void action(gui::dialog_process_info &info) { const bool leader_bool = leader_bools_[get_menu().selection()]; scroll_btn_->enable(leader_bool); if(leader_bool && (info.double_clicked || (!info.key_down && (info.key[SDLK_RETURN] || info.key[SDLK_KP_ENTER])))) { set_result(get_menu().selection()); } else if(!info.key_down && info.key[SDLK_ESCAPE]) { set_result(gui::CLOSE_DIALOG); } else if(!info.key_down && info.key[SDLK_SPACE]) { set_result(extra_result_); } else if(result() == gui::CONTINUE_DIALOG) { dialog::action(info); } }
int main(){ phoneBook book; long tempNum; char tempName[80], *searchName; int i; book.total = 0; for(;;){ switch(get_menu()){ case 1: printf("Enter a phone number: "); scanf("%ld", &tempNum); printf("Enter a name: "); flush_buffer(); scanf("%[^\n]", tempName); add_phone_number(tempNum, tempName, &book); printf("\n"); break; case 2: printf("Enter a phone number: "); scanf("%ld", &tempNum); searchName = get_phone_number(tempNum, &book); if(searchName == NULL) printf("Contact not found!\n"); else printf("%s\n", searchName); break; case 3: for(i = 0;i < book.total; i++){ printf("%ld - %s\n", book.entry[i].number,book.entry[i].name); } break; case 0: free(book); return 0; } } return 0; }
gui::dialog::dimension_measurements file_dialog::layout(int xloc, int yloc) { gui::dialog::dimension_measurements dim = dialog::layout(xloc, yloc); //shift the menu up unsigned y_shift = dim.menu_y - std::min<int>(dim.label_y, dim.textbox.y); int y_max = dim.menu_y + get_menu().height(); dim.menu_y -= y_shift; //shift the extra buttons up if (show_directory_buttons_) { std::map<gui::dialog_button *, std::pair<int,int> >::iterator i; for(i = dim.buttons.begin(); i != dim.buttons.end(); ++i) { const int btn_h = i->first->height(); int& btn_y = i->second.second; y_max = std::max<int>(y_max, btn_y + btn_h); btn_y -= y_shift; } } //shift the textbox down const int textbox_bottom_y = dim.textbox.y + get_textbox().height(); const int label_bottom_y = dim.label_y + get_textbox().get_label()->height(); y_shift = y_max - std::max<int>(textbox_bottom_y, label_bottom_y); dim.textbox.y += y_shift; dim.label_y += y_shift; set_layout(dim); return dim; }
void Menu::draw_menu_option_hilite(int h_menu, int v_menu) { agi_menu *m = get_menu(h_menu); agi_menu_option *d = get_menu_option(h_menu, v_menu); _text->print_text(d->text, 0, m->wincol + 1, v_menu + 2, m->width + 2, MENU_BG, d->enabled ? MENU_FG : MENU_DISABLED); }
/* * Menu spacing get/set functions - menu_spacing(3X) man page */ static VALUE rbncurs_c_set_menu_spacing(VALUE rb_menu, VALUE spc_description, VALUE spc_rows, VALUE spc_cols) { MENU *menu = get_menu(rb_menu); return INT2NUM(set_menu_spacing(menu, NUM2INT(spc_description), NUM2INT(spc_rows), NUM2INT(spc_cols))); }
boolean curses_menu_exists(winid wid) { if (get_menu(wid) != NULL) { return TRUE; } else { return FALSE; } }
void curses_create_nhmenu(winid wid) { nhmenu *new_menu = NULL; nhmenu *menuptr = nhmenus; nhmenu_item *menu_item_ptr = NULL; nhmenu_item *tmp_menu_item = NULL; new_menu = get_menu(wid); if (new_menu != NULL) { /* Reuse existing menu, clearing out current entries */ menu_item_ptr = new_menu->entries; if (menu_item_ptr != NULL) { while (menu_item_ptr->next_item != NULL) { tmp_menu_item = menu_item_ptr->next_item; free(menu_item_ptr); menu_item_ptr = tmp_menu_item; } free(menu_item_ptr); /* Last entry */ new_menu->entries = NULL; } if (new_menu->prompt != NULL) /* Reusing existing menu */ { free((char *)new_menu->prompt); } return; } new_menu = malloc(sizeof(nhmenu)); new_menu->wid = wid; new_menu->prompt = NULL; new_menu->entries = NULL; new_menu->num_pages = 0; new_menu->height = 0; new_menu->width = 0; new_menu->reuse_accels = FALSE; new_menu->next_menu = NULL; if (nhmenus == NULL) /* no menus in memory yet */ { new_menu->prev_menu = NULL; nhmenus = new_menu; } else { while (menuptr->next_menu != NULL) { menuptr = menuptr->next_menu; } new_menu->prev_menu = menuptr; menuptr->next_menu = new_menu; } }
static VALUE rbncurs_c_free_menu(VALUE rb_menu) { VALUE menus_hash = rb_iv_get(mMenu, "@menus_hash"); MENU *menu = get_menu(rb_menu); VALUE menu_address = INT2NUM((long)(menu)); rb_funcall(menus_hash, rb_intern("delete"), 1, menu_address); rb_iv_set(rb_menu, "@destroyed", Qtrue); return INT2NUM(free_menu(menu)); }
agi_menu_option *Menu::get_menu_option(int i, int j) { agi_menu *m = get_menu(i); MenuOptionList::iterator iter; for (iter = m->down.begin(); iter != m->down.end(); ++iter) { agi_menu_option* d = *iter; if (d->index == j) return d; } return NULL; }
int install_loader(loader_t *l, sys_info_t *info, lickdir_t *lick) { if(!l->check()) { if(!l->install(info, lick)) return 0; menu_t *m = get_menu(l); m->install(lick); free(m); return 1; } return -1; // already installed }
void curses_add_nhmenu_item(winid wid, const ANY_P *identifier, char accelerator, char group_accel, int attr, const char *str, boolean presel) { char *new_str; nhmenu_item *new_item, *current_items, *menu_item_ptr; nhmenu *current_menu = get_menu(wid); if (str == NULL) { return; } new_str = curses_copy_of(str); curses_rtrim((char *) new_str); new_item = malloc(sizeof(nhmenu_item)); new_item->wid = wid; new_item->identifier = *identifier; new_item->accelerator = accelerator; new_item->group_accel = group_accel; new_item->attr = attr; new_item->str = new_str; new_item->presel = presel; new_item->selected = FALSE; new_item->page_num = 0; new_item->line_num = 0; new_item->num_lines = 0; new_item->count = -1; new_item->next_item = NULL; if (current_menu == NULL) { panic("curses_add_nhmenu_item: attempt to add item to nonexistant menu"); } current_items = current_menu->entries; menu_item_ptr = current_items; if (current_items == NULL) { new_item->prev_item = NULL; current_menu->entries = new_item; } else { while (menu_item_ptr->next_item != NULL) { menu_item_ptr = menu_item_ptr->next_item; } new_item->prev_item = menu_item_ptr; menu_item_ptr->next_item = new_item; } }
/* draw box and pulldowns. */ void Menu::draw_menu_option(int h_menu) { /* find which vertical menu it is */ agi_menu *m = get_menu(h_menu); draw_box(m->wincol * CHAR_COLS, 1 * CHAR_LINES, (m->wincol + m->width + 2) * CHAR_COLS, (1 + m->height + 2) * CHAR_LINES, MENU_BG, MENU_LINE, 0); MenuOptionList::iterator iter; for (iter = m->down.begin(); iter != m->down.end(); ++iter) { agi_menu_option* d = *iter; _text->print_text(d->text, 0, m->wincol + 1, d->index + 2, m->width + 2, d->enabled ? MENU_FG : MENU_DISABLED, MENU_BG); } }
int uninstall_loader(loader_t *l, int reinstall, sys_info_t *info, lickdir_t *lick) { if(l->check()) { if(!l->uninstall(info, lick)) return 0; if(!reinstall) { menu_t *m = get_menu(l); m->uninstall(lick); free(m); } return 1; } return -1; // already uninstalled }
static VALUE rbncurs_c_set_menu_init(VALUE rb_menu, VALUE proc) { MENU *menu = NULL; if (!rb_obj_is_kind_of(rb_menu, cMENU)) rb_raise(rb_eArgError, "arg1 must be a MENU object"); if (!rb_obj_is_kind_of(proc, rb_cProc)) rb_raise(rb_eArgError, "arg2 must be a Proc object"); menu = get_menu(rb_menu); reg_proc(menu, MENU_INIT_HOOK, proc); if (proc != Qnil) return INT2NUM(set_menu_init(menu, menu_init_hook)); else return INT2NUM(set_menu_init(menu, NULL)); }
void statistics_dialog::action(gui::dialog_process_info &dp_info) { int sel = get_menu().selection(); bool has_details = sel < 5 && sel >= 0 && unit_count_[sel] > 0; detail_btn_->enable(has_details); if(dp_info.double_clicked && has_details) { set_result(sel); } else if(dp_info.new_key_down && !dp_info.key_down) { set_result(gui::CLOSE_DIALOG); } // Prepare the sub-dialog for Statistic Details std::string title; std::vector<std::string> items_sub; switch(result()) { case gui::CLOSE_DIALOG: break; case 0: items_sub = create_unit_table(stats_.recruits, team_num_); title = _("Recruits"); break; case 1: items_sub = create_unit_table(stats_.recalls, team_num_); title = _("Recalls"); break; case 2: items_sub = create_unit_table(stats_.advanced_to, team_num_); title = _("Advancements"); break; case 3: items_sub = create_unit_table(stats_.deaths, team_num_); title = _("Losses"); break; case 4: items_sub = create_unit_table(stats_.killed, team_num_); /** @todo FIXME? Perhaps killed units shouldn't have the same team-color as your own. */ title = _("Kills"); break; default: break; } if (items_sub.empty() == false) { gui::dialog d(get_display(), title + " (" + player_name_ + ")", "", gui::CLOSE_ONLY); d.set_menu(items_sub); d.show(); dp_info.clear_buttons(); set_result(gui::CONTINUE_DIALOG); } }
static VALUE rbncurs_c_menu_items(VALUE rb_menu) { MENU *menu = get_menu(rb_menu); ITEM **items = menu_items(menu); VALUE arr = Qundef; int i; if (items == NULL) rb_raise(rb_eRuntimeError, "Error retrieving menu items"); arr = rb_ary_new(); i=0; while (items[i] != NULL) rb_ary_push(arr, wrap_item(items[i++])); return arr; }
/* * Item-menu connection make/break functions - menu_items(3X) man page */ static VALUE rbncurs_c_set_menu_items(VALUE rb_menu, VALUE rb_item_array) { long n = rbncurs_array_length(rb_item_array); /* If ncurses does not free memory used by the previous array of strings, */ /* we will have to do it now. */ ITEM **items = ALLOC_N(ITEM*, (n+1)); long i; MENU *menu = NULL; for (i=0; i<n; i++) items[i] = get_item(rb_ary_entry(rb_item_array, i)); items[n] = NULL; menu = get_menu(rb_menu); return INT2NUM(set_menu_items(menu, items)); }
int client_main(config_t *cfg){ int mode; mode = get_menu(); //モード選択はループの最後に行う while(1){ if ( mode == CLIENT_GET ){ //ファイル取得 if ( cfg->host[0] == '\0' ){ printf("接続先が登録されていません。\nEnterキーでメニューに戻ります。\n"); fflush(stdin); getc(stdin); mode = get_menu(); continue; } if ( client_receive_transmission(cfg) == ERROR_CONNECT ){ printf("サーバに接続できませんでした。\n接続先の受信プログラムが起動していない可能性があります。\nEnterキーでもう一度接続を試みます。\n"); fflush(stdin); getc(stdin); continue; } } else if ( mode == CLIENT_CONFIG ){ if ( cfg->host[0] == '\0' ){ //接続先がないので入力させる printf("接続先を入力し、Enterキーを押してください。\n>>"); new_config(cfg); config_load(cfg); } else { //接続先を表示し、入力を求める。 printf("現在設定されている接続先は%sです。\n上書きしない場合は、Enterキーのみを入力してください。\n上書きする場合は接続先を入力し、Enterキーを入力してください。\n>>",cfg->host); new_config(cfg); config_load(cfg); } } else if ( mode == CLIENT_EXIT ){ //終了 exit(0); } mode = get_menu(); } return NO_ERROR; }
void curses_del_menu(winid wid) { nhmenu_item *tmp_menu_item; nhmenu_item *menu_item_ptr; nhmenu *tmpmenu; nhmenu *current_menu = get_menu(wid); if (current_menu == NULL) { return; } menu_item_ptr = current_menu->entries; /* First free entries associated with this menu from memory */ if (menu_item_ptr != NULL) { while (menu_item_ptr->next_item != NULL) { tmp_menu_item = menu_item_ptr->next_item; free(menu_item_ptr); menu_item_ptr = tmp_menu_item; } free(menu_item_ptr); /* Last entry */ current_menu->entries = NULL; } /* Now unlink the menu from the list and free it as well */ if (current_menu->prev_menu != NULL) { tmpmenu = current_menu->prev_menu; tmpmenu->next_menu = current_menu->next_menu; } else { nhmenus = current_menu->next_menu; /* New head mode or NULL */ } if (current_menu->next_menu != NULL) { tmpmenu = current_menu->next_menu; tmpmenu->prev_menu = current_menu->prev_menu; } free(current_menu); curses_del_wid(wid); }
void curses_finalize_nhmenu(winid wid, const char *prompt) { int count = 0; nhmenu *current_menu = get_menu(wid); nhmenu_item *menu_item_ptr = current_menu->entries; if (current_menu == NULL) { panic("curses_finalize_nhmenu: attempt to finalize nonexistant menu"); } while (menu_item_ptr != NULL) { menu_item_ptr = menu_item_ptr->next_item; count++; } current_menu->num_entries = count; current_menu->prompt = curses_copy_of(prompt); }
static VALUE rbncurs_c_menu_format(VALUE rb_menu, VALUE rows, VALUE cols) { if (rb_obj_is_instance_of(rows, rb_cArray) != Qtrue || rb_obj_is_instance_of(cols, rb_cArray) != Qtrue) { rb_raise(rb_eArgError, "rows and cols arguments must be empty Arrays"); return Qnil; } else { MENU *menu = get_menu(rb_menu); int vals[2] = {0,0}; menu_format(menu, &vals[0], &vals[1]); rb_ary_push(rows, INT2NUM(vals[0])); rb_ary_push(cols, INT2NUM(vals[1])); return Qnil; } }
static VALUE rbncurs_c_scale_menu(VALUE rb_menu, VALUE rows, VALUE columns) { MENU *menu = get_menu(rb_menu); if (rb_obj_is_instance_of(rows, rb_cArray) != Qtrue || rb_obj_is_instance_of(columns, rb_cArray) != Qtrue) { rb_raise(rb_eArgError, "rows and columns arguments must be empty Arrays"); return Qnil; } else { int vals[2] = {0,0}; int result = scale_menu(menu, &vals[0],&vals[1]); rb_ary_push(rows, INT2NUM(vals[0])); rb_ary_push(columns, INT2NUM(vals[1])); return INT2NUM(result); } }
void GetMenuBar(std::string const& name, wxFrame *window, agi::Context *c) { menu_items const& items = get_menu(name); std::auto_ptr<CommandMenuBar> menu(new CommandMenuBar(c)); for (menu_items::const_iterator it = items.begin(); it != items.end(); ++it) { std::string submenu, disp; read_entry(*it, "submenu", &submenu); read_entry(*it, "text", &disp); if (!submenu.empty()) { menu->Append(build_menu(submenu, c, &menu->cm), _(lagi_wxString(disp))); } else { read_entry(*it, "special", &submenu); if (submenu == "automation") menu->Append(new AutomationMenu(c, &menu->cm), _(lagi_wxString(disp))); } } window->Bind(wxEVT_MENU_OPEN, &CommandManager::OnMenuOpen, &menu->cm); window->Bind(wxEVT_COMMAND_MENU_SELECTED, &CommandManager::OnMenuClick, &menu->cm); window->SetMenuBar(menu.get()); #ifdef __WXGTK__ // GTK silently swallows keypresses for accelerators whose associated // menu items are disabled. As we don't update the menu until it's // opened, this means that conditional hotkeys don't work if the menu // hasn't been opened since they became valid. // // To work around this, we completely disable accelerators from menu // item. wxGTK doesn't expose any way to do this other that at wx // compile time (SetAcceleratorTable is a no-op), so have some fun with // the implementation details of undocumented methods. Detaching via // wxMenuBar::Detach removes the accelerator table, and then // wxMenuBarBase::Attch is used to avoid readding it. menu->Detach(); menu->wxMenuBarBase::Attach(window); #endif menu.release(); }
static VALUE rbncurs_c_menu_spacing(VALUE rb_menu, VALUE spc_description, VALUE spc_rows, VALUE spc_cols) { if (rb_obj_is_instance_of(spc_description, rb_cArray) != Qtrue || rb_obj_is_instance_of(spc_rows, rb_cArray) != Qtrue || rb_obj_is_instance_of(spc_cols, rb_cArray) != Qtrue) { rb_raise(rb_eArgError, "spc_description, spc_rows, and spc_cols arguments must be empty Arrays"); return Qnil; } else { MENU *menu = get_menu(rb_menu); int vals[3] = {0,0,0}; int result = menu_spacing(menu, &vals[0], &vals[1], &vals[2]); rb_ary_push(spc_description, INT2NUM(vals[0])); rb_ary_push(spc_rows, INT2NUM(vals[1])); rb_ary_push(spc_cols, INT2NUM(vals[2])); return INT2NUM(result); } }
void statistics_dialog::action(gui::dialog_process_info &dp_info) { int sel = get_menu().selection(); bool has_details = sel < 5 && sel >= 0 && unit_count_[sel] > 0; detail_btn_->enable(has_details); if(dp_info.double_clicked && has_details) { set_result(sel); } else if(dp_info.new_key_down && !dp_info.key_down) { set_result(gui::CLOSE_DIALOG); } // Prepare the sub-dialog for Statistic Details std::string title; std::vector<std::string> items_sub; switch(result()) { case gui::CLOSE_DIALOG: break; case 0: items_sub = create_unit_table(current_stats().recruits, team_num_); title = _("Recruits"); break; case 1: items_sub = create_unit_table(current_stats().recalls, team_num_); title = _("Recalls"); break; case 2: items_sub = create_unit_table(current_stats().advanced_to, team_num_); title = _("Advancements"); break; case 3: items_sub = create_unit_table(current_stats().deaths, team_num_); title = _("Losses"); break; case 4: // Give kills a (probably) different team color. items_sub = create_unit_table(current_stats().killed, team_num_ == 1 ? 2 : 1); title = _("Kills"); break; case BUTTON_SCENE: // Scenario selection. do_scene_selection(); set_result(gui::CONTINUE_DIALOG); break; case BUTTON_TOGGLE: // Toggle between campaign and scenario stats. display_stats(!use_campaign_); set_result(gui::CONTINUE_DIALOG); break; default: break; } if (items_sub.empty() == false) { gui::dialog d(get_video(), title + " (" + player_name_ + ")", "", gui::CLOSE_ONLY); d.set_menu(items_sub); d.show(); dp_info.clear_buttons(); set_result(gui::CONTINUE_DIALOG); } }
int curses_display_nhmenu(winid wid, int how, MENU_ITEM_P **_selected) { nhmenu *current_menu = get_menu(wid); nhmenu_item *menu_item_ptr; int num_chosen, count; WINDOW *win; MENU_ITEM_P *selected = NULL; *_selected = NULL; if (current_menu == NULL) { panic("curses_display_nhmenu: attempt to display nonexistant menu"); } menu_item_ptr = current_menu->entries; if (menu_item_ptr == NULL) { panic("curses_display_nhmenu: attempt to display empty menu"); } /* Reset items to unselected to clear out selections from previous invocations of this menu, and preselect appropriate items */ while (menu_item_ptr != NULL) { menu_item_ptr->selected = menu_item_ptr->presel; menu_item_ptr = menu_item_ptr->next_item; } menu_win_size(current_menu); menu_determine_pages(current_menu); /* Display pre and post-game menus centered */ if (((moves <= 1) && !invent) || program_state.gameover) { win = curses_create_window(current_menu->width, current_menu->height, CENTER); } else /* Display during-game menus on the right out of the way */ { win = curses_create_window(current_menu->width, current_menu->height, RIGHT); } num_chosen = menu_get_selections(win, current_menu, how); curses_destroy_win(win); if (num_chosen > 0) { selected = (MENU_ITEM_P*) malloc(num_chosen * sizeof(MENU_ITEM_P)); count = 0; menu_item_ptr = current_menu->entries; while (menu_item_ptr != NULL) { if (menu_item_ptr->selected) { if (count == num_chosen) { panic("curses_display_nhmenu: Selected items " "exceeds expected number"); } selected[count].item = menu_item_ptr->identifier; selected[count].count = menu_item_ptr->count; count++; } menu_item_ptr = menu_item_ptr->next_item; } if (count != num_chosen) { panic("curses_display_nhmenu: Selected items less than " "expected number"); } } *_selected = selected; return num_chosen; }
/* * Menu mark get/set functions - menu_mark(3X) man page */ static VALUE rbncurs_c_set_menu_mark(VALUE rb_menu, VALUE value) { MENU *menu = get_menu(rb_menu); return INT2NUM(set_menu_mark(menu, STR2CSTR(value))); }
void get_config() { int flag = 0, sflag = 0, i, prt = 0; int reprint_screen = 0; ulong page; #if NMOD_FRAMEBUFFER > 0 stop_record(); #endif popup(); wait_keyup(); while(!flag) { cprint(POP_Y+1, POP_X+2, "Configuration:"); cprint(POP_Y+3, POP_X+6, "(1) Test Selection"); cprint(POP_Y+4, POP_X+6, "(2) Address Range"); cprint(POP_Y+5, POP_X+6, "(3) Memory Sizing"); cprint(POP_Y+6, POP_X+6, "(4) Error Summary"); cprint(POP_Y+7, POP_X+6, "(5) Error Report Mode"); cprint(POP_Y+8, POP_X+6, "(6) ECC Mode"); cprint(POP_Y+9, POP_X+6, "(7) Restart"); cprint(POP_Y+10, POP_X+6, "(8) Refresh Screen"); cprint(POP_Y+11, POP_X+6, "(9) Adv. Options"); cprint(POP_Y+12,POP_X+6,"(0) Continue"); /* Wait for key release */ /* Fooey! This nuts'es up the serial input. */ sflag = 0; switch(get_key()) { case 2: /* 1 - Test Selection */ popclear(); cprint(POP_Y+1, POP_X+2, "Test Selection:"); cprint(POP_Y+3, POP_X+6, "(1) Default Tests"); cprint(POP_Y+4, POP_X+6, "(2) Skip Current Test"); cprint(POP_Y+5, POP_X+6, "(3) Select Test"); cprint(POP_Y+6, POP_X+6, "(4) Select Bit Fade Test"); cprint(POP_Y+7, POP_X+6, "(0) Continue"); if (v->testsel < 0) { cprint(POP_Y+3, POP_X+5, ">"); } else { cprint(POP_Y+5, POP_X+5, ">"); } wait_keyup(); while (!sflag) { switch(get_key()) { case 2: /* Default */ if (v->testsel == 9) { bail++; } v->testsel = -1; find_ticks(); sflag++; cprint(LINE_INFO, COL_TST, "Std"); break; case 3: /* Skip test */ bail++; sflag++; break; case 4: /* Select test */ popclear(); cprint(POP_Y+1, POP_X+3, "Test Selection:"); cprint(POP_Y+4, POP_X+5, "Test Number [0-9]: "); i = getval(POP_Y+4, POP_X+24, 0); if (i <= 9) { if (i != v->testsel) { v->pass = -1; v->test = -1; } v->testsel = i; } find_ticks(); sflag++; bail++; cprint(LINE_INFO, COL_TST, "#"); dprint(LINE_INFO, COL_TST+1, i, 2, 1); break; case 5: if (v->testsel != 9) { v->pass = -1; v->test = -1; } v->testsel = 9; find_ticks(); sflag++; bail++; cprint(LINE_INFO, COL_TST, "#"); dprint(LINE_INFO, COL_TST+1, 9, 2, 1); break; case 11: case 57: sflag++; break; } } popclear(); break; case 3: /* 2 - Address Range */ popclear(); cprint(POP_Y+1, POP_X+2, "Test Address Range:"); cprint(POP_Y+3, POP_X+6, "(1) Set Lower Limit"); cprint(POP_Y+4, POP_X+6, "(2) Set Upper Limit"); cprint(POP_Y+5, POP_X+6, "(3) Test All Memory"); cprint(POP_Y+6, POP_X+6, "(0) Continue"); wait_keyup(); while (!sflag) { switch(get_key()) { case 2: /* Lower Limit */ popclear(); cprint(POP_Y+2, POP_X+4, "Lower Limit: "); cprint(POP_Y+4, POP_X+4, "Current: "); aprint(POP_Y+4, POP_X+13, v->plim_lower); cprint(POP_Y+6, POP_X+4, "New: "); page = getval(POP_Y+6, POP_X+9, 12); if (page + 1 <= v->plim_upper) { v->plim_lower = page; bail++; } adj_mem(); find_ticks(); sflag++; break; case 3: /* Upper Limit */ popclear(); cprint(POP_Y+2, POP_X+4, "Upper Limit: "); cprint(POP_Y+4, POP_X+4, "Current: "); aprint(POP_Y+4, POP_X+13, v->plim_upper); cprint(POP_Y+6, POP_X+4, "New: "); page = getval(POP_Y+6, POP_X+9, 12); if (page - 1 >= v->plim_lower) { v->plim_upper = page; bail++; } adj_mem(); find_ticks(); sflag++; break; case 4: /* All of memory */ v->plim_lower = 0; v->plim_upper = v->pmap[v->msegs - 1].end; bail++; adj_mem(); find_ticks(); sflag++; break; case 11: case 57: /* 0/CR - Continue */ sflag++; break; } } popclear(); break; case 4: /* 3 - Memory Sizing */ popclear(); cprint(POP_Y+1, POP_X+2, "Memory Sizing:"); cprint(POP_Y+3, POP_X+6, "(1) BIOS - Std"); if (e820_nr) { cprint(POP_Y+4, POP_X+6, "(2) BIOS - All"); cprint(POP_Y+5, POP_X+6, "(3) Probe"); cprint(POP_Y+6, POP_X+6, "(0) Continue"); cprint(POP_Y+2+memsz_mode, POP_X+5, ">"); } else { cprint(POP_Y+4, POP_X+6, "(3) Probe"); cprint(POP_Y+5, POP_X+6, "(0) Continue"); if (memsz_mode == SZ_MODE_BIOS) { cprint(POP_Y+3, POP_X+5, ">"); } else { cprint(POP_Y+4, POP_X+5, ">"); } } wait_keyup(); while (!sflag) { switch(get_key()) { case 2: memsz_mode = SZ_MODE_BIOS; wait_keyup(); restart(); /* mem_size(); v->test = 0; v->pass = 0; v->total_ticks = 0; bail++; sflag++; */ break; case 3: memsz_mode = SZ_MODE_BIOS_RES; wait_keyup(); restart(); /* mem_size(); v->test = 0; v->pass = 0; v->total_ticks = 0; bail++; sflag++; */ break; case 4: memsz_mode = SZ_MODE_PROBE; wait_keyup(); restart(); /* mem_size(); v->test = 0; v->pass = 0; v->total_ticks = 0; bail++; sflag++; */ break; case 11: case 57: /* 0/CR - Continue */ sflag++; break; } } popclear(); break; case 5: /* 4 - Show error summary */ popclear(); for (i=0; tseq[i].msg != NULL; i++) { cprint(POP_Y+1+i, POP_X+2, "Test:"); dprint(POP_Y+1+i, POP_X+8, i, 2, 1); cprint(POP_Y+1+i, POP_X+12, "Errors:"); dprint(POP_Y+1+i, POP_X+20, tseq[i].errors, 5, 1); } wait_keyup(); while (get_key() == 0); popclear(); break; case 6: /* 5 - Printing Mode */ popclear(); cprint(POP_Y+1, POP_X+2, "Printing Mode:"); cprint(POP_Y+3, POP_X+6, "(1) Individual Errors"); cprint(POP_Y+4, POP_X+6, "(2) BadRAM Patterns"); cprint(POP_Y+5, POP_X+6, "(3) Error Counts Only"); cprint(POP_Y+6, POP_X+6, "(0) Continue"); cprint(POP_Y+3+v->printmode, POP_X+5, ">"); wait_keyup(); while (!sflag) { switch(get_key()) { case 2: /* Separate Addresses */ v->printmode=PRINTMODE_ADDRESSES; v->eadr = 0; sflag++; break; case 3: /* BadRAM Patterns */ v->printmode=PRINTMODE_PATTERNS; sflag++; prt++; break; case 4: /* Error Counts Only */ v->printmode=PRINTMODE_NONE; sflag++; break; case 11: case 57: /* 0/CR - Continue */ sflag++; break; } } popclear(); break; case 7: /* 6 - ECC Polling Mode */ popclear(); cprint(POP_Y+1, POP_X+2, "ECC Polling Mode:"); cprint(POP_Y+3, POP_X+6, "(1) Recommended"); cprint(POP_Y+4, POP_X+6, "(2) On"); cprint(POP_Y+5, POP_X+6, "(3) Off"); cprint(POP_Y+6, POP_X+6, "(0) Continue"); wait_keyup(); while(!sflag) { switch(get_key()) { case 2: set_ecc_polling(-1); sflag++; break; case 3: set_ecc_polling(1); sflag++; break; case 4: set_ecc_polling(0); sflag++; break; case 11: case 57: /* 0/CR - Continue */ sflag++; break; } } popclear(); break; case 8: wait_keyup(); restart(); break; case 9: reprint_screen = 1; flag++; break; case 10: get_menu(); break; case 11: case 57: case 28: /* 0/CR/SP - Continue */ flag++; break; } } popdown(); if (prt) { printpatn(); } if (reprint_screen){ tty_print_screen(); } }
/* * Menu pattern get/set functions - menu_pattern(3X) man page */ static VALUE rbncurs_c_set_menu_pattern(VALUE rb_menu, VALUE pattern) { MENU *menu = get_menu(rb_menu); return INT2NUM(set_menu_pattern(menu, STR2CSTR(pattern))); }
static VALUE rbncurs_c_menu_pattern(VALUE rb_menu) { MENU *menu = get_menu(rb_menu); return rb_str_new2(menu_pattern(menu)); }