diff --git a/NoFences/FenceWindow.Designer.cs b/NoFences/FenceWindow.Designer.cs index 548a003..cbfe454 100644 --- a/NoFences/FenceWindow.Designer.cs +++ b/NoFences/FenceWindow.Designer.cs @@ -37,6 +37,7 @@ private void InitializeComponent() this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.newFenceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.titleSizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -47,19 +48,20 @@ private void InitializeComponent() this.lockedToolStripMenuItem, this.minifyToolStripMenuItem, this.renameToolStripMenuItem, + this.titleSizeToolStripMenuItem, this.toolStripSeparator1, this.newFenceToolStripMenuItem, this.exitToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; - this.contextMenuStrip1.Size = new System.Drawing.Size(152, 142); + this.contextMenuStrip1.Size = new System.Drawing.Size(181, 186); this.contextMenuStrip1.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); // // deleteItemToolStripMenuItem // this.deleteItemToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.deleteItemToolStripMenuItem.Name = "deleteItemToolStripMenuItem"; - this.deleteItemToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.deleteItemToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.deleteItemToolStripMenuItem.Text = "Delete item"; this.deleteItemToolStripMenuItem.Click += new System.EventHandler(this.deleteItemToolStripMenuItem_Click); // @@ -67,7 +69,7 @@ private void InitializeComponent() // this.lockedToolStripMenuItem.CheckOnClick = true; this.lockedToolStripMenuItem.Name = "lockedToolStripMenuItem"; - this.lockedToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.lockedToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.lockedToolStripMenuItem.Text = "Lock"; this.lockedToolStripMenuItem.Click += new System.EventHandler(this.lockedToolStripMenuItem_Click); // @@ -75,36 +77,43 @@ private void InitializeComponent() // this.minifyToolStripMenuItem.CheckOnClick = true; this.minifyToolStripMenuItem.Name = "minifyToolStripMenuItem"; - this.minifyToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.minifyToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.minifyToolStripMenuItem.Text = "Minify"; this.minifyToolStripMenuItem.Click += new System.EventHandler(this.minifyToolStripMenuItem_Click); // // renameToolStripMenuItem // this.renameToolStripMenuItem.Name = "renameToolStripMenuItem"; - this.renameToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.renameToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.renameToolStripMenuItem.Text = "Rename"; this.renameToolStripMenuItem.Click += new System.EventHandler(this.renameToolStripMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(148, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); // // newFenceToolStripMenuItem // this.newFenceToolStripMenuItem.Name = "newFenceToolStripMenuItem"; - this.newFenceToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.newFenceToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.newFenceToolStripMenuItem.Text = "New Fence"; this.newFenceToolStripMenuItem.Click += new System.EventHandler(this.newFenceToolStripMenuItem_Click); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(151, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.exitToolStripMenuItem.Text = "Remove Fence"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // + // titleSizeToolStripMenuItem + // + this.titleSizeToolStripMenuItem.Name = "titleSizeToolStripMenuItem"; + this.titleSizeToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.titleSizeToolStripMenuItem.Text = "Title size..."; + this.titleSizeToolStripMenuItem.Click += new System.EventHandler(this.titleSizeToolStripMenuItem_Click); + // // FenceWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -148,6 +157,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem renameToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem deleteItemToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem newFenceToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem titleSizeToolStripMenuItem; } } diff --git a/NoFences/FenceWindow.cs b/NoFences/FenceWindow.cs index ec71954..dec25b3 100644 --- a/NoFences/FenceWindow.cs +++ b/NoFences/FenceWindow.cs @@ -15,7 +15,7 @@ namespace NoFences { public partial class FenceWindow : Form { - private const int titleHeight = 35; + private int titleHeight; private const int titleOffset = 3; private const int itemWidth = 75; private const int itemHeight = 32 + itemPadding + textHeight; @@ -25,8 +25,8 @@ public partial class FenceWindow : Form private readonly FenceInfo fenceInfo; - private readonly Font titleFont; - private readonly Font iconFont; + private Font titleFont; + private Font iconFont; private string selectedItem; private string hoveringItem; @@ -42,6 +42,13 @@ public partial class FenceWindow : Form private DateTime lastRedraw = DateTime.Now; + private void ReloadFonts() + { + var family = new FontFamily("Segoe UI"); + titleFont = new Font(family, (int)Math.Floor(titleHeight / 2.0)); + iconFont = new Font(family, 9); + } + public FenceWindow(FenceInfo fenceInfo) { InitializeComponent(); @@ -49,10 +56,11 @@ public FenceWindow(FenceInfo fenceInfo) BlurUtil.EnableBlur(Handle); WindowUtil.HideFromAltTab(Handle); DesktopUtil.GlueToDesktop(Handle); + this.titleHeight = fenceInfo.TitleHeight; + if (titleHeight < 16 || titleHeight > 100) + titleHeight = 35; - var family = new FontFamily("Segoe UI"); - titleFont = new Font(family, 17); - iconFont = new Font(family, 9); + ReloadFonts(); AllowDrop = true; @@ -83,7 +91,8 @@ protected override void WndProc(ref Message m) // Mouse leave var myrect = new Rectangle(Location, Size); - if (m.Msg == 0x02a2 && !myrect.IntersectsWith(new Rectangle(MousePosition, new Size(1, 1)))) { + if (m.Msg == 0x02a2 && !myrect.IntersectsWith(new Rectangle(MousePosition, new Size(1, 1)))) + { Minify(); } @@ -410,6 +419,24 @@ private void FenceWindow_Load(object sender, EventArgs e) { } + + private void titleSizeToolStripMenuItem_Click(object sender, EventArgs e) + { + var dialog = new HeightDialog(fenceInfo.TitleHeight); + if (dialog.ShowDialog(this) == DialogResult.OK) + { + fenceInfo.TitleHeight = dialog.TitleHeight; + titleHeight = dialog.TitleHeight; + ReloadFonts(); + Minify(); + if (isMinified) + { + Height = titleHeight; + } + Refresh(); + Save(); + } + } } } diff --git a/NoFences/Model/FenceInfo.cs b/NoFences/Model/FenceInfo.cs index 667c94c..7494ffa 100644 --- a/NoFences/Model/FenceInfo.cs +++ b/NoFences/Model/FenceInfo.cs @@ -21,6 +21,8 @@ public class FenceInfo public bool CanMinify { get; set; } + public int TitleHeight { get; set; } = 35; + public List Files { get; set; } = new List(); public FenceInfo() diff --git a/NoFences/NoFences.csproj b/NoFences/NoFences.csproj index 731931f..e5e7fd2 100644 --- a/NoFences/NoFences.csproj +++ b/NoFences/NoFences.csproj @@ -52,6 +52,12 @@ EditDialog.cs + + Form + + + HeightDialog.cs + @@ -74,6 +80,9 @@ FenceWindow.cs + + HeightDialog.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/NoFences/Properties/AssemblyInfo.cs b/NoFences/Properties/AssemblyInfo.cs index d6a718d..3d76aa8 100644 --- a/NoFences/Properties/AssemblyInfo.cs +++ b/NoFences/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("NoFences")] -[assembly: AssemblyDescription("")] +[assembly: AssemblyDescription("Open Source Alternative to 'Stardock Fences'")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NoFences")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.0.0")] -[assembly: AssemblyFileVersion("1.3.0.0")] +[assembly: AssemblyVersion("1.4.0.0")] +[assembly: AssemblyFileVersion("1.4.0.0")]