#10, project menu, new, sub menu, either dub or native format

This commit is contained in:
Basile Burg 2015-09-20 06:23:18 +02:00
parent ffb193ece4
commit 674a1f9b8c
3 changed files with 49 additions and 22 deletions

View File

@ -98,6 +98,7 @@ implementation
constructor TCEDubProject.create(aOwner: TComponent);
begin
inherited;
fJSON := TJSONObject.Create();
fProjectSubject := TCEProjectSubject.Create;
fBuildTypes := TStringList.Create;
fConfigs := TStringList.Create;

View File

@ -1,7 +1,7 @@
object CEMainForm: TCEMainForm
Left = 393
Left = 480
Height = 49
Top = 216
Top = 238
Width = 745
AllowDropFiles = True
Caption = 'Coedit'
@ -2559,7 +2559,7 @@ object CEMainForm: TCEMainForm
object MenuItem14: TMenuItem
Caption = 'Project'
object MenuItem31: TMenuItem
Action = actProjNew
Caption = 'New project'
Bitmap.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000064000000640000000000000000000000FFFFFF000000
@ -2596,6 +2596,13 @@ object CEMainForm: TCEMainForm
A53889898AFF0000000089898AFF0000000089898AFF0000000089898AFF0000
000089898AFF000000000000000000000000FFFFFF00FFFFFF00
}
ImageIndex = 8
object MenuItem69: TMenuItem
Action = actProjNewDubJson
end
object MenuItem70: TMenuItem
Action = actProjNewNative
end
end
object MenuItem30: TMenuItem
Action = actProjOpen
@ -3604,7 +3611,6 @@ object CEMainForm: TCEMainForm
Images = imgList
OnUpdate = ActionsUpdate
left = 32
top = 1
object actEdCopy: TAction
Category = 'Edit'
Caption = 'Copy'
@ -3733,12 +3739,6 @@ object CEMainForm: TCEMainForm
ImageIndex = 9
OnExecute = actProjOpenExecute
end
object actProjNew: TAction
Category = 'Project'
Caption = 'New project'
ImageIndex = 8
OnExecute = actProjNewExecute
end
object actProjClose: TAction
Category = 'Project'
Caption = 'Close project'
@ -3907,6 +3907,18 @@ object CEMainForm: TCEMainForm
ImageIndex = 34
OnExecute = actSetRunnableSwExecute
end
object actProjNewDubJson: TAction
Category = 'Project'
Caption = 'DUB json'
ImageIndex = 8
OnExecute = actProjNewDubJsonExecute
end
object actProjNewNative: TAction
Category = 'Project'
Caption = 'Native format'
ImageIndex = 8
OnExecute = actProjNewNativeExecute
end
end
object imgList: TImageList
left = 64

View File

@ -36,6 +36,8 @@ type
actFileHtmlExport: TAction;
actFileUnittest: TAction;
actFileCompileAndRunOut: TAction;
actProjNewDubJson: TAction;
actProjNewNative: TAction;
actSetRunnableSw: TAction;
actLayoutSave: TAction;
actProjOpenContFold: TAction;
@ -48,7 +50,6 @@ type
actProjCompAndRunWithArgs: TAction;
actProjClose: TAction;
actProjOpts: TAction;
actProjNew: TAction;
actProjOpen: TAction;
actProjSave: TAction;
actProjSaveAs: TAction;
@ -127,6 +128,8 @@ type
MenuItem66: TMenuItem;
MenuItem67: TMenuItem;
MenuItem68: TMenuItem;
MenuItem69: TMenuItem;
MenuItem70: TMenuItem;
mnuLayout: TMenuItem;
mnuItemMruFile: TMenuItem;
mnuItemMruProj: TMenuItem;
@ -137,6 +140,8 @@ type
MenuItem7: TMenuItem;
MenuItem8: TMenuItem;
MenuItem9: TMenuItem;
procedure actProjNewDubJsonExecute(Sender: TObject);
procedure actProjNewNativeExecute(Sender: TObject);
procedure actSetRunnableSwExecute(Sender: TObject);
procedure updateDocumentBasedAction(sender: TObject);
procedure updateProjectBasedAction(sender: TObject);
@ -163,7 +168,6 @@ type
procedure actEdMacPlayExecute(Sender: TObject);
procedure actEdMacStartStopExecute(Sender: TObject);
procedure actFileNewExecute(Sender: TObject);
procedure actProjNewExecute(Sender: TObject);
procedure actFileNewRunExecute(Sender: TObject);
procedure actFileOpenExecute(Sender: TObject);
procedure actProjOpenContFoldExecute(Sender: TObject);
@ -2005,6 +2009,22 @@ begin
showProjTitle;
end;
procedure TCEMainForm.actProjNewDubJsonExecute(Sender: TObject);
begin
if (fProjectInterface <> nil) and fProjectInterface.modified and (dlgOkCancel(
'The project modifications are not saved, continue ?') = mrCancel) then exit;
closeProj;
newDubProj;
end;
procedure TCEMainForm.actProjNewNativeExecute(Sender: TObject);
begin
if (fProjectInterface <> nil) and fProjectInterface.modified and (dlgOkCancel(
'The project modifications are not saved, continue ?') = mrCancel) then exit;
closeProj;
newNativeProj;
end;
procedure TCEMainForm.newNativeProj;
begin
fNativeProject := TCENativeProject.Create(nil);
@ -2015,8 +2035,10 @@ end;
procedure TCEMainForm.newDubProj;
begin
fDubProject := TCEDubProject.Create(nil);
fDubProject.Name := 'CurrentProject';
fDubProject := TCEDubProject.create(nil);
fDubProject.json.Add('name', '');
fDubProject.beginModification;
fDubProject.endModification;
fProjectInterface := fDubProject as ICECommonProject;
showProjTitle;
end;
@ -2051,14 +2073,6 @@ begin
openProj(TMenuItem(Sender).Hint);
end;
procedure TCEMainForm.actProjNewExecute(Sender: TObject);
begin
if (fProjectInterface <> nil) and fProjectInterface.modified and (dlgOkCancel(
'The project modifications are not saved, continue ?') = mrCancel) then exit;
closeProj;
newNativeProj;
end;
procedure TCEMainForm.actProjCloseExecute(Sender: TObject);
begin
if fProjectInterface = nil then exit;