diff --git a/ChangeLog b/ChangeLog index 2db3815748..e30f5a5329 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sat Mar 13 19:46:54 MET 1999 Sven Neumann + + * Makefile.am + * pixmaps/ptoselection.xpm -> pixmaps/toselection.xpm + * app/channels_dialog.c + * app/paths_dialog.c: Provide a button to convert a channel + into a selection. Share the xpm with the paths-dialog. Add two new + menu entries that allow to add or subtract the channel to/from the + current selection (as suggested by Wolfgang Hofer). + 1999-03-12 Michael Natterer Moved all pixmaps and bitmaps from app/ and libgimp/ to pixmaps/ diff --git a/Makefile.am b/Makefile.am index b4081abfce..ba10b84ac4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ EXTRA_DIST = \ pixmaps/penedit.xpm \ pixmaps/pennorm.xpm \ pixmaps/penstroke.xpm \ - pixmaps/ptoselection.xpm \ + pixmaps/toselection.xpm \ pixmaps/zoom_in.xpm \ pixmaps/zoom_out.xpm \ README.i18n \ diff --git a/app/channels_dialog.c b/app/channels_dialog.c index cd8d045967..fc44218479 100644 --- a/app/channels_dialog.c +++ b/app/channels_dialog.c @@ -44,6 +44,7 @@ #include "pixmaps/lower.xpm" #include "pixmaps/duplicate.xpm" #include "pixmaps/delete.xpm" +#include "pixmaps/toselection.xpm" #include "libgimp/gimpintl.h" @@ -123,6 +124,8 @@ static void channels_dialog_lower_channel_callback (GtkWidget *, gpointer); static void channels_dialog_duplicate_channel_callback (GtkWidget *, gpointer); static void channels_dialog_delete_channel_callback (GtkWidget *, gpointer); static void channels_dialog_channel_to_sel_callback (GtkWidget *, gpointer); +static void channels_dialog_add_channel_to_sel_callback (GtkWidget *, gpointer); +static void channels_dialog_sub_channel_from_sel_callback (GtkWidget *, gpointer); /* channel widget function prototypes */ static ChannelWidget *channel_widget_get_ID (Channel *); @@ -164,6 +167,10 @@ static MenuItem channels_ops[] = channels_dialog_delete_channel_callback, NULL, NULL, NULL }, { N_("Channel To Selection"), 'S', GDK_CONTROL_MASK, channels_dialog_channel_to_sel_callback, NULL, NULL, NULL }, + { N_("Add Channel To Selection"), 0, 0, + channels_dialog_add_channel_to_sel_callback, NULL, NULL, NULL }, + { N_("Sub Channel From Selection"), 0, 0, + channels_dialog_sub_channel_from_sel_callback, NULL, NULL, NULL }, { NULL, 0, 0, NULL, NULL, NULL, NULL }, }; @@ -175,6 +182,7 @@ static OpsButton channels_ops_buttons[] = { lower_xpm, channels_dialog_lower_channel_callback, N_("Lower Channel"), NULL }, { duplicate_xpm, channels_dialog_duplicate_channel_callback, N_("Duplicate Channel"), NULL }, { delete_xpm, channels_dialog_delete_channel_callback, N_("Delete Channel"), NULL }, + { toselection_xpm, channels_dialog_channel_to_sel_callback, N_("Channel To Selection"), NULL }, { NULL, NULL, NULL, NULL } }; @@ -556,6 +564,11 @@ channels_dialog_set_menu_sensitivity () gtk_widget_set_sensitive (channels_ops_buttons[4].widget, !fs_sensitive && aux_sensitive); /* channel to selection */ gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive); + gtk_widget_set_sensitive (channels_ops_buttons[5].widget, aux_sensitive); + /* add channel to selection */ + gtk_widget_set_sensitive (channels_ops[6].widget, aux_sensitive); + /* sub channel from selection */ + gtk_widget_set_sensitive (channels_ops[7].widget, aux_sensitive); } @@ -945,6 +958,64 @@ channels_dialog_channel_to_sel_callback (GtkWidget *w, } +static void +channels_dialog_add_channel_to_sel_callback (GtkWidget *w, + gpointer client_data) +{ + GImage *gimage; + Channel *active_channel; + Channel *new_channel; + + /* if there is a currently selected gimage + */ + if (!channelsD) + return; + if (! (gimage = channelsD->gimage)) + return; + + if ((active_channel = gimage_get_active_channel (gimage))) + { + new_channel = channel_copy (gimage_get_mask (gimage)); + channel_combine_mask (new_channel, + active_channel, + ADD, + 0, 0); /* off x/y */ + gimage_mask_load (gimage, new_channel); + channel_delete (new_channel); + gdisplays_flush (); + } +} + + +static void +channels_dialog_sub_channel_from_sel_callback (GtkWidget *w, + gpointer client_data) +{ + GImage *gimage; + Channel *active_channel; + Channel *new_channel; + + /* if there is a currently selected gimage + */ + if (!channelsD) + return; + if (! (gimage = channelsD->gimage)) + return; + + if ((active_channel = gimage_get_active_channel (gimage))) + { + new_channel = channel_copy (gimage_get_mask (gimage)); + channel_combine_mask (new_channel, + active_channel, + SUB, + 0, 0); /* off x/y */ + gimage_mask_load (gimage, new_channel); + channel_delete (new_channel); + gdisplays_flush (); + } +} + + /****************************/ /* channel widget functions */ /****************************/ diff --git a/app/gui/channels-dialog.c b/app/gui/channels-dialog.c index cd8d045967..fc44218479 100644 --- a/app/gui/channels-dialog.c +++ b/app/gui/channels-dialog.c @@ -44,6 +44,7 @@ #include "pixmaps/lower.xpm" #include "pixmaps/duplicate.xpm" #include "pixmaps/delete.xpm" +#include "pixmaps/toselection.xpm" #include "libgimp/gimpintl.h" @@ -123,6 +124,8 @@ static void channels_dialog_lower_channel_callback (GtkWidget *, gpointer); static void channels_dialog_duplicate_channel_callback (GtkWidget *, gpointer); static void channels_dialog_delete_channel_callback (GtkWidget *, gpointer); static void channels_dialog_channel_to_sel_callback (GtkWidget *, gpointer); +static void channels_dialog_add_channel_to_sel_callback (GtkWidget *, gpointer); +static void channels_dialog_sub_channel_from_sel_callback (GtkWidget *, gpointer); /* channel widget function prototypes */ static ChannelWidget *channel_widget_get_ID (Channel *); @@ -164,6 +167,10 @@ static MenuItem channels_ops[] = channels_dialog_delete_channel_callback, NULL, NULL, NULL }, { N_("Channel To Selection"), 'S', GDK_CONTROL_MASK, channels_dialog_channel_to_sel_callback, NULL, NULL, NULL }, + { N_("Add Channel To Selection"), 0, 0, + channels_dialog_add_channel_to_sel_callback, NULL, NULL, NULL }, + { N_("Sub Channel From Selection"), 0, 0, + channels_dialog_sub_channel_from_sel_callback, NULL, NULL, NULL }, { NULL, 0, 0, NULL, NULL, NULL, NULL }, }; @@ -175,6 +182,7 @@ static OpsButton channels_ops_buttons[] = { lower_xpm, channels_dialog_lower_channel_callback, N_("Lower Channel"), NULL }, { duplicate_xpm, channels_dialog_duplicate_channel_callback, N_("Duplicate Channel"), NULL }, { delete_xpm, channels_dialog_delete_channel_callback, N_("Delete Channel"), NULL }, + { toselection_xpm, channels_dialog_channel_to_sel_callback, N_("Channel To Selection"), NULL }, { NULL, NULL, NULL, NULL } }; @@ -556,6 +564,11 @@ channels_dialog_set_menu_sensitivity () gtk_widget_set_sensitive (channels_ops_buttons[4].widget, !fs_sensitive && aux_sensitive); /* channel to selection */ gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive); + gtk_widget_set_sensitive (channels_ops_buttons[5].widget, aux_sensitive); + /* add channel to selection */ + gtk_widget_set_sensitive (channels_ops[6].widget, aux_sensitive); + /* sub channel from selection */ + gtk_widget_set_sensitive (channels_ops[7].widget, aux_sensitive); } @@ -945,6 +958,64 @@ channels_dialog_channel_to_sel_callback (GtkWidget *w, } +static void +channels_dialog_add_channel_to_sel_callback (GtkWidget *w, + gpointer client_data) +{ + GImage *gimage; + Channel *active_channel; + Channel *new_channel; + + /* if there is a currently selected gimage + */ + if (!channelsD) + return; + if (! (gimage = channelsD->gimage)) + return; + + if ((active_channel = gimage_get_active_channel (gimage))) + { + new_channel = channel_copy (gimage_get_mask (gimage)); + channel_combine_mask (new_channel, + active_channel, + ADD, + 0, 0); /* off x/y */ + gimage_mask_load (gimage, new_channel); + channel_delete (new_channel); + gdisplays_flush (); + } +} + + +static void +channels_dialog_sub_channel_from_sel_callback (GtkWidget *w, + gpointer client_data) +{ + GImage *gimage; + Channel *active_channel; + Channel *new_channel; + + /* if there is a currently selected gimage + */ + if (!channelsD) + return; + if (! (gimage = channelsD->gimage)) + return; + + if ((active_channel = gimage_get_active_channel (gimage))) + { + new_channel = channel_copy (gimage_get_mask (gimage)); + channel_combine_mask (new_channel, + active_channel, + SUB, + 0, 0); /* off x/y */ + gimage_mask_load (gimage, new_channel); + channel_delete (new_channel); + gdisplays_flush (); + } +} + + /****************************/ /* channel widget functions */ /****************************/ diff --git a/app/gui/paths-dialog.c b/app/gui/paths-dialog.c index f05fb49cf8..97e9894306 100644 --- a/app/gui/paths-dialog.c +++ b/app/gui/paths-dialog.c @@ -61,7 +61,7 @@ #include "pixmaps/pendel.xpm" #include "pixmaps/penedit.xpm" #include "pixmaps/penstroke.xpm" -#include "pixmaps/ptoselection.xpm" +#include "pixmaps/toselection.xpm" #include "pixmaps/path.xbm" #define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK @@ -156,7 +156,7 @@ static OpsButton paths_ops_buttons[] = { { new_xpm, paths_dialog_new_path_callback, N_("New Path"), NULL }, { duplicate_xpm, paths_dialog_dup_path_callback, N_("Duplicate Path"), NULL }, - { ptoselection_xpm, paths_dialog_path_to_sel_callback, N_("Path to Selection"), NULL }, + { toselection_xpm, paths_dialog_path_to_sel_callback, N_("Path to Selection"), NULL }, { penstroke_xpm, paths_dialog_stroke_path_callback, N_("Stroke Path"), NULL }, { delete_xpm, paths_dialog_delete_path_callback, N_("Delete Path"), NULL }, { NULL, NULL, NULL, NULL } diff --git a/app/paths_dialog.c b/app/paths_dialog.c index f05fb49cf8..97e9894306 100644 --- a/app/paths_dialog.c +++ b/app/paths_dialog.c @@ -61,7 +61,7 @@ #include "pixmaps/pendel.xpm" #include "pixmaps/penedit.xpm" #include "pixmaps/penstroke.xpm" -#include "pixmaps/ptoselection.xpm" +#include "pixmaps/toselection.xpm" #include "pixmaps/path.xbm" #define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK @@ -156,7 +156,7 @@ static OpsButton paths_ops_buttons[] = { { new_xpm, paths_dialog_new_path_callback, N_("New Path"), NULL }, { duplicate_xpm, paths_dialog_dup_path_callback, N_("Duplicate Path"), NULL }, - { ptoselection_xpm, paths_dialog_path_to_sel_callback, N_("Path to Selection"), NULL }, + { toselection_xpm, paths_dialog_path_to_sel_callback, N_("Path to Selection"), NULL }, { penstroke_xpm, paths_dialog_stroke_path_callback, N_("Stroke Path"), NULL }, { delete_xpm, paths_dialog_delete_path_callback, N_("Delete Path"), NULL }, { NULL, NULL, NULL, NULL } diff --git a/pixmaps/ptoselection.xpm b/pixmaps/toselection.xpm similarity index 92% rename from pixmaps/ptoselection.xpm rename to pixmaps/toselection.xpm index c08f150d9a..e403957228 100644 --- a/pixmaps/ptoselection.xpm +++ b/pixmaps/toselection.xpm @@ -1,5 +1,5 @@ /* XPM */ -static char * ptoselection_xpm[] = { +static char * toselection_xpm[] = { "17 17 4 1", " c None", ". c #000000",