mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:19:32 +02:00
MG: filedialogs now saves size and history
git-svn-id: trunk@1714 -
This commit is contained in:
parent
9217c2841c
commit
b312b70e90
@ -51,7 +51,7 @@ uses
|
|||||||
{$else}
|
{$else}
|
||||||
mwCustomEdit, mwPasSyn, mwHighlighter,
|
mwCustomEdit, mwPasSyn, mwHighlighter,
|
||||||
{$endif}
|
{$endif}
|
||||||
XMLCfg, CodeTemplateDialog, KeyMapping;
|
XMLCfg, CodeTemplateDialog, KeyMapping, InputHistory;
|
||||||
|
|
||||||
type
|
type
|
||||||
{$ifdef NEW_EDITOR_SYNEDIT}
|
{$ifdef NEW_EDITOR_SYNEDIT}
|
||||||
@ -3010,11 +3010,14 @@ var OpenDialog:TOpenDialog;
|
|||||||
begin
|
begin
|
||||||
OpenDialog:=TOpenDialog.Create(Application);
|
OpenDialog:=TOpenDialog.Create(Application);
|
||||||
try
|
try
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
with OpenDialog do begin
|
with OpenDialog do begin
|
||||||
Filter:='DCI file (*.dci)|*.dci';
|
Title:='Choose code template file (*.dci)';
|
||||||
|
Filter:='DCI file (*.dci)|*.dci|All files|*.*';
|
||||||
if Execute then
|
if Execute then
|
||||||
CodeTemplateFileNameComboBox.Text:=FileName;
|
CodeTemplateFileNameComboBox.Text:=FileName;
|
||||||
end;
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
finally
|
finally
|
||||||
OpenDialog.Free;
|
OpenDialog.Free;
|
||||||
end;
|
end;
|
||||||
|
@ -39,7 +39,7 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils, Forms, Controls, Buttons, XMLCfg, ObjectInspector,
|
Classes, SysUtils, Forms, Controls, Buttons, XMLCfg, ObjectInspector,
|
||||||
ExtCtrls, StdCtrls, EditorOptions, LResources, LazConf, Dialogs,
|
ExtCtrls, StdCtrls, EditorOptions, LResources, LazConf, Dialogs,
|
||||||
ExtToolDialog, IDEProcs, IDEOptionDefs;
|
ExtToolDialog, IDEProcs, IDEOptionDefs, InputHistory;
|
||||||
|
|
||||||
const
|
const
|
||||||
EnvOptsVersion: integer = 101;
|
EnvOptsVersion: integer = 101;
|
||||||
@ -123,7 +123,6 @@ type
|
|||||||
FMaxRecentOpenFiles: integer;
|
FMaxRecentOpenFiles: integer;
|
||||||
FRecentProjectFiles: TStringList;
|
FRecentProjectFiles: TStringList;
|
||||||
FMaxRecentProjectFiles: integer;
|
FMaxRecentProjectFiles: integer;
|
||||||
FLastOpenDialogDir: string;
|
|
||||||
FOpenLastProjectAtStart: boolean;
|
FOpenLastProjectAtStart: boolean;
|
||||||
|
|
||||||
// backup
|
// backup
|
||||||
@ -220,8 +219,6 @@ type
|
|||||||
property MaxRecentProjectFiles: integer
|
property MaxRecentProjectFiles: integer
|
||||||
read FMaxRecentProjectFiles write FMaxRecentProjectFiles;
|
read FMaxRecentProjectFiles write FMaxRecentProjectFiles;
|
||||||
procedure AddToRecentProjectFiles(const AFilename: string);
|
procedure AddToRecentProjectFiles(const AFilename: string);
|
||||||
property LastOpenDialogDir: string
|
|
||||||
read FLastOpenDialogDir write FLastOpenDialogDir;
|
|
||||||
property LastSavedProjectFile: string
|
property LastSavedProjectFile: string
|
||||||
read FLastSavedProjectFile write FLastSavedProjectFile;
|
read FLastSavedProjectFile write FLastSavedProjectFile;
|
||||||
property OpenLastProjectAtStart: boolean
|
property OpenLastProjectAtStart: boolean
|
||||||
@ -487,7 +484,6 @@ begin
|
|||||||
FMaxRecentOpenFiles:=10;
|
FMaxRecentOpenFiles:=10;
|
||||||
FRecentProjectFiles:=TStringList.Create;
|
FRecentProjectFiles:=TStringList.Create;
|
||||||
FMaxRecentProjectFiles:=5;
|
FMaxRecentProjectFiles:=5;
|
||||||
FLastOpenDialogDir:='';
|
|
||||||
FOpenLastProjectAtStart:=true;
|
FOpenLastProjectAtStart:=true;
|
||||||
|
|
||||||
// backup
|
// backup
|
||||||
@ -705,8 +701,6 @@ begin
|
|||||||
'EnvironmentOptions/Recent/ProjectFiles/Max',FMaxRecentProjectFiles);
|
'EnvironmentOptions/Recent/ProjectFiles/Max',FMaxRecentProjectFiles);
|
||||||
LoadRecentList(XMLConfig,FRecentProjectFiles,
|
LoadRecentList(XMLConfig,FRecentProjectFiles,
|
||||||
'EnvironmentOptions/Recent/ProjectFiles/');
|
'EnvironmentOptions/Recent/ProjectFiles/');
|
||||||
FLastOpenDialogDir:=XMLConfig.GetValue(
|
|
||||||
'EnvironmentOptions/Recent/LastOpenDialogDir/Value',FLastOpenDialogDir);
|
|
||||||
|
|
||||||
// external tools
|
// external tools
|
||||||
fExternalTools.Load(XMLConfig,'EnvironmentOptions/ExternalTools/');
|
fExternalTools.Load(XMLConfig,'EnvironmentOptions/ExternalTools/');
|
||||||
@ -841,8 +835,6 @@ begin
|
|||||||
'EnvironmentOptions/Recent/ProjectFiles/Max',FMaxRecentProjectFiles);
|
'EnvironmentOptions/Recent/ProjectFiles/Max',FMaxRecentProjectFiles);
|
||||||
SaveRecentList(XMLConfig,FRecentProjectFiles,
|
SaveRecentList(XMLConfig,FRecentProjectFiles,
|
||||||
'EnvironmentOptions/Recent/ProjectFiles/');
|
'EnvironmentOptions/Recent/ProjectFiles/');
|
||||||
XMLConfig.SetValue('EnvironmentOptions/Recent/LastOpenDialogDir/Value'
|
|
||||||
,FLastOpenDialogDir);
|
|
||||||
|
|
||||||
// external tools
|
// external tools
|
||||||
fExternalTools.Save(XMLConfig,'EnvironmentOptions/ExternalTools/');
|
fExternalTools.Save(XMLConfig,'EnvironmentOptions/ExternalTools/');
|
||||||
@ -2394,6 +2386,7 @@ begin
|
|||||||
SaveDialog:=TSaveDialog.Create(Application);
|
SaveDialog:=TSaveDialog.Create(Application);
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
|
InputHistories.ApplyFileDialogSettings(SaveDialog);
|
||||||
SaveDialog.Filter:='Lazarus Desktop Settings (*.lds)|*.lds'
|
SaveDialog.Filter:='Lazarus Desktop Settings (*.lds)|*.lds'
|
||||||
+'|XML files (*.xml)|*.xml'
|
+'|XML files (*.xml)|*.xml'
|
||||||
+'|All files (*.*)|*.*';
|
+'|All files (*.*)|*.*';
|
||||||
@ -2409,6 +2402,7 @@ begin
|
|||||||
AnEnvironmentOptions.Free;
|
AnEnvironmentOptions.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(SaveDialog);
|
||||||
except
|
except
|
||||||
// ToDo
|
// ToDo
|
||||||
writeln('ERROR: [TEnvironmentOptionsDialog.SaveDesktopSettingsToFileButtonClick]');
|
writeln('ERROR: [TEnvironmentOptionsDialog.SaveDesktopSettingsToFileButtonClick]');
|
||||||
@ -2426,6 +2420,7 @@ begin
|
|||||||
OpenDialog:=TOpenDialog.Create(Application);
|
OpenDialog:=TOpenDialog.Create(Application);
|
||||||
try
|
try
|
||||||
try
|
try
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
OpenDialog.Filter:='Lazarus Desktop Settings (*.lds)|*.lds'
|
OpenDialog.Filter:='Lazarus Desktop Settings (*.lds)|*.lds'
|
||||||
+'|XML files (*.xml)|*.xml'
|
+'|XML files (*.xml)|*.xml'
|
||||||
+'|All files (*.*)|*.*';
|
+'|All files (*.*)|*.*';
|
||||||
@ -2441,6 +2436,7 @@ begin
|
|||||||
AnEnvironmentOptions.Free;
|
AnEnvironmentOptions.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
except
|
except
|
||||||
// ToDo
|
// ToDo
|
||||||
writeln('ERROR: [TEnvironmentOptionsDialog.SaveDesktopSettingsToFileButtonClick]');
|
writeln('ERROR: [TEnvironmentOptionsDialog.SaveDesktopSettingsToFileButtonClick]');
|
||||||
|
@ -29,7 +29,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Dialogs, Buttons, StdCtrls, IDEProcs,
|
Classes, SysUtils, Forms, Controls, Dialogs, Buttons, StdCtrls, IDEProcs,
|
||||||
LResources, TransferMacros;
|
LResources, TransferMacros, InputHistory;
|
||||||
|
|
||||||
type
|
type
|
||||||
TInputFileFlag = (iftDirectory, iftFilename, iftCmdLine,
|
TInputFileFlag = (iftDirectory, iftFilename, iftCmdLine,
|
||||||
@ -168,8 +168,10 @@ begin
|
|||||||
if FileIndex<0 then exit;
|
if FileIndex<0 then exit;
|
||||||
if OpenDialog=nil then OpenDialog:=TOpenDialog.Create(Self);
|
if OpenDialog=nil then OpenDialog:=TOpenDialog.Create(Self);
|
||||||
with OpenDialog do begin
|
with OpenDialog do begin
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
Title:='Select '+GetGroupBox(FileIndex).Caption;
|
Title:='Select '+GetGroupBox(FileIndex).Caption;
|
||||||
if (not Execute) then exit;
|
if (not Execute) then exit;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
AFilename:=Filename;
|
AFilename:=Filename;
|
||||||
if not FilenameIsValidForFileIndex(AFilename,FileIndex) then exit;
|
if not FilenameIsValidForFileIndex(AFilename,FileIndex) then exit;
|
||||||
GetInputEdit(FileIndex).Text:=AFilename;
|
GetInputEdit(FileIndex).Text:=AFilename;
|
||||||
|
@ -31,11 +31,20 @@ unit InputHistory;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, IDEProcs, XMLCfg, LazConf;
|
Classes, SysUtils, IDEProcs, XMLCfg, LazConf, Dialogs;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
TFileDialogSettings = record
|
||||||
|
InitialDir: string;
|
||||||
|
Width: integer;
|
||||||
|
Height: integer;
|
||||||
|
HistoryList: TStringList;
|
||||||
|
MaxHistory: integer;
|
||||||
|
end;
|
||||||
|
|
||||||
TInputHistories = class
|
TInputHistories = class
|
||||||
private
|
private
|
||||||
|
FFileDialogSettings: TFileDialogSettings;
|
||||||
FFilename: string;
|
FFilename: string;
|
||||||
|
|
||||||
// Find- and replace-history
|
// Find- and replace-history
|
||||||
@ -68,6 +77,10 @@ type
|
|||||||
function LastFPCUnitLinksValid: boolean;
|
function LastFPCUnitLinksValid: boolean;
|
||||||
function LastFPCUnitLinksNeedsUpdate(const SearchPath: string): boolean;
|
function LastFPCUnitLinksNeedsUpdate(const SearchPath: string): boolean;
|
||||||
procedure SetLastFPCUnitLinks(const FPCPath, SearchPath, UnitLinks: string);
|
procedure SetLastFPCUnitLinks(const FPCPath, SearchPath, UnitLinks: string);
|
||||||
|
|
||||||
|
// filedialog
|
||||||
|
procedure ApplyFileDialogSettings(DestDialog: TFileDialog);
|
||||||
|
procedure StoreFileDialogSettings(SourceDialog: TFileDialog);
|
||||||
public
|
public
|
||||||
// Find- and replace-history
|
// Find- and replace-history
|
||||||
property FindHistory: TStringList read FFindHistory write FFindHistory;
|
property FindHistory: TStringList read FFindHistory write FFindHistory;
|
||||||
@ -80,6 +93,10 @@ type
|
|||||||
property LastFPCPath: string read FLastFPCPath write SetLastFPCPath;
|
property LastFPCPath: string read FLastFPCPath write SetLastFPCPath;
|
||||||
property LastFPCSearchPath: string read FLastFPCSearchPath;
|
property LastFPCSearchPath: string read FLastFPCSearchPath;
|
||||||
property LastFPCAge: longint read FLastFPCAge;
|
property LastFPCAge: longint read FLastFPCAge;
|
||||||
|
|
||||||
|
// filedialogs
|
||||||
|
property FileDialogSettings: TFileDialogSettings
|
||||||
|
read FFileDialogSettings write FFileDialogSettings;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var InputHistories: TInputHistories;
|
var InputHistories: TInputHistories;
|
||||||
@ -115,12 +132,16 @@ begin
|
|||||||
FReplaceHistory:=TStringList.Create;
|
FReplaceHistory:=TStringList.Create;
|
||||||
FMaxFindHistory:=20;
|
FMaxFindHistory:=20;
|
||||||
|
|
||||||
|
FFileDialogSettings.HistoryList:=TStringList.Create;
|
||||||
|
FFileDialogSettings.MaxHistory:=20;
|
||||||
|
|
||||||
FFilename:='';
|
FFilename:='';
|
||||||
Clear;
|
Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TInputHistories.Destroy;
|
destructor TInputHistories.Destroy;
|
||||||
begin
|
begin
|
||||||
|
FFileDialogSettings.HistoryList.Free;
|
||||||
FFindHistory.Free;
|
FFindHistory.Free;
|
||||||
FReplaceHistory.Free;
|
FReplaceHistory.Free;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
@ -130,6 +151,12 @@ procedure TInputHistories.Clear;
|
|||||||
begin
|
begin
|
||||||
FFindHistory.Clear;
|
FFindHistory.Clear;
|
||||||
FReplaceHistory.Clear;
|
FReplaceHistory.Clear;
|
||||||
|
with FFileDialogSettings do begin
|
||||||
|
HistoryList.Clear;
|
||||||
|
Width:=0;
|
||||||
|
Height:=0;
|
||||||
|
InitialDir:='';
|
||||||
|
end;
|
||||||
FLastFPCPath:='';
|
FLastFPCPath:='';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -144,6 +171,13 @@ begin
|
|||||||
FLastFPCPath:=XMLConfig.GetValue(Path+'FPCUnitLinks/FPCPath','');
|
FLastFPCPath:=XMLConfig.GetValue(Path+'FPCUnitLinks/FPCPath','');
|
||||||
FLastFPCSearchPath:=XMLConfig.GetValue(Path+'FPCUnitLinks/FPCSearchPath','');
|
FLastFPCSearchPath:=XMLConfig.GetValue(Path+'FPCUnitLinks/FPCSearchPath','');
|
||||||
FLastFPCUnitLinks:=XMLConfig.GetValue(Path+'FPCUnitLinks/UnitLinks','');
|
FLastFPCUnitLinks:=XMLConfig.GetValue(Path+'FPCUnitLinks/UnitLinks','');
|
||||||
|
with FFileDialogSettings do begin
|
||||||
|
Width:=XMLConfig.GetValue(Path+'FileDialog/Width',0);
|
||||||
|
Height:=XMLConfig.GetValue(Path+'FileDialog/Height',0);
|
||||||
|
InitialDir:=XMLConfig.GetValue(Path+'FileDialog/InitialDir','');
|
||||||
|
MaxHistory:=XMLConfig.GetValue(Path+'FileDialog/MaxHistory',20);
|
||||||
|
LoadRecentList(XMLConfig,HistoryList,Path+'FileDialog/HistoryList/');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
procedure TInputHistories.SaveToXMLConfig(XMLConfig: TXMLConfig;
|
||||||
@ -157,6 +191,13 @@ begin
|
|||||||
XMLConfig.SetValue(Path+'FPCUnitLinks/FPCPath',FLastFPCPath);
|
XMLConfig.SetValue(Path+'FPCUnitLinks/FPCPath',FLastFPCPath);
|
||||||
XMLConfig.SetValue(Path+'FPCUnitLinks/FPCSearchPath',FLastFPCSearchPath);
|
XMLConfig.SetValue(Path+'FPCUnitLinks/FPCSearchPath',FLastFPCSearchPath);
|
||||||
XMLConfig.SetValue(Path+'FPCUnitLinks/UnitLinks',FLastFPCUnitLinks);
|
XMLConfig.SetValue(Path+'FPCUnitLinks/UnitLinks',FLastFPCUnitLinks);
|
||||||
|
with FFileDialogSettings do begin
|
||||||
|
XMLConfig.SetValue(Path+'FileDialog/Width',Width);
|
||||||
|
XMLConfig.SetValue(Path+'FileDialog/Height',Height);
|
||||||
|
XMLConfig.SetValue(Path+'FileDialog/InitialDir',InitialDir);
|
||||||
|
XMLConfig.SetValue(Path+'FileDialog/MaxHistory',MaxHistory);
|
||||||
|
SaveRecentList(XMLConfig,HistoryList,Path+'FileDialog/HistoryList/');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TInputHistories.SetLazarusDefaultFilename;
|
procedure TInputHistories.SetLazarusDefaultFilename;
|
||||||
@ -234,5 +275,26 @@ begin
|
|||||||
FLastFPCAge:=FileAge(FPCPath);
|
FLastFPCAge:=FileAge(FPCPath);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TInputHistories.ApplyFileDialogSettings(DestDialog: TFileDialog);
|
||||||
|
begin
|
||||||
|
DestDialog.InitialDir:=FFileDialogSettings.InitialDir;
|
||||||
|
DestDialog.Width:=FFileDialogSettings.Width;
|
||||||
|
DestDialog.Height:=FFileDialogSettings.Height;
|
||||||
|
|
||||||
|
DestDialog.HistoryList:=FFileDialogSettings.HistoryList;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TInputHistories.StoreFileDialogSettings(SourceDialog: TFileDialog);
|
||||||
|
var s: string;
|
||||||
|
begin
|
||||||
|
FFileDialogSettings.InitialDir:=SourceDialog.InitialDir;
|
||||||
|
FFileDialogSettings.Width:=SourceDialog.Width;
|
||||||
|
FFileDialogSettings.Height:=SourceDialog.Height;
|
||||||
|
s:=ExtractFilePath(FFileDialogSettings.InitialDir);
|
||||||
|
if s<>'' then
|
||||||
|
AddToRecentList(s,FFileDialogSettings.HistoryList,
|
||||||
|
FFileDialogSettings.MaxHistory);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
31
ide/main.pp
31
ide/main.pp
@ -726,6 +726,7 @@ procedure TMainIDE.FormClose(Sender : TObject; var Action: TCloseAction);
|
|||||||
begin
|
begin
|
||||||
SaveEnvironment;
|
SaveEnvironment;
|
||||||
SaveIncludeLinks;
|
SaveIncludeLinks;
|
||||||
|
InputHistories.Save;
|
||||||
if TheControlSelection<>nil then TheControlSelection.Clear;
|
if TheControlSelection<>nil then TheControlSelection.Clear;
|
||||||
if SourceNoteBook<>nil then SourceNoteBook.ClearUnUsedEditorComponents(true);
|
if SourceNoteBook<>nil then SourceNoteBook.ClearUnUsedEditorComponents(true);
|
||||||
end;
|
end;
|
||||||
@ -1743,21 +1744,20 @@ begin
|
|||||||
or (Sender is TSourceNoteBook) then begin
|
or (Sender is TSourceNoteBook) then begin
|
||||||
OpenDialog:=TOpenDialog.Create(Application);
|
OpenDialog:=TOpenDialog.Create(Application);
|
||||||
try
|
try
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
OpenDialog.Title:=lisOpenFile;
|
OpenDialog.Title:=lisOpenFile;
|
||||||
OpenDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
OpenDialog.Options:=OpenDialog.Options+[ofAllowMultiSelect];
|
||||||
OpenDialog.Options:=[ofAllowMultiSelect];
|
|
||||||
if OpenDialog.Execute and (OpenDialog.Files.Count>0) then begin
|
if OpenDialog.Execute and (OpenDialog.Files.Count>0) then begin
|
||||||
For I := 0 to OpenDialog.Files.Count-1 do
|
For I := 0 to OpenDialog.Files.Count-1 do
|
||||||
Begin
|
Begin
|
||||||
AFilename:=ExpandFilename(OpenDialog.Files.Strings[i]);
|
AFilename:=ExpandFilename(OpenDialog.Files.Strings[i]);
|
||||||
if i=0 then
|
|
||||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(AFilename);
|
|
||||||
if DoOpenEditorFile(AFilename,[])=mrOk then begin
|
if DoOpenEditorFile(AFilename,[])=mrOk then begin
|
||||||
EnvironmentOptions.AddToRecentOpenFiles(AFilename);
|
EnvironmentOptions.AddToRecentOpenFiles(AFilename);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
SaveEnvironment;
|
SaveEnvironment;
|
||||||
end;
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
finally
|
finally
|
||||||
OpenDialog.Free;
|
OpenDialog.Free;
|
||||||
end;
|
end;
|
||||||
@ -2021,17 +2021,17 @@ begin
|
|||||||
if Sender=itmProjectOpen then begin
|
if Sender=itmProjectOpen then begin
|
||||||
OpenDialog:=TOpenDialog.Create(Application);
|
OpenDialog:=TOpenDialog.Create(Application);
|
||||||
try
|
try
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
OpenDialog.Title:=lisOpenProjectFile+' (*.lpi)';
|
OpenDialog.Title:=lisOpenProjectFile+' (*.lpi)';
|
||||||
OPenDialog.Filter := '*.lpi';
|
OpenDialog.Filter := 'Lazarus Project Info (*.lpi)|*.lpi|All Files|*.*';
|
||||||
OpenDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
|
||||||
if OpenDialog.Execute then begin
|
if OpenDialog.Execute then begin
|
||||||
AFilename:=ExpandFilename(OpenDialog.Filename);
|
AFilename:=ExpandFilename(OpenDialog.Filename);
|
||||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(AFilename);
|
|
||||||
if DoOpenProjectFile(AFilename)=mrOk then begin
|
if DoOpenProjectFile(AFilename)=mrOk then begin
|
||||||
EnvironmentOptions.AddToRecentProjectFiles(AFilename);
|
EnvironmentOptions.AddToRecentProjectFiles(AFilename);
|
||||||
SaveEnvironment;
|
SaveEnvironment;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
finally
|
finally
|
||||||
OpenDialog.Free;
|
OpenDialog.Free;
|
||||||
end;
|
end;
|
||||||
@ -2527,9 +2527,9 @@ begin
|
|||||||
SaveDialog:=TSaveDialog.Create(Application);
|
SaveDialog:=TSaveDialog.Create(Application);
|
||||||
try
|
try
|
||||||
// show save dialog
|
// show save dialog
|
||||||
|
InputHistories.ApplyFileDialogSettings(SaveDialog);
|
||||||
SaveDialog.Title:=lisSaveSpace+SaveAsFilename+' (*'+SaveAsFileExt+')';
|
SaveDialog.Title:=lisSaveSpace+SaveAsFilename+' (*'+SaveAsFileExt+')';
|
||||||
SaveDialog.FileName:=SaveAsFilename+SaveAsFileExt;
|
SaveDialog.FileName:=SaveAsFilename+SaveAsFileExt;
|
||||||
SaveDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
|
||||||
if not SaveDialog.Execute then begin
|
if not SaveDialog.Execute then begin
|
||||||
// user cancels
|
// user cancels
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
@ -2537,11 +2537,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
NewFilename:=ExpandFilename(SaveDialog.Filename);
|
NewFilename:=ExpandFilename(SaveDialog.Filename);
|
||||||
finally
|
finally
|
||||||
|
InputHistories.StoreFileDialogSettings(SaveDialog);
|
||||||
SaveDialog.Free;
|
SaveDialog.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(NewFilename);
|
|
||||||
|
|
||||||
// check unitname
|
// check unitname
|
||||||
if FilenameIsPascalUnit(NewFilename) then begin
|
if FilenameIsPascalUnit(NewFilename) then begin
|
||||||
NewUnitName:=ExtractFileNameOnly(NewFilename);
|
NewUnitName:=ExtractFileNameOnly(NewFilename);
|
||||||
@ -3145,6 +3144,7 @@ begin
|
|||||||
|
|
||||||
SaveDialog:=TSaveDialog.Create(Application);
|
SaveDialog:=TSaveDialog.Create(Application);
|
||||||
try
|
try
|
||||||
|
InputHistories.ApplyFileDialogSettings(SaveDialog);
|
||||||
SaveDialog.Title:='Save Project '+Project1.Title+' (*.lpi)';
|
SaveDialog.Title:='Save Project '+Project1.Title+' (*.lpi)';
|
||||||
|
|
||||||
// build a nice project info filename suggestion
|
// build a nice project info filename suggestion
|
||||||
@ -3169,14 +3169,12 @@ begin
|
|||||||
repeat
|
repeat
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
|
|
||||||
SaveDialog.InitialDir:=EnvironmentOptions.LastOpenDialogDir;
|
|
||||||
if not SaveDialog.Execute then begin
|
if not SaveDialog.Execute then begin
|
||||||
// user cancels
|
// user cancels
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
NewFilename:=ExpandFilename(SaveDialog.Filename);
|
NewFilename:=ExpandFilename(SaveDialog.Filename);
|
||||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(NewFilename);
|
|
||||||
NewProgramName:=ExtractFileNameOnly(NewFilename);
|
NewProgramName:=ExtractFileNameOnly(NewFilename);
|
||||||
|
|
||||||
// check filename
|
// check filename
|
||||||
@ -3246,6 +3244,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
until Result<>mrRetry;
|
until Result<>mrRetry;
|
||||||
finally
|
finally
|
||||||
|
InputHistories.StoreFileDialogSettings(SaveDialog);
|
||||||
SaveDialog.Free;
|
SaveDialog.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3895,7 +3894,7 @@ begin
|
|||||||
// search file in path (search especially for pascal files)
|
// search file in path (search especially for pascal files)
|
||||||
if FindFile(FName,SPath) then begin
|
if FindFile(FName,SPath) then begin
|
||||||
result:=mrOk;
|
result:=mrOk;
|
||||||
EnvironmentOptions.LastOpenDialogDir:=ExtractFilePath(FName);
|
InputHistories.FileDialogSettings.InitialDir:=ExtractFilePath(FName);
|
||||||
if DoOpenEditorFile(FName,[])=mrOk then begin
|
if DoOpenEditorFile(FName,[])=mrOk then begin
|
||||||
EnvironmentOptions.AddToRecentOpenFiles(FName);
|
EnvironmentOptions.AddToRecentOpenFiles(FName);
|
||||||
SaveEnvironment;
|
SaveEnvironment;
|
||||||
@ -4584,6 +4583,9 @@ function TMainIDE.DoSaveAll: TModalResult;
|
|||||||
begin
|
begin
|
||||||
writeln('TMainIDE.DoSaveAll');
|
writeln('TMainIDE.DoSaveAll');
|
||||||
Result:=DoSaveProject([]);
|
Result:=DoSaveProject([]);
|
||||||
|
SaveEnvironment;
|
||||||
|
SaveIncludeLinks;
|
||||||
|
InputHistories.Save;
|
||||||
// ToDo: save package, cvs settings, ...
|
// ToDo: save package, cvs settings, ...
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6400,6 +6402,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.302 2002/05/30 14:18:46 lazarus
|
||||||
|
MG: filedialogs now saves size and history
|
||||||
|
|
||||||
Revision 1.301 2002/05/27 17:58:40 lazarus
|
Revision 1.301 2002/05/27 17:58:40 lazarus
|
||||||
MG: added command line help
|
MG: added command line help
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ uses
|
|||||||
MemCheck,
|
MemCheck,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils, Controls, Forms, Buttons, StdCtrls, ComCtrls, Dialogs,
|
Classes, SysUtils, Controls, Forms, Buttons, StdCtrls, ComCtrls, Dialogs,
|
||||||
ExtCtrls, LResources, XMLCfg, DOS, IDEProcs, SysVarUserOverrideDlg;
|
ExtCtrls, LResources, XMLCfg, DOS, IDEProcs, SysVarUserOverrideDlg,
|
||||||
|
InputHistory;
|
||||||
|
|
||||||
{ The xml format version:
|
{ The xml format version:
|
||||||
When the format changes (new values, changed formats) we can distinguish old
|
When the format changes (new values, changed formats) we can distinguish old
|
||||||
@ -717,6 +718,7 @@ var OpenDialog: TOpenDialog;
|
|||||||
begin
|
begin
|
||||||
OpenDialog:=TOpenDialog.Create(Self);
|
OpenDialog:=TOpenDialog.Create(Self);
|
||||||
with OpenDialog do begin
|
with OpenDialog do begin
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
if HostApplicationEdit.Text<>'' then
|
if HostApplicationEdit.Text<>'' then
|
||||||
OpenDialog.InitialDir:=ExtractFilePath(HostApplicationEdit.Text);
|
OpenDialog.InitialDir:=ExtractFilePath(HostApplicationEdit.Text);
|
||||||
OpenDialog.Filename:=HostApplicationEdit.Text;
|
OpenDialog.Filename:=HostApplicationEdit.Text;
|
||||||
@ -729,6 +731,7 @@ begin
|
|||||||
HostApplicationEdit.Text:=OpenDialog.Filename;
|
HostApplicationEdit.Text:=OpenDialog.Filename;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -778,6 +781,7 @@ var OpenDialog: TOpenDialog;
|
|||||||
begin
|
begin
|
||||||
OpenDialog:=TOpenDialog.Create(Self);
|
OpenDialog:=TOpenDialog.Create(Self);
|
||||||
with OpenDialog do begin
|
with OpenDialog do begin
|
||||||
|
InputHistories.ApplyFileDialogSettings(OpenDialog);
|
||||||
if WorkingDirectoryEdit.Text<>'' then
|
if WorkingDirectoryEdit.Text<>'' then
|
||||||
OpenDialog.InitialDir:=ExtractFilePath(WorkingDirectoryEdit.Text);
|
OpenDialog.InitialDir:=ExtractFilePath(WorkingDirectoryEdit.Text);
|
||||||
OpenDialog.Filename:=HostApplicationEdit.Text;
|
OpenDialog.Filename:=HostApplicationEdit.Text;
|
||||||
@ -790,6 +794,7 @@ begin
|
|||||||
WorkingDirectoryEdit.Text:=OpenDialog.Filename;
|
WorkingDirectoryEdit.Text:=OpenDialog.Filename;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
InputHistories.StoreFileDialogSettings(OpenDialog);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user