diff --git a/org.libvips.vipsdisp.gschema.xml b/org.libvips.vipsdisp.gschema.xml
index f8b54c7..0db0caf 100644
--- a/org.libvips.vipsdisp.gschema.xml
+++ b/org.libvips.vipsdisp.gschema.xml
@@ -31,14 +31,6 @@
-
- 500
- Properties pane divider position
-
- Position of the properties pane divider.
-
-
-
1.0
Scale
diff --git a/src/animatedpane.c b/src/animatedpane.c
deleted file mode 100644
index f0edc17..0000000
--- a/src/animatedpane.c
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
-#define DEBUG
- */
-
-#include "vipsdisp.h"
-
-/* Duration of the GtkPaned enter/leave animations
- */
-#define PANED_DURATION (0.5)
-
-struct _Animatedpane
-{
- GtkWidget parent_instance;
-
- GtkWidget *paned;
-
- // right hand pane is visible
- gboolean revealed;
-
- // distance of the divider from the RIGHT edge of the window
- int position;
-
- // animation state.
- double elapsed;
- double last_frame_time;
- gboolean is_animating;
-
- /* The positions we animate between.
- */
- int start;
- int stop;
-};
-
-enum {
- // all the gtkpaned properties ... we don't use the same numbering
- PROP_POSITION = 1,
- PROP_POSITION_SET,
- PROP_MIN_POSITION,
- PROP_MAX_POSITION,
- PROP_WIDE_HANDLE,
- PROP_RESIZE_START_CHILD,
- PROP_RESIZE_END_CHILD,
- PROP_SHRINK_START_CHILD,
- PROP_SHRINK_END_CHILD,
- PROP_START_CHILD,
- PROP_END_CHILD,
- PROP_ORIENTATION,
-
- // the one we add
- PROP_REVEALED,
-
- PROP_LAST
-};
-
-static void animatedpane_buildable_iface_init( GtkBuildableIface *iface );
-
-/* We need to support buildable too.
- */
-G_DEFINE_TYPE_WITH_CODE( Animatedpane, animatedpane, GTK_TYPE_WIDGET,
- G_IMPLEMENT_INTERFACE( GTK_TYPE_BUILDABLE,
- animatedpane_buildable_iface_init ) )
-
-static GtkBuildableIface *parent_buildable_iface;
-
-// map prop enums to and from gtk names
-static const char *prop_names[] = {
- "", // no prop_id 0
- "position",
- "position-set",
- "min-position",
- "max-position",
- "wide-handle",
- "resize-start-child",
- "resize-end-child",
- "shrink-start-child",
- "shrink-end-child",
- "start-child",
- "end-child",
- "orientation",
- "revealed"
-};
-
-// try to respect the animations on/off flag
-static gboolean
-animatedpaned_enable_animations( Animatedpane *animatedpane )
-{
- gboolean enable_animations;
-
- g_object_get( gtk_widget_get_settings( GTK_WIDGET( animatedpane ) ),
- "gtk-enable-animations", &enable_animations,
- NULL );
-
- return( enable_animations );
-}
-
-static void
-animatedpaned_set_child_visibility( Animatedpane *animatedpane,
- gboolean revealed )
-{
-#ifdef DEBUG
- printf( "animatedpaned_set_child_visibility: %d\n", revealed );
-#endif /* DEBUG */
-
- GtkWidget *child =
- gtk_paned_get_end_child( GTK_PANED( animatedpane->paned ) );
-
- if( revealed )
- gtk_widget_show( child );
- else
- gtk_widget_hide( child );
-
-}
-
-static void
-animatedpaned_set_child_position( Animatedpane *animatedpane, int position )
-{
- // our position is distance from the right edge -- we must swap this
- int widget_width = gtk_widget_get_width( GTK_WIDGET( animatedpane ) );
- // widget_width will be zero on startup and we want the thing to come in
- // from the right, so we need a large value
- int paned_position = widget_width == 0 ? 10000 : widget_width - position;
-
- gtk_paned_set_position( GTK_PANED( animatedpane->paned ),
- paned_position );
-}
-
-/* From clutter-easing.c, based on Robert Penner's infamous easing equations,
- * MIT license.
- */
-static double
-ease_out_cubic( double t )
-{
- double p = t - 1;
-
- return( p * p * p + 1 );
-}
-
-static gboolean
-animatedpane_animate_tick( GtkWidget *widget, GdkFrameClock *frame_clock,
- gpointer client_data )
-{
- Animatedpane *animatedpane = ANIMATEDPANE( widget );
- gint64 frame_time = gdk_frame_clock_get_frame_time( frame_clock );
-
- double t;
-
- gint64 dt = animatedpane->last_frame_time > 0 ?
- frame_time - animatedpane->last_frame_time :
- 0;
- animatedpane->last_frame_time = frame_time;
-
- animatedpane->elapsed += (double) dt / G_TIME_SPAN_SECOND;
-
- t = ease_out_cubic( animatedpane->elapsed / PANED_DURATION );
-
-#ifdef DEBUG
- printf( "animatedpane_animate_tick: elapsed = %g\n",
- animatedpane->elapsed );
-#endif /* DEBUG */
-
- if( t >= 0.99 ) {
- // all done
- animatedpaned_set_child_position( animatedpane, animatedpane->stop );
- if( !animatedpane->revealed )
- animatedpaned_set_child_visibility( animatedpane, FALSE );
- animatedpane->is_animating = FALSE;
-
- return( G_SOURCE_REMOVE );
- }
- else {
- gint position = animatedpane->start +
- t * (animatedpane->stop - animatedpane->start);
-
- animatedpaned_set_child_position( animatedpane, position );
-
- return( G_SOURCE_CONTINUE );
- }
-}
-
-static void
-animatedpaned_set_revealed( Animatedpane *animatedpane, gboolean revealed )
-{
-#ifdef DEBUG
- printf( "animatedpaned_set_revealed: %d\n", revealed );
-#endif /* DEBUG */
-
- if( animatedpane->revealed != revealed ) {
- animatedpane->revealed = revealed;
-
- if( animatedpaned_enable_animations( animatedpane ) ) {
- animatedpane->last_frame_time = -1;
- animatedpane->elapsed = 0.0;
- animatedpane->is_animating = TRUE;
-
- animatedpane->start = animatedpane->position;
- animatedpane->stop = 0;
- if( revealed )
- VIPS_SWAP( int, animatedpane->start, animatedpane->stop );
-
- animatedpaned_set_child_position( animatedpane,
- animatedpane->start );
-
- if( revealed )
- animatedpaned_set_child_visibility( animatedpane, TRUE );
-
- gtk_widget_add_tick_callback( GTK_WIDGET( animatedpane ),
- animatedpane_animate_tick, NULL, NULL );
- }
- else
- animatedpaned_set_child_visibility( animatedpane, revealed );
- }
-}
-
-static void
-animatedpane_dispose( GObject *object )
-{
- Animatedpane *animatedpane = ANIMATEDPANE( object );
-
-#ifdef DEBUG
- printf( "animatedpane_dispose:\n" );
-#endif /*DEBUG*/
-
- VIPS_FREEF( gtk_widget_unparent, animatedpane->paned );
-
- G_OBJECT_CLASS( animatedpane_parent_class )->dispose( object );
-}
-
-#ifdef DEBUG
-static const char *
-animatedpane_property_name( guint prop_id )
-{
- if( prop_id < PROP_LAST )
- return( prop_names[prop_id] );
- else
- return( "" );
-}
-#endif /*DEBUG*/
-
-static void
-animatedpane_set_property( GObject *object,
- guint prop_id, const GValue *value, GParamSpec *pspec )
-{
- Animatedpane *animatedpane = ANIMATEDPANE( object );
-
-#ifdef DEBUG
-{
- char *str;
-
- str = g_strdup_value_contents( value );
- printf( "animatedpane_set_property: %s %s\n",
- animatedpane_property_name( prop_id ), str );
- g_free( str );
-}
-#endif /*DEBUG*/
-
- if( prop_id == PROP_REVEALED )
- animatedpaned_set_revealed( animatedpane,
- g_value_get_boolean( value ) );
- else if( prop_id == PROP_POSITION ) {
- animatedpane->position = g_value_get_int( value );
- animatedpaned_set_child_position( animatedpane,
- animatedpane->position );
- }
- else if( prop_id < PROP_REVEALED )
- g_object_set_property( G_OBJECT( animatedpane->paned ),
- prop_names[prop_id], value );
- else
- G_OBJECT_WARN_INVALID_PROPERTY_ID( object, prop_id, pspec );
-
- // if we just added the child, set the initial visibility
- if( prop_id == PROP_END_CHILD )
- animatedpaned_set_child_visibility( animatedpane,
- animatedpane->revealed );
-}
-
-static void
-animatedpane_get_property( GObject *object,
- guint prop_id, GValue *value, GParamSpec *pspec )
-{
- Animatedpane *animatedpane = ANIMATEDPANE( object );
-
- if( prop_id == PROP_REVEALED )
- g_value_set_boolean( value, animatedpane->revealed );
- else if( prop_id == PROP_POSITION )
- g_value_set_int( value, animatedpane->position );
- else if( prop_id < PROP_REVEALED )
- g_object_get_property( G_OBJECT( animatedpane->paned ),
- prop_names[prop_id], value );
- else
- G_OBJECT_WARN_INVALID_PROPERTY_ID( object, prop_id, pspec );
-
-#ifdef DEBUG
-{
- char *str;
-
- str = g_strdup_value_contents( value );
- printf( "animatedpane_get_property: %s %s\n",
- animatedpane_property_name( prop_id ), str );
- g_free( str );
-}
-#endif /*DEBUG*/
-}
-
-static void
-animatedpane_position_notify( GtkWidget *paned,
- GParamSpec *pspec, gpointer user_data )
-{
- GtkWidget *parent = gtk_widget_get_parent( paned );
- Animatedpane *animatedpane = ANIMATEDPANE( parent );
-
- if( animatedpane->revealed &&
- !animatedpane->is_animating ) {
- // FIXME ... could get from pspec?
- int paned_position = gtk_paned_get_position( GTK_PANED( paned ) );
-
- // our position is distance from the right edge -- we must swap this
- int widget_width = gtk_widget_get_width( GTK_WIDGET( animatedpane ) );
- int position = widget_width - paned_position;
-
-#ifdef DEBUG
- printf( "animatedpane_position_notify: new position %d\n", position );
-#endif /* DEBUG */
-
- if( animatedpane->position != position )
- g_object_set( animatedpane, "position", position, NULL );
- }
-}
-
-static void
-animatedpane_init( Animatedpane *animatedpane )
-{
-#ifdef DEBUG
- printf( "animatedpane_init:\n" );
-#endif /*DEBUG*/
-
- // distance of the divider from the RIGHT edge of the window
- animatedpane->position = 500;
-
- // it'd be nice to create our gtkpaned in animatedpane.ui, but we need
- // this pointer during builder
- animatedpane->paned = gtk_paned_new( GTK_ORIENTATION_HORIZONTAL );
- gtk_widget_set_parent( animatedpane->paned, GTK_WIDGET( animatedpane ) );
-
- gtk_widget_init_template( GTK_WIDGET( animatedpane ) );
-
- g_signal_connect( animatedpane->paned, "notify::position",
- G_CALLBACK( animatedpane_position_notify ), animatedpane );
-}
-
-// copy-paste from gtkpaned to get the GTK property flags
-#define GTK_PARAM_READABLE \
- (G_PARAM_READABLE | \
- G_PARAM_STATIC_NAME | \
- G_PARAM_STATIC_NICK | \
- G_PARAM_STATIC_BLURB)
-
-#define GTK_PARAM_READWRITE \
- (G_PARAM_READWRITE | \
- G_PARAM_STATIC_NAME | \
- G_PARAM_STATIC_NICK | \
- G_PARAM_STATIC_BLURB)
-
-static void
-animatedpane_class_init( AnimatedpaneClass *class )
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS( class );
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS( class );
-
-#ifdef DEBUG
- printf( "animatedpane_class_init:\n" );
-#endif /*DEBUG*/
-
- gtk_widget_class_set_layout_manager_type( widget_class,
- GTK_TYPE_BIN_LAYOUT );
- gtk_widget_class_set_template_from_resource( GTK_WIDGET_CLASS( class ),
- APP_PATH "/animatedpane.ui");
-
- gobject_class->dispose = animatedpane_dispose;
- gobject_class->set_property = animatedpane_set_property;
- gobject_class->get_property = animatedpane_get_property;
-
- // the GtkPaned properties we support
- g_object_class_install_property( gobject_class, PROP_POSITION,
- g_param_spec_int( "position", NULL, NULL,
- 0, G_MAXINT, 0,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_POSITION_SET,
- g_param_spec_boolean( "position-set", NULL, NULL,
- FALSE,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_MIN_POSITION,
- g_param_spec_int( "min-position", NULL, NULL,
- 0, G_MAXINT, 0,
- GTK_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_MAX_POSITION,
- g_param_spec_int( "max-position", NULL, NULL,
- 0, G_MAXINT, G_MAXINT,
- GTK_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_WIDE_HANDLE,
- g_param_spec_boolean( "wide-handle", NULL, NULL,
- FALSE,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_RESIZE_START_CHILD,
- g_param_spec_boolean( "resize-start-child", NULL, NULL,
- TRUE,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_RESIZE_END_CHILD,
- g_param_spec_boolean( "resize-end-child", NULL, NULL,
- TRUE,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_SHRINK_START_CHILD,
- g_param_spec_boolean( "shrink-start-child", NULL, NULL,
- TRUE,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_SHRINK_END_CHILD,
- g_param_spec_boolean( "shrink-end-child", NULL, NULL,
- TRUE,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_START_CHILD,
- g_param_spec_object( "start-child", NULL, NULL,
- GTK_TYPE_WIDGET,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- g_object_class_install_property( gobject_class, PROP_END_CHILD,
- g_param_spec_object( "end-child", NULL, NULL,
- GTK_TYPE_WIDGET,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- // not defined by gtkpaned -- this is from the orientable interface, but
- // we need to forward it anyway
- g_object_class_install_property( gobject_class, PROP_ORIENTATION,
- g_param_spec_enum( "orientation", NULL, NULL,
- GTK_TYPE_ORIENTATION,
- GTK_ORIENTATION_HORIZONTAL,
- GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
-
- // the one property we add
- g_object_class_install_property( gobject_class, PROP_REVEALED,
- g_param_spec_boolean( "revealed",
- _( "revealed" ),
- _( "Show the pane child" ),
- FALSE,
- G_PARAM_READWRITE ) );
-}
-
-static void
-animatedpane_buildable_add_child( GtkBuildable *buildable,
- GtkBuilder *builder, GObject *child, const char *type )
-{
-#ifdef DEBUG
- printf( "animatedpane_buildable_add_child: %s\n", type );
-#endif /*DEBUG*/
-
- Animatedpane *self = ANIMATEDPANE( buildable );
- GtkBuildable *paned_buildable = GTK_BUILDABLE( self->paned );
- GtkBuildableIface *paned_iface = GTK_BUILDABLE_GET_IFACE( self->paned );
-
- paned_iface->add_child( paned_buildable, builder, child, type );
-}
-
-static void
-animatedpane_buildable_iface_init( GtkBuildableIface *iface )
-{
- parent_buildable_iface = g_type_interface_peek_parent( iface );
- iface->add_child = animatedpane_buildable_add_child;
-}
-
diff --git a/src/animatedpane.h b/src/animatedpane.h
deleted file mode 100644
index e9160b1..0000000
--- a/src/animatedpane.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __ANIMATEDPANE_H
-#define __ANIMATEDPANE_H
-
-#define ANIMATEDPANE_TYPE (animatedpane_get_type())
-
-// not correct, but gtk does not export this
-typedef struct _GtkPanedClass {
- GtkWidgetClass parent_class;
-
- // true for gtk master at least
- void *used_by_gtk[6];
-} GtkPanedClass;
-
-G_DECLARE_FINAL_TYPE( Animatedpane, animatedpane,
- VIPSDISP, ANIMATEDPANE, GtkPaned )
-
-#define ANIMATEDPANE( obj ) \
- (G_TYPE_CHECK_INSTANCE_CAST( (obj), \
- ANIMATEDPANE_TYPE, Animatedpane ))
-
-Animatedpane *animatedpane_new( void );
-
-#endif /* __ANIMATEDPANE_H */
diff --git a/src/gtk/imagewindow.ui b/src/gtk/imagewindow.ui
index 12963d4..e8c4521 100644
--- a/src/gtk/imagewindow.ui
+++ b/src/gtk/imagewindow.ui
@@ -165,6 +165,7 @@
diff --git a/src/gtk/properties.ui b/src/gtk/properties.ui
index 4550800..d0d6986 100644
--- a/src/gtk/properties.ui
+++ b/src/gtk/properties.ui
@@ -1,31 +1,41 @@
- true
+ false
true
- 10px
- 10px
-
- vertical
- true
+
+ slide-right
+ false
true
-
- 10px
- 10px
- true
- Filter properties
-
-
-
-
-
- true
+
+ 10px
+ 10px
+ vertical
+ false
true
-
+
+
+
+ 10px
+ 10px
+ true
+ Filter properties
+
+
+
+
+
+ true
+ true
+ never
+
+
+
+
diff --git a/src/imagewindow.c b/src/imagewindow.c
index 4411256..56db866 100644
--- a/src/imagewindow.c
+++ b/src/imagewindow.c
@@ -53,12 +53,12 @@ struct _ImageWindow
GtkWidget *progress_cancel;
GtkWidget *error_bar;
GtkWidget *error_label;
+ GtkWidget *main_box;
GtkWidget *scrolled_window;
GtkWidget *imagedisplay;
+ GtkWidget *properties;
GtkWidget *display_bar;
GtkWidget *info_bar;
- GtkWidget *properties_pane;
- GtkWidget *properties;
/* Throttle progress bar updates to a few per second with this.
*/
@@ -87,7 +87,7 @@ static guint image_window_signals[SIG_LAST] = { 0 };
static void
image_window_dispose( GObject *object )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( object );
+ ImageWindow *win = IMAGE_WINDOW( object );
#ifdef DEBUG
printf( "image_window_dispose:\n" );
@@ -412,7 +412,7 @@ static gboolean
image_window_tick( GtkWidget *widget,
GdkFrameClock *frame_clock, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
gint64 frame_time = gdk_frame_clock_get_frame_time( frame_clock );
double dt = win->last_frame_time > 0 ?
@@ -496,8 +496,8 @@ static void
image_window_animate_bestfit( ImageWindow *win )
{
// size by whole image area, including the props pane
- int widget_width = gtk_widget_get_width( win->properties_pane );
- int widget_height = gtk_widget_get_height( win->properties_pane );
+ int widget_width = gtk_widget_get_width( win->main_box );
+ int widget_height = gtk_widget_get_height( win->main_box );
double hscale = (double) widget_width / win->tile_source->display_width;
double vscale = (double) widget_height / win->tile_source->display_height;
@@ -524,7 +524,7 @@ static void
image_window_magin_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
image_window_animate_scale_to( win, 2 * image_window_get_scale( win ) );
image_window_start_animation( win );
@@ -534,7 +534,7 @@ static void
image_window_magout_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
image_window_animate_scale_to( win, 0.5 * image_window_get_scale( win ) );
image_window_start_animation( win );
@@ -544,7 +544,7 @@ static void
image_window_bestfit_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
image_window_animate_bestfit( win );
image_window_start_animation( win );
@@ -554,7 +554,7 @@ static void
image_window_oneone_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
image_window_set_scale( win, 1.0 );
}
@@ -563,7 +563,7 @@ static void
image_window_duplicate_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
VipsdispApp *app;
TileSource *tile_source;
@@ -590,7 +590,6 @@ image_window_duplicate_action( GSimpleAction *action,
copy_state( GTK_WIDGET( new ), GTK_WIDGET( win ), "control" );
copy_state( GTK_WIDGET( new ), GTK_WIDGET( win ), "info" );
copy_state( GTK_WIDGET( new ), GTK_WIDGET( win ), "properties" );
- copy_state( GTK_WIDGET( new ), GTK_WIDGET( win ), "properties-position" );
copy_state( GTK_WIDGET( new ), GTK_WIDGET( win ), "background" );
/* We want to init the scroll position, but we can't do that until the
@@ -616,7 +615,7 @@ static void
image_window_on_file_open_cb( GObject* source_object,
GAsyncResult* res, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
GtkFileDialog *dialog = GTK_FILE_DIALOG( source_object );
GFile *file;
@@ -634,7 +633,7 @@ static void
image_window_replace_response( GtkDialog *dialog,
gint response_id, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( response_id == GTK_RESPONSE_ACCEPT ) {
GFile *file;
@@ -654,7 +653,7 @@ static void
image_window_replace_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
#if GTK_CHECK_VERSION(4, 10, 0)
@@ -734,7 +733,7 @@ static void
image_window_on_file_save_cb( GObject* source_object,
GAsyncResult* res, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
GtkFileDialog *dialog = GTK_FILE_DIALOG( source_object );
GFile *file;
@@ -770,7 +769,7 @@ static void
image_window_saveas_response( GtkDialog *dialog,
gint response, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( response == GTK_RESPONSE_ACCEPT ) {
GFile *file;
@@ -808,7 +807,7 @@ static void
image_window_saveas_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( win->tile_source ) {
#if GTK_CHECK_VERSION(4, 10, 0)
@@ -862,7 +861,7 @@ static void
image_window_close_action( GSimpleAction *action,
GVariant *parameter, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
gtk_window_destroy( GTK_WINDOW( win ) );
}
@@ -886,7 +885,7 @@ static gboolean
image_window_key_pressed( GtkEventControllerKey *self,
guint keyval, guint keycode, GdkModifierType state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
GtkScrolledWindow *scrolled_window =
GTK_SCROLLED_WINDOW( win->scrolled_window );
@@ -1006,7 +1005,7 @@ static gboolean
image_window_key_released( GtkEventControllerKey *self,
guint keyval, guint keycode, GdkModifierType state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
gboolean handled;
@@ -1035,7 +1034,7 @@ static void
image_window_motion( GtkEventControllerMotion *self,
gdouble x, gdouble y, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
win->last_x_gtk = x;
win->last_y_gtk = y;
@@ -1047,7 +1046,7 @@ static gboolean
image_window_scroll( GtkEventControllerMotion *self,
double dx, double dy, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
double x_image;
double y_image;
@@ -1070,7 +1069,7 @@ static void
image_window_scale_begin( GtkGesture* self,
GdkEventSequence* sequence, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
double finger_cx;
double finger_cy;
@@ -1086,7 +1085,7 @@ static void
image_window_scale_changed( GtkGestureZoom *self,
gdouble scale, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
image_window_set_scale_position( win,
scale * win->last_scale, win->scale_cx, win->scale_cy );
@@ -1096,7 +1095,7 @@ static void
image_window_drag_begin( GtkEventControllerMotion *self,
gdouble start_x, gdouble start_y, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
int window_left;
int window_top;
@@ -1114,7 +1113,7 @@ static void
image_window_drag_update( GtkEventControllerMotion *self,
gdouble offset_x, gdouble offset_y, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
image_window_set_position( win,
win->drag_start_x - offset_x,
@@ -1137,7 +1136,7 @@ static void
image_window_fullscreen( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
g_object_set( win,
"fullscreened", g_variant_get_boolean( state ),
@@ -1150,7 +1149,7 @@ static void
image_window_control( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
g_object_set( win->display_bar,
"revealed", g_variant_get_boolean( state ),
@@ -1171,7 +1170,7 @@ static void
image_window_info( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
g_object_set( win->info_bar,
"revealed", g_variant_get_boolean( state ),
@@ -1183,7 +1182,7 @@ image_window_info( GSimpleAction *action,
static void
image_window_next( GSimpleAction *action, GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( win->tile_source ) {
int n_pages = win->tile_source->n_pages;
@@ -1198,7 +1197,7 @@ image_window_next( GSimpleAction *action, GVariant *state, gpointer user_data )
static void
image_window_prev( GSimpleAction *action, GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( win->tile_source ) {
int n_pages = win->tile_source->n_pages;
@@ -1247,7 +1246,7 @@ static void
image_window_scale( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
VipsImage *image;
@@ -1289,7 +1288,7 @@ image_window_scale( GSimpleAction *action,
static void
image_window_log( GSimpleAction *action, GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( win->tile_source )
g_object_set( win->tile_source,
@@ -1302,7 +1301,7 @@ image_window_log( GSimpleAction *action, GVariant *state, gpointer user_data )
static void
image_window_icc( GSimpleAction *action, GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( win->tile_source )
g_object_set( win->tile_source,
@@ -1316,7 +1315,7 @@ static void
image_window_falsecolour( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( win->tile_source )
g_object_set( win->tile_source,
@@ -1337,7 +1336,7 @@ static void
image_window_mode( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
const gchar *str;
TileSourceMode mode;
@@ -1385,7 +1384,7 @@ static void
image_window_background( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
TileCacheBackground background =
background_to_enum( g_variant_get_string( state, NULL ) );
@@ -1401,7 +1400,7 @@ static void
image_window_reset( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
if( win->tile_source )
g_object_set( win->tile_source,
@@ -1422,14 +1421,14 @@ static void
image_window_properties( GSimpleAction *action,
GVariant *state, gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
gboolean revealed = g_variant_get_boolean( state );
#ifdef DEBUG
puts("image_window_properties");
#endif /* DEBUG */
- g_object_set( win->properties_pane,
+ g_object_set( win->properties,
"revealed", revealed,
NULL );
@@ -1474,17 +1473,19 @@ static void
image_window_properties_leave( GtkEventControllerFocus *self,
gpointer user_data )
{
- ImageWindow *win = VIPSDISP_IMAGE_WINDOW( user_data );
+ ImageWindow *win = IMAGE_WINDOW( user_data );
gboolean revealed;
- g_object_get( win->properties_pane,
+ g_object_get( win->properties,
"revealed", &revealed,
NULL );
// if the props pane had the focus, and it's being hidden, we must refocus
- if( !revealed )
+ if( !revealed ) {
+ printf("image_window_properties_leave: warping focus\n");
gtk_widget_grab_focus( win->imagedisplay );
+ }
}
static void
@@ -1582,21 +1583,14 @@ image_window_init( ImageWindow *win )
G_SETTINGS_BIND_DEFAULT );
g_settings_bind( win->settings, "properties",
- G_OBJECT( win->properties_pane ),
+ G_OBJECT( win->properties ),
"revealed",
G_SETTINGS_BIND_DEFAULT );
- g_settings_bind( win->settings, "properties-position",
- G_OBJECT( win->properties_pane ),
- "position",
- G_SETTINGS_BIND_DEFAULT );
-
/* Initialise from settings.
*/
change_state( GTK_WIDGET( win ), "properties",
g_settings_get_value( win->settings, "properties" ) );
- change_state( GTK_WIDGET( win ), "properties-position",
- g_settings_get_value( win->settings, "properties-position" ) );
/* Initial menu state from settings.
*/
@@ -1604,6 +1598,10 @@ image_window_init( ImageWindow *win )
g_settings_get_value( win->settings, "control" ) );
change_state( GTK_WIDGET( win ), "info",
g_settings_get_value( win->settings, "info" ) );
+
+ // some kind of gtk bug? hepand on properties can't be set from .ui or in
+ // properties.c, but must be set after adding to a parent
+ g_object_set( win->properties, "hexpand", FALSE, NULL );
}
static void
@@ -1641,12 +1639,12 @@ image_window_class_init( ImageWindowClass *class )
BIND( progress_cancel );
BIND( error_bar );
BIND( error_label );
+ BIND( main_box );
BIND( scrolled_window );
BIND( imagedisplay );
+ BIND( properties );
BIND( display_bar );
BIND( info_bar );
- BIND( properties_pane );
- BIND( properties );
gtk_widget_class_bind_template_callback( GTK_WIDGET_CLASS( class ),
image_window_pressed_cb );
diff --git a/src/imagewindow.h b/src/imagewindow.h
index 9523f29..9df1147 100644
--- a/src/imagewindow.h
+++ b/src/imagewindow.h
@@ -3,6 +3,8 @@
#define IMAGE_WINDOW_TYPE (image_window_get_type())
+#define VIPSDISP_IMAGE_WINDOW IMAGE_WINDOW
+
G_DECLARE_FINAL_TYPE( ImageWindow, image_window,
VIPSDISP, IMAGE_WINDOW, GtkApplicationWindow )
diff --git a/src/meson.build b/src/meson.build
index a4e34c3..3538f84 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -13,7 +13,6 @@ resources = gnome.compile_resources(
executable('vipsdisp', [
marshal,
resources,
- 'animatedpane.c',
'displaybar.c',
'gtkutil.c',
'imagedisplay.c',
diff --git a/src/properties.c b/src/properties.c
index b7d1cbd..4377af8 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -12,6 +12,7 @@ struct _Properties
TileSource *tile_source;
+ GtkWidget *revealer;
GtkWidget *properties;
GtkWidget *search_entry;
GtkWidget *scrolled_window;
@@ -29,6 +30,7 @@ G_DEFINE_TYPE( Properties, properties, GTK_TYPE_WIDGET );
enum {
PROP_TILE_SOURCE = 1,
+ PROP_REVEALED,
SIG_LAST
};
@@ -42,6 +44,10 @@ properties_property_name( guint prop_id )
return( "TILE_SOURCE" );
break;
+ case PROP_REVEALED:
+ return( "REVEALED" );
+ break;
+
default:
return( "" );
}
@@ -100,7 +106,6 @@ properties_add_item( Properties *p, const char *field, GValue *value )
// can't set alignment in CSS for some reason
gtk_widget_set_halign( label, GTK_ALIGN_START );
gtk_label_set_selectable( GTK_LABEL( label ), TRUE );
- gtk_label_set_ellipsize( GTK_LABEL( label ), PANGO_ELLIPSIZE_END );
properties_add_row( p, field, label );
}
@@ -226,7 +231,7 @@ properties_search_changed( GtkWidget *search_entry, gpointer user_data )
}
#ifdef DEBUG
- printf( "properties_search_changed: pattern = "%s"\n", p->pattern );
+ printf( "properties_search_changed: pattern = %s\n", p->pattern );
#endif
properties_refresh( p );
@@ -241,7 +246,7 @@ properties_dispose( GObject *p_ )
printf( "properties_dispose:\n" );
#endif
- VIPS_FREEF( gtk_widget_unparent, p->properties );
+ VIPS_FREEF( gtk_widget_unparent, p->revealer );
VIPS_FREE( p->pattern );
G_OBJECT_CLASS( properties_parent_class )->dispose( p_ );
@@ -270,25 +275,23 @@ properties_set_property( GObject *object, guint prop_id,
TILE_SOURCE( g_value_get_object( value ) ) );
break;
+ case PROP_REVEALED:
+ gboolean revealed = g_value_get_boolean( value );
+ gboolean current_revealed =
+ gtk_revealer_get_reveal_child( GTK_REVEALER( p->revealer ) );
+
+ if( current_revealed != revealed ) {
+ gtk_revealer_set_reveal_child( GTK_REVEALER( p->revealer ),
+ revealed );
+ g_object_notify_by_pspec( object, pspec );
+ }
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( p, prop_id, pspec );
}
}
-/* This function lets you read the custom properties "image-window" and
- * "revealed".
- *
- * @p_ gpointer (Properties *) this
- *
- * @prop_id This is the signal id, e.g. PROP_TILE_SOURCE, defined in the
- * enum above.
- *
- * @v The current value of the property.
- *
- * @pspec The param spec for the property corresponding to @prop_id.
- *
- * (GObject boilerplate)
- */
static void
properties_get_property( GObject *p_,
guint prop_id, GValue *value, GParamSpec *pspec )
@@ -300,6 +303,11 @@ properties_get_property( GObject *p_,
g_value_set_object( value, p->tile_source );
break;
+ case PROP_REVEALED:
+ g_value_set_boolean( value,
+ gtk_revealer_get_reveal_child( GTK_REVEALER( p->revealer ) ) );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( p_, prop_id, pspec );
}
@@ -358,6 +366,7 @@ properties_class_init( PropertiesClass *class )
gtk_widget_class_set_template_from_resource( widget_class,
APP_PATH "/properties.ui");
+ BIND( revealer );
BIND( properties );
BIND( search_entry );
BIND( scrolled_window );
@@ -371,4 +380,9 @@ properties_class_init( PropertiesClass *class )
_( "The tile source whose properties we display" ),
TILE_SOURCE_TYPE,
G_PARAM_READWRITE ) );
+
+ g_object_class_install_property( gobject_class, PROP_REVEALED,
+ g_param_spec_boolean( "revealed", NULL, NULL,
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY ) );
}
diff --git a/src/properties.h b/src/properties.h
index 7334dfc..9c7c036 100644
--- a/src/properties.h
+++ b/src/properties.h
@@ -5,9 +5,6 @@
G_DECLARE_FINAL_TYPE( Properties, properties, VIPSDISP, PROPERTIES, GtkWidget );
-#define PROPERTIES( obj ) \
- (G_TYPE_CHECK_INSTANCE_CAST( (obj), PROPERTIES_TYPE, Properties ))
-
-void properties_apply( Properties *p );
+#define PROPERTIES VIPSDISP_PROPERTIES
#endif /* __PROPERTIES_H */
diff --git a/src/vipsdisp.h b/src/vipsdisp.h
index fc5aaa3..cd0b044 100644
--- a/src/vipsdisp.h
+++ b/src/vipsdisp.h
@@ -35,7 +35,6 @@
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#include "gtkutil.h"
-#include "animatedpane.h"
#include "tslider.h"
#include "vipsdispapp.h"
#include "vipsdispmarshal.h"
diff --git a/src/vipsdispapp.c b/src/vipsdispapp.c
index 2a4004c..4fc5c3e 100644
--- a/src/vipsdispapp.c
+++ b/src/vipsdispapp.c
@@ -135,7 +135,6 @@ vipsdisp_app_startup( GApplication *app )
TSLIDER_TYPE;
INFOBAR_TYPE;
PROPERTIES_TYPE;
- ANIMATEDPANE_TYPE;
g_action_map_add_action_entries( G_ACTION_MAP( app ),
app_entries, G_N_ELEMENTS( app_entries ),