fix invalid cast runtime warning
[claws.git] / src / plugins / pdf_viewer / poppler_viewer.c
index ae001be..5df4661 100644 (file)
@@ -83,7 +83,7 @@ static void pdf_viewer_button_rotate_left_cb(GtkButton *button, PdfViewer *viewe
 static void pdf_viewer_spin_change_page_cb(GtkSpinButton *button, PdfViewer *viewer);
 static void pdf_viewer_spin_zoom_scroll_cb(GtkSpinButton *button, PdfViewer *viewer);
 /* Show/Hide the index pane */
-static void pdf_viewer_show_document_index_cb(GtkButton *button, PdfViewer *viewer);
+static void pdf_viewer_show_document_index_cb(GtkToggleButton *button, PdfViewer *viewer);
 static void pdf_viewer_button_print_cb(GtkButton *button, PdfViewer *viewer);
 static void pdf_viewer_button_document_info_cb(GtkButton *button, PdfViewer *viewer);
 
@@ -1107,6 +1107,16 @@ static gboolean pdf_viewer_scroll_cb(GtkWidget *widget, GdkEventScroll *event,
 
        in_scroll_cb = TRUE;
 
+       if ((event->state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
+               if (event->direction == GDK_SCROLL_UP) {
+                       pdf_viewer_button_zoom_in_cb(NULL, viewer);
+               } else {
+                       pdf_viewer_button_zoom_out_cb(NULL, viewer);
+               }
+               in_scroll_cb = FALSE;
+               return TRUE;
+       }
+
        if (event->direction == GDK_SCROLL_UP &&
            gtk_adjustment_get_value(adj) == gtk_adjustment_get_lower(adj) &&
            cur_p > 1) {
@@ -1178,7 +1188,7 @@ static void pdf_viewer_button_rotate_left_cb(GtkButton *button, PdfViewer *viewe
 }
 
 /* Show/Hide the index pane */
-static void pdf_viewer_show_document_index_cb(GtkButton *button, PdfViewer *viewer)
+static void pdf_viewer_show_document_index_cb(GtkToggleButton *button, PdfViewer *viewer)
 {
        if (!viewer->pdf_index) {
                viewer->pdf_index = poppler_index_iter_new(viewer->pdf_doc);
@@ -1623,6 +1633,13 @@ static void pdf_viewer_scroll_one_line(MimeViewer *_viewer, gboolean up)
        gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(widget), \
                                col, col+1, 0, 1, 0, 0, BUTTON_H_PADDING, 0); \
        col++;
+#define ADD_TOGGLE_BUTTON_TO_TABLE(widget, stock_image) \
+       widget = gtk_toggle_button_new(); \
+       img = stock_pixmap_widget(stock_image); \
+       gtk_button_set_image(GTK_BUTTON(widget), img); \
+       gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(widget), \
+                               col, col+1, 0, 1, 0, 0, BUTTON_H_PADDING, 0); \
+       col++;
 
 #define ADD_SEP_TO_TABLE \
        sep = gtk_label_new(""); \
@@ -1799,7 +1816,7 @@ static MimeViewer *pdf_viewer_create(void)
        ADD_SEP_TO_TABLE
        ADD_BUTTON_TO_TABLE(viewer->print, STOCK_PIXMAP_PRINTER)
        ADD_BUTTON_TO_TABLE(viewer->doc_info, STOCK_PIXMAP_DOC_INFO)
-       ADD_BUTTON_TO_TABLE(viewer->doc_index, STOCK_PIXMAP_DOC_INDEX)
+       ADD_TOGGLE_BUTTON_TO_TABLE(viewer->doc_index, STOCK_PIXMAP_DOC_INDEX)
 
        gtk_scrolled_window_set_policy(
                        GTK_SCROLLED_WINDOW(viewer->scrollwin), 
@@ -2072,6 +2089,7 @@ static MimeViewer *pdf_viewer_create(void)
 }
 
 #undef ADD_BUTTON_TO_TABLE
+#undef ADD_TOGGLE_BUTTON_TO_TABLE
 #undef ADD_SEP_TO_TABLE
 #undef BUTTON_H_PADDING
 #undef SEP_H_PADDING