Exemplo n.º 1
0
 void UpdateGlobalWarningLabel()
 {
     KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts(IdeApp.CommandService.GetCommands());
     if (conflicts.Length == 0)
     {
         globalWarningBox.Hide();
         return;
     }
     globalWarningBox.Show();
     conflicButton.MenuCreator = delegate {
         Menu menu = new Menu();
         foreach (KeyBindingConflict conf in conflicts)
         {
             if (menu.Children.Length > 0)
             {
                 SeparatorMenuItem it = new SeparatorMenuItem();
                 it.Show();
                 menu.Insert(it, -1);
             }
             foreach (Command cmd in conf.Commands)
             {
                 string   txt      = currentBindings.GetBinding(cmd) + " - " + cmd.Text;
                 MenuItem item     = new MenuItem(txt);
                 Command  localCmd = cmd;
                 item.Activated += delegate {
                     SelectCommand(localCmd);
                 };
                 item.Show();
                 menu.Insert(item, -1);
             }
         }
         return(menu);
     };
 }
Exemplo n.º 2
0
        void OnKeyBindingSchemeChanged(object sender, EventArgs e)
        {
            if (internalUpdate)
            {
                return;
            }

            if (schemeCombo.Active == 0)
            {
                return;
            }

            Command  command;
            string   binding;
            TreeIter iter;

            if (!keyStore.GetIterFirst(out iter))
            {
                return;
            }

            // Load a key binding template
            KeyBindingScheme scheme = KeyBindingService.GetSchemeByName(schemeCombo.ActiveText);

            currentBindings = scheme.GetKeyBindingSet().Clone();

            do
            {
                TreeIter citer;
                keyStore.IterChildren(out citer, iter);
                do
                {
                    command = (Command)keyStore.GetValue(citer, commandCol);
                    binding = currentBindings.GetBinding(command);
                    keyStore.SetValue(citer, bindingCol, binding);
                } while (keyStore.IterNext(ref citer));
            } while (keyStore.IterNext(ref iter));

            UpdateGlobalWarningLabel();
        }
Exemplo n.º 3
0
        void UpdateGlobalWarningLabel()
        {
            KeyBindingConflict[] conflicts = currentBindings.CheckKeyBindingConflicts(IdeApp.CommandService.GetCommands());
            if (conflicts.Length == 0)
            {
                globalWarningBox.Hide();
                return;
            }
            globalWarningBox.Show();

            conflicButton.ContextMenuRequested = delegate {
                ContextMenu menu  = new ContextMenu();
                bool        first = true;

                foreach (KeyBindingConflict conf in conflicts)
                {
                    if (first == false)
                    {
                        ContextMenuItem item = new SeparatorContextMenuItem();
                        menu.Items.Add(item);
                    }

                    foreach (Command cmd in conf.Commands)
                    {
                        string          txt      = currentBindings.GetBinding(cmd) + " - " + cmd.Text;
                        ContextMenuItem item     = new ContextMenuItem(txt);
                        Command         localCmd = cmd;

                        item.Clicked += (sender, e) => SelectCommand(localCmd);

                        menu.Items.Add(item);
                        first = false;
                    }
                }

                return(menu);
            };
        }