예제 #1
0
/* Set a specific window as the selected one */
static void 
select(scroll_list *sl, int sel){
	while ( sl->sel_win < sel)
		sel_win_down(sl);
		
	while ( sl->sel_win > sel)
		sel_win_up(sl);
};
예제 #2
0
/*
	The position of the currently selected info is incremented,
	i. e. the selected window is moved down towards the bottom of the screen
	If we are already at the bottom of the window list, we must move
	the text lines up! 
*/
void
scroll_list_down(scroll_list *sl){
	if (sl->sel_win < (sl->num_windows - 1)) {
		
		// here we must check if we have reached the absolute end of the infos
		if ( (sl->last_pos < 0) || (scroll_list_selected(sl) < sl->last_pos) )
			sel_win_down(sl);

	} else {					// We want to scroll past the lower end of the window list
		// here we must check if we have reached the absolute end of the infos
		if ( (sl->last_pos < 0) || (scroll_list_selected(sl) < sl->last_pos) ){
			sl->first_shown_pos++;
			sl->range_set(sl->first_shown_pos, last_shown_pos(sl) );
			scroll_list_changed(sl);
		}
	};	
};
예제 #3
0
static void 
keypress(Screen *this_screen, int cur_key, UserReq *req){
	switch (cur_key) {
		case KEY_OK:
			user_wants_add(info_idx(&result_list, result_list.sel_win) );
			switch_screen(SEARCH_SCREEN, TRACKLIST_SCREEN);
			break;
			
		case KEY_Pplus:	
		case KEY_Up:
			if (result_list.sel_win > 0)
				sel_win_up(&result_list);
			else {					// We want to scroll past the upper end of the window list
				if ( info_idx(&result_list, 0)  > 0){		// We have information to show
					result_list.first_info_idx = resultlist_range_set(result_list.first_info_idx-1, last_info_idx(&result_list)-1 );
					view_resultnames_changed();
				};
			};	
			break;
			
		case KEY_Pminus:	
		case KEY_Down:
			if (result_list.sel_win < (result_list.num_windows - 1)) {
				// We need only move our selected window one position down
				// But we check if we have already reached the last info pos
				if ( (mpd_resultlist_last() == -1) || (info_idx(&result_list, result_list.sel_win) < mpd_resultlist_last()) )
						sel_win_down(&result_list);

			} else {					// We want to scroll past the lower end of the window list
				result_list.first_info_idx = resultlist_range_set(result_list.first_info_idx+1, last_info_idx(&result_list)+1 );
				view_resultnames_changed();
			};
			break;
									
		case KEY_Left:	
			win_cursor_input(CURSOR_LEFT);
			break;
			
		case KEY_Right:
			win_cursor_input(CURSOR_RIGHT);
			break;
			
		case KEY_Minus:
			win_cursor_input(CURSOR_BACKSPACE);
			break;
			
		case KEY_0:
			win_cursor_input(0);	
			break;
					
		case KEY_1:
			win_cursor_input(1);	
			break;
			
		case KEY_2:
			win_cursor_input(2);	
			break;
			
		case KEY_3:
			win_cursor_input(3);	
			break;
			
		case KEY_4:
			win_cursor_input(4);	
			break;
			
		case KEY_5:
			win_cursor_input(5);	
			break;
			
		case KEY_6:
			win_cursor_input(6);	
			break;				
					
		case KEY_7:
			win_cursor_input(7);	
			break;
			
		case KEY_8:
			win_cursor_input(8);	
			break;
			
		case KEY_9:
			win_cursor_input(9);	
			break;
				
		default:
			break;
	};
};