app/gradient.c app/gradient.h app/internal_procs.c app/plug_in.c

Sat Oct 31 14:57:40 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>

	* app/gradient.c
	* app/gradient.h
	* app/internal_procs.c
	* app/plug_in.c
	* app/session.c
	* app/session.h
	* libgimp/Makefile.am
	* libgimp/gimpmenu.h
	* libgimp/app/gimprc.c
	* libgimp/libgimpmenu.c
	* plug-ins/script-fu/scripts/test-sphere.scm
	* plug-ins/script-fu/script-fu-enums.h
	* plug-ins/script-fu/script-fu.c
	* plug-ins/script-fu/script-fu-scripts.c

	New file:-

	* libgimp/gimpgradientmenu.c

	New gradient selector widget (smaller than the editor). This can now
	be controlled via the PDB.

	New widget which gives easy way to do gradient selections. This
	new widget is used by script-fu (see the test->sphere script).

	gradient.c needs to be split up (source is almost already split
	I will complete this RSN).
This commit is contained in:
GMT 1998 Andy Thomas 1998-10-31 16:22:37 +00:00 committed by Andy Thomas
parent 064e081cd8
commit d4ccd85afd
48 changed files with 4706 additions and 338 deletions

View File

@ -1,3 +1,33 @@
Sat Oct 31 14:57:40 GMT 1998 Andy Thomas <alt@picnic.demon.co.uk>
* app/gradient.c
* app/gradient.h
* app/internal_procs.c
* app/plug_in.c
* app/session.c
* app/session.h
* libgimp/Makefile.am
* libgimp/gimpmenu.h
* libgimp/app/gimprc.c
* libgimp/libgimpmenu.c
* plug-ins/script-fu/scripts/test-sphere.scm
* plug-ins/script-fu/script-fu-enums.h
* plug-ins/script-fu/script-fu.c
* plug-ins/script-fu/script-fu-scripts.c
New file:-
* libgimp/gimpgradientmenu.c
New gradient selector widget (smaller than the editor). This can now
be controlled via the PDB.
New widget which gives easy way to do gradient selections. This
new widget is used by script-fu (see the test->sphere script).
gradient.c needs to be split up (source is almost already split
I will complete this RSN).
Sat Oct 31 01:37:23 CET 1998 Marc Lehmann <pcg@goof.com>
* configure.in: make perl use the GLIB_CFLAGS/LIBS vars properly.

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -254,7 +254,7 @@ static SessionInfo *session_infos[] =
&palette_session_info,
&brush_select_session_info,
&pattern_select_session_info,
&gradient_editor_session_info,
&gradient_select_session_info,
&device_status_session_info,
&error_console_session_info
};

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@ void grad_get_color_at(double pos, double *r, double *g, double *b, double *a);
void grad_create_gradient_editor(void);
void grad_free_gradient_editor(void);
void gradients_check_dialogs(void);
/***** Procedural database exports *****/
@ -45,6 +46,9 @@ extern ProcRecord gradients_get_active_proc;
extern ProcRecord gradients_set_active_proc;
extern ProcRecord gradients_sample_uniform_proc;
extern ProcRecord gradients_sample_custom_proc;
extern ProcRecord gradients_close_popup_proc;
extern ProcRecord gradients_set_popup_proc;
extern ProcRecord gradients_popup_proc;
extern ProcRecord gradients_get_gradient_data_proc;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@ void grad_get_color_at(double pos, double *r, double *g, double *b, double *a);
void grad_create_gradient_editor(void);
void grad_free_gradient_editor(void);
void gradients_check_dialogs(void);
/***** Procedural database exports *****/
@ -45,6 +46,9 @@ extern ProcRecord gradients_get_active_proc;
extern ProcRecord gradients_set_active_proc;
extern ProcRecord gradients_sample_uniform_proc;
extern ProcRecord gradients_sample_custom_proc;
extern ProcRecord gradients_close_popup_proc;
extern ProcRecord gradients_set_popup_proc;
extern ProcRecord gradients_popup_proc;
extern ProcRecord gradients_get_gradient_data_proc;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@ void grad_get_color_at(double pos, double *r, double *g, double *b, double *a);
void grad_create_gradient_editor(void);
void grad_free_gradient_editor(void);
void gradients_check_dialogs(void);
/***** Procedural database exports *****/
@ -45,6 +46,9 @@ extern ProcRecord gradients_get_active_proc;
extern ProcRecord gradients_set_active_proc;
extern ProcRecord gradients_sample_uniform_proc;
extern ProcRecord gradients_sample_custom_proc;
extern ProcRecord gradients_close_popup_proc;
extern ProcRecord gradients_set_popup_proc;
extern ProcRecord gradients_popup_proc;
extern ProcRecord gradients_get_gradient_data_proc;
#endif

View File

@ -55,7 +55,7 @@ static GtkItemFactoryEntry toolbox_entries[] =
{ N_("/File/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/File/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/File/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_tools_options_cmd_callback, 0 },
{ N_("/File/Dialogs/Input Devices..."), NULL, dialogs_input_devices_cmd_callback, 0 },
@ -210,7 +210,7 @@ static GtkItemFactoryEntry image_entries[] =
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/Dialogs/Indexed Palette..."), NULL, dialogs_indexed_palette_cmd_callback, 0 },
{ N_("/Dialogs/Tool Options..."), NULL, dialogs_tools_options_cmd_callback, 0 },

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -77,7 +77,7 @@ SessionInfo brush_select_session_info =
{ "brush-select", (GtkItemFactoryCallback)dialogs_brushes_cmd_callback, 150, 180, 0, 0, FALSE };
SessionInfo pattern_select_session_info =
{ "pattern-select", (GtkItemFactoryCallback)dialogs_patterns_cmd_callback, 160, 180, 0, 0, FALSE };
SessionInfo gradient_editor_session_info =
SessionInfo gradient_select_session_info =
{ "gradient-editor", (GtkItemFactoryCallback)dialogs_gradient_editor_cmd_callback, 170, 180, 0, 0, FALSE };
SessionInfo device_status_session_info =
{ "device-status", (GtkItemFactoryCallback)dialogs_device_status_cmd_callback, 0, 600, 0, 0, FALSE };

View File

@ -43,7 +43,7 @@ extern SessionInfo tool_options_session_info;
extern SessionInfo palette_session_info;
extern SessionInfo brush_select_session_info;
extern SessionInfo pattern_select_session_info;
extern SessionInfo gradient_editor_session_info;
extern SessionInfo gradient_select_session_info;
extern SessionInfo device_status_session_info;
extern SessionInfo error_console_session_info;

View File

@ -80,7 +80,7 @@ internal_procs_init ()
{
gfloat pcount = 0;
/* grep -c procedural_db_register internal_procs.c */
gfloat total_pcount = 245;
gfloat total_pcount = 249;
app_init_update_status("Internal Procedures", "Tool procedures",
pcount/total_pcount);
@ -356,6 +356,10 @@ internal_procs_init ()
procedural_db_register (&gradients_set_active_proc); pcount++;
procedural_db_register (&gradients_sample_uniform_proc); pcount++;
procedural_db_register (&gradients_sample_custom_proc); pcount++;
procedural_db_register (&gradients_popup_proc); pcount++;
procedural_db_register (&gradients_close_popup_proc); pcount++;
procedural_db_register (&gradients_set_popup_proc); pcount++;
procedural_db_register (&gradients_get_gradient_data_proc); pcount++;
app_init_update_status(NULL, "Image procedures",
pcount/total_pcount);

View File

@ -55,7 +55,7 @@ static GtkItemFactoryEntry toolbox_entries[] =
{ N_("/File/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/File/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/File/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_tools_options_cmd_callback, 0 },
{ N_("/File/Dialogs/Input Devices..."), NULL, dialogs_input_devices_cmd_callback, 0 },
@ -210,7 +210,7 @@ static GtkItemFactoryEntry image_entries[] =
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/Dialogs/Indexed Palette..."), NULL, dialogs_indexed_palette_cmd_callback, 0 },
{ N_("/Dialogs/Tool Options..."), NULL, dialogs_tools_options_cmd_callback, 0 },

View File

@ -55,7 +55,7 @@ static GtkItemFactoryEntry toolbox_entries[] =
{ N_("/File/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/File/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/File/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_tools_options_cmd_callback, 0 },
{ N_("/File/Dialogs/Input Devices..."), NULL, dialogs_input_devices_cmd_callback, 0 },
@ -210,7 +210,7 @@ static GtkItemFactoryEntry image_entries[] =
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/Dialogs/Indexed Palette..."), NULL, dialogs_indexed_palette_cmd_callback, 0 },
{ N_("/Dialogs/Tool Options..."), NULL, dialogs_tools_options_cmd_callback, 0 },

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -52,6 +52,7 @@
#include "general.h"
#include "gimage.h"
#include "gimprc.h"
#include "gradient.h"
#include "interface.h"
#include "menus.h"
#include "pattern_select.h" /* Needed for closing pattern dialogs */
@ -1066,6 +1067,7 @@ plug_in_close (PlugIn *plug_in,
/* Close any dialogs that this plugin might have opened */
brushes_check_dialogs();
patterns_check_dialogs();
gradients_check_dialogs();
open_plug_ins = g_slist_remove (open_plug_ins, plug_in);
}

View File

@ -77,7 +77,7 @@ SessionInfo brush_select_session_info =
{ "brush-select", (GtkItemFactoryCallback)dialogs_brushes_cmd_callback, 150, 180, 0, 0, FALSE };
SessionInfo pattern_select_session_info =
{ "pattern-select", (GtkItemFactoryCallback)dialogs_patterns_cmd_callback, 160, 180, 0, 0, FALSE };
SessionInfo gradient_editor_session_info =
SessionInfo gradient_select_session_info =
{ "gradient-editor", (GtkItemFactoryCallback)dialogs_gradient_editor_cmd_callback, 170, 180, 0, 0, FALSE };
SessionInfo device_status_session_info =
{ "device-status", (GtkItemFactoryCallback)dialogs_device_status_cmd_callback, 0, 600, 0, 0, FALSE };

View File

@ -43,7 +43,7 @@ extern SessionInfo tool_options_session_info;
extern SessionInfo palette_session_info;
extern SessionInfo brush_select_session_info;
extern SessionInfo pattern_select_session_info;
extern SessionInfo gradient_editor_session_info;
extern SessionInfo gradient_select_session_info;
extern SessionInfo device_status_session_info;
extern SessionInfo error_console_session_info;

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@ void grad_get_color_at(double pos, double *r, double *g, double *b, double *a);
void grad_create_gradient_editor(void);
void grad_free_gradient_editor(void);
void gradients_check_dialogs(void);
/***** Procedural database exports *****/
@ -45,6 +46,9 @@ extern ProcRecord gradients_get_active_proc;
extern ProcRecord gradients_set_active_proc;
extern ProcRecord gradients_sample_uniform_proc;
extern ProcRecord gradients_sample_custom_proc;
extern ProcRecord gradients_close_popup_proc;
extern ProcRecord gradients_set_popup_proc;
extern ProcRecord gradients_popup_proc;
extern ProcRecord gradients_get_gradient_data_proc;
#endif

View File

@ -55,7 +55,7 @@ static GtkItemFactoryEntry toolbox_entries[] =
{ N_("/File/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/File/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/File/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/File/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/File/Dialogs/Tool Options..."), "<control><shift>T", dialogs_tools_options_cmd_callback, 0 },
{ N_("/File/Dialogs/Input Devices..."), NULL, dialogs_input_devices_cmd_callback, 0 },
@ -210,7 +210,7 @@ static GtkItemFactoryEntry image_entries[] =
{ N_("/Dialogs/Brushes..."), "<control><shift>B", dialogs_brushes_cmd_callback, 0 },
{ N_("/Dialogs/Patterns..."), "<control><shift>P", dialogs_patterns_cmd_callback, 0 },
{ N_("/Dialogs/Palette..."), "<control>P", dialogs_palette_cmd_callback, 0 },
{ N_("/Dialogs/Gradient Editor..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Gradient..."), "<control>G", dialogs_gradient_editor_cmd_callback, 0 },
{ N_("/Dialogs/Layers & Channels..."), "<control>L", dialogs_lc_cmd_callback, 0 },
{ N_("/Dialogs/Indexed Palette..."), NULL, dialogs_indexed_palette_cmd_callback, 0 },
{ N_("/Dialogs/Tool Options..."), NULL, dialogs_tools_options_cmd_callback, 0 },

View File

@ -52,6 +52,7 @@ libgimp_la_SOURCES = \
libgimpui_la_SOURCES = \
gimpmenu.c \
gimpbrushmenu.c \
gimpgradientmenu.c \
gimppatternmenu.c
gimpinclude_HEADERS = \

270
libgimp/gimpgradientmenu.c Normal file
View File

@ -0,0 +1,270 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* Copyright (C) 1998 Andy Thomas
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <stdio.h>
#include <string.h>
#include "gimp.h"
#include "gimpui.h"
/* Idea is to have a function to call that returns a widget that
* completely controls the selection of a gradient.
* you get a widget returned that you can use in a table say.
* In:- Initial gradient name. Null means use current selection.
* pointer to func to call when gradient changes (GRunGradientCallback).
* Returned:- Pointer to a widget that you can use in UI.
*
* Widget simply made up of a preview widget (20x40) containing the gradient
* which can be clicked on to changed the gradient selection.
*/
#define GSEL_DATA_KEY "__gsel_data"
#define CELL_SIZE_HEIGHT 18
#define CELL_SIZE_WIDTH 84
#define GRAD_CHECK_SIZE_SM 4
#define GRAD_CHECK_DARK (1.0 / 3.0)
#define GRAD_CHECK_LIGHT (2.0 / 3.0)
struct __gradients_sel {
gchar * dname;
GRunGradientCallback cback;
GtkWidget *gradient_preview;
GtkWidget *button;
GtkWidget *gradient_popup_pnt;
gint width;
gchar *gradient_name; /* Local copy */
gdouble *grad_data; /* local copy */
gint sample_size;
gpointer udata;
};
typedef struct __gradients_sel GSelect, * GSelectP;
static void
gradient_pre_update(GtkWidget *gradient_preview,
gint width_data,
gdouble *grad_data)
{
gint x,y;
gdouble *src;
double r, g, b, a;
double c0, c1;
guchar *p0, *p1,*even,*odd;
gint width = width_data/4;
/* Draw the gradient */
src = grad_data;
p0 = even = g_malloc(width*3);
p1 = odd = g_malloc(width*3);
for (x = 0; x < width; x++) {
r = src[x*4+0];
g = src[x*4+1];
b = src[x*4+2];
a = src[x*4+3];
if ((x / GRAD_CHECK_SIZE_SM) & 1) {
c0 = GRAD_CHECK_LIGHT;
c1 = GRAD_CHECK_DARK;
} else {
c0 = GRAD_CHECK_DARK;
c1 = GRAD_CHECK_LIGHT;
} /* else */
*p0++ = (c0 + (r - c0) * a) * 255.0;
*p0++ = (c0 + (g - c0) * a) * 255.0;
*p0++ = (c0 + (b - c0) * a) * 255.0;
*p1++ = (c1 + (r - c1) * a) * 255.0;
*p1++ = (c1 + (g - c1) * a) * 255.0;
*p1++ = (c1 + (b - c1) * a) * 255.0;
} /* for */
for (y = 0; y < CELL_SIZE_HEIGHT; y++)
{
if ((y / GRAD_CHECK_SIZE_SM) & 1)
{
gtk_preview_draw_row (GTK_PREVIEW (gradient_preview), (guchar *)odd, 0, y, (width < CELL_SIZE_WIDTH)?width:CELL_SIZE_WIDTH);
}
else
{
gtk_preview_draw_row (GTK_PREVIEW (gradient_preview), (guchar *)even, 0, y, (width < CELL_SIZE_WIDTH)?width:CELL_SIZE_WIDTH);
}
}
g_free(even);
g_free(odd);
/* Draw the brush preview */
gtk_widget_draw (gradient_preview, NULL);
}
static void
gradient_select_invoker(gchar *name,
gint width,
gdouble * grad_data,
gint closing,
gpointer udata)
{
GSelectP gsel = (GSelectP)udata;
if(gsel->grad_data != NULL)
g_free(gsel->grad_data);
gsel->width = width;
if(gsel->gradient_name)
g_free(gsel->gradient_name);
gsel->gradient_name = g_strdup(name);
/* one row only each row has four doubles r,g,b,a */
gsel->grad_data = g_malloc(width*sizeof(gdouble));
/* printf("name = %s width = %d\n",name,width);*/
g_memmove(gsel->grad_data,grad_data,width*sizeof(gdouble));
gradient_pre_update(gsel->gradient_preview,gsel->width,gsel->grad_data);
if(gsel->cback != NULL)
(gsel->cback)(name,width,grad_data,closing,gsel->udata);
if(closing)
gtk_widget_set_sensitive(gsel->button,TRUE);
}
static void
gradient_preview_callback(GtkWidget *widget,
gpointer data)
{
GSelectP gsel = (GSelectP)data;
gtk_widget_set_sensitive(gsel->button,FALSE);
gsel->gradient_popup_pnt =
gimp_interactive_selection_gradient((gsel->dname)?gsel->dname:"Gradient Plugin Selection",
gsel->gradient_name,
gsel->sample_size,
gradient_select_invoker,gsel);
}
GtkWidget *
gimp_gradient_select_widget(gchar *dname,
gchar *igradient,
GRunGradientCallback cback,
gpointer udata)
{
GtkWidget * button;
GtkWidget * hbox;
GtkWidget * gradient;
gint width;
gdouble *grad_data;
gchar *gradient_name;
GSelectP gsel = g_new(GSelect, sizeof(GSelect));
hbox = gtk_hbox_new (FALSE, 3);
gtk_widget_show(hbox);
button = gtk_button_new();
gradient = gtk_preview_new (GTK_PREVIEW_COLOR);
gtk_preview_size (GTK_PREVIEW (gradient), CELL_SIZE_WIDTH, CELL_SIZE_HEIGHT);
gtk_widget_show(gradient);
gtk_container_add (GTK_CONTAINER (button), gradient);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) gradient_preview_callback,
(gpointer)gsel);
gtk_widget_show(button);
gsel->button = button;
gsel->cback = cback;
gsel->udata = udata;
gsel->grad_data = NULL;
gsel->gradient_preview = gradient;
gsel->dname = dname;
gsel->gradient_popup_pnt = NULL;
gsel->sample_size = CELL_SIZE_WIDTH;
/* Do initial gradient setup */
gradient_name = gimp_gradient_get_gradient_data(igradient,&width, CELL_SIZE_WIDTH,&grad_data);
if(gradient_name)
{
gradient_pre_update(gsel->gradient_preview,width,grad_data);
gsel->grad_data = grad_data;
gsel->gradient_name = gradient_name;
gsel->width = width;
}
else
{
gsel->gradient_name = g_strdup(igradient);
}
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
gtk_object_set_data(GTK_OBJECT(hbox),GSEL_DATA_KEY,(gpointer)gsel);
return hbox;
}
gint
gimp_gradient_select_widget_close_popup(GtkWidget *w)
{
gint ret_val = FALSE;
GSelectP gsel = (GSelectP)gtk_object_get_data(GTK_OBJECT(w),GSEL_DATA_KEY);
if(gsel && gsel->gradient_popup_pnt)
{
ret_val = gimp_gradient_close_popup(gsel->gradient_popup_pnt);
gsel->gradient_popup_pnt = NULL;
}
return ret_val;
}
gint
gimp_gradient_select_widget_set_popup(GtkWidget *w,gchar *gname)
{
gint ret_val = FALSE;
gint width;
gdouble *grad_data;
gchar *gradient_name;
GSelectP gsel = (GSelectP)gtk_object_get_data(GTK_OBJECT(w),GSEL_DATA_KEY);
if(gsel)
{
gradient_name = gimp_gradient_get_gradient_data(gname,&width,gsel->sample_size,&grad_data);
if(gradient_name)
{
gradient_select_invoker(gname,width,grad_data,0,gsel);
if(gsel->gradient_popup_pnt)
{
if(gimp_gradient_set_popup(gsel->gradient_popup_pnt,gname))
{
ret_val = TRUE;
}
}
}
}
return ret_val;
}

View File

@ -55,11 +55,25 @@ struct _GPatternData {
typedef struct _GPatternData GPatternData;
/* Copy data from temp_PDB call */
struct _GGradientData {
gint busy;
gchar *gname;
gint width;
gdouble *gradient_data;
GRunGradientCallback callback;
gint closing;
gpointer udata;
};
typedef struct _GGradientData GGradientData;
static void gimp_menu_callback (GtkWidget *w,
gint32 *id);
static void do_brush_callback (GBrushData *bdata);
static gint idle_test_brush (GBrushData *bdata);
static gint idle_test_pattern (GPatternData *pdata);
static gint idle_test_gradient (GGradientData *gdata);
static void temp_brush_invoker (char *name,
int nparams,
GParam *param,
@ -76,8 +90,10 @@ void gimp_run_temp (void);
static GHashTable *gbrush_ht = NULL;
static GHashTable *gpattern_ht = NULL;
static GHashTable *ggradient_ht = NULL;
static GBrushData *active_brush_pdb = NULL;
static GPatternData *active_pattern_pdb = NULL;
static GGradientData *active_gradient_pdb = NULL;
GtkWidget*
@ -487,6 +503,30 @@ do_pattern_callback(GPatternData * pdata)
pdata->pname = pdata->pattern_mask_data = 0;
}
static void
do_gradient_callback(GGradientData * gdata)
{
if(!gdata->busy)
return;
if(gdata->callback)
gdata->callback(gdata->gname,
gdata->width,
gdata->gradient_data,
gdata->closing,
gdata->udata);
if(gdata->gname)
g_free(gdata->gname);
if(gdata->gradient_data)
g_free(gdata->gradient_data);
gdata->busy = 0;
gdata->gname = NULL;
gdata->gradient_data = NULL;
}
static gint
idle_test_brush (GBrushData * bdata)
{
@ -502,6 +542,13 @@ idle_test_pattern (GPatternData * pdata)
return FALSE;
}
static gint
idle_test_gradient (GGradientData * gdata)
{
do_gradient_callback(gdata);
return FALSE;
}
static void
temp_brush_invoker(char *name,
int nparams,
@ -595,6 +642,50 @@ temp_pattern_invoker(char *name,
values[0].data.d_status = status;
}
static void
temp_gradient_invoker(char *name,
int nparams,
GParam *param,
int *nreturn_vals,
GParam **return_vals)
{
static GParam values[1];
GStatusType status = STATUS_SUCCESS;
GGradientData *gdata = (GGradientData *)g_hash_table_lookup(ggradient_ht,name);
if(!gdata)
{
g_warning("Can't find internal gradient data");
}
else
{
if(!gdata->busy)
{
int i;
gdouble *pv,*values;;
gdata->gname = g_strdup(param[0].data.d_string);
gdata->width = param[1].data.d_int32;
gdata->gradient_data = (gdouble *)g_malloc(param[1].data.d_int32*sizeof(gdouble));
values = param[2].data.d_floatarray;
pv = gdata->gradient_data;
for (i = 0; i < gdata->width; i++)
gdata->gradient_data[i] = param[2].data.d_floatarray[i];
gdata->closing = param[3].data.d_int32;
active_gradient_pdb = gdata;
gdata->busy = 1;
gtk_idle_add((GtkFunction) idle_test_gradient,active_gradient_pdb);
}
}
*nreturn_vals = 1;
*return_vals = values;
values[0].type = PARAM_STATUS;
values[0].data.d_status = status;
}
static void
input_callback (gpointer data,
gint source,
@ -936,3 +1027,134 @@ gimp_pattern_set_popup(void * popup_pnt, gchar * pname)
return retval;
}
void *
gimp_interactive_selection_gradient(gchar *dialogname,
gchar *gradient_name,
gint sample_sz,
GRunGradientCallback callback,
gpointer udata)
{
static GParamDef args[] =
{
{ PARAM_STRING, "str", "String"},
{ PARAM_INT32, "grad width","grad width"},
{ PARAM_FLOATARRAY,"grad data","The gradient mask data"},
{ PARAM_INT32, "dialog status","Registers if the dialog was closing [0 = No, 1 = Yes]"},
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
static int nreturn_vals = 0;
gint bnreturn_vals;
GParam *pdbreturn_vals;
gchar *pdbname = gen_temp_plugin_name();
GGradientData *gdata = g_malloc0(sizeof(struct _GGradientData));
gimp_install_temp_proc (pdbname,
"Temp PDB for interactive popups",
"More here later",
"Andy Thomas",
"Andy Thomas",
"1997",
NULL,
"RGB*, GRAY*",
PROC_TEMPORARY,
nargs, nreturn_vals,
args, return_vals,
temp_gradient_invoker);
pdbreturn_vals =
gimp_run_procedure("gimp_gradients_popup",
&bnreturn_vals,
PARAM_STRING,pdbname,
PARAM_STRING,dialogname,
PARAM_STRING,gradient_name,/*name*/
PARAM_INT32,sample_sz, /* size of sample to be returned */
PARAM_END);
gimp_setup_callbacks(); /* New function to allow callbacks to be watched */
gimp_destroy_params (pdbreturn_vals,bnreturn_vals);
/* Now add to hash table so we can find it again */
if(ggradient_ht == NULL)
ggradient_ht = g_hash_table_new (g_str_hash,
g_str_equal);
gdata->callback = callback;
gdata->udata = udata;
g_hash_table_insert(ggradient_ht,pdbname,gdata);
return pdbname;
}
gchar *
gimp_gradient_get_gradient_data (gchar *gname,
gint *width,
gint sample_sz,
gdouble **grad_data)
{
GParam *return_vals;
int nreturn_vals;
gchar *ret_name = NULL;
return_vals = gimp_run_procedure ("gimp_gradients_get_gradient_data",
&nreturn_vals,
PARAM_STRING, gname,
PARAM_INT32, sample_sz,
PARAM_END);
if (return_vals[0].data.d_status == STATUS_SUCCESS)
{
int i;
ret_name = g_strdup(return_vals[1].data.d_string);
*width = return_vals[2].data.d_int32;
*grad_data = g_new (gdouble,*width);
for (i = 0; i < *width; i++)
(*grad_data)[i] = return_vals[3].data.d_floatarray[i];
}
gimp_destroy_params (return_vals, nreturn_vals);
return ret_name;
}
gint
gimp_gradient_close_popup(void * popup_pnt)
{
GParam *return_vals;
int nreturn_vals;
gint retval;
return_vals = gimp_run_procedure ("gimp_gradients_close_popup",
&nreturn_vals,
PARAM_STRING, popup_pnt,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
retval = (return_vals[0].data.d_status == STATUS_SUCCESS);
return retval;
}
gint
gimp_gradient_set_popup(void * popup_pnt, gchar * gname)
{
GParam *return_vals;
int nreturn_vals;
gint retval;
return_vals = gimp_run_procedure ("gimp_gradients_set_popup",
&nreturn_vals,
PARAM_STRING, popup_pnt,
PARAM_STRING, gname,
PARAM_END);
gimp_destroy_params (return_vals, nreturn_vals);
retval = (return_vals[0].data.d_status == STATUS_SUCCESS);
return retval;
}

View File

@ -54,6 +54,13 @@ typedef void (*GRunPatternCallback) (gchar *, /* Name */
gint, /* dialog closing */
gpointer /* user data */);
/* Popup the gradient dialog */
typedef void (*GRunGradientCallback) (gchar *, /* Name */
gint, /* Width */
gdouble *, /* grad data */
gint, /* dialog closing */
gpointer /* user data */);
GtkWidget* gimp_image_menu_new (GimpConstraintFunc constraint,
GimpMenuCallback callback,
gpointer data,
@ -135,6 +142,30 @@ gint gimp_pattern_set_popup(void * popup_pnt, gchar * pname);
gint gimp_pattern_close_popup(void * popup_pnt);
void * gimp_interactive_selection_gradient (gchar *dialogtitle,
gchar *gradient_name,
gint sample_sz,
GRunGradientCallback callback,
gpointer udata);
GtkWidget * gimp_gradient_select_widget(gchar * gname,
gchar * igradient,
GRunGradientCallback cback,
gpointer);
gint gimp_gradient_select_widget_close_popup(GtkWidget *w);
gint gimp_gradient_select_widget_set_popup(GtkWidget *w,gchar *pname);
gchar *gimp_gradient_get_gradient_data (gchar *pname,
gint *width,
gint sample_sz,
gdouble **mask_data);
gint gimp_gradient_set_popup(void * popup_pnt, gchar * pname);
gint gimp_gradient_close_popup(void * popup_pnt);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -34,7 +34,8 @@ typedef enum
SF_ADJUSTMENT,
SF_FONT,
SF_PATTERN,
SF_BRUSH
SF_BRUSH,
SF_GRADIENT
} SFArgType;
typedef enum

View File

@ -89,6 +89,7 @@ typedef union
SFAdjustment sfa_adjustment;
SFFont sfa_font;
gchar * sfa_pattern;
gchar * sfa_gradient;
SFBrush sfa_brush;
} SFArgValue;
@ -185,6 +186,12 @@ static void script_fu_pattern_preview (gchar *name,
gint closing,
gpointer udata);
static void script_fu_gradient_preview (gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
@ -616,6 +623,17 @@ script_fu_add_script (LISP a)
args[i + 1].description = script->arg_labels[i];
break;
case SF_GRADIENT:
if (!TYPEP (car (a), tc_string))
return my_err ("script-fu-register: gradient defaults must be string values", NIL);
script->arg_defaults[i].sfa_gradient = g_strdup (get_c_string (car (a)));
script->arg_values[i].sfa_gradient = g_strdup (script->arg_defaults[i].sfa_pattern);
args[i + 1].type = PARAM_STRING;
args[i + 1].name = "gradient";
args[i + 1].description = script->arg_labels[i];
break;
default:
break;
}
@ -767,6 +785,9 @@ script_fu_script_proc (char *name,
case SF_PATTERN:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_GRADIENT:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_BRUSH:
length += strlen (params[i + 1].data.d_string) + 3;
break;
@ -820,6 +841,10 @@ script_fu_script_proc (char *name,
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_GRADIENT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_BRUSH:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
@ -921,6 +946,10 @@ script_fu_free_script (SFScript *script)
g_free (script->arg_defaults[i].sfa_pattern);
g_free (script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
g_free (script->arg_defaults[i].sfa_gradient);
g_free (script->arg_values[i].sfa_gradient);
break;
case SF_BRUSH:
g_free (script->arg_defaults[i].sfa_brush.name);
g_free (script->arg_values[i].sfa_brush.name);
@ -1185,6 +1214,12 @@ script_fu_interface (SFScript *script)
script_fu_pattern_preview,
&script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
script->args_widgets[i] = gimp_gradient_select_widget("Script-fu Pattern Selection",
script->arg_values[i].sfa_gradient,
script_fu_gradient_preview,
&script->arg_values[i].sfa_gradient);
break;
case SF_BRUSH:
script->args_widgets[i] =
gimp_brush_select_widget("Script-fu brush Selection",
@ -1314,6 +1349,18 @@ script_fu_pattern_preview(gchar *name,
*pname = g_strdup(name);
}
static void
script_fu_gradient_preview(gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata)
{
gchar ** pname = (gchar **) udata;
g_free(*pname);
*pname = g_strdup(name);
}
static void
script_fu_brush_preview(char * name, /* Name */
gdouble opacity, /* opacity */
@ -1404,6 +1451,9 @@ script_fu_cleanup_widgets (SFScript *script)
case SF_PATTERN:
gimp_pattern_select_widget_close_popup(script->args_widgets[i]);
break;
case SF_GRADIENT:
gimp_gradient_select_widget_close_popup(script->args_widgets[i]);
break;
case SF_BRUSH:
gimp_brush_select_widget_close_popup(script->args_widgets[i]);
break;
@ -1473,6 +1523,9 @@ script_fu_ok_callback (GtkWidget *widget,
case SF_PATTERN:
length += strlen (script->arg_values[i].sfa_pattern) + 3;
break;
case SF_GRADIENT:
length += strlen (script->arg_values[i].sfa_gradient) + 3;
break;
case SF_BRUSH:
length += strlen (script->arg_values[i].sfa_brush.name) + 3;
length += 36; /* Maximum size of three ints for opacity, spacing,mode*/
@ -1543,6 +1596,10 @@ script_fu_ok_callback (GtkWidget *widget,
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"",script->arg_values[i].sfa_pattern);
text = buffer;
break;
case SF_GRADIENT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"",script->arg_values[i].sfa_gradient);
text = buffer;
break;
case SF_BRUSH:
g_snprintf (buffer, MAX_STRING_LENGTH,
"'(\"%s\" %f %d %d)",
@ -1789,6 +1846,9 @@ script_fu_reset_callback (GtkWidget *widget,
case SF_PATTERN:
gimp_pattern_select_widget_set_popup(script->args_widgets[i],script->arg_defaults[i].sfa_pattern);
break;
case SF_GRADIENT:
gimp_gradient_select_widget_set_popup(script->args_widgets[i],script->arg_defaults[i].sfa_gradient);
break;
case SF_BRUSH:
gimp_brush_select_widget_set_popup(script->args_widgets[i],
script->arg_defaults[i].sfa_brush.name,

View File

@ -89,6 +89,7 @@ typedef union
SFAdjustment sfa_adjustment;
SFFont sfa_font;
gchar * sfa_pattern;
gchar * sfa_gradient;
SFBrush sfa_brush;
} SFArgValue;
@ -185,6 +186,12 @@ static void script_fu_pattern_preview (gchar *name,
gint closing,
gpointer udata);
static void script_fu_gradient_preview (gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
@ -616,6 +623,17 @@ script_fu_add_script (LISP a)
args[i + 1].description = script->arg_labels[i];
break;
case SF_GRADIENT:
if (!TYPEP (car (a), tc_string))
return my_err ("script-fu-register: gradient defaults must be string values", NIL);
script->arg_defaults[i].sfa_gradient = g_strdup (get_c_string (car (a)));
script->arg_values[i].sfa_gradient = g_strdup (script->arg_defaults[i].sfa_pattern);
args[i + 1].type = PARAM_STRING;
args[i + 1].name = "gradient";
args[i + 1].description = script->arg_labels[i];
break;
default:
break;
}
@ -767,6 +785,9 @@ script_fu_script_proc (char *name,
case SF_PATTERN:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_GRADIENT:
length += strlen (params[i + 1].data.d_string) + 3;
break;
case SF_BRUSH:
length += strlen (params[i + 1].data.d_string) + 3;
break;
@ -820,6 +841,10 @@ script_fu_script_proc (char *name,
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_GRADIENT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
break;
case SF_BRUSH:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", params[i + 1].data.d_string);
text = buffer;
@ -921,6 +946,10 @@ script_fu_free_script (SFScript *script)
g_free (script->arg_defaults[i].sfa_pattern);
g_free (script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
g_free (script->arg_defaults[i].sfa_gradient);
g_free (script->arg_values[i].sfa_gradient);
break;
case SF_BRUSH:
g_free (script->arg_defaults[i].sfa_brush.name);
g_free (script->arg_values[i].sfa_brush.name);
@ -1185,6 +1214,12 @@ script_fu_interface (SFScript *script)
script_fu_pattern_preview,
&script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
script->args_widgets[i] = gimp_gradient_select_widget("Script-fu Pattern Selection",
script->arg_values[i].sfa_gradient,
script_fu_gradient_preview,
&script->arg_values[i].sfa_gradient);
break;
case SF_BRUSH:
script->args_widgets[i] =
gimp_brush_select_widget("Script-fu brush Selection",
@ -1314,6 +1349,18 @@ script_fu_pattern_preview(gchar *name,
*pname = g_strdup(name);
}
static void
script_fu_gradient_preview(gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata)
{
gchar ** pname = (gchar **) udata;
g_free(*pname);
*pname = g_strdup(name);
}
static void
script_fu_brush_preview(char * name, /* Name */
gdouble opacity, /* opacity */
@ -1404,6 +1451,9 @@ script_fu_cleanup_widgets (SFScript *script)
case SF_PATTERN:
gimp_pattern_select_widget_close_popup(script->args_widgets[i]);
break;
case SF_GRADIENT:
gimp_gradient_select_widget_close_popup(script->args_widgets[i]);
break;
case SF_BRUSH:
gimp_brush_select_widget_close_popup(script->args_widgets[i]);
break;
@ -1473,6 +1523,9 @@ script_fu_ok_callback (GtkWidget *widget,
case SF_PATTERN:
length += strlen (script->arg_values[i].sfa_pattern) + 3;
break;
case SF_GRADIENT:
length += strlen (script->arg_values[i].sfa_gradient) + 3;
break;
case SF_BRUSH:
length += strlen (script->arg_values[i].sfa_brush.name) + 3;
length += 36; /* Maximum size of three ints for opacity, spacing,mode*/
@ -1543,6 +1596,10 @@ script_fu_ok_callback (GtkWidget *widget,
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"",script->arg_values[i].sfa_pattern);
text = buffer;
break;
case SF_GRADIENT:
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"",script->arg_values[i].sfa_gradient);
text = buffer;
break;
case SF_BRUSH:
g_snprintf (buffer, MAX_STRING_LENGTH,
"'(\"%s\" %f %d %d)",
@ -1789,6 +1846,9 @@ script_fu_reset_callback (GtkWidget *widget,
case SF_PATTERN:
gimp_pattern_select_widget_set_popup(script->args_widgets[i],script->arg_defaults[i].sfa_pattern);
break;
case SF_GRADIENT:
gimp_gradient_select_widget_set_popup(script->args_widgets[i],script->arg_defaults[i].sfa_gradient);
break;
case SF_BRUSH:
gimp_brush_select_widget_set_popup(script->args_widgets[i],
script->arg_defaults[i].sfa_brush.name,

View File

@ -478,6 +478,7 @@ init_constants ()
setvar (cintern ("SF-FONT"), flocons (SF_FONT), NIL);
setvar (cintern ("SF-PATTERN"), flocons (SF_PATTERN), NIL);
setvar (cintern ("SF-BRUSH"), flocons (SF_BRUSH), NIL);
setvar (cintern ("SF-GRADIENT"), flocons (SF_GRADIENT), NIL);
/* for SF_ADJUSTMENT */
setvar (cintern ("SF-SLIDER"), flocons (SF_SLIDER), NIL);

View File

@ -62,11 +62,24 @@
; The vaule returned when the script is invoked is a string containing the
; pattern name. If the above selection was not altered the string would
; contain "Maple Leaves"
; ----------------------------------------------------------------------
;
; SF-GRADIENT
; Only useful in interactive mode. It will create a widget in the control
; dialog. The widget consists of a button containing a preview of the selected
; gradient. If the button is pressed a gradient selection dialog will popup.
;
;
; Usage:-
; SF-GRADIENT "Gradient" "Deep_Sea"
;
; The vaule returned when the script is invoked is a string containing the
; gradient name. If the above selection was not altered the string would
; contain "Deep_Sea"
;
(define (script-fu-test-sphere radius light shadow bg-color sphere-color brush text pattern font size)
(define (script-fu-test-sphere radius light shadow bg-color sphere-color brush text pattern gradient font size)
(let* ((width (* radius 3.75))
(height (* radius 2.5))
(img (car (gimp-image-new width height RGB)))
@ -108,6 +121,12 @@
FALSE 0 0 light-x light-y light-end-x light-end-y)
(gimp-selection-none img)
(gimp-gradients-set-active gradient)
(gimp-ellipse-select img 10 10 50 50 REPLACE TRUE FALSE 0)
(gimp-blend img drawable CUSTOM NORMAL LINEAR 100 offset REPEAT-NONE
FALSE 0 0 10 10 30 60)
(gimp-selection-none img)
(gimp-palette-set-foreground '(0 0 0))
(gimp-floating-sel-anchor (car (gimp-text-fontname img drawable
x-position y-position
@ -123,7 +142,7 @@
(script-fu-register "script-fu-test-sphere"
"<Toolbox>/Xtns/Script-Fu/Test/Sphere"
"Simple script to test and show the usage of the new Script-Fu API extensions. \n\nNote the use of spinbuttons, sliders, the font selector and do not forget the about dialog..."
"Simple script to test and show the usage of the new Script-Fu API extensions. \n\nNote the use of spinbuttons, sliders, the font, pattern, brush and gradient selectors and do not forget the about dialog..."
"Spencer Kimball, Sven Neumann"
"Spencer Kimball"
"1996, 1998"
@ -136,6 +155,7 @@
SF-BRUSH "Brush" '("Circle (03)" 1.0 44 0)
SF-STRING "Text" "Script-Fu rocks!"
SF-PATTERN "Pattern" "Maple Leaves"
SF-GRADIENT "Gradient" "Deep_Sea"
SF-FONT "Font" "-freefont-agate-normal-r-normal-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font size (in pixels)" '(50 1 1000 1 10 0 1))