diff options
author | Federico Mena Quintero <federico@ximian.com> | 2002-07-09 20:13:08 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2002-07-09 20:13:08 +0000 |
commit | 8501101669051c8d4bb51209516ec2872c5895e2 (patch) | |
tree | a86d864fc09ce1819467ff63c0945f63ca413c03 /viewer | |
parent | 910b6d775cfa93b961c6a5e83a65e710b14217e2 (diff) | |
download | eog-8501101669051c8d4bb51209516ec2872c5895e2.tar.gz |
:EOG::Interpolation): Removed tiles interpolation, as it does not make
2002-07-09 Federico Mena Quintero <federico@ximian.com>
* idl/Eog.idl (GNOME::EOG::Interpolation): Removed tiles
interpolation, as it does not make sense for EOG.
* viewer/eog-image-view.c (listener_Interpolation_cb): Likewise.
(ui_id_strings_interp_type): Likewise.
(eog_image_view_get_prop): Likewise.
(eog_image_view_set_prop): Likewise.
* viewer/eog-preview.c (eog_preview_update): Likewise.
* viewer/preferences.c (prefs_interpolation): Likewise.
* viewer/eog-image-view-ui.xml: Likewise.
* viewer/eog-image-view.c (eog_image_view_create_ui): Use the
computed number of elements for the interpolation types array, not
a hardcoded constant.
(eog_image_view_create_ui): Convert the interpolation value to a
menu index before using it.
(interp_type_changed_cb): Likewise.
* viewer/eog-control.c (eog_control_construct): Do not add a
property control interface. The preferences code is highly
convoluted and broken, so I'm removing it.
* viewer/eog-imagew-view.c (eog_image_view_get_property_control):
Removed.
* viewer/Makefile.am (eog_image_viewer_SOURCES): Removed
preferences.[ch].
* viewer/preferences.[ch]: Removed.
* shell/eog-shell-ui.xml: Removed the Edit/Preferernces item.
* shell/eog-window.c: Removed the preferences machinery.
* shell/Makefile.am (eog_SOURCES): Removed eog-preferences.[ch].
Diffstat (limited to 'viewer')
-rw-r--r-- | viewer/Makefile.am | 2 | ||||
-rw-r--r-- | viewer/eog-control.c | 5 | ||||
-rw-r--r-- | viewer/eog-image-view-ui.xml | 3 | ||||
-rw-r--r-- | viewer/eog-image-view.c | 111 | ||||
-rw-r--r-- | viewer/eog-image-view.h | 1 | ||||
-rw-r--r-- | viewer/eog-preview.c | 3 | ||||
-rw-r--r-- | viewer/preferences.c | 224 | ||||
-rw-r--r-- | viewer/preferences.h | 25 |
8 files changed, 29 insertions, 345 deletions
diff --git a/viewer/Makefile.am b/viewer/Makefile.am index 21832d8a..9eddd098 100644 --- a/viewer/Makefile.am +++ b/viewer/Makefile.am @@ -32,8 +32,6 @@ eog_image_viewer_SOURCES = \ eog-print-setup.h \ eog-util.h \ eog-util.c \ - preferences.h \ - preferences.c \ main.c # eog-embeddable.c \ # eog-embeddable.h \ diff --git a/viewer/eog-control.c b/viewer/eog-control.c index a40a849e..06d7d01d 100644 --- a/viewer/eog-control.c +++ b/viewer/eog-control.c @@ -368,7 +368,6 @@ eog_control_construct (EogControl *control, { GtkWidget *widget; BonoboPropertyBag *pb; - BonoboPropertyControl *pc; EogControlPrivate *priv; g_return_val_if_fail (image != NULL, NULL); @@ -438,10 +437,6 @@ eog_control_construct (EogControl *control, BONOBO_OBJREF (pb), NULL); - pc = eog_image_view_get_property_control (priv->image_view); - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (pc)); - return control; } diff --git a/viewer/eog-image-view-ui.xml b/viewer/eog-image-view-ui.xml index 53a422bc..f343f9ce 100644 --- a/viewer/eog-image-view-ui.xml +++ b/viewer/eog-image-view-ui.xml @@ -16,8 +16,6 @@ <cmd name="InterpolationNearest" _label="Nea_rest Neighbour" type="radio" group="Interpolation"/> - <cmd name="InterpolationTiles" _label="_Tiles" - type="radio" group="Interpolation"/> <cmd name="InterpolationBilinear" _label="_Bilinear" type="radio" group="Interpolation"/> <cmd name="InterpolationHyperbolic" _label="_Hyperbolic" @@ -74,7 +72,6 @@ <submenu name="Interpolation" _label="_Interpolation"> <menuitem name="InterpolationNearest" verb=""/> - <menuitem name="InterpolationTiles" verb=""/> <menuitem name="InterpolationBilinear" verb=""/> <menuitem name="InterpolationHyperbolic" verb=""/> </submenu> diff --git a/viewer/eog-image-view.c b/viewer/eog-image-view.c index bf8e4d99..236362e8 100644 --- a/viewer/eog-image-view.c +++ b/viewer/eog-image-view.c @@ -33,8 +33,6 @@ #include <image-view.h> #include <ui-image.h> -#include <preferences.h> - #include <bonobo/bonobo-stream.h> #include <bonobo/bonobo-ui-util.h> @@ -106,9 +104,6 @@ enum { LAST_SIGNAL }; -static BonoboControl* property_control_get_cb (BonoboPropertyControl *property_control, - int page_number, void *closure); - static void popup_menu_cb (gpointer data, guint action, GtkWidget *widget); static GObjectClass *eog_image_view_parent_class; @@ -198,9 +193,6 @@ listener_Interpolation_cb (BonoboUIComponent *uic, if (!strcmp (path, "InterpolationNearest")) { interpolation = GDK_INTERP_NEAREST; } - else if (!strcmp (path, "InterpolationTiles")) { - interpolation = GDK_INTERP_TILES; - } else if (!strcmp (path, "InterpolationBilinear")) { interpolation = GDK_INTERP_BILINEAR; } @@ -1202,13 +1194,35 @@ listener_CheckSize_cb (BonoboUIComponent *uic, } +/* Keep this in sync with interp_menu_index_from_value() below */ static const gchar* ui_id_strings_interp_type [] = { "InterpolationNearest", - "InterpolationTiles", "InterpolationBilinear", "InterpolationHyperbolic" }; +static const int n_ui_id_strings_interp_type = (sizeof (ui_id_strings_interp_type) / + sizeof (ui_id_strings_interp_type[0])); + +/* Converts an enum value to the corresponding menu index for interpolation */ +static int +interp_menu_index_from_value (int value) +{ + switch (value) { + case GDK_INTERP_NEAREST: + return 0; + + case GDK_INTERP_BILINEAR: + return 1; + + case GDK_INTERP_HYPER: + return 2; + + default: + return 0; + } +} + static const gchar* ui_id_strings_dither [] = { "DitherNone", "DitherNormal", @@ -1280,8 +1294,9 @@ eog_image_view_create_ui (EogImageView *image_view) value = gconf_client_get_int (image_view->priv->client, GCONF_EOG_VIEW_INTERP_TYPE, NULL); + value = interp_menu_index_from_value (value); set_ui_group_item (image_view, ui_id_strings_interp_type [value]); - for (i = 0; i < 4; i++) { + for (i = 0; i < n_ui_id_strings_interp_type; i++) { bonobo_ui_component_add_listener (image_view->priv->uic, ui_id_strings_interp_type [i], listener_Interpolation_cb, image_view); } @@ -1373,8 +1388,6 @@ eog_image_view_get_prop (BonoboPropertyBag *bag, switch (interp_type) { case GDK_INTERP_NEAREST: eog_interp = GNOME_EOG_INTERPOLATION_NEAREST; - case GDK_INTERP_TILES: - eog_interp = GNOME_EOG_INTERPOLATION_TILES; case GDK_INTERP_BILINEAR: eog_interp = GNOME_EOG_INTERPOLATION_BILINEAR; case GDK_INTERP_HYPER: @@ -1555,9 +1568,6 @@ eog_image_view_set_prop (BonoboPropertyBag *bag, case GNOME_EOG_INTERPOLATION_NEAREST: interp_type = GDK_INTERP_NEAREST; break; - case GNOME_EOG_INTERPOLATION_TILES: - interp_type = GDK_INTERP_TILES; - break; case GNOME_EOG_INTERPOLATION_BILINEAR: interp_type = GDK_INTERP_BILINEAR; break; @@ -1682,20 +1692,6 @@ eog_image_view_get_property_bag (EogImageView *image_view) return image_view->priv->property_bag; } -BonoboPropertyControl * -eog_image_view_get_property_control (EogImageView *image_view) -{ - BonoboEventSource *es; - - g_return_val_if_fail (image_view != NULL, NULL); - g_return_val_if_fail (EOG_IS_IMAGE_VIEW (image_view), NULL); - - es = bonobo_event_source_new (); - - return bonobo_property_control_new_full (property_control_get_cb, - 1, es, image_view); -} - void eog_image_view_set_ui_container (EogImageView *image_view, Bonobo_UIContainer ui_container) @@ -1909,58 +1905,6 @@ BONOBO_TYPE_FUNC_FULL (EogImageView, eog_image_view); static void -property_control_get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - CORBA_Environment *ev, - gpointer user_data) -{ - switch (arg_id) { - case PROP_CONTROL_TITLE: - g_assert (arg->_type == BONOBO_ARG_STRING); - BONOBO_ARG_SET_STRING (arg, _("Display")); - break; - default: - g_assert_not_reached (); - } -} - -static BonoboControl * -property_control_get_cb (BonoboPropertyControl *property_control, - int page_number, void *closure) -{ - EogImageView *image_view; - GtkWidget *container; - BonoboControl *control; - BonoboPropertyBag *property_bag; - - g_return_val_if_fail (closure != NULL, NULL); - g_return_val_if_fail (EOG_IS_IMAGE_VIEW (closure), NULL); - g_return_val_if_fail (page_number == 0, NULL); - - image_view = EOG_IMAGE_VIEW (closure); - - container = eog_create_preferences_page (image_view, page_number); - - gtk_widget_show_all (container); - - control = bonobo_control_new (container); - - /* Property Bag */ - property_bag = bonobo_property_bag_new (property_control_get_prop, - NULL, control); - - bonobo_property_bag_add (property_bag, "bonobo:title", - PROP_CONTROL_TITLE, BONOBO_ARG_STRING, - NULL, NULL, BONOBO_PROPERTY_READABLE); - - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (property_bag)); - - return control; -} - -static void interp_type_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, @@ -1968,6 +1912,7 @@ interp_type_changed_cb (GConfClient *client, { EogImageView *view; GdkInterpType interpolation; + int i; view = EOG_IMAGE_VIEW (user_data); @@ -1981,7 +1926,9 @@ interp_type_changed_cb (GConfClient *client, image_view_set_interp_type (view->priv->image_view, interpolation); bonobo_event_source_notify_listeners (view->priv->property_bag->es, "interpolation", NULL, NULL); - set_ui_group_item (view, ui_id_strings_interp_type [interpolation]); + + i = interp_menu_index_from_value (interpolation); + set_ui_group_item (view, ui_id_strings_interp_type [i]); } static void diff --git a/viewer/eog-image-view.h b/viewer/eog-image-view.h index 88b9ec3e..880a37a9 100644 --- a/viewer/eog-image-view.h +++ b/viewer/eog-image-view.h @@ -61,7 +61,6 @@ EogImageView *eog_image_view_construct (EogImageView *imag gboolean need_close_item); EogImage *eog_image_view_get_image (EogImageView *image_view); BonoboPropertyBag *eog_image_view_get_property_bag (EogImageView *image_view); -BonoboPropertyControl *eog_image_view_get_property_control (EogImageView *image_view); void eog_image_view_set_ui_container (EogImageView *image_view, Bonobo_UIContainer ui_container); void eog_image_view_unset_ui_container (EogImageView *image_view); diff --git a/viewer/eog-preview.c b/viewer/eog-preview.c index e2148f51..fe173e51 100644 --- a/viewer/eog-preview.c +++ b/viewer/eog-preview.c @@ -84,9 +84,6 @@ eog_preview_update (EogPreview *preview, gdouble width, gdouble height, case GNOME_EOG_INTERPOLATION_NEAREST: interp = GDK_INTERP_NEAREST; break; - case GNOME_EOG_INTERPOLATION_TILES: - interp = GDK_INTERP_TILES; - break; case GNOME_EOG_INTERPOLATION_BILINEAR: interp = GDK_INTERP_BILINEAR; break; diff --git a/viewer/preferences.c b/viewer/preferences.c deleted file mode 100644 index e012d4a5..00000000 --- a/viewer/preferences.c +++ /dev/null @@ -1,224 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/** - * eog-image-view.c - * - * Authors: - * Martin Baulig (baulig@suse.de) - * - * Copyright 2000 SuSE GmbH. - */ -#include <config.h> -#include <stdio.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkmarshal.h> -#include <gtk/gtktypeutils.h> -#include <gconf/gconf-client.h> - -#include <gnome.h> - -#include <eog-image-view.h> - -#include <libeog/access.h> - -#include "preferences.h" - -typedef struct { - int type; - const char *string; -} PrefsEntry; - -/* Interpolation types for the index-mapping functions */ -static PrefsEntry prefs_interpolation [] = { - { GNOME_EOG_INTERPOLATION_NEAREST, - N_("Nearest Neighbour Interpolation") }, - { GNOME_EOG_INTERPOLATION_TILES, - N_("Tiles Interpolation") }, - { GNOME_EOG_INTERPOLATION_BILINEAR, - N_("Bilinear Interpolation") }, - { GNOME_EOG_INTERPOLATION_HYPERBOLIC, - N_("Hyperbolic Interpolation") }, - { 0, NULL } -}; - -static PrefsEntry prefs_dither [] = { - { GNOME_EOG_DITHER_NONE, N_("No dithering") }, - { GNOME_EOG_DITHER_NORMAL, N_("Normal (pseudocolor) dithering") }, - { GNOME_EOG_DITHER_MAXIMUM, N_("Maximum (high color) dithering") }, - { 0, NULL } -}; - -static PrefsEntry prefs_check_type [] = { - { GNOME_EOG_CHECK_TYPE_DARK, N_("Dark") }, - { GNOME_EOG_CHECK_TYPE_MIDTONE, N_("Midtone") }, - { GNOME_EOG_CHECK_TYPE_LIGHT, N_("Light") }, - { GNOME_EOG_CHECK_TYPE_BLACK, N_("Black") }, - { GNOME_EOG_CHECK_TYPE_GRAY, N_("Gray") }, - { GNOME_EOG_CHECK_TYPE_WHITE, N_("White") }, - { 0, NULL } -}; - -static PrefsEntry prefs_check_size [] = { - { GNOME_EOG_CHECK_SIZE_SMALL, N_("Small") }, - { GNOME_EOG_CHECK_SIZE_MEDIUM, N_("Medium") }, - { GNOME_EOG_CHECK_SIZE_LARGE, N_("Large") }, - { 0, NULL } -}; - -static void -activate_cb (GtkWidget *widget, gpointer data) -{ - EogImageView *view; - gchar *key; - gint value; - - view = EOG_IMAGE_VIEW (data); - - key = (gchar*) g_object_get_data (G_OBJECT (widget), "gconf_key"); - value = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "value")); - - gconf_client_set_int (eog_image_view_get_client (view), - key, value, NULL); -} - -static GtkWidget * -create_prefs_menu (const PrefsEntry *menu_description, - gchar *key, - EogImageView *view) -{ - GtkWidget *omenu, *menu; - const PrefsEntry *entry; - int value; - GSList *group; - int history = 0, i = 0; - - g_print ("create_prefs for %s", key); - value = gconf_client_get_int (eog_image_view_get_client (view), - key, NULL); - - omenu = gtk_option_menu_new (); - - menu = gtk_menu_new (); - group = NULL; - - for (entry = menu_description; entry->string; entry++) { - const char *translated_string; - GtkWidget *item; - - translated_string = gettext (entry->string); - item = gtk_radio_menu_item_new_with_label (group, translated_string); - group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (item)); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - - g_object_set_data (G_OBJECT (item), "value", GINT_TO_POINTER (i)); - g_object_set_data (G_OBJECT (item), "gconf_key", key); - - if (entry->type == value) { - g_print ("set start value %i\n", value); - gtk_check_menu_item_set_active - (GTK_CHECK_MENU_ITEM (item), TRUE); - history = i; - } - - g_signal_connect (item, "activate", - G_CALLBACK (activate_cb), view); - - i++; - - gtk_widget_show (item); - } - - gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), history); - - return omenu; -} - -static GtkWidget* -create_label (gchar *text, - GtkWidget *widget) -{ - GtkWidget *alignment; - GtkWidget *label; - - label = gtk_label_new_with_mnemonic (text); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget); - alignment = gtk_alignment_new (1.0, 0.5, 0.0, 0.0); - - access_add_atk_relation (label, widget, ATK_RELATION_LABEL_FOR, ATK_RELATION_LABELLED_BY); - - gtk_container_add (GTK_CONTAINER (alignment), label); - - return alignment; -} - -GtkWidget * -eog_create_preferences_page (EogImageView *image_view, - guint page_number) -{ - GtkWidget *table, *interp, *dither; - GtkWidget *check_type, *check_size; - GtkWidget *label; - GConfClient *client; - - g_return_val_if_fail (image_view != NULL, NULL); - g_return_val_if_fail (EOG_IS_IMAGE_VIEW (image_view), NULL); - g_return_val_if_fail (page_number == 0, NULL); - - client = eog_image_view_get_client (image_view); - - table = gtk_table_new (4, 2, FALSE); - - interp = create_prefs_menu (prefs_interpolation, - GCONF_EOG_VIEW_INTERP_TYPE, - image_view); - - label = create_label (_("_Interpolation:"), interp); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, 0, 1); - - gtk_table_attach_defaults (GTK_TABLE (table), interp, - 1, 2, 0, 1); - - dither = create_prefs_menu (prefs_dither, - GCONF_EOG_VIEW_DITHER, - image_view); - - label = create_label (_("_Dither:"), dither); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, 1, 2); - - gtk_table_attach_defaults (GTK_TABLE (table), dither, - 1, 2, 1, 2); - - check_type = create_prefs_menu (prefs_check_type, - GCONF_EOG_VIEW_CHECK_TYPE, - image_view); - - label = create_label (_("Check _type:"), check_type); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, 2, 3); - - gtk_table_attach_defaults (GTK_TABLE (table), check_type, - 1, 2, 2, 3); - - check_size = create_prefs_menu (prefs_check_size, - GCONF_EOG_VIEW_CHECK_SIZE, - image_view); - - label = create_label (_("Check _size:"), check_size); - gtk_table_attach_defaults (GTK_TABLE (table), - label, - 0, 1, 3, 4); - - gtk_table_attach_defaults (GTK_TABLE (table), check_size, - 1, 2, 3, 4); - - gtk_table_set_row_spacings (GTK_TABLE (table), 4); - gtk_table_set_col_spacings (GTK_TABLE (table), 4); - gtk_container_set_border_width (GTK_CONTAINER (table), 10); - - return table; -} diff --git a/viewer/preferences.h b/viewer/preferences.h deleted file mode 100644 index 932b860e..00000000 --- a/viewer/preferences.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * preferences.h. - * - * Authors: - * Martin Baulig (baulig@suse.de) - * - * Copyright 2001, SuSE GmbH. - */ - -#ifndef _PREFERENCES_H_ -#define _PREFERENCES_H_ - -#include <eog-image-view.h> - -G_BEGIN_DECLS - -GtkWidget * -eog_create_preferences_page (EogImageView *image_view, - guint page_number); - -G_END_DECLS - -#endif - |