reload last project, handle the free standing project

This commit is contained in:
Basile Burg 2016-06-22 05:27:28 +02:00
parent cc4fdbfc40
commit baee2e6207
4 changed files with 30 additions and 20 deletions

View File

@ -321,12 +321,14 @@ type
function groupFilename: string; function groupFilename: string;
// indicates the count of project in the group // indicates the count of project in the group
function projectCount: integer; function projectCount: integer;
// indicates the index of the project
function getProjectIndex: integer;
// returns the nth project // returns the nth project
function getProject(index: Integer): ICECommonProject; function getProject(index: Integer): ICECommonProject;
// tries to find the project named fname. // tries to find the project named fname.
function findProject(const fname: string): ICECommonProject; function findProject(const fname: string): ICECommonProject;
// selects the nth project // selects the nth project
procedure selectProject(index: Integer); procedure setProjectIndex(index: Integer);
end; end;

View File

@ -423,6 +423,7 @@ type
fProject: string; fProject: string;
fDocIndex: integer; fDocIndex: integer;
fProjectGroup: string; fProjectGroup: string;
fProjectIndex: integer;
procedure setDocuments(aValue: TStringList); procedure setDocuments(aValue: TStringList);
protected protected
procedure beforeSave; override; procedure beforeSave; override;
@ -432,6 +433,7 @@ type
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;
property projectIndex: integer read fProjectIndex write fProjectIndex;
public public
constructor create(aOwner: TComponent); override; constructor create(aOwner: TComponent); override;
destructor destroy; override; destructor destroy; override;
@ -690,12 +692,16 @@ procedure TCELastDocsAndProjs.Assign(aSource: TPersistent);
var var
itf: ICECommonProject = nil; itf: ICECommonProject = nil;
begin begin
if aSource is TCEMainForm then if aSource = CEMainForm then
begin begin
itf := TCEMainForm(aSource).fFreeProj; itf := CEMainForm.fFreeProj;
if itf <> nil then if itf <> nil then
fProject := itf.filename; fProject := itf.filename;
fProjectGroup := getProjectGroup.groupFilename; fProjectGroup := getProjectGroup.groupFilename;
if itf = CEMainForm.fProject then
fProjectIndex:=-1
else
fProjectIndex := getProjectGroup.getProjectIndex;
end else end else
inherited; inherited;
end; end;
@ -731,6 +737,8 @@ begin
begin begin
getProjectGroup.openGroup(fProjectGroup); getProjectGroup.openGroup(fProjectGroup);
end; end;
if (fProjectIndex = -1) and (dst.fFreeProj <> nil) then
dst.fFreeProj.activate;
end else end else
inherited; inherited;
end; end;

View File

@ -36,7 +36,6 @@ type
fModified: boolean; fModified: boolean;
fOnChanged: TNotifyEvent; fOnChanged: TNotifyEvent;
procedure setItems(value: TCollection); procedure setItems(value: TCollection);
procedure setProjectIndex(value: integer);
function getItem(index: integer): TProjectGroupItem; function getItem(index: integer): TProjectGroupItem;
procedure doChanged; procedure doChanged;
// //
@ -45,9 +44,6 @@ type
protected protected
procedure afterLoad; override; procedure afterLoad; override;
procedure afterSave; override; procedure afterSave; override;
published
property items: TCollection read fItems write setItems;
property projectIndex: integer read fProjectIndex write setProjectIndex;
public public
constructor create(aOwner: TComponent); override; constructor create(aOwner: TComponent); override;
destructor destroy; override; destructor destroy; override;
@ -60,13 +56,17 @@ type
function groupModified: boolean; function groupModified: boolean;
function groupFilename: string; function groupFilename: string;
function projectCount: integer; function projectCount: integer;
function getProjectIndex: integer;
function getProject(ix: Integer): ICECommonProject; function getProject(ix: Integer): ICECommonProject;
function findProject(const fname: string): ICECommonProject; function findProject(const fname: string): ICECommonProject;
procedure selectProject(ix: Integer); procedure setProjectIndex(value: Integer);
// //
function addItem(const fname: string): TProjectGroupItem; function addItem(const fname: string): TProjectGroupItem;
property item[ix: integer]: TProjectGroupItem read getItem; default; property item[ix: integer]: TProjectGroupItem read getItem; default;
property onChanged: TNotifyEvent read fOnChanged write fOnChanged; property onChanged: TNotifyEvent read fOnChanged write fOnChanged;
published
property items: TCollection read fItems write setItems;
property index: integer read fProjectIndex write setProjectIndex;
end; end;
(** (**
@ -205,11 +205,6 @@ begin
end; end;
end; end;
procedure TProjectGroup.selectProject(ix: Integer);
begin
setProjectIndex(ix);
end;
procedure TProjectGroup.afterLoad; procedure TProjectGroup.afterLoad;
begin begin
inherited; inherited;
@ -284,6 +279,11 @@ begin
exit(fItems.Count); exit(fItems.Count);
end; end;
function TProjectGroup.getProjectIndex: integer;
begin
exit(fProjectIndex);
end;
function TProjectGroup.singleServiceName: string; function TProjectGroup.singleServiceName: string;
begin begin
exit('ICEProjectGroup'); exit('ICEProjectGroup');
@ -443,16 +443,16 @@ begin
exit; exit;
TProjectGroupItem(lstProj.Selected.Data).lazyLoad; TProjectGroupItem(lstProj.Selected.Data).lazyLoad;
subjProjFocused(fProjSubj, TProjectGroupItem(lstProj.Selected.Data).project); subjProjFocused(fProjSubj, TProjectGroupItem(lstProj.Selected.Data).project);
if projectGroup.projectIndex <> lstProj.ItemIndex then if projectGroup.getProjectIndex <> lstProj.ItemIndex then
projectGroup.projectIndex := lstProj.ItemIndex; projectGroup.setProjectIndex(lstProj.ItemIndex);
end; end;
procedure TCEProjectGroupWidget.handleChanged(sender: TObject); procedure TCEProjectGroupWidget.handleChanged(sender: TObject);
begin begin
updateList; updateList;
if (projectGroup.projectIndex <> -1) and (projectGroup.projectIndex <> lstProj.ItemIndex) then if (projectGroup.getProjectIndex <> -1) and (projectGroup.getProjectIndex <> lstProj.ItemIndex) then
begin begin
lstProj.ItemIndex := projectGroup.projectIndex; lstProj.ItemIndex := projectGroup.getProjectIndex;
lstProjDblClick(nil); lstProjDblClick(nil);
end; end;
end; end;

View File

@ -53,12 +53,12 @@ The latest Coedit version requires at least DMD 2.066.
* Choose the zipped setup for your platform (at the bottom of a release log, the buttons labeled `coedit.<version>.<platform>.setup.zip`). * Choose the zipped setup for your platform (at the bottom of a release log, the buttons labeled `coedit.<version>.<platform>.setup.zip`).
* The content must be extracted and executed: * The content must be extracted and executed:
* note that the option `--nodcd` can be typed to skip the installation of the completion daemon. * note that the option `--nodcd` can be typed to skip the installation of the completion daemon.
* Linux, all users, in a console `cd` to the file location and type `sudo .\coedit.<version>.<platform>.setup`. * Linux, all users, in a console `cd` to the file location and type `sudo ./coedit.<version>.<platform>.setup`.
* Linux, only you, in a console `cd` to the file location and type: `.\coedit.<version>.<platform>.setup`. * Linux, only you, in a console `cd` to the file location and type: `./coedit.<version>.<platform>.setup`.
* Windows, optional, it may be necessary to deactivate your anti-virus software. Norton AV has been reported for detecting a potential threat in his heuristic module and Avast AV not to allow the setup at all. * Windows, optional, it may be necessary to deactivate your anti-virus software. Norton AV has been reported for detecting a potential threat in his heuristic module and Avast AV not to allow the setup at all.
* Windows: double click, and confirm in the UAC dialog box. * Windows: double click, and confirm in the UAC dialog box.
* To uninstall, run the same program but with the `-u` option. * To uninstall, run the same program but with the `-u` option.
* Linux: if coedit has been setup with `sudo` you must also uninstall with elevated privileges: `sudo .\coedit.<version>.<platform>.setup -u`. * Linux: if coedit has been setup with `sudo` you must also uninstall with elevated privileges: `sudo ./coedit.<version>.<platform>.setup -u`.
* Windows: start a console as administrator and execute: `coedit.<version>.win32.setup -u`. * Windows: start a console as administrator and execute: `coedit.<version>.win32.setup -u`.
* Troubleshooting: run the setup program with the `-l` (or `--list`) option to get the status of the files and use the report to uninstall manually the files or open a ticket [here][lnk_bugtracker]. * Troubleshooting: run the setup program with the `-l` (or `--list`) option to get the status of the files and use the report to uninstall manually the files or open a ticket [here][lnk_bugtracker].