Changeset 169

Show
Ignore:
Timestamp:
06/09/07 08:26:51 (1 year ago)
Author:
takkaria
Message:

Fix some menu bugs (#128):

  • Options submenus should use a, b, c etc.
  • Macro menu doesn't have the right indentation.
  • Birthscreen menu for race/class has cursor in wrong place (should be on the grid of the selected menu item).
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/birth.c

    r156 r169  
    727727{ 
    728728        byte attr = curs_attrs[CURS_KNOWN][0 != cursor]; 
    729         c_prt(attr, sex_info[oid].title, row, col); 
     729        c_put_str(attr, sex_info[oid].title, row, col); 
    730730} 
    731731 
     
    741741{ 
    742742        byte attr = curs_attrs[CURS_KNOWN][0 != cursor]; 
    743         c_prt(attr, p_name + p_info[oid].name, row, col); 
     743        c_put_str(attr, p_name + p_info[oid].name, row, col); 
    744744} 
    745745 
     
    755755{ 
    756756        byte attr = curs_attrs[0 != (rp_ptr->choice & (1L << oid))][0 != cursor]; 
    757         c_prt(attr, c_name + c_info[oid].name, row, col); 
     757        c_put_str(attr, c_name + c_info[oid].name, row, col); 
    758758} 
    759759 
  • trunk/src/cmd4.c

    r156 r169  
    29352935        int cursor = 0; 
    29362936 
    2937         region loc = {0, 1, 0, 11}; 
     2937        region loc = {0, 0, 0, 12}; 
    29382938 
    29392939        /* Roguelike */ 
     
    29532953        FILE_TYPE(FILE_TYPE_TEXT); 
    29542954 
    2955  
    29562955        screen_save(); 
    29572956 
     
    29672966                clear_from(0); 
    29682967 
    2969                 /* No title -- this is a complex menu. */ 
    2970                 prt("Interact with macros", 0, 0); 
    29712968                /* Describe current action */ 
    2972                 prt("Current action (if any) shown below:", 12, 0); 
     2969                prt("Current action (if any) shown below:", 13, 0); 
     2970 
    29732971                /* Analyze the current action */ 
    29742972                ascii_to_text(tmp, sizeof(tmp), macro_buffer); 
     2973 
    29752974                /* Display the current action */ 
    2976                 prt(tmp, 13, 0); 
     2975                prt(tmp, 14, 0); 
    29772976                c = menu_select(&macro_menu, &cursor, EVT_CMD); 
    29782977 
    2979                 if (ESCAPE == c.key)  
    2980                        break; 
     2978 
     2979                if (ESCAPE == c.key) break; 
    29812980                evt = macro_actions[cursor].id; 
    29822981 
    2983                 switch(evt) { 
     2982                switch(evt) 
     2983                { 
    29842984                case LOAD_PREF: 
     2985                { 
    29852986                        do_cmd_pref_file_hack(16); 
    29862987                        break; 
     2988                } 
    29872989 
    29882990#ifdef ALLOW_MACROS 
     
    30703072                        break; 
    30713073                } 
     3074 
    30723075                case DEL_MACRO: 
    30733076                { 
     
    41664169        menu_type *menu; 
    41674170 
     4171        /* options screen selection menu */ 
     4172        menu = &option_menu; 
     4173        WIPE(menu, menu_type); 
     4174        menu_set_id(menu, OPTION_MENU); 
     4175        menu->title = "Options Menu"; 
     4176        menu->menu_data = option_actions; 
     4177        menu->count = N_ELEMENTS(option_actions); 
     4178        menu_init(menu, MN_SCROLL, MN_ACT, &SCREEN_REGION); 
     4179 
    41684180        /* Initialize the options toggle menu */ 
    41694181        menu = &option_toggle_menu; 
     
    41714183        menu->prompt = "Set option (y/n/t), '?' for information"; 
    41724184        menu->cmd_keys = "?YyNnTt"; 
    4173         menu->selections = default_choice
     4185        menu->selections = "abcdefghijklmopqrsuvwxz"
    41744186        menu->count = OPT_PAGE_PER; 
    41754187        menu->flags = MN_DBL_TAP; 
    41764188        menu_init2(menu, find_menu_skin(MN_SCROLL), &options_iter, &SCREEN_REGION); 
    4177  
    4178         /* options screen selection menu */ 
    4179         menu = &option_menu; 
    4180         WIPE(menu, menu_type); 
    4181         menu_set_id(menu, OPTION_MENU); 
    4182         menu->title = "Options Menu"; 
    4183         menu->count = N_ELEMENTS(option_actions); 
    4184         menu->menu_data = option_actions; 
    4185         menu_init(menu, MN_SCROLL, MN_ACT, &SCREEN_REGION); 
    41864189 
    41874190        /* macro menu */ 
     
    41894192        WIPE(menu, menu_type); 
    41904193        menu_set_id(menu, MACRO_MENU); 
     4194        menu->title = "Interact with macros"; 
     4195        menu->selections = default_choice; 
     4196        menu->menu_data = macro_actions; 
    41914197        menu->count = N_ELEMENTS(macro_actions); 
    4192         menu->menu_data = macro_actions; 
    4193         menu->selections = lower_case; 
    41944198        menu_init(menu, MN_SCROLL, MN_EVT, &SCREEN_REGION); 
    41954199 
    4196         /* knowledge menu */ 
    4197         menu = &knowledge_menu; 
    4198         WIPE(menu, menu_type); 
    4199         menu_set_id(menu, KNOWLEDGE_MENU); 
    4200         menu->title = "Display current knowledge"; 
    4201         menu->count = N_ELEMENTS(knowledge_actions), 
    4202         menu->menu_data = knowledge_actions; 
    4203         menu_init(menu, MN_SCROLL, MN_ACT, &SCREEN_REGION); 
    4204          
    42054200        /* visuals menu */ 
    42064201        menu = &visual_menu; 
     
    42094204        menu->title = "Interact with visuals"; 
    42104205        menu->selections = default_choice; 
     4206        menu->menu_data = visual_menu_items; 
    42114207        menu->count = N_ELEMENTS(visual_menu_items); 
    4212         menu->menu_data = visual_menu_items;  
    42134208        menu_init(menu, MN_SCROLL, MN_EVT, &SCREEN_REGION); 
    42144209 
     
    42194214        menu->title = "Interact with colors"; 
    42204215        menu->selections = default_choice; 
    4221         menu->count = N_ELEMENTS(color_events), 
    42224216        menu->menu_data = color_events; 
     4217        menu->count = N_ELEMENTS(color_events); 
    42234218        menu_init(menu, MN_SCROLL, MN_EVT, &SCREEN_REGION); 
     4219 
     4220        /* knowledge menu */ 
     4221        menu = &knowledge_menu; 
     4222        WIPE(menu, menu_type); 
     4223        menu_set_id(menu, KNOWLEDGE_MENU); 
     4224        menu->title = "Display current knowledge"; 
     4225        menu->menu_data = knowledge_actions; 
     4226        menu->count = N_ELEMENTS(knowledge_actions), 
     4227        menu_init(menu, MN_SCROLL, MN_ACT, &SCREEN_REGION); 
    42244228 
    42254229        /* initialize other static variables */ 
  • trunk/src/ui.c

    r166 r169  
    1717 */ 
    1818#include "angband.h" 
    19  
    2019 
    2120/* 
     
    333332 
    334333/* Display current view of a skin */ 
    335 static void 
    336 display_scrolling(menu_type *menu, int cursor, int *top, region *loc) 
     334static void display_scrolling(menu_type *menu, int cursor, int *top, region *loc) 
    337335{ 
    338336        int col = loc->col; 
     
    342340        int i; 
    343341 
    344         if ((cursor <= *top) && (*top > 0)) { 
     342        if ((cursor <= *top) && (*top > 0)) 
     343        { 
    345344                if(menu->flags & MN_PAGE) *top = cursor; 
    346345                else *top = cursor - jumpscroll - 1; 
    347346        } 
    348         if (cursor >= *top + (rows_per_page - 1)) { 
    349                 if(menu->flags & MN_PAGE && cursor + rows_per_page < n) 
     347 
     348        if (cursor >= *top + (rows_per_page - 1)) 
     349        { 
     350                if (menu->flags & MN_PAGE && cursor + rows_per_page < n) 
    350351                        *top = cursor; 
    351                 else if(menu->flags & MN_PAGE)  
     352                else if (menu->flags & MN_PAGE) 
    352353                        *top = n - rows_per_page; 
    353354                else  
    354355                        *top = cursor - (rows_per_page - 1) + 1 + jumpscroll; 
    355356        } 
     357 
    356358        if (*top > n - rows_per_page) 
    357359                *top = n - rows_per_page; 
     
    366368        } 
    367369 
    368         if (cursor >= 0) 
     370        if (menu->cursor >= 0) 
    369371                Term_gotoxy(col, row + cursor - *top); 
    370372} 
     
    553555 
    554556/* Modal display of menu */ 
    555 static void 
    556 display_menu_row(menu_type *menu, int pos, int top, 
    557                  bool cursor, int row, int col, int width) 
     557static void display_menu_row(menu_type *menu, int pos, int top, 
     558                             bool cursor, int row, int col, int width) 
    558559{ 
    559560        int flags = menu->flags; 
     
    604605                                        TERM_WHITE, menu->prompt); 
    605606 
    606         menu->skin->display_list(menu, menu->cursor, &menu->top, &menu->active); 
    607  
    608607        if (menu->browse_hook && oid >= 0) 
    609608                menu->browse_hook(oid, (void*) menu->menu_data, loc); 
     609 
     610        menu->skin->display_list(menu, menu->cursor, &menu->top, &menu->active); 
    610611} 
    611612