gecko/browser/devtools/tilt/CmdTilt.jsm
Rob Campbell 797c29b92e Backout bug 776875, bug 773347, bug 775031, bug 773565 due to test failures. a=orange
--HG--
rename : browser/devtools/commandline/Commands.jsm => browser/devtools/commandline/GcliCommands.jsm
rename : browser/devtools/commandline/CmdCookie.jsm => browser/devtools/commandline/GcliCookieCommands.jsm
rename : browser/devtools/tilt/CmdTilt.jsm => browser/devtools/commandline/GcliTiltCommands.jsm
rename : browser/devtools/commandline/commandline.css => browser/devtools/commandline/gcli.css
rename : browser/devtools/commandline/commandlineoutput.xhtml => browser/devtools/commandline/gclioutput.xhtml
rename : browser/devtools/commandline/commandlinetooltip.xhtml => browser/devtools/commandline/gclitooltip.xhtml
rename : browser/devtools/commandline/test/browser_cmd_addon.js => browser/devtools/commandline/test/browser_gcli_addon.js
rename : browser/devtools/commandline/test/browser_dbg_cmd_break.html => browser/devtools/commandline/test/browser_gcli_break.html
rename : browser/devtools/commandline/test/browser_dbg_cmd_break.js => browser/devtools/commandline/test/browser_gcli_break.js
rename : browser/devtools/commandline/test/browser_cmd_calllog.js => browser/devtools/commandline/test/browser_gcli_calllog.js
rename : browser/devtools/commandline/test/browser_cmd_commands.js => browser/devtools/commandline/test/browser_gcli_commands.js
rename : browser/devtools/commandline/test/browser_cmd_cookie.js => browser/devtools/commandline/test/browser_gcli_cookie.js
rename : browser/devtools/commandline/test/browser_dbg_cmd.js => browser/devtools/commandline/test/browser_gcli_dbg.js
rename : browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.js => browser/devtools/commandline/test/browser_gcli_edit.js
rename : browser/devtools/commandline/test/browser_cmd_pagemod_export.html => browser/devtools/commandline/test/browser_gcli_inspect.html
rename : browser/devtools/highlighter/test/browser_inspector_cmd_inspect.js => browser/devtools/commandline/test/browser_gcli_inspect.js
rename : browser/devtools/commandline/test/browser_cmd_integrate.js => browser/devtools/commandline/test/browser_gcli_integrate.js
rename : browser/devtools/commandline/test/browser_cmd_jsb.js => browser/devtools/commandline/test/browser_gcli_jsb.js
rename : browser/devtools/commandline/test/browser_cmd_pagemod_export.js => browser/devtools/commandline/test/browser_gcli_pagemod_export.js
rename : browser/devtools/commandline/test/browser_cmd_pref.js => browser/devtools/commandline/test/browser_gcli_pref.js
rename : browser/devtools/responsivedesign/test/browser_responsive_cmd.js => browser/devtools/commandline/test/browser_gcli_responsivemode.js
rename : browser/devtools/commandline/test/browser_cmd_restart.js => browser/devtools/commandline/test/browser_gcli_restart.js
rename : browser/devtools/commandline/test/browser_cmd_settings.js => browser/devtools/commandline/test/browser_gcli_settings.js
rename : browser/devtools/styleeditor/test/browser_styleeditor_cmd_edit.html => browser/devtools/commandline/test/resources.html
rename : browser/devtools/commandline/test/browser_dbg_cmd.html => browser/devtools/commandline/test/resources_dbg.html
rename : browser/devtools/styleeditor/test/resources_inpage.jsi => browser/devtools/commandline/test/resources_inpage.js
rename : browser/devtools/styleeditor/test/resources_inpage1.css => browser/devtools/commandline/test/resources_inpage1.css
rename : browser/devtools/styleeditor/test/resources_inpage2.css => browser/devtools/commandline/test/resources_inpage2.css
rename : browser/devtools/commandline/test/browser_cmd_jsb_script.jsi => browser/devtools/commandline/test/resources_jsb_script.js
rename : browser/themes/gnomestripe/devtools/commandline.css => browser/themes/gnomestripe/devtools/gcli.css
rename : browser/themes/pinstripe/devtools/commandline.css => browser/themes/pinstripe/devtools/gcli.css
rename : browser/themes/winstripe/devtools/commandline.css => browser/themes/winstripe/devtools/gcli.css
2012-08-24 09:27:30 -04:00

192 lines
4.6 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let EXPORTED_SYMBOLS = [ ];
Components.utils.import("resource:///modules/devtools/gcli.jsm");
Components.utils.import("resource:///modules/HUDService.jsm");
/**
* 'tilt' command
*/
gcli.addCommand({
name: 'tilt',
description: gcli.lookup("tiltDesc"),
manual: gcli.lookup("tiltManual")
});
/**
* 'tilt open' command
*/
gcli.addCommand({
name: 'tilt open',
description: gcli.lookup("tiltOpenDesc"),
manual: gcli.lookup("tiltOpenManual"),
params: [
{
name: "node",
type: "node",
defaultValue: null,
description: gcli.lookup("inspectNodeDesc"),
manual: gcli.lookup("inspectNodeManual")
}
],
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
let InspectorUI = chromeWindow.InspectorUI;
let Tilt = chromeWindow.Tilt;
if (Tilt.currentInstance) {
Tilt.update(args.node);
} else {
let hudId = chromeWindow.HUDConsoleUI.getOpenHUD();
let hud = HUDService.getHudReferenceById(hudId);
if (hud && !hud.consolePanel) {
HUDService.deactivateHUDForContext(chromeWindow.gBrowser.selectedTab);
}
InspectorUI.openInspectorUI(args.node);
Tilt.initialize();
}
}
});
/**
* 'tilt translate' command
*/
gcli.addCommand({
name: 'tilt translate',
description: gcli.lookup("tiltTranslateDesc"),
manual: gcli.lookup("tiltTranslateManual"),
params: [
{
name: "x",
type: "number",
defaultValue: 0,
description: gcli.lookup("tiltTranslateXDesc"),
manual: gcli.lookup("tiltTranslateXManual")
},
{
name: "y",
type: "number",
defaultValue: 0,
description: gcli.lookup("tiltTranslateYDesc"),
manual: gcli.lookup("tiltTranslateYManual")
}
],
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
let Tilt = chromeWindow.Tilt;
if (Tilt.currentInstance) {
Tilt.currentInstance.controller.arcball.translate([args.x, args.y]);
}
}
});
/**
* 'tilt rotate' command
*/
gcli.addCommand({
name: 'tilt rotate',
description: gcli.lookup("tiltRotateDesc"),
manual: gcli.lookup("tiltRotateManual"),
params: [
{
name: "x",
type: { name: 'number', min: -360, max: 360, step: 10 },
defaultValue: 0,
description: gcli.lookup("tiltRotateXDesc"),
manual: gcli.lookup("tiltRotateXManual")
},
{
name: "y",
type: { name: 'number', min: -360, max: 360, step: 10 },
defaultValue: 0,
description: gcli.lookup("tiltRotateYDesc"),
manual: gcli.lookup("tiltRotateYManual")
},
{
name: "z",
type: { name: 'number', min: -360, max: 360, step: 10 },
defaultValue: 0,
description: gcli.lookup("tiltRotateZDesc"),
manual: gcli.lookup("tiltRotateZManual")
}
],
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
let Tilt = chromeWindow.Tilt;
if (Tilt.currentInstance) {
Tilt.currentInstance.controller.arcball.rotate([args.x, args.y, args.z]);
}
}
});
/**
* 'tilt zoom' command
*/
gcli.addCommand({
name: 'tilt zoom',
description: gcli.lookup("tiltZoomDesc"),
manual: gcli.lookup("tiltZoomManual"),
params: [
{
name: "zoom",
type: { name: 'number' },
description: gcli.lookup("tiltZoomAmountDesc"),
manual: gcli.lookup("tiltZoomAmountManual")
}
],
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
let Tilt = chromeWindow.Tilt;
if (Tilt.currentInstance) {
Tilt.currentInstance.controller.arcball.zoom(-args.zoom);
}
}
});
/**
* 'tilt reset' command
*/
gcli.addCommand({
name: 'tilt reset',
description: gcli.lookup("tiltResetDesc"),
manual: gcli.lookup("tiltResetManual"),
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
let Tilt = chromeWindow.Tilt;
if (Tilt.currentInstance) {
Tilt.currentInstance.controller.arcball.reset();
}
}
});
/**
* 'tilt close' command
*/
gcli.addCommand({
name: 'tilt close',
description: gcli.lookup("tiltCloseDesc"),
manual: gcli.lookup("tiltCloseManual"),
exec: function(args, context) {
let chromeWindow = context.environment.chromeDocument.defaultView;
let Tilt = chromeWindow.Tilt;
Tilt.destroy(Tilt.currentWindowId);
}
});