Commit 3d92aa58 authored by Maurits Rijk's avatar Maurits Rijk

Started implementation of fuzzy select. Removed 2 pixmaps for which we now...

Started implementation of fuzzy select. Removed 2 pixmaps for which we now have stock icons and made a few changes according to #87687
parent fcdb1553
2002-08-03 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/Makefile.am (EXTRA_DIST): removed *.xpm files for
which we now use GTK stock icons
* plug-ins/imagemap/edit.xpm
* plug-ins/imagemap/preferences.xpm: removed these pixmaps since we now
use stock icons for those.
* plug-ins/imagemap/imap_preferences.c
* plug-ins/imagemap/imap_browse.c: replaced a few deprecated GTK
function calls.
2002-08-02 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/imap_preferences.c
* plug-ins/imagemap/imap_main.c
* plug-ins/imagemap/imap_main.h
* plug-ins/imagemap/imap_menu.c
* plug-ins/imagemap/imap_menu.h
* plug-ins/imagemap/imap_tools.c
* plug-ins/imagemap/imap_tools.h: started implementation of fuzzy
select: you can now click on a more or less contiguous region and the
plug-in will automatically create an object (circle, rectangle or
polygon)
2002-08-01 Maurits Rijk <lpeek.mrijk@consunet.nl>
* plug-ins/imagemap/imap_object.c (object_list_write_csim)
......
......@@ -11,11 +11,9 @@ EXTRA_DIST = \
circle.xpm \
coord.xpm \
dimension.xpm \
edit.xpm \
grid.xpm \
map_info.xpm \
polygon.xpm \
preferences.xpm \
rectangle.xpm \
to_back.xpm \
to_front.xpm \
......
/* XPM */
static char * edit_xpm[] = {
"16 16 4 1",
" c None",
". c #000000",
"+ c #FF0000",
"@ c #FFFF00",
" ",
" .. ",
" . .+. ",
" .@. ",
" . .@. ",
" . ..@. ",
" .@. ",
" .@.. ",
" .@. . ",
" .@. ",
" .@. . ",
" .@. ",
" .@. . ",
" .. . ",
" . . ",
" "};
......@@ -21,11 +21,6 @@
*
*/
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "imap_browse.h"
......@@ -65,9 +60,9 @@ browse_cb(GtkWidget *widget, gpointer data)
if (!browse->file_selection) {
GtkWidget *dialog;
dialog = browse->file_selection = gtk_file_selection_new(browse->name);
gtk_signal_connect_object(
GTK_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog));
g_signal_connect_swapped(
G_OBJECT(GTK_FILE_SELECTION(dialog)->cancel_button),
"clicked", G_CALLBACK(gtk_widget_hide), G_OBJECT(dialog));
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dialog)->ok_button),
"clicked", G_CALLBACK(select_cb), data);
}
......
......@@ -95,6 +95,7 @@ static PreferencesData_t _preferences = {CSIM, TRUE, FALSE, TRUE, TRUE, FALSE,
FALSE, DEFAULT_UNDO_LEVELS, DEFAULT_MRU_SIZE};
static MRU_t *_mru;
static GimpDrawable *_drawable;
static GdkCursorType _cursor;
static gboolean _show_url = TRUE;
static gchar *_filename = NULL;
......@@ -171,6 +172,7 @@ run(char *name, int n_params, GimpParam *param, int *nreturn_vals,
/* Get the specified drawable */
drawable = gimp_drawable_get(param[2].data.d_drawable);
_drawable = drawable;
_image_name = gimp_image_get_name(param[1].data.d_image);
_image_width = gimp_image_width(param[1].data.d_image);
_image_height = gimp_image_height(param[1].data.d_image);
......@@ -435,6 +437,95 @@ set_arrow_func(void)
_cursor = GDK_TOP_LEFT_ARROW;
}
static gboolean
fuzzy_select_on_button_press(GtkWidget *widget, GdkEventButton *event,
gpointer data)
{
if (event->button == 1) {
gdouble rx = get_real_coord((gint) event->x);
gdouble ry = get_real_coord((gint) event->y);
gint32 image_ID = gimp_drawable_image(_drawable->drawable_id);
gint32 channel_ID;
/* Save the old selection first */
channel_ID = gimp_selection_save(image_ID);
if (gimp_fuzzy_select(_drawable->drawable_id, rx, ry,
10, /* Treshold */
GIMP_CHANNEL_OP_REPLACE,
FALSE, FALSE, 0, FALSE)) {
GimpParam *return_vals;
gint nreturn_vals;
return_vals = gimp_run_procedure("plug_in_sel2path",
&nreturn_vals,
GIMP_PDB_INT32, TRUE,
GIMP_PDB_IMAGE, 0,
GIMP_PDB_DRAWABLE,
_drawable->drawable_id,
GIMP_PDB_END);
if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS) {
gdouble distance;
gchar *path_name = gimp_path_get_current(image_ID);
Object_t *object = create_polygon(NULL);
Polygon_t *polygon = ObjectToPolygon(object);
gint x0, y0;
gdouble grad0;
add_shape(object);
x0 = gimp_path_get_point_at_dist(image_ID, 0.0, &y0, &grad0);
polygon->points = g_list_append(NULL, new_point(x0, y0));
for (distance = 1.0;; distance += 1.0) {
gint x1, y1 = -1;
gdouble grad1;
x1 = gimp_path_get_point_at_dist(image_ID, distance, &y1,
&grad1);
if (y1 == -1)
break;
if (abs(x1 - x0) <= 1 || abs(y1 - y0) <= 1) {
gdouble diff;
if (grad0 != 0.0)
diff = (grad1 - grad0) / grad0;
else
diff = grad1;
if (fabs(diff) > 0.1) {
polygon->points = g_list_append(polygon->points,
new_point(x1, y1));
grad0 = grad1;
}
x0 = x1;
y0 = y1;
}
}
gimp_path_delete(image_ID, path_name);
g_free(path_name);
} else {
printf("Damn %d\n", return_vals[0].data.d_status);
}
gimp_destroy_params(return_vals, nreturn_vals);
}
/* Restore old selection */
(void) gimp_selection_load(channel_ID);
(void) gimp_image_remove_channel(image_ID, channel_ID);
gimp_channel_delete(channel_ID);
}
return FALSE;
}
void
set_fuzzy_select_func(void)
{
_button_press_func = fuzzy_select_on_button_press;
_cursor = GDK_TOP_LEFT_ARROW; /* Fix me! */
}
static void
set_object_func(gboolean (*func)(GtkWidget*, GdkEventButton*,
gpointer), gpointer param)
......
......@@ -75,6 +75,7 @@ void draw_polygon(GdkWindow *window, GdkGC *gc, GList *list);
const char *get_filename(void);
void set_arrow_func(void);
void set_fuzzy_select_func(void);
void set_rectangle_func(void);
void set_circle_func(void);
void set_polygon_func(void);
......
......@@ -26,11 +26,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "imap_circle.h"
......@@ -96,62 +91,18 @@ menu_shapes_selected(gint count)
}
static void
menu_zoom_to(gint factor)
{
if (_menu_callback_lock) {
_menu_callback_lock--;
} else {
set_zoom(factor);
}
menu_set_zoom_sensitivity(factor);
}
static void
menu_zoom_to_1(GtkWidget *widget, gpointer data)
{
menu_zoom_to(1);
}
static void
menu_zoom_to_2(GtkWidget *widget, gpointer data)
{
menu_zoom_to(2);
}
static void
menu_zoom_to_3(GtkWidget *widget, gpointer data)
{
menu_zoom_to(3);
}
static void
menu_zoom_to_4(GtkWidget *widget, gpointer data)
{
menu_zoom_to(4);
}
static void
menu_zoom_to_5(GtkWidget *widget, gpointer data)
{
menu_zoom_to(5);
}
static void
menu_zoom_to_6(GtkWidget *widget, gpointer data)
{
menu_zoom_to(6);
}
static void
menu_zoom_to_7(GtkWidget *widget, gpointer data)
menu_zoom_to(GtkWidget *widget, gpointer data)
{
menu_zoom_to(7);
}
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
gint factor = (gint) data;
static void
menu_zoom_to_8(GtkWidget *widget, gpointer data)
{
menu_zoom_to(8);
if (_menu_callback_lock) {
_menu_callback_lock--;
} else {
set_zoom(factor);
}
menu_set_zoom_sensitivity(factor);
}
}
static void
......@@ -202,6 +153,20 @@ menu_arrow(GtkWidget *widget, gpointer data)
}
}
static void
menu_fuzzy_select(GtkWidget *widget, gpointer data)
{
if (_menu_callback_lock) {
_menu_callback_lock = FALSE;
} else {
/*
set_arrow_func();
tools_select_arrow();
popup_select_arrow();
*/
}
}
static void
menu_grid(GtkWidget *widget, gpointer data)
{
......@@ -359,29 +324,29 @@ make_view_menu(GtkWidget *menu_bar)
zoom_menu = make_sub_menu(view_menu, _("Zoom To"));
_menu.zoom[0] = make_radio_item(zoom_menu, NULL, "1:1", menu_zoom_to_1,
NULL);
_menu.zoom[0] = make_radio_item(zoom_menu, NULL, "1:1", menu_zoom_to,
(gpointer) 1);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[0]));
_menu.zoom[1] = make_radio_item(zoom_menu, group, "1:2", menu_zoom_to_2,
NULL);
_menu.zoom[1] = make_radio_item(zoom_menu, group, "1:2", menu_zoom_to,
(gpointer) 2);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[1]));
_menu.zoom[2] = make_radio_item(zoom_menu, group, "1:3", menu_zoom_to_3,
NULL);
_menu.zoom[2] = make_radio_item(zoom_menu, group, "1:3", menu_zoom_to,
(gpointer) 3);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[2]));
_menu.zoom[3] = make_radio_item(zoom_menu, group, "1:4", menu_zoom_to_4,
NULL);
_menu.zoom[3] = make_radio_item(zoom_menu, group, "1:4", menu_zoom_to,
(gpointer) 4);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[3]));
_menu.zoom[4] = make_radio_item(zoom_menu, group, "1:5", menu_zoom_to_5,
NULL);
_menu.zoom[4] = make_radio_item(zoom_menu, group, "1:5", menu_zoom_to,
(gpointer) 5);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[4]));
_menu.zoom[5] = make_radio_item(zoom_menu, group, "1:6", menu_zoom_to_6,
NULL);
_menu.zoom[5] = make_radio_item(zoom_menu, group, "1:6", menu_zoom_to,
(gpointer) 6);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[5]));
_menu.zoom[6] = make_radio_item(zoom_menu, group, "1:7", menu_zoom_to_7,
NULL);
_menu.zoom[6] = make_radio_item(zoom_menu, group, "1:7", menu_zoom_to,
(gpointer) 7);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.zoom[6]));
_menu.zoom[7] = make_radio_item(zoom_menu, group, "1:8", menu_zoom_to_8,
NULL);
_menu.zoom[7] = make_radio_item(zoom_menu, group, "1:8", menu_zoom_to,
(gpointer) 8);
}
static void
......@@ -392,6 +357,10 @@ make_mapping_menu(GtkWidget *menu_bar)
_menu.arrow = make_radio_item(menu, NULL, _("Arrow"), menu_arrow, NULL);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.arrow));
_menu.fuzzy_select = make_radio_item(menu, group,
_("Select Contiguous Region"),
menu_fuzzy_select, NULL);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.fuzzy_select));
_menu.rectangle = make_radio_item(menu, group, _("Rectangle"),
menu_rectangle, NULL);
group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(_menu.rectangle));
......@@ -419,8 +388,8 @@ static void
make_help_menu(GtkWidget *menu_bar)
{
GtkWidget *help_menu = make_menu_bar_item(menu_bar, _("_Help"));
gtk_menu_item_right_justify(GTK_MENU_ITEM(gtk_menu_get_attach_widget(
GTK_MENU(help_menu))));
gtk_menu_item_set_right_justified(
GTK_MENU_ITEM(gtk_menu_get_attach_widget(GTK_MENU(help_menu))), TRUE);
make_item_with_label(help_menu, _("About ImageMap..."), menu_command,
&_menu.cmd_about);
}
......@@ -484,6 +453,12 @@ menu_select_arrow(void)
menu_select(_menu.arrow);
}
void
menu_select_fuzzy_select(void)
{
menu_select(_menu.fuzzy_select);
}
void
menu_select_rectangle(void)
{
......
......@@ -3,7 +3,7 @@
*
* Generates clickable image maps.
*
* Copyright (C) 1998-1999 Maurits Rijk lpeek.mrijk@consunet.nl
* Copyright (C) 1998-2002 Maurits Rijk lpeek.mrijk@consunet.nl
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -37,6 +37,7 @@ typedef struct {
GtkWidget *clear;
GtkWidget *edit;
GtkWidget *arrow;
GtkWidget *fuzzy_select;
GtkWidget *rectangle;
GtkWidget *circle;
GtkWidget *polygon;
......@@ -134,6 +135,7 @@ void menu_build_mru_items(MRU_t *mru);
void menu_set_zoom_sensitivity(gint factor);
void menu_select_arrow(void);
void menu_select_fuzzy_select(void);
void menu_select_rectangle(void);
void menu_select_circle(void);
void menu_select_polygon(void);
......
......@@ -27,11 +27,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
#endif
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>
#include "libgimp/gimp.h"
......@@ -307,15 +302,10 @@ static void
change_color(PreferencesDialog_t *param, GtkWidget *button,
GdkColor *gdk_color)
{
gdouble color[3];
GdkColormap *colormap;
GtkColorSelection *colorsel = GTK_COLOR_SELECTION(param->color_sel);
gtk_color_selection_get_color(colorsel, color);
gdk_color->red = (guint16)(color[0]*65535.0);
gdk_color->green = (guint16)(color[1]*65535.0);
gdk_color->blue = (guint16)(color[2]*65535.0);
gtk_color_selection_get_current_color(colorsel, gdk_color);
colormap = gdk_drawable_get_colormap(button->window);
gdk_colormap_alloc_color(colormap, gdk_color, FALSE, TRUE);
......@@ -356,8 +346,6 @@ area_event(GtkWidget *widget, GdkEvent *event, PreferencesDialog_t *param,
GdkColor *gdk_color,
void (*color_changed_func)(GtkWidget *widget, gpointer data))
{
gdouble color[3];
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
......@@ -369,25 +357,22 @@ area_event(GtkWidget *widget, GdkEvent *event, PreferencesDialog_t *param,
param->color_sel = GTK_COLOR_SELECTION_DIALOG(
param->color_sel_dlg)->colorsel;
gtk_signal_connect(GTK_OBJECT(param->color_sel), "color_changed",
(GtkSignalFunc)color_changed, (gpointer) param);
g_signal_connect(G_OBJECT(param->color_sel), "color_changed",
(GtkSignalFunc)color_changed, (gpointer) param);
gtk_signal_connect(
GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(dialog)->ok_button),
g_signal_connect(
G_OBJECT(GTK_COLOR_SELECTION_DIALOG(dialog)->ok_button),
"clicked", GTK_SIGNAL_FUNC(select_color_ok), (gpointer) param);
gtk_signal_connect(
GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(dialog)->cancel_button),
g_signal_connect(
G_OBJECT(GTK_COLOR_SELECTION_DIALOG(dialog)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(select_color_cancel), (gpointer) param);
}
_color_changed_func = color_changed_func;
color[0] = (gdouble) gdk_color->red / 65535.0;
color[1] = (gdouble) gdk_color->green / 65535.0;
color[2] = (gdouble) gdk_color->blue / 65535.0;
gtk_color_selection_set_color(GTK_COLOR_SELECTION(param->color_sel), color);
gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(param->color_sel),
gdk_color);
gtk_widget_show(param->color_sel_dlg);
return TRUE;
......@@ -425,20 +410,35 @@ edit_selected_bg(GtkWidget *widget, GdkEvent *event,
selected_bg_color_changed);
}
static void
create_general_tab(PreferencesDialog_t *data, GtkWidget *notebook)
static GtkWidget*
create_tab(GtkWidget *notebook, gchar *label, gint rows, gint cols)
{
GtkWidget *table;
GtkWidget *frame;
GtkWidget *hbox;
GtkWidget *label;
GtkWidget *vbox;
vbox = gtk_vbox_new(FALSE, 1);
gtk_widget_show(vbox);
table = gtk_table_new(7, 2, FALSE);
table = gtk_table_new(rows, cols, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_widget_show(table);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox,
gtk_label_new_with_mnemonic(label));
return table;
}
static void
create_general_tab(PreferencesDialog_t *data, GtkWidget *notebook)
{
GtkWidget *table = create_tab(notebook, _("_General"), 7, 2);
GtkWidget *frame;
GtkWidget *hbox;
frame = gtk_frame_new( _("Default Map Type"));
gtk_widget_show(frame);
gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 2, 0, 1);
......@@ -471,39 +471,22 @@ create_general_tab(PreferencesDialog_t *data, GtkWidget *notebook)
create_check_button_in_table(table, 6, 0,
_("_Use double-sized grab handles"));
gtk_widget_show(frame);
label = gtk_label_new_with_mnemonic( _("_General"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);
}
static void
create_menu_tab(PreferencesDialog_t *data, GtkWidget *notebook)
{
GtkWidget *table;
GtkWidget *table = create_tab(notebook, _("_Menu"), 2, 2);
GtkWidget *label;
GtkWidget *vbox;
vbox = gtk_vbox_new(FALSE, 1);
gtk_widget_show(vbox);
table = gtk_table_new(2, 2, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_widget_show(table);
label = create_label_in_table(table, 0, 0,
_("Number of Undo _levels (1 - 99):"));
_("Number of _Undo levels (1 - 99):"));
data->undo_levels = create_spin_button_in_table(table, label, 0, 1, 1, 1,
99);
label = create_label_in_table(table, 1, 0,
_("Number of MRU _entries (1 - 16):"));
_("Number of M_RU entries (1 - 16):"));
data->mru_size = create_spin_button_in_table(table, label, 1, 1, 1, 1, 16);
label = gtk_label_new_with_mnemonic( _("_Menu"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
}
static GtkWidget*
......@@ -512,11 +495,11 @@ create_color_field(PreferencesDialog_t *data, GtkWidget *table, gint row,
{
GtkWidget *area = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(area), 16, 8);
gtk_widget_set_size_request(area, 16, 8);
gtk_widget_set_events(area, GDK_BUTTON_PRESS_MASK);
gtk_table_attach_defaults(GTK_TABLE(table), area, col, col + 1, row,
row + 1);
gtk_signal_connect(GTK_OBJECT(area), "event", func, (gpointer) data);
g_signal_connect(G_OBJECT(area), "event", func, (gpointer) data);
gtk_widget_show(area);
return area;
......@@ -525,19 +508,8 @@ create_color_field(PreferencesDialog_t *data, GtkWidget *table, gint row,
static void
create_colors_tab(PreferencesDialog_t *data, GtkWidget *notebook)
{
GtkWidget *table, *label;
GtkWidget *vbox;
vbox = gtk_vbox_new(FALSE, 1);
gtk_widget_show(vbox);
table = gtk_table_new(2, 3, FALSE);
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
gtk_container_set_border_width(GTK_CONTAINER(table), 10);
gtk_table_set_col_spacings(GTK_TABLE(table), 10);
gtk_table_set_row_spacings(GTK_TABLE(table), 10);
gtk_widget_show(table);
GtkWidget *table = create_tab(notebook, _("Co_lors"), 2, 3);
create_label_in_table(table, 0, 0, _("Normal:"));
data->normal_fg = create_color_field(data, table, 0, 1,
(GtkSignalFunc) edit_normal_fg);
......@@ -549,9 +521,18 @@ create_colors_tab(PreferencesDialog_t *data, GtkWidget *notebook)
(GtkSignalFunc) edit_selected_fg);
data->selected_bg = create_color_field(data, table, 1, 2,
(GtkSignalFunc) edit_selected_bg);
}
static void
create_contiguous_regions_tab(PreferencesDialog_t *data, GtkWidget *notebook)
{
GtkWidget *table = create_tab(notebook, _("Co_ntiguous Region"), 2, 2);
GtkWidget *label;
label = gtk_label_new_with_mnemonic( _("Co_lors"));
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbox, label);
label = create_label_in_table(table, 0, 0,
_("_Threshold:"));
data->auto_convert =
create_check_button_in_table(table, 1, 0, _("_Automatically convert"));
}
static void
......@@ -577,14 +558,15 @@ create_preferences_dialog()
data->notebook = notebook = gtk_notebook_new();
gtk_container_set_border_width(GTK_CONTAINER(notebook), 10);
gtk_signal_connect_after(GTK_OBJECT(notebook), "switch_page",
GTK_SIGNAL_FUNC(switch_page), (gpointer) data);
g_signal_connect_after(G_OBJECT(notebook), "switch_page",
GTK_SIGNAL_FUNC(switch_page), (gpointer) data);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog->dialog)->vbox),
notebook, TRUE, TRUE, 10);
create_general_tab(data, notebook);
create_menu_tab(data, notebook);
create_colors_tab(data, notebook);
create_contiguous_regions_tab(data, notebook);
gtk_widget_show(notebook);
......
......@@ -41,6 +41,8 @@ typedef struct {
gboolean keep_circles_round;
gboolean show_url_tip;
gboolean use_doublesized;
gboolean auto_convert;
gdouble threshold;
gint undo_levels;
gint mru_size;
ColorSelData_t colors;
......@@ -71,6 +73,9 @@ typedef struct {
GtkWidget *color_sel_dlg;
GtkWidget *color_sel;
GtkWidget *threshold;
GtkWidget *auto_convert;
PreferencesData_t *old_data;
ColorSelData_t old_colors;
ColorSelData_t new_colors;
......
......@@ -37,6 +37,7 @@
#include "imap_tools.h"
#include "libgimp/stdplugins-intl.h"
#include "libgimpwidgets/gimpstock.h"
static gboolean _callback_lock;
static Tools_t _tools;
......@@ -75,6 +76,20 @@ arrow_clicked(GtkWidget *widget, gpointer data)
}
}
static void
fuzzy_select_clicked(GtkWidget *widget, gpointer data)
{
if (_callback_lock) {
_callback_lock = FALSE;
} else {
set_fuzzy_select_func();
/*
menu_select_fuzzy_select();
popup_select_fuzzy_select();
*/
}
}
static void
rectangle_clicked(GtkWidget *widget, gpointer data)
{
......@@ -129,8 +144,14 @@ make_tools(GtkWidget *window)
NULL, _("Select"),
_("Select existing area"),
arrow_clicked, NULL);
_tools.fuzzy_select =
make_toolbar_radio_icon(toolbar, GIMP_STOCK_TOOL_FUZZY_SELECT,
_tools.arrow, _("Fuzzy Select"),
_("Select contiguous regions"),
fuzzy_select_clicked, NULL);
_tools.rectangle = make_toolbar_radio_icon(toolbar, IMAP_STOCK_RECTANGLE,
_tools.arrow, _("Rectangle"),
_tools.fuzzy_select,
_("Rectangle"),
_("Define Rectangle area"),
rectangle_clicked, NULL);
_tools.circle = make_toolbar_radio_icon(toolbar, IMAP_STOCK_CIRCLE,
......
......@@ -29,6 +29,7 @@
typedef struct {
GtkWidget *container;
GtkWidget *arrow;
GtkWidget *fuzzy_select;
GtkWidget *rectangle;
GtkWidget *circle;
GtkWidget *polygon;
......
/* XPM */
static char * preferences_xpm[] = {
"16 16 5 1",
" c None",
". c #707070",
"+ c #000000",
"@ c #D6D6D6",