Skip to content

Commit

Permalink
Cleanup from previous work, added some tooltips to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
CatmanFan committed Feb 12, 2025
1 parent d081e69 commit bbc7bf0
Show file tree
Hide file tree
Showing 11 changed files with 717 additions and 1,911 deletions.
3 changes: 2 additions & 1 deletion FriishProduce/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ static void Main(string[] args)
Config = new(Paths.Config);
Logger.Log("Opening FriishProduce.");
Lang = new Language();
Theme.ChangeScheme(0);

System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Lang.Current);

Expand All @@ -63,6 +62,8 @@ static void Main(string[] args)
// else
// {
Logger.Log("Running in GUI (graphical) mode.");
Theme.ChangeScheme(-1); // Program.Config.application.theme

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
MainForm = new MainForm(args);
Expand Down
54 changes: 33 additions & 21 deletions FriishProduce/SettingsForm.Designer.cs

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

33 changes: 26 additions & 7 deletions FriishProduce/SettingsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ public partial class SettingsForm : Form
{
private bool isShown = false;

private TheArtOfDev.HtmlRenderer.WinForms.HtmlToolTip tip = HTML.CreateToolTip();
private int dirtyOption1;
private bool dirtyOption2;
private int dirtyOption2;
private bool dirtyOption3;

public SettingsForm()
{
Expand All @@ -33,8 +35,8 @@ public void RefreshForm()
Program.Lang.Control(vc_neo);
Program.Lang.Control(adobe_flash);

Theme.BtnSizes(b_ok, b_cancel);
Theme.BtnLayout(this, b_ok, b_cancel);
Theme.BtnSizes(GetBanners, b_ok, b_cancel);
Theme.BtnLayout(this, GetBanners, b_ok, b_cancel);
if (Theme.ChangeColors(this, false))
{
border.BackColor = bottomPanel2.BackColor = Theme.Colors.Form.Border;
Expand All @@ -59,6 +61,9 @@ public void RefreshForm()
default_node.Nodes[6].Text = Program.Lang.Console(Platform.Flash);
default_node.Nodes[7].Text = Program.Lang.String("forwarders", "platforms");

Program.Lang.ToolTip(tip, use_online_wad_enabled, null, use_online_wad_enabled.Text);
Program.Lang.ToolTip(tip, bypass_rom_size, null, bypass_rom_size.Text);

#endregion

// -----------------------------
Expand All @@ -73,6 +78,10 @@ public void RefreshForm()

#region --- Localization of All Controls ---

themes.Items.Clear();
themes.Items.Add("Default");
themes.Items.Add("Dark");

image_interpolation_mode.Text = Program.Lang.String("image_interpolation_mode", "projectform");
image_interpolation_modes.Items.Clear();
image_interpolation_modes.Items.AddRange(Program.Lang.StringArray("image_interpolation_mode", "projectform"));
Expand Down Expand Up @@ -201,6 +210,7 @@ public void RefreshForm()
#region --- Set All Settings to Defaults ---

// Defaults & forwarders
themes.SelectedIndex = 0; // Program.Config.application.theme;
reset_all_dialogs.Checked = false;
toggleSwitch2.Checked = Program.Config.forwarder.show_bios_screen;
forwarder_type.SelectedIndex = Program.Config.forwarder.root_storage_device;
Expand Down Expand Up @@ -229,7 +239,13 @@ public void RefreshForm()
Program.Config.Save();
}

GetBanners.Visible = Program.DebugMode;
// Debug-only options
#if DEBUG
GetBanners.Visible = true;
#else
GetBanners.Visible = false;
#endif
// theme.Visible = Program.DebugMode;

// NES
vc_nes_palettelist.SelectedIndex = Program.Config.nes.palette;
Expand Down Expand Up @@ -301,7 +317,8 @@ public void RefreshForm()
// -----------------------------

dirtyOption1 = languages.SelectedIndex;
dirtyOption2 = reset_all_dialogs.Checked;
dirtyOption2 = themes.SelectedIndex;
dirtyOption3 = reset_all_dialogs.Checked;
}

private void Loading(object sender, EventArgs e)
Expand Down Expand Up @@ -344,7 +361,7 @@ private void CustomDatabase_CheckedChanged(object sender, EventArgs e)
private void OK_Click(object sender, EventArgs e)
{
// -------------------------------------------
// Language setting
// Language and theme settings
// -------------------------------------------
var lng = languages.SelectedIndex == 0 ? "sys" : "en";
if (lng != "sys")
Expand All @@ -353,6 +370,7 @@ private void OK_Click(object sender, EventArgs e)
lng = item.Key;

Program.Config.application.language = lng;
// Program.Config.application.theme = theme.SelectedIndex;
// Program.Lang = new Language(lng);

// -------------------------------------------
Expand Down Expand Up @@ -467,7 +485,8 @@ private void OK_Click(object sender, EventArgs e)

bool isDirty = isShown
&& (dirtyOption1 != languages.SelectedIndex
|| dirtyOption2 != reset_all_dialogs.Checked);
|| dirtyOption2 != themes.SelectedIndex
|| dirtyOption3 != reset_all_dialogs.Checked);
if (isDirty) MessageBox.Show(Program.Lang.Msg(0), MessageBox.Buttons.Ok, MessageBox.Icons.Information);

if (toggledOnline)
Expand Down
Loading

0 comments on commit bbc7bf0

Please sign in to comment.