Skip to content

Commit

Permalink
- Finished implementing preliminary themes functionality
Browse files Browse the repository at this point in the history
- Fixed bug in which banner images randomly crashed due to memory issues, and added this fix to other memory-intensive processes
- Fixed bug in which projects would not close properly when exiting from the dropdown menu
- Other interface changes, notably the dialog buttons
  • Loading branch information
CatmanFan committed Feb 12, 2025
1 parent 6402022 commit d081e69
Show file tree
Hide file tree
Showing 21 changed files with 2,511 additions and 824 deletions.
3 changes: 1 addition & 2 deletions FriishProduce/MainForm.Designer.cs

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

55 changes: 28 additions & 27 deletions FriishProduce/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,29 @@ private ToolStripItem[] platformsStripItemList()
/// </summary>
private void RefreshForm()
{
#region -- Appearance --

if (Theme.ChangeColors(this, false))
{
if (mainPanel.BackgroundImage == null)
tabControl.BackgroundImage = mainPanel.BackgroundImage = Theme.GenerateBG(ClientRectangle);
tabControl.BackgroundImageLayout = mainPanel.BackgroundImageLayout = ImageLayout.Stretch;

toolStrip.Renderer = new Theme.CustomToolStrip();
tabControl.BackHighColor = tabControl.BackLowColor = Color.Transparent;
tabControl.TabBackHighColor = Theme.Colors.Form.BG;
tabControl.TabBackLowColor = Theme.Colors.Form.BG;
}

#endregion

new_project.MenuItems.Clear();
new_project.MenuItems.AddRange(platformsMenuItemList());
toolbarNewProject.DropDownItems.Clear();
toolbarNewProject.DropDownItems.AddRange(platformsStripItemList());

#region Localization
#region -- Localization --

Program.Lang.Control(this);
Text = Program.Lang.ApplicationTitle;
about.Text = Program.Lang.Format(("about_app", null), Program.Lang.ApplicationTitle);
Expand Down Expand Up @@ -147,6 +164,7 @@ private void RefreshForm()

try { BrowseProject.Filter = SaveProject.Filter = Program.Lang.String("filter.project"); }
catch { MessageBox.Show("Warning!\nThe language strings have not been loaded correctly.\n\nSeveral items may show up as 'undefined'.\n\nOther exceptions related to strings or filters can also occur!", MessageBox.Buttons.Ok, MessageBox.Icons.Warning, false); }

#endregion

if (Program.DebugMode)
Expand Down Expand Up @@ -193,7 +211,6 @@ private void MainForm_Loading(object sender, EventArgs e)
{
ClientSize = new Size(pF.Width, pF.Height + h);
MinimumSize = MaximumSize = Size;
tabControl.TabBackLowColor = pF.BackColor;
}

mainPanel.Size = tabControl.Size = new Size(Width - w, Height - h);
Expand Down Expand Up @@ -225,21 +242,8 @@ private void MainForm_Closing(object sender, FormClosingEventArgs e)
return;
}

var collection = tabControl.TabPages;

for (int i = 0; i < collection.Count; i++)
{
var p = tabControl.TabPages[i];
var f = p.Form as ProjectForm;

if (f.IsModified)
{
tabControl.TabPages[tabControl.TabPages.get_IndexOf(p)].Select();

if (!f.CheckUnsaved())
e.Cancel = true;
}
}
CloseAll_Click(sender, new EventArgs());
e.Cancel = tabControl.TabPages.Count > 0;
}

/// <summary>
Expand Down Expand Up @@ -427,18 +431,22 @@ private void TabContextMenu_Opening(object sender, CancelEventArgs e)

private void CloseAll_Click(object sender, EventArgs e)
{
List<Form> list = new();
List<ProjectForm> list = new();

for (int i = 0; i < tabControl.TabPages.Count; i++)
list.Add(tabControl.TabPages[i].Form as Form);
list.Add(tabControl.TabPages[i].Form as ProjectForm);

foreach (var tab in list)
tab.Close();
}

private void About_Click(object sender, EventArgs e) { using var about = new About(); about.ShowDialog(); }

private void MenuItem_Exit_Click(object sender, EventArgs e) => Application.Exit();
private void MenuItem_Exit_Click(object sender, EventArgs e)
{
Close();
Application.Exit();
}

private void ExportWAD_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -980,13 +988,6 @@ private void ExtractWAD_Click(object sender, EventArgs e)
}
}

private void ToolStrip_Paint(object sender, PaintEventArgs e)
{
Rectangle r = new(e.ClipRectangle.X, e.ClipRectangle.Y, e.ClipRectangle.Width, e.ClipRectangle.Height + 5);
using var b = new System.Drawing.Drawing2D.LinearGradientBrush(new Point(0, 0), new Point(0, r.Height), Color.White, Color.Gainsboro);
e.Graphics.FillRectangle(b, r);
}

private void TabControl_Paint(object sender, JacksiroKe.MdiTabCtrl.TabControl.TabPaintEventArgs e)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Expand Down
Loading

0 comments on commit d081e69

Please sign in to comment.