aboutsummaryrefslogtreecommitdiffstats
path: root/screen_utils.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-03-24 15:17:52 +0000
committerKalle Wallin <kaw@linux.se>2004-03-24 15:17:52 +0000
commitb30908800a6594524171afb1eed22413f3e85bba (patch)
treef36ded987c0795c2246361d5333a5194bad0349b /screen_utils.c
parentecaa2131695342d84a3cc3b472032a7805e34a8b (diff)
downloadmpd-b30908800a6594524171afb1eed22413f3e85bba.tar.gz
mpd-b30908800a6594524171afb1eed22413f3e85bba.tar.xz
mpd-b30908800a6594524171afb1eed22413f3e85bba.zip
Moved list window fuctions to list_window.c.
Added function list_window_cmd() for basic commands (movment). git-svn-id: https://svn.musicpd.org/ncmpc/trunk@454 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'screen_utils.c')
-rw-r--r--screen_utils.c159
1 files changed, 0 insertions, 159 deletions
diff --git a/screen_utils.c b/screen_utils.c
index 8de23e16c..49bd6692a 100644
--- a/screen_utils.c
+++ b/screen_utils.c
@@ -10,165 +10,6 @@
#include "command.h"
#include "screen.h"
-list_window_t *
-list_window_init(WINDOW *w, int width, int height)
-{
- list_window_t *lw;
-
- lw = malloc(sizeof(list_window_t));
- memset(lw, 0, sizeof(list_window_t));
- lw->w = w;
- lw->cols = width;
- lw->rows = height;
- lw->clear = 1;
- return lw;
-}
-
-list_window_t *
-list_window_free(list_window_t *lw)
-{
- if( lw )
- {
- memset(lw, 0, sizeof(list_window_t));
- free(lw);
- }
- return NULL;
-}
-
-void
-list_window_reset(list_window_t *lw)
-{
- lw->selected = 0;
- lw->start = 0;
- lw->clear = 1;
-}
-
-void
-list_window_set_selected(list_window_t *lw, int n)
-{
- lw->selected=n;
-}
-
-void
-list_window_paint(list_window_t *lw,
- list_window_callback_fn_t callback,
- void *callback_data)
-{
- int i;
-
- while( lw->selected < lw->start )
- {
- lw->start--;
- lw->clear=1;
- }
- while( lw->selected >= lw->start+lw->rows )
- {
- lw->start++;
- lw->clear=1;
- }
- if( lw->clear )
- {
- wclear(lw->w);
- lw->clear=0;
- }
-
- for(i=0; i<lw->rows; i++)
- {
- int highlight;
- char *label;
-
- label = (callback) (lw->start+i, &highlight, callback_data);
- if( label )
- {
- wmove(lw->w, i, 0);
- if( highlight )
- wattron(lw->w, A_BOLD);
- if( lw->start+i == lw->selected )
- wattron(lw->w, A_REVERSE);
-
- waddnstr(lw->w, label, lw->cols);
-
- if( highlight )
- wattroff(lw->w, A_BOLD);
- if( lw->start+i == lw->selected )
- wattroff(lw->w, A_REVERSE);
- }
- }
-}
-
-void
-list_window_next(list_window_t *lw, int length)
-{
- if( lw->selected < length-1 )
- lw->selected++;
-}
-
-void
-list_window_previous(list_window_t *lw)
-{
- if( lw->selected > 0 )
- lw->selected--;
-}
-
-void
-list_window_first(list_window_t *lw)
-{
- lw->selected = 0;
-}
-
-void
-list_window_last(list_window_t *lw, int length)
-{
- lw->selected = length-1;
-}
-
-void
-list_window_next_page(list_window_t *lw, int length)
-{
- int step = lw->rows-1;
- if( step<= 0 )
- return;
- if( lw->selected+step < length-1 )
- lw->selected+=step;
- else
- return list_window_last(lw,length);
-}
-
-void
-list_window_previous_page(list_window_t *lw)
-{
- int step = lw->rows-1;
- if( step<= 0 )
- return;
- if( lw->selected-step > 0 )
- lw->selected-=step;
- else
- list_window_first(lw);
-}
-
-int
-list_window_find(list_window_t *lw,
- list_window_callback_fn_t callback,
- void *callback_data,
- char *str)
-{
- int h;
- int i = lw->selected+1;
- char *label;
-
- while( (label=(callback) (i,&h,callback_data)) )
- {
- if( str && label && strcasestr(label, str) )
- {
- lw->selected = i;
- return 0;
- }
- i++;
- }
- return 1;
-}
-
-
char *
screen_readln(WINDOW *w, char *prompt)
{