Hi Prasanna,
addAndRemoveSidePanels, should first, unregister the panel and then
registers new one.
(i.e. onRemoveSidePanel and then onAppendSidePanel);
It would be great if you can investigate the panel syncing logic here:
https://github.com/firebug/firebug/blob/master/extension/content/firebug/firefox/bindings.xml#L86
Perhaps we could improve it so, the order doesn't matter?
addAndRemoveSidePanels : function(flag) {
FBTrace.sysout("addAndRemoveSidePanels")
var panelType_rules = Firebug.getPanelType("rulesSidePanel");
var panelType_colorContrast =
Firebug.getPanelType("colorContrastSidePanel");
/* flag == true if it is other than color contrast toolbar
button*/
if (flag) {
if (panelType_colorContrast) {
AINSPECTOR_FB.font_properties_registered =
panelType_colorContrast;
AINSPECTOR_FB.tabPanelUtil.onRemoveSidePanel(panelType_colorContrast);
}
if (panelType_rules) {
//nothing
} else {
FBTrace.sysout("AINSPECTOR_FB.rules_registered: ",
AINSPECTOR_FB.rules_registered);
panelType_rules = AINSPECTOR_FB.rules_registered;
AINSPECTOR_FB.tabPanelUtil.onAppendSidePanel(panelType_rules);
}
} else { //if it is only color contrast panel
if (panelType_rules) {
AINSPECTOR_FB.rules_registered = panelType_rules;
AINSPECTOR_FB.tabPanelUtil.onRemoveSidePanel(panelType_rules);
}
if (panelType_colorContrast) {
//nothing
} else {
panelType_colorContrast =
AINSPECTOR_FB.font_properties_registered;
AINSPECTOR_FB.tabPanelUtil.onAppendSidePanel(panelType_colorContrast);
}
}
}
Some other notes:
1) The 'raw' argument in highlight method (panel-utils.js) was
undefined so, I appended the following condition
if (!row)
return;
So, I was able to see the toolbar with buttons (Images, Controls, …)
2)
panel.name is an identifier it should not be translated
You should only translate the panel title (the title property).
3) The same for parentPanel it’s also an identifier and should not be
translated.
4) I wouldn’t recommend using DTD for locales, DTD entities are not
scriptable
and so you can’t avoid errors if there is a missing translation (DTD
entity) and e.g.
fallback to English string.
5) You don’t need an extra $AI_STR, just register your string bundle
with
Firebug.registerStringBundle and use Locale.$STR (or FBL.$STR)
6) dependents: should use identifiers of panels not titles.
7) You should consider switching to AMD syntax.
Honza