浏览代码

Updated search dialog

Simon Grossenbacher 8 年之前
父节点
当前提交
f623daa360
共有 6 个文件被更改,包括 81 次插入77 次删除
  1. 二进制
      RESTDebugger.exe
  2. 6 6
      prj/RESTDebugger.stat
  3. 1 1
      src/_frmBiggerEditor.pas
  4. 13 14
      src/_frmMain.pas
  5. 33 35
      src/_frmSearch.dfm
  6. 28 21
      src/_frmSearch.pas

二进制
RESTDebugger.exe


+ 6 - 6
prj/RESTDebugger.stat

@@ -1,10 +1,10 @@
 [Stats]
-EditorSecs=18948
-DesignerSecs=5395
-InspectorSecs=2773
-CompileSecs=893867
-OtherSecs=4796
+EditorSecs=19447
+DesignerSecs=5690
+InspectorSecs=3051
+CompileSecs=941272
+OtherSecs=4969
 StartTime=27.10.2016 18:27:37
 RealKeys=0
 EffectiveKeys=0
-DebugSecs=14059
+DebugSecs=14375

+ 1 - 1
src/_frmBiggerEditor.pas

@@ -43,7 +43,7 @@ begin
   if Key = vkF3 then
   begin
     frmMain.ActiveEditor := EditorBiggerEditor;
-    frmMain.DoSearchReplaceText(false, false);
+    frmMain.DoSearchReplaceText(false, frmMain.gbSearchBackwards);
   end;
 
   if (Key = 70) and (Shift = [ssCtrl]) then

+ 13 - 14
src/_frmMain.pas

@@ -197,23 +197,22 @@ type
   public
     MainConfig: TJSONConfig;
     ActiveEditor: TSynEdit;
+    gbSearchBackwards: Boolean;
+    gbSearchCaseSensitive: Boolean;
+    gbSearchFromCaret: Boolean;
+    gbSearchSelectionOnly: Boolean;
+    gbSearchTextAtCaret: Boolean;
+    gbSearchWholeWords: Boolean;
+    gbSearchRegex: Boolean;
+
+    gsSearchText: string;
+    gsSearchTextHistory: string;
+    gsReplaceText: string;
+    gsReplaceTextHistory: string;
     procedure DoSearchReplaceText(AReplace: Boolean; ABackwards: Boolean);
     procedure ShowSearchReplaceDialog(AReplace: Boolean);
   end;
 
-var
-  gbSearchBackwards: Boolean;
-  gbSearchCaseSensitive: Boolean;
-  gbSearchFromCaret: Boolean;
-  gbSearchSelectionOnly: Boolean;
-  gbSearchTextAtCaret: Boolean;
-  gbSearchWholeWords: Boolean;
-  gbSearchRegex: Boolean;
-
-  gsSearchText: string;
-  gsSearchTextHistory: string;
-  gsReplaceText: string;
-  gsReplaceTextHistory: string;
 
 var
   frmMain: TfrmMain;
@@ -663,7 +662,7 @@ begin
   if Key = vkF3 then
   begin
     ActiveEditor := EditorContent;
-    DoSearchReplaceText(false, false);
+    DoSearchReplaceText(false, gbSearchBackwards);
   end;
 
   if (Key = 70) and (Shift = [ssCtrl]) then

+ 33 - 35
src/_frmSearch.dfm

@@ -25,74 +25,56 @@ object frmSearch: TfrmSearch
     Height = 13
     Caption = '&Search for:'
   end
-  object cbSearchText: TComboBox
+  object cbSearchText: TcxComboBox
     Left = 96
     Top = 8
-    Width = 228
-    Height = 21
     TabOrder = 0
+    Width = 228
   end
-  object gbSearchOptions: TGroupBox
+  object gbSearchOptions: TcxGroupBox
     Left = 8
     Top = 40
-    Width = 154
-    Height = 127
     Caption = 'Options'
     TabOrder = 1
-    object cbSearchCaseSensitive: TCheckBox
+    Height = 132
+    Width = 154
+    object cbSearchCaseSensitive: TcxCheckBox
       Left = 8
       Top = 17
-      Width = 140
-      Height = 17
       Caption = 'C&ase sensitivity'
       TabOrder = 0
+      Width = 94
     end
-    object cbSearchWholeWords: TCheckBox
+    object cbSearchWholeWords: TcxCheckBox
       Left = 8
       Top = 39
-      Width = 140
-      Height = 17
       Caption = '&Whole words only'
       TabOrder = 1
+      Width = 106
     end
-    object cbSearchFromCursor: TCheckBox
+    object cbSearchFromCursor: TcxCheckBox
       Left = 8
       Top = 61
-      Width = 140
-      Height = 17
       Caption = 'Search from &caret'
       TabOrder = 2
+      Width = 106
     end
-    object cbSearchSelectedOnly: TCheckBox
+    object cbSearchSelectedOnly: TcxCheckBox
       Left = 8
       Top = 83
-      Width = 140
-      Height = 17
       Caption = '&Selected text only'
       TabOrder = 3
+      Width = 106
     end
-    object cbRegularExpression: TCheckBox
+    object cbRegularExpression: TcxCheckBox
       Left = 8
       Top = 104
-      Width = 140
-      Height = 17
       Caption = '&Regular expression'
       TabOrder = 4
+      Width = 112
     end
   end
-  object rgSearchDirection: TRadioGroup
-    Left = 170
-    Top = 40
-    Width = 154
-    Height = 65
-    Caption = 'Direction'
-    ItemIndex = 0
-    Items.Strings = (
-      '&Forward'
-      '&Backward')
-    TabOrder = 2
-  end
-  object btnOK: TButton
+  object btnOK: TcxButton
     Left = 170
     Top = 149
     Width = 75
@@ -102,7 +84,7 @@ object frmSearch: TfrmSearch
     ModalResult = 1
     TabOrder = 3
   end
-  object btnCancel: TButton
+  object btnCancel: TcxButton
     Left = 249
     Top = 149
     Width = 75
@@ -112,4 +94,20 @@ object frmSearch: TfrmSearch
     ModalResult = 2
     TabOrder = 4
   end
+  object rgSearchDirection: TcxRadioGroup
+    Left = 170
+    Top = 40
+    TabStop = False
+    Caption = 'Direction'
+    Properties.Items = <
+      item
+        Caption = 'Forward'
+      end
+      item
+        Caption = 'Backward'
+      end>
+    TabOrder = 2
+    Height = 65
+    Width = 154
+  end
 end

+ 28 - 21
src/_frmSearch.pas

@@ -4,21 +4,24 @@ interface
 
 uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
-  StdCtrls, ExtCtrls;
+  StdCtrls, ExtCtrls, cxGraphics, cxControls, cxLookAndFeels,
+  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore,
+  dxSkinOffice2016Colorful, Vcl.Menus, cxButtons, cxCheckBox, cxGroupBox,
+  cxTextEdit, cxMaskEdit, cxDropDownEdit, cxRadioGroup;
 
 type
   TfrmSearch = class(TForm)
     Label1: TLabel;
-    cbSearchText: TComboBox;
-    rgSearchDirection: TRadioGroup;
-    gbSearchOptions: TGroupBox;
-    cbSearchCaseSensitive: TCheckBox;
-    cbSearchWholeWords: TCheckBox;
-    cbSearchFromCursor: TCheckBox;
-    cbSearchSelectedOnly: TCheckBox;
-    btnOK: TButton;
-    btnCancel: TButton;
-    cbRegularExpression: TCheckBox;
+    cbSearchText: TcxComboBox;
+    gbSearchOptions: TcxGroupBox;
+    cbSearchCaseSensitive: TcxCheckBox;
+    cbSearchWholeWords: TcxCheckBox;
+    cbSearchFromCursor: TcxCheckBox;
+    cbSearchSelectedOnly: TcxCheckBox;
+    cbRegularExpression: TcxCheckBox;
+    btnOK: TcxButton;
+    btnCancel: TcxButton;
+    rgSearchDirection: TcxRadioGroup;
     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
     procedure FormClose(Sender: TObject; var Action: TCloseAction);
     procedure FormShow(Sender: TObject);
@@ -102,12 +105,13 @@ var
   i: integer;
 begin
   Result := '';
-  for i := 0 to cbSearchText.Items.Count - 1 do begin
+  for i := 0 to cbSearchText.Properties.Items.Count - 1 do
+  begin
     if i >= 10 then
       break;
     if i > 0 then
       Result := Result + #13#10;
-    Result := Result + cbSearchText.Items[i];
+    Result := Result + cbSearchText.Properties.Items[i];
   end;
 end;
 
@@ -143,7 +147,7 @@ end;
 
 procedure TfrmSearch.SetSearchTextHistory(Value: string);
 begin
-  cbSearchText.Items.Text := Value;
+  cbSearchText.Properties.Items.Text := Value;
 end;
 
 procedure TfrmSearch.SetSearchWholeWords(Value: boolean);
@@ -171,16 +175,19 @@ var
   s: string;
   i: integer;
 begin
-  if ModalResult = mrOK then begin
+  if ModalResult = mrOK then
+  begin
     s := cbSearchText.Text;
-    if s <> '' then begin
-      i := cbSearchText.Items.IndexOf(s);
-      if i > -1 then begin
-        cbSearchText.Items.Delete(i);
-        cbSearchText.Items.Insert(0, s);
+    if s <> '' then
+    begin
+      i := cbSearchText.Properties.Items.IndexOf(s);
+      if i > -1 then
+      begin
+        cbSearchText.Properties.Items.Delete(i);
+        cbSearchText.Properties.Items.Insert(0, s);
         cbSearchText.Text := s;
       end else
-        cbSearchText.Items.Insert(0, s);
+        cbSearchText.Properties.Items.Insert(0, s);
     end;
   end;
 end;