/// <summary> /// This is called while the user is dragging the mouse and when the user releases the mouse. /// </summary> /// <param name="evttype">A value of <c>GoInputState.Start</c> when called from <see cref="M:Northwoods.Go.GoToolResizing.Start" />, /// a value of <c>GoInputState.Continue</c> when called from <see cref="M:Northwoods.Go.GoToolResizing.DoMouseMove" />, and /// a value of <c>GoInputState.Finish</c> when called from <see cref="M:Northwoods.Go.GoToolResizing.DoMouseUp" />.</param> /// <remarks> /// Basically this just calls <see cref="M:Northwoods.Go.GoObject.DoResize(Northwoods.Go.GoView,System.Drawing.RectangleF,System.Drawing.PointF,System.Int32,Northwoods.Go.GoInputState,System.Drawing.SizeF,System.Drawing.SizeF)" /> on the /// <see cref="P:Northwoods.Go.GoTool.CurrentObject" />. Objects are responsible for their /// own resize behavior. /// However, this calls <see cref="M:Northwoods.Go.GoView.SnapPoint(System.Drawing.PointF,Northwoods.Go.GoObject)" /> to adjust the /// input event point to make sure the current resize point is a valid one /// according to whatever grids there are. /// </remarks> public virtual void DoResizing(GoInputState evttype) { if (base.CurrentObject != null) { GoInputEventArgs lastInput = base.LastInput; lastInput.DocPoint = base.View.SnapPoint(lastInput.DocPoint, base.CurrentObject); lastInput.ViewPoint = base.View.ConvertDocToView(lastInput.DocPoint); GoObject currentObject = base.CurrentObject; RectangleF bounds = currentObject.Bounds; currentObject.DoResize(base.View, OriginalBounds, lastInput.DocPoint, ResizeHandle.HandleID, evttype, MinimumSize, MaximumSize); if (!mySelectionHidden && ((bounds == currentObject.Bounds && currentObject.Document == base.View.Document) || currentObject.View == base.View)) { currentObject.AddSelectionHandles(base.Selection, mySelectedObject); } } }
/// <summary> /// Call <see cref="M:Northwoods.Go.GoObject.AddSelectionHandles(Northwoods.Go.GoSelection,Northwoods.Go.GoObject)" /> on the /// <see cref="P:Northwoods.Go.GoObject.SelectionObject" /> of each selected object /// if <see cref="M:Northwoods.Go.GoObject.CanView" /> is true, or call /// <see cref="M:Northwoods.Go.GoObject.RemoveSelectionHandles(Northwoods.Go.GoSelection)" /> otherwise. /// </summary> /// <seealso cref="M:Northwoods.Go.GoSelection.RemoveAllSelectionHandles" /> public void AddAllSelectionHandles() { using (GoCollectionEnumerator goCollectionEnumerator = GetEnumerator()) { while (goCollectionEnumerator.MoveNext()) { GoObject current = goCollectionEnumerator.Current; GoObject selectionObject = current.SelectionObject; if (selectionObject != null) { if (current.CanView()) { selectionObject.AddSelectionHandles(this, current); } else { selectionObject.RemoveSelectionHandles(this); } } } } }
/// <summary> /// Restore the selection handles on the link. /// </summary> public override void Stop() { if (mySelectionHidden) { mySelectionHidden = false; GoObject currentObject = base.CurrentObject; if (currentObject != null && currentObject.Document == base.View.Document) { GoObject goObject = base.Link.GoObject; if (!base.Selection.Contains(goObject)) { base.Selection.Add(goObject); } else { currentObject.AddSelectionHandles(base.Selection, goObject); } } } base.CurrentObject = null; base.Stop(); }
/// <summary> /// Clean up this resizing tool's state. /// </summary> /// <remarks> /// This removes any visible resize box, restores the selection handles if needed, /// and stops the transaction (either aborting or finishing it). /// </remarks> public override void Stop() { base.View.DrawXorBox(default(Rectangle), drawnew: false); if (mySelectionHidden) { mySelectionHidden = false; GoObject currentObject = base.CurrentObject; if (currentObject != null && currentObject.Document == base.View.Document) { if (!base.Selection.Contains(mySelectedObject)) { base.Selection.Add(mySelectedObject); } else { currentObject.AddSelectionHandles(base.Selection, mySelectedObject); } } } mySelectedObject = null; base.CurrentObject = null; ResizeHandle = null; StopTransaction(); }