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_SDL</String>
<String>USE_FREETYPE</String>
<String>USE_GDB_DEBUG</String>
<String>EmbedStandardResources</String>
</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.Build.0 = Debug|Any CPU
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

View File

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

View File

@ -20,6 +20,7 @@ import dlangui.core.files;
import dlangide.ui.commands;
import dlangide.ui.wspanel;
import dlangide.ui.outputpanel;
import dlangide.ui.newproject;
import dlangide.ui.dsourceedit;
import dlangide.ui.homescreen;
import dlangide.ui.settings;
@ -622,13 +623,29 @@ class IDEFrame : AppFrame {
searchPanel.focus();
}
return true;
default:
case IDEActions.FileNewWorkspace:
createNewProject(true);
return true;
case IDEActions.FileNewProject:
createNewProject(false);
return true;
default:
return super.handleAction(a);
}
}
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() {
//Log.d("settings before copy:\n", _settings.setting.toJSON(true));
Setting s = _settings.copySettings();

View File

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