private void repositoryItemSearchControl1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { string text = (sender as TextEdit).Text; FlowView view = this.GetCurrentGraphView(); if (view == null) { return; } // if the search keyword has change, then reset the search enumerator // otherwise, keep searching for the next result if (text != OldSearchKeyWord) { view.BlockSearcher.SearchReset = true; } OldSearchKeyWord = text; BlockSearchResult?.FxPlayer.FadeToNormalColor(); BlockSearchResult = view.BlockSearcher.SearchNextBlock(text); if (BlockSearchResult == null) { return; } // highlight search result BlockSearchResult?.FxPlayer?.DarkenColor(); view.ScrollRectangleToVisible(BlockSearchResult); } }
private void btnZoomNormal_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FlowView view = GetCurrentGraphView(); if (view != null) { view.ZoomNormal(); } }
private void btnComment_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FlowView view = GetCurrentGraphView(); bool ok = (view != null && !view.Doc.IsReadOnly); if (ok == true) { view.Doc.InsertComment(); } }
private void btnAlignVer_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FlowView view = GetCurrentGraphView(); bool ok = (view != null && !view.Doc.IsReadOnly && (view.Selection.Count >= 2)); if (ok) { view.AlignVerticalCenters(); } }
private void btnLinkAmongSelection_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FlowView view = GetCurrentGraphView(); bool ok = (view != null && !view.Doc.IsReadOnly && view.Selection.Count == 2); // create links from only two blocks if (ok) { view.CreateRelationshipsAmongSelection(); } }
private void btnDrawLink_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FlowView view = GetCurrentGraphView(); bool ok = (view != null && !view.Doc.IsReadOnly); if (ok) { view.StartDrawingRelationship(); } }
private void btnPrintBlock_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { FlowView view = GetCurrentGraphView(); bool ok = (view != null && !view.Doc.IsReadOnly); if (ok == true) { view.Doc.InsertNode(BlockType.Output); } }
/// <summary> /// When the mouse passes over a block, display all of its ports. /// </summary> /// <param name="evt"></param> /// <param name="view"></param> /// <returns></returns> /// <remarks> /// All ports on all blocks are hidden when the mouse hovers over the background. /// </remarks> public override bool OnMouseOver(GoInputEventArgs evt, GoView view) { FlowView v = view as FlowView; if (v != null) { foreach (GoPort p in this.Ports) { p.SkipsUndoManager = true; p.Style = GoPortStyle.Ellipse; p.SkipsUndoManager = false; } } return(false); }
public override void DoMouseMove() { if (myLink != null && myLink.ToPort != null) { GoPort p = myLink.ToPort.GoObject as GoPort; if (p != null) { p.Position = this.LastInput.DocPoint; FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn != null && gn != this.Predecessor && !FlowView.IsLinked(this.Predecessor, gn)) { GoPort nearest = FindNearestPort(this.LastInput.DocPoint, gn); if (nearest != null) { p.Position = nearest.Position; p.ToSpot = nearest.ToSpot; } } } } }
public override void DoMouseDown() { if (this.Predecessor == null) { FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn == null) { return; } if (!gn.IsPredecessor) { return; } this.Predecessor = gn; MainBase.App.SetStatusMessage("From block " + this.Predecessor.Text); MakeTemporaryLink(); } else { FlowBlock gn = this.View.PickObject(true, false, this.LastInput.DocPoint, true) as FlowBlock; if (gn != null && gn != this.Predecessor && !FlowView.IsLinked(this.Predecessor, gn)) { // delete the temporary link this.View.Layers.Default.Remove(myLink); myLink = null; // create the link in the design GoPort nearest = FindNearestPort(this.LastInput.DocPoint, gn); IGoLink link = this.View.CreateLink(this.Predecessor.BottomPort, nearest); if (link != null) { this.TransactionResult = "New link"; this.View.RaiseLinkCreated(link.GoObject); this.View.Selection.Select(link.GoObject); } StopTool(); } } }
/// return false if the flow is terminated due to error or end-block private bool ExecuteNextBlock() { string ErrorReport = ""; FlowView view = form.GetCurrentGoView() as FlowView; FlowMap map = form.ActiveMdiChild as FlowMap; if (view == null) { MainInterface.Instance.UserLog("Error: No flow is found", LogType.Error); MainInterface.Instance.UserLog("Please create a new Flow art or open your old project", LogType.Normal); ResetFlow(); RaiseError?.Invoke(this, new EventArgs()); return(false); } if (map == null) { return(false); } FlowBlock OldBlock = CurrentBlock; CurrentBlock = view.GetNextBlock(CurrentBlock, LastBlockResult, out ErrorReport); // remember to check if this view is the same as the previous view // reset flow when there is link error if (CurrentBlock == null) { MainInterface.Instance.UserLog(ErrorReport, LogType.Error); ResetFlow(); RaiseError?.Invoke(this, new EventArgs()); return(false); } // unhighlight old block if (PlayFadingEffect) { OldBlock?.FxPlayer.FadeToNormalColor(); } else { OldBlock?.FxPlayer.NormalizeColor(); } // highlight new block CurrentBlock?.FxPlayer.DarkenColor(); EnterNextBlock?.Invoke(this, new EventArgs()); // reset flow if there is expression error LastBlockResult = HandleBlock(CurrentBlock, out ErrorReport); if (ErrorReport != "") { MainInterface.Instance.UserLog(ErrorReport, LogType.Error); ResetFlow(); RaiseError?.Invoke(this, new EventArgs()); return(false); } // reset flow if this is then End-block if (CurrentBlock.Kind == BlockType.End) { ResetFlow(); ReachEndBlock?.Invoke(this, new EventArgs()); return(false); } // blank space because it's beautiful :) MainInterface.Instance.UserLog("", LogType.Normal); return(true); }
public ViewBlockSearcher(FlowView view) { this.ViewToSearch = view; }