diff --git a/src/menu.cpp b/src/menu.cpp index 26617ba6..ee6c0f93 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -281,7 +281,7 @@ void Menu::Display(bool redraw_whole_window) void Menu::Refresh(bool redraw_whole_window) { if (!itsOptions.empty() && is_static()) - itsHighlight == 0 ? Go(DOWN) : Go(UP); + itsHighlight == 0 ? Go(wDown) : Go(wUp); int MaxBeginning = itsOptions.size() < itsHeight ? 0 : itsOptions.size()-itsHeight; if (itsBeginning > MaxBeginning) @@ -397,7 +397,7 @@ void Menu::Go(Where where) scrollok(itsWindow, 1); switch (where) { - case UP: + case wUp: { if (itsHighlight <= itsBeginning && itsHighlight > 0) { @@ -414,13 +414,13 @@ void Menu::Go(Where where) if (is_static()) { if (itsHighlight == 0) - Go(DOWN); + Go(wDown); else - Go(UP); + Go(wUp); } break; } - case DOWN: + case wDown: { if (itsHighlight >= MaxCurrentHighlight && itsHighlight < MaxHighlight) { @@ -437,13 +437,13 @@ void Menu::Go(Where where) if (is_static()) { if (itsHighlight == MaxHighlight) - Go(UP); + Go(wUp); else - Go(DOWN); + Go(wDown); } break; } - case PAGE_UP: + case wPageUp: { itsHighlight -= itsHeight; itsBeginning -= itsHeight; @@ -455,14 +455,14 @@ void Menu::Go(Where where) if (is_static()) { if (itsHighlight == 0) - Go(DOWN); + Go(wDown); else - Go(UP); + Go(wUp); } redraw_screen(); break; } - case PAGE_DOWN: + case wPageDown: { itsHighlight += itsHeight; itsBeginning += itsHeight; @@ -474,37 +474,37 @@ void Menu::Go(Where where) if (is_static()) { if (itsHighlight == MaxHighlight) - Go(UP); + Go(wUp); else - Go(DOWN); + Go(wDown); } redraw_screen(); break; } - case HOME: + case wHome: { itsHighlight = 0; itsBeginning = 0; if (is_static()) { if (itsHighlight == 0) - Go(DOWN); + Go(wDown); else - Go(UP); + Go(wUp); } redraw_screen(); break; } - case END: + case wEnd: { itsHighlight = MaxHighlight; itsBeginning = MaxBeginning; if (is_static()) { if (itsHighlight == MaxHighlight) - Go(UP); + Go(wUp); else - Go(DOWN); + Go(wDown); } redraw_screen(); break; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 05027da8..fcceb99c 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -330,7 +330,7 @@ int main(int argc, char *argv[]) int footer_height = Config.statusbar_visibility ? 2 : 1; wFooter = new Window(0, footer_start_y, COLS, footer_height, "", Config.statusbar_color, brNone); - wFooter->GetGetStringHelper(TraceMpdStatus); + wFooter->SetGetStringHelper(TraceMpdStatus); wFooter->Display(); wCurrent = mPlaylist; @@ -658,14 +658,14 @@ int main(int argc, char *argv[]) while (Keypressed(input, Key.Up)) { TraceMpdStatus(); - wCurrent->Go(UP); + wCurrent->Go(wUp); wCurrent->Refresh(); wCurrent->ReadKey(input); } wCurrent->Timeout(ncmpcpp_window_timeout); } else - wCurrent->Go(UP); + wCurrent->Go(wUp); } else if (Keypressed(input, Key.Down)) { @@ -675,30 +675,30 @@ int main(int argc, char *argv[]) while (Keypressed(input, Key.Down)) { TraceMpdStatus(); - wCurrent->Go(DOWN); + wCurrent->Go(wDown); wCurrent->Refresh(); wCurrent->ReadKey(input); } wCurrent->Timeout(ncmpcpp_window_timeout); } else - wCurrent->Go(DOWN); + wCurrent->Go(wDown); } else if (Keypressed(input, Key.PageUp)) { - wCurrent->Go(PAGE_UP); + wCurrent->Go(wPageUp); } else if (Keypressed(input, Key.PageDown)) { - wCurrent->Go(PAGE_DOWN); + wCurrent->Go(wPageDown); } else if (Keypressed(input, Key.Home)) { - wCurrent->Go(HOME); + wCurrent->Go(wHome); } else if (Keypressed(input, Key.End)) { - wCurrent->Go(END); + wCurrent->Go(wEnd); } else if (input == KEY_RESIZE) { @@ -1139,8 +1139,8 @@ int main(int argc, char *argv[]) for (int i = 1; i <=13; i++) mSearcher->MakeStatic(i, 1); - mSearcher->Go(DOWN); - mSearcher->Go(DOWN); + mSearcher->Go(wDown); + mSearcher->Go(wDown); } else ShowMessage("No results found"); @@ -1230,7 +1230,7 @@ int main(int argc, char *argv[]) } FreeSongList(list); if (Keypressed(input, Key.Space)) - wCurrent->Go(DOWN); + wCurrent->Go(wDown); break; } case csPlaylistEditor: @@ -1274,7 +1274,7 @@ int main(int argc, char *argv[]) } FreeSongList(list); if (Keypressed(input, Key.Space)) - wCurrent->Go(DOWN); + wCurrent->Go(wDown); break; } default: @@ -1290,7 +1290,7 @@ int main(int argc, char *argv[]) Menu *mCurrent = static_cast(wCurrent); int i = mCurrent->GetChoice(); mCurrent->Select(i, !mCurrent->Selected(i)); - mCurrent->Go(DOWN); + mCurrent->Go(wDown); } } else @@ -1343,7 +1343,7 @@ int main(int argc, char *argv[]) break; } } - mBrowser->Go(DOWN); + mBrowser->Go(wDown); } else if (current_screen == csSearcher && !vSearched.empty()) { @@ -1354,7 +1354,7 @@ int main(int argc, char *argv[]) Song &s = *vSearched[id]; if (Mpd->AddSong(s) != -1) ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s))); - mSearcher->Go(DOWN); + mSearcher->Go(wDown); } else if (current_screen == csLibrary) goto ENTER_LIBRARY_SCREEN; // sorry, but that's stupid to copy the same code here. @@ -1598,14 +1598,14 @@ int main(int argc, char *argv[]) { if (!MoveSongUp(*it-1)) { - mPlaylist->Go(DOWN); + mPlaylist->Go(wDown); break; } } } else if (MoveSongUp(mPlaylist->GetChoice()-1)) - mPlaylist->Go(UP); + mPlaylist->Go(wUp); } else if (wCurrent == mPlaylistEditor) { @@ -1618,14 +1618,14 @@ int main(int argc, char *argv[]) { if (!PlaylistMoveSongUp(mPlaylistList->GetCurrentOption(), *it-1)) { - mPlaylistEditor->Go(DOWN); + mPlaylistEditor->Go(wDown); break; } } } else if (PlaylistMoveSongUp(mPlaylistList->GetCurrentOption(), mPlaylistEditor->GetChoice()-1)) - mPlaylistEditor->Go(UP); + mPlaylistEditor->Go(wUp); } } else if (Keypressed(input, Key.MvSongDown)) @@ -1642,14 +1642,14 @@ int main(int argc, char *argv[]) { if (!MoveSongDown(*it-1)) { - mPlaylist->Go(UP); + mPlaylist->Go(wUp); break; } } } else if (MoveSongDown(mPlaylist->GetChoice()-1)) - mPlaylist->Go(DOWN); + mPlaylist->Go(wDown); } else if (wCurrent == mPlaylistEditor) { @@ -1662,14 +1662,14 @@ int main(int argc, char *argv[]) { if (!PlaylistMoveSongDown(mPlaylistList->GetCurrentOption(), *it-1)) { - mPlaylistEditor->Go(UP); + mPlaylistEditor->Go(wUp); break; } } } else if (PlaylistMoveSongDown(mPlaylistList->GetCurrentOption(), mPlaylistEditor->GetChoice()-1)) - mPlaylistEditor->Go(DOWN); + mPlaylistEditor->Go(wDown); } } else if (Keypressed(input, Key.Add)) @@ -1843,8 +1843,13 @@ int main(int argc, char *argv[]) { GetDirectory(vSearched[mSearcher->GetChoice()-search_engine_static_option-1]->GetDirectory()); for (int i = 1; i < mBrowser->MaxChoice(); i++) + { if (mSearcher->GetCurrentOption() == mBrowser->GetOption(i)) + { mBrowser->Highlight(i); + break; + } + } goto SWITCHER_BROWSER_REDIRECT; } } @@ -1986,17 +1991,17 @@ int main(int argc, char *argv[]) mDialog->ReadKey(input); if (Keypressed(input, Key.Up)) - mDialog->Go(UP); + mDialog->Go(wUp); else if (Keypressed(input, Key.Down)) - mDialog->Go(DOWN); + mDialog->Go(wDown); else if (Keypressed(input, Key.PageUp)) - mDialog->Go(PAGE_UP); + mDialog->Go(wPageUp); else if (Keypressed(input, Key.PageDown)) - mDialog->Go(PAGE_DOWN); + mDialog->Go(wPageDown); else if (Keypressed(input, Key.Home)) - mDialog->Go(HOME); + mDialog->Go(wHome); else if (Keypressed(input, Key.End)) - mDialog->Go(END); + mDialog->Go(wEnd); } int id = mDialog->GetChoice(); diff --git a/src/scrollpad.cpp b/src/scrollpad.cpp index f2380e14..67a91e16 100644 --- a/src/scrollpad.cpp +++ b/src/scrollpad.cpp @@ -162,34 +162,34 @@ void Scrollpad::Go(Where where) switch (where) { - case UP: + case wUp: { if (itsBeginning > 0) itsBeginning--; // for scrolling break; } - case DOWN: + case wDown: { if (itsBeginning < MaxBeginning) itsBeginning++; // scroll break; } - case PAGE_UP: + case wPageUp: { itsBeginning -= itsHeight; if (itsBeginning < 0) itsBeginning = 0; break; } - case PAGE_DOWN: + case wPageDown: { itsBeginning += itsHeight; if (itsBeginning > MaxBeginning) itsBeginning = MaxBeginning; break; } - case HOME: + case wHome: { itsBeginning = 0; break; } - case END: + case wEnd: { itsBeginning = MaxBeginning; break; diff --git a/src/window.h b/src/window.h index 8a0e7129..3d30d2da 100644 --- a/src/window.h +++ b/src/window.h @@ -41,7 +41,7 @@ using std::vector; enum Color { clDefault, clBlack, clRed, clGreen, clYellow, clBlue, clMagenta, clCyan, clWhite }; enum Border { brNone, brBlack, brRed, brGreen, brYellow, brBlue, brMagenta, brCyan, brWhite }; -enum Where { UP, DOWN, PAGE_UP, PAGE_DOWN, HOME, END }; +enum Where { wUp, wDown, wPageUp, wPageDown, wHome, wEnd }; typedef void (*GetStringHelper)(); typedef std::pair ColorPair; @@ -63,7 +63,7 @@ class Window Window(const Window &); virtual ~Window(); virtual WINDOW *RawWin() { return itsWindow; } - virtual void GetGetStringHelper(GetStringHelper helper) { itsGetStringHelper = helper; } + virtual void SetGetStringHelper(GetStringHelper helper) { itsGetStringHelper = helper; } virtual void SetColor(Color, Color = clDefault); virtual void SetBaseColor(Color, Color = clDefault); virtual void SetBorder(Border);