From 35658e2533b772ad861bdbe0ef18282251c0252e Mon Sep 17 00:00:00 2001 From: neldoreth Date: Sat, 26 Dec 2009 15:55:32 +0100 Subject: [PATCH] Added commands and function Added commands to zathura without any functionality and edited the current configuration --- config.def.h | 26 ++++++++++++-- zathura.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 118 insertions(+), 3 deletions(-) diff --git a/config.def.h b/config.def.h index 86e6a62..3f8a5f5 100644 --- a/config.def.h +++ b/config.def.h @@ -28,13 +28,28 @@ static const char notification_w_fgcolor[] = "#000000"; /* shortcuts */ Shortcut shortcuts[] = { /* 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_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_question, 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 */ @@ -54,7 +69,11 @@ InputbarShortcut inputbar_shortcuts[] = { Command commands[] = { /* command, abbreviation, function, completion, description */ {"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" }, + {"write", "w", cmd_save, 0, "Save the document" }, + {"zoom", "z", cmd_zoom, 0, "Set zoom level" }, }; /* buffer commands */ @@ -62,6 +81,9 @@ BufferCommand buffer_commands[] = { /* regex, function, argument */ {"^gg$", bcmd_goto, { TOP } }, {"^[0-9]+G$", bcmd_goto, {0} }, + {"^zI$", bcmd_zoom, { ZOOM_IN } }, + {"^zO$", bcmd_zoom, { ZOOM_OUT } }, + {"^z0$", bcmd_zoom, { ZOOM_ORIGINAL } }, }; /* special commands */ diff --git a/zathura.c b/zathura.c index 0d87a0e..76aaa69 100644 --- a/zathura.c +++ b/zathura.c @@ -14,7 +14,9 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, NORMAL, HIGHLIGHT, 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 */ struct @@ -152,8 +154,15 @@ GtkEventBox* createCompletionRow(GtkBox*, char*, char*, gboolean); /* shortcut declarations */ void sc_abort(Argument*); +void sc_adjust_window(Argument*); void sc_change_mode(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*); /* inputbar shortcut declarations */ @@ -163,13 +172,19 @@ void isc_completion(Argument*); void isc_string_manipulation(Argument*); /* command declarations */ +void cmd_open(int, char**); +void cmd_print(int, char**); +void cmd_rotate(int, char**); void cmd_quit(int, char**); +void cmd_save(int, char**); +void cmd_zoom(int, char**); /* completion commands */ Completion* cc_open(char*); /* buffer command declarations */ void bcmd_goto(char*, Argument*); +void bcmd_zoom(char*, Argument*); /* special command delcarations */ void scmd_search(char*, Argument*); @@ -439,6 +454,12 @@ sc_abort(Argument* argument) change_mode(NORMAL); } +void +sc_adjust_window(Argument* argument) +{ + +} + void 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 sc_quit(Argument* argument) { @@ -781,12 +838,42 @@ isc_string_manipulation(Argument* argument) } /* command implementation */ +void +cmd_open(int argc, char** argv) +{ + +} + +void +cmd_print(int argc, char** argv) +{ + +} + +void +cmd_rotate(int argc, char** argv) +{ + +} + void cmd_quit(int argc, char** argv) { cb_destroy(NULL, NULL); } +void +cmd_save(int argc, char** argv) +{ + +} + +void +cmd_zoom(int argc, char** argv) +{ + +} + /* completion command implementation */ 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 */ void scmd_search(char* input, Argument* argument)