示例#1
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();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonOpenVars,
                new List <string>()
            {
                "Open Mario State Data",
            },
                new List <Action>()
            {
                () => _variablePanel.OpenVariables(@"Config/MarioStateData.xml"),
            });

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

            buttonSaveVars.Click += (sender, e) => _variablePanel.SaveVariables();
            ControlUtilities.AddContextMenuStripFunctions(
                buttonSaveVars,
                new List <string>()
            {
                "Save Pop Outs"
            },
                new List <Action>()
            {
                () => FormManager.SavePopOuts()
            });

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

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

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

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

            buttonPasteVars.Click += (sender, e) => PasteUtilities.Paste(_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();

            _labelRecordValuesCount = splitContainerCustomControls.Panel1.Controls["labelRecordValuesCount"] as Label;

            _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);
        }
示例#2
0
        public override void InitializeTab()
        {
            base.InitializeTab();

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

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

            buttonCopyVars.Click           += (sender, e) => CopyUtilities.Copy(watchVariablePanelCustom.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, watchVariablePanelCustom.GetCurrentVariableControls);

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

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

            checkBoxCustomRecordValues.Click += (sender, e) => ToggleRecording();

            buttonCustomShowValues.Click += (sender, e) => ShowRecordedValues();

            buttonCustomClearValues.Click += (sender, e) => ClearRecordedValues();

            // 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;
            };

            InitializeAddSubtractGetSetFuncionality(
                buttonVarNameWidthSubtract,
                buttonVarNameWidthAdd,
                buttonVarNameWidthGet,
                buttonVarNameWidthSet,
                betterTextboxVarNameWidthAddSubtract,
                betterTextboxVarNameWidthGetSet,
                (int value) => { WatchVariableControl.VariableNameWidth = value; },
                () => WatchVariableControl.VariableNameWidth);

            InitializeAddSubtractGetSetFuncionality(
                buttonVarValueWidthSubtract,
                buttonVarValueWidthAdd,
                buttonVarValueWidthGet,
                buttonVarValueWidthSet,
                betterTextboxVarValueWidthAddSubtract,
                betterTextboxVarValueWidthGetSet,
                (int value) => { WatchVariableControl.VariableValueWidth = value; },
                () => WatchVariableControl.VariableValueWidth);

            InitializeAddSubtractGetSetFuncionality(
                buttonVarHeightSubtract,
                buttonVarHeightAdd,
                buttonVarHeightGet,
                buttonVarHeightSet,
                betterTextboxVarHeightAddSubtract,
                betterTextboxVarHeightGetSet,
                (int value) => { WatchVariableControl.VariableHeight = value; },
                () => WatchVariableControl.VariableHeight);

            InitializeAddSubtractGetSetFuncionality(
                buttonVarTextSizeSubtract,
                buttonVarTextSizeAdd,
                buttonVarTextSizeGet,
                buttonVarTextSizeSet,
                betterTextboxVarTextSizeAddSubtract,
                betterTextboxVarTextSizeGetSet,
                (int value) => { WatchVariableControl.VariableTextSize = value; },
                () => WatchVariableControl.VariableTextSize);

            InitializeAddSubtractGetSetFuncionality(
                buttonVarOffsetSubtract,
                buttonVarOffsetAdd,
                buttonVarOffsetGet,
                buttonVarOffsetSet,
                betterTextboxVarOffsetAddSubtract,
                betterTextboxVarOffsetGetSet,
                (int value) => { WatchVariableControl.VariableOffset = value; },
                () => WatchVariableControl.VariableOffset);
        }