Esempio n. 1
0
        public override void OnKeyDown(KeyEventArgs e)
        {
            var allowToolSelection = true;

            if (SelectedTool != null)
            {
                SelectedTool.OnKeyDown(e);
                allowToolSelection = SelectedTool.AllowToolShortcuts;
            }

            if (!e.Handled && allowToolSelection)
            {
                foreach (var tool in Tools)
                {
                    if (e.KeyData == tool.Accelerator && tool != SelectedTool)
                    {
                        SelectedTool = tool;
                        e.Handled    = true;
                        break;
                    }
                }
            }
            if (!e.Handled)
            {
                base.OnKeyDown(e);
            }
        }
Esempio n. 2
0
 public override void GeneratePads(GeneratePadArgs args)
 {
     base.GeneratePads(args);
     if (Document.EditMode && (this.Client == null || this.Client.CurrentUser.Level >= Pablo.Network.UserLevel.Editor))
     {
         var layout = new DynamicLayout {
             Padding = new Padding(5)
         };
         layout.BeginVertical(Padding.Empty, Size.Empty);
         layout.Add(new Controls.ColourPad(this));
         layout.EndVertical();
         layout.Add(new Controls.ToolboxPad(this));
         args.LeftPads.Add(layout);
     }
     else
     {
         this.SelectedTool = null;
     }
 }