Bug 250129 - Improve toolbar customization UE on OS X. r=mconnor.

This commit is contained in:
mozilla.mano%sent.com 2006-08-26 07:27:54 +00:00
parent 6f8af3603c
commit ac5036c596
10 changed files with 265 additions and 29 deletions

View File

@ -56,6 +56,10 @@ ifneq (,$(filter windows gtk2 mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DHAVE_SHELL_SERVICE=1
endif
ifneq (,$(filter mac cocoa, $(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DTOOLBAR_CUSTOMIZATION_SHEET
endif
ifndef MOZ_BRANDING_DIRECTORY
libs locale::
$(INSTALL) $(srcdir)/content/browserconfig.properties $(DIST)/bin

View File

@ -11,6 +11,10 @@
%charsetDTD;
<!ENTITY % findBarDTD SYSTEM "chrome://global/locale/findbar.dtd" >
%findBarDTD;
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
%customizeToolbarDTD;
#endif
#ifdef MOZ_PLACES
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;

View File

@ -3362,12 +3362,29 @@ function BrowserCustomizeToolbar()
var cmd = document.getElementById("cmd_CustomizeToolbars");
cmd.setAttribute("disabled", "true");
window.openDialog("chrome://global/content/customizeToolbar.xul", "CustomizeToolbar",
"chrome,all,dependent", document.getElementById("navigator-toolbox"));
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
document.getElementById("customizeToolbarSheetBox").hidden = false;
// New tabs are breaking the xul stack
document.getElementById("cmd_newNavigatorTab")
.setAttribute("disabled", "true");
getBrowser()._blockDblClick = true;
#else
window.openDialog("chrome://global/content/customizeToolbar.xul",
"CustomizeToolbar",
"chrome,all,dependent",
document.getElementById("navigator-toolbox"));
#endif
}
function BrowserToolboxCustomizeDone(aToolboxChanged)
{
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
document.getElementById("customizeToolbarSheetBox").hidden = true;
document.getElementById("cmd_newNavigatorTab").removeAttribute("disabled");
getBrowser()._blockDblClick = false;
#endif
// Update global UI elements that may have been added or removed
if (aToolboxChanged) {
gURLBar = document.getElementById("urlbar");
@ -3437,8 +3454,10 @@ function BrowserToolboxCustomizeDone(aToolboxChanged)
bookmarksBar._init();
#endif
#ifndef TOOLBAR_CUSTOMIZATION_SHEET
// XXX Shouldn't have to do this, but I do
window.focus();
#endif
}
var FullScreen =

View File

@ -477,32 +477,46 @@
#endif
</toolbox>
<hbox flex="1" id="browser">
<vbox id="sidebar-box" hidden="true" class="chromeclass-extrachrome">
<sidebarheader align="center">
<label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
<image id="sidebar-throbber"/>
<toolbarbutton class="tabs-closebutton" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
</sidebarheader>
<browser id="sidebar" flex="1" autoscroll="false"
style="min-width: 14em; width: 18em; max-width: 36em;"/>
</vbox>
<stack id="browser-stack" flex="1">
<hbox flex="1" id="browser">
<vbox id="sidebar-box" hidden="true" class="chromeclass-extrachrome">
<sidebarheader align="center">
<label id="sidebar-title" persist="value" flex="1" crop="end" control="sidebar"/>
<image id="sidebar-throbber"/>
<toolbarbutton class="tabs-closebutton" tooltiptext="&sidebarCloseButton.tooltip;" oncommand="toggleSidebar();"/>
</sidebarheader>
<browser id="sidebar" flex="1" autoscroll="false"
style="min-width: 14em; width: 18em; max-width: 36em;"/>
</vbox>
<splitter id="sidebar-splitter" class="chromeclass-extrachrome" hidden="true"/>
<vbox id="appcontent" flex="1">
<tabbrowser id="content" disablehistory="true"
flex="1" contenttooltip="aHTMLTooltip"
contentcontextmenu="contentAreaContextMenu"
onnewtab="BrowserOpenTab();"
autocompletepopup="PopupAutoComplete"
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
onclick="return contentAreaClick(event, false);"
<splitter id="sidebar-splitter" class="chromeclass-extrachrome" hidden="true"/>
<vbox id="appcontent" flex="1">
<tabbrowser id="content" disablehistory="true"
flex="1" contenttooltip="aHTMLTooltip"
contentcontextmenu="contentAreaContextMenu"
onnewtab="BrowserOpenTab();"
autocompletepopup="PopupAutoComplete"
ondragdrop="nsDragAndDrop.drop(event, contentAreaDNDObserver);"
onclick="return contentAreaClick(event, false);"
#ifdef MOZ_PLACES
onselect="BrowserController.onEvent(BrowserController.EVENT_TABCHANGE);"
onselect="BrowserController.onEvent(BrowserController.EVENT_TABCHANGE);"
#endif
/>
</vbox>
</hbox>
/>
</vbox>
</hbox>
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
<hbox flex="1" hidden="true" id="customizeToolbarSheetBox">
<hbox flex="1"/>
<vbox flex="1">
<iframe id="customizeToolbarSheetIFrame"
style="&dialog.style;"
src="chrome://browser/content/customizeToolbarSheet.xul"/>
<vbox flex="1"/>
</vbox>
<hbox flex="1"/>
</hbox>
#endif
</stack>
#include ../../../toolkit/components/typeaheadfind/content/findBar.inc

View File

@ -0,0 +1,49 @@
# ***** 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 mozilla.org Code.
#
# The Initial Developer of the Original Code is
# Mozilla Corporation
# Portions created by the Initial Developer are Copyright (C) 2005-2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Asaf Romano <mozilla.mano@sent.com>
#
# 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 GPL or the LGPL. 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 *****
var gCustomizeToolbarSheet = {
init: function() {
InitWithToolbox(window.parent.document.getElementById("navigator-toolbox"));
},
done: function() {
// XXXmano: I'm pretty sure we don't need to do this, but since
// the XP dialog does, we will.
document.getElementById("main-box").collapsed = true;
finishToolbarCustomization();
}
};

View File

@ -0,0 +1,122 @@
<?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 Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998-1999
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# David Hyatt (hyatt@apple.com)
# Blake Ross (blaker@netscape.com)
# Asaf Romano <mozilla.mano@sent.com>
#
# 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 GPL or the LGPL. 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 dialog [
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
%customizeToolbarDTD;
]>
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/content/customizeToolbar.css" type="text/css"?>
<?xml-stylesheet href="chrome://global/skin/customizeToolbar.css" type="text/css"?>
<window id="CustomizeToolbarSheet"
title="&dialog.title;"
style="&dialog.style;"
onload="gCustomizeToolbarSheet.init();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"
src="chrome://global/content/customizeToolbar.js"/>
<script type="application/x-javascript"
src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript"
src="chrome://global/content/nsTransferable.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/customizeToolbarSheet.js"/>
<stringbundle id="stringBundle"
src="chrome://global/locale/customizeToolbar.properties"/>
<keyset id="CustomizeToolbarSheetKeyset">
<key id="cmd_close_sheet"
keycode="VK_ESCAPE"
oncommand="gCustomizeToolbarSheet.done();" />
<key id="cmd_close_sheet" keycode="VK_RETURN"
oncommand="gCustomizeToolbarSheet.done();" />
<key id="cmd_close_sheet" keycode="VK_ENTER"
oncommand="gCustomizeToolbarSheet.done();" />
</keyset>
<vbox id="main-box" flex="1" collapsed="true">
<label id="instructions" value="&instructions.description;"/>
<vbox flex="1" id="palette-box"
ondraggesture="gDraggingFromPalette = true; nsDragAndDrop.startDrag(event, dragStartObserver);"
ondragover="nsDragAndDrop.dragOver(event, paletteDNDObserver);"
ondragdrop="nsDragAndDrop.drop(event, paletteDNDObserver);"/>
<box align="center">
<label value="&show.label;"/>
<menulist id="modelist"
value="icons"
oncommand="updateToolbarMode(this.value);">
<menupopup>
<menuitem value="full" label="&iconsAndText.label;"/>
<menuitem value="icons" label="&icons.label;"/>
<menuitem value="text" label="&text.label;"/>
</menupopup>
</menulist>
<checkbox id="smallicons"
oncommand="updateIconSize(this.checked);"
label="&useSmallIcons.label;"/>
<button label="&addNewToolbar.label;"
oncommand="addNewToolbar();"
icon="add"/>
<button label="&restoreDefaultSet.label;"
oncommand="restoreDefaultSet();"
icon="refresh"/>
</box>
<separator class="groove"/>
<hbox align="center" pack="end">
<button label="&saveChanges.label;"
oncommand="gCustomizeToolbarSheet.done();"
default="true"
icon="close"/>
</hbox>
</vbox>
</window>

View File

@ -43,6 +43,10 @@ browser.jar:
* content/browser/jsConsoleOverlay.xul (content/jsConsoleOverlay.xul)
* content/browser/softwareUpdateOverlay.xul (content/softwareUpdateOverlay.xul)
#endif
#ifdef TOOLBAR_CUSTOMIZATION_SHEET
* content/browser/customizeToolbarSheet.xul (content/customizeToolbarSheet.xul)
* content/browser/customizeToolbarSheet.js (content/customizeToolbarSheet.js)
#endif
* content/browser/viewSourceOverlay.xul (content/viewSourceOverlay.xul)
#ifdef MOZ_USE_GENERIC_BRANDING
% content branding %content/branding/ xpcnativewrappers=yes

View File

@ -980,3 +980,13 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
-moz-border-bottom-colors: #000000;
}
%endif
#CustomizeToolbarSheet > #main-box {
border-top: none !important;
border-left: 2px solid;
border-right: 2px solid;
border-bottom: 3px solid;
-moz-border-right-colors: -moz-mac-menushadow ThreeDLightShadow !important;
-moz-border-bottom-colors: -moz-mac-menushadow -moz-mac-menushadow ThreeDShadow !important;
-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight !important;
}

View File

@ -4,6 +4,7 @@ reporter.jar:
#ifdef MOZ_PHOENIX
% overlay chrome://browser/content/browser.xul chrome://reporter/content/reporterOverlay.xul
% overlay chrome://global/content/customizeToolbar.xul chrome://reporter/content/reporterOverlay.xul
% overlay chrome://browser/content/customizeToolbarSheet.xul chrome://reporter/content/reporterOverlay.xul
% skin reporter classic/1.0 %skin/classic/reporter/
#endif
#else

View File

@ -48,7 +48,13 @@ var gToolboxIconSize = false;
function onLoad()
{
gToolbox = window.arguments[0];
InitWithToolbox(window.arguments[0]);
repositionDialog();
}
function InitWithToolbox(aToolbox)
{
gToolbox = aToolbox;
gToolboxDocument = gToolbox.ownerDocument;
gToolbox.addEventListener("draggesture", onToolbarDragGesture, false);
@ -56,12 +62,10 @@ function onLoad()
gToolbox.addEventListener("dragexit", onToolbarDragExit, false);
gToolbox.addEventListener("dragdrop", onToolbarDragDrop, false);
repositionDialog();
initDialog();
}
function onUnload(aEvent)
function finishToolbarCustomization()
{
removeToolboxListeners();
unwrapToolbarItems();
@ -70,6 +74,11 @@ function onUnload(aEvent)
notifyParentComplete();
}
function onUnload(aEvent)
{
finishToolbarCustomization();
}
function onAccept(aEvent)
{
document.getElementById("main-box").collapsed = true;