Пример #1
0
int main(int argc, char** argv){
  setlocale(LC_ALL, "en_US.utf8");  
  initial_check();
  get_files_list();

  ESCDELAY = 1;
  menu_index = 0;
  previous_index = -1;
  
  initscr();
  noecho();
  keypad(stdscr, TRUE);
  getmaxyx(stdscr,rows,cols);
  diff_col_width = cols/2-1;
  start_color();
  use_default_colors();
  init_pair(1, COLOR_RED,     -1);
  init_pair(2, COLOR_GREEN,   -1);
  init_pair(3, COLOR_CYAN,    -1);
  refresh();

  print_files_menu();
  show_git_diff();

  ch = getch();  
  while(ch != 27 && ch != 'q'){
    switch(ch){
      case KEY_UP: 
        move_menu(-1);
        break;
      case KEY_DOWN: 
        move_menu(1);
        break;
      case 'h':
        show_help();
        break;
      case '?':
        show_help();
        break;
      case ' ':
        check_row();
        break;
      case 'a':
        check_all();
        break;
      case 'c':
        open_system_index_add_window();
        break;
    }
    ch = getch();  
  }
  
  endwin();
  git_threads_shutdown();
  return(EXIT_SUCCESS);
}
Пример #2
0
void menu_screen(lmLedMatrix *matrix, double elapsed) {
    if (encoder.value / ENCODER_EDGE > 1) {
        menu_next();
#ifdef DEBUG
        printf("next ->\n");
#endif
        encoder.value = 0;
    } else if (encoder.value / ENCODER_EDGE < -1) {
        menu_previous();
#ifdef DEBUG
        printf("previous ->\n");
#endif
        encoder.value = 0;
    }

    lm_matrix_clear(matrix);

    menu_t current = menus[current_menu];

    if (next_direction == NOTHING) {
        current_x = 0; // Nothing to do
    } else {
        menu_t next = menus[next_menu];

        move_menu(elapsed, next_direction);
        next.screen(matrix, (int16_t) round(next_x), 0, elapsed, next.user_data);
    }

    current.screen(matrix, (int16_t) round(current_x), 0, elapsed, current.user_data);

    lm_matrix_swap_buffers(matrix);
}
Пример #3
0
Файл: menu.c Проект: Cougar/pwm
static void vis_entry(WMenu *menu, int entry)
{
	int dx, dy;
	
	if(is_vis_entry(menu, entry, &dx, &dy))
		return;
	
	move_menu(topmenu(menu), dx, dy);
}
Пример #4
0
Файл: menu.c Проект: Cougar/pwm
static void scrollfunc()
{
	WMenu *menu=scrollmenu;
	int dx=scrollhoriz*SCROLL_AMOUNT;
	int dy=scrollvert*SCROLL_AMOUNT;
	Window win;
	
	if(menu->x+dx>0 && scrollhoriz==1)
		dx=-menu->x;
	else if(menu->x+menu->w+dx<SCREEN->width-SCROLL_BORDER && scrollhoriz==-1)
		dx=-(menu->x+menu->w-SCREEN->width+SCROLL_BORDER);

	if(menu->y+dy>0 && scrollvert==1)
		dy=-menu->y;
	else if(menu->y+menu->h+dy<SCREEN->height-SCROLL_BORDER && scrollvert==-1)
		dy=-(menu->y+menu->h-SCREEN->height+SCROLL_BORDER);

	move_menu(scrolltop, dx, dy);
	
	/* pointer root -> dx, dy */
	get_pointer_rootpos(&dx, &dy);

	if(menu_select_at(menu, dx, dy)){
		if(test_scroll(menu, dx, dy))
			return;
	}else if(test_scroll(menu, dx, dy)){
		return;
	}else{
		if(!find_window_at(dx, dy, &win))
			goto end;
		
		menu=(WMenu*)find_thing_t(win, WTHING_MENU);
		
		if(menu==NULL)
			goto end;
		
		if(test_scroll(menu, dx, dy))
			start_scroll(menu);
	}

end:
	end_scroll();
}
Пример #5
0
Файл: menu.c Проект: Cougar/pwm
void set_menu_pos(WMenu *menu, int x, int y)
{
	move_menu(menu, x-menu->x, y-menu->y);
}