public override bool CanStart() { GoInputEventArgs e = LastInput; return((e.Buttons == MouseButtons.Left) && e.Shift && (Math.Abs(e.ViewPoint.X - FirstInput.ViewPoint.X) > 1 || Math.Abs(e.ViewPoint.Y - FirstInput.ViewPoint.Y) > 1)); }
public override bool OnSingleClick(GoInputEventArgs evt, GoView view) { if (!evt.Alt && !evt.Control && !evt.DoubleClick && !evt.Shift && (evt.Buttons == MouseButtons.Left)) { Parent.Selectable = !Parent.Selectable; } return(base.OnSingleClick(evt, view)); }
public override bool CanStart() { bool pRetVal = false; GoInputEventArgs e = LastInput; pRetVal = (e.Buttons == MouseButtons.Left) && e.Control && (Math.Abs(e.ViewPoint.X - FirstInput.ViewPoint.X) > 1 || Math.Abs(e.ViewPoint.Y - FirstInput.ViewPoint.Y) > 1); return(pRetVal); }
protected override void OnExternalObjectsDropped(GoInputEventArgs evt) { if (Selection.Primary is RoadmapItem node && node.Document is GoDocument doc) { RemoveMitigation?.Invoke(node.Mitigation); AddNode(node); RefreshNodes(); } }
/// <summary> /// Bring up a context menu when the user context clicks in the background. /// </summary> /// <param name="evt"></param> protected override void OnBackgroundContextClicked(GoInputEventArgs e) { base.OnBackgroundContextClicked(e); // set up the background context menu GoContextMenu cm = new GoContextMenu(this); if (CanInsertObjects()) cm.MenuItems.Add(new MenuItem("Paste", new EventHandler(this.Paste_Command))); if (cm.MenuItems.Count > 0) cm.MenuItems.Add(new MenuItem("-")); cm.MenuItems.Add(new MenuItem("Properties", new EventHandler(this.Properties_Command))); cm.Show(this, e.ViewPoint); }
public override bool OnSingleClick(GoInputEventArgs evt, GoView view) { if (!evt.Alt && !evt.Control && !evt.DoubleClick && !evt.Shift && (evt.Buttons == MouseButtons.Left)) { var diagram = GetAssociatedDiagram(); if (diagram != null) { DiagramClicked?.Invoke(diagram); } } return(base.OnSingleClick(evt, view)); }
protected override void OnExternalObjectsDropped(GoInputEventArgs evt) { if (Selection.Primary is KanbanItem node && node.Document is GoDocument doc) { RemoveItem?.Invoke(node.Item); AddNode(node); ItemDropped?.Invoke(node.Item); node.Container = ContainerId; RefreshNodes(); } }
protected override void OnBackgroundContextClicked(GoInputEventArgs evt) { base.OnBackgroundContextClicked(evt); GoContextMenu cm = new GoContextMenu(this); if (_buckets?.Any() ?? false) { foreach (var bucket in _buckets) { AddMenu(cm, _actions[bucket]); } } cm.Show(this, evt.ViewPoint); }
/// <summary> /// Bring up a context menu when the user context clicks in the background. /// </summary> /// <param name="evt"></param> protected override void OnBackgroundContextClicked(GoInputEventArgs evt) { base.OnBackgroundContextClicked(evt); // set up the background context menu GoContextMenu cm = new GoContextMenu(this); //if (CanInsertObjects()) // cm.Items.Add(new ToolStripMenuItem("Paste", null, new EventHandler(this.Paste_Command))); if (cm.Items.Count > 0) { cm.Items.Add(new ToolStripSeparator()); } cm.Items.Add(new ToolStripMenuItem("Properties", null, new EventHandler(this.Properties_Command))); cm.Show(this, evt.ViewPoint); }
private void backgroundDoubleClicked(object sender, GoInputEventArgs e) { Guid guid = Guid.NewGuid(); goView1.Document.StartTransaction(); RouterNode n = new RouterNode(guid.ToString(), this); n.Selected += selected; n.Deselected += deselected; n.LabelSpot = GoObject.MiddleTop; n.Location = e.DocPoint; n.Editable = true; goView1.Document.Add(n); goView1.Document.FinishTransaction("new node " + guid); }
/// <summary> /// When the mouse passes over a node, display all of its ports. /// </summary> /// <param name="evt"></param> /// <param name="view"></param> /// <returns></returns> /// <remarks> /// All ports on all nodes are hidden when the mouse hovers over the background. /// </remarks> public override bool OnMouseOver(GoInputEventArgs evt, GoView view) { GraphView v = view as GraphView; if (v != null) { foreach (GoPort p in this.Ports) { p.SkipsUndoManager = true; p.Style = GoPortStyle.Ellipse; p.SkipsUndoManager = false; } } return(false); }
protected override void OnBackgroundHover(GoInputEventArgs e) { foreach (GoObject obj in this.Document) { IGoNode n = obj as IGoNode; if (n != null) { foreach (GoPort p in n.Ports) { p.SkipsUndoManager = true; p.Style = GoPortStyle.None; p.SkipsUndoManager = false; } } } base.OnBackgroundHover(e); }
/// <summary> /// Handle a drop from the tree view. /// </summary> /// <param name="evt"></param> //protected override IGoCollection DoExternalDrop(DragEventArgs evt) //{ // IDataObject data = evt.Data; // Object treenodeobj = data.GetData(typeof(TreeNode)); // if (treenodeobj is TreeNode treenode) // { // Point screenPnt = new Point(evt.X, evt.Y); // Point viewPnt = PointToClient(screenPnt); // PointF docPnt = ConvertViewToDoc(viewPnt); // StartTransaction(); // Selection.Clear(); // Selection.HotSpot = new SizeF(0, 0); // if (treenode.Tag is GoObject tag) // { // var newobj = Document.AddCopy(tag, docPnt); // Selection.Add(newobj); // } // FinishTransaction("Insert from TreeView"); // return Selection; // } // else // { // return base.DoExternalDrop(evt); // } //} protected override void OnBackgroundSelectionDropped(GoInputEventArgs evt) { bool wasinbox = false; foreach (GoObject obj in Selection) { if (obj.Parent is GraphGroup) { wasinbox = true; break; } } if (wasinbox) { Document.DefaultLayer.AddCollection(Selection, true); } base.OnBackgroundSelectionDropped(evt); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// public override bool OnDoubleClick(GoInputEventArgs evt, GoView view) { if (this.Kind == BlockType.Start || this.Kind == BlockType.End) { return(true); } // skip editing blocks in the pallete if (!(this.Document is FlowDocument)) { return(true); } frmBlockEdit frm = new frmBlockEdit(this); DialogResult dialogResult = frm.ShowDialog(); if (dialogResult == DialogResult.OK) { this.Text = frm.ExpressionResult; } return(true); }
public override bool OnDoubleClick(GoInputEventArgs evt, GoView view) { InvokeClicked(new MessageClickedArgs()); return(false); }
void d_BackgroundSingleClicked(object sender, GoInputEventArgs e) { customTreeView2.ClearSelection(); }
protected override void OnExternalObjectsDropped(GoInputEventArgs evt) { PointF point; switch (_dpiState) { case DpiState.TooSmall: point = new PointF(evt.DocPoint.X / 2, evt.DocPoint.Y / 2); break; case DpiState.TooBig: point = new PointF(evt.DocPoint.X * 2, evt.DocPoint.Y * 2); break; default: point = evt.DocPoint; break; } if (Selection.Primary is GoSimpleNode simpleNode) { var parent = GetParentGroup(point); simpleNode.Remove(); switch (simpleNode.Text) { case "ExternalInteractor": CreateExternalInteractor?.Invoke(point, parent); break; case "Process": CreateProcess?.Invoke(point, parent); break; case "DataStore": CreateDataStore?.Invoke(point, parent); break; case "TrustBoundary": CreateTrustBoundary?.Invoke(point, parent); break; default: if (Guid.TryParse(simpleNode.Text, out Guid id)) { CreateIdentity?.Invoke(id, point, parent); } break; } } else if (Selection.Primary is GraphThreatTypeNode threatTypeNode) { var threatType = threatTypeNode.ThreatType; threatTypeNode.Remove(); var nodes = Document.PickObjects(point, false, null, 100); foreach (var node in nodes) { var parent = node?.ParentNode; if (parent is GraphEntity gnode) { var entity = _diagram.Model?.GetEntity(gnode.EntityShape.AssociatedId); if (entity != null) { entity.AddThreatEvent(threatType); gnode.ShowThreats(this); } } else if (parent is GraphLink glink) { var dataFlow = _diagram.Model?.GetDataFlow(glink.Link.AssociatedId); if (dataFlow != null) { dataFlow.AddThreatEvent(threatType); glink.ShowThreats(this, point); } } } } }
private void onBackgroundContextClicked(GoInputEventArgs e) { _moBiDiagramPresenter.ShowContextMenu(null, e.ViewPoint, e.DocPoint); }
public override bool OnDoubleClick(GoInputEventArgs evt, GoView view) { InvokeClicked(new MessageClickedArgs()); return false; }
public override bool OnDoubleClick(GoInputEventArgs evt, GoView view) { InvokeClicked(new LifeLineClickedArgs()); return base.OnDoubleClick(evt, view); }
private void onBackgroundContextClicked(GoInputEventArgs goInputEventArgs) { _journalDiagramPresenter.ShowContextMenu(new JournalDiagramBackground(), goInputEventArgs.ViewPoint); }
/// <summary>Called when the user single clicks on this object.</summary> /// <param name="evt"></param> /// <param name="view"></param> /// <returns> /// True to indicate this /// object handled the event and thus that the calling view /// need not continue calling the method up the chain of parents. /// </returns> /// <remarks> /// By default this method does nothing but return false. /// <see cref="T:Northwoods.Go.GoView" />.<see cref="M:Northwoods.Go.GoView.DoSingleClick(Northwoods.Go.GoInputEventArgs)" /> is the normal caller, /// which in turn is called by various tools. /// </remarks> /// <seealso cref="M:Northwoods.Go.GoObject.OnDoubleClick(Northwoods.Go.GoInputEventArgs,Northwoods.Go.GoView)" /> /// <seealso cref="M:Northwoods.Go.GoObject.OnContextClick(Northwoods.Go.GoInputEventArgs,Northwoods.Go.GoView)" /> public override bool OnSingleClick(GoInputEventArgs evt, GoView view) { OnMessageClicked?.Invoke(FixMessage); return(base.OnSingleClick(evt, view)); }
public override bool OnDoubleClick(GoInputEventArgs evt, GoView view) { InvokeClicked(new LifeLineClickedArgs()); return(base.OnDoubleClick(evt, view)); }
public override bool OnContextClick(GoInputEventArgs evt, GoView view) { ToggleInfo(); return(true); }