mirror of https://gitlab.com/basile.b/dexed.git
last doc and proj, also saves and restores focused document
This commit is contained in:
parent
6dab35adca
commit
477bcb2054
|
@ -212,7 +212,6 @@ end;
|
||||||
procedure TCEPageControl.hidePage(index: integer);
|
procedure TCEPageControl.hidePage(index: integer);
|
||||||
var
|
var
|
||||||
pge: TCEPage;
|
pge: TCEPage;
|
||||||
ctl: TControl;
|
|
||||||
begin
|
begin
|
||||||
if (index < 0) or (index > fPages.Count-1) then
|
if (index < 0) or (index > fPages.Count-1) then
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -344,12 +344,14 @@ type
|
||||||
private
|
private
|
||||||
fDocuments: TStringList;
|
fDocuments: TStringList;
|
||||||
fProject: string;
|
fProject: string;
|
||||||
|
fDocIndex: integer;
|
||||||
//fProjectGRoup: string;
|
//fProjectGRoup: string;
|
||||||
procedure setDocuments(aValue: TStringList);
|
procedure setDocuments(aValue: TStringList);
|
||||||
protected
|
protected
|
||||||
procedure beforeSave; override;
|
procedure beforeSave; override;
|
||||||
procedure afterLoad; override;
|
procedure afterLoad; override;
|
||||||
published
|
published
|
||||||
|
property documentIndex: integer read fDocIndex write fDocIndex;
|
||||||
property documents: TStringList read fDocuments write setDocuments;
|
property documents: TStringList read fDocuments write setDocuments;
|
||||||
property project: string read fProject write fProject;
|
property project: string read fProject write fProject;
|
||||||
// property projectGroup: string read fProjectGroup write fProjectGroup;
|
// property projectGroup: string read fProjectGroup write fProjectGroup;
|
||||||
|
@ -528,30 +530,49 @@ end;
|
||||||
procedure TCELastDocsAndProjs.beforeSave;
|
procedure TCELastDocsAndProjs.beforeSave;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
mdh: ICEMultiDocHandler;
|
docHandler: ICEMultiDocHandler;
|
||||||
|
document: TCESynMemo;
|
||||||
str: string;
|
str: string;
|
||||||
begin
|
begin
|
||||||
mdh := getMultiDocHandler;
|
docHandler := getMultiDocHandler;
|
||||||
if mdh = nil then exit;
|
if docHandler = nil then
|
||||||
for i:= 0 to mdh.documentCount-1 do
|
exit;
|
||||||
|
//
|
||||||
|
for i:= 0 to docHandler.documentCount-1 do
|
||||||
begin
|
begin
|
||||||
str := mdh.document[i].fileName;
|
document := docHandler.document[i];
|
||||||
if str <> mdh.document[i].tempFilename then
|
str := document.fileName;
|
||||||
if FileExists(str) then
|
if (str <> document.tempFilename) and FileExists(str) then
|
||||||
fDocuments.Add(str);
|
begin
|
||||||
|
fDocuments.Add(str);
|
||||||
|
if document.Focused then
|
||||||
|
documentIndex := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELastDocsAndProjs.afterLoad;
|
procedure TCELastDocsAndProjs.afterLoad;
|
||||||
var
|
var
|
||||||
mdh: ICEMultiDocHandler;
|
docHandler: ICEMultiDocHandler;
|
||||||
str: string;
|
str, focusedName: string;
|
||||||
|
i: integer;
|
||||||
begin
|
begin
|
||||||
mdh := getMultiDocHandler;
|
docHandler := getMultiDocHandler;
|
||||||
if mdh = nil then exit;
|
if docHandler = nil then
|
||||||
for str in fDocuments do
|
exit;
|
||||||
|
//
|
||||||
|
for i := 0 to fDocuments.Count-1 do
|
||||||
|
begin
|
||||||
|
str := fDocuments.Strings[i];
|
||||||
if FileExists(str) then
|
if FileExists(str) then
|
||||||
mdh.openDocument(str);
|
docHandler.openDocument(str);
|
||||||
|
if i = fDocIndex then
|
||||||
|
focusedName := str;
|
||||||
|
end;
|
||||||
|
//
|
||||||
|
if focusedName <> '' then
|
||||||
|
docHandler.openDocument(focusedName);
|
||||||
|
|
||||||
// TODO-cbugfix: if project file is reloaded to an editor it won't be linked to the matching project (e.g save file and project editor widget directly updated)
|
// TODO-cbugfix: if project file is reloaded to an editor it won't be linked to the matching project (e.g save file and project editor widget directly updated)
|
||||||
// same with MRU file or mini-explorer.
|
// same with MRU file or mini-explorer.
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue