From b126c782ddcc37c6a85880d840f78c32a39a7df4 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 31 Jul 2021 18:29:21 +0100 Subject: [PATCH] Changed: context menus --- Windows/Forms/TilePanelLayout.Designer.cs | 98 +++++++----- Windows/Forms/TilePanelLayout.cs | 174 ++++++++++++++++------ 2 files changed, 185 insertions(+), 87 deletions(-) diff --git a/Windows/Forms/TilePanelLayout.Designer.cs b/Windows/Forms/TilePanelLayout.Designer.cs index db0008e..41d2ee5 100644 --- a/Windows/Forms/TilePanelLayout.Designer.cs +++ b/Windows/Forms/TilePanelLayout.Designer.cs @@ -32,11 +32,11 @@ this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator(); + this.removeRowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.removeRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); this.topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -46,8 +46,10 @@ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.label1 = new System.Windows.Forms.Label(); - this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator(); - this.removeRowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem(); + this.removeRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); this.SuspendLayout(); @@ -60,68 +62,66 @@ this.toolStripMenuItem6, this.removeRowToolStripMenuItem1}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(181, 98); + this.contextMenuStrip1.Size = new System.Drawing.Size(144, 76); // // addToolStripMenuItem // this.addToolStripMenuItem.Name = "addToolStripMenuItem"; - this.addToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.addToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.addToolStripMenuItem.Text = "&Add Tile"; this.addToolStripMenuItem.Click += new System.EventHandler(this.addTileMenuItem_Click); // // addListToolStripMenuItem // this.addListToolStripMenuItem.Name = "addListToolStripMenuItem"; - this.addListToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.addListToolStripMenuItem.Size = new System.Drawing.Size(143, 22); this.addListToolStripMenuItem.Text = "Add &Folder"; this.addListToolStripMenuItem.Click += new System.EventHandler(this.addListTileMenuItem_Click); // + // toolStripMenuItem6 + // + this.toolStripMenuItem6.Name = "toolStripMenuItem6"; + this.toolStripMenuItem6.Size = new System.Drawing.Size(140, 6); + // + // removeRowToolStripMenuItem1 + // + this.removeRowToolStripMenuItem1.Name = "removeRowToolStripMenuItem1"; + this.removeRowToolStripMenuItem1.Size = new System.Drawing.Size(143, 22); + this.removeRowToolStripMenuItem1.Text = "&Remove Row"; + this.removeRowToolStripMenuItem1.Click += new System.EventHandler(this.removeRowToolStripMenuItem_Click_1); + // // contextMenuStrip2 // this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem2, - this.toolStripMenuItem5, this.toolStripMenuItem1, - this.removeRowToolStripMenuItem, + this.toolStripSeparator3, + this.toolStripMenuItem7, this.toolStripSeparator2, this.toolStripMenuItem4, this.toolStripSeparator1, this.toolStripMenuItem3}); this.contextMenuStrip2.Name = "contextMenuStrip1"; - this.contextMenuStrip2.Size = new System.Drawing.Size(144, 148); + this.contextMenuStrip2.Size = new System.Drawing.Size(181, 154); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(143, 22); + this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem2.Text = "&Add Group"; this.toolStripMenuItem2.Click += new System.EventHandler(this.addGroupMenuItem_Click); // - // toolStripMenuItem5 - // - this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(143, 22); - this.toolStripMenuItem5.Text = "Add &Row"; - this.toolStripMenuItem5.Click += new System.EventHandler(this.addRowMenuItem_Click); - // // toolStripMenuItem1 // this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(143, 22); + this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem1.Text = "&Edit"; this.toolStripMenuItem1.Click += new System.EventHandler(this.editGroupMenuItem_Click); // - // removeRowToolStripMenuItem - // - this.removeRowToolStripMenuItem.Name = "removeRowToolStripMenuItem"; - this.removeRowToolStripMenuItem.Size = new System.Drawing.Size(143, 22); - this.removeRowToolStripMenuItem.Text = "Remo&ve Row"; - this.removeRowToolStripMenuItem.Click += new System.EventHandler(this.removeRowToolStripMenuItem_Click); - // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(140, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6); // // toolStripMenuItem4 // @@ -131,7 +131,7 @@ this.downToolStripMenuItem, this.bottomToolStripMenuItem}); this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(143, 22); + this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem4.Text = "&Move"; // // topToolStripMenuItem @@ -165,12 +165,12 @@ // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(140, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(143, 22); + this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem3.Text = "&Remove"; this.toolStripMenuItem3.Click += new System.EventHandler(this.removeGroupMenuItem3_Click); // @@ -189,17 +189,33 @@ this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); // - // toolStripMenuItem6 + // toolStripSeparator3 // - this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(177, 6); + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6); // - // removeRowToolStripMenuItem1 + // toolStripMenuItem7 // - this.removeRowToolStripMenuItem1.Name = "removeRowToolStripMenuItem1"; - this.removeRowToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); - this.removeRowToolStripMenuItem1.Text = "&Remove Row"; - this.removeRowToolStripMenuItem1.Click += new System.EventHandler(this.removeRowToolStripMenuItem1_Click); + this.toolStripMenuItem7.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItem5, + this.removeRowToolStripMenuItem}); + this.toolStripMenuItem7.Name = "toolStripMenuItem7"; + this.toolStripMenuItem7.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem7.Text = "Ro&w"; + // + // toolStripMenuItem5 + // + this.toolStripMenuItem5.Name = "toolStripMenuItem5"; + this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItem5.Text = "Add &Row"; + this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click); + // + // removeRowToolStripMenuItem + // + this.removeRowToolStripMenuItem.Name = "removeRowToolStripMenuItem"; + this.removeRowToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.removeRowToolStripMenuItem.Text = "Remo&ve Row"; + this.removeRowToolStripMenuItem.Click += new System.EventHandler(this.removeRowToolStripMenuItem_Click_1); // // TilePanelLayout // @@ -223,7 +239,6 @@ private System.Windows.Forms.ToolStripMenuItem addListToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4; @@ -233,9 +248,12 @@ private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; - private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem; private System.Windows.Forms.Label label1; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6; private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem1; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem7; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5; + private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem; } } diff --git a/Windows/Forms/TilePanelLayout.cs b/Windows/Forms/TilePanelLayout.cs index 66cf586..ed46f53 100644 --- a/Windows/Forms/TilePanelLayout.cs +++ b/Windows/Forms/TilePanelLayout.cs @@ -764,52 +764,6 @@ namespace FizzyLauncher.Windows.Forms } } - private void addTileMenuItem_Click(object sender, EventArgs e) - { - Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y); - - EditTileForm.ShowAddDialog(this, coord); - } - - private void addListTileMenuItem_Click(object sender, EventArgs e) - { - Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y); - - EditTileFolderForm.ShowAddDialog(this, coord); - } - - private void addGroupMenuItem_Click(object sender, EventArgs e) => this.AddGroup(); - - private void addRowMenuItem_Click(object sender, EventArgs e) => this.AddRow(); - - private void editGroupMenuItem_Click(object sender, EventArgs e) => this.EditGroup(); - - private void moveTopMenuItem_Click(object sender, EventArgs e) => this.MoveTop(); - - private void moveUpMenuItem_Click(object sender, EventArgs e) => this.MoveUp(); - - private void moveDownMenuItem_Click(object sender, EventArgs e) => this.MoveDown(); - - private void moveBottomMenuItem_Click(object sender, EventArgs e) => this.MoveBottom(); - - private void removeGroupMenuItem3_Click(object sender, EventArgs e) => this.Remove(); - - private void removeRowToolStripMenuItem_Click(object sender, EventArgs e) - { - if (gridSize.Y <= 1) - { - return; - } - - bool rs = items.Exists(x => x.Coord.Y.Equals(gridSize.Y - 1)); - if (rs) - { - return; - } - - this.SetGridSize(gridSize.X, (gridSize.Y - 1)); - } - private async void label1_MouseClick(object sender, MouseEventArgs e) { if (isAnimating) return; @@ -852,12 +806,138 @@ namespace FizzyLauncher.Windows.Forms } } + #region tile context menu + + /// + /// Add tile + /// + /// + /// + private void addTileMenuItem_Click(object sender, EventArgs e) + { + Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y); + + EditTileForm.ShowAddDialog(this, coord); + } + + /// + /// Add folder + /// + /// + /// + private void addListTileMenuItem_Click(object sender, EventArgs e) + { + Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y); + + EditTileFolderForm.ShowAddDialog(this, coord); + } + + #endregion + + #region group context menu + + /// + /// Add group + /// + /// + /// + private void addGroupMenuItem_Click(object sender, EventArgs e) + { + this.AddGroup(); + } + + /// + /// Edit group + /// + /// + /// + private void editGroupMenuItem_Click(object sender, EventArgs e) + { + this.EditGroup(); + } + + /// + /// Add row + /// + /// + /// + private void toolStripMenuItem5_Click(object sender, EventArgs e) + { + this.AddRow(); + } + /// /// Remove row /// /// /// - private void removeRowToolStripMenuItem1_Click(object sender, EventArgs e) => removeRowToolStripMenuItem_Click(sender, e); + private void removeRowToolStripMenuItem_Click_1(object sender, EventArgs e) + { + if (gridSize.Y <= 1) + { + return; + } + + bool rs = items.Exists(x => x.Coord.Y.Equals(gridSize.Y - 1)); + if (rs) + { + return; + } + + this.SetGridSize(gridSize.X, (gridSize.Y - 1)); + } + + /// + /// Move to top + /// + /// + /// + private void moveTopMenuItem_Click(object sender, EventArgs e) + { + this.MoveTop(); + } + + /// + /// Move up + /// + /// + /// + private void moveUpMenuItem_Click(object sender, EventArgs e) + { + this.MoveUp(); + } + + /// + /// Move down + /// + /// + /// + private void moveDownMenuItem_Click(object sender, EventArgs e) + { + this.MoveDown(); + } + + /// + /// Move to bottom + /// + /// + /// + private void moveBottomMenuItem_Click(object sender, EventArgs e) + { + this.MoveBottom(); + } + + /// + /// Remove group + /// + /// + /// + private void removeGroupMenuItem3_Click(object sender, EventArgs e) + { + this.Remove(); + } + + #endregion } }