Ejemplo n.º 1
0
        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++;
            }
        }
Ejemplo n.º 2
0
        private SegmentCtl CreateSegmentCtl(SMPathSegment pathSeg)
        {
            SegmentCtl segCtl = new SegmentCtl(_containerPanel, _flowItem, this, pathSeg);

            segCtl.Name = BuildSegName(pathSeg);
            _containerPanel.Controls.Add(segCtl);
            return(segCtl);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
        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 });
        }
Ejemplo n.º 5
0
 private void OnMouseUp(object sender, MouseEventArgs e)
 {
     if (_newSegCtl != null)
     {
         _newSegCtl.OnMouseUp(sender, e);
         _newSegCtl = null;
     }
     else
     {
         DragMode = eDrag.None;
     }
 }
Ejemplo n.º 6
0
 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);
         }
     }
 }
Ejemplo n.º 7
0
 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);
 }
Ejemplo n.º 8
0
        /// <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;
        }