summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-16 00:46:32 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-16 00:46:32 +0000
commitcf87ca267353855c40cc29c08eb40b646693e3e2 (patch)
tree0d7c2732774b41cf6bf3b0bd1dd2b21752f31270 /crawl-ref/source/menu.cc
parent6ed4daf41beec1170a296309f5013ced65ceab20 (diff)
downloadcrawl-ref-cf87ca267353855c40cc29c08eb40b646693e3e2.tar.gz
crawl-ref-cf87ca267353855c40cc29c08eb40b646693e3e2.zip
In the item selection menu, pressing "." will toggle the next item in the
list; you can press "." repeatedly to select/unselect a number of contiguous items. Also, removed the depedancy upon "menu.h" for formatted_string, since that isn't in menu.h anymore. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2101 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/menu.cc')
-rw-r--r--crawl-ref/source/menu.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 576b4517ec..c379460d8f 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -32,7 +32,8 @@ Menu::Menu( int _flags )
highlighter(new MenuHighlighter),
num(-1),
lastch(0),
- alive(false)
+ alive(false),
+ last_selected(-1)
{
set_flags(flags);
}
@@ -242,6 +243,22 @@ bool Menu::process_key( int keyin )
repaint = true;
break;
}
+ case '.':
+ if (last_selected != -1)
+ {
+ if ((first_entry + pagesize - last_selected) == 1)
+ {
+ page_down();
+ nav = true;
+ }
+
+ select_index(last_selected + 1);
+ get_selected(&sel);
+
+ repaint = true;
+ }
+ break;
+
default:
keyin = post_process(keyin);
lastch = keyin;
@@ -273,6 +290,14 @@ bool Menu::process_key( int keyin )
break;
}
+ if (last_selected != -1 &&
+ (items.size() == ((unsigned int) last_selected + 1)
+ || items[last_selected + 1] == NULL
+ || items[last_selected + 1]->level != MEL_ITEM))
+ {
+ last_selected = -1;
+ }
+
if (!isdigit( keyin ))
num = -1;
@@ -463,6 +488,7 @@ void Menu::select_index( int index, int qty )
continue;
if (is_hotkey(i, items[i]->hotkeys[0]) && is_selectable(i))
{
+ last_selected = i;
items[i]->select( qty );
draw_item( i );
}
@@ -478,6 +504,7 @@ void Menu::select_index( int index, int qty )
continue;
if (is_hotkey(i, items[i]->hotkeys[0]))
{
+ last_selected = i;
items[i]->select( qty );
draw_item( i );
}
@@ -486,6 +513,7 @@ void Menu::select_index( int index, int qty )
else if (items[si]->level == MEL_ITEM &&
(flags & (MF_SINGLESELECT | MF_MULTISELECT)))
{
+ last_selected = si;
items[si]->select( qty );
draw_item( si );
}