ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.ScratchPad/ScratchPad.cs
(Generate patch)

Comparing trunk/RomCheater.ScratchPad/ScratchPad.cs (file contents):
Revision 769 by william, Thu Jun 20 21:34:48 2013 UTC vs.
Revision 775 by william, Thu Jun 20 22:59:40 2013 UTC

# Line 28 | Line 28 | using RomCheater.PluginFramework.Core;
28   namespace RomCheater.ScratchPad
29   {
30      public partial class ScratchPad : DockContent
31 <    {
31 >    {        
32          List<ScratchPadDocument> docuemntList = new List<ScratchPadDocument>();
33          private UserControlPlugin plugin;
34          private bool PostInitDone = false;
# Line 82 | Line 82 | namespace RomCheater.ScratchPad
82  
83  
84  
85 <    
85 >
86  
87          private void ScratchPad_FormClosing(object sender, FormClosingEventArgs e)
88          {
# Line 99 | Line 99 | namespace RomCheater.ScratchPad
99              //        mnuItemSave.PerformClick();
100              //    }
101              //}
102            
102              for (int i = 0; i < docuemntList.Count; i++)
103              {
104                  var Document = docuemntList[i];
105 <                Document.OnDocumentQuit();                
105 >                Document.OnDocumentQuit();
106              }
108
107          }
108  
109          private void ScratchPad_Deactivate<T>(object sender, T e) where T: EventArgs
# Line 118 | Line 116 | namespace RomCheater.ScratchPad
116              catch { }
117          }
118  
119 +
120 +        private void AddDocument(ScratchPadDocument t)
121 +        {
122 +            t.DocumentClosing += new BaseEventHandler<ControlClosingEventArgs<int>>(t_DocumentClosing);
123 +            docuemntList.Add(t);
124 +            this.tb.TabPages.Add(t.DocumentTab);
125 +            t.Dock = DockStyle.Fill;
126 +        }
127 +
128          private void mnuItemNew_Click(object sender, EventArgs e)
129          {
130              // create new document
131              int tp_index = this.tb.TabPages.Count;
132              ScratchPadDocument t = new ScratchPadDocument(tp_index);
133 <            docuemntList.Add(t);
134 <            this.tb.TabPages.Add(t.DocumentTab);
133 >            AddDocument(t);
134 >        }
135 >
136 >        private void ScratchPad_Load(object sender, EventArgs e)
137 >        {
138 >            int tp_index = this.tb.TabPages.Count;
139 >            ScratchPadDocument t = new ScratchPadDocument(tp_index);
140 >            AddDocument(t);
141 >        }
142 >
143 >        void t_DocumentClosing(ControlClosingEventArgs<int> e)
144 >        {
145 >                int index = e.Args;
146 >                this.docuemntList.RemoveAt(index);
147          }
148  
149          //private void txtScratchPad_LinkClicked(object sender, LinkClickedEventArgs e)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines