MainWnd.UI2Settings(): no ls.Save() when no UI change, LocalSettings: Saves either plain or encrypted file, ver. 2.18.1268
This commit is contained in:
+24
-21
@@ -652,29 +652,32 @@ namespace TBF
|
||||
/// </summary>
|
||||
void UI2Settings()
|
||||
{
|
||||
/// Obtain MainWnd dimensions, etc.
|
||||
bool isMaximized = (WindowState == FormWindowState.Maximized);
|
||||
int left = (WindowState == FormWindowState.Normal) ? Location.X : RestoreBounds.Left;
|
||||
int top = (WindowState == FormWindowState.Normal) ? Location.Y : RestoreBounds.Top;
|
||||
int width = (WindowState == FormWindowState.Normal) ? Size.Width : RestoreBounds.Width;
|
||||
int height = (WindowState == FormWindowState.Normal) ? Size.Height : RestoreBounds.Height;
|
||||
int sd1 = rightHorizSplitContainer.SplitterDistance;
|
||||
int sd2 = topVerticalSplitContainer.SplitterDistance;
|
||||
|
||||
LocalSettings ls = Program.LocalSettings;
|
||||
|
||||
if (ls != null)
|
||||
if (ls != null && (ls.MainWndMaximized != isMaximized ||
|
||||
ls.MainWndLeft != left ||
|
||||
ls.MainWndTop != top ||
|
||||
ls.MainWndWidth != width ||
|
||||
ls.MainWndHeight != height ||
|
||||
ls.RightPaneHorizSplitterDistance != sd1 ||
|
||||
ls.TopPaneVerticalSplitterDistance != sd2))
|
||||
{
|
||||
ls.RightPaneHorizSplitterDistance = rightHorizSplitContainer.SplitterDistance;
|
||||
ls.TopPaneVerticalSplitterDistance = topVerticalSplitContainer.SplitterDistance;
|
||||
|
||||
ls.MainWndMaximized = (WindowState == FormWindowState.Maximized);
|
||||
if (WindowState == FormWindowState.Normal)
|
||||
{
|
||||
ls.MainWndLeft = Location.X;
|
||||
ls.MainWndTop = Location.Y;
|
||||
ls.MainWndWidth = Size.Width;
|
||||
ls.MainWndHeight = Size.Height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Maximized or minimized (when restarted, minimized window is restored as normal)
|
||||
ls.MainWndLeft = RestoreBounds.Left;
|
||||
ls.MainWndTop = RestoreBounds.Top;
|
||||
ls.MainWndWidth = RestoreBounds.Width;
|
||||
ls.MainWndHeight = RestoreBounds.Height;
|
||||
}
|
||||
/// At least one MainWnd dimension differs => Update local settings and save them
|
||||
ls.MainWndMaximized = isMaximized;
|
||||
ls.MainWndLeft = left;
|
||||
ls.MainWndTop = top;
|
||||
ls.MainWndWidth = width;
|
||||
ls.MainWndHeight = height;
|
||||
ls.RightPaneHorizSplitterDistance = sd1;
|
||||
ls.TopPaneVerticalSplitterDistance = sd2;
|
||||
ls.Save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user