Example #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);
};
Example #2
0
/*
	The position of the currently selected info is decremented,
	i. e. the selected window is moved up towards the top of the screen
	If we are already at the top of the window list, we must move
	the text lines down! 
*/
void 
scroll_list_up(scroll_list *sl){
	if (sl->sel_win > 0)
		sel_win_up(sl);
	else {					// We want to scroll past the upper end of the window list
		if ( info_pos(sl, 0) > sl->first_pos){		// valid pos
			sl->first_shown_pos--;
			sl->range_set(sl->first_shown_pos, last_shown_pos(sl) );
			scroll_list_changed(sl);
		};
	};
};
Example #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;
	};
};