2003-09-24 01:01:38 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
1999-03-02 08:31:39 +08:00
|
|
|
*
|
2000-02-26 11:41:06 +08:00
|
|
|
* gimpchainbutton.c
|
2003-09-24 01:01:38 +08:00
|
|
|
* Copyright (C) 1999-2000 Sven Neumann <sven@gimp.org>
|
2000-02-26 11:41:06 +08:00
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
1999-11-18 05:13:50 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1999-03-02 08:31:39 +08:00
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2003-09-24 01:01:38 +08:00
|
|
|
*
|
|
|
|
* This library 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
|
1999-03-02 08:31:39 +08:00
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
1999-11-18 05:13:50 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
1999-03-02 08:31:39 +08:00
|
|
|
*/
|
|
|
|
|
2006-05-30 10:01:39 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-05-31 07:38:46 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-07 04:31:46 +08:00
|
|
|
#include "gimpwidgetstypes.h"
|
|
|
|
|
1999-03-02 08:31:39 +08:00
|
|
|
#include "gimpchainbutton.h"
|
2015-12-13 03:44:46 +08:00
|
|
|
#include "gimpicons.h"
|
2000-05-31 07:38:46 +08:00
|
|
|
|
1999-03-02 08:31:39 +08:00
|
|
|
|
2010-07-06 00:01:28 +08:00
|
|
|
/**
|
|
|
|
* SECTION: gimpchainbutton
|
|
|
|
* @title: GimpChainButton
|
|
|
|
* @short_description: Widget to visually connect two entry widgets.
|
|
|
|
* @see_also: You may want to use the convenience function
|
|
|
|
* gimp_coordinates_new() to set up two GimpSizeEntries
|
|
|
|
* (see #GimpSizeEntry) linked with a #GimpChainButton.
|
|
|
|
*
|
|
|
|
* This widget provides a button showing either a linked or a broken
|
|
|
|
* chain that can be used to link two entries, spinbuttons, colors or
|
|
|
|
* other GUI elements and show that they may be locked. Use it for
|
|
|
|
* example to connect X and Y ratios to provide the possibility of a
|
|
|
|
* constrained aspect ratio.
|
|
|
|
*
|
|
|
|
* The #GimpChainButton only gives visual feedback, it does not really
|
|
|
|
* connect widgets. You have to take care of locking the values
|
|
|
|
* yourself by checking the state of the #GimpChainButton whenever a
|
|
|
|
* value changes in one of the connected widgets and adjusting the
|
|
|
|
* other value if necessary.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2006-09-07 20:23:42 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_POSITION
|
|
|
|
};
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
TOGGLED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
|
|
|
|
struct _GimpChainButtonPrivate
|
|
|
|
{
|
|
|
|
GimpChainPosition position;
|
|
|
|
gboolean active;
|
|
|
|
|
|
|
|
GtkWidget *button;
|
|
|
|
GtkWidget *line1;
|
|
|
|
GtkWidget *line2;
|
|
|
|
GtkWidget *image;
|
|
|
|
};
|
|
|
|
|
2018-04-29 06:06:50 +08:00
|
|
|
#define GET_PRIVATE(obj) (((GimpChainButton *) (obj))->priv)
|
2011-01-01 01:17:11 +08:00
|
|
|
|
|
|
|
|
2011-01-13 05:03:33 +08:00
|
|
|
static void gimp_chain_button_constructed (GObject *object);
|
2006-09-07 20:23:42 +08:00
|
|
|
static void gimp_chain_button_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_chain_button_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2001-12-29 21:26:29 +08:00
|
|
|
|
2005-12-21 04:35:23 +08:00
|
|
|
static void gimp_chain_button_clicked_callback (GtkWidget *widget,
|
2006-04-12 18:53:28 +08:00
|
|
|
GimpChainButton *button);
|
2006-11-22 16:05:13 +08:00
|
|
|
static void gimp_chain_button_update_image (GimpChainButton *button);
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
|
2008-02-27 03:25:11 +08:00
|
|
|
static GtkWidget * gimp_chain_line_new (GimpChainPosition position,
|
|
|
|
gint which);
|
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
|
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-19 00:09:39 +08:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GimpChainButton, gimp_chain_button, GTK_TYPE_GRID)
|
2005-12-21 04:35:23 +08:00
|
|
|
|
|
|
|
#define parent_class gimp_chain_button_parent_class
|
|
|
|
|
|
|
|
static guint gimp_chain_button_signals[LAST_SIGNAL] = { 0 };
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
|
2014-05-08 03:27:57 +08:00
|
|
|
static const gchar * const gimp_chain_icon_names[] =
|
1999-11-17 02:53:49 +08:00
|
|
|
{
|
2017-03-05 23:01:59 +08:00
|
|
|
GIMP_ICON_CHAIN_HORIZONTAL,
|
|
|
|
GIMP_ICON_CHAIN_HORIZONTAL_BROKEN,
|
|
|
|
GIMP_ICON_CHAIN_VERTICAL,
|
|
|
|
GIMP_ICON_CHAIN_VERTICAL_BROKEN
|
2000-02-22 08:23:26 +08:00
|
|
|
};
|
|
|
|
|
2000-08-28 06:41:52 +08:00
|
|
|
|
1999-03-02 08:31:39 +08:00
|
|
|
static void
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
gimp_chain_button_class_init (GimpChainButtonClass *klass)
|
1999-03-02 08:31:39 +08:00
|
|
|
{
|
2006-09-07 20:23:42 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
2011-01-13 05:03:33 +08:00
|
|
|
object_class->constructed = gimp_chain_button_constructed;
|
2006-09-07 20:23:42 +08:00
|
|
|
object_class->set_property = gimp_chain_button_set_property;
|
|
|
|
object_class->get_property = gimp_chain_button_get_property;
|
|
|
|
|
2003-09-24 01:01:38 +08:00
|
|
|
gimp_chain_button_signals[TOGGLED] =
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_new ("toggled",
|
2006-04-12 18:53:28 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpChainButtonClass, toggled),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2000-08-28 06:41:52 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
klass->toggled = NULL;
|
2006-09-07 20:23:42 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GimpChainButton:position:
|
|
|
|
*
|
|
|
|
* The position in which the chain button will be used.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2006-09-07 20:23:42 +08:00
|
|
|
*/
|
|
|
|
g_object_class_install_property (object_class, PROP_POSITION,
|
2017-06-07 03:19:17 +08:00
|
|
|
g_param_spec_enum ("position",
|
|
|
|
"Position",
|
|
|
|
"The chain's position",
|
2006-09-07 20:23:42 +08:00
|
|
|
GIMP_TYPE_CHAIN_POSITION,
|
|
|
|
GIMP_CHAIN_TOP,
|
|
|
|
G_PARAM_CONSTRUCT_ONLY |
|
|
|
|
GIMP_PARAM_READWRITE));
|
1999-03-02 08:31:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-01-05 23:41:23 +08:00
|
|
|
gimp_chain_button_init (GimpChainButton *button)
|
1999-03-02 08:31:39 +08:00
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
2000-02-22 08:23:26 +08:00
|
|
|
|
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-19 00:09:39 +08:00
|
|
|
button->priv = gimp_chain_button_get_instance_private (button);
|
2018-04-29 06:06:50 +08:00
|
|
|
|
|
|
|
private = GET_PRIVATE (button);
|
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
private->position = GIMP_CHAIN_TOP;
|
|
|
|
private->active = FALSE;
|
|
|
|
private->image = gtk_image_new ();
|
|
|
|
private->button = gtk_button_new ();
|
2003-01-05 23:41:23 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
gtk_button_set_relief (GTK_BUTTON (private->button), GTK_RELIEF_NONE);
|
|
|
|
gtk_container_add (GTK_CONTAINER (private->button), private->image);
|
|
|
|
gtk_widget_show (private->image);
|
|
|
|
|
|
|
|
g_signal_connect (private->button, "clicked",
|
2003-09-24 01:01:38 +08:00
|
|
|
G_CALLBACK (gimp_chain_button_clicked_callback),
|
2003-01-05 23:41:23 +08:00
|
|
|
button);
|
1999-03-02 08:31:39 +08:00
|
|
|
}
|
|
|
|
|
2011-01-13 05:03:33 +08:00
|
|
|
static void
|
|
|
|
gimp_chain_button_constructed (GObject *object)
|
1999-03-02 08:31:39 +08:00
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButton *button = GIMP_CHAIN_BUTTON (object);
|
|
|
|
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
1999-11-17 02:53:49 +08:00
|
|
|
|
2012-11-13 04:51:22 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->constructed (object);
|
1999-11-17 02:53:49 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
private->line1 = gimp_chain_line_new (private->position, 1);
|
|
|
|
private->line2 = gimp_chain_line_new (private->position, -1);
|
2008-02-27 03:25:11 +08:00
|
|
|
|
2006-11-22 16:05:13 +08:00
|
|
|
gimp_chain_button_update_image (button);
|
2000-02-22 08:23:26 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
if (private->position & GIMP_CHAIN_LEFT) /* are we a vertical chainbutton? */
|
1999-03-03 23:00:56 +08:00
|
|
|
{
|
2018-04-29 06:06:50 +08:00
|
|
|
gtk_widget_set_vexpand (private->line1, TRUE);
|
|
|
|
gtk_widget_set_vexpand (private->line2, TRUE);
|
|
|
|
|
|
|
|
gtk_grid_attach (GTK_GRID (button), private->line1, 0, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (button), private->button, 0, 1, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (button), private->line2, 0, 2, 1, 1);
|
1999-03-03 23:00:56 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-04-29 06:06:50 +08:00
|
|
|
gtk_widget_set_hexpand (private->line1, TRUE);
|
|
|
|
gtk_widget_set_hexpand (private->line2, TRUE);
|
|
|
|
|
|
|
|
gtk_grid_attach (GTK_GRID (button), private->line1, 0, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (button), private->button, 1, 0, 1, 1);
|
|
|
|
gtk_grid_attach (GTK_GRID (button), private->line2, 2, 0, 1, 1);
|
1999-03-03 23:00:56 +08:00
|
|
|
}
|
1999-03-02 08:31:39 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
gtk_widget_show (private->button);
|
|
|
|
gtk_widget_show (private->line1);
|
|
|
|
gtk_widget_show (private->line2);
|
2006-09-07 20:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_chain_button_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButtonPrivate *private = GET_PRIVATE (object);
|
2006-09-07 20:23:42 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_POSITION:
|
2011-01-01 01:17:11 +08:00
|
|
|
private->position = g_value_get_enum (value);
|
2006-09-07 20:23:42 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_chain_button_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButtonPrivate *private = GET_PRIVATE (object);
|
2006-09-07 20:23:42 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_POSITION:
|
2011-01-01 01:17:11 +08:00
|
|
|
g_value_set_enum (value, private->position);
|
2006-09-07 20:23:42 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_chain_button_new:
|
|
|
|
* @position: The position you are going to use for the button
|
|
|
|
* with respect to the widgets you want to chain.
|
|
|
|
*
|
|
|
|
* Creates a new #GimpChainButton widget.
|
|
|
|
*
|
|
|
|
* This returns a button showing either a broken or a linked chain and
|
2018-04-29 06:06:50 +08:00
|
|
|
* small clamps attached to both sides that visually group the two
|
|
|
|
* widgets you want to connect. This widget looks best when attached
|
|
|
|
* to a grid taking up two columns (or rows respectively) next to the
|
|
|
|
* widgets that it is supposed to connect. It may work for more than
|
|
|
|
* two widgets, but the look is optimized for two.
|
2006-09-07 20:23:42 +08:00
|
|
|
*
|
|
|
|
* Returns: Pointer to the new #GimpChainButton, which is inactive
|
|
|
|
* by default. Use gimp_chain_button_set_active() to
|
|
|
|
* change its state.
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
|
|
|
gimp_chain_button_new (GimpChainPosition position)
|
|
|
|
{
|
|
|
|
return g_object_new (GIMP_TYPE_CHAIN_BUTTON,
|
|
|
|
"position", position,
|
|
|
|
NULL);
|
1999-03-02 08:31:39 +08:00
|
|
|
}
|
|
|
|
|
2003-09-24 01:01:38 +08:00
|
|
|
/**
|
2000-02-12 10:16:59 +08:00
|
|
|
* gimp_chain_button_set_active:
|
2003-02-07 05:17:12 +08:00
|
|
|
* @button: Pointer to a #GimpChainButton.
|
2001-12-29 21:26:29 +08:00
|
|
|
* @active: The new state.
|
2003-09-24 01:01:38 +08:00
|
|
|
*
|
|
|
|
* Sets the state of the #GimpChainButton to be either locked (%TRUE) or
|
2003-02-07 05:17:12 +08:00
|
|
|
* unlocked (%FALSE) and changes the showed pixmap to reflect the new state.
|
2000-02-12 10:16:59 +08:00
|
|
|
*/
|
2003-09-24 01:01:38 +08:00
|
|
|
void
|
2003-01-05 23:41:23 +08:00
|
|
|
gimp_chain_button_set_active (GimpChainButton *button,
|
2006-04-12 18:53:28 +08:00
|
|
|
gboolean active)
|
2000-02-12 10:16:59 +08:00
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButtonPrivate *private;
|
|
|
|
|
2003-01-05 23:41:23 +08:00
|
|
|
g_return_if_fail (GIMP_IS_CHAIN_BUTTON (button));
|
2000-02-12 10:16:59 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
private = GET_PRIVATE (button);
|
|
|
|
|
|
|
|
if (private->active != active)
|
2000-02-12 10:16:59 +08:00
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
private->active = active ? TRUE : FALSE;
|
2003-02-07 05:17:12 +08:00
|
|
|
|
2006-11-22 16:05:13 +08:00
|
|
|
gimp_chain_button_update_image (button);
|
2000-02-12 10:16:59 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_chain_button_get_active
|
2003-01-05 23:41:23 +08:00
|
|
|
* @button: Pointer to a #GimpChainButton.
|
2003-09-24 01:01:38 +08:00
|
|
|
*
|
|
|
|
* Checks the state of the #GimpChainButton.
|
2000-02-12 10:16:59 +08:00
|
|
|
*
|
2003-02-07 05:17:12 +08:00
|
|
|
* Returns: %TRUE if the #GimpChainButton is active (locked).
|
2000-02-12 10:16:59 +08:00
|
|
|
*/
|
2003-09-24 01:01:38 +08:00
|
|
|
gboolean
|
2003-01-05 23:41:23 +08:00
|
|
|
gimp_chain_button_get_active (GimpChainButton *button)
|
2000-02-12 10:16:59 +08:00
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButtonPrivate *private;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (button), FALSE);
|
|
|
|
|
|
|
|
private = GET_PRIVATE (button);
|
|
|
|
|
|
|
|
return private->active;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_chain_button_get_button
|
|
|
|
* @button: A #GimpChainButton.
|
|
|
|
*
|
|
|
|
* Returns: The #GimpChainButton's button.
|
|
|
|
*
|
|
|
|
* Since: GIMP 3.0
|
|
|
|
*/
|
|
|
|
GtkWidget *
|
|
|
|
gimp_chain_button_get_button (GimpChainButton *button)
|
|
|
|
{
|
|
|
|
GimpChainButtonPrivate *private;
|
|
|
|
|
2003-01-05 23:41:23 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CHAIN_BUTTON (button), FALSE);
|
2000-02-12 10:16:59 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
private = GET_PRIVATE (button);
|
|
|
|
|
|
|
|
return private->button;
|
2000-02-12 10:16:59 +08:00
|
|
|
}
|
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
1999-03-03 23:00:56 +08:00
|
|
|
static void
|
1999-11-17 02:53:49 +08:00
|
|
|
gimp_chain_button_clicked_callback (GtkWidget *widget,
|
2006-04-12 18:53:28 +08:00
|
|
|
GimpChainButton *button)
|
1999-03-02 08:31:39 +08:00
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
1999-03-02 08:31:39 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
gimp_chain_button_set_active (button, ! private->active);
|
2000-08-28 06:41:52 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (button, gimp_chain_button_signals[TOGGLED], 0);
|
1999-03-02 08:31:39 +08:00
|
|
|
}
|
|
|
|
|
2008-02-27 03:25:11 +08:00
|
|
|
static void
|
|
|
|
gimp_chain_button_update_image (GimpChainButton *button)
|
|
|
|
{
|
2011-01-01 01:17:11 +08:00
|
|
|
GimpChainButtonPrivate *private = GET_PRIVATE (button);
|
|
|
|
guint i;
|
2008-02-27 03:25:11 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
i = ((private->position & GIMP_CHAIN_LEFT) << 1) + (private->active ? 0 : 1);
|
2008-02-27 03:25:11 +08:00
|
|
|
|
2011-01-01 01:17:11 +08:00
|
|
|
gtk_image_set_from_icon_name (GTK_IMAGE (private->image),
|
2014-05-08 03:27:57 +08:00
|
|
|
gimp_chain_icon_names[i],
|
|
|
|
GTK_ICON_SIZE_BUTTON);
|
2008-02-27 03:25:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* GimpChainLine is a simple no-window widget for drawing the lines.
|
|
|
|
*
|
|
|
|
* Originally this used to be a GtkDrawingArea but this turned out to
|
|
|
|
* be a bad idea. We don't need an extra window to draw on and we also
|
|
|
|
* don't need any input events.
|
|
|
|
*/
|
|
|
|
|
2010-10-15 16:44:11 +08:00
|
|
|
static GType gimp_chain_line_get_type (void) G_GNUC_CONST;
|
|
|
|
static gboolean gimp_chain_line_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr);
|
2008-02-27 03:25:11 +08:00
|
|
|
|
|
|
|
struct _GimpChainLine
|
|
|
|
{
|
|
|
|
GtkWidget parent_instance;
|
|
|
|
GimpChainPosition position;
|
|
|
|
gint which;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GimpChainLine GimpChainLine;
|
|
|
|
typedef GtkWidgetClass GimpChainLineClass;
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GimpChainLine, gimp_chain_line, GTK_TYPE_WIDGET)
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_chain_line_class_init (GimpChainLineClass *klass)
|
|
|
|
{
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
|
|
|
2010-10-15 16:44:11 +08:00
|
|
|
widget_class->draw = gimp_chain_line_draw;
|
2008-02-27 03:25:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_chain_line_init (GimpChainLine *line)
|
|
|
|
{
|
2009-10-18 00:51:48 +08:00
|
|
|
gtk_widget_set_has_window (GTK_WIDGET (line), FALSE);
|
2008-02-27 03:25:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkWidget *
|
|
|
|
gimp_chain_line_new (GimpChainPosition position,
|
|
|
|
gint which)
|
|
|
|
{
|
|
|
|
GimpChainLine *line = g_object_new (gimp_chain_line_get_type (), NULL);
|
|
|
|
|
|
|
|
line->position = position;
|
|
|
|
line->which = which;
|
|
|
|
|
|
|
|
return GTK_WIDGET (line);
|
|
|
|
}
|
|
|
|
|
2003-01-05 23:41:23 +08:00
|
|
|
static gboolean
|
2010-10-15 16:44:11 +08:00
|
|
|
gimp_chain_line_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr)
|
1999-03-03 23:00:56 +08:00
|
|
|
{
|
2010-12-15 20:16:03 +08:00
|
|
|
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
|
|
|
GimpChainLine *line = ((GimpChainLine *) widget);
|
2009-10-18 00:51:48 +08:00
|
|
|
GtkAllocation allocation;
|
2003-09-24 01:01:38 +08:00
|
|
|
GdkPoint points[3];
|
|
|
|
GimpChainPosition position;
|
2010-12-15 20:16:03 +08:00
|
|
|
GdkRGBA color;
|
2010-10-15 16:35:28 +08:00
|
|
|
|
2010-10-15 16:40:37 +08:00
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
1999-03-03 23:00:56 +08:00
|
|
|
#define SHORT_LINE 4
|
2010-10-15 16:40:37 +08:00
|
|
|
points[0].x = allocation.width / 2;
|
|
|
|
points[0].y = allocation.height / 2;
|
1999-03-03 23:00:56 +08:00
|
|
|
|
2008-02-27 03:25:11 +08:00
|
|
|
position = line->position;
|
2003-09-24 01:01:38 +08:00
|
|
|
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
2008-02-26 17:47:29 +08:00
|
|
|
{
|
|
|
|
switch (position)
|
|
|
|
{
|
|
|
|
case GIMP_CHAIN_TOP:
|
|
|
|
case GIMP_CHAIN_BOTTOM:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CHAIN_LEFT:
|
|
|
|
position = GIMP_CHAIN_RIGHT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CHAIN_RIGHT:
|
|
|
|
position = GIMP_CHAIN_LEFT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-09-24 01:01:38 +08:00
|
|
|
|
|
|
|
switch (position)
|
1999-03-03 23:00:56 +08:00
|
|
|
{
|
|
|
|
case GIMP_CHAIN_LEFT:
|
|
|
|
points[0].x += SHORT_LINE;
|
|
|
|
points[1].x = points[0].x - SHORT_LINE;
|
|
|
|
points[1].y = points[0].y;
|
|
|
|
points[2].x = points[1].x;
|
2010-10-15 16:40:37 +08:00
|
|
|
points[2].y = (line->which == 1 ? allocation.height - 1 : 0);
|
1999-03-03 23:00:56 +08:00
|
|
|
break;
|
2008-02-26 17:47:29 +08:00
|
|
|
|
1999-03-03 23:00:56 +08:00
|
|
|
case GIMP_CHAIN_RIGHT:
|
|
|
|
points[0].x -= SHORT_LINE;
|
|
|
|
points[1].x = points[0].x + SHORT_LINE;
|
|
|
|
points[1].y = points[0].y;
|
|
|
|
points[2].x = points[1].x;
|
2010-10-15 16:40:37 +08:00
|
|
|
points[2].y = (line->which == 1 ? allocation.height - 1 : 0);
|
1999-03-03 23:00:56 +08:00
|
|
|
break;
|
2008-02-26 17:47:29 +08:00
|
|
|
|
1999-03-03 23:00:56 +08:00
|
|
|
case GIMP_CHAIN_TOP:
|
|
|
|
points[0].y += SHORT_LINE;
|
|
|
|
points[1].x = points[0].x;
|
|
|
|
points[1].y = points[0].y - SHORT_LINE;
|
2010-10-15 16:40:37 +08:00
|
|
|
points[2].x = (line->which == 1 ? allocation.width - 1 : 0);
|
1999-03-03 23:00:56 +08:00
|
|
|
points[2].y = points[1].y;
|
|
|
|
break;
|
2008-02-26 17:47:29 +08:00
|
|
|
|
1999-03-03 23:00:56 +08:00
|
|
|
case GIMP_CHAIN_BOTTOM:
|
|
|
|
points[0].y -= SHORT_LINE;
|
|
|
|
points[1].x = points[0].x;
|
|
|
|
points[1].y = points[0].y + SHORT_LINE;
|
2010-10-15 16:40:37 +08:00
|
|
|
points[2].x = (line->which == 1 ? allocation.width - 1 : 0);
|
1999-03-03 23:00:56 +08:00
|
|
|
points[2].y = points[1].y;
|
|
|
|
break;
|
2008-02-26 17:47:29 +08:00
|
|
|
|
1999-03-03 23:00:56 +08:00
|
|
|
default:
|
2000-03-16 00:00:24 +08:00
|
|
|
return FALSE;
|
1999-03-03 23:00:56 +08:00
|
|
|
}
|
|
|
|
|
2010-10-15 16:35:28 +08:00
|
|
|
cairo_move_to (cr, points[0].x, points[0].y);
|
|
|
|
cairo_line_to (cr, points[1].x, points[1].y);
|
|
|
|
cairo_line_to (cr, points[2].x, points[2].y);
|
|
|
|
|
|
|
|
cairo_set_line_width (cr, 2.0);
|
|
|
|
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
|
2010-12-15 20:16:03 +08:00
|
|
|
gtk_style_context_get_color (context, 0, &color);
|
|
|
|
gdk_cairo_set_source_rgba (cr, &color);
|
2010-10-15 16:35:28 +08:00
|
|
|
|
|
|
|
cairo_stroke (cr);
|
1999-03-03 23:00:56 +08:00
|
|
|
|
2000-03-16 00:00:24 +08:00
|
|
|
return TRUE;
|
1999-03-03 23:00:56 +08:00
|
|
|
}
|