Exemple #1
0
        void gp_MouseDown(object sender, MouseEventArgs e)
        {
            SelectTool st = currentTool as SelectTool;

            if (st != null)
            {
                st.StartSelect(e.Location);
                return;
            }

            AddEdgeTool aet = currentTool as AddEdgeTool;

            if (aet != null)
            {
                aet.Begin(this, e.Location);
                return;
            }

            MoveObjectTool mt = currentTool as MoveObjectTool;

            if (mt != null)
            {
                mt.Begin(e.Location, CurrentGraphPanel.GetSelection());
                return;
            }
        }
Exemple #2
0
        void gp_MouseUp(object sender, MouseEventArgs e)
        {
            SelectTool st = currentTool as SelectTool;

            if (st != null)
            {
                st.EndSelect(app, this, e.Location, true);
                List <ISelectable> currentSelection = CurrentGraphPanel.GetSelection();
                if (currentSelection.Count == 1)
                {
                    selectedItemPropertyGrid.SelectedObject = currentSelection[0].GetItem();
                }
                else if (currentSelection.Count > 0)
                {
                    object[] selectedObjects = new object[currentSelection.Count];
                    for (int i = 0; i < currentSelection.Count; i++)
                    {
                        selectedObjects[i] = currentSelection[i].GetItem();
                    }

                    selectedItemPropertyGrid.SelectedObjects = selectedObjects;
                }
                else
                {
                    selectedItemPropertyGrid.SelectedObject = CurrentGraphPanel.Graph;
                }
                return;
            }

            AddEdgeTool aet = currentTool as AddEdgeTool;

            if (aet != null)
            {
                aet.End(app, this, e.Location);
                return;
            }

            MoveObjectTool mt = currentTool as MoveObjectTool;

            if (mt != null)
            {
                mt.End(e.Location);
                return;
            }
        }