Set adjust_open and map zoom command

This commit is contained in:
Moritz Lipp 2010-06-18 11:03:11 +02:00
parent 52f747a9c1
commit 5677083579
2 changed files with 31 additions and 5 deletions

View file

@ -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},

View file

@ -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*);
@ -537,6 +538,7 @@ void
init_settings()
{
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')
{