177153 - Cleanup of inspector toggling code

r=timeless sr=bzbarsky
This commit is contained in:
caillon%returnzero.com 2002-11-15 03:20:01 +00:00
parent f4be2cfdb4
commit 011a7fc7d4
4 changed files with 49 additions and 40 deletions

View File

@ -19,7 +19,7 @@
<command id="cmdShowPrefsDialog" oncommand="inspector.showPrefsDialog()"/>
<command id="cmdToggleBrowser" oncommand="inspector.toggleBrowser()"/>
<command id="cmdToggleBrowser" oncommand="inspector.toggleBrowser(true)"/>
<command id="cmdEditUndo" global="true" oncommand="inspector.doViewerCommand('cmdEditUndo');"/>
<command id="cmdEditRedo" global="true" oncommand="inspector.doViewerCommand('cmdEditRedo');"/>
@ -32,7 +32,7 @@
<!--
<command id="cmdRunSearch" oncommand="inspector.runSearch()"/>
<command id="cmdToggleSearch" oncommand="inspector.toggleSearch()"/>
<command id="cmdToggleSearch" oncommand="inspector.toggleSearch(true)"/>
<command id="cmdViewSearchItem" oncommand="inspector.viewSearchItem()"/>
<command id="cmdEditSearchItem" oncommand="inspector.editSearchItem()"/>
<command id="cmdCopySearchItemLine" oncommand="inspector.copySearchItemLine()"/>

View File

@ -98,8 +98,8 @@ InspectorApp.prototype =
var el = document.getElementById("bxBrowser");
el.addEventListener("load", BrowserLoadListener, true);
this.toggleBrowser(true, false);
//this.toggleSearch(true, false);
this.setBrowser(false, true);
//this.setSearch(false, true);
this.mClipboardHelper = XPCU.getService(kClipboardHelperCID, "nsIClipboardHelper");
@ -182,25 +182,33 @@ InspectorApp.prototype =
this.startSearchModule(url);
}
},
toggleBrowser: function(aExplicit, aValue, aSetOnly)
toggleBrowser: function(aToggleSplitter)
{
var val = aExplicit ? aValue : !this.mShowBrowser;
this.mShowBrowser = val;
if (!aSetOnly)
this.openSplitter("Browser", val);
var cmd = document.getElementById("cmdToggleBrowser");
cmd.setAttribute("checked", val);
this.setBrowser(!this.mShowBrowser, aToggleSplitter)
},
toggleSearch: function(aExplicit, aValue, aSetOnly)
setBrowser: function(aValue, aToggleSplitter)
{
var val = aExplicit ? aValue : !this.mShowSearch;
this.mShowSearch = val;
if (!aSetOnly)
this.openSplitter("Search", val);
this.mShowBrowser = aValue;
if (aToggleSplitter)
this.openSplitter("Browser", aValue);
var cmd = document.getElementById("cmdToggleBrowser");
cmd.setAttribute("checked", aValue);
},
toggleSearch: function(aToggleSplitter)
{
this.setSearch(!this.mShowSearch, aToggleSplitter);
},
setSearch: function(aValue, aToggleSplitter)
{
this.mShowSearch = aValue;
if (aToggleSplitter)
this.openSplitter("Search", aValue);
var cmd = document.getElementById("cmdToggleSearch");
cmd.setAttribute("checked", val);
cmd.setAttribute("checked", aValue);
},
openSplitter: function(aName, aTruth)
@ -298,7 +306,7 @@ InspectorApp.prototype =
this.mPendingURL = aURL;
this.mPendingNoSave = aNoSaveHistory;
this.browseToURL(aURL);
this.toggleBrowser(true, true);
this.setBrowser(true, true);
},
browseToURL: function(aURL)
@ -318,7 +326,7 @@ InspectorApp.prototype =
if (win) {
this.setTargetWindow(win);
this.toggleBrowser(true, false);
this.setBrowser(false, true);
} else
alert("Unable to switch to window.");
},
@ -503,9 +511,9 @@ InspectorApp.prototype =
onSplitterOpen: function(aSplitter)
{
if (aSplitter.id == "splBrowser") {
this.toggleBrowser(true, aSplitter.isOpened, true);
this.setBrowser(aSplitter.isOpened, false);
} else if (aSplitter.id == "splSearch") {
this.toggleSearch(true, aSplitter.isOpened, true);
this.setSearch(aSplitter.isOpened, false);
}
},

View File

@ -18,7 +18,7 @@
oncommand="inspector.getViewer('dom').findNext()"/>
<command id="cmd:toggleAnon" viewer="dom"
oncommand="inspector.getViewer('dom').toggleAnonContent()"/>
oncommand="inspector.getViewer('dom').toggleAnonContent(true)"/>
<command id="cmd:toggleSubDocs" viewer="dom"
oncommand="inspector.getViewer('dom').toggleSubDocs()"/>

View File

@ -125,11 +125,11 @@ DOMViewer.prototype =
this.mPanel = aPane;
aPane.notifyViewerReady(this);
this._toggleAnonContent(true, PrefUtils.getPref("inspector.dom.showAnon"));
this.setAnonContent(PrefUtils.getPref("inspector.dom.showAnon"), false);
this.setWhitespaceNodes(PrefUtils.getPref("inspector.dom.showWhitespaceNodes"));
this.setFlashSelected(PrefUtils.getPref("inspector.blink.on"));
},
destroy: function()
{
this.mDOMTree.treeBoxObject.view = null;
@ -185,23 +185,25 @@ DOMViewer.prototype =
"_blank", "chrome,dependent", this.mFindType, this.mFindDir, this.mFindParams);
},
toggleAnonContent: function(aExplicit, aValue)
toggleAnonContent: function(aRebuild)
{
this._toggleAnonContent(aExplicit, aValue);
this.rebuild();
this.setAnonContent(!this.mDOMView.showAnonymousContent, aRebuild);
},
_toggleAnonContent: function(aExplicit, aValue)
setAnonContent: function(aValue, aRebuild)
{
var val = aExplicit ? aValue : !this.mDOMView.showAnonymousContent;
this.mDOMView.showAnonymousContent = val;
this.mPanel.panelset.setCommandAttribute("cmd:toggleAnon", "checked", val);
PrefUtils.setPref("inspector.dom.showAnon", val);
this.mDOMView.showAnonymousContent = aValue;
this.mPanel.panelset.setCommandAttribute("cmd:toggleAnon", "checked", aValue);
PrefUtils.setPref("inspector.dom.showAnon", aValue);
if (aRebuild) {
this.rebuild();
}
},
toggleSubDocs: function(aExplicit, aValue)
toggleSubDocs: function()
{
var val = aExplicit ? aValue : !this.mDOMView.showSubDocuments;
var val = !this.mDOMView.showSubDocuments;
this.mDOMView.showSubDocuments = val;
this.mPanel.panelset.setCommandAttribute("cmd:toggleSubDocs", "checked", val);
},
@ -228,7 +230,7 @@ DOMViewer.prototype =
this.setWhitespaceNodes(!this.mDOMView.showWhitespaceNodes);
},
toggleAttributes: function(aExplicit, aValue)
toggleAttributes: function()
{
alert("NOT YET IMPLEMENTED");
},
@ -694,10 +696,9 @@ DOMViewer.prototype =
}
},
toggleFlashSelected: function(aExplicit, aValue)
toggleFlashSelected: function()
{
var val = aExplicit ? aValue : !this.mFlashSelected;
this.setFlashSelected(val);
this.setFlashSelected(!this.mFlashSelected);
},
setFlashSelected: function(aValue)