mirror of https://github.com/GNOME/gimp.git
gimp_pixmap_new(): set the widget's requisition so it can be properly
2000-02-19 Michael Natterer <mitch@gimp.org> * libgimp/gimppixmap.c: gimp_pixmap_new(): set the widget's requisition so it can be properly packed before it's realized. * libgimp/gimpwidgets.[ch]: added a "text" parameter to gimp_pixmap_button_new(). * app/undo_history.c: use gimp_pixmap_buttons. * app/gradient.c * app/nav_window.c * app/palette.c * libgimp/gimppatheditor.c * plug-ins/Lighting/lighting_ui.c * plug-ins/MapObject/mapobject_ui.c: changed calls to gimp_pixmap_button_new(). * plug-ins/MapObject/mapobject_main.c: INIT_I18N() was missing in query(). * plug-ins/pagecurl/pagecurl.c: use GimpVector2 functions instead of reinventing the wheel. * plug-ins/helpbrowser/helpbrowser.c: use gimp_pixmap_buttons. * plug-ins/helpbrowser/back.xpm * plug-ins/helpbrowser/forward.xpm: cropped.
This commit is contained in:
parent
1b15b15820
commit
5d57b99903
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2000-02-19 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* libgimp/gimppixmap.c: gimp_pixmap_new(): set the widget's
|
||||
requisition so it can be properly packed before it's realized.
|
||||
|
||||
* libgimp/gimpwidgets.[ch]: added a "text" parameter to
|
||||
gimp_pixmap_button_new().
|
||||
|
||||
* app/undo_history.c: use gimp_pixmap_buttons.
|
||||
|
||||
* app/gradient.c
|
||||
* app/nav_window.c
|
||||
* app/palette.c
|
||||
* libgimp/gimppatheditor.c
|
||||
* plug-ins/Lighting/lighting_ui.c
|
||||
* plug-ins/MapObject/mapobject_ui.c: changed calls to
|
||||
gimp_pixmap_button_new().
|
||||
|
||||
* plug-ins/MapObject/mapobject_main.c: INIT_I18N() was missing in
|
||||
query().
|
||||
|
||||
* plug-ins/pagecurl/pagecurl.c: use GimpVector2 functions instead
|
||||
of reinventing the wheel.
|
||||
|
||||
* plug-ins/helpbrowser/helpbrowser.c: use gimp_pixmap_buttons.
|
||||
|
||||
* plug-ins/helpbrowser/back.xpm
|
||||
* plug-ins/helpbrowser/forward.xpm: cropped.
|
||||
|
||||
Sat Feb 19 13:53:34 CET 2000 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/fuzzy_select.c: ignore motion_events in a time-window of
|
||||
|
|
|
@ -1080,7 +1080,7 @@ nav_create_button_area (InfoDialog *info_win)
|
|||
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (navwindow_zoomout),
|
||||
|
@ -1115,7 +1115,7 @@ nav_create_button_area (InfoDialog *info_win)
|
|||
gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (hscale1), FALSE);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (navwindow_zoomin),
|
||||
|
|
|
@ -1080,7 +1080,7 @@ nav_create_button_area (InfoDialog *info_win)
|
|||
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (navwindow_zoomout),
|
||||
|
@ -1115,7 +1115,7 @@ nav_create_button_area (InfoDialog *info_win)
|
|||
gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (hscale1), FALSE);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (navwindow_zoomin),
|
||||
|
|
|
@ -931,7 +931,7 @@ gradient_editor_create (void)
|
|||
/* + and - buttons */
|
||||
gtk_widget_realize (g_editor->shell);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_in_callback),
|
||||
|
@ -939,7 +939,7 @@ gradient_editor_create (void)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_out_callback),
|
||||
|
|
|
@ -931,7 +931,7 @@ gradient_editor_create (void)
|
|||
/* + and - buttons */
|
||||
gtk_widget_realize (g_editor->shell);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_in_callback),
|
||||
|
@ -939,7 +939,7 @@ gradient_editor_create (void)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_out_callback),
|
||||
|
|
|
@ -931,7 +931,7 @@ gradient_editor_create (void)
|
|||
/* + and - buttons */
|
||||
gtk_widget_realize (g_editor->shell);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_in_callback),
|
||||
|
@ -939,7 +939,7 @@ gradient_editor_create (void)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_out_callback),
|
||||
|
|
|
@ -2186,14 +2186,14 @@ palette_dialog_new (gint vert)
|
|||
palette);
|
||||
|
||||
/* + and - buttons */
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_zoomin_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_zoomout_callback),
|
||||
|
|
|
@ -1080,7 +1080,7 @@ nav_create_button_area (InfoDialog *info_win)
|
|||
hbox1 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (navwindow_zoomout),
|
||||
|
@ -1115,7 +1115,7 @@ nav_create_button_area (InfoDialog *info_win)
|
|||
gtk_box_pack_start (GTK_BOX (vbox1), hscale1, TRUE, TRUE, 0);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (hscale1), FALSE);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (navwindow_zoomin),
|
||||
|
|
|
@ -2186,14 +2186,14 @@ palette_dialog_new (gint vert)
|
|||
palette);
|
||||
|
||||
/* + and - buttons */
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_zoomin_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_zoomout_callback),
|
||||
|
|
|
@ -130,12 +130,6 @@ typedef struct
|
|||
/**************************************************************/
|
||||
/* Static Data */
|
||||
|
||||
static GdkPixmap *undo_pixmap = NULL;
|
||||
static GdkBitmap *undo_mask = NULL;
|
||||
|
||||
static GdkPixmap *redo_pixmap = NULL;
|
||||
static GdkBitmap *redo_mask = NULL;
|
||||
|
||||
static GdkPixmap *clean_pixmap = NULL;
|
||||
static GdkBitmap *clean_mask = NULL;
|
||||
|
||||
|
@ -725,10 +719,6 @@ undo_history_new (GImage *gimage)
|
|||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *button;
|
||||
GtkWidget *abox;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *pixmapwid;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scrolled_win;
|
||||
|
||||
st = g_new0 (undo_history_st, 1);
|
||||
|
@ -799,16 +789,6 @@ undo_history_new (GImage *gimage)
|
|||
gtk_widget_realize (st->shell);
|
||||
style = gtk_widget_get_style (st->shell);
|
||||
|
||||
undo_pixmap =
|
||||
gdk_pixmap_create_from_xpm_d (st->shell->window,
|
||||
&undo_mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
raise_xpm);
|
||||
redo_pixmap =
|
||||
gdk_pixmap_create_from_xpm_d (st->shell->window,
|
||||
&redo_mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
lower_xpm);
|
||||
clean_pixmap =
|
||||
gdk_pixmap_create_from_xpm_d (st->shell->window,
|
||||
&clean_mask,
|
||||
|
@ -853,56 +833,18 @@ undo_history_new (GImage *gimage)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gtk_button_new ();
|
||||
st->undo_button = button;
|
||||
st->undo_button = button = gimp_pixmap_button_new (raise_xpm, _("Undo"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (undo_history_undo_callback),
|
||||
st);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (button), abox);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_add (GTK_CONTAINER (abox), hbox2);
|
||||
|
||||
pixmapwid = gtk_pixmap_new (undo_pixmap, undo_mask);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), pixmapwid, FALSE, FALSE, 0);
|
||||
gtk_widget_show (pixmapwid);
|
||||
|
||||
label = gtk_label_new (_("Undo"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (hbox2));
|
||||
gtk_widget_show (GTK_WIDGET (abox));
|
||||
gtk_widget_show (GTK_WIDGET (button));
|
||||
|
||||
button = gtk_button_new ();
|
||||
st->redo_button = button;
|
||||
st->redo_button = button = gimp_pixmap_button_new (lower_xpm, _("Redo"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (undo_history_redo_callback),
|
||||
st);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (button), abox);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_add (GTK_CONTAINER (abox), hbox2);
|
||||
|
||||
pixmapwid = gtk_pixmap_new (redo_pixmap, redo_mask);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), pixmapwid, FALSE, FALSE, 0);
|
||||
gtk_widget_show (pixmapwid);
|
||||
|
||||
label = gtk_label_new (_("Redo"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (hbox2));
|
||||
gtk_widget_show (GTK_WIDGET (abox));
|
||||
gtk_widget_show (GTK_WIDGET (button));
|
||||
|
||||
undo_history_set_sensitive (st, GTK_CLIST (st->clist)->rows);
|
||||
|
|
|
@ -931,7 +931,7 @@ gradient_editor_create (void)
|
|||
/* + and - buttons */
|
||||
gtk_widget_realize (g_editor->shell);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_in_callback),
|
||||
|
@ -939,7 +939,7 @@ gradient_editor_create (void)
|
|||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (ed_zoom_out_callback),
|
||||
|
|
|
@ -2186,14 +2186,14 @@ palette_dialog_new (gint vert)
|
|||
palette);
|
||||
|
||||
/* + and - buttons */
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_zoomin_callback),
|
||||
(gpointer) palette);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (palette_dialog_zoomout_callback),
|
||||
|
|
|
@ -97,14 +97,14 @@ gimp_path_editor_init (GimpPathEditor *gpe)
|
|||
gtk_box_pack_start (GTK_BOX (gpe->upper_hbox), button_box, FALSE, TRUE, 0);
|
||||
gtk_widget_show (button_box);
|
||||
|
||||
gpe->new_button = button = gimp_pixmap_button_new (new_xpm);
|
||||
gpe->new_button = button = gimp_pixmap_button_new (new_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_path_editor_new_callback),
|
||||
gpe);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gpe->up_button = button = gimp_pixmap_button_new (raise_xpm);
|
||||
gpe->up_button = button = gimp_pixmap_button_new (raise_xpm, NULL);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
|
@ -112,7 +112,7 @@ gimp_path_editor_init (GimpPathEditor *gpe)
|
|||
gpe);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gpe->down_button = button = gimp_pixmap_button_new (lower_xpm);
|
||||
gpe->down_button = button = gimp_pixmap_button_new (lower_xpm, NULL);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
|
@ -120,7 +120,7 @@ gimp_path_editor_init (GimpPathEditor *gpe)
|
|||
gpe);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gpe->delete_button = button = gimp_pixmap_button_new (delete_xpm);
|
||||
gpe->delete_button = button = gimp_pixmap_button_new (delete_xpm, NULL);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gimppixmap.h"
|
||||
|
||||
struct _GimpPixmap
|
||||
|
@ -67,9 +69,6 @@ gimp_pixmap_init (GimpPixmap *pixmap)
|
|||
GtkPixmap *gtk_pixmap;
|
||||
|
||||
gtk_pixmap = GTK_PIXMAP (pixmap);
|
||||
|
||||
gtk_pixmap->pixmap_insensitive = NULL;
|
||||
gtk_pixmap->build_insensitive = TRUE;
|
||||
}
|
||||
|
||||
GtkType
|
||||
|
@ -110,6 +109,7 @@ GtkWidget *
|
|||
gimp_pixmap_new (gchar **xpm_data)
|
||||
{
|
||||
GimpPixmap *pixmap;
|
||||
gint width, height;
|
||||
|
||||
g_return_val_if_fail (xpm_data != NULL, NULL);
|
||||
|
||||
|
@ -120,6 +120,18 @@ gimp_pixmap_new (gchar **xpm_data)
|
|||
|
||||
pixmap->xpm_data = xpm_data;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return GTK_WIDGET (pixmap);
|
||||
}
|
||||
|
||||
|
@ -143,6 +155,7 @@ gimp_pixmap_realize (GtkWidget *widget)
|
|||
&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);
|
||||
|
|
|
@ -930,21 +930,48 @@ gimp_coordinates_new (GimpUnit unit,
|
|||
/**
|
||||
* gimp_pixmap_button_new:
|
||||
* @xpm_data:
|
||||
* @text:
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
GtkWidget *
|
||||
gimp_pixmap_button_new (gchar **xpm_data)
|
||||
gimp_pixmap_button_new (gchar **xpm_data,
|
||||
gchar *text)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
|
||||
button = gtk_button_new ();
|
||||
|
||||
pixmap = gimp_pixmap_new (xpm_data);
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
if (text)
|
||||
{
|
||||
GtkWidget *abox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (button), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (abox), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
}
|
||||
|
||||
|
||||
return button;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,8 @@ GtkWidget * gimp_coordinates_new (GimpUnit unit,
|
|||
gdouble ysize_0, /* % */
|
||||
gdouble ysize_100 /* % */);
|
||||
|
||||
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data);
|
||||
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data,
|
||||
gchar *text);
|
||||
|
||||
/*
|
||||
* Standard Callbacks
|
||||
|
|
|
@ -97,14 +97,14 @@ gimp_path_editor_init (GimpPathEditor *gpe)
|
|||
gtk_box_pack_start (GTK_BOX (gpe->upper_hbox), button_box, FALSE, TRUE, 0);
|
||||
gtk_widget_show (button_box);
|
||||
|
||||
gpe->new_button = button = gimp_pixmap_button_new (new_xpm);
|
||||
gpe->new_button = button = gimp_pixmap_button_new (new_xpm, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gimp_path_editor_new_callback),
|
||||
gpe);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gpe->up_button = button = gimp_pixmap_button_new (raise_xpm);
|
||||
gpe->up_button = button = gimp_pixmap_button_new (raise_xpm, NULL);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
|
@ -112,7 +112,7 @@ gimp_path_editor_init (GimpPathEditor *gpe)
|
|||
gpe);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gpe->down_button = button = gimp_pixmap_button_new (lower_xpm);
|
||||
gpe->down_button = button = gimp_pixmap_button_new (lower_xpm, NULL);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
|
@ -120,7 +120,7 @@ gimp_path_editor_init (GimpPathEditor *gpe)
|
|||
gpe);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gpe->delete_button = button = gimp_pixmap_button_new (delete_xpm);
|
||||
gpe->delete_button = button = gimp_pixmap_button_new (delete_xpm, NULL);
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (button_box), button, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "gimppixmap.h"
|
||||
|
||||
struct _GimpPixmap
|
||||
|
@ -67,9 +69,6 @@ gimp_pixmap_init (GimpPixmap *pixmap)
|
|||
GtkPixmap *gtk_pixmap;
|
||||
|
||||
gtk_pixmap = GTK_PIXMAP (pixmap);
|
||||
|
||||
gtk_pixmap->pixmap_insensitive = NULL;
|
||||
gtk_pixmap->build_insensitive = TRUE;
|
||||
}
|
||||
|
||||
GtkType
|
||||
|
@ -110,6 +109,7 @@ GtkWidget *
|
|||
gimp_pixmap_new (gchar **xpm_data)
|
||||
{
|
||||
GimpPixmap *pixmap;
|
||||
gint width, height;
|
||||
|
||||
g_return_val_if_fail (xpm_data != NULL, NULL);
|
||||
|
||||
|
@ -120,6 +120,18 @@ gimp_pixmap_new (gchar **xpm_data)
|
|||
|
||||
pixmap->xpm_data = xpm_data;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return GTK_WIDGET (pixmap);
|
||||
}
|
||||
|
||||
|
@ -143,6 +155,7 @@ gimp_pixmap_realize (GtkWidget *widget)
|
|||
&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);
|
||||
|
|
|
@ -930,21 +930,48 @@ gimp_coordinates_new (GimpUnit unit,
|
|||
/**
|
||||
* gimp_pixmap_button_new:
|
||||
* @xpm_data:
|
||||
* @text:
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
*/
|
||||
GtkWidget *
|
||||
gimp_pixmap_button_new (gchar **xpm_data)
|
||||
gimp_pixmap_button_new (gchar **xpm_data,
|
||||
gchar *text)
|
||||
{
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
|
||||
button = gtk_button_new ();
|
||||
|
||||
pixmap = gimp_pixmap_new (xpm_data);
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
if (text)
|
||||
{
|
||||
GtkWidget *abox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
|
||||
abox = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_container_add (GTK_CONTAINER (button), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (abox), hbox);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), pixmap, FALSE, FALSE, 4);
|
||||
gtk_widget_show (pixmap);
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 4);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
gtk_widget_show (pixmap);
|
||||
}
|
||||
|
||||
|
||||
return button;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,8 @@ GtkWidget * gimp_coordinates_new (GimpUnit unit,
|
|||
gdouble ysize_0, /* % */
|
||||
gdouble ysize_100 /* % */);
|
||||
|
||||
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data);
|
||||
GtkWidget * gimp_pixmap_button_new (gchar **xpm_data,
|
||||
gchar *text);
|
||||
|
||||
/*
|
||||
* Standard Callbacks
|
||||
|
|
|
@ -1136,7 +1136,7 @@ main_dialog (GDrawable *drawable)
|
|||
|
||||
gimp_help_set_help_data (button, _("Recompute preview image"), NULL);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (zoomout_callback),
|
||||
|
@ -1145,7 +1145,7 @@ main_dialog (GDrawable *drawable)
|
|||
|
||||
gimp_help_set_help_data (button, _("Zoom out (make image smaller)"), NULL);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (zoomin_callback),
|
||||
|
|
|
@ -194,6 +194,8 @@ query (void)
|
|||
};
|
||||
static gint nargs = sizeof (args) / sizeof (args[0]);
|
||||
|
||||
INIT_I18N();
|
||||
|
||||
gimp_install_procedure ("plug_in_map_object",
|
||||
"Maps a picture to a object (plane, sphere, box or cylinder)",
|
||||
"No help yet",
|
||||
|
|
|
@ -1440,7 +1440,7 @@ main_dialog (GDrawable *drawable)
|
|||
|
||||
gimp_help_set_help_data (button, _("Recompute preview image"), NULL);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_out_xpm, NULL);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (zoomout_callback),
|
||||
|
@ -1449,7 +1449,7 @@ main_dialog (GDrawable *drawable)
|
|||
|
||||
gimp_help_set_help_data (button, _("Zoom out (make image smaller)"), NULL);
|
||||
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm);
|
||||
button = gimp_pixmap_button_new (zoom_in_xpm, NULL);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (zoomin_callback),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XPM */
|
||||
static char * back_xpm[] = {
|
||||
"20 20 42 1",
|
||||
"14 14 42 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #C6D7C3",
|
||||
|
@ -43,23 +43,17 @@ static char * back_xpm[] = {
|
|||
"a c #6FA763",
|
||||
"b c #5B8851",
|
||||
"c c #36582E",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .. ",
|
||||
" ..+. ",
|
||||
" ..@#+. ",
|
||||
" ..$#%%+. ",
|
||||
" ..&#*=-;+. ",
|
||||
" .>,#'))===+. ",
|
||||
" ..!#~{,@)===+] ",
|
||||
" ..^/(_:<[}[}|. ",
|
||||
" ..1234_5}[|. ",
|
||||
" ..^26<_}|. ",
|
||||
" ..728_9. ",
|
||||
" ..0ab. ",
|
||||
" ..c. ",
|
||||
" .. ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
" ..",
|
||||
" ..+.",
|
||||
" ..@#+.",
|
||||
" ..$#%%+.",
|
||||
" ..&#*=-;+.",
|
||||
" .>,#'))===+.",
|
||||
"..!#~{,@)===+]",
|
||||
"..^/(_:<[}[}|.",
|
||||
" ..1234_5}[|.",
|
||||
" ..^26<_}|.",
|
||||
" ..728_9.",
|
||||
" ..0ab.",
|
||||
" ..c.",
|
||||
" .."};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* XPM */
|
||||
static char * forward_xpm[] = {
|
||||
"20 20 49 1",
|
||||
"14 14 49 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #E1EADF",
|
||||
|
@ -50,23 +50,17 @@ static char * forward_xpm[] = {
|
|||
"h c #5D8554",
|
||||
"i c #37592F",
|
||||
"j c #3F6534",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .. ",
|
||||
" .+.. ",
|
||||
" .@#$.. ",
|
||||
" .@%&#*.. ",
|
||||
" .@=-;>-,.. ",
|
||||
" .@;;;>>'#)!. ",
|
||||
" ~@;;;>{]^]/(.. ",
|
||||
" ._:<:<[}|123.. ",
|
||||
" .4567|890a.. ",
|
||||
" .46b[c0d.. ",
|
||||
" .ebf0g.. ",
|
||||
" .<hi.. ",
|
||||
" .j.. ",
|
||||
" .. ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
".. ",
|
||||
".+.. ",
|
||||
".@#$.. ",
|
||||
".@%&#*.. ",
|
||||
".@=-;>-,.. ",
|
||||
".@;;;>>'#)!. ",
|
||||
"~@;;;>{]^]/(..",
|
||||
"._:<:<[}|123..",
|
||||
".4567|890a.. ",
|
||||
".46b[c0d.. ",
|
||||
".ebf0g.. ",
|
||||
".<hi.. ",
|
||||
".j.. ",
|
||||
".. "};
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
#include "queue.h"
|
||||
|
||||
/* pixmaps */
|
||||
#include "back.xpm"
|
||||
#include "forward.xpm"
|
||||
#include "back.xpm"
|
||||
|
||||
/* defines */
|
||||
|
||||
|
@ -527,45 +527,6 @@ xmhtml_activate (GtkWidget *html,
|
|||
}
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
pixmap_button_new (gchar **xpm,
|
||||
gchar *text,
|
||||
GtkWidget *parent)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmapwid;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
|
||||
gtk_widget_realize (parent);
|
||||
style = gtk_widget_get_style (parent);
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (parent->window,
|
||||
&mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
xpm);
|
||||
pixmapwid = gtk_pixmap_new (pixmap, mask);
|
||||
|
||||
box = gtk_hbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), pixmapwid, FALSE, FALSE, 0);
|
||||
gtk_widget_show (pixmapwid);
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
gtk_widget_show (box);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (button), 0);
|
||||
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (button), box);
|
||||
|
||||
return (button);
|
||||
}
|
||||
|
||||
static void
|
||||
notebook_switch_callback (GtkNotebook *notebook,
|
||||
GtkNotebookPage *page,
|
||||
|
@ -803,7 +764,8 @@ open_browser_dialog (gchar *locale,
|
|||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
|
||||
|
||||
back_button = pixmap_button_new (back_xpm, _("Back"), window);
|
||||
back_button = gimp_pixmap_button_new (back_xpm, _("Back"));
|
||||
gtk_button_set_relief (GTK_BUTTON (back_button), GTK_RELIEF_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), back_button);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (back_button), FALSE);
|
||||
gtk_signal_connect (GTK_OBJECT (back_button), "clicked",
|
||||
|
@ -811,7 +773,8 @@ open_browser_dialog (gchar *locale,
|
|||
NULL);
|
||||
gtk_widget_show (back_button);
|
||||
|
||||
forward_button = pixmap_button_new (forward_xpm, _("Forward"), window);
|
||||
forward_button = gimp_pixmap_button_new (forward_xpm, _("Forward"));
|
||||
gtk_button_set_relief (GTK_BUTTON (forward_button), GTK_RELIEF_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), forward_button);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (forward_button), FALSE);
|
||||
gtk_signal_connect (GTK_OBJECT (forward_button), "clicked",
|
||||
|
|
|
@ -76,11 +76,6 @@
|
|||
|
||||
/***** Types *****/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gdouble x, y;
|
||||
} vector_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint do_curl_shade;
|
||||
|
@ -110,30 +105,27 @@ static void run (gchar *name,
|
|||
|
||||
static void set_default_params (void);
|
||||
|
||||
static void dialog_ok_callback (GtkWidget *, gpointer);
|
||||
static void dialog_toggle_update (GtkWidget *, gint);
|
||||
static void dialog_scale_update (GtkAdjustment *, double *);
|
||||
static void dialog_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void dialog_toggle_update (GtkWidget *widget,
|
||||
gint32 value);
|
||||
static void dialog_scale_update (GtkAdjustment *adjustment,
|
||||
gdouble *value);
|
||||
|
||||
static int do_dialog (void);
|
||||
static gint do_dialog (void);
|
||||
|
||||
static void v_set (vector_t * v, double x, double y);
|
||||
static void v_add (vector_t * v, vector_t a, vector_t b);
|
||||
static void v_sub (vector_t * v, vector_t a, vector_t b);
|
||||
static double v_mag (vector_t v);
|
||||
static double v_dot (vector_t a, vector_t b);
|
||||
static void init_calculation (void);
|
||||
|
||||
static void init_calculation (void);
|
||||
static gint left_of_diagl (gdouble x, gdouble y);
|
||||
static gint right_of_diagr (gdouble x, gdouble y);
|
||||
static gint below_diagb (gdouble x, gdouble y);
|
||||
static gint right_of_diagm (gdouble x, gdouble y);
|
||||
static gint inside_circle (gdouble x, gdouble y);
|
||||
|
||||
static int left_of_diagl (double x, double y);
|
||||
static int right_of_diagr (double x, double y);
|
||||
static int below_diagb (double x, double y);
|
||||
static int right_of_diagm (double x, double y);
|
||||
static int inside_circle (double x, double y);
|
||||
|
||||
static void do_curl_effect (void);
|
||||
static void clear_curled_region (void);
|
||||
static void page_curl (void);
|
||||
static guchar *get_samples (GDrawable *drawable);
|
||||
static void do_curl_effect (void);
|
||||
static void clear_curled_region (void);
|
||||
static void page_curl (void);
|
||||
static guchar *get_samples (GDrawable *drawable);
|
||||
|
||||
/***** Variables *****/
|
||||
|
||||
|
@ -149,47 +141,43 @@ static CurlParams curl;
|
|||
|
||||
/* Image parameters */
|
||||
|
||||
gint32 image_id;
|
||||
GDrawable *curl_layer;
|
||||
GDrawable *drawable;
|
||||
GDrawable *layer_mask;
|
||||
static gint32 image_id;
|
||||
static GDrawable *curl_layer;
|
||||
static GDrawable *drawable;
|
||||
|
||||
typedef GdkPixmap *GdkPmP;
|
||||
GdkPmP gdk_curl_pixmaps[8];
|
||||
static GdkPixmap *gdk_curl_pixmaps[8];
|
||||
static GdkBitmap *gdk_curl_masks[8];
|
||||
|
||||
typedef GdkBitmap *GdkBmP;
|
||||
GdkBmP gdk_curl_masks[8];
|
||||
static GtkWidget *curl_pixmap_widget;
|
||||
|
||||
GtkWidget *curl_pixmap_widget;
|
||||
|
||||
gint sel_x1, sel_y1, sel_x2, sel_y2;
|
||||
gint true_sel_width, true_sel_height;
|
||||
gint sel_width, sel_height;
|
||||
gint drawable_position;
|
||||
static gint curl_run = FALSE;
|
||||
gint32 curl_layer_ID;
|
||||
static gint sel_x1, sel_y1, sel_x2, sel_y2;
|
||||
static gint true_sel_width, true_sel_height;
|
||||
static gint sel_width, sel_height;
|
||||
static gint drawable_position;
|
||||
static gint curl_run = FALSE;
|
||||
static gint32 curl_layer_ID;
|
||||
|
||||
/* Center and radius of circle */
|
||||
|
||||
vector_t center;
|
||||
double radius;
|
||||
static GimpVector2 center;
|
||||
static double radius;
|
||||
|
||||
/* Useful points to keep around */
|
||||
|
||||
vector_t left_tangent;
|
||||
vector_t right_tangent;
|
||||
static GimpVector2 left_tangent;
|
||||
static GimpVector2 right_tangent;
|
||||
|
||||
/* Slopes --- these are *not* in the usual geometric sense! */
|
||||
|
||||
double diagl_slope;
|
||||
double diagr_slope;
|
||||
double diagb_slope;
|
||||
double diagm_slope;
|
||||
static gdouble diagl_slope;
|
||||
static gdouble diagr_slope;
|
||||
static gdouble diagb_slope;
|
||||
static gdouble diagm_slope;
|
||||
|
||||
/* User-configured parameters */
|
||||
|
||||
guchar fore_color[3];
|
||||
guchar back_color[3];
|
||||
static guchar fore_color[3];
|
||||
static guchar back_color[3];
|
||||
|
||||
|
||||
/***** Functions *****/
|
||||
|
@ -208,14 +196,14 @@ query (void)
|
|||
{ PARAM_INT32, "edge", "Edge to curl (1-4, clockwise, starting in the lower right edge)" },
|
||||
{ PARAM_INT32, "type", "vertical (0), horizontal (1)" },
|
||||
{ PARAM_INT32, "shade", "Shade the region under the curl (1) or not (0)" },
|
||||
}; /* args */
|
||||
};
|
||||
static gint nargs = sizeof (args) / sizeof (args[0]);
|
||||
|
||||
static GParamDef return_vals[] =
|
||||
{
|
||||
{ PARAM_LAYER, "Curl layer", "The new layer with the curl." }
|
||||
};
|
||||
static int nargs = sizeof (args) / sizeof (args[0]);
|
||||
static int nreturn_vals = sizeof (return_vals) / sizeof (return_vals[0]);
|
||||
static gint nreturn_vals = sizeof (return_vals) / sizeof (return_vals[0]);
|
||||
|
||||
INIT_I18N();
|
||||
|
||||
|
@ -346,49 +334,6 @@ run (gchar *name,
|
|||
values[0].data.d_status = status;
|
||||
}
|
||||
|
||||
/*************************/
|
||||
/* Some Vector-functions */
|
||||
|
||||
static void
|
||||
v_set (vector_t *v,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
v->x = x;
|
||||
v->y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
v_add (vector_t *v,
|
||||
vector_t a,
|
||||
vector_t b)
|
||||
{
|
||||
v->x = a.x + b.x;
|
||||
v->y = a.y + b.y;
|
||||
}
|
||||
|
||||
static void
|
||||
v_sub (vector_t *v,
|
||||
vector_t a,
|
||||
vector_t b)
|
||||
{
|
||||
v->x = a.x - b.x;
|
||||
v->y = a.y - b.y;
|
||||
}
|
||||
|
||||
static double
|
||||
v_mag (vector_t v)
|
||||
{
|
||||
return sqrt (v.x * v.x + v.y * v.y);
|
||||
}
|
||||
|
||||
static double
|
||||
v_dot (vector_t a,
|
||||
vector_t b)
|
||||
{
|
||||
return a.x * b.x + a.y * b.y;
|
||||
}
|
||||
|
||||
/*****************************************************
|
||||
* Functions to locate the current point in the curl.
|
||||
* The following functions assume an curl in the
|
||||
|
@ -411,38 +356,39 @@ v_dot (vector_t a,
|
|||
* +-------------------------+----------------------+
|
||||
*/
|
||||
|
||||
static int
|
||||
left_of_diagl (double x,
|
||||
double y)
|
||||
static gint
|
||||
left_of_diagl (gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
return (x < (sel_width + (y - sel_height) * diagl_slope));
|
||||
}
|
||||
|
||||
static int
|
||||
right_of_diagr (double x,
|
||||
double y)
|
||||
static gint
|
||||
right_of_diagr (gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
return (x > (sel_width + (y - sel_height) * diagr_slope));
|
||||
}
|
||||
|
||||
static int
|
||||
below_diagb (double x,
|
||||
double y)
|
||||
static gint
|
||||
below_diagb (gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
return (y < (right_tangent.y + (x - right_tangent.x) * diagb_slope));
|
||||
}
|
||||
|
||||
static int
|
||||
right_of_diagm (double x,
|
||||
double y)
|
||||
static gint
|
||||
right_of_diagm (gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
return (x > (sel_width + (y - sel_height) * diagm_slope));
|
||||
}
|
||||
|
||||
static int
|
||||
inside_circle (double x, double y)
|
||||
static gint
|
||||
inside_circle (gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
double dx, dy;
|
||||
gdouble dx, dy;
|
||||
|
||||
dx = x - center.x;
|
||||
dy = y - center.y;
|
||||
|
@ -589,8 +535,6 @@ do_dialog (void)
|
|||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
|
||||
gtk_widget_realize (dialog);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, TRUE, TRUE, 0);
|
||||
|
@ -605,7 +549,9 @@ do_dialog (void)
|
|||
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
gtk_widget_realize (dialog);
|
||||
style = gtk_widget_get_style (dialog);
|
||||
|
||||
gdk_curl_pixmaps[0] =
|
||||
gdk_pixmap_create_from_xpm_d (dialog->window,
|
||||
&(gdk_curl_masks[0]),
|
||||
|
@ -695,7 +641,7 @@ do_dialog (void)
|
|||
gtk_widget_show (table);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
frame = gtk_frame_new ( _("Curl Orientation"));
|
||||
frame = gtk_frame_new (_("Curl Orientation"));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
|
@ -790,11 +736,11 @@ do_dialog (void)
|
|||
static void
|
||||
init_calculation (void)
|
||||
{
|
||||
double k;
|
||||
double alpha, beta;
|
||||
double angle;
|
||||
vector_t v1, v2;
|
||||
gint32 *image_layers, nlayers;
|
||||
gdouble k;
|
||||
gdouble alpha, beta;
|
||||
gdouble angle;
|
||||
GimpVector2 v1, v2;
|
||||
gint32 *image_layers, nlayers;
|
||||
|
||||
gimp_layer_add_alpha (drawable->id);
|
||||
|
||||
|
@ -833,23 +779,24 @@ init_calculation (void)
|
|||
alpha = atan ((double) sel_height / sel_width);
|
||||
beta = alpha / 2.0;
|
||||
k = sel_width / ((G_PI + alpha) * sin (beta) + cos (beta));
|
||||
v_set (¢er, k * cos (beta), k * sin (beta));
|
||||
gimp_vector2_set (¢er, k * cos (beta), k * sin (beta));
|
||||
radius = center.y;
|
||||
|
||||
/* left_tangent */
|
||||
|
||||
v_set (&left_tangent, radius * -sin (alpha), radius * cos (alpha));
|
||||
v_add (&left_tangent, left_tangent, center);
|
||||
gimp_vector2_set (&left_tangent, radius * -sin (alpha), radius * cos (alpha));
|
||||
gimp_vector2_add (&left_tangent, &left_tangent, ¢er);
|
||||
|
||||
/* right_tangent */
|
||||
|
||||
v_sub (&v1, left_tangent, center);
|
||||
v_set (&v2, sel_width - center.x, sel_height - center.y);
|
||||
angle = -2.0 * acos (v_dot (v1, v2) / (v_mag (v1) * v_mag (v2)));
|
||||
v_set (&right_tangent,
|
||||
v1.x * cos (angle) + v1.y * -sin (angle),
|
||||
v1.x * sin (angle) + v1.y * cos (angle));
|
||||
v_add (&right_tangent, right_tangent, center);
|
||||
gimp_vector2_sub (&v1, &left_tangent, ¢er);
|
||||
gimp_vector2_set (&v2, sel_width - center.x, sel_height - center.y);
|
||||
angle = -2.0 * acos (gimp_vector2_inner_product (&v1, &v2) /
|
||||
(gimp_vector2_length (&v1) * gimp_vector2_length (&v2)));
|
||||
gimp_vector2_set (&right_tangent,
|
||||
v1.x * cos (angle) + v1.y * -sin (angle),
|
||||
v1.x * sin (angle) + v1.y * cos (angle));
|
||||
gimp_vector2_add (&right_tangent, &right_tangent, ¢er);
|
||||
|
||||
/* Slopes */
|
||||
|
||||
|
@ -867,17 +814,17 @@ init_calculation (void)
|
|||
static void
|
||||
do_curl_effect (void)
|
||||
{
|
||||
gint x, y, color_image;
|
||||
gint x1, y1, k;
|
||||
guint alpha_pos, progress, max_progress;
|
||||
gdouble intensity, alpha, beta;
|
||||
vector_t v, dl, dr;
|
||||
gdouble dl_mag, dr_mag, angle, factor;
|
||||
guchar *pp, *dest, fore_grayval, back_grayval;
|
||||
guchar *gradsamp;
|
||||
GPixelRgn dest_rgn;
|
||||
gpointer pr;
|
||||
guchar *grad_samples = NULL;
|
||||
gint x, y, color_image;
|
||||
gint x1, y1, k;
|
||||
guint alpha_pos, progress, max_progress;
|
||||
gdouble intensity, alpha, beta;
|
||||
GimpVector2 v, dl, dr;
|
||||
gdouble dl_mag, dr_mag, angle, factor;
|
||||
guchar *pp, *dest, fore_grayval, back_grayval;
|
||||
guchar *gradsamp;
|
||||
GPixelRgn dest_rgn;
|
||||
gpointer pr;
|
||||
guchar *grad_samples = NULL;
|
||||
|
||||
color_image = gimp_drawable_is_rgb (drawable->id);
|
||||
curl_layer =
|
||||
|
@ -923,12 +870,14 @@ do_curl_effect (void)
|
|||
0, 0, true_sel_width, true_sel_height, TRUE, TRUE);
|
||||
|
||||
/* Init shade_under */
|
||||
v_set (&dl, -sel_width, -sel_height);
|
||||
dl_mag = v_mag (dl);
|
||||
v_set (&dr, -(sel_width - right_tangent.x), -(sel_height - right_tangent.y));
|
||||
dr_mag = v_mag (dr);
|
||||
alpha = acos (v_dot (dl, dr) / (dl_mag * dr_mag));
|
||||
beta=alpha/2;
|
||||
gimp_vector2_set (&dl, -sel_width, -sel_height);
|
||||
dl_mag = gimp_vector2_length (&dl);
|
||||
gimp_vector2_set (&dr,
|
||||
-(sel_width - right_tangent.x),
|
||||
-(sel_height - right_tangent.y));
|
||||
dr_mag = gimp_vector2_length (&dr);
|
||||
alpha = acos (gimp_vector2_inner_product (&dl, &dr) / (dl_mag * dr_mag));
|
||||
beta=alpha / 2;
|
||||
|
||||
/* Init shade_curl */
|
||||
|
||||
|
@ -985,7 +934,8 @@ do_curl_effect (void)
|
|||
{
|
||||
v.x = -(sel_width - x);
|
||||
v.y = -(sel_height - y);
|
||||
angle = acos (v_dot (v, dl) / (v_mag (v) * dl_mag));
|
||||
angle = acos (gimp_vector2_inner_product (&v, &dl) /
|
||||
(gimp_vector2_length (&v) * dl_mag));
|
||||
|
||||
if (inside_circle (x, y) || below_diagb (x, y))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue