ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/MenuList.cpp
(Generate patch)

Comparing DashInterface/MenuList.cpp (file contents):
Revision 45 by douglas, 2008-03-06T18:12:54-08:00 vs.
Revision 46 by douglas, 2008-03-06T19:47:57-08:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 + #include <iostream>
8 +
9   #include <foreach.hpp>
10  
11   #include "MenuList.hpp"
# Line 48 | Line 50 | void MenuList::Render()
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   }
# Line 94 | Line 101 | MenuList &MenuList::operator ++()
101                  state.item = next;
102          }
103  
104 +        std::cerr << state.item << ' ' << state.top << ' ' << state.bottom << ' ' << cursor << std::endl;
105 +
106          return *this;
107   }
108  
# Line 107 | Line 116 | MenuList &MenuList::operator --()
116                  else
117                          --cursor;
118  
119 +        std::cerr << state.item << ' ' << state.top << ' ' << state.bottom << ' ' << cursor << std::endl;
120 +
121          return *this;
122   }
123  
# Line 123 | Line 134 | MenuList *TopList::AppendItem::Select()
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines