Bug #264128 --> toolbar customization window should be more like a dialog

for Thunderbird.
This commit is contained in:
scott%scott-macgregor.org 2004-10-15 01:03:06 +00:00
Родитель 6461b3d446
Коммит ac997b7ac7
2 изменённых файлов: 22 добавлений и 28 удалений

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

@ -26,6 +26,7 @@ const kWindowWidth = 600;
const kWindowHeight = 400;
const kAnimateIncrement = 50;
const kAnimateSteps = kWindowHeight / kAnimateIncrement - 1;
const kVSizeSlop = 5;
var gToolboxDocument = null;
var gToolbox = null;
@ -41,13 +42,9 @@ function onLoad()
gToolbox.addEventListener("dragover", onToolbarDragOver, false);
gToolbox.addEventListener("dragexit", onToolbarDragExit, false);
gToolbox.addEventListener("dragdrop", onToolbarDragDrop, false);
document.documentElement.setAttribute("hidechrome", "true");
repositionDialog();
window.outerWidth = kWindowWidth;
window.outerHeight = 50;
slideOpen(0);
initDialog();
}
function onUnload(aEvent)
@ -57,6 +54,8 @@ function onUnload(aEvent)
persistCurrentSets();
notifyParentComplete();
window.close();
}
function onCancel()
@ -93,7 +92,7 @@ function onCancel()
function onAccept(aEvent)
{
document.getElementById("main-box").collapsed = true;
slideClosed(0);
window.close();
}
function initDialog()
@ -116,31 +115,20 @@ function initDialog()
wrapToolbarItems();
}
function slideOpen(aStep)
{
if (aStep < kAnimateSteps) {
window.outerHeight += kAnimateIncrement;
setTimeout(slideOpen, 20, ++aStep);
} else {
initDialog();
}
}
function slideClosed(aStep)
{
if (aStep < kAnimateSteps) {
window.outerHeight -= kAnimateIncrement;
setTimeout(slideClosed, 10, ++aStep);
} else {
window.close();
}
}
function repositionDialog()
{
// Position the dialog touching the bottom of the toolbox and centered with it
// Position the dialog touching the bottom of the toolbox and centered with
// it. We must resize the window smaller first so that it is positioned
// properly.
var screenX = gToolbox.boxObject.screenX + ((gToolbox.boxObject.width - kWindowWidth) / 2);
var screenY = gToolbox.boxObject.screenY + gToolbox.boxObject.height;
var newHeight = kWindowHeight;
if (newHeight >= screen.availHeight - screenY - kVSizeSlop) {
newHeight = screen.availHeight - screenY - kVSizeSlop;
}
window.resizeTo(kWindowWidth, newHeight);
window.moveTo(screenX, screenY);
}

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

@ -55,6 +55,12 @@
<stringbundle id="stringBundle" src="chrome://global/locale/customizeToolbar.properties"/>
<keyset>
<key id="cmd_close_sheet" keycode="VK_ESCAPE" oncommand="onCancel();" />
<key id="cmd_close_sheet" keycode="VK_RETURN" oncommand="onAccept();" />
<key id="cmd_close_sheet" keycode="VK_ENTER" oncommand="onAccept();" />
</keyset>
<vbox id="main-box" flex="1" collapsed="true">
<description id="instructions">
&instructions.description;