Added commands and function

Added commands to zathura without any functionality
and edited the current configuration
This commit is contained in:
Moritz Lipp 2009-12-26 15:55:32 +01:00
parent 4b15dbc003
commit f3925c266c
2 changed files with 118 additions and 3 deletions

View File

@ -28,13 +28,28 @@ static const char notification_w_fgcolor[] = "#000000";
/* shortcuts */ /* shortcuts */
Shortcut shortcuts[] = { Shortcut shortcuts[] = {
/* mask, key, function, mode, argument */ /* mask, key, function, mode, argument */
{0, GDK_Escape, sc_abort, -1, {0} },
{GDK_CONTROL_MASK, GDK_c, sc_abort, -1, {0} },
{GDK_CONTROL_MASK, GDK_i, sc_adjust_window, -1, { ADJUST_BESTFIT } },
{GDK_CONTROL_MASK, GDK_u, sc_adjust_window, -1, { ADJUST_WIDTH } },
{0, GDK_i, sc_change_mode, NORMAL, { INSERT } }, {0, GDK_i, sc_change_mode, NORMAL, { INSERT } },
{0, GDK_v, sc_change_mode, NORMAL, { VISUAL } }, {0, GDK_v, sc_change_mode, NORMAL, { VISUAL } },
{GDK_CONTROL_MASK, GDK_q, sc_quit, -1, {0} },
{GDK_SHIFT_MASK, GDK_slash, sc_focus_inputbar, -1, { .data = "/" } }, {GDK_SHIFT_MASK, GDK_slash, sc_focus_inputbar, -1, { .data = "/" } },
{GDK_SHIFT_MASK, GDK_question, sc_focus_inputbar, -1, { .data = "?" } }, {GDK_SHIFT_MASK, GDK_question, sc_focus_inputbar, -1, { .data = "?" } },
{0, GDK_colon, sc_focus_inputbar, -1, { .data = ":" } }, {0, GDK_colon, sc_focus_inputbar, -1, { .data = ":" } },
{0, GDK_Escape, sc_abort, -1, {0} }, {0, GDK_o, sc_focus_inputbar, -1, { .data = ":open" } },
{GDK_SHIFT_MASK, GDK_j, sc_navigate, -1, { NEXT } },
{GDK_SHIFT_MASK, GDK_k, sc_navigate, -1, { PREVIOUS } },
{0, GDK_r, sc_rotate, -1, {0} },
{0, GDK_h, sc_scroll, -1, { LEFT } },
{0, GDK_j, sc_scroll, -1, { UP } },
{0, GDK_k, sc_scroll, -1, { DOWN } },
{0, GDK_l, sc_scroll, -1, { RIGHT } },
{0, GDK_n, sc_search, -1, { FORWARD } },
{0, GDK_N, sc_search, -1, { BACKWARD } },
{GDK_CONTROL_MASK, GDK_n, sc_toggle_statusbar, -1, {0} },
{GDK_CONTROL_MASK, GDK_m, sc_toggle_inputbar, -1, {0} },
{GDK_CONTROL_MASK, GDK_q, sc_quit, -1, {0} },
}; };
/* inputbar shortcuts */ /* inputbar shortcuts */
@ -54,7 +69,11 @@ InputbarShortcut inputbar_shortcuts[] = {
Command commands[] = { Command commands[] = {
/* command, abbreviation, function, completion, description */ /* command, abbreviation, function, completion, description */
{"open", "o", cmd_quit, cc_open, "Open a file" }, {"open", "o", cmd_quit, cc_open, "Open a file" },
{"print", "p", cmd_print, 0, "Print the document" },
{"rotate", "r", cmd_rotate, 0, "Rotate the page" },
{"quit", "q", cmd_quit, 0, "Quit zjui" }, {"quit", "q", cmd_quit, 0, "Quit zjui" },
{"write", "w", cmd_save, 0, "Save the document" },
{"zoom", "z", cmd_zoom, 0, "Set zoom level" },
}; };
/* buffer commands */ /* buffer commands */
@ -62,6 +81,9 @@ BufferCommand buffer_commands[] = {
/* regex, function, argument */ /* regex, function, argument */
{"^gg$", bcmd_goto, { TOP } }, {"^gg$", bcmd_goto, { TOP } },
{"^[0-9]+G$", bcmd_goto, {0} }, {"^[0-9]+G$", bcmd_goto, {0} },
{"^zI$", bcmd_zoom, { ZOOM_IN } },
{"^zO$", bcmd_zoom, { ZOOM_OUT } },
{"^z0$", bcmd_zoom, { ZOOM_ORIGINAL } },
}; };
/* special commands */ /* special commands */

View File

@ -14,7 +14,9 @@
enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN,
BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT, BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT,
INSERT, VISUAL, DELETE_LAST_WORD, DEFAULT, INSERT, VISUAL, DELETE_LAST_WORD, DEFAULT,
ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP }; ERROR, WARNING, NEXT_GROUP, PREVIOUS_GROUP,
ZOOM_IN, ZOOM_OUT, ZOOM_ORIGINAL, FORWARD,
BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH };
/* zathura */ /* zathura */
struct struct
@ -152,8 +154,15 @@ GtkEventBox* createCompletionRow(GtkBox*, char*, char*, gboolean);
/* shortcut declarations */ /* shortcut declarations */
void sc_abort(Argument*); void sc_abort(Argument*);
void sc_adjust_window(Argument*);
void sc_change_mode(Argument*); void sc_change_mode(Argument*);
void sc_focus_inputbar(Argument*); void sc_focus_inputbar(Argument*);
void sc_navigate(Argument*);
void sc_rotate(Argument*);
void sc_scroll(Argument*);
void sc_search(Argument*);
void sc_toggle_inputbar(Argument*);
void sc_toggle_statusbar(Argument*);
void sc_quit(Argument*); void sc_quit(Argument*);
/* inputbar shortcut declarations */ /* inputbar shortcut declarations */
@ -163,13 +172,19 @@ void isc_completion(Argument*);
void isc_string_manipulation(Argument*); void isc_string_manipulation(Argument*);
/* command declarations */ /* command declarations */
void cmd_open(int, char**);
void cmd_print(int, char**);
void cmd_rotate(int, char**);
void cmd_quit(int, char**); void cmd_quit(int, char**);
void cmd_save(int, char**);
void cmd_zoom(int, char**);
/* completion commands */ /* completion commands */
Completion* cc_open(char*); Completion* cc_open(char*);
/* buffer command declarations */ /* buffer command declarations */
void bcmd_goto(char*, Argument*); void bcmd_goto(char*, Argument*);
void bcmd_zoom(char*, Argument*);
/* special command delcarations */ /* special command delcarations */
void scmd_search(char*, Argument*); void scmd_search(char*, Argument*);
@ -439,6 +454,12 @@ sc_abort(Argument* argument)
change_mode(NORMAL); change_mode(NORMAL);
} }
void
sc_adjust_window(Argument* argument)
{
}
void void
sc_change_mode(Argument* argument) sc_change_mode(Argument* argument)
{ {
@ -457,6 +478,42 @@ sc_focus_inputbar(Argument* argument)
} }
} }
void
sc_navigate(Argument* argument)
{
}
void
sc_rotate(Argument* argument)
{
}
void
sc_scroll(Argument* argument)
{
}
void
sc_search(Argument* argument)
{
}
void
sc_toggle_inputbar(Argument* argument)
{
}
void
sc_toggle_statusbar(Argument* argument)
{
}
void void
sc_quit(Argument* argument) sc_quit(Argument* argument)
{ {
@ -781,12 +838,42 @@ isc_string_manipulation(Argument* argument)
} }
/* command implementation */ /* command implementation */
void
cmd_open(int argc, char** argv)
{
}
void
cmd_print(int argc, char** argv)
{
}
void
cmd_rotate(int argc, char** argv)
{
}
void void
cmd_quit(int argc, char** argv) cmd_quit(int argc, char** argv)
{ {
cb_destroy(NULL, NULL); cb_destroy(NULL, NULL);
} }
void
cmd_save(int argc, char** argv)
{
}
void
cmd_zoom(int argc, char** argv)
{
}
/* completion command implementation */ /* completion command implementation */
Completion* cc_open(char* input) Completion* cc_open(char* input)
{ {
@ -840,6 +927,12 @@ bcmd_goto(char* buffer, Argument* argument)
} }
void
bcmd_zoom(char* buffer, Argument* argument)
{
}
/* special command implementation */ /* special command implementation */
void void
scmd_search(char* input, Argument* argument) scmd_search(char* input, Argument* argument)