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 46 by douglas, 2008-03-06T19:47:57-08:00 vs.
Revision 47 by douglas, 2008-03-07T03:08:31-08:00

# Line 20 | Line 20 | MenuList::MenuList(MenuList *parent, Dis
20   {
21   }
22  
23 + MenuList::MenuList(MenuList *parent) : parent(parent), display(parent->display), cursor(0), list(1)
24 + {
25 + }
26 +
27   MenuList::~MenuList()
28   {
29          _foreach (std::vector<MenuItem *>, item, list)
30                  delete *item;
31 +
32 +        if (parent != NULL && parent != this)
33 +                delete parent;
34   }
35  
36   MenuList *MenuList::Enter()
# Line 43 | Line 50 | MenuList *MenuList::Right()
50  
51   MenuList *MenuList::Left()
52   {
53 +        MenuList *parent(this->parent);
54 +
55 +        if (parent != this)
56 +        {
57 +                this->parent = NULL;
58 +
59 +                delete this;
60 +        }
61 +
62          return parent;
63   }
64  
# Line 77 | Line 93 | void MenuList::Render()
93                                  display.Set(1, _index, value);
94                          }
95                          else
96 <                                display.Set(1, _index, std::string(18, ' '));
96 >                                display.Set(1, _index, std::string(19, ' '));
97          }
98          else
99                  _forall (size_t, index, state.top, size < state.bottom ? size : state.bottom)
# Line 101 | Line 117 | MenuList &MenuList::operator ++()
117                  state.item = next;
118          }
119  
104        std::cerr << state.item << ' ' << state.top << ' ' << state.bottom << ' ' << cursor << std::endl;
105
120          return *this;
121   }
122  
# Line 116 | Line 130 | MenuList &MenuList::operator --()
130                  else
131                          --cursor;
132  
119        std::cerr << state.item << ' ' << state.top << ' ' << state.bottom << ' ' << cursor << std::endl;
120
133          return *this;
134   }
135  
# Line 164 | Line 176 | TopList::ShuffleItem::operator bool() co
176          return audacious.IsRunning() ? audacious.IsShuffle() : false;
177   }
178  
179 < TopList::MusicItem::MusicItem(MenuList *list, Audacious::Audacious &audacious) : MenuItem(list), audacious(audacious)
179 > TopList::MusicItem::MusicItem(MenuList *list, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library) : MenuItem(list), audacious(audacious), append(append), library(library)
180   {
181   }
182  
183   MenuList *TopList::MusicItem::Select()
184   {
185 <        delete this;
174 <
175 <        return NULL;
185 >        return new ArtistList(list, audacious, append, library);
186   }
187  
188   TopList::MusicItem::operator std::string() const
# Line 180 | Line 190 | TopList::MusicItem::operator std::string
190          return _B("Music");
191   }
192  
193 < TopList::TopList(Display &display, Audacious::Audacious &audacious, bool &append) : MenuList(this, display, 3)
193 > TopList::TopList(Display &display, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library) : MenuList(this, display, 3)
194   {
195          previous = NULL;
196          list[0] = new AppendItem(this, append);
197          list[1] = new ShuffleItem(this, audacious);
198 <        list[2] = new MusicItem(this, audacious);
198 >        list[2] = new MusicItem(this, audacious, append, library);
199 > }
200 >
201 > ArtistList::ArtistList(MenuList *parent, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library) : MenuList(parent)
202 > {
203 >        list[0] = new AllItem(this, audacious, append, library);
204 > }
205 >
206 > ArtistList::AllItem::AllItem(MenuList *list, Audacious::Audacious &audacious, bool &append, MusicLibrary::Library &library) : MenuItem(list), audacious(audacious), append(append), library(library)
207 > {
208 > }
209 >
210 > MenuList *ArtistList::AllItem::Select()
211 > {
212 >        std::cerr << _B("All Artists!") << std::endl;
213 >
214 >        return list;
215 > }
216 >
217 > ArtistList::AllItem::operator std::string() const
218 > {
219 >        return _B("All Artists");
220   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines