mirror of https://github.com/GNOME/gimp.git
Implemented gimp_palette_set_default_colors and
gimp_palette_swap_colors as pdb-calls and bound menu-entries and keybindings to them. (gimp-sven-980216-0.patch) --Sven
This commit is contained in:
parent
4fcde69ce0
commit
a19b750c45
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Sun Mar 1 20:28:54 MET 1998 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/internal_procs.c
|
||||
* app/palette.c
|
||||
* app/palette.h
|
||||
* app/commands.c
|
||||
* app/commands.h
|
||||
* app/menus.c
|
||||
* libgimp/gimppalette.c:
|
||||
implemented gimp_palette_set_default_colors and
|
||||
gimp_palette_swap_colors as pdb-calls and bound menu-entries and
|
||||
keybindings to them (gimp-sven-980216-0.patch)
|
||||
|
||||
Sat Feb 28 22:05:15 PST 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* autoconfed the data stuff
|
||||
|
|
|
@ -2278,6 +2278,20 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_set_default_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_swap_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_swap_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
|
|
@ -77,6 +77,8 @@ void layers_merge_cmd_callback (GtkWidget *, gpointer);
|
|||
void layers_flatten_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_alpha_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_mask_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void filters_repeat_cmd_callback (GtkWidget *, gpointer);
|
||||
void dialogs_brushes_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
#/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -205,8 +205,6 @@ color_area_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent;
|
||||
int target;
|
||||
unsigned char fg_r, fg_g, fg_b;
|
||||
unsigned char bg_r, bg_g, bg_b;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -239,18 +237,11 @@ color_area_events (GtkWidget *widget,
|
|||
}
|
||||
break;
|
||||
case SWAP_AREA:
|
||||
palette_get_foreground (&fg_r, &fg_g, &fg_b);
|
||||
palette_get_background (&bg_r, &bg_g, &bg_b);
|
||||
|
||||
palette_set_foreground (bg_r, bg_g, bg_b);
|
||||
palette_set_background (fg_r, fg_g, fg_b);
|
||||
|
||||
palette_swap_colors();
|
||||
color_area_draw ();
|
||||
break;
|
||||
case DEF_AREA:
|
||||
palette_set_foreground (0, 0, 0);
|
||||
palette_set_background (255, 255, 255);
|
||||
|
||||
palette_set_default_colors();
|
||||
color_area_draw ();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2278,6 +2278,20 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_set_default_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_swap_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_swap_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
|
|
@ -77,6 +77,8 @@ void layers_merge_cmd_callback (GtkWidget *, gpointer);
|
|||
void layers_flatten_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_alpha_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_mask_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void filters_repeat_cmd_callback (GtkWidget *, gpointer);
|
||||
void dialogs_brushes_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
#/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -205,8 +205,6 @@ color_area_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent;
|
||||
int target;
|
||||
unsigned char fg_r, fg_g, fg_b;
|
||||
unsigned char bg_r, bg_g, bg_b;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -239,18 +237,11 @@ color_area_events (GtkWidget *widget,
|
|||
}
|
||||
break;
|
||||
case SWAP_AREA:
|
||||
palette_get_foreground (&fg_r, &fg_g, &fg_b);
|
||||
palette_get_background (&bg_r, &bg_g, &bg_b);
|
||||
|
||||
palette_set_foreground (bg_r, bg_g, bg_b);
|
||||
palette_set_background (fg_r, fg_g, fg_b);
|
||||
|
||||
palette_swap_colors();
|
||||
color_area_draw ();
|
||||
break;
|
||||
case DEF_AREA:
|
||||
palette_set_foreground (0, 0, 0);
|
||||
palette_set_background (255, 255, 255);
|
||||
|
||||
palette_set_default_colors();
|
||||
color_area_draw ();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2278,6 +2278,20 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_set_default_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_swap_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_swap_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
|
|
@ -77,6 +77,8 @@ void layers_merge_cmd_callback (GtkWidget *, gpointer);
|
|||
void layers_flatten_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_alpha_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_mask_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void filters_repeat_cmd_callback (GtkWidget *, gpointer);
|
||||
void dialogs_brushes_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -2278,6 +2278,20 @@ layers_mask_select_cmd_callback (GtkWidget *widget,
|
|||
gdisplays_flush ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_default_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_set_default_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_swap_colors_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
{
|
||||
palette_swap_colors ();
|
||||
}
|
||||
|
||||
void
|
||||
tools_select_cmd_callback (GtkWidget *widget,
|
||||
gpointer client_data)
|
||||
|
|
|
@ -77,6 +77,8 @@ void layers_merge_cmd_callback (GtkWidget *, gpointer);
|
|||
void layers_flatten_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_alpha_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void layers_mask_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_default_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_swap_colors_cmd_callback (GtkWidget *, gpointer);
|
||||
void tools_select_cmd_callback (GtkWidget *, gpointer);
|
||||
void filters_repeat_cmd_callback (GtkWidget *, gpointer);
|
||||
void dialogs_brushes_cmd_callback (GtkWidget *, gpointer);
|
||||
|
|
|
@ -177,6 +177,8 @@ static GtkMenuEntry menu_items[] =
|
|||
{ "<Image>/Tools/Airbrush", "A", tools_select_cmd_callback, (gpointer) AIRBRUSH },
|
||||
{ "<Image>/Tools/Clone", "C", tools_select_cmd_callback, (gpointer) CLONE },
|
||||
{ "<Image>/Tools/Convolve", "V", tools_select_cmd_callback, (gpointer) CONVOLVE },
|
||||
{ "<Image>/Tools/Default Colors", "D", tools_default_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/<separator>", NULL, NULL, NULL },
|
||||
{ "<Image>/Tools/Toolbox", NULL, toolbox_raise_callback, NULL },
|
||||
|
||||
|
|
|
@ -357,6 +357,27 @@ palette_set_background (int r,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
palette_set_default_colors (void)
|
||||
{
|
||||
palette_set_foreground (0, 0, 0);
|
||||
palette_set_background (255, 255, 255);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
palette_swap_colors (void)
|
||||
{
|
||||
unsigned char fg_r, fg_g, fg_b;
|
||||
unsigned char bg_r, bg_g, bg_b;
|
||||
|
||||
palette_get_foreground (&fg_r, &fg_g, &fg_b);
|
||||
palette_get_background (&bg_r, &bg_g, &bg_b);
|
||||
|
||||
palette_set_foreground (bg_r, bg_g, bg_b);
|
||||
palette_set_background (fg_r, fg_g, fg_b);
|
||||
}
|
||||
|
||||
void
|
||||
palette_init_palettes (void)
|
||||
{
|
||||
|
@ -1616,3 +1637,81 @@ ProcRecord palette_set_background_proc =
|
|||
/* Exec method */
|
||||
{ { palette_set_background_invoker } },
|
||||
};
|
||||
|
||||
/*******************************/
|
||||
/* PALETTE_SET_DEFAULT_COLORS */
|
||||
|
||||
static Argument *
|
||||
palette_set_default_colors_invoker (Argument *args)
|
||||
{
|
||||
int success;
|
||||
|
||||
success = TRUE;
|
||||
if (success)
|
||||
palette_set_default_colors ();
|
||||
|
||||
return procedural_db_return_args (&palette_set_background_proc, success);
|
||||
}
|
||||
|
||||
/* The procedure definition */
|
||||
|
||||
ProcRecord palette_set_default_colors_proc =
|
||||
{
|
||||
"gimp_palette_set_default_colors",
|
||||
"Set the current GIMP foreground and background colors to black and white",
|
||||
"This procedure sets the current GIMP foreground and background colors to their initial default values, black and white.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { palette_set_default_colors_invoker } },
|
||||
};
|
||||
|
||||
/************************/
|
||||
/* PALETTE_SWAP_COLORS */
|
||||
|
||||
static Argument *
|
||||
palette_swap_colors_invoker (Argument *args)
|
||||
{
|
||||
int success;
|
||||
|
||||
success = TRUE;
|
||||
if (success)
|
||||
palette_swap_colors ();
|
||||
|
||||
return procedural_db_return_args (&palette_swap_colors_proc, success);
|
||||
}
|
||||
|
||||
/* The procedure definition */
|
||||
|
||||
ProcRecord palette_swap_colors_proc =
|
||||
{
|
||||
"gimp_palette_swap_colors",
|
||||
"Swap the current GIMP foreground and background colors",
|
||||
"This procedure swaps the current GIMP foreground and background colors, so that the new foreground color becomes the old background color and vice versa.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { palette_swap_colors_invoker } },
|
||||
};
|
||||
|
|
|
@ -38,6 +38,8 @@ void palette_get_background (unsigned char *, unsigned char *, unsigned char *);
|
|||
void palette_set_foreground (int, int, int);
|
||||
void palette_set_background (int, int, int);
|
||||
void palette_set_active_color (int, int, int, int);
|
||||
void palette_set_default_colors (void);
|
||||
void palette_swap_colors (void);
|
||||
|
||||
struct _PaletteEntries {
|
||||
char *name;
|
||||
|
@ -64,5 +66,7 @@ extern ProcRecord palette_get_foreground_proc;
|
|||
extern ProcRecord palette_get_background_proc;
|
||||
extern ProcRecord palette_set_foreground_proc;
|
||||
extern ProcRecord palette_set_background_proc;
|
||||
extern ProcRecord palette_set_default_colors_proc;
|
||||
extern ProcRecord palette_swap_colors_proc;
|
||||
|
||||
#endif /* __PALETTE_H__ */
|
||||
|
|
|
@ -294,6 +294,8 @@ internal_procs_init ()
|
|||
procedural_db_register (&palette_get_background_proc); pcount++;
|
||||
procedural_db_register (&palette_set_foreground_proc); pcount++;
|
||||
procedural_db_register (&palette_set_background_proc); pcount++;
|
||||
procedural_db_register (&palette_set_default_colors_proc); pcount++;
|
||||
procedural_db_register (&palette_swap_colors_proc); pcount++;
|
||||
|
||||
app_init_update_status(NULL, "Interface procedures",
|
||||
pcount/total_pcount);
|
||||
|
|
|
@ -177,6 +177,8 @@ static GtkMenuEntry menu_items[] =
|
|||
{ "<Image>/Tools/Airbrush", "A", tools_select_cmd_callback, (gpointer) AIRBRUSH },
|
||||
{ "<Image>/Tools/Clone", "C", tools_select_cmd_callback, (gpointer) CLONE },
|
||||
{ "<Image>/Tools/Convolve", "V", tools_select_cmd_callback, (gpointer) CONVOLVE },
|
||||
{ "<Image>/Tools/Default Colors", "D", tools_default_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/<separator>", NULL, NULL, NULL },
|
||||
{ "<Image>/Tools/Toolbox", NULL, toolbox_raise_callback, NULL },
|
||||
|
||||
|
|
|
@ -177,6 +177,8 @@ static GtkMenuEntry menu_items[] =
|
|||
{ "<Image>/Tools/Airbrush", "A", tools_select_cmd_callback, (gpointer) AIRBRUSH },
|
||||
{ "<Image>/Tools/Clone", "C", tools_select_cmd_callback, (gpointer) CLONE },
|
||||
{ "<Image>/Tools/Convolve", "V", tools_select_cmd_callback, (gpointer) CONVOLVE },
|
||||
{ "<Image>/Tools/Default Colors", "D", tools_default_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/<separator>", NULL, NULL, NULL },
|
||||
{ "<Image>/Tools/Toolbox", NULL, toolbox_raise_callback, NULL },
|
||||
|
||||
|
|
|
@ -357,6 +357,27 @@ palette_set_background (int r,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
palette_set_default_colors (void)
|
||||
{
|
||||
palette_set_foreground (0, 0, 0);
|
||||
palette_set_background (255, 255, 255);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
palette_swap_colors (void)
|
||||
{
|
||||
unsigned char fg_r, fg_g, fg_b;
|
||||
unsigned char bg_r, bg_g, bg_b;
|
||||
|
||||
palette_get_foreground (&fg_r, &fg_g, &fg_b);
|
||||
palette_get_background (&bg_r, &bg_g, &bg_b);
|
||||
|
||||
palette_set_foreground (bg_r, bg_g, bg_b);
|
||||
palette_set_background (fg_r, fg_g, fg_b);
|
||||
}
|
||||
|
||||
void
|
||||
palette_init_palettes (void)
|
||||
{
|
||||
|
@ -1616,3 +1637,81 @@ ProcRecord palette_set_background_proc =
|
|||
/* Exec method */
|
||||
{ { palette_set_background_invoker } },
|
||||
};
|
||||
|
||||
/*******************************/
|
||||
/* PALETTE_SET_DEFAULT_COLORS */
|
||||
|
||||
static Argument *
|
||||
palette_set_default_colors_invoker (Argument *args)
|
||||
{
|
||||
int success;
|
||||
|
||||
success = TRUE;
|
||||
if (success)
|
||||
palette_set_default_colors ();
|
||||
|
||||
return procedural_db_return_args (&palette_set_background_proc, success);
|
||||
}
|
||||
|
||||
/* The procedure definition */
|
||||
|
||||
ProcRecord palette_set_default_colors_proc =
|
||||
{
|
||||
"gimp_palette_set_default_colors",
|
||||
"Set the current GIMP foreground and background colors to black and white",
|
||||
"This procedure sets the current GIMP foreground and background colors to their initial default values, black and white.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { palette_set_default_colors_invoker } },
|
||||
};
|
||||
|
||||
/************************/
|
||||
/* PALETTE_SWAP_COLORS */
|
||||
|
||||
static Argument *
|
||||
palette_swap_colors_invoker (Argument *args)
|
||||
{
|
||||
int success;
|
||||
|
||||
success = TRUE;
|
||||
if (success)
|
||||
palette_swap_colors ();
|
||||
|
||||
return procedural_db_return_args (&palette_swap_colors_proc, success);
|
||||
}
|
||||
|
||||
/* The procedure definition */
|
||||
|
||||
ProcRecord palette_swap_colors_proc =
|
||||
{
|
||||
"gimp_palette_swap_colors",
|
||||
"Swap the current GIMP foreground and background colors",
|
||||
"This procedure swaps the current GIMP foreground and background colors, so that the new foreground color becomes the old background color and vice versa.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { palette_swap_colors_invoker } },
|
||||
};
|
||||
|
|
|
@ -38,6 +38,8 @@ void palette_get_background (unsigned char *, unsigned char *, unsigned char *);
|
|||
void palette_set_foreground (int, int, int);
|
||||
void palette_set_background (int, int, int);
|
||||
void palette_set_active_color (int, int, int, int);
|
||||
void palette_set_default_colors (void);
|
||||
void palette_swap_colors (void);
|
||||
|
||||
struct _PaletteEntries {
|
||||
char *name;
|
||||
|
@ -64,5 +66,7 @@ extern ProcRecord palette_get_foreground_proc;
|
|||
extern ProcRecord palette_get_background_proc;
|
||||
extern ProcRecord palette_set_foreground_proc;
|
||||
extern ProcRecord palette_set_background_proc;
|
||||
extern ProcRecord palette_set_default_colors_proc;
|
||||
extern ProcRecord palette_swap_colors_proc;
|
||||
|
||||
#endif /* __PALETTE_H__ */
|
||||
|
|
|
@ -177,6 +177,8 @@ static GtkMenuEntry menu_items[] =
|
|||
{ "<Image>/Tools/Airbrush", "A", tools_select_cmd_callback, (gpointer) AIRBRUSH },
|
||||
{ "<Image>/Tools/Clone", "C", tools_select_cmd_callback, (gpointer) CLONE },
|
||||
{ "<Image>/Tools/Convolve", "V", tools_select_cmd_callback, (gpointer) CONVOLVE },
|
||||
{ "<Image>/Tools/Default Colors", "D", tools_default_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/Swap Colors", "X", tools_swap_colors_cmd_callback, NULL},
|
||||
{ "<Image>/Tools/<separator>", NULL, NULL, NULL },
|
||||
{ "<Image>/Tools/Toolbox", NULL, toolbox_raise_callback, NULL },
|
||||
|
||||
|
|
|
@ -357,6 +357,27 @@ palette_set_background (int r,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
palette_set_default_colors (void)
|
||||
{
|
||||
palette_set_foreground (0, 0, 0);
|
||||
palette_set_background (255, 255, 255);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
palette_swap_colors (void)
|
||||
{
|
||||
unsigned char fg_r, fg_g, fg_b;
|
||||
unsigned char bg_r, bg_g, bg_b;
|
||||
|
||||
palette_get_foreground (&fg_r, &fg_g, &fg_b);
|
||||
palette_get_background (&bg_r, &bg_g, &bg_b);
|
||||
|
||||
palette_set_foreground (bg_r, bg_g, bg_b);
|
||||
palette_set_background (fg_r, fg_g, fg_b);
|
||||
}
|
||||
|
||||
void
|
||||
palette_init_palettes (void)
|
||||
{
|
||||
|
@ -1616,3 +1637,81 @@ ProcRecord palette_set_background_proc =
|
|||
/* Exec method */
|
||||
{ { palette_set_background_invoker } },
|
||||
};
|
||||
|
||||
/*******************************/
|
||||
/* PALETTE_SET_DEFAULT_COLORS */
|
||||
|
||||
static Argument *
|
||||
palette_set_default_colors_invoker (Argument *args)
|
||||
{
|
||||
int success;
|
||||
|
||||
success = TRUE;
|
||||
if (success)
|
||||
palette_set_default_colors ();
|
||||
|
||||
return procedural_db_return_args (&palette_set_background_proc, success);
|
||||
}
|
||||
|
||||
/* The procedure definition */
|
||||
|
||||
ProcRecord palette_set_default_colors_proc =
|
||||
{
|
||||
"gimp_palette_set_default_colors",
|
||||
"Set the current GIMP foreground and background colors to black and white",
|
||||
"This procedure sets the current GIMP foreground and background colors to their initial default values, black and white.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { palette_set_default_colors_invoker } },
|
||||
};
|
||||
|
||||
/************************/
|
||||
/* PALETTE_SWAP_COLORS */
|
||||
|
||||
static Argument *
|
||||
palette_swap_colors_invoker (Argument *args)
|
||||
{
|
||||
int success;
|
||||
|
||||
success = TRUE;
|
||||
if (success)
|
||||
palette_swap_colors ();
|
||||
|
||||
return procedural_db_return_args (&palette_swap_colors_proc, success);
|
||||
}
|
||||
|
||||
/* The procedure definition */
|
||||
|
||||
ProcRecord palette_swap_colors_proc =
|
||||
{
|
||||
"gimp_palette_swap_colors",
|
||||
"Swap the current GIMP foreground and background colors",
|
||||
"This procedure swaps the current GIMP foreground and background colors, so that the new foreground color becomes the old background color and vice versa.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
PDB_INTERNAL,
|
||||
|
||||
/* Input arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Output arguments */
|
||||
0,
|
||||
NULL,
|
||||
|
||||
/* Exec method */
|
||||
{ { palette_swap_colors_invoker } },
|
||||
};
|
||||
|
|
|
@ -38,6 +38,8 @@ void palette_get_background (unsigned char *, unsigned char *, unsigned char *);
|
|||
void palette_set_foreground (int, int, int);
|
||||
void palette_set_background (int, int, int);
|
||||
void palette_set_active_color (int, int, int, int);
|
||||
void palette_set_default_colors (void);
|
||||
void palette_swap_colors (void);
|
||||
|
||||
struct _PaletteEntries {
|
||||
char *name;
|
||||
|
@ -64,5 +66,7 @@ extern ProcRecord palette_get_foreground_proc;
|
|||
extern ProcRecord palette_get_background_proc;
|
||||
extern ProcRecord palette_set_foreground_proc;
|
||||
extern ProcRecord palette_set_background_proc;
|
||||
extern ProcRecord palette_set_default_colors_proc;
|
||||
extern ProcRecord palette_swap_colors_proc;
|
||||
|
||||
#endif /* __PALETTE_H__ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
#/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
|
@ -205,8 +205,6 @@ color_area_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent;
|
||||
int target;
|
||||
unsigned char fg_r, fg_g, fg_b;
|
||||
unsigned char bg_r, bg_g, bg_b;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -239,18 +237,11 @@ color_area_events (GtkWidget *widget,
|
|||
}
|
||||
break;
|
||||
case SWAP_AREA:
|
||||
palette_get_foreground (&fg_r, &fg_g, &fg_b);
|
||||
palette_get_background (&bg_r, &bg_g, &bg_b);
|
||||
|
||||
palette_set_foreground (bg_r, bg_g, bg_b);
|
||||
palette_set_background (fg_r, fg_g, fg_b);
|
||||
|
||||
palette_swap_colors();
|
||||
color_area_draw ();
|
||||
break;
|
||||
case DEF_AREA:
|
||||
palette_set_foreground (0, 0, 0);
|
||||
palette_set_background (255, 255, 255);
|
||||
|
||||
palette_set_default_colors();
|
||||
color_area_draw ();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -103,3 +103,29 @@ gimp_palette_set_foreground (guchar red,
|
|||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_palette_set_default_colors (void)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_palette_set_default_colors",
|
||||
&nreturn_vals,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_palette_swap_colors (void)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_palette_swap_colors",
|
||||
&nreturn_vals,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
|
|
@ -103,3 +103,29 @@ gimp_palette_set_foreground (guchar red,
|
|||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_palette_set_default_colors (void)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_palette_set_default_colors",
|
||||
&nreturn_vals,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_palette_swap_colors (void)
|
||||
{
|
||||
GParam *return_vals;
|
||||
int nreturn_vals;
|
||||
|
||||
return_vals = gimp_run_procedure ("gimp_palette_swap_colors",
|
||||
&nreturn_vals,
|
||||
PARAM_END);
|
||||
|
||||
gimp_destroy_params (return_vals, nreturn_vals);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue