mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
UPD: Make language configuration page as TFrame.
UPD: Add Save result to report that options change needs restart.
This commit is contained in:
parent
3dadcdc476
commit
92ebc8a69a
9 changed files with 137 additions and 59 deletions
|
|
@ -100,7 +100,7 @@ type
|
|||
procedure Done; override;
|
||||
public
|
||||
procedure Load; override;
|
||||
procedure Save; override;
|
||||
function Save: TOptionsEditorSaveFlags; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
|
@ -490,7 +490,7 @@ begin
|
|||
tbInactivePanelBrightness.Position:= gInactivePanelBrightness;
|
||||
end;
|
||||
|
||||
procedure TfrmOptionsColors.Save;
|
||||
function TfrmOptionsColors.Save: TOptionsEditorSaveFlags;
|
||||
begin
|
||||
gForeColor := cbTextColor.Selected;
|
||||
gBackColor := cbBackColor.Selected; // background color
|
||||
|
|
@ -501,6 +501,7 @@ begin
|
|||
gUseInvertedSelection := cbbUseInvertedSelection.Checked;
|
||||
gInactivePanelBrightness := tbInactivePanelBrightness.Position;
|
||||
gUseFrameCursor := cbbUseFrameCursor.Checked;
|
||||
Result := [];
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@ type
|
|||
optedArchivers,
|
||||
optedTooltips);
|
||||
|
||||
TOptionsEditorSaveFlag = (oesfNeedsRestart);
|
||||
TOptionsEditorSaveFlags = set of TOptionsEditorSaveFlag;
|
||||
|
||||
{ TOptionsEditorClass }
|
||||
|
||||
TOptionsEditorClass = class of TOptionsEditor;
|
||||
|
|
@ -46,7 +49,7 @@ type
|
|||
destructor Destroy; override;
|
||||
|
||||
procedure Load; virtual; abstract;
|
||||
procedure Save; virtual; abstract;
|
||||
function Save: TOptionsEditorSaveFlags; virtual; abstract;
|
||||
end;
|
||||
|
||||
{ TOptionsEditorRec }
|
||||
|
|
|
|||
12
src/frames/foptionslanguage.lfm
Normal file
12
src/frames/foptionslanguage.lfm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
inherited frmOptionsLanguage: TfrmOptionsLanguage
|
||||
Align = alClient
|
||||
object lngList: TListBox[0]
|
||||
Left = 0
|
||||
Height = 240
|
||||
Top = 0
|
||||
Width = 320
|
||||
Align = alClient
|
||||
ItemHeight = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
92
src/frames/foptionslanguage.pas
Normal file
92
src/frames/foptionslanguage.pas
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
unit fOptionsLanguage;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, StdCtrls,
|
||||
fOptionsFrame;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmOptionsLanguage }
|
||||
|
||||
TfrmOptionsLanguage = class(TOptionsEditor)
|
||||
lngList: TListBox;
|
||||
private
|
||||
procedure FillLngListBox;
|
||||
protected
|
||||
procedure Init; override;
|
||||
procedure Done; override;
|
||||
public
|
||||
procedure Load; override;
|
||||
function Save: TOptionsEditorSaveFlags; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
uDebug, uFindEx, uTypes, uGlobs, uGlobsPaths, uLng;
|
||||
|
||||
{ TfrmOptionsLanguage }
|
||||
|
||||
procedure TfrmOptionsLanguage.FillLngListBox;
|
||||
var
|
||||
fr: TSearchRecEx;
|
||||
iIndex: Integer;
|
||||
sLangName: String;
|
||||
begin
|
||||
lngList.Clear;
|
||||
DCDebug('Language dir: ' + gpLngDir);
|
||||
if FindFirstEx(gpLngDir+'*.po', faAnyFile, fr)<>0 then
|
||||
begin
|
||||
FindCloseEx(fr);
|
||||
Exit;
|
||||
end;
|
||||
repeat
|
||||
sLangName := GetLanguageName(gpLngDir + fr.Name);
|
||||
lngList.Items.Add(Format('%s = (%s)', [fr.Name, sLangName]));
|
||||
until FindNextEx(fr)<>0;
|
||||
|
||||
FindCloseEx(fr);
|
||||
|
||||
iIndex:=lngList.Items.IndexOfName(gPOFileName + #32);
|
||||
if iIndex>=0 then
|
||||
lngList.Selected[iIndex]:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmOptionsLanguage.Init;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TfrmOptionsLanguage.Done;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TfrmOptionsLanguage.Load;
|
||||
begin
|
||||
FillLngListBox;
|
||||
end;
|
||||
|
||||
function TfrmOptionsLanguage.Save: TOptionsEditorSaveFlags;
|
||||
var
|
||||
SelectedPOFileName: String;
|
||||
begin
|
||||
Result := [];
|
||||
if lngList.ItemIndex > -1 then
|
||||
begin
|
||||
SelectedPOFileName := Trim(lngList.Items.Names[lngList.ItemIndex]);
|
||||
if SelectedPOFileName <> gPOFileName then
|
||||
Include(Result, oesfNeedsRestart);
|
||||
gPOFileName := SelectedPOFileName;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterOptionsEditor(optedLanguage, TfrmOptionsLanguage);
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ type
|
|||
procedure Done; override;
|
||||
public
|
||||
procedure Load; override;
|
||||
procedure Save; override;
|
||||
function Save: TOptionsEditorSaveFlags; override;
|
||||
end;
|
||||
|
||||
var
|
||||
|
|
@ -603,7 +603,7 @@ begin
|
|||
tmpWLXPlugins.Assign(gWLXPlugins);
|
||||
end;
|
||||
|
||||
procedure TfrmOptionsPlugins.Save;
|
||||
function TfrmOptionsPlugins.Save: TOptionsEditorSaveFlags;
|
||||
begin
|
||||
{ Set plugins lists }
|
||||
gDSXPlugins.Assign(tmpDSXPlugins);
|
||||
|
|
@ -611,6 +611,7 @@ begin
|
|||
gWDXPlugins.Assign(tmpWDXPlugins);
|
||||
gWFXPlugins.Assign(tmpWFXPlugins);
|
||||
gWLXPlugins.Assign(tmpWLXPlugins);
|
||||
Result := [];
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ type
|
|||
procedure Done; override;
|
||||
public
|
||||
procedure Load; override;
|
||||
procedure Save; override;
|
||||
function Save: TOptionsEditorSaveFlags; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
|
@ -221,7 +221,7 @@ begin
|
|||
lsbCustomFields.Items.Add(FFileInfoToolTip.HintItemList[I].Name);
|
||||
end;
|
||||
|
||||
procedure TfrmOptionsToolTips.Save;
|
||||
function TfrmOptionsToolTips.Save: TOptionsEditorSaveFlags;
|
||||
begin
|
||||
gShowToolTipMode:= []; // Reset tool tip show mode
|
||||
if rbToolTipAllFiles.Checked then
|
||||
|
|
@ -230,6 +230,7 @@ begin
|
|||
Include(gShowToolTipMode, stm_only_large_name);
|
||||
|
||||
gFileInfoToolTip.Assign(FFileInfoToolTip);
|
||||
Result := [];
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue