# # = Preferences Window Framework # # The syntax for use looks something like: # # # # # # # # # # # Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); this.service.getDefaultBranch(""); Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranchInternal); this.preferences.rootBranchInternal .removeObserver(this.name, this.preferences); return this.getAttribute("instantApply") == "true" || document.documentElement.instantApply; if (val == this.name) return val; this.preferences.rootBranchInternal .removeObserver(this.name, this.preferences); this.setAttribute('name', val); this.preferences.rootBranchInternal .addObserver(val, this.preferences, false); return val; null return this.preferences.rootBranch.prefIsLocked(this.name); return this.getAttribute("disabled") == "true"; return parseInt(this.getAttribute("tabindex")); return this.preferences.rootBranch.prefHasUserValue(this.name); this.preferences.rootBranch.clearUserPref(this.name); false return this._useDefault ? this.preferences.defaultBranch : this.preferences.rootBranch; false with id='" + this.id + "' and name='" + this.name + "' has unknown type '" + this.type + "'."; consoleService.logStringMessage(msg); ]]> this.updateElements(); #else title="&preferencesDefaultTitleMac.title;"> #endif false this.setAttribute("lastSelected", val); document.persist(this.id, "lastSelected"); return val; null false 1) aPaneElement.removeAttribute("flex"); // Calling sizeToContent after the first prefpane is loaded // will size the windows contents so style information is // available to calculate correct sizing. if (!this._initialized && prefpanes.length > 1) { if (this._shouldAnimate) this.style.minHeight = 0; window.sizeToContent(); } var oldPane = this.lastSelected ? document.getElementById(this.lastSelected) : this.preferencePanes[0]; oldPane.selected = !(aPaneElement.selected = true); this.lastSelected = aPaneElement.id; this.currentPane = aPaneElement; this._initialized = true; // Only animate if we've switched between prefpanes if (this._shouldAnimate && oldPane.id != aPaneElement.id) { aPaneElement.style.opacity = 0.0; this.animate(oldPane, aPaneElement); } else if (!this._shouldAnimate && prefpanes.length > 1) { var targetHeight = parseInt(window.getComputedStyle(this._paneDeckContainer, "").height); var verticalPadding = parseInt(window.getComputedStyle(aPaneElement, "").paddingTop); verticalPadding += parseInt(window.getComputedStyle(aPaneElement, "").paddingBottom); if (aPaneElement.contentHeight > targetHeight - verticalPadding) { // To workaround the bottom border of a groupbox from being // cutoff an hbox with a class of bottomBox may enclose it. // This needs to include its padding to resize properly. // See bug 394433 var bottomPadding = 0; var bottomBox = aPaneElement.getElementsByAttribute("class", "bottomBox")[0]; if (bottomBox) bottomPadding = parseInt(window.getComputedStyle(bottomBox, "").paddingBottom); window.innerHeight += bottomPadding + verticalPadding + aPaneElement.contentHeight - targetHeight; } // XXX rstrong - extend the contents of the prefpane to // prevent elements from being cutoff (see bug 349098). if (aPaneElement.contentHeight + verticalPadding < targetHeight) aPaneElement._content.style.height = targetHeight - verticalPadding + "px"; } } break; } } var helpButton = document.documentElement.getButton("help"); if (aPaneElement.hasAttribute("helpURI")) helpButton.hidden = false; else helpButton.hidden = true; ]]> oldHeight ? 1 : -1; var sizeDelta = Math.abs(oldHeight - aNewPane.contentHeight); this._animateRemainder = sizeDelta % this._animateIncrement; this._setUpAnimationTimer(oldHeight); ]]> 0 && this._currentHeight >= lastSelectedPane.contentHeight) || (this._multiplier < 0 && this._currentHeight <= lastSelectedPane.contentHeight)) return 0; if ((this._multiplier > 0 && newHeight > lastSelectedPane.contentHeight) || (this._multiplier < 0 && newHeight < lastSelectedPane.contentHeight)) increment = this._animateRemainder * this._multiplier; return increment; ]]> null null 15 40 5 0.40 0 0 0 return openDialog(aURL, "", "modal,centerscreen,resizable=no" + (aFeatures != "" ? ("," + aFeatures) : ""), aParams); // copied from contextHelp.js // Locate existing help window for this helpFileURI. // copied from contextHelp.js // Opens up the Help Viewer with the specified topic and helpFileURI. // currentPane is set in _selectPane for prefwindows which aren't childs. // So if there's no currentPane, just use the first pane. var pane = this.currentPane ? this.currentPane : this.preferencePanes[0]; this.openHelp(pane.helpTopic, pane.getAttribute("helpURI")); if (event.originalTarget.hasAttribute("pane")) { var pane = document.getElementById(event.originalTarget.getAttribute("pane")); event.originalTarget.parentNode.parentNode.showPane(pane); } if (this.instantApply) window.close(); false return document.getElementById(aElement.getAttribute("preference")); var targetHeight = parseInt(window.getComputedStyle(this._content, "").height); targetHeight += parseInt(window.getComputedStyle(this._content, "").marginTop); targetHeight += parseInt(window.getComputedStyle(this._content, "").marginBottom); return targetHeight; document.getAnonymousElementByAttribute(this, "class", "content-box"); // This "command" event handler tracks changes made to preferences by // the user in this window. this.userChangedValue(event.target); // This "select" event handler tracks changes made to colorpicker // preferences by the user in this window. if (event.target.localName == "colorpicker") this.userChangedValue(event.target); // This "change" event handler tracks changes made to preferences by // the user in this window. this.userChangedValue(event.target); // This "input" event handler tracks changes made to preferences by // the user in this window. this.userChangedValue(event.target); # -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is the Preferences System. # # The Initial Developer of the Original Code is # Ben Goodger. # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved. # # Contributor(s): # Ben Goodger # Josh Aas # # Alternatively, the contents of this file may be used under the terms of # either the GNU General Public License Version 2 or later (the "GPL"), or # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your # decision by deleting the provisions above and replace them with the notice # and other provisions required by the GPL or the LGPL. If you do not delete # the provisions above, a recipient may use your version of this file under # the terms of any one of the MPL, the GPL or the LGPL. # # ***** END LICENSE BLOCK ***** # # This is PrefWindow 6. The Code Could Well Be Ready, Are You? # # Historical References: # PrefWindow V (February 1, 2003) # PrefWindow IV (April 24, 2000) # PrefWindow III (January 6, 2000) # PrefWindow II (???) # PrefWindow I (June 4, 1999) #