public override string ToString()
 {
     if (Mode == MODE.ADD_POINT)
     {
         Vertex VTX = ParentObj.GetComponent <Vertex>();
         return("Point," + VTX.XY.x + "," + VTX.XY.y + "," + "1" + "," + VTX.ID + "," + VTX.Fixed + "," + Active + "," + VTX.VertexName);
     }
     else if (Mode == MODE.ADD_LINE)
     {
         HLine HLN = ParentObj.GetComponent <HLine>();
         int   Id1 = HLN.VA.GetComponent <Vertex>().ID;
         int   Id2 = HLN.VB.GetComponent <Vertex>().ID;
         return("Line," + Id1 + "," + Id2 + "," + HLN.ID + "," + Active + "," + HLN.HLineName);
     }
     else if (Mode == MODE.ADD_CIRCLE)
     {
         HCircle HCI = ParentObj.GetComponent <HCircle>();
         int     Id1 = HCI.VA.GetComponent <Vertex>().ID;
         return("Circle," + Id1 + "," + HCI.HCR.HR + "," + HCI.ID + "," + Active + "," + HCI.HCircleName);
     }
     else if (Mode == MODE.ADD_MIDPOINT)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID
                + "," + HMD.VB.GetComponent <Vertex>().ID + "," + HMD.VC.GetComponent <Vertex>().ID + "," + HMD.ID + "," + Active);
     }
     else if (Mode == MODE.POINT_TO_POINT)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID
                + "," + HMD.VB.GetComponent <Vertex>().ID + "," + "ID3" + "," + HMD.ID + "," + Active);
     }
     else if (Mode == MODE.POINT_TO_LINE)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID
                + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active);
     }
     else if (Mode == MODE.POINT_TO_CIRCLE)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <Vertex>().ID
                + "," + HMD.VB.GetComponent <HCircle>().ID + "," + "ID3" + "," + HMD.ID + "," + Active);
     }
     else if (Mode == MODE.ISOMETRY)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <HLine>().ID
                + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active);
     }
     else if (Mode == MODE.PERPENDICULAR)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <HLine>().ID
                + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active);
     }
     else if (Mode == MODE.TANGENT_C2L)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <HCircle>().ID
                + "," + HMD.VB.GetComponent <HLine>().ID + "," + "ID3" + "," + HMD.ID + "," + Active);
     }
     else if (Mode == MODE.TANGENT_C2C)
     {
         HModule HMD = ParentObj.GetComponent <HModule>();
         return("Module," + Mode + "," + HMD.VA.GetComponent <HCircle>().ID
                + "," + HMD.VB.GetComponent <HCircle>().ID + "," + "ID3" + "," + HMD.ID + "," + Active);
     }
     else
     {
         return("");
     }
 }
    // This is the actual window.
    void DialogWindow(int windowID)
    {
        float AlignX    = 15;
        float AlignY    = 20;
        float AlignStep = 30;
        float height    = 28;
        float align     = 60;
        float bigAlign  = 72;
        float width     = windowRect.width - 30;
        float halfAlign = width / 2f;

        if (LogObject.Mode == MODE.ADD_POINT)
        {
            Vertex VTX = Object.GetComponent <Vertex>();
            if (VTX == null)
            {
                return;
            }
            Fixed = VTX.Fixed;
            //
            GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle);
            AlignY += AlignStep;
            //
            GUI.Label(new Rect(AlignX, AlignY, width, height), "Name ", TextStyle);
            ObjectName = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), ObjectName, TextFieldStyle);
            AlignY    += AlignStep;
            // 1列目
            GUI.Label(new Rect(AlignX, AlignY, windowRect.width - align, height), Text2, TextStyle);
            AlignY += AlignStep;

            GUI.Label(new Rect(AlignX, AlignY, width, height), "X :", TextStyle);
            CoordX  = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), CoordX, TextFieldStyle);
            AlignY += AlignStep;

            GUI.Label(new Rect(AlignX, AlignY, width, height), "Y : ", TextStyle);
            CoordY  = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), CoordY, TextFieldStyle);
            AlignY += AlignStep;
            // 2列目
            if (Fixed)
            {
                GUI.Label(new Rect(AlignX, AlignY, width, height), "Fixed ", TextStyle);
                if (GUI.Button(new Rect(AlignX + bigAlign, AlignY, width - bigAlign, height), "Unfixed", ButtonStyle))
                {
                    Fixed = VTX.Fixed = false;
                }
            }
            else
            {
                GUI.Label(new Rect(AlignX, AlignY, width, height), "Unfixed ", TextStyle);
                if (GUI.Button(new Rect(AlignX + bigAlign, AlignY, width - bigAlign, height), "Fixed", ButtonStyle))
                {
                    Fixed = VTX.Fixed = true;
                }
            }
            AlignY += AlignStep;

            if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle))
            {
                Objects.DraggedVertex = VTX;
                Objects.ExecuteDeletePoint();
                show = false;
            }
            AlignY += AlignStep;

            if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle))
            {
                show = false;
            }
            if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle))
            {
                VTX.VertexName = ObjectName;
                VTX.XY.x       = float.Parse(CoordX);
                VTX.XY.y       = float.Parse(CoordY);
                show           = false;
            }
        }
        else if (LogObject.Mode == MODE.ADD_LINE)
        {
            HLine HLN = Object.GetComponent <HLine>();
            if (HLN == null)
            {
                return;
            }
            Clipped = HLN.Clipped;

            GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle);
            AlignY += AlignStep;

            //
            GUI.Label(new Rect(AlignX, AlignY, width, height), "Name ", TextStyle);
            ObjectName = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), ObjectName, TextFieldStyle);
            AlignY    += AlignStep;

            GUI.Label(new Rect(AlignX, AlignY, width, height), Text2, TextStyle);
            AlignY += AlignStep;

            if (Clipped)
            {
                GUI.Label(new Rect(AlignX, AlignY, width, height), "Clipped", TextStyle);
                if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, width - halfAlign, height), "Unclipped", ButtonStyle))
                {
                    Clipped = HLN.Clipped = false;
                }
            }
            else
            {
                GUI.Label(new Rect(AlignX, AlignY, width, height), "Unclipped", TextStyle);
                if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, width - halfAlign, height), "Clipped", ButtonStyle))
                {
                    Clipped = HLN.Clipped = true;
                }
            }
            AlignY += AlignStep;

            if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle))
            {
                Objects.ExecuteDeleteHLine(HLN);
                show = false;
            }
            AlignY += AlignStep;

            if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle))
            {
                show = false;
            }
            if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle))
            {
                HLN.HLineName = ObjectName;
                show          = false;
            }
        }
        else if (LogObject.Mode == MODE.ADD_CIRCLE)
        {
            HCircle HCI = Object.GetComponent <HCircle>();
            if (HCI == null)
            {
                return;
            }

            GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle);
            AlignY += AlignStep;

            GUI.Label(new Rect(AlignX, AlignY, width, height), "Name ", TextStyle);
            ObjectName = GUI.TextField(new Rect(AlignX + align, AlignY, width - align, height), ObjectName, TextFieldStyle);
            AlignY    += AlignStep;

            GUI.Label(new Rect(AlignX, AlignY, width, height), Text2, TextStyle);
            AlignY += AlignStep;

            if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle))
            {
                Objects.ExecuteDeleteHCircle(HCI);
                show = false;
            }
            AlignY += AlignStep;

            if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle))
            {
                show = false;
            }
            if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle))
            {
                HCI.HCircleName = ObjectName;
                show            = false;
            }
        }
        else
        {
            HModule HMD = Object.GetComponent <HModule>();
            if (HMD != null)
            {
                GUI.Label(new Rect(AlignX, AlignY, width, height), Text1, TextStyle);
                AlignY += AlignStep;

                GUI.Label(new Rect(AlignX, AlignY, width, height), Text2, TextStyle);
                AlignY += AlignStep;

                if (GUI.Button(new Rect(AlignX, AlignY, width, height), "Delete", ButtonStyle))
                {
                    Objects.ExecuteDeleteHModule(HMD);
                    show = false;
                }
                AlignY += AlignStep;
            }
            if (GUI.Button(new Rect(AlignX, AlignY, halfAlign, height), "Cancel", ButtonStyle))
            {
                show = false;
            }
            if (GUI.Button(new Rect(AlignX + halfAlign, AlignY, halfAlign, height), "OK", ButtonStyle))
            {
                show = false;
            }
        }
    }