Exemplo n.º 1
0
        public void AddPanel(DockContent form, DockState dockState, bool AllowMultiple)
        {
            DockContent joinBefore = null;
            DockPane    joinPane   = null;

            foreach (DockContent content in dockPanel.Contents)
            {
                if (content.GetType() == form.GetType() && !AllowMultiple)
                {
                    return;
                }
                if (content.GetType() == form.GetType() || (
                        content.DockState == DockState.Document && dockState == DockState.Document))
                {
                    joinBefore = content;
                    joinPane   = content.Pane;
                }
            }
            form.DockPanel = dockPanel;
            form.DockState = dockState;
            if (joinPane != null)
            {
                form.Show(joinPane, joinBefore);
            }
            else
            {
                form.Show();
            }
        }
Exemplo n.º 2
0
        void content_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                DockContent dock = (DockContent)sender;
                dock.FormClosing -= new FormClosingEventHandler(content_FormClosing);

                List <DockContent> typeList = DockContents[dock.GetType()];
                typeList.Remove(dock);

                var handler = DockContentRemoved;
                if (handler != null)
                {
                    handler(this, new DockContentEventArgs(dock));
                }

                if (dock.Pane.Contents.Count == 2)
                {
                    if (viewFilesToolStripMenuItem.Checked && (dock.Pane == DockFiles.Pane))
                    {
                        DockFiles.Show();
                    }
                    else if (viewEditorsToolStripMenuItem.Checked && (dock.Pane == DockEditors.Pane))
                    {
                        DockEditors.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
        /// <summary>
        /// ドキュメントが閉じられた
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void DocumentClosed(object sender, EventArgs e)
        {
            string      key = "";
            DockContent dc  = (DockContent)sender;

            if (dc.GetType() == typeof(AngleScriptEditor))
            {
                AngleScriptEditor fmSE = (AngleScriptEditor)dc;
                key = fmSE.FilePath;
            }
            else if (dc.GetType() == typeof(FontDoc))
            {
                FontDoc fmSE = (FontDoc)dc;
                key = fmSE.FilePath;
            }
            else if (dc.GetType() == typeof(ImageViewerDoc))
            {
                ImageViewerDoc fmSE = (ImageViewerDoc)dc;
                key = fmSE.FilePath;
            }
            else if (dc.GetType() == typeof(AudioDoc))
            {
                AudioDoc fmSE = (AudioDoc)dc;
                key = fmSE.FilePath;
            }


            lock (ms_lockObj)
            {
                if (m_dockContents.ContainsKey(key))
                {
                    m_dockContents.Remove(key);
                }
                if (sender == m_fmDocCurrent)
                {
                    m_fmDocCurrent = null;
                }
                dc.Dispose();
            }


            if (m_dockContents.Count == 0)
            {
                //m_fmMain.BookMarkBreakPointToolbarEnable(false);
            }
        }
Exemplo n.º 4
0
        public void ShowDockContent(DockContent content, DockContent defaultDock, ContentCategory category)
        {
            try
            {
                content.FormClosed += content_FormClosed;

                List <DockContent> typeList;
                Type type = content.GetType();
                if (!DockContents.TryGetValue(type, out typeList))
                {
                    typeList = new List <DockContent>();
                    DockContents.Add(type, typeList);
                }
                typeList.Add(content);

                var handler = DockContentAdded;
                if (handler != null)
                {
                    handler(this, new DockContentEventArgs(content));
                }

                if (defaultDock == null)
                {
                    content.Show(this.dockPanel, DockState.Float);
                }
                else
                {
                    content.Show(defaultDock.Pane, null);

                    if (((defaultDock == DockFiles) || (defaultDock == DockEditors)) && !defaultDock.IsHidden)
                    {
                        defaultDock.Hide();
                    }
                }
                SetDocking(content, dockingToolStripMenuItem.Checked);

                if (category != ContentCategory.None)
                {
                    ((FormQuickAccess)DockQuickAccess).RegisterOpenFile(content, category);
                }

                foreach (Control c in content.Controls)
                {
                    if (c is MenuStrip)
                    {
                        MenuStrip ms = (MenuStrip)c;
                        InstallStatusLineHandler(ms.Items);
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Exemplo n.º 5
0
        public DockContent GetContentDocked(DockContent DockContent)
        {
            foreach (DockContent dock in dockPanel.Contents)
            {
                if (dock.GetType() == DockContent.GetType())
                {
                    return(dock);
                }
            }

            return(null);
        }
Exemplo n.º 6
0
        public static void Show(DockContent content, DockPanel panel)
        {
            PanelHint hint = content.GetType().GetCustomAttribute <PanelHint>();

            if (hint != null)
            {
                content.Show(panel, hint.DockState);
            }
            else
            {
                content.Show(panel, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft);
            }
        }
Exemplo n.º 7
0
        public void ShowDockContent(DockContent content, DockContent defaultDock, ContentCategory category)
        {
            try
            {
                content.FormClosed += content_FormClosed;

                List <DockContent> typeList;
                Type type = content.GetType();
                if (!DockContents.TryGetValue(type, out typeList))
                {
                    typeList = new List <DockContent>();
                    DockContents.Add(type, typeList);
                }
                typeList.Add(content);

                var handler = DockContentAdded;
                if (handler != null)
                {
                    handler(this, new DockContentEventArgs(content));
                }

                if (defaultDock == null)
                {
                    content.Show(this.dockPanel, DockState.Float);
                }
                else
                {
                    content.Show(defaultDock.Pane, null);

                    if (((defaultDock == DockFiles) || (defaultDock == DockEditors)) && !defaultDock.IsHidden)
                    {
                        defaultDock.Hide();
                    }
                }

                if (category != ContentCategory.None)
                {
                    ((FormQuickAccess)DockQuickAccess).RegisterOpenFile(content, category);
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Exemplo n.º 8
0
        public void ShowDockContent(DockContent content, DockContent defaultDock)
        {
            try
            {
                content.FormClosing += new FormClosingEventHandler(content_FormClosing);

                List <DockContent> typeList;
                Type type = content.GetType();
                if (!DockContents.TryGetValue(type, out typeList))
                {
                    typeList = new List <DockContent>();
                    DockContents.Add(type, typeList);
                }
                typeList.Add(content);

                var handler = DockContentAdded;
                if (handler != null)
                {
                    handler(this, new DockContentEventArgs(content));
                }

                if (defaultDock == null)
                {
                    content.Show(this.dockPanel, DockState.Float);
                }
                else
                {
                    content.Show(defaultDock.Pane, null);

                    if (((defaultDock == DockFiles) || (defaultDock == DockEditors)) && !defaultDock.IsHidden)
                    {
                        defaultDock.Hide();
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Exemplo n.º 9
0
 /// <summary>
 /// The string used for functions to report in docking settings files.
 /// </summary>
 /// <param name="form"></param>
 /// <returns></returns>
 public static string GetDockingString(DockContent form)
 {
     return($"{form.GetType()},{form.Text}");
 }