New files with the preferences code.

2000-05-08  Federico Mena Quintero  <federico@helixcode.com>

	* preferences.[ch]: New files with the preferences code.

	* main.c (main): Call prefs_init().

	* image-view.c (ImageViewPrivate): Added the per-view
	configuration options for interpolation and checks.
	(image_view_init): Initialize the configuration options.
	(paint_iteration_idle): Use priv->interp_type.
	(paint_rectangle): Compute the check color and size.  Use the
	user-specified dither mode.
	(image_view_set_interp_type): New function.
	(image_view_get_interp_type): New function.
	(image_view_set_check_type): New function.
	(image_view_get_check_type): New function.
	(image_view_set_check_size): New function.
	(image_view_get_check_size): New function.
	(image_view_set_dither): New function.
	(image_view_get_dither): New function.
	(image_view_set_preferences): New function.
	(image_view_set_scroll): New function.
	(image_view_get_scroll): New function.

	* window.c (set_mode): Set the image view parameters from the
	preferences.

	* commands.c (cmd_cb_full_screen): Likewise.

	* window.c (window_key_press): Accept q for exiting the program.

	* full-screen.c (full_screen_key_press): Also accept C-w and q for
	exiting full-screen mode.

	* Makefile.am (eog_SOURCES): Added preferences.[ch].
This commit is contained in:
Federico Mena Quintero 2000-05-08 19:30:42 +00:00 committed by Federico Mena Quintero
parent 31369e56ed
commit fd4615f2f7
19 changed files with 2438 additions and 20 deletions

View file

@ -1,3 +1,7 @@
2000-05-08 Federico Mena Quintero <federico@helixcode.com>
* configure.in: Moved the gnome-config flags around.
2000-05-03 Pablo Saratxaga <pablo@mandrakesoft.com>
* src/window.c: replaced 5% with 5%% in messages, to avoid false

View file

@ -95,13 +95,13 @@ else
fi
AM_CONDITIONAL(GPRINT, $have_gprint)
EXTRA_BONOBO_CFLAGS=`gnome-config --cflags gnomeui gdk_pixbuf gnomecanvaspixbuf $bonobo $gprint`
EXTRA_BONOBO_LIBS=`gnome-config --libs gnomeui gdk_pixbuf gnomecanvaspixbuf $bonobo $gprint`
EXTRA_BONOBO_CFLAGS=`gnome-config --cflags $bonobo $gprint gnomecanvaspixbuf gdk_pixbuf gnomeui`
EXTRA_BONOBO_LIBS=`gnome-config --libs $bonobo $gprint gnomecanvaspixbuf gdk_pixbuf gnomeui`
AC_SUBST(EXTRA_BONOBO_CFLAGS)
AC_SUBST(EXTRA_BONOBO_LIBS)
EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomeui gdk_pixbuf gnomecanvaspixbuf`
EXTRA_GNOME_LIBS=`gnome-config --libs gnomeui gdk_pixbuf gnomecanvaspixbuf`
EXTRA_GNOME_CFLAGS=`gnome-config --cflags gnomecanvaspixbuf gdk_pixbuf gnomeui`
EXTRA_GNOME_LIBS=`gnome-config --libs gnomecanvaspixbuf gdk_pixbuf gnomeui`
AC_SUBST(EXTRA_GNOME_CFLAGS)
AC_SUBST(EXTRA_GNOME_LIBS)

View file

@ -32,9 +32,14 @@
/* Checks */
#define CHECK_SIZE 16
#define CHECK_SMALL 4
#define CHECK_MEDIUM 8
#define CHECK_LARGE 16
#define CHECK_BLACK 0x00000000
#define CHECK_DARK 0x00555555
#define CHECK_GRAY 0x00808080
#define CHECK_LIGHT 0x00aaaaaa
#define CHECK_WHITE 0x00ffffff
/* Maximum size of repaint rectangles */
@ -73,6 +78,19 @@ typedef struct {
int drag_anchor_x, drag_anchor_y;
int drag_ofs_x, drag_ofs_y;
/* Interpolation type */
GdkInterpType interp_type;
/* Check type and size */
CheckType check_type;
CheckSize check_size;
/* Dither type */
GdkRgbDither dither;
/* Scroll type */
ScrollType scroll;
/* Whether the image is being dragged */
guint dragging : 1;
@ -207,6 +225,11 @@ image_view_init (ImageView *view)
GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
priv->zoom = 1.0;
priv->interp_type = prefs_interp_type;
priv->check_type = prefs_check_type;
priv->check_size = prefs_check_size;
priv->dither = prefs_dither;
priv->scroll = prefs_scroll;
GTK_WIDGET_UNSET_FLAGS (view, GTK_NO_WINDOW);
}
@ -385,6 +408,8 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
int xofs, yofs;
ArtIRect r, d;
GdkPixbuf *tmp;
int check_size;
guint32 check_1, check_2;
priv = view->priv;
@ -468,6 +493,61 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, d.x1 - d.x0, d.y1 - d.y0);
#endif
/* Compute check parameters */
switch (priv->check_type) {
case CHECK_TYPE_DARK:
check_1 = CHECK_BLACK;
check_2 = CHECK_DARK;
break;
case CHECK_TYPE_MIDTONE:
check_1 = CHECK_DARK;
check_2 = CHECK_LIGHT;
break;
case CHECK_TYPE_LIGHT:
check_1 = CHECK_LIGHT;
check_2 = CHECK_WHITE;
break;
case CHECK_TYPE_BLACK:
check_1 = check_2 = CHECK_BLACK;
break;
case CHECK_TYPE_GRAY:
check_1 = check_2 = CHECK_GRAY;
break;
case CHECK_TYPE_WHITE:
check_1 = check_2 = CHECK_WHITE;
break;
default:
check_1 = CHECK_DARK;
check_2 = CHECK_LIGHT;
}
switch (priv->check_size) {
case CHECK_SIZE_SMALL:
check_size = CHECK_SMALL;
break;
case CHECK_SIZE_MEDIUM:
check_size = CHECK_MEDIUM;
break;
case CHECK_SIZE_LARGE:
check_size = CHECK_LARGE;
break;
default:
check_size = CHECK_LARGE;
break;
}
/* Draw! */
gdk_pixbuf_composite_color (priv->image->pixbuf,
tmp,
0, 0,
@ -477,8 +557,8 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
interp_type,
255,
d.x0 - xofs, d.y0 - yofs,
CHECK_SIZE,
CHECK_DARK, CHECK_LIGHT);
check_size,
check_1, check_2);
#ifdef PACK_RGBA
pack_pixbuf (tmp);
@ -488,7 +568,7 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
GTK_WIDGET (view)->style->black_gc,
d.x0, d.y0,
d.x1 - d.x0, d.y1 - d.y0,
GDK_RGB_DITHER_NORMAL,
priv->dither,
gdk_pixbuf_get_pixels (tmp),
gdk_pixbuf_get_rowstride (tmp),
d.x0 - xofs, d.y0 - yofs);
@ -537,7 +617,7 @@ paint_iteration_idle (gpointer data)
return FALSE;
}
paint_rectangle (view, &rect, GDK_INTERP_BILINEAR);
paint_rectangle (view, &rect, priv->interp_type);
return TRUE;
}
@ -1240,6 +1320,25 @@ image_view_new (void)
return GTK_WIDGET (gtk_type_new (TYPE_IMAGE_VIEW));
}
/**
* image_view_set_preferences:
* @view: An image view.
*
* Sets an image view's parameters from the preferences mechanism.
**/
void
image_view_set_preferences (ImageView *view)
{
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
image_view_set_interp_type (view, prefs_interp_type);
image_view_set_check_type (view, prefs_check_type);
image_view_set_check_size (view, prefs_check_size);
image_view_set_dither (view, prefs_dither);
image_view_set_scroll (view, prefs_scroll);
}
/**
* image_view_set_image:
* @view: An image view.
@ -1340,3 +1439,223 @@ image_view_get_zoom (ImageView *view)
priv = view->priv;
return priv->zoom;
}
/**
* image_view_set_interp_type:
* @view: An image view.
* @interp_type: Interpolation type.
*
* Sets the interpolation type on an image view.
**/
void
image_view_set_interp_type (ImageView *view, GdkInterpType interp_type)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->interp_type == interp_type)
return;
priv->interp_type = interp_type;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_interp_type:
* @view: An image view.
*
* Queries the interpolation type of an image view.
*
* Return value: Interpolation type.
**/
GdkInterpType
image_view_get_interp_type (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, GDK_INTERP_NEAREST);
g_return_val_if_fail (IS_IMAGE_VIEW (view), GDK_INTERP_NEAREST);
priv = view->priv;
return priv->interp_type;
}
/**
* image_view_set_check_type:
* @view: An image view.
* @check_type: Check type.
*
* Sets the check type on an image view.
**/
void
image_view_set_check_type (ImageView *view, CheckType check_type)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->check_type == check_type)
return;
priv->check_type = check_type;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_check_type:
* @view: An image view.
*
* Queries the check type of an image view.
*
* Return value: Check type.
**/
CheckType
image_view_get_check_type (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, CHECK_TYPE_BLACK);
g_return_val_if_fail (IS_IMAGE_VIEW (view), CHECK_TYPE_BLACK);
priv = view->priv;
return priv->check_type;
}
/**
* image_view_set_check_size:
* @view: An image view.
* @check_size: Check size.
*
* Sets the check size on an image view.
**/
void
image_view_set_check_size (ImageView *view, CheckSize check_size)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->check_size == check_size)
return;
priv->check_size = check_size;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_check_size:
* @view: An image view.
*
* Queries the check size on an image view.
*
* Return value: Check size.
**/
CheckSize
image_view_get_check_size (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, CHECK_SIZE_SMALL);
g_return_val_if_fail (IS_IMAGE_VIEW (view), CHECK_SIZE_SMALL);
priv = view->priv;
return priv->check_size;
}
/**
* image_view_set_dither:
* @view: An image view.
* @dither: Dither type.
*
* Sets the dither type on an image view.
**/
void
image_view_set_dither (ImageView *view, GdkRgbDither dither)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->dither == dither)
return;
priv->dither = dither;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_dither:
* @view: An image view.
*
* Queries the dither type of an image view.
*
* Return value: Dither type.
**/
GdkRgbDither
image_view_get_dither (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, GDK_RGB_DITHER_NONE);
g_return_val_if_fail (IS_IMAGE_VIEW (view), GDK_RGB_DITHER_NONE);
priv = view->priv;
return priv->dither;
}
/**
* image_view_set_scroll:
* @view: An image view.
* @scroll: Scrolling type.
*
* Sets the scrolling type on an image view.
**/
void
image_view_set_scroll (ImageView *view, ScrollType scroll)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->scroll == scroll)
return;
priv->scroll = scroll;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_scroll:
* @view: An image view.
*
* Queries the scrolling type of an image view.
*
* Return value: Scrolling type.
**/
ScrollType
image_view_get_scroll (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, SCROLL_NORMAL);
g_return_val_if_fail (IS_IMAGE_VIEW (view), SCROLL_NORMAL);
priv = view->priv;
return priv->scroll;
}

View file

@ -25,6 +25,7 @@
#include <libgnome/gnome-defs.h>
#include <gtk/gtkwidget.h>
#include "image.h"
#include "preferences.h"
BEGIN_GNOME_DECLS
@ -62,12 +63,29 @@ GtkType image_view_get_type (void);
GtkWidget *image_view_new (void);
void image_view_set_preferences (ImageView *view);
void image_view_set_image (ImageView *view, Image *image);
Image *image_view_get_image (ImageView *view);
void image_view_set_zoom (ImageView *view, double zoom);
double image_view_get_zoom (ImageView *view);
void image_view_set_interp_type (ImageView *view, GdkInterpType interp_type);
GdkInterpType image_view_get_interp_type (ImageView *view);
void image_view_set_check_type (ImageView *view, CheckType check_type);
CheckType image_view_get_check_type (ImageView *view);
void image_view_set_check_size (ImageView *view, CheckSize check_size);
CheckSize image_view_get_check_size (ImageView *view);
void image_view_set_dither (ImageView *view, GdkRgbDither dither);
GdkRgbDither image_view_get_dither (ImageView *view);
void image_view_set_scroll (ImageView *view, ScrollType scroll);
ScrollType image_view_get_scroll (ImageView *view);
END_GNOME_DECLS

View file

@ -0,0 +1,616 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>EOG</name>
<program_name>eog</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>False</use_widget_names>
<output_main_file>True</output_main_file>
<output_support_files>True</output_support_files>
<output_build_files>True</output_build_files>
<backup_source_files>True</backup_source_files>
<main_source_file>interface.c</main_source_file>
<main_header_file>interface.h</main_header_file>
<handler_source_file>callbacks.c</handler_source_file>
<handler_header_file>callbacks.h</handler_header_file>
<support_source_file>support.c</support_source_file>
<support_header_file>support.h</support_header_file>
<output_translatable_strings>True</output_translatable_strings>
<translatable_strings_file>preferences-dialog.glade.h</translatable_strings_file>
</project>
<widget>
<class>GnomePropertyBox</class>
<name>PreferencesDialog</name>
<cxx_use_heap>True</cxx_use_heap>
<widget>
<class>GtkNotebook</class>
<child_name>GnomePropertyBox:notebook</child_name>
<name>notebook1</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox4</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkTable</class>
<name>table1</name>
<cxx_use_heap>True</cxx_use_heap>
<rows>5</rows>
<columns>2</columns>
<homogeneous>True</homogeneous>
<row_spacing>2</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Interpolation type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label4</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Transparency type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label5</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Check size</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>TransparencyType</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Dark checks
Midtone checks
Light checks
Black only
Gray only
White only
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>CheckSize</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Small
Medium
Large
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>InterpolationType</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Nearest neighbor
Bilinear
Hyperbolic
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>TwoPassScrolling</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Two-pass scrolling</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<left_attach>0</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label8</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Dither type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>DitherType</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>None
Normal (pseudocolor)
Maximum (high color)
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label1</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Display</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox1</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>4</spacing>
<widget>
<class>GtkFrame</class>
<name>frame1</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Image Windows</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox2</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkHBox</class>
<name>hbox1</name>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label6</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Use scrollbars</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>WindowScrollbars</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Never
Only if image does not fit
</items>
<initial_choice>0</initial_choice>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
</widget>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>WindowAutoSize</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Pick window size and zoom factor automatically</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>OpenNewWindow</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Open images in a new window</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame2</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Full Screen</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox3</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkHBox</class>
<name>hbox2</name>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label7</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Use scrollbars</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>FullScreenScrollbars</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Never
Only if image does not fit
</items>
<initial_choice>0</initial_choice>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
</widget>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton1</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Use 1:1 zoom factor</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>FullScreenZoom</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton2</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Use same zoom factor as image window</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>FullScreenZoom</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton3</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Fit all images to screen</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>FullScreenZoom</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator1</name>
<cxx_use_heap>True</cxx_use_heap>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>FullScreenFitStandard</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Fit standard-sized images to screen</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>FullScreenBevel</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Put a bevel around the edge of the screen</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label2</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Viewers</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</GTK-Interface>

84
shell/preferences.c Normal file
View file

@ -0,0 +1,84 @@
/* Eye of Gnome image viewer - preferences
*
* Copyright (C) 2000 The Free Software Foundation
*
* Author: Federico Mena-Quintero <federico@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-config.h>
#include "preferences.h"
GdkInterpType prefs_interp_type;
CheckType prefs_check_type;
CheckSize prefs_check_size;
GdkRgbDither prefs_dither;
ScrollType prefs_scroll;
GtkPolicyType prefs_window_sb_policy;
gboolean prefs_window_auto_size;
gboolean prefs_open_new_window;
GtkPolicyType prefs_full_screen_sb_policy;
FullScreenZoom prefs_full_screen_zoom;
gboolean prefs_full_screen_fit_standard;
gboolean prefs_full_screen_bevel;
/**
* prefs_init:
* @void:
*
* Reads the default set of preferences. Must be called prior to any of the
* rest of the program running.
**/
void
prefs_init (void)
{
gnome_config_push_prefix ("/eog/");
prefs_interp_type = gnome_config_get_int (
"view/interp_type=2"); /* bilinear */
prefs_check_type = gnome_config_get_int (
"view/check_type=1"); /* midtone */
prefs_check_size = gnome_config_get_int (
"view/check_size=2"); /* large */
prefs_dither = gnome_config_get_int (
"view/dither=1"); /* normal */
prefs_scroll = gnome_config_get_int (
"view/scroll=1"); /* two-pass */
prefs_window_sb_policy = gnome_config_get_int (
"window/sb_policy=1"); /* automatic */
prefs_window_auto_size = gnome_config_get_bool (
"window/auto_size=1"); /* true */
prefs_open_new_window = gnome_config_get_bool (
"window/open_new_window=0"); /* false */
prefs_full_screen_sb_policy = gnome_config_get_int (
"full_screen/sb_policy=1"); /* never */
prefs_full_screen_zoom = gnome_config_get_int (
"full_screen/zoom=2"); /* fit */
prefs_full_screen_fit_standard = gnome_config_get_bool (
"full_screen/fit_standard=1"); /* true */
prefs_full_screen_bevel = gnome_config_get_bool (
"full_screen/bevel=0"); /* false */
gnome_config_pop_prefix ();
}

97
shell/preferences.h Normal file
View file

@ -0,0 +1,97 @@
/* Eye of Gnome image viewer - preferences
*
* Copyright (C) 2000 The Free Software Foundation
*
* Author: Federico Mena-Quintero <federico@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef PREFERENCES_H
#define PREFERENCES_H
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtkenums.h>
/* Interpolation type for views */
extern GdkInterpType prefs_interp_type;
/* Type of checks for views */
typedef enum {
CHECK_TYPE_DARK,
CHECK_TYPE_MIDTONE,
CHECK_TYPE_LIGHT,
CHECK_TYPE_BLACK,
CHECK_TYPE_GRAY,
CHECK_TYPE_WHITE
} CheckType;
extern CheckType prefs_check_type;
/* Check size for views */
typedef enum {
CHECK_SIZE_SMALL,
CHECK_SIZE_MEDIUM,
CHECK_SIZE_LARGE
} CheckSize;
extern CheckSize prefs_check_size;
/* Dither type */
extern GdkRgbDither prefs_dither;
/* Scrolling type for views */
typedef enum {
SCROLL_NORMAL,
SCROLL_TWO_PASS
} ScrollType;
extern ScrollType prefs_scroll;
/* Scrollbar policy for image windows */
extern GtkPolicyType prefs_window_sb_policy;
/* Pick window size and zoom factor automatically for image windows */
extern gboolean prefs_window_auto_size;
/* Open images in a new window */
extern gboolean prefs_open_new_window;
/* Scrollbar policy for full screen mode */
extern GtkPolicyType prefs_full_screen_sb_policy;
/* Automatic zoom for full screen mode */
typedef enum {
FULL_SCREEN_ZOOM_1,
FULL_SCREEN_ZOOM_SAME_AS_WINDOW,
FULL_SCREEN_ZOOM_FIT
} FullScreenZoom;
extern FullScreenZoom prefs_full_screen_zoom;
/* Fit standard-sized images to full screen mode */
extern gboolean prefs_full_screen_fit_standard;
/* Put a bevel around the edge of the screen */
extern gboolean prefs_full_screen_bevel;
void prefs_init (void);
#endif

View file

@ -1,3 +1,39 @@
2000-05-08 Federico Mena Quintero <federico@helixcode.com>
* preferences.[ch]: New files with the preferences code.
* main.c (main): Call prefs_init().
* image-view.c (ImageViewPrivate): Added the per-view
configuration options for interpolation and checks.
(image_view_init): Initialize the configuration options.
(paint_iteration_idle): Use priv->interp_type.
(paint_rectangle): Compute the check color and size. Use the
user-specified dither mode.
(image_view_set_interp_type): New function.
(image_view_get_interp_type): New function.
(image_view_set_check_type): New function.
(image_view_get_check_type): New function.
(image_view_set_check_size): New function.
(image_view_get_check_size): New function.
(image_view_set_dither): New function.
(image_view_get_dither): New function.
(image_view_set_preferences): New function.
(image_view_set_scroll): New function.
(image_view_get_scroll): New function.
* window.c (set_mode): Set the image view parameters from the
preferences.
* commands.c (cmd_cb_full_screen): Likewise.
* window.c (window_key_press): Accept q for exiting the program.
* full-screen.c (full_screen_key_press): Also accept C-w and q for
exiting full-screen mode.
* Makefile.am (eog_SOURCES): Added preferences.[ch].
2000-05-05 Federico Mena Quintero <federico@helixcode.com>
* image-view.c: New "zoom_fit" class to ask the parent to zoom to

View file

@ -20,6 +20,8 @@ eog_SOURCES = \
image-view.c \
image-view.h \
main.c \
preferences.c \
preferences.h \
stock.c \
stock.h \
tb-image.c \

View file

@ -92,6 +92,7 @@ cmd_cb_full_screen (GtkWidget *widget, gpointer data)
ui = UI_IMAGE (window_get_ui_image (WINDOW (data)));
view = IMAGE_VIEW (ui_image_get_image_view (ui));
image_view_set_preferences (view);
fs = full_screen_new ();
full_screen_set_image (FULL_SCREEN (fs), image_view_get_image (view));

View file

@ -190,6 +190,7 @@ static gint
full_screen_key_press (GtkWidget *widget, GdkEventKey *event)
{
gint result;
gboolean do_hide;
result = FALSE;
@ -199,12 +200,32 @@ full_screen_key_press (GtkWidget *widget, GdkEventKey *event)
if (result)
return result;
if (event->keyval == GDK_Escape) {
gtk_widget_hide (widget);
return TRUE;
do_hide = FALSE;
switch (event->keyval) {
case GDK_Escape:
do_hide = TRUE;
break;
case GDK_W:
case GDK_w:
if (event->state & GDK_CONTROL_MASK)
do_hide = TRUE;
break;
case GDK_Q:
case GDK_q:
do_hide = TRUE;
break;
default:
return FALSE;
}
return FALSE;
if (do_hide)
gtk_widget_hide (widget);
return TRUE;
}

View file

@ -32,9 +32,14 @@
/* Checks */
#define CHECK_SIZE 16
#define CHECK_SMALL 4
#define CHECK_MEDIUM 8
#define CHECK_LARGE 16
#define CHECK_BLACK 0x00000000
#define CHECK_DARK 0x00555555
#define CHECK_GRAY 0x00808080
#define CHECK_LIGHT 0x00aaaaaa
#define CHECK_WHITE 0x00ffffff
/* Maximum size of repaint rectangles */
@ -73,6 +78,19 @@ typedef struct {
int drag_anchor_x, drag_anchor_y;
int drag_ofs_x, drag_ofs_y;
/* Interpolation type */
GdkInterpType interp_type;
/* Check type and size */
CheckType check_type;
CheckSize check_size;
/* Dither type */
GdkRgbDither dither;
/* Scroll type */
ScrollType scroll;
/* Whether the image is being dragged */
guint dragging : 1;
@ -207,6 +225,11 @@ image_view_init (ImageView *view)
GTK_WIDGET_SET_FLAGS (view, GTK_CAN_FOCUS);
priv->zoom = 1.0;
priv->interp_type = prefs_interp_type;
priv->check_type = prefs_check_type;
priv->check_size = prefs_check_size;
priv->dither = prefs_dither;
priv->scroll = prefs_scroll;
GTK_WIDGET_UNSET_FLAGS (view, GTK_NO_WINDOW);
}
@ -385,6 +408,8 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
int xofs, yofs;
ArtIRect r, d;
GdkPixbuf *tmp;
int check_size;
guint32 check_1, check_2;
priv = view->priv;
@ -468,6 +493,61 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, d.x1 - d.x0, d.y1 - d.y0);
#endif
/* Compute check parameters */
switch (priv->check_type) {
case CHECK_TYPE_DARK:
check_1 = CHECK_BLACK;
check_2 = CHECK_DARK;
break;
case CHECK_TYPE_MIDTONE:
check_1 = CHECK_DARK;
check_2 = CHECK_LIGHT;
break;
case CHECK_TYPE_LIGHT:
check_1 = CHECK_LIGHT;
check_2 = CHECK_WHITE;
break;
case CHECK_TYPE_BLACK:
check_1 = check_2 = CHECK_BLACK;
break;
case CHECK_TYPE_GRAY:
check_1 = check_2 = CHECK_GRAY;
break;
case CHECK_TYPE_WHITE:
check_1 = check_2 = CHECK_WHITE;
break;
default:
check_1 = CHECK_DARK;
check_2 = CHECK_LIGHT;
}
switch (priv->check_size) {
case CHECK_SIZE_SMALL:
check_size = CHECK_SMALL;
break;
case CHECK_SIZE_MEDIUM:
check_size = CHECK_MEDIUM;
break;
case CHECK_SIZE_LARGE:
check_size = CHECK_LARGE;
break;
default:
check_size = CHECK_LARGE;
break;
}
/* Draw! */
gdk_pixbuf_composite_color (priv->image->pixbuf,
tmp,
0, 0,
@ -477,8 +557,8 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
interp_type,
255,
d.x0 - xofs, d.y0 - yofs,
CHECK_SIZE,
CHECK_DARK, CHECK_LIGHT);
check_size,
check_1, check_2);
#ifdef PACK_RGBA
pack_pixbuf (tmp);
@ -488,7 +568,7 @@ paint_rectangle (ImageView *view, ArtIRect *rect, GdkInterpType interp_type)
GTK_WIDGET (view)->style->black_gc,
d.x0, d.y0,
d.x1 - d.x0, d.y1 - d.y0,
GDK_RGB_DITHER_NORMAL,
priv->dither,
gdk_pixbuf_get_pixels (tmp),
gdk_pixbuf_get_rowstride (tmp),
d.x0 - xofs, d.y0 - yofs);
@ -537,7 +617,7 @@ paint_iteration_idle (gpointer data)
return FALSE;
}
paint_rectangle (view, &rect, GDK_INTERP_BILINEAR);
paint_rectangle (view, &rect, priv->interp_type);
return TRUE;
}
@ -1240,6 +1320,25 @@ image_view_new (void)
return GTK_WIDGET (gtk_type_new (TYPE_IMAGE_VIEW));
}
/**
* image_view_set_preferences:
* @view: An image view.
*
* Sets an image view's parameters from the preferences mechanism.
**/
void
image_view_set_preferences (ImageView *view)
{
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
image_view_set_interp_type (view, prefs_interp_type);
image_view_set_check_type (view, prefs_check_type);
image_view_set_check_size (view, prefs_check_size);
image_view_set_dither (view, prefs_dither);
image_view_set_scroll (view, prefs_scroll);
}
/**
* image_view_set_image:
* @view: An image view.
@ -1340,3 +1439,223 @@ image_view_get_zoom (ImageView *view)
priv = view->priv;
return priv->zoom;
}
/**
* image_view_set_interp_type:
* @view: An image view.
* @interp_type: Interpolation type.
*
* Sets the interpolation type on an image view.
**/
void
image_view_set_interp_type (ImageView *view, GdkInterpType interp_type)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->interp_type == interp_type)
return;
priv->interp_type = interp_type;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_interp_type:
* @view: An image view.
*
* Queries the interpolation type of an image view.
*
* Return value: Interpolation type.
**/
GdkInterpType
image_view_get_interp_type (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, GDK_INTERP_NEAREST);
g_return_val_if_fail (IS_IMAGE_VIEW (view), GDK_INTERP_NEAREST);
priv = view->priv;
return priv->interp_type;
}
/**
* image_view_set_check_type:
* @view: An image view.
* @check_type: Check type.
*
* Sets the check type on an image view.
**/
void
image_view_set_check_type (ImageView *view, CheckType check_type)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->check_type == check_type)
return;
priv->check_type = check_type;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_check_type:
* @view: An image view.
*
* Queries the check type of an image view.
*
* Return value: Check type.
**/
CheckType
image_view_get_check_type (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, CHECK_TYPE_BLACK);
g_return_val_if_fail (IS_IMAGE_VIEW (view), CHECK_TYPE_BLACK);
priv = view->priv;
return priv->check_type;
}
/**
* image_view_set_check_size:
* @view: An image view.
* @check_size: Check size.
*
* Sets the check size on an image view.
**/
void
image_view_set_check_size (ImageView *view, CheckSize check_size)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->check_size == check_size)
return;
priv->check_size = check_size;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_check_size:
* @view: An image view.
*
* Queries the check size on an image view.
*
* Return value: Check size.
**/
CheckSize
image_view_get_check_size (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, CHECK_SIZE_SMALL);
g_return_val_if_fail (IS_IMAGE_VIEW (view), CHECK_SIZE_SMALL);
priv = view->priv;
return priv->check_size;
}
/**
* image_view_set_dither:
* @view: An image view.
* @dither: Dither type.
*
* Sets the dither type on an image view.
**/
void
image_view_set_dither (ImageView *view, GdkRgbDither dither)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->dither == dither)
return;
priv->dither = dither;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_dither:
* @view: An image view.
*
* Queries the dither type of an image view.
*
* Return value: Dither type.
**/
GdkRgbDither
image_view_get_dither (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, GDK_RGB_DITHER_NONE);
g_return_val_if_fail (IS_IMAGE_VIEW (view), GDK_RGB_DITHER_NONE);
priv = view->priv;
return priv->dither;
}
/**
* image_view_set_scroll:
* @view: An image view.
* @scroll: Scrolling type.
*
* Sets the scrolling type on an image view.
**/
void
image_view_set_scroll (ImageView *view, ScrollType scroll)
{
ImageViewPrivate *priv;
g_return_if_fail (view != NULL);
g_return_if_fail (IS_IMAGE_VIEW (view));
priv = view->priv;
if (priv->scroll == scroll)
return;
priv->scroll = scroll;
gtk_widget_queue_draw (GTK_WIDGET (view));
}
/**
* image_view_get_scroll:
* @view: An image view.
*
* Queries the scrolling type of an image view.
*
* Return value: Scrolling type.
**/
ScrollType
image_view_get_scroll (ImageView *view)
{
ImageViewPrivate *priv;
g_return_val_if_fail (view != NULL, SCROLL_NORMAL);
g_return_val_if_fail (IS_IMAGE_VIEW (view), SCROLL_NORMAL);
priv = view->priv;
return priv->scroll;
}

View file

@ -25,6 +25,7 @@
#include <libgnome/gnome-defs.h>
#include <gtk/gtkwidget.h>
#include "image.h"
#include "preferences.h"
BEGIN_GNOME_DECLS
@ -62,12 +63,29 @@ GtkType image_view_get_type (void);
GtkWidget *image_view_new (void);
void image_view_set_preferences (ImageView *view);
void image_view_set_image (ImageView *view, Image *image);
Image *image_view_get_image (ImageView *view);
void image_view_set_zoom (ImageView *view, double zoom);
double image_view_get_zoom (ImageView *view);
void image_view_set_interp_type (ImageView *view, GdkInterpType interp_type);
GdkInterpType image_view_get_interp_type (ImageView *view);
void image_view_set_check_type (ImageView *view, CheckType check_type);
CheckType image_view_get_check_type (ImageView *view);
void image_view_set_check_size (ImageView *view, CheckSize check_size);
CheckSize image_view_get_check_size (ImageView *view);
void image_view_set_dither (ImageView *view, GdkRgbDither dither);
GdkRgbDither image_view_get_dither (ImageView *view);
void image_view_set_scroll (ImageView *view, ScrollType scroll);
ScrollType image_view_get_scroll (ImageView *view);
END_GNOME_DECLS

View file

@ -21,6 +21,7 @@
#include <config.h>
#include <gnome.h>
#include "preferences.h"
#include "stock.h"
#include "util.h"
#include "window.h"
@ -41,6 +42,7 @@ main (int argc, char **argv)
gdk_rgb_init ();
stock_init ();
prefs_init ();
args = poptGetArgs (ctx);

View file

@ -0,0 +1,616 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>EOG</name>
<program_name>eog</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>False</use_widget_names>
<output_main_file>True</output_main_file>
<output_support_files>True</output_support_files>
<output_build_files>True</output_build_files>
<backup_source_files>True</backup_source_files>
<main_source_file>interface.c</main_source_file>
<main_header_file>interface.h</main_header_file>
<handler_source_file>callbacks.c</handler_source_file>
<handler_header_file>callbacks.h</handler_header_file>
<support_source_file>support.c</support_source_file>
<support_header_file>support.h</support_header_file>
<output_translatable_strings>True</output_translatable_strings>
<translatable_strings_file>preferences-dialog.glade.h</translatable_strings_file>
</project>
<widget>
<class>GnomePropertyBox</class>
<name>PreferencesDialog</name>
<cxx_use_heap>True</cxx_use_heap>
<widget>
<class>GtkNotebook</class>
<child_name>GnomePropertyBox:notebook</child_name>
<name>notebook1</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox4</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkTable</class>
<name>table1</name>
<cxx_use_heap>True</cxx_use_heap>
<rows>5</rows>
<columns>2</columns>
<homogeneous>True</homogeneous>
<row_spacing>2</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Interpolation type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label4</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Transparency type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label5</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Check size</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>TransparencyType</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Dark checks
Midtone checks
Light checks
Black only
Gray only
White only
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>CheckSize</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Small
Medium
Large
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>InterpolationType</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Nearest neighbor
Bilinear
Hyperbolic
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>TwoPassScrolling</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Two-pass scrolling</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<left_attach>0</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label8</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Dither type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>DitherType</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>None
Normal (pseudocolor)
Maximum (high color)
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label1</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Display</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox1</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>4</spacing>
<widget>
<class>GtkFrame</class>
<name>frame1</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Image Windows</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox2</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkHBox</class>
<name>hbox1</name>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label6</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Use scrollbars</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>WindowScrollbars</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Never
Only if image does not fit
</items>
<initial_choice>0</initial_choice>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
</widget>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>WindowAutoSize</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Pick window size and zoom factor automatically</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>OpenNewWindow</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Open images in a new window</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
<widget>
<class>GtkFrame</class>
<name>frame2</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Full Screen</label>
<label_xalign>0</label_xalign>
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkVBox</class>
<name>vbox3</name>
<border_width>4</border_width>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkHBox</class>
<name>hbox2</name>
<cxx_use_heap>True</cxx_use_heap>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label7</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Use scrollbars</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkOptionMenu</class>
<name>FullScreenScrollbars</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<items>Never
Only if image does not fit
</items>
<initial_choice>0</initial_choice>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
<pack>GTK_PACK_END</pack>
</child>
</widget>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton1</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Use 1:1 zoom factor</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>FullScreenZoom</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton2</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Use same zoom factor as image window</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>FullScreenZoom</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>radiobutton3</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Fit all images to screen</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>FullScreenZoom</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator1</name>
<cxx_use_heap>True</cxx_use_heap>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>FullScreenFitStandard</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Fit standard-sized images to screen</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCheckButton</class>
<name>FullScreenBevel</name>
<cxx_use_heap>True</cxx_use_heap>
<can_focus>True</can_focus>
<label>Put a bevel around the edge of the screen</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label2</name>
<cxx_use_heap>True</cxx_use_heap>
<label>Viewers</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</GTK-Interface>

View file

@ -0,0 +1,49 @@
/*
* Translatable strings file generated by Glade.
* Add this file to your project's POTFILES.in.
* DO NOT compile it as part of your application.
*/
gchar *s = N_("Interpolation type");
gchar *s = N_("Transparency type");
gchar *s = N_("Check size");
gchar *s = N_("Dark checks\n"
"Midtone checks\n"
"Light checks\n"
"Black only\n"
"Gray only\n"
"White only\n"
"");
gchar *s = N_("Small\n"
"Medium\n"
"Large\n"
"");
gchar *s = N_("Nearest neighbor\n"
"Bilinear\n"
"Hyperbolic\n"
"");
gchar *s = N_("Two-pass scrolling");
gchar *s = N_("Dither type");
gchar *s = N_("None\n"
"Normal (pseudocolor)\n"
"Maximum (high color)\n"
"");
gchar *s = N_("Display");
gchar *s = N_("Image Windows");
gchar *s = N_("Use scrollbars");
gchar *s = N_("Never\n"
"Only if image does not fit\n"
"");
gchar *s = N_("Pick window size and zoom factor automatically");
gchar *s = N_("Open images in a new window");
gchar *s = N_("Full Screen");
gchar *s = N_("Use scrollbars");
gchar *s = N_("Never\n"
"Only if image does not fit\n"
"");
gchar *s = N_("Use 1:1 zoom factor");
gchar *s = N_("Use same zoom factor as image window");
gchar *s = N_("Fit all images to screen");
gchar *s = N_("Fit standard-sized images to screen");
gchar *s = N_("Put a bevel around the edge of the screen");
gchar *s = N_("Viewers");

84
src/preferences.c Normal file
View file

@ -0,0 +1,84 @@
/* Eye of Gnome image viewer - preferences
*
* Copyright (C) 2000 The Free Software Foundation
*
* Author: Federico Mena-Quintero <federico@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-config.h>
#include "preferences.h"
GdkInterpType prefs_interp_type;
CheckType prefs_check_type;
CheckSize prefs_check_size;
GdkRgbDither prefs_dither;
ScrollType prefs_scroll;
GtkPolicyType prefs_window_sb_policy;
gboolean prefs_window_auto_size;
gboolean prefs_open_new_window;
GtkPolicyType prefs_full_screen_sb_policy;
FullScreenZoom prefs_full_screen_zoom;
gboolean prefs_full_screen_fit_standard;
gboolean prefs_full_screen_bevel;
/**
* prefs_init:
* @void:
*
* Reads the default set of preferences. Must be called prior to any of the
* rest of the program running.
**/
void
prefs_init (void)
{
gnome_config_push_prefix ("/eog/");
prefs_interp_type = gnome_config_get_int (
"view/interp_type=2"); /* bilinear */
prefs_check_type = gnome_config_get_int (
"view/check_type=1"); /* midtone */
prefs_check_size = gnome_config_get_int (
"view/check_size=2"); /* large */
prefs_dither = gnome_config_get_int (
"view/dither=1"); /* normal */
prefs_scroll = gnome_config_get_int (
"view/scroll=1"); /* two-pass */
prefs_window_sb_policy = gnome_config_get_int (
"window/sb_policy=1"); /* automatic */
prefs_window_auto_size = gnome_config_get_bool (
"window/auto_size=1"); /* true */
prefs_open_new_window = gnome_config_get_bool (
"window/open_new_window=0"); /* false */
prefs_full_screen_sb_policy = gnome_config_get_int (
"full_screen/sb_policy=1"); /* never */
prefs_full_screen_zoom = gnome_config_get_int (
"full_screen/zoom=2"); /* fit */
prefs_full_screen_fit_standard = gnome_config_get_bool (
"full_screen/fit_standard=1"); /* true */
prefs_full_screen_bevel = gnome_config_get_bool (
"full_screen/bevel=0"); /* false */
gnome_config_pop_prefix ();
}

97
src/preferences.h Normal file
View file

@ -0,0 +1,97 @@
/* Eye of Gnome image viewer - preferences
*
* Copyright (C) 2000 The Free Software Foundation
*
* Author: Federico Mena-Quintero <federico@gimp.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef PREFERENCES_H
#define PREFERENCES_H
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtkenums.h>
/* Interpolation type for views */
extern GdkInterpType prefs_interp_type;
/* Type of checks for views */
typedef enum {
CHECK_TYPE_DARK,
CHECK_TYPE_MIDTONE,
CHECK_TYPE_LIGHT,
CHECK_TYPE_BLACK,
CHECK_TYPE_GRAY,
CHECK_TYPE_WHITE
} CheckType;
extern CheckType prefs_check_type;
/* Check size for views */
typedef enum {
CHECK_SIZE_SMALL,
CHECK_SIZE_MEDIUM,
CHECK_SIZE_LARGE
} CheckSize;
extern CheckSize prefs_check_size;
/* Dither type */
extern GdkRgbDither prefs_dither;
/* Scrolling type for views */
typedef enum {
SCROLL_NORMAL,
SCROLL_TWO_PASS
} ScrollType;
extern ScrollType prefs_scroll;
/* Scrollbar policy for image windows */
extern GtkPolicyType prefs_window_sb_policy;
/* Pick window size and zoom factor automatically for image windows */
extern gboolean prefs_window_auto_size;
/* Open images in a new window */
extern gboolean prefs_open_new_window;
/* Scrollbar policy for full screen mode */
extern GtkPolicyType prefs_full_screen_sb_policy;
/* Automatic zoom for full screen mode */
typedef enum {
FULL_SCREEN_ZOOM_1,
FULL_SCREEN_ZOOM_SAME_AS_WINDOW,
FULL_SCREEN_ZOOM_FIT
} FullScreenZoom;
extern FullScreenZoom prefs_full_screen_zoom;
/* Fit standard-sized images to full screen mode */
extern gboolean prefs_full_screen_fit_standard;
/* Put a bevel around the edge of the screen */
extern gboolean prefs_full_screen_bevel;
void prefs_init (void);
#endif

View file

@ -72,7 +72,7 @@ static void window_init (Window *window);
static void window_destroy (GtkObject *object);
static gint window_delete (GtkWidget *widget, GdkEventAny *event);
static gint window_key_press (GtkWidget *widget, GdkEventKey *event);
static GnomeAppClass *parent_class;
@ -207,6 +207,7 @@ static void
set_mode (Window *window, WindowMode mode)
{
WindowPrivate *priv;
ImageView *view;
priv = window->priv;
@ -233,7 +234,11 @@ set_mode (Window *window, WindowMode mode)
priv->content = ui_image_new ();
gnome_app_set_contents (GNOME_APP (window), priv->content);
gtk_widget_show (priv->content);
gtk_widget_grab_focus (ui_image_get_image_view (UI_IMAGE (priv->content)));
view = IMAGE_VIEW (ui_image_get_image_view (UI_IMAGE (priv->content)));
image_view_set_preferences (view);
gtk_widget_grab_focus (GTK_WIDGET (view));
break;
case WINDOW_MODE_COLLECTION:
@ -365,6 +370,8 @@ static GnomeUIInfo file_menu[] = {
cmd_cb_window_close, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CLOSE,
'w', GDK_CONTROL_MASK, NULL },
#define FILE_EXIT_INDEX 4
GNOMEUIINFO_MENU_EXIT_ITEM (exit_cmd, NULL),
GNOMEUIINFO_END
};
@ -480,6 +487,7 @@ window_class_init (WindowClass *class)
object_class->destroy = window_destroy;
widget_class->delete_event = window_delete;
widget_class->key_press_event = window_key_press;
}
/* Object initialization function for windows */
@ -531,6 +539,33 @@ window_delete (GtkWidget *widget, GdkEventAny *event)
return TRUE;
}
/* Key press handler for windows */
static gint
window_key_press (GtkWidget *widget, GdkEventKey *event)
{
gint result;
result = FALSE;
if (GTK_WIDGET_CLASS (parent_class)->key_press_event)
result = (* GTK_WIDGET_CLASS (parent_class)->key_press_event) (widget, event);
if (result)
return result;
switch (event->keyval) {
case GDK_Q:
case GDK_q:
exit_cmd (NULL, widget);
break;
default:
return FALSE;
}
return TRUE;
}
/**
* window_new:
* @void: