1 /* GIMP - The GNU Image Manipulation Program
2  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16  */
17 
18 #include "config.h"
19 
20 #include <gegl.h>
21 #include <gtk/gtk.h>
22 
23 #include "libgimpwidgets/gimpwidgets.h"
24 
25 #include "actions-types.h"
26 
27 #include "core/gimp.h"
28 
29 #include "widgets/gimpactiongroup.h"
30 
31 #include "debug-actions.h"
32 #include "debug-commands.h"
33 
34 
35 static const GimpActionEntry debug_actions[] =
36 {
37   { "debug-menu", NULL, "_Debug" },
38 
39   { "debug-mem-profile", NULL,
40     "_Memory Profile", NULL, NULL,
41     debug_mem_profile_cmd_callback,
42     NULL },
43 
44   { "debug-benchmark-projection", NULL,
45     "Benchmark _Projection", NULL,
46     "Invalidates the entire projection, measures the time it takes to "
47     "validate (render) the part that is visible in the active display, "
48     "and print the result to stdout.",
49     debug_benchmark_projection_cmd_callback,
50     NULL },
51 
52   { "debug-show-image-graph", NULL,
53     "Show Image _Graph", NULL,
54     "Creates a new image showing the GEGL graph of this image",
55     debug_show_image_graph_cmd_callback,
56     NULL },
57 
58   { "debug-dump-items", NULL,
59     "_Dump Items", NULL, NULL,
60     debug_dump_menus_cmd_callback,
61     NULL },
62 
63   { "debug-dump-managers", NULL,
64     "Dump _UI Managers", NULL, NULL,
65     debug_dump_managers_cmd_callback,
66     NULL },
67 
68   { "debug-dump-keyboard-shortcuts", NULL,
69     "Dump _Keyboard Shortcuts", NULL, NULL,
70     debug_dump_keyboard_shortcuts_cmd_callback,
71     NULL },
72 
73   { "debug-dump-attached-data", NULL,
74     "Dump Attached Data", NULL, NULL,
75     debug_dump_attached_data_cmd_callback,
76     NULL }
77 };
78 
79 void
debug_actions_setup(GimpActionGroup * group)80 debug_actions_setup (GimpActionGroup *group)
81 {
82   gint i;
83 
84   gimp_action_group_add_actions (group, NULL,
85                                  debug_actions,
86                                  G_N_ELEMENTS (debug_actions));
87 
88 #define SET_VISIBLE(action,condition) \
89         gimp_action_group_set_action_visible (group, action, (condition) != 0)
90 
91   for (i = 0; i < G_N_ELEMENTS (debug_actions); i++)
92     SET_VISIBLE (debug_actions[i].name, group->gimp->show_debug_menu);
93 
94 #undef SET_VISIBLE
95 }
96 
97 void
debug_actions_update(GimpActionGroup * group,gpointer data)98 debug_actions_update (GimpActionGroup *group,
99                       gpointer         data)
100 {
101 #define SET_SENSITIVE(action,condition) \
102         gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
103 
104   SET_SENSITIVE ("debug-show-image-graph", gegl_has_operation ("gegl:introspect"));
105 
106 #undef SET_SENSITIVE
107 }
108