예제 #1
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            var zoom_section = new GLib.Menu();

            menu.AppendSection(null, zoom_section);

            app.AddAccelAction(ZoomIn, new[] { "<Primary>plus", "<Primary>equal", "equal", "<Primary>KP_Add", "KP_Add" });
            zoom_section.AppendItem(ZoomIn.CreateMenuItem());

            app.AddAccelAction(ZoomOut, new[] { "<Primary>minus", "<Primary>underscore", "minus", "<Primary>KP_Subtract", "KP_Subtract" });
            zoom_section.AppendItem(ZoomOut.CreateMenuItem());

            app.AddAccelAction(ActualSize, new[] { "<Primary>0", "<Primary><Shift>A" });
            zoom_section.AppendItem(ActualSize.CreateMenuItem());

            app.AddAccelAction(ZoomToWindow, "<Primary>B");
            zoom_section.AppendItem(ZoomToWindow.CreateMenuItem());

            app.AddAccelAction(Fullscreen, "F11");
            zoom_section.AppendItem(Fullscreen.CreateMenuItem());

            var metric_section = new GLib.Menu();

            menu.AppendSection(null, metric_section);

            var metric_menu = new GLib.Menu();

            metric_section.AppendSubmenu(Translations.GetString("Ruler Units"), metric_menu);

            app.AddAction(RulerMetric);
            metric_menu.Append(Translations.GetString("Pixels"), $"app.{RulerMetric.Name}(0)");
            metric_menu.Append(Translations.GetString("Inches"), $"app.{RulerMetric.Name}(1)");
            metric_menu.Append(Translations.GetString("Centimeters"), $"app.{RulerMetric.Name}(2)");

            var show_hide_section = new GLib.Menu();

            menu.AppendSection(null, show_hide_section);

            var show_hide_menu = new GLib.Menu();

            show_hide_section.AppendSubmenu(Translations.GetString("Show/Hide"), show_hide_menu);

            app.AddAction(PixelGrid);
            show_hide_menu.AppendItem(PixelGrid.CreateMenuItem());

            app.AddAction(Rulers);
            show_hide_menu.AppendItem(Rulers.CreateMenuItem());

            app.AddAction(ToolBar);
            show_hide_menu.AppendItem(ToolBar.CreateMenuItem());

            app.AddAction(StatusBar);
            show_hide_menu.AppendItem(StatusBar.CreateMenuItem());

            app.AddAction(ToolBox);
            show_hide_menu.AppendItem(ToolBox.CreateMenuItem());

            app.AddAction(ImageTabs);
            show_hide_menu.AppendItem(ImageTabs.CreateMenuItem());
        }