diff options
Diffstat (limited to 'src/book-view.c')
-rw-r--r-- | src/book-view.c | 1861 |
1 files changed, 1291 insertions, 570 deletions
diff --git a/src/book-view.c b/src/book-view.c index 5d2e84d..f989d83 100644 --- a/src/book-view.c +++ b/src/book-view.c @@ -1,4 +1,4 @@ -/* book-view.c generated by valac 0.13.1, the Vala compiler +/* book-view.c generated by valac 0.13.4, the Vala compiler * generated from book-view.vala, do not modify */ /* @@ -301,81 +301,149 @@ static void _book_view_scroll_cb_gtk_adjustment_value_changed (GtkAdjustment* _s BookView* book_view_construct (GType object_type, Book* book) { BookView * self = NULL; Book* _tmp0_; - Page* _tmp4_ = NULL; - Page* _tmp5_; - GHashTable* _tmp6_ = NULL; - GtkDrawingArea* _tmp7_ = NULL; - GtkHScrollbar* _tmp8_ = NULL; - GtkAdjustment* _tmp9_ = NULL; - GtkAdjustment* _tmp10_; + Book* _tmp1_; + Book* _tmp13_; + Page* _tmp14_ = NULL; + Page* _tmp15_; + Book* _tmp16_; + Book* _tmp17_; + Book* _tmp18_; + Book* _tmp19_; + GHashFunc _tmp20_; + GEqualFunc _tmp21_; + GHashTable* _tmp22_; + GtkDrawingArea* _tmp23_; + GtkWidget* _tmp24_; + GtkWidget* _tmp25_; + GtkWidget* _tmp26_; + GtkWidget* _tmp27_; + GtkWidget* _tmp28_; + GtkHScrollbar* _tmp29_; + GtkHScrollbar* _tmp30_; + GtkHScrollbar* _tmp31_; + GtkAdjustment* _tmp32_ = NULL; + GtkAdjustment* _tmp33_; + GtkHScrollbar* _tmp34_; + GtkWidget* _tmp35_; + GtkWidget* _tmp36_; + GtkWidget* _tmp37_; + GtkWidget* _tmp38_; + GtkWidget* _tmp39_; + GtkWidget* _tmp40_; + GtkWidget* _tmp41_; + GtkWidget* _tmp42_; + GtkAdjustment* _tmp43_; + GtkWidget* _tmp44_; g_return_val_if_fail (book != NULL, NULL); self = (BookView*) g_object_new (object_type, NULL); - _tmp0_ = _book_ref0 (book); + _tmp0_ = book; + _tmp1_ = _book_ref0 (_tmp0_); _book_unref0 (self->priv->book); - self->priv->book = _tmp0_; + self->priv->book = _tmp1_; { gint i; i = 0; { - gboolean _tmp1_; - _tmp1_ = TRUE; + gboolean _tmp2_; + _tmp2_ = TRUE; while (TRUE) { - guint _tmp2_; - Page* _tmp3_ = NULL; + gboolean _tmp3_; + gint _tmp5_; + Book* _tmp6_; + guint _tmp7_ = 0U; + Book* _tmp8_; + gint _tmp9_; + Page* _tmp10_ = NULL; Page* page; - if (!_tmp1_) { - i++; + Book* _tmp11_; + Page* _tmp12_; + _tmp3_ = _tmp2_; + if (!_tmp3_) { + gint _tmp4_; + _tmp4_ = i; + i = _tmp4_ + 1; } - _tmp1_ = FALSE; - _tmp2_ = book_get_n_pages (book); - if (!(((guint) i) < _tmp2_)) { + _tmp2_ = FALSE; + _tmp5_ = i; + _tmp6_ = book; + _tmp7_ = book_get_n_pages (_tmp6_); + if (!(((guint) _tmp5_) < _tmp7_)) { break; } - _tmp3_ = book_get_page (book, i); - page = _tmp3_; - book_view_add_cb (self, book, page); + _tmp8_ = book; + _tmp9_ = i; + _tmp10_ = book_get_page (_tmp8_, _tmp9_); + page = _tmp10_; + _tmp11_ = book; + _tmp12_ = page; + book_view_add_cb (self, _tmp11_, _tmp12_); _page_unref0 (page); } } } - _tmp4_ = book_get_page (book, 0); - _tmp5_ = _tmp4_; - book_view_select_page (self, _tmp5_); - _page_unref0 (_tmp5_); - g_signal_connect_object (book, "page-added", (GCallback) _book_view_add_cb_book_page_added, self, 0); - g_signal_connect_object (book, "page-removed", (GCallback) _book_view_remove_cb_book_page_removed, self, 0); - g_signal_connect_object (book, "reordered", (GCallback) _book_view_reorder_cb_book_reordered, self, 0); - g_signal_connect_object (book, "cleared", (GCallback) _book_view_clear_cb_book_cleared, self, 0); + _tmp13_ = book; + _tmp14_ = book_get_page (_tmp13_, 0); + _tmp15_ = _tmp14_; + book_view_select_page (self, _tmp15_); + _page_unref0 (_tmp15_); + _tmp16_ = book; + g_signal_connect_object (_tmp16_, "page-added", (GCallback) _book_view_add_cb_book_page_added, self, 0); + _tmp17_ = book; + g_signal_connect_object (_tmp17_, "page-removed", (GCallback) _book_view_remove_cb_book_page_removed, self, 0); + _tmp18_ = book; + g_signal_connect_object (_tmp18_, "reordered", (GCallback) _book_view_reorder_cb_book_reordered, self, 0); + _tmp19_ = book; + g_signal_connect_object (_tmp19_, "cleared", (GCallback) _book_view_clear_cb_book_cleared, self, 0); self->priv->need_layout = TRUE; - _tmp6_ = g_hash_table_new_full (g_direct_hash, g_direct_equal, _page_unref0_, _page_view_unref0_); + _tmp20_ = g_direct_hash; + _tmp21_ = g_direct_equal; + _tmp22_ = g_hash_table_new_full (_tmp20_, _tmp21_, _page_unref0_, _page_view_unref0_); _g_hash_table_unref0 (self->priv->page_data); - self->priv->page_data = _tmp6_; + self->priv->page_data = _tmp22_; self->priv->cursor = GDK_ARROW; - _tmp7_ = (GtkDrawingArea*) gtk_drawing_area_new (); + _tmp23_ = (GtkDrawingArea*) gtk_drawing_area_new (); + _tmp24_ = (GtkWidget*) g_object_ref_sink (_tmp23_); _g_object_unref0 (self->priv->drawing_area); - self->priv->drawing_area = (GtkWidget*) g_object_ref_sink (_tmp7_); - gtk_widget_set_size_request (self->priv->drawing_area, 200, 100); - gtk_widget_set_can_focus (self->priv->drawing_area, TRUE); - gtk_widget_set_events (self->priv->drawing_area, (gint) (((((GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK) | GDK_BUTTON_RELEASE_MASK) | GDK_FOCUS_CHANGE_MASK) | GDK_STRUCTURE_MASK) | GDK_SCROLL_MASK)); - gtk_box_pack_start ((GtkBox*) self, self->priv->drawing_area, TRUE, TRUE, (guint) 0); - _tmp8_ = (GtkHScrollbar*) gtk_hscrollbar_new (NULL); + self->priv->drawing_area = _tmp24_; + _tmp25_ = self->priv->drawing_area; + gtk_widget_set_size_request (_tmp25_, 200, 100); + _tmp26_ = self->priv->drawing_area; + gtk_widget_set_can_focus (_tmp26_, TRUE); + _tmp27_ = self->priv->drawing_area; + gtk_widget_set_events (_tmp27_, (gint) (((((GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK) | GDK_BUTTON_RELEASE_MASK) | GDK_FOCUS_CHANGE_MASK) | GDK_STRUCTURE_MASK) | GDK_SCROLL_MASK)); + _tmp28_ = self->priv->drawing_area; + gtk_box_pack_start ((GtkBox*) self, _tmp28_, TRUE, TRUE, (guint) 0); + _tmp29_ = (GtkHScrollbar*) gtk_hscrollbar_new (NULL); + _tmp30_ = g_object_ref_sink (_tmp29_); _g_object_unref0 (self->priv->scroll); - self->priv->scroll = g_object_ref_sink (_tmp8_); - _tmp9_ = gtk_range_get_adjustment ((GtkRange*) self->priv->scroll); - _tmp10_ = _g_object_ref0 (_tmp9_); + self->priv->scroll = _tmp30_; + _tmp31_ = self->priv->scroll; + _tmp32_ = gtk_range_get_adjustment ((GtkRange*) _tmp31_); + _tmp33_ = _g_object_ref0 (_tmp32_); _g_object_unref0 (self->priv->adjustment); - self->priv->adjustment = _tmp10_; - gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) self->priv->scroll, FALSE, TRUE, (guint) 0); - g_signal_connect_object (self->priv->drawing_area, "configure-event", (GCallback) _book_view_configure_cb_gtk_widget_configure_event, self, 0); - g_signal_connect_object (self->priv->drawing_area, "draw", (GCallback) _book_view_draw_cb_gtk_widget_draw, self, 0); - g_signal_connect_object (self->priv->drawing_area, "motion-notify-event", (GCallback) _book_view_motion_cb_gtk_widget_motion_notify_event, self, 0); - g_signal_connect_object (self->priv->drawing_area, "key-press-event", (GCallback) _book_view_key_cb_gtk_widget_key_press_event, self, 0); - g_signal_connect_object (self->priv->drawing_area, "button-press-event", (GCallback) _book_view_button_cb_gtk_widget_button_press_event, self, 0); - g_signal_connect_object (self->priv->drawing_area, "button-release-event", (GCallback) _book_view_button_cb_gtk_widget_button_release_event, self, 0); - g_signal_connect_object (self->priv->drawing_area, "focus-in-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_in_event, self, G_CONNECT_AFTER); - g_signal_connect_object (self->priv->drawing_area, "focus-out-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_out_event, self, G_CONNECT_AFTER); - g_signal_connect_object (self->priv->adjustment, "value-changed", (GCallback) _book_view_scroll_cb_gtk_adjustment_value_changed, self, 0); - gtk_widget_show (self->priv->drawing_area); + self->priv->adjustment = _tmp33_; + _tmp34_ = self->priv->scroll; + gtk_box_pack_start ((GtkBox*) self, (GtkWidget*) _tmp34_, FALSE, TRUE, (guint) 0); + _tmp35_ = self->priv->drawing_area; + g_signal_connect_object (_tmp35_, "configure-event", (GCallback) _book_view_configure_cb_gtk_widget_configure_event, self, 0); + _tmp36_ = self->priv->drawing_area; + g_signal_connect_object (_tmp36_, "draw", (GCallback) _book_view_draw_cb_gtk_widget_draw, self, 0); + _tmp37_ = self->priv->drawing_area; + g_signal_connect_object (_tmp37_, "motion-notify-event", (GCallback) _book_view_motion_cb_gtk_widget_motion_notify_event, self, 0); + _tmp38_ = self->priv->drawing_area; + g_signal_connect_object (_tmp38_, "key-press-event", (GCallback) _book_view_key_cb_gtk_widget_key_press_event, self, 0); + _tmp39_ = self->priv->drawing_area; + g_signal_connect_object (_tmp39_, "button-press-event", (GCallback) _book_view_button_cb_gtk_widget_button_press_event, self, 0); + _tmp40_ = self->priv->drawing_area; + g_signal_connect_object (_tmp40_, "button-release-event", (GCallback) _book_view_button_cb_gtk_widget_button_release_event, self, 0); + _tmp41_ = self->priv->drawing_area; + g_signal_connect_object (_tmp41_, "focus-in-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_in_event, self, G_CONNECT_AFTER); + _tmp42_ = self->priv->drawing_area; + g_signal_connect_object (_tmp42_, "focus-out-event", (GCallback) _book_view_focus_cb_gtk_widget_focus_out_event, self, G_CONNECT_AFTER); + _tmp43_ = self->priv->adjustment; + g_signal_connect_object (_tmp43_, "value-changed", (GCallback) _book_view_scroll_cb_gtk_adjustment_value_changed, self, 0); + _tmp44_ = self->priv->drawing_area; + gtk_widget_show (_tmp44_); return self; } @@ -392,16 +460,22 @@ static gpointer _page_view_ref0 (gpointer self) { static PageView* book_view_get_nth_page (BookView* self, gint n) { PageView* result = NULL; - Page* _tmp0_ = NULL; + Book* _tmp0_; + gint _tmp1_; + Page* _tmp2_ = NULL; Page* page; - gconstpointer _tmp1_ = NULL; - PageView* _tmp2_; + GHashTable* _tmp3_; + gconstpointer _tmp4_ = NULL; + PageView* _tmp5_; g_return_val_if_fail (self != NULL, NULL); - _tmp0_ = book_get_page (self->priv->book, n); - page = _tmp0_; - _tmp1_ = g_hash_table_lookup (self->priv->page_data, page); - _tmp2_ = _page_view_ref0 ((PageView*) _tmp1_); - result = _tmp2_; + _tmp0_ = self->priv->book; + _tmp1_ = n; + _tmp2_ = book_get_page (_tmp0_, _tmp1_); + page = _tmp2_; + _tmp3_ = self->priv->page_data; + _tmp4_ = g_hash_table_lookup (_tmp3_, page); + _tmp5_ = _page_view_ref0 ((PageView*) _tmp4_); + result = _tmp5_; _page_unref0 (page); return result; } @@ -409,7 +483,8 @@ static PageView* book_view_get_nth_page (BookView* self, gint n) { static PageView* book_view_get_next_page (BookView* self, PageView* page) { PageView* result = NULL; - PageView* _tmp8_; + PageView* _tmp20_; + PageView* _tmp21_; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (page != NULL, NULL); { @@ -419,36 +494,60 @@ static PageView* book_view_get_next_page (BookView* self, PageView* page) { gboolean _tmp0_; _tmp0_ = TRUE; while (TRUE) { - Page* _tmp1_ = NULL; + gboolean _tmp1_; + Book* _tmp3_; + gint _tmp4_; + Page* _tmp5_ = NULL; Page* p; - Page* _tmp2_ = NULL; - Page* _tmp3_; - gboolean _tmp4_; - if (!_tmp0_) { - i++; + Page* _tmp6_; + Page* _tmp7_; + PageView* _tmp8_; + Page* _tmp9_ = NULL; + Page* _tmp10_; + gboolean _tmp11_; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; } _tmp0_ = FALSE; - _tmp1_ = book_get_page (self->priv->book, i); - p = _tmp1_; - if (p == NULL) { + _tmp3_ = self->priv->book; + _tmp4_ = i; + _tmp5_ = book_get_page (_tmp3_, _tmp4_); + p = _tmp5_; + _tmp6_ = p; + if (_tmp6_ == NULL) { _page_unref0 (p); break; } - _tmp2_ = page_view_get_page (page); - _tmp3_ = _tmp2_; - _tmp4_ = p == _tmp3_; - _page_unref0 (_tmp3_); - if (_tmp4_) { - Page* _tmp5_ = NULL; - _tmp5_ = book_get_page (self->priv->book, i + 1); + _tmp7_ = p; + _tmp8_ = page; + _tmp9_ = page_view_get_page (_tmp8_); + _tmp10_ = _tmp9_; + _tmp11_ = _tmp7_ == _tmp10_; + _page_unref0 (_tmp10_); + if (_tmp11_) { + Book* _tmp12_; + gint _tmp13_; + Page* _tmp14_ = NULL; + Page* _tmp15_; + _tmp12_ = self->priv->book; + _tmp13_ = i; + _tmp14_ = book_get_page (_tmp12_, _tmp13_ + 1); _page_unref0 (p); - p = _tmp5_; - if (p != NULL) { - gconstpointer _tmp6_ = NULL; - PageView* _tmp7_; - _tmp6_ = g_hash_table_lookup (self->priv->page_data, p); - _tmp7_ = _page_view_ref0 ((PageView*) _tmp6_); - result = _tmp7_; + p = _tmp14_; + _tmp15_ = p; + if (_tmp15_ != NULL) { + GHashTable* _tmp16_; + Page* _tmp17_; + gconstpointer _tmp18_ = NULL; + PageView* _tmp19_; + _tmp16_ = self->priv->page_data; + _tmp17_ = p; + _tmp18_ = g_hash_table_lookup (_tmp16_, _tmp17_); + _tmp19_ = _page_view_ref0 ((PageView*) _tmp18_); + result = _tmp19_; _page_unref0 (p); return result; } @@ -457,8 +556,9 @@ static PageView* book_view_get_next_page (BookView* self, PageView* page) { } } } - _tmp8_ = _page_view_ref0 (page); - result = _tmp8_; + _tmp20_ = page; + _tmp21_ = _page_view_ref0 (_tmp20_); + result = _tmp21_; return result; } @@ -466,55 +566,77 @@ static PageView* book_view_get_next_page (BookView* self, PageView* page) { static PageView* book_view_get_prev_page (BookView* self, PageView* page) { PageView* result = NULL; PageView* _tmp0_; + PageView* _tmp1_; PageView* prev_page; - PageView* _tmp8_; + PageView* _tmp18_; + PageView* _tmp19_; g_return_val_if_fail (self != NULL, NULL); g_return_val_if_fail (page != NULL, NULL); - _tmp0_ = _page_view_ref0 (page); - prev_page = _tmp0_; + _tmp0_ = page; + _tmp1_ = _page_view_ref0 (_tmp0_); + prev_page = _tmp1_; { gint i; i = 0; { - gboolean _tmp1_; - _tmp1_ = TRUE; + gboolean _tmp2_; + _tmp2_ = TRUE; while (TRUE) { - Page* _tmp2_ = NULL; + gboolean _tmp3_; + Book* _tmp5_; + gint _tmp6_; + Page* _tmp7_ = NULL; Page* p; - Page* _tmp3_ = NULL; - Page* _tmp4_; - gboolean _tmp5_; - gconstpointer _tmp6_ = NULL; - PageView* _tmp7_; - if (!_tmp1_) { - i++; + Page* _tmp8_; + Page* _tmp9_; + PageView* _tmp10_; + Page* _tmp11_ = NULL; + Page* _tmp12_; + gboolean _tmp13_; + GHashTable* _tmp14_; + Page* _tmp15_; + gconstpointer _tmp16_ = NULL; + PageView* _tmp17_; + _tmp3_ = _tmp2_; + if (!_tmp3_) { + gint _tmp4_; + _tmp4_ = i; + i = _tmp4_ + 1; } - _tmp1_ = FALSE; - _tmp2_ = book_get_page (self->priv->book, i); - p = _tmp2_; - if (p == NULL) { + _tmp2_ = FALSE; + _tmp5_ = self->priv->book; + _tmp6_ = i; + _tmp7_ = book_get_page (_tmp5_, _tmp6_); + p = _tmp7_; + _tmp8_ = p; + if (_tmp8_ == NULL) { _page_unref0 (p); break; } - _tmp3_ = page_view_get_page (page); - _tmp4_ = _tmp3_; - _tmp5_ = p == _tmp4_; - _page_unref0 (_tmp4_); - if (_tmp5_) { + _tmp9_ = p; + _tmp10_ = page; + _tmp11_ = page_view_get_page (_tmp10_); + _tmp12_ = _tmp11_; + _tmp13_ = _tmp9_ == _tmp12_; + _page_unref0 (_tmp12_); + if (_tmp13_) { result = prev_page; _page_unref0 (p); return result; } - _tmp6_ = g_hash_table_lookup (self->priv->page_data, p); - _tmp7_ = _page_view_ref0 ((PageView*) _tmp6_); + _tmp14_ = self->priv->page_data; + _tmp15_ = p; + _tmp16_ = g_hash_table_lookup (_tmp14_, _tmp15_); + _tmp17_ = _page_view_ref0 ((PageView*) _tmp16_); _page_view_unref0 (prev_page); - prev_page = _tmp7_; + prev_page = _tmp17_; _page_unref0 (p); } } } - _tmp8_ = _page_view_ref0 (page); - result = _tmp8_; + _tmp18_ = page; + _tmp19_ = _page_view_ref0 (_tmp18_); + result = _tmp19_; _page_view_unref0 (prev_page); return result; } @@ -551,20 +673,26 @@ static gpointer _page_ref0 (gpointer self) { static void book_view_add_cb (BookView* self, Book* book, Page* page) { - PageView* _tmp0_ = NULL; + Page* _tmp0_; + PageView* _tmp1_; PageView* page_view; - Page* _tmp1_; - PageView* _tmp2_; + GHashTable* _tmp2_; + Page* _tmp3_; + Page* _tmp4_; + PageView* _tmp5_; g_return_if_fail (self != NULL); g_return_if_fail (book != NULL); g_return_if_fail (page != NULL); - _tmp0_ = page_view_new (page); - page_view = _tmp0_; + _tmp0_ = page; + _tmp1_ = page_view_new (_tmp0_); + page_view = _tmp1_; g_signal_connect_object (page_view, "changed", (GCallback) _book_view_page_view_changed_cb_page_view_changed, self, 0); g_signal_connect_object (page_view, "size-changed", (GCallback) _book_view_page_view_size_changed_cb_page_view_size_changed, self, 0); - _tmp1_ = _page_ref0 (page); - _tmp2_ = _page_view_ref0 (page_view); - g_hash_table_insert (self->priv->page_data, _tmp1_, _tmp2_); + _tmp2_ = self->priv->page_data; + _tmp3_ = page; + _tmp4_ = _page_ref0 (_tmp3_); + _tmp5_ = _page_view_ref0 (page_view); + g_hash_table_insert (_tmp2_, _tmp4_, _tmp5_); self->priv->need_layout = TRUE; book_view_redraw (self); _page_view_unref0 (page_view); @@ -574,83 +702,141 @@ static void book_view_add_cb (BookView* self, Book* book, Page* page) { static void book_view_set_selected_page (BookView* self, PageView* page) { gboolean _tmp0_ = FALSE; PageView* _tmp1_; - gboolean _tmp2_; + gboolean _tmp4_; + PageView* _tmp6_; + PageView* _tmp7_; + PageView* _tmp8_; + GtkWidget* _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp11_; g_return_if_fail (self != NULL); - if (self->priv->selected_page != NULL) { - _tmp0_ = page != self->priv->selected_page; + _tmp1_ = self->priv->selected_page; + if (_tmp1_ != NULL) { + PageView* _tmp2_; + PageView* _tmp3_; + _tmp2_ = page; + _tmp3_ = self->priv->selected_page; + _tmp0_ = _tmp2_ != _tmp3_; } else { _tmp0_ = FALSE; } - if (_tmp0_) { - page_view_set_selected (self->priv->selected_page, FALSE); + _tmp4_ = _tmp0_; + if (_tmp4_) { + PageView* _tmp5_; + _tmp5_ = self->priv->selected_page; + page_view_set_selected (_tmp5_, FALSE); } - _tmp1_ = _page_view_ref0 (page); + _tmp6_ = page; + _tmp7_ = _page_view_ref0 (_tmp6_); _page_view_unref0 (self->priv->selected_page); - self->priv->selected_page = _tmp1_; - if (self->priv->selected_page == NULL) { + self->priv->selected_page = _tmp7_; + _tmp8_ = self->priv->selected_page; + if (_tmp8_ == NULL) { return; } - g_object_get (self->priv->drawing_area, "has-focus", &_tmp2_, NULL); - if (!_tmp2_) { - page_view_set_selected (self->priv->selected_page, FALSE); + _tmp9_ = self->priv->drawing_area; + g_object_get (_tmp9_, "has-focus", &_tmp10_, NULL); + _tmp11_ = _tmp10_; + if (!_tmp11_) { + PageView* _tmp12_; + _tmp12_ = self->priv->selected_page; + page_view_set_selected (_tmp12_, FALSE); } else { - page_view_set_selected (self->priv->selected_page, TRUE); + PageView* _tmp13_; + _tmp13_ = self->priv->selected_page; + page_view_set_selected (_tmp13_, TRUE); } } static void book_view_set_x_offset (BookView* self, gint offset) { + GtkAdjustment* _tmp0_; + gint _tmp1_; g_return_if_fail (self != NULL); - gtk_adjustment_set_value (self->priv->adjustment, (gdouble) offset); + _tmp0_ = self->priv->adjustment; + _tmp1_ = offset; + gtk_adjustment_set_value (_tmp0_, (gdouble) _tmp1_); } static gint book_view_get_x_offset (BookView* self) { gint result = 0; - gdouble _tmp0_; + GtkAdjustment* _tmp0_; + gdouble _tmp1_ = 0.0; g_return_val_if_fail (self != NULL, 0); - _tmp0_ = gtk_adjustment_get_value (self->priv->adjustment); - result = (gint) _tmp0_; + _tmp0_ = self->priv->adjustment; + _tmp1_ = gtk_adjustment_get_value (_tmp0_); + result = (gint) _tmp1_; return result; } static void book_view_show_page_view (BookView* self, PageView* page) { gboolean _tmp0_ = FALSE; + PageView* _tmp1_; + gboolean _tmp4_; GtkAllocation allocation = {0}; - GtkAllocation _tmp2_ = {0}; - gint _tmp3_; + GtkWidget* _tmp5_; + GtkAllocation _tmp6_ = {0}; + PageView* _tmp7_; + gint _tmp8_ = 0; gint left_edge; - gint _tmp4_; - gint _tmp5_; + PageView* _tmp9_; + gint _tmp10_ = 0; + PageView* _tmp11_; + gint _tmp12_ = 0; gint right_edge; - gint _tmp6_; + gint _tmp13_; + gint _tmp14_ = 0; g_return_if_fail (self != NULL); - if (page == NULL) { + _tmp1_ = page; + if (_tmp1_ == NULL) { _tmp0_ = TRUE; } else { - gboolean _tmp1_; - _tmp1_ = gtk_widget_get_visible ((GtkWidget*) self->priv->scroll); - _tmp0_ = !_tmp1_; + GtkHScrollbar* _tmp2_; + gboolean _tmp3_ = FALSE; + _tmp2_ = self->priv->scroll; + _tmp3_ = gtk_widget_get_visible ((GtkWidget*) _tmp2_); + _tmp0_ = !_tmp3_; } - if (_tmp0_) { + _tmp4_ = _tmp0_; + if (_tmp4_) { return; } - gtk_widget_get_allocation (self->priv->drawing_area, &_tmp2_); - allocation = _tmp2_; - _tmp3_ = page_view_get_x_offset (page); - left_edge = _tmp3_; - _tmp4_ = page_view_get_x_offset (page); - _tmp5_ = page_view_get_width (page); - right_edge = _tmp4_ + _tmp5_; - _tmp6_ = book_view_get_x_offset (self); - if ((left_edge - _tmp6_) < 0) { - book_view_set_x_offset (self, left_edge); + _tmp5_ = self->priv->drawing_area; + gtk_widget_get_allocation (_tmp5_, &_tmp6_); + allocation = _tmp6_; + _tmp7_ = page; + _tmp8_ = page_view_get_x_offset (_tmp7_); + left_edge = _tmp8_; + _tmp9_ = page; + _tmp10_ = page_view_get_x_offset (_tmp9_); + _tmp11_ = page; + _tmp12_ = page_view_get_width (_tmp11_); + right_edge = _tmp10_ + _tmp12_; + _tmp13_ = left_edge; + _tmp14_ = book_view_get_x_offset (self); + if ((_tmp13_ - _tmp14_) < 0) { + gint _tmp15_; + _tmp15_ = left_edge; + book_view_set_x_offset (self, _tmp15_); } else { - gint _tmp7_; - _tmp7_ = book_view_get_x_offset (self); - if ((right_edge - _tmp7_) > allocation.width) { - book_view_set_x_offset (self, right_edge - allocation.width); + gint _tmp16_; + gint _tmp17_ = 0; + GtkAllocation _tmp18_; + gint _tmp19_; + _tmp16_ = right_edge; + _tmp17_ = book_view_get_x_offset (self); + _tmp18_ = allocation; + _tmp19_ = _tmp18_.width; + if ((_tmp16_ - _tmp17_) > _tmp19_) { + gint _tmp20_; + GtkAllocation _tmp21_; + gint _tmp22_; + _tmp20_ = right_edge; + _tmp21_ = allocation; + _tmp22_ = _tmp21_.width; + book_view_set_x_offset (self, _tmp20_ - _tmp22_); } } } @@ -658,60 +844,94 @@ static void book_view_show_page_view (BookView* self, PageView* page) { static void book_view_select_page_view (BookView* self, PageView* page) { Page* p; + PageView* _tmp0_; + PageView* _tmp1_; + PageView* _tmp2_; + gboolean _tmp3_; + PageView* _tmp5_; + Page* _tmp8_; g_return_if_fail (self != NULL); p = NULL; - if (self->priv->selected_page == page) { + _tmp0_ = self->priv->selected_page; + _tmp1_ = page; + if (_tmp0_ == _tmp1_) { _page_unref0 (p); return; } - book_view_set_selected_page (self, page); - if (self->priv->need_layout) { + _tmp2_ = page; + book_view_set_selected_page (self, _tmp2_); + _tmp3_ = self->priv->need_layout; + if (_tmp3_) { self->priv->show_selected_page = TRUE; } else { - book_view_show_page_view (self, page); + PageView* _tmp4_; + _tmp4_ = page; + book_view_show_page_view (self, _tmp4_); } - if (page != NULL) { - Page* _tmp0_ = NULL; - _tmp0_ = page_view_get_page (page); + _tmp5_ = page; + if (_tmp5_ != NULL) { + PageView* _tmp6_; + Page* _tmp7_ = NULL; + _tmp6_ = page; + _tmp7_ = page_view_get_page (_tmp6_); _page_unref0 (p); - p = _tmp0_; + p = _tmp7_; } - g_signal_emit_by_name (self, "page-selected", p); + _tmp8_ = p; + g_signal_emit_by_name (self, "page-selected", _tmp8_); _page_unref0 (p); } static void book_view_remove_cb (BookView* self, Book* book, Page* page) { PageView* _tmp0_; + PageView* _tmp1_; PageView* new_selection; - Page* _tmp1_ = NULL; Page* _tmp2_; - gboolean _tmp3_; + Page* _tmp3_ = NULL; + Page* _tmp4_; + gboolean _tmp5_; + GHashTable* _tmp12_; + Page* _tmp13_; + PageView* _tmp14_; g_return_if_fail (self != NULL); g_return_if_fail (book != NULL); g_return_if_fail (page != NULL); - _tmp0_ = _page_view_ref0 (self->priv->selected_page); - new_selection = _tmp0_; - _tmp1_ = book_view_get_selected (self); - _tmp2_ = _tmp1_; - _tmp3_ = page == _tmp2_; - _page_unref0 (_tmp2_); - if (_tmp3_) { - PageView* _tmp4_ = NULL; - _tmp4_ = book_view_get_prev_page (self, self->priv->selected_page); + _tmp0_ = self->priv->selected_page; + _tmp1_ = _page_view_ref0 (_tmp0_); + new_selection = _tmp1_; + _tmp2_ = page; + _tmp3_ = book_view_get_selected (self); + _tmp4_ = _tmp3_; + _tmp5_ = _tmp2_ == _tmp4_; + _page_unref0 (_tmp4_); + if (_tmp5_) { + PageView* _tmp6_; + PageView* _tmp7_ = NULL; + PageView* _tmp8_; + PageView* _tmp9_; + _tmp6_ = self->priv->selected_page; + _tmp7_ = book_view_get_prev_page (self, _tmp6_); _page_view_unref0 (new_selection); - new_selection = _tmp4_; - if (new_selection == self->priv->selected_page) { - PageView* _tmp5_ = NULL; - _tmp5_ = book_view_get_next_page (self, self->priv->selected_page); + new_selection = _tmp7_; + _tmp8_ = new_selection; + _tmp9_ = self->priv->selected_page; + if (_tmp8_ == _tmp9_) { + PageView* _tmp10_; + PageView* _tmp11_ = NULL; + _tmp10_ = self->priv->selected_page; + _tmp11_ = book_view_get_next_page (self, _tmp10_); _page_view_unref0 (new_selection); - new_selection = _tmp5_; + new_selection = _tmp11_; } _page_view_unref0 (self->priv->selected_page); self->priv->selected_page = NULL; } - g_hash_table_remove (self->priv->page_data, page); - book_view_select_page_view (self, new_selection); + _tmp12_ = self->priv->page_data; + _tmp13_ = page; + g_hash_table_remove (_tmp12_, _tmp13_); + _tmp14_ = new_selection; + book_view_select_page_view (self, _tmp14_); self->priv->need_layout = TRUE; book_view_redraw (self); _page_view_unref0 (new_selection); @@ -727,9 +947,11 @@ static void book_view_reorder_cb (BookView* self, Book* book) { static void book_view_clear_cb (BookView* self, Book* book) { + GHashTable* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (book != NULL); - g_hash_table_remove_all (self->priv->page_data); + _tmp0_ = self->priv->page_data; + g_hash_table_remove_all (_tmp0_); _page_view_unref0 (self->priv->selected_page); self->priv->selected_page = NULL; g_signal_emit_by_name (self, "page-selected", NULL); @@ -741,9 +963,11 @@ static void book_view_clear_cb (BookView* self, Book* book) { Book* book_view_get_book (BookView* self) { Book* result = NULL; Book* _tmp0_; + Book* _tmp1_; g_return_val_if_fail (self != NULL, NULL); - _tmp0_ = _book_ref0 (self->priv->book); - result = _tmp0_; + _tmp0_ = self->priv->book; + _tmp1_ = _book_ref0 (_tmp0_); + result = _tmp1_; return result; } @@ -752,6 +976,7 @@ static gboolean book_view_configure_cb (BookView* self, GtkWidget* widget, GdkEv gboolean result = FALSE; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (event != NULL, FALSE); self->priv->need_layout = TRUE; result = FALSE; return result; @@ -759,12 +984,16 @@ static gboolean book_view_configure_cb (BookView* self, GtkWidget* widget, GdkEv static void book_view_layout_into (BookView* self, gint width, gint height, gint* book_width, gint* book_height) { - gint _book_width = 0; - gint _book_height = 0; + gint _vala_book_width = 0; + gint _vala_book_height = 0; gint max_dpi; gint max_width; gint max_height; + gint _tmp41_; + gint _tmp42_; gdouble aspect; + gint _tmp43_; + gint _tmp44_; gdouble max_aspect; gint spacing; gint x_offset; @@ -777,25 +1006,43 @@ static void book_view_layout_into (BookView* self, gint width, gint height, gint gboolean _tmp0_; _tmp0_ = TRUE; while (TRUE) { - guint _tmp1_; - Page* _tmp2_ = NULL; - Page* page; + gboolean _tmp1_; gint _tmp3_; - if (!_tmp0_) { - i++; + Book* _tmp4_; + guint _tmp5_ = 0U; + Book* _tmp6_; + gint _tmp7_; + Page* _tmp8_ = NULL; + Page* page; + Page* _tmp9_; + gint _tmp10_ = 0; + gint _tmp11_; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; } _tmp0_ = FALSE; - _tmp1_ = book_get_n_pages (self->priv->book); - if (!(((guint) i) < _tmp1_)) { + _tmp3_ = i; + _tmp4_ = self->priv->book; + _tmp5_ = book_get_n_pages (_tmp4_); + if (!(((guint) _tmp3_) < _tmp5_)) { break; } - _tmp2_ = book_get_page (self->priv->book, i); - page = _tmp2_; - _tmp3_ = page_get_dpi (page); - if (_tmp3_ > max_dpi) { - gint _tmp4_; - _tmp4_ = page_get_dpi (page); - max_dpi = _tmp4_; + _tmp6_ = self->priv->book; + _tmp7_ = i; + _tmp8_ = book_get_page (_tmp6_, _tmp7_); + page = _tmp8_; + _tmp9_ = page; + _tmp10_ = page_get_dpi (_tmp9_); + _tmp11_ = max_dpi; + if (_tmp10_ > _tmp11_) { + Page* _tmp12_; + gint _tmp13_ = 0; + _tmp12_ = page; + _tmp13_ = page_get_dpi (_tmp12_); + max_dpi = _tmp13_; } _page_unref0 (page); } @@ -807,104 +1054,210 @@ static void book_view_layout_into (BookView* self, gint width, gint height, gint gint i; i = 0; { - gboolean _tmp5_; - _tmp5_ = TRUE; + gboolean _tmp14_; + _tmp14_ = TRUE; while (TRUE) { - guint _tmp6_; - Page* _tmp7_ = NULL; + gboolean _tmp15_; + gint _tmp17_; + Book* _tmp18_; + guint _tmp19_ = 0U; + Book* _tmp20_; + gint _tmp21_; + Page* _tmp22_ = NULL; Page* page; - gint _tmp8_; + Page* _tmp23_; + gint _tmp24_ = 0; gint w; - gint _tmp9_; + Page* _tmp25_; + gint _tmp26_ = 0; gint h; - gint _tmp10_; - gint _tmp11_; - if (!_tmp5_) { - i++; + gint _tmp27_; + gint _tmp28_; + Page* _tmp29_; + gint _tmp30_ = 0; + gint _tmp31_; + gint _tmp32_; + Page* _tmp33_; + gint _tmp34_ = 0; + gint _tmp35_; + gint _tmp36_; + gint _tmp38_; + gint _tmp39_; + _tmp15_ = _tmp14_; + if (!_tmp15_) { + gint _tmp16_; + _tmp16_ = i; + i = _tmp16_ + 1; } - _tmp5_ = FALSE; - _tmp6_ = book_get_n_pages (self->priv->book); - if (!(((guint) i) < _tmp6_)) { + _tmp14_ = FALSE; + _tmp17_ = i; + _tmp18_ = self->priv->book; + _tmp19_ = book_get_n_pages (_tmp18_); + if (!(((guint) _tmp17_) < _tmp19_)) { break; } - _tmp7_ = book_get_page (self->priv->book, i); - page = _tmp7_; - _tmp8_ = page_get_width (page); - w = _tmp8_; - _tmp9_ = page_get_height (page); - h = _tmp9_; - _tmp10_ = page_get_dpi (page); - w = (gint) (((((gdouble) w) * max_dpi) / _tmp10_) + 0.5); - _tmp11_ = page_get_dpi (page); - h = (gint) (((((gdouble) h) * max_dpi) / _tmp11_) + 0.5); - if (w > max_width) { - max_width = w; + _tmp20_ = self->priv->book; + _tmp21_ = i; + _tmp22_ = book_get_page (_tmp20_, _tmp21_); + page = _tmp22_; + _tmp23_ = page; + _tmp24_ = page_get_width (_tmp23_); + w = _tmp24_; + _tmp25_ = page; + _tmp26_ = page_get_height (_tmp25_); + h = _tmp26_; + _tmp27_ = w; + _tmp28_ = max_dpi; + _tmp29_ = page; + _tmp30_ = page_get_dpi (_tmp29_); + w = (gint) (((((gdouble) _tmp27_) * _tmp28_) / _tmp30_) + 0.5); + _tmp31_ = h; + _tmp32_ = max_dpi; + _tmp33_ = page; + _tmp34_ = page_get_dpi (_tmp33_); + h = (gint) (((((gdouble) _tmp31_) * _tmp32_) / _tmp34_) + 0.5); + _tmp35_ = w; + _tmp36_ = max_width; + if (_tmp35_ > _tmp36_) { + gint _tmp37_; + _tmp37_ = w; + max_width = _tmp37_; } - if (h > max_height) { - max_height = h; + _tmp38_ = h; + _tmp39_ = max_height; + if (_tmp38_ > _tmp39_) { + gint _tmp40_; + _tmp40_ = h; + max_height = _tmp40_; } _page_unref0 (page); } } } - aspect = ((gdouble) width) / height; - max_aspect = ((gdouble) max_width) / max_height; + _tmp41_ = width; + _tmp42_ = height; + aspect = ((gdouble) _tmp41_) / _tmp42_; + _tmp43_ = max_width; + _tmp44_ = max_height; + max_aspect = ((gdouble) _tmp43_) / _tmp44_; spacing = 12; - _book_width = 0; - _book_height = 0; + _vala_book_width = 0; + _vala_book_height = 0; { gint i; i = 0; { - gboolean _tmp12_; - _tmp12_ = TRUE; + gboolean _tmp45_; + _tmp45_ = TRUE; while (TRUE) { - guint _tmp13_; - PageView* _tmp14_ = NULL; + gboolean _tmp46_; + gint _tmp48_; + Book* _tmp49_; + guint _tmp50_ = 0U; + gint _tmp51_; + PageView* _tmp52_ = NULL; PageView* page; - Page* _tmp15_ = NULL; + PageView* _tmp53_; + Page* _tmp54_ = NULL; Page* p; - gint _tmp20_; + gdouble _tmp55_; + gdouble _tmp56_; + PageView* _tmp75_; + gint _tmp76_ = 0; gint h; - gint _tmp21_; - if (!_tmp12_) { - i++; + gint _tmp77_; + gint _tmp78_; + gint _tmp80_; + PageView* _tmp81_; + gint _tmp82_ = 0; + gint _tmp83_; + _tmp46_ = _tmp45_; + if (!_tmp46_) { + gint _tmp47_; + _tmp47_ = i; + i = _tmp47_ + 1; } - _tmp12_ = FALSE; - _tmp13_ = book_get_n_pages (self->priv->book); - if (!(((guint) i) < _tmp13_)) { + _tmp45_ = FALSE; + _tmp48_ = i; + _tmp49_ = self->priv->book; + _tmp50_ = book_get_n_pages (_tmp49_); + if (!(((guint) _tmp48_) < _tmp50_)) { break; } - _tmp14_ = book_view_get_nth_page (self, i); - page = _tmp14_; - _tmp15_ = page_view_get_page (page); - p = _tmp15_; - if (max_aspect > aspect) { - gint _tmp16_; - gint _tmp17_; + _tmp51_ = i; + _tmp52_ = book_view_get_nth_page (self, _tmp51_); + page = _tmp52_; + _tmp53_ = page; + _tmp54_ = page_view_get_page (_tmp53_); + p = _tmp54_; + _tmp55_ = max_aspect; + _tmp56_ = aspect; + if (_tmp55_ > _tmp56_) { + Page* _tmp57_; + gint _tmp58_ = 0; + gint _tmp59_; + gint _tmp60_; + Page* _tmp61_; + gint _tmp62_ = 0; + gint _tmp63_; gint w; - _tmp16_ = page_get_width (p); - _tmp17_ = page_get_dpi (p); - w = (gint) (((((gdouble) _tmp16_) * max_dpi) * width) / (_tmp17_ * max_width)); - page_view_set_width (page, w); + PageView* _tmp64_; + gint _tmp65_; + _tmp57_ = p; + _tmp58_ = page_get_width (_tmp57_); + _tmp59_ = max_dpi; + _tmp60_ = width; + _tmp61_ = p; + _tmp62_ = page_get_dpi (_tmp61_); + _tmp63_ = max_width; + w = (gint) (((((gdouble) _tmp58_) * _tmp59_) * _tmp60_) / (_tmp62_ * _tmp63_)); + _tmp64_ = page; + _tmp65_ = w; + page_view_set_width (_tmp64_, _tmp65_); } else { - gint _tmp18_; - gint _tmp19_; + Page* _tmp66_; + gint _tmp67_ = 0; + gint _tmp68_; + gint _tmp69_; + Page* _tmp70_; + gint _tmp71_ = 0; + gint _tmp72_; gint h; - _tmp18_ = page_get_height (p); - _tmp19_ = page_get_dpi (p); - h = (gint) (((((gdouble) _tmp18_) * max_dpi) * height) / (_tmp19_ * max_height)); - page_view_set_height (page, h); + PageView* _tmp73_; + gint _tmp74_; + _tmp66_ = p; + _tmp67_ = page_get_height (_tmp66_); + _tmp68_ = max_dpi; + _tmp69_ = height; + _tmp70_ = p; + _tmp71_ = page_get_dpi (_tmp70_); + _tmp72_ = max_height; + h = (gint) (((((gdouble) _tmp67_) * _tmp68_) * _tmp69_) / (_tmp71_ * _tmp72_)); + _tmp73_ = page; + _tmp74_ = h; + page_view_set_height (_tmp73_, _tmp74_); } - _tmp20_ = page_view_get_height (page); - h = _tmp20_; - if (h > _book_height) { - _book_height = h; + _tmp75_ = page; + _tmp76_ = page_view_get_height (_tmp75_); + h = _tmp76_; + _tmp77_ = h; + _tmp78_ = _vala_book_height; + if (_tmp77_ > _tmp78_) { + gint _tmp79_; + _tmp79_ = h; + _vala_book_height = _tmp79_; } - _tmp21_ = page_view_get_width (page); - _book_width = _book_width + _tmp21_; - if (i != 0) { - _book_width = _book_width + spacing; + _tmp80_ = _vala_book_width; + _tmp81_ = page; + _tmp82_ = page_view_get_width (_tmp81_); + _vala_book_width = _tmp80_ + _tmp82_; + _tmp83_ = i; + if (_tmp83_ != 0) { + gint _tmp84_; + gint _tmp85_; + _tmp84_ = _vala_book_width; + _tmp85_ = spacing; + _vala_book_width = _tmp84_ + _tmp85_; } _page_unref0 (p); _page_view_unref0 (page); @@ -916,115 +1269,229 @@ static void book_view_layout_into (BookView* self, gint width, gint height, gint gint i; i = 0; { - gboolean _tmp22_; - _tmp22_ = TRUE; + gboolean _tmp86_; + _tmp86_ = TRUE; while (TRUE) { - guint _tmp23_; - PageView* _tmp24_ = NULL; + gboolean _tmp87_; + gint _tmp89_; + Book* _tmp90_; + guint _tmp91_ = 0U; + gint _tmp92_; + PageView* _tmp93_ = NULL; PageView* page; - gint _tmp25_; - gint _tmp26_; - if (!_tmp22_) { - i++; + PageView* _tmp94_; + gint _tmp95_; + gint _tmp96_; + PageView* _tmp97_; + gint _tmp98_ = 0; + gint _tmp99_; + PageView* _tmp100_; + gint _tmp101_; + PageView* _tmp102_; + gint _tmp103_ = 0; + _tmp87_ = _tmp86_; + if (!_tmp87_) { + gint _tmp88_; + _tmp88_ = i; + i = _tmp88_ + 1; } - _tmp22_ = FALSE; - _tmp23_ = book_get_n_pages (self->priv->book); - if (!(((guint) i) < _tmp23_)) { + _tmp86_ = FALSE; + _tmp89_ = i; + _tmp90_ = self->priv->book; + _tmp91_ = book_get_n_pages (_tmp90_); + if (!(((guint) _tmp89_) < _tmp91_)) { break; } - _tmp24_ = book_view_get_nth_page (self, i); - page = _tmp24_; - page_view_set_x_offset (page, x_offset); - _tmp25_ = page_view_get_width (page); - x_offset = x_offset + (_tmp25_ + spacing); - _tmp26_ = page_view_get_height (page); - page_view_set_y_offset (page, (height - _tmp26_) / 2); + _tmp92_ = i; + _tmp93_ = book_view_get_nth_page (self, _tmp92_); + page = _tmp93_; + _tmp94_ = page; + _tmp95_ = x_offset; + page_view_set_x_offset (_tmp94_, _tmp95_); + _tmp96_ = x_offset; + _tmp97_ = page; + _tmp98_ = page_view_get_width (_tmp97_); + _tmp99_ = spacing; + x_offset = _tmp96_ + (_tmp98_ + _tmp99_); + _tmp100_ = page; + _tmp101_ = height; + _tmp102_ = page; + _tmp103_ = page_view_get_height (_tmp102_); + page_view_set_y_offset (_tmp100_, (_tmp101_ - _tmp103_) / 2); _page_view_unref0 (page); } } } if (book_width) { - *book_width = _book_width; + *book_width = _vala_book_width; } if (book_height) { - *book_height = _book_height; + *book_height = _vala_book_height; } } static void book_view_layout (BookView* self) { + gboolean _tmp0_; GtkAllocation allocation = {0}; - GtkAllocation _tmp0_ = {0}; + GtkWidget* _tmp1_; + GtkAllocation _tmp2_ = {0}; GtkAllocation box_allocation = {0}; - GtkAllocation _tmp1_ = {0}; + GtkAllocation _tmp3_ = {0}; gboolean right_aligned; - gdouble _tmp2_; - gdouble _tmp3_; - gdouble _tmp4_; + GtkAdjustment* _tmp4_; + gdouble _tmp5_ = 0.0; + GtkAdjustment* _tmp6_; + gdouble _tmp7_ = 0.0; + GtkAdjustment* _tmp8_; + gdouble _tmp9_ = 0.0; + GtkAllocation _tmp10_; + gint _tmp11_; gint width; - guint _tmp5_; + GtkAllocation _tmp12_; + gint _tmp13_; + guint _tmp14_ = 0U; gint height; gint book_width = 0; gint book_height = 0; - gint _tmp6_; - gint _tmp7_; + gint _tmp15_; + gint _tmp16_; + gint _tmp17_ = 0; + gint _tmp18_ = 0; + gint _tmp19_; + GtkAllocation _tmp20_; + gint _tmp21_; + gboolean _tmp54_; g_return_if_fail (self != NULL); - if (!self->priv->need_layout) { + _tmp0_ = self->priv->need_layout; + if (!_tmp0_) { return; } self->priv->laying_out = TRUE; - gtk_widget_get_allocation (self->priv->drawing_area, &_tmp0_); - allocation = _tmp0_; - gtk_widget_get_allocation ((GtkWidget*) self, &_tmp1_); - box_allocation = _tmp1_; + _tmp1_ = self->priv->drawing_area; + gtk_widget_get_allocation (_tmp1_, &_tmp2_); + allocation = _tmp2_; + gtk_widget_get_allocation ((GtkWidget*) self, &_tmp3_); + box_allocation = _tmp3_; right_aligned = TRUE; - _tmp2_ = gtk_adjustment_get_value (self->priv->adjustment); - _tmp3_ = gtk_adjustment_get_upper (self->priv->adjustment); - _tmp4_ = gtk_adjustment_get_page_size (self->priv->adjustment); - if (_tmp2_ < (_tmp3_ - _tmp4_)) { + _tmp4_ = self->priv->adjustment; + _tmp5_ = gtk_adjustment_get_value (_tmp4_); + _tmp6_ = self->priv->adjustment; + _tmp7_ = gtk_adjustment_get_upper (_tmp6_); + _tmp8_ = self->priv->adjustment; + _tmp9_ = gtk_adjustment_get_page_size (_tmp8_); + if (_tmp5_ < (_tmp7_ - _tmp9_)) { right_aligned = FALSE; } - width = (gint) allocation.width; - _tmp5_ = gtk_container_get_border_width ((GtkContainer*) self); - height = (gint) (box_allocation.height - (_tmp5_ * 2)); - book_view_layout_into (self, width, height, &_tmp6_, &_tmp7_); - book_width = _tmp6_; - book_height = _tmp7_; - if (book_width > allocation.width) { - gint _tmp8_; - gint _tmp9_; + _tmp10_ = allocation; + _tmp11_ = _tmp10_.width; + width = (gint) _tmp11_; + _tmp12_ = box_allocation; + _tmp13_ = _tmp12_.height; + _tmp14_ = gtk_container_get_border_width ((GtkContainer*) self); + height = (gint) (_tmp13_ - (_tmp14_ * 2)); + _tmp15_ = width; + _tmp16_ = height; + book_view_layout_into (self, _tmp15_, _tmp16_, &_tmp17_, &_tmp18_); + book_width = _tmp17_; + book_height = _tmp18_; + _tmp19_ = book_width; + _tmp20_ = allocation; + _tmp21_ = _tmp20_.width; + if (_tmp19_ > _tmp21_) { + GtkAllocation _tmp22_; + gint _tmp23_; + gint _tmp24_; + gint _tmp25_; + gint _tmp26_ = 0; + gint _tmp27_ = 0; + GtkAdjustment* _tmp28_; + GtkAdjustment* _tmp29_; + gint _tmp30_; + GtkAdjustment* _tmp31_; + GtkAllocation _tmp32_; + gint _tmp33_; + gint _tmp34_; + GtkAllocation _tmp35_; + gint _tmp36_; gint max_offset; - gboolean _tmp10_ = FALSE; - height = allocation.height; - book_view_layout_into (self, width, height, &_tmp8_, &_tmp9_); - book_width = _tmp8_; - book_height = _tmp9_; - gtk_adjustment_set_lower (self->priv->adjustment, (gdouble) 0); - gtk_adjustment_set_upper (self->priv->adjustment, (gdouble) book_width); - gtk_adjustment_set_page_size (self->priv->adjustment, (gdouble) allocation.width); - max_offset = book_width - allocation.width; - if (right_aligned) { - _tmp10_ = TRUE; + gboolean _tmp37_ = FALSE; + gboolean _tmp38_; + gboolean _tmp41_; + GtkHScrollbar* _tmp43_; + _tmp22_ = allocation; + _tmp23_ = _tmp22_.height; + height = _tmp23_; + _tmp24_ = width; + _tmp25_ = height; + book_view_layout_into (self, _tmp24_, _tmp25_, &_tmp26_, &_tmp27_); + book_width = _tmp26_; + book_height = _tmp27_; + _tmp28_ = self->priv->adjustment; + gtk_adjustment_set_lower (_tmp28_, (gdouble) 0); + _tmp29_ = self->priv->adjustment; + _tmp30_ = book_width; + gtk_adjustment_set_upper (_tmp29_, (gdouble) _tmp30_); + _tmp31_ = self->priv->adjustment; + _tmp32_ = allocation; + _tmp33_ = _tmp32_.width; + gtk_adjustment_set_page_size (_tmp31_, (gdouble) _tmp33_); + _tmp34_ = book_width; + _tmp35_ = allocation; + _tmp36_ = _tmp35_.width; + max_offset = _tmp34_ - _tmp36_; + _tmp38_ = right_aligned; + if (_tmp38_) { + _tmp37_ = TRUE; } else { - gint _tmp11_; - _tmp11_ = book_view_get_x_offset (self); - _tmp10_ = _tmp11_ > max_offset; + gint _tmp39_ = 0; + gint _tmp40_; + _tmp39_ = book_view_get_x_offset (self); + _tmp40_ = max_offset; + _tmp37_ = _tmp39_ > _tmp40_; } - if (_tmp10_) { - book_view_set_x_offset (self, max_offset); + _tmp41_ = _tmp37_; + if (_tmp41_) { + gint _tmp42_; + _tmp42_ = max_offset; + book_view_set_x_offset (self, _tmp42_); } - gtk_widget_show ((GtkWidget*) self->priv->scroll); + _tmp43_ = self->priv->scroll; + gtk_widget_show ((GtkWidget*) _tmp43_); } else { + GtkHScrollbar* _tmp44_; + gint _tmp45_; + GtkAllocation _tmp46_; + gint _tmp47_; gint offset; - gtk_widget_hide ((GtkWidget*) self->priv->scroll); - offset = (book_width - allocation.width) / 2; - gtk_adjustment_set_lower (self->priv->adjustment, (gdouble) offset); - gtk_adjustment_set_upper (self->priv->adjustment, (gdouble) offset); - gtk_adjustment_set_page_size (self->priv->adjustment, (gdouble) 0); - book_view_set_x_offset (self, offset); + GtkAdjustment* _tmp48_; + gint _tmp49_; + GtkAdjustment* _tmp50_; + gint _tmp51_; + GtkAdjustment* _tmp52_; + gint _tmp53_; + _tmp44_ = self->priv->scroll; + gtk_widget_hide ((GtkWidget*) _tmp44_); + _tmp45_ = book_width; + _tmp46_ = allocation; + _tmp47_ = _tmp46_.width; + offset = (_tmp45_ - _tmp47_) / 2; + _tmp48_ = self->priv->adjustment; + _tmp49_ = offset; + gtk_adjustment_set_lower (_tmp48_, (gdouble) _tmp49_); + _tmp50_ = self->priv->adjustment; + _tmp51_ = offset; + gtk_adjustment_set_upper (_tmp50_, (gdouble) _tmp51_); + _tmp52_ = self->priv->adjustment; + gtk_adjustment_set_page_size (_tmp52_, (gdouble) 0); + _tmp53_ = offset; + book_view_set_x_offset (self, _tmp53_); } - if (self->priv->show_selected_page) { - book_view_show_page_view (self, self->priv->selected_page); + _tmp54_ = self->priv->show_selected_page; + if (_tmp54_) { + PageView* _tmp55_; + _tmp55_ = self->priv->selected_page; + book_view_show_page_view (self, _tmp55_); } self->priv->need_layout = FALSE; self->priv->show_selected_page = FALSE; @@ -1034,95 +1501,149 @@ static void book_view_layout (BookView* self) { static gboolean book_view_draw_cb (BookView* self, GtkWidget* widget, cairo_t* context) { gboolean result = FALSE; - guint _tmp0_; + Book* _tmp0_; + guint _tmp1_ = 0U; gdouble left = 0.0; gdouble top = 0.0; gdouble right = 0.0; gdouble bottom = 0.0; - gdouble _tmp1_; - gdouble _tmp2_; - gdouble _tmp3_; - gdouble _tmp4_; + cairo_t* _tmp2_; + gdouble _tmp3_ = 0.0; + gdouble _tmp4_ = 0.0; + gdouble _tmp5_ = 0.0; + gdouble _tmp6_ = 0.0; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (context != NULL, FALSE); - _tmp0_ = book_get_n_pages (self->priv->book); - if (_tmp0_ == ((guint) 0)) { + _tmp0_ = self->priv->book; + _tmp1_ = book_get_n_pages (_tmp0_); + if (_tmp1_ == ((guint) 0)) { result = FALSE; return result; } book_view_layout (self); - cairo_clip_extents (context, &_tmp1_, &_tmp2_, &_tmp3_, &_tmp4_); - left = _tmp1_; - top = _tmp2_; - right = _tmp3_; - bottom = _tmp4_; + _tmp2_ = context; + cairo_clip_extents (_tmp2_, &_tmp3_, &_tmp4_, &_tmp5_, &_tmp6_); + left = _tmp3_; + top = _tmp4_; + right = _tmp5_; + bottom = _tmp6_; { gint i; i = 0; { - gboolean _tmp5_; - _tmp5_ = TRUE; + gboolean _tmp7_; + _tmp7_ = TRUE; while (TRUE) { - guint _tmp6_; - PageView* _tmp7_ = NULL; + gboolean _tmp8_; + gint _tmp10_; + Book* _tmp11_; + guint _tmp12_ = 0U; + gint _tmp13_; + PageView* _tmp14_ = NULL; PageView* page; - gint _tmp8_; - gint _tmp9_; + PageView* _tmp15_; + gint _tmp16_ = 0; + gint _tmp17_ = 0; gint left_edge; - gint _tmp10_; - gint _tmp11_; - gint _tmp12_; + PageView* _tmp18_; + gint _tmp19_ = 0; + PageView* _tmp20_; + gint _tmp21_ = 0; + gint _tmp22_ = 0; gint right_edge; - gboolean _tmp13_ = FALSE; - gint _tmp14_; - gboolean _tmp15_; - if (!_tmp5_) { - i++; + gboolean _tmp23_ = FALSE; + gint _tmp24_; + gdouble _tmp25_; + gboolean _tmp28_; + cairo_t* _tmp29_; + cairo_t* _tmp30_; + gint _tmp31_ = 0; + PageView* _tmp32_; + cairo_t* _tmp33_; + cairo_t* _tmp34_; + PageView* _tmp35_; + gboolean _tmp36_ = FALSE; + _tmp8_ = _tmp7_; + if (!_tmp8_) { + gint _tmp9_; + _tmp9_ = i; + i = _tmp9_ + 1; } - _tmp5_ = FALSE; - _tmp6_ = book_get_n_pages (self->priv->book); - if (!(((guint) i) < _tmp6_)) { + _tmp7_ = FALSE; + _tmp10_ = i; + _tmp11_ = self->priv->book; + _tmp12_ = book_get_n_pages (_tmp11_); + if (!(((guint) _tmp10_) < _tmp12_)) { break; } - _tmp7_ = book_view_get_nth_page (self, i); - page = _tmp7_; - _tmp8_ = page_view_get_x_offset (page); - _tmp9_ = book_view_get_x_offset (self); - left_edge = _tmp8_ - _tmp9_; - _tmp10_ = page_view_get_x_offset (page); - _tmp11_ = page_view_get_width (page); - _tmp12_ = book_view_get_x_offset (self); - right_edge = (_tmp10_ + _tmp11_) - _tmp12_; - if (((gdouble) right_edge) < left) { - _tmp13_ = TRUE; + _tmp13_ = i; + _tmp14_ = book_view_get_nth_page (self, _tmp13_); + page = _tmp14_; + _tmp15_ = page; + _tmp16_ = page_view_get_x_offset (_tmp15_); + _tmp17_ = book_view_get_x_offset (self); + left_edge = _tmp16_ - _tmp17_; + _tmp18_ = page; + _tmp19_ = page_view_get_x_offset (_tmp18_); + _tmp20_ = page; + _tmp21_ = page_view_get_width (_tmp20_); + _tmp22_ = book_view_get_x_offset (self); + right_edge = (_tmp19_ + _tmp21_) - _tmp22_; + _tmp24_ = right_edge; + _tmp25_ = left; + if (((gdouble) _tmp24_) < _tmp25_) { + _tmp23_ = TRUE; } else { - _tmp13_ = ((gdouble) left_edge) > right; + gint _tmp26_; + gdouble _tmp27_; + _tmp26_ = left_edge; + _tmp27_ = right; + _tmp23_ = ((gdouble) _tmp26_) > _tmp27_; } - if (_tmp13_) { + _tmp28_ = _tmp23_; + if (_tmp28_) { _page_view_unref0 (page); continue; } - cairo_save (context); - _tmp14_ = book_view_get_x_offset (self); - cairo_translate (context, (gdouble) (-_tmp14_), (gdouble) 0); - page_view_render (page, context); - cairo_restore (context); - _tmp15_ = page_view_get_selected (page); - if (_tmp15_) { - GtkStyle* _tmp16_ = NULL; - gint _tmp17_; - gint _tmp18_; - gint _tmp19_; - gint _tmp20_; - gint _tmp21_; - _tmp16_ = gtk_widget_get_style (self->priv->drawing_area); - _tmp17_ = page_view_get_x_offset (page); - _tmp18_ = book_view_get_x_offset (self); - _tmp19_ = page_view_get_y_offset (page); - _tmp20_ = page_view_get_width (page); - _tmp21_ = page_view_get_height (page); - gtk_paint_focus (_tmp16_, context, GTK_STATE_SELECTED, NULL, NULL, _tmp17_ - _tmp18_, _tmp19_, _tmp20_, _tmp21_); + _tmp29_ = context; + cairo_save (_tmp29_); + _tmp30_ = context; + _tmp31_ = book_view_get_x_offset (self); + cairo_translate (_tmp30_, (gdouble) (-_tmp31_), (gdouble) 0); + _tmp32_ = page; + _tmp33_ = context; + page_view_render (_tmp32_, _tmp33_); + _tmp34_ = context; + cairo_restore (_tmp34_); + _tmp35_ = page; + _tmp36_ = page_view_get_selected (_tmp35_); + if (_tmp36_) { + GtkWidget* _tmp37_; + GtkStyle* _tmp38_ = NULL; + cairo_t* _tmp39_; + PageView* _tmp40_; + gint _tmp41_ = 0; + gint _tmp42_ = 0; + PageView* _tmp43_; + gint _tmp44_ = 0; + PageView* _tmp45_; + gint _tmp46_ = 0; + PageView* _tmp47_; + gint _tmp48_ = 0; + _tmp37_ = self->priv->drawing_area; + _tmp38_ = gtk_widget_get_style (_tmp37_); + _tmp39_ = context; + _tmp40_ = page; + _tmp41_ = page_view_get_x_offset (_tmp40_); + _tmp42_ = book_view_get_x_offset (self); + _tmp43_ = page; + _tmp44_ = page_view_get_y_offset (_tmp43_); + _tmp45_ = page; + _tmp46_ = page_view_get_width (_tmp45_); + _tmp47_ = page; + _tmp48_ = page_view_get_height (_tmp47_); + gtk_paint_focus (_tmp38_, _tmp39_, GTK_STATE_SELECTED, NULL, NULL, _tmp41_ - _tmp42_, _tmp44_, _tmp46_, _tmp48_); } _page_view_unref0 (page); } @@ -1134,8 +1655,8 @@ static gboolean book_view_draw_cb (BookView* self, GtkWidget* widget, cairo_t* c static PageView* book_view_get_page_at (BookView* self, gint x, gint y, gint* x_, gint* y_) { - gint _x_ = 0; - gint _y_ = 0; + gint _vala_x_ = 0; + gint _vala_y_ = 0; PageView* result = NULL; g_return_val_if_fail (self != NULL, NULL); { @@ -1145,62 +1666,114 @@ static PageView* book_view_get_page_at (BookView* self, gint x, gint y, gint* x_ gboolean _tmp0_; _tmp0_ = TRUE; while (TRUE) { - guint _tmp1_; - PageView* _tmp2_ = NULL; - PageView* page; + gboolean _tmp1_; gint _tmp3_; + Book* _tmp4_; + guint _tmp5_ = 0U; + gint _tmp6_; + PageView* _tmp7_ = NULL; + PageView* page; + PageView* _tmp8_; + gint _tmp9_ = 0; gint left; - gint _tmp4_; + gint _tmp10_; + PageView* _tmp11_; + gint _tmp12_ = 0; gint right; - gint _tmp5_; + PageView* _tmp13_; + gint _tmp14_ = 0; gint top; - gint _tmp6_; + gint _tmp15_; + PageView* _tmp16_; + gint _tmp17_ = 0; gint bottom; - gboolean _tmp7_ = FALSE; - gboolean _tmp8_ = FALSE; - gboolean _tmp9_ = FALSE; - if (!_tmp0_) { - i++; + gboolean _tmp18_ = FALSE; + gboolean _tmp19_ = FALSE; + gboolean _tmp20_ = FALSE; + gint _tmp21_; + gint _tmp22_; + gboolean _tmp25_; + gboolean _tmp28_; + gboolean _tmp31_; + _tmp1_ = _tmp0_; + if (!_tmp1_) { + gint _tmp2_; + _tmp2_ = i; + i = _tmp2_ + 1; } _tmp0_ = FALSE; - _tmp1_ = book_get_n_pages (self->priv->book); - if (!(((guint) i) < _tmp1_)) { + _tmp3_ = i; + _tmp4_ = self->priv->book; + _tmp5_ = book_get_n_pages (_tmp4_); + if (!(((guint) _tmp3_) < _tmp5_)) { break; } - _tmp2_ = book_view_get_nth_page (self, i); - page = _tmp2_; - _tmp3_ = page_view_get_x_offset (page); - left = _tmp3_; - _tmp4_ = page_view_get_width (page); - right = left + _tmp4_; - _tmp5_ = page_view_get_y_offset (page); - top = _tmp5_; - _tmp6_ = page_view_get_height (page); - bottom = top + _tmp6_; - if (x >= left) { - _tmp9_ = x <= right; + _tmp6_ = i; + _tmp7_ = book_view_get_nth_page (self, _tmp6_); + page = _tmp7_; + _tmp8_ = page; + _tmp9_ = page_view_get_x_offset (_tmp8_); + left = _tmp9_; + _tmp10_ = left; + _tmp11_ = page; + _tmp12_ = page_view_get_width (_tmp11_); + right = _tmp10_ + _tmp12_; + _tmp13_ = page; + _tmp14_ = page_view_get_y_offset (_tmp13_); + top = _tmp14_; + _tmp15_ = top; + _tmp16_ = page; + _tmp17_ = page_view_get_height (_tmp16_); + bottom = _tmp15_ + _tmp17_; + _tmp21_ = x; + _tmp22_ = left; + if (_tmp21_ >= _tmp22_) { + gint _tmp23_; + gint _tmp24_; + _tmp23_ = x; + _tmp24_ = right; + _tmp20_ = _tmp23_ <= _tmp24_; } else { - _tmp9_ = FALSE; + _tmp20_ = FALSE; } - if (_tmp9_) { - _tmp8_ = y >= top; + _tmp25_ = _tmp20_; + if (_tmp25_) { + gint _tmp26_; + gint _tmp27_; + _tmp26_ = y; + _tmp27_ = top; + _tmp19_ = _tmp26_ >= _tmp27_; } else { - _tmp8_ = FALSE; + _tmp19_ = FALSE; } - if (_tmp8_) { - _tmp7_ = y <= bottom; + _tmp28_ = _tmp19_; + if (_tmp28_) { + gint _tmp29_; + gint _tmp30_; + _tmp29_ = y; + _tmp30_ = bottom; + _tmp18_ = _tmp29_ <= _tmp30_; } else { - _tmp7_ = FALSE; + _tmp18_ = FALSE; } - if (_tmp7_) { - _x_ = x - left; - _y_ = y - top; + _tmp31_ = _tmp18_; + if (_tmp31_) { + gint _tmp32_; + gint _tmp33_; + gint _tmp34_; + gint _tmp35_; + _tmp32_ = x; + _tmp33_ = left; + _vala_x_ = _tmp32_ - _tmp33_; + _tmp34_ = y; + _tmp35_ = top; + _vala_y_ = _tmp34_ - _tmp35_; result = page; if (x_) { - *x_ = _x_; + *x_ = _vala_x_; } if (y_) { - *y_ = _y_; + *y_ = _vala_y_; } return result; } @@ -1210,10 +1783,10 @@ static PageView* book_view_get_page_at (BookView* self, gint x, gint y, gint* x_ } result = NULL; if (x_) { - *x_ = _x_; + *x_ = _vala_x_; } if (y_) { - *y_ = _y_; + *y_ = _vala_y_; } return result; } @@ -1221,51 +1794,100 @@ static PageView* book_view_get_page_at (BookView* self, gint x, gint y, gint* x_ static gboolean book_view_button_cb (BookView* self, GtkWidget* widget, GdkEventButton* event) { gboolean result = FALSE; + GtkWidget* _tmp0_; gint x; gint y; + GdkEventButton _tmp1_; + GdkEventType _tmp2_; + PageView* _tmp12_; + GdkEventButton _tmp13_; + guint _tmp14_; + GdkEventButton _tmp29_; + guint _tmp30_; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (event != NULL, FALSE); book_view_layout (self); - gtk_widget_grab_focus (self->priv->drawing_area); + _tmp0_ = self->priv->drawing_area; + gtk_widget_grab_focus (_tmp0_); x = 0; y = 0; - if ((*event).type == GDK_BUTTON_PRESS) { - gint _tmp0_; - gint _tmp1_; - gint _tmp2_; - PageView* _tmp3_ = NULL; - PageView* _tmp4_; - _tmp0_ = book_view_get_x_offset (self); - _tmp3_ = book_view_get_page_at (self, (gint) ((*event).x + _tmp0_), (gint) (*event).y, &_tmp1_, &_tmp2_); - x = _tmp1_; - y = _tmp2_; - _tmp4_ = _tmp3_; - book_view_select_page_view (self, _tmp4_); - _page_view_unref0 (_tmp4_); + _tmp1_ = *event; + _tmp2_ = _tmp1_.type; + if (_tmp2_ == GDK_BUTTON_PRESS) { + GdkEventButton _tmp3_; + gdouble _tmp4_; + gint _tmp5_ = 0; + GdkEventButton _tmp6_; + gdouble _tmp7_; + gint _tmp8_ = 0; + gint _tmp9_ = 0; + PageView* _tmp10_ = NULL; + PageView* _tmp11_; + _tmp3_ = *event; + _tmp4_ = _tmp3_.x; + _tmp5_ = book_view_get_x_offset (self); + _tmp6_ = *event; + _tmp7_ = _tmp6_.y; + _tmp10_ = book_view_get_page_at (self, (gint) (_tmp4_ + _tmp5_), (gint) _tmp7_, &_tmp8_, &_tmp9_); + x = _tmp8_; + y = _tmp9_; + _tmp11_ = _tmp10_; + book_view_select_page_view (self, _tmp11_); + _page_view_unref0 (_tmp11_); } - if (self->priv->selected_page == NULL) { + _tmp12_ = self->priv->selected_page; + if (_tmp12_ == NULL) { result = FALSE; return result; } - if ((*event).button == ((guint) 1)) { - if ((*event).type == GDK_BUTTON_PRESS) { - page_view_button_press (self->priv->selected_page, x, y); + _tmp13_ = *event; + _tmp14_ = _tmp13_.button; + if (_tmp14_ == ((guint) 1)) { + GdkEventButton _tmp15_; + GdkEventType _tmp16_; + _tmp15_ = *event; + _tmp16_ = _tmp15_.type; + if (_tmp16_ == GDK_BUTTON_PRESS) { + PageView* _tmp17_; + gint _tmp18_; + gint _tmp19_; + _tmp17_ = self->priv->selected_page; + _tmp18_ = x; + _tmp19_ = y; + page_view_button_press (_tmp17_, _tmp18_, _tmp19_); } else { - if ((*event).type == GDK_BUTTON_RELEASE) { - page_view_button_release (self->priv->selected_page, x, y); + GdkEventButton _tmp20_; + GdkEventType _tmp21_; + _tmp20_ = *event; + _tmp21_ = _tmp20_.type; + if (_tmp21_ == GDK_BUTTON_RELEASE) { + PageView* _tmp22_; + gint _tmp23_; + gint _tmp24_; + _tmp22_ = self->priv->selected_page; + _tmp23_ = x; + _tmp24_ = y; + page_view_button_release (_tmp22_, _tmp23_, _tmp24_); } else { - if ((*event).type == GDK_2BUTTON_PRESS) { - Page* _tmp5_ = NULL; - Page* _tmp6_; - _tmp5_ = book_view_get_selected (self); - _tmp6_ = _tmp5_; - g_signal_emit_by_name (self, "show-page", _tmp6_); - _page_unref0 (_tmp6_); + GdkEventButton _tmp25_; + GdkEventType _tmp26_; + _tmp25_ = *event; + _tmp26_ = _tmp25_.type; + if (_tmp26_ == GDK_2BUTTON_PRESS) { + Page* _tmp27_ = NULL; + Page* _tmp28_; + _tmp27_ = book_view_get_selected (self); + _tmp28_ = _tmp27_; + g_signal_emit_by_name (self, "show-page", _tmp28_); + _page_unref0 (_tmp28_); } } } } - if ((*event).button == ((guint) 3)) { + _tmp29_ = *event; + _tmp30_ = _tmp29_.button; + if (_tmp30_ == ((guint) 3)) { g_signal_emit_by_name (self, "show-menu"); } result = FALSE; @@ -1275,19 +1897,31 @@ static gboolean book_view_button_cb (BookView* self, GtkWidget* widget, GdkEvent static void book_view_set_cursor (BookView* self, GdkCursorType cursor) { GdkCursor* c = NULL; - GdkCursor* _tmp0_ = NULL; - GdkWindow* _tmp1_ = NULL; + GdkCursorType _tmp0_; + GdkCursorType _tmp1_; + GdkCursorType _tmp2_; + GdkCursorType _tmp3_; + GdkCursor* _tmp4_; + GtkWidget* _tmp5_; + GdkWindow* _tmp6_ = NULL; + GdkCursor* _tmp7_; g_return_if_fail (self != NULL); - if (self->priv->cursor == cursor) { + _tmp0_ = self->priv->cursor; + _tmp1_ = cursor; + if (_tmp0_ == _tmp1_) { _g_object_unref0 (c); return; } - self->priv->cursor = cursor; - _tmp0_ = gdk_cursor_new (cursor); + _tmp2_ = cursor; + self->priv->cursor = _tmp2_; + _tmp3_ = cursor; + _tmp4_ = gdk_cursor_new (_tmp3_); _g_object_unref0 (c); - c = _tmp0_; - _tmp1_ = gtk_widget_get_window (self->priv->drawing_area); - gdk_window_set_cursor (_tmp1_, c); + c = _tmp4_; + _tmp5_ = self->priv->drawing_area; + _tmp6_ = gtk_widget_get_window (_tmp5_); + _tmp7_ = c; + gdk_window_set_cursor (_tmp6_, _tmp7_); _g_object_unref0 (c); } @@ -1296,51 +1930,100 @@ static gboolean book_view_motion_cb (BookView* self, GtkWidget* widget, GdkEvent gboolean result = FALSE; GdkCursorType cursor; gboolean _tmp0_ = FALSE; + PageView* _tmp1_; + gboolean _tmp4_; + GdkCursorType _tmp33_; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE); + g_return_val_if_fail (event != NULL, FALSE); cursor = GDK_ARROW; - if (self->priv->selected_page != NULL) { - _tmp0_ = ((*event).state & GDK_BUTTON1_MASK) != 0; + _tmp1_ = self->priv->selected_page; + if (_tmp1_ != NULL) { + GdkEventMotion _tmp2_; + GdkModifierType _tmp3_; + _tmp2_ = *event; + _tmp3_ = _tmp2_.state; + _tmp0_ = (_tmp3_ & GDK_BUTTON1_MASK) != 0; } else { _tmp0_ = FALSE; } - if (_tmp0_) { - gint _tmp1_; - gint _tmp2_; + _tmp4_ = _tmp0_; + if (_tmp4_) { + GdkEventMotion _tmp5_; + gdouble _tmp6_; + gint _tmp7_ = 0; + PageView* _tmp8_; + gint _tmp9_ = 0; gint x; - gint _tmp3_; + GdkEventMotion _tmp10_; + gdouble _tmp11_; + PageView* _tmp12_; + gint _tmp13_ = 0; gint y; - GdkCursorType _tmp4_; - _tmp1_ = book_view_get_x_offset (self); - _tmp2_ = page_view_get_x_offset (self->priv->selected_page); - x = (gint) (((*event).x + _tmp1_) - _tmp2_); - _tmp3_ = page_view_get_y_offset (self->priv->selected_page); - y = (gint) ((*event).y - _tmp3_); - page_view_motion (self->priv->selected_page, x, y); - _tmp4_ = page_view_get_cursor (self->priv->selected_page); - cursor = _tmp4_; + PageView* _tmp14_; + gint _tmp15_; + gint _tmp16_; + PageView* _tmp17_; + GdkCursorType _tmp18_ = 0; + _tmp5_ = *event; + _tmp6_ = _tmp5_.x; + _tmp7_ = book_view_get_x_offset (self); + _tmp8_ = self->priv->selected_page; + _tmp9_ = page_view_get_x_offset (_tmp8_); + x = (gint) ((_tmp6_ + _tmp7_) - _tmp9_); + _tmp10_ = *event; + _tmp11_ = _tmp10_.y; + _tmp12_ = self->priv->selected_page; + _tmp13_ = page_view_get_y_offset (_tmp12_); + y = (gint) (_tmp11_ - _tmp13_); + _tmp14_ = self->priv->selected_page; + _tmp15_ = x; + _tmp16_ = y; + page_view_motion (_tmp14_, _tmp15_, _tmp16_); + _tmp17_ = self->priv->selected_page; + _tmp18_ = page_view_get_cursor (_tmp17_); + cursor = _tmp18_; } else { gint x = 0; gint y = 0; - gint _tmp5_; - gint _tmp6_; - gint _tmp7_; - PageView* _tmp8_ = NULL; + GdkEventMotion _tmp19_; + gdouble _tmp20_; + gint _tmp21_ = 0; + GdkEventMotion _tmp22_; + gdouble _tmp23_; + gint _tmp24_ = 0; + gint _tmp25_ = 0; + PageView* _tmp26_ = NULL; PageView* over_page; - _tmp5_ = book_view_get_x_offset (self); - _tmp8_ = book_view_get_page_at (self, (gint) ((*event).x + _tmp5_), (gint) (*event).y, &_tmp6_, &_tmp7_); - x = _tmp6_; - y = _tmp7_; - over_page = _tmp8_; - if (over_page != NULL) { - GdkCursorType _tmp9_; - page_view_motion (over_page, x, y); - _tmp9_ = page_view_get_cursor (over_page); - cursor = _tmp9_; + PageView* _tmp27_; + _tmp19_ = *event; + _tmp20_ = _tmp19_.x; + _tmp21_ = book_view_get_x_offset (self); + _tmp22_ = *event; + _tmp23_ = _tmp22_.y; + _tmp26_ = book_view_get_page_at (self, (gint) (_tmp20_ + _tmp21_), (gint) _tmp23_, &_tmp24_, &_tmp25_); + x = _tmp24_; + y = _tmp25_; + over_page = _tmp26_; + _tmp27_ = over_page; + if (_tmp27_ != NULL) { + PageView* _tmp28_; + gint _tmp29_; + gint _tmp30_; + PageView* _tmp31_; + GdkCursorType _tmp32_ = 0; + _tmp28_ = over_page; + _tmp29_ = x; + _tmp30_ = y; + page_view_motion (_tmp28_, _tmp29_, _tmp30_); + _tmp31_ = over_page; + _tmp32_ = page_view_get_cursor (_tmp31_); + cursor = _tmp32_; } _page_view_unref0 (over_page); } - book_view_set_cursor (self, cursor); + _tmp33_ = cursor; + book_view_set_cursor (self, _tmp33_); result = FALSE; return result; } @@ -1348,52 +2031,67 @@ static gboolean book_view_motion_cb (BookView* self, GtkWidget* widget, GdkEvent static gboolean book_view_key_cb (BookView* self, GtkWidget* widget, GdkEventKey* event) { gboolean result = FALSE; + GdkEventKey _tmp0_; + guint _tmp1_; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE); - switch ((*event).keyval) { + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = *event; + _tmp1_ = _tmp0_.keyval; + switch (_tmp1_) { case 0xff50: { - Page* _tmp0_ = NULL; - Page* _tmp1_; - _tmp0_ = book_get_page (self->priv->book, 0); - _tmp1_ = _tmp0_; - book_view_select_page (self, _tmp1_); - _page_unref0 (_tmp1_); + Book* _tmp2_; + Page* _tmp3_ = NULL; + Page* _tmp4_; + _tmp2_ = self->priv->book; + _tmp3_ = book_get_page (_tmp2_, 0); + _tmp4_ = _tmp3_; + book_view_select_page (self, _tmp4_); + _page_unref0 (_tmp4_); result = TRUE; return result; } case 0xff51: { - PageView* _tmp2_ = NULL; - PageView* _tmp3_; - _tmp2_ = book_view_get_prev_page (self, self->priv->selected_page); - _tmp3_ = _tmp2_; - book_view_select_page_view (self, _tmp3_); - _page_view_unref0 (_tmp3_); + PageView* _tmp5_; + PageView* _tmp6_ = NULL; + PageView* _tmp7_; + _tmp5_ = self->priv->selected_page; + _tmp6_ = book_view_get_prev_page (self, _tmp5_); + _tmp7_ = _tmp6_; + book_view_select_page_view (self, _tmp7_); + _page_view_unref0 (_tmp7_); result = TRUE; return result; } case 0xff53: { - PageView* _tmp4_ = NULL; - PageView* _tmp5_; - _tmp4_ = book_view_get_next_page (self, self->priv->selected_page); - _tmp5_ = _tmp4_; - book_view_select_page_view (self, _tmp5_); - _page_view_unref0 (_tmp5_); + PageView* _tmp8_; + PageView* _tmp9_ = NULL; + PageView* _tmp10_; + _tmp8_ = self->priv->selected_page; + _tmp9_ = book_view_get_next_page (self, _tmp8_); + _tmp10_ = _tmp9_; + book_view_select_page_view (self, _tmp10_); + _page_view_unref0 (_tmp10_); result = TRUE; return result; } case 0xFF57: { - guint _tmp6_; - Page* _tmp7_ = NULL; - Page* _tmp8_; - _tmp6_ = book_get_n_pages (self->priv->book); - _tmp7_ = book_get_page (self->priv->book, ((gint) _tmp6_) - 1); - _tmp8_ = _tmp7_; - book_view_select_page (self, _tmp8_); - _page_unref0 (_tmp8_); + Book* _tmp11_; + Book* _tmp12_; + guint _tmp13_ = 0U; + Page* _tmp14_ = NULL; + Page* _tmp15_; + _tmp11_ = self->priv->book; + _tmp12_ = self->priv->book; + _tmp13_ = book_get_n_pages (_tmp12_); + _tmp14_ = book_get_page (_tmp11_, ((gint) _tmp13_) - 1); + _tmp15_ = _tmp14_; + book_view_select_page (self, _tmp15_); + _page_unref0 (_tmp15_); result = TRUE; return result; } @@ -1408,45 +2106,60 @@ static gboolean book_view_key_cb (BookView* self, GtkWidget* widget, GdkEventKey static gboolean book_view_focus_cb (BookView* self, GtkWidget* widget, GdkEventFocus* event) { gboolean result = FALSE; + PageView* _tmp0_; g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (widget != NULL, FALSE); - book_view_set_selected_page (self, self->priv->selected_page); + g_return_val_if_fail (event != NULL, FALSE); + _tmp0_ = self->priv->selected_page; + book_view_set_selected_page (self, _tmp0_); result = FALSE; return result; } static void book_view_scroll_cb (BookView* self, GtkAdjustment* adjustment) { + gboolean _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (adjustment != NULL); - if (!self->priv->laying_out) { + _tmp0_ = self->priv->laying_out; + if (!_tmp0_) { book_view_redraw (self); } } void book_view_redraw (BookView* self) { + GtkWidget* _tmp0_; g_return_if_fail (self != NULL); - gtk_widget_queue_draw (self->priv->drawing_area); + _tmp0_ = self->priv->drawing_area; + gtk_widget_queue_draw (_tmp0_); } void book_view_select_page (BookView* self, Page* page) { Page* _tmp0_ = NULL; Page* _tmp1_; - gboolean _tmp2_; + Page* _tmp2_; + gboolean _tmp3_; + Page* _tmp4_; g_return_if_fail (self != NULL); _tmp0_ = book_view_get_selected (self); _tmp1_ = _tmp0_; - _tmp2_ = _tmp1_ == page; + _tmp2_ = page; + _tmp3_ = _tmp1_ == _tmp2_; _page_unref0 (_tmp1_); - if (_tmp2_) { + if (_tmp3_) { return; } - if (page != NULL) { - gconstpointer _tmp3_ = NULL; - _tmp3_ = g_hash_table_lookup (self->priv->page_data, page); - book_view_select_page_view (self, (PageView*) _tmp3_); + _tmp4_ = page; + if (_tmp4_ != NULL) { + GHashTable* _tmp5_; + Page* _tmp6_; + gconstpointer _tmp7_ = NULL; + _tmp5_ = self->priv->page_data; + _tmp6_ = page; + _tmp7_ = g_hash_table_lookup (_tmp5_, _tmp6_); + book_view_select_page_view (self, (PageView*) _tmp7_); } else { book_view_select_page_view (self, NULL); } @@ -1454,34 +2167,42 @@ void book_view_select_page (BookView* self, Page* page) { void book_view_select_next_page (BookView* self) { - PageView* _tmp0_ = NULL; - PageView* _tmp1_; + PageView* _tmp0_; + PageView* _tmp1_ = NULL; + PageView* _tmp2_; g_return_if_fail (self != NULL); - _tmp0_ = book_view_get_next_page (self, self->priv->selected_page); - _tmp1_ = _tmp0_; - book_view_select_page_view (self, _tmp1_); - _page_view_unref0 (_tmp1_); + _tmp0_ = self->priv->selected_page; + _tmp1_ = book_view_get_next_page (self, _tmp0_); + _tmp2_ = _tmp1_; + book_view_select_page_view (self, _tmp2_); + _page_view_unref0 (_tmp2_); } void book_view_select_prev_page (BookView* self) { - PageView* _tmp0_ = NULL; - PageView* _tmp1_; + PageView* _tmp0_; + PageView* _tmp1_ = NULL; + PageView* _tmp2_; g_return_if_fail (self != NULL); - _tmp0_ = book_view_get_prev_page (self, self->priv->selected_page); - _tmp1_ = _tmp0_; - book_view_select_page_view (self, _tmp1_); - _page_view_unref0 (_tmp1_); + _tmp0_ = self->priv->selected_page; + _tmp1_ = book_view_get_prev_page (self, _tmp0_); + _tmp2_ = _tmp1_; + book_view_select_page_view (self, _tmp2_); + _page_view_unref0 (_tmp2_); } Page* book_view_get_selected (BookView* self) { Page* result = NULL; + PageView* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - if (self->priv->selected_page != NULL) { - Page* _tmp0_ = NULL; - _tmp0_ = page_view_get_page (self->priv->selected_page); - result = _tmp0_; + _tmp0_ = self->priv->selected_page; + if (_tmp0_ != NULL) { + PageView* _tmp1_; + Page* _tmp2_ = NULL; + _tmp1_ = self->priv->selected_page; + _tmp2_ = page_view_get_page (_tmp1_); + result = _tmp2_; return result; } else { result = NULL; |