public void MouseDown(MouseEventArgs e) { if (e == null) { throw new ArgumentNullException("The argument object is 'null'"); } if (e.Button == MouseButtons.Left && Enabled && !IsSuspended) { //if(e.Clicks == 1) { TextEditor.Hide(); Selection.CollectEntitiesAt(e.Location); if (Selection.SelectedItems.Count > 0) { IMouseListener listener = Selection.SelectedItems[0].GetService(typeof(IMouseListener)) as IMouseListener; if (listener != null) { listener.MouseDown(e); } } } if (e.Clicks == 2) { if (Selection.SelectedItems.Count > 0 && Selection.SelectedItems[0] is TextOnly) // if (Selection.SelectedItems.Count > 0 ) { TextEditor.GetEditor(Selection.SelectedItems[0] as IShape); TextEditor.Show(); } } } }
// ------------------------------------------------------------------ /// <summary> /// Handles the mouse down event /// </summary> /// <param name="e">The /// <see cref="T:System.Windows.Forms.MouseEventArgs"/> instance /// containing the event data.</param> // ------------------------------------------------------------------ public virtual bool MouseDown(MouseEventArgs e) { if (e == null) { throw new ArgumentNullException("The argument object is 'null'"); } //if(e.Button == MouseButtons.Left && Enabled && !IsSuspended) if (Enabled && !IsSuspended) { // Only if one of the multi-select keys are pressed do we NOT // clear the selection before adding to it the selected entity. bool clearSelectionFirst = true; if (this.isMultiSelectKeyPressed == true) { clearSelectionFirst = false; } // Also don't clear the selection if a group is currently // selected so we can drill-down into it. if (this.Controller.Model.Selection.SelectedItems.Count > 0) { foreach (IDiagramEntity entity in this.Controller.Model.Selection.SelectedItems) { if ((entity is IGroup) && (entity.Hit(e.Location) == true)) { clearSelectionFirst = false; } } } this.Controller.Model.Selection.CollectEntitiesAt(e.Location, clearSelectionFirst); if (this.Controller.Model.Selection.SelectedItems.Count > 0) { IMouseListener listener = this.Controller.Model.Selection.SelectedItems[0].GetService( typeof(IMouseListener)) as IMouseListener; if (listener != null) { if (listener.MouseDown(e)) { return(true); } } } if ((this.Controller.Model.Selection.SelectedItems.Count > 0) && (this.Controller.Model.Selection.SelectedItems[0] is ITextProvider)) { //ActivateTool(); ITextProvider textProvider = this.Controller.Model.Selection.SelectedItems[0] as ITextProvider; if ((e.Clicks == textProvider.EditTextClicks) && (textProvider.AllowTextEditing)) { return(Controller.ActivateTextEditor(textProvider)); } } } return(false); }