MCPcopy
hub / github.com/arduino/Arduino / retrieveSketchLocation

Method retrieveSketchLocation

app/src/processing/app/Base.java:605–628  ·  view source on GitHub ↗
(String index)

Source from the content-addressed store, hash-verified

603 }
604
605 private int[] retrieveSketchLocation(String index) {
606 if (PreferencesData.get("last.screen.height") == null)
607 return defaultEditorLocation();
608
609 // if screen size has changed, the window coordinates no longer
610 // make sense, so don't use them unless they're identical
611 Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
612 int screenW = PreferencesData.getInteger("last.screen.width");
613 int screenH = PreferencesData.getInteger("last.screen.height");
614
615 if ((screen.width != screenW) || (screen.height != screenH))
616 return defaultEditorLocation();
617
618 String locationStr = PreferencesData
619 .get("last.sketch" + index + ".location");
620 if (locationStr == null)
621 return defaultEditorLocation();
622
623 int location[] = PApplet.parseInt(PApplet.split(locationStr, ','));
624 if (location[0] > screen.width || location[1] > screen.height)
625 return defaultEditorLocation();
626
627 return location;
628 }
629
630 protected void storeRecentSketches(SketchController sketch) {
631 if (sketch.isUntitled()) {

Callers 2

BaseMethod · 0.95
restoreSketchesMethod · 0.95

Calls 5

getMethod · 0.95
defaultEditorLocationMethod · 0.95
getIntegerMethod · 0.95
parseIntMethod · 0.95
splitMethod · 0.95

Tested by

no test coverage detected