Inheritance: MonoHotDraw.Tools.TextTool
        public override void MouseDown(MouseEvent ev)
        {
            IDrawingView view = ev.View;
            LabelFigure label = ((AssociationFigure)Figure).FindLabel(ev.X, ev.Y);

            if (label != null && view.IsFigureSelected(Figure) ) {
                DelegateTool = new SimpleTextTool(Editor, label, DefaultTool);
            }
            else {
                DelegateTool = new PolyLineFigureTool(Editor, (IConnectionFigure)Figure, DefaultTool);
            }

            if (DelegateTool != null) {
                DelegateTool.MouseDown (ev);
            }
        }
            public override void MouseDown(MouseEvent ev)
            {
                IDrawingView view = ev.View;
                SimpleTextFigure figure = ((TableFigure)Figure).FindTextFigure (ev.X, ev.Y);
                Gdk.EventButton gdk_event = ev.GdkEvent as EventButton;

                if (figure != null && view.IsFigureSelected (Figure) && gdk_event.Button == 3) {
                    ColumnFigure cfigure = figure is ColumnFigure ? figure as ColumnFigure : null;
                    if (cfigure != null)
                        DelegateTool = new PopupMenuTool (Editor, cfigure, DefaultTool, DefaultTool, true);
                } else if (figure != null && view.IsFigureSelected (Figure) && gdk_event.Button == 1) {
                    if (figure is AbstractColumnFigure) {
                        AbstractColumnFigure column = figure as AbstractColumnFigure;
                        if(((TableFigure)Figure).SelectionMode && !(column is ColumnFkFigure)){
                            if(MonoDevelop.Core.Gui.MessageService.Confirm("Do you like to delete column: "+column.ColumnModel.Name+ " from table: "+column.ColumnModel.Parent.Name+"?", MonoDevelop.Core.Gui.AlertButton.Remove)){
                                ((TableFigure)Figure).removeColumn(column);
                            }
                            ((TableFigure)Figure).SelectionMode = false;
                        }else{
                            DelegateTool = new ColumnTextTool (Editor, column, DefaultTool);
                        }
                    }else{
                        DelegateTool = new SimpleTextTool (Editor, figure, DefaultTool);
                    }
                } else {
                    DelegateTool = DefaultTool;
                }
                if (DelegateTool != null)
                    DelegateTool.MouseDown (ev);

                if (figure == null) {
                    figure = ((TableFigure)Figure).FindIconTextFigure (ev.X, ev.Y);
                    if (figure != null) {
                        ColumnFigure cfigure = figure is ColumnFigure ? figure as ColumnFigure : null;
                        DelegateTool = new PopupMenuTool (Editor, cfigure, DefaultTool, DefaultTool, false);
                    }
                }
                base.MouseDown (ev);
            }
            public override void MouseDown(MouseEvent ev)
            {
                IDrawingView view = ev.View;
                DigitalClockTextFigure figure = ((DigitalClockFigure) Figure).FindTextFigure (ev.X, ev.Y);

                if (figure != null && view.IsFigureSelected (Figure)) {
                    DelegateTool = new SimpleTextTool (Editor, figure, DefaultTool);
                } else {
                    DelegateTool = DefaultTool;
                }

                DelegateTool.MouseDown (ev);
            }
Exemple #4
0
            public override void MouseDown(MouseEvent ev)
            {
                IDrawingView view = ev.View;
                LabelFigure name = ((ActorFigure)Figure).FindName(ev.X, ev.Y);

                if (name != null && view.IsFigureSelected(Figure) ) {
                    DelegateTool = new SimpleTextTool(Editor, name, DefaultTool);
                }
                else {
                    DelegateTool = DefaultTool;
                }

                DelegateTool.MouseDown (ev);
            }
Exemple #5
0
        // HERZUM SPRINT 2.3 TLAB-56 TLAB-57 TLAB-58 TLAB-59
        /*
        private void PopupContextMenu(IPrimaryToolDelegator mainTool, IDrawingEditor editor, ITool dt, MouseEvent ev)
        {
            m_contextMenu = new Gtk.Menu();
            Gtk.MenuItem editLabel = new Gtk.MenuItem("Edit label");

            editLabel.Activated += delegate(object sender, EventArgs e) 
            {
                SimpleTextTool textTool = new SimpleTextTool(editor, this, dt, ev);
                mainTool.DelegateTool = textTool;
                textTool.StartEditing();
            };
    
            m_contextMenu.Add(editLabel);
            m_contextMenu.ShowAll();

            m_contextMenu.Popup();
        }
        */

        private void PopupContextMenu(IPrimaryToolDelegator mainTool, IDrawingEditor editor, ITool dt, MouseEvent ev)
        {
            m_contextMenu = new Gtk.Menu();
            Gtk.MenuItem editLabel = new Gtk.MenuItem("Edit label");
            Gtk.MenuItem copy = new Gtk.MenuItem("Copy");
            Gtk.MenuItem cut = new Gtk.MenuItem("Cut");
            // Gtk.MenuItem paste = new Gtk.MenuItem("Paste");

            editLabel.Activated += delegate(object sender, EventArgs e) 
            {
                SimpleTextTool textTool = new SimpleTextTool(editor, this, dt, ev);
                mainTool.DelegateTool = textTool;
                textTool.StartEditing();
            };

            copy.Activated += delegate(object sender, EventArgs e) 
            {
                Clipboard.Copy(ExperimentNode.Owner as BaseExperiment);
            };

            cut.Activated += delegate(object sender, EventArgs e) 
            {
                Clipboard.Cut(ExperimentNode.Owner as BaseExperiment);
            };

            /*
            paste.Activated += delegate(object sender, EventArgs e) 
            {
                Clipboard.Paste(ExperimentNode.Owner as BaseExperiment);
                ExperimentCanvasPad ecp = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, this);
                ecp.DisplayAddedSubgraph(ExperimentNode.Owner as BaseExperiment); 
            };
            */

            m_contextMenu.Add(editLabel);
            m_contextMenu.Add(copy);
            m_contextMenu.Add(cut);
            // m_contextMenu.Add(paste);
            m_contextMenu.ShowAll();

            m_contextMenu.Popup();
        }
        private void PopupContextMenu(IPrimaryToolDelegator mainTool, IDrawingEditor editor, ITool dt, MouseEvent ev)
        {
            m_contextMenu = new Gtk.Menu();
            Gtk.MenuItem editLabel = new Gtk.MenuItem("Edit label");

            editLabel.Activated += delegate(object sender, EventArgs e) 
            {
                SimpleTextTool textTool = new SimpleTextTool(editor, this, dt, ev);
                mainTool.DelegateTool = textTool;
                textTool.StartEditing();
            };
    
            m_contextMenu.Add(editLabel);
            m_contextMenu.ShowAll();

            m_contextMenu.Popup();
        }