special handling of a dropped "Standard" brush/pattern/gradient because

1999-11-14  Michael Natterer  <mitch@gimp.org>

	* app/gimpdnd.c: special handling of a dropped "Standard"
	brush/pattern/gradient because they are not part of their lists.

	* app/pattern.c: fill the standard_pattern with a b/w grid.
This commit is contained in:
Michael Natterer 1999-11-14 11:43:03 +00:00 committed by Michael Natterer
parent 0c922cd3b0
commit a4358a5397
4 changed files with 53 additions and 18 deletions

View File

@ -1,3 +1,10 @@
1999-11-14 Michael Natterer <mitch@gimp.org>
* app/gimpdnd.c: special handling of a dropped "Standard"
brush/pattern/gradient because they are not part of their lists.
* app/pattern.c: fill the standard_pattern with a b/w grid.
1999-11-14 Michael Natterer <mitch@gimp.org>
* app/airbrush.c

View File

@ -823,7 +823,10 @@ gimp_dnd_set_brush_data (GtkWidget *widget,
name = (gchar *) vals;
brush = gimp_brush_list_get_brush (brush_list, name);
if (strcmp (name, "Standard") == 0)
brush = brushes_get_standard_brush ();
else
brush = gimp_brush_list_get_brush (brush_list, name);
if (brush)
(* (GimpDndDropBrushFunc) set_brush_func) (widget, brush, set_brush_data);
@ -927,7 +930,10 @@ gimp_dnd_set_pattern_data (GtkWidget *widget,
name = (gchar *) vals;
pattern = pattern_list_get_pattern (pattern_list, name);
if (strcmp (name, "Standard") == 0)
pattern = patterns_get_standard_pattern ();
else
pattern = pattern_list_get_pattern (pattern_list, name);
if (pattern)
(* (GimpDndDropPatternFunc) set_pattern_func) (widget, pattern,
@ -1032,7 +1038,12 @@ gimp_dnd_set_gradient_data (GtkWidget *widget,
name = (gchar *) vals;
if ((gradient = gradient_list_get_gradient (gradients_list, name)))
if (strcmp (name, "Standard") == 0)
gradient = gradients_get_standard_gradient ();
else
gradient = gradient_list_get_gradient (gradients_list, name);
if (gradient)
(* (GimpDndDropGradientFunc) set_gradient_func) (widget, gradient,
set_gradient_data);
}

View File

@ -29,27 +29,23 @@
#include <dirent.h>
#endif
#include "colormaps.h"
#include "datafiles.h"
#include "devices.h"
#include "patterns.h"
#include "pattern_header.h"
#include "colormaps.h"
#include "errors.h"
#include "gimpcontext.h"
#include "gimprc.h"
#include "dialog_handler.h"
#include "libgimp/gimpintl.h"
/* global variables */
GPattern *active_pattern = NULL;
GSList *pattern_list = NULL;
gint num_patterns = 0;
GPattern *active_pattern = NULL;
GSList *pattern_list = NULL;
gint num_patterns = 0;
/* static variables */
static GPattern *standard_pattern = NULL;
/* static function prototypes */
/* local function prototypes */
static GSList * insert_pattern_in_list (GSList *, GPattern *);
static void load_pattern (gchar *);
static void pattern_free_func (gpointer, gpointer);
@ -80,7 +76,7 @@ patterns_init (gboolean no_data)
}
void
patterns_free ()
patterns_free (void)
{
if (pattern_list)
{
@ -97,13 +93,23 @@ patterns_get_standard_pattern (void)
{
if (! standard_pattern)
{
guchar *data;
gint row, col;
standard_pattern = g_new (GPattern, 1);
standard_pattern->filename = NULL;
standard_pattern->name = g_strdup ("Standard");
standard_pattern->index = -1; /* not part of the pattern list */
/* TODO: fill it with something */
standard_pattern->mask = temp_buf_new (8, 8, 8, 0, 0, NULL);
standard_pattern->mask = temp_buf_new (32, 32, 3, 0, 0, NULL);
data = temp_buf_data (standard_pattern->mask);
for (row = 0; row < standard_pattern->mask->height; row++)
for (col = 0; col < standard_pattern->mask->width; col++)
{
*data++ = *data++ = *data++ = (col % 2) && (row % 2) ? 255 : 0;
}
}
return standard_pattern;

View File

@ -823,7 +823,10 @@ gimp_dnd_set_brush_data (GtkWidget *widget,
name = (gchar *) vals;
brush = gimp_brush_list_get_brush (brush_list, name);
if (strcmp (name, "Standard") == 0)
brush = brushes_get_standard_brush ();
else
brush = gimp_brush_list_get_brush (brush_list, name);
if (brush)
(* (GimpDndDropBrushFunc) set_brush_func) (widget, brush, set_brush_data);
@ -927,7 +930,10 @@ gimp_dnd_set_pattern_data (GtkWidget *widget,
name = (gchar *) vals;
pattern = pattern_list_get_pattern (pattern_list, name);
if (strcmp (name, "Standard") == 0)
pattern = patterns_get_standard_pattern ();
else
pattern = pattern_list_get_pattern (pattern_list, name);
if (pattern)
(* (GimpDndDropPatternFunc) set_pattern_func) (widget, pattern,
@ -1032,7 +1038,12 @@ gimp_dnd_set_gradient_data (GtkWidget *widget,
name = (gchar *) vals;
if ((gradient = gradient_list_get_gradient (gradients_list, name)))
if (strcmp (name, "Standard") == 0)
gradient = gradients_get_standard_gradient ();
else
gradient = gradient_list_get_gradient (gradients_list, name);
if (gradient)
(* (GimpDndDropGradientFunc) set_gradient_func) (widget, gradient,
set_gradient_data);
}