1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-15 07:15:52 +01:00

Steps towards bootstrapped addon.

--HG--
branch : bootstrapped
This commit is contained in:
Kris Maglione
2010-12-23 19:52:32 -05:00
parent 5a51f53a74
commit c66701339f
6 changed files with 189 additions and 135 deletions

View File

@@ -10,6 +10,74 @@
const CommandWidgets = Class("CommandWidgets", {
init: function () {
let _commandline = "if (window.dactyl) return dactyl.modules.commandline";
let _status = "dactyl-statusline-field-";
util.overlayWindow(window, {
append: <e4x xmlns={XUL} xmlns:dactyl={NS}>
<window id={document.documentElement.id}>
<popupset>
<menupopup id="dactyl-contextmenu"
onpopupshowing="return (event.target != this || dactyl.modules.commandline.onContext(event));">
<menuitem id="dactyl-context-copylink"
label="Copy Link Location" dactyl:group="link"
oncommand="goDoCommand('cmd_copyLink');"/>
<menuitem id="dactyl-context-copy"
label="Copy" dactyl:group="selection"
command="cmd_copy"/>
<menuitem id="dactyl-context-selectall"
label="Select All"
command="cmd_selectAll"/>
</menupopup>
</popupset>
</window>
<vbox id={config.commandContainer}>
<vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe id="dactyl-multiline-output" src="chrome://dactyl/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false"
contextmenu="dactyl-contextmenu"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/>
</vbox>
<vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe class="dactyl-completions" id="dactyl-completions-dactyl-commandline" src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/>
</vbox>
<vbox id={"dactyl-completions-" + _status + "commandline-container"} class="dactyl-container" hidden="false" collapsed="true" insertbefore="addon-bar,status-bar">
<iframe class="dactyl-completions" id={"dactyl-completions-" + _status + "commandline"} src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false"
onclick={_commandline + ".onMultilineOutputEvent(event)"}/>
</vbox>
<stack orient="horizontal" align="stretch" class="dactyl-container" id="dactyl-container" dactyl:highlight="CmdLine CmdCmdLine">
<textbox class="plain" id="dactyl-strut" flex="1" crop="end" collapsed="true"/>
<textbox class="plain" id="dactyl-mode" flex="1" crop="end"/>
<textbox class="plain" id="dactyl-message" flex="1" readonly="true"/>
<hbox id="dactyl-commandline" hidden="false" class="dactyl-container" dactyl:highlight="Normal CmdNormal" collapsed="true">
<label id="dactyl-commandline-prompt" class="dactyl-commandline-prompt plain" flex="0" crop="end" value="" collapsed="true"/>
<textbox id="dactyl-commandline-command" class="dactyl-commandline-command plain" flex="1" type="input" timeout="100"
oninput={_commandline + ".onEvent(event);"} onkeyup={_commandline + ".onEvent(event);"}
onfocus={_commandline + ".onEvent(event);"} onblur={_commandline + ".onEvent(event);"}/>
</hbox>
</stack>
<vbox class="dactyl-container" hidden="false" collapsed="false" dactyl:highlight="CmdLine">
<textbox id="dactyl-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true"
dactyl:highlight="Normal"
onkeypress={_commandline + ".onMultilineInputEvent(event);"} oninput={_commandline + ".onMultilineInputEvent(event);"}
onblur={_commandline + ".onMultilineInputEvent(event);"}/>
</vbox>
</vbox>
</e4x>.*
});
this.elements = {};
this.addElement({
name: "container",

View File

@@ -57,6 +57,8 @@ const ConfigBase = Class(ModuleBase, {
get browserModes() [modes.NORMAL],
commandContainer: "browser-bottombox",
/**
* @property {Object} Application specific defaults for option values. The
* property names must be the options' canonical names, and the values

View File

@@ -18,113 +18,9 @@
]>
<overlay id="dactyl"
xmlns:dactyl="http://vimperator.org/namespaces/liberator"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript;version=1.8" src="&dactyl.content;dactyl-overlay.js"/>
<window id="&dactyl.mainWindow;">
<popupset>
<menupopup id="dactyl-contextmenu"
onpopupshowing="return (event.target != this || dactyl.modules.commandline.onContext(event));">
<menuitem id="dactyl-context-copylink"
label="Copy Link Location" dactyl:group="link"
oncommand="goDoCommand('cmd_copyLink');"/>
<menuitem id="dactyl-context-copy"
label="Copy" dactyl:group="selection"
command="cmd_copy"/>
<menuitem id="dactyl-context-selectall"
label="Select All"
command="cmd_selectAll"/>
</menupopup>
</popupset>
<!--this notifies us also of focus events in the XUL
from: http://developer.mozilla.org/en/docs/XUL_Tutorial:Updating_Commands !-->
<!-- I don't think we really need this. Kris -->
<commandset id="onPentadactylFocus" commandupdater="true" events="focus"
oncommandupdate="&events;.onFocusChange(event);"/>
<commandset id="onPentadactylSelect" commandupdater="true" events="select"
oncommandupdate="&events;.onSelectionChange(event);"/>
</window>
<vbox id="&dactyl.commandContainer;">
<vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe id="dactyl-multiline-output" src="chrome://dactyl/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false"
contextmenu="dactyl-contextmenu"
onclick="&commandline;.onMultilineOutputEvent(event)"/>
</vbox>
<vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe class="dactyl-completions" id="dactyl-completions-dactyl-commandline" src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false"
onclick="&commandline;.onMultilineOutputEvent(event)"/>
</vbox>
<vbox id="dactyl-completions-&status;commandline-container" class="dactyl-container" hidden="false" collapsed="true" insertbefore="addon-bar,status-bar">
<iframe class="dactyl-completions" id="dactyl-completions-&status;commandline" src="chrome://dactyl/content/buffer.xhtml"
contextmenu="dactyl-contextmenu"
flex="1" hidden="false" collapsed="false"
onclick="&commandline;.onMultilineOutputEvent(event)"/>
</vbox>
<stack orient="horizontal" align="stretch" class="dactyl-container" id="dactyl-container" dactyl:highlight="CmdLine CmdCmdLine">
<textbox class="plain" id="dactyl-strut" flex="1" crop="end" collapsed="true"/>
<textbox class="plain" id="dactyl-mode" flex="1" crop="end"/>
<textbox class="plain" id="dactyl-message" flex="1" readonly="true"/>
<hbox id="dactyl-commandline" hidden="false" class="dactyl-container" dactyl:highlight="Normal CmdNormal" collapsed="true">
<label id="dactyl-commandline-prompt" class="dactyl-commandline-prompt plain" flex="0" crop="end" value="" collapsed="true"/>
<textbox id="dactyl-commandline-command" class="dactyl-commandline-command plain" flex="1" type="input" timeout="100"
oninput="&commandline;.onEvent(event);" onkeyup="&commandline;.onEvent(event);"
onfocus="&commandline;.onEvent(event);" onblur="&commandline;.onEvent(event);"/>
</hbox>
</stack>
<vbox class="dactyl-container" hidden="false" collapsed="false" dactyl:highlight="CmdLine">
<textbox id="dactyl-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true"
dactyl:highlight="Normal"
onkeypress="&commandline;.onMultilineInputEvent(event);" oninput="&commandline;.onMultilineInputEvent(event);"
onblur="&commandline;.onMultilineInputEvent(event);"/>
</vbox>
</vbox>
<statusbar id="status-bar" dactyl:highlight="StatusLine StatusNormal">
<hbox insertbefore="&dactyl.statusBefore;" insertafter="&dactyl.statusAfter;"
style="background: inherit;" id="&status;container" flex="1" hidden="false" align="center">
<stack orient="horizontal" align="stretch" flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine">
<hbox class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine">
<label class="plain" id="&status;mode" crop="end" collapsed="true"/>
<stack flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine">
<textbox class="plain" id="&status;url" crop="end" flex="1" readonly="true"/>
<textbox class="plain" id="&status;message" crop="end" flex="1" readonly="true" dactyl:highlight="Normal StatusNormal"/>
</stack>
</hbox>
<hbox id="&status;commandline" hidden="false" class="dactyl-container" dactyl:highlight="Normal StatusNormal" collapsed="true">
<label id="&status;commandline-prompt" class="dactyl-commandline-prompt plain" flex="0" crop="end" value="" collapsed="true"/>
<textbox id="&status;commandline-command" class="dactyl-commandline-command plain" flex="1" type="text" timeout="100"
oninput="&commandline;.onEvent(event);" onkeyup="&commandline;.onEvent(event);"
onfocus="&commandline;.onEvent(event);" onblur="&commandline;.onEvent(event);"/>
</hbox>
</stack>
<label class="plain" id="&status;inputbuffer" flex="0"/>
<label class="plain" id="&status;progress" flex="0"/>
<label class="plain" id="&status;tabcount" flex="0"/>
<label class="plain" id="&status;bufferposition" flex="0"/>
<label class="plain" id="&status;zoomlevel" flex="0"/>
</hbox>
<!-- just hide them since other elements expect them -->
<statusbarpanel id="statusbar-display" hidden="true"/>
<statusbarpanel id="statusbar-progresspanel" hidden="true"/>
</statusbar>
</overlay>
<!-- vim: set fdm=marker sw=4 ts=4 et: -->

View File

@@ -13,6 +13,21 @@
*/
const Events = Module("events", {
init: function () {
let _events = "if (window.dactyl &and; dactyl.modules.loaded.events) return dactyl.modules.events"
util.overlayWindow(window, {
append: <e4x xmlns={XUL}>
<window id={document.documentElement.id}>
<!--this notifies us also of focus events in the XUL
from: http://developer.mozilla.org/en/docs/XUL_Tutorial:Updating_Commands !-->
<!-- I don't think we really need this. Kris -->
<commandset id="onPentadactylFocus" commandupdater="true" events="focus"
oncommandupdate="{_events}.onFocusChange(event);"/>
<commandset id="onPentadactylSelect" commandupdater="true" events="select"
oncommandupdate="{_events}.onSelectionChange(event);"/>
</window>
</e4x>.*
});
this._fullscreen = window.fullScreen;
this._lastFocus = null;
this._currentMacro = "";

View File

@@ -10,6 +10,45 @@
const StatusLine = Module("statusline", {
init: function () {
let _commandline = "if (window.dactyl) return dactyl.modules.commandline";
let _status = "dactyl-statusline-field-";
util.overlayWindow(window, {
append: <e4x xmlns={XUL} xmlns:dactyl={NS}>
<statusbar id="status-bar" dactyl:highlight="StatusLine StatusNormal">
<!-- insertbefore="dactyl.statusBefore;" insertafter="dactyl.statusAfter;" -->
<hbox
style="background: inherit;" id={_status + "container"} flex="1" hidden="false" align="center">
<stack orient="horizontal" align="stretch" flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine">
<hbox class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine">
<label class="plain" id={_status + "mode"} crop="end" collapsed="true"/>
<stack flex="1" class="dactyl-container" dactyl:highlight="CmdLine StatusCmdLine">
<textbox class="plain" id={_status + "url"} crop="end" flex="1" readonly="true"/>
<textbox class="plain" id={_status + "message"} crop="end" flex="1" readonly="true" dactyl:highlight="Normal StatusNormal"/>
</stack>
</hbox>
<hbox id={_status + "commandline"} hidden="false" class="dactyl-container" dactyl:highlight="Normal StatusNormal" collapsed="true">
<label id={_status + "commandline-prompt"} class="dactyl-commandline-prompt plain" flex="0" crop="end" value="" collapsed="true"/>
<textbox id={_status + "commandline-command"} class="dactyl-commandline-command plain" flex="1" type="text" timeout="100"
oninput={_commandline + ".onEvent(event);"} onkeyup={_commandline + ".onEvent(event);"}
onfocus={_commandline + ".onEvent(event);"} onblur={_commandline + ".onEvent(event);"}/>
</hbox>
</stack>
<label class="plain" id={_status + "inputbuffer"} flex="0"/>
<label class="plain" id={_status + "progress"} flex="0"/>
<label class="plain" id={_status + "tabcount"} flex="0"/>
<label class="plain" id={_status + "bufferposition"} flex="0"/>
<label class="plain" id={_status + "zoomlevel"} flex="0"/>
</hbox>
<!-- just hide them since other elements expect them -->
<statusbarpanel id="statusbar-display" hidden="true"/>
<statusbarpanel id="statusbar-progresspanel" hidden="true"/>
</statusbar>
</e4x>.*
});
this._statusLine = document.getElementById("status-bar");
this.statusBar = document.getElementById("addon-bar") || this._statusLine;
this.statusBar.collapsed = true; // it is later restored unless the user sets laststatus=0