public void DeleteLastSegment(SMPathOut firstSeg) { // Never delete the first one. SMPathSegment thisPathSeg = firstSeg.Next; int nSeg = 1; while (thisPathSeg != null) { if (thisPathSeg.Next == null) { // Delete this one SegmentCtl segCtl = GetSegmentCtl(thisPathSeg); if (segCtl != null) { _containerPanel.Controls.Remove(segCtl); segCtl.Dispose(); } thisPathSeg.Delete(); PreMoveIt(firstSeg); return; } thisPathSeg = thisPathSeg.Next; nSeg++; } }
private SegmentCtl CreateSegmentCtl(SMPathSegment pathSeg) { SegmentCtl segCtl = new SegmentCtl(_containerPanel, _flowItem, this, pathSeg); segCtl.Name = BuildSegName(pathSeg); _containerPanel.Controls.Add(segCtl); return(segCtl); }
/// <summary> /// Returns true if this segment path is selected /// </summary> /// <param name="pathOut"></param> /// <returns></returns> public bool IsSelected(SMPathOut pathOut) { SegmentCtl segCtl = GetSegmentCtl(pathOut); if (segCtl != null) { return((segCtl as ISelectable).SMSelected); } return(false); }
private void CreateNewSegment(eDrag dragMode, int pixDeltaX, int pixDeltaY) { SMPathSegment newPathSeg = _pathSeg.Append(); SetSegGridLoc(newPathSeg, pixDeltaX, pixDeltaY); // Create the control _newSegCtl = _ctlBase.AppendSegmentCtl(newPathSeg); _ctlBase.MoveItem(); _newSegCtl.Handoff(_lastMousePosition, dragMode, new SMPathSegment[] { newPathSeg }); }
private void OnMouseUp(object sender, MouseEventArgs e) { if (_newSegCtl != null) { _newSegCtl.OnMouseUp(sender, e); _newSegCtl = null; } else { DragMode = eDrag.None; } }
private void DisposeSegment(SMPathSegment pathSeg) { if (pathSeg != null) { string segName = BuildSegName(pathSeg); if (_containerPanel.Controls.ContainsKey(segName)) { SegmentCtl segCtl = _containerPanel.Controls[segName] as SegmentCtl; _containerPanel.Controls.Remove(segCtl); segCtl.Dispose(); DisposeSegment(pathSeg.Next); } } }
private PointF MoveSegment(SMPathSegment pathSeg, PointF startGridPt) { if (pathSeg != null) { string segName = BuildSegName(pathSeg); if (_containerPanel.Controls.ContainsKey(segName)) { SegmentCtl segCtl = _containerPanel.Controls[segName] as SegmentCtl; PointF endGridPt = segCtl.MoveIt(startGridPt); return(MoveSegment(pathSeg.Next, endGridPt)); } } return(startGridPt); }
/// <summary> /// Set this path to be selected /// </summary> /// <param name="pathOut"></param> public void SetSelected(SMPathOut pathOut) { SegmentCtl segCtl = GetSegmentCtl(pathOut); _containerPanel.CurrentSel = segCtl as ISelectable; }