Back to index

wims  3.65+svn20090927
SetParameterTool.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.construction.Selector;
00010 import rene.zirkel.constructors.*;
00011 import rene.zirkel.objects.*;
00012 
00017 public class SetParameterTool extends ObjectConstructor
00018        implements Selector
00019 {      public void mousePressed (MouseEvent e, ZirkelCanvas zc)
00020        {      double x=zc.x(e.getX()),y=zc.y(e.getY());
00021               ConstructionObject o=zc.selectWithSelector(e.getX(),e.getY(),this);
00022               if (o==null || o.isMainParameter()) return;
00023               o.setMainParameter();
00024               if (o.isMainParameter())
00025               {      o.setSelected(true);
00026                      zc.getConstruction().addParameter(o);
00027                      zc.repaint();
00028               }
00029               if (e.isShiftDown()) o.setSpecialParameter(true);
00030        }
00031 
00032        public boolean isAdmissible (ZirkelCanvas zc, ConstructionObject o)
00033        {      return (o instanceof PointObject ||
00034                      o instanceof PrimitiveLineObject ||
00035                      o instanceof PrimitiveCircleObject ||
00036                      o instanceof ExpressionObject ||
00037                      o instanceof AngleObject ||
00038                      o instanceof AreaObject ||
00039                      o instanceof FunctionObject ||
00040                      o instanceof UserFunctionObject);
00041        }
00042 
00043        public void mouseMoved (MouseEvent e, ZirkelCanvas zc, boolean simple)
00044        {      zc.indicateWithSelector(e.getX(),e.getY(),this);
00045        }
00046        
00047        public void reset (ZirkelCanvas zc)
00048        {      super.reset(zc);
00049               zc.clearSelected();
00050               zc.getConstruction().clearParameters();
00051        }
00052        
00053        public void showStatus (ZirkelCanvas zc)
00054        {      zc.showStatus(
00055                      Zirkel.name("message.parameters",
00056                             "Macro Parameters: Select the Parameters!"));
00057        }
00058 }