mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 21:36:00 +01:00
En/Disable syntex support
This commit is contained in:
parent
6de5978127
commit
f6c6b4a883
5 changed files with 28 additions and 1 deletions
2
config.c
2
config.c
|
@ -161,6 +161,8 @@ config_load_default(zathura_t* zathura)
|
|||
girara_setting_add(gsession, "abort-clear-search", &bool_value, BOOLEAN, false, _("Clear search results on abort"), NULL, NULL);
|
||||
bool_value = false;
|
||||
girara_setting_add(gsession, "window-title-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the window title"), NULL, NULL);
|
||||
bool_value = false;
|
||||
girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable syntex support"), NULL, NULL);
|
||||
|
||||
/* define default shortcuts */
|
||||
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);
|
||||
|
|
5
main.c
5
main.c
|
@ -40,6 +40,7 @@ main(int argc, char* argv[])
|
|||
gchar* synctex_editor = NULL;
|
||||
bool forkback = false;
|
||||
bool print_version = false;
|
||||
bool synctex = false;
|
||||
|
||||
#if (GTK_MAJOR_VERSION == 3)
|
||||
Window embed = 0;
|
||||
|
@ -56,6 +57,7 @@ main(int argc, char* argv[])
|
|||
{ "password", 'w', 0, G_OPTION_ARG_STRING, &password, _("Document password"), "password" },
|
||||
{ "debug", 'l', 0, G_OPTION_ARG_STRING, &loglevel, _("Log level (debug, info, warning, error)"), "level" },
|
||||
{ "version", 'v', 0, G_OPTION_ARG_NONE, &print_version, _("Print version information"), NULL },
|
||||
{ "synctex", 's', 0, G_OPTION_ARG_NONE, &synctex, _("Enable synctex support"), NULL },
|
||||
{ "synctex-editor-command", 'x', 0, G_OPTION_ARG_STRING, &synctex_editor, _("Synctex editor (forwarded to the synctex command)"), "cmd" },
|
||||
{ NULL, '\0', 0, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
@ -108,6 +110,9 @@ main(int argc, char* argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
/* Enable/Disable synctex support */
|
||||
zathura_set_syntex(zathura, synctex);
|
||||
|
||||
/* Print version */
|
||||
if (print_version == true) {
|
||||
char* string = zathura_get_version_string(zathura, false);
|
||||
|
|
|
@ -613,7 +613,10 @@ cb_zathura_page_widget_button_release_event(GtkWidget* widget, GdkEventButton* b
|
|||
} else {
|
||||
redraw_rect(ZATHURA_PAGE(widget), &priv->mouse.selection);
|
||||
|
||||
if (priv->zathura->synctex.enabled && button->state & GDK_CONTROL_MASK) {
|
||||
bool synctex = false;
|
||||
girara_setting_get(priv->zathura->ui.session, "synctex", &synctex);
|
||||
|
||||
if (synctex == true && button->state & GDK_CONTROL_MASK) {
|
||||
/* synctex backwards sync */
|
||||
double scale = zathura_document_get_scale(document);
|
||||
int x = button->x / scale, y = button->y / scale;
|
||||
|
|
|
@ -374,6 +374,15 @@ zathura_set_synctex_editor_command(zathura_t* zathura, const char* command)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
zathura_set_syntex(zathura_t* zathura, bool value)
|
||||
{
|
||||
g_return_if_fail(zathura != NULL);
|
||||
g_return_if_fail(zathura->ui.session != NULL);
|
||||
|
||||
girara_setting_set(zathura->ui.session, "synctex", &value);
|
||||
}
|
||||
|
||||
void
|
||||
zathura_set_argv(zathura_t* zathura, char** argv)
|
||||
{
|
||||
|
|
|
@ -191,6 +191,14 @@ void zathura_set_plugin_dir(zathura_t* zathura, const char* dir);
|
|||
*/
|
||||
void zathura_set_synctex_editor_command(zathura_t* zathura, const char* command);
|
||||
|
||||
/**
|
||||
* En/Disable zathuras syntex support
|
||||
*
|
||||
* @param zathura The zathura session
|
||||
* @param value The value
|
||||
*/
|
||||
void zathura_set_syntex(zathura_t* zathura, bool value);
|
||||
|
||||
/**
|
||||
* Sets the program parameters
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue