From 5677083579c964cd59a438d0198741acb35668e7 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Fri, 18 Jun 2010 11:03:11 +0200 Subject: [PATCH] Set adjust_open and map zoom command --- config.def.h | 7 ++++++- zathura.c | 29 +++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h index d75b16e..82ed8b3 100644 --- a/config.def.h +++ b/config.def.h @@ -56,7 +56,7 @@ char* uri_command = "firefox '%s'"; /* uri */ /* additional settings */ gboolean show_scrollbars = FALSE; -#define ADJUST_OPEN ADJUST_BESTFIT +int adjust_open = ADJUST_BESTFIT; #define SELECTION_STYLE POPPLER_SELECTION_GLYPH #define GOTO_MODE GOTO_LABELS /* GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET */ @@ -185,6 +185,7 @@ SpecialCommand special_commands[] = { /* settings */ Setting settings[] = { /* name, variable, type, render, re-init, description */ + {"adjust_open", &(adjust_open), 'i', FALSE, FALSE, "Command to open URIs"}, {"browser", &(uri_command), 's', FALSE, FALSE, "Command to open URIs"}, {"completion_bgcolor", &(completion_bgcolor), 's', FALSE, TRUE, "Completion background color"}, {"completion_fgcolor", &(completion_fgcolor), 's', FALSE, TRUE, "Completion foreground color"}, @@ -244,6 +245,7 @@ ShortcutName shortcut_names[] = { {"toggle_index", sc_toggle_index}, {"toggle_inputbar", sc_toggle_inputbar}, {"toggle_statusbar", sc_toggle_statusbar}, + {"zoom", sc_zoom}, }; /* argument names */ @@ -261,9 +263,12 @@ ArgumentName argument_names[] = { {"full_up", FULL_UP}, {"half_down", HALF_DOWN}, {"half_up", HALF_UP}, + {"in", ZOOM_IN}, {"insert", INSERT}, {"left", LEFT}, {"next", NEXT}, + {"original", ZOOM_ORIGINAL}, + {"out", ZOOM_OUT}, {"previous", PREVIOUS}, {"right", RIGHT}, {"select", SELECT}, diff --git a/zathura.c b/zathura.c index fac247e..40efce2 100644 --- a/zathura.c +++ b/zathura.c @@ -365,6 +365,7 @@ void sc_toggle_inputbar(Argument*); void sc_toggle_fullscreen(Argument*); void sc_toggle_statusbar(Argument*); void sc_quit(Argument*); +void sc_zoom(Argument*); /* inputbar shortcut declarations */ void isc_abort(Argument*); @@ -536,7 +537,8 @@ init_keylist() void init_settings() { - Zathura.State.filename = (char*) default_text; + Zathura.State.filename = (char*) default_text; + Zathura.Global.adjust_mode = adjust_open; gtk_window_set_default_size(GTK_WINDOW(Zathura.UI.window), default_width, default_height); } @@ -555,7 +557,6 @@ init_zathura() Zathura.Global.mode = NORMAL; Zathura.Global.viewing_mode = NORMAL; Zathura.Global.recolor = 0; - Zathura.Global.adjust_mode = ADJUST_OPEN; Zathura.Global.goto_mode = GOTO_MODE; Zathura.Global.show_index = FALSE; @@ -2137,6 +2138,12 @@ sc_quit(Argument* argument) cb_destroy(NULL, NULL); } +void +sc_zoom(Argument* argument) +{ + bcmd_zoom(NULL, argument); +} + /* inputbar shortcut declarations */ void isc_abort(Argument* argument) @@ -3006,8 +3013,22 @@ cmd_set(int argc, char** argv) return FALSE; int *x = (int*) (settings[i].variable); - if(argv[1]) - *x = atoi(argv[1]); + + int id = -1; + int arg_c; + for(arg_c = 0; arg_c < LENGTH(argument_names); arg_c++) + { + if(!strcmp(argv[1], argument_names[arg_c].name)) + { + id = argument_names[arg_c].argument; + break; + } + } + + if(id == -1) + id = atoi(argv[1]); + + *x = id; } else if(settings[i].type == 'f') {