From 78455c91b09616e2ff6713adbd6d44463a80608b Mon Sep 17 00:00:00 2001 From: Jes Date: Thu, 14 Jan 2010 19:01:07 +0100 Subject: Mise à jour de l'éditeur MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-editor/AboutBox.Designer.cs | 139 ++++++ script-editor/AboutBox.cs | 75 +++ script-editor/AboutBox.resx | 181 +++++++ script-editor/CommentForm.Designer.cs | 83 ++++ script-editor/CommentForm.cs | 28 ++ script-editor/CommentForm.resx | 120 +++++ script-editor/CustomControl.cs | 35 ++ script-editor/FontFile.cs | 6 +- script-editor/MainForm.Designer.cs | 805 ++++++++++++++++++++++--------- script-editor/MainForm.cs | 534 +++++++++++++------- script-editor/MainForm.resx | 3 + script-editor/MyPanel.cs | 11 - script-editor/Pointer.cs | 34 +- script-editor/Properties/AssemblyInfo.cs | 4 +- script-editor/VPScriptEditor_CS.csproj | 30 +- 15 files changed, 1659 insertions(+), 429 deletions(-) create mode 100644 script-editor/AboutBox.Designer.cs create mode 100644 script-editor/AboutBox.cs create mode 100644 script-editor/AboutBox.resx create mode 100644 script-editor/CommentForm.Designer.cs create mode 100644 script-editor/CommentForm.cs create mode 100644 script-editor/CommentForm.resx create mode 100644 script-editor/CustomControl.cs delete mode 100644 script-editor/MyPanel.cs diff --git a/script-editor/AboutBox.Designer.cs b/script-editor/AboutBox.Designer.cs new file mode 100644 index 0000000..375663d --- /dev/null +++ b/script-editor/AboutBox.Designer.cs @@ -0,0 +1,139 @@ +namespace VPScriptEditor +{ + partial class AboutBox + { + private System.ComponentModel.IContainer components = null; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox)); + this.labelProductName = new System.Windows.Forms.Label(); + this.okButton = new System.Windows.Forms.Button(); + this.labelCopyright = new System.Windows.Forms.Label(); + this.labelVersion = new System.Windows.Forms.Label(); + this.logoPictureBox = new System.Windows.Forms.PictureBox(); + this.labelWebsite = new System.Windows.Forms.Label(); + this.linkLblWebsite = new System.Windows.Forms.LinkLabel(); + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // labelProductName + // + this.labelProductName.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelProductName.Location = new System.Drawing.Point(78, 0); + this.labelProductName.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelProductName.Name = "labelProductName"; + this.labelProductName.Size = new System.Drawing.Size(205, 43); + this.labelProductName.TabIndex = 19; + this.labelProductName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // okButton + // + this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.okButton.Location = new System.Drawing.Point(110, 110); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 22); + this.okButton.TabIndex = 24; + this.okButton.Text = "&OK"; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // labelCopyright + // + this.labelCopyright.AutoSize = true; + this.labelCopyright.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelCopyright.Location = new System.Drawing.Point(78, 64); + this.labelCopyright.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelCopyright.Name = "labelCopyright"; + this.labelCopyright.Size = new System.Drawing.Size(0, 13); + this.labelCopyright.TabIndex = 21; + this.labelCopyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // labelVersion + // + this.labelVersion.AutoSize = true; + this.labelVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelVersion.Location = new System.Drawing.Point(78, 43); + this.labelVersion.Margin = new System.Windows.Forms.Padding(6, 0, 3, 0); + this.labelVersion.Name = "labelVersion"; + this.labelVersion.Size = new System.Drawing.Size(0, 13); + this.labelVersion.TabIndex = 0; + this.labelVersion.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // logoPictureBox + // + this.logoPictureBox.Anchor = System.Windows.Forms.AnchorStyles.None; + this.logoPictureBox.Image = ((System.Drawing.Image)(resources.GetObject("logoPictureBox.Image"))); + this.logoPictureBox.Location = new System.Drawing.Point(12, 43); + this.logoPictureBox.Name = "logoPictureBox"; + this.logoPictureBox.Size = new System.Drawing.Size(48, 48); + this.logoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.logoPictureBox.TabIndex = 12; + this.logoPictureBox.TabStop = false; + // + // labelWebsite + // + this.labelWebsite.AutoSize = true; + this.labelWebsite.Location = new System.Drawing.Point(78, 85); + this.labelWebsite.Name = "labelWebsite"; + this.labelWebsite.Size = new System.Drawing.Size(52, 13); + this.labelWebsite.TabIndex = 25; + this.labelWebsite.Text = "Web site:"; + this.labelWebsite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // linkLblWebsite + // + this.linkLblWebsite.AutoSize = true; + this.linkLblWebsite.Location = new System.Drawing.Point(136, 86); + this.linkLblWebsite.Name = "linkLblWebsite"; + this.linkLblWebsite.Size = new System.Drawing.Size(122, 13); + this.linkLblWebsite.TabIndex = 26; + this.linkLblWebsite.TabStop = true; + this.linkLblWebsite.Text = "http://www.bessab.com"; + this.linkLblWebsite.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLblWebsite_LinkClicked); + // + // AboutBox + // + this.AcceptButton = this.okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.okButton; + this.ClientSize = new System.Drawing.Size(295, 138); + this.Controls.Add(this.linkLblWebsite); + this.Controls.Add(this.labelWebsite); + this.Controls.Add(this.labelProductName); + this.Controls.Add(this.labelVersion); + this.Controls.Add(this.logoPictureBox); + this.Controls.Add(this.labelCopyright); + this.Controls.Add(this.okButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AboutBox"; + this.Padding = new System.Windows.Forms.Padding(9); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + ((System.ComponentModel.ISupportInitialize)(this.logoPictureBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + private System.Windows.Forms.Label labelProductName; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.Label labelCopyright; + private System.Windows.Forms.Label labelVersion; + private System.Windows.Forms.PictureBox logoPictureBox; + private System.Windows.Forms.Label labelWebsite; + private System.Windows.Forms.LinkLabel linkLblWebsite; + } +} diff --git a/script-editor/AboutBox.cs b/script-editor/AboutBox.cs new file mode 100644 index 0000000..dc107d0 --- /dev/null +++ b/script-editor/AboutBox.cs @@ -0,0 +1,75 @@ +using System; +using System.Reflection; +using System.Windows.Forms; + +namespace VPScriptEditor +{ + partial class AboutBox : Form + { + public AboutBox() + { + InitializeComponent(); + Text = String.Format("About {0}", AssemblyTitle); + labelProductName.Text = AssemblyProduct; + labelVersion.Text = String.Format("Version {0}", AssemblyVersion); + labelCopyright.Text = AssemblyCopyright; + } + + public static string AssemblyTitle + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); + if (attributes.Length > 0) + { + AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; + if (titleAttribute.Title != "") + return titleAttribute.Title; + } + return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); + } + } + + public static string AssemblyVersion + { + get + { + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); + } + } + + public static string AssemblyProduct + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); + if (attributes.Length == 0) + return ""; + else + return ((AssemblyProductAttribute)attributes[0]).Product; + } + } + + public static string AssemblyCopyright + { + get + { + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + if (attributes.Length == 0) + return ""; + else + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + } + + private void okButton_Click(object sender, EventArgs e) + { + Close(); + } + + private void linkLblWebsite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + System.Diagnostics.Process.Start(linkLblWebsite.Text); + } + } +} diff --git a/script-editor/AboutBox.resx b/script-editor/AboutBox.resx new file mode 100644 index 0000000..cee9442 --- /dev/null +++ b/script-editor/AboutBox.resx @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + 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 + AAAASUVORK5CYII= + + + \ No newline at end of file diff --git a/script-editor/CommentForm.Designer.cs b/script-editor/CommentForm.Designer.cs new file mode 100644 index 0000000..3400912 --- /dev/null +++ b/script-editor/CommentForm.Designer.cs @@ -0,0 +1,83 @@ +namespace VPScriptEditor +{ + partial class CommentForm + { + private System.ComponentModel.IContainer components = null; + + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.richTxtComment = new System.Windows.Forms.RichTextBox(); + this.bttnOK = new System.Windows.Forms.Button(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.richTxtComment, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.bttnOK, 0, 1); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(5, 5); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(636, 308); + this.tableLayoutPanel1.TabIndex = 0; + // + // richTxtComment + // + this.richTxtComment.Dock = System.Windows.Forms.DockStyle.Fill; + this.richTxtComment.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.richTxtComment.Location = new System.Drawing.Point(3, 3); + this.richTxtComment.Name = "richTxtComment"; + this.richTxtComment.Size = new System.Drawing.Size(630, 272); + this.richTxtComment.TabIndex = 0; + this.richTxtComment.Text = ""; + // + // bttnOK + // + this.bttnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); + this.bttnOK.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.bttnOK.Location = new System.Drawing.Point(282, 281); + this.bttnOK.Name = "bttnOK"; + this.bttnOK.Size = new System.Drawing.Size(72, 24); + this.bttnOK.TabIndex = 1; + this.bttnOK.Text = "OK"; + this.bttnOK.UseVisualStyleBackColor = true; + this.bttnOK.Click += new System.EventHandler(this.bttnOK_Click); + // + // CommentForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.bttnOK; + this.ClientSize = new System.Drawing.Size(646, 318); + this.Controls.Add(this.tableLayoutPanel1); + this.MinimizeBox = false; + this.Name = "CommentForm"; + this.Padding = new System.Windows.Forms.Padding(5); + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.tableLayoutPanel1.ResumeLayout(false); + this.ResumeLayout(false); + + } + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.RichTextBox richTxtComment; + private System.Windows.Forms.Button bttnOK; + } +} \ No newline at end of file diff --git a/script-editor/CommentForm.cs b/script-editor/CommentForm.cs new file mode 100644 index 0000000..12106fe --- /dev/null +++ b/script-editor/CommentForm.cs @@ -0,0 +1,28 @@ +using System.Windows.Forms; + +namespace VPScriptEditor +{ + public partial class CommentForm : Form + { + public string Comment + { + get + { + return richTxtComment.Text.Length > 0 ? richTxtComment.Text : null; + } + } + + public CommentForm(int pointerNb, string comment) + { + InitializeComponent(); + + richTxtComment.Text = comment == null ? "" : comment; + this.Text = "Comment for pointer " + (pointerNb + 1); + } + + private void bttnOK_Click(object sender, System.EventArgs e) + { + Close(); + } + } +} diff --git a/script-editor/CommentForm.resx b/script-editor/CommentForm.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/script-editor/CommentForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/script-editor/CustomControl.cs b/script-editor/CustomControl.cs new file mode 100644 index 0000000..829565c --- /dev/null +++ b/script-editor/CustomControl.cs @@ -0,0 +1,35 @@ +using System.Windows.Forms; + +namespace CustomControl +{ + public class MyPanel : Panel + { + protected override void OnPaintBackground(PaintEventArgs pevent) { } + } + + public class MyRichTextBox : RichTextBox + { + private bool allowedKeypress; + + protected override void OnKeyPress(KeyPressEventArgs e) + { + e.Handled = true; + if (!allowedKeypress) + System.Media.SystemSounds.Beep.Play(); + } + + protected override void OnKeyDown(KeyEventArgs e) + { + allowedKeypress = e.Control && (e.KeyCode == Keys.A || e.KeyCode == Keys.C || e.KeyCode == Keys.Insert || e.KeyCode == Keys.Y || e.KeyCode == Keys.Z); + + if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete || (e.Control && (e.KeyCode == Keys.V || e.KeyCode == Keys.X)) || (e.Shift && (e.KeyCode == Keys.Insert || e.KeyCode == Keys.Delete))) + { + if (e.KeyCode == Keys.Delete || (e.Shift && (e.KeyCode == Keys.Insert || e.KeyCode == Keys.Delete))) + System.Media.SystemSounds.Beep.Play(); + e.Handled = true; + } + else + base.OnKeyDown(e); + } + } +} diff --git a/script-editor/FontFile.cs b/script-editor/FontFile.cs index 8bbf61e..cc74763 100644 --- a/script-editor/FontFile.cs +++ b/script-editor/FontFile.cs @@ -61,7 +61,7 @@ namespace VPScriptEditor case "Text": if (attrs[i].Value.Length != 1) - throw new Exception("Invalid database"); + throw new Exception("Invalid database, character " + attrs[i].Value + " not supported"); text = attrs[i].Value[0]; break; @@ -79,8 +79,8 @@ namespace VPScriptEditor XmlDocument fontXml = new XmlDocument(); fontXml.Load(file); XmlNodeList fontNode = fontXml.GetElementsByTagName("Symbol"); - glyphs = new Symbol[fontNode.Count + 1]; - bitmaps = new Bitmap[fontNode.Count + 1]; + glyphs = new Symbol[fontNode.Count]; + bitmaps = new Bitmap[fontNode.Count]; data = new Dictionary(); for (int i = 0; i < fontNode.Count; i++) { diff --git a/script-editor/MainForm.Designer.cs b/script-editor/MainForm.Designer.cs index ee72599..f879053 100644 --- a/script-editor/MainForm.Designer.cs +++ b/script-editor/MainForm.Designer.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Drawing; using System.Diagnostics; using System.Windows.Forms; + namespace VPScriptEditor { partial class VPScriptEditor : Form @@ -36,45 +37,76 @@ namespace VPScriptEditor this.txtbxPointerNumber = new System.Windows.Forms.TextBox(); this.bttnPrevious = new System.Windows.Forms.Button(); this.bttnNext = new System.Windows.Forms.Button(); - this.txtbxInputPtr = new System.Windows.Forms.TextBox(); this.grpbxInput = new System.Windows.Forms.GroupBox(); - this.txtbxInputHeight = new System.Windows.Forms.TextBox(); - this.lblInputHeight = new System.Windows.Forms.Label(); - this.txtbxInputWidth = new System.Windows.Forms.TextBox(); - this.lblInputWidth = new System.Windows.Forms.Label(); - this.txtbxInputY = new System.Windows.Forms.TextBox(); - this.lblInputY = new System.Windows.Forms.Label(); - this.txtbxInputX = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.lblInputX = new System.Windows.Forms.Label(); + this.txtbxInputX = new System.Windows.Forms.TextBox(); + this.lblInputY = new System.Windows.Forms.Label(); + this.txtbxInputY = new System.Windows.Forms.TextBox(); + this.lblInputWidth = new System.Windows.Forms.Label(); + this.txtbxInputWidth = new System.Windows.Forms.TextBox(); + this.lblInputHeight = new System.Windows.Forms.Label(); + this.txtbxInputHeight = new System.Windows.Forms.TextBox(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.bttnNextUntranslated = new System.Windows.Forms.Button(); + this.bttnNextUnsure = new System.Windows.Forms.Button(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.grpbxOutput = new System.Windows.Forms.GroupBox(); - this.bttnResize = new System.Windows.Forms.Button(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); this.bttnReset = new System.Windows.Forms.Button(); - this.txtbxOutputHeight = new System.Windows.Forms.TextBox(); - this.txtbxOutputPtr = new System.Windows.Forms.TextBox(); - this.lblOutputHeight = new System.Windows.Forms.Label(); - this.txtbxOutputWidth = new System.Windows.Forms.TextBox(); - this.txtbxOutputY = new System.Windows.Forms.TextBox(); + this.bttnResize = new System.Windows.Forms.Button(); + this.chkDone = new System.Windows.Forms.CheckBox(); + this.chkUnsure = new System.Windows.Forms.CheckBox(); + this.bttnComment = new System.Windows.Forms.Button(); + this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); this.lblOutputX = new System.Windows.Forms.Label(); - this.lblOutputWidth = new System.Windows.Forms.Label(); this.txtbxOutputX = new System.Windows.Forms.TextBox(); this.lblOutputY = new System.Windows.Forms.Label(); - this.tsmiTest = new System.Windows.Forms.ToolStripMenuItem(); + this.txtbxOutputY = new System.Windows.Forms.TextBox(); + this.lblOutputWidth = new System.Windows.Forms.Label(); + this.txtbxOutputWidth = new System.Windows.Forms.TextBox(); + this.lblOutputHeight = new System.Windows.Forms.Label(); + this.txtbxOutputHeight = new System.Windows.Forms.TextBox(); + this.richEditOutputPtr = new System.Windows.Forms.RichTextBox(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.OpenMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.SaveAsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menu = new System.Windows.Forms.MenuStrip(); - this.pnlOutput = new CustomControl.MyPanel(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.wordWarpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.statusStrip = new System.Windows.Forms.StatusStrip(); + this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); + this.lblStatusProgress = new System.Windows.Forms.ToolStripStatusLabel(); this.pnlInput = new CustomControl.MyPanel(); + this.richEditInputPtr = new CustomControl.MyRichTextBox(); + this.pnlOutput = new CustomControl.MyPanel(); this.grpbxInput.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.flowLayoutPanel2.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); this.grpbxOutput.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.tableLayoutPanel5.SuspendLayout(); + this.flowLayoutPanel3.SuspendLayout(); + this.flowLayoutPanel4.SuspendLayout(); this.menu.SuspendLayout(); + this.statusStrip.SuspendLayout(); this.SuspendLayout(); // // lblPointerNumber // - this.lblPointerNumber.AutoSize = true; - this.lblPointerNumber.Location = new System.Drawing.Point(6, 16); + this.lblPointerNumber.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblPointerNumber.Location = new System.Drawing.Point(3, 7); this.lblPointerNumber.Name = "lblPointerNumber"; this.lblPointerNumber.Size = new System.Drawing.Size(46, 13); this.lblPointerNumber.TabIndex = 1; @@ -82,17 +114,18 @@ namespace VPScriptEditor // // txtbxRoom // + this.txtbxRoom.Anchor = System.Windows.Forms.AnchorStyles.None; this.txtbxRoom.BackColor = System.Drawing.SystemColors.Window; - this.txtbxRoom.Location = new System.Drawing.Point(371, 40); + this.txtbxRoom.Location = new System.Drawing.Point(413, 4); this.txtbxRoom.Name = "txtbxRoom"; this.txtbxRoom.ReadOnly = true; this.txtbxRoom.Size = new System.Drawing.Size(100, 20); - this.txtbxRoom.TabIndex = 7; + this.txtbxRoom.TabIndex = 6; // // lblRoom // - this.lblRoom.AutoSize = true; - this.lblRoom.Location = new System.Drawing.Point(324, 43); + this.lblRoom.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblRoom.Location = new System.Drawing.Point(366, 7); this.lblRoom.Name = "lblRoom"; this.lblRoom.Size = new System.Drawing.Size(41, 13); this.lblRoom.TabIndex = 3; @@ -100,21 +133,23 @@ namespace VPScriptEditor // // txtbxPointerNumber // + this.txtbxPointerNumber.Anchor = System.Windows.Forms.AnchorStyles.None; this.txtbxPointerNumber.Enabled = false; - this.txtbxPointerNumber.Location = new System.Drawing.Point(58, 13); + this.txtbxPointerNumber.Location = new System.Drawing.Point(91, 4); this.txtbxPointerNumber.MaxLength = 4; this.txtbxPointerNumber.Name = "txtbxPointerNumber"; this.txtbxPointerNumber.Size = new System.Drawing.Size(37, 20); - this.txtbxPointerNumber.TabIndex = 0; + this.txtbxPointerNumber.TabIndex = 2; this.txtbxPointerNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxPointerNumber_KeyPress); // // bttnPrevious // + this.bttnPrevious.Anchor = System.Windows.Forms.AnchorStyles.None; this.bttnPrevious.Enabled = false; this.bttnPrevious.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.bttnPrevious.Location = new System.Drawing.Point(118, 13); + this.bttnPrevious.Location = new System.Drawing.Point(55, 3); this.bttnPrevious.Name = "bttnPrevious"; - this.bttnPrevious.Size = new System.Drawing.Size(30, 20); + this.bttnPrevious.Size = new System.Drawing.Size(30, 22); this.bttnPrevious.TabIndex = 1; this.bttnPrevious.Text = "←"; this.bttnPrevious.UseVisualStyleBackColor = true; @@ -122,260 +157,459 @@ namespace VPScriptEditor // // bttnNext // + this.bttnNext.Anchor = System.Windows.Forms.AnchorStyles.None; this.bttnNext.Enabled = false; this.bttnNext.Font = new System.Drawing.Font("Times New Roman", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.bttnNext.Location = new System.Drawing.Point(157, 13); + this.bttnNext.Location = new System.Drawing.Point(134, 3); this.bttnNext.Name = "bttnNext"; - this.bttnNext.Size = new System.Drawing.Size(30, 20); - this.bttnNext.TabIndex = 2; + this.bttnNext.Size = new System.Drawing.Size(30, 22); + this.bttnNext.TabIndex = 3; this.bttnNext.Text = "→"; this.bttnNext.UseVisualStyleBackColor = true; this.bttnNext.Click += new System.EventHandler(this.bttnNext_Click); // - // txtbxInputPtr - // - this.txtbxInputPtr.BackColor = System.Drawing.SystemColors.Window; - this.txtbxInputPtr.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtbxInputPtr.Location = new System.Drawing.Point(9, 66); - this.txtbxInputPtr.Multiline = true; - this.txtbxInputPtr.Name = "txtbxInputPtr"; - this.txtbxInputPtr.ReadOnly = true; - this.txtbxInputPtr.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtbxInputPtr.Size = new System.Drawing.Size(593, 174); - this.txtbxInputPtr.TabIndex = 8; - // // grpbxInput // - this.grpbxInput.Controls.Add(this.txtbxInputHeight); - this.grpbxInput.Controls.Add(this.lblInputHeight); - this.grpbxInput.Controls.Add(this.txtbxInputWidth); - this.grpbxInput.Controls.Add(this.lblInputWidth); - this.grpbxInput.Controls.Add(this.txtbxInputY); - this.grpbxInput.Controls.Add(this.lblInputY); - this.grpbxInput.Controls.Add(this.txtbxInputX); - this.grpbxInput.Controls.Add(this.lblInputX); - this.grpbxInput.Controls.Add(this.lblRoom); - this.grpbxInput.Controls.Add(this.txtbxInputPtr); - this.grpbxInput.Controls.Add(this.lblPointerNumber); - this.grpbxInput.Controls.Add(this.bttnNext); - this.grpbxInput.Controls.Add(this.txtbxPointerNumber); - this.grpbxInput.Controls.Add(this.bttnPrevious); - this.grpbxInput.Controls.Add(this.txtbxRoom); - this.grpbxInput.Location = new System.Drawing.Point(12, 27); + this.grpbxInput.Controls.Add(this.tableLayoutPanel2); + this.grpbxInput.Dock = System.Windows.Forms.DockStyle.Fill; + this.grpbxInput.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.grpbxInput.Location = new System.Drawing.Point(3, 33); this.grpbxInput.Name = "grpbxInput"; - this.grpbxInput.Size = new System.Drawing.Size(608, 246); - this.grpbxInput.TabIndex = 1; + this.grpbxInput.Size = new System.Drawing.Size(826, 272); + this.grpbxInput.TabIndex = 5; this.grpbxInput.TabStop = false; this.grpbxInput.Text = "Original text"; // - // txtbxInputHeight + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 330F)); + this.tableLayoutPanel2.Controls.Add(this.pnlInput, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel3, 0, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 17); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(820, 252); + this.tableLayoutPanel2.TabIndex = 16; + // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.ColumnCount = 1; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Controls.Add(this.flowLayoutPanel2, 0, 0); + this.tableLayoutPanel3.Controls.Add(this.richEditInputPtr, 0, 1); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 2; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel3.Size = new System.Drawing.Size(484, 246); + this.tableLayoutPanel3.TabIndex = 16; + // + // flowLayoutPanel2 + // + this.flowLayoutPanel2.Controls.Add(this.lblInputX); + this.flowLayoutPanel2.Controls.Add(this.txtbxInputX); + this.flowLayoutPanel2.Controls.Add(this.lblInputY); + this.flowLayoutPanel2.Controls.Add(this.txtbxInputY); + this.flowLayoutPanel2.Controls.Add(this.lblInputWidth); + this.flowLayoutPanel2.Controls.Add(this.txtbxInputWidth); + this.flowLayoutPanel2.Controls.Add(this.lblInputHeight); + this.flowLayoutPanel2.Controls.Add(this.txtbxInputHeight); + this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3); + this.flowLayoutPanel2.Name = "flowLayoutPanel2"; + this.flowLayoutPanel2.Size = new System.Drawing.Size(478, 24); + this.flowLayoutPanel2.TabIndex = 1; // - this.txtbxInputHeight.BackColor = System.Drawing.SystemColors.Window; - this.txtbxInputHeight.Location = new System.Drawing.Point(287, 40); - this.txtbxInputHeight.Name = "txtbxInputHeight"; - this.txtbxInputHeight.ReadOnly = true; - this.txtbxInputHeight.Size = new System.Drawing.Size(30, 20); - this.txtbxInputHeight.TabIndex = 6; - // - // lblInputHeight + // lblInputX // - this.lblInputHeight.AutoSize = true; - this.lblInputHeight.Location = new System.Drawing.Point(237, 43); - this.lblInputHeight.Name = "lblInputHeight"; - this.lblInputHeight.Size = new System.Drawing.Size(44, 13); - this.lblInputHeight.TabIndex = 15; - this.lblInputHeight.Text = "Height :"; + this.lblInputX.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblInputX.AutoSize = true; + this.lblInputX.Location = new System.Drawing.Point(3, 6); + this.lblInputX.Name = "lblInputX"; + this.lblInputX.Size = new System.Drawing.Size(20, 13); + this.lblInputX.TabIndex = 9; + this.lblInputX.Text = "X :"; // - // txtbxInputWidth + // txtbxInputX // - this.txtbxInputWidth.BackColor = System.Drawing.SystemColors.Window; - this.txtbxInputWidth.Location = new System.Drawing.Point(201, 40); - this.txtbxInputWidth.Name = "txtbxInputWidth"; - this.txtbxInputWidth.ReadOnly = true; - this.txtbxInputWidth.Size = new System.Drawing.Size(30, 20); - this.txtbxInputWidth.TabIndex = 5; + this.txtbxInputX.Anchor = System.Windows.Forms.AnchorStyles.None; + this.txtbxInputX.BackColor = System.Drawing.SystemColors.Window; + this.txtbxInputX.Location = new System.Drawing.Point(29, 3); + this.txtbxInputX.Name = "txtbxInputX"; + this.txtbxInputX.ReadOnly = true; + this.txtbxInputX.Size = new System.Drawing.Size(30, 20); + this.txtbxInputX.TabIndex = 1; // - // lblInputWidth + // lblInputY // - this.lblInputWidth.AutoSize = true; - this.lblInputWidth.Location = new System.Drawing.Point(154, 43); - this.lblInputWidth.Name = "lblInputWidth"; - this.lblInputWidth.Size = new System.Drawing.Size(41, 13); - this.lblInputWidth.TabIndex = 13; - this.lblInputWidth.Text = "Width :"; + this.lblInputY.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblInputY.AutoSize = true; + this.lblInputY.Location = new System.Drawing.Point(65, 6); + this.lblInputY.Name = "lblInputY"; + this.lblInputY.Size = new System.Drawing.Size(20, 13); + this.lblInputY.TabIndex = 11; + this.lblInputY.Text = "Y :"; // // txtbxInputY // + this.txtbxInputY.Anchor = System.Windows.Forms.AnchorStyles.None; this.txtbxInputY.BackColor = System.Drawing.SystemColors.Window; - this.txtbxInputY.Location = new System.Drawing.Point(118, 40); + this.txtbxInputY.Location = new System.Drawing.Point(91, 3); this.txtbxInputY.Name = "txtbxInputY"; this.txtbxInputY.ReadOnly = true; this.txtbxInputY.Size = new System.Drawing.Size(30, 20); - this.txtbxInputY.TabIndex = 4; + this.txtbxInputY.TabIndex = 2; // - // lblInputY + // lblInputWidth // - this.lblInputY.AutoSize = true; - this.lblInputY.Location = new System.Drawing.Point(94, 43); - this.lblInputY.Name = "lblInputY"; - this.lblInputY.Size = new System.Drawing.Size(20, 13); - this.lblInputY.TabIndex = 11; - this.lblInputY.Text = "Y :"; + this.lblInputWidth.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblInputWidth.AutoSize = true; + this.lblInputWidth.Location = new System.Drawing.Point(127, 6); + this.lblInputWidth.Name = "lblInputWidth"; + this.lblInputWidth.Size = new System.Drawing.Size(41, 13); + this.lblInputWidth.TabIndex = 13; + this.lblInputWidth.Text = "Width :"; // - // txtbxInputX + // txtbxInputWidth // - this.txtbxInputX.BackColor = System.Drawing.SystemColors.Window; - this.txtbxInputX.Location = new System.Drawing.Point(58, 40); - this.txtbxInputX.Name = "txtbxInputX"; - this.txtbxInputX.ReadOnly = true; - this.txtbxInputX.Size = new System.Drawing.Size(30, 20); - this.txtbxInputX.TabIndex = 3; + this.txtbxInputWidth.Anchor = System.Windows.Forms.AnchorStyles.None; + this.txtbxInputWidth.BackColor = System.Drawing.SystemColors.Window; + this.txtbxInputWidth.Location = new System.Drawing.Point(174, 3); + this.txtbxInputWidth.Name = "txtbxInputWidth"; + this.txtbxInputWidth.ReadOnly = true; + this.txtbxInputWidth.Size = new System.Drawing.Size(30, 20); + this.txtbxInputWidth.TabIndex = 3; // - // lblInputX + // lblInputHeight // - this.lblInputX.AutoSize = true; - this.lblInputX.Location = new System.Drawing.Point(34, 43); - this.lblInputX.Name = "lblInputX"; - this.lblInputX.Size = new System.Drawing.Size(20, 13); - this.lblInputX.TabIndex = 9; - this.lblInputX.Text = "X :"; + this.lblInputHeight.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblInputHeight.AutoSize = true; + this.lblInputHeight.Location = new System.Drawing.Point(210, 6); + this.lblInputHeight.Name = "lblInputHeight"; + this.lblInputHeight.Size = new System.Drawing.Size(44, 13); + this.lblInputHeight.TabIndex = 15; + this.lblInputHeight.Text = "Height :"; + // + // txtbxInputHeight + // + this.txtbxInputHeight.Anchor = System.Windows.Forms.AnchorStyles.None; + this.txtbxInputHeight.BackColor = System.Drawing.SystemColors.Window; + this.txtbxInputHeight.Location = new System.Drawing.Point(260, 3); + this.txtbxInputHeight.Name = "txtbxInputHeight"; + this.txtbxInputHeight.ReadOnly = true; + this.txtbxInputHeight.Size = new System.Drawing.Size(30, 20); + this.txtbxInputHeight.TabIndex = 4; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Controls.Add(this.lblPointerNumber); + this.flowLayoutPanel1.Controls.Add(this.bttnPrevious); + this.flowLayoutPanel1.Controls.Add(this.txtbxPointerNumber); + this.flowLayoutPanel1.Controls.Add(this.bttnNext); + this.flowLayoutPanel1.Controls.Add(this.bttnNextUntranslated); + this.flowLayoutPanel1.Controls.Add(this.bttnNextUnsure); + this.flowLayoutPanel1.Controls.Add(this.lblRoom); + this.flowLayoutPanel1.Controls.Add(this.txtbxRoom); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(826, 24); + this.flowLayoutPanel1.TabIndex = 0; + // + // bttnNextUntranslated + // + this.bttnNextUntranslated.Enabled = false; + this.bttnNextUntranslated.Location = new System.Drawing.Point(170, 3); + this.bttnNextUntranslated.Name = "bttnNextUntranslated"; + this.bttnNextUntranslated.Size = new System.Drawing.Size(108, 22); + this.bttnNextUntranslated.TabIndex = 4; + this.bttnNextUntranslated.Text = "Next untranslated"; + this.bttnNextUntranslated.UseVisualStyleBackColor = true; + this.bttnNextUntranslated.Click += new System.EventHandler(this.bttnNextUntranslated_Click); + // + // bttnNextUnsure + // + this.bttnNextUnsure.Enabled = false; + this.bttnNextUnsure.Location = new System.Drawing.Point(284, 3); + this.bttnNextUnsure.Name = "bttnNextUnsure"; + this.bttnNextUnsure.Size = new System.Drawing.Size(76, 22); + this.bttnNextUnsure.TabIndex = 5; + this.bttnNextUnsure.Text = "Next unsure"; + this.bttnNextUnsure.UseVisualStyleBackColor = true; + this.bttnNextUnsure.Click += new System.EventHandler(this.bttnNextUnsure_Click); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.grpbxInput, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.grpbxOutput, 0, 2); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 24); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(832, 587); + this.tableLayoutPanel1.TabIndex = 18; // // grpbxOutput // - this.grpbxOutput.Controls.Add(this.bttnResize); - this.grpbxOutput.Controls.Add(this.bttnReset); - this.grpbxOutput.Controls.Add(this.txtbxOutputHeight); - this.grpbxOutput.Controls.Add(this.txtbxOutputPtr); - this.grpbxOutput.Controls.Add(this.lblOutputHeight); - this.grpbxOutput.Controls.Add(this.txtbxOutputWidth); - this.grpbxOutput.Controls.Add(this.txtbxOutputY); - this.grpbxOutput.Controls.Add(this.lblOutputX); - this.grpbxOutput.Controls.Add(this.lblOutputWidth); - this.grpbxOutput.Controls.Add(this.txtbxOutputX); - this.grpbxOutput.Controls.Add(this.lblOutputY); - this.grpbxOutput.Location = new System.Drawing.Point(12, 279); + this.grpbxOutput.Controls.Add(this.tableLayoutPanel4); + this.grpbxOutput.Dock = System.Windows.Forms.DockStyle.Fill; + this.grpbxOutput.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.grpbxOutput.Location = new System.Drawing.Point(3, 311); this.grpbxOutput.Name = "grpbxOutput"; - this.grpbxOutput.Size = new System.Drawing.Size(608, 246); - this.grpbxOutput.TabIndex = 0; + this.grpbxOutput.Size = new System.Drawing.Size(826, 273); + this.grpbxOutput.TabIndex = 10; this.grpbxOutput.TabStop = false; this.grpbxOutput.Text = "Translated text"; // - // bttnResize - // - this.bttnResize.Enabled = false; - this.bttnResize.Location = new System.Drawing.Point(397, 13); - this.bttnResize.Name = "bttnResize"; - this.bttnResize.Size = new System.Drawing.Size(96, 20); - this.bttnResize.TabIndex = 5; - this.bttnResize.Text = "Resize window"; - this.bttnResize.UseVisualStyleBackColor = true; - this.bttnResize.Click += new System.EventHandler(this.bttnResize_Click); + // tableLayoutPanel4 + // + this.tableLayoutPanel4.ColumnCount = 2; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 330F)); + this.tableLayoutPanel4.Controls.Add(this.pnlOutput, 1, 0); + this.tableLayoutPanel4.Controls.Add(this.tableLayoutPanel5, 0, 0); + this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 17); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 1; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Size = new System.Drawing.Size(820, 253); + this.tableLayoutPanel4.TabIndex = 24; + // + // tableLayoutPanel5 + // + this.tableLayoutPanel5.ColumnCount = 1; + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel5.Controls.Add(this.flowLayoutPanel3, 0, 0); + this.tableLayoutPanel5.Controls.Add(this.flowLayoutPanel4, 0, 1); + this.tableLayoutPanel5.Controls.Add(this.richEditOutputPtr, 0, 2); + this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 3); + this.tableLayoutPanel5.Name = "tableLayoutPanel5"; + this.tableLayoutPanel5.RowCount = 3; + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel5.Size = new System.Drawing.Size(484, 247); + this.tableLayoutPanel5.TabIndex = 17; + // + // flowLayoutPanel3 + // + this.flowLayoutPanel3.Controls.Add(this.bttnReset); + this.flowLayoutPanel3.Controls.Add(this.bttnResize); + this.flowLayoutPanel3.Controls.Add(this.chkDone); + this.flowLayoutPanel3.Controls.Add(this.chkUnsure); + this.flowLayoutPanel3.Controls.Add(this.bttnComment); + this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel3.Location = new System.Drawing.Point(3, 3); + this.flowLayoutPanel3.Name = "flowLayoutPanel3"; + this.flowLayoutPanel3.Size = new System.Drawing.Size(478, 24); + this.flowLayoutPanel3.TabIndex = 9; // // bttnReset // + this.bttnReset.Anchor = System.Windows.Forms.AnchorStyles.None; this.bttnReset.Enabled = false; - this.bttnReset.Location = new System.Drawing.Point(304, 13); + this.bttnReset.Location = new System.Drawing.Point(3, 3); this.bttnReset.Name = "bttnReset"; - this.bttnReset.Size = new System.Drawing.Size(87, 20); - this.bttnReset.TabIndex = 4; + this.bttnReset.Size = new System.Drawing.Size(87, 22); + this.bttnReset.TabIndex = 1; this.bttnReset.Text = "Reset pointer"; this.bttnReset.UseVisualStyleBackColor = true; this.bttnReset.Click += new System.EventHandler(this.bttnReset_Click); // - // txtbxOutputHeight - // - this.txtbxOutputHeight.Location = new System.Drawing.Point(268, 13); - this.txtbxOutputHeight.Name = "txtbxOutputHeight"; - this.txtbxOutputHeight.Size = new System.Drawing.Size(30, 20); - this.txtbxOutputHeight.TabIndex = 3; - this.txtbxOutputHeight.TextChanged += new System.EventHandler(this.txtbxOutput_TextChanged); - // - // txtbxOutputPtr - // - this.txtbxOutputPtr.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtbxOutputPtr.Location = new System.Drawing.Point(9, 39); - this.txtbxOutputPtr.MaxLength = 5000; - this.txtbxOutputPtr.Multiline = true; - this.txtbxOutputPtr.Name = "txtbxOutputPtr"; - this.txtbxOutputPtr.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.txtbxOutputPtr.Size = new System.Drawing.Size(593, 201); - this.txtbxOutputPtr.TabIndex = 8; - this.txtbxOutputPtr.TextChanged += new System.EventHandler(this.txtbxOutput_TextChanged); - this.txtbxOutputPtr.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxOutputPtr_KeyPress); - // - // lblOutputHeight - // - this.lblOutputHeight.AutoSize = true; - this.lblOutputHeight.Location = new System.Drawing.Point(218, 16); - this.lblOutputHeight.Name = "lblOutputHeight"; - this.lblOutputHeight.Size = new System.Drawing.Size(44, 13); - this.lblOutputHeight.TabIndex = 23; - this.lblOutputHeight.Text = "Height :"; - // - // txtbxOutputWidth - // - this.txtbxOutputWidth.Location = new System.Drawing.Point(182, 13); - this.txtbxOutputWidth.Name = "txtbxOutputWidth"; - this.txtbxOutputWidth.Size = new System.Drawing.Size(30, 20); - this.txtbxOutputWidth.TabIndex = 2; - this.txtbxOutputWidth.TextChanged += new System.EventHandler(this.txtbxOutput_TextChanged); + // bttnResize // - // txtbxOutputY + this.bttnResize.Anchor = System.Windows.Forms.AnchorStyles.None; + this.bttnResize.Enabled = false; + this.bttnResize.Location = new System.Drawing.Point(96, 3); + this.bttnResize.Name = "bttnResize"; + this.bttnResize.Size = new System.Drawing.Size(96, 22); + this.bttnResize.TabIndex = 2; + this.bttnResize.Text = "Resize window"; + this.bttnResize.UseVisualStyleBackColor = true; + this.bttnResize.Click += new System.EventHandler(this.bttnResize_Click); // - this.txtbxOutputY.Location = new System.Drawing.Point(99, 13); - this.txtbxOutputY.Name = "txtbxOutputY"; - this.txtbxOutputY.Size = new System.Drawing.Size(30, 20); - this.txtbxOutputY.TabIndex = 1; - this.txtbxOutputY.TextChanged += new System.EventHandler(this.txtbxOutput_TextChanged); + // chkDone + // + this.chkDone.Anchor = System.Windows.Forms.AnchorStyles.None; + this.chkDone.AutoSize = true; + this.chkDone.Enabled = false; + this.chkDone.Location = new System.Drawing.Point(205, 5); + this.chkDone.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3); + this.chkDone.Name = "chkDone"; + this.chkDone.Size = new System.Drawing.Size(52, 17); + this.chkDone.TabIndex = 3; + this.chkDone.Text = "Done"; + this.chkDone.UseVisualStyleBackColor = true; + this.chkDone.CheckedChanged += new System.EventHandler(this.chkbx_CheckedChanged); + // + // chkUnsure + // + this.chkUnsure.Anchor = System.Windows.Forms.AnchorStyles.None; + this.chkUnsure.AutoSize = true; + this.chkUnsure.Enabled = false; + this.chkUnsure.Location = new System.Drawing.Point(266, 5); + this.chkUnsure.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); + this.chkUnsure.Name = "chkUnsure"; + this.chkUnsure.Size = new System.Drawing.Size(60, 17); + this.chkUnsure.TabIndex = 4; + this.chkUnsure.Text = "Unsure"; + this.chkUnsure.UseVisualStyleBackColor = true; + this.chkUnsure.CheckedChanged += new System.EventHandler(this.chkbx_CheckedChanged); + // + // bttnComment + // + this.bttnComment.Enabled = false; + this.bttnComment.Location = new System.Drawing.Point(332, 3); + this.bttnComment.Name = "bttnComment"; + this.bttnComment.Size = new System.Drawing.Size(113, 22); + this.bttnComment.TabIndex = 5; + this.bttnComment.Text = "Add comment"; + this.bttnComment.UseVisualStyleBackColor = true; + this.bttnComment.Click += new System.EventHandler(this.bttnComment_Click); + // + // flowLayoutPanel4 + // + this.flowLayoutPanel4.Controls.Add(this.lblOutputX); + this.flowLayoutPanel4.Controls.Add(this.txtbxOutputX); + this.flowLayoutPanel4.Controls.Add(this.lblOutputY); + this.flowLayoutPanel4.Controls.Add(this.txtbxOutputY); + this.flowLayoutPanel4.Controls.Add(this.lblOutputWidth); + this.flowLayoutPanel4.Controls.Add(this.txtbxOutputWidth); + this.flowLayoutPanel4.Controls.Add(this.lblOutputHeight); + this.flowLayoutPanel4.Controls.Add(this.txtbxOutputHeight); + this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 33); + this.flowLayoutPanel4.Name = "flowLayoutPanel4"; + this.flowLayoutPanel4.Size = new System.Drawing.Size(478, 24); + this.flowLayoutPanel4.TabIndex = 10; // // lblOutputX // + this.lblOutputX.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblOutputX.AutoSize = true; - this.lblOutputX.Location = new System.Drawing.Point(11, 16); + this.lblOutputX.Location = new System.Drawing.Point(3, 6); this.lblOutputX.Name = "lblOutputX"; this.lblOutputX.Size = new System.Drawing.Size(20, 13); this.lblOutputX.TabIndex = 17; this.lblOutputX.Text = "X :"; // - // lblOutputWidth - // - this.lblOutputWidth.AutoSize = true; - this.lblOutputWidth.Location = new System.Drawing.Point(135, 16); - this.lblOutputWidth.Name = "lblOutputWidth"; - this.lblOutputWidth.Size = new System.Drawing.Size(41, 13); - this.lblOutputWidth.TabIndex = 21; - this.lblOutputWidth.Text = "Width :"; - // // txtbxOutputX // - this.txtbxOutputX.Location = new System.Drawing.Point(37, 13); + this.txtbxOutputX.Anchor = System.Windows.Forms.AnchorStyles.None; + this.txtbxOutputX.Enabled = false; + this.txtbxOutputX.Location = new System.Drawing.Point(29, 3); this.txtbxOutputX.Name = "txtbxOutputX"; this.txtbxOutputX.Size = new System.Drawing.Size(30, 20); - this.txtbxOutputX.TabIndex = 0; - this.txtbxOutputX.TextChanged += new System.EventHandler(this.txtbxOutput_TextChanged); + this.txtbxOutputX.TabIndex = 6; + this.txtbxOutputX.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxOutput_KeyPress); // // lblOutputY // + this.lblOutputY.Anchor = System.Windows.Forms.AnchorStyles.None; this.lblOutputY.AutoSize = true; - this.lblOutputY.Location = new System.Drawing.Point(73, 16); + this.lblOutputY.Location = new System.Drawing.Point(65, 6); this.lblOutputY.Name = "lblOutputY"; this.lblOutputY.Size = new System.Drawing.Size(20, 13); this.lblOutputY.TabIndex = 19; this.lblOutputY.Text = "Y :"; // - // tsmiTest + // txtbxOutputY + // + this.txtbxOutputY.Anchor = System.Windows.Forms.AnchorStyles.None; + this.txtbxOutputY.Enabled = false; + this.txtbxOutputY.Location = new System.Drawing.Point(91, 3); + this.txtbxOutputY.Name = "txtbxOutputY"; + this.txtbxOutputY.Size = new System.Drawing.Size(30, 20); + this.txtbxOutputY.TabIndex = 7; + this.txtbxOutputY.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxOutput_KeyPress); + // + // lblOutputWidth + // + this.lblOutputWidth.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblOutputWidth.AutoSize = true; + this.lblOutputWidth.Location = new System.Drawing.Point(127, 6); + this.lblOutputWidth.Name = "lblOutputWidth"; + this.lblOutputWidth.Size = new System.Drawing.Size(41, 13); + this.lblOutputWidth.TabIndex = 21; + this.lblOutputWidth.Text = "Width :"; + // + // txtbxOutputWidth + // + this.txtbxOutputWidth.Anchor = System.Windows.Forms.AnchorStyles.None; + this.txtbxOutputWidth.Enabled = false; + this.txtbxOutputWidth.Location = new System.Drawing.Point(174, 3); + this.txtbxOutputWidth.Name = "txtbxOutputWidth"; + this.txtbxOutputWidth.Size = new System.Drawing.Size(30, 20); + this.txtbxOutputWidth.TabIndex = 8; + this.txtbxOutputWidth.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxOutput_KeyPress); + // + // lblOutputHeight // - this.tsmiTest.AutoToolTip = true; - this.tsmiTest.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.tsmiTest.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.lblOutputHeight.Anchor = System.Windows.Forms.AnchorStyles.None; + this.lblOutputHeight.AutoSize = true; + this.lblOutputHeight.Location = new System.Drawing.Point(210, 6); + this.lblOutputHeight.Name = "lblOutputHeight"; + this.lblOutputHeight.Size = new System.Drawing.Size(44, 13); + this.lblOutputHeight.TabIndex = 23; + this.lblOutputHeight.Text = "Height :"; + // + // txtbxOutputHeight + // + this.txtbxOutputHeight.Anchor = System.Windows.Forms.AnchorStyles.None; + this.txtbxOutputHeight.Enabled = false; + this.txtbxOutputHeight.Location = new System.Drawing.Point(260, 3); + this.txtbxOutputHeight.Name = "txtbxOutputHeight"; + this.txtbxOutputHeight.Size = new System.Drawing.Size(30, 20); + this.txtbxOutputHeight.TabIndex = 9; + this.txtbxOutputHeight.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxOutput_KeyPress); + // + // richEditOutputPtr + // + this.richEditOutputPtr.DetectUrls = false; + this.richEditOutputPtr.Dock = System.Windows.Forms.DockStyle.Fill; + this.richEditOutputPtr.Enabled = false; + this.richEditOutputPtr.Font = new System.Drawing.Font("MS PGothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.richEditOutputPtr.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.richEditOutputPtr.Location = new System.Drawing.Point(3, 63); + this.richEditOutputPtr.MaxLength = 5000; + this.richEditOutputPtr.Name = "richEditOutputPtr"; + this.richEditOutputPtr.Size = new System.Drawing.Size(478, 181); + this.richEditOutputPtr.TabIndex = 10; + this.richEditOutputPtr.Text = ""; + this.richEditOutputPtr.KeyDown += new System.Windows.Forms.KeyEventHandler(this.richEditOutputPtr_KeyDown); + this.richEditOutputPtr.SelectionChanged += new System.EventHandler(this.richEditOutputPtr_SelectionChanged); + this.richEditOutputPtr.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.richEditOutputPtr_KeyPress); + this.richEditOutputPtr.TextChanged += new System.EventHandler(this.richEditOutputPtr_TextChanged); + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.AutoToolTip = true; + this.fileToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.OpenMenuItem, this.SaveMenuItem, this.SaveAsMenuItem, this.ExitMenuItem}); - this.tsmiTest.Name = "tsmiTest"; - this.tsmiTest.ShortcutKeyDisplayString = ""; - this.tsmiTest.Size = new System.Drawing.Size(37, 20); - this.tsmiTest.Text = "&File"; + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.ShortcutKeyDisplayString = ""; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "&File"; // // OpenMenuItem // @@ -383,7 +617,7 @@ namespace VPScriptEditor this.OpenMenuItem.Name = "OpenMenuItem"; this.OpenMenuItem.ShortcutKeyDisplayString = ""; this.OpenMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); - this.OpenMenuItem.Size = new System.Drawing.Size(152, 22); + this.OpenMenuItem.Size = new System.Drawing.Size(146, 22); this.OpenMenuItem.Text = "&Open"; this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); // @@ -393,7 +627,7 @@ namespace VPScriptEditor this.SaveMenuItem.Enabled = false; this.SaveMenuItem.Name = "SaveMenuItem"; this.SaveMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); - this.SaveMenuItem.Size = new System.Drawing.Size(152, 22); + this.SaveMenuItem.Size = new System.Drawing.Size(146, 22); this.SaveMenuItem.Text = "&Save"; this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click); // @@ -402,7 +636,7 @@ namespace VPScriptEditor this.SaveAsMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.SaveAsMenuItem.Enabled = false; this.SaveAsMenuItem.Name = "SaveAsMenuItem"; - this.SaveAsMenuItem.Size = new System.Drawing.Size(152, 22); + this.SaveAsMenuItem.Size = new System.Drawing.Size(146, 22); this.SaveAsMenuItem.Text = "S&ave as"; this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click); // @@ -410,55 +644,147 @@ namespace VPScriptEditor // this.ExitMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.ExitMenuItem.Name = "ExitMenuItem"; - this.ExitMenuItem.Size = new System.Drawing.Size(152, 22); + this.ExitMenuItem.Size = new System.Drawing.Size(146, 22); this.ExitMenuItem.Text = "E&xit"; this.ExitMenuItem.Click += new System.EventHandler(this.ExitMenuItem_Click); // // menu // this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.tsmiTest}); + this.fileToolStripMenuItem, + this.editToolStripMenuItem, + this.aboutToolStripMenuItem}); this.menu.Location = new System.Drawing.Point(0, 0); this.menu.Name = "menu"; this.menu.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; - this.menu.Size = new System.Drawing.Size(961, 24); + this.menu.Size = new System.Drawing.Size(832, 24); this.menu.TabIndex = 5; this.menu.Text = "MenuStrip1"; // - // pnlOutput + // editToolStripMenuItem // - this.pnlOutput.Location = new System.Drawing.Point(632, 284); - this.pnlOutput.Name = "pnlOutput"; - this.pnlOutput.Size = new System.Drawing.Size(320, 240); - this.pnlOutput.TabIndex = 16; - this.pnlOutput.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlOutput_Paint); + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.wordWarpToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "&Edit"; + // + // wordWarpToolStripMenuItem + // + this.wordWarpToolStripMenuItem.Checked = true; + this.wordWarpToolStripMenuItem.CheckOnClick = true; + this.wordWarpToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.wordWarpToolStripMenuItem.Name = "wordWarpToolStripMenuItem"; + this.wordWarpToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.W))); + this.wordWarpToolStripMenuItem.Size = new System.Drawing.Size(177, 22); + this.wordWarpToolStripMenuItem.Text = "Word warp"; + this.wordWarpToolStripMenuItem.CheckedChanged += new System.EventHandler(this.wordWarpToolStripMenuItem_CheckedChanged); + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.aboutToolStripMenuItem1}); + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(24, 20); + this.aboutToolStripMenuItem.Text = "&?"; + // + // aboutToolStripMenuItem1 + // + this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1"; + this.aboutToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1; + this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(126, 22); + this.aboutToolStripMenuItem1.Text = "&About"; + this.aboutToolStripMenuItem1.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click); + // + // statusStrip + // + this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripStatusLabel1, + this.lblStatusProgress}); + this.statusStrip.Location = new System.Drawing.Point(0, 611); + this.statusStrip.Name = "statusStrip"; + this.statusStrip.Size = new System.Drawing.Size(832, 22); + this.statusStrip.TabIndex = 17; + this.statusStrip.Text = "statusStrip1"; + // + // toolStripStatusLabel1 + // + this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; + this.toolStripStatusLabel1.Size = new System.Drawing.Size(408, 17); + this.toolStripStatusLabel1.Spring = true; + this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblStatusProgress + // + this.lblStatusProgress.Name = "lblStatusProgress"; + this.lblStatusProgress.Size = new System.Drawing.Size(408, 17); + this.lblStatusProgress.Spring = true; + this.lblStatusProgress.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // pnlInput // - this.pnlInput.Location = new System.Drawing.Point(632, 33); + this.pnlInput.Anchor = System.Windows.Forms.AnchorStyles.None; + this.pnlInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pnlInput.Location = new System.Drawing.Point(495, 6); + this.pnlInput.MinimumSize = new System.Drawing.Size(320, 240); this.pnlInput.Name = "pnlInput"; this.pnlInput.Size = new System.Drawing.Size(320, 240); this.pnlInput.TabIndex = 15; this.pnlInput.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlInput_Paint); // + // richEditInputPtr + // + this.richEditInputPtr.BackColor = System.Drawing.SystemColors.Window; + this.richEditInputPtr.DetectUrls = false; + this.richEditInputPtr.Dock = System.Windows.Forms.DockStyle.Fill; + this.richEditInputPtr.Font = new System.Drawing.Font("MS PGothic", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.richEditInputPtr.Location = new System.Drawing.Point(3, 33); + this.richEditInputPtr.Name = "richEditInputPtr"; + this.richEditInputPtr.Size = new System.Drawing.Size(478, 210); + this.richEditInputPtr.TabIndex = 5; + this.richEditInputPtr.Text = ""; + this.richEditInputPtr.SelectionChanged += new System.EventHandler(this.richEdit_SelectionChanged); + this.richEditInputPtr.TextChanged += new System.EventHandler(this.richEditInputPtr_TextChanged); + // + // pnlOutput + // + this.pnlOutput.Anchor = System.Windows.Forms.AnchorStyles.None; + this.pnlOutput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pnlOutput.Location = new System.Drawing.Point(495, 6); + this.pnlOutput.MinimumSize = new System.Drawing.Size(320, 240); + this.pnlOutput.Name = "pnlOutput"; + this.pnlOutput.Size = new System.Drawing.Size(320, 240); + this.pnlOutput.TabIndex = 16; + this.pnlOutput.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlOutput_Paint); + // // VPScriptEditor // - this.ClientSize = new System.Drawing.Size(961, 536); - this.Controls.Add(this.pnlOutput); - this.Controls.Add(this.pnlInput); - this.Controls.Add(this.grpbxOutput); - this.Controls.Add(this.grpbxInput); + this.ClientSize = new System.Drawing.Size(832, 633); + this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.statusStrip); this.Controls.Add(this.menu); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menu; this.Name = "VPScriptEditor"; - this.Text = "VPScriptEditor"; this.grpbxInput.ResumeLayout(false); - this.grpbxInput.PerformLayout(); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel3.ResumeLayout(false); + this.flowLayoutPanel2.ResumeLayout(false); + this.flowLayoutPanel2.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.tableLayoutPanel1.ResumeLayout(false); this.grpbxOutput.ResumeLayout(false); - this.grpbxOutput.PerformLayout(); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel5.ResumeLayout(false); + this.flowLayoutPanel3.ResumeLayout(false); + this.flowLayoutPanel3.PerformLayout(); + this.flowLayoutPanel4.ResumeLayout(false); + this.flowLayoutPanel4.PerformLayout(); this.menu.ResumeLayout(false); this.menu.PerformLayout(); + this.statusStrip.ResumeLayout(false); + this.statusStrip.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -469,10 +795,10 @@ namespace VPScriptEditor private TextBox txtbxPointerNumber; private Button bttnPrevious; private Button bttnNext; - private TextBox txtbxInputPtr; + private CustomControl.MyRichTextBox richEditInputPtr; + private RichTextBox richEditOutputPtr; private GroupBox grpbxInput; private GroupBox grpbxOutput; - private TextBox txtbxOutputPtr; private Label lblInputX; private TextBox txtbxInputX; private TextBox txtbxInputY; @@ -493,12 +819,33 @@ namespace VPScriptEditor private Button bttnResize; private CustomControl.MyPanel pnlInput; private CustomControl.MyPanel pnlOutput; - private ToolStripMenuItem tsmiTest; + private ToolStripMenuItem fileToolStripMenuItem; private ToolStripMenuItem OpenMenuItem; private ToolStripMenuItem SaveMenuItem; private ToolStripMenuItem ExitMenuItem; private MenuStrip menu; - private ToolStripMenuItem SaveAsMenuItem; + private ToolStripMenuItem SaveAsMenuItem; + private StatusStrip statusStrip; + private TableLayoutPanel tableLayoutPanel1; + private TableLayoutPanel tableLayoutPanel2; + private TableLayoutPanel tableLayoutPanel3; + private FlowLayoutPanel flowLayoutPanel1; + private FlowLayoutPanel flowLayoutPanel2; + private TableLayoutPanel tableLayoutPanel4; + private TableLayoutPanel tableLayoutPanel5; + private FlowLayoutPanel flowLayoutPanel3; + private FlowLayoutPanel flowLayoutPanel4; + private ToolStripMenuItem editToolStripMenuItem; + private ToolStripMenuItem wordWarpToolStripMenuItem; + private ToolStripMenuItem aboutToolStripMenuItem; + private ToolStripMenuItem aboutToolStripMenuItem1; + private ToolStripStatusLabel toolStripStatusLabel1; + private CheckBox chkDone; + private CheckBox chkUnsure; + private Button bttnComment; + private ToolStripStatusLabel lblStatusProgress; + private Button bttnNextUntranslated; + private Button bttnNextUnsure; } } diff --git a/script-editor/MainForm.cs b/script-editor/MainForm.cs index 110eb61..fe1bcb0 100644 --- a/script-editor/MainForm.cs +++ b/script-editor/MainForm.cs @@ -6,13 +6,18 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; +using System.Xml; +using System.Xml.Serialization; +using tom; namespace VPScriptEditor { public partial class VPScriptEditor { private Pointer[] inputPtr, outputPtr; - private int currPointerNb; + private PointerAnnotation[] annotations; + private ITextDocument inDoc, outDoc; + private int currPointerNb, nbUndefinedPtr, nextUntranslatedPtr, nextUnsurePtr; private string outputFileName; private FontFile vpFont; private Bitmap conersBmp; @@ -26,40 +31,54 @@ namespace VPScriptEditor dfile.Close(); Stream imgStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VPScriptEditor.corners.png"); - if (imgStream == null) - throw new Exception("Can't open embedded image"); - + if (imgStream == null) throw new Exception("Can't open embedded image"); conersBmp = new Bitmap(imgStream); - this.ActiveControl = txtbxOutputPtr; + inDoc = getDocument(richEditInputPtr); + outDoc = getDocument(richEditOutputPtr); + + updateTitle(); + } + + [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)] + private extern static IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, out IntPtr lParam); + private const int WM_USER = 0x400, EM_GETOLEINTERFACE = WM_USER + 60; + private ITextDocument getDocument(RichTextBox rtb) + { + IntPtr iRichEditOle = IntPtr.Zero; + if (SendMessage(rtb.Handle, EM_GETOLEINTERFACE, 0, out iRichEditOle) == IntPtr.Zero) + throw new Exception("Can't access IRichEditOle object from RichTextBox"); + + return (ITextDocument)System.Runtime.InteropServices.Marshal.GetTypedObjectForIUnknown(iRichEditOle, typeof(tom.ITextDocument)); } private Pointer[] parseXML(String content) { Match match = Regex.Match(content.Replace("\r\n", "\n"), "^\\n*((?:.|\\n)*?)(?:\\n\\n)?\\n*$"); - if (!match.Success) - throw new Exception("Bad script format!"); + if (!match.Success) throw new Exception("Bad script format!"); MatchCollection matches = Regex.Matches(match.Groups[1].Value, "\\n(|)\\n((?:.|\\n)*?)(?=(?:\\n\\n|$))"); + if (matches.Count == 0) throw new Exception("Void script!"); Pointer[] pointers = new Pointer[matches.Count]; for (int i = 0; i < matches.Count; i++) { int nb = int.Parse(matches[i].Groups[1].Value); + if (nb <= 0 || nb > matches.Count) throw new Exception("Pointer no " + nb + " out of range!"); - if (nb <= 0 || nb > matches.Count) - throw new Exception("Pointer no " + nb + " out of range!"); - - if (pointers[nb - 1] != null) - throw new Exception("Duplicate pointer no " + nb); - + if (pointers[nb - 1] != null) throw new Exception("Duplicate pointer no " + nb); pointers[nb - 1] = new Pointer(matches[i].Groups[2].Value, matches[i].Groups[5].Value.Length > 0 ? WindowType.Normal : (matches[i].Groups[4].Value.Length > 0 ? WindowType.Fixed : WindowType.None), matches[i].Groups[5].Value, matches[i].Groups[6].Value, matches[i].Groups[7].Value, matches[i].Groups[8].Value, matches[i].Groups[9].Value); } return pointers; } + private string getAnnotationFileName(string filename) + { + return Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + ".annotation.xml"; + } + private void OpenMenuItem_Click(System.Object sender, System.EventArgs e) { StreamReader sr = null; @@ -72,31 +91,59 @@ namespace VPScriptEditor if (ofd.ShowDialog() != DialogResult.OK) return; - String origFileName = ofd.FileName; + String origFileName = ofd.FileName, outputFileName; sr = new StreamReader(ofd.OpenFile()); - inputPtr = parseXML(sr.ReadToEnd()); + Pointer[] inputPtr = parseXML(sr.ReadToEnd()); sr.Close(); ofd.Title = "Select *translated* script file"; while (true) - { if (ofd.ShowDialog() != DialogResult.OK) return; - - if ((outputFileName = ofd.FileName) == origFileName) - MessageBox.Show("Select a different file than the original script!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else - { - sr = new StreamReader(ofd.OpenFile()); - outputPtr = parseXML(sr.ReadToEnd()); - break; - } + if ((outputFileName = ofd.FileName) == origFileName) + MessageBox.Show("Select a different file than the original script!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + else + break; + + sr = new StreamReader(ofd.OpenFile()); + Pointer[] outputPtr = parseXML(sr.ReadToEnd()); + sr.Close(); + if (outputPtr.Length != inputPtr.Length) throw new Exception("The two scripts don't contain same number of pointers"); + + String annotationFileName = getAnnotationFileName(outputFileName); + PointerAnnotation[] annotations; + if (System.IO.File.Exists(annotationFileName)) + { + XmlSerializer serializer = new XmlSerializer(typeof(PointerAnnotation[])); + sr = new StreamReader(annotationFileName); + annotations = (PointerAnnotation[])serializer.Deserialize(sr); } + else + { + MessageBox.Show("No annotation file found for " + Path.GetFileName(outputFileName) + "\nA new one will be created on next save", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + annotations = new PointerAnnotation[inputPtr.Length]; + for (int i = 0; i < inputPtr.Length; i++) + annotations[i] = new PointerAnnotation(); + } + + this.inputPtr = inputPtr; + this.outputPtr = outputPtr; + this.outputFileName = outputFileName; + this.annotations = annotations; + + nbUndefinedPtr = 0; + foreach (PointerAnnotation pa in annotations) + if (pa.state == PointerState.Undefined) + nbUndefinedPtr++; + + toolStripStatusLabel1.Text = Path.GetFileName(outputFileName) + " successfully loaded"; } catch (Exception ex) { - MessageBox.Show(ex.Message); + MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; } finally { @@ -106,13 +153,64 @@ namespace VPScriptEditor initInterface(); } - public string[] getText(string input) + private void saveCurrentPointer() { - string input_new = Regex.Replace(Regex.Replace(input, "(.+?)", new MatchEvaluator(delegate(Match m) { return new String(m.Groups[2].Value[0], int.Parse(m.Groups[1].Value)); })), "<.+?/>", ""); - return Regex.Split(input_new, "\r\n"); + outputPtr[currPointerNb].setVars(inputPtr[currPointerNb].rooms, inputPtr[currPointerNb].type, txtbxOutputX.Text, txtbxOutputY.Text, txtbxOutputWidth.Text, txtbxOutputHeight.Text, richEditOutputPtr.Text.Replace("\r\n", "\n")); + annotations[currPointerNb].state = chkDone.Checked ? PointerState.Done : (chkUnsure.Checked ? PointerState.Unsure : PointerState.Undefined); + } + + private bool saveOutput(string fileName) + { + saveCurrentPointer(); + + StreamWriter sw = null; + try + { + StringBuilder str = new StringBuilder("\n\n"); + + for (int i = 0; i < outputPtr.Length; i++) + { + Pointer p = outputPtr[i]; + + str.Append("\n"); + if (p.type == WindowType.None) + str.Append(""); + else + if (p.type == WindowType.Fixed) + str.Append(""); + else + str.Append(""); + + str.Append("\n"); + str.Append(p.content.Replace("\r\n", "\n")); + str.Append("\n\n"); + } + + str.Append("\n"); + + sw = new StreamWriter(fileName); + sw.Write(str); + sw.Close(); + + XmlSerializer serializer = new XmlSerializer(typeof(PointerAnnotation[])); + sw = new StreamWriter(getAnnotationFileName(fileName)); + serializer.Serialize(sw, annotations); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + finally + { + if (sw != null) sw.Close(); + } + + toolStripStatusLabel1.Text = "Last save on " + DateTime.Now.ToString(); + return true; } - public void updateInputPtr() + private void updateInputPtr() { Pointer p = inputPtr[currPointerNb]; @@ -121,151 +219,141 @@ namespace VPScriptEditor txtbxInputY.Text = p.y; txtbxInputWidth.Text = p.width; txtbxInputHeight.Text = p.height; - txtbxInputPtr.Text = p.content.Replace("\n", "\r\n"); + richEditInputPtr.Text = p.content; } - public void updateOutputPtr() + private void updateOutputPtr() { Pointer p = outputPtr[currPointerNb]; - txtbxOutputX.Text = p.x; txtbxOutputY.Text = p.y; txtbxOutputWidth.Text = p.width; txtbxOutputHeight.Text = p.height; - txtbxOutputPtr.Text = p.content.Replace("\n", "\r\n"); + richEditOutputPtr.Text = p.content; + txtbxOutputX.Enabled = txtbxOutputY.Enabled = txtbxOutputWidth.Enabled = txtbxOutputHeight.Enabled = bttnResize.Enabled = p.type == WindowType.Normal; + + PointerState ps = annotations[currPointerNb].state; + chkDone.CheckedChanged -= this.chkbx_CheckedChanged; + chkDone.Checked = ps == PointerState.Done; + chkDone.CheckedChanged += this.chkbx_CheckedChanged; + chkUnsure.CheckedChanged -= this.chkbx_CheckedChanged; + chkUnsure.Checked = ps == PointerState.Unsure; + chkUnsure.CheckedChanged += this.chkbx_CheckedChanged; + } - bttnResize.Enabled = p.type == WindowType.Normal; + private void updateCommentBttn() + { + bttnComment.Text = annotations[currPointerNb].comment == null ? "Add comment" : "View/Edit comment"; } - public void updateInterface() + private void updateInterface() { + nextUntranslatedPtr = searchPointer(PointerState.Undefined); + nextUnsurePtr = searchPointer(PointerState.Unsure); + bttnNext.Enabled = currPointerNb < inputPtr.Length - 1; bttnPrevious.Enabled = currPointerNb > 0; + bttnNextUntranslated.Enabled = nextUntranslatedPtr != -1; + bttnNextUnsure.Enabled = nextUnsurePtr != -1; txtbxPointerNumber.Text = Convert.ToString(currPointerNb + 1); updateInputPtr(); updateOutputPtr(); + updateCommentBttn(); pnlInput.Invalidate(); pnlOutput.Invalidate(); } - public void updateTitle() + private void updateTitle() { - this.Text = "VPScriptEditor - " + Path.GetFileName(outputFileName); + this.Text = AboutBox.AssemblyProduct + (outputFileName != null ? " - " + Path.GetFileName(outputFileName) : ""); } - public void initInterface() + private void updateStatusProgress() + { + lblStatusProgress.Text = (inputPtr.Length - nbUndefinedPtr) + "/" + inputPtr.Length; + } + + private void initInterface() { currPointerNb = 0; - txtbxPointerNumber.Enabled = true; - bttnReset.Enabled = true; - SaveMenuItem.Enabled = SaveAsMenuItem.Enabled = true; + txtbxPointerNumber.Enabled = bttnReset.Enabled = SaveMenuItem.Enabled = SaveAsMenuItem.Enabled = chkDone.Enabled = chkUnsure.Enabled = bttnComment.Enabled = richEditOutputPtr.Enabled = true; updateInterface(); updateTitle(); - } + updateStatusProgress(); - private void bttnNext_Click(System.Object sender, System.EventArgs e) - { - saveCurrentPointer(); - ++currPointerNb; - updateInterface(); + ActiveControl = richEditOutputPtr; } - private void bttnPrevious_Click(System.Object sender, System.EventArgs e) + private int searchPointer(PointerState ps) { - saveCurrentPointer(); - --currPointerNb; - updateInterface(); - } + for (int i = 1; i < annotations.Length; i++) + if (annotations[(currPointerNb + i) % annotations.Length].state == ps) + return (currPointerNb + i) % annotations.Length; - private void bttnReset_Click(System.Object sender, System.EventArgs e) - { - outputPtr[currPointerNb] = new Pointer(inputPtr[currPointerNb]); - updateOutputPtr(); + return -1; } - private void ExitMenuItem_Click(System.Object sender, System.EventArgs e) + private void gotoPointer(int nb) { - Application.Exit(); + saveCurrentPointer(); + currPointerNb = nb; + updateInterface(); } - private void gotoPointer() + private void txtbxPointerNumber_KeyPress(object sender, KeyPressEventArgs e) { - saveCurrentPointer(); - - try + if (e.KeyChar == (char)Keys.Return) { - int nb = int.Parse(txtbxPointerNumber.Text); - if (nb > 0 && nb <= inputPtr.Length) - currPointerNb = nb - 1; + e.Handled = true; + int nb; + if (int.TryParse(txtbxPointerNumber.Text, out nb) && nb > 0 && nb <= inputPtr.Length) + gotoPointer(nb - 1); else { MessageBox.Show("Pointer out of range. Please enter a number between 1 and " + inputPtr.Length + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; + txtbxPointerNumber.Text = System.Convert.ToString(currPointerNb + 1); } } - catch (System.FormatException) - { - MessageBox.Show("Incorrect pointer number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - finally - { - txtbxPointerNumber.Text = System.Convert.ToString(currPointerNb + 1); - } - - updateInterface(); } - private bool saveOutputXML(string fileName) + private void bttnPrevious_Click(System.Object sender, System.EventArgs e) { - saveCurrentPointer(); - - StreamWriter sw = null; - try - { - StringBuilder str = new StringBuilder("\n\n"); - - for (int i = 0; i < outputPtr.Length; i++) - { - Pointer p = outputPtr[i]; + gotoPointer(currPointerNb - 1); + } - str.Append("\n"); - if (p.type == WindowType.None) - str.Append(""); - else - if (p.type == WindowType.Fixed) - str.Append(""); - else - str.Append(""); + private void bttnNext_Click(System.Object sender, System.EventArgs e) + { + gotoPointer(currPointerNb + 1); + } + + private void bttnNextUntranslated_Click(object sender, EventArgs e) + { + gotoPointer(nextUntranslatedPtr); + } - str.Append("\n"); - str.Append(p.content.Replace("\r\n", "\n")); - str.Append("\n\n"); - } + private void bttnNextUnsure_Click(object sender, EventArgs e) + { + gotoPointer(nextUnsurePtr); + } - str.Append("\n"); + private void bttnReset_Click(System.Object sender, System.EventArgs e) + { + outputPtr[currPointerNb].copyFrom(inputPtr[currPointerNb]); + chkDone.Checked = chkUnsure.Checked = false; + updateOutputPtr(); + } - sw = new StreamWriter(fileName); - sw.Write(str); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - return false; - } - finally - { - if (sw != null) sw.Close(); - } - return true; + private void ExitMenuItem_Click(System.Object sender, System.EventArgs e) + { + Application.Exit(); } private void SaveMenuItem_Click(System.Object sender, System.EventArgs e) { - saveOutputXML(outputFileName); + saveOutput(outputFileName); } private void SaveAsMenuItem_Click(object sender, EventArgs e) @@ -277,95 +365,89 @@ namespace VPScriptEditor if (sfd.ShowDialog() != DialogResult.OK) return; - if (saveOutputXML(sfd.FileName)) + if (saveOutput(sfd.FileName)) { outputFileName = sfd.FileName; updateTitle(); } } - public void saveCurrentPointer() + private void colorizeRichEdit(ITextDocument itd) { - outputPtr[currPointerNb] = new Pointer(inputPtr[currPointerNb].rooms, inputPtr[currPointerNb].type, txtbxOutputX.Text, txtbxOutputY.Text, txtbxOutputWidth.Text, txtbxOutputHeight.Text, txtbxOutputPtr.Text.Replace("\r\n", "\n")); - } + itd.Freeze(); + itd.Undo((int)tomConstants.tomSuspend); - private void bttnResize_Click(System.Object sender, System.EventArgs e) - { - String[] text = getText(txtbxOutputPtr.Text); - int w = 0, h = 0; + ITextRange r = itd.Range(0, 0); + r.MoveEnd((int)tomConstants.tomCharacter, r.StoryLength); + r.Font.ForeColor = 0; - for (int j = 0; j <= text.Length - 1; j++) + MatchCollection matches = Regex.Matches(r.Text, "<(.*?)/>"); + for (int i = 0; i < matches.Count; i++) { - int curr_w = 0; - - foreach (char ch in text[j]) - try - { - curr_w += vpFont.getSymbolWidth(ch); - } - catch (System.Collections.Generic.KeyNotFoundException ex) { } - - w = curr_w > w ? curr_w : w; - h += 14; + r.Start = matches[i].Groups[0].Index; + r.End = r.Start + matches[i].Groups[0].Length; + r.Font.ForeColor = 0xFF; } - txtbxOutputWidth.Text = System.Convert.ToString(w); - txtbxOutputHeight.Text = System.Convert.ToString(h); + itd.Undo((int)tomConstants.tomResume); + itd.Unfreeze(); + } - pnlOutput.Invalidate(); + private void parseScriptLines(string[] input, int a, int b) + { + for (int i = a; i < b; i++) + input[i] = Regex.Replace(Regex.Replace(input[i], "(.+?)", new MatchEvaluator(delegate(Match m) { return new String(m.Groups[2].Value[0], int.Parse(m.Groups[1].Value)); })), "<.+?/>", ""); } - private Bitmap drawPointer(String[] text, string xStr, string yStr, string wStr, string hStr) + private static bool isNewTag(String s) { return s == ""; } + + private Bitmap drawPointer(RichTextBox rtb, string xStr, string yStr, string wStr, string hStr) { + String[] text = Regex.Split(rtb.Text, "\n"); + int currLineNb = Regex.Matches(rtb.Text.Substring(0, rtb.SelectionStart), "\\n").Count; + + int begLineNb = Array.FindLastIndex(text, currLineNb, isNewTag) + 1, endLineNb = Array.FindIndex(text, currLineNb + 1, isNewTag); + if (endLineNb < 0) endLineNb = text.Length; + parseScriptLines(text, begLineNb, endLineNb); + Bitmap bmp = new Bitmap(320, 240, PixelFormat.Format32bppArgb); Graphics gBmp = Graphics.FromImage(bmp); gBmp.CompositingMode = CompositingMode.SourceOver; gBmp.FillRectangle(Brushes.White, 0, 0, bmp.Width, bmp.Height); - int x_base, x_curr, y_curr; + int x_base, y_curr, h, w; - try - { - x_base = x_curr = int.Parse(xStr); - y_curr = int.Parse(yStr); - } - catch (System.FormatException e) - { - x_curr = x_base = y_curr = 10; - } + if (!int.TryParse(xStr, out x_base) || !int.TryParse(yStr, out y_curr)) + x_base = y_curr = 10; - try + if (int.TryParse(wStr, out w) && int.TryParse(hStr, out h)) { - int h = int.Parse(hStr), w = int.Parse(wStr); - SolidBrush innerBrush = new SolidBrush(Color.FromArgb(248, 216, 96)), outerBrush = new SolidBrush(Color.FromArgb(88, 64, 8)); - - gBmp.FillRectangle(outerBrush, x_curr - 8, y_curr, 1, h); - gBmp.FillRectangle(innerBrush, x_curr - 7, y_curr, 2, h); - gBmp.FillRectangle(outerBrush, x_curr - 2, y_curr - 7, w + 5, 1); - gBmp.FillRectangle(innerBrush, x_curr - 2, y_curr - 6, w + 5, 2); - gBmp.FillRectangle(outerBrush, x_curr + w + 9, y_curr, 1, h); - gBmp.FillRectangle(innerBrush, x_curr + w + 7, y_curr, 2, h); - gBmp.FillRectangle(outerBrush, x_curr - 2, y_curr + h + 6, w + 5, 1); - gBmp.FillRectangle(innerBrush, x_curr - 2, y_curr + h + 4, w + 5, 2); - - gBmp.DrawImage(conersBmp, x_curr - 8, y_curr - 7, new Rectangle(0, 0, 7, 7), GraphicsUnit.Pixel); - gBmp.DrawImage(conersBmp, x_curr - 8, y_curr + h, new Rectangle(0, 7, 7, 7), GraphicsUnit.Pixel); - gBmp.DrawImage(conersBmp, x_curr + w + 3, y_curr - 7, new Rectangle(7, 0, 7, 7), GraphicsUnit.Pixel); - gBmp.DrawImage(conersBmp, x_curr + w + 3, y_curr + h, new Rectangle(7, 7, 7, 7), GraphicsUnit.Pixel); + gBmp.FillRectangle(outerBrush, x_base - 8, y_curr, 1, h); + gBmp.FillRectangle(innerBrush, x_base - 7, y_curr, 2, h); + gBmp.FillRectangle(outerBrush, x_base - 2, y_curr - 7, w + 5, 1); + gBmp.FillRectangle(innerBrush, x_base - 2, y_curr - 6, w + 5, 2); + gBmp.FillRectangle(outerBrush, x_base + w + 9, y_curr, 1, h); + gBmp.FillRectangle(innerBrush, x_base + w + 7, y_curr, 2, h); + gBmp.FillRectangle(outerBrush, x_base - 2, y_curr + h + 6, w + 5, 1); + gBmp.FillRectangle(innerBrush, x_base - 2, y_curr + h + 4, w + 5, 2); + + gBmp.DrawImage(conersBmp, x_base - 8, y_curr - 7, new Rectangle(0, 0, 7, 7), GraphicsUnit.Pixel); + gBmp.DrawImage(conersBmp, x_base - 8, y_curr + h, new Rectangle(0, 7, 7, 7), GraphicsUnit.Pixel); + gBmp.DrawImage(conersBmp, x_base + w + 3, y_curr - 7, new Rectangle(7, 0, 7, 7), GraphicsUnit.Pixel); + gBmp.DrawImage(conersBmp, x_base + w + 3, y_curr + h, new Rectangle(7, 7, 7, 7), GraphicsUnit.Pixel); } - catch (System.FormatException e) { } - for (int j = 0; j <= text.Length - 1; j++) + int x_curr = x_base; + for (int j = begLineNb; j < endLineNb; j++) { foreach (char ch in text[j]) - try + if (vpFont.containsSymbol(ch)) { gBmp.DrawImage(vpFont.getBitmap(ch), x_curr, y_curr); x_curr += vpFont.getSymbolWidth(ch); } - catch (System.Collections.Generic.KeyNotFoundException e) { } x_curr = x_base; y_curr += 14; @@ -376,35 +458,131 @@ namespace VPScriptEditor private void pnlInput_Paint(object sender, PaintEventArgs e) { - e.Graphics.DrawImage(drawPointer(getText(txtbxInputPtr.Text), txtbxInputX.Text, txtbxInputY.Text, txtbxInputWidth.Text, txtbxInputHeight.Text), 0, 0); + e.Graphics.DrawImage(drawPointer(richEditInputPtr, txtbxInputX.Text, txtbxInputY.Text, txtbxInputWidth.Text, txtbxInputHeight.Text), 0, 0); } private void pnlOutput_Paint(object sender, PaintEventArgs e) { - e.Graphics.DrawImage(drawPointer(getText(txtbxOutputPtr.Text), txtbxOutputX.Text, txtbxOutputY.Text, txtbxOutputWidth.Text, txtbxOutputHeight.Text), 0, 0); + e.Graphics.DrawImage(drawPointer(richEditOutputPtr, txtbxOutputX.Text, txtbxOutputY.Text, txtbxOutputWidth.Text, txtbxOutputHeight.Text), 0, 0); } - private void txtbxOutput_TextChanged(object sender, EventArgs e) + private void richEdit_SelectionChanged(object sender, EventArgs e) + { + ((RichTextBox)sender == richEditInputPtr ? pnlInput : pnlOutput).Invalidate(); + } + + private void richEditInputPtr_TextChanged(object sender, EventArgs e) + { + colorizeRichEdit(inDoc); + } + + private void richEditOutputPtr_SelectionChanged(object sender, EventArgs e) { pnlOutput.Invalidate(); } - private void txtbxPointerNumber_KeyPress(object sender, KeyPressEventArgs e) + private void richEditOutputPtr_TextChanged(object sender, EventArgs e) { - if (e.KeyChar == (char)Keys.Return) + colorizeRichEdit(outDoc); + // simple trick to circumvent a stupid vertical scroll bug + richEditOutputPtr.SelectionStart = richEditOutputPtr.SelectionStart; + } + + private void richEditOutputPtr_KeyDown(object sender, KeyEventArgs e) + { + if ((e.Shift && e.KeyCode == Keys.Insert) || (e.Control && e.KeyCode == Keys.V)) { + richEditOutputPtr.Paste(DataFormats.GetFormat("Text")); e.Handled = true; - gotoPointer(); } + else + if ((e.Modifiers == Keys.None || e.Modifiers == Keys.Control) && e.KeyCode == Keys.Delete) + pnlOutput.Invalidate(); } - private void txtbxOutputPtr_KeyPress(object sender, KeyPressEventArgs e) + private void richEditOutputPtr_KeyPress(object sender, KeyPressEventArgs e) { - if (!vpFont.containsSymbol(e.KeyChar) && e.KeyChar >= ' ') + if (e.KeyChar >= ' ' && e.KeyChar != (char)Keys.F16 && !vpFont.containsSymbol(e.KeyChar)) { e.Handled = true; System.Media.SystemSounds.Beep.Play(); } } + + private void bttnResize_Click(System.Object sender, System.EventArgs e) + { + String[] text = Regex.Split(richEditOutputPtr.Text, "\n"); + int w = 0, h = 0, curr_h = 0; + + for (int j = 0; j < text.Length; j++) + if (isNewTag(text[j])) + { + h = Math.Max(curr_h, h); + curr_h = 0; + } + else + { + int curr_w = 0; + parseScriptLines(text, j, j + 1); + + foreach (char ch in text[j]) + if (vpFont.containsSymbol(ch)) + curr_w += vpFont.getSymbolWidth(ch); + + w = Math.Max(curr_w, w); + curr_h += 14; + } + + h = Math.Max(curr_h, h); + + txtbxOutputWidth.Text = System.Convert.ToString(w); + txtbxOutputHeight.Text = System.Convert.ToString(h); + + pnlOutput.Invalidate(); + } + + private void chkbx_CheckedChanged(object sender, EventArgs e) + { + CheckBox chk = (CheckBox)sender, chk2 = chk == chkDone ? chkUnsure : chkDone; + if (chk.Checked && chk2.Checked) + { + nbUndefinedPtr++; + chk2.Checked = false; + } + else + { + nbUndefinedPtr += (!chkDone.Checked && !chkUnsure.Checked ? 1 : -1); + updateStatusProgress(); + } + } + + private void bttnComment_Click(object sender, EventArgs e) + { + CommentForm cf = new CommentForm(currPointerNb, annotations[currPointerNb].comment); + cf.ShowDialog(); + annotations[currPointerNb].comment = cf.Comment; + updateCommentBttn(); + } + + private void txtbxOutput_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == (char)Keys.Return) + { + e.Handled = true; + pnlOutput.Invalidate(); + } + } + + private void wordWarpToolStripMenuItem_CheckedChanged(object sender, EventArgs e) + { + richEditInputPtr.WordWrap = richEditOutputPtr.WordWrap = ((ToolStripMenuItem)sender).Checked; + inDoc = getDocument(richEditInputPtr); + outDoc = getDocument(richEditOutputPtr); + } + + private void aboutToolStripMenuItem1_Click(object sender, EventArgs e) + { + new AboutBox().ShowDialog(); + } } } \ No newline at end of file diff --git a/script-editor/MainForm.resx b/script-editor/MainForm.resx index a35674e..512b0e8 100644 --- a/script-editor/MainForm.resx +++ b/script-editor/MainForm.resx @@ -120,6 +120,9 @@ 22, 26 + + 105, 26 + diff --git a/script-editor/MyPanel.cs b/script-editor/MyPanel.cs deleted file mode 100644 index 60d7a7b..0000000 --- a/script-editor/MyPanel.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Windows.Forms; - -namespace CustomControl -{ - public class MyPanel : Panel - { - protected override void OnPaintBackground(PaintEventArgs pevent) - { - } - } -} diff --git a/script-editor/Pointer.cs b/script-editor/Pointer.cs index 73a050c..24aa7d9 100644 --- a/script-editor/Pointer.cs +++ b/script-editor/Pointer.cs @@ -1,9 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Xml.Serialization; namespace VPScriptEditor { + public enum PointerState { Undefined, Unsure, Done }; + + public class PointerAnnotation + { + [XmlElement("State")] + public PointerState state; + [XmlElement("Comment")] + public string comment; + + public PointerAnnotation() : this(PointerState.Undefined, null) { } + + public PointerAnnotation(PointerState state, string comment) + { + this.state = state; + this.comment = comment; + } + } + public enum WindowType { Normal, Fixed, None }; public class Pointer @@ -11,9 +27,17 @@ namespace VPScriptEditor public string rooms, x, y, width, height, content; public WindowType type; - public Pointer(Pointer p) : this(p.rooms, p.type, p.x, p.y, p.width, p.height, p.content) { } - public Pointer(string rooms, WindowType type, string x, string y, string width, string height, string content) + { + setVars(rooms, type, x, y, width, height, content); + } + + public void copyFrom(Pointer p) + { + setVars(p.rooms, p.type, p.x, p.y, p.width, p.height, p.content); + } + + public void setVars(string rooms, WindowType type, string x, string y, string width, string height, string content) { this.rooms = rooms; this.type = type; diff --git a/script-editor/Properties/AssemblyInfo.cs b/script-editor/Properties/AssemblyInfo.cs index dc2b223..c29719e 100644 --- a/script-editor/Properties/AssemblyInfo.cs +++ b/script-editor/Properties/AssemblyInfo.cs @@ -17,7 +17,7 @@ using System.Windows.Forms; [ assembly: AssemblyDescription( "" ) ] [ assembly: AssemblyCompany( "" ) ] [ assembly: AssemblyProduct( "VPScriptEditor" ) ] -[ assembly: AssemblyCopyright( "Copyright © 2009" ) ] +[assembly: AssemblyCopyright("Copyright (C) 2009 Jes, Pixel, Vadd_VII")] [ assembly: AssemblyTrademark( "" ) ] [ assembly: ComVisible( false ) ] @@ -36,6 +36,6 @@ using System.Windows.Forms; // en utilisant '*', comme indiqué ci-dessous : // -[ assembly: AssemblyVersion( "1.0.0.0" ) ] +[assembly: AssemblyVersion("0.8.0.*")] [ assembly: AssemblyFileVersion( "1.0.0.0" ) ] diff --git a/script-editor/VPScriptEditor_CS.csproj b/script-editor/VPScriptEditor_CS.csproj index 2b8c394..e155850 100644 --- a/script-editor/VPScriptEditor_CS.csproj +++ b/script-editor/VPScriptEditor_CS.csproj @@ -67,7 +67,19 @@ - + + Form + + + AboutBox.cs + + + Form + + + CommentForm.cs + + Component @@ -99,6 +111,12 @@ + + AboutBox.cs + + + CommentForm.cs + MainForm.cs @@ -118,4 +136,14 @@ true + + + {8CC497C9-A1DF-11CE-8098-00AA0047BE5D} + 1 + 0 + 0 + tlbimp + False + + \ No newline at end of file -- cgit v1.2.3