mirror of https://github.com/GNOME/gimp.git
plug-ins/gflare/gflare.c libgimp/gimpunitmenu.c set separators of option
2000-12-03 Michael Natterer <mitch@gimp.org> * plug-ins/gflare/gflare.c * libgimp/gimpunitmenu.c * libgimp/gimpwidgets.c: set separators of option menus insensitive. (see Sven's fix below below). * app/layers_dialog.c: set "Merge Down" insensitive for the bottom layer.
This commit is contained in:
parent
0d9382fb04
commit
6bb4458abb
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2000-12-03 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* plug-ins/gflare/gflare.c
|
||||
* libgimp/gimpunitmenu.c
|
||||
* libgimp/gimpwidgets.c: set separators of option menus insensitive.
|
||||
(see Sven's fix below below).
|
||||
|
||||
* app/layers_dialog.c: set "Merge Down" insensitive for
|
||||
the bottom layer.
|
||||
|
||||
2000-12-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/layer.c
|
||||
|
|
|
@ -995,14 +995,14 @@ layers_dialog_preview_extents (void)
|
|||
static void
|
||||
layers_dialog_set_menu_sensitivity (void)
|
||||
{
|
||||
gboolean fs; /* floating sel */
|
||||
gboolean ac; /* active channel */
|
||||
gboolean fs; /* no floating sel */
|
||||
gboolean ac; /* no active channel */
|
||||
gboolean lm; /* layer mask */
|
||||
gboolean gimage; /* is there a gimage */
|
||||
gboolean lp; /* layers present */
|
||||
gboolean alpha; /* alpha channel present */
|
||||
gboolean indexed; /* is indexed */
|
||||
gint next_alpha;
|
||||
gboolean next_alpha;
|
||||
GSList *list;
|
||||
GSList *next;
|
||||
GSList *prev;
|
||||
|
@ -1027,7 +1027,7 @@ layers_dialog_set_menu_sensitivity (void)
|
|||
if (gimage)
|
||||
{
|
||||
lp = (layersD->gimage->layers != NULL);
|
||||
indexed = (gimp_image_base_type(layersD->gimage)==INDEXED);
|
||||
indexed = (gimp_image_base_type (layersD->gimage) == INDEXED);
|
||||
}
|
||||
|
||||
list = layersD->gimage->layers;
|
||||
|
@ -1047,7 +1047,7 @@ layers_dialog_set_menu_sensitivity (void)
|
|||
|
||||
if (next)
|
||||
{
|
||||
layer = (Layer *)next->data;
|
||||
layer = (Layer *) next->data;
|
||||
next_alpha = layer_has_alpha (layer);
|
||||
}
|
||||
else
|
||||
|
@ -1089,7 +1089,7 @@ layers_dialog_set_menu_sensitivity (void)
|
|||
SET_SENSITIVE ("Scale Layer...", ac && gimage && lp);
|
||||
|
||||
SET_SENSITIVE ("Merge Visible Layers...", fs && ac && gimage && lp);
|
||||
SET_SENSITIVE ("Merge Down", fs && ac && gimage && lp);
|
||||
SET_SENSITIVE ("Merge Down", fs && ac && gimage && lp && next);
|
||||
SET_SENSITIVE ("Flatten Image", fs && ac && gimage && lp);
|
||||
|
||||
SET_SENSITIVE ("Add Layer Mask...", fs && ac && gimage && !lm && lp && alpha && !indexed);
|
||||
|
|
|
@ -995,14 +995,14 @@ layers_dialog_preview_extents (void)
|
|||
static void
|
||||
layers_dialog_set_menu_sensitivity (void)
|
||||
{
|
||||
gboolean fs; /* floating sel */
|
||||
gboolean ac; /* active channel */
|
||||
gboolean fs; /* no floating sel */
|
||||
gboolean ac; /* no active channel */
|
||||
gboolean lm; /* layer mask */
|
||||
gboolean gimage; /* is there a gimage */
|
||||
gboolean lp; /* layers present */
|
||||
gboolean alpha; /* alpha channel present */
|
||||
gboolean indexed; /* is indexed */
|
||||
gint next_alpha;
|
||||
gboolean next_alpha;
|
||||
GSList *list;
|
||||
GSList *next;
|
||||
GSList *prev;
|
||||
|
@ -1027,7 +1027,7 @@ layers_dialog_set_menu_sensitivity (void)
|
|||
if (gimage)
|
||||
{
|
||||
lp = (layersD->gimage->layers != NULL);
|
||||
indexed = (gimp_image_base_type(layersD->gimage)==INDEXED);
|
||||
indexed = (gimp_image_base_type (layersD->gimage) == INDEXED);
|
||||
}
|
||||
|
||||
list = layersD->gimage->layers;
|
||||
|
@ -1047,7 +1047,7 @@ layers_dialog_set_menu_sensitivity (void)
|
|||
|
||||
if (next)
|
||||
{
|
||||
layer = (Layer *)next->data;
|
||||
layer = (Layer *) next->data;
|
||||
next_alpha = layer_has_alpha (layer);
|
||||
}
|
||||
else
|
||||
|
@ -1089,7 +1089,7 @@ layers_dialog_set_menu_sensitivity (void)
|
|||
SET_SENSITIVE ("Scale Layer...", ac && gimage && lp);
|
||||
|
||||
SET_SENSITIVE ("Merge Visible Layers...", fs && ac && gimage && lp);
|
||||
SET_SENSITIVE ("Merge Down", fs && ac && gimage && lp);
|
||||
SET_SENSITIVE ("Merge Down", fs && ac && gimage && lp && next);
|
||||
SET_SENSITIVE ("Flatten Image", fs && ac && gimage && lp);
|
||||
|
||||
SET_SENSITIVE ("Add Layer Mask...", fs && ac && gimage && !lm && lp && alpha && !indexed);
|
||||
|
|
|
@ -306,6 +306,7 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
|
|||
|
||||
menuitem = gtk_menu_item_new ();
|
||||
gtk_menu_append (GTK_MENU (GTK_OPTION_MENU (gum)->menu), menuitem);
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (gum)->menu),
|
||||
menuitem, user_unit - 1);
|
||||
gtk_widget_show (menuitem);
|
||||
|
|
|
@ -104,6 +104,8 @@ gimp_option_menu_new (gboolean menu_only,
|
|||
else
|
||||
{
|
||||
menuitem = gtk_menu_item_new ();
|
||||
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
|
@ -201,6 +203,8 @@ gimp_option_menu_new2 (gboolean menu_only,
|
|||
else
|
||||
{
|
||||
menuitem = gtk_menu_item_new ();
|
||||
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
|
|
|
@ -306,6 +306,7 @@ gimp_unit_menu_set_unit (GimpUnitMenu *gum,
|
|||
|
||||
menuitem = gtk_menu_item_new ();
|
||||
gtk_menu_append (GTK_MENU (GTK_OPTION_MENU (gum)->menu), menuitem);
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
gtk_menu_reorder_child (GTK_MENU (GTK_OPTION_MENU (gum)->menu),
|
||||
menuitem, user_unit - 1);
|
||||
gtk_widget_show (menuitem);
|
||||
|
|
|
@ -104,6 +104,8 @@ gimp_option_menu_new (gboolean menu_only,
|
|||
else
|
||||
{
|
||||
menuitem = gtk_menu_item_new ();
|
||||
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
|
@ -201,6 +203,8 @@ gimp_option_menu_new2 (gboolean menu_only,
|
|||
else
|
||||
{
|
||||
menuitem = gtk_menu_item_new ();
|
||||
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
}
|
||||
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
|
|
|
@ -4147,11 +4147,12 @@ ed_mode_menu_new (GFlareMode *mode_var)
|
|||
|
||||
for (i = 0; i < GF_NUM_MODES; i++)
|
||||
{
|
||||
menuitem = gtk_menu_item_new_with_label (gettext(gflare_menu_modes[i]));
|
||||
menuitem = gtk_menu_item_new_with_label (gettext (gflare_menu_modes[i]));
|
||||
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), (gpointer) i);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem),
|
||||
GINT_TO_POINTER (i));
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) ed_mode_menu_callback,
|
||||
GTK_SIGNAL_FUNC (ed_mode_menu_callback),
|
||||
mode_var);
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
|
@ -4799,7 +4800,7 @@ gm_menu_create_sub_menus (GradientMenu *gm,
|
|||
menuitem = gtk_menu_item_new_with_label (name);
|
||||
gtk_object_set_user_data (GTK_OBJECT (menuitem), gm);
|
||||
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
|
||||
(GtkSignalFunc) gm_menu_item_callback,
|
||||
GTK_SIGNAL_FUNC (gm_menu_item_callback),
|
||||
name);
|
||||
gtk_menu_append (GTK_MENU (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
@ -4813,6 +4814,7 @@ gm_menu_create_sub_menus (GradientMenu *gm,
|
|||
|
||||
/* hline */
|
||||
menuitem = gtk_menu_item_new ();
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
gtk_widget_show (menuitem);
|
||||
gtk_menu_prepend (GTK_MENU (menu), menuitem);
|
||||
|
||||
|
@ -4833,7 +4835,8 @@ gm_menu_create_sub_menus (GradientMenu *gm,
|
|||
}
|
||||
|
||||
static void
|
||||
gm_menu_item_callback (GtkWidget *w, gpointer data)
|
||||
gm_menu_item_callback (GtkWidget *w,
|
||||
gpointer data)
|
||||
{
|
||||
GradientMenu *gm;
|
||||
gchar *gradient_name = (gchar *) data;
|
||||
|
@ -4841,6 +4844,7 @@ gm_menu_item_callback (GtkWidget *w, gpointer data)
|
|||
DEBUG_PRINT(("gm_menu_item_callback\n"));
|
||||
|
||||
gm = (GradientMenu *) gtk_object_get_user_data (GTK_OBJECT (w));
|
||||
|
||||
gradient_name_copy (gm->gradient_name, gradient_name);
|
||||
|
||||
gm_preview_draw (gm->preview, gradient_name);
|
||||
|
@ -4855,26 +4859,28 @@ gm_menu_item_callback (GtkWidget *w, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
gm_preview_draw (GtkWidget *preview, gchar *gradient_name)
|
||||
gm_preview_draw (GtkWidget *preview,
|
||||
gchar *gradient_name)
|
||||
{
|
||||
guchar values[GM_PREVIEW_WIDTH][4];
|
||||
gint nvalues = GM_PREVIEW_WIDTH;
|
||||
int row, irow, col;
|
||||
gint row, irow, col;
|
||||
guchar dest_row[GM_PREVIEW_WIDTH][3];
|
||||
guchar *dest, *src;
|
||||
int check, b;
|
||||
const int alpha = 3;
|
||||
guchar *dest;
|
||||
guchar *src;
|
||||
gint check, b;
|
||||
const gint alpha = 3;
|
||||
|
||||
gradient_get_values (gradient_name, (guchar *)values, nvalues);
|
||||
|
||||
for(row = 0; row < GM_PREVIEW_HEIGHT; row += GIMP_CHECK_SIZE_SM)
|
||||
for (row = 0; row < GM_PREVIEW_HEIGHT; row += GIMP_CHECK_SIZE_SM)
|
||||
{
|
||||
for(col = 0; col < GM_PREVIEW_WIDTH; col++)
|
||||
for (col = 0; col < GM_PREVIEW_WIDTH; col++)
|
||||
{
|
||||
dest = dest_row[col];
|
||||
src = values[col];
|
||||
|
||||
if(src[alpha] == OPAQUE)
|
||||
if (src[alpha] == OPAQUE)
|
||||
{
|
||||
/* no alpha channel or opaque -- simple way */
|
||||
for (b = 0; b < alpha; b++)
|
||||
|
@ -4913,7 +4919,8 @@ gm_preview_draw (GtkWidget *preview, gchar *gradient_name)
|
|||
}
|
||||
|
||||
static void
|
||||
gm_option_menu_destroy_callback (GtkWidget *w, gpointer data)
|
||||
gm_option_menu_destroy_callback (GtkWidget *w,
|
||||
gpointer data)
|
||||
{
|
||||
GradientMenu *gm = data;
|
||||
gradient_menus = g_list_remove (gradient_menus, gm);
|
||||
|
@ -4934,7 +4941,8 @@ gm_option_menu_destroy_callback (GtkWidget *w, gpointer data)
|
|||
|
||||
|
||||
void
|
||||
gradient_name_copy (gchar *dest, gchar *src)
|
||||
gradient_name_copy (gchar *dest,
|
||||
gchar *src)
|
||||
{
|
||||
strncpy (dest, src, GRADIENT_NAME_MAX);
|
||||
dest[GRADIENT_NAME_MAX-1] = '\0';
|
||||
|
@ -4944,9 +4952,10 @@ gradient_name_copy (gchar *dest, gchar *src)
|
|||
Translate SPACE to "\\040", etc.
|
||||
*/
|
||||
void
|
||||
gradient_name_encode (guchar *dest, guchar *src)
|
||||
gradient_name_encode (guchar *dest,
|
||||
guchar *src)
|
||||
{
|
||||
int cnt = GRADIENT_NAME_MAX - 1;
|
||||
gint cnt = GRADIENT_NAME_MAX - 1;
|
||||
|
||||
while (*src && cnt--)
|
||||
{
|
||||
|
@ -4965,10 +4974,11 @@ gradient_name_encode (guchar *dest, guchar *src)
|
|||
Translate "\\040" to SPACE, etc.
|
||||
*/
|
||||
void
|
||||
gradient_name_decode (guchar *dest, guchar *src)
|
||||
gradient_name_decode (guchar *dest,
|
||||
guchar *src)
|
||||
{
|
||||
int cnt = GRADIENT_NAME_MAX - 1;
|
||||
int tmp;
|
||||
gint cnt = GRADIENT_NAME_MAX - 1;
|
||||
gint tmp;
|
||||
|
||||
while (*src && cnt--)
|
||||
{
|
||||
|
@ -4986,19 +4996,19 @@ gradient_name_decode (guchar *dest, guchar *src)
|
|||
|
||||
|
||||
void
|
||||
gradient_init ()
|
||||
gradient_init (void)
|
||||
{
|
||||
gradient_cache_head = NULL;
|
||||
gradient_cache_count = 0;
|
||||
}
|
||||
|
||||
void
|
||||
gradient_free ()
|
||||
gradient_free (void)
|
||||
{
|
||||
gradient_cache_flush ();
|
||||
}
|
||||
|
||||
char **
|
||||
gchar **
|
||||
gradient_get_list (gint *num_gradients)
|
||||
{
|
||||
gchar **gradients;
|
||||
|
@ -5006,7 +5016,6 @@ gradient_get_list (gint *num_gradients)
|
|||
gint external_ngradients = 0;
|
||||
gint i, n;
|
||||
|
||||
|
||||
gradient_cache_flush ();
|
||||
external_gradients = gimp_gradients_get_list (&external_ngradients);
|
||||
|
||||
|
@ -5027,7 +5036,9 @@ gradient_get_list (gint *num_gradients)
|
|||
}
|
||||
|
||||
void
|
||||
gradient_get_values (gchar *gradient_name, guchar *values, gint nvalues)
|
||||
gradient_get_values (gchar *gradient_name,
|
||||
guchar *values,
|
||||
gint nvalues)
|
||||
{
|
||||
/* DEBUG_PRINT (("gradient_get_values: %s %d\n", gradient_name, nvalues)); */
|
||||
|
||||
|
@ -5042,13 +5053,15 @@ gradient_get_values (gchar *gradient_name, guchar *values, gint nvalues)
|
|||
}
|
||||
|
||||
static void
|
||||
gradient_get_values_internal (gchar *gradient_name, guchar *values, gint nvalues)
|
||||
gradient_get_values_internal (gchar *gradient_name,
|
||||
guchar *values,
|
||||
gint nvalues)
|
||||
{
|
||||
static guchar white[4] = {255,255,255,255};
|
||||
static guchar white_trans[4] = {255,255,255,0};
|
||||
static guchar red_trans[4] = {255,0,0,0};
|
||||
static guchar blue_trans[4] = {0,0,255,0};
|
||||
static guchar yellow_trans[4] = {255,255,0,0};
|
||||
static guchar white[4] = { 255, 255, 255, 255 };
|
||||
static guchar white_trans[4] = { 255, 255, 255, 0 };
|
||||
static guchar red_trans[4] = { 255, 0, 0, 0 };
|
||||
static guchar blue_trans[4] = { 0, 0, 255, 0 };
|
||||
static guchar yellow_trans[4] = { 255, 255, 0, 0 };
|
||||
|
||||
/*
|
||||
The internal gradients here are example --
|
||||
|
@ -5085,10 +5098,14 @@ gradient_get_values_internal (gchar *gradient_name, guchar *values, gint nvalues
|
|||
}
|
||||
|
||||
static void
|
||||
gradient_get_blend (guchar *fg, guchar *bg, guchar *values, gint nvalues)
|
||||
gradient_get_blend (guchar *fg,
|
||||
guchar *bg,
|
||||
guchar *values,
|
||||
gint nvalues)
|
||||
{
|
||||
gdouble x;
|
||||
int i, j;
|
||||
gint i;
|
||||
gint j;
|
||||
guchar *v = values;
|
||||
|
||||
for (i=0; i<nvalues; i++)
|
||||
|
@ -5100,10 +5117,13 @@ gradient_get_blend (guchar *fg, guchar *bg, guchar *values, gint nvalues)
|
|||
}
|
||||
|
||||
static void
|
||||
gradient_get_random (gint seed, guchar *values, gint nvalues)
|
||||
gradient_get_random (gint seed,
|
||||
guchar *values,
|
||||
gint nvalues)
|
||||
{
|
||||
int i, j;
|
||||
int inten;
|
||||
gint i;
|
||||
gint j;
|
||||
gint inten;
|
||||
guchar *v = values;
|
||||
|
||||
/*
|
||||
|
@ -5120,11 +5140,14 @@ gradient_get_random (gint seed, guchar *values, gint nvalues)
|
|||
}
|
||||
|
||||
static void
|
||||
gradient_get_default (gchar *name, guchar *values, gint nvalues)
|
||||
gradient_get_default (gchar *name,
|
||||
guchar *values,
|
||||
gint nvalues)
|
||||
{
|
||||
double e[3];
|
||||
double x;
|
||||
int i, j;
|
||||
gdouble e[3];
|
||||
gdouble x;
|
||||
gint i;
|
||||
gint j;
|
||||
guchar *v = values;
|
||||
|
||||
/*
|
||||
|
@ -5153,7 +5176,9 @@ gradient_get_default (gchar *name, guchar *values, gint nvalues)
|
|||
cached values are stored in guchar array. No accuracy.
|
||||
*/
|
||||
static void
|
||||
gradient_get_values_external (gchar *gradient_name, guchar *values, gint nvalues)
|
||||
gradient_get_values_external (gchar *gradient_name,
|
||||
guchar *values,
|
||||
gint nvalues)
|
||||
{
|
||||
GradientCacheItem *ci;
|
||||
gint found;
|
||||
|
@ -5202,11 +5227,14 @@ gradient_get_values_external (gchar *gradient_name, guchar *values, gint nvalues
|
|||
}
|
||||
|
||||
static void
|
||||
gradient_get_values_real_external (gchar *gradient_name, guchar *values, gint nvalues)
|
||||
gradient_get_values_real_external (gchar *gradient_name,
|
||||
guchar *values,
|
||||
gint nvalues)
|
||||
{
|
||||
gchar *old_name;
|
||||
gdouble *tmp_values;
|
||||
int i, j;
|
||||
gint i;
|
||||
gint j;
|
||||
|
||||
old_name = gimp_gradients_get_active ();
|
||||
|
||||
|
@ -5224,9 +5252,10 @@ gradient_get_values_real_external (gchar *gradient_name, guchar *values, gint nv
|
|||
}
|
||||
|
||||
void
|
||||
gradient_cache_flush ()
|
||||
gradient_cache_flush (void)
|
||||
{
|
||||
GradientCacheItem *ci, *tmp;
|
||||
GradientCacheItem *ci;
|
||||
GradientCacheItem *tmp;
|
||||
|
||||
ci = gradient_cache_head;
|
||||
while (ci)
|
||||
|
@ -5240,7 +5269,8 @@ gradient_cache_flush ()
|
|||
}
|
||||
|
||||
static GradientCacheItem *
|
||||
gradient_cache_lookup (gchar *name, gint *found)
|
||||
gradient_cache_lookup (gchar *name,
|
||||
gint *found)
|
||||
{
|
||||
GradientCacheItem *ci;
|
||||
|
||||
|
@ -5286,7 +5316,7 @@ gradient_cache_lookup (gchar *name, gint *found)
|
|||
}
|
||||
|
||||
static void
|
||||
gradient_cache_zorch ()
|
||||
gradient_cache_zorch (void)
|
||||
{
|
||||
GradientCacheItem *ci = gradient_cache_head;
|
||||
|
||||
|
@ -5308,7 +5338,7 @@ gradient_cache_zorch ()
|
|||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
gradient_report ()
|
||||
gradient_report (void)
|
||||
{
|
||||
double total = (double) get_values_external_clock / CLOCKS_PER_SEC;
|
||||
|
||||
|
|
Loading…
Reference in New Issue