mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-07 14:15:59 +01:00
Allow configurable modes
This commit is contained in:
parent
babaeacbf8
commit
8847f34afe
2 changed files with 41 additions and 32 deletions
27
config.def.h
27
config.def.h
|
@ -63,6 +63,23 @@ int adjust_open = ADJUST_BESTFIT;
|
|||
#define SELECTION_STYLE POPPLER_SELECTION_GLYPH
|
||||
#define GOTO_MODE GOTO_LABELS /* GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET */
|
||||
|
||||
/* define additional modes */
|
||||
#define INSERT (1 << 4)
|
||||
#define VISUAL (1 << 5)
|
||||
#define EMACS_CX (1 << 6)
|
||||
|
||||
/* mode names */
|
||||
ModeName mode_names[] = {
|
||||
/* default mode names */
|
||||
{"all", ALL, ""},
|
||||
{"fullscreen", FULLSCREEN, ""},
|
||||
{"index", INDEX, ""},
|
||||
{"normal", NORMAL, ""},
|
||||
/* additional mode names */
|
||||
{"insert", INSERT, "-- INSERT --"},
|
||||
{"visual", VISUAL, "-- VISUAL --"}
|
||||
};
|
||||
|
||||
/* shortcuts */
|
||||
Shortcut shortcuts[] = {
|
||||
/* mask, key, function, mode, argument */
|
||||
|
@ -289,16 +306,6 @@ ArgumentName argument_names[] = {
|
|||
{"width", ADJUST_WIDTH},
|
||||
};
|
||||
|
||||
/* mode names */
|
||||
ModeName mode_names[] = {
|
||||
{"all", ALL},
|
||||
{"fullscreen", FULLSCREEN},
|
||||
{"index", INDEX},
|
||||
{"insert", INSERT},
|
||||
{"normal", NORMAL},
|
||||
{"visual", VISUAL},
|
||||
};
|
||||
|
||||
/* special keys */
|
||||
GDKKey gdk_keys[] = {
|
||||
{"<BackSpace>", GDK_BackSpace},
|
||||
|
|
46
zathura.c
46
zathura.c
|
@ -33,9 +33,7 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
|||
#define ALL (1 << 0)
|
||||
#define FULLSCREEN (1 << 1)
|
||||
#define INDEX (1 << 2)
|
||||
#define INSERT (1 << 3)
|
||||
#define NORMAL (1 << 4)
|
||||
#define VISUAL (1 << 5)
|
||||
#define NORMAL (1 << 3)
|
||||
|
||||
/* typedefs */
|
||||
struct CElement
|
||||
|
@ -94,7 +92,8 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
char* name;
|
||||
int mode;
|
||||
int mode;
|
||||
char* display;
|
||||
} ModeName;
|
||||
|
||||
typedef struct
|
||||
|
@ -895,26 +894,29 @@ draw(int page_id)
|
|||
void
|
||||
change_mode(int mode)
|
||||
{
|
||||
char* mode_text;
|
||||
char* mode_text = 0;
|
||||
for(unsigned int i = 0; i != LENGTH(mode_names); ++i)
|
||||
if(mode_names[i].mode == mode)
|
||||
{
|
||||
mode_text = mode_names[i].display;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(mode)
|
||||
if(!mode_text)
|
||||
{
|
||||
case INSERT:
|
||||
mode_text = "-- INSERT --";
|
||||
break;
|
||||
case VISUAL:
|
||||
mode_text = "-- VISUAL --";
|
||||
break;
|
||||
case ADD_MARKER:
|
||||
mode_text = "";
|
||||
break;
|
||||
case EVAL_MARKER:
|
||||
mode_text = "";
|
||||
break;
|
||||
default:
|
||||
mode_text = "";
|
||||
mode = NORMAL;
|
||||
break;
|
||||
switch(mode)
|
||||
{
|
||||
case ADD_MARKER:
|
||||
mode_text = "";
|
||||
break;
|
||||
case EVAL_MARKER:
|
||||
mode_text = "";
|
||||
break;
|
||||
default:
|
||||
mode_text = "";
|
||||
mode = NORMAL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Zathura.Global.mode = mode;
|
||||
|
|
Loading…
Reference in a new issue