doublecmd/src/frames/foptionsfilesearch.pas
Denis Bisson 3c8068c942 ADD: New internal command "cm_AddNewSearch" to generate a new instance of the "Find files" dialog window. This way, more than one search may be done at the same time.
ADD: When closing any "Find files" dialog window, if at least one search has been done, that window will remain in memory. If no search has been done, it will be cleared from memory.
ADD: New internal command "cm_ViewSearches" to show a list of "Find files" dialog window and select one of them to activate it. This way, it possible to do a second search without losing the first one and to be able to reactive it.
ADD: New internal command "cm_DeleteSearches" to delete all the "Find files" dialog windows we may have in memory. If you want to delete just one, activate it via the "cm_ViewSearches" internal command and then clear it from memory from there.
ADD: New internal command "cm_ConfigSearches" to jump directly to the configuration of options related with searches.
ADD: New 32x32 icons for the new internal commands "cm_AddNewSearch", "cm_ViewSearches", "cm_DeleteSearches" and "cm_ConfigSearches". For the 16x16, the last three mentionned were added since for the "cm_AddNewSearch" it was already there, added by mistake too early but now it's used.
ADD: There is now a dedicated page for the option of the search instead of being inside the "File operations" page.
UPD: On new installation, in the "Find files" dialog window, the "ENTER" key is not a shortcut anymore to launch a search. Too many persons get used that pressing enter in the result page was making us to jump to the file location. Code were already in place to have pertinent action on default button so pressing "ENTER" do the pertinent expected job.
ADD: Possibility to have a menu bar in the "Find files" dialog window. This is mainly to help the user at first to see all the possibility. There is an option to hide it and probably experienced user after a while will hide it to gain some 20 extra pixels vertically.
ADD: Reserve, if not already used, the keyboard shortcut "Ctrl+Shift+F7" for the new internal command "cm_AddNewSearch".
UPD: Inside the "Find files" unit, re-arrange the code so the buttons will use TAction to do something instead of the opposite where the TAction were pressing button.
UPD: Language files have been updated.
2016-12-01 02:23:28 +00:00

133 lines
3.9 KiB
ObjectPascal

{
Double Commander
-------------------------------------------------------------------------
File search options page
Copyright (C) 2006-2016 Alexander Koblov (alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
}
unit fOptionsFileSearch;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, StdCtrls, Spin, ExtCtrls, KASComboBox, DividerBevel,
fOptionsFrame;
type
{ TfrmOptionsFileSearch }
TfrmOptionsFileSearch = class(TOptionsEditor)
cbInitiallyClearFileMask: TCheckBox;
cbNewSearchFilters: TComboBoxAutoWidth;
cbShowMenuBarInFindFiles: TCheckBox;
cbPartialNameSearch: TCheckBox;
cbSearchDefaultTemplate: TComboBoxAutoWidth;
dbTextSearch: TDividerBevel;
gbFileSearch: TGroupBox;
lblNewSearchFilters: TLabel;
lblSearchDefaultTemplate: TLabel;
rbUseMmapInSearch: TRadioButton;
rbUseStreamInSearch: TRadioButton;
private
FLoading: Boolean;
procedure FillTemplatesList(ListItems: TStrings);
protected
procedure Init; override;
procedure Load; override;
function Save: TOptionsEditorSaveFlags; override;
public
constructor Create(TheOwner: TComponent); override;
class function GetIconIndex: Integer; override;
class function GetTitle: String; override;
end;
implementation
{$R *.lfm}
uses
DCStrUtils, uGlobs, uLng;
{ TfrmOptionsFileSearch }
class function TfrmOptionsFileSearch.GetIconIndex: Integer;
begin
Result := 41;
end;
class function TfrmOptionsFileSearch.GetTitle: String;
begin
Result := rsOptionsEditorFileSearch;
end;
procedure TfrmOptionsFileSearch.Init;
begin
FillTemplatesList(cbSearchDefaultTemplate.Items);
ParseLineToList(rsNewSearchClearFilterOptions, cbNewSearchFilters.Items);
end;
procedure TfrmOptionsFileSearch.FillTemplatesList(ListItems: TStrings);
begin
gSearchTemplateList.LoadToStringList(ListItems);
ListItems.Insert(0, rsOptHotkeysNoHotkey);
end;
procedure TfrmOptionsFileSearch.Load;
begin
FLoading := True;
rbUseMmapInSearch.Checked := gUseMmapInSearch;
cbPartialNameSearch.Checked := gPartialNameSearch;
cbInitiallyClearFileMask.Checked := gInitiallyClearFileMask;
cbNewSearchFilters.ItemIndex := integer(gNewSearchClearFiltersAction);
cbShowMenuBarInFindFiles.Checked := gShowMenuBarInFindFiles;
cbSearchDefaultTemplate.ItemIndex := cbSearchDefaultTemplate.Items.IndexOf(gSearchDefaultTemplate);
if cbSearchDefaultTemplate.ItemIndex < 0 then cbSearchDefaultTemplate.ItemIndex := 0;
FLoading := False;
end;
function TfrmOptionsFileSearch.Save: TOptionsEditorSaveFlags;
begin
Result := [];
gUseMmapInSearch := rbUseMmapInSearch.Checked;
gPartialNameSearch := cbPartialNameSearch.Checked;
gInitiallyClearFileMask := cbInitiallyClearFileMask.Checked;
gNewSearchClearFiltersAction := TFiltersOnNewSearch(cbNewSearchFilters.ItemIndex);
gShowMenuBarInFindFiles := cbShowMenuBarInFindFiles.Checked;
if cbSearchDefaultTemplate.ItemIndex > 0 then
gSearchDefaultTemplate:= cbSearchDefaultTemplate.Text
else begin
gSearchDefaultTemplate:= EmptyStr;
end;
end;
constructor TfrmOptionsFileSearch.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FLoading := False;
end;
end.