Commit 35b21c63 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

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.
parent fb3dcfc9
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> 2005-11-19 Michael Natterer <mitch@gimp.org>
* app/tools/gimppaintoptions-gui.c * app/tools/gimppaintoptions-gui.c
......
...@@ -74,9 +74,7 @@ set_default_settings (void) ...@@ -74,9 +74,7 @@ set_default_settings (void)
mapvals.cylinder_radius = 0.25; mapvals.cylinder_radius = 0.25;
mapvals.cylinder_length = 1.0; mapvals.cylinder_length = 1.0;
mapvals.zoom_model = gimp_zoom_model_new (); mapvals.zoom = 1.0;
gimp_zoom_model_set_range (mapvals.zoom_model, 0.25, 1.0);
mapvals.lightsource.type = POINT_LIGHT; mapvals.lightsource.type = POINT_LIGHT;
mapvals.antialiasing = TRUE; mapvals.antialiasing = TRUE;
......
...@@ -63,8 +63,7 @@ typedef struct ...@@ -63,8 +63,7 @@ typedef struct
gint showgrid; gint showgrid;
gint showcaps; gint showcaps;
GimpZoomModel *zoom_model; gdouble zoom;
gdouble alpha,beta,gamma; gdouble alpha,beta,gamma;
gdouble maxdepth; gdouble maxdepth;
gdouble pixeltreshold; gdouble pixeltreshold;
......
...@@ -396,10 +396,9 @@ update_light (gint xpos, ...@@ -396,10 +396,9 @@ update_light (gint xpos,
gint ypos) gint ypos)
{ {
gint startx, starty, pw, ph; gint startx, starty, pw, ph;
gdouble zoom = gimp_zoom_model_get_factor (mapvals.zoom_model);
pw = PREVIEW_WIDTH * zoom; pw = PREVIEW_WIDTH * mapvals.zoom;
ph = PREVIEW_HEIGHT * zoom; ph = PREVIEW_HEIGHT * mapvals.zoom;
startx = (PREVIEW_WIDTH - pw) / 2; startx = (PREVIEW_WIDTH - pw) / 2;
starty = (PREVIEW_HEIGHT - ph) / 2; starty = (PREVIEW_HEIGHT - ph) / 2;
...@@ -416,7 +415,6 @@ void ...@@ -416,7 +415,6 @@ void
draw_preview_image (gint docompute) draw_preview_image (gint docompute)
{ {
gint startx, starty, pw, ph; gint startx, starty, pw, ph;
gdouble zoom;
GdkColor color; GdkColor color;
color.red = 0x0; color.red = 0x0;
...@@ -432,10 +430,8 @@ draw_preview_image (gint docompute) ...@@ -432,10 +430,8 @@ draw_preview_image (gint docompute)
gdk_gc_set_function (gc, GDK_COPY); gdk_gc_set_function (gc, GDK_COPY);
linetab[0].x1 = -1; linetab[0].x1 = -1;
zoom = gimp_zoom_model_get_factor (mapvals.zoom_model); pw = PREVIEW_WIDTH * mapvals.zoom;
ph = PREVIEW_HEIGHT * mapvals.zoom;
pw = PREVIEW_WIDTH * zoom;
ph = PREVIEW_HEIGHT * zoom;
startx = (PREVIEW_WIDTH - pw) / 2; startx = (PREVIEW_WIDTH - pw) / 2;
starty = (PREVIEW_HEIGHT - ph) / 2; starty = (PREVIEW_HEIGHT - ph) / 2;
...@@ -475,8 +471,7 @@ draw_preview_image (gint docompute) ...@@ -475,8 +471,7 @@ draw_preview_image (gint docompute)
void void
draw_preview_wireframe (void) draw_preview_wireframe (void)
{ {
gint startx, starty, pw, ph; gint startx, starty, pw, ph;
gdouble zoom;
GdkColor color; GdkColor color;
color.red = 0x0; color.red = 0x0;
...@@ -491,10 +486,8 @@ draw_preview_wireframe (void) ...@@ -491,10 +486,8 @@ draw_preview_wireframe (void)
gdk_gc_set_function (gc, GDK_INVERT); gdk_gc_set_function (gc, GDK_INVERT);
zoom = gimp_zoom_model_get_factor (mapvals.zoom_model); pw = PREVIEW_WIDTH * mapvals.zoom;
ph = PREVIEW_HEIGHT * mapvals.zoom;
pw = PREVIEW_WIDTH * zoom;
ph = PREVIEW_HEIGHT * zoom;
startx = (PREVIEW_WIDTH - pw) / 2; startx = (PREVIEW_WIDTH - pw) / 2;
starty = (PREVIEW_HEIGHT - ph) / 2; starty = (PREVIEW_HEIGHT - ph) / 2;
......
...@@ -300,10 +300,13 @@ preview_callback (GtkWidget *widget, ...@@ -300,10 +300,13 @@ preview_callback (GtkWidget *widget,
} }
static void static void
zoom_notify_callback (GObject *model) zoomed_callback (GimpZoomModel *model)
{ {
mapvals.zoom = gimp_zoom_model_get_factor (model);
if (linetab[0].x1 != -1) if (linetab[0].x1 != -1)
clear_wireframe (); clear_wireframe ();
draw_preview_image (TRUE); draw_preview_image (TRUE);
} }
...@@ -1330,13 +1333,14 @@ create_main_notebook (GtkWidget *container) ...@@ -1330,13 +1333,14 @@ create_main_notebook (GtkWidget *container)
gboolean gboolean
main_dialog (GimpDrawable *drawable) main_dialog (GimpDrawable *drawable)
{ {
GtkWidget *main_hbox; GtkWidget *main_hbox;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *frame; GtkWidget *frame;
GtkWidget *button; GtkWidget *button;
GtkWidget *toggle; GtkWidget *toggle;
gboolean run = FALSE; GimpZoomModel *model;
gboolean run = FALSE;
gimp_ui_init ("MapObject", FALSE); gimp_ui_init ("MapObject", FALSE);
...@@ -1404,18 +1408,20 @@ main_dialog (GimpDrawable *drawable) ...@@ -1404,18 +1408,20 @@ main_dialog (GimpDrawable *drawable)
gimp_help_set_help_data (button, _("Recompute preview image"), NULL); gimp_help_set_help_data (button, _("Recompute preview image"), NULL);
button = gimp_zoom_button_new (mapvals.zoom_model, model = gimp_zoom_model_new ();
GIMP_ZOOM_IN, GTK_ICON_SIZE_MENU); 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_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button); gtk_widget_show (button);
button = gimp_zoom_button_new (mapvals.zoom_model, button = gimp_zoom_button_new (model, GIMP_ZOOM_OUT, GTK_ICON_SIZE_MENU);
GIMP_ZOOM_OUT, GTK_ICON_SIZE_MENU);
gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0);
gtk_widget_show (button); gtk_widget_show (button);
g_signal_connect (mapvals.zoom_model, "notify::value", g_signal_connect (model, "zoomed",
G_CALLBACK (zoom_notify_callback), G_CALLBACK (zoomed_callback),
NULL); NULL);
toggle = gtk_check_button_new_with_mnemonic (_("Show preview _wireframe")); toggle = gtk_check_button_new_with_mnemonic (_("Show preview _wireframe"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment