Commit 3d0adbf1 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

removed GimpZoomWidgetType.

2005-09-25  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimpwidgetsenums.[ch]: removed GimpZoomWidgetType.

	* libgimpwidgets/gimpzoommodel.[ch]: removed gimp_zoom_widget_new()
	in favor of gimp_zoom_button_new().

	* libgimp/gimpzoompreview.c: changed accordingly.

	* libgimpwidgets/gimpwidgets.def: updated.

	* plug-ins/MapObject/mapobject_main.[ch]
	* plug-ins/MapObject/mapobject_preview.c
	* plug-ins/MapObject/mapobject_ui.c: use a GimpZoomModel and let
	it create the zoom buttons.

	* plug-ins/MapObject/mapobject_apply.c
	* plug-ins/MapObject/mapobject_image.c
	* plug-ins/MapObject/mapobject_shade.c: include "gimp/gimpui.h".
parent d4776ce0
2005-09-25 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimpwidgetsenums.[ch]: removed GimpZoomWidgetType.
* libgimpwidgets/gimpzoommodel.[ch]: removed gimp_zoom_widget_new()
in favor of gimp_zoom_button_new().
* libgimp/gimpzoompreview.c: changed accordingly.
* libgimpwidgets/gimpwidgets.def: updated.
* plug-ins/MapObject/mapobject_main.[ch]
* plug-ins/MapObject/mapobject_preview.c
* plug-ins/MapObject/mapobject_ui.c: use a GimpZoomModel and let
it create the zoom buttons.
* plug-ins/MapObject/mapobject_apply.c
* plug-ins/MapObject/mapobject_image.c
* plug-ins/MapObject/mapobject_shade.c: include "gimp/gimpui.h".
2005-09-25 Michael Natterer <mitch@gimp.org> 2005-09-25 Michael Natterer <mitch@gimp.org>
* plug-ins/help/Makefile.am (gimp_help_lookup_LDADD): link * plug-ins/help/Makefile.am (gimp_help_lookup_LDADD): link
......
2005-09-25 Sven Neumann <sven@gimp.org>
* libgimpwidgets/libgimpwidgets-sections.txt
* libgimpwidgets/tmpl/gimpstock.sgml
* libgimpwidgets/tmpl/gimpzoommodel.sgml: updated.
2005-09-25 Sven Neumann <sven@gimp.org> 2005-09-25 Sven Neumann <sven@gimp.org>
* libgimpwidgets/libgimpwidgets-sections.txt * libgimpwidgets/libgimpwidgets-sections.txt
......
...@@ -569,8 +569,8 @@ GIMP_STOCK_PASTE_AS_NEW ...@@ -569,8 +569,8 @@ GIMP_STOCK_PASTE_AS_NEW
GIMP_STOCK_PASTE_INTO GIMP_STOCK_PASTE_INTO
GIMP_STOCK_PATH_STROKE GIMP_STOCK_PATH_STROKE
GIMP_STOCK_PLUGIN GIMP_STOCK_PLUGIN
GIMP_STOCK_QMASK_OFF GIMP_STOCK_QUICK_MASK_OFF
GIMP_STOCK_QMASK_ON GIMP_STOCK_QUICK_MASK_ON
GIMP_STOCK_HISTOGRAM GIMP_STOCK_HISTOGRAM
GIMP_STOCK_HISTOGRAM_LINEAR GIMP_STOCK_HISTOGRAM_LINEAR
GIMP_STOCK_HISTOGRAM_LOGARITHMIC GIMP_STOCK_HISTOGRAM_LOGARITHMIC
...@@ -694,6 +694,7 @@ GIMP_STOCK_TOOL_DODGE ...@@ -694,6 +694,7 @@ GIMP_STOCK_TOOL_DODGE
GIMP_STOCK_TOOL_ELLIPSE_SELECT GIMP_STOCK_TOOL_ELLIPSE_SELECT
GIMP_STOCK_TOOL_ERASER GIMP_STOCK_TOOL_ERASER
GIMP_STOCK_TOOL_FLIP GIMP_STOCK_TOOL_FLIP
GIMP_STOCK_TOOL_FOREGROUND_SELECT
GIMP_STOCK_TOOL_FREE_SELECT GIMP_STOCK_TOOL_FREE_SELECT
GIMP_STOCK_TOOL_FUZZY_SELECT GIMP_STOCK_TOOL_FUZZY_SELECT
GIMP_STOCK_TOOL_HUE_SATURATION GIMP_STOCK_TOOL_HUE_SATURATION
...@@ -1018,11 +1019,13 @@ GIMP_SCROLLED_PREVIEW_GET_CLASS ...@@ -1018,11 +1019,13 @@ GIMP_SCROLLED_PREVIEW_GET_CLASS
<FILE>gimpzoommodel</FILE> <FILE>gimpzoommodel</FILE>
<TITLE>GimpZoomModel</TITLE> <TITLE>GimpZoomModel</TITLE>
GimpZoomModel GimpZoomModel
GimpZoomType
gimp_zoom_model_new gimp_zoom_model_new
gimp_zoom_model_set_range gimp_zoom_model_set_range
gimp_zoom_model_zoom
gimp_zoom_model_get_factor gimp_zoom_model_get_factor
gimp_zoom_model_get_fraction gimp_zoom_model_get_fraction
gimp_zoom_widget_new gimp_zoom_button_new
gimp_zoom_model_zoom_step gimp_zoom_model_zoom_step
<SUBSECTION Standard> <SUBSECTION Standard>
GimpZoomModelClass GimpZoomModelClass
...@@ -1033,6 +1036,8 @@ gimp_zoom_model_get_type ...@@ -1033,6 +1036,8 @@ gimp_zoom_model_get_type
GIMP_ZOOM_MODEL_CLASS GIMP_ZOOM_MODEL_CLASS
GIMP_IS_ZOOM_MODEL_CLASS GIMP_IS_ZOOM_MODEL_CLASS
GIMP_ZOOM_MODEL_GET_CLASS GIMP_ZOOM_MODEL_GET_CLASS
GIMP_TYPE_ZOOM_TYPE
gimp_zoom_type_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
......
...@@ -156,16 +156,16 @@ RTL variant ...@@ -156,16 +156,16 @@ RTL variant
<!-- ##### MACRO GIMP_STOCK_QMASK_OFF ##### --> <!-- ##### MACRO GIMP_STOCK_QUICK_MASK_OFF ##### -->
<para xml:base="../../gimpstock.xml"> <para xml:base="../../gimpstock.xml">
<inlinegraphic fileref="stock-qmask-off-16.png" format="png"></inlinegraphic> <inlinegraphic fileref="stock-quick-mask-off-16.png" format="png"></inlinegraphic>
</para> </para>
<!-- ##### MACRO GIMP_STOCK_QMASK_ON ##### --> <!-- ##### MACRO GIMP_STOCK_QUICK_MASK_ON ##### -->
<para xml:base="../../gimpstock.xml"> <para xml:base="../../gimpstock.xml">
<inlinegraphic fileref="stock-qmask-on-16.png" format="png"></inlinegraphic> <inlinegraphic fileref="stock-quick-mask-on-16.png" format="png"></inlinegraphic>
</para> </para>
...@@ -1102,6 +1102,14 @@ RTL variant ...@@ -1102,6 +1102,14 @@ RTL variant
<!-- ##### MACRO GIMP_STOCK_TOOL_FOREGROUND_SELECT ##### -->
<para xml:base="../../gimpstock.xml">
<inlinegraphic fileref="stock-tool-foreground-select-22.png" format="png"></inlinegraphic>
<inlinegraphic fileref="stock-tool-foreground-select-16.png" format="png"></inlinegraphic>
</para>
<!-- ##### MACRO GIMP_STOCK_TOOL_FREE_SELECT ##### --> <!-- ##### MACRO GIMP_STOCK_TOOL_FREE_SELECT ##### -->
<para xml:base="../../gimpstock.xml"> <para xml:base="../../gimpstock.xml">
<inlinegraphic fileref="stock-tool-free-select-22.png" format="png"></inlinegraphic> <inlinegraphic fileref="stock-tool-free-select-22.png" format="png"></inlinegraphic>
......
...@@ -48,6 +48,19 @@ GimpZoomModel ...@@ -48,6 +48,19 @@ GimpZoomModel
</para> </para>
<!-- ##### ENUM GimpZoomType ##### -->
<para>
</para>
@GIMP_ZOOM_IN:
@GIMP_ZOOM_OUT:
@GIMP_ZOOM_IN_MORE:
@GIMP_ZOOM_OUT_MORE:
@GIMP_ZOOM_IN_MAX:
@GIMP_ZOOM_OUT_MAX:
@GIMP_ZOOM_TO:
<!-- ##### FUNCTION gimp_zoom_model_new ##### --> <!-- ##### FUNCTION gimp_zoom_model_new ##### -->
<para> <para>
...@@ -66,6 +79,16 @@ GimpZoomModel ...@@ -66,6 +79,16 @@ GimpZoomModel
@max: @max:
<!-- ##### FUNCTION gimp_zoom_model_zoom ##### -->
<para>
</para>
@model:
@zoom_type:
@scale:
<!-- ##### FUNCTION gimp_zoom_model_get_factor ##### --> <!-- ##### FUNCTION gimp_zoom_model_get_factor ##### -->
<para> <para>
...@@ -80,18 +103,19 @@ GimpZoomModel ...@@ -80,18 +103,19 @@ GimpZoomModel
</para> </para>
@zoom_factor: @model:
@numerator: @numerator:
@denominator: @denominator:
<!-- ##### FUNCTION gimp_zoom_widget_new ##### --> <!-- ##### FUNCTION gimp_zoom_button_new ##### -->
<para> <para>
</para> </para>
@model: @model:
@type: @zoom_type:
@icon_size:
@Returns: @Returns:
......
...@@ -108,15 +108,15 @@ gimp_zoom_preview_init (GimpZoomPreview *preview) ...@@ -108,15 +108,15 @@ gimp_zoom_preview_init (GimpZoomPreview *preview)
gtk_widget_show (button_bar); gtk_widget_show (button_bar);
/* zoom out */ /* zoom out */
button = gimp_zoom_widget_new (priv->zoom, GIMP_ZOOM_OUT_BUTTON); button = gimp_zoom_button_new (priv->zoom,
gtk_box_pack_start (GTK_BOX (button_bar), button, GIMP_ZOOM_OUT, GTK_ICON_SIZE_SMALL_TOOLBAR);
FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (button_bar), button, FALSE, FALSE, 0);
gtk_widget_show (button); gtk_widget_show (button);
/* zoom in */ /* zoom in */
button = gimp_zoom_widget_new (priv->zoom, GIMP_ZOOM_IN_BUTTON); button = gimp_zoom_button_new (priv->zoom,
gtk_box_pack_start (GTK_BOX (button_bar), button, GIMP_ZOOM_IN, GTK_ICON_SIZE_SMALL_TOOLBAR);
FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (button_bar), button, FALSE, FALSE, 0);
gtk_widget_show (button); gtk_widget_show (button);
/* label */ /* label */
......
...@@ -328,6 +328,7 @@ EXPORTS ...@@ -328,6 +328,7 @@ EXPORTS
gimp_unit_menu_set_unit gimp_unit_menu_set_unit
gimp_unit_menu_update gimp_unit_menu_update
gimp_widgets_init gimp_widgets_init
gimp_zoom_button_new
gimp_zoom_model_get_factor gimp_zoom_model_get_factor
gimp_zoom_model_get_fraction gimp_zoom_model_get_fraction
gimp_zoom_model_get_type gimp_zoom_model_get_type
...@@ -335,6 +336,5 @@ EXPORTS ...@@ -335,6 +336,5 @@ EXPORTS
gimp_zoom_model_set_range gimp_zoom_model_set_range
gimp_zoom_model_zoom gimp_zoom_model_zoom
gimp_zoom_model_zoom_step gimp_zoom_model_zoom_step
gimp_zoom_widget_new
gimp_zoom_type_get_type gimp_zoom_type_get_type
...@@ -171,35 +171,6 @@ gimp_size_entry_update_policy_get_type (void) ...@@ -171,35 +171,6 @@ gimp_size_entry_update_policy_get_type (void)
return type; return type;
} }
GType
gimp_zoom_widget_type_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_ZOOM_IN_BUTTON, "GIMP_ZOOM_IN_BUTTON", "in-button" },
{ GIMP_ZOOM_OUT_BUTTON, "GIMP_ZOOM_OUT_BUTTON", "out-button" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_ZOOM_IN_BUTTON, "GIMP_ZOOM_IN_BUTTON", NULL },
{ GIMP_ZOOM_OUT_BUTTON, "GIMP_ZOOM_OUT_BUTTON", NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (! type)
{
type = g_enum_register_static ("GimpZoomWidgetType", values);
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType GType
gimp_zoom_type_get_type (void) gimp_zoom_type_get_type (void)
{ {
......
...@@ -90,16 +90,6 @@ typedef enum ...@@ -90,16 +90,6 @@ typedef enum
} GimpSizeEntryUpdatePolicy; } GimpSizeEntryUpdatePolicy;
#define GIMP_TYPE_ZOOM_WIDGET_TYPE (gimp_zoom_model_widget_type_get_type ())
GType gimp_zoom_widget_type_get_type (void) G_GNUC_CONST;
typedef enum
{
GIMP_ZOOM_IN_BUTTON,
GIMP_ZOOM_OUT_BUTTON
} GimpZoomWidgetType;
#define GIMP_TYPE_ZOOM_TYPE (gimp_zoom_type_get_type ()) #define GIMP_TYPE_ZOOM_TYPE (gimp_zoom_type_get_type ())
GType gimp_zoom_type_get_type (void) G_GNUC_CONST; GType gimp_zoom_type_get_type (void) G_GNUC_CONST;
......
...@@ -409,58 +409,76 @@ gimp_zoom_model_get_fraction (GimpZoomModel *model, ...@@ -409,58 +409,76 @@ gimp_zoom_model_get_fraction (GimpZoomModel *model,
} }
} }
static GtkWidget *
zoom_button_new (const gchar *stock_id,
GtkIconSize icon_size)
{
GtkWidget *button;
if (icon_size > 0)
{
GtkWidget *image;
button = gtk_button_new ();
image = gtk_image_new_from_stock (stock_id, icon_size);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
}
else
{
button = gtk_button_new_from_stock (stock_id);
}
return button;
}
/** /**
* gimp_zoom_widget_new: * gimp_zoom_button_new:
* @model: a #GimpZoomModel * @model: a #GimpZoomModel
* @type: the type of widget to create * @zoom_type:
* * @icon_size: use 0 for a button with text labels
* Creates a new widget to interact with the #GimpZoomModel.
* *
* Return value: a new #GtkWidget. * Return value: a newly created GtkButton
* *
* Since GIMP 2.4 * Since GIMP 2.4
**/ **/
GtkWidget * GtkWidget *
gimp_zoom_widget_new (GimpZoomModel *model, gimp_zoom_button_new (GimpZoomModel *model,
GimpZoomWidgetType type) GimpZoomType zoom_type,
GtkIconSize icon_size)
{ {
GtkWidget *button; GtkWidget *button = NULL;
GtkWidget *image;
g_return_val_if_fail (GIMP_IS_ZOOM_MODEL (model), NULL); g_return_val_if_fail (GIMP_IS_ZOOM_MODEL (model), NULL);
switch (type) switch (zoom_type)
{ {
case GIMP_ZOOM_IN_BUTTON: case GIMP_ZOOM_IN:
button = gtk_button_new (); button = zoom_button_new (GTK_STOCK_ZOOM_IN, icon_size);
image = gtk_image_new_from_stock (GTK_STOCK_ZOOM_IN,
GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
g_signal_connect_swapped (button, "clicked", g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gimp_zoom_model_zoom_in), G_CALLBACK (gimp_zoom_model_zoom_in),
model); model);
return button; break;
case GIMP_ZOOM_OUT_BUTTON: case GIMP_ZOOM_OUT:
button = gtk_button_new (); button = zoom_button_new (GTK_STOCK_ZOOM_OUT, icon_size);
image = gtk_image_new_from_stock (GTK_STOCK_ZOOM_OUT,
GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_container_add (GTK_CONTAINER (button), image);
gtk_widget_show (image);
g_signal_connect_swapped (button, "clicked", g_signal_connect_swapped (button, "clicked",
G_CALLBACK (gimp_zoom_model_zoom_out), G_CALLBACK (gimp_zoom_model_zoom_out),
model); model);
return button; break;
default:
g_warning ("sorry, no button for this zoom type (%d)", zoom_type);
break;
} }
return NULL; return button;
} }
/** /**
* gimp_zoom_model_zoom_step: * gimp_zoom_model_zoom_step:
* @zoom_type: * @zoom_type:
* @scale: ignored unless @zoom_type == %GIMP_ZOOM_TO * @scale: ignored unless @zoom_type == %GIMP_ZOOM_TO
* *
* Utility function to calculate a new scale factor. * Utility function to calculate a new scale factor.
* *
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpzoommodel.h * gimpzoommodel.h
* Copyright (C) 2005 David Odin <dindinx@gimp.org> * Copyright (C) 2005 David Odin <dindinx@gimp.org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -67,8 +67,9 @@ void gimp_zoom_model_get_fraction (GimpZoomModel *model, ...@@ -67,8 +67,9 @@ void gimp_zoom_model_get_fraction (GimpZoomModel *model,
gint *numerator, gint *numerator,
gint *denominator); gint *denominator);
GtkWidget * gimp_zoom_widget_new (GimpZoomModel *model, GtkWidget * gimp_zoom_button_new (GimpZoomModel *model,
GimpZoomWidgetType type); GimpZoomType zoom_type,
GtkIconSize icon_size);
gdouble gimp_zoom_model_zoom_step (GimpZoomType zoom_type, gdouble gimp_zoom_model_zoom_step (GimpZoomType zoom_type,
gdouble scale); gdouble scale);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "mapobject_main.h" #include "mapobject_main.h"
#include "mapobject_image.h" #include "mapobject_image.h"
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "mapobject_main.h" #include "mapobject_main.h"
#include "mapobject_preview.h" #include "mapobject_preview.h"
......
...@@ -74,7 +74,8 @@ set_default_settings (void) ...@@ -74,7 +74,8 @@ 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.preview_zoom_factor = 0; mapvals.zoom_model = gimp_zoom_model_new ();
gimp_zoom_model_set_range (mapvals.zoom_model, 0.25, 1.0);
mapvals.lightsource.type = POINT_LIGHT; mapvals.lightsource.type = POINT_LIGHT;
......
...@@ -63,7 +63,7 @@ typedef struct ...@@ -63,7 +63,7 @@ typedef struct
gint showgrid; gint showgrid;
gint showcaps; gint showcaps;
glong preview_zoom_factor; GimpZoomModel *zoom_model;
gdouble alpha,beta,gamma; gdouble alpha,beta,gamma;
gdouble maxdepth; gdouble maxdepth;
...@@ -74,7 +74,7 @@ typedef struct ...@@ -74,7 +74,7 @@ typedef struct
gint32 boxmap_id[6]; gint32 boxmap_id[6];
gint32 cylindermap_id[2]; gint32 cylindermap_id[2];
} MapObjectValues; } MapObjectValues;
/* Externally visible variables */ /* Externally visible variables */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "mapobject_main.h" #include "mapobject_main.h"
#include "mapobject_ui.h" #include "mapobject_ui.h"
...@@ -394,12 +395,13 @@ void ...@@ -394,12 +395,13 @@ void
update_light (gint xpos, 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 >> mapvals.preview_zoom_factor; pw = PREVIEW_WIDTH * zoom;
ph = PREVIEW_HEIGHT >> mapvals.preview_zoom_factor; ph = PREVIEW_HEIGHT * zoom;
startx = (PREVIEW_WIDTH - pw) >> 1; startx = (PREVIEW_WIDTH - pw) / 2;
starty = (PREVIEW_HEIGHT - ph) >> 1; starty = (PREVIEW_HEIGHT - ph) / 2;
gimp_vector_2d_to_3d (startx, starty, pw, ph, xpos, ypos, gimp_vector_2d_to_3d (startx, starty, pw, ph, xpos, ypos,
&mapvals.viewpoint, &mapvals.lightsource.position); &mapvals.viewpoint, &mapvals.lightsource.position);
...@@ -414,6 +416,7 @@ void ...@@ -414,6 +416,7 @@ 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;