Skip to content

Commit

Permalink
Fix dialogs so they center on parent properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
botman99 committed Jun 16, 2018
1 parent 4003c7a commit 18d575d
Show file tree
Hide file tree
Showing 14 changed files with 81 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Grepy2.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
; The name of the installer
Name "Grepy2"

!define VERSION '2.0.6'
!define VERSION '2.0.7'

; The file to write
OutFile "Grepy2-${VERSION}.exe"
Expand Down
6 changes: 5 additions & 1 deletion Grepy2Help/Grepy2.htm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
</HEAD>
<BODY>
<p style="text-align:right">Previous&nbsp;&nbsp;&nbsp;<A href="WhatIsGrepy.htm">Next</a></p>
<p style="text-align:center">Grepy version 2.0.6</p>
<p style="text-align:center">Grepy version 2.0.7</p>
<br>
<br>
What's New:<br>
<br>
Version 2.0.7 - June 16, 2018<br>
<ul>
<li>Fix dialogs so they center on the parent.</li>
</ul>
Version 2.0.6 - March 27, 2018<br>
<ul>
<li>Made the "No Matches Found" dialog be TopMost.</li>
Expand Down
22 changes: 22 additions & 0 deletions Grepy2Help/Grepy2Help.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,35 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<None Include="CommandLine.htm">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Grepy2.htm">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Grepy2Help.hhp" />
<None Include="GrepyDetails.htm">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Menu.htm">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Options.htm">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Search.htm">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="Table of Contents.hhc" />
<None Include="View.htm">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="WhatIsGrepy.htm">
<DeploymentContent>true</DeploymentContent>
</None>
</ItemGroup>
<ItemGroup>
<Image Include="GrepyDetails.PNG" />
<Image Include="GrepyExample.PNG" />
<Image Include="GrepyMenu.PNG" />
<Image Include="GrepyOptions.PNG" />
Expand Down
8 changes: 8 additions & 0 deletions Grepy2Help/Grepy2Help.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@
<None Include="WhatIsGrepy.htm" />
<None Include="Grepy2Help.hhp" />
<None Include="Table of Contents.hhc" />
<None Include="CommandLine.htm" />
<None Include="Grepy2.htm" />
<None Include="GrepyDetails.htm" />
<None Include="Menu.htm" />
<None Include="Options.htm" />
<None Include="Search.htm" />
<None Include="View.htm" />
</ItemGroup>
<ItemGroup>
<Image Include="GrepyExample.PNG" />
<Image Include="GrepyMenu.PNG" />
<Image Include="GrepyOptions.PNG" />
<Image Include="GrepySearch.PNG" />
<Image Include="GrepyDetails.PNG" />
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ private void SearchIsDoneOrCancelled(bool bDisplaySearchTextMatches)
noMatchesFoundDialog.StartPosition = FormStartPosition.CenterParent;
// noMatchesFoundDialog.ControlBox = false; // don't show the 'X' to close button

noMatchesFoundDialog.ShowDialog();
noMatchesFoundDialog.ShowDialog(this);
}
}
}
Expand Down Expand Up @@ -1351,7 +1351,7 @@ private void DoSearchDialog()
{
SearchForm searchDialog = new SearchForm();

searchDialog.ShowDialog();
searchDialog.ShowDialog(this);

if( searchDialog.DialogResult == DialogResult.OK )
{
Expand Down Expand Up @@ -1398,7 +1398,7 @@ private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
{
OptionsForm optionsDialog = new OptionsForm();

optionsDialog.ShowDialog();
optionsDialog.ShowDialog(this);

if( optionsDialog.DialogResult == DialogResult.OK )
{
Expand Down
1 change: 1 addition & 0 deletions NoMatchesFound.Designer.cs

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

5 changes: 5 additions & 0 deletions NoMatchesFound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@ private void OkButton_Click(object sender, EventArgs e)
{
Close();
}

private void NoMatchesFound_Shown(object sender, EventArgs e)
{
CenterToParent();
}
}
}
1 change: 1 addition & 0 deletions OptionsForm.Designer.cs

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

25 changes: 14 additions & 11 deletions OptionsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,6 @@ private void OptionsForm_Load(object sender, EventArgs e)
WorkerThreadsComboBox.Items.Add(string.Format("{0}", index));
}

int pos_x = -1;
int pos_y = -1;
if( Config.Get(Config.KEY.OptionsPosX, ref pos_x) && Config.Get(Config.KEY.OptionsPosY, ref pos_y) )
{
Location = new Point(pos_x, pos_y);
}
else // otherwise, center the window on the main form
{
this.CenterToParent();
}

bool bDeferRichTextDisplay = false;
Config.Get(Config.KEY.OptionsDeferRichTextDisplay, ref bDeferRichTextDisplay);
DeferRichTextCheckBox.Checked = bDeferRichTextDisplay;
Expand Down Expand Up @@ -98,6 +87,20 @@ private void OptionsForm_Load(object sender, EventArgs e)
OptionsToolTip.SetToolTip(this.DeferRichTextCheckBox, "Enable to defer the displaying of search match text in the RichText box until after the search is complete (this can improve performance).");

OptionsToolTip.SetToolTip(this.WindowsFileAssociationCheckBox, "Whether you wish to use the Windows application associated with a file type to edit the file or whether you wish to specify an editor to use to edit all files.");
}

private void OptionsForm_Shown(object sender, EventArgs e)
{
int pos_x = -1;
int pos_y = -1;
if( Config.Get(Config.KEY.OptionsPosX, ref pos_x) && Config.Get(Config.KEY.OptionsPosY, ref pos_y) )
{
Location = new Point(pos_x, pos_y);
}
else // otherwise, center the window on the main form
{
this.CenterToParent();
}

bWindowInitComplete = true; // window initialization is complete, okay to write config settings now
}
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[assembly: AssemblyTitle("Grepy2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Jeffrey Broome")]
[assembly: AssemblyProduct("Grepy2")]
[assembly: AssemblyCopyright("Copyright © 2017-2018")]
[assembly: AssemblyTrademark("")]
Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.6.0")]
[assembly: AssemblyFileVersion("2.0.6.0")]
[assembly: AssemblyVersion("2.0.7.0")]
[assembly: AssemblyFileVersion("2.0.7.0")]
1 change: 1 addition & 0 deletions SearchForm.Designer.cs

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

27 changes: 15 additions & 12 deletions SearchForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,6 @@ public SearchForm()

private void SearchForm_Load(object sender, EventArgs e)
{
int pos_x = -1;
int pos_y = -1;
if( Config.Get(Config.KEY.SearchPosX, ref pos_x) && Config.Get(Config.KEY.SearchPosY, ref pos_y) )
{
Location = new Point(pos_x, pos_y);
}
else // otherwise, center the window on the main form
{
this.CenterToParent();
}

bool bConfigRegularExpression = false;
if( Config.Get(Config.KEY.SearchRegularExpression, ref bConfigRegularExpression) )
{
Expand Down Expand Up @@ -156,6 +145,20 @@ private void SearchForm_Load(object sender, EventArgs e)
SearchToolTip.SetToolTip(this.SearchForComboBox, "Type in the text you wish to search for here.");
SearchToolTip.SetToolTip(this.FileSpecComboBox, "Type in the file specifications you wish to use when collecting the files to search.");
SearchToolTip.SetToolTip(this.FolderComboBox, "Type in the folder name you wish to start searching from (or click the \"...\" button to browse to a folder).");
}

private void SearchForm_Shown(object sender, EventArgs e)
{
int pos_x = -1;
int pos_y = -1;
if( Config.Get(Config.KEY.SearchPosX, ref pos_x) && Config.Get(Config.KEY.SearchPosY, ref pos_y) )
{
Location = new Point(pos_x, pos_y);
}
else // otherwise, center the window on the main form
{
this.CenterToParent();
}

bWindowInitComplete = true; // window initialization is complete, okay to write config settings now
}
Expand Down Expand Up @@ -320,7 +323,7 @@ private void SearchOkButton_Click(object sender, EventArgs e)

private void SearchHelpButton_Click(object sender, EventArgs e)
{
helpForm.Show();
helpForm.Show(this);
}

private void SearchCancelButton_Click(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion SearchHelpForm.Designer.cs

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

2 changes: 1 addition & 1 deletion SearchHelpForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public SearchHelpForm()
InitializeComponent();
}

private void SearchHelpForm_Load(object sender, EventArgs e)
private void SearchHelpForm_Shown(object sender, EventArgs e)
{
int pos_x = -1;
int pos_y = -1;
Expand Down

0 comments on commit 18d575d

Please sign in to comment.