private void GetLinkables(Point pos, TouchDevice d) { Shape resizeNode = null; var sh = DocTools.DetectSelectedShape(_doc, pos, d, out resizeNode) as IVdShape; var end = DocTools.RequestLinkable(sh); if (end == null) { MessageDlg.Show("Can only link points and groups/付箋とグループ以外はリンクできません", "Tip", MessageBoxButton.OK, MessageBoxImage.Information); _palette.ResetTool(); _modeMgr.Mode = ShapeInputMode.ManipulationExpected; return; } if (_linkCreation.end1 == null) { _linkCreation.end1 = end; } else if (end == _linkCreation.end1) { _palette.ResetTool(); _modeMgr.Mode = ShapeInputMode.ManipulationExpected; MessageDlg.Show("Cannot link points with itself/同じ付箋・グループをリンクする事はできません", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { _linkCreation.end2 = end; } }
void GetLinkables(Point pos, TouchDevice d) { Shape resizeNode = null; var sh = DocTools.DetectSelectedShape(_doc, pos, d, out resizeNode) as IVdShape; var end = DocTools.RequestLinkable(sh); if (end == null) { MessageBox.Show("Badges or clusters are accepted as link endpoints", "Tip", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (linkCreation.end1 == null) { linkCreation.end1 = end; } else if (end == linkCreation.end1) { MessageBox.Show("Cannot link object with itself", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { linkCreation.end2 = end; } }
public bool InpDeviceDown(Point pos, TouchDevice touchDev) { DocTools.UnfocusAll(_doc.GetShapes().Where(sh => !sh.IsManipulated())); switch (_modeMgr.Mode) { case ShapeInputMode.CreationExpected: _modeMgr.Mode = ShapeInputMode.ManipulationExpected; CreateManipulate(_palette.shapeType, pos.X, pos.Y); if (_palette != null) { _palette.ResetOvers(); } return(true); case ShapeInputMode.LinkedObj1Expected: GetLinkables(pos, touchDev); if (_linkCreation.end1 != null) { ModeMgr.Mode = ShapeInputMode.LinkedObj2Expected; } return(true); case ShapeInputMode.LinkedObj2Expected: GetLinkables(pos, touchDev); if (_linkCreation.end1 != null && _linkCreation.end2 != null) { _linkCreation.linkId = _doc.BeginCreateLink(_linkCreation.end1.GetId(), _linkCreation.end2.GetId(), _linkCreation.headType); _linkCreation.end1 = null; _linkCreation.end2 = null; ModeMgr.Mode = ShapeInputMode.ManipulationExpected; if (_palette != null) { _palette.ResetOvers(); } } return(true); case ShapeInputMode.ManipulationExpected: //no current touch points on shapes (maybe touch points over empty space) Shape resizeNode = null; var underContact = DocTools.DetectSelectedShape(_doc, pos, touchDev, out resizeNode) as IVdShape; if (underContact == null) { return(false); } LockIfPossible(underContact, resizeNode, pos, touchDev); return(true); case ShapeInputMode.Manipulating: DocTools.UnfocusAll(_doc.GetShapes().Where(sh => !sh.IsManipulated())); StopManipulation(_doc.VolatileCtx.LocalCursor, true); return(true); case ShapeInputMode.CursorApprovalExpected: return(true); default: throw new NotSupportedException(); } }
public void InpDeviceDown(Point pos, TouchDevice touchDev) { if (ShapeHitTester.IsPaletteHit(_doc, pos)) { _palette.StartManip(pos, touchDev); return; } DocTools.UnfocusAll(_doc.GetShapes().Where(sh => !sh.IsManipulated())); switch (_modeMgr.Mode) { case ShapeInputMode.CreationExpected: _modeMgr.Mode = ShapeInputMode.ManipulationExpected; CreateManipulate(_palette.shapeType, pos.X, pos.Y); if (_palette != null) { _palette.ResetOvers(); } break; case ShapeInputMode.LinkedObj1Expected: GetLinkables(pos, touchDev); if (linkCreation.end1 != null) { ModeMgr.Mode = ShapeInputMode.LinkedObj2Expected; } break; case ShapeInputMode.LinkedObj2Expected: GetLinkables(pos, touchDev); if (linkCreation.end1 != null && linkCreation.end2 != null) { _doc.BeginCreateLink(linkCreation.end1.GetId(), linkCreation.end2.GetId(), linkCreation.linkHead); linkCreation.end1 = null; linkCreation.end2 = null; ModeMgr.Mode = ShapeInputMode.ManipulationExpected; if (_palette != null) { _palette.ResetOvers(); } } break; case ShapeInputMode.ManipulationExpected: //no current touch points on shapes (maybe touch points over empty space) Shape resizeNode = null; var underContact = DocTools.DetectSelectedShape(_doc, pos, touchDev, out resizeNode) as IVdShape; if (underContact == null) { return; } var shapeFree = underContact.GetCursor() == null; var shapeLockedByUs = false; if (!shapeFree) { shapeLockedByUs = underContact.GetCursor().OwnerId == _palette.GetOwnerId(); } //this shape free and we don't have cursors if (shapeFree && _doc.VolatileCtx.LocalCursor == null) { //shape free, try lock it and schedule cursor approval continuation { cursorApproval.resizeNode = resizeNode; cursorApproval.pos = pos; cursorApproval.td = touchDev; _modeMgr.Mode = ShapeInputMode.CursorApprovalExpected; } //take new local cursor _doc.VolatileCtx.BeginTakeShapeWithLocalCursor(underContact.Id()); } else if (shapeLockedByUs) { CaptureAndStartManip(underContact, pos, resizeNode, touchDev); } break; case ShapeInputMode.Manipulating: break; case ShapeInputMode.CursorApprovalExpected: break; default: throw new NotSupportedException(); } }