diff --git a/Source/AboutEditorForm.resx b/Source/AboutEditorForm.resx index 5fcc524..be86a54 100644 --- a/Source/AboutEditorForm.resx +++ b/Source/AboutEditorForm.resx @@ -131,9 +131,8 @@ 96, 96 - - - Top, Bottom, Left, Right + + Version 10.2 by ArtUrlWWW MiddleCenter diff --git a/Source/AddString.cs b/Source/AddString.cs index 23e384d..6ebfaf3 100644 --- a/Source/AddString.cs +++ b/Source/AddString.cs @@ -139,7 +139,7 @@ private void copyStrFldsValues_Click(object sender, EventArgs e) sh.textIDFld = textIDFld.Text; sh.displayTextFld = displayTextFld.Text; - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } private void pasteStrFldsValues_Click(object sender, EventArgs e) diff --git a/Source/Editor.Designer.cs b/Source/Editor.Designer.cs index c96616e..63db262 100644 --- a/Source/Editor.Designer.cs +++ b/Source/Editor.Designer.cs @@ -30,7 +30,7 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Editor)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -42,7 +42,6 @@ private void InitializeComponent() this.label2 = new System.Windows.Forms.Label(); this.Paste_ALL_copied_values = new System.Windows.Forms.Button(); this.Show_copied_values = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); this.Copy_Values_By_IDs = new System.Windows.Forms.Button(); this.Copy_selected_rows = new System.Windows.Forms.Button(); this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); @@ -50,6 +49,8 @@ private void InitializeComponent() this.copyThisRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); + this.copySelectedRowsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.label3 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); this.contextMenuStrip1.SuspendLayout(); this.SuspendLayout(); @@ -66,8 +67,8 @@ private void InitializeComponent() this.Column2, this.Column3}); this.dataGridView1.Name = "dataGridView1"; - dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4; this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick); this.dataGridView1.CellMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_CellMouseClick); this.dataGridView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.dataGridView1_MouseClick); @@ -139,12 +140,6 @@ private void InitializeComponent() this.Show_copied_values.UseVisualStyleBackColor = true; this.Show_copied_values.Click += new System.EventHandler(this.Show_copied_values_Click); // - // label3 - // - resources.ApplyResources(this.label3, "label3"); - this.label3.Name = "label3"; - this.label3.Click += new System.EventHandler(this.label3_Click); - // // Copy_Values_By_IDs // resources.ApplyResources(this.Copy_Values_By_IDs, "Copy_Values_By_IDs"); @@ -164,7 +159,8 @@ private void InitializeComponent() resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1"); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.deleteThisElementToolStripMenuItem, - this.copyThisRowToolStripMenuItem}); + this.copyThisRowToolStripMenuItem, + this.copySelectedRowsToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; // // deleteThisElementToolStripMenuItem @@ -189,15 +185,26 @@ private void InitializeComponent() resources.ApplyResources(this.label5, "label5"); this.label5.Name = "label5"; // + // copySelectedRowsToolStripMenuItem + // + this.copySelectedRowsToolStripMenuItem.Name = "copySelectedRowsToolStripMenuItem"; + resources.ApplyResources(this.copySelectedRowsToolStripMenuItem, "copySelectedRowsToolStripMenuItem"); + this.copySelectedRowsToolStripMenuItem.Click += new System.EventHandler(this.copySelectedRowsToolStripMenuItem_Click); + // + // label3 + // + resources.ApplyResources(this.label3, "label3"); + this.label3.Name = "label3"; + // // Editor // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.label3); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.Copy_selected_rows); this.Controls.Add(this.Copy_Values_By_IDs); - this.Controls.Add(this.label3); this.Controls.Add(this.Show_copied_values); this.Controls.Add(this.Paste_ALL_copied_values); this.Controls.Add(this.label2); @@ -228,7 +235,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label2; private System.Windows.Forms.Button Paste_ALL_copied_values; private System.Windows.Forms.Button Show_copied_values; - private System.Windows.Forms.Label label3; private System.Windows.Forms.Button Copy_Values_By_IDs; private System.Windows.Forms.Button Copy_selected_rows; private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; @@ -236,5 +242,7 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem copyThisRowToolStripMenuItem; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; + private System.Windows.Forms.ToolStripMenuItem copySelectedRowsToolStripMenuItem; + private System.Windows.Forms.Label label3; } } \ No newline at end of file diff --git a/Source/Editor.cs b/Source/Editor.cs index 2cf749c..fb3c26c 100644 --- a/Source/Editor.cs +++ b/Source/Editor.cs @@ -167,15 +167,15 @@ private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventA sh.textIDFld = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); sh.displayTextFld = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } } private void Paste_ALL_copied_values_Click(object sender, EventArgs e) { - for (int x = 0; x < MainUI.strHolders.Count; x++) + for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++) { - StringHolder sh = MainUI.strHolders[x]; + StringHolder sh = MainUI.copiedValuesStrHolders[x]; DataTable dt = (DataTable)dataGridView1.DataSource; DataRow dr; @@ -199,27 +199,27 @@ private void Show_copied_values_Click(object sender, EventArgs e) private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { - if (dataGridView1.SelectedRows.Count > 0) - { - if (e.Button == MouseButtons.Left) - { - //if (addstr != null) - //{ - // addstr.setFldsValues(MainUI.strHolders[listView1.SelectedIndices[0]]); - //} - } - else - { - CopySelectedRows(); - } - } + //if (dataGridView1.SelectedRows.Count > 0) + //{ + // if (e.Button == MouseButtons.Left) + // { + // //if (addstr != null) + // //{ + // // addstr.setFldsValues(MainUI.strHolders[listView1.SelectedIndices[0]]); + // //} + // } + // else + // { + // CopySelectedRows(); + // } + //} } - private void label3_Click(object sender, EventArgs e) - { - HowToCopyMultipleRows a = new HowToCopyMultipleRows(); - a.ShowDialog(); - } + //private void label3_Click(object sender, EventArgs e) + //{ + // HowToCopyMultipleRows a = new HowToCopyMultipleRows(); + // a.ShowDialog(); + //} private void Copy_Values_By_IDs_Click(object sender, EventArgs e) { @@ -300,7 +300,7 @@ private static DialogResult ShowInputDialog(ref string input) private void Copy_selected_rows_Click(object sender, EventArgs e) { - CopySelectedRows(); + //CopySelectedRows(); } private void CopySelectedRows() @@ -311,7 +311,7 @@ private void CopySelectedRows() sh.textIDFld = dataGridView1.SelectedRows[x].Cells[0].Value.ToString(); sh.displayTextFld = dataGridView1.SelectedRows[x].Cells[1].Value.ToString(); - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } MessageBox.Show(dataGridView1.SelectedRows.Count + " rows copied!"); @@ -337,8 +337,12 @@ private void deleteThisElementToolStripMenuItem_Click(object sender, EventArgs e private void dataGridView1_MouseClick(object sender, MouseEventArgs e) { - contextMenuStrip1.Tag = dataGridView1.CurrentCell; - contextMenuStrip1.Show(dataGridView1, e.Location); + if (e.Button == MouseButtons.Right) + { + dataGridView1.CurrentCell.OwningRow.Selected = true; + contextMenuStrip1.Tag = dataGridView1.CurrentCell; + contextMenuStrip1.Show(dataGridView1, e.Location); + } } @@ -350,7 +354,7 @@ private void copyThisRowToolStripMenuItem_Click(object sender, EventArgs e) sh.textIDFld = row.Cells[0].Value.ToString(); sh.displayTextFld = row.Cells[1].Value.ToString(); - MainUI.strHolders.Add(sh); + MainUI.copiedValuesStrHolders.Add(sh); } @@ -369,5 +373,10 @@ protected override bool ProcessDialogKey(Keys keyData) } return base.ProcessDialogKey(keyData); } + + private void copySelectedRowsToolStripMenuItem_Click(object sender, EventArgs e) + { + CopySelectedRows(); + } } } diff --git a/Source/Editor.resx b/Source/Editor.resx index cf9f8ca..49550c6 100644 --- a/Source/Editor.resx +++ b/Source/Editor.resx @@ -180,8 +180,8 @@ $this - - 0 + + 668, 595 341, 19 @@ -228,9 +228,180 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 566, 492 + + + 141, 29 + + + 8 + + + Copy Values By IDs + + + Copy_Values_By_IDs + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 5 + + + 390, 492 + + + 158, 29 + + + 9 + + + Copy selected rows + + + Copy_selected_rows + + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + 17, 17 + + + 177, 70 + + + contextMenuStrip1 + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 176, 22 + + + Delete this element + + + 176, 22 + + + Copy this row + + + True + + + 164, 548 + + + 241, 19 + + + 10 + + + Press ESC to close Editro without save + + + label4 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 3 + + + True + + + NoControl + + + 164, 572 + + + 302, 19 + + + 11 + + + Press CTRL+S to apply changes and close Editor + + + label5 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 2 + + + 176, 22 + + + Copy selected rows + + + True + + + 668, 572 + + + 328, 19 + + + 12 + + + Right click on some cell to show menu copy options. + + + label3 + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + 96, 96 + + 1034, 639 + + + Segoe UI, 10pt + AAABAA0AAAAAAAEAIAA2EgEA1gAAAICAAAABACAAKAgBAAwTAQCAgAAAAQAIAChMAAA0GwIAQEAAAAEA @@ -3881,11 +4052,15 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - $this + + copySelectedRowsToolStripMenuItem - - $this + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Editor + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 diff --git a/Source/MainUI.cs b/Source/MainUI.cs index f706969..ea73d2e 100644 --- a/Source/MainUI.cs +++ b/Source/MainUI.cs @@ -21,7 +21,7 @@ public partial class MainUI : Form private DataGridViewSettings settings0 = new DataGridViewSettings(); private DataGridViewSettings settings1 = new DataGridViewSettings(); - public static List strHolders = new List(); + public static List copiedValuesStrHolders = new List(); public MainUI() { @@ -390,6 +390,8 @@ private void closeAndSavePackage(bool save = true) SaveSTBLFile(true); } + fileNameLbl.Text = ""; + LanguageLbl.Text = ""; dataGridView1.DataSource = null; dataGridView1.Columns.Add("Column1", ""); @@ -436,7 +438,7 @@ private void showLangCodesToolStripMenuItem_Click(object sender, EventArgs e) private void multyInsertIntoFilesToolStripMenuItem_Click(object sender, EventArgs e) { - if (MainUI.strHolders.Count > 0) + if (MainUI.copiedValuesStrHolders.Count > 0) { isTextChanged = false; @@ -477,17 +479,31 @@ private void multyInsertIntoFilesToolStripMenuItem_Click(object sender, EventArg isTextChanged = true; - for (int x = 0; x < MainUI.strHolders.Count; x++) + for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++) { - StringHolder sh = MainUI.strHolders[x]; + StringHolder copiedStrElement = MainUI.copiedValuesStrHolders[x]; DataTable dt = (DataTable)dataGridView1.DataSource; - DataRow dr; - dr = dt.NewRow(); - dr[0] = sh.textIDFld; - dr[1] = sh.displayTextFld; - dt.Rows.Add(dr); - dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString(); + + var drArr = (from rowEl in dt.AsEnumerable() + where rowEl.Field(0) == copiedStrElement.textIDFld + select rowEl); + + if (drArr.Count() == 0) + { + DataRow dr = dt.NewRow(); + dr[0] = copiedStrElement.textIDFld; + dr[1] = copiedStrElement.displayTextFld; + dt.Rows.Add(dr); + dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString(); + + } + else + { + DataRow dr = drArr.First(); + dr[1] = copiedStrElement.displayTextFld; + } + } @@ -499,7 +515,8 @@ private void multyInsertIntoFilesToolStripMenuItem_Click(object sender, EventArg isTextChanged = false; } - } else + } + else { switch (Thread.CurrentThread.CurrentUICulture.ThreeLetterWindowsLanguageName) { diff --git a/Source/Properties/AssemblyInfo.cs b/Source/Properties/AssemblyInfo.cs index e9dbc03..8cece65 100644 --- a/Source/Properties/AssemblyInfo.cs +++ b/Source/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, // 方法是按如下所示使用“*”: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("10.0.0.0")] -[assembly: AssemblyFileVersion("10.0.0.0")] +[assembly: AssemblyVersion("10.2.0.0")] +[assembly: AssemblyFileVersion("10.2.0.0")] diff --git a/Source/StringPicker.cs b/Source/StringPicker.cs index e630a50..4ac82dc 100644 --- a/Source/StringPicker.cs +++ b/Source/StringPicker.cs @@ -29,9 +29,9 @@ private void reloadListView() { listView1.Items.Clear(); listView1.View = View.List; - for (int x = 0; x < MainUI.strHolders.Count; x++) + for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++) { - StringHolder sh = MainUI.strHolders[x]; + StringHolder sh = MainUI.copiedValuesStrHolders[x]; listView1.Items.Add(sh.textIDFld + " - " + sh.displayTextFld); } @@ -45,12 +45,12 @@ private void listView1_MouseClick(object sender, MouseEventArgs e) { if (addstr != null) { - addstr.setFldsValues(MainUI.strHolders[listView1.SelectedIndices[0]]); + addstr.setFldsValues(MainUI.copiedValuesStrHolders[listView1.SelectedIndices[0]]); } } else { - MainUI.strHolders.RemoveAt(listView1.SelectedIndices[0]); + MainUI.copiedValuesStrHolders.RemoveAt(listView1.SelectedIndices[0]); reloadListView(); } } @@ -60,7 +60,7 @@ private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { if (addstr != null) { - addstr.setFldsValues(MainUI.strHolders[listView1.SelectedIndices[0]]); + addstr.setFldsValues(MainUI.copiedValuesStrHolders[listView1.SelectedIndices[0]]); } this.Close();