adjustCoordsAndDraw(new complex(0,0), new complex(0,0));
return;
}
- alert(evtarget.getAttribute('label') + ', ' + evtarget.getAttribute('bmRowID'));
- //gPref.setIntPref("mandelbrot.iteration_max", iterMax);
+
+ if (evtarget.getAttribute('bmRowID')) {
+ let iterMax = 0;
+ let C_min = null;
+ let C_max = null;
+
+ let file = Components.classes["@mozilla.org/file/directory_service;1"]
+ .getService(Components.interfaces.nsIProperties)
+ .get("ProfD", Components.interfaces.nsIFile);
+ file.append("mandelbookmarks.sqlite");
+ let connection = Components.classes["@mozilla.org/storage/service;1"]
+ .getService(Components.interfaces.mozIStorageService)
+ .openDatabase(file);
+ let statement = connection.createStatement(
+ "SELECT iteration_max,Cr_min,Cr_max,Ci_min,Ci_max FROM bookmarks WHERE ROWID=?1");
+ statement.bindStringParameter(0, evtarget.getAttribute('bmRowID'));
+ while (statement.executeStep()) {
+ iterMax = statement.getInt32(0);
+ C_min = new complex(statement.getDouble(1), statement.getDouble(3));
+ C_max = new complex(statement.getDouble(2), statement.getDouble(4));
+ }
+ statement.finalize();
+ connection.close();
+
+ if (iterMax && C_min && C_max) {
+ gPref.setIntPref("mandelbrot.iteration_max", iterMax);
+ adjustCoordsAndDraw(C_min, C_max);
+ }
+ }
}
function saveBookmark() {