plug-ins/MapObject/mapobject_main.[ch]

2005-11-21  Sven Neumann  <sven@gimp.org>

	* plug-ins/MapObject/mapobject_main.[ch]
	* plug-ins/MapObject/mapobject_preview.c
	* plug-ins/MapObject/mapobject_ui.c: must not keep pointers in the
	struct that is being used to preserve data between invocations of
	the plug-in. Fixes bug #321932.
This commit is contained in:
Sven Neumann 2005-11-21 12:00:56 +00:00 committed by Sven Neumann
parent fb3dcfc932
commit 35b21c63c6
5 changed files with 37 additions and 33 deletions

View File

@ -1,3 +1,11 @@
2005-11-21 Sven Neumann <sven@gimp.org>
* plug-ins/MapObject/mapobject_main.[ch]
* plug-ins/MapObject/mapobject_preview.c
* plug-ins/MapObject/mapobject_ui.c: must not keep pointers in the
struct that is being used to preserve data between invocations of
the plug-in. Fixes bug #321932.
2005-11-19 Michael Natterer <mitch@gimp.org>
* app/tools/gimppaintoptions-gui.c

View File

@ -74,9 +74,7 @@ set_default_settings (void)
mapvals.cylinder_radius = 0.25;
mapvals.cylinder_length = 1.0;
mapvals.zoom_model = gimp_zoom_model_new ();
gimp_zoom_model_set_range (mapvals.zoom_model, 0.25, 1.0);
mapvals.zoom = 1.0;
mapvals.lightsource.type = POINT_LIGHT;
mapvals.antialiasing = TRUE;

View File

@ -63,8 +63,7 @@ typedef struct
gint showgrid;
gint showcaps;
GimpZoomModel *zoom_model;
gdouble zoom;
gdouble alpha,beta,gamma;
gdouble maxdepth;
gdouble pixeltreshold;

View File

@ -396,10 +396,9 @@ update_light (gint xpos,
gint ypos)
{
gint startx, starty, pw, ph;
gdouble zoom = gimp_zoom_model_get_factor (mapvals.zoom_model);
pw = PREVIEW_WIDTH * zoom;
ph = PREVIEW_HEIGHT * zoom;
pw = PREVIEW_WIDTH * mapvals.zoom;
ph = PREVIEW_HEIGHT * mapvals.zoom;
startx = (PREVIEW_WIDTH - pw) / 2;
starty = (PREVIEW_HEIGHT - ph) / 2;
@ -416,7 +415,6 @@ void
draw_preview_image (gint docompute)
{
gint startx, starty, pw, ph;
gdouble zoom;
GdkColor color;
color.red = 0x0;
@ -432,10 +430,8 @@ draw_preview_image (gint docompute)
gdk_gc_set_function (gc, GDK_COPY);
linetab[0].x1 = -1;
zoom = gimp_zoom_model_get_factor (mapvals.zoom_model);
pw = PREVIEW_WIDTH * zoom;
ph = PREVIEW_HEIGHT * zoom;
pw = PREVIEW_WIDTH * mapvals.zoom;
ph = PREVIEW_HEIGHT * mapvals.zoom;
startx = (PREVIEW_WIDTH - pw) / 2;
starty = (PREVIEW_HEIGHT - ph) / 2;
@ -475,8 +471,7 @@ draw_preview_image (gint docompute)
void
draw_preview_wireframe (void)
{
gint startx, starty, pw, ph;
gdouble zoom;
gint startx, starty, pw, ph;
GdkColor color;
color.red = 0x0;
@ -491,10 +486,8 @@ draw_preview_wireframe (void)
gdk_gc_set_function (gc, GDK_INVERT);
zoom = gimp_zoom_model_get_factor (mapvals.zoom_model);
pw = PREVIEW_WIDTH * zoom;
ph = PREVIEW_HEIGHT * zoom;
pw = PREVIEW_WIDTH * mapvals.zoom;
ph = PREVIEW_HEIGHT * mapvals.zoom;
startx = (PREVIEW_WIDTH - pw) / 2;
starty = (PREVIEW_HEIGHT - ph) / 2;

View File

@ -300,10 +300,13 @@ preview_callback (GtkWidget *widget,
}
static void
zoom_notify_callback (GObject *model)
zoomed_callback (GimpZoomModel *model)
{
mapvals.zoom = gimp_zoom_model_get_factor (model);
if (linetab[0].x1 != -1)
clear_wireframe ();
draw_preview_image (TRUE);
}
@ -1330,13 +1333,14 @@ create_main_notebook (GtkWidget *container)
gboolean
main_dialog (GimpDrawable *drawable)
{
GtkWidget *main_hbox;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *button;
GtkWidget *toggle;
gboolean run = FALSE;
GtkWidget *main_hbox;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *button;
GtkWidget *toggle;
GimpZoomModel *model;
gboolean run = FALSE;
gimp_ui_init ("MapObject", FALSE);
@ -1404,18 +1408,20 @@ main_dialog (GimpDrawable *drawable)
gimp_help_set_help_data (button, _("Recompute preview image"), NULL);
button = gimp_zoom_button_new (mapvals.zoom_model,
GIMP_ZOOM_IN, GTK_ICON_SIZE_MENU);
model = gimp_zoom_model_new ();
gimp_zoom_model_set_range (model, 0.25, 1.0);
gimp_zoom_model_zoom (model, GIMP_ZOOM_TO, mapvals.zoom);
button = gimp_zoom_button_new (model, GIMP_ZOOM_IN, GTK_ICON_SIZE_MENU);
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gimp_zoom_button_new (mapvals.zoom_model,
GIMP_ZOOM_OUT, GTK_ICON_SIZE_MENU);
button = gimp_zoom_button_new (model, GIMP_ZOOM_OUT, GTK_ICON_SIZE_MENU);
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
g_signal_connect (mapvals.zoom_model, "notify::value",
G_CALLBACK (zoom_notify_callback),
g_signal_connect (model, "zoomed",
G_CALLBACK (zoomed_callback),
NULL);
toggle = gtk_check_button_new_with_mnemonic (_("Show preview _wireframe"));