Exemple #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());
        }
Exemple #2
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(SaveAll, "<Ctrl><Alt>A");
            menu.AppendItem(SaveAll.CreateMenuItem());

            app.AddAccelAction(CloseAll, "<Primary><Shift>W");
            menu.AppendItem(CloseAll.CreateMenuItem());

            doc_section = new GLib.Menu();
            menu.AppendSection(null, doc_section);

            app.AddAction(active_doc_action);
        }
Exemple #3
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(Contents, "F1");
            menu.AppendItem(Contents.CreateMenuItem());

            app.AddAction(Website);
            menu.AppendItem(Website.CreateMenuItem());

            app.AddAction(Bugs);
            menu.AppendItem(Bugs.CreateMenuItem());

            app.AddAction(Translate);
            menu.AppendItem(Translate.CreateMenuItem());

            // This is part of the application menu on macOS.
            if (PintaCore.System.OperatingSystem != OS.Mac)
            {
                var about_section = new GLib.Menu();
                menu.AppendSection(null, about_section);

                var about = PintaCore.Actions.App.About;
                app.AddAction(about);
                about_section.AppendItem(about.CreateMenuItem());
            }
        }
Exemple #4
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAction(About);
            menu.AppendItem(About.CreateMenuItem());

            app.AddAccelAction(Exit, "<Primary>Q");
            menu.AppendItem(Exit.CreateMenuItem());
        }
Exemple #5
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(AddNewLayer, "<Primary><Shift>N");
            menu.AppendItem(AddNewLayer.CreateMenuItem());

            app.AddAccelAction(DeleteLayer, "<Primary><Shift>Delete");
            menu.AppendItem(DeleteLayer.CreateMenuItem());

            app.AddAccelAction(DuplicateLayer, "<Primary><Shift>D");
            menu.AppendItem(DuplicateLayer.CreateMenuItem());

            app.AddAccelAction(MergeLayerDown, "<Primary>M");
            menu.AppendItem(MergeLayerDown.CreateMenuItem());

            app.AddAction(ImportFromFile);
            menu.AppendItem(ImportFromFile.CreateMenuItem());

            var flip_section = new GLib.Menu();

            menu.AppendSection(null, flip_section);

            app.AddAction(FlipHorizontal);
            flip_section.AppendItem(FlipHorizontal.CreateMenuItem());

            app.AddAction(FlipVertical);
            flip_section.AppendItem(FlipVertical.CreateMenuItem());

            app.AddAction(RotateZoom);
            flip_section.AppendItem(RotateZoom.CreateMenuItem());

            var prop_section = new GLib.Menu();

            menu.AppendSection(null, prop_section);

            app.AddAccelAction(Properties, "F4");
            prop_section.AppendItem(Properties.CreateMenuItem());

            app.AddAction(MoveLayerDown);
            app.AddAction(MoveLayerUp);
        }
Exemple #6
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(New, "<Primary>N");
            menu.AppendItem(New.CreateMenuItem());

            app.AddAction(NewScreenshot);
            menu.AppendItem(NewScreenshot.CreateMenuItem());

            app.AddAccelAction(Open, "<Primary>O");
            menu.AppendItem(Open.CreateMenuItem());

            var save_section = new GLib.Menu();

            menu.AppendSection(null, save_section);

            app.AddAccelAction(Save, "<Primary>S");
            save_section.AppendItem(Save.CreateMenuItem());

            app.AddAccelAction(SaveAs, "<Primary><Shift>S");
            save_section.AppendItem(SaveAs.CreateMenuItem());

            var close_section = new GLib.Menu();

            menu.AppendSection(null, close_section);

            app.AddAccelAction(Close, "<Primary>W");
            close_section.AppendItem(Close.CreateMenuItem());

            // This is part of the application menu on macOS.
            if (PintaCore.System.OperatingSystem != OS.Mac)
            {
                var exit = PintaCore.Actions.App.Exit;
                app.AddAccelAction(exit, "<Primary>Q");
                close_section.AppendItem(exit.CreateMenuItem());
            }

            // Printing is disabled for now until it is fully functional.
#if false
            menu.Append(Print.CreateAcceleratedMenuItem(Gdk.Key.P, Gdk.ModifierType.ControlMask));
            menu.AppendSeparator();
#endif
        }
Exemple #7
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(Undo, "<Primary>Z");
            menu.AppendItem(Undo.CreateMenuItem());

            app.AddAccelAction(Redo, new[] { "<Primary><Shift>Z", "<Ctrl>Y" });
            menu.AppendItem(Redo.CreateMenuItem());

            var paste_section = new GLib.Menu();

            menu.AppendSection(null, paste_section);

            app.AddAccelAction(Cut, "<Primary>X");
            paste_section.AppendItem(Cut.CreateMenuItem());

            app.AddAccelAction(Copy, "<Primary>C");
            paste_section.AppendItem(Copy.CreateMenuItem());

            app.AddAccelAction(CopyMerged, "<Primary><Shift>C");
            paste_section.AppendItem(CopyMerged.CreateMenuItem());

            app.AddAccelAction(Paste, "<Primary>V");
            paste_section.AppendItem(Paste.CreateMenuItem());

            app.AddAccelAction(PasteIntoNewLayer, "<Primary><Shift>V");
            paste_section.AppendItem(PasteIntoNewLayer.CreateMenuItem());

            app.AddAccelAction(PasteIntoNewImage, "<Primary><Alt>V");
            paste_section.AppendItem(PasteIntoNewImage.CreateMenuItem());

            var sel_section = new GLib.Menu();

            menu.AppendSection(null, sel_section);

            app.AddAccelAction(SelectAll, "<Primary>A");
            sel_section.AppendItem(SelectAll.CreateMenuItem());

            app.AddAccelAction(Deselect, new[] { "<Primary><Shift>A", "<Ctrl>D" });
            sel_section.AppendItem(Deselect.CreateMenuItem());

            var edit_sel_section = new GLib.Menu();

            menu.AppendSection(null, edit_sel_section);

            app.AddAccelAction(EraseSelection, "Delete");
            edit_sel_section.AppendItem(EraseSelection.CreateMenuItem());

            app.AddAccelAction(FillSelection, "BackSpace");
            edit_sel_section.AppendItem(FillSelection.CreateMenuItem());

            app.AddAccelAction(InvertSelection, "<Primary>I");
            edit_sel_section.AppendItem(InvertSelection.CreateMenuItem());

            var palette_section = new GLib.Menu();

            menu.AppendSection(null, palette_section);

            var palette_menu = new GLib.Menu();

            menu.AppendSubmenu(Translations.GetString("Palette"), palette_menu);

            app.AddAction(LoadPalette);
            palette_menu.AppendItem(LoadPalette.CreateMenuItem());

            app.AddAction(SavePalette);
            palette_menu.AppendItem(SavePalette.CreateMenuItem());

            app.AddAction(ResetPalette);
            palette_menu.AppendItem(ResetPalette.CreateMenuItem());

            app.AddAction(ResizePalette);
            palette_menu.AppendItem(ResizePalette.CreateMenuItem());
        }