mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-23 11:42:36 +01:00
Add method to Select All/Invert Selection
This commit is contained in:
parent
c693221c40
commit
bcb6fee4d6
@ -251,25 +251,28 @@ namespace Nikse.SubtitleEdit.Forms
|
|||||||
|
|
||||||
private void buttonSelectAll_Click(object sender, EventArgs e)
|
private void buttonSelectAll_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
listViewNames.ItemChecked -= ListViewNamesItemChecked;
|
DoSelection(true);
|
||||||
listViewNames.BeginUpdate();
|
|
||||||
foreach (ListViewItem item in listViewNames.Items)
|
|
||||||
item.Checked = true;
|
|
||||||
listViewNames.EndUpdate();
|
|
||||||
listViewNames.ItemChecked += ListViewNamesItemChecked;
|
|
||||||
GeneratePreview();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonInverseSelection_Click(object sender, EventArgs e)
|
private void buttonInverseSelection_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
DoSelection(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoSelection(bool selectAll)
|
||||||
{
|
{
|
||||||
listViewNames.ItemChecked -= ListViewNamesItemChecked;
|
listViewNames.ItemChecked -= ListViewNamesItemChecked;
|
||||||
listViewNames.BeginUpdate();
|
listViewNames.BeginUpdate();
|
||||||
foreach (ListViewItem item in listViewNames.Items)
|
foreach (ListViewItem item in listViewNames.Items)
|
||||||
item.Checked = !item.Checked;
|
{
|
||||||
|
if (selectAll)
|
||||||
|
item.Checked = true;
|
||||||
|
else
|
||||||
|
item.Checked = !item.Checked;
|
||||||
|
}
|
||||||
listViewNames.EndUpdate();
|
listViewNames.EndUpdate();
|
||||||
listViewNames.ItemChecked += ListViewNamesItemChecked;
|
listViewNames.ItemChecked += ListViewNamesItemChecked;
|
||||||
GeneratePreview();
|
GeneratePreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user