コード例 #1
0
        void InitApp(CommandManager commandManager)
        {
            if (initedApp)
            {
                return;
            }

            MacMainMenu.SetAppQuitCommand(CommandManager.ToCommandId(FileCommands.Exit));

            MacMainMenu.AddCommandIDMappings(new Dictionary <object, CarbonCommandID> ()
            {
                { CommandManager.ToCommandId(EditCommands.Copy), CarbonCommandID.Copy },
                { CommandManager.ToCommandId(EditCommands.Cut), CarbonCommandID.Cut },
                { CommandManager.ToCommandId(EditCommands.MonodevelopPreferences), CarbonCommandID.Preferences },
                { CommandManager.ToCommandId(EditCommands.Redo), CarbonCommandID.Redo },
                { CommandManager.ToCommandId(EditCommands.Undo), CarbonCommandID.Undo },
                { CommandManager.ToCommandId(EditCommands.SelectAll), CarbonCommandID.SelectAll },
                { CommandManager.ToCommandId(FileCommands.NewFile), CarbonCommandID.New },
                { CommandManager.ToCommandId(FileCommands.OpenFile), CarbonCommandID.Open },
                { CommandManager.ToCommandId(FileCommands.Save), CarbonCommandID.Save },
                { CommandManager.ToCommandId(FileCommands.SaveAs), CarbonCommandID.SaveAs },
                { CommandManager.ToCommandId(FileCommands.CloseFile), CarbonCommandID.Close },
                { CommandManager.ToCommandId(FileCommands.Exit), CarbonCommandID.Quit },
                { CommandManager.ToCommandId(FileCommands.ReloadFile), CarbonCommandID.Revert },
                { CommandManager.ToCommandId(HelpCommands.About), CarbonCommandID.About },
                { CommandManager.ToCommandId(HelpCommands.Help), CarbonCommandID.AppHelp },
                { CommandManager.ToCommandId(MacIntegrationCommands.HideWindow), CarbonCommandID.Hide },
                { CommandManager.ToCommandId(MacIntegrationCommands.HideOthers), CarbonCommandID.HideOthers },
            });

            //mac-ify these command names
            commandManager.GetCommand(EditCommands.MonodevelopPreferences).Text = GettextCatalog.GetString("Preferences...");
            commandManager.GetCommand(EditCommands.DefaultPolicies).Text        = GettextCatalog.GetString("Custom Policies...");
            commandManager.GetCommand(HelpCommands.About).Text = GettextCatalog.GetString("About {0}", BrandingService.ApplicationName);
            commandManager.GetCommand(MacIntegrationCommands.HideWindow).Text = GettextCatalog.GetString("Hide {0}", BrandingService.ApplicationName);
            commandManager.GetCommand(ToolCommands.AddinManager).Text         = GettextCatalog.GetString("Add-in Manager...");

            initedApp = true;

            IdeApp.Workbench.RootWindow.DeleteEvent += HandleDeleteEvent;

            if (MacSystemInformation.OsVersion >= MacSystemInformation.Lion)
            {
                IdeApp.Workbench.RootWindow.Realized += (sender, args) => {
                    var win = GtkQuartz.GetWindow((Gtk.Window)sender);
                    win.CollectionBehavior |= NSWindowCollectionBehavior.FullScreenPrimary;
                };
            }
        }
コード例 #2
0
        static void InitApp(CommandManager commandManager)
        {
            if (initedApp)
            {
                return;
            }

            MacMainMenu.AddCommandIDMappings(new Dictionary <object, CarbonCommandID> ()
            {
                { CommandManager.ToCommandId(EditCommands.Copy), CarbonCommandID.Copy },
                { CommandManager.ToCommandId(EditCommands.Cut), CarbonCommandID.Cut },
                //FIXME: for some reason mapping this causes two menu items to be created
                // { EditCommands.MonodevelopPreferences, CarbonCommandID.Preferences },
                { CommandManager.ToCommandId(EditCommands.Redo), CarbonCommandID.Redo },
                { CommandManager.ToCommandId(EditCommands.Undo), CarbonCommandID.Undo },
                { CommandManager.ToCommandId(EditCommands.SelectAll), CarbonCommandID.SelectAll },
                { CommandManager.ToCommandId(FileCommands.NewFile), CarbonCommandID.New },
                { CommandManager.ToCommandId(FileCommands.OpenFile), CarbonCommandID.Open },
                { CommandManager.ToCommandId(FileCommands.Save), CarbonCommandID.Save },
                { CommandManager.ToCommandId(FileCommands.SaveAs), CarbonCommandID.SaveAs },
                { CommandManager.ToCommandId(FileCommands.CloseFile), CarbonCommandID.Close },
                { CommandManager.ToCommandId(FileCommands.Exit), CarbonCommandID.Quit },
                { CommandManager.ToCommandId(FileCommands.ReloadFile), CarbonCommandID.Revert },
                { CommandManager.ToCommandId(HelpCommands.About), CarbonCommandID.About },
                { CommandManager.ToCommandId(HelpCommands.Help), CarbonCommandID.AppHelp },
            });

            //mac-ify these command names
            commandManager.GetCommand(EditCommands.MonodevelopPreferences).Text = GettextCatalog.GetString("Preferences...");
            commandManager.GetCommand(EditCommands.DefaultPolicies).Text        = GettextCatalog.GetString("Custom Policies...");
            commandManager.GetCommand(HelpCommands.About).Text        = string.Format(GettextCatalog.GetString("About {0}"), BrandingService.ApplicationName);
            commandManager.GetCommand(ToolCommands.AddinManager).Text = GettextCatalog.GetString("Add-in Manager...");

            initedApp = true;
            MacMainMenu.SetAppQuitCommand(CommandManager.ToCommandId(FileCommands.Exit));
            MacMainMenu.AddAppMenuItems(
                commandManager,
                CommandManager.ToCommandId(HelpCommands.About),
                CommandManager.ToCommandId(MonoDevelop.Ide.Updater.UpdateCommands.CheckForUpdates),
                CommandManager.ToCommandId(Command.Separator),
                CommandManager.ToCommandId(EditCommands.MonodevelopPreferences),
                CommandManager.ToCommandId(EditCommands.DefaultPolicies),
                CommandManager.ToCommandId(ToolCommands.AddinManager));

            IdeApp.Workbench.RootWindow.DeleteEvent += HandleDeleteEvent;
        }