示例#1
0
        internal void CheckContentsEmpty()
        {
            if (Items.Count == 0)
            {
                bool isMainDocPaneToBeClosed = IsMainDocumentPane.HasValue &&
                                               IsMainDocumentPane.Value;

                if (isMainDocPaneToBeClosed)
                {
                    DockingManager manager = GetManager();
                    DocumentPane   candidateNewMainDocPane = manager.FindAnotherLogicalChildContained <DocumentPane>(this);
                    if (candidateNewMainDocPane != null &&
                        candidateNewMainDocPane.GetManager() == this.GetManager())
                    {
                        ResizingPanel containerPanel = Parent as ResizingPanel;
                        if (containerPanel != null)
                        {
                            containerPanel.RemoveChild(this);
                        }

                        manager.MainDocumentPane = candidateNewMainDocPane;
                        candidateNewMainDocPane.NotifyPropertyChanged("IsMainDocumentPane");
                    }
                }
                else
                {
                    ResizingPanel containerPanel = Parent as ResizingPanel;
                    if (containerPanel != null)
                    {
                        containerPanel.RemoveChild(this);
                    }
                }
            }
        }
示例#2
0
        public override Pane ClonePane()
        {
            DockablePane paneToAnchor = new DockablePane();

            ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height));

            if (HostedPane.Style != null)
            {
                paneToAnchor.Style = HostedPane.Style;
            }

            int selectedIndex = HostedPane.SelectedIndex;

            //transfer contents from hosted pane in the floating window and
            //the new created dockable pane
            while (HostedPane.Items.Count > 0)
            {
                paneToAnchor.Items.Add(
                    HostedPane.RemoveContent(0));
            }

            paneToAnchor.SelectedIndex = selectedIndex;

            return(paneToAnchor);
        }
        /// <summary>
        /// Restore content specific layout settings
        /// </summary>
        /// <param name="storeReader">Saved xml element containg content layout settings</param>
        /// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
        public virtual void RestoreLayout(XmlElement contentElement)
        {
            if (contentElement.HasAttribute("FloatingWindowSize"))
            {
                FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize"));
            }


            Size effectiveSize = new Size(0d, 0d);

            if (contentElement.HasAttribute("EffectiveSize"))
            {
                // Store
                effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize"));
            }

            ResizingPanel.SetEffectiveSize(this, effectiveSize);

            if (contentElement.HasAttribute("ChildIndex"))
            {
                _savedStateAndPosition = new DockableContentStateAndPosition(
                    ContainerPane,
                    int.Parse(contentElement.GetAttribute("ChildIndex")),
                    double.Parse(contentElement.GetAttribute("Width")),
                    double.Parse(contentElement.GetAttribute("Height")),
                    (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor"))
                    );
                //contentElement.HasAttribute("State") ? (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State") );
            }
        }
        public override Pane ClonePane()
        {
            DockablePane paneToAnchor = new DockablePane();

            //transfer the resizing panel sizes
            //paneToAnchor.SetValue(ResizingPanel.ResizeWidthProperty,
            //    HostedPane.GetValue(ResizingPanel.ResizeWidthProperty));
            //paneToAnchor.SetValue(ResizingPanel.ResizeHeightProperty,
            //    HostedPane.GetValue(ResizingPanel.ResizeHeightProperty));
            ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height));


            int selectedIndex = HostedPane.SelectedIndex;

            //transfer contents from hosted pane in the floating window and
            //the new created dockable pane
            while (HostedPane.Items.Count > 0)
            {
                paneToAnchor.Items.Add(
                    HostedPane.RemoveContent(0));
            }

            paneToAnchor.SelectedIndex = selectedIndex;

            return(paneToAnchor);
        }
        public FlyoutDockablePane(DockableContent content)
        {
            _referencedPane = content.ContainerPane as DockablePane;
            _manager        = _referencedPane.GetManager();

            //save current content position in container pane
            _arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content);
            Anchor = _referencedPane.Anchor;

            SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width));
            SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height));


            //if (double.IsInfinity(ResizingPanel.GetResizeWidth(this)))
            //    ResizingPanel.SetResizeWidth(this, 200);
            //if (double.IsInfinity(ResizingPanel.GetResizeHeight(this)))
            //    ResizingPanel.SetResizeHeight(this, 200);

            this.Style = _referencedPane.Style;

            //remove content from container pane
            //and add content to my temporary pane
            _referencedPane.Items.RemoveAt(_arrayIndexPreviousPane);
            this.Items.Add(content);


            //select the single content in this pane
            SelectedItem = this.Items[0];
        }
示例#6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mnuFlipContent = ((System.Windows.Controls.MenuItem)(target));

            #line 12 "..\..\Window5.xaml"
                this.mnuFlipContent.Click += new System.Windows.RoutedEventHandler(this.ShowDockingManager_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.TestContainer = ((System.Windows.Controls.ContentControl)(target));
                return;

            case 3:
                this._dockingManager = ((AvalonDock.DockingManager)(target));

            #line 16 "..\..\Window5.xaml"
                this._dockingManager.Loaded += new System.Windows.RoutedEventHandler(this._dockingManager_Loaded);

            #line default
            #line hidden
                return;

            case 4:
                this.content1 = ((AvalonDock.DockableContent)(target));
                return;

            case 5:
                this.content2 = ((AvalonDock.DockableContent)(target));
                return;

            case 6:
                this.content3 = ((AvalonDock.DockableContent)(target));
                return;

            case 7:
                this.bottomPanel = ((AvalonDock.ResizingPanel)(target));
                return;

            case 8:
                this.ShowMeFirst = ((AvalonDock.DockableContent)(target));
                return;

            case 9:
                this.ShowMeSecond = ((AvalonDock.DockableContent)(target));
                return;

            case 10:
                this.AlsoShowMeSecond = ((AvalonDock.DockableContent)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#7
0
        /// <summary>
        /// Restore content specific layout settings
        /// </summary>
        /// <param name="storeReader">Saved xml element containg content layout settings</param>
        /// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
        public override void RestoreLayout(XmlElement contentElement)
        {
            if (contentElement.HasAttribute("FloatingWindowSize"))
            {
                FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize"));
            }
            if (contentElement.HasAttribute("FlyoutWindowSize"))
            {
                FlyoutWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FlyoutWindowSize"));
            }

            Size effectiveSize = new Size(0d, 0d);

            if (contentElement.HasAttribute("EffectiveSize"))
            {
                // Store
                effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize"));
            }

            ResizingPanel.SetEffectiveSize(this, effectiveSize);

            if (contentElement.HasAttribute("ChildIndex"))
            {
                Pane paneRef           = null;
                Guid containerPaneGuid = Guid.Empty;
                if (contentElement.HasAttribute("ContainerPaneID"))
                {
                    containerPaneGuid = new Guid(contentElement.GetAttribute("ContainerPaneID"));

                    if (Manager != null)
                    {
                        ILinqToTree <AvaloniaObject> itemFound = new LogicalTreeAdapter(Manager).Descendants().FirstOrDefault(el => el.Item is DockablePane && ((el.Item as DockablePane).ID == containerPaneGuid));
                        paneRef = itemFound != null ? itemFound.Item as DockablePane : null;
                    }
                }

                if (paneRef != null)
                {
                    _savedStateAndPosition = new DockableContentStateAndPosition(
                        paneRef,
                        int.Parse(contentElement.GetAttribute("ChildIndex")),
                        double.Parse(contentElement.GetAttribute("Width")),
                        double.Parse(contentElement.GetAttribute("Height")),
                        (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")),
                        (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State")));
                }
                else
                {
                    _savedStateAndPosition = new DockableContentStateAndPosition(
                        containerPaneGuid,
                        int.Parse(contentElement.GetAttribute("ChildIndex")),
                        double.Parse(contentElement.GetAttribute("Width")),
                        double.Parse(contentElement.GetAttribute("Height")),
                        (AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")),
                        (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State")));
                }
            }
        }
 internal void RestoreOriginalPane()
 {
     if (this.Items.Count == 1)
     {
         _referencedPane.Items.Insert(_arrayIndexPreviousPane, RemoveContent(0));
         ResizingPanel.SetResizeWidth(_referencedPane, ResizingPanel.GetResizeWidth(this));
         ResizingPanel.SetResizeHeight(_referencedPane, ResizingPanel.GetResizeHeight(this));
     }
 }
        protected override void OnVisualParentChanged(DependencyObject oldParent)
        {
            ResizingPanel panel = Parent as ResizingPanel;

            if (panel != null)
            {
                Orientation = panel.Orientation;
            }

            base.OnVisualParentChanged(oldParent);
        }
示例#10
0
        void FloatingWindow_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (HostedPane != null)
            {
                foreach (ManagedContent c in HostedPane.Items)
                {
                    c.FloatingWindowSize = new Size(Width, Height);
                }

                ResizingPanel.SetEffectiveSize(HostedPane, new Size(Width, Height));
            }
        }
示例#11
0
 internal void CheckContentsEmpty()
 {
     if (IsMainDocumentPane.HasValue &&
         !IsMainDocumentPane.Value &&
         Items.Count == 0)
     {
         ResizingPanel containerPanel = Parent as ResizingPanel;
         if (containerPanel != null)
         {
             containerPanel.RemoveChild(this);
         }
     }
 }
        public override ManagedContent RemoveContent(int index)
        {
            ManagedContent content = base.RemoveContent(index);

            if (Items.Count == 0)
            {
                ResizingPanel containerPanel = Parent as ResizingPanel;
                if (containerPanel != null)
                {
                    containerPanel.RemoveChild(this);
                }
            }

            return(content);
        }
示例#13
0
        /// <summary>
        /// Remove a child from children collection
        /// </summary>
        /// <param name="childToRemove"></param>
        internal void RemoveChild(FrameworkElement childToRemove)
        {
            int indexOfChildToRemove = Children.IndexOf(childToRemove);

            Debug.Assert(indexOfChildToRemove != -1);

            Children.RemoveAt(indexOfChildToRemove);

            if (Children.Count > 0)
            {
                SetupSplitters();

                if (Children.Count == 1)
                {
                    UIElement singleChild = this.Children[0];

                    if (Parent is ResizingPanel)
                    {
                        ResizingPanel parentPanel = Parent as ResizingPanel;
                        if (parentPanel != null)
                        {
                            int indexOfThisPanel = parentPanel.Children.IndexOf(this);
                            parentPanel.Children.RemoveAt(indexOfThisPanel);
                            this.Children.Remove(singleChild);
                            parentPanel.Children.Insert(indexOfThisPanel, singleChild);
                        }
                    }
                    else if (Parent is DockingManager)
                    {
                        DockingManager manager = Parent as DockingManager;
                        if (manager != null)
                        {
                            this.Children.Remove(singleChild);
                            manager.Content = singleChild;
                        }
                    }
                }
            }
            else
            {
                ResizingPanel parentPanel = Parent as ResizingPanel;
                if (parentPanel != null)
                {
                    parentPanel.RemoveChild(this);
                }
            }
        }
        internal DocumentPaneResizingPanel GetParentDocumentPaneResizingPanel()
        {
            ResizingPanel parentPanel = LogicalTreeHelper.GetParent(this) as ResizingPanel;
            
            if (parentPanel == null)
                return null;

            while (!(parentPanel is DocumentPaneResizingPanel))
            {
                parentPanel = LogicalTreeHelper.GetParent(parentPanel) as ResizingPanel;

                if (parentPanel == null)
                    return null;
            }

            return parentPanel as DocumentPaneResizingPanel;
        }
        public override Pane ClonePane()
        {
            DocumentPane paneToAnchor = new DocumentPane();

            ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height));

            //transfer contents from hosted pane in the floating window and
            //the new created dockable pane
            while (HostedPane.Items.Count > 0)
            {
                paneToAnchor.Items.Add(
                    HostedPane.RemoveContent(0));
            }
            paneToAnchor.ApplyTemplate();

            return(paneToAnchor);
        }
示例#16
0
        internal override ManagedContent RemoveContent(int index)
        {
            ManagedContent  content         = base.RemoveContent(index);
            DockableContent dockableContent = content as DockableContent;

            if (((dockableContent == null) ||
                 (dockableContent != null && dockableContent.SavedStateAndPosition == null) ||
                 (dockableContent != null && dockableContent.SavedStateAndPosition.ContainerPane != this)) &&
                Items.Count == 0)
            {
                ResizingPanel containerPanel = Parent as ResizingPanel;
                if (containerPanel != null)
                {
                    containerPanel.RemoveChild(this);
                }
            }

            return(content);
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 12 "..\..\..\Window1.xaml"
                ((System.Windows.Controls.MenuItem)(target)).Click += new System.Windows.RoutedEventHandler(this.MenuItem_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.dockManager = ((AvalonDock.DockingManager)(target));
                return;

            case 3:
                this.resizeScenarioPanel = ((AvalonDock.ResizingPanel)(target));
                return;

            case 4:
                this.scenarioDocumentPane = ((AvalonDock.DocumentPane)(target));
                return;

            case 5:
                this.messagesDockPane = ((AvalonDock.DockablePane)(target));
                return;

            case 6:
                this.messagesPane = ((AvalonDock.DockableContent)(target));
                return;

            case 7:
                this.txtMessages = ((System.Windows.Controls.TextBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.DockManager = ((AvalonDock.DockingManager)(target));
                return;

            case 2:
                this.VerticalResizingPanel = ((AvalonDock.ResizingPanel)(target));
                return;

            case 3:
                this.HorizontalResizingPanel = ((AvalonDock.ResizingPanel)(target));
                return;

            case 4:
                this.DesignerDockablePane = ((AvalonDock.DocumentPane)(target));
                return;

            case 5:
                this.Placeholder1 = ((AvalonDock.DockablePane)(target));
                return;

            case 6:
                this.Placeholder2 = ((AvalonDock.DockablePane)(target));
                return;

            case 7:
                this.TabsPane = ((AvalonDock.DockablePane)(target));
                return;

            case 8:
                this.Status = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
示例#19
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.mnuFlipContent = ((System.Windows.Controls.MenuItem)(target));
     
     #line 12 "..\..\Window5.xaml"
     this.mnuFlipContent.Click += new System.Windows.RoutedEventHandler(this.ShowDockingManager_Click);
     
     #line default
     #line hidden
     return;
     case 2:
     this.TestContainer = ((System.Windows.Controls.ContentControl)(target));
     return;
     case 3:
     this._dockingManager = ((AvalonDock.DockingManager)(target));
     
     #line 16 "..\..\Window5.xaml"
     this._dockingManager.Loaded += new System.Windows.RoutedEventHandler(this._dockingManager_Loaded);
     
     #line default
     #line hidden
     return;
     case 4:
     this.content1 = ((AvalonDock.DockableContent)(target));
     return;
     case 5:
     this.content2 = ((AvalonDock.DockableContent)(target));
     return;
     case 6:
     this.content3 = ((AvalonDock.DockableContent)(target));
     return;
     case 7:
     this.bottomPanel = ((AvalonDock.ResizingPanel)(target));
     return;
     case 8:
     this.ShowMeFirst = ((AvalonDock.DockableContent)(target));
     return;
     case 9:
     this.ShowMeSecond = ((AvalonDock.DockableContent)(target));
     return;
     case 10:
     this.AlsoShowMeSecond = ((AvalonDock.DockableContent)(target));
     return;
     }
     this._contentLoaded = true;
 }
示例#20
0
        /// <summary>
        /// Anchor a dockable pane to a border
        /// </summary>
        /// <param name="paneToAnchor"></param>
        /// <param name="anchor"></param>
        public void Anchor(DockablePane paneToAnchor, AnchorStyle anchor)
        {
            //ensure that content property is not empty
            EnsureContentNotEmpty();

            if (Content == null)
                return;

            //remove the pane from its original children collection
            FrameworkElement parentElement = paneToAnchor.Parent as FrameworkElement;

            if (anchor == AnchorStyle.None)
                anchor = AnchorStyle.Right;

            //Change anchor border according to FlowDirection
            if (FlowDirection == FlowDirection.RightToLeft)
            {
                if (anchor == AnchorStyle.Right)
                    anchor = AnchorStyle.Left;
                else if (anchor == AnchorStyle.Left)
                    anchor = AnchorStyle.Right;
            }

            //parentElement should be a DockingManager or a ResizingPanel
            if (parentElement is ContentControl)
            {
                ((ContentControl)parentElement).Content = null;
            }

            //and insert in the top level panel if exist
            ResizingPanel toplevelPanel = Content as ResizingPanel;

            if (toplevelPanel != null && toplevelPanel.Children.Count == 0)
            {
                Content = null;
                toplevelPanel = null;
            }

            Orientation requestedOrientation =
                (anchor == AnchorStyle.Bottom || anchor == AnchorStyle.Top) ? Orientation.Vertical : Orientation.Horizontal;

            //if toplevel panel contains only one child then just override the orientation
            //as requested
            if (toplevelPanel != null && toplevelPanel.Children.Count == 1)
                toplevelPanel.Orientation = requestedOrientation;

            if (toplevelPanel == null ||
                toplevelPanel.Orientation != requestedOrientation)
            {
                //if toplevel panel doesn't exist or it has not the correct orientation
                //we have to create a new one and set it as content of docking manager
                toplevelPanel = new ResizingPanel();
                toplevelPanel.Orientation = requestedOrientation;

                FrameworkElement contentElement = Content as FrameworkElement;

                _allowRefreshContents = false;
                Content = null;

                if (anchor == AnchorStyle.Left ||
                    anchor == AnchorStyle.Top)
                {
                    toplevelPanel.Children.Add(paneToAnchor);
                    toplevelPanel.InsertChildRelativeTo(contentElement, paneToAnchor, true);
                }
                else
                {
                    toplevelPanel.Children.Add(paneToAnchor);
                    toplevelPanel.InsertChildRelativeTo(contentElement, paneToAnchor, false);
                }

                _allowRefreshContents = true;
                Content = toplevelPanel;
            }
            else
            {

                //here we have a docking manager content with the right orientation
                //so we have only to insert new child at correct position
                if (anchor == AnchorStyle.Left ||
                    anchor == AnchorStyle.Top)
                {
                    //add new child before first one (prepend)
                    toplevelPanel.InsertChildRelativeTo(paneToAnchor, toplevelPanel.Children[0] as FrameworkElement, false);
                }
                else
                {
                    //add new child after last one (append)
                    toplevelPanel.InsertChildRelativeTo(paneToAnchor, toplevelPanel.Children[toplevelPanel.Children.Count - 1] as FrameworkElement, true);
                }
            }

            //Refresh anchor style
            DockablePane paneToAnchorAsDockablePane = paneToAnchor as DockablePane;

            if (paneToAnchorAsDockablePane != null)
            {
                paneToAnchorAsDockablePane.Anchor = anchor;
            }

            if (anchor == AnchorStyle.Left ||
                anchor == AnchorStyle.Right)
            {
                double w = Math.Min(
                    ActualWidth / 2.0,
                    ResizingPanel.GetEffectiveSize(paneToAnchor).Width);
                ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(w, GridUnitType.Pixel));
                ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(1.0, GridUnitType.Star));
            }
            else
            {
                double h = Math.Min(
                    ActualHeight / 2.0,
                    ResizingPanel.GetEffectiveSize(paneToAnchor).Height);
                ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(1.0, GridUnitType.Star));
                ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(h, GridUnitType.Pixel));
            }

            //refresh contents state
            paneToAnchor.Items.OfType<DockableContent>().ForEach(dc =>
                {
                    dc.SetStateToDock();
                });

            //paneToAnchor.Focus();
            toplevelPanel.InvalidateMeasure();
        }
示例#21
0
        /// <summary>
        /// Anchor a dockable pane (<see cref="DockablePane"/>) to a border of an other dockable pane
        /// </summary>
        /// <param name="paneToAnchor">Pane to anchor</param>
        /// <param name="relativePane">Pane relative</param>
        /// <param name="anchor"></param>
        public void Anchor(DockablePane paneToAnchor, DockablePane relativePane, AnchorStyle anchor)
        {
            //ensure that content property is not empty
            EnsureContentNotEmpty();

            if (anchor == AnchorStyle.None)
                anchor = AnchorStyle.Right;

            //get a refernce to the resizingpanel container of relativePane
            ResizingPanel relativePaneContainer = LogicalTreeHelper.GetParent(relativePane) as ResizingPanel;
            Orientation requestedOrientation =
                (anchor == AnchorStyle.Bottom || anchor == AnchorStyle.Top) ? Orientation.Vertical : Orientation.Horizontal;

            if (relativePaneContainer == null)
            {
                Debug.Assert(relativePane.Parent == this);

                relativePaneContainer = new ResizingPanel();
                relativePaneContainer.Orientation = requestedOrientation;
                this.Content = relativePaneContainer;
                relativePaneContainer.Children.Add(relativePane);
            }

            Debug.Assert(relativePaneContainer != null, "By now we can't have a pane without a resizing panel containing it");

            #region Create and setup container panel
            if (relativePaneContainer != null)
            {
                //check if orientation is right
                if (relativePaneContainer.Orientation != requestedOrientation)
                {
                    //if the existing panel is not oriented as we want
                    //create a new one
                    ResizingPanel newPanel = new ResizingPanel();
                    newPanel.Orientation = requestedOrientation;

                    if (newPanel.Orientation == Orientation.Horizontal)
                        ResizingPanel.SetResizeHeight(newPanel, ResizingPanel.GetResizeHeight(relativePane));
                    else
                        ResizingPanel.SetResizeWidth(newPanel, ResizingPanel.GetResizeWidth(relativePane));

                    //replace relative pane in its' container panel
                    //with this new panel
                    int indexofRelativePane = relativePaneContainer.Children.IndexOf(relativePane);
                    relativePaneContainer.Children.Remove(relativePane);
                    relativePaneContainer.Children.Insert(indexofRelativePane, newPanel);

                    //now we have a panel correctly placed in the tree
                    newPanel.Children.Add(relativePane);
                    newPanel.InsertChildRelativeTo(
                        paneToAnchor, relativePane, anchor == AnchorStyle.Right || anchor == AnchorStyle.Bottom);

                    relativePaneContainer = newPanel;
                }
                else
                {
                    if (anchor == AnchorStyle.Left ||
                        anchor == AnchorStyle.Top)
                    {
                        //add new child before first (prepend)
                        relativePaneContainer.InsertChildRelativeTo(paneToAnchor,
                            relativePane, false);
                    }
                    else
                    {
                        //add new child after last (append)
                        relativePaneContainer.InsertChildRelativeTo(paneToAnchor,
                            relativePane, true);
                    }
                }

                relativePaneContainer.InvalidateMeasure();
            }
            #endregion

            //than set the new anchor style for the pane
            paneToAnchor.Anchor = relativePane.Anchor;

            if (anchor == AnchorStyle.Left ||
                anchor == AnchorStyle.Right)
            {
                double w = Math.Min(
                    ResizingPanel.GetEffectiveSize(relativePane).Width / 2.0,
                    ResizingPanel.GetEffectiveSize(paneToAnchor).Width);
                ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(w, GridUnitType.Pixel));
                ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(1.0, GridUnitType.Star));
            }
            else
            {
                double h = Math.Min(
                    ResizingPanel.GetEffectiveSize(relativePane).Height / 2.0,
                    ResizingPanel.GetEffectiveSize(paneToAnchor).Height);
                ResizingPanel.SetResizeWidth(paneToAnchor, new GridLength(1.0, GridUnitType.Star));
                ResizingPanel.SetResizeHeight(paneToAnchor, new GridLength(h, GridUnitType.Pixel));
            }

            //refresh contents state
            foreach (DockableContent draggedContent in paneToAnchor.Items)
            {
                draggedContent.SetStateToDock();
            }

            if (relativePaneContainer != null)
                relativePaneContainer.AdjustPanelSizes();

            //paneToAnchor.Focus();
        }
示例#22
0
        //void SaveLayout(XmlWriter xmlWriter, DocumentPaneResizingPanel panelToSerialize)
        //{
        //    xmlWriter.WriteStartElement("DocumentPanePlaceHolder");
        //    //List<DockableContent> listOfFoundContents = new List<DockableContent>();
        //    //FindContents<DockableContent>(listOfFoundContents, panelToSerialize);
        //    var listOfFoundContents = new LogicalTreeAdapter(panelToSerialize).Descendants().Where(i => i.Item is DockableContent).Select(i => i.Item);
        //    foreach (DockableContent content in listOfFoundContents)
        //    {
        //        SaveLayout(xmlWriter, content);
        //    }
        //    xmlWriter.WriteEndElement();
        //}
        void SaveLayout(XmlWriter xmlWriter, ResizingPanel panelToSerialize)
        {
            if (panelToSerialize is DocumentPaneResizingPanel)
                xmlWriter.WriteStartElement("DocumentPaneResizingPanel");
            else
                xmlWriter.WriteStartElement("ResizingPanel");

            //if (!double.IsInfinity(ResizingPanel.GetResizeWidth(panelToSerialize)))
            //    xmlWriter.WriteAttributeString("ResizeWidth", XmlConvert.ToString(ResizingPanel.GetResizeWidth(panelToSerialize)));
            //if (!double.IsInfinity(ResizingPanel.GetResizeHeight(panelToSerialize)))
            //    xmlWriter.WriteAttributeString("ResizeHeight", XmlConvert.ToString(ResizingPanel.GetResizeHeight(panelToSerialize)));

            xmlWriter.WriteAttributeString("ResizeWidth", ResizingPanel.GetResizeWidth(panelToSerialize).ToString());
            xmlWriter.WriteAttributeString("ResizeHeight", ResizingPanel.GetResizeHeight(panelToSerialize).ToString());
            xmlWriter.WriteAttributeString("EffectiveSize", new SizeConverter().ConvertToInvariantString(ResizingPanel.GetEffectiveSize(panelToSerialize)));

            xmlWriter.WriteAttributeString("Orientation", Convert.ToString(panelToSerialize.Orientation));

            foreach (UIElement child in panelToSerialize.Children)
            {
                if (child is DockablePane)
                    SaveLayout(xmlWriter, child as DockablePane);
                else if (child is DocumentPane)
                    SaveLayout(xmlWriter, child as DocumentPane);
                //else if (child is DocumentPaneResizingPanel)
                //    SaveLayout(xmlWriter, child as DocumentPaneResizingPanel);
                else if (child is ResizingPanel)
                    SaveLayout(xmlWriter, child as ResizingPanel);
            }

            xmlWriter.WriteEndElement();
        }
示例#23
0
        /// <summary>
        /// Update the <see cref="DockablePane.Anchor"/> property relative to the <see cref="DocumentContent"/> object
        /// </summary>
        /// <param name="panel"></param>
        /// <returns></returns>
        /// <remarks>Traverse the logical tree starting from root <see cref="ResizingPanel"/> and set property <see cref="DockablePane.Anchor"/> of dockable pane found.</remarks>
        void UpdateAnchorStyle(ResizingPanel panel)
        {
            AnchorStyle currentAnchor = panel.Orientation == Orientation.Horizontal ? AnchorStyle.Left : AnchorStyle.Top;
            bool foundDocumentContent = false;

            foreach (FrameworkElement child in panel.Children)
            {
                if (child is ResizingPanel)
                {
                    if (!foundDocumentContent &&
                        GetMainDocumentPane(child as ResizingPanel) != null)
                    {
                        foundDocumentContent = true;
                        currentAnchor = panel.Orientation == Orientation.Horizontal ? AnchorStyle.Right : AnchorStyle.Bottom;
                        UpdateAnchorStyle(child as ResizingPanel);
                    }
                    else
                        ForceAnchorStyle(child as ResizingPanel, currentAnchor);
                }
                else if (child is DocumentPane)
                {
                    foundDocumentContent = true;
                    currentAnchor = panel.Orientation == Orientation.Horizontal ? AnchorStyle.Right : AnchorStyle.Bottom;
                }
                else if (child is DockablePane)
                {
                    (child as DockablePane).Anchor = currentAnchor;
                }
            }
        }
示例#24
0
        public void Register( RenderWindowManager rwm )
        {
            this.rwm = rwm;

            //var tabItem = new TabItem();
            //tabItem.Header = "Pokus";

            // var tabItems = TabControl.Items;

            var resHorizontalPanel = new ResizingPanel()
            {
                Orientation = Orientation.Horizontal
            };

            var resVerticalPanel = new ResizingPanel()
            {
                Orientation = Orientation.Vertical
            };

            /*
            OpenGLWindow tempGLWin = rwm.RenderWindows[0].GlWindows[0];
            var wfh = new WindowsFormsHost();
            wfh.Child = tempGLWin;

            var dockPane = new DockablePane();
            var documentPane = new DocumentPane();

            dockPane.Items.Add( new DockableContent()
            {
              Name = "classesContent",
              Title = "Classes"
            } );
            */

            var dockPane = new DockablePane();

            var documentPane = new DocumentPane();

            foreach ( var openglWindow in rwm.RenderWindows )
            {
                var formHost = new WindowsFormsHost()
                {
                    Child = openglWindow.GlWindows[0]
                };

                documentPane.Items.Add
                (
                  new DocumentContent()
                  {
                      Content = formHost,
                      Title = "a"
                  }
               );
            }

            //var a = new DocumentContent();
            //a.Content = wfh;
            //a.Title = "Raycast";
            //documentPane.Items.Add( a );

            //documentPane.Items.Add( new DocumentContent()
            //{
            //    Title = "My Document!"

            //} );

            //dockPane.Items.Add( new DockableContent()
            //{
            //    Name = "classesContent",
            //    Title = "Logs",

            //} );

            //var logDockPane = new DockablePane();

            //logDockPane.Items.Add( new DockableContent()
            //{
            //    Name = "classesContent",
            //    Title = "Logs",
            //}
            //);

            //resVerticalPanel.Children.Add( logDockPane );

            ResizingPanel XXX =  DockingManager.Content as ResizingPanel;

            XXX.Children.Add( dockPane );
            XXX.Children.Add( documentPane );
            //resHorizontalPanel.Children.Add( logDockPane);

            DockingManager.Content = XXX;
        }
示例#25
0
        internal void OnDragOver(OverlayWindowDockingButton owdDock, Point point)
        {
            if (selectionBox == null)
            {
                return;
            }

            Rect rectPane;

            double width  = 200;
            double height = 200;

            if (owdDock == owdBottom ||
                owdDock == owdLeft ||
                owdDock == owdTop ||
                owdDock == owdRight)
            {
                rectPane = _manager.SurfaceRectangle;
            }
            else
            {
                rectPane = CurrentDropPane.SurfaceRectangle;
                height   = Math.Min(rectPane.Height / 2,
                                    ResizingPanel.GetResizeHeight(_manager.DragPaneServices.FloatingWindow.HostedPane));
                width = Math.Min(rectPane.Width / 2,
                                 ResizingPanel.GetResizeWidth(_manager.DragPaneServices.FloatingWindow.HostedPane));
            }

            Point myScreenTopLeft = this.PointToScreenDPI(new Point());

            rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me

            //if (CurrentDropPane != null &&
            //    !double.IsInfinity(ResizingPanel.GetResizeWidth(CurrentDropPane)))
            //    width = ResizingPanel.GetResizeWidth(CurrentDropPane);

            //if (CurrentDropPane != null &&
            //    !double.IsInfinity(ResizingPanel.GetResizeHeight(CurrentDropPane)))
            //    height = ResizingPanel.GetResizeHeight(CurrentDropPane);


            if (owdDock == owdBottom || owdDock == owdPaneBottom)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height - height);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = height;
            }
            if (owdDock == owdLeft || owdDock == owdPaneLeft)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = width;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdRight || owdDock == owdPaneRight)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width - width);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = width;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdTop || owdDock == owdPaneTop)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = height;
            }
            if (owdDock == owdPaneInto)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = rectPane.Height;
            }

            selectionBox.Visibility = Visibility.Visible;

            _manager.DragPaneServices.FloatingWindow.OnShowSelectionBox();
        }
示例#26
0
        internal void ClearEmptyPanels(ResizingPanel panelToClear)
        {
            if (panelToClear == null)
                return;

            foreach (var childPanel in panelToClear.Children.OfType<ResizingPanel>().ToArray())
            {
                if (childPanel.Children.Count == 0)
                {
                    panelToClear.RemoveChild(childPanel);
                }
                else
                {
                    ClearEmptyPanels(childPanel);
                }
            }
        }
示例#27
0
        bool? FindPaneInPanel(ResizingPanel panel, Pane paneToFind)
        {
            foreach (UIElement child in panel.Children)
            {
                if (child == paneToFind)
                    return true;
                else if (child is DockablePane)
                    return null;
                else if (child is ResizingPanel)
                {
                    bool? found = FindPaneInPanel(child as ResizingPanel, paneToFind);
                    if (found.HasValue && found.Value)
                        return true;
                }
            }

            return false;
        }
示例#28
0
        /// <summary>
        /// Returns the main document pane
        /// </summary>
        /// <param name="parentPanel"></param>
        /// <returns></returns>
        internal static DocumentPane GetMainDocumentPane(ResizingPanel parentPanel)
        {
            foreach (UIElement child in parentPanel.Children)
            {
                if (child is DocumentPane)
                    return child as DocumentPane;

                if (child is ResizingPanel)
                {
                    DocumentPane foundDocPane = GetMainDocumentPane(child as ResizingPanel);
                    if (foundDocPane != null)
                        return foundDocPane;
                }
            }

            return null;
        }
示例#29
0
        private void _resizer_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            UIElement dragElement = sender as UIElement;

            if (dragElement.IsMouseCaptured)
            {
                Point       ptMoveDrag      = e.GetPosition(dragElement);
                AnchorStyle CorrectedAnchor = Anchor;

                if (CorrectedAnchor == AnchorStyle.Left && FlowDirection == FlowDirection.RightToLeft)
                {
                    CorrectedAnchor = AnchorStyle.Right;
                }
                else if (CorrectedAnchor == AnchorStyle.Right && FlowDirection == FlowDirection.RightToLeft)
                {
                    CorrectedAnchor = AnchorStyle.Left;
                }

                double deltaX = FlowDirection == FlowDirection.LeftToRight ? ptMoveDrag.X - ptStartDrag.X : ptStartDrag.X - ptMoveDrag.X;

                if (CorrectedAnchor == AnchorStyle.Left)
                {
                    if (Width + deltaX < 4.0)
                    {
                        Width = 4.0;
                    }
                    else
                    {
                        Width += deltaX;
                    }
                }
                else if (CorrectedAnchor == AnchorStyle.Top)
                {
                    if (Height + (ptMoveDrag.Y - ptStartDrag.Y) < 4.0)
                    {
                        Height = 4.0;
                    }
                    else
                    {
                        Height += ptMoveDrag.Y - ptStartDrag.Y;
                    }
                }
                else if (CorrectedAnchor == AnchorStyle.Right)
                {
                    if (Width - (deltaX) < 4)
                    {
                        Left  = originalLeft + originalWidth - 4;
                        Width = 4;
                    }
                    else
                    {
                        Left  += deltaX;
                        Width -= deltaX;
                    }
                }
                else if (CorrectedAnchor == AnchorStyle.Bottom)
                {
                    if (Height - (ptMoveDrag.Y - ptStartDrag.Y) < 4)
                    {
                        Top    = originalTop + originalHeight - 4;
                        Height = 4;
                    }
                    else
                    {
                        Top    += ptMoveDrag.Y - ptStartDrag.Y;
                        Height -= ptMoveDrag.Y - ptStartDrag.Y;
                    }
                }

                ResizingPanel.SetResizeHeight(ReferencedPane, ReferencedPane.ActualHeight);
                ResizingPanel.SetResizeWidth(ReferencedPane, ReferencedPane.ActualWidth);
            }
        }
示例#30
0
        public bool activatePlugin( string PluginFile, ref List<IPlugin> Plugins )
        {
            Assembly asm = null;

            try
            {
                // FIXME: check only for valid .net assemblies with manifest
                asm = Assembly.LoadFile( PluginFile );

                if ( asm == null )
                    return false;
            }
            catch ( Exception e )
            {
            }

            Type PluginClass = null;
            int i = 0;

            // iterate through all types in assembly

            // !! FIXME: for debug only

            //foreach ( Type type in asm.GetTypes() )
            //{
            //PluginClass = type;

            // !! FIXME: for debug only
            //if ( PluginClass is IRenderEngine )
            // if a rendering able plugin was found
            //{
            try
            {
                // create an instance of rendering plugin
                //IRenderEngine tplugin = Activator.CreateInstance( PluginClass ) as IRenderEngine;

                IRenderEngine tplugin = (IRenderEngine) new RayCaster( dsm, anim_man );

                ModelOrientationControl orientationControl = new ModelOrientationControl(tplugin,wm);
                var dockPane = new DockablePane();

                dockPane.Items.Add( new DockableContent()
                {
                    Name = "orientationContent",
                    Title = "Orientation",
                    Content = orientationControl
                } );

                var resHorizontalPanel = new ResizingPanel()
                {
                    Orientation = Orientation.Horizontal
                };

                resHorizontalPanel.Children.Add( dockPane );

                //resHorizontalPanel.Children.Add( logDockPane);
                this.wm.DockingManager.Content = resHorizontalPanel;

                var ccc = this.wm.DockingManager.Content;

                if ( tplugin != null )
                    Plugins.Add( tplugin );

                // setup a new RenderWindow
                RenderWindow renderWindow = new RenderWindow();
                renderWindow.RenderEngine = tplugin;

                //var renderingDataset = dsm.getRenderingDatasetRef();
                //renderWindow.SetRenderingDataset( ref renderingDataset );

                OpenGLWindow glWindow = new OpenGLWindow();
                glWindow.SetRenderingMethod( tplugin );

                renderWindow.GlWindows.Add( glWindow );
                this.rwm.RenderWindows.Add( renderWindow );

                // setup marching cubes opengl window
                IRenderEngine marchingCubesPlugin = (IRenderEngine) new MarchingCubes( dsm );

                if ( marchingCubesPlugin != null )
                    Plugins.Add( marchingCubesPlugin );

                // setup a new RenderWindow
                RenderWindow renderWindow2 = new RenderWindow();
                renderWindow2.RenderEngine = marchingCubesPlugin;

                OpenGLWindow glWindow2 = new OpenGLWindow();
                glWindow2.SetRenderingMethod( marchingCubesPlugin );

                renderWindow2.GlWindows.Add( glWindow2 );
                //this.rwm.RenderWindows.Add(renderWindow2);

                wm.Register( this.rwm );
            }
            //}

            catch ( Exception e )
            {
                MessageBox.Show( "Shit happened during plugin registration: " + PluginFile + e.Message );
            }

            return true;
        }
示例#31
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 22 "..\..\MainWindow.xaml"
                ((Novartis.Msi.MSImageView.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.WindowClosing);

            #line default
            #line hidden

            #line 22 "..\..\MainWindow.xaml"
                ((Novartis.Msi.MSImageView.MainWindow)(target)).Closed += new System.EventHandler(this.WindowClosed);

            #line default
            #line hidden

            #line 22 "..\..\MainWindow.xaml"
                ((Novartis.Msi.MSImageView.MainWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.WindowLoaded);

            #line default
            #line hidden

            #line 22 "..\..\MainWindow.xaml"
                ((Novartis.Msi.MSImageView.MainWindow)(target)).Initialized += new System.EventHandler(this.WindowInitialized);

            #line default
            #line hidden
                return;

            case 2:

            #line 26 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdOpen);

            #line default
            #line hidden
                return;

            case 3:

            #line 27 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdSaveAs);

            #line default
            #line hidden

            #line 27 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CanExecuteCmdSaveAs);

            #line default
            #line hidden
                return;

            case 4:

            #line 28 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdExit);

            #line default
            #line hidden
                return;

            case 5:

            #line 29 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdAbout);

            #line default
            #line hidden
                return;

            case 6:

            #line 30 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdToggleToolTips);

            #line default
            #line hidden
                return;

            case 7:

            #line 31 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdUseApproximation);

            #line default
            #line hidden
                return;

            case 8:

            #line 32 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdNewRoi);

            #line default
            #line hidden
                return;

            case 9:

            #line 33 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdOpenRoi);

            #line default
            #line hidden
                return;

            case 10:

            #line 34 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdSaveRoi);

            #line default
            #line hidden
                return;

            case 11:

            #line 35 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdSaveRoiAs);

            #line default
            #line hidden
                return;

            case 12:

            #line 36 "..\..\MainWindow.xaml"
                ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.OnCmdCloseRoi);

            #line default
            #line hidden
                return;

            case 13:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 14:
                this.FileMenu = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 15:
                this.FileOpen = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 16:
                this.FileSaveAs = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 17:
                this.FileExit = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 18:
                this.ROIMenu = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 19:
                this.RoiNew = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 20:
                this.RoiOpen = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 21:
                this.RoiSave = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 22:
                this.RoiSaveAs = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 23:
                this.RoiClose = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 24:
                this.ViewMenu = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 25:
                this.ShowToolTips = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 26:
                this.ShowStatusBar = ((System.Windows.Controls.MenuItem)(target));

            #line 77 "..\..\MainWindow.xaml"
                this.ShowStatusBar.Click += new System.Windows.RoutedEventHandler(this.ShowStatusBarClick);

            #line default
            #line hidden
                return;

            case 27:
                this.ViewIntensityGraph = ((System.Windows.Controls.MenuItem)(target));

            #line 78 "..\..\MainWindow.xaml"
                this.ViewIntensityGraph.Click += new System.Windows.RoutedEventHandler(this.ViewIntensityGraphClick);

            #line default
            #line hidden
                return;

            case 28:
                this.SettingsMenu = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 29:
                this.UseApproximation = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 30:
                this.HelpMenu = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 31:
                this.HelpAbout = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 32:
                this.toolBarTray = ((System.Windows.Controls.ToolBarTray)(target));
                return;

            case 33:
                this.tbFile = ((System.Windows.Controls.ToolBar)(target));
                return;

            case 34:
                this.tbbOpen = ((System.Windows.Controls.Button)(target));

            #line 92 "..\..\MainWindow.xaml"
                this.tbbOpen.Click += new System.Windows.RoutedEventHandler(this.OnCmdOpen);

            #line default
            #line hidden
                return;

            case 35:
                this.tbbSaveAs = ((System.Windows.Controls.Button)(target));

            #line 95 "..\..\MainWindow.xaml"
                this.tbbSaveAs.Click += new System.Windows.RoutedEventHandler(this.OnCmdSaveAs);

            #line default
            #line hidden
                return;

            case 36:
                this.dockingManager = ((AvalonDock.DockingManager)(target));

            #line 102 "..\..\MainWindow.xaml"
                this.dockingManager.ActiveContentChanged += new System.EventHandler(this.DockingManagerActiveContentChanged);

            #line default
            #line hidden

            #line 102 "..\..\MainWindow.xaml"
                this.dockingManager.ActiveDocumentChanged += new System.EventHandler(this.DockingManagerActiveDocumentChanged);

            #line default
            #line hidden

            #line 102 "..\..\MainWindow.xaml"
                this.dockingManager.DocumentClosed += new System.EventHandler(this.DockingManagerDocumentClosed);

            #line default
            #line hidden

            #line 102 "..\..\MainWindow.xaml"
                this.dockingManager.DocumentClosing += new System.EventHandler <System.ComponentModel.CancelEventArgs>(this.DockingManagerDocumentClosing);

            #line default
            #line hidden
                return;

            case 37:
                this.resizingPane = ((AvalonDock.ResizingPanel)(target));
                return;

            case 38:
                this.documentPane = ((AvalonDock.DocumentPane)(target));
                return;

            case 39:
                this.dockablePane = ((AvalonDock.DockablePane)(target));
                return;

            case 40:
                this.imagePropsContent = ((Novartis.Msi.MSImageView.ImagePropsContent)(target));
                return;

            case 41:
                this.roiProjectWindow = ((Novartis.Msi.MSImageView.RoiProjectWindow)(target));
                return;

            case 42:
                this.metaContent = ((Novartis.Msi.MSImageView.MetaContent)(target));
                return;

            case 43:
                this.statusBar = ((System.Windows.Controls.Primitives.StatusBar)(target));
                return;

            case 44:
                this.coordinatesLabel = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 45:
                this.coordinates = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 46:
                this.intensityLabel = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 47:
                this.intensity = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 48:
                this.infoText = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 49:
                this.progressOperation = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 50:
                this.progressBar = ((System.Windows.Controls.ProgressBar)(target));
                return;
            }
            this._contentLoaded = true;
        }
        public MainWindowViewModel(DockingManager dockingManager, ResizingPanel horizontalResizingPanel, ResizingPanel verticalResizingPanel, DockablePane tabsPane)
        {
            this.dockingManager = dockingManager;

            dockingManager.ActiveDocumentChanged += delegate(object sender, EventArgs args)
            {
                this.UpdateViews();
            };

            this.toolboxControl = new ToolboxControl();
            this.InitialiseToolbox();

            this.horizontalResizingPanel = horizontalResizingPanel;
            this.verticalResizingPanel = verticalResizingPanel;

            this.tabsPane = tabsPane;

            this.dockableContents = new Dictionary<ContentTypes, DockableContent>();
            this.ViewToolbox();

            string disableDebugViewOutputValue = ConfigurationManager.AppSettings["DisableDebugViewOutput"];
            if (!string.IsNullOrEmpty(disableDebugViewOutputValue))
            {
                this.disableDebugViewOutput = bool.Parse(disableDebugViewOutputValue);
            }
        }
示例#33
0
        internal bool OnDrop(OverlayWindowDockingButton owdDock, Point point)
        {
            //calculate desidered size
            Rect rectPane;

            switch (OverlayButtonHover)
            {
            case AvalonDock.OverlayButtonHover.DropBorderBottom:
            case AvalonDock.OverlayButtonHover.DropBorderLeft:
            case AvalonDock.OverlayButtonHover.DropBorderTop:
            case AvalonDock.OverlayButtonHover.DropBorderRight:
                rectPane = (_manager as IDropSurface).SurfaceRectangle;
                break;

            default:
                rectPane = (CurrentDropPane as IDropSurface).SurfaceRectangle;
                break;
            }

            var desideredWidth = Math.Min(
                rectPane.Width / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Width);
            var desideredHeight = Math.Min(
                rectPane.Height / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Height);

            var desideredSize = new Size(
                desideredWidth,
                desideredHeight);

            //user has dropped the floating window over a anchor button
            //create a new dockable pane to insert in the main layout
            //FIX: clone pane and return true only if overlayButtonOver is not set to None!!


            //floating window is going to be closed..
            selectionBox.Visibility = Visibility.Hidden;

            //take the overlaybutton hover property to get the right button highlighted
            switch (OverlayButtonHover)
            {
            case AvalonDock.OverlayButtonHover.DropBorderBottom:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Bottom);
                break;

            case AvalonDock.OverlayButtonHover.DropBorderTop:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Top);
                break;

            case AvalonDock.OverlayButtonHover.DropBorderLeft:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Left);
                break;

            case AvalonDock.OverlayButtonHover.DropBorderRight:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Right);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneBottom:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Bottom);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneTop:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Top);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneLeft:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Left);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneRight:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane, AnchorStyle.Right);
                break;

            case AvalonDock.OverlayButtonHover.DropPaneInto:
                _manager.DropInto(
                    _manager.DragPaneServices.FloatingWindow.ClonePane(),
                    CurrentDropPane);
                break;

            default:
                return(false);
            }


            return(true);
        }
示例#34
0
 /// <summary>
 /// Called by <see cref="UpdateAnchorStyle"/> whene a <see cref="DocumentContent"/> object has been found
 /// </summary>
 /// <param name="panel"></param>
 /// <param name="forcedAnchor"></param>
 void ForceAnchorStyle(ResizingPanel panel, AnchorStyle forcedAnchor)
 {
     foreach (FrameworkElement child in panel.Children)
     {
         if (child is ResizingPanel)
         {
             ForceAnchorStyle((child as ResizingPanel), forcedAnchor);
         }
         else if ((child is DockablePane))
         {
             ((DockablePane)child).Anchor = forcedAnchor;
         }
     }
 }
示例#35
0
        internal void OnDragOver(OverlayWindowDockingButton owdDock, Point point)
        {
            if (selectionBox == null)
            {
                return;
            }

            Rect rectPane;

            if (owdDock == owdBottom ||
                owdDock == owdLeft ||
                owdDock == owdTop ||
                owdDock == owdRight)
            {
                rectPane = (_manager as IDropSurface).SurfaceRectangle;
            }
            else
            {
                rectPane = (CurrentDropPane as IDropSurface).SurfaceRectangle;
            }

            double selectionBoxWidth = Math.Min(
                rectPane.Width / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Width);
            double selectionBoxHeight = Math.Min(
                rectPane.Height / 2.0,
                ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Height);


            Point myScreenTopLeft = this.PointToScreenDPI(new Point());

            rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me

            if (owdDock == owdBottom || owdDock == owdPaneBottom)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height - selectionBoxHeight);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = selectionBoxHeight;
            }
            if (owdDock == owdLeft || owdDock == owdPaneLeft)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = selectionBoxWidth;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdRight || owdDock == owdPaneRight)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width - selectionBoxWidth);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = selectionBoxWidth;
                selectionBox.Height = rectPane.Height;
            }
            if (owdDock == owdTop || owdDock == owdPaneTop)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = selectionBoxHeight;
            }
            if (owdDock == owdPaneInto)
            {
                selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left);
                selectionBox.SetValue(Canvas.TopProperty, rectPane.Top);
                selectionBox.Width  = rectPane.Width;
                selectionBox.Height = rectPane.Height;
            }

            if (owdDock == owdLeft)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderLeft);//OverlayButtonHover = OverlayButtonHover.DropBorderLeft;
            }
            else if (owdDock == owdRight)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderRight);//OverlayButtonHover = OverlayButtonHover.DropBorderRight;
            }
            else if (owdDock == owdTop)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderTop);//OverlayButtonHover = OverlayButtonHover.DropBorderTop;
            }
            else if (owdDock == owdBottom)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropBorderBottom);//OverlayButtonHover = OverlayButtonHover.DropBorderBottom;
            }
            else if (owdDock == owdPaneInto)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneInto);//OverlayButtonHover = OverlayButtonHover.DropPaneInto;
            }
            else if (owdDock == owdPaneRight)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneRight);//OverlayButtonHover = OverlayButtonHover.DropPaneRight;
            }
            else if (owdDock == owdPaneTop)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneTop);//OverlayButtonHover = OverlayButtonHover.DropPaneTop;
            }
            else if (owdDock == owdPaneLeft)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneLeft);//OverlayButtonHover = OverlayButtonHover.DropPaneLeft;
            }
            else if (owdDock == owdPaneBottom)
            {
                SetOverlayButtonHover(OverlayButtonHover.DropPaneBottom);//OverlayButtonHover = OverlayButtonHover.DropPaneBottom;
            }
            else
            {
                SetOverlayButtonHover(OverlayButtonHover.None);//OverlayButtonHover = OverlayButtonHover.None;
            }
            selectionBox.Visibility = Visibility.Visible;

            _manager.DragPaneServices.FloatingWindow.OnShowSelectionBox();
        }
示例#36
0
        ResizingPanel RestoreResizingPanel(XmlElement mainElement, DockableContent[] actualContents, DocumentContent[] actualDocuments, ref DocumentPane mainDocumentPane)
        {
            ResizingPanel panel = null;

            if (mainElement.Name == "DocumentPaneResizingPanel")
                panel = new DocumentPaneResizingPanel();
            else
                panel = new ResizingPanel();

            if (mainElement.HasAttribute("Orientation"))
                panel.Orientation = (Orientation)Enum.Parse(typeof(Orientation), mainElement.GetAttribute("Orientation"));
            if (mainElement.HasAttribute("ResizeWidth"))
                ResizingPanel.SetResizeWidth(panel, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeWidth")));
            if (mainElement.HasAttribute("ResizeHeight"))
                ResizingPanel.SetResizeHeight(panel, (GridLength)GLConverter.ConvertFromInvariantString(mainElement.GetAttribute("ResizeHeight")));
            if (mainElement.HasAttribute("EffectiveSize"))
                ResizingPanel.SetEffectiveSize(panel, (Size)(new SizeConverter()).ConvertFromInvariantString(mainElement.GetAttribute("EffectiveSize")));

            foreach (XmlElement childElement in mainElement.ChildNodes)
            {
                if (childElement.Name == "ResizingPanel" ||
                    childElement.Name == "DocumentPaneResizingPanel")
                {
                    var childPanel = RestoreResizingPanel(childElement, actualContents, actualDocuments, ref mainDocumentPane);

                    if (childPanel.Children.Count > 0)
                    {
                        panel.Children.Add(childPanel);
                    }
                    else
                    {
                        Debug.WriteLine("Found empty ResizingPanel in stored layout, it will be discarded.");
                    }
                }
                #region Restore DockablePane
                else if (childElement.Name == "DockablePane")
                {
                    var pane = RestoreDockablePaneLayout(childElement, actualContents, actualDocuments);

                    //restore dockable panes even if no contents are inside (an hidden content could refer this pane in SaveStateAndPosition)
                    panel.Children.Add(pane);

                }
                #endregion
                #region Restore Contents inside a DocumentPane
                else if (childElement.Name == "DocumentPane")
                {
                    var documentPane = RestoreDocumentPaneLayout(childElement, actualContents, actualDocuments);

                    bool isMainDocumentPane = false;
                    if (childElement.HasAttribute("IsMain"))
                        isMainDocumentPane = XmlConvert.ToBoolean(childElement.GetAttribute("IsMain"));

                    if (documentPane.Items.Count > 0 ||
                        isMainDocumentPane)
                        panel.Children.Add(documentPane);

                    if (isMainDocumentPane)
                    {
                        if (mainDocumentPane != null)
                            throw new InvalidOperationException("Main document pane is set more than one time");

                        mainDocumentPane = documentPane;
                    }
                }

                #endregion
            }

            return panel;
        }
示例#37
0
        internal static bool IsPanelContainingDocumentPane(ResizingPanel parentPanel)
        {
            foreach (UIElement child in parentPanel.Children)
            {
                if (child is DocumentPane)
                    return true;
                if (child is ResizingPanel)
                {
                    bool foundDocPane = IsPanelContainingDocumentPane(child as ResizingPanel);
                    if (foundDocPane)
                        return foundDocPane;
                }
            }

            return false;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.GuestBookerStartWindow = ((Guest_Booker_Studio.MainWindow)(target));
     return;
     case 2:
     this.Pgrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 3:
     this.Part_Title = ((System.Windows.Controls.Grid)(target));
     
     #line 19 "..\..\..\MainWindow.xaml"
     this.Part_Title.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Part_Title_DoubleClick);
     
     #line default
     #line hidden
     return;
     case 4:
     this.minimizeButton = ((System.Windows.Controls.Button)(target));
     
     #line 39 "..\..\..\MainWindow.xaml"
     this.minimizeButton.Click += new System.Windows.RoutedEventHandler(this.minimizeButton_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.restoreMaximizeButton = ((System.Windows.Controls.Button)(target));
     
     #line 42 "..\..\..\MainWindow.xaml"
     this.restoreMaximizeButton.Click += new System.Windows.RoutedEventHandler(this.restoreMaximizeButton_Click);
     
     #line default
     #line hidden
     return;
     case 6:
     this.closeButton = ((System.Windows.Controls.Button)(target));
     
     #line 45 "..\..\..\MainWindow.xaml"
     this.closeButton.Click += new System.Windows.RoutedEventHandler(this.closeButton_Click);
     
     #line default
     #line hidden
     return;
     case 7:
     this.dockManager = ((AvalonDock.DockingManager)(target));
     return;
     case 8:
     this.vPanel = ((AvalonDock.ResizingPanel)(target));
     return;
     case 9:
     this.hPanel = ((AvalonDock.ResizingPanel)(target));
     return;
     case 10:
     this.WorkAreaWindow = ((Guest_Booker_Studio.Pages.Generic.InnerWindow)(target));
     return;
     case 11:
     this.ApplicationExplorerPane = ((AvalonDock.DockablePane)(target));
     return;
     case 12:
     this.ApplicationExplorer = ((Guest_Booker_Studio.Presentation.Controls.CustomerExplorerControl)(target));
     return;
     case 13:
     this.mainWindowStatusBarMessage = ((System.Windows.Controls.TextBlock)(target));
     return;
     }
     this._contentLoaded = true;
 }