renamed newly added function to gimp_preview_get_controls(). Increased row

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

	* libgimpwidgets/gimppreview.[ch]: renamed newly added function to
	gimp_preview_get_controls(). Increased row padding for controls.

	* libgimpwidgets/gimpwidgets.def
	* libgimp/gimpzoompreview.c: changed accordingly.

	* libgimpbase/gimputils.c (gimp_enum_get_value): ref the enum
	class instead of only peeking at it.

	* libgimpwidgets/gimpzoommodel.c (gimp_zoom_button_new): set a
	tooltip on zoom buttons that only show an icon.
This commit is contained in:
Sven Neumann 2005-09-28 11:02:02 +00:00 committed by Sven Neumann
parent fa7f068dd6
commit 3670d4c3ae
7 changed files with 58 additions and 27 deletions

View File

@ -1,3 +1,20 @@
2005-09-28 Sven Neumann <neumann@jpk.com>
2005-09-28 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppreview.[ch]: renamed newly added function to
gimp_preview_get_controls(). Increased row padding for controls.
* libgimpwidgets/gimpwidgets.def
* libgimp/gimpzoompreview.c: changed accordingly.
* libgimpbase/gimputils.c (gimp_enum_get_value): ref the enum
class instead of only peeking at it.
* libgimpwidgets/gimpzoommodel.c (gimp_zoom_button_new): set a
tooltip on zoom buttons that only show an icon.
2005-09-28 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppreview.[ch]: added a hbox to the table and

View File

@ -103,7 +103,7 @@ gimp_zoom_preview_init (GimpZoomPreview *preview)
G_CALLBACK (gimp_zoom_preview_set_adjustments),
preview);
box = gimp_preview_get_control_box (GIMP_PREVIEW (preview));
box = gimp_preview_get_controls (GIMP_PREVIEW (preview));
g_return_if_fail (GTK_IS_BOX (box));
button_bar = gtk_hbox_new (FALSE, 2);

View File

@ -437,10 +437,11 @@ gimp_enum_get_value (GType enum_type,
{
GEnumClass *enum_class;
GEnumValue *enum_value;
gboolean success = FALSE;
g_return_val_if_fail (G_TYPE_IS_ENUM (enum_type), FALSE);
enum_class = g_type_class_peek (enum_type);
enum_class = g_type_class_ref (enum_type);
enum_value = g_enum_get_value (enum_class, value);
if (enum_value)
@ -470,10 +471,12 @@ gimp_enum_get_value (GType enum_type,
NULL);
}
return TRUE;
success = TRUE;
}
return FALSE;
g_type_class_unref (enum_class);
return success;
}
/**

View File

@ -50,7 +50,7 @@ enum
typedef struct
{
GtkWidget *control_box;
GtkWidget *controls;
} GimpPreviewPrivate;
#define GIMP_PREVIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GIMP_TYPE_PREVIEW, GimpPreviewPrivate))
@ -192,19 +192,19 @@ gimp_preview_init (GimpPreview *preview)
gtk_widget_show (preview->frame);
preview->table = gtk_table_new (3, 2, FALSE);
gtk_table_set_row_spacing (GTK_TABLE (preview->table), 1, 2);
gtk_table_set_row_spacing (GTK_TABLE (preview->table), 1, 6);
gtk_container_add (GTK_CONTAINER (preview->frame), preview->table);
gtk_widget_show (preview->table);
preview->timeout_id = 0;
preview->timeout_id = 0;
preview->xmin = preview->ymin = 0;
preview->xmax = preview->ymax = 1;
preview->width = preview->xmax - preview->xmin;
preview->height = preview->ymax - preview->ymin;
preview->xmin = preview->ymin = 0;
preview->xmax = preview->ymax = 1;
preview->width = preview->xmax - preview->xmin;
preview->height = preview->ymax - preview->ymin;
preview->xoff = 0;
preview->yoff = 0;
preview->xoff = 0;
preview->yoff = 0;
preview->default_cursor = NULL;
@ -247,17 +247,16 @@ gimp_preview_init (GimpPreview *preview)
G_CALLBACK (gimp_preview_area_size_allocate),
preview);
priv->control_box = gtk_hbox_new (FALSE, 6);
gtk_table_attach (GTK_TABLE (preview->table), priv->control_box, 0, 2, 2, 3,
priv->controls = gtk_hbox_new (FALSE, 6);
gtk_table_attach (GTK_TABLE (preview->table), priv->controls, 0, 2, 2, 3,
GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0);
gtk_widget_show (priv->control_box);
gtk_widget_show (priv->controls);
/* toggle button to (des)activate the instant preview */
preview->toggle = gtk_check_button_new_with_mnemonic (_("_Preview"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preview->toggle),
preview->update_preview);
gtk_box_pack_start (GTK_BOX (priv->control_box), preview->toggle,
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (priv->controls), preview->toggle, TRUE, TRUE, 0);
gtk_widget_show (preview->toggle);
g_signal_connect (preview->toggle, "toggled",
@ -720,7 +719,7 @@ gimp_preview_set_default_cursor (GimpPreview *preview,
}
/**
* gimp_preview_get_control_box:
* gimp_preview_get_controls:
* @preview: a #GimpPreview widget
*
* Gives access to the #GtkHBox at the bottom of the preview that
@ -732,9 +731,9 @@ gimp_preview_set_default_cursor (GimpPreview *preview,
* Since: GIMP 2.4
**/
GtkWidget *
gimp_preview_get_control_box (GimpPreview *preview)
gimp_preview_get_controls (GimpPreview *preview)
{
g_return_val_if_fail (GIMP_IS_PREVIEW (preview), NULL);
return GIMP_PREVIEW_GET_PRIVATE (preview)->control_box;
return GIMP_PREVIEW_GET_PRIVATE (preview)->controls;
}

View File

@ -116,10 +116,10 @@ void gimp_preview_draw_buffer (GimpPreview *preview,
void gimp_preview_invalidate (GimpPreview *preview);
void gimp_preview_set_default_cursor (GimpPreview *preview,
GdkCursor *cursor);
void gimp_preview_set_default_cursor (GimpPreview *preview,
GdkCursor *cursor);
GtkWidget * gimp_preview_get_control_box (GimpPreview *preview);
GtkWidget * gimp_preview_get_controls (GimpPreview *preview);
G_END_DECLS

View File

@ -212,7 +212,7 @@ EXPORTS
gimp_preview_draw
gimp_preview_draw_buffer
gimp_preview_get_area
gimp_preview_get_control_box
gimp_preview_get_controls
gimp_preview_get_position
gimp_preview_get_size
gimp_preview_get_type

View File

@ -26,8 +26,10 @@
#include "gimpwidgetstypes.h"
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "gimphelpui.h"
#include "gimpzoommodel.h"
@ -417,10 +419,9 @@ zoom_button_new (const gchar *stock_id,
if (icon_size > 0)
{
GtkWidget *image;
GtkWidget *image = gtk_image_new_from_stock (stock_id, icon_size);
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);
}
@ -472,6 +473,17 @@ gimp_zoom_button_new (GimpZoomModel *model,
break;
}
if (button && icon_size > 0)
{
const gchar *desc;
if (gimp_enum_get_value (GIMP_TYPE_ZOOM_TYPE, zoom_type,
NULL, NULL, &desc, NULL))
{
gimp_help_set_help_data (button, desc, NULL);
}
}
return button;
}