Exemple #1
0
    private void flowChart1_BoxModified(object sender, BoxMouseArgs e)
    {
      if (e.Box.Tag is Arc)
      {
        Arc arc = e.Box.Tag as Arc;
        arc.x = GridUnfix(e.Box.BoundingRect.X);
        arc.y = GridUnfix(e.Box.BoundingRect.Y);
        arc.w = e.Box.BoundingRect.Width;
        arc.h = e.Box.BoundingRect.Height;
      }
      else if (e.Box.Tag is SysCAD.Protocol.Point)
      {
        SysCAD.Protocol.Point point = e.Box.Tag as SysCAD.Protocol.Point;
        point.X = GridUnfix(e.Box.BoundingRect.X + 1.0F);
        point.Y = GridUnfix(e.Box.BoundingRect.Y + 1.0F);
      }

      SetStencil(modelStencil);
    }
Exemple #2
0
		internal void fireObjModified(ChartObject obj, PointF pt, int mnpHandle)
		{
			switch (obj.getType())
			{
				case ItemType.Box:
					if (BoxModified != null)
					{
						Box box = (Box)obj;
						BoxMouseArgs args = new BoxMouseArgs(
							box, pt.X, pt.Y, mnpHandle);
						BoxModified(this, args);
					}
					break;
				case ItemType.ControlHost:
					if (ControlHostModified != null)
					{
						ControlHost host = (ControlHost)obj;
						ControlHostMouseArgs args = new ControlHostMouseArgs(
							host, pt.X, pt.Y, mnpHandle);
						ControlHostModified(this, args);
					}
					break;
				case ItemType.Table:
					if (TableModified != null)
					{
						Table table = (Table)obj;
						TableMouseArgs args = new TableMouseArgs(
							table, pt.X, pt.Y, mnpHandle);
						TableModified(this, args);
					}
					break;
				case ItemType.Arrow:
					if (ArrowModified != null)
					{
						Arrow arrow = (Arrow)obj;
						ArrowMouseArgs args = new ArrowMouseArgs(
							arrow, pt.X, pt.Y, mnpHandle);
						ArrowModified(this, args);
					}
					break;
			}
		}
Exemple #3
0
    private void fcFlowChart_BoxModified(object sender, BoxMouseArgs e)
    {
      SysCAD.Protocol.Action action = new SysCAD.Protocol.Action();

      if (e.Box.Tag is EditorNode)
      {
        Box modelBox = (e.Box.Tag as EditorNode).ModelBox;
        Box graphicBox = (e.Box.Tag as EditorNode).GraphicBox;
        Box textBox = (e.Box.Tag as EditorNode).TextBox;


        GraphicNode newGraphicNode = state.GraphicItem((e.Box.Tag as EditorNode).Guid).Clone();
        if (modelBox != null)
        {
          newGraphicNode.BoundingRect = new SysCAD.Protocol.Rectangle(modelBox.BoundingRect);
          newGraphicNode.Angle = modelBox.RotationAngle;

          if (textBox != e.Box)
          {
            ArrowCollection incomingArrows = modelBox.IncomingArrows.Clone();

            foreach (Arrow arrow in incomingArrows)
            {
              GraphicLink newGraphicLink = state.GraphicLink((arrow.Tag as EditorLink).Guid).Clone();

              if (newGraphicLink != null)
              {
                if (!State.CompareControlPoints(arrow.ControlPoints, newGraphicLink.ControlPoints))
                {
                  newGraphicLink.ControlPoints = State.GetControlPoints(arrow.ControlPoints);
                  action.Modify.Add(newGraphicLink);
                }
              }
            }

            ArrowCollection outgoingArrows = modelBox.OutgoingArrows.Clone();

            foreach (Arrow arrow in outgoingArrows)
            {
              GraphicLink newGraphicLink = state.GraphicLink((arrow.Tag as EditorLink).Guid).Clone();

              if (newGraphicLink != null)
              {
                if (!State.CompareControlPoints(arrow.ControlPoints, newGraphicLink.ControlPoints))
                {
                  newGraphicLink.ControlPoints = State.GetControlPoints(arrow.ControlPoints);
                  action.Modify.Add(newGraphicLink);
                }
              }
            }
          }
        }
        else
        {
          newGraphicNode.BoundingRect = new SysCAD.Protocol.Rectangle(graphicBox.BoundingRect);
          newGraphicNode.Angle = graphicBox.RotationAngle;
        }

        newGraphicNode.TagArea = new SysCAD.Protocol.Rectangle(textBox.BoundingRect);
        newGraphicNode.TagAngle = textBox.RotationAngle;
        action.Modify.Add(newGraphicNode);


        //Boxmodified.
        AddAction(action);
      }

      else if (e.Box.Tag is EditorLink)
      {
        Box tagArea = e.Box;
        GraphicLink newLink = state.GraphicLink((e.Box.Tag as EditorLink).Guid).Clone();

        newLink.TagArea = new SysCAD.Protocol.Rectangle(tagArea.BoundingRect);
        newLink.TagAngle = tagArea.RotationAngle;
        action.Modify.Add(newLink);

        AddAction(action);
      }

      else if (e.Box.Tag is EditorArea)
      { // move areas back to bottom after every operation so they stay out of the way.
        EditorArea editorArea = e.Box.Tag as EditorArea;
        editorArea.Box.ZBottom();
      }

      form1.GraphicPropertyGrid.Refresh();

      ContextMenu propertyGridMenu = form1.GraphicPropertyGrid.ContextMenu;

      if (propertyGridMenu == null)
        propertyGridMenu = new ContextMenu();

      propertyGridMenu.MenuItems.Add("Test");

      form1.GraphicPropertyGrid.ContextMenu = propertyGridMenu;
    }