mirror of https://github.com/GNOME/gimp.git
app/base/Makefile.am app/core/Makefile.am app/gui/Makefile.am added
2001-05-30 Michael Natterer <mitch@gimp.org> * app/base/Makefile.am * app/core/Makefile.am * app/gui/Makefile.am * app/paint-funcs/Makefile.am: added makefile.msc to EXTRA_DIST. * app/core/gimpimage.c: don't try to create previews with width or height < 1. * app/gui/color-notebook.c: Major (??) dialog repacking. Don't show an action_area for the main color selection (it's now about half the size of the 1.2 one). * libgimp/gimpcolorselector.h: define some gui size constants here. * app/gui/color-select.c * modules/colorsel_triangle.c * modules/colorsel_water.c: use the constants and removed the spacing around the main container. * libgimpwidgets/gimpcolorarea.[ch]: rendering in the idle loop fixes a race condition when accessing widget->window during widget resizing. * modules/Makefile.am: disabled the "GTK" color notebook page (we will put the GtkHSV widget of gtk+ 2.0 here). 2001-05-30 Michael Natterer <mitch@gimp.org> * libgimpmath/libgimpmath-docs.sgml: s/libgimpcolor/libgimpmath/.
This commit is contained in:
parent
80a22ec5fd
commit
11c2f6caee
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2001-05-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/base/Makefile.am
|
||||
* app/core/Makefile.am
|
||||
* app/gui/Makefile.am
|
||||
* app/paint-funcs/Makefile.am: added makefile.msc to EXTRA_DIST.
|
||||
|
||||
* app/core/gimpimage.c: don't try to create previews with width or
|
||||
height < 1.
|
||||
|
||||
* app/gui/color-notebook.c: Major (??) dialog repacking. Don't
|
||||
show an action_area for the main color selection (it's now about
|
||||
half the size of the 1.2 one).
|
||||
|
||||
* libgimp/gimpcolorselector.h: define some gui size constants
|
||||
here.
|
||||
|
||||
* app/gui/color-select.c
|
||||
* modules/colorsel_triangle.c
|
||||
* modules/colorsel_water.c: use the constants and removed the
|
||||
spacing around the main container.
|
||||
|
||||
* libgimpwidgets/gimpcolorarea.[ch]: rendering in the idle loop
|
||||
fixes a race condition when accessing widget->window during widget
|
||||
resizing.
|
||||
|
||||
* modules/Makefile.am: disabled the "GTK" color notebook page (we
|
||||
will put the GtkHSV widget of gtk+ 2.0 here).
|
||||
|
||||
2001-05-29 Simon Budig <simon@gimp.org>
|
||||
|
||||
* po/POTFILES.in: Added app/tools/gimpposterizetool.c
|
||||
|
|
|
@ -37,6 +37,9 @@ libappbase_la_SOURCES = \
|
|||
tile-swap.c \
|
||||
tile-swap.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
makefile.msc
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-Base\"
|
||||
|
||||
|
|
|
@ -82,6 +82,9 @@ libappcore_la_SOURCES = \
|
|||
gimpviewable.c \
|
||||
gimpviewable.h
|
||||
|
||||
EXTRS_DIST = \
|
||||
makefile.msc
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-Core\"
|
||||
|
||||
|
|
|
@ -4091,6 +4091,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
temp_buf_data_clear (comp);
|
||||
|
||||
floating_sel = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
|
@ -4101,16 +4102,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer
|
||||
they are attached to */
|
||||
* they are attached to
|
||||
*/
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
floating_sel = layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floating_sel &&
|
||||
if (floating_sel &&
|
||||
floating_sel->fs.drawable == GIMP_DRAWABLE (layer))
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
{
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
}
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
|
@ -4119,16 +4123,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
|
||||
construct_flag = FALSE;
|
||||
|
||||
while (reverse_list)
|
||||
for (; reverse_list; reverse_list = g_slist_next (reverse_list))
|
||||
{
|
||||
layer = (GimpLayer *) reverse_list->data;
|
||||
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||
|
||||
x = (gint) RINT (ratio * off_x);
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
continue;
|
||||
|
||||
x1 = CLAMP (x, 0, width);
|
||||
y1 = CLAMP (y, 0, height);
|
||||
|
@ -4207,8 +4214,6 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
}
|
||||
|
||||
construct_flag = TRUE;
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
||||
g_slist_free (reverse_list);
|
||||
|
|
|
@ -4091,6 +4091,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
temp_buf_data_clear (comp);
|
||||
|
||||
floating_sel = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
|
@ -4101,16 +4102,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer
|
||||
they are attached to */
|
||||
* they are attached to
|
||||
*/
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
floating_sel = layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floating_sel &&
|
||||
if (floating_sel &&
|
||||
floating_sel->fs.drawable == GIMP_DRAWABLE (layer))
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
{
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
}
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
|
@ -4119,16 +4123,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
|
||||
construct_flag = FALSE;
|
||||
|
||||
while (reverse_list)
|
||||
for (; reverse_list; reverse_list = g_slist_next (reverse_list))
|
||||
{
|
||||
layer = (GimpLayer *) reverse_list->data;
|
||||
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||
|
||||
x = (gint) RINT (ratio * off_x);
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
continue;
|
||||
|
||||
x1 = CLAMP (x, 0, width);
|
||||
y1 = CLAMP (y, 0, height);
|
||||
|
@ -4207,8 +4214,6 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
}
|
||||
|
||||
construct_flag = TRUE;
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
||||
g_slist_free (reverse_list);
|
||||
|
|
|
@ -4091,6 +4091,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
temp_buf_data_clear (comp);
|
||||
|
||||
floating_sel = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
|
@ -4101,16 +4102,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer
|
||||
they are attached to */
|
||||
* they are attached to
|
||||
*/
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
floating_sel = layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floating_sel &&
|
||||
if (floating_sel &&
|
||||
floating_sel->fs.drawable == GIMP_DRAWABLE (layer))
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
{
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
}
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
|
@ -4119,16 +4123,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
|
||||
construct_flag = FALSE;
|
||||
|
||||
while (reverse_list)
|
||||
for (; reverse_list; reverse_list = g_slist_next (reverse_list))
|
||||
{
|
||||
layer = (GimpLayer *) reverse_list->data;
|
||||
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||
|
||||
x = (gint) RINT (ratio * off_x);
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
continue;
|
||||
|
||||
x1 = CLAMP (x, 0, width);
|
||||
y1 = CLAMP (y, 0, height);
|
||||
|
@ -4207,8 +4214,6 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
}
|
||||
|
||||
construct_flag = TRUE;
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
||||
g_slist_free (reverse_list);
|
||||
|
|
|
@ -4091,6 +4091,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
temp_buf_data_clear (comp);
|
||||
|
||||
floating_sel = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
|
@ -4101,16 +4102,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer
|
||||
they are attached to */
|
||||
* they are attached to
|
||||
*/
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
floating_sel = layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floating_sel &&
|
||||
if (floating_sel &&
|
||||
floating_sel->fs.drawable == GIMP_DRAWABLE (layer))
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
{
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
}
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
|
@ -4119,16 +4123,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
|
||||
construct_flag = FALSE;
|
||||
|
||||
while (reverse_list)
|
||||
for (; reverse_list; reverse_list = g_slist_next (reverse_list))
|
||||
{
|
||||
layer = (GimpLayer *) reverse_list->data;
|
||||
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||
|
||||
x = (gint) RINT (ratio * off_x);
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
continue;
|
||||
|
||||
x1 = CLAMP (x, 0, width);
|
||||
y1 = CLAMP (y, 0, height);
|
||||
|
@ -4207,8 +4214,6 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
}
|
||||
|
||||
construct_flag = TRUE;
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
||||
g_slist_free (reverse_list);
|
||||
|
|
|
@ -4091,6 +4091,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
temp_buf_data_clear (comp);
|
||||
|
||||
floating_sel = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
|
@ -4101,16 +4102,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer
|
||||
they are attached to */
|
||||
* they are attached to
|
||||
*/
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
floating_sel = layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floating_sel &&
|
||||
if (floating_sel &&
|
||||
floating_sel->fs.drawable == GIMP_DRAWABLE (layer))
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
{
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
}
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
|
@ -4119,16 +4123,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
|
||||
construct_flag = FALSE;
|
||||
|
||||
while (reverse_list)
|
||||
for (; reverse_list; reverse_list = g_slist_next (reverse_list))
|
||||
{
|
||||
layer = (GimpLayer *) reverse_list->data;
|
||||
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||
|
||||
x = (gint) RINT (ratio * off_x);
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
continue;
|
||||
|
||||
x1 = CLAMP (x, 0, width);
|
||||
y1 = CLAMP (y, 0, height);
|
||||
|
@ -4207,8 +4214,6 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
}
|
||||
|
||||
construct_flag = TRUE;
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
||||
g_slist_free (reverse_list);
|
||||
|
|
|
@ -4091,6 +4091,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
temp_buf_data_clear (comp);
|
||||
|
||||
floating_sel = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
|
@ -4101,16 +4102,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer
|
||||
they are attached to */
|
||||
* they are attached to
|
||||
*/
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
floating_sel = layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floating_sel &&
|
||||
if (floating_sel &&
|
||||
floating_sel->fs.drawable == GIMP_DRAWABLE (layer))
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
{
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
}
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
|
@ -4119,16 +4123,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
|
||||
construct_flag = FALSE;
|
||||
|
||||
while (reverse_list)
|
||||
for (; reverse_list; reverse_list = g_slist_next (reverse_list))
|
||||
{
|
||||
layer = (GimpLayer *) reverse_list->data;
|
||||
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||
|
||||
x = (gint) RINT (ratio * off_x);
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
continue;
|
||||
|
||||
x1 = CLAMP (x, 0, width);
|
||||
y1 = CLAMP (y, 0, height);
|
||||
|
@ -4207,8 +4214,6 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
}
|
||||
|
||||
construct_flag = TRUE;
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
||||
g_slist_free (reverse_list);
|
||||
|
|
|
@ -4091,6 +4091,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
temp_buf_data_clear (comp);
|
||||
|
||||
floating_sel = NULL;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
|
@ -4101,16 +4102,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
if (gimp_drawable_get_visible (GIMP_DRAWABLE (layer)))
|
||||
{
|
||||
/* floating selections are added right above the layer
|
||||
they are attached to */
|
||||
* they are attached to
|
||||
*/
|
||||
if (gimp_layer_is_floating_sel (layer))
|
||||
{
|
||||
floating_sel = layer;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (floating_sel &&
|
||||
if (floating_sel &&
|
||||
floating_sel->fs.drawable == GIMP_DRAWABLE (layer))
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
{
|
||||
reverse_list = g_slist_prepend (reverse_list, floating_sel);
|
||||
}
|
||||
|
||||
reverse_list = g_slist_prepend (reverse_list, layer);
|
||||
}
|
||||
|
@ -4119,16 +4123,19 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
|
||||
construct_flag = FALSE;
|
||||
|
||||
while (reverse_list)
|
||||
for (; reverse_list; reverse_list = g_slist_next (reverse_list))
|
||||
{
|
||||
layer = (GimpLayer *) reverse_list->data;
|
||||
|
||||
gimp_drawable_offsets (GIMP_DRAWABLE (layer), &off_x, &off_y);
|
||||
|
||||
x = (gint) RINT (ratio * off_x);
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
y = (gint) RINT (ratio * off_y);
|
||||
w = (gint) RINT (ratio * gimp_drawable_width (GIMP_DRAWABLE (layer)));
|
||||
h = (gint) RINT (ratio * gimp_drawable_height (GIMP_DRAWABLE (layer)));
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
continue;
|
||||
|
||||
x1 = CLAMP (x, 0, width);
|
||||
y1 = CLAMP (y, 0, height);
|
||||
|
@ -4207,8 +4214,6 @@ gimp_image_get_new_preview (GimpViewable *viewable,
|
|||
}
|
||||
|
||||
construct_flag = TRUE;
|
||||
|
||||
reverse_list = g_slist_next (reverse_list);
|
||||
}
|
||||
|
||||
g_slist_free (reverse_list);
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "pixmaps/refresh.xpm"
|
||||
|
||||
|
||||
#define COLOR_AREA_SIZE 20
|
||||
#define COLOR_HISTORY_SIZE 16
|
||||
|
@ -55,7 +57,7 @@ typedef enum
|
|||
} ColorNotebookUpdateType;
|
||||
|
||||
|
||||
/* "class" information we keep on each registered colour selector */
|
||||
/* "class" information we keep on each registered color selector */
|
||||
|
||||
typedef struct _ColorSelectorInfo ColorSelectorInfo;
|
||||
|
||||
|
@ -123,6 +125,8 @@ static void color_notebook_ok_callback (GtkWidget *widget,
|
|||
gpointer data);
|
||||
static void color_notebook_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_reset_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_update_callback (gpointer data,
|
||||
const GimpHSV *hsv,
|
||||
const GimpRGB *rgb);
|
||||
|
@ -187,13 +191,14 @@ color_notebook_new (const gchar *title,
|
|||
ColorNotebook *cnp;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *main_hbox;
|
||||
GtkWidget *left_vbox;
|
||||
GtkWidget *right_vbox;
|
||||
GtkWidget *colors_frame;
|
||||
GtkWidget *color_frame;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
GtkWidget *arrow;
|
||||
GtkWidget *color_area;
|
||||
GimpRGB bw;
|
||||
|
@ -248,36 +253,66 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
if (wants_updates)
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
|
||||
wants_updates ? _("Close") : _("OK"),
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, wants_updates,
|
||||
wants_updates ? _("Revert to Old Color") : _("Cancel"),
|
||||
color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, !wants_updates,
|
||||
"_delete_event_", color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 6);
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (cnp->shell)->child)), 0)));
|
||||
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
|
||||
_("OK"), color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
_("Cancel"), color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
}
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
main_hbox = gtk_hbox_new (FALSE, 6);
|
||||
main_hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_add (GTK_CONTAINER (main_vbox), main_hbox);
|
||||
gtk_widget_show (main_hbox);
|
||||
|
||||
/* The left vbox with the notebook */
|
||||
left_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), left_vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (left_vbox);
|
||||
|
||||
/* The right vbox with color areas and color space sliders */
|
||||
right_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
|
||||
/* do we actually need a notebook? */
|
||||
if (selector_info->next)
|
||||
{
|
||||
cnp->notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), cnp->notebook,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_notebook_set_tab_border (GTK_NOTEBOOK (cnp->notebook), 0);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), cnp->notebook,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->notebook);
|
||||
}
|
||||
else /* only one selector */
|
||||
|
@ -316,8 +351,8 @@ color_notebook_new (const gchar *title,
|
|||
}
|
||||
else
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), csel->frame,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), csel->frame,
|
||||
TRUE, TRUE, 0);
|
||||
}
|
||||
|
||||
gtk_widget_show (csel->frame);
|
||||
|
@ -333,92 +368,114 @@ color_notebook_new (const gchar *title,
|
|||
info = info->next;
|
||||
}
|
||||
|
||||
/* The right vertical box with color areas and color space sliders */
|
||||
right_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
/* The table for the color_areas */
|
||||
table = gtk_table_new (2, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The hbox for the color_areas */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
/* The new color area */
|
||||
color_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (color_frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (color_frame, -1, COLOR_AREA_SIZE);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Current:"), 1.0, 0.5,
|
||||
color_frame, 1, FALSE);
|
||||
|
||||
cnp->new_color =
|
||||
gimp_color_area_new (&cnp->rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_container_add (GTK_CONTAINER (color_frame), cnp->new_color);
|
||||
gtk_widget_show (cnp->new_color);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->new_color), "color_changed",
|
||||
GTK_SIGNAL_FUNC (color_notebook_color_changed),
|
||||
cnp);
|
||||
|
||||
/* The old color area */
|
||||
color_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (color_frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (color_frame, -1, COLOR_AREA_SIZE);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
_("Old:"), 1.0, 0.5,
|
||||
color_frame, 1, FALSE);
|
||||
|
||||
cnp->orig_color =
|
||||
gimp_color_area_new (&cnp->orig_rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (cnp->orig_color);
|
||||
gtk_container_add (GTK_CONTAINER (color_frame), cnp->orig_color);
|
||||
gtk_widget_show (cnp->orig_color);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 4, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gimp_pixmap_new (refresh_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
gimp_help_set_help_data (button,
|
||||
_("Revert to old color"),
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_reset_callback),
|
||||
cnp);
|
||||
|
||||
vbox = gtk_vbox_new (TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The white color button */
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
|
||||
GTK_SHRINK, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_rgba_set (&bw, 1.0, 1.0, 1.0, 1.0);
|
||||
color_area = gimp_color_area_new (&bw,
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (color_area);
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, -1);
|
||||
gtk_widget_set_usize (button, 16, COLOR_AREA_SIZE);
|
||||
gtk_container_add (GTK_CONTAINER (button), color_area);
|
||||
gtk_widget_show (color_area);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_set_white),
|
||||
(GtkObject *) cnp);
|
||||
|
||||
/* The black color button */
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), button, 3, 4, 0, 1,
|
||||
GTK_SHRINK, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_rgba_set (&bw, 0.0, 0.0, 0.0, 1.0);
|
||||
color_area = gimp_color_area_new (&bw,
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (color_area);
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, -1);
|
||||
gtk_widget_set_usize (button, 16, COLOR_AREA_SIZE);
|
||||
gtk_container_add (GTK_CONTAINER (button), color_area);
|
||||
gtk_widget_show (color_area);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_set_black),
|
||||
(GtkObject *) cnp);
|
||||
|
||||
/* The old/new color area frame and hbox */
|
||||
colors_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (colors_frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), colors_frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (colors_frame);
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 2);
|
||||
gtk_container_add (GTK_CONTAINER (colors_frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The new color area */
|
||||
cnp->new_color =
|
||||
gimp_color_area_new (&cnp->rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_widget_set_usize (cnp->new_color, -1, COLOR_AREA_SIZE);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->new_color), "color_changed",
|
||||
GTK_SIGNAL_FUNC (color_notebook_color_changed),
|
||||
cnp);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), cnp->new_color, TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->new_color);
|
||||
|
||||
/* The old color area */
|
||||
cnp->orig_color =
|
||||
gimp_color_area_new (&cnp->orig_rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_widget_set_usize (cnp->new_color, -1, COLOR_AREA_SIZE);
|
||||
gtk_drag_dest_unset (cnp->orig_color);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), cnp->orig_color, TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->orig_color);
|
||||
|
||||
/* The color space sliders, toggle buttons and entries */
|
||||
table = gtk_table_new (8, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
table = gtk_table_new (7, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
group = NULL;
|
||||
|
@ -430,8 +487,7 @@ color_notebook_new (const gchar *title,
|
|||
}
|
||||
else
|
||||
{
|
||||
cnp->toggles[i] =
|
||||
gtk_radio_button_new (group);
|
||||
cnp->toggles[i] = gtk_radio_button_new (group);
|
||||
|
||||
gimp_help_set_help_data (cnp->toggles[i],
|
||||
gettext (slider_tips[i]), NULL);
|
||||
|
@ -459,40 +515,17 @@ color_notebook_new (const gchar *title,
|
|||
cnp);
|
||||
}
|
||||
|
||||
/* The hex triplet entry */
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, 1, 4, 8, 9,
|
||||
GTK_FILL | GTK_EXPAND, GTK_EXPAND, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
cnp->hex_entry = gtk_entry_new_with_max_length (7);
|
||||
gimp_rgb_get_uchar (&cnp->rgb, &r, &g, &b);
|
||||
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x", r, g, b);
|
||||
gtk_entry_set_text (GTK_ENTRY (cnp->hex_entry), buffer);
|
||||
gtk_widget_set_usize (GTK_WIDGET (cnp->hex_entry), 60, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), cnp->hex_entry, TRUE, TRUE, 2);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "focus_out_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_widget_show (cnp->hex_entry);
|
||||
|
||||
label = gtk_label_new (_("Hex Triplet:"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
/* The color history */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
table = gtk_table_new (2, 9, TRUE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_box_pack_end (GTK_BOX (right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, COLOR_AREA_SIZE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 1);
|
||||
gimp_help_set_help_data (button,
|
||||
_("Add the current color to the color history"),
|
||||
NULL);
|
||||
|
@ -510,7 +543,11 @@ color_notebook_new (const gchar *title,
|
|||
{
|
||||
button = gtk_button_new ();
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, COLOR_AREA_SIZE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button,
|
||||
(i > 7 ? i - 8 : i) + 1,
|
||||
(i > 7 ? i - 8 : i) + 2,
|
||||
i > 7 ? 1 : 0,
|
||||
i > 7 ? 2 : 1);
|
||||
|
||||
cnp->history[i] = gimp_color_area_new (&color_history[i],
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS,
|
||||
|
@ -528,6 +565,31 @@ color_notebook_new (const gchar *title,
|
|||
&color_history[i]);
|
||||
}
|
||||
|
||||
/* The hex triplet entry */
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_end (GTK_BOX (right_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
cnp->hex_entry = gtk_entry_new_with_max_length (7);
|
||||
gimp_rgb_get_uchar (&cnp->rgb, &r, &g, &b);
|
||||
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x", r, g, b);
|
||||
gtk_entry_set_text (GTK_ENTRY (cnp->hex_entry), buffer);
|
||||
gtk_widget_set_usize (GTK_WIDGET (cnp->hex_entry), 60, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), cnp->hex_entry, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "focus_out_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_widget_show (cnp->hex_entry);
|
||||
|
||||
label = gtk_label_new (_("Hex Triplet:"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
gtk_widget_show (cnp->shell);
|
||||
|
||||
/* this must come after showing the widget, otherwise we get a
|
||||
|
@ -734,6 +796,25 @@ color_notebook_cancel_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_notebook_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorNotebook *cnp;
|
||||
|
||||
cnp = (ColorNotebook *) data;
|
||||
|
||||
cnp->rgb = cnp->orig_rgb;
|
||||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
color_notebook_update (cnp,
|
||||
UPDATE_NOTEBOOK |
|
||||
UPDATE_NEW_COLOR |
|
||||
UPDATE_CALLER);
|
||||
}
|
||||
|
||||
static void
|
||||
color_notebook_page_switch (GtkWidget *widget,
|
||||
GtkNotebookPage *page,
|
||||
|
|
|
@ -84,6 +84,9 @@ libappgui_la_SOURCES = \
|
|||
toolbox.c \
|
||||
toolbox.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
makefile.msc
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-GUI\"
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "pixmaps/refresh.xpm"
|
||||
|
||||
|
||||
#define COLOR_AREA_SIZE 20
|
||||
#define COLOR_HISTORY_SIZE 16
|
||||
|
@ -55,7 +57,7 @@ typedef enum
|
|||
} ColorNotebookUpdateType;
|
||||
|
||||
|
||||
/* "class" information we keep on each registered colour selector */
|
||||
/* "class" information we keep on each registered color selector */
|
||||
|
||||
typedef struct _ColorSelectorInfo ColorSelectorInfo;
|
||||
|
||||
|
@ -123,6 +125,8 @@ static void color_notebook_ok_callback (GtkWidget *widget,
|
|||
gpointer data);
|
||||
static void color_notebook_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_reset_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_update_callback (gpointer data,
|
||||
const GimpHSV *hsv,
|
||||
const GimpRGB *rgb);
|
||||
|
@ -187,13 +191,14 @@ color_notebook_new (const gchar *title,
|
|||
ColorNotebook *cnp;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *main_hbox;
|
||||
GtkWidget *left_vbox;
|
||||
GtkWidget *right_vbox;
|
||||
GtkWidget *colors_frame;
|
||||
GtkWidget *color_frame;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
GtkWidget *arrow;
|
||||
GtkWidget *color_area;
|
||||
GimpRGB bw;
|
||||
|
@ -248,36 +253,66 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
if (wants_updates)
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
|
||||
wants_updates ? _("Close") : _("OK"),
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, wants_updates,
|
||||
wants_updates ? _("Revert to Old Color") : _("Cancel"),
|
||||
color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, !wants_updates,
|
||||
"_delete_event_", color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 6);
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (cnp->shell)->child)), 0)));
|
||||
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
|
||||
_("OK"), color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
_("Cancel"), color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
}
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
main_hbox = gtk_hbox_new (FALSE, 6);
|
||||
main_hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_add (GTK_CONTAINER (main_vbox), main_hbox);
|
||||
gtk_widget_show (main_hbox);
|
||||
|
||||
/* The left vbox with the notebook */
|
||||
left_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), left_vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (left_vbox);
|
||||
|
||||
/* The right vbox with color areas and color space sliders */
|
||||
right_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
|
||||
/* do we actually need a notebook? */
|
||||
if (selector_info->next)
|
||||
{
|
||||
cnp->notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), cnp->notebook,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_notebook_set_tab_border (GTK_NOTEBOOK (cnp->notebook), 0);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), cnp->notebook,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->notebook);
|
||||
}
|
||||
else /* only one selector */
|
||||
|
@ -316,8 +351,8 @@ color_notebook_new (const gchar *title,
|
|||
}
|
||||
else
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), csel->frame,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), csel->frame,
|
||||
TRUE, TRUE, 0);
|
||||
}
|
||||
|
||||
gtk_widget_show (csel->frame);
|
||||
|
@ -333,92 +368,114 @@ color_notebook_new (const gchar *title,
|
|||
info = info->next;
|
||||
}
|
||||
|
||||
/* The right vertical box with color areas and color space sliders */
|
||||
right_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
/* The table for the color_areas */
|
||||
table = gtk_table_new (2, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The hbox for the color_areas */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
/* The new color area */
|
||||
color_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (color_frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (color_frame, -1, COLOR_AREA_SIZE);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Current:"), 1.0, 0.5,
|
||||
color_frame, 1, FALSE);
|
||||
|
||||
cnp->new_color =
|
||||
gimp_color_area_new (&cnp->rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_container_add (GTK_CONTAINER (color_frame), cnp->new_color);
|
||||
gtk_widget_show (cnp->new_color);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->new_color), "color_changed",
|
||||
GTK_SIGNAL_FUNC (color_notebook_color_changed),
|
||||
cnp);
|
||||
|
||||
/* The old color area */
|
||||
color_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (color_frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (color_frame, -1, COLOR_AREA_SIZE);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
_("Old:"), 1.0, 0.5,
|
||||
color_frame, 1, FALSE);
|
||||
|
||||
cnp->orig_color =
|
||||
gimp_color_area_new (&cnp->orig_rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (cnp->orig_color);
|
||||
gtk_container_add (GTK_CONTAINER (color_frame), cnp->orig_color);
|
||||
gtk_widget_show (cnp->orig_color);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 4, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gimp_pixmap_new (refresh_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
gimp_help_set_help_data (button,
|
||||
_("Revert to old color"),
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_reset_callback),
|
||||
cnp);
|
||||
|
||||
vbox = gtk_vbox_new (TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The white color button */
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
|
||||
GTK_SHRINK, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_rgba_set (&bw, 1.0, 1.0, 1.0, 1.0);
|
||||
color_area = gimp_color_area_new (&bw,
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (color_area);
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, -1);
|
||||
gtk_widget_set_usize (button, 16, COLOR_AREA_SIZE);
|
||||
gtk_container_add (GTK_CONTAINER (button), color_area);
|
||||
gtk_widget_show (color_area);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_set_white),
|
||||
(GtkObject *) cnp);
|
||||
|
||||
/* The black color button */
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), button, 3, 4, 0, 1,
|
||||
GTK_SHRINK, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_rgba_set (&bw, 0.0, 0.0, 0.0, 1.0);
|
||||
color_area = gimp_color_area_new (&bw,
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (color_area);
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, -1);
|
||||
gtk_widget_set_usize (button, 16, COLOR_AREA_SIZE);
|
||||
gtk_container_add (GTK_CONTAINER (button), color_area);
|
||||
gtk_widget_show (color_area);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_set_black),
|
||||
(GtkObject *) cnp);
|
||||
|
||||
/* The old/new color area frame and hbox */
|
||||
colors_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (colors_frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), colors_frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (colors_frame);
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 2);
|
||||
gtk_container_add (GTK_CONTAINER (colors_frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The new color area */
|
||||
cnp->new_color =
|
||||
gimp_color_area_new (&cnp->rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_widget_set_usize (cnp->new_color, -1, COLOR_AREA_SIZE);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->new_color), "color_changed",
|
||||
GTK_SIGNAL_FUNC (color_notebook_color_changed),
|
||||
cnp);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), cnp->new_color, TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->new_color);
|
||||
|
||||
/* The old color area */
|
||||
cnp->orig_color =
|
||||
gimp_color_area_new (&cnp->orig_rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_widget_set_usize (cnp->new_color, -1, COLOR_AREA_SIZE);
|
||||
gtk_drag_dest_unset (cnp->orig_color);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), cnp->orig_color, TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->orig_color);
|
||||
|
||||
/* The color space sliders, toggle buttons and entries */
|
||||
table = gtk_table_new (8, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
table = gtk_table_new (7, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
group = NULL;
|
||||
|
@ -430,8 +487,7 @@ color_notebook_new (const gchar *title,
|
|||
}
|
||||
else
|
||||
{
|
||||
cnp->toggles[i] =
|
||||
gtk_radio_button_new (group);
|
||||
cnp->toggles[i] = gtk_radio_button_new (group);
|
||||
|
||||
gimp_help_set_help_data (cnp->toggles[i],
|
||||
gettext (slider_tips[i]), NULL);
|
||||
|
@ -459,40 +515,17 @@ color_notebook_new (const gchar *title,
|
|||
cnp);
|
||||
}
|
||||
|
||||
/* The hex triplet entry */
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, 1, 4, 8, 9,
|
||||
GTK_FILL | GTK_EXPAND, GTK_EXPAND, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
cnp->hex_entry = gtk_entry_new_with_max_length (7);
|
||||
gimp_rgb_get_uchar (&cnp->rgb, &r, &g, &b);
|
||||
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x", r, g, b);
|
||||
gtk_entry_set_text (GTK_ENTRY (cnp->hex_entry), buffer);
|
||||
gtk_widget_set_usize (GTK_WIDGET (cnp->hex_entry), 60, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), cnp->hex_entry, TRUE, TRUE, 2);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "focus_out_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_widget_show (cnp->hex_entry);
|
||||
|
||||
label = gtk_label_new (_("Hex Triplet:"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
/* The color history */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
table = gtk_table_new (2, 9, TRUE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_box_pack_end (GTK_BOX (right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, COLOR_AREA_SIZE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 1);
|
||||
gimp_help_set_help_data (button,
|
||||
_("Add the current color to the color history"),
|
||||
NULL);
|
||||
|
@ -510,7 +543,11 @@ color_notebook_new (const gchar *title,
|
|||
{
|
||||
button = gtk_button_new ();
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, COLOR_AREA_SIZE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button,
|
||||
(i > 7 ? i - 8 : i) + 1,
|
||||
(i > 7 ? i - 8 : i) + 2,
|
||||
i > 7 ? 1 : 0,
|
||||
i > 7 ? 2 : 1);
|
||||
|
||||
cnp->history[i] = gimp_color_area_new (&color_history[i],
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS,
|
||||
|
@ -528,6 +565,31 @@ color_notebook_new (const gchar *title,
|
|||
&color_history[i]);
|
||||
}
|
||||
|
||||
/* The hex triplet entry */
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_end (GTK_BOX (right_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
cnp->hex_entry = gtk_entry_new_with_max_length (7);
|
||||
gimp_rgb_get_uchar (&cnp->rgb, &r, &g, &b);
|
||||
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x", r, g, b);
|
||||
gtk_entry_set_text (GTK_ENTRY (cnp->hex_entry), buffer);
|
||||
gtk_widget_set_usize (GTK_WIDGET (cnp->hex_entry), 60, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), cnp->hex_entry, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "focus_out_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_widget_show (cnp->hex_entry);
|
||||
|
||||
label = gtk_label_new (_("Hex Triplet:"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
gtk_widget_show (cnp->shell);
|
||||
|
||||
/* this must come after showing the widget, otherwise we get a
|
||||
|
@ -734,6 +796,25 @@ color_notebook_cancel_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_notebook_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorNotebook *cnp;
|
||||
|
||||
cnp = (ColorNotebook *) data;
|
||||
|
||||
cnp->rgb = cnp->orig_rgb;
|
||||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
color_notebook_update (cnp,
|
||||
UPDATE_NOTEBOOK |
|
||||
UPDATE_NEW_COLOR |
|
||||
UPDATE_CALLER);
|
||||
}
|
||||
|
||||
static void
|
||||
color_notebook_page_switch (GtkWidget *widget,
|
||||
GtkNotebookPage *page,
|
||||
|
|
|
@ -42,15 +42,13 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define XY_DEF_WIDTH 200
|
||||
#define XY_DEF_HEIGHT 200
|
||||
#define Z_DEF_WIDTH 15
|
||||
#define Z_DEF_HEIGHT 200
|
||||
#define COLOR_AREA_WIDTH 74
|
||||
#define COLOR_AREA_HEIGHT 20
|
||||
#define XY_DEF_WIDTH GIMP_COLOR_SELECTOR_SIZE
|
||||
#define XY_DEF_HEIGHT GIMP_COLOR_SELECTOR_SIZE
|
||||
#define Z_DEF_WIDTH GIMP_COLOR_SELECTOR_BAR_SIZE
|
||||
#define Z_DEF_HEIGHT GIMP_COLOR_SELECTOR_SIZE
|
||||
|
||||
#define COLOR_AREA_MASK (GDK_EXPOSURE_MASK | \
|
||||
GDK_BUTTON_PRESS_MASK | \
|
||||
#define COLOR_AREA_MASK (GDK_EXPOSURE_MASK | \
|
||||
GDK_BUTTON_PRESS_MASK | \
|
||||
GDK_BUTTON_RELEASE_MASK | \
|
||||
GDK_BUTTON1_MOTION_MASK | \
|
||||
GDK_ENTER_NOTIFY_MASK)
|
||||
|
@ -243,20 +241,19 @@ color_select_widget_new (ColorSelect *csp,
|
|||
GtkWidget *z_frame;
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
|
||||
main_hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), main_hbox, TRUE, FALSE, 0);
|
||||
gtk_widget_show (main_hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), hbox, TRUE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The x/y component preview */
|
||||
xy_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (xy_frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), xy_frame, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), xy_frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (xy_frame);
|
||||
|
||||
csp->xy_color = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
|
@ -284,7 +281,7 @@ color_select_widget_new (ColorSelect *csp,
|
|||
/* The z component preview */
|
||||
z_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (z_frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), z_frame, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), z_frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (z_frame);
|
||||
|
||||
csp->z_color = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
|
|
|
@ -14,6 +14,10 @@ libapppaint_funcs_la_SOURCES = \
|
|||
paint-funcs.h \
|
||||
$(mmx_sources)
|
||||
|
||||
EXTRA_DIST = \
|
||||
makefile.msc \
|
||||
paint-funcs-simd.S
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gimp-Paint-Funcs\"
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@
|
|||
|
||||
#include "libgimp/gimpintl.h"
|
||||
|
||||
#include "pixmaps/refresh.xpm"
|
||||
|
||||
|
||||
#define COLOR_AREA_SIZE 20
|
||||
#define COLOR_HISTORY_SIZE 16
|
||||
|
@ -55,7 +57,7 @@ typedef enum
|
|||
} ColorNotebookUpdateType;
|
||||
|
||||
|
||||
/* "class" information we keep on each registered colour selector */
|
||||
/* "class" information we keep on each registered color selector */
|
||||
|
||||
typedef struct _ColorSelectorInfo ColorSelectorInfo;
|
||||
|
||||
|
@ -123,6 +125,8 @@ static void color_notebook_ok_callback (GtkWidget *widget,
|
|||
gpointer data);
|
||||
static void color_notebook_cancel_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_reset_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void color_notebook_update_callback (gpointer data,
|
||||
const GimpHSV *hsv,
|
||||
const GimpRGB *rgb);
|
||||
|
@ -187,13 +191,14 @@ color_notebook_new (const gchar *title,
|
|||
ColorNotebook *cnp;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *main_hbox;
|
||||
GtkWidget *left_vbox;
|
||||
GtkWidget *right_vbox;
|
||||
GtkWidget *colors_frame;
|
||||
GtkWidget *color_frame;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
GtkWidget *arrow;
|
||||
GtkWidget *color_area;
|
||||
GimpRGB bw;
|
||||
|
@ -248,36 +253,66 @@ color_notebook_new (const gchar *title,
|
|||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
if (wants_updates)
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
|
||||
wants_updates ? _("Close") : _("OK"),
|
||||
color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, wants_updates,
|
||||
wants_updates ? _("Revert to Old Color") : _("Cancel"),
|
||||
color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, !wants_updates,
|
||||
"_delete_event_", color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, TRUE,
|
||||
|
||||
NULL);
|
||||
NULL);
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 6);
|
||||
gtk_widget_hide (GTK_WIDGET (g_list_nth_data (gtk_container_children (GTK_CONTAINER (GTK_BIN (cnp->shell)->child)), 0)));
|
||||
|
||||
gtk_widget_hide (GTK_DIALOG (cnp->shell)->action_area);
|
||||
}
|
||||
else
|
||||
{
|
||||
cnp->shell =
|
||||
gimp_dialog_new (title, "color_selection",
|
||||
color_notebook_help_func, (const gchar *) cnp,
|
||||
GTK_WIN_POS_NONE,
|
||||
FALSE, TRUE, TRUE,
|
||||
|
||||
_("OK"), color_notebook_ok_callback,
|
||||
cnp, NULL, NULL, TRUE, FALSE,
|
||||
|
||||
_("Cancel"), color_notebook_cancel_callback,
|
||||
cnp, NULL, NULL, FALSE, TRUE,
|
||||
|
||||
NULL);
|
||||
}
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (cnp->shell)->vbox), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
main_hbox = gtk_hbox_new (FALSE, 6);
|
||||
main_hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_add (GTK_CONTAINER (main_vbox), main_hbox);
|
||||
gtk_widget_show (main_hbox);
|
||||
|
||||
/* The left vbox with the notebook */
|
||||
left_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), left_vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (left_vbox);
|
||||
|
||||
/* The right vbox with color areas and color space sliders */
|
||||
right_vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
|
||||
/* do we actually need a notebook? */
|
||||
if (selector_info->next)
|
||||
{
|
||||
cnp->notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), cnp->notebook,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_notebook_set_tab_border (GTK_NOTEBOOK (cnp->notebook), 0);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), cnp->notebook,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->notebook);
|
||||
}
|
||||
else /* only one selector */
|
||||
|
@ -316,8 +351,8 @@ color_notebook_new (const gchar *title,
|
|||
}
|
||||
else
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), csel->frame,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), csel->frame,
|
||||
TRUE, TRUE, 0);
|
||||
}
|
||||
|
||||
gtk_widget_show (csel->frame);
|
||||
|
@ -333,92 +368,114 @@ color_notebook_new (const gchar *title,
|
|||
info = info->next;
|
||||
}
|
||||
|
||||
/* The right vertical box with color areas and color space sliders */
|
||||
right_vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), right_vbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (right_vbox);
|
||||
/* The table for the color_areas */
|
||||
table = gtk_table_new (2, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_box_pack_start (GTK_BOX (left_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* The hbox for the color_areas */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
/* The new color area */
|
||||
color_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (color_frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (color_frame, -1, COLOR_AREA_SIZE);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
_("Current:"), 1.0, 0.5,
|
||||
color_frame, 1, FALSE);
|
||||
|
||||
cnp->new_color =
|
||||
gimp_color_area_new (&cnp->rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_container_add (GTK_CONTAINER (color_frame), cnp->new_color);
|
||||
gtk_widget_show (cnp->new_color);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->new_color), "color_changed",
|
||||
GTK_SIGNAL_FUNC (color_notebook_color_changed),
|
||||
cnp);
|
||||
|
||||
/* The old color area */
|
||||
color_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (color_frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_usize (color_frame, -1, COLOR_AREA_SIZE);
|
||||
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
|
||||
_("Old:"), 1.0, 0.5,
|
||||
color_frame, 1, FALSE);
|
||||
|
||||
cnp->orig_color =
|
||||
gimp_color_area_new (&cnp->orig_rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (cnp->orig_color);
|
||||
gtk_container_add (GTK_CONTAINER (color_frame), cnp->orig_color);
|
||||
gtk_widget_show (cnp->orig_color);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 4, 1, 2,
|
||||
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
pixmap = gimp_pixmap_new (refresh_xpm);
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
gimp_help_set_help_data (button,
|
||||
_("Revert to old color"),
|
||||
NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_reset_callback),
|
||||
cnp);
|
||||
|
||||
vbox = gtk_vbox_new (TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* The white color button */
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
|
||||
GTK_SHRINK, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_rgba_set (&bw, 1.0, 1.0, 1.0, 1.0);
|
||||
color_area = gimp_color_area_new (&bw,
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (color_area);
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, -1);
|
||||
gtk_widget_set_usize (button, 16, COLOR_AREA_SIZE);
|
||||
gtk_container_add (GTK_CONTAINER (button), color_area);
|
||||
gtk_widget_show (color_area);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_set_white),
|
||||
(GtkObject *) cnp);
|
||||
|
||||
/* The black color button */
|
||||
button = gtk_button_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), button, 3, 4, 0, 1,
|
||||
GTK_SHRINK, GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gimp_rgba_set (&bw, 0.0, 0.0, 0.0, 1.0);
|
||||
color_area = gimp_color_area_new (&bw,
|
||||
GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON2_MASK);
|
||||
gtk_drag_dest_unset (color_area);
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, -1);
|
||||
gtk_widget_set_usize (button, 16, COLOR_AREA_SIZE);
|
||||
gtk_container_add (GTK_CONTAINER (button), color_area);
|
||||
gtk_widget_show (color_area);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (color_notebook_set_black),
|
||||
(GtkObject *) cnp);
|
||||
|
||||
/* The old/new color area frame and hbox */
|
||||
colors_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (colors_frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), colors_frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (colors_frame);
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 2);
|
||||
gtk_container_add (GTK_CONTAINER (colors_frame), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The new color area */
|
||||
cnp->new_color =
|
||||
gimp_color_area_new (&cnp->rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_widget_set_usize (cnp->new_color, -1, COLOR_AREA_SIZE);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->new_color), "color_changed",
|
||||
GTK_SIGNAL_FUNC (color_notebook_color_changed),
|
||||
cnp);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), cnp->new_color, TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->new_color);
|
||||
|
||||
/* The old color area */
|
||||
cnp->orig_color =
|
||||
gimp_color_area_new (&cnp->orig_rgb,
|
||||
show_alpha ?
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS : GIMP_COLOR_AREA_FLAT,
|
||||
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
|
||||
gtk_widget_set_usize (cnp->new_color, -1, COLOR_AREA_SIZE);
|
||||
gtk_drag_dest_unset (cnp->orig_color);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), cnp->orig_color, TRUE, TRUE, 0);
|
||||
gtk_widget_show (cnp->orig_color);
|
||||
|
||||
/* The color space sliders, toggle buttons and entries */
|
||||
table = gtk_table_new (8, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
table = gtk_table_new (7, 4, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
group = NULL;
|
||||
|
@ -430,8 +487,7 @@ color_notebook_new (const gchar *title,
|
|||
}
|
||||
else
|
||||
{
|
||||
cnp->toggles[i] =
|
||||
gtk_radio_button_new (group);
|
||||
cnp->toggles[i] = gtk_radio_button_new (group);
|
||||
|
||||
gimp_help_set_help_data (cnp->toggles[i],
|
||||
gettext (slider_tips[i]), NULL);
|
||||
|
@ -459,40 +515,17 @@ color_notebook_new (const gchar *title,
|
|||
cnp);
|
||||
}
|
||||
|
||||
/* The hex triplet entry */
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_table_attach (GTK_TABLE (table), hbox, 1, 4, 8, 9,
|
||||
GTK_FILL | GTK_EXPAND, GTK_EXPAND, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
cnp->hex_entry = gtk_entry_new_with_max_length (7);
|
||||
gimp_rgb_get_uchar (&cnp->rgb, &r, &g, &b);
|
||||
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x", r, g, b);
|
||||
gtk_entry_set_text (GTK_ENTRY (cnp->hex_entry), buffer);
|
||||
gtk_widget_set_usize (GTK_WIDGET (cnp->hex_entry), 60, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), cnp->hex_entry, TRUE, TRUE, 2);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "focus_out_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_widget_show (cnp->hex_entry);
|
||||
|
||||
label = gtk_label_new (_("Hex Triplet:"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
/* The color history */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
table = gtk_table_new (2, 9, TRUE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 3);
|
||||
gtk_box_pack_end (GTK_BOX (right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, COLOR_AREA_SIZE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 1);
|
||||
gimp_help_set_help_data (button,
|
||||
_("Add the current color to the color history"),
|
||||
NULL);
|
||||
|
@ -510,7 +543,11 @@ color_notebook_new (const gchar *title,
|
|||
{
|
||||
button = gtk_button_new ();
|
||||
gtk_widget_set_usize (button, COLOR_AREA_SIZE, COLOR_AREA_SIZE);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), button,
|
||||
(i > 7 ? i - 8 : i) + 1,
|
||||
(i > 7 ? i - 8 : i) + 2,
|
||||
i > 7 ? 1 : 0,
|
||||
i > 7 ? 2 : 1);
|
||||
|
||||
cnp->history[i] = gimp_color_area_new (&color_history[i],
|
||||
GIMP_COLOR_AREA_SMALL_CHECKS,
|
||||
|
@ -528,6 +565,31 @@ color_notebook_new (const gchar *title,
|
|||
&color_history[i]);
|
||||
}
|
||||
|
||||
/* The hex triplet entry */
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_end (GTK_BOX (right_vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
cnp->hex_entry = gtk_entry_new_with_max_length (7);
|
||||
gimp_rgb_get_uchar (&cnp->rgb, &r, &g, &b);
|
||||
g_snprintf (buffer, sizeof (buffer), "#%.2x%.2x%.2x", r, g, b);
|
||||
gtk_entry_set_text (GTK_ENTRY (cnp->hex_entry), buffer);
|
||||
gtk_widget_set_usize (GTK_WIDGET (cnp->hex_entry), 60, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), cnp->hex_entry, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "focus_out_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_signal_connect (GTK_OBJECT (cnp->hex_entry), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (color_notebook_hex_entry_events),
|
||||
cnp);
|
||||
gtk_widget_show (cnp->hex_entry);
|
||||
|
||||
label = gtk_label_new (_("Hex Triplet:"));
|
||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
gtk_widget_show (cnp->shell);
|
||||
|
||||
/* this must come after showing the widget, otherwise we get a
|
||||
|
@ -734,6 +796,25 @@ color_notebook_cancel_callback (GtkWidget *widget,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
color_notebook_reset_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
ColorNotebook *cnp;
|
||||
|
||||
cnp = (ColorNotebook *) data;
|
||||
|
||||
cnp->rgb = cnp->orig_rgb;
|
||||
|
||||
color_notebook_update_hsv_values (cnp);
|
||||
color_notebook_update_scales (cnp, -1);
|
||||
|
||||
color_notebook_update (cnp,
|
||||
UPDATE_NOTEBOOK |
|
||||
UPDATE_NEW_COLOR |
|
||||
UPDATE_CALLER);
|
||||
}
|
||||
|
||||
static void
|
||||
color_notebook_page_switch (GtkWidget *widget,
|
||||
GtkNotebookPage *page,
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2001-05-30 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimpmath/libgimpmath-docs.sgml: s/libgimpcolor/libgimpmath/.
|
||||
|
||||
2001-05-25 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* Makefile.am
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
|
||||
<!entity libgimpmath-gimpmatht SYSTEM "sgml/gimpmatht.sgml">
|
||||
<!entity libgimpmath-gimpmath SYSTEM "sgml/gimpmath.sgml">
|
||||
<!entity libgimpmath-gimpmathtypes SYSTEM "sgml/gimpmathtypes.sgml">
|
||||
<!entity libgimpmath-gimpmatrix SYSTEM "sgml/gimpmatrix.sgml">
|
||||
<!entity libgimpmath-gimpvector SYSTEM "sgml/gimpvector.sgml">
|
||||
|
@ -9,9 +9,9 @@
|
|||
<title>GIMP Math Library Reference Manual</title>
|
||||
</bookinfo>
|
||||
|
||||
<chapter id="libgimpcolor">
|
||||
<chapter id="libgimpmath">
|
||||
<title>GIMP Math Library</title>
|
||||
&libgimpmath-gimpmatht;
|
||||
&libgimpmath-gimpmath;
|
||||
&libgimpmath-gimpmathtypes;
|
||||
&libgimpmath-gimpmatrix;
|
||||
&libgimpmath-gimpvector;
|
||||
|
|
|
@ -28,6 +28,10 @@ extern "C" {
|
|||
/* For information look at the html documentation */
|
||||
|
||||
|
||||
#define GIMP_COLOR_SELECTOR_SIZE 150
|
||||
#define GIMP_COLOR_SELECTOR_BAR_SIZE 15
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GIMP_COLOR_SELECTOR_HUE,
|
||||
|
|
|
@ -38,15 +38,6 @@
|
|||
|
||||
static const GtkTargetEntry targets[] = { { "application/x-color", 0 } };
|
||||
|
||||
|
||||
struct _GimpColorArea
|
||||
{
|
||||
GtkPreview preview;
|
||||
|
||||
GimpColorAreaType type;
|
||||
GimpRGB color;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
COLOR_CHANGED,
|
||||
|
@ -57,10 +48,17 @@ static guint gimp_color_area_signals[LAST_SIGNAL] = { 0 };
|
|||
static GtkWidgetClass *parent_class = NULL;
|
||||
|
||||
|
||||
static void gimp_color_area_class_init (GimpColorAreaClass *klass);
|
||||
static void gimp_color_area_init (GimpColorArea *gca);
|
||||
static void gimp_color_area_destroy (GtkObject *object);
|
||||
static void gimp_color_area_update (GimpColorArea *gca);
|
||||
static void gimp_color_area_class_init (GimpColorAreaClass *klass);
|
||||
static void gimp_color_area_init (GimpColorArea *gca);
|
||||
|
||||
static void gimp_color_area_destroy (GtkObject *object);
|
||||
|
||||
static void gimp_color_area_realize (GtkWidget *widget);
|
||||
static void gimp_color_area_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
static void gimp_color_area_update (GimpColorArea *gca);
|
||||
static gboolean gimp_color_area_idle_update (gpointer data);
|
||||
|
||||
static void gimp_color_area_drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context);
|
||||
|
@ -132,6 +130,9 @@ gimp_color_area_class_init (GimpColorAreaClass *klass)
|
|||
|
||||
object_class->destroy = gimp_color_area_destroy;
|
||||
|
||||
widget_class->realize = gimp_color_area_realize;
|
||||
widget_class->size_allocate = gimp_color_area_size_allocate;
|
||||
|
||||
widget_class->drag_begin = gimp_color_area_drag_begin;
|
||||
widget_class->drag_end = gimp_color_area_drag_end;
|
||||
widget_class->drag_data_received = gimp_color_area_drag_data_received;
|
||||
|
@ -142,19 +143,14 @@ static void
|
|||
gimp_color_area_init (GimpColorArea *gca)
|
||||
{
|
||||
gimp_rgba_set (&gca->color, 0.0, 0.0, 0.0, 1.0);
|
||||
gca->type = GIMP_COLOR_AREA_FLAT;
|
||||
|
||||
gca->type = GIMP_COLOR_AREA_FLAT;
|
||||
gca->idle_id = 0;
|
||||
|
||||
GTK_PREVIEW (gca)->type = GTK_PREVIEW_COLOR;
|
||||
GTK_PREVIEW (gca)->bpp = 3;
|
||||
GTK_PREVIEW (gca)->dither = GDK_RGB_DITHER_NORMAL;
|
||||
GTK_PREVIEW (gca)->expand = TRUE;
|
||||
|
||||
gtk_signal_connect_after (GTK_OBJECT (gca), "realize",
|
||||
GTK_SIGNAL_FUNC (gimp_color_area_update),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (gca), "size_allocate",
|
||||
GTK_SIGNAL_FUNC (gimp_color_area_update),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -167,10 +163,35 @@ gimp_color_area_destroy (GtkObject *object)
|
|||
|
||||
gca = GIMP_COLOR_AREA (object);
|
||||
|
||||
if (gca->idle_id)
|
||||
{
|
||||
g_source_remove (gca->idle_id);
|
||||
gca->idle_id = 0;
|
||||
}
|
||||
|
||||
if (GTK_OBJECT_CLASS (parent_class)->destroy)
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_area_realize (GtkWidget *widget)
|
||||
{
|
||||
if (GTK_WIDGET_CLASS (parent_class)->realize)
|
||||
GTK_WIDGET_CLASS (parent_class)->realize (widget);
|
||||
|
||||
gimp_color_area_update (GIMP_COLOR_AREA (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_color_area_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
gimp_color_area_update (GIMP_COLOR_AREA (widget));
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_color_area_new:
|
||||
* @color: A pointer to a #GimpRGB struct.
|
||||
|
@ -276,28 +297,47 @@ gimp_color_area_set_type (GimpColorArea *gca,
|
|||
static void
|
||||
gimp_color_area_update (GimpColorArea *gca)
|
||||
{
|
||||
gint window_width, window_height;
|
||||
guint width, height;
|
||||
guint x, y;
|
||||
guint check_size = 0;
|
||||
guchar light[3];
|
||||
guchar dark[3];
|
||||
guchar opaque[3];
|
||||
guchar *p;
|
||||
guchar *buf;
|
||||
gdouble frac;
|
||||
|
||||
g_return_if_fail (gca != NULL);
|
||||
g_return_if_fail (GIMP_IS_COLOR_AREA (gca));
|
||||
|
||||
if (gca->idle_id)
|
||||
{
|
||||
g_source_remove (gca->idle_id);
|
||||
}
|
||||
|
||||
gca->idle_id =
|
||||
g_idle_add_full (G_PRIORITY_LOW,
|
||||
(GSourceFunc) gimp_color_area_idle_update, gca,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_color_area_idle_update (gpointer data)
|
||||
{
|
||||
GimpColorArea *gca;
|
||||
gint window_width, window_height;
|
||||
guint width, height;
|
||||
guint x, y;
|
||||
guint check_size = 0;
|
||||
guchar light[3];
|
||||
guchar dark[3];
|
||||
guchar opaque[3];
|
||||
guchar *p;
|
||||
guchar *buf;
|
||||
gdouble frac;
|
||||
|
||||
gca = GIMP_COLOR_AREA (data);
|
||||
|
||||
gca->idle_id = 0;
|
||||
|
||||
if (! GTK_WIDGET_REALIZED (GTK_WIDGET (gca)))
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
gdk_window_get_size (GTK_WIDGET (gca)->window,
|
||||
&window_width, &window_height);
|
||||
|
||||
if (window_width < 1 || window_height < 1)
|
||||
return;
|
||||
return FALSE;
|
||||
|
||||
width = window_width;
|
||||
height = window_height;
|
||||
|
@ -413,6 +453,8 @@ gimp_color_area_update (GimpColorArea *gca)
|
|||
g_free (buf);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (gca));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -53,6 +53,16 @@ typedef enum
|
|||
|
||||
typedef struct _GimpColorAreaClass GimpColorAreaClass;
|
||||
|
||||
struct _GimpColorArea
|
||||
{
|
||||
GtkPreview preview;
|
||||
|
||||
/*< private >*/
|
||||
GimpColorAreaType type;
|
||||
GimpRGB color;
|
||||
guint idle_id;
|
||||
};
|
||||
|
||||
struct _GimpColorAreaClass
|
||||
{
|
||||
GtkPreviewClass parent_class;
|
||||
|
|
|
@ -42,15 +42,13 @@
|
|||
#include "libgimp/gimpintl.h"
|
||||
|
||||
|
||||
#define XY_DEF_WIDTH 200
|
||||
#define XY_DEF_HEIGHT 200
|
||||
#define Z_DEF_WIDTH 15
|
||||
#define Z_DEF_HEIGHT 200
|
||||
#define COLOR_AREA_WIDTH 74
|
||||
#define COLOR_AREA_HEIGHT 20
|
||||
#define XY_DEF_WIDTH GIMP_COLOR_SELECTOR_SIZE
|
||||
#define XY_DEF_HEIGHT GIMP_COLOR_SELECTOR_SIZE
|
||||
#define Z_DEF_WIDTH GIMP_COLOR_SELECTOR_BAR_SIZE
|
||||
#define Z_DEF_HEIGHT GIMP_COLOR_SELECTOR_SIZE
|
||||
|
||||
#define COLOR_AREA_MASK (GDK_EXPOSURE_MASK | \
|
||||
GDK_BUTTON_PRESS_MASK | \
|
||||
#define COLOR_AREA_MASK (GDK_EXPOSURE_MASK | \
|
||||
GDK_BUTTON_PRESS_MASK | \
|
||||
GDK_BUTTON_RELEASE_MASK | \
|
||||
GDK_BUTTON1_MOTION_MASK | \
|
||||
GDK_ENTER_NOTIFY_MASK)
|
||||
|
@ -243,20 +241,19 @@ color_select_widget_new (ColorSelect *csp,
|
|||
GtkWidget *z_frame;
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 2);
|
||||
|
||||
main_hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), main_hbox, TRUE, FALSE, 0);
|
||||
gtk_widget_show (main_hbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (main_hbox), hbox, TRUE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
/* The x/y component preview */
|
||||
xy_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (xy_frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), xy_frame, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), xy_frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (xy_frame);
|
||||
|
||||
csp->xy_color = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
|
@ -284,7 +281,7 @@ color_select_widget_new (ColorSelect *csp,
|
|||
/* The z component preview */
|
||||
z_frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (z_frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), z_frame, FALSE, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), z_frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (z_frame);
|
||||
|
||||
csp->z_color = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
|
|
|
@ -20,13 +20,12 @@ EXTRA_DIST = \
|
|||
gimpmodregister.h
|
||||
|
||||
libexec_LTLIBRARIES = \
|
||||
libcolorsel_gtk.la \
|
||||
libcolorsel_triangle.la \
|
||||
libcolorsel_water.la
|
||||
|
||||
libcolorsel_gtk_la_SOURCES = colorsel_gtk.c
|
||||
libcolorsel_gtk_la_LDFLAGS = -avoid-version -module
|
||||
libcolorsel_gtk_la_LIBADD = $(GTK_LIBS)
|
||||
## libcolorsel_gtk_la_SOURCES = colorsel_gtk.c
|
||||
## libcolorsel_gtk_la_LDFLAGS = -avoid-version -module
|
||||
## libcolorsel_gtk_la_LIBADD = $(GTK_LIBS)
|
||||
|
||||
libcolorsel_triangle_la_SOURCES = colorsel_triangle.c
|
||||
libcolorsel_triangle_la_LDFLAGS = -avoid-version -module
|
||||
|
|
|
@ -87,9 +87,9 @@ static const GtkTargetEntry targets[] =
|
|||
};
|
||||
|
||||
|
||||
#define COLORWHEELRADIUS 100
|
||||
#define COLORTRIANGLERADIUS 80
|
||||
#define PREVIEWSIZE (2 * COLORWHEELRADIUS + 1)
|
||||
#define COLORWHEELRADIUS (GIMP_COLOR_SELECTOR_SIZE / 2)
|
||||
#define COLORTRIANGLERADIUS (COLORWHEELRADIUS - GIMP_COLOR_SELECTOR_BAR_SIZE)
|
||||
#define PREVIEWSIZE (2 * COLORWHEELRADIUS + 1)
|
||||
|
||||
#define BGCOLOR 180
|
||||
|
||||
|
@ -208,18 +208,17 @@ colorsel_triangle_new (const GimpHSV *hsv,
|
|||
*selector_data = coldata;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_container_add (GTK_CONTAINER (frame), preview);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, FALSE, 0);
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
return hbox;
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
/* definitions and variables */
|
||||
|
||||
#define IMAGE_SIZE 200
|
||||
#define IMAGE_SIZE GIMP_COLOR_SELECTOR_SIZE
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -398,6 +398,7 @@ colorsel_water_new (const GimpHSV *hsv,
|
|||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbox2;
|
||||
GtkObject *adj;
|
||||
GtkWidget *scale;
|
||||
|
||||
|
@ -411,15 +412,17 @@ colorsel_water_new (const GimpHSV *hsv,
|
|||
*selector_data = coldata;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
|
||||
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 4);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), hbox2, TRUE, FALSE, 0);
|
||||
|
||||
/* the event box */
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), frame, FALSE, FALSE, 0);
|
||||
|
||||
event_box = gtk_event_box_new ();
|
||||
gtk_container_add (GTK_CONTAINER (frame), event_box);
|
||||
|
@ -467,7 +470,7 @@ colorsel_water_new (const GimpHSV *hsv,
|
|||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
gimp_help_set_help_data (scale, _("Pressure"), NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), scale, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), scale, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
|
|
Loading…
Reference in New Issue