Ejemplo n.º 1
0
 /// <summary>
 /// Initializes special menus.
 /// </summary>
 public void InitializeSpecialMenus()
 {
     CreateProvidersLinks();
     CommonMenusControl.Instance.ActionViewStats.Enabled = Settings.UsageStatisticsEnabled;
     CommonMenusControl.Instance.ActionViewLog.Enabled   = DebugManager.TraceEnabled;
     ActionWebLinks.Visible = Settings.WebLinksMenuEnabled;
     if (Settings.WebLinksMenuEnabled)
     {
         ActionWebLinks.InitializeFromWebLinks(InitializeSpecialMenus);
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Processes the command key.
    /// </summary>
    /// <seealso cref="M:System.Windows.Forms.Form.ProcessCmdKey(Message@,Keys)"/>
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
        if (Globals.IsReady)
        {
            switch (keyData)
            {
            // Top menu system
            case Keys.Alt | Keys.S:
                ActionSettings.ShowDropDown();
                return(true);

            case Keys.Alt | Keys.I:
                ActionInformation.ShowDropDown();
                return(true);

            case Keys.F9:
                ActionPreferences.PerformClick();
                return(true);

            case Keys.Alt | Keys.Control | Keys.F4:
                ActionExit.PerformClick();
                return(true);

            case Keys.Escape:
                if (!EditESCtoExit.Checked || EditMeanings.IsCurrentCellInEditMode)
                {
                    break;
                }
                ActionExit.PerformClick();
                return(true);

            // Rotate view
            case Keys.Control | Keys.Shift | Keys.Tab:
                if (Globals.AllowClose)
                {
                    SetView(Settings.CurrentView.Previous(ViewMode.Notebook));// TODO notebook remove when ready
                }
                return(true);

            case Keys.Control | Keys.Tab:
                if (Globals.AllowClose)
                {
                    SetView(Settings.CurrentView.Next(ViewMode.Notebook));// TODO notebook remove when ready
                }
                return(true);

            // Change view
            case Keys.F1:
                ActionViewAnalysis.PerformClick();
                return(true);

            case Keys.F2:
                ActionViewLetters.PerformClick();
                return(true);

            case Keys.F3:
                if (!Globals.IsDebugExecutable)
                {
                    break;                         // TODO remove when ready
                }
                ActionViewNotebook.PerformClick();
                return(true);

            // Application functions
            case Keys.F5:
            case Keys.Control | Keys.F:
                ActionSearchTerm.PerformClick();
                return(true);

            case Keys.Control | Keys.N:
                ActionNewInstance.PerformClick();
                return(true);

            // Top menu system
            case Keys.Alt | Keys.T:
                ActionTools.ShowDropDown();
                return(true);

            case Keys.Alt | Keys.L:
                if (ActionWebLinks.Enabled)
                {
                    ActionWebLinks.ShowDropDown();
                }
                return(true);

            // Data edition
            case Keys.Control | Keys.S:
                ActionSave.PerformClick();
                return(true);

            case Keys.Control | Keys.Back:
                ActionUndo.Focus();
                ActionUndo.PerformClick();
                return(true);
            }
        }
        // Letters navigation
        if (Globals.AllowClose && Settings.CurrentView == ViewMode.Letters)
        {
            switch (keyData)
            {
            case Keys.Control | Keys.Home:
                LettersNavigator.ActionFirst.PerformClick();
                return(true);

            case Keys.Control | Keys.End:
                LettersNavigator.ActionLast.PerformClick();
                return(true);

            case Keys.Control | Keys.PageUp:
                LettersNavigator.ActionPrevious.PerformClick();
                return(true);

            case Keys.Control | Keys.PageDown:
                LettersNavigator.ActionNext.PerformClick();
                return(true);
            }
        }
        return(base.ProcessCmdKey(ref msg, keyData));
    }