Example #1
0
 public override bool OnDoubleClick()
 {
     base.OnDoubleClick();
     DialogResult result = DialogResult.None;
     if (SupportedTypes.Length == 1 && SupportedTypes[0].IsEnum)
     {
         var form = new SelectionForm();
         form.Text = Name ?? "Select item from list";
         form.Items = SupportedTypes[0].GetEnumNames();
         int index = Array.IndexOf(SupportedTypes[0].GetEnumNames(), ValueState.Text);
         if (index == -1)
             index = 0;
         form.SelectedIndex = index;
         result = form.ShowDialog();
         if (result == DialogResult.OK)
         {
             ValueState = new ValueItemState(form.Items[form.SelectedIndex], SupportedTypes[0]);
         }
     }
     else
     {
         var form = new ValueBoxForm();
         form.Text = Name ?? "Value editor";
         form.SetSupportedTypes(SupportedTypes);
         form.InputText = ValueState.Text;
         form.InputType = ValueState.Type;
         form.EnableTypeComboBox = EnableTypeField;
         result = form.ShowDialog();
         if (result == DialogResult.OK && ValueItemState.TryParse(form.InputText, form.InputType) != null)
         {
             ValueState = new ValueItemState(form.InputText, form.InputType);
         }
     }
     return true;
 }
Example #2
0
 public override bool OnDoubleClick()
 {
     base.OnDoubleClick();
     var form = new SelectionForm();
     form.Text = Name ?? "Select item from list";
     form.Items = Items;
     form.SelectedIndex = SelectedIndex;
     var result = form.ShowDialog();
     if (result == DialogResult.OK)
         SelectedIndex = form.SelectedIndex;
     return true;
 }
Example #3
0
        private void OpenSelectionInputType_CurrentRow()
        {
            if (null != GridAlgorithms.CurrentRow)
            {
                RowBatchAlgorithm row = (RowBatchAlgorithm)GridAlgorithms.CurrentRow.DataBoundItem;
                if (null != row)
                {
                    BatchFilterFactory.NodeFilterInputType value = row.Item3;

                    IEnumerable<BatchFilterFactory.NodeFilterInputType> values =
                            (IEnumerable<BatchFilterFactory.NodeFilterInputType>)
                            Enum.GetValues(typeof(BatchFilterFactory.NodeFilterInputType));

                    SelectionForm<string> sel = new SelectionForm<string>(
                            values.Select(s => s.ToString()).ToArray(),
                            false);

                    sel.ShowDialog(this);
                    if (sel.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        if (null != sel.Selection && sel.Selection.Length > 0)
                        {
                            value = (BatchFilterFactory.NodeFilterInputType)Enum.Parse(typeof(BatchFilterFactory.NodeFilterInputType), sel.Selection[0]);

                            BindingList<RowBatchAlgorithm> datasource = (BindingList<RowBatchAlgorithm>)GridAlgorithms.DataSource;

                            datasource[GridAlgorithms.CurrentRow.Index] = new RowBatchAlgorithm(
                                    row.Item1, row.Item2, value, row.Item4, row.Item5);

                        }
                    }
                    sel.Dispose();
                }
            }
        }
        private void gridExecution_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                    return;

                switch (e.ColumnIndex)
                {
                    case 0:
                        IEnumerable<MetricExecutionType> values = (IEnumerable<MetricExecutionType>)Enum.GetValues(typeof(MetricExecutionType));

                        SelectionForm<string> sel = new SelectionForm<string>(
                                 values.Select(s => s.ToString()).ToArray(),
                                 false);

                        sel.ShowDialog(this);
                        if (sel.DialogResult == System.Windows.Forms.DialogResult.OK)
                        {
                            RowMetricExecution r = (RowMetricExecution)gridExecution.Rows[e.RowIndex].DataBoundItem;

                            BindingList<RowMetricExecution> datasource = (BindingList<RowMetricExecution>)gridExecution.DataSource;

                            datasource[e.RowIndex] = new RowMetricExecution(
                                    r.Item1,
                                    (MetricExecutionType)Enum.Parse(typeof(MetricExecutionType), sel.Selection[0]),
                                    r.Item3);

                        }
                        sel.Dispose();

                        break;
                    case 1:
                        RowMetricExecution r2 = (RowMetricExecution)gridExecution.Rows[e.RowIndex].DataBoundItem;

                        if (r2.Item2 != MetricExecutionType.RefOutput)
                        {
                            MessageBox.Show("Set to ExecutionType.InputOutput first!!!");
                            return;
                        }

                        SelectionForm<Image> sel2 = new SelectionForm<Image>(_references, false);
                        sel2.ShowDialog(this);
                        if (sel2.DialogResult == System.Windows.Forms.DialogResult.OK)
                        {
                            BindingList<RowMetricExecution> datasource = (BindingList<RowMetricExecution>)gridExecution.DataSource;

                            datasource[e.RowIndex] = new RowMetricExecution(r2.Item1, r2.Item2, new WeakImage(sel2.Selection[0]));
                        }
                        sel2.Dispose();

                        break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }
        }
        public override object EditValue(ITypeDescriptorContext context,
            IServiceProvider provider, object value)
        {
            DTE dte = (DTE)provider.GetService(typeof(DTE));

            try
            {
                List<NameValueItem> nvitems = this.GetItems(dte, provider);

                SortItems(nvitems);

                object svc = provider.GetService(typeof(IWindowsFormsEditorService));
                if (svc == null)
                {
                    return base.EditValue(context, provider, value);
                }

                SelectionForm form = new SelectionForm(nvitems, value, true);
                if (((IWindowsFormsEditorService)svc).ShowDialog(form) == DialogResult.OK)
                {
                    if (value is NameValueItem[])
                    {
                        return form.SelectedNameValueItems;
                    }
                    else
                    {
                        return form.SelectedNameValueItem;
                    }
                }
                else
                {
                    return value;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            return null;
        }
        public static List <ToolStripItem> CreateSelectionToolStripItems(
            Func <List <WatchVariableControl> > getVars,
            WatchVariableFlowLayoutPanel panel)
        {
            Action <WatchVariableControlSettings, List <WatchVariableControl> > apply2 =
                (WatchVariableControlSettings settings, List <WatchVariableControl> vars) =>
            {
                if (KeyboardUtilities.IsCtrlHeld())
                {
                    WatchVariableControlSettingsManager.AddSettings(settings);
                }
                else
                {
                    vars.ForEach(control => control.ApplySettings(settings));
                }
            };

            Action <WatchVariableControlSettings> apply = (WatchVariableControlSettings settings) => apply2(settings, getVars());

            ToolStripMenuItem itemHighlight = new ToolStripMenuItem("Highlight...");

            ControlUtilities.AddDropDownItems(
                itemHighlight,
                new List <string>()
            {
                "Highlight", "Don't Highlight"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeHighlighted: true, newHighlighted: true)),
                () => apply(new WatchVariableControlSettings(changeHighlighted: true, newHighlighted: false)),
            });
            ToolStripMenuItem itemHighlightColor = new ToolStripMenuItem("Color...");

            ControlUtilities.AddDropDownItems(
                itemHighlightColor,
                new List <string>()
            {
                "Red",
                "Orange",
                "Yellow",
                "Green",
                "Blue",
                "Purple",
                "Pink",
                "Brown",
                "Black",
                "White",
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Red)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Orange)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Yellow)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Green)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Blue)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Purple)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Pink)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Brown)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.Black)),
                () => apply(new WatchVariableControlSettings(changeHighlightColor: true, newHighlightColor: Color.White)),
            });
            itemHighlight.DropDownItems.Add(itemHighlightColor);

            ToolStripMenuItem itemLock = new ToolStripMenuItem("Lock...");

            ControlUtilities.AddDropDownItems(
                itemLock,
                new List <string>()
            {
                "Lock", "Don't Lock"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeLocked: true, newLocked: true)),
                () => apply(new WatchVariableControlSettings(changeLocked: true, newLocked: false)),
            });

            ToolStripMenuItem itemFixAddress = new ToolStripMenuItem("Fix Address...");

            ControlUtilities.AddDropDownItems(
                itemFixAddress,
                new List <string>()
            {
                "Default", "Fix Address", "Don't Fix Address"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeFixedAddress: true, changeFixedAddressToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeFixedAddress: true, newFixedAddress: true)),
                () => apply(new WatchVariableControlSettings(changeFixedAddress: true, newFixedAddress: false)),
            });

            ToolStripMenuItem itemCopy = new ToolStripMenuItem("Copy...");

            CopyUtilities.AddDropDownItems(itemCopy, getVars);

            ToolStripMenuItem itemPaste = new ToolStripMenuItem("Paste");

            itemPaste.Click += (sender, e) =>
            {
                List <WatchVariableControl> varList = getVars();
                List <string> stringList            = ParsingUtilities.ParseStringList(Clipboard.GetText());
                if (stringList.Count == 0)
                {
                    return;
                }

                Config.Stream.Suspend();
                for (int i = 0; i < varList.Count; i++)
                {
                    varList[i].SetValue(stringList[i % stringList.Count]);
                }
                Config.Stream.Resume();
            };

            ToolStripMenuItem itemRoundTo        = new ToolStripMenuItem("Round to...");
            ToolStripMenuItem itemRoundToDefault = new ToolStripMenuItem("Default");

            itemRoundToDefault.Click += (sender, e) =>
                                        apply(new WatchVariableControlSettings(
                                                  changeRoundingLimit: true, changeRoundingLimitToDefault: true));
            ToolStripMenuItem itemRoundToNoRounding = new ToolStripMenuItem("No Rounding");

            itemRoundToNoRounding.Click += (sender, e) =>
                                           apply(new WatchVariableControlSettings(
                                                     changeRoundingLimit: true, newRoundingLimit: -1));
            List <ToolStripMenuItem> itemsRoundToNumDecimalPlaces = new List <ToolStripMenuItem>();

            for (int i = 0; i <= 10; i++)
            {
                int index = i;
                itemsRoundToNumDecimalPlaces.Add(new ToolStripMenuItem(index + " decimal place(s)"));
                itemsRoundToNumDecimalPlaces[index].Click += (sender, e) =>
                                                             apply(new WatchVariableControlSettings(
                                                                       changeRoundingLimit: true, newRoundingLimit: index));
            }
            itemRoundTo.DropDownItems.Add(itemRoundToDefault);
            itemRoundTo.DropDownItems.Add(itemRoundToNoRounding);
            itemsRoundToNumDecimalPlaces.ForEach(setAllRoundingLimitsNumberItem =>
            {
                itemRoundTo.DropDownItems.Add(setAllRoundingLimitsNumberItem);
            });

            ToolStripMenuItem itemDisplayAsHex = new ToolStripMenuItem("Display as Hex...");

            ControlUtilities.AddDropDownItems(
                itemDisplayAsHex,
                new List <string>()
            {
                "Default", "Hex", "Decimal"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeDisplayAsHex: true, changeDisplayAsHexToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeDisplayAsHex: true, newDisplayAsHex: true)),
                () => apply(new WatchVariableControlSettings(changeDisplayAsHex: true, newDisplayAsHex: false)),
            });

            ToolStripMenuItem itemAngleSigned = new ToolStripMenuItem("Angle: Signed...");

            ControlUtilities.AddDropDownItems(
                itemAngleSigned,
                new List <string>()
            {
                "Default", "Unsigned", "Signed"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleSigned: true, changeAngleSignedToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleSigned: true, newAngleSigned: false)),
                () => apply(new WatchVariableControlSettings(changeAngleSigned: true, newAngleSigned: true)),
            });

            ToolStripMenuItem itemAngleUnits        = new ToolStripMenuItem("Angle: Units...");
            ToolStripMenuItem itemAngleUnitsDefault = new ToolStripMenuItem("Default");

            itemAngleUnitsDefault.Click += (sender, e) =>
                                           apply(new WatchVariableControlSettings(
                                                     changeAngleUnits: true, changeAngleUnitsToDefault: true));
            List <ToolStripMenuItem> itemsAngleUnitsValue = new List <ToolStripMenuItem>();

            foreach (AngleUnitType angleUnitType in Enum.GetValues(typeof(AngleUnitType)))
            {
                AngleUnitType angleUnitTypeFixed = angleUnitType;
                string        stringValue        = angleUnitTypeFixed.ToString();
                if (stringValue == AngleUnitType.InGameUnits.ToString())
                {
                    stringValue = "In-Game Units";
                }
                ToolStripMenuItem itemAngleUnitsValue = new ToolStripMenuItem(stringValue);
                itemAngleUnitsValue.Click += (sender, e) =>
                                             apply(new WatchVariableControlSettings(
                                                       changeAngleUnits: true, newAngleUnits: angleUnitTypeFixed));
                itemsAngleUnitsValue.Add(itemAngleUnitsValue);
            }
            itemAngleUnits.DropDownItems.Add(itemAngleUnitsDefault);
            itemsAngleUnitsValue.ForEach(setAllAngleUnitsValuesItem =>
            {
                itemAngleUnits.DropDownItems.Add(setAllAngleUnitsValuesItem);
            });

            ToolStripMenuItem itemAngleTruncateToMultipleOf16 = new ToolStripMenuItem("Angle: Truncate to Multiple of 16...");

            ControlUtilities.AddDropDownItems(
                itemAngleTruncateToMultipleOf16,
                new List <string>()
            {
                "Default", "Truncate to Multiple of 16", "Don't Truncate to Multiple of 16"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleTruncateToMultipleOf16: true, changeAngleTruncateToMultipleOf16ToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleTruncateToMultipleOf16: true, newAngleTruncateToMultipleOf16: true)),
                () => apply(new WatchVariableControlSettings(changeAngleTruncateToMultipleOf16: true, newAngleTruncateToMultipleOf16: false)),
            });

            ToolStripMenuItem itemAngleConstrainToOneRevolution = new ToolStripMenuItem("Angle: Constrain to One Revolution...");

            ControlUtilities.AddDropDownItems(
                itemAngleConstrainToOneRevolution,
                new List <string>()
            {
                "Default", "Constrain to One Revolution", "Don't Constrain to One Revolution"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleConstrainToOneRevolution: true, changeAngleConstrainToOneRevolutionToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleConstrainToOneRevolution: true, newAngleConstrainToOneRevolution: true)),
                () => apply(new WatchVariableControlSettings(changeAngleConstrainToOneRevolution: true, newAngleConstrainToOneRevolution: false)),
            });

            ToolStripMenuItem itemAngleReverse = new ToolStripMenuItem("Angle: Reverse...");

            ControlUtilities.AddDropDownItems(
                itemAngleReverse,
                new List <string>()
            {
                "Default", "Reverse", "Don't Reverse"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleReverse: true, changeAngleReverseToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleReverse: true, newAngleReverse: true)),
                () => apply(new WatchVariableControlSettings(changeAngleReverse: true, newAngleReverse: false)),
            });

            ToolStripMenuItem itemAngleDisplayAsHex = new ToolStripMenuItem("Angle: Display as Hex...");

            ControlUtilities.AddDropDownItems(
                itemAngleDisplayAsHex,
                new List <string>()
            {
                "Default", "Hex", "Decimal"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleDisplayAsHex: true, changeAngleDisplayAsHexToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleDisplayAsHex: true, newAngleDisplayAsHex: true)),
                () => apply(new WatchVariableControlSettings(changeAngleDisplayAsHex: true, newAngleDisplayAsHex: false)),
            });

            ToolStripMenuItem itemShowVariableXml = new ToolStripMenuItem("Show Variable XML");

            itemShowVariableXml.Click += (sender, e) =>
            {
                InfoForm infoForm = new InfoForm();
                infoForm.SetText(
                    "Variable Info",
                    "Variable XML",
                    String.Join("\r\n", getVars().ConvertAll(control => control.ToXml(true))));
                infoForm.Show();
            };

            ToolStripMenuItem itemShowVariableInfo = new ToolStripMenuItem("Show Variable Info");

            itemShowVariableInfo.Click += (sender, e) =>
            {
                InfoForm infoForm = new InfoForm();
                infoForm.SetText(
                    "Variable Info",
                    "Variable Info",
                    String.Join("\t",
                                WatchVariableWrapper.GetVarInfoLabels()) +
                    "\r\n" +
                    String.Join(
                        "\r\n",
                        getVars().ConvertAll(control => control.GetVarInfo())
                        .ConvertAll(infoList => String.Join("\t", infoList))));
                infoForm.Show();
            };

            void createBinaryMathOperationVariable(BinaryMathOperation operation)
            {
                List <WatchVariableControl> controls = getVars();

                if (controls.Count % 2 == 1)
                {
                    controls.RemoveAt(controls.Count - 1);
                }

                for (int i = 0; i < controls.Count / 2; i++)
                {
                    WatchVariableControl control1 = controls[i];
                    WatchVariableControl control2 = controls[i + controls.Count / 2];
                    string specialType            = WatchVariableSpecialUtilities.AddBinaryMathOperationEntry(control1, control2, operation);

                    WatchVariable watchVariable =
                        new WatchVariable(
                            memoryTypeName: null,
                            specialType: specialType,
                            baseAddressType: BaseAddressTypeEnum.None,
                            offsetUS: null,
                            offsetJP: null,
                            offsetSH: null,
                            offsetEU: null,
                            offsetDefault: null,
                            mask: null,
                            shift: null,
                            handleMapping: true);
                    WatchVariableControlPrecursor precursor =
                        new WatchVariableControlPrecursor(
                            name: string.Format("{0} {1} {2}", control1.VarName, MathOperationUtilities.GetSymbol(operation), control2.VarName),
                            watchVar: watchVariable,
                            subclass: WatchVariableSubclass.Number,
                            backgroundColor: null,
                            displayType: null,
                            roundingLimit: null,
                            useHex: null,
                            invertBool: null,
                            isYaw: null,
                            coordinate: null,
                            groupList: new List <VariableGroup>()
                    {
                        VariableGroup.Custom
                    });
                    WatchVariableControl control = precursor.CreateWatchVariableControl();
                    panel.AddVariable(control);
                }
            }

            void createAggregateMathOperationVariable(AggregateMathOperation operation)
            {
                List <WatchVariableControl> controls = getVars();

                if (controls.Count == 0)
                {
                    return;
                }
                string        specialType   = WatchVariableSpecialUtilities.AddAggregateMathOperationEntry(controls, operation);
                WatchVariable watchVariable =
                    new WatchVariable(
                        memoryTypeName: null,
                        specialType: specialType,
                        baseAddressType: BaseAddressTypeEnum.None,
                        offsetUS: null,
                        offsetJP: null,
                        offsetSH: null,
                        offsetEU: null,
                        offsetDefault: null,
                        mask: null,
                        shift: null,
                        handleMapping: true);
                WatchVariableControlPrecursor precursor =
                    new WatchVariableControlPrecursor(
                        name: operation.ToString(),
                        watchVar: watchVariable,
                        subclass: WatchVariableSubclass.Number,
                        backgroundColor: null,
                        displayType: null,
                        roundingLimit: null,
                        useHex: null,
                        invertBool: null,
                        isYaw: null,
                        coordinate: null,
                        groupList: new List <VariableGroup>()
                {
                    VariableGroup.Custom
                });
                WatchVariableControl control = precursor.CreateWatchVariableControl();

                panel.AddVariable(control);
            }

            void createDistanceMathOperationVariable(bool use3D)
            {
                List <WatchVariableControl> controls = getVars();
                bool satisfies2D = !use3D && controls.Count >= 4;
                bool satisfies3D = use3D && controls.Count >= 6;

                if (!satisfies2D && !satisfies3D)
                {
                    return;
                }
                string specialType = WatchVariableSpecialUtilities.AddDistanceMathOperationEntry(controls, use3D);
                string name        = use3D ?
                                     string.Format(
                    "({0},{1},{2}) to ({3},{4},{5})",
                    controls[0].VarName,
                    controls[1].VarName,
                    controls[2].VarName,
                    controls[3].VarName,
                    controls[4].VarName,
                    controls[5].VarName) :
                                     string.Format(
                    "({0},{1}) to ({2},{3})",
                    controls[0].VarName,
                    controls[1].VarName,
                    controls[2].VarName,
                    controls[3].VarName);
                WatchVariable watchVariable =
                    new WatchVariable(
                        memoryTypeName: null,
                        specialType: specialType,
                        baseAddressType: BaseAddressTypeEnum.None,
                        offsetUS: null,
                        offsetJP: null,
                        offsetSH: null,
                        offsetEU: null,
                        offsetDefault: null,
                        mask: null,
                        shift: null,
                        handleMapping: true);
                WatchVariableControlPrecursor precursor =
                    new WatchVariableControlPrecursor(
                        name: name,
                        watchVar: watchVariable,
                        subclass: WatchVariableSubclass.Number,
                        backgroundColor: null,
                        displayType: null,
                        roundingLimit: null,
                        useHex: null,
                        invertBool: null,
                        isYaw: null,
                        coordinate: null,
                        groupList: new List <VariableGroup>()
                {
                    VariableGroup.Custom
                });
                WatchVariableControl control = precursor.CreateWatchVariableControl();

                panel.AddVariable(control);
            }

            void createRealTimeVariable()
            {
                List <WatchVariableControl> controls = getVars();

                for (int i = 0; i < controls.Count; i++)
                {
                    WatchVariableControl control = controls[i];
                    string specialType           = WatchVariableSpecialUtilities.AddRealTimeEntry(control);

                    WatchVariable watchVariable =
                        new WatchVariable(
                            memoryTypeName: null,
                            specialType: specialType,
                            baseAddressType: BaseAddressTypeEnum.None,
                            offsetUS: null,
                            offsetJP: null,
                            offsetSH: null,
                            offsetEU: null,
                            offsetDefault: null,
                            mask: null,
                            shift: null,
                            handleMapping: true);
                    WatchVariableControlPrecursor precursor =
                        new WatchVariableControlPrecursor(
                            name: string.Format("{0} Real Time", control.VarName),
                            watchVar: watchVariable,
                            subclass: WatchVariableSubclass.String,
                            backgroundColor: null,
                            displayType: null,
                            roundingLimit: null,
                            useHex: null,
                            invertBool: null,
                            isYaw: null,
                            coordinate: null,
                            groupList: new List <VariableGroup>()
                    {
                        VariableGroup.Custom
                    });
                    WatchVariableControl control2 = precursor.CreateWatchVariableControl();
                    panel.AddVariable(control2);
                }
            }

            ToolStripMenuItem itemAddVariables = new ToolStripMenuItem("Add Variable(s)...");

            ControlUtilities.AddDropDownItems(
                itemAddVariables,
                new List <string>()
            {
                "Addition",
                "Subtraction",
                "Multiplication",
                "Division",
                "Modulo",
                "Non-Negative Modulo",
                "Exponent",
                null,
                "Mean",
                "Median",
                "Min",
                "Max",
                null,
                "2D Distance",
                "3D Distance",
                null,
                "Real Time",
            },
                new List <Action>()
            {
                () => createBinaryMathOperationVariable(BinaryMathOperation.Add),
                () => createBinaryMathOperationVariable(BinaryMathOperation.Subtract),
                () => createBinaryMathOperationVariable(BinaryMathOperation.Multiply),
                () => createBinaryMathOperationVariable(BinaryMathOperation.Divide),
                () => createBinaryMathOperationVariable(BinaryMathOperation.Modulo),
                () => createBinaryMathOperationVariable(BinaryMathOperation.NonNegativeModulo),
                () => createBinaryMathOperationVariable(BinaryMathOperation.Exponent),
                () => { },
                () => createAggregateMathOperationVariable(AggregateMathOperation.Mean),
                () => createAggregateMathOperationVariable(AggregateMathOperation.Median),
                () => createAggregateMathOperationVariable(AggregateMathOperation.Min),
                () => createAggregateMathOperationVariable(AggregateMathOperation.Max),
                () => { },
                () => createDistanceMathOperationVariable(use3D: false),
                () => createDistanceMathOperationVariable(use3D: true),
                () => { },
                () => createRealTimeVariable(),
            });

            ToolStripMenuItem itemSetCascadingValues = new ToolStripMenuItem("Set Cascading Values");

            itemSetCascadingValues.Click += (sender, e) =>
            {
                List <WatchVariableControl> controls = getVars();
                object value1 = DialogUtilities.GetStringFromDialog(labelText: "Base Value:");
                object value2 = DialogUtilities.GetStringFromDialog(labelText: "Offset Value:");
                if (value1 == null || value2 == null)
                {
                    return;
                }
                double?number1 = ParsingUtilities.ParseDoubleNullable(value1);
                double?number2 = ParsingUtilities.ParseDoubleNullable(value2);
                if (!number1.HasValue || !number2.HasValue)
                {
                    return;
                }
                List <Func <object, bool> > setters = controls.SelectMany(control => control.GetSetters()).ToList();
                for (int i = 0; i < setters.Count; i++)
                {
                    setters[i](number1.Value + i * number2.Value);
                }
            };

            List <string> backgroundColorStringList = new List <string>();
            List <Action> backgroundColorActionList = new List <Action>();

            backgroundColorStringList.Add("Default");
            backgroundColorActionList.Add(
                () => apply(new WatchVariableControlSettings(changeBackgroundColor: true, changeBackgroundColorToDefault: true)));
            foreach (KeyValuePair <string, string> pair in ColorUtilities.ColorToParamsDictionary)
            {
                Color  color       = ColorTranslator.FromHtml(pair.Value);
                string colorString = pair.Key;
                if (colorString == "LightBlue")
                {
                    colorString = "Light Blue";
                }
                backgroundColorStringList.Add(colorString);
                backgroundColorActionList.Add(
                    () => apply(new WatchVariableControlSettings(changeBackgroundColor: true, newBackgroundColor: color)));
            }
            backgroundColorStringList.Add("Control (No Color)");
            backgroundColorActionList.Add(
                () => apply(new WatchVariableControlSettings(changeBackgroundColor: true, newBackgroundColor: SystemColors.Control)));
            backgroundColorStringList.Add("Custom Color");
            backgroundColorActionList.Add(
                () =>
            {
                List <WatchVariableControl> vars = getVars();
                Color?newColor = ColorUtilities.GetColorFromDialog(SystemColors.Control);
                if (newColor.HasValue)
                {
                    apply2(new WatchVariableControlSettings(changeBackgroundColor: true, newBackgroundColor: newColor.Value), vars);
                    ColorUtilities.LastCustomColor = newColor.Value;
                }
            });
            backgroundColorStringList.Add("Last Custom Color");
            backgroundColorActionList.Add(
                () => apply(new WatchVariableControlSettings(changeBackgroundColor: true, newBackgroundColor: ColorUtilities.LastCustomColor)));
            ToolStripMenuItem itemBackgroundColor = new ToolStripMenuItem("Background Color...");

            ControlUtilities.AddDropDownItems(
                itemBackgroundColor,
                backgroundColorStringList,
                backgroundColorActionList);

            ToolStripMenuItem itemMove = new ToolStripMenuItem("Move...");

            ControlUtilities.AddDropDownItems(
                itemMove,
                new List <string>()
            {
                "Start Move", "End Move", "Clear Move"
            },
                new List <Action>()
            {
                () => panel.NotifyOfReorderingStart(getVars()),
                () => panel.NotifyOfReorderingEnd(getVars()),
                () => panel.NotifyOfReorderingClear(),
            });

            ToolStripMenuItem itemRemove = new ToolStripMenuItem("Remove");

            itemRemove.Click += (sender, e) => panel.RemoveVariables(getVars());

            ToolStripMenuItem itemRename = new ToolStripMenuItem("Rename...");

            itemRename.Click += (sender, e) =>
            {
                List <WatchVariableControl> watchVars = getVars();
                string template = DialogUtilities.GetStringFromDialog("$");
                if (template == null)
                {
                    return;
                }
                foreach (WatchVariableControl control in watchVars)
                {
                    control.VarName = template.Replace("$", control.VarName);
                }
            };

            ToolStripMenuItem itemOpenController = new ToolStripMenuItem("Open Controller");

            itemOpenController.Click += (sender, e) =>
            {
                List <WatchVariableControl> vars          = getVars();
                VariableControllerForm      varController =
                    new VariableControllerForm(
                        vars.ConvertAll(control => control.VarName),
                        vars.ConvertAll(control => control.WatchVarWrapper),
                        vars.ConvertAll(control => control.FixedAddressList));
                varController.Show();
            };

            ToolStripMenuItem itemOpenTripletController = new ToolStripMenuItem("Open Triplet Controller");

            itemOpenTripletController.Click += (sender, e) =>
            {
                VariableTripletControllerForm form = new VariableTripletControllerForm();
                form.Initialize(getVars().ConvertAll(control => control.CreateCopy()));
                form.ShowForm();
            };

            ToolStripMenuItem itemOpenPopOut = new ToolStripMenuItem("Open Pop Out");

            itemOpenPopOut.Click += (sender, e) =>
            {
                VariablePopOutForm form = new VariablePopOutForm();
                form.Initialize(getVars().ConvertAll(control => control.CreateCopy()));
                form.ShowForm();
            };

            ToolStripMenuItem itemAddToTab = new ToolStripMenuItem("Add to Tab...");

            ControlUtilities.AddDropDownItems(
                itemAddToTab,
                new List <string>()
            {
                "Regular", "Fixed", "Grouped by Base Address", "Grouped by Variable"
            },
                new List <Action>()
            {
                () => SelectionForm.ShowDataManagerSelectionForm(getVars(), AddToTabTypeEnum.Regular),
                () => SelectionForm.ShowDataManagerSelectionForm(getVars(), AddToTabTypeEnum.Fixed),
                () => SelectionForm.ShowDataManagerSelectionForm(getVars(), AddToTabTypeEnum.GroupedByBaseAddress),
                () => SelectionForm.ShowDataManagerSelectionForm(getVars(), AddToTabTypeEnum.GroupedByVariable),
            });

            ToolStripMenuItem itemAddToCustomTab = new ToolStripMenuItem("Add to Custom Tab...");

            ControlUtilities.AddDropDownItems(
                itemAddToCustomTab,
                new List <string>()
            {
                "Regular", "Fixed", "Grouped by Base Address", "Grouped by Variable"
            },
                new List <Action>()
            {
                () => WatchVariableControl.AddVarsToTab(getVars(), Config.CustomManager, AddToTabTypeEnum.Regular),
                () => WatchVariableControl.AddVarsToTab(getVars(), Config.CustomManager, AddToTabTypeEnum.Fixed),
                () => WatchVariableControl.AddVarsToTab(getVars(), Config.CustomManager, AddToTabTypeEnum.GroupedByBaseAddress),
                () => WatchVariableControl.AddVarsToTab(getVars(), Config.CustomManager, AddToTabTypeEnum.GroupedByVariable),
            });

            return(new List <ToolStripItem>()
            {
                itemHighlight,
                itemLock,
                itemFixAddress,
                itemCopy,
                itemPaste,
                new ToolStripSeparator(),
                itemRoundTo,
                itemDisplayAsHex,
                new ToolStripSeparator(),
                itemAngleSigned,
                itemAngleUnits,
                itemAngleTruncateToMultipleOf16,
                itemAngleConstrainToOneRevolution,
                itemAngleReverse,
                itemAngleDisplayAsHex,
                new ToolStripSeparator(),
                itemShowVariableXml,
                itemShowVariableInfo,
                new ToolStripSeparator(),
                itemAddVariables,
                itemSetCascadingValues,
                new ToolStripSeparator(),
                itemBackgroundColor,
                itemMove,
                itemRemove,
                itemRename,
                itemOpenController,
                itemOpenTripletController,
                itemOpenPopOut,
                itemAddToTab,
                itemAddToCustomTab,
            });
        }
Example #7
0
        public override object EditValue(ITypeDescriptorContext context,
                                         IServiceProvider provider, object value)
        {
            EnvDTE.DTE dte = (EnvDTE.DTE)provider.GetService(typeof(EnvDTE.DTE));

            try
            {
                List <NameValueItem> nvitems = this.GetItems(dte, provider);

                SortItems(nvitems);

                object svc = provider.GetService(typeof(IWindowsFormsEditorService));
                if (svc == null)
                {
                    return(base.EditValue(context, provider, value));
                }

                SelectionForm form = new SelectionForm(nvitems, value, false);
                if (((IWindowsFormsEditorService)svc).ShowDialog(form) == DialogResult.OK)
                {
                    if (context.Instance != null)
                    {
                        if (context.Instance is System.String)
                        {
                            if (context.Instance.ToString() == "NameValueItem")
                            {
                                return(form.SelectedNameValueItem);
                            }
                        }
                    }
                    if (value is NameValueItem[])
                    {
                        return(form.SelectedNameValueItems);
                    }
                    else if (value is NameValueItem)
                    {
                        return(form.SelectedNameValueItem);
                    }
                    else
                    {
                        if (form.SelectedNameValueItem != null)
                        {
                            return(form.SelectedNameValueItem.Value);
                        }
                        else
                        {
                            return("");
                        }
                    }
                }
                else
                {
                    return(value);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return(null);
        }
Example #8
0
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData revit,
                                                ref string message, ElementSet elements)
        {
            UIApplication uiapp = revit.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;

            Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
            Document doc = uidoc.Document;


            FormCollection fc = Application.OpenForms;

            foreach (System.Windows.Forms.Form frm in fc) //tries looking for the Open Form to get the spline from
            {
                if (frm.Name == "SelectionForm")
                {
                    isFormOpen = true;
                }
            }

            if (isFormOpen == false)
            {
                isFormOpen = true;

                SelectionForm form = new SelectionForm(uidoc);

                form.FormBorderStyle = FormBorderStyle.FixedDialog;
                form.MaximizeBox     = false;
                form.MinimizeBox     = false;
                form.StartPosition   = FormStartPosition.CenterScreen;

                form.Show();
            }
            else
            {
                MessageBox.Show("Form Already Open, Please Close Previous Instance", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }



            /*
             * ReferenceArray ra = new ReferenceArray();
             * ISelectionFilter selFilter = new DetailLineFilter();
             *
             * try
             * {
             *  splineRefrence = uidoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element, selFilter);
             *  selectedSpline = uidoc.Document.GetElement(splineRefrence.ElementId);
             *  RenumberSplineForm form = new RenumberSplineForm(uidoc,selectedSpline);
             *  form.ShowDialog();
             *
             *  form.Dispose();
             * }
             * catch(Exception ex)
             * {
             *  TaskDialog.Show("Error", ex.Message);
             * }
             */



            return(Result.Succeeded);
        }
Example #9
0
        private void AddStringContextMenuStripItems(string specialType)
        {
            ToolStripMenuItem itemSelectValue = new ToolStripMenuItem("Select Value...");
            bool addedClickAction             = true;

            EventHandler handler;

            if (specialTypeContextMenuHandlers.TryGetValue(specialType, out handler))
            {
                itemSelectValue.Click += handler;
            }
            else
            {
                switch (specialType)
                {
                case "ActionDescription":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowActionDescriptionSelectionForm();
                    break;

                case "PrevActionDescription":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowPreviousActionDescriptionSelectionForm();
                    break;

                case "AnimationDescription":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowAnimationDescriptionSelectionForm();
                    break;

                case "TriangleTypeDescription":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowTriangleTypeDescriptionSelectionForm();
                    break;

                case "DemoCounterDescription":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowDemoCounterDescriptionSelectionForm();
                    break;

                case "TtcSpeedSettingDescription":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowTtcSpeedSettingDescriptionSelectionForm();
                    break;

                case "AreaTerrainDescription":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowAreaTerrainDescriptionSelectionForm();
                    break;

                case "Map3DMode":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowMap3DModeSelectionForm();
                    break;

                case "CompassPosition":
                    itemSelectValue.Click += (sender, e) => SelectionForm.ShowCompassPositionSelectionForm();
                    break;

                default:
                    addedClickAction = false;
                    break;
                }
            }

            if (addedClickAction)
            {
                _contextMenuStrip.AddToBeginningList(new ToolStripSeparator());
                _contextMenuStrip.AddToBeginningList(itemSelectValue);
            }
        }
        public static List <ToolStripItem> CreateSelectionToolStripItems(
            Func <List <WatchVariableControl> > getVars,
            WatchVariableFlowLayoutPanel panel)
        {
            Action <WatchVariableControlSettings> apply = (WatchVariableControlSettings settings) =>
            {
                if (KeyboardUtilities.IsCtrlHeld())
                {
                    WatchVariableControlSettingsManager.AddSettings(settings);
                }
                else
                {
                    getVars().ForEach(control => control.ApplySettings(settings));
                }
            };

            ToolStripMenuItem itemHighlight = new ToolStripMenuItem("Highlight...");

            ControlUtilities.AddDropDownItems(
                itemHighlight,
                new List <string>()
            {
                "Highlight", "Don't Highlight"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeHighlighted: true, newHighlighted: true)),
                () => apply(new WatchVariableControlSettings(changeHighlighted: true, newHighlighted: false)),
            });

            ToolStripMenuItem itemLock = new ToolStripMenuItem("Lock...");

            ControlUtilities.AddDropDownItems(
                itemLock,
                new List <string>()
            {
                "Lock", "Don't Lock"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeLocked: true, newLocked: true)),
                () => apply(new WatchVariableControlSettings(changeLocked: true, newLocked: false)),
            });

            ToolStripMenuItem itemCopy = new ToolStripMenuItem("Copy...");
            Action <List <WatchVariableControl>, string> copyValues =
                (List <WatchVariableControl> controls, string separator) =>
            {
                Clipboard.SetText(
                    String.Join(separator, controls.ConvertAll(
                                    control => control.GetValue(false))));
            };

            ControlUtilities.AddDropDownItems(
                itemCopy,
                new List <string>()
            {
                "Copy with Commas", "Copy with Tabs", "Copy with Line Breaks"
            },
                new List <Action>()
            {
                () => copyValues(getVars(), ","),
                () => copyValues(getVars(), "\t"),
                () => copyValues(getVars(), "\r\n"),
            });

            ToolStripMenuItem itemPaste = new ToolStripMenuItem("Paste");

            itemPaste.Click += (sender, e) =>
            {
                List <string> stringList            = ParsingUtilities.ParseStringList(Clipboard.GetText());
                List <WatchVariableControl> varList = getVars();
                if (stringList.Count != varList.Count)
                {
                    return;
                }

                Config.Stream.Suspend();
                for (int i = 0; i < stringList.Count; i++)
                {
                    varList[i].SetValue(stringList[i]);
                }
                Config.Stream.Resume();
            };

            ToolStripMenuItem itemRoundTo        = new ToolStripMenuItem("Round to...");
            ToolStripMenuItem itemRoundToDefault = new ToolStripMenuItem("Default");

            itemRoundToDefault.Click += (sender, e) =>
                                        apply(new WatchVariableControlSettings(
                                                  changeRoundingLimit: true, changeRoundingLimitToDefault: true));
            ToolStripMenuItem itemRoundToNoRounding = new ToolStripMenuItem("No Rounding");

            itemRoundToNoRounding.Click += (sender, e) =>
                                           apply(new WatchVariableControlSettings(
                                                     changeRoundingLimit: true, newRoundingLimit: -1));
            List <ToolStripMenuItem> itemsRoundToNumDecimalPlaces = new List <ToolStripMenuItem>();

            for (int i = 0; i <= 10; i++)
            {
                int index = i;
                itemsRoundToNumDecimalPlaces.Add(new ToolStripMenuItem(index + " decimal place(s)"));
                itemsRoundToNumDecimalPlaces[index].Click += (sender, e) =>
                                                             apply(new WatchVariableControlSettings(
                                                                       changeRoundingLimit: true, newRoundingLimit: index));
            }
            itemRoundTo.DropDownItems.Add(itemRoundToDefault);
            itemRoundTo.DropDownItems.Add(itemRoundToNoRounding);
            itemsRoundToNumDecimalPlaces.ForEach(setAllRoundingLimitsNumberItem =>
            {
                itemRoundTo.DropDownItems.Add(setAllRoundingLimitsNumberItem);
            });

            ToolStripMenuItem itemDisplayAsHex = new ToolStripMenuItem("Display as Hex...");

            ControlUtilities.AddDropDownItems(
                itemDisplayAsHex,
                new List <string>()
            {
                "Default", "Hex", "Decimal"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeDisplayAsHex: true, changeDisplayAsHexToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeDisplayAsHex: true, newDisplayAsHex: true)),
                () => apply(new WatchVariableControlSettings(changeDisplayAsHex: true, newDisplayAsHex: false)),
            });

            ToolStripMenuItem itemAngleSigned = new ToolStripMenuItem("Angle: Signed...");

            ControlUtilities.AddDropDownItems(
                itemAngleSigned,
                new List <string>()
            {
                "Default", "Unsigned", "Signed"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleSigned: true, changeAngleSignedToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleSigned: true, newAngleSigned: false)),
                () => apply(new WatchVariableControlSettings(changeAngleSigned: true, newAngleSigned: true)),
            });

            ToolStripMenuItem itemAngleUnits        = new ToolStripMenuItem("Angle: Units...");
            ToolStripMenuItem itemAngleUnitsDefault = new ToolStripMenuItem("Default");

            itemAngleUnitsDefault.Click += (sender, e) =>
                                           apply(new WatchVariableControlSettings(
                                                     changeAngleUnits: true, changeAngleUnitsToDefault: true));
            List <ToolStripMenuItem> itemsAngleUnitsValue = new List <ToolStripMenuItem>();

            foreach (AngleUnitType angleUnitType in Enum.GetValues(typeof(AngleUnitType)))
            {
                AngleUnitType     angleUnitTypeFixed  = angleUnitType;
                ToolStripMenuItem itemAngleUnitsValue = new ToolStripMenuItem(angleUnitTypeFixed.ToString());
                itemAngleUnitsValue.Click += (sender, e) =>
                                             apply(new WatchVariableControlSettings(
                                                       changeAngleUnits: true, newAngleUnits: angleUnitTypeFixed));
                itemsAngleUnitsValue.Add(itemAngleUnitsValue);
            }
            itemAngleUnits.DropDownItems.Add(itemAngleUnitsDefault);
            itemsAngleUnitsValue.ForEach(setAllAngleUnitsValuesItem =>
            {
                itemAngleUnits.DropDownItems.Add(setAllAngleUnitsValuesItem);
            });

            ToolStripMenuItem itemAngleTruncateToMultipleOf16 = new ToolStripMenuItem("Angle: Truncate to Multiple of 16...");

            ControlUtilities.AddDropDownItems(
                itemAngleTruncateToMultipleOf16,
                new List <string>()
            {
                "Default", "Truncate to Multiple of 16", "Don't Truncate to Multiple of 16"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleTruncateToMultipleOf16: true, changeAngleTruncateToMultipleOf16ToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleTruncateToMultipleOf16: true, newAngleTruncateToMultipleOf16: true)),
                () => apply(new WatchVariableControlSettings(changeAngleTruncateToMultipleOf16: true, newAngleTruncateToMultipleOf16: false)),
            });

            ToolStripMenuItem itemAngleConstrainToOneRevolution = new ToolStripMenuItem("Angle: Constrain to One Revolution...");

            ControlUtilities.AddDropDownItems(
                itemAngleConstrainToOneRevolution,
                new List <string>()
            {
                "Default", "Constrain to One Revolution", "Don't Constrain to One Revolution"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleConstrainToOneRevolution: true, changeAngleConstrainToOneRevolutionToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleConstrainToOneRevolution: true, newAngleConstrainToOneRevolution: true)),
                () => apply(new WatchVariableControlSettings(changeAngleConstrainToOneRevolution: true, newAngleConstrainToOneRevolution: false)),
            });

            ToolStripMenuItem itemAngleDisplayAsHex = new ToolStripMenuItem("Angle: Display as Hex...");

            ControlUtilities.AddDropDownItems(
                itemAngleDisplayAsHex,
                new List <string>()
            {
                "Default", "Hex", "Decimal"
            },
                new List <Action>()
            {
                () => apply(new WatchVariableControlSettings(changeAngleDisplayAsHex: true, changeAngleDisplayAsHexToDefault: true)),
                () => apply(new WatchVariableControlSettings(changeAngleDisplayAsHex: true, newAngleDisplayAsHex: true)),
                () => apply(new WatchVariableControlSettings(changeAngleDisplayAsHex: true, newAngleDisplayAsHex: false)),
            });

            ToolStripMenuItem itemShowVariableXml = new ToolStripMenuItem("Show Variable XML");

            itemShowVariableXml.Click += (sender, e) =>
            {
                InfoForm infoForm = new InfoForm();
                infoForm.SetText(
                    "Variable Info",
                    "Variable XML",
                    String.Join("\r\n", getVars().ConvertAll(control => control.ToXml(true))));
                infoForm.Show();
            };

            ToolStripMenuItem itemShowVariableInfo = new ToolStripMenuItem("Show Variable Info");

            itemShowVariableInfo.Click += (sender, e) =>
            {
                InfoForm infoForm = new InfoForm();
                infoForm.SetText(
                    "Variable Info",
                    "Variable Info",
                    String.Join("\t",
                                WatchVariableWrapper.GetVarInfoLabels()) +
                    "\r\n" +
                    String.Join(
                        "\r\n",
                        getVars().ConvertAll(control => control.GetVarInfo())
                        .ConvertAll(infoList => String.Join("\t", infoList))));
                infoForm.Show();
            };

            ToolStripMenuItem itemMove = new ToolStripMenuItem("Move...");

            ControlUtilities.AddDropDownItems(
                itemMove,
                new List <string>()
            {
                "Start Move", "End Move", "Clear Move"
            },
                new List <Action>()
            {
                () => panel.NotifyOfReorderingStart(getVars()),
                () => panel.NotifyOfReorderingEnd(getVars()),
                () => panel.NotifyOfReorderingClear(),
            });

            ToolStripMenuItem itemRemove = new ToolStripMenuItem("Remove");

            itemRemove.Click += (sender, e) => panel.RemoveVariables(getVars());

            ToolStripMenuItem itemEnableCustomization = new ToolStripMenuItem("Enable Customization");

            itemEnableCustomization.Click += (sender, e) => apply(new WatchVariableControlSettings(enableCustomization: true));

            ToolStripMenuItem itemOpenController = new ToolStripMenuItem("Open Controller");

            itemOpenController.Click += (sender, e) =>
            {
                List <WatchVariableControl> vars          = getVars();
                VariableControllerForm      varController =
                    new VariableControllerForm(
                        vars.ConvertAll(control => control.VarName),
                        vars.ConvertAll(control => control.WatchVarWrapper),
                        vars.ConvertAll(control => control.FixedAddressList));
                varController.Show();
            };

            ToolStripMenuItem itemOpenPopOut = new ToolStripMenuItem("Open Pop Out");

            itemOpenPopOut.Click += (sender, e) =>
            {
                VariablePopOutForm form = new VariablePopOutForm();
                form.Initialize(getVars().ConvertAll(control => control.CreateCopy()));
                form.ShowForm();
            };

            ToolStripMenuItem itemAddToTab = new ToolStripMenuItem("Add to Tab...");

            itemAddToTab.Click += (sender, e) => SelectionForm.ShowDataManagerSelectionForm(getVars());

            ToolStripMenuItem itemAddToCustomTab = new ToolStripMenuItem("Add to Custom Tab");

            itemAddToCustomTab.Click += (sender, e) => WatchVariableControl.AddVarsToTab(getVars(), Config.CustomManager);

            return(new List <ToolStripItem>
            {
                itemHighlight,
                itemLock,
                itemCopy,
                itemPaste,
                new ToolStripSeparator(),
                itemRoundTo,
                itemDisplayAsHex,
                new ToolStripSeparator(),
                itemAngleSigned,
                itemAngleUnits,
                itemAngleTruncateToMultipleOf16,
                itemAngleConstrainToOneRevolution,
                itemAngleDisplayAsHex,
                new ToolStripSeparator(),
                itemShowVariableXml,
                itemShowVariableInfo,
                new ToolStripSeparator(),
                itemMove,
                itemRemove,
                itemEnableCustomization,
                itemOpenController,
                itemOpenPopOut,
                itemAddToTab,
                itemAddToCustomTab,
            });
        }