public MapForm(Map map)
{
RTHInfo = new RTHData();
InitializeComponent();
this.map = map;
this.Text = map.filePath;
// this is here so that we can see the panel in design mode
// this.splitContainer4.SplitterDistance = this.splitContainer4.Height - 27;
searchComboBox.SelectedIndex = 0;
// Set up the delays for the ToolTip.
toolTip.AutoPopDelay = 5000;
toolTip.InitialDelay = 1000;
toolTip.ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip.ShowAlways = true;
toolTip.SetToolTip(
this.recursiveCheckBox,
"Utilizes all tags listed within the currently selected tag instead of just the root tag");
toolTip.SetToolTip(
this.parsedCheckBox, "Calculates tag sizes by reflexives instead of reading tag size from index\nDo NOT check when using meta editors!");
toolTip.SetToolTip(this.soundsCheckBox, "Adds sounds into map when building");
toolTip.SetToolTip(
this.scanbspwithifp, "Scans reflexives, idents & strings using plugins instead of scanning manually");
toolTip.SetToolTip(this.saveMetaButton, "Exports tag data");
#region Load Strings Table <not in a background process>
/*
ThreadStart ts = delegate { LoadStringsBackgroundWorker(map); };
Thread thr = new Thread(ts);
thr.Start();
*/
//var watch = System.Diagnostics.Stopwatch.StartNew();
sSwap = new MEStringsSelector(map, this);
//watch.Stop();
//MessageBox.Show("String loading took: " + watch.ElapsedMilliseconds.ToString() + "ms");
// Test results on my slow machine took ~550ms. Not worth the stream errors on faster machines using a seperate thread.
#endregion
// attempt to load custom skin
try
{
LoadSkin();
}
catch
{
// Don't show skin errors EVERY time a map is opened. We perform a check when
// the main form is loaded and display the error once then.
// Global.ShowErrorMsg("There was an error while loading the skin",ex);
}
// display magic
primaryMagicBox.Text = map.PrimaryMagic.ToString("X");
secondaryMagicBox.Text = map.SecondaryMagic.ToString("X");
// show tags in tree
formFuncs.AddMetasToTreeView(map, treeView1, metaView, false);
// Add plugins to menu
plugins.Plugin.Add(Global.StartupPath + "\\Libraries");
UpdatePluginsMenu();
// display map image on form
if (map.HaloVersion == HaloVersionEnum.Halo2 ||
map.HaloVersion == HaloVersionEnum.Halo2Vista)
{
DisplayMapBitmap();
}
// format listview columns
formFuncs.AddColumnsToListView(references, map.DisplayType);
// Update the "Visual Editor" button to support multiple BSPs if
// there are more than one
if (map.BSP.bspcount > 1)
{
int index = toolStrip2.Items.IndexOf(toolStripBSPEditor);
toolStrip2.Items.RemoveAt(index);
toolStrip2.Items.Insert(index, toolStripBSPEditorDropDown);
toolStripBSPEditorDropDown.DropDownItems.Clear();
for (int x = 0; x < map.BSP.bspcount; x++)
{
// create a dropdown button for each bsp
ToolStripMenuItem tsMenuItem = new ToolStripMenuItem();
tsMenuItem.Name = "toolStripMenuItem" + x;
// tsMenuItem.Size = new System.Drawing.Size(179, 22);
tsMenuItem.Text = map.FileNames.Name[map.BSP.sbsp[x].TagIndex];
tsMenuItem.Click += this.toolStripBSPEditor_Click;
toolStripBSPEditorDropDown.DropDownItems.Add(tsMenuItem);
}
}
foreach (Prefs.CustomPluginMask mask in Prefs .CustomPluginMasks)
{
comboBox1.Items.Add(mask.Name);
}
// Default to Complete Plugin set
comboBox1.SelectedItem = comboBox1.Items[0];
// Set focus to the TAG tree list
treeView1.Select();
}