From 49b3d926ea33f486468f0bc855585968eacca124 Mon Sep 17 00:00:00 2001 From: Jes Date: Wed, 6 Jan 2010 23:39:02 +0100 Subject: Ajout des sources de l'éditeur de script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-editor/FontFile.cs | 117 ++++++ script-editor/MainForm.Designer.cs | 504 +++++++++++++++++++++++++ script-editor/MainForm.cs | 410 ++++++++++++++++++++ script-editor/MainForm.resx | 200 ++++++++++ script-editor/MyPanel.cs | 11 + script-editor/Pointer.cs | 34 ++ script-editor/Program.cs | 25 ++ script-editor/Properties/AssemblyInfo.cs | 41 ++ script-editor/Properties/Resources.Designer.cs | 63 ++++ script-editor/Properties/Resources.resx | 117 ++++++ script-editor/Properties/Settings.Designer.cs | 26 ++ script-editor/Properties/Settings.settings | 7 + script-editor/VPIcon.ico | Bin 0 -> 9662 bytes script-editor/VPScriptEditor_CS.csproj | 121 ++++++ script-editor/VPScriptEditor_CS.sln | 20 + script-editor/corners.png | Bin 0 -> 300 bytes 16 files changed, 1696 insertions(+) create mode 100644 script-editor/FontFile.cs create mode 100644 script-editor/MainForm.Designer.cs create mode 100644 script-editor/MainForm.cs create mode 100644 script-editor/MainForm.resx create mode 100644 script-editor/MyPanel.cs create mode 100644 script-editor/Pointer.cs create mode 100644 script-editor/Program.cs create mode 100644 script-editor/Properties/AssemblyInfo.cs create mode 100644 script-editor/Properties/Resources.Designer.cs create mode 100644 script-editor/Properties/Resources.resx create mode 100644 script-editor/Properties/Settings.Designer.cs create mode 100644 script-editor/Properties/Settings.settings create mode 100644 script-editor/VPIcon.ico create mode 100644 script-editor/VPScriptEditor_CS.csproj create mode 100644 script-editor/VPScriptEditor_CS.sln create mode 100644 script-editor/corners.png diff --git a/script-editor/FontFile.cs b/script-editor/FontFile.cs new file mode 100644 index 0000000..8bbf61e --- /dev/null +++ b/script-editor/FontFile.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Xml; + +namespace VPScriptEditor +{ + public class FontFile + { + private Dictionary data; + private Symbol[] glyphs; + private Bitmap[] bitmaps; + + private class Symbol + { + private bool[,] data; + private int width; + private char text; + + public char getText() + { + return text; + } + + public bool getXY(int x, int y) + { + return data[x, y]; + } + + public int getWidth() + { + return width; + } + + public Symbol(XmlAttributeCollection attrs) + { + data = new bool[12, 12]; + + for (int i = 0; i < attrs.Count; i++) + { + switch (attrs[i].Name) + { + case "Width": + width = int.Parse(attrs[i].Value); + break; + + case "Data": + byte[] bdata = Convert.FromBase64String(attrs[i].Value); + + for (int y = 0; y < 12; y++) + { + int curr = bdata[y * 2 + 1] * 256 + bdata[y * 2]; + for (int x = 0; x < 12; x++) + if ((curr & (0x8000 >> x)) > 0) + data[x, y] = true; + else + data[x, y] = false; + } + + break; + + case "Text": + if (attrs[i].Value.Length != 1) + throw new Exception("Invalid database"); + + text = attrs[i].Value[0]; + break; + + default: + throw new Exception(("Wrong Font XML Format - Unknown attribute: " + attrs[i].Name)); + } + + } + } + } + + public FontFile(System.IO.StreamReader file, Color color) + { + XmlDocument fontXml = new XmlDocument(); + fontXml.Load(file); + XmlNodeList fontNode = fontXml.GetElementsByTagName("Symbol"); + glyphs = new Symbol[fontNode.Count + 1]; + bitmaps = new Bitmap[fontNode.Count + 1]; + data = new Dictionary(); + for (int i = 0; i < fontNode.Count; i++) + { + glyphs[i] = new Symbol(fontNode[i].Attributes); + data.Add(glyphs[i].getText(), i); + bitmaps[i] = new Bitmap(glyphs[i].getWidth(), 12); + for (int y = 0; y < 12; y++) + for (int x = 0; x < glyphs[i].getWidth(); x++) + if (glyphs[i].getXY(x, y)) + bitmaps[i].SetPixel(x, y, color); + } + } + + public bool containsSymbol(char symbol) + { + return data.ContainsKey(symbol); + } + + public int getSymbolWidth(char symbol) + { + return glyphs[data[symbol]].getWidth(); + } + + public bool getSymbolXY(char symbol, int x, int y) + { + return glyphs[data[symbol]].getXY(x, y); + } + + public Bitmap getBitmap(char symbol) + { + return bitmaps[data[symbol]]; + } + } +} \ No newline at end of file diff --git a/script-editor/MainForm.Designer.cs b/script-editor/MainForm.Designer.cs new file mode 100644 index 0000000..ee72599 --- /dev/null +++ b/script-editor/MainForm.Designer.cs @@ -0,0 +1,504 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +namespace VPScriptEditor +{ + partial class VPScriptEditor : Form + { + [ System.Diagnostics.DebuggerNonUserCode() ] + protected override void Dispose( bool disposing ) + { + try + { + if ( disposing && components != null ) + { + components.Dispose(); + } + } + finally + { + base.Dispose( disposing ); + } + } + + private System.ComponentModel.IContainer components; + + [ System.Diagnostics.DebuggerStepThrough() ] + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VPScriptEditor)); + this.lblPointerNumber = new System.Windows.Forms.Label(); + this.txtbxRoom = new System.Windows.Forms.TextBox(); + this.lblRoom = new System.Windows.Forms.Label(); + 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.lblInputX = new System.Windows.Forms.Label(); + this.grpbxOutput = new System.Windows.Forms.GroupBox(); + this.bttnResize = new System.Windows.Forms.Button(); + 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.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.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.pnlInput = new CustomControl.MyPanel(); + this.grpbxInput.SuspendLayout(); + this.grpbxOutput.SuspendLayout(); + this.menu.SuspendLayout(); + this.SuspendLayout(); + // + // lblPointerNumber + // + this.lblPointerNumber.AutoSize = true; + this.lblPointerNumber.Location = new System.Drawing.Point(6, 16); + this.lblPointerNumber.Name = "lblPointerNumber"; + this.lblPointerNumber.Size = new System.Drawing.Size(46, 13); + this.lblPointerNumber.TabIndex = 1; + this.lblPointerNumber.Text = "Pointer :"; + // + // txtbxRoom + // + this.txtbxRoom.BackColor = System.Drawing.SystemColors.Window; + this.txtbxRoom.Location = new System.Drawing.Point(371, 40); + this.txtbxRoom.Name = "txtbxRoom"; + this.txtbxRoom.ReadOnly = true; + this.txtbxRoom.Size = new System.Drawing.Size(100, 20); + this.txtbxRoom.TabIndex = 7; + // + // lblRoom + // + this.lblRoom.AutoSize = true; + this.lblRoom.Location = new System.Drawing.Point(324, 43); + this.lblRoom.Name = "lblRoom"; + this.lblRoom.Size = new System.Drawing.Size(41, 13); + this.lblRoom.TabIndex = 3; + this.lblRoom.Text = "Room :"; + // + // txtbxPointerNumber + // + this.txtbxPointerNumber.Enabled = false; + this.txtbxPointerNumber.Location = new System.Drawing.Point(58, 13); + this.txtbxPointerNumber.MaxLength = 4; + this.txtbxPointerNumber.Name = "txtbxPointerNumber"; + this.txtbxPointerNumber.Size = new System.Drawing.Size(37, 20); + this.txtbxPointerNumber.TabIndex = 0; + this.txtbxPointerNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtbxPointerNumber_KeyPress); + // + // bttnPrevious + // + 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.Name = "bttnPrevious"; + this.bttnPrevious.Size = new System.Drawing.Size(30, 20); + this.bttnPrevious.TabIndex = 1; + this.bttnPrevious.Text = "←"; + this.bttnPrevious.UseVisualStyleBackColor = true; + this.bttnPrevious.Click += new System.EventHandler(this.bttnPrevious_Click); + // + // bttnNext + // + 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.Name = "bttnNext"; + this.bttnNext.Size = new System.Drawing.Size(30, 20); + this.bttnNext.TabIndex = 2; + 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.Name = "grpbxInput"; + this.grpbxInput.Size = new System.Drawing.Size(608, 246); + this.grpbxInput.TabIndex = 1; + this.grpbxInput.TabStop = false; + this.grpbxInput.Text = "Original text"; + // + // txtbxInputHeight + // + 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 + // + 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 :"; + // + // txtbxInputWidth + // + 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; + // + // lblInputWidth + // + 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 :"; + // + // txtbxInputY + // + this.txtbxInputY.BackColor = System.Drawing.SystemColors.Window; + this.txtbxInputY.Location = new System.Drawing.Point(118, 40); + this.txtbxInputY.Name = "txtbxInputY"; + this.txtbxInputY.ReadOnly = true; + this.txtbxInputY.Size = new System.Drawing.Size(30, 20); + this.txtbxInputY.TabIndex = 4; + // + // lblInputY + // + 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 :"; + // + // txtbxInputX + // + 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; + // + // lblInputX + // + 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 :"; + // + // 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.Name = "grpbxOutput"; + this.grpbxOutput.Size = new System.Drawing.Size(608, 246); + this.grpbxOutput.TabIndex = 0; + 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); + // + // bttnReset + // + this.bttnReset.Enabled = false; + this.bttnReset.Location = new System.Drawing.Point(304, 13); + this.bttnReset.Name = "bttnReset"; + this.bttnReset.Size = new System.Drawing.Size(87, 20); + this.bttnReset.TabIndex = 4; + 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); + // + // txtbxOutputY + // + 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); + // + // lblOutputX + // + this.lblOutputX.AutoSize = true; + this.lblOutputX.Location = new System.Drawing.Point(11, 16); + 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.Name = "txtbxOutputX"; + this.txtbxOutputX.Size = new System.Drawing.Size(30, 20); + this.txtbxOutputX.TabIndex = 0; + this.txtbxOutputX.TextChanged += new System.EventHandler(this.txtbxOutput_TextChanged); + // + // lblOutputY + // + this.lblOutputY.AutoSize = true; + this.lblOutputY.Location = new System.Drawing.Point(73, 16); + this.lblOutputY.Name = "lblOutputY"; + this.lblOutputY.Size = new System.Drawing.Size(20, 13); + this.lblOutputY.TabIndex = 19; + this.lblOutputY.Text = "Y :"; + // + // tsmiTest + // + this.tsmiTest.AutoToolTip = true; + this.tsmiTest.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.tsmiTest.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"; + // + // OpenMenuItem + // + this.OpenMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + 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.Text = "&Open"; + this.OpenMenuItem.Click += new System.EventHandler(this.OpenMenuItem_Click); + // + // SaveMenuItem + // + this.SaveMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + 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.Text = "&Save"; + this.SaveMenuItem.Click += new System.EventHandler(this.SaveMenuItem_Click); + // + // SaveAsMenuItem + // + 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.Text = "S&ave as"; + this.SaveAsMenuItem.Click += new System.EventHandler(this.SaveAsMenuItem_Click); + // + // ExitMenuItem + // + this.ExitMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.ExitMenuItem.Name = "ExitMenuItem"; + this.ExitMenuItem.Size = new System.Drawing.Size(152, 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.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.TabIndex = 5; + this.menu.Text = "MenuStrip1"; + // + // pnlOutput + // + 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); + // + // pnlInput + // + this.pnlInput.Location = new System.Drawing.Point(632, 33); + 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); + // + // 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.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.grpbxOutput.ResumeLayout(false); + this.grpbxOutput.PerformLayout(); + this.menu.ResumeLayout(false); + this.menu.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + private Label lblPointerNumber; + private TextBox txtbxRoom; + private Label lblRoom; + private TextBox txtbxPointerNumber; + private Button bttnPrevious; + private Button bttnNext; + private TextBox txtbxInputPtr; + private GroupBox grpbxInput; + private GroupBox grpbxOutput; + private TextBox txtbxOutputPtr; + private Label lblInputX; + private TextBox txtbxInputX; + private TextBox txtbxInputY; + private Label lblInputY; + private TextBox txtbxInputHeight; + private Label lblInputHeight; + private TextBox txtbxInputWidth; + private Label lblInputWidth; + private TextBox txtbxOutputHeight; + private Label lblOutputHeight; + private TextBox txtbxOutputWidth; + private TextBox txtbxOutputY; + private Label lblOutputX; + private Label lblOutputWidth; + private TextBox txtbxOutputX; + private Label lblOutputY; + private Button bttnReset; + private Button bttnResize; + private CustomControl.MyPanel pnlInput; + private CustomControl.MyPanel pnlOutput; + private ToolStripMenuItem tsmiTest; + private ToolStripMenuItem OpenMenuItem; + private ToolStripMenuItem SaveMenuItem; + private ToolStripMenuItem ExitMenuItem; + private MenuStrip menu; + private ToolStripMenuItem SaveAsMenuItem; + + } +} diff --git a/script-editor/MainForm.cs b/script-editor/MainForm.cs new file mode 100644 index 0000000..110eb61 --- /dev/null +++ b/script-editor/MainForm.cs @@ -0,0 +1,410 @@ +using System; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Windows.Forms; + +namespace VPScriptEditor +{ + public partial class VPScriptEditor + { + private Pointer[] inputPtr, outputPtr; + private int currPointerNb; + private string outputFileName; + private FontFile vpFont; + private Bitmap conersBmp; + + public VPScriptEditor() + { + InitializeComponent(); + + StreamReader dfile = System.IO.File.OpenText(System.Windows.Forms.Application.StartupPath + @"\database\VP-database.xml"); + vpFont = new FontFile(dfile, Color.Black); + dfile.Close(); + + Stream imgStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("VPScriptEditor.corners.png"); + if (imgStream == null) + throw new Exception("Can't open embedded image"); + + conersBmp = new Bitmap(imgStream); + + this.ActiveControl = txtbxOutputPtr; + } + + 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!"); + + MatchCollection matches = Regex.Matches(match.Groups[1].Value, "\\n(|)\\n((?:.|\\n)*?)(?=(?:\\n\\n|$))"); + + 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 (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 void OpenMenuItem_Click(System.Object sender, System.EventArgs e) + { + StreamReader sr = null; + + try + { + OpenFileDialog ofd = new OpenFileDialog(); + ofd.Title = "Select *original* script file"; + ofd.Filter = "Valkyrie Profile script files (*.xml)|*.xml|" + "All files|*.*"; + if (ofd.ShowDialog() != DialogResult.OK) + return; + + String origFileName = ofd.FileName; + sr = new StreamReader(ofd.OpenFile()); + 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; + } + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message); + } + finally + { + if (sr != null) sr.Close(); + } + + initInterface(); + } + + public string[] getText(string input) + { + 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"); + } + + public void updateInputPtr() + { + Pointer p = inputPtr[currPointerNb]; + + txtbxRoom.Text = p.rooms; + txtbxInputX.Text = p.x; + txtbxInputY.Text = p.y; + txtbxInputWidth.Text = p.width; + txtbxInputHeight.Text = p.height; + txtbxInputPtr.Text = p.content.Replace("\n", "\r\n"); + } + + public 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"); + + bttnResize.Enabled = p.type == WindowType.Normal; + } + + public void updateInterface() + { + bttnNext.Enabled = currPointerNb < inputPtr.Length - 1; + bttnPrevious.Enabled = currPointerNb > 0; + + txtbxPointerNumber.Text = Convert.ToString(currPointerNb + 1); + + updateInputPtr(); + updateOutputPtr(); + pnlInput.Invalidate(); + pnlOutput.Invalidate(); + } + + public void updateTitle() + { + this.Text = "VPScriptEditor - " + Path.GetFileName(outputFileName); + } + + public void initInterface() + { + currPointerNb = 0; + txtbxPointerNumber.Enabled = true; + bttnReset.Enabled = true; + SaveMenuItem.Enabled = SaveAsMenuItem.Enabled = true; + + updateInterface(); + updateTitle(); + } + + private void bttnNext_Click(System.Object sender, System.EventArgs e) + { + saveCurrentPointer(); + ++currPointerNb; + updateInterface(); + } + + private void bttnPrevious_Click(System.Object sender, System.EventArgs e) + { + saveCurrentPointer(); + --currPointerNb; + updateInterface(); + } + + private void bttnReset_Click(System.Object sender, System.EventArgs e) + { + outputPtr[currPointerNb] = new Pointer(inputPtr[currPointerNb]); + updateOutputPtr(); + } + + private void ExitMenuItem_Click(System.Object sender, System.EventArgs e) + { + Application.Exit(); + } + + private void gotoPointer() + { + saveCurrentPointer(); + + try + { + int nb = int.Parse(txtbxPointerNumber.Text); + if (nb > 0 && nb <= inputPtr.Length) + currPointerNb = nb - 1; + else + { + MessageBox.Show("Pointer out of range. Please enter a number between 1 and " + inputPtr.Length + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + return; + } + } + 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) + { + 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); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + finally + { + if (sw != null) sw.Close(); + } + return true; + } + + private void SaveMenuItem_Click(System.Object sender, System.EventArgs e) + { + saveOutputXML(outputFileName); + } + + private void SaveAsMenuItem_Click(object sender, EventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Title = "Save as"; + sfd.Filter = "Valkyrie Profile script files (*.xml)|*.xml|" + "All files|*.*"; + + if (sfd.ShowDialog() != DialogResult.OK) + return; + + if (saveOutputXML(sfd.FileName)) + { + outputFileName = sfd.FileName; + updateTitle(); + } + } + + public void saveCurrentPointer() + { + outputPtr[currPointerNb] = new Pointer(inputPtr[currPointerNb].rooms, inputPtr[currPointerNb].type, txtbxOutputX.Text, txtbxOutputY.Text, txtbxOutputWidth.Text, txtbxOutputHeight.Text, txtbxOutputPtr.Text.Replace("\r\n", "\n")); + } + + private void bttnResize_Click(System.Object sender, System.EventArgs e) + { + String[] text = getText(txtbxOutputPtr.Text); + int w = 0, h = 0; + + for (int j = 0; j <= text.Length - 1; j++) + { + 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; + } + + txtbxOutputWidth.Text = System.Convert.ToString(w); + txtbxOutputHeight.Text = System.Convert.ToString(h); + + pnlOutput.Invalidate(); + } + + private Bitmap drawPointer(String[] text, string xStr, string yStr, string wStr, string hStr) + { + 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; + + try + { + x_base = x_curr = int.Parse(xStr); + y_curr = int.Parse(yStr); + } + catch (System.FormatException e) + { + x_curr = x_base = y_curr = 10; + } + + try + { + 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); + } + catch (System.FormatException e) { } + + for (int j = 0; j <= text.Length - 1; j++) + { + foreach (char ch in text[j]) + try + { + 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; + } + + return bmp; + } + + 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); + } + + 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); + } + + private void txtbxOutput_TextChanged(object sender, EventArgs e) + { + pnlOutput.Invalidate(); + } + + private void txtbxPointerNumber_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == (char)Keys.Return) + { + e.Handled = true; + gotoPointer(); + } + } + + private void txtbxOutputPtr_KeyPress(object sender, KeyPressEventArgs e) + { + if (!vpFont.containsSymbol(e.KeyChar) && e.KeyChar >= ' ') + { + e.Handled = true; + System.Media.SystemSounds.Beep.Play(); + } + } + } +} \ No newline at end of file diff --git a/script-editor/MainForm.resx b/script-editor/MainForm.resx new file mode 100644 index 0000000..a35674e --- /dev/null +++ b/script-editor/MainForm.resx @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + 22, 26 + + + + + AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wC9wPYAvcD2AL7B9gC5vPUApajzAKCs9ACSofIAmqXyAJuj8gB1kvAEZo7vKF+I + 7lo/fux/OYDsoDJ97aBAg+2fSYTugFeD7VFtje8jiZzxBoih8gCXqPMAmKbyAKuv9QCpr/QAs7X1ALa3 + 9gC2t/YAtrf2ALa39gC2t/YA////AL3A9gC9wPYAvsH2ALm89QClqPMAn6z0AJOh8gCkqPICgpvxOkaC + 7ZEveuzaQofu/V2X8P93pvL/f6zz/3Cm8v9WmPD/RIvu+TJ769dPh+2OfJ7yOaGr8wCZpfIAq6/1AKmv + 9ACztfUAtrf2ALa39gC2t/YAtrf2ALa39gD///8AvcD2AL3A9gC+wfYAubv1AKWo8wCnr/QAjaDzHlCK + 7qAvfez3cqDy/8DR+P/s7P3///7//+f0/v+MxPb/a6/y/zqU7v9xs/P/v9L4/26d8f8wfuz0VI7unpun + 8h2xsPUAqK/0ALO19QC2t/YAtrf2ALa39gC2t/YAtrf2AP///wC9wPYAvcD2AL7B9gC5vPUAqqnzAIuk + 8lAxf+3jY5jw/9rg+//////////////////a8P3/Lafx/wCY7v8Sku7/MZ/w/xWM7f/O6Pz//////9ve + +/9flfD/L3zt3JKn80OwsfUAs7X1ALa39gC2t/YAtrf2ALa39gC2t/YA////ALy/9gC8v/YAvsH2AMG/ + 9gB+nPFULX/t84619f/6+f/////////////1/P7/nM73/zyh8f8CpPD/CrXy/ySi8f9fuPT/KZrv/zmi + 8f/G5vv/7fr+///8//+Us/X/Jnrs8o6m81a9ufYAtrf2ALa39gC2t/YAtrf2ALa39gD///8AwsT3AMPF + 9wDDwfcAlavzSDCB7PNlpPH/PZjw/1ul8v/X7Pz/1Ov8/2259P8KhO3/N6Lx/yuu8v8Kq/H/K6fx/yua + 8P8UovH/BKzx/xKi8P8hnfH/bL71//f9//+mvPb/KXzs8Zqs9EC8uvYAt7j2ALe49gC3uPYAt7j2AP// + /wDPzvgA0tD4ALi99h8zfuzairX0/zyf8P8/o/H/UKTx/0Sc8f8jmvD/CKDw/yqq8f80sPL/Fa3x/wy2 + 8v8TsvL/Fq7x/w618v8NvfP/Crvz/wW28v8Ame//l9D4//////+LrvP/MX/sz6mx9RissvUAqrH1AKqx + 9QCqsfUA////ALzC9wDIx/gAaJvxnUqQ7/9ktfT/CqLw/yiw8v8+sPP/IqHx/waj8P8MuvP/DLbz/wi1 + 8/8Lu/P/Db3z/wy88/8Lu/P/Db3z/w288/8NvPP/Dr/z/wCr8f9fuPT////////6/v9Sju7/YJPvjqiv + 9AChrPQAoaz0AKGs9AD///8An6vzAIyl8jM3gO3xvNP5/zCo8f8ArvL/Cbjy/wWv8f8Vp/H/Iqrx/wy2 + 8v8NvfP/Db3z/w288/8NvPP/Dbzz/w288/8NvPP/Dbzz/w288/8NvfP/Cbny/xin8f98wvb//////8/Y + +v8wfezulaXyJJ2n8wCcp/MAnKfzAP///wCiqfQCWpDwiWyd8f/f8Pz/PKTx/x+p8f8QsPL/Da7x/yet + 8f8ZsPH/C7rz/w288/8NvPP/Db3z/w298/8NvPP/Dbzz/w288/8NvPP/Dbzz/w288/8NvfP/CLnz/wKh + 7/9XsfP/7/X9/2ed8f9gj+99oqbzAJ2k8wCdpPMA////AIqd8iE6gO3Utc34/2q39P8dlO//RLHy/xSd + 7/8Uq/H/DLLy/wy68/8NvfP/Db3z/wm58v8Ht/P/B7by/wm58/8NvfP/Dbzz/w288/8NvPP/Dbzz/w28 + 8/8OvvP/CLfy/xec8P94vfT/mLz1/0CE7sSYo/MIkaHzAJGh8wD///8AZIrvSD6C7fXi5vz/X7b0/wSe + 7/8NqvD/D7Dy/w258v8NvfP/Dbzz/wOy8v8GrPH/HK3y/xik8f8iqfH/HKzx/wy28/8NvfP/Dbzz/w28 + 8/8NvPP/Dbzz/w288/8Mu/P/Fabx/ziX8P+LuvX/RYju6l+S8CxckfAAXJHwAP///wBBe+xnWpPw/d/t + /P9Fo/L/Cp/v/wq58/8Nu/P/C7vz/wi58/8MsfL/R7r0/z6p8v9xwfb/wen7/5PW+P9gvvT/GKry/wm5 + 8/8NvPP/Dbzz/w288/8NvPP/Dbzz/wy98/8Sq/H/MZbw/5vH9/9Vke/9PnztQEp97QBJfe0A////AEmD + 7YttofH/fLn0/yGL7v83p/H/GKrx/w+q8f8PrvH/C6Hw/x6c8P/V8fz/4PL9/9Hq/P/u+f7/Pqvy/wyi + 8P8Rs/L/DLzz/w288/8NvPP/Dbzz/w288/8NvPP/Db3z/wmz8v8emfD/yeP7/1+W8P9MgO1RdIvvAG+K + 7wD///8ASITtnmyh8f9ZrfP/DI3t/1Cz9P8Xmu//B5rv/1C48/+x4fr/p9f5/+74/v///////////5/U + 9/8JovD/Cbrz/wy98/8NvPP/Dbzz/w288/8NvPP/Dbzz/w288/8NvPP/ArHy/zyv8v/u9v3/XZTw/3Ka + 8W2wsfUAp670AP///wBDf+2Aa57x/5rQ+P8Mie7/Io3u/0Su8v8Kle//fcn3/+f4/v/9/v////////// + ///M5vv/Kqbw/wS08v8OvfP/Dbzz/w288/8NvPP/Dbzz/w288/8NvPP/Dbzz/w298/8CrvL/SbDy//T5 + /v9YkfD/RXzsSGeE7gBjg+4A////AER87WRSj+/99/b+/2a09P8Nfuv/MJjv/xKV7/80qPL/Npnw/7TY + +f///////////43K9v8Bn+//Db3z/w288/8NvPP/Dbzz/w288/8NvPP/Dbzz/w288/8NvPP/Dr3z/wCs + 8f9WtvT/9Pf+/0uI7vxDhO0+TIbuAEuG7gD///8AepjwRzuA7fXl6Pz/qdf5/yOK7f85mvD/a8T1/wuZ + 7/8AgOz/h8D2//////+42/n/arr1/xit8v8Ku/P/Dbzz/w288/8NvPP/Dbzz/w288/8NvPP/Dbzz/w29 + 8/8KvPP/A6Lw/6zc+v/f4vv/OIHt4WuV8CRmlPAAZpTwAP///wCNnvIaOn/txrTI9//K5vz/Hovt/xyY + 7/88q/L/Cojt/2a39P/r9/7//////7Hb+v8JlO7/Crfy/w298/8NvPP/Dbzz/w288/8NvPP/Dbzz/w28 + 8/8NvPP/DLzz/wes8f9ww/b//////5u59f8+g+22m6DyAJSe8gCUnvIA////AKiv9ABpmPB6WZLv//z9 + //9etfP/AJLu/w2R7v94vvb/8vr+////////////ndP4/wSj8P8LvPP/Dbzz/w288/8NvPP/Dbzz/w28 + 8/8NvPP/Dbzz/w288/8DsfL/P7Lz/9z0/f//+P7/UY/v/2eQ72iYn/IAlJ7yAJSe8gD///8Avr72AKu1 + 9SgufezlxND4/77k+/8nke7/odX5//////////////////////+Hyvf/Aqbw/w298/8NvPP/Dbzz/w28 + 8/8NvPP/Dbzz/w288/8NvPP/Db3z/wqw8v86qvL/Y7b0/4m49f89hO7WkaTzD5Ok8wCSpPMAkqTzAP// + /wDBwfYAysX2AHKe8XxGiO7/8vH9/97z/f/1+v7//////////////////////5jS+f8DovD/C7zz/w28 + 8/8NvPP/Dbzz/w288/8NvPP/Dbzz/w288/8NvPP/D7by/xar8f8JpPD/A4js/1Ge8NDH4/sPwuP6AMHi + +gDB4voA////AMHB9gDEw/YAsLT0DTuD7sV3ovL/////////////////////////////////1+79/x+k + 8f8CtfL/Dr7z/w288/8NvPP/Dbzz/w288/8OvfP/C7vz/wm78/8NvfP/C7vz/w2+8/8KsfL/Gpjv/7DZ + +WHL6fwAxeb8AMXm/AD///8Avr/2AL6/9gDDwfYAqLT0KSh57NuJrPP///z///////////////////// + ////////m9T4/wWj7/8DtPH/Db3z/w298/8NvfP/DLvz/wSz8v8JqfH/EK7x/wu78/8NvvP/Db3z/w2+ + 8/8GrvH/Vbbz0NTt/SHf9P0A2/L9AP///wC+v/YAvr/2AMDB9gC5t/UAgpXwMSt77NxyoPH/9PL9//// + ////////////////////////ntX4/yip8f8DovD/AK7x/wi08v8KpfD/MK3y/6bd+v+UzPf/CJ/v/wCx + 8v8IuvP/Db3z/wy+8/8ApfD/Zbr0sr/l+wC75fsA////AL6/9gC+v/YAwMH2ALS29QCVmfEAmKTzKUKI + 7sBChu7/tsj3//r3/v//////////////////////5/b+/6TY+f9Rt/T/HZ7w/6fc+f/s8v3/usr3/0mK + 7vxBku/IRrHz1hao8f0Br/H/DL3z/wS08v82qfLmv+X8EMnr/QD///8Avr/2AL6/9gDAwfYAtLb1AI6W + 8ACrrfQAp670DmOP73AueuvdUZHv/5S19f/Q2fr/8PD+//z7/v///////////+ju/P+IufX/h7L0/1OP + 7/8yfezeapHwap+v9Aew3PoWpdj5Vlu89MgHqfH/AK3x/zms8uvp9/4Z+v//AP///wC+v/YAvr/2AMDB + 9gC0tvUAj5bwAKis9AChrPQAipzxAHiT8BJij+9oP4LttDV97d0+gu72T43v/lmX8P5Qju/9QYXu9zyD + 7dhAgu2ubpTwZJCd8RKZn/IAnK/0AJ/W+ADE6fwAu+L7B4/P+IEWmu/6JZPv/7nc+WnY7vsn////AL6/ + 9gC+v/YAwMH2ALS29QCPlvAAqKz0AKGs9ACDmfEAeJLvAISZ8QCYnvICaY/vHWqQ8DpUf+1ENXHrR1R/ + 7UN8mPE7aY3vGY+X8AGepvMAkZ3xAJKd8gCbr/QAoNb4ALzl+wCv3voA4ff+AL7i+0l1t/Wrttz5Wczp + +yf///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// + /wD///8A////AP///wD///8A///////8P///wAf//wAB//4AAP/8AAB/+AAAP/AAAB/gAAAP4AAAD8AA + AA/AAAAHwAAAB8AAAAeAAAAHgAAAB4AAAAfAAAAHwAAAB8AAAAfgAAAP4AAAD/AAAA/wAAAP+AAAB/wA + AAP+AAAD/4ADw//gD+P////7//////////8= + + + \ No newline at end of file diff --git a/script-editor/MyPanel.cs b/script-editor/MyPanel.cs new file mode 100644 index 0000000..60d7a7b --- /dev/null +++ b/script-editor/MyPanel.cs @@ -0,0 +1,11 @@ +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 new file mode 100644 index 0000000..73a050c --- /dev/null +++ b/script-editor/Pointer.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace VPScriptEditor +{ + public enum WindowType { Normal, Fixed, None }; + + public class Pointer + { + 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) + { + this.rooms = rooms; + this.type = type; + + if (type == WindowType.Normal) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + } + else + this.x = this.y = this.width = this.height = null; + + this.content = content; + } + } +} diff --git a/script-editor/Program.cs b/script-editor/Program.cs new file mode 100644 index 0000000..b219c24 --- /dev/null +++ b/script-editor/Program.cs @@ -0,0 +1,25 @@ +using System; +using System.Windows.Forms; + +namespace VPScriptEditor +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + try + { + Application.EnableVisualStyles(); + Application.Run(new VPScriptEditor()); + } + catch (Exception e) + { + MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/script-editor/Properties/AssemblyInfo.cs b/script-editor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..dc2b223 --- /dev/null +++ b/script-editor/Properties/AssemblyInfo.cs @@ -0,0 +1,41 @@ +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. + +// Vérifiez les valeurs des attributs de l'assembly + +using System.Collections; +using System.Collections.Generic; +using System.Drawing; +using System.Diagnostics; +using System.Windows.Forms; +[ assembly: AssemblyTitle( "VPScriptEditor" ) ] +[ assembly: AssemblyDescription( "" ) ] +[ assembly: AssemblyCompany( "" ) ] +[ assembly: AssemblyProduct( "VPScriptEditor" ) ] +[ assembly: AssemblyCopyright( "Copyright © 2009" ) ] +[ assembly: AssemblyTrademark( "" ) ] + +[ assembly: ComVisible( false ) ] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[ assembly: Guid( "77081730-1dcb-4d54-97d6-5f50b92cdba8" ) ] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// + +[ assembly: AssemblyVersion( "1.0.0.0" ) ] +[ assembly: AssemblyFileVersion( "1.0.0.0" ) ] + diff --git a/script-editor/Properties/Resources.Designer.cs b/script-editor/Properties/Resources.Designer.cs new file mode 100644 index 0000000..2b73ec6 --- /dev/null +++ b/script-editor/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3082 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace VPScriptEditor.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("VPScriptEditor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/script-editor/Properties/Resources.resx b/script-editor/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/script-editor/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/Properties/Settings.Designer.cs b/script-editor/Properties/Settings.Designer.cs new file mode 100644 index 0000000..716fb91 --- /dev/null +++ b/script-editor/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3082 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace VPScriptEditor.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/script-editor/Properties/Settings.settings b/script-editor/Properties/Settings.settings new file mode 100644 index 0000000..85b890b --- /dev/null +++ b/script-editor/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/script-editor/VPIcon.ico b/script-editor/VPIcon.ico new file mode 100644 index 0000000..c6e8e77 Binary files /dev/null and b/script-editor/VPIcon.ico differ diff --git a/script-editor/VPScriptEditor_CS.csproj b/script-editor/VPScriptEditor_CS.csproj new file mode 100644 index 0000000..2b8c394 --- /dev/null +++ b/script-editor/VPScriptEditor_CS.csproj @@ -0,0 +1,121 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {1881D841-CDBB-4BFA-BD2E-1303E66AD42B} + WinExe + Properties + VPScriptEditor + VPScriptEditor + v3.5 + 512 + VPIcon.ico + + + false + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 2 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 2 + true + + + + + + + + + + + + + + Component + + + + + Form + + + MainForm.cs + + + + + True + True + Resources.resx + + + True + True + Settings.settings + + + + + Designer + ResXFileCodeGenerator + Resources.Designer.cs + + + + + MainForm.cs + + + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + False + Microsoft.Net.Framework.3.5 + true + + + \ No newline at end of file diff --git a/script-editor/VPScriptEditor_CS.sln b/script-editor/VPScriptEditor_CS.sln new file mode 100644 index 0000000..05d24d5 --- /dev/null +++ b/script-editor/VPScriptEditor_CS.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VPScriptEditor_CS", "VPScriptEditor_CS.csproj", "{1881D841-CDBB-4BFA-BD2E-1303E66AD42B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1881D841-CDBB-4BFA-BD2E-1303E66AD42B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1881D841-CDBB-4BFA-BD2E-1303E66AD42B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1881D841-CDBB-4BFA-BD2E-1303E66AD42B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1881D841-CDBB-4BFA-BD2E-1303E66AD42B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/script-editor/corners.png b/script-editor/corners.png new file mode 100644 index 0000000..d34b962 Binary files /dev/null and b/script-editor/corners.png differ -- cgit v1.2.3