projects
/
mandelbrot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9c2ca9f
)
use a global var for the bundle, make prompts use correct strings from that bundle...
author
Robert Kaiser
<kairo@kairo.at>
Thu, 30 Jul 2009 10:27:31 +0000
(12:27 +0200)
committer
Robert Kaiser
<kairo@kairo.at>
Thu, 30 Jul 2009 10:27:31 +0000
(12:27 +0200)
xulapp/chrome/mandelbrot/content/mandelbrot.js
patch
|
blob
|
blame
|
history
xulapp/chrome/mandelbrot/content/mandelbrot.xul
patch
|
blob
|
blame
|
history
xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.dtd
patch
|
blob
|
blame
|
history
xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.properties
patch
|
blob
|
blame
|
history
diff --git
a/xulapp/chrome/mandelbrot/content/mandelbrot.js
b/xulapp/chrome/mandelbrot/content/mandelbrot.js
index d887b82e71f0d9dcd620d449d34ff28fdad48f31..28b443c1d50c1dd581a148eb4ddd6833c02e651f 100644
(file)
--- 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;
.getService(Components.interfaces.nsIPrefService)
.getBranch(null);
var gStartTime = 0;
+var gMbrotBundle;
function Startup() {
updateIterMenu();
updatePaletteMenu();
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() {
}
function drawImage() {
@@
-54,8
+55,7
@@
function drawImage() {
document.getElementById("drawButton").hidden = true;
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;
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 =
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;
}
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);
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));
zoomstart.x + ',' + zoomstart.y + '-' +
(event.clientX - canvas.offsetLeft) + ',' +
(event.clientY - canvas.offsetTop));
@@
-363,7
+364,6
@@
function mouseevent(etype, event) {
}
function saveImage() {
}
function saveImage() {
- const bundle = document.getElementById("mbrotBundle");
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = null;
try {
const nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = null;
try {
@@
-371,9
+371,9
@@
function saveImage() {
.createInstance(nsIFilePicker);
} catch (e) {}
if (!fp) return;
.createInstance(nsIFilePicker);
} catch (e) {}
if (!fp) return;
- var promptString =
b
undle.getString("savePrompt");
+ var promptString =
gMbrotB
undle.getString("savePrompt");
fp.init(window, promptString, nsIFilePicker.modeSave);
fp.init(window, promptString, nsIFilePicker.modeSave);
- fp.appendFilter(
b
undle.getString("pngFilterName"), "*.png");
+ fp.appendFilter(
gMbrotB
undle.getString("pngFilterName"), "*.png");
fp.defaultString = "mandelbrot.png";
var fpResult = fp.show();
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"));
}
// 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");
}
na.setAttribute("disabled", "true");
}
@@
-425,11
+424,10
@@
function callBookmark(evtarget) {
function saveBookmark() {
// retrieve wanted bookmark name with a prompt
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 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
// 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
diff --git
a/xulapp/chrome/mandelbrot/content/mandelbrot.xul
b/xulapp/chrome/mandelbrot/content/mandelbrot.xul
index 18b65b0be9408ec389f4591d588197d00d482a3f..9f7c25863dfade2f3b5aa3fd1f67586ffe78a334 100644
(file)
--- a/
xulapp/chrome/mandelbrot/content/mandelbrot.xul
+++ b/
xulapp/chrome/mandelbrot/content/mandelbrot.xul
@@
-74,6
+74,7
@@
<menupopup id="menu_bookmarkPopup"
onpopupshowing="updateBookmarkMenu(event.target);"
oncommand="callBookmark(event.target);">
<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();"/>
<menuseparator id="bookmarkSeparator"/>
</menupopup>
<menuitem id="bookmarkSave" label="&bookmarkSave.label;" oncommand="saveBookmark();"/>
<menuseparator id="bookmarkSeparator"/>
</menupopup>
diff --git
a/xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.dtd
b/xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.dtd
index a8ef6b1fbf69ff175374134ee62d3c7a0909dedf..738b7fb224fa4e336e87af5de1a12460f54afd79 100644
(file)
--- a/
xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.dtd
+++ b/
xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.dtd
@@
-42,7
+42,8
@@
<!ENTITY fileSave.label "Save Image…">
<!ENTITY fileQuit.label "Quit">
<!ENTITY fileSave.label "Save Image…">
<!ENTITY fileQuit.label "Quit">
-<!ENTITY bookmarkMenu.label "Bookmarks">
+<!ENTITY bookmarkMenu.label "Locations">
+<!ENTITY bookmarkOverview.label "Overview">
<!ENTITY bookmarkSave.label "Save Bookmark…">
<!ENTITY prefMenu.label "Settings">
<!ENTITY bookmarkSave.label "Save Bookmark…">
<!ENTITY prefMenu.label "Settings">
diff --git
a/xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.properties
b/xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.properties
index f604a1e49cc9b70ab5ceed85631f4b73e2821a14..d5f2d39f0301c66d81acb50d16516c7c9a372005 100644
(file)
--- a/
xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.properties
+++ b/
xulapp/chrome/mandelbrot/locales/en-US/mandelbrot.properties
@@
-41,3
+41,7
@@
statusTime=Time: %S seconds
savePrompt=Save Image As…
pngFilterName=PNG Files
noBookmarks=[No bookmarks found]
savePrompt=Save Image As…
pngFilterName=PNG Files
noBookmarks=[No bookmarks found]
+saveBookmarkTitle=Bookmark This Location
+saveBookmarkLabel=Please enter a name for bookmarking the current location
+zoomConfirmTitle=Confirm zooming
+zoomConfirmLabel=Zoom in on the area you dragged your mouse over?