Beispiel #1
0
        private void cmb_Variable_Preset_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!ignoreChanges)
            {
                AsmPatch     patch                 = (clb_Patches.SelectedItem as AsmPatch);
                VariableType selectedVariable      = patch.VariableMap[(string)variableComboBox.SelectedItem];
                VariableType.VariablePreset preset = (VariableType.VariablePreset)cmb_Variable_Preset.SelectedItem;
                variableSpinner.Visible = preset.IsModifiable;

                if (!preset.IsModifiable)
                {
                    variableSpinner.Value = preset.Value;
                }
            }
        }
Beispiel #2
0
        private void HandleVariablePresets(VariableType variable)
        {
            if (variable.PresetValues.Count > 0)
            {
                variableSpinner.Location    = new Point(DisplacedVariableSpinnerX, variableSpinner.Location.Y);
                cmb_Variable_Preset.Visible = true;
                cmb_Variable_Preset.Items.Clear();

                int selectedIndex = -1;
                variablePresetIndexMap = new Dictionary <VariableType.VariablePreset, int>();
                VariableType.VariablePreset selectedPreset = FindSelectedPreset(variable);
                for (int index = 0; index < variable.PresetValues.Count; index++)
                {
                    VariableType.VariablePreset preset = variable.PresetValues[index];
                    variablePresetIndexMap.Add(preset, index);
                    cmb_Variable_Preset.Items.Add(preset);
                    if (variable.PresetValues[index] == selectedPreset)
                    {
                        selectedIndex = index;
                    }
                }

                if (selectedPreset == null)
                {
                    cmb_Variable_Preset.SelectedIndex = -1;
                    variableSpinner.Visible           = true;
                }
                else
                {
                    cmb_Variable_Preset.SelectedIndex = selectedIndex;
                    variableSpinner.Visible           = selectedPreset.IsModifiable;
                }
            }
            else
            {
                variableSpinner.Location    = new Point(OriginalVariableSpinnerX, variableSpinner.Location.Y);
                cmb_Variable_Preset.Visible = false;
                variableSpinner.Visible     = true;
            }
        }