X-Git-Url: https://git-public.kairo.at/?p=mandelbrot.git;a=blobdiff_plain;f=xulapp%2Fchrome%2Fmandelbrot%2Fcontent%2Fmandelbrot.js;h=28b443c1d50c1dd581a148eb4ddd6833c02e651f;hp=d887b82e71f0d9dcd620d449d34ff28fdad48f31;hb=fa4ecb249ee06df34c4604172d81084f4111e766;hpb=9c2ca9fa0da990b69c278ae100ccd8dfb631f4eb;ds=sidebyside diff --git a/xulapp/chrome/mandelbrot/content/mandelbrot.js b/xulapp/chrome/mandelbrot/content/mandelbrot.js index d887b82..28b443c 100644 --- a/xulapp/chrome/mandelbrot/content/mandelbrot.js +++ b/xulapp/chrome/mandelbrot/content/mandelbrot.js @@ -40,12 +40,13 @@ var gPref = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService) .getBranch(null); var gStartTime = 0; +var gMbrotBundle; function Startup() { updateIterMenu(); updatePaletteMenu(); - document.getElementById("statusLabel").value = - document.getElementById("mbrotBundle").getString("statusEmpty"); + gMbrotBundle = document.getElementById("mbrotBundle"); + document.getElementById("statusLabel").value = gMbrotBundle.getString("statusEmpty"); } function drawImage() { @@ -54,8 +55,7 @@ function drawImage() { document.getElementById("drawButton").hidden = true; - document.getElementById("statusLabel").value = - document.getElementById("mbrotBundle").getString("statusDrawing"); + document.getElementById("statusLabel").value = gMbrotBundle.getString("statusDrawing"); let Cr_min = -2.0; let Cr_max = 1.0; @@ -147,7 +147,7 @@ function EndCalc() { let endTime = new Date(); let timeUsed = (endTime.getTime() - gStartTime.getTime()) / 1000; document.getElementById("statusLabel").value = - document.getElementById("mbrotBundle").getFormattedString("statusTime", [timeUsed.toFixed(3)]); + gMbrotBundle.getFormattedString("statusTime", [timeUsed.toFixed(3)]); gStartTime = 0; } @@ -351,7 +351,8 @@ function mouseevent(etype, event) { if (event.button == 0) { var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); - var ok = prompts.confirm(null, "XXX Zoom in", + var ok = prompts.confirm(null, gMbrotBundle.getString("zoomConfirmTitle"), + gMbrotBundle.getString("zoomConfirmLabel") + ' --- ' + zoomstart.x + ',' + zoomstart.y + '-' + (event.clientX - canvas.offsetLeft) + ',' + (event.clientY - canvas.offsetTop)); @@ -363,7 +364,6 @@ function mouseevent(etype, event) { } function saveImage() { - const bundle = document.getElementById("mbrotBundle"); const nsIFilePicker = Components.interfaces.nsIFilePicker; var fp = null; try { @@ -371,9 +371,9 @@ function saveImage() { .createInstance(nsIFilePicker); } catch (e) {} if (!fp) return; - var promptString = bundle.getString("savePrompt"); + var promptString = gMbrotBundle.getString("savePrompt"); fp.init(window, promptString, nsIFilePicker.modeSave); - fp.appendFilter(bundle.getString("pngFilterName"), "*.png"); + fp.appendFilter(gMbrotBundle.getString("pngFilterName"), "*.png"); fp.defaultString = "mandelbrot.png"; var fpResult = fp.show(); @@ -415,8 +415,7 @@ function updateBookmarkMenu(aParent) { } // Create the "Nothing Available" Menu item and disable it. var na = aParent.appendChild(document.createElement("menuitem")); - na.setAttribute("label", - document.getElementById("mbrotBundle").getString("noBookmarks")); + na.setAttribute("label", gMbrotBundle.getString("noBookmarks")); na.setAttribute("disabled", "true"); } @@ -425,11 +424,10 @@ function callBookmark(evtarget) { function saveBookmark() { // retrieve wanted bookmark name with a prompt - var mbrotBundle = document.getElementById("mbrotBundle"); var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService); var input = {value: ""}; // empty default value - var ok = prompts.prompt(null, "XXX Title", "XXX Please enter a name for the bookmark", input, null, {}); + var ok = prompts.prompt(null, gMbrotBundle.getString("saveBookmarkTitle"), gMbrotBundle.getString("saveBookmarkLabel"), input, null, {}); // ok is true if OK is pressed, false if Cancel. input.value holds the value of the edit field if "OK" was pressed. if (!ok || !input.value) return