From 88299629bb0c376a950a284a8d164d45689bd7e6 Mon Sep 17 00:00:00 2001 From: Jaex Date: Sun, 14 Feb 2016 01:00:53 +0200 Subject: [PATCH] Quick task editor double click to edit, made form localizable --- .../Forms/QuickTaskMenuEditorForm.Designer.cs | 63 ++--- ShareX/Forms/QuickTaskMenuEditorForm.cs | 27 ++- ShareX/Forms/QuickTaskMenuEditorForm.resx | 225 ++++++++++++++++++ 3 files changed, 261 insertions(+), 54 deletions(-) diff --git a/ShareX/Forms/QuickTaskMenuEditorForm.Designer.cs b/ShareX/Forms/QuickTaskMenuEditorForm.Designer.cs index 9b7b17fa4..19243e2d2 100644 --- a/ShareX/Forms/QuickTaskMenuEditorForm.Designer.cs +++ b/ShareX/Forms/QuickTaskMenuEditorForm.Designer.cs @@ -28,6 +28,7 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QuickTaskMenuEditorForm)); this.lvPresets = new ShareX.HelpersLib.MyListView(); this.chName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.btnAdd = new System.Windows.Forms.Button(); @@ -35,105 +36,75 @@ private void InitializeComponent() this.btnRemove = new System.Windows.Forms.Button(); this.btnReset = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); + this.lblTip = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lvPresets // this.lvPresets.AllowDrop = true; this.lvPresets.AllowItemDrag = true; - this.lvPresets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); + resources.ApplyResources(this.lvPresets, "lvPresets"); this.lvPresets.AutoFillColumn = true; this.lvPresets.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.chName}); - this.lvPresets.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lvPresets.FullRowSelect = true; this.lvPresets.GridLines = true; this.lvPresets.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; - this.lvPresets.Location = new System.Drawing.Point(8, 8); this.lvPresets.Name = "lvPresets"; - this.lvPresets.Size = new System.Drawing.Size(448, 328); - this.lvPresets.TabIndex = 0; this.lvPresets.UseCompatibleStateImageBehavior = false; this.lvPresets.View = System.Windows.Forms.View.Details; this.lvPresets.ItemMoved += new ShareX.HelpersLib.MyListView.ListViewItemMovedEventHandler(this.lvPresets_ItemMoved); + this.lvPresets.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvPresets_MouseDoubleClick); // // chName // - this.chName.Width = 372; + resources.ApplyResources(this.chName, "chName"); // // btnAdd // - this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnAdd.Location = new System.Drawing.Point(8, 368); + resources.ApplyResources(this.btnAdd, "btnAdd"); this.btnAdd.Name = "btnAdd"; - this.btnAdd.Size = new System.Drawing.Size(144, 23); - this.btnAdd.TabIndex = 1; - this.btnAdd.Text = "Add"; this.btnAdd.UseVisualStyleBackColor = true; this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click); // // btnEdit // - this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnEdit.Location = new System.Drawing.Point(160, 368); + resources.ApplyResources(this.btnEdit, "btnEdit"); this.btnEdit.Name = "btnEdit"; - this.btnEdit.Size = new System.Drawing.Size(144, 23); - this.btnEdit.TabIndex = 2; - this.btnEdit.Text = "Edit"; this.btnEdit.UseVisualStyleBackColor = true; this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click); // // btnRemove // - this.btnRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnRemove.Location = new System.Drawing.Point(312, 368); + resources.ApplyResources(this.btnRemove, "btnRemove"); this.btnRemove.Name = "btnRemove"; - this.btnRemove.Size = new System.Drawing.Size(144, 23); - this.btnRemove.TabIndex = 3; - this.btnRemove.Text = "Remove"; this.btnRemove.UseVisualStyleBackColor = true; this.btnRemove.Click += new System.EventHandler(this.btnRemove_Click); // // btnReset // - this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnReset.Location = new System.Drawing.Point(272, 400); + resources.ApplyResources(this.btnReset, "btnReset"); this.btnReset.Name = "btnReset"; - this.btnReset.Size = new System.Drawing.Size(184, 23); - this.btnReset.TabIndex = 4; - this.btnReset.Text = "Reset to default"; this.btnReset.UseVisualStyleBackColor = true; this.btnReset.Click += new System.EventHandler(this.btnReset_Click); // // btnClose // - this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnClose.Location = new System.Drawing.Point(8, 400); + resources.ApplyResources(this.btnClose, "btnClose"); this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(256, 23); - this.btnClose.TabIndex = 5; - this.btnClose.Text = "Close"; this.btnClose.UseVisualStyleBackColor = true; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // - // label1 + // lblTip // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(8, 344); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(341, 13); - this.label1.TabIndex = 6; - this.label1.Text = "Tip: If you add empty task it will be converted to separator line in menu."; + resources.ApplyResources(this.lblTip, "lblTip"); + this.lblTip.Name = "lblTip"; // // QuickTaskMenuEditorForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(464, 432); - this.Controls.Add(this.label1); + this.Controls.Add(this.lblTip); this.Controls.Add(this.btnClose); this.Controls.Add(this.btnReset); this.Controls.Add(this.btnRemove); @@ -141,8 +112,6 @@ private void InitializeComponent() this.Controls.Add(this.btnAdd); this.Controls.Add(this.lvPresets); this.Name = "QuickTaskMenuEditorForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "ShareX - Quick task menu editor"; this.ResumeLayout(false); this.PerformLayout(); @@ -157,6 +126,6 @@ private void InitializeComponent() private System.Windows.Forms.Button btnRemove; private System.Windows.Forms.Button btnReset; private System.Windows.Forms.Button btnClose; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lblTip; } } \ No newline at end of file diff --git a/ShareX/Forms/QuickTaskMenuEditorForm.cs b/ShareX/Forms/QuickTaskMenuEditorForm.cs index 6ff6f55bf..f4ac3447f 100644 --- a/ShareX/Forms/QuickTaskMenuEditorForm.cs +++ b/ShareX/Forms/QuickTaskMenuEditorForm.cs @@ -66,6 +66,25 @@ private void Edit(QuickTaskInfo taskInfo) new QuickTaskInfoEditForm(taskInfo).ShowDialog(); } + private void EditSelectedItem() + { + if (lvPresets.SelectedItems.Count > 0) + { + ListViewItem lvi = lvPresets.SelectedItems[0]; + QuickTaskInfo taskInfo = lvi.Tag as QuickTaskInfo; + Edit(taskInfo); + lvi.Text = taskInfo.ToString(); + } + } + + private void lvPresets_MouseDoubleClick(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + EditSelectedItem(); + } + } + private void btnAdd_Click(object sender, EventArgs e) { QuickTaskInfo taskInfo = new QuickTaskInfo(); @@ -79,13 +98,7 @@ private void btnAdd_Click(object sender, EventArgs e) private void btnEdit_Click(object sender, EventArgs e) { - if (lvPresets.SelectedItems.Count > 0) - { - ListViewItem lvi = lvPresets.SelectedItems[0]; - QuickTaskInfo taskInfo = lvi.Tag as QuickTaskInfo; - Edit(taskInfo); - lvi.Text = taskInfo.ToString(); - } + EditSelectedItem(); } private void btnRemove_Click(object sender, EventArgs e) diff --git a/ShareX/Forms/QuickTaskMenuEditorForm.resx b/ShareX/Forms/QuickTaskMenuEditorForm.resx index 1af7de150..336eee1ed 100644 --- a/ShareX/Forms/QuickTaskMenuEditorForm.resx +++ b/ShareX/Forms/QuickTaskMenuEditorForm.resx @@ -117,4 +117,229 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Top, Bottom, Left, Right + + + + 372 + + + + Microsoft Sans Serif, 9.75pt + + + 8, 8 + + + 448, 328 + + + 0 + + + lvPresets + + + ShareX.HelpersLib.MyListView, ShareX.HelpersLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + + + $this + + + 6 + + + Bottom, Left + + + 8, 368 + + + 144, 23 + + + 1 + + + Add + + + btnAdd + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + Bottom, Left + + + 160, 368 + + + 144, 23 + + + 2 + + + Edit + + + btnEdit + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + Bottom, Left + + + 312, 368 + + + 144, 23 + + + 3 + + + Remove + + + btnRemove + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + Bottom, Left + + + 272, 400 + + + 184, 23 + + + 4 + + + Reset to default + + + btnReset + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + Bottom, Left + + + 8, 400 + + + 256, 23 + + + 5 + + + Close + + + btnClose + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 1 + + + Bottom, Left + + + True + + + 8, 344 + + + 341, 13 + + + 6 + + + Tip: If you add empty task it will be converted to separator line in menu. + + + lblTip + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + + + 6, 13 + + + 464, 432 + + + CenterScreen + + + ShareX - Quick task menu editor + + + chName + + + System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + QuickTaskMenuEditorForm + + + ShareX.HelpersLib.BaseForm, ShareX.HelpersLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file