Пример #1
0
/*-----------------------------------------------------------------------------------*/
static void
s_ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;
  
  /* Draw menus */
  hires_color(ctk_hires_theme.menucolor); 
  hires_gotoxy(0, 0);
  hires_revers(0);
  ctk_hires_cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    if(m != menus->open) {
      ctk_hires_cputsn(m->title, m->titlelen);
      ctk_hires_cputc(' ');
    } else {     
      draw_menu(m);
    }
  }
  ctk_hires_cclear(SCREEN_WIDTH - hires_wherex() -
		      strlen(menus->desktopmenu->title) - 1);
  
  /* Draw desktopmenu */  
  if(menus->desktopmenu != menus->open) {
    ctk_hires_cputsn(menus->desktopmenu->title,
			menus->desktopmenu->titlelen);
    ctk_hires_cputc(' ');
  } else {
    draw_menu(menus->desktopmenu);
  }

}
Пример #2
0
int				menu_over(t_game *g)
{
	int		key;

	init_display();
	wrefresh(stdscr);
	g->display_choose = 0;
	draw_menu(g);
	while ((key = getch()))
	{
		if (key == 10 && g->display_choose == 0)
		{
			retry(g);
			ft_init_map(g);
			return (endwin(), 1);
		}
		if (key == 10 && g->display_choose == 1)
			menu_hightscores(g);
		if (key == 10 && g->display_choose == 2)
			return (endwin(), 0);
		func_choose(g, key);
		draw_menu(g);
	}
	return (1);
}
Пример #3
0
int
search_menu_list(const char *pattern, menu_info *m)
{
	int save = 0;
	int i;

	if(pattern != NULL)
	{
		m->regexp = strdup(pattern);
		if(search_menu(m, m->pos) != 0)
		{
			draw_menu(m);
			move_to_menu_pos(m->pos, m);
			return 1;
		}
		draw_menu(m);
	}

	for(i = 0; i < search_repeat; i++)
		switch(m->match_dir)
		{
			case NONE:
				save = search_menu_forwards(m, m->pos + 1);
				break;
			case UP:
				save = search_menu_backwards(m, m->pos - 1);
				break;
			case DOWN:
				save = search_menu_forwards(m, m->pos + 1);
				break;
			default:
				break;
		}
	return save;
}
Пример #4
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;

  /* Draw menus */
  (void)textcolor(MENUCOLOR);
  gotoxy(0, 0);
  revers(1);
  cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    draw_menu(m, m == menus->open);
  }

  /* Draw desktopmenu */
  if(wherex() + strlen(menus->desktopmenu->title) + 1 >= sizex) {
    gotoxy(sizex - (unsigned char)strlen(menus->desktopmenu->title) - 1, 0);
  } else {
    cclear(sizex - wherex() -
	   (unsigned char)strlen(menus->desktopmenu->title) - 1);
  }
  draw_menu(menus->desktopmenu, menus->desktopmenu == menus->open);

  revers(0);
}
Пример #5
0
void execute_file_menu(int choice,const char * choice_name, char * folder){
    char file[strlen(choice_name)];
    char folder_complet[strlen(folder)+strlen(file)+1];
    
    strcpy(file, choice_name);
    
    strcpy(folder_complet, folder);
    strcat(folder_complet, file);
    
    
    if(exists(folder_complet) == 1){
         
         mvprintw(LINES-2, 0, "                                                        ");
         mvprintw(LINES-1, 0, "%s                                                                ", folder_complet);
         display_execution(6, mem, taille_mem, reg, taille_reg, 1, 2, 3);
        
    }
    else if(exists(folder_complet) == 2){
        strcat(folder_complet, "/");
        int i;
        char ** files = list_file(folder_complet, &i);
        mvprintw(LINES-1, 0, "Dossier:  %s                                                        ", folder_complet);
        draw_menu(files, execute_file_menu, folder_complet, i);
    }
    else{
        mvprintw(LINES-1, 0, "Une erreur s'est produite lors de l'ouverture du fichier. Retour à ./");
        int i;
        char ** files = list_file("", &i);
        draw_menu(files, execute_file_menu, "", i);
    }

}
Пример #6
0
void PlayerMenu::draw(bool left_side, const Scene& scene, SDL_Renderer* renderer)
{
	if (left_side)
	{
		draw_menu(left_side_, renderer);
	}
	else
	{
		draw_menu(right_side_, renderer);
	}
}
Пример #7
0
static void menu_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  if (cell_index->row == GAME_INDEX) {
    draw_menu(ctx, cell_layer, "Play", game_icon);
  } else if (cell_index->row == INSTRUCTION_INDEX) {
    draw_menu(ctx, cell_layer, "Instructions", NULL);
  } else if (cell_index->row == SETTINGS_INDEX) {
    draw_menu(ctx, cell_layer, "Settings", NULL);
  } else if (cell_index->row == ABOUT_INDEX) {
    draw_menu(ctx, cell_layer, "About", NULL);
  }
}
Пример #8
0
int init_gui()
{	WIN win;
	int ch;
        int i;
        char ** files;

	initscr();			/* Start curses mode 		*/
	start_color();			/* Start the color functionality */
	cbreak();			/* Line buffering disabled, Pass on
					 * everty thing to me 		*/
	keypad(stdscr, TRUE);		/* I need that nifty F1 	*/
	noecho();
	init_pair(1, COLOR_CYAN, COLOR_BLACK);
        init_pair(2, COLOR_GREEN, COLOR_BLACK);

	/* Initialize the window parameters */
	init_win_params(&win);
	print_win_params(&win);

	attron(COLOR_PAIR(1));
        printw("F2: Ouvrir un fichier");
        printw("\t F3: Lancer l'émulation");
	printw("\t F5: Quitter");
        attron(A_BOLD);
        attron(COLOR_PAIR(2));
        char chaine[]="Welcome to ProcSI emulator";
        mvprintw((LINES/2) -3,(COLS-strlen(chaine))/2,chaine);
        attroff(A_BOLD);
	refresh();
	attroff(COLOR_PAIR(1));
	
	create_box(&win, TRUE);
        draw_menu(choices, execute_main_menu, "", 3);
        
	while((ch = getch()) != KEY_F(5))
	{
            switch(ch)
	    {	case KEY_F(5):
                        mvprintw(LINES-2, 0, "Exiting...");
                        endwin();			/* End curses mode		  */
                        exit(0);
            
                case KEY_F(2):
                        files = list_file("", &i);
                        draw_menu(files, execute_file_menu, "", i);
            }
            
	}
	endwin();			/* End curses mode		  */
	return 0;
}
Пример #9
0
void
remove_current_item(menu_state_t *ms)
{
	menu_data_t *const m = ms->d;
	menu_current_line_erase(ms);

	remove_from_string_array(m->items, m->len, m->pos);

	if(m->data != NULL)
	{
		remove_from_string_array(m->data, m->len, m->pos);
	}

	if(m->void_data != NULL)
	{
		memmove(m->void_data + m->pos, m->void_data + m->pos + 1,
				sizeof(*m->void_data)*((m->len - 1) - m->pos));
	}

	if(ms->matches != NULL)
	{
		if(ms->matches[m->pos][0] >= 0)
		{
			--ms->matching_entries;
		}
		memmove(ms->matches + m->pos, ms->matches + m->pos + 1,
				sizeof(*ms->matches)*((m->len - 1) - m->pos));
	}

	--m->len;
	draw_menu(ms);

	move_to_menu_pos(m->pos, ms);
}
Пример #10
0
/* Tries to navigate to menu search match specified via pos argument.  If pos is
 * negative, match wasn't found and the message is printed.  Returns new value
 * for save_msg flag. */
static int
navigate_to_match(menu_state_t *m, int pos)
{
	if(pos > -1)
	{
		if(!m->search_highlight)
		{
			/* Might need to highlight other items, so redraw whole menu. */
			m->search_highlight = 1;
			m->d->pos = pos;
			draw_menu(m);
		}
		else
		{
			menu_current_line_erase(m);
			move_to_menu_pos(pos, m);
		}
		menu_print_search_msg(m);
	}
	else
	{
		move_to_menu_pos(m->d->pos, m);
		if(cfg.wrap_scan)
		{
			menu_print_search_msg(m);
		}
	}
	return 1;
}
Пример #11
0
int main(void)
{

	char menu[ROW][COL]={"Enter Data","Linear Search","Binary Search","Find Biggest",
			 "Find Smallest","Find 2nd Biggest","Find 2nd Smallest","Selection Sort","bubble_sort",
			 "insertion_sort","Free Data","Exit"};
	char ch;
	int choice,flag;


	flag=0;
	choice=0;
	init_menu();

	do
	{
		draw_menu(20,8,choice,menu);
		ch=getch();
		choice=check_hotkeys(ch);
		flag=menu_body(ch,choice);

	}while(flag!=1);

	return(0);

}
Пример #12
0
int main(void)
{
    sys_setup_keys();
    u8g_setup();

    menu_redraw_required = 1;
    for(;;)
    {

        sys_debounce_key();

        if (  menu_redraw_required != 0 )
        {
            u8g_FirstPage(&u8g);
            do
            {
                draw_menu();

            } while ( u8g_NextPage(&u8g) );
            menu_redraw_required = 0;
        }

        update_menu();
    }
}
Пример #13
0
int menu_firms()
{
    char firms[MAX_OPTIONS][_MAX_LFN + 1], dirpath[] = PATH_FIRMWARE_DIR;

    int pathlen = strlen(dirpath);
    int count = find_file_pattern(firms, dirpath, pathlen, MAX_OPTIONS, "firmware*.bin");

    if (!count) {
        draw_loading("Failed to load FIRM", "Make sure the encrypted FIRM is\n  located in the firmware directory");
        return 1;
    }

    char *options[count];
    for (int x = 0; x <= count; x++) options[x] = firms[x];

    int result = draw_menu("Select firmware", 0, count, options);
    if (result == -1) return 0;

    memcpy(config->firm_path, firms[result], _MAX_LFN + 1);

    reload_native_firm();
    load_cakes_info(PATH_PATCHES);

    return 0;
}
Пример #14
0
void draw_all_menu( Menu *menu )
{
  if ( menu->parent != 0 )
    draw_all_menu( (int)( &menu ) );
  draw_menu( menu );
  return;
}
Пример #15
0
struct optionsinfo goto_options_menu(BITMAP *scrbuffer, DATAFILE *main_data,
                                     DATAFILE *plane_data, struct optionsinfo options,
                                     struct menuinfo options_menu,
                                     struct menuinfo stats_menu)
{
// function controls the options menu

    options_menu.highlight = 0;
    do {
        // reset the selection
        options_menu.selection = -1;

        // draw the options screen
        draw_menu(scrbuffer, main_data, options_menu, options_menu.row, options_menu.col);
        textout_centre_ex(scrbuffer, main_data[FONTLARGE].dat, "Options",
                          SCREEN_W/2, TITLE_ROW*8, GREY+15, -1);
        blit(scrbuffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);

        options_menu = move_menu_cursor(options_menu);

        if (options_menu.selection == 0) {
            // go to the stats menu
            options = goto_stats_menu(scrbuffer, main_data, plane_data, options, stats_menu);
            options_menu.highlight = 0;
        }

    } while (options_menu.selection != options_menu.num_of_options - 1);

    return(options);
}
Пример #16
0
void menu_main()
{
    while (1) {
        char *options[] = {"Boot CFW",
                           "Select Patches",
                           "More options...",
                           "Version info",
                           "Power off"};
        int result = draw_menu("CakesFW " CAKES_VERSION, 0, sizeof(options) / sizeof(char *), options);

        switch (result) {
            case 0:
                save_config();
                boot_cfw();
                break;
            case 1:
                menu_select_patches();
                break;
            case 2:
                menu_more();
                break;
            case 3:
                version_info();
                break;
            case 4:
                i2cWriteRegister(I2C_DEV_MCU, 0x20, 1);
                while(1);  // Won't break out of this one >:D
        }
    }
}
Пример #17
0
void draw_table(void) 
{
        // give us a green table
        printf(NORMAL);
        printf(CLEAR_SCREEN);

        // Title
        printf(MOVE_TOP_LEFT);
        printf(RED);
        printf("                                B L A C K J A C K\n");

        // menu
        draw_menu();

        // Headings
        printf(BLUE);
        printf("\033[%d;%dH", DEALER_ROW, DEALER_COL);
        printf("Dealer");
        printf("\033[%d;%dH", DEALER_ROW+1, DEALER_COL);
        printf("------");
        printf("\033[%d;%dH", PLAYER_ROW, PLAYER_COL);
        printf("You");
        printf("\033[%d;%dH", PLAYER_ROW+1, PLAYER_COL);
        printf("---");

        // wins, losses
        draw_stats();

        printf(MOVE_TOP_LEFT);
} // draw_table()
Пример #18
0
void
update_menu(void)
{
	draw_menu(menu);
	move_to_menu_pos(menu->pos, menu);
	wrefresh(menu_win);
}
Пример #19
0
int main(void)
{
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); //Check for memoryLeaks.
	draw_menu();

	return 0;
}
Пример #20
0
void tick_game_menu(t_game* game) {
  static SDL_Surface* menu;
  if (!menu) menu = ximg_load("res/texture.jpg");
  SDL_BlitSurface(menu, sdlh_rect(0, 0, 512, 512), game->screen,
                  sdlh_rect(0, 0, 0, 0));
  draw_menu(game);
  sound_menu();
}
Пример #21
0
void
move_to_menu_pos(int pos, menu_state_t *ms)
{
	menu_data_t *const m = ms->d;
	int redraw;

	pos = MIN(m->len - 1, MAX(0, pos));
	if(pos < 0)
	{
		return;
	}

	normalize_top(ms);

	redraw = 0;
	if(pos > get_last_visible_line(m))
	{
		m->top = pos - (ms->win_rows - 2 - 1);
		redraw = 1;
	}
	else if(pos < m->top)
	{
		m->top = pos;
		redraw = 1;
	}

	if(cfg.scroll_off > 0)
	{
		int s = MIN(DIV_ROUND_UP(ms->win_rows - 2, 2), cfg.scroll_off);
		if(pos - m->top < s && m->top > 0)
		{
			m->top -= s - (pos - m->top);
			normalize_top(ms);
			redraw = 1;
		}
		if(pos > get_last_visible_line(m) - s)
		{
			m->top += s - (get_last_visible_line(m) - pos);
			normalize_top(ms);
			redraw = 1;
		}
	}

	ms->current = 1 + (pos - m->top);
	m->pos = pos;

	if(redraw)
	{
		draw_menu(ms);
	}
	else
	{
		draw_menu_item(ms, m->pos, ms->current, 0);
	}
	checked_wmove(menu_win, ms->current, 2);

	show_position_in_menu(m);
}
Пример #22
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;  

  
  /* Draw menus */
  textcolor(VNC_OUT_MENUCOLOR);
  gotoxy(0, 0);
  revers(1);
  cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    if(m != menus->open) {
      update_area(wherex(), 0, strlen(m->title) + 1, 1);
      cputs(m->title);
      cputc(' ');
    } else {
      draw_menu(m);
    }
  }


  if(wherex() + strlen(menus->desktopmenu->title) + 1>= sizex) {
    gotoxy(sizex - strlen(menus->desktopmenu->title) - 1, 0);
  } else {
    cclear(sizex - wherex() -
	   strlen(menus->desktopmenu->title) - 1);
    update_area(wherex(), 0, sizex - wherex() -
		strlen(menus->desktopmenu->title) - 1, 1);
  }
  
  /* Draw desktopmenu */
  if(menus->desktopmenu != menus->open) {
    update_area(wherex(), 0, strlen(menus->desktopmenu->title) + 1, 1);
    cputs(menus->desktopmenu->title);
    cputc(' ');
  } else {
    draw_menu(menus->desktopmenu);
  }

  revers(0);



}
Пример #23
0
/*---------------------------------------------------------------------------*/
void ctk_draw_menus(struct ctk_menus *menus) {
  struct ctk_menu *m;  
  
  clip(0, SCREEN_HEIGHT);
  /* Draw menus */
  gotoxy(0, 0);
  revers(1);
  for(m = menus->menus->next; m != NULL; m = m->next) {
    draw_menu(m, menus->open);
  }

  clearTo(SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1);

  /* Draw desktopmenu */
  draw_menu(menus->desktopmenu, menus->open);

  revers(0);
}
Пример #24
0
int getchoice(char* greet, char* choices[])
{
	static int selected_row = 0;
	int max_row = 0;
	int start_screenrow = MESSAGE_LINE, start_screencol = 10;
	char** option = NULL;
	int selected = 0;
	int key = 0;

	option = choices;
	while (*option) {
		max_row++;
		option++;
	}

	if (selected_row >= max_row)
		selected_row = 0;

	clear();
	mvprintw(2, 20, "%s", "CD Database Application");
	refresh();

	mvprintw(start_screenrow-2, start_screencol, greet);
	keypad(stdscr, TRUE);
	cbreak();
	noecho();
	key=0;

	while (key != 'q' && key != KEY_ENTER && key != '\n')
	{
		if (key == KEY_UP) {
			if (selected_row == 0)
				selected_row = max_row - 1;
			else
				selected_row--;
		}

		if (key == KEY_DOWN) {
			if (selected_row == (max_row - 1))
				selected_row = 0;
			else
				selected_row++;
		}
		selected = *choices[selected_row];
		draw_menu(choices, selected_row, start_screenrow, start_screencol);
		key = getch();
	}

	keypad(stdscr, FALSE);
	nocbreak();
	echo();

	if (key == 'q')
		selected = 'q';
	
	return selected;
}
Пример #25
0
/* Redraw the intro screen */
void draw_intro_screen (void)
{
    SDL_FillRect (screen, NULL, 0);
    draw_starfield ();
    draw_menu (screen, intro_menu);
    if (intr_message.show)
        intro_draw_message ();
    SDL_UpdateRect (screen, 0, 0, 0, 0);
}
Пример #26
0
void move_arrow_left(void)
{
	if(mi_index > 0)
		mi_index--;
	
	if(arrow_Pos_H > 0)
		arrow_Pos_H--;

	draw_menu();
}
Пример #27
0
void move_arrow_down(void)
{
	if(mi_index < mi_index_max)
		mi_index++;
	
	if(arrow_Pos_V < 1)
		arrow_Pos_V++;
	
	draw_menu();
}
Пример #28
0
void move_arrow_up(void)
{
	if(mi_index > 0)
		mi_index--;
	
	if(arrow_Pos_V > 0)
		arrow_Pos_V--;
	
	draw_menu();
}
Пример #29
0
static void menu_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
  if (is_search_initialized) {
    save_contact_name(cell_index->row);
    save_contact_number(cell_index->row);
    save_contact_id(cell_index->row);
    draw_menu(ctx, cell_layer, current_contact, current_number);
  } else {
    draw_loading(ctx, cell_layer, "Loading...", "If you just installed, this menu will populate as you send texts");
  }
}
Пример #30
0
void move_arrow_right(void)
{
	if(mi_index < mi_index_max)
		mi_index++;
	
	if(arrow_Pos_H < 1)
		arrow_Pos_H++;

	draw_menu();
}