Пример #1
0
        private GSystemButton AddButton(string name, int x, int y, int w, int h, OnClick onClick)
        {
            GSystemButton gsystemButton = new GSystemButton(x, y, w, h, SystemColors.Control, SystemColors.ControlText, name, (IFont)Engine.GetUniFont(2));

            gsystemButton.OnClick = onClick;
            this.Client.Children.Add((Gump)gsystemButton);
            return(gsystemButton);
        }
Пример #2
0
 private void UpdateModifier(GSystemButton btn, string prefix, bool opt)
 {
     if (opt)
     {
         btn.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, 0.5f));
     }
     else
     {
         btn.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, 0.25f));
         btn.InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f);
     }
 }
Пример #3
0
        public GMacroEditorForm()
            : base(0, 0, 269, 283)
        {
            Gumps.Focus = (Gump)this;
            this.m_NonRestrictivePicking        = true;
            this.Client.m_NonRestrictivePicking = true;
            this.Text = "Macro Editor";
            GAlphaBackground galphaBackground = this.m_Sunken = new GAlphaBackground(1, 2, 259, 230);

            galphaBackground.ShouldHitTest = false;
            galphaBackground.FillAlpha     = 1f;
            galphaBackground.FillColor     = GumpColors.AppWorkspace;
            galphaBackground.DrawBorder    = false;
            this.Client.Children.Add((Gump)galphaBackground);
            this.m_KeyboardFlipper         = new GSystemButton(71, 236, 120, 20, SystemColors.Control, SystemColors.ControlText, "Show Keyboard", (IFont)Engine.GetUniFont(2));
            this.m_KeyboardFlipper.OnClick = new OnClick(this.KeyboardFlipper_OnClick);
            this.Client.Children.Add((Gump)this.m_KeyboardFlipper);
            GSystemButton gsystemButton1 = new GSystemButton(240, 236, 20, 20, SystemColors.Control, SystemColors.ControlText, "→", (IFont)Engine.GetUniFont(2));

            gsystemButton1.Tooltip = (ITooltip) new Tooltip("Advance to the next macro", true);
            gsystemButton1.OnClick = new OnClick(this.Next_OnClick);
            this.Client.Children.Add((Gump)gsystemButton1);
            GSystemButton gsystemButton2 = new GSystemButton(1, 236, 20, 20, SystemColors.Control, SystemColors.ControlText, "←", (IFont)Engine.GetUniFont(2));

            gsystemButton2.Tooltip = (ITooltip) new Tooltip("Go back to the previous macro", true);
            gsystemButton2.OnClick = new OnClick(this.Prev_OnClick);
            this.Client.Children.Add((Gump)gsystemButton2);
            this.Center();
            this.Y -= 92;
            if (Macros.List.Count > 0)
            {
                this.Current = Macros.List[0];
            }
            else
            {
                this.m_NoSel = new GLabel("No macro is currently selected", (IFont)Engine.GetUniFont(1), Hues.Load(1153), 16, 18);
                this.Client.Children.Add((Gump)this.m_NoSel);
            }
        }
Пример #4
0
        public GMacroKeyboard()
            : base(0, 0, 639, 184)
        {
            this.m_Buttons               = new object[256];
            this.m_HighButtons           = new object[256];
            this.FillColor               = GumpColors.Control;
            this.FillAlpha               = 1f;
            this.m_NonRestrictivePicking = true;
            int x = this.Width - 98;

            this.m_All           = new GSystemButton(x - 19, 10, 20, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), Color.Black, "", (IFont)Engine.GetUniFont(2));
            this.m_Ctrl          = new GSystemButton(x, 10, 32, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), Color.Black, "Ctrl", (IFont)Engine.GetUniFont(2));
            this.m_Alt           = new GSystemButton(x + 31, 10, 32, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), Color.Black, "Alt", (IFont)Engine.GetUniFont(2));
            this.m_Shift         = new GSystemButton(x + 62, 10, 32, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, 0.5f), Color.Black, "Shift", (IFont)Engine.GetUniFont(2));
            this.m_All.OnClick   = new OnClick(this.All_OnClick);
            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_Children.Add((Gump)this.m_All);
            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.PlaceKey(Keys.Escape, "Esc");
            this.Skip();
            this.PlaceKey(Keys.F1);
            this.PlaceKey(Keys.F2);
            this.PlaceKey(Keys.F3);
            this.PlaceKey(Keys.F4);
            this.Skip(0.5f);
            this.PlaceKey(Keys.F5);
            this.PlaceKey(Keys.F6);
            this.PlaceKey(Keys.F7);
            this.PlaceKey(Keys.F8);
            this.Skip(0.5f);
            this.PlaceKey(Keys.F9);
            this.PlaceKey(Keys.F10);
            this.PlaceKey(Keys.F11);
            this.PlaceKey(Keys.F12);
            this.Skip(0.25f);
            this.m_Bold = false;
            this.PlaceKey(Keys.Snapshot, "Prnt");
            this.PlaceKey(Keys.Scroll, "Scrl");
            this.PlaceKey(Keys.Pause, "Paus");
            this.m_Bold = true;
            this.m_fX   = 0.0f;
            this.m_fY  += 1.25f;
            this.PlaceKey(Keys.Oemtilde, "~");
            this.PlaceKey(Keys.D1, "1");
            this.PlaceKey(Keys.D2, "2");
            this.PlaceKey(Keys.D3, "3");
            this.PlaceKey(Keys.D4, "4");
            this.PlaceKey(Keys.D5, "5");
            this.PlaceKey(Keys.D6, "6");
            this.PlaceKey(Keys.D7, "7");
            this.PlaceKey(Keys.D8, "8");
            this.PlaceKey(Keys.D9, "9");
            this.PlaceKey(Keys.D0, "0");
            this.PlaceKey(Keys.OemMinus, "-");
            this.PlaceKey(Keys.Oemplus, "+");
            this.m_Bold = false;
            this.PlaceKey(Keys.Back, "Backspace", 2f);
            this.m_Bold = true;
            this.Skip(0.25f);
            this.m_Bold = false;
            this.PlaceKey(Keys.Insert, "Ins");
            this.PlaceKey(Keys.Home);
            this.m_Bold = true;
            this.PlaceKey(Keys.Prior, "↑");
            this.Skip(0.25f);
            this.PlaceKey(Keys.NumLock, "Num");
            this.PlaceKey(Keys.Divide, "/");
            this.PlaceKey(Keys.Multiply, "*");
            this.PlaceKey(Keys.Subtract, "-");
            this.m_fX = 0.0f;
            ++this.m_fY;
            this.PlaceKey(Keys.Tab, 1.5f);
            this.PlaceKey(Keys.Q);
            this.PlaceKey(Keys.W);
            this.PlaceKey(Keys.E);
            this.PlaceKey(Keys.R);
            this.PlaceKey(Keys.T);
            this.PlaceKey(Keys.Y);
            this.PlaceKey(Keys.U);
            this.PlaceKey(Keys.I);
            this.PlaceKey(Keys.O);
            this.PlaceKey(Keys.P);
            this.PlaceKey(Keys.OemOpenBrackets, "[");
            this.PlaceKey(Keys.OemCloseBrackets, "]");
            this.PlaceKey(Keys.OemPipe, "\\", 1.5f);
            this.Skip(0.25f);
            this.m_Bold = false;
            this.PlaceKey(Keys.Delete, "Del");
            this.PlaceKey(Keys.End);
            this.m_Bold = true;
            this.PlaceKey(Keys.Next, "↓");
            this.Skip(0.25f);
            this.PlaceKey(Keys.NumPad7, "7");
            this.PlaceKey(Keys.NumPad8, "8");
            this.PlaceKey(Keys.NumPad9, "9");
            this.PlaceKey(Keys.Add, "+", 1f, 2f);
            this.m_fX = 0.0f;
            ++this.m_fY;
            this.PlaceKey(Keys.Capital, "Caps", 1.75f);
            this.PlaceKey(Keys.A);
            this.PlaceKey(Keys.S);
            this.PlaceKey(Keys.D);
            this.PlaceKey(Keys.F);
            this.PlaceKey(Keys.G);
            this.PlaceKey(Keys.H);
            this.PlaceKey(Keys.J);
            this.PlaceKey(Keys.K);
            this.PlaceKey(Keys.L);
            this.PlaceKey(Keys.OemSemicolon, ";");
            this.PlaceKey(Keys.OemQuotes, "'");
            this.PlaceKey(Keys.Return, 2.25f);
            this.Skip(3.5f);
            this.PlaceKey(Keys.NumPad4, "4");
            this.PlaceKey(Keys.NumPad5, "5");
            this.PlaceKey(Keys.NumPad6, "6");
            this.m_fX = 0.0f;
            ++this.m_fY;
            this.PlaceKey(Keys.ShiftKey, "Shift", 2.25f);
            this.PlaceKey(Keys.Z);
            this.PlaceKey(Keys.X);
            this.PlaceKey(Keys.C);
            this.PlaceKey(Keys.V);
            this.PlaceKey(Keys.B);
            this.PlaceKey(Keys.N);
            this.PlaceKey(Keys.M);
            this.PlaceKey(Keys.Oemcomma, ",");
            this.PlaceKey(Keys.OemPeriod, ".");
            this.PlaceKey(Keys.OemQuestion, "/");
            this.PlaceKey(Keys.ShiftKey, "Shift", 2.75f);
            this.Skip(1.25f);
            this.PlaceKey(Keys.Up, "↑");
            this.Skip(1.25f);
            this.PlaceKey(Keys.NumPad1, "1");
            this.PlaceKey(Keys.NumPad2, "2");
            this.PlaceKey(Keys.NumPad3, "3");
            this.m_Bold = false;
            this.PlaceKey(Keys.Return, "Entr", 1f, 2f);
            this.m_Bold = true;
            this.m_fX   = 0.0f;
            ++this.m_fY;
            this.PlaceKey(Keys.ControlKey, "Ctrl", 1.5f);
            this.PlaceKey(Keys.LWin, "Win", 1.25f);
            this.PlaceKey(Keys.Menu, "Alt", 1.25f);
            this.PlaceKey(Keys.Space, 5.75f);
            this.PlaceKey(Keys.Menu, "Alt", 1.25f);
            this.PlaceKey(Keys.RWin, "Win", 1.25f);
            this.PlaceKey(Keys.Apps, 1.25f);
            this.PlaceKey(Keys.ControlKey, "Ctrl", 1.5f);
            this.Skip(0.25f);
            this.PlaceKey(Keys.Left, "←");
            this.PlaceKey(Keys.Down, "↓");
            this.PlaceKey(Keys.Right, "→");
            this.Skip(0.25f);
            this.PlaceKey(Keys.NumPad0, "0", 2f);
            this.PlaceKey(Keys.Decimal, ".");
            this.Mods = MacroModifiers.All;
        }
Пример #5
0
        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);
        }