📄 main.js
字号:
}), new EchoApp.Row({ cellSpacing: 40, children: [ new EchoApp.RadioButton({ group: groupOrderButtons, text: this._msg["AutomaticDemo.OrderSequential"], selected: true }), this._orderRandom = new EchoApp.RadioButton({ group: groupOrderButtons, text: this._msg["AutomaticDemo.OrderRandom"] }) ] }) ] }), new EchoApp.Column({ styleName: "PreferencesColumn", children: [ new EchoApp.Label({ styleName: "PreferencesTitle", text: this._msg["AutomaticDemo.TransitionPrompt"] }), this._transitionSelect = new EchoApp.SelectField({ items: [ { id: "Random", text: this._msg["AutomaticDemo.TransitionRandom"] }, { id: "Fade", text: this._msg["AutomaticDemo.TransitionFade"] }, { id: "RandomPan", text: this._msg["AutomaticDemo.TransitionRandomPan"] }, { id: "PanRight", text: this._msg["AutomaticDemo.TransitionPanRight"] }, { id: "None", text: this._msg["AutomaticDemo.TransitionNone"] } ], selectedId: DemoApp.pref.transitionsEnabled ? "Random" : "None" }) ] }) ] }) ] }) ] }); }, _processSpeedChange: function(e) { if (e.source == this._speedLudicrous) { this._transitionSelectLastId = this._transitionSelect.get("selectedId"); this._transitionSelect.set("selectedId", "None"); this._transitionSelect.setEnabled(false); } else { if (!this._transitionSelect.isEnabled()) { this._transitionSelect.set("selectedId", this._transitionSelectLastId); this._transitionSelect.setEnabled(true); } } }, _start: function(e) { var interval = this._speedLudicrous.get("selected") ? 1 : (this._speedFast.get("selected") ? 1500 : 4500); this._workspace.startAutomaticDemo(false, interval, !!this._speedLudicrous.get("selected"), this._transitionSelect.get("selectedId")); this.parent.remove(this); }, _close: function(e) { this.parent.remove(this); }});/** * WebCore.Scheduler.Runnable to launch various screens at intervals for the automatic demo. */DemoApp.AutomaticDemoRunnable = Core.extend(WebCore.Scheduler.Runnable, { $static: { ALL_TRANSITIONS: [ ExtrasApp.TransitionPane.TYPE_FADE, ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_UP, ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_LEFT, ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_RIGHT, ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_DOWN ], PAN_TRANSITIONS: [ ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_UP, ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_LEFT, ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_RIGHT, ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_DOWN ] }, _screens: null, _launcher: null, _lastExec: 0, _count: 0, _performanceTest: false, _startTime: null, $construct: function(launcher, sections, performanceTest, interval, randomOrder, transitionStyle) { this._launcher = launcher; this._performanceTest = performanceTest; this._interval = interval; this._randomOrder = randomOrder; this._transitionStyle = transitionStyle; this._screens = []; for (var i = 0; i < sections.length; ++i) { for (var j = 0; j < sections[i].screens.length; ++j) { this._screens.push(sections[i].screens[j]); } } this._count = 0; }, repeat: true, timeInterval: null, run: function() { if (this._performanceTest && this._startTime == null) { this._startTime = new Date().getTime(); } if (this._launcher.fpsLabel) { if (this._count == 0) { this._lastExec = new Date().getTime(); } ++this._count; if (this._count % 10 == 0) { var time = new Date().getTime(); this._launcher.fpsLabel.set("text", parseInt(100000 / (time - this._lastExec)) / 10); this._lastExec = time; if (this._performanceTest && time > this._startTime + 30000) { var averageFps = (this._count - 1) / ((time - this._startTime) / 1000); this._launcher.stopAutomaticDemo(averageFps); return; } } } this.timeInterval = this._interval; switch (this._transitionStyle) { case "Random": this._launcher.setTransition(DemoApp.Util.randomItem(DemoApp.AutomaticDemoRunnable.ALL_TRANSITIONS), true); break; case "RandomPan": this._launcher.setTransition(DemoApp.Util.randomItem(DemoApp.AutomaticDemoRunnable.PAN_TRANSITIONS), true); break; case "Fade": this._launcher.setTransition(ExtrasApp.TransitionPane.TYPE_FADE, true); break; case "PanRight": this._launcher.setTransition(ExtrasApp.TransitionPane.TYPE_CAMERA_PAN_RIGHT, true); break; case "None": this._launcher.setTransition(ExtrasApp.TransitionPane.TYPE_IMMEDIATE, true); break; } if (this._randomOrder) { this._launcher.launchScreen(DemoApp.Util.randomItem(this._screens)); } else { this._launcher.launchScreen(this._launcher.getNextScreen()); } }});/** * Color selection button widget. Colored button launches a color select window when clicked. */DemoApp.ColorSelectButton = Core.extend(EchoApp.Button, { _msg: null, _color: null, _window: null, _colorSelect: null, $construct: function(color) { this._msg = DemoApp.Messages.get(null); this.color = color ? color : "#000000", EchoApp.Button.call(this, { width: 50, height: 20, border: "1px outset " + this.color, background: this.color, events: { action: Core.method(this, this._processAction) } }); }, _apply: function(e) { this.color = this._colorSelect.get("color"); this.set("border", "1px outset " + this.color); this.set("background", this.color); this._window.parent.remove(this._window); this._window = null; this._colorSelect = null; }, _close: function(e) { this._window.parent.remove(this._window); this._window = null; this._colorSelect = null; }, _processAction: function() { var contentPane = this; while (!(contentPane instanceof EchoApp.ContentPane)) { contentPane = contentPane.parent; } this._window = new EchoApp.WindowPane({ styleName: DemoApp.pref.windowStyleName, title: "Select Color", width: 220, height: 260, modal: true, events: { close: Core.method(this, this._close) }, children: [ new EchoApp.SplitPane({ styleName: "ControlPane.Container.Bottom", children: [ new EchoApp.Row({ styleName: "ControlPane", children: [ new EchoApp.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Ok"], icon: "image/Icon24Yes.gif", events: { action: Core.method(this, this._apply) } }), new EchoApp.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Cancel"], icon: "image/Icon24No.gif", events: { action: Core.method(this, this._close) } }) ] }), this._colorSelect = new ExtrasApp.ColorSelect({ layoutData: { insets: "5px 10px" }, color: this.color, hueWidth: 16, saturationHeight: 128, valueWidth: 128 }) ] }) ] }); contentPane.add(this._window); }});/** * Window to provide information about downloading the demo application. */DemoApp.DownloadWindow = Core.extend(EchoApp.WindowPane, { _msg: null, $construct: function() { this._msg = DemoApp.Messages.get(null); EchoApp.WindowPane.call(this, { styleName: DemoApp.pref.windowStyleName, title: this._msg["DownloadWindow.Title"], icon: "image/Icon16Download.gif", iconInsets: "6px 10px", insets: 10, events: { close: function(e) { e.source.parent.remove(e.source); } }, children: [ new DemoApp.HtmlLabel({ html: this._msg["DownloadWindow.Message"] }) ] }); }});/** * Window used to display windowed demo screens. */DemoApp.ScreenWindow = Core.extend(EchoApp.WindowPane, { $construct: function(screen) { EchoApp.WindowPane.call(this, { icon: screen.icon16, iconInsets: "6px 10px", title: screen.title, styleName: DemoApp.pref.windowStyleName, width: 600, height:500, events: { close: function(e) { e.source.parent.remove(e.source); } } }); if (screen.launchFunction) { screen.launchFunction(this); } },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -