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

Diff of /trunk/RomCheater.ScratchPad/ScratchPad.cs

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

--- trunk/RomCheater.ScratchPad/ScratchPad.cs	2013/06/20 21:34:48	769
+++ trunk/RomCheater.ScratchPad/ScratchPad.cs	2013/06/20 22:33:04	774
@@ -28,7 +28,7 @@
 namespace RomCheater.ScratchPad
 {
     public partial class ScratchPad : DockContent
-    {
+    {        
         List<ScratchPadDocument> docuemntList = new List<ScratchPadDocument>();
         private UserControlPlugin plugin;
         private bool PostInitDone = false;
@@ -82,7 +82,7 @@
 
 
 
-     
+
 
         private void ScratchPad_FormClosing(object sender, FormClosingEventArgs e)
         {
@@ -99,13 +99,11 @@
             //        mnuItemSave.PerformClick();
             //    }
             //}
-            
             for (int i = 0; i < docuemntList.Count; i++)
             {
                 var Document = docuemntList[i];
-                Document.OnDocumentQuit();                
+                Document.OnDocumentQuit();
             }
-
         }
 
         private void ScratchPad_Deactivate<T>(object sender, T e) where T: EventArgs
@@ -123,10 +121,26 @@
             // create new document
             int tp_index = this.tb.TabPages.Count;
             ScratchPadDocument t = new ScratchPadDocument(tp_index);
+            t.DocumentClosing += new BaseEventHandler<ControlClosingEventArgs<int>>(t_DocumentClosing);
+            docuemntList.Add(t);
+            this.tb.TabPages.Add(t.DocumentTab);
+        }
+
+        private void ScratchPad_Load(object sender, EventArgs e)
+        {
+            int tp_index = this.tb.TabPages.Count;
+            ScratchPadDocument t = new ScratchPadDocument(tp_index);
+            t.DocumentClosing += new BaseEventHandler<ControlClosingEventArgs<int>>(t_DocumentClosing);
             docuemntList.Add(t);
             this.tb.TabPages.Add(t.DocumentTab);
         }
 
+        void t_DocumentClosing(ControlClosingEventArgs<int> e)
+        {
+                int index = e.Args;
+                this.docuemntList.RemoveAt(index);
+        }
+
         //private void txtScratchPad_LinkClicked(object sender, LinkClickedEventArgs e)
         //{
         //    //System.Diagnostics.Process.Start(e.LinkText);

 

  ViewVC Help
Powered by ViewVC 1.1.22