parking it here until more decisions on the browser come in. (It should probably be reachable by pressing '?' from the current '?' help screen.) It reads the manual from ../docs/crawl_manual.txt, so you'd better put it there! Yes, this is a hack and will have to be done better. You can press the letter of the section (e.g., 'j' or 'J') to jump to that section.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@627 c06c8d41-db1a-0410-9941-cceddc491573
2GV6OW7P54FXZ5OD2NUMX7MLXH424LYAFMOAUQ2UGSOLKLYDBJGAC
bool menu_browser::process_key( int keyin )
{
bool repaint = false;
switch ( keyin )
{
case 0:
return true;
case CK_ENTER:
case CK_ESCAPE:
return false;
return false;
case ' ': case '+': case CK_PGDN: case '>': case '\'':
repaint = page_down();
break;
case '-': case CK_PGUP: case '<': case ';':
repaint = page_up();
break;
case CK_UP:
repaint = line_up();
break;
case CK_DOWN:
repaint = line_down();
break;
default:
// look for it as a hotkey
for ( unsigned int i = 0; i < items.size(); ++i )
{
// found it
if ( items[i]->is_hotkey(keyin) )
{
repaint = jump_to(i);
break;
}
}
break;
}
if (repaint)
draw_menu();
return true;
}
// last updated 12may2000 {dlb}
/* ***********************************************************************
* called from: acr
* *********************************************************************** */
void list_commands(bool wizard);
void browse_file( FILE* fp )
{
menu_browser m;
bool next_is_hotkey = false;
char buf[200];
while (fgets(buf, sizeof buf, fp))
{
MenuEntry* me = new MenuEntry(buf);
if ( next_is_hotkey && isupper(buf[0]) )
{
me->add_hotkey(buf[0]);
me->add_hotkey(tolower(buf[0]));
me->level = MEL_TITLE;
me->colour = WHITE;
}
m.add_entry(me);
// XXX FIXME: there must be some better way to identify sections
next_is_hotkey = (strstr(buf, "------------------------------------------------------------------------") == buf);
}
m.show();
}