Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Package Functions | Package Attributes | Private Member Functions
rene.zirkel.ZirkelApplet Class Reference
Inheritance diagram for rene.zirkel.ZirkelApplet:
Inheritance graph
[legend]
Collaboration diagram for rene.zirkel.ZirkelApplet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void init ()
void setOption (String option)
void makeMacroBar ()
void updateMacroBar ()
void iconPressed (String o)
void settool (int i)
void setcolor (int c)
void settype (int c)
void setcolortype (int c)
void showStatus (String s)
void keyPressed (KeyEvent e)
void keyReleased (KeyEvent e)
void keyTyped (KeyEvent e)
void initLightColors ()
void initObjectKeys ()
void notifyDone ()
void showcolor (int c)
void showcomment ()
void showconstruction ()
void toggleGrid ()
void runmacro (boolean shift)
void runMacro (Macro m)
void setShowNames (boolean flag)
void setObtuse (boolean flag)
void setSolid (boolean flag)
void setShowValues (boolean flag)
void setLongNames (boolean flag)
void toggleGrid (boolean grid)
void loadsettings ()
void doAction (String o)
void itemAction (String o, boolean flag)
void start ()
void showVersion ()
void stop ()
void destroy ()
void replay ()
void replayChosen ()
boolean enabled (String function)
boolean haveBreaks ()
String loadImage ()
Image doLoadImage (String filename)
boolean interpret (String s)
 For external scripting: Interprets a command s using the internal construction language.
String getConstruction ()
 For external scripting: Gets the construction as an XML stream contained in a string.
String getAllObjects ()
String ConvertLineNotation (String parameter)
String getDrawing (String type, String names)
boolean putConstruction (String s)
 For external scripting: Receives the construction as an XML stream, contained in a string.
void track ()

Static Public Member Functions

static double roundit (double x)
static String[] StringToArray (String str)

Public Attributes

ObjectConstructor ObjectConstructors []

Static Public Attributes

static String xaxis_text = "x-axis"
static String yaxis_text = "y-axis"
static boolean yaxis_text_vertical = false
static String xaxis_variable = "X"
static String yaxis_variable = "Y"
static int decimals = 2
static final String DefaultIcons = " runmacro animate "
static final String DefaultOptions = " draw twolines indicate "

Package Functions

void initDemo ()
void setIA (IconBar IA, String set)
void definemacro ()

Package Attributes

ZirkelCanvas ZC
IconBar IA
IconBar IB
IconBar IC
MacroBar IM
String filename = "test.zir"
Label Status
Color C
Color CC
Frame F
String FirstConstructor = "point"
String Tools = "all"
String Options = ""
int CurrentTool = 0
HistoryTextField Input
ConstructionObject Last = null
boolean edit
boolean jumptostart
DemoRunner DR = null
Replay RD = null
String OldMacro = null
AnimatorTool A = null

Private Member Functions

String getthisintersection (String name)
String getthispoint (String name)
String getthisray (String name)
String getthissegment (String name)
String getthisarea (String name)
String getthisline (String name)
String getthiscircle (String name)
String getthisfixedcircle (String name)
String getthisangle (String name)
String getthisfunction (String name)
String getthisFreeDrawing ()

Detailed Description

Definition at line 30 of file ZirkelApplet.java.


Member Function Documentation

String rene.zirkel.ZirkelApplet.ConvertLineNotation ( String  parameter) [inline]

Definition at line 1407 of file ZirkelApplet.java.

    {
        int i = parameter.indexOf("x=");
        if(i != -1)
            return parameter + ":perpendicular";
        i = parameter.indexOf("x");
        if(i == -1)
            return parameter + ":horizontal";
        i = parameter.indexOf("=");
        //System.out.println("parameter" + parameter + "i=" + i);
        if(i != -1)
        {
            int t = parameter.length();
            String links = parameter.substring(0, i);
            String c = parameter.substring(i + 1, t);
            t = links.length();
            i = links.indexOf("x");
            String mx = links.substring(0, i);
            if(mx.length() == 0)
                mx = "1";
            String by = links.substring(i + 1, t);
            by = by.replace('y',' ');
            by = by.replace('*',' ');
            by = by.replace('+',' ');
            if(by.length() == 0)
                by = "1";
            mx = mx.replace('*',' ');
            return "slope=-1*(" + mx + ")/(" + by + "):constant=" + "(" + c + ")/(" + by + "):affine";
        } else
        {
            return "error: line not correct";
        }
    }

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.definemacro ( ) [inline, package]

Definition at line 1046 of file ZirkelApplet.java.

       {      if (!ZC.defineMacro()) return; 
              if (ZC.getOC() instanceof SetTargetsTool)
                     settool(ZirkelFrame.NParameters);
              else ZC.getOC().reset(ZC);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1248 of file ZirkelApplet.java.

       {      ZC.invalidate();
              if (DR!=null) DR.stop();
       }

Here is the call graph for this function:

void rene.zirkel.ZirkelApplet.doAction ( String  o) [inline]

Definition at line 1124 of file ZirkelApplet.java.

       {      if (o.equals("Input"))
              {      try
                     {      ZC.getConstruction().interpret(ZC,Input.getText(),"");
                            Input.remember();
                            Input.setText("");
                            loadsettings();
                            ZC.validate();
                            ZC.getConstruction().updateCircleDep();
                     }
                     catch (ConstructionException e)
                     {      ZC.warning(e.getDescription());
                     }
              }
       }

Here is the call graph for this function:

Image rene.zirkel.ZirkelApplet.doLoadImage ( String  filename) [inline]

Implements rene.zirkel.ZirkelCanvasInterface.

Definition at line 1289 of file ZirkelApplet.java.

       {      Image i;
              try 
              {      i = getToolkit().getImage(new URL(getCodeBase(),filename));
                     MediaTracker mt=new MediaTracker(this);
                     mt.addImage(i,0);
                     mt.waitForID(0);
                     if (mt.checkID(0) && !mt.isErrorAny())
                     {      return i;
                     }
              }
              catch (Exception e)
              {      showStatus(e.toString());
              }
              return null;
       }

Here is the call graph for this function:

boolean rene.zirkel.ZirkelApplet.enabled ( String  function) [inline]

Implements rene.zirkel.ZirkelCanvasInterface.

Definition at line 1271 of file ZirkelApplet.java.

       {      if (Tools.indexOf("all")>=0) return true;
              return Tools.indexOf(function)>=0;
       }      

Definition at line 1360 of file ZirkelApplet.java.

                                 {
       String result="";String name="";String type="";
       Enumeration t=ZC.Drawings.elements();
       // is the drawing tool used? 
       // the resulting string will be all freehand drawings 
       // [they do not have names, e.g a collection of seperate points]
       if(t.hasMoreElements()){
           while (t.hasMoreElements()){
              Drawing d=(Drawing)t.nextElement();
              Enumeration ec=d.elements();
              if (ec.hasMoreElements()){
                  CoordinatesXY xy=(CoordinatesXY)ec.nextElement();
                  while (ec.hasMoreElements()){
                     xy=(CoordinatesXY)ec.nextElement();                                                                
                     //System.out.println("X="+xy.X+"  Y="+xy.Y);
                     result=result+"freehand_point:noname:x="+xy.X+":y="+xy.Y+"\n,";  
                  }                                                                                                          
              }                                                                                                                  
           }                                                                                                                          
        } 
       Construction C = ZC.getConstruction();
       Enumeration e=C.elements();
       while (e.hasMoreElements()){
           ConstructionObject o=(ConstructionObject)e.nextElement();
           name=o.getName().toString().toLowerCase();
           if(name.indexOf("my_") == -1 ){
              // only use object not protected by prefix "my_
              type=o.getTag().toString().toLowerCase();
              // I hope "getTag()" is not too language dependant...must check this !!
              // make use of my own function...don't know a quicker way of doing this.
              result=getDrawing(type,name)+","+result;
           }
       }
       
       return result;
    }  

Here is the call graph for this function:

For external scripting: Gets the construction as an XML stream contained in a string.

Returns:
Construction.

Definition at line 1328 of file ZirkelApplet.java.

       {      ByteArrayOutputStream out=new ByteArrayOutputStream();
              try
              {      ZC.save(out,true,true,false,ZC.getMacros(),"");
                     return out.toString("utf-8");
              }
              catch (Exception e)
              {      return "Error";
              }
       }

Here is the call graph for this function:

String rene.zirkel.ZirkelApplet.getDrawing ( String  type,
String  names 
) [inline]

Definition at line 1786 of file ZirkelApplet.java.

    {
        String name[] = StringToArray(names);
        int i = name.length;
        String endresult = "";
       
       if(type.equalsIgnoreCase("freehand_drawing") ||type.equalsIgnoreCase("freehand_point"))
       {
           endresult = endresult + getthisFreeDrawing() + "\n";
       } else
       
        if(type.equalsIgnoreCase("line") || type.equalsIgnoreCase("lines"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthisline(Name) + "\n";
            }

        } else

        if(type.equalsIgnoreCase("function"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
              //System.out.println("...with name "+Name);
                endresult = endresult + getthisfunction(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("area") || type.equalsIgnoreCase("poly") ||  type.equalsIgnoreCase("polygon"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
              //System.out.println("...with name "+Name);
                endresult = endresult + getthisarea(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("ray") || type.equalsIgnoreCase("demiline"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthisray(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("circle") || type.equalsIgnoreCase("circles"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthiscircle(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("fixedcircle") || type.equalsIgnoreCase("fixedcircles"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthisfixedcircle(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("intersection")|| type.equalsIgnoreCase("intersectionpoint"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthisintersection(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("pointonobject") || type.equalsIgnoreCase("pointon"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthispoint(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("point") || type.equalsIgnoreCase("points"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthispoint(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("segment") || type.equalsIgnoreCase("segments"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthissegment(Name) + "\n";
            }

        } else
        if(type.equalsIgnoreCase("angle") || type.equalsIgnoreCase("angles"))
        {
            for(int p = 0; p < i; p++)
            {
                String Name = name[p];
                endresult = endresult + getthisangle(Name) + "\n";
            }

        }
        return endresult;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisangle ( String  name) [inline, private]

Definition at line 1704 of file ZirkelApplet.java.

    {
        String result = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration a = C.elements(); a.hasMoreElements();)
            try
            {
                AngleObject c = (AngleObject)a.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                        result = "angle=" + name + ":value=" + c.getE();
                        check++;
                    }
                    catch(Exception e)
                    {
                        result = "angle=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "angle=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisarea ( String  name) [inline, private]

Definition at line 1574 of file ZirkelApplet.java.

    {
        String result = "";
       String surface ="";
       String polypoints = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration z = C.elements(); z.hasMoreElements();)
            try
            {
                AreaObject c = (AreaObject)z.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                     polypoints="";
                     for( Enumeration point = c.depending(); point.hasMoreElements();)
                         try
                         {
                            PointObject p = (PointObject)point.nextElement();
                            double x = roundit(p.getX());double y = roundit(p.getY());
                            polypoints = "x=" + x + ":y=" + y +":"+ polypoints;
                         }
                            catch(Exception e){}
                     surface=c.getDisplayValue();
                     //System.out.println("result="+result+"  name="+name);
                     result = "polygon=" + polypoints + "area="+ surface + "\n" + result;
                        check++;
                    }
                    catch(Exception e)
                    {
                        result = "polygon=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "polygon=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthiscircle ( String  name) [inline, private]

Definition at line 1644 of file ZirkelApplet.java.

    {
        String result = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration z = C.elements(); z.hasMoreElements();)
            try
            {
                CircleObject c = (CircleObject)z.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                        double x = roundit(c.getX());
                        double y = roundit(c.getY());
                        double radius = roundit(c.getR());
                        result = "circle=" + name + ":" + "x=" + x + ":y=" + y + ":r=" + radius;
                        check++;
                    }
                    catch(Exception e)
                    {
                        result = "circle=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "circle=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisfixedcircle ( String  name) [inline, private]

Definition at line 1674 of file ZirkelApplet.java.

    {
        String result = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration z = C.elements(); z.hasMoreElements();)
            try
            {
                FixedCircleObject c = (FixedCircleObject)z.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                        double x = roundit(c.getX());
                        double y = roundit(c.getY());
                        double radius = roundit(c.getR());
                        result = "fixedcircle=" + name + ":" + "x=" + x + ":y=" + y + ":r=" + radius;
                        check++;
                    }
                    catch(Exception e)
                    {
                        result = "fixedcircle=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "fixedcircle=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisFreeDrawing ( ) [inline, private]

Definition at line 1759 of file ZirkelApplet.java.

                                       {
       Enumeration t=ZC.Drawings.elements();
       // is the drawing tool used? 
       // the resulting string will be all freehand drawings 
       // [they do not have names, e.g a collection of seperate points]
       String result = "";
       if(t.hasMoreElements()){
           while (t.hasMoreElements()){
              Drawing d=(Drawing)t.nextElement();
              Enumeration ec=d.elements();
              if (ec.hasMoreElements()){
                  CoordinatesXY xy=(CoordinatesXY)ec.nextElement();
                  while (ec.hasMoreElements()){
                     xy=(CoordinatesXY)ec.nextElement();                                                                
                     //System.out.println("X="+xy.X+"  Y="+xy.Y);
                     result=result+"freehand_point:noname:x="+xy.X+":y="+xy.Y+"\n,";  
                  }                                                                                                          
              }                                                                                                                  
           }                                                                                                                          
        }
       if(result.length()<1){
           result= "freehand_drawing not present error";
       }
       return result;

    }

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisfunction ( String  name) [inline, private]

Definition at line 1731 of file ZirkelApplet.java.

    {
        String result = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration ff = C.elements(); ff.hasMoreElements();)
            try
            {
                FunctionObject c = (FunctionObject)ff.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                        check++;
                        result = c.getEquation();
                        result = "function=" + name + ":" + result;
                    }
                    catch(Exception e)
                    {
                        result = "function=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "function=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisintersection ( String  name) [inline, private]

Definition at line 1441 of file ZirkelApplet.java.

    {
        String result = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration r = C.elements(); r.hasMoreElements();)
            try
            {
                IntersectionObject c = (IntersectionObject)r.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                        double x = roundit(c.getX());
                        double y = roundit(c.getY());
                        result = "point=" + name + ":" + "x=" + x + ":y=" + y + "\n";
                        check++;
                    }
                    catch(Exception e)
                    {
                        result = "point=" + name + " no value error \n";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "point=" + name + " not present error\n";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisline ( String  name) [inline, private]

Definition at line 1615 of file ZirkelApplet.java.

    {
        String result = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration l = C.elements(); l.hasMoreElements();)
            try
            {
                LineObject c = (LineObject)l.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                        check++;
                        result = c.getEquation();
                        result = ConvertLineNotation(result);
                        result = "line=" + name + ":" + result;
                    }
                    catch(Exception e)
                    {
                        result = "line=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "line=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthispoint ( String  name) [inline, private]

Definition at line 1471 of file ZirkelApplet.java.

    {
        String result = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration r = C.elements(); r.hasMoreElements();)
            try
            {
                PointObject c = (PointObject)r.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                        double x = roundit(c.getX());
                        double y = roundit(c.getY());
                        result = "point=" + name + ":" + "x=" + x + ":y=" + y + "\n";
                        check++;
                    }
                    catch(Exception e)
                    {
                        result = "point=" + name + " no value error \n";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "point=" + name + " not present error\n";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthisray ( String  name) [inline, private]

Definition at line 1501 of file ZirkelApplet.java.

    {
        String result = "";
       String raypoints = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration s = C.elements(); s.hasMoreElements();)
            try
            {
                RayObject c = (RayObject)s.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                     for( Enumeration point = c.depending(); point.hasMoreElements();)
                         try
                         {
                            PointObject p = (PointObject)point.nextElement();
                            double x = roundit(p.getX());double y = roundit(p.getY());
                            raypoints = "x=" + x + ":y=" + y +":"+ raypoints;
                         }
                            catch(Exception e){}
                     result = "ray=" + name + ":" + raypoints + "length="+ c.getLength();
                        check++;

                    }
                    catch(Exception e)
                    {
                        result = "ray=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "ray=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

String rene.zirkel.ZirkelApplet.getthissegment ( String  name) [inline, private]

Definition at line 1538 of file ZirkelApplet.java.

    {
        String result = "";
       String segmentpoints = "";
        int check = 0;
        Construction C = ZC.getConstruction();
        for(Enumeration s = C.elements(); s.hasMoreElements();)
            try
            {
                SegmentObject c = (SegmentObject)s.nextElement();
                if(c.getName().equalsIgnoreCase(name))
                    try
                    {
                     for( Enumeration point = c.depending(); point.hasMoreElements();)
                         try
                         {
                            PointObject p = (PointObject)point.nextElement();
                            double x = roundit(p.getX());double y = roundit(p.getY());
                            segmentpoints = "x=" + x + ":y=" + y +":"+ segmentpoints;
                         }
                            catch(Exception e){}
                     result = "segment=" + name + ":" + segmentpoints + "length="+ c.getLength();
                        check++;

                    }
                    catch(Exception e)
                    {
                        result = "segment=" + name + " no value error";
                    }
            }
            catch(Exception exception) { }

        if(check == 0)
            result = "segment=" + name + " not present error";
        return result;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1276 of file ZirkelApplet.java.

       {      Enumeration e=ZC.getConstruction().elements();
              while (e.hasMoreElements())
              {      if (((ConstructionObject)e.nextElement()).isBreak())
                            return true;
              }
              return false;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.iconPressed ( String  o) [inline]

Definition at line 563 of file ZirkelApplet.java.

       {      if (RD!=null) RD.doclose();
              ZC.requestFocus();
              if (IA!=null && IA.isControlPressed())
              {      if (o.equals("edit"))
                     {      if (CurrentTool!=ZirkelFrame.NEdit) IA.setState("edit",false);
                            ZC.editLast();
                            ZC.repaint();
                     }
                     IA.clearShiftControl();
                     return;
              }
              for (int i=0; i<ZirkelFrame.ObjectStrings.length; i++)
                     if (o.equals(ZirkelFrame.ObjectStrings[i]))
                     {      if (i==ZirkelFrame.NMacro) runmacro(IB.isShiftPressed());
                            else settool(i);
                            return;
                     }
              if (IM!=null) // Search in the macro line
              {      Macro m=IM.find(o);
                     if (m!=null) 
                     {      runMacro(m);
                            return;
                     }
              }
              if (o.equals("hidden"))
              {      ZC.setShowHidden(IA.getState("hidden"));
              }
              else if (o.equals("partial"))
              {      ZC.setPartial(IA.getState("partial"));
              }
              else if (o.equals("plines"))
              {      ZC.setPartialLines(IA.getState("plines"));
              }
              else if (o.equals("arrow"))
              {      ZC.setVectors(IA.getState("arrow"));
              }
              else if (o.equals("color"))
              {      int n=IA.getMultipleState("color");
                     if (n>=0) setcolor(n);
              }
              else if (o.equals("showcolor"))
              {      int n=IA.getMultipleState("showcolor");
                     if (n>=0) showcolor(n);
              }
              else if (o.equals("showname"))
              {      setShowNames(IA.getState("showname"));
              }
              else if (o.equals("obtuse"))
              {      setObtuse(IA.getState("obtuse"));
              }
              else if (o.equals("solid"))
              {      setSolid(IA.getState("solid"));
              }
              else if (o.equals("showvalue"))
              {      setShowValues(IA.getState("showvalue"));
              }
              else if (o.equals("longnames"))
              {      setLongNames(IA.getState("longnames"));
              }
              else if (o.equals("grid"))
              {      toggleGrid(IA.getState("grid"));
              }
              else if (o.equals("comment"))
              {      showcomment();
              }
              else if (o.equals("function"))
              {      if (IA.isControlPressed()) ZC.createFunction();
                     else ZC.createCurve();
              }
              else if (o.equals("type"))
              {      int n=IA.getMultipleState("type");
                     if (n>=0) settype(n);
              }
              else if (o.equals("thickness"))
              {      int n=IA.getMultipleState("thickness");
                     if (n>=0) setcolortype(n);
              }
              else if (o.equals("edit"))
              {      settool(ZirkelFrame.NEdit);
              }
              else if (o.equals("back"))
              {      ZC.back();
                     ZC.repaint();
              }
              else if (o.equals("undo"))
              {      ZC.undo();
                     ZC.repaint();
              }
              else if (o.equals("replay"))
              {      replay();
              }
              else if (o.equals("macro"))
              {      int n=IA.getMultipleState("macro");
                     switch (n)
                     {      case 1 :
                                   settool(ZirkelFrame.NParameters);
                                   break;
                            case 2 :
                                   settool(ZirkelFrame.NTargets);
                                   break;
                            case 0 :
                                   definemacro();
                                   break;
                     }
                     IA.setState("macro",true);
              }
              else if (o.equals("allback"))
              {      if (Last!=null && Last instanceof TextObject)
                            ((TextObject)Last).setDoShow(false);
                     Enumeration e=ZC.getConstruction().elements();
                     if (e.hasMoreElements())
                     {      Last=(ConstructionObject)e.nextElement();
                            ZC.paintUntil(Last);
                            if ((Last instanceof TextObject) && Last.valid()
                                   && !Last.isSuperHidden())
                            {      ((TextObject)Last).setDoShow(true);
                            }
                     }
                     IC.setEnabled("allforward",true);
                     IC.setEnabled("nextbreak",true);
                     IC.setEnabled("oneforward",true);
                     IC.setEnabled("allback",false);
                     if (haveBreaks() && !Last.isBreak()) iconPressed("nextbreak");
              }
              else if (o.equals("allforward"))
              {      if (Last!=null && Last instanceof TextObject)
                            ((TextObject)Last).setDoShow(false);
                     ZC.paintUntil(null);
                     Last=null;
                     IC.setEnabled("allforward",false);
                     IC.setEnabled("nextbreak",false);
                     IC.setEnabled("oneforward",false);
                     IC.setEnabled("allback",true);
              }
              else if (o.equals("nextbreak"))
              {      if (Last!=null && Last instanceof TextObject)
                            ((TextObject)Last).setDoShow(false);
                     Enumeration e=ZC.getConstruction().elements();
                     outer: while (e.hasMoreElements())
                     {      ConstructionObject next=(ConstructionObject)e.nextElement();
                            if (next==Last)
                                   while (e.hasMoreElements())
                                   {      Last=(ConstructionObject)e.nextElement();
                                          if (Last==null || Last.isBreak()) break outer;
                                   }
                     }
                     IC.setEnabled("allback",true);
                     if ((Last instanceof TextObject) && Last.valid()
                            && !Last.isSuperHidden())
                     {      ((TextObject)Last).setDoShow(true);
                     }
                     ZC.paintUntil(Last);
                     IC.setEnabled("allback",true);
                     IC.setEnabled("nextbreak",e.hasMoreElements());
                     IC.setEnabled("allforward",e.hasMoreElements());
              }
              else if (o.equals("oneforward"))
              {      if (Last!=null && Last instanceof TextObject)
                            ((TextObject)Last).setDoShow(false);
                     Enumeration e=ZC.getConstruction().elements();
                     outer: while (e.hasMoreElements())
                     {      ConstructionObject next=(ConstructionObject)e.nextElement();
                            if (next==Last)
                                   while (e.hasMoreElements())
                                   {      Last=(ConstructionObject)e.nextElement();
                                          if (Last==null || !Last.isHidden()) break outer;
                                          if ((Last instanceof TextObject) && Last.valid()
                                                 && !Last.isSuperHidden())
                                          {      ((TextObject)Last).setDoShow(true);
                                                 break outer;
                                          }
                                   }
                     }
                     IC.setEnabled("allback",true);
                     ZC.paintUntil(Last);
                     if (!e.hasMoreElements())
                     {      ZC.paintUntil(null);
                            IC.setEnabled("allforward",false);
                            IC.setEnabled("oneforward",false);
                            IC.setEnabled("allback",true);
                     }
              }
              else if (IB.isControlPressed() || IA.isControlPressed())
              {      int i=CurrentTool;
                     if (o.equals("objecttracker"))
                     {      track();
                     }
                     settool(i);
              }      
              IA.clearShiftControl();
              IB.clearShiftControl();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.init ( ) [inline]

Definition at line 66 of file ZirkelApplet.java.

       {      
              
              String lang=getParameter("language");   
              if (lang!=null){
                  System.out.println("lang="+getParameter("language"));
                  try
                  {  
                     Locale.setDefault(new Locale(lang,""));
                  }
                  catch (RuntimeException e) {}
                  //jm.evers
                  Global.initBundle("rene/zirkel/docs/ZirkelProperties_"+lang);
              }
              else
              {
                  Global.initBundle("rene/zirkel/docs/ZirkelProperties");
              }

              Count.resetAll();
              CC=C=Global.Background;
              initLightColors();
              initObjectKeys();
              Dimension dscreen=getToolkit().getScreenSize();
              F=new Frame();
              F.setSize(dscreen);
              
              if (getParameter("oldicons")==null)
              {      Global.setParameter("iconpath","/rene/zirkel/newicons/");
                     Global.setParameter("iconsize",getParameter("smallicons")==null?32:24);
                     Global.setParameter("icontype","png");
              }
              else
              {      Global.setParameter("iconpath","/rene/zirkel/icons/");
                     Global.setParameter("iconsize",20);
              }      
              
              String color=getParameter("color");
              if (color!=null)
              {      StringParser p=new StringParser(getParameter("color"));
                     p.replace(',',' ');
                     int red,green,blue;
                     red=p.parseint(); green=p.parseint(); blue=p.parseint();
                     C=new Color(red,green,blue);
                     Global.Background=C;
                     Global.ControlBackground=C;
                     CC=C;
              }
              
              color=getParameter("colorbackground");
              if (color!=null) Global.setParameter("colorbackground",color);
              else Global.removeParameter("colorbackground");
              color=getParameter("colorselect");
              if (color!=null) Global.setParameter("colorselect",color);
              else Global.removeParameter("colorselect");
              ZirkelFrame.SelectColor=Global.getParameter("colorselect",Color.red);
              color=getParameter("colortarget");
              if (color!=null) Global.setParameter("colortarget",color);
              else Global.removeParameter("colortarget");
              ZirkelFrame.TargetColor=Global.getParameter("colorselect",Color.pink);
              ZirkelFrame.initLightColors(Color.white);                      
              
              
              String font=getParameter("font");
              if (font!=null)
              {      if (font.indexOf("bold")>=0)
                            Global.setParameter("font.bold",true);
                     if (font.indexOf("large")>=0)
                            Global.setParameter("font.large",true);                        
              }
              
              if (getParameter("demo")!=null)
              {      initDemo();
                     return;
              }
              
              String style=getParameter("style");
              if (style==null) style="plain";
              
              boolean simple=(style.equals("plain") || style.equals("3D") ||
                     style.equals("breaks"));
              edit=!simple;
              boolean status=(style.equals("full") || style.equals("status"));
              boolean icons=(style.equals("full") || style.equals("nonvisual")
                     || style.equals("icons") );
              boolean breaks=(style.equals("breaks"));
              
              if (getParameter("edit")!=null) edit=true;
              
              for (int i=0; i<ZirkelFrame.Colors.length; i++)
              {      color=getParameter("color"+i);
                     if (color!=null) Global.setParameter("color"+i,color);
                     else Global.removeParameter("color"+i);
              }
              
              ZirkelFrame.initLightColors(Color.white);                      
              setLayout(new BorderLayout());

              Tools=getParameter("tools");
              if (Tools==null || Tools.equals("defaults")) Tools=DefaultIcons;
              
              Options=getParameter("options");
              if (Options==null || Options.equals("defaults")) Options=DefaultOptions;
              
              Global.setParameter("macrobar",Options.indexOf("macrobar")>=0);
              makeMacroBar();
              
              if (icons)
              {      IB=new IconBar(F);
                     IB.setBackground(CC);
                     IB.setIconBarListener(this);
                     StringTokenizer t=new StringTokenizer(Tools);
                     int count=0;
                     while (t.hasMoreTokens())
                     {      t.nextToken(); count++;
                     }
                     String a[]=new String[count];
                     t=new StringTokenizer(Tools);
                     count=0;
                     while (t.hasMoreTokens())
                     {      a[count++]=t.nextToken();
                     }
                     if (count>0) FirstConstructor=a[0];
                     IB.addToggleGroupLeft(a);
                     IB.addSeparatorLeft();
                     if (Options.indexOf("twolines")>=0 || Options.indexOf("defaults")>=0)
                     {      IA=new IconBar(F);
                            IA.setBackground(CC);
                            IA.setIconBarListener(this);
                            setIA(IA,Options);
                            Panel north=new Panel();
                            north.setBackground(CC);
                            north.setLayout(new GridLayout(0,1));
                            north.add(IA);
                            north.add(IB);
                            if (IM!=null) north.add(IM);
                            add("North",new Panel3D(north,CC));
                     }
                     else
                     {      IA=IB;
                            setIA(IB,Options);
                            if (IM!=null)
                            {      Panel north=new Panel();
                                   north.setBackground(CC);
                                   north.setLayout(new GridLayout(0,1));
                                   north.add(IA);
                                   if (IM!=null) north.add(IM);
                                   add("North",new Panel3D(north,CC));                                   
                            }
                            else
                            {      add("North",new Panel3D(IB,CC));
                            }
                     }
              }
              else IA=IB=null;
              
              Global.setParameter("options.intersection",false);
              Global.setParameter("options.pointon",false);
              Global.setParameter("options.choice",false);
              
              if (Options.indexOf("qchoice")>=0)
              {      Global.setParameter("options.choice",true);
              }
              if (Options.indexOf("qintersection")>=0)
              {      Global.setParameter("options.intersection",true);
              }
              if (Options.indexOf("qpointon")>=0)
              {      Global.setParameter("options.pointon",true);
              }
              Global.setParameter("options.indicate",true);
              Global.setParameter("options.indicate.simple",Options.indexOf("noindicate")>=0);
              
              if (getParameter("selectionsize")!=null)
              {      try
                     {      double x=new Double(getParameter("selectionsize")).doubleValue();
                            Global.setParameter("selectionsize",x);
                     }
                     catch (Exception e) {}
              }

              ZC=new ZirkelCanvas(!edit,!breaks,!breaks);
              ZC.addMouseListener(ZC);
              ZC.addMouseMotionListener(ZC);
              ZC.setBackground(Global.getParameter("colorbackground",C));
              ZC.setFrame(F);
              ZC.setZirkelCanvasListener(this);
              if (getParameter("showhidden")!=null) ZC.setShowHidden(true);
              if (style.equals("plain")) add("Center",ZC);
              else add("Center",new Panel3D(ZC,ZC.getBackground()));
              ZC.addStatusListener(this);
              ZC.addKeyListener(this);
              
              setShowNames(false);
              
              if (status)
              {      Status=new Label("");
                     Status.setBackground(CC);
                     add("South",new Panel3D(Status,Status.getBackground()));
              }
              else if (style.equals("nonvisual"))
              {      Input=new HistoryTextField(this,"Input");
                     ZC.setTextField(Input);
                     ZC.Visual=false;
                     setShowNames(true);
                     add("South",new Panel3D(Input));
              }
              
              try
              {      Global.setParameter("digits.edit",
                            Integer.parseInt(getParameter("editdigits")));
              }
              catch (Exception e) {}
              try
              {      Global.setParameter("digits.lengths",
                            Integer.parseInt(getParameter("displaydigits")));
              }
              catch (Exception e) {}
              try
              {      Global.setParameter("digits.angles",
                            Integer.parseInt(getParameter("angledigits")));
              }
              catch (Exception e) {}
              
              setOption("movename");
              setOption("movefixname");
              ZC.updateDigits();
              
              setOption("nopopupmenu");
              setOption("nomousezoom");
                            
              try
              {      Global.setParameter("minpointsize",
                            new Double(getParameter("minpointsize")).doubleValue());
              }
              catch (Exception e) {}
              try
              {      Global.setParameter("minlinesize",
                            new Double(getParameter("minlinewidth")).doubleValue());
              }
              catch (Exception e) {}
              try
              {      Global.setParameter("minfontsize",
                            new Double(getParameter("minfontsize")).doubleValue());
              }
              catch (Exception e) {}
              try
              {      Global.setParameter("arrowsize",
                            new Double(getParameter("arrowsize")).doubleValue());
              }
              catch (Exception e) {}

              try
              {      String grid=getParameter("grid");
                     ZC.ShowGrid=!grid.equals("none");
                     Global.setParameter("grid.fine",grid.equals("coordinates"));
                     if ( getParameter("snap").equalsIgnoreCase("left") || getParameter("snap").equalsIgnoreCase("yes") ){
                            Global.setParameter("grid.leftsnap",true);
                     }
                     else
                     {
                         Global.setParameter("grid.leftsnap",false);
                     }
              }
              catch (Exception e) {}

              if (getParameter("interactive")!=null && 
                     getParameter("interactive").equals("false"))
                            ZC.setInteractive(false);

              boolean job=false;

              ZC.IW=getSize().width;
              ZC.IH=getSize().height;
              
              if (getParameter("germanpoints")!=null
                     && getParameter("germanpoints").equals("true"))
                            Global.setParameter("options.germanpoints",true);
              // jm.evers          
              String c=getParameter("background_image");
              if (c!=null && c.length()>0) {
                  URL url;
                  try {url=new URL(c);}
                  catch (MalformedURLException e) {url=null;}
                  if(url!=null){
                     //System.out.println("trying:"+url);
                     try{
                         Image i=getToolkit().getImage(url);
                         MediaTracker mt=new MediaTracker(this);
                         mt.addImage(i,0);
                         mt.waitForID(0);
                         if (mt.checkID(0) && !mt.isErrorAny()){
                            ZC.setBackground(i);ZC.repaint();
                            Global.setParameter("background.usesize",true);  
                         }
                     }
                     catch (Exception e) { System.out.println("Image could not be loaded"); }            
                  }
              }

              c=getParameter("x_axis_text");
              if(c!=null && c.length()>0){xaxis_text=c;}
              c=getParameter("y_axis_text");
              if(c!=null && c.length()>0){yaxis_text=c;}
              c=getParameter("y_axis_text_vertical");
              if(c!=null && c.length()>0){
                  if(c.equalsIgnoreCase("yes") || c.equalsIgnoreCase("true") ){yaxis_text_vertical=true;}else{yaxis_text_vertical=false;}
              }
              c=getParameter("xaxis_variable");
              if(c!=null && c.length()>0){xaxis_variable=c;}
              c=getParameter("yaxis_variable");
              if(c!=null && c.length()>0){yaxis_variable=c;}
              c=getParameter("decimals");
              if(c!=null && c.length()>0){decimals=Integer.parseInt(c,10);}
              
              // end jm.evers
                            
              filename=getParameter("file");
              if (filename==null)
              {      filename=getParameter("job");
                     job=true;
              }
              if (filename!=null)
              {      boolean firsttry=true;
                     while (true)
                     {      try
                            {      URL url;
                                   if (filename.toUpperCase().startsWith("HTTP"))
                                          url=new URL(
                                                 firsttry?FileName.toURL(filename):filename);
                                   else
                                          url=new URL(getCodeBase(),
                                                 firsttry?FileName.toURL(filename):filename);
                                   
                                   ZC.clear();
                                   InputStream in=url.openStream();
                                   if (ZirkelFrame.isCompressed(filename))
                                          in=new GZIPInputStream(in);
                                   showStatus(Global.name("loading"));
                                   ZC.load(in);
                                   toggleGrid(ZC.ShowGrid);
                                   if (job)
                                   {      ZC.displayJob(true);
                                          ZC.setDoneListener(this);
                                   }
                                   if (icons) iconPressed(FirstConstructor);
                                   in.close();
                                   if (getParameter("background")!=null)
                                   {
                                       Image i=getToolkit().getImage(new URL(getCodeBase(),
                                                 getParameter("background")));
                                          MediaTracker mt=new MediaTracker(this);
                                          mt.addImage(i,0);
                                          mt.waitForID(0);
                                          if (mt.checkID(0) && !mt.isErrorAny())
                                          {      ZC.setBackground(i);
                                          }
                                   }
                                   ZC.repaint();
                            }
                            catch (Exception e)
                            {      if (firsttry)
                                   {      firsttry=false; continue;
                                   }
                                   Warning w=new Warning(F,FileName.chop(32,""+e,64),
                                          Zirkel.name("message"),true);
                                   w.center(F);
                                   w.setVisible(true);
                                   showStatus(""+e);
                                   e.printStackTrace();
                                   System.out.println(e);
                            }
                            break;
                     }
              }

              if (breaks)
              {      IC=new IconBar(F);
                     IC.setBackground(CC);
                     IC.setIconBarListener(this);
                     IC.addLeft("allback");
                     if (haveBreaks()) IC.addLeft("nextbreak");
                     else IC.addLeft("oneforward");
                     IC.addLeft("allforward");
                     Panel pic=new Panel3D(IC);
                     add("South",pic);
                     IC.setEnabled("nextbreak",false);
                     IC.setEnabled("oneforward",false);
                     IC.setEnabled("allforward",false);
                     ZC.getConstruction().setOriginalOrder(true);
                     jumptostart=(getParameter("jumptostart")!=null);
              }

              if (getParameter("restrictedmove")!=null)
              {      Global.setParameter("restrictedmove",true);
              }
              
              if (getParameter("noconfirmation")!=null)
              {      Global.setParameter("confirmation",false);
              }
              
              if (IA!=null) settype(2);
              ZC.setMacroBar(IM);
              ZC.updateMacroBar();
              ZC.recompute();
              ZC.repaint();
       }

Here is the call graph for this function:

void rene.zirkel.ZirkelApplet.initDemo ( ) [inline, package]

Definition at line 483 of file ZirkelApplet.java.

       {      setLayout(new BorderLayout());

              ZC=new ZirkelCanvas(false,false,false);
              ZC.setBackground(Global.getParameter("colorbackground",C));
              ZC.setFrame(F);
              ZC.setZirkelCanvasListener(this);
              if (getParameter("showhidden")!=null) ZC.setShowHidden(true);
              add("Center",new Panel3D(ZC,ZC.getBackground()));

              Status=new Label("",Label.CENTER);
              Status.setBackground(C);
              add("South",new Panel3D(Status,Status.getBackground()));
              
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 978 of file ZirkelApplet.java.

       {      int n=ZirkelFrame.Colors.length;
              ZirkelFrame.LightColors=new Color[n];
              Color back=C;
              int red=back.getRed(),green=back.getGreen(),blue=back.getBlue();
              double lambda=0.4;
              for (int i=0; i<n; i++)
              {      int r=(int)(red*(1-lambda)+ZirkelFrame.Colors[i].getRed()*lambda);
                     int g=(int)(green*(1-lambda)+ZirkelFrame.Colors[i].getGreen()*lambda);
                     int b=(int)(blue*(1-lambda)+ZirkelFrame.Colors[i].getBlue()*lambda);
                     ZirkelFrame.LightColors[i]=new Color(r,g,b);
              }
       }

Here is the caller graph for this function:

Definition at line 992 of file ZirkelApplet.java.

       {      ZirkelFrame.ObjectKeys=new char[ZirkelFrame.ObjectStrings.length];
              for (int i=0; i<ZirkelFrame.ObjectStrings.length; i++)
              {      String shortcut=Zirkel.name("shortcuts."+ZirkelFrame.ObjectStrings[i]);
                     if (shortcut.length()>0)
                            ZirkelFrame.ObjectKeys[i]=shortcut.charAt(0);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

For external scripting: Interprets a command s using the internal construction language.

(Expl: "A=point()")

Parameters:
s
Returns:
Command executed or not

Definition at line 1312 of file ZirkelApplet.java.

       {      try
              {      ZC.getConstruction().interpret(ZC,s);
                     ZC.repaint();
                     return true;
              }
              catch (ConstructionException e) 
              {      return false;
              }
       }

Here is the call graph for this function:

void rene.zirkel.ZirkelApplet.itemAction ( String  o,
boolean  flag 
) [inline]

Definition at line 1139 of file ZirkelApplet.java.

       {      
       }
void rene.zirkel.ZirkelApplet.keyPressed ( KeyEvent  e) [inline]

Definition at line 838 of file ZirkelApplet.java.

{}
void rene.zirkel.ZirkelApplet.keyReleased ( KeyEvent  e) [inline]

Definition at line 839 of file ZirkelApplet.java.

       {      int code=e.getKeyCode();
              int i;
              boolean Shift=e.isShiftDown(),Control=e.isControlDown(),Alt=e.isAltDown();
              if (Control)
              {      if (Options.indexOf("type")>0)
                            for (i=0; i<ZirkelFrame.PointKeys.length; i++)
                            {      if (ZirkelFrame.PointKeys[i]==code)
                                   {      settype(i);
                                          return;
                                   }
                            }
                     if (Options.indexOf("color")>0)
                            for (i=0; i<ZirkelFrame.ColorKeys.length; i++)
                            {      if (ZirkelFrame.ColorKeys[i]==code)
                                   {      setcolor(i);
                                          return;
                                   }
                            }
              }
              else if (Alt)
              {      if (Options.indexOf("showcolor")>0)
                            for (i=0; i<ZirkelFrame.ColorKeys.length; i++)
                            {      if (ZirkelFrame.ColorKeys[i]==code)
                                   {      showcolor(i);
                                          return;
                                   }
                            }
                     if (Options.indexOf("thickness")>0)
                            for (i=0; i<ZirkelFrame.ColorTypeKeys.length; i++)
                            {      if (ZirkelFrame.ColorTypeKeys[i]==code)
                                   {      setcolortype(i);
                                          return;
                                   }
                            }
              }
              else
              {      switch (code)
                     {      case KeyEvent.VK_ESCAPE :
                                   if (ZC.getCurrentTool() instanceof DrawerTool) ZC.clearDrawings();
                                   else ZC.reset(); 
                                   break;
                            case KeyEvent.VK_ENTER :
                                   if (Shift) track(); 
                                   break;
                     }
              }
              if (!e.isActionKey()) return;
              switch (code)
              {      case KeyEvent.VK_F1 :
                            showVersion();
                            break;
                     case KeyEvent.VK_F7 :
                            if (Shift || Control)
                            {      setShowNames(!IA.getState("showname"));
                            }
                            break;
                     case KeyEvent.VK_F8 :
                            if (Shift || Control)
                            {      setLongNames(!IA.getState("longnames"));
                            }
                            break;
                     case KeyEvent.VK_F9 :
                            if (Shift || Control)
                            {      IA.setState("partial",!IA.getState("partial"));
                                   ZC.setPartial(IA.getState("partial"));
                            }
                            else
                            {      if (Options.indexOf("hidden")<0) break;
                                   IA.setState("hidden",!IA.getState("hidden"));
                                   ZC.setShowHidden(IA.getState("hidden"));
                            }
                            break;
                     case KeyEvent.VK_F10 :
                            if (Shift || Control)
                            {      IA.setState("plines",!IA.getState("plines"));
                                   ZC.setPartial(IA.getState("plines"));
                            }
                            else showcomment();
                            break;
                     case KeyEvent.VK_F11 :
                            if (Shift || Control)
                            {      IA.setState("arrow",!IA.getState("arrow"));
                                   ZC.setPartial(IA.getState("arrow"));
                            }
                            else showconstruction();
                            break;
                     case KeyEvent.VK_F12 :
                            if (Shift || Control)
                            {      IA.setState("obtuse",!IA.getState("obtuse"));
                                   ZC.setObtuse(IA.getState("obtuse"));
                            }
                            else toggleGrid();
                            break;
                     case KeyEvent.VK_LEFT :
                            if (Shift && ZC.getCurrentTool() instanceof ObjectTracker)
                                   ((ObjectTracker)ZC.getCurrentTool()).increaseOmit();
                            else if (Shift && ZC.getCurrentTool() instanceof BreakpointAnimator)
                                   ((BreakpointAnimator)ZC.getCurrentTool()).decreaseSpeed(); 
                            else if (Shift && ZC.getCurrentTool() instanceof AnimatorTool)
                                   ((AnimatorTool)ZC.getCurrentTool()).decreaseSpeed(); 
                            else ZC.shift(-0.2,0); 
                            break;
                     case KeyEvent.VK_RIGHT :
                            if (Shift && ZC.getCurrentTool() instanceof ObjectTracker)
                                   ((ObjectTracker)ZC.getCurrentTool()).decreaseOmit();
                            else if (Shift && ZC.getCurrentTool() instanceof BreakpointAnimator)
                                   ((BreakpointAnimator)ZC.getCurrentTool()).increaseSpeed(); 
                            else if (Shift && ZC.getCurrentTool() instanceof AnimatorTool)
                                   ((AnimatorTool)ZC.getCurrentTool()).increaseSpeed(); 
                            else ZC.shift(0.2,0); 
                            break;
                     case KeyEvent.VK_UP :
                            ZC.shift(0,0.2); break;
                     case KeyEvent.VK_DOWN :
                            ZC.shift(0,-0.2); break;
              }
       }

Here is the call graph for this function:

void rene.zirkel.ZirkelApplet.keyTyped ( KeyEvent  e) [inline]

Definition at line 957 of file ZirkelApplet.java.

       {      char c=e.getKeyChar();
              if (e.isControlDown() || e.isAltDown()) return;
              int i;
              for (i=0; i<ZirkelFrame.ObjectKeys.length; i++)
              {      if (c==ZirkelFrame.ObjectKeys[i])
                     {      if (Tools.indexOf(ZirkelFrame.ObjectStrings[i])>=0)
                                   settool(i);
                            return;
                     }
              }
              switch (c)
              {      case KeyEvent.VK_BACK_SPACE :
                            ZC.undo();
                            ZC.repaint();
                            return;
                     case '+' : ZC.magnify(1/Math.sqrt(Math.sqrt(2))); break;
                     case '-' : ZC.magnify(Math.sqrt(Math.sqrt(2))); break;
              }
       }

Here is the call graph for this function:

Implements rene.zirkel.ZirkelCanvasInterface.

Definition at line 1285 of file ZirkelApplet.java.

                                 {
              return null;
       }

Definition at line 1114 of file ZirkelApplet.java.

       {      setcolor(ZC.getDefaultColor());
              settype(ZC.getDefaultType());
              setcolortype(ZC.getDefaultColorType());
              IA.setState("partial",ZC.getPartial());
              IA.setState("plines",ZC.getPartialLines());
              IA.setState("arrow",ZC.getVectors());
              ZC.setHidden(false);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 548 of file ZirkelApplet.java.

       {      if (Global.getParameter("macrobar",true))
              {      IM=new MacroBar(F);
                     IM.addKeyListener(this); 
                     IM.setIconBarListener(this);
                     IM.setBackground(CC);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1002 of file ZirkelApplet.java.

       {      repaint();
              try
              {      Thread.sleep(500);
              }
              catch (Exception e) {}
              if (Global.getParameter("confirmation",true))
              {      Warning w=new Warning(F,Zirkel.name("done"),
                            Zirkel.name("message"),true);
                     w.center(F);
                     w.setVisible(true);
              }
              String sol=getParameter("solution");
              if (sol!=null)
              {      try
                     {      AppletContext ac=getAppletContext();
                            ac.showDocument(new URL(getCodeBase(),FileName.toURL(sol)));
                     }
                     catch (Exception e)
                     {      System.out.println(e);
                            e.printStackTrace();
                     }
              }
       }

Here is the call graph for this function:

For external scripting: Receives the construction as an XML stream, contained in a string.

Parameters:
s
Returns:
Success

Definition at line 1916 of file ZirkelApplet.java.

       {
           System.out.println("trying:"+s);      
           try
              {      ByteArrayOutputStream bout=new ByteArrayOutputStream();
                     PrintWriter out=new PrintWriter(new OutputStreamWriter(bout,"utf-8"));
                     out.print(s);
                     out.close();
                     byte b[]=bout.toByteArray();
                     InputStream in=new ByteArrayInputStream(b);
                     ZC.load(in,true,true);
                     System.out.println("loaded "+in);
                     return true;
              }
              catch (Exception e)
              {      e.printStackTrace();
                     System.out.println("error"+e);
                     return false;
              }
       }

Here is the call graph for this function:

Definition at line 1253 of file ZirkelApplet.java.

       {      if (RD!=null) return;
              RD=new Replay(F,ZC)
                     {      public void doclose ()
                            {      RD=null;
                                   super.doclose();
                            }
                     };
              Dimension d=getToolkit().getScreenSize();
              RD.setLocation(d.width-100-RD.getSize().width,100);
              ZC.OC.invalidate(ZC);
              RD.setVisible(true);
       }

Here is the caller graph for this function:

Implements rene.zirkel.ZirkelCanvasInterface.

Definition at line 1267 of file ZirkelApplet.java.

       {      replay();
       }

Here is the call graph for this function:

static double rene.zirkel.ZirkelApplet.roundit ( double  x) [inline, static]

Definition at line 1354 of file ZirkelApplet.java.

                                          {
       int rounder=(int) Math.pow((double)10,(double)decimals);
       double rounded=(int)(Math.round(rounder*x));
       return rounded/rounder;
    }

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.runmacro ( boolean  shift) [inline]

Definition at line 1056 of file ZirkelApplet.java.

       {      Macro m=null;
              if (OldMacro==null && ZC.getMacros().size()==1)
                     m=((MacroItem)ZC.getMacros().elementAt(0)).M;
              else
              {      m=ZC.chooseMacro(OldMacro);
                     if (!shift || m==null) m=ZC.chooseMacro();
              }
              if (m==null)
              {      settool(CurrentTool); return;
              }
              runMacro(m);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.runMacro ( Macro  m) [inline]

Implements rene.zirkel.ZirkelCanvasInterface.

Definition at line 1070 of file ZirkelApplet.java.

       {      ((MacroRunner)ObjectConstructors[ZirkelFrame.NMacro]).
                     setMacro(m,ZC);
              settool(ZirkelFrame.NMacro);
              if (IM!=null) IM.select(m);
              IB.setMultipleState("macro",0);
              OldMacro=m.getName();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.setcolor ( int  c) [inline]

Definition at line 818 of file ZirkelApplet.java.

       {      IA.setMultipleState("color",c);
              ZC.setDefaultColor(c);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.setcolortype ( int  c) [inline]

Definition at line 828 of file ZirkelApplet.java.

       {      IA.setMultipleState("thickness",c);
              ZC.setDefaultColorType(c);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.setIA ( IconBar  IA,
String  set 
) [inline, package]

Definition at line 499 of file ZirkelApplet.java.

       {      if (set.indexOf("back")>=0)
                     IA.addLeft("back");
              if (set.indexOf("delete")>=0)
                     IA.addToggleLeft("delete");
              if (set.indexOf("undo")>=0)
                     IA.addLeft("undo");
              if (set.indexOf("hidden")>=0)
                     IA.addOnOffLeft("hidden");
              if (set.indexOf("showcolor")>=0)
                     IA.addMultipleIconLeft("showcolor",ZirkelFrame.Colors.length);
              if (set.indexOf("color")>=0)
                     IA.addMultipleIconLeft("color",6);
              if (set.indexOf("type")>=0)
                     IA.addMultipleIconLeft("type",4);
              if (set.indexOf("thickness")>=0)
                     IA.addMultipleIconLeft("thickness",3);
              if (set.indexOf("partial")>=0)
                     IA.addOnOffLeft("partial");
              if (set.indexOf("plines")>=0)
                     IA.addOnOffLeft("plines");
              if (set.indexOf("arrow")>=0)
                     IA.addOnOffLeft("arrow");
              if (set.indexOf("showname")>=0)
                     IA.addOnOffLeft("showname");
              if (set.indexOf("showvalue")>=0)
                     IA.addOnOffLeft("showvalue");
              if (set.indexOf("edit")>=0)
                     IA.addToggleLeft("edit");
              if (set.indexOf("obtuse")>=0)
                     IA.addOnOffLeft("obtuse");
              if (set.indexOf("solid")>=0)
                     IA.addOnOffLeft("solid");
              if (set.indexOf("grid")>=0)
                     IA.addOnOffLeft("grid");
              if (set.indexOf("macro")>=0)
                     IA.addMultipleToggleIconLeft("macro",3);
              if (set.indexOf("replay")>=0)
                     IA.addLeft("replay");
              if (set.indexOf("zoom")>=0)
                     IA.addToggleLeft("zoom");
              if (set.indexOf("comment")>=0)
                     IA.addLeft("comment");
              if (set.indexOf("function")>=0)
                     IA.addLeft("function");
              if (set.indexOf("draw")>=0)
                     IA.addToggleLeft("draw");
       }

Here is the caller graph for this function:

Definition at line 1103 of file ZirkelApplet.java.

       {      IA.setState("longnames",flag);
              Global.setParameter("options.longnames",flag);
              ZC.setLongNames(flag);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1085 of file ZirkelApplet.java.

       {      IA.setState("obtuse",flag);
              Global.setParameter("options.obtuse",flag);
              ZC.setObtuse(flag);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.setOption ( String  option) [inline]

Definition at line 473 of file ZirkelApplet.java.

       {      try
              {      Global.setParameter("options."+option,
                            getParameter(option).equals("true"));
              }
              catch (Exception e) {}
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1079 of file ZirkelApplet.java.

       {      if (IA!=null) IA.setState("showname",flag);
              Global.setParameter("options.shownames",flag);
              ZC.setShowNames(flag);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1097 of file ZirkelApplet.java.

       {      IA.setState("showvalue",flag);
              Global.setParameter("options.showvalue",flag);
              ZC.setShowValues(flag);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.setSolid ( boolean  flag) [inline]

Definition at line 1091 of file ZirkelApplet.java.

       {      IA.setState("solid",flag);
              Global.setParameter("options.solid",flag);
              ZC.setSolid(flag);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.settool ( int  i) [inline]

Definition at line 795 of file ZirkelApplet.java.

       {      if (IM!=null) IM.deselectAll();
              ZC.setTool(ObjectConstructors[i]);
              CurrentTool=i;
              if (i<ZirkelFrame.IconNumber  && IB.have(ZirkelFrame.ObjectStrings[i]))
                     IB.toggle(ZirkelFrame.ObjectStrings[i]);
              else
                     IB.unselect(FirstConstructor);
              ObjectConstructors[i].resetFirstTime(ZC); 
              if (i==ZirkelFrame.NTargets) IA.setMultipleState("macro",2);
              else if (i==ZirkelFrame.NParameters) IA.setMultipleState("macro",1);
              else
              {      IA.setMultipleState("macro",0);
                     IA.setState("macro",false);
              }
              IA.setState("delete",i==ZirkelFrame.NDelete);
              IA.setState("edit",i==ZirkelFrame.NEdit);
              IA.setState("draw",i==ZirkelFrame.NDraw);
              IA.setState("rename",i==ZirkelFrame.NRename);
              IA.setState("zoom",i==ZirkelFrame.NZoom);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.settype ( int  c) [inline]

Definition at line 823 of file ZirkelApplet.java.

       {      IA.setMultipleState("type",c);
              ZC.setDefaultType(c);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.showcolor ( int  c) [inline]

Definition at line 1027 of file ZirkelApplet.java.

       {      ZC.setShowColor(c);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1031 of file ZirkelApplet.java.

       {      if (F==null) return;
              CommentDialog d=new CommentDialog(F,
                     ZC.getComment(),Zirkel.name("comment.title"),ZC.displayJob());
              ZC.setComment(d.getText());
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1038 of file ZirkelApplet.java.

       {      if (F==null) return;
       }

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.showStatus ( String  s) [inline]

Definition at line 833 of file ZirkelApplet.java.

       {      super.showStatus(s);
              if (Status!=null) Status.setText(s);
       }

Here is the caller graph for this function:

Definition at line 1237 of file ZirkelApplet.java.

       {      showStatus(
                     Zirkel.name("program.name")+" "+Zirkel.name("program.version")
                     +" "+Zirkel.name("program.date"));
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.zirkel.ZirkelApplet.start ( ) [inline]

Definition at line 1145 of file ZirkelApplet.java.

       {      if (getParameter("demo")!=null)
              {      DR=new DemoRunner(ZC,this,getParameter("demo"),Status);
                     return;
              }
              Construction C=ZC.getConstruction();
              ZC.paint(ZC.getGraphics());
              ZC.allowRightMouse(true);
              if (C.TrackP!=null)
              {      try
                     {      ConstructionObject
                                   P=C.find(C.TrackP);
                            if (!((P instanceof PointObject) 
                                   || (P instanceof PrimitiveLineObject)))
                                          throw new ConstructionException("");                           
                            ConstructionObject po[]=
                                   new ConstructionObject[C.TrackPO.size()];
                            for (int i=0; i<po.length; i++)
                            {      ConstructionObject o=C.find(
                                          (String)C.TrackPO.elementAt(i));
                                   if (o==null || !((o instanceof PointObject) 
                                          || (o instanceof PrimitiveLineObject)))
                                                 throw new ConstructionException("");
                                   po[i]=o;
                            }
                            PointObject PM=null;
                            if (C.TrackPM!=null)
                                   PM=(PointObject)C.find(C.TrackPM);
                            if (C.TrackO!=null)
                            {      ConstructionObject O=C.find(C.TrackO);
                                   if (P==null || (PM==null && (O instanceof ExpressionObject)) || O==null)
                                          throw new ConstructionException("");
                                   ObjectTracker ot=new ObjectTracker(P,PM,O,ZC,
                                          C.Animate,C.Paint,po);
                                   if (C.Animate) ot.Interactive=false;
                                   ot.setOmit(C.Omit);
                                   ZC.setTool(ot);
                                   if (!edit) ZC.allowRightMouse(false);
                                   ZC.validate();
                                   ZC.repaint();
                            }
                            else
                            {      if (P==null)
                                          throw new ConstructionException("");
                                   ZC.setTool(new Tracker(P,po));
                                   if (PM!=null) PM.setSelected(true);
                                   ZC.validate();
                                   ZC.repaint();
                            }
                     }
                     catch (Exception e)
                     {      
                     }                    
              }
              else if (C.AnimateP!=null)
              {      try
                     {      PointObject
                                   P=(PointObject)C.find(C.AnimateP);
                            if (P==null || !P.moveable())
                                   throw new ConstructionException("");
                            Enumeration e=C.AnimateV.elements();
                            while (e.hasMoreElements())
                            {      String s=(String)e.nextElement();
                                   ConstructionObject o=C.find(s);
                                   if (o==null || !(o instanceof SegmentObject
                                          || o instanceof PrimitiveCircleObject
                                          || o instanceof PointObject))
                                                 throw new ConstructionException("");                           
                            }
                            ZC.setTool(A=new AnimatorTool(P,C.AnimateV,ZC,C.AnimateNegative,
                                          C.AnimateOriginal,C.AnimateDelay));
                            ZC.allowRightMouse(false);
                            A.setInteractive(false);
                     }
                     catch (Exception e)
                     {      // e.printStackTrace();
                     }                    
              }
              else if (C.AnimateBreakpoints)
              {      BreakpointAnimator bp=new BreakpointAnimator();
                     bp.setLoop(C.AnimateLoop);
                     bp.setSpeed(C.AnimateTime);
                     ZC.allowRightMouse(false);
                     ZC.setTool(bp);
                     bp.reset(ZC);
              }
              else if (jumptostart)
              {      System.out.println("here");
                     iconPressed("allback");
              }
       }

Here is the call graph for this function:

void rene.zirkel.ZirkelApplet.stop ( ) [inline]

Definition at line 1243 of file ZirkelApplet.java.

       {      ZC.invalidate();
              if (DR!=null) DR.stop();
       }

Here is the call graph for this function:

static String [] rene.zirkel.ZirkelApplet.StringToArray ( String  str) [inline, static]

Definition at line 1397 of file ZirkelApplet.java.

    {
        StringTokenizer t = new StringTokenizer(str, ",");
        String array[] = new String[t.countTokens()];
        for(int i = 0; t.hasMoreTokens(); i++)
            array[i] = t.nextToken();

        return array;
    }

Here is the caller graph for this function:

Definition at line 1042 of file ZirkelApplet.java.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1109 of file ZirkelApplet.java.

       {      ZC.setShowGrid(grid);
              if (IA!=null) IA.setState("grid",grid);
       }

Here is the call graph for this function:

void rene.zirkel.ZirkelApplet.track ( ) [inline]

Definition at line 1937 of file ZirkelApplet.java.

       {      if (ZC.getCurrentTool() instanceof ObjectTracker &&
              ((ObjectTracker)ZC.getCurrentTool()).isComplete())
              {      ((ObjectTracker)ZC.getCurrentTool()).keep(ZC); 
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 557 of file ZirkelApplet.java.

Here is the call graph for this function:


Member Data Documentation

AnimatorTool rene.zirkel.ZirkelApplet.A = null [package]

Definition at line 1143 of file ZirkelApplet.java.

Color rene.zirkel.ZirkelApplet.C [package]

Definition at line 38 of file ZirkelApplet.java.

Color rene.zirkel.ZirkelApplet.CC [package]

Definition at line 38 of file ZirkelApplet.java.

Definition at line 49 of file ZirkelApplet.java.

Definition at line 46 of file ZirkelApplet.java.

final String rene.zirkel.ZirkelApplet.DefaultIcons = " runmacro animate " [static]

Definition at line 55 of file ZirkelApplet.java.

final String rene.zirkel.ZirkelApplet.DefaultOptions = " draw twolines indicate " [static]

Definition at line 60 of file ZirkelApplet.java.

Definition at line 481 of file ZirkelApplet.java.

Definition at line 52 of file ZirkelApplet.java.

Frame rene.zirkel.ZirkelApplet.F [package]

Definition at line 39 of file ZirkelApplet.java.

String rene.zirkel.ZirkelApplet.filename = "test.zir" [package]

Definition at line 36 of file ZirkelApplet.java.

String rene.zirkel.ZirkelApplet.FirstConstructor = "point" [package]

Definition at line 48 of file ZirkelApplet.java.

IconBar rene.zirkel.ZirkelApplet.IA [package]

Definition at line 34 of file ZirkelApplet.java.

IconBar rene.zirkel.ZirkelApplet.IB [package]

Definition at line 34 of file ZirkelApplet.java.

IconBar rene.zirkel.ZirkelApplet.IC [package]

Definition at line 34 of file ZirkelApplet.java.

MacroBar rene.zirkel.ZirkelApplet.IM [package]

Definition at line 35 of file ZirkelApplet.java.

HistoryTextField rene.zirkel.ZirkelApplet.Input [package]

Definition at line 50 of file ZirkelApplet.java.

Definition at line 53 of file ZirkelApplet.java.

ConstructionObject rene.zirkel.ZirkelApplet.Last = null [package]

Definition at line 51 of file ZirkelApplet.java.

Definition at line 757 of file ZirkelApplet.java.

String rene.zirkel.ZirkelApplet.OldMacro = null [package]

Definition at line 1054 of file ZirkelApplet.java.

String rene.zirkel.ZirkelApplet.Options = "" [package]

Definition at line 48 of file ZirkelApplet.java.

Replay rene.zirkel.ZirkelApplet.RD = null [package]

Definition at line 561 of file ZirkelApplet.java.

Definition at line 37 of file ZirkelApplet.java.

String rene.zirkel.ZirkelApplet.Tools = "all" [package]

Definition at line 48 of file ZirkelApplet.java.

String rene.zirkel.ZirkelApplet.xaxis_text = "x-axis" [static]

Definition at line 41 of file ZirkelApplet.java.

Definition at line 44 of file ZirkelApplet.java.

String rene.zirkel.ZirkelApplet.yaxis_text = "y-axis" [static]

Definition at line 42 of file ZirkelApplet.java.

Definition at line 43 of file ZirkelApplet.java.

Definition at line 45 of file ZirkelApplet.java.

Definition at line 33 of file ZirkelApplet.java.


The documentation for this class was generated from the following file: