Try to improve resizing for "Modify selection"

This commit is contained in:
Nikolaj Olsson 2021-03-03 19:41:28 +01:00
parent 83f1385408
commit 350ef299fe
2 changed files with 81 additions and 53 deletions

View File

@ -37,8 +37,8 @@
this.groupBoxRule = new System.Windows.Forms.GroupBox();
this.numericUpDownDuration = new System.Windows.Forms.NumericUpDown();
this.checkBoxCaseSensitive = new System.Windows.Forms.CheckBox();
this.textBoxText = new System.Windows.Forms.TextBox();
this.comboBoxRule = new System.Windows.Forms.ComboBox();
this.textBoxText = new System.Windows.Forms.TextBox();
this.listViewStyles = new System.Windows.Forms.ListView();
this.columnHeaderStyleName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.buttonCancel = new System.Windows.Forms.Button();
@ -50,10 +50,10 @@
this.columnHeaderLine = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderText = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnHeaderStyle = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.labelInfo = new System.Windows.Forms.Label();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.toolStripMenuItemSelectAll = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemInverseSelection = new System.Windows.Forms.ToolStripMenuItem();
this.labelInfo = new System.Windows.Forms.Label();
this.groupBoxWhatToDo.SuspendLayout();
this.groupBoxRule.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownDuration)).BeginInit();
@ -63,15 +63,14 @@
//
// groupBoxWhatToDo
//
this.groupBoxWhatToDo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxWhatToDo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxWhatToDo.Controls.Add(this.radioButtonIntersect);
this.groupBoxWhatToDo.Controls.Add(this.radioButtonSubtractFromSelection);
this.groupBoxWhatToDo.Controls.Add(this.radioButtonAddToSelection);
this.groupBoxWhatToDo.Controls.Add(this.radioButtonNewSelection);
this.groupBoxWhatToDo.Location = new System.Drawing.Point(380, 12);
this.groupBoxWhatToDo.Location = new System.Drawing.Point(421, 12);
this.groupBoxWhatToDo.Name = "groupBoxWhatToDo";
this.groupBoxWhatToDo.Size = new System.Drawing.Size(411, 135);
this.groupBoxWhatToDo.Size = new System.Drawing.Size(385, 135);
this.groupBoxWhatToDo.TabIndex = 1;
this.groupBoxWhatToDo.TabStop = false;
this.groupBoxWhatToDo.Text = "What to do with matches";
@ -124,14 +123,16 @@
//
// groupBoxRule
//
this.groupBoxRule.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxRule.Controls.Add(this.numericUpDownDuration);
this.groupBoxRule.Controls.Add(this.checkBoxCaseSensitive);
this.groupBoxRule.Controls.Add(this.textBoxText);
this.groupBoxRule.Controls.Add(this.comboBoxRule);
this.groupBoxRule.Controls.Add(this.textBoxText);
this.groupBoxRule.Controls.Add(this.listViewStyles);
this.groupBoxRule.Location = new System.Drawing.Point(12, 12);
this.groupBoxRule.Name = "groupBoxRule";
this.groupBoxRule.Size = new System.Drawing.Size(362, 135);
this.groupBoxRule.Size = new System.Drawing.Size(403, 135);
this.groupBoxRule.TabIndex = 0;
this.groupBoxRule.TabStop = false;
this.groupBoxRule.Text = "Rule";
@ -160,14 +161,6 @@
this.checkBoxCaseSensitive.UseVisualStyleBackColor = true;
this.checkBoxCaseSensitive.CheckedChanged += new System.EventHandler(this.checkBoxCaseSensitive_CheckedChanged);
//
// textBoxText
//
this.textBoxText.Location = new System.Drawing.Point(198, 21);
this.textBoxText.Name = "textBoxText";
this.textBoxText.Size = new System.Drawing.Size(158, 20);
this.textBoxText.TabIndex = 1;
this.textBoxText.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// comboBoxRule
//
this.comboBoxRule.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@ -184,8 +177,20 @@
this.comboBoxRule.TabIndex = 0;
this.comboBoxRule.SelectedIndexChanged += new System.EventHandler(this.comboBoxRule_SelectedIndexChanged);
//
// textBoxText
//
this.textBoxText.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxText.Location = new System.Drawing.Point(198, 21);
this.textBoxText.Name = "textBoxText";
this.textBoxText.Size = new System.Drawing.Size(199, 20);
this.textBoxText.TabIndex = 1;
this.textBoxText.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// listViewStyles
//
this.listViewStyles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.listViewStyles.CheckBoxes = true;
this.listViewStyles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeaderStyleName});
@ -194,7 +199,7 @@
this.listViewStyles.HideSelection = false;
this.listViewStyles.Location = new System.Drawing.Point(198, 21);
this.listViewStyles.Name = "listViewStyles";
this.listViewStyles.Size = new System.Drawing.Size(158, 108);
this.listViewStyles.Size = new System.Drawing.Size(199, 108);
this.listViewStyles.TabIndex = 3;
this.listViewStyles.UseCompatibleStateImageBehavior = false;
this.listViewStyles.View = System.Windows.Forms.View.Details;
@ -204,7 +209,7 @@
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonCancel.Location = new System.Drawing.Point(621, 446);
this.buttonCancel.Location = new System.Drawing.Point(636, 446);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 6;
@ -216,7 +221,7 @@
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(540, 446);
this.buttonOK.Location = new System.Drawing.Point(555, 446);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 5;
@ -228,7 +233,7 @@
//
this.buttonApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonApply.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonApply.Location = new System.Drawing.Point(702, 446);
this.buttonApply.Location = new System.Drawing.Point(717, 446);
this.buttonApply.Name = "buttonApply";
this.buttonApply.Size = new System.Drawing.Size(89, 23);
this.buttonApply.TabIndex = 7;
@ -244,7 +249,7 @@
this.groupBoxPreview.Controls.Add(this.listViewFixes);
this.groupBoxPreview.Location = new System.Drawing.Point(12, 153);
this.groupBoxPreview.Name = "groupBoxPreview";
this.groupBoxPreview.Size = new System.Drawing.Size(779, 286);
this.groupBoxPreview.Size = new System.Drawing.Size(794, 286);
this.groupBoxPreview.TabIndex = 2;
this.groupBoxPreview.TabStop = false;
this.groupBoxPreview.Text = "Matching lines";
@ -263,7 +268,7 @@
this.listViewFixes.HideSelection = false;
this.listViewFixes.Location = new System.Drawing.Point(3, 16);
this.listViewFixes.Name = "listViewFixes";
this.listViewFixes.Size = new System.Drawing.Size(773, 267);
this.listViewFixes.Size = new System.Drawing.Size(788, 267);
this.listViewFixes.TabIndex = 1;
this.listViewFixes.UseCompatibleStateImageBehavior = false;
this.listViewFixes.View = System.Windows.Forms.View.Details;
@ -276,7 +281,7 @@
// columnHeaderLine
//
this.columnHeaderLine.Text = "Line#";
this.columnHeaderLine.Width = 122;
this.columnHeaderLine.Width = 80;
//
// columnHeaderText
//
@ -287,6 +292,28 @@
//
this.columnHeaderStyle.Text = "Style";
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItemSelectAll,
this.toolStripMenuItemInverseSelection});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(162, 48);
//
// toolStripMenuItemSelectAll
//
this.toolStripMenuItemSelectAll.Name = "toolStripMenuItemSelectAll";
this.toolStripMenuItemSelectAll.Size = new System.Drawing.Size(161, 22);
this.toolStripMenuItemSelectAll.Text = "Select all";
this.toolStripMenuItemSelectAll.Click += new System.EventHandler(this.toolStripMenuItemSelectAll_Click);
//
// toolStripMenuItemInverseSelection
//
this.toolStripMenuItemInverseSelection.Name = "toolStripMenuItemInverseSelection";
this.toolStripMenuItemInverseSelection.Size = new System.Drawing.Size(161, 22);
this.toolStripMenuItemInverseSelection.Text = "Inverse selection";
this.toolStripMenuItemInverseSelection.Click += new System.EventHandler(this.toolStripMenuItemInverseSelection_Click);
//
// labelInfo
//
this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@ -297,33 +324,11 @@
this.labelInfo.TabIndex = 3;
this.labelInfo.Text = "labelInfo";
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItemSelectAll,
this.toolStripMenuItemInverseSelection});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 70);
//
// toolStripMenuItemSelectAll
//
this.toolStripMenuItemSelectAll.Name = "toolStripMenuItemSelectAll";
this.toolStripMenuItemSelectAll.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemSelectAll.Text = "Select all";
this.toolStripMenuItemSelectAll.Click += new System.EventHandler(this.toolStripMenuItemSelectAll_Click);
//
// toolStripMenuItemInverseSelection
//
this.toolStripMenuItemInverseSelection.Name = "toolStripMenuItemInverseSelection";
this.toolStripMenuItemInverseSelection.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItemInverseSelection.Text = "Inverse selection";
this.toolStripMenuItemInverseSelection.Click += new System.EventHandler(this.toolStripMenuItemInverseSelection_Click);
//
// ModifySelection
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(803, 478);
this.ClientSize = new System.Drawing.Size(818, 478);
this.Controls.Add(this.labelInfo);
this.Controls.Add(this.groupBoxWhatToDo);
this.Controls.Add(this.groupBoxPreview);
@ -340,9 +345,10 @@
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Create/modify selection";
this.Shown += new System.EventHandler(this.ModifySelection_Shown);
this.ResizeEnd += new System.EventHandler(this.ModifySelection_ResizeEnd);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ModifySelection_KeyDown);
this.Resize += new System.EventHandler(this.ModifySelection_Resize);
this.Shown += new System.EventHandler(this.ModifySelection_Shown);
this.groupBoxWhatToDo.ResumeLayout(false);
this.groupBoxWhatToDo.PerformLayout();
this.groupBoxRule.ResumeLayout(false);

View File

@ -567,12 +567,6 @@ namespace Nikse.SubtitleEdit.Forms
Preview();
}
private void ModifySelection_Resize(object sender, EventArgs e)
{
listViewFixes.Columns[listViewFixes.Columns.Count - 1].Width = -2;
listViewStyles.Columns[listViewStyles.Columns.Count - 1].Width = -2;
}
private void ModifySelection_Shown(object sender, EventArgs e)
{
ModifySelection_Resize(sender, e);
@ -603,5 +597,33 @@ namespace Nikse.SubtitleEdit.Forms
item.Checked = !item.Checked;
}
}
private void ModifySelection_Resize(object sender, EventArgs e)
{
ModifySelection_ResizeEnd(null, null);
}
private void ModifySelection_ResizeEnd(object sender, EventArgs e)
{
listViewFixes.Columns[0].Width = 50;
listViewFixes.Columns[1].Width = 80;
if (_format.HasStyleSupport)
{
listViewFixes.Columns[2].Width = listViewFixes.Width
- listViewFixes.Columns[0].Width
- listViewFixes.Columns[1].Width
- listViewFixes.Columns[3].Width
- 30;
return;
}
listViewFixes.Columns[0].Width = 50;
listViewFixes.Columns[1].Width = 80;
listViewFixes.Columns[2].Width = listViewFixes.Width
- listViewFixes.Columns[0].Width
- listViewFixes.Columns[1].Width
- 30;
}
}
}