Exemple #1
0
    private void fcFlowChart_Click(object sender, EventArgs e)
    {
      MouseEventArgs me = e as MouseEventArgs;
      SetHoverMembers(me);

      form1.ModeModify();

      if (me.Button == MouseButtons.Right)
      {
        ContextMenu theMenu = new ContextMenu();

        if (hoverNode != null)
        {
          contextNode = hoverNode;
          if (hoverNode.Locked)
            theMenu.MenuItems.Add("Unlock", new EventHandler(UnlockNode));
          else
          {
            MenuItem arrangeMenu = theMenu.MenuItems.Add("Align Nodes...");
            arrangeMenu.MenuItems.Add("Top", new EventHandler(AlignTop));
            arrangeMenu.MenuItems.Add("Bottom", new EventHandler(RouteLinks));
            arrangeMenu.MenuItems.Add("Left", new EventHandler(RouteLinks));
            arrangeMenu.MenuItems.Add("Right", new EventHandler(RouteLinks));
            arrangeMenu.MenuItems.Add("Center (H)", new EventHandler(RouteLinks));
            arrangeMenu.MenuItems.Add("Center (V)", new EventHandler(RouteLinks));
            theMenu.MenuItems.Add("-");
            theMenu.MenuItems.Add("Route Links", new EventHandler(RouteLinks));
            theMenu.MenuItems.Add("Raise to Top", new EventHandler(RaiseNodeToTop));
            theMenu.MenuItems.Add("Send to Bottom", new EventHandler(SendNodeToBottom));

            theMenu.MenuItems.Add("-");

            theMenu.MenuItems.Add("Lock", new EventHandler(LockNode));
          }
          form1.ModeModify();
        }

        else if (hoverArea != null)
        {
          contextArea = hoverArea;
          if (hoverArea.Locked)
            theMenu.MenuItems.Add("Unlock", new EventHandler(UnlockArea));
          else
          {
            theMenu.MenuItems.Add("Raise to Top", new EventHandler(RaiseAreaToTop));
            theMenu.MenuItems.Add("Send to Bottom", new EventHandler(SendAreaToBottom));

            theMenu.MenuItems.Add("-");

            theMenu.MenuItems.Add("Lock", new EventHandler(LockArea));
          }
          form1.ModeModify();
        }

        else if (hoverLink != null)
        {
          theMenu.MenuItems.Add("Route Link", new EventHandler(RouteLink));
          theMenu.MenuItems.Add("Disconnect Origin", new EventHandler(DisconnectOrigin));
          theMenu.MenuItems.Add("Disconnect Destination", new EventHandler(DisconnectDestination));

          form1.ModeModify();
        }

        theMenu.MenuItems.Add("-");
        theMenu.MenuItems.Add("Layout Flowchart (!!Broken in an interesting way in latest release!!)", new EventHandler(LayoutFlowchart));

        theMenu.MenuItems.Add("Insert Symbol", new EventHandler(InsertSymbol));

        theMenu.Show(fcFlowChart, me.Location);
      }
    }
Exemple #2
0
    //internal bool CreateGraphicItem(out Int64 requestId, out Guid guid, String tag, String path, String model, String shape, SysCAD.Protocol.Rectangle boundingRect, Double angle, SysCAD.Protocol.Rectangle textArea, Double textAngle, System.Drawing.Color fillColor, FillMode fillMode, bool mirrorX, bool mirrorY)
    //{
    //  return clientProtocol.CreateItem(out requestId, out guid, tag, path, model, shape, boundingRect, angle, textArea, textAngle, fillColor, fillMode, mirrorX, mirrorY);
    //}

    //internal bool CreateGraphicLink(out Int64 requestId, out Guid guid, String tag, String classId, Guid origin, Guid destination, String originPort, Int16 originPortID, String destinationPort, Int16 destinationPortID, List<SysCAD.Protocol.Point> controlPoints, SysCAD.Protocol.Rectangle textArea, Double textAngle)
    //{
    //  return clientProtocol.CreateLink(out requestId, out guid, tag, classId, origin, destination, originPort, originPortID, destinationPort, destinationPortID, controlPoints, textArea, textAngle);
    //}

    internal void CreateArea(GraphicArea graphicArea)
    {
      if (flowChart.InvokeRequired)
      {
        flowChart.BeginInvoke(new CreateAreaDelegate(CreateArea), new object[] { graphicArea });
      }
      else
      {
        Box box = null;
        PureComponents.TreeView.Node node = null;

        node = tvNavigation.AddNodeByPath(graphicArea.Path + graphicArea.Tag, graphicArea.Guid.ToString());
        node.AllowDrop = false;
        node.Tooltip = "";
        tvNavigation.AddSelectedNode(node);

        bool isVisible = true;
        if (node.Parent != null) // if we're not root, make visibility same as parent.
          isVisible = node.Parent.IsSelected;

        box = flowChart.CreateBox((float)graphicArea.X, (float)graphicArea.Y, (float)graphicArea.Width, (float)graphicArea.Height);
        box.ToolTip = "";// graphicArea.Tag;
        box.Style = BoxStyle.Rectangle;

        // Make areas unmodifiable -- for now.
        //box.Locked = true;

        EditorArea area = new EditorArea(this, graphicArea);
        area.Box = box;
        editorAreas.Add(area.Guid, area);

        box.Tag = area;
        node.Tag = area;

        area.Locked = true;
        area.Visible = isVisible;
      }
    }
Exemple #3
0
    private void SetHoverMembers(MouseEventArgs e)
    {
      PointF ptF = fcFlowChart.ClientToDoc(new System.Drawing.Point(e.X, e.Y));

      Arrow hoverArrow = fcFlowChart.GetArrowAt(ptF, 2.0F);
      Box hoverBox = fcFlowChart.GetBoxAt(ptF, 2.0F);

      hoverLink = null;
      hoverNode = null;
      hoverArea = null;

      if ((hoverArrow != null) && (hoverArrow.Tag is EditorLink))
        hoverLink = hoverArrow.Tag as EditorLink;

      if ((hoverBox != null) && (hoverBox.Tag is EditorNode))
        hoverNode = hoverBox.Tag as EditorNode;
      else
      {
        foreach (EditorNode node in state.Nodes)
        {
          if (node.Locked)
          {
            if (((node.ModelBox != null) && (node.ModelBox.BoundingRect.Contains(ptF))) ||
              ((node.GraphicBox != null) && (node.GraphicBox.BoundingRect.Contains(ptF))) ||
              ((node.TextBox != null) && (node.TextBox.BoundingRect.Contains(ptF))) ||
              ((node.HiddenBox != null) && (node.HiddenBox.BoundingRect.Contains(ptF))))
            {
              hoverNode = node;
              return;
            }
          }
        }
      }

      if ((hoverBox != null) && (hoverBox.Tag is EditorArea))
        hoverArea = (hoverBox.Tag as EditorArea);
      else
      {
        foreach (EditorArea area in state.Areas)
        {
          if (area.Box.BoundingRect.Contains(ptF))
          {
            hoverArea = area;
            return;
          }
        }
      }
    }