a few code clean-ups

This commit is contained in:
unK
2008-09-13 17:43:36 +02:00
parent 3419ff13a8
commit 831f9ab405

View File

@@ -844,14 +844,14 @@ int main(int argc, char *argv[])
case csPlaylist: case csPlaylist:
{ {
if (!mPlaylist->Empty()) if (!mPlaylist->Empty())
Mpd->PlayID(mPlaylist->at(mPlaylist->GetChoice()).GetID()); Mpd->PlayID(mPlaylist->Current().GetID());
break; break;
} }
case csBrowser: case csBrowser:
{ {
GO_TO_PARENT_DIR: GO_TO_PARENT_DIR:
const Item &item = mBrowser->at(mBrowser->GetChoice()); const Item &item = mBrowser->Current();
switch (item.type) switch (item.type)
{ {
case itDirectory: case itDirectory:
@@ -1208,7 +1208,7 @@ int main(int argc, char *argv[])
{ {
if (!mLibSongs->Empty()) if (!mLibSongs->Empty())
{ {
Song &s = mLibSongs->at(mLibSongs->GetChoice()); Song &s = mLibSongs->Current();
int id = Mpd->AddSong(s); int id = Mpd->AddSong(s);
if (id >= 0) if (id >= 0)
{ {
@@ -1428,9 +1428,9 @@ int main(int argc, char *argv[])
{ {
LockStatusbar(); LockStatusbar();
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1); wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1);
mEditorTags->at(mEditorTags->GetChoice()).GetEmptyFields(1); mEditorTags->Current().GetEmptyFields(1);
string new_tag = wFooter->GetString(mEditorTags->GetOption()); string new_tag = wFooter->GetString(mEditorTags->GetOption());
mEditorTags->at(mEditorTags->GetChoice()).GetEmptyFields(0); mEditorTags->Current().GetEmptyFields(0);
UnlockStatusbar(); UnlockStatusbar();
for (SongList::iterator it = list.begin(); it != list.end(); it++) for (SongList::iterator it = list.begin(); it != list.end(); it++)
(**it.*set)(new_tag); (**it.*set)(new_tag);
@@ -1439,12 +1439,12 @@ int main(int argc, char *argv[])
{ {
LockStatusbar(); LockStatusbar();
wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1); wFooter->WriteXY(0, Config.statusbar_visibility, "[.b]" + mEditorTagTypes->GetOption() + "[/b]: ", 1);
mEditorTags->at(mEditorTags->GetChoice()).GetEmptyFields(1); mEditorTags->Current().GetEmptyFields(1);
string new_tag = wFooter->GetString(mEditorTags->GetOption()); string new_tag = wFooter->GetString(mEditorTags->GetOption());
mEditorTags->at(mEditorTags->GetChoice()).GetEmptyFields(0); mEditorTags->Current().GetEmptyFields(0);
UnlockStatusbar(); UnlockStatusbar();
if (new_tag != mEditorTags->GetOption()) if (new_tag != mEditorTags->GetOption())
(mEditorTags->at(mEditorTags->GetChoice()).*set)(new_tag); (mEditorTags->Current().*set)(new_tag);
mEditorTags->Go(wDown); mEditorTags->Go(wDown);
} }
} }
@@ -1468,7 +1468,7 @@ int main(int argc, char *argv[])
{ {
if (current_screen == csBrowser) if (current_screen == csBrowser)
{ {
const Item &item = mBrowser->at(mBrowser->GetChoice()); const Item &item = mBrowser->Current();
switch (item.type) switch (item.type)
{ {
case itDirectory: case itDirectory:
@@ -1696,9 +1696,8 @@ int main(int argc, char *argv[])
else if (current_screen == csBrowser || wCurrent == mPlaylistList) else if (current_screen == csBrowser || wCurrent == mPlaylistList)
{ {
LockStatusbar(); LockStatusbar();
int id = wCurrent->GetChoice(); const string &name = wCurrent == mBrowser ? mBrowser->Current().name : mPlaylistList->Current();
const string &name = wCurrent == mBrowser ? mBrowser->at(id).name : mPlaylistList->at(id); if (current_screen != csBrowser || mBrowser->Current().type == itPlaylist)
if (current_screen != csBrowser || mBrowser->at(id).type == itPlaylist)
{ {
wFooter->WriteXY(0, Config.statusbar_visibility, "Delete playlist " + name + " ? [y/n] ", 1); wFooter->WriteXY(0, Config.statusbar_visibility, "Delete playlist " + name + " ? [y/n] ", 1);
curs_set(1); curs_set(1);
@@ -2209,7 +2208,7 @@ int main(int argc, char *argv[])
} }
else if ( else if (
(wCurrent == mPlaylist && !mPlaylist->Empty()) (wCurrent == mPlaylist && !mPlaylist->Empty())
|| (wCurrent == mBrowser && mBrowser->at(mBrowser->GetChoice()).type == itSong) || (wCurrent == mBrowser && mBrowser->Current().type == itSong)
|| (wCurrent == mSearcher && mSearcher->Current().first == ".") || (wCurrent == mSearcher && mSearcher->Current().first == ".")
|| (wCurrent == mLibSongs && !mLibSongs->Empty()) || (wCurrent == mLibSongs && !mLibSongs->Empty())
|| (wCurrent == mPlaylistEditor && !mPlaylistEditor->Empty())) || (wCurrent == mPlaylistEditor && !mPlaylistEditor->Empty()))
@@ -2699,7 +2698,7 @@ int main(int argc, char *argv[])
} }
else if ( else if (
(wCurrent == mPlaylist && !mPlaylist->Empty()) (wCurrent == mPlaylist && !mPlaylist->Empty())
|| (wCurrent == mBrowser && mBrowser->at(mBrowser->GetChoice()).type == itSong) || (wCurrent == mBrowser && mBrowser->Current().type == itSong)
|| (wCurrent == mSearcher && mSearcher->Current().first == ".") || (wCurrent == mSearcher && mSearcher->Current().first == ".")
|| (wCurrent == mLibSongs && !mLibSongs->Empty()) || (wCurrent == mLibSongs && !mLibSongs->Empty())
|| (wCurrent == mPlaylistEditor && !mPlaylistEditor->Empty())) || (wCurrent == mPlaylistEditor && !mPlaylistEditor->Empty()))
@@ -2756,7 +2755,7 @@ int main(int argc, char *argv[])
} }
else if ( else if (
(wCurrent == mPlaylist && !mPlaylist->Empty()) (wCurrent == mPlaylist && !mPlaylist->Empty())
|| (wCurrent == mBrowser && mBrowser->at(mBrowser->GetChoice()).type == itSong) || (wCurrent == mBrowser && mBrowser->Current().type == itSong)
|| (wCurrent == mSearcher && mSearcher->Current().first == ".") || (wCurrent == mSearcher && mSearcher->Current().first == ".")
|| (wCurrent == mLibSongs && !mLibSongs->Empty()) || (wCurrent == mLibSongs && !mLibSongs->Empty())
|| (wCurrent == mPlaylistEditor && !mPlaylistEditor->Empty())) || (wCurrent == mPlaylistEditor && !mPlaylistEditor->Empty()))