remove any global prefs the add-on sets, remove another obsolete function, fix missin...
authorRobert Kaiser <kairo@kairo.at>
Sun, 30 Oct 2011 15:07:51 +0000 (16:07 +0100)
committerRobert Kaiser <kairo@kairo.at>
Sun, 30 Oct 2011 15:09:13 +0000 (16:09 +0100)
Makefile.in
content/mandelbrot.js
content/mandelbrot.xul
locales/en-US/mandelbrot.dtd
prefs.js
skin/classic/mobileUI.css

index d7428b5b060ad98e7f7e7a16df06ab816d9da0b4..a44d02ec0300f444065c00f6051fc850aeb7067f 100644 (file)
@@ -49,7 +49,7 @@ endif
 
 MODULE                 = mandelbrot
 
-EXTENSION_VERSION      = 4.0b3
+EXTENSION_VERSION      = 4.0
 
 XPI_NAME               = mandelbrot
 USE_EXTENSION_MANIFEST = 1
index c1f3e5461d33a834be720e733ca6fca82032dd25..7d77b1236609b83625fdb1d407e1f46cf884d988 100644 (file)
@@ -43,6 +43,7 @@ var gColorPalette = [];
 var gStartTime = 0;
 var gMbrotBundle;
 var gCurrentImageData;
+var gLastImageData;
 
 function Startup() {
   gMbrotBundle = document.getElementById("mbrotBundle");
@@ -193,6 +194,10 @@ function drawImage() {
 
   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;
@@ -204,6 +209,10 @@ function drawImage() {
   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");
 
@@ -538,18 +547,11 @@ function saveImage() {
   }
 }
 
-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")
@@ -586,6 +588,16 @@ function updateBookmarkMenu(aParent) {
   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;
index 109d86eb6a756d1b4c33e73a946e54d9c23efc85..720f9db60ba53531fdd8e7396c827b0a68c898f0 100644 (file)
     <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"
index c763088d4335db0378e444004436d976dac4b621..1b2af65c3ca672a0510463236de8145f4a89724f 100644 (file)
@@ -41,6 +41,7 @@
 <!ENTITY toolbarSave.label     "Save…">
 
 <!ENTITY bookmarkMenu.label    "Locations">
+<!ENTITY bookmarkBack.label    "Back">
 <!ENTITY bookmarkOverview.label "Overview">
 <!ENTITY bookmarkSave.label    "Add Bookmark…">
 
index 2fbe1fe2349b7eb60edcc63e7d383ab5cc192965..fc5853eb750cff8c51173d2291ff395463a327ec 100644 (file)
--- a/prefs.js
+++ b/prefs.js
  *
  * ***** 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);
index d72ac7136bf75f916839e4e5b7e24f81cd1b3f05..a0439539477074bc6e4f676912f8752a0f0a3c66 100644 (file)
@@ -119,3 +119,8 @@ panel {
   background-color: #69645c;
   color: white;
 }
+
+panel > titlebar {
+  background-color: rgb(94,97,102);
+  color: white;
+}