diff options
Diffstat (limited to 'src/book-view.c')
-rw-r--r-- | src/book-view.c | 3891 |
1 files changed, 3891 insertions, 0 deletions
diff --git a/src/book-view.c b/src/book-view.c new file mode 100644 index 0000000..4ae0fd2 --- /dev/null +++ b/src/book-view.c @@ -0,0 +1,3891 @@ +/* book-view.c generated by valac 0.24.0, the Vala compiler + * generated from book-view.vala, do not modify */ + +/* + * Copyright (C) 2009-2011 Canonical Ltd. + * Author: Robert Ancell <robert.ancell@canonical.com> + * + * 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 3 of the License, or (at your option) any later + * version. See http://www.gnu.org/copyleft/gpl.html the full text of the + * license. + */ +/* FIXME: When scrolling, copy existing render sideways?*/ +/* FIXME: Only render pages that change and only the part that changed*/ + +#include <glib.h> +#include <glib-object.h> +#include <gtk/gtk.h> +#include <gdk/gdk.h> +#include <cairo.h> +#include <float.h> +#include <math.h> + + +#define TYPE_BOOK_VIEW (book_view_get_type ()) +#define BOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOOK_VIEW, BookView)) +#define BOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOOK_VIEW, BookViewClass)) +#define IS_BOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOOK_VIEW)) +#define IS_BOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOOK_VIEW)) +#define BOOK_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOOK_VIEW, BookViewClass)) + +typedef struct _BookView BookView; +typedef struct _BookViewClass BookViewClass; +typedef struct _BookViewPrivate BookViewPrivate; + +#define TYPE_BOOK (book_get_type ()) +#define BOOK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_BOOK, Book)) +#define BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_BOOK, BookClass)) +#define IS_BOOK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_BOOK)) +#define IS_BOOK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_BOOK)) +#define BOOK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_BOOK, BookClass)) + +typedef struct _Book Book; +typedef struct _BookClass BookClass; + +#define TYPE_PAGE (page_get_type ()) +#define PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE, Page)) +#define PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE, PageClass)) +#define IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE)) +#define IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE)) +#define PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE, PageClass)) + +typedef struct _Page Page; +typedef struct _PageClass PageClass; + +#define TYPE_PAGE_VIEW (page_view_get_type ()) +#define PAGE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PAGE_VIEW, PageView)) +#define PAGE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PAGE_VIEW, PageViewClass)) +#define IS_PAGE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PAGE_VIEW)) +#define IS_PAGE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PAGE_VIEW)) +#define PAGE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PAGE_VIEW, PageViewClass)) + +typedef struct _PageView PageView; +typedef struct _PageViewClass PageViewClass; +#define _book_unref0(var) ((var == NULL) ? NULL : (var = (book_unref (var), NULL))) +#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL))) +#define _page_view_unref0(var) ((var == NULL) ? NULL : (var = (page_view_unref (var), NULL))) +#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) +#define _page_unref0(var) ((var == NULL) ? NULL : (var = (page_unref (var), NULL))) + +struct _BookView { + GtkBox parent_instance; + BookViewPrivate * priv; +}; + +struct _BookViewClass { + GtkBoxClass parent_class; +}; + +struct _BookViewPrivate { + Book* _book; + GHashTable* page_data; + gboolean need_layout; + gboolean laying_out; + gboolean show_selected_page; + PageView* selected_page_view; + GtkWidget* drawing_area; + GtkScrollbar* scroll; + GtkAdjustment* adjustment; + GdkCursorType cursor; +}; + + +static gpointer book_view_parent_class = NULL; + +GType book_view_get_type (void) G_GNUC_CONST; +gpointer book_ref (gpointer instance); +void book_unref (gpointer instance); +GParamSpec* param_spec_book (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_book (GValue* value, gpointer v_object); +void value_take_book (GValue* value, gpointer v_object); +gpointer value_get_book (const GValue* value); +GType book_get_type (void) G_GNUC_CONST; +gpointer page_ref (gpointer instance); +void page_unref (gpointer instance); +GParamSpec* param_spec_page (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_page (GValue* value, gpointer v_object); +void value_take_page (GValue* value, gpointer v_object); +gpointer value_get_page (const GValue* value); +GType page_get_type (void) G_GNUC_CONST; +gpointer page_view_ref (gpointer instance); +void page_view_unref (gpointer instance); +GParamSpec* param_spec_page_view (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void value_set_page_view (GValue* value, gpointer v_object); +void value_take_page_view (GValue* value, gpointer v_object); +gpointer value_get_page_view (const GValue* value); +GType page_view_get_type (void) G_GNUC_CONST; +#define BOOK_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_BOOK_VIEW, BookViewPrivate)) +enum { + BOOK_VIEW_DUMMY_PROPERTY, + BOOK_VIEW_BOOK, + BOOK_VIEW_SELECTED_PAGE, + BOOK_VIEW_X_OFFSET +}; +Book* book_view_get_book (BookView* self); +static void book_view_add_cb (BookView* self, Book* book, Page* page); +static void _book_view_add_cb_book_page_added (Book* _sender, Page* page, gpointer self); +static void book_view_remove_cb (BookView* self, Book* book, Page* page); +static void _book_view_remove_cb_book_page_removed (Book* _sender, Page* page, gpointer self); +static void book_view_reorder_cb (BookView* self, Book* book); +static void _book_view_reorder_cb_book_reordered (Book* _sender, gpointer self); +static void book_view_clear_cb (BookView* self, Book* book); +static void _book_view_clear_cb_book_cleared (Book* _sender, gpointer self); +static gboolean book_view_configure_cb (BookView* self, GtkWidget* widget, GdkEventConfigure* event); +static gboolean _book_view_configure_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self); +static gboolean book_view_draw_cb (BookView* self, GtkWidget* widget, cairo_t* context); +static gboolean _book_view_draw_cb_gtk_widget_draw (GtkWidget* _sender, cairo_t* cr, gpointer self); +static gboolean book_view_motion_cb (BookView* self, GtkWidget* widget, GdkEventMotion* event); +static gboolean _book_view_motion_cb_gtk_widget_motion_notify_event (GtkWidget* _sender, GdkEventMotion* event, gpointer self); +static gboolean book_view_key_cb (BookView* self, GtkWidget* widget, GdkEventKey* event); +static gboolean _book_view_key_cb_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self); +static gboolean book_view_button_cb (BookView* self, GtkWidget* widget, GdkEventButton* event); +static gboolean _book_view_button_cb_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self); +static gboolean _book_view_button_cb_gtk_widget_button_release_event (GtkWidget* _sender, GdkEventButton* event, gpointer self); +static gboolean book_view_focus_cb (BookView* self, GtkWidget* widget, GdkEventFocus* event); +static gboolean _book_view_focus_cb_gtk_widget_focus_in_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self); +static gboolean _book_view_focus_cb_gtk_widget_focus_out_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self); +static void book_view_scroll_cb (BookView* self, GtkAdjustment* adjustment); +static void _book_view_scroll_cb_gtk_adjustment_value_changed (GtkAdjustment* _sender, gpointer self); +BookView* book_view_new (Book* book); +BookView* book_view_construct (GType object_type, Book* book); +static void book_view_set_book (BookView* self, Book* value); +guint book_get_n_pages (Book* self); +Page* book_get_page (Book* self, gint page_number); +void book_view_set_selected_page (BookView* self, Page* value); +static void _page_unref0_ (gpointer var); +static void _page_view_unref0_ (gpointer var); +static PageView* book_view_get_nth_page (BookView* self, gint n); +static PageView* book_view_get_next_page (BookView* self, PageView* page); +Page* page_view_get_page (PageView* self); +static PageView* book_view_get_prev_page (BookView* self, PageView* page); +static void book_view_page_view_changed_cb (BookView* self, PageView* page); +void book_view_redraw (BookView* self); +static void book_view_page_view_size_changed_cb (BookView* self, PageView* page); +PageView* page_view_new (Page* page); +PageView* page_view_construct (GType object_type, Page* page); +static void _book_view_page_view_changed_cb_page_view_changed (PageView* _sender, gpointer self); +static void _book_view_page_view_size_changed_cb_page_view_size_changed (PageView* _sender, gpointer self); +static void book_view_set_selected_page_view (BookView* self, PageView* page); +void page_view_set_selected (PageView* self, gboolean value); +static void book_view_show_page_view (BookView* self, PageView* page); +gint page_view_get_x_offset (PageView* self); +gint page_view_get_width (PageView* self); +gint book_view_get_x_offset (BookView* self); +void book_view_set_x_offset (BookView* self, gint value); +static void book_view_select_page_view (BookView* self, PageView* page); +Page* book_view_get_selected_page (BookView* self); +static void book_view_layout_into (BookView* self, gint width, gint height, gint* book_width, gint* book_height); +gint page_get_dpi (Page* self); +gint page_get_width (Page* self); +gint page_get_height (Page* self); +void page_view_set_width (PageView* self, gint value); +void page_view_set_height (PageView* self, gint value); +gint page_view_get_height (PageView* self); +void page_view_set_x_offset (PageView* self, gint value); +void page_view_set_y_offset (PageView* self, gint value); +static void book_view_layout (BookView* self); +void page_view_render (PageView* self, cairo_t* context); +gboolean page_view_get_selected (PageView* self); +gint page_view_get_y_offset (PageView* self); +static PageView* book_view_get_page_at (BookView* self, gint x, gint y, gint* x_, gint* y_); +void page_view_button_press (PageView* self, gint x, gint y); +void page_view_button_release (PageView* self, gint x, gint y); +static void book_view_set_cursor (BookView* self, GdkCursorType cursor); +void page_view_motion (PageView* self, gint x, gint y); +GdkCursorType page_view_get_cursor (PageView* self); +void book_view_select_next_page (BookView* self); +void book_view_select_prev_page (BookView* self); +static void g_cclosure_user_marshal_VOID__PAGE (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); +static void book_view_finalize (GObject* obj); +static void _vala_book_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); +static void _vala_book_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); + + +static void _book_view_add_cb_book_page_added (Book* _sender, Page* page, gpointer self) { +#line 123 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_add_cb ((BookView*) self, _sender, page); +#line 210 "book-view.c" +} + + +static void _book_view_remove_cb_book_page_removed (Book* _sender, Page* page, gpointer self) { +#line 124 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_remove_cb ((BookView*) self, _sender, page); +#line 217 "book-view.c" +} + + +static void _book_view_reorder_cb_book_reordered (Book* _sender, gpointer self) { +#line 125 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_reorder_cb ((BookView*) self, _sender); +#line 224 "book-view.c" +} + + +static void _book_view_clear_cb_book_cleared (Book* _sender, gpointer self) { +#line 126 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_clear_cb ((BookView*) self, _sender); +#line 231 "book-view.c" +} + + +static gboolean _book_view_configure_cb_gtk_widget_configure_event (GtkWidget* _sender, GdkEventConfigure* event, gpointer self) { + gboolean result; + result = book_view_configure_cb ((BookView*) self, _sender, event); +#line 127 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 240 "book-view.c" +} + + +static gboolean _book_view_draw_cb_gtk_widget_draw (GtkWidget* _sender, cairo_t* cr, gpointer self) { + gboolean result; + result = book_view_draw_cb ((BookView*) self, _sender, cr); +#line 128 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 249 "book-view.c" +} + + +static gboolean _book_view_motion_cb_gtk_widget_motion_notify_event (GtkWidget* _sender, GdkEventMotion* event, gpointer self) { + gboolean result; + result = book_view_motion_cb ((BookView*) self, _sender, event); +#line 129 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 258 "book-view.c" +} + + +static gboolean _book_view_key_cb_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) { + gboolean result; + result = book_view_key_cb ((BookView*) self, _sender, event); +#line 130 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 267 "book-view.c" +} + + +static gboolean _book_view_button_cb_gtk_widget_button_press_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) { + gboolean result; + result = book_view_button_cb ((BookView*) self, _sender, event); +#line 131 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 276 "book-view.c" +} + + +static gboolean _book_view_button_cb_gtk_widget_button_release_event (GtkWidget* _sender, GdkEventButton* event, gpointer self) { + gboolean result; + result = book_view_button_cb ((BookView*) self, _sender, event); +#line 132 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 285 "book-view.c" +} + + +static gboolean _book_view_focus_cb_gtk_widget_focus_in_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self) { + gboolean result; + result = book_view_focus_cb ((BookView*) self, _sender, event); +#line 133 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 294 "book-view.c" +} + + +static gboolean _book_view_focus_cb_gtk_widget_focus_out_event (GtkWidget* _sender, GdkEventFocus* event, gpointer self) { + gboolean result; + result = book_view_focus_cb ((BookView*) self, _sender, event); +#line 134 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 303 "book-view.c" +} + + +static void _book_view_scroll_cb_gtk_adjustment_value_changed (GtkAdjustment* _sender, gpointer self) { +#line 135 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_scroll_cb ((BookView*) self, _sender); +#line 310 "book-view.c" +} + + +static void _page_unref0_ (gpointer var) { +#line 95 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + (var == NULL) ? NULL : (var = (page_unref (var), NULL)); +#line 317 "book-view.c" +} + + +static void _page_view_unref0_ (gpointer var) { +#line 95 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + (var == NULL) ? NULL : (var = (page_view_unref (var), NULL)); +#line 324 "book-view.c" +} + + +static gpointer _g_object_ref0 (gpointer self) { +#line 105 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return self ? g_object_ref (self) : NULL; +#line 331 "book-view.c" +} + + +BookView* book_view_construct (GType object_type, Book* book) { + BookView * self = NULL; + Book* _tmp0_ = NULL; + Book* _tmp12_ = NULL; + Page* _tmp13_ = NULL; + Page* _tmp14_ = NULL; + Book* _tmp15_ = NULL; + Book* _tmp16_ = NULL; + Book* _tmp17_ = NULL; + Book* _tmp18_ = NULL; + GHashFunc _tmp19_ = NULL; + GEqualFunc _tmp20_ = NULL; + GHashTable* _tmp21_ = NULL; + GtkDrawingArea* _tmp22_ = NULL; + GtkWidget* _tmp23_ = NULL; + GtkWidget* _tmp24_ = NULL; + GtkWidget* _tmp25_ = NULL; + GtkWidget* _tmp26_ = NULL; + GtkScrollbar* _tmp27_ = NULL; + GtkScrollbar* _tmp28_ = NULL; + GtkAdjustment* _tmp29_ = NULL; + GtkAdjustment* _tmp30_ = NULL; + GtkAdjustment* _tmp31_ = NULL; + GtkScrollbar* _tmp32_ = NULL; + GtkWidget* _tmp33_ = NULL; + GtkWidget* _tmp34_ = NULL; + GtkWidget* _tmp35_ = NULL; + GtkWidget* _tmp36_ = NULL; + GtkWidget* _tmp37_ = NULL; + GtkWidget* _tmp38_ = NULL; + GtkWidget* _tmp39_ = NULL; + GtkWidget* _tmp40_ = NULL; + GtkAdjustment* _tmp41_ = NULL; + GtkWidget* _tmp42_ = NULL; +#line 74 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (book != NULL, NULL); +#line 76 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self = (BookView*) g_object_new (object_type, "orientation", GTK_ORIENTATION_VERTICAL, NULL); +#line 77 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = book; +#line 77 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_book (self, _tmp0_); +#line 377 "book-view.c" + { + gint i = 0; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 382 "book-view.c" + { + gboolean _tmp1_ = FALSE; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = TRUE; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 389 "book-view.c" + gint _tmp3_ = 0; + Book* _tmp4_ = NULL; + guint _tmp5_ = 0U; + guint _tmp6_ = 0U; + Page* page = NULL; + Book* _tmp7_ = NULL; + gint _tmp8_ = 0; + Page* _tmp9_ = NULL; + Book* _tmp10_ = NULL; + Page* _tmp11_ = NULL; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp1_) { +#line 402 "book-view.c" + gint _tmp2_ = 0; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = i; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp2_ + 1; +#line 408 "book-view.c" + } +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = FALSE; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = i; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = book; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = book_get_n_pages (_tmp4_); +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = _tmp5_; +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!(((guint) _tmp3_) < _tmp6_)) { +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 424 "book-view.c" + } +#line 82 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = book; +#line 82 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = i; +#line 82 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = book_get_page (_tmp7_, _tmp8_); +#line 82 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp9_; +#line 83 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = book; +#line 83 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = page; +#line 83 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_add_cb (self, _tmp10_, _tmp11_); +#line 80 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (page); +#line 442 "book-view.c" + } + } + } +#line 86 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = book; +#line 86 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = book_get_page (_tmp12_, 0); +#line 86 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = _tmp13_; +#line 86 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_selected_page (self, _tmp14_); +#line 86 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (_tmp14_); +#line 89 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = book; +#line 89 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp15_, "page-added", (GCallback) _book_view_add_cb_book_page_added, self, 0); +#line 90 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = book; +#line 90 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp16_, "page-removed", (GCallback) _book_view_remove_cb_book_page_removed, self, 0); +#line 91 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = book; +#line 91 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp17_, "reordered", (GCallback) _book_view_reorder_cb_book_reordered, self, 0); +#line 92 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = book; +#line 92 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp18_, "cleared", (GCallback) _book_view_clear_cb_book_cleared, self, 0); +#line 94 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = TRUE; +#line 95 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = g_direct_hash; +#line 95 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = g_direct_equal; +#line 95 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = g_hash_table_new_full (_tmp19_, _tmp20_, _page_unref0_, _page_view_unref0_); +#line 95 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_hash_table_unref0 (self->priv->page_data); +#line 95 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->page_data = _tmp21_; +#line 96 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->cursor = GDK_ARROW; +#line 98 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = (GtkDrawingArea*) gtk_drawing_area_new (); +#line 98 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_ref_sink (_tmp22_); +#line 98 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (self->priv->drawing_area); +#line 98 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->drawing_area = (GtkWidget*) _tmp22_; +#line 99 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = self->priv->drawing_area; +#line 99 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_set_size_request (_tmp23_, 200, 100); +#line 100 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = self->priv->drawing_area; +#line 100 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_set (_tmp24_, "can-focus", TRUE, NULL); +#line 101 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = self->priv->drawing_area; +#line 101 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_set_events (_tmp25_, ((((GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK) | GDK_BUTTON_RELEASE_MASK) | GDK_FOCUS_CHANGE_MASK) | GDK_STRUCTURE_MASK) | GDK_SCROLL_MASK); +#line 102 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp26_ = self->priv->drawing_area; +#line 102 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_box_pack_start ((GtkBox*) self, _tmp26_, TRUE, TRUE, (guint) 0); +#line 104 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp27_ = (GtkScrollbar*) gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, NULL); +#line 104 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_ref_sink (_tmp27_); +#line 104 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (self->priv->scroll); +#line 104 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->scroll = _tmp27_; +#line 105 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp28_ = self->priv->scroll; +#line 105 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp29_ = gtk_range_get_adjustment ((GtkRange*) _tmp28_); +#line 105 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp30_ = _tmp29_; +#line 105 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp31_ = _g_object_ref0 (_tmp30_); +#line 105 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (self->priv->adjustment); +#line 105 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->adjustment = _tmp31_; +#line 106 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp32_ = self->priv->scroll; +#line 106 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp32_, FALSE, TRUE, (guint) 0); +#line 108 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp33_ = self->priv->drawing_area; +#line 108 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp33_, "configure-event", (GCallback) _book_view_configure_cb_gtk_widget_configure_event, self, 0); +#line 109 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp34_ = self->priv->drawing_area; +#line 109 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp34_, "draw", (GCallback) _book_view_draw_cb_gtk_widget_draw, self, 0); +#line 110 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp35_ = self->priv->drawing_area; +#line 110 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp35_, "motion-notify-event", (GCallback) _book_view_motion_cb_gtk_widget_motion_notify_event, self, 0); +#line 111 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp36_ = self->priv->drawing_area; +#line 111 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp36_, "key-press-event", (GCallback) _book_view_key_cb_gtk_widget_key_press_event, self, 0); +#line 112 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp37_ = self->priv->drawing_area; +#line 112 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp37_, "button-press-event", (GCallback) _book_view_button_cb_gtk_widget_button_press_event, self, 0); +#line 113 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp38_ = self->priv->drawing_area; +#line 113 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp38_, "button-release-event", (GCallback) _book_view_button_cb_gtk_widget_button_release_event, self, 0); +#line 114 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp39_ = self->priv->drawing_area; +#line 114 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp39_, "focus-in-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_in_event, self, G_CONNECT_AFTER); +#line 115 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp40_ = self->priv->drawing_area; +#line 115 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp40_, "focus-out-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_out_event, self, G_CONNECT_AFTER); +#line 116 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp41_ = self->priv->adjustment; +#line 116 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (_tmp41_, "value-changed", (GCallback) _book_view_scroll_cb_gtk_adjustment_value_changed, self, 0); +#line 118 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp42_ = self->priv->drawing_area; +#line 118 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_set_visible (_tmp42_, TRUE); +#line 74 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return self; +#line 576 "book-view.c" +} + + +BookView* book_view_new (Book* book) { +#line 74 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return book_view_construct (TYPE_BOOK_VIEW, book); +#line 583 "book-view.c" +} + + +static gpointer _page_view_ref0 (gpointer self) { +#line 141 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return self ? page_view_ref (self) : NULL; +#line 590 "book-view.c" +} + + +static PageView* book_view_get_nth_page (BookView* self, gint n) { + PageView* result = NULL; + Page* page = NULL; + Book* _tmp0_ = NULL; + gint _tmp1_ = 0; + Page* _tmp2_ = NULL; + GHashTable* _tmp3_ = NULL; + gconstpointer _tmp4_ = NULL; + PageView* _tmp5_ = NULL; +#line 138 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 140 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->_book; +#line 140 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = n; +#line 140 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = book_get_page (_tmp0_, _tmp1_); +#line 140 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp2_; +#line 141 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = self->priv->page_data; +#line 141 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = g_hash_table_lookup (_tmp3_, page); +#line 141 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = _page_view_ref0 ((PageView*) _tmp4_); +#line 141 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = _tmp5_; +#line 141 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (page); +#line 141 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 625 "book-view.c" +} + + +static PageView* book_view_get_next_page (BookView* self, PageView* page) { + PageView* result = NULL; + PageView* _tmp18_ = NULL; + PageView* _tmp19_ = NULL; +#line 144 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 144 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (page != NULL, NULL); +#line 637 "book-view.c" + { + gint i = 0; +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 642 "book-view.c" + { + gboolean _tmp0_ = FALSE; +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = TRUE; +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 649 "book-view.c" + Page* p = NULL; + Book* _tmp2_ = NULL; + gint _tmp3_ = 0; + Page* _tmp4_ = NULL; + Page* _tmp5_ = NULL; + Page* _tmp6_ = NULL; + PageView* _tmp7_ = NULL; + Page* _tmp8_ = NULL; + Page* _tmp9_ = NULL; +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp0_) { +#line 661 "book-view.c" + gint _tmp1_ = 0; +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = i; +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp1_ + 1; +#line 667 "book-view.c" + } +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = FALSE; +#line 148 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = self->priv->_book; +#line 148 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = i; +#line 148 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = book_get_page (_tmp2_, _tmp3_); +#line 148 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + p = _tmp4_; +#line 149 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = p; +#line 149 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp5_ == NULL) { +#line 150 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 150 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 687 "book-view.c" + } +#line 151 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = p; +#line 151 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = page; +#line 151 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = page_view_get_page (_tmp7_); +#line 151 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = _tmp8_; +#line 151 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp6_ == _tmp9_) { +#line 699 "book-view.c" + Book* _tmp10_ = NULL; + gint _tmp11_ = 0; + Page* _tmp12_ = NULL; + Page* _tmp13_ = NULL; +#line 153 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = self->priv->_book; +#line 153 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = i; +#line 153 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = book_get_page (_tmp10_, _tmp11_ + 1); +#line 153 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 153 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + p = _tmp12_; +#line 154 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = p; +#line 154 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp13_ != NULL) { +#line 718 "book-view.c" + GHashTable* _tmp14_ = NULL; + Page* _tmp15_ = NULL; + gconstpointer _tmp16_ = NULL; + PageView* _tmp17_ = NULL; +#line 155 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = self->priv->page_data; +#line 155 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = p; +#line 155 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = g_hash_table_lookup (_tmp14_, _tmp15_); +#line 155 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = _page_view_ref0 ((PageView*) _tmp16_); +#line 155 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = _tmp17_; +#line 155 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 155 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 737 "book-view.c" + } + } +#line 146 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 742 "book-view.c" + } + } + } +#line 159 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = page; +#line 159 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = _page_view_ref0 (_tmp18_); +#line 159 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = _tmp19_; +#line 159 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 754 "book-view.c" +} + + +static PageView* book_view_get_prev_page (BookView* self, PageView* page) { + PageView* result = NULL; + PageView* prev_page = NULL; + PageView* _tmp0_ = NULL; + PageView* _tmp1_ = NULL; + PageView* _tmp16_ = NULL; + PageView* _tmp17_ = NULL; +#line 162 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 162 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (page != NULL, NULL); +#line 164 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = page; +#line 164 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = _page_view_ref0 (_tmp0_); +#line 164 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + prev_page = _tmp1_; +#line 775 "book-view.c" + { + gint i = 0; +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 780 "book-view.c" + { + gboolean _tmp2_ = FALSE; +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = TRUE; +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 787 "book-view.c" + Page* p = NULL; + Book* _tmp4_ = NULL; + gint _tmp5_ = 0; + Page* _tmp6_ = NULL; + Page* _tmp7_ = NULL; + Page* _tmp8_ = NULL; + PageView* _tmp9_ = NULL; + Page* _tmp10_ = NULL; + Page* _tmp11_ = NULL; + GHashTable* _tmp12_ = NULL; + Page* _tmp13_ = NULL; + gconstpointer _tmp14_ = NULL; + PageView* _tmp15_ = NULL; +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp2_) { +#line 803 "book-view.c" + gint _tmp3_ = 0; +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = i; +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp3_ + 1; +#line 809 "book-view.c" + } +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = FALSE; +#line 167 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = self->priv->_book; +#line 167 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = i; +#line 167 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = book_get_page (_tmp4_, _tmp5_); +#line 167 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + p = _tmp6_; +#line 168 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = p; +#line 168 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp7_ == NULL) { +#line 169 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 169 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 829 "book-view.c" + } +#line 170 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = p; +#line 170 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = page; +#line 170 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = page_view_get_page (_tmp9_); +#line 170 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = _tmp10_; +#line 170 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp8_ == _tmp11_) { +#line 171 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = prev_page; +#line 171 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 171 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 847 "book-view.c" + } +#line 172 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = self->priv->page_data; +#line 172 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = p; +#line 172 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = g_hash_table_lookup (_tmp12_, _tmp13_); +#line 172 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = _page_view_ref0 ((PageView*) _tmp14_); +#line 172 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (prev_page); +#line 172 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + prev_page = _tmp15_; +#line 165 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 863 "book-view.c" + } + } + } +#line 175 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = page; +#line 175 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = _page_view_ref0 (_tmp16_); +#line 175 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = _tmp17_; +#line 175 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (prev_page); +#line 175 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 877 "book-view.c" +} + + +static void book_view_page_view_changed_cb (BookView* self, PageView* page) { +#line 178 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 178 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (page != NULL); +#line 180 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_redraw (self); +#line 888 "book-view.c" +} + + +static void book_view_page_view_size_changed_cb (BookView* self, PageView* page) { +#line 183 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 183 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (page != NULL); +#line 185 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = TRUE; +#line 186 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_redraw (self); +#line 901 "book-view.c" +} + + +static void _book_view_page_view_changed_cb_page_view_changed (PageView* _sender, gpointer self) { +#line 192 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_page_view_changed_cb ((BookView*) self, _sender); +#line 908 "book-view.c" +} + + +static void _book_view_page_view_size_changed_cb_page_view_size_changed (PageView* _sender, gpointer self) { +#line 193 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_page_view_size_changed_cb ((BookView*) self, _sender); +#line 915 "book-view.c" +} + + +static gpointer _page_ref0 (gpointer self) { +#line 194 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return self ? page_ref (self) : NULL; +#line 922 "book-view.c" +} + + +static void book_view_add_cb (BookView* self, Book* book, Page* page) { + PageView* page_view = NULL; + Page* _tmp0_ = NULL; + PageView* _tmp1_ = NULL; + GHashTable* _tmp2_ = NULL; + Page* _tmp3_ = NULL; + Page* _tmp4_ = NULL; + PageView* _tmp5_ = NULL; +#line 189 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 189 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (book != NULL); +#line 189 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (page != NULL); +#line 191 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = page; +#line 191 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = page_view_new (_tmp0_); +#line 191 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view = _tmp1_; +#line 192 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (page_view, "changed", (GCallback) _book_view_page_view_changed_cb_page_view_changed, self, 0); +#line 193 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_connect_object (page_view, "size-changed", (GCallback) _book_view_page_view_size_changed_cb_page_view_size_changed, self, 0); +#line 194 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = self->priv->page_data; +#line 194 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = page; +#line 194 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = _page_ref0 (_tmp3_); +#line 194 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = _page_view_ref0 (page_view); +#line 194 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_hash_table_insert (_tmp2_, _tmp4_, _tmp5_); +#line 195 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = TRUE; +#line 196 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_redraw (self); +#line 189 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (page_view); +#line 966 "book-view.c" +} + + +static void book_view_set_selected_page_view (BookView* self, PageView* page) { + gboolean _tmp0_ = FALSE; + PageView* _tmp1_ = NULL; + PageView* _tmp5_ = NULL; + PageView* _tmp6_ = NULL; + PageView* _tmp7_ = NULL; + GtkWidget* _tmp8_ = NULL; + gboolean _tmp9_ = FALSE; + gboolean _tmp10_ = FALSE; +#line 199 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 202 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = self->priv->selected_page_view; +#line 202 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp1_ != NULL) { +#line 985 "book-view.c" + PageView* _tmp2_ = NULL; + PageView* _tmp3_ = NULL; +#line 202 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = page; +#line 202 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = self->priv->selected_page_view; +#line 202 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = _tmp2_ != _tmp3_; +#line 994 "book-view.c" + } else { +#line 202 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = FALSE; +#line 998 "book-view.c" + } +#line 202 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp0_) { +#line 1002 "book-view.c" + PageView* _tmp4_ = NULL; +#line 203 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = self->priv->selected_page_view; +#line 203 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_set_selected (_tmp4_, TRUE); +#line 1008 "book-view.c" + } +#line 205 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = page; +#line 205 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = _page_view_ref0 (_tmp5_); +#line 205 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (self->priv->selected_page_view); +#line 205 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->selected_page_view = _tmp6_; +#line 206 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = self->priv->selected_page_view; +#line 206 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp7_ == NULL) { +#line 207 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return; +#line 1024 "book-view.c" + } +#line 210 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = self->priv->drawing_area; +#line 210 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_get (_tmp8_, "has-focus", &_tmp9_, NULL); +#line 210 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = _tmp9_; +#line 210 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp10_) { +#line 1034 "book-view.c" + PageView* _tmp11_ = NULL; +#line 211 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = self->priv->selected_page_view; +#line 211 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_set_selected (_tmp11_, FALSE); +#line 1040 "book-view.c" + } else { + PageView* _tmp12_ = NULL; +#line 213 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = self->priv->selected_page_view; +#line 213 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_set_selected (_tmp12_, TRUE); +#line 1047 "book-view.c" + } +} + + +static void book_view_show_page_view (BookView* self, PageView* page) { + gboolean _tmp0_ = FALSE; + PageView* _tmp1_ = NULL; + GtkAllocation allocation = {0}; + GtkWidget* _tmp4_ = NULL; + GtkAllocation _tmp5_ = {0}; + gint left_edge = 0; + PageView* _tmp6_ = NULL; + gint _tmp7_ = 0; + gint _tmp8_ = 0; + gint right_edge = 0; + PageView* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + PageView* _tmp12_ = NULL; + gint _tmp13_ = 0; + gint _tmp14_ = 0; + gint _tmp15_ = 0; + gint _tmp16_ = 0; + gint _tmp17_ = 0; +#line 216 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 218 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = page; +#line 218 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp1_ == NULL) { +#line 218 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = TRUE; +#line 1080 "book-view.c" + } else { + GtkScrollbar* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; +#line 218 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = self->priv->scroll; +#line 218 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = gtk_widget_get_visible ((GtkWidget*) _tmp2_); +#line 218 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = !_tmp3_; +#line 1090 "book-view.c" + } +#line 218 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp0_) { +#line 219 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return; +#line 1096 "book-view.c" + } +#line 222 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = self->priv->drawing_area; +#line 222 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_get_allocation (_tmp4_, &_tmp5_); +#line 222 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + allocation = _tmp5_; +#line 223 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = page; +#line 223 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = page_view_get_x_offset (_tmp6_); +#line 223 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = _tmp7_; +#line 223 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + left_edge = _tmp8_; +#line 224 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = page; +#line 224 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = page_view_get_x_offset (_tmp9_); +#line 224 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = _tmp10_; +#line 224 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = page; +#line 224 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = page_view_get_width (_tmp12_); +#line 224 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = _tmp13_; +#line 224 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + right_edge = _tmp11_ + _tmp14_; +#line 226 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = left_edge; +#line 226 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = book_view_get_x_offset (self); +#line 226 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = _tmp16_; +#line 226 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if ((_tmp15_ - _tmp17_) < 0) { +#line 1134 "book-view.c" + gint _tmp18_ = 0; +#line 227 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = left_edge; +#line 227 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_x_offset (self, _tmp18_); +#line 1140 "book-view.c" + } else { + gint _tmp19_ = 0; + gint _tmp20_ = 0; + gint _tmp21_ = 0; + GtkAllocation _tmp22_ = {0}; + gint _tmp23_ = 0; +#line 228 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = right_edge; +#line 228 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = book_view_get_x_offset (self); +#line 228 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = _tmp20_; +#line 228 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = allocation; +#line 228 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = _tmp22_.width; +#line 228 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if ((_tmp19_ - _tmp21_) > _tmp23_) { +#line 1159 "book-view.c" + gint _tmp24_ = 0; + GtkAllocation _tmp25_ = {0}; + gint _tmp26_ = 0; +#line 229 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = right_edge; +#line 229 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = allocation; +#line 229 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp26_ = _tmp25_.width; +#line 229 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_x_offset (self, _tmp24_ - _tmp26_); +#line 1171 "book-view.c" + } + } +} + + +static void book_view_select_page_view (BookView* self, PageView* page) { + Page* p = NULL; + PageView* _tmp0_ = NULL; + PageView* _tmp1_ = NULL; + PageView* _tmp2_ = NULL; + gboolean _tmp3_ = FALSE; + PageView* _tmp5_ = NULL; + Page* _tmp10_ = NULL; +#line 232 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 234 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + p = NULL; +#line 236 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->selected_page_view; +#line 236 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = page; +#line 236 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp0_ == _tmp1_) { +#line 237 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 237 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return; +#line 1199 "book-view.c" + } +#line 239 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = page; +#line 239 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_selected_page_view (self, _tmp2_); +#line 241 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = self->priv->need_layout; +#line 241 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp3_) { +#line 242 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->show_selected_page = TRUE; +#line 1211 "book-view.c" + } else { + PageView* _tmp4_ = NULL; +#line 244 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = page; +#line 244 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_show_page_view (self, _tmp4_); +#line 1218 "book-view.c" + } +#line 246 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = page; +#line 246 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp5_ != NULL) { +#line 1224 "book-view.c" + PageView* _tmp6_ = NULL; + Page* _tmp7_ = NULL; + Page* _tmp8_ = NULL; + Page* _tmp9_ = NULL; +#line 247 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = page; +#line 247 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = page_view_get_page (_tmp6_); +#line 247 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = _tmp7_; +#line 247 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = _page_ref0 (_tmp8_); +#line 247 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 247 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + p = _tmp9_; +#line 1241 "book-view.c" + } +#line 248 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = p; +#line 248 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_emit_by_name (self, "page-selected", _tmp10_); +#line 232 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 1249 "book-view.c" +} + + +static void book_view_remove_cb (BookView* self, Book* book, Page* page) { + PageView* new_selection = NULL; + PageView* _tmp0_ = NULL; + PageView* _tmp1_ = NULL; + Page* _tmp2_ = NULL; + Page* _tmp3_ = NULL; + Page* _tmp4_ = NULL; + PageView* page_view = NULL; + GHashTable* _tmp11_ = NULL; + Page* _tmp12_ = NULL; + gconstpointer _tmp13_ = NULL; + PageView* _tmp14_ = NULL; + guint _tmp15_ = 0U; + guint _tmp16_ = 0U; + GHashTable* _tmp17_ = NULL; + Page* _tmp18_ = NULL; + PageView* _tmp19_ = NULL; +#line 251 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 251 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (book != NULL); +#line 251 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (page != NULL); +#line 253 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->selected_page_view; +#line 253 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = _page_view_ref0 (_tmp0_); +#line 253 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + new_selection = _tmp1_; +#line 256 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = page; +#line 256 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = book_view_get_selected_page (self); +#line 256 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = _tmp3_; +#line 256 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp2_ == _tmp4_) { +#line 1290 "book-view.c" + PageView* _tmp5_ = NULL; + PageView* _tmp6_ = NULL; + PageView* _tmp7_ = NULL; + PageView* _tmp8_ = NULL; +#line 258 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = self->priv->selected_page_view; +#line 258 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = book_view_get_prev_page (self, _tmp5_); +#line 258 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (new_selection); +#line 258 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + new_selection = _tmp6_; +#line 259 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = new_selection; +#line 259 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = self->priv->selected_page_view; +#line 259 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp7_ == _tmp8_) { +#line 1309 "book-view.c" + PageView* _tmp9_ = NULL; + PageView* _tmp10_ = NULL; +#line 260 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = self->priv->selected_page_view; +#line 260 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = book_view_get_next_page (self, _tmp9_); +#line 260 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (new_selection); +#line 260 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + new_selection = _tmp10_; +#line 1320 "book-view.c" + } +#line 261 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (self->priv->selected_page_view); +#line 261 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->selected_page_view = NULL; +#line 1326 "book-view.c" + } +#line 264 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = self->priv->page_data; +#line 264 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = page; +#line 264 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = g_hash_table_lookup (_tmp11_, _tmp12_); +#line 264 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = _page_view_ref0 ((PageView*) _tmp13_); +#line 264 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view = _tmp14_; +#line 265 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("changed", TYPE_PAGE_VIEW, &_tmp15_, NULL, FALSE); +#line 265 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (page_view, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp15_, 0, NULL, (GCallback) _book_view_page_view_changed_cb_page_view_changed, self); +#line 266 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("size-changed", TYPE_PAGE_VIEW, &_tmp16_, NULL, FALSE); +#line 266 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (page_view, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp16_, 0, NULL, (GCallback) _book_view_page_view_size_changed_cb_page_view_size_changed, self); +#line 267 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = self->priv->page_data; +#line 267 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = page; +#line 267 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_hash_table_remove (_tmp17_, _tmp18_); +#line 269 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = new_selection; +#line 269 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, _tmp19_); +#line 271 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = TRUE; +#line 272 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_redraw (self); +#line 251 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (page_view); +#line 251 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (new_selection); +#line 1364 "book-view.c" +} + + +static void book_view_reorder_cb (BookView* self, Book* book) { +#line 275 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 275 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (book != NULL); +#line 277 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = TRUE; +#line 278 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_redraw (self); +#line 1377 "book-view.c" +} + + +static void book_view_clear_cb (BookView* self, Book* book) { + GHashTable* _tmp0_ = NULL; +#line 281 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 281 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (book != NULL); +#line 283 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->page_data; +#line 283 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_hash_table_remove_all (_tmp0_); +#line 284 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (self->priv->selected_page_view); +#line 284 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->selected_page_view = NULL; +#line 285 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_emit_by_name (self, "page-selected", NULL); +#line 286 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = TRUE; +#line 287 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_redraw (self); +#line 1401 "book-view.c" +} + + +static gboolean book_view_configure_cb (BookView* self, GtkWidget* widget, GdkEventConfigure* event) { + gboolean result = FALSE; +#line 290 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 290 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (widget != NULL, FALSE); +#line 290 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (event != NULL, FALSE); +#line 292 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = TRUE; +#line 293 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 293 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 1419 "book-view.c" +} + + +static void book_view_layout_into (BookView* self, gint width, gint height, gint* book_width, gint* book_height) { + gint _vala_book_width = 0; + gint _vala_book_height = 0; + gint max_dpi = 0; + gint max_width = 0; + gint max_height = 0; + gdouble aspect = 0.0; + gint _tmp47_ = 0; + gint _tmp48_ = 0; + gdouble max_aspect = 0.0; + gint _tmp49_ = 0; + gint _tmp50_ = 0; + gint spacing = 0; + gint x_offset = 0; +#line 296 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 299 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_dpi = 0; +#line 1441 "book-view.c" + { + gint i = 0; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 1446 "book-view.c" + { + gboolean _tmp0_ = FALSE; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = TRUE; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 1453 "book-view.c" + gint _tmp2_ = 0; + Book* _tmp3_ = NULL; + guint _tmp4_ = 0U; + guint _tmp5_ = 0U; + Page* page = NULL; + Book* _tmp6_ = NULL; + gint _tmp7_ = 0; + Page* _tmp8_ = NULL; + Page* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + gint _tmp12_ = 0; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp0_) { +#line 1468 "book-view.c" + gint _tmp1_ = 0; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = i; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp1_ + 1; +#line 1474 "book-view.c" + } +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = FALSE; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = i; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = self->priv->_book; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = book_get_n_pages (_tmp3_); +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = _tmp4_; +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!(((guint) _tmp2_) < _tmp5_)) { +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 1490 "book-view.c" + } +#line 302 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = self->priv->_book; +#line 302 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = i; +#line 302 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = book_get_page (_tmp6_, _tmp7_); +#line 302 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp8_; +#line 303 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = page; +#line 303 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = page_get_dpi (_tmp9_); +#line 303 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = _tmp10_; +#line 303 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = max_dpi; +#line 303 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp11_ > _tmp12_) { +#line 1510 "book-view.c" + Page* _tmp13_ = NULL; + gint _tmp14_ = 0; + gint _tmp15_ = 0; +#line 304 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = page; +#line 304 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = page_get_dpi (_tmp13_); +#line 304 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = _tmp14_; +#line 304 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_dpi = _tmp15_; +#line 1522 "book-view.c" + } +#line 300 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (page); +#line 1526 "book-view.c" + } + } + } +#line 308 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_width = 0; +#line 308 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_height = 0; +#line 1534 "book-view.c" + { + gint i = 0; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 1539 "book-view.c" + { + gboolean _tmp16_ = FALSE; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = TRUE; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 1546 "book-view.c" + gint _tmp18_ = 0; + Book* _tmp19_ = NULL; + guint _tmp20_ = 0U; + guint _tmp21_ = 0U; + Page* page = NULL; + Book* _tmp22_ = NULL; + gint _tmp23_ = 0; + Page* _tmp24_ = NULL; + gint w = 0; + Page* _tmp25_ = NULL; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + gint h = 0; + Page* _tmp28_ = NULL; + gint _tmp29_ = 0; + gint _tmp30_ = 0; + gint _tmp31_ = 0; + gint _tmp32_ = 0; + Page* _tmp33_ = NULL; + gint _tmp34_ = 0; + gint _tmp35_ = 0; + gint _tmp36_ = 0; + gint _tmp37_ = 0; + Page* _tmp38_ = NULL; + gint _tmp39_ = 0; + gint _tmp40_ = 0; + gint _tmp41_ = 0; + gint _tmp42_ = 0; + gint _tmp44_ = 0; + gint _tmp45_ = 0; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp16_) { +#line 1579 "book-view.c" + gint _tmp17_ = 0; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = i; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp17_ + 1; +#line 1585 "book-view.c" + } +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = FALSE; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = i; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = self->priv->_book; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = book_get_n_pages (_tmp19_); +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = _tmp20_; +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!(((guint) _tmp18_) < _tmp21_)) { +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 1601 "book-view.c" + } +#line 311 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = self->priv->_book; +#line 311 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = i; +#line 311 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = book_get_page (_tmp22_, _tmp23_); +#line 311 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp24_; +#line 312 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = page; +#line 312 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp26_ = page_get_width (_tmp25_); +#line 312 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp27_ = _tmp26_; +#line 312 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + w = _tmp27_; +#line 313 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp28_ = page; +#line 313 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp29_ = page_get_height (_tmp28_); +#line 313 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp30_ = _tmp29_; +#line 313 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + h = _tmp30_; +#line 316 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp31_ = w; +#line 316 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp32_ = max_dpi; +#line 316 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp33_ = page; +#line 316 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp34_ = page_get_dpi (_tmp33_); +#line 316 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp35_ = _tmp34_; +#line 316 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + w = (gint) (((((gdouble) _tmp31_) * _tmp32_) / _tmp35_) + 0.5); +#line 317 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp36_ = h; +#line 317 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp37_ = max_dpi; +#line 317 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp38_ = page; +#line 317 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp39_ = page_get_dpi (_tmp38_); +#line 317 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp40_ = _tmp39_; +#line 317 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + h = (gint) (((((gdouble) _tmp36_) * _tmp37_) / _tmp40_) + 0.5); +#line 319 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp41_ = w; +#line 319 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp42_ = max_width; +#line 319 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp41_ > _tmp42_) { +#line 1657 "book-view.c" + gint _tmp43_ = 0; +#line 320 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp43_ = w; +#line 320 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_width = _tmp43_; +#line 1663 "book-view.c" + } +#line 321 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp44_ = h; +#line 321 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp45_ = max_height; +#line 321 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp44_ > _tmp45_) { +#line 1671 "book-view.c" + gint _tmp46_ = 0; +#line 322 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp46_ = h; +#line 322 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_height = _tmp46_; +#line 1677 "book-view.c" + } +#line 309 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (page); +#line 1681 "book-view.c" + } + } + } +#line 325 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp47_ = width; +#line 325 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp48_ = height; +#line 325 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + aspect = ((gdouble) _tmp47_) / _tmp48_; +#line 326 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp49_ = max_width; +#line 326 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp50_ = max_height; +#line 326 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_aspect = ((gdouble) _tmp49_) / _tmp50_; +#line 329 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + spacing = 12; +#line 330 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_book_width = 0; +#line 331 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_book_height = 0; +#line 1703 "book-view.c" + { + gint i = 0; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 1708 "book-view.c" + { + gboolean _tmp51_ = FALSE; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp51_ = TRUE; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 1715 "book-view.c" + gint _tmp53_ = 0; + Book* _tmp54_ = NULL; + guint _tmp55_ = 0U; + guint _tmp56_ = 0U; + PageView* page = NULL; + gint _tmp57_ = 0; + PageView* _tmp58_ = NULL; + Page* p = NULL; + PageView* _tmp59_ = NULL; + Page* _tmp60_ = NULL; + Page* _tmp61_ = NULL; + Page* _tmp62_ = NULL; + gdouble _tmp63_ = 0.0; + gdouble _tmp64_ = 0.0; + gint h = 0; + PageView* _tmp87_ = NULL; + gint _tmp88_ = 0; + gint _tmp89_ = 0; + gint _tmp90_ = 0; + gint _tmp91_ = 0; + gint _tmp93_ = 0; + PageView* _tmp94_ = NULL; + gint _tmp95_ = 0; + gint _tmp96_ = 0; + gint _tmp97_ = 0; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp51_) { +#line 1743 "book-view.c" + gint _tmp52_ = 0; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp52_ = i; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp52_ + 1; +#line 1749 "book-view.c" + } +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp51_ = FALSE; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp53_ = i; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp54_ = self->priv->_book; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp55_ = book_get_n_pages (_tmp54_); +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp56_ = _tmp55_; +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!(((guint) _tmp53_) < _tmp56_)) { +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 1765 "book-view.c" + } +#line 334 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp57_ = i; +#line 334 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp58_ = book_view_get_nth_page (self, _tmp57_); +#line 334 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp58_; +#line 335 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp59_ = page; +#line 335 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp60_ = page_view_get_page (_tmp59_); +#line 335 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp61_ = _tmp60_; +#line 335 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp62_ = _page_ref0 (_tmp61_); +#line 335 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + p = _tmp62_; +#line 338 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp63_ = max_aspect; +#line 338 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp64_ = aspect; +#line 338 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp63_ > _tmp64_) { +#line 1789 "book-view.c" + gint w = 0; + Page* _tmp65_ = NULL; + gint _tmp66_ = 0; + gint _tmp67_ = 0; + gint _tmp68_ = 0; + gint _tmp69_ = 0; + Page* _tmp70_ = NULL; + gint _tmp71_ = 0; + gint _tmp72_ = 0; + gint _tmp73_ = 0; + PageView* _tmp74_ = NULL; + gint _tmp75_ = 0; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp65_ = p; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp66_ = page_get_width (_tmp65_); +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp67_ = _tmp66_; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp68_ = max_dpi; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp69_ = width; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp70_ = p; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp71_ = page_get_dpi (_tmp70_); +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp72_ = _tmp71_; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp73_ = max_width; +#line 341 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + w = (gint) (((((gdouble) _tmp67_) * _tmp68_) * _tmp69_) / (_tmp72_ * _tmp73_)); +#line 342 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp74_ = page; +#line 342 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp75_ = w; +#line 342 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_set_width (_tmp74_, _tmp75_); +#line 1828 "book-view.c" + } else { + gint h = 0; + Page* _tmp76_ = NULL; + gint _tmp77_ = 0; + gint _tmp78_ = 0; + gint _tmp79_ = 0; + gint _tmp80_ = 0; + Page* _tmp81_ = NULL; + gint _tmp82_ = 0; + gint _tmp83_ = 0; + gint _tmp84_ = 0; + PageView* _tmp85_ = NULL; + gint _tmp86_ = 0; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp76_ = p; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp77_ = page_get_height (_tmp76_); +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp78_ = _tmp77_; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp79_ = max_dpi; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp80_ = height; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp81_ = p; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp82_ = page_get_dpi (_tmp81_); +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp83_ = _tmp82_; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp84_ = max_height; +#line 347 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + h = (gint) (((((gdouble) _tmp78_) * _tmp79_) * _tmp80_) / (_tmp83_ * _tmp84_)); +#line 348 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp85_ = page; +#line 348 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp86_ = h; +#line 348 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_set_height (_tmp85_, _tmp86_); +#line 1868 "book-view.c" + } +#line 351 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp87_ = page; +#line 351 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp88_ = page_view_get_height (_tmp87_); +#line 351 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp89_ = _tmp88_; +#line 351 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + h = _tmp89_; +#line 352 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp90_ = h; +#line 352 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp91_ = _vala_book_height; +#line 352 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp90_ > _tmp91_) { +#line 1884 "book-view.c" + gint _tmp92_ = 0; +#line 353 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp92_ = h; +#line 353 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_book_height = _tmp92_; +#line 1890 "book-view.c" + } +#line 354 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp93_ = _vala_book_width; +#line 354 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp94_ = page; +#line 354 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp95_ = page_view_get_width (_tmp94_); +#line 354 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp96_ = _tmp95_; +#line 354 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_book_width = _tmp93_ + _tmp96_; +#line 355 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp97_ = i; +#line 355 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp97_ != 0) { +#line 1906 "book-view.c" + gint _tmp98_ = 0; + gint _tmp99_ = 0; +#line 356 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp98_ = _vala_book_width; +#line 356 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp99_ = spacing; +#line 356 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_book_width = _tmp98_ + _tmp99_; +#line 1915 "book-view.c" + } +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (p); +#line 332 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (page); +#line 1921 "book-view.c" + } + } + } +#line 359 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + x_offset = 0; +#line 1927 "book-view.c" + { + gint i = 0; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 1932 "book-view.c" + { + gboolean _tmp100_ = FALSE; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp100_ = TRUE; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 1939 "book-view.c" + gint _tmp102_ = 0; + Book* _tmp103_ = NULL; + guint _tmp104_ = 0U; + guint _tmp105_ = 0U; + PageView* page = NULL; + gint _tmp106_ = 0; + PageView* _tmp107_ = NULL; + PageView* _tmp108_ = NULL; + gint _tmp109_ = 0; + gint _tmp110_ = 0; + PageView* _tmp111_ = NULL; + gint _tmp112_ = 0; + gint _tmp113_ = 0; + gint _tmp114_ = 0; + PageView* _tmp115_ = NULL; + gint _tmp116_ = 0; + PageView* _tmp117_ = NULL; + gint _tmp118_ = 0; + gint _tmp119_ = 0; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp100_) { +#line 1961 "book-view.c" + gint _tmp101_ = 0; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp101_ = i; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp101_ + 1; +#line 1967 "book-view.c" + } +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp100_ = FALSE; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp102_ = i; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp103_ = self->priv->_book; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp104_ = book_get_n_pages (_tmp103_); +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp105_ = _tmp104_; +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!(((guint) _tmp102_) < _tmp105_)) { +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 1983 "book-view.c" + } +#line 362 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp106_ = i; +#line 362 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp107_ = book_view_get_nth_page (self, _tmp106_); +#line 362 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp107_; +#line 365 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp108_ = page; +#line 365 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp109_ = x_offset; +#line 365 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_set_x_offset (_tmp108_, _tmp109_); +#line 366 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp110_ = x_offset; +#line 366 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp111_ = page; +#line 366 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp112_ = page_view_get_width (_tmp111_); +#line 366 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp113_ = _tmp112_; +#line 366 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp114_ = spacing; +#line 366 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + x_offset = _tmp110_ + (_tmp113_ + _tmp114_); +#line 369 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp115_ = page; +#line 369 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp116_ = height; +#line 369 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp117_ = page; +#line 369 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp118_ = page_view_get_height (_tmp117_); +#line 369 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp119_ = _tmp118_; +#line 369 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_set_y_offset (_tmp115_, (_tmp116_ - _tmp119_) / 2); +#line 360 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (page); +#line 2023 "book-view.c" + } + } + } +#line 296 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (book_width) { +#line 296 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + *book_width = _vala_book_width; +#line 2031 "book-view.c" + } +#line 296 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (book_height) { +#line 296 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + *book_height = _vala_book_height; +#line 2037 "book-view.c" + } +} + + +static void book_view_layout (BookView* self) { + gboolean _tmp0_ = FALSE; + GtkAllocation allocation = {0}; + GtkWidget* _tmp1_ = NULL; + GtkAllocation _tmp2_ = {0}; + GtkAllocation box_allocation = {0}; + GtkAllocation _tmp3_ = {0}; + gboolean right_aligned = FALSE; + GtkAdjustment* _tmp4_ = NULL; + gdouble _tmp5_ = 0.0; + GtkAdjustment* _tmp6_ = NULL; + gdouble _tmp7_ = 0.0; + GtkAdjustment* _tmp8_ = NULL; + gdouble _tmp9_ = 0.0; + gint width = 0; + GtkAllocation _tmp10_ = {0}; + gint _tmp11_ = 0; + gint height = 0; + GtkAllocation _tmp12_ = {0}; + gint _tmp13_ = 0; + guint _tmp14_ = 0U; + gint book_width = 0; + gint book_height = 0; + gint _tmp15_ = 0; + gint _tmp16_ = 0; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + GtkAllocation _tmp20_ = {0}; + gint _tmp21_ = 0; + gboolean _tmp54_ = FALSE; +#line 373 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 375 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->need_layout; +#line 375 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp0_) { +#line 376 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return; +#line 2081 "book-view.c" + } +#line 378 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->laying_out = TRUE; +#line 381 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = self->priv->drawing_area; +#line 381 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_get_allocation (_tmp1_, &_tmp2_); +#line 381 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + allocation = _tmp2_; +#line 383 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp3_); +#line 383 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + box_allocation = _tmp3_; +#line 386 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + right_aligned = TRUE; +#line 387 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = self->priv->adjustment; +#line 387 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = gtk_adjustment_get_value (_tmp4_); +#line 387 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = self->priv->adjustment; +#line 387 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = gtk_adjustment_get_upper (_tmp6_); +#line 387 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = self->priv->adjustment; +#line 387 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = gtk_adjustment_get_page_size (_tmp8_); +#line 387 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp5_ < (_tmp7_ - _tmp9_)) { +#line 388 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + right_aligned = FALSE; +#line 2113 "book-view.c" + } +#line 391 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = allocation; +#line 391 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = _tmp10_.width; +#line 391 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + width = (gint) _tmp11_; +#line 392 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = box_allocation; +#line 392 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = _tmp12_.height; +#line 392 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = gtk_container_get_border_width ((GtkContainer*) self); +#line 392 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + height = (gint) (_tmp13_ - (_tmp14_ * 2)); +#line 394 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = width; +#line 394 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = height; +#line 394 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_layout_into (self, _tmp15_, _tmp16_, &_tmp17_, &_tmp18_); +#line 394 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_width = _tmp17_; +#line 394 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_height = _tmp18_; +#line 397 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = book_width; +#line 397 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = allocation; +#line 397 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = _tmp20_.width; +#line 397 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp19_ > _tmp21_) { +#line 2147 "book-view.c" + GtkAllocation _tmp22_ = {0}; + gint _tmp23_ = 0; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + GtkAdjustment* _tmp28_ = NULL; + GtkAdjustment* _tmp29_ = NULL; + gint _tmp30_ = 0; + GtkAdjustment* _tmp31_ = NULL; + GtkAllocation _tmp32_ = {0}; + gint _tmp33_ = 0; + gint max_offset = 0; + gint _tmp34_ = 0; + GtkAllocation _tmp35_ = {0}; + gint _tmp36_ = 0; + gboolean _tmp37_ = FALSE; + gboolean _tmp38_ = FALSE; + GtkScrollbar* _tmp43_ = NULL; +#line 400 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = allocation; +#line 400 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = _tmp22_.height; +#line 400 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + height = _tmp23_; +#line 401 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = width; +#line 401 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = height; +#line 401 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_layout_into (self, _tmp24_, _tmp25_, &_tmp26_, &_tmp27_); +#line 401 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_width = _tmp26_; +#line 401 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_height = _tmp27_; +#line 404 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp28_ = self->priv->adjustment; +#line 404 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_adjustment_set_lower (_tmp28_, (gdouble) 0); +#line 405 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp29_ = self->priv->adjustment; +#line 405 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp30_ = book_width; +#line 405 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_adjustment_set_upper (_tmp29_, (gdouble) _tmp30_); +#line 406 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp31_ = self->priv->adjustment; +#line 406 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp32_ = allocation; +#line 406 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp33_ = _tmp32_.width; +#line 406 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_adjustment_set_page_size (_tmp31_, (gdouble) _tmp33_); +#line 409 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp34_ = book_width; +#line 409 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp35_ = allocation; +#line 409 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp36_ = _tmp35_.width; +#line 409 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + max_offset = _tmp34_ - _tmp36_; +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp38_ = right_aligned; +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp38_) { +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp37_ = TRUE; +#line 2215 "book-view.c" + } else { + gint _tmp39_ = 0; + gint _tmp40_ = 0; + gint _tmp41_ = 0; +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp39_ = book_view_get_x_offset (self); +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp40_ = _tmp39_; +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp41_ = max_offset; +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp37_ = _tmp40_ > _tmp41_; +#line 2228 "book-view.c" + } +#line 410 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp37_) { +#line 2232 "book-view.c" + gint _tmp42_ = 0; +#line 411 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp42_ = max_offset; +#line 411 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_x_offset (self, _tmp42_); +#line 2238 "book-view.c" + } +#line 413 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp43_ = self->priv->scroll; +#line 413 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_set_visible ((GtkWidget*) _tmp43_, TRUE); +#line 2244 "book-view.c" + } else { + GtkScrollbar* _tmp44_ = NULL; + gint offset = 0; + gint _tmp45_ = 0; + GtkAllocation _tmp46_ = {0}; + gint _tmp47_ = 0; + GtkAdjustment* _tmp48_ = NULL; + gint _tmp49_ = 0; + GtkAdjustment* _tmp50_ = NULL; + gint _tmp51_ = 0; + GtkAdjustment* _tmp52_ = NULL; + gint _tmp53_ = 0; +#line 417 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp44_ = self->priv->scroll; +#line 417 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_set_visible ((GtkWidget*) _tmp44_, FALSE); +#line 418 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp45_ = book_width; +#line 418 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp46_ = allocation; +#line 418 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp47_ = _tmp46_.width; +#line 418 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + offset = (_tmp45_ - _tmp47_) / 2; +#line 419 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp48_ = self->priv->adjustment; +#line 419 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp49_ = offset; +#line 419 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_adjustment_set_lower (_tmp48_, (gdouble) _tmp49_); +#line 420 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp50_ = self->priv->adjustment; +#line 420 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp51_ = offset; +#line 420 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_adjustment_set_upper (_tmp50_, (gdouble) _tmp51_); +#line 421 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp52_ = self->priv->adjustment; +#line 421 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_adjustment_set_page_size (_tmp52_, (gdouble) 0); +#line 422 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp53_ = offset; +#line 422 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_x_offset (self, _tmp53_); +#line 2289 "book-view.c" + } +#line 425 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp54_ = self->priv->show_selected_page; +#line 425 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp54_) { +#line 2295 "book-view.c" + PageView* _tmp55_ = NULL; +#line 426 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp55_ = self->priv->selected_page_view; +#line 426 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_show_page_view (self, _tmp55_); +#line 2301 "book-view.c" + } +#line 428 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->need_layout = FALSE; +#line 429 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->show_selected_page = FALSE; +#line 430 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->laying_out = FALSE; +#line 2309 "book-view.c" +} + + +static gboolean book_view_draw_cb (BookView* self, GtkWidget* widget, cairo_t* context) { + gboolean result = FALSE; + Book* _tmp0_ = NULL; + guint _tmp1_ = 0U; + guint _tmp2_ = 0U; + gdouble left = 0.0; + gdouble top = 0.0; + gdouble right = 0.0; + gdouble bottom = 0.0; + cairo_t* _tmp3_ = NULL; + gdouble _tmp4_ = 0.0; + gdouble _tmp5_ = 0.0; + gdouble _tmp6_ = 0.0; + gdouble _tmp7_ = 0.0; +#line 433 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 433 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (widget != NULL, FALSE); +#line 433 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (context != NULL, FALSE); +#line 435 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->_book; +#line 435 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = book_get_n_pages (_tmp0_); +#line 435 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = _tmp1_; +#line 435 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp2_ == ((guint) 0)) { +#line 436 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 436 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 2345 "book-view.c" + } +#line 438 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_layout (self); +#line 441 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = context; +#line 441 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + cairo_clip_extents (_tmp3_, &_tmp4_, &_tmp5_, &_tmp6_, &_tmp7_); +#line 441 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + left = _tmp4_; +#line 441 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + top = _tmp5_; +#line 441 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + right = _tmp6_; +#line 441 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + bottom = _tmp7_; +#line 2361 "book-view.c" + { + gint i = 0; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 2366 "book-view.c" + { + gboolean _tmp8_ = FALSE; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = TRUE; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 2373 "book-view.c" + gint _tmp10_ = 0; + Book* _tmp11_ = NULL; + guint _tmp12_ = 0U; + guint _tmp13_ = 0U; + PageView* page = NULL; + gint _tmp14_ = 0; + PageView* _tmp15_ = NULL; + gint left_edge = 0; + PageView* _tmp16_ = NULL; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + gint _tmp19_ = 0; + gint _tmp20_ = 0; + gint right_edge = 0; + PageView* _tmp21_ = NULL; + gint _tmp22_ = 0; + gint _tmp23_ = 0; + PageView* _tmp24_ = NULL; + gint _tmp25_ = 0; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + gint _tmp28_ = 0; + gboolean _tmp29_ = FALSE; + gint _tmp30_ = 0; + gdouble _tmp31_ = 0.0; + cairo_t* _tmp34_ = NULL; + cairo_t* _tmp35_ = NULL; + gint _tmp36_ = 0; + gint _tmp37_ = 0; + PageView* _tmp38_ = NULL; + cairo_t* _tmp39_ = NULL; + cairo_t* _tmp40_ = NULL; + PageView* _tmp41_ = NULL; + gboolean _tmp42_ = FALSE; + gboolean _tmp43_ = FALSE; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp8_) { +#line 2411 "book-view.c" + gint _tmp9_ = 0; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = i; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp9_ + 1; +#line 2417 "book-view.c" + } +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = FALSE; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = i; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = self->priv->_book; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = book_get_n_pages (_tmp11_); +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = _tmp12_; +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!(((guint) _tmp10_) < _tmp13_)) { +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 2433 "book-view.c" + } +#line 446 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = i; +#line 446 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = book_view_get_nth_page (self, _tmp14_); +#line 446 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp15_; +#line 447 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = page; +#line 447 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = page_view_get_x_offset (_tmp16_); +#line 447 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = _tmp17_; +#line 447 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = book_view_get_x_offset (self); +#line 447 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = _tmp19_; +#line 447 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + left_edge = _tmp18_ - _tmp20_; +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = page; +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = page_view_get_x_offset (_tmp21_); +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = _tmp22_; +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = page; +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = page_view_get_width (_tmp24_); +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp26_ = _tmp25_; +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp27_ = book_view_get_x_offset (self); +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp28_ = _tmp27_; +#line 448 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + right_edge = (_tmp23_ + _tmp26_) - _tmp28_; +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp30_ = right_edge; +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp31_ = left; +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (((gdouble) _tmp30_) < _tmp31_) { +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp29_ = TRUE; +#line 2479 "book-view.c" + } else { + gint _tmp32_ = 0; + gdouble _tmp33_ = 0.0; +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp32_ = left_edge; +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp33_ = right; +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp29_ = ((gdouble) _tmp32_) > _tmp33_; +#line 2489 "book-view.c" + } +#line 451 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp29_) { +#line 452 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (page); +#line 452 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + continue; +#line 2497 "book-view.c" + } +#line 454 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp34_ = context; +#line 454 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + cairo_save (_tmp34_); +#line 455 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp35_ = context; +#line 455 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp36_ = book_view_get_x_offset (self); +#line 455 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp37_ = _tmp36_; +#line 455 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + cairo_translate (_tmp35_, (gdouble) (-_tmp37_), (gdouble) 0); +#line 456 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp38_ = page; +#line 456 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp39_ = context; +#line 456 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_render (_tmp38_, _tmp39_); +#line 457 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp40_ = context; +#line 457 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + cairo_restore (_tmp40_); +#line 459 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp41_ = page; +#line 459 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp42_ = page_view_get_selected (_tmp41_); +#line 459 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp43_ = _tmp42_; +#line 459 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp43_) { +#line 2529 "book-view.c" + GtkWidget* _tmp44_ = NULL; + GtkStyleContext* _tmp45_ = NULL; + cairo_t* _tmp46_ = NULL; + PageView* _tmp47_ = NULL; + gint _tmp48_ = 0; + gint _tmp49_ = 0; + gint _tmp50_ = 0; + gint _tmp51_ = 0; + PageView* _tmp52_ = NULL; + gint _tmp53_ = 0; + gint _tmp54_ = 0; + PageView* _tmp55_ = NULL; + gint _tmp56_ = 0; + gint _tmp57_ = 0; + PageView* _tmp58_ = NULL; + gint _tmp59_ = 0; + gint _tmp60_ = 0; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp44_ = self->priv->drawing_area; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp45_ = gtk_widget_get_style_context (_tmp44_); +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp46_ = context; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp47_ = page; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp48_ = page_view_get_x_offset (_tmp47_); +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp49_ = _tmp48_; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp50_ = book_view_get_x_offset (self); +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp51_ = _tmp50_; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp52_ = page; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp53_ = page_view_get_y_offset (_tmp52_); +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp54_ = _tmp53_; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp55_ = page; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp56_ = page_view_get_width (_tmp55_); +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp57_ = _tmp56_; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp58_ = page; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp59_ = page_view_get_height (_tmp58_); +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp60_ = _tmp59_; +#line 460 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_render_focus (_tmp45_, _tmp46_, (gdouble) (_tmp49_ - _tmp51_), (gdouble) _tmp54_, (gdouble) _tmp57_, (gdouble) _tmp60_); +#line 2583 "book-view.c" + } +#line 444 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (page); +#line 2587 "book-view.c" + } + } + } +#line 467 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 467 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 2595 "book-view.c" +} + + +static PageView* book_view_get_page_at (BookView* self, gint x, gint y, gint* x_, gint* y_) { + gint _vala_x_ = 0; + gint _vala_y_ = 0; + PageView* result = NULL; + gint _tmp0_ = 0; +#line 470 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 472 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_y_ = 0; +#line 472 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = _vala_y_; +#line 472 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_x_ = _tmp0_; +#line 2612 "book-view.c" + { + gint i = 0; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = 0; +#line 2617 "book-view.c" + { + gboolean _tmp1_ = FALSE; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = TRUE; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + while (TRUE) { +#line 2624 "book-view.c" + gint _tmp3_ = 0; + Book* _tmp4_ = NULL; + guint _tmp5_ = 0U; + guint _tmp6_ = 0U; + PageView* page = NULL; + gint _tmp7_ = 0; + PageView* _tmp8_ = NULL; + gint left = 0; + PageView* _tmp9_ = NULL; + gint _tmp10_ = 0; + gint _tmp11_ = 0; + gint right = 0; + gint _tmp12_ = 0; + PageView* _tmp13_ = NULL; + gint _tmp14_ = 0; + gint _tmp15_ = 0; + gint top = 0; + PageView* _tmp16_ = NULL; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + gint bottom = 0; + gint _tmp19_ = 0; + PageView* _tmp20_ = NULL; + gint _tmp21_ = 0; + gint _tmp22_ = 0; + gboolean _tmp23_ = FALSE; + gboolean _tmp24_ = FALSE; + gboolean _tmp25_ = FALSE; + gint _tmp26_ = 0; + gint _tmp27_ = 0; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp1_) { +#line 2657 "book-view.c" + gint _tmp2_ = 0; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = i; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + i = _tmp2_ + 1; +#line 2663 "book-view.c" + } +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = FALSE; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = i; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = self->priv->_book; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = book_get_n_pages (_tmp4_); +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = _tmp5_; +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!(((guint) _tmp3_) < _tmp6_)) { +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 2679 "book-view.c" + } +#line 475 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = i; +#line 475 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = book_view_get_nth_page (self, _tmp7_); +#line 475 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page = _tmp8_; +#line 476 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = page; +#line 476 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = page_view_get_x_offset (_tmp9_); +#line 476 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = _tmp10_; +#line 476 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + left = _tmp11_; +#line 477 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = left; +#line 477 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = page; +#line 477 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = page_view_get_width (_tmp13_); +#line 477 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = _tmp14_; +#line 477 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + right = _tmp12_ + _tmp15_; +#line 478 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = page; +#line 478 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = page_view_get_y_offset (_tmp16_); +#line 478 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = _tmp17_; +#line 478 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + top = _tmp18_; +#line 479 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = top; +#line 479 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = page; +#line 479 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = page_view_get_height (_tmp20_); +#line 479 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = _tmp21_; +#line 479 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + bottom = _tmp19_ + _tmp22_; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp26_ = x; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp27_ = left; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp26_ >= _tmp27_) { +#line 2729 "book-view.c" + gint _tmp28_ = 0; + gint _tmp29_ = 0; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp28_ = x; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp29_ = right; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = _tmp28_ <= _tmp29_; +#line 2738 "book-view.c" + } else { +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = FALSE; +#line 2742 "book-view.c" + } +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp25_) { +#line 2746 "book-view.c" + gint _tmp30_ = 0; + gint _tmp31_ = 0; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp30_ = y; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp31_ = top; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = _tmp30_ >= _tmp31_; +#line 2755 "book-view.c" + } else { +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = FALSE; +#line 2759 "book-view.c" + } +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp24_) { +#line 2763 "book-view.c" + gint _tmp32_ = 0; + gint _tmp33_ = 0; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp32_ = y; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp33_ = bottom; +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = _tmp32_ <= _tmp33_; +#line 2772 "book-view.c" + } else { +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = FALSE; +#line 2776 "book-view.c" + } +#line 480 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp23_) { +#line 2780 "book-view.c" + gint _tmp34_ = 0; + gint _tmp35_ = 0; + gint _tmp36_ = 0; + gint _tmp37_ = 0; +#line 482 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp34_ = x; +#line 482 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp35_ = left; +#line 482 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_x_ = _tmp34_ - _tmp35_; +#line 483 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp36_ = y; +#line 483 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp37_ = top; +#line 483 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _vala_y_ = _tmp36_ - _tmp37_; +#line 484 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = page; +#line 484 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (x_) { +#line 484 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + *x_ = _vala_x_; +#line 2803 "book-view.c" + } +#line 484 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (y_) { +#line 484 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + *y_ = _vala_y_; +#line 2809 "book-view.c" + } +#line 484 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 2813 "book-view.c" + } +#line 473 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (page); +#line 2817 "book-view.c" + } + } + } +#line 488 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = NULL; +#line 488 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (x_) { +#line 488 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + *x_ = _vala_x_; +#line 2827 "book-view.c" + } +#line 488 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (y_) { +#line 488 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + *y_ = _vala_y_; +#line 2833 "book-view.c" + } +#line 488 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 2837 "book-view.c" +} + + +static gboolean book_view_button_cb (BookView* self, GtkWidget* widget, GdkEventButton* event) { + gboolean result = FALSE; + GtkWidget* _tmp0_ = NULL; + gint x = 0; + gint y = 0; + GdkEventButton* _tmp1_ = NULL; + GdkEventType _tmp2_ = 0; + PageView* _tmp13_ = NULL; + GdkEventButton* _tmp14_ = NULL; + guint _tmp15_ = 0U; + GdkEventButton* _tmp30_ = NULL; + guint _tmp31_ = 0U; +#line 491 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 491 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (widget != NULL, FALSE); +#line 491 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (event != NULL, FALSE); +#line 493 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_layout (self); +#line 495 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->drawing_area; +#line 495 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_grab_focus (_tmp0_); +#line 497 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + x = 0; +#line 497 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + y = 0; +#line 498 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = event; +#line 498 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = _tmp1_->type; +#line 498 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp2_ == GDK_BUTTON_PRESS) { +#line 2875 "book-view.c" + GdkEventButton* _tmp3_ = NULL; + gdouble _tmp4_ = 0.0; + gint _tmp5_ = 0; + gint _tmp6_ = 0; + GdkEventButton* _tmp7_ = NULL; + gdouble _tmp8_ = 0.0; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + PageView* _tmp11_ = NULL; + PageView* _tmp12_ = NULL; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = event; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = _tmp3_->x; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = book_view_get_x_offset (self); +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = _tmp5_; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = event; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = _tmp7_->y; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = book_view_get_page_at (self, (gint) (_tmp4_ + _tmp6_), (gint) _tmp8_, &_tmp9_, &_tmp10_); +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + x = _tmp9_; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + y = _tmp10_; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = _tmp11_; +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, _tmp12_); +#line 499 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (_tmp12_); +#line 2910 "book-view.c" + } +#line 501 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = self->priv->selected_page_view; +#line 501 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp13_ == NULL) { +#line 502 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 502 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 2920 "book-view.c" + } +#line 505 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = event; +#line 505 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = _tmp14_->button; +#line 505 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp15_ == ((guint) 1)) { +#line 2928 "book-view.c" + GdkEventButton* _tmp16_ = NULL; + GdkEventType _tmp17_ = 0; +#line 507 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = event; +#line 507 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = _tmp16_->type; +#line 507 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp17_ == GDK_BUTTON_PRESS) { +#line 2937 "book-view.c" + PageView* _tmp18_ = NULL; + gint _tmp19_ = 0; + gint _tmp20_ = 0; +#line 508 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = self->priv->selected_page_view; +#line 508 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = x; +#line 508 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = y; +#line 508 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_button_press (_tmp18_, _tmp19_, _tmp20_); +#line 2949 "book-view.c" + } else { + GdkEventButton* _tmp21_ = NULL; + GdkEventType _tmp22_ = 0; +#line 509 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = event; +#line 509 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = _tmp21_->type; +#line 509 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp22_ == GDK_BUTTON_RELEASE) { +#line 2959 "book-view.c" + PageView* _tmp23_ = NULL; + gint _tmp24_ = 0; + gint _tmp25_ = 0; +#line 510 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = self->priv->selected_page_view; +#line 510 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = x; +#line 510 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = y; +#line 510 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_button_release (_tmp23_, _tmp24_, _tmp25_); +#line 2971 "book-view.c" + } else { + GdkEventButton* _tmp26_ = NULL; + GdkEventType _tmp27_ = 0; +#line 511 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp26_ = event; +#line 511 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp27_ = _tmp26_->type; +#line 511 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp27_ == GDK_2BUTTON_PRESS) { +#line 2981 "book-view.c" + Page* _tmp28_ = NULL; + Page* _tmp29_ = NULL; +#line 512 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp28_ = book_view_get_selected_page (self); +#line 512 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp29_ = _tmp28_; +#line 512 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_emit_by_name (self, "show-page", _tmp29_); +#line 2990 "book-view.c" + } + } + } + } +#line 516 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp30_ = event; +#line 516 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp31_ = _tmp30_->button; +#line 516 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp31_ == ((guint) 3)) { +#line 517 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_emit_by_name (self, "show-menu"); +#line 3003 "book-view.c" + } +#line 519 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 519 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3009 "book-view.c" +} + + +static void book_view_set_cursor (BookView* self, GdkCursorType cursor) { + GdkCursor* c = NULL; + GdkCursorType _tmp0_ = 0; + GdkCursorType _tmp1_ = 0; + GdkCursorType _tmp2_ = 0; + GdkCursorType _tmp3_ = 0; + GdkCursor* _tmp4_ = NULL; + GtkWidget* _tmp5_ = NULL; + GdkWindow* _tmp6_ = NULL; + GdkCursor* _tmp7_ = NULL; +#line 522 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 526 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->cursor; +#line 526 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = cursor; +#line 526 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp0_ == _tmp1_) { +#line 527 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (c); +#line 527 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return; +#line 3035 "book-view.c" + } +#line 528 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = cursor; +#line 528 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->cursor = _tmp2_; +#line 530 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = cursor; +#line 530 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = gdk_cursor_new (_tmp3_); +#line 530 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (c); +#line 530 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + c = _tmp4_; +#line 531 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = self->priv->drawing_area; +#line 531 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = gtk_widget_get_window (_tmp5_); +#line 531 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = c; +#line 531 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gdk_window_set_cursor (_tmp6_, _tmp7_); +#line 522 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (c); +#line 3059 "book-view.c" +} + + +static gboolean book_view_motion_cb (BookView* self, GtkWidget* widget, GdkEventMotion* event) { + gboolean result = FALSE; + GdkCursorType cursor = 0; + gboolean _tmp0_ = FALSE; + PageView* _tmp1_ = NULL; + GdkCursorType _tmp38_ = 0; +#line 534 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 534 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (widget != NULL, FALSE); +#line 534 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (event != NULL, FALSE); +#line 536 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + cursor = GDK_ARROW; +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = self->priv->selected_page_view; +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp1_ != NULL) { +#line 3081 "book-view.c" + GdkEventMotion* _tmp2_ = NULL; + GdkModifierType _tmp3_ = 0; +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = event; +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = _tmp2_->state; +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = (_tmp3_ & GDK_BUTTON1_MASK) != 0; +#line 3090 "book-view.c" + } else { +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = FALSE; +#line 3094 "book-view.c" + } +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp0_) { +#line 3098 "book-view.c" + gint x = 0; + GdkEventMotion* _tmp4_ = NULL; + gdouble _tmp5_ = 0.0; + gint _tmp6_ = 0; + gint _tmp7_ = 0; + PageView* _tmp8_ = NULL; + gint _tmp9_ = 0; + gint _tmp10_ = 0; + gint y = 0; + GdkEventMotion* _tmp11_ = NULL; + gdouble _tmp12_ = 0.0; + PageView* _tmp13_ = NULL; + gint _tmp14_ = 0; + gint _tmp15_ = 0; + PageView* _tmp16_ = NULL; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + PageView* _tmp19_ = NULL; + GdkCursorType _tmp20_ = 0; + GdkCursorType _tmp21_ = 0; +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = event; +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = _tmp4_->x; +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = book_view_get_x_offset (self); +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = _tmp6_; +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = self->priv->selected_page_view; +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = page_view_get_x_offset (_tmp8_); +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = _tmp9_; +#line 541 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + x = (gint) ((_tmp5_ + _tmp7_) - _tmp10_); +#line 542 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = event; +#line 542 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = _tmp11_->y; +#line 542 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = self->priv->selected_page_view; +#line 542 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = page_view_get_y_offset (_tmp13_); +#line 542 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = _tmp14_; +#line 542 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + y = (gint) (_tmp12_ - _tmp15_); +#line 543 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = self->priv->selected_page_view; +#line 543 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp17_ = x; +#line 543 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = y; +#line 543 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_motion (_tmp16_, _tmp17_, _tmp18_); +#line 544 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp19_ = self->priv->selected_page_view; +#line 544 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = page_view_get_cursor (_tmp19_); +#line 544 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp21_ = _tmp20_; +#line 544 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + cursor = _tmp21_; +#line 3163 "book-view.c" + } else { + gint x = 0; + gint y = 0; + PageView* over_page = NULL; + GdkEventMotion* _tmp22_ = NULL; + gdouble _tmp23_ = 0.0; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + GdkEventMotion* _tmp26_ = NULL; + gdouble _tmp27_ = 0.0; + gint _tmp28_ = 0; + gint _tmp29_ = 0; + PageView* _tmp30_ = NULL; + PageView* _tmp31_ = NULL; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = event; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp23_ = _tmp22_->x; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = book_view_get_x_offset (self); +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp25_ = _tmp24_; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp26_ = event; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp27_ = _tmp26_->y; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp30_ = book_view_get_page_at (self, (gint) (_tmp23_ + _tmp25_), (gint) _tmp27_, &_tmp28_, &_tmp29_); +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + x = _tmp28_; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + y = _tmp29_; +#line 549 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + over_page = _tmp30_; +#line 550 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp31_ = over_page; +#line 550 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp31_ != NULL) { +#line 3202 "book-view.c" + PageView* _tmp32_ = NULL; + gint _tmp33_ = 0; + gint _tmp34_ = 0; + PageView* _tmp35_ = NULL; + GdkCursorType _tmp36_ = 0; + GdkCursorType _tmp37_ = 0; +#line 552 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp32_ = over_page; +#line 552 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp33_ = x; +#line 552 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp34_ = y; +#line 552 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + page_view_motion (_tmp32_, _tmp33_, _tmp34_); +#line 553 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp35_ = over_page; +#line 553 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp36_ = page_view_get_cursor (_tmp35_); +#line 553 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp37_ = _tmp36_; +#line 553 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + cursor = _tmp37_; +#line 3225 "book-view.c" + } +#line 539 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (over_page); +#line 3229 "book-view.c" + } +#line 557 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp38_ = cursor; +#line 557 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_cursor (self, _tmp38_); +#line 559 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 559 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3239 "book-view.c" +} + + +static gboolean book_view_key_cb (BookView* self, GtkWidget* widget, GdkEventKey* event) { + gboolean result = FALSE; + GdkEventKey* _tmp0_ = NULL; + guint _tmp1_ = 0U; +#line 562 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 562 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (widget != NULL, FALSE); +#line 562 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (event != NULL, FALSE); +#line 564 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = event; +#line 564 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = _tmp0_->keyval; +#line 564 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + switch (_tmp1_) { +#line 564 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case 0xff50: +#line 3261 "book-view.c" + { + Book* _tmp2_ = NULL; + Page* _tmp3_ = NULL; + Page* _tmp4_ = NULL; +#line 567 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = self->priv->_book; +#line 567 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = book_get_page (_tmp2_, 0); +#line 567 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = _tmp3_; +#line 567 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_selected_page (self, _tmp4_); +#line 567 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (_tmp4_); +#line 568 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = TRUE; +#line 568 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3280 "book-view.c" + } +#line 564 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case 0xff51: +#line 3284 "book-view.c" + { + PageView* _tmp5_ = NULL; + PageView* _tmp6_ = NULL; + PageView* _tmp7_ = NULL; +#line 570 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = self->priv->selected_page_view; +#line 570 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = book_view_get_prev_page (self, _tmp5_); +#line 570 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp7_ = _tmp6_; +#line 570 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, _tmp7_); +#line 570 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (_tmp7_); +#line 571 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = TRUE; +#line 571 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3303 "book-view.c" + } +#line 564 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case 0xff53: +#line 3307 "book-view.c" + { + PageView* _tmp8_ = NULL; + PageView* _tmp9_ = NULL; + PageView* _tmp10_ = NULL; +#line 573 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = self->priv->selected_page_view; +#line 573 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp9_ = book_view_get_next_page (self, _tmp8_); +#line 573 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = _tmp9_; +#line 573 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, _tmp10_); +#line 573 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (_tmp10_); +#line 574 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = TRUE; +#line 574 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3326 "book-view.c" + } +#line 564 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case 0xFF57: +#line 3330 "book-view.c" + { + Book* _tmp11_ = NULL; + Book* _tmp12_ = NULL; + guint _tmp13_ = 0U; + guint _tmp14_ = 0U; + Page* _tmp15_ = NULL; + Page* _tmp16_ = NULL; +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp11_ = self->priv->_book; +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = self->priv->_book; +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp13_ = book_get_n_pages (_tmp12_); +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = _tmp13_; +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp15_ = book_get_page (_tmp11_, ((gint) _tmp14_) - 1); +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = _tmp15_; +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_selected_page (self, _tmp16_); +#line 576 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_unref0 (_tmp16_); +#line 577 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = TRUE; +#line 577 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3358 "book-view.c" + } + default: + { +#line 580 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 580 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3366 "book-view.c" + } + } +} + + +static gboolean book_view_focus_cb (BookView* self, GtkWidget* widget, GdkEventFocus* event) { + gboolean result = FALSE; + PageView* _tmp0_ = NULL; +#line 584 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, FALSE); +#line 584 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (widget != NULL, FALSE); +#line 584 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (event != NULL, FALSE); +#line 586 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->selected_page_view; +#line 586 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_selected_page_view (self, _tmp0_); +#line 587 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = FALSE; +#line 587 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3389 "book-view.c" +} + + +static void book_view_scroll_cb (BookView* self, GtkAdjustment* adjustment) { + gboolean _tmp0_ = FALSE; +#line 590 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 590 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (adjustment != NULL); +#line 592 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->laying_out; +#line 592 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (!_tmp0_) { +#line 593 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_redraw (self); +#line 3405 "book-view.c" + } +} + + +void book_view_redraw (BookView* self) { + GtkWidget* _tmp0_ = NULL; +#line 596 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 598 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->drawing_area; +#line 598 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_widget_queue_draw (_tmp0_); +#line 3418 "book-view.c" +} + + +void book_view_select_next_page (BookView* self) { + PageView* _tmp0_ = NULL; + PageView* _tmp1_ = NULL; + PageView* _tmp2_ = NULL; +#line 601 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 603 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->selected_page_view; +#line 603 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = book_view_get_next_page (self, _tmp0_); +#line 603 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = _tmp1_; +#line 603 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, _tmp2_); +#line 603 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (_tmp2_); +#line 3438 "book-view.c" +} + + +void book_view_select_prev_page (BookView* self) { + PageView* _tmp0_ = NULL; + PageView* _tmp1_ = NULL; + PageView* _tmp2_ = NULL; +#line 606 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 608 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->selected_page_view; +#line 608 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = book_view_get_prev_page (self, _tmp0_); +#line 608 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = _tmp1_; +#line 608 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, _tmp2_); +#line 608 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (_tmp2_); +#line 3458 "book-view.c" +} + + +Book* book_view_get_book (BookView* self) { + Book* result; + Book* _tmp0_ = NULL; +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->_book; +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = _tmp0_; +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3473 "book-view.c" +} + + +static gpointer _book_ref0 (gpointer self) { +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return self ? book_ref (self) : NULL; +#line 3480 "book-view.c" +} + + +static void book_view_set_book (BookView* self, Book* value) { + Book* _tmp0_ = NULL; + Book* _tmp1_ = NULL; +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = value; +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = _book_ref0 (_tmp0_); +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _book_unref0 (self->priv->_book); +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->_book = _tmp1_; +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_notify ((GObject *) self, "book"); +#line 3499 "book-view.c" +} + + +Page* book_view_get_selected_page (BookView* self) { + Page* result; + PageView* _tmp0_ = NULL; +#line 30 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, NULL); +#line 32 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->selected_page_view; +#line 32 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp0_ != NULL) { +#line 3512 "book-view.c" + PageView* _tmp1_ = NULL; + Page* _tmp2_ = NULL; + Page* _tmp3_ = NULL; +#line 33 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = self->priv->selected_page_view; +#line 33 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = page_view_get_page (_tmp1_); +#line 33 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = _tmp2_; +#line 33 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = _tmp3_; +#line 33 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3526 "book-view.c" + } else { +#line 35 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = NULL; +#line 35 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3532 "book-view.c" + } +} + + +void book_view_set_selected_page (BookView* self, Page* value) { + Page* _tmp0_ = NULL; + Page* _tmp1_ = NULL; + Page* _tmp2_ = NULL; + Page* _tmp3_ = NULL; +#line 37 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 39 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = book_view_get_selected_page (self); +#line 39 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = _tmp0_; +#line 39 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = value; +#line 39 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp1_ == _tmp2_) { +#line 40 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return; +#line 3554 "book-view.c" + } +#line 42 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp3_ = value; +#line 42 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (_tmp3_ != NULL) { +#line 3560 "book-view.c" + GHashTable* _tmp4_ = NULL; + Page* _tmp5_ = NULL; + gconstpointer _tmp6_ = NULL; +#line 43 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = self->priv->page_data; +#line 43 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp5_ = value; +#line 43 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = g_hash_table_lookup (_tmp4_, _tmp5_); +#line 43 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, (PageView*) _tmp6_); +#line 3572 "book-view.c" + } else { +#line 45 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_select_page_view (self, NULL); +#line 3576 "book-view.c" + } +#line 37 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_notify ((GObject *) self, "selected-page"); +#line 3580 "book-view.c" +} + + +gint book_view_get_x_offset (BookView* self) { + gint result; + GtkAdjustment* _tmp0_ = NULL; + gdouble _tmp1_ = 0.0; +#line 64 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_val_if_fail (self != NULL, 0); +#line 66 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->adjustment; +#line 66 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = gtk_adjustment_get_value (_tmp0_); +#line 66 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + result = (gint) _tmp1_; +#line 66 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + return result; +#line 3598 "book-view.c" +} + + +void book_view_set_x_offset (BookView* self, gint value) { + GtkAdjustment* _tmp0_ = NULL; + gint _tmp1_ = 0; +#line 68 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (self != NULL); +#line 70 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->adjustment; +#line 70 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp1_ = value; +#line 70 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + gtk_adjustment_set_value (_tmp0_, (gdouble) _tmp1_); +#line 68 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_notify ((GObject *) self, "x-offset"); +#line 3615 "book-view.c" +} + + +static void g_cclosure_user_marshal_VOID__PAGE (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { + typedef void (*GMarshalFunc_VOID__PAGE) (gpointer data1, gpointer arg_1, gpointer data2); + register GMarshalFunc_VOID__PAGE callback; + register GCClosure * cc; + register gpointer data1; + register gpointer data2; + cc = (GCClosure *) closure; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_return_if_fail (n_param_values == 2); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + if (G_CCLOSURE_SWAP_DATA (closure)) { +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + data1 = closure->data; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + data2 = param_values->data[0].v_pointer; +#line 3634 "book-view.c" + } else { +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + data1 = param_values->data[0].v_pointer; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + data2 = closure->data; +#line 3640 "book-view.c" + } +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + callback = (GMarshalFunc_VOID__PAGE) (marshal_data ? marshal_data : cc->callback); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + callback (data1, value_get_page (param_values + 1), data2); +#line 3646 "book-view.c" +} + + +static void book_view_class_init (BookViewClass * klass) { +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_parent_class = g_type_class_peek_parent (klass); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_type_class_add_private (klass, sizeof (BookViewPrivate)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + G_OBJECT_CLASS (klass)->get_property = _vala_book_view_get_property; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + G_OBJECT_CLASS (klass)->set_property = _vala_book_view_set_property; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + G_OBJECT_CLASS (klass)->finalize = book_view_finalize; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), BOOK_VIEW_BOOK, param_spec_book ("book", "book", "book", TYPE_BOOK, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), BOOK_VIEW_SELECTED_PAGE, param_spec_page ("selected-page", "selected-page", "selected-page", TYPE_PAGE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_object_class_install_property (G_OBJECT_CLASS (klass), BOOK_VIEW_X_OFFSET, g_param_spec_int ("x-offset", "x-offset", "x-offset", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_new ("page_selected", TYPE_BOOK_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__PAGE, G_TYPE_NONE, 1, TYPE_PAGE); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_new ("show_page", TYPE_BOOK_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__PAGE, G_TYPE_NONE, 1, TYPE_PAGE); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_new ("show_menu", TYPE_BOOK_VIEW, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); +#line 3673 "book-view.c" +} + + +static void book_view_instance_init (BookView * self) { +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv = BOOK_VIEW_GET_PRIVATE (self); +#line 27 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self->priv->selected_page_view = NULL; +#line 3682 "book-view.c" +} + + +static void book_view_finalize (GObject* obj) { + BookView * self; + Book* _tmp0_ = NULL; + guint _tmp1_ = 0U; + Book* _tmp2_ = NULL; + guint _tmp3_ = 0U; + Book* _tmp4_ = NULL; + guint _tmp5_ = 0U; + Book* _tmp6_ = NULL; + guint _tmp7_ = 0U; + GtkWidget* _tmp8_ = NULL; + guint _tmp9_ = 0U; + GtkWidget* _tmp10_ = NULL; + guint _tmp11_ = 0U; + GtkWidget* _tmp12_ = NULL; + guint _tmp13_ = 0U; + GtkWidget* _tmp14_ = NULL; + guint _tmp15_ = 0U; + GtkWidget* _tmp16_ = NULL; + guint _tmp17_ = 0U; + GtkWidget* _tmp18_ = NULL; + guint _tmp19_ = 0U; + GtkWidget* _tmp20_ = NULL; + guint _tmp21_ = 0U; + GtkWidget* _tmp22_ = NULL; + guint _tmp23_ = 0U; + GtkAdjustment* _tmp24_ = NULL; + guint _tmp25_ = 0U; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_BOOK_VIEW, BookView); +#line 123 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp0_ = self->priv->_book; +#line 123 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("page-added", TYPE_BOOK, &_tmp1_, NULL, FALSE); +#line 123 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp0_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp1_, 0, NULL, (GCallback) _book_view_add_cb_book_page_added, self); +#line 124 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp2_ = self->priv->_book; +#line 124 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("page-removed", TYPE_BOOK, &_tmp3_, NULL, FALSE); +#line 124 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp2_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp3_, 0, NULL, (GCallback) _book_view_remove_cb_book_page_removed, self); +#line 125 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp4_ = self->priv->_book; +#line 125 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("reordered", TYPE_BOOK, &_tmp5_, NULL, FALSE); +#line 125 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp4_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp5_, 0, NULL, (GCallback) _book_view_reorder_cb_book_reordered, self); +#line 126 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp6_ = self->priv->_book; +#line 126 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("cleared", TYPE_BOOK, &_tmp7_, NULL, FALSE); +#line 126 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp6_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp7_, 0, NULL, (GCallback) _book_view_clear_cb_book_cleared, self); +#line 127 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp8_ = self->priv->drawing_area; +#line 127 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("configure-event", GTK_TYPE_WIDGET, &_tmp9_, NULL, FALSE); +#line 127 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp8_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp9_, 0, NULL, (GCallback) _book_view_configure_cb_gtk_widget_configure_event, self); +#line 128 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp10_ = self->priv->drawing_area; +#line 128 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("draw", GTK_TYPE_WIDGET, &_tmp11_, NULL, FALSE); +#line 128 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp10_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp11_, 0, NULL, (GCallback) _book_view_draw_cb_gtk_widget_draw, self); +#line 129 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp12_ = self->priv->drawing_area; +#line 129 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("motion-notify-event", GTK_TYPE_WIDGET, &_tmp13_, NULL, FALSE); +#line 129 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp12_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp13_, 0, NULL, (GCallback) _book_view_motion_cb_gtk_widget_motion_notify_event, self); +#line 130 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp14_ = self->priv->drawing_area; +#line 130 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("key-press-event", GTK_TYPE_WIDGET, &_tmp15_, NULL, FALSE); +#line 130 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp14_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp15_, 0, NULL, (GCallback) _book_view_key_cb_gtk_widget_key_press_event, self); +#line 131 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp16_ = self->priv->drawing_area; +#line 131 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("button-press-event", GTK_TYPE_WIDGET, &_tmp17_, NULL, FALSE); +#line 131 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp16_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp17_, 0, NULL, (GCallback) _book_view_button_cb_gtk_widget_button_press_event, self); +#line 132 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp18_ = self->priv->drawing_area; +#line 132 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("button-release-event", GTK_TYPE_WIDGET, &_tmp19_, NULL, FALSE); +#line 132 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp18_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp19_, 0, NULL, (GCallback) _book_view_button_cb_gtk_widget_button_release_event, self); +#line 133 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp20_ = self->priv->drawing_area; +#line 133 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("focus-in-event", GTK_TYPE_WIDGET, &_tmp21_, NULL, FALSE); +#line 133 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp20_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp21_, 0, NULL, (GCallback) _book_view_focus_cb_gtk_widget_focus_in_event, self); +#line 134 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp22_ = self->priv->drawing_area; +#line 134 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("focus-out-event", GTK_TYPE_WIDGET, &_tmp23_, NULL, FALSE); +#line 134 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp22_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp23_, 0, NULL, (GCallback) _book_view_focus_cb_gtk_widget_focus_out_event, self); +#line 135 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _tmp24_ = self->priv->adjustment; +#line 135 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_parse_name ("value-changed", GTK_TYPE_ADJUSTMENT, &_tmp25_, NULL, FALSE); +#line 135 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_signal_handlers_disconnect_matched (_tmp24_, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp25_, 0, NULL, (GCallback) _book_view_scroll_cb_gtk_adjustment_value_changed, self); +#line 18 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _book_unref0 (self->priv->_book); +#line 19 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_hash_table_unref0 (self->priv->page_data); +#line 27 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _page_view_unref0 (self->priv->selected_page_view); +#line 50 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (self->priv->drawing_area); +#line 53 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (self->priv->scroll); +#line 54 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + _g_object_unref0 (self->priv->adjustment); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + G_OBJECT_CLASS (book_view_parent_class)->finalize (obj); +#line 3808 "book-view.c" +} + + +GType book_view_get_type (void) { + static volatile gsize book_view_type_id__volatile = 0; + if (g_once_init_enter (&book_view_type_id__volatile)) { + static const GTypeInfo g_define_type_info = { sizeof (BookViewClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) book_view_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BookView), 0, (GInstanceInitFunc) book_view_instance_init, NULL }; + GType book_view_type_id; + book_view_type_id = g_type_register_static (GTK_TYPE_BOX, "BookView", &g_define_type_info, 0); + g_once_init_leave (&book_view_type_id__volatile, book_view_type_id); + } + return book_view_type_id__volatile; +} + + +static void _vala_book_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { + BookView * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BOOK_VIEW, BookView); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + switch (property_id) { +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case BOOK_VIEW_BOOK: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + value_set_book (value, book_view_get_book (self)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case BOOK_VIEW_SELECTED_PAGE: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + value_set_page (value, book_view_get_selected_page (self)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case BOOK_VIEW_X_OFFSET: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + g_value_set_int (value, book_view_get_x_offset (self)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 3847 "book-view.c" + default: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 3853 "book-view.c" + } +} + + +static void _vala_book_view_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) { + BookView * self; + self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_BOOK_VIEW, BookView); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + switch (property_id) { +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case BOOK_VIEW_BOOK: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_book (self, value_get_book (value)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case BOOK_VIEW_SELECTED_PAGE: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_selected_page (self, value_get_page (value)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + case BOOK_VIEW_X_OFFSET: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + book_view_set_x_offset (self, g_value_get_int (value)); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 3881 "book-view.c" + default: +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +#line 15 "/home/bob/bzr/simple-scan/trunk/src/book-view.vala" + break; +#line 3887 "book-view.c" + } +} + + + |