Commit 859481e5 authored by jaycox's avatar jaycox

Allow the user to change a brush's name.


	* app/brush_edit.[ch]: Allow the user to change a brush's name.

	* app/gimpbrushlist.[ch] * app/gimprc.[ch]: ported Calvin
	Williamson's brush saving code from the hollywood branch.

	* app/preferences_dialog.c:  add the brush_vbr_path

	* data/brushes/round1.vbr: removed.  You should remove this file
	from your system if you have installed previous versions.
parent febc3daa
Mon Aug 30 03:37:28 1999 Jay Cox (jaycox@earthlink.net)
* app/brush_edit.[ch]: Allow the user to change a brush's name.
* app/gimpbrushlist.[ch] * app/gimprc.[ch]: ported Calvin
Williamson's brush saving code from the hollywood branch.
* app/preferences_dialog.c: add the brush_vbr_path
* data/brushes/round1.vbr: removed. You should remove this file
from your system if you have installed previous versions.
Sub Aug 29 23:00:50 1999 vidar@prosalg.no (Vidar Madsen)
* plug-ins/gimpresionist/*.[ch]: Big rewrite of many internals
......
......@@ -101,7 +101,7 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
gchar *src, *buf;
brush_edit_clear_preview (begw);
if (brush == NULL)
if (brush == NULL || brush->mask == NULL)
return TRUE;
scale = MAX(ceil(brush->mask->width/(float)begw->preview->requisition.width),
ceil(brush->mask->height/(float)begw->preview->requisition.height));
......@@ -138,6 +138,12 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
return TRUE;
}
void brush_renamed_callback(GtkWidget *widget, BrushEditGeneratedWindow *begw)
{
gtk_entry_set_text(GTK_ENTRY(begw->name),
gimp_brush_get_name(GIMP_BRUSH(begw->brush)));
}
void
brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrush *gbrush)
......@@ -145,7 +151,7 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrushGenerated *brush = 0;
if (begw->brush == (GimpBrushGenerated*)gbrush)
return;
if (begw->brush)
if (begw && begw->brush)
{
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
gtk_object_unref(GTK_OBJECT(begw->brush));
......@@ -164,6 +170,9 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
GTK_SIGNAL_FUNC(brush_edit_brush_dirty_callback),
begw);
gtk_signal_connect(GTK_OBJECT (brush), "rename",
GTK_SIGNAL_FUNC(brush_renamed_callback),
begw);
begw->brush = NULL;
gtk_adjustment_set_value(GTK_ADJUSTMENT(begw->radius_data),
gimp_brush_generated_get_radius (brush));
......@@ -173,12 +182,25 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
gimp_brush_generated_get_angle (brush));
gtk_adjustment_set_value(GTK_ADJUSTMENT(begw->aspect_ratio_data),
gimp_brush_generated_get_aspect_ratio(brush));
gtk_entry_set_text(GTK_ENTRY(begw->name), gimp_brush_get_name(gbrush));
begw->brush = brush;
gtk_object_ref(GTK_OBJECT(begw->brush));
brush_edit_brush_dirty_callback(GIMP_BRUSH(brush), begw);
}
}
void name_changed_func(GtkWidget *widget, BrushEditGeneratedWindow *begw)
{
gchar *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
gimp_brush_set_name(GIMP_BRUSH(begw->brush), entry_text);
}
void focus_out_func(GtkWidget *wid1, GtkWidget *wid2, BrushEditGeneratedWindow *begw)
{
name_changed_func(wid1, begw);
}
BrushEditGeneratedWindow *
brush_edit_generated_new ()
{
......@@ -211,7 +233,23 @@ brush_edit_generated_new ()
/* Populate the window with some widgets */
/* brush's preview widget w/frame */
/* table for brush controlls */
table = gtk_table_new(5, 4, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* Brush's name */
begw->name = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (vbox), begw->name, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (begw->name), "activate",
(GtkSignalFunc) name_changed_func,
begw);
gtk_signal_connect (GTK_OBJECT (begw->name), "focus_out_event",
(GtkSignalFunc) focus_out_func,
begw);
gtk_widget_show(begw->name);
/* brush's preview widget w/frame */
begw->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (begw->frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), begw->frame, TRUE, TRUE, 0);
......
......@@ -30,6 +30,7 @@ typedef struct _BrushEditGeneratedWindow
GtkWidget *preview;
GtkWidget *scale_label;
GtkWidget *options_box;
GtkWidget *name;
GtkAdjustment *radius_data;
GtkAdjustment *hardness_data;
GtkAdjustment *angle_data;
......
......@@ -90,6 +90,7 @@ static char * old_swap_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_brush_path;
static char * old_brush_vbr_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_gradient_path;
......@@ -115,6 +116,7 @@ static char * edit_swap_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_brush_vbr_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_gradient_path = NULL;
......@@ -300,6 +302,7 @@ file_prefs_save_callback (GtkWidget *widget,
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_brush_vbr_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_gradient_path;
......@@ -320,6 +323,7 @@ file_prefs_save_callback (GtkWidget *widget,
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_brush_path = brush_path;
save_brush_vbr_path = brush_vbr_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_gradient_path = gradient_path;
......@@ -474,6 +478,12 @@ file_prefs_save_callback (GtkWidget *widget,
brush_path = edit_brush_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (brush_vbr_path, edit_brush_vbr_path))
{
update = g_list_append (update, "brush-vbr-path");
brush_vbr_path = edit_brush_vbr_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (pattern_path, edit_pattern_path))
{
update = g_list_append (update, "pattern-path");
......@@ -528,6 +538,7 @@ file_prefs_save_callback (GtkWidget *widget,
plug_in_path = save_plug_in_path;
module_path = save_module_path;
brush_path = save_brush_path;
brush_vbr_path = save_brush_vbr_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
......@@ -605,6 +616,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_brush_path, old_brush_path);
file_prefs_strset (&edit_brush_vbr_path, old_brush_vbr_path);
file_prefs_strset (&edit_pattern_path, old_pattern_path);
file_prefs_strset (&edit_palette_path, old_palette_path);
file_prefs_strset (&edit_gradient_path, old_gradient_path);
......@@ -1406,6 +1418,7 @@ file_pref_cmd_callback (GtkWidget *widget,
edit_temp_path = file_prefs_strdup (temp_path);
edit_swap_path = file_prefs_strdup (swap_path);
edit_brush_path = file_prefs_strdup (brush_path);
edit_brush_vbr_path = file_prefs_strdup (brush_vbr_path);
edit_pattern_path = file_prefs_strdup (pattern_path);
edit_palette_path = file_prefs_strdup (palette_path);
edit_plug_in_path = file_prefs_strdup (plug_in_path);
......@@ -1456,6 +1469,7 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_brush_path, edit_brush_path);
file_prefs_strset (&old_brush_vbr_path, edit_brush_vbr_path);
file_prefs_strset (&old_pattern_path, edit_pattern_path);
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
......@@ -2398,6 +2412,8 @@ file_pref_cmd_callback (GtkWidget *widget,
} paths[] = {
{ N_("Brushes"), N_("Brushes Directories"), N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Generated Brushes"), N_("Generated Brushes Directories"), N_("Select Generated Brushes Dir"),
&edit_brush_vbr_path },
{ N_("Patterns"), N_("Patterns Directories"), N_("Select Patterns Dir"),
&edit_pattern_path },
{ N_("Palettes"), N_("Palettes Directories"), N_("Select Palettes Dir"),
......
......@@ -50,6 +50,7 @@
#include "gimplistP.h"
#include "gimpbrushlistP.h"
#include "dialog_handler.h"
#include "general.h"
#include "libgimp/gimpintl.h"
......@@ -201,11 +202,71 @@ brush_compare_func (gconstpointer first, gconstpointer second)
void
brushes_free ()
{
printf("freeing brushes\n");
if (brush_list)
{
while (GIMP_LIST(brush_list)->list)
gimp_brush_list_remove(brush_list, GIMP_LIST(brush_list)->list->data);
{
GimpBrush * b = GIMP_BRUSH (GIMP_LIST(brush_list)->list->data);
char * filename = b->filename;
if (GIMP_IS_BRUSH_GENERATED (b))
{
if (!filename)
{
char *home;
char *local_path;
char *first_token;
char *token;
char *path;
if (brush_vbr_path)
{
printf("posibly saving %s\n", b->name);
/* Get the first path specified in the brush vbr path variable */
home = getenv("HOME");
local_path = g_strdup (brush_vbr_path);
first_token = local_path;
token = xstrsep(&first_token, ":");
if (token)
{
if (*token == '~')
{
path = g_malloc(strlen(home) + strlen(token) + 1);
sprintf(path, "%s%s", home, token + 1);
}
else
{
path = g_malloc(strlen(token) + 1);
strcpy(path, token);
}
filename = g_malloc (strlen (path) + strlen (b->name) + 2 + 4);
sprintf (filename, "%s/%s.vbr", path, b->name);
g_free (path);
}
g_free (local_path);
}
else
filename = NULL;
}
else
{
if (strcmp(&filename[strlen(filename) - 4], ".vbr"))
filename = NULL;
}
/* okay we are ready to try to save the generated file*/
if (filename)
{
printf("saving %s\n", filename);
gimp_brush_generated_save ( GIMP_BRUSH_GENERATED(b), filename);
}
}
gimp_brush_list_remove(brush_list, b);
}
}
have_default_brush = 0;
......
......@@ -101,6 +101,7 @@ char * plug_in_path = NULL;
char * temp_path = NULL;
char * swap_path = NULL;
char * brush_path = NULL;
char * brush_vbr_path = NULL;
char * default_brush = NULL;
char * pattern_path = NULL;
char * default_pattern = NULL;
......@@ -227,6 +228,7 @@ static ParseFunc funcs[] =
{ "temp-path", TT_PATH, &temp_path, NULL },
{ "swap-path", TT_PATH, &swap_path, NULL },
{ "brush-path", TT_PATH, &brush_path, NULL },
{ "brush-vbr-path", TT_PATH, &brush_vbr_path, NULL },
{ "pattern-path", TT_PATH, &pattern_path, NULL },
{ "plug-in-path", TT_PATH, &plug_in_path, NULL },
{ "palette-path", TT_PATH, &palette_path, NULL },
......
......@@ -27,6 +27,7 @@ extern char * plug_in_path;
extern char * temp_path;
extern char * swap_path;
extern char * brush_path;
extern char * brush_vbr_path;
extern char * default_brush;
extern char * pattern_path;
extern char * default_pattern;
......
......@@ -101,7 +101,7 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
gchar *src, *buf;
brush_edit_clear_preview (begw);
if (brush == NULL)
if (brush == NULL || brush->mask == NULL)
return TRUE;
scale = MAX(ceil(brush->mask->width/(float)begw->preview->requisition.width),
ceil(brush->mask->height/(float)begw->preview->requisition.height));
......@@ -138,6 +138,12 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
return TRUE;
}
void brush_renamed_callback(GtkWidget *widget, BrushEditGeneratedWindow *begw)
{
gtk_entry_set_text(GTK_ENTRY(begw->name),
gimp_brush_get_name(GIMP_BRUSH(begw->brush)));
}
void
brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrush *gbrush)
......@@ -145,7 +151,7 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrushGenerated *brush = 0;
if (begw->brush == (GimpBrushGenerated*)gbrush)
return;
if (begw->brush)
if (begw && begw->brush)
{
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
gtk_object_unref(GTK_OBJECT(begw->brush));
......@@ -164,6 +170,9 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
GTK_SIGNAL_FUNC(brush_edit_brush_dirty_callback),
begw);
gtk_signal_connect(GTK_OBJECT (brush), "rename",
GTK_SIGNAL_FUNC(brush_renamed_callback),
begw);
begw->brush = NULL;
gtk_adjustment_set_value(GTK_ADJUSTMENT(begw->radius_data),
gimp_brush_generated_get_radius (brush));
......@@ -173,12 +182,25 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
gimp_brush_generated_get_angle (brush));
gtk_adjustment_set_value(GTK_ADJUSTMENT(begw->aspect_ratio_data),
gimp_brush_generated_get_aspect_ratio(brush));
gtk_entry_set_text(GTK_ENTRY(begw->name), gimp_brush_get_name(gbrush));
begw->brush = brush;
gtk_object_ref(GTK_OBJECT(begw->brush));
brush_edit_brush_dirty_callback(GIMP_BRUSH(brush), begw);
}
}
void name_changed_func(GtkWidget *widget, BrushEditGeneratedWindow *begw)
{
gchar *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
gimp_brush_set_name(GIMP_BRUSH(begw->brush), entry_text);
}
void focus_out_func(GtkWidget *wid1, GtkWidget *wid2, BrushEditGeneratedWindow *begw)
{
name_changed_func(wid1, begw);
}
BrushEditGeneratedWindow *
brush_edit_generated_new ()
{
......@@ -211,7 +233,23 @@ brush_edit_generated_new ()
/* Populate the window with some widgets */
/* brush's preview widget w/frame */
/* table for brush controlls */
table = gtk_table_new(5, 4, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* Brush's name */
begw->name = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (vbox), begw->name, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (begw->name), "activate",
(GtkSignalFunc) name_changed_func,
begw);
gtk_signal_connect (GTK_OBJECT (begw->name), "focus_out_event",
(GtkSignalFunc) focus_out_func,
begw);
gtk_widget_show(begw->name);
/* brush's preview widget w/frame */
begw->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (begw->frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), begw->frame, TRUE, TRUE, 0);
......
......@@ -30,6 +30,7 @@ typedef struct _BrushEditGeneratedWindow
GtkWidget *preview;
GtkWidget *scale_label;
GtkWidget *options_box;
GtkWidget *name;
GtkAdjustment *radius_data;
GtkAdjustment *hardness_data;
GtkAdjustment *angle_data;
......
......@@ -90,6 +90,7 @@ static char * old_swap_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_brush_path;
static char * old_brush_vbr_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_gradient_path;
......@@ -115,6 +116,7 @@ static char * edit_swap_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_brush_vbr_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_gradient_path = NULL;
......@@ -300,6 +302,7 @@ file_prefs_save_callback (GtkWidget *widget,
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_brush_vbr_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_gradient_path;
......@@ -320,6 +323,7 @@ file_prefs_save_callback (GtkWidget *widget,
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_brush_path = brush_path;
save_brush_vbr_path = brush_vbr_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_gradient_path = gradient_path;
......@@ -474,6 +478,12 @@ file_prefs_save_callback (GtkWidget *widget,
brush_path = edit_brush_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (brush_vbr_path, edit_brush_vbr_path))
{
update = g_list_append (update, "brush-vbr-path");
brush_vbr_path = edit_brush_vbr_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (pattern_path, edit_pattern_path))
{
update = g_list_append (update, "pattern-path");
......@@ -528,6 +538,7 @@ file_prefs_save_callback (GtkWidget *widget,
plug_in_path = save_plug_in_path;
module_path = save_module_path;
brush_path = save_brush_path;
brush_vbr_path = save_brush_vbr_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
......@@ -605,6 +616,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_brush_path, old_brush_path);
file_prefs_strset (&edit_brush_vbr_path, old_brush_vbr_path);
file_prefs_strset (&edit_pattern_path, old_pattern_path);
file_prefs_strset (&edit_palette_path, old_palette_path);
file_prefs_strset (&edit_gradient_path, old_gradient_path);
......@@ -1406,6 +1418,7 @@ file_pref_cmd_callback (GtkWidget *widget,
edit_temp_path = file_prefs_strdup (temp_path);
edit_swap_path = file_prefs_strdup (swap_path);
edit_brush_path = file_prefs_strdup (brush_path);
edit_brush_vbr_path = file_prefs_strdup (brush_vbr_path);
edit_pattern_path = file_prefs_strdup (pattern_path);
edit_palette_path = file_prefs_strdup (palette_path);
edit_plug_in_path = file_prefs_strdup (plug_in_path);
......@@ -1456,6 +1469,7 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_brush_path, edit_brush_path);
file_prefs_strset (&old_brush_vbr_path, edit_brush_vbr_path);
file_prefs_strset (&old_pattern_path, edit_pattern_path);
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
......@@ -2398,6 +2412,8 @@ file_pref_cmd_callback (GtkWidget *widget,
} paths[] = {
{ N_("Brushes"), N_("Brushes Directories"), N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Generated Brushes"), N_("Generated Brushes Directories"), N_("Select Generated Brushes Dir"),
&edit_brush_vbr_path },
{ N_("Patterns"), N_("Patterns Directories"), N_("Select Patterns Dir"),
&edit_pattern_path },
{ N_("Palettes"), N_("Palettes Directories"), N_("Select Palettes Dir"),
......
......@@ -90,6 +90,7 @@ static char * old_swap_path;
static char * old_plug_in_path;
static char * old_module_path;
static char * old_brush_path;
static char * old_brush_vbr_path;
static char * old_pattern_path;
static char * old_palette_path;
static char * old_gradient_path;
......@@ -115,6 +116,7 @@ static char * edit_swap_path = NULL;
static char * edit_plug_in_path = NULL;
static char * edit_module_path = NULL;
static char * edit_brush_path = NULL;
static char * edit_brush_vbr_path = NULL;
static char * edit_pattern_path = NULL;
static char * edit_palette_path = NULL;
static char * edit_gradient_path = NULL;
......@@ -300,6 +302,7 @@ file_prefs_save_callback (GtkWidget *widget,
gchar *save_plug_in_path;
gchar *save_module_path;
gchar *save_brush_path;
gchar *save_brush_vbr_path;
gchar *save_pattern_path;
gchar *save_palette_path;
gchar *save_gradient_path;
......@@ -320,6 +323,7 @@ file_prefs_save_callback (GtkWidget *widget,
save_plug_in_path = plug_in_path;
save_module_path = module_path;
save_brush_path = brush_path;
save_brush_vbr_path = brush_vbr_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
save_gradient_path = gradient_path;
......@@ -474,6 +478,12 @@ file_prefs_save_callback (GtkWidget *widget,
brush_path = edit_brush_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (brush_vbr_path, edit_brush_vbr_path))
{
update = g_list_append (update, "brush-vbr-path");
brush_vbr_path = edit_brush_vbr_path;
restart_notification = TRUE;
}
if (file_prefs_strcmp (pattern_path, edit_pattern_path))
{
update = g_list_append (update, "pattern-path");
......@@ -528,6 +538,7 @@ file_prefs_save_callback (GtkWidget *widget,
plug_in_path = save_plug_in_path;
module_path = save_module_path;
brush_path = save_brush_path;
brush_vbr_path = save_brush_vbr_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
......@@ -605,6 +616,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
file_prefs_strset (&edit_plug_in_path, old_plug_in_path);
file_prefs_strset (&edit_module_path, old_module_path);
file_prefs_strset (&edit_brush_path, old_brush_path);
file_prefs_strset (&edit_brush_vbr_path, old_brush_vbr_path);
file_prefs_strset (&edit_pattern_path, old_pattern_path);
file_prefs_strset (&edit_palette_path, old_palette_path);
file_prefs_strset (&edit_gradient_path, old_gradient_path);
......@@ -1406,6 +1418,7 @@ file_pref_cmd_callback (GtkWidget *widget,
edit_temp_path = file_prefs_strdup (temp_path);
edit_swap_path = file_prefs_strdup (swap_path);
edit_brush_path = file_prefs_strdup (brush_path);
edit_brush_vbr_path = file_prefs_strdup (brush_vbr_path);
edit_pattern_path = file_prefs_strdup (pattern_path);
edit_palette_path = file_prefs_strdup (palette_path);
edit_plug_in_path = file_prefs_strdup (plug_in_path);
......@@ -1456,6 +1469,7 @@ file_pref_cmd_callback (GtkWidget *widget,
file_prefs_strset (&old_plug_in_path, edit_plug_in_path);
file_prefs_strset (&old_module_path, edit_module_path);
file_prefs_strset (&old_brush_path, edit_brush_path);
file_prefs_strset (&old_brush_vbr_path, edit_brush_vbr_path);
file_prefs_strset (&old_pattern_path, edit_pattern_path);
file_prefs_strset (&old_palette_path, edit_palette_path);
file_prefs_strset (&old_gradient_path, edit_gradient_path);
......@@ -2398,6 +2412,8 @@ file_pref_cmd_callback (GtkWidget *widget,
} paths[] = {
{ N_("Brushes"), N_("Brushes Directories"), N_("Select Brushes Dir"),
&edit_brush_path },
{ N_("Generated Brushes"), N_("Generated Brushes Directories"), N_("Select Generated Brushes Dir"),
&edit_brush_vbr_path },
{ N_("Patterns"), N_("Patterns Directories"), N_("Select Patterns Dir"),
&edit_pattern_path },
{ N_("Palettes"), N_("Palettes Directories"), N_("Select Palettes Dir"),
......
......@@ -101,7 +101,7 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
gchar *src, *buf;
brush_edit_clear_preview (begw);
if (brush == NULL)
if (brush == NULL || brush->mask == NULL)
return TRUE;
scale = MAX(ceil(brush->mask->width/(float)begw->preview->requisition.width),
ceil(brush->mask->height/(float)begw->preview->requisition.height));
......@@ -138,6 +138,12 @@ brush_edit_brush_dirty_callback(GimpBrush *brush,
return TRUE;
}
void brush_renamed_callback(GtkWidget *widget, BrushEditGeneratedWindow *begw)
{
gtk_entry_set_text(GTK_ENTRY(begw->name),
gimp_brush_get_name(GIMP_BRUSH(begw->brush)));
}
void
brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrush *gbrush)
......@@ -145,7 +151,7 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
GimpBrushGenerated *brush = 0;
if (begw->brush == (GimpBrushGenerated*)gbrush)
return;
if (begw->brush)
if (begw && begw->brush)
{
gtk_signal_disconnect_by_data(GTK_OBJECT(begw->brush), begw);
gtk_object_unref(GTK_OBJECT(begw->brush));
......@@ -164,6 +170,9 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
gtk_signal_connect(GTK_OBJECT (brush), "dirty",
GTK_SIGNAL_FUNC(brush_edit_brush_dirty_callback),
begw);
gtk_signal_connect(GTK_OBJECT (brush), "rename",
GTK_SIGNAL_FUNC(brush_renamed_callback),
begw);
begw->brush = NULL;
gtk_adjustment_set_value(GTK_ADJUSTMENT(begw->radius_data),
gimp_brush_generated_get_radius (brush));
......@@ -173,12 +182,25 @@ brush_edit_generated_set_brush(BrushEditGeneratedWindow *begw,
gimp_brush_generated_get_angle (brush));
gtk_adjustment_set_value(GTK_ADJUSTMENT(begw->aspect_ratio_data),
gimp_brush_generated_get_aspect_ratio(brush));
gtk_entry_set_text(GTK_ENTRY(begw->name), gimp_brush_get_name(gbrush));
begw->brush = brush;
gtk_object_ref(GTK_OBJECT(begw->brush));
brush_edit_brush_dirty_callback(GIMP_BRUSH(brush), begw);
}
}
void name_changed_func(GtkWidget *widget, BrushEditGeneratedWindow *begw)
{
gchar *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(widget));
gimp_brush_set_name(GIMP_BRUSH(begw->brush), entry_text);
}
void focus_out_func(GtkWidget *wid1, GtkWidget *wid2, BrushEditGeneratedWindow *begw)
{
name_changed_func(wid1, begw);
}
BrushEditGeneratedWindow *
brush_edit_generated_new ()
{
......@@ -211,7 +233,23 @@ brush_edit_generated_new ()
/* Populate the window with some widgets */
/* brush's preview widget w/frame */
/* table for brush controlls */
table = gtk_table_new(5, 4, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
/* Brush's name */
begw->name = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (vbox), begw->name, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (begw->name), "activate",
(GtkSignalFunc) name_changed_func,
begw);
gtk_signal_connect (GTK_OBJECT (begw->name), "focus_out_event",
(GtkSignalFunc) focus_out_func,
begw);
gtk_widget_show(begw->name);
/* brush's preview widget w/frame */
begw->frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (begw->frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), begw->frame, TRUE, TRUE, 0);
......
......@@ -30,6 +30,7 @@ typedef struct _BrushEditGeneratedWindow
GtkWidget *preview;
GtkWidget *scale_label;
GtkWidget *options_box;
GtkWidget *name;
GtkAdjustment *radius_data;
GtkAdjustment *hardness_data;
GtkAdjustment *angle_data;
......
GIMP-VBR
1.0
round01
15.0
10.0
0.75
1.0
0.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment