Make newline insertion a bit smarter
This commit is contained in:
parent
a9cd9e2c45
commit
4c883c33e1
|
@ -70,6 +70,8 @@ namespace ScriptTool
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
bool readUntilEnd = (endAddress == -1);
|
bool readUntilEnd = (endAddress == -1);
|
||||||
bool ended = false;
|
bool ended = false;
|
||||||
|
bool suppressNextEnd = false;
|
||||||
|
|
||||||
int address = startAddress;
|
int address = startAddress;
|
||||||
|
|
||||||
while (!ended)
|
while (!ended)
|
||||||
|
@ -100,7 +102,7 @@ namespace ScriptTool
|
||||||
|
|
||||||
builder.Append(String.Format("[{0}]", String.Join(" ", filtered)));
|
builder.Append(String.Format("[{0}]", String.Join(" ", filtered)));
|
||||||
|
|
||||||
if (newLines && code.IsEnd)
|
if (newLines && code.IsEnd && !suppressNextEnd)
|
||||||
{
|
{
|
||||||
builder.AppendLine();
|
builder.AppendLine();
|
||||||
}
|
}
|
||||||
|
@ -115,6 +117,15 @@ namespace ScriptTool
|
||||||
|
|
||||||
if (readUntilEnd && code.IsEnd)
|
if (readUntilEnd && code.IsEnd)
|
||||||
ended = true;
|
ended = true;
|
||||||
|
|
||||||
|
if (code.IsEnd)
|
||||||
|
{
|
||||||
|
suppressNextEnd = false;
|
||||||
|
}
|
||||||
|
else if (code.SuppressNextEnd == true)
|
||||||
|
{
|
||||||
|
suppressNextEnd = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace ScriptTool
|
||||||
public int CountOffset { get; set; }
|
public int CountOffset { get; set; }
|
||||||
public bool HasReferences { get; set; }
|
public bool HasReferences { get; set; }
|
||||||
public bool AbsoluteAddressing { get { return true; } }
|
public bool AbsoluteAddressing { get { return true; } }
|
||||||
|
public bool SuppressNextEnd { get; set; }
|
||||||
|
|
||||||
static EbControlCode()
|
static EbControlCode()
|
||||||
{
|
{
|
||||||
|
@ -288,6 +289,11 @@ namespace ScriptTool
|
||||||
return IsVariableLength;
|
return IsVariableLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ShouldSerializeSuppressNextEnd()
|
||||||
|
{
|
||||||
|
return SuppressNextEnd;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public int CompareTo(EbControlCode other)
|
public int CompareTo(EbControlCode other)
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace ScriptTool
|
||||||
bool IsValid(string[] codeStrings);
|
bool IsValid(string[] codeStrings);
|
||||||
bool HasReferences { get; }
|
bool HasReferences { get; }
|
||||||
bool AbsoluteAddressing { get; }
|
bool AbsoluteAddressing { get; }
|
||||||
|
bool SuppressNextEnd { get; }
|
||||||
|
|
||||||
int ComputeLength(byte[] rom, int address);
|
int ComputeLength(byte[] rom, int address);
|
||||||
IList<int> GetReferences(byte[] rom, int address);
|
IList<int> GetReferences(byte[] rom, int address);
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace ScriptTool
|
||||||
public bool HasReferences { get; set; }
|
public bool HasReferences { get; set; }
|
||||||
public bool AbsoluteAddressing { get; set; }
|
public bool AbsoluteAddressing { get; set; }
|
||||||
public bool IsCompressedString { get { return false; } }
|
public bool IsCompressedString { get { return false; } }
|
||||||
|
public bool SuppressNextEnd { get; set; }
|
||||||
|
|
||||||
static M12ControlCode()
|
static M12ControlCode()
|
||||||
{
|
{
|
||||||
|
|
|
@ -260,7 +260,8 @@
|
||||||
2
|
2
|
||||||
],
|
],
|
||||||
"Description": "Load a text string into memory (end with [02]",
|
"Description": "Load a text string into memory (end with [02]",
|
||||||
"Length": 2
|
"Length": 2,
|
||||||
|
"SuppressNextEnd": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": [
|
"Identifier": [
|
||||||
|
|
|
@ -18,7 +18,8 @@
|
||||||
{
|
{
|
||||||
"Identifier": 0x3,
|
"Identifier": 0x3,
|
||||||
"Description": "Display menu string set {0:X}",
|
"Description": "Display menu string set {0:X}",
|
||||||
"Length": 4
|
"Length": 4,
|
||||||
|
"SuppressNextEnd": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0x4,
|
"Identifier": 0x4,
|
||||||
|
|
|
@ -33,10 +33,7 @@
|
||||||
this.fileMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.fileMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.saveMenu = new System.Windows.Forms.ToolStripMenuItem();
|
this.saveMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.topPanel = new System.Windows.Forms.FlowLayoutPanel();
|
this.topPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.groupSelector = new System.Windows.Forms.ComboBox();
|
||||||
this.tptSelector = new System.Windows.Forms.ComboBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.battleActionSelector = new System.Windows.Forms.ComboBox();
|
|
||||||
this.backButton = new System.Windows.Forms.Button();
|
this.backButton = new System.Windows.Forms.Button();
|
||||||
this.mainPanel = new System.Windows.Forms.Panel();
|
this.mainPanel = new System.Windows.Forms.Panel();
|
||||||
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
this.mainSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
|
@ -48,6 +45,7 @@
|
||||||
this.lineOpsPanel = new System.Windows.Forms.FlowLayoutPanel();
|
this.lineOpsPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.copyCodesButton = new System.Windows.Forms.Button();
|
this.copyCodesButton = new System.Windows.Forms.Button();
|
||||||
this.codeSplitContainer = new System.Windows.Forms.SplitContainer();
|
this.codeSplitContainer = new System.Windows.Forms.SplitContainer();
|
||||||
|
this.codeList = new System.Windows.Forms.ListBox();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
this.referenceList = new System.Windows.Forms.ListBox();
|
this.referenceList = new System.Windows.Forms.ListBox();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
this.label3 = new System.Windows.Forms.Label();
|
||||||
|
@ -57,7 +55,9 @@
|
||||||
this.statusBar = new System.Windows.Forms.StatusStrip();
|
this.statusBar = new System.Windows.Forms.StatusStrip();
|
||||||
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
this.statusLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||||
this.writeTimer = new System.Windows.Forms.Timer(this.components);
|
this.writeTimer = new System.Windows.Forms.Timer(this.components);
|
||||||
this.codeList = new System.Windows.Forms.ListBox();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.collectionSelector = new System.Windows.Forms.ComboBox();
|
||||||
|
this.previewButton = new System.Windows.Forms.Button();
|
||||||
this.mainMenu.SuspendLayout();
|
this.mainMenu.SuspendLayout();
|
||||||
this.topPanel.SuspendLayout();
|
this.topPanel.SuspendLayout();
|
||||||
this.mainPanel.SuspendLayout();
|
this.mainPanel.SuspendLayout();
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
this.fileMenu});
|
this.fileMenu});
|
||||||
this.mainMenu.Location = new System.Drawing.Point(0, 0);
|
this.mainMenu.Location = new System.Drawing.Point(0, 0);
|
||||||
this.mainMenu.Name = "mainMenu";
|
this.mainMenu.Name = "mainMenu";
|
||||||
this.mainMenu.Size = new System.Drawing.Size(853, 24);
|
this.mainMenu.Size = new System.Drawing.Size(1026, 24);
|
||||||
this.mainMenu.TabIndex = 8;
|
this.mainMenu.TabIndex = 8;
|
||||||
this.mainMenu.Text = "menuStrip1";
|
this.mainMenu.Text = "menuStrip1";
|
||||||
//
|
//
|
||||||
|
@ -108,65 +108,31 @@
|
||||||
// topPanel
|
// topPanel
|
||||||
//
|
//
|
||||||
this.topPanel.AutoSize = true;
|
this.topPanel.AutoSize = true;
|
||||||
this.topPanel.Controls.Add(this.label4);
|
|
||||||
this.topPanel.Controls.Add(this.tptSelector);
|
|
||||||
this.topPanel.Controls.Add(this.label1);
|
this.topPanel.Controls.Add(this.label1);
|
||||||
this.topPanel.Controls.Add(this.battleActionSelector);
|
this.topPanel.Controls.Add(this.collectionSelector);
|
||||||
|
this.topPanel.Controls.Add(this.groupSelector);
|
||||||
this.topPanel.Controls.Add(this.backButton);
|
this.topPanel.Controls.Add(this.backButton);
|
||||||
this.topPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
this.topPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||||
this.topPanel.Location = new System.Drawing.Point(0, 24);
|
this.topPanel.Location = new System.Drawing.Point(0, 24);
|
||||||
this.topPanel.Name = "topPanel";
|
this.topPanel.Name = "topPanel";
|
||||||
this.topPanel.Size = new System.Drawing.Size(853, 29);
|
this.topPanel.Size = new System.Drawing.Size(1026, 29);
|
||||||
this.topPanel.TabIndex = 10;
|
this.topPanel.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// label4
|
// groupSelector
|
||||||
//
|
//
|
||||||
this.label4.AutoSize = true;
|
this.groupSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.label4.Location = new System.Drawing.Point(3, 0);
|
this.groupSelector.FormattingEnabled = true;
|
||||||
this.label4.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
this.groupSelector.Location = new System.Drawing.Point(208, 4);
|
||||||
this.label4.Name = "label4";
|
this.groupSelector.Margin = new System.Windows.Forms.Padding(3, 4, 3, 3);
|
||||||
this.label4.Padding = new System.Windows.Forms.Padding(3, 7, 0, 6);
|
this.groupSelector.Name = "groupSelector";
|
||||||
this.label4.Size = new System.Drawing.Size(60, 26);
|
this.groupSelector.Size = new System.Drawing.Size(238, 21);
|
||||||
this.label4.TabIndex = 14;
|
this.groupSelector.TabIndex = 10;
|
||||||
this.label4.Text = "TPT entry:";
|
this.groupSelector.SelectionChangeCommitted += new System.EventHandler(this.groupSelector_SelectionChangeCommitted);
|
||||||
//
|
|
||||||
// tptSelector
|
|
||||||
//
|
|
||||||
this.tptSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.tptSelector.FormattingEnabled = true;
|
|
||||||
this.tptSelector.Location = new System.Drawing.Point(66, 4);
|
|
||||||
this.tptSelector.Margin = new System.Windows.Forms.Padding(3, 4, 3, 3);
|
|
||||||
this.tptSelector.Name = "tptSelector";
|
|
||||||
this.tptSelector.Size = new System.Drawing.Size(238, 21);
|
|
||||||
this.tptSelector.TabIndex = 10;
|
|
||||||
this.tptSelector.SelectionChangeCommitted += new System.EventHandler(this.selector_SelectionChangeCommitted);
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(310, 0);
|
|
||||||
this.label1.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Padding = new System.Windows.Forms.Padding(3, 7, 0, 6);
|
|
||||||
this.label1.Size = new System.Drawing.Size(72, 26);
|
|
||||||
this.label1.TabIndex = 11;
|
|
||||||
this.label1.Text = "Battle action:";
|
|
||||||
//
|
|
||||||
// battleActionSelector
|
|
||||||
//
|
|
||||||
this.battleActionSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
||||||
this.battleActionSelector.FormattingEnabled = true;
|
|
||||||
this.battleActionSelector.Location = new System.Drawing.Point(385, 4);
|
|
||||||
this.battleActionSelector.Margin = new System.Windows.Forms.Padding(3, 4, 3, 3);
|
|
||||||
this.battleActionSelector.Name = "battleActionSelector";
|
|
||||||
this.battleActionSelector.Size = new System.Drawing.Size(238, 21);
|
|
||||||
this.battleActionSelector.TabIndex = 13;
|
|
||||||
this.battleActionSelector.SelectionChangeCommitted += new System.EventHandler(this.selector_SelectionChangeCommitted);
|
|
||||||
//
|
//
|
||||||
// backButton
|
// backButton
|
||||||
//
|
//
|
||||||
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
this.backButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.backButton.Location = new System.Drawing.Point(629, 3);
|
this.backButton.Location = new System.Drawing.Point(452, 3);
|
||||||
this.backButton.Name = "backButton";
|
this.backButton.Name = "backButton";
|
||||||
this.backButton.Size = new System.Drawing.Size(75, 23);
|
this.backButton.Size = new System.Drawing.Size(75, 23);
|
||||||
this.backButton.TabIndex = 12;
|
this.backButton.TabIndex = 12;
|
||||||
|
@ -182,7 +148,7 @@
|
||||||
this.mainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.mainPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.mainPanel.Location = new System.Drawing.Point(0, 53);
|
this.mainPanel.Location = new System.Drawing.Point(0, 53);
|
||||||
this.mainPanel.Name = "mainPanel";
|
this.mainPanel.Name = "mainPanel";
|
||||||
this.mainPanel.Size = new System.Drawing.Size(853, 667);
|
this.mainPanel.Size = new System.Drawing.Size(1026, 667);
|
||||||
this.mainPanel.TabIndex = 11;
|
this.mainPanel.TabIndex = 11;
|
||||||
//
|
//
|
||||||
// mainSplitContainer
|
// mainSplitContainer
|
||||||
|
@ -204,8 +170,8 @@
|
||||||
this.mainSplitContainer.Panel2.BackColor = System.Drawing.SystemColors.Control;
|
this.mainSplitContainer.Panel2.BackColor = System.Drawing.SystemColors.Control;
|
||||||
this.mainSplitContainer.Panel2.Controls.Add(this.codeSplitContainer);
|
this.mainSplitContainer.Panel2.Controls.Add(this.codeSplitContainer);
|
||||||
this.mainSplitContainer.Panel2.Controls.Add(this.gameSelectorPanel);
|
this.mainSplitContainer.Panel2.Controls.Add(this.gameSelectorPanel);
|
||||||
this.mainSplitContainer.Size = new System.Drawing.Size(853, 667);
|
this.mainSplitContainer.Size = new System.Drawing.Size(1026, 667);
|
||||||
this.mainSplitContainer.SplitterDistance = 627;
|
this.mainSplitContainer.SplitterDistance = 800;
|
||||||
this.mainSplitContainer.TabIndex = 6;
|
this.mainSplitContainer.TabIndex = 6;
|
||||||
//
|
//
|
||||||
// leftSplitContainer
|
// leftSplitContainer
|
||||||
|
@ -221,8 +187,8 @@
|
||||||
//
|
//
|
||||||
this.leftSplitContainer.Panel1.Controls.Add(this.textBoxPanel);
|
this.leftSplitContainer.Panel1.Controls.Add(this.textBoxPanel);
|
||||||
this.leftSplitContainer.Panel1.Controls.Add(this.lineOpsPanel);
|
this.leftSplitContainer.Panel1.Controls.Add(this.lineOpsPanel);
|
||||||
this.leftSplitContainer.Size = new System.Drawing.Size(627, 667);
|
this.leftSplitContainer.Size = new System.Drawing.Size(800, 667);
|
||||||
this.leftSplitContainer.SplitterDistance = 443;
|
this.leftSplitContainer.SplitterDistance = 526;
|
||||||
this.leftSplitContainer.TabIndex = 5;
|
this.leftSplitContainer.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// textBoxPanel
|
// textBoxPanel
|
||||||
|
@ -235,7 +201,7 @@
|
||||||
this.textBoxPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.textBoxPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.textBoxPanel.Location = new System.Drawing.Point(0, 0);
|
this.textBoxPanel.Location = new System.Drawing.Point(0, 0);
|
||||||
this.textBoxPanel.Name = "textBoxPanel";
|
this.textBoxPanel.Name = "textBoxPanel";
|
||||||
this.textBoxPanel.Size = new System.Drawing.Size(623, 406);
|
this.textBoxPanel.Size = new System.Drawing.Size(796, 489);
|
||||||
this.textBoxPanel.TabIndex = 10;
|
this.textBoxPanel.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// ebString
|
// ebString
|
||||||
|
@ -246,7 +212,7 @@
|
||||||
this.ebString.Multiline = true;
|
this.ebString.Multiline = true;
|
||||||
this.ebString.Name = "ebString";
|
this.ebString.Name = "ebString";
|
||||||
this.ebString.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.ebString.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.ebString.Size = new System.Drawing.Size(613, 128);
|
this.ebString.Size = new System.Drawing.Size(786, 128);
|
||||||
this.ebString.TabIndex = 9;
|
this.ebString.TabIndex = 9;
|
||||||
//
|
//
|
||||||
// m12String
|
// m12String
|
||||||
|
@ -257,7 +223,7 @@
|
||||||
this.m12String.Multiline = true;
|
this.m12String.Multiline = true;
|
||||||
this.m12String.Name = "m12String";
|
this.m12String.Name = "m12String";
|
||||||
this.m12String.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.m12String.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.m12String.Size = new System.Drawing.Size(613, 128);
|
this.m12String.Size = new System.Drawing.Size(786, 128);
|
||||||
this.m12String.TabIndex = 10;
|
this.m12String.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// m12StringEnglish
|
// m12StringEnglish
|
||||||
|
@ -268,7 +234,7 @@
|
||||||
this.m12StringEnglish.Multiline = true;
|
this.m12StringEnglish.Multiline = true;
|
||||||
this.m12StringEnglish.Name = "m12StringEnglish";
|
this.m12StringEnglish.Name = "m12StringEnglish";
|
||||||
this.m12StringEnglish.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.m12StringEnglish.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.m12StringEnglish.Size = new System.Drawing.Size(613, 128);
|
this.m12StringEnglish.Size = new System.Drawing.Size(786, 128);
|
||||||
this.m12StringEnglish.TabIndex = 11;
|
this.m12StringEnglish.TabIndex = 11;
|
||||||
//
|
//
|
||||||
// lineOpsPanel
|
// lineOpsPanel
|
||||||
|
@ -276,10 +242,11 @@
|
||||||
this.lineOpsPanel.AutoSize = true;
|
this.lineOpsPanel.AutoSize = true;
|
||||||
this.lineOpsPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
this.lineOpsPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
this.lineOpsPanel.Controls.Add(this.copyCodesButton);
|
this.lineOpsPanel.Controls.Add(this.copyCodesButton);
|
||||||
|
this.lineOpsPanel.Controls.Add(this.previewButton);
|
||||||
this.lineOpsPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
this.lineOpsPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
this.lineOpsPanel.Location = new System.Drawing.Point(0, 406);
|
this.lineOpsPanel.Location = new System.Drawing.Point(0, 489);
|
||||||
this.lineOpsPanel.Name = "lineOpsPanel";
|
this.lineOpsPanel.Name = "lineOpsPanel";
|
||||||
this.lineOpsPanel.Size = new System.Drawing.Size(623, 33);
|
this.lineOpsPanel.Size = new System.Drawing.Size(796, 33);
|
||||||
this.lineOpsPanel.TabIndex = 9;
|
this.lineOpsPanel.TabIndex = 9;
|
||||||
//
|
//
|
||||||
// copyCodesButton
|
// copyCodesButton
|
||||||
|
@ -314,6 +281,16 @@
|
||||||
this.codeSplitContainer.SplitterDistance = 292;
|
this.codeSplitContainer.SplitterDistance = 292;
|
||||||
this.codeSplitContainer.TabIndex = 1;
|
this.codeSplitContainer.TabIndex = 1;
|
||||||
//
|
//
|
||||||
|
// codeList
|
||||||
|
//
|
||||||
|
this.codeList.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.codeList.FormattingEnabled = true;
|
||||||
|
this.codeList.HorizontalScrollbar = true;
|
||||||
|
this.codeList.Location = new System.Drawing.Point(0, 19);
|
||||||
|
this.codeList.Name = "codeList";
|
||||||
|
this.codeList.Size = new System.Drawing.Size(218, 269);
|
||||||
|
this.codeList.TabIndex = 3;
|
||||||
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.label2.AutoSize = true;
|
||||||
|
@ -392,7 +369,7 @@
|
||||||
this.statusLabel});
|
this.statusLabel});
|
||||||
this.statusBar.Location = new System.Drawing.Point(0, 720);
|
this.statusBar.Location = new System.Drawing.Point(0, 720);
|
||||||
this.statusBar.Name = "statusBar";
|
this.statusBar.Name = "statusBar";
|
||||||
this.statusBar.Size = new System.Drawing.Size(853, 22);
|
this.statusBar.Size = new System.Drawing.Size(1026, 22);
|
||||||
this.statusBar.TabIndex = 7;
|
this.statusBar.TabIndex = 7;
|
||||||
this.statusBar.Text = "statusStrip1";
|
this.statusBar.Text = "statusStrip1";
|
||||||
//
|
//
|
||||||
|
@ -407,21 +384,41 @@
|
||||||
this.writeTimer.Interval = 10000;
|
this.writeTimer.Interval = 10000;
|
||||||
this.writeTimer.Tick += new System.EventHandler(this.writeTimer_Tick);
|
this.writeTimer.Tick += new System.EventHandler(this.writeTimer_Tick);
|
||||||
//
|
//
|
||||||
// codeList
|
// label1
|
||||||
//
|
//
|
||||||
this.codeList.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.label1.AutoSize = true;
|
||||||
this.codeList.FormattingEnabled = true;
|
this.label1.Location = new System.Drawing.Point(3, 8);
|
||||||
this.codeList.HorizontalScrollbar = true;
|
this.label1.Margin = new System.Windows.Forms.Padding(3, 8, 0, 0);
|
||||||
this.codeList.Location = new System.Drawing.Point(0, 19);
|
this.label1.Name = "label1";
|
||||||
this.codeList.Name = "codeList";
|
this.label1.Size = new System.Drawing.Size(39, 13);
|
||||||
this.codeList.Size = new System.Drawing.Size(218, 269);
|
this.label1.TabIndex = 13;
|
||||||
this.codeList.TabIndex = 3;
|
this.label1.Text = "Group:";
|
||||||
|
//
|
||||||
|
// collectionSelector
|
||||||
|
//
|
||||||
|
this.collectionSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
|
this.collectionSelector.FormattingEnabled = true;
|
||||||
|
this.collectionSelector.Location = new System.Drawing.Point(45, 4);
|
||||||
|
this.collectionSelector.Margin = new System.Windows.Forms.Padding(3, 4, 3, 3);
|
||||||
|
this.collectionSelector.Name = "collectionSelector";
|
||||||
|
this.collectionSelector.Size = new System.Drawing.Size(157, 21);
|
||||||
|
this.collectionSelector.TabIndex = 14;
|
||||||
|
this.collectionSelector.SelectionChangeCommitted += new System.EventHandler(this.collectionSelector_SelectionChangeCommitted);
|
||||||
|
//
|
||||||
|
// previewButton
|
||||||
|
//
|
||||||
|
this.previewButton.Location = new System.Drawing.Point(133, 3);
|
||||||
|
this.previewButton.Name = "previewButton";
|
||||||
|
this.previewButton.Size = new System.Drawing.Size(75, 23);
|
||||||
|
this.previewButton.TabIndex = 1;
|
||||||
|
this.previewButton.Text = "Preview";
|
||||||
|
this.previewButton.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(853, 742);
|
this.ClientSize = new System.Drawing.Size(1026, 742);
|
||||||
this.Controls.Add(this.mainPanel);
|
this.Controls.Add(this.mainPanel);
|
||||||
this.Controls.Add(this.topPanel);
|
this.Controls.Add(this.topPanel);
|
||||||
this.Controls.Add(this.mainMenu);
|
this.Controls.Add(this.mainMenu);
|
||||||
|
@ -469,11 +466,8 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem fileMenu;
|
private System.Windows.Forms.ToolStripMenuItem fileMenu;
|
||||||
private System.Windows.Forms.ToolStripMenuItem saveMenu;
|
private System.Windows.Forms.ToolStripMenuItem saveMenu;
|
||||||
private System.Windows.Forms.FlowLayoutPanel topPanel;
|
private System.Windows.Forms.FlowLayoutPanel topPanel;
|
||||||
private System.Windows.Forms.Label label4;
|
|
||||||
private System.Windows.Forms.ComboBox battleActionSelector;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
private System.Windows.Forms.Button backButton;
|
private System.Windows.Forms.Button backButton;
|
||||||
private System.Windows.Forms.ComboBox tptSelector;
|
private System.Windows.Forms.ComboBox groupSelector;
|
||||||
private System.Windows.Forms.Panel mainPanel;
|
private System.Windows.Forms.Panel mainPanel;
|
||||||
private System.Windows.Forms.SplitContainer mainSplitContainer;
|
private System.Windows.Forms.SplitContainer mainSplitContainer;
|
||||||
private System.Windows.Forms.SplitContainer leftSplitContainer;
|
private System.Windows.Forms.SplitContainer leftSplitContainer;
|
||||||
|
@ -494,6 +488,9 @@
|
||||||
private System.Windows.Forms.FlowLayoutPanel lineOpsPanel;
|
private System.Windows.Forms.FlowLayoutPanel lineOpsPanel;
|
||||||
private System.Windows.Forms.Button copyCodesButton;
|
private System.Windows.Forms.Button copyCodesButton;
|
||||||
private System.Windows.Forms.ListBox codeList;
|
private System.Windows.Forms.ListBox codeList;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
private System.Windows.Forms.ComboBox collectionSelector;
|
||||||
|
private System.Windows.Forms.Button previewButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,14 @@ namespace ScriptToolGui
|
||||||
IList<string> m12StringsEnglish;
|
IList<string> m12StringsEnglish;
|
||||||
IList<string> ebStrings;
|
IList<string> ebStrings;
|
||||||
|
|
||||||
|
// Index mappings
|
||||||
|
IndexMapping itemMapping = new IndexMapping();
|
||||||
|
|
||||||
// Matched reference pairs
|
// Matched reference pairs
|
||||||
List<MatchedGroup> tptGroups = new List<MatchedGroup>();
|
MatchedGroupCollection tptGroups = new MatchedGroupCollection("TPT");
|
||||||
List<MatchedGroup> battleActionGroups = new List<MatchedGroup>();
|
MatchedGroupCollection battleActionGroups = new MatchedGroupCollection("Battle actions");
|
||||||
List<MatchedGroup> matchedGroups = new List<MatchedGroup>();
|
List<MatchedGroup> matchedGroups = new List<MatchedGroup>();
|
||||||
|
IList<MatchedGroupCollection> matchedCollections = new List<MatchedGroupCollection>();
|
||||||
|
|
||||||
// Navigation stack
|
// Navigation stack
|
||||||
IDictionary<Game, int> currentIndex;
|
IDictionary<Game, int> currentIndex;
|
||||||
|
@ -60,7 +64,28 @@ namespace ScriptToolGui
|
||||||
|
|
||||||
InitLookups();
|
InitLookups();
|
||||||
|
|
||||||
PopulateSelectors();
|
PopulateCollectionSelector();
|
||||||
|
|
||||||
|
collectionSelector.SelectedIndex = 0;
|
||||||
|
collectionSelector_SelectionChangeCommitted(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PopulateCollectionSelector()
|
||||||
|
{
|
||||||
|
collectionSelector.Items.Clear();
|
||||||
|
|
||||||
|
collectionSelector.Items.Add(tptGroups);
|
||||||
|
collectionSelector.Items.Add(battleActionGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PopulateGroupSelector(MatchedGroupCollection collection)
|
||||||
|
{
|
||||||
|
groupSelector.Items.Clear();
|
||||||
|
|
||||||
|
if (collection != null)
|
||||||
|
{
|
||||||
|
groupSelector.Items.AddRange(collection.Groups.ToArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitLookups()
|
private void InitLookups()
|
||||||
|
@ -87,38 +112,32 @@ namespace ScriptToolGui
|
||||||
private void ImportAllStringRefs(string folder)
|
private void ImportAllStringRefs(string folder)
|
||||||
{
|
{
|
||||||
// TPT
|
// TPT
|
||||||
string m12PrimaryFileName = Path.Combine(folder, "m12-tpt-primary.json");
|
var m12PrimaryTptRefs = ImportStringRefs(Path.Combine(folder, "m12-tpt-primary.json"));
|
||||||
string ebPrimaryFileName = Path.Combine(folder, "eb-tpt-primary.json");
|
var ebPrimaryTptRefs = ImportStringRefs(Path.Combine(folder, "eb-tpt-primary.json"));
|
||||||
|
|
||||||
var m12PrimaryTptRefs = ImportStringRefs(m12PrimaryFileName);
|
var m12SecondaryTptRefs = ImportStringRefs(Path.Combine(folder, "m12-tpt-secondary.json"));
|
||||||
var ebPrimaryTptRefs = ImportStringRefs(ebPrimaryFileName);
|
var ebSecondaryTptRefs = ImportStringRefs(Path.Combine(folder, "eb-tpt-secondary.json"));
|
||||||
|
|
||||||
string m12SecondaryFileName = Path.Combine(folder, "m12-tpt-secondary.json");
|
tptGroups.Groups.AddRange(MatchRefs(ebPrimaryTptRefs, m12PrimaryTptRefs));
|
||||||
string ebSecondaryFileName = Path.Combine(folder, "eb-tpt-secondary.json");
|
tptGroups.Groups.AddRange(MatchRefs(ebSecondaryTptRefs, m12SecondaryTptRefs));
|
||||||
|
tptGroups.Groups.Sort((g1, g2) => g1.Index.CompareTo(g2.Index));
|
||||||
var m12SecondaryTptRefs = ImportStringRefs(m12SecondaryFileName);
|
|
||||||
var ebSecondaryTptRefs = ImportStringRefs(ebSecondaryFileName);
|
|
||||||
|
|
||||||
tptGroups.AddRange(MatchRefs(ebPrimaryTptRefs, m12PrimaryTptRefs));
|
|
||||||
tptGroups.AddRange(MatchRefs(ebSecondaryTptRefs, m12SecondaryTptRefs));
|
|
||||||
tptGroups.Sort((g1, g2) => g1.Index.CompareTo(g2.Index));
|
|
||||||
|
|
||||||
matchedGroups.AddRange(tptGroups);
|
matchedGroups.AddRange(tptGroups);
|
||||||
|
|
||||||
// Battle actions
|
// Battle actions
|
||||||
string m12BattleActionsFileName = Path.Combine(folder, "m12-battle-actions.json");
|
var m12BattleActionRefs = ImportStringRefs(Path.Combine(folder, "m12-battle-actions.json"));
|
||||||
string ebBattleActionsFileName = Path.Combine(folder, "eb-battle-actions.json");
|
var ebBattleActionRefs = ImportStringRefs(Path.Combine(folder, "eb-battle-actions.json"));
|
||||||
|
|
||||||
var m12BattleActionRefs = ImportStringRefs(m12BattleActionsFileName);
|
battleActionGroups.Groups.AddRange(MatchRefs(ebBattleActionRefs, m12BattleActionRefs));
|
||||||
var ebBattleActionRefs = ImportStringRefs(ebBattleActionsFileName);
|
battleActionGroups.Groups.Sort((g1, g2) => g1.Index.CompareTo(g2.Index));
|
||||||
|
|
||||||
battleActionGroups.AddRange(MatchRefs(ebBattleActionRefs, m12BattleActionRefs));
|
|
||||||
battleActionGroups.Sort((g1, g2) => g1.Index.CompareTo(g2.Index));
|
|
||||||
|
|
||||||
matchedGroups.AddRange(battleActionGroups);
|
matchedGroups.AddRange(battleActionGroups);
|
||||||
|
|
||||||
matchedGroups.Sort((g1, g2) => g1.Index.CompareTo(g2.Index));
|
// Item help
|
||||||
|
|
||||||
|
matchedGroups.Sort((g1, g2) => g1.Index.CompareTo(g2.Index));
|
||||||
|
matchedCollections.Add(tptGroups);
|
||||||
|
matchedCollections.Add(battleActionGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MatchedGroup[] MatchRefs(MainStringRef[] ebRefs, MainStringRef[] m12Refs)
|
private MatchedGroup[] MatchRefs(MainStringRef[] ebRefs, MainStringRef[] m12Refs)
|
||||||
|
@ -161,15 +180,6 @@ namespace ScriptToolGui
|
||||||
return Game.None;
|
return Game.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PopulateSelectors()
|
|
||||||
{
|
|
||||||
tptSelector.Items.Clear();
|
|
||||||
tptSelector.Items.AddRange(tptGroups.ToArray());
|
|
||||||
|
|
||||||
battleActionSelector.Items.Clear();
|
|
||||||
battleActionSelector.Items.AddRange(battleActionGroups.ToArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PopulateCodeList()
|
private void PopulateCodeList()
|
||||||
{
|
{
|
||||||
codeList.Items.Clear();
|
codeList.Items.Clear();
|
||||||
|
@ -251,19 +261,35 @@ namespace ScriptToolGui
|
||||||
previousNavigationState = new MatchedGroupNavigationEntry(group);
|
previousNavigationState = new MatchedGroupNavigationEntry(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectGroup(tptSelector, group);
|
SelectGroup(group);
|
||||||
SelectGroup(battleActionSelector, group);
|
|
||||||
|
|
||||||
PopulateCodeList();
|
PopulateCodeList();
|
||||||
PopulateReferenceList();
|
PopulateReferenceList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SelectGroup(ComboBox selector, MatchedGroup group)
|
private void SelectGroup(MatchedGroup group)
|
||||||
{
|
{
|
||||||
if (group != null && selector.Items.Contains(group))
|
if (group != null)
|
||||||
selector.SelectedItem = group;
|
{
|
||||||
else
|
// Find this group in our collections
|
||||||
selector.SelectedIndex = -1;
|
foreach (var collection in matchedCollections)
|
||||||
|
{
|
||||||
|
if (collection.Contains(group))
|
||||||
|
{
|
||||||
|
if ((MatchedGroupCollection)collectionSelector.SelectedItem !=
|
||||||
|
collection)
|
||||||
|
{
|
||||||
|
collectionSelector.SelectedItem = collection;
|
||||||
|
PopulateGroupSelector(collection);
|
||||||
|
}
|
||||||
|
|
||||||
|
groupSelector.SelectedItem = group;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
groupSelector.SelectedIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MatchedGroup FindGroup(IEnumerable<MatchedGroup> groups, Game game, string label)
|
private MatchedGroup FindGroup(IEnumerable<MatchedGroup> groups, Game game, string label)
|
||||||
|
@ -312,12 +338,10 @@ namespace ScriptToolGui
|
||||||
labelDef = "^" + otherGame.Value.Label + "^";
|
labelDef = "^" + otherGame.Value.Label + "^";
|
||||||
textboxLookup[otherGame.Key].Text = GetString(otherGame.Key, otherGame.Value.Label, out index);
|
textboxLookup[otherGame.Key].Text = GetString(otherGame.Key, otherGame.Value.Label, out index);
|
||||||
currentIndex[game] = index;
|
currentIndex[game] = index;
|
||||||
//stringsLookup[otherGame.Key].First(l => l.Contains(labelDef));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectGroup(tptSelector, match);
|
SelectGroup(match);
|
||||||
SelectGroup(battleActionSelector, match);
|
|
||||||
|
|
||||||
PopulateCodeList();
|
PopulateCodeList();
|
||||||
PopulateReferenceList();
|
PopulateReferenceList();
|
||||||
|
@ -384,19 +408,17 @@ namespace ScriptToolGui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selector_SelectionChangeCommitted(object sender, EventArgs e)
|
private void groupSelector_SelectionChangeCommitted(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var selector = (ComboBox)sender;
|
|
||||||
|
|
||||||
SaveCurrentState();
|
SaveCurrentState();
|
||||||
|
|
||||||
if (selector.SelectedIndex == -1)
|
if (groupSelector.SelectedIndex == -1)
|
||||||
NavigateTo(null);
|
NavigateTo(null);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PushPreviousNavigationState();
|
PushPreviousNavigationState();
|
||||||
|
|
||||||
var currentGroup = (MatchedGroup)selector.SelectedItem;
|
var currentGroup = (MatchedGroup)groupSelector.SelectedItem;
|
||||||
NavigateTo(currentGroup);
|
NavigateTo(currentGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,6 +489,22 @@ namespace ScriptToolGui
|
||||||
{
|
{
|
||||||
m12StringEnglish.Text = m12Compiler.StripText(m12String.Text);
|
m12StringEnglish.Text = m12Compiler.StripText(m12String.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void collectionSelector_SelectionChangeCommitted(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (collectionSelector.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
groupSelector.Items.Clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var collection = (MatchedGroupCollection)collectionSelector.SelectedItem;
|
||||||
|
PopulateGroupSelector(collection);
|
||||||
|
|
||||||
|
groupSelector.SelectedIndex = 0;
|
||||||
|
groupSelector_SelectionChangeCommitted(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Game
|
enum Game
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ScriptToolGui
|
||||||
|
{
|
||||||
|
class MatchedGroupCollection : IEnumerable<MatchedGroup>
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public List<MatchedGroup> Groups { get; private set; }
|
||||||
|
|
||||||
|
public MatchedGroupCollection(string name)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Groups = new List<MatchedGroup>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerator<MatchedGroup> GetEnumerator()
|
||||||
|
{
|
||||||
|
return Groups.GetEnumerator();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||||
|
{
|
||||||
|
return GetEnumerator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -49,6 +49,8 @@
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="IndexMapping.cs" />
|
||||||
|
<Compile Include="IndexPair.cs" />
|
||||||
<Compile Include="MainForm.cs">
|
<Compile Include="MainForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -56,6 +58,7 @@
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="MatchedGroup.cs" />
|
<Compile Include="MatchedGroup.cs" />
|
||||||
|
<Compile Include="MatchedGroupCollection.cs" />
|
||||||
<Compile Include="NavigationEntry.cs" />
|
<Compile Include="NavigationEntry.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue