summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2009-03-29 01:06:38 +1100
committerDoug Kearns <dougkearns@gmail.com>2009-03-29 12:04:01 +1100
commita5c8ebcc5520a3c2ad1ccaf05df462e247917881 (patch)
tree0f42664864fc2528885f21760e6196c47cc3aa1c
parent58a5b47f639f78261a05579050e1af281fe2768d (diff)
downloadpentadactyl-a5c8ebcc5520a3c2ad1ccaf05df462e247917881.tar.gz
Add rough :displaypane and :dpclose commands.
-rwxr-xr-xxulmus/content/config.js81
-rwxr-xr-xxulmus/locale/en-US/gui.txt15
-rwxr-xr-xxulmus/locale/en-US/index.txt4
3 files changed, 66 insertions, 34 deletions
diff --git a/xulmus/content/config.js b/xulmus/content/config.js
index 7471d034..8d4b2134 100755
--- a/xulmus/content/config.js
+++ b/xulmus/content/config.js
@@ -184,6 +184,31 @@ const config = { //{{{
liberator.open(pre + newNumberStr + post);
}
+ function openDisplayPane(id)
+ {
+ let pane = document.getElementById(id);
+ let manager = Components.classes['@songbirdnest.com/Songbird/DisplayPane/Manager;1']
+ .getService(Components.interfaces.sbIDisplayPaneManager);
+ let paneinfo = manager.getPaneInfo(pane._lastURL.stringValue);
+
+ if (!paneinfo)
+ paneinfo = manager.defaultPaneInfo;
+
+ pane.loadContent(paneinfo);
+ }
+
+ // FIXME: best way to format these args? Hyphenated? One word like :dialog?
+ let displayPanes = {
+ "content pane bottom": "displaypane_contentpane_bottom",
+ "service pane bottom": "displaypane_servicepane_bottom",
+ "right sidebar": "displaypane_right_sidebar"
+ };
+
+ completion.displayPane = function (context) {
+ context.title = ["Display Pane"];
+ context.completions = displayPanes; // FIXME: useful description etc
+ };
+
// load Xulmus specific modules
// FIXME: Why aren't these listed in config.scripts?
// FIXME: Why isn't this automatic? -> how would one know which classes to load where? --mst
@@ -402,50 +427,42 @@ const config = { //{{{
},
{ argCount: "0" });
- // TODO: service/content pane and right sidebar manipulation commands? --djk
- /*
- // TODO: move sidebar commands to ui.js?
- commands.add(["sbcl[ose]"],
- "Close the sidebar window",
- function ()
- {
- if (!document.getElementById("sidebar-box").hidden)
- toggleSidebar();
- },
- { argCount: "0" });
-
- commands.add(["sideb[ar]", "sb[ar]", "sbope[n]"],
- "Open the sidebar window",
+ commands.add(["dpcl[ose]"],
+ "Close a display pane",
function (args)
{
let arg = args.literalArg;
- // focus if the requested sidebar is already open
- if (document.getElementById("sidebar-title").value == arg)
- {
- document.getElementById("sidebar-box").focus();
- return;
- }
+ if (arg in displayPanes)
+ document.getElementById(displayPanes[arg]).hide();
+ else
+ liberator.echoerr("E475: Invalid argument: " + arg);
- let menu = document.getElementById("viewSidebarMenu");
+ },
+ {
+ argCount: "1",
+ completer: function (context) completion.displayPane(context),
+ literal: 0
+ });
- for (let [,panel] in Iterator(menu.childNodes))
- {
- if (panel.label == arg)
- {
- panel.doCommand();
- return;
- }
- }
+ // TODO: this should accept a second arg to specify content
+ commands.add(["displayp[ane]", "dp[ane]", "dpope[n]"],
+ "Open a display pane",
+ function (args)
+ {
+ let arg = args.literalArg;
- liberator.echoerr("No sidebar " + arg + " found");
+ if (arg in displayPanes)
+ openDisplayPane(displayPanes[arg])
+ // TODO: focus when we have better key handling of these extended modes
+ else
+ liberator.echoerr("E475: Invalid argument: " + arg);
},
{
argCount: "1",
- completer: function (context) completion.sidebar(context),
+ completer: function (context) completion.displayPane(context),
literal: 0
});
- */
commands.add(["winc[lose]", "wc[lose]"],
"Close window",
diff --git a/xulmus/locale/en-US/gui.txt b/xulmus/locale/en-US/gui.txt
index 4f2e8972..068994cd 100755
--- a/xulmus/locale/en-US/gui.txt
+++ b/xulmus/locale/en-US/gui.txt
@@ -65,4 +65,19 @@ Show progress of current downloads. Open the original Songbird download dialog
in a new tab. Here, downloads can be paused, canceled and resumed.
________________________________________________________________________________
+
+|:dpcl| |:dpclose| +
+||:dpcl[ose] {pane}||
+________________________________________________________________________________
+Close the specified display pane.
+________________________________________________________________________________
+
+
+|:dpope| |:dpopen| |:dp| |:dpane| |:dislplayp| |:dislplaypane|
+||:displaypane {pane}|| +
+________________________________________________________________________________
+Open the specified display pane. {pane} is any of "content pane bottom",
+"service pane bottom" or "right sidebar".
+________________________________________________________________________________
+
// vim: set filetype=asciidoc:
diff --git a/xulmus/locale/en-US/index.txt b/xulmus/locale/en-US/index.txt
index c7fabf5b..bb8510bc 100755
--- a/xulmus/locale/en-US/index.txt
+++ b/xulmus/locale/en-US/index.txt
@@ -218,6 +218,8 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
||[c]:doautoall[c]|| Apply the autocommands matching the specified URL to all buffers +
||[c]:doautocmd[c]|| Apply the autocommands matching the specified URL to the current buffer +
||[c]:downloads[c]|| Show progress of current downloads +
+||[c]:displaypane[c]|| Open the specified display pane +
+||[c]:dpclose[c]|| Close the specified display pane +
||[c]:echo[c]|| Echo the expression +
||[c]:echoerr[c]|| Echo the expression as an error message +
||[c]:echomsg[c]|| Echo the expression as an informational message +
@@ -268,12 +270,10 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
||[c]:restart[c]|| Force undefined to restart +
||[c]:runtime[c]|| Source the specified file from each directory in 'runtimepath' +
||[c]:saveas[c]|| Save current document to disk +
-||[c]:sbclose[c]|| Close the sidebar window +
||[c]:scriptnames[c]|| List all sourced script names +
||[c]:set[c]|| Set an option +
||[c]:setglobal[c]|| Set global option +
||[c]:setlocal[c]|| Set local option +
-||[c]:sidebar[c]|| Open the sidebar window +
||[c]:style[c]|| Style Xulmus and web sites +
||[c]:source[c]|| Read Ex commands from a file +
||[c]:stop[c]|| Stop loading +