start an 'image settings' prefwindow-based dialog for settings several options on...
[mandelbrot.git] / xulapp / chrome / mandelbrot / content / mandelbrot.js
index e3c36ae00e8278d53e33b4645f6f7c1b45ce176c..7762362591c4664798a8f9344df9865b91d59fae 100644 (file)
@@ -69,10 +69,20 @@ function drawImage() {
 function drawLine(line, canvas, context, iterMax, algorithm) {
     let Cr_min = -2.0;
     let Cr_max = 1.0;
+    try {
+      Cr_min = gPref.getCharPref("mandelbrot.last_image.Cr_min");
+      Cr_max = gPref.getCharPref("mandelbrot.last_image.Cr_max");
+    }
+    catch (e) { }
     let Cr_scale = Cr_max - Cr_min;
 
     let Ci_min = -1.5;
     let Ci_max = 1.5;
+    try {
+      Cr_min = gPref.getCharPref("mandelbrot.last_image.Ci_min");
+      Cr_max = gPref.getCharPref("mandelbrot.last_image.Ci_max");
+    }
+    catch (e) { }
     let Ci_scale = Ci_max - Ci_min;
 
     let pixels = [];
@@ -363,6 +373,10 @@ function setPalette(aPaletteID) {
   gColorPalette = getColorPalette(aPaletteID);
 }
 
+function imgSettings() {
+  window.openDialog("chrome://mandelbrot/content/image-settings.xul");
+}
+
 function updateDebugMenu() {
   var jitMenuItem = document.getElementById("jitEnabled");
   jitMenuItem.setAttribute("checked", gPref.getBoolPref("javascript.options.jit.chrome"));
@@ -403,7 +417,6 @@ function setAlgorithm(algoID) {
   gPref.setCharPref("mandelbrot.use_algorithm", algoID);
 }
 
-
 /***** helper functions from external sources *****/
 
 // function below is based on http://developer.mozilla.org/en/docs/Code_snippets:Canvas