Commit 0a5fadee authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/perspective_tool.c app/rotate_tool.c app/scale_tool.c app/shear_tool.c

2000-02-21  Michael Natterer  <mitch@gimp.org>

	* app/perspective_tool.c
	* app/rotate_tool.c
	* app/scale_tool.c
	* app/shear_tool.c
	* plug-ins/common/gauss_iir.c
	* plug-ins/common/gauss_rle.c: fix Solaris compilation problems
	reported by Ludovic Poitou <ludovic.poitou@france.sun.com>.

	* libgimp/gimppixmap.[ch]: new function gimp_pixmap_set().

	* plug-ins/gfig/gfig.c: hacked the ui to use the libgimp widgets &
	constructors and slightly reorganized it to use fewer screen
	space (not yet perfect). Did a general namespace & code cleanup.

	* plug-ins/FractalExplorer/FractalExplorer.c: use a GimpPathEditor
	widget.
parent e42cece9
2000-02-21 Michael Natterer <mitch@gimp.org>
* app/perspective_tool.c
* app/rotate_tool.c
* app/scale_tool.c
* app/shear_tool.c
* plug-ins/common/gauss_iir.c
* plug-ins/common/gauss_rle.c: fix Solaris compilation problems
reported by Ludovic Poitou <ludovic.poitou@france.sun.com>.
* libgimp/gimppixmap.[ch]: new function gimp_pixmap_set().
* plug-ins/gfig/gfig.c: hacked the ui to use the libgimp widgets &
constructors and slightly reorganized it to use fewer screen
space (not yet perfect). Did a general namespace & code cleanup.
* plug-ins/FractalExplorer/FractalExplorer.c: use a GimpPathEditor
widget.
Mon Feb 21 11:59:33 CET 2000 Sven Neumann <sven@gimp.org>
* plug-ins/common/curve_bend.c
......
......@@ -303,7 +303,8 @@ perspective_tool_perspective (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -393,7 +393,8 @@ rotate_tool_rotate (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -504,7 +504,8 @@ scale_tool_scale (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -345,7 +345,8 @@ shear_tool_shear (GimpImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -303,7 +303,8 @@ perspective_tool_perspective (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -393,7 +393,8 @@ rotate_tool_rotate (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -504,7 +504,8 @@ scale_tool_scale (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -345,7 +345,8 @@ shear_tool_shear (GimpImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -303,7 +303,8 @@ perspective_tool_perspective (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -393,7 +393,8 @@ rotate_tool_rotate (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -504,7 +504,8 @@ scale_tool_scale (GImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -345,7 +345,8 @@ shear_tool_shear (GimpImage *gimage,
ret = transform_core_do (gimage, drawable, float_tiles,
interpolation, matrix,
progress ? progress_update_and_flush : NULL,
progress ? progress_update_and_flush :
(progress_func_t) NULL,
progress);
if (progress)
......
......@@ -31,8 +31,9 @@ struct _GimpPixmap
gchar **xpm_data;
};
static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap);
static GtkPixmapClass *parent_class = NULL;
......@@ -66,9 +67,7 @@ gimp_pixmap_class_init (GimpPixmapClass *class)
static void
gimp_pixmap_init (GimpPixmap *pixmap)
{
GtkPixmap *gtk_pixmap;
gtk_pixmap = GTK_PIXMAP (pixmap);
pixmap->xpm_data = NULL;
}
GtkType
......@@ -109,55 +108,95 @@ GtkWidget *
gimp_pixmap_new (gchar **xpm_data)
{
GimpPixmap *pixmap;
gint width, height;
g_return_val_if_fail (xpm_data != NULL, NULL);
pixmap = gtk_type_new (gimp_pixmap_get_type ());
if (!xpm_data)
return NULL;
GTK_PIXMAP (pixmap)->build_insensitive = TRUE;
gimp_pixmap_set (pixmap, xpm_data);
pixmap = gtk_type_new (gimp_pixmap_get_type ());
return GTK_WIDGET (pixmap);
}
/**
* gimp_pixmap_new:
* @pixmap: The pixmap widget you want to set the new xpm_data for.
* @xpm_data: A pointer to a XPM data structure as found in XPM files.
*
* Sets a new image for an existing #GimpPixmap widget.
*
*/
void
gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data)
{
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GIMP_IS_PIXMAP (pixmap));
pixmap->xpm_data = xpm_data;
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
GTK_WIDGET (pixmap)->requisition.width = 0;
GTK_WIDGET (pixmap)->requisition.height = 0;
if (! GTK_WIDGET_REALIZED (GTK_WIDGET (pixmap)))
{
g_warning ("passed pointer is no XPM data");
if (xpm_data)
{
gint width, height;
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
{
g_warning ("passed pointer is no XPM data");
}
else
{
GTK_WIDGET (pixmap)->requisition.width =
width + GTK_MISC (pixmap)->xpad * 2;
GTK_WIDGET (pixmap)->requisition.height =
height + GTK_MISC (pixmap)->ypad * 2;
}
}
}
else
{
GTK_WIDGET (pixmap)->requisition.width =
width + GTK_MISC (pixmap)->xpad * 2;
GTK_WIDGET (pixmap)->requisition.height =
height + GTK_MISC (pixmap)->ypad * 2;
gimp_pixmap_create_from_xpm_d (pixmap);
}
return GTK_WIDGET (pixmap);
}
static void
gimp_pixmap_realize (GtkWidget *widget)
{
GimpPixmap *pixmap;
if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
gimp_pixmap_create_from_xpm_d (GIMP_PIXMAP (widget));
}
static void
gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap)
{
GtkStyle *style;
GdkPixmap *gdk_pixmap;
GdkBitmap *mask;
GdkPixmap *gdk_pixmap = NULL;
GdkBitmap *mask = NULL;
pixmap = GIMP_PIXMAP (widget);
if (pixmap->xpm_data)
{
GtkWidget *widget;
if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
widget = GTK_WIDGET (pixmap);
style = gtk_widget_get_style (widget);
style = gtk_widget_get_style (widget);
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
&mask,
&style->bg[GTK_STATE_NORMAL],
pixmap->xpm_data);
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
&mask,
&style->bg[GTK_STATE_NORMAL],
pixmap->xpm_data);
}
GTK_PIXMAP (pixmap)->build_insensitive = TRUE;
gtk_pixmap_set (GTK_PIXMAP (pixmap), gdk_pixmap, mask);
gdk_pixmap_unref (gdk_pixmap);
gdk_bitmap_unref (mask);
if (gdk_pixmap)
gdk_pixmap_unref (gdk_pixmap);
if (mask)
gdk_bitmap_unref (mask);
}
......@@ -43,7 +43,10 @@ struct _GimpPixmapClass
};
GtkType gimp_pixmap_get_type (void);
GtkWidget * gimp_pixmap_new (gchar **xpm_data);
GtkWidget * gimp_pixmap_new (gchar **xpm_data);
void gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data);
#ifdef __cplusplus
}
......
......@@ -31,8 +31,9 @@ struct _GimpPixmap
gchar **xpm_data;
};
static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_destroy (GtkObject *object);
static void gimp_pixmap_realize (GtkWidget *widget);
static void gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap);
static GtkPixmapClass *parent_class = NULL;
......@@ -66,9 +67,7 @@ gimp_pixmap_class_init (GimpPixmapClass *class)
static void
gimp_pixmap_init (GimpPixmap *pixmap)
{
GtkPixmap *gtk_pixmap;
gtk_pixmap = GTK_PIXMAP (pixmap);
pixmap->xpm_data = NULL;
}
GtkType
......@@ -109,55 +108,95 @@ GtkWidget *
gimp_pixmap_new (gchar **xpm_data)
{
GimpPixmap *pixmap;
gint width, height;
g_return_val_if_fail (xpm_data != NULL, NULL);
pixmap = gtk_type_new (gimp_pixmap_get_type ());
if (!xpm_data)
return NULL;
GTK_PIXMAP (pixmap)->build_insensitive = TRUE;
gimp_pixmap_set (pixmap, xpm_data);
pixmap = gtk_type_new (gimp_pixmap_get_type ());
return GTK_WIDGET (pixmap);
}
/**
* gimp_pixmap_new:
* @pixmap: The pixmap widget you want to set the new xpm_data for.
* @xpm_data: A pointer to a XPM data structure as found in XPM files.
*
* Sets a new image for an existing #GimpPixmap widget.
*
*/
void
gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data)
{
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GIMP_IS_PIXMAP (pixmap));
pixmap->xpm_data = xpm_data;
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
GTK_WIDGET (pixmap)->requisition.width = 0;
GTK_WIDGET (pixmap)->requisition.height = 0;
if (! GTK_WIDGET_REALIZED (GTK_WIDGET (pixmap)))
{
g_warning ("passed pointer is no XPM data");
if (xpm_data)
{
gint width, height;
if (sscanf (xpm_data[0], "%d %d", &width, &height) != 2)
{
g_warning ("passed pointer is no XPM data");
}
else
{
GTK_WIDGET (pixmap)->requisition.width =
width + GTK_MISC (pixmap)->xpad * 2;
GTK_WIDGET (pixmap)->requisition.height =
height + GTK_MISC (pixmap)->ypad * 2;
}
}
}
else
{
GTK_WIDGET (pixmap)->requisition.width =
width + GTK_MISC (pixmap)->xpad * 2;
GTK_WIDGET (pixmap)->requisition.height =
height + GTK_MISC (pixmap)->ypad * 2;
gimp_pixmap_create_from_xpm_d (pixmap);
}
return GTK_WIDGET (pixmap);
}
static void
gimp_pixmap_realize (GtkWidget *widget)
{
GimpPixmap *pixmap;
if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
gimp_pixmap_create_from_xpm_d (GIMP_PIXMAP (widget));
}
static void
gimp_pixmap_create_from_xpm_d (GimpPixmap *pixmap)
{
GtkStyle *style;
GdkPixmap *gdk_pixmap;
GdkBitmap *mask;
GdkPixmap *gdk_pixmap = NULL;
GdkBitmap *mask = NULL;
pixmap = GIMP_PIXMAP (widget);
if (pixmap->xpm_data)
{
GtkWidget *widget;
if (GTK_WIDGET_CLASS (parent_class)->realize)
(* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
widget = GTK_WIDGET (pixmap);
style = gtk_widget_get_style (widget);
style = gtk_widget_get_style (widget);
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
&mask,
&style->bg[GTK_STATE_NORMAL],
pixmap->xpm_data);
gdk_pixmap = gdk_pixmap_create_from_xpm_d (widget->window,
&mask,
&style->bg[GTK_STATE_NORMAL],
pixmap->xpm_data);
}
GTK_PIXMAP (pixmap)->build_insensitive = TRUE;
gtk_pixmap_set (GTK_PIXMAP (pixmap), gdk_pixmap, mask);
gdk_pixmap_unref (gdk_pixmap);
gdk_bitmap_unref (mask);
if (gdk_pixmap)
gdk_pixmap_unref (gdk_pixmap);
if (mask)
gdk_bitmap_unref (mask);
}
......@@ -43,7 +43,10 @@ struct _GimpPixmapClass
};
GtkType gimp_pixmap_get_type (void);
GtkWidget * gimp_pixmap_new (gchar **xpm_data);
GtkWidget * gimp_pixmap_new (gchar **xpm_data);
void gimp_pixmap_set (GimpPixmap *pixmap,
gchar **xpm_data);
#ifdef __cplusplus
}
......
......@@ -151,15 +151,10 @@ static void fractalexplorer_free_everything (fractalexplorerOBJ *feOBJ)
static void fractalexplorer_list_free_all (void);
static fractalexplorerOBJ * fractalexplorer_load (gchar *filename,
gchar *name);
static void fractalexplorer_rescan_file_selection_ok (GtkWidget *widget,
GtkFileSelection *fs,
gpointer data);
static void fractalexplorer_list_load_all (GList *plist);
static void fractalexplorer_rescan_ok_callback (GtkWidget *widget,
gpointer data);
static void fractalexplorer_rescan_add_entry_callback (GtkWidget *widget,
gpointer data);
gpointer data);
static void fractalexplorer_rescan_list (void);
......@@ -654,29 +649,31 @@ delete_dialog_callback (GtkWidget *widget,
gboolean delete,
gpointer data)
{
gint pos;
GList * sellist;
fractalexplorerOBJ * sel_obj;
GtkWidget *list = (GtkWidget *)data;
gint pos;
GList *sellist;
fractalexplorerOBJ *sel_obj;
GtkWidget *list = (GtkWidget *) data;
if (delete)
{
/* Must update which object we are editing */
/* Get the list and which item is selected */
/* Only allow single selections */
sellist = GTK_LIST(list)->selection;
g_print ("list: %i\n", g_list_length (sellist));
sel_obj = (fractalexplorerOBJ *)gtk_object_get_user_data(GTK_OBJECT((GtkWidget *)(sellist->data)));
pos = gtk_list_child_position(GTK_LIST(fractalexplorer_gtk_list),sellist->data);
/* g_print ("list: %i\n", g_list_length (sellist)); */
sel_obj = (fractalexplorerOBJ *)
gtk_object_get_user_data (GTK_OBJECT(sellist->data));
pos = gtk_list_child_position (GTK_LIST (fractalexplorer_gtk_list),
sellist->data);
/* Delete the current item + asssociated file */
gtk_list_clear_items(GTK_LIST (fractalexplorer_gtk_list),pos,pos+1);
gtk_list_clear_items (GTK_LIST (fractalexplorer_gtk_list), pos, pos + 1);
/* Shadow copy for ordering info */
fractalexplorer_list = g_list_remove(fractalexplorer_list,sel_obj);
fractalexplorer_list = g_list_remove (fractalexplorer_list, sel_obj);
/*
if(sel_obj == current_obj)
{
......@@ -684,14 +681,15 @@ delete_dialog_callback (GtkWidget *widget,
}
*/
/* Free current obj */
fractalexplorer_free_everything(sel_obj);
fractalexplorer_free_everything (sel_obj);
/* Select previous one */
if (pos > 0)
pos--;
if((pos == 0) && (g_list_length(fractalexplorer_list) == 0))
{
if ((pos == 0) && (g_list_length (fractalexplorer_list) == 0))
{
/*gtk_widget_sed_sensitive ();*/
/* Warning - we have a problem here
* since we are not really "creating an entry"
* why call fractalexplorer_new?
......@@ -699,19 +697,19 @@ delete_dialog_callback (GtkWidget *widget,
new_button_press(NULL,NULL,NULL);
}
gtk_list_select_item(GTK_LIST(fractalexplorer_gtk_list), pos);
gtk_widget_set_sensitive (delete_frame_to_freeze, TRUE);
current_obj = g_list_nth_data(fractalexplorer_list,pos);
gtk_list_select_item (GTK_LIST (fractalexplorer_gtk_list), pos);
current_obj = g_list_nth_data (fractalexplorer_list, pos);
/*
draw xxxxxxxxxxxxxxxx
update_draw_area(fractalexplorer_preview,NULL);
*/
list_button_update(current_obj);
}
gtk_widget_set_sensitive (delete_frame_to_freeze, TRUE);
else
{
gtk_widget_set_sensitive (delete_frame_to_freeze, TRUE);
}
delete_dialog = NULL;
return;
......@@ -1205,7 +1203,8 @@ plug_in_parse_fractalexplorer_path (void)
}
else
{
g_message (_("fractalexplorer-path miss-configured - \nPath `%.100s' not found\n"), path);
g_message (_("fractalexplorer-path misconfigured\nPath "
"\"%s\" not found."), path);
g_free (path);
}
token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S);
......@@ -1308,38 +1307,6 @@ fractalexplorer_load (gchar *filename,
return fractalexplorer;
}
static void
fractalexplorer_rescan_file_selection_ok (GtkWidget *widget,
GtkFileSelection *fs,
gpointer data)
{
GtkWidget *list_item;
GtkWidget *lw = (GtkWidget *) gtk_object_get_user_data (GTK_OBJECT (fs));
gchar * filenamebuf;
struct stat filestat;
gint err;
filenamebuf = gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs));
err = stat(filenamebuf, &filestat);
if (!S_ISDIR (filestat.st_mode))
{
g_warning("Entry %.100s is not a directory\n", filenamebuf);
}
else
{
list_item = gtk_list_item_new_with_label (filenamebuf);
gtk_widget_show (list_item);
gtk_list_prepend_items (GTK_LIST (lw), g_list_append (NULL, list_item));
rescan_list = g_list_prepend (rescan_list, g_strdup (filenamebuf));
}
gtk_widget_destroy (GTK_WIDGET (fs));
}
static void
fractalexplorer_list_load_all (GList *plist)
{
......@@ -1480,147 +1447,103 @@ static void
fractalexplorer_rescan_ok_callback (GtkWidget *widget,
gpointer data)
{
GList *list;
GtkWidget *patheditor;
GList *list;
gchar *raw_path;
gchar **path;
gint i;
list = rescan_list;
while (list)
{
list = list->next;
}
list = fractalexplorer_path_list;
while (list)
{
rescan_list = g_list_append (rescan_list, g_strdup (list->data));
list = list->next;
}
gtk_widget_set_sensitive (GTK_WIDGET (data), FALSE);
gtk_list_clear_items (GTK_LIST (fractalexplorer_gtk_list), 0, -1);
fractalexplorer_list_load_all (rescan_list);
build_list_items (fractalexplorer_gtk_list);
list_button_update (current_obj);
gtk_widget_destroy (GTK_WIDGET (data));
}
for (list = fractalexplorer_path_list; list; list = g_list_next (list))
g_free (list->data);
static void
fractalexplorer_rescan_add_entry_callback (GtkWidget *widget,
gpointer data)
{
static GtkWidget *window = NULL;
g_list_free (fractalexplorer_path_list);
fractalexplorer_path_list = NULL;
/* Call up the file sel dialogue */
window = gtk_file_selection_new (_("Add FractalExplorer path"));
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
gtk_object_set_user_data (GTK_OBJECT (window), data);
patheditor = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (data),
"patheditor"));
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&window);
raw_path = gimp_path_editor_get_path (GIMP_PATH_EDITOR (patheditor));
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (window)->ok_button),
"clicked",
GTK_SIGNAL_FUNC (fractalexplorer_rescan_file_selection_ok),
window);
path = g_strsplit (raw_path, ":", 16);
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (window)->cancel_button),
"clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (window));
for (i = 0; i < 16; i++)
{
if (!path[i])
break;
fractalexplorer_path_list = g_list_append (fractalexplorer_path_list,
g_strdup (path[i]));
}
g_strfreev (path);
if (fractalexplorer_path_list)
{
gtk_list_clear_items (GTK_LIST (fractalexplorer_gtk_list), 0, -1);
fractalexplorer_list_load_all (fractalexplorer_path_list);
build_list_items (fractalexplorer_gtk_list);
list_button_update (current_obj);
}
gtk_widget_show (window);
gtk_widget_destroy (GTK_WIDGET (data));
}