* Some small fixes in config handling

This commit is contained in:
Michaël Van Canneyt 2024-09-17 09:12:40 +02:00
parent f27ab84322
commit f8cb933df5
3 changed files with 24 additions and 20 deletions

View File

@ -35,11 +35,10 @@ Type
procedure SetDirectoriesBeforeFiles(AValue: Boolean);
procedure SetFilesInTree(AValue: Boolean);
procedure SetLastOpenedDir(AValue: string);
procedure SetRoootDir(AValue: TRootDir);
procedure SetRootDir(AValue: TRootDir);
procedure SetSplitterPos(AValue: integer);
procedure SetStartDir(AValue: TStartDir);
procedure SetSyncCurrentEditor(AValue: Boolean);
procedure WriteConfig; virtual;
procedure OnFormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
protected
{ Called by file browser window }
@ -53,9 +52,10 @@ Type
procedure ConfigWindow(AForm: TFileBrowserForm); virtual;
function GetResolvedRootDir : String;
function ShowConfig: Boolean;
procedure WriteConfig; virtual;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
property StartDir: TStartDir read FStartDir write SetStartDir;
property RootDir: TRootDir read FRootDir write SetRoootDir;
property RootDir: TRootDir read FRootDir write SetRootDir;
property CustomStartDir: string read FCustomStartDir write SetCustomStartDir;
property CustomRootDir: string read FCustomRootDir write SetCustomRootDir;
property LastOpenedDir: string read FLastOpenedDir write SetLastOpenedDir;
@ -129,7 +129,7 @@ begin
FNeedSave:=True;
end;
procedure TFileBrowserController.SetRoootDir(AValue: TRootDir);
procedure TFileBrowserController.SetRootDir(AValue: TRootDir);
begin
if FRootDir=AValue then Exit;
FRootDir:=AValue;

View File

@ -15,12 +15,12 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Width = 803
Align = alTop
Caption = 'Root directory'
ClientHeight = 174
ClientHeight = 173
ClientWidth = 801
TabOrder = 0
object DERootDir: TDirectoryEdit
Left = 38
Height = 28
Height = 34
Top = 128
Width = 754
ShowHidden = False
@ -34,7 +34,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 16
Height = 23
Top = 96
Width = 175
Width = 191
Caption = 'Always use this directory'
TabOrder = 1
end
@ -42,7 +42,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 14
Height = 23
Top = 36
Width = 118
Width = 131
Caption = 'Filesystem root'
TabOrder = 2
end
@ -50,7 +50,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 14
Height = 23
Top = 9
Width = 197
Width = 220
Caption = 'Use current project directory'
Checked = True
TabOrder = 3
@ -60,7 +60,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 14
Height = 23
Top = 64
Width = 110
Width = 122
Caption = 'User directory'
TabOrder = 4
end
@ -72,12 +72,12 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Width = 803
Align = alTop
Caption = 'Initial directory'
ClientHeight = 135
ClientHeight = 134
ClientWidth = 801
TabOrder = 1
object DEStartDir: TDirectoryEdit
Left = 38
Height = 28
Height = 34
Top = 89
Width = 752
ShowHidden = False
@ -91,7 +91,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 14
Height = 23
Top = 65
Width = 175
Width = 191
Caption = 'Always use this directory'
TabOrder = 1
end
@ -99,7 +99,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 14
Height = 23
Top = 36
Width = 179
Width = 198
Caption = 'Use last opened directory'
TabOrder = 2
end
@ -107,7 +107,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 14
Height = 23
Top = 8
Width = 197
Width = 220
Caption = 'Use current project directory'
Checked = True
TabOrder = 3
@ -118,7 +118,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 24
Height = 23
Top = 355
Width = 191
Width = 207
Caption = 'Show files in main tree view'
TabOrder = 2
OnChange = CBShowFilesInlineChange
@ -129,7 +129,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 52
Height = 23
Top = 386
Width = 191
Width = 207
BorderSpacing.Top = 8
Caption = 'Show files in main tree view'
TabOrder = 3
@ -141,7 +141,7 @@ object FileBrowserOptionsFrame: TFileBrowserOptionsFrame
Left = 24
Height = 23
Top = 417
Width = 277
Width = 304
BorderSpacing.Top = 8
Caption = 'Keep synchronized with current editor file'
TabOrder = 4

View File

@ -90,6 +90,8 @@ begin
sdCustomDir: RB := RBThisDir;
end;
RB.Checked := True;
if C.StartDir=sdCustomDir then
DEStartDir.Directory:=C.CustomStartDir;
case C.RootDir of
rdProjectDir: RB := RBUseProjectDir;
rdRootDir: RB := RBRootFileSystemRoot;
@ -97,6 +99,8 @@ begin
rdCustomDir: RB := RBRootThisDir;
end;
RB.Checked := True;
if C.RootDir=rdCustomDir then
DERootDir.Directory:=C.CustomRootDir;
CBShowFilesInline.Checked:=C.FilesInTree;
CBShowDirectoriesBeforeFiles.Checked:=C.DirectoriesBeforeFiles;
CBSyncCurrentEditor.Checked:=C.SyncCurrentEditor;
@ -135,9 +139,9 @@ begin
RD:=rdCustomDir;
C.RootDir:=rD;
if rD=rdCustomDir then
C.CustomRootDir:=DEStartDir.Directory
C.CustomRootDir:=DERootDir.Directory
else
C.CustomStartDir:='';
C.CustomRootDir:='';
C.FilesInTree:=CBShowFilesInline.Checked;
C.SyncCurrentEditor:=CBSyncCurrentEditor.Checked;
end;