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; |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
< |
|
85 |
> |
|
86 |
|
|
87 |
|
private void ScratchPad_FormClosing(object sender, FormClosingEventArgs e) |
88 |
|
{ |
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 |
121 |
|
// create new document |
122 |
|
int tp_index = this.tb.TabPages.Count; |
123 |
|
ScratchPadDocument t = new ScratchPadDocument(tp_index); |
124 |
+ |
t.DocumentClosing += new BaseEventHandler<ControlClosingEventArgs<int>>(t_DocumentClosing); |
125 |
+ |
docuemntList.Add(t); |
126 |
+ |
this.tb.TabPages.Add(t.DocumentTab); |
127 |
+ |
} |
128 |
+ |
|
129 |
+ |
private void ScratchPad_Load(object sender, EventArgs e) |
130 |
+ |
{ |
131 |
+ |
int tp_index = this.tb.TabPages.Count; |
132 |
+ |
ScratchPadDocument t = new ScratchPadDocument(tp_index); |
133 |
+ |
t.DocumentClosing += new BaseEventHandler<ControlClosingEventArgs<int>>(t_DocumentClosing); |
134 |
|
docuemntList.Add(t); |
135 |
|
this.tb.TabPages.Add(t.DocumentTab); |
136 |
|
} |
137 |
|
|
138 |
+ |
void t_DocumentClosing(ControlClosingEventArgs<int> e) |
139 |
+ |
{ |
140 |
+ |
int index = e.Args; |
141 |
+ |
this.docuemntList.RemoveAt(index); |
142 |
+ |
} |
143 |
+ |
|
144 |
|
//private void txtScratchPad_LinkClicked(object sender, LinkClickedEventArgs e) |
145 |
|
//{ |
146 |
|
// //System.Diagnostics.Process.Start(e.LinkText); |