public static string GetKeyName(Keys key) { if (key == (Keys)69632) { return("Wheel Up"); } if (key == (Keys)69633) { return("Wheel Down"); } if (key == (Keys)69634) { return("Wheel Press"); } if (GMacroEditorPanel.m_Aliases == null) { GMacroEditorPanel.LoadAliases(); } int index = (int)key; if (index >= 0 && index < GMacroEditorPanel.m_Aliases.Length && GMacroEditorPanel.m_Aliases[index] != null) { return(GMacroEditorPanel.m_Aliases[index]); } return(key.ToString()); }
public static string Find(string toFind, ParamNode n) { if (n.Param == toFind) { return(n.Name); } return(GMacroEditorPanel.Find(toFind, n.Nodes)); }
private static void LoadAliases() { GMacroEditorPanel.m_Aliases = new string[256]; GMacroEditorPanel.SetAlias(Keys.Add, "Num +"); GMacroEditorPanel.SetAlias(Keys.Back, "Backspace"); GMacroEditorPanel.SetAlias(Keys.Capital, "Caps Lock"); GMacroEditorPanel.SetAlias(Keys.ControlKey, "Control"); GMacroEditorPanel.SetAlias(Keys.D0, "0"); GMacroEditorPanel.SetAlias(Keys.D1, "1"); GMacroEditorPanel.SetAlias(Keys.D2, "2"); GMacroEditorPanel.SetAlias(Keys.D3, "3"); GMacroEditorPanel.SetAlias(Keys.D4, "4"); GMacroEditorPanel.SetAlias(Keys.D5, "5"); GMacroEditorPanel.SetAlias(Keys.D6, "6"); GMacroEditorPanel.SetAlias(Keys.D7, "7"); GMacroEditorPanel.SetAlias(Keys.D8, "8"); GMacroEditorPanel.SetAlias(Keys.D9, "9"); GMacroEditorPanel.SetAlias(Keys.Decimal, "Num ."); GMacroEditorPanel.SetAlias(Keys.Divide, "Num /"); GMacroEditorPanel.SetAlias(Keys.Menu, "Alt"); GMacroEditorPanel.SetAlias(Keys.Multiply, "Num *"); GMacroEditorPanel.SetAlias(Keys.NumLock, "Num Lock"); GMacroEditorPanel.SetAlias(Keys.NumPad0, "Num 0"); GMacroEditorPanel.SetAlias(Keys.NumPad1, "Num 1"); GMacroEditorPanel.SetAlias(Keys.NumPad2, "Num 2"); GMacroEditorPanel.SetAlias(Keys.NumPad3, "Num 3"); GMacroEditorPanel.SetAlias(Keys.NumPad4, "Num 4"); GMacroEditorPanel.SetAlias(Keys.NumPad5, "Num 5"); GMacroEditorPanel.SetAlias(Keys.NumPad6, "Num 6"); GMacroEditorPanel.SetAlias(Keys.NumPad7, "Num 7"); GMacroEditorPanel.SetAlias(Keys.NumPad8, "Num 8"); GMacroEditorPanel.SetAlias(Keys.NumPad9, "Num 9"); GMacroEditorPanel.SetAlias(Keys.OemClear, "Clear"); GMacroEditorPanel.SetAlias(Keys.OemCloseBrackets, "]"); GMacroEditorPanel.SetAlias(Keys.Oemcomma, ","); GMacroEditorPanel.SetAlias(Keys.OemMinus, "-"); GMacroEditorPanel.SetAlias(Keys.OemOpenBrackets, "["); GMacroEditorPanel.SetAlias(Keys.OemPeriod, "."); GMacroEditorPanel.SetAlias(Keys.OemPipe, "\\"); GMacroEditorPanel.SetAlias(Keys.OemBackslash, "\\"); GMacroEditorPanel.SetAlias(Keys.Oemplus, "+"); GMacroEditorPanel.SetAlias(Keys.OemQuestion, "?"); GMacroEditorPanel.SetAlias(Keys.OemQuotes, "'"); GMacroEditorPanel.SetAlias(Keys.OemSemicolon, ";"); GMacroEditorPanel.SetAlias(Keys.Oemtilde, "~"); GMacroEditorPanel.SetAlias(Keys.Next, "Page Down"); GMacroEditorPanel.SetAlias(Keys.Next, "Page Down"); GMacroEditorPanel.SetAlias(Keys.Prior, "Page Up"); GMacroEditorPanel.SetAlias(Keys.Prior, "Page Up"); GMacroEditorPanel.SetAlias(Keys.Snapshot, "Print Screen"); GMacroEditorPanel.SetAlias(Keys.Scroll, "Scroll Lock"); GMacroEditorPanel.SetAlias(Keys.ShiftKey, "Shift"); GMacroEditorPanel.SetAlias(Keys.Subtract, "Num -"); }
public static string Find(string toFind, ParamNode[] nodes) { for (int index = 0; nodes != null && index < nodes.Length; ++index) { string str = GMacroEditorPanel.Find(toFind, nodes[index]); if (str != null) { return(str); } } return((string)null); }
public GEditAction(GMacroEditorPanel p, Macro macro, Action action) : base(0, 0, 103, 86) { this.m_Panel = p; this.m_Macro = macro; this.m_Action = action; Gumps.Modal = (Gump)this; Gumps.Focus = (Gump)this; this.Text = "Edit"; this.m_NonRestrictivePicking = true; this.AddButton("↑", 6, 7, 24, 24, new OnClick(this.Up_OnClick)).Tooltip = (ITooltip) new Tooltip("Moves the instruction up", true); this.AddButton("↓", 6, 30, 24, 24, new OnClick(this.Down_OnClick)).Tooltip = (ITooltip) new Tooltip("Moves the instruction down", true); this.AddButton("Delete", 39, 7, 50, 24, new OnClick(this.Delete_OnClick)).Tooltip = (ITooltip) new Tooltip("Removes the instruction", true); this.Center(); }
public void Finish(Keys key, Keys mods) { if (!this.m_Recording) { return; } this.m_Recording = false; this.String = GMacroEditorPanel.GetKeyName(key); GMacroEditorPanel gmacroEditorPanel = this.m_Parent as GMacroEditorPanel; if (gmacroEditorPanel == null) { return; } gmacroEditorPanel.Macro.Key = key; gmacroEditorPanel.Macro.Mods = mods; gmacroEditorPanel.UpdateModifiers(); gmacroEditorPanel.NotifyParent(); }
public GMacroEditorPanel(Macro m) : base(0, 0, 259, 230) { this.m_Macro = m; this.m_CanDrag = false; this.m_NonRestrictivePicking = true; this.ShouldHitTest = false; this.m_Ctrl = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Ctrl", (IFont)Engine.GetUniFont(2)); this.m_Alt = new GSystemButton(49, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Alt", (IFont)Engine.GetUniFont(2)); this.m_Shift = new GSystemButton(88, 10, 42, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Shift", (IFont)Engine.GetUniFont(2)); this.m_Ctrl.OnClick = new OnClick(this.Ctrl_OnClick); this.m_Alt.OnClick = new OnClick(this.Alt_OnClick); this.m_Shift.OnClick = new OnClick(this.Shift_OnClick); this.m_Ctrl.Tooltip = (ITooltip) new Tooltip("Toggles the control key modifier", true); this.m_Alt.Tooltip = (ITooltip) new Tooltip("Toggles the alt key modifier", true); this.m_Shift.Tooltip = (ITooltip) new Tooltip("Toggles the shift key modifier", true); this.m_Children.Add((Gump)this.m_Ctrl); this.m_Children.Add((Gump)this.m_Alt); this.m_Children.Add((Gump)this.m_Shift); this.UpdateModifiers(); this.m_Children.Add((Gump) new GAlphaBackground(129, 10, 74, 20) { FillAlpha = 1f, FillColor = GumpColors.Window }); GMacroKeyEntry gmacroKeyEntry = new GMacroKeyEntry(GMacroEditorPanel.GetKeyName(m.Key), 129, 10, 74, 20); gmacroKeyEntry.Tooltip = (ITooltip) new Tooltip("Press any key here to change the macro", true); this.m_Children.Add((Gump)gmacroKeyEntry); GSystemButton gsystemButton = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, "Delete", (IFont)Engine.GetUniFont(2)); gsystemButton.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, 0.25f)); gsystemButton.InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f); gsystemButton.Tooltip = (ITooltip) new Tooltip("Deletes the entire macro", true); gsystemButton.OnClick = new OnClick(this.Delete_OnClick); gsystemButton.X = this.Width - 10 - gsystemButton.Width; this.m_Children.Add((Gump)gsystemButton); this.FillAlpha = 0.15f; for (int index = 0; index < m.Actions.Count; ++index) { try { Action action = m.Actions[index]; if (action.Handler != null) { ActionHandler handler = action.Handler; GMainMenu gmainMenu = new GMainMenu(10, 35 + index * 23); GMenuItem mi = (GMenuItem) new GActionMenu(this, m, action); gmainMenu.Add(this.FormatMenu(mi)); if (handler.Params == null) { GAlphaBackground galphaBackground = new GAlphaBackground(129, 35 + index * 23, 120, 24); galphaBackground.FillAlpha = 1f; galphaBackground.FillColor = GumpColors.Window; this.m_Children.Add((Gump)galphaBackground); IHue windowText = GumpHues.WindowText; GTextBox gtextBox = (GTextBox) new GMacroParamEntry(action, action.Param, galphaBackground.X + 4, galphaBackground.Y, galphaBackground.Width - 4, galphaBackground.Height); gtextBox.MaxChars = 239; this.m_Children.Add((Gump)gtextBox); } else if (handler.Params.Length != 0) { GMenuItem menuFrom = this.GetMenuFrom(new ParamNode(GMacroEditorPanel.Find(action.Param, handler.Params) ?? action.Param, handler.Params), action, handler); menuFrom.DropDown = index == m.Actions.Count - 1; gmainMenu.Add(menuFrom); } gmainMenu.LeftToRight = true; this.m_Children.Add((Gump)gmainMenu); } } catch { } } GMainMenu gmainMenu1 = new GMainMenu(10, 35 + m.Actions.Count * 23); GMenuItem menuFrom1 = this.GetMenuFrom(ActionHandler.Root); menuFrom1.Tooltip = (ITooltip) new Tooltip("To create a new instruction pick one from the menu below", false, 200); menuFrom1.Text = "New..."; menuFrom1.DropDown = true; gmainMenu1.Add(this.FormatMenu(menuFrom1)); gmainMenu1.LeftToRight = true; this.m_Children.Add((Gump)gmainMenu1); }
public GMacroKeyButton(Keys key, string name, bool bold, int x, int y, int w, int h) : base(x, y, w, h, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), SystemColors.ControlText, name, bold ? (IFont)Engine.GetUniFont(1) : (IFont)Engine.GetUniFont(2)) { this.m_Key = key; this.Tooltip = (ITooltip) new Tooltip(string.Format("{0}\nClick to create", (object)GMacroEditorPanel.GetKeyName(this.m_Key)), true); this.FillAlpha = 1f; this.m_QuickDrag = false; this.m_CanDrag = true; this.OnClick = new OnClick(this.Clicked); }