new project creation, initial version

This commit is contained in:
Vadim Lopatin 2015-12-05 22:11:25 +03:00
parent ea784c9909
commit f6cc9c388c
5 changed files with 82 additions and 54 deletions

View File

@ -33,7 +33,6 @@
<String>USE_OPENGL</String> <String>USE_OPENGL</String>
<String>USE_SDL</String> <String>USE_SDL</String>
<String>USE_FREETYPE</String> <String>USE_FREETYPE</String>
<String>USE_GDB_DEBUG</String>
<String>EmbedStandardResources</String> <String>EmbedStandardResources</String>
</VersionIds> </VersionIds>
</VersionIds> </VersionIds>

View File

@ -125,4 +125,12 @@ Global
{FB7A3FF6-0E67-47D1-BA70-F258F9A0E332}.UnittestMinimal|Any CPU.ActiveCfg = Debug|Any CPU {FB7A3FF6-0E67-47D1-BA70-F258F9A0E332}.UnittestMinimal|Any CPU.ActiveCfg = Debug|Any CPU
{FB7A3FF6-0E67-47D1-BA70-F258F9A0E332}.UnittestMinimal|Any CPU.Build.0 = Debug|Any CPU {FB7A3FF6-0E67-47D1-BA70-F258F9A0E332}.UnittestMinimal|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
$0.TextStylePolicy = $1
$1.FileWidth = 120
$1.inheritsSet = VisualStudio
$1.inheritsScope = text/plain
$1.scope = text/plain
EndGlobalSection
EndGlobal EndGlobal

View File

@ -36,7 +36,7 @@ enum IDEActions : int {
HelpAbout, HelpAbout,
WindowCloseAllDocuments, WindowCloseAllDocuments,
CreateNewWorkspace, CreateNewWorkspace,
AddToCurrentWorkspace, AddToCurrentWorkspace,
ProjectFolderAddItem, ProjectFolderAddItem,
ProjectFolderRemoveItem, ProjectFolderRemoveItem,
ProjectFolderOpenItem, ProjectFolderOpenItem,

View File

@ -20,6 +20,7 @@ import dlangui.core.files;
import dlangide.ui.commands; import dlangide.ui.commands;
import dlangide.ui.wspanel; import dlangide.ui.wspanel;
import dlangide.ui.outputpanel; import dlangide.ui.outputpanel;
import dlangide.ui.newproject;
import dlangide.ui.dsourceedit; import dlangide.ui.dsourceedit;
import dlangide.ui.homescreen; import dlangide.ui.homescreen;
import dlangide.ui.settings; import dlangide.ui.settings;
@ -622,13 +623,29 @@ class IDEFrame : AppFrame {
searchPanel.focus(); searchPanel.focus();
} }
return true; return true;
default: case IDEActions.FileNewWorkspace:
createNewProject(true);
return true;
case IDEActions.FileNewProject:
createNewProject(false);
return true;
default:
return super.handleAction(a); return super.handleAction(a);
} }
} }
return false; return false;
} }
void createNewProject(bool newWorkspace) {
NewProjectDlg dlg = new NewProjectDlg(window, newWorkspace);
dlg.dialogResult = delegate(Dialog dlg, const Action result) {
if (result.id == ACTION_APPLY.id) {
//Log.d("settings after edit:\n", s.toJSON(true));
}
};
dlg.show();
}
void showPreferences() { void showPreferences() {
//Log.d("settings before copy:\n", _settings.setting.toJSON(true)); //Log.d("settings before copy:\n", _settings.setting.toJSON(true));
Setting s = _settings.copySettings(); Setting s = _settings.copySettings();

View File

@ -8,14 +8,13 @@ import dlangui.widgets.widget;
import dlangui.widgets.layouts; import dlangui.widgets.layouts;
import dlangui.widgets.editors; import dlangui.widgets.editors;
import dlangui.dml.parser; import dlangui.dml.parser;
import dlangui.core.stdaction;
class NewProjectDlg : Dialog { class NewProjectDlg : Dialog {
this(UIString caption, Window parentWindow = null, uint flags = DialogFlag.Modal) { bool _newWorkspace;
super(caption, parentWindow, flags); this(Window parent, bool newWorkspace) {
_caption = caption; super(newWorkspace ? UIString("New Workspace"d) : UIString("New Project"d), parent, DialogFlag.Modal);
_parentWindow = parentWindow;
_flags = flags;
_icon = "dlangui-logo1"; _icon = "dlangui-logo1";
} }
@ -23,53 +22,58 @@ class NewProjectDlg : Dialog {
override void init() { override void init() {
super.init(); super.init();
Widget content = parseML(q{ Widget content = parseML(q{
VerticalLayout { VerticalLayout {
id: vlayout id: vlayout
HorizontalLayout { margins: Rect { left: 5; right: 3; top: 2; bottom: 4 }
VerticalLayout { padding: Rect { 5, 4, 3, 2 } // same as Rect { left: 5; top: 4; right: 3; bottom: 2 }
layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT; layoutWidth: 1 layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
TextWidget { HorizontalLayout {
text: "Project type" layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
} VerticalLayout {
} layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
VerticalLayout { TextWidget {
layoutWidth: FILL_PARENT; layoutWeight: FILL_PARENT; layoutWidth: 1 text: "Project type"
TextWidget { }
text: "Template" EditBox {}
} }
} VerticalLayout {
VerticalLayout { layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
layoutWidth: FILL_PARENT; layoutWeight: FILL_PARENT; layoutWidth: 1 TextWidget {
TextWidget { text: "Template"
text: "Description" }
} EditBox {}
} }
} VerticalLayout {
margins: Rect { left: 5; right: 3; top: 2; bottom: 4 } layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
padding: Rect { 5, 4, 3, 2 } // same as Rect { left: 5; top: 4; right: 3; bottom: 2 } TextWidget {
TextWidget { text: "Description"
/* this widget can be accessed via id myLabel1 }
e.g. w.childById!TextWidget("myLabel1") EditBox {}
*/ }
id: myLabel1 }
text: "Some text"; padding: 5 TableLayout {
enabled: false colCount: 2
} layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
TextWidget { TextWidget { text: "Project name" }
id: myLabel2 EditLine {
text: "More text"; margins: 5 id: edProjectName
enabled: true }
} TextWidget { text: "Solution name" }
CheckBox{ id: cb1; text: "Some checkbox" } EditLine {
HorizontalLayout { id: edSolutionName
RadioButton { id: rb1; text: "Radio Button 1" } }
RadioButton { id: rb1; text: "Radio Button 2" } TextWidget { text: "Location" }
} EditLine {
} id: edLocation
}); }
// you can access loaded items by id - e.g. to assign signal listeners TextWidget { text: "" }
auto edit1 = window.mainWidget.childById!EditLine("edit1"); CheckBox { id: cbCreateSubdir; text: "Create subdirectory for project" }
}
}
});
addChild(content);
addChild(createButtonsPanel([ACTION_OK, ACTION_CANCEL], 0, 0));
} }
} }