Skip to content

Commit

Permalink
Introduce new FindReplaceDialog (layout only)
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandreu committed Jun 23, 2019
1 parent d1a1488 commit d65064b
Show file tree
Hide file tree
Showing 11 changed files with 358 additions and 7 deletions.
6 changes: 1 addition & 5 deletions OfficeRibbonXEditor/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ public App()
builder.RegisterType<DialogProvider>().As<IDialogProvider>();

builder.RegisterType<MainWindowViewModel>();
builder.RegisterType<DialogHostViewModel>();
builder.RegisterType<SettingsDialogViewModel>();
builder.RegisterType<AboutDialogViewModel>();
builder.RegisterType<CallbackDialogViewModel>();
builder.RegisterType<GoToDialogViewModel>();
DialogHostBase.RegisterDialogViewModels(builder);

this.container = builder.Build();
}
Expand Down
11 changes: 11 additions & 0 deletions OfficeRibbonXEditor/OfficeRibbonXEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
</Compile>
<Compile Include="Extensions\UiElementExtensions.cs" />
<Compile Include="Models\LaunchDialogEventArgs.cs" />
<Compile Include="ViewModels\FindReplaceDialogViewModel.cs" />
<Compile Include="ViewModels\GoToDialogViewModel.cs" />
<Compile Include="ViewModels\CallbackDialogViewModel.cs" />
<Compile Include="ViewModels\DialogBase.cs" />
Expand Down Expand Up @@ -245,6 +246,9 @@
<Compile Include="ViewModels\TreeViewItemViewModel.cs" />
<Compile Include="Models\OfficeDocument.cs" />
<Compile Include="Views\DialogHostBase.cs" />
<Compile Include="Views\FindReplaceDialog.xaml.cs">
<DependentUpon>FindReplaceDialog.xaml</DependentUpon>
</Compile>
<Compile Include="Views\GoToDialog.xaml.cs">
<DependentUpon>GoToDialog.xaml</DependentUpon>
</Compile>
Expand All @@ -271,6 +275,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\FindReplaceDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\GoToDialog.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -411,6 +419,9 @@
<Resource Include="Dialogs\FindReplace\Resources\GoToPreviousMessage.png" />
<Resource Include="Dialogs\FindReplace\Resources\LineColorHS.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Images\clock.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
Binary file added OfficeRibbonXEditor/Resources/Images/clock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion OfficeRibbonXEditor/Resources/ImagesResource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions OfficeRibbonXEditor/Resources/ImagesResource.resx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@
<data name="check" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>images\check.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="clock" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>images\clock.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="copy" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>images\copy.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down
85 changes: 85 additions & 0 deletions OfficeRibbonXEditor/ViewModels/FindReplaceDialogViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
namespace OfficeRibbonXEditor.ViewModels
{
public class FindReplaceDialogViewModel : DialogBase
{
private bool isStandardSearch = true;

public bool IsStandardSearch
{
get => this.isStandardSearch;
set => this.Set(ref this.isStandardSearch, value);
}

private bool isExtendedSearch;

public bool IsExtendedSearch
{
get => this.isExtendedSearch;
set => this.Set(ref this.isExtendedSearch, value);
}

private bool isRegExSearch;

public bool IsRegExSearch
{
get => this.isRegExSearch;
set => this.Set(ref this.isRegExSearch, value);
}

private bool matchCase;

public bool MatchCase
{
get => this.matchCase;
set => this.Set(ref this.matchCase, value);
}

private bool wholeWord;

public bool WholeWord
{
get => this.wholeWord;
set => this.Set(ref this.wholeWord, value);
}

private bool wordStart;

public bool WordStart
{
get => this.wordStart;
set => this.Set(ref this.wordStart, value);
}

private bool wrap;

public bool Wrap
{
get => this.wrap;
set => this.Set(ref this.wrap, value);
}

private bool searchSelection;

public bool SearchSelection
{
get => this.searchSelection;
set => this.Set(ref this.searchSelection, value);
}

private bool markLine;

public bool MarkLine
{
get => this.markLine;
set => this.Set(ref this.markLine, value);
}

private bool highlightMatches;

public bool HighlightMatches
{
get => this.highlightMatches;
set => this.Set(ref this.highlightMatches, value);
}
}
}
3 changes: 3 additions & 0 deletions OfficeRibbonXEditor/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public MainWindowViewModel(IMessageBoxService messageBoxService, IFileDialogServ
this.ValidateCommand = new RelayCommand(() => this.ValidateXml(true));
this.GenerateCallbacksCommand = new RelayCommand(this.ExecuteGenerateCallbacksCommand);
this.GoToCommand = new RelayCommand(this.ExecuteGoToCommand);
this.ShowFindReplaceCommand = new RelayCommand(() => this.LaunchDialog<FindReplaceDialogViewModel>());
this.ShowSettingsCommand = new RelayCommand(() => this.LaunchDialog<SettingsDialogViewModel, ScintillaLexer>(this.Lexer));
this.ShowAboutCommand = new RelayCommand(() => this.LaunchDialog<AboutDialogViewModel>(true));
this.RecentFileClickCommand = new RelayCommand<string>(this.FinishOpeningFile);
Expand Down Expand Up @@ -242,6 +243,8 @@ public TreeViewItemViewModel SelectedItem

public RelayCommand GoToCommand { get; }

public RelayCommand ShowFindReplaceCommand { get; }

public RelayCommand<string> RecentFileClickCommand { get; }

public RelayCommand NewerVersionCommand { get; }
Expand Down
17 changes: 16 additions & 1 deletion OfficeRibbonXEditor/Views/DialogHostBase.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Windows;
using Autofac;
using OfficeRibbonXEditor.Controls;
using OfficeRibbonXEditor.Interfaces;
using OfficeRibbonXEditor.ViewModels;
using Xceed.Wpf.Toolkit.Core.Converters;

namespace OfficeRibbonXEditor.Views
{
Expand Down Expand Up @@ -73,6 +73,16 @@ private static void OnModelChanged(DependencyObject sender, DependencyPropertyCh
host.CenterInOwner();
}

public static void RegisterDialogViewModels(ContainerBuilder builder)
{
builder.RegisterType<DialogHostViewModel>();
builder.RegisterType<SettingsDialogViewModel>();
builder.RegisterType<AboutDialogViewModel>();
builder.RegisterType<CallbackDialogViewModel>();
builder.RegisterType<GoToDialogViewModel>();
builder.RegisterType<FindReplaceDialogViewModel>();
}

private static DialogControl GenerateControl(Type contentDialogType)
{
if (contentDialogType == typeof(AboutDialogViewModel))
Expand All @@ -95,6 +105,11 @@ private static DialogControl GenerateControl(Type contentDialogType)
return new GoToDialog();
}

if (contentDialogType == typeof(FindReplaceDialogViewModel))
{
return new FindReplaceDialog();
}

throw new ArgumentException($"Type {contentDialogType.Name} does not have an registered control");
}

Expand Down
Loading

0 comments on commit d65064b

Please sign in to comment.