Skip to content

Commit

Permalink
Fixed a bug when changing languages
Browse files Browse the repository at this point in the history
Also moved the autocategorize button a bit higher.
  • Loading branch information
Theo47 committed Apr 6, 2016
1 parent a842676 commit d4d6510
Show file tree
Hide file tree
Showing 3 changed files with 599 additions and 619 deletions.
82 changes: 41 additions & 41 deletions Depressurizer/MainForm.Designer.cs

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

29 changes: 6 additions & 23 deletions Depressurizer/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2419,7 +2419,9 @@ private void changeLanguageToolStripItems( ToolStripItem item, ComponentResource
/// <param name="resources"></param> Resource manager
/// <param name="newCulture"></param> Culture of language to load
private void changeLanguageControls( Control c, ComponentResourceManager resources, CultureInfo newCulture ) {
if( c != null ) {
if( c != null )
{
Rectangle currentBounds = c.Bounds;
if( c.GetType() == typeof( MenuStrip ) ) {
foreach( ToolStripDropDownItem mItem in ( c as MenuStrip ).Items )
changeLanguageToolStripItems( mItem, resources, newCulture );
Expand All @@ -2436,6 +2438,7 @@ private void changeLanguageControls( Control c, ComponentResourceManager resourc
changeLanguageControls(childControl, resources, newCulture);
}
resources.ApplyResources( c, c.Name, newCulture );
c.Bounds = currentBounds;
}
}

Expand All @@ -2453,40 +2456,20 @@ private void menu_Tools_Settings_Click( object sender, EventArgs e ) {
ComponentResourceManager resources = new ComponentResourceManager( typeof( FormMain ) );
resources.ApplyResources( this, this.Name, Thread.CurrentThread.CurrentUICulture );

// If the window is maximized, un-maximize it
bool maximized = false;
if( this.WindowState == FormWindowState.Maximized ) {
maximized = true;
this.WindowState = FormWindowState.Normal;
}

// jpodadera. Save actual size and recover original size before reload resources of controls
int actualWidth = this.Width;
int actualHeight = this.Height;
int actualSplitDistanceMain = this.splitContainer.SplitterDistance;
int actualSplitDistanceSecondary = this.splitGame.SplitterDistance;
int actualSplitDistanceCategories = this.splitCategories.SplitterDistance;
int actualSplitDistanceBrowser = this.splitBrowser.SplitterDistance;

this.Width = this.originalWidth;
this.Height = this.originalHeight;
this.splitContainer.SplitterDistance = this.originalSplitDistanceMain;
this.splitGame.SplitterDistance = this.originalSplitDistanceSecondary;
this.splitBrowser.SplitterDistance = this.originalSplitDistanceBrowser;

changeLanguageControls( this, resources, Thread.CurrentThread.CurrentUICulture );

// jpodadera. Recover previous size
this.Width = actualWidth;
this.Height = actualHeight;
splitContainer.SplitterDistance = actualSplitDistanceMain;
splitGame.SplitterDistance = actualSplitDistanceSecondary;
splitCategories.SplitterDistance = actualSplitDistanceCategories;
splitBrowser.SplitterDistance = actualSplitDistanceBrowser;

// Re-maximize if it was maximized before
if( maximized ) {
this.WindowState = FormWindowState.Maximized;
}

FullListRefresh();
}

Expand Down
Loading

0 comments on commit d4d6510

Please sign in to comment.