public TriangleManager(Control tabControl, List <WatchVariableControlPrecursor> variables, WatchVariablePanel watchVariablePanel) : base(variables, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS) { _triangleCache = new Dictionary <uint, TriangleStruct>(); _triangleData = new List <short[]>(); SplitContainer splitContainerTriangles = tabControl.Controls["splitContainerTriangles"] as SplitContainer; _addressBox = splitContainerTriangles.Panel1.Controls["maskedTextBoxOtherTriangle"] as MaskedTextBox; _useMisalignmentOffsetCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxVertexMisalignment"] as CheckBox; _addressBox.KeyDown += AddressBox_KeyDown; (splitContainerTriangles.Panel1.Controls["radioButtonTriFloor"] as RadioButton).Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Floor); (splitContainerTriangles.Panel1.Controls["radioButtonTriWall"] as RadioButton).Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Wall); (splitContainerTriangles.Panel1.Controls["radioButtonTriCeiling"] as RadioButton).Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Ceiling); (splitContainerTriangles.Panel1.Controls["radioButtonTriOther"] as RadioButton).Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Other); (splitContainerTriangles.Panel1.Controls["labelTriangleSelection"] as Label).Click += (sender, e) => ShowTriangleCoordinates(); (splitContainerTriangles.Panel1.Controls["buttonGotoV1"] as Button).Click += (sender, e) => ButtonUtilities.GotoTriangle(_triangleAddress, 1, _useMisalignmentOffsetCheckbox.Checked); (splitContainerTriangles.Panel1.Controls["buttonGotoV2"] as Button).Click += (sender, e) => ButtonUtilities.GotoTriangle(_triangleAddress, 2, _useMisalignmentOffsetCheckbox.Checked); (splitContainerTriangles.Panel1.Controls["buttonGotoV3"] as Button).Click += (sender, e) => ButtonUtilities.GotoTriangle(_triangleAddress, 3, _useMisalignmentOffsetCheckbox.Checked); (splitContainerTriangles.Panel1.Controls["buttonGotoVClosest"] as Button).Click += (sender, e) => { int closestVertex = WatchVariableSpecialUtilities.GetClosestTriangleVertexIndex(_triangleAddress); ButtonUtilities.GotoTriangle(_triangleAddress, closestVertex, _useMisalignmentOffsetCheckbox.Checked); }; (splitContainerTriangles.Panel1.Controls["buttonRetrieveTriangle"] as Button).Click += (sender, e) => ButtonUtilities.RetrieveTriangle(_triangleAddress); Button buttonNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["buttonNeutralizeTriangle"] as Button; buttonNeutralizeTriangle.Click += (sender, e) => ButtonUtilities.NeutralizeTriangle(_triangleAddress); ControlUtilities.AddContextMenuStripFunctions( buttonNeutralizeTriangle, new List <string>() { "Neutralize", "Neutralize with 0", "Neutralize with 21" }, new List <Action>() { () => ButtonUtilities.NeutralizeTriangle(_triangleAddress), () => ButtonUtilities.NeutralizeTriangle(_triangleAddress, false), () => ButtonUtilities.NeutralizeTriangle(_triangleAddress, true), }); (splitContainerTriangles.Panel1.Controls["buttonAnnihilateTriangle"] as Button).Click += (sender, e) => ButtonUtilities.AnnihilateTriangle(_triangleAddress); var trianglePosGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTrianglePos"] as GroupBox; ControlUtilities.InitializeThreeDimensionController( CoordinateSystem.Euler, trianglePosGroupBox, trianglePosGroupBox.Controls["buttonTrianglePosXn"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosXp"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosZn"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosZp"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosXnZn"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosXnZp"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosXpZn"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosXpZp"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosYp"] as Button, trianglePosGroupBox.Controls["buttonTrianglePosYn"] as Button, trianglePosGroupBox.Controls["textBoxTrianglePosXZ"] as TextBox, trianglePosGroupBox.Controls["textBoxTrianglePosY"] as TextBox, trianglePosGroupBox.Controls["checkBoxTrianglePosRelative"] as CheckBox, (float hOffset, float vOffset, float nOffset, bool useRelative) => { ButtonUtilities.MoveTriangle( _triangleAddress, hOffset, nOffset, -1 * vOffset, useRelative); }); var triangleNormalGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTriangleNormal"] as GroupBox; ControlUtilities.InitializeScalarController( triangleNormalGroupBox.Controls["buttontriangleNormalN"] as Button, triangleNormalGroupBox.Controls["buttontriangleNormalP"] as Button, triangleNormalGroupBox.Controls["textBoxTriangleNormal"] as TextBox, (float normalValue) => { ButtonUtilities.MoveTriangleNormal(_triangleAddress, normalValue); }); _checkBoxNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["checkBoxNeutralizeTriangle"] as CheckBox; (splitContainerTriangles.Panel1.Controls["buttonTriangleShowCoords"] as Button).Click += (sender, e) => ShowTriangleCoordinates(); (splitContainerTriangles.Panel1.Controls["buttonTriangleShowEquation"] as Button).Click += (sender, e) => ShowTriangleEquation(); _recordTriangleDataCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRecordTriangleData"] as CheckBox; _recordTriangleCountLabel = splitContainerTriangles.Panel1.Controls["labelRecordTriangleCount"] as Label; (splitContainerTriangles.Panel1.Controls["buttonTriangleShowData"] as Button).Click += (sender, e) => ShowTriangleData(); (splitContainerTriangles.Panel1.Controls["buttonTriangleShowVertices"] as Button).Click += (sender, e) => ShowTriangleVertices(); (splitContainerTriangles.Panel1.Controls["buttonTriangleClearData"] as Button).Click += (sender, e) => ClearTriangleData(); _repeatFirstVertexCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxRepeatFirstVertex"] as CheckBox; (splitContainerTriangles.Panel1.Controls["buttonTriangleShowLevelTris"] as Button).Click += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetLevelTriangles()); (splitContainerTriangles.Panel1.Controls["buttonTriangleShowObjTris"] as Button).Click += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles()); (splitContainerTriangles.Panel1.Controls["buttonTriangleShowAllTris"] as Button).Click += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetAllTriangles()); var buttonTriangleNeutralizeAllTriangles = splitContainerTriangles.Panel1.Controls["buttonTriangleNeutralizeAllTriangles"] as Button; buttonTriangleNeutralizeAllTriangles.Click += (sender, e) => TriangleUtilities.NeutralizeTriangles(); ControlUtilities.AddContextMenuStripFunctions( buttonTriangleNeutralizeAllTriangles, new List <string>() { "Neutralize All Triangles", "Neutralize Wall Triangles", "Neutralize Floor Triangles", "Neutralize Ceiling Triangles", }, new List <Action>() { () => TriangleUtilities.NeutralizeTriangles(), () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Wall), () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Floor), () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Ceiling), }); var buttonTriangleDisableAllCamCollision = splitContainerTriangles.Panel1.Controls["buttonTriangleDisableAllCamCollision"] as Button; buttonTriangleDisableAllCamCollision.Click += (sender, e) => TriangleUtilities.DisableCamCollision(); ControlUtilities.AddContextMenuStripFunctions( buttonTriangleDisableAllCamCollision, new List <string>() { "Disable Cam Collision for All Triangles", "Disable Cam Collision for Wall Triangles", "Disable Cam Collision for Floor Triangles", "Disable Cam Collision for Ceiling Triangles", }, new List <Action>() { () => TriangleUtilities.DisableCamCollision(), () => TriangleUtilities.DisableCamCollision(TriangleClassification.Wall), () => TriangleUtilities.DisableCamCollision(TriangleClassification.Floor), () => TriangleUtilities.DisableCamCollision(TriangleClassification.Ceiling), }); }