mirror of
https://github.com/LorenzCK/OnTopReplica.git
synced 2024-05-10 15:32:41 +12:00
Issue #29: "show chrome/window border" setting is restored on start up (if last window is restored).
This commit is contained in:
parent
c794df3ade
commit
fbf8fae7f0
|
@ -83,18 +83,6 @@ namespace OnTopReplica {
|
|||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e) {
|
||||
//Store last thumbnail, if any
|
||||
if (_thumbnailPanel.IsShowingThumbnail && CurrentThumbnailWindowHandle != null) {
|
||||
Settings.Default.RestoreLastWindowTitle = CurrentThumbnailWindowHandle.Title;
|
||||
Settings.Default.RestoreLastWindowHwnd = CurrentThumbnailWindowHandle.Handle.ToInt64();
|
||||
Settings.Default.RestoreLastWindowClass = CurrentThumbnailWindowHandle.Class;
|
||||
}
|
||||
else {
|
||||
Settings.Default.RestoreLastWindowTitle = string.Empty;
|
||||
Settings.Default.RestoreLastWindowHwnd = 0;
|
||||
Settings.Default.RestoreLastWindowClass = string.Empty;
|
||||
}
|
||||
|
||||
_msgPumpManager.Dispose();
|
||||
Program.Platform.CloseForm(this);
|
||||
|
||||
|
|
|
@ -71,7 +71,8 @@ namespace OnTopReplica {
|
|||
//Enter GUI loop
|
||||
Application.Run(_mainForm);
|
||||
|
||||
//HACK: re-enable chrome to fix position persistence (ideally, chrome status should be stored and restored - but this is not always possible)
|
||||
//Re-enable chrome to store correct position (position is stored always WITH chrome: when restoring fails, the position stays ok)
|
||||
Settings.Default.RestoreLastShowChrome = _mainForm.IsChromeVisible;
|
||||
if (!_mainForm.IsChromeVisible)
|
||||
_mainForm.IsChromeVisible = true;
|
||||
|
||||
|
@ -80,6 +81,18 @@ namespace OnTopReplica {
|
|||
Settings.Default.RestoreLastPosition = _mainForm.Location;
|
||||
Settings.Default.RestoreLastSize = _mainForm.ClientSize;
|
||||
Settings.Default.Save();
|
||||
|
||||
//Store last thumbnail, if any
|
||||
if (_mainForm.ThumbnailPanel.IsShowingThumbnail && _mainForm.CurrentThumbnailWindowHandle != null) {
|
||||
Settings.Default.RestoreLastWindowTitle = _mainForm.CurrentThumbnailWindowHandle.Title;
|
||||
Settings.Default.RestoreLastWindowHwnd = _mainForm.CurrentThumbnailWindowHandle.Handle.ToInt64();
|
||||
Settings.Default.RestoreLastWindowClass = _mainForm.CurrentThumbnailWindowHandle.Class;
|
||||
}
|
||||
else {
|
||||
Settings.Default.RestoreLastWindowTitle = string.Empty;
|
||||
Settings.Default.RestoreLastWindowHwnd = 0;
|
||||
Settings.Default.RestoreLastWindowClass = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
14
OnTopReplica/Properties/Settings.Designer.cs
generated
14
OnTopReplica/Properties/Settings.Designer.cs
generated
|
@ -1,7 +1,7 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18051
|
||||
// Runtime Version:4.0.30319.34003
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
|
@ -237,5 +237,17 @@ namespace OnTopReplica.Properties {
|
|||
this["FullscreenMode"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("True")]
|
||||
public bool RestoreLastShowChrome {
|
||||
get {
|
||||
return ((bool)(this["RestoreLastShowChrome"]));
|
||||
}
|
||||
set {
|
||||
this["RestoreLastShowChrome"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,5 +56,8 @@
|
|||
<Setting Name="FullscreenMode" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">Standard</Value>
|
||||
</Setting>
|
||||
<Setting Name="RestoreLastShowChrome" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
|
@ -33,8 +33,10 @@ namespace OnTopReplica.StartupOptions {
|
|||
if (Settings.Default.RestoreSizeAndPosition) {
|
||||
options.StartLocation = Settings.Default.RestoreLastPosition;
|
||||
options.StartSize = Settings.Default.RestoreLastSize;
|
||||
options.DisableChrome = !Settings.Default.RestoreLastShowChrome;
|
||||
|
||||
Log.Write("Restoring window at {0} size {1}", Settings.Default.RestoreLastPosition, Settings.Default.RestoreLastSize);
|
||||
Log.Write("Restoring window at {0} size {1} {2}", Settings.Default.RestoreLastPosition, Settings.Default.RestoreLastSize,
|
||||
(Settings.Default.RestoreLastShowChrome) ? "with chrome" : "without chrome");
|
||||
}
|
||||
|
||||
if (Settings.Default.RestoreLastWindow) {
|
||||
|
|
|
@ -58,6 +58,9 @@
|
|||
<setting name="FullscreenMode" serializeAs="String">
|
||||
<value>Standard</value>
|
||||
</setting>
|
||||
<setting name="RestoreLastShowChrome" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</OnTopReplica.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
|
|
Loading…
Reference in a new issue