Some more or less cosmetic changes to the channels-dialog.

--Sven
This commit is contained in:
Sven Neumann 1999-03-13 18:55:04 +00:00
parent 3faf83af86
commit d86538d5c5
7 changed files with 158 additions and 6 deletions

View File

@ -1,3 +1,13 @@
Sat Mar 13 19:46:54 MET 1999 Sven Neumann <sven@gimp.org>
* 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 <mitschel@cs.tu-berlin.de> 1999-03-12 Michael Natterer <mitschel@cs.tu-berlin.de>
Moved all pixmaps and bitmaps from app/ and libgimp/ to pixmaps/ Moved all pixmaps and bitmaps from app/ and libgimp/ to pixmaps/

View File

@ -23,7 +23,7 @@ EXTRA_DIST = \
pixmaps/penedit.xpm \ pixmaps/penedit.xpm \
pixmaps/pennorm.xpm \ pixmaps/pennorm.xpm \
pixmaps/penstroke.xpm \ pixmaps/penstroke.xpm \
pixmaps/ptoselection.xpm \ pixmaps/toselection.xpm \
pixmaps/zoom_in.xpm \ pixmaps/zoom_in.xpm \
pixmaps/zoom_out.xpm \ pixmaps/zoom_out.xpm \
README.i18n \ README.i18n \

View File

@ -44,6 +44,7 @@
#include "pixmaps/lower.xpm" #include "pixmaps/lower.xpm"
#include "pixmaps/duplicate.xpm" #include "pixmaps/duplicate.xpm"
#include "pixmaps/delete.xpm" #include "pixmaps/delete.xpm"
#include "pixmaps/toselection.xpm"
#include "libgimp/gimpintl.h" #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_duplicate_channel_callback (GtkWidget *, gpointer);
static void channels_dialog_delete_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_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 */ /* channel widget function prototypes */
static ChannelWidget *channel_widget_get_ID (Channel *); static ChannelWidget *channel_widget_get_ID (Channel *);
@ -164,6 +167,10 @@ static MenuItem channels_ops[] =
channels_dialog_delete_channel_callback, NULL, NULL, NULL }, channels_dialog_delete_channel_callback, NULL, NULL, NULL },
{ N_("Channel To Selection"), 'S', GDK_CONTROL_MASK, { N_("Channel To Selection"), 'S', GDK_CONTROL_MASK,
channels_dialog_channel_to_sel_callback, NULL, NULL, NULL }, 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 }, { 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 }, { lower_xpm, channels_dialog_lower_channel_callback, N_("Lower Channel"), NULL },
{ duplicate_xpm, channels_dialog_duplicate_channel_callback, N_("Duplicate Channel"), NULL }, { duplicate_xpm, channels_dialog_duplicate_channel_callback, N_("Duplicate Channel"), NULL },
{ delete_xpm, channels_dialog_delete_channel_callback, N_("Delete 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 } { 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); gtk_widget_set_sensitive (channels_ops_buttons[4].widget, !fs_sensitive && aux_sensitive);
/* channel to selection */ /* channel to selection */
gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive); 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 */ /* channel widget functions */
/****************************/ /****************************/

View File

@ -44,6 +44,7 @@
#include "pixmaps/lower.xpm" #include "pixmaps/lower.xpm"
#include "pixmaps/duplicate.xpm" #include "pixmaps/duplicate.xpm"
#include "pixmaps/delete.xpm" #include "pixmaps/delete.xpm"
#include "pixmaps/toselection.xpm"
#include "libgimp/gimpintl.h" #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_duplicate_channel_callback (GtkWidget *, gpointer);
static void channels_dialog_delete_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_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 */ /* channel widget function prototypes */
static ChannelWidget *channel_widget_get_ID (Channel *); static ChannelWidget *channel_widget_get_ID (Channel *);
@ -164,6 +167,10 @@ static MenuItem channels_ops[] =
channels_dialog_delete_channel_callback, NULL, NULL, NULL }, channels_dialog_delete_channel_callback, NULL, NULL, NULL },
{ N_("Channel To Selection"), 'S', GDK_CONTROL_MASK, { N_("Channel To Selection"), 'S', GDK_CONTROL_MASK,
channels_dialog_channel_to_sel_callback, NULL, NULL, NULL }, 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 }, { 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 }, { lower_xpm, channels_dialog_lower_channel_callback, N_("Lower Channel"), NULL },
{ duplicate_xpm, channels_dialog_duplicate_channel_callback, N_("Duplicate Channel"), NULL }, { duplicate_xpm, channels_dialog_duplicate_channel_callback, N_("Duplicate Channel"), NULL },
{ delete_xpm, channels_dialog_delete_channel_callback, N_("Delete 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 } { 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); gtk_widget_set_sensitive (channels_ops_buttons[4].widget, !fs_sensitive && aux_sensitive);
/* channel to selection */ /* channel to selection */
gtk_widget_set_sensitive (channels_ops[5].widget, aux_sensitive); 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 */ /* channel widget functions */
/****************************/ /****************************/

View File

@ -61,7 +61,7 @@
#include "pixmaps/pendel.xpm" #include "pixmaps/pendel.xpm"
#include "pixmaps/penedit.xpm" #include "pixmaps/penedit.xpm"
#include "pixmaps/penstroke.xpm" #include "pixmaps/penstroke.xpm"
#include "pixmaps/ptoselection.xpm" #include "pixmaps/toselection.xpm"
#include "pixmaps/path.xbm" #include "pixmaps/path.xbm"
#define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK #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 }, { new_xpm, paths_dialog_new_path_callback, N_("New Path"), NULL },
{ duplicate_xpm, paths_dialog_dup_path_callback, N_("Duplicate 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 }, { penstroke_xpm, paths_dialog_stroke_path_callback, N_("Stroke Path"), NULL },
{ delete_xpm, paths_dialog_delete_path_callback, N_("Delete Path"), NULL }, { delete_xpm, paths_dialog_delete_path_callback, N_("Delete Path"), NULL },
{ NULL, NULL, NULL, NULL } { NULL, NULL, NULL, NULL }

View File

@ -61,7 +61,7 @@
#include "pixmaps/pendel.xpm" #include "pixmaps/pendel.xpm"
#include "pixmaps/penedit.xpm" #include "pixmaps/penedit.xpm"
#include "pixmaps/penstroke.xpm" #include "pixmaps/penstroke.xpm"
#include "pixmaps/ptoselection.xpm" #include "pixmaps/toselection.xpm"
#include "pixmaps/path.xbm" #include "pixmaps/path.xbm"
#define PREVIEW_EVENT_MASK GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_ENTER_NOTIFY_MASK #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 }, { new_xpm, paths_dialog_new_path_callback, N_("New Path"), NULL },
{ duplicate_xpm, paths_dialog_dup_path_callback, N_("Duplicate 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 }, { penstroke_xpm, paths_dialog_stroke_path_callback, N_("Stroke Path"), NULL },
{ delete_xpm, paths_dialog_delete_path_callback, N_("Delete Path"), NULL }, { delete_xpm, paths_dialog_delete_path_callback, N_("Delete Path"), NULL },
{ NULL, NULL, NULL, NULL } { NULL, NULL, NULL, NULL }

View File

@ -1,5 +1,5 @@
/* XPM */ /* XPM */
static char * ptoselection_xpm[] = { static char * toselection_xpm[] = {
"17 17 4 1", "17 17 4 1",
" c None", " c None",
". c #000000", ". c #000000",