Changed: context menus

This commit is contained in:
Ray 2021-07-31 18:29:21 +01:00
parent b037e8c0bd
commit b126c782dd
2 changed files with 185 additions and 87 deletions

View File

@ -32,11 +32,11 @@
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addListToolStripMenuItem = 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.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = 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.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -46,8 +46,10 @@
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.removeRowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); 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.contextMenuStrip1.SuspendLayout();
this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -60,68 +62,66 @@
this.toolStripMenuItem6, this.toolStripMenuItem6,
this.removeRowToolStripMenuItem1}); this.removeRowToolStripMenuItem1});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 98); this.contextMenuStrip1.Size = new System.Drawing.Size(144, 76);
// //
// addToolStripMenuItem // addToolStripMenuItem
// //
this.addToolStripMenuItem.Name = "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.Text = "&Add Tile";
this.addToolStripMenuItem.Click += new System.EventHandler(this.addTileMenuItem_Click); this.addToolStripMenuItem.Click += new System.EventHandler(this.addTileMenuItem_Click);
// //
// addListToolStripMenuItem // addListToolStripMenuItem
// //
this.addListToolStripMenuItem.Name = "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.Text = "Add &Folder";
this.addListToolStripMenuItem.Click += new System.EventHandler(this.addListTileMenuItem_Click); 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 // contextMenuStrip2
// //
this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem2, this.toolStripMenuItem2,
this.toolStripMenuItem5,
this.toolStripMenuItem1, this.toolStripMenuItem1,
this.removeRowToolStripMenuItem, this.toolStripSeparator3,
this.toolStripMenuItem7,
this.toolStripSeparator2, this.toolStripSeparator2,
this.toolStripMenuItem4, this.toolStripMenuItem4,
this.toolStripSeparator1, this.toolStripSeparator1,
this.toolStripMenuItem3}); this.toolStripMenuItem3});
this.contextMenuStrip2.Name = "contextMenuStrip1"; this.contextMenuStrip2.Name = "contextMenuStrip1";
this.contextMenuStrip2.Size = new System.Drawing.Size(144, 148); this.contextMenuStrip2.Size = new System.Drawing.Size(181, 154);
// //
// toolStripMenuItem2 // toolStripMenuItem2
// //
this.toolStripMenuItem2.Name = "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.Text = "&Add Group";
this.toolStripMenuItem2.Click += new System.EventHandler(this.addGroupMenuItem_Click); 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 // toolStripMenuItem1
// //
this.toolStripMenuItem1.Name = "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.Text = "&Edit";
this.toolStripMenuItem1.Click += new System.EventHandler(this.editGroupMenuItem_Click); 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 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(140, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
// //
// toolStripMenuItem4 // toolStripMenuItem4
// //
@ -131,7 +131,7 @@
this.downToolStripMenuItem, this.downToolStripMenuItem,
this.bottomToolStripMenuItem}); this.bottomToolStripMenuItem});
this.toolStripMenuItem4.Name = "toolStripMenuItem4"; 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"; this.toolStripMenuItem4.Text = "&Move";
// //
// topToolStripMenuItem // topToolStripMenuItem
@ -165,12 +165,12 @@
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(140, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
// //
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.Name = "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.Text = "&Remove";
this.toolStripMenuItem3.Click += new System.EventHandler(this.removeGroupMenuItem3_Click); 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.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick);
this.label1.MouseDoubleClick += 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.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripMenuItem6.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
// //
// removeRowToolStripMenuItem1 // toolStripMenuItem7
// //
this.removeRowToolStripMenuItem1.Name = "removeRowToolStripMenuItem1"; this.toolStripMenuItem7.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.removeRowToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem5,
this.removeRowToolStripMenuItem1.Text = "&Remove Row"; this.removeRowToolStripMenuItem});
this.removeRowToolStripMenuItem1.Click += new System.EventHandler(this.removeRowToolStripMenuItem1_Click); 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 // TilePanelLayout
// //
@ -223,7 +239,6 @@
private System.Windows.Forms.ToolStripMenuItem addListToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem addListToolStripMenuItem;
private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
@ -233,9 +248,12 @@
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6;
private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem1; 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;
} }
} }

View File

@ -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) private async void label1_MouseClick(object sender, MouseEventArgs e)
{ {
if (isAnimating) return; if (isAnimating) return;
@ -852,12 +806,138 @@ namespace FizzyLauncher.Windows.Forms
} }
} }
#region tile context menu
/// <summary>
/// Add tile
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addTileMenuItem_Click(object sender, EventArgs e)
{
Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
EditTileForm.ShowAddDialog(this, coord);
}
/// <summary>
/// Add folder
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addListTileMenuItem_Click(object sender, EventArgs e)
{
Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
EditTileFolderForm.ShowAddDialog(this, coord);
}
#endregion
#region group context menu
/// <summary>
/// Add group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addGroupMenuItem_Click(object sender, EventArgs e)
{
this.AddGroup();
}
/// <summary>
/// Edit group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void editGroupMenuItem_Click(object sender, EventArgs e)
{
this.EditGroup();
}
/// <summary>
/// Add row
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem5_Click(object sender, EventArgs e)
{
this.AddRow();
}
/// <summary> /// <summary>
/// Remove row /// Remove row
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
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));
}
/// <summary>
/// Move to top
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveTopMenuItem_Click(object sender, EventArgs e)
{
this.MoveTop();
}
/// <summary>
/// Move up
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveUpMenuItem_Click(object sender, EventArgs e)
{
this.MoveUp();
}
/// <summary>
/// Move down
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveDownMenuItem_Click(object sender, EventArgs e)
{
this.MoveDown();
}
/// <summary>
/// Move to bottom
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveBottomMenuItem_Click(object sender, EventArgs e)
{
this.MoveBottom();
}
/// <summary>
/// Remove group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void removeGroupMenuItem3_Click(object sender, EventArgs e)
{
this.Remove();
}
#endregion
} }
} }