From 3a7f67ad514637f719ee224fc1b52fa7717d39c2 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Fri, 25 Dec 2009 07:59:30 +0000 Subject: [PATCH] Add menu item "Invert selection", usable in grids and listboxes. Fixes issue #451. --- res/icons/arrow_switch.png | Bin 0 -> 683 bytes source/main.dfm | 37 +++++++++++++++++++++++++++++++++++++ source/main.pas | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 res/icons/arrow_switch.png diff --git a/res/icons/arrow_switch.png b/res/icons/arrow_switch.png new file mode 100644 index 0000000000000000000000000000000000000000..258c16c63a20f7474764507475af7961ecf4263a GIT binary patch literal 683 zcmV;c0#yBpP)A3WJ2dfsV78ToP)wU4~UJxT^#Yl8pW;T)B2y+W_BqqmW z&#t|w0SE!KR$a#7aL!?!V{G>0(f7&GF0n$i_yAiovkXpE$M|c8KDe}2*w(W8jK3Y2*x)V03j=u2XF48q6F<0_UD&z zFmi~T?K=p$491faq~>RsPR$VB89_xzOpK2V+=|x$1lD3~x!;g2Mz5ELE831k>xd528II@{FM*4t5cwMI2$KMmfFm;RN43xW+e;$tzEyd|PV<@i4gUfKh|U-I$hymfQ} zt?kWDj37pE;wZ>1WHG%+SvbnRqEaTN#u*-slSm{u7_C6WGBh|el4$>24G=QE;Y9f< z)G2BOvC3T5Jn;{4ig%R|E{ITA5W$|ds8uW$Z^f(HeLnnp>dACn(D>^wEGjH6Et2~F zjpx1H%%|rOCx{iqDPk27MT{DNK*OCgPK;oDLHt!jVx&(zZS&Lq>Ld9Y&Ck!LvbvJw zmn1{|Z(}o^vo(KE_?L PngOptions = [pngBlendOnDisabled, pngGrayscaleOnDisabled] Left = 104 diff --git a/source/main.pas b/source/main.pas index 50226d25..3d960c10 100644 --- a/source/main.pas +++ b/source/main.pas @@ -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;