Add tasks overlay for starting editor from taskbar or menus in other modules. b=122271, fix by neil@parkwaycc.co.uk, r=cmanske, sr=hewitt, a=asa

This commit is contained in:
cmanske%netscape.com 2002-03-23 04:38:14 +00:00
Родитель 66ae49ae82
Коммит 3cdbcdf6e8
9 изменённых файлов: 112 добавлений и 223 удалений

Просмотреть файл

@ -36,6 +36,7 @@ comm.jar:
content/editor/editorPrefsOverlay.xul (ui/composer/content/editorPrefsOverlay.xul) content/editor/editorPrefsOverlay.xul (ui/composer/content/editorPrefsOverlay.xul)
content/editor/editorNavigatorOverlay.xul (ui/composer/content/editorNavigatorOverlay.xul) content/editor/editorNavigatorOverlay.xul (ui/composer/content/editorNavigatorOverlay.xul)
content/editor/editorMailOverlay.xul (ui/composer/content/editorMailOverlay.xul) content/editor/editorMailOverlay.xul (ui/composer/content/editorMailOverlay.xul)
content/editor/editorTasksOverlay.xul (ui/composer/content/editorTasksOverlay.xul)
content/editor/editorApplicationOverlay.js (ui/composer/content/editorApplicationOverlay.js) content/editor/editorApplicationOverlay.js (ui/composer/content/editorApplicationOverlay.js)
content/editor/images/tag-anchor.gif (ui/composer/content/images/tag-anchor.gif) content/editor/images/tag-anchor.gif (ui/composer/content/images/tag-anchor.gif)
content/editor/images/tag-abr.gif (ui/composer/content/images/tag-abr.gif) content/editor/images/tag-abr.gif (ui/composer/content/images/tag-abr.gif)

Просмотреть файл

@ -40,6 +40,7 @@ EditorParagraphMarks.css
EditorContent.css EditorContent.css
editorOverlay.js editorOverlay.js
editorOverlay.xul editorOverlay.xul
editorTasksOverlay.xul
composerOverlay.xul composerOverlay.xul
sidebar-editor.rdf sidebar-editor.rdf
sidebar-editor.xul sidebar-editor.xul

Просмотреть файл

@ -18,12 +18,18 @@
<!-- overlay information --> <!-- overlay information -->
<RDF:Seq about="urn:mozilla:overlays"> <RDF:Seq about="urn:mozilla:overlays">
<RDF:li resource="chrome://communicator/content/tasksOverlay.xul"/>
<RDF:li resource="chrome://communicator/content/pref/preftree.xul"/> <RDF:li resource="chrome://communicator/content/pref/preftree.xul"/>
<RDF:li resource="chrome://communicator/content/pref/pref-appearance.xul"/> <RDF:li resource="chrome://communicator/content/pref/pref-appearance.xul"/>
<RDF:li resource="chrome://navigator/content/navigatorOverlay.xul"/> <RDF:li resource="chrome://navigator/content/navigatorOverlay.xul"/>
<RDF:li resource="chrome://messenger/content/mailWindowOverlay.xul"/> <RDF:li resource="chrome://messenger/content/mailWindowOverlay.xul"/>
</RDF:Seq> </RDF:Seq>
<!-- editor tasks overlay -->
<RDF:Seq about="chrome://communicator/content/tasksOverlay.xul">
<RDF:li>chrome://editor/content/editorTasksOverlay.xul</RDF:li>
</RDF:Seq>
<!-- editor preferences branches --> <!-- editor preferences branches -->
<RDF:Seq about="chrome://communicator/content/pref/preftree.xul"> <RDF:Seq about="chrome://communicator/content/pref/preftree.xul">
<RDF:li>chrome://editor/content/editorPrefsOverlay.xul</RDF:li> <RDF:li>chrome://editor/content/editorPrefsOverlay.xul</RDF:li>

Просмотреть файл

@ -144,14 +144,6 @@ function editPage(url, launchWindow, delay)
} catch(e) {} } catch(e) {}
} }
// This used to be BrowserNewEditorWindow in navigator.js
function NewEditorWindow()
{
// Open editor window with blank page
// Kludge to leverage openDialog non-modal!
window.openDialog( "chrome://editor/content", "_blank", "chrome,all,dialog=no", "about:blank");
}
function NewEditorFromTemplate() function NewEditorFromTemplate()
{ {
// XXX not implemented // XXX not implemented

Просмотреть файл

@ -0,0 +1,76 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Editor Tasks Overlay.
-
- The Initial Developer of the Original Code is
- Neil Rashbrook.
- Portions created by the Initial Developer are Copyright (C) 2001
- the Initial Developer. All Rights Reserved.
-
- Contributor(s): Neil Rashbrook <neil@parkwaycc.co.uk>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<!DOCTYPE window SYSTEM "chrome://communicator/locale/tasksOverlay.dtd">
<overlay id="editorTasksOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
<![CDATA[
function toEditor()
{
if (!CycleWindow("composer:html"))
NewEditorWindow();
}
function NewEditorWindow()
{
// Open editor window with blank page
window.openDialog( "chrome://editor/content", "_blank", "chrome,all,dialog=no", "about:blank");
}
]]>
</script>
<keyset id="tasksKeys">
<key id="key_editor" key="&editorCmd.commandkey;" command="Tasks:Editor" modifiers="accel"/>
</keyset>
<commandset id="tasksCommands">
<command id="Tasks:Editor" oncommand="toEditor();"/>
</commandset>
<statusbarpanel id="component-bar">
<toolbarbutton class="taskbutton" id="mini-comp" command="Tasks:Editor"
tooltiptext="&taskComposer.tooltip;"/>
</statusbarpanel>
<menupopup id="taskPopup">
<menuitem label="&editorCmd.label;" accesskey="&editorCmd.accesskey;" key="key_editor" command="Tasks:Editor" id="tasksMenuEditor" insertafter="tasksMenuNavigator"/>
</menupopup>
</overlay>

Просмотреть файл

@ -1,171 +0,0 @@
#!nmake
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/NPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s):
DEPTH=..\..\..\..
CHROME_DIR = packages/core
CHROME_CONTENT_DIR=editor/content
CHROME_MISC_DIR=editor/content/images
CHROME_CONTENT = \
.\editor.xul \
.\TextEditorAppShell.xul \
.\editor.js \
.\publish.js \
.\publishprefs.js \
.\ComposerCommands.js \
.\EditorCommandsDebug.js \
.\EditorContextMenu.js \
.\EditorContextMenuOverlay.xul \
.\EditorInitPage.html \
.\EditorInitPagePlain.html \
.\EditorExtra.css \
.\EditorContent.css \
.\EditorAllTags.css \
.\EditorOverride.css \
.\EditorParagraphMarks.css \
.\sidebar-editor.rdf \
.\sidebar-editor.xul \
.\sb-bookmarks-panel.xul \
.\sb-bookmarks.js \
.\sb-file-contextMenu.js \
.\sb-file-panel.js \
.\sb-file-panel.xul \
.\sb-FileWidgetFileHandler.js \
.\editorOverlay.xul \
.\editorOverlay.js \
.\composerOverlay.xul \
.\pref-editing.xul \
.\pref-publish.xul \
.\pref-composer.js \
.\pref-composer.xul \
.\editorPrefsOverlay.xul \
.\editorUtilities.js \
$(NULL)
CHROME_MISC = \
.\images\tag-anchor.gif \
.\images\tag-abr.gif \
.\images\tag-acr.gif \
.\images\tag-adr.gif \
.\images\tag-ara.gif \
.\images\tag-bas.gif \
.\images\tag-blq.gif \
.\images\tag-bsf.gif \
.\images\tag-btn.gif \
.\images\tag-cit.gif \
.\images\tag-clg.gif \
.\images\tag-cod.gif \
.\images\tag-cpt.gif \
.\images\tag-ctr.gif \
.\images\tag-fld.gif \
.\images\tag-fnt.gif \
.\images\tag-for.gif \
.\images\tag-frm.gif \
.\images\tag-fst.gif \
.\images\tag-ifr.gif \
.\images\tag-inp.gif \
.\images\tag-lbl.gif \
.\images\tag-lgn.gif \
.\images\tag-lnk.gif \
.\images\tag-lst.gif \
.\images\tag-men.gif \
.\images\tag-nfr.gif \
.\images\tag-nsc.gif \
.\images\tag-opg.gif \
.\images\tag-opt.gif \
.\images\tag-prm.gif \
.\images\tag-scr.gif \
.\images\tag-slc.gif \
.\images\tag-sml.gif \
.\images\tag-smp.gif \
.\images\tag-spn.gif \
.\images\tag-stk.gif \
.\images\tag-stl.gif \
.\images\tag-stn.gif \
.\images\tag-tbd.gif \
.\images\tag-tbl.gif \
.\images\tag-tft.gif \
.\images\tag-thd.gif \
.\images\tag-hed.gif \
.\images\tag-isx.gif \
.\images\tag-met.gif \
.\images\tag-ttl.gif \
.\images\tag-pln.gif \
.\images\tag-xmp.gif \
.\images\tag-txt.gif \
.\images\tag-a.gif \
.\images\tag-app.gif \
.\images\tag-b.gif \
.\images\tag-bdo.gif \
.\images\tag-big.gif \
.\images\tag-body.gif \
.\images\tag-br.gif \
.\images\tag-col.gif \
.\images\tag-dd.gif \
.\images\tag-del.gif \
.\images\tag-dfn.gif \
.\images\tag-dir.gif \
.\images\tag-div.gif \
.\images\tag-dl.gif \
.\images\tag-dt.gif \
.\images\tag-em.gif \
.\images\tag-h1.gif \
.\images\tag-h2.gif \
.\images\tag-h3.gif \
.\images\tag-h4.gif \
.\images\tag-h5.gif \
.\images\tag-h6.gif \
.\images\tag-hr.gif \
.\images\tag-html.gif \
.\images\tag-i.gif \
.\images\tag-img.gif \
.\images\tag-ins.gif \
.\images\tag-kbd.gif \
.\images\tag-li.gif \
.\images\tag-map.gif \
.\images\tag-obj.gif \
.\images\tag-ol.gif \
.\images\tag-p.gif \
.\images\tag-pre.gif \
.\images\tag-q.gif \
.\images\tag-s.gif \
.\images\tag-sub.gif \
.\images\tag-sup.gif \
.\images\tag-td.gif \
.\images\tag-th.gif \
.\images\tag-tr.gif \
.\images\tag-tt.gif \
.\images\tag-u.gif \
.\images\tag-ul.gif \
.\images\tag-var.gif \
.\images\tag-userdefined.gif \
.\images\smile.gif \
.\images\smile_active.gif \
.\images\smile_disabled.gif \
.\images\smile_hover.gif \
.\images\frown.gif \
.\images\wink.gif \
.\images\sick.gif \
$(NULL)
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -62,12 +62,14 @@
<statusbarpanel id="component-bar"> <statusbarpanel id="component-bar">
<toolbarbutton class="taskbutton" id="mini-mail" oncommand="toMessengerWindow()" <toolbarbutton class="taskbutton" id="mini-mail" oncommand="toMessengerWindow()"
position="2" tooltiptext="&taskMessenger.tooltip;"/> position="2" tooltiptext="&taskMessenger.tooltip;"/>
<toolbarbutton id="mini-comp" position="3"/>
<toolbarbutton class="taskbutton" id="mini-addr" oncommand="toAddressBook();" <toolbarbutton class="taskbutton" id="mini-addr" oncommand="toAddressBook();"
position="4" tooltiptext="&taskAddressBook.tooltip;"/> position="4" tooltiptext="&taskAddressBook.tooltip;"/>
</statusbarpanel> </statusbarpanel>
<menupopup id="taskPopup"> <menupopup id="taskPopup">
<menuitem accesskey="&messengerCmd.accesskey;" label="&messengerCmd.label;" key="key_mail" command="Tasks:Mail" id="tasksMenuMail" insertafter="tasksMenuNavigator"/> <menuitem accesskey="&messengerCmd.accesskey;" label="&messengerCmd.label;" key="key_mail" command="Tasks:Mail" id="tasksMenuMail" insertafter="tasksMenuNavigator"/>
<menuitem id="tasksMenuEditor" insertafter="tasksMenuMail"/>
<menuitem label="&addressBookCmd.label;" accesskey="&addressBookCmd.accesskey;" key="key_addressbook" command="Tasks:AddressBook" id="tasksMenuAddressBook" insertafter="tasksMenuEditor"/> <menuitem label="&addressBookCmd.label;" accesskey="&addressBookCmd.accesskey;" key="key_addressbook" command="Tasks:AddressBook" id="tasksMenuAddressBook" insertafter="tasksMenuEditor"/>
</menupopup> </menupopup>

Просмотреть файл

@ -38,7 +38,8 @@
function toNavigator() function toNavigator()
{ {
CycleWindow('navigator:browser', getBrowserURL()); if (!CycleWindow("navigator:browser"))
OpenBrowserWindow();
} }
// Set up a lame hack to avoid opening two bookmarks. // Set up a lame hack to avoid opening two bookmarks.
@ -147,21 +148,7 @@ function OpenBrowserWindow()
} }
} }
function newWindowOfType( aType ) function CycleWindow( aType )
{
switch (aType) {
case "navigator:browser":
OpenBrowserWindow();
break;
case "composer:html":
NewEditorWindow();
break;
default:
break;
}
}
function CycleWindow( aType, aChromeURL )
{ {
var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService(); var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator); var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
@ -170,29 +157,30 @@ function CycleWindow( aType, aChromeURL )
var topWindow = windowManagerInterface.getMostRecentWindow( null ); var topWindow = windowManagerInterface.getMostRecentWindow( null );
if ( topWindowOfType == null ) if ( topWindowOfType == null )
newWindowOfType( aType ); return null;
else if ( topWindowOfType != topWindow )
if ( topWindowOfType != topWindow ) {
topWindowOfType.focus(); topWindowOfType.focus();
else { return topWindowOfType;
var enumerator = windowManagerInterface.getEnumerator( aType );
var firstWindow = windowManagerInterface.convertISupportsToDOMWindow ( enumerator.getNext() );
var iWindow = firstWindow; // ;-)
while ( iWindow != topWindow && enumerator.hasMoreElements() )
iWindow = windowManagerInterface.convertISupportsToDOMWindow ( enumerator.getNext() );
var desiredWindow = firstWindow;
if ( enumerator.hasMoreElements() )
desiredWindow = windowManagerInterface.convertISupportsToDOMWindow ( enumerator.getNext() );
if ( desiredWindow == topWindow ) // Only one window, open a new one
newWindowOfType( aType );
else
desiredWindow.focus();
} }
}
function toEditor() var enumerator = windowManagerInterface.getEnumerator( aType );
{ var firstWindow = windowManagerInterface.convertISupportsToDOMWindow(enumerator.getNext());
CycleWindow('composer:html', 'chrome://editor/content/editor.xul'); var iWindow = firstWindow;
while (iWindow != topWindow && enumerator.hasMoreElements())
iWindow = windowManagerInterface.convertISupportsToDOMWindow(enumerator.getNext());
if (enumerator.hasMoreElements()) {
iWindow = windowManagerInterface.convertISupportsToDOMWindow(enumerator.getNext());
iWindow.focus();
return iWindow;
}
if (firstWindow == topWindow) // Only one window
return null;
firstWindow.focus();
return firstWindow;
} }
function ShowWindowFromResource( node ) function ShowWindowFromResource( node )

Просмотреть файл

@ -17,14 +17,12 @@
<keyset id="tasksKeys"> <keyset id="tasksKeys">
<key id="key_navigator" key="&navigatorCmd.commandkey;" command="Tasks:Navigator" modifiers="accel"/> <key id="key_navigator" key="&navigatorCmd.commandkey;" command="Tasks:Navigator" modifiers="accel"/>
<key id="key_editor" key="&editorCmd.commandkey;" command="Tasks:Editor" modifiers="accel"/>
<!-- Tools Menu --> <!-- Tools Menu -->
<key id="key_gotoHistory" key="&history.commandKey;" oncommand="toHistory();" modifiers="accel"/> <key id="key_gotoHistory" key="&history.commandKey;" oncommand="toHistory();" modifiers="accel"/>
</keyset> </keyset>
<commandset id="tasksCommands"> <commandset id="tasksCommands">
<command id="Tasks:Navigator" oncommand="toNavigator();"/> <command id="Tasks:Navigator" oncommand="toNavigator();"/>
<command id="Tasks:Editor" oncommand="toEditor();"/>
</commandset> </commandset>
@ -42,7 +40,6 @@
<menupopup id="taskPopup"> <menupopup id="taskPopup">
<menuitem label="&navigatorCmd.label;" accesskey="&navigatorCmd.accesskey;" key="key_navigator" command="Tasks:Navigator" id="tasksMenuNavigator"/> <menuitem label="&navigatorCmd.label;" accesskey="&navigatorCmd.accesskey;" key="key_navigator" command="Tasks:Navigator" id="tasksMenuNavigator"/>
<menuitem label="&editorCmd.label;" accesskey="&editorCmd.accesskey;" key="key_editor" command="Tasks:Editor" id="tasksMenuEditor"/>
<!-- Overlays get stuffed in here. --> <!-- Overlays get stuffed in here. -->
@ -58,7 +55,6 @@
<menu label="&toolsMenu.label;" accesskey="&toolsMenu.accesskey;"> <menu label="&toolsMenu.label;" accesskey="&toolsMenu.accesskey;">
<menupopup id="toolsPopup" onpopupshowing="javaItemEnabling();"> <menupopup id="toolsPopup" onpopupshowing="javaItemEnabling();">
<menuitem label="&historyCmd.label;" accesskey="&historyCmd.accesskey;" oncommand="toHistory()" key="key_gotoHistory"/> <menuitem label="&historyCmd.label;" accesskey="&historyCmd.accesskey;" oncommand="toHistory()" key="key_gotoHistory"/>
<menuitem label="&importUtilCmd.label;" accesskey="&importUtilCmd.accesskey;" oncommand="toImport()"/>
<menuitem id="java" label="&javaConsoleCmd.label;" accesskey="&javaConsoleCmd.accesskey;" oncommand="toJavaConsole()"/> <menuitem id="java" label="&javaConsoleCmd.label;" accesskey="&javaConsoleCmd.accesskey;" oncommand="toJavaConsole()"/>
<menuitem label="&javaScriptConsoleCmd.label;" accesskey="&javaScriptConsoleCmd.accesskey;" oncommand="toJavaScriptConsole();"/> <menuitem label="&javaScriptConsoleCmd.label;" accesskey="&javaScriptConsoleCmd.accesskey;" oncommand="toJavaScriptConsole();"/>
<menuitem label="&downloadManagerCmd.label;" accesskey="&downloadManagerCmd.accesskey;" oncommand="toDownloadManager();"/> <menuitem label="&downloadManagerCmd.label;" accesskey="&downloadManagerCmd.accesskey;" oncommand="toDownloadManager();"/>
@ -72,7 +68,5 @@
<statusbarpanel id="component-bar" persist="collapsed"> <statusbarpanel id="component-bar" persist="collapsed">
<toolbarbutton class="taskbutton" id="mini-nav" oncommand="toNavigator();" <toolbarbutton class="taskbutton" id="mini-nav" oncommand="toNavigator();"
tooltiptext="&taskNavigator.tooltip;"/> tooltiptext="&taskNavigator.tooltip;"/>
<toolbarbutton class="taskbutton" id="mini-comp" oncommand="toEditor();"
tooltiptext="&taskComposer.tooltip;"/>
</statusbarpanel> </statusbarpanel>
</overlay> </overlay>