Skip to content

Commit

Permalink
Fix menu text being unreadable in light mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
OliBomby committed Dec 17, 2023
1 parent 3e054de commit d835fb1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
29 changes: 21 additions & 8 deletions Mapping_Tools/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,37 +92,50 @@
<Menu
WindowChrome.IsHitTestVisibleInChrome="true"
IsMainMenu="True"
Background="{DynamicResource PrimaryHueMidBrush}"
Foreground="{DynamicResource PrimaryHueMidForegroundBrush}">
<MenuItem Header="_File" MinWidth="50" Height="35">
<MenuItem Header="_Open beatmap" Click="OpenBeatmap" Icon="{materialDesign:PackIcon Folder}"
ToolTip="Select the current beatmap with File Explorer." />
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Select the current beatmap with File Explorer." />
<MenuItem Header="_Open current beatmap" Click="OpenGetCurrentBeatmap" Icon="{materialDesign:PackIcon RestoreFromTrash}"
ToolTip="Set the current beatmap to the selected beatmap in your osu! client." />
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Set the current beatmap to the selected beatmap in your osu! client." />
<MenuItem Header="_Generate backup" Click="SaveBackup" Icon="{materialDesign:PackIcon Backup}"
ToolTip="Save a backup of the current beatmap to the backups folder." />
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Save a backup of the current beatmap to the backups folder." />
<MenuItem Header="_Load backup" Click="LoadBackup" Icon="{materialDesign:PackIcon BackupRestore}"
ToolTip="Load a backup from the backups folder into the current beatmap." />
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Load a backup from the backups folder into the current beatmap." />
<MenuItem Header="_BetterSave™ current beatmap" Click="CoolSave" Icon="{materialDesign:PackIcon ContentSave}"
ToolTip="Save the beatmap which is currently open in your osu! editor. BetterSave™ saves the beatmap just like the vanilla editor, but decimal values get rounded instead of truncated." />
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Save the beatmap which is currently open in your osu! editor. BetterSave™ saves the beatmap just like the vanilla editor, but decimal values get rounded instead of truncated." />
</MenuItem>
<Separator/>
<MenuItem Header="_About" MinWidth="67" Height="35">
<MenuItem Header="_Open Mapping Tools folder" Click="OpenConfig" Icon="{materialDesign:PackIcon FolderOpen}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Open the Mapping Tools folder." />
<MenuItem Header="_Open backups folder" Click="OpenBackups" Icon="{materialDesign:PackIcon FolderOpen}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Open the backups folder." />
<MenuItem Header="_Check for updates" Click="MenuItem_OnClick" Icon="{materialDesign:PackIcon Update}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Check if there are updates available." />
<MenuItem Header="_Website" Click="OpenWebsite" Icon="{materialDesign:PackIcon OpenInBrowser}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Open the official Mapping Tools website in your browser." />
<MenuItem Header="_Github" Click="OpenGitHub" Icon="{materialDesign:PackIcon Github}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Go to the Mapping Tools Github." />
<MenuItem Header="_Donate" Click="OpenDonate" Icon="{materialDesign:PackIcon Heart}"
Foreground="{DynamicResource MaterialDesignBody}"
ToolTip="Support Mapping Tools." />
<MenuItem Header="_About" Click="OpenInfo" Icon="{materialDesign:PackIcon InfoCircle}"/>
<MenuItem Header="_About" Click="OpenInfo" Icon="{materialDesign:PackIcon InfoCircle}"
Foreground="{DynamicResource MaterialDesignBody}"/>
</MenuItem>
<MenuItem Visibility="{Binding ProjectMenuVisibility}" Header="_Project" Height="35" MinWidth="67" ItemsSource="{Binding ProjectMenuItems}"/>
<MenuItem Visibility="{Binding ProjectMenuVisibility}"
Header="_Project" Height="35" MinWidth="67"
ItemsSource="{Binding ProjectMenuItems}"/>
</Menu>
</StackPanel>

Expand Down
17 changes: 13 additions & 4 deletions Mapping_Tools/Viewmodels/MainWindowVm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,19 +317,28 @@ private void ViewChanged() {
if (isSavable) {
ProjectMenuVisibility = Visibility.Visible;

ProjectMenuItems.Add(GetSaveProjectMenuItem());
ProjectMenuItems.Add(GetLoadProjectMenuItem());
ProjectMenuItems.Add(GetNewProjectMenuItem());
AddProjectMenuItem(GetSaveProjectMenuItem());
AddProjectMenuItem(GetLoadProjectMenuItem());
AddProjectMenuItem(GetNewProjectMenuItem());
}

if (View is IHaveExtraProjectMenuItems havingExtraProjectMenuItems) {
ProjectMenuVisibility = Visibility.Visible;

foreach (var menuItem in havingExtraProjectMenuItems.GetMenuItems()) {
ProjectMenuItems.Add(menuItem);
AddProjectMenuItem(menuItem);
}
}
}

private void AddProjectMenuItem(MenuItem item) {
// Set the foreground color to DynamicResource MaterialDesignBody
// so that it will change color when the theme changes
item.SetResourceReference(Control.ForegroundProperty, "MaterialDesignBody");

ProjectMenuItems.Add(item);
}

private MenuItem GetSaveProjectMenuItem() {
var menu = new MenuItem {
Header = "_Save project",
Expand Down

0 comments on commit d835fb1

Please sign in to comment.