From dce21d84b3ad83946b17343aee297a4982895c87 Mon Sep 17 00:00:00 2001 From: Ben Date: Sat, 27 Jun 2015 18:08:06 +0100 Subject: [PATCH] Major UI overhaul, implemented FluentRibbon --- Filtration.Interface/IDocument.cs | 4 +- .../TestItemFilterBlockTranslator.cs | 103 +++++++++++++ .../ViewModels/ThemeViewModel.cs | 2 +- Filtration/App.xaml | 16 +- .../Converters/BooleanVisibilityConverter.cs | 25 ++- .../BooleanVisibilityConverterCopy.cs | 43 ++++++ Filtration/Filtration.csproj | 24 ++- Filtration/Resources/Icons/Copy.ico | Bin 0 -> 5430 bytes Filtration/Resources/Icons/Paste.ico | Bin 0 -> 5430 bytes Filtration/Resources/Icons/PasteStyle.ico | Bin 0 -> 5430 bytes Filtration/Resources/Icons/ReplaceColors.ico | Bin 0 -> 5430 bytes Filtration/Resources/Icons/Theme.ico | Bin 0 -> 5430 bytes Filtration/Resources/Icons/copy_icon.png | Bin 194 -> 0 bytes Filtration/Resources/Icons/paste_icon.png | Bin 265 -> 0 bytes .../Resources/Icons/replace_colors_icon.png | Bin 325 -> 0 bytes Filtration/Resources/Icons/settings_icon.png | Bin 0 -> 870 bytes Filtration/Resources/Icons/theme_icon.png | Bin 235 -> 0 bytes .../Translators/ItemFilterBlockTranslator.cs | 69 ++++++++- .../UserControls/ItemPreviewControl.xaml | 36 +++-- .../UserControls/ItemPreviewControl.xaml.cs | 31 ++-- .../ViewModels/ItemFilterBlockViewModel.cs | 31 +++- .../ViewModels/ItemFilterScriptViewModel.cs | 87 ++++++++++- Filtration/ViewModels/MainWindowViewModel.cs | 145 ++++++++++++++++-- Filtration/Views/AboutWindow.xaml | 11 +- Filtration/Views/IconsDictionary.xaml | 10 +- Filtration/Views/ItemFilterBlockView.xaml | 59 ++++++- Filtration/Views/ItemFilterScriptView.xaml | 31 +--- Filtration/Views/ItemFilterSectionView.xaml | 8 +- Filtration/Views/MainWindow.xaml | 141 ++++++++++------- Filtration/Views/ReplaceColorsWindow.xaml | 7 +- Filtration/Views/SettingsWindow.xaml | 8 +- .../Views/SharedResourcesDictionary.xaml | 2 +- Filtration/packages.config | 4 +- 33 files changed, 712 insertions(+), 185 deletions(-) create mode 100644 Filtration/Converters/BooleanVisibilityConverterCopy.cs create mode 100644 Filtration/Resources/Icons/Copy.ico create mode 100644 Filtration/Resources/Icons/Paste.ico create mode 100644 Filtration/Resources/Icons/PasteStyle.ico create mode 100644 Filtration/Resources/Icons/ReplaceColors.ico create mode 100644 Filtration/Resources/Icons/Theme.ico delete mode 100644 Filtration/Resources/Icons/copy_icon.png delete mode 100644 Filtration/Resources/Icons/paste_icon.png delete mode 100644 Filtration/Resources/Icons/replace_colors_icon.png create mode 100644 Filtration/Resources/Icons/settings_icon.png delete mode 100644 Filtration/Resources/Icons/theme_icon.png diff --git a/Filtration.Interface/IDocument.cs b/Filtration.Interface/IDocument.cs index 68d218e..e27b2ec 100644 --- a/Filtration.Interface/IDocument.cs +++ b/Filtration.Interface/IDocument.cs @@ -1,6 +1,4 @@ -using System.Windows.Media; - -namespace Filtration.Interface +namespace Filtration.Interface { public interface IDocument { diff --git a/Filtration.Tests/Translators/TestItemFilterBlockTranslator.cs b/Filtration.Tests/Translators/TestItemFilterBlockTranslator.cs index c844577..4393ff5 100644 --- a/Filtration.Tests/Translators/TestItemFilterBlockTranslator.cs +++ b/Filtration.Tests/Translators/TestItemFilterBlockTranslator.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Windows.Media; using Filtration.ObjectModel; @@ -1325,6 +1326,108 @@ namespace Filtration.Tests.Translators Assert.AreEqual(expectedResult, result); } + [Test] + public void ReplaceColorBlockItemsFromString_SingleLine_ReplacesColorBlock() + { + // Arrange + var testInputString = "SetTextColor 240 200 150 # Rarest Currency"; + + var testInputBlockItems = new ObservableCollection(); + var testInputBlockItem = new TextColorBlockItem(Colors.Red); + testInputBlockItems.Add(testInputBlockItem); + + // Act + _testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString); + + // Assert + var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem; + Assert.IsNotNull(textColorBlockItem); + Assert.AreNotSame(testInputBlockItem, textColorBlockItem); + Assert.AreEqual(new Color { R = 240, G = 200, B = 150, A = 255}, textColorBlockItem.Color); + } + + [Test] + public void ReplaceColorBlockItemsFromString_MalformedLine_DoesNothing() + { + // Arrange + var testInputString = "SetTextCsaolor 240 200 150 # Rarest Currency"; + + var testInputBlockItems = new ObservableCollection(); + var testInputBlockItem = new TextColorBlockItem(Colors.Red); + testInputBlockItems.Add(testInputBlockItem); + + // Act + _testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString); + + // Assert + var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem; + Assert.IsNotNull(textColorBlockItem); + Assert.AreSame(testInputBlockItem, textColorBlockItem); + } + + [Test] + public void ReplaceColorBlockItemsFromString_MultipleLines_ExistingBlockItems() + { + // Arrange + var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine + + "SetBackgroundColor 0 0 0 # Rarest Currency Background" + Environment.NewLine + + "SetBorderColor 255 255 255 # Rarest Currency Border"; + + var testInputBlockItems = new ObservableCollection(); + var testInputTextColorBlockItem = new TextColorBlockItem(Colors.Red); + var testInputBackgroundColorBlockItem = new BackgroundColorBlockItem(Colors.Blue); + var testInpuBorderColorBlockItem = new BorderColorBlockItem(Colors.Yellow); + testInputBlockItems.Add(testInputTextColorBlockItem); + testInputBlockItems.Add(testInputBackgroundColorBlockItem); + testInputBlockItems.Add(testInpuBorderColorBlockItem); + + // Act + _testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString); + + // Assert + var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem; + Assert.IsNotNull(textColorBlockItem); + Assert.AreNotSame(testInputTextColorBlockItem, textColorBlockItem); + Assert.AreEqual(new Color {A = 255, R = 240, G = 200, B = 150}, textColorBlockItem.Color); + + var backgroundColorBlockItem = testInputBlockItems.First(b => b is BackgroundColorBlockItem) as BackgroundColorBlockItem; + Assert.IsNotNull(backgroundColorBlockItem); + Assert.AreNotSame(testInputBackgroundColorBlockItem, backgroundColorBlockItem); + Assert.AreEqual(new Color { A = 255, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color); + + var borderColorBlockItem = testInputBlockItems.First(b => b is BorderColorBlockItem) as BorderColorBlockItem; + Assert.IsNotNull(borderColorBlockItem); + Assert.AreNotSame(testInpuBorderColorBlockItem, borderColorBlockItem); + Assert.AreEqual(new Color { A = 255, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color); + } + + [Test] + public void ReplaceColorBlockItemsFromString_MultipleLines_NoExistingBlockItems() + { + // Arrange + var testInputString = "SetTextColor 240 200 150 # Rarest Currency" + Environment.NewLine + + "SetBackgroundColor 0 0 0 # Rarest Currency Background" + Environment.NewLine + + "SetBorderColor 255 255 255 # Rarest Currency Border"; + + var testInputBlockItems = new ObservableCollection(); + + // Act + _testUtility.Translator.ReplaceColorBlockItemsFromString(testInputBlockItems, testInputString); + + // Assert + var textColorBlockItem = testInputBlockItems.First(b => b is TextColorBlockItem) as TextColorBlockItem; + Assert.IsNotNull(textColorBlockItem); + Assert.AreEqual(new Color { A = 255, R = 240, G = 200, B = 150 }, textColorBlockItem.Color); + + var backgroundColorBlockItem = testInputBlockItems.First(b => b is BackgroundColorBlockItem) as BackgroundColorBlockItem; + Assert.IsNotNull(backgroundColorBlockItem); + Assert.AreEqual(new Color { A = 255, R = 0, G = 0, B = 0 }, backgroundColorBlockItem.Color); + + var borderColorBlockItem = testInputBlockItems.First(b => b is BorderColorBlockItem) as BorderColorBlockItem; + Assert.IsNotNull(borderColorBlockItem); + Assert.AreEqual(new Color { A = 255, R = 255, G = 255, B = 255 }, borderColorBlockItem.Color); + } + private class ItemFilterBlockTranslatorTestUtility { public ItemFilterBlockTranslatorTestUtility() diff --git a/Filtration.ThemeEditor/ViewModels/ThemeViewModel.cs b/Filtration.ThemeEditor/ViewModels/ThemeViewModel.cs index 6d9dc6e..eb4befa 100644 --- a/Filtration.ThemeEditor/ViewModels/ThemeViewModel.cs +++ b/Filtration.ThemeEditor/ViewModels/ThemeViewModel.cs @@ -36,7 +36,7 @@ namespace Filtration.ThemeEditor.ViewModels var icon = new BitmapImage(); icon.BeginInit(); - icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/theme_icon.png"); + icon.UriSource = new Uri("pack://application:,,,/Filtration;component/Resources/Icons/Theme.ico"); icon.EndInit(); IconSource = icon; } diff --git a/Filtration/App.xaml b/Filtration/App.xaml index ad4d7cf..2165bdd 100644 --- a/Filtration/App.xaml +++ b/Filtration/App.xaml @@ -5,14 +5,18 @@ - - - - - + + - \ No newline at end of file + + + + \ No newline at end of file diff --git a/Filtration/Converters/BooleanVisibilityConverter.cs b/Filtration/Converters/BooleanVisibilityConverter.cs index ba451d8..153b4c2 100644 --- a/Filtration/Converters/BooleanVisibilityConverter.cs +++ b/Filtration/Converters/BooleanVisibilityConverter.cs @@ -9,7 +9,30 @@ namespace Filtration.Converters { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - return (bool)value ? Visibility.Visible : Visibility.Collapsed; + if (value is bool && targetType == typeof (Visibility)) + { + var val = (bool) value; + if (val) + { + return Visibility.Visible; + } + if (parameter is Visibility) + { + return parameter; + } + return Visibility.Collapsed; + } + if (value != null) + { + return Visibility.Visible; + } + + + if (parameter is Visibility) + { + return parameter; + } + return Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Filtration/Converters/BooleanVisibilityConverterCopy.cs b/Filtration/Converters/BooleanVisibilityConverterCopy.cs new file mode 100644 index 0000000..3be867a --- /dev/null +++ b/Filtration/Converters/BooleanVisibilityConverterCopy.cs @@ -0,0 +1,43 @@ +using System; +using System.Globalization; +using System.Windows; +using System.Windows.Data; + +namespace Filtration.Converters +{ + internal class BooleanVisibilityConverterCopy : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool && targetType == typeof (Visibility)) + { + var val = (bool) value; + if (val) + { + return Visibility.Visible; + } + if (parameter is Visibility) + { + return parameter; + } + return Visibility.Collapsed; + } + if (value != null) + { + return Visibility.Visible; + } + + + if (parameter is Visibility) + { + return parameter; + } + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index a681a54..9408166 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -53,6 +53,12 @@ ..\packages\Castle.Windsor.3.3.0\lib\net45\Castle.Windsor.dll + + ..\packages\Fluent.Ribbon.3.4.0\lib\net45\Fluent.dll + + + ..\packages\FontAwesome.WPF.4.3.0.3\lib\FontAwesome.WPF.dll + False ..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.dll @@ -61,9 +67,6 @@ False ..\packages\MvvmLightLibs.5.1.1.0\lib\net45\GalaSoft.MvvmLight.Platform.dll - - ..\packages\MahApps.Metro.1.1.2.0\lib\net45\MahApps.Metro.dll - @@ -75,7 +78,9 @@ ..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Layout.Toolkit.dll - + + ..\packages\Fluent.Ribbon.3.4.0\lib\net45\System.Windows.Interactivity.dll + @@ -124,6 +129,7 @@ + @@ -346,10 +352,8 @@ - - @@ -361,7 +365,6 @@ - @@ -369,8 +372,13 @@ - + + + + + + Always diff --git a/Filtration/Resources/Icons/Copy.ico b/Filtration/Resources/Icons/Copy.ico new file mode 100644 index 0000000000000000000000000000000000000000..bcba93f30e4dc3ea2379f776c31118959430e22b GIT binary patch literal 5430 zcmeHLF>b>!45XU?8Ji!(Q_&Z6P39K;N7rOG9P|NwN7rs0{ffLGQ>H$kfXcH$lvPDZ zj*TDzLf|5sI`Sw=@(`keZfIT-k0rfKiSCG~Ty^j7bD}r)-LsD$nbG-qAY%WiY_r+8 z6k@d?HfER~BR*6k@{0aP_2_({F3}gBU#sO8UT(avjdz$IuX!@x5{(}}-ls|Zl2>xV zFR=O~+)&QlZs*qP^?~uA<3rq#Psi$bU8m?voq7~q#KJHavTip08;Xa|uhYt;Ytzqu zomTu%zvEl4(R@WzCOEL$evyMKi>Jv?LBy6R{!Bo0jCC>A%^(S>C4TV%d=`6Q-AFKTQzI{ zIjvvUmHV92f2*(1(CfE&A-~j@qc7ahsP#khDc>dNhx!K}Ot0VKX)gFaPIdovt^57n z)pdQSs_N;~`YCPHqiePL>i56hkjM{m=4ku+k(7V-KgPox^kY5O`=Hk!%L`r~So^KD z{q@KCZ`J1K>-(O&eoG(meKj?|kG|D^ov-h+*0=hvzbn#*-1D8PN9#*&YZUHS+Ne!( zTAJDq?wH!g=;z++RNrMDYwCmCdoB6Tb!_+bi)Jo@W=^w)|7FO)Eprx(C8KU==^9!n N;Js!z*A(4}`T>^murmMv literal 0 HcmV?d00001 diff --git a/Filtration/Resources/Icons/Paste.ico b/Filtration/Resources/Icons/Paste.ico new file mode 100644 index 0000000000000000000000000000000000000000..4487f9817c1d12a91b30fe957a653f84bf7c9cdc GIT binary patch literal 5430 zcmeHL%W4}z5NySP9A(G{L?@Gv$id$c2;`WX9yfurkASX8{=kq^{vaoV?ThjoA{Rel zgTcg*WZdPY$S_RrYBt(SqK2k-s;jz2BWaK=GLT2II})uUdGlCgPeexh_4@O!$a}?} zE2fXisBtYKil@eGHgiphdF9F3mv^TZE==^GwE{hGLLJxtqCPy!)Ys4RoX_Xq$K&zq zE_!GulgTS+5j^j(q8IKL>*;j*5!&83)#E<29$FmW*mP;-KzloyN-DH|_$Ko4X`R1v zk)N8lXGWU)nz)Z10vAtDQ51#ilAGF2mSrpJKC^J_H}pSPUX9-_uWqxi*KXa!4E4XZ zd@MZXuiiK7`jQ9#JkKl3$HHU&oS9O${@e54e*XUZ@87L;&sg{-?;p%+3iM-%yUUN1 zdyib`*YW56R;!g;EEYHVoq6GV@;ii724sk{s7z}4?<7W3eoSPvTXIS1bO+k%?Esr2KF za810gO24r7S7$jSze6^Eo)6SPK>`PE6B&_AkWovo~e&W~EPjoqrr{J1+O$+0(&oB5u$?4KPt zo_kNu@BDuEzMGq;B&A8uNLhIj#60QKXC>(sNs{vR#^f>`3Ew;;sBkCT6r3gB#=Nl|vuj4?A|Kvw3^5=t<&YJh8Jl1#e`5uI0k8Ko&`QGYx zo4vAeq4#WQd{4xVi? znbHB%Tv=Jk&?_n`#>>jeUgq&{n6Agrq8JW`hY&+}jL`2Ek4LZw8*2)Gjw$u8TRuCs zKs^8-R^zEw6ybdQY*A{BfQu&hlkoihsmIt4xneym7PAO1;^cFr755$X!m3w4kH;S6 z<>l3sLmt`}QN+)w7O`aR{+S-kqxJRmv8t-7q&_&u{POBreEm>Q*i;eLbuO_#=TgIfP}tAf90!n1BtYY3h+#kleNGC9)Af?s@a%`r5) zpYO3%e(VJrdKx^QjGyYwJw2xntzGwj!*2GTU*|^tzZV~}KyAr_V{mrIR{61?z*_K( z1?xW?zS?$bd2MYqspRf&L(73W(-lbOfZlo1u$lEIHBO$mJ(hxuV4Z0s^j+nn@Z=4) z5?x}G*9KMtbtU&Zl%hR~qU1XQH+F%Ban$gH`B6=^M=5;1yQcUAocW3F&krmGjvpLM zaPM|Ho%5if-`3K-6VCMTR`}KD4d)5-Lwu9(4V*DBPOnyT=l`lK~o<)Ecz%V?Qmtd<|mgS;B9z5C2zyv*6=3=;6nHdX4xoA{V@aW`Kra z(x8=J{ocRPoOG)Bk?vBSD2MOvcxT`~p!N6n3!edDMb8B> zXxIaLVNa^xY9v1Dqn=a#X+`2w$EU@o?hD^rrbn2u8}9&fWx@eZXAw!tP3;Br m**2(22Tuc+1fB)CZ19)BbHE9g8%cBJvS>47k=(emxcvjBzAVuI literal 0 HcmV?d00001 diff --git a/Filtration/Resources/Icons/ReplaceColors.ico b/Filtration/Resources/Icons/ReplaceColors.ico new file mode 100644 index 0000000000000000000000000000000000000000..100e18fe68584f6a2e0f65c4ca562c4b12fcfab2 GIT binary patch literal 5430 zcmeHK-Ahwp7=QZ!2?jG^U`=dv5z*E3ADBeTtzdWOT57t9&_%ka(DG(rNSlEXNP^(H zh(Wl>bu9=&FdE1fqoM7r(OfX-vJ3I_{G87`y_=5XXMqQPJkR@lyuast&UxQ+ju5BB zY0+#GByFPqtPod(5Vo$$_-(TgVX|E%8>tjgv6B#j>_>H798^8lp?uLA$g39yRi{y2 zYd|fxJ@~Exq-Xb+pILR)}h?>-SRt>l&eEY7b{4)c8Y!X*zJssxU&Fs zj-$Lnr}9MuptD_;lvjNJGseZ znAlk30lz%lpu1z0~Jj`12W~^BIjl?*6yl`)Z*cta8s;!Umtw z_2}d6%4bWblAfaXZHADxE9uG0N}^_8Sq4%j+IK>KR&hU2yOR7VS1{^i}l(=V@ zQEWto@9=z*Mn{QRj`yk1$_l~ho! zx6#;W|M8sDea_0<=zW{AbgmJf>^J)SA)oeu32UV~mWX$e^rw5_=30#GKh8Ok|4s*# z=!)4pUkcGbLvjn_u%bIKAvIiLPzrkPWg=!qQPXiV$O z$hn Jf&)H%>>oR*@Mr)4 literal 0 HcmV?d00001 diff --git a/Filtration/Resources/Icons/Theme.ico b/Filtration/Resources/Icons/Theme.ico new file mode 100644 index 0000000000000000000000000000000000000000..00ead80c227b50e63cd1a5e1f54ed82c34e8e769 GIT binary patch literal 5430 zcmc&&F=!M)6dlFFGNt9&h?apA30OqI!hVz*+qs?HIb&{^n`WtI z$kxoOTgKco#?;ow{^uoQPN?rb^-+@|#{FcBp?+81y?Obks@i`P!A1JuBDT@-fejCv zHrTG)-Nu@2HkQ5iV8t+^&hMW`g=T@8!D>1m_(cTs^5&n%Hh6l6Ro8L*fZu+!#36eA zf{%DDt`Gch5~K5lzu;-B>jA&>>_H|z1_V>A&If+9y_U`={vwhmR{CLqAMe$bboBQGEK&5KXZ;vxk6gO%G1<*q+Ed#$ah z!mn=(rV79LC7LSyc&9y8_=EHMRN-%)B~yhD{z1-r^1AVvf6jaMy78I64}XE{-(JmL zf2`4U3i!7lrt$TA67N^7?tJu^v?WG-vC=OV>)(Eo{hcFmS^4fb;zV>CeXfr_@b`Tu z;a%*CFJEFX=8n(ukqiD|<1Ux+J^xZ4)~)A``Nq+wRp+41{5R6yd3yaNN9u^LZQhu~ zA;uN(?>t}T?pgd1Bsf0n)^_n+AMxPddEvqLtUuxf7i|$=pF8HmMhy5zJC8ZM2!8~+ zwes+}aLxt%qt|JC-}+0LdE$frtnYlm6|4E`wv3mt;2-a&&k4TgU)Pm;P!%8iyGL7G zy6E~NxC}nH=yMS;!CNfOIuMPYxBeVVm!jPHUM7jPqmdo``ff)*zS`lpKAqn;`HaF?$LJ@&S?|H1g_v`JpVk=k{8WCA^x4CT{<65&WID6 z!Y}wgLy@U4{v|~c|L8s8o(AJH=IP|DNxq9;Wc`a^BS!egCzEsS$B^;+Wci#+7INkO y&zXM@m}j9KoOQf5g-`2`d5hwHNE^1a|EXgKr2P!*;=^CG$o>DH*7-YN;qG6>sZ%Kc literal 0 HcmV?d00001 diff --git a/Filtration/Resources/Icons/copy_icon.png b/Filtration/Resources/Icons/copy_icon.png deleted file mode 100644 index 8ff40a0fc6f034170439f61e6c725774e681c781..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 194 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9F5M?jcysy3fAP_V?) z#WAEJ?&yV$Tnz?1EEl>{GWW0T{x$d2q251K|Mn&RjP6`q+X=YmQ+7-$7Y{TZdjt z+>OkBxWV4-;Z4i-XTQT8^8UpF_en%SRCr#clQFJ?Fc3s@gdF9cfu1|0pyvvah$x9DiRkG*1qUGo zJ#-|ZaByrWoyz60_?xDQy`@m+c|JJ9IwYk$_I=NS zAW)v?DOB`#psi^b1{KG#>bg$puof}^z*rTAp(={Pwg;#i05wg6mp{T)Rk;B;9bsHU zLww&S|6rp5K*P}ecBd9_U&&|Lg#uDa8eKdEGIjvxPdX_{&hVH3 zo diff --git a/Filtration/Resources/Icons/settings_icon.png b/Filtration/Resources/Icons/settings_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..eb7b43cd2a5807b88075375db79a8ea594b5481b GIT binary patch literal 870 zcmV-s1DX7ZP)y>_zLSHy=Irp6N-h0k> zPHs|?5SN#iPeh~@*j}5NnfWLQke1{qC*Mnc0B)L(WYN*x5|I_wl}bgHmzNRN0@%aG z@mVBRk^|rb$q-NF}K8B$D$;@;f^_((m`h zVrgkf>h-$Xf$UYjk+gerB|kVgAiV5B5iAK z$q~R!Yqc7|p6q{r+nP3*!+jzPmpFe$(Z(k1)*67#^-Cp-5 z!7gBcn0}X1sU$AuvUBqO-3KWa@5}7$tSDHcV-FhxFBTkjSfx1yU}TDS_+TiKI&gT6V%|3qfvCc~G(Ba(w(#wzgg)tZg>16$4^vE4vf3 zMFxKBZ0GbLP-lWG`S#mwvDkdIDGLktGz;?R@k0rLIPG@Zc7Yi3pp)Ovz}H=+Oi6!^ z{Q%QKI_askTrQZNiL+@BKusEr20iN?M(eJi*3^9d&OB|W^>=K2Qewja*Uf1|CQ~G< zB66EI9n%WKLZKiA1f=C4_$N6w*cuQ^$tQ5Y1t;A0$LQRS$-!VCE>0(>+)jqW@7{|D z9edaqc(LGs%e;vE*AO>ga7+{X`}>s9c@_C>_)H%V(*`juha&AfNb>p$nlfxmeQkRg zI7dS70a~cpZ1P1*2<%~ltpj3uJnoBVOnuZCQDW-Hi#M0c$@=>GUt19!KGanMpx|6j z7srr_xU-WCxsE7^xY*9#yJ79!dpZ0MHQ&7bF0g1?o2J@}mX0@Of_9A`o~`_!J#TB) z+S=vQn6lrlddIqS3O}o+YD2Kbu?nsOafdhzJAxRyWsHJvSYF@z{m#RsP1kNo#~UR0 za~@uCaSc=6vOSH00UQgT&)I(~AXi3W!wH4o|2em??|EOw?`B-jmpuEJ)}7KRRW-E^ h%HJ{tCUyuL* diff --git a/Filtration/Translators/ItemFilterBlockTranslator.cs b/Filtration/Translators/ItemFilterBlockTranslator.cs index aae6375..c4f2ecc 100644 --- a/Filtration/Translators/ItemFilterBlockTranslator.cs +++ b/Filtration/Translators/ItemFilterBlockTranslator.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.IO; using System.Linq; using System.Text.RegularExpressions; @@ -17,6 +18,7 @@ namespace Filtration.Translators { ItemFilterBlock TranslateStringToItemFilterBlock(string inputString); string TranslateItemFilterBlockToString(ItemFilterBlock block); + void ReplaceColorBlockItemsFromString(ObservableCollection blockItems, string inputString); } internal class ItemFilterBlockTranslator : IItemFilterBlockTranslator @@ -260,26 +262,30 @@ namespace Filtration.Translators } private void AddColorItemToBlockItems(ItemFilterBlock block, string inputString) where T : ColorBlockItem + { + block.BlockItems.Add(GetColorBlockItemFromString(inputString)); + } + + private T GetColorBlockItemFromString(string inputString) where T: ColorBlockItem { var blockItem = Activator.CreateInstance(); var result = Regex.Matches(inputString, @"([\w\s]*)[#]?(.*)"); - // When Theme support is added result[0].Groups[2].Value will contain the ColorGroup in the comment if it exists. blockItem.Color = GetColorFromString(result[0].Groups[1].Value); - + var componentName = result[0].Groups[2].Value.Trim(); if (!string.IsNullOrEmpty(componentName)) { ThemeComponentType componentType; - if (typeof (T) == typeof (TextColorBlockItem)) + if (typeof(T) == typeof(TextColorBlockItem)) { componentType = ThemeComponentType.TextColor; } - else if (typeof (T) == typeof (BackgroundColorBlockItem)) + else if (typeof(T) == typeof(BackgroundColorBlockItem)) { componentType = ThemeComponentType.BackgroundColor; } - else if (typeof (T) == typeof (BorderColorBlockItem)) + else if (typeof(T) == typeof(BorderColorBlockItem)) { componentType = ThemeComponentType.BorderColor; } @@ -291,7 +297,58 @@ namespace Filtration.Translators blockItem.ThemeComponent = _themeComponentListBuilder.AddComponent(componentType, componentName, blockItem.Color); } - block.BlockItems.Add(blockItem); + return blockItem; + } + + public void ReplaceColorBlockItemsFromString(ObservableCollection blockItems , string inputString) + { + foreach (var line in new LineReader(() => new StringReader(inputString))) + { + var matches = Regex.Match(line, @"(\w+)"); + + switch (matches.Value) + { + case "SetTextColor": + { + ReplaceColorBlockItem(blockItems, line); + break; + } + case "SetBackgroundColor": + { + ReplaceColorBlockItem(blockItems, line); + break; + } + case "SetBorderColor": + { + ReplaceColorBlockItem(blockItems, line); + break; + } + case "SetFontSize": + { + ReplaceFontSizeBlockItem(blockItems, line); + break; + } + } + } + } + + private void ReplaceColorBlockItem(ObservableCollection blockItems, string inputString) where T : ColorBlockItem + { + var newBlockItem = GetColorBlockItemFromString(inputString); + var existingBlockItem = blockItems.OfType().FirstOrDefault(); + blockItems.Remove(existingBlockItem); + blockItems.Add(newBlockItem); + } + + private void ReplaceFontSizeBlockItem(ObservableCollection blockItems, string inputString) + { + var match = Regex.Match(inputString, @"\s+(\d+)"); + if (!match.Success) return; + + var newBlockItem = new FontSizeBlockItem(Convert.ToInt16(match.Value)); + var existingBlockItem = blockItems.OfType().FirstOrDefault(); + blockItems.Remove(existingBlockItem); + blockItems.Add(newBlockItem); } private void AddBlockGroupToBlock(ItemFilterBlock block, string inputString) diff --git a/Filtration/UserControls/ItemPreviewControl.xaml b/Filtration/UserControls/ItemPreviewControl.xaml index a7d0822..94f4d14 100644 --- a/Filtration/UserControls/ItemPreviewControl.xaml +++ b/Filtration/UserControls/ItemPreviewControl.xaml @@ -10,17 +10,31 @@ - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Filtration/UserControls/ItemPreviewControl.xaml.cs b/Filtration/UserControls/ItemPreviewControl.xaml.cs index b39eb8f..2a753d4 100644 --- a/Filtration/UserControls/ItemPreviewControl.xaml.cs +++ b/Filtration/UserControls/ItemPreviewControl.xaml.cs @@ -33,6 +33,13 @@ namespace Filtration.UserControls new FrameworkPropertyMetadata() ); + public static readonly DependencyProperty BlockFontSizeProperty = DependencyProperty.Register( + "BlockFontSize", + typeof(int), + typeof(ItemPreviewControl), + new FrameworkPropertyMetadata() + ); + public Color TextColor { get { return (Color) GetValue(TextColorProperty); } @@ -50,25 +57,11 @@ namespace Filtration.UserControls get { return (Color)GetValue(BorderColorProperty); } set { SetValue(BorderColorProperty, value); } } - - //private static void OnItemPreviewControlPropertyChanged(DependencyObject source, - // DependencyPropertyChangedEventArgs e) - //{ - // var control = source as ItemPreviewControl; - // if (control == null) return; - // control.OnPropertyChanged("TextColor"); - // control.OnPropertyChanged("BackgroundColor"); - // control.OnPropertyChanged("BorderColor"); - //} - - //public event PropertyChangedEventHandler PropertyChanged; - - //[NotifyPropertyChangedInvocator] - //protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) - //{ - // var handler = PropertyChanged; - // if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); - //} + public int BlockFontSize + { + get { return (int)GetValue(BlockFontSizeProperty); } + set { SetValue(BlockFontSizeProperty, value); } + } } } diff --git a/Filtration/ViewModels/ItemFilterBlockViewModel.cs b/Filtration/ViewModels/ItemFilterBlockViewModel.cs index 35d8cd3..cf2d5a5 100644 --- a/Filtration/ViewModels/ItemFilterBlockViewModel.cs +++ b/Filtration/ViewModels/ItemFilterBlockViewModel.cs @@ -19,7 +19,9 @@ namespace Filtration.ViewModels { void Initialise(ItemFilterBlock itemFilterBlock, ItemFilterScriptViewModel parentScriptViewModel); bool IsDirty { get; set; } + bool IsExpanded { get; set; } ItemFilterBlock Block { get; } + void RefreshBlockPreview(); } internal class ItemFilterBlockViewModel : FiltrationViewModelBase, IItemFilterBlockViewModel @@ -38,6 +40,8 @@ namespace Filtration.ViewModels CopyBlockCommand = new RelayCommand(OnCopyBlockCommand); PasteBlockCommand = new RelayCommand(OnPasteBlockCommand); + CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand); + PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand); AddBlockCommand = new RelayCommand(OnAddBlockCommand); AddSectionCommand = new RelayCommand(OnAddSectionCommand); DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand); @@ -74,6 +78,8 @@ namespace Filtration.ViewModels public RelayCommand CopyBlockCommand { get; private set; } public RelayCommand PasteBlockCommand { get; private set; } + public RelayCommand CopyBlockStyleCommand { get; private set; } + public RelayCommand PasteBlockStyleCommand { get; private set; } public RelayCommand AddBlockCommand { get; private set; } public RelayCommand AddSectionCommand { get; private set; } public RelayCommand DeleteBlockCommand { get; private set; } @@ -90,7 +96,9 @@ namespace Filtration.ViewModels public RelayCommand PlaySoundCommand { get; private set; } public ItemFilterBlock Block { get; private set; } + public bool IsDirty { get; set; } + public bool IsExpanded { get; set; } public ObservableCollection BlockItems { @@ -228,7 +236,7 @@ namespace Filtration.ViewModels { return HasTextColor ? BlockItems.OfType().First().Color - : new Color { A = 255, R = 255, G = 255, B = 255 }; + : new Color { A = 255, R = 200, G = 200, B = 200 }; } } @@ -267,6 +275,12 @@ namespace Filtration.ViewModels get { return Block.HasBlockItemOfType(); } } + public int DisplayFontSize + { + // Dividing by 1.8 roughly scales in-game font sizes down to WPF sizes + get { return HasFontSize ? (int)(BlockItems.OfType().First().Value / 1.8) : 19; } + } + public bool HasSound { get { return Block.HasBlockItemOfType(); } @@ -325,6 +339,15 @@ namespace Filtration.ViewModels _parentScriptViewModel.PasteBlock(this); } + private void OnCopyBlockStyleCommand() + { + _parentScriptViewModel.CopyBlockStyle(this); + } + + private void OnPasteBlockStyleCommand() + { + _parentScriptViewModel.PasteBlockStyle(this); + } private void OnAddBlockCommand() { @@ -383,10 +406,16 @@ namespace Filtration.ViewModels } private void OnAudioVisualBlockItemChanged(object sender, EventArgs e) + { + RefreshBlockPreview(); + } + + public void RefreshBlockPreview() { RaisePropertyChanged("DisplayTextColor"); RaisePropertyChanged("DisplayBackgroundColor"); RaisePropertyChanged("DisplayBorderColor"); + RaisePropertyChanged("DisplayFontSize"); RaisePropertyChanged("HasSound"); } diff --git a/Filtration/ViewModels/ItemFilterScriptViewModel.cs b/Filtration/ViewModels/ItemFilterScriptViewModel.cs index d27f934..c764d14 100644 --- a/Filtration/ViewModels/ItemFilterScriptViewModel.cs +++ b/Filtration/ViewModels/ItemFilterScriptViewModel.cs @@ -37,10 +37,28 @@ namespace Filtration.ViewModels void RemoveDirtyFlag(); void SetDirtyFlag(); + RelayCommand AddBlockCommand { get; } + RelayCommand AddSectionCommand { get; } + RelayCommand DeleteBlockCommand { get; } + RelayCommand MoveBlockUpCommand { get; } + RelayCommand MoveBlockDownCommand { get; } + RelayCommand MoveBlockToTopCommand { get; } + RelayCommand MoveBlockToBottomCommand { get;} + RelayCommand CopyBlockCommand { get; } + RelayCommand PasteBlockCommand { get; } + RelayCommand CopyBlockStyleCommand { get; } + RelayCommand PasteBlockStyleCommand { get; } + RelayCommand ExpandAllBlocksCommand { get; } + RelayCommand CollapseAllBlocksCommand { get; } + RelayCommand ToggleShowAdvancedCommand { get; } + RelayCommand ClearFilterCommand { get; } + void AddSection(IItemFilterBlockViewModel targetBlockViewModel); void AddBlock(IItemFilterBlockViewModel targetBlockViewModel); void CopyBlock(IItemFilterBlockViewModel targetBlockViewModel); + void CopyBlockStyle(IItemFilterBlockViewModel targetBlockViewModel); void PasteBlock(IItemFilterBlockViewModel targetBlockViewModel); + void PasteBlockStyle(IItemFilterBlockViewModel targetBlockViewModel); } internal class ItemFilterScriptViewModel : PaneViewModel, IItemFilterScriptViewModel @@ -80,7 +98,11 @@ namespace Filtration.ViewModels AddBlockCommand = new RelayCommand(OnAddBlockCommand); AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => SelectedBlockViewModel != null); CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => SelectedBlockViewModel != null); + CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => SelectedBlockViewModel != null); PasteBlockCommand = new RelayCommand(OnPasteBlockCommand, () => SelectedBlockViewModel != null); + PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => SelectedBlockViewModel != null); + ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand); + CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand); var icon = new BitmapImage(); icon.BeginInit(); @@ -100,7 +122,11 @@ namespace Filtration.ViewModels public RelayCommand AddBlockCommand { get; private set; } public RelayCommand AddSectionCommand { get; private set; } public RelayCommand CopyBlockCommand { get; private set; } + public RelayCommand CopyBlockStyleCommand { get; private set; } public RelayCommand PasteBlockCommand { get; private set; } + public RelayCommand PasteBlockStyleCommand { get; private set; } + public RelayCommand ExpandAllBlocksCommand { get; private set; } + public RelayCommand CollapseAllBlocksCommand { get; private set; } public ObservableCollection ItemFilterBlockViewModels { @@ -444,6 +470,44 @@ namespace Filtration.ViewModels Clipboard.SetText(_blockTranslator.TranslateItemFilterBlockToString(SelectedBlockViewModel.Block)); } + private void OnCopyBlockStyleCommand() + { + CopyBlockStyle(SelectedBlockViewModel); + } + + public void CopyBlockStyle(IItemFilterBlockViewModel targetBlockViewModel) + { + string outputText = string.Empty; + + foreach (var blockItem in targetBlockViewModel.Block.BlockItems.Where(b => b is IAudioVisualBlockItem)) + { + if (outputText != string.Empty) + { + outputText += Environment.NewLine; + } + outputText += blockItem.OutputText; + } + + Clipboard.SetText(outputText); + } + + private void OnPasteBlockStyleCommand() + { + PasteBlockStyle(SelectedBlockViewModel); + } + + public void PasteBlockStyle(IItemFilterBlockViewModel targetBlockViewModel) + { + var clipboardText = Clipboard.GetText(); + if (string.IsNullOrEmpty(clipboardText)) + { + return; + } + + _blockTranslator.ReplaceColorBlockItemsFromString(targetBlockViewModel.Block.BlockItems, clipboardText); + targetBlockViewModel.RefreshBlockPreview(); + } + private void OnPasteBlockCommand() { PasteBlock(SelectedBlockViewModel); @@ -479,7 +543,6 @@ namespace Filtration.ViewModels private void OnMoveBlockToTopCommand() { MoveBlockToTop(SelectedBlockViewModel); - } public void MoveBlockToTop(IItemFilterBlockViewModel targetBlockViewModel) @@ -589,20 +652,36 @@ namespace Filtration.ViewModels { AddSection(SelectedBlockViewModel); } - + public void AddSection(IItemFilterBlockViewModel targetBlockViewModel) { var vm = _itemFilterBlockViewModelFactory.Create(); var newSection = new ItemFilterSection { Description = "New Section" }; vm.Initialise(newSection, this); - Script.ItemFilterBlocks.Insert(Script.ItemFilterBlocks.IndexOf(targetBlockViewModel.Block) + 1, newSection); - ItemFilterBlockViewModels.Insert(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel) + 1, vm); + Script.ItemFilterBlocks.Insert(Script.ItemFilterBlocks.IndexOf(targetBlockViewModel.Block), newSection); + ItemFilterBlockViewModels.Insert(ItemFilterBlockViewModels.IndexOf(targetBlockViewModel), vm); IsDirty = true; SelectedBlockViewModel = vm; RaisePropertyChanged("ItemFilterSectionViewModels"); } + private void OnExpandAllBlocksCommand() + { + foreach (var blockViewModel in ItemFilterBlockViewModels) + { + blockViewModel.IsExpanded = true; + } + } + + private void OnCollapseAllBlocksCommand() + { + foreach (var blockViewModel in ItemFilterBlockViewModels) + { + blockViewModel.IsExpanded = false; + } + } + private void OnDeleteBlockCommand() { DeleteBlock(SelectedBlockViewModel); diff --git a/Filtration/ViewModels/MainWindowViewModel.cs b/Filtration/ViewModels/MainWindowViewModel.cs index c68e14d..8f5992e 100644 --- a/Filtration/ViewModels/MainWindowViewModel.cs +++ b/Filtration/ViewModels/MainWindowViewModel.cs @@ -53,25 +53,39 @@ namespace Filtration.ViewModels _themeService = themeService; NewScriptCommand = new RelayCommand(OnNewScriptCommand); - CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, ActiveDocumentIsScript); + CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript); OpenScriptCommand = new RelayCommand(OnOpenScriptCommand); OpenThemeCommand = new RelayCommand(OnOpenThemeCommand); - SaveCommand = new RelayCommand(OnSaveDocumentCommand, ActiveDocumentIsEditable); SaveAsCommand = new RelayCommand(OnSaveAsCommand, ActiveDocumentIsEditable); CloseCommand = new RelayCommand(OnCloseDocumentCommand, () => AvalonDockWorkspaceViewModel.ActiveDocument != null); - CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript() && (_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null)); - PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript() && (_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null)); + CopyBlockCommand = new RelayCommand(OnCopyBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + CopyBlockStyleCommand = new RelayCommand(OnCopyBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + PasteCommand = new RelayCommand(OnPasteCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + + MoveBlockUpCommand = new RelayCommand(OnMoveBlockUpCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + MoveBlockDownCommand = new RelayCommand(OnMoveBlockDownCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + MoveBlockToTopCommand = new RelayCommand(OnMoveBlockToTopCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + MoveBlockToBottomCommand = new RelayCommand(OnMoveBlockToBottomCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); + + AddBlockCommand = new RelayCommand(OnAddBlockCommand, () => ActiveDocumentIsScript); + AddSectionCommand = new RelayCommand(OnAddSectionCommand, () => ActiveDocumentIsScript); + DeleteBlockCommand = new RelayCommand(OnDeleteBlockCommand, () => ActiveDocumentIsScript && ActiveScriptHasSelectedBlock); OpenAboutWindowCommand = new RelayCommand(OnOpenAboutWindowCommand); OpenSettingsWindowCommand = new RelayCommand(OnOpenSettingsWindowCommand); - ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, ActiveDocumentIsScript); - CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, ActiveDocumentIsScript); - ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, ActiveDocumentIsScript); + ReplaceColorsCommand = new RelayCommand(OnReplaceColorsCommand, () => ActiveDocumentIsScript); + CreateThemeCommand = new RelayCommand(OnCreateThemeCommand, () => ActiveDocumentIsScript); + ApplyThemeToScriptCommand = new RelayCommand(OnApplyThemeToScriptCommand, () => ActiveDocumentIsScript); - //LoadScriptFromFile("C:\\ThioleLootFilter.txt"); + ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript); + CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript); + + ToggleShowAdvancedCommand = new RelayCommand(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript); + ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript); if (string.IsNullOrEmpty(_itemFilterScriptRepository.GetItemFilterScriptDirectory())) { @@ -95,6 +109,7 @@ namespace Filtration.ViewModels ReplaceColorsCommand.RaiseCanExecuteChanged(); ApplyThemeToScriptCommand.RaiseCanExecuteChanged(); CreateThemeCommand.RaiseCanExecuteChanged(); + RaisePropertyChanged("ShowAdvancedStatus"); break; } case "NewScript": @@ -116,7 +131,9 @@ namespace Filtration.ViewModels public RelayCommand SaveCommand { get; private set; } public RelayCommand SaveAsCommand { get; private set; } public RelayCommand CopyBlockCommand { get; private set; } + public RelayCommand CopyBlockStyleCommand { get; private set; } public RelayCommand PasteCommand { get; private set; } + public RelayCommand PasteBlockStyleCommand { get; private set; } public RelayCommand CopyScriptCommand { get; private set; } public RelayCommand NewScriptCommand { get; private set; } public RelayCommand CloseCommand { get; private set; } @@ -125,6 +142,21 @@ namespace Filtration.ViewModels public RelayCommand ReplaceColorsCommand { get; private set; } public RelayCommand CreateThemeCommand { get; private set; } public RelayCommand ApplyThemeToScriptCommand { get; private set; } + + public RelayCommand AddBlockCommand { get; private set; } + public RelayCommand AddSectionCommand { get; private set; } + public RelayCommand DeleteBlockCommand { get; private set; } + + public RelayCommand MoveBlockUpCommand { get; private set; } + public RelayCommand MoveBlockDownCommand { get; private set; } + public RelayCommand MoveBlockToTopCommand { get; private set; } + public RelayCommand MoveBlockToBottomCommand { get; private set; } + + public RelayCommand ExpandAllBlocksCommand { get; private set; } + public RelayCommand CollapseAllBlocksCommand { get; private set; } + + public RelayCommand ToggleShowAdvancedCommand { get; private set; } + public RelayCommand ClearFiltersCommand { get; private set; } public IAvalonDockWorkspaceViewModel AvalonDockWorkspaceViewModel { @@ -141,9 +173,25 @@ namespace Filtration.ViewModels } } - private bool ActiveDocumentIsScript() + public bool ActiveDocumentIsScript { - return _activeDocument is IItemFilterScriptViewModel; + get + { + { + var isScript = _activeDocument is ItemFilterScriptViewModel; + return isScript; + } + } + } + + public bool ActiveScriptHasSelectedBlock + { + get { return AvalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel != null; } + } + + public bool ActiveDocumentIsTheme + { + get { { return _activeDocument is ThemeViewModel; } } } private bool ActiveDocumentIsEditable() @@ -151,6 +199,14 @@ namespace Filtration.ViewModels return _activeDocument is IEditableDocument; } + public bool ShowAdvancedStatus + { + get + { + return ActiveDocumentIsScript && _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ShowAdvanced; + } + } + private void OnCreateThemeCommand() { var themeViewModel = _themeProvider.NewThemeForScript(AvalonDockWorkspaceViewModel.ActiveScriptViewModel.Script); @@ -321,12 +377,22 @@ namespace Filtration.ViewModels private void OnCopyBlockCommand() { - _avalonDockWorkspaceViewModel.ActiveScriptViewModel.CopyBlock(_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel); + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.CopyBlockCommand.Execute(null); + } + + private void OnCopyBlockStyleCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.CopyBlockStyleCommand.Execute(null); } private void OnPasteCommand() { - _avalonDockWorkspaceViewModel.ActiveScriptViewModel.PasteBlock(_avalonDockWorkspaceViewModel.ActiveScriptViewModel.SelectedBlockViewModel); + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.PasteBlockCommand.Execute(null); + } + + private void OnPasteBlockStyleCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.PasteBlockStyleCommand.Execute(null); } private void OnNewScriptCommand() @@ -339,5 +405,60 @@ namespace Filtration.ViewModels { _avalonDockWorkspaceViewModel.ActiveDocument.Close(); } + + private void OnMoveBlockUpCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.MoveBlockUpCommand.Execute(null); + } + + private void OnMoveBlockDownCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.MoveBlockDownCommand.Execute(null); + } + + private void OnMoveBlockToTopCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.MoveBlockToTopCommand.Execute(null); + } + + private void OnMoveBlockToBottomCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.MoveBlockToBottomCommand.Execute(null); + } + + private void OnAddBlockCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.AddBlockCommand.Execute(null); + } + + private void OnAddSectionCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.AddSectionCommand.Execute(null); + } + + private void OnDeleteBlockCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.DeleteBlockCommand.Execute(null); + } + + private void OnExpandAllBlocksCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ExpandAllBlocksCommand.Execute(null); + } + + private void OnCollapseAllBlocksCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.CollapseAllBlocksCommand.Execute(null); + } + + private void OnToggleShowAdvancedCommand(bool showAdvanced) + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ToggleShowAdvancedCommand.Execute(showAdvanced); + } + + private void OnClearFiltersCommand() + { + _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ClearFilterCommand.Execute(null); + } } } diff --git a/Filtration/Views/AboutWindow.xaml b/Filtration/Views/AboutWindow.xaml index d006756..3767236 100644 --- a/Filtration/Views/AboutWindow.xaml +++ b/Filtration/Views/AboutWindow.xaml @@ -1,16 +1,15 @@ - + BorderBrush="Black"> + @@ -71,4 +70,4 @@ - + diff --git a/Filtration/Views/IconsDictionary.xaml b/Filtration/Views/IconsDictionary.xaml index 3e66273..7b16b14 100644 --- a/Filtration/Views/IconsDictionary.xaml +++ b/Filtration/Views/IconsDictionary.xaml @@ -2,11 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - - @@ -16,7 +14,7 @@ - + @@ -24,6 +22,10 @@ - + + + + + \ No newline at end of file diff --git a/Filtration/Views/ItemFilterBlockView.xaml b/Filtration/Views/ItemFilterBlockView.xaml index 05debd2..aa2748b 100644 --- a/Filtration/Views/ItemFilterBlockView.xaml +++ b/Filtration/Views/ItemFilterBlockView.xaml @@ -11,6 +11,7 @@ xmlns:blockItemBaseTypes="clr-namespace:Filtration.ObjectModel.BlockItemBaseTypes;assembly=Filtration.ObjectModel" xmlns:blockItemTypes="clr-namespace:Filtration.ObjectModel.BlockItemTypes;assembly=Filtration.ObjectModel" xmlns:enums="clr-namespace:Filtration.ObjectModel.Enums;assembly=Filtration.ObjectModel" + xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase" mc:Ignorable="d" d:DataContext="{d:DesignInstance Type=viewModels:ItemFilterBlockViewModel}" d:DesignHeight="200" d:DesignWidth="800"> @@ -38,13 +39,23 @@ Advanced Block Group - + + + + + @@ -66,7 +77,6 @@ - @@ -94,15 +104,21 @@ - - + - + @@ -148,12 +164,39 @@ - + + + + + + + + + + + diff --git a/Filtration/Views/ItemFilterSectionView.xaml b/Filtration/Views/ItemFilterSectionView.xaml index a6928a8..6ff0543 100644 --- a/Filtration/Views/ItemFilterSectionView.xaml +++ b/Filtration/Views/ItemFilterSectionView.xaml @@ -22,7 +22,13 @@ - + + + + + + + diff --git a/Filtration/Views/MainWindow.xaml b/Filtration/Views/MainWindow.xaml index a582a5a..22df379 100644 --- a/Filtration/Views/MainWindow.xaml +++ b/Filtration/Views/MainWindow.xaml @@ -1,58 +1,83 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/Filtration/Views/SettingsWindow.xaml b/Filtration/Views/SettingsWindow.xaml index 3a287ca..4832a3f 100644 --- a/Filtration/Views/SettingsWindow.xaml +++ b/Filtration/Views/SettingsWindow.xaml @@ -1,13 +1,13 @@ - + Title="Options" Height="150" Width="500"> + @@ -45,4 +45,4 @@ - + diff --git a/Filtration/Views/SharedResourcesDictionary.xaml b/Filtration/Views/SharedResourcesDictionary.xaml index 6ebc0ee..5287469 100644 --- a/Filtration/Views/SharedResourcesDictionary.xaml +++ b/Filtration/Views/SharedResourcesDictionary.xaml @@ -8,7 +8,7 @@