New project popup

This commit is contained in:
luboslenco
2019-03-11 13:33:02 +01:00
parent a8fadf69b9
commit 1c9bbeed4c
2 changed files with 51 additions and 38 deletions
+41 -14
View File
@@ -20,6 +20,7 @@ class App extends iron.Trait {
public static var showFiles = false;
public static var showBox = false;
public static var boxText = "";
public static var boxCommands:Zui->Void = null;
public static var foldersOnly = false;
public static var showFilename = false;
public static var whandle = new Zui.Handle();
@@ -370,29 +371,44 @@ class App extends iron.Trait {
g.color = uimodal.t.SEPARATOR_COL;
g.fillRect(left, top, modalW, modalH);
g.end();
uimodal.begin(g);
if (uimodal.window(whandle, left, top, modalW, modalH)) {
uimodal._y += 20;
for (line in boxText.split("\n")) {
uimodal.text(line);
if (boxCommands == null) {
uimodal.begin(g);
if (uimodal.window(whandle, left, top, modalW, modalH)) {
uimodal._y += 20;
for (line in boxText.split("\n")) {
uimodal.text(line);
}
}
uimodal.end(false);
uimodal.beginLayout(g, right - Std.int(uimodal.ELEMENT_W()), bottom - Std.int(uimodal.ELEMENT_H() * 1.2), Std.int(uimodal.ELEMENT_W()));
if (uimodal.button("OK")) {
showBox = false;
}
uimodal.endLayout(false);
}
uimodal.end(false);
uimodal.beginLayout(g, right - Std.int(uimodal.ELEMENT_W()), bottom - Std.int(uimodal.ELEMENT_H() * 1.2), Std.int(uimodal.ELEMENT_W()));
if (uimodal.button("OK")) {
showBox = false;
else {
uimodal.begin(g);
if (uimodal.window(whandle, left, top, modalW, modalH)) {
uimodal._y += 20;
boxCommands(uimodal);
}
uimodal.end();
}
uimodal.endLayout(false);
g.begin(false);
}
public static function showMessageBox(text:String) {
showBox = true;
boxText = text;
boxCommands = null;
}
public static function showCustomBox(commands:Zui->Void = null) {
showBox = true;
boxCommands = commands;
}
@:access(zui.Zui)
@@ -429,7 +445,18 @@ class App extends iron.Trait {
ui.changed = false;
if (menuCategory == 0) {
if (ui.button("New Project", Left)) { Project.projectNew(); ViewportUtil.scaleToBounds(); }
if (ui.button("New Project", Left)) {
showCustomBox(function(ui:Zui) {
ui.text("New Project");
ui.row([1/2, 1/2]);
UITrait.inst.newObject = ui.combo(Id.handle(), UITrait.inst.newObjectNames, "Default Object");
if (ui.button("OK")) {
Project.projectNew();
ViewportUtil.scaleToBounds();
showBox = false;
}
});
}
if (ui.button("Open...", Left, 'Ctrl+O')) Project.projectOpen();
if (ui.button("Save", Left, 'Ctrl+S')) Project.projectSave();
if (ui.button("Save As...", Left, 'Ctrl+Shift+S')) Project.projectSaveAs();
+10 -24
View File
@@ -448,13 +448,19 @@ class UITrait extends iron.Trait {
if (ctrl && !shift && kb.started("s")) Project.projectSave();
else if (ctrl && shift && kb.started("s")) Project.projectSaveAs();
else if (ctrl && kb.started("o")) Project.projectOpen();
arm.App.showFiles = false;
if (!arm.App.uimodal.isTyping) {
if (kb.started("escape")) arm.App.showFiles = false;
if (arm.App.showFiles && kb.started("enter")) {
if (kb.started("escape")) {
arm.App.showFiles = false;
arm.App.filesDone(arm.App.path);
UITrait.inst.ddirty = 2;
arm.App.showBox = false;
}
if (arm.App.showFiles) {
if (kb.started("enter")) {
arm.App.showFiles = false;
arm.App.filesDone(arm.App.path);
UITrait.inst.ddirty = 2;
}
}
}
@@ -2091,27 +2097,7 @@ class UITrait extends iron.Trait {
}
if (ui.tab(htab, "Export")) {
if (ui.panel(Id.handle({selected: true}), "Project", 1)) {
ui.row([1/2,1/2]);
if (newConfirm) {
if (ui.button("Confirm")) {
newConfirm = false;
Project.projectNew();
ViewportUtil.scaleToBounds();
}
}
else if (ui.button("New")) {
newConfirm = true;
}
newObject = ui.combo(Id.handle(), newObjectNames, "Default Object");
ui.row([1/3,1/3,1/3]);
if (ui.button("Open")) Project.projectOpen();
if (ui.button("Save")) Project.projectSave();
if (ui.button("Save As")) Project.projectSaveAs();
}
ui.separator();
if (ui.panel(Id.handle({selected: false}), "Project Quality", 1)) {
ui.combo(resHandle, ["1K", "2K", "4K", "8K", "16K"], "Res", true);
if (resHandle.changed) {