Example #1
0
        public MiscManager(List <WatchVariable> watchVariables, NoTearFlowLayoutPanel variableTable, Control miscControl)
            : base(watchVariables, variableTable)
        {
            SplitContainer splitContainerMisc = miscControl.Controls["splitContainerMisc"] as SplitContainer;
            GroupBox       groupBoxRNGIndex   = splitContainerMisc.Panel1.Controls["groupBoxRNGIndex"] as GroupBox;

            _betterTextboxRNGIndex = groupBoxRNGIndex.Controls["betterTextboxRNGIndex"] as BetterTextbox;
            _betterTextboxRNGIndex.AddEnterAction(() =>
            {
                int?index = ParsingUtilities.ParseIntNullable(_betterTextboxRNGIndex.Text);
                if (index.HasValue)
                {
                    ushort rngValue = RngIndexer.GetRngValue(index.Value);
                    Config.Stream.SetValue(rngValue, Config.RngAddress);
                }
            });

            _checkBoxTurnOffMusic = splitContainerMisc.Panel1.Controls["checkBoxTurnOffMusic"] as CheckBox;
        }
Example #2
0
        public ActionsManager(string varFilePath, WatchVariableFlowLayoutPanel variableTable, Control actionsControl)
            : base(varFilePath, variableTable)
        {
            textBoxActionDescription    = actionsControl.Controls["textBoxActionDescription"] as BetterTextbox;
            textBoxAnimationDescription = actionsControl.Controls["textBoxAnimationDescription"] as BetterTextbox;

            textBoxActionDescription.DoubleClick    += (sender, e) => SelectionForm.ShowActionDescriptionSelectionForm();
            textBoxAnimationDescription.DoubleClick += (sender, e) => SelectionForm.ShowAnimationDescriptionSelectionForm();

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxActionDescription,
                new List <string>()
            {
                "Select Action", "Free Movement Action", "Open Action Form"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowActionDescriptionSelectionForm(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => new ActionForm().Show(),
            });

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxAnimationDescription,
                new List <string>()
            {
                "Select Animation", "Replace Animation"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowAnimationDescriptionSelectionForm(),
                () =>
                {
                    int?animationToBeReplaced = SelectionForm.GetAnimation("Choose Animation to Be Replaced", "Select Animation");
                    int?animationToReplaceIt  = SelectionForm.GetAnimation("Choose Animation to Replace It", "Select Animation");
                    if (animationToBeReplaced == null || animationToReplaceIt == null)
                    {
                        return;
                    }
                    AnimationUtilities.ReplaceAnimation(animationToBeReplaced.Value, animationToReplaceIt.Value);
                },
            });
        }
Example #3
0
        public ActionsManager(string varFilePath, WatchVariableFlowLayoutPanel variableTable, Control actionsControl)
            : base(varFilePath, variableTable)
        {
            textBoxActionDescription    = actionsControl.Controls["textBoxActionDescription"] as BetterTextbox;
            textBoxAnimationDescription = actionsControl.Controls["textBoxAnimationDescription"] as BetterTextbox;

            textBoxActionDescription.DoubleClick    += (sender, e) => SelectionForm.ShowActionSelectionForm();
            textBoxAnimationDescription.DoubleClick += (sender, e) => SelectionForm.ShowAnimationSelectionForm();

            ControlUtilities.AddContextMenuStripFunctions(
                textBoxActionDescription,
                new List <string>()
            {
                "Select Action", "Free Movement Action", "Open Action Form"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowActionSelectionForm(),
                () => Config.Stream.SetValue(MarioConfig.FreeMovementAction, MarioConfig.StructAddress + MarioConfig.ActionOffset),
                () => new ActionForm().Show(),
            });
        }
Example #4
0
        public VarHackManager(Control varHackControlControl, VarHackFlowLayoutPanel varHackPanel)
        {
            _varHackPanel = varHackPanel;

            // Top buttons

            SplitContainer splitContainerVarHack =
                varHackControlControl.Controls["splitContainerVarHack"] as SplitContainer;

            Button buttonVarHackAddNewVariable =
                splitContainerVarHack.Panel1.Controls["buttonVarHackAddNewVariable"] as Button;

            buttonVarHackAddNewVariable.Click +=
                (sender, e) => _varHackPanel.AddNewControl();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonVarHackAddNewVariable,
                new List <string>()
            {
                "RNG Index",
                "Floor YNorm",
                "Defacto Speed",
                "Sliding Speed",
                "Mario Action",
                "Mario Animation",
                "DYaw Intended - Facing",
                "DYaw Intended - Facing (HAU)",
            },
                new List <Action>()
            {
                () => AddVariable("RngIndex"),
                () => AddVariable("FloorYNorm"),
                () => AddVariable("DefactoSpeed"),
                () => AddVariable("SlidingSpeed"),
                () => AddVariable("MarioAction"),
                () => AddVariable("MarioAnimation"),
                () => AddVariable("DYawIntendFacing"),
                () => AddVariable("DYawIntendFacingHau"),
            });

            Button buttonVarHackOpenVars =
                splitContainerVarHack.Panel1.Controls["buttonVarHackOpenVars"] as Button;

            buttonVarHackOpenVars.Click +=
                (sender, e) => _varHackPanel.OpenVariables();

            Button buttonVarHackSaveVars =
                splitContainerVarHack.Panel1.Controls["buttonVarHackSaveVars"] as Button;

            buttonVarHackSaveVars.Click +=
                (sender, e) => _varHackPanel.SaveVariables();

            Button buttonVarHackClearVariables =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVars"] as Button;

            buttonVarHackClearVariables.Click +=
                (sender, e) => _varHackPanel.ClearVariables();

            Button buttonVarHackShowVariableBytesInLittleEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInLittleEndian"] as Button;

            buttonVarHackShowVariableBytesInLittleEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInLittleEndian();

            Button buttonVarHackShowVariableBytesInBigEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInBigEndian"] as Button;

            buttonVarHackShowVariableBytesInBigEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInBigEndian();

            // Bottom buttons

            Button buttonVarHackApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackApplyVariablesToMemory"] as Button;

            buttonVarHackApplyVariablesToMemory.Click +=
                (sender, e) => _varHackPanel.ApplyVariablesToMemory();

            Button buttonVarHackClearVariablesInMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVariablesInMemory"] as Button;

            buttonVarHackClearVariablesInMemory.Click +=
                (sender, e) => _varHackPanel.ClearVariablesInMemory();

            _buttonEnableDisableRomHack =
                splitContainerVarHack.Panel1.Controls["buttonEnableDisableRomHack"] as BinaryButton;
            _buttonEnableDisableRomHack.Initialize(
                "Enable ROM Hack",
                "Disable ROM Hack",
                () => VarHackConfig.ShowVarRomHack.LoadPayload(),
                () => VarHackConfig.ShowVarRomHack.ClearPayload(),
                () => VarHackConfig.ShowVarRomHack.Enabled);

            ControlUtilities.AddContextMenuStripFunctions(
                _buttonEnableDisableRomHack,
                new List <string>()
            {
                "1f Delay Hack (Standard)", "0f Delay Hack (Experimental)"
            },
                new List <Action>()
            {
                () => VarHackConfig.ShowVarRomHack.LoadPayload(),
                () => VarHackConfig.ShowVarRomHack2.LoadPayload(),
            });

            // Middle buttons

            _textBoxXPosValue = splitContainerVarHack.Panel1.Controls["textBoxXPosValue"] as BetterTextbox;
            _textBoxXPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxXPosValue.Text = VarHackConfig.DefaultXPos.ToString();
            InitializePositionControls(
                _textBoxXPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxXPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonXPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonXPosAdd"] as Button);

            _textBoxYPosValue = splitContainerVarHack.Panel1.Controls["textBoxYPosValue"] as BetterTextbox;
            _textBoxYPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYPosValue.Text = VarHackConfig.DefaultYPos.ToString();
            InitializePositionControls(
                _textBoxYPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxYPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYPosAdd"] as Button);

            _textBoxYDeltaValue = splitContainerVarHack.Panel1.Controls["textBoxYDeltaValue"] as BetterTextbox;
            _textBoxYDeltaValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYDeltaValue.Text = VarHackConfig.DefaultYDelta.ToString();
            InitializePositionControls(
                _textBoxYDeltaValue,
                splitContainerVarHack.Panel1.Controls["textBoxYDeltaChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaAdd"] as Button);

            Button buttonSetPositionsAndApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonSetPositionsAndApplyVariablesToMemory"] as Button;

            buttonSetPositionsAndApplyVariablesToMemory.Click +=
                (sender, e) => SetPositionsAndApplyVariablesToMemory();
        }
Example #5
0
        public OptionsManager(TabPage tabControl)
        {
            // rom version
            GroupBox    groupBoxRomVersion      = tabControl.Controls["groupBoxRomVersion"] as GroupBox;
            RadioButton radioButtonRomVersionUS = groupBoxRomVersion.Controls["radioButtonRomVersionUS"] as RadioButton;

            radioButtonRomVersionUS.Checked = Config.Version == RomVersion.US;
            radioButtonRomVersionUS.Click  += (sender, e) => { Config.Version = RomVersion.US; };
            RadioButton radioButtonRomVersionJP = groupBoxRomVersion.Controls["radioButtonRomVersionJP"] as RadioButton;

            radioButtonRomVersionJP.Checked = Config.Version == RomVersion.JP;
            radioButtonRomVersionJP.Click  += (sender, e) => { Config.Version = RomVersion.JP; };
            RadioButton radioButtonRomVersionPAL = groupBoxRomVersion.Controls["radioButtonRomVersionPAL"] as RadioButton;

            radioButtonRomVersionPAL.Checked = Config.Version == RomVersion.PAL;
            radioButtonRomVersionPAL.Click  += (sender, e) => { Config.Version = RomVersion.PAL; };

            // goto/retrieve offsets
            GroupBox      groupBoxGotoRetrieveOffsets = tabControl.Controls["groupBoxGotoRetrieveOffsets"] as GroupBox;
            BetterTextbox textBoxGotoAbove            = groupBoxGotoRetrieveOffsets.Controls["textBoxGotoAbove"] as BetterTextbox;

            textBoxGotoAbove.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.GotoAboveOffset, GotoRetrieveConfig.GotoAboveDefault);
            BetterTextbox textBoxGotoInfront = groupBoxGotoRetrieveOffsets.Controls["textBoxGotoInfront"] as BetterTextbox;

            textBoxGotoInfront.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.GotoInfrontOffset, GotoRetrieveConfig.GotoInfrontDefault);
            BetterTextbox textBoxRetrieveAbove = groupBoxGotoRetrieveOffsets.Controls["textBoxRetrieveAbove"] as BetterTextbox;

            textBoxRetrieveAbove.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.RetrieveAboveOffset, GotoRetrieveConfig.RetrieveAboveDefault);
            BetterTextbox textBoxRetrieveInfront = groupBoxGotoRetrieveOffsets.Controls["textBoxRetrieveInfront"] as BetterTextbox;

            textBoxRetrieveInfront.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.RetrieveInfrontOffset, GotoRetrieveConfig.RetrieveInfrontDefault);

            // position controller relative angle
            GroupBox    groupBoxPositionControllerRelativeAngle = tabControl.Controls["groupBoxPositionControllerRelativeAngle"] as GroupBox;
            RadioButton radioButtonPositionControllerRelativeAngleRecommended =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleRecommended"] as RadioButton;

            radioButtonPositionControllerRelativeAngleRecommended.Click += (sender, e) =>
                                                                           PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Recommended;
            RadioButton radioButtonPositionControllerRelativeAngleMario =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleMario"] as RadioButton;

            radioButtonPositionControllerRelativeAngleMario.Click += (sender, e) =>
                                                                     PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Mario;
            RadioButton radioButtonPositionControllerRelativeAngleCustom =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleCustom"] as RadioButton;

            radioButtonPositionControllerRelativeAngleCustom.Click += (sender, e) =>
                                                                      PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Custom;
            BetterTextbox textBoxPositionControllerRelativeAngleCustom =
                groupBoxPositionControllerRelativeAngle.Controls["textBoxPositionControllerRelativeAngleCustom"] as BetterTextbox;

            textBoxPositionControllerRelativeAngleCustom.LostFocus += (sender, e) =>
            {
                double value;
                if (double.TryParse((sender as TextBox).Text, out value))
                {
                    PositionControllerRelativityConfig.CustomAngle = value;
                }
                else
                {
                    (sender as TextBox).Text = PositionControllerRelativityConfig.CustomAngle.ToString();
                }
            };

            // object slot overlays
            GroupBox        groupBoxShowOverlay           = tabControl.Controls["groupBoxShowOverlay"] as GroupBox;
            List <CheckBox> overlaysCheckboxes            = new List <CheckBox>();
            CheckBox        checkBoxShowOverlayHeldObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayHeldObject"] as CheckBox;

            checkBoxShowOverlayHeldObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayHeldObject = checkBoxShowOverlayHeldObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayHeldObject);
            CheckBox checkBoxShowOverlayStoodOnObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayStoodOnObject"] as CheckBox;

            checkBoxShowOverlayStoodOnObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayStoodOnObject = checkBoxShowOverlayStoodOnObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayStoodOnObject);
            CheckBox checkBoxShowOverlayInteractionObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayInteractionObject"] as CheckBox;

            checkBoxShowOverlayInteractionObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayInteractionObject = checkBoxShowOverlayInteractionObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayInteractionObject);
            CheckBox checkBoxShowOverlayUsedObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayUsedObject"] as CheckBox;

            checkBoxShowOverlayUsedObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayUsedObject = checkBoxShowOverlayUsedObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayUsedObject);
            CheckBox checkBoxShowOverlayClosestObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayClosestObject"] as CheckBox;

            checkBoxShowOverlayClosestObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayClosestObject = checkBoxShowOverlayClosestObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayClosestObject);
            CheckBox checkBoxShowOverlayCameraObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayCameraObject"] as CheckBox;

            checkBoxShowOverlayCameraObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayCameraObject = checkBoxShowOverlayCameraObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayCameraObject);
            CheckBox checkBoxShowOverlayCameraHackObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayCameraHackObject"] as CheckBox;

            checkBoxShowOverlayCameraHackObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayCameraHackObject = checkBoxShowOverlayCameraHackObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayCameraHackObject);
            CheckBox checkBoxShowOverlayFloorObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayFloorObject"] as CheckBox;

            checkBoxShowOverlayFloorObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayFloorObject = checkBoxShowOverlayFloorObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayFloorObject);
            CheckBox checkBoxShowOverlayWallObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayWallObject"] as CheckBox;

            checkBoxShowOverlayWallObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayWallObject = checkBoxShowOverlayWallObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayWallObject);
            CheckBox checkBoxShowOverlayCeilingObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayCeilingObject"] as CheckBox;

            checkBoxShowOverlayCeilingObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayCeilingObject = checkBoxShowOverlayCeilingObject.Checked;
            overlaysCheckboxes.Add(checkBoxShowOverlayCeilingObject);

            CheckBox checkBoxShowOverlayParentObject = groupBoxShowOverlay.Controls["checkBoxShowOverlayParentObject"] as CheckBox;

            checkBoxShowOverlayParentObject.CheckedChanged += (sender, e) => OverlayConfig.ShowOverlayParentObject = checkBoxShowOverlayParentObject.Checked;

            groupBoxShowOverlay.Click += (sender, e) =>
            {
                bool newChecked = !overlaysCheckboxes.All(checkbox => checkbox.Checked);
                overlaysCheckboxes.ForEach(checkbox => checkbox.Checked = newChecked);
            };

            // FPS
            GroupBox      groupBoxFPS      = tabControl.Controls["groupBoxFPS"] as GroupBox;
            BetterTextbox betterTextboxFPS = groupBoxFPS.Controls["betterTextboxFPS"] as BetterTextbox;

            betterTextboxFPS.AddLostFocusAction(
                () =>
            {
                uint value;
                if (uint.TryParse(betterTextboxFPS.Text, out value))
                {
                    RefreshRateConfig.RefreshRateFreq = value;
                }
                else
                {
                    betterTextboxFPS.Text = RefreshRateConfig.RefreshRateFreq.ToString();
                }
            });

            // miscellaneous
            CheckBox checkBoxStartSlotIndexOne = tabControl.Controls["checkBoxStartSlotIndexOne"] as CheckBox;

            checkBoxStartSlotIndexOne.Click += (sender, e) => OptionsConfig.SlotIndexsFromOne = checkBoxStartSlotIndexOne.Checked;
            CheckBox checkBoxMoveCamWithPu = tabControl.Controls["checkBoxMoveCamWithPu"] as CheckBox;

            checkBoxMoveCamWithPu.Click += (sender, e) => OptionsConfig.MoveCameraWithPu = checkBoxMoveCamWithPu.Checked;
            CheckBox checkBoxScaleDiagonalPositionControllerButtons = tabControl.Controls["checkBoxScaleDiagonalPositionControllerButtons"] as CheckBox;

            checkBoxScaleDiagonalPositionControllerButtons.Click += (sender, e) => OptionsConfig.ScaleDiagonalPositionControllerButtons = checkBoxScaleDiagonalPositionControllerButtons.Checked;
            CheckBox checkBoxExcludeDustForClosestObject = tabControl.Controls["checkBoxExcludeDustForClosestObject"] as CheckBox;

            checkBoxExcludeDustForClosestObject.Click += (sender, e) => OptionsConfig.ExcludeDustForClosestObject = checkBoxExcludeDustForClosestObject.Checked;
            CheckBox checkBoxNeutralizeTrianglesWith21 = tabControl.Controls["checkBoxNeutralizeTrianglesWith21"] as CheckBox;

            checkBoxNeutralizeTrianglesWith21.Click += (sender, e) => OptionsConfig.NeutralizeTrianglesWith21 = checkBoxNeutralizeTrianglesWith21.Checked;
            CheckBox checkBoxUseMisalignmentOffsetForDistanceToLine = tabControl.Controls["checkBoxUseMisalignmentOffsetForDistanceToLine"] as CheckBox;

            checkBoxUseMisalignmentOffsetForDistanceToLine.Click += (sender, e) => OptionsConfig.UseMisalignmentOffsetForDistanceToLine = checkBoxUseMisalignmentOffsetForDistanceToLine.Checked;
        }
Example #6
0
        public TriangleManager(Control tabControl, string varFilePath, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            _recordedTriangleAddresses = new List <uint>();

            SplitContainer splitContainerTriangles = tabControl.Controls["splitContainerTriangles"] as SplitContainer;

            _addressBox = splitContainerTriangles.Panel1.Controls["textBoxCustomTriangle"] as BetterTextbox;
            _useMisalignmentOffsetCheckbox = splitContainerTriangles.Panel1.Controls["checkBoxVertexMisalignment"] as CheckBox;

            _addressBox.AddEnterAction(() => AddressBoxEnter());

            _radioButtonTriFloor          = splitContainerTriangles.Panel1.Controls["radioButtonTriFloor"] as RadioButton;
            _radioButtonTriFloor.Click   += (sender, e) => Mode_Click(sender, e, TriangleMode.Floor);
            _radioButtonTriWall           = splitContainerTriangles.Panel1.Controls["radioButtonTriWall"] as RadioButton;
            _radioButtonTriWall.Click    += (sender, e) => Mode_Click(sender, e, TriangleMode.Wall);
            _radioButtonTriCeiling        = splitContainerTriangles.Panel1.Controls["radioButtonTriCeiling"] as RadioButton;
            _radioButtonTriCeiling.Click += (sender, e) => Mode_Click(sender, e, TriangleMode.Ceiling);
            _radioButtonTriCustom         = splitContainerTriangles.Panel1.Controls["radioButtonTriCustom"] as RadioButton;
            _radioButtonTriCustom.Click  += (sender, e) => Mode_Click(sender, e, TriangleMode.Custom);

            ControlUtilities.AddContextMenuStripFunctions(
                _radioButtonTriCustom,
                new List <string>()
            {
                "Paste Addresses",
            },
                new List <Action>()
            {
                () => EnterCustomText(Clipboard.GetText()),
            });

            Label labelTriangleSelection = splitContainerTriangles.Panel1.Controls["labelTriangleSelection"] as Label;

            ControlUtilities.AddContextMenuStripFunctions(
                labelTriangleSelection,
                new List <string>()
            {
                "Update Based on Coordinates",
                "Paste Triangles",
            },
                new List <Action>()
            {
                () => UpdateBasedOnCoordinates(),
                () => PasteTriangles(),
            });

            (splitContainerTriangles.Panel1.Controls["buttonGotoV1"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 1, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV2"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 2, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoV3"] as Button).Click
                += (sender, e) => ButtonUtilities.GotoTriangleVertex(TriangleAddresses[0], 3, _useMisalignmentOffsetCheckbox.Checked);
            (splitContainerTriangles.Panel1.Controls["buttonGotoVClosest"] as Button).Click += (sender, e) =>
                                                                                               ButtonUtilities.GotoTriangleVertexClosest(TriangleAddresses[0], _useMisalignmentOffsetCheckbox.Checked);

            (splitContainerTriangles.Panel1.Controls["buttonRetrieveTriangle"] as Button).Click
                += (sender, e) => ButtonUtilities.RetrieveTriangle(TriangleAddresses);

            Button buttonNeutralizeTriangle = splitContainerTriangles.Panel1.Controls["buttonNeutralizeTriangle"] as Button;

            buttonNeutralizeTriangle.Click += (sender, e) => ButtonUtilities.NeutralizeTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonNeutralizeTriangle,
                new List <string>()
            {
                "Neutralize", "Neutralize with 0", "Neutralize with 0x15"
            },
                new List <Action>()
            {
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, false),
                () => ButtonUtilities.NeutralizeTriangle(TriangleAddresses, true),
            });

            Button buttonAnnihilateTriangle = splitContainerTriangles.Panel1.Controls["buttonAnnihilateTriangle"] as Button;

            buttonAnnihilateTriangle.Click += (sender, e) => ButtonUtilities.AnnihilateTriangle(TriangleAddresses);
            ControlUtilities.AddContextMenuStripFunctions(
                buttonAnnihilateTriangle,
                new List <string>()
            {
                "Annihilate All Tri But Death Barriers",
                "Annihilate All Ceilings",
            },
                new List <Action>()
            {
                () => TriangleUtilities.AnnihilateAllTrianglesButDeathBarriers(),
                () => TriangleUtilities.AnnihilateAllCeilings(),
            });

            var trianglePosGroupBox = splitContainerTriangles.Panel1.Controls["groupBoxTrianglePos"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                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(
                    TriangleAddresses,
                    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(TriangleAddresses, 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["buttonTriangleShowAddresses"] as Button).Click
                += (sender, e) => ShowTriangleAddresses();
            (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());

            Button buttonTriangleShowObjTris = splitContainerTriangles.Panel1.Controls["buttonTriangleShowObjTris"] as Button;

            buttonTriangleShowObjTris.Click += (sender, e) => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles());
            ControlUtilities.AddContextMenuStripFunctions(
                buttonTriangleShowObjTris,
                new List <string>()
            {
                "Show All Object Tris", "Show Selected Object Tris"
            },
                new List <Action>()
            {
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetObjectTriangles()),
                () => TriangleUtilities.ShowTriangles(TriangleUtilities.GetSelectedObjectTriangles()),
            });

            (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",
                "Neutralize Death Barriers",
                "Neutralize Lava",
                "Neutralize Sleeping",
                "Neutralize Loading Zones"
            },
                new List <Action>()
            {
                () => TriangleUtilities.NeutralizeTriangles(),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Wall),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Floor),
                () => TriangleUtilities.NeutralizeTriangles(TriangleClassification.Ceiling),
                () => TriangleUtilities.NeutralizeTriangles(0x0A),
                () => TriangleUtilities.NeutralizeTriangles(0x01),
                () => TriangleUtilities.NeutralizeSleeping(),
                () => {
                    TriangleUtilities.NeutralizeTriangles(0x1B);
                    TriangleUtilities.NeutralizeTriangles(0x1C);
                    TriangleUtilities.NeutralizeTriangles(0x1D);
                    TriangleUtilities.NeutralizeTriangles(0x1E);
                },
            });

            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),
            });

            GroupBox groupBoxTriangleTypeConversion        = splitContainerTriangles.Panel1.Controls["groupBoxTriangleTypeConversion"] as GroupBox;
            ComboBox comboBoxTriangleTypeConversionConvert = groupBoxTriangleTypeConversion.Controls["comboBoxTriangleTypeConversionConvert"] as ComboBox;
            TextBox  textBoxTriangleTypeConversionFromType = groupBoxTriangleTypeConversion.Controls["textBoxTriangleTypeConversionFromType"] as TextBox;
            TextBox  textBoxTriangleTypeConversionToType   = groupBoxTriangleTypeConversion.Controls["textBoxTriangleTypeConversionToType"] as TextBox;
            Button   buttonTriangleTypeConversionConvert   = groupBoxTriangleTypeConversion.Controls["buttonTriangleTypeConversionConvert"] as Button;

            comboBoxTriangleTypeConversionConvert.DataSource = EnumUtilities.GetEnumValues <TriangleClassificationExtended>(typeof(TriangleClassificationExtended));

            buttonTriangleTypeConversionConvert.Click += (sender, e) =>
            {
                TriangleClassificationExtended classification = (TriangleClassificationExtended)comboBoxTriangleTypeConversionConvert.SelectedItem;
                short?fromType = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionFromType.Text);
                short?toType   = (short?)ParsingUtilities.ParseHexNullable(textBoxTriangleTypeConversionToType.Text);
                if (!fromType.HasValue || !toType.HasValue)
                {
                    return;
                }
                TriangleUtilities.ConvertSurfaceTypes(classification, fromType.Value, toType.Value);
            };
        }
Example #7
0
        public OptionsManager(TabPage tabControl, Control cogControl)
        {
            _savedSettingsTextList = new List <string>()
            {
                "Display Yaw Angles as Unsigned",
                "Variable Values Flush Right",
                "Start Slot Index From 1",
                "Offset Goto/Retrieve Functions",
                "PU Controller Moves Camera",
                "Scale Diagonal Position Controller Buttons",
                "Exclude Dust for Closest Object",
                "Use Misalignment Offset For Distance To Line",
                "Don't Round Values to 0",
                "Display as Hex Uses Memory",
                "Neutralize Triangles with 0x15",
                "Cloning Updates Holp Type",
                "Use In-Game Trig for Angle Logic",
            };

            _savedSettingsGetterList = new List <Func <bool> >()
            {
                () => SavedSettingsConfig.DisplayYawAnglesAsUnsigned,
                () => SavedSettingsConfig.VariableValuesFlushRight,
                () => SavedSettingsConfig.StartSlotIndexsFromOne,
                () => SavedSettingsConfig.OffsetGotoRetrieveFunctions,
                () => SavedSettingsConfig.MoveCameraWithPu,
                () => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons,
                () => SavedSettingsConfig.ExcludeDustForClosestObject,
                () => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine,
                () => SavedSettingsConfig.DontRoundValuesToZero,
                () => SavedSettingsConfig.DisplayAsHexUsesMemory,
                () => SavedSettingsConfig.NeutralizeTrianglesWith0x15,
                () => SavedSettingsConfig.CloningUpdatesHolpType,
                () => SavedSettingsConfig.UseInGameTrigForAngleLogic,
            };

            _savedSettingsSetterList = new List <Action <bool> >()
            {
                (bool value) => SavedSettingsConfig.DisplayYawAnglesAsUnsigned             = value,
                (bool value) => SavedSettingsConfig.VariableValuesFlushRight               = value,
                (bool value) => SavedSettingsConfig.StartSlotIndexsFromOne                 = value,
                (bool value) => SavedSettingsConfig.OffsetGotoRetrieveFunctions            = value,
                (bool value) => SavedSettingsConfig.MoveCameraWithPu                       = value,
                (bool value) => SavedSettingsConfig.ScaleDiagonalPositionControllerButtons = value,
                (bool value) => SavedSettingsConfig.ExcludeDustForClosestObject            = value,
                (bool value) => SavedSettingsConfig.UseMisalignmentOffsetForDistanceToLine = value,
                (bool value) => SavedSettingsConfig.DontRoundValuesToZero                  = value,
                (bool value) => SavedSettingsConfig.DisplayAsHexUsesMemory                 = value,
                (bool value) => SavedSettingsConfig.NeutralizeTrianglesWith0x15            = value,
                (bool value) => SavedSettingsConfig.CloningUpdatesHolpType                 = value,
                (bool value) => SavedSettingsConfig.UseInGameTrigForAngleLogic             = value,
            };

            _savedSettingsCheckedListBox = tabControl.Controls["checkedListBoxSavedSettings"] as CheckedListBox;
            for (int i = 0; i < _savedSettingsTextList.Count; i++)
            {
                _savedSettingsCheckedListBox.Items.Add(_savedSettingsTextList[i], _savedSettingsGetterList[i]());
            }
            _savedSettingsCheckedListBox.ItemCheck += (sender, e) =>
            {
                _savedSettingsSetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            Button buttonOptionsResetSavedSettings = tabControl.Controls["buttonOptionsResetSavedSettings"] as Button;

            buttonOptionsResetSavedSettings.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            _savedSettingsItemList = _savedSettingsTextList.ConvertAll(text => new ToolStripMenuItem(text));
            for (int i = 0; i < _savedSettingsItemList.Count; i++)
            {
                ToolStripMenuItem item   = _savedSettingsItemList[i];
                Action <bool>     setter = _savedSettingsSetterList[i];
                Func <bool>       getter = _savedSettingsGetterList[i];
                item.Click += (sender, e) =>
                {
                    bool newValue = !getter();
                    setter(newValue);
                    item.Checked = newValue;
                };
                item.Checked = getter();
            }

            ToolStripMenuItem resetSavedSettingsItem = new ToolStripMenuItem(buttonOptionsResetSavedSettings.Text);

            resetSavedSettingsItem.Click += (sender, e) => SavedSettingsConfig.ResetSavedSettings();

            ToolStripMenuItem goToOptionsTabItem = new ToolStripMenuItem("Go to Options Tab");

            goToOptionsTabItem.Click += (sender, e) =>
                                        Config.TabControlMain.SelectedTab = Config.TabControlMain.TabPages["tabPageOptions"];

            cogControl.ContextMenuStrip = new ContextMenuStrip();
            cogControl.Click           += (sender, e) => cogControl.ContextMenuStrip.Show(Cursor.Position);

            _savedSettingsItemList.ForEach(item => cogControl.ContextMenuStrip.Items.Add(item));
            cogControl.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            cogControl.ContextMenuStrip.Items.Add(resetSavedSettingsItem);
            cogControl.ContextMenuStrip.Items.Add(goToOptionsTabItem);

            // goto/retrieve offsets
            GroupBox      groupBoxGotoRetrieveOffsets = tabControl.Controls["groupBoxGotoRetrieveOffsets"] as GroupBox;
            BetterTextbox textBoxGotoAbove            = groupBoxGotoRetrieveOffsets.Controls["textBoxGotoAbove"] as BetterTextbox;

            textBoxGotoAbove.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.GotoAboveOffset, GotoRetrieveConfig.GotoAboveDefault);
            BetterTextbox textBoxGotoInfront = groupBoxGotoRetrieveOffsets.Controls["textBoxGotoInfront"] as BetterTextbox;

            textBoxGotoInfront.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.GotoInfrontOffset, GotoRetrieveConfig.GotoInfrontDefault);
            BetterTextbox textBoxRetrieveAbove = groupBoxGotoRetrieveOffsets.Controls["textBoxRetrieveAbove"] as BetterTextbox;

            textBoxRetrieveAbove.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.RetrieveAboveOffset, GotoRetrieveConfig.RetrieveAboveDefault);
            BetterTextbox textBoxRetrieveInfront = groupBoxGotoRetrieveOffsets.Controls["textBoxRetrieveInfront"] as BetterTextbox;

            textBoxRetrieveInfront.LostFocus += (sender, e) => textBoxGotoRetrieve_LostFocus(
                sender, ref GotoRetrieveConfig.RetrieveInfrontOffset, GotoRetrieveConfig.RetrieveInfrontDefault);

            // position controller relative angle
            GroupBox    groupBoxPositionControllerRelativeAngle = tabControl.Controls["groupBoxPositionControllerRelativeAngle"] as GroupBox;
            RadioButton radioButtonPositionControllerRelativeAngleRecommended =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleRecommended"] as RadioButton;

            radioButtonPositionControllerRelativeAngleRecommended.Click += (sender, e) =>
                                                                           PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Recommended;
            RadioButton radioButtonPositionControllerRelativeAngleMario =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleMario"] as RadioButton;

            radioButtonPositionControllerRelativeAngleMario.Click += (sender, e) =>
                                                                     PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Mario;
            RadioButton radioButtonPositionControllerRelativeAngleCustom =
                groupBoxPositionControllerRelativeAngle.Controls["radioButtonPositionControllerRelativeAngleCustom"] as RadioButton;

            radioButtonPositionControllerRelativeAngleCustom.Click += (sender, e) =>
                                                                      PositionControllerRelativityConfig.Relativity = PositionControllerRelativity.Custom;
            BetterTextbox textBoxPositionControllerRelativeAngleCustom =
                groupBoxPositionControllerRelativeAngle.Controls["textBoxPositionControllerRelativeAngleCustom"] as BetterTextbox;

            textBoxPositionControllerRelativeAngleCustom.LostFocus += (sender, e) =>
            {
                double value;
                if (double.TryParse((sender as TextBox).Text, out value))
                {
                    PositionControllerRelativityConfig.CustomAngle = value;
                }
                else
                {
                    (sender as TextBox).Text = PositionControllerRelativityConfig.CustomAngle.ToString();
                }
            };

            // object slot overlays
            List <string> objectSlotOverlayTextList = new List <string>()
            {
                "Held Object",
                "Stood On Object",
                "Ridden Object",
                "Interaction Object",
                "Used Object",
                "Closest Object",
                "Camera Object",
                "Camera Hack Object",
                "Floor Object",
                "Wall Object",
                "Ceiling Object",
                "Collision Object",
                "Parent Object",
                "Child Object",
            };

            List <Func <bool> > objectSlotOverlayGetterList = new List <Func <bool> >()
            {
                () => OverlayConfig.ShowOverlayHeldObject,
                () => OverlayConfig.ShowOverlayStoodOnObject,
                () => OverlayConfig.ShowOverlayRiddenObject,
                () => OverlayConfig.ShowOverlayInteractionObject,
                () => OverlayConfig.ShowOverlayUsedObject,
                () => OverlayConfig.ShowOverlayClosestObject,
                () => OverlayConfig.ShowOverlayCameraObject,
                () => OverlayConfig.ShowOverlayCameraHackObject,
                () => OverlayConfig.ShowOverlayFloorObject,
                () => OverlayConfig.ShowOverlayWallObject,
                () => OverlayConfig.ShowOverlayCeilingObject,
                () => OverlayConfig.ShowOverlayCollisionObject,
                () => OverlayConfig.ShowOverlayParentObject,
                () => OverlayConfig.ShowOverlayChildObject,
            };

            List <Action <bool> > objectSlotOverlaySetterList = new List <Action <bool> >()
            {
                (bool value) => OverlayConfig.ShowOverlayHeldObject        = value,
                (bool value) => OverlayConfig.ShowOverlayStoodOnObject     = value,
                (bool value) => OverlayConfig.ShowOverlayRiddenObject      = value,
                (bool value) => OverlayConfig.ShowOverlayInteractionObject = value,
                (bool value) => OverlayConfig.ShowOverlayUsedObject        = value,
                (bool value) => OverlayConfig.ShowOverlayClosestObject     = value,
                (bool value) => OverlayConfig.ShowOverlayCameraObject      = value,
                (bool value) => OverlayConfig.ShowOverlayCameraHackObject  = value,
                (bool value) => OverlayConfig.ShowOverlayFloorObject       = value,
                (bool value) => OverlayConfig.ShowOverlayWallObject        = value,
                (bool value) => OverlayConfig.ShowOverlayCeilingObject     = value,
                (bool value) => OverlayConfig.ShowOverlayCollisionObject   = value,
                (bool value) => OverlayConfig.ShowOverlayParentObject      = value,
                (bool value) => OverlayConfig.ShowOverlayChildObject       = value,
            };

            CheckedListBox checkedListBoxObjectSlotOverlaysToShow = tabControl.Controls["checkedListBoxObjectSlotOverlaysToShow"] as CheckedListBox;

            for (int i = 0; i < objectSlotOverlayTextList.Count; i++)
            {
                checkedListBoxObjectSlotOverlaysToShow.Items.Add(objectSlotOverlayTextList[i], objectSlotOverlayGetterList[i]());
            }
            checkedListBoxObjectSlotOverlaysToShow.ItemCheck += (sender, e) =>
            {
                objectSlotOverlaySetterList[e.Index](e.NewValue == CheckState.Checked);
            };

            Action <bool> setAllObjectSlotOverlays = (bool value) =>
            {
                int specialCount = 2;
                int totalCount   = checkedListBoxObjectSlotOverlaysToShow.Items.Count;
                for (int i = 0; i < totalCount - specialCount; i++)
                {
                    checkedListBoxObjectSlotOverlaysToShow.SetItemChecked(i, value);
                }
            };

            ControlUtilities.AddContextMenuStripFunctions(
                checkedListBoxObjectSlotOverlaysToShow,
                new List <string>()
            {
                "Set All On", "Set All Off"
            },
                new List <Action>()
            {
                () => setAllObjectSlotOverlays(true),
                () => setAllObjectSlotOverlays(false),
            });

            // FPS
            GroupBox      groupBoxFPS      = tabControl.Controls["groupBoxFPS"] as GroupBox;
            BetterTextbox betterTextboxFPS = groupBoxFPS.Controls["betterTextboxFPS"] as BetterTextbox;

            betterTextboxFPS.AddLostFocusAction(
                () =>
            {
                uint value;
                if (uint.TryParse(betterTextboxFPS.Text, out value))
                {
                    RefreshRateConfig.RefreshRateFreq = value;
                }
                else
                {
                    betterTextboxFPS.Text = RefreshRateConfig.RefreshRateFreq.ToString();
                }
            });
        }
Example #8
0
        public VarHackManager(Control varHackControlControl, VarHackPanel varHackPanel)
        {
            _varHackPanel = varHackPanel;

            // Top buttons

            SplitContainer splitContainerVarHack =
                varHackControlControl.Controls["splitContainerVarHack"] as SplitContainer;

            Button buttonVarHackAddNewVariable =
                splitContainerVarHack.Panel1.Controls["buttonVarHackAddNewVariable"] as Button;

            buttonVarHackAddNewVariable.Click +=
                (sender, e) => _varHackPanel.AddNewControl();

            ControlUtilities.AddContextMenuStripFunctions(
                buttonVarHackAddNewVariable,
                new List <string>()
            {
                "RNG Index",
                "Floor YNorm",
                "Defacto Speed",
                "Mario Action",
                "Mario Animation",
            },
                new List <Action>()
            {
                () => AddVariable(() => "Index " + RngIndexer.GetRngIndex()),
                () => AddVariable(() =>
                {
                    uint triFloorAddress = Config.Stream.GetUInt32(MarioConfig.StructAddress + MarioConfig.FloorTriangleOffset);
                    float yNorm          = Config.Stream.GetSingle(triFloorAddress + TriangleOffsetsConfig.NormY);
                    return("YNorm " + FormatDouble(yNorm, 4, true));
                }),
                () => AddVariable(() => "Defacto " + FormatInteger(WatchVariableSpecialUtilities.GetMarioDeFactoSpeed())),
                () => AddVariable(() => "Action " + TableConfig.MarioActions.GetActionName()),
                () => AddVariable(() => "Animation " + TableConfig.MarioAnimations.GetAnimationName()),
            });

            Button buttonVarHackClearVariables =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVariables"] as Button;

            buttonVarHackClearVariables.Click +=
                (sender, e) => _varHackPanel.ClearControls();

            Button buttonVarHackShowVariableBytesInLittleEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInLittleEndian"] as Button;

            buttonVarHackShowVariableBytesInLittleEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInLittleEndian();

            Button buttonVarHackShowVariableBytesInBigEndian =
                splitContainerVarHack.Panel1.Controls["buttonVarHackShowVariableBytesInBigEndian"] as Button;

            buttonVarHackShowVariableBytesInBigEndian.Click +=
                (sender, e) => _varHackPanel.ShowVariableBytesInBigEndian();

            // Bottom buttons

            Button buttonVarHackApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackApplyVariablesToMemory"] as Button;

            buttonVarHackApplyVariablesToMemory.Click +=
                (sender, e) => _varHackPanel.ApplyVariablesToMemory();

            Button buttonVarHackClearVariablesInMemory =
                splitContainerVarHack.Panel1.Controls["buttonVarHackClearVariablesInMemory"] as Button;

            buttonVarHackClearVariablesInMemory.Click +=
                (sender, e) => _varHackPanel.ClearVariablesInMemory();

            _buttonEnableDisableRomHack =
                splitContainerVarHack.Panel1.Controls["buttonEnableDisableRomHack"] as BinaryButton;
            _buttonEnableDisableRomHack.Initialize(
                "Enable ROM Hack",
                "Disable ROM Hack",
                () => VarHackConfig.ShowVarRomHack.LoadPayload(),
                () => VarHackConfig.ShowVarRomHack.ClearPayload(),
                () => VarHackConfig.ShowVarRomHack.Enabled);

            // Middle buttons

            _textBoxXPosValue = splitContainerVarHack.Panel1.Controls["textBoxXPosValue"] as BetterTextbox;
            _textBoxXPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxXPosValue.Text = VarHackConfig.DefaultXPos.ToString();
            InitializePositionControls(
                _textBoxXPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxXPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonXPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonXPosAdd"] as Button);

            _textBoxYPosValue = splitContainerVarHack.Panel1.Controls["textBoxYPosValue"] as BetterTextbox;
            _textBoxYPosValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYPosValue.Text = VarHackConfig.DefaultYPos.ToString();
            InitializePositionControls(
                _textBoxYPosValue,
                splitContainerVarHack.Panel1.Controls["textBoxYPosChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYPosSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYPosAdd"] as Button);

            _textBoxYDeltaValue = splitContainerVarHack.Panel1.Controls["textBoxYDeltaValue"] as BetterTextbox;
            _textBoxYDeltaValue.AddEnterAction(() => SetPositionsAndApplyVariablesToMemory());
            _textBoxYDeltaValue.Text = VarHackConfig.DefaultYDelta.ToString();
            InitializePositionControls(
                _textBoxYDeltaValue,
                splitContainerVarHack.Panel1.Controls["textBoxYDeltaChange"] as TextBox,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaSubtract"] as Button,
                splitContainerVarHack.Panel1.Controls["buttonYDeltaAdd"] as Button);

            Button buttonSetPositionsAndApplyVariablesToMemory =
                splitContainerVarHack.Panel1.Controls["buttonSetPositionsAndApplyVariablesToMemory"] as Button;

            buttonSetPositionsAndApplyVariablesToMemory.Click +=
                (sender, e) => SetPositionsAndApplyVariablesToMemory();
        }
Example #9
0
        public CoinManager(TabPage tabControl)
        {
            // set controls

            SplitContainer splitContainerCoin = tabControl.Controls["splitContainerCoin"] as SplitContainer;

            _dataGridViewCoin = splitContainerCoin.Panel2.Controls["dataGridViewCoin"] as DataGridView;

            _listBoxCoinObjects = splitContainerCoin.Panel1.Controls["listBoxCoinObjects"] as ListBox;

            _textBoxCoinHSpeedScale  = splitContainerCoin.Panel1.Controls["textBoxCoinHSpeedScale"] as BetterTextbox;
            _textBoxCoinVSpeedScale  = splitContainerCoin.Panel1.Controls["textBoxCoinVSpeedScale"] as BetterTextbox;
            _textBoxCoinVSpeedOffset = splitContainerCoin.Panel1.Controls["textBoxCoinVSpeedOffset"] as BetterTextbox;
            _textBoxCoinParamOrder   = splitContainerCoin.Panel1.Controls["textBoxCoinParamOrder"] as BetterTextbox;
            _textBoxCoinNumCoins     = splitContainerCoin.Panel1.Controls["textBoxCoinNumCoins"] as BetterTextbox;

            _labelCoinHSpeedRange  = splitContainerCoin.Panel1.Controls["labelCoinHSpeedRange"] as Label;
            _labelCoinVSpeedRange  = splitContainerCoin.Panel1.Controls["labelCoinVSpeedRange"] as Label;
            _labelCoinTableEntries = splitContainerCoin.Panel1.Controls["labelCoinTableEntries"] as Label;

            GroupBox groupBoxCoinFilter = splitContainerCoin.Panel1.Controls["groupBoxCoinFilter"] as GroupBox;

            _textBoxCoinFilterHSpeedMin = groupBoxCoinFilter.Controls["textBoxCoinFilterHSpeedMin"] as BetterTextbox;
            _textBoxCoinFilterHSpeedMax = groupBoxCoinFilter.Controls["textBoxCoinFilterHSpeedMax"] as BetterTextbox;
            _textBoxCoinFilterVSpeedMin = groupBoxCoinFilter.Controls["textBoxCoinFilterVSpeedMin"] as BetterTextbox;
            _textBoxCoinFilterVSpeedMax = groupBoxCoinFilter.Controls["textBoxCoinFilterVSpeedMax"] as BetterTextbox;
            _textBoxCoinFilterAngleMin  = groupBoxCoinFilter.Controls["textBoxCoinFilterAngleMin"] as BetterTextbox;
            _textBoxCoinFilterAngleMax  = groupBoxCoinFilter.Controls["textBoxCoinFilterAngleMax"] as BetterTextbox;
            _textBoxCoinFilterRequiredNumOfQualifiedCoins =
                groupBoxCoinFilter.Controls["textBoxCoinFilterRequiredNumOfQualifiedCoins"] as BetterTextbox;

            GroupBox groupBoxCoinCustomization =
                splitContainerCoin.Panel1.Controls["groupBoxCoinCustomization"] as GroupBox;

            _checkBoxCoinCustomizatonDisplayNonQualifiedCoinsOfAQualifiedCoinGroup =
                groupBoxCoinCustomization.Controls[
                    "checkBoxCoinCustomizatonDisplayNonQualifiedCoinsOfAQualifiedCoinGroup"] as CheckBox;
            _textBoxCoinCustomizatonNumDecimalDigits =
                groupBoxCoinCustomization.Controls["textBoxCoinCustomizatonNumDecimalDigits"] as BetterTextbox;
            _textBoxCoinCustomizatonStartingRngIndex =
                groupBoxCoinCustomization.Controls["textBoxCoinCustomizatonStartingRngIndex"] as BetterTextbox;

            _buttonCoinClear     = splitContainerCoin.Panel1.Controls["buttonCoinClear"] as Button;
            _buttonCoinCalculate = splitContainerCoin.Panel1.Controls["buttonCoinCalculate"] as Button;

            // initialize controls

            ControlUtilities.SetTableDoubleBuffered(_dataGridViewCoin, true);

            _listBoxCoinObjects.DataSource = CoinObject.GetCoinObjects();
            _listBoxCoinObjects.ClearSelected();
            _listBoxCoinObjects.SelectedValueChanged += (sender, e) => ListBoxSelectionChange();

            _buttonCoinCalculate.Click += (sender, e) => CalculateCoinTrajectories();
            _buttonCoinClear.Click     += (sender, e) => ClearCoinTrajectories();

            Color lightBlue   = Color.FromArgb(235, 255, 255);
            Color lightPink   = Color.FromArgb(255, 240, 255);
            Color lightYellow = Color.FromArgb(255, 255, 220);

            _dataGridViewCoin.Columns[0].DefaultCellStyle.BackColor = lightBlue;
            _dataGridViewCoin.Columns[1].DefaultCellStyle.BackColor = lightBlue;
            _dataGridViewCoin.Columns[2].DefaultCellStyle.BackColor = lightPink;
            _dataGridViewCoin.Columns[3].DefaultCellStyle.BackColor = lightYellow;
            _dataGridViewCoin.Columns[4].DefaultCellStyle.BackColor = lightYellow;
            _dataGridViewCoin.Columns[5].DefaultCellStyle.BackColor = lightYellow;
        }
Example #10
0
        public CustomManager(string varFilePath, Control customControl, WatchVariableFlowLayoutPanel variableTable)
            : base(varFilePath, variableTable)
        {
            EnableCustomization();

            SplitContainer splitContainerCustom         = customControl.Controls["splitContainerCustom"] as SplitContainer;
            SplitContainer splitContainerCustomControls = splitContainerCustom.Panel1.Controls["splitContainerCustomControls"] as SplitContainer;

            // Panel 1 controls

            Button buttonOpenVars = splitContainerCustomControls.Panel1.Controls["buttonOpenVars"] as Button;

            buttonOpenVars.Click += (sender, e) => _variablePanel.OpenVariables();

            Button buttonSaveVars = splitContainerCustomControls.Panel1.Controls["buttonSaveVars"] as Button;

            buttonSaveVars.Click += (sender, e) => _variablePanel.SaveVariables();

            Button buttonClearVars = splitContainerCustomControls.Panel1.Controls["buttonClearVars"] as Button;

            buttonClearVars.Click += (sender, e) => _variablePanel.ClearVariables();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonClearVars,
                new List <string>()
            {
                "Clear All Vars", "Clear Default Vars"
            },
                new List <Action>()
            {
                () => _variablePanel.ClearVariables(),
                () => _variablePanel.RemoveVariableGroup(VariableGroup.NoGroup),
            });

            _checkBoxCustomRecordValues        = splitContainerCustomControls.Panel1.Controls["checkBoxCustomRecordValues"] as CheckBox;
            _checkBoxCustomRecordValues.Click += (sender, e) => ToggleRecording();

            _textBoxRecordValuesCount = splitContainerCustomControls.Panel1.Controls["textBoxRecordValuesCount"] as BetterTextbox;

            _buttonCustomShowValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomShowValues"] as Button;
            _buttonCustomShowValues.Click += (sender, e) => ShowRecordedValues();

            _buttonCustomClearValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomClearValues"] as Button;
            _buttonCustomClearValues.Click += (sender, e) => ClearRecordedValues();

            _checkBoxUseValueAtStartOfGlobalTimer = splitContainerCustomControls.Panel1.Controls["checkBoxUseValueAtStartOfGlobalTimer"] as CheckBox;

            _labelCustomRecordingFrequencyValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingFrequencyValue"] as Label;

            _labelCustomRecordingGapsValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingGapsValue"] as Label;

            _recordedValues = new Dictionary <int, List <object> >();
            _lastTimer      = null;
            _numGaps        = 0;
            _recordFreq     = 1;

            // Panel 2 controls

            Button buttonResetVariableSizeToDefault = splitContainerCustomControls.Panel2.Controls["buttonResetVariableSizeToDefault"] as Button;

            buttonResetVariableSizeToDefault.Click += (sender, e) =>
            {
                WatchVariableControl.VariableNameWidth  = WatchVariableControl.DEFAULT_VARIABLE_NAME_WIDTH;
                WatchVariableControl.VariableValueWidth = WatchVariableControl.DEFAULT_VARIABLE_VALUE_WIDTH;
                WatchVariableControl.VariableHeight     = WatchVariableControl.DEFAULT_VARIABLE_HEIGHT;
            };

            GroupBox groupBoxVarNameWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarNameWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSubtract"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthAdd"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthGet"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSet"] as Button,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthAddSubtract"] as TextBox,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableNameWidth = value; },
                () => WatchVariableControl.VariableNameWidth);

            GroupBox groupBoxVarValueWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarValueWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSubtract"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthAdd"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthGet"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSet"] as Button,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthAddSubtract"] as TextBox,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableValueWidth = value; },
                () => WatchVariableControl.VariableValueWidth);

            GroupBox groupBoxVarHeight = splitContainerCustomControls.Panel2.Controls["groupBoxVarHeight"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarHeight.Controls["buttonVarHeightSubtract"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightAdd"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightGet"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightSet"] as Button,
                groupBoxVarHeight.Controls["betterTextboxVarHeightAddSubtract"] as TextBox,
                groupBoxVarHeight.Controls["betterTextboxVarHeightGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableHeight = value; },
                () => WatchVariableControl.VariableHeight);
        }
Example #11
0
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VarHackContainerForm));
            this.checkBoxUsePointer        = new System.Windows.Forms.CheckBox();
            this.checkBoxNoNumber          = new System.Windows.Forms.CheckBox();
            this.textBoxNameValue          = new STROOP.BetterTextbox();
            this.textBoxNameLabel          = new STROOP.BetterTextbox();
            this.textBoxAddressLabel       = new STROOP.BetterTextbox();
            this.textBoxAddressValue       = new STROOP.BetterTextbox();
            this.textBoxPointerOffsetLabel = new STROOP.BetterTextbox();
            this.textBoxPointerOffsetValue = new STROOP.BetterTextbox();
            this.textBoxXPosLabel          = new STROOP.BetterTextbox();
            this.textBoxYPosLabel          = new STROOP.BetterTextbox();
            this.textBoxXPosValue          = new STROOP.BetterTextbox();
            this.textBoxYPosValue          = new STROOP.BetterTextbox();
            this.checkBoxUseHex            = new System.Windows.Forms.CheckBox();
            this.radioButtonSByte          = new System.Windows.Forms.RadioButton();
            this.radioButtonByte           = new System.Windows.Forms.RadioButton();
            this.radioButtonShort          = new System.Windows.Forms.RadioButton();
            this.radioButtonUShort         = new System.Windows.Forms.RadioButton();
            this.radioButtonInt            = new System.Windows.Forms.RadioButton();
            this.radioButtonUInt           = new System.Windows.Forms.RadioButton();
            this.radioButtonFloat          = new System.Windows.Forms.RadioButton();
            this.pictureBoxUpArrow         = new System.Windows.Forms.PictureBox();
            this.pictureBoxDownArrow       = new System.Windows.Forms.PictureBox();
            this.pictureBoxRedX            = new System.Windows.Forms.PictureBox();

            /*
             * this.SuspendLayout();
             * ((System.ComponentModel.ISupportInitialize)(this.pictureBoxUpArrow)).BeginInit();
             * ((System.ComponentModel.ISupportInitialize)(this.pictureBoxDownArrow)).BeginInit();
             * ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRedX)).BeginInit();
             * this.SuspendLayout();
             */
            //
            // tableLayoutPanel1
            //
            this.ColumnCount     = 6;
            this.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 78F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 107F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 56F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 73F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 36F));
            this.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 29F));
            this.Controls.Add(this.checkBoxUsePointer, 1, 2);
            this.Controls.Add(this.checkBoxNoNumber, 0, 2);
            this.Controls.Add(this.textBoxNameValue, 1, 0);
            this.Controls.Add(this.textBoxNameLabel, 0, 0);
            this.Controls.Add(this.textBoxAddressLabel, 0, 1);
            this.Controls.Add(this.textBoxAddressValue, 1, 1);
            this.Controls.Add(this.textBoxPointerOffsetLabel, 0, 3);
            this.Controls.Add(this.textBoxPointerOffsetValue, 1, 3);
            this.Controls.Add(this.radioButtonSByte, 2, 0);
            this.Controls.Add(this.radioButtonByte, 3, 0);
            this.Controls.Add(this.radioButtonShort, 2, 1);
            this.Controls.Add(this.radioButtonUShort, 3, 1);
            this.Controls.Add(this.radioButtonInt, 2, 2);
            this.Controls.Add(this.radioButtonUInt, 3, 2);
            this.Controls.Add(this.radioButtonFloat, 2, 3);
            this.Controls.Add(this.checkBoxUseHex, 3, 3);
            this.Controls.Add(this.textBoxXPosLabel, 4, 2);
            this.Controls.Add(this.textBoxXPosValue, 5, 2);
            this.Controls.Add(this.textBoxYPosLabel, 4, 3);
            this.Controls.Add(this.textBoxYPosValue, 5, 3);
            this.Controls.Add(this.pictureBoxUpArrow, 4, 0);
            this.Controls.Add(this.pictureBoxDownArrow, 4, 1);
            this.Controls.Add(this.pictureBoxRedX, 5, 0);
            this.Location = new System.Drawing.Point(0, 0);
            this.Name     = "tableLayoutPanel1";
            this.RowCount = 4;
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
            this.Size     = new System.Drawing.Size(401, 99);
            this.TabIndex = 39;
            //
            // checkBoxUsePointer
            //
            this.checkBoxUsePointer.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.checkBoxUsePointer.AutoSize = true;
            this.checkBoxUsePointer.Location = new System.Drawing.Point(81, 51);
            this.checkBoxUsePointer.Name     = "checkBoxUsePointer";
            this.checkBoxUsePointer.Size     = new System.Drawing.Size(81, 17);
            this.checkBoxUsePointer.TabIndex = 4;
            this.checkBoxUsePointer.Text     = "Use Pointer";
            this.checkBoxUsePointer.UseVisualStyleBackColor = true;
            //
            // checkBoxNoNumber
            //
            this.checkBoxNoNumber.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.checkBoxNoNumber.AutoSize = true;
            this.checkBoxNoNumber.Location = new System.Drawing.Point(81, 51);
            this.checkBoxNoNumber.Name     = "checkBoxNoNumber";
            this.checkBoxNoNumber.Size     = new System.Drawing.Size(81, 17);
            this.checkBoxNoNumber.TabIndex = 4;
            this.checkBoxNoNumber.Text     = "No Num";
            this.checkBoxNoNumber.UseVisualStyleBackColor = true;
            this.checkBoxNoNumber.ForeColor = Color.DarkRed;
            //
            // textBoxNameValue
            //
            this.textBoxNameValue.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            this.textBoxNameValue.BackColor = System.Drawing.Color.White;
            this.textBoxNameValue.Location  = new System.Drawing.Point(81, 3);
            this.textBoxNameValue.Name      = "textBoxNameValue";
            this.textBoxNameValue.Size      = new System.Drawing.Size(100, 20);
            this.textBoxNameValue.TabIndex  = 10;
            this.textBoxNameValue.Text      = "Mario X";
            this.textBoxNameValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //this.textBoxNameValue.MaxLength = VarHackConfig.MaxStringLength;
            //
            // textBoxNameLabel
            //
            this.textBoxNameLabel.Anchor      = System.Windows.Forms.AnchorStyles.Right;
            this.textBoxNameLabel.BackColor   = System.Drawing.SystemColors.Control;
            this.textBoxNameLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBoxNameLabel.Location    = new System.Drawing.Point(3, 5);
            this.textBoxNameLabel.Name        = "textBoxNameLabel";
            this.textBoxNameLabel.ReadOnly    = true;
            this.textBoxNameLabel.Size        = new System.Drawing.Size(72, 13);
            this.textBoxNameLabel.TabIndex    = 10;
            this.textBoxNameLabel.Text        = "Name:";
            this.textBoxNameLabel.TextAlign   = System.Windows.Forms.HorizontalAlignment.Right;
            //
            // textBoxAddressLabel
            //
            this.textBoxAddressLabel.Anchor      = System.Windows.Forms.AnchorStyles.Right;
            this.textBoxAddressLabel.BackColor   = System.Drawing.SystemColors.Control;
            this.textBoxAddressLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBoxAddressLabel.Location    = new System.Drawing.Point(3, 29);
            this.textBoxAddressLabel.Name        = "textBoxAddressLabel";
            this.textBoxAddressLabel.ReadOnly    = true;
            this.textBoxAddressLabel.Size        = new System.Drawing.Size(72, 13);
            this.textBoxAddressLabel.TabIndex    = 10;
            this.textBoxAddressLabel.Text        = "Address:";
            this.textBoxAddressLabel.TextAlign   = System.Windows.Forms.HorizontalAlignment.Right;
            //
            // textBoxAddressValue
            //
            this.textBoxAddressValue.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            this.textBoxAddressValue.BackColor = System.Drawing.Color.White;
            this.textBoxAddressValue.Location  = new System.Drawing.Point(81, 27);
            this.textBoxAddressValue.Name      = "textBoxAddressValue";
            this.textBoxAddressValue.Size      = new System.Drawing.Size(100, 20);
            this.textBoxAddressValue.TabIndex  = 10;
            this.textBoxAddressValue.Text      = "0x8033B1AC";
            this.textBoxAddressValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            // textBoxPointerOffsetLabel
            //
            this.textBoxPointerOffsetLabel.Anchor      = System.Windows.Forms.AnchorStyles.Right;
            this.textBoxPointerOffsetLabel.BackColor   = System.Drawing.SystemColors.Control;
            this.textBoxPointerOffsetLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBoxPointerOffsetLabel.Location    = new System.Drawing.Point(3, 79);
            this.textBoxPointerOffsetLabel.Name        = "textBoxPointerOffsetLabel";
            this.textBoxPointerOffsetLabel.ReadOnly    = true;
            this.textBoxPointerOffsetLabel.Size        = new System.Drawing.Size(72, 13);
            this.textBoxPointerOffsetLabel.TabIndex    = 10;
            this.textBoxPointerOffsetLabel.Text        = "Pointer Offset:";
            this.textBoxPointerOffsetLabel.TextAlign   = System.Windows.Forms.HorizontalAlignment.Right;
            //
            // textBoxPointerOffsetValue
            //
            this.textBoxPointerOffsetValue.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            this.textBoxPointerOffsetValue.BackColor = System.Drawing.Color.White;
            this.textBoxPointerOffsetValue.Enabled   = false;
            this.textBoxPointerOffsetValue.Location  = new System.Drawing.Point(81, 75);
            this.textBoxPointerOffsetValue.Name      = "textBoxPointerOffsetValue";
            this.textBoxPointerOffsetValue.Size      = new System.Drawing.Size(100, 20);
            this.textBoxPointerOffsetValue.TabIndex  = 10;
            this.textBoxPointerOffsetValue.Text      = "0x10";
            this.textBoxPointerOffsetValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            // textBoxXPosLabel
            //
            this.textBoxXPosLabel.Anchor      = System.Windows.Forms.AnchorStyles.Right;
            this.textBoxXPosLabel.BackColor   = System.Drawing.SystemColors.Control;
            this.textBoxXPosLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBoxXPosLabel.Location    = new System.Drawing.Point(317, 5);
            this.textBoxXPosLabel.Name        = "textBoxXPosLabel";
            this.textBoxXPosLabel.ReadOnly    = true;
            this.textBoxXPosLabel.Size        = new System.Drawing.Size(30, 13);
            this.textBoxXPosLabel.TabIndex    = 10;
            this.textBoxXPosLabel.Text        = "X Pos:";
            this.textBoxXPosLabel.TextAlign   = System.Windows.Forms.HorizontalAlignment.Right;
            //
            // textBoxYPosLabel
            //
            this.textBoxYPosLabel.Anchor      = System.Windows.Forms.AnchorStyles.Right;
            this.textBoxYPosLabel.BackColor   = System.Drawing.SystemColors.Control;
            this.textBoxYPosLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.textBoxYPosLabel.Location    = new System.Drawing.Point(317, 29);
            this.textBoxYPosLabel.Name        = "textBoxYPosLabel";
            this.textBoxYPosLabel.ReadOnly    = true;
            this.textBoxYPosLabel.Size        = new System.Drawing.Size(30, 13);
            this.textBoxYPosLabel.TabIndex    = 10;
            this.textBoxYPosLabel.Text        = "Y Pos:";
            this.textBoxYPosLabel.TextAlign   = System.Windows.Forms.HorizontalAlignment.Right;
            //
            // textBoxXPosValue
            //
            this.textBoxXPosValue.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            this.textBoxXPosValue.BackColor = System.Drawing.Color.White;
            this.textBoxXPosValue.Location  = new System.Drawing.Point(353, 3);
            this.textBoxXPosValue.Name      = "textBoxXPosValue";
            this.textBoxXPosValue.Size      = new System.Drawing.Size(45, 20);
            this.textBoxXPosValue.TabIndex  = 10;
            this.textBoxXPosValue.Text      = "100";
            this.textBoxXPosValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            // textBoxYPosValue
            //
            this.textBoxYPosValue.Anchor    = System.Windows.Forms.AnchorStyles.Left;
            this.textBoxYPosValue.BackColor = System.Drawing.Color.White;
            this.textBoxYPosValue.Location  = new System.Drawing.Point(353, 27);
            this.textBoxYPosValue.Name      = "textBoxYPosValue";
            this.textBoxYPosValue.Size      = new System.Drawing.Size(45, 20);
            this.textBoxYPosValue.TabIndex  = 10;
            this.textBoxYPosValue.Text      = "200";
            this.textBoxYPosValue.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            //
            // checkBoxUseHex
            //
            this.checkBoxUseHex.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.checkBoxUseHex.AutoSize = true;
            this.checkBoxUseHex.Location = new System.Drawing.Point(244, 77);
            this.checkBoxUseHex.Name     = "checkBoxUseHex";
            this.checkBoxUseHex.Size     = new System.Drawing.Size(67, 17);
            this.checkBoxUseHex.TabIndex = 4;
            this.checkBoxUseHex.Text     = "Use Hex";
            this.checkBoxUseHex.UseVisualStyleBackColor = true;
            //
            // radioButtonSByte
            //
            this.radioButtonSByte.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.radioButtonSByte.AutoSize = true;
            this.radioButtonSByte.Location = new System.Drawing.Point(188, 3);
            this.radioButtonSByte.Name     = "radioButtonSByte";
            this.radioButtonSByte.Size     = new System.Drawing.Size(50, 17);
            this.radioButtonSByte.TabIndex = 11;
            this.radioButtonSByte.Text     = "sbyte";
            this.radioButtonSByte.UseVisualStyleBackColor = true;
            //
            // radioButtonByte
            //
            this.radioButtonByte.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.radioButtonByte.AutoSize = true;
            this.radioButtonByte.Location = new System.Drawing.Point(244, 3);
            this.radioButtonByte.Name     = "radioButtonByte";
            this.radioButtonByte.Size     = new System.Drawing.Size(45, 17);
            this.radioButtonByte.TabIndex = 11;
            this.radioButtonByte.Text     = "byte";
            this.radioButtonByte.UseVisualStyleBackColor = true;
            //
            // radioButtonShort
            //
            this.radioButtonShort.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.radioButtonShort.AutoSize = true;
            this.radioButtonShort.Location = new System.Drawing.Point(188, 27);
            this.radioButtonShort.Name     = "radioButtonShort";
            this.radioButtonShort.Size     = new System.Drawing.Size(48, 17);
            this.radioButtonShort.TabIndex = 11;
            this.radioButtonShort.Text     = "short";
            this.radioButtonShort.UseVisualStyleBackColor = true;
            //
            // radioButtonUShort
            //
            this.radioButtonUShort.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.radioButtonUShort.AutoSize = true;
            this.radioButtonUShort.Location = new System.Drawing.Point(244, 27);
            this.radioButtonUShort.Name     = "radioButtonUShort";
            this.radioButtonUShort.Size     = new System.Drawing.Size(54, 17);
            this.radioButtonUShort.TabIndex = 11;
            this.radioButtonUShort.Text     = "ushort";
            this.radioButtonUShort.UseVisualStyleBackColor = true;
            //
            // radioButtonInt
            //
            this.radioButtonInt.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.radioButtonInt.AutoSize = true;
            this.radioButtonInt.Location = new System.Drawing.Point(188, 51);
            this.radioButtonInt.Name     = "radioButtonInt";
            this.radioButtonInt.Size     = new System.Drawing.Size(36, 17);
            this.radioButtonInt.TabIndex = 11;
            this.radioButtonInt.Text     = "int";
            this.radioButtonInt.UseVisualStyleBackColor = true;
            //
            // radioButtonUInt
            //
            this.radioButtonUInt.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.radioButtonUInt.AutoSize = true;
            this.radioButtonUInt.Location = new System.Drawing.Point(244, 51);
            this.radioButtonUInt.Name     = "radioButtonUInt";
            this.radioButtonUInt.Size     = new System.Drawing.Size(42, 17);
            this.radioButtonUInt.TabIndex = 11;
            this.radioButtonUInt.Text     = "uint";
            this.radioButtonUInt.UseVisualStyleBackColor = true;
            //
            // radioButtonFloat
            //
            this.radioButtonFloat.Anchor   = System.Windows.Forms.AnchorStyles.Left;
            this.radioButtonFloat.AutoSize = true;
            this.radioButtonFloat.Checked  = true;
            this.radioButtonFloat.Location = new System.Drawing.Point(188, 77);
            this.radioButtonFloat.Name     = "radioButtonFloat";
            this.radioButtonFloat.Size     = new System.Drawing.Size(45, 17);
            this.radioButtonFloat.TabIndex = 11;
            this.radioButtonFloat.TabStop  = true;
            this.radioButtonFloat.Text     = "float";
            this.radioButtonFloat.UseVisualStyleBackColor = true;
            //
            // pictureBoxUpArrow
            //
            this.pictureBoxUpArrow.BackgroundImage       = global::STROOP.Properties.Resources.Up_Arrow;
            this.pictureBoxUpArrow.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            //this.pictureBoxUpArrow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxUpArrow.Cursor   = System.Windows.Forms.Cursors.Hand;
            this.pictureBoxUpArrow.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.pictureBoxUpArrow.Location = new System.Drawing.Point(317, 51);
            this.pictureBoxUpArrow.Name     = "pictureBoxUpArrow";
            this.pictureBoxUpArrow.Size     = new System.Drawing.Size(30, 18);
            this.pictureBoxUpArrow.TabIndex = 12;
            this.pictureBoxUpArrow.TabStop  = false;
            //
            // pictureBoxDownArrow
            //
            this.pictureBoxDownArrow.BackgroundImage       = global::STROOP.Properties.Resources.Down_Arrow;
            this.pictureBoxDownArrow.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            //this.pictureBoxDownArrow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxDownArrow.Cursor   = System.Windows.Forms.Cursors.Hand;
            this.pictureBoxDownArrow.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.pictureBoxDownArrow.Location = new System.Drawing.Point(317, 75);
            this.pictureBoxDownArrow.Name     = "pictureBoxDownArrow";
            this.pictureBoxDownArrow.Size     = new System.Drawing.Size(30, 21);
            this.pictureBoxDownArrow.TabIndex = 12;
            this.pictureBoxDownArrow.TabStop  = false;
            //
            // pictureBoxRedX
            //
            this.pictureBoxRedX.BackgroundImage       = global::STROOP.Properties.Resources.Red_X;
            this.pictureBoxRedX.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
            //this.pictureBoxRedX.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.pictureBoxRedX.Cursor   = System.Windows.Forms.Cursors.Hand;
            this.pictureBoxRedX.Dock     = System.Windows.Forms.DockStyle.Fill;
            this.pictureBoxRedX.Location = new System.Drawing.Point(353, 51);
            this.pictureBoxRedX.Name     = "pictureBoxRedX";
            this.SetRowSpan(this.pictureBoxRedX, 2);
            this.pictureBoxRedX.Size     = new System.Drawing.Size(45, 45);
            this.pictureBoxRedX.TabIndex = 12;
            this.pictureBoxRedX.TabStop  = false;
            //
            // VarHackContainerForm
            //

            /*
             * this.ResumeLayout(false);
             * this.PerformLayout();
             * ((System.ComponentModel.ISupportInitialize)(this.pictureBoxUpArrow)).EndInit();
             * ((System.ComponentModel.ISupportInitialize)(this.pictureBoxDownArrow)).EndInit();
             * ((System.ComponentModel.ISupportInitialize)(this.pictureBoxRedX)).EndInit();
             */
        }
Example #12
0
        public CustomManager(List <WatchVariableControlPrecursor> variables, Control customControl, WatchVariablePanel variableTable)
            : base(variables, variableTable)
        {
            EnableCustomVariableFunctionality();

            SplitContainer splitContainerCustom         = customControl.Controls["splitContainerCustom"] as SplitContainer;
            SplitContainer splitContainerCustomControls = splitContainerCustom.Panel1.Controls["splitContainerCustomControls"] as SplitContainer;

            // Panel 1 controls

            Button buttonClearVariables = splitContainerCustomControls.Panel1.Controls["buttonClearVariables"] as Button;

            buttonClearVariables.Click += (sender, e) => ClearVariables();

            _checkBoxCustomRecordValues        = splitContainerCustomControls.Panel1.Controls["checkBoxCustomRecordValues"] as CheckBox;
            _checkBoxCustomRecordValues.Click += (sender, e) => ToggleRecording();

            _textBoxRecordValuesCount = splitContainerCustomControls.Panel1.Controls["textBoxRecordValuesCount"] as BetterTextbox;

            _buttonCustomShowValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomShowValues"] as Button;
            _buttonCustomShowValues.Click += (sender, e) => ShowRecordedValues();

            _buttonCustomClearValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomClearValues"] as Button;
            _buttonCustomClearValues.Click += (sender, e) => ClearRecordedValues();

            _checkBoxUseValueAtStartOfGlobalTimer = splitContainerCustomControls.Panel1.Controls["checkBoxUseValueAtStartOfGlobalTimer"] as CheckBox;

            _labelCustomRecordingFrequencyValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingFrequencyValue"] as Label;

            _labelCustomRecordingGapsValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingGapsValue"] as Label;

            _recordedValues = new Dictionary <int, List <string> >();
            _lastTimer      = null;
            _numGaps        = 0;
            _recordFreq     = 1;

            // Panel 2 controls

            Button buttonResetVariableSizeToDefault = splitContainerCustomControls.Panel2.Controls["buttonResetVariableSizeToDefault"] as Button;

            buttonResetVariableSizeToDefault.Click += (sender, e) =>
            {
                WatchVariableControl.VariableNameWidth  = WatchVariableControl.DEFAULT_VARIABLE_NAME_WIDTH;
                WatchVariableControl.VariableValueWidth = WatchVariableControl.DEFAULT_VARIABLE_VALUE_WIDTH;
                WatchVariableControl.VariableHeight     = WatchVariableControl.DEFAULT_VARIABLE_HEIGHT;
            };

            GroupBox groupBoxVarNameWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarNameWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSubtract"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthAdd"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthGet"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSet"] as Button,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthAddSubtract"] as TextBox,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableNameWidth = value; },
                () => WatchVariableControl.VariableNameWidth);

            GroupBox groupBoxVarValueWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarValueWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSubtract"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthAdd"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthGet"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSet"] as Button,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthAddSubtract"] as TextBox,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableValueWidth = value; },
                () => WatchVariableControl.VariableValueWidth);

            GroupBox groupBoxVarHeight = splitContainerCustomControls.Panel2.Controls["groupBoxVarHeight"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarHeight.Controls["buttonVarHeightSubtract"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightAdd"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightGet"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightSet"] as Button,
                groupBoxVarHeight.Controls["betterTextboxVarHeightAddSubtract"] as TextBox,
                groupBoxVarHeight.Controls["betterTextboxVarHeightGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableHeight = value; },
                () => WatchVariableControl.VariableHeight);
        }
Example #13
0
        public CustomManager(string varFilePath, Control customControl, WatchVariableFlowLayoutPanel variableTable)
            : base(varFilePath, variableTable)
        {
            SplitContainer splitContainerCustom         = customControl.Controls["splitContainerCustom"] as SplitContainer;
            SplitContainer splitContainerCustomControls = splitContainerCustom.Panel1.Controls["splitContainerCustomControls"] as SplitContainer;

            // Panel 1 controls

            Button buttonOpenVars = splitContainerCustomControls.Panel1.Controls["buttonOpenVars"] as Button;

            buttonOpenVars.Click += (sender, e) => _variablePanel.OpenVariables();

            Button buttonSaveVars = splitContainerCustomControls.Panel1.Controls["buttonSaveVars"] as Button;

            buttonSaveVars.Click += (sender, e) => _variablePanel.SaveVariables();

            Button buttonCopyVars = splitContainerCustomControls.Panel1.Controls["buttonCopyVars"] as Button;

            buttonCopyVars.Click           += (sender, e) => CopyUtilities.Copy(_variablePanel.GetCurrentVariableControls(), _copyType);
            buttonCopyVars.ContextMenuStrip = new ContextMenuStrip();
            ToolStripMenuItem itemSetDefaultCopyType = new ToolStripMenuItem("Set Default Copy Type");

            buttonCopyVars.ContextMenuStrip.Items.Add(itemSetDefaultCopyType);
            buttonCopyVars.ContextMenuStrip.Items.Add(new ToolStripSeparator());
            ControlUtilities.AddCheckableDropDownItems(
                itemSetDefaultCopyType,
                CopyUtilities.GetCopyNames(),
                EnumUtilities.GetEnumValues <CopyTypeEnum>(typeof(CopyTypeEnum)),
                copyType => _copyType = copyType,
                _copyType);
            CopyUtilities.AddContextMenuStripFunctions(
                buttonCopyVars, _variablePanel.GetCurrentVariableControls);

            Button buttonClearVars = splitContainerCustomControls.Panel1.Controls["buttonClearVars"] as Button;

            buttonClearVars.Click += (sender, e) => _variablePanel.ClearVariables();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonClearVars,
                new List <string>()
            {
                "Clear All Vars", "Clear Default Vars"
            },
                new List <Action>()
            {
                () => _variablePanel.ClearVariables(),
                () => _variablePanel.RemoveVariableGroup(VariableGroup.NoGroup),
            });

            _checkBoxCustomRecordValues        = splitContainerCustomControls.Panel1.Controls["checkBoxCustomRecordValues"] as CheckBox;
            _checkBoxCustomRecordValues.Click += (sender, e) => ToggleRecording();

            _textBoxRecordValuesCount = splitContainerCustomControls.Panel1.Controls["textBoxRecordValuesCount"] as BetterTextbox;

            _buttonCustomShowValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomShowValues"] as Button;
            _buttonCustomShowValues.Click += (sender, e) => ShowRecordedValues();

            _buttonCustomClearValues        = splitContainerCustomControls.Panel1.Controls["buttonCustomClearValues"] as Button;
            _buttonCustomClearValues.Click += (sender, e) => ClearRecordedValues();

            _checkBoxUseValueAtStartOfGlobalTimer = splitContainerCustomControls.Panel1.Controls["checkBoxUseValueAtStartOfGlobalTimer"] as CheckBox;

            _labelCustomRecordingFrequencyValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingFrequencyValue"] as Label;

            _labelCustomRecordingGapsValue = splitContainerCustomControls.Panel1.Controls["labelCustomRecordingGapsValue"] as Label;

            _recordedValues = new Dictionary <int, List <object> >();
            _lastTimer      = null;
            _numGaps        = 0;
            _recordFreq     = 1;

            // Panel 2 controls

            Button buttonResetVariableSizeToDefault = splitContainerCustomControls.Panel2.Controls["buttonResetVariableSizeToDefault"] as Button;

            buttonResetVariableSizeToDefault.Click += (sender, e) =>
            {
                WatchVariableControl.VariableNameWidth  = WatchVariableControl.DEFAULT_VARIABLE_NAME_WIDTH;
                WatchVariableControl.VariableValueWidth = WatchVariableControl.DEFAULT_VARIABLE_VALUE_WIDTH;
                WatchVariableControl.VariableHeight     = WatchVariableControl.DEFAULT_VARIABLE_HEIGHT;
                WatchVariableControl.VariableTextSize   = WatchVariableControl.DEFAULT_VARIABLE_TEXT_SIZE;
                WatchVariableControl.VariableOffset     = WatchVariableControl.DEFAULT_VARIABLE_OFFSET;
            };

            GroupBox groupBoxVarNameWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarNameWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSubtract"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthAdd"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthGet"] as Button,
                groupBoxVarNameWidth.Controls["buttonVarNameWidthSet"] as Button,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthAddSubtract"] as TextBox,
                groupBoxVarNameWidth.Controls["betterTextboxVarNameWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableNameWidth = value; },
                () => WatchVariableControl.VariableNameWidth);

            GroupBox groupBoxVarValueWidth = splitContainerCustomControls.Panel2.Controls["groupBoxVarValueWidth"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSubtract"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthAdd"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthGet"] as Button,
                groupBoxVarValueWidth.Controls["buttonVarValueWidthSet"] as Button,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthAddSubtract"] as TextBox,
                groupBoxVarValueWidth.Controls["betterTextboxVarValueWidthGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableValueWidth = value; },
                () => WatchVariableControl.VariableValueWidth);

            GroupBox groupBoxVarHeight = splitContainerCustomControls.Panel2.Controls["groupBoxVarHeight"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarHeight.Controls["buttonVarHeightSubtract"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightAdd"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightGet"] as Button,
                groupBoxVarHeight.Controls["buttonVarHeightSet"] as Button,
                groupBoxVarHeight.Controls["betterTextboxVarHeightAddSubtract"] as TextBox,
                groupBoxVarHeight.Controls["betterTextboxVarHeightGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableHeight = value; },
                () => WatchVariableControl.VariableHeight);

            GroupBox groupBoxVarTextSize = splitContainerCustomControls.Panel2.Controls["groupBoxVarTextSize"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarTextSize.Controls["buttonVarTextSizeSubtract"] as Button,
                groupBoxVarTextSize.Controls["buttonVarTextSizeAdd"] as Button,
                groupBoxVarTextSize.Controls["buttonVarTextSizeGet"] as Button,
                groupBoxVarTextSize.Controls["buttonVarTextSizeSet"] as Button,
                groupBoxVarTextSize.Controls["betterTextboxVarTextSizeAddSubtract"] as TextBox,
                groupBoxVarTextSize.Controls["betterTextboxVarTextSizeGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableTextSize = value; },
                () => WatchVariableControl.VariableTextSize);

            GroupBox groupBoxVarOffset = splitContainerCustomControls.Panel2.Controls["groupBoxVarOffset"] as GroupBox;

            InitializeAddSubtractGetSetFuncionality(
                groupBoxVarOffset.Controls["buttonVarOffsetSubtract"] as Button,
                groupBoxVarOffset.Controls["buttonVarOffsetAdd"] as Button,
                groupBoxVarOffset.Controls["buttonVarOffsetGet"] as Button,
                groupBoxVarOffset.Controls["buttonVarOffsetSet"] as Button,
                groupBoxVarOffset.Controls["betterTextboxVarOffsetAddSubtract"] as TextBox,
                groupBoxVarOffset.Controls["betterTextboxVarOffsetGetSet"] as TextBox,
                (int value) => { WatchVariableControl.VariableOffset = value; },
                () => WatchVariableControl.VariableOffset);
        }