Пример #1
0
        public StatusMapPanel()
        {
            var panel = downPanel();

            model   = new StatusTreeMap(this);
            treeMap = new QTreeMap(model);
            Content = panel;
            var controlGrid = new QGrid();

            ResizingPanel.SetResizeHeight(controlGrid, 23);
            controlGrid.addColumn(1, GridUnitType.Star);
            controlGrid.addColumn(1, GridUnitType.Star);
            controlGrid.addColumn(7, GridUnitType.Star);
            controlGrid.add(new QCheckBox("Equal Size Boxes", true, selected => { model.setIsEqualSizes(selected); treeMap.updateGuiNodes(); })
            {
                VerticalAlignment = VerticalAlignment.Center
            }, 0);
            var refershBox = new QComboBox("5", refreshRate => treeMap.setRefreshRate(int.Parse(refreshRate) * 1000))
            {
                Height = 20
            };

            controlGrid.add(withLabel("Refresh Rate (sec): ", refershBox), 1);
            refershBox.populateWithFirst("1", O.list("3", "5", "10", "30", "60"), false);
            panel.Children.Add(controlGrid);
            panel.Children.Add(treeMap);
            refreshContextMenus();
        }
Пример #2
0
        private static void StarGridLengthPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var value = new GridLength((double)e.NewValue, GridUnitType.Star);

            ResizingPanel.SetResizeHeight(d, value);
            ResizingPanel.SetResizeWidth(d, value);
        }
        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);
            }
        }
Пример #4
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);
                    }
                }
            }
        }
Пример #5
0
 public Shell()
 {
     InitializeComponent();
     regions = new Dictionary <Type, UIElement>
     {
         { GetType(), this },
         { typeof(Window), this },
         { StatusBar.GetType(), StatusBar },
         { Menu.GetType(), Menu },
         { DockManager.GetType(), DockManager },
         { Tabs.GetType(), Tabs },
         { ResizingPanel.GetType(), ResizingPanel },
         { ButtonBar.GetType(), ButtonBar },
         { TaskBarIcon.GetType(), TaskBarIcon },
         { StockWatch.GetType(), StockWatch },
     };
     DockManager.Loaded += (o, e) =>
     {
         if (File.Exists(settings_file))
         {
             DockManager.RestoreLayout(settings_file);
         }
     };
     Closing += (o, e) => DockManager.SaveLayout(settings_file);
     Closing += (o, e) => TaskBarIcon.Dispose();
     Loaded  += (o, e) =>
     {
         TaskBarIcon.Icon = UIIcon.Application.AsIcon();
     };
 }
Пример #6
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 <DependencyObject> 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")));
                }
            }
        }
        private void TreeView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (myTreeView.SelectedItem != null)
            {
                if (myTreeView.SelectedItem is IBlocksFolder)
                {
                    IBlocksFolder            fld = (IBlocksFolder)myTreeView.SelectedItem;
                    DockableContentBlockList tmp = new DockableContentBlockList(fld);
                    tmp.parentDockingManager = parentDockingManager;
                    tmp.Title = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    if (myTreeView.SelectedItem is BlocksOfflineFolder)
                    {
                        tmp.ToolTip = ((BlocksOfflineFolder)myTreeView.SelectedItem).Folder;
                    }
                    else
                    {
                        tmp.ToolTip = fld.ToString();
                    }
                    tmp.Show(parentDockingManager);
                    tmp.ToggleAutoHide();

                    //Set size of the parent DockablePane (it's automaticly been created!)
                    DockablePane tmpPane = tmp.TryFindParent <DockablePane>();
                    ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0));

                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (myTreeView.SelectedItem is ISymbolTable)
                {
                    ISymbolTable             fld = (ISymbolTable)myTreeView.SelectedItem;
                    ContentWindowSymbolTable tmp = new ContentWindowSymbolTable(fld);
                    tmp.Title   = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (myTreeView.SelectedItem is ReferenceData)
                {
                    ReferenceData fld = (ReferenceData)myTreeView.SelectedItem;
                    ContentWindowReferenceData tmp = new ContentWindowReferenceData(fld);
                    tmp.parentDockingManager = parentDockingManager;

                    tmp.Title   = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
                else if (myTreeView.SelectedItem is S7VATBlock)
                {
                    S7VATBlock          fld = (S7VATBlock)myTreeView.SelectedItem;
                    ContentWindowVarTab tmp = new ContentWindowVarTab(fld);
                    tmp.Title   = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                    tmp.ToolTip = fld.ToString();
                    tmp.Show(parentDockingManager);
                    parentDockingManager.ActiveDocument = tmp;
                }
            }
        }
Пример #8
0
        void addMarkets(Panel outer)
        {
            var pane = dockableChild(outer);

            ResizingPanel.SetResizeHeight(pane, 300);
            pane.Items.Add(new DockableContent {
                Name = "Markets", Title = "Markets", Content = marketsBox
            });
        }
Пример #9
0
        void addRunSetupPane(Panel resizingPanel)
        {
            var pane = dockableChild(resizingPanel);

            ResizingPanel.SetResizeHeight(pane, 45);
            pane.Items.Add(new DockableContent {
                Name = "Setup", Title = "Run Setup", Content = runSetupControls()
            });
        }
Пример #10
0
 public static ResizingPanel add_ResizingPanel(this DockingManager dockingManager, WPF.Orientation orientation)
 {
     return((ResizingPanel)dockingManager.wpfInvoke(
                () => {
         var resizingPanel = new ResizingPanel()
         {
             Orientation = orientation
         };
         dockingManager.Content = resizingPanel;
         return resizingPanel;
     }));
 }
Пример #11
0
        void addMarketsParameters(Panel lower)
        {
            var resizingPanel = new ResizingPanel {
                Orientation = Orientation.Vertical
            };

            ResizingPanel.SetResizeWidth(resizingPanel, 160);
            lower.Children.Add(resizingPanel);
            addMarkets(resizingPanel);
            addParameters(resizingPanel);
            addSwitchesPanel(resizingPanel);
        }
Пример #12
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));
            }
        }
Пример #13
0
        void addSwitchesPanel(Panel outer)
        {
            var pane = dockableChild(outer);

            ResizingPanel.SetResizeHeight(pane, 100);
            var switches = new QDockPanel();

            pane.Items.Add(new DockableContent {
                Name = "AdditionalSwitches", Title = "Additional Switches", Content = switches
            });
            switches.add(label("Slippage Calculator"), Dock.Top);
            switches.add(slippageBox, Dock.Top);
            switches.add(runInNativeCurrencyBox, Dock.Top);
        }
Пример #14
0
 public static ResizingPanel resizeWidth(this ResizingPanel dockablePane, int width)
 {
     return((ResizingPanel)dockablePane.wpfInvoke(
                () => {
         try
         {
             AvalonDock.ResizingPanel.SetResizeWidth(dockablePane, new System.Windows.GridLength(width));
         }
         catch (Exception ex)
         {
             ex.log("");
         }
         return dockablePane;
     }));
 }
Пример #15
0
        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);
        }
        private void mnuOnlineBlocks_Click(object sender, RoutedEventArgs e)
        {
            OnlineBlocksFolder       onl = new OnlineBlocksFolder(Connection);
            IBlocksFolder            fld = (IBlocksFolder)onl;
            DockableContentBlockList tmp = new DockableContentBlockList(fld);

            tmp.parentDockingManager = DockManager;
            tmp.Title   = fld.ToString();
            tmp.ToolTip = fld.ToString();
            tmp.Show(DockManager);
            tmp.ToggleAutoHide();

            //Set size of the parent DockablePane (it's automaticly been created!)
            DockablePane tmpPane = tmp.TryFindParent <DockablePane>();

            ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0));

            DockManager.ActiveDocument = tmp;
        }
Пример #18
0
        private void myConnectionsList_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (myConnectionsList.SelectedItem != null)
            {
                OnlineBlocksFolder       onl = new OnlineBlocksFolder((string)myConnectionsList.SelectedItem);
                IBlocksFolder            fld = (IBlocksFolder)onl;
                DockableContentBlockList tmp = new DockableContentBlockList(fld);
                tmp.parentDockingManager = parentDockingManager;
                tmp.Title   = fld.ToString(); //.Substring(fld.ToString().LastIndexOf("\\") + 1);
                tmp.ToolTip = fld.ToString();
                tmp.Show(parentDockingManager);
                tmp.ToggleAutoHide();

                //Set size of the parent DockablePane (it's automaticly been created!)
                DockablePane tmpPane = tmp.TryFindParent <DockablePane>();
                ResizingPanel.SetEffectiveSize(tmpPane, new Size(350, 0));

                parentDockingManager.ActiveDocument = tmp;
            }
        }
Пример #19
0
        public LayoutManager()
        {
            // Basic configuration:
            // \- ResizingPanel - main panel
            //  |- ResizingPanel - top panel
            //     |- DockablePane - left pane
            //     |- DocumentPane - documents pane
            //     \- DockablePane - right pane
            //  \- DockablePane - bottom pane

            m_mainPanel.Name = "MainPanel";

            m_topPanel.Name     = "TopPanel";
            m_topLeftPane.Name  = "TopLeftPane";
            m_docPane.Name      = "DocumentPane";
            m_topRightPane.Name = "TopRightPane";

            m_bottomPane.Name = "BottomPane";

            m_mainPanel.Orientation = Orientation.Vertical;
            m_topPanel.Orientation  = Orientation.Horizontal;

            ResizingPanel.SetResizeHeight(m_topPanel, new GridLength(70, GridUnitType.Star));
            ResizingPanel.SetResizeHeight(m_bottomPane, new GridLength(30, GridUnitType.Star));

            m_mainPanel.Children.Add(m_topPanel);
            m_mainPanel.Children.Add(m_bottomPane);

            ResizingPanel.SetResizeWidth(m_topLeftPane, new GridLength(20, GridUnitType.Star));
            ResizingPanel.SetResizeWidth(m_docPane, new GridLength(60, GridUnitType.Star));
            ResizingPanel.SetResizeWidth(m_topRightPane, new GridLength(20, GridUnitType.Star));

            m_topPanel.Children.Add(m_topLeftPane);
            m_topPanel.Children.Add(m_docPane);
            m_topPanel.Children.Add(m_topRightPane);

            DockManager.Content = m_mainPanel;

            DockManager.Loaded        += new System.Windows.RoutedEventHandler(DockManager_Loaded);
            DockManager.LayoutUpdated += new EventHandler(DockManager_LayoutUpdated);
        }
Пример #20
0
        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);
        }
Пример #21
0
        //protected override void OnClosed(EventArgs e)
        //{
        //    base.OnClosed(e);

        //    DockableContent[] cntsToClose = new DockableContent[HostedPane.Items.Count];
        //    HostedPane.Items.CopyTo(cntsToClose, 0);

        //    foreach (DockableContent cntToClose in cntsToClose)
        //    {
        //        //HostedPane.CloseOrHide(HostedPane.Items[0] as DockableContent, ForcedClosing);
        //        cntToClose.CloseOrHide(ForcedClosing);
        //    }

        //    Manager.UnregisterFloatingWindow(this);
        //}

        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);
        }
Пример #22
0
        public void ShowDockedWindow(object viewModel, DockArea dockArea, object context = null,
                                     bool selectWhenShown       = true, DockSide dockSide = DockSide.Left,
                                     double startupVisibleWidth = -1, bool hideOnClose    = false, bool isCloseable = true)
        {
            var dockingManager = GetDockingManager();

            var anchor = GetAnchorStyle(dockSide);

            // TODO
            //if (anchor == AnchorStyle.Left && dockArea != DockArea.Master)
            //{
            //    var istview = IoC.Get<FacilitiesViewModel>();
            //    var instdockable = GetDockable(istview, null, DockArea.Master);

            //    instdockable.Show(dockingManager, anchor);
            //}

            var dockableContent = GetDockable(viewModel, context, dockArea);

            dockableContent.HideOnClose = hideOnClose;
            dockableContent.IsCloseable = isCloseable;
            dockableContent.Show(dockingManager, anchor);

            if (startupVisibleWidth >= 0)
            {
                var width = new GridLength(startupVisibleWidth);
                ResizingPanel.SetResizeWidth(dockableContent.ContainerPane, width);
            }

            if (selectWhenShown)
            {
                dockableContent.Activate();
            }
            //else
            //    dockableContent.ToggleAutoHide();
        }
        private void CreateOrUnhideDockableContent(ContentTypes contentType, string title, string viewPropertyName, object parent)
        {
            if (!this.dockableContents.Keys.Contains(contentType))
            {
                DockableContent dockableContent = new DockableContent();

                ContentControl contentControl = new ContentControl();

                dockableContent.IsCloseable = true;
                dockableContent.HideOnClose = false;

                dockableContent.Title = title;

                dockableContent.Content = contentControl;

                if (parent is ResizingPanel)
                {
                    DockablePane dockablePane = new DockablePane();
                    dockablePane.Items.Add(dockableContent);
                    ResizingPanel resizingPanel = parent as ResizingPanel;

                    switch (contentType)
                    {
                    case ContentTypes.PropertyInspector:
                        resizingPanel.Children.Add(dockablePane);
                        ResizingPanel.SetResizeWidth(dockablePane, new GridLength(300));
                        break;

                    case ContentTypes.Outline:
                        resizingPanel.Children.Insert(1, dockablePane);
                        ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250));
                        break;

                    case ContentTypes.Toolbox:
                        resizingPanel.Children.Insert(0, dockablePane);
                        ResizingPanel.SetResizeWidth(dockablePane, new GridLength(250));
                        break;
                    }
                }
                else if (parent is DockablePane)
                {
                    DockablePane dockablePane = parent as DockablePane;
                    dockablePane.Items.Add(dockableContent);
                    if (dockablePane.Parent == null)
                    {
                        this.verticalResizingPanel.Children.Add(dockablePane);
                    }
                }

                Binding dataContextBinding = new Binding(viewPropertyName);
                dockableContent.SetBinding(DockableContent.DataContextProperty, dataContextBinding);

                Binding contentBinding = new Binding(".");
                contentControl.SetBinding(ContentControl.ContentProperty, contentBinding);

                this.dockableContents[contentType] = dockableContent;

                dockableContent.Closed += delegate(object sender, EventArgs args)
                {
                    contentControl.Content = null;
                    this.dockableContents[contentType].DataContext = null;
                    this.dockableContents.Remove(contentType);
                };
            }
            else
            {
                if (this.dockableContents[contentType].State == DockableContentState.Hidden)
                {
                    this.dockableContents[contentType].Show();
                }
            }
        }
Пример #24
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();
        }
Пример #25
0
        internal bool OnDrop(OverlayWindowDockingButton owdDock, Point point)
        {
            //calculate desidered size
            Rect rectPane;

            switch (OverlayButtonHover)
            {
            case HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderBottom:
            case HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderLeft:
            case HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderTop:
            case HeBianGu.Control.DockPanelControl.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 HeBianGu.Control.DockPanelControl.OverlayButtonHover.DropBorderBottom:
                _manager.Anchor(
                    _manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane,
                    AnchorStyle.Bottom);
                break;

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

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

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

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

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

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

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

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

            default:
                return(false);
            }


            return(true);
        }