4 |
|
// |
5 |
|
// $Id$ |
6 |
|
|
7 |
+ |
#include <iostream> |
8 |
+ |
|
9 |
|
#include <foreach.hpp> |
10 |
|
|
11 |
|
#include "MenuList.hpp" |
50 |
|
{ |
51 |
|
display.SetCursorPosition(19, cursor); |
52 |
|
|
53 |
+ |
size_t size(list.size()); |
54 |
+ |
|
55 |
|
if (this != previous || state != old) |
56 |
|
{ |
57 |
< |
display.Set(0, 0, (state.bottom != 0 ? '\x1a' : ' ')); |
57 |
> |
display.Set(0, 0, (state.top != 0 ? '\x1a' : ' ')); |
58 |
|
display.Set(0, 1, '\x12'); |
59 |
|
display.Set(0, 2, '\x13'); |
60 |
< |
display.Set(0, 3, (state.top < list.size() ? '\x1b' : ' ')); |
60 |
> |
display.Set(0, 3, (state.bottom < size ? '\x1b' : ' ')); |
61 |
|
|
62 |
< |
_forall (size_t, index, state.bottom, state.top) |
63 |
< |
{ |
64 |
< |
MenuItem *item(list[index]); |
65 |
< |
std::string value(*item); |
66 |
< |
|
67 |
< |
value.resize(18, ' '); |
68 |
< |
|
69 |
< |
if (BoolItem *item_ = dynamic_cast<BoolItem *>(item)) |
70 |
< |
value += (*item_ ? '\x94' : '\xcf'); |
71 |
< |
else if (dynamic_cast<SubItem *>(item)) |
72 |
< |
value += '\x10'; |
73 |
< |
else |
74 |
< |
value += ' '; |
62 |
> |
_forall (size_t, index, state.top, state.bottom) |
63 |
> |
if (index < size) |
64 |
> |
{ |
65 |
> |
MenuItem *item(list[index]); |
66 |
> |
std::string value(*item); |
67 |
> |
|
68 |
> |
value.resize(18, ' '); |
69 |
> |
|
70 |
> |
if (BoolItem *item_ = dynamic_cast<BoolItem *>(item)) |
71 |
> |
value += (*item_ ? '\x94' : '\xcf'); |
72 |
> |
else if (dynamic_cast<SubItem *>(item)) |
73 |
> |
value += '\x10'; |
74 |
> |
else |
75 |
> |
value += ' '; |
76 |
|
|
77 |
< |
display.Set(1, _index, value); |
78 |
< |
} |
77 |
> |
display.Set(1, _index, value); |
78 |
> |
} |
79 |
> |
else |
80 |
> |
display.Set(1, _index, std::string(18, ' ')); |
81 |
|
} |
82 |
|
else |
83 |
< |
_forall (size_t, index, state.bottom, state.top) |
83 |
> |
_forall (size_t, index, state.top, size < state.bottom ? size : state.bottom) |
84 |
|
if (BoolItem *item = dynamic_cast<BoolItem *>(list[index])) |
85 |
|
display.Set(19, _index, (*item ? _B("\x94") : _B("\xcf"))); |
86 |
|
} |
101 |
|
state.item = next; |
102 |
|
} |
103 |
|
|
104 |
+ |
std::cerr << state.item << ' ' << state.top << ' ' << state.bottom << ' ' << cursor << std::endl; |
105 |
+ |
|
106 |
|
return *this; |
107 |
|
} |
108 |
|
|
116 |
|
else |
117 |
|
--cursor; |
118 |
|
|
119 |
+ |
std::cerr << state.item << ' ' << state.top << ' ' << state.bottom << ' ' << cursor << std::endl; |
120 |
+ |
|
121 |
|
return *this; |
122 |
|
} |
123 |
|
|
134 |
|
|
135 |
|
TopList::AppendItem::operator std::string() const |
136 |
|
{ |
137 |
< |
return _B("Append"); |
137 |
> |
return _B("Playlist Append"); |
138 |
|
} |
139 |
|
|
140 |
|
TopList::AppendItem::operator bool() const |