regedit: add a color scheme for path and context help sections
authorChris Davis <cd.rattan@gmail.com>
Thu, 22 May 2014 22:23:52 +0000 (15:23 -0700)
committerMichael Adam <obnox@samba.org>
Wed, 1 Oct 2014 12:32:08 +0000 (14:32 +0200)
Signed-off-by: Chris Davis <cd.rattan@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source3/utils/regedit.c

index 86983c2f08f06d77720adfea20eb4ec803ebf3cd..a69fa6b65fb0f439dc230a8ae45216f20a27c0ed 100644 (file)
@@ -50,6 +50,9 @@
 #define PATH_WIDTH     (COLS - 6)
 #define PATH_WIDTH_MAX 1024
 
+#define PAIR_YELLOW_CYAN 1
+#define PAIR_BLACK_CYAN 2
+
 struct regedit {
        WINDOW *main_window;
        WINDOW *path_label;
@@ -73,6 +76,8 @@ static void show_path(struct regedit *regedit)
        }
        copywin(regedit->path_label, regedit->main_window, 0, start_pad,
                PATH_START_Y, start_win, PATH_START_Y, PATH_MAX_Y, false);
+
+       mvchgat(0, 0, COLS, A_BOLD, PAIR_YELLOW_CYAN, NULL);
 }
 
 static void print_path(struct regedit *regedit, struct tree_node *node)
@@ -147,15 +152,16 @@ static void print_help(struct regedit *regedit)
 
        move(HELP1_START_Y, HELP1_START_X);
        clrtoeol();
-       attron(A_REVERSE);
+       attron(COLOR_PAIR(PAIR_BLACK_CYAN));
        mvaddstr(HELP1_START_Y, HELP1_START_X, help);
        pad = COLS - strlen(msg) - strlen(help);
        for (i = 0; i < pad; ++i) {
                addch(' ');
        }
-       attron(A_BOLD);
+       attroff(COLOR_PAIR(PAIR_BLACK_CYAN));
+       attron(COLOR_PAIR(PAIR_YELLOW_CYAN) | A_BOLD);
        addstr(msg);
-       attroff(A_REVERSE | A_BOLD);
+       attroff(COLOR_PAIR(PAIR_YELLOW_CYAN) | A_BOLD);
 
        move(HELP2_START_Y, HELP2_START_X);
        clrtoeol();
@@ -440,6 +446,8 @@ static void display_window(TALLOC_CTX *mem_ctx, struct registry_context *ctx)
                start_color();
                use_default_colors();
                assume_default_colors(COLOR_WHITE, COLOR_BLUE);
+               init_pair(PAIR_YELLOW_CYAN, COLOR_YELLOW, COLOR_CYAN);
+               init_pair(PAIR_BLACK_CYAN, COLOR_BLACK, COLOR_CYAN);
        }
 
        regedit = talloc_zero(mem_ctx, struct regedit);