/* Copyright 2006 Rene Grothmann, modified by Eric Hakenholz This file is part of C.a.R. software. C.a.R. is a free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 of the License. C.a.R. is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ package rene.zirkel.tools; import java.awt.Cursor; import java.awt.MouseInfo; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; import rene.zirkel.ZirkelCanvas; import rene.zirkel.constructors.ObjectConstructor; public class SelectTool extends ObjectConstructor { private static final int hotSize=5; private Point DragLoc=null; private Point GrowEast=null; private Point GrowSouth=null; private Point GrowNorth=null; private Point GrowWest=null; private Point GrowSouthEast=null; private ZirkelCanvas ZC; public SelectTool(ZirkelCanvas zc) { ZC=zc; zc.showCopyRectangle(); } public boolean isInside(Point pt, ZirkelCanvas zc) { Rectangle sel=(Rectangle) zc.getCopyRectangle(); if (sel==null) { return false; } sel=(Rectangle) sel.clone(); sel.grow(-hotSize, -hotSize); return sel.contains(pt); } public boolean isEast(Point pt, ZirkelCanvas zc) { Rectangle sel=(Rectangle) zc.getCopyRectangle(); if (sel==null) { return false; } boolean bool=(Math.abs(pt.x-sel.x-sel.width)sel.y)&&(pt.y<(sel.y+sel.height)); return bool; } public boolean isSouth(Point pt, ZirkelCanvas zc) { Rectangle sel=(Rectangle) zc.getCopyRectangle(); if (sel==null) { return false; } boolean bool=(Math.abs(pt.y-sel.y-sel.height)sel.x)&&(pt.x<(sel.x+sel.width)); return bool; } public boolean isNorth(Point pt, ZirkelCanvas zc) { Rectangle sel=(Rectangle) zc.getCopyRectangle(); if (sel==null) { return false; } boolean bool=(Math.abs(pt.y-sel.y)sel.x)&&(pt.x<(sel.x+sel.width)); return bool; } public boolean isWest(Point pt, ZirkelCanvas zc) { Rectangle sel=(Rectangle) zc.getCopyRectangle(); if (sel==null) { return false; } boolean bool=(Math.abs(pt.x-sel.x)sel.y)&&(pt.y<(sel.y+sel.height)); return bool; } public boolean isSouthEast(Point pt, ZirkelCanvas zc) { Rectangle sel=(Rectangle) zc.getCopyRectangle(); if (sel==null) { return false; } boolean bool=(Math.abs(pt.x-sel.x-sel.width)x: "+r.x+""); } @Override public boolean useSmartBoard() { return false; } @Override public void invalidate(ZirkelCanvas zc) { zc.hideCopyRectangle(); zc.repaint(); } }