From 60e048b29facde0026b5fac74fdf88f60d2e12cd Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Sun, 16 Jan 2011 17:29:06 +0100 Subject: [PATCH] convert image settings to a panel in windowed version as well and kill separate files for image-settings --- jar.mn | 4 - .../mandelbrot/content/image-settings.js | 144 ------------------ .../mandelbrot/content/image-settings.xul | 144 ------------------ .../mandelbrot/content/mandelbrot-tab.xul | 13 +- .../chrome/mandelbrot/content/mandelbrot.js | 14 +- .../chrome/mandelbrot/content/mandelbrot.xul | 77 +++++++++- .../locales/en-US/image-settings.dtd | 57 ------- .../mandelbrot/locales/en-US/mandelbrot.dtd | 22 +++ .../skin/classic/image-settings.css | 37 ----- 9 files changed, 111 insertions(+), 401 deletions(-) delete mode 100644 xulapp/chrome/mandelbrot/content/image-settings.js delete mode 100644 xulapp/chrome/mandelbrot/content/image-settings.xul delete mode 100644 xulapp/chrome/mandelbrot/locales/en-US/image-settings.dtd delete mode 100644 xulapp/chrome/mandelbrot/skin/classic/image-settings.css diff --git a/jar.mn b/jar.mn index 472bd94..69628f4 100644 --- a/jar.mn +++ b/jar.mn @@ -15,8 +15,6 @@ mandelbrot.jar: content/mandelbrot/mandelbrot.js (xulapp/chrome/mandelbrot/content/mandelbrot.js) content/mandelbrot/mandelbrot.xul (xulapp/chrome/mandelbrot/content/mandelbrot.xul) content/mandelbrot/mandelbrot-tab.xul (xulapp/chrome/mandelbrot/content/mandelbrot-tab.xul) - content/mandelbrot/image-settings.js (xulapp/chrome/mandelbrot/content/image-settings.js) - content/mandelbrot/image-settings.xul (xulapp/chrome/mandelbrot/content/image-settings.xul) content/mandelbrot/fxOverlay.xul (extension/fxOverlay.xul) content/mandelbrot/mobileOverlay.xul (extension/mobileOverlay.xul) content/mandelbrot/smOverlay.xul (extension/smOverlay.xul) @@ -24,8 +22,6 @@ mandelbrot.jar: skin/classic/mandelbrot/mandelbrotIcon16.png (xulapp/chrome/mandelbrot/skin/classic/mandelbrotIcon16.png) skin/classic/mandelbrot/mandelbrotIcon32.png (xulapp/chrome/mandelbrot/skin/classic/mandelbrotIcon32.png) skin/classic/mandelbrot/mobileUI.css (xulapp/chrome/mandelbrot/skin/classic/mobileUI.css) - skin/classic/mandelbrot/image-settings.css (xulapp/chrome/mandelbrot/skin/classic/image-settings.css) locale/@AB_CD@/mandelbrot/mandelbrot.dtd (xulapp/chrome/mandelbrot/locales/@AB_CD@/mandelbrot.dtd) locale/@AB_CD@/mandelbrot/mandelbrot.properties (xulapp/chrome/mandelbrot/locales/@AB_CD@/mandelbrot.properties) locale/@AB_CD@/mandelbrot/mandelbrot-overlay.dtd (xulapp/chrome/mandelbrot/locales/@AB_CD@/mandelbrot-overlay.dtd) - locale/@AB_CD@/mandelbrot/image-settings.dtd (xulapp/chrome/mandelbrot/locales/@AB_CD@/image-settings.dtd) diff --git a/xulapp/chrome/mandelbrot/content/image-settings.js b/xulapp/chrome/mandelbrot/content/image-settings.js deleted file mode 100644 index a025bde..0000000 --- a/xulapp/chrome/mandelbrot/content/image-settings.js +++ /dev/null @@ -1,144 +0,0 @@ -/* ***** 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 KaiRo.at Mandelbrot, XULRunner version. - * - * The Initial Developer of the Original Code is - * Robert Kaiser . - * Portions created by the Initial Developer are Copyright (C) 2008 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Robert Kaiser - * - * 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 ***** */ - -var gColorPalette = []; - -function initSettings() { - recalcCoord('Cr', 'scale'); - recalcCoord('Ci', 'scale'); - if (!window.opener) - window.getButton('extra1').disabled = true; -} - -function drawPreview() { - let canvas = document.getElementById("mbrotPreview"); - let context = canvas.getContext("2d"); - - if (document.getElementById("imgWidth").value / - document.getElementById("imgHeight").value - < 80 / 50) { - canvas.height = 50; - canvas.width = canvas.height * - document.getElementById("imgWidth").value / - document.getElementById("imgHeight").value; - } - else { - canvas.width = 80; - canvas.height = canvas.width * - document.getElementById("imgHeight").value / - document.getElementById("imgWidth").value; - } - - let Cr_min = parseFloat(document.getElementById("Cr_min").value); - let Cr_max = parseFloat(document.getElementById("Cr_max").value); - if ((Cr_min < -2) || (Cr_min > 2) || - (Cr_max < -2) || (Cr_max > 2) || (Cr_min >= Cr_max)) { - Cr_min = -2.0; Cr_max = 1.0; - } - - let Ci_min = parseFloat(document.getElementById("Ci_min").value); - let Ci_max = parseFloat(document.getElementById("Ci_max").value); - if ((Ci_min < -2) || (Ci_min > 2) || - (Ci_max < -2) || (Ci_max > 2) || (Ci_min >= Ci_max)) { - Ci_min = -2.0; Ci_max = 1.0; - } - - let iterMax = gPref.getIntPref("mandelbrot.iteration_max"); - let algorithm = gPref.getCharPref("mandelbrot.use_algorithm"); - - context.fillStyle = "rgba(255, 255, 255, 127)"; - context.fillRect(0, 0, canvas.width, canvas.height); - - try { - var currentPalette = gPref.getCharPref("mandelbrot.color_palette"); - } - catch(e) { - var currentPalette = ''; - } - if (!currentPalette.length) { - currentPalette = 'kairo'; - } - gColorPalette = getColorPalette(currentPalette); - - drawLine(0, [Cr_min, Cr_max, Ci_min, Ci_max], - canvas, context, iterMax, algorithm); -} - -function recalcCoord(coord, target) { - let othercoord = (coord == 'Ci') ? 'Cr' : 'Ci'; - let owndim = (coord == 'Ci') ? 'height' : 'width'; - let otherdim = (coord == 'Ci') ? 'width' : 'height'; - if (target == 'scale') { - var myscale = - parseFloat(document.getElementById(coord + '_max').value) - - parseFloat(document.getElementById(coord + '_min').value); - document.getElementById(coord + '_scale').value = roundCoord(myscale); - } - else if (target == 'max') { - let mymax = - parseFloat(document.getElementById(coord + '_min').value) + - parseFloat(document.getElementById(coord + '_scale').value); - document.getElementById('mandelbrot.last_image.' + coord + '_max').value = roundCoord(mymax); - var myscale = document.getElementById(coord + '_scale').value; - } - if (document.getElementById('syncProp').checked) { - let otherscale = myscale * - document.getElementById('mandelbrot.image.' + otherdim).value / - document.getElementById('mandelbrot.image.' + owndim).value; - document.getElementById(othercoord + '_scale').value = roundCoord(otherscale); - let othermax = - parseFloat(document.getElementById(othercoord + '_min').value) + - parseFloat(document.getElementById(othercoord + '_scale').value); - document.getElementById('mandelbrot.last_image.' + othercoord + '_max').value = roundCoord(othermax); - } -} - -function checkProportions() { - if (!document.getElementById('syncProp').checked) { - recalcCoord('Cr', 'scale'); - } -} - -function roundCoord(floatval) { - // We should round to 10 decimals here or so - return floatval; -} - -function callDrawImage() { - window.opener.drawImage(); - window.close(); -} \ No newline at end of file diff --git a/xulapp/chrome/mandelbrot/content/image-settings.xul b/xulapp/chrome/mandelbrot/content/image-settings.xul deleted file mode 100644 index 605aac2..0000000 --- a/xulapp/chrome/mandelbrot/content/image-settings.xul +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - -