Merge lp:~bdrung/firefox-extensions/mozgest.ubuntu into lp:~ubuntu-dev/firefox-extensions/mozgest.ubuntu

Proposed by Benjamin Drung
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bdrung/firefox-extensions/mozgest.ubuntu
Merge into: lp:~ubuntu-dev/firefox-extensions/mozgest.ubuntu
Diff against target: None lines
To merge this branch: bzr merge lp:~bdrung/firefox-extensions/mozgest.ubuntu
Reviewer Review Type Date Requested Status
Alexander Sack Pending
Review via email: mp+9280@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Benjamin Drung (bdrung) wrote :

New upstream release 2.1.4

28. By Benjamin Drung

RELEASE version 2.1.4-0ubuntu1 to ubuntu/karmic

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.bzr-builddeb'
2=== added file '.bzr-builddeb/default.conf'
3--- .bzr-builddeb/default.conf 1970-01-01 00:00:00 +0000
4+++ .bzr-builddeb/default.conf 2009-07-25 23:01:05 +0000
5@@ -0,0 +1,4 @@
6+[BUILDDEB]
7+merge = True
8+export-upstream-revision = revid:bdrung@ubuntu.com-20090725215038-wfimnbref3p8h3ev
9+export-upstream = .
10
11=== modified file 'chrome.manifest'
12--- chrome.manifest 2008-02-27 03:41:55 +0000
13+++ chrome.manifest 2009-07-25 21:50:38 +0000
14@@ -1,6 +1,4 @@
15 overlay chrome://browser/content/browser.xul chrome://mozgest/content/mozgestOverlay.xul
16-overlay chrome://browser/content/bookmarks/bookmarksProperties.xul chrome://mozgest/content/bmPropsOverlay.xul
17-overlay chrome://browser/content/places/bookmarkProperties.xul chrome://mozgest/content/bmPropsOverlay.xul
18
19 overlay chrome://global/content/viewSource.xul chrome://mozgest/content/mozgestOverlay.xul
20 overlay chrome://global/content/viewPartialSource.xul chrome://mozgest/content/mozgestOverlay.xul
21@@ -12,7 +10,6 @@
22 overlay chrome://navigator/content/navigator.xul chrome://mozgest/content/mozgestOverlay.xul
23 overlay chrome://navigator/content/viewSource.xul chrome://mozgest/content/mozgestOverlay.xul
24 overlay chrome://navigator/content/viewPartialSource.xul chrome://mozgest/content/mozgestOverlay.xul
25-overlay chrome://communicator/content/bookmarks/bm-props.xul chrome://mozgest/content/bmPropsOverlay.xul
26
27 content mozgest jar:chrome/mozgest.jar!/content/
28 skin mozgest classic/1.0 jar:chrome/mozgest.jar!/skin/classic/
29@@ -21,18 +18,19 @@
30 style chrome://global/content/customizeToolbar.xul chrome://mozgest/skin/mozgest.css
31
32 locale mozgest en-US jar:chrome/mozgest.jar!/locale/en-US/
33-locale mozgest ca-AD jar:chrome/mozgest.jar!/locale/ca-AD/
34-locale mozgest cs-CZ jar:chrome/mozgest.jar!/locale/cs-CZ/
35 locale mozgest de-DE jar:chrome/mozgest.jar!/locale/de-DE/
36-locale mozgest el-GR jar:chrome/mozgest.jar!/locale/el-GR/
37+locale mozgest da-DK jar:chrome/mozgest.jar!/locale/da-DK/
38 locale mozgest es-ES jar:chrome/mozgest.jar!/locale/es-ES/
39 locale mozgest fr-FR jar:chrome/mozgest.jar!/locale/fr-FR/
40-locale mozgest hu-HU jar:chrome/mozgest.jar!/locale/hu-HU/
41+locale mozgest it-IT jar:chrome/mozgest.jar!/locale/it-IT/
42 locale mozgest ja-JP jar:chrome/mozgest.jar!/locale/ja-JP/
43+locale mozgest ko-KR jar:chrome/mozgest.jar!/locale/ko-KR/
44 locale mozgest lt-LT jar:chrome/mozgest.jar!/locale/lt-LT/
45 locale mozgest nl-NL jar:chrome/mozgest.jar!/locale/nl-NL/
46 locale mozgest pl-PL jar:chrome/mozgest.jar!/locale/pl-PL/
47 locale mozgest pt-PT jar:chrome/mozgest.jar!/locale/pt-PT/
48 locale mozgest ru-RU jar:chrome/mozgest.jar!/locale/ru-RU/
49 locale mozgest sk-SK jar:chrome/mozgest.jar!/locale/sk-SK/
50-locale mozgest zh-CN jar:chrome/mozgest.jar!/locale/zh-CN/
51\ No newline at end of file
52+locale mozgest sv-SE jar:chrome/mozgest.jar!/locale/sv-SE/
53+locale mozgest zh-CN jar:chrome/mozgest.jar!/locale/zh-CN/
54+locale mozgest zh-TW jar:chrome/mozgest.jar!/locale/zh-TW/
55\ No newline at end of file
56
57=== removed file 'chrome/content/bmPropsOverlay.xul'
58--- chrome/content/bmPropsOverlay.xul 2008-02-27 03:41:55 +0000
59+++ chrome/content/bmPropsOverlay.xul 1970-01-01 00:00:00 +0000
60@@ -1,144 +0,0 @@
61-<?xml version="1.0"?>
62-<!-- ***** BEGIN LICENSE BLOCK *****
63- - Version: MPL 1.1/GPL 2.0/LGPL 2.1
64- -
65- - The contents of this file are subject to the Mozilla Public License Version
66- - 1.1 (the "License"); you may not use this file except in compliance with
67- - the License. You may obtain a copy of the License at
68- - http://www.mozilla.org/MPL/
69- -
70- - Software distributed under the License is distributed on an "AS IS" basis,
71- - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
72- - for the specific language governing rights and limitations under the
73- - License.
74- -
75- - The Original Code is MozGest Bookmarkproperties.
76- -
77- - The Initial Developer of the Original Code is Jochen Schlehuber.
78- - Portions created by the Initial Developer are Copyright (C) 2004
79- - the Initial Developer. All Rights Reserved.
80- -
81- - Contributor(s) (alphabetical order):
82- - Jochen <bugs@krickelkrackel.de>
83- -
84- - Alternatively, the contents of this file may be used under the terms of
85- - either the GNU General Public License Version 2 or later (the "GPL"), or
86- - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
87- - in which case the provisions of the GPL or the LGPL are applicable instead
88- - of those above. If you wish to allow use of your version of this file only
89- - under the terms of either the GPL or the LGPL, and not to allow others to
90- - use your version of this file under the terms of the MPL, indicate your
91- - decision by deleting the provisions above and replace them with the notice
92- - and other provisions required by the LGPL or the GPL. If you do not delete
93- - the provisions above, a recipient may use your version of this file under
94- - the terms of any one of the MPL, the GPL or the LGPL.
95- -
96- - ***** END LICENSE BLOCK ***** -->
97-
98-<!DOCTYPE overlay SYSTEM "chrome://mozgest/locale/mozgest.dtd">
99-
100-<overlay id="mozgest"
101- xmlns:html="http://www.w3.org/1999/xhtml"
102- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
103-
104- <script type="application/x-javascript" src="defaults.js"/>
105- <script type="application/x-javascript" src="mozgestCommon.js"/>
106- <script type="application/x-javascript" src="componentLoader.js"/>
107-
108- <script type="application/x-javascript">
109- <![CDATA[
110- var mozgestOverlay = {
111- mgMappingsObserver : {
112- observe: function(subject, topic, data) {
113- if (topic == "mozgestControl" && data == "mappingsUpdated")
114- mozgestOverlay.mgBMinit();
115- }
116- },
117-
118- mgAddObserver : function() {
119- Components.classes["@mozilla.org/observer-service;1"]
120- .getService(Components.interfaces.nsIObserverService)
121- .addObserver(mozgestOverlay.mgMappingsObserver, "mozgestControl", false);
122- },
123-
124- mgRemoveObserver : function() {
125- Components.classes["@mozilla.org/observer-service;1"]
126- .getService(Components.interfaces.nsIObserverService)
127- .removeObserver(mozgestOverlay.mgMappingsObserver, "mozgestControl");
128- },
129-
130- mgBMinit : function() {
131- if (document.getElementById("keywordRow")) {
132- this.sRow = document.getElementById("keywordRow");
133- this.bm = mgBMService.plBook.getItemGUID(window.arguments[0].bookmarkId);
134- }
135- else {
136- this.sRow = document.getElementById("shortcutrow")
137- this.bm = window.arguments[0];
138- }
139- document.argss=window.arguments;
140-
141- if (this.sRow.getAttribute("hidden"))
142- return;
143-
144- if (!this.mgList) {
145- this.mgRow = document.createElement("row")
146- this.mgRow.id = "mozgestRow"
147- this.mgRow.align = "center"
148-
149- this.mgLabel = document.createElement("label")
150- this.mgLabel.setAttribute("value", mgGetString("bmPropsLabel"))
151- this.mgRow.appendChild(this.mgLabel)
152-
153- this.mgList = document.createElement("menulist")
154- this.mgLabel = mgGetString("editGesture")
155- this.mgList.setAttribute("label", this.mgLabel)
156- this.mgRow.appendChild(this.mgList)
157-
158- this.sRow.parentNode.insertBefore(this.mgRow, this.sRow.nextSibling)
159- sizeToContent()
160- }
161-
162- this.mgList.removeAllItems()
163-
164- var mapTable = _mgMS.activeMappings["browser"]
165- var gestureFound = false
166-
167- for (mapping in mapTable) {
168- if (mapTable[mapping].func == this.bm) {
169- gestureFound = true
170- var aCode = mgMappingLocalizer.localize(mapping)
171- this.mItem = this.mgList
172- .appendItem(aCode + " " + decodeURIComponent(mapTable[mapping].name), mapping)
173-
174- this.mItem.setAttribute("oncommand",
175- "mozgestOverlay.mgEditMapping('directEdit', this.value)");
176- }
177- }
178- if (gestureFound)
179- this.mgList.menupopup.appendChild(document.createElement("menuseparator"));
180-
181- this.mItem = this.mgList.appendItem(mgGetString("newGesture"), this.bm);
182- this.mItem.setAttribute("oncommand",
183- "mozgestOverlay.mgEditMapping('New', this.value)");
184- this.mgList.setAttribute("label", this.mgLabel)
185- },
186-
187- mgEditMapping : function(editMode, mgValue) {
188- if (editMode == "New")
189- _mgMS.curBookmark = this.bm;
190-
191- this.mgList.selectedIndex = -1
192- this.mgList.setAttribute("label", this.mgLabel)
193- mgCommon.openDialog("chrome://mozgest/content/pref/mappings.xul", [editMode, "browser", mgValue])
194- _mgMS.curBookmark = null
195- }
196- }
197-
198- addEventListener("load", function() {mozgestOverlay.mgBMinit()}, true)
199- addEventListener("unload", function() {mozgestOverlay.mgRemoveObserver()}, true)
200- mozgestOverlay.mgAddObserver()
201- ]]>
202- </script>
203-
204-</overlay>
205\ No newline at end of file
206
207=== removed file 'chrome/content/componentLoader.js'
208--- chrome/content/componentLoader.js 2008-02-27 03:41:55 +0000
209+++ chrome/content/componentLoader.js 1970-01-01 00:00:00 +0000
210@@ -1,74 +0,0 @@
211-/* ***** BEGIN LICENSE BLOCK *****
212- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
213- *
214- * The contents of this file are subject to the Mozilla Public License Version
215- * 1.1 (the "License"); you may not use this file except in compliance with
216- * the License. You may obtain a copy of the License at
217- * http://www.mozilla.org/MPL/
218- *
219- * Software distributed under the License is distributed on an "AS IS" basis,
220- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
221- * for the specific language governing rights and limitations under the
222- * License.
223- *
224- * The Original Code is Mouse Gestures (Component loader).
225- *
226- * The Initial Developer of the Original Code is Jochen Schlehuber.
227- * Portions created by the Initial Developer are Copyright (C) 2005
228- * the Initial Developer. All Rights Reserved.
229- *
230- * Contributor(s) (alphabetical order):
231- * Jochen <bugs@krickelkrackel.de>
232- *
233- * Alternatively, the contents of this file may be used under the terms of
234- * either the GNU General Public License Version 2 or later (the "GPL"), or
235- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
236- * in which case the provisions of the GPL or the LGPL are applicable instead
237- * of those above. If you wish to allow use of your version of this file only
238- * under the terms of either the GPL or the LGPL, and not to allow others to
239- * use your version of this file under the terms of the MPL, indicate your
240- * decision by deleting the provisions above and replace them with the notice
241- * and other provisions required by the GPL or the LGPL. If you do not delete
242- * the provisions above, a recipient may use your version of this file under
243- * the terms of any one of the MPL, the GPL or the LGPL.
244- *
245- * ***** END LICENSE BLOCK ***** */
246-
247-// global variables
248-var mgMouseService = false;
249-var mgNativeTrails = false;
250-var mgMouseEvents = false;
251-
252-var mgComponentLoader = {
253- init : false,
254-
255- initMouseService : function(setMain) {
256- if (this.init)
257- return;
258-
259- this.init = true;
260-
261- if (("@mousegestures.org/mgMouseService;1" in Components.classes)) {
262- try {
263- mgMouseService = Components.classes["@mousegestures.org/mgMouseService;1"]
264- .getService().QueryInterface(Components.interfaces.mgIMouseService);
265-
266- mgNativeTrails = mgMouseService.supports("nativeTrails");
267- mgMouseEvents = mgMouseService.supports("mouseEvents");
268-
269- //if (setMain) {
270- var baseWin = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
271- .getInterface(Components.interfaces.nsIWebNavigation)
272- .QueryInterface(Components.interfaces.nsIBaseWindow);
273-
274- mgMouseService.setMainWin(baseWin, null);
275- //}
276- }
277- catch (e) {}
278- }
279- }
280-}
281-
282-var _mgMS = Components.classes["@mousegestures.org/mgMappingsService;1"].getService();
283-_mgMS = _mgMS.wrappedJSObject;
284-_mgMS.initMappings();
285\ No newline at end of file
286
287=== added file 'chrome/content/contextOverlay.xul'
288--- chrome/content/contextOverlay.xul 1970-01-01 00:00:00 +0000
289+++ chrome/content/contextOverlay.xul 2009-07-25 21:50:38 +0000
290@@ -0,0 +1,123 @@
291+<?xml-stylesheet href="chrome://mozgest/skin/mozgest.css" type="text/css"?>
292+<!DOCTYPE overlay SYSTEM "chrome://mozgest/locale/mozgest.dtd" >
293+
294+<overlay id="mozgestContextOverlay"
295+ xmlns:html="http://www.w3.org/1999/xhtml"
296+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
297+
298+ <script type="application/x-javascript">
299+ <![CDATA[
300+ function mgUpdateQuickSettings(target) {
301+ var items = target.getElementsByAttribute("mgPref", "*");
302+
303+ for (var x = 0; x < items.length; x++)
304+ items[x].setAttribute("checked", mgPrefs.prefs.getBoolPref(items[x].getAttribute("mgPref")));
305+
306+ var trailItem = target.getElementsByAttribute("mgPref", "trails.enabled");
307+ trailItem[0].hidden = (window.mgNativeTrails) ? false : true;
308+
309+ var item = target.ownerDocument.getElementById("mgQuickButton" + mgPrefs.prefs.getIntPref("mousebutton"));
310+ item.setAttribute("checked", true);
311+ }
312+
313+ function mgToggleQuickSettings(target) {
314+ if (!target.hasAttribute("id")) {
315+ var qPref = target.getAttribute("mgPref");
316+ mgPrefs.prefs.setBoolPref(qPref, !mgPrefs.prefs.getBoolPref(qPref));
317+ }
318+ else
319+ mgPrefs.prefs.setIntPref("mousebutton", target.id.substring(13));
320+ }
321+
322+ function mgUpdateGestureHistory(target) {
323+ while (target.childNodes.length > 1)
324+ target.removeChild(target.firstChild);
325+
326+ var h
327+
328+ if ("mgState" in window)
329+ h = mgState.history;
330+ else if (parent && parent.mgState)
331+ h = parent.mgState.history;
332+ else
333+ h = _mgMS.history;
334+
335+ for (var x = 0; x < h.length; x++) {
336+ var item = document.createElement("menuitem");
337+ item.setAttribute("label", h[x][0] + " ");
338+ item.setAttribute("acceltext", h[x][1]);
339+ item.setAttribute("disabled", true);
340+ target.insertBefore(item, target.lastChild);
341+ }
342+ }
343+ ]]>
344+ </script>
345+
346+ <popup id="mgSidebarContext">
347+ <menuitem position="1"
348+ oncommand="mgCommon.openDialog('chrome://mozgest/content/pref/mappings.xul',['winTypeEdit', mgWindowType, null])"
349+ label="&btnMappings;"
350+ accesskey="&sidebar.mappings.key;"/>
351+ <menuitem insertbefore="mgSidebarSettingsSep"
352+ oncommand="mgCommon.openDialog('chrome://mozgest/content/pref/pref-mozgest.xul')"
353+ label="&sidebar.settings;"
354+ accesskey="&sidebar.settings.key;" />
355+
356+ <menu insertbefore="mgSidebarSettingsSep"
357+ label="&sidebar.quicksettings;"
358+ accesskey="&sidebar.quicksettings.key;">
359+ <menupopup id="mgQuickSettingsPopup"
360+ onpopupshowing="mgUpdateQuickSettings(this)"
361+ oncommand="mgToggleQuickSettings(event.target)">
362+ <menuitem type="radio" label="&condition.LMB;" id="mgQuickButton0"/>
363+ <menuitem type="radio" label="&condition.MMB;" id="mgQuickButton1"/>
364+ <menuitem type="radio" label="&condition.RMB;" id="mgQuickButton2"/>
365+ <menuseparator/>
366+ <menuitem label="&additional.strokesEnabled;"
367+ type="checkbox"
368+ mgPref="enableStrokes"/>
369+ <menuitem label="&additional.rockersEnabled;"
370+ type="checkbox"
371+ mgPref="enableRockers"/>
372+ <menuitem label="&additional.wheelRockersEnabled;"
373+ type="checkbox"
374+ mgPref="enableWheelRockers"/>
375+ <menuseparator/>
376+ <menuitem label="&trails.enabled;"
377+ type="checkbox"
378+ mgPref="trails.enabled"/>
379+ <menuitem label="&status.enabled;"
380+ type="checkbox"
381+ mgPref="status.isEnabled"/>
382+ <menuseparator/>
383+ <menuitem label="&condition.left;"
384+ type="checkbox"
385+ mgPref="lefthanded"/>
386+ </menupopup>
387+ </menu>
388+
389+ <menuseparator insertbefore="mgSidebarSettingsSep"/>
390+
391+ <menu id="historyMenu" insertbefore="mgSidebarSettingsSep"
392+ label="&sidebar.history;"
393+ accesskey="&sidebar.history.key;">
394+
395+ <menupopup id="mgHistoryPopup"
396+ onpopupshowing="mgUpdateGestureHistory(this)">
397+ <menuitem label="&sidebar.history.more;"
398+ mgMenuItem="true"
399+ disabled="true"/>
400+ </menupopup>
401+ </menu>
402+
403+ <menuitem insertbefore="mgSidebarSortSep"
404+ oncommand="mgCommon.showWebPage('http://www.mousegestures.org')"
405+ label="&visit.home;"
406+ accesskey="&sidebar.visit.home.key;"/>
407+
408+ <menuitem insertbefore="mgSidebarSortSep"
409+ oncommand="mgCommon.showWebPage('http://www.mousegestures.org/exchange/')"
410+ label="&visit.exchange;"
411+ accesskey="&sidebar.visit.exchange.key;"/>
412+ </popup>
413+</overlay>
414\ No newline at end of file
415
416=== modified file 'chrome/content/defaults.js'
417--- chrome/content/defaults.js 2008-02-27 03:41:55 +0000
418+++ chrome/content/defaults.js 2009-07-25 21:50:38 +0000
419@@ -8,99 +8,109 @@
420 mailcompose : new Array()
421 },
422
423- /* =================================================================================
424+ /* ============================================================================
425 func: is important!
426 func can be: built-in-function, script-code, keyboard-shortcut, bookmark-id
427- =================================================================================
428- x[mapping] = {func:xxx, type:xxx, name:xxx, count:xxx}
429- type = 0 -> normal gesture
430- func is predefined (no name)
431- note: 0 will never be stored
432- type = 1 -> custom gesture
433- func is a JavaScript snippet (evaled)
434- type = 2 -> keyboard gesture
435- func is a mixture of ctrl|alt|shift|meta and keyCode|charcode
436- and will be fired to document.documentElement
437- type = 9x -> bookmark gesture
438- func is a unique bookmark id
439- 90 -> current Window
440- 91 -> new Window
441- 92 -> current Tab
442- 93 -> new Tab
443- 94 -> Sidebar
444- ================================================================================= */
445+ ============================================================================
446+ x[mapping] = {func:xxx, type:xxx, name:xxx, count:xxx, cat:xxx}
447+ type = 0 -> normal gesture
448+ func is predefined (no name)
449+ note: 0 will never be stored
450+ type = 1 -> custom gesture
451+ func is a JavaScript snippet (evaled)
452+ type = 2 -> keyboard gesture
453+ func is a mixture of ctrl|alt|shift|meta and keyCode|charcode
454+ and will be fired to document.documentElement
455+ type = 9x -> bookmark gesture
456+ func is a unique bookmark id
457+ 90 -> current Window
458+ 91 -> new Window
459+ 92 -> current Tab
460+ 93 -> new Tab
461+ 94 -> Sidebar
462+ ============================================================================
463+ cat: The category of the gesture
464+ 0: Miscellaneous (everything that is not 1-6)
465+ 1: Navigation (e.g. back)
466+ 2: Tabbed Browsing (e.g. mgB_OpenTab)
467+ 3: Window Management (e.g. mgW_CloseWin)
468+ 4: Zooming, Scrolling, DOM-Manipulation (e.g. mgB_ZoomIn)
469+ 5: Links and Bookmarks (e.g. mgB_LinksInWindows)
470+ 6: Message Management (e.g. mgM_NextMessage, only TB and SM)
471+ ============================================================================ */
472
473 init : function() {
474 // "b" == browser
475 var b = this.mappings.browser;
476- b[":02"] = {func: "mgB_Forward"}
477- b[":20"] = {func: "mgB_Back"}
478- b[":12"] = {func: "mgB_NextTab"}
479- b[":10"] = {func: "mgB_PreviousTab"}
480- b[":2+"] = {func: "mgB_NextTab"}
481- b[":2-"] = {func: "mgB_PreviousTab"}
482- b["L"] = {func: "mgB_Back"}
483- b["R"] = {func: "mgB_Forward"}
484- b["LU"] = {func: "mgB_Stop"}
485- b["DURD"] = {func: "mgB_Home"}
486- b["D"] = {func: "mgB_OpenNewDocument"}
487- b["U"] = {func: "mgB_OpenTab"}
488- b["UR"] = {func: "mgB_NextTab"}
489- b["UL"] = {func: "mgB_PreviousTab"}
490- b["ULU"] = {func: "mgB_UpDir"}
491- b["DR"] = {func: "mgB_CloseTab"}
492- b["RD"] = {func: "mgB_ViewPageInfo"}
493- b["LDRDL"] = {func: "mgB_ViewPageSource"}
494- b["DRDLU"] = {func: "mgB_AddBookmark"}
495- b["RUDR"] = {func: "mgB_DoubleStackWin"}
496- b["9"] = {func: "mgB_HideImage"}
497- b["3"] = {func: "mgB_ZoomIn_DoubleImage"}
498- b["7"] = {func: "mgB_ZoomOut_HalveImage"}
499- b["1"] = {func: "mgB_ResetZoom"}
500- b["31"] = {func: "mgB_ZoomIn"}
501- b["13"] = {func: "mgB_ZoomOut"}
502- b["*RU"] = {func: "mgB_LinksInWindows"}
503- b["*RUL"] = {func: "mgB_LinksInTabs"}
504+ b[":02"] = {func: "mgB_Forward", cat: 1}
505+ b[":20"] = {func: "mgB_Back", cat: 1}
506+ b[":12"] = {func: "mgB_NextTab", cat: 2}
507+ b[":10"] = {func: "mgB_PreviousTab", cat: 2}
508+ b[":2+"] = {func: "mgB_NextTab", cat: 2}
509+ b[":2-"] = {func: "mgB_PreviousTab", cat: 2}
510+ b["L"] = {func: "mgB_Back", cat: 1}
511+ b["R"] = {func: "mgB_Forward", cat: 1}
512+ b["LU"] = {func: "mgB_Stop", cat: 1}
513+ b["DURD"] = {func: "mgB_Home", cat: 1}
514+ b["D"] = {func: "mgB_OpenNewDocument", cat: 3}
515+ b["U"] = {func: "mgB_OpenTab", cat: 2}
516+ b["UR"] = {func: "mgB_NextTab", cat: 2}
517+ b["UL"] = {func: "mgB_PreviousTab", cat: 2}
518+ b["UD"] = {func: "mgB_Reload", cat: 1}
519+ b["ULU"] = {func: "mgB_UpDir", cat: 1}
520+ b["DR"] = {func: "mgB_CloseTab", cat: 2}
521+ b["RD"] = {func: "mgB_ViewPageInfo", cat: 3}
522+ b["LDRDL"] = {func: "mgB_ViewPageSource", cat: 3}
523+ b["DRDLU"] = {func: "mgB_AddBookmark", cat: 5}
524+ b["RUDR"] = {func: "mgB_DoubleStackWin", cat: 3}
525+ b["9"] = {func: "mgB_HideImage", cat: 4}
526+ b["3"] = {func: "mgB_ZoomIn_DoubleImage", cat: 4}
527+ b["7"] = {func: "mgB_ZoomOut_HalveImage", cat: 4}
528+ b["1"] = {func: "mgB_ResetZoom", cat: 4}
529+ b["31"] = {func: "mgB_ZoomIn", cat: 4}
530+ b["13"] = {func: "mgB_ZoomOut", cat: 4}
531+ b["*RU"] = {func: "mgB_LinksInWindows", cat: 5}
532+ b["*RUL"] = {func: "mgB_LinksInTabs", cat: 5}
533
534 //"vs" == viewsource
535 var vs = this.mappings.viewsource;
536- vs["3"] = {func: "mgB_ZoomIn"}
537- vs["7"] = {func: "mgB_ZoomOut"}
538- vs["1"] = {func: "mgB_ResetZoom"}
539+ vs["3"] = {func: "mgB_ZoomIn", cat:4}
540+ vs["7"] = {func: "mgB_ZoomOut", cat: 4}
541+ vs["1"] = {func: "mgB_ResetZoom", cat: 4}
542
543 //"w" == generic (for all window types)
544 var w = this.mappings.window;
545- w["9L3"] = {func: "mgW_Cut"}
546- w["93"] = {func: "mgW_Copy"}
547- w["39"] = {func: "mgW_Paste"}
548- w["DRD"] = {func: "mgW_CloseWin"}
549- w["DL"] = {func: "mgW_MinWin"}
550- w["RU"] = {func: "mgW_RestMaxWin"}
551- w["U1"] = {func: "mgW_ScrollUp"}
552- w["D7"] = {func: "mgW_ScrollDown"}
553- w["R7"] = {func: "mgW_ScrollRight"}
554- w["L9"] = {func: "mgW_ScrollLeft"}
555+ w["9L3"] = {func: "mgW_Cut", cat: 0}
556+ w["93"] = {func: "mgW_Copy", cat: 0}
557+ w["39"] = {func: "mgW_Paste", cat: 0}
558+ w["DRD"] = {func: "mgW_CloseWin", cat: 3}
559+ w["DL"] = {func: "mgW_MinWin", cat: 3}
560+ w["RU"] = {func: "mgW_RestMaxWin", cat: 3}
561+ w["U1"] = {func: "mgW_ScrollUp", cat: 4}
562+ w["D7"] = {func: "mgW_ScrollDown", cat: 4}
563+ w["R7"] = {func: "mgW_ScrollRight", cat: 4}
564+ w["L9"] = {func: "mgW_ScrollLeft", cat: 4}
565
566 //"m" == messenger
567 var m = this.mappings.messenger;
568- m[":20"] = {func: "mgM_PrevMessage"}
569- m[":02"] = {func: "mgM_NextMessage"}
570- m["L"] = {func: "mgM_PrevMessage"}
571- m["R"] = {func: "mgM_NextMessage"}
572- m["DRU"] = {func: "mgM_DeleteMessage"}
573- m["DUR"] = {func: "mgM_ReplyMessage"}
574- m["DURL"] = {func: "mgM_ForwardMessage"}
575- m["UD"] = {func: "mgM_Reload"}
576- m["DURD"] = {func: "mgM_Home"}
577- m["D"] = {func: "mgM_NewMessage"}
578- m["*RUL"] = {func: "mgM_OpenLinks"}
579- m["URD"] = {func: "mgM_ViewSource"}
580- m["9"] = {func: "mgB_HideImage"}
581- m["3"] = {func: "mgB_ZoomIn_DoubleImage"}
582- m["7"] = {func: "mgB_ZoomOut_HalveImage"}
583- m["1"] = {func: "mgB_ResetZoom"}
584- m["31"] = {func: "mgB_ZoomIn"}
585- m["13"] = {func: "mgB_ZoomOut"}
586+ m[":20"] = {func: "mgM_PrevMessage", cat: 6}
587+ m[":02"] = {func: "mgM_NextMessage", cat: 6}
588+ m["L"] = {func: "mgM_PrevMessage", cat: 6}
589+ m["R"] = {func: "mgM_NextMessage", cat: 6}
590+ m["DRU"] = {func: "mgM_DeleteMessage", cat: 6}
591+ m["DUR"] = {func: "mgM_ReplyMessage", cat: 6}
592+ m["DURL"] = {func: "mgM_ForwardMessage", cat: 6}
593+ m["UD"] = {func: "mgM_Reload", cat: 1}
594+ m["DURD"] = {func: "mgM_Home", cat: 1}
595+ m["D"] = {func: "mgM_NewMessage", cat: 6}
596+ m["*RUL"] = {func: "mgM_OpenLinks", cat: 5}
597+ m["URD"] = {func: "mgM_ViewSource", cat: 3}
598+ m["9"] = {func: "mgB_HideImage", cat: 4}
599+ m["3"] = {func: "mgB_ZoomIn_DoubleImage", cat: 4}
600+ m["7"] = {func: "mgB_ZoomOut_HalveImage", cat: 4}
601+ m["1"] = {func: "mgB_ResetZoom", cat: 4}
602+ m["31"] = {func: "mgB_ZoomIn", cat: 4}
603+ m["13"] = {func: "mgB_ZoomOut", cat: 4}
604
605 //"mc" == mailcompose
606 var mc = this.mappings.mailcompose;
607@@ -128,60 +138,61 @@
608 will work in (B)rowser, (M)essenger and (V)iew(S)ource
609 ====================================================== */
610 var b = this.functions.browser;
611- b["mgB_AddBookmark"] = ["B"]
612- b["mgB_Back"] = ["B"]
613- b["mgB_CloseDoc"] = ["B"]
614- b["mgB_CloseTab"] = ["B"]
615- b["mgB_DoubleImageSize"] = ["B", "M"]
616- b["mgB_DoubleStackWin"] = ["B"]
617- b["mgB_Forward"] = ["B"]
618- b["mgB_HalveImageSize"] = ["B", "M"]
619- b["mgB_HideImage"] = ["B", "M"]
620- b["mgB_Home"] = ["B"]
621- b["mgB_LinksInTabs"] = ["B"]
622- b["mgB_LinksInWindows"] = ["B"]
623- b["mgB_NextTab"] = ["B"]
624- b["mgB_OpenNewDocument"] = ["B"]
625- b["mgB_OpenTab"] = ["B"]
626- b["mgB_PreviousTab"] = ["B"]
627- b["mgB_Reload"] = ["B"]
628- b["mgB_ResetZoom"] = ["B", "M", "VS"]
629- b["mgB_Stop"] = ["B"]
630- b["mgB_UpDir"] = ["B"]
631- b["mgB_ViewPageInfo"] = ["B"]
632- b["mgB_ViewPageSource"] = ["B"]
633- b["mgB_ZoomIn"] = ["B", "M", "VS"]
634- b["mgB_ZoomIn_DoubleImage"] = ["B", "M"]
635- b["mgB_ZoomOut"] = ["B", "M", "VS"]
636- b["mgB_ZoomOut_HalveImage"] = ["B", "M"]
637+ b["mgB_AddBookmark"] = ["B", "cat5"]
638+ b["mgB_Back"] = ["B", "cat1"]
639+ b["mgB_CloseDoc"] = ["B", "cat3"]
640+ b["mgB_CloseTab"] = ["B", "cat2"]
641+ b["mgB_DoubleImageSize"] = ["B", "M", "cat4"]
642+ b["mgB_DoubleStackWin"] = ["B", "cat3"]
643+ b["mgB_Forward"] = ["B", "cat1"]
644+ b["mgB_HalveImageSize"] = ["B", "M", "cat4"]
645+ b["mgB_HideImage"] = ["B", "M", "cat4"]
646+ b["mgB_Home"] = ["B", "cat1"]
647+ b["mgB_LinksInTabs"] = ["B", "cat5"]
648+ b["mgB_LinksInWindows"] = ["B", "cat5"]
649+ b["mgB_NextTab"] = ["B", "cat2"]
650+ b["mgB_OpenNewDocument"] = ["B", "cat3"]
651+ b["mgB_OpenTab"] = ["B", "cat2"]
652+ b["mgB_PreviousTab"] = ["B", "cat2"]
653+ b["mgB_Reload"] = ["B", "cat1"]
654+ b["mgB_ReloadSkipCache"] = ["B", "cat1"]
655+ b["mgB_ResetZoom"] = ["B", "M", "VS", "cat4"]
656+ b["mgB_Stop"] = ["B", "cat1"]
657+ b["mgB_UpDir"] = ["B", "cat1"]
658+ b["mgB_ViewPageInfo"] = ["B", "cat3"]
659+ b["mgB_ViewPageSource"] = ["B", "cat3"]
660+ b["mgB_ZoomIn"] = ["B", "M", "VS", "cat4"]
661+ b["mgB_ZoomIn_DoubleImage"] = ["B", "M", "cat4"]
662+ b["mgB_ZoomOut"] = ["B", "M", "VS", "cat4"]
663+ b["mgB_ZoomOut_HalveImage"] = ["B", "M", "cat4"]
664
665 // "w" == functions for all window types (generic)
666 var w = this.functions.window;
667- w["mgW_CloseWin"] = ["W"]
668- w["mgW_Copy"] = ["W"]
669- w["mgW_Cut"] = ["W"]
670- w["mgW_MinWin"] = ["W"]
671- w["mgW_Paste"] = ["W"]
672- w["mgW_RestMaxWin"] = ["W"]
673- w["mgW_ScrollDown"] = ["W"]
674- w["mgW_ScrollUp"] = ["W"]
675- w["mgW_ScrollRight"] = ["W"]
676- w["mgW_ScrollLeft"] = ["W"]
677+ w["mgW_CloseWin"] = ["W", "cat3"]
678+ w["mgW_Copy"] = ["W", "cat0"]
679+ w["mgW_Cut"] = ["W", "cat0"]
680+ w["mgW_MinWin"] = ["W", "cat3"]
681+ w["mgW_Paste"] = ["W", "cat0"]
682+ w["mgW_RestMaxWin"] = ["W", "cat3"]
683+ w["mgW_ScrollDown"] = ["W", "cat4"]
684+ w["mgW_ScrollUp"] = ["W", "cat4"]
685+ w["mgW_ScrollRight"] = ["W", "cat4"]
686+ w["mgW_ScrollLeft"] = ["W", "cat4"]
687
688 // "m" == functions for messenger
689 var m = this.functions.messenger;
690- m["mgM_DeleteMessage"] = ["M"]
691- m["mgM_ForwardMessage"] = ["M"]
692- m["mgM_Home"] = ["M"]
693- m["mgM_NewMessage"] = ["M"]
694- m["mgM_NextMessage"] = ["M"]
695- m["mgM_NextUnreadMessage"] = ["M"]
696- m["mgM_OpenLinks"] = ["M"]
697- m["mgM_PrevMessage"] = ["M"]
698- m["mgM_PrevUnreadMessage"] = ["M"]
699- m["mgM_Reload"] = ["M"]
700- m["mgM_ReplyMessage"] = ["M"]
701- m["mgM_ViewSource"] = ["M"]
702+ m["mgM_DeleteMessage"] = ["M", "cat6"]
703+ m["mgM_ForwardMessage"] = ["M", "cat6"]
704+ m["mgM_Home"] = ["M", "cat1"]
705+ m["mgM_NewMessage"] = ["M", "cat6"]
706+ m["mgM_NextMessage"] = ["M", "cat6"]
707+ m["mgM_NextUnreadMessage"] = ["M", "cat6"]
708+ m["mgM_OpenLinks"] = ["M", "cat5"]
709+ m["mgM_PrevMessage"] = ["M", "cat6"]
710+ m["mgM_PrevUnreadMessage"] = ["M", "cat6"]
711+ m["mgM_Reload"] = ["M", "cat1"]
712+ m["mgM_ReplyMessage"] = ["M", "cat6"]
713+ m["mgM_ViewSource"] = ["M", "cat3"]
714
715 // "mc" == functions for mailcompose
716 var mc = this.functions.mailcompose;
717@@ -202,14 +213,15 @@
718 p["grid"] = [15, 4, 500]
719 p["delay"] = [1000, 200, 10000]
720 p["lmbGestureLimit"] = [500, 100, 10000]
721- p["dragdropDelay"] = [400, 100, 10000]
722 p["staticRockersDelay"] = [1000, 200, 10000]
723 p["diagonalTolerance"] = [60, 0, 75]
724 p["mousebutton"] = navigator.platform.indexOf("Mac") == 0 ? [0, 0, 2] : [2, 0, 2]
725 p["trails.width"] = [4, 1, 100]
726 p["trails.interval"] = [2, 1, 100]
727+ p["status.align"] = [0, 0, 3]
728 p["status.timeout"] = [1000, 0, 5000]
729 p["selectedTabIndex"] = [3, 0, 3]
730+ p["scrollBy"] = [200, 1, 1000000]
731
732 // bool
733 p["browser"] = [true]
734@@ -228,13 +240,15 @@
735 p["modifier.shift"] = [false]
736 p["modifier.meta"] = [false]
737 p["trails.enabled"] = [false]
738- p["status.enabled"] = [true]
739+ p["status.isEnabled"] = [false]
740 p["status.rockers.enabled"] = [false]
741- p["sideBarToolTip"] = [true]
742+ p["sideBar.canvas"] = [true]
743+ p["sideBar.toolTip"] = [true]
744
745 // char
746 p["trails.color"] = ["#FF9900"]
747- p["sideBarSort"] = ["sortByUsage"]
748+ p["status.anchorElement"] = ["document.documentElement"]
749+ p["sideBar.sort"] = ["sortByUsage"]
750 p["importFrom"] = ["www.mousegestures.org"]
751 },
752
753
754=== modified file 'chrome/content/gestimp.js'
755--- chrome/content/gestimp.js 2008-02-27 03:41:55 +0000
756+++ chrome/content/gestimp.js 2009-07-25 21:50:38 +0000
757@@ -59,18 +59,28 @@
758 }
759
760 function mgB_AddBookmark() {
761- addBookmarkAs(document.getElementById('content'));
762+ setTimeout(function () {document.getElementById("Browser:AddBookmarkAs").doCommand()}, 50);
763 }
764
765 function mgB_CloseDoc() {
766 if (gBrowser.mTabs.length > 1)
767- gBrowser.removeCurrentTab();
768- else
769+ mgB_CloseTab();
770+ else if (!mgB_ClosePrintPreview())
771 mgW_CloseWin();
772 }
773
774 function mgB_CloseTab() {
775- getBrowser().removeCurrentTab();
776+ if (!mgB_ClosePrintPreview())
777+ getBrowser().removeCurrentTab();
778+}
779+
780+function mgB_ClosePrintPreview() {
781+ if (document.getElementById("print-preview-toolbar")) {
782+ PrintUtils.exitPrintPreview();
783+ return true;
784+ }
785+
786+ return false;
787 }
788
789 function mgB_DoubleImageSize() {
790@@ -83,7 +93,7 @@
791 window.moveTo(screen.availLeft, screen.availTop);
792 window.resizeTo(screen.availWidth/2, screen.availHeight);
793 tempW = mgNewBrowserWindow();
794- tempW.loadURI(globalOnLink[0].href, mgGetReferrer());
795+ tempW.loadURI(globalOnLink[0].href, mgGetReferrer(globalOnLink[0]));
796 tempW.moveTo(screen.availWidth/2 + (screen.width - screen.availWidth),
797 screen.availTop);
798 tempW.resizeTo(screen.availWidth/2, screen.availHeight);
799@@ -106,12 +116,12 @@
800 function mgB_LinksInTabs() {
801 var browser = getBrowser();
802 for (var i = 0; i < globalOnLink.length; i++)
803- tab = browser.addTab(globalOnLink[i].href, mgGetReferrer());
804+ tab = browser.addTab(globalOnLink[i].href, mgGetReferrer(globalOnLink[i]));
805 }
806
807 function mgB_LinksInWindows() {
808 for (var i = 0; i < globalOnLink.length; i++)
809- mgNewBrowserWindow().loadURI(globalOnLink[i].href, mgGetReferrer());
810+ mgNewBrowserWindow().loadURI(globalOnLink[i].href, mgGetReferrer(globalOnLink[i]));
811 }
812
813 function mgB_NextTab() {
814@@ -120,7 +130,7 @@
815
816 function mgB_OpenNewDocument() {
817 if(globalOnLink) // open link in new window
818- mgNewBrowserWindow().loadURI(globalOnLink[0].href, mgGetReferrer());
819+ mgNewBrowserWindow().loadURI(globalOnLink[0].href, mgGetReferrer(globalOnLink[0]));
820 else {
821 if (globalOnImage) // Open image in new window
822 window.open(globalOnImage.src);
823@@ -142,6 +152,11 @@
824 mgResetRocker();
825 }
826
827+function mgB_ReloadSkipCache() {
828+ BrowserReloadSkipCache();
829+ mgResetRocker();
830+}
831+
832 function mgB_Stop() {
833 BrowserStop();
834 }
835@@ -224,9 +239,9 @@
836
837 /*** HELPER FUNCTIONS ***/
838
839-function mgGetReferrer() {
840+function mgGetReferrer(aLink) {
841 try {
842- var mgRefURL = globalSrcEvent.target.ownerDocument.location.href;
843+ var mgRefURL = aLink.ownerDocument.location.href;
844
845 if (mgRefURL) {
846 var ioService = Components.classes["@mozilla.org/network/io-service;1"]
847@@ -242,8 +257,8 @@
848 return (globalSrcEvent.view != null) ? globalSrcEvent.view.getSelection() : "";
849 }
850
851-function mgLinkInTab(url) {
852- var tab = getBrowser().addTab(url, mgGetReferrer());
853+function mgLinkInTab(url, aLink) {
854+ var tab = getBrowser().addTab(url, mgGetReferrer(aLink));
855 if (!mgPrefs.root.getBoolPref("browser.tabs.loadInBackground"))
856 getBrowser().selectedTab = tab;
857 }
858@@ -266,11 +281,11 @@
859
860 function mgOpenTab() {
861 if (globalOnLink && globalOnLink.length > 0)
862- mgLinkInTab(globalOnLink[0].href);
863+ mgLinkInTab(globalOnLink[0].href, globalOnLink[0]);
864 else {
865 var sel = mgGetSelection().toString();
866 if (sel.match(/^(http)|(ftp):/))
867- mgLinkInTab(sel);
868+ mgLinkInTab(sel, null);
869 else
870 BrowserOpenTab();
871 }
872@@ -298,15 +313,6 @@
873 }
874 }
875
876-function mgViewPartialSource() {
877- var docCharset = null;
878- docCharset = "charset=" + globalSrcEvent.view.document.characterSet;
879- openDialog("chrome://global/content/viewPartialSource.xul", "_blank",
880- "scrollbars,resizable,chrome,dialog=no",
881- null, docCharset, mgGetSelection(), "selection");
882-}
883-
884-
885 /*** GENERIC FUNCTIONS ***/
886
887 function mgW_RestMaxWin() {
888@@ -318,8 +324,10 @@
889 }
890
891 function mgW_MinWin() {
892- if (window.minimize != 'undefined')
893+ if (window.minimize != 'undefined') {
894 window.minimize();
895+ mgResetRocker(true);
896+ }
897 }
898
899 function mgW_CloseWin() {
900@@ -342,19 +350,19 @@
901 }
902
903 function mgW_ScrollDown() {
904- globalSrcEvent.view.scrollBy(0, 200);
905+ globalSrcEvent.view.scrollBy(0, mgPrefs.scrollBy);
906 }
907
908 function mgW_ScrollUp() {
909- globalSrcEvent.view.scrollBy(0, -200);
910+ globalSrcEvent.view.scrollBy(0, -mgPrefs.scrollBy);
911 }
912
913 function mgW_ScrollRight() {
914- globalSrcEvent.view.scrollBy(200, 0);
915+ globalSrcEvent.view.scrollBy(mgPrefs.scrollBy, 0);
916 }
917
918 function mgW_ScrollLeft() {
919- globalSrcEvent.view.scrollBy(-200, 0);
920+ globalSrcEvent.view.scrollBy(-mgPrefs.scrollBy, 0);
921 }
922
923 /*** MESSENGER FUNCTIONS ***/
924
925=== modified file 'chrome/content/gestures.js'
926--- chrome/content/gestures.js 2008-02-27 03:41:55 +0000
927+++ chrome/content/gestures.js 2009-07-25 21:50:38 +0000
928@@ -59,12 +59,8 @@
929 where the ending of the gesture matches a specific pattern. */
930 function mgFireGesture(aGesture){
931 if (!mgFireGestureFromTable(aGesture)) {
932- if (!mgFireOnLinkGesture()) {
933- if (mgPrefs["status.enabled"])
934- mgStatusPopup.firstChild.value = mgGetString("g.unknown") + " " + mgState.localizedGesture;
935-
936- mgCommon.dump("MozGest: Unknown Gesture: " + aGesture + "\n");
937- }
938+ if (!mgFireOnLinkGesture())
939+ mgShowStatus(null, mgGetString("g.unknown") + " " + mgState.localizedGesture);
940 }
941 // clear global variables
942 globalOnLink = globalOnImage = globalSrcEvent = false;
943@@ -79,15 +75,27 @@
944 mapping = mgGetMapping(aGesture)[0];
945
946 if (mapping) {
947- if (mgPrefs.mousebutton == 0 && mgState.previousSelection && globalSrcEvent) {
948- mgGetSelection().removeAllRanges();
949- mgGetSelection().addRange(mgState.previousSelection);
950- mgState.previousSelection = null;
951- }
952-
953 mgState.gestureDone = true;
954 var message = mgGetMapping(aGesture)[1];
955- mgCommon.dump("MozGest: Invoking '" + message + "'\n");
956+ mgCommon.dump("Invoking '" + message + "'");
957+
958+ if (mgPrefs.mousebutton == 0) {
959+ try {
960+ if (mgState.inputField) {
961+ if (mgState.selStart != mgState.selEnd)
962+ mgState.inputField.setSelectionRange(mgState.selStart, mgState.selEnd);
963+ else
964+ mgState.inputField.setSelectionRange(mgState.inputField.selectionStart, mgState.inputField.selectionStart);
965+ }
966+
967+ if (mgState.previousSelection && globalSrcEvent) {
968+ mgGetSelection().removeAllRanges();
969+ mgGetSelection().addRange(mgState.previousSelection);
970+ mgState.previousSelection = null;
971+ }
972+ }
973+ catch (e) {}
974+ }
975
976 try {
977 var mType = (mapping.type) ? parseInt(mapping.type) : 0;
978@@ -98,14 +106,7 @@
979 mgFunctionToFire();
980 }
981 else if (mType == 2) {
982- var mData = mapping.func.split("|");
983- var ev = document.createEvent('KeyEvents');
984-
985- ev.initKeyEvent('keypress', true, true, null,
986- eval(mData[0]), eval(mData[1]), eval(mData[2]),
987- eval(mData[3]), parseInt(mData[4]), parseInt(mData[5]));
988-
989- document.documentElement.dispatchEvent(ev);
990+ setTimeout(mgFireKeyEvent, 10, mapping.func.split("|"))
991 }
992 else if (mgBMService.enabled || mgBMService.plEnabled) {
993 mgBmInfo.get(mapping.func);
994@@ -113,54 +114,54 @@
995 var mgPostData = { };
996
997 if (mgLocation) {
998- var mgLoadIn = parseInt(mapping.type.substring(1,2));
999-
1000- if (mgBMService.makeURI(mgLocation).scheme == "javascript")
1001- mgLoadIn = 0;
1002- else {
1003- var selString = mgGetSelection().toString().replace(/\s$/, "");
1004-
1005- var mgKeyW = mgBmInfo.key;
1006-
1007- if (mgKeyW) // if bookmark has a keyword, use browser-function to replace %s
1008- mgLocation = getShortcutOrURI(mgKeyW + " " + selString, mgPostData);
1009-
1010- else if (mgLocation.match(/%s/))
1011- mgLocation = mgLocation.replace(/%s/g, encodeURIComponent(selString));
1012- }
1013-
1014- if (mgLoadIn == 4 && mgAppInfo.name != "Firefox")
1015- mgLoadIn = 0;
1016-
1017- switch (mgLoadIn) {
1018- case 4:
1019- var mgPanelTitle = mgBmInfo.title;
1020- openWebPanel(mgPanelTitle, mgLocation);
1021-
1022- if (mgPostData.value)
1023- setTimeout(mgLoadSideBar, 100, mgLocation, mgPostData.value);
1024- break;
1025-
1026- case 3:
1027- getBrowser().selectedTab = getBrowser().addTab(mgLocation, null, null, mgPostData.value);
1028- break;
1029-
1030- case 2:
1031- getBrowser().addTab(mgLocation, null, null, mgPostData.value);
1032- break;
1033-
1034- case 1:
1035- mgNewBrowserWindow().loadURI(mgLocation, null, mgPostData.value);
1036- break;
1037-
1038- case 0:
1039- loadURI(mgLocation, null, mgPostData.value);
1040- break;
1041- }
1042+ var mgLoadIn = parseInt(mapping.type.substring(1,2));
1043+
1044+ if (mgBMService.makeURI(mgLocation).scheme == "javascript")
1045+ mgLoadIn = 0;
1046+ else {
1047+ var selString = mgGetSelection().toString().replace(/\s$/, "");
1048+
1049+ var mgKeyW = mgBmInfo.key;
1050+
1051+ if (mgKeyW) // if bookmark has a keyword, use browser-function to replace %s
1052+ mgLocation = getShortcutOrURI(mgKeyW + " " + selString, mgPostData);
1053+
1054+ else if (mgLocation.match(/%s/))
1055+ mgLocation = mgLocation.replace(/%s/g, encodeURIComponent(selString));
1056+ }
1057+
1058+ if (mgLoadIn == 4 && mgAppInfo.name != "Firefox")
1059+ mgLoadIn = 0;
1060+
1061+ switch (mgLoadIn) {
1062+ case 4:
1063+ var mgPanelTitle = mgBmInfo.title;
1064+ openWebPanel(mgPanelTitle, mgLocation);
1065+
1066+ if (mgPostData.value)
1067+ setTimeout(mgLoadSideBar, 100, mgLocation, mgPostData.value);
1068+ break;
1069+
1070+ case 3:
1071+ getBrowser().selectedTab = getBrowser().addTab(mgLocation, null, null, mgPostData.value);
1072+ break;
1073+
1074+ case 2:
1075+ getBrowser().addTab(mgLocation, null, null, mgPostData.value);
1076+ break;
1077+
1078+ case 1:
1079+ mgNewBrowserWindow().loadURI(mgLocation, null, mgPostData.value);
1080+ break;
1081+
1082+ case 0:
1083+ loadURI(mgLocation, null, mgPostData.value);
1084+ break;
1085+ }
1086 }
1087 else {
1088- alert(mgGetString("unknownBookmark"))
1089- return true;
1090+ mgShowStatus(null, mgGetString("unknownBookmark"));
1091+ return true;
1092 }
1093 }
1094 }
1095@@ -180,7 +181,8 @@
1096 if (source == null || source.indexOf("chrome://mozgest/") == 0) {
1097 var msg = mgGetString("errorInGestureFunction");
1098 msg = msg.replace(/%MESSAGE%/, errorMessage);
1099- alert(msg);
1100+ mgState.lastError = errorMessage;
1101+ mgShowStatus(null, msg);
1102 }
1103 return true;
1104 }
1105@@ -189,6 +191,12 @@
1106 mgState.history.pop();
1107
1108 mgState.history.unshift([message, mgMappingLocalizer.localize(aGesture)]);
1109+
1110+ if (_mgMS.history.length > 9)
1111+ _mgMS.history.pop();
1112+
1113+ _mgMS.history.unshift([message, mgMappingLocalizer.localize(aGesture)]);
1114+
1115 mapping.count ? mapping.count++ : mapping.count = 1;
1116 return true;
1117 }
1118@@ -201,8 +209,8 @@
1119 var g = mgState.gesture.join("");
1120 var twoStroke = g.substr(g.length-2,2);
1121 var threeStroke = g.substr(g.length-3,3);
1122- mgCommon.dump("MozGest: Multiple link spawn: " + g
1123- + ' spotted... \n ...Looking for Finishing Move\n');
1124+
1125+ mgCommon.dump("Found " + globalOnLink.length + " link(s)");
1126
1127 if (!mgFireGestureFromTable("*" + twoStroke))
1128 return mgFireGestureFromTable("*" + threeStroke);
1129@@ -216,11 +224,6 @@
1130 if (!mgPrefs.enableRockers && !mgPrefs.enableWheelRockers)
1131 return false;
1132
1133- if (mgState.rockerAborted) {
1134- mgState.rockerCode = "";
1135- mgState.rockerAborted = false;
1136- }
1137-
1138 if (mgState.rockerCode == "")
1139 mgState.rockerCode = ":";
1140
1141@@ -233,18 +236,8 @@
1142 return mgFireRocker(mgState.rockerCode, e);
1143 }
1144
1145-function mgFireRocker(code, e, map, byTimer, time) {
1146- mgFireStatic.clearTimer();
1147- // sometimes the timeout is wrong
1148- if (byTimer) {
1149- var tD = (new Date).getTime() - time;
1150- if (tD < mgPrefs.staticRockersDelay/1.5) {
1151- mgFireStatic.setTimer(code, map, mgPrefs.staticRockersDelay - tD);
1152- return null;
1153- }
1154- }
1155-
1156- var mapping = map ? map : mgGetMapping(code)[0];
1157+function mgFireRocker(code, e) {
1158+ var mapping = mgGetMapping(code)[0];
1159
1160 if (mapping) {
1161 gestureInProgress = mgState.gestureStartTime = false;
1162@@ -261,51 +254,33 @@
1163 }
1164
1165 if (mgPrefs["status.rockers.enabled"])
1166- mgShowStatus(code, true, byTimer);
1167-
1168+ mgShowStatus(code);
1169+
1170 mgFireGestureFromTable(code, mapping);
1171-
1172- if (mgMouseEvents) {
1173- var isWheel = isNaN(code.substring(1));
1174-
1175- if ((isWheel && mgPrefs.staticWheelRockers) || (!isWheel && mgPrefs.staticRockers))
1176- mgFireStatic.setTimer(code, mapping);
1177- }
1178-
1179 return true;
1180 }
1181 else
1182 return false;
1183 }
1184
1185-var mgFireStatic = {
1186- timeout : null,
1187-
1188- setTimer : function(code, mapping, tO) {
1189- var timer = tO ? tO : mgPrefs.staticRockersDelay;
1190- this.timeout = setTimeout(mgFireRocker, timer, code, false, mapping, true, (new Date).getTime());
1191- },
1192-
1193- clearTimer : function() {
1194- clearTimeout(this.timeout);
1195- }
1196-}
1197-
1198 function mgReleaseRocker(e) {
1199- mgFireStatic.clearTimer();
1200 if (e) {
1201 var button = mgPrefs.lefthanded ? Math.abs(e.button - 2) : e.button;
1202 eval("mgState.rockerCode = mgState.rockerCode.replace(/" + button + "/g, '');");
1203 }
1204 }
1205
1206-function mgResetRocker() {
1207- if (!mgMouseEvents)
1208+function mgResetRocker(force) {
1209+ if (mgState.rockerCode.length > 1 && (!mgMouseEvents || force)) {
1210 mgState.rockerCode = "";
1211+
1212+ if (mgMouseEvents)
1213+ mgObserver.mgClearInterval();
1214+ }
1215 }
1216
1217 function mgMousewheelHandler(e) {
1218- if (mgState.rockerAborted)
1219+ if (mgState.rockerCode.length < 2)
1220 return;
1221
1222 var dir = e.detail > 0 ? "+" : "-";
1223@@ -313,7 +288,19 @@
1224 if (mgState.rockerCode && mgGetMapping(mgState.rockerCode+dir)[0]) {
1225 e.preventDefault();
1226 e.stopPropagation();
1227+ mgFireRocker(mgState.rockerCode + dir);
1228+
1229+ if (mgMouseEvents && mgPrefs.staticWheelRockers)
1230+ mgObserver.mgSetInterval(null, mgState.rockerCode + dir);
1231 }
1232-
1233- mgFireRocker(mgState.rockerCode + dir);
1234+}
1235+
1236+function mgFireKeyEvent(mData) {
1237+ var ev = document.createEvent('KeyEvents');
1238+
1239+ ev.initKeyEvent('keypress', true, true, null,
1240+ eval(mData[0]), eval(mData[1]), eval(mData[2]),
1241+ eval(mData[3]), parseInt(mData[4]), parseInt(mData[5]));
1242+
1243+ document.documentElement.dispatchEvent(ev);
1244 }
1245\ No newline at end of file
1246
1247=== modified file 'chrome/content/mozgestCommon.js'
1248--- chrome/content/mozgestCommon.js 2008-02-27 03:41:55 +0000
1249+++ chrome/content/mozgestCommon.js 2009-07-25 21:50:38 +0000
1250@@ -45,7 +45,7 @@
1251 init : function() {
1252 if (!this.prefs) {
1253 var prefService = Components.classes["@mozilla.org/preferences-service;1"]
1254- .getService(Components.interfaces.nsIPrefService);
1255+ .getService(Components.interfaces.nsIPrefService);
1256
1257 this.root = prefService.getBranch(null); // root preferences branch
1258 this.prefs = prefService.getBranch("mozgest."); // mozgest preferences branch
1259@@ -68,11 +68,10 @@
1260 p.gestureCondition += " && e.altKey";
1261 if (g("modifier.shift"))
1262 p.gestureCondition += " && e.shiftKey";
1263- if (navigator.platform == "MacPPC" && g("modifier.meta"))
1264+ if (navigator.platform.indexOf("Mac") == 0 && g("modifier.meta"))
1265 p.gestureCondition += " && e.metaKey";
1266
1267 g("sideBarSort");
1268- g("sideBarToolTip");
1269 g("importFrom");
1270 g("selectedTabIndex");
1271 },
1272@@ -132,8 +131,8 @@
1273
1274 dump : function(aText) {
1275 try {
1276- if (mgPrefs.prefs.getBoolPref("enableDump"))
1277- dump(aText);
1278+ if (mgPrefs["enableDump"])
1279+ dump("Mozgest: " + aText + "\n");
1280 }
1281 catch (e) {}
1282 },
1283@@ -143,28 +142,17 @@
1284 var locale = null;
1285 try {
1286 locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
1287- .getService(Components.interfaces.nsIXULChromeRegistry)
1288- .getSelectedLocale("global");
1289+ .getService(Components.interfaces.nsIXULChromeRegistry)
1290+ .getSelectedLocale("global");
1291 }
1292 catch (e) {}
1293
1294- if (locale != null)
1295+ if (locale != null && pageUrl.indexOf("http://www.mousegestures.org") == 0)
1296 pageUrl = pageUrl + "?language=" + locale;
1297
1298- //Thunderbird
1299- if (mgAppInfo.name == "Thunderbird") {
1300- var uri = Components.classes["@mozilla.org/network/standard-url;1"]
1301- .createInstance(Components.interfaces.nsIURI);
1302- uri.spec = pageUrl;
1303-
1304- var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
1305- .getService(Components.interfaces.nsIExternalProtocolService);
1306- protocolSvc.loadUrl(uri);
1307- return;
1308- }
1309-
1310 //check for an existing browser window
1311 var browserWindow = this.winMediator.getMostRecentWindow("navigator:browser");
1312+
1313 if (browserWindow) {
1314 try {
1315 browserWindow.delayedOpenTab(pageUrl);
1316@@ -173,8 +161,15 @@
1317 browserWindow.loadURI(pageUrl);
1318 }
1319 }
1320- else
1321- window.open(pageUrl);
1322+ else {
1323+ var uri = Components.classes["@mozilla.org/network/standard-url;1"]
1324+ .createInstance(Components.interfaces.nsIURI);
1325+ uri.spec = pageUrl;
1326+
1327+ var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
1328+ .getService(Components.interfaces.nsIExternalProtocolService);
1329+ protocolSvc.loadUrl(uri);
1330+ }
1331 },
1332
1333 compactCode : function(aCode) {
1334@@ -187,15 +182,18 @@
1335 return compacted;
1336 },
1337
1338- addTreeRow : function(tChildren, args, mozgestGeneric) {
1339+ addTreeRow : function(tChildren, args, id, isCount) {
1340 var ti = document.createElement("treeitem");
1341+ ti.id = id;
1342 var row = document.createElement("treerow");
1343
1344 for (var i = 0; i < args.length; i++) {
1345 var cell = document.createElement("treecell");
1346 cell.setAttribute("label", args[i]);
1347- if (mozgestGeneric)
1348- cell.setAttribute("properties", mozgestGeneric);
1349+
1350+ if (isCount) {
1351+ cell.setAttribute("properties", "mozgestCount");
1352+ }
1353 row.appendChild(cell);
1354 }
1355 ti.appendChild(row);
1356@@ -222,9 +220,7 @@
1357 try {
1358 if (win.document.location == aURL) {
1359 retVal = true;
1360- var errText = mgGetString("windowAlreadyOpen");
1361- errText = errText.replace(/%MGWIN%/g, win.document.title);
1362- alert(errText);
1363+ win.focus();
1364 }
1365 }
1366 catch (e) {}
1367@@ -242,54 +238,140 @@
1368
1369 notifyObservers : function(aboutWhat) {
1370 Components.classes["@mozilla.org/observer-service;1"]
1371- .getService(Components.interfaces.nsIObserverService)
1372- .notifyObservers(null, "mozgestControl", aboutWhat);
1373- }
1374-}
1375-
1376-
1377-/* ***** BEGIN LICENSE BLOCK *****
1378- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1379- *
1380- * The contents of this file are subject to the Mozilla Public License Version
1381- * 1.1 (the "License"); you may not use this file except in compliance with
1382- * the License. You may obtain a copy of the License at
1383- * http://www.mozilla.org/MPL/
1384- *
1385- * Software distributed under the License is distributed on an "AS IS" basis,
1386- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1387- * for the specific language governing rights and limitations under the
1388- * License.
1389- *
1390- * The Original Code is Mouse Gesture for Mozilla.
1391- *
1392- * The Initial Developer of the Original Code is Jochen Schlehuber.
1393- * Portions created by the Initial Developer are Copyright (C) 2006
1394- * the Initial Developer. All Rights Reserved.
1395- *
1396- * Contributor(s) (alphabetical order):
1397- * Jochen <bugs@krickelkrackel.de>
1398- *
1399- * Alternatively, the contents of this file may be used under the terms of
1400- * either the GNU General Public License Version 2 or later (the "GPL"), or
1401- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1402- * in which case the provisions of the GPL or the LGPL are applicable instead
1403- * of those above. If you wish to allow use of your version of this file only
1404- * under the terms of either the GPL or the LGPL, and not to allow others to
1405- * use your version of this file under the terms of the MPL, indicate your
1406- * decision by deleting the provisions above and replace them with the notice
1407- * and other provisions required by the GPL or the LGPL. If you do not delete
1408- * the provisions above, a recipient may use your version of this file under
1409- * the terms of any one of the MPL, the GPL or the LGPL.
1410- *
1411- * ***** END LICENSE BLOCK ***** */
1412+ .getService(Components.interfaces.nsIObserverService)
1413+ .notifyObservers(null, "mozgestControl", aboutWhat);
1414+ }
1415+}
1416+
1417+var mgStorage = {
1418+ processURL : function (url, docLoc) {
1419+ url = url.substr(10);
1420+ var parts = url.split("/");
1421+ document.aaa = parts;
1422+ // check whether command is valid
1423+ switch (parts[0]) {
1424+ case "addmapping":
1425+ this.importMapping(parts, docLoc);
1426+ break;
1427+ case "addgestureset":
1428+ this.importSet(url.substring(14), docLoc);
1429+ break;
1430+ default:
1431+ var msg = mgGetString("unknownCommand");
1432+ msg = msg.replace(/%COMMAND%/, parts[0]);
1433+ alert(msg);
1434+ }
1435+ },
1436+
1437+ importSet : function (url) {
1438+ try {
1439+ mgBMService.makeURI(url);
1440+ }
1441+ catch (e) {
1442+ return;
1443+ }
1444+ mgCommon.openDialog("chrome://mozgest/content/pref/importSet.xul", [url]);
1445+ },
1446+
1447+ importMapping : function (parts, docLoc) {
1448+ if (mgCommon.checkWindowOpen("chrome://mozgest/content/pref/mappings.xul"))
1449+ return;
1450+
1451+ var validCode = false;
1452+ var code = "";
1453+ var appearance = null;
1454+
1455+ var gestureRegExp = /^(\*{0,1}[1379DLUR]+){1}(;\*{0,1}[1379DLUR]+){0,1}$/;
1456+ if (parts[2].match(/^:[0-2][0-2\+\-]$/)) {
1457+ validCode = true;
1458+ code = parts[2];
1459+ }
1460+ else if (gestureRegExp.exec(parts[2])) {
1461+ validCode = true;
1462+ code = RegExp.$1;
1463+ appearance = RegExp.$2.substr(1);
1464+ var cC = mgCommon.compactCode;
1465+ if (cC(code) != code || (appearance && cC(appearance) != code))
1466+ validCode = false;
1467+ }
1468+
1469+ if (!validCode) {
1470+ alert(mgGetString("invalidCode"));
1471+ return;
1472+ }
1473+
1474+ var func = null;
1475+ var name = null;
1476+ var custom = null;
1477+ var check = 0;
1478+
1479+ if (parts[3] == "custom") {
1480+ name = decodeURIComponent(parts[4]);
1481+ custom = decodeURIComponent(parts[5]);
1482+ check = this.checkFunc(parts[1], null);
1483+ }
1484+ else {
1485+ check = this.checkFunc(parts[1], parts[3]);
1486+ func = parts[3];
1487+ }
1488+
1489+ if (check == -1) {
1490+ this.msg = mgGetString("unknownWindowType");
1491+ this.msg = this.msg.replace(/%WINDOWTYPE%/, parts[1]);
1492+ alert(this.msg);
1493+ return;
1494+ }
1495+ if (check == -2) {
1496+ this.msg = mgGetString("unknownFunction");
1497+ this.msg = this.msg.replace(/%FUNCTION%/, parts[3]);
1498+ alert(this.msg);
1499+ return;
1500+ }
1501+
1502+ _mgMS.importLocation = docLoc;
1503+ _mgMS.importWinType = parts[1];
1504+ _mgMS.importCode = code;
1505+ _mgMS.importAppearance = appearance;
1506+ _mgMS.importName = name;
1507+ _mgMS.importFunc = func;
1508+ _mgMS.importCustom = custom;
1509+
1510+ if (parts.length >= 6 && parts[6].indexOf("cat") == 0)
1511+ _mgMS.importCat = parts[6];
1512+ else
1513+ _mgMS.importCat = "cat0";
1514+
1515+ mgCommon.openDialog("chrome://mozgest/content/pref/mappings.xul",
1516+ ["Import", parts[1], code]);
1517+ },
1518+
1519+ checkFunc : function(winType, aFunc) {
1520+ var retVal = 0;
1521+
1522+ if (!((winType in _mgMS.supportedWindows) || winType == "window"))
1523+ return -1;
1524+
1525+ if (aFunc) {
1526+ if (!(aFunc in _mgMS.functions[winType]) &&
1527+ !(aFunc in _mgMS.functions["window"]))
1528+ return -2;
1529+ }
1530+
1531+ return retVal;
1532+ }
1533+}
1534
1535 var mgAppInfo = {
1536 init : function() {
1537 var em = Components.classes["@mozilla.org/extensions/manager;1"]
1538 .getService(Components.interfaces.nsIExtensionManager);
1539
1540- this.mozgestVersion = em.getItemForID("{FFA36170-80B1-4535-B0E3-A4569E497DD0}").version;
1541+ this.mozgestID = "{FFA36170-80B1-4535-B0E3-A4569E497DD0}";
1542+ this.mozgestVersion = em.getItemForID(this.mozgestID).version;
1543+ var instLoc = em.getInstallLocation(this.mozgestID);
1544+ var itemLoc = instLoc.getItemLocation(this.mozgestID);
1545+ this.installPath = itemLoc.path;
1546+ mgPrefs.prefs.setCharPref("installLocation", this.installPath);
1547
1548 var pHandler = Components.classes['@mozilla.org/network/io-service;1']
1549 .getService(Components.interfaces.nsIIOService)
1550@@ -297,6 +379,7 @@
1551 .QueryInterface(Components.interfaces.nsIHttpProtocolHandler);
1552
1553 this.geckoVersion = pHandler.misc.substring(3);
1554+ this.geckoShortVersion = this.geckoVersion.substring(0,3);
1555 this.oscpu = pHandler.oscpu;
1556 this.platform = pHandler.platform;
1557
1558@@ -404,48 +487,7 @@
1559 },
1560
1561 manualImport : function() {
1562- var importWarning = confirm(mgGetString("impWarning"));
1563-
1564- if (!importWarning)
1565- return;
1566-
1567- var title = mgGetString("impTitle");
1568- var cc = Components.classes;
1569- var ci = Components.interfaces;
1570-
1571- var profile = cc['@mozilla.org/file/directory_service;1'].getService(ci.nsIProperties);
1572-
1573- var filePath = profile.get('ProfD', ci.nsILocalFile);
1574-
1575- var fp = cc["@mozilla.org/filepicker;1"].createInstance(ci.nsIFilePicker);
1576- fp.init(window, title, ci.nsIFilePicker.modeOpen);
1577-
1578- var retVal = fp.show();
1579-
1580- if (retVal == ci.nsIFilePicker.returnOK) {
1581- var mgPath = profile.get('ProfD', ci.nsILocalFile);
1582- mgPath.appendRelativePath("mousegestures.js");
1583-
1584- try {
1585- mgPath.remove(false);
1586- fp.file.copyTo(filePath, "mousegestures.js");
1587- _mgMS.getActiveMappings();
1588- mgCommon.notifyObservers("mappingsUpdated");
1589- alert(mgGetString("impSuccess"))
1590- }
1591- catch (e) {
1592- try {
1593- mgPath.remove(false);
1594- }
1595- catch (e) {}
1596-
1597- _mgMS.removedDefaultMappings = new Array();
1598- _mgMS.cleanUp();
1599- _mgMS.getActiveMappings();
1600- mgCommon.notifyObservers("mappingsUpdated");
1601- alert(mgGetString("impCorrupt"))
1602- }
1603- }
1604+ mgCommon.openDialog('chrome://mozgest/content/pref/importSet.xul');
1605 }
1606 }
1607
1608@@ -467,8 +509,7 @@
1609 this.KeyW = this.RDFS.GetResource("http://home.netscape.com/NC-rdf#ShortcutURL");
1610 this.Post = this.RDFS.GetResource("http://home.netscape.com/NC-rdf#PostData");
1611 }
1612-
1613- if ("@mozilla.org/browser/nav-history-service;1" in Components.classes) {
1614+ else if ("@mozilla.org/browser/nav-history-service;1" in Components.classes) {
1615 this.plEnabled = true;
1616
1617 this.plHist = Components.classes["@mozilla.org/browser/nav-history-service;1"]
1618@@ -500,7 +541,7 @@
1619
1620 if ("@mozilla.org/browser/bookmarks-service;1" in Components.classes) {
1621 this.uri = mgBMService.Book.GetTarget(mgBMService.RDFS
1622- .GetResource(bmId), mgBMService.Href, true);
1623+ .GetResource(bmId), mgBMService.Href, true);
1624
1625 if (this.uri) {
1626 this.uri = this.uri.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
1627@@ -508,7 +549,7 @@
1628 }
1629
1630 this.title = mgBMService.Book.GetTarget(mgBMService.RDFS
1631- .GetResource(bmId), mgBMService.Name, true)
1632+ .GetResource(bmId), mgBMService.Name, true)
1633 if (this.title)
1634 this.title = this.title.QueryInterface(
1635 Components.interfaces.nsIRDFLiteral).Value;
1636@@ -516,7 +557,10 @@
1637 this.title = "";
1638
1639 this.key = mgBMService.Book.GetTarget(mgBMService.RDFS
1640- .GetResource(bmId), mgBMService.KeyW, true);
1641+ .GetResource(bmId), mgBMService.KeyW, true);
1642+
1643+ if (this.key)
1644+ this.key = this.key.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
1645 }
1646
1647 if ("@mozilla.org/browser/nav-history-service;1" in Components.classes) {
1648@@ -532,4 +576,44 @@
1649 mgCommon.init();
1650 mgAppInfo.init();
1651 mgMappingLocalizer.init();
1652-mgBMService.init();
1653\ No newline at end of file
1654+mgBMService.init();
1655+
1656+// ================================= component loader ====================================
1657+// global variables
1658+var mgMouseService = false;
1659+var mgNativeTrails = false;
1660+var mgMouseEvents = false;
1661+
1662+var mgComponentLoader = {
1663+ init : false,
1664+
1665+ initMouseService : function(setMain) {
1666+ if (this.init)
1667+ return;
1668+
1669+ this.init = true;
1670+
1671+ if (("@mousegestures.org/mgMouseService;1" in Components.classes)) {
1672+ try {
1673+ mgMouseService = Components.classes["@mousegestures.org/mgMouseService;1"]
1674+ .getService().QueryInterface(Components.interfaces.mgIMouseService);
1675+
1676+ mgNativeTrails = mgMouseService.supports("nativeTrails");
1677+ mgMouseEvents = mgMouseService.supports("mouseEvents");
1678+
1679+ if (setMain) {
1680+ var baseWin = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
1681+ .getInterface(Components.interfaces.nsIWebNavigation)
1682+ .QueryInterface(Components.interfaces.nsIBaseWindow);
1683+
1684+ mgMouseService.setMainWin(baseWin);
1685+ }
1686+ }
1687+ catch (e) {}
1688+ }
1689+ }
1690+}
1691+
1692+var _mgMS = Components.classes["@mousegestures.org/mgMappingsService;1"].getService();
1693+_mgMS = _mgMS.wrappedJSObject;
1694+_mgMS.initMappings();
1695\ No newline at end of file
1696
1697=== removed file 'chrome/content/mozgestImport.js'
1698--- chrome/content/mozgestImport.js 2008-02-27 03:41:55 +0000
1699+++ chrome/content/mozgestImport.js 1970-01-01 00:00:00 +0000
1700@@ -1,236 +0,0 @@
1701-/* ***** BEGIN LICENSE BLOCK *****
1702- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
1703- *
1704- * The contents of this file are subject to the Mozilla Public License Version
1705- * 1.1 (the "License"); you may not use this file except in compliance with
1706- * the License. You may obtain a copy of the License at
1707- * http://www.mozilla.org/MPL/
1708- *
1709- * Software distributed under the License is distributed on an "AS IS" basis,
1710- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
1711- * for the specific language governing rights and limitations under the
1712- * License.
1713- *
1714- * The Original Code is Mouse Gestures for Mozilla.
1715- *
1716- * The Initial Developer of the Original Code is Jens Bannmann.
1717- * Portions created by the Initial Developer are Copyright (C) 2003
1718- * the Initial Developer. All Rights Reserved.
1719- *
1720- * Contributor(s) (alphabetical order):
1721- * Jens Bannmann <jens.b@web.de>
1722- * Jochen <bugs@krickelkrackel.de>
1723- *
1724- * Alternatively, the contents of this file may be used under the terms of
1725- * either the GNU General Public License Version 2 or later (the "GPL"), or
1726- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
1727- * in which case the provisions of the GPL or the LGPL are applicable instead
1728- * of those above. If you wish to allow use of your version of this file only
1729- * under the terms of either the GPL or the LGPL, and not to allow others to
1730- * use your version of this file under the terms of the MPL, indicate your
1731- * decision by deleting the provisions above and replace them with the notice
1732- * and other provisions required by the GPL or the LGPL. If you do not delete
1733- * the provisions above, a recipient may use your version of this file under
1734- * the terms of any one of the MPL, the GPL or the LGPL.
1735- *
1736- * ***** END LICENSE BLOCK ***** */
1737-
1738-var mgStorage = {
1739- processURL : function (url, docLoc) {
1740- url = url.substr(10);
1741- var parts = url.split("/");
1742- // check whether command is valid
1743- switch (parts[0]) {
1744- case "addmapping":
1745- this.importMapping(parts, docLoc);
1746- break;
1747- default:
1748- var msg = mgGetString("unknownCommand");
1749- msg = msg.replace(/%COMMAND%/, parts[0]);
1750- alert(msg);
1751- }
1752- },
1753-
1754- importMapping : function (parts, docLoc) {
1755- if (mgCommon.checkWindowOpen("chrome://mozgest/content/pref/mappings.xul"))
1756- return;
1757-
1758- var validCode = false;
1759- var code = "";
1760- var appearance = null;
1761-
1762- var gestureRegExp = /^(\*{0,1}[1379DLUR]+){1}(;\*{0,1}[1379DLUR]+){0,1}$/;
1763- if (parts[2].match(/^:[0-2][0-2\+\-]$/)) {
1764- validCode = true;
1765- code = parts[2];
1766- }
1767- else if (gestureRegExp.exec(parts[2])) {
1768- validCode = true;
1769- code = RegExp.$1;
1770- appearance = RegExp.$2.substr(1);
1771- var cC = mgCommon.compactCode;
1772- if (cC(code) != code || (appearance && cC(appearance) != code))
1773- validCode = false;
1774- }
1775-
1776- if (!validCode) {
1777- alert(mgGetString("invalidCode"));
1778- return;
1779- }
1780-
1781- var func = null;
1782- var name = null;
1783- var custom = null;
1784- var check = 0;
1785-
1786- if (parts[3] == "custom") {
1787- name = decodeURIComponent(parts[4]);
1788- custom = unescape(parts[5]);
1789- check = this.checkFunc(parts[1], null);
1790- }
1791- else {
1792- check = this.checkFunc(parts[1], parts[3]);
1793- func = parts[3];
1794- }
1795-
1796- if (check == -1) {
1797- this.msg = mgGetString("unknownWindowType");
1798- this.msg = this.msg.replace(/%WINDOWTYPE%/, parts[1]);
1799- alert(this.msg);
1800- return;
1801- }
1802- if (check == -2) {
1803- this.msg = mgGetString("unknownFunction");
1804- this.msg = this.msg.replace(/%FUNCTION%/, parts[3]);
1805- alert(this.msg);
1806- return;
1807- }
1808-
1809- _mgMS.importLocation = docLoc;
1810- _mgMS.importWinType = parts[1];
1811- _mgMS.importCode = code;
1812- _mgMS.importAppearance = appearance;
1813- _mgMS.importName = name;
1814- _mgMS.importFunc = func;
1815- _mgMS.importCustom = custom;
1816-
1817- mgCommon.openDialog("chrome://mozgest/content/pref/mappings.xul",
1818- ["Import", parts[1], code]);
1819- },
1820-
1821- checkFunc : function(winType, aFunc) {
1822- var retVal = 0;
1823-
1824- if (!((winType in _mgMS.supportedWindows) || winType == "window"))
1825- return -1;
1826-
1827- if (aFunc) {
1828- if (!(aFunc in _mgMS.functions[winType]) &&
1829- !(aFunc in _mgMS.functions["window"]))
1830- return -2;
1831- }
1832-
1833- return retVal;
1834- }
1835-}
1836-
1837-//Import mousegestures.rdf
1838-
1839-var importer = {
1840- RDF : Components.classes["@mozilla.org/rdf/rdf-service;1"]
1841- .getService(Components.interfaces.nsIRDFService),
1842-
1843- NS : "http://optimoz.mozdev.org/gestures-rdf#",
1844-
1845- actTemp : new Array(),
1846-
1847- initImport : function() {
1848- var retVal = false;
1849- try {
1850- var wTypeArray = new Array("browser", "viewsource", "window", "messenger");
1851-
1852- var dirService = Components.classes['@mozilla.org/file/directory_service;1']
1853- .getService(Components.interfaces.nsIProperties);
1854- var mappingsFile = dirService.get('ProfD', Components.interfaces.nsILocalFile);
1855- mappingsFile.append("mousegestures.rdf");
1856-
1857- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
1858- .getService(Components.interfaces.nsIIOService);
1859- var mgFileSpec = ioService.newFileURI(mappingsFile).spec
1860-
1861- var dsource = this.RDF.GetDataSourceBlocking(mgFileSpec);
1862- // if dsource is corrupted, we don't receive the error,
1863- // although it is in the console. so let us test...
1864- var lastTest = dsource.GetAllResources();
1865-
1866- if (!lastTest.hasMoreElements())
1867- throw("MozGest: Stopping import! Something is wrong with mousegestures.rdf\n");
1868-
1869- for (var x = 0; x < wTypeArray.length; x++)
1870- this.importRDFGestures(dsource, wTypeArray[x]);
1871- }
1872- catch (e) {
1873- retVal = e;
1874- }
1875-
1876- return retVal;
1877- },
1878-
1879- importRDFGestures : function(dsource, winType) {
1880- var mappingsContainer = Components.classes['@mozilla.org/rdf/container;1'].createInstance()
1881- .QueryInterface(Components.interfaces.nsIRDFContainer);
1882-
1883- var rootnode = this.RDF.GetResource("urn:mozgest:mappings:" + winType);
1884-
1885- try {
1886- mappingsContainer.Init(dsource, rootnode);
1887- }
1888- catch (e) {
1889- // no existing mappings
1890- return;
1891- }
1892-
1893- var enumerator = mappingsContainer.GetElements();
1894-
1895- if (!enumerator.hasMoreElements())
1896- return;
1897-
1898- this.actTemp[winType] = new Array();
1899-
1900- while (enumerator.hasMoreElements()) {
1901- var mapping = enumerator.getNext()
1902- .QueryInterface(Components.interfaces.nsIRDFResource);
1903-
1904- var code = this.getProperty(dsource, mapping, "code");
1905-
1906- if (code == "UUUUUU")
1907- continue;
1908-
1909- var func = this.getProperty(dsource, mapping, "function");
1910- var custom = this.getProperty(dsource, mapping, "custom");
1911- var bmOpenIn = this.getProperty(dsource, mapping, "bmOpenIn");
1912- var count = Math.abs(this.getProperty(dsource, mapping, "count")) || 0;
1913- var type = null;
1914- var name = null;
1915-
1916- if (custom) {
1917- type = "1";
1918- func = custom;
1919- name = this.getProperty(dsource, mapping, "name");
1920- }
1921- if (bmOpenIn)
1922- type = "2" + bmOpenIn;
1923-
1924- this.actTemp[winType][code] = {type:type, name:name, func:func, count:count};
1925- }
1926- return;
1927- },
1928-
1929- getProperty : function (dsource, obj, propName) {
1930- var literal = dsource.GetTarget(obj, this.RDF.GetResource(this.NS + propName), true);
1931- if (literal)
1932- return literal.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
1933- else
1934- return null;
1935- }
1936-}
1937\ No newline at end of file
1938
1939=== modified file 'chrome/content/mozgestOverlay.js'
1940--- chrome/content/mozgestOverlay.js 2008-02-27 03:41:55 +0000
1941+++ chrome/content/mozgestOverlay.js 2009-07-25 21:50:38 +0000
1942@@ -50,20 +50,19 @@
1943 //-- Global variables --
1944 //----------------------
1945 var mgStatusPopup;
1946-var mgContext = null;
1947-var mgContextVis = false;
1948-var mgPopupBox;
1949+var mgPopup = null;
1950 var mgContent = null;
1951-var mgString; // array holding localized stroke names
1952+var mgString; //array holding localized stroke names
1953 var gestureInProgress = false;
1954-var globalOnLink = false; // array that holds a list of all the links traversed during gesture
1955-var globalOnImage = false; // string containing an image href or false
1956-var globalSrcEvent = false; // event which started the active gesture.
1957+var globalOnLink = false; //array that holds a list of all the links traversed during gesture
1958+var globalOnImage = false; //string containing an image href or false
1959+var globalSrcEvent = false; //event which started the active gesture.
1960
1961 var mgState = {
1962- gestureStartTime : 0 ,
1963+ inputField : null,
1964+ currentNode : null,
1965+ gestureStartTime : 0,
1966 gestureDone : false,
1967- rockerAborted : false,
1968 previousSelection : null,
1969 oX : 0, oY : 0,
1970 gridMoves : new Array(),
1971@@ -74,16 +73,17 @@
1972 gestureTimeout : null,
1973 statusTimer : null,
1974 allowContext : false,
1975- autoScrollAborted : false,
1976 history : new Array(),
1977 rockerCode : "",
1978- linkTemp : null
1979+ linkTemp : null,
1980+ lastError : ""
1981 };
1982
1983 var mgObserver = {
1984- mgPrefTimeout : null,
1985- obs : Components.classes["@mozilla.org/observer-service;1"]
1986- .getService(Components.interfaces.nsIObserverService),
1987+ mgPrefTimeout : null,
1988+ mgRockerInterval : null,
1989+ obs : Components.classes["@mozilla.org/observer-service;1"]
1990+ .getService(Components.interfaces.nsIObserverService),
1991
1992 createEvt : function(what, data) {
1993 var mData = data.split("|");
1994@@ -95,10 +95,10 @@
1995 },
1996
1997 observe : function(subject, topic, data) {
1998- // when MozGest pref was changed, we reinitialize
1999- // (except when sidebar settings changed)
2000- // use a timeout to avoid multiple inits if more than
2001- // one pref was changed. Not bullet proof.
2002+ /*when MozGest pref was changed, we reinitialize
2003+ (except when sidebar settings changed)
2004+ use a timeout to avoid multiple inits if more than
2005+ one pref was changed. Not bullet proof. */
2006 if (topic.indexOf("nsPref") == 0) {
2007 if (data.indexOf("sideBar") == 0 || data == "selectedTabIndex" ||
2008 data == "importFrom" || data == "firstStart")
2009@@ -108,51 +108,60 @@
2010 mgObserver.mgPrefTimeout = setTimeout(mozgestInit, 200);
2011 }
2012
2013- if (topic == "mozgestGetBaseWin") {
2014- if (mgCommon.winWatcher.activeWindow != window)
2015- return;
2016-
2017- mgMouseService.setBaseWin(mgGetBaseWin());
2018- }
2019+ if (topic == "domwindowopened")
2020+ mgResetRocker(true);
2021
2022 if (topic == "mozgestButtonUp") {
2023- if (mgCommon.winWatcher.activeWindow != window)
2024+ mgObserver.mgClearInterval();
2025+
2026+ if (mgCommon.winWatcher.activeWindow != window) {
2027+ mgResetRocker(true);
2028 return;
2029+ }
2030
2031 try {
2032 mgEndGesture(this.createEvt("mouseup", data), true);
2033+ gestureInProgress = false;
2034 }
2035 catch (e) {}
2036 }
2037
2038+ if (mgCommon.winWatcher.activeWindow != window)
2039+ return;
2040+
2041 if (topic == "mozgestButtonDown") {
2042- if (mgCommon.winWatcher.activeWindow != window)
2043- return;
2044-
2045+ mgObserver.mgClearInterval();
2046 try {
2047- if (navigator.platform != "Win32" &&
2048- this.createEvt("mousedown", data).button == mgPrefs.mousebutton)
2049- mgContext.hidePopup();
2050+ if (navigator.platform != "Win32" && mgMouseInContent(this.createEvt("mousedown", data)))
2051+ mgPopup.hidePopup();
2052 }
2053 catch (e) {}
2054-
2055 }
2056
2057 if (topic == "mozgestRockerDown") {
2058- if (mgCommon.winWatcher.activeWindow != window)
2059- return;
2060+ mgObserver.mgClearInterval();
2061+ gestureInProgress = false;
2062
2063 try {
2064- mgStartGesture(this.createEvt("mousedown", data));
2065+ var evt = this.createEvt("mousedown", data);
2066+ setTimeout(mgStartGesture, 0, evt);
2067+
2068+ if (mgPrefs.staticRockers)
2069+ mgObserver.mgSetInterval(evt);
2070 }
2071 catch (e) {}
2072 }
2073+
2074+ if (topic == "mozgestGetBaseWin")
2075+ mgMouseService.setBaseWin(mgGetBaseWin());
2076 },
2077
2078 register : function() {
2079 mgPrefs.prefs.QueryInterface(Components.interfaces.nsIPrefBranch2)
2080 .addObserver("", this, false);
2081
2082+ mgCommon.winWatcher.registerNotification(this);
2083+
2084 if (mgMouseEvents) {
2085 this.obs.addObserver(this, "mozgestGetBaseWin", false);
2086 this.obs.addObserver(this, "mozgestRockerDown", false);
2087@@ -165,12 +174,30 @@
2088 mgPrefs.prefs.QueryInterface(Components.interfaces.nsIPrefBranch2)
2089 .removeObserver("", this);
2090
2091+ mgCommon.winWatcher.unregisterNotification(this);
2092+
2093 if (mgMouseEvents) {
2094 this.obs.removeObserver(this, "mozgestGetBaseWin");
2095 this.obs.removeObserver(this, "mozgestRockerDown");
2096 this.obs.removeObserver(this, "mozgestButtonUp");
2097 this.obs.removeObserver(this, "mozgestButtonDown");
2098 }
2099+ },
2100+
2101+ mgSetInterval : function(e, wheelCode) {
2102+ mgObserver.mgClearInterval();
2103+
2104+ if (e) {
2105+ mgObserver.mgRockerInterval = setInterval(mgStartGesture, mgPrefs.staticRockersDelay, e);
2106+ }
2107+ else if (wheelCode) {
2108+ mgObserver.mgRockerInterval = setInterval(mgFireRocker, mgPrefs.staticRockersDelay, wheelCode);
2109+ }
2110+ },
2111+
2112+ mgClearInterval : function() {
2113+ clearInterval(mgObserver.mgRockerInterval);
2114+ mgObserver.mgRockerInterval = null;
2115 }
2116 }
2117
2118@@ -179,32 +206,27 @@
2119 //--------------------------------
2120 function mgStartup(e) {
2121 window.removeEventListener("load", mgStartup, false);
2122- mgComponentLoader.initMouseService(true);
2123+ document.loadOverlay("chrome://mozgest/content/contextOverlay.xul", null);
2124 mgInitNotification();
2125
2126- // Hack! get our keyset
2127- var mgKeySet = document.getElementById("openMozgestSettings");
2128- if (!mgKeySet) {
2129- mgKeySet = document.getElementsByAttribute("id", "openMozgestSettings")[0].parentNode;
2130- document.documentElement.appendChild(mgKeySet);
2131- }
2132-
2133 //this comes from windowTypes.js
2134 mgWindowTypes.init();
2135 mgWindowType = mgWindowTypes.getWindowType(document.location);
2136
2137 if (mgWindowType) {
2138- mgCommon.dump("MozGest: ---- Startup ----\n");
2139+ mgCommon.dump("Startup");
2140+ mgLoadStrings();
2141+ mozgestInit();
2142 mgObserver.register();
2143 window.addEventListener("unload", function () {mgObserver.unregister()}, false);
2144- mgLoadStrings();
2145- mozgestInit();
2146 }
2147 }
2148
2149 function mozgestInit() {
2150 mgPrefs.init();
2151- // turn gestures recognition on/off
2152+ mgComponentLoader.initMouseService(true);
2153+
2154+ //turn gestures recognition on/off
2155 if (mgPrefs.get(mgWindowType))
2156 mgAddWindowWatch();
2157 else
2158@@ -216,12 +238,12 @@
2159 catch (e) {
2160 mgPrefs.prefs.setBoolPref("firstStart", true);
2161 mgPrefs.prefs.setIntPref("selectedTabIndex", 3);
2162- setTimeout("mgCommon.openDialog('chrome://mozgest/content/pref/pref-mozgest.xul')", 500);
2163+ setTimeout("openDialog('chrome://mozgest/content/pref/pref-mozgest.xul','','chrome,resizable,centerscreen')", 500);
2164 }
2165 }
2166
2167 function mgLoadStrings() {
2168- // load localized strings and cache often used strings
2169+ //load localized strings and cache often used strings
2170 mgString = new Array();
2171 mgString["R"] = mgGetString("a.right");
2172 mgString["L"] = mgGetString("a.left");
2173@@ -235,7 +257,7 @@
2174 }
2175
2176 function mgAddWindowWatch() {
2177- mgCommon.dump("MozGest: ---- Get Contentarea ---\n");
2178+ mgCommon.dump("Get Contentarea");
2179
2180 if (document.documentElement.getAttribute("windowtype") == "navigator:browser")
2181 mgContent = mgGetContentArea().mPanelContainer;
2182@@ -243,23 +265,35 @@
2183 mgContent = mgGetContentArea();
2184
2185 mgRemoveWindowWatch();
2186- mgCommon.dump("MozGest: Adding Listeners\n");
2187+ mgCommon.dump("Adding Listeners");
2188
2189- mgContent.addEventListener("mousedown", mgStartGesture, false);
2190+ mgContent.addEventListener("mousedown", mgStartGesture, true);
2191 mgContent.addEventListener("draggesture", mgOnDragGestureEvent, true);
2192
2193 if (mgPrefs.enableWheelRockers)
2194- mgContent.addEventListener("DOMMouseScroll", mgMousewheelHandler, false);
2195+ mgContent.addEventListener("DOMMouseScroll", mgMousewheelHandler, true);
2196
2197- window.addEventListener("mouseup", mgEndGesture, false);
2198+ window.addEventListener("mouseup", mgEndGesture, true);
2199 window.addEventListener("keydown", mgAllowContextByKeyPress, true);
2200 window.addEventListener("mousemove", mgProcessCoordinates, true);
2201+ window.addEventListener("popupshowing", mgPopupListener, true);
2202 mgContent.addEventListener("contextmenu", mgContextMenuListener, true);
2203 mgContent.addEventListener("click", mgOnClickHandler, true);
2204 mgContent.addEventListener("dblclick", mgOnClickHandler, true);
2205+}
2206
2207- if (navigator.platform != "Win32")
2208- window.addEventListener("popupshowing", mgAutoScrollHandler, true);
2209+function mgRemoveWindowWatch() {
2210+ mgCommon.dump("Removing Listeners");
2211+ mgContent.removeEventListener("mousedown", mgStartGesture, true);
2212+ mgContent.removeEventListener("draggesture", mgOnDragGestureEvent, true);
2213+ mgContent.removeEventListener("DOMMouseScroll", mgMousewheelHandler, true);
2214+ mgContent.removeEventListener("contextmenu", mgContextMenuListener, true);
2215+ window.removeEventListener("mouseup", mgEndGesture, true);
2216+ window.removeEventListener("keydown", mgAllowContextByKeyPress, true);
2217+ window.removeEventListener("mousemove", mgProcessCoordinates, true);
2218+ window.removeEventListener("popupshowing", mgPopupListener, true);
2219+ mgContent.removeEventListener("click", mgOnClickHandler, true);
2220+ mgContent.removeEventListener("dblclick", mgOnClickHandler, true);
2221 }
2222
2223 function mgInitNotification() {
2224@@ -267,7 +301,9 @@
2225 var mgSet = document.createElement("popupset");
2226 mgStatusPopup = document.createElement("tooltip");
2227 mgStatusPopup.id = "mgStatusPopup";
2228- mgStatusPopup.setAttribute("onpopuphidden", "this.hidden=true;setTimeout('mgStatusPopup.hidden=false',0)");
2229+ mgStatusPopup.setAttribute("onpopupshown", "this.mgOpen=true");
2230+ mgStatusPopup.setAttribute("onpopuphidden", "this.mgOpen=false;this.hidden=true;setTimeout('mgStatusPopup.hidden=false',0)");
2231+ mgStatusPopup.setAttribute("onmouseover", "if (!gestureInProgress) this.hidePopup()");
2232 var mgStatusLabel = document.createElement("label");
2233 mgStatusLabel.id = "mgStatusLabel";
2234 mgStatusLabel.setAttribute("crop", "end");
2235@@ -276,45 +312,31 @@
2236 mgSet.appendChild(mgStatusPopup);
2237 document.documentElement.appendChild(mgSet);
2238 window.addEventListener("blur", function () {
2239- if (mgPrefs["status.enabled"])
2240+ if (mgPrefs["status.isEnabled"])
2241 mgStatusPopup.hidePopup()
2242 }, true);
2243 }
2244 }
2245
2246-function mgRemoveWindowWatch() {
2247- mgCommon.dump("MozGest: Removing Listeners\n");
2248- mgContent.removeEventListener("mousedown", mgStartGesture, false);
2249- mgContent.removeEventListener("draggesture", mgOnDragGestureEvent, true);
2250- mgContent.removeEventListener("DOMMouseScroll", mgMousewheelHandler, false);
2251- mgContent.removeEventListener("contextmenu", mgContextMenuListener, true);
2252- window.removeEventListener("mouseup", mgEndGesture, false);
2253- window.removeEventListener("keydown", mgAllowContextByKeyPress, true);
2254- window.removeEventListener("mousemove", mgProcessCoordinates, true);
2255- mgContent.removeEventListener("click", mgOnClickHandler, true);
2256- mgContent.removeEventListener("dblclick", mgOnClickHandler, true);
2257- window.removeEventListener("popupshowing", mgAutoScrollHandler, true);
2258-}
2259-
2260 //-----------------------
2261 //-- Integration hooks --
2262+//-- everything needed for co-existing with or disabling regular app functions
2263 //-----------------------
2264-// (everything needed for co-existing with or disabling regular app functions)
2265-
2266 function mgContextMenuListener(e) {
2267- if (mgAppInfo.geckoVersion.substring(0,3) > 1.8) {
2268+ if (mgAppInfo.platform == "Windows" || mgAppInfo.geckoShortVersion > 1.8) {
2269 if (!mgState.allowContext) {
2270 e.preventDefault();
2271 e.stopPropagation();
2272 }
2273 }
2274-
2275- addEventListener("popupshowing", mgDisableContextMenu, true);
2276- setTimeout("removeEventListener('popupshowing', mgDisableContextMenu, true)", 5);
2277+ else {
2278+ addEventListener("popupshowing", mgDisableContextMenu, true);
2279+ setTimeout("removeEventListener('popupshowing', mgDisableContextMenu, true)", 5);
2280+ }
2281 }
2282
2283 function mgDisableContextMenu(e) {
2284- mgContext=e.originalTarget;
2285+ mgPopup = e.originalTarget;
2286
2287 if (!mgState.allowContext)
2288 e.preventDefault();
2289@@ -327,9 +349,12 @@
2290 }
2291 }
2292
2293-function mgAutoScrollHandler(e) {
2294- if (e.target.id=="autoscroller") {
2295- mgContext=e.originalTarget;
2296+function mgPopupListener(e) {
2297+ if (e.originalTarget.nodeName.indexOf("tooltip") != -1)
2298+ return;
2299+
2300+ mgPopup = e.originalTarget;
2301+ if (e.target.id == "autoscroller") {
2302 if (!e.target.hasAttribute("mozgestWasHere")) {
2303 e.target.addEventListener("mousedown", function(e) {mgStartGesture(e, true)}, true);
2304 e.target.setAttribute("mozgestWasHere", true);
2305@@ -339,73 +364,59 @@
2306
2307 function mgOnClickHandler(e) {
2308 if (mgState.gestureDone) {
2309- mgCommon.dump("MozGest: Stopping " + e.type + " event caused by last gesture.\n");
2310+ mgCommon.dump("Stopping " + e.type + " event caused by last gesture");
2311 e.preventDefault();
2312 e.stopPropagation();
2313 return false;
2314 }
2315
2316- var node = e.originalTarget;
2317-
2318- if (!node.getAttribute || !node.hasAttribute("href"))
2319- return null;
2320-
2321- var tagname = node.nodeName.toLowerCase();
2322- var href = node.getAttribute("href");
2323-
2324- if (tagname == "a" && href.indexOf("mozgest://") == 0 && e.button < 2) {
2325- mgCommon.dump("MozGest: Link click " + href + "\n");
2326- mgStorage.processURL(href, node.ownerDocument.location);
2327- e.stopPropagation();
2328- e.preventDefault();
2329+ if (e.button < 2) {
2330+ var node = e.originalTarget;
2331+
2332+ if (node.localName.toLowerCase() != "a")
2333+ return null;
2334+
2335+ if (!node.getAttribute || !node.hasAttribute("href"))
2336+ return null;
2337+
2338+ var href = node.getAttribute("href");
2339+
2340+ if (href.indexOf("mozgest://") == 0) {
2341+ mgCommon.dump("Link click " + href);
2342+ mgStorage.processURL(href, node.ownerDocument.location);
2343+ e.stopPropagation();
2344+ e.preventDefault();
2345+ }
2346 }
2347 return null;
2348 }
2349
2350 function mgOnDragGestureEvent(e) {
2351- var draggedElement = e.originalTarget.nodeName.toUpperCase();
2352- if (gestureInProgress && draggedElement != "HTML") {
2353- if (mgState.lastMoveTime-mgState.gestureStartTime > mgPrefs.dragdropDelay) {
2354- mgCommon.dump("MozGest: '" + draggedElement
2355- + "' drag encountered, canceling gesture\n");
2356- mgEndGesture("drag");
2357- } else {
2358- mgCommon.dump("MozGest: canceling '" + draggedElement
2359- + "' drag event, continuing gesture\n");
2360- e.stopPropagation();
2361- }
2362+ if (gestureInProgress) {
2363+ e.preventDefault();
2364+ e.stopPropagation();
2365 }
2366- if (mgState.gestureDone)
2367- e.stopPropagation();
2368 }
2369
2370 //---------------------------------
2371 //-- The gesture recognizer core --
2372 //---------------------------------
2373 function mgProcessCoordinates(e) {
2374- if (e.screenX < mgState.oX -25 || e.screenX > mgState.oX +25 ||
2375- e.screenY < mgState.oY -25 || e.screenY > mgState.oY +25)
2376- mgState.rockerAborted = true;
2377+ if (mgState.rockerCode.length > 1 &&
2378+ (e.screenX < mgState.oX -25 || e.screenX > mgState.oX +25 ||
2379+ e.screenY < mgState.oY -25 || e.screenY > mgState.oY +25))
2380+ mgResetRocker(true);
2381
2382- if (!gestureInProgress)
2383+ if (!mgPrefs.enableStrokes || !gestureInProgress)
2384 return;
2385
2386 var now = (new Date).getTime();
2387
2388- if (mgPrefs.mousebutton == 1 && !mgState.autoScrollAborted &&
2389- (e.screenX != mgState.oX || e.screenY != mgState.oY)) {
2390- mgState.autoScrollAborted = true;
2391- if (mgStopAutoScroll())
2392- return;
2393- }
2394-
2395- if (!mgPrefs.enableStrokes)
2396- return;
2397-
2398- var g = mgState.gesture.join("");
2399- if (mgPrefs.gestureCondition == "e.button==0" && (g == "L" || g == "R")
2400- && (now - mgState.gestureStartTime) > mgPrefs.lmbGestureLimit) {
2401- mgEndGesture(null);
2402+ if (mgState.gesture.length < 1) {
2403+ if (mgPrefs.mousebutton == 1 && (e.screenX != mgState.oX || e.screenY != mgState.oY)) {
2404+ if (mgStopAutoScroll())
2405+ return;
2406+ }
2407 }
2408
2409 var x_dir = e.screenX - mgState.oX;
2410@@ -414,9 +425,9 @@
2411 var y = Math.abs(y_dir);
2412
2413 if (x >= mgPrefs.grid/2 || y >= mgPrefs.grid/2) { // process each half-grid
2414- // diagonal movement:
2415- // mgPrefs.diagonalTolerance = 75 means that a movement is recognized as diagonal when
2416- // x/y or y/x is between 0.25 and 1
2417+ //diagonal movement:
2418+ //mgPrefs.diagonalTolerance = 75 means that a movement is recognized as diagonal when
2419+ //x/y or y/x is between 0.25 and 1
2420 if ( mgPrefs.diagonalTolerance != 0 && ( (x/y >= (1-mgPrefs.diagonalTolerance/100) && x/y <= 1)
2421 || (y/x >= (1-mgPrefs.diagonalTolerance/100) && y/x <= 1) ) ) {
2422
2423@@ -429,14 +440,14 @@
2424 else if (x_dir > 0 && y_dir < 0)
2425 mgPush("9");
2426 }
2427- // horizontal move:
2428+ //horizontal move:
2429 else if (x > y) {
2430 if (x_dir > 0)
2431 mgPush("R");
2432 else if (x_dir < 0)
2433 mgPush("L");
2434 }
2435- // vertical move:
2436+ //vertical move:
2437 else if (x < y) {
2438 if (y_dir > 0)
2439 mgPush("D");
2440@@ -444,19 +455,18 @@
2441 mgPush("U");
2442 }
2443
2444- mgShowStatus(mgState.gesture.join(""));
2445 mgState.lastGestureTime = now;
2446-
2447- if (mgState.gestureTimeout)
2448- window.clearTimeout(mgState.gestureTimeout);
2449-
2450- mgState.gestureTimeout = window.setTimeout("mgEndGesture(null);", mgPrefs.delay);
2451-
2452+ clearTimeout(mgState.gestureTimeout);
2453+ mgState.gestureTimeout = setTimeout("mgEndGesture(null);", mgPrefs.delay);
2454 mgState.oX = e.screenX;
2455 mgState.oY = e.screenY;
2456 }
2457 mgState.lastMoveTime = now;
2458- mgExamineHoveredElement(e.originalTarget);
2459+
2460+ if (mgState.currentNode != e.originalTarget)
2461+ mgExamineHoveredElement(e.originalTarget);
2462+
2463+ mgState.currentNode = e.originalTarget;
2464 }
2465
2466 function mgPush(code) {
2467@@ -473,9 +483,8 @@
2468 if (mgState.gesture[mgState.gesture.length-1] != code) {
2469 mgState.gesture.push(code);
2470 mgState.localizedGesture.push(mgString[code]);
2471+ mgShowStatus(mgState.gesture.join(""));
2472 }
2473- if (mgState.gesture.length == 1)
2474- mgResetRocker();
2475 }
2476
2477 function mgExamineHoveredElement(node, inContentCheck) {
2478@@ -492,9 +501,7 @@
2479 for (checkNode; checkNode; checkNode = checkNode.parentNode) {
2480 var n = checkNode.nodeName.toLowerCase();
2481
2482- if (n == "scrollbar" || n == "select" ||
2483- n == "input" || n == "textarea" ||
2484- n == "textbox" || n == "object" || n == "embed")
2485+ if (n == "scrollbar" || n == "object" || n == "embed")
2486 return false;
2487 }
2488 }
2489@@ -512,7 +519,6 @@
2490 if (!(node.href in mgState.linkTemp)) {
2491 mgState.linkTemp[node.href] = node.href;
2492 globalOnLink.push(node);
2493- mgCommon.dump("Mozgest: hovered link '" + node.href + "'\n");
2494 }
2495 break;
2496 }
2497@@ -521,7 +527,6 @@
2498 for (imgNode; imgNode; imgNode = imgNode.parentNode) {
2499 if (!globalOnImage && imgNode instanceof CI.nsIDOMHTMLImageElement) {
2500 globalOnImage = imgNode;
2501- mgCommon.dump("Mozgest: found image.\n");
2502 break;
2503 }
2504 }
2505@@ -537,119 +542,123 @@
2506
2507 if (mgExamineHoveredElement(e.originalTarget, true) && !mgCheckForRocker(e) && !isPopup) {
2508 globalSrcEvent = e;
2509+ mgState.currentNode = e.originalTarget;
2510
2511 if (!gestureInProgress && mgPrefs.enableStrokes && eval(mgPrefs.gestureCondition)) {
2512 // check if it's possible to draw trails
2513- if (mgPrefs["trails.enabled"] && mgNativeTrails)
2514- mgMouseService.initTrails(mgGetBaseWin(), mgPrefs["trails.width"], mgPrefs["trails.interval"],
2515- mgPrefs.grid, mgPrefs["trails.color"].substring(1));
2516+ if (mgNativeTrails && mgPrefs["trails.enabled"])
2517+ mgMouseService.initTrails(mgGetBaseWin());
2518
2519 gestureInProgress = true;
2520 mgState.gestureStartTime = mgState.lastGestureTime = (new Date).getTime();
2521 mgState.lastMoveTime = mgState.gesture.length = mgState.localizedGesture.length = 0;;
2522
2523- var sel = mgGetSelection();
2524- if (mgPrefs.mousebutton == 0 && sel && sel.rangeCount > 0)
2525- mgState.previousSelection = sel.getRangeAt(0);
2526+ if (mgPrefs.mousebutton == 0) {
2527+ mgState.inputField = null;
2528+ var nodeName = globalSrcEvent.target.nodeName.toLowerCase();
2529+
2530+ if (nodeName == "input" || nodeName == "textarea") {
2531+ mgState.inputField = globalSrcEvent.target;
2532+ mgState.selStart = mgState.inputField.selectionStart;
2533+ mgState.selEnd = mgState.inputField.selectionEnd;
2534+ }
2535+
2536+ mgState.previousSelection = null;
2537+ var sel = mgGetSelection();
2538+
2539+ if (sel && sel.rangeCount > 0)
2540+ mgState.previousSelection = sel.getRangeAt(0);
2541+
2542+ mgState.gestureTimeout = setTimeout("mgEndGesture(null);", mgPrefs.lmbGestureLimit);
2543+ }
2544 }
2545 }
2546 }
2547
2548 function mgEndGesture(e, synth) {
2549 mgReleaseRocker(e);
2550- mgState.rockerAborted = false;
2551- mgState.autoScrollAborted = false;
2552 clearTimeout(mgState.statusTimer);
2553+ clearTimeout(mgState.gestureTimeout);
2554
2555 if (gestureInProgress) {
2556- gestureInProgress = mgState.gestureStartTime = false;
2557+ gestureInProgress = false;
2558+ mgState.gestureStartTime = false;
2559
2560 if (mgNativeTrails)
2561 mgMouseService.stopTrails();
2562
2563- window.clearTimeout(mgState.gestureTimeout);
2564+ mgState.gestureDone = (mgState.gesture.join("") != "") ? true : false;
2565
2566- // check if we've been called via a timeout; see mgProcessCoordinates()
2567 if (e == null) {
2568- mgCommon.dump("gesture timeouted\n");
2569-
2570- if (mgPrefs["status.enabled"])
2571- mgStatusPopup.firstChild.value = mgGetString("g.aborted");
2572-
2573- mgState.gestureDone = true;
2574- }
2575- else if (mgState.gesture.join("") != "") {
2576- mgState.gestureDone = true;
2577- window.setTimeout(mgFireGesture, 0, mgState.gesture.join(""));
2578- }
2579+ if (mgState.gestureDone)
2580+ mgShowStatus(null, mgGetString("g.aborted"));
2581+ }
2582+ else if (mgState.gestureDone)
2583+ setTimeout(mgFireGesture, 0, mgState.gesture.join(""));
2584 }
2585
2586- if (mgPrefs["status.enabled"])
2587+ if (mgPrefs["status.isEnabled"])
2588 mgState.statusTimer = setTimeout("mgStatusPopup.hidePopup();", mgPrefs["status.timeout"]);
2589
2590 if (!synth && e && !mgState.gestureDone && (e.button == 2 ||
2591 (navigator.platform.indexOf("Mac") == 0 && e.button == 0 && e.ctrlKey))) {
2592 mgState.allowContext = true;
2593- //==================== contextmenu on mousedown =============================
2594+
2595+ //contextmenu on mousedown
2596 if (navigator.platform != "Win32") {
2597- var ctBox = mgContent.boxObject;
2598-
2599- if (e.screenY >= ctBox.screenY &&
2600- e.screenY <= ctBox.screenY + ctBox.height &&
2601- e.screenX >= ctBox.screenX &&
2602- e.screenX <= ctBox.screenX + ctBox.width) {
2603-
2604+ if (e.originalTarget.ownerDocument && e.originalTarget.ownerDocument == document)
2605+ return;
2606+
2607+ if (mgMouseInContent(e)) {
2608 document.popupNode = e.target;
2609+ document.mozgestPopupRangeParent = e.rangeParent;
2610+ document.mozgestPopupRangeOffset = e.rangeOffset;
2611
2612- if (mgAppInfo.geckoVersion.substring(0,3) > 1.8) {
2613+ if (mgAppInfo.geckoShortVersion > 1.8) {
2614 var ev = e.view.document.createEvent ('MouseEvents');
2615 ev.initMouseEvent('contextmenu', true, true, e.view, 1, e.screenX, e.screenY,
2616 e.pageX, e.pageY, 0, 0, 0, 0, 2, null);
2617
2618- e.originalTarget.dispatchEvent(ev);
2619+ try {
2620+ e.originalTarget.dispatchEvent(ev);
2621+ }
2622+ catch (err) {
2623+ e.target.dispatchEvent(ev);
2624+ }
2625
2626- if (gContextMenu) {
2627+ if ("gContextMenu" in window) {
2628 try {
2629 gContextMenu.setTarget(document.popupNode, e.rangeParent, e.rangeOffset);
2630 gContextMenu.initItems();
2631 }
2632- catch (e) {}
2633+ catch (err) {}
2634 }
2635 return;
2636 }
2637
2638- var mgPopupBox = mgContext.boxObject
2639- .QueryInterface(Components.interfaces.nsIPopupBoxObject);
2640-
2641- if (mgContextVis)
2642- return;
2643-
2644- if (e.target.ownerDocument && e.target.ownerDocument == document)
2645- return;
2646-
2647- if (!mgContext.hasAttribute("mozgestWasHere")) {
2648- mgContext.addEventListener("popupshown", mgObserveContext, true);
2649- mgContext.addEventListener("popuphidden", mgObserveContext, true);
2650- mgContext.setAttribute("mozgestWasHere", true);
2651- }
2652+ var mgPopupBox = mgPopup.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);
2653+ document.popupNode = e.originalTarget;
2654
2655 try {
2656- mgPopupBox.showPopup(mgContext.ownerDocument.documentElement, mgContext,
2657+ mgPopupBox.showPopup(mgPopup.ownerDocument.documentElement, mgPopup,
2658 e.clientX, e.clientY, "context", "bottomleft", "topleft");
2659 }
2660- catch (e) {}
2661+ catch (err) {}
2662 }
2663 }
2664 }
2665 }
2666
2667-function mgObserveContext(e) {
2668- if (e.type == "popupshown") {
2669- if (e.target == mgContext)
2670- mgContextVis = true;
2671- }
2672- else if (e.target == mgContext)
2673- mgContextVis = false;
2674+function mgMouseInContent(e) {
2675+ var ctBox = mgContent.boxObject;
2676+
2677+ if (e.screenY >= ctBox.screenY &&
2678+ e.screenY <= ctBox.screenY + ctBox.height &&
2679+ e.screenX >= ctBox.screenX &&
2680+ e.screenX <= ctBox.screenX + ctBox.width)
2681+ return true;
2682+ else
2683+ return false;
2684 }
2685
2686 function mgGetBaseWin() {
2687@@ -657,18 +666,66 @@
2688 return mgDocShell.QueryInterface(Components.interfaces.nsIBaseWindow);
2689 }
2690
2691-function mgShowStatus(code, isRocker, byTimer) {
2692- if (mgPrefs["status.enabled"]) {
2693+function mgShowStatus(code, errorMSG) {
2694+ if (mgPrefs["status.isEnabled"]) {
2695 clearTimeout(mgState.statusTimer);
2696- var statusText = mgString["gesture"] + " " +
2697- ((isRocker) ? (code + ((byTimer) ? unescape("%u221E") : "")) : mgState.localizedGesture);
2698- var nameTemp = mgGetMapping(code)[1];
2699-
2700- if (nameTemp)
2701- statusText += " (" + nameTemp + ")";
2702+ var statusText;
2703+
2704+ if (!errorMSG) {
2705+ statusText = mgString["gesture"] + " " +
2706+ ((code.toString().indexOf(":") == 0) ? code : mgState.localizedGesture);
2707+ var nameTemp = mgGetMapping(code)[1];
2708+
2709+ if (nameTemp)
2710+ statusText += " (" + nameTemp + ")";
2711+ }
2712+ else
2713+ statusText = errorMSG;
2714
2715 mgStatusPopup.firstChild.setAttribute("value", statusText);
2716- mgStatusPopup.showPopup(document.documentElement, -1 , -1, "tooltip", "topleft", "bottomleft");
2717+
2718+ var isOpen = false;
2719+
2720+ if (mgStatusPopup.boxObject.popupState) {
2721+ if (mgStatusPopup.boxObject.popupState == "open")
2722+ isOpen = true;
2723+ }
2724+ else if (mgStatusPopup.mgOpen)
2725+ isOpen = true;
2726+
2727+ if (!isOpen) {
2728+ var width = 500;
2729+
2730+ try {
2731+ width = parseInt(document.defaultView.getComputedStyle(mgStatusPopup, null).getPropertyValue("max-width"));
2732+ }
2733+ catch (e) {}
2734+
2735+ var elt = mgPrefs["status.anchorElement"];
2736+ elt = eval(elt);
2737+
2738+ if (!elt)
2739+ elt = document.documentElement;
2740+
2741+ var box = elt.boxObject;
2742+
2743+ switch(mgPrefs["status.align"]) {
2744+ case 0: //topLeft
2745+ mgStatusPopup.showPopup(elt, -1 , -1, "tooltip", "topleft", "bottomleft");
2746+ break;
2747+ case 1: //topRight
2748+ mgStatusPopup.showPopup(elt, -1 , -1, "tooltip", "topright", "bottomright");
2749+ break;
2750+ case 2: //bottomLeft
2751+ mgStatusPopup.showPopup(elt, box.screenX, box.screenY + box.height, "tooltip", null, null);
2752+ break;
2753+ case 3: //bottomRight
2754+ mgStatusPopup.showPopup(elt, box.screenX + box.width - width, box.screenY + box.height, "tooltip", null, null);
2755+ break;
2756+ }
2757+ }
2758+ if (errorMSG)
2759+ mgState.statusTimer = setTimeout("mgStatusPopup.hidePopup();", mgPrefs["status.timeout"]);
2760 }
2761 }
2762
2763@@ -690,4 +747,23 @@
2764 }
2765
2766 return [mapping, name];
2767+}
2768+
2769+//--------------------
2770+//-- Ugly Overrides --
2771+//--------------------
2772+function openEditorContextMenu (popup) {
2773+ InlineSpellCheckerUI.clearSuggestionsFromMenu();
2774+ InlineSpellCheckerUI.initFromEvent((document.mozgestPopupRangeParent) ? document.mozgestPopupRangeParent : document.popupRangeParent,
2775+ (document.mozgestPopupRangeOffset) ? document.mozgestPopupRangeOffset : document.popupRangeOffset);
2776+ var onMisspelling = InlineSpellCheckerUI.overMisspelling;
2777+ document.getElementById('spellCheckSuggestionsSeparator').hidden = !onMisspelling;
2778+ document.getElementById('spellCheckAddToDictionary').hidden = !onMisspelling;
2779+ document.getElementById('spellCheckIgnoreWord').hidden = !onMisspelling;
2780+ var separator = document.getElementById('spellCheckAddSep');
2781+ separator.hidden = !onMisspelling;
2782+ document.getElementById('spellCheckNoSuggestions').hidden = !onMisspelling ||
2783+ InlineSpellCheckerUI.addSuggestionsToMenu(popup, separator, 5);
2784+
2785+ updateEditItems();
2786 }
2787\ No newline at end of file
2788
2789=== modified file 'chrome/content/mozgestOverlay.xul'
2790--- chrome/content/mozgestOverlay.xul 2008-02-27 03:41:55 +0000
2791+++ chrome/content/mozgestOverlay.xul 2009-07-25 21:50:38 +0000
2792@@ -39,84 +39,105 @@
2793 - ***** END LICENSE BLOCK ***** -->
2794
2795 <?xml-stylesheet href="chrome://mozgest/skin/mozgest.css" type="text/css"?>
2796-
2797 <!DOCTYPE overlay SYSTEM "chrome://mozgest/locale/mozgest.dtd" >
2798
2799 <overlay id="mozgest"
2800 xmlns:html="http://www.w3.org/1999/xhtml"
2801 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
2802
2803- <keyset>
2804- <key id="openMozgestSettings"
2805- key="&settings.commandkey;"
2806- modifiers="&settings.commandmodifiers;"
2807- oncommand="mgCommon.openDialog('chrome://mozgest/content/pref/pref-mozgest.xul')"/>
2808- </keyset>
2809-
2810 <script type="application/x-javascript" src="defaults.js"/>
2811 <script type="application/x-javascript" src="mozgestCommon.js"/>
2812- <script type="application/x-javascript" src="componentLoader.js"/>
2813 <script type="application/x-javascript" src="windowTypes.js"/>
2814- <script type="application/x-javascript" src="mozgestImport.js"/>
2815 <script type="application/x-javascript" src="mozgestOverlay.js"/>
2816 <script type="application/x-javascript" src="gestures.js"/>
2817 <script type="application/x-javascript" src="gestimp.js"/>
2818
2819 <script type="application/x-javascript">
2820- // Register mgStartup as an onload listener. To avoid getting called
2821- // multiple times, register in non-capturing mode (3rd param = false).
2822 window.addEventListener("load", mgStartup, false);
2823 </script>
2824
2825- <!-- Firefox Sidebar -->
2826- <menupopup id="viewSidebarMenu">
2827- <menuitem key="viewMozgestSidebarKB" observes="viewMozgestSidebar"/>
2828- </menupopup>
2829-
2830- <keyset id="mainKeyset">
2831+ <window id="main-window">
2832+ <keyset id="mozgestKeyset"/>
2833+ <popupset id="mozgestPopupset"/>
2834+ </window>
2835+
2836+ <window id="viewSource">
2837+ <keyset id="mozgestKeyset"/>
2838+ </window>
2839+
2840+ <window id="messengerWindow">
2841+ <keyset id="mozgestKeyset"/>
2842+ <popupset id="mozgestPopupset"/>
2843+ </window>
2844+
2845+ <window id="msgcomposeWindow">
2846+ <keyset id="mozgestKeyset"/>
2847+ <popupset id="mozgestPopupset"/>
2848+ </window>
2849+
2850+ <keyset id="mozgestKeyset">
2851+ <key id="openMozgestSettings"
2852+ key="&settings.commandkey;"
2853+ modifiers="&settings.commandmodifiers;"
2854+ oncommand="mgCommon.openDialog('chrome://mozgest/content/pref/pref-mozgest.xul')"/>
2855+
2856 <key id="viewMozgestSidebarKB"
2857 key="&sidebar.commandkey;"
2858 modifiers="&sidebar.commandmodifiers;"
2859- oncommand="try {toggleSidebar('viewMozgestSidebar');} catch (e) {}"
2860- insertbefore="viewBookmarksSidebarKb"/>
2861+ oncommand="try {
2862+ toggleSidebar('viewMozgestSidebar');
2863+ }
2864+ catch (e) {
2865+ mgCommon.openDialog('chrome://mozgest/content/sidebar/mozgestSidebar.xul');
2866+ }"/>
2867 </keyset>
2868
2869+ <popupset id="mozgestPopupset">
2870+ <popup id="mgSidebarContext">
2871+ <menuseparator id="mgSidebarSettingsSep"/>
2872+ </popup>
2873+ </popupset>
2874+
2875+ <!-- Firefox Sidebar -->
2876+ <menupopup id="viewSidebarMenu">
2877+ <menuitem key="viewMozgestSidebarKB"
2878+ observes="viewMozgestSidebar"
2879+ context="mgSidebarContext"/>
2880+ </menupopup>
2881+
2882 <broadcasterset id="mainBroadcasterSet">
2883 <broadcaster id="viewMozgestSidebar" autoCheck="false" label="&mozgest.label;"
2884 type="checkbox" group="sidebar" sidebartitle="&sidebar.title;"
2885 sidebarurl="chrome://mozgest/content/sidebar/mozgestSidebar.xul"
2886- oncommand="toggleSidebar('viewMozgestSidebar');"/>
2887+ oncommand="try {
2888+ toggleSidebar('viewMozgestSidebar');
2889+ }
2890+ catch (e) {
2891+ mgCommon.openDialog('chrome://mozgest/content/sidebar/mozgestSidebar.xul')
2892+ }"/>
2893 </broadcasterset>
2894+ <!-- Firefox Sidebar -->
2895
2896 <toolbarpalette id="BrowserToolbarPalette">
2897 <toolbarbutton id="mgSidebarButton"
2898- class="toolbarbutton-1 chromeclass-toolbar-additional"
2899- observes="viewMozgestSidebar"
2900- context="mgButtonContext"
2901- tooltiptext="&sidebar.title;"/>
2902- </toolbarpalette>
2903- <!-- Firefox Sidebar -->
2904-
2905- <popupset id="mainPopupSet">
2906- <popup id="mgButtonContext">
2907- <menuitem oncommand="mgCommon.openDialog('chrome://mozgest/content/pref/mappings.xul')"
2908- label="&btnMappings;"
2909- accesskey="&sidebar.mappings.key;" />
2910-
2911- <menuitem oncommand="mgCommon.openDialog('chrome://mozgest/content/pref/pref-mozgest.xul')"
2912- label="&sidebar.settings;"
2913- accesskey="&sidebar.settings.key;" />
2914-
2915- <menuseparator/>
2916-
2917- <menuitem oncommand="mgCommon.showWebPage('http://www.mousegestures.org')"
2918- label="&visit.home;"
2919- accesskey="&sidebar.visit.home.key;" />
2920-
2921- <menuitem oncommand="mgCommon.showWebPage('http://www.mousegestures.org/exchange/')"
2922- label="&visit.exchange;"
2923- accesskey="&sidebar.visit.exchange.key;" />
2924- </popup>
2925- </popupset>
2926+ observes="viewMozgestSidebar"/>
2927+ </toolbarpalette>
2928+
2929+ <toolbarpalette id="MailToolbarPalette">
2930+ <toolbarbutton id="mgSidebarButton"
2931+ label="&mozgest.label;"
2932+ oncommand="mgCommon.openDialog('chrome://mozgest/content/sidebar/mozgestSidebar.xul')"/>
2933+ </toolbarpalette>
2934+
2935+ <toolbarpalette id="MsgComposeToolbarPalette">
2936+ <toolbarbutton id="mgSidebarButton"
2937+ label="&mozgest.label;"
2938+ oncommand="mgCommon.openDialog('chrome://mozgest/content/sidebar/mozgestSidebar.xul')"/>
2939+ </toolbarpalette>
2940+
2941+ <toolbarbutton id="mgSidebarButton"
2942+ class="toolbarbutton-1 chromeclass-toolbar-additional"
2943+ context="mgSidebarContext"
2944+ tooltiptext="&sidebar.title;"/>
2945
2946 </overlay>
2947\ No newline at end of file
2948
2949=== modified file 'chrome/content/pref/edit-mapping.js'
2950--- chrome/content/pref/edit-mapping.js 2008-02-27 03:41:55 +0000
2951+++ chrome/content/pref/edit-mapping.js 2009-07-25 21:50:38 +0000
2952@@ -37,8 +37,9 @@
2953 * ***** END LICENSE BLOCK ***** */
2954
2955 var docTitle, dialogMode, acceptButton, actTemp, wType, docLoc, mgStatusPopup;
2956-var gestureType, codeBox, wheelBtn, wheelDir, functionType, functionsTree, ftChildren, mappingName, customBox, keyBox, keyMappingName;
2957-var startType, startCode, startName, startFunc, startCount;
2958+var gestureType, codeBox, wheelBtn, wheelDir, mgCategory, mgCatLen, catCol, allFuncs;
2959+var functionType, functionsTree, mappingName, customBox, keyBox, keyMappingName;
2960+var startType, startCode, startName, startFunc, startCount, startCat;
2961 var bmMappingName, bmTree, bmSelected, bmOpenIn, bmInfo, bmImage;
2962 var mgRow1, mgRow2, mgRow3;
2963 var bmDeleted = false;
2964@@ -67,7 +68,7 @@
2965 }
2966
2967 document.getElementById("mgPlacesTree").setAttribute("place",
2968- "place:queryType=1&excludeReadOnlyFolders=1&folder=" + PlacesUtils.allBookmarksFolderId);
2969+ "place:queryType=1&excludeReadOnlyFolders=1&onlyBookmarked=1&folder=1");
2970 document.getElementById("mgPlacesTree").setAttribute("type", "places");
2971 initEditor();
2972 }
2973@@ -79,9 +80,10 @@
2974 codeBox = document.getElementById("codeBox");
2975 wheelBtn = document.getElementById("wheelRockerButton");
2976 wheelDir = document.getElementById("wheelDirection");
2977+ mgCategory = document.getElementById("mgCategory");
2978+ mgCatLen = mgCategory.firstChild.childNodes.length;
2979 functionType = document.getElementById("functionType");
2980 functionsTree = document.getElementById("functionsTree");
2981- ftChildren = document.getElementById("ftChildren");
2982 mappingName = document.getElementById("mappingName");
2983 bmMappingName = document.getElementById("bmMappingName");
2984 keyMappingName = document.getElementById("keyMappingName");
2985@@ -90,6 +92,7 @@
2986 bmInfo = document.getElementById("bmInfo");
2987 bmImage = document.getElementById("bmImage");
2988 bmOpenIn = document.getElementById("bmOpenIn");
2989+ catCol = document.getElementById("catCol");
2990 mgRow1 = document.getElementById("mgRow1");
2991 mgRow2 = mgRow1.nextSibling;
2992 mgRow3 = mgRow2.nextSibling;
2993@@ -99,9 +102,6 @@
2994 document.getElementById("mgRegcognizeButton").hidden = !mgNativeTrails;
2995 mgInitNotification();
2996
2997- if (mgAppInfo.name != "Firefox")
2998- document.getElementById("sidebarItem").hidden = true;
2999-
3000 // get passed arguments
3001 // [0] == dialogMode (Edit, New or Import)
3002 // [1] == wType (window, browser, etc.)
3003@@ -109,6 +109,11 @@
3004 dialogMode = window.arguments[0];
3005 wType = window.arguments[1];
3006
3007+ if (mgAppInfo.name != "Firefox") {
3008+ document.getElementById("sidebarItem").hidden = true;
3009+ document.getElementById("cat6").hidden = false;
3010+ }
3011+
3012 if (dialogMode != "Import")
3013 document.getElementById("mgPermissionButton").hidden = true;
3014
3015@@ -120,15 +125,48 @@
3016
3017 // fill function list
3018 var curFuncts = _mgMS.functions[wType];
3019-
3020- for (func in curFuncts)
3021- mgCommon.addTreeRow(ftChildren, new Array(func, mgGetString(func)));
3022+ var funcTemp1 = new Array();
3023+ allFuncs = new Array();
3024+
3025+ mgDefaultFunctions.init()
3026+ funcTemp1 = mgDefaultFunctions.getFunctions();
3027+
3028+ for (win in funcTemp1) {
3029+ for (each in funcTemp1[win]) {
3030+ cat = funcTemp1[win][each];
3031+ cat = cat.toString().substring(cat.toString().length -4);
3032+ allFuncs[each] = cat;
3033+ }
3034+ }
3035+
3036+ var cat = 0;
3037+ var tc;
3038+
3039+ for (func in curFuncts) {
3040+ if (func in allFuncs)
3041+ cat = allFuncs[func];
3042+
3043+ tc = document.getElementById("tr" + cat)
3044+ mgCommon.addTreeRow(tc, new Array(func, mgGetString(func)), func);
3045+ }
3046
3047 if (wType != "window") {
3048 curFuncts = _mgMS.functions["window"];
3049
3050- for (func in curFuncts)
3051- mgCommon.addTreeRow(ftChildren, new Array(func,mgGetString(func)), "mozgestGeneric");
3052+ for (func in curFuncts) {
3053+ if (func in allFuncs)
3054+ cat = allFuncs[func];
3055+
3056+ tc = document.getElementById("tr" + cat);
3057+ mgCommon.addTreeRow(tc, new Array(func, mgGetString(func)), func);
3058+ }
3059+ }
3060+
3061+ for (var x = 0; x < mgCatLen; x++) {
3062+ var tCat = document.getElementById("trcat" + x);
3063+
3064+ if (tCat.childNodes.length < 1)
3065+ tCat.parentNode.setAttribute("hidden", true);
3066 }
3067
3068 // prepare for bookmark mappings
3069@@ -146,21 +184,8 @@
3070
3071 actTemp = _mgMS.actTemp;
3072
3073- if (dialogMode == "New") {
3074- if (_mgMS.curBookmark) {
3075- bmSelected = _mgMS.curBookmark;
3076- _mgMS.curBookmark = null;
3077- bmMappingName.value = _mgMS.curBookmarkName;
3078-
3079- if (mgBMService.enabled)
3080- bmInit();
3081- else if (mgBMService.plEnabled)
3082- setTimeout(plInit, 0);
3083-
3084- functionType.selectedTab = functionType.getElementsByAttribute("gestureType", "9")[0];
3085- }
3086- return;
3087- }
3088+ if (dialogMode == "New")
3089+ return;
3090
3091 if (dialogMode == "Edit") {
3092 startCode = curMapping;
3093@@ -170,24 +195,16 @@
3094
3095 startFunc = actTemp[wType][curMapping].func;
3096 startCount = actTemp[wType][curMapping].count;
3097+ startCat = actTemp[wType][curMapping].cat;
3098+ mgCategory.selectedItem = document.getElementById("cat" + actTemp[wType][curMapping].cat);
3099+
3100 setGestureType();
3101
3102 var fType = startType = actTemp[wType][curMapping].type;
3103
3104 if (!fType) {
3105 fType = startType = "";
3106- try {
3107- for (var x = 0; x < ftChildren.childNodes.length; x++) {
3108- var funcName = functionsTree.view.getCellText(x, functionsTree.columns["ftFuncCol"]);
3109-
3110- if (funcName == actTemp[wType][curMapping].func) {
3111- functionsTree.view.selection.select(x);
3112- functionsTree.boxObject.ensureRowIsVisible(x);
3113- break;
3114- }
3115- }
3116- }
3117- catch (e) {}
3118+ selectTreeItem(actTemp[wType][curMapping].cat, actTemp[wType][curMapping].func);
3119 }
3120 else {
3121 fType = fType.toString();
3122@@ -221,6 +238,7 @@
3123 }
3124
3125 if (dialogMode == "Import") {
3126+ functionType._tabs.removeChild(functionType._tabs.lastChild);
3127 setGestureType();
3128 importGesture();
3129 }
3130@@ -239,21 +257,21 @@
3131
3132 // if _mgMS.importFunc is null than it is a custom gesture!
3133 if (!_mgMS.importFunc) {
3134+ mgCategory.selectedItem = document.getElementById(_mgMS.importCat)
3135 customBox.value = _mgMS.importCustom;
3136 functionType.selectedIndex = 1;
3137 }
3138- else {
3139- try {
3140- for (var x = 0; x < ftChildren.childNodes.length; x++) {
3141- var funcName = functionsTree.view.getCellText(x, functionsTree.columns["ftFuncCol"]);
3142- if (funcName == _mgMS.importFunc) {
3143- functionsTree.view.selection.select(x);
3144- break;
3145- }
3146- }
3147- }
3148- catch (e) {}
3149- }
3150+ else
3151+ selectTreeItem(allFuncs[_mgMS.importFunc].substring(3), _mgMS.importFunc);
3152+}
3153+
3154+function selectTreeItem(aCat, aFunc) {
3155+ document.getElementById("trItemcat" + aCat).setAttribute("open", true);
3156+
3157+ var item = document.getElementById(aFunc);
3158+ functionsTree.view.selection.select(functionsTree.view.getIndexOfItem(item));
3159+ functionsTree.boxObject.ensureRowIsVisible(functionsTree.view.getIndexOfItem(item));
3160+ functionsTree.focus();
3161 }
3162
3163 function bmInit() {
3164@@ -352,9 +370,12 @@
3165
3166 var target = bmTree.selectedNode;
3167
3168- if (!target || target.type != 0)
3169+ if (!target)
3170+ return;
3171+
3172+ if (target.type != 0)
3173 bmSelected = "";
3174- else if (target) {
3175+ else {
3176 try {
3177 bmSelected = mgBMService.plBook.getItemGUID(target.itemId);
3178 }
3179@@ -503,6 +524,19 @@
3180 .selectedIndex = gestureType.selectedIndex;
3181 }
3182
3183+function updateCat(aIndex) {
3184+ document.getElementById("catBox").hidden = (aIndex == 0) ? true : false;
3185+}
3186+
3187+function setTreeSel(tree) {
3188+ var sel = tree.view.selection;
3189+ var index = sel.currentIndex;
3190+ var tc = tree.view.getItemAtIndex(index)
3191+
3192+ if (sel.isSelected(index) && tree.view.isContainer(index))
3193+ sel.clearRange(index, index);
3194+}
3195+
3196 function updateSecondRocker(r1) {
3197 var r2 = document.getElementById("rocker2");
3198 var c = r2.menupopup.childNodes;
3199@@ -599,10 +633,11 @@
3200 code = ":" + wb + ((wd == 1) ? "+" : "-");
3201 }
3202
3203- var type = parseInt(functionType.selectedTab.getAttribute("gestureType"));
3204- var name = null;
3205- var func = null;
3206- var count = 0;
3207+ var type = parseInt(functionType.selectedTab.getAttribute("gestureType"));
3208+ var name = null;
3209+ var func = null;
3210+ var count = 0;
3211+ var cat = mgCategory.selectedItem.id.substring(3);
3212
3213 if (type == 1) { // custom gesture
3214 name = mappingName.value;
3215@@ -654,13 +689,20 @@
3216 type = type.toString() + bmOpenIn.selectedIndex.toString();
3217 }
3218 else { // normal gesture
3219- var row = functionsTree.contentView.selection.currentIndex;
3220- if (row == -1) {
3221- alert(mgGetString("chooseFunction"));
3222- return false;
3223- }
3224-
3225- func = functionsTree.view.getCellText(row, functionsTree.columns["ftFuncCol"]);
3226+ if (functionsTree.view.selection.count < 1) {
3227+ alert(mgGetString("chooseFunction"));
3228+ return false;
3229+ }
3230+
3231+ var item = functionsTree.contentView.getItemAtIndex(functionsTree.contentView.selection.currentIndex);
3232+
3233+ if (!item.id || (item.id && !(item.id in allFuncs))) {
3234+ alert(mgGetString("chooseFunction"));
3235+ return false;
3236+ }
3237+
3238+ func = item.id;
3239+ cat = allFuncs[func].substring(3);
3240 }
3241
3242 var conf = true;
3243@@ -683,8 +725,8 @@
3244 if (conf) {
3245 if (dialogMode == "Edit") {
3246 // let us check if there were changes
3247- if (type != startType || code != startCode ||
3248- name != startName || func != startFunc) {
3249+ if (type != startType || code != startCode || name != startName ||
3250+ func != startFunc || cat != startCat) {
3251 // if code was changed, we have to remove the original gesture
3252 if (code != startCode) {
3253 //rebuild actTemp without startCode
3254@@ -713,7 +755,7 @@
3255 _mgMS.defTemp[wType][code] = _mgMS.defaultMappings[wType][code];
3256
3257 // add the mapping to actTemp
3258- _mgMS.addMapping(wType, code, type, name, func, count);
3259+ _mgMS.addMapping(wType, code, type, name, func, count, cat);
3260 }
3261 else
3262 return false;
3263
3264=== modified file 'chrome/content/pref/edit-mapping.xul'
3265--- chrome/content/pref/edit-mapping.xul 2008-02-27 03:41:55 +0000
3266+++ chrome/content/pref/edit-mapping.xul 2009-07-25 21:50:38 +0000
3267@@ -38,6 +38,7 @@
3268
3269 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
3270 <?xml-stylesheet href="chrome://mozgest/skin/mozgest.css" type="text/css"?>
3271+<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
3272
3273 <!DOCTYPE dialog SYSTEM "chrome://mozgest/locale/mozgest.dtd">
3274 <?xul-overlay href="compassOverlay.xul"?>
3275@@ -53,6 +54,13 @@
3276 mgviewsource="&windowtypes.viewsource;"
3277 mgmessenger="&windowtypes.messenger;"
3278 mgmailcompose="&windowtypes.mailcompose;"
3279+ cat0="&cat0;"
3280+ cat1="&cat1;"
3281+ cat2="&cat2;"
3282+ cat3="&cat3;"
3283+ cat4="&cat4;"
3284+ cat5="&cat5;"
3285+ cat6="&cat6;"
3286 buttons="accept,cancel"
3287 onload="initMain();"
3288 onunload="removeObserver();"
3289@@ -61,7 +69,6 @@
3290
3291 <script type="application/x-javascript" src="../defaults.js"/>
3292 <script type="application/x-javascript" src="../mozgestCommon.js"/>
3293- <script type="application/x-javascript" src="../componentLoader.js"/>
3294 <script type="application/x-javascript" src="../mozgestOverlay.js"/>
3295 <script type="application/x-javascript" src="edit-mapping.js"/>
3296
3297@@ -108,6 +115,7 @@
3298 <row align="center">
3299 <textbox id="codeBox"/>
3300 <toolbarbutton id="mgRegcognizeButton"
3301+ tooltiptext="&recognizer.windowTitle;"
3302 oncommand="showRecognizer(true);"/>
3303 </row>
3304 </rows>
3305@@ -166,6 +174,25 @@
3306 <spacer height="5"/>
3307 </groupbox>
3308
3309+ <spacer height="5"/>
3310+
3311+ <vbox id="catBox">
3312+ <label value="&colDescCat;" class="header"/>
3313+ <menulist id="mgCategory" selectedIndex="0">
3314+ <menupopup>
3315+ <menuitem id="cat1" label="&cat1;"/>
3316+ <menuitem id="cat2" label="&cat2;"/>
3317+ <menuitem id="cat3" label="&cat3;"/>
3318+ <menuitem id="cat4" label="&cat4;"/>
3319+ <menuitem id="cat5" label="&cat5;"/>
3320+ <menuitem id="cat6" label="&cat6;" hidden="true"/>
3321+ <menuitem id="cat0" label="&cat0;"/>
3322+ </menupopup>
3323+ </menulist>
3324+ </vbox>
3325+
3326+ <spacer height="10"/>
3327+
3328 <vbox flex="1">
3329 <spacer flex="1"/>
3330 <hbox>
3331@@ -183,7 +210,7 @@
3332 </vbox>
3333
3334 <vbox flex="3">
3335- <tabbox id="functionType" flex="1">
3336+ <tabbox id="functionType" flex="1" onselect="updateCat(this.selectedIndex)">
3337 <tabs>
3338 <tab label="&mEditor.miBuiltIn;" gestureType="0"/>
3339 <tab label="&mEditor.miCustom;" gestureType="1"/>
3340@@ -194,14 +221,70 @@
3341 <tabpanels flex="1" id="functionDeck">
3342 <tabpanel orient="vertical" flex="1">
3343 <vbox flex="1">
3344- <tree id="functionsTree" hidecolumnpicker="true" style="width:25em;" flex="1" seltype="single">
3345+ <tree id="functionsTree"
3346+ hidecolumnpicker="true"
3347+ style="width:25em;"
3348+ flex="1"
3349+ seltype="single"
3350+ onselect="setTreeSel(this)">
3351 <treecols>
3352- <treecol id="ftFuncCol" label="&mEditor.colFunc;" style="min-width:12em;" persist="width"/>
3353+ <treecol id="mEditorColFunc" label="&mEditor.colFunc;" primary="true" flex="1" persist="width"/>
3354 <splitter class="tree-splitter"/>
3355- <treecol id="ftDescCol" label="&colDescription;" flex="1"/>
3356+ <treecol id="mEditorColDesc" label="&colDescription;" flex="1" persist="width"/>
3357 </treecols>
3358- <treechildren id="ftChildren"/>
3359+
3360+ <treechildren>
3361+ <treeitem container="true" id="trItemcat1" persist="open">
3362+ <treerow>
3363+ <treecell label="&cat1;"/>
3364+ </treerow>
3365+ <treechildren id="trcat1"/>
3366+ </treeitem>
3367+
3368+ <treeitem container="true" id="trItemcat2" persist="open">
3369+ <treerow>
3370+ <treecell label="&cat2;"/>
3371+ </treerow>
3372+ <treechildren id="trcat2"/>
3373+ </treeitem>
3374+
3375+ <treeitem container="true" id="trItemcat3" persist="open">
3376+ <treerow>
3377+ <treecell label="&cat3;"/>
3378+ </treerow>
3379+ <treechildren id="trcat3"/>
3380+ </treeitem>
3381+
3382+ <treeitem container="true" id="trItemcat4" persist="open">
3383+ <treerow>
3384+ <treecell label="&cat4;"/>
3385+ </treerow>
3386+ <treechildren id="trcat4"/>
3387+ </treeitem>
3388+
3389+ <treeitem container="true" id="trItemcat5" persist="open">
3390+ <treerow>
3391+ <treecell label="&cat5;"/>
3392+ </treerow>
3393+ <treechildren id="trcat5"/>
3394+ </treeitem>
3395+
3396+ <treeitem container="true" id="trItemcat6" persist="open">
3397+ <treerow>
3398+ <treecell label="&cat6;"/>
3399+ </treerow>
3400+ <treechildren id="trcat6"/>
3401+ </treeitem>
3402+
3403+ <treeitem container="true" id="trItemcat0" persist="open">
3404+ <treerow>
3405+ <treecell label="&cat0;"/>
3406+ </treerow>
3407+ <treechildren id="trcat0"/>
3408+ </treeitem>
3409+ </treechildren>
3410 </tree>
3411+
3412 </vbox>
3413 </tabpanel>
3414
3415@@ -284,7 +367,7 @@
3416 </treecols>
3417 </tree>
3418
3419- <tree id="mgPlacesTree" class="placesTree"
3420+ <tree id="mgPlacesTree" class="placesTree" ondraggesture="event.preventDefault()"
3421 flex="1" hidecolumnpicker="true" seltype="single" hidden="true" rows="7"
3422 onselect="plSelect(event)" ondblclick="plSelect(event)">
3423 <treecols>
3424
3425=== modified file 'chrome/content/pref/help.xul'
3426--- chrome/content/pref/help.xul 2008-02-27 03:41:55 +0000
3427+++ chrome/content/pref/help.xul 2009-07-25 21:50:38 +0000
3428@@ -44,7 +44,7 @@
3429 width="400"
3430 onload="initHelp();"
3431 hidechrome="true"
3432- style="-moz-appearance:tooltip"
3433+ style="-moz-appearance: tooltip"
3434 onclick="close();"
3435 buttons="accept">
3436
3437
3438=== added file 'chrome/content/pref/importSet.xul'
3439--- chrome/content/pref/importSet.xul 1970-01-01 00:00:00 +0000
3440+++ chrome/content/pref/importSet.xul 2009-07-25 21:50:38 +0000
3441@@ -0,0 +1,250 @@
3442+<?xml version="1.0"?>
3443+
3444+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
3445+<?xml-stylesheet href="chrome://mozgest/skin/mozgest.css" type="text/css"?>
3446+
3447+<!DOCTYPE dialog SYSTEM "chrome://mozgest/locale/mozgest.dtd">
3448+
3449+<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
3450+ id="mgImportGestureSetWindow"
3451+ persist="width,height,screenX,screenY"
3452+ width="350"
3453+ height="500"
3454+ onload="document.title = mgGetString('impTitle');"
3455+ onunload="removeObserver();"
3456+ buttons="accept,cancel"
3457+ ondialogcancel="return persist.cancelSave();"
3458+ ondialogaccept="return persist.cancelSave();">
3459+
3460+ <script type="application/x-javascript" src="../defaults.js"/>
3461+ <script type="application/x-javascript" src="../mozgestCommon.js"/>
3462+
3463+ <vbox flex="1">
3464+ <description id="warningLabel">Warning</description>
3465+ <spacer height="20"/>
3466+
3467+ <groupbox>
3468+ <description id="urlLabel">Location</description>
3469+ <spacer height="10"/>
3470+ <hbox>
3471+ <button id="mgImportButton"
3472+ oncommand="document.getElementById('progressBox').hidden = false;importSet()"
3473+ label="&mappings.btnImport;"/>
3474+ <spacer flex="1"/>
3475+ </hbox>
3476+ </groupbox>
3477+
3478+ <hbox>
3479+ <spacer flex="1"/>
3480+ <button id="mgPermissionButton"
3481+ image="chrome://mozgest/skin/attention.png"
3482+ oncommand="openDialog('chrome://mozgest/content/pref/permissions.xul','','', URI.host);"
3483+ label="&mEditor.lblPermissions;"/>
3484+ </hbox>
3485+
3486+ <spacer height="20"/>
3487+
3488+ <vbox id="progressBox" flex="1" hidden="true">
3489+ <progressmeter id="prMeter"/>
3490+ <spacer height="10"/>
3491+ <deck id="msgDeck" selectedIndex="0">
3492+ <description id="msgDeck0"/>
3493+ <description id="msgDeck1">Succes</description>
3494+ <description id="msgDeck2">Restored</description>
3495+ <description id="msgDeck3">Error</description>
3496+ </deck>
3497+ </vbox>
3498+
3499+ <spacer height="10"/>
3500+
3501+ </vbox>
3502+
3503+ <script type="application/x-javascript">
3504+ <![CDATA[
3505+ var downloadError;
3506+
3507+ try {
3508+ var systemBundle = Components.classes["@mozilla.org/intl/stringbundle;1"].getService()
3509+ .QueryInterface(Components.interfaces.nsIStringBundleService)
3510+ .createBundle("chrome://global/locale/filepicker.properties");
3511+
3512+ downloadError = systemBundle.GetStringFromName("errorOpenFileDoesntExistTitle");
3513+ }
3514+ catch (e) {
3515+ downloadError = "Error opening %S"
3516+ }
3517+
3518+ var msgDeck = document.getElementById("msgDeck");
3519+
3520+ var cc = Components.classes;
3521+ var ci = Components.interfaces;
3522+ var aURL;
3523+
3524+ if (("arguments" in window))
3525+ aURL = window.arguments[0];
3526+ else {
3527+ var fp = cc["@mozilla.org/filepicker;1"].createInstance(ci.nsIFilePicker);
3528+ fp.init(window, mgGetString("impTitle"), ci.nsIFilePicker.modeOpen);
3529+
3530+ var retVal = fp.show();
3531+
3532+ if (retVal == ci.nsIFilePicker.returnOK)
3533+ aURL = fp.fileURL.spec;
3534+ else
3535+ window.close();
3536+ }
3537+
3538+ document.getElementById("warningLabel").firstChild.nodeValue = mgGetString("impWarning");
3539+ var importButton = document.getElementById("mgImportButton");
3540+ var succesLabel = document.getElementById("successLabel");
3541+ var acceptButton = document.documentElement._buttons.accept;
3542+ var cancelButton = document.documentElement._buttons.cancel;
3543+
3544+ acceptButton.hidden = true;
3545+
3546+ if (aURL) {
3547+ var imported = false;
3548+ downloadError = downloadError.replace(/%S/, decodeURI(aURL));
3549+
3550+ document.getElementById("msgDeck1").firstChild.nodeValue = mgGetString("impSuccess");
3551+ document.getElementById("msgDeck2").firstChild.nodeValue = mgGetString("impCorrupt");
3552+ document.getElementById("msgDeck3").firstChild.nodeValue = downloadError;
3553+ document.getElementById("urlLabel").firstChild.nodeValue = decodeURI(aURL);
3554+
3555+ var ioService = Components.classes["@mozilla.org/network/io-service;1"]
3556+ .getService(Components.interfaces.nsIIOService);
3557+
3558+ var URI = ioService.newURI(aURL, null, null);
3559+
3560+ var persist = cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
3561+ .createInstance(ci.nsIWebBrowserPersist);
3562+
3563+ persist.persistFlags = ci.nsIWebBrowserPersist.PERSIST_FLAGS_BYPASS_CACHE;
3564+ persist.persistFlags |= ci.nsIWebBrowserPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES;
3565+ persist.persistFlags |= ci.nsIWebBrowserPersist.PERSIST_FLAGS_IGNORE_REDIRECTED_DATA;
3566+ persist.persistFlags |= ci.nsIWebBrowserPersist.PERSIST_FLAGS_FAIL_ON_BROKEN_LINKS;
3567+
3568+ var mgPermissionObserver = {
3569+ observe: function(subject, topic, data) {
3570+ if (topic.indexOf("nsPref") == 0) {
3571+ if (data == "importFrom")
3572+ checkPermissions();
3573+ }
3574+ }
3575+ }
3576+
3577+ mgPrefs.prefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal)
3578+ .addObserver("", mgPermissionObserver, false);
3579+
3580+ checkPermissions();
3581+ }
3582+
3583+ function importSet() {
3584+ var profile = cc['@mozilla.org/file/directory_service;1'].getService(ci.nsIProperties);
3585+ var filePath = profile.get('ProfD', ci.nsILocalFile);
3586+ var oldFile = profile.get('ProfD', ci.nsILocalFile);
3587+ oldFile.appendRelativePath("mousegestures.js");
3588+
3589+ var filePathDir = profile.get('ProfD', ci.nsILocalFile);
3590+ filePathDir.append("mozgest2")
3591+
3592+ try {
3593+ filePathDir.create(1, 0755);
3594+ }
3595+ catch (e) {}
3596+
3597+ var now = new Date();
3598+ var year = now.getFullYear();
3599+ var month = now.getMonth() +1;
3600+ month = (month < 10) ? "0"+month : month;
3601+ var day = now.getDate();
3602+ day = (day < 10) ? "0"+day : day;
3603+
3604+ var impText = "mousegestures_import_" + year + month + day + ".js";
3605+ filePathDir.append(impText);
3606+
3607+ persist.progressListener = {
3608+ onProgressChange: function (aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress) {
3609+ var percentComplete = (aCurTotalProgress/aMaxTotalProgress)*100;
3610+ document.getElementById("prMeter").value = parseInt(percentComplete);
3611+
3612+ if (parseInt(percentComplete) > 90 || URI.scheme == "file")
3613+ imported = true;
3614+
3615+ if (aRequest.name != aURL)
3616+ imported = false;
3617+ },
3618+
3619+ onStatusChange : function (a, b, c, d) {},
3620+
3621+ onStateChange: function (aWebProgress, aRequest, aStatus, aMessage) {
3622+ if (imported && (aStatus & persist.progressListener.STATE_STOP)) {
3623+ try {
3624+ oldFile.remove(false);
3625+ filePathDir.copyTo(filePath, "mousegestures.js");
3626+ _mgMS.getActiveMappings();
3627+ mgCommon.notifyObservers("mappingsUpdated");
3628+ msgDeck.selectedIndex = 1;
3629+ }
3630+ catch (e) {
3631+ try {
3632+ oldFile.remove(false);
3633+ }
3634+ catch (e) {}
3635+
3636+ _mgMS.removedDefaultMappings = new Array();
3637+ _mgMS.cleanUp();
3638+ _mgMS.getActiveMappings();
3639+ mgCommon.notifyObservers("mappingsUpdated");
3640+ msgDeck.selectedIndex = 2;
3641+ }
3642+ }
3643+
3644+ if (!imported && (aStatus & persist.progressListener.STATE_STOP))
3645+ msgDeck.selectedIndex = 3;
3646+
3647+ acceptButton.hidden = false;
3648+ cancelButton.hidden = true;
3649+ importButton.disabled = true;
3650+ }
3651+ }
3652+
3653+ persist.saveURI(URI, null, null, null, null, filePathDir);
3654+ }
3655+
3656+ function checkPermissions() {
3657+ var permButton = document.getElementById("mgPermissionButton");
3658+ permButton.setAttribute("tooltiptext", mgGetString("permButtonLabel1"));
3659+ permButton.removeAttribute("mgAllowImport");
3660+ importButton.disabled = true;
3661+
3662+ var allowedHosts = mgPrefs.prefs.getCharPref("importFrom").split("|");
3663+ var allow = (URI.scheme == "file") ? true : false;
3664+
3665+ if (!allow) {
3666+ for (var x = 0; x < allowedHosts.length; x++) {
3667+ if (allowedHosts[x] == URI.host) {
3668+ allow = true;
3669+ break;
3670+ }
3671+ }
3672+ }
3673+
3674+ if (allow) {
3675+ importButton.disabled = false;
3676+ permButton.setAttribute("tooltiptext", mgGetString("permButtonLabel0"));
3677+ permButton.setAttribute("mgAllowImport", true);
3678+ }
3679+ }
3680+
3681+ function removeObserver() {
3682+ try {
3683+ mgPrefs.prefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal)
3684+ .removeObserver("", mgPermissionObserver);
3685+ }
3686+ catch (e) {}
3687+ }
3688+
3689+ ]]>
3690+ </script>
3691+</dialog>
3692\ No newline at end of file
3693
3694=== modified file 'chrome/content/pref/mappings.js'
3695--- chrome/content/pref/mappings.js 2008-02-27 03:41:55 +0000
3696+++ chrome/content/pref/mappings.js 2009-07-25 21:50:38 +0000
3697@@ -35,8 +35,7 @@
3698 *
3699 * ***** END LICENSE BLOCK ***** */
3700
3701-var mgTabBox, mappingsTree, defaultTree;
3702-var tChildren, mChildren, dChildren;
3703+var mgTabBox, mapTree, defTree, mgCatLen;
3704 var sortByGesture = new Array();
3705 var sortByName = new Array();
3706 var sortBy = "byName";
3707@@ -45,11 +44,10 @@
3708 var exportButton;
3709
3710 function initMappingsWindow(restart) {
3711- mgTabBox = document.getElementById("mgTabBox");
3712- mappingsTree = document.getElementById("mappingstree");
3713- defaultTree = document.getElementById("defaultmappingstree");
3714- mChildren = document.getElementById("mappingstreechildren");
3715- dChildren = document.getElementById("defaultstreechildren");
3716+ mgTabBox = document.getElementById("mgTabBox");
3717+ mapTree = document.getElementById("mapTree");
3718+ defTree = document.getElementById("defTree");
3719+ mgCatLen = document.getElementById("mapTreeChildren").childNodes.length;
3720 exportButton = document.getElementById("exportButton");
3721
3722 //from compassOverlay.xul
3723@@ -94,7 +92,9 @@
3724 if (window.arguments[0]) {
3725 var args = window.arguments[0];
3726 mgTabBox.selectedTab = document.getElementsByAttribute("mgWinType", args[1])[0];
3727- setTimeout(handleArguments, 0, args[0], args[2]);
3728+
3729+ if (args[0] == "directEdit" || args[0] == "Import")
3730+ setTimeout(handleArguments, 0, args[0], args[2]);
3731 }
3732 }
3733 else {
3734@@ -127,19 +127,38 @@
3735 else
3736 mName = mgGetString(acm[mapping].func);
3737
3738- mgCommon.addTreeRow(mChildren, new Array(mgMappingLocalizer.localize(mapping), decodeURIComponent(mName), mapping));
3739+ var tc = document.getElementById("trcat" + acm[mapping].cat)
3740+ mgCommon.addTreeRow(tc, new Array(mgMappingLocalizer.localize(mapping), decodeURIComponent(mName)), "act" + mapping);
3741+
3742 }
3743
3744+ setCount("trItemcatLabel", "trcat");
3745 showRemovedDefaults(component);
3746 }
3747
3748+function setCount(label, item) {
3749+ for (var x = 0; x < mgCatLen; x++) {
3750+ var lbl = document.getElementById(label + x);
3751+ var tCat = document.getElementById(item + x);
3752+ var count = tCat.childNodes.length;
3753+
3754+ tCat.parentNode.setAttribute("hidden", (count > 0) ? false : true);
3755+ lbl.setAttribute("label", "(" + count + ")");
3756+ }
3757+}
3758+
3759 function clearTrees() {
3760- while (mChildren.hasChildNodes())
3761- mChildren.removeChild(mChildren.firstChild);
3762-
3763- while (dChildren.hasChildNodes())
3764- dChildren.removeChild(dChildren.firstChild);
3765-
3766+ for (var x=0; x < mgCatLen; x++) {
3767+ var tc = document.getElementById("trcat" + x);
3768+
3769+ while (tc.hasChildNodes())
3770+ tc.removeChild(tc.firstChild);
3771+
3772+ var tc1 = document.getElementById("deftrcat" + x);
3773+
3774+ while (tc1.hasChildNodes())
3775+ tc1.removeChild(tc1.firstChild);
3776+ }
3777 }
3778
3779 function sortTree(sortOrder, dir) {
3780@@ -157,13 +176,17 @@
3781 else
3782 mName = mgGetString(_mgMS.actTemp[component][mapping].func);
3783
3784- sortByName[component][sortByName[component].length] = [mName, mapping];
3785+ sortByName[component][sortByName[component].length] = [mName, mapping, _mgMS.actTemp[component][mapping].cat];
3786 }
3787
3788+
3789+
3790 if (dir == "ascending")
3791 sortByName[component].sort(function(a, b) {return ((a[0].toLowerCase())>(b[0].toLowerCase()) ? 1 : -1)} );
3792 if (dir == "descending")
3793 sortByName[component].sort(function(a, b) {return ((a[0].toLowerCase())<(b[0].toLowerCase()) ? 1 : -1)} );
3794+
3795+ sortByName[component].sort(function(a, b) {return ((a[2])>(b[2]) ? 1 : -1)} );
3796 }
3797
3798 for (component in _mgMS.actTemp) {
3799@@ -225,46 +248,53 @@
3800 }
3801
3802 function showRemovedDefaults() {
3803- while (dChildren.hasChildNodes())
3804- dChildren.removeChild(dChildren.firstChild);
3805-
3806 var rdm = _mgMS.defTemp[wType];
3807
3808- for (var mapping in rdm)
3809- mgCommon.addTreeRow(dChildren, new Array(mgMappingLocalizer.localize(mapping),
3810- mgGetString(rdm[mapping].func)));
3811+ for (var mapping in rdm) {
3812+ var tc = document.getElementById("deftrcat" + rdm[mapping].cat);
3813+
3814+ mgCommon.addTreeRow(tc, new Array(mgMappingLocalizer.localize(mapping),
3815+ mgGetString(rdm[mapping].func)), "def" + mapping);
3816+ }
3817+
3818+ setCount("deftrItemcatLabel", "deftrcat");
3819 }
3820
3821 function removeMapping() {
3822 exportButton.disabled = true;
3823 var delArray = new Array();
3824
3825- if (mappingsTree.view.selection.count > 1) {
3826- for (var x = 0; x < mappingsTree.view.rowCount; x++)
3827- if (mappingsTree.view.selection.isSelected(x))
3828- delArray.push(x);
3829+ for (var x = 0; x < mapTree.view.rowCount; x++) {
3830+ if (mapTree.view.selection.isSelected(x)) {
3831+ var tc = mapTree.view.getItemAtIndex(x);
3832+
3833+ if (tc.id.indexOf("trItemcat") != 0)
3834+ delArray[delArray.length] = tc.id;
3835+ }
3836 }
3837- else
3838- delArray.push(mappingsTree.view.selection.currentIndex);
3839
3840+ mapTree.view.selection.clearSelection();
3841 var tempArray = new Array();
3842
3843- while (delArray.length) {
3844- var row = delArray[delArray.length-1];
3845- var map = mappingsTree.view.getCellText(row, mappingsTree.columns["origCodeCol"]);
3846+ for (x = 0; x < delArray.length; x++) {
3847+ var map = delArray[x].substring(3);
3848+ var item = document.getElementById(delArray[x]);
3849 tempArray[map] = "true";
3850
3851 if (map in _mgMS.defaultMappings[wType]) {
3852 if (!_mgMS.actTemp[wType][map].name &&
3853- _mgMS.actTemp[wType][map].func == _mgMS.defaultMappings[wType][map].func)
3854+ _mgMS.actTemp[wType][map].func == _mgMS.defaultMappings[wType][map].func)
3855 {
3856- var mName = mgGetString(_mgMS.actTemp[wType][map].func);
3857- _mgMS.defTemp[wType][map] = _mgMS.actTemp[wType][map];
3858- mgCommon.addTreeRow(dChildren, new Array(mgMappingLocalizer.localize(map), mName, map));
3859+ _mgMS.defTemp[wType][map] = _mgMS.actTemp[wType][map];
3860+
3861+ var deftrcat = document.getElementById("def" + item.parentNode.id);
3862+
3863+ mgCommon.addTreeRow(deftrcat, new Array(mgMappingLocalizer.localize(map),
3864+ mgGetString(_mgMS.defaultMappings[wType][map].func)), "def" + map);
3865+
3866 }
3867 }
3868- mChildren.removeChild(mChildren.childNodes[row]);
3869- delArray.pop();
3870+ item.parentNode.removeChild(item);
3871 }
3872
3873 // rebuild _mgMS.actTemp
3874@@ -277,25 +307,29 @@
3875
3876 _mgMS.actTemp[wType][mapping1] = temp[mapping1];
3877 }
3878+
3879+ sortTree(sortBy, sortOrder);
3880+ showMappingsFor(wType);
3881 }
3882
3883 function addDefault() {
3884- var row = defaultTree.contentView.selection.currentIndex;
3885- var locCode = defaultTree.view.getCellText(row, defaultTree.columns["dmCodeCol"]);
3886- var locName = defaultTree.view.getCellText(row, defaultTree.columns["dmDescCol"]);
3887- var mapping = mgMappingLocalizer.deLocalize(locCode);
3888+ var index = defTree.view.selection.currentIndex;
3889+ var defItem = defTree.view.getItemAtIndex(index);
3890+ var defItemParent = defItem.parentNode;
3891+
3892+ var mapping = defItem.id.substring(3);
3893+ var mapItemID = "act" + defItem.id.substring(3);
3894+ var mapItemParent = document.getElementById(defItemParent.id.substring(3));
3895
3896 if (overWriteCheck(mapping)) {
3897- // search for the mapping and remove it!
3898- // setting the cellText will crash!
3899- for (var x = 0; x < mChildren.childNodes.length; x++) {
3900- if (mappingsTree.view.getCellText(x, mappingsTree.columns["origCodeCol"]) == mapping) {
3901- mChildren.removeChild(mChildren.childNodes[x]);
3902- break;
3903- }
3904- }
3905-
3906- mgCommon.addTreeRow(mChildren, new Array(locCode, locName, mapping));
3907+ var mapItem = document.getElementById(mapItemID);
3908+
3909+ if (mapItem)
3910+ mapItem.parentNode.removeChild(mapItem);
3911+
3912+ mgCommon.addTreeRow(mapItemParent, new Array(mgMappingLocalizer.localize(mapping),
3913+ mgGetString(_mgMS.defaultMappings[wType][mapping].func)), "act" + mapping);
3914+
3915
3916 // rebuild _mgMS.defTemp
3917 var temp = _mgMS.defTemp[wType];
3918@@ -314,7 +348,8 @@
3919 _mgMS.actTemp[wType][mapping].count = 0;
3920
3921 temp = null;
3922- dChildren.removeChild(dChildren.childNodes[row]);
3923+ defTree.view.selection.clearSelection();
3924+ defItemParent.removeChild(defItem);
3925 sortTree(sortBy, sortOrder);
3926 showMappingsFor(wType);
3927 exportButton.disabled = true;
3928@@ -343,16 +378,15 @@
3929
3930 function handleArguments(editMode, eCode) {
3931 if (editMode == "directEdit") {
3932- for (var x = 0; x < mChildren.childNodes.length; x++) {
3933- var oCode = mappingsTree.view.getCellText(x, mappingsTree.columns["origCodeCol"]);
3934-
3935- if (oCode == eCode) {
3936- mappingsTree.view.selection.select(x);
3937- mappingsTree.boxObject.ensureRowIsVisible(x)
3938- break;
3939- }
3940- }
3941- mappingsTree.focus();
3942+ var item = document.getElementById("act" + eCode);
3943+
3944+ var cat = _mgMS.actTemp[wType][eCode].cat;
3945+ document.getElementById("trItemcat" + cat).setAttribute("open", true);
3946+
3947+ mapTree.view.selection.select(mapTree.view.getIndexOfItem(item));
3948+ mapTree.boxObject.ensureRowIsVisible(mapTree.view.getIndexOfItem(item));
3949+
3950+ mapTree.focus();
3951 editMapping("Edit");
3952 }
3953 else if (editMode == "Import")
3954@@ -382,8 +416,9 @@
3955 var mapping = null;
3956
3957 if (mode == "Edit") {
3958- var row = mappingsTree.view.selection.currentIndex;
3959- mapping = mappingsTree.view.getCellText(row, mappingsTree.columns["origCodeCol"]);
3960+ var index = mapTree.view.selection.currentIndex;
3961+ var tc = mapTree.view.getItemAtIndex(index);
3962+ mapping = tc.id.substring(3);
3963 }
3964 if (mode == "Import") {
3965 wType =_mgMS.importWinType;
3966@@ -399,39 +434,68 @@
3967 }
3968
3969 function publishMapping() {
3970- var row = mappingsTree.view.selection.currentIndex;
3971- var mapping = mappingsTree.view.getCellText(row, mappingsTree.columns["origCodeCol"]);
3972+ var index = mapTree.view.selection.currentIndex;
3973+ var tc = mapTree.view.getItemAtIndex(index);
3974+ var mapping = tc.id.substring(3);
3975
3976 window.openDialog("chrome://mozgest/content/pref/publishMapping.xul",
3977 "mozgest:publishmapping", "chrome,centerscreen,modal",
3978 wType, mapping);
3979 }
3980
3981-
3982 function updateButtons(tree, buttons) {
3983- buttons.setAttribute("disabled", tree.currentIndex != -1 ? false : true);
3984+ buttons.setAttribute("disabled", true);
3985+
3986+ var sel = tree.view.selection;
3987+
3988+ if (sel.count == 0)
3989+ return;
3990+
3991+ var index = sel.currentIndex;
3992+ var tc = tree.view.getItemAtIndex(index)
3993+
3994+ if (sel.isSelected(index) && tree.view.isContainer(index))
3995+ sel.clearRange(index, index);
3996
3997 if (buttons.id == "editButtons") {
3998- try {
3999- var row = mappingsTree.view.selection.currentIndex;
4000- var mapping = mappingsTree.view.getCellText(row, mappingsTree.columns["origCodeCol"]);
4001- var isBookMark = false;
4002-
4003- if ((mapping in _mgMS.actTemp[wType] &&
4004- _mgMS.actTemp[wType][mapping].type &&
4005- _mgMS.actTemp[wType][mapping].type.toString().indexOf("2") == 0) ||
4006- mappingsTree.view.selection.count > 1)
4007- isBookMark = true;
4008-
4009- document.getElementById("publishButton").disabled = isBookMark ? true : false;
4010- }
4011- catch (e) {}
4012-
4013- try {
4014- document.getElementById("editButton").disabled = (mappingsTree.view.selection.count == 1) ? false : true;
4015- }
4016- catch (e) {}
4017+ var pub = document.getElementById("publishButton");
4018+ var ed = document.getElementById("editButton");
4019+
4020+ if (sel.count == 0)
4021+ buttons.setAttribute("disabled", true);
4022+ else if (sel.count == 1) {
4023+ buttons.setAttribute("disabled", false);
4024+
4025+ index = sel.currentIndex;
4026+ tc = tree.view.getItemAtIndex(index);
4027+
4028+ if (!sel.isSelected(index)) {
4029+ for (x = 0; x < tree.view.rowCount; x++) {
4030+ if (sel.isSelected(x)) {
4031+ tc = tree.view.getItemAtIndex(x);
4032+ break;
4033+ }
4034+ }
4035+ }
4036+
4037+ var mapping = tc.id.substring(3)
4038+
4039+ if (mapping in _mgMS.actTemp[wType]) {
4040+ if (!_mgMS.actTemp[wType][mapping].type || _mgMS.actTemp[wType][mapping].type != 1)
4041+ pub.setAttribute("disabled", true);
4042+ }
4043+ }
4044+ else if (sel.count > 1) {
4045+ buttons.setAttribute("disabled", false);
4046+ pub.setAttribute("disabled", true);
4047+ ed.setAttribute("disabled", true);
4048+ }
4049+
4050+ return;
4051 }
4052+
4053+ if (sel.count > 0)
4054+ buttons.setAttribute("disabled", false);
4055 }
4056
4057 var mgMappingsObserver = {
4058
4059=== modified file 'chrome/content/pref/mappings.xul'
4060--- chrome/content/pref/mappings.xul 2008-02-27 03:41:55 +0000
4061+++ chrome/content/pref/mappings.xul 2009-07-25 21:50:38 +0000
4062@@ -38,6 +38,7 @@
4063
4064
4065 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
4066+<?xml-stylesheet href="chrome://mozgest/skin/mozgest.css" type="text/css"?>
4067
4068 <!DOCTYPE dialog SYSTEM "chrome://mozgest/locale/mozgest.dtd">
4069 <?xul-overlay href="compassOverlay.xul"?>
4070@@ -50,11 +51,17 @@
4071 persist="screenX,screenY,width,height"
4072 buttons="accept,cancel"
4073 ondialogaccept="return onAcceptMappings();"
4074- ondialogcancel="return onCancel()">
4075+ ondialogcancel="return onCancel()"
4076+ cat0="&cat0;"
4077+ cat1="&cat1;"
4078+ cat2="&cat2;"
4079+ cat3="&cat3;"
4080+ cat4="&cat4;"
4081+ cat5="&cat5;"
4082+ cat6="&cat6;">
4083
4084 <script type="application/x-javascript" src="../defaults.js"/>
4085 <script type="application/x-javascript" src="../mozgestCommon.js"/>
4086- <script type="application/x-javascript" src="../componentLoader.js"/>
4087 <script type="application/x-javascript" src="mappings.js"/>
4088
4089 <broadcasterset id="broadcasterset">
4090@@ -85,33 +92,92 @@
4091 <rows>
4092
4093 <row>
4094- <label value="&mappings.lblActive;" class="header"/>
4095+ <label id="lblActive" value="&mappings.lblActive;" mgLblValue="&mappings.lblActive;" class="header"/>
4096 <hbox/>
4097 </row>
4098
4099- <row flex="3">
4100- <tree id="mappingstree" style="width:30em;" flags="dont-build-content" hidecolumnpicker="true"
4101+ <row flex="3" id="mapTreeRow" persist="height">
4102+ <tree id="mapTree" hidecolumnpicker="true" style="width:25em;" flex="1"
4103 onselect="updateButtons(this, document.getElementById('editButtons'))">
4104+
4105 <treecols>
4106- <treecol id="codeCol"
4107+ <treecol id="mEditorColFunc"
4108 label="&mappings.colGesture;"
4109+ primary="true"
4110+ persist="width"
4111+ flex="2"
4112 onclick="if (event.button == 0)
4113 changeSortOrder('byGesture', this, this.nextSibling.nextSibling)"
4114- width="80"
4115- mgOldSortDirection="descending"
4116- persist="width"/>
4117+ mgOldSortDirection="descending"/>
4118 <splitter class="tree-splitter"/>
4119- <treecol id="funcCol"
4120+ <treecol id="mEditorColDesc"
4121 label="&colDescription;"
4122+ persist="width"
4123+ flex="1"
4124 sortDirection="ascending"
4125 mgOldSortDirection="descending"
4126 onclick="if (event.button == 0)
4127- changeSortOrder('byName', this, this.previousSibling.previousSibling)"
4128- flex="1"/>
4129- <treecol id="origCodeCol"
4130- hidden="true"/>
4131+ changeSortOrder('byName', this, this.previousSibling.previousSibling)"/>
4132 </treecols>
4133- <treechildren id="mappingstreechildren"/>
4134+
4135+ <treechildren id="mapTreeChildren">
4136+ <treeitem container="true" id="trItemcat1" persist="open">
4137+ <treerow>
4138+ <treecell label="&cat1;"/>
4139+ <treecell id="trItemcatLabel1" properties="mozgestCount"/>
4140+ </treerow>
4141+ <treechildren id="trcat1"/>
4142+ </treeitem>
4143+
4144+ <treeitem container="true" id="trItemcat2" persist="open">
4145+ <treerow>
4146+ <treecell label="&cat2;"/>
4147+ <treecell id="trItemcatLabel2" properties="mozgestCount"/>
4148+ </treerow>
4149+ <treechildren id="trcat2"/>
4150+ </treeitem>
4151+
4152+ <treeitem container="true" id="trItemcat3" persist="open">
4153+ <treerow>
4154+ <treecell label="&cat3;"/>
4155+ <treecell id="trItemcatLabel3" properties="mozgestCount"/>
4156+ </treerow>
4157+ <treechildren id="trcat3"/>
4158+ </treeitem>
4159+
4160+ <treeitem container="true" id="trItemcat4" persist="open">
4161+ <treerow>
4162+ <treecell label="&cat4;"/>
4163+ <treecell id="trItemcatLabel4" properties="mozgestCount"/>
4164+ </treerow>
4165+ <treechildren id="trcat4"/>
4166+ </treeitem>
4167+
4168+ <treeitem container="true" id="trItemcat5" persist="open">
4169+ <treerow>
4170+ <treecell label="&cat5;"/>
4171+ <treecell id="trItemcatLabel5" properties="mozgestCount"/>
4172+ </treerow>
4173+ <treechildren id="trcat5"/>
4174+ </treeitem>
4175+
4176+ <treeitem container="true" id="trItemcat6" persist="open">
4177+ <treerow>
4178+ <treecell label="&cat6;"/>
4179+ <treecell id="trItemcatLabel6" properties="mozgestCount"/>
4180+ </treerow>
4181+ <treechildren id="trcat6"/>
4182+ </treeitem>
4183+
4184+ <treeitem container="true" id="trItemcat0" persist="open">
4185+ <treerow>
4186+ <treecell label="&cat0;"/>
4187+ <treecell id="trItemcatLabel0" properties="mozgestCount"/>
4188+ </treerow>
4189+ <treechildren id="trcat0"/>
4190+ </treeitem>
4191+
4192+ </treechildren>
4193 </tree>
4194
4195 <vbox>
4196@@ -131,25 +197,91 @@
4197 </vbox>
4198 </row>
4199
4200- <row>
4201- <separator/>
4202- </row>
4203-
4204- <row>
4205- <label value="&mappings.lblInactive;" class="header"/>
4206- </row>
4207-
4208- <row flex="1">
4209- <tree id="defaultmappingstree" hidecolumnpicker="true" seltype="single"
4210+
4211+ <splitter resizeafter="farthest" style="margin:5px"/>
4212+ <row>
4213+ <label id="lblInactive" value="&mappings.lblInactive;" mgLblValue="&mappings.lblInactive;" class="header"/>
4214+ </row>
4215+
4216+ <row flex="1" id="defTreeRow" persist="height">
4217+ <tree id="defTree" hidecolumnpicker="true" style="width:25em;" flex="1" seltype="single"
4218 onselect="updateButtons(this, document.getElementById('addButton'))">
4219 <treecols>
4220- <treecol id="dmCodeCol" hideheader="true">
4221- <observes element="codeCol" attribute="width"/>
4222- </treecol>
4223- <treecol id="dmDescCol" flex="1" hideheader="true"/>
4224- <treecol id="dmResCol" hidden="true"/>
4225+ <treecol id="defCodeCol"
4226+ primary="true"
4227+ persist="width"
4228+ flex="2"
4229+ hideheader="true">
4230+ <observes element="mEditorColFunc" attribute="width"/>
4231+ </treecol>
4232+ <treecol id="defDescCol"
4233+ persist="width"
4234+ flex="1"
4235+ sortDirection="ascending"
4236+ hideheader="true">
4237+ <observes element="mEditorColDesc" attribute="width"/>
4238+ </treecol>
4239 </treecols>
4240- <treechildren id="defaultstreechildren"/>
4241+
4242+ <treechildren>
4243+
4244+ <treeitem container="true" id="deftrItemcat1" persist="open">
4245+ <treerow>
4246+ <treecell label="&cat1;"/>
4247+ <treecell id="deftrItemcatLabel1" properties="mozgestCount"/>
4248+ </treerow>
4249+ <treechildren id="deftrcat1"/>
4250+ </treeitem>
4251+
4252+ <treeitem container="true" id="deftrItemcat2" persist="open">
4253+ <treerow>
4254+ <treecell label="&cat2;"/>
4255+ <treecell id="deftrItemcatLabel2" properties="mozgestCount"/>
4256+ </treerow>
4257+ <treechildren id="deftrcat2"/>
4258+ </treeitem>
4259+
4260+ <treeitem container="true" id="deftrItemcat3" persist="open">
4261+ <treerow>
4262+ <treecell label="&cat3;"/>
4263+ <treecell id="deftrItemcatLabel3" properties="mozgestCount"/>
4264+ </treerow>
4265+ <treechildren id="deftrcat3"/>
4266+ </treeitem>
4267+
4268+ <treeitem container="true" id="deftrItemcat4" persist="open">
4269+ <treerow>
4270+ <treecell label="&cat4;"/>
4271+ <treecell id="deftrItemcatLabel4" properties="mozgestCount"/>
4272+ </treerow>
4273+ <treechildren id="deftrcat4"/>
4274+ </treeitem>
4275+
4276+ <treeitem container="true" id="deftrItemcat5" persist="open">
4277+ <treerow>
4278+ <treecell label="&cat5;"/>
4279+ <treecell id="deftrItemcatLabel5" properties="mozgestCount"/>
4280+ </treerow>
4281+ <treechildren id="deftrcat5"/>
4282+ </treeitem>
4283+
4284+ <treeitem container="true" id="deftrItemcat6" persist="open">
4285+ <treerow>
4286+ <treecell label="&cat6;"/>
4287+ <treecell id="deftrItemcatLabel6" properties="mozgestCount"/>
4288+ </treerow>
4289+ <treechildren id="deftrcat6"/>
4290+ </treeitem>
4291+
4292+ <treeitem container="true" id="deftrItemcat0" persist="open">
4293+ <treerow>
4294+ <treecell label="&cat0;"/>
4295+ <treecell id="deftrItemcatLabel0" properties="mozgestCount"/>
4296+ </treerow>
4297+ <treechildren id="deftrcat0"/>
4298+ </treeitem>
4299+
4300+ </treechildren>
4301 </tree>
4302
4303 <vbox>
4304
4305=== modified file 'chrome/content/pref/pref-mozgest.js'
4306--- chrome/content/pref/pref-mozgest.js 2008-02-27 03:41:55 +0000
4307+++ chrome/content/pref/pref-mozgest.js 2009-07-25 21:50:38 +0000
4308@@ -138,7 +138,7 @@
4309 || document.getElementById("modifier.ctrl").checked
4310 || document.getElementById("modifier.alt").checked
4311 || document.getElementById("modifier.shift").checked,
4312- new Array("lmbGestureLimit", "dragdropDelay"));
4313+ new Array("lmbGestureLimit"));
4314 }
4315
4316 function onMouseButtonChange() {
4317@@ -173,7 +173,7 @@
4318 }
4319
4320 function toggleStatusSettingsBox() {
4321- toggleElements(!document.getElementById("status.enabled").checked,
4322+ toggleElements(!document.getElementById("status.isEnabled").checked,
4323 new Array("status.timeout"));
4324 }
4325
4326@@ -214,23 +214,6 @@
4327 mgCommon.openDialog("chrome://mozgest/content/pref/mappings.xul");
4328 }
4329
4330-function openPrintWindow() {
4331- if (mgCommon.checkWindowOpen('chrome://mozgest/content/sidebar/mozgestSidebar.xul'))
4332- return;
4333-
4334- try {
4335- var appS = Components.classes["@mozilla.org/appshell/appShellService;1"]
4336- .getService().QueryInterface(Components.interfaces.nsIAppShellService);
4337-
4338- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
4339- .getService(Components.interfaces.nsIIOService);
4340- var pURI = ioService.newURI('chrome://mozgest/content/sidebar/mozgestSidebar.xul',
4341- null, null);
4342- appS.createTopLevelWindow(null, pURI, true, false, 4094, null, null);
4343- }
4344- catch (e) {}
4345-}
4346-
4347 function mgExitPrefPanel() {
4348 mgPrefs.prefs.setIntPref("selectedTabIndex", mgTabBox.selectedIndex);
4349 }
4350\ No newline at end of file
4351
4352=== modified file 'chrome/content/pref/pref-mozgest.xul'
4353--- chrome/content/pref/pref-mozgest.xul 2008-02-27 03:41:55 +0000
4354+++ chrome/content/pref/pref-mozgest.xul 2009-07-25 21:50:38 +0000
4355@@ -54,20 +54,19 @@
4356 onunload="mgExitPrefPanel();"
4357 ondialogaccept="savePrefs();">
4358
4359- <script type="application/x-javascript" src="../defaults.js"/>
4360+ <script type="application/x-javascript" src="../defaults.js"/>
4361 <script type="application/x-javascript" src="../mozgestCommon.js"/>
4362- <script type="application/x-javascript" src="../componentLoader.js"/>
4363 <script type="application/x-javascript" src="pref-mozgest.js"/>
4364
4365 <script type="application/x-javascript">
4366 <![CDATA[
4367 var eltIDs = [
4368 "mousebutton", "modifier.meta", "modifier.ctrl", "modifier.alt",
4369- "modifier.shift", "lefthanded", "dragdropDelay", "lmbGestureLimit",
4370+ "modifier.shift", "lefthanded", "lmbGestureLimit",
4371 "enableStrokes", "grid", "diagonalTolerance", "delay",
4372 "enableRockers", "staticRockers", "enableWheelRockers", "staticWheelRockers",
4373 "trails.enabled", "trails.width", "trails.interval", "trails.color",
4374- "status.enabled", "status.timeout"
4375+ "status.isEnabled", "status.timeout"
4376 ];
4377 ]]>
4378 </script>
4379@@ -135,14 +134,6 @@
4380 mgHelpDesc="&lmbGestureLimitDesc;"
4381 onclick="mgCommon.openHint(this.parentNode.firstChild.value, this);"/>
4382 </hbox>
4383- <hbox align="center">
4384- <label value="&lmbDragdropDelay;"/>
4385- <textbox id="dragdropDelay" size="3"/>
4386- <label value="&units.milliseconds;"/>
4387- <image class="mgHelpButton"
4388- mgHelpDesc="&lmbDragdropDelayDesc;"
4389- onclick="mgCommon.openHint(this.parentNode.firstChild.value, this);"/>
4390- </hbox>
4391 </groupbox>
4392 </vbox>
4393
4394@@ -166,8 +157,7 @@
4395 <spacer flex="1"/>
4396
4397 <hbox orient="horizontal">
4398- <button label="&btnMappings;" oncommand="openMappingsWindow();" />
4399- <button label="&btnPrint;" oncommand="openPrintWindow();" />
4400+ <button label="&btnMappings;" oncommand="openMappingsWindow();"/>
4401 <spacer flex="1" minwidth="30"/>
4402 <button label="&btnReset;" oncommand="resetToDefault();"/>
4403 </hbox>
4404@@ -300,7 +290,7 @@
4405
4406 <groupbox>
4407 <caption>
4408- <checkbox id="status.enabled"
4409+ <checkbox id="status.isEnabled"
4410 label="&status.enabled;"
4411 oncommand="toggleStatusSettingsBox();"/>
4412 </caption>
4413@@ -341,23 +331,23 @@
4414 <spacer height="30"/>
4415 <vbox>
4416 <hbox>
4417- <label value="&visit.home;" style="text-decoration:underline;cursor:pointer"
4418+ <label value="&visit.faq;" class="mgHelpLink"
4419+ onclick="mgCommon.showWebPage('http://www.mousegestures.org/help/')"/>
4420+ <spacer flex="1"/>
4421+ </hbox>
4422+ <hbox>
4423+ <label value="&visit.home;" class="mgHelpLink"
4424 onclick="mgCommon.showWebPage('http://www.mousegestures.org/')"/>
4425 <spacer flex="1"/>
4426 </hbox>
4427 <hbox>
4428- <label value="&visit.exchange;" style="text-decoration:underline;cursor:pointer"
4429+ <label value="&visit.exchange;" class="mgHelpLink"
4430 onclick="mgCommon.showWebPage('http://www.mousegestures.org/exchange/')"/>
4431 <spacer flex="1"/>
4432 </hbox>
4433- <hbox>
4434- <label value="&visit.faq;" style="text-decoration:underline;cursor:pointer"
4435- onclick="mgCommon.showWebPage('http://www.mousegestures.org/help/')"/>
4436- <spacer flex="1"/>
4437- </hbox>
4438 <spacer height="25"/>
4439 <hbox>
4440- <label value="Missing your language?" style="text-decoration:underline;cursor:pointer"
4441+ <label value="Missing your language?" class="mgHelpLink"
4442 onclick="mgCommon.showWebPage('http://www.mousegestures.org/languages/')"/>
4443 <spacer flex="1"/>
4444 </hbox>
4445
4446=== modified file 'chrome/content/pref/publishMapping.xul'
4447--- chrome/content/pref/publishMapping.xul 2008-02-27 03:41:55 +0000
4448+++ chrome/content/pref/publishMapping.xul 2009-07-25 21:50:38 +0000
4449@@ -48,7 +48,6 @@
4450
4451 <script type="application/x-javascript" src="../defaults.js"/>
4452 <script type="application/x-javascript" src="../mozgestCommon.js"/>
4453- <script type="application/x-javascript" src="../componentLoader.js"/>
4454
4455 <script type="application/x-javascript">
4456 <![CDATA[
4457@@ -62,6 +61,7 @@
4458 var custom = false;
4459 var component;
4460 var mapping;
4461+ var cat
4462
4463 function generateLink() {
4464 type = window.arguments[0];
4465@@ -85,6 +85,8 @@
4466 link = link + type + "/" + code;
4467 link += "/";
4468 link += !func ? "custom/" + (name + "/" + custom) : func;
4469+ link += "/cat";
4470+ link += mapping.cat;
4471 link += "/";
4472
4473 // put it into textbox
4474
4475=== modified file 'chrome/content/sidebar/drawgesture.js'
4476--- chrome/content/sidebar/drawgesture.js 2008-02-27 03:41:55 +0000
4477+++ chrome/content/sidebar/drawgesture.js 2009-07-25 21:50:38 +0000
4478@@ -102,6 +102,8 @@
4479 }
4480
4481 function draw(aCanvas, aGesture) {
4482+ dummy(aCanvas);
4483+
4484 if (aGesture.charAt(0) == ":")
4485 drawRockerGesture(aCanvas, aGesture);
4486 else
4487@@ -180,7 +182,6 @@
4488 positions[i + 1].x + xOffset,
4489 positions[i + 1].y + yOffset);
4490 }
4491- aCanvas.paint();
4492 }
4493
4494 function getPos(point, history) {
4495@@ -245,7 +246,6 @@
4496 aCanvas.fillRect(x + 8, y + 8 + (6 * f), 1, 1);
4497 aCanvas.fillRect(x + 7, y + 8 + (5 * f), 3, 1);
4498 aCanvas.fillRect(x + 6, y + 8 + (4 * f), 5, 1);
4499- aCanvas.paint();
4500 }
4501
4502 function drawMouse(aCanvas, x, y, button) {
4503@@ -258,9 +258,7 @@
4504 aCanvas.drawLine(x + 11, y + 14, x + 9, y + 16);
4505
4506 aCanvas.fillRect(x + 3, y + 16, 6, 1);
4507-
4508 aCanvas.fillRect(x + 1, y + 5, 10, 1);
4509-
4510 aCanvas.fillRect(x + 4, y + 1, 1, 4);
4511 aCanvas.fillRect(x + 7, y + 1, 1, 4);
4512
4513@@ -276,57 +274,40 @@
4514 aCanvas.fillRect(x + 8, y + 1, 3, 4);
4515 else
4516 aCanvas.fillRect(x + 10, y + 1, 1, 1);
4517-
4518- aCanvas.paint();
4519-}
4520-
4521-var graphics =
4522-{
4523- createCanvasElement: function(id, width, height) {
4524- var el = document.createElement("canvas");
4525- el.setAttribute("id", id);
4526- el.setAttribute("width", width);
4527- el.setAttribute("height", height);
4528- return el;
4529- },
4530-
4531- getContext: function(canvasID) {
4532- return new nativeContextWrapper(canvasID);
4533- }
4534-}
4535-
4536-function nativeContextWrapper(canvasID) {
4537- this.ctx = document.getElementById(canvasID).getContext("2d");
4538-
4539- this.drawLine = function(x1, y1, x2, y2) {
4540- this.ctx.moveTo(x1 + 0.5, y1 + 0.5);
4541- this.ctx.lineTo(x2 + 0.5, y2 + 0.5);
4542- this.ctx.stroke();
4543- };
4544-
4545- this.fillCircle = function(x, y, diameter) {
4546- this.ctx.arc(x + 0.5, y + 0.5, (diameter / 2), 0.1, 3, false);
4547- this.ctx.arc(x + 0.5, y + 0.5, (diameter / 2), 3, 0.1, false);
4548- this.ctx.fill();
4549- };
4550-
4551- this.fillRect = function(x, y, w, h) {
4552- this.ctx.lineJoin = "miter";
4553- this.ctx.fillRect(x, y, w, h);
4554- };
4555-
4556- this.paint = function() {};
4557-
4558- this.setStroke = function(width) {
4559- this.ctx.lineWidth = width;
4560- };
4561-
4562- this.setColor = function(color) {
4563- this.ctx.strokeStyle = color;
4564- this.ctx.fillStyle = color;
4565- };
4566-
4567- this.beginPath = function() {
4568- this.ctx.beginPath();
4569- };
4570+}
4571+
4572+function dummy(aCanvas) {
4573+ aCanvas.ctx = aCanvas.getContext("2d");
4574+
4575+ aCanvas.drawLine = function(x1, y1, x2, y2) {
4576+ aCanvas.ctx.moveTo(x1 + 0.5, y1 + 0.5);
4577+ aCanvas.ctx.lineTo(x2 + 0.5, y2 + 0.5);
4578+ aCanvas.ctx.stroke();
4579+ };
4580+
4581+ aCanvas.fillCircle = function(x, y, diameter) {
4582+ aCanvas.ctx.arc(x + 0.5, y + 0.5, (diameter / 2), 0.1, 3, false);
4583+ aCanvas.ctx.arc(x + 0.5, y + 0.5, (diameter / 2), 3, 0.1, false);
4584+ aCanvas.ctx.fill();
4585+ };
4586+
4587+ aCanvas.fillRect = function(x, y, w, h) {
4588+ aCanvas.ctx.lineJoin = "miter";
4589+ aCanvas.ctx.fillRect(x, y, w, h);
4590+ };
4591+
4592+ aCanvas.setStroke = function(width) {
4593+ aCanvas.ctx.lineWidth = width;
4594+ };
4595+
4596+ aCanvas.setColor = function(color) {
4597+ aCanvas.ctx.strokeStyle = color;
4598+ aCanvas.ctx.fillStyle = color;
4599+ };
4600+
4601+ aCanvas.beginPath = function() {
4602+ aCanvas.ctx.beginPath();
4603+ };
4604+
4605+ return aCanvas.ctx;
4606 }
4607\ No newline at end of file
4608
4609=== modified file 'chrome/content/sidebar/mozgestSidebar.js'
4610--- chrome/content/sidebar/mozgestSidebar.js 2008-02-27 03:41:55 +0000
4611+++ chrome/content/sidebar/mozgestSidebar.js 2009-07-25 21:50:38 +0000
4612@@ -1,29 +1,24 @@
4613-var sbDoc, sbBody, counts, sortOrder, isSideBar;
4614+var sbMappings, sortOrder, mapArray;
4615 var activeElt = null;
4616-var toolTipEnabled = false;
4617-var scrollPos = 0;
4618-
4619-var sbFrame = document.getElementById("theFrame");
4620-document.getElementById(mgPrefs.prefs.getCharPref("sideBarSort")).setAttribute('checked', true);
4621-isSideBar = parent.mgWindowType ? true : false;
4622-
4623-if (window.arguments && window.arguments[0] == "standalone") {
4624- isSideBar = true;
4625-}
4626-
4627-if (isSideBar) {
4628+var canvasEnabled = true;
4629+var tooltipEnabled = true;
4630+var scrollX = {};
4631+scrollX.value = 0;
4632+var scrollY = {};
4633+scrollY.value = 0;
4634+
4635+function initSidebar() {
4636+ mgComponentLoader.initMouseService(false);
4637+ sbMappings = document.getElementById("sbMappings");
4638+ document.getElementById(mgPrefs.prefs.getCharPref("sideBar.sort")).setAttribute("checked", true);
4639+ tooltipEnabled = mgPrefs.prefs.getBoolPref("sideBar.toolTip");
4640+
4641 try {
4642- scrollPos = mgPrefs.prefs.getIntPref("sideBarPos");
4643+ scrollY.value = sbMappings.getAttribute("mgScrollTop");
4644+ setScrollPos();
4645 }
4646 catch (e) {}
4647 addEventListener("scroll", getScrollPos, true);
4648- toolTipEnabled = mgPrefs.prefs.getBoolPref("sideBarToolTip");
4649-}
4650-
4651-if (!isSideBar) {
4652- sbFrame.removeAttribute("context");
4653- sbFrame.removeAttribute("oncontextmenu");
4654- document.getElementById("printToolbox").removeAttribute("hidden");
4655 }
4656
4657 function addObserver() {
4658@@ -33,9 +28,6 @@
4659
4660 mgPrefs.prefs.QueryInterface(Components.interfaces.nsIPrefBranchInternal)
4661 .addObserver("", mgSidebarObserver, false);
4662-
4663- if (!isSideBar)
4664- document.title = document.documentElement.getAttribute("mgPrint");
4665 }
4666
4667 function removeObserver() {
4668@@ -51,86 +43,61 @@
4669 observe: function(subject, topic, data) {
4670 if (topic == "mozgestControl") {
4671 if (data == "mappingsUpdated")
4672- setTimeout("sbFrame.webNavigation.reload(0)", 0);
4673+ document.location.reload();
4674 }
4675
4676 if (topic.indexOf("nsPref") == 0) {
4677 if (data == "enableStrokes" ||
4678 data == "enableRockers" ||
4679- data == "enableWheelRockers")
4680- setTimeout("sbFrame.webNavigation.reload(0)", 0);
4681+ data == "enableWheelRockers" ||
4682+ data == "sideBar.canvas")
4683+ setTimeout("document.location.reload()", 0);
4684
4685- if (data == "sideBarToolTip") {
4686- if (isSidebar)
4687- toolTipEnabled = mgPrefs.prefs.getBoolPref("sideBarToolTip");
4688- }
4689+ if (data == "sideBar.toolTip")
4690+ tooltipEnabled = mgPrefs.prefs.getBoolPref("sideBar.toolTip");
4691 }
4692 }
4693 }
4694
4695-function reloadFrame(aID) {
4696- mgPrefs.prefs.setCharPref("sideBarSort", aID)
4697- sbFrame.webNavigation.reload(0)
4698-}
4699-
4700-function updateGestureHistory(target) {
4701- while (target.childNodes.length > 1)
4702- target.removeChild(target.firstChild);
4703-
4704- var h = parent.mgState.history;
4705-
4706- for (var x = 0; x < h.length; x++) {
4707- var item = document.createElement("menuitem");
4708- item.setAttribute("label", h[x][0] + " ");
4709- item.setAttribute("acceltext", h[x][1]);
4710- item.setAttribute("disabled", true);
4711- item.setAttribute("mgMenuItem", true);
4712- target.insertBefore(item, target.lastChild);
4713- }
4714+function reloadDoc(aID) {
4715+ mgPrefs.prefs.setCharPref("sideBar.sort", aID)
4716+ document.location.reload(0)
4717 }
4718
4719 function fillIn() {
4720- sbDoc = sbFrame.contentDocument;
4721- sbBody = sbDoc.body;
4722- sbBody.setAttribute("isSideBar", isSideBar);
4723-
4724- // Allow localizers to define font size
4725- var fontSize;
4726+ var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
4727 try {
4728- fontSize = mgGetString("fontSize." + (isSideBar ? "sidebar" : "print"));
4729+ canvas.getContext("2d");
4730+ canvasEnabled = mgPrefs.prefs.getBoolPref("sideBar.canvas");
4731 }
4732 catch (e) {
4733- fontSize = null;
4734+ canvasEnabled = false;
4735 }
4736- if (fontSize)
4737- sbBody.setAttribute("style", "font-size: " + fontSize);
4738-
4739- prepareInject("window", false);
4740+
4741+ prepareInject("window");
4742+
4743 for (component in _mgMS.supportedWindows)
4744- prepareInject(component, false);
4745+ prepareInject(component);
4746
4747- //print default mappings
4748- if (!isSideBar) {
4749- sbBody.appendChild(sbDoc.createElement("hr"));
4750- prepareInject("window", true);
4751- for (component in _mgMS.supportedWindows)
4752- prepareInject(component, true);
4753- }
4754+ setTimeout("initSidebar()", 0);
4755 }
4756
4757-function prepareInject(component, readDef) {
4758- var mappingsSet;
4759-
4760- if (!readDef)
4761- mappingsSet = _mgMS.activeMappings[component];
4762- else
4763- mappingsSet = _mgMS.defaultMappings[component];
4764-
4765- counts = new Array();
4766+function prepareInject(component) {
4767+ var mappingsSet = _mgMS.activeMappings[component];
4768+ mapArray = new Array();
4769+
4770+ for (var x = 1; x < 7; x++)
4771+ mapArray[x] = new Array();
4772+
4773+ mapArray[99] = new Array();
4774+
4775+ var mapCount = 0;
4776
4777 for (mapping in mappingsSet) {
4778- var mName = null;
4779- var mCount = null;
4780+ mapCount += 1;
4781+ var mName = null;
4782+ var mCount = null;
4783+ var mCat = 0;
4784
4785 if (mappingsSet[mapping].name)
4786 mName = decodeURIComponent(mappingsSet[mapping].name);
4787@@ -139,147 +106,216 @@
4788
4789 if (mappingsSet[mapping].count)
4790 mCount = mappingsSet[mapping].count;
4791-
4792- counts[counts.length] = { component : component,
4793- code : mapping,
4794- name : mName,
4795- count : mCount };
4796+ else
4797+ mCount = 0;
4798+
4799+ mCat = mappingsSet[mapping].cat;
4800+
4801+ if (mCat == 0)
4802+ mCat = 99;
4803+
4804+ mapArray[mCat][mapArray[mCat].length] = { component : component,
4805+ code : mapping,
4806+ name : mName,
4807+ count : mCount,
4808+ cat : ((mCat == 99) ? 0 : mCat) };
4809 }
4810
4811- if (counts.length == 0)
4812+ if (mapCount < 1)
4813 return;
4814
4815- if (mgPrefs.prefs.getCharPref("sideBarSort") == "sortByName") {
4816- counts.sort(function(a, b) {return ((a.name.toLowerCase())>(b.name.toLowerCase()) ? 1 : -1)} );
4817- sortOrder = "sortByName";
4818- }
4819- else {
4820- counts.sort(function(a, b) {return ((a.count)>(b.count) ? 1 : -1)} );
4821- sortOrder = "sortByUsage";
4822+ for (cat in mapArray) {
4823+ if (mgPrefs.prefs.getCharPref("sideBar.sort") == "sortByName") {
4824+ mapArray[cat].sort(function(a, b) {return ((a.name.toLowerCase())>(b.name.toLowerCase()) ? 1 : -1)});
4825+ sortOrder = "sortByName";
4826+ }
4827+ else {
4828+ mapArray[cat].sort(function(a, b) {return ((a.count)>(b.count) ? 1 : -1)});
4829+ sortOrder = "sortByUsage";
4830+ }
4831 }
4832
4833- inject(document.documentElement.getAttribute(component), readDef);
4834+ inject(document.documentElement.getAttribute(component), component);
4835 }
4836
4837-function inject(wType, readDef) {
4838- // calculate length
4839- if (!readDef) {
4840- var gLength = 0;
4841- for (var xx=0; xx < counts.length; xx++) {
4842- if (counts[xx].code.indexOf(":") == 0) {
4843- var isWheel = isNaN(counts[xx].code.substring(1));
4844+function inject(wType, component) {
4845+ var counts = new Array();
4846+ var gLength = 0;
4847+
4848+ for (cat in mapArray) {
4849+ counts = mapArray[cat];
4850+
4851+ if (counts.length > 0) {
4852+ for (var n = 0; n < counts.length; n++) {
4853+ if (counts[n].code.indexOf(":") == 0) {
4854+ var isWheel = isNaN(counts[n].code.substring(1));
4855+
4856+ if ((isWheel && !mgPrefs.prefs.getBoolPref("enableWheelRockers")) ||
4857+ (!isWheel && !mgPrefs.prefs.getBoolPref("enableRockers")))
4858+ continue;
4859+ }
4860+ else if (!mgPrefs.prefs.getBoolPref("enableStrokes"))
4861+ continue;
4862+
4863+ gLength++;
4864+ }
4865+ }
4866+ }
4867+
4868+ if (gLength == 0)
4869+ return;
4870+
4871+ var rowEven = false;
4872+ var mC = document.getElementById("sbMappings")
4873+
4874+ //the header and container of the window type
4875+ var cBox = document.createElement("vbox");
4876+ cBox.style.paddingBottom = "15px";
4877+ cBox.mgWindowType = component;
4878+ var tb = document.createElement("tabbox");
4879+ var tabs = document.createElement("tabs");
4880+ var tab = document.createElement("tab");
4881+ tab.setAttribute("label", wType);
4882+ tab.setAttribute("flex", "1");
4883+ tab.setAttribute("crop", "end");
4884+ tabs.appendChild(tab);
4885+ tb.appendChild(tabs);
4886+ var tps = document.createElement("tabpanels");
4887+ var tp = document.createElement("tabpanel");
4888+ tp.setAttribute("orient", "vertical");
4889+ tps.appendChild(tp);
4890+ tb.appendChild(tps);
4891+ cBox.appendChild(tb)
4892+ mC.appendChild(cBox);
4893+
4894+ //rL is the window box
4895+ var rL = document.createElement("richlistbox");
4896+ rL.mgWindowType = component;
4897+ tp.appendChild(rL);
4898+
4899+ for (cat in mapArray) {
4900+ counts = mapArray[cat];
4901+
4902+ for (var x=0; x < counts.length; x++) {
4903+ if (counts[x].code.indexOf(":") == 0) {
4904+ var isWheel = isNaN(counts[x].code.substring(1));
4905
4906 if ((isWheel && !mgPrefs.prefs.getBoolPref("enableWheelRockers")) ||
4907 (!isWheel && !mgPrefs.prefs.getBoolPref("enableRockers")))
4908 continue;
4909 }
4910-
4911 else if (!mgPrefs.prefs.getBoolPref("enableStrokes"))
4912- continue
4913-
4914- gLength++;
4915- }
4916-
4917- if (gLength < 1)
4918- return;
4919- }
4920-
4921- var head = sbDoc.createElement("span");
4922- head.className = "component";
4923-
4924- if (!isSideBar) {
4925- if (!readDef)
4926- head.appendChild(sbDoc.createTextNode(document
4927- .documentElement.getAttribute("mgActive") + wType));
4928- else
4929- head.appendChild(sbDoc.createTextNode(document
4930- .documentElement.getAttribute("mgDefault") + wType));
4931- }
4932- else
4933- head.appendChild(sbDoc.createTextNode(wType));
4934-
4935- sbBody.appendChild(head);
4936-
4937- var rowEven = false;
4938- var table = sbDoc.createElement("table");
4939- table.className = "mTable";
4940- table.setAttribute("width", "100%");
4941- table.setAttribute("cellspacing", 0);
4942- sbBody.appendChild(table);
4943-
4944- for (var x=0; x < counts.length; x++) {
4945- if (counts[x].code.indexOf(":") == 0 && !readDef) {
4946- var isWheel = isNaN(counts[x].code.substring(1));
4947-
4948- if ((isWheel && !mgPrefs.prefs.getBoolPref("enableWheelRockers")) ||
4949- (!isWheel && !mgPrefs.prefs.getBoolPref("enableRockers")))
4950- continue;
4951- }
4952-
4953- if (counts[x].code.indexOf(":") != 0 && !readDef) {
4954- if (!mgPrefs.prefs.getBoolPref("enableStrokes"))
4955- continue;
4956- }
4957-
4958- rowEven = !rowEven;
4959- var tRow = sbDoc.createElement("tr");
4960- tRow.setAttribute("class", (rowEven ? 'even' : 'odd'));
4961- tRow.mgWindowType = counts[x].component;
4962- tRow.mgCode = counts[x].code;
4963-
4964- var left = sbDoc.createElement("td");
4965- left.appendChild(sbDoc.createTextNode(counts[x].name));
4966- var right = sbDoc.createElement("td");
4967- right.setAttribute("align", "right");
4968- right.className = "gesture";
4969- right.mgTooltip = true;
4970- right.mgTCode = counts[x].code;
4971- right.mgTWindowType = counts[x].component;
4972- tRow.appendChild(left);
4973- tRow.appendChild(right);
4974- table.appendChild(tRow);
4975-
4976- var aGest = counts[x].code;
4977-
4978- if (!isSideBar && parseInt(mgAppInfo.version) < 3)
4979- right.appendChild(sbDoc.createTextNode(mgMappingLocalizer.localize(aGest)));
4980- else
4981- sbDoc.defaultView.createGestureBox(aGest, right);
4982+ continue;
4983+
4984+ rowEven = !rowEven;
4985+
4986+ //rI is the row within rL
4987+ var rI = document.createElement("richlistitem");
4988+
4989+ rI.mgWindowType = counts[x].component;
4990+ rI.mgCode = counts[x].code;
4991+ rI.mgTooltip = true;
4992+ rI.mgCat = counts[x].cat;
4993+
4994+ var catID = "mgCat_" + counts[x].component + "_" + counts[x].cat;
4995+
4996+ if (!document.getElementById(catID)) {
4997+ var newCat = document.createElement("checkbox");
4998+ newCat.mgWindowType = counts[x].component;
4999+ newCat.mgCat = rI.mgCat;
5000+ newCat.id = catID;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: