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

Method nextEditorLocation

app/src/processing/app/Base.java:679–709  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

677 }
678
679 protected int[] nextEditorLocation() {
680 if (activeEditor == null) {
681 // If no current active editor, use default placement
682 return defaultEditorLocation();
683 }
684
685 Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
686
687 // With a currently active editor, open the new window
688 // using the same dimensions, but offset slightly.
689 synchronized (editors) {
690 int[] location = activeEditor.getPlacement();
691
692 // Just in case the bounds for that window are bad
693 final int OVER = 50;
694 location[0] += OVER;
695 location[1] += OVER;
696
697 if (location[0] == OVER || location[2] == OVER
698 || location[0] + location[2] > screen.width
699 || location[1] + location[3] > screen.height) {
700 // Warp the next window to a randomish location on screen.
701 int[] l = defaultEditorLocation();
702 l[0] *= Math.random() * 2;
703 l[1] *= Math.random() * 2;
704 return l;
705 }
706
707 return location;
708 }
709 }
710
711
712 // .................................................................

Callers 2

restoreSketchesMethod · 0.95
handleOpenMethod · 0.95

Calls 2

defaultEditorLocationMethod · 0.95
getPlacementMethod · 0.45

Tested by

no test coverage detected