ATTRIBUTE_HEADER -> ATTRIBUTE_NORMAL

This commit is contained in:
Přemysl Eric Janouch 2017-01-29 17:55:50 +01:00
parent 993fe3f2d6
commit d95eb500f7
Signed by: p
GPG Key ID: B715679E3A361BE6
2 changed files with 25 additions and 25 deletions

View File

@ -63,7 +63,7 @@ settings = {
root = "~/Music" root = "~/Music"
} }
colors = { colors = {
header = "" normal = ""
highlight = "bold" highlight = "bold"
elapsed = "reverse" elapsed = "reverse"
remains = "ul" remains = "ul"

View File

@ -23,7 +23,7 @@
// We "need" to have an enum for attributes before including liberty. // We "need" to have an enum for attributes before including liberty.
// Avoiding colours in the defaults here in order to support dumb terminals. // Avoiding colours in the defaults here in order to support dumb terminals.
#define ATTRIBUTE_TABLE(XX) \ #define ATTRIBUTE_TABLE(XX) \
XX( HEADER, "header", -1, -1, 0 ) \ XX( NORMAL, "normal", -1, -1, 0 ) \
XX( HIGHLIGHT, "highlight", -1, -1, A_BOLD ) \ XX( HIGHLIGHT, "highlight", -1, -1, A_BOLD ) \
/* Gauge */ \ /* Gauge */ \
XX( ELAPSED, "elapsed", -1, -1, A_REVERSE ) \ XX( ELAPSED, "elapsed", -1, -1, A_REVERSE ) \
@ -943,7 +943,7 @@ app_draw_song_info (void)
if (!(map = item_list_get (&g.playlist, g.song))) if (!(map = item_list_get (&g.playlist, g.song)))
return; return;
chtype attr_header = APP_ATTR (HEADER); chtype attr_normal = APP_ATTR (NORMAL);
chtype attr_highlight = APP_ATTR (HIGHLIGHT); chtype attr_highlight = APP_ATTR (HIGHLIGHT);
char *title; char *title;
@ -954,7 +954,7 @@ app_draw_song_info (void)
struct row_buffer buf; struct row_buffer buf;
row_buffer_init (&buf); row_buffer_init (&buf);
row_buffer_append (&buf, title, attr_highlight); row_buffer_append (&buf, title, attr_highlight);
app_flush_header (&buf, attr_highlight); app_flush_header (&buf, attr_normal);
} }
char *artist = compact_map_find (map, "artist"); char *artist = compact_map_find (map, "artist");
@ -966,12 +966,12 @@ app_draw_song_info (void)
row_buffer_init (&buf); row_buffer_init (&buf);
if (artist) if (artist)
row_buffer_append_args (&buf, " by " + !buf.total_width, attr_header, row_buffer_append_args (&buf, " by " + !buf.total_width, attr_normal,
artist, attr_highlight, NULL); artist, attr_highlight, NULL);
if (album) if (album)
row_buffer_append_args (&buf, " from " + !buf.total_width, attr_header, row_buffer_append_args (&buf, " from " + !buf.total_width, attr_normal,
album, attr_highlight, NULL); album, attr_highlight, NULL);
app_flush_header (&buf, attr_header); app_flush_header (&buf, attr_normal);
} }
static char * static char *
@ -1033,39 +1033,39 @@ app_draw_status (void)
if (g.state != PLAYER_STOPPED) if (g.state != PLAYER_STOPPED)
app_draw_song_info (); app_draw_song_info ();
chtype attr_header = APP_ATTR (HEADER); chtype attr_normal = APP_ATTR (NORMAL);
chtype attr_highlight = APP_ATTR (HIGHLIGHT); chtype attr_highlight = APP_ATTR (HIGHLIGHT);
struct row_buffer buf; struct row_buffer buf;
row_buffer_init (&buf); row_buffer_init (&buf);
bool stopped = g.state == PLAYER_STOPPED; bool stopped = g.state == PLAYER_STOPPED;
chtype attr_song_action = stopped ? attr_header : attr_highlight; chtype attr_song_action = stopped ? attr_normal : attr_highlight;
const char *toggle = g.state == PLAYER_PLAYING ? "||" : "|>"; const char *toggle = g.state == PLAYER_PLAYING ? "||" : "|>";
row_buffer_append_args (&buf, row_buffer_append_args (&buf,
"<<", attr_song_action, " ", attr_header, "<<", attr_song_action, " ", attr_normal,
toggle, attr_highlight, " ", attr_header, toggle, attr_highlight, " ", attr_normal,
"[]", attr_song_action, " ", attr_header, "[]", attr_song_action, " ", attr_normal,
">>", attr_song_action, " ", attr_header, ">>", attr_song_action, " ", attr_normal,
NULL); NULL);
if (stopped) if (stopped)
row_buffer_append (&buf, "Stopped", attr_header); row_buffer_append (&buf, "Stopped", attr_normal);
else else
{ {
if (g.song_elapsed >= 0) if (g.song_elapsed >= 0)
{ {
app_write_time (&buf, g.song_elapsed, attr_header); app_write_time (&buf, g.song_elapsed, attr_normal);
row_buffer_append (&buf, " ", attr_header); row_buffer_append (&buf, " ", attr_normal);
} }
if (g.song_duration >= 1) if (g.song_duration >= 1)
{ {
row_buffer_append (&buf, "/ ", attr_header); row_buffer_append (&buf, "/ ", attr_normal);
app_write_time (&buf, g.song_duration, attr_header); app_write_time (&buf, g.song_duration, attr_normal);
row_buffer_append (&buf, " ", attr_header); row_buffer_append (&buf, " ", attr_normal);
} }
row_buffer_append (&buf, " ", attr_header); row_buffer_append (&buf, " ", attr_normal);
} }
// It gets a bit complicated due to the only right-aligned item on the row // It gets a bit complicated due to the only right-aligned item on the row
@ -1086,15 +1086,15 @@ app_draw_status (void)
(float) g.song_elapsed / g.song_duration, remaining); (float) g.song_elapsed / g.song_duration, remaining);
} }
else else
row_buffer_space (&buf, remaining, attr_header); row_buffer_space (&buf, remaining, attr_normal);
if (volume) if (volume)
{ {
row_buffer_append (&buf, volume, attr_header); row_buffer_append (&buf, volume, attr_normal);
free (volume); free (volume);
} }
g.controls_offset = g.header_height; g.controls_offset = g.header_height;
app_flush_header (&buf, attr_header); app_flush_header (&buf, attr_normal);
} }
static void static void
@ -1114,11 +1114,11 @@ app_draw_header (void)
break; break;
case MPD_CONNECTING: case MPD_CONNECTING:
move (g.header_height++, 0); move (g.header_height++, 0);
app_write_line ("Connecting to MPD...", APP_ATTR (HEADER)); app_write_line ("Connecting to MPD...", APP_ATTR (NORMAL));
break; break;
case MPD_DISCONNECTED: case MPD_DISCONNECTED:
move (g.header_height++, 0); move (g.header_height++, 0);
app_write_line ("Disconnected", APP_ATTR (HEADER)); app_write_line ("Disconnected", APP_ATTR (NORMAL));
} }
chtype attrs[2] = { APP_ATTR (TAB_BAR), APP_ATTR (TAB_ACTIVE) }; chtype attrs[2] = { APP_ATTR (TAB_BAR), APP_ATTR (TAB_ACTIVE) };