summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 273d498)
raw | patch | inline | side by side (parent: 273d498)
author | Max Kellermann <max@duempel.org> | |
Sun, 11 Oct 2009 17:46:11 +0000 (19:46 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sun, 11 Oct 2009 17:46:11 +0000 (19:46 +0200) |
Not used anymore, because both screen_browser and screen_queue have a
row paint callback now.
row paint callback now.
diff --git a/src/list_window.c b/src/list_window.c
index d1a6ce3ff2ca9f4d18b9046921317dbeb641037c..23e478f2d43f0855a1560b2bd30300b6e6787464 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
}
static void
-list_window_paint_row(WINDOW *w, unsigned y, unsigned width,
- bool selected, bool highlight,
- const char *text, const char *second_column)
+list_window_paint_row(WINDOW *w, unsigned width, bool selected,
+ const char *text)
{
- unsigned second_column_width;
-
-#ifdef NCMPC_MINI
- second_column = NULL;
- highlight = false;
-#endif /* NCMPC_MINI */
-
- if (second_column != NULL) {
- second_column_width = utf8_width(second_column) + 1;
- if (second_column_width < width)
- width -= second_column_width;
- else
- second_column_width = 0;
- } else
- second_column_width = 0;
-
- row_color(w, highlight ? COLOR_LIST_BOLD : COLOR_LIST, selected);
-
- waddstr(w, text);
-
- /* erase the unused space after the text */
- row_clear_to_eol(w, width, selected);
-
- if (second_column_width > 0) {
- wmove(w, y, width);
- waddch(w, ' ');
- waddstr(w, second_column);
- }
+ row_paint_text(w, width, COLOR_LIST,
+ selected, text);
}
void
for (unsigned i = 0; i < lw->rows; i++) {
const char *label;
- bool highlight = false;
- char *second_column = NULL;
wmove(lw->w, i, 0);
break;
}
- label = callback(lw->start + i, &highlight, &second_column, callback_data);
+ label = callback(lw->start + i, callback_data);
assert(label != NULL);
-#ifdef NCMPC_MINI
- highlight = false;
- second_column = NULL;
-#endif /* NCMPC_MINI */
-
- list_window_paint_row(lw->w, i, lw->cols,
+ list_window_paint_row(lw->w, lw->cols,
show_cursor &&
lw->start + i >= range.start &&
lw->start + i < range.end,
- highlight,
- label, second_column);
-
- if (second_column != NULL)
- g_free(second_column);
+ label);
}
row_color_end(lw->w);
bool wrap,
bool bell_on_wrap)
{
- bool h;
unsigned i = lw->selected + 1;
const char *label;
do {
while (i < lw->length) {
- label = callback(i, &h, NULL, callback_data);
+ label = callback(i, callback_data);
assert(label != NULL);
if (match_line(label, str)) {
bool wrap,
bool bell_on_wrap)
{
- bool h;
int i = lw->selected - 1;
const char *label;
do {
while (i >= 0) {
- label = callback(i, &h, NULL, callback_data);
+ label = callback(i, callback_data);
assert(label != NULL);
if (match_line(label, str)) {
void *callback_data,
const char *str)
{
- bool h;
const char *label;
assert(str != NULL);
for (unsigned i = 0; i < lw->length; ++i) {
- label = callback(i, &h, NULL, callback_data);
+ label = callback(i, callback_data);
assert(label != NULL);
if (jump_match(label, str)) {
diff --git a/src/list_window.h b/src/list_window.h
index 8ffe40f9bd5ca0cf79d11b3a82c11b16e51f0744..cf938f8ce1a793a312bfbb7875d5af61217941a4 100644 (file)
--- a/src/list_window.h
+++ b/src/list_window.h
#include <ncurses.h>
#endif
-typedef const char *(*list_window_callback_fn_t)(unsigned index,
- bool *highlight,
- char **second_column,
- void *data);
+typedef const char *
+(*list_window_callback_fn_t)(unsigned i, void *data);
typedef void
(*list_window_paint_callback_t)(WINDOW *w, unsigned i,
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 847bed045286f3a73c3dc3d0d193ded91751a6f5..a12b26303c772a1e83bdb6dd434d8d3733dd4d0a 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
/* list_window callback */
static const char *
-screen_artist_lw_callback(unsigned idx, G_GNUC_UNUSED bool *highlight,
- G_GNUC_UNUSED char** sc, G_GNUC_UNUSED void *data)
+screen_artist_lw_callback(unsigned idx, void *data)
{
GPtrArray *list = data;
static char buf[BUFSIZE];
diff --git a/src/screen_browser.c b/src/screen_browser.c
index 6070e6902ee94dcfe7097c880803ec7e8dcf98fe..455053c60a5bcab4e294079642818a01faa74ca1 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
/* list_window callback */
static const char *
-browser_lw_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char **second_column, void *data)
+browser_lw_callback(unsigned idx, void *data)
{
const struct filelist *fl = (const struct filelist *) data;
static char buf[BUFSIZE];
assert(entry != NULL);
entity = entry->entity;
-#ifndef NCMPC_MINI
- *highlight = (entry->flags & HIGHLIGHT) != 0;
-#else
- *highlight = false;
-#endif
if( entity == NULL )
return "..";
diff --git a/src/screen_help.c b/src/screen_help.c
index 1a66b698fbf7915eeb9ed12a26271b9dd18776b4..a501aad045281cf818ab23c6e516c704879354aa 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
static struct list_window *lw;
static const char *
-list_callback(unsigned i,
- G_GNUC_UNUSED bool *highlight, G_GNUC_UNUSED char** second_column,
- G_GNUC_UNUSED void *data)
+list_callback(unsigned i, G_GNUC_UNUSED void *data)
{
const struct help_text_row *row = &help_text[i];
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index cea71b49d6462fdc53a744e80e277ce3f983a39b..36472bf521cb8d424f886326377144eaeac4d933 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
}
static const char *
-list_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char** sc, G_GNUC_UNUSED void *data)
+list_callback(unsigned idx, G_GNUC_UNUSED void *data)
{
static char buf[BUFSIZE];
@@ -202,8 +202,6 @@ list_callback(unsigned idx, bool *highlight, G_GNUC_UNUSED char** sc, G_GNUC_UNU
assert(idx < (unsigned)command_list_length);
- if (cmds[idx].flags & COMMAND_KEY_CONFLICT)
- *highlight = true;
return cmds[idx].name;
} else {
if (idx == 0)
diff --git a/src/screen_queue.c b/src/screen_queue.c
index b36ba66c8f87d686d6c4fad0bbe3b5064508304b..750abb01d451b784bb1256c532406748d1a9f5dd 100644 (file)
--- a/src/screen_queue.c
+++ b/src/screen_queue.c
struct mpdclient *c;
} completion_callback_data_t;
+/*
static struct hscroll hscroll;
static guint scroll_source_id;
+*/
#endif
static struct mpdclient_playlist *playlist;
screen_queue_save_selection();
}
+/*
#ifndef NCMPC_MINI
static gboolean
scroll_timer_callback(G_GNUC_UNUSED gpointer data)
return false;
}
#endif
+*/
static const char *
-screen_queue_lw_callback(unsigned idx, bool *highlight, char **second_column,
- G_GNUC_UNUSED void *data)
+screen_queue_lw_callback(unsigned idx, G_GNUC_UNUSED void *data)
{
static char songname[MAX_SONG_LENGTH];
struct mpd_song *song;
assert(idx < playlist_length(playlist));
song = playlist_get(playlist, idx);
- if ((int)mpd_song_get_id(song) == current_song_id)
- *highlight = true;
strfsong(songname, MAX_SONG_LENGTH, options.list_format, song);
+ /*
#ifndef NCMPC_MINI
- if (second_column != NULL && mpd_song_get_duration(song) > 0) {
- char duration[32];
- format_duration_short(duration, sizeof(duration),
- mpd_song_get_duration(song));
- *second_column = g_strdup(duration);
- }
-
if (idx == lw->selected)
{
- int second_column_len = 0;
- if (second_column != NULL && *second_column != NULL)
- second_column_len = strlen(*second_column);
- if (options.scroll && utf8_width(songname) > (unsigned)(COLS - second_column_len - 1) )
- {
+ if (options.scroll && utf8_width(songname) > (unsigned)COLS) {
static unsigned current_song;
char *tmp;
}
}
}
-#else
- (void)second_column;
#endif
+ */
return songname;
}
diff --git a/src/screen_search.c b/src/screen_search.c
index 7a8c01134582cf8a23044459ebc183699efd90b4..781dd0c24b1d7f5b075d367e9c5126ae03285512 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
/* search info */
static const char *
-lw_search_help_callback(unsigned idx, G_GNUC_UNUSED bool *highlight,
- G_GNUC_UNUSED char** sc, G_GNUC_UNUSED void *data)
+lw_search_help_callback(unsigned idx, G_GNUC_UNUSED void *data)
{
assert(idx < G_N_ELEMENTS(help_text));
diff --git a/src/screen_song.c b/src/screen_song.c
index 121599eb97f2dd85f9a93bef1a9761cba7a517fb..3696cd23957fe6ca30efa88a74b0fa25995078b2 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
}
static const char *
-screen_song_list_callback(unsigned idx, G_GNUC_UNUSED bool *highlight,
- G_GNUC_UNUSED char** sc, G_GNUC_UNUSED void *data)
+screen_song_list_callback(unsigned idx, G_GNUC_UNUSED void *data)
{
static char buffer[256];
char *value;
diff --git a/src/screen_text.c b/src/screen_text.c
index a80b56240b09ecc18c22d21ce7b6ebf32ba4b175..b7d66838fa6a6de260a10894857c59628c499f27 100644 (file)
--- a/src/screen_text.c
+++ b/src/screen_text.c
}
const char *
-screen_text_list_callback(unsigned idx, G_GNUC_UNUSED bool *highlight,
- G_GNUC_UNUSED char** sc, void *data)
+screen_text_list_callback(unsigned idx, void *data)
{
const struct screen_text *text = data;
static char buffer[256];
diff --git a/src/screen_text.h b/src/screen_text.h
index 5358feb82e9329f73c00e778d3596fe71f3ff63e..43ae3c66c9f5a3ff3a87303e612ff884bc78f8f7 100644 (file)
--- a/src/screen_text.h
+++ b/src/screen_text.h
screen_text_set(struct screen_text *text, const GString *str);
const char *
-screen_text_list_callback(unsigned idx, bool *highlight, char** sc, void *data);
+screen_text_list_callback(unsigned idx, void *data);
static inline void
screen_text_paint(struct screen_text *text)