[tor-commits] [tor-launcher/master] Bug 11471: Text does not fit the dialog size.

2014-06-30 Thread brade
commit c1f170510a8b8a9ad79b181f412c4355e9312056
Author: Kathy Brade br...@pearlcrescent.com
Date:   Mon Jun 30 11:22:59 2014 -0400

Bug 11471: Text does not fit the dialog size.

This is a partial fix (network settings wizard only).
Also fixed a nuisance:  the torWarning CSS class was being added
  more than once to the Copy Tor Log To Clipboard button.
---
 src/chrome/content/network-settings.js |   66 +---
 1 file changed, 61 insertions(+), 5 deletions(-)

diff --git a/src/chrome/content/network-settings.js 
b/src/chrome/content/network-settings.js
index c6b6cf2..2f1d619 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -177,10 +177,50 @@ function initDialog()
   showPanel();
   }
 
+  // Resize this window to fit content.  sizeToContent() alone will not do
+  // the job (it has many limitations and it is buggy).
+  sizeToContent();
+  let w = maxWidthOfContent();
+  if (w)
+  {
+let windowFrameWidth = window.outerWidth - window.innerWidth;
+w += windowFrameWidth;
+
+if (w  window.outerWidth)
+  window.resizeTo(w, window.outerHeight);
+  }
+
   TorLauncherLogger.log(2, initDialog done);
 }
 
 
+// For now, we assume that the wizard buttons are the widest portion.
+// TODO: return a value for the settings dialog (non-wizard case).
+function maxWidthOfContent()
+{
+  let haveWizard = (getWizard() != null);
+  if (!haveWizard)
+return undefined;
+
+  // Show all buttons so we can get an accurate width measurement.
+  // They will be hidden, as necessary, by the wizard.
+  let buttons = back,next,cancel,extra2,help.split(',');
+  for (let i = 0; i  buttons.length; ++i)
+showOrHideButton(buttons[i], true, false);
+
+  let btn = document.documentElement.getButton(cancel);
+  let btnContainer = btn.parentElement;
+
+  const kWarningIconWidth = 20; // skin/warning.png is 16 plus some margin
+  let r = btnContainer.getBoundingClientRect();
+
+  // Hide copy log button if appropriate.
+  restoreCopyLogVisibility();
+
+  return Math.ceil((2 * r.left) + r.width + kWarningIconWidth);
+}
+
+
 function getWizard()
 {
   var elem = document.getElementById(TorNetworkSettings);
@@ -434,13 +474,31 @@ function showCopyLogButton(aHaveErrorOrWarning)
 if (aHaveErrorOrWarning)
 {
   var clz = copyLogBtn.getAttribute(class);
-  copyLogBtn.setAttribute(class, clz ? clz +  torWarning
-   : torWarning);
+  if (!clz)
+copyLogBtn.setAttribute(class, torWarning);
+  else if (clz.indexOf(torWarning)  0)
+copyLogBtn.setAttribute(class, clz +  torWarning);
 }
   }
 }
 
 
+function restoreCopyLogVisibility()
+{
+  if (!getWizard())
+return;
+
+  var copyLogBtn = document.documentElement.getButton(extra2);
+  if (!copyLogBtn)
+return;
+
+  if (copyLogBtn.hasAttribute(wizardCanCopyLog))
+copyLogBtn.removeAttribute(hidden);
+  else
+copyLogBtn.setAttribute(hidden, true);
+}
+
+
 function showOrHideButton(aID, aShow, aFocus)
 {
   var btn = setButtonAttr(aID, hidden, !aShow);
@@ -649,9 +707,7 @@ function closeHelp()
   {
 showOrHideButton(cancel, true, false);
 showOrHideButton(back, true, false);
-var copyLogBtn = document.documentElement.getButton(extra2);
-if (copyLogBtn  copyLogBtn.hasAttribute(wizardCanCopyLog))
-  copyLogBtn.removeAttribute(hidden);
+restoreCopyLogVisibility();
 restoreButtonLabel(next);
 var forAssistance = document.getElementById(forAssistance);
 if (forAssistance)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor-launcher/master] Bug 11471: Text does not fit the dialog size.

2014-06-30 Thread brade
commit 7a56563f3bc52f2031fc998c743247f43d488a9c
Author: Kathy Brade br...@pearlcrescent.com
Date:   Mon Jun 30 16:20:38 2014 -0400

Bug 11471: Text does not fit the dialog size.

Increase the progress window width slightly and allow for three lines
in the description field.
---
 src/chrome/content/progress.xul |4 ++--
 src/chrome/skin/progress.css|6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/chrome/content/progress.xul b/src/chrome/content/progress.xul
index fe85e39..473dab9 100644
--- a/src/chrome/content/progress.xul
+++ b/src/chrome/content/progress.xul
@@ -1,6 +1,6 @@
 ?xml version=1.0?
 !--
-   - Copyright (c) 2013, The Tor Project, Inc.
+   - Copyright (c) 2014, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
   --
@@ -32,7 +32,7 @@
 spacer flex=1 /
   /vbox
   separator orient=vertical /
-  vbox
+  vbox flex=1
 label id=progressHeading value=torprogress.heading; /
 description id=progressDesc /
   /vbox
diff --git a/src/chrome/skin/progress.css b/src/chrome/skin/progress.css
index 711a679..d718452 100644
--- a/src/chrome/skin/progress.css
+++ b/src/chrome/skin/progress.css
@@ -1,12 +1,12 @@
 /*
- * Copyright (c) 2013, The Tor Project, Inc.
+ * Copyright (c) 2014, The Tor Project, Inc.
  * See LICENSE for licensing information.
  *
  * vim: set sw=2 sts=2 ts=8 et syntax=css:
  */
 
 dialog {
-  width: 370px;
+  width: 400px;
 }
 
 #progressHeading {
@@ -27,7 +27,7 @@ dialog {
 }
 
 #progressDesc {
-  height: 32px;
+  height: 48px;
 }
 
 #progressMeter {

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits