From 45026f8540a2ca26a9fddaeb75994f066fe60921 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Mon, 25 Apr 2011 22:20:30 +0000 Subject: [PATCH] nixos-gui: - Add a scroll bar for option details. - Respect text eol and indentation on the ui. svn path=/nixos/trunk/; revision=26974 --- gui/chrome/content/main.js | 23 +++++++++++++++-------- gui/chrome/content/myviewer.xul | 29 ++++++++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/gui/chrome/content/main.js b/gui/chrome/content/main.js index ee238993a3d..ecfc5a8c5c9 100644 --- a/gui/chrome/content/main.js +++ b/gui/chrome/content/main.js @@ -15,6 +15,13 @@ function setProgress(current, max) } */ +function updateTextbox(id, value) +{ + // setting the height cause an overflow which resize the textbox to its + // content due to its onoverflow attribute. + $(id).attr("value", value).attr("height", 1); +}; + function updatePanel(options) { log("updatePanel: " + options.length); @@ -32,22 +39,22 @@ function updatePanel(options) $("#desc").text(o.description); if (o.value != null) - $("#val").text(o.value); + updateTextbox("#val", o.value); else - $("#val").text(""); + updateTextbox("#val", ""); if (o.defaultValue != null) - $("#def").text(o.defaultValue); + updateTextbox("#def", o.defaultValue); else - $("#def").text(""); + updateTextbox("#def", ""); if (o.example != null) - $("#exp").text(o.example); + updateTextbox("#exp", o.example); else - $("#exp").text(""); + updateTextbox("#exp", ""); - $("#decls").text(o.declarations.join("\n")); - $("#defs").text(o.definitions.join("\n")); + updateTextbox("#decls", o.declarations.join("\n")); + updateTextbox("#defs", o.definitions.join("\n")); } diff --git a/gui/chrome/content/myviewer.xul b/gui/chrome/content/myviewer.xul index 732d5d62606..2aeb9391d07 100644 --- a/gui/chrome/content/myviewer.xul +++ b/gui/chrome/content/myviewer.xul @@ -18,43 +18,46 @@