

Public Member Functions | |
| ScrolledSwingScilabCanvas (ScrollabeSwingScilabCanvas canvas) | |
| void | setCanvas (ScrollabeSwingScilabCanvas canvas) |
| void | display () |
| void | draw () |
| boolean | getAutoSwapBufferMode () |
| Size | getDims () |
| GL | getGL () |
| Position | getPosition () |
| void | setAutoSwapBufferMode (boolean onOrOff) |
| void | setDims (Size newSize) |
| void | setPosition (Position newPosition) |
| int | getFigureIndex () |
| void | setAutoResizeMode (boolean onOrOff) |
| boolean | getAutoResizeMode () |
| int[] | getViewingRegion () |
| void | setViewingRegion (int posX, int posY, int width, int height) |
| void | setBackgroundColor (double red, double green, double blue) |
| void | setEventHandler (String funName) |
| void | setEventHandlerEnabled (boolean status) |
| int | rubberBox (boolean isClick, boolean isZoom, int[] initialRect, int[] endRect) |
| boolean | getRotationDisplacement (int[] displacement) |
| void | stopRotationRecording () |
| void | close () |
| BufferedImage | dumpAsBufferedImage () |
Static Public Member Functions | |
| static ScrolledSwingScilabCanvas | createCanvas (int figureIndex) |
Protected Member Functions | |
| ScrollabeSwingScilabCanvas | getCanvas () |
Private Member Functions | |
| void | enableEventHandler () |
| void | disableEventHandler () |
Private Attributes | |
| ScrollabeSwingScilabCanvas | canvas |
| ScilabEventListener | eventHandler |
Static Private Attributes | |
| static final int | VIEWPORT_SIZE = 4 |
Definition at line 37 of file ScrolledSwingScilabCanvas.java.
| org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::ScrolledSwingScilabCanvas | ( | ScrollabeSwingScilabCanvas | canvas | ) | [inline] |
Default contsructor
Definition at line 49 of file ScrolledSwingScilabCanvas.java.
Referenced by createCanvas().
00049 { 00050 super(canvas); 00051 this.canvas = canvas; 00052 // actually with the current impelementation of GLJPanel.paintComponent, 00053 // the panel is totally redrawed each time. 00054 this.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); 00055 }

| static ScrolledSwingScilabCanvas org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::createCanvas | ( | int | figureIndex | ) | [inline, static] |
| figureIndex | index of the figure which will be drawn |
Definition at line 61 of file ScrolledSwingScilabCanvas.java.
References createCanvas(), ScrolledSwingScilabCanvas(), and setBackgroundColor().
Referenced by createCanvas().
00061 { 00062 ScrollabeSwingScilabCanvas viewedCanvas = ScrollabeSwingScilabCanvas.createCanvas(figureIndex); 00063 ScrolledSwingScilabCanvas newCanvas = new ScrolledSwingScilabCanvas(viewedCanvas); 00064 newCanvas.setBackgroundColor(1.0, 1.0, 1.0); 00065 return newCanvas; 00066 }


| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setCanvas | ( | ScrollabeSwingScilabCanvas | canvas | ) | [inline] |
Set the canvas implementation of the canvas
Definition at line 72 of file ScrolledSwingScilabCanvas.java.
Referenced by close().

| ScrollabeSwingScilabCanvas org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getCanvas | ( | ) | [inline, protected] |
Definition at line 80 of file ScrolledSwingScilabCanvas.java.
References canvas.
Referenced by close(), display(), getAutoResizeMode(), getAutoSwapBufferMode(), getDims(), getFigureIndex(), getGL(), getPosition(), getRotationDisplacement(), rubberBox(), setAutoResizeMode(), setAutoSwapBufferMode(), setBackgroundColor(), setDims(), setPosition(), setViewingRegion(), and stopRotationRecording().
00080 { 00081 return canvas; 00082 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::display | ( | ) | [inline] |
OpenGL function forcing redraw of the canvas
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 87 of file ScrolledSwingScilabCanvas.java.
References org::scilab::modules::gui::canvas::SimpleCanvas::display(), and getCanvas().
00087 { 00088 //long deb = System.nanoTime(); 00089 getCanvas().display(); 00090 //long end = System.nanoTime() - deb; 00091 //System.err.println("Elapsed time = " + (end / 1000000.0)); 00092 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::draw | ( | ) | [inline] |
Scilab function to draw on object
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 97 of file ScrolledSwingScilabCanvas.java.
References canvas, and org::scilab::modules::gui::bridge::canvas::SwingScilabCanvas::draw().
00097 { 00098 this.setVisible(true); 00099 this.doLayout(); 00100 canvas.draw(); 00101 }

| boolean org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getAutoSwapBufferMode | ( | ) | [inline] |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 106 of file ScrolledSwingScilabCanvas.java.
References org::scilab::modules::gui::canvas::SimpleCanvas::getAutoSwapBufferMode(), and getCanvas().
00106 { 00107 return getCanvas().getAutoSwapBufferMode(); 00108 }

| Size org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getDims | ( | ) | [inline] |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 113 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::bridge::canvas::SwingScilabCanvas::getDims().
Referenced by org::scilab::modules::gui::utils::PositionConverter::javaToScilab(), and org::scilab::modules::gui::utils::PositionConverter::scilabToJava().
00113 { 00114 return getCanvas().getDims(); 00115 }


| GL org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getGL | ( | ) | [inline] |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 120 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::canvas::SimpleCanvas::getGL().
00120 { 00121 return getCanvas().getGL(); 00122 }

| Position org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getPosition | ( | ) | [inline] |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 127 of file ScrolledSwingScilabCanvas.java.
References getCanvas().

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setAutoSwapBufferMode | ( | boolean | onOrOff | ) | [inline] |
Set the swap buffer mode
| onOrOff | true to enable, false to disable |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 135 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::canvas::SimpleCanvas::setAutoSwapBufferMode().
00135 { 00136 getCanvas().setAutoSwapBufferMode(onOrOff); 00137 00138 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setDims | ( | Size | newSize | ) | [inline] |
Set new size for the canvas
| newSize | new Size to apply |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 144 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::bridge::canvas::SwingScilabCanvas::setDims().
00144 { 00145 getCanvas().setDims(newSize); 00146 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setPosition | ( | Position | newPosition | ) | [inline] |
Set a new position for the canvas
| newPosition | new position to apply |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 152 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), org::scilab::modules::gui::utils::Position::getX(), and org::scilab::modules::gui::utils::Position::getY().
00152 { 00153 getCanvas().setLocation(newPosition.getX(), newPosition.getY()); 00154 }

| int org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getFigureIndex | ( | ) | [inline] |
Get the Figuer Index : the Scilab ID of the figure.
Definition at line 161 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::bridge::canvas::SwingScilabCanvas::getFigureIndex().
Referenced by setEventHandler().
00161 { 00162 return getCanvas().getFigureIndex(); 00163 }


| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setAutoResizeMode | ( | boolean | onOrOff | ) | [inline] |
Specify wether the canvas should fit the parent tab size (and consequently the scrollpane size) or not
| onOrOff | true to enable autoresize mode |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 170 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::bridge::canvas::ScrollabeSwingScilabCanvas::setAutoResizeMode().
00170 { 00171 getCanvas().setAutoResizeMode(onOrOff); 00172 00173 // so the canvas will retrieve its good position 00174 getCanvas().revalidate(); 00175 }

| boolean org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getAutoResizeMode | ( | ) | [inline] |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 180 of file ScrolledSwingScilabCanvas.java.
References org::scilab::modules::gui::bridge::canvas::ScrollabeSwingScilabCanvas::getAutoResizeMode(), and getCanvas().
Referenced by setViewingRegion().
00180 { 00181 return getCanvas().getAutoResizeMode(); 00182 }


| int [] org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getViewingRegion | ( | ) | [inline] |
Get the part of the canvas which is currently viewed
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 188 of file ScrolledSwingScilabCanvas.java.
References res.
Referenced by setViewingRegion().
00188 { 00189 Rectangle viewport = getViewport().getViewRect(); 00190 int[] res = {(int) viewport.getX(), 00191 (int) viewport.getY(), 00192 (int) viewport.getWidth(), 00193 (int) viewport.getHeight()}; 00194 return res; 00195 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setViewingRegion | ( | int | posX, | |
| int | posY, | |||
| int | width, | |||
| int | height | |||
| ) | [inline] |
Specify a new viewport for the canvas For SwingScilabCanvas viewport can not be modified since it match the parent tab size
| posX | X coordinate of upper left point of the viewport within the canvas | |
| posY | Y coordinate of upper left point of the viewport within the canvas | |
| width | width of the viewport | |
| height | height of the viewport |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 206 of file ScrolledSwingScilabCanvas.java.
References getAutoResizeMode(), getCanvas(), getViewingRegion(), and VIEWPORT_SIZE.
00206 { 00207 if (!getAutoResizeMode()) { 00208 // don't set viewport size here it should always fit parent tab size 00209 // It seems that we must check the viewport size and positions 00210 // to get coherent values, otherwise the setViewPosition hangs... 00211 // there are three checks that must be performed for the two dimensions 00212 // - be sure that viewport position is greater than 0. 00213 // - if the viewport is larger than the canvas, then it can't be moved 00214 // - if the viewport is smaller than the canvas, then it should remains 00215 // inside the canvas 00216 00217 int canvasWidth = getCanvas().getWidth(); 00218 int canvasHeight = getCanvas().getHeight(); 00219 int[] curViewedRegion = getViewingRegion(); 00220 int viewportPosX = curViewedRegion[0]; 00221 int viewPortPosY = curViewedRegion[1]; 00222 int viewportWidth = curViewedRegion[2]; 00223 int viewportHeight = curViewedRegion[VIEWPORT_SIZE - 1]; 00224 00225 // use previous values as default ones 00226 int realPosX = 0; 00227 int realPosY = 0; 00228 00229 00230 if (viewportWidth <= canvasWidth) { 00231 // viewport smaller than the canvas 00232 // check that the viewport stays in the canvas 00233 // the left most position is canvasWidth - viewporwidth 00234 realPosX = Math.min(posX, canvasWidth - viewportWidth); 00235 } else { 00236 // viewport larger than the canvas 00237 // get previous position (should be 0) 00238 realPosX = viewportPosX; 00239 } 00240 // last check, greater than 0 00241 realPosX = Math.max(0, realPosX); 00242 00243 if (viewportHeight <= canvasHeight) { 00244 realPosY = Math.min(posY, canvasHeight - viewportHeight); 00245 } else { 00246 realPosY = viewPortPosY; 00247 } 00248 realPosY = Math.max(0, realPosY); 00249 00250 getViewport().setViewPosition(new Point(realPosX, realPosY)); 00251 revalidate(); 00252 } 00253 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setBackgroundColor | ( | double | red, | |
| double | green, | |||
| double | blue | |||
| ) | [inline] |
Set the background of the Canvas.
| red | red channel | |
| green | green channel | |
| blue | blue channel |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 261 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::bridge::canvas::SwingScilabCanvas::setBackgroundColor().
Referenced by createCanvas().
00261 { 00262 getCanvas().setBackgroundColor(red, green, blue); 00263 this.setBackground(new Color((float) red, (float) green, (float) blue)); 00264 }


| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setEventHandler | ( | String | funName | ) | [inline] |
Set the event handler of the Canvas
| command | the name of the Scilab function to call |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 270 of file ScrolledSwingScilabCanvas.java.
References disableEventHandler(), eventHandler, and getFigureIndex().
00270 { 00271 disableEventHandler(); 00272 eventHandler = new ScilabEventListener(funName, getFigureIndex()); 00273 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::setEventHandlerEnabled | ( | boolean | status | ) | [inline] |
Set the status of the event handler of the Canvas
| status | is true to set the event handler active |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 280 of file ScrolledSwingScilabCanvas.java.
References disableEventHandler(), and enableEventHandler().
00280 { 00281 if (status) { 00282 enableEventHandler(); 00283 } 00284 else { 00285 disableEventHandler(); 00286 } 00287 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::enableEventHandler | ( | ) | [inline, private] |
Definition at line 289 of file ScrolledSwingScilabCanvas.java.
References canvas, and eventHandler.
Referenced by setEventHandlerEnabled().
00289 { 00290 canvas.addKeyListener(eventHandler); 00291 canvas.addMouseListener(eventHandler); 00292 canvas.addMouseMotionListener(eventHandler); 00293 }

| void org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::disableEventHandler | ( | ) | [inline, private] |
Definition at line 295 of file ScrolledSwingScilabCanvas.java.
References canvas, and eventHandler.
Referenced by close(), setEventHandler(), and setEventHandlerEnabled().
00295 { 00296 if (eventHandler != null) { 00297 canvas.removeKeyListener(eventHandler); 00298 canvas.removeMouseListener(eventHandler); 00299 canvas.removeMouseMotionListener(eventHandler); 00300 } 00301 }

| int org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::rubberBox | ( | boolean | isClick, | |
| boolean | isZoom, | |||
| int[] | initialRect, | |||
| int[] | endRect | |||
| ) | [inline] |
Create an interactive selection rectangle and return its pixel coordinates
| isClick | specify wether the rubber box is selected by one click for each one of the two edge or a sequence of press-release | |
| isZoom | specify if the rubber box is used for a zoom and then change the mouse cursor. | |
| initialRect | if not null specify the initial rectangle to draw | |
| endRect | array [x1,y1,x2,y2] containing the result of rubberbox |
Implements org::scilab::modules::gui::canvas::SimpleCanvas.
Definition at line 312 of file ScrolledSwingScilabCanvas.java.
References getCanvas(), and org::scilab::modules::gui::bridge::canvas::SwingScilabCanvas::rubberBox().
00312 { 00313 return getCanvas().rubberBox(isClick, isZoom, initialRect, endRect); 00314 }

| boolean org::scilab::modules::gui::bridge::canvas::ScrolledSwingScilabCanvas::getRotationDisplacement | ( | int[] | displacement | ) | [inline] |
Get the displacement in pixel that should be used for rotating axes