| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,7 +68,7 @@ public void initFrame(PApplet sketch, int backgroundColor, | |||
| 68 | 68 | ||
| 69 | 69 | // | |
| 70 | 70 | ||
| 71 | - public void placeWindow(int[] location); | ||
| 71 | + // public void placeWindow(int[] location); | ||
| 72 | 72 | ||
| 73 | 73 | public void placeWindow(int[] location, int[] editorLocation); | |
| 74 | 74 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -596,6 +596,7 @@ public void mousePressed(java.awt.event.MouseEvent e) { | |||
| 596 | 596 | } | |
| 597 | 597 | ||
| 598 | 598 | ||
| 599 | + /* | ||
| 599 | 600 | @Override | |
| 600 | 601 | public void placeWindow(int[] location) { | |
| 601 | 602 | setFrameSize(); //sketchWidth, sketchHeight); | |
@@ -639,6 +640,7 @@ public void windowClosing(WindowEvent e) { | |||
| 639 | 640 | frame.setVisible(true); | |
| 640 | 641 | } | |
| 641 | 642 | } | |
| 643 | + */ | ||
| 642 | 644 | ||
| 643 | 645 | ||
| 644 | 646 | private void setCanvasSize() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -256,6 +256,7 @@ public void start(final Stage stage) { | |||
| 256 | 256 | */ | |
| 257 | 257 | ||
| 258 | 258 | ||
| 259 | + /* | ||
| 259 | 260 | @Override | |
| 260 | 261 | public void placeWindow(int[] location) { | |
| 261 | 262 | //setFrameSize(); | |
@@ -296,11 +297,68 @@ public void placeWindow(int[] location) { | |||
| 296 | 297 | setVisible(true); | |
| 297 | 298 | } | |
| 298 | 299 | } | |
| 300 | + */ | ||
| 299 | 301 | ||
| 300 | 302 | ||
| 303 | + @Override | ||
| 301 | 304 | 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]); | ||
| 303 | 315 | ||
| 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 | + } | ||
| 304 | 362 | } | |
| 305 | 363 | ||
| 306 | 364 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,12 +80,17 @@ public void setResizable(boolean resizable) { | |||
| 80 | 80 | } | |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | - public void placeWindow(int[] location) { } | ||
| 83 | + // public void placeWindow(int[] location) { } | ||
| 84 | 84 | ||
| 85 | + @Override | ||
| 85 | 86 | public void placeWindow(int[] location, int[] editorLocation) { } | |
| 86 | 87 | ||
| 88 | + | ||
| 89 | + @Override | ||
| 87 | 90 | public void placePresent(int stopColor) { } | |
| 88 | 91 | ||
| 92 | + | ||
| 93 | + @Override | ||
| 89 | 94 | public void setupExternalMessages() { } | |
| 90 | 95 | ||
| 91 | 96 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -307,9 +307,9 @@ public void setResizable(boolean resizable) { | |||
| 307 | 307 | } | |
| 308 | 308 | ||
| 309 | 309 | ||
| 310 | + /* | ||
| 310 | 311 | @Override | |
| 311 | 312 | public void placeWindow(int[] location) { | |
| 312 | - /* | ||
| 313 | 313 | if (location != null) { | |
| 314 | 314 | // a specific location was received from the Runner | |
| 315 | 315 | // (applet has been run more than once, user placed window) | |
@@ -325,8 +325,8 @@ public void placeWindow(int[] location) { | |||
| 325 | 325 | // closed. Awesome. http://dev.processing.org/bugs/show_bug.cgi?id=1508 | |
| 326 | 326 | Display.setLocation(Display.getX(), 30); | |
| 327 | 327 | } | |
| 328 | - */ | ||
| 329 | 328 | } | |
| 329 | + */ | ||
| 330 | 330 | ||
| 331 | 331 | ||
| 332 | 332 | @Override | |
| Back | FazBrowse Home | New Git URL |
0 commit comments