/[RomCheater]/trunk/RomCheater/Main.cs
ViewVC logotype

Diff of /trunk/RomCheater/Main.cs

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

--- trunk/RomCheater/Main.cs	2012/05/11 11:37:14	143
+++ trunk/RomCheater/Main.cs	2012/05/11 12:11:40	144
@@ -13,13 +13,16 @@
 using RomCheater.PluginFramework.Core;
 using System.Diagnostics;
 using RomCheater.PluginFramework.Interfaces;
+using WeifenLuo.WinFormsUI.Docking;
 
 namespace RomCheater
 {
     public partial class Main : Form
     {
-        private bool log_window_expanded = false;
-        private double log_window_splitter_default_position = 1.4045;
+        private DeserializeDockContent m_deserializeDockContent;
+        private FloatingLogWindow m_LogWindow = new FloatingLogWindow();
+        //private bool log_window_expanded = false;
+        //private double log_window_splitter_default_position = 1.4045;
         PluginLoader loader = null;
         IConfigPlugin ConfigPlugin = null;
         IInputPlugin InputPlugin = null;
@@ -39,17 +42,48 @@
         #endregion
 
 
+        #region Dock Support
+        private IDockContent GetContentFromPersistString(string persistString)
+        {
+            if (persistString == typeof(FloatingLogWindow).ToString())
+            {
+                return m_LogWindow;
+            }
+            else
+            {
+                // not sure if this is appropriate
+                return null;
+            }
+        }
+        public void SetupDocks()
+        {
+            m_LogWindow = new FloatingLogWindow();
+            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
+        }
+        public void ShowDocks()
+        {
+            ShowLogWindow();
+        }
+        public void ShowLogWindow()
+        {
+            m_LogWindow.Show(dockPanel);
+        }
+        #endregion
+
+
         public Main() : this(false) { }
         public Main(bool no_console_redirect)
         {
             InitializeComponent();
             load_loggerflags();
-            LoggerInstance = logwriter;
+            SetupDocks();
+            LoggerInstance = m_LogWindow.Logwriter;
             LoggerInstance.CreateNewLog(false);
             logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name);
             load_plugins();
             if (no_console_redirect)
                 LoggerInstance.RedirectConsoleOutput = false;
+           
         }
         private void load_loggerflags()
         {
@@ -86,7 +120,8 @@
         }
 
         private void Main_Load(object sender, EventArgs e)
-        {        
+        {
+           
         }
 
         private void mnuItemConfig_Click(object sender, EventArgs e)
@@ -104,22 +139,14 @@
             selector.ShowDialog();
         }
 
-        private void btnExapandCollapseLogWindow_Click(object sender, EventArgs e)
+        private void Main_Shown(object sender, EventArgs e)
         {
-            if (log_window_expanded)
-            {
-                // collapse                
-                main_split.SplitterDistance = (int)((double)this.Height/ log_window_splitter_default_position);
-                log_window_expanded = false;
-                btnExapandCollapseLogWindow.Text = "expand";
-            }
-            else
-            {
-                // expand
-                main_split.SplitterDistance = 0;
-                btnExapandCollapseLogWindow.Text = "collapse";
-                log_window_expanded = true;
-            }
+            ShowDocks();
+        }
+
+        private void mnuItemShowLogWindow_Click(object sender, EventArgs e)
+        {
+            ShowLogWindow();
         }
     }
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22