Permalink
Browse files

Better solution for issue 3871 (Change color format)

  • Loading branch information...
1 parent f387900 commit 74c768185a93ce2c0c23ab4ed63598f997d72ebb @SebastianZ SebastianZ committed May 29, 2012
@@ -10,15 +10,17 @@ define([
"firebug/lib/dom",
"firebug/lib/xml",
"firebug/lib/url",
+ "firebug/lib/array",
"firebug/js/sourceLink",
"firebug/chrome/menu",
"firebug/lib/options",
"firebug/lib/string",
"firebug/lib/persist",
+ "firebug/css/cssModule",
"firebug/css/cssReps"
],
-function(Obj, Firebug, Domplate, Locale, Events, Css, Dom, Xml, Url, SourceLink, Menu,
- Options, Str, Persist, CSSInfoTip) {
+function(Obj, Firebug, Domplate, Locale, Events, Css, Dom, Xml, Url, Arr, SourceLink, Menu,
+ Options, Str, Persist, CSSModule, CSSInfoTip) {
with (Domplate) {
@@ -302,14 +304,6 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
this.styleOpened[style.property] = Css.hasClass(styleNode, "opened");
},
- setColorDisplay: function(type)
- {
- Options.set("colorDisplay", type);
-
- var menuItem = Firebug.chrome.$("colorDisplay"+type.charAt(0).toUpperCase()+type.slice(1));
- menuItem.setAttribute("checked", "true");
- },
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Events
@@ -471,37 +465,11 @@ CSSComputedPanel.prototype = Obj.extend(Firebug.Panel,
},
Menu.optionMenu("Show_Mozilla_specific_styles",
"showMozillaSpecificStyles",
- "computed.option.tip.Show_Mozilla_Specific_Styles"),
- "-",
- {
- label: "computed.option.label.Colors_As_Hex",
- tooltiptext: "computed.option.tip.Colors_As_Hex",
- type: "radio",
- name: "colorDisplay",
- id: "colorDisplayHex",
- command: Obj.bindFixed(this.setColorDisplay, this, "hex"),
- checked: Options.get("colorDisplay") == "hex"
- },
- {
- label: "computed.option.label.Colors_As_RGB",
- tooltiptext: "computed.option.tip.Colors_As_RGB",
- type: "radio",
- name: "colorDisplay",
- id: "colorDisplayRGB",
- command: Obj.bindFixed(this.setColorDisplay, this, "rgb"),
- checked: Options.get("colorDisplay") == "rgb"
- },
- {
- label: "computed.option.label.Colors_As_HSL",
- tooltiptext: "computed.option.tip.Colors_As_HSL",
- type: "radio",
- name: "colorDisplay",
- id: "colorDisplayHSL",
- command: Obj.bindFixed(this.setColorDisplay, this, "hsl"),
- checked: Options.get("colorDisplay") == "hsl"
- }
+ "computed.option.tip.Show_Mozilla_Specific_Styles")
);
+ items = Arr.extendArray(items, CSSModule.getColorDisplayOptionMenuItems());
+
return items;
},
@@ -9,8 +9,9 @@ define([
"firebug/lib/css",
"firebug/chrome/window",
"firebug/lib/xml",
+ "firebug/lib/options"
],
-function(Obj, Firebug, Xpcom, Events, Url, Css, Win, Xml) {
+function(Obj, Firebug, Xpcom, Events, Url, Css, Win, Xml, Options) {
// ********************************************************************************************* //
// Constants
@@ -356,7 +357,8 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
return m ? m[0] : "";
},
- getPropertyInfo: function(computedStyle, propName) {
+ getPropertyInfo: function(computedStyle, propName)
+ {
var propInfo = {
property: propName,
value: computedStyle.getPropertyValue(propName),
@@ -367,6 +369,48 @@ Firebug.CSSModule = Obj.extend(Obj.extend(Firebug.Module, Firebug.EditorSelector
return propInfo;
},
+ setColorDisplay: function(event, type)
+ {
+ Options.set("colorDisplay", type);
+
+ var menuItem = event.target;
+ menuItem.setAttribute("checked", "true");
+ },
+
+ getColorDisplayOptionMenuItems: function()
+ {
+ return [
+ "-",
+ {
+ label: "computed.option.label.Colors_As_Hex",
+ tooltiptext: "computed.option.tip.Colors_As_Hex",
+ type: "radio",
+ name: "colorDisplay",
+ id: "colorDisplayHex",
+ command: Obj.bind(this.setColorDisplay, this, "hex"),
+ checked: Options.get("colorDisplay") == "hex"
+ },
+ {
+ label: "computed.option.label.Colors_As_RGB",
+ tooltiptext: "computed.option.tip.Colors_As_RGB",
+ type: "radio",
+ name: "colorDisplay",
+ id: "colorDisplayRGB",
+ command: Obj.bind(this.setColorDisplay, this, "rgb"),
+ checked: Options.get("colorDisplay") == "rgb"
+ },
+ {
+ label: "computed.option.label.Colors_As_HSL",
+ tooltiptext: "computed.option.tip.Colors_As_HSL",
+ type: "radio",
+ name: "colorDisplay",
+ id: "colorDisplayHSL",
+ command: Obj.bind(this.setColorDisplay, this, "hsl"),
+ checked: Options.get("colorDisplay") == "hsl"
+ }
+ ];
+ },
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Module functions
Oops, something went wrong.

0 comments on commit 74c7681

Please sign in to comment.