|
@@ -1,29 +1,29 @@
|
|
|
var graphics = Atomic.getGraphics();
|
|
var graphics = Atomic.getGraphics();
|
|
|
-
|
|
|
|
|
var UI = Atomic.UI;
|
|
var UI = Atomic.UI;
|
|
|
var UIWidget = Atomic.UIWidget;
|
|
var UIWidget = Atomic.UIWidget;
|
|
|
var UIMenuWindow = Atomic.UIMenuWindow;
|
|
var UIMenuWindow = Atomic.UIMenuWindow;
|
|
|
-
|
|
|
|
|
var editorStrings = require("./editorStrings");
|
|
var editorStrings = require("./editorStrings");
|
|
|
var utils = require("./utils");
|
|
var utils = require("./utils");
|
|
|
|
|
+var ui = require("./ui");
|
|
|
|
|
|
|
|
-var view = new Atomic.UIView();
|
|
|
|
|
|
|
+// Create the main frame
|
|
|
|
|
+var mainframe = exports.mainframe = new UIWidget();
|
|
|
|
|
|
|
|
-var mainframe = new UIWidget();
|
|
|
|
|
|
|
+ui.view.addChild(mainframe);
|
|
|
|
|
|
|
|
|
|
+// Set it to be the size of the entire window
|
|
|
mainframe.setSize(graphics.width, graphics.height);
|
|
mainframe.setSize(graphics.width, graphics.height);
|
|
|
|
|
|
|
|
|
|
+// load the UI
|
|
|
mainframe.load("AtomicEditor/editor/ui/mainframe.tb.txt");
|
|
mainframe.load("AtomicEditor/editor/ui/mainframe.tb.txt");
|
|
|
|
|
|
|
|
-// Subscribe to graphics subsystems screen mode switching
|
|
|
|
|
|
|
+// Subscribe to graphics subsystems screen mode switching, so we can adjust the widget size
|
|
|
mainframe.subscribeToEvent(graphics, "ScreenMode", function(data) {
|
|
mainframe.subscribeToEvent(graphics, "ScreenMode", function(data) {
|
|
|
|
|
|
|
|
mainframe.setSize(data.width, data.height);
|
|
mainframe.setSize(data.width, data.height);
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-var srcLookup = {};
|
|
|
|
|
-
|
|
|
|
|
mainframe.handleMenuAtomicEditor = function(data) {
|
|
mainframe.handleMenuAtomicEditor = function(data) {
|
|
|
|
|
|
|
|
var target = data.target;
|
|
var target = data.target;
|
|
@@ -47,11 +47,7 @@ mainframe.handleMenuBarEvent = function(data) {
|
|
|
|
|
|
|
|
if (data.type == UI.EVENT_TYPE_CLICK) {
|
|
if (data.type == UI.EVENT_TYPE_CLICK) {
|
|
|
|
|
|
|
|
- if (mainframe.handleMenuAtomicEditor(data)) {
|
|
|
|
|
-
|
|
|
|
|
- return true;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (mainframe.handleMenuAtomicEditor(data)) return true;
|
|
|
|
|
|
|
|
var target = data.target;
|
|
var target = data.target;
|
|
|
|
|
|
|
@@ -62,104 +58,92 @@ mainframe.handleMenuBarEvent = function(data) {
|
|
|
var menu = new UIMenuWindow(target, target.id + " popup");
|
|
var menu = new UIMenuWindow(target, target.id + " popup");
|
|
|
menu.show(src);
|
|
menu.show(src);
|
|
|
return true;
|
|
return true;
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
mainframe.subscribeToEvent(mainframe, "WidgetEvent", function(data) {
|
|
mainframe.subscribeToEvent(mainframe, "WidgetEvent", function(data) {
|
|
|
|
|
|
|
|
- if (mainframe.handleMenuBarEvent(data)) {
|
|
|
|
|
-
|
|
|
|
|
- return true;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (mainframe.handleMenuBarEvent(data)) return true;
|
|
|
|
|
|
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-initializeMenuSources();
|
|
|
|
|
-
|
|
|
|
|
-function initializeMenuSources() {
|
|
|
|
|
-
|
|
|
|
|
- var editorItems = {
|
|
|
|
|
- "About Atomic Editor": "about atomic editor",
|
|
|
|
|
- "-1" : null,
|
|
|
|
|
- "Manage License" : "manage license",
|
|
|
|
|
- "-2" : null,
|
|
|
|
|
- "Check for Updates" : "check update",
|
|
|
|
|
- "-3" : null,
|
|
|
|
|
- "Quit" : "quit"
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- var editItems = {
|
|
|
|
|
-
|
|
|
|
|
- "Undo" : ["edit undo", editorStrings.ShortcutUndo],
|
|
|
|
|
- "Redo" : ["edit redo", editorStrings.ShortcutRedo],
|
|
|
|
|
- "-1" : null,
|
|
|
|
|
- "Cut" : ["edit cut", editorStrings.ShortcutCut],
|
|
|
|
|
- "Copy" : ["edit copy", editorStrings.ShortcutCopy],
|
|
|
|
|
- "Paste" : ["edit paste", editorStrings.ShortcutPaste],
|
|
|
|
|
- "Select All" : ["edit select all", editorStrings.ShortcutSelectAll],
|
|
|
|
|
- "-2" : null,
|
|
|
|
|
- "Find" : ["edit find", editorStrings.ShortcutFind],
|
|
|
|
|
- "Find Next" : ["edit find next", editorStrings.ShortcutFindNext],
|
|
|
|
|
- "Find Prev" : ["edit find prev", editorStrings.ShortcutFindPrev],
|
|
|
|
|
- "-3" : null,
|
|
|
|
|
- "Format Code" : ["edit format code", editorStrings.ShortcutBeautify],
|
|
|
|
|
- "-4" : null,
|
|
|
|
|
- "Play" : ["edit play", editorStrings.ShortcutPlay]
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- var fileItems = {
|
|
|
|
|
- "New Project" : "new project",
|
|
|
|
|
- "Open Project" : "open project",
|
|
|
|
|
- "Save Project" : "save project",
|
|
|
|
|
- "-1" : null,
|
|
|
|
|
- "Close Project" : "close project",
|
|
|
|
|
- "-2" : null,
|
|
|
|
|
- "Save File" : ["save file", editorStrings.ShortcutSaveFile],
|
|
|
|
|
- "Close File" : ["close file", editorStrings.ShortcutCloseFile],
|
|
|
|
|
-
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- var buildItems = {
|
|
|
|
|
- "Build" : ["build project", editorStrings.ShortcutBuild],
|
|
|
|
|
- "-1" : null,
|
|
|
|
|
- "Build Settings" : ["build project settings", editorStrings.ShortcutBuildSettings],
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- var toolsItems = {
|
|
|
|
|
- "Tiled Map Editor" : "tools tiles"
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- var helpItems = {
|
|
|
|
|
- "API Documentation" : "help api",
|
|
|
|
|
- "-1" : null,
|
|
|
|
|
- "Forums" : "help forums",
|
|
|
|
|
- "-2" : null,
|
|
|
|
|
- "Atomic Game Engine on GitHub" : "help github"
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- var developerItems = {
|
|
|
|
|
- "Set 1920x1080 Resolution" : "developer resolution"
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- srcLookup["menu atomic editor"] = utils.createMenuItemSource(editorItems);
|
|
|
|
|
- srcLookup["menu file"] = utils.createMenuItemSource(fileItems);
|
|
|
|
|
- srcLookup["menu edit"] = utils.createMenuItemSource(editItems);
|
|
|
|
|
- srcLookup["menu build"] = utils.createMenuItemSource(buildItems);
|
|
|
|
|
- srcLookup["menu tools"] = utils.createMenuItemSource(toolsItems);
|
|
|
|
|
- srcLookup["menu help"] = utils.createMenuItemSource(helpItems);
|
|
|
|
|
- srcLookup["menu developer"] = utils.createMenuItemSource(developerItems);
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
|
|
+var srcLookup = {};
|
|
|
|
|
|
|
|
-view.addChild(mainframe);
|
|
|
|
|
|
|
+var editorItems = {
|
|
|
|
|
+ "About Atomic Editor": "about atomic editor",
|
|
|
|
|
+ "-1" : null,
|
|
|
|
|
+ "Manage License" : "manage license",
|
|
|
|
|
+ "-2" : null,
|
|
|
|
|
+ "Check for Updates" : "check update",
|
|
|
|
|
+ "-3" : null,
|
|
|
|
|
+ "Quit" : "quit"
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+var editItems = {
|
|
|
|
|
+
|
|
|
|
|
+ "Undo" : ["edit undo", editorStrings.ShortcutUndo],
|
|
|
|
|
+ "Redo" : ["edit redo", editorStrings.ShortcutRedo],
|
|
|
|
|
+ "-1" : null,
|
|
|
|
|
+ "Cut" : ["edit cut", editorStrings.ShortcutCut],
|
|
|
|
|
+ "Copy" : ["edit copy", editorStrings.ShortcutCopy],
|
|
|
|
|
+ "Paste" : ["edit paste", editorStrings.ShortcutPaste],
|
|
|
|
|
+ "Select All" : ["edit select all", editorStrings.ShortcutSelectAll],
|
|
|
|
|
+ "-2" : null,
|
|
|
|
|
+ "Find" : ["edit find", editorStrings.ShortcutFind],
|
|
|
|
|
+ "Find Next" : ["edit find next", editorStrings.ShortcutFindNext],
|
|
|
|
|
+ "Find Prev" : ["edit find prev", editorStrings.ShortcutFindPrev],
|
|
|
|
|
+ "-3" : null,
|
|
|
|
|
+ "Format Code" : ["edit format code", editorStrings.ShortcutBeautify],
|
|
|
|
|
+ "-4" : null,
|
|
|
|
|
+ "Play" : ["edit play", editorStrings.ShortcutPlay]
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+var fileItems = {
|
|
|
|
|
+ "New Project" : "new project",
|
|
|
|
|
+ "Open Project" : "open project",
|
|
|
|
|
+ "Save Project" : "save project",
|
|
|
|
|
+ "-1" : null,
|
|
|
|
|
+ "Close Project" : "close project",
|
|
|
|
|
+ "-2" : null,
|
|
|
|
|
+ "Save File" : ["save file", editorStrings.ShortcutSaveFile],
|
|
|
|
|
+ "Close File" : ["close file", editorStrings.ShortcutCloseFile],
|
|
|
|
|
+
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+var buildItems = {
|
|
|
|
|
+ "Build" : ["build project", editorStrings.ShortcutBuild],
|
|
|
|
|
+ "-1" : null,
|
|
|
|
|
+ "Build Settings" : ["build project settings", editorStrings.ShortcutBuildSettings],
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+var toolsItems = {
|
|
|
|
|
+ "Tiled Map Editor" : "tools tiles"
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+var helpItems = {
|
|
|
|
|
+ "API Documentation" : "help api",
|
|
|
|
|
+ "-1" : null,
|
|
|
|
|
+ "Forums" : "help forums",
|
|
|
|
|
+ "-2" : null,
|
|
|
|
|
+ "Atomic Game Engine on GitHub" : "help github"
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+var developerItems = {
|
|
|
|
|
+ "Set 1920x1080 Resolution" : "developer resolution"
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+srcLookup["menu atomic editor"] = utils.createMenuItemSource(editorItems);
|
|
|
|
|
+srcLookup["menu file"] = utils.createMenuItemSource(fileItems);
|
|
|
|
|
+srcLookup["menu edit"] = utils.createMenuItemSource(editItems);
|
|
|
|
|
+srcLookup["menu build"] = utils.createMenuItemSource(buildItems);
|
|
|
|
|
+srcLookup["menu tools"] = utils.createMenuItemSource(toolsItems);
|
|
|
|
|
+srcLookup["menu help"] = utils.createMenuItemSource(helpItems);
|
|
|
|
|
+srcLookup["menu developer"] = utils.createMenuItemSource(developerItems);
|