From f7db100148c2659da642d30954a0916619e3ef96 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 8 Nov 2020 16:12:12 +0000 Subject: [PATCH] Fixed: add row + remove row --- .../Forms/Tile/TTilePanelLayout.Designer.cs | 44 ++++++++++++------- Windows/Forms/Tile/TTilePanelLayout.cs | 13 +++++- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/Windows/Forms/Tile/TTilePanelLayout.Designer.cs b/Windows/Forms/Tile/TTilePanelLayout.Designer.cs index 03dd3db..93e43a8 100644 --- a/Windows/Forms/Tile/TTilePanelLayout.Designer.cs +++ b/Windows/Forms/Tile/TTilePanelLayout.Designer.cs @@ -44,6 +44,7 @@ this.bottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); + this.removeRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip2.SuspendLayout(); this.SuspendLayout(); @@ -54,19 +55,19 @@ this.addToolStripMenuItem, this.addListToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(181, 70); + this.contextMenuStrip1.Size = new System.Drawing.Size(139, 48); // // addToolStripMenuItem // this.addToolStripMenuItem.Name = "addToolStripMenuItem"; - this.addToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.addToolStripMenuItem.Size = new System.Drawing.Size(138, 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(138, 22); this.addListToolStripMenuItem.Text = "Add &List Tile"; this.addListToolStripMenuItem.Click += new System.EventHandler(this.addListTileMenuItem_Click); // @@ -76,38 +77,39 @@ this.toolStripMenuItem2, this.toolStripMenuItem5, this.toolStripMenuItem1, + this.removeRowToolStripMenuItem, this.toolStripSeparator2, this.toolStripMenuItem4, this.toolStripSeparator1, this.toolStripMenuItem3}); this.contextMenuStrip2.Name = "contextMenuStrip1"; - this.contextMenuStrip2.Size = new System.Drawing.Size(133, 126); + this.contextMenuStrip2.Size = new System.Drawing.Size(181, 170); // // toolStripMenuItem2 // this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(132, 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(132, 22); + this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 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(132, 22); + this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem1.Text = "&Edit"; this.toolStripMenuItem1.Click += new System.EventHandler(this.editGroupMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(129, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6); // // toolStripMenuItem4 // @@ -117,55 +119,62 @@ this.downToolStripMenuItem, this.bottomToolStripMenuItem}); this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(132, 22); + this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem4.Text = "&Move"; // // topToolStripMenuItem // this.topToolStripMenuItem.Name = "topToolStripMenuItem"; - this.topToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.topToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.topToolStripMenuItem.Text = "&Top"; this.topToolStripMenuItem.Click += new System.EventHandler(this.moveTopMenuItem_Click); // // upToolStripMenuItem // this.upToolStripMenuItem.Name = "upToolStripMenuItem"; - this.upToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.upToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.upToolStripMenuItem.Text = "&Up"; this.upToolStripMenuItem.Click += new System.EventHandler(this.moveUpMenuItem_Click); // // downToolStripMenuItem // this.downToolStripMenuItem.Name = "downToolStripMenuItem"; - this.downToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.downToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.downToolStripMenuItem.Text = "&Down"; this.downToolStripMenuItem.Click += new System.EventHandler(this.moveDownMenuItem_Click); // // bottomToolStripMenuItem // this.bottomToolStripMenuItem.Name = "bottomToolStripMenuItem"; - this.bottomToolStripMenuItem.Size = new System.Drawing.Size(114, 22); + this.bottomToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.bottomToolStripMenuItem.Text = "&Bottom"; this.bottomToolStripMenuItem.Click += new System.EventHandler(this.moveBottomMenuItem_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(129, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(132, 22); + this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem3.Text = "&Remove"; this.toolStripMenuItem3.Click += new System.EventHandler(this.removeGroupMenuItem3_Click); // - // TilePanelLayout + // 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); + // + // TTilePanelLayout // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Transparent; - this.Name = "TilePanelLayout"; + this.Name = "TTilePanelLayout"; this.Size = new System.Drawing.Size(370, 150); this.contextMenuStrip1.ResumeLayout(false); this.contextMenuStrip2.ResumeLayout(false); @@ -189,5 +198,6 @@ private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; + private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem; } } diff --git a/Windows/Forms/Tile/TTilePanelLayout.cs b/Windows/Forms/Tile/TTilePanelLayout.cs index bf72530..7e0bc29 100644 --- a/Windows/Forms/Tile/TTilePanelLayout.cs +++ b/Windows/Forms/Tile/TTilePanelLayout.cs @@ -407,7 +407,7 @@ namespace AppLauncher.Windows.Forms })); } - public void AddRow() =>this.SetGridSize(groupModel.GridSize.Width, (groupModel.GridSize.Height + 1)); + public void AddRow() => this.SetGridSize(gridSize.X, (gridSize.Y + 1)); public void EditGroup() => EditGroupForm.ShowDialog(this); @@ -578,6 +578,8 @@ namespace AppLauncher.Windows.Forms { gridSize = new Point(width, height); + groupModel.GridSize.Height = height; + expandedHeight = (this.TileSize * height) + labelHeight; int w = (this.TileSize * gridSize.X); @@ -782,5 +784,14 @@ namespace AppLauncher.Windows.Forms private void removeGroupMenuItem3_Click(object sender, EventArgs e) => this.Remove(); + private void removeRowToolStripMenuItem_Click(object sender, EventArgs e) + { + bool rs = items.Exists(x => x.Coord.Y.Equals(gridSize.Y - 1)); + if (!rs) + { + this.SetGridSize(gridSize.X, (gridSize.Y - 1)); + } + } + } }