MODULE = mandelbrot
-EXTENSION_VERSION = 4.0b3
+EXTENSION_VERSION = 4.0
XPI_NAME = mandelbrot
USE_EXTENSION_MANIFEST = 1
var gStartTime = 0;
var gMbrotBundle;
var gCurrentImageData;
+var gLastImageData;
function Startup() {
gMbrotBundle = document.getElementById("mbrotBundle");
document.getElementById("statusLabel").value = gMbrotBundle.getString("statusDrawing");
+ if (gCurrentImageData) {
+ gLastImageData = gCurrentImageData;
+ }
+
let Cr_vals = getAdjustPref("last_image.Cr_*");
let Cr_min = Cr_vals.Cr_min;
let Cr_max = Cr_vals.Cr_max;
let iterMax = getAdjustPref("iteration_max");
let algorithm = getAdjustPref("use_algorithm");
+ let currentPalette = getAdjustPref("color_palette");
+ if (!gColorPalette || !gColorPalette.length)
+ gColorPalette = getColorPalette(currentPalette);
+
let iWidth = getAdjustPref("image.width");
let iHeight = getAdjustPref("image.height");
}
}
-function exitMandelbrot() {
- var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo);
- if (appInfo.ID == "mandelbrot@kairo.at")
- quitApp(false);
- else
- window.close();
-}
-
function updateBookmarkMenu(aParent) {
document.getElementById("bookmarkSave").disabled =
- (!document.getElementById("drawButton").hidden || (gStartTime > 0));
+ (!document.getElementById("drawButton").hidden || (gStartTime > 0));
+
+ document.getElementById("bookmarkBack").disabled = !gLastImageData;
while (aParent.hasChildNodes() &&
aParent.lastChild.id != "bookmarkSeparator")
na.setAttribute("disabled", "true");
}
+function goBack () {
+ if (gLastImageData) {
+ Services.prefs.setIntPref("mandelbrot.iteration_max",
+ gLastImageData.iterMax);
+ // use gLastImageData.iWidth, gLastImageData.iHeight ???
+ adjustCoordsAndDraw(gLastImageData.C_min, gLastImageData.C_max);
+ gLastImageData = undefined;
+ }
+}
+
function callBookmark(evtarget) {
if (evtarget.id == "bookmarkSave" || evtarget.id == "bookmarkSeparator")
return;
<toolbar class="chromeclass-toolbar"
id="mandelbrotToolbar"
align="center">
- <toolbarbutton id="fileDraw" label="&toolbarDraw.label;" oncommand="drawImage();"/>
- <toolbarbutton id="fileSave" label="&toolbarSave.label;" oncommand="saveImage();"/>
+ <toolbarbutton id="fileDraw"
+ label="&toolbarDraw.label;"
+ oncommand="drawImage();"/>
+ <toolbarbutton id="fileSave"
+ label="&toolbarSave.label;"
+ oncommand="saveImage();"/>
<toolbarbutton id="bookmarkMenu"
type="menu"
class="tabbable"
<menupopup id="menu_bookmarkPopup"
onpopupshowing="updateBookmarkMenu(event.target);"
oncommand="callBookmark(event.target);">
- <menuitem id="bookmarkOverview" label="&bookmarkOverview.label;"/>
- <menuitem id="bookmarkSave" label="&bookmarkSave.label;" oncommand="saveBookmark();"/>
+ <menuitem id="bookmarkBack"
+ label="&bookmarkBack.label;"
+ disabled="true"
+ oncommand="goBack();"/>
+ <menuitem id="bookmarkOverview"
+ label="&bookmarkOverview.label;"/>
+ <menuitem id="bookmarkSave"
+ label="&bookmarkSave.label;"
+ oncommand="saveBookmark();"/>
<menuseparator id="bookmarkSeparator"/>
</menupopup>
</toolbarbutton>
- <toolbarbutton id="imgSettings" label="&imgSettings.label;" oncommand="imgSettings();"/>
+ <toolbarbutton id="imgSettings"
+ label="&imgSettings.label;"
+ oncommand="imgSettings();"/>
</toolbar>
</toolbox>
<panel id="imgSettingsPanel"
<!ENTITY toolbarSave.label "Save…">
<!ENTITY bookmarkMenu.label "Locations">
+<!ENTITY bookmarkBack.label "Back">
<!ENTITY bookmarkOverview.label "Overview">
<!ENTITY bookmarkSave.label "Add Bookmark…">
*
* ***** END LICENSE BLOCK ***** */
-pref("toolkit.defaultChromeURI", "chrome://mandelbrot/content/mandelbrot.xul");
-
/* default prefs */
-// use TraceMonkey by default for getting fast calculations
-pref("javascript.options.jit.chrome", true);
-// instantly apply prefs to make sure the image settings dialog works
-pref("browser.preferences.instantApply", true);
// sync image proportions in the dialog by default
pref("mandelbrot.syncProportions", true);
-
-/* debugging prefs */
-pref("browser.dom.window.dump.enabled", true);
-pref("javascript.options.showInConsole", true);
-pref("javascript.options.strict", true);
-pref("nglayout.debug.disable_xul_cache", true);
-pref("nglayout.debug.disable_xul_fastload", true);
background-color: #69645c;
color: white;
}
+
+panel > titlebar {
+ background-color: rgb(94,97,102);
+ color: white;
+}