2010-11-10 20:31:15 +01:00
|
|
|
/* See LICENSE file for license and copyright information */
|
2010-11-10 20:47:53 +01:00
|
|
|
|
|
|
|
#ifndef CALLBACKS_H
|
|
|
|
#define CALLBACKS_H
|
|
|
|
|
2010-11-12 13:48:18 +01:00
|
|
|
#include <gtk/gtk.h>
|
2011-10-23 17:01:15 +02:00
|
|
|
#include <girara/types.h>
|
2011-12-09 14:50:35 +01:00
|
|
|
#include <girara/macros.h>
|
2011-09-29 17:05:54 +02:00
|
|
|
|
2012-03-27 13:34:23 +02:00
|
|
|
#include "internal.h"
|
2012-02-07 19:25:47 +01:00
|
|
|
#include "document.h"
|
2012-03-07 01:11:18 +01:00
|
|
|
#include "zathura.h"
|
2012-02-07 19:25:47 +01:00
|
|
|
|
2011-02-01 15:48:16 +01:00
|
|
|
/**
|
|
|
|
* Quits the current zathura session
|
|
|
|
*
|
|
|
|
* @param widget The gtk window of zathura
|
2012-03-07 01:11:18 +01:00
|
|
|
* @param zathura Correspondending zathura session
|
2012-02-08 15:30:13 +01:00
|
|
|
* @return true if no error occured and the event has been handled
|
2011-02-01 15:48:16 +01:00
|
|
|
*/
|
2012-03-07 01:11:18 +01:00
|
|
|
gboolean cb_destroy(GtkWidget* widget, zathura_t* zathura);
|
2011-02-01 15:48:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function gets called when the buffer of girara changes
|
|
|
|
*
|
|
|
|
* @param session The girara session
|
|
|
|
*/
|
2012-02-08 15:19:51 +01:00
|
|
|
void cb_buffer_changed(girara_session_t* session);
|
2011-02-01 15:48:16 +01:00
|
|
|
|
adapt view_adjustment callbacks to new document/view separation
The adjustment callbacks act as an interface between position data in
the document object, and the adjustments.
We remove the horizontal centering code, as now it is done by
position_set. Those callbacks should not change the position read from
the document object in any way.
Also, we split the adjustment_value_changed callback into a vertical and
an horizontal version. Previously a single callback was reused for both,
horizontal and vertical. That lead to a subtle problem when coming out
of index mode. What happened was the following:
1. horizontal adjustment bounds change coming out of index mode. This
triggers an hadjustment changed signal.
2. the hadjustment_changed callback handles it, and resets the
hadjustment value, as the bound may have changed. This triggers a
value_changed event.
3. the value_changed callback handles the event, and captures the
position for *BOTH*, horizontal and vertical adjustments, saving
them to the document object.
1..3 is repeated for the vertical adjustment.
Now, if in 3. the horizontal adjustment bounds were not yet updated
after the index mode, we got ourselves at the wrong vertical position.
This race condition is avoided now because both value_changed callbacks
*ONLY* handle their own direction, either vertical or horizontal, not
both.
2013-10-22 23:00:21 +02:00
|
|
|
/**
|
|
|
|
* This function gets called when the value of the horizontal scrollbars
|
|
|
|
* changes (e.g.: by scrolling, moving to another page)
|
|
|
|
*
|
|
|
|
* @param adjustment The hadjustment of the page view
|
|
|
|
* @param data NULL
|
|
|
|
*/
|
|
|
|
void cb_view_hadjustment_value_changed(GtkAdjustment *adjustment, gpointer data);
|
|
|
|
|
2011-02-01 15:48:16 +01:00
|
|
|
/**
|
2011-07-21 14:47:24 +02:00
|
|
|
* This function gets called when the value of the vertical scrollbars
|
2011-02-01 15:48:16 +01:00
|
|
|
* changes (e.g.: by scrolling, moving to another page)
|
|
|
|
*
|
|
|
|
* @param adjustment The vadjustment of the page view
|
|
|
|
* @param data NULL
|
|
|
|
*/
|
2010-12-29 11:46:13 +01:00
|
|
|
void cb_view_vadjustment_value_changed(GtkAdjustment *adjustment, gpointer data);
|
2013-03-23 15:59:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function gets called when the bounds or the page_size of the horizontal
|
|
|
|
* scrollbar change (e.g. when the zoom level is changed).
|
|
|
|
*
|
2013-10-20 23:57:24 +02:00
|
|
|
* It adjusts the value of the horizontal scrollbar
|
2013-03-23 15:59:27 +01:00
|
|
|
*
|
|
|
|
* @param adjustment The horizontal adjustment of a gtkScrolledWindow
|
|
|
|
* @param data The zathura instance
|
|
|
|
*/
|
|
|
|
void cb_view_hadjustment_changed(GtkAdjustment *adjustment, gpointer data);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function gets called when the bounds or the page_size of the vertical
|
|
|
|
* scrollbar change (e.g. when the zoom level is changed).
|
|
|
|
*
|
|
|
|
* It adjusts the value of the vertical scrollbar based on its previous
|
|
|
|
* adjustment, stored in the tracking adjustment zathura->ui.hadjustment.
|
|
|
|
*
|
|
|
|
* @param adjustment The vertical adjustment of a gtkScrolledWindow
|
|
|
|
* @param data The zathura instance
|
|
|
|
*/
|
|
|
|
void cb_view_vadjustment_changed(GtkAdjustment *adjustment, gpointer data);
|
|
|
|
|
2013-10-22 21:24:26 +02:00
|
|
|
/**
|
|
|
|
* This function gets called when the program need to refresh the document view.
|
|
|
|
*
|
|
|
|
* It adjusts the value of the scrollbars, triggering a redraw in the new
|
|
|
|
* position.
|
|
|
|
*
|
|
|
|
* @param view The view GtkWidget
|
|
|
|
* @param data The zathura instance
|
|
|
|
*/
|
|
|
|
void cb_refresh_view(GtkWidget* view, gpointer data);
|
|
|
|
|
2011-07-21 14:47:24 +02:00
|
|
|
/**
|
|
|
|
* This function gets called when the value of the "pages-per-row"
|
|
|
|
* variable changes
|
|
|
|
*
|
|
|
|
* @param session The current girara session
|
2012-02-08 15:30:13 +01:00
|
|
|
* @param name The name of the row
|
|
|
|
* @param type The settings type
|
|
|
|
* @param value The value
|
|
|
|
* @param data Custom data
|
2011-07-21 14:47:24 +02:00
|
|
|
*/
|
2013-10-20 16:20:08 +02:00
|
|
|
void cb_page_layout_value_changed(girara_session_t* session, const char* name,
|
2012-06-27 22:34:16 +02:00
|
|
|
girara_setting_type_t type, void* value, void* data);
|
2010-11-12 13:48:18 +01:00
|
|
|
|
2011-09-29 17:05:54 +02:00
|
|
|
/**
|
|
|
|
* Called when an index element is activated (e.g.: double click)
|
|
|
|
*
|
|
|
|
* @param tree_view Tree view
|
|
|
|
* @param path Path
|
|
|
|
* @param column Column
|
|
|
|
* @param zathura Zathura session
|
|
|
|
*/
|
2011-09-29 18:17:03 +02:00
|
|
|
void cb_index_row_activated(GtkTreeView* tree_view, GtkTreePath* path,
|
2011-12-09 14:50:35 +01:00
|
|
|
GtkTreeViewColumn* column, void* zathura);
|
2011-09-29 17:05:54 +02:00
|
|
|
|
2012-02-07 17:31:47 +01:00
|
|
|
/**
|
|
|
|
* Called when input has been passed to the sc_follow dialog
|
|
|
|
*
|
|
|
|
* @param entry The dialog inputbar
|
|
|
|
* @param session The girara session
|
2012-02-08 15:30:13 +01:00
|
|
|
* @return true if no error occured and the event has been handled
|
2012-02-07 17:31:47 +01:00
|
|
|
*/
|
|
|
|
bool cb_sc_follow(GtkEntry* entry, girara_session_t* session);
|
|
|
|
|
2012-12-07 16:03:43 +01:00
|
|
|
/**
|
|
|
|
* Called when input has been passed to the sc_display_link dialog
|
|
|
|
*
|
|
|
|
* @param entry The dialog inputbar
|
|
|
|
* @param session The girara session
|
|
|
|
* @return true if no error occured and the event has been handled
|
|
|
|
*/
|
|
|
|
bool cb_sc_display_link(GtkEntry* entry, girara_session_t* session);
|
|
|
|
|
2012-02-07 19:25:47 +01:00
|
|
|
/**
|
|
|
|
* Emitted when file has been changed
|
|
|
|
*
|
|
|
|
* @param monitor The file monitor
|
|
|
|
* @param file The file
|
|
|
|
* @param other_file A file or NULL
|
|
|
|
* @param event The monitor event
|
|
|
|
* @param session The girara session
|
|
|
|
*/
|
2012-02-08 15:30:13 +01:00
|
|
|
void cb_file_monitor(GFileMonitor* monitor, GFile* file, GFile* other_file,
|
|
|
|
GFileMonitorEvent event, girara_session_t* session);
|
2012-02-07 19:25:47 +01:00
|
|
|
|
2012-02-08 23:21:27 +01:00
|
|
|
/**
|
|
|
|
* Callback to read new password for file that should be opened
|
|
|
|
*
|
|
|
|
* @param entry The password entry
|
|
|
|
* @param dialog The dialog information
|
|
|
|
* @return true if input has been handled
|
|
|
|
*/
|
|
|
|
bool cb_password_dialog(GtkEntry* entry, zathura_password_dialog_info_t* dialog);
|
|
|
|
|
2012-02-09 01:46:51 +01:00
|
|
|
/**
|
|
|
|
* Emitted when the view has been resized
|
|
|
|
*
|
|
|
|
* @param widget View
|
|
|
|
* @param allocation Allocation
|
|
|
|
* @param zathura Zathura session
|
|
|
|
* @return true if signal has been handled successfully
|
|
|
|
*/
|
|
|
|
bool cb_view_resized(GtkWidget* widget, GtkAllocation* allocation, zathura_t* zathura);
|
|
|
|
|
2012-03-14 17:33:35 +01:00
|
|
|
/**
|
|
|
|
* Emitted when the 'recolor' setting is changed
|
|
|
|
*
|
|
|
|
* @param session Girara session
|
|
|
|
* @param name Name of the setting ("recolor")
|
|
|
|
* @param type Type of the setting (BOOLEAN)
|
|
|
|
* @param value New value
|
|
|
|
* @param data Custom data
|
|
|
|
*/
|
|
|
|
void cb_setting_recolor_change(girara_session_t* session, const char* name,
|
|
|
|
girara_setting_type_t type, void* value, void* data);
|
|
|
|
|
2012-07-31 16:43:20 +02:00
|
|
|
/**
|
|
|
|
* Emitted when the 'recolor-keephue' setting is changed
|
|
|
|
*
|
|
|
|
* @param session Girara session
|
|
|
|
* @param name Name of the setting ("recolor")
|
|
|
|
* @param type Type of the setting (BOOLEAN)
|
|
|
|
* @param value New value
|
|
|
|
* @param data Custom data
|
|
|
|
*/
|
|
|
|
void cb_setting_recolor_keep_hue_change(girara_session_t* session, const char* name,
|
|
|
|
girara_setting_type_t type, void* value, void* data);
|
|
|
|
|
|
|
|
|
2012-05-01 19:09:33 +02:00
|
|
|
/**
|
|
|
|
* Unknown command handler which is used to handle the strict numeric goto
|
|
|
|
* command
|
|
|
|
*
|
|
|
|
* @param session The girara session
|
|
|
|
* @param input The command input
|
|
|
|
* @return true if the input has been handled
|
|
|
|
*/
|
|
|
|
bool cb_unknown_command(girara_session_t* session, const char* input);
|
|
|
|
|
2013-08-31 13:12:41 +02:00
|
|
|
/**
|
|
|
|
* Emitted when text has been selected in the page widget
|
|
|
|
*
|
|
|
|
* @param widget page view widget
|
|
|
|
* @param text selected text
|
|
|
|
* @param data user data
|
|
|
|
*/
|
|
|
|
void cb_page_widget_text_selected(ZathuraPage* page, const char* text,
|
|
|
|
void* data);
|
|
|
|
|
|
|
|
void cb_page_widget_image_selected(ZathuraPage* page, GdkPixbuf* pixbuf,
|
|
|
|
void* data);
|
|
|
|
|
2014-05-24 18:04:59 +02:00
|
|
|
void
|
|
|
|
cb_page_widget_link(ZathuraPage* page, void* data);
|
|
|
|
|
|
|
|
|
2010-11-10 20:47:53 +01:00
|
|
|
#endif // CALLBACKS_H
|