void Target_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var Target = sender as TabItem; if (Target == null || Target.Tag == null || !(Target.Tag is Guid)) { return; } var Position = e.GetPosition(Target); if (Position.Y > TABITEM_HEADER_HEIGHT) // If double-clicking beyond the header... exit { return; } var ViewId = (Guid)Target.Tag; var TargetView = this.RegisteredViews.FirstOrDefault(doc => doc.GlobalId == ViewId); if (TargetView == null) { return; } var Context = TargetView.EditEngine; var EditingView = (View)TargetView; // IMPORTANT: This avoid crashes by a double-click over the close button [X] of the tab header. if (EditingView.IsClosing) { return; } CompositionEngine.EditViewProperties(EditingView); }
private void NavTree_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { this.PreviousPointingPosition = default(Point); Idea PointedIdea = null; if (e.OriginalSource is FrameworkElement) { var SourceItem = Display.GetNearestVisualDominantOfType <TreeViewItem>(e.OriginalSource as FrameworkElement); if (SourceItem != null) { var PointedView = SourceItem.Header as View; if (PointedView == null) { PointedIdea = SourceItem.Header as Idea; } else if (PointedView == this.CurrentView) { CompositionEngine.EditViewProperties(PointedView); return; } } } if (PointedIdea != null && PointedIdea == this.TargetIdea) { // Is clicking for jump... this.IsNavigating = true; var PointingShortcut = (this.CurrentView.Manipulator.CurrentTargetedObject is VisualElement && ((VisualElement)this.CurrentView.Manipulator.CurrentTargetedObject).OwnerRepresentation.IsShortcut && ((VisualElement)this.CurrentView.Manipulator.CurrentTargetedObject).OwnerRepresentation.RepresentedIdea == TargetIdea); if (PointingShortcut) { ApplicationProduct.ProductDirector.EditorInterrelationsControl.SetTarget(TargetIdea); // Do not "jump", it could interfere with resizing/moving of shortcut symbols } else if (TargetIdea.OwnerContainer != null) { if (TargetIdea.OwnerContainer.CompositeActiveView == this.CurrentView && this.WorkspaceDirector.ActiveDocument.ActiveDocumentView == this.CurrentView) { var SelectableSymbols = this.CurrentView.ViewChildren .Where(child => child.Key is VisualSymbol && ((VisualSymbol)child.Key).OwnerRepresentation .RepresentedIdea == TargetIdea) .Select(child => (VisualSymbol)child.Key); if (SelectableSymbols.Any() && !SelectableSymbols.Any(symb => symb.OwnerRepresentation.RepresentedIdea.IsSelected)) { this.CurrentView.Manipulator.ApplySelection(SelectableSymbols.First(), false, (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))); } ApplicationProduct.ProductDirector.EditorInterrelationsControl.SetTarget(TargetIdea); this.CurrentView.Presenter.BringIntoView( TargetIdea.VisualRepresentators.First(vrep => vrep.DisplayingView == this.CurrentView).MainSymbol.BaseArea); } else { var Representator = TargetIdea.MainRepresentator; if (Representator != null && !CompositionEngine.IsSelectingByRectangle /*- && this.IsMouseOver && Mouse.LeftButton == MouseButtonState.Pressed*/) { Representator.DisplayingView.Engine.ShowView(Representator.DisplayingView); Representator.DisplayingView.Presenter.PostCall( vpres => { vpres.OwnerView.Manipulator.ApplySelection(Representator.MainSymbol); vpres.OwnerView.Presenter.BringIntoView(Representator.MainSymbol.BaseArea); }); } } } this.TargetIdea = null; this.IsNavigating = false; } }