Skip to content

Commit

Permalink
added setting ShowFrameNavTool #2072
Browse files Browse the repository at this point in the history
  • Loading branch information
d2phap committed Jan 25, 2025
1 parent 7dfb28b commit 61d0c0e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 8 deletions.
9 changes: 8 additions & 1 deletion Source/Components/ImageGlass.Settings/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,15 @@ public static class Config
public static bool ShowWelcomeImage { get; set; } = true;

/// <summary>
/// Gets, sets value of visibility of toolbar when start up
/// Gets, sets value of visibility of toolbar on start up
/// </summary>
public static bool ShowToolbar { get; set; } = true;

/// <summary>
/// Gets, sets value of visibility of Frame Navigation tool on startup
/// </summary>
public static bool ShowFrameNavTool { get; set; } = false;

/// <summary>
/// Gets, sets value of visibility of app icon
/// </summary>
Expand Down Expand Up @@ -700,6 +705,7 @@ public static void Load(IConfigurationRoot? items = null)
ShowGalleryFileName = items.GetValueEx(nameof(ShowGalleryFileName), ShowGalleryFileName);
ShowWelcomeImage = items.GetValueEx(nameof(ShowWelcomeImage), ShowWelcomeImage);
ShowToolbar = items.GetValueEx(nameof(ShowToolbar), ShowToolbar);
ShowFrameNavTool = items.GetValueEx(nameof(ShowFrameNavTool), ShowFrameNavTool);
ShowAppIcon = items.GetValueEx(nameof(ShowAppIcon), ShowAppIcon);
EnableLoopBackNavigation = items.GetValueEx(nameof(EnableLoopBackNavigation), EnableLoopBackNavigation);
ShowCheckerboard = items.GetValueEx(nameof(ShowCheckerboard), ShowCheckerboard);
Expand Down Expand Up @@ -1065,6 +1071,7 @@ public static ExpandoObject PrepareJsonSettingsObject(bool useAbsoluteFileUrl =
_ = settings.TryAdd(nameof(ShowGalleryFileName), ShowGalleryFileName);
_ = settings.TryAdd(nameof(ShowWelcomeImage), ShowWelcomeImage);
_ = settings.TryAdd(nameof(ShowToolbar), ShowToolbar);
_ = settings.TryAdd(nameof(ShowFrameNavTool), ShowFrameNavTool);
_ = settings.TryAdd(nameof(ShowAppIcon), ShowAppIcon);
_ = settings.TryAdd(nameof(EnableLoopBackNavigation), EnableLoopBackNavigation);
_ = settings.TryAdd(nameof(ShowCheckerboard), ShowCheckerboard);
Expand Down
5 changes: 2 additions & 3 deletions Source/Components/ImageGlass.Settings/WebUI/FrmSettings.html
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@
<section>
<header lang-text="FrmSettings.Nav._Layout">[Layout]</header>

<div class="d-flex flex-wrap mt-4">
<div class="d-flex flex-wrap gap-4 mt-4">
<!-- Layout map -->
<div class="app-layout d-inline-grid me-4 mb-5">
<div class="app-layout d-inline-grid">
<div class="region-center"></div>

<div data-position="Top">
Expand Down Expand Up @@ -692,7 +692,6 @@
</select>
</div>
</div>
</div>
</div>
</section>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,25 @@
.align-self-stretch {
align-self: stretch !important;
}


.gap-0 {
gap: 0 !important;
}
.gap-1 {
gap: 0.25rem !important;
}
.gap-2 {
gap: 0.5rem !important;
}
.gap-3 {
gap: 1rem !important;
}
.gap-4 {
gap: 1.5rem !important;
}
.gap-5 {
gap: 3rem !important;
}


3 changes: 3 additions & 0 deletions Source/ImageGlass/FrmMain/FrmMain.Configs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ private void SetUpFrmMainConfigs()
// toggle gallery
IG_ToggleGallery(Config.ShowGallery);

// toggle frame navigation tool
IG_ToggleFrameNavTool(Config.ShowFrameNavTool);


ResumeLayout(false);

Expand Down
9 changes: 5 additions & 4 deletions Source/ImageGlass/FrmMain/FrmMain.IGMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3150,21 +3150,22 @@ public bool IG_ToggleColorPicker(bool? visible = null)
public bool IG_ToggleFrameNavTool(bool? visible = null)
{
visible ??= MnuFrameNav.Checked;
Config.ShowFrameNavTool = visible.Value;

// update menu item state
MnuFrameNav.Checked = visible.Value;
MnuFrameNav.Checked = Config.ShowFrameNavTool;

// update toolbar items state
UpdateToolbarItemsState();

// toggle frame nav toolbar
_ = ToggleFrameNavToolbarAsync(visible.Value);
_ = SetFrameNavToolbarVisibilityAsync(Config.ShowFrameNavTool);

return visible.Value;
return Config.ShowFrameNavTool;
}


private async Task ToggleFrameNavToolbarAsync(bool visible)
private async Task SetFrameNavToolbarVisibilityAsync(bool visible)
{
ToolbarContext.SuspendLayout();
ToolbarContext.ClearItems();
Expand Down

0 comments on commit 61d0c0e

Please sign in to comment.