Example #1
0
        public GMacroEditorPanel(Client.Macro m) : base(0, 0, 0x103, 230)
        {
            GMainMenu menu;
            GMenuItem menuFrom;

            this.m_Macro   = m;
            base.m_CanDrag = false;
            base.m_NonRestrictivePicking = true;
            base.ShouldHitTest           = false;
            this.m_Ctrl          = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Ctrl", Engine.GetUniFont(2));
            this.m_Alt           = new GSystemButton(0x31, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Alt", Engine.GetUniFont(2));
            this.m_Shift         = new GSystemButton(0x58, 10, 0x2a, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Shift", 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  = new Tooltip("Toggles the control key modifier", true);
            this.m_Alt.Tooltip   = new Tooltip("Toggles the alt key modifier", true);
            this.m_Shift.Tooltip = new Tooltip("Toggles the shift key modifier", true);
            base.m_Children.Add(this.m_Ctrl);
            base.m_Children.Add(this.m_Alt);
            base.m_Children.Add(this.m_Shift);
            this.UpdateModifiers();
            GAlphaBackground toAdd = new GAlphaBackground(0x81, 10, 0x4a, 20)
            {
                FillAlpha = 1f,
                FillColor = GumpColors.Window
            };

            base.m_Children.Add(toAdd);
            GMacroKeyEntry entry = new GMacroKeyEntry(GetKeyName(m.Key), 0x81, 10, 0x4a, 20)
            {
                Tooltip = new Tooltip("Press any key here to change the macro", true)
            };

            base.m_Children.Add(entry);
            GSystemButton button = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Delete", Engine.GetUniFont(2));

            button.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, (float)0.25f));
            button.InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f);
            button.Tooltip       = new Tooltip("Deletes the entire macro", true);
            button.OnClick       = new OnClick(this.Delete_OnClick);
            button.X             = (this.Width - 10) - button.Width;
            base.m_Children.Add(button);
            base.FillAlpha = 0.15f;
            for (int i = 0; i < m.Actions.Length; i++)
            {
                try
                {
                    Action action = m.Actions[i];
                    if (action.Handler != null)
                    {
                        ActionHandler ah = action.Handler;
                        menu     = new GMainMenu(10, 0x23 + (i * 0x17));
                        menuFrom = new GActionMenu(this, m, action);
                        menu.Add(this.FormatMenu(menuFrom));
                        if (ah.Params == null)
                        {
                            GAlphaBackground background2 = new GAlphaBackground(0x81, 0x23 + (i * 0x17), 120, 0x18)
                            {
                                FillAlpha = 1f,
                                FillColor = GumpColors.Window
                            };
                            base.m_Children.Add(background2);
                            IHue     windowText = GumpHues.WindowText;
                            GTextBox box        = new GMacroParamEntry(action, action.Param, background2.X, background2.Y, background2.Width, background2.Height)
                            {
                                MaxChars = 0xef
                            };
                            base.m_Children.Add(box);
                        }
                        else if (ah.Params.Length != 0)
                        {
                            string name = Find(action.Param, ah.Params);
                            if (name == null)
                            {
                                name = action.Param;
                            }
                            menuFrom          = this.GetMenuFrom(new ParamNode(name, ah.Params), action, ah);
                            menuFrom.DropDown = i == (m.Actions.Length - 1);
                            menu.Add(menuFrom);
                        }
                        menu.LeftToRight = true;
                        base.m_Children.Add(menu);
                    }
                }
                catch
                {
                }
            }
            menu              = new GMainMenu(10, 0x23 + (m.Actions.Length * 0x17));
            menuFrom          = this.GetMenuFrom(ActionHandler.Root);
            menuFrom.Tooltip  = new Tooltip("To create a new instruction pick one from the menu below", false, 200);
            menuFrom.Text     = "New...";
            menuFrom.DropDown = true;
            menu.Add(this.FormatMenu(menuFrom));
            menu.LeftToRight = true;
            base.m_Children.Add(menu);
        }
Example #2
0
 public GMacroEditorPanel(Client.Macro m)
     : base(0, 0, 0x103, 230)
 {
     GMainMenu menu;
     GMenuItem menuFrom;
     this.m_Macro = m;
     base.m_CanDrag = false;
     base.m_NonRestrictivePicking = true;
     base.ShouldHitTest = false;
     this.m_Ctrl = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float) 0.5f), SystemColors.ControlText, "Ctrl", Engine.GetUniFont(2));
     this.m_Alt = new GSystemButton(0x31, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float) 0.5f), SystemColors.ControlText, "Alt", Engine.GetUniFont(2));
     this.m_Shift = new GSystemButton(0x58, 10, 0x2a, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float) 0.5f), SystemColors.ControlText, "Shift", 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 = new Tooltip("Toggles the control key modifier", true);
     this.m_Alt.Tooltip = new Tooltip("Toggles the alt key modifier", true);
     this.m_Shift.Tooltip = new Tooltip("Toggles the shift key modifier", true);
     base.m_Children.Add(this.m_Ctrl);
     base.m_Children.Add(this.m_Alt);
     base.m_Children.Add(this.m_Shift);
     this.UpdateModifiers();
     GAlphaBackground toAdd = new GAlphaBackground(0x81, 10, 0x4a, 20) {
         FillAlpha = 1f,
         FillColor = GumpColors.Window
     };
     base.m_Children.Add(toAdd);
     GMacroKeyEntry entry = new GMacroKeyEntry(GetKeyName(m.Key), 0x81, 10, 0x4a, 20) {
         Tooltip = new Tooltip("Press any key here to change the macro", true)
     };
     base.m_Children.Add(entry);
     GSystemButton button = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float) 0.5f), SystemColors.ControlText, "Delete", Engine.GetUniFont(2));
     button.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, (float) 0.25f));
     button.InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float) 0.5f);
     button.Tooltip = new Tooltip("Deletes the entire macro", true);
     button.OnClick = new OnClick(this.Delete_OnClick);
     button.X = (this.Width - 10) - button.Width;
     base.m_Children.Add(button);
     base.FillAlpha = 0.15f;
     for (int i = 0; i < m.Actions.Length; i++)
     {
         try
         {
             Action action = m.Actions[i];
             if (action.Handler != null)
             {
                 ActionHandler ah = action.Handler;
                 menu = new GMainMenu(10, 0x23 + (i * 0x17));
                 menuFrom = new GActionMenu(this, m, action);
                 menu.Add(this.FormatMenu(menuFrom));
                 if (ah.Params == null)
                 {
                     GAlphaBackground background2 = new GAlphaBackground(0x81, 0x23 + (i * 0x17), 120, 0x18) {
                         FillAlpha = 1f,
                         FillColor = GumpColors.Window
                     };
                     base.m_Children.Add(background2);
                     IHue windowText = GumpHues.WindowText;
                     GTextBox box = new GMacroParamEntry(action, action.Param, background2.X, background2.Y, background2.Width, background2.Height) {
                         MaxChars = 0xef
                     };
                     base.m_Children.Add(box);
                 }
                 else if (ah.Params.Length != 0)
                 {
                     string name = Find(action.Param, ah.Params);
                     if (name == null)
                     {
                         name = action.Param;
                     }
                     menuFrom = this.GetMenuFrom(new ParamNode(name, ah.Params), action, ah);
                     menuFrom.DropDown = i == (m.Actions.Length - 1);
                     menu.Add(menuFrom);
                 }
                 menu.LeftToRight = true;
                 base.m_Children.Add(menu);
             }
         }
         catch
         {
         }
     }
     menu = new GMainMenu(10, 0x23 + (m.Actions.Length * 0x17));
     menuFrom = this.GetMenuFrom(ActionHandler.Root);
     menuFrom.Tooltip = new Tooltip("To create a new instruction pick one from the menu below", false, 200);
     menuFrom.Text = "New...";
     menuFrom.DropDown = true;
     menu.Add(this.FormatMenu(menuFrom));
     menu.LeftToRight = true;
     base.m_Children.Add(menu);
 }