/[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 01:37:36	727
+++ trunk/RomCheater.RVAScratchPad/Form1.cs	2013/06/19 14:18:50	728
@@ -18,21 +18,21 @@
     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;
+        //IUserControlPlugin ScratchPadPlugin = null;
 
-        private DeserializeDockContent m_deserializeDockContent;
-        private FloatingLogWindow m_LogWindow = new FloatingLogWindow();
-        private FloatingWebBrowser m_wb = new FloatingWebBrowser();
-
-        public IWebBrowserProvider WebBrowserProvider
-        {
-            get { return new WebBrowserProvider(m_wb); }
-        }
+        //private DeserializeDockContent m_deserializeDockContent;
+        //private FloatingLogWindow m_LogWindow = new FloatingLogWindow();
+        //private FloatingWebBrowser m_wb = new FloatingWebBrowser();
+
+        //public IWebBrowserProvider WebBrowserProvider
+        //{
+        //    get { return new WebBrowserProvider(m_wb); }
+        //}
         #region LogWriterSupport
         static LogWriter _LoggerInstance;
         static LogWriter LoggerInstance
@@ -50,7 +50,8 @@
             SettingsSubscriber.AddSubscriber(this, RomCheater.Properties.Settings.Default);              
             load_loggerflags();
             SetupDocks();
-            LoggerInstance = m_LogWindow.Logwriter;
+            //LoggerInstance = m_LogWindow.Logwriter;
+            LoggerInstance = new LogWriter(!no_console_redirect);
             LoggerInstance.CreateNewLog(false);
             logger.ForceLog.Info.WriteLine("LoggingFlags = 0x{0:x4} ({1})", logger.GetLoggingFlags().Value, logger.GetLoggingFlags().Name);
             load_plugins();
@@ -82,49 +83,49 @@
                 ConfigPlugin = loader.GetPluginByGuid<IConfigPlugin>(config.ID.ToString());
             }
 
-            // update the Config plugin's reference to the webbrowswer
-            ConfigPlugin.WebBrowserProvider = this.WebBrowserProvider;
+            //// update the Config plugin's reference to the webbrowswer
+            ////ConfigPlugin.WebBrowserProvider = this.WebBrowserProvider;
 
             SettingsSubscriber.SetValue("LastConfigPlugin", ConfigPlugin.ToString());
 
-            var scratchpad = PluginCollection.GetPluginByName(PluginNames.ScratchPadPlugin);
-            var rvacalc = PluginCollection.GetPluginByName(PluginNames.RVACalculatorPlugin);            
-            ScratchPadPlugin = loader.GetPluginByGuid<IUserControlPlugin>(scratchpad.ID.ToString());
+            //var scratchpad = PluginCollection.GetPluginByName(PluginNames.ScratchPadPlugin);
+            var rvacalc = PluginCollection.GetPluginByName(PluginNames.RVACalculatorPlugin);
+            //ScratchPadPlugin = loader.GetPluginByGuid<IUserControlPlugin>(scratchpad.ID.ToString());
             RVACalcPlugin = loader.GetPluginByGuid<IUserControlPlugin>(rvacalc.ID.ToString());
 
             // update config of each plugin
-            ScratchPadPlugin.SetAcceptedConfig(ConfigPlugin);
+            //ScratchPadPlugin.SetAcceptedConfig(ConfigPlugin);
             RVACalcPlugin.SetAcceptedConfig(ConfigPlugin);
         }
 
 
 
         #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();
+            //m_LogWindow = new FloatingLogWindow();
             //m_LogWindow.CloseButton = false;
             //m_LogWindow.CloseButtonVisible = false;
 
-            m_wb = new FloatingWebBrowser();
+            //m_wb = new FloatingWebBrowser();
             //m_wb.CloseButton = false;
             //m_wb.CloseButtonVisible = false;
 
-            m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
+            //m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
         }
         #region SetupDockWindowHandler support
         public void SetupDockWindowHandler()
         {
-            SetupLogWindowHandler();
-            SetupWebBrowserWindowHandler();
+            //SetupLogWindowHandler();
+            //SetupWebBrowserWindowHandler();
             SetupPluginWindowHandlers();
         }
         private void SetupPluginWindowHandlers()
@@ -133,91 +134,91 @@
             {
                 RVACalcPlugin.Activate();
             }
-            if (ScratchPadPlugin != null)
-            {
-                ScratchPadPlugin.Activate();
-            }
-        }
-        private void SetupLogWindowHandler()
-        {
-            if (m_LogWindow == null) return;
-            //m_LogWindow.Shown += new EventHandler(AddDockToWindowList);
-            //m_LogWindow.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
-            m_LogWindow.Activate();
-        }
-        private void SetupWebBrowserWindowHandler()
-        {
-            if (m_wb == null) return;
-            //m_wb.Shown += new EventHandler(AddDockToWindowList);
-            //m_wb.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
-            m_wb.Activate();
-        }
+            //if (ScratchPadPlugin != null)
+            //{
+            //    ScratchPadPlugin.Activate();
+            //}
+        }
+        //private void SetupLogWindowHandler()
+        //{
+        //    //if (m_LogWindow == null) return;
+        //    ////m_LogWindow.Shown += new EventHandler(AddDockToWindowList);
+        //    ////m_LogWindow.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
+        //    //m_LogWindow.Activate();
+        //}
+        //private void SetupWebBrowserWindowHandler()
+        //{
+        //    //if (m_wb == null) return;
+        //    ////m_wb.Shown += new EventHandler(AddDockToWindowList);
+        //    ////m_wb.FormClosed += new FormClosedEventHandler(RemoveDockFromWindowList);
+        //    //m_wb.Activate();
+        //}
         #endregion
         public void ShowDocks()
         {
-            ShowLogWindow();
-            SetupLogWindowHandler();
-            ShowWebBrowser();
-            SetupWebBrowserWindowHandler();
+            //ShowLogWindow();
+            //SetupLogWindowHandler();
+            //ShowWebBrowser();
+            //SetupWebBrowserWindowHandler();
             ShowPluginWindows();
             SetupPluginWindowHandlers();
 
-            if (RVACalcPlugin != null)
-                RVACalcPlugin.Activate();
+            //if (RVACalcPlugin != null)
+            //    RVACalcPlugin.Activate();
         }
         public void ShowLogWindow()
         {
-            if (m_LogWindow == null || m_LogWindow.IsDisposed) { m_LogWindow = new FloatingLogWindow(); }
-            if (LoggerInstance == null)
-            {
-                LoggerInstance = m_LogWindow.Logwriter;
-                LoggerInstance.CreateNewLog(false);
-            }
-            //m_LogWindow.AllowEndUserDocking = true;
-            //m_LogWindow.CloseButton = false;
-            //m_LogWindow.CloseButtonVisible = false;
-            m_LogWindow.Show(dockPanel, DockState.DockBottom);
+            //if (m_LogWindow == null || m_LogWindow.IsDisposed) { m_LogWindow = new FloatingLogWindow(); }
+            //if (LoggerInstance == null)
+            //{
+            //    LoggerInstance = m_LogWindow.Logwriter;
+            //    LoggerInstance.CreateNewLog(false);
+            //}
+            ////m_LogWindow.AllowEndUserDocking = true;
+            ////m_LogWindow.CloseButton = false;
+            ////m_LogWindow.CloseButtonVisible = false;
+            //m_LogWindow.Show(dockPanel, DockState.DockBottom);
         }
 
 
         public void ShowWebBrowser()
         {
-            //load_plugins_silent();
-            m_wb = new FloatingWebBrowser();
-            //m_wb.AllowEndUserDocking = true;
-            //m_wb.CloseButton = false;
-            //m_wb.CloseButtonVisible = false;
-            m_wb.Show(dockPanel, DockState.Document);
+            ////load_plugins_silent();
+            //m_wb = new FloatingWebBrowser();
+            ////m_wb.AllowEndUserDocking = true;
+            ////m_wb.CloseButton = false;
+            ////m_wb.CloseButtonVisible = false;
+            //m_wb.Show(dockPanel, DockState.Document);
         }
         public void ShowPluginWindows()
         {
             if (RVACalcPlugin != null)
             {
                 // RVA Calc                
-                //RVACalcPlugin.DockHandler.CloseButton = false;                
-                //RVACalcPlugin.DockHandler.CloseButtonVisible = false;
-                //RVACalcPlugin.DockHandler.AllowEndUserDocking = true;
+                RVACalcPlugin.DockHandler.CloseButton = false;
+                RVACalcPlugin.DockHandler.CloseButtonVisible = false;
+                RVACalcPlugin.DockHandler.AllowEndUserDocking = false;
                 RVACalcPlugin.Show(dockPanel);
             }
-            if (ScratchPadPlugin != null)
-            {
-                // ScratchPad                
-                //ScratchPadPlugin.DockHandler.CloseButton = false;
-                //ScratchPadPlugin.DockHandler.CloseButtonVisible = false;
-                //ScratchPadPlugin.DockHandler.AllowEndUserDocking = true;
-                ScratchPadPlugin.Show(dockPanel, DockState.Document);
-            }
+            //if (ScratchPadPlugin != null)
+            //{
+            //    // ScratchPad                
+            //    //ScratchPadPlugin.DockHandler.CloseButton = false;
+            //    //ScratchPadPlugin.DockHandler.CloseButtonVisible = false;
+            //    //ScratchPadPlugin.DockHandler.AllowEndUserDocking = true;
+            //    ScratchPadPlugin.Show(dockPanel, DockState.Document);
+            //}
         }
         #endregion
 
         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)
             {
@@ -227,34 +228,34 @@
 
         private void Form1_Shown(object sender, EventArgs e)
         {
-            //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();
-            }
-
-            if (RVACalcPlugin != null)
-                RVACalcPlugin.Activate();
-            //dockPanel.ResumeLayout(true, true);
+            ////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();
+            //}
+
+            //if (RVACalcPlugin != null)
+            //    RVACalcPlugin.Activate();
+            ////dockPanel.ResumeLayout(true, true);
         }
 
         private void mnuItemExit_Click(object sender, EventArgs e)

 

  ViewVC Help
Powered by ViewVC 1.1.22