2006-12-09 21:33:38 +00:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2002-03-08 00:27:45 +00:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* gimpeditor.c
|
2004-05-12 18:36:33 +00:00
|
|
|
* Copyright (C) 2001-2004 Michael Natterer <mitch@gimp.org>
|
2002-03-08 00:27:45 +00:00
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2002-03-08 00:27:45 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2002-03-08 00:27:45 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2002-03-08 00:27:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-11-01 22:28:18 +01:00
|
|
|
#include <gegl.h>
|
2002-03-08 00:27:45 +00:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2019-07-31 10:16:21 +02:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2002-03-08 00:27:45 +00:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
|
|
|
|
|
|
|
#include "widgets-types.h"
|
|
|
|
|
2017-03-11 01:40:15 +01:00
|
|
|
#include "config/gimpguiconfig.h"
|
|
|
|
|
|
|
|
#include "core/gimp.h"
|
|
|
|
|
2019-07-02 03:54:38 +02:00
|
|
|
#include "gimpaction.h"
|
|
|
|
#include "gimpactiongroup.h"
|
2003-10-10 21:24:12 +00:00
|
|
|
#include "gimpdocked.h"
|
2002-03-08 00:27:45 +00:00
|
|
|
#include "gimpeditor.h"
|
|
|
|
#include "gimpdnd.h"
|
2003-03-21 11:47:37 +00:00
|
|
|
#include "gimpmenufactory.h"
|
2019-07-02 03:54:38 +02:00
|
|
|
#include "gimptoggleaction.h"
|
2004-05-11 16:05:21 +00:00
|
|
|
#include "gimpuimanager.h"
|
2004-10-16 15:48:23 +00:00
|
|
|
#include "gimpwidgets-utils.h"
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2005-05-27 11:40:06 +00:00
|
|
|
#include "gimp-intl.h"
|
|
|
|
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2002-03-18 19:34:06 +00:00
|
|
|
#define DEFAULT_CONTENT_SPACING 2
|
|
|
|
#define DEFAULT_BUTTON_SPACING 2
|
2002-10-15 20:52:46 +00:00
|
|
|
#define DEFAULT_BUTTON_ICON_SIZE GTK_ICON_SIZE_MENU
|
2008-02-10 20:50:21 +00:00
|
|
|
#define DEFAULT_BUTTON_RELIEF GTK_RELIEF_NONE
|
2002-03-18 19:34:06 +00:00
|
|
|
|
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_MENU_FACTORY,
|
|
|
|
PROP_MENU_IDENTIFIER,
|
|
|
|
PROP_UI_PATH,
|
2005-05-27 11:40:06 +00:00
|
|
|
PROP_POPUP_DATA,
|
|
|
|
PROP_SHOW_NAME,
|
2005-06-04 22:32:31 +00:00
|
|
|
PROP_NAME
|
2004-05-12 18:36:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
struct _GimpEditorPrivate
|
|
|
|
{
|
|
|
|
GimpMenuFactory *menu_factory;
|
|
|
|
gchar *menu_identifier;
|
|
|
|
GimpUIManager *ui_manager;
|
|
|
|
gchar *ui_path;
|
|
|
|
gpointer popup_data;
|
|
|
|
|
|
|
|
gboolean show_button_bar;
|
|
|
|
GtkWidget *name_label;
|
|
|
|
GtkWidget *button_box;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-14 09:38:11 +01:00
|
|
|
static void gimp_editor_docked_iface_init (GimpDockedInterface *iface);
|
|
|
|
|
|
|
|
static void gimp_editor_constructed (GObject *object);
|
|
|
|
static void gimp_editor_dispose (GObject *object);
|
|
|
|
static void gimp_editor_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_editor_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
2018-06-10 16:41:36 +02:00
|
|
|
static void gimp_editor_style_updated (GtkWidget *widget);
|
|
|
|
|
2011-01-14 09:38:11 +01:00
|
|
|
static GimpUIManager * gimp_editor_get_menu (GimpDocked *docked,
|
|
|
|
const gchar **ui_path,
|
|
|
|
gpointer *popup_data);
|
|
|
|
static gboolean gimp_editor_has_button_bar (GimpDocked *docked);
|
|
|
|
static void gimp_editor_set_show_button_bar (GimpDocked *docked,
|
|
|
|
gboolean show);
|
|
|
|
static gboolean gimp_editor_get_show_button_bar (GimpDocked *docked);
|
|
|
|
|
|
|
|
static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor,
|
|
|
|
GtkReliefStyle *button_relief);
|
2002-03-08 00:27:45 +00:00
|
|
|
|
|
|
|
|
2010-10-30 15:44:46 +02:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpEditor, gimp_editor, GTK_TYPE_BOX,
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 12:09:39 -04:00
|
|
|
G_ADD_PRIVATE (GimpEditor)
|
2005-12-19 22:37:49 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCKED,
|
2006-05-15 09:46:31 +00:00
|
|
|
gimp_editor_docked_iface_init))
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2005-12-19 22:37:49 +00:00
|
|
|
#define parent_class gimp_editor_parent_class
|
2002-03-08 00:27:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_editor_class_init (GimpEditorClass *klass)
|
|
|
|
{
|
2010-10-15 14:08:36 +02:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2011-01-09 20:38:01 +01:00
|
|
|
object_class->constructed = gimp_editor_constructed;
|
|
|
|
object_class->dispose = gimp_editor_dispose;
|
|
|
|
object_class->set_property = gimp_editor_set_property;
|
|
|
|
object_class->get_property = gimp_editor_get_property;
|
2004-05-12 18:36:33 +00:00
|
|
|
|
2018-06-10 16:41:36 +02:00
|
|
|
widget_class->style_updated = gimp_editor_style_updated;
|
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_MENU_FACTORY,
|
|
|
|
g_param_spec_object ("menu-factory",
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_MENU_FACTORY,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE |
|
2004-05-12 18:36:33 +00:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_MENU_IDENTIFIER,
|
|
|
|
g_param_spec_string ("menu-identifier",
|
|
|
|
NULL, NULL,
|
|
|
|
NULL,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE |
|
2004-05-12 18:36:33 +00:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_UI_PATH,
|
|
|
|
g_param_spec_string ("ui-path",
|
|
|
|
NULL, NULL,
|
|
|
|
NULL,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE |
|
2004-05-12 18:36:33 +00:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_POPUP_DATA,
|
|
|
|
g_param_spec_pointer ("popup-data",
|
|
|
|
NULL, NULL,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE |
|
2004-05-12 18:36:33 +00:00
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2005-05-27 11:40:06 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_SHOW_NAME,
|
|
|
|
g_param_spec_boolean ("show-name",
|
|
|
|
NULL, NULL,
|
|
|
|
FALSE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READWRITE));
|
2005-05-27 11:40:06 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_NAME,
|
|
|
|
g_param_spec_string ("name",
|
|
|
|
NULL, NULL,
|
|
|
|
NULL,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_WRITABLE |
|
2005-05-27 11:40:06 +00:00
|
|
|
G_PARAM_CONSTRUCT));
|
|
|
|
|
2002-03-08 00:27:45 +00:00
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-08-03 09:34:55 +00:00
|
|
|
g_param_spec_int ("content-spacing",
|
2002-03-08 00:27:45 +00:00
|
|
|
NULL, NULL,
|
|
|
|
0,
|
|
|
|
G_MAXINT,
|
2002-03-18 19:34:06 +00:00
|
|
|
DEFAULT_CONTENT_SPACING,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READABLE));
|
2002-03-08 00:27:45 +00:00
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-08-03 09:34:55 +00:00
|
|
|
g_param_spec_int ("button-spacing",
|
2002-03-08 00:27:45 +00:00
|
|
|
NULL, NULL,
|
|
|
|
0,
|
|
|
|
G_MAXINT,
|
2002-03-18 19:34:06 +00:00
|
|
|
DEFAULT_BUTTON_SPACING,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READABLE));
|
2002-03-18 19:34:06 +00:00
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
2005-08-03 09:34:55 +00:00
|
|
|
g_param_spec_enum ("button-icon-size",
|
2002-03-18 19:34:06 +00:00
|
|
|
NULL, NULL,
|
|
|
|
GTK_TYPE_ICON_SIZE,
|
|
|
|
DEFAULT_BUTTON_ICON_SIZE,
|
2006-01-18 20:29:40 +00:00
|
|
|
GIMP_PARAM_READABLE));
|
2008-02-10 20:50:21 +00:00
|
|
|
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
|
|
g_param_spec_enum ("button-relief",
|
|
|
|
NULL, NULL,
|
|
|
|
GTK_TYPE_RELIEF_STYLE,
|
|
|
|
DEFAULT_BUTTON_RELIEF,
|
|
|
|
GIMP_PARAM_READABLE));
|
2002-03-08 00:27:45 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 09:38:11 +01:00
|
|
|
static void
|
|
|
|
gimp_editor_docked_iface_init (GimpDockedInterface *iface)
|
|
|
|
{
|
|
|
|
iface->get_menu = gimp_editor_get_menu;
|
|
|
|
iface->has_button_bar = gimp_editor_has_button_bar;
|
|
|
|
iface->set_show_button_bar = gimp_editor_set_show_button_bar;
|
|
|
|
iface->get_show_button_bar = gimp_editor_get_show_button_bar;
|
|
|
|
}
|
|
|
|
|
2002-03-08 00:27:45 +00:00
|
|
|
static void
|
|
|
|
gimp_editor_init (GimpEditor *editor)
|
|
|
|
{
|
2010-10-30 15:44:46 +02:00
|
|
|
gtk_orientable_set_orientation (GTK_ORIENTABLE (editor),
|
|
|
|
GTK_ORIENTATION_VERTICAL);
|
|
|
|
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 12:09:39 -04:00
|
|
|
editor->priv = gimp_editor_get_instance_private (editor);
|
2018-06-10 16:41:36 +02:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->popup_data = editor;
|
|
|
|
editor->priv->show_button_bar = TRUE;
|
2005-05-27 11:40:06 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->name_label = g_object_new (GTK_TYPE_LABEL,
|
2018-06-10 16:41:36 +02:00
|
|
|
"xalign", 0.0,
|
|
|
|
"yalign", 0.5,
|
|
|
|
"ellipsize", PANGO_ELLIPSIZE_END,
|
|
|
|
NULL);
|
2011-04-09 19:51:51 +02:00
|
|
|
gimp_label_set_attributes (GTK_LABEL (editor->priv->name_label),
|
2005-05-27 11:40:06 +00:00
|
|
|
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
|
|
|
-1);
|
2011-04-09 19:51:51 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (editor), editor->priv->name_label,
|
|
|
|
FALSE, FALSE, 0);
|
2003-03-21 11:47:37 +00:00
|
|
|
}
|
|
|
|
|
2003-10-10 21:24:12 +00:00
|
|
|
static void
|
2011-01-14 09:38:11 +01:00
|
|
|
gimp_editor_constructed (GObject *object)
|
2003-10-10 21:24:12 +00:00
|
|
|
{
|
2011-01-14 09:38:11 +01:00
|
|
|
GimpEditor *editor = GIMP_EDITOR (object);
|
2004-05-12 18:36:33 +00:00
|
|
|
|
2012-11-12 21:51:22 +01:00
|
|
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
2004-05-12 18:36:33 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (! editor->priv->popup_data)
|
|
|
|
editor->priv->popup_data = editor;
|
2004-05-12 18:36:33 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (editor->priv->menu_factory && editor->priv->menu_identifier)
|
2004-05-12 18:36:33 +00:00
|
|
|
{
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->ui_manager =
|
2023-03-07 18:23:38 +01:00
|
|
|
gimp_menu_factory_get_manager (editor->priv->menu_factory,
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->menu_identifier,
|
2018-05-14 00:34:16 +02:00
|
|
|
editor->priv->popup_data);
|
Issue #7023: icon size selection on GIMP 2.99.
This kinda reverts commit 6aebd30de142286c41e6cd90abedc4082a13fcea ("app: remove
icon sizing preferences"), except that the code base is different enough since
this old commit was mainly for GIMP 2.10.x.
In any case, after initially thinking that GTK+3 handling for high density
display would be enough, we finally decide that adding back a Preferences-wide
setting for overriding the theme-set icon size is a good idea (additionally to
GTK+3 automatic support).
The base idea for removing the feature was that GTK+3 has high density display
support, through the "scale factor". Typically a high density display will
normally be set as using a ×2 scale factor so all icons will be double size.
Unfortunately it turns out it's not enough.
For instance, on very small screen estate, even with a scale factor of 1, if the
theme sets 24px toolbox icons, it may still take too much space.
Oppositely on huge screens, even with ×2 factor scale detected by the OS, the
icons may still feel too small (this is possibly what happens with #7023).
Furthermore there is also a matter of taste. Some people like small icons even
when they have the space. Others may want bigger icons, easy to click on.
Finally you can like a theme for its color scheme for instance, but it may not
have the icon size you want. Right now, we'd need to duplicate every theme in
small or bigger size. Instead of doing so, let's just have this global setting
overriding the theme rules.
Comparison with the 2.10 implementation:
- We still provide 4 sizes: small, medium, large and huge.
- We don't have the "Guess ideal size" setting anymore. Instead this is now a
mix of the GTK+3 scale factor logic and the theme-set or custom size. I.e.
that on a high density display with ×2 scale factor, we could have toolbox
icons up to 96 pixels (48×2)!
- We now try to have less custom code in widgets as we append the CSS rules to
the theme (similar to what we were already doing for dark theme or icon
variants). What happens in widget code is mostly to connect to changes in
themes and redraw the widgets which need to be.
- The custom size will now affect: toolbox icons, the FG/BG editor widget (in
both the toolbox and the color dockable), dockable tab icons, the main
dockable buttons, eye and lock header icons in item tree views, eye and lock
cell icons in the item lists.
There are still a bunch of areas where it is not taken into account, such as
plug-ins, and various dialogs, but even in custom-made interface in dockables.
Ultimately it might be interesting to have a way to sync more buttons and
widgets to a global size settings.
Lastly, I fixed a bunch of existing bugs where we were updating icon sizes with
gtk_image_set_from_icon_name() using the const icon name taken from
gtk_image_get_icon_name(). As this was reusing the same string pointer, we were
ending with freeing the icon name.
2022-09-26 22:56:08 +02:00
|
|
|
|
|
|
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
|
|
|
"notify::theme",
|
|
|
|
G_CALLBACK (gimp_editor_style_updated),
|
|
|
|
editor, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
|
|
|
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
|
|
|
"notify::override-theme-icon-size",
|
|
|
|
G_CALLBACK (gimp_editor_style_updated),
|
|
|
|
editor, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
|
|
|
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
|
|
|
"notify::custom-icon-size",
|
|
|
|
G_CALLBACK (gimp_editor_style_updated),
|
|
|
|
editor, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
|
2004-05-12 18:36:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-15 14:08:36 +02:00
|
|
|
static void
|
|
|
|
gimp_editor_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GimpEditor *editor = GIMP_EDITOR (object);
|
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_object (&editor->priv->menu_factory);
|
2010-10-15 14:08:36 +02:00
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_pointer (&editor->priv->menu_identifier, g_free);
|
2010-10-15 14:08:36 +02:00
|
|
|
|
2017-07-15 18:38:01 +02:00
|
|
|
g_clear_pointer (&editor->priv->ui_path, g_free);
|
2010-10-15 14:08:36 +02:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
static void
|
|
|
|
gimp_editor_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpEditor *editor = GIMP_EDITOR (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_MENU_FACTORY:
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->menu_factory = g_value_dup_object (value);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
case PROP_MENU_IDENTIFIER:
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->menu_identifier = g_value_dup_string (value);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
case PROP_UI_PATH:
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->ui_path = g_value_dup_string (value);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
case PROP_POPUP_DATA:
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->popup_data = g_value_get_pointer (value);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2005-05-27 11:40:06 +00:00
|
|
|
case PROP_SHOW_NAME:
|
2011-04-09 19:51:51 +02:00
|
|
|
g_object_set_property (G_OBJECT (editor->priv->name_label),
|
|
|
|
"visible", value);
|
2005-05-27 11:40:06 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2005-05-27 11:40:06 +00:00
|
|
|
case PROP_NAME:
|
|
|
|
gimp_editor_set_name (editor, g_value_get_string (value));
|
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_editor_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GimpEditor *editor = GIMP_EDITOR (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_MENU_FACTORY:
|
2011-04-09 19:51:51 +02:00
|
|
|
g_value_set_object (value, editor->priv->menu_factory);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
case PROP_MENU_IDENTIFIER:
|
2011-04-09 19:51:51 +02:00
|
|
|
g_value_set_string (value, editor->priv->menu_identifier);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
case PROP_UI_PATH:
|
2011-04-09 19:51:51 +02:00
|
|
|
g_value_set_string (value, editor->priv->ui_path);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
case PROP_POPUP_DATA:
|
2011-04-09 19:51:51 +02:00
|
|
|
g_value_set_pointer (value, editor->priv->popup_data);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2005-05-27 11:40:06 +00:00
|
|
|
case PROP_SHOW_NAME:
|
2011-04-09 19:51:51 +02:00
|
|
|
g_object_get_property (G_OBJECT (editor->priv->name_label),
|
|
|
|
"visible", value);
|
2005-05-27 11:40:06 +00:00
|
|
|
break;
|
2008-07-23 07:47:10 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-10 16:41:36 +02:00
|
|
|
static void
|
|
|
|
gimp_editor_style_updated (GtkWidget *widget)
|
|
|
|
{
|
|
|
|
GimpEditor *editor = GIMP_EDITOR (widget);
|
|
|
|
gint content_spacing;
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
|
|
|
|
|
|
|
|
gtk_widget_style_get (widget,
|
|
|
|
"content-spacing", &content_spacing,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_box_set_spacing (GTK_BOX (widget), content_spacing);
|
|
|
|
|
|
|
|
if (editor->priv->button_box)
|
|
|
|
gimp_editor_set_box_style (editor, GTK_BOX (editor->priv->button_box));
|
|
|
|
}
|
|
|
|
|
2005-06-04 22:32:31 +00:00
|
|
|
static GimpUIManager *
|
|
|
|
gimp_editor_get_menu (GimpDocked *docked,
|
|
|
|
const gchar **ui_path,
|
|
|
|
gpointer *popup_data)
|
2005-06-04 21:00:48 +00:00
|
|
|
{
|
2005-06-04 22:32:31 +00:00
|
|
|
GimpEditor *editor = GIMP_EDITOR (docked);
|
2005-06-04 21:00:48 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
*ui_path = editor->priv->ui_path;
|
|
|
|
*popup_data = editor->priv->popup_data;
|
2005-06-04 21:00:48 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
return editor->priv->ui_manager;
|
2005-06-04 22:32:31 +00:00
|
|
|
}
|
2005-06-04 21:00:48 +00:00
|
|
|
|
|
|
|
|
2005-06-04 22:32:31 +00:00
|
|
|
static gboolean
|
|
|
|
gimp_editor_has_button_bar (GimpDocked *docked)
|
|
|
|
{
|
|
|
|
GimpEditor *editor = GIMP_EDITOR (docked);
|
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
return editor->priv->button_box != NULL;
|
2005-06-04 21:00:48 +00:00
|
|
|
}
|
|
|
|
|
2005-06-04 22:32:31 +00:00
|
|
|
static void
|
|
|
|
gimp_editor_set_show_button_bar (GimpDocked *docked,
|
|
|
|
gboolean show)
|
2005-06-04 21:00:48 +00:00
|
|
|
{
|
2005-06-04 22:32:31 +00:00
|
|
|
GimpEditor *editor = GIMP_EDITOR (docked);
|
2005-06-04 21:00:48 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (show != editor->priv->show_button_bar)
|
2005-06-04 21:00:48 +00:00
|
|
|
{
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->show_button_bar = show;
|
2005-06-04 21:00:48 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (editor->priv->button_box)
|
|
|
|
gtk_widget_set_visible (editor->priv->button_box, show);
|
2005-06-04 22:32:31 +00:00
|
|
|
}
|
2005-06-04 21:00:48 +00:00
|
|
|
}
|
|
|
|
|
2005-06-04 22:32:31 +00:00
|
|
|
static gboolean
|
|
|
|
gimp_editor_get_show_button_bar (GimpDocked *docked)
|
2003-10-10 21:24:12 +00:00
|
|
|
{
|
|
|
|
GimpEditor *editor = GIMP_EDITOR (docked);
|
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
return editor->priv->show_button_bar;
|
2003-10-10 21:24:12 +00:00
|
|
|
}
|
|
|
|
|
2002-03-15 15:09:58 +00:00
|
|
|
GtkWidget *
|
|
|
|
gimp_editor_new (void)
|
|
|
|
{
|
2005-06-04 22:32:31 +00:00
|
|
|
return g_object_new (GIMP_TYPE_EDITOR, NULL);
|
2002-03-15 15:09:58 +00:00
|
|
|
}
|
|
|
|
|
2003-03-21 11:47:37 +00:00
|
|
|
void
|
|
|
|
gimp_editor_create_menu (GimpEditor *editor,
|
|
|
|
GimpMenuFactory *menu_factory,
|
|
|
|
const gchar *menu_identifier,
|
2004-04-29 12:52:29 +00:00
|
|
|
const gchar *ui_path,
|
2004-05-12 18:36:33 +00:00
|
|
|
gpointer popup_data)
|
2003-03-21 11:47:37 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_EDITOR (editor));
|
|
|
|
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
|
|
|
|
g_return_if_fail (menu_identifier != NULL);
|
2004-04-29 12:52:29 +00:00
|
|
|
g_return_if_fail (ui_path != NULL);
|
2003-03-21 11:47:37 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (editor->priv->menu_factory)
|
|
|
|
g_object_unref (editor->priv->menu_factory);
|
2004-05-12 18:36:33 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->menu_factory = g_object_ref (menu_factory);
|
2004-04-29 12:52:29 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (editor->priv->ui_manager)
|
2023-03-07 18:23:38 +01:00
|
|
|
g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
|
|
|
|
G_CALLBACK (gimp_editor_style_updated),
|
|
|
|
editor);
|
2004-04-21 16:33:17 +00:00
|
|
|
|
2023-03-07 18:23:38 +01:00
|
|
|
editor->priv->ui_manager = gimp_menu_factory_get_manager (menu_factory,
|
2011-04-09 19:51:51 +02:00
|
|
|
menu_identifier,
|
2018-05-14 00:34:16 +02:00
|
|
|
popup_data);
|
Issue #7023: icon size selection on GIMP 2.99.
This kinda reverts commit 6aebd30de142286c41e6cd90abedc4082a13fcea ("app: remove
icon sizing preferences"), except that the code base is different enough since
this old commit was mainly for GIMP 2.10.x.
In any case, after initially thinking that GTK+3 handling for high density
display would be enough, we finally decide that adding back a Preferences-wide
setting for overriding the theme-set icon size is a good idea (additionally to
GTK+3 automatic support).
The base idea for removing the feature was that GTK+3 has high density display
support, through the "scale factor". Typically a high density display will
normally be set as using a ×2 scale factor so all icons will be double size.
Unfortunately it turns out it's not enough.
For instance, on very small screen estate, even with a scale factor of 1, if the
theme sets 24px toolbox icons, it may still take too much space.
Oppositely on huge screens, even with ×2 factor scale detected by the OS, the
icons may still feel too small (this is possibly what happens with #7023).
Furthermore there is also a matter of taste. Some people like small icons even
when they have the space. Others may want bigger icons, easy to click on.
Finally you can like a theme for its color scheme for instance, but it may not
have the icon size you want. Right now, we'd need to duplicate every theme in
small or bigger size. Instead of doing so, let's just have this global setting
overriding the theme rules.
Comparison with the 2.10 implementation:
- We still provide 4 sizes: small, medium, large and huge.
- We don't have the "Guess ideal size" setting anymore. Instead this is now a
mix of the GTK+3 scale factor logic and the theme-set or custom size. I.e.
that on a high density display with ×2 scale factor, we could have toolbox
icons up to 96 pixels (48×2)!
- We now try to have less custom code in widgets as we append the CSS rules to
the theme (similar to what we were already doing for dark theme or icon
variants). What happens in widget code is mostly to connect to changes in
themes and redraw the widgets which need to be.
- The custom size will now affect: toolbox icons, the FG/BG editor widget (in
both the toolbox and the color dockable), dockable tab icons, the main
dockable buttons, eye and lock header icons in item tree views, eye and lock
cell icons in the item lists.
There are still a bunch of areas where it is not taken into account, such as
plug-ins, and various dialogs, but even in custom-made interface in dockables.
Ultimately it might be interesting to have a way to sync more buttons and
widgets to a global size settings.
Lastly, I fixed a bunch of existing bugs where we were updating icon sizes with
gtk_image_set_from_icon_name() using the const icon name taken from
gtk_image_get_icon_name(). As this was reusing the same string pointer, we were
ending with freeing the icon name.
2022-09-26 22:56:08 +02:00
|
|
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
|
|
|
"notify::theme",
|
|
|
|
G_CALLBACK (gimp_editor_style_updated),
|
|
|
|
editor, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
|
|
|
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
|
|
|
"notify::override-theme-icon-size",
|
|
|
|
G_CALLBACK (gimp_editor_style_updated),
|
|
|
|
editor, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
|
|
|
|
g_signal_connect_object (editor->priv->ui_manager->gimp->config,
|
|
|
|
"notify::custom-icon-size",
|
|
|
|
G_CALLBACK (gimp_editor_style_updated),
|
|
|
|
editor, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
|
2004-04-22 17:14:22 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (editor->priv->ui_path)
|
|
|
|
g_free (editor->priv->ui_path);
|
2004-04-22 17:14:22 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->ui_path = g_strdup (ui_path);
|
2004-04-22 17:14:22 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
editor->priv->popup_data = popup_data;
|
2003-03-21 11:47:37 +00:00
|
|
|
}
|
|
|
|
|
2021-12-08 00:09:08 +01:00
|
|
|
gboolean
|
|
|
|
gimp_editor_popup_menu_at_pointer (GimpEditor *editor,
|
|
|
|
const GdkEvent *trigger_event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), FALSE);
|
|
|
|
|
|
|
|
if (editor->priv->ui_manager && editor->priv->ui_path)
|
|
|
|
{
|
|
|
|
gimp_ui_manager_update (editor->priv->ui_manager, editor->priv->popup_data);
|
|
|
|
gimp_ui_manager_ui_popup_at_pointer (editor->priv->ui_manager, editor->priv->ui_path,
|
2023-02-22 19:58:43 +01:00
|
|
|
GTK_WIDGET (editor), trigger_event, NULL, NULL);
|
2021-12-08 00:09:08 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-12-08 00:09:08 +01:00
|
|
|
gboolean
|
|
|
|
gimp_editor_popup_menu_at_rect (GimpEditor *editor,
|
|
|
|
GdkWindow *window,
|
|
|
|
const GdkRectangle *rect,
|
|
|
|
GdkGravity rect_anchor,
|
|
|
|
GdkGravity menu_anchor,
|
|
|
|
const GdkEvent *trigger_event)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), FALSE);
|
|
|
|
|
|
|
|
if (editor->priv->ui_manager && editor->priv->ui_path)
|
|
|
|
{
|
|
|
|
gimp_ui_manager_update (editor->priv->ui_manager, editor->priv->popup_data);
|
|
|
|
gimp_ui_manager_ui_popup_at_rect (editor->priv->ui_manager, editor->priv->ui_path,
|
2023-02-22 19:58:43 +01:00
|
|
|
GTK_WIDGET (editor), window,
|
|
|
|
rect, rect_anchor, menu_anchor,
|
2021-12-08 00:09:08 +01:00
|
|
|
trigger_event, NULL, NULL);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2023-02-09 21:50:54 +01:00
|
|
|
/**
|
|
|
|
* gimp_editor_add_button:
|
|
|
|
* @editor:
|
|
|
|
* @icon_name:
|
|
|
|
* @tooltip:
|
|
|
|
* @help_id:
|
|
|
|
* @callback:
|
|
|
|
* @extended_callback:
|
|
|
|
* @callback_data:
|
|
|
|
*
|
|
|
|
* Creates a new button, connect @callback to the "clicked" signal and
|
|
|
|
* @extended_callback to the "extended-clicked" signal.
|
|
|
|
* The @callback_data has to be a %GObject so that we keep a ref on it and avoid
|
|
|
|
* bad surprises.
|
|
|
|
*/
|
2002-03-08 00:27:45 +00:00
|
|
|
GtkWidget *
|
|
|
|
gimp_editor_add_button (GimpEditor *editor,
|
2014-05-06 23:47:38 +02:00
|
|
|
const gchar *icon_name,
|
2002-03-08 00:27:45 +00:00
|
|
|
const gchar *tooltip,
|
2003-08-24 13:52:51 +00:00
|
|
|
const gchar *help_id,
|
2002-03-08 00:27:45 +00:00
|
|
|
GCallback callback,
|
|
|
|
GCallback extended_callback,
|
2023-02-09 21:50:54 +01:00
|
|
|
GObject *callback_data)
|
2002-03-08 00:27:45 +00:00
|
|
|
{
|
2008-02-10 20:50:21 +00:00
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *image;
|
|
|
|
GtkIconSize button_icon_size;
|
|
|
|
GtkReliefStyle button_relief;
|
2002-03-08 00:27:45 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
2014-05-06 23:47:38 +02:00
|
|
|
g_return_val_if_fail (icon_name != NULL, NULL);
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2008-02-10 20:50:21 +00:00
|
|
|
button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2018-05-17 12:56:29 +02:00
|
|
|
button = gimp_button_new ();
|
2008-02-10 20:50:21 +00:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (button), button_relief);
|
2011-04-09 19:51:51 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (editor->priv->button_box), button, TRUE, TRUE, 0);
|
2002-03-08 00:27:45 +00:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2003-08-24 13:52:51 +00:00
|
|
|
if (tooltip || help_id)
|
|
|
|
gimp_help_set_help_data (button, tooltip, help_id);
|
2002-03-08 00:27:45 +00:00
|
|
|
|
|
|
|
if (callback)
|
2023-02-09 21:50:54 +01:00
|
|
|
g_signal_connect_object (button, "clicked",
|
|
|
|
callback,
|
|
|
|
callback_data, 0);
|
2002-03-08 00:27:45 +00:00
|
|
|
|
|
|
|
if (extended_callback)
|
2023-02-09 21:50:54 +01:00
|
|
|
g_signal_connect_object (button, "extended-clicked",
|
|
|
|
extended_callback,
|
|
|
|
callback_data, 0);
|
2002-03-08 00:27:45 +00:00
|
|
|
|
2014-05-06 23:47:38 +02:00
|
|
|
image = gtk_image_new_from_icon_name (icon_name, button_icon_size);
|
2002-03-08 00:27:45 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (button), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
|
|
|
return button;
|
|
|
|
}
|
2003-03-31 12:09:09 +00:00
|
|
|
|
|
|
|
GtkWidget *
|
2014-05-07 15:30:38 +02:00
|
|
|
gimp_editor_add_icon_box (GimpEditor *editor,
|
|
|
|
GType enum_type,
|
|
|
|
const gchar *icon_prefix,
|
|
|
|
GCallback callback,
|
|
|
|
gpointer callback_data)
|
2003-03-31 12:09:09 +00:00
|
|
|
{
|
2008-02-10 20:50:21 +00:00
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *first_button;
|
|
|
|
GtkIconSize button_icon_size;
|
|
|
|
GtkReliefStyle button_relief;
|
|
|
|
GList *children;
|
|
|
|
GList *list;
|
2003-03-31 12:09:09 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
|
|
|
g_return_val_if_fail (g_type_is_a (enum_type, G_TYPE_ENUM), NULL);
|
2014-05-06 23:47:38 +02:00
|
|
|
g_return_val_if_fail (icon_prefix != NULL, NULL);
|
2003-03-31 12:09:09 +00:00
|
|
|
|
2008-02-10 20:50:21 +00:00
|
|
|
button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
|
2003-03-31 12:09:09 +00:00
|
|
|
|
2014-05-07 21:30:06 +02:00
|
|
|
hbox = gimp_enum_icon_box_new (enum_type, icon_prefix, button_icon_size,
|
2019-08-08 00:01:10 +02:00
|
|
|
callback, callback_data, NULL,
|
2014-05-07 21:30:06 +02:00
|
|
|
&first_button);
|
2003-03-31 12:09:09 +00:00
|
|
|
|
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (hbox));
|
|
|
|
|
|
|
|
for (list = children; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
GtkWidget *button = list->data;
|
|
|
|
|
|
|
|
g_object_ref (button);
|
|
|
|
|
2008-02-10 20:50:21 +00:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (button), button_relief);
|
|
|
|
|
2003-03-31 12:09:09 +00:00
|
|
|
gtk_container_remove (GTK_CONTAINER (hbox), button);
|
2011-04-09 19:51:51 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (editor->priv->button_box), button,
|
2003-03-31 12:09:09 +00:00
|
|
|
TRUE, TRUE, 0);
|
|
|
|
|
|
|
|
g_object_unref (button);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (children);
|
2004-02-17 20:17:49 +00:00
|
|
|
|
2006-07-05 13:40:47 +00:00
|
|
|
g_object_ref_sink (hbox);
|
|
|
|
g_object_unref (hbox);
|
2003-03-31 12:09:09 +00:00
|
|
|
|
|
|
|
return first_button;
|
|
|
|
}
|
2003-04-01 09:07:53 +00:00
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
|
2007-05-22 16:18:32 +00:00
|
|
|
typedef struct
|
2004-05-12 18:36:33 +00:00
|
|
|
{
|
|
|
|
GdkModifierType mod_mask;
|
2019-07-02 03:54:38 +02:00
|
|
|
GimpAction *action;
|
2007-05-22 16:18:32 +00:00
|
|
|
} ExtendedAction;
|
2004-05-12 18:36:33 +00:00
|
|
|
|
|
|
|
static void
|
2007-05-22 16:18:32 +00:00
|
|
|
gimp_editor_button_extended_actions_free (GList *actions)
|
2004-05-12 18:36:33 +00:00
|
|
|
{
|
2007-05-22 16:18:32 +00:00
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = actions; list; list = list->next)
|
|
|
|
g_slice_free (ExtendedAction, list->data);
|
|
|
|
|
|
|
|
g_list_free (actions);
|
2004-05-12 18:36:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_editor_button_extended_clicked (GtkWidget *button,
|
|
|
|
GdkModifierType mask,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GList *extended = g_object_get_data (G_OBJECT (button), "extended-actions");
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
for (list = extended; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
ExtendedAction *ext = list->data;
|
|
|
|
|
|
|
|
if ((ext->mod_mask & mask) == ext->mod_mask &&
|
2021-04-23 18:49:29 +02:00
|
|
|
gimp_action_get_sensitive (ext->action, NULL))
|
2004-05-12 18:36:33 +00:00
|
|
|
{
|
2019-07-02 03:54:38 +02:00
|
|
|
gimp_action_activate (ext->action);
|
2004-05-12 18:36:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-11 16:05:21 +00:00
|
|
|
GtkWidget *
|
|
|
|
gimp_editor_add_action_button (GimpEditor *editor,
|
|
|
|
const gchar *group_name,
|
2004-05-12 18:36:33 +00:00
|
|
|
const gchar *action_name,
|
|
|
|
...)
|
2004-05-11 16:05:21 +00:00
|
|
|
{
|
|
|
|
GimpActionGroup *group;
|
2019-07-02 03:54:38 +02:00
|
|
|
GimpAction *action;
|
2004-05-11 16:05:21 +00:00
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *old_child;
|
|
|
|
GtkWidget *image;
|
|
|
|
GtkIconSize button_icon_size;
|
2008-02-10 20:50:21 +00:00
|
|
|
GtkReliefStyle button_relief;
|
2014-05-06 23:47:38 +02:00
|
|
|
const gchar *icon_name;
|
2004-05-11 16:05:21 +00:00
|
|
|
gchar *tooltip;
|
|
|
|
const gchar *help_id;
|
2004-05-12 18:36:33 +00:00
|
|
|
GList *extended = NULL;
|
|
|
|
va_list args;
|
2004-05-11 16:05:21 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
|
|
|
g_return_val_if_fail (action_name != NULL, NULL);
|
2011-04-09 19:51:51 +02:00
|
|
|
g_return_val_if_fail (editor->priv->ui_manager != NULL, NULL);
|
2004-05-11 16:05:21 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
group = gimp_ui_manager_get_action_group (editor->priv->ui_manager,
|
|
|
|
group_name);
|
2004-05-11 16:05:21 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (group != NULL, NULL);
|
|
|
|
|
2019-07-02 03:54:38 +02:00
|
|
|
action = gimp_action_group_get_action (group, action_name);
|
2004-05-11 16:05:21 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (action != NULL, NULL);
|
|
|
|
|
2008-02-10 20:50:21 +00:00
|
|
|
button_icon_size = gimp_editor_ensure_button_box (editor, &button_relief);
|
2004-05-11 16:05:21 +00:00
|
|
|
|
2019-07-02 03:54:38 +02:00
|
|
|
if (GIMP_IS_TOGGLE_ACTION (action))
|
2009-08-21 13:52:29 +02:00
|
|
|
button = gtk_toggle_button_new ();
|
2004-09-26 15:21:44 +00:00
|
|
|
else
|
2018-05-17 12:56:29 +02:00
|
|
|
button = gimp_button_new ();
|
2004-09-26 15:21:44 +00:00
|
|
|
|
2008-02-10 20:50:21 +00:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (button), button_relief);
|
|
|
|
|
2019-07-02 03:54:38 +02:00
|
|
|
icon_name = gimp_action_get_icon_name (action);
|
|
|
|
tooltip = g_strdup (gimp_action_get_tooltip (action));
|
2014-05-06 23:47:38 +02:00
|
|
|
help_id = g_object_get_qdata (G_OBJECT (action), GIMP_HELP_ID);
|
2004-05-11 16:05:21 +00:00
|
|
|
|
|
|
|
old_child = gtk_bin_get_child (GTK_BIN (button));
|
|
|
|
|
|
|
|
if (old_child)
|
2012-02-21 00:36:18 +01:00
|
|
|
gtk_widget_destroy (old_child);
|
2004-05-11 16:05:21 +00:00
|
|
|
|
2014-05-06 23:47:38 +02:00
|
|
|
image = gtk_image_new_from_icon_name (icon_name, button_icon_size);
|
2004-05-11 16:05:21 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (button), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
|
2023-03-09 02:10:40 +01:00
|
|
|
gimp_action_set_proxy (action, button);
|
2011-04-09 19:51:51 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (editor->priv->button_box), button,
|
|
|
|
TRUE, TRUE, 0);
|
2006-06-10 17:48:33 +00:00
|
|
|
gtk_widget_show (button);
|
|
|
|
|
2004-05-12 18:36:33 +00:00
|
|
|
va_start (args, action_name);
|
|
|
|
|
|
|
|
action_name = va_arg (args, const gchar *);
|
|
|
|
|
|
|
|
while (action_name)
|
|
|
|
{
|
|
|
|
GdkModifierType mod_mask;
|
|
|
|
|
|
|
|
mod_mask = va_arg (args, GdkModifierType);
|
|
|
|
|
2019-07-02 03:54:38 +02:00
|
|
|
action = gimp_action_group_get_action (group, action_name);
|
2004-05-12 18:36:33 +00:00
|
|
|
|
|
|
|
if (action && mod_mask)
|
|
|
|
{
|
2007-05-22 16:18:32 +00:00
|
|
|
ExtendedAction *ext = g_slice_new (ExtendedAction);
|
2004-05-12 18:36:33 +00:00
|
|
|
|
2011-10-06 22:26:43 +02:00
|
|
|
ext->mod_mask = mod_mask;
|
2004-05-12 18:36:33 +00:00
|
|
|
ext->action = action;
|
|
|
|
|
2004-10-16 17:10:04 +00:00
|
|
|
extended = g_list_prepend (extended, ext);
|
2004-10-16 15:48:23 +00:00
|
|
|
|
|
|
|
if (tooltip)
|
|
|
|
{
|
2019-07-02 03:54:38 +02:00
|
|
|
const gchar *ext_tooltip = gimp_action_get_tooltip (action);
|
2004-10-16 15:48:23 +00:00
|
|
|
|
|
|
|
if (ext_tooltip)
|
|
|
|
{
|
2007-11-09 11:17:00 +00:00
|
|
|
gchar *tmp = g_strconcat (tooltip, "\n<b>",
|
2011-10-05 19:21:24 +02:00
|
|
|
gimp_get_mod_string (ext->mod_mask),
|
2007-11-09 11:17:00 +00:00
|
|
|
"</b> ", ext_tooltip, NULL);
|
2004-10-16 15:48:23 +00:00
|
|
|
g_free (tooltip);
|
|
|
|
tooltip = tmp;
|
|
|
|
}
|
|
|
|
}
|
2004-05-12 18:36:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
action_name = va_arg (args, const gchar *);
|
|
|
|
}
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
|
|
|
|
if (extended)
|
|
|
|
{
|
|
|
|
g_object_set_data_full (G_OBJECT (button), "extended-actions", extended,
|
|
|
|
(GDestroyNotify) gimp_editor_button_extended_actions_free);
|
|
|
|
|
2005-08-03 09:34:55 +00:00
|
|
|
g_signal_connect (button, "extended-clicked",
|
2004-05-12 18:36:33 +00:00
|
|
|
G_CALLBACK (gimp_editor_button_extended_clicked),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2004-10-16 15:48:23 +00:00
|
|
|
if (tooltip || help_id)
|
2007-11-22 13:59:06 +00:00
|
|
|
gimp_help_set_help_data_with_markup (button, tooltip, help_id);
|
2004-10-16 15:48:23 +00:00
|
|
|
|
|
|
|
g_free (tooltip);
|
|
|
|
|
2004-05-11 16:05:21 +00:00
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
2005-05-27 11:40:06 +00:00
|
|
|
void
|
|
|
|
gimp_editor_set_show_name (GimpEditor *editor,
|
|
|
|
gboolean show)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_EDITOR (editor));
|
|
|
|
|
|
|
|
g_object_set (editor, "show-name", show, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_editor_set_name (GimpEditor *editor,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_EDITOR (editor));
|
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
gtk_label_set_text (GTK_LABEL (editor->priv->name_label),
|
2005-05-27 11:40:06 +00:00
|
|
|
name ? name : _("(None)"));
|
|
|
|
}
|
|
|
|
|
2003-11-12 00:21:58 +00:00
|
|
|
void
|
|
|
|
gimp_editor_set_box_style (GimpEditor *editor,
|
|
|
|
GtkBox *box)
|
|
|
|
{
|
2017-03-11 01:40:15 +01:00
|
|
|
GList *children;
|
|
|
|
GList *list;
|
2008-02-10 20:50:21 +00:00
|
|
|
GtkIconSize button_icon_size;
|
|
|
|
gint button_spacing;
|
|
|
|
GtkReliefStyle button_relief;
|
2003-11-12 00:21:58 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_EDITOR (editor));
|
|
|
|
g_return_if_fail (GTK_IS_BOX (box));
|
|
|
|
|
2018-06-10 16:41:36 +02:00
|
|
|
gtk_widget_style_get (GTK_WIDGET (editor),
|
|
|
|
"button-icon-size", &button_icon_size,
|
|
|
|
"button-spacing", &button_spacing,
|
|
|
|
"button-relief", &button_relief,
|
|
|
|
NULL);
|
2003-11-12 00:21:58 +00:00
|
|
|
|
|
|
|
gtk_box_set_spacing (box, button_spacing);
|
|
|
|
|
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (box));
|
|
|
|
for (list = children; list; list = g_list_next (list))
|
|
|
|
{
|
|
|
|
if (GTK_IS_BUTTON (list->data))
|
|
|
|
{
|
|
|
|
GtkWidget *child;
|
|
|
|
|
2008-02-10 20:50:21 +00:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (list->data), button_relief);
|
|
|
|
|
2003-11-12 00:21:58 +00:00
|
|
|
child = gtk_bin_get_child (GTK_BIN (list->data));
|
|
|
|
|
Issue #7023: icon size selection on GIMP 2.99.
This kinda reverts commit 6aebd30de142286c41e6cd90abedc4082a13fcea ("app: remove
icon sizing preferences"), except that the code base is different enough since
this old commit was mainly for GIMP 2.10.x.
In any case, after initially thinking that GTK+3 handling for high density
display would be enough, we finally decide that adding back a Preferences-wide
setting for overriding the theme-set icon size is a good idea (additionally to
GTK+3 automatic support).
The base idea for removing the feature was that GTK+3 has high density display
support, through the "scale factor". Typically a high density display will
normally be set as using a ×2 scale factor so all icons will be double size.
Unfortunately it turns out it's not enough.
For instance, on very small screen estate, even with a scale factor of 1, if the
theme sets 24px toolbox icons, it may still take too much space.
Oppositely on huge screens, even with ×2 factor scale detected by the OS, the
icons may still feel too small (this is possibly what happens with #7023).
Furthermore there is also a matter of taste. Some people like small icons even
when they have the space. Others may want bigger icons, easy to click on.
Finally you can like a theme for its color scheme for instance, but it may not
have the icon size you want. Right now, we'd need to duplicate every theme in
small or bigger size. Instead of doing so, let's just have this global setting
overriding the theme rules.
Comparison with the 2.10 implementation:
- We still provide 4 sizes: small, medium, large and huge.
- We don't have the "Guess ideal size" setting anymore. Instead this is now a
mix of the GTK+3 scale factor logic and the theme-set or custom size. I.e.
that on a high density display with ×2 scale factor, we could have toolbox
icons up to 96 pixels (48×2)!
- We now try to have less custom code in widgets as we append the CSS rules to
the theme (similar to what we were already doing for dark theme or icon
variants). What happens in widget code is mostly to connect to changes in
themes and redraw the widgets which need to be.
- The custom size will now affect: toolbox icons, the FG/BG editor widget (in
both the toolbox and the color dockable), dockable tab icons, the main
dockable buttons, eye and lock header icons in item tree views, eye and lock
cell icons in the item lists.
There are still a bunch of areas where it is not taken into account, such as
plug-ins, and various dialogs, but even in custom-made interface in dockables.
Ultimately it might be interesting to have a way to sync more buttons and
widgets to a global size settings.
Lastly, I fixed a bunch of existing bugs where we were updating icon sizes with
gtk_image_set_from_icon_name() using the const icon name taken from
gtk_image_get_icon_name(). As this was reusing the same string pointer, we were
ending with freeing the icon name.
2022-09-26 22:56:08 +02:00
|
|
|
if (GTK_IS_IMAGE (child) &&
|
|
|
|
gtk_image_get_storage_type (GTK_IMAGE (child)) == GTK_IMAGE_ICON_NAME)
|
2003-11-12 00:21:58 +00:00
|
|
|
{
|
2009-09-03 13:24:30 +02:00
|
|
|
GtkIconSize old_size;
|
Issue #7023: icon size selection on GIMP 2.99.
This kinda reverts commit 6aebd30de142286c41e6cd90abedc4082a13fcea ("app: remove
icon sizing preferences"), except that the code base is different enough since
this old commit was mainly for GIMP 2.10.x.
In any case, after initially thinking that GTK+3 handling for high density
display would be enough, we finally decide that adding back a Preferences-wide
setting for overriding the theme-set icon size is a good idea (additionally to
GTK+3 automatic support).
The base idea for removing the feature was that GTK+3 has high density display
support, through the "scale factor". Typically a high density display will
normally be set as using a ×2 scale factor so all icons will be double size.
Unfortunately it turns out it's not enough.
For instance, on very small screen estate, even with a scale factor of 1, if the
theme sets 24px toolbox icons, it may still take too much space.
Oppositely on huge screens, even with ×2 factor scale detected by the OS, the
icons may still feel too small (this is possibly what happens with #7023).
Furthermore there is also a matter of taste. Some people like small icons even
when they have the space. Others may want bigger icons, easy to click on.
Finally you can like a theme for its color scheme for instance, but it may not
have the icon size you want. Right now, we'd need to duplicate every theme in
small or bigger size. Instead of doing so, let's just have this global setting
overriding the theme rules.
Comparison with the 2.10 implementation:
- We still provide 4 sizes: small, medium, large and huge.
- We don't have the "Guess ideal size" setting anymore. Instead this is now a
mix of the GTK+3 scale factor logic and the theme-set or custom size. I.e.
that on a high density display with ×2 scale factor, we could have toolbox
icons up to 96 pixels (48×2)!
- We now try to have less custom code in widgets as we append the CSS rules to
the theme (similar to what we were already doing for dark theme or icon
variants). What happens in widget code is mostly to connect to changes in
themes and redraw the widgets which need to be.
- The custom size will now affect: toolbox icons, the FG/BG editor widget (in
both the toolbox and the color dockable), dockable tab icons, the main
dockable buttons, eye and lock header icons in item tree views, eye and lock
cell icons in the item lists.
There are still a bunch of areas where it is not taken into account, such as
plug-ins, and various dialogs, but even in custom-made interface in dockables.
Ultimately it might be interesting to have a way to sync more buttons and
widgets to a global size settings.
Lastly, I fixed a bunch of existing bugs where we were updating icon sizes with
gtk_image_set_from_icon_name() using the const icon name taken from
gtk_image_get_icon_name(). As this was reusing the same string pointer, we were
ending with freeing the icon name.
2022-09-26 22:56:08 +02:00
|
|
|
const gchar *old_icon_name;
|
2003-11-12 00:21:58 +00:00
|
|
|
|
Issue #7023: icon size selection on GIMP 2.99.
This kinda reverts commit 6aebd30de142286c41e6cd90abedc4082a13fcea ("app: remove
icon sizing preferences"), except that the code base is different enough since
this old commit was mainly for GIMP 2.10.x.
In any case, after initially thinking that GTK+3 handling for high density
display would be enough, we finally decide that adding back a Preferences-wide
setting for overriding the theme-set icon size is a good idea (additionally to
GTK+3 automatic support).
The base idea for removing the feature was that GTK+3 has high density display
support, through the "scale factor". Typically a high density display will
normally be set as using a ×2 scale factor so all icons will be double size.
Unfortunately it turns out it's not enough.
For instance, on very small screen estate, even with a scale factor of 1, if the
theme sets 24px toolbox icons, it may still take too much space.
Oppositely on huge screens, even with ×2 factor scale detected by the OS, the
icons may still feel too small (this is possibly what happens with #7023).
Furthermore there is also a matter of taste. Some people like small icons even
when they have the space. Others may want bigger icons, easy to click on.
Finally you can like a theme for its color scheme for instance, but it may not
have the icon size you want. Right now, we'd need to duplicate every theme in
small or bigger size. Instead of doing so, let's just have this global setting
overriding the theme rules.
Comparison with the 2.10 implementation:
- We still provide 4 sizes: small, medium, large and huge.
- We don't have the "Guess ideal size" setting anymore. Instead this is now a
mix of the GTK+3 scale factor logic and the theme-set or custom size. I.e.
that on a high density display with ×2 scale factor, we could have toolbox
icons up to 96 pixels (48×2)!
- We now try to have less custom code in widgets as we append the CSS rules to
the theme (similar to what we were already doing for dark theme or icon
variants). What happens in widget code is mostly to connect to changes in
themes and redraw the widgets which need to be.
- The custom size will now affect: toolbox icons, the FG/BG editor widget (in
both the toolbox and the color dockable), dockable tab icons, the main
dockable buttons, eye and lock header icons in item tree views, eye and lock
cell icons in the item lists.
There are still a bunch of areas where it is not taken into account, such as
plug-ins, and various dialogs, but even in custom-made interface in dockables.
Ultimately it might be interesting to have a way to sync more buttons and
widgets to a global size settings.
Lastly, I fixed a bunch of existing bugs where we were updating icon sizes with
gtk_image_set_from_icon_name() using the const icon name taken from
gtk_image_get_icon_name(). As this was reusing the same string pointer, we were
ending with freeing the icon name.
2022-09-26 22:56:08 +02:00
|
|
|
gtk_image_get_icon_name (GTK_IMAGE (child), &old_icon_name, &old_size);
|
2009-09-03 13:24:30 +02:00
|
|
|
|
|
|
|
if (button_icon_size != old_size)
|
Issue #7023: icon size selection on GIMP 2.99.
This kinda reverts commit 6aebd30de142286c41e6cd90abedc4082a13fcea ("app: remove
icon sizing preferences"), except that the code base is different enough since
this old commit was mainly for GIMP 2.10.x.
In any case, after initially thinking that GTK+3 handling for high density
display would be enough, we finally decide that adding back a Preferences-wide
setting for overriding the theme-set icon size is a good idea (additionally to
GTK+3 automatic support).
The base idea for removing the feature was that GTK+3 has high density display
support, through the "scale factor". Typically a high density display will
normally be set as using a ×2 scale factor so all icons will be double size.
Unfortunately it turns out it's not enough.
For instance, on very small screen estate, even with a scale factor of 1, if the
theme sets 24px toolbox icons, it may still take too much space.
Oppositely on huge screens, even with ×2 factor scale detected by the OS, the
icons may still feel too small (this is possibly what happens with #7023).
Furthermore there is also a matter of taste. Some people like small icons even
when they have the space. Others may want bigger icons, easy to click on.
Finally you can like a theme for its color scheme for instance, but it may not
have the icon size you want. Right now, we'd need to duplicate every theme in
small or bigger size. Instead of doing so, let's just have this global setting
overriding the theme rules.
Comparison with the 2.10 implementation:
- We still provide 4 sizes: small, medium, large and huge.
- We don't have the "Guess ideal size" setting anymore. Instead this is now a
mix of the GTK+3 scale factor logic and the theme-set or custom size. I.e.
that on a high density display with ×2 scale factor, we could have toolbox
icons up to 96 pixels (48×2)!
- We now try to have less custom code in widgets as we append the CSS rules to
the theme (similar to what we were already doing for dark theme or icon
variants). What happens in widget code is mostly to connect to changes in
themes and redraw the widgets which need to be.
- The custom size will now affect: toolbox icons, the FG/BG editor widget (in
both the toolbox and the color dockable), dockable tab icons, the main
dockable buttons, eye and lock header icons in item tree views, eye and lock
cell icons in the item lists.
There are still a bunch of areas where it is not taken into account, such as
plug-ins, and various dialogs, but even in custom-made interface in dockables.
Ultimately it might be interesting to have a way to sync more buttons and
widgets to a global size settings.
Lastly, I fixed a bunch of existing bugs where we were updating icon sizes with
gtk_image_set_from_icon_name() using the const icon name taken from
gtk_image_get_icon_name(). As this was reusing the same string pointer, we were
ending with freeing the icon name.
2022-09-26 22:56:08 +02:00
|
|
|
{
|
|
|
|
gchar *icon_name;
|
|
|
|
|
|
|
|
icon_name = g_strdup (old_icon_name);
|
|
|
|
gtk_image_set_from_icon_name (GTK_IMAGE (child),
|
|
|
|
icon_name, button_icon_size);
|
|
|
|
g_free (icon_name);
|
|
|
|
}
|
2003-11-12 00:21:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (children);
|
|
|
|
}
|
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
GimpUIManager *
|
|
|
|
gimp_editor_get_ui_manager (GimpEditor *editor)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
return editor->priv->ui_manager;
|
|
|
|
}
|
|
|
|
|
|
|
|
GtkBox *
|
|
|
|
gimp_editor_get_button_box (GimpEditor *editor)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
return GTK_BOX (editor->priv->button_box);
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpMenuFactory *
|
|
|
|
|
|
|
|
gimp_editor_get_menu_factory (GimpEditor *editor)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
return editor->priv->menu_factory;
|
|
|
|
}
|
|
|
|
|
|
|
|
gpointer *
|
|
|
|
gimp_editor_get_popup_data (GimpEditor *editor)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
return editor->priv->popup_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
gchar *
|
|
|
|
gimp_editor_get_ui_path (GimpEditor *editor)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_EDITOR (editor), NULL);
|
|
|
|
|
|
|
|
return editor->priv->ui_path;
|
|
|
|
}
|
|
|
|
|
2003-11-12 00:21:58 +00:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
2003-04-01 09:07:53 +00:00
|
|
|
static GtkIconSize
|
2008-02-10 20:50:21 +00:00
|
|
|
gimp_editor_ensure_button_box (GimpEditor *editor,
|
|
|
|
GtkReliefStyle *button_relief)
|
2003-04-01 09:07:53 +00:00
|
|
|
{
|
2018-06-05 16:07:02 +02:00
|
|
|
GtkIconSize button_icon_size;
|
|
|
|
gint button_spacing;
|
2017-03-11 01:40:15 +01:00
|
|
|
|
2018-06-10 16:41:36 +02:00
|
|
|
gtk_widget_style_get (GTK_WIDGET (editor),
|
|
|
|
"button-icon-size", &button_icon_size,
|
|
|
|
"button-spacing", &button_spacing,
|
|
|
|
"button-relief", button_relief,
|
|
|
|
NULL);
|
2003-04-01 09:07:53 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (! editor->priv->button_box)
|
2003-04-01 09:07:53 +00:00
|
|
|
{
|
2011-09-30 11:29:11 +02:00
|
|
|
editor->priv->button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
button_spacing);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (editor->priv->button_box), TRUE);
|
2011-04-09 19:51:51 +02:00
|
|
|
gtk_box_pack_end (GTK_BOX (editor), editor->priv->button_box, FALSE, FALSE, 0);
|
|
|
|
gtk_box_reorder_child (GTK_BOX (editor), editor->priv->button_box, 0);
|
2005-06-04 21:00:48 +00:00
|
|
|
|
2011-04-09 19:51:51 +02:00
|
|
|
if (editor->priv->show_button_bar)
|
|
|
|
gtk_widget_show (editor->priv->button_box);
|
2003-04-01 09:07:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return button_icon_size;
|
|
|
|
}
|