mirror of https://github.com/GNOME/gimp.git
Merged from trunk revisions 25970:26170
svn path=/branches/soc-2008-tagging/; revision=26174
This commit is contained in:
parent
aafa684956
commit
f23d974a94
3
HACKING
3
HACKING
|
@ -16,9 +16,6 @@ Beta software can be found at alpha.gnu.org.
|
|||
* pkg-config 0.16.0 (or preferably a newer version)
|
||||
- http://www.freedesktop.org/software/pkgconfig/
|
||||
|
||||
* intltoolize 0.35.5 (or preferably a newer version)
|
||||
- ftp://ftp.gnome.org/pub/gnome/sources/intltool/
|
||||
|
||||
* gtkdocize
|
||||
- http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/
|
||||
|
||||
|
|
28
INSTALL
28
INSTALL
|
@ -28,18 +28,22 @@ header files installed.
|
|||
1. You need to have installed a recent version of pkg-config available
|
||||
from http://www.freedesktop.org/software/pkgconfig/.
|
||||
|
||||
2. You need to have GEGL version 0.0.18 or newer and babl version
|
||||
2. You need intltool (at least 0.35.5, but preferably a newer version).
|
||||
Intltool can be downloaded from
|
||||
http://ftp.gnome.org/pub/gnome/sources/intltool/
|
||||
|
||||
3. You need to have GEGL version 0.0.18 or newer and babl version
|
||||
0.0.22 or newer. You can get it from http://gegl.org/ or check
|
||||
it out from the subversion repository:
|
||||
|
||||
http://svn.gnome.org/svn/babl/trunk
|
||||
http://svn.gnome.org/svn/gegl/trunk
|
||||
|
||||
3. You need to have installed GTK+ version 2.12.1 or newer. GIMP
|
||||
4. You need to have installed GTK+ version 2.12.1 or newer. GIMP
|
||||
also need a recent versions of GLib (>= 2.16.1) and Pango (>= 1.18.0).
|
||||
Sources for these can be grabbed from ftp://ftp.gtk.org/.
|
||||
|
||||
4. We require PangoFT2, a Pango backend that uses FreeType2. Make
|
||||
5. We require PangoFT2, a Pango backend that uses FreeType2. Make
|
||||
sure you have FreeType2 and fontconfig installed before you
|
||||
compile Pango. FreeType2 can be downloaded from
|
||||
http://www.freetype.org/. Fontconfig from
|
||||
|
@ -48,28 +52,28 @@ header files installed.
|
|||
Older versions are known to have bugs that seriously affect the
|
||||
stability of GIMP.
|
||||
|
||||
5. We use cairo, which is hosted at http://www.cairographics.org/.
|
||||
6. We use cairo, which is hosted at http://www.cairographics.org/.
|
||||
|
||||
6. We use dbus-glib if available. Grab it from
|
||||
7. We use dbus-glib if available. Grab it from
|
||||
http://dbus.freedesktop.org/releases/dbus-glib/
|
||||
|
||||
7. You may want to install other third party libraries or programs
|
||||
8. You may want to install other third party libraries or programs
|
||||
that are needed for some of the available plugins. We recommend
|
||||
to check that the following libraries are installed: libpng,
|
||||
libjpeg, libpoppler, libtiff, webkit, libmng, librsvg, libwmf.
|
||||
|
||||
8. The Python extension requires Python development headers to be
|
||||
9. The Python extension requires Python development headers to be
|
||||
present. You will also need PyGTK and the respective development
|
||||
headers.
|
||||
|
||||
9. Configure GIMP by running the `configure' script. You may want
|
||||
10. Configure GIMP by running the `configure' script. You may want
|
||||
to pass some options to it, see below.
|
||||
|
||||
10. Build GIMP by running `make'. The use of GNU make is recommended.
|
||||
11. Build GIMP by running `make'. The use of GNU make is recommended.
|
||||
If you need to tweak the build to make it work with other flavours
|
||||
of make, we'd appreciate if you'd send us a patch with the changes.
|
||||
|
||||
11. Install GIMP by running `make install'. In order to avoid clashes
|
||||
12. Install GIMP by running `make install'. In order to avoid clashes
|
||||
with other versions of GIMP, we install a binary called gimp-2.5.
|
||||
By default there's also a link created so that you can type 'gimp'
|
||||
to start gimp-2.5.
|
||||
|
@ -226,6 +230,10 @@ These are:
|
|||
gimp-console binary to be built in addition to the standard binary.
|
||||
gimp-console is useful for command-line batch mode or as a server.
|
||||
|
||||
--enable-gimp-remote. Use this option if you want the gimp-remote
|
||||
binary to be built. This only works with X11 and it is obsolete if#
|
||||
your platform has DBus support.
|
||||
|
||||
--disable-python. If for some reason you don't want to build the
|
||||
Python based pygimp plug-in, you can use --disable-python.
|
||||
|
||||
|
|
21
NEWS
21
NEWS
|
@ -7,6 +7,27 @@ This is the unstable development branch of GIMP. Here we are working
|
|||
towards the next stable release, which will be GIMP 2.6.
|
||||
|
||||
|
||||
Changes in GIMP 2.5.2
|
||||
=====================
|
||||
|
||||
- final touches on the combined Freehand/Polygon Select tool
|
||||
- added a dockable dialog for managing Color tool settings
|
||||
- prepared the code for changes in the upcoming GTK+ release
|
||||
- improved popup scale button
|
||||
- mark the center of rectangles/bounding rectangles during moves
|
||||
- added dialog to query for using the online user manual
|
||||
- allow to map dynamics to hardness for the Eraser tool
|
||||
- provide gimp-remote functionality on Windows
|
||||
- disable the build and install of the gimp-remote tool by default
|
||||
- bug fixes and code cleanup
|
||||
|
||||
|
||||
Contributors:
|
||||
|
||||
Sven Neumann, Michael Natterer, Martin Nordholts, Manish Singh,
|
||||
Lars-Peter Clausen, Alexia Death, Tor Lillqvist, Jakub Steiner
|
||||
|
||||
|
||||
Changes in GIMP 2.5.1
|
||||
=====================
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ app_sources = \
|
|||
main.c \
|
||||
sanity.c \
|
||||
sanity.h \
|
||||
unique.c \
|
||||
unique.h \
|
||||
units.c \
|
||||
units.h \
|
||||
version.c \
|
||||
|
|
|
@ -222,7 +222,7 @@ static const GimpStringActionEntry dialogs_toplevel_actions[] =
|
|||
|
||||
{ "dialogs-tips", GIMP_STOCK_INFO,
|
||||
N_("_Tip of the Day"), NULL,
|
||||
N_("Show the tip of the day"),
|
||||
N_("Show some helpful tips on using GIMP"),
|
||||
"gimp-tips-dialog",
|
||||
GIMP_HELP_TIPS_DIALOG },
|
||||
|
||||
|
|
|
@ -988,7 +988,7 @@ layers_edit_layer_response (GtkWidget *widget,
|
|||
{
|
||||
g_object_set (layer,
|
||||
"auto-rename",
|
||||
GTK_TOGGLE_BUTTON (dialog->rename_toggle)->active,
|
||||
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->rename_toggle)),
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -555,12 +555,7 @@ tools_activate_enum_action (const gchar *action_desc,
|
|||
if (GIMP_IS_ENUM_ACTION (action) &&
|
||||
GIMP_ENUM_ACTION (action)->value_variable)
|
||||
{
|
||||
gint old_value;
|
||||
|
||||
old_value = GIMP_ENUM_ACTION (action)->value;
|
||||
GIMP_ENUM_ACTION (action)->value = value;
|
||||
gtk_action_activate (action);
|
||||
GIMP_ENUM_ACTION (action)->value = old_value;
|
||||
gimp_enum_action_selected (GIMP_ENUM_ACTION (action), value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -633,11 +633,11 @@ view_actions_update (GimpActionGroup *group,
|
|||
|
||||
if (shell->canvas)
|
||||
{
|
||||
GimpRGB color;
|
||||
GtkStyle *style = gtk_widget_get_style (shell->canvas);
|
||||
GimpRGB color;
|
||||
|
||||
gtk_widget_ensure_style (shell->canvas);
|
||||
gimp_rgb_set_gdk_color (&color,
|
||||
shell->canvas->style->bg + GTK_STATE_NORMAL);
|
||||
gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL);
|
||||
gimp_rgb_set_alpha (&color, GIMP_OPACITY_OPAQUE);
|
||||
|
||||
SET_COLOR ("view-padding-color-theme", &color);
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
#include <gegl.h>
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
|
@ -64,6 +62,7 @@
|
|||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
/* local prototypes */
|
||||
|
||||
static void app_init_update_none (const gchar *text1,
|
||||
|
|
|
@ -85,53 +85,78 @@ color_balance_create_lookup_tables (ColorBalance *cb)
|
|||
transfer_initialized = TRUE;
|
||||
}
|
||||
|
||||
/* Set the transfer arrays (for speed) */
|
||||
/* Prepare the transfer arrays (for speed) */
|
||||
|
||||
cyan_red_transfer[GIMP_SHADOWS] =
|
||||
(cb->cyan_red[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
|
||||
|
||||
cyan_red_transfer[GIMP_MIDTONES] =
|
||||
(cb->cyan_red[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
|
||||
|
||||
cyan_red_transfer[GIMP_HIGHLIGHTS] =
|
||||
(cb->cyan_red[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
|
||||
|
||||
|
||||
magenta_green_transfer[GIMP_SHADOWS] =
|
||||
(cb->magenta_green[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
|
||||
|
||||
magenta_green_transfer[GIMP_MIDTONES] =
|
||||
(cb->magenta_green[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
|
||||
|
||||
magenta_green_transfer[GIMP_HIGHLIGHTS] =
|
||||
(cb->magenta_green[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
|
||||
|
||||
|
||||
yellow_blue_transfer[GIMP_SHADOWS] =
|
||||
(cb->yellow_blue[GIMP_SHADOWS] > 0) ? shadows_add : shadows_sub;
|
||||
|
||||
yellow_blue_transfer[GIMP_MIDTONES] =
|
||||
(cb->yellow_blue[GIMP_MIDTONES] > 0) ? midtones_add : midtones_sub;
|
||||
|
||||
yellow_blue_transfer[GIMP_HIGHLIGHTS] =
|
||||
(cb->yellow_blue[GIMP_HIGHLIGHTS] > 0) ? highlights_add : highlights_sub;
|
||||
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
r_n = i;
|
||||
g_n = i;
|
||||
b_n = i;
|
||||
|
||||
r_n += cb->cyan_red[GIMP_SHADOWS] * cyan_red_transfer[GIMP_SHADOWS][r_n];
|
||||
r_n = CLAMP0255 (r_n);
|
||||
r_n += cb->cyan_red[GIMP_MIDTONES] * cyan_red_transfer[GIMP_MIDTONES][r_n];
|
||||
r_n = CLAMP0255 (r_n);
|
||||
r_n += cb->cyan_red[GIMP_HIGHLIGHTS] * cyan_red_transfer[GIMP_HIGHLIGHTS][r_n];
|
||||
r_n += (cb->cyan_red[GIMP_SHADOWS] *
|
||||
cyan_red_transfer[GIMP_SHADOWS][r_n]);
|
||||
r_n = CLAMP0255 (r_n);
|
||||
|
||||
g_n += cb->magenta_green[GIMP_SHADOWS] * magenta_green_transfer[GIMP_SHADOWS][g_n];
|
||||
g_n = CLAMP0255 (g_n);
|
||||
g_n += cb->magenta_green[GIMP_MIDTONES] * magenta_green_transfer[GIMP_MIDTONES][g_n];
|
||||
g_n = CLAMP0255 (g_n);
|
||||
g_n += cb->magenta_green[GIMP_HIGHLIGHTS] * magenta_green_transfer[GIMP_HIGHLIGHTS][g_n];
|
||||
r_n += (cb->cyan_red[GIMP_MIDTONES] *
|
||||
cyan_red_transfer[GIMP_MIDTONES][r_n]);
|
||||
r_n = CLAMP0255 (r_n);
|
||||
|
||||
r_n += (cb->cyan_red[GIMP_HIGHLIGHTS] *
|
||||
cyan_red_transfer[GIMP_HIGHLIGHTS][r_n]);
|
||||
r_n = CLAMP0255 (r_n);
|
||||
|
||||
g_n += (cb->magenta_green[GIMP_SHADOWS] *
|
||||
magenta_green_transfer[GIMP_SHADOWS][g_n]);
|
||||
g_n = CLAMP0255 (g_n);
|
||||
|
||||
b_n += cb->yellow_blue[GIMP_SHADOWS] * yellow_blue_transfer[GIMP_SHADOWS][b_n];
|
||||
g_n += (cb->magenta_green[GIMP_MIDTONES] *
|
||||
magenta_green_transfer[GIMP_MIDTONES][g_n]);
|
||||
g_n = CLAMP0255 (g_n);
|
||||
|
||||
g_n += (cb->magenta_green[GIMP_HIGHLIGHTS] *
|
||||
magenta_green_transfer[GIMP_HIGHLIGHTS][g_n]);
|
||||
g_n = CLAMP0255 (g_n);
|
||||
|
||||
b_n += (cb->yellow_blue[GIMP_SHADOWS] *
|
||||
yellow_blue_transfer[GIMP_SHADOWS][b_n]);
|
||||
b_n = CLAMP0255 (b_n);
|
||||
b_n += cb->yellow_blue[GIMP_MIDTONES] * yellow_blue_transfer[GIMP_MIDTONES][b_n];
|
||||
|
||||
b_n += (cb->yellow_blue[GIMP_MIDTONES] *
|
||||
yellow_blue_transfer[GIMP_MIDTONES][b_n]);
|
||||
b_n = CLAMP0255 (b_n);
|
||||
b_n += cb->yellow_blue[GIMP_HIGHLIGHTS] * yellow_blue_transfer[GIMP_HIGHLIGHTS][b_n];
|
||||
|
||||
b_n += (cb->yellow_blue[GIMP_HIGHLIGHTS] *
|
||||
yellow_blue_transfer[GIMP_HIGHLIGHTS][b_n]);
|
||||
b_n = CLAMP0255 (b_n);
|
||||
|
||||
cb->r_lookup[i] = r_n;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "gimp-composite-generic.h"
|
||||
#include "gimp-composite-3dnow.h"
|
||||
|
||||
int
|
||||
static int
|
||||
gimp_composite_3dnow_test (int iterations, int n_pixels)
|
||||
{
|
||||
#if defined(COMPILE_3DNOW_IS_OKAY)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "gimp-composite-generic.h"
|
||||
#include "gimp-composite-altivec.h"
|
||||
|
||||
int
|
||||
static int
|
||||
gimp_composite_altivec_test (int iterations, int n_pixels)
|
||||
{
|
||||
#if defined(COMPILE_ALTIVEC_IS_OKAY)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "gimp-composite-generic.h"
|
||||
#include "gimp-composite-mmx.h"
|
||||
|
||||
int
|
||||
static int
|
||||
gimp_composite_mmx_test (int iterations, int n_pixels)
|
||||
{
|
||||
#if defined(COMPILE_MMX_IS_OKAY)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "gimp-composite-generic.h"
|
||||
#include "gimp-composite-sse.h"
|
||||
|
||||
int
|
||||
static int
|
||||
gimp_composite_sse_test (int iterations, int n_pixels)
|
||||
{
|
||||
#if defined(COMPILE_SSE_IS_OKAY)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "gimp-composite-generic.h"
|
||||
#include "gimp-composite-sse2.h"
|
||||
|
||||
int
|
||||
static int
|
||||
gimp_composite_sse2_test (int iterations, int n_pixels)
|
||||
{
|
||||
#if defined(COMPILE_SSE2_IS_OKAY)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "gimp-composite-util.h"
|
||||
#include "gimp-composite-generic.h"
|
||||
|
||||
int
|
||||
static int
|
||||
gimp_composite_regression(int iterations, int n_pixels)
|
||||
{
|
||||
GimpCompositeContext generic_ctx;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "gimp-composite-generic.h"
|
||||
#include "gimp-composite-vis.h"
|
||||
|
||||
int
|
||||
static int
|
||||
gimp_composite_vis_test (int iterations, int n_pixels)
|
||||
{
|
||||
#if defined(COMPILE_VIS_IS_OKAY)
|
||||
|
|
|
@ -420,8 +420,8 @@ N_("Sets the size of the previews in the Undo History.")
|
|||
N_("When enabled, pressing F1 will open the help browser.")
|
||||
|
||||
#define USER_MANUAL_ONLINE_BLURB \
|
||||
N_("When enabled, the online user manual will be used by the help system. " \
|
||||
"Otherwise the locally installed copy is used.")
|
||||
"When enabled, the online user manual will be used by the help system. " \
|
||||
"Otherwise the locally installed copy is used."
|
||||
|
||||
#define USER_MANUAL_ONLINE_URI_BLURB \
|
||||
"The location of the online user manual. This is used if " \
|
||||
|
|
|
@ -219,11 +219,11 @@ gimp_user_install_detect_old (GimpUserInstall *install)
|
|||
|
||||
migrate = g_file_test (dir, G_FILE_TEST_IS_DIR);
|
||||
|
||||
#ifdef GIMP_UNSTABLE
|
||||
g_printerr ("gimp-user-install: migrating from %s\n", dir);
|
||||
#endif
|
||||
if (migrate)
|
||||
{
|
||||
#ifdef GIMP_UNSTABLE
|
||||
g_printerr ("gimp-user-install: migrating from %s\n", dir);
|
||||
#endif
|
||||
install->old_major = 2;
|
||||
install->old_minor = i;
|
||||
|
||||
|
|
|
@ -766,26 +766,31 @@ gimp_data_make_internal (GimpData *data,
|
|||
}
|
||||
|
||||
/**
|
||||
* gimp_data_name_compare:
|
||||
* gimp_data_compare:
|
||||
* @data1: a #GimpData object.
|
||||
* @data2: another #GimpData object.
|
||||
*
|
||||
* Compares the names of the two objects for use in sorting; see
|
||||
* gimp_object_name_collate() for the method. Objects marked as
|
||||
* "internal" are considered to come before any objects that are not.
|
||||
* Compares two data objects for use in sorting. Objects marked as
|
||||
* "internal" come first, then user-writable objects, then system data
|
||||
* files. In these three groups, the objects are sorted alphabetically
|
||||
* by name, using gimp_object_name_collate().
|
||||
*
|
||||
* Return value: -1 if @data1 compares before @data2,
|
||||
* 0 if they compare equal,
|
||||
* 1 if @data1 compares after @data2.
|
||||
**/
|
||||
gint
|
||||
gimp_data_name_compare (GimpData *data1,
|
||||
GimpData *data2)
|
||||
gimp_data_compare (GimpData *data1,
|
||||
GimpData *data2)
|
||||
{
|
||||
/* move the internal objects (like the FG -> BG) gradient) to the top */
|
||||
if (data1->internal != data2->internal)
|
||||
return data1->internal ? -1 : 1;
|
||||
|
||||
/* keep user-writable objects about system resource files */
|
||||
if (data1->writable != data2->writable)
|
||||
return data1->writable ? -1 : 1;
|
||||
|
||||
return gimp_object_name_collate ((GimpObject *) data1,
|
||||
(GimpObject *) data2);
|
||||
}
|
||||
|
|
|
@ -106,6 +106,8 @@ GimpData * gimp_data_duplicate (GimpData *data);
|
|||
void gimp_data_make_internal (GimpData *data,
|
||||
const gchar *internal_name);
|
||||
|
||||
gint gimp_data_compare (GimpData *data1,
|
||||
GimpData *data2);
|
||||
gint gimp_data_name_compare (GimpData *data1,
|
||||
GimpData *data2);
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ gimp_data_factory_new (Gimp *gimp,
|
|||
const GimpDataFactoryLoaderEntry *loader_entries,
|
||||
gint n_loader_entries,
|
||||
GimpDataNewFunc new_func,
|
||||
GimpDataGetStandardFunc standard_func)
|
||||
GimpDataGetStandardFunc get_standard_func)
|
||||
{
|
||||
GimpDataFactory *factory;
|
||||
|
||||
|
@ -153,7 +153,7 @@ gimp_data_factory_new (Gimp *gimp,
|
|||
factory->gimp = gimp;
|
||||
factory->container = gimp_list_new (data_type, TRUE);
|
||||
gimp_list_set_sort_func (GIMP_LIST (factory->container),
|
||||
(GCompareFunc) gimp_data_name_compare);
|
||||
(GCompareFunc) gimp_data_compare);
|
||||
|
||||
factory->path_property_name = g_strdup (path_property_name);
|
||||
factory->writable_property_name = g_strdup (writable_property_name);
|
||||
|
@ -162,7 +162,7 @@ gimp_data_factory_new (Gimp *gimp,
|
|||
factory->n_loader_entries = n_loader_entries;
|
||||
|
||||
factory->data_new_func = new_func;
|
||||
factory->data_get_standard_func = standard_func;
|
||||
factory->data_get_standard_func = get_standard_func;
|
||||
|
||||
return factory;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ GimpDataFactory * gimp_data_factory_new (Gimp *
|
|||
const GimpDataFactoryLoaderEntry *loader_entries,
|
||||
gint n_loader_entries,
|
||||
GimpDataNewFunc new_func,
|
||||
GimpDataGetStandardFunc standard_func);
|
||||
GimpDataGetStandardFunc get_standard_func);
|
||||
|
||||
void gimp_data_factory_data_init (GimpDataFactory *factory,
|
||||
gboolean no_data);
|
||||
|
|
|
@ -83,7 +83,7 @@ gimp_grid_class_init (GimpGridClass *klass)
|
|||
"style",
|
||||
N_("Line style used for the grid."),
|
||||
GIMP_TYPE_GRID_STYLE,
|
||||
GIMP_GRID_INTERSECTIONS,
|
||||
GIMP_GRID_SOLID,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_FGCOLOR,
|
||||
"fgcolor",
|
||||
|
@ -99,12 +99,12 @@ gimp_grid_class_init (GimpGridClass *klass)
|
|||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_XSPACING,
|
||||
"xspacing",
|
||||
N_("Horizontal spacing of grid lines."),
|
||||
1.0, GIMP_MAX_IMAGE_SIZE, 32.0,
|
||||
1.0, GIMP_MAX_IMAGE_SIZE, 10.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_YSPACING,
|
||||
"yspacing",
|
||||
N_("Vertical spacing of grid lines."),
|
||||
1.0, GIMP_MAX_IMAGE_SIZE, 32.0,
|
||||
1.0, GIMP_MAX_IMAGE_SIZE, 10.0,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
GIMP_CONFIG_INSTALL_PROP_UNIT (object_class, PROP_SPACING_UNIT,
|
||||
"spacing-unit", NULL,
|
||||
|
|
|
@ -26,6 +26,7 @@ BOOLEAN: BOOLEAN
|
|||
BOOLEAN: ENUM, INT
|
||||
BOOLEAN: OBJECT, POINTER
|
||||
BOOLEAN: OBJECT, POINTER, STRING
|
||||
BOOLEAN: STRING
|
||||
|
||||
VOID: BOOLEAN
|
||||
VOID: BOOLEAN, INT, INT, INT, INT
|
||||
|
@ -33,6 +34,7 @@ VOID: BOXED
|
|||
VOID: BOXED, ENUM
|
||||
VOID: DOUBLE
|
||||
VOID: DOUBLE, DOUBLE
|
||||
VOID: DOUBLE, DOUBLE, DOUBLE, DOUBLE
|
||||
VOID: ENUM
|
||||
VOID: ENUM, ENUM, BOXED, INT
|
||||
VOID: ENUM, OBJECT
|
||||
|
|
|
@ -2805,3 +2805,128 @@ gimp_value_take_stringarray (GValue *value,
|
|||
|
||||
g_value_take_boxed (value, array);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GIMP_TYPE_COLOR_ARRAY
|
||||
*/
|
||||
|
||||
GType
|
||||
gimp_color_array_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
type = g_boxed_type_register_static ("GimpColorArray",
|
||||
(GBoxedCopyFunc) gimp_array_copy,
|
||||
(GBoxedFreeFunc) gimp_array_free);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* GIMP_TYPE_PARAM_COLOR_ARRAY
|
||||
*/
|
||||
|
||||
static void gimp_param_color_array_class_init (GParamSpecClass *klass);
|
||||
static void gimp_param_color_array_init (GParamSpec *pspec);
|
||||
|
||||
GType
|
||||
gimp_param_color_array_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (! type)
|
||||
{
|
||||
const GTypeInfo info =
|
||||
{
|
||||
sizeof (GParamSpecClass),
|
||||
NULL, NULL,
|
||||
(GClassInitFunc) gimp_param_color_array_class_init,
|
||||
NULL, NULL,
|
||||
sizeof (GimpParamSpecArray),
|
||||
0,
|
||||
(GInstanceInitFunc) gimp_param_color_array_init
|
||||
};
|
||||
|
||||
type = g_type_register_static (G_TYPE_PARAM_BOXED,
|
||||
"GimpParamColorArray", &info, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_param_color_array_class_init (GParamSpecClass *klass)
|
||||
{
|
||||
klass->value_type = GIMP_TYPE_COLOR_ARRAY;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_param_color_array_init (GParamSpec *pspec)
|
||||
{
|
||||
}
|
||||
|
||||
GParamSpec *
|
||||
gimp_param_spec_color_array (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
GParamFlags flags)
|
||||
{
|
||||
GimpParamSpecColorArray *array_spec;
|
||||
|
||||
array_spec = g_param_spec_internal (GIMP_TYPE_PARAM_COLOR_ARRAY,
|
||||
name, nick, blurb, flags);
|
||||
|
||||
return G_PARAM_SPEC (array_spec);
|
||||
}
|
||||
|
||||
const GimpRGB *
|
||||
gimp_value_get_colorarray (const GValue *value)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value), NULL);
|
||||
|
||||
return (const GimpRGB *) gimp_value_get_array (value);
|
||||
}
|
||||
|
||||
GimpRGB *
|
||||
gimp_value_dup_colorarray (const GValue *value)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value), NULL);
|
||||
|
||||
return (GimpRGB *) gimp_value_dup_array (value);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_value_set_colorarray (GValue *value,
|
||||
const GimpRGB *data,
|
||||
gsize length)
|
||||
{
|
||||
g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
|
||||
|
||||
gimp_value_set_array (value, (const guint8 *) data,
|
||||
length * sizeof (GimpRGB));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_value_set_static_colorarray (GValue *value,
|
||||
const GimpRGB *data,
|
||||
gsize length)
|
||||
{
|
||||
g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
|
||||
|
||||
gimp_value_set_static_array (value, (const guint8 *) data,
|
||||
length * sizeof (GimpRGB));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_value_take_colorarray (GValue *value,
|
||||
GimpRGB *data,
|
||||
gsize length)
|
||||
{
|
||||
g_return_if_fail (GIMP_VALUE_HOLDS_COLOR_ARRAY (value));
|
||||
|
||||
gimp_value_take_array (value, (guint8 *) data,
|
||||
length * sizeof (GimpRGB));
|
||||
}
|
||||
|
|
|
@ -859,4 +859,49 @@ void gimp_value_take_stringarray (GValue *value,
|
|||
gsize length);
|
||||
|
||||
|
||||
/*
|
||||
* GIMP_TYPE_COLOR_ARRAY
|
||||
*/
|
||||
|
||||
#define GIMP_TYPE_COLOR_ARRAY (gimp_color_array_get_type ())
|
||||
#define GIMP_VALUE_HOLDS_COLOR_ARRAY(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GIMP_TYPE_COLOR_ARRAY))
|
||||
|
||||
GType gimp_color_array_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
/*
|
||||
* GIMP_TYPE_PARAM_COLOR_ARRAY
|
||||
*/
|
||||
|
||||
#define GIMP_TYPE_PARAM_COLOR_ARRAY (gimp_param_color_array_get_type ())
|
||||
#define GIMP_PARAM_SPEC_COLOR_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_COLOR_ARRAY, GimpParamSpecColorArray))
|
||||
#define GIMP_IS_PARAM_SPEC_COLOR_ARRAY(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_COLOR_ARRAY))
|
||||
|
||||
typedef struct _GimpParamSpecColorArray GimpParamSpecColorArray;
|
||||
|
||||
struct _GimpParamSpecColorArray
|
||||
{
|
||||
GParamSpecBoxed parent_instance;
|
||||
};
|
||||
|
||||
GType gimp_param_color_array_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GParamSpec * gimp_param_spec_color_array (const gchar *name,
|
||||
const gchar *nick,
|
||||
const gchar *blurb,
|
||||
GParamFlags flags);
|
||||
|
||||
const GimpRGB * gimp_value_get_colorarray (const GValue *value);
|
||||
GimpRGB * gimp_value_dup_colorarray (const GValue *value);
|
||||
void gimp_value_set_colorarray (GValue *value,
|
||||
const GimpRGB *array,
|
||||
gsize length);
|
||||
void gimp_value_set_static_colorarray (GValue *value,
|
||||
const GimpRGB *array,
|
||||
gsize length);
|
||||
void gimp_value_take_colorarray (GValue *value,
|
||||
GimpRGB *array,
|
||||
gsize length);
|
||||
|
||||
|
||||
#endif /* __GIMP_PARAM_SPECS_H__ */
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
|
|
@ -288,14 +288,15 @@ about_dialog_anim_expose (GtkWidget *widget,
|
|||
GdkEventExpose *event,
|
||||
GimpAboutDialog *dialog)
|
||||
{
|
||||
GdkGC *text_gc;
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GdkGC *text_gc;
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
|
||||
if (! dialog->visible)
|
||||
return FALSE;
|
||||
|
||||
text_gc = widget->style->text_gc[GTK_STATE_NORMAL];
|
||||
text_gc = style->text_gc[GTK_STATE_NORMAL];
|
||||
|
||||
pango_layout_get_pixel_size (dialog->layout, &width, &height);
|
||||
|
||||
|
@ -366,6 +367,7 @@ decorate_text (GimpAboutDialog *dialog,
|
|||
gint anim_type,
|
||||
gdouble time)
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style (dialog->anim_area);
|
||||
const gchar *text;
|
||||
const gchar *ptr;
|
||||
gint letter_count = 0;
|
||||
|
@ -379,8 +381,8 @@ decorate_text (GimpAboutDialog *dialog,
|
|||
PangoRectangle lrect = {0, 0, 0, 0};
|
||||
GdkColor mix;
|
||||
|
||||
mix_colors (dialog->anim_area->style->bg + GTK_STATE_NORMAL,
|
||||
dialog->anim_area->style->fg + GTK_STATE_NORMAL, &mix, time);
|
||||
mix_colors (style->bg + GTK_STATE_NORMAL,
|
||||
style->fg + GTK_STATE_NORMAL, &mix, time);
|
||||
|
||||
text = pango_layout_get_text (dialog->layout);
|
||||
g_return_if_fail (text != NULL);
|
||||
|
@ -476,8 +478,8 @@ decorate_text (GimpAboutDialog *dialog,
|
|||
else
|
||||
pos = ((gdouble) (letter_count - border)) / 15;
|
||||
|
||||
mix_colors (dialog->anim_area->style->fg + GTK_STATE_NORMAL,
|
||||
dialog->anim_area->style->bg + GTK_STATE_NORMAL,
|
||||
mix_colors (style->fg + GTK_STATE_NORMAL,
|
||||
style->bg + GTK_STATE_NORMAL,
|
||||
&mix, pos);
|
||||
|
||||
ptr = g_utf8_next_char (ptr);
|
||||
|
|
|
@ -191,7 +191,7 @@ channel_options_opacity_update (GtkAdjustment *adjustment,
|
|||
GimpRGB color;
|
||||
|
||||
gimp_color_button_get_color (GIMP_COLOR_BUTTON (data), &color);
|
||||
gimp_rgb_set_alpha (&color, adjustment->value / 100.0);
|
||||
gimp_rgb_set_alpha (&color, gtk_adjustment_get_value (adjustment) / 100.0);
|
||||
gimp_color_button_set_color (GIMP_COLOR_BUTTON (data), &color);
|
||||
}
|
||||
|
||||
|
|
|
@ -170,6 +170,10 @@ file_open_dialog_response (GtkWidget *open_dialog,
|
|||
|
||||
gtk_widget_destroy (open_dialog);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_file_dialog_set_sensitive (dialog, TRUE);
|
||||
}
|
||||
|
||||
g_slist_foreach (uris, (GFunc) g_free, NULL);
|
||||
g_slist_free (uris);
|
||||
|
|
|
@ -239,7 +239,7 @@ static void
|
|||
layer_options_dialog_toggle_rename (GtkWidget *widget,
|
||||
LayerOptionsDialog *options)
|
||||
{
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active &&
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) &&
|
||||
gimp_drawable_is_text_layer (GIMP_DRAWABLE (options->layer)))
|
||||
{
|
||||
GimpTextLayer *text_layer = GIMP_TEXT_LAYER (options->layer);
|
||||
|
|
|
@ -726,7 +726,8 @@ palette_import_columns_changed (GtkAdjustment *adj,
|
|||
ImportDialog *dialog)
|
||||
{
|
||||
if (dialog->palette)
|
||||
gimp_palette_set_columns (dialog->palette, ROUND (adj->value));
|
||||
gimp_palette_set_columns (dialog->palette,
|
||||
ROUND (gtk_adjustment_get_value (adj)));
|
||||
}
|
||||
|
||||
/* functions & callbacks to keep the import dialog uptodate ****************/
|
||||
|
@ -772,9 +773,9 @@ palette_import_make_palette (ImportDialog *dialog)
|
|||
if (! palette_name || ! strlen (palette_name))
|
||||
palette_name = _("Untitled");
|
||||
|
||||
n_colors = ROUND (dialog->num_colors->value);
|
||||
n_columns = ROUND (dialog->columns->value);
|
||||
threshold = ROUND (dialog->threshold->value);
|
||||
n_colors = ROUND (gtk_adjustment_get_value (dialog->num_colors));
|
||||
n_columns = ROUND (gtk_adjustment_get_value (dialog->columns));
|
||||
threshold = ROUND (gtk_adjustment_get_value (dialog->threshold));
|
||||
|
||||
switch (dialog->import_type)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "widgets/gimpdevices.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
#include "widgets/gimpgrideditor.h"
|
||||
#include "widgets/gimphelp.h"
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpmessagebox.h"
|
||||
#include "widgets/gimpmessagedialog.h"
|
||||
|
@ -437,7 +438,7 @@ prefs_resolution_source_callback (GtkWidget *widget,
|
|||
|
||||
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
|
||||
|
||||
from_gdk = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
from_gdk = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
|
||||
|
||||
if (from_gdk)
|
||||
{
|
||||
|
@ -1798,15 +1799,49 @@ prefs_dialog_new (Gimp *gimp,
|
|||
GTK_BOX (vbox2));
|
||||
|
||||
{
|
||||
GtkWidget *combo;
|
||||
GtkWidget *combo;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
const gchar *icon;
|
||||
const gchar *text;
|
||||
|
||||
table = prefs_table_new (1, GTK_CONTAINER (vbox2));
|
||||
table = prefs_table_new (2, GTK_CONTAINER (vbox2));
|
||||
combo = prefs_boolean_combo_box_add (object, "user-manual-online",
|
||||
_("Use the online version"),
|
||||
_("Use a locally installed copy"),
|
||||
_("User manual:"),
|
||||
GTK_TABLE (table), 0, size_group);
|
||||
gimp_help_set_help_data (combo, NULL, NULL);
|
||||
|
||||
if (gimp_help_user_manual_is_installed (gimp))
|
||||
{
|
||||
icon = GIMP_STOCK_INFO;
|
||||
text = _("There's a local installation of the user manual.");
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = GIMP_STOCK_WARNING;
|
||||
text = _("The user manual is not installed locally.");
|
||||
}
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), hbox, 1, 2, 1, 2);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
image = gtk_image_new_from_stock (icon, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
||||
gtk_widget_show (image);
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gimp_label_set_attributes (GTK_LABEL (label),
|
||||
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
||||
-1);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
|
||||
/* Help Browser */
|
||||
|
|
|
@ -45,6 +45,7 @@ libappdisplay_a_sources = \
|
|||
gimpdisplayshell-icon.h \
|
||||
gimpdisplayshell-preview.c \
|
||||
gimpdisplayshell-preview.h \
|
||||
gimpdisplayshell-private.h \
|
||||
gimpdisplayshell-progress.c \
|
||||
gimpdisplayshell-progress.h \
|
||||
gimpdisplayshell-render.c \
|
||||
|
|
|
@ -828,6 +828,7 @@ gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
|
|||
cairo_t *cr)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (canvas);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
gdouble wilber_width;
|
||||
gdouble wilber_height;
|
||||
gdouble width;
|
||||
|
@ -857,9 +858,9 @@ gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
|
|||
widget->allocation.height / factor - wilber_height * 1.1);
|
||||
|
||||
cairo_set_source_rgba (cr,
|
||||
widget->style->fg[widget->state].red / 65535.0,
|
||||
widget->style->fg[widget->state].green / 65535.0,
|
||||
widget->style->fg[widget->state].blue / 65535.0,
|
||||
style->fg[widget->state].red / 65535.0,
|
||||
style->fg[widget->state].green / 65535.0,
|
||||
style->fg[widget->state].blue / 65535.0,
|
||||
0.15);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ gimp_display_shell_set_show_rulers (GimpDisplayShell *shell,
|
|||
|
||||
g_object_set (options, "show-rulers", show, NULL);
|
||||
|
||||
table = GTK_TABLE (GTK_WIDGET (shell->canvas)->parent);
|
||||
table = GTK_TABLE (gtk_widget_get_parent (GTK_WIDGET (shell->canvas)));
|
||||
|
||||
if (show)
|
||||
{
|
||||
|
@ -220,6 +220,7 @@ gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
|
|||
gboolean show)
|
||||
{
|
||||
GimpDisplayOptions *options;
|
||||
GtkWidget *parent;
|
||||
GtkBox *hbox;
|
||||
GtkBox *vbox;
|
||||
|
||||
|
@ -229,8 +230,11 @@ gimp_display_shell_set_show_scrollbars (GimpDisplayShell *shell,
|
|||
|
||||
g_object_set (options, "show-scrollbars", show, NULL);
|
||||
|
||||
hbox = GTK_BOX (shell->vsb->parent->parent);
|
||||
vbox = GTK_BOX (shell->hsb->parent->parent);
|
||||
parent = gtk_widget_get_parent (shell->vsb);
|
||||
hbox = GTK_BOX (gtk_widget_get_parent (parent));
|
||||
|
||||
parent = gtk_widget_get_parent (shell->hsb);
|
||||
vbox = GTK_BOX (gtk_widget_get_parent (parent));
|
||||
|
||||
if (show)
|
||||
{
|
||||
|
@ -585,9 +589,13 @@ gimp_display_shell_set_padding (GimpDisplayShell *shell,
|
|||
case GIMP_CANVAS_PADDING_MODE_DEFAULT:
|
||||
if (shell->canvas)
|
||||
{
|
||||
GtkStyle *style;
|
||||
|
||||
gtk_widget_ensure_style (shell->canvas);
|
||||
gimp_rgb_set_gdk_color (&color,
|
||||
shell->canvas->style->bg + GTK_STATE_NORMAL);
|
||||
|
||||
style = gtk_widget_get_style (shell->canvas);
|
||||
|
||||
gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-autoscroll.h"
|
||||
#include "gimpdisplayshell-coords.h"
|
||||
#include "gimpdisplayshell-private.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
#include "gimpdisplayshell-transform.h"
|
||||
|
||||
|
@ -135,9 +136,9 @@ gimp_display_shell_autoscroll_timeout (gpointer data)
|
|||
|
||||
info->time += AUTOSCROLL_DT;
|
||||
|
||||
gimp_display_shell_scroll (shell,
|
||||
AUTOSCROLL_DX * (gdouble) dx,
|
||||
AUTOSCROLL_DX * (gdouble) dy);
|
||||
gimp_display_shell_scroll_private (shell,
|
||||
AUTOSCROLL_DX * (gdouble) dx,
|
||||
AUTOSCROLL_DX * (gdouble) dy);
|
||||
|
||||
gimp_display_shell_untransform_coordinate (shell,
|
||||
&device_coords,
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "gimpdisplayshell-draw.h"
|
||||
#include "gimpdisplayshell-layer-select.h"
|
||||
#include "gimpdisplayshell-preview.h"
|
||||
#include "gimpdisplayshell-private.h"
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
#include "gimpdisplayshell-selection.h"
|
||||
|
@ -84,7 +85,15 @@ static void gimp_display_shell_vscrollbar_update (GtkAdjustment *
|
|||
GimpDisplayShell *shell);
|
||||
static void gimp_display_shell_hscrollbar_update (GtkAdjustment *adjustment,
|
||||
GimpDisplayShell *shell);
|
||||
static gboolean gimp_display_shell_vscrollbar_update_range (GtkRange *range,
|
||||
GtkScrollType scroll,
|
||||
gdouble value,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
static gboolean gimp_display_shell_hscrollbar_update_range (GtkRange *range,
|
||||
GtkScrollType scroll,
|
||||
gdouble value,
|
||||
GimpDisplayShell *shell);
|
||||
static GdkModifierType
|
||||
gimp_display_shell_key_to_state (gint key);
|
||||
|
||||
|
@ -175,11 +184,7 @@ gimp_display_shell_events (GtkWidget *widget,
|
|||
case GDK_KP_Enter:
|
||||
case GDK_ISO_Enter:
|
||||
case GDK_BackSpace:
|
||||
break;
|
||||
|
||||
case GDK_Escape:
|
||||
if (event->type == GDK_KEY_PRESS)
|
||||
gimp_display_shell_set_fullscreen (shell, FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -242,6 +247,14 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas,
|
|||
G_CALLBACK (gimp_display_shell_vscrollbar_update),
|
||||
shell);
|
||||
|
||||
g_signal_connect (shell->hsb, "change-value",
|
||||
G_CALLBACK (gimp_display_shell_hscrollbar_update_range),
|
||||
shell);
|
||||
|
||||
g_signal_connect (shell->vsb, "change-value",
|
||||
G_CALLBACK (gimp_display_shell_vscrollbar_update_range),
|
||||
shell);
|
||||
|
||||
/* allow shrinking */
|
||||
gtk_widget_set_size_request (GTK_WIDGET (shell), 0, 0);
|
||||
|
||||
|
@ -327,6 +340,52 @@ gimp_display_shell_canvas_expose (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_display_shell_hscrollbar_update_range (GtkRange *range,
|
||||
GtkScrollType scroll,
|
||||
gdouble value,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), TRUE);
|
||||
|
||||
if (! shell->display)
|
||||
return TRUE;
|
||||
|
||||
if ((scroll == GTK_SCROLL_JUMP) ||
|
||||
(scroll == GTK_SCROLL_PAGE_BACKWARD) ||
|
||||
(scroll == GTK_SCROLL_PAGE_FORWARD))
|
||||
return FALSE;
|
||||
|
||||
gimp_display_shell_setup_hscrollbar_with_value (shell, value);
|
||||
|
||||
gtk_adjustment_changed (shell->hsbdata);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_display_shell_vscrollbar_update_range (GtkRange *range,
|
||||
GtkScrollType scroll,
|
||||
gdouble value,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), TRUE);
|
||||
|
||||
if (! shell->display)
|
||||
return TRUE;
|
||||
|
||||
if ((scroll == GTK_SCROLL_JUMP) ||
|
||||
(scroll == GTK_SCROLL_PAGE_BACKWARD) ||
|
||||
(scroll == GTK_SCROLL_PAGE_FORWARD))
|
||||
return FALSE;
|
||||
|
||||
gimp_display_shell_setup_vscrollbar_with_value (shell, value);
|
||||
|
||||
gtk_adjustment_changed (shell->vsbdata);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_check_device_cursor (GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -987,10 +1046,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
break;
|
||||
}
|
||||
|
||||
value = adj->value + ((direction == GDK_SCROLL_UP ||
|
||||
direction == GDK_SCROLL_LEFT) ?
|
||||
-adj->page_increment / 2 :
|
||||
adj->page_increment / 2);
|
||||
value = (gtk_adjustment_get_value (adj) +
|
||||
((direction == GDK_SCROLL_UP ||
|
||||
direction == GDK_SCROLL_LEFT) ?
|
||||
-adj->page_increment / 2 :
|
||||
adj->page_increment / 2));
|
||||
value = CLAMP (value, adj->lower, adj->upper - adj->page_size);
|
||||
|
||||
gtk_adjustment_set_value (adj, value);
|
||||
|
@ -1096,11 +1156,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
|||
|
||||
if (shell->scrolling)
|
||||
{
|
||||
gimp_display_shell_scroll (shell,
|
||||
(shell->scroll_start_x - mevent->x -
|
||||
shell->offset_x),
|
||||
(shell->scroll_start_y - mevent->y -
|
||||
shell->offset_y));
|
||||
gimp_display_shell_scroll_private (shell,
|
||||
(shell->scroll_start_x - mevent->x -
|
||||
shell->offset_x),
|
||||
(shell->scroll_start_y - mevent->y -
|
||||
shell->offset_y));
|
||||
}
|
||||
else if (state & GDK_BUTTON1_MASK)
|
||||
{
|
||||
|
@ -1651,14 +1711,20 @@ static void
|
|||
gimp_display_shell_vscrollbar_update (GtkAdjustment *adjustment,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
gimp_display_shell_scroll (shell, 0, (adjustment->value - shell->offset_y));
|
||||
gimp_display_shell_scroll_private (shell,
|
||||
0,
|
||||
gtk_adjustment_get_value (adjustment) -
|
||||
shell->offset_y);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_hscrollbar_update (GtkAdjustment *adjustment,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
gimp_display_shell_scroll (shell, (adjustment->value - shell->offset_x), 0);
|
||||
gimp_display_shell_scroll_private (shell,
|
||||
gtk_adjustment_get_value (adjustment) -
|
||||
shell->offset_x,
|
||||
0);
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
|
|
|
@ -90,7 +90,19 @@ gimp_display_shell_close (GimpDisplayShell *shell,
|
|||
image->dirty &&
|
||||
shell->display->config->confirm_on_close)
|
||||
{
|
||||
gimp_display_shell_close_dialog (shell, image);
|
||||
/* If there's a save dialog active for this image, then raise it.
|
||||
* (see bug #511965)
|
||||
*/
|
||||
GtkWidget *dialog = g_object_get_data (G_OBJECT (image),
|
||||
"gimp-file-save-dialog");
|
||||
if (dialog)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_display_shell_close_dialog (shell, image);
|
||||
}
|
||||
}
|
||||
else if (image)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "gimpdisplayshell-appearance.h"
|
||||
#include "gimpdisplayshell-draw.h"
|
||||
#include "gimpdisplayshell-render.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
#include "gimpdisplayshell-transform.h"
|
||||
|
||||
|
||||
|
@ -511,35 +512,16 @@ gimp_display_shell_draw_area (GimpDisplayShell *shell,
|
|||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpProjection *proj;
|
||||
TileManager *tiles;
|
||||
gint level;
|
||||
gint level_width;
|
||||
gint level_height;
|
||||
gint sx, sy;
|
||||
gint sw, sh;
|
||||
gint sx, sy;
|
||||
gint sw, sh;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (! shell->display->image)
|
||||
return;
|
||||
|
||||
proj = shell->display->image->projection;
|
||||
|
||||
level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
|
||||
|
||||
tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
|
||||
|
||||
level_width = tile_manager_width (tiles);
|
||||
level_height = tile_manager_height (tiles);
|
||||
|
||||
/* the image's size in display coordinates */
|
||||
sx = shell->disp_xoffset - shell->offset_x;
|
||||
sy = shell->disp_yoffset - shell->offset_y;
|
||||
|
||||
/* SCALE[XY] with pyramid level taken into account. */
|
||||
sw = PROJ_ROUND (level_width * (shell->scale_x * (1 << level)));
|
||||
sh = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell, &sx, &sy);
|
||||
gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
|
||||
|
||||
/* check if the passed in area intersects with
|
||||
* both the display and the image
|
||||
|
@ -574,14 +556,19 @@ gimp_display_shell_draw_area (GimpDisplayShell *shell,
|
|||
{
|
||||
for (j = x; j < x2; j += GIMP_DISPLAY_RENDER_BUF_WIDTH)
|
||||
{
|
||||
gint disp_xoffset, disp_yoffset;
|
||||
gint dx, dy;
|
||||
|
||||
dx = MIN (x2 - j, GIMP_DISPLAY_RENDER_BUF_WIDTH);
|
||||
dy = MIN (y2 - i, GIMP_DISPLAY_RENDER_BUF_HEIGHT);
|
||||
|
||||
gimp_display_shell_get_disp_offset (shell,
|
||||
&disp_xoffset,
|
||||
&disp_yoffset);
|
||||
|
||||
gimp_display_shell_render (shell,
|
||||
j - shell->disp_xoffset,
|
||||
i - shell->disp_yoffset,
|
||||
j - disp_xoffset,
|
||||
i - disp_yoffset,
|
||||
dx, dy,
|
||||
shell->highlight ? &rect : NULL);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (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
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DISPLAY_SHELL_PRIVATE_H__
|
||||
#define __GIMP_DISPLAY_SHELL_PRIVATE_H__
|
||||
|
||||
|
||||
void gimp_display_shell_scroll_private (GimpDisplayShell *shell,
|
||||
gint x_offset,
|
||||
gint y_offset);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_SHELL_PRIVATE_H__ */
|
|
@ -144,12 +144,17 @@ gimp_display_shell_progress_message (GimpProgress *progress,
|
|||
/* warning messages go to the statusbar, if it's visible */
|
||||
if (! gimp_statusbar_get_visible (GIMP_STATUSBAR (shell->statusbar)))
|
||||
break;
|
||||
/* else fallthrough */
|
||||
else
|
||||
return gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
|
||||
severity, domain, message);
|
||||
|
||||
case GIMP_MESSAGE_INFO:
|
||||
/* info messages go to the statusbar, no matter if it's visible or not */
|
||||
return gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
|
||||
severity, domain, message);
|
||||
/* info messages go to the statusbar;
|
||||
* if they are not handled there, they are swallowed
|
||||
*/
|
||||
gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
|
||||
severity, domain, message);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-filter.h"
|
||||
#include "gimpdisplayshell-render.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
|
||||
#define GIMP_DISPLAY_ZOOM_FAST (1 << 0) /* use the fastest possible code
|
||||
path trading quality for speed
|
||||
|
@ -223,6 +224,8 @@ gimp_display_shell_render (GimpDisplayShell *shell,
|
|||
GimpImage *image;
|
||||
RenderInfo info;
|
||||
GimpImageType type;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (w > 0 && h > 0);
|
||||
|
@ -230,13 +233,15 @@ gimp_display_shell_render (GimpDisplayShell *shell,
|
|||
image = shell->display->image;
|
||||
projection = image->projection;
|
||||
|
||||
gimp_display_shell_get_render_start_offset (shell, &offset_x, &offset_y);
|
||||
|
||||
/* Initialize RenderInfo with values that don't change during the
|
||||
* call of this function.
|
||||
*/
|
||||
info.shell = shell;
|
||||
|
||||
info.x = x + shell->offset_x;
|
||||
info.y = y + shell->offset_y;
|
||||
info.x = x + offset_x;
|
||||
info.y = y + offset_y;
|
||||
info.w = w;
|
||||
info.h = h;
|
||||
|
||||
|
@ -310,12 +315,20 @@ gimp_display_shell_render (GimpDisplayShell *shell,
|
|||
}
|
||||
|
||||
/* put it to the screen */
|
||||
gimp_canvas_draw_rgb (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_RENDER,
|
||||
x + shell->disp_xoffset, y + shell->disp_yoffset,
|
||||
{
|
||||
gint disp_xoffset, disp_yoffset;
|
||||
gint offset_x, offset_y;
|
||||
|
||||
gimp_display_shell_get_disp_offset (shell, &disp_xoffset, &disp_yoffset);
|
||||
gimp_display_shell_get_render_start_offset (shell, &offset_x, &offset_y);
|
||||
|
||||
gimp_canvas_draw_rgb (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_RENDER,
|
||||
x + disp_xoffset, y + disp_yoffset,
|
||||
w, h,
|
||||
shell->render_buf,
|
||||
3 * GIMP_DISPLAY_RENDER_BUF_WIDTH,
|
||||
shell->offset_x, shell->offset_y);
|
||||
offset_x, offset_y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -338,16 +351,20 @@ gimp_display_shell_render_highlight (GimpDisplayShell *shell,
|
|||
{
|
||||
guchar *buf = shell->render_buf;
|
||||
GdkRectangle rect;
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
rect.x = shell->offset_x + x;
|
||||
rect.y = shell->offset_y + y;
|
||||
gimp_display_shell_get_render_start_offset (shell, &offset_x, &offset_y);
|
||||
|
||||
rect.x = x + offset_x;
|
||||
rect.y = y + offset_y;
|
||||
rect.width = w;
|
||||
rect.height = h;
|
||||
|
||||
if (gdk_rectangle_intersect (highlight, &rect, &rect))
|
||||
{
|
||||
rect.x -= shell->offset_x + x;
|
||||
rect.y -= shell->offset_y + y;
|
||||
rect.x -= x + offset_x;
|
||||
rect.y -= y + offset_y;
|
||||
|
||||
for (y = 0; y < rect.y; y++)
|
||||
{
|
||||
|
|
|
@ -89,10 +89,7 @@ void
|
|||
gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
gdouble lower;
|
||||
gdouble upper;
|
||||
gdouble max_size;
|
||||
gfloat sx, sy;
|
||||
gfloat sw, sh;
|
||||
gint image_width;
|
||||
gint image_height;
|
||||
|
||||
|
@ -108,126 +105,113 @@ gimp_display_shell_scale_setup (GimpDisplayShell *shell)
|
|||
image_width = gimp_image_get_width (image);
|
||||
image_height = gimp_image_get_height (image);
|
||||
|
||||
sx = SCALEX (shell, image_width);
|
||||
sy = SCALEY (shell, image_height);
|
||||
sw = SCALEX (shell, image_width);
|
||||
sh = SCALEY (shell, image_height);
|
||||
}
|
||||
else
|
||||
{
|
||||
image_width = shell->disp_width;
|
||||
image_height = shell->disp_height;
|
||||
|
||||
sx = image_width;
|
||||
sy = image_height;
|
||||
sw = image_width;
|
||||
sh = image_height;
|
||||
}
|
||||
|
||||
|
||||
/* Horizontal scrollbar */
|
||||
|
||||
shell->hsbdata->value = shell->offset_x;
|
||||
shell->hsbdata->upper = sx;
|
||||
shell->hsbdata->page_size = MIN (sx, shell->disp_width);
|
||||
shell->hsbdata->page_size = shell->disp_width;
|
||||
shell->hsbdata->page_increment = shell->disp_width / 2;
|
||||
shell->hsbdata->step_increment = shell->scale_x;
|
||||
|
||||
gimp_display_shell_setup_hscrollbar_with_value (shell, shell->offset_x);
|
||||
|
||||
gtk_adjustment_changed (shell->hsbdata);
|
||||
|
||||
|
||||
/* Vertcal scrollbar */
|
||||
|
||||
shell->vsbdata->value = shell->offset_y;
|
||||
shell->vsbdata->upper = sy;
|
||||
shell->vsbdata->page_size = MIN (sy, shell->disp_height);
|
||||
shell->vsbdata->page_size = shell->disp_height;
|
||||
shell->vsbdata->page_increment = shell->disp_height / 2;
|
||||
shell->vsbdata->step_increment = shell->scale_y;
|
||||
|
||||
gtk_adjustment_changed (shell->hsbdata);
|
||||
gimp_display_shell_setup_vscrollbar_with_value (shell, shell->offset_y);
|
||||
|
||||
gtk_adjustment_changed (shell->vsbdata);
|
||||
|
||||
/* horizontal ruler */
|
||||
|
||||
lower = 0;
|
||||
/* Setup rulers */
|
||||
{
|
||||
gdouble horizontal_lower;
|
||||
gdouble horizontal_upper;
|
||||
gdouble horizontal_max_size;
|
||||
gdouble vertical_lower;
|
||||
gdouble vertical_upper;
|
||||
gdouble vertical_max_size;
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
|
||||
if (image)
|
||||
{
|
||||
upper = img2real (shell, TRUE, FUNSCALEX (shell, shell->disp_width));
|
||||
max_size = img2real (shell, TRUE, MAX (image_width, image_height));
|
||||
}
|
||||
else
|
||||
{
|
||||
upper = image_width;
|
||||
max_size = MAX (image_width, image_height);
|
||||
}
|
||||
|
||||
if (image && sx < shell->disp_width)
|
||||
{
|
||||
shell->disp_xoffset = (shell->disp_width - sx) / 2;
|
||||
/* Initialize values */
|
||||
|
||||
lower -= img2real (shell, TRUE,
|
||||
FUNSCALEX (shell, (gdouble) shell->disp_xoffset));
|
||||
upper -= img2real (shell, TRUE,
|
||||
FUNSCALEX (shell, (gdouble) shell->disp_xoffset));
|
||||
}
|
||||
else if (image)
|
||||
{
|
||||
shell->disp_xoffset = 0;
|
||||
horizontal_lower = 0;
|
||||
vertical_lower = 0;
|
||||
|
||||
lower += img2real (shell, TRUE,
|
||||
FUNSCALEX (shell, (gdouble) shell->offset_x));
|
||||
upper += img2real (shell, TRUE,
|
||||
FUNSCALEX (shell, (gdouble) shell->offset_x));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->disp_xoffset = 0;
|
||||
}
|
||||
if (image)
|
||||
{
|
||||
horizontal_upper = img2real (shell, TRUE, FUNSCALEX (shell, shell->disp_width));
|
||||
horizontal_max_size = img2real (shell, TRUE, MAX (image_width, image_height));
|
||||
|
||||
gimp_ruler_set_range (GIMP_RULER (shell->hrule), lower, upper, max_size);
|
||||
gimp_ruler_set_unit (GIMP_RULER (shell->hrule), shell->unit);
|
||||
vertical_upper = img2real (shell, FALSE, FUNSCALEY (shell, shell->disp_height));
|
||||
vertical_max_size = img2real (shell, FALSE, MAX (image_width, image_height));
|
||||
}
|
||||
else
|
||||
{
|
||||
horizontal_upper = image_width;
|
||||
horizontal_max_size = MAX (image_width, image_height);
|
||||
|
||||
/* vertical ruler */
|
||||
vertical_upper = image_height;
|
||||
vertical_max_size = MAX (image_width, image_height);
|
||||
}
|
||||
|
||||
lower = 0;
|
||||
|
||||
if (image)
|
||||
{
|
||||
upper = img2real (shell, FALSE, FUNSCALEY (shell, shell->disp_height));
|
||||
max_size = img2real (shell, FALSE, MAX (image_width, image_height));
|
||||
}
|
||||
else
|
||||
{
|
||||
upper = image_height;
|
||||
max_size = MAX (image_width, image_height);
|
||||
}
|
||||
/* Adjust due to scrolling */
|
||||
|
||||
if (image && sy < shell->disp_height)
|
||||
{
|
||||
shell->disp_yoffset = (shell->disp_height - sy) / 2;
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
|
||||
lower -= img2real (shell, FALSE,
|
||||
FUNSCALEY (shell, (gdouble) shell->disp_yoffset));
|
||||
upper -= img2real (shell, FALSE,
|
||||
FUNSCALEY (shell, (gdouble) shell->disp_yoffset));
|
||||
}
|
||||
else if (image)
|
||||
{
|
||||
shell->disp_yoffset = 0;
|
||||
horizontal_lower -= img2real (shell, TRUE,
|
||||
FUNSCALEX (shell, (gdouble) scaled_image_viewport_offset_x));
|
||||
horizontal_upper -= img2real (shell, TRUE,
|
||||
FUNSCALEX (shell, (gdouble) scaled_image_viewport_offset_x));
|
||||
|
||||
lower += img2real (shell, FALSE,
|
||||
FUNSCALEY (shell, (gdouble) shell->offset_y));
|
||||
upper += img2real (shell, FALSE,
|
||||
FUNSCALEY (shell, (gdouble) shell->offset_y));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->disp_yoffset = 0;
|
||||
}
|
||||
vertical_lower -= img2real (shell, FALSE,
|
||||
FUNSCALEY (shell, (gdouble) scaled_image_viewport_offset_y));
|
||||
vertical_upper -= img2real (shell, FALSE,
|
||||
FUNSCALEY (shell, (gdouble) scaled_image_viewport_offset_y));
|
||||
|
||||
gimp_ruler_set_range (GIMP_RULER (shell->vrule), lower, upper, max_size);
|
||||
gimp_ruler_set_unit (GIMP_RULER (shell->vrule), shell->unit);
|
||||
|
||||
#if 0
|
||||
g_printerr ("offset_x: %d\n"
|
||||
"offset_y: %d\n"
|
||||
"disp_width: %d\n"
|
||||
"disp_height: %d\n"
|
||||
"disp_xoffset: %d\n"
|
||||
"disp_yoffset: %d\n\n",
|
||||
shell->offset_x, shell->offset_y,
|
||||
shell->disp_width, shell->disp_height,
|
||||
shell->disp_xoffset, shell->disp_yoffset);
|
||||
#endif
|
||||
/* Finally setup the actual rulers */
|
||||
|
||||
gimp_ruler_set_range (GIMP_RULER (shell->hrule),
|
||||
horizontal_lower,
|
||||
horizontal_upper,
|
||||
horizontal_max_size);
|
||||
|
||||
gimp_ruler_set_unit (GIMP_RULER (shell->hrule),
|
||||
shell->unit);
|
||||
|
||||
gimp_ruler_set_range (GIMP_RULER (shell->vrule),
|
||||
vertical_lower,
|
||||
vertical_upper,
|
||||
vertical_max_size);
|
||||
|
||||
gimp_ruler_set_unit (GIMP_RULER (shell->vrule),
|
||||
shell->unit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,24 +26,61 @@
|
|||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "base/tile-manager.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplay-foreach.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-private.h"
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
|
||||
|
||||
gboolean
|
||||
gimp_display_shell_scroll (GimpDisplayShell *shell,
|
||||
gint x_offset,
|
||||
gint y_offset)
|
||||
#define OVERPAN_FACTOR 0.5
|
||||
|
||||
|
||||
/**
|
||||
* gimp_display_shell_center_around_image_coordinate:
|
||||
* @shell:
|
||||
* @image_x:
|
||||
* @image_y:
|
||||
*
|
||||
* Center the viewport around the passed image coordinate
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_center_around_image_coordinate (GimpDisplayShell *shell,
|
||||
gdouble image_x,
|
||||
gdouble image_y)
|
||||
{
|
||||
gint scaled_image_x;
|
||||
gint scaled_image_y;
|
||||
gint offset_to_apply_x;
|
||||
gint offset_to_apply_y;
|
||||
|
||||
scaled_image_x = RINT (image_x * shell->scale_x);
|
||||
scaled_image_y = RINT (image_y * shell->scale_y);
|
||||
|
||||
offset_to_apply_x = scaled_image_x - shell->disp_width / 2 - shell->offset_x;
|
||||
offset_to_apply_y = scaled_image_y - shell->disp_height / 2 - shell->offset_y;
|
||||
|
||||
gimp_display_shell_scroll_private (shell,
|
||||
offset_to_apply_x,
|
||||
offset_to_apply_y);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_scroll_private (GimpDisplayShell *shell,
|
||||
gint x_offset,
|
||||
gint y_offset)
|
||||
{
|
||||
gint old_x;
|
||||
gint old_y;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
old_x = shell->offset_x;
|
||||
old_y = shell->offset_y;
|
||||
|
@ -80,11 +117,7 @@ gimp_display_shell_scroll (GimpDisplayShell *shell,
|
|||
gimp_display_shell_resume (shell);
|
||||
|
||||
gimp_display_shell_scrolled (shell);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -94,16 +127,47 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
|
|||
|
||||
if (shell->display->image)
|
||||
{
|
||||
gint sx, sy;
|
||||
gint sw, sh;
|
||||
gint min_offset_x;
|
||||
gint max_offset_x;
|
||||
gint min_offset_y;
|
||||
gint max_offset_y;
|
||||
|
||||
sx = SCALEX (shell, gimp_image_get_width (shell->display->image));
|
||||
sy = SCALEY (shell, gimp_image_get_height (shell->display->image));
|
||||
sw = SCALEX (shell, gimp_image_get_width (shell->display->image));
|
||||
sh = SCALEY (shell, gimp_image_get_height (shell->display->image));
|
||||
|
||||
shell->offset_x = CLAMP (shell->offset_x, 0,
|
||||
MAX (sx - shell->disp_width, 0));
|
||||
if (shell->disp_width < sw)
|
||||
{
|
||||
min_offset_x = 0 - shell->disp_width * OVERPAN_FACTOR;
|
||||
max_offset_x = sw - shell->disp_width * (1.0 - OVERPAN_FACTOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
gint overpan_amount;
|
||||
|
||||
shell->offset_y = CLAMP (shell->offset_y, 0,
|
||||
MAX (sy - shell->disp_height, 0));
|
||||
overpan_amount = shell->disp_width - sw * (1.0 - OVERPAN_FACTOR);
|
||||
|
||||
min_offset_x = 0 - overpan_amount;
|
||||
max_offset_x = sw + overpan_amount - shell->disp_width;
|
||||
}
|
||||
|
||||
if (shell->disp_height < sh)
|
||||
{
|
||||
min_offset_y = 0 - shell->disp_height * OVERPAN_FACTOR;
|
||||
max_offset_y = sh - shell->disp_height * (1.0 - OVERPAN_FACTOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
gint overpan_amount;
|
||||
|
||||
overpan_amount = shell->disp_height - sh * (1.0 - OVERPAN_FACTOR);
|
||||
|
||||
min_offset_y = 0 - overpan_amount;
|
||||
max_offset_y = sh + overpan_amount - shell->disp_height;
|
||||
}
|
||||
|
||||
shell->offset_x = CLAMP (shell->offset_x, min_offset_x, max_offset_x);
|
||||
shell->offset_y = CLAMP (shell->offset_y, min_offset_y, max_offset_y);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,3 +175,261 @@ gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell)
|
|||
shell->offset_y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_get_scaled_viewport:
|
||||
* @shell:
|
||||
* @x:
|
||||
* @y:
|
||||
* @w:
|
||||
* @h:
|
||||
*
|
||||
* Gets the viewport in screen coordinates, with origin at (0, 0) in
|
||||
* the image
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *w,
|
||||
gint *h)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
if (x) *x = -scaled_image_viewport_offset_x;
|
||||
if (y) *y = -scaled_image_viewport_offset_y;
|
||||
if (w) *w = shell->disp_width;
|
||||
if (h) *h = shell->disp_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_get_viewport:
|
||||
* @shell:
|
||||
* @x:
|
||||
* @y:
|
||||
* @w:
|
||||
* @h:
|
||||
*
|
||||
* Gets the viewport in image coordinates
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_get_viewport (const GimpDisplayShell *shell,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *w,
|
||||
gdouble *h)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (x) *x = shell->offset_x / shell->scale_x;
|
||||
if (y) *y = shell->offset_y / shell->scale_y;
|
||||
if (w) *w = shell->disp_width / shell->scale_x;
|
||||
if (h) *h = shell->disp_height / shell->scale_y;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_get_scaled_image_viewport_offset:
|
||||
* @shell:
|
||||
* @x:
|
||||
* @y:
|
||||
*
|
||||
* Gets the scaled image offset in viewport coordinates
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (const GimpDisplayShell *shell,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (x) *x = -shell->offset_x;
|
||||
if (y) *y = -shell->offset_y;
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_get_scaled_image_size:
|
||||
* @shell:
|
||||
* @w:
|
||||
* @h:
|
||||
*
|
||||
* Gets the size of the rendered image after it has been scaled.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_get_scaled_image_size (const GimpDisplayShell *shell,
|
||||
gint *w,
|
||||
gint *h)
|
||||
{
|
||||
GimpProjection *proj;
|
||||
TileManager *tiles;
|
||||
gint level;
|
||||
gint level_width;
|
||||
gint level_height;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
|
||||
|
||||
proj = shell->display->image->projection;
|
||||
|
||||
level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
|
||||
|
||||
tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
|
||||
|
||||
level_width = tile_manager_width (tiles);
|
||||
level_height = tile_manager_height (tiles);
|
||||
|
||||
if (w) *w = PROJ_ROUND (level_width * (shell->scale_x * (1 << level)));
|
||||
if (h) *h = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_get_disp_offset:
|
||||
* @shell:
|
||||
* @disp_xoffset:
|
||||
* @disp_yoffset:
|
||||
*
|
||||
* In viewport coordinates, get the offset of where to start rendering
|
||||
* the scaled image.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_get_disp_offset (const GimpDisplayShell *shell,
|
||||
gint *disp_xoffset,
|
||||
gint *disp_yoffset)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (disp_xoffset)
|
||||
{
|
||||
if (shell->offset_x < 0)
|
||||
{
|
||||
*disp_xoffset = -shell->offset_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
*disp_xoffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (disp_yoffset)
|
||||
{
|
||||
if (shell->offset_y < 0)
|
||||
{
|
||||
*disp_yoffset = -shell->offset_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
*disp_yoffset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_get_render_start_offset:
|
||||
* @shell:
|
||||
* @offset_x:
|
||||
* @offset_y:
|
||||
*
|
||||
* Get the offset into the scaled image that we should start render
|
||||
* from
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_get_render_start_offset (const GimpDisplayShell *shell,
|
||||
gint *offset_x,
|
||||
gint *offset_y)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (offset_x) *offset_x = MAX (0, shell->offset_x);
|
||||
if (offset_y) *offset_y = MAX (0, shell->offset_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_setup_hscrollbar_with_value:
|
||||
* @shell:
|
||||
* @value:
|
||||
*
|
||||
* Setup the limits of the horizontal scrollbar
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_setup_hscrollbar_with_value (GimpDisplayShell *shell,
|
||||
gdouble value)
|
||||
{
|
||||
gint sw;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (! shell->display ||
|
||||
! shell->display->image)
|
||||
return;
|
||||
|
||||
sw = SCALEX (shell, gimp_image_get_width (shell->display->image));
|
||||
|
||||
if (shell->disp_width < sw)
|
||||
{
|
||||
shell->hsbdata->upper = MAX (value + shell->disp_width,
|
||||
sw);
|
||||
|
||||
shell->hsbdata->lower = MIN (value,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->hsbdata->lower = MIN (value,
|
||||
-(shell->disp_width - sw) / 2);
|
||||
|
||||
shell->hsbdata->upper = MAX (value + shell->disp_width,
|
||||
sw + (shell->disp_width - sw) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_display_shell_setup_vscrollbar_with_value:
|
||||
* @shell:
|
||||
* @value:
|
||||
*
|
||||
* Setup the limits of the vertical scrollbar
|
||||
*
|
||||
**/
|
||||
void
|
||||
gimp_display_shell_setup_vscrollbar_with_value (GimpDisplayShell *shell,
|
||||
gdouble value)
|
||||
{
|
||||
gint sh;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
if (! shell->display ||
|
||||
! shell->display->image)
|
||||
return;
|
||||
|
||||
sh = SCALEY (shell, gimp_image_get_height (shell->display->image));
|
||||
|
||||
if (shell->disp_height < sh)
|
||||
{
|
||||
shell->vsbdata->upper = MAX (value + shell->disp_height,
|
||||
sh);
|
||||
|
||||
shell->vsbdata->lower = MIN (value,
|
||||
0);
|
||||
}
|
||||
else
|
||||
{
|
||||
shell->vsbdata->lower = MIN (value,
|
||||
-(shell->disp_height - sh) / 2);
|
||||
|
||||
shell->vsbdata->upper = MAX (value + shell->disp_height,
|
||||
sh + (shell->disp_height - sh) / 2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,11 +20,44 @@
|
|||
#define __GIMP_DISPLAY_SHELL_SCROLL_H__
|
||||
|
||||
|
||||
gboolean gimp_display_shell_scroll (GimpDisplayShell *shell,
|
||||
gint x_offset,
|
||||
gint y_offset);
|
||||
void gimp_display_shell_center_around_image_coordinate (GimpDisplayShell *shell,
|
||||
gdouble image_x,
|
||||
gdouble image_y);
|
||||
|
||||
void gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell);
|
||||
void gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_get_scaled_viewport (const GimpDisplayShell *shell,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *w,
|
||||
gint *h);
|
||||
|
||||
void gimp_display_shell_get_viewport (const GimpDisplayShell *shell,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *w,
|
||||
gdouble *h);
|
||||
|
||||
void gimp_display_shell_get_scaled_image_viewport_offset (const GimpDisplayShell *shell,
|
||||
gint *x,
|
||||
gint *y);
|
||||
|
||||
void gimp_display_shell_get_scaled_image_size (const GimpDisplayShell *shell,
|
||||
gint *w,
|
||||
gint *h);
|
||||
|
||||
void gimp_display_shell_get_disp_offset (const GimpDisplayShell *shell,
|
||||
gint *disp_xoffset,
|
||||
gint *disp_yoffset);
|
||||
|
||||
void gimp_display_shell_get_render_start_offset (const GimpDisplayShell *shell,
|
||||
gint *offset_x,
|
||||
gint *offset_y);
|
||||
|
||||
void gimp_display_shell_setup_hscrollbar_with_value (GimpDisplayShell *shell,
|
||||
gdouble value);
|
||||
void gimp_display_shell_setup_vscrollbar_with_value (GimpDisplayShell *shell,
|
||||
gdouble value);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_SHELL_SCROLL_H__ */
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
#include "gimpdisplayshell-transform.h"
|
||||
|
||||
|
||||
|
@ -48,6 +49,9 @@ gimp_display_shell_transform_coordinate (GimpDisplayShell *shell,
|
|||
GimpCoords *image_coords,
|
||||
GimpCoords *display_coords)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (image_coords != NULL);
|
||||
g_return_if_fail (display_coords != NULL);
|
||||
|
@ -57,8 +61,12 @@ gimp_display_shell_transform_coordinate (GimpDisplayShell *shell,
|
|||
display_coords->x = SCALEX (shell, image_coords->x);
|
||||
display_coords->y = SCALEY (shell, image_coords->y);
|
||||
|
||||
display_coords->x += - shell->offset_x + shell->disp_xoffset;
|
||||
display_coords->y += - shell->offset_y + shell->disp_yoffset;
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
|
||||
display_coords->x += scaled_image_viewport_offset_x;
|
||||
display_coords->y += scaled_image_viewport_offset_y;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,14 +83,21 @@ gimp_display_shell_untransform_coordinate (GimpDisplayShell *shell,
|
|||
GimpCoords *display_coords,
|
||||
GimpCoords *image_coords)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (display_coords != NULL);
|
||||
g_return_if_fail (image_coords != NULL);
|
||||
|
||||
*image_coords = *display_coords;
|
||||
|
||||
image_coords->x = display_coords->x - shell->disp_xoffset + shell->offset_x;
|
||||
image_coords->y = display_coords->y - shell->disp_yoffset + shell->offset_y;
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
|
||||
image_coords->x = display_coords->x - scaled_image_viewport_offset_x;
|
||||
image_coords->y = display_coords->y - scaled_image_viewport_offset_y;
|
||||
|
||||
image_coords->x /= shell->scale_x;
|
||||
image_coords->y /= shell->scale_y;
|
||||
|
@ -96,6 +111,8 @@ gimp_display_shell_transform_xy (GimpDisplayShell *shell,
|
|||
gint *ny,
|
||||
gboolean use_offsets)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
gint offset_x = 0;
|
||||
gint offset_y = 0;
|
||||
gint64 tx;
|
||||
|
@ -119,8 +136,11 @@ gimp_display_shell_transform_xy (GimpDisplayShell *shell,
|
|||
tx = ((gint64) x * shell->x_src_dec) / shell->x_dest_inc;
|
||||
ty = ((gint64) y * shell->y_src_dec) / shell->y_dest_inc;
|
||||
|
||||
tx += shell->disp_xoffset - shell->offset_x;
|
||||
ty += shell->disp_yoffset - shell->offset_y;
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
tx += scaled_image_viewport_offset_x;
|
||||
ty += scaled_image_viewport_offset_y;
|
||||
|
||||
/* The projected coordinates might overflow a gint in the case of big
|
||||
images at high zoom levels, so we clamp them here to avoid problems. */
|
||||
|
@ -153,6 +173,8 @@ gimp_display_shell_untransform_xy (GimpDisplayShell *shell,
|
|||
gboolean round,
|
||||
gboolean use_offsets)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
gint offset_x = 0;
|
||||
gint offset_y = 0;
|
||||
gint64 tx;
|
||||
|
@ -170,8 +192,11 @@ gimp_display_shell_untransform_xy (GimpDisplayShell *shell,
|
|||
gimp_item_offsets (item, &offset_x, &offset_y);
|
||||
}
|
||||
|
||||
tx = (gint64) x + shell->offset_x - shell->disp_xoffset;
|
||||
ty = (gint64) y + shell->offset_y - shell->disp_yoffset;
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
tx = (gint64) x - scaled_image_viewport_offset_x;
|
||||
ty = (gint64) y - scaled_image_viewport_offset_y;
|
||||
|
||||
tx *= shell->x_dest_inc;
|
||||
ty *= shell->y_dest_inc;
|
||||
|
@ -207,6 +232,8 @@ gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
|
|||
gdouble *ny,
|
||||
gboolean use_offsets)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
gint offset_x = 0;
|
||||
gint offset_y = 0;
|
||||
|
||||
|
@ -222,11 +249,12 @@ gimp_display_shell_transform_xy_f (GimpDisplayShell *shell,
|
|||
gimp_item_offsets (item, &offset_x, &offset_y);
|
||||
}
|
||||
|
||||
*nx = SCALEX (shell, x + offset_x) - shell->offset_x;
|
||||
*ny = SCALEY (shell, y + offset_y) - shell->offset_y;
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
|
||||
*nx += shell->disp_xoffset;
|
||||
*ny += shell->disp_yoffset;
|
||||
*nx = SCALEX (shell, x + offset_x) + scaled_image_viewport_offset_x;
|
||||
*ny = SCALEY (shell, y + offset_y) + scaled_image_viewport_offset_y;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -251,6 +279,8 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
|
|||
gdouble *ny,
|
||||
gboolean use_offsets)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
gint offset_x = 0;
|
||||
gint offset_y = 0;
|
||||
|
||||
|
@ -258,9 +288,6 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
|
|||
g_return_if_fail (nx != NULL);
|
||||
g_return_if_fail (ny != NULL);
|
||||
|
||||
x -= shell->disp_xoffset;
|
||||
y -= shell->disp_yoffset;
|
||||
|
||||
if (use_offsets)
|
||||
{
|
||||
GimpItem *item;
|
||||
|
@ -269,8 +296,12 @@ gimp_display_shell_untransform_xy_f (GimpDisplayShell *shell,
|
|||
gimp_item_offsets (item, &offset_x, &offset_y);
|
||||
}
|
||||
|
||||
*nx = (x + shell->offset_x) / shell->scale_x - offset_x;
|
||||
*ny = (y + shell->offset_y) / shell->scale_y - offset_y;
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
|
||||
*nx = (x - scaled_image_viewport_offset_x) / shell->scale_x - offset_x;
|
||||
*ny = (y - scaled_image_viewport_offset_y) / shell->scale_y - offset_y;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,17 +339,22 @@ gimp_display_shell_transform_points (GimpDisplayShell *shell,
|
|||
|
||||
for (i = 0; i < n_points ; i++)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
gdouble x = points[i].x + offset_x;
|
||||
gdouble y = points[i].y + offset_y;
|
||||
|
||||
x = x * shell->x_src_dec / shell->x_dest_inc;
|
||||
y = y * shell->y_src_dec / shell->y_dest_inc;
|
||||
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
coords[i].x = CLAMP (PROJ_ROUND64 (x) +
|
||||
shell->disp_xoffset - shell->offset_x,
|
||||
scaled_image_viewport_offset_x,
|
||||
G_MININT, G_MAXINT);
|
||||
coords[i].y = CLAMP (PROJ_ROUND64 (y) +
|
||||
shell->disp_yoffset - shell->offset_y,
|
||||
scaled_image_viewport_offset_y,
|
||||
G_MININT, G_MAXINT);
|
||||
}
|
||||
}
|
||||
|
@ -358,17 +394,22 @@ gimp_display_shell_transform_coords (GimpDisplayShell *shell,
|
|||
|
||||
for (i = 0; i < n_coords ; i++)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
gdouble x = image_coords[i].x + offset_x;
|
||||
gdouble y = image_coords[i].y + offset_y;
|
||||
|
||||
x = x * shell->x_src_dec / shell->x_dest_inc;
|
||||
y = y * shell->y_src_dec / shell->y_dest_inc;
|
||||
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
disp_coords[i].x = CLAMP (PROJ_ROUND64 (x) +
|
||||
shell->disp_xoffset - shell->offset_x,
|
||||
scaled_image_viewport_offset_x,
|
||||
G_MININT, G_MAXINT);
|
||||
disp_coords[i].y = CLAMP (PROJ_ROUND64 (y) +
|
||||
shell->disp_yoffset - shell->offset_y,
|
||||
scaled_image_viewport_offset_y,
|
||||
G_MININT, G_MAXINT);
|
||||
}
|
||||
}
|
||||
|
@ -408,6 +449,8 @@ gimp_display_shell_transform_segments (GimpDisplayShell *shell,
|
|||
|
||||
for (i = 0; i < n_segs ; i++)
|
||||
{
|
||||
gint scaled_image_viewport_offset_x;
|
||||
gint scaled_image_viewport_offset_y;
|
||||
gint64 x1, x2;
|
||||
gint64 y1, y2;
|
||||
|
||||
|
@ -421,13 +464,17 @@ gimp_display_shell_transform_segments (GimpDisplayShell *shell,
|
|||
y1 = (y1 * shell->y_src_dec) / shell->y_dest_inc;
|
||||
y2 = (y2 * shell->y_src_dec) / shell->y_dest_inc;
|
||||
|
||||
dest_segs[i].x1 = CLAMP (x1 + shell->disp_xoffset - shell->offset_x,
|
||||
gimp_display_shell_get_scaled_image_viewport_offset (shell,
|
||||
&scaled_image_viewport_offset_x,
|
||||
&scaled_image_viewport_offset_y);
|
||||
|
||||
dest_segs[i].x1 = CLAMP (x1 + scaled_image_viewport_offset_x,
|
||||
G_MININT, G_MAXINT);
|
||||
dest_segs[i].x2 = CLAMP (x2 + shell->disp_xoffset - shell->offset_x,
|
||||
dest_segs[i].x2 = CLAMP (x2 + scaled_image_viewport_offset_x,
|
||||
G_MININT, G_MAXINT);
|
||||
dest_segs[i].y1 = CLAMP (y1 + shell->disp_yoffset - shell->offset_y,
|
||||
dest_segs[i].y1 = CLAMP (y1 + scaled_image_viewport_offset_y,
|
||||
G_MININT, G_MAXINT);
|
||||
dest_segs[i].y2 = CLAMP (y2 + shell->disp_yoffset - shell->offset_y,
|
||||
dest_segs[i].y2 = CLAMP (y2 + scaled_image_viewport_offset_y,
|
||||
G_MININT, G_MAXINT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,8 +257,6 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||
|
||||
shell->disp_width = 0;
|
||||
shell->disp_height = 0;
|
||||
shell->disp_xoffset = 0;
|
||||
shell->disp_yoffset = 0;
|
||||
|
||||
shell->proximity = FALSE;
|
||||
shell->snap_to_guides = TRUE;
|
||||
|
@ -937,12 +935,20 @@ gimp_display_shell_new (GimpDisplay *display,
|
|||
shell->hsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, image_width,
|
||||
1, 1, image_width));
|
||||
shell->hsb = gtk_hscrollbar_new (shell->hsbdata);
|
||||
|
||||
gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->hsb), GTK_SENSITIVITY_ON);
|
||||
gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->hsb), GTK_SENSITIVITY_ON);
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->hsb, GTK_CAN_FOCUS);
|
||||
|
||||
/* the vertical scrollbar */
|
||||
shell->vsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, image_height,
|
||||
1, 1, image_height));
|
||||
shell->vsb = gtk_vscrollbar_new (shell->vsbdata);
|
||||
|
||||
gtk_range_set_lower_stepper_sensitivity (GTK_RANGE (shell->vsb), GTK_SENSITIVITY_ON);
|
||||
gtk_range_set_upper_stepper_sensitivity (GTK_RANGE (shell->vsb), GTK_SENSITIVITY_ON);
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (shell->vsb, GTK_CAN_FOCUS);
|
||||
|
||||
/* create the contents of the inner_table ********************************/
|
||||
|
@ -1334,9 +1340,6 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
|
|||
GimpUnit unit,
|
||||
gdouble scale)
|
||||
{
|
||||
gint display_width;
|
||||
gint display_height;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (GIMP_IS_DISPLAY (shell->display));
|
||||
g_return_if_fail (GIMP_IS_IMAGE (image));
|
||||
|
@ -1345,8 +1348,7 @@ gimp_display_shell_fill (GimpDisplayShell *shell,
|
|||
GTK_WIDGET (shell));
|
||||
|
||||
gimp_display_shell_set_unit (shell, unit);
|
||||
gimp_display_shell_set_initial_scale (shell, scale,
|
||||
&display_width, &display_height);
|
||||
gimp_display_shell_set_initial_scale (shell, scale, NULL, NULL);
|
||||
gimp_display_shell_scale_changed (shell);
|
||||
|
||||
gimp_statusbar_fill (GIMP_STATUSBAR (shell->statusbar));
|
||||
|
|
|
@ -99,8 +99,6 @@ struct _GimpDisplayShell
|
|||
|
||||
gint disp_width; /* width of drawing area */
|
||||
gint disp_height; /* height of drawing area */
|
||||
gint disp_xoffset;
|
||||
gint disp_yoffset;
|
||||
|
||||
gboolean proximity; /* is a device in proximity */
|
||||
gboolean snap_to_guides; /* should the guides be snapped to? */
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define BORDER_PEN_WIDTH 3
|
||||
|
||||
|
||||
static void gimp_navigation_editor_docked_iface_init (GimpDockedInterface *iface);
|
||||
|
||||
static void gimp_navigation_editor_destroy (GtkObject *object);
|
||||
|
@ -71,6 +74,8 @@ static gboolean gimp_navigation_editor_button_release (GtkWidget *wi
|
|||
static void gimp_navigation_editor_marker_changed (GimpNavigationView *view,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GimpNavigationEditor *editor);
|
||||
static void gimp_navigation_editor_zoom (GimpNavigationView *view,
|
||||
GimpZoomType direction,
|
||||
|
@ -220,6 +225,7 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|||
gint click_x,
|
||||
gint click_y)
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GimpNavigationEditor *editor;
|
||||
GimpNavigationView *view;
|
||||
GdkScreen *screen;
|
||||
|
@ -266,17 +272,15 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|||
/* decide where to put the popup */
|
||||
gdk_window_get_origin (widget->window, &x_org, &y_org);
|
||||
|
||||
#define BORDER_PEN_WIDTH 3
|
||||
|
||||
x = (x_org + click_x -
|
||||
view->p_x -
|
||||
0.5 * (view->p_width - BORDER_PEN_WIDTH) -
|
||||
2 * widget->style->xthickness);
|
||||
2 * style->xthickness);
|
||||
|
||||
y = (y_org + click_y -
|
||||
view->p_y -
|
||||
0.5 * (view->p_height - BORDER_PEN_WIDTH) -
|
||||
2 * widget->style->ythickness);
|
||||
2 * style->ythickness);
|
||||
|
||||
/* If the popup doesn't fit into the screen, we have a problem.
|
||||
* We move the popup onscreen and risk that the pointer is not
|
||||
|
@ -290,10 +294,10 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|||
|
||||
x = CLAMP (x, 0, (gdk_screen_get_width (screen) -
|
||||
GIMP_VIEW (view)->renderer->width -
|
||||
4 * widget->style->xthickness));
|
||||
4 * style->xthickness));
|
||||
y = CLAMP (y, 0, (gdk_screen_get_height (screen) -
|
||||
GIMP_VIEW (view)->renderer->height -
|
||||
4 * widget->style->ythickness));
|
||||
4 * style->ythickness));
|
||||
|
||||
gtk_window_move (GTK_WINDOW (shell->nav_popup), x, y);
|
||||
gtk_widget_show (shell->nav_popup);
|
||||
|
@ -304,8 +308,6 @@ gimp_navigation_editor_popup (GimpDisplayShell *shell,
|
|||
view->motion_offset_x = 0.5 * (view->p_width - BORDER_PEN_WIDTH);
|
||||
view->motion_offset_y = 0.5 * (view->p_height - BORDER_PEN_WIDTH);
|
||||
|
||||
#undef BORDER_PEN_WIDTH
|
||||
|
||||
gimp_navigation_view_grab_pointer (view);
|
||||
}
|
||||
|
||||
|
@ -490,15 +492,17 @@ static void
|
|||
gimp_navigation_editor_marker_changed (GimpNavigationView *view,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GimpNavigationEditor *editor)
|
||||
{
|
||||
if (editor->shell)
|
||||
{
|
||||
GimpDisplayShell *shell = editor->shell;
|
||||
|
||||
gimp_display_shell_scroll (shell,
|
||||
RINT (x * shell->scale_x - shell->offset_x),
|
||||
RINT (y * shell->scale_y - shell->offset_y));
|
||||
gimp_display_shell_center_around_image_coordinate (shell,
|
||||
x + width / 2,
|
||||
y + height / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,7 +544,7 @@ gimp_navigation_editor_scroll (GimpNavigationView *view,
|
|||
|
||||
g_assert (adj != NULL);
|
||||
|
||||
value = adj->value;
|
||||
value = gtk_adjustment_get_value (adj);
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
|
@ -565,7 +569,8 @@ static void
|
|||
gimp_navigation_editor_zoom_adj_changed (GtkAdjustment *adj,
|
||||
GimpNavigationEditor *editor)
|
||||
{
|
||||
gimp_display_shell_scale (editor->shell, GIMP_ZOOM_TO, pow (2.0, adj->value));
|
||||
gimp_display_shell_scale (editor->shell, GIMP_ZOOM_TO,
|
||||
pow (2.0, gtk_adjustment_get_value (adj)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -640,9 +645,13 @@ gimp_navigation_editor_update_marker (GimpNavigationEditor *editor)
|
|||
gimp_view_renderer_set_dot_for_dot (renderer, shell->dot_for_dot);
|
||||
|
||||
if (renderer->viewable)
|
||||
gimp_navigation_view_set_marker (GIMP_NAVIGATION_VIEW (editor->view),
|
||||
shell->offset_x / shell->scale_x,
|
||||
shell->offset_y / shell->scale_y,
|
||||
shell->disp_width / shell->scale_x,
|
||||
shell->disp_height / shell->scale_y);
|
||||
{
|
||||
GimpNavigationView *view = GIMP_NAVIGATION_VIEW (editor->view);
|
||||
gdouble x, y;
|
||||
gdouble w, h;
|
||||
|
||||
gimp_display_shell_get_viewport (shell, &x, &y, &w, &h);
|
||||
|
||||
gimp_navigation_view_set_marker (view, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -493,13 +493,18 @@ gimp_statusbar_progress_message (GimpProgress *progress,
|
|||
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
|
||||
GtkWidget *label = GTK_STATUSBAR (statusbar)->label;
|
||||
PangoLayout *layout;
|
||||
const gchar *stock_id = gimp_get_message_stock_id (severity);
|
||||
const gchar *stock_id;
|
||||
gboolean handle_msg = FALSE;
|
||||
|
||||
/* we can only handle short one-liners */
|
||||
/* don't accept a message if we are already displaying one */
|
||||
if (statusbar->temp_timeout_id)
|
||||
return FALSE;
|
||||
|
||||
/* we can only handle short one-liners */
|
||||
layout = gtk_widget_create_pango_layout (label, message);
|
||||
|
||||
stock_id = gimp_get_message_stock_id (severity);
|
||||
|
||||
if (pango_layout_get_line_count (layout) == 1)
|
||||
{
|
||||
gint width;
|
||||
|
|
|
@ -420,9 +420,14 @@ gimp_curves_config_load_cruft (GimpCurvesConfig *config,
|
|||
gimp_curve_set_curve_type (curve, GIMP_CURVE_SMOOTH);
|
||||
|
||||
for (j = 0; j < GIMP_CURVE_N_CRUFT_POINTS; j++)
|
||||
gimp_curve_set_point (curve, j,
|
||||
(gdouble) index[i][j] / 255.0,
|
||||
(gdouble) value[i][j] / 255.0);
|
||||
{
|
||||
if (index[i][j] < 0 || value[i][j] < 0)
|
||||
gimp_curve_set_point (curve, j, -1, -1);
|
||||
else
|
||||
gimp_curve_set_point (curve, j,
|
||||
(gdouble) index[i][j] / 255.0,
|
||||
(gdouble) value[i][j] / 255.0);
|
||||
}
|
||||
|
||||
gimp_data_thaw (GIMP_DATA (curve));
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ libappgui_a_SOURCES = \
|
|||
gui.h \
|
||||
gui-message.c \
|
||||
gui-message.h \
|
||||
gui-unique.c \
|
||||
gui-unique.h \
|
||||
gui-vtable.c \
|
||||
gui-vtable.h \
|
||||
gui-types.h \
|
||||
|
|
|
@ -0,0 +1,228 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (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
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
#define DBUS_API_SUBJECT_TO_CHANGE
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#endif
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "widgets/gimpdbusservice.h"
|
||||
|
||||
#include "gui-unique.h"
|
||||
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
static void gui_dbus_service_init (Gimp *gimp);
|
||||
static void gui_dbus_service_exit (void);
|
||||
|
||||
static DBusGConnection *dbus_connection = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
static void gui_unique_win32_init (Gimp *gimp);
|
||||
static void gui_unique_win32_exit (void);
|
||||
|
||||
static Gimp *unique_gimp = NULL;
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
gui_unique_init (Gimp *gimp)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gui_unique_win32_init (gimp);
|
||||
#elif HAVE_DBUS_GLIB
|
||||
gui_dbus_service_init (gimp);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gui_unique_exit (void)
|
||||
{
|
||||
#if HAVE_DBUS_GLIB
|
||||
gui_dbus_service_exit ();
|
||||
#elif HAVE_DBUS_GLIB
|
||||
gui_unique_win32_exit ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
|
||||
static void
|
||||
gui_dbus_service_init (Gimp *gimp)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (dbus_connection == NULL);
|
||||
|
||||
dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
|
||||
if (dbus_connection)
|
||||
{
|
||||
GObject *service = gimp_dbus_service_new (gimp);
|
||||
|
||||
dbus_bus_request_name (dbus_g_connection_get_connection (dbus_connection),
|
||||
GIMP_DBUS_SERVICE_NAME, 0, NULL);
|
||||
|
||||
dbus_g_connection_register_g_object (dbus_connection,
|
||||
GIMP_DBUS_SERVICE_PATH, service);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gui_dbus_service_exit (void)
|
||||
{
|
||||
if (dbus_connection)
|
||||
{
|
||||
dbus_g_connection_unref (dbus_connection);
|
||||
dbus_connection = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAVE_DBUS_GLIB */
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gchar *name;
|
||||
gboolean as_new;
|
||||
} IdleOpenData;
|
||||
|
||||
|
||||
static IdleOpenData *
|
||||
idle_open_data_new (const gchar *name,
|
||||
gboolean as_new)
|
||||
{
|
||||
IdleOpenData *data = g_slice_new (IdleOpenData);
|
||||
|
||||
data->name = g_strdup (name);
|
||||
data->as_new = as_new;
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static void
|
||||
idle_open_data_free (IdleOpenData *data)
|
||||
{
|
||||
g_free (data->name);
|
||||
g_slice_free (IdleOpenData, data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gui_unique_win32_idle_open (IdleOpenData *data)
|
||||
{
|
||||
file_open_from_command_line (unique_gimp, data->name, data->as_new);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK
|
||||
gui_unique_win32_message_handler (HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_COPYDATA:
|
||||
{
|
||||
COPYDATASTRUCT *copydata = (COPYDATASTRUCT *) lParam;
|
||||
|
||||
if (unique_gimp && copydata->cbData > 0)
|
||||
{
|
||||
GSource *source;
|
||||
GClosure *closure;
|
||||
IdleOpenData *data = idle_open_data_new (copydata->lpData, copydata->dwData != 0);
|
||||
|
||||
closure = g_cclosure_new (G_CALLBACK (gui_unique_win32_idle_open),
|
||||
data,
|
||||
(GClosureNotify) idle_open_data_free);
|
||||
|
||||
g_object_watch_closure (unique_gimp, closure);
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_closure (source, closure);
|
||||
g_source_attach (source, NULL);
|
||||
g_source_unref (source);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return DefWindowProcW (hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gui_unique_win32_init (Gimp *gimp)
|
||||
{
|
||||
WNDCLASSW wc;
|
||||
|
||||
g_return_if_fail (GIMP_IS_GIMP (gimp));
|
||||
g_return_if_fail (unique_gimp == NULL);
|
||||
|
||||
unique_gimp = gimp;
|
||||
|
||||
/* register window class for proxy window */
|
||||
memset (&wc, 0, sizeof (wc));
|
||||
|
||||
wc.hInstance = GetModuleHandle (NULL);
|
||||
wc.lpfnWndProc = gui_unique_win32_message_handler;
|
||||
wc.lpszClassName = GIMP_UNIQUE_WIN32_WINDOW_CLASS;
|
||||
|
||||
RegisterClassW (&wc);
|
||||
|
||||
CreateWindowExW (0,
|
||||
GIMP_UNIQUE_WIN32_WINDOW_CLASS,
|
||||
GIMP_UNIQUE_WIN32_WINDOW_NAME,
|
||||
WS_POPUP, 0, 0, 1, 1, NULL, NULL, wc.hInstance, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gui_unique_win32_exit (void)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_GIMP (unique_gimp));
|
||||
|
||||
unique_gimp = NULL;
|
||||
}
|
||||
|
||||
|
||||
#endif /* G_OS_WIN32 */
|
|
@ -0,0 +1,32 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (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
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GUI_UNIQUE_H__
|
||||
#define __GUI_UNIQUE_H__
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#define GIMP_UNIQUE_WIN32_WINDOW_CLASS L"GimpWin32UniqueHandler"
|
||||
#define GIMP_UNIQUE_WIN32_WINDOW_NAME L"GimpProxy"
|
||||
#endif
|
||||
|
||||
|
||||
void gui_unique_init (Gimp *gimp);
|
||||
void gui_unique_exit (void);
|
||||
|
||||
|
||||
#endif /* __GUI_UNIQUE_H__ */
|
|
@ -22,12 +22,6 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
#define DBUS_API_SUBJECT_TO_CHANGE
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#endif
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
#include "libgimpwidgets/gimpwidgets-private.h"
|
||||
|
@ -57,7 +51,6 @@
|
|||
#include "widgets/gimpclipboard.h"
|
||||
#include "widgets/gimpcolorselectorpalette.h"
|
||||
#include "widgets/gimpcontrollers.h"
|
||||
#include "widgets/gimpdbusservice.h"
|
||||
#include "widgets/gimpdevices.h"
|
||||
#include "widgets/gimpdevicestatus.h"
|
||||
#include "widgets/gimpdialogfactory.h"
|
||||
|
@ -80,6 +73,7 @@
|
|||
|
||||
#include "color-history.h"
|
||||
#include "gui.h"
|
||||
#include "gui-unique.h"
|
||||
#include "gui-vtable.h"
|
||||
#include "session.h"
|
||||
#include "splash.h"
|
||||
|
@ -136,18 +130,11 @@ static void gui_display_changed (GimpContext *context,
|
|||
Gimp *gimp);
|
||||
static void gui_display_remove (GimpContainer *displays);
|
||||
|
||||
static void gui_dbus_service_init (Gimp *gimp);
|
||||
static void gui_dbus_service_exit (void);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static Gimp *the_gui_gimp = NULL;
|
||||
static GimpUIManager *image_ui_manager = NULL;
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
static DBusGConnection *dbus_connection = NULL;
|
||||
#endif
|
||||
static Gimp *the_gui_gimp = NULL;
|
||||
static GimpUIManager *image_ui_manager = NULL;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -525,7 +512,7 @@ gui_restore_after_callback (Gimp *gimp,
|
|||
display = GIMP_DISPLAY (gimp_create_display (gimp,
|
||||
NULL, GIMP_UNIT_PIXEL, 1.0));
|
||||
|
||||
gui_dbus_service_init (gimp);
|
||||
gui_unique_init (gimp);
|
||||
|
||||
if (gui_config->restore_session)
|
||||
session_restore (gimp);
|
||||
|
@ -559,9 +546,7 @@ gui_exit_callback (Gimp *gimp,
|
|||
|
||||
gimp->message_handler = GIMP_CONSOLE;
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
gui_dbus_service_exit ();
|
||||
#endif
|
||||
gui_unique_exit ();
|
||||
|
||||
if (gui_config->save_session_info)
|
||||
session_save (gimp, FALSE);
|
||||
|
@ -761,43 +746,3 @@ gui_display_remove (GimpContainer *displays)
|
|||
if (gimp_container_is_empty (displays))
|
||||
windows_show_toolbox ();
|
||||
}
|
||||
|
||||
static void
|
||||
gui_dbus_service_init (Gimp *gimp)
|
||||
{
|
||||
#if HAVE_DBUS_GLIB
|
||||
GError *error = NULL;
|
||||
|
||||
g_return_if_fail (dbus_connection == NULL);
|
||||
|
||||
dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
|
||||
if (dbus_connection)
|
||||
{
|
||||
GObject *service = gimp_dbus_service_new (gimp);
|
||||
|
||||
dbus_bus_request_name (dbus_g_connection_get_connection (dbus_connection),
|
||||
GIMP_DBUS_SERVICE_NAME, 0, NULL);
|
||||
|
||||
dbus_g_connection_register_g_object (dbus_connection,
|
||||
GIMP_DBUS_SERVICE_PATH, service);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
gui_dbus_service_exit (void)
|
||||
{
|
||||
#if HAVE_DBUS_GLIB
|
||||
if (dbus_connection)
|
||||
{
|
||||
dbus_g_connection_unref (dbus_connection);
|
||||
dbus_connection = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
140
app/main.c
140
app/main.c
|
@ -41,10 +41,6 @@
|
|||
#include <io.h> /* get_osfhandle */
|
||||
#endif
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
#include <dbus/dbus-glib.h>
|
||||
#endif
|
||||
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
#include <gdk/gdk.h>
|
||||
#endif
|
||||
|
@ -59,14 +55,11 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
|
||||
#include "file/file-utils.h"
|
||||
|
||||
#include "widgets/gimpdbusservice.h"
|
||||
|
||||
#include "about.h"
|
||||
#include "app.h"
|
||||
#include "errors.h"
|
||||
#include "sanity.h"
|
||||
#include "unique.h"
|
||||
#include "units.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -113,11 +106,6 @@ static void gimp_open_console_window (void);
|
|||
#define gimp_open_console_window() /* as nothing */
|
||||
#endif
|
||||
|
||||
static gboolean gimp_dbus_open (const gchar **filenames,
|
||||
gboolean as_new,
|
||||
gboolean be_verbose);
|
||||
|
||||
|
||||
static const gchar *system_gimprc = NULL;
|
||||
static const gchar *user_gimprc = NULL;
|
||||
static const gchar *session_name = NULL;
|
||||
|
@ -386,11 +374,18 @@ main (int argc,
|
|||
if (no_interface)
|
||||
new_instance = TRUE;
|
||||
|
||||
if (! new_instance)
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
if (! new_instance && gimp_unique_open (filenames, as_new))
|
||||
{
|
||||
if (gimp_dbus_open (filenames, as_new, be_verbose))
|
||||
return EXIT_SUCCESS;
|
||||
if (be_verbose)
|
||||
g_print ("%s\n",
|
||||
_("Another GIMP instance is already running."));
|
||||
|
||||
gdk_notify_startup_complete ();
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
abort_message = sanity_check ();
|
||||
if (abort_message)
|
||||
|
@ -607,9 +602,6 @@ gimp_init_malloc (void)
|
|||
*
|
||||
* An alternative to tuning this parameter would be to use
|
||||
* malloc_trim(), for example after releasing a large tile-manager.
|
||||
*
|
||||
* Another possibility is to switch to using GSlice as soon as this
|
||||
* API is available in a stable GLib release.
|
||||
*/
|
||||
mallopt (M_MMAP_THRESHOLD, TILE_WIDTH * TILE_HEIGHT);
|
||||
#endif
|
||||
|
@ -698,113 +690,3 @@ gimp_sigfatal_handler (gint sig_num)
|
|||
}
|
||||
|
||||
#endif /* ! G_OS_WIN32 */
|
||||
|
||||
|
||||
static gboolean
|
||||
gimp_dbus_open (const gchar **filenames,
|
||||
gboolean as_new,
|
||||
gboolean be_verbose)
|
||||
{
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
#if HAVE_DBUS_GLIB
|
||||
DBusGConnection *connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
|
||||
|
||||
if (connection)
|
||||
{
|
||||
DBusGProxy *proxy;
|
||||
gboolean success;
|
||||
GError *error = NULL;
|
||||
|
||||
proxy = dbus_g_proxy_new_for_name (connection,
|
||||
GIMP_DBUS_SERVICE_NAME,
|
||||
GIMP_DBUS_SERVICE_PATH,
|
||||
GIMP_DBUS_SERVICE_INTERFACE);
|
||||
|
||||
if (filenames)
|
||||
{
|
||||
const gchar *method = as_new ? "OpenAsNew" : "Open";
|
||||
gchar *cwd = NULL;
|
||||
gint i;
|
||||
|
||||
for (i = 0, success = TRUE; filenames[i] && success; i++)
|
||||
{
|
||||
const gchar *filename = filenames[i];
|
||||
gchar *uri = NULL;
|
||||
|
||||
if (file_utils_filename_is_uri (filename, &error))
|
||||
{
|
||||
uri = g_strdup (filename);
|
||||
}
|
||||
else if (! error)
|
||||
{
|
||||
if (! g_path_is_absolute (filename))
|
||||
{
|
||||
gchar *absolute;
|
||||
|
||||
if (! cwd)
|
||||
cwd = g_get_current_dir ();
|
||||
|
||||
absolute = g_build_filename (cwd, filename, NULL);
|
||||
|
||||
uri = g_filename_to_uri (absolute, NULL, &error);
|
||||
|
||||
g_free (absolute);
|
||||
}
|
||||
else
|
||||
{
|
||||
uri = g_filename_to_uri (filename, NULL, &error);
|
||||
}
|
||||
}
|
||||
|
||||
if (uri)
|
||||
{
|
||||
gboolean retval; /* ignored */
|
||||
|
||||
success = dbus_g_proxy_call (proxy, method, &error,
|
||||
G_TYPE_STRING, uri,
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_BOOLEAN, &retval,
|
||||
G_TYPE_INVALID);
|
||||
g_free (uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr ("conversion to uri failed: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (cwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = dbus_g_proxy_call (proxy, "Activate", &error,
|
||||
G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
g_object_unref (proxy);
|
||||
dbus_g_connection_unref (connection);
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (be_verbose)
|
||||
g_print ("%s\n",
|
||||
_("Another GIMP instance is already running."));
|
||||
|
||||
gdk_notify_startup_complete ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else if (! (error->domain == DBUS_GERROR &&
|
||||
error->code == DBUS_GERROR_SERVICE_UNKNOWN))
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
}
|
||||
|
||||
g_clear_error (&error);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -1163,9 +1163,9 @@ gimp_paint_options_get_dynamic_hardness (GimpPaintOptions *paint_options,
|
|||
g_return_val_if_fail (GIMP_IS_PAINT_OPTIONS (paint_options), 1.0);
|
||||
g_return_val_if_fail (coords != NULL, 1.0);
|
||||
|
||||
if (paint_options->pressure_options->rate ||
|
||||
paint_options->velocity_options->rate ||
|
||||
paint_options->random_options->rate)
|
||||
if (paint_options->pressure_options->hardness ||
|
||||
paint_options->velocity_options->hardness ||
|
||||
paint_options->random_options->hardness)
|
||||
{
|
||||
gdouble pressure = -1.0;
|
||||
gdouble velocity = -1.0;
|
||||
|
|
|
@ -386,7 +386,9 @@ brightness_contrast_brightness_changed (GtkAdjustment *adjustment,
|
|||
GimpBrightnessContrastTool *bc_tool)
|
||||
{
|
||||
GimpBrightnessContrastConfig *config = bc_tool->config;
|
||||
gdouble value = adjustment->value / 127.0;
|
||||
gdouble value;
|
||||
|
||||
value = gtk_adjustment_get_value (adjustment) / 127.0;
|
||||
|
||||
if (config->brightness != value)
|
||||
{
|
||||
|
@ -401,7 +403,9 @@ brightness_contrast_contrast_changed (GtkAdjustment *adjustment,
|
|||
GimpBrightnessContrastTool *bc_tool)
|
||||
{
|
||||
GimpBrightnessContrastConfig *config = bc_tool->config;
|
||||
gdouble value = adjustment->value / 127.0;
|
||||
gdouble value;
|
||||
|
||||
value = gtk_adjustment_get_value (adjustment) / 127.0;
|
||||
|
||||
if (config->contrast != value)
|
||||
{
|
||||
|
|
|
@ -424,12 +424,11 @@ static void
|
|||
color_balance_preserve_toggled (GtkWidget *widget,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gboolean active = GTK_TOGGLE_BUTTON (widget)->active;
|
||||
gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
|
||||
|
||||
if (config->preserve_luminosity != active)
|
||||
if (cb_tool->config->preserve_luminosity != active)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (cb_tool->config,
|
||||
"preserve-luminosity", active,
|
||||
NULL);
|
||||
}
|
||||
|
@ -439,12 +438,11 @@ static void
|
|||
color_balance_cr_changed (GtkAdjustment *adjustment,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (config->cyan_red[config->range] != value)
|
||||
if (cb_tool->config->cyan_red[cb_tool->config->range] != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (cb_tool->config,
|
||||
"cyan-red", value,
|
||||
NULL);
|
||||
}
|
||||
|
@ -454,12 +452,11 @@ static void
|
|||
color_balance_mg_changed (GtkAdjustment *adjustment,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (config->magenta_green[config->range] != value)
|
||||
if (cb_tool->config->magenta_green[cb_tool->config->range] != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (cb_tool->config,
|
||||
"magenta-green", value,
|
||||
NULL);
|
||||
}
|
||||
|
@ -469,12 +466,11 @@ static void
|
|||
color_balance_yb_changed (GtkAdjustment *adjustment,
|
||||
GimpColorBalanceTool *cb_tool)
|
||||
{
|
||||
GimpColorBalanceConfig *config = cb_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (config->yellow_blue[config->range] != value)
|
||||
if (cb_tool->config->yellow_blue[cb_tool->config->range] != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (cb_tool->config,
|
||||
"yellow-blue", value,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ static void
|
|||
colorize_hue_changed (GtkAdjustment *adjustment,
|
||||
GimpColorizeTool *col_tool)
|
||||
{
|
||||
gdouble value = adjustment->value / 360.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 360.0;
|
||||
|
||||
if (col_tool->config->hue != value)
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ static void
|
|||
colorize_saturation_changed (GtkAdjustment *adjustment,
|
||||
GimpColorizeTool *col_tool)
|
||||
{
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (col_tool->config->saturation != value)
|
||||
{
|
||||
|
@ -340,7 +340,7 @@ static void
|
|||
colorize_lightness_changed (GtkAdjustment *adjustment,
|
||||
GimpColorizeTool *col_tool)
|
||||
{
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (col_tool->config->lightness != value)
|
||||
{
|
||||
|
|
|
@ -584,6 +584,7 @@ gimp_curves_tool_settings_import (GimpImageMapTool *image_map_tool,
|
|||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||
FILE *file;
|
||||
gboolean success;
|
||||
gchar header[64];
|
||||
|
||||
file = g_fopen (filename, "rt");
|
||||
|
||||
|
@ -596,11 +597,32 @@ gimp_curves_tool_settings_import (GimpImageMapTool *image_map_tool,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
success = gimp_curves_config_load_cruft (tool->config, file, error);
|
||||
if (! fgets (header, sizeof (header), file))
|
||||
{
|
||||
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
|
||||
_("Could not read header from '%s': %s"),
|
||||
gimp_filename_to_utf8 (filename),
|
||||
g_strerror (errno));
|
||||
fclose (file);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (g_str_has_prefix (header, "# GIMP Curves File\n"))
|
||||
{
|
||||
rewind (file);
|
||||
|
||||
success = gimp_curves_config_load_cruft (tool->config, file, error);
|
||||
|
||||
fclose (file);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
fclose (file);
|
||||
|
||||
return success;
|
||||
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_import (image_map_tool,
|
||||
filename,
|
||||
error);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -62,6 +62,42 @@
|
|||
|
||||
#define EDIT_SELECT_SCROLL_LOCK FALSE
|
||||
#define ARROW_VELOCITY 25
|
||||
#define CENTER_CROSS_SIZE 6
|
||||
|
||||
|
||||
typedef struct _GimpEditSelectionTool
|
||||
{
|
||||
GimpDrawTool parent_instance;
|
||||
|
||||
gint origx, origy; /* Last x and y coords */
|
||||
gint cumlx, cumly; /* Cumulative changes to x and yed */
|
||||
gint x, y; /* Current x and y coords */
|
||||
gint num_segs_in; /* Num seg in selection boundary */
|
||||
gint num_segs_out; /* Num seg in selection boundary */
|
||||
BoundSeg *segs_in; /* Pointer to the channel sel. segs */
|
||||
BoundSeg *segs_out; /* Pointer to the channel sel. segs */
|
||||
|
||||
gint x1, y1; /* Bounding box of selection mask */
|
||||
gint x2, y2;
|
||||
|
||||
gdouble center_x; /* Where to draw the mark of center */
|
||||
gdouble center_y;
|
||||
|
||||
GimpTranslateMode edit_mode; /* Translate the mask or layer? */
|
||||
|
||||
gboolean first_move; /* Don't push undos after the first */
|
||||
|
||||
gboolean propagate_release;
|
||||
|
||||
gboolean constrain; /* Constrain the movement */
|
||||
gdouble start_x, start_y;/* Coords when button was pressed */
|
||||
gdouble last_x, last_y; /* Previous coords sent to _motion */
|
||||
} GimpEditSelectionTool;
|
||||
|
||||
typedef struct _GimpEditSelectionToolClass
|
||||
{
|
||||
GimpDrawToolClass parent_class;
|
||||
} GimpEditSelectionToolClass;
|
||||
|
||||
|
||||
static void gimp_edit_selection_tool_button_release (GimpTool *tool,
|
||||
|
@ -398,6 +434,10 @@ gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
|||
y1 - coords->y,
|
||||
x2 - x1,
|
||||
y2 - y1);
|
||||
|
||||
/* Save where to draw the mark of the center */
|
||||
edit_select->center_x = (x1 + x2) / 2.0;
|
||||
edit_select->center_y = (y1 + y2) / 2.0;
|
||||
}
|
||||
|
||||
gimp_tool_control_activate (GIMP_TOOL (edit_select)->control);
|
||||
|
@ -919,6 +959,15 @@ gimp_edit_selection_tool_draw (GimpDrawTool *draw_tool)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Mark the center because we snap to it */
|
||||
gimp_draw_tool_draw_cross_by_anchor (draw_tool,
|
||||
edit_select->center_x + edit_select->cumlx,
|
||||
edit_select->center_y + edit_select->cumly,
|
||||
CENTER_CROSS_SIZE,
|
||||
CENTER_CROSS_SIZE,
|
||||
GTK_ANCHOR_CENTER,
|
||||
FALSE);
|
||||
|
||||
GIMP_DRAW_TOOL_CLASS (parent_class)->draw (draw_tool);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,41 +30,6 @@
|
|||
#define GIMP_IS_EDIT_SELECTION_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_EDIT_SELECTION_TOOL))
|
||||
|
||||
|
||||
typedef struct _GimpEditSelectionTool GimpEditSelectionTool;
|
||||
typedef struct _GimpEditSelectionToolClass GimpEditSelectionToolClass;
|
||||
|
||||
struct _GimpEditSelectionTool
|
||||
{
|
||||
GimpDrawTool parent_instance;
|
||||
|
||||
gint origx, origy; /* Last x and y coords */
|
||||
gint cumlx, cumly; /* Cumulative changes to x and yed */
|
||||
gint x, y; /* Current x and y coords */
|
||||
gint num_segs_in; /* Num seg in selection boundary */
|
||||
gint num_segs_out; /* Num seg in selection boundary */
|
||||
BoundSeg *segs_in; /* Pointer to the channel sel. segs */
|
||||
BoundSeg *segs_out; /* Pointer to the channel sel. segs */
|
||||
|
||||
gint x1, y1; /* Bounding box of selection mask */
|
||||
gint x2, y2;
|
||||
|
||||
GimpTranslateMode edit_mode; /* Translate the mask or layer? */
|
||||
|
||||
gboolean first_move; /* Don't push undos after the first */
|
||||
|
||||
gboolean propagate_release;
|
||||
|
||||
gboolean constrain; /* Constrain the movement */
|
||||
gdouble start_x, start_y;/* Coords when button was pressed */
|
||||
gdouble last_x, last_y; /* Previous coords sent to _motion */
|
||||
};
|
||||
|
||||
struct _GimpEditSelectionToolClass
|
||||
{
|
||||
GimpDrawToolClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_edit_selection_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gimp_edit_selection_tool_start (GimpTool *parent_tool,
|
||||
|
|
|
@ -1029,17 +1029,30 @@ gimp_free_select_tool_update_motion (GimpFreeSelectTool *fst,
|
|||
{
|
||||
priv->polygon_modified = TRUE;
|
||||
|
||||
if (priv->constrain_angle &&
|
||||
priv->grabbed_segment_index > 0 &&
|
||||
priv->n_points > 0 )
|
||||
if (priv->constrain_angle &&
|
||||
priv->n_segment_indices > 1 )
|
||||
{
|
||||
gdouble start_point_x;
|
||||
gdouble start_point_y;
|
||||
gint segment_index;
|
||||
|
||||
/* Base constraints on the last segment vertex if we move
|
||||
* the first one, otherwise base on the previous segment
|
||||
* vertex
|
||||
*/
|
||||
if (priv->grabbed_segment_index == 0)
|
||||
{
|
||||
segment_index = priv->n_segment_indices - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
segment_index = priv->grabbed_segment_index - 1;
|
||||
}
|
||||
|
||||
gimp_free_select_tool_get_segment_point (fst,
|
||||
&start_point_x,
|
||||
&start_point_y,
|
||||
priv->grabbed_segment_index - 1);
|
||||
segment_index);
|
||||
|
||||
gimp_tool_motion_constrain (start_point_x,
|
||||
start_point_y,
|
||||
|
@ -1438,16 +1451,16 @@ gimp_free_select_tool_modifier_key (GimpTool *tool,
|
|||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
Private *priv = GET_PRIVATE (tool);
|
||||
|
||||
if (tool->display != display)
|
||||
return;
|
||||
if (tool->display == display)
|
||||
{
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
|
||||
gimp_draw_tool_pause (draw_tool);
|
||||
priv->constrain_angle = state & GDK_CONTROL_MASK ? TRUE : FALSE;
|
||||
|
||||
priv->constrain_angle = state & GDK_CONTROL_MASK ? TRUE : FALSE;
|
||||
priv->supress_handles = state & GDK_SHIFT_MASK ? TRUE : FALSE;
|
||||
|
||||
priv->supress_handles = state & GDK_SHIFT_MASK ? TRUE : FALSE;
|
||||
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
gimp_draw_tool_resume (draw_tool);
|
||||
}
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->modifier_key (tool,
|
||||
key,
|
||||
|
|
|
@ -286,7 +286,6 @@ gimp_gegl_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
GimpGeglTool *tool = GIMP_GEGL_TOOL (image_map_tool);
|
||||
GtkListStore *store;
|
||||
GtkCellRenderer *cell;
|
||||
GtkSizeGroup *label_group;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
@ -294,8 +293,7 @@ gimp_gegl_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
GList *opclasses;
|
||||
GList *iter;
|
||||
|
||||
main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool);
|
||||
label_group = gimp_image_map_tool_dialog_get_label_group (image_map_tool);
|
||||
main_vbox = gimp_image_map_tool_dialog_get_vbox (image_map_tool);
|
||||
|
||||
/* The operation combo box */
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
|
@ -306,8 +304,6 @@ gimp_gegl_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_size_group_add_widget (label_group, label);
|
||||
|
||||
store = gtk_list_store_new (1, G_TYPE_STRING);
|
||||
|
||||
opclasses = gimp_get_geglopclasses ();
|
||||
|
|
|
@ -568,12 +568,11 @@ static void
|
|||
hue_saturation_hue_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 180.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 180.0;
|
||||
|
||||
if (config->hue[config->range] != value)
|
||||
if (hs_tool->config->hue[hs_tool->config->range] != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (hs_tool->config,
|
||||
"hue", value,
|
||||
NULL);
|
||||
}
|
||||
|
@ -583,12 +582,11 @@ static void
|
|||
hue_saturation_lightness_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (config->lightness[config->range] != value)
|
||||
if (hs_tool->config->lightness[hs_tool->config->range] != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (hs_tool->config,
|
||||
"lightness", value,
|
||||
NULL);
|
||||
}
|
||||
|
@ -598,12 +596,11 @@ static void
|
|||
hue_saturation_saturation_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (config->saturation[config->range] != value)
|
||||
if (hs_tool->config->saturation[hs_tool->config->range] != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (hs_tool->config,
|
||||
"saturation", value,
|
||||
NULL);
|
||||
}
|
||||
|
@ -613,12 +610,11 @@ static void
|
|||
hue_saturation_overlap_changed (GtkAdjustment *adjustment,
|
||||
GimpHueSaturationTool *hs_tool)
|
||||
{
|
||||
GimpHueSaturationConfig *config = hs_tool->config;
|
||||
gdouble value = adjustment->value / 100.0;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment) / 100.0;
|
||||
|
||||
if (config->overlap != value)
|
||||
if (hs_tool->config->overlap != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (hs_tool->config,
|
||||
"overlap", value,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -49,20 +49,13 @@
|
|||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_image_map_tool_import_activate (GtkWidget *widget,
|
||||
static gboolean gimp_image_map_tool_settings_import (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool);
|
||||
static void gimp_image_map_tool_export_activate (GtkWidget *widget,
|
||||
static gboolean gimp_image_map_tool_settings_export (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool);
|
||||
|
||||
static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool,
|
||||
const gchar *title,
|
||||
gboolean save);
|
||||
|
||||
static gboolean gimp_image_map_tool_settings_import (GimpImageMapTool *tool,
|
||||
const gchar *filename);
|
||||
static gboolean gimp_image_map_tool_settings_export (GimpImageMapTool *tool,
|
||||
const gchar *filename);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
|
@ -74,6 +67,7 @@ gimp_image_map_tool_add_settings_gui (GimpImageMapTool *image_map_tool)
|
|||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
gchar *filename;
|
||||
gchar *folder;
|
||||
|
||||
klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool);
|
||||
|
||||
|
@ -93,26 +87,33 @@ gimp_image_map_tool_add_settings_gui (GimpImageMapTool *image_map_tool)
|
|||
g_object_unref (image_map_tool->label_group);
|
||||
|
||||
filename = gimp_tool_info_build_options_filename (tool_info, ".settings");
|
||||
folder = g_build_filename (gimp_directory (), klass->settings_name, NULL);
|
||||
|
||||
image_map_tool->settings_box = gimp_settings_box_new (tool_info->gimp,
|
||||
image_map_tool->config,
|
||||
klass->recent_settings,
|
||||
filename);
|
||||
filename,
|
||||
klass->import_dialog_title,
|
||||
klass->export_dialog_title,
|
||||
tool_info->help_id,
|
||||
folder,
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), image_map_tool->settings_box,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (image_map_tool->settings_box);
|
||||
|
||||
g_free (filename);
|
||||
g_free (folder);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label),
|
||||
GIMP_SETTINGS_BOX (image_map_tool->settings_box)->combo);
|
||||
|
||||
g_signal_connect (image_map_tool->settings_box, "import",
|
||||
G_CALLBACK (gimp_image_map_tool_import_activate),
|
||||
G_CALLBACK (gimp_image_map_tool_settings_import),
|
||||
image_map_tool);
|
||||
|
||||
g_signal_connect (image_map_tool->settings_box, "export",
|
||||
G_CALLBACK (gimp_image_map_tool_export_activate),
|
||||
G_CALLBACK (gimp_image_map_tool_settings_export),
|
||||
image_map_tool);
|
||||
|
||||
return TRUE;
|
||||
|
@ -165,144 +166,10 @@ gimp_image_map_tool_real_settings_export (GimpImageMapTool *tool,
|
|||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_image_map_tool_import_activate (GtkWidget *widget,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
|
||||
gimp_image_map_tool_settings_dialog (tool, klass->import_dialog_title, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_tool_export_activate (GtkWidget *widget,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
|
||||
gimp_image_map_tool_settings_dialog (tool, klass->export_dialog_title, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
settings_dialog_response (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
gboolean save;
|
||||
|
||||
save = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "save"));
|
||||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
gchar *filename;
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
|
||||
if (save)
|
||||
gimp_image_map_tool_settings_export (tool, filename);
|
||||
else
|
||||
gimp_image_map_tool_settings_import (tool, filename);
|
||||
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
if (save)
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->import_item, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->export_item, TRUE);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_image_map_tool_settings_dialog (GimpImageMapTool *tool,
|
||||
const gchar *title,
|
||||
gboolean save)
|
||||
{
|
||||
GimpImageMapOptions *options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (tool);
|
||||
GtkFileChooser *chooser;
|
||||
const gchar *settings_name;
|
||||
gchar *folder;
|
||||
|
||||
settings_name = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->settings_name;
|
||||
|
||||
g_return_if_fail (settings_name != NULL);
|
||||
|
||||
if (tool->settings_dialog)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (tool->settings_dialog));
|
||||
return;
|
||||
}
|
||||
|
||||
if (save)
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->import_item, FALSE);
|
||||
else
|
||||
gtk_widget_set_sensitive (GIMP_SETTINGS_BOX (tool->settings_box)->export_item, FALSE);
|
||||
|
||||
tool->settings_dialog =
|
||||
gtk_file_chooser_dialog_new (title, GTK_WINDOW (tool->shell),
|
||||
save ?
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE :
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
save ? GTK_STOCK_SAVE : GTK_STOCK_OPEN,
|
||||
GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
chooser = GTK_FILE_CHOOSER (tool->settings_dialog);
|
||||
|
||||
g_object_set_data (G_OBJECT (chooser), "save", GINT_TO_POINTER (save));
|
||||
|
||||
gtk_window_set_role (GTK_WINDOW (chooser), "gimp-import-export-settings");
|
||||
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (chooser),
|
||||
(gpointer) &tool->settings_dialog);
|
||||
|
||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
|
||||
|
||||
if (save)
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
|
||||
|
||||
g_signal_connect (chooser, "response",
|
||||
G_CALLBACK (settings_dialog_response),
|
||||
tool);
|
||||
g_signal_connect (chooser, "delete-event",
|
||||
G_CALLBACK (gtk_true),
|
||||
NULL);
|
||||
|
||||
folder = g_build_filename (gimp_directory (), settings_name, NULL);
|
||||
|
||||
if (g_file_test (folder, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
gtk_file_chooser_add_shortcut_folder (chooser, folder, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (folder);
|
||||
folder = g_strdup (g_get_home_dir ());
|
||||
}
|
||||
|
||||
if (options->settings)
|
||||
gtk_file_chooser_set_filename (chooser, options->settings);
|
||||
else
|
||||
gtk_file_chooser_set_current_folder (chooser, folder);
|
||||
|
||||
g_free (folder);
|
||||
|
||||
gimp_help_connect (tool->settings_dialog, gimp_standard_help_func,
|
||||
GIMP_TOOL (tool)->tool_info->help_id, NULL);
|
||||
|
||||
gtk_widget_show (tool->settings_dialog);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_image_map_tool_settings_import (GimpImageMapTool *tool,
|
||||
const gchar *filename)
|
||||
gimp_image_map_tool_settings_import (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
GError *error = NULL;
|
||||
|
@ -328,8 +195,9 @@ gimp_image_map_tool_settings_import (GimpImageMapTool *tool,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gimp_image_map_tool_settings_export (GimpImageMapTool *tool,
|
||||
const gchar *filename)
|
||||
gimp_image_map_tool_settings_export (GimpSettingsBox *box,
|
||||
const gchar *filename,
|
||||
GimpImageMapTool *tool)
|
||||
{
|
||||
GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
|
||||
GError *error = NULL;
|
||||
|
|
|
@ -190,16 +190,15 @@ gimp_image_map_tool_init (GimpImageMapTool *image_map_tool)
|
|||
GIMP_DIRTY_DRAWABLE |
|
||||
GIMP_DIRTY_SELECTION);
|
||||
|
||||
image_map_tool->drawable = NULL;
|
||||
image_map_tool->operation = NULL;
|
||||
image_map_tool->config = NULL;
|
||||
image_map_tool->image_map = NULL;
|
||||
image_map_tool->drawable = NULL;
|
||||
image_map_tool->operation = NULL;
|
||||
image_map_tool->config = NULL;
|
||||
image_map_tool->image_map = NULL;
|
||||
|
||||
image_map_tool->shell = NULL;
|
||||
image_map_tool->main_vbox = NULL;
|
||||
image_map_tool->settings_box = NULL;
|
||||
image_map_tool->label_group = NULL;
|
||||
image_map_tool->settings_dialog = NULL;
|
||||
image_map_tool->shell = NULL;
|
||||
image_map_tool->main_vbox = NULL;
|
||||
image_map_tool->settings_box = NULL;
|
||||
image_map_tool->label_group = NULL;
|
||||
}
|
||||
|
||||
static GObject *
|
||||
|
|
|
@ -53,9 +53,6 @@ struct _GimpImageMapTool
|
|||
GtkWidget *main_vbox;
|
||||
GtkWidget *settings_box;
|
||||
GtkSizeGroup *label_group;
|
||||
|
||||
/* settings file dialog */
|
||||
GtkWidget *settings_dialog;
|
||||
};
|
||||
|
||||
struct _GimpImageMapToolClass
|
||||
|
|
|
@ -797,10 +797,10 @@ gimp_levels_tool_config_notify (GObject *object,
|
|||
gtk_adjustment_set_value (tool->high_input,
|
||||
config->high_input[config->channel] * 255.0);
|
||||
|
||||
tool->low_input->upper = tool->high_input->value;
|
||||
tool->high_input->lower = tool->low_input->value;
|
||||
tool->gamma_linear->lower = tool->low_input->value;
|
||||
tool->gamma_linear->upper = tool->high_input->value;
|
||||
tool->low_input->upper = gtk_adjustment_get_value (tool->high_input);
|
||||
tool->high_input->lower = gtk_adjustment_get_value (tool->low_input);
|
||||
tool->gamma_linear->lower = gtk_adjustment_get_value (tool->low_input);
|
||||
tool->gamma_linear->upper = gtk_adjustment_get_value (tool->high_input);
|
||||
gtk_adjustment_changed (tool->low_input);
|
||||
gtk_adjustment_changed (tool->high_input);
|
||||
gtk_adjustment_changed (tool->gamma_linear);
|
||||
|
@ -938,10 +938,12 @@ levels_stretch_callback (GtkWidget *widget,
|
|||
static void
|
||||
levels_linear_gamma_update (GimpLevelsTool *tool)
|
||||
{
|
||||
gdouble low_input = gtk_adjustment_get_value (tool->low_input);
|
||||
gdouble high_input = gtk_adjustment_get_value (tool->high_input);
|
||||
gdouble delta, mid, tmp, value;
|
||||
|
||||
delta = (tool->high_input->value - tool->low_input->value) / 2.0;
|
||||
mid = tool->low_input->value + delta;
|
||||
delta = (high_input - low_input) / 2.0;
|
||||
mid = low_input + delta;
|
||||
tmp = log10 (1.0 / tool->config->gamma[tool->config->channel]);
|
||||
value = mid + delta * tmp;
|
||||
|
||||
|
@ -952,14 +954,16 @@ static void
|
|||
levels_linear_gamma_changed (GtkAdjustment *adjustment,
|
||||
GimpLevelsTool *tool)
|
||||
{
|
||||
gdouble low_input = gtk_adjustment_get_value (tool->low_input);
|
||||
gdouble high_input = gtk_adjustment_get_value (tool->high_input);
|
||||
gdouble delta, mid, tmp, value;
|
||||
|
||||
delta = (tool->high_input->value - tool->low_input->value) / 2.0;
|
||||
delta = (high_input - low_input) / 2.0;
|
||||
|
||||
if (delta >= 0.5)
|
||||
{
|
||||
mid = tool->low_input->value + delta;
|
||||
tmp = (adjustment->value - mid) / delta;
|
||||
mid = low_input + delta;
|
||||
tmp = (gtk_adjustment_get_value (adjustment) - mid) / delta;
|
||||
value = 1.0 / pow (10, tmp);
|
||||
|
||||
/* round the gamma value to the nearest 1/100th */
|
||||
|
@ -974,7 +978,7 @@ levels_low_input_changed (GtkAdjustment *adjustment,
|
|||
GimpLevelsTool *tool)
|
||||
{
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
gint value = ROUND (gtk_adjustment_get_value (adjustment));
|
||||
|
||||
tool->high_input->lower = value;
|
||||
tool->gamma_linear->lower = value;
|
||||
|
@ -996,11 +1000,12 @@ levels_gamma_changed (GtkAdjustment *adjustment,
|
|||
GimpLevelsTool *tool)
|
||||
{
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gdouble value = gtk_adjustment_get_value (adjustment);
|
||||
|
||||
if (config->gamma[config->channel] != adjustment->value)
|
||||
if (config->gamma[config->channel] != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
"gamma", adjustment->value,
|
||||
"gamma", value,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -1012,7 +1017,7 @@ levels_high_input_changed (GtkAdjustment *adjustment,
|
|||
GimpLevelsTool *tool)
|
||||
{
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
gint value = ROUND (gtk_adjustment_get_value (adjustment));
|
||||
|
||||
tool->low_input->upper = value;
|
||||
tool->gamma_linear->upper = value;
|
||||
|
@ -1034,7 +1039,7 @@ levels_low_output_changed (GtkAdjustment *adjustment,
|
|||
GimpLevelsTool *tool)
|
||||
{
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
gint value = ROUND (gtk_adjustment_get_value (adjustment));
|
||||
|
||||
if (config->low_output[config->channel] != value / 255.0)
|
||||
{
|
||||
|
@ -1049,7 +1054,7 @@ levels_high_output_changed (GtkAdjustment *adjustment,
|
|||
GimpLevelsTool *tool)
|
||||
{
|
||||
GimpLevelsConfig *config = tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
gint value = ROUND (gtk_adjustment_get_value (adjustment));
|
||||
|
||||
if (config->high_output[config->channel] != value / 255.0)
|
||||
{
|
||||
|
|
|
@ -183,7 +183,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
gboolean rtl = gtk_widget_get_direction (vbox) == GTK_TEXT_DIR_RTL;
|
||||
|
||||
frame = gimp_prop_expander_new (config, "dynamics-expanded",
|
||||
_("Dynamics sensitivity"));
|
||||
_("Brush Dynamics"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
|
@ -235,7 +235,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
|
|||
for (i = 0; i < n_dynamics; i++)
|
||||
{
|
||||
gtk_label_set_angle (GTK_LABEL (dynamics_labels[i]),
|
||||
rtl ? 45 : 315);
|
||||
rtl ? 315 : 45);
|
||||
gtk_misc_set_alignment (GTK_MISC (dynamics_labels[i]), 1.0, 1.0);
|
||||
gtk_fixed_put (GTK_FIXED (fixed), dynamics_labels[i], 0, 0);
|
||||
gtk_widget_show (dynamics_labels[i]);
|
||||
|
@ -299,10 +299,10 @@ static gboolean
|
|||
tool_has_opacity_dynamics (GType tool_type)
|
||||
{
|
||||
return (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
|
||||
tool_type == GIMP_TYPE_CLONE_TOOL ||
|
||||
tool_type == GIMP_TYPE_HEAL_TOOL ||
|
||||
tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
|
||||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
|
||||
tool_type == GIMP_TYPE_CLONE_TOOL ||
|
||||
tool_type == GIMP_TYPE_HEAL_TOOL ||
|
||||
tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
|
||||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
|
||||
tool_type == GIMP_TYPE_ERASER_TOOL);
|
||||
}
|
||||
|
||||
|
@ -314,6 +314,7 @@ tool_has_hardness_dynamics (GType tool_type)
|
|||
tool_type == GIMP_TYPE_HEAL_TOOL ||
|
||||
tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
|
||||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
||||
tool_type == GIMP_TYPE_ERASER_TOOL ||
|
||||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
|
||||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
||||
tool_type == GIMP_TYPE_SMUDGE_TOOL);
|
||||
|
@ -322,23 +323,21 @@ tool_has_hardness_dynamics (GType tool_type)
|
|||
static gboolean
|
||||
tool_has_rate_dynamics (GType tool_type)
|
||||
{
|
||||
return (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
||||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
||||
return (tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
||||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
||||
tool_type == GIMP_TYPE_SMUDGE_TOOL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
tool_has_size_dynamics (GType tool_type)
|
||||
{
|
||||
return (tool_type == GIMP_TYPE_CLONE_TOOL ||
|
||||
return (g_type_is_a (tool_type, GIMP_TYPE_PAINTBRUSH_TOOL) ||
|
||||
tool_type == GIMP_TYPE_CLONE_TOOL ||
|
||||
tool_type == GIMP_TYPE_HEAL_TOOL ||
|
||||
tool_type == GIMP_TYPE_PERSPECTIVE_CLONE_TOOL ||
|
||||
tool_type == GIMP_TYPE_CONVOLVE_TOOL ||
|
||||
tool_type == GIMP_TYPE_DODGE_BURN_TOOL ||
|
||||
tool_type == GIMP_TYPE_ERASER_TOOL ||
|
||||
tool_type == GIMP_TYPE_PAINTBRUSH_TOOL ||
|
||||
tool_type == GIMP_TYPE_AIRBRUSH_TOOL ||
|
||||
tool_type == GIMP_TYPE_PENCIL_TOOL);
|
||||
tool_type == GIMP_TYPE_ERASER_TOOL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -373,9 +372,9 @@ dynamics_check_button_size_allocate (GtkWidget *toggle,
|
|||
gint x, y;
|
||||
|
||||
if (gtk_widget_get_direction (label) == GTK_TEXT_DIR_LTR)
|
||||
x = allocation->x + allocation->width - label->allocation.width;
|
||||
else
|
||||
x = allocation->x;
|
||||
else
|
||||
x = allocation->x + allocation->width - label->allocation.width;
|
||||
|
||||
x -= fixed->allocation.x;
|
||||
|
||||
|
|
|
@ -453,8 +453,11 @@ gimp_paint_tool_motion (GimpTool *tool,
|
|||
core->cur_coords.x -= off_x;
|
||||
core->cur_coords.y -= off_y;
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state,
|
||||
display);
|
||||
GIMP_TOOL_CLASS (parent_class)->motion (tool, coords, time, state, display);
|
||||
|
||||
/* don't paint while the Shift key is pressed for line drawing */
|
||||
if (paint_tool->draw_line)
|
||||
return;
|
||||
|
||||
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
|
||||
|
||||
|
@ -550,7 +553,7 @@ gimp_paint_tool_oper_update (GimpTool *tool,
|
|||
|
||||
gimp_tool_pop_status (tool, display);
|
||||
|
||||
if (tool->display &&
|
||||
if (tool->display &&
|
||||
tool->display != display &&
|
||||
tool->display->image == display->image)
|
||||
{
|
||||
|
|
|
@ -260,12 +260,11 @@ static void
|
|||
gimp_posterize_tool_levels_changed (GtkAdjustment *adjustment,
|
||||
GimpPosterizeTool *posterize_tool)
|
||||
{
|
||||
GimpPosterizeConfig *config = posterize_tool->config;
|
||||
gint value = ROUND (adjustment->value);
|
||||
gint value = ROUND (gtk_adjustment_get_value (adjustment));
|
||||
|
||||
if (config->levels != value)
|
||||
if (posterize_tool->config->levels != value)
|
||||
{
|
||||
g_object_set (config,
|
||||
g_object_set (posterize_tool->config,
|
||||
"levels", value,
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include "display/gimpdisplay.h"
|
||||
#include "display/gimpdisplayshell.h"
|
||||
#include "display/gimpdisplayshell-scroll.h"
|
||||
#include "display/gimpdisplayshell-transform.h"
|
||||
|
||||
#include "gimpdrawtool.h"
|
||||
|
@ -64,6 +65,7 @@ enum
|
|||
#define MIN_HANDLE_SIZE 15
|
||||
#define NARROW_MODE_HANDLE_SIZE 15
|
||||
#define NARROW_MODE_THRESHOLD 45
|
||||
#define CENTER_CROSS_SIZE 6
|
||||
|
||||
|
||||
#define SQRT5 2.236067977
|
||||
|
@ -1666,9 +1668,23 @@ gimp_rectangle_tool_draw (GimpDrawTool *draw_tool)
|
|||
switch (private->function)
|
||||
{
|
||||
case GIMP_RECTANGLE_TOOL_MOVING:
|
||||
|
||||
if (gimp_tool_control_is_active (tool->control))
|
||||
break;
|
||||
/* else fallthrough */
|
||||
{
|
||||
/* Mark the center because we snap to it */
|
||||
gimp_draw_tool_draw_cross_by_anchor (draw_tool,
|
||||
(pub_x1 + pub_x2) / 2.0,
|
||||
(pub_y1 + pub_y2) / 2.0,
|
||||
CENTER_CROSS_SIZE,
|
||||
CENTER_CROSS_SIZE,
|
||||
GTK_ANCHOR_CENTER,
|
||||
FALSE);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fallthrough */
|
||||
}
|
||||
|
||||
case GIMP_RECTANGLE_TOOL_DEAD:
|
||||
case GIMP_RECTANGLE_TOOL_CREATING:
|
||||
|
@ -1832,15 +1848,14 @@ gimp_rectangle_tool_update_handle_sizes (GimpRectangleTool *rect_tool)
|
|||
/* Calculate rectangles of the selection rectangle and the display shell,
|
||||
* with origin at (0, 0) of image, and in screen coordinate scale.
|
||||
*/
|
||||
gint x1 = pub_x1 * shell->scale_x;
|
||||
gint y1 = pub_y1 * shell->scale_y;
|
||||
gint w1 = (pub_x2 - pub_x1) * shell->scale_x;
|
||||
gint h1 = (pub_y2 - pub_y1) * shell->scale_y;
|
||||
gint x1 = pub_x1 * shell->scale_x;
|
||||
gint y1 = pub_y1 * shell->scale_y;
|
||||
gint w1 = (pub_x2 - pub_x1) * shell->scale_x;
|
||||
gint h1 = (pub_y2 - pub_y1) * shell->scale_y;
|
||||
|
||||
gint x2 = -shell->disp_xoffset + shell->offset_x;
|
||||
gint y2 = -shell->disp_yoffset + shell->offset_y;
|
||||
gint w2 = shell->disp_width;
|
||||
gint h2 = shell->disp_height;
|
||||
gint x2, y2, w2, h2;
|
||||
|
||||
gimp_display_shell_get_scaled_viewport (shell, &x2, &y2, &w2, &h2);
|
||||
|
||||
rectangle_width = w1;
|
||||
rectangle_height = h1;
|
||||
|
@ -1932,8 +1947,9 @@ gimp_rectangle_tool_scale_has_changed (GimpRectangleTool *rect_tool)
|
|||
|
||||
shell = GIMP_DISPLAY_SHELL (tool->display->shell);
|
||||
|
||||
return shell->scale_x != private->scale_x_used_for_handle_size_calculations ||
|
||||
shell->scale_y != private->scale_y_used_for_handle_size_calculations;
|
||||
return (shell->scale_x != private->scale_x_used_for_handle_size_calculations
|
||||
||
|
||||
shell->scale_y != private->scale_y_used_for_handle_size_calculations);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2177,10 +2193,8 @@ gimp_rectangle_tool_synthesize_motion (GimpRectangleTool *rect_tool,
|
|||
* signal which we don't want in the middle of a rectangle change.
|
||||
*/
|
||||
if (gimp_tool_control_is_active (GIMP_TOOL (rect_tool)->control))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
|
||||
|
||||
old_function = private->function;
|
||||
|
@ -2528,10 +2542,10 @@ gimp_rectangle_tool_coord_outside (GimpRectangleTool *rect_tool,
|
|||
y1_b = pub_y1 - (narrow_mode ? private->corner_handle_h / shell->scale_y : 0);
|
||||
y2_b = pub_y2 + (narrow_mode ? private->corner_handle_h / shell->scale_y : 0);
|
||||
|
||||
return coord->x < x1_b ||
|
||||
coord->x > x2_b ||
|
||||
coord->y < y1_b ||
|
||||
coord->y > y2_b;
|
||||
return (coord->x < x1_b ||
|
||||
coord->x > x2_b ||
|
||||
coord->y < y1_b ||
|
||||
coord->y > y2_b);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -130,49 +130,37 @@ gimp_rotate_tool_key_press (GimpTool *tool,
|
|||
GdkEventKey *kevent,
|
||||
GimpDisplay *display)
|
||||
{
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
GimpRotateTool *rotate = GIMP_ROTATE_TOOL (tool);
|
||||
gboolean handled_key = FALSE;
|
||||
GtkSpinButton *angle_spin = GTK_SPIN_BUTTON (rotate->angle_spin_button);
|
||||
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
|
||||
|
||||
if (display == draw_tool->display)
|
||||
{
|
||||
GimpRotateTool *rotate = GIMP_ROTATE_TOOL (tool);
|
||||
GtkSpinButton *angle_spin = GTK_SPIN_BUTTON (rotate->angle_spin_button);
|
||||
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
case GDK_Up:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_FORWARD, 0.0);
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case GDK_Down:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_STEP_BACKWARD, 0.0);
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case GDK_Left:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_FORWARD, 0.0);
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case GDK_Right:
|
||||
handled_key = TRUE;
|
||||
gtk_spin_button_spin (angle_spin, GTK_SPIN_PAGE_BACKWARD, 0.0);
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
handled_key = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! handled_key)
|
||||
{
|
||||
handled_key = GIMP_TOOL_CLASS (parent_class)->key_press (tool,
|
||||
kevent,
|
||||
display);
|
||||
}
|
||||
|
||||
return handled_key;
|
||||
return GIMP_TOOL_CLASS (parent_class)->key_press (tool, kevent, display);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -0,0 +1,226 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (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
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
#include <dbus/dbus-glib.h>
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "core/core-types.h"
|
||||
|
||||
#include "file/file-utils.h"
|
||||
|
||||
#include "unique.h"
|
||||
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
static gboolean gimp_unique_dbus_open (const gchar **filenames,
|
||||
gboolean as_new);
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
static gboolean gimp_unique_win32_open (const gchar **filenames,
|
||||
gboolean as_new);
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
gimp_unique_open (const gchar **filenames,
|
||||
gboolean as_new)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
return gimp_unique_win32_open (filenames, as_new);
|
||||
#elif HAVE_DBUS_GLIB
|
||||
return gimp_unique_dbus_open (filenames, as_new);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gimp_unique_filename_to_uri (const gchar *filename,
|
||||
const gchar *cwd,
|
||||
GError **error)
|
||||
{
|
||||
gchar *uri = NULL;
|
||||
|
||||
if (file_utils_filename_is_uri (filename, error))
|
||||
{
|
||||
uri = g_strdup (filename);
|
||||
}
|
||||
else if (! *error)
|
||||
{
|
||||
if (! g_path_is_absolute (filename))
|
||||
{
|
||||
gchar *absolute = g_build_filename (cwd, filename, NULL);
|
||||
|
||||
uri = g_filename_to_uri (absolute, NULL, error);
|
||||
|
||||
g_free (absolute);
|
||||
}
|
||||
else
|
||||
{
|
||||
uri = g_filename_to_uri (filename, NULL, error);
|
||||
}
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
#if HAVE_DBUS_GLIB
|
||||
|
||||
static gboolean
|
||||
gimp_unique_dbus_open (const gchar **filenames,
|
||||
gboolean as_new)
|
||||
{
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
|
||||
/* for the DBus service names */
|
||||
#include "widgets/gimpdbusservice.h"
|
||||
|
||||
DBusGConnection *connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
|
||||
|
||||
if (connection)
|
||||
{
|
||||
DBusGProxy *proxy;
|
||||
gboolean success;
|
||||
GError *error = NULL;
|
||||
|
||||
proxy = dbus_g_proxy_new_for_name (connection,
|
||||
GIMP_DBUS_SERVICE_NAME,
|
||||
GIMP_DBUS_SERVICE_PATH,
|
||||
GIMP_DBUS_SERVICE_INTERFACE);
|
||||
|
||||
if (filenames)
|
||||
{
|
||||
const gchar *method = as_new ? "OpenAsNew" : "Open";
|
||||
gchar *cwd = g_get_current_dir ();
|
||||
gint i;
|
||||
|
||||
for (i = 0, success = TRUE; filenames[i] && success; i++)
|
||||
{
|
||||
gchar *uri = gimp_unique_filename_to_uri (filenames[i],
|
||||
cwd, &error);
|
||||
|
||||
if (uri)
|
||||
{
|
||||
gboolean retval; /* ignored */
|
||||
|
||||
success = dbus_g_proxy_call (proxy, method, &error,
|
||||
G_TYPE_STRING, uri,
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_BOOLEAN, &retval,
|
||||
G_TYPE_INVALID);
|
||||
g_free (uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr ("conversion to uri failed: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (cwd);
|
||||
}
|
||||
else
|
||||
{
|
||||
success = dbus_g_proxy_call (proxy, "Activate", &error,
|
||||
G_TYPE_INVALID, G_TYPE_INVALID);
|
||||
}
|
||||
|
||||
g_object_unref (proxy);
|
||||
dbus_g_connection_unref (connection);
|
||||
|
||||
if (success)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else if (! (error->domain == DBUS_GERROR &&
|
||||
error->code == DBUS_GERROR_SERVICE_UNKNOWN))
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
}
|
||||
|
||||
g_clear_error (&error);
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /* HAVE_DBUS_GLIB */
|
||||
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
static gboolean
|
||||
gimp_unique_win32_open (const gchar **filenames,
|
||||
gboolean as_new)
|
||||
{
|
||||
#ifndef GIMP_CONSOLE_COMPILATION
|
||||
|
||||
/* for the proxy window names */
|
||||
#include "gui/gui-unique.h"
|
||||
|
||||
HWND window_handle = FindWindowW (GIMP_UNIQUE_WIN32_WINDOW_CLASS,
|
||||
GIMP_UNIQUE_WIN32_WINDOW_NAME);
|
||||
|
||||
if (window_handle)
|
||||
{
|
||||
COPYDATASTRUCT copydata;
|
||||
gchar *cwd = g_get_current_dir ();
|
||||
GError *error = NULL;
|
||||
gint i;
|
||||
|
||||
for (i = 0; filenames[i]; i++)
|
||||
{
|
||||
gchar *uri = gimp_unique_filename_to_uri (filenames[i], cwd, &error);
|
||||
|
||||
if (uri)
|
||||
{
|
||||
copydata.lpData = uri;
|
||||
copydata.cbData = strlen (uri) + 1; /* size in bytes */
|
||||
copydata.dwData = (long) as_new;
|
||||
|
||||
SendMessage (window_handle,
|
||||
WM_COPYDATA, window_handle, ©data);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_printerr ("conversion to uri failed: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (cwd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /* G_OS_WIN32 */
|
|
@ -0,0 +1,27 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (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
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __UNIQUE_H__
|
||||
#define __UNIQUE_H__
|
||||
|
||||
|
||||
gboolean gimp_unique_open (const gchar **filenames,
|
||||
gboolean as_new);
|
||||
|
||||
|
||||
#endif /* __UNIQUE_H__ */
|
|
@ -22,7 +22,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <cairo/cairo.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
|
|
@ -259,6 +259,8 @@ libappwidgets_a_sources = \
|
|||
gimpsessioninfo-dockable.h \
|
||||
gimpsettingsbox.c \
|
||||
gimpsettingsbox.h \
|
||||
gimpsettingseditor.c \
|
||||
gimpsettingseditor.h \
|
||||
gimpsizebox.c \
|
||||
gimpsizebox.h \
|
||||
gimpstringaction.c \
|
||||
|
@ -343,6 +345,8 @@ libappwidgets_a_sources = \
|
|||
gimpwidgets-utils.h \
|
||||
gimpwindow.c \
|
||||
gimpwindow.h \
|
||||
gtkscalebutton.c \
|
||||
gtkscalebutton.h \
|
||||
gtkwrapbox.c \
|
||||
gtkwrapbox.h \
|
||||
gtkhwrapbox.c \
|
||||
|
|
|
@ -128,9 +128,10 @@ gimp_action_class_init (GimpActionClass *klass)
|
|||
static void
|
||||
gimp_action_init (GimpAction *action)
|
||||
{
|
||||
action->color = NULL;
|
||||
action->viewable = NULL;
|
||||
action->ellipsize = PANGO_ELLIPSIZE_NONE;
|
||||
action->color = NULL;
|
||||
action->viewable = NULL;
|
||||
action->ellipsize = PANGO_ELLIPSIZE_NONE;
|
||||
action->max_width_chars = -1;
|
||||
|
||||
g_signal_connect (action, "notify::tooltip",
|
||||
G_CALLBACK (gimp_action_tooltip_notify),
|
||||
|
@ -301,32 +302,26 @@ gimp_action_set_proxy (GimpAction *action,
|
|||
|
||||
area = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (proxy));
|
||||
|
||||
if (area && ! GIMP_IS_COLOR_AREA (area))
|
||||
if (GIMP_IS_COLOR_AREA (area))
|
||||
{
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), NULL);
|
||||
area = NULL;
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (area), action->color);
|
||||
}
|
||||
|
||||
if (! area)
|
||||
else
|
||||
{
|
||||
GtkSettings *settings = gtk_widget_get_settings (proxy);
|
||||
gint width, height;
|
||||
gint width, height;
|
||||
|
||||
area = gimp_color_area_new (action->color,
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS, 0);
|
||||
gimp_color_area_set_draw_border (GIMP_COLOR_AREA (area), TRUE);
|
||||
|
||||
gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (proxy),
|
||||
GTK_ICON_SIZE_MENU,
|
||||
&width, &height);
|
||||
|
||||
gtk_widget_set_size_request (area, width, height);
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), area);
|
||||
gtk_widget_show (area);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_color_area_set_color (GIMP_COLOR_AREA (area), action->color);
|
||||
}
|
||||
}
|
||||
else if (action->viewable)
|
||||
{
|
||||
|
@ -334,20 +329,17 @@ gimp_action_set_proxy (GimpAction *action,
|
|||
|
||||
view = gtk_image_menu_item_get_image (GTK_IMAGE_MENU_ITEM (proxy));
|
||||
|
||||
if (view && (! GIMP_IS_VIEW (view) ||
|
||||
! g_type_is_a (G_TYPE_FROM_INSTANCE (action->viewable),
|
||||
GIMP_VIEW (view)->renderer->viewable_type)))
|
||||
if (GIMP_IS_VIEW (view) &&
|
||||
g_type_is_a (G_TYPE_FROM_INSTANCE (action->viewable),
|
||||
GIMP_VIEW (view)->renderer->viewable_type))
|
||||
{
|
||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), NULL);
|
||||
view = NULL;
|
||||
gimp_view_set_viewable (GIMP_VIEW (view), action->viewable);
|
||||
}
|
||||
|
||||
if (! view)
|
||||
else
|
||||
{
|
||||
GtkSettings *settings = gtk_widget_get_settings (proxy);
|
||||
GtkIconSize size;
|
||||
gint width, height;
|
||||
gint border_width;
|
||||
GtkIconSize size;
|
||||
gint width, height;
|
||||
gint border_width;
|
||||
|
||||
if (GIMP_IS_IMAGEFILE (action->viewable))
|
||||
{
|
||||
|
@ -360,7 +352,8 @@ gimp_action_set_proxy (GimpAction *action,
|
|||
border_width = 1;
|
||||
}
|
||||
|
||||
gtk_icon_size_lookup_for_settings (settings, size, &width, &height);
|
||||
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (proxy),
|
||||
size, &width, &height);
|
||||
|
||||
view = gimp_view_new_full (action->context, action->viewable,
|
||||
width, height, border_width,
|
||||
|
@ -368,10 +361,6 @@ gimp_action_set_proxy (GimpAction *action,
|
|||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (proxy), view);
|
||||
gtk_widget_show (view);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_view_set_viewable (GIMP_VIEW (view), action->viewable);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -341,8 +341,10 @@ gimp_action_view_new (GimpUIManager *manager,
|
|||
gtk_tree_view_column_set_title (column, _("Shortcut"));
|
||||
|
||||
cell = gtk_cell_renderer_accel_new ();
|
||||
cell->mode = GTK_CELL_RENDERER_MODE_EDITABLE;
|
||||
GTK_CELL_RENDERER_TEXT (cell)->editable = TRUE;
|
||||
g_object_set (cell,
|
||||
"mode", GTK_CELL_RENDERER_MODE_EDITABLE,
|
||||
"editable", TRUE,
|
||||
NULL);
|
||||
gtk_tree_view_column_pack_start (column, cell, TRUE);
|
||||
gtk_tree_view_column_set_attributes (column, cell,
|
||||
"accel-key",
|
||||
|
|
|
@ -188,6 +188,7 @@ gimp_blob_editor_expose (GtkWidget *widget,
|
|||
GdkEventExpose *event)
|
||||
{
|
||||
GimpBlobEditor *editor = GIMP_BLOB_EDITOR (widget);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
cairo_t *cr;
|
||||
GdkRectangle rect;
|
||||
gint r0;
|
||||
|
@ -208,10 +209,10 @@ gimp_blob_editor_expose (GtkWidget *widget,
|
|||
|
||||
cairo_rectangle (cr,
|
||||
rect.x + 0.5, rect.y + 0.5, rect.width - 1, rect.width - 1);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->light[widget->state]);
|
||||
gdk_cairo_set_source_color (cr, &style->light[widget->state]);
|
||||
cairo_fill_preserve (cr);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &widget->style->dark[widget->state]);
|
||||
gdk_cairo_set_source_color (cr, &style->dark[widget->state]);
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_stroke (cr);
|
||||
|
||||
|
@ -319,6 +320,7 @@ gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
|
|||
gdouble radius)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (editor);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
Blob *blob;
|
||||
BlobFunc function = blob_ellipse;
|
||||
gint i;
|
||||
|
@ -373,6 +375,6 @@ gimp_blob_editor_draw_blob (GimpBlobEditor *editor,
|
|||
|
||||
g_free (blob);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &widget->style->fg[widget->state]);
|
||||
gdk_cairo_set_source_color (cr, &style->fg[widget->state]);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
|
|
@ -347,12 +347,12 @@ gimp_brush_editor_update_brush (GtkAdjustment *adjustment,
|
|||
|
||||
brush = GIMP_BRUSH_GENERATED (GIMP_DATA_EDITOR (editor)->data);
|
||||
|
||||
radius = editor->radius_data->value;
|
||||
spikes = ROUND (editor->spikes_data->value);
|
||||
hardness = editor->hardness_data->value;
|
||||
ratio = editor->aspect_ratio_data->value;
|
||||
angle = editor->angle_data->value;
|
||||
spacing = editor->spacing_data->value;
|
||||
radius = gtk_adjustment_get_value (editor->radius_data);
|
||||
spikes = ROUND (gtk_adjustment_get_value (editor->spikes_data));
|
||||
hardness = gtk_adjustment_get_value (editor->hardness_data);
|
||||
ratio = gtk_adjustment_get_value (editor->aspect_ratio_data);
|
||||
angle = gtk_adjustment_get_value (editor->angle_data);
|
||||
spacing = gtk_adjustment_get_value (editor->spacing_data);
|
||||
|
||||
if (radius != gimp_brush_generated_get_radius (brush) ||
|
||||
spikes != gimp_brush_generated_get_spikes (brush) ||
|
||||
|
|
|
@ -155,7 +155,7 @@ gimp_brush_factory_view_new (GimpViewType view_type,
|
|||
|
||||
/* eek */
|
||||
gtk_box_pack_end (GTK_BOX (editor->view),
|
||||
factory_view->spacing_scale->parent,
|
||||
gtk_widget_get_parent (factory_view->spacing_scale),
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
factory_view->spacing_changed_handler_id =
|
||||
|
@ -242,7 +242,7 @@ gimp_brush_factory_view_spacing_update (GtkAdjustment *adjustment,
|
|||
gimp_brush_factory_view_spacing_changed,
|
||||
view);
|
||||
|
||||
gimp_brush_set_spacing (brush, adjustment->value);
|
||||
gimp_brush_set_spacing (brush, gtk_adjustment_get_value (adjustment));
|
||||
|
||||
g_signal_handlers_unblock_by_func (brush,
|
||||
gimp_brush_factory_view_spacing_changed,
|
||||
|
|
|
@ -168,7 +168,7 @@ gimp_brush_select_constructor (GType type,
|
|||
gtk_widget_show (dialog->view);
|
||||
|
||||
/* Create the frame and the table for the options */
|
||||
table = GIMP_BRUSH_FACTORY_VIEW (dialog->view)->spacing_scale->parent;
|
||||
table = gtk_widget_get_parent (GIMP_BRUSH_FACTORY_VIEW (dialog->view)->spacing_scale);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
|
||||
|
@ -332,7 +332,7 @@ gimp_brush_select_opacity_update (GtkAdjustment *adjustment,
|
|||
GimpBrushSelect *select)
|
||||
{
|
||||
gimp_context_set_opacity (GIMP_PDB_DIALOG (select)->context,
|
||||
adjustment->value / 100.0);
|
||||
gtk_adjustment_get_value (adjustment) / 100.0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -353,9 +353,11 @@ static void
|
|||
gimp_brush_select_spacing_update (GtkAdjustment *adjustment,
|
||||
GimpBrushSelect *select)
|
||||
{
|
||||
if (select->spacing != adjustment->value)
|
||||
gdouble value = gtk_adjustment_get_value (adjustment);
|
||||
|
||||
if (select->spacing != value)
|
||||
{
|
||||
select->spacing = adjustment->value;
|
||||
select->spacing = value;
|
||||
|
||||
gimp_pdb_dialog_run_callback (GIMP_PDB_DIALOG (select), FALSE);
|
||||
}
|
||||
|
|
|
@ -191,6 +191,7 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
|
|||
GtkCellRendererState flags)
|
||||
{
|
||||
GimpCellRendererDashes *dashes = GIMP_CELL_RENDERER_DASHES (cell);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GtkStateType state;
|
||||
cairo_t *cr;
|
||||
gint width;
|
||||
|
@ -240,7 +241,7 @@ gimp_cell_renderer_dashes_render (GtkCellRenderer *cell,
|
|||
}
|
||||
}
|
||||
|
||||
gdk_cairo_set_source_color (cr, &widget->style->text[state]);
|
||||
gdk_cairo_set_source_color (cr, &style->text[state]);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
|
|
@ -123,7 +123,9 @@ gimp_cell_renderer_viewable_class_init (GimpCellRendererViewableClass *klass)
|
|||
static void
|
||||
gimp_cell_renderer_viewable_init (GimpCellRendererViewable *cellviewable)
|
||||
{
|
||||
GTK_CELL_RENDERER (cellviewable)->mode = GTK_CELL_RENDERER_MODE_ACTIVATABLE;
|
||||
g_object_set (cellviewable,
|
||||
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -154,15 +154,15 @@ static gboolean
|
|||
gimp_color_bar_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
|
||||
GimpColorBar *bar = GIMP_COLOR_BAR (widget);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
guchar *buf;
|
||||
guchar *b;
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
gint i, j;
|
||||
|
||||
x = GTK_CONTAINER (bar)->border_width;
|
||||
y = GTK_CONTAINER (bar)->border_width;
|
||||
x = y = gtk_container_get_border_width (GTK_CONTAINER (bar));
|
||||
|
||||
width = widget->allocation.width - 2 * x;
|
||||
height = widget->allocation.height - 2 * y;
|
||||
|
@ -205,7 +205,7 @@ gimp_color_bar_expose (GtkWidget *widget,
|
|||
break;
|
||||
}
|
||||
|
||||
gdk_draw_rgb_image (widget->window, widget->style->black_gc,
|
||||
gdk_draw_rgb_image (widget->window, style->black_gc,
|
||||
widget->allocation.x + x, widget->allocation.y + y,
|
||||
width, height,
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
|
|
|
@ -582,7 +582,7 @@ static void
|
|||
gimp_color_editor_tab_toggled (GtkWidget *widget,
|
||||
GimpColorEditor *editor)
|
||||
{
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
||||
{
|
||||
GtkWidget *selector;
|
||||
|
||||
|
|
|
@ -271,13 +271,14 @@ gimp_color_frame_expose (GtkWidget *widget,
|
|||
|
||||
if (frame->has_number)
|
||||
{
|
||||
cairo_t *cr;
|
||||
gchar buf[8];
|
||||
gint w, h;
|
||||
gdouble scale;
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
cairo_t *cr;
|
||||
gchar buf[8];
|
||||
gint w, h;
|
||||
gdouble scale;
|
||||
|
||||
cr = gdk_cairo_create (widget->window);
|
||||
gdk_cairo_set_source_color (cr, &widget->style->light[GTK_STATE_NORMAL]);
|
||||
gdk_cairo_set_source_color (cr, &style->light[GTK_STATE_NORMAL]);
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", frame->number);
|
||||
|
||||
|
|
|
@ -829,7 +829,9 @@ gimp_colormap_adjustment_changed (GtkAdjustment *adjustment,
|
|||
|
||||
if (HAVE_COLORMAP (image))
|
||||
{
|
||||
gimp_colormap_editor_set_index (editor, adjustment->value + 0.5, NULL);
|
||||
gint index = ROUND (gtk_adjustment_get_value (adjustment));
|
||||
|
||||
gimp_colormap_editor_set_index (editor, index, NULL);
|
||||
|
||||
gimp_colormap_editor_update_entries (editor);
|
||||
}
|
||||
|
|
|
@ -286,6 +286,7 @@ gimp_component_editor_set_view_size (GimpComponentEditor *editor,
|
|||
gint view_size)
|
||||
{
|
||||
GtkWidget *tree_widget;
|
||||
GtkStyle *tree_style;
|
||||
GtkIconSize icon_size;
|
||||
GtkTreeIter iter;
|
||||
gboolean iter_valid;
|
||||
|
@ -295,14 +296,15 @@ gimp_component_editor_set_view_size (GimpComponentEditor *editor,
|
|||
view_size <= GIMP_VIEWABLE_MAX_PREVIEW_SIZE);
|
||||
|
||||
tree_widget = GTK_WIDGET (editor->view);
|
||||
tree_style = gtk_widget_get_style (tree_widget);
|
||||
|
||||
icon_size = gimp_get_icon_size (tree_widget,
|
||||
GIMP_STOCK_VISIBLE,
|
||||
GTK_ICON_SIZE_BUTTON,
|
||||
view_size -
|
||||
2 * tree_widget->style->xthickness,
|
||||
2 * tree_style->xthickness,
|
||||
view_size -
|
||||
2 * tree_widget->style->ythickness);
|
||||
2 * tree_style->ythickness);
|
||||
|
||||
g_object_set (editor->eye_cell,
|
||||
"stock-size", icon_size,
|
||||
|
|
|
@ -106,6 +106,7 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
|
|||
{
|
||||
GimpContainerView *view;
|
||||
GtkScrolledWindowClass *sw_class;
|
||||
GtkStyle *sw_style;
|
||||
GtkRequisition req;
|
||||
gint view_size;
|
||||
gint scrollbar_width;
|
||||
|
@ -134,11 +135,12 @@ gimp_container_box_set_size_request (GimpContainerBox *box,
|
|||
&req);
|
||||
scrollbar_width += req.width;
|
||||
|
||||
border_x = GTK_CONTAINER (box)->border_width;
|
||||
border_y = GTK_CONTAINER (box)->border_width;
|
||||
border_x = border_y = gtk_container_get_border_width (GTK_CONTAINER (box));
|
||||
|
||||
border_x += box->scrolled_win->style->xthickness * 2 + scrollbar_width;
|
||||
border_y += box->scrolled_win->style->ythickness * 2;
|
||||
sw_style = gtk_widget_get_style (box->scrolled_win);
|
||||
|
||||
border_x += sw_style->xthickness * 2 + scrollbar_width;
|
||||
border_y += sw_style->ythickness * 2;
|
||||
|
||||
gtk_widget_set_size_request (box->scrolled_win,
|
||||
width > 0 ? width + border_x : -1,
|
||||
|
|
|
@ -43,12 +43,6 @@ enum
|
|||
PROP_ELLIPSIZE = GIMP_CONTAINER_VIEW_PROP_LAST + 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_RENDERER,
|
||||
COLUMN_NAME,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
static void gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *iface);
|
||||
|
||||
|
@ -144,7 +138,7 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
|
|||
GtkCellLayout *layout;
|
||||
GtkCellRenderer *cell;
|
||||
|
||||
store = gtk_list_store_new (NUM_COLUMNS,
|
||||
store = gtk_list_store_new (GIMP_CONTAINER_COMBO_BOX_N_COLUMNS,
|
||||
GIMP_TYPE_VIEW_RENDERER,
|
||||
G_TYPE_STRING);
|
||||
|
||||
|
@ -157,7 +151,8 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
|
|||
cell = gimp_cell_renderer_viewable_new ();
|
||||
gtk_cell_layout_pack_start (layout, cell, FALSE);
|
||||
gtk_cell_layout_set_attributes (layout, cell,
|
||||
"renderer", COLUMN_RENDERER,
|
||||
"renderer",
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER,
|
||||
NULL);
|
||||
|
||||
combo_box->viewable_renderer = cell;
|
||||
|
@ -165,7 +160,8 @@ gimp_container_combo_box_init (GimpContainerComboBox *combo_box)
|
|||
cell = gtk_cell_renderer_text_new ();
|
||||
gtk_cell_layout_pack_start (layout, cell, TRUE);
|
||||
gtk_cell_layout_set_attributes (layout, cell,
|
||||
"text", COLUMN_NAME,
|
||||
"text",
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME,
|
||||
NULL);
|
||||
|
||||
combo_box->text_renderer = cell;
|
||||
|
@ -277,8 +273,8 @@ gimp_container_combo_box_set (GimpContainerComboBox *combo_box,
|
|||
view);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), iter,
|
||||
COLUMN_RENDERER, renderer,
|
||||
COLUMN_NAME, name,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME, name,
|
||||
-1);
|
||||
|
||||
g_object_unref (renderer);
|
||||
|
@ -308,7 +304,7 @@ gimp_container_combo_box_set_context (GimpContainerView *view,
|
|||
GimpViewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_view_renderer_set_context (renderer, context);
|
||||
|
@ -429,7 +425,7 @@ gimp_container_combo_box_rename_item (GimpContainerView *view,
|
|||
gchar *name = gimp_viewable_get_description (viewable, NULL);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), iter,
|
||||
COLUMN_NAME, name,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME, name,
|
||||
-1);
|
||||
|
||||
g_free (name);
|
||||
|
@ -494,7 +490,7 @@ gimp_container_combo_box_set_view_size (GimpContainerView *view)
|
|||
GimpViewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_view_renderer_set_size (renderer, view_size, border_width);
|
||||
|
@ -516,7 +512,7 @@ gimp_container_combo_box_changed (GtkComboBox *combo_box,
|
|||
GimpViewRenderer *renderer;
|
||||
|
||||
gtk_tree_model_get (gtk_combo_box_get_model (combo_box), &iter,
|
||||
COLUMN_RENDERER, &renderer,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER, &renderer,
|
||||
-1);
|
||||
|
||||
gimp_container_view_item_selected (view, renderer->viewable);
|
||||
|
|
|
@ -23,6 +23,14 @@
|
|||
#define __GIMP_CONTAINER_COMBO_BOX_H__
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_RENDERER,
|
||||
GIMP_CONTAINER_COMBO_BOX_COLUMN_NAME,
|
||||
GIMP_CONTAINER_COMBO_BOX_N_COLUMNS
|
||||
};
|
||||
|
||||
|
||||
#define GIMP_TYPE_CONTAINER_COMBO_BOX (gimp_container_combo_box_get_type ())
|
||||
#define GIMP_CONTAINER_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_CONTAINER_COMBO_BOX, GimpContainerComboBox))
|
||||
#define GIMP_CONTAINER_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_CONTAINER_COMBO_BOX, GimpContainerComboBoxClass))
|
||||
|
|
|
@ -179,6 +179,7 @@ static void
|
|||
gimp_container_grid_view_init (GimpContainerGridView *grid_view)
|
||||
{
|
||||
GimpContainerBox *box = GIMP_CONTAINER_BOX (grid_view);
|
||||
GtkWidget *viewport;
|
||||
|
||||
grid_view->rows = 1;
|
||||
grid_view->columns = 1;
|
||||
|
@ -195,14 +196,14 @@ gimp_container_grid_view_init (GimpContainerGridView *grid_view)
|
|||
grid_view->wrap_box = gtk_hwrap_box_new (FALSE);
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (box->scrolled_win),
|
||||
grid_view->wrap_box);
|
||||
gtk_viewport_set_shadow_type (GTK_VIEWPORT (grid_view->wrap_box->parent),
|
||||
GTK_SHADOW_NONE);
|
||||
viewport = gtk_widget_get_parent (grid_view->wrap_box);
|
||||
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
|
||||
gtk_widget_show (grid_view->wrap_box);
|
||||
|
||||
g_signal_connect (grid_view->wrap_box->parent, "size-allocate",
|
||||
g_signal_connect (viewport, "size-allocate",
|
||||
G_CALLBACK (gimp_container_grid_view_viewport_resized),
|
||||
grid_view);
|
||||
g_signal_connect (grid_view->wrap_box->parent, "button-press-event",
|
||||
g_signal_connect (viewport, "button-press-event",
|
||||
G_CALLBACK (gimp_container_grid_view_button_press),
|
||||
grid_view);
|
||||
|
||||
|
@ -374,8 +375,10 @@ gimp_container_grid_view_menu_position (GtkMenu *menu,
|
|||
}
|
||||
else
|
||||
{
|
||||
*x += widget->style->xthickness;
|
||||
*y += widget->style->ythickness;
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
|
||||
*x += style->xthickness;
|
||||
*y += style->ythickness;
|
||||
}
|
||||
|
||||
gimp_menu_position (menu, x, y);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue