mirror of https://gitlab.com/basile.b/dexed.git
replace comparisons against nil with assigned/is/not/Nil + style fixes
This commit is contained in:
parent
ce6874d05d
commit
ae740f0782
313
src/ce_main.pas
313
src/ce_main.pas
|
@ -857,8 +857,9 @@ begin
|
||||||
CEMainForm.fDscanUnittests := fDscanUnittests;
|
CEMainForm.fDscanUnittests := fDscanUnittests;
|
||||||
DcdWrapper.port:=fDcdPort;
|
DcdWrapper.port:=fDcdPort;
|
||||||
for i := 0 to CEMainForm.fWidgList.Count-1 do
|
for i := 0 to CEMainForm.fWidgList.Count-1 do
|
||||||
CEMainForm.fWidgList.widget[i].toolbarFlat:=fFlatLook;
|
CEMainForm.fWidgList.widget[i].toolbarFlat:=fFlatLook;
|
||||||
end else if target = fBackup then
|
end
|
||||||
|
else if target = fBackup then
|
||||||
begin
|
begin
|
||||||
fBackup.fMaxRecentDocs:= fMaxRecentDocs;
|
fBackup.fMaxRecentDocs:= fMaxRecentDocs;
|
||||||
fBackup.fMaxRecentProjs:= fMaxRecentProjs;
|
fBackup.fMaxRecentProjs:= fMaxRecentProjs;
|
||||||
|
@ -929,7 +930,7 @@ begin
|
||||||
if source = CEMainForm then
|
if source = CEMainForm then
|
||||||
begin
|
begin
|
||||||
itf := CEMainForm.fFreeProj;
|
itf := CEMainForm.fFreeProj;
|
||||||
if itf <> nil then
|
if assigned(itf) then
|
||||||
fProject := itf.filename;
|
fProject := itf.filename;
|
||||||
fProjectGroup := getProjectGroup.groupFilename;
|
fProjectGroup := getProjectGroup.groupFilename;
|
||||||
if itf = CEMainForm.fProject then
|
if itf = CEMainForm.fProject then
|
||||||
|
@ -953,7 +954,7 @@ begin
|
||||||
if dst.fProjFromCommandLine then
|
if dst.fProjFromCommandLine then
|
||||||
exit;
|
exit;
|
||||||
itf := dst.fProject;
|
itf := dst.fProject;
|
||||||
if (itf <> nil) and (itf.filename = fProject) and
|
if assigned(itf) and (itf.filename = fProject) and
|
||||||
(itf.filename.fileExists) then exit;
|
(itf.filename.fileExists) then exit;
|
||||||
if fProject.isNotEmpty and fProject.fileExists then
|
if fProject.isNotEmpty and fProject.fileExists then
|
||||||
begin
|
begin
|
||||||
|
@ -971,7 +972,7 @@ begin
|
||||||
begin
|
begin
|
||||||
getProjectGroup.openGroup(fProjectGroup);
|
getProjectGroup.openGroup(fProjectGroup);
|
||||||
end;
|
end;
|
||||||
if (fProjectIndex = -1) and (dst.fFreeProj <> nil) then
|
if (fProjectIndex = -1) and assigned(dst.fFreeProj) then
|
||||||
dst.fFreeProj.activate;
|
dst.fFreeProj.activate;
|
||||||
end else
|
end else
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -990,9 +991,9 @@ var
|
||||||
str: string;
|
str: string;
|
||||||
begin
|
begin
|
||||||
docHandler := getMultiDocHandler;
|
docHandler := getMultiDocHandler;
|
||||||
if docHandler = nil then
|
if not assigned(docHandler) then
|
||||||
exit;
|
exit;
|
||||||
//
|
|
||||||
for i:= 0 to docHandler.documentCount-1 do
|
for i:= 0 to docHandler.documentCount-1 do
|
||||||
begin
|
begin
|
||||||
document := docHandler.document[i];
|
document := docHandler.document[i];
|
||||||
|
@ -1014,9 +1015,9 @@ var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
docHandler := getMultiDocHandler;
|
docHandler := getMultiDocHandler;
|
||||||
if docHandler = nil then
|
if not assigned(docHandler) then
|
||||||
exit;
|
exit;
|
||||||
//
|
|
||||||
for i := 0 to fDocuments.Count-1 do
|
for i := 0 to fDocuments.Count-1 do
|
||||||
begin
|
begin
|
||||||
str := fDocuments[i];
|
str := fDocuments[i];
|
||||||
|
@ -1027,7 +1028,7 @@ begin
|
||||||
focusedName := str;
|
focusedName := str;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//
|
|
||||||
if focusedName.isNotEmpty then
|
if focusedName.isNotEmpty then
|
||||||
docHandler.openDocument(focusedName);
|
docHandler.openDocument(focusedName);
|
||||||
end;
|
end;
|
||||||
|
@ -1072,7 +1073,7 @@ end;
|
||||||
procedure TCEPersistentMainShortcuts.assignTo(target: TPersistent);
|
procedure TCEPersistentMainShortcuts.assignTo(target: TPersistent);
|
||||||
var
|
var
|
||||||
itm: TCEPersistentShortcut;
|
itm: TCEPersistentShortcut;
|
||||||
i, j: Integer;
|
i,j: Integer;
|
||||||
begin
|
begin
|
||||||
if target = CEMainForm then
|
if target = CEMainForm then
|
||||||
for i:= 0 to fCol.Count-1 do
|
for i:= 0 to fCol.Count-1 do
|
||||||
|
@ -1120,9 +1121,9 @@ begin
|
||||||
inherited create(aOwner);
|
inherited create(aOwner);
|
||||||
fMainMenuSubj := TCEMainMenuSubject.create;
|
fMainMenuSubj := TCEMainMenuSubject.create;
|
||||||
fActionHandler := TCEActionProviderSubject.create;
|
fActionHandler := TCEActionProviderSubject.create;
|
||||||
//
|
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
//
|
|
||||||
InitMRUs;
|
InitMRUs;
|
||||||
InitWidgets;
|
InitWidgets;
|
||||||
InitDocking;
|
InitDocking;
|
||||||
|
@ -1131,15 +1132,15 @@ begin
|
||||||
fMultidoc := getMultiDocHandler;
|
fMultidoc := getMultiDocHandler;
|
||||||
OnDragDrop:= @ddHandler.DragDrop;
|
OnDragDrop:= @ddHandler.DragDrop;
|
||||||
OnDragOver:= @ddHandler.DragOver;
|
OnDragOver:= @ddHandler.DragOver;
|
||||||
//
|
|
||||||
updateMainMenuProviders;
|
updateMainMenuProviders;
|
||||||
EntitiesConnector.forceUpdate;
|
EntitiesConnector.forceUpdate;
|
||||||
fSymStringExpander:= getSymStringExpander;
|
fSymStringExpander:= getSymStringExpander;
|
||||||
fProjectGroup := getProjectGroup;
|
fProjectGroup := getProjectGroup;
|
||||||
//
|
|
||||||
getCMdParams;
|
getCMdParams;
|
||||||
fAppliOpts.assignTo(self);
|
fAppliOpts.assignTo(self);
|
||||||
//
|
|
||||||
fInitialized := true;
|
fInitialized := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1306,7 +1307,8 @@ begin
|
||||||
for i := 0 to fWidgList.Count-1 do
|
for i := 0 to fWidgList.Count-1 do
|
||||||
begin
|
begin
|
||||||
widg := fWidgList.widget[i];
|
widg := fWidgList.widget[i];
|
||||||
if not widg.isDockable then continue;
|
if not widg.isDockable then
|
||||||
|
continue;
|
||||||
for anchl in [low(anchl) .. high(anchl)] do
|
for anchl in [low(anchl) .. high(anchl)] do
|
||||||
if GetDockSplitterOrParent(DockMaster.GetSite(widg), anchl, site) then
|
if GetDockSplitterOrParent(DockMaster.GetSite(widg), anchl, site) then
|
||||||
begin
|
begin
|
||||||
|
@ -1314,7 +1316,8 @@ begin
|
||||||
begin
|
begin
|
||||||
if TAnchorDockHostSite(site).BoundSplitter.isNotNil then
|
if TAnchorDockHostSite(site).BoundSplitter.isNotNil then
|
||||||
TAnchorDockSplitterEx(TAnchorDockHostSite(site).BoundSplitter).OnMouseWheel:=@DockSplitterMw;
|
TAnchorDockSplitterEx(TAnchorDockHostSite(site).BoundSplitter).OnMouseWheel:=@DockSplitterMw;
|
||||||
end else if site is TAnchorDockSplitter then
|
end
|
||||||
|
else if site is TAnchorDockSplitter then
|
||||||
TAnchorDockSplitterEx(TAnchorDockSplitter(site)).OnMouseWheel:=@DockSplitterMw;
|
TAnchorDockSplitterEx(TAnchorDockSplitter(site)).OnMouseWheel:=@DockSplitterMw;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -1339,7 +1342,8 @@ begin
|
||||||
DockMaster.HideHeaderCaptionFloatingControl := true;
|
DockMaster.HideHeaderCaptionFloatingControl := true;
|
||||||
|
|
||||||
// this is a fix (?) copied from Laz.
|
// this is a fix (?) copied from Laz.
|
||||||
if DockManager is TAnchorDockManager then begin
|
if DockManager is TAnchorDockManager then
|
||||||
|
begin
|
||||||
aManager:=TAnchorDockManager(DockManager);
|
aManager:=TAnchorDockManager(DockManager);
|
||||||
aManager.PreferredSiteSizeAsSiteMinimum:=false;
|
aManager.PreferredSiteSizeAsSiteMinimum:=false;
|
||||||
end;
|
end;
|
||||||
|
@ -1355,8 +1359,10 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// load existing or default docking
|
// load existing or default docking
|
||||||
if FileExists(getCoeditDocPath + 'docking.xml') then LoadDocking
|
if FileExists(getCoeditDocPath + 'docking.xml') then
|
||||||
else begin
|
LoadDocking
|
||||||
|
else
|
||||||
|
begin
|
||||||
Height := 0;
|
Height := 0;
|
||||||
// center
|
// center
|
||||||
DockMaster.ManualDock(DockMaster.GetAnchorSite(fEditWidg), DockMaster.GetSite(Self), alBottom);
|
DockMaster.ManualDock(DockMaster.GetAnchorSite(fEditWidg), DockMaster.GetSite(Self), alBottom);
|
||||||
|
@ -1393,7 +1399,8 @@ begin
|
||||||
for i := 0 to fWidgList.Count-1 do
|
for i := 0 to fWidgList.Count-1 do
|
||||||
begin
|
begin
|
||||||
widg := fWidgList.widget[i];
|
widg := fWidgList.widget[i];
|
||||||
if not widg.isDockable then continue;
|
if not widg.isDockable then
|
||||||
|
continue;
|
||||||
DockMaster.GetAnchorSite(widg).Header.HeaderPosition := adlhpTop;
|
DockMaster.GetAnchorSite(widg).Header.HeaderPosition := adlhpTop;
|
||||||
if not DockMaster.GetAnchorSite(widg).HasParent then
|
if not DockMaster.GetAnchorSite(widg).HasParent then
|
||||||
DockMaster.GetAnchorSite(widg).Close;
|
DockMaster.GetAnchorSite(widg).Close;
|
||||||
|
@ -1485,11 +1492,11 @@ end;
|
||||||
procedure TCEMainForm.SaveDocking;
|
procedure TCEMainForm.SaveDocking;
|
||||||
var
|
var
|
||||||
xcfg: TXMLConfigStorage;
|
xcfg: TXMLConfigStorage;
|
||||||
i: NativeInt;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if not fInitialized then exit;
|
if not fInitialized or not Visible then
|
||||||
if not Visible then exit;
|
exit;
|
||||||
//
|
|
||||||
DockMaster.RestoreLayouts.Clear;
|
DockMaster.RestoreLayouts.Clear;
|
||||||
if WindowState = wsMinimized then WindowState := wsNormal;
|
if WindowState = wsMinimized then WindowState := wsNormal;
|
||||||
// does not save minimized/undocked windows to prevent bugs
|
// does not save minimized/undocked windows to prevent bugs
|
||||||
|
@ -1501,7 +1508,7 @@ begin
|
||||||
else if not DockMaster.GetAnchorSite(fWidgList.widget[i]).HasParent then
|
else if not DockMaster.GetAnchorSite(fWidgList.widget[i]).HasParent then
|
||||||
DockMaster.GetAnchorSite(fWidgList.widget[i]).Close;
|
DockMaster.GetAnchorSite(fWidgList.widget[i]).Close;
|
||||||
end;
|
end;
|
||||||
//
|
|
||||||
forceDirectory(getCoeditDocPath);
|
forceDirectory(getCoeditDocPath);
|
||||||
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'docking.xml.tmp', false);
|
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'docking.xml.tmp', false);
|
||||||
try
|
try
|
||||||
|
@ -1521,7 +1528,7 @@ begin
|
||||||
finally
|
finally
|
||||||
xcfg.Free;
|
xcfg.Free;
|
||||||
end;
|
end;
|
||||||
//
|
|
||||||
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'dockingopts.xml',false);
|
xcfg := TXMLConfigStorage.Create(getCoeditDocPath + 'dockingopts.xml',false);
|
||||||
try
|
try
|
||||||
DockMaster.SaveSettingsToConfig(xcfg);
|
DockMaster.SaveSettingsToConfig(xcfg);
|
||||||
|
@ -1584,7 +1591,7 @@ var
|
||||||
begin
|
begin
|
||||||
if fRunProc.isNil then
|
if fRunProc.isNil then
|
||||||
exit;
|
exit;
|
||||||
//
|
|
||||||
fname := fRunProc.Executable;
|
fname := fRunProc.Executable;
|
||||||
if getprocInputHandler.process = fRunProc then
|
if getprocInputHandler.process = fRunProc then
|
||||||
begin
|
begin
|
||||||
|
@ -1711,7 +1718,7 @@ begin
|
||||||
// see: http://forum.lazarus.freepascal.org/index.php/topic,30616.0.htm
|
// see: http://forum.lazarus.freepascal.org/index.php/topic,30616.0.htm
|
||||||
if fAppliOpts.reloadLastDocuments then
|
if fAppliOpts.reloadLastDocuments then
|
||||||
LoadLastDocsAndProj;
|
LoadLastDocsAndProj;
|
||||||
if fProject = nil then
|
if not assigned(fProject) then
|
||||||
newDubProj;
|
newDubProj;
|
||||||
|
|
||||||
DockMaster.ResetSplitters;
|
DockMaster.ResetSplitters;
|
||||||
|
@ -1780,7 +1787,7 @@ var
|
||||||
begin
|
begin
|
||||||
canClose := false;
|
canClose := false;
|
||||||
SaveLastDocsAndProj;
|
SaveLastDocsAndProj;
|
||||||
if (fFreeProj <> nil) then
|
if assigned(fFreeProj) then
|
||||||
begin
|
begin
|
||||||
if fFreeProj.modified and
|
if fFreeProj.modified and
|
||||||
(dlgFileChangeClose(fFreeProj.filename, UnsavedProj) = mrCancel) then
|
(dlgFileChangeClose(fFreeProj.filename, UnsavedProj) = mrCancel) then
|
||||||
|
@ -1789,9 +1796,11 @@ begin
|
||||||
fFreeProj := nil;
|
fFreeProj := nil;
|
||||||
end;
|
end;
|
||||||
for i := fMultidoc.documentCount-1 downto 0 do
|
for i := fMultidoc.documentCount-1 downto 0 do
|
||||||
if not fMultidoc.closeDocument(i) then exit;
|
if not fMultidoc.closeDocument(i) then
|
||||||
if fProjectGroup.groupModified then if
|
exit;
|
||||||
(dlgFileChangeClose(fProjectGroup.groupFilename, UnsavedPGrp) = mrCancel) then exit;
|
if fProjectGroup.groupModified and
|
||||||
|
(dlgFileChangeClose(fProjectGroup.groupFilename, UnsavedPGrp) = mrCancel) then
|
||||||
|
exit;
|
||||||
canClose := true;
|
canClose := true;
|
||||||
fProjectGroup.closeGroup;
|
fProjectGroup.closeGroup;
|
||||||
end;
|
end;
|
||||||
|
@ -1803,7 +1812,7 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.updateProjectBasedAction(sender: TObject);
|
procedure TCEMainForm.updateProjectBasedAction(sender: TObject);
|
||||||
begin
|
begin
|
||||||
TAction(sender).Enabled := (fProject <> nil) {and not fProjActionsLock};
|
TAction(sender).Enabled := assigned(fProject) {and not fProjActionsLock};
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.updateDocEditBasedAction(sender: TObject);
|
procedure TCEMainForm.updateDocEditBasedAction(sender: TObject);
|
||||||
|
@ -1817,14 +1826,14 @@ end;
|
||||||
procedure TCEMainForm.ActionsUpdate(AAction: TBasicAction; var Handled: Boolean);
|
procedure TCEMainForm.ActionsUpdate(AAction: TBasicAction; var Handled: Boolean);
|
||||||
begin
|
begin
|
||||||
Handled := false;
|
Handled := false;
|
||||||
if fUpdateCount > 0 then exit;
|
if fUpdateCount > 0 then
|
||||||
|
exit;
|
||||||
Inc(fUpdateCount);
|
Inc(fUpdateCount);
|
||||||
try
|
try
|
||||||
clearActProviderEntries;
|
clearActProviderEntries;
|
||||||
collectedActProviderEntries;
|
collectedActProviderEntries;
|
||||||
if AAction.isNotNil then
|
if AAction.isNotNil and not AAction.Update then
|
||||||
if not AAction.Update then
|
TAction(AAction).enabled := true;
|
||||||
TAction(AAction).enabled := true;
|
|
||||||
updateMainMenuProviders;
|
updateMainMenuProviders;
|
||||||
finally
|
finally
|
||||||
Dec(fUpdateCount);
|
Dec(fUpdateCount);
|
||||||
|
@ -1837,7 +1846,8 @@ var
|
||||||
itm: TMenuItem;
|
itm: TMenuItem;
|
||||||
doneUpdate: boolean = false;
|
doneUpdate: boolean = false;
|
||||||
begin
|
begin
|
||||||
if mainMenu.Images = nil then exit;
|
if not assigned(mainMenu.Images) then
|
||||||
|
exit;
|
||||||
for j := 0 to fMainMenuSubj.observersCount-1 do
|
for j := 0 to fMainMenuSubj.observersCount-1 do
|
||||||
begin
|
begin
|
||||||
// try to update existing entry.
|
// try to update existing entry.
|
||||||
|
@ -1871,9 +1881,11 @@ var
|
||||||
clickTrg: TNotifyEvent;
|
clickTrg: TNotifyEvent;
|
||||||
begin
|
begin
|
||||||
srcLst := TCEMruFileList(Sender);
|
srcLst := TCEMruFileList(Sender);
|
||||||
if srcLst.isNil then exit;
|
if srcLst.isNil then
|
||||||
|
exit;
|
||||||
trgMnu := TMenuItem(srcLst.objectTag);
|
trgMnu := TMenuItem(srcLst.objectTag);
|
||||||
if trgMnu.isNil then exit;
|
if trgMnu.isNil then
|
||||||
|
exit;
|
||||||
|
|
||||||
if fUpdateCount > 0 then exit;
|
if fUpdateCount > 0 then exit;
|
||||||
Inc(fUpdateCount);
|
Inc(fUpdateCount);
|
||||||
|
@ -1913,9 +1925,8 @@ var
|
||||||
srcLst: TCEMruFileList;
|
srcLst: TCEMruFileList;
|
||||||
begin
|
begin
|
||||||
srcLst := TCEMruFileList(TmenuItem(Sender).Tag);
|
srcLst := TCEMruFileList(TmenuItem(Sender).Tag);
|
||||||
if srcLst.isNil then exit;
|
if srcLst.isNotNil then
|
||||||
//
|
srcLst.Clear;
|
||||||
srcLst.Clear;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
@ -1928,7 +1939,8 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.docClosing(document: TCESynMemo);
|
procedure TCEMainForm.docClosing(document: TCESynMemo);
|
||||||
begin
|
begin
|
||||||
if document <> fDoc then exit;
|
if document <> fDoc then
|
||||||
|
exit;
|
||||||
fDoc := nil;
|
fDoc := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2057,7 +2069,6 @@ begin
|
||||||
category := act.Category;
|
category := act.Category;
|
||||||
identifier := act.Caption;
|
identifier := act.Caption;
|
||||||
aShortcut := act.ShortCut;
|
aShortcut := act.ShortCut;
|
||||||
//
|
|
||||||
fScCollectCount += 1;
|
fScCollectCount += 1;
|
||||||
result := fScCollectCount < actions.ActionCount;
|
result := fScCollectCount < actions.ActionCount;
|
||||||
end;
|
end;
|
||||||
|
@ -2070,11 +2081,8 @@ begin
|
||||||
for i:= 0 to Actions.ActionCount-1 do
|
for i:= 0 to Actions.ActionCount-1 do
|
||||||
begin
|
begin
|
||||||
act := TCustomAction(Actions.Actions[i]);
|
act := TCustomAction(Actions.Actions[i]);
|
||||||
if act.Category <> category then
|
if (act.Category = category) and (act.Caption = identifier) then
|
||||||
continue;
|
act.ShortCut := aShortcut;
|
||||||
if act.Caption <> identifier then
|
|
||||||
continue;
|
|
||||||
act.ShortCut := aShortcut;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2095,16 +2103,11 @@ begin
|
||||||
prov := fActionHandler[i] as ICEActionProvider;
|
prov := fActionHandler[i] as ICEActionProvider;
|
||||||
if not prov.actHandlerWantRecollect then
|
if not prov.actHandlerWantRecollect then
|
||||||
continue;
|
continue;
|
||||||
//
|
|
||||||
for j := Actions.ActionCount-1 downto 0 do
|
for j := Actions.ActionCount-1 downto 0 do
|
||||||
begin
|
begin
|
||||||
act := Actions.Actions[j];
|
act := Actions.Actions[j];
|
||||||
if act.Owner = Self then
|
if (act.Owner <> Self) and (act.Tag = PtrInt(prov)) then
|
||||||
continue;
|
act.ActionList := nil;
|
||||||
if act.Tag <> PtrInt(prov) then
|
|
||||||
continue;
|
|
||||||
//
|
|
||||||
act.ActionList := nil;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -2120,7 +2123,7 @@ var
|
||||||
act.ActionList := Actions;
|
act.ActionList := Actions;
|
||||||
act.Tag := ptrInt(prov);
|
act.Tag := ptrInt(prov);
|
||||||
act.Category := cat;
|
act.Category := cat;
|
||||||
//
|
|
||||||
act := nil;
|
act := nil;
|
||||||
cat := '';
|
cat := '';
|
||||||
end;
|
end;
|
||||||
|
@ -2130,7 +2133,7 @@ begin
|
||||||
prov := fActionHandler[i] as ICEActionProvider;
|
prov := fActionHandler[i] as ICEActionProvider;
|
||||||
if not prov.actHandlerWantFirst then
|
if not prov.actHandlerWantFirst then
|
||||||
continue;
|
continue;
|
||||||
//
|
|
||||||
act := nil;
|
act := nil;
|
||||||
cat := '';
|
cat := '';
|
||||||
while prov.actHandlerWantNext(cat, act) do
|
while prov.actHandlerWantNext(cat, act) do
|
||||||
|
@ -2151,7 +2154,8 @@ begin
|
||||||
try
|
try
|
||||||
with TOpenDialog.Create(nil) do
|
with TOpenDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
if Execute then begin
|
if Execute then
|
||||||
|
begin
|
||||||
exp.Highlighter := fDoc.Highlighter;
|
exp.Highlighter := fDoc.Highlighter;
|
||||||
exp.Title := fDoc.fileName;
|
exp.Title := fDoc.fileName;
|
||||||
exp.ExportAsText:=true;
|
exp.ExportAsText:=true;
|
||||||
|
@ -2195,7 +2199,7 @@ var
|
||||||
begin
|
begin
|
||||||
with TOpenDialog.Create(nil) do
|
with TOpenDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
if fDoc.isNotNil and not fDoc.isTemporary then
|
if fDoc.isNotNil and not fDoc.isTemporary and fDoc.fileName.fileExists then
|
||||||
initialDir := fDoc.fileName.extractFileDir;
|
initialDir := fDoc.fileName.extractFileDir;
|
||||||
options := options + [ofAllowMultiSelect];
|
options := options + [ofAllowMultiSelect];
|
||||||
filter := DdiagFilter;
|
filter := DdiagFilter;
|
||||||
|
@ -2209,9 +2213,8 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjOpenContFoldExecute(Sender: TObject);
|
procedure TCEMainForm.actProjOpenContFoldExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fProject = nil then exit;
|
if not assigned(fProject) or not fProject.filename.fileExists then
|
||||||
if not fProject.filename.fileExists then exit;
|
exit;
|
||||||
//
|
|
||||||
DockMaster.GetAnchorSite(fExplWidg).Show;
|
DockMaster.GetAnchorSite(fExplWidg).Show;
|
||||||
getExplorer.browse(fProject.filename.extractFilePath);
|
getExplorer.browse(fProject.filename.extractFilePath);
|
||||||
end;
|
end;
|
||||||
|
@ -2247,11 +2250,13 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actFileSaveAsExecute(Sender: TObject);
|
procedure TCEMainForm.actFileSaveAsExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fDoc.isNil then exit;
|
if fDoc.isNil then
|
||||||
//
|
exit;
|
||||||
with TSaveDialog.Create(nil) do
|
with TSaveDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
Filter := DdiagFilter;
|
Filter := DdiagFilter;
|
||||||
|
if not fDoc.isTemporary and fDoc.fileName.fileExists then
|
||||||
|
InitialDir := fDoc.fileName.extractFileDir;
|
||||||
if execute then
|
if execute then
|
||||||
fDoc.saveToFile(filename);
|
fDoc.saveToFile(filename);
|
||||||
finally
|
finally
|
||||||
|
@ -2263,8 +2268,9 @@ procedure TCEMainForm.actFileSaveExecute(Sender: TObject);
|
||||||
var
|
var
|
||||||
str: string;
|
str: string;
|
||||||
begin
|
begin
|
||||||
if fDoc.isNil then exit;
|
if fDoc.isNil then
|
||||||
//
|
exit;
|
||||||
|
|
||||||
str := fDoc.fileName;
|
str := fDoc.fileName;
|
||||||
if (str <> fDoc.tempFilename) and str.fileExists then
|
if (str <> fDoc.tempFilename) and str.fileExists then
|
||||||
saveFile(fDoc)
|
saveFile(fDoc)
|
||||||
|
@ -2274,10 +2280,11 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actFileAddToProjExecute(Sender: TObject);
|
procedure TCEMainForm.actFileAddToProjExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fDoc.isNil then exit;
|
if fDoc.isNil or not assigned(fProject) then
|
||||||
if fProject = nil then exit;
|
exit;
|
||||||
if fProject.filename = fDoc.fileName then exit;
|
if fProject.filename = fDoc.fileName then
|
||||||
//
|
exit;
|
||||||
|
|
||||||
if fProject.getFormat = pfCE then
|
if fProject.getFormat = pfCE then
|
||||||
begin
|
begin
|
||||||
if fDoc.fileName.fileExists and not fDoc.isTemporary then
|
if fDoc.fileName.fileExists and not fDoc.isTemporary then
|
||||||
|
@ -2328,7 +2335,9 @@ begin
|
||||||
with TSaveDialog.create(nil) do
|
with TSaveDialog.create(nil) do
|
||||||
try
|
try
|
||||||
if fDoc.isDSource then
|
if fDoc.isDSource then
|
||||||
Filter:= DdiagFilter;
|
Filter := DdiagFilter;
|
||||||
|
if fDoc.fileName.fileExists and not fDoc.isTemporary then
|
||||||
|
InitialDir := fDoc.fileName.extractFileDir;
|
||||||
if execute then
|
if execute then
|
||||||
begin
|
begin
|
||||||
str := TStringList.create;
|
str := TStringList.create;
|
||||||
|
@ -2470,7 +2479,6 @@ begin
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
proc.getFullLines(lst);
|
proc.getFullLines(lst);
|
||||||
//processOutputToStrings(proc, lst);
|
|
||||||
if proc = fRunProc then for str in lst do
|
if proc = fRunProc then for str in lst do
|
||||||
fMsgs.message(str, fDoc, amcEdit, amkBub)
|
fMsgs.message(str, fDoc, amcEdit, amkBub)
|
||||||
else // dmd used to compile runnable
|
else // dmd used to compile runnable
|
||||||
|
@ -2489,7 +2497,7 @@ begin
|
||||||
proc := TCEProcess(sender);
|
proc := TCEProcess(sender);
|
||||||
asyncprocOutput(sender);
|
asyncprocOutput(sender);
|
||||||
inph := EntitiesConnector.getSingleService('ICEProcInputHandler');
|
inph := EntitiesConnector.getSingleService('ICEProcInputHandler');
|
||||||
if (inph <> nil) then
|
if inph.isNotNil then
|
||||||
(inph as ICEProcInputHandler).removeProcess(proc);
|
(inph as ICEProcInputHandler).removeProcess(proc);
|
||||||
if (proc.ExitStatus <> 0) then
|
if (proc.ExitStatus <> 0) then
|
||||||
fMsgs.message(format('error: the process (%s) has returned the signal %d',
|
fMsgs.message(format('error: the process (%s) has returned the signal %d',
|
||||||
|
@ -2511,10 +2519,10 @@ begin
|
||||||
memo.Lines.Assign(fRunnablesOptions.staticSwitches);
|
memo.Lines.Assign(fRunnablesOptions.staticSwitches);
|
||||||
memo.Parent := form;
|
memo.Parent := form;
|
||||||
form.ShowModal;
|
form.ShowModal;
|
||||||
//
|
|
||||||
fRunnablesOptions.staticSwitches.Assign(memo.Lines);
|
fRunnablesOptions.staticSwitches.Assign(memo.Lines);
|
||||||
fRunnablesOptions.sanitizeSwitches;
|
fRunnablesOptions.sanitizeSwitches;
|
||||||
//
|
|
||||||
form.Free;
|
form.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -2533,8 +2541,8 @@ begin
|
||||||
result := false;
|
result := false;
|
||||||
fMsgs.clearByData(fDoc);
|
fMsgs.clearByData(fDoc);
|
||||||
FreeRunnableProc;
|
FreeRunnableProc;
|
||||||
if fDoc.isNil then exit;
|
if fDoc.isNil or (fDoc.Lines.Count = 0) then
|
||||||
if fDoc.Lines.Count = 0 then exit;
|
exit;
|
||||||
|
|
||||||
firstlineFlags := fDoc.Lines[0];
|
firstlineFlags := fDoc.Lines[0];
|
||||||
rng.init(firstLineFlags);
|
rng.init(firstLineFlags);
|
||||||
|
@ -2663,9 +2671,11 @@ var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
fname: string;
|
fname: string;
|
||||||
begin
|
begin
|
||||||
if fDoc.isNil then exit;
|
if fDoc.isNil then
|
||||||
|
exit;
|
||||||
fname := runnableExename;
|
fname := runnableExename;
|
||||||
if not fname.fileExists then exit;
|
if not fname.fileExists then
|
||||||
|
exit;
|
||||||
|
|
||||||
fRunProc := TCEProcess.Create(nil);
|
fRunProc := TCEProcess.Create(nil);
|
||||||
if redirect then
|
if redirect then
|
||||||
|
@ -2843,7 +2853,7 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.dubFile(outside: boolean);
|
procedure TCEMainForm.dubFile(outside: boolean);
|
||||||
begin
|
begin
|
||||||
if fDoc = nil then
|
if fDoc.isNil then
|
||||||
exit;
|
exit;
|
||||||
FreeRunnableProc;
|
FreeRunnableProc;
|
||||||
fRunProc := TCEProcess.Create(nil);
|
fRunProc := TCEProcess.Create(nil);
|
||||||
|
@ -2915,9 +2925,8 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actFileOpenContFoldExecute(Sender: TObject);
|
procedure TCEMainForm.actFileOpenContFoldExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fDoc.isNil then exit;
|
if fDoc.isNil or not fDoc.fileName.fileExists then
|
||||||
if not fDoc.fileName.fileExists then exit;
|
exit;
|
||||||
//
|
|
||||||
DockMaster.GetAnchorSite(fExplWidg).Show;
|
DockMaster.GetAnchorSite(fExplWidg).Show;
|
||||||
getExplorer.browse(fDoc.fileName.extractFilePath);
|
getExplorer.browse(fDoc.fileName.extractFilePath);
|
||||||
end;
|
end;
|
||||||
|
@ -2955,21 +2964,21 @@ end;
|
||||||
procedure TCEMainForm.actProjRunExecute(Sender: TObject);
|
procedure TCEMainForm.actProjRunExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fProject.binaryKind <> executable then
|
if fProject.binaryKind <> executable then
|
||||||
|
dlgOkInfo('Non executable projects cant be run')
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
dlgOkInfo('Non executable projects cant be run');
|
if (not fProject.targetUpToDate) then if
|
||||||
exit;
|
dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes then
|
||||||
|
begin
|
||||||
|
if fAppliOpts.autoSaveProjectFiles then
|
||||||
|
saveModifiedProjectFiles(fProject);
|
||||||
|
if fAppliOpts.showBuildDuration then
|
||||||
|
fCompStart := Time;
|
||||||
|
fProject.compile;
|
||||||
|
end;
|
||||||
|
if fProject.outputFilename.fileExists or (fProject.getFormat = pfDUB) then
|
||||||
|
fProject.run;
|
||||||
end;
|
end;
|
||||||
if (not fProject.targetUpToDate) then if
|
|
||||||
dlgYesNo('The project output is not up-to-date, rebuild ?') = mrYes then
|
|
||||||
begin
|
|
||||||
if fAppliOpts.autoSaveProjectFiles then
|
|
||||||
saveModifiedProjectFiles(fProject);
|
|
||||||
if fAppliOpts.showBuildDuration then
|
|
||||||
fCompStart := Time;
|
|
||||||
fProject.compile;
|
|
||||||
end;
|
|
||||||
if fProject.outputFilename.fileExists or (fProject.getFormat = pfDUB) then
|
|
||||||
fProject.run;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjRunWithArgsExecute(Sender: TObject);
|
procedure TCEMainForm.actProjRunWithArgsExecute(Sender: TObject);
|
||||||
|
@ -2987,10 +2996,12 @@ var
|
||||||
widg: TCEWidget;
|
widg: TCEWidget;
|
||||||
act: TAction;
|
act: TAction;
|
||||||
begin
|
begin
|
||||||
if sender.isNil then exit;
|
if sender.isNil then
|
||||||
|
exit;
|
||||||
act := TAction(sender);
|
act := TAction(sender);
|
||||||
if act.Tag = 0 then exit;
|
if act.Tag = 0 then
|
||||||
//
|
exit;
|
||||||
|
|
||||||
widg := TCEWidget(act.Tag);
|
widg := TCEWidget(act.Tag);
|
||||||
if widg.isDockable then
|
if widg.isDockable then
|
||||||
begin
|
begin
|
||||||
|
@ -3007,9 +3018,8 @@ var
|
||||||
widg: TCEWidget;
|
widg: TCEWidget;
|
||||||
begin
|
begin
|
||||||
widg := TCEWidget( TComponent(sender).tag );
|
widg := TCEWidget( TComponent(sender).tag );
|
||||||
if widg.isNil then exit;
|
if widg.isNotNil then
|
||||||
//
|
widg.showWidget;
|
||||||
widg.showWidget;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.layoutLoadFromFile(const fname: string);
|
procedure TCEMainForm.layoutLoadFromFile(const fname: string);
|
||||||
|
@ -3018,7 +3028,6 @@ var
|
||||||
begin
|
begin
|
||||||
if not fname.fileExists then
|
if not fname.fileExists then
|
||||||
exit;
|
exit;
|
||||||
//
|
|
||||||
xcfg := TXMLConfigStorage.Create(fname, true);
|
xcfg := TXMLConfigStorage.Create(fname, true);
|
||||||
try
|
try
|
||||||
DockMaster.RestoreLayouts.Clear;
|
DockMaster.RestoreLayouts.Clear;
|
||||||
|
@ -3031,7 +3040,7 @@ end;
|
||||||
procedure TCEMainForm.layoutSaveToFile(const fname: string);
|
procedure TCEMainForm.layoutSaveToFile(const fname: string);
|
||||||
var
|
var
|
||||||
xcfg: TXMLConfigStorage;
|
xcfg: TXMLConfigStorage;
|
||||||
i: NativeInt;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
DockMaster.RestoreLayouts.Clear;
|
DockMaster.RestoreLayouts.Clear;
|
||||||
for i:= 0 to fWidgList.Count-1 do
|
for i:= 0 to fWidgList.Count-1 do
|
||||||
|
@ -3071,15 +3080,13 @@ procedure TCEMainForm.layoutUpdateMenu;
|
||||||
var
|
var
|
||||||
lst: TStringList;
|
lst: TStringList;
|
||||||
itm: TMenuItem;
|
itm: TMenuItem;
|
||||||
i: NativeInt;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
mnuLayout.Clear;
|
|
||||||
//
|
|
||||||
itm := TMenuItem.Create(self);
|
itm := TMenuItem.Create(self);
|
||||||
itm.Action := actLayoutSave;
|
itm.Action := actLayoutSave;
|
||||||
mnuLayout.Add(itm);
|
mnuLayout.Add(itm);
|
||||||
mnuLayout.AddSeparator;
|
mnuLayout.AddSeparator;
|
||||||
//
|
|
||||||
lst := TStringList.Create;
|
lst := TStringList.Create;
|
||||||
try
|
try
|
||||||
listFiles(lst, getCoeditDocPath + 'layouts' + DirectorySeparator);
|
listFiles(lst, getCoeditDocPath + 'layouts' + DirectorySeparator);
|
||||||
|
@ -3109,10 +3116,11 @@ var
|
||||||
begin
|
begin
|
||||||
if not InputQuery('New layout name', '', fname) then
|
if not InputQuery('New layout name', '', fname) then
|
||||||
exit;
|
exit;
|
||||||
//
|
|
||||||
fname := fname.extractFileName;
|
fname := fname.extractFileName;
|
||||||
if fname.extractFileExt <> '.xml' then
|
if fname.extractFileExt <> '.xml' then
|
||||||
fname += '.xml';
|
fname += '.xml';
|
||||||
|
|
||||||
layoutSaveToFile(getCoeditDocPath + 'layouts' + DirectorySeparator + fname);
|
layoutSaveToFile(getCoeditDocPath + 'layouts' + DirectorySeparator + fname);
|
||||||
layoutUpdateMenu;
|
layoutUpdateMenu;
|
||||||
end;
|
end;
|
||||||
|
@ -3150,7 +3158,7 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.showProjTitle;
|
procedure TCEMainForm.showProjTitle;
|
||||||
begin
|
begin
|
||||||
if (fProject <> nil) and fProject.filename.fileExists then
|
if assigned(fProject) and fProject.filename.fileExists then
|
||||||
caption := format('Coedit - %s', [shortenPath(fProject.filename, 30)])
|
caption := format('Coedit - %s', [shortenPath(fProject.filename, 30)])
|
||||||
else
|
else
|
||||||
caption := 'Coedit';
|
caption := 'Coedit';
|
||||||
|
@ -3160,10 +3168,10 @@ procedure TCEMainForm.saveProjSource(const document: TCESynMemo);
|
||||||
var
|
var
|
||||||
fname: string;
|
fname: string;
|
||||||
begin
|
begin
|
||||||
if fProject = nil then exit;
|
if not assigned(fProject) or checkProjectLock or
|
||||||
if fProject.filename <> document.fileName then exit;
|
(fProject.filename <> document.fileName) then
|
||||||
if checkProjectLock then exit;
|
exit;
|
||||||
//
|
|
||||||
fname := fProject.filename;
|
fname := fProject.filename;
|
||||||
document.saveToFile(fname);
|
document.saveToFile(fname);
|
||||||
fProject.reload;
|
fProject.reload;
|
||||||
|
@ -3171,13 +3179,14 @@ end;
|
||||||
|
|
||||||
function TCEMainForm.closeProj: boolean;
|
function TCEMainForm.closeProj: boolean;
|
||||||
begin
|
begin
|
||||||
result := true;
|
if not assigned(fProject) then
|
||||||
if fProject = nil then exit;
|
exit(true);
|
||||||
|
|
||||||
result := false;
|
result := false;
|
||||||
//
|
|
||||||
if fProject = fFreeProj then
|
if fProject = fFreeProj then
|
||||||
begin
|
begin
|
||||||
if checkProjectLock then exit;
|
if checkProjectLock then
|
||||||
|
exit;
|
||||||
fProject.getProject.Free;
|
fProject.getProject.Free;
|
||||||
fFreeProj := nil;
|
fFreeProj := nil;
|
||||||
end;
|
end;
|
||||||
|
@ -3190,9 +3199,9 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjNewDubJsonExecute(Sender: TObject);
|
procedure TCEMainForm.actProjNewDubJsonExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (fProject <> nil) and not fProject.inGroup
|
if assigned(fProject) and not fProject.inGroup and fProject.modified and
|
||||||
and fProject.modified and
|
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then
|
||||||
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then exit;
|
exit;
|
||||||
if not closeProj then
|
if not closeProj then
|
||||||
exit;
|
exit;
|
||||||
newDubProj;
|
newDubProj;
|
||||||
|
@ -3200,9 +3209,9 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjNewNativeExecute(Sender: TObject);
|
procedure TCEMainForm.actProjNewNativeExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (fProject <> nil) and not fProject.inGroup
|
if assigned(fProject) and not fProject.inGroup and fProject.modified and
|
||||||
and fProject.modified and
|
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then
|
||||||
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then exit;
|
exit;
|
||||||
if not closeProj then
|
if not closeProj then
|
||||||
exit;
|
exit;
|
||||||
newNativeProj;
|
newNativeProj;
|
||||||
|
@ -3245,7 +3254,7 @@ begin
|
||||||
newDubProj
|
newDubProj
|
||||||
else
|
else
|
||||||
newNativeProj;
|
newNativeProj;
|
||||||
//
|
|
||||||
fProject.loadFromFile(fname);
|
fProject.loadFromFile(fname);
|
||||||
showProjTitle;
|
showProjTitle;
|
||||||
end;
|
end;
|
||||||
|
@ -3254,7 +3263,7 @@ procedure TCEMainForm.mruProjItemClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if checkProjectLock then
|
if checkProjectLock then
|
||||||
exit;
|
exit;
|
||||||
if (fProject <> nil) and not fProject.inGroup and fProject.modified and
|
if assigned(fProject) and not fProject.inGroup and fProject.modified and
|
||||||
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then
|
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then
|
||||||
exit;
|
exit;
|
||||||
openProj(TMenuItem(Sender).Hint);
|
openProj(TMenuItem(Sender).Hint);
|
||||||
|
@ -3273,8 +3282,9 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjCloseExecute(Sender: TObject);
|
procedure TCEMainForm.actProjCloseExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if (fProject <> nil) and not fProject.inGroup and fProject.modified and
|
if assigned(fProject) and not fProject.inGroup and fProject.modified and
|
||||||
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then exit;
|
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then
|
||||||
|
exit;
|
||||||
closeProj;
|
closeProj;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -3289,7 +3299,10 @@ begin
|
||||||
end;
|
end;
|
||||||
with TSaveDialog.Create(nil) do
|
with TSaveDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
if execute then saveProjAs(filename);
|
if fProject.filename.fileExists then
|
||||||
|
InitialDir := fproject.filename.extractFileDir;
|
||||||
|
if execute then
|
||||||
|
saveProjAs(filename);
|
||||||
finally
|
finally
|
||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
|
@ -3297,7 +3310,8 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjSaveExecute(Sender: TObject);
|
procedure TCEMainForm.actProjSaveExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fProject = nil then exit;
|
if not assigned(fProject) then
|
||||||
|
exit;
|
||||||
if (fProject.getFormat = pfDUB) and TCEDubProject(fProject.getProject).isSDL then
|
if (fProject.getFormat = pfDUB) and TCEDubProject(fProject.getProject).isSDL then
|
||||||
begin
|
begin
|
||||||
fMsgs.message(DubSdlWarning, fProject, amcProj, amkWarn);
|
fMsgs.message(DubSdlWarning, fProject, amcProj, amkWarn);
|
||||||
|
@ -3305,15 +3319,17 @@ begin
|
||||||
end;
|
end;
|
||||||
if checkProjectLock then
|
if checkProjectLock then
|
||||||
exit;
|
exit;
|
||||||
if fProject.filename.isNotEmpty then saveProj
|
if fProject.filename.isNotEmpty then
|
||||||
else actProjSaveAs.Execute;
|
saveProj
|
||||||
|
else
|
||||||
|
actProjSaveAs.Execute;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjOpenExecute(Sender: TObject);
|
procedure TCEMainForm.actProjOpenExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if checkProjectLock then
|
if checkProjectLock then
|
||||||
exit;
|
exit;
|
||||||
if (fProject <> nil) and fProject.modified and
|
if assigned(fProject) and fProject.modified and
|
||||||
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then exit;
|
(dlgFileChangeClose(fProject.filename, UnsavedProj) = mrCancel) then exit;
|
||||||
with TOpenDialog.Create(nil) do
|
with TOpenDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
|
@ -3341,14 +3357,15 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjSourceExecute(Sender: TObject);
|
procedure TCEMainForm.actProjSourceExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fProject = nil then exit;
|
if not assigned(fProject) or not fProject.filename.fileExists then
|
||||||
if not fProject.filename.fileExists then exit;
|
exit;
|
||||||
|
|
||||||
if (fProject.getFormat = pfDUB) and TCEDubProject(fProject.getProject).isSDL then
|
if (fProject.getFormat = pfDUB) and TCEDubProject(fProject.getProject).isSDL then
|
||||||
begin
|
begin
|
||||||
fMsgs.message(DubSdlWarning, fProject, amcProj, amkWarn);
|
fMsgs.message(DubSdlWarning, fProject, amcProj, amkWarn);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
//
|
|
||||||
openFile(fProject.filename);
|
openFile(fProject.filename);
|
||||||
fDoc.isProjectDescription := true;
|
fDoc.isProjectDescription := true;
|
||||||
if fProject.getFormat = pfCE then
|
if fProject.getFormat = pfCE then
|
||||||
|
@ -3359,7 +3376,8 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjOptViewExecute(Sender: TObject);
|
procedure TCEMainForm.actProjOptViewExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fProject = nil then exit;
|
if not assigned(fProject) then
|
||||||
|
exit;
|
||||||
dlgOkInfo(fProject.getCommandLine, 'Compilation command line');
|
dlgOkInfo(fProject.getCommandLine, 'Compilation command line');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -3387,6 +3405,8 @@ procedure TCEMainForm.actProjSaveGroupAsExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
with TSaveDialog.Create(nil) do
|
with TSaveDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
|
if fProjectGroup.groupFilename.fileExists then
|
||||||
|
InitialDir := fProjectGroup.groupFilename.extractFileDir;
|
||||||
if execute then
|
if execute then
|
||||||
fProjectGroup.saveGroup(filename);
|
fProjectGroup.saveGroup(filename);
|
||||||
finally
|
finally
|
||||||
|
@ -3404,7 +3424,7 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjSelUngroupedExecute(Sender: TObject);
|
procedure TCEMainForm.actProjSelUngroupedExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fFreeProj <> nil then
|
if assigned(fFreeProj) then
|
||||||
fFreeProj.activate;
|
fFreeProj.activate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -3420,12 +3440,9 @@ end;
|
||||||
|
|
||||||
procedure TCEMainForm.actProjAddToGroupExecute(Sender: TObject);
|
procedure TCEMainForm.actProjAddToGroupExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if fFreeProj = nil then
|
if not assigned(fFreeProj) or fFreeProj.inGroup or
|
||||||
exit;
|
not fFreeProj.filename.fileExists then
|
||||||
if fFreeProj.inGroup then
|
exit;
|
||||||
exit;
|
|
||||||
if not fFreeProj.filename.fileExists then
|
|
||||||
exit;
|
|
||||||
fProjectGroup.addProject(fFreeProj);
|
fProjectGroup.addProject(fFreeProj);
|
||||||
fFreeProj := nil;
|
fFreeProj := nil;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue