Add menu item "Invert selection", usable in grids and listboxes. Fixes issue #451.

This commit is contained in:
Ansgar Becker
2009-12-25 07:59:30 +00:00
parent 527cbdf423
commit 3a7f67ad51
3 changed files with 72 additions and 0 deletions

BIN
res/icons/arrow_switch.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

View File

@@ -1479,6 +1479,9 @@ object MainForm: TMainForm
object actSelectAll1: TMenuItem
Action = actSelectAll
end
object Inverseselection1: TMenuItem
Action = actSelectInverse
end
object actFindInVT1: TMenuItem
Action = actFilterPanel
end
@@ -2226,6 +2229,13 @@ object MainForm: TMainForm
ShortCut = 16499
OnExecute = actCloseQueryTabExecute
end
object actSelectInverse: TAction
Category = 'Various'
Caption = 'Invert selection'
ImageIndex = 138
ShortCut = 16457
OnExecute = actSelectInverseExecute
end
object actFilterPanel: TAction
Category = 'Various'
AutoCheck = True
@@ -6077,6 +6087,33 @@ object MainForm: TMainForm
3B74ACC3980000000049454E44AE426082}
Name = 'PngImage137'
Background = clWindow
end
item
PngImage.Data = {
89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF
610000001974455874536F6674776172650041646F626520496D616765526561
647971C9653C000002554944415478DAA5935F48536118C69FB3D282A4485AAB
997891EDE8CC366F9C17665D5814B85941B35841F407A2CB2E02D75D57155DE6
5D48098175511736312514C956E6DC9C7A919E294E7153278A74D3CEF7A7F71C
635D64C4E83BBC7C1F87F3FEF89EE7798F22A5C4FF2C251F404B87AF47D799EF
CD8DEE6CDE00FF0B6F1D35F7B32C4B76DDE95373805BEF2EE708820BB3381361
DA83B058CE319D9DA152771516A1A4B80499F50CB46422F6E1DEC79A1CE08AEB
1AA4F1D06D04D5F4F21426E727C004835A5A819D853BC00CB0E4E0F42E3A1983
369B18FAF460A45EB9D9754906DC0490E217409890A5F514BA23DD385ED30021
0498D94CC539A2130498D186BF3E1CF328D7DFFA2537AFCD6111DB70C4EA40D5
A1A3282828C4ABFE4EECB7DA905E4D61319D82DD5642DF316A4EC4471EC55D7F
98E86F6F2A623A6FADB43B83B5151EC4A6A3188C0D722E45F3C0FD70A8F6AE9B
F3ED6236F2385EBE650A179F3715E959D6CABEEBC1C0E9AB50140BDA5E3EE5E4
7C73F8C968C87DDB49673E3BD1FEED3720D0794192CB304A328903C507B1B1B6
01875DC5E1B272CC2413A4790C9AA6A14A75823181C848249E783DB729C1DFE1
950DCE933987191995C9AC2231A5C177AA99DC27B01131996B984816E37DA817
912FA3C30BA1944739FFECAC6C387622E7B0B12717E7311E1D87A34C45A5A302
BBF7EE3193E0664204E822C0E7D1A174EF72BDD2D4D6684A20ED20ADD037E584
D90F1ECCAE65370729CB55ABD58A6A573516E6168CE658BA6FA526AF512EF5DA
EB28EA7E9AD2E452DF8ABA650AFF5AB6C67D3D9C495F666035FF9FE96FEB27B1
2189F0361D408C0000000049454E44AE426082}
Name = 'PngImage138'
Background = clWindow
end>
PngOptions = [pngBlendOnDisabled, pngGrayscaleOnDisabled]
Left = 104

View File

@@ -444,6 +444,8 @@ type
actDataDuplicateRow: TAction;
Duplicaterow1: TMenuItem;
Bulktableeditor1: TMenuItem;
actSelectInverse: TAction;
Inverseselection1: TMenuItem;
procedure refreshMonitorConfig;
procedure loadWindowConfig;
procedure saveWindowConfig;
@@ -700,6 +702,7 @@ type
procedure PageControlMainContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
procedure menuQueryHelpersGenerateStatementClick(Sender: TObject);
procedure actDataDuplicateRowExecute(Sender: TObject);
procedure actSelectInverseExecute(Sender: TObject);
private
ReachedEOT : Boolean;
FDelimiter: String;
@@ -7815,6 +7818,38 @@ begin
end;
procedure TMainForm.actSelectInverseExecute(Sender: TObject);
var
Control: TWinControl;
Grid: TVirtualStringTree;
ListBox: TTNTListBox;
Success: Boolean;
i: Integer;
begin
// Invert selection in grids or listboxes
Success := False;
Control := Screen.ActiveControl;
// Do not handle Search/replace dialog
if not Control.Focused then Exit;
if Control is TVirtualStringTree then begin
Grid := TVirtualStringTree(Control);
if toMultiSelect in Grid.TreeOptions.SelectionOptions then begin
Grid.InvertSelection(False);
Success := True;
end;
end else if Control is TTNTListBox then begin
ListBox := TTNTListBox(Control);
if ListBox.MultiSelect then begin
for i:=0 to ListBox.Count-1 do
ListBox.Selected[i] := not ListBox.Selected[i];
Success := True;
end;
end;
if not Success then
MessageBeep(MB_ICONASTERISK);
end;
procedure TMainForm.EnumerateRecentFilters;
var
flt: TStringList;