/[RomCheater]/trunk/RomCheater.RVAScratchPad/Form1.cs
ViewVC logotype

Diff of /trunk/RomCheater.RVAScratchPad/Form1.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater.RVAScratchPad/Form1.cs	2013/06/19 15:08:07	730
+++ trunk/RomCheater.RVAScratchPad/Form1.cs	2013/06/19 15:13:24	731
@@ -18,14 +18,14 @@
     public partial class Form1 : Form
     {
         private SettingSubscriber SettingsSubscriber = null;
-        //private bool m_bSaveLayout = true;
+        private bool m_bSaveLayout = true;
         PluginLoader loader = null;
         IConfigPlugin ConfigPlugin = null;
 
         IUserControlPlugin RVACalcPlugin = null;
         IUserControlPlugin ScratchPadPlugin = null;
 
-        //private DeserializeDockContent m_deserializeDockContent;
+        private DeserializeDockContent m_deserializeDockContent;
         //private FloatingLogWindow m_LogWindow = new FloatingLogWindow();
         //private FloatingWebBrowser m_wb = new FloatingWebBrowser();
 
@@ -101,14 +101,14 @@
 
 
         #region Dock Support
-        //private IDockContent GetContentFromPersistString(string persistString)
-        //{
-        //    if (persistString == typeof(FloatingLogWindow).ToString()) { return m_LogWindow; }
-        //    if (persistString == typeof(FloatingWebBrowser).ToString()) { return m_wb; }
-        //    if (RVACalcPlugin != null) { if (persistString == RVACalcPlugin.IDockContentTypeName) { return RVACalcPlugin.DockContent; } }
-        //    if (ScratchPadPlugin != null) { if (persistString == ScratchPadPlugin.IDockContentTypeName) { return ScratchPadPlugin.DockContent; } }
-        //    return null;
-        //}
+        private IDockContent GetContentFromPersistString(string persistString)
+        {
+            //if (persistString == typeof(FloatingLogWindow).ToString()) { return m_LogWindow; }
+            //if (persistString == typeof(FloatingWebBrowser).ToString()) { return m_wb; }
+            if (RVACalcPlugin != null) { if (persistString == RVACalcPlugin.IDockContentTypeName) { return RVACalcPlugin.DockContent; } }
+            if (ScratchPadPlugin != null) { if (persistString == ScratchPadPlugin.IDockContentTypeName) { return ScratchPadPlugin.DockContent; } }
+            return null;
+        }
         public void SetupDocks()
         {
             //m_LogWindow = new FloatingLogWindow();
@@ -119,7 +119,20 @@
             //m_wb.CloseButton = false;
             //m_wb.CloseButtonVisible = false;
 
-            //m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
+            if (RVACalcPlugin != null)
+            {
+                RVACalcPlugin.DockHandler.CloseButton = false;
+                RVACalcPlugin.DockHandler.CloseButtonVisible = false;
+                RVACalcPlugin.DockHandler.AllowEndUserDocking = false;
+            }
+            if (ScratchPadPlugin != null)
+            {
+                ScratchPadPlugin.DockHandler.CloseButton = false;
+                ScratchPadPlugin.DockHandler.CloseButtonVisible = false;
+                ScratchPadPlugin.DockHandler.AllowEndUserDocking = false;
+            }
+
+            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
         }
         #region SetupDockWindowHandler support
         public void SetupDockWindowHandler()
@@ -132,10 +145,16 @@
         {
             if (RVACalcPlugin != null)
             {
+                RVACalcPlugin.DockHandler.CloseButton = false;
+                RVACalcPlugin.DockHandler.CloseButtonVisible = false;
+                RVACalcPlugin.DockHandler.AllowEndUserDocking = false;
                 RVACalcPlugin.Activate();
             }
             if (ScratchPadPlugin != null)
             {
+                ScratchPadPlugin.DockHandler.CloseButton = false;
+                ScratchPadPlugin.DockHandler.CloseButtonVisible = false;
+                ScratchPadPlugin.DockHandler.AllowEndUserDocking = false;
                 ScratchPadPlugin.Activate();
             }
         }
@@ -198,15 +217,15 @@
                 RVACalcPlugin.DockHandler.CloseButton = false;
                 RVACalcPlugin.DockHandler.CloseButtonVisible = false;
                 RVACalcPlugin.DockHandler.AllowEndUserDocking = false;
-                RVACalcPlugin.Show(dockPanel);
+                RVACalcPlugin.Show(dockPanel, DockState.DockLeft);
             }
             if (ScratchPadPlugin != null)
             {
                 // ScratchPad                
-                //ScratchPadPlugin.DockHandler.CloseButton = false;
-                //ScratchPadPlugin.DockHandler.CloseButtonVisible = false;
-                //ScratchPadPlugin.DockHandler.AllowEndUserDocking = true;
-                ScratchPadPlugin.Show(dockPanel, DockState.Document);
+                ScratchPadPlugin.DockHandler.CloseButton = false;
+                ScratchPadPlugin.DockHandler.CloseButtonVisible = false;
+                ScratchPadPlugin.DockHandler.AllowEndUserDocking = false;
+                ScratchPadPlugin.Show(dockPanel, DockState.DockRight);
             }
         }
         #endregion
@@ -214,11 +233,11 @@
         private void Form1_FormClosing(object sender, FormClosingEventArgs e)
         {
             SettingsSubscriber.SaveSettings();
-            //string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "RVAScratchPad-DockPanel.config");
-            //if (m_bSaveLayout)
-            //    dockPanel.SaveAsXml(configFile);
-            //else if (File.Exists(configFile))
-            //    File.Delete(configFile);
+            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "RVAScratchPad-DockPanel.config");
+            if (m_bSaveLayout)
+                dockPanel.SaveAsXml(configFile);
+            else if (File.Exists(configFile))
+                File.Delete(configFile);
             // notify any docked windows of formclosing
             foreach (var t in this.dockPanel.Contents)
             {
@@ -230,28 +249,28 @@
         {
             ////dockPanel.SuspendLayout(true);
             ////ShowDocks();
-            //string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "RVAScratchPad-DockPanel.config");
-            //if (File.Exists(configFile))
-            //{
-            //    try
-            //    {
-            //        dockPanel.LoadFromXml(configFile, m_deserializeDockContent);
-            //        SetupDockWindowHandler();
-            //    }
-            //    catch (Exception)
-            //    {
-            //        this.Controls.Remove(dockPanel);
-            //        dockPanel = new DockPanel();
-            //        dockPanel.Dock = DockStyle.Fill;
-            //        dockPanel.DocumentStyle = DocumentStyle.DockingWindow;
-            //        this.Controls.Add(dockPanel);
-            //        ShowDocks();
-            //    }
-            //}
-            //else
-            //{
-            ShowDocks();
-            //}
+            string configFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "RVAScratchPad-DockPanel.config");
+            if (File.Exists(configFile))
+            {
+                try
+                {
+                    dockPanel.LoadFromXml(configFile, m_deserializeDockContent);
+                    SetupDockWindowHandler();
+                }
+                catch (Exception)
+                {
+                    this.Controls.Remove(dockPanel);
+                    dockPanel = new DockPanel();
+                    dockPanel.Dock = DockStyle.Fill;
+                    dockPanel.DocumentStyle = DocumentStyle.DockingWindow;
+                    this.Controls.Add(dockPanel);
+                    ShowDocks();
+                }
+            }
+            else
+            {
+                ShowDocks();
+            }
 
             if (RVACalcPlugin != null)
                 RVACalcPlugin.Activate();

 

  ViewVC Help
Powered by ViewVC 1.1.22