public bool AddSplitControl(DropLocation location, DropLocation sourceLocation, TearableTabItem ttItem) { if (ttcMain.Items.Contains(ttItem) && 1 == ttcMain.Items.Count) { return(false); } switch (location) { case DropLocation.Top: case DropLocation.Bottom: itccCenter = new TearableTabSplitHorizontal(this); break; case DropLocation.Left: case DropLocation.Right: itccCenter = new TearableTabSplitVertical(this); break; case DropLocation.Center: default: throw new NotSupportedException("Center not supported"); } tabs[location] = itccCenter; gridContentSplitControl.Children.Remove(ttcMain); ttddMain.Visibility = Visibility.Collapsed; ttddMain.DetachDetectorElement(); Grid tmpGrid = null; itccCenter.AddControl(location, ttcMain, ttItem, ref tmpGrid); gridContentSplitControl.Children.Insert(0, itccCenter as UIElement); ttcMain = null; return(true); }
void IDropable.Drop(object data, DropLocation location) { var droppedElement = data as NodeItem; if (droppedElement == null) { return; } if (object.ReferenceEquals(droppedElement, this)) { //if dragged and dropped yourself, don't need to do anything return; } var arg = new NodeDropRequest { DroppedNode = droppedElement.State.DataContext, DropTarget = State.DataContext, Location = location }; var editor = this.FindParentOfType <TreeEditor>(); if (editor.DropCommand != null && editor.DropCommand.CanExecute(arg)) { editor.DropCommand.Execute(arg); } if (location == DropLocation.InPlace) { IsExpanded = true; } }
internal void Update( DropLocation location ) { myLocation = location; myAdornerLayer.Update( AdornedElement ); Visibility = Visibility.Visible; }
internal void Update(DropLocation location) { myLocation = location; myAdornerLayer.Update(AdornedElement); Visibility = Visibility.Visible; }
public bool AddControl(DropLocation location, TearableTabControl existingTabControl, TearableTabItem newTabItem, ref Grid droppedItemParent) { TearableTabControl ttcNew = new TearableTabControl(); TearableTabControl newTabItemParent = newTabItem.Parent as TearableTabControl; if (!ttcNew.DropTab(newTabItem)) { } switch (location) { case DropLocation.Left: ttcLeft = ttcNew; ttcRight = existingTabControl; break; case DropLocation.Right: ttcLeft = existingTabControl; ttcRight = ttcNew; break; case DropLocation.Center: case DropLocation.Top: case DropLocation.Bottom: default: throw new NotSupportedException("Only left and right locations are supported in Horizontal"); } // This is where it seems to go wrong as well as in TTSH // Start { droppedItemParent = existingTabControl.Parent as Grid; if (null != droppedItemParent) { droppedItemParent.Children.Remove(existingTabControl); } else { } if (this.IsChildOf(newTabItem)) { } // } end gridContentVertical.Children.Insert(0, ttcLeft); Grid.SetColumn(ttcLeft, 0); gridContentVertical.Children.Insert(0, ttcRight); Grid.SetColumn(ttcRight, 2); AttachHandlers(ttcLeft); AttachHandlers(ttcRight); ttddLeft.AttachDetectorElement(ttcLeft); ttddRight.AttachDetectorElement(ttcRight); AttachHandlers(ttddLeft); AttachHandlers(ttddRight); return(true); }
bool IDropable.IsDropAllowed(object data, DropLocation location) { if (Root == null) { return(false); } return(myTree.StateContainer.GetOrCreate(Root).IsDropAllowed(location)); }
public static void DrawNodeDropHint(DropLocation location, Graphics g) { NodeView pView = location.Parent.NodeView; g.DrawLine(dropHintPen, pView.Left, pView.Top, pView.Right, pView.Top); g.DrawLine(dropHintPen, pView.Left, pView.Bottom - 1, pView.Right, pView.Bottom - 1); g.DrawArc(dropHintPen, pView.Right - 2, pView.Top, 5, pView.Height - 1, 270, 180); g.DrawArc(dropHintPen, pView.Left - 3, pView.Top, 5, pView.Height - 1, 90, 180); }
bool IDropable.IsDropAllowed(object data, DropLocation location) { if (!(data is NodeItem)) { return(false); } return(State.IsDropAllowed(location)); }
public DropSortableItemsAdorner(FrameworkElement adornedElement) : base(adornedElement) { myOwner = adornedElement; IsHitTestVisible = false; myLocation = DropLocation.InPlace; myAdornerLayer = AdornerLayer.GetAdornerLayer(AdornedElement); myAdornerLayer.Add(this); }
void IDropable.Drop( object data, DropLocation location ) { var droppedElement = data as NodeViewModel; if( droppedElement == null ) { return; } ProjectService.Project.AddChildTo( droppedElement.Node, Node ); }
public DropSortableItemsAdorner( FrameworkElement adornedElement ) : base(adornedElement) { myOwner = adornedElement; IsHitTestVisible = false; myLocation = DropLocation.InPlace; myAdornerLayer = AdornerLayer.GetAdornerLayer( AdornedElement ); myAdornerLayer.Add( this ); }
void IDropable.Drop(object data, DropLocation location) { var droppedElement = data as NodeItem; if (droppedElement == null) { return; } var nodeId = ((ClusterTreeNode)droppedElement.DataContext).Id; myPresentation.DynamicClusters().RemoveFromClusters(nodeId); }
void OnTriggerExit2D(Collider2D other) { if (other.gameObject.tag != "Slot") { return; } DropLocation dropLocation = other.GetComponent <DropLocation>(); if (dropSpot == dropLocation) { dropSpot = null; } }
private void DetectorElement_DragOver(object sender, DragEventArgs e) { mousePosition = e.GetPosition(sender as FrameworkElement); double vertical = detectorElement.ActualWidth / 3; double horizontal = detectorElement.ActualHeight / 3; double opacity = 0.5; dropLocation = DropLocation.NA; HideHighlight(); TearableTabItem tabItemTarget = e.Source as TearableTabItem; if (this.IsChildOf(tabItemTarget)) { } TearableTabItem tabItemSource = e.Data.GetData(typeof(TearableTabItem)) as TearableTabItem; if (this.IsChildOf(tabItemSource)) { } if (mousePosition.Y > 25) { if (mousePosition.X < vertical) { gridLeft.Opacity = opacity; dropLocation = DropLocation.Left; } else if (mousePosition.X > detectorElement.ActualWidth - vertical) { gridRight.Opacity = opacity; dropLocation = DropLocation.Right; } else if (mousePosition.Y < horizontal) { gridTop.Opacity = opacity; dropLocation = DropLocation.Top; } else if (mousePosition.Y > detectorElement.ActualHeight - horizontal) { gridBottom.Opacity = opacity; dropLocation = DropLocation.Bottom; } else { gridTop.Opacity = opacity; gridBottom.Opacity = opacity; dropLocation = DropLocation.Center; } } }
void IDropable.Drop(object data, DropLocation location) { var droppedElement = data as NodeItem; if (droppedElement == null) { return; } var nodeId = ((ClusterTreeNode)droppedElement.DataContext).Id; new ChangeClusterAssignment(myPresentation) .Execute(t => t.RemoveFromClusters(nodeId)); }
public static PickupIndex GetSelection(DropLocation dropLocation, float normalizedIndex) { var selections = Selection[dropLocation]; WeightedSelection <PickupIndex> weightedSelection = new WeightedSelection <PickupIndex>(); foreach (var selection in selections) { foreach (var pickup in selection.Pickups) { weightedSelection.AddChoice(pickup, selection.DropChance); } } return(weightedSelection.Evaluate(normalizedIndex)); }
protected override void Execute(CodeActivityContext context) { #region Extract Workflow Argument Values // Build Folder var dropLocation = DropLocation.Get(context); // The folder to create var folderName = FolderName.Get(context); #endregion var folderCreated = DoCreateFolder(dropLocation, folderName); context.SetValue(FolderCreated, folderCreated); //FolderCreated.Set(context, folderCreated); }
void IDropable.Drop(object data, DropLocation location) { var droppedElement = data as NodeItem; if (droppedElement == null) { return; } var arg = new NodeDropRequest { DroppedNode = droppedElement.State.DataContext, DropTarget = Root, Location = location }; if (DropCommand != null && DropCommand.CanExecute(arg)) { DropCommand.Execute(arg); } }
internal bool IsDropAllowed(DropLocation location) { if (location == DropLocation.InPlace) { var dragDropSupport = DataContext as IDragDropSupport; if (dragDropSupport != null) { return(dragDropSupport.IsDropAllowed); } } else { var dragDropSupport = DataContext.Parent as IDragDropSupport; if (dragDropSupport != null) { return(dragDropSupport.IsDropAllowed); } } return(true); }
public Vector3 UseDropLocation() { Dictionary <int, DropLocation> newList = new Dictionary <int, DropLocation>(); int counter = 0; DropLocation toReturn = new DropLocation(-1, Vector3.zero); foreach (KeyValuePair <int, DropLocation> entry in dropLocations) { if (counter == 0) { toReturn = entry.Value; counter++; } else { newList.Add(entry.Key, entry.Value); } counter++; } dropLocations = newList; return(toReturn.position); }
public void UpdateDropLocation(int key, Vector3 location) { DropLocation dropLocation = null; if (dropLocations.TryGetValue(key, out dropLocation)) { if (dropLocation != null) { dropLocations[key].position = location; } } else { dropLocations.Add(key, new DropLocation(dropLocations.Count, location)); } if (driver != null) { if (driver.action == DeliveryDriver.DriverAction.droppingOffStack) { driver.NextAction(); } } }
public virtual bool canDrop(DropLocation location, TreeNode draggedNode, TreeNode dropNode) { return(true); }
private void normaliseNamespaces(DropLocation dropLocation , List<Node> nodes) { List<NamespaceDeclaration> namespaces = new List<NamespaceDeclaration>(dropLocation.Namespaces); if (Application.Settings.NormaliseProjectNamespace) { var defaultNS = dropLocation.ProjectDefaultNamespace; if (!namespaces.Any(x => x.Namespace == defaultNS)) { namespaces.Add(new NamespaceDeclaration() {Namespace = defaultNS}); } } foreach (var n in nodes) { var ns = n.Namespace; n.NormalisedNamespace = ns ; var nsComponents = ns.Split('.'); if (!string.IsNullOrEmpty(ns)) { var exactMatch = namespaces.FirstOrDefault(x => x.Namespace == ns); if (exactMatch != null) { n.NormalisedNamespace = exactMatch.Alias ; // namespace not needed, as its already imported } else { // find a using statement similar to this one; var similar = namespaces.Where(x => !x.Namespace.Split('.').Except(nsComponents).Any()) .OrderByDescending(x => x.Namespace.Length) .FirstOrDefault(); if (similar != null) { n.NormalisedNamespace = ns.Substring(similar.Namespace.Length + 1); if (!string.IsNullOrEmpty(similar.Alias)) n.NormalisedNamespace = similar.Alias + "." + n.NormalisedNamespace; } } } } }
void stringNodesTreeView_DragOver(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; Point clientHit = PointToClient(new Point(e.X, e.Y)); TreeNode destination = HitTest(clientHit).Node; TreeNode Dropped = null; if (destination == null) { stringNode last = StringNodeRoot.Nodes[StringNodeRoot.Nodes.Count - 1]; if (nodesDic.ContainsKey(last.Name)) { destination = nodesDic[last.Name]; } } if (e.Data.GetDataPresent(typeof(TreeNode))) { Dropped = (TreeNode)e.Data.GetData(typeof(TreeNode)); } else { if (e.Data.GetDataPresent(typeof(string))) { string droppedStr = (string)e.Data.GetData(typeof(string)); if (!string.IsNullOrEmpty(droppedStr)) { Dropped = new TreeNode(droppedStr); IsAdding = true; } } } bool allowDrop = false; DropLocation newDrop = DropLocation.On; if (Dropped != null && destination != null) { int deadZone = destination.Bounds.Height / 4; if ((clientHit.Y - destination.Bounds.Y) < deadZone) { newDrop = DropLocation.Top; } else { if ((clientHit.Y - destination.Bounds.Y) > (3 * deadZone)) { newDrop = DropLocation.Bottom; } else { newDrop = DropLocation.On; } } allowDrop = true; } if (allowDrop && canDrop(newDrop, Dropped, destination)) { RefNode = destination; DropMode = newDrop; Invalidate(); } else { e.Effect = DragDropEffects.None; RefNode = null; IsAdding = false; } }
public static void AddDropInformation(DropLocation dropLocation, List <PickupSelection> pickupSelections) { Selection[dropLocation] = pickupSelections; }
private DropLocation GetDropLocation() { var ret = new DropLocation(); var activeDocument = Application.DTE.Value?.ActiveDocument; var sel = activeDocument?.Selection as TextSelection; CodeElement droppedClass = null; CodeElement droppedMethod = null; ret.AddNamespace( getImportStatements(activeDocument)); if (sel != null) { droppedClass = sel.ActivePoint.CodeElement[vsCMElement.vsCMElementClass]; droppedMethod = sel.ActivePoint.CodeElement[vsCMElement.vsCMElementFunction]; try { if (droppedMethod != null) { Debug.WriteLine("Dropped onto method " + droppedMethod.Name); } if (droppedClass != null) { Debug.WriteLine("Dropped onto class " + droppedClass.Name); ret.AddNamespace(droppedClass.SafeNamespace()); } } catch { } } if(droppedClass!=null) ret.Class =(CodeClass) droppedClass; if(droppedMethod!=null) ret.Function = (CodeFunction)droppedMethod; return ret; }
public bool AddSplitControl(DropLocation location, DropLocation sourceLoaction, TearableTabItem ttItem) { ITabControlContainer itcc; Grid droppedItemParent = null; switch (location) { case DropLocation.Top: case DropLocation.Bottom: itcc = new TearableTabSplitHorizontal(this); break; case DropLocation.Left: case DropLocation.Right: itcc = new TearableTabSplitVertical(this); break; case DropLocation.Center: default: throw new NotSupportedException("Center not supported"); } switch (sourceLoaction) { case DropLocation.Left: if (ttcLeft.Items.Contains(ttItem) && 1 == ttcLeft.Items.Count) { return(false); } DetachHandlers(ttcLeft); gridContentVertical.Children.Remove(ttcLeft); TearableTabControl ttcLeftTmp = ttcLeft; if (ttcLeft == null) { } if (itcc.AddControl(location, ttcLeft, ttItem, ref droppedItemParent)) { ttddLeft.Visibility = Visibility.Collapsed; ttddLeft.DetachDetectorElement(); Grid.SetColumn(itcc as UIElement, 0); itccLeft = itcc; ttcLeft = null; if (null == droppedItemParent) { gridContentVertical.Children.Insert(0, itcc as UIElement); } else { droppedItemParent.Children.Add(itcc as UIElement); } } else { (ttcLeftTmp.Parent as Grid).Children.Remove(ttcLeftTmp); gridContentVertical.Children.Insert(0, ttcLeftTmp); } break; case DropLocation.Right: if (ttcRight.Items.Contains(ttItem) && 1 == ttcRight.Items.Count) { return(false); } DetachHandlers(ttcRight); gridContentVertical.Children.Remove(ttcRight); TearableTabControl ttcRightTmp = ttcRight; if (ttcRight == null) { } if (itcc.AddControl(location, ttcRight, ttItem, ref droppedItemParent)) { ttddRight.Visibility = Visibility.Collapsed; ttddRight.DetachDetectorElement(); Grid.SetColumn(itcc as UIElement, 2); itccRight = itcc; ttcRight = null; if (null == droppedItemParent) { gridContentVertical.Children.Insert(0, itcc as UIElement); } else { droppedItemParent.Children.Add(itcc as UIElement); } } else { (ttcRightTmp.Parent as Grid).Children.Remove(ttcRightTmp); gridContentVertical.Children.Insert(0, ttcRightTmp); } break; case DropLocation.Top: case DropLocation.Bottom: case DropLocation.Center: default: throw new NotSupportedException("Center not supported"); } //try //{ // gridContentVertical.Children.Insert(0, itcc as UIElement); //} //catch (Exception ex) //{ //} return(true); }
private void RememberDropSpot(GameObject dropTarget) { DropLocation dropLocation = dropTarget.GetComponent <DropLocation>(); dropSpot = dropLocation; }
internal void NodeDragDrop(MapTree tree, DropLocation location) { mapCtrl.MoveNodes(location); }
public bool AddSplitControl(DropLocation location, DropLocation sourceLoaction, TearableTabItem ttItem) { ITabControlContainer itcc; Grid droppedItemParent = null; switch (location) { case DropLocation.Top: case DropLocation.Bottom: itcc = new TearableTabSplitHorizontal(this); break; case DropLocation.Left: case DropLocation.Right: itcc = new TearableTabSplitVertical(this); break; case DropLocation.Center: default: throw new NotSupportedException("Center not supported"); } tabs[location] = itcc; switch (sourceLoaction) { case DropLocation.Top: if (ttcTop.Items.Contains(ttItem) && 1 == ttcTop.Items.Count) { return(false); } DetachHandlers(ttcTop); gridContentHorizontal.Children.Remove(ttcTop); TearableTabControl ttcTopTmp = ttcTop; if (this.TabParent == null) { } if (ttcTop == null) { // ADE 20210319 return(false); } if (itcc.AddControl(location, ttcTop, ttItem, ref droppedItemParent)) { ttddTop.Visibility = Visibility.Collapsed; ttddTop.DetachDetectorElement(); Grid.SetRow(itcc as UIElement, 0); itccTop = itcc; ttcTop = null; if (null == droppedItemParent) { gridContentHorizontal.Children.Insert(0, itcc as UIElement); } else { droppedItemParent.Children.Add(itcc as UIElement); } } else { (ttcTopTmp.Parent as Grid).Children.Remove(ttcTopTmp); gridContentHorizontal.Children.Insert(0, ttcTopTmp); } break; case DropLocation.Bottom: if (ttcBottom.Items.Contains(ttItem) && 1 == ttcBottom.Items.Count) { return(false); } DetachHandlers(ttcBottom); gridContentHorizontal.Children.Remove(ttcBottom); TearableTabControl ttcBottomTmp = ttcBottom; if (ttcBottom == null) { } if (itcc.AddControl(location, ttcBottom, ttItem, ref droppedItemParent)) { ttddBottom.Visibility = Visibility.Collapsed; ttddBottom.DetachDetectorElement(); Grid.SetRow(itcc as UIElement, 2); itccBottom = itcc; ttcBottom = null; if (null == droppedItemParent) { gridContentHorizontal.Children.Insert(0, itcc as UIElement); } else { droppedItemParent.Children.Add(itcc as UIElement); } } else { (ttcBottomTmp.Parent as Grid).Children.Remove(ttcBottomTmp); gridContentHorizontal.Children.Insert(0, ttcBottomTmp); } break; case DropLocation.Left: case DropLocation.Right: case DropLocation.Center: default: throw new NotSupportedException("Center not supported"); } return(true); }
void IDropable.Drop(object data, DropLocation location) { DocumentLoader.Load(((string[])data).First()); }
private void MoveNode(NodeWriteAccess nodeToMove, NodeWriteAccess targetNode, DropLocation operation) { var siblings = targetNode.Siblings; var dropPos = siblings.IndexOf(targetNode); if (operation == DropLocation.After) { dropPos++; } if (siblings.Contains(nodeToMove)) { var oldPos = siblings.IndexOf(nodeToMove); if (oldPos < dropPos) { // ObservableCollection first removes the item and then reinserts which invalidates the index dropPos--; } siblings.Move(oldPos, dropPos); } else { if (dropPos < siblings.Count) { ChangeParent(nodeToMove, n => siblings.Insert(dropPos, n), targetNode.GetParent()); } else { ChangeParent(nodeToMove, n => siblings.Add(n), targetNode.GetParent()); } } }
private IDropAction getDropAction(IEnumerable<Node> nodes, DragDropInfo dragDropInfo, DropLocation dropLocation ) { var qry = new DropQuery() { AltDown = ((dragDropInfo.KeyStates & DragDropKeyStates.AltKey) != 0), ShiftDown = ((dragDropInfo.KeyStates & DragDropKeyStates.ShiftKey) != 0), ControlDown = ((dragDropInfo.KeyStates & DragDropKeyStates.ControlKey) != 0), ContainsClasses = (nodes.Any(x => x.IsClass)), ContainsMembers = (nodes.Any(x => !x.IsClass)), DroppingIntoClass = dropLocation.Class != null, DroppingIntoMethod = dropLocation.Function != null }; return _dropActionProvider.GetAction(qry); }
bool IDropable.IsDropAllowed(object data, DropLocation location) { return(true); }
void IDropable.Drop( object data, DropLocation location ) { var droppedElement = data as NodeViewModel; if( droppedElement == null ) { return; } if( droppedElement.Id == Id ) { //if dragged and dropped yourself, don't need to do anything return; } if( location == DropLocation.Before || location == DropLocation.After ) { var operation = location == DropLocation.Before ? MoveOperation.MoveBefore : MoveOperation.MoveAfter; ProjectService.Project.MoveNode( droppedElement.Node, Node, operation ); } else { ProjectService.Project.AddChildTo( droppedElement.Node, Node ); } IsExpanded = true; }
bool IDropable.IsDropAllowed( object data, DropLocation location ) { return true; }
public bool AddControl(DropLocation location, TearableTabControl ttControl, TearableTabItem newTabItem, ref Grid droppedItemParent) { return(true); }
bool IDropable.IsDropAllowed(object data, DropLocation location) { return(DocumentLoader != null && DocumentLoader.CanLoad(((string[])data).First())); }