From 91d3479839f1407f4eb3e85f9d234f8cfaea4913 Mon Sep 17 00:00:00 2001 From: Nick Vella Date: Sat, 3 Aug 2019 23:21:13 +1000 Subject: [PATCH] LocEdit: kb shortcuts and convenience buttons --- src/managed/LocEdit/MainForm.Designer.cs | 52 ++++++++++++++++++++++-- src/managed/LocEdit/MainForm.cs | 21 ++++++++++ src/managed/LocEdit/MainForm.resx | 52 +++++++++++++++++++----- 3 files changed, 111 insertions(+), 14 deletions(-) diff --git a/src/managed/LocEdit/MainForm.Designer.cs b/src/managed/LocEdit/MainForm.Designer.cs index 4df5c26f..8e78e321 100644 --- a/src/managed/LocEdit/MainForm.Designer.cs +++ b/src/managed/LocEdit/MainForm.Designer.cs @@ -33,6 +33,10 @@ this.toolStrip = new System.Windows.Forms.ToolStrip(); this.toolStripButtonLoad = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonSave = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); + this.toolStripButtonInsertAbove = new System.Windows.Forms.ToolStripButton(); + this.toolStripButtonInsertBelow = new System.Windows.Forms.ToolStripButton(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.textBoxFind = new System.Windows.Forms.TextBox(); @@ -53,7 +57,11 @@ this.toolStrip.ImageScalingSize = new System.Drawing.Size(28, 28); this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripButtonLoad, - this.toolStripButtonSave}); + this.toolStripButtonSave, + this.toolStripSeparator1, + this.toolStripLabel1, + this.toolStripButtonInsertAbove, + this.toolStripButtonInsertBelow}); this.toolStrip.Location = new System.Drawing.Point(0, 0); this.toolStrip.Name = "toolStrip"; this.toolStrip.Padding = new System.Windows.Forms.Padding(0, 0, 2, 0); @@ -81,6 +89,40 @@ this.toolStripButtonSave.Text = "Save"; this.toolStripButtonSave.Click += new System.EventHandler(this.ToolStripButtonSave_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // toolStripLabel1 + // + this.toolStripLabel1.ForeColor = System.Drawing.SystemColors.ControlDarkDark; + this.toolStripLabel1.Name = "toolStripLabel1"; + this.toolStripLabel1.Size = new System.Drawing.Size(35, 22); + this.toolStripLabel1.Text = "Rows"; + this.toolStripLabel1.Click += new System.EventHandler(this.ToolStripLabel1_Click); + // + // toolStripButtonInsertAbove + // + this.toolStripButtonInsertAbove.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButtonInsertAbove.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonInsertAbove.Image"))); + this.toolStripButtonInsertAbove.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonInsertAbove.Name = "toolStripButtonInsertAbove"; + this.toolStripButtonInsertAbove.Size = new System.Drawing.Size(77, 22); + this.toolStripButtonInsertAbove.Text = "Insert Above"; + this.toolStripButtonInsertAbove.Click += new System.EventHandler(this.ToolStripButtonInsertAbove_Click); + // + // toolStripButtonInsertBelow + // + this.toolStripButtonInsertBelow.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.toolStripButtonInsertBelow.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonInsertBelow.Image"))); + this.toolStripButtonInsertBelow.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonInsertBelow.Name = "toolStripButtonInsertBelow"; + this.toolStripButtonInsertBelow.Size = new System.Drawing.Size(75, 22); + this.toolStripButtonInsertBelow.Text = "Insert Below"; + this.toolStripButtonInsertBelow.ToolTipText = "Insert Below"; + this.toolStripButtonInsertBelow.Click += new System.EventHandler(this.ToolStripButtonInsertBelow_Click); + // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 1; @@ -116,8 +158,8 @@ // // textBoxFind // - this.textBoxFind.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.textBoxFind.Location = new System.Drawing.Point(60, 5); + this.textBoxFind.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxFind.Location = new System.Drawing.Point(60, 3); this.textBoxFind.Name = "textBoxFind"; this.textBoxFind.Size = new System.Drawing.Size(650, 20); this.textBoxFind.TabIndex = 0; @@ -228,6 +270,10 @@ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridColKey; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridColValue; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridColComment; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton toolStripButtonInsertAbove; + private System.Windows.Forms.ToolStripButton toolStripButtonInsertBelow; + private System.Windows.Forms.ToolStripLabel toolStripLabel1; } } diff --git a/src/managed/LocEdit/MainForm.cs b/src/managed/LocEdit/MainForm.cs index 69b4c0d8..4e8ede2c 100644 --- a/src/managed/LocEdit/MainForm.cs +++ b/src/managed/LocEdit/MainForm.cs @@ -122,6 +122,11 @@ namespace LocEdit return true; } + if (keyData == (Keys.Control | Keys.A)) + { + if(dataGridView.CurrentRow != null) dataGridView.CurrentRow.Selected = true; + return true; + } if (keyData == Keys.F3) { @@ -186,6 +191,22 @@ namespace LocEdit var result = MessageBox.Show(this, "There are unsaved changes. Are you sure you want to exit?", "LocEdit", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (result == DialogResult.No) e.Cancel = true; } + + private void ToolStripLabel1_Click(object sender, EventArgs e) + { + + } + + private void ToolStripButtonInsertAbove_Click(object sender, EventArgs e) + { + if (dataGridView.CurrentCell != null) dataGridView.Rows.Insert(dataGridView.CurrentCell.RowIndex); + } + + private void ToolStripButtonInsertBelow_Click(object sender, EventArgs e) + { + if (dataGridView.CurrentCell != null && dataGridView.CurrentCell.RowIndex < dataGridView.Rows.Count - 1) + dataGridView.Rows.Insert(dataGridView.CurrentCell.RowIndex + 1); + } } internal static class Helpers diff --git a/src/managed/LocEdit/MainForm.resx b/src/managed/LocEdit/MainForm.resx index 565047d3..0ded9a4f 100644 --- a/src/managed/LocEdit/MainForm.resx +++ b/src/managed/LocEdit/MainForm.resx @@ -124,17 +124,17 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIuSURBVDhPzZBdSFNhGMdfhK7Cm+oquu2yr8voKi/KsiJE - SBAjWOrm3HLp1haxGVnBloNMW7MVGU0UqhUuAzGaUrTlmtNFZCuZdhUjtPZ98px/z3t2pkURddcDP97z - vOf9/87zHvZ/VGyoo55AiXePHIgNnj2ovGaSJG0URdEhLIug9Q71Fcp+OYsO2CqiA1YgG10hNT8KvkeS - 3fwgD9KyltiQTCa1vKfwTpLdYGNXDDE5mBr/CTEVliWcgLtdXuMjXQi4DEcTiYQsEQRhgY32tkLKRCB9 - efIrfP8H0gsPMDfuQqFQ8GepSPCRPe7WQ/oagvjZ/1dM3j7Nr1NOrCfWsWFnM8SlZ5h97kTw4Rn4+rQK - LUVcDfBd06z0tzrr4bRUD3PU+7YeYPftjfiWHIPfo8HSGxekeQ9xXYE//557PQ3ppqrtm9nQeRXiL3ow - 4dVg+UM3chEDclMnkZ9qQz7ajsLMKRkhZiYsMovBNqirtjlsNlbG+q11ef9NPWYDF1B43YHsqxNE66oo - akRhmiiJZsyI3lWRYEct/QPGrpqOLI54jkOIX0aGwpnJFmTCOpLoZVlOnoTgkmmTjLfz0Jw8Pq9ec937 - p4NGCG/tSIc0SL9sJrSrokhxmtKVPk3oQGG7HOblth5zh3wm+poJqaCaaEIqpCZJUZYJK5Mooj5jNRfU - KHHGvF3m/f22w7jYWIlzqj1/5JJ2L8y1uyy6yi2blDhj4XB4DYAypf3HYuw7h15ETmoPbgAAAAAASUVO - RK5CYII= + YQUAAAAJcEhZcwAADsMAAA7DAcd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