[Pkg-mozext-commits] [firebug] 32/48: Issue 7305 (Add a button for pretty-printing the currently displayed script) https://code.google.com/p/fbug/issues/detail?id=7305

David Prévot taffit at moszumanska.debian.org
Tue Jun 3 01:47:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository firebug.

commit 3b4e4d94bcc1fb45d63e247d5dbae221ad515dff
Author: Sebastian Zartner <sebastianzartner at gmail.com>
Date:   Tue May 27 23:58:57 2014 +0200

    Issue 7305 (Add a button for pretty-printing the currently displayed
    script)
    https://code.google.com/p/fbug/issues/detail?id=7305
---
 .../content/firebug/debugger/script/scriptPanel.js |  36 ++--
 extension/content/firebug/firebugOverlay.xul       |   5 +
 .../content/firebug/firefox/firebugMenuOverlay.xul |   2 +
 extension/skin/classic/firebug.css                 |  17 +-
 extension/skin/classic/prettyPrint.svg             | 201 +++++++++++++++++++++
 5 files changed, 239 insertions(+), 22 deletions(-)

diff --git a/extension/content/firebug/debugger/script/scriptPanel.js b/extension/content/firebug/debugger/script/scriptPanel.js
index 7ee4eef..bc5536e 100644
--- a/extension/content/firebug/debugger/script/scriptPanel.js
+++ b/extension/content/firebug/debugger/script/scriptPanel.js
@@ -549,6 +549,8 @@ ScriptPanel.prototype = Obj.extend(BasePanel,
         if (sourceLink instanceof SourceLink)
             this.showSource(sourceLink);
 
+        this.setPrettyPrintState();
+
         Events.dispatch(this.fbListeners, "onUpdateScriptLocation", [this, sourceLink]);
     },
 
@@ -1407,25 +1409,6 @@ ScriptPanel.prototype = Obj.extend(BasePanel,
             )
         }
 
-        var sourceFile = this.getSourceFile();
-        var category = sourceFile.getCategory();
-
-        // Pretty printing can be done only for source files that have
-        // corresponding server side script actor. Note that dynamic scripts
-        // are currently collected on the client side (a workaround) since
-        // RDP doesn't support it yet.
-        if (category === "js" && sourceFile.actor)
-        {
-            items.push("-",
-            {
-                label: "script.PrettyPrint",
-                tooltiptext: "script.tip.PrettyPrint",
-                type: "checkbox",
-                checked: sourceFile.isPrettyPrinted,
-                command: Obj.bindFixed(this.togglePrettyPrint, this)
-            });
-        }
-
         return items;
     },
 
@@ -1573,6 +1556,21 @@ ScriptPanel.prototype = Obj.extend(BasePanel,
         }
     },
 
+    // Update the pretty-print button to reflect ability of the selection to be reformatted
+    setPrettyPrintState: function()
+    {
+        var sourceFile = this.getSourceFile();
+        var category = sourceFile.getCategory();
+
+        // Pretty printing can be done only for source files that have
+        // corresponding server side script actor. Note that dynamic scripts
+        // are currently collected on the client side (a workaround) since
+        // RDP doesn't support it yet.
+        var prettyPrintButton = Firebug.chrome.$("fbToggleScriptPrettyPrinting");
+        prettyPrintButton.disabled = (category !== "js" || !sourceFile.actor);
+        prettyPrintButton.checked = (!prettyPrintButton.disabled && sourceFile.isPrettyPrinted);
+    },
+
     syncListeners: function(context)
     {
         var chrome = Firebug.chrome;
diff --git a/extension/content/firebug/firebugOverlay.xul b/extension/content/firebug/firebugOverlay.xul
index 69bbc80..1966ad4 100644
--- a/extension/content/firebug/firebugOverlay.xul
+++ b/extension/content/firebug/firebugOverlay.xul
@@ -248,6 +248,11 @@
                                                     class="fbInternational"/>
                                             </menupopup>
                                         </toolbarbutton>
+                                        <toolbarbutton id="fbToggleScriptPrettyPrinting"
+                                            type="checkbox"
+                                            class="toolbar-image-button fbInternational"
+                                            tooltiptext="script.tip.PrettyPrint"
+                                            command="cmd_firebug_toggleScriptPrettyPrinting"/>
                                     </hbox>
 
                                     <hbox id="fbNetButtons" collapsed="true" class="noTabStop">
diff --git a/extension/content/firebug/firefox/firebugMenuOverlay.xul b/extension/content/firebug/firefox/firebugMenuOverlay.xul
index b08900a..94cea88 100644
--- a/extension/content/firebug/firefox/firebugMenuOverlay.xul
+++ b/extension/content/firebug/firefox/firebugMenuOverlay.xul
@@ -20,6 +20,8 @@
         <command id="cmd_firebug_toggleHTMLEditing" oncommand="Firebug.currentContext.getPanel('html').toggleEditing()"/>
         <command id="cmd_firebug_togglecssEditMode" oncommand="Firebug.currentContext.getPanel('stylesheet').toggleEditing()"/>
 
+        <command id="cmd_firebug_toggleScriptPrettyPrinting" oncommand="Firebug.currentContext.getPanel('script').togglePrettyPrint()"/>
+
         <command id="cmd_firebug_focusCommandLine" oncommand="if (!Firebug.currentContext) Firebug.toggleBar(true); Firebug.CommandLine.focus(Firebug.currentContext, {select: true})"/>
         <command id="cmd_firebug_focusFirebugSearch" oncommand="if (Firebug.currentContext) Firebug.Search.onSearchCommand(document);"/>
         <command id="cmd_firebug_focusWatchEditor" oncommand="if (Firebug.currentContext) Firebug.chrome.focusWatch(Firebug.currentContext);"/>
diff --git a/extension/skin/classic/firebug.css b/extension/skin/classic/firebug.css
index 52576ef..bc3f1b0 100644
--- a/extension/skin/classic/firebug.css
+++ b/extension/skin/classic/firebug.css
@@ -517,7 +517,18 @@ textbox[type="fbSearchBox"] > panel {
     filter: url(resource://firebugui/filters.svg#deepDarken);
 }
 
-/*************************************************************************************************/
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Script formatting buttons */
+
+#fbToggleScriptPrettyPrinting {
+    list-style-image: url(chrome://firebug/skin/prettyPrint.svg);
+}
+
+#fbToggleScriptPrettyPrinting[disabled=true] {
+    filter: url(resource://firebugui/filters.svg#grayscale);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 /* Debugger buttons */
 
 #fbDebuggerButtons {
@@ -569,7 +580,7 @@ textbox[type="fbSearchBox"] > panel {
 }
 
 
-/*************************************************************************************************/
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 /* Script history buttons */
 
 #fbNavigateBackButton:-moz-locale-dir(ltr),
@@ -609,7 +620,7 @@ textbox[type="fbSearchBox"] > panel {
     font-weight: bold;
 }
 
-/*************************************************************************************************/
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 /* Command Line Popup */
 
 #fbCommandPopupButton {
diff --git a/extension/skin/classic/prettyPrint.svg b/extension/skin/classic/prettyPrint.svg
new file mode 100644
index 0000000..31155cb
--- /dev/null
+++ b/extension/skin/classic/prettyPrint.svg
@@ -0,0 +1,201 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- See license.txt for terms of usage -->
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   version="1.1"
+   width="16"
+   height="16"
+   viewBox="0 0 16 16"
+   id="svg2">
+  <defs
+     id="defs4">
+    <linearGradient
+       id="linearGradient3776">
+      <stop
+         id="stop3778"
+         style="stop-color:#1c3b5c;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3780"
+         style="stop-color:#285078;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3766">
+      <stop
+         id="stop3768"
+         style="stop-color:#285a8c;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3770"
+         style="stop-color:#508cc8;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="12.425406"
+       y1="1050.2233"
+       x2="3.5745938"
+       y2="1038.4811"
+       id="linearGradient3772"
+       xlink:href="#linearGradient3766"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       x1="11.258194"
+       y1="1051.3895"
+       x2="2.0714815"
+       y2="1039.2687"
+       id="linearGradient3774"
+       xlink:href="#linearGradient3776"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       id="linearGradient3766-7">
+      <stop
+         id="stop3768-4"
+         style="stop-color:#285a8c;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3770-0"
+         style="stop-color:#508cc8;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       id="linearGradient3776-4">
+      <stop
+         id="stop3778-8"
+         style="stop-color:#1c3b5c;stop-opacity:1"
+         offset="0" />
+      <stop
+         id="stop3780-8"
+         style="stop-color:#285078;stop-opacity:1"
+         offset="1" />
+    </linearGradient>
+    <linearGradient
+       x1="12.425406"
+       y1="1050.2233"
+       x2="3.5745938"
+       y2="1038.4811"
+       id="linearGradient3835"
+       xlink:href="#linearGradient3766-7"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       x1="11.258194"
+       y1="1051.3895"
+       x2="2.0714815"
+       y2="1039.2687"
+       id="linearGradient3837"
+       xlink:href="#linearGradient3776-4"
+       gradientUnits="userSpaceOnUse" />
+    <linearGradient
+       x1="12.425406"
+       y1="1050.2233"
+       x2="3.5745938"
+       y2="1038.4811"
+       id="linearGradient3839"
+       xlink:href="#linearGradient3766-7"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,28.419299,0)" />
+    <linearGradient
+       x1="11.258194"
+       y1="1051.3895"
+       x2="2.0714815"
+       y2="1039.2687"
+       id="linearGradient3841"
+       xlink:href="#linearGradient3776-4"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,28.419299,0)" />
+    <linearGradient
+       x1="12.425406"
+       y1="1050.2233"
+       x2="3.5745938"
+       y2="1038.4811"
+       id="linearGradient3843"
+       xlink:href="#linearGradient3766-7"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,8.8137792,0)" />
+    <linearGradient
+       x1="11.258194"
+       y1="1051.3895"
+       x2="2.0714815"
+       y2="1039.2687"
+       id="linearGradient3845"
+       xlink:href="#linearGradient3776-4"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,8.8137792,0)" />
+    <linearGradient
+       x1="12.425406"
+       y1="1050.2233"
+       x2="3.5745938"
+       y2="1038.4811"
+       id="linearGradient3932"
+       xlink:href="#linearGradient3766-7"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,28.419299,0)" />
+    <linearGradient
+       x1="11.258194"
+       y1="1051.3895"
+       x2="2.0714815"
+       y2="1039.2687"
+       id="linearGradient3934"
+       xlink:href="#linearGradient3776-4"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,28.419299,0)" />
+    <linearGradient
+       x1="17.286474"
+       y1="1046.2933"
+       x2="-18.064997"
+       y2="1003.1907"
+       id="linearGradient3937"
+       xlink:href="#linearGradient3766-7"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,28.419299,0)" />
+    <linearGradient
+       x1="12.826281"
+       y1="1050.7607"
+       x2="-24.272367"
+       y2="1006.0219"
+       id="linearGradient3939"
+       xlink:href="#linearGradient3776-4"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-1,0,0,1,28.419299,0)" />
+  </defs>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     transform="matrix(0.87176843,0,0,0.87142036,1.0258526,-902.07849)"
+     id="layer1"
+     style="fill:url(#linearGradient3772);fill-opacity:1;stroke:url(#linearGradient3774)">
+    <g
+       transform="matrix(0.25416706,0,0,0.25364326,0.79526474,784.62751)"
+       id="text4062"
+       style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:url(#linearGradient3772);fill-opacity:1;stroke:url(#linearGradient3774);stroke-width:1.80748332;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:sans-serif" />
+  </g>
+  <g
+     transform="matrix(-0.87176843,0,0,0.87142036,14.831027,-902.07849)"
+     id="layer1-2"
+     style="fill:url(#linearGradient3843);fill-opacity:1;stroke:url(#linearGradient3845)">
+    <g
+       transform="matrix(0.25416706,0,0,0.25364326,0.79526474,784.62751)"
+       id="text4062-4"
+       style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:url(#linearGradient3839);fill-opacity:1;stroke:url(#linearGradient3841);stroke-width:1.80748332;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:sans-serif">
+      <path
+         d="m 21.734149,1045.6726 0,5.1254 -1.816406,0 c -4.863281,0 -9.027342,-0.7227 -10.6874984,-2.168 -1.640625,-1.4453 -2.4609375,-4.3261 -2.4609375,-8.6426 l 0,-6.0986 c 0,-2.9492 -0.5273437,-4.9902 -1.5820312,-6.1231 -1.0546875,-1.1328 -2.96875,-1.6992 -5.74218751,-1.6992 l -1.78710939,0 0,-4.1894 1.78710939,0 c 2.79296871,0 4.70703121,-0.5566 5.74218751,-1.6699 1.0546875,-1.1329 1.5820312,-3.1544 1.5820312,-6.0645 l 0,-6.1268 c 0,-4.3165 0.8203125,-7.1876 2.4609375,-8.61332 1.660 [...]
+         id="path4067-5"
+         style="font-size:60px;font-variant:normal;font-stretch:normal;fill:url(#linearGradient3937);fill-opacity:1;stroke:url(#linearGradient3939);stroke-width:1.80748332;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Fixedsys;-inkscape-font-specification:Fixedsys" />
+    </g>
+  </g>
+</svg>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list