Commit a56f89b8 authored by Lauri Alanko's avatar Lauri Alanko

Added stuff to make gcg by default (for maintainers)

Redid the indexed palette dialog to not crash, to be a bit more
usable, and to be a cleaner module. A first shot at using gcg in
actual practice.. If something is screwed, let me know!
parent 42d9768d
......@@ -87,6 +87,8 @@ gimp_SOURCES = \
color_transfer.h \
colormaps.c \
colormaps.h \
colormap_dialog.c \
colormap_dialog.h \
commands.c \
commands.h \
convert.c \
......@@ -202,8 +204,6 @@ gimp_SOURCES = \
image_map.h \
image_render.c \
image_render.h \
indexed_palette.c \
indexed_palette.h \
info_dialog.c \
info_dialog.h \
info_window.c \
......@@ -383,3 +383,42 @@ files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done
# GCG stuff
SUFFIXES = .gc .gh
if WITH_GCG
GCG = ../tools/gcg/gcg -I ../tools/gcg/gh
GEN_CODE = colormap_dialog.c
if WITH_GNU_MAKE
GEN_HEADER =$(subst .gc,.t.h,$(GCG_DEFS)) \
$(subst .gc,.p.h,$(GCG_DEFS)) \
$(subst .gc,.i.h,$(GCG_DEFS)) \
$(subst .gc,.h,$(GCG_DEFS))
$(GEN_CODE): %.c: %.gc
$(GCG) -o $@ $<
else # WITH_GNU_MAKE
GEN_HEADER = # fill in here manually, if you bother
.gc.c:
$(GCG) -o $@ $<
endif # WITH_GNU_MAKE
BUILT_SOURCES = $(GEN_CODE) $(GEN_HEADER)
if ENABLE_GCG_DEPS
if WITH_GNU_MAKE
# dependency magic
GCGMAKEDEPEND = ../tools/gcg/gcgmakedepend
$(DEF_DEPS): .deps/%.d: %.gc
$(GCGMAKEDEPEND) $(DEF_INC) $< >$@
# automake uses .P for .c files, we use .d for .gc files, should
# be no conflict..
GCG_DEFS = $(subst .c,.gc,$(GEN_CODE))
DEF_DEPS = $(patsubst %.gc,.deps/%.d,$(GCG_DEFS))
-include $(DEF_DEPS)
endif # WITH_GNU_MAKE
endif # ENABLE_GCG_DEPS
endif # WITH_GCG
# end GCG stuff
......@@ -27,6 +27,8 @@
#include "by_color_select.h"
#include "channels_dialog.h"
#include "colormaps.h"
#include "colormap_dialog.i.h"
#include "color_area.h"
#include "color_balance.h"
#include "commands.h"
#include "convert.h"
......@@ -49,7 +51,6 @@
#include "histogram_tool.h"
#include "hue_saturation.h"
#include "image_render.h"
#include "indexed_palette.h"
#include "info_window.h"
#include "interface.h"
#include "invert.h"
......@@ -1028,15 +1029,30 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
lc_dialog_create (gdisp->gimage);
}
static void
cmap_dlg_sel_cb(ColormapDialog* dlg, gpointer user_data)
{
guchar* c;
GimpImage* img = colormap_dialog_image(dlg);
c = &img->cmap[colormap_dialog_col_index(dlg) * 3];
if(active_color == FOREGROUND)
palette_set_foreground (c[0], c[1], c[2]);
else if(active_color == BACKGROUND)
palette_set_background (c[0], c[1], c[2]);
}
void
dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
gdisp = gdisplay_active ();
indexed_palette_create (gdisp->gimage);
static ColormapDialog* cmap_dlg;
if(!cmap_dlg){
cmap_dlg = colormap_dialog_create (image_context);
colormap_dialog_connect_selected(cmap_dlg_sel_cb, NULL,
cmap_dlg);
}
gtk_widget_show(GTK_WIDGET(cmap_dlg));
}
void
......
......@@ -65,6 +65,7 @@
#include "xcf.h"
#include "errors.h"
#include "docindex.h"
#include "colormap_dialog.h"
#include "config.h"
......
......@@ -22,7 +22,7 @@
#include "gdk/gdkx.h"
#include "gtk/gtk.h"
#include "gimpsetF.h"
#include "colormap_dialog.t.h"
#define DISPLAY ((Display *) GDK_DISPLAY())
/* important macros - we reuse the ones from glib */
......@@ -53,7 +53,6 @@ extern int console_messages;
extern int restore_session;
extern int we_are_exiting; /* this is used in session_get_window_info() */
extern GimpSet* image_context;
extern MessageHandlerType message_handler;
#endif /* APPENV_H */
#include <gimp.gh>
#include <gtk.gh>
module Gimp.ColormapDialog;
import Gtk, g;
class ColormapDialog : Gtk.Dialog {
public static ColormapDialog* create(Set* context);
read-only Image* image;
read-only int col-index;
protected pre-emit void selected ();
Widget* vbox;
Preview* palette;
Widget* image-menu;
OptionMenu* option-menu;
Set* context;
uint event-handler;
int xn;
int yn;
int cellsize;
Entry* index-entry;
Entry* color-entry;
SetHandlerId rename-handler;
SetHandlerId cmap-changed-handler;
Widget* add-item;
.ColorSelectP color-select;
}
This diff is collapsed.
......@@ -27,6 +27,8 @@
#include "by_color_select.h"
#include "channels_dialog.h"
#include "colormaps.h"
#include "colormap_dialog.i.h"
#include "color_area.h"
#include "color_balance.h"
#include "commands.h"
#include "convert.h"
......@@ -49,7 +51,6 @@
#include "histogram_tool.h"
#include "hue_saturation.h"
#include "image_render.h"
#include "indexed_palette.h"
#include "info_window.h"
#include "interface.h"
#include "invert.h"
......@@ -1028,15 +1029,30 @@ dialogs_lc_cmd_callback (GtkWidget *widget,
lc_dialog_create (gdisp->gimage);
}
static void
cmap_dlg_sel_cb(ColormapDialog* dlg, gpointer user_data)
{
guchar* c;
GimpImage* img = colormap_dialog_image(dlg);
c = &img->cmap[colormap_dialog_col_index(dlg) * 3];
if(active_color == FOREGROUND)
palette_set_foreground (c[0], c[1], c[2]);
else if(active_color == BACKGROUND)
palette_set_background (c[0], c[1], c[2]);
}
void
dialogs_indexed_palette_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
gdisp = gdisplay_active ();
indexed_palette_create (gdisp->gimage);
static ColormapDialog* cmap_dlg;
if(!cmap_dlg){
cmap_dlg = colormap_dialog_create (image_context);
colormap_dialog_connect_selected(cmap_dlg_sel_cb, NULL,
cmap_dlg);
}
gtk_widget_show(GTK_WIDGET(cmap_dlg));
}
void
......
......@@ -74,7 +74,6 @@
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "indexed_palette.h"
#include "interface.h"
#include "undo.h"
#include "palette.h"
......@@ -913,7 +912,7 @@ convert_image (GImage *gimage,
gdisplays_update_title (gimage);
gdisplays_update_full (gimage);
indexed_palette_update_image_list ();
gimp_image_colormap_changed (gimage, -1);
}
static void
......
......@@ -74,7 +74,6 @@
#include "floating_sel.h"
#include "fsdither.h"
#include "gdisplay.h"
#include "indexed_palette.h"
#include "interface.h"
#include "undo.h"
#include "palette.h"
......@@ -913,7 +912,7 @@ convert_image (GImage *gimage,
gdisplays_update_title (gimage);
gdisplays_update_full (gimage);
indexed_palette_update_image_list ();
gimp_image_colormap_changed (gimage, -1);
}
static void
......
......@@ -93,6 +93,7 @@ enum{
RENAME,
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
LAST_SIGNAL
};
static void gimp_image_destroy (GtkObject *);
......@@ -123,6 +124,8 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_signal_new ("resize", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[RESTRUCTURE] =
gimp_signal_new ("restructure", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", 0, type, 0, gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -923,7 +926,15 @@ gimp_image_get_new_tattoo(GimpImage *image)
return (image->tattoo_state);
}
void
gimp_image_colormap_changed (GimpImage *image, gint col){
g_return_if_fail (image);
g_return_if_fail (col < image->num_cols);
gtk_signal_emit (GTK_OBJECT(image),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
......
......@@ -18,7 +18,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
/* the image types */
......@@ -146,6 +146,15 @@ void gimp_image_detach_parasite (GimpImage *, const char *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
specifies which color has changed, or negative if there's a bigger change.
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
/* layer/channel functions */
......
......@@ -93,6 +93,7 @@ enum{
RENAME,
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
LAST_SIGNAL
};
static void gimp_image_destroy (GtkObject *);
......@@ -123,6 +124,8 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_signal_new ("resize", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[RESTRUCTURE] =
gimp_signal_new ("restructure", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", 0, type, 0, gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -923,7 +926,15 @@ gimp_image_get_new_tattoo(GimpImage *image)
return (image->tattoo_state);
}
void
gimp_image_colormap_changed (GimpImage *image, gint col){
g_return_if_fail (image);
g_return_if_fail (col < image->num_cols);
gtk_signal_emit (GTK_OBJECT(image),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
......
......@@ -18,7 +18,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
/* the image types */
......@@ -146,6 +146,15 @@ void gimp_image_detach_parasite (GimpImage *, const char *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
specifies which color has changed, or negative if there's a bigger change.
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
/* layer/channel functions */
......
......@@ -93,6 +93,7 @@ enum{
RENAME,
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
LAST_SIGNAL
};
static void gimp_image_destroy (GtkObject *);
......@@ -123,6 +124,8 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_signal_new ("resize", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[RESTRUCTURE] =
gimp_signal_new ("restructure", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", 0, type, 0, gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -923,7 +926,15 @@ gimp_image_get_new_tattoo(GimpImage *image)
return (image->tattoo_state);
}
void
gimp_image_colormap_changed (GimpImage *image, gint col){
g_return_if_fail (image);
g_return_if_fail (col < image->num_cols);
gtk_signal_emit (GTK_OBJECT(image),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
......
......@@ -18,7 +18,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
/* the image types */
......@@ -146,6 +146,15 @@ void gimp_image_detach_parasite (GimpImage *, const char *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
specifies which color has changed, or negative if there's a bigger change.
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
/* layer/channel functions */
......
......@@ -93,6 +93,7 @@ enum{
RENAME,
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
LAST_SIGNAL
};
static void gimp_image_destroy (GtkObject *);
......@@ -123,6 +124,8 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_signal_new ("resize", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[RESTRUCTURE] =
gimp_signal_new ("restructure", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", 0, type, 0, gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -923,7 +926,15 @@ gimp_image_get_new_tattoo(GimpImage *image)
return (image->tattoo_state);
}
void
gimp_image_colormap_changed (GimpImage *image, gint col){
g_return_if_fail (image);
g_return_if_fail (col < image->num_cols);
gtk_signal_emit (GTK_OBJECT(image),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
......
......@@ -18,7 +18,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
/* the image types */
......@@ -146,6 +146,15 @@ void gimp_image_detach_parasite (GimpImage *, const char *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
specifies which color has changed, or negative if there's a bigger change.
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
/* layer/channel functions */
......
......@@ -93,6 +93,7 @@ enum{
RENAME,
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
LAST_SIGNAL
};
static void gimp_image_destroy (GtkObject *);
......@@ -123,6 +124,8 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_signal_new ("resize", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[RESTRUCTURE] =
gimp_signal_new ("restructure", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", 0, type, 0, gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -923,7 +926,15 @@ gimp_image_get_new_tattoo(GimpImage *image)
return (image->tattoo_state);
}
void
gimp_image_colormap_changed (GimpImage *image, gint col){
g_return_if_fail (image);
g_return_if_fail (col < image->num_cols);
gtk_signal_emit (GTK_OBJECT(image),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
......
......@@ -18,7 +18,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
/* the image types */
......@@ -146,6 +146,15 @@ void gimp_image_detach_parasite (GimpImage *, const char *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
specifies which color has changed, or negative if there's a bigger change.
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
/* layer/channel functions */
......
......@@ -28,7 +28,6 @@
#include "gdisplay_ops.h"
#include "gimage_mask.h"
#include "gimprc.h"
#include "indexed_palette.h"
#include "layer.h"
#include "paint_core.h"
#include "paint_funcs.h"
......@@ -1987,7 +1986,7 @@ undo_pop_gimage_mod (GImage *gimage,
gdisplays_update_full (gimage);
gdisplays_update_title (gimage);
indexed_palette_update_image_list ();
gimp_image_colormap_changed (gimage, -1);
if (gimage->width != (int) data[0] || gimage->height != (int) data[1])
shrink_wrap = TRUE;
......
......@@ -93,6 +93,7 @@ enum{
RENAME,
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
LAST_SIGNAL
};
static void gimp_image_destroy (GtkObject *);
......@@ -123,6 +124,8 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_signal_new ("resize", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[RESTRUCTURE] =
gimp_signal_new ("restructure", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", 0, type, 0, gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -923,7 +926,15 @@ gimp_image_get_new_tattoo(GimpImage *image)
return (image->tattoo_state);
}
void
gimp_image_colormap_changed (GimpImage *image, gint col){
g_return_if_fail (image);
g_return_if_fail (col < image->num_cols);
gtk_signal_emit (GTK_OBJECT(image),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
......
......@@ -18,7 +18,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
/* the image types */
......@@ -146,6 +146,15 @@ void gimp_image_detach_parasite (GimpImage *, const char *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
specifies which color has changed, or negative if there's a bigger change.
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
/* layer/channel functions */
......
......@@ -93,6 +93,7 @@ enum{
RENAME,
RESIZE,
RESTRUCTURE,
COLORMAP_CHANGED,
LAST_SIGNAL
};
static void gimp_image_destroy (GtkObject *);
......@@ -123,6 +124,8 @@ gimp_image_class_init (GimpImageClass *klass)
gimp_signal_new ("resize", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[RESTRUCTURE] =
gimp_signal_new ("restructure", 0, type, 0, gimp_sigtype_void);
gimp_image_signals[COLORMAP_CHANGED] =
gimp_signal_new ("colormap_changed", 0, type, 0, gimp_sigtype_int);
gtk_object_class_add_signals (object_class, gimp_image_signals, LAST_SIGNAL);
}
......@@ -923,7 +926,15 @@ gimp_image_get_new_tattoo(GimpImage *image)
return (image->tattoo_state);
}
void
gimp_image_colormap_changed (GimpImage *image, gint col){
g_return_if_fail (image);
g_return_if_fail (col < image->num_cols);
gtk_signal_emit (GTK_OBJECT(image),
gimp_image_signals[COLORMAP_CHANGED],
col);
}
/************************************************************/
/* Projection functions */
/************************************************************/
......
......@@ -18,7 +18,7 @@
#define GIMP_IMAGE(obj) GTK_CHECK_CAST (obj, GIMP_TYPE_IMAGE, GimpImage)
#define GIMP_IS_GIMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
#define GIMP_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, GIMP_TYPE_IMAGE)
/* the image types */
......@@ -146,6 +146,15 @@ void gimp_image_detach_parasite (GimpImage *, const char *);
Tattoo gimp_image_get_new_tattoo (GimpImage *);
/* Temporary hack till colormap manipulation is encapsulated in functions.
Call this whenever you modify an image's colormap. The ncol argument
specifies which color has changed, or negative if there's a bigger change.
Currently, use this also when the image's base type is changed to/from
indexed. */
void gimp_image_colormap_changed (GimpImage * image,
gint ncol);
/* layer/channel functions */
......
......@@ -28,7 +28,6 @@
#include "histogram_tool.h"
#include "hue_saturation.h"
#include "image_render.h"
#include "indexed_palette.h"
#include "info_window.h"
#include "interface.h"
#include "invert.h"
......
......@@ -4,8 +4,6 @@
#include "channels_dialog.h"
#include "layers_dialog.h"
#include "indexed_palette.h"
#include "drawable.h"
#include "gdisplay.h"
#include "procedural_db.h"
......@@ -27,6 +25,8 @@
<