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
Родитель 6ae53f54f8
Коммит 6ed40c3805
9 изменённых файлов: 113 добавлений и 52 удалений

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

@ -36,6 +36,7 @@ comm.jar:
content/editor/editorPrefsOverlay.xul (ui/composer/content/editorPrefsOverlay.xul)
content/editor/editorNavigatorOverlay.xul (ui/composer/content/editorNavigatorOverlay.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/images/tag-anchor.gif (ui/composer/content/images/tag-anchor.gif)
content/editor/images/tag-abr.gif (ui/composer/content/images/tag-abr.gif)

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

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

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

@ -18,12 +18,18 @@
<!-- overlay information -->
<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/pref-appearance.xul"/>
<RDF:li resource="chrome://navigator/content/navigatorOverlay.xul"/>
<RDF:li resource="chrome://messenger/content/mailWindowOverlay.xul"/>
</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 -->
<RDF:Seq about="chrome://communicator/content/pref/preftree.xul">
<RDF:li>chrome://editor/content/editorPrefsOverlay.xul</RDF:li>

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

@ -144,14 +144,6 @@ function editPage(url, launchWindow, delay)
} 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()
{
// 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>

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

@ -52,6 +52,7 @@ CHROME_CONTENT = \
.\sb-FileWidgetFileHandler.js \
.\editorOverlay.xul \
.\editorOverlay.js \
.\editorTasksOverlay.xul \
.\composerOverlay.xul \
.\pref-editing.xul \
.\pref-publish.xul \

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

@ -62,12 +62,14 @@
<statusbarpanel id="component-bar">
<toolbarbutton class="taskbutton" id="mini-mail" oncommand="toMessengerWindow()"
position="2" tooltiptext="&taskMessenger.tooltip;"/>
<toolbarbutton id="mini-comp" position="3"/>
<toolbarbutton class="taskbutton" id="mini-addr" oncommand="toAddressBook();"
position="4" tooltiptext="&taskAddressBook.tooltip;"/>
</statusbarpanel>
<menupopup id="taskPopup">
<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"/>
</menupopup>

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

@ -38,7 +38,8 @@
function toNavigator()
{
CycleWindow('navigator:browser', getBrowserURL());
if (!CycleWindow("navigator:browser"))
OpenBrowserWindow();
}
// Set up a lame hack to avoid opening two bookmarks.
@ -147,21 +148,7 @@ function OpenBrowserWindow()
}
}
function newWindowOfType( aType )
{
switch (aType) {
case "navigator:browser":
OpenBrowserWindow();
break;
case "composer:html":
NewEditorWindow();
break;
default:
break;
}
}
function CycleWindow( aType, aChromeURL )
function CycleWindow( aType )
{
var windowManager = Components.classes['@mozilla.org/rdf/datasource;1?name=window-mediator'].getService();
var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
@ -170,29 +157,30 @@ function CycleWindow( aType, aChromeURL )
var topWindow = windowManagerInterface.getMostRecentWindow( null );
if ( topWindowOfType == null )
newWindowOfType( aType );
else if ( topWindowOfType != topWindow )
topWindowOfType.focus();
else {
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();
}
}
return null;
function toEditor()
{
CycleWindow('composer:html', 'chrome://editor/content/editor.xul');
if ( topWindowOfType != topWindow ) {
topWindowOfType.focus();
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());
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 )

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

@ -17,14 +17,12 @@
<keyset id="tasksKeys">
<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 -->
<key id="key_gotoHistory" key="&history.commandKey;" oncommand="toHistory();" modifiers="accel"/>
</keyset>
<commandset id="tasksCommands">
<command id="Tasks:Navigator" oncommand="toNavigator();"/>
<command id="Tasks:Editor" oncommand="toEditor();"/>
</commandset>
@ -42,7 +40,6 @@
<menupopup id="taskPopup">
<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. -->
@ -58,7 +55,6 @@
<menu label="&toolsMenu.label;" accesskey="&toolsMenu.accesskey;">
<menupopup id="toolsPopup" onpopupshowing="javaItemEnabling();">
<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 label="&javaScriptConsoleCmd.label;" accesskey="&javaScriptConsoleCmd.accesskey;" oncommand="toJavaScriptConsole();"/>
<menuitem label="&downloadManagerCmd.label;" accesskey="&downloadManagerCmd.accesskey;" oncommand="toDownloadManager();"/>
@ -72,7 +68,5 @@
<statusbarpanel id="component-bar" persist="collapsed">
<toolbarbutton class="taskbutton" id="mini-nav" oncommand="toNavigator();"
tooltiptext="&taskNavigator.tooltip;"/>
<toolbarbutton class="taskbutton" id="mini-comp" oncommand="toEditor();"
tooltiptext="&taskComposer.tooltip;"/>
</statusbarpanel>
</overlay>