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

@ -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;
@ -621,6 +622,12 @@ class IDEFrame : AppFrame {
if(searchPanel !is null) { if(searchPanel !is null) {
searchPanel.focus(); searchPanel.focus();
} }
return true;
case IDEActions.FileNewWorkspace:
createNewProject(true);
return true;
case IDEActions.FileNewProject:
createNewProject(false);
return true; return true;
default: default:
return super.handleAction(a); return super.handleAction(a);
@ -629,6 +636,16 @@ class IDEFrame : AppFrame {
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";
} }
@ -25,51 +24,56 @@ class NewProjectDlg : Dialog {
Widget content = parseML(q{ Widget content = parseML(q{
VerticalLayout { VerticalLayout {
id: vlayout id: vlayout
margins: Rect { left: 5; right: 3; top: 2; bottom: 4 }
padding: Rect { 5, 4, 3, 2 } // same as Rect { left: 5; top: 4; right: 3; bottom: 2 }
layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
HorizontalLayout { HorizontalLayout {
layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
VerticalLayout { VerticalLayout {
layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT; layoutWidth: 1 layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
TextWidget { TextWidget {
text: "Project type" text: "Project type"
} }
EditBox {}
} }
VerticalLayout { VerticalLayout {
layoutWidth: FILL_PARENT; layoutWeight: FILL_PARENT; layoutWidth: 1 layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
TextWidget { TextWidget {
text: "Template" text: "Template"
} }
EditBox {}
} }
VerticalLayout { VerticalLayout {
layoutWidth: FILL_PARENT; layoutWeight: FILL_PARENT; layoutWidth: 1 layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
TextWidget { TextWidget {
text: "Description" text: "Description"
} }
EditBox {}
} }
} }
margins: Rect { left: 5; right: 3; top: 2; bottom: 4 } TableLayout {
padding: Rect { 5, 4, 3, 2 } // same as Rect { left: 5; top: 4; right: 3; bottom: 2 } colCount: 2
TextWidget { layoutWidth: FILL_PARENT; layoutHeight: FILL_PARENT
/* this widget can be accessed via id myLabel1 TextWidget { text: "Project name" }
e.g. w.childById!TextWidget("myLabel1") EditLine {
*/ id: edProjectName
id: myLabel1
text: "Some text"; padding: 5
enabled: false
} }
TextWidget { TextWidget { text: "Solution name" }
id: myLabel2 EditLine {
text: "More text"; margins: 5 id: edSolutionName
enabled: true
} }
CheckBox{ id: cb1; text: "Some checkbox" } TextWidget { text: "Location" }
HorizontalLayout { EditLine {
RadioButton { id: rb1; text: "Radio Button 1" } id: edLocation
RadioButton { id: rb1; text: "Radio Button 2" } }
TextWidget { text: "" }
CheckBox { id: cbCreateSubdir; text: "Create subdirectory for project" }
} }
} }
}); });
// you can access loaded items by id - e.g. to assign signal listeners
auto edit1 = window.mainWidget.childById!EditLine("edit1");
addChild(content);
addChild(createButtonsPanel([ACTION_OK, ACTION_CANCEL], 0, 0));
} }
} }