2014-11-14 13:19:46 (UTC-02:00)
Marcel Rodrigues <marcelgmr@gmail.com>
Add message helper.
diff --git a/rover.c b/rover.c index f16e739..3fbd42d 100644 --- a/rover.c +++ b/rover.c @@ -29,6 +29,8 @@ static char *ARGS[MAXARGS]; typedef enum {DEFAULT, RED, GREEN, YELLOW, BLUE, CYAN, MAGENTA, WHITE} color_t; +#define STATUSPOS COLS - 16 + /* Height of listing view. */ #define HEIGHT (LINES-4) @@ -37,6 +39,7 @@ typedef enum {DEFAULT, RED, GREEN, YELLOW, BLUE, CYAN, MAGENTA, WHITE} color_t; #define SHOW_DIRS 0x02u #define SHOW_HIDDEN 0x04u +/* Marks parameters. */ #define BULK_INIT 5 #define BULK_THRESH 256 @@ -290,7 +293,7 @@ update() sprintf(ROW, "%d/%d", FSEL + 1, rover.nfiles); sprintf(STATUS+3, "%*s", 12, ROW); color_set(RVC_STATUS, NULL); - mvaddstr(LINES - 1, COLS - 16, STATUS); + mvaddstr(LINES - 1, STATUSPOS, STATUS); color_set(DEFAULT, NULL); refresh(); } @@ -554,6 +557,22 @@ igetstr(char *buffer, int maxlen) return 1; } +static void +message(const char *msg, color_t color) +{ + int len, pos; + + len = strlen(msg); + pos = (STATUSPOS - len) >> 1; + attr_on(A_BOLD, NULL); + color_set(color, NULL); + mvaddstr(LINES - 1, pos, msg); + color_set(DEFAULT, NULL); + attr_off(A_BOLD, NULL); + getch(); + mvhline(LINES - 1, pos, ' ', len); +} + int main(int argc, char *argv[]) {