From 3e4f815b3780ca6ae084e6bd123dfd43cc2564e4 Mon Sep 17 00:00:00 2001 From: "hewitt%netscape.com" Date: Fri, 2 Feb 2001 02:18:13 +0000 Subject: [PATCH] 45060 - addressing widget cleanup, r=ducarroz, sr=sspitzer --- .../content/addressingWidgetOverlay.js | 128 +++++++++++++++++- .../resources/content/messengercompose.xul | 2 +- themes/modern/global/globalBindings.xml | 10 ++ .../modern/global/menulist-compact-arrow.gif | 0 themes/modern/global/menulist.css | 35 +++++ themes/modern/jar.mn | 1 + .../messengercompose/messengercompose.css | 46 ++++--- .../global/resources/content/treeBindings.xml | 18 ++- xpfe/global/resources/content/xul.css | 6 +- 9 files changed, 221 insertions(+), 25 deletions(-) create mode 100644 themes/modern/global/menulist-compact-arrow.gif diff --git a/mailnews/compose/resources/content/addressingWidgetOverlay.js b/mailnews/compose/resources/content/addressingWidgetOverlay.js index 3ca91986e10..cac74d24a4c 100644 --- a/mailnews/compose/resources/content/addressingWidgetOverlay.js +++ b/mailnews/compose/resources/content/addressingWidgetOverlay.js @@ -141,6 +141,7 @@ function CompFields2Recipients(msgCompFields, msgType) dump("replacing child in comp fields 2 recips \n"); var parent = treeChildren.parentNode; parent.replaceChild(newTreeChildrenNode, treeChildren); + awFitDummyRows(); setTimeout("awFinishCopyNodes();", 0); } } @@ -414,7 +415,10 @@ function awAppendNewRow(setFocus) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).selectedItem.getAttribute("data"); - var newNode = awCopyNode(treeitem1, body, 0); + var nextDummy = awGetNextDummyRow(); + var newNode = awCopyNode(treeitem1, body, nextDummy); + if (nextDummy) body.removeChild(nextDummy); + top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); @@ -529,7 +533,8 @@ function awRemoveRow(row) var body = document.getElementById('addressWidgetBody'); awRemoveNodeAndChildren(body, awGetTreeItem(row)); - + awFitDummyRows(); + top.MAX_RECIPIENTS --; } @@ -546,7 +551,6 @@ function awRemoveNodeAndChildren(parent, nodeToRemove) } parent.removeChild(nodeToRemove); - } function awSetFocus(row, inputElement) @@ -762,3 +766,121 @@ function awKeyDown(event, treeElement) break; } } + +/* ::::::::::: addressing widget dummy rows ::::::::::::::::: */ + +var gAWContentHeight = 0; +var gAWRowHeight = 0; + +function awFitDummyRows() +{ + awCalcContentHeight(); + awCreateOrRemoveDummyRows(); +} + +function awCreateOrRemoveDummyRows() +{ + var body = document.getElementById("addressWidgetBody"); + var bodyHeight = body.boxObject.height; + + // remove rows to remove scrollbar + var kids = body.childNodes; + for (var i = kids.length-1; gAWContentHeight > bodyHeight && i >= 0; --i) { + if (kids[i].hasAttribute("_isDummyRow")) { + gAWContentHeight -= gAWRowHeight; + body.removeChild(kids[i]); + } + } + + // add rows to fill space + if (gAWRowHeight) { + while (gAWContentHeight+gAWRowHeight < bodyHeight) { + awCreateDummyItem(body); + gAWContentHeight += gAWRowHeight; + } + } +} + +function awCalcContentHeight() +{ + var body = document.getElementById("addressWidgetBody"); + var kids = body.getElementsByTagName("treerow"); + + gAWContentHeight = 0; + if (kids.length > 0) { + // all rows are forced to a uniform height in xul trees, so + // find the first tree row with a boxObject and use it as precedent + var i = 0; + do { + gAWRowHeight = kids[i].boxObject.height; + ++i; + } while (i < kids.length && !gAWRowHeight); + gAWContentHeight = gAWRowHeight*kids.length; + } +} + +function awCreateDummyItem(aParent) +{ + var titem = document.createElement("treeitem"); + titem.setAttribute("_isDummyRow", "true"); + + var trow = document.createElement("treerow"); + trow.setAttribute("class", "dummy-row"); + trow.setAttribute("onclick", "awDummyRow_onclick()"); + titem.appendChild(trow); + + awCreateDummyCell(trow); + awCreateDummyCell(trow); + + if (aParent) + aParent.appendChild(titem); + + return titem; +} + +function awCreateDummyCell(aParent) +{ + var cell = document.createElement("treecell"); + cell.setAttribute("class", "treecell-addressingWidget dummy-row-cell"); + if (aParent) + aParent.appendChild(cell); + + return cell; +} + +function awDummyRow_onclick() { + // pass click event back to handler + awClickEmptySpace(document.getElementById("addressWidgetBody"), true); +} + +function awGetNextDummyRow() +{ + // gets the next row from the top down + var body = document.getElementById("addressWidgetBody"); + var kids = body.childNodes; + for (var i = 0; i < kids.length; ++i) { + if (kids[i].hasAttribute("_isDummyRow")) + return kids[i]; + } + return null; +} + +function awSizerListen() +{ + // when splitter is clicked, fill in necessary dummy rows each time the mouse is moved + awCalcContentHeight(); // precalculate + document.addEventListener("mousemove", awSizerMouseMove, true); + document.addEventListener("mouseup", awSizerMouseUp, false); +} + +function awSizerMouseMove() +{ + awCreateOrRemoveDummyRows(); +} + +function awSizerMouseUp() +{ + document.removeEventListener("mousemove", awSizerMouseUp, false); + document.removeEventListener("mouseup", awSizerMouseUp, false); +} + diff --git a/mailnews/compose/resources/content/messengercompose.xul b/mailnews/compose/resources/content/messengercompose.xul index daef693bc4a..210b4d2fc9f 100644 --- a/mailnews/compose/resources/content/messengercompose.xul +++ b/mailnews/compose/resources/content/messengercompose.xul @@ -515,7 +515,7 @@ - + diff --git a/themes/modern/global/globalBindings.xml b/themes/modern/global/globalBindings.xml index f58fecf2976..e909bb39d9d 100644 --- a/themes/modern/global/globalBindings.xml +++ b/themes/modern/global/globalBindings.xml @@ -208,6 +208,16 @@ + + + + + + + + + + diff --git a/themes/modern/global/menulist-compact-arrow.gif b/themes/modern/global/menulist-compact-arrow.gif new file mode 100644 index 00000000000..e69de29bb2d diff --git a/themes/modern/global/menulist.css b/themes/modern/global/menulist.css index 6f304470767..71b3e1ba184 100644 --- a/themes/modern/global/menulist.css +++ b/themes/modern/global/menulist.css @@ -317,4 +317,39 @@ border: 1px inset #B2BFBF; } +/* :::::::::: compact menulists :::::::::: */ + +.menulist-compact { + -moz-binding: url("chrome://global/skin/globalBindings.xml#menulist-compact"); + margin: 0px; + border: 1px solid #000000; + min-width: 0px; + min-height: 0px; + background-color: #D6DFDF; + -moz-user-focus: ignore; +} + +.menulist-compact-text { + margin-right: 3px; +} + +.menulist-compact-internal-box { + border-left: 1px solid #F7F7F7; + border-top: 1px solid #F7F7F7; + border-right: 1px solid #8CA2A5; + border-bottom: 1px solid #8CA2A5; + padding: 1px; +} + +.menulist-compact-dropmarker { + list-style-image: url("chrome://global/skin/menulist-compact-arrow.gif"); + margin-left: 2px; +} + +.menulist-compact:hover:active > .menulist-compact-internal-box, +.menulist-compact[open="true"] > .menulist-compact-internal-box { + background-color: #949EA5; + border: 1px solid #808080; +} + diff --git a/themes/modern/jar.mn b/themes/modern/jar.mn index 7f86ee31a74..1c5341f9585 100644 --- a/themes/modern/jar.mn +++ b/themes/modern/jar.mn @@ -274,6 +274,7 @@ modern.jar: skin/modern/global/check-radio-check-pressed.gif (global/check-radio-check-pressed.gif) skin/modern/global/check-radio-check.gif (global/check-radio-check.gif) skin/modern/global/menulist-arrow.gif (global/menulist-arrow.gif) + skin/modern/global/menulist-compact-arrow.gif (global/menulist-compact-arrow.gif) skin/modern/global/menulist-dis-arrow.gif (global/menulist-dis-arrow.gif) skin/modern/global/menulist-left-top.gif (global/menulist-left-top.gif) skin/modern/global/menulist-left-mid.gif (global/menulist-left-mid.gif) diff --git a/themes/modern/messenger/messengercompose/messengercompose.css b/themes/modern/messenger/messengercompose/messengercompose.css index 59376273026..6416cd985ed 100644 --- a/themes/modern/messenger/messengercompose/messengercompose.css +++ b/themes/modern/messenger/messengercompose/messengercompose.css @@ -52,39 +52,53 @@ box.padded { /* addressing widget */ #addressingWidgetTree { - height : 80px; width : 0px; - -moz-user-focus: ignore !important; + border: 1px inset #5B7693; + -moz-user-focus: none; } +#listcol-addressingWidget { + width: 9em; + border-right: 1px solid #D3D3E5; +} + #addressingWidgetTree > treechildren > treeitem > treerow, #addressingWidgetTree > treechildren > treeitem[selected="true"] > treerow { border: none; - background-color: transparent; - color: buttontext; + background-color: inherit; + color: inherit; } .treecell-addressingWidget { vertical-align: middle; + padding: 0px; + border-bottom: 1px solid #D3D3E5; } -tree.addressingWidget > treechildren > treeitem > treerow > treecell > image { - margin : 0px 3px 0px 0px; +.treecell-addressingWidget:first-child { + border-top: none; + border-bottom: none; +} + +.dummy-row-cell:first-child { + border-top: none; + border-bottom: 1px solid #D3D3E5; +} + +.aw-menulist { + margin: 0px; + border-top: none; + border-left: none; + border-color: #314152; +} + +.person-icon { + margin : 2px 4px 2px 4px; border: none; list-style-image: url("chrome://messenger/skin/addressbook/person.gif"); -moz-user-focus: ignore; } -#listcol-addressingWidget { - width: 110px; -} - -.menulist-compact { - -moz-user-focus: ignore; - margin: 3px; - border: none; -} - /* menulist.outset { diff --git a/xpfe/global/resources/content/treeBindings.xml b/xpfe/global/resources/content/treeBindings.xml index 2d9ba0f8b61..1342d93e926 100644 --- a/xpfe/global/resources/content/treeBindings.xml +++ b/xpfe/global/resources/content/treeBindings.xml @@ -92,10 +92,20 @@ - - - - + + + + + + + + + + + + + + diff --git a/xpfe/global/resources/content/xul.css b/xpfe/global/resources/content/xul.css index e99436daef7..66b2d6b52b0 100644 --- a/xpfe/global/resources/content/xul.css +++ b/xpfe/global/resources/content/xul.css @@ -305,10 +305,14 @@ treeitem[container="true"] > treerow > .treecell-indent { -moz-binding: url("chrome://global/content/treeBindings.xml#treecell-image"); } -.treecell-header { +.treecell-header, .treecell-inset-header { -moz-binding: url("chrome://global/content/treeBindings.xml#treecell-header"); } +.treecell-header-image { + -moz-binding: url("chrome://global/content/treeBindings.xml#treecell-header-image"); +} + .treecell-align-right { -moz-binding: url("chrome://global/content/treeBindings.xml#treecell-align-right"); }