1
0
mirror of synced 2025-02-26 06:49:45 +01:00

Add right click to close tabs, and double click title bar to maxamize

This commit is contained in:
KillzXGaming 2019-03-28 17:28:39 -04:00
parent 8a74942ead
commit 718ddfaea3
10 changed files with 34 additions and 4 deletions

Binary file not shown.

View File

@ -135,7 +135,6 @@ namespace Switch_Toolbox.Library
private void SaveMaterials(Scene scene, STGenericModel model, string FileName, List<STGenericTexture> Textures) private void SaveMaterials(Scene scene, STGenericModel model, string FileName, List<STGenericTexture> Textures)
{ {
string TextureExtension = ".png"; string TextureExtension = ".png";
string TexturePath = System.IO.Path.GetDirectoryName(FileName); string TexturePath = System.IO.Path.GetDirectoryName(FileName);
@ -146,7 +145,6 @@ namespace Switch_Toolbox.Library
var bitmap = tex.GetBitmap(); var bitmap = tex.GetBitmap();
bitmap.Save(path); bitmap.Save(path);
bitmap.Dispose(); bitmap.Dispose();
} }
foreach (var mat in model.Nodes[1].Nodes) foreach (var mat in model.Nodes[1].Nodes)
@ -160,6 +158,7 @@ namespace Switch_Toolbox.Library
{ {
TextureSlot slot = new TextureSlot(); TextureSlot slot = new TextureSlot();
string path = System.IO.Path.Combine(TexturePath, tex.Name + TextureExtension); string path = System.IO.Path.Combine(TexturePath, tex.Name + TextureExtension);
slot.FilePath = path; slot.FilePath = path;
slot.UVIndex = 0; slot.UVIndex = 0;
slot.Flags = 0; slot.Flags = 0;

View File

@ -62,6 +62,18 @@ namespace Switch_Toolbox.Library.Forms
this.Renderer = new MenuRenderer(); this.Renderer = new MenuRenderer();
} }
} }
public STContextMenuStrip(IContainer container)
{
this.ForeColor = FormThemes.BaseTheme.FormContextMenuForeColor;
if (FormThemes.ActivePreset != FormThemes.Preset.White)
{
this.BackColor = titlebarBackColor;
this.ForeColor = titlebarForeColor;
this.Renderer = new MenuRenderer();
}
}
} }
public class MenuRenderer : ToolStripProfessionalRenderer public class MenuRenderer : ToolStripProfessionalRenderer

View File

@ -129,6 +129,7 @@ namespace Switch_Toolbox.Library.Forms
this.TitleBar.Name = "TitleBar"; this.TitleBar.Name = "TitleBar";
this.TitleBar.Size = new System.Drawing.Size(543, 25); this.TitleBar.Size = new System.Drawing.Size(543, 25);
this.TitleBar.TabIndex = 10; this.TitleBar.TabIndex = 10;
this.TitleBar.DoubleClick += new System.EventHandler(this.TitleBar_DoubleClick);
this.TitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TitleBar_MouseDown); this.TitleBar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.TitleBar_MouseDown);
// //
// LblTitle // LblTitle
@ -397,6 +398,14 @@ namespace Switch_Toolbox.Library.Forms
Rectangle Top { get { return new Rectangle(0, 0, this.ClientSize.Width, BorderSize); } } Rectangle Top { get { return new Rectangle(0, 0, this.ClientSize.Width, BorderSize); } }
Rectangle Left { get { return new Rectangle(0, 0, BorderSize, this.ClientSize.Height); } } Rectangle Left { get { return new Rectangle(0, 0, BorderSize, this.ClientSize.Height); } }
private void TitleBar_DoubleClick(object sender, EventArgs e)
{
if (canResize)
{
Maximize();
}
}
Rectangle Bottom { get { return new Rectangle(0, this.ClientSize.Height - BorderSize, this.ClientSize.Width, BorderSize); } } Rectangle Bottom { get { return new Rectangle(0, this.ClientSize.Height - BorderSize, this.ClientSize.Width, BorderSize); } }
Rectangle Right { get { return new Rectangle(this.ClientSize.Width - BorderSize, 0, BorderSize, this.ClientSize.Height); } } Rectangle Right { get { return new Rectangle(this.ClientSize.Width - BorderSize, 0, BorderSize, this.ClientSize.Height); } }

View File

@ -56,7 +56,7 @@
this.creditsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.creditsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel1 = new Switch_Toolbox.Library.Forms.STPanel();
this.tabForms = new Switch_Toolbox.Library.Forms.STTabControl(); this.tabForms = new Switch_Toolbox.Library.Forms.STTabControl();
this.tabControlContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.tabControlContextMenuStrip = new Switch_Toolbox.Library.Forms.STContextMenuStrip(this.components);
this.closeToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.closeToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel(); this.stPanel2 = new Switch_Toolbox.Library.Forms.STPanel();
this.BtnMdiMinimize = new System.Windows.Forms.PictureBox(); this.BtnMdiMinimize = new System.Windows.Forms.PictureBox();
@ -289,6 +289,7 @@
this.tabForms.TabIndex = 9; this.tabForms.TabIndex = 9;
this.tabForms.Visible = false; this.tabForms.Visible = false;
this.tabForms.SelectedIndexChanged += new System.EventHandler(this.tabForms_SelectedIndexChanged); this.tabForms.SelectedIndexChanged += new System.EventHandler(this.tabForms_SelectedIndexChanged);
this.tabForms.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tabForms_MouseClick);
// //
// tabControlContextMenuStrip // tabControlContextMenuStrip
// //
@ -456,7 +457,7 @@
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip tabControlContextMenuStrip; private Switch_Toolbox.Library.Forms.STContextMenuStrip tabControlContextMenuStrip;
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem fileAssociationsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fileAssociationsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem mainSettingsToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem mainSettingsToolStripMenuItem;

View File

@ -792,6 +792,7 @@ namespace Toolbox
{ {
if (child == tabForms.SelectedTab.Tag) if (child == tabForms.SelectedTab.Tag)
{ {
OnMdiWindowClosed();
child.Close(); child.Close();
return; return;
} }
@ -1045,5 +1046,13 @@ namespace Toolbox
private void updateToolstrip_Click(object sender, EventArgs e) { private void updateToolstrip_Click(object sender, EventArgs e) {
UpdateNotifcationClick(); UpdateNotifcationClick();
} }
private void tabForms_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
this.tabControlContextMenuStrip.Show(this.tabForms, e.Location);
}
}
} }
} }