Exemplo n.º 1
0
        public void CreateMainMenu(Gtk.Menu menu)
        {
            menu.Append(Undo.CreateAcceleratedMenuItem(Gdk.Key.Z, Gdk.ModifierType.ControlMask));

            ImageMenuItem redo = Redo.CreateAcceleratedMenuItem(Gdk.Key.Z, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);

            redo.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.Y, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append(redo);

            menu.AppendSeparator();
            menu.Append(Cut.CreateAcceleratedMenuItem(Gdk.Key.X, Gdk.ModifierType.ControlMask));
            menu.Append(Copy.CreateAcceleratedMenuItem(Gdk.Key.C, Gdk.ModifierType.ControlMask));
            menu.Append(CopyMerged.CreateAcceleratedMenuItem(Gdk.Key.C, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask));
            menu.Append(Paste.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.ControlMask));
            menu.Append(PasteIntoNewLayer.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask));
            menu.Append(PasteIntoNewImage.CreateAcceleratedMenuItem(Gdk.Key.V, Gdk.ModifierType.Mod1Mask | Gdk.ModifierType.ControlMask));

            menu.AppendSeparator();
            menu.Append(SelectAll.CreateAcceleratedMenuItem(Gdk.Key.A, Gdk.ModifierType.ControlMask));

            ImageMenuItem deslect = Deselect.CreateAcceleratedMenuItem(Gdk.Key.A, Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask);

            deslect.AddAccelerator("activate", PintaCore.Actions.AccelGroup, new AccelKey(Gdk.Key.D, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            menu.Append(deslect);

            menu.AppendSeparator();
            menu.Append(EraseSelection.CreateAcceleratedMenuItem(Gdk.Key.Delete, Gdk.ModifierType.None));
            menu.Append(FillSelection.CreateAcceleratedMenuItem(Gdk.Key.BackSpace, Gdk.ModifierType.None));
            menu.Append(InvertSelection.CreateAcceleratedMenuItem(Gdk.Key.I, Gdk.ModifierType.ControlMask));

            menu.AppendSeparator();
            Gtk.Action menu_action  = new Gtk.Action("Palette", Mono.Unix.Catalog.GetString("Palette"), null, null);
            Menu       palette_menu = (Menu)menu.AppendItem(menu_action.CreateSubMenuItem()).Submenu;

            palette_menu.Append(LoadPalette.CreateMenuItem());
            palette_menu.Append(SavePalette.CreateMenuItem());
            palette_menu.Append(ResetPalette.CreateMenuItem());
            palette_menu.Append(ResizePalette.CreateMenuItem());

            menu.AppendSeparator();
            menu.Append(AddinManager.CreateMenuItem());
        }
Exemplo n.º 2
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());
        }