-
Notifications
You must be signed in to change notification settings - Fork 10
/
pp_menu_edit.cpp
73 lines (57 loc) · 2.15 KB
/
pp_menu_edit.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <gtk/gtkstock.h>
#include <gtk/gtkmain.h>
#include "config.h"
#include "pp_menu_edit.h"
#include "pp_mainwindow.h"
#include "dialogs.h"
#include "miscwidgets/generaldialogs.h"
#include "progressbar.h"
#include "gettext.h"
#define _(x) gettext(x)
#define N_(x) gettext_noop(x)
using namespace std;
static void edit_selectall(GtkAction *action,gpointer *ob)
{
pp_MainWindow *mw=(pp_MainWindow *)ob;
mw->state->layout->SelectAll();
pp_mainwindow_refresh(mw);
}
static void edit_selectnone(GtkAction *action,gpointer *ob)
{
pp_MainWindow *mw=(pp_MainWindow *)ob;
mw->state->layout->SelectNone();
pp_mainwindow_refresh(mw);
}
static GtkActionEntry editmenu_entries[] = {
{ "EditMenu", NULL, N_("_Edit") },
{ "SelectAll", NULL, N_("Select _All"), "<control>A", N_("Select all images"), G_CALLBACK(edit_selectall) },
{ "SelectNone", NULL, N_("Select _None"), NULL, N_("Deselect all images"), G_CALLBACK(edit_selectnone) },
{ "Cut", GTK_STOCK_CUT, N_("_Cut"), "<control>X", N_("Cut the current image to the clipboard"), NULL },
{ "Copy", GTK_STOCK_COPY, N_("C_opy"), "<control>C", N_("Copy the current image to the clipboard"), NULL },
{ "Paste", GTK_STOCK_PASTE, N_("_Paste"), "<control>V", N_("Paste the contents of the clipboard as a new image"), NULL },
};
static const char *editmenu_ui_description =
"<ui>"
" <menubar name='MainMenu'>"
" <menu action='EditMenu'>"
" <menuitem action='SelectAll'/>"
" <menuitem action='SelectNone'/>"
" <separator/>"
" <menuitem action='Cut'/>"
" <menuitem action='Copy'/>"
" <menuitem action='Paste'/>"
" </menu>"
" </menubar>"
"</ui>";
void BuildEditMenu(void *userdata,GtkUIManager *ui_manager)
{
GError *error=NULL;
GtkActionGroup *action_group;
action_group = gtk_action_group_new ("EditMenuActions");
gtk_action_group_set_translation_domain(action_group,PACKAGE);
gtk_action_group_add_actions (action_group, editmenu_entries, G_N_ELEMENTS (editmenu_entries), userdata);
gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
if (!gtk_ui_manager_add_ui_from_string (ui_manager, editmenu_ui_description, -1, &error))
throw error->message;
}