diff --git a/src/ce_interfaces.pas b/src/ce_interfaces.pas index 61a658ab..28d18779 100644 --- a/src/ce_interfaces.pas +++ b/src/ce_interfaces.pas @@ -321,12 +321,14 @@ type function groupFilename: string; // indicates the count of project in the group function projectCount: integer; + // indicates the index of the project + function getProjectIndex: integer; // returns the nth project function getProject(index: Integer): ICECommonProject; // tries to find the project named fname. function findProject(const fname: string): ICECommonProject; // selects the nth project - procedure selectProject(index: Integer); + procedure setProjectIndex(index: Integer); end; diff --git a/src/ce_main.pas b/src/ce_main.pas index 1d0d2f41..cce66c16 100644 --- a/src/ce_main.pas +++ b/src/ce_main.pas @@ -423,6 +423,7 @@ type fProject: string; fDocIndex: integer; fProjectGroup: string; + fProjectIndex: integer; procedure setDocuments(aValue: TStringList); protected procedure beforeSave; override; @@ -432,6 +433,7 @@ type property documents: TStringList read fDocuments write setDocuments; property project: string read fProject write fProject; property projectGroup: string read fProjectGroup write fProjectGroup; + property projectIndex: integer read fProjectIndex write fProjectIndex; public constructor create(aOwner: TComponent); override; destructor destroy; override; @@ -690,12 +692,16 @@ procedure TCELastDocsAndProjs.Assign(aSource: TPersistent); var itf: ICECommonProject = nil; begin - if aSource is TCEMainForm then + if aSource = CEMainForm then begin - itf := TCEMainForm(aSource).fFreeProj; + itf := CEMainForm.fFreeProj; if itf <> nil then fProject := itf.filename; fProjectGroup := getProjectGroup.groupFilename; + if itf = CEMainForm.fProject then + fProjectIndex:=-1 + else + fProjectIndex := getProjectGroup.getProjectIndex; end else inherited; end; @@ -731,6 +737,8 @@ begin begin getProjectGroup.openGroup(fProjectGroup); end; + if (fProjectIndex = -1) and (dst.fFreeProj <> nil) then + dst.fFreeProj.activate; end else inherited; end; diff --git a/src/ce_projgroup.pas b/src/ce_projgroup.pas index 5fc5915f..48618791 100644 --- a/src/ce_projgroup.pas +++ b/src/ce_projgroup.pas @@ -36,7 +36,6 @@ type fModified: boolean; fOnChanged: TNotifyEvent; procedure setItems(value: TCollection); - procedure setProjectIndex(value: integer); function getItem(index: integer): TProjectGroupItem; procedure doChanged; // @@ -45,9 +44,6 @@ type protected procedure afterLoad; override; procedure afterSave; override; - published - property items: TCollection read fItems write setItems; - property projectIndex: integer read fProjectIndex write setProjectIndex; public constructor create(aOwner: TComponent); override; destructor destroy; override; @@ -60,13 +56,17 @@ type function groupModified: boolean; function groupFilename: string; function projectCount: integer; + function getProjectIndex: integer; function getProject(ix: Integer): ICECommonProject; function findProject(const fname: string): ICECommonProject; - procedure selectProject(ix: Integer); + procedure setProjectIndex(value: Integer); // function addItem(const fname: string): TProjectGroupItem; property item[ix: integer]: TProjectGroupItem read getItem; default; property onChanged: TNotifyEvent read fOnChanged write fOnChanged; + published + property items: TCollection read fItems write setItems; + property index: integer read fProjectIndex write setProjectIndex; end; (** @@ -205,11 +205,6 @@ begin end; end; -procedure TProjectGroup.selectProject(ix: Integer); -begin - setProjectIndex(ix); -end; - procedure TProjectGroup.afterLoad; begin inherited; @@ -284,6 +279,11 @@ begin exit(fItems.Count); end; +function TProjectGroup.getProjectIndex: integer; +begin + exit(fProjectIndex); +end; + function TProjectGroup.singleServiceName: string; begin exit('ICEProjectGroup'); @@ -443,16 +443,16 @@ begin exit; TProjectGroupItem(lstProj.Selected.Data).lazyLoad; subjProjFocused(fProjSubj, TProjectGroupItem(lstProj.Selected.Data).project); - if projectGroup.projectIndex <> lstProj.ItemIndex then - projectGroup.projectIndex := lstProj.ItemIndex; + if projectGroup.getProjectIndex <> lstProj.ItemIndex then + projectGroup.setProjectIndex(lstProj.ItemIndex); end; procedure TCEProjectGroupWidget.handleChanged(sender: TObject); begin updateList; - if (projectGroup.projectIndex <> -1) and (projectGroup.projectIndex <> lstProj.ItemIndex) then + if (projectGroup.getProjectIndex <> -1) and (projectGroup.getProjectIndex <> lstProj.ItemIndex) then begin - lstProj.ItemIndex := projectGroup.projectIndex; + lstProj.ItemIndex := projectGroup.getProjectIndex; lstProjDblClick(nil); end; end; diff --git a/wiki/wiki.txt b/wiki/wiki.txt index 36262e8e..6431289d 100644 --- a/wiki/wiki.txt +++ b/wiki/wiki.txt @@ -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...setup.zip`). * The content must be extracted and executed: * 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...setup`. - * Linux, only you, in a console `cd` to the file location and type: `.\coedit...setup`. + * Linux, all users, in a console `cd` to the file location and type `sudo ./coedit...setup`. + * Linux, only you, in a console `cd` to the file location and type: `./coedit...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: double click, and confirm in the UAC dialog box. * 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...setup -u`. + * Linux: if coedit has been setup with `sudo` you must also uninstall with elevated privileges: `sudo ./coedit...setup -u`. * Windows: start a console as administrator and execute: `coedit..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].