📄 main.js
字号:
}), new EchoApp.SplitPane({ orientation: EchoApp.SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, separatorPosition: 55, separatorHeight: 1, separatorColor: "#000000", children: [ new EchoApp.Row({ insets: 8, alignment: "center", cellSpacing: 100, layoutData: { overflow: EchoApp.SplitPane.OVERFLOW_HIDDEN, backgroundImage: "image/NavigationBackground.png" }, children: [ new EchoApp.Button({ icon: "image/PreviousArrow.gif", rolloverIcon: "image/PreviousArrowRollover.gif", text: this._msg["Navigation.Previous"], foreground: "#ffffff", rolloverForeground: "#c9fdd2", font: { bold: true, italic: true }, iconTextMargin: 10, textPosition: "left", rolloverEnabled: true, events: { action: Core.method(this, this._processPrevious) } }), new EchoApp.Button({ icon: "image/NextArrow.gif", rolloverIcon: "image/NextArrowRollover.gif", text: this._msg["Navigation.Next"], foreground: "#ffffff", rolloverForeground: "#c9fdd2", font: { bold: true, italic: true }, iconTextMargin: 10, textPosition: "right", rolloverEnabled: true, events: { action: Core.method(this, this._processNext) } }) ] }), this._contentArea = new ExtrasApp.TransitionPane({ }) ] }) ] }) ] }) ] }); this._menu.set("model", this._createMenuModel()); this._createLaunchPanel(); this.launchScreen(this.getNextScreen()); }, _createLaunchPanel: function() { this._screenMap = { }; for (var i = 0; i < this._sections.length; ++i) { var column = new EchoApp.Column({ styleName: "LaunchPanel", layoutData: { title: this._sections[i].title } }); this._launchPanel.add(column); for (var j = 0; j < this._sections[i].screens.length; ++j) { var screen = this._sections[i].screens[j]; column.add(new EchoApp.Button({ id: screen.id, styleName: "LaunchPanel", icon: screen.icon64, text: screen.title, actionCommand: screen.id, events: { action: Core.method(this, this._processLauncherClick) } })); this._screenMap[screen.id] = screen; } } }, _createMenuModel: function() { var launchMenu = new ExtrasApp.MenuModel(null, this._msg["Menu.LaunchMenu"], null); var windowedLaunchMenu = new ExtrasApp.MenuModel(null, this._msg["Menu.StartWindowedDemoMenu"], null); for (var i = 0; i < this._sections.length; ++i) { for (var j = 0; j < this._sections[i].screens.length; ++j) { var screen = this._sections[i].screens[j]; launchMenu.addItem(new ExtrasApp.OptionModel("L:" + screen.id, screen.title, screen.icon16)); windowedLaunchMenu.addItem(new ExtrasApp.OptionModel("W:" + screen.id, screen.title, screen.icon16)); } } launchMenu.addItem(new ExtrasApp.SeparatorModel()); launchMenu.addItem(windowedLaunchMenu); launchMenu.addItem(new ExtrasApp.SeparatorModel()); launchMenu.addItem(new ExtrasApp.OptionModel("autodemo", this._msg["Menu.StartAutoDemo"], "image/Icon16Play.gif")); launchMenu.addItem(new ExtrasApp.OptionModel("perftest", this._msg["Menu.PerformanceTest"], "image/Icon16Performance.gif")); var menuModel = new ExtrasApp.MenuModel(null, null, null, [ launchMenu, new ExtrasApp.MenuModel(null, this._msg["Menu.ToolsMenu"], null, [ new ExtrasApp.OptionModel("viewsource", this._msg["Menu.ViewSource"], "image/Icon16JavaScript.gif"), new ExtrasApp.MenuModel(null, this._msg["Menu.ViewSourceMenu"], null, [ new ExtrasApp.OptionModel("viewsource.main", this._msg["Menu.ViewSourceMain"], null), new ExtrasApp.OptionModel("viewsource.ss", this._msg["Menu.ViewSourceStyleSheet"], null), new ExtrasApp.OptionModel("viewsource.msg", this._msg["Menu.ViewSourceMessages"], null), new ExtrasApp.SeparatorModel(), new ExtrasApp.OptionModel("viewsource.html", this._msg["Menu.ViewSourceHtml"], null) ]), new ExtrasApp.SeparatorModel(), new ExtrasApp.OptionModel("preferences", this._msg["Menu.Preferences"], "image/Icon16Preferences.gif"), new ExtrasApp.SeparatorModel(), new ExtrasApp.OptionModel("download", this._msg["Menu.Download"], "image/Icon16Download.gif") ]), new ExtrasApp.MenuModel(null, this._msg["Menu.HelpMenu"], null, [ new ExtrasApp.OptionModel("about", this._msg["Menu.About"], "image/Icon16Info.gif") ]) ]); return menuModel; }, getNextScreen: function() { var activeFound = this._activeScreen == null; for (var k = 0; k < 2; ++k) { for (var i = 0; i < this._sections.length; ++i) { for (var j = 0; j < this._sections[i].screens.length; ++j) { var screen = this._sections[i].screens[j]; if (activeFound && screen.launchFunction) { return screen; } if (this._activeScreen == screen) { activeFound = true; } } } } }, getPreviousScreen: function() { var activeFound = this._activeScreen == null; for (var k = 0; k < 2; ++k) { for (var i = this._sections.length - 1; i >= 0; --i) { for (var j = this._sections[i].screens.length - 1; j >= 0; --j) { var screen = this._sections[i].screens[j]; if (activeFound && screen.launchFunction) { return screen; } if (this._activeScreen == screen) { activeFound = true; } } } } }, launchScreen: function(screen) { if (this._activeScreenLaunchButton) { this._activeScreenLaunchButton.setStyleName("LaunchPanel"); this._activeScreenLaunchButton = null; } this._activeScreen = screen; for (var i = 0; i < this._launchPanel.children.length && !this._activeScreenLaunchButton; ++i) { var column = this._launchPanel.children[i] for (var j = 0; j < column.children.length && !this._activeScreenLaunchButton; ++j) { var launchButton = column.children[j]; if (launchButton.get("id") == screen.id) { this._activeScreenLaunchButton = launchButton; this._activeScreenLaunchButton.setStyleName("LaunchPanel.Selected"); this._launchPanel.set("activeTab", column.renderId); } } } if (screen.launchFunction) { screen.launchFunction(this); } }, _launchScreenWindowed: function(screen) { var screenWindow = new DemoApp.ScreenWindow(screen); this.add(screenWindow); }, _processLauncherClick: function(e) { if (this._screenMap[e.actionCommand]) { this.setTransition(ExtrasApp.TransitionPane.TYPE_FADE); var screen = this._screenMap[e.actionCommand]; this.launchScreen(screen); } }, _processMenuAction: function(e) { switch (e.modelId) { case "about": this.add(new DemoApp.AboutDialog()); break; case "autodemo": this.add(new DemoApp.AutomaticDemoDialog(this)); break; case "download": this.add(new DemoApp.DownloadWindow()); break; case "perftest": this.add(new DemoApp.PerformanceTestDialog(this)); break; case "preferences": this.add(new DemoApp.PreferencesDialog(this.application)); break; case "viewsource": this.add(new DemoApp.SourceWindow(this._activeScreen)); break; case "viewsource.main": this.add(new DemoApp.SourceWindow("app/Main.js")); break; case "viewsource.ss": this.add(new DemoApp.SourceWindow("app/Default.StyleSheet.js")); break; case "viewsource.msg": this.add(new DemoApp.SourceWindow("app/Messages.js")); break; case "viewsource.html": this.add(new DemoApp.SourceWindow("index.html")); break; default: if (e.modelId.substring(0,2) == "L:") { var screen = this._screenMap[e.modelId.substring(2)]; this.launchScreen(screen); } else if (e.modelId.substring(0,2) == "W:") { var screen = this._screenMap[e.modelId.substring(2)]; this._launchScreenWindowed(screen); } break; } }, _processNext: function(e) { this.setTransition(ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_RIGHT); this.launchScreen(this.getNextScreen()); }, _processPrevious: function(e) { this.setTransition(ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_LEFT); this.launchScreen(this.getPreviousScreen()); }, setContent: function(content) { this._contentArea.removeAll(); this._contentArea.add(content); }, setTransition: function(type, overridePreferences) { this._contentArea.set("type", overridePreferences || DemoApp.pref.transitionsEnabled ? type : ExtrasApp.TransitionPane.TYPE_IMMEDIATE); }, startAutomaticDemo: function(performanceTest, interval, randomOrder, transitionStyle) { if (performanceTest) { interval = 0; transitionStyle = "None"; } this._stopWindow = new EchoApp.WindowPane({ modal: true, styleName: "GlassBlue2", title: this._msg[performanceTest ? "PerformanceTest.WindowTitle" : "AutomaticDemo.RunWindowTitle"], icon: performanceTest ? "image/Icon16Performance.gif" : "image/Icon16Play.gif", iconInsets: "6px 10px", closable: false, resizable: false, movable: false, positionX: 2000, positionY: 2000, height: 100, width: 230 }); if (interval > 1) { this._stopWindow.add(new EchoApp.ContentPane({ overflow: EchoApp.ContentPane.OVERFLOW_HIDDEN, backgroundImage: { url: "image/StopBackground.png", y: "50%" }, children: [ new EchoApp.Button({ foreground: "#ffffef", font: { size: 30 }, insets: 5, alignment: { horizontal: "center", vertical: "middle" }, text: this._msg["AutomaticDemo.StopMessage"], events: { action: Core.method(this, this.stopAutomaticDemo) } }) ] })); } else { this._launchPanel.set("animationTime", 0); this._stopWindow.add(new EchoApp.SplitPane({ orienation: EchoApp.SplitPane.ORIENTATION_HORIZONTAL_LEFT_RIGHT, separatorPosition: 80,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -