public StopEditorForm(SMContainerPanel containerPanel, SMExit stopItem) { _containerPanel = containerPanel; _stopItem = stopItem; InitializeComponent(); tbText.Text = _stopItem.Text; }
public SMCtlBase(SMContainerPanel containerPanel, SMFlowBase flowItem, Size ctlSize) { _containerPanel = containerPanel; _flowItem = flowItem; InitializeComponent(); this.Name = flowItem.Name; Size = ctlSize; Location = GridLocToLocation(); label.Size = new Size(ctlSize.Width - 8, label.Size.Height); this.Cursor = Cursors.Default; _fontBase = this.label.Font; _fontBold = new Font(this.label.Font, FontStyle.Bold); containerPanel.Controls.Add(this); Build(_flowItem[SMFlowBase.eDir.Up]); Build(_flowItem[SMFlowBase.eDir.Down]); Build(_flowItem[SMFlowBase.eDir.Left]); Build(_flowItem[SMFlowBase.eDir.Right]); delFlowHightlightedChanged = new SMFlowBase.DelHightedOnChange(HighlitedOnChanged); flowItem.evHighlightedOnChaged += delFlowHightlightedChanged; OnChanged(); BringToFront(); }
protected PointF LocationToGridSnap() { Point ptCtlCenter = Location; ptCtlCenter.Offset(this.Size.Width / 2, this.Size.Height / 2); return(SMContainerPanel.PixelToGridSnap(ptCtlCenter)); }
public TransitionCtl(SMContainerPanel containerPanel, SMFlowBase flowItem) : base(containerPanel, flowItem, global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.TransitionFlow.Size) { InitializeComponent(); U.RegisterOnChanged(() => (FlowItem as SMTransition).HasProblem, hasProblemOnChanged); OnChanged(); }
/// <summary> /// Constructor /// </summary> /// <param name="containerPanel"></param> /// <param name="flowItem"></param> /// <param name="ctlBase"></param> /// <param name="pathSeg"></param> public SegmentCtl(SMContainerPanel containerPanel, SMFlowBase flowItem, SMCtlBase ctlBase, SMPathSegment pathSeg) { _containerPanel = containerPanel; _flowItem = flowItem; _ctlBase = ctlBase; _pathSeg = pathSeg; if (pathSeg.First is SMPathOutError) { _penLine = new Pen(Color.Red, 2); _penSelected = new Pen(Color.Red, 6); _penNoTarget = new Pen(Color.Salmon, 6); } else if (pathSeg.First is SMPathOutStop) { _penLine = new Pen(Color.Black, 2); _penSelected = new Pen(Color.Blue, 6); _penNoTarget = new Pen(Color.DarkGray, 6); } else { _penLine = new Pen(Color.Green, 2); _penSelected = new Pen(Color.Green, 6); _penNoTarget = new Pen(Color.DarkGreen, 6); } _ctlBase.LocationChanged += new EventHandler(ctlBase_OnLocationChanged); InitializeComponent(); }
public NewItemForm(SMContainerPanel containerPanel, PointF ptGridLoc) { _containerPanel = containerPanel; _ptGridPt = ptGridLoc; InitializeComponent(); rbAction.Tag = typeof(SMActionFlow); rbDecision.Tag = typeof(SMDecision); rbStop.Tag = typeof(SMExit); rbSubroutine.Tag = typeof(SMSubroutine); rbStopReturn.Tag = typeof(SMReturnStop); rbTransition.Tag = typeof(SMTransition); rbActTrans.Tag = typeof(SMActTransFlow); if (_containerPanel.FlowContainer is SMSubroutine) { rbStop.Text = "Return"; rbStopReturn.Show(); } else { rbStop.Text = "Stop"; rbStopReturn.Hide(); } if (string.IsNullOrEmpty(_sel)) { _sel = rbAction.Name; } (gbFlowItems.Controls[_sel] as RadioButton).Checked = true; }
/// <summary> /// Constructor /// </summary> /// <param name="containerPanel"></param> /// <param name="name"></param> public ArrowCtl(SMContainerPanel containerPanel, string name) { _containerPanel = containerPanel; InitializeComponent(); this.Name = name; this.Size = global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.ArrowSelected.Size; }
private void SetSegGridLoc(SMPathSegment pathSeg, int xPix, int yPix) { float gridDelta = pathSeg.Vertical ? SMContainerPanel.PixelToGridY(yPix) : SMContainerPanel.PixelToGridX(xPix); pathSeg.GridDistance = gridDelta; }
public SubroutineEditorForm(SMContainerPanel containerPanel, SMSubroutine subroutineItem) { _containerPanel = containerPanel; _subroutineItem = subroutineItem; InitializeComponent(); Text = subroutineItem.Name; tbText.Text = _subroutineItem.Text; }
public Point GridLocToLocation() { Point location = SMContainerPanel.GridToPixel(_flowItem.GridLoc); // Center in the grid location.Offset(-Size.Width / 2, -Size.Height / 2); return(location); }
/// <summary> /// Move the arrow to the right position /// </summary> /// <param name="flowItem"></param> /// <param name="pathOut"></param> public void MoveIt(SMFlowBase flowItem, SMPathOut pathOut) { try { _ctrlBasefromPathOut = _containerPanel.GetFlowCtl(pathOut.Owner.Name); _ctlBaseTgt = _containerPanel.GetFlowCtl(pathOut.TargetID); if (_ctlBaseTgt == null) { return; } Size arrowSize = global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.ArrowUp.Size; Point borderLocation = _ctlBaseTgt.Location; Size borderSize = _ctlBaseTgt.Size; borderLocation.Offset(-arrowSize.Width, -arrowSize.Height); borderSize.Width += arrowSize.Width; borderSize.Height += arrowSize.Height; Rectangle rcBorder = new Rectangle(borderLocation, borderSize); PointF endPt = flowItem.FindEndPoint(pathOut); Point pixXY = SMContainerPanel.GridToPixel(endPt); SMPathSegment pathLastSeg = pathOut.Last; if (pathLastSeg.Vertical) { if (pathLastSeg.GridDistance < 0) { // Up SetBackgroundImage(global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.ArrowUp); Location = new Point(pixXY.X - arrowSize.Width / 2, rcBorder.Bottom); } else { // Down SetBackgroundImage(global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.ArrowDown); Location = new Point(pixXY.X - arrowSize.Width / 2, rcBorder.Top); } } else { if (pathLastSeg.GridDistance < 0) { // Left SetBackgroundImage(global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.ArrowLeft); Location = new Point(rcBorder.Right, pixXY.Y - arrowSize.Height / 2); } else { // Right SetBackgroundImage(global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.ArrowRight); Location = new Point(rcBorder.Left, pixXY.Y - arrowSize.Height / 2); } } _ctrlBasefromPathOut.LocationChanged += new EventHandler(ctrlBasefromPathOut_OnLocationChanged); _locOfstFromCtrlBase = new Point(_ctrlBasefromPathOut.Location.X - this.Location.X, _ctrlBasefromPathOut.Location.Y - this.Location.Y); Show(); } catch (Exception ex) { ex.ToString(); } }
private void DoMove(SMPathSegment pathSeg, int xDelta, int yDelta) { if (pathSeg != null) { float gridDelta = pathSeg.Vertical ? SMContainerPanel.PixelToGridY(yDelta) : SMContainerPanel.PixelToGridX(xDelta); pathSeg.GridDistance += gridDelta; } }
public TransitionEditorForm(SMContainerPanel containerPanel, SMTransition transitionItem) { _containerPanel = containerPanel; _transitionItem = transitionItem; InitializeComponent(); mcbTimeoutToStopPath.BindTwoWay(() => _transitionItem.FlowTimeoutToStopPath); mCbLoopTransition.BindTwoWay(() => _transitionItem.LoopTransition); strTimeOutCaption.BindTwoWay(() => _transitionItem.TimeOutCaption); strTimeOutMsg.BindTwoWay(() => _transitionItem.TimeOutMessage); mDoubleTimeOut.BindTwoWay(() => _transitionItem.TransTimeOut); mDoubleLoopTime.BindTwoWay(() => _transitionItem.TransLoopTime); mcbUseDryRunTrans.BindTwoWay(() => _transitionItem.UseDryRunTrans); tbText.Text = _transitionItem.Text; Text = transitionItem.Name; GetFlowList(_transitionItem.StateMachine); cmbTransitionID.DataSource = null; cmbTransitionID.DataSource = _flowNameList; if (_transitionItem.TransitionTargetID != "") { cmbTransitionID.SelectedItem = _transitionItem.TransitionTargetID; } cmbDryRunTransitionID.DataSource = null; cmbDryRunTransitionID.DataSource = _flowNameList2; if (_transitionItem != null) { if (cmbDryRunTransitionID.Items.Contains(_transitionItem.DryRunTransitionTargetID)) { cmbDryRunTransitionID.SelectedItem = _transitionItem.DryRunTransitionTargetID; } else { cmbDryRunTransitionID.SelectedItem = null; } } smPropID.ScopeID = _transitionItem.ParentContainer.ScopeID; smPropID.BindTwoWay(() => DummyID); smValueID.ScopeID = _transitionItem.ParentContainer.ScopeID; smValueID.BindTwoWay(() => ConditionaValue); Rebuild(); cbOperator.SelectedIndex = 0; }
public DecisionEditorForm(SMContainerPanel containerPanel, SMDecision decisionItem) { _containerPanel = containerPanel; _decisionItem = decisionItem; InitializeComponent(); tbText.Text = _decisionItem.Text; Text = decisionItem.Name; tbWaitTimeOut.Text = decisionItem.WaitTimeoutMS.ToString(); foreach (SMPathOut path in _decisionItem.PathArray) { SMPathOutBool pathOutBool = path as SMPathOutBool; if (pathOutBool != null) { if (pathOutBool.True) { tbTrueDelay.Text = pathOutBool.PathOutDelayMS.ToString(); } else { tbFalseDelay.Text = pathOutBool.PathOutDelayMS.ToString(); } } } cbNested.Checked = _decisionItem.HasChildren; cbFlowTimeouttoStop.Checked = _decisionItem.FlowTimeoutToStopPath; DummyID = _decisionItem.ConditionID; booleanID.ScopeID = _decisionItem.ParentContainer.ScopeID; try { booleanID.BindTwoWay(() => DummyID); } catch { DummyID = ""; booleanID.BindTwoWay(() => DummyID); } cbUseDryRunLogic.Checked = _decisionItem.UseDryRunLogic; bcbDryRunLogic.SelectedIndex = _decisionItem.DryRunLogic ? 1 : 0; }
/// <summary> /// Constructor /// </summary> /// <param name="containerPanel"></param> /// <param name="actionFlowItem"></param> public ActionEditorForm(SMContainerPanel containerPanel, SMActionFlow actionFlowItem) { _containerPanel = containerPanel; _actionFlowItem = actionFlowItem; InitializeComponent(); _initialGBHeight = gbMethods.Height; _initialDLGHeight = Height; tbText.Text = _actionFlowItem.Text; Text = actionFlowItem.Name; mcbDryRunSkipActions.BindTwoWay(() => _actionFlowItem.DryRunSkipActions); if (_actionFlowItem.HasChildren) { foreach (SMMethod method in _actionFlowItem.ChildArray) { AddMethod(method); } } AddMethod(null); }
public void OnMouseUp(object sender, MouseEventArgs e) { if (_bMoving) { if (OverEmptySpace) { // Drop item //PointF newPos = SMContainerPanel.PixelToGridSnap(_containerPanel.PointToClient(MousePosition)); PointF newPos = SMContainerPanel.PixelToGridSnap(this.Location); _flowItem.GridLoc = newPos; _containerPanel.Redraw(); } else { MoveItem(); } } //this.Cursor = Cursors.Default; _mouseAtFirstClick = Point.Empty; Cursor = Cursors.Default; _bMoving = false; }
public ActTransEditorForm(SMContainerPanel containerPanel, SMActTransFlow actTransFlowItem) { _containerPanel = containerPanel; _actTransFlowItem = actTransFlowItem; InitializeComponent(); _initialGBHeight = gbMethods.Height; _initialDLGHeight = Height; tbText.Text = _actTransFlowItem.Text; Text = actTransFlowItem.Name; if (_actTransFlowItem.HasChildren) { foreach (SMMethod method in _actTransFlowItem.ChildArray) { AddMethod(method); } } AddMethod(null); foreach (SMTransition transition in _actTransFlowItem.TransitionList) { AddTransitionGUI(transition); } }
public ActTransEditorFormV2(SMContainerPanel containerPanel, SMActTransFlow actTransFlowItem) { _containerPanel = containerPanel; _actTransFlowItem = actTransFlowItem; InitializeComponent(); _initialGBHeight = gbMethods.Height; _initialDLGHeight = Height; tbText.Text = _actTransFlowItem.Text; Text = actTransFlowItem.Name; if (_actTransFlowItem.HasMethod) { foreach (SMMethod method in _actTransFlowItem.ChildArray) { AddMethod(method); } } AddMethod(null); mcbDryRunSkipActions.BindTwoWay(() => _actTransFlowItem.DryRunSkipActions); panelTransitionEdit.Controls.Add(new TransitionEditorCtrlV2(_actTransFlowItem)); }
public SubroutineCtl(SMContainerPanel containerPanel, SMSubroutine flowItem) : base(containerPanel, flowItem, global:: MCore.Comp.SMLib.SMFlowChart.Properties.Resources.Subroutine.Size) { InitializeComponent(); }
public ActionCtl(SMContainerPanel containerPanel, SMFlowBase flowItem) : base(containerPanel, flowItem, global::MCore.Comp.SMLib.SMFlowChart.Properties.Resources.ActionFlow.Size) { InitializeComponent(); OnChanged(); }
public PointF MoveIt(PointF startGridPt) { if (Highlighted && IsSelected) { (this as ISelectable).SMSelected = false; } bool StopPath = _pathSeg is SMPathOutStop; bool ErrorPath = _pathSeg is SMPathOutError; _lineWidth = IsEditable || Highlighted ? 6 : 2; PointF endGridPt = startGridPt; float gridDistance = _pathSeg.GridDistance; Point startPt = SMContainerPanel.GridToPixel(startGridPt); int pixDistance = 0; int halfLine = _lineWidth / 2; if (Vertical) { pixDistance = SMContainerPanel.GridToPixelY(gridDistance); if (IsFirst && _pathSeg.Next == null) { // Check for minimum distance if (pixDistance > 0) { if (pixDistance < _ctlBase.Height / 2) { pixDistance = _ctlBase.Height / 2 + 3; gridDistance = SMContainerPanel.PixelToGridY(pixDistance); _pathSeg.GridDistance = gridDistance; pixDistance = SMContainerPanel.GridToPixelY(gridDistance); } } else { if (pixDistance > -_ctlBase.Height / 2) { pixDistance = -_ctlBase.Height / 2 - 3; gridDistance = SMContainerPanel.PixelToGridY(pixDistance); _pathSeg.GridDistance = gridDistance; pixDistance = SMContainerPanel.GridToPixelY(gridDistance); } } } endGridPt.Y += gridDistance; } else { pixDistance = SMContainerPanel.GridToPixelX(gridDistance); if (IsFirst && _pathSeg.Next == null) { // Check for minimum distance if (pixDistance > 0) { if (pixDistance < _ctlBase.Width / 2) { pixDistance = _ctlBase.Width / 2 + 3; gridDistance = SMContainerPanel.PixelToGridX(pixDistance); _pathSeg.GridDistance = gridDistance; pixDistance = SMContainerPanel.GridToPixelX(gridDistance); } } else { if (pixDistance > -_ctlBase.Width / 2) { pixDistance = -_ctlBase.Width / 2 - 3; gridDistance = SMContainerPanel.PixelToGridX(pixDistance); _pathSeg.GridDistance = gridDistance; pixDistance = SMContainerPanel.GridToPixelX(gridDistance); } } } endGridPt.X += gridDistance; } Point loc = startPt; Size size = Size.Empty; if (Vertical) { size = new Size(_lineWidth, Math.Abs(pixDistance) + _lineWidth); if (pixDistance >= 0) { // Down loc.Offset(-halfLine, -halfLine); } else { // Up loc.Offset(-halfLine, pixDistance - halfLine); } } else { size = new Size(Math.Abs(pixDistance) + _lineWidth, _lineWidth); if (pixDistance >= 0) { // Right loc.Offset(-halfLine, -halfLine); } else { // Left loc.Offset(pixDistance - halfLine, -halfLine); } } Location = loc; _locOfstFromCtrlBase = new Point(_ctlBase.Location.X - this.Location.X, _ctlBase.Location.Y - this.Location.Y); Size = size; if (IsLast && !IsFirst) { _flowItem.DetermineTarget(FirstPathSeg); if (IsSelected) { BringToFront(); } } if (!_containerPanel.EditMode && _pathSeg.Next == null && _pathSeg is SMPathOut && !(_pathSeg as SMPathOut).HasTargetID) { if (ErrorPath || StopPath || _pathSeg is SMPathOutBool) { this.Hide(); return(endGridPt); } } this.Show(); Refresh(); return(endGridPt); }
public GridEditForm(SMContainerPanel containerPanel, PointF ptGridLoc) { _containerPanel = containerPanel; _ptGridPt = ptGridLoc; InitializeComponent(); }