Back to index

wims  3.65+svn20090927
SetTargetsTool.java
Go to the documentation of this file.
00001 package rene.zirkel.tools;
00002 
00003 // file: SetParameter.java
00004 
00005 import java.awt.event.*;
00006 
00007 import rene.zirkel.Zirkel;
00008 import rene.zirkel.ZirkelCanvas;
00009 import rene.zirkel.constructors.*;
00010 import rene.zirkel.objects.ConstructionObject;
00011 
00012 public class SetTargetsTool extends ObjectConstructor
00013 {      public void mousePressed (MouseEvent e, ZirkelCanvas zc)
00014        {      double x=zc.x(e.getX()),y=zc.y(e.getY());
00015               ConstructionObject o=zc.selectConstructableObject(e.getX(),e.getY());
00016               if (o==null || !o.isFlag()) return;
00017               o.setTarget(true);
00018               if (o.isTarget())
00019               {      o.setSelected(true);
00020                      zc.getConstruction().addTarget(o);
00021                      zc.repaint();
00022               }
00023        }
00024        public void mouseMoved (MouseEvent e, ZirkelCanvas zc, boolean simple)
00025        {      zc.indicateConstructableObjects(e.getX(),e.getY());
00026        }
00027        public void reset (ZirkelCanvas zc)
00028        {      super.reset(zc);
00029               zc.clearSelected();
00030               zc.getConstruction().clearTargets();
00031               zc.getConstruction().determineConstructables();
00032        }
00033        public void showStatus (ZirkelCanvas zc)
00034        {      zc.showStatus(
00035                      Zirkel.name("message.targets",
00036                             "Macro Targets: Select the Targets!"));
00037        }
00038        public boolean useSmartBoard ()
00039        {      return false;
00040        }
00041 }