Changeset 122 for trunk/Forms
- Timestamp:
- Nov 26, 2016, 12:35:41 AM (8 years ago)
- Location:
- trunk/Forms
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r121 r122 1 1 object FormMain: TFormMain 2 Left = 7182 Left = 675 3 3 Height = 447 4 Top = 66 34 Top = 668 5 5 Width = 782 6 6 Caption = 'Acronym Decoder' … … 140 140 Action = AFileClose 141 141 end 142 object ToolButton14: TToolButton 143 Left = 253 144 Height = 22 145 Top = 2 146 Width = 5 147 Style = tbsDivider 148 end 149 object ToolButton16: TToolButton 150 Left = 258 151 Top = 2 152 Action = AFilterExactMatch 153 Style = tbsCheck 154 end 155 object ToolButton13: TToolButton 156 Left = 281 157 Top = 2 158 Action = AFilterCaseSensitive 159 Style = tbsCheck 160 end 142 161 end 143 162 object PanelParam: TPanel … … 156 175 Top = 3 157 176 Width = 129 158 Caption = 'Exact match' 159 OnChange = CheckBoxExactMatchChange 177 Action = AFilterExactMatch 160 178 TabOrder = 0 161 179 end … … 165 183 Top = 3 166 184 Width = 144 167 Caption = 'Case sensitive' 168 OnChange = CheckBoxExactMatchChange 185 Action = AFilterCaseSensitive 169 186 TabOrder = 1 170 187 end … … 264 281 Caption = 'Export' 265 282 OnExecute = AExportExecute 283 end 284 object AFilterExactMatch: TAction 285 AutoCheck = True 286 Caption = 'Exact match' 287 ImageIndex = 18 288 OnExecute = AFilterExactMatchExecute 289 end 290 object AFilterCaseSensitive: TAction 291 AutoCheck = True 292 Caption = 'Case sensitive' 293 ImageIndex = 17 294 OnExecute = AFilterCaseSensitiveExecute 266 295 end 267 296 end -
trunk/Forms/UFormMain.lrt
r121 r122 6 6 TFORMMAIN.TOOLBUTTON8.CAPTION=ToolButton8 7 7 TFORMMAIN.TOOLBUTTON10.CAPTION=ToolButton10 8 TFORMMAIN.CHECKBOXEXACTMATH.CAPTION=Exact match9 TFORMMAIN.CHECKBOXCASESENSITIVE.CAPTION=Case sensitive10 8 TFORMMAIN.AEXIT.CAPTION=Exit 11 9 TFORMMAIN.ASHOW.CAPTION=Show … … 25 23 TFORMMAIN.APROCESSIMPORTS.CAPTION=Process imports 26 24 TFORMMAIN.AEXPORT.CAPTION=Export 25 TFORMMAIN.AFILTEREXACTMATCH.CAPTION=Exact match 26 TFORMMAIN.AFILTERCASESENSITIVE.CAPTION=Case sensitive 27 27 TFORMMAIN.MENUITEM8.CAPTION=File 28 28 TFORMMAIN.MENUITEMOPENRECENT.CAPTION=Open recent -
trunk/Forms/UFormMain.pas
r121 r122 16 16 17 17 TFormMain = class(TForm) 18 AFilterCaseSensitive: TAction; 19 AFilterExactMatch: TAction; 18 20 AHide: TAction; 19 21 AExport: TAction; … … 75 77 ToolButton11: TToolButton; 76 78 ToolButton12: TToolButton; 79 ToolButton13: TToolButton; 80 ToolButton14: TToolButton; 81 ToolButton16: TToolButton; 77 82 ToolButton2: TToolButton; 78 83 ToolButton3: TToolButton; … … 90 95 procedure AFileSaveAsExecute(Sender: TObject); 91 96 procedure AFileSaveExecute(Sender: TObject); 97 procedure AFilterCaseSensitiveExecute(Sender: TObject); 98 procedure AFilterExactMatchExecute(Sender: TObject); 92 99 procedure AHideExecute(Sender: TObject); 93 100 procedure AImportExecute(Sender: TObject); … … 100 107 procedure AShowImportFormatsExecute(Sender: TObject); 101 108 procedure AShowImportSourcesExecute(Sender: TObject); 102 procedure CheckBoxExactMatchChange(Sender: TObject);103 109 procedure EditSearchChange(Sender: TObject); 104 110 procedure FormHide(Sender: TObject); … … 123 129 ProjectClosed: Boolean; 124 130 ImportTotalItemCount: Integer; 125 function GetFilteredCase(Text: string): string;131 function FilterCell(Text1, Text2: string): Boolean; 126 132 procedure ProcessImportsJob(Job: TJob); 127 133 procedure FilterList(List: TListObject); … … 280 286 end; 281 287 288 procedure TFormMain.AFilterCaseSensitiveExecute(Sender: TObject); 289 begin 290 UpdateAcronymsList; 291 end; 292 293 procedure TFormMain.AFilterExactMatchExecute(Sender: TObject); 294 begin 295 UpdateAcronymsList; 296 end; 297 282 298 procedure TFormMain.AHideExecute(Sender: TObject); 283 299 begin … … 401 417 FreeAndNil(FormImportSources); 402 418 end; 403 end;404 405 procedure TFormMain.CheckBoxExactMatchChange(Sender: TObject);406 begin407 UpdateAcronymsList;408 419 end; 409 420 … … 496 507 end; 497 508 498 function TFormMain.GetFilteredCase(Text: string): string; 499 begin 500 if not CheckBoxCaseSensitive.Checked then Result := UTF8LowerCase(Text) 501 else Result := Text; 509 function TFormMain.FilterCell(Text1, Text2: string): Boolean; 510 begin 511 if not AFilterCaseSensitive.Checked then begin 512 Text1 := UTF8LowerCase(Text1); 513 Text2 := UTF8LowerCase(Text2); 514 end; 515 if AFilterExactMatch.Checked then 516 Result := Text1 = Text2 517 else Result := Pos(Text1, Text2) > 0; 502 518 end; 503 519 … … 543 559 if Visible and (EnteredCount > 0) then begin 544 560 FoundCount := 0; 545 if CheckBoxExactMatch.Checked then begin 546 if TextEnteredColumn(0) and (GetFilteredCase(StringGrid.Cells[0, 0]) = 547 GetFilteredCase(TAcronymMeaning(List.Items[I]).Acronym.Name)) then Inc(FoundCount); 548 if TextEnteredColumn(1) and (GetFilteredCase(StringGrid.Cells[1, 0]) = 549 GetFilteredCase(TAcronymMeaning(List.Items[I]).Name)) then Inc(FoundCount); 550 if TextEnteredColumn(2) and (GetFilteredCase(StringGrid.Cells[2, 0]) = 551 GetFilteredCase(TAcronymMeaning(List.Items[I]).Categories.GetString)) then Inc(FoundCount); 552 end else begin 553 if Pos(GetFilteredCase(StringGrid.Cells[0, 0]), 554 GetFilteredCase(TAcronymMeaning(List.Items[I]).Acronym.Name)) > 0 then Inc(FoundCount); 555 if Pos(GetFilteredCase(StringGrid.Cells[1, 0]), 556 GetFilteredCase(TAcronymMeaning(List.Items[I]).Name)) > 0 then Inc(FoundCount); 557 if Pos(GetFilteredCase(StringGrid.Cells[2, 0]), 558 GetFilteredCase(TAcronymMeaning(List.Items[I]).Categories.GetString)) > 0 then Inc(FoundCount); 559 end; 561 if TextEnteredColumn(0) and (FilterCell(StringGrid.Cells[0, 0], 562 TAcronymMeaning(List.Items[I]).Acronym.Name)) then Inc(FoundCount); 563 if TextEnteredColumn(1) and (FilterCell(StringGrid.Cells[1, 0], 564 TAcronymMeaning(List.Items[I]).Name)) then Inc(FoundCount); 565 if TextEnteredColumn(2) and (FilterCell(StringGrid.Cells[2, 0], 566 TAcronymMeaning(List.Items[I]).Categories.GetString)) then Inc(FoundCount); 560 567 if FoundCount <> EnteredCount then List.Delete(I); 561 568 end else List.Delete(I); … … 640 647 Core.AlwaysOnTop := ReadBoolWithDefault('AlwaysOnTop', False); 641 648 Core.StartMinimizedToTray := ReadBoolWithDefault('StartMinimizedToTray', False); 642 CheckBoxExactMatch.Checked := ReadBoolWithDefault('ExactMatch', False);643 CheckBoxCaseSensitive.Checked := ReadBoolWithDefault('CaseSensitive', False);649 AFilterExactMatch.Checked := ReadBoolWithDefault('ExactMatch', False); 650 AFilterCaseSensitive.Checked := ReadBoolWithDefault('CaseSensitive', False); 644 651 MenuItemToolbar.Checked := ReadBoolWithDefault('ToolBarVisible', True); 645 652 MenuItemParam.Checked := ReadBoolWithDefault('FilterParamVisible', True); … … 672 679 WriteBool('AlwaysOnTop', Core.AlwaysOnTop); 673 680 WriteBool('StartMinimizedToTray', Core.StartMinimizedToTray); 674 WriteBool('ExactMatch', CheckBoxExactMatch.Checked);675 WriteBool('CaseSensitive', CheckBoxCaseSensitive.Checked);681 WriteBool('ExactMatch', AFilterExactMatch.Checked); 682 WriteBool('CaseSensitive', AFilterCaseSensitive.Checked); 676 683 WriteBool('ToolBarVisible', MenuItemToolbar.Checked); 677 684 WriteBool('FilterParamVisible', MenuItemParam.Checked);
Note:
See TracChangeset
for help on using the changeset viewer.