/// <summary> /// Default context menu strip for checks /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_DefaultCheck(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; for (int i = 0; i < ((ExpressionMemberCheck)container.Member).Choices.Count(); i++) { string item = ((ExpressionMemberCheck)container.Member).Choices[i]; if (container.Member.ValueToDisplay(item) == null) continue; ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add((editor.XmlValueToMenu.ContainsKey(item)) ? editor.XmlValueToMenu[item] : container.Member.ValueToDisplay(item)); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; if (container.Member.ValueDescription.AreEqual(container.Member.ValueToXml(item), value)) tsi.Select(); if (((ExpressionMemberCheck)container.Member).SeparatorAt(i)) editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value); return editor.ValueSelectorContextMenuStrip; }
/// <summary> /// Default context menu strip for booleans (yes/no) /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_DefaultBool(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; foreach (string item in new string[2] { container.Member.ValueToDisplay("1"), container.Member.ValueToDisplay("0") }) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value); return editor.ValueSelectorContextMenuStrip; }
public ExpressionMemberValueDescription(ExpressionMemberValueType type, ExpressionMemberValueBehaviorInXml behavior, ExpressionMemberValueEditor editor, object min = null, object max = null, string quoteLeft = "", string quoteRight = " ", string defaultIfNull = null) { Type = type; BehaviorInXml = behavior; Editor = editor; Min = min; Max = max; QuoteLeft = quoteLeft; QuoteRight = quoteRight; DefaultIfNull = defaultIfNull; }
/// <summary> /// Default context menu strip, with separator for the first value and no Dialog option. /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_DefaultListWithFirstSeparated(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { return PrepareContextMenuStrip_DefaultListWithOptions(container, editor, mode, false, true); }
/// <summary> /// Default context menu strip, with Dialog option and separator for the first value. /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_DefaultListPlusDialogWithFirstSeparated(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { return(PrepareContextMenuStrip_DefaultListWithOptions(container, editor, mode, true, true)); }
/// <summary> /// Context menu strip for nested specified list (used by named objects) /// </summary> private static ContextMenuStrip PrepareContextMenuStrip_SpecifiedNestedListPlusDialog(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode, Dictionary<string, List<string>> dict) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) return null; bool empty = true; foreach (KeyValuePair<string, List<string>> kvp in dict) if (kvp.Value.Count != 0) empty = false; if (empty) return null; if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = true; //For each list of named objects that is stored in the dictionary foreach (KeyValuePair<string, List<string>> kvp in dict) { if (kvp.Value.Count == 0) continue; ToolStripMenuItem tsm = new ToolStripMenuItem(kvp.Key); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); //If they do not fit make a second nested menu inside the first one if (kvp.Value.Count > Settings.Current.NamesPerSubmenu) { int i; List<string> headers = new List<string>(); for (i = 0; i < kvp.Value.Count / Settings.Current.NamesPerSubmenu; i++) { string first = kvp.Value[i * Settings.Current.NamesPerSubmenu]; string last = kvp.Value[(i + 1) * Settings.Current.NamesPerSubmenu - 1]; headers.Add(first + " - " + last); } if (i * Settings.Current.NamesPerSubmenu <= kvp.Value.Count - 1) headers.Add(kvp.Value[i * Settings.Current.NamesPerSubmenu] + " - " + kvp.Value[kvp.Value.Count - 1]); for (i = 0; i < headers.Count; i++) { ToolStripMenuItem tsm2 = (ToolStripMenuItem)tsm.DropDownItems.Add(headers[i]); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); for (int j = i * Settings.Current.NamesPerSubmenu; j < (i == headers.Count - 1 ? kvp.Value.Count : (i + 1) * Settings.Current.NamesPerSubmenu); j++) { string item = kvp.Value[j]; ToolStripItem tsi = tsm2.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } else//If they fit in a single menu add everything into the first menu item { foreach (string item in kvp.Value) { ToolStripItem tsi = tsm.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return editor.ValueSelectorContextMenuStrip; }
/// <summary> /// Default context menu strip, providing a choice of Dialog and first value separator options /// </summary> private static ContextMenuStrip PrepareContextMenuStrip_DefaultListWithOptions(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode, bool plusDialogItem, bool firstSeparated) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) return null; if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = plusDialogItem; bool doOnce = firstSeparated; foreach (string item in editor.DisplayValueToXml.Keys) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; if (doOnce) { doOnce = false; editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); } } if (plusDialogItem) { if (firstSeparated != true || editor.DisplayValueToXml.Keys.Count != 1) editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return editor.ValueSelectorContextMenuStrip; }
/// <summary> /// Context menu strip for player names /// </summary> /// <param name="container"></param> /// <param name="editor"></param> /// <param name="mode"></param> /// <returns></returns> internal static ContextMenuStrip PrepareContextMenuStrip_PlayerListPlusDialog(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) return null; // Recreate the menu if player ship names changed since last time //TODO: This should (probably) be moved to an event as well! bool forceRecreate = true; if (editor.Tag != null && editor.Tag as string[] != null) { string[] prevNames = (string[])editor.Tag; string[] curNames = Mission.Current.PlayerShipNames; if (prevNames.Length == curNames.Length) { bool identical = true; for (int i = 0; identical && i < prevNames.Length; i++) if (prevNames[i] != curNames[i]) identical = false; if (identical) forceRecreate = false; } } editor.Tag = Mission.Current.PlayerShipNames; if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu || forceRecreate) { editor.XmlValueToDisplay.Clear(); editor.DisplayValueToXml.Clear(); editor.MenuItems.Clear(); foreach (string playerShipName in Mission.Current.PlayerShipNames) editor.AddToDictionary(playerShipName, playerShipName); editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = true; foreach (string item in editor.DisplayValueToXml.Keys) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return editor.ValueSelectorContextMenuStrip; }
/// <summary> /// Context menu strip for specified list (used by timers, variables, etc.) /// </summary> private static ContextMenuStrip PrepareContextMenuStrip_SpecifiedListPlusDialog(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode, KeyValuePair <List <string>, List <string> > list) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) { return(null); } if (list.Key.Count == 0) { return(null); } if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = true; if (list.Value.Count == 0) { foreach (string item in list.Key) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } else { int i; for (i = 0; i < list.Value.Count; i++) { ToolStripMenuItem tsm = new ToolStripMenuItem(list.Value[i]); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); for (int j = i * Settings.Current.NamesPerSubmenu; j < (i == list.Value.Count - 1 ? list.Key.Count : (i + 1) * Settings.Current.NamesPerSubmenu); j++) { string item = list.Key[j]; ToolStripItem tsi = tsm.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Context menu strip for external program IDs /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_ExternalProgramIDList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { return(PrepareContextMenuStrip_SpecifiedListPlusDialog(container, editor, mode, Mission.Current.ExternalProgramIDsList)); }
/// <summary> /// Default context menu strip for booleans (yes/no) /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_DefaultBool(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; foreach (string item in new string[3] { "Default", container.Member.ValueToDisplay("1"), container.Member.ValueToDisplay("0") }) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Default context menu strip for checks /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_DefaultCheck(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; for (int i = 0; i < ((ExpressionMemberCheck)container.Member).Choices.Count(); i++) { string item = ((ExpressionMemberCheck)container.Member).Choices[i]; if (container.Member.ValueToDisplay(item) == null) { continue; } ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add((editor.XmlValueToMenu.ContainsKey(item)) ? editor.XmlValueToMenu[item] : container.Member.ValueToDisplay(item)); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; if (container.Member.ValueDescription.AreEqual(container.Member.ValueToXml(item), value)) { tsi.Select(); } if (((ExpressionMemberCheck)container.Member).SeparatorAt(i)) { editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); } } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Context menu strip with nested items (based on menu groups). /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_NestedList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; int i = 0; foreach (KeyValuePair <int, string> kvp in editor.MenuGroups.OrderBy((KeyValuePair <int, string> x) => x.Key)) { ToolStripMenuItem tsm = new ToolStripMenuItem(kvp.Value); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); while (i < kvp.Key) { string item = editor.MenuItems[i++]; ToolStripItem tsi = tsm.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Default context menu strip, providing a choice of Dialog and first value separator options. /// </summary> private static ContextMenuStrip PrepareContextMenuStrip_DefaultListWithOptions(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode, bool plusDialogItem, bool firstSeparated) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) { return(null); } if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = plusDialogItem; bool doOnce = firstSeparated; foreach (string item in editor.DisplayValueToXml.Keys) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; if (doOnce) { doOnce = false; editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); } } if (plusDialogItem) { if (firstSeparated != true || editor.DisplayValueToXml.Keys.Count != 1) { editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); } ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Context menu strip for HullID /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_HullIDList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; ToolStripItem tsn1 = editor.ValueSelectorContextMenuStrip.Items.Add("NULL"); tsn1.Tag = container; tsn1.Click += ContextMenuClickChoose; editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); List<string> keys = VesselData.Current.VesselList.Keys.ToList(); if (keys.Count > Settings.Current.NamesPerSubmenu) { int i; List<string> headers = new List<string>(); for (i = 0; i < keys.Count / Settings.Current.NamesPerSubmenu; i++) { string first = VesselData.Current.VesselToString(keys[i * Settings.Current.NamesPerSubmenu]); string last = VesselData.Current.VesselToString(keys[(i + 1) * Settings.Current.NamesPerSubmenu - 1]); headers.Add(first + " - " + last); } if (i * Settings.Current.NamesPerSubmenu <= keys.Count - 1) headers.Add(VesselData.Current.VesselToString(keys[i * Settings.Current.NamesPerSubmenu]) + " - " + VesselData.Current.VesselToString(keys[keys.Count - 1])); for (i = 0; i < headers.Count; i++) { ToolStripMenuItem tsm2 = (ToolStripMenuItem)editor.ValueSelectorContextMenuStrip.Items.Add(headers[i]); editor.ValueSelectorContextMenuStrip.Items.Add(tsm2); for (int j = i * Settings.Current.NamesPerSubmenu; j < (i == headers.Count - 1 ? keys.Count : (i + 1) * Settings.Current.NamesPerSubmenu); j++) { ToolStripItem tsi = tsm2.DropDownItems.Add(VesselData.Current.VesselToString(keys[j])); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } else { foreach (string item in VesselData.Current.VesselList.Keys) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(VesselData.Current.VesselToString(item)); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } if (VesselData.Current.VesselList.Keys.Count > 0) { editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); // When we had a huge list of IDs, there was a purpose of having NULL entry both above and below. // Now that we have separation into submenus, there is no need for that //ToolStripItem tsn2 = editor.cmsValueSelector.Items.Add("NULL"); //tsn2.Tag = container; //tsn2.Click += ContextMenuClick_Choose; //editor.cmsValueSelector.Items.Add(new ToolStripSeparator()); } ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, string.IsNullOrWhiteSpace(value) ? null : value); return editor.ValueSelectorContextMenuStrip; }
/// <summary> /// Context menu strip with nested items (based on menu groups). /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_NestedList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; int i = 0; foreach (KeyValuePair<int, string> kvp in editor.MenuGroups.OrderBy((KeyValuePair<int, string> x) => x.Key)) { ToolStripMenuItem tsm = new ToolStripMenuItem(kvp.Value); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); while (i < kvp.Key) { string item = editor.MenuItems[i++]; ToolStripItem tsi = tsm.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, value); return editor.ValueSelectorContextMenuStrip; }
/// <summary> /// Context Menu Strip for names of named objects /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_NamedAllNameList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { return(PrepareContextMenuStrip_SpecifiedNestedListPlusDialog(container, editor, mode, Mission.Current.AllNamesLists)); }
/// <summary> /// Context menu strip for variable names /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_VariableNameList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { return PrepareContextMenuStrip_SpecifiedListPlusDialog(container, editor, mode, Mission.Current.VariableNamesList); }
/// <summary> /// Context menu strip for nested specified list (used by named objects) /// </summary> private static ContextMenuStrip PrepareContextMenuStrip_SpecifiedNestedListPlusDialog(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode, Dictionary <string, List <string> > dict) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) { return(null); } bool empty = true; foreach (KeyValuePair <string, List <string> > kvp in dict) { if (kvp.Value.Count != 0) { empty = false; } } if (empty) { return(null); } if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = true; //For each list of named objects that is stored in the dictionary foreach (KeyValuePair <string, List <string> > kvp in dict) { if (kvp.Value.Count == 0) { continue; } ToolStripMenuItem tsm = new ToolStripMenuItem(kvp.Key); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); //If they do not fit make a second nested menu inside the first one if (kvp.Value.Count > Settings.Current.NamesPerSubmenu) { int i; List <string> headers = new List <string>(); for (i = 0; i < kvp.Value.Count / Settings.Current.NamesPerSubmenu; i++) { string first = kvp.Value[i * Settings.Current.NamesPerSubmenu]; string last = kvp.Value[(i + 1) * Settings.Current.NamesPerSubmenu - 1]; headers.Add(first + " - " + last); } if (i * Settings.Current.NamesPerSubmenu <= kvp.Value.Count - 1) { headers.Add(kvp.Value[i * Settings.Current.NamesPerSubmenu] + " - " + kvp.Value[kvp.Value.Count - 1]); } for (i = 0; i < headers.Count; i++) { ToolStripMenuItem tsm2 = (ToolStripMenuItem)tsm.DropDownItems.Add(headers[i]); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); for (int j = i * Settings.Current.NamesPerSubmenu; j < (i == headers.Count - 1 ? kvp.Value.Count : (i + 1) * Settings.Current.NamesPerSubmenu); j++) { string item = kvp.Value[j]; ToolStripItem tsi = tsm2.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } else//If they fit in a single menu add everything into the first menu item { foreach (string item in kvp.Value) { ToolStripItem tsi = tsm.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Context menu strip for specified list (used by timers, variables and stations) /// </summary> private static ContextMenuStrip PrepareContextMenuStrip_SpecifiedListPlusDialog(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode, KeyValuePair<List<string>, List<string>> list) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) return null; if (list.Key.Count == 0) return null; if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = true; if (list.Value.Count == 0) { foreach (string item in list.Key) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } else { int i; for (i = 0; i < list.Value.Count; i++) { ToolStripMenuItem tsm = new ToolStripMenuItem(list.Value[i]); editor.ValueSelectorContextMenuStrip.Items.Add(tsm); for (int j = i * Settings.Current.NamesPerSubmenu; j < (i == list.Value.Count - 1 ? list.Key.Count : (i + 1) * Settings.Current.NamesPerSubmenu); j++) { string item = list.Key[j]; ToolStripItem tsi = tsm.DropDownItems.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return editor.ValueSelectorContextMenuStrip; }
/// <summary> /// Context menu strip for HullID /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_HullIDList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { string value = container.GetValue(); if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu) { editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = false; ToolStripItem tsn1 = editor.ValueSelectorContextMenuStrip.Items.Add("NULL"); tsn1.Tag = container; tsn1.Click += ContextMenuClickChoose; editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); List <string> keys = VesselData.Current.VesselList.Keys.ToList(); if (keys.Count > Settings.Current.NamesPerSubmenu) { int i; List <string> headers = new List <string>(); for (i = 0; i < keys.Count / Settings.Current.NamesPerSubmenu; i++) { string first = VesselData.Current.VesselToString(keys[i * Settings.Current.NamesPerSubmenu]); string last = VesselData.Current.VesselToString(keys[(i + 1) * Settings.Current.NamesPerSubmenu - 1]); headers.Add(first + " - " + last); } if (i * Settings.Current.NamesPerSubmenu <= keys.Count - 1) { headers.Add(VesselData.Current.VesselToString(keys[i * Settings.Current.NamesPerSubmenu]) + " - " + VesselData.Current.VesselToString(keys[keys.Count - 1])); } for (i = 0; i < headers.Count; i++) { ToolStripMenuItem tsm2 = (ToolStripMenuItem)editor.ValueSelectorContextMenuStrip.Items.Add(headers[i]); editor.ValueSelectorContextMenuStrip.Items.Add(tsm2); for (int j = i * Settings.Current.NamesPerSubmenu; j < (i == headers.Count - 1 ? keys.Count : (i + 1) * Settings.Current.NamesPerSubmenu); j++) { ToolStripItem tsi = tsm2.DropDownItems.Add(VesselData.Current.VesselToString(keys[j])); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } } else { foreach (string item in VesselData.Current.VesselList.Keys) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(VesselData.Current.VesselToString(item)); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } } if (VesselData.Current.VesselList.Keys.Count > 0) { editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); // When we had a huge list of IDs, there was a purpose of having NULL entry both above and below. // Now that we have separation into submenus, there is no need for that //ToolStripItem tsn2 = editor.cmsValueSelector.Items.Add("NULL"); //tsn2.Tag = container; //tsn2.Click += ContextMenuClick_Choose; //editor.cmsValueSelector.Items.Add(new ToolStripSeparator()); } ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, string.IsNullOrWhiteSpace(value) ? null : value); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Context menu strip for player names /// </summary> /// <param name="container"></param> /// <param name="editor"></param> /// <param name="mode"></param> /// <returns></returns> internal static ContextMenuStrip PrepareContextMenuStrip_PlayerListPlusDialog(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { if (mode == ExpressionMemberValueEditorActivationMode.ForceDialog) { return(null); } // Recreate the menu if player ship names changed since last time //TODO: This should (probably) be moved to an event as well! bool forceRecreate = true; if (editor.Tag != null && editor.Tag as string[] != null) { string[] prevNames = (string[])editor.Tag; string[] curNames = Mission.Current.PlayerShipNames; if (prevNames.Length == curNames.Length) { bool identical = true; for (int i = 0; identical && i < prevNames.Length; i++) { if (prevNames[i] != curNames[i]) { identical = false; } } if (identical) { forceRecreate = false; } } } editor.Tag = Mission.Current.PlayerShipNames; if (editor.ValueSelectorContextMenuStrip == null || editor.LastUser != container.Member.ValueDescription || editor.ForceRecreateMenu || forceRecreate) { editor.XmlValueToDisplay.Clear(); editor.DisplayValueToXml.Clear(); editor.MenuItems.Clear(); foreach (string playerShipName in Mission.Current.PlayerShipNames) { editor.AddToDictionary(playerShipName, playerShipName); } editor.ValueSelectorContextMenuStrip = new ContextMenuStrip(); editor.InitContextMenuStrip(); editor.LastUser = container.Member.ValueDescription; editor.ValueSelectorContextMenuStrip.Items.Clear(); editor.ValueSelectorContextMenuStrip.Tag = true; foreach (string item in editor.DisplayValueToXml.Keys) { ToolStripItem tsi = editor.ValueSelectorContextMenuStrip.Items.Add(item); tsi.Tag = container; tsi.Click += ContextMenuClickChoose; } editor.ValueSelectorContextMenuStrip.Items.Add(new ToolStripSeparator()); ToolStripItem tsl = editor.ValueSelectorContextMenuStrip.Items.Add("Input value..."); tsl.Tag = container; tsl.Click += ContextMenuClickShowDialog; editor.ShowHideContextMenuStrip(); } AssignContainerToContextMenuStrip(editor.ValueSelectorContextMenuStrip, container, container.GetValue(), true); return(editor.ValueSelectorContextMenuStrip); }
/// <summary> /// Default context menu strip, with no Dialog option and no separator for the first value. /// </summary> internal static ContextMenuStrip PrepareContextMenuStrip_DefaultList(ExpressionMemberContainer container, ExpressionMemberValueEditor editor, ExpressionMemberValueEditorActivationMode mode) { return(PrepareContextMenuStrip_DefaultListWithOptions(container, editor, mode, false, false)); }
static ExpressionMemberValueEditors() { Nothing = new ExpressionMemberValueEditor(false, false); Label = new ExpressionMemberValueEditor(true, false); DefaultInteger = new ExpressionMemberValueEditor(); DefaultDouble = new ExpressionMemberValueEditor(); DefaultString = new ExpressionMemberValueEditor(); DefaultBody = new ExpressionMemberValueEditor(); DefaultBool = new ExpressionMemberValueEditor(); DefaultBool.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultBool; CreateType = new ExpressionMemberValueEditor(); CreateType.AddToDictionary("anomaly", "anomaly"); CreateType.AddToDictionary("blackHole", "black hole"); CreateType.AddToDictionary("enemy", "enemy"); CreateType.AddToDictionary("genericMesh", "generic mesh"); CreateType.AddToDictionary("monster", "monster"); CreateType.AddToDictionary("neutral", "neutral"); CreateType.AddToDictionary("player", "player"); CreateType.AddToDictionary("station", "station"); CreateType.AddToDictionary("whale", "whale"); CreateType.AddToDictionary("asteroids", "asteroids"); CreateType.AddToDictionary("mines", "mines"); CreateType.AddToDictionary("nebulas", "nebulas"); CreateType.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; DefaultCheck = new ExpressionMemberValueEditor(); DefaultCheck.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultCheck; XmlNameActionCheck = new ExpressionMemberValueEditor_XmlName(); XmlNameActionCheck.AddToDictionary("start_getting_keypresses_from", "Start getting keypresses from consoles: "); XmlNameActionCheck.AddToDictionary("end_getting_keypresses_from", "End getting keypresses from consoles: "); XmlNameActionCheck.AddToDictionary("set_special", "Set"); XmlNameActionCheck.AddToDictionary("set_side_value", "Set side"); XmlNameActionCheck.AddToDictionary("set_ship_text", "Set text strings"); XmlNameActionCheck.AddToDictionary("<destroy>", "Destroy"); XmlNameActionCheck.AddToDictionary("clear_ai", "Clear AI command stack"); XmlNameActionCheck.AddToDictionary("add_ai", "Add an AI command"); XmlNameActionCheck.AddToDictionary("set_object_property", "Set property"); XmlNameActionCheck.AddToDictionary("set_fleet_property", "Set property"); XmlNameActionCheck.AddToDictionary("addto_object_property", "Add"); XmlNameActionCheck.AddToDictionary("copy_object_property", "Copy property"); XmlNameActionCheck.AddToDictionary("set_relative_position", "Set position"); XmlNameActionCheck.AddToDictionary("set_to_gm_position", "Set position"); XmlNameActionCheck.AddToDictionary("incoming_comms_text", "Show incoming text message"); XmlNameActionCheck.AddToDictionary("incoming_message", "Show incoming audio message"); XmlNameActionCheck.AddToDictionary("warning_popup_message", "Show warning popup message"); XmlNameActionCheck.AddToDictionary("big_message", "Show big message on main screen"); XmlNameActionCheck.AddToDictionary("set_player_grid_damage", "Set player ship's damage"); XmlNameActionCheck.AddToDictionary("play_sound_now", "Play sound on main screen"); XmlNameActionCheck.AddToDictionary("set_damcon_members", "Set DamCon members"); XmlNameActionCheck.AddToDictionary("log", "Log new entry"); XmlNameActionCheck.AddToMenuDictionary("start_getting_keypresses_from", "Start getting keypresses from consoles"); XmlNameActionCheck.AddToMenuDictionary("end_getting_keypresses_from", "End getting keypresses from consoles"); XmlNameActionCheck.AddToMenuDictionary("set_special", "Set ship's special values"); XmlNameActionCheck.AddToMenuDictionary("set_side_value", "Set object's side"); XmlNameActionCheck.AddToMenuDictionary("set_ship_text", "Set object's text"); XmlNameActionCheck.AddToMenuDictionary("set_object_property", "Set property of object"); XmlNameActionCheck.AddToMenuDictionary("copy_object_property", "Copy property of object"); XmlNameActionCheck.AddToMenuDictionary("addto_object_property", "Add to property of object"); XmlNameActionCheck.AddToMenuDictionary("set_fleet_property", "Set property of fleet"); XmlNameActionCheck.AddToMenuDictionary("set_relative_position", "Set position relative to object"); XmlNameActionCheck.AddToMenuDictionary("add_ai", "Add AI command"); XmlNameActionCheck.AddToMenuDictionary("clear_ai", "Clear AI commands"); XmlNameActionCheck.AddToMenuDictionary("set_to_gm_position", "Set position relative to GM position"); XmlNameActionCheck.AddToMenuDictionary("create", "Create object(s)"); XmlNameActionCheck.AddToMenuDictionary("<destroy>", "Destroy object(s)"); XmlNameActionCheck.AddToMenuDictionary("direct", "Direct object to object / position"); XmlNameActionCheck.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultCheck; XmlNameConditionCheck = new ExpressionMemberValueEditor_XmlName(); XmlNameConditionCheck.AddToDictionary("if_variable", "Variable"); XmlNameConditionCheck.AddToDictionary("if_timer_finished", "Timer"); XmlNameConditionCheck.AddToDictionary("if_damcon_members", "Amount of DamCon members"); XmlNameConditionCheck.AddToDictionary("if_fleet_count", "Ship count"); XmlNameConditionCheck.AddToDictionary("if_docked", "Player ship is docked"); XmlNameConditionCheck.AddToDictionary("if_player_is_targeting", "Player ship is targeting"); XmlNameConditionCheck.AddToDictionary("<existance>", "Object"); XmlNameConditionCheck.AddToDictionary("<location>", "Object"); XmlNameConditionCheck.AddToDictionary("if_object_property", "Property"); XmlNameConditionCheck.AddToDictionary("if_distance", "Distance"); XmlNameConditionCheck.AddToDictionary("if_difficulty", "Difficulty level"); XmlNameConditionCheck.AddToDictionary("if_gm_key", "GM pressed"); XmlNameConditionCheck.AddToDictionary("if_client_key", "Client pressed"); XmlNameConditionCheck.AddToMenuDictionary("if_timer_finished", "Timer has finished"); XmlNameConditionCheck.AddToMenuDictionary("if_damcon_members", "Amount of DamCon members"); XmlNameConditionCheck.AddToMenuDictionary("if_fleet_count", "Ship count (in a fleet)"); XmlNameConditionCheck.AddToMenuDictionary("<existance>", "Object exists / doesn't"); XmlNameConditionCheck.AddToMenuDictionary("if_object_property", "Object property"); XmlNameConditionCheck.AddToMenuDictionary("<location>", "Object is located"); XmlNameConditionCheck.AddToMenuDictionary("if_distance", "Distance between objects"); XmlNameConditionCheck.AddToMenuDictionary("if_gm_key", "GM pressed a key"); XmlNameConditionCheck.AddToMenuDictionary("if_client_key", "Client pressed a key"); XmlNameConditionCheck.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultCheck; SetVariableCheck = new ExpressionMemberValueEditor(); SetVariableCheck.AddToDictionary("<to>", "to"); SetVariableCheck.AddToMenuDictionary("<to>", "to an exact value"); SetVariableCheck.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultCheck; AIType = new ExpressionMemberValueEditor(); AIType.AddToDictionary("TRY_TO_BECOME_LEADER", "TRY TO BECOME LEADER"); AIType.AddToDictionary("CHASE_PLAYER", "CHASE PLAYER "); AIType.AddToDictionary("CHASE_AI_SHIP", "CHASE AI SHIP "); AIType.AddToDictionary("CHASE_STATION", "CHASE STATION "); AIType.AddToDictionary("CHASE_WHALE", "CHASE WHALE "); AIType.AddToDictionary("AVOID_WHALE", "AVOID WHALE "); AIType.AddToDictionary("AVOID_BLACK_HOLE", "AVOID BLACK HOLE "); AIType.AddToDictionary("CHASE_ANGER", "CHASE ANGER"); AIType.AddToDictionary("CHASE_FLEET", "CHASE FLEET "); AIType.AddToDictionary("FOLLOW_LEADER", "FOLLOW LEADER"); AIType.AddToDictionary("FOLLOW_COMMS_ORDERS", "FOLLOW COMMS ORDERS"); AIType.AddToDictionary("LEADER_LEADS", "LEADER LEADS"); AIType.AddToDictionary("ELITE_AI", "ELITE AI"); AIType.AddToDictionary("DIR_THROTTLE", "DIR THROTTLE "); AIType.AddToDictionary("POINT_THROTTLE", "POINT THROTTLE "); AIType.AddToDictionary("TARGET_THROTTLE", "TARGET THROTTLE "); AIType.AddToDictionary("ATTACK", "ATTACK "); AIType.AddToDictionary("DEFEND", "DEFEND "); AIType.AddToDictionary("PROCEED_TO_EXIT", "PROCEED TO EXIT"); AIType.AddToDictionary("FIGHTER_BINGO", "FIGHTER BINGO"); AIType.AddToDictionary("LAUNCH_FIGHTERS", "LAUNCH FIGHTERS "); AIType.AddToDictionary("GUARD_STATION", "GUARD STATION "); AIType.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; PropertyObject = new ExpressionMemberValueEditor(); PropertyObject.AddToDictionary("positionX", "positionX"); PropertyObject.AddToDictionary("positionY", "positionY"); PropertyObject.AddToDictionary("positionZ", "positionZ"); PropertyObject.AddToDictionary("deltaX", "deltaX"); PropertyObject.AddToDictionary("deltaY", "deltaY"); PropertyObject.AddToDictionary("deltaZ", "deltaZ"); PropertyObject.AddToDictionary("angle", "angle"); PropertyObject.AddToDictionary("pitch", "pitch"); PropertyObject.AddToDictionary("roll", "roll"); PropertyObject.AddToDictionary("sideValue", "sideValue"); PropertyObject.NewMenuGroup("All objects"); PropertyObject.AddToDictionary("blocksShotFlag", "blocksShotFlag"); PropertyObject.AddToDictionary("pushRadius", "pushRadius"); PropertyObject.AddToDictionary("pitchDelta", "pitchDelta"); PropertyObject.AddToDictionary("rollDelta", "rollDelta"); PropertyObject.AddToDictionary("angleDelta", "angleDelta"); PropertyObject.AddToDictionary("artScale", "artScale"); PropertyObject.NewMenuGroup("Generic meshes"); PropertyObject.AddToDictionary("shieldState", "shieldState"); PropertyObject.AddToDictionary("canBuild", "canBuild"); PropertyObject.AddToDictionary("missileStoresHoming", "missileStoresHoming"); PropertyObject.AddToDictionary("missileStoresNuke", "missileStoresNuke"); PropertyObject.AddToDictionary("missileStoresMine", "missileStoresMine"); PropertyObject.AddToDictionary("missileStoresECM", "missileStoresECM"); PropertyObject.NewMenuGroup("Stations"); PropertyObject.AddToDictionary("throttle", "throttle"); PropertyObject.AddToDictionary("steering", "steering"); PropertyObject.AddToDictionary("topSpeed", "topSpeed"); PropertyObject.AddToDictionary("turnRate", "turnRate"); PropertyObject.AddToDictionary("shieldStateFront", "shieldStateFront"); PropertyObject.AddToDictionary("shieldMaxStateFront", "shieldMaxStateFront"); PropertyObject.AddToDictionary("shieldStateBack", "shieldStateBack"); PropertyObject.AddToDictionary("shieldMaxStateBack", "shieldMaxStateBack"); PropertyObject.AddToDictionary("shieldsOn", "shieldsOn"); PropertyObject.AddToDictionary("triggersMines", "triggersMines"); PropertyObject.AddToDictionary("systemDamageBeam", "systemDamageBeam"); PropertyObject.AddToDictionary("systemDamageTorpedo", "systemDamageTorpedo"); PropertyObject.AddToDictionary("systemDamageTactical", "systemDamageTactical"); PropertyObject.AddToDictionary("systemDamageTurning", "systemDamageTurning"); PropertyObject.AddToDictionary("systemDamageImpulse", "systemDamageImpulse"); PropertyObject.AddToDictionary("systemDamageWarp", "systemDamageWarp"); PropertyObject.AddToDictionary("systemDamageFrontShield", "systemDamageFrontShield"); PropertyObject.AddToDictionary("systemDamageBackShield", "systemDamageBackShield"); PropertyObject.AddToDictionary("shieldBandStrength0", "shieldBandStrength0"); PropertyObject.AddToDictionary("shieldBandStrength1", "shieldBandStrength1"); PropertyObject.AddToDictionary("shieldBandStrength2", "shieldBandStrength2"); PropertyObject.AddToDictionary("shieldBandStrength3", "shieldBandStrength3"); PropertyObject.AddToDictionary("shieldBandStrength4", "shieldBandStrength4"); PropertyObject.NewMenuGroup("Shielded ships"); PropertyObject.AddToDictionary("targetPointX", "targetPointX"); PropertyObject.AddToDictionary("targetPointY", "targetPointY"); PropertyObject.AddToDictionary("targetPointZ", "targetPointZ"); PropertyObject.AddToDictionary("hasSurrendered", "hasSurrendered"); PropertyObject.AddToDictionary("eliteAIType", "eliteAIType"); PropertyObject.AddToDictionary("eliteAbilityBits", "eliteAbilityBits"); PropertyObject.AddToDictionary("eliteAbilityState", "eliteAbilityState"); PropertyObject.AddToDictionary("surrenderChance", "surrenderChance"); PropertyObject.NewMenuGroup("Enemies"); PropertyObject.AddToDictionary("exitPointX", "exitPointX"); PropertyObject.AddToDictionary("exitPointY", "exitPointY"); PropertyObject.AddToDictionary("exitPointZ", "exitPointZ"); PropertyObject.NewMenuGroup("Neutrals"); PropertyObject.AddToDictionary("countHoming", "countHoming"); PropertyObject.AddToDictionary("countNuke", "countNuke"); PropertyObject.AddToDictionary("countMine", "countMine"); PropertyObject.AddToDictionary("countECM", "countECM"); PropertyObject.AddToDictionary("energy", "energy"); PropertyObject.AddToDictionary("warpState", "warpState"); PropertyObject.AddToDictionary("currentRealSpeed", "currentRealSpeed"); PropertyObject.NewMenuGroup("Players"); PropertyObject.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_NestedList; PropertyFleet = new ExpressionMemberValueEditor(); PropertyFleet.AddToDictionary("fleetSpacing", "spacing"); PropertyFleet.AddToDictionary("fleetMaxRadius", "max radius"); PropertyFleet.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; SkyboxIndex = new ExpressionMemberValueEditor(); for (int i = 0; i <= 29; i++) SkyboxIndex.AddToDictionary(i.ToString(), i.ToString()); SkyboxIndex.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultListPlusDialog; Difficulty = new ExpressionMemberValueEditor(); for (int i = 0; i <= 11; i++) Difficulty.AddToDictionary(i.ToString(), i.ToString()); Difficulty.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; ShipSystem = new ExpressionMemberValueEditor(); ShipSystem.AddToDictionary("systemBeam", "Primary Beam"); ShipSystem.AddToDictionary("systemTorpedo", "Torpedo"); ShipSystem.AddToDictionary("systemTactical", "Sensors"); ShipSystem.AddToDictionary("systemTurning", "Maneuver"); ShipSystem.AddToDictionary("systemImpulse", "Impulse"); ShipSystem.AddToDictionary("systemWarp", "Warp"); ShipSystem.AddToDictionary("systemFrontShield", "Front Shield"); ShipSystem.AddToDictionary("systemBackShield", "Rear Shield"); ShipSystem.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; CountFrom = new ExpressionMemberValueEditor(); CountFrom.AddToDictionary("left", "left"); CountFrom.AddToDictionary("top", "top"); CountFrom.AddToDictionary("front", "front"); CountFrom.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; DamageValue = new ExpressionMemberValueEditor_Percent(); DamageValue.AddToDictionary("0.0", "0%"); DamageValue.AddToDictionary("0.25", "25%"); DamageValue.AddToDictionary("0.5", "50%"); DamageValue.AddToDictionary("0.75", "75%"); DamageValue.AddToDictionary("1.0", "100%"); DamageValue.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultListPlusDialog; TeamIndex = new ExpressionMemberValueEditor(); TeamIndex.AddToDictionary("0", "0"); TeamIndex.AddToDictionary("1", "1"); TeamIndex.AddToDictionary("2", "2"); TeamIndex.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; TeamAmount = new ExpressionMemberValueEditor(); TeamAmount.AddToDictionary("0", "0"); TeamAmount.AddToDictionary("1", "1"); TeamAmount.AddToDictionary("2", "2"); TeamAmount.AddToDictionary("3", "3"); TeamAmount.AddToDictionary("4", "4"); TeamAmount.AddToDictionary("5", "5"); TeamAmount.AddToDictionary("6", "6"); TeamAmount.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; TeamAmountF = new ExpressionMemberValueEditor(); TeamAmountF.AddToDictionary("0", "0"); TeamAmountF.AddToDictionary("1", "1"); TeamAmountF.AddToDictionary("2", "2"); TeamAmountF.AddToDictionary("3", "3"); TeamAmountF.AddToDictionary("4", "4"); TeamAmountF.AddToDictionary("5", "5"); TeamAmountF.AddToDictionary("6", "6"); TeamAmountF.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultListPlusDialog; SpecialShipType = new ExpressionMemberValueEditor(); SpecialShipType.AddToDictionary(null, "Unspecified"); SpecialShipType.AddToDictionary("-1", "Nothing"); SpecialShipType.AddToDictionary("0", "Dilapidated"); SpecialShipType.AddToDictionary("1", "Upgraded"); SpecialShipType.AddToDictionary("2", "Overpowered"); SpecialShipType.AddToDictionary("3", "Underpowered"); SpecialShipType.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultListWithFirstSeparated; SpecialCapitainType = new ExpressionMemberValueEditor(); SpecialCapitainType.AddToDictionary(null, "Unspecified"); SpecialCapitainType.AddToDictionary("-1", "Nothing"); SpecialCapitainType.AddToDictionary("0", "Cowardly"); SpecialCapitainType.AddToDictionary("1", "Brave"); SpecialCapitainType.AddToDictionary("2", "Bombastic"); SpecialCapitainType.AddToDictionary("3", "Seething"); SpecialCapitainType.AddToDictionary("4", "Duplicitous"); SpecialCapitainType.AddToDictionary("5", "Exceptional"); SpecialCapitainType.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultListWithFirstSeparated; Side = new ExpressionMemberValueEditor(); Side.AddToDictionary(null, "Default"); Side.AddToDictionary("0", "0 (No side)"); Side.AddToDictionary("1", "1 (Enemy)"); Side.AddToDictionary("2", "2 (Player)"); Side.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultListPlusDialogWithFirstSepearted; Comparator = new ExpressionMemberValueEditor(); Comparator.AddToDictionary("GREATER", ">"); Comparator.AddToDictionary("GREATER_EQUAL", ">="); Comparator.AddToDictionary("EQUALS", "="); Comparator.AddToDictionary("NOT", "!="); Comparator.AddToDictionary("LESS_EQUAL", "<="); Comparator.AddToDictionary("LESS", "<"); Comparator.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; DistanceNebulaCheck = new ExpressionMemberValueEditor(); DistanceNebulaCheck.AddToDictionary("anywhere2", "anywhere"); DistanceNebulaCheck.AddToMenuDictionary("anywhere", "anywhere on the map"); DistanceNebulaCheck.AddToMenuDictionary("anywhere2", "anywhere outside a nebula or up to ... if inside"); DistanceNebulaCheck.AddToMenuDictionary("closer than", "closer than ... if outside a nebula or up to ... if inside"); DistanceNebulaCheck.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultCheck; ConvertDirectCheck = new ExpressionMemberValueEditor(); ConvertDirectCheck.AddToDictionary("Do nothing", "(Click here to convert)"); ConvertDirectCheck.AddToDictionary("Convert to add_ai", "YOU SHOULD NEVER SEE THIS"); ConvertDirectCheck.AddToMenuDictionary("Do nothing", "Do nothing"); ConvertDirectCheck.AddToMenuDictionary("Convert to add_ai", "Convert to add_ai"); ConvertDirectCheck.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultCheck; TimerName = new ExpressionMemberValueEditor(); TimerName.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_TimerNameList; Mission.NamesListUpdated += new Action(() => { TimerName.InvalidateContextMenuStrip(); }); VariableName = new ExpressionMemberValueEditor(); VariableName.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_VariableNameList; Mission.NamesListUpdated += new Action(() => { VariableName.InvalidateContextMenuStrip(); }); NamedAllName = new ExpressionMemberValueEditor(); NamedAllName.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_NamedAllNameList; Mission.NamesListUpdated += new Action(() => { NamedAllName.InvalidateContextMenuStrip(); }); NamedStationName = new ExpressionMemberValueEditor(); NamedStationName.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_NamedStationNameList; Mission.NamesListUpdated += new Action(() => { NamedStationName.InvalidateContextMenuStrip(); }); ConsoleList = new ExpressionMemberValueEditor_ConsoleList(); EliteAIType = new ExpressionMemberValueEditor(); EliteAIType.AddToDictionary("0", "behave like a normal ship"); EliteAIType.AddToDictionary("0.0", "behave like a normal ship"); EliteAIType.AddToDictionary("1", "follow nearest normal fleet"); EliteAIType.AddToDictionary("1.0", "follow nearest normal fleet"); EliteAIType.AddToDictionary("2", "ignore everything except players"); EliteAIType.AddToDictionary("2.0", "ignore everything except players"); EliteAIType.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; EliteAbilityBits = new ExpressionMemberValueEditor_AbilityBits(); PlayerNames = new ExpressionMemberValueEditor(); PlayerNames.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_PlayerListPlusDialog; WarpState = new ExpressionMemberValueEditor(); WarpState.AddToDictionary("0", "0"); WarpState.AddToDictionary("1", "1"); WarpState.AddToDictionary("2", "2"); WarpState.AddToDictionary("3", "3"); WarpState.AddToDictionary("4", "4"); WarpState.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_DefaultList; PathEditor = new ExpressionMemberValueEditor_PathEditor(); HullID = new ExpressionMemberValueEditor_HullID(); HullID.PrepareContextMenuStripMethod = ExpressionMemberValueEditor.PrepareContextMenuStrip_HullIDList; VesselData.VesselDataChanged += new Action(() => { HullID.InvalidateContextMenuStrip(); }); RaceKeys = new ExpressionMemberValueEditor_RaceKeys(); VesselData.VesselDataChanged += new Action(() => { RaceKeys.InvalidateContextMenuStrip(); }); HullKeys = new ExpressionMemberValueEditor_HullKeys(); VesselData.VesselDataChanged += new Action(() => { HullKeys.InvalidateContextMenuStrip(); }); }