public NotePadMeta( String n, int xl, int yl, int w, int h ) { note = n; location = new Point( xl, yl ); width = w; height = h; selected = false; setDefaultFont(); }
@Override public void setLocation( int x, int y ) { int nx = ( x >= 0 ? x : 0 ); int ny = ( y >= 0 ? y : 0 ); Point loc = new Point( nx, ny ); if ( !loc.equals( location ) ) { setChanged(); } location = loc; }
public Point textExtent( String text ) { String[] lines = text.split( Const.CR ); int maxWidth = 0; for ( String line : lines ) { Rectangle2D bounds = TextUtilities.getTextBounds( line, gc, gc.getFontMetrics() ); if ( bounds.getWidth() > maxWidth ) { maxWidth = (int) bounds.getWidth(); } } int height = gc.getFontMetrics().getHeight() * lines.length; return new Point( maxWidth, height ); }
public Point real2screen( int x, int y ) { offset = getOffset(); Point screen = new Point( x + offset.x, y + offset.y ); return screen; }
public NotePadMeta() { note = null; location = new Point( -1, -1 ); width = -1; height = -1; selected = false; setDefaultFont(); backgroundcolorred = 0xFF; backgroundcolorgreen = 0xA5; backgroundcolorblue = 0x00; }
public void setLocation( int x, int y ) { int nx = ( x >= 0 ? x : 0 ); int ny = ( y >= 0 ? y : 0 ); Point loc = new Point( nx, ny ); if ( !loc.equals( location ) ) { setChanged(); } location = loc; }
protected Point getOffset( Point thumb, Point area ) { Point p = new Point( 0, 0 ); Point sel = new Point( hori.getSelection(), vert.getSelection() ); if ( thumb.x == 0 || thumb.y == 0 ) { return p; } p.x = Math.round( -sel.x * area.x / thumb.x / magnification ); p.y = Math.round( -sel.y * area.y / thumb.y / magnification ); return p; }
protected Point getArea() { org.eclipse.swt.graphics.Rectangle rect = canvas.getClientArea(); Point area = new Point( rect.width, rect.height ); return area; }
public Point getNamePosition( String string, Point screen, int iconsize ) { Point textsize = gc.textExtent( string ); int xpos = screen.x + ( iconsize / 2 ) - ( textsize.x / 2 ); int ypos = screen.y + iconsize + 5; return new Point( xpos, ypos ); }
public Point textExtent( String text ) { String[] lines = text.split( Const.CR ); int maxWidth = 0; for ( String line : lines ) { Rectangle2D bounds = TextUtilities.getTextBounds( line, gc, gc.getFontMetrics() ); if ( bounds.getWidth() > maxWidth ) { maxWidth = (int) bounds.getWidth(); } } int height = gc.getFontMetrics().getHeight() * lines.length; return new Point( maxWidth, height ); }
public Point textExtent( String text ) { org.eclipse.swt.graphics.Point p = gc.textExtent( text ); return new Point( p.x, p.y ); }
public static Point calculateGridPosition( Point p ) { int gridSize = PropsUI.getInstance().getCanvasGridSize(); if ( gridSize > 1 ) { // Snap to grid... // return new Point( gridSize * Math.round( p.x / gridSize ), gridSize * Math.round( p.y / gridSize ) ); } else { // Normal draw // return p; } }
public void paste() { final String clipcontent = spoon.fromClipboard(); Point loc = new Point( currentMouseX, currentMouseY ); spoon.pasteXML( transMeta, clipcontent, loc ); }
public void pasteNote() { final String clipcontent = spoon.fromClipboard(); Point loc = new Point( currentMouseX, currentMouseY ); spoon.pasteXML( jobMeta, clipcontent, loc ); }
public void replaceMeta( JobEntryCopy jobEntryCopy ) { entry = (JobEntryInterface) jobEntryCopy.entry.clone(); nr = jobEntryCopy.nr; // Copy nr. 0 is the base copy... selected = jobEntryCopy.selected; if ( jobEntryCopy.location != null ) { location = new Point( jobEntryCopy.location.x, jobEntryCopy.location.y ); } launchingInParallel = jobEntryCopy.launchingInParallel; draw = jobEntryCopy.draw; id = jobEntryCopy.id; setChanged(); }
public static void setLocation( GUIPositionInterface guiElement, int x, int y ) { if ( x < 0 ) { x = 0; } if ( y < 0 ) { y = 0; } guiElement.setLocation( calculateGridPosition( new Point( x, y ) ) ); }
public Point getDeviceBounds() { org.eclipse.swt.graphics.Rectangle p = gc.getDevice().getBounds(); return new Point( p.width, p.height ); }
public Point getRealPosition( Composite canvas, int x, int y ) { Point p = new Point( 0, 0 ); Composite follow = canvas; while ( follow != null ) { Point xy = new Point( follow.getLocation().x, follow.getLocation().y ); p.x += xy.x; p.y += xy.y; follow = follow.getParent(); } p.x = x - p.x - 8; p.y = y - p.y - 48; return screen2real( p.x, p.y ); }
public SwingDirectGC( Graphics2D gc, Rectangle2D rect, int iconsize, int xOffset, int yOffset ) throws KettleException { this.image = null; this.gc = gc; this.observer = null; this.stepImages = SwingGUIResource.getInstance().getStepImages(); this.entryImages = SwingGUIResource.getInstance().getEntryImages(); this.iconsize = iconsize; this.area = new Point( (int) rect.getWidth(), (int) rect.getHeight() ); this.xOffset = xOffset; this.yOffset = yOffset; init(); }