1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 18:04:13 +01:00

Add rough :displaypane and :dpclose commands.

This commit is contained in:
Doug Kearns
2009-03-29 01:06:38 +11:00
parent 58a5b47f63
commit a5c8ebcc55
3 changed files with 68 additions and 36 deletions

View File

@@ -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");
for (let [,panel] in Iterator(menu.childNodes))
{
if (panel.label == arg)
{
panel.doCommand();
return;
}
}
liberator.echoerr("No sidebar " + arg + " found");
},
{
argCount: "1",
completer: function (context) completion.sidebar(context),
completer: function (context) completion.displayPane(context),
literal: 0
});
// 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;
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.displayPane(context),
literal: 0
});
*/
commands.add(["winc[lose]", "wc[lose]"],
"Close window",

View File

@@ -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:

View File

@@ -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 +