FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

remove the extra placeWindow() method and just use one · hayscoding/processing@4efaab2 · GitHub

Repository navigation

Commit 4efaab2

Browse files
committed
remove the extra placeWindow() method and just use one
1 parent b450fe2 commit 4efaab2

5 files changed

Lines changed: 70 additions & 5 deletions

File tree

‎core/src/processing/core/PSurface.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void initFrame(PApplet sketch, int backgroundColor,
6868

6969
//
7070

71-
public void placeWindow(int[] location);
71+
// public void placeWindow(int[] location);
7272

7373
public void placeWindow(int[] location, int[] editorLocation);
7474

‎core/src/processing/core/PSurfaceAWT.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ public void mousePressed(java.awt.event.MouseEvent e) {
596596
}
597597

598598

599+
/*
599600
@Override
600601
public void placeWindow(int[] location) {
601602
setFrameSize(); //sketchWidth, sketchHeight);
@@ -639,6 +640,7 @@ public void windowClosing(WindowEvent e) {
639640
frame.setVisible(true);
640641
}
641642
}
643+
*/
642644

643645

644646
private void setCanvasSize() {

‎core/src/processing/core/PSurfaceFX.java‎

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ public void start(final Stage stage) {
256256
*/
257257

258258

259+
/*
259260
@Override
260261
public void placeWindow(int[] location) {
261262
//setFrameSize();
@@ -296,11 +297,68 @@ public void placeWindow(int[] location) {
296297
setVisible(true);
297298
}
298299
}
300+
*/
299301

300302

303+
@Override
301304
public void placeWindow(int[] location, int[] editorLocation) {
302-
// TODO Auto-generated method stub
305+
//Dimension window = setFrameSize();
306+
307+
// int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH);
308+
// int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT);
309+
310+
if (location != null) {
311+
// a specific location was received from the Runner
312+
// (applet has been run more than once, user placed window)
313+
stage.setX(location[0]);
314+
stage.setY(location[1]);
303315

316+
} else if (editorLocation != null) {
317+
int locationX = editorLocation[0] - 20;
318+
int locationY = editorLocation[1];
319+
320+
if (locationX - stage.getWidth() > 10) {
321+
// if it fits to the left of the window
322+
stage.setX(locationX - stage.getWidth());
323+
stage.setY(locationY);
324+
325+
} else { // doesn't fit
326+
// if it fits inside the editor window,
327+
// offset slightly from upper lefthand corner
328+
// so that it's plunked inside the text area
329+
locationX = editorLocation[0] + 66;
330+
locationY = editorLocation[1] + 66;
331+
332+
if ((locationX + stage.getWidth() > sketch.displayWidth - 33) ||
333+
(locationY + stage.getHeight() > sketch.displayHeight - 33)) {
334+
// otherwise center on screen
335+
locationX = (int) ((sketch.displayWidth - stage.getWidth()) / 2);
336+
locationY = (int) ((sketch.displayHeight - stage.getHeight()) / 2);
337+
}
338+
stage.setX(locationX);
339+
stage.setY(locationY);
340+
}
341+
} else { // just center on screen
342+
//setFrameCentered();
343+
}
344+
if (stage.getY() < 0) {
345+
// Windows actually allows you to place frames where they can't be
346+
// closed. Awesome. http://dev.processing.org/bugs/show_bug.cgi?id=1508
347+
//frame.setLocation(frameLoc.x, 30);
348+
stage.setY(30);
349+
}
350+
351+
//canvas.setBounds((contentW - sketchWidth)/2,
352+
// (contentH - sketchHeight)/2,
353+
// sketchWidth, sketchHeight);
354+
355+
// handle frame resizing events
356+
//setupFrameResizeListener();
357+
358+
// TODO this is much too late... why even create the enormous frame for PDF?
359+
if (sketch.getGraphics().displayable()) {
360+
setVisible(true);
361+
}
304362
}
305363

306364

‎core/src/processing/core/PSurfaceNone.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,17 @@ public void setResizable(boolean resizable) {
8080
}
8181

8282

83-
public void placeWindow(int[] location) { }
83+
// public void placeWindow(int[] location) { }
8484

85+
@Override
8586
public void placeWindow(int[] location, int[] editorLocation) { }
8687

88+
89+
@Override
8790
public void placePresent(int stopColor) { }
8891

92+
93+
@Override
8994
public void setupExternalMessages() { }
9095

9196

‎core/src/processing/opengl/PSurfaceLWJGL.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,9 @@ public void setResizable(boolean resizable) {
307307
}
308308

309309

310+
/*
310311
@Override
311312
public void placeWindow(int[] location) {
312-
/*
313313
if (location != null) {
314314
// a specific location was received from the Runner
315315
// (applet has been run more than once, user placed window)
@@ -325,8 +325,8 @@ public void placeWindow(int[] location) {
325325
// closed. Awesome. http://dev.processing.org/bugs/show_bug.cgi?id=1508
326326
Display.setLocation(Display.getX(), 30);
327327
}
328-
*/
329328
}
329+
*/
330330

331331

332332
@Override

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL