1 using WeifenLuo.WinFormsUI.Docking;
\r
5 namespace Kuineator.Components.Window
\r
7 class EditWindow:DockContent
\r
10 private bool loaded = true;
\r
11 private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
\r
12 private System.Windows.Forms.ToolStripMenuItem ConMenuItem01;
\r
13 private System.Windows.Forms.ToolStripMenuItem ConMenuItem02;
\r
14 private System.Windows.Forms.ToolStripMenuItem ConMenuItem03;
\r
15 private System.Windows.Forms.ToolStripSeparator ConSeparator01;
\r
16 private System.Windows.Forms.ToolStripMenuItem ConMenuItem04;
\r
17 private System.Windows.Forms.ToolStripMenuItem ConMenuItem05;
\r
18 private System.Windows.Forms.ToolStripSeparator ConSeparator02;
\r
19 private System.Windows.Forms.ToolStripMenuItem ConMenuItem06;
\r
20 private System.Windows.Forms.ToolStripMenuItem ConMenuItem07;
\r
21 public string path = "";
\r
22 public EditWindow(){
\r
23 InitializeComponent();
\r
27 public EditWindow(string path)
\r
29 InitializeComponent();
\r
31 FileInfo f = new FileInfo(path);
\r
33 this.codeEditorControl1.Open(path);
\r
37 public EditWindow(string tabname, int mode)
\r
39 InitializeComponent();
\r
41 this.Text = tabname;
\r
44 public EditWindow(string tabname, string str)
\r
46 InitializeComponent();
\r
48 this.Text = tabname;
\r
51 this.Load +=new EventHandler(codeEditorControl1_Load);
\r
54 private void codeEditorControl1_Load(object sender, EventArgs e){
\r
55 this.syntaxDocument1.InsertText(swp, 0, 0);
\r
59 private void InitializeComponent()
\r
61 this.components = new System.ComponentModel.Container();
\r
62 Fireball.Windows.Forms.LineMarginRender lineMarginRender2 = new Fireball.Windows.Forms.LineMarginRender();
\r
63 this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
\r
64 this.codeEditorControl1 = new Fireball.Windows.Forms.CodeEditorControl();
\r
65 this.syntaxDocument1 = new Fireball.Syntax.SyntaxDocument(this.components);
\r
66 this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
\r
67 this.ConMenuItem01 = new System.Windows.Forms.ToolStripMenuItem();
\r
68 this.ConMenuItem02 = new System.Windows.Forms.ToolStripMenuItem();
\r
69 this.ConMenuItem03 = new System.Windows.Forms.ToolStripMenuItem();
\r
70 this.ConSeparator01 = new System.Windows.Forms.ToolStripSeparator();
\r
71 this.ConMenuItem04 = new System.Windows.Forms.ToolStripMenuItem();
\r
72 this.ConMenuItem05 = new System.Windows.Forms.ToolStripMenuItem();
\r
73 this.ConSeparator02 = new System.Windows.Forms.ToolStripSeparator();
\r
74 this.ConMenuItem06 = new System.Windows.Forms.ToolStripMenuItem();
\r
75 this.ConMenuItem07 = new System.Windows.Forms.ToolStripMenuItem();
\r
76 this.tableLayoutPanel1.SuspendLayout();
\r
77 this.contextMenuStrip1.SuspendLayout();
\r
78 this.SuspendLayout();
\r
80 // tableLayoutPanel1
\r
82 this.tableLayoutPanel1.ColumnCount = 1;
\r
83 this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
\r
84 this.tableLayoutPanel1.Controls.Add(this.codeEditorControl1, 0, 1);
\r
85 this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
\r
86 this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
\r
87 this.tableLayoutPanel1.Name = "tableLayoutPanel1";
\r
88 this.tableLayoutPanel1.RowCount = 2;
\r
89 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.198473F));
\r
90 this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 95.80153F));
\r
91 this.tableLayoutPanel1.Size = new System.Drawing.Size(284, 262);
\r
92 this.tableLayoutPanel1.TabIndex = 0;
\r
94 // codeEditorControl1
\r
96 this.codeEditorControl1.ActiveView = Fireball.Windows.Forms.CodeEditor.ActiveView.BottomRight;
\r
97 this.codeEditorControl1.AllowDrop = true;
\r
98 this.codeEditorControl1.AutoListPosition = null;
\r
99 this.codeEditorControl1.AutoListSelectedText = "a123";
\r
100 this.codeEditorControl1.AutoListVisible = false;
\r
101 this.codeEditorControl1.CopyAsRTF = false;
\r
102 this.codeEditorControl1.Dock = System.Windows.Forms.DockStyle.Fill;
\r
103 this.codeEditorControl1.Document = this.syntaxDocument1;
\r
104 this.codeEditorControl1.Indent = Fireball.Windows.Forms.CodeEditor.IndentStyle.None;
\r
105 this.codeEditorControl1.InfoTipCount = 1;
\r
106 this.codeEditorControl1.InfoTipPosition = null;
\r
107 this.codeEditorControl1.InfoTipSelectedIndex = 1;
\r
108 this.codeEditorControl1.InfoTipVisible = false;
\r
109 lineMarginRender2.Bounds = new System.Drawing.Rectangle(19, 0, 19, 16);
\r
110 this.codeEditorControl1.LineMarginRender = lineMarginRender2;
\r
111 this.codeEditorControl1.Location = new System.Drawing.Point(3, 13);
\r
112 this.codeEditorControl1.LockCursorUpdate = false;
\r
113 this.codeEditorControl1.Name = "codeEditorControl1";
\r
114 this.codeEditorControl1.Saved = false;
\r
115 this.codeEditorControl1.ScopeIndicatorColor = System.Drawing.Color.White;
\r
116 this.codeEditorControl1.ShowScopeIndicator = false;
\r
117 this.codeEditorControl1.Size = new System.Drawing.Size(278, 246);
\r
118 this.codeEditorControl1.SmoothScroll = true;
\r
119 this.codeEditorControl1.SplitviewH = -4;
\r
120 this.codeEditorControl1.SplitviewV = -4;
\r
121 this.codeEditorControl1.TabGuideColor = System.Drawing.Color.FromArgb(((int)(((byte)(233)))), ((int)(((byte)(233)))), ((int)(((byte)(233)))));
\r
122 this.codeEditorControl1.TabIndex = 0;
\r
123 this.codeEditorControl1.Text = "codeEditorControl1";
\r
124 this.codeEditorControl1.WhitespaceColor = System.Drawing.SystemColors.ControlDark;
\r
128 this.syntaxDocument1.Lines = new string[] {
\r
130 this.syntaxDocument1.MaxUndoBufferSize = 1000;
\r
131 this.syntaxDocument1.Modified = false;
\r
132 this.syntaxDocument1.UndoStep = 0;
\r
134 // contextMenuStrip1
\r
136 this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
\r
137 this.ConMenuItem01,
\r
138 this.ConMenuItem02,
\r
139 this.ConMenuItem03,
\r
140 this.ConSeparator01,
\r
141 this.ConMenuItem04,
\r
142 this.ConMenuItem05,
\r
143 this.ConSeparator02,
\r
144 this.ConMenuItem06,
\r
145 this.ConMenuItem07});
\r
146 this.contextMenuStrip1.Name = "contextMenuStrip1";
\r
147 this.contextMenuStrip1.Size = new System.Drawing.Size(153, 192);
\r
151 this.ConMenuItem01.Name = "ConMenuItem01";
\r
152 this.ConMenuItem01.Size = new System.Drawing.Size(152, 22);
\r
153 this.ConMenuItem01.Text = "閉じる";
\r
154 this.ConMenuItem01.Click += new System.EventHandler(this.ConMenuItem01_Click);
\r
158 this.ConMenuItem02.Name = "ConMenuItem02";
\r
159 this.ConMenuItem02.Size = new System.Drawing.Size(152, 22);
\r
160 this.ConMenuItem02.Text = "他を閉じる";
\r
161 this.ConMenuItem02.Click += new System.EventHandler(this.ConMenuItem02_Click);
\r
165 this.ConMenuItem03.Name = "ConMenuItem03";
\r
166 this.ConMenuItem03.Size = new System.Drawing.Size(152, 22);
\r
167 this.ConMenuItem03.Text = "すべて閉じる";
\r
168 this.ConMenuItem03.Click += new System.EventHandler(this.ConMenuItem03_Click);
\r
172 this.ConSeparator01.Name = "ConSeparator01";
\r
173 this.ConSeparator01.Size = new System.Drawing.Size(149, 6);
\r
177 this.ConMenuItem04.Name = "ConMenuItem04";
\r
178 this.ConMenuItem04.Size = new System.Drawing.Size(152, 22);
\r
179 this.ConMenuItem04.Text = "再読み込み";
\r
180 this.ConMenuItem04.Click += new System.EventHandler(this.ConMenuItem04_Click);
\r
184 this.ConMenuItem05.Name = "ConMenuItem05";
\r
185 this.ConMenuItem05.Size = new System.Drawing.Size(152, 22);
\r
186 this.ConMenuItem05.Text = "複製";
\r
187 this.ConMenuItem05.Click += new System.EventHandler(this.ConMenuItem05_Click);
\r
191 this.ConSeparator02.Name = "ConSeparator02";
\r
192 this.ConSeparator02.Size = new System.Drawing.Size(149, 6);
\r
196 this.ConMenuItem06.Name = "ConMenuItem06";
\r
197 this.ConMenuItem06.Size = new System.Drawing.Size(152, 22);
\r
198 this.ConMenuItem06.Text = "保存";
\r
199 this.ConMenuItem06.Click += new System.EventHandler(this.ConMenuItem06_Click);
\r
203 this.ConMenuItem07.Name = "ConMenuItem07";
\r
204 this.ConMenuItem07.Size = new System.Drawing.Size(152, 22);
\r
205 this.ConMenuItem07.Text = "上書き保存";
\r
206 this.ConMenuItem07.Click += new System.EventHandler(this.ConMenuItem07_Click);
\r
210 this.ClientSize = new System.Drawing.Size(284, 262);
\r
211 this.Controls.Add(this.tableLayoutPanel1);
\r
212 this.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
\r
213 this.Name = "EditWindow";
\r
214 this.TabPageContextMenuStrip = this.contextMenuStrip1;
\r
215 this.tableLayoutPanel1.ResumeLayout(false);
\r
216 this.contextMenuStrip1.ResumeLayout(false);
\r
217 this.ResumeLayout(false);
\r
221 private void EditInitialize()
\r
223 this.lexer = new PwrLexer(this.syntaxDocument1, this.codeEditorControl1);
\r
227 this.tablist1 = new Fireball.Windows.Forms.CodeEditor.AutoListForm(this.codeEditorControl1);
\r
228 this.tablist1.AutoSize = true;
\r
229 this.tablist1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
\r
230 this.tablist1.ClientSize = new System.Drawing.Size(167, 164);
\r
231 this.tablist1.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
\r
232 this.tablist1.Location = new System.Drawing.Point(0, 0);
\r
233 this.tablist1.Name = "tablist1";
\r
234 this.tablist1.ShowInTaskbar = false;
\r
235 this.tablist1.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
\r
236 this.tablist1.Visible = false;
\r
237 this.codeEditorControl1.TextChanged += new System.EventHandler(this.codeEditorControl1_TextChanged);
\r
240 public Fireball.Windows.Forms.CodeEditorControl getEditor()
\r
242 return this.codeEditorControl1;
\r
245 private void codeEditorControl1_TextChanged(object sender, EventArgs e)
\r
247 this.lexer.TextChanged();
\r
248 if (this.Text[this.Text.Length - 1] != '*' && loaded) this.Text += "*";
\r
251 public void EditWindow_Deactivate(object sender, EventArgs e)
\r
253 this.codeEditorControl1.AutoListVisible = false;
\r
256 public void WindowSave()
\r
258 if (this.Text[this.Text.Length - 1] == '*')
\r
260 if (this.path == "")
\r
262 if (System.Windows.Forms.MessageBox.Show("新規ファイルを保存しますか?",
\r
264 System.Windows.Forms.MessageBoxButtons.YesNo,
\r
265 System.Windows.Forms.MessageBoxIcon.Exclamation,
\r
266 System.Windows.Forms.MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
\r
268 FileStream f = Settings.FileControl.getSaveFile();
\r
271 StreamWriter fw = new StreamWriter(f, System.Text.Encoding.GetEncoding(Settings.FileControl.CharacterCode));
\r
272 fw.Write(this.syntaxDocument1.Text);
\r
280 FileStream f = new FileStream(this.path, FileMode.Create);
\r
281 StreamWriter fw = new StreamWriter(f, System.Text.Encoding.GetEncoding(Settings.FileControl.CharacterCode));
\r
282 fw.Write(this.syntaxDocument1.Text);
\r
289 public void WindowSaveAs()
\r
292 FileStream f = Settings.FileControl.getSaveFile();
\r
295 this.path = f.Name;
\r
296 StreamWriter fw = new StreamWriter(f, System.Text.Encoding.GetEncoding(Settings.FileControl.CharacterCode));
\r
297 fw.Write(this.syntaxDocument1.Text);
\r
303 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
\r
304 private Fireball.Windows.Forms.CodeEditorControl codeEditorControl1;
\r
305 public Fireball.Syntax.SyntaxDocument syntaxDocument1;
\r
306 private Fireball.Windows.Forms.CodeEditor.AutoListForm tablist1;
\r
307 private System.ComponentModel.IContainer components;
\r
308 private PwrLexer lexer;
\r
310 private void ConMenuItem01_Click(object sender, EventArgs e)
\r
316 private void ConMenuItem02_Click(object sender, EventArgs e)
\r
318 Tools.PropertyManager.editmag.OtherRemoveWindow(this);
\r
321 private void ConMenuItem03_Click(object sender, EventArgs e)
\r
326 private void ConMenuItem04_Click(object sender, EventArgs e)
\r
331 private void ConMenuItem05_Click(object sender, EventArgs e)
\r
336 private void ConMenuItem06_Click(object sender, EventArgs e)
\r
341 private void ConMenuItem07_Click(object sender, EventArgs e)
\r