more PascalCase to camelCase conversions

This commit is contained in:
Andrzej Rybczak
2012-09-13 19:23:33 +02:00
parent 8e6d9a97e3
commit dd7665bb7d
43 changed files with 567 additions and 567 deletions

View File

@@ -161,7 +161,7 @@ void Action::ResizeScreen(bool reload_main_window)
SetResizeFlags(); SetResizeFlags();
ApplyToVisibleWindows(&BasicScreen::Resize); applyToVisibleWindows(&BasicScreen::resize);
if (Config.header_visibility || Config.new_design) if (Config.header_visibility || Config.new_design)
wHeader->resize(COLS, HeaderHeight); wHeader->resize(COLS, HeaderHeight);
@@ -170,7 +170,7 @@ void Action::ResizeScreen(bool reload_main_window)
wFooter->moveTo(0, FooterStartY); wFooter->moveTo(0, FooterStartY);
wFooter->resize(COLS, Config.statusbar_visibility ? 2 : 1); wFooter->resize(COLS, Config.statusbar_visibility ? 2 : 1);
ApplyToVisibleWindows(&BasicScreen::Refresh); applyToVisibleWindows(&BasicScreen::refresh);
Status::Changes::elapsedTime(); Status::Changes::elapsedTime();
if (!Mpd.isPlaying()) if (!Mpd.isPlaying())
@@ -349,21 +349,21 @@ void Action::ListsChangeFinisher()
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
) )
{ {
if (myScreen->ActiveWindow() == myLibrary->Tags) if (myScreen->activeWindow() == myLibrary->Tags)
{ {
myLibrary->Albums->clear(); myLibrary->Albums->clear();
myLibrary->Songs->clear(); myLibrary->Songs->clear();
} }
else if (myScreen->ActiveWindow() == myLibrary->Albums) else if (myScreen->activeWindow() == myLibrary->Albums)
{ {
myLibrary->Songs->clear(); myLibrary->Songs->clear();
} }
else if (myScreen->ActiveWindow() == myPlaylistEditor->Playlists) else if (myScreen->activeWindow() == myPlaylistEditor->Playlists)
{ {
myPlaylistEditor->Content->clear(); myPlaylistEditor->Content->clear();
} }
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
else if (myScreen->ActiveWindow() == myTagEditor->Dirs) else if (myScreen->activeWindow() == myTagEditor->Dirs)
{ {
myTagEditor->Tags->clear(); myTagEditor->Tags->clear();
} }
@@ -482,18 +482,18 @@ void MouseEvent::Run()
Mpd.SetVolume(Mpd.GetVolume()+2); Mpd.SetVolume(Mpd.GetVolume()+2);
} }
else if (itsMouseEvent.bstate & (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED)) else if (itsMouseEvent.bstate & (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED))
myScreen->MouseButtonPressed(itsMouseEvent); myScreen->mouseButtonPressed(itsMouseEvent);
} }
void ScrollUp::Run() void ScrollUp::Run()
{ {
myScreen->Scroll(NC::wUp); myScreen->scroll(NC::wUp);
ListsChangeFinisher(); ListsChangeFinisher();
} }
void ScrollDown::Run() void ScrollDown::Run()
{ {
myScreen->Scroll(NC::wDown); myScreen->scroll(NC::wDown);
ListsChangeFinisher(); ListsChangeFinisher();
} }
@@ -591,25 +591,25 @@ void ScrollDownAlbum::Run()
void PageUp::Run() void PageUp::Run()
{ {
myScreen->Scroll(NC::wPageUp); myScreen->scroll(NC::wPageUp);
ListsChangeFinisher(); ListsChangeFinisher();
} }
void PageDown::Run() void PageDown::Run()
{ {
myScreen->Scroll(NC::wPageDown); myScreen->scroll(NC::wPageDown);
ListsChangeFinisher(); ListsChangeFinisher();
} }
void MoveHome::Run() void MoveHome::Run()
{ {
myScreen->Scroll(NC::wHome); myScreen->scroll(NC::wHome);
ListsChangeFinisher(); ListsChangeFinisher();
} }
void MoveEnd::Run() void MoveEnd::Run()
{ {
myScreen->Scroll(NC::wEnd); myScreen->scroll(NC::wEnd);
ListsChangeFinisher(); ListsChangeFinisher();
} }
@@ -630,7 +630,7 @@ bool JumpToParentDirectory::canBeRun() const
{ {
return (myScreen == myBrowser) return (myScreen == myBrowser)
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
|| (myScreen->ActiveWindow() == myTagEditor->Dirs) || (myScreen->activeWindow() == myTagEditor->Dirs)
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
; ;
} }
@@ -641,8 +641,8 @@ void JumpToParentDirectory::Run()
{ {
if (myBrowser->CurrentDir() != "/") if (myBrowser->CurrentDir() != "/")
{ {
myBrowser->Main()->reset(); myBrowser->main()->reset();
myBrowser->EnterPressed(); myBrowser->enterPressed();
} }
} }
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
@@ -651,7 +651,7 @@ void JumpToParentDirectory::Run()
if (myTagEditor->CurrentDir() != "/") if (myTagEditor->CurrentDir() != "/")
{ {
myTagEditor->Dirs->reset(); myTagEditor->Dirs->reset();
myTagEditor->EnterPressed(); myTagEditor->enterPressed();
} }
} }
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
@@ -659,12 +659,12 @@ void JumpToParentDirectory::Run()
void PressEnter::Run() void PressEnter::Run()
{ {
myScreen->EnterPressed(); myScreen->enterPressed();
} }
void PressSpace::Run() void PressSpace::Run()
{ {
myScreen->SpacePressed(); myScreen->spacePressed();
} }
bool PreviousColumn::canBeRun() const bool PreviousColumn::canBeRun() const
@@ -751,17 +751,17 @@ void Delete::Run()
Statusbar::msg("Item(s) deleted"); Statusbar::msg("Item(s) deleted");
} }
# ifndef WIN32 # ifndef WIN32
else if (myScreen == myBrowser && !myBrowser->Main()->empty()) else if (myScreen == myBrowser && !myBrowser->main()->empty())
{ {
if (!myBrowser->isLocal() && !isMPDMusicDirSet()) if (!myBrowser->isLocal() && !isMPDMusicDirSet())
return; return;
std::string question; std::string question;
if (myBrowser->Main()->hasSelected()) if (myBrowser->main()->hasSelected())
question = "Delete selected items?"; question = "Delete selected items?";
else else
{ {
MPD::Item &item = myBrowser->Main()->current().value(); MPD::Item &item = myBrowser->main()->current().value();
std::string name = item.type == MPD::itSong ? item.song->getName() : item.name; std::string name = item.type == MPD::itSong ? item.song->getName() : item.name;
question = "Delete "; question = "Delete ";
question += itemTypeToString(item.type); question += itemTypeToString(item.type);
@@ -773,7 +773,7 @@ void Delete::Run()
if (yes) if (yes)
{ {
bool success = true; bool success = true;
auto list = getSelectedOrCurrent(myBrowser->Main()->begin(), myBrowser->Main()->end(), myBrowser->Main()->currentI()); auto list = getSelectedOrCurrent(myBrowser->main()->begin(), myBrowser->main()->end(), myBrowser->main()->currentI());
for (auto it = list.begin(); it != list.end(); ++it) for (auto it = list.begin(); it != list.end(); ++it)
{ {
const MPD::Item &i = (*it)->value(); const MPD::Item &i = (*it)->value();
@@ -803,7 +803,7 @@ void Delete::Run()
# endif // !WIN32 # endif // !WIN32
else if (myScreen == myPlaylistEditor && !myPlaylistEditor->Content->empty()) else if (myScreen == myPlaylistEditor && !myPlaylistEditor->Content->empty())
{ {
if (myScreen->ActiveWindow() == myPlaylistEditor->Playlists) if (myScreen->activeWindow() == myPlaylistEditor->Playlists)
{ {
std::string question; std::string question;
if (myPlaylistEditor->Playlists->hasSelected()) if (myPlaylistEditor->Playlists->hasSelected())
@@ -827,7 +827,7 @@ void Delete::Run()
else else
Statusbar::msg("Aborted"); Statusbar::msg("Aborted");
} }
else if (myScreen->ActiveWindow() == myPlaylistEditor->Content) else if (myScreen->activeWindow() == myPlaylistEditor->Content)
{ {
std::string playlist = myPlaylistEditor->Playlists->current().value(); std::string playlist = myPlaylistEditor->Playlists->current().value();
auto delete_fun = std::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2); auto delete_fun = std::bind(&MPD::Connection::PlaylistDelete, _1, playlist, _2);
@@ -889,7 +889,7 @@ void SavePlaylist::Run()
if (result == MPD_ERROR_SUCCESS) if (result == MPD_ERROR_SUCCESS)
{ {
Statusbar::msg("Playlist saved as \"%s\"", playlist_name.c_str()); Statusbar::msg("Playlist saved as \"%s\"", playlist_name.c_str());
if (myPlaylistEditor->Main()) // check if initialized if (myPlaylistEditor->main()) // check if initialized
myPlaylistEditor->Playlists->clear(); // make playlist's list update itself myPlaylistEditor->Playlists->clear(); // make playlist's list update itself
} }
else if (result == MPD_SERVER_ERROR_EXIST) else if (result == MPD_SERVER_ERROR_EXIST)
@@ -903,17 +903,17 @@ void SavePlaylist::Run()
} }
else else
Statusbar::msg("Aborted"); Statusbar::msg("Aborted");
if (myPlaylistEditor->Main()) // check if initialized if (myPlaylistEditor->main()) // check if initialized
myPlaylistEditor->Playlists->clear(); // make playlist's list update itself myPlaylistEditor->Playlists->clear(); // make playlist's list update itself
if (myScreen == myPlaylist) if (myScreen == myPlaylist)
myPlaylist->EnableHighlighting(); myPlaylist->EnableHighlighting();
} }
} }
} }
if (myBrowser->Main() if (myBrowser->main()
&& !myBrowser->isLocal() && !myBrowser->isLocal()
&& myBrowser->CurrentDir() == "/" && myBrowser->CurrentDir() == "/"
&& !myBrowser->Main()->empty()) && !myBrowser->main()->empty())
myBrowser->GetDirectory(myBrowser->CurrentDir()); myBrowser->GetDirectory(myBrowser->CurrentDir());
} }
@@ -946,10 +946,10 @@ void MoveSortOrderDown::Run()
bool MoveSelectedItemsUp::canBeRun() const bool MoveSelectedItemsUp::canBeRun() const
{ {
return ((myScreen->ActiveWindow() == myPlaylist->Items return ((myScreen->activeWindow() == myPlaylist->Items
&& !myPlaylist->Items->empty() && !myPlaylist->Items->empty()
&& !myPlaylist->isFiltered()) && !myPlaylist->isFiltered())
|| (myScreen->ActiveWindow() == myPlaylistEditor->Content || (myScreen->activeWindow() == myPlaylistEditor->Content
&& !myPlaylistEditor->Content->empty() && !myPlaylistEditor->Content->empty()
&& !myPlaylistEditor->isContentFiltered())); && !myPlaylistEditor->isContentFiltered()));
} }
@@ -971,10 +971,10 @@ void MoveSelectedItemsUp::Run()
bool MoveSelectedItemsDown::canBeRun() const bool MoveSelectedItemsDown::canBeRun() const
{ {
return ((myScreen->ActiveWindow() == myPlaylist->Items return ((myScreen->activeWindow() == myPlaylist->Items
&& !myPlaylist->Items->empty() && !myPlaylist->Items->empty()
&& !myPlaylist->isFiltered()) && !myPlaylist->isFiltered())
|| (myScreen->ActiveWindow() == myPlaylistEditor->Content || (myScreen->activeWindow() == myPlaylistEditor->Content
&& !myPlaylistEditor->Content->empty() && !myPlaylistEditor->Content->empty()
&& !myPlaylistEditor->isContentFiltered())); && !myPlaylistEditor->isContentFiltered()));
} }
@@ -996,8 +996,8 @@ void MoveSelectedItemsDown::Run()
bool MoveSelectedItemsTo::canBeRun() const bool MoveSelectedItemsTo::canBeRun() const
{ {
return myScreen->ActiveWindow() == myPlaylist->Items return myScreen->activeWindow() == myPlaylist->Items
|| myScreen->ActiveWindow() == myPlaylistEditor->Content; || myScreen->activeWindow() == myPlaylistEditor->Content;
} }
void MoveSelectedItemsTo::Run() void MoveSelectedItemsTo::Run()
@@ -1074,7 +1074,7 @@ bool ToggleDisplayMode::canBeRun() const
return myScreen == myPlaylist return myScreen == myPlaylist
|| myScreen == myBrowser || myScreen == myBrowser
|| myScreen == mySearcher || myScreen == mySearcher
|| myScreen->ActiveWindow() == myPlaylistEditor->Content; || myScreen->activeWindow() == myPlaylistEditor->Content;
} }
void ToggleDisplayMode::Run() void ToggleDisplayMode::Run()
@@ -1102,16 +1102,16 @@ void ToggleDisplayMode::Run()
{ {
Config.columns_in_browser = !Config.columns_in_browser; Config.columns_in_browser = !Config.columns_in_browser;
Statusbar::msg("Browser display mode: %s", Config.columns_in_browser ? "Columns" : "Classic"); Statusbar::msg("Browser display mode: %s", Config.columns_in_browser ? "Columns" : "Classic");
myBrowser->Main()->setTitle(Config.columns_in_browser && Config.titles_visibility ? Display::Columns(myBrowser->Main()->getWidth()) : ""); myBrowser->main()->setTitle(Config.columns_in_browser && Config.titles_visibility ? Display::Columns(myBrowser->main()->getWidth()) : "");
} }
else if (myScreen == mySearcher) else if (myScreen == mySearcher)
{ {
Config.columns_in_search_engine = !Config.columns_in_search_engine; Config.columns_in_search_engine = !Config.columns_in_search_engine;
Statusbar::msg("Search engine display mode: %s", Config.columns_in_search_engine ? "Columns" : "Classic"); Statusbar::msg("Search engine display mode: %s", Config.columns_in_search_engine ? "Columns" : "Classic");
if (mySearcher->Main()->size() > SearchEngine::StaticOptions) if (mySearcher->main()->size() > SearchEngine::StaticOptions)
mySearcher->Main()->setTitle(Config.columns_in_search_engine && Config.titles_visibility ? Display::Columns(mySearcher->Main()->getWidth()) : ""); mySearcher->main()->setTitle(Config.columns_in_search_engine && Config.titles_visibility ? Display::Columns(mySearcher->main()->getWidth()) : "");
} }
else if (myScreen->ActiveWindow() == myPlaylistEditor->Content) else if (myScreen->activeWindow() == myPlaylistEditor->Content)
{ {
Config.columns_in_playlist_editor = !Config.columns_in_playlist_editor; Config.columns_in_playlist_editor = !Config.columns_in_playlist_editor;
Statusbar::msg("Playlist editor display mode: %s", Config.columns_in_playlist_editor ? "Columns" : "Classic"); Statusbar::msg("Playlist editor display mode: %s", Config.columns_in_playlist_editor ? "Columns" : "Classic");
@@ -1222,23 +1222,23 @@ void ToggleRandom::Run()
bool StartSearching::canBeRun() const bool StartSearching::canBeRun() const
{ {
return myScreen == mySearcher && !mySearcher->Main()->at(0).isInactive(); return myScreen == mySearcher && !mySearcher->main()->at(0).isInactive();
} }
void StartSearching::Run() void StartSearching::Run()
{ {
mySearcher->Main()->highlight(SearchEngine::SearchButton); mySearcher->main()->highlight(SearchEngine::SearchButton);
mySearcher->Main()->setHighlighting(0); mySearcher->main()->setHighlighting(0);
mySearcher->Main()->refresh(); mySearcher->main()->refresh();
mySearcher->Main()->setHighlighting(1); mySearcher->main()->setHighlighting(1);
mySearcher->EnterPressed(); mySearcher->enterPressed();
} }
bool SaveTagChanges::canBeRun() const bool SaveTagChanges::canBeRun() const
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
return myScreen == myTinyTagEditor return myScreen == myTinyTagEditor
|| myScreen->ActiveWindow() == myTagEditor->TagTypes; || myScreen->activeWindow() == myTagEditor->TagTypes;
# else # else
return false; return false;
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
@@ -1249,13 +1249,13 @@ void SaveTagChanges::Run()
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
if (myScreen == myTinyTagEditor) if (myScreen == myTinyTagEditor)
{ {
myTinyTagEditor->Main()->highlight(myTinyTagEditor->Main()->size()-2); // Save myTinyTagEditor->main()->highlight(myTinyTagEditor->main()->size()-2); // Save
myTinyTagEditor->EnterPressed(); myTinyTagEditor->enterPressed();
} }
else if (myScreen->ActiveWindow() == myTagEditor->TagTypes) else if (myScreen->activeWindow() == myTagEditor->TagTypes)
{ {
myTagEditor->TagTypes->highlight(myTagEditor->TagTypes->size()-1); // Save myTagEditor->TagTypes->highlight(myTagEditor->TagTypes->size()-1); // Save
myTagEditor->EnterPressed(); myTagEditor->enterPressed();
} }
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
} }
@@ -1305,7 +1305,7 @@ void EditSong::Run()
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
auto s = currentSong(myScreen); auto s = currentSong(myScreen);
myTinyTagEditor->SetEdited(*s); myTinyTagEditor->SetEdited(*s);
myTinyTagEditor->SwitchTo(); myTinyTagEditor->switchTo();
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
} }
@@ -1313,7 +1313,7 @@ bool EditLibraryTag::canBeRun() const
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
return isMPDMusicDirSet() return isMPDMusicDirSet()
&& myScreen->ActiveWindow() == myLibrary->Tags && myScreen->activeWindow() == myLibrary->Tags
&& !myLibrary->Tags->empty(); && !myLibrary->Tags->empty();
# else # else
return false; return false;
@@ -1365,7 +1365,7 @@ bool EditLibraryAlbum::canBeRun() const
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
return isMPDMusicDirSet() return isMPDMusicDirSet()
&& myScreen->ActiveWindow() == myLibrary->Albums && myScreen->activeWindow() == myLibrary->Albums
&& !myLibrary->Albums->empty(); && !myLibrary->Albums->empty();
# else # else
return false; return false;
@@ -1419,10 +1419,10 @@ bool EditDirectoryName::canBeRun() const
{ {
return isMPDMusicDirSet() return isMPDMusicDirSet()
&& ((myScreen == myBrowser && ((myScreen == myBrowser
&& !myBrowser->Main()->empty() && !myBrowser->main()->empty()
&& myBrowser->Main()->current().value().type == MPD::itDirectory) && myBrowser->main()->current().value().type == MPD::itDirectory)
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
|| (myScreen->ActiveWindow() == myTagEditor->Dirs || (myScreen->activeWindow() == myTagEditor->Dirs
&& !myTagEditor->Dirs->empty() && !myTagEditor->Dirs->empty()
&& myTagEditor->Dirs->choice() > 0) && myTagEditor->Dirs->choice() > 0)
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
@@ -1435,7 +1435,7 @@ void EditDirectoryName::Run()
if (myScreen == myBrowser) if (myScreen == myBrowser)
{ {
std::string old_dir = myBrowser->Main()->current().value().name; std::string old_dir = myBrowser->main()->current().value().name;
Statusbar::lock(); Statusbar::lock();
Statusbar::put() << NC::fmtBold << "Directory: " << NC::fmtBoldEnd; Statusbar::put() << NC::fmtBold << "Directory: " << NC::fmtBoldEnd;
std::string new_dir = wFooter->getString(old_dir); std::string new_dir = wFooter->getString(old_dir);
@@ -1467,7 +1467,7 @@ void EditDirectoryName::Run()
} }
} }
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
else if (myScreen->ActiveWindow() == myTagEditor->Dirs) else if (myScreen->activeWindow() == myTagEditor->Dirs)
{ {
std::string old_dir = myTagEditor->Dirs->current().value().first; std::string old_dir = myTagEditor->Dirs->current().value().first;
Statusbar::lock(); Statusbar::lock();
@@ -1496,11 +1496,11 @@ void EditDirectoryName::Run()
bool EditPlaylistName::canBeRun() const bool EditPlaylistName::canBeRun() const
{ {
return (myScreen->ActiveWindow() == myPlaylistEditor->Playlists return (myScreen->activeWindow() == myPlaylistEditor->Playlists
&& !myPlaylistEditor->Playlists->empty()) && !myPlaylistEditor->Playlists->empty())
|| (myScreen == myBrowser || (myScreen == myBrowser
&& !myBrowser->Main()->empty() && !myBrowser->main()->empty()
&& myBrowser->Main()->current().value().type == MPD::itPlaylist); && myBrowser->main()->current().value().type == MPD::itPlaylist);
} }
void EditPlaylistName::Run() void EditPlaylistName::Run()
@@ -1508,10 +1508,10 @@ void EditPlaylistName::Run()
using Global::wFooter; using Global::wFooter;
std::string old_name; std::string old_name;
if (myScreen->ActiveWindow() == myPlaylistEditor->Playlists) if (myScreen->activeWindow() == myPlaylistEditor->Playlists)
old_name = myPlaylistEditor->Playlists->current().value(); old_name = myPlaylistEditor->Playlists->current().value();
else else
old_name = myBrowser->Main()->current().value().name; old_name = myBrowser->main()->current().value().name;
Statusbar::lock(); Statusbar::lock();
Statusbar::put() << NC::fmtBold << "Playlist: " << NC::fmtBoldEnd; Statusbar::put() << NC::fmtBold << "Playlist: " << NC::fmtBoldEnd;
std::string new_name = wFooter->getString(old_name); std::string new_name = wFooter->getString(old_name);
@@ -1522,9 +1522,9 @@ void EditPlaylistName::Run()
{ {
const char msg[] = "Playlist renamed to \"%ls\""; const char msg[] = "Playlist renamed to \"%ls\"";
Statusbar::msg(msg, wideShorten(ToWString(new_name), COLS-const_strlen(msg)).c_str()); Statusbar::msg(msg, wideShorten(ToWString(new_name), COLS-const_strlen(msg)).c_str());
if (myBrowser->Main() && !myBrowser->isLocal()) if (myBrowser->main() && !myBrowser->isLocal())
myBrowser->GetDirectory("/"); myBrowser->GetDirectory("/");
if (myPlaylistEditor->Main()) if (myPlaylistEditor->main())
myPlaylistEditor->Playlists->clear(); myPlaylistEditor->Playlists->clear();
} }
} }
@@ -1565,12 +1565,12 @@ void JumpToMediaLibrary::Run()
bool JumpToPlaylistEditor::canBeRun() const bool JumpToPlaylistEditor::canBeRun() const
{ {
return myScreen == myBrowser return myScreen == myBrowser
&& myBrowser->Main()->current().value().type == MPD::itPlaylist; && myBrowser->main()->current().value().type == MPD::itPlaylist;
} }
void JumpToPlaylistEditor::Run() void JumpToPlaylistEditor::Run()
{ {
myPlaylistEditor->Locate(myBrowser->Main()->current().value().name); myPlaylistEditor->Locate(myBrowser->main()->current().value().name);
} }
void ToggleScreenLock::Run() void ToggleScreenLock::Run()
@@ -1580,9 +1580,9 @@ void ToggleScreenLock::Run()
if (myLockedScreen != 0) if (myLockedScreen != 0)
{ {
BasicScreen::Unlock(); BasicScreen::unlock();
Action::SetResizeFlags(); Action::SetResizeFlags();
myScreen->Resize(); myScreen->resize();
Statusbar::msg("Screen unlocked"); Statusbar::msg("Screen unlocked");
} }
else else
@@ -1604,7 +1604,7 @@ void ToggleScreenLock::Run()
return; return;
} }
Config.locked_screen_width_part = part/100.0; Config.locked_screen_width_part = part/100.0;
if (myScreen->Lock()) if (myScreen->lock())
Statusbar::msg("Screen locked (with %d%% width)", part); Statusbar::msg("Screen locked (with %d%% width)", part);
else else
Statusbar::msg("Current screen can't be locked"); Statusbar::msg("Current screen can't be locked");
@@ -1740,7 +1740,7 @@ void SelectAlbum::Run()
void AddSelectedItems::Run() void AddSelectedItems::Run()
{ {
mySelectedItemsAdder->SwitchTo(); mySelectedItemsAdder->switchTo();
} }
void CropMainPlaylist::Run() void CropMainPlaylist::Run()
@@ -1893,9 +1893,9 @@ void Find::Run()
Statusbar::msg("Searching..."); Statusbar::msg("Searching...");
Screen<NC::Scrollpad> *s = static_cast<Screen<NC::Scrollpad> *>(myScreen); Screen<NC::Scrollpad> *s = static_cast<Screen<NC::Scrollpad> *>(myScreen);
s->Main()->removeFormatting(); s->main()->removeFormatting();
Statusbar::msg("%s", findme.empty() || s->Main()->setFormatting(NC::fmtReverse, ToWString(findme), NC::fmtReverseEnd, 0) ? "Done" : "No matching patterns found"); Statusbar::msg("%s", findme.empty() || s->main()->setFormatting(NC::fmtReverse, ToWString(findme), NC::fmtReverseEnd, 0) ? "Done" : "No matching patterns found");
s->Main()->flush(); s->main()->flush();
} }
bool FindItemBackward::canBeRun() const bool FindItemBackward::canBeRun() const
@@ -2056,14 +2056,14 @@ void ToggleBrowserSortMode::Run()
Statusbar::msg("Sort songs by: Name"); Statusbar::msg("Sort songs by: Name");
break; break;
} }
std::sort(myBrowser->Main()->begin()+(myBrowser->CurrentDir() != "/"), myBrowser->Main()->end(), std::sort(myBrowser->main()->begin()+(myBrowser->CurrentDir() != "/"), myBrowser->main()->end(),
LocaleBasedItemSorting(std::locale(), Config.ignore_leading_the, Config.browser_sort_mode)); LocaleBasedItemSorting(std::locale(), Config.ignore_leading_the, Config.browser_sort_mode));
} }
bool ToggleLibraryTagType::canBeRun() const bool ToggleLibraryTagType::canBeRun() const
{ {
return (myScreen->ActiveWindow() == myLibrary->Tags) return (myScreen->activeWindow() == myLibrary->Tags)
|| (myLibrary->Columns() == 2 && myScreen->ActiveWindow() == myLibrary->Albums); || (myLibrary->Columns() == 2 && myScreen->activeWindow() == myLibrary->Albums);
} }
void ToggleLibraryTagType::Run() void ToggleLibraryTagType::Run()
@@ -2145,7 +2145,7 @@ bool SetSelectedItemsPriority::canBeRun() const
Statusbar::msg("Priorities are supported in MPD >= 0.17.0"); Statusbar::msg("Priorities are supported in MPD >= 0.17.0");
return false; return false;
} }
return myScreen->ActiveWindow() == myPlaylist->Items && !myPlaylist->Items->empty(); return myScreen->activeWindow() == myPlaylist->Items && !myPlaylist->Items->empty();
} }
void SetSelectedItemsPriority::Run() void SetSelectedItemsPriority::Run()
@@ -2169,7 +2169,7 @@ void SetSelectedItemsPriority::Run()
bool FilterPlaylistOnPriorities::canBeRun() const bool FilterPlaylistOnPriorities::canBeRun() const
{ {
return myScreen->ActiveWindow() == myPlaylist->Items; return myScreen->activeWindow() == myPlaylist->Items;
} }
void FilterPlaylistOnPriorities::Run() void FilterPlaylistOnPriorities::Run()
@@ -2192,14 +2192,14 @@ void FilterPlaylistOnPriorities::Run()
void ShowSongInfo::Run() void ShowSongInfo::Run()
{ {
mySongInfo->SwitchTo(); mySongInfo->switchTo();
} }
bool ShowArtistInfo::canBeRun() const bool ShowArtistInfo::canBeRun() const
{ {
#ifdef HAVE_CURL_CURL_H #ifdef HAVE_CURL_CURL_H
return myScreen == myLastfm return myScreen == myLastfm
|| (myScreen->ActiveWindow() == myLibrary->Tags || (myScreen->activeWindow() == myLibrary->Tags
&& !myLibrary->Tags->empty() && !myLibrary->Tags->empty()
&& Config.media_lib_primary_tag == MPD_TAG_ARTIST) && Config.media_lib_primary_tag == MPD_TAG_ARTIST)
|| currentSong(myScreen); || currentSong(myScreen);
@@ -2213,12 +2213,12 @@ void ShowArtistInfo::Run()
# ifdef HAVE_CURL_CURL_H # ifdef HAVE_CURL_CURL_H
if (myScreen == myLastfm || myLastfm->isDownloading()) if (myScreen == myLastfm || myLastfm->isDownloading())
{ {
myLastfm->SwitchTo(); myLastfm->switchTo();
return; return;
} }
std::string artist; std::string artist;
if (myScreen->ActiveWindow() == myLibrary->Tags) if (myScreen->activeWindow() == myLibrary->Tags)
{ {
assert(!myLibrary->Tags->empty()); assert(!myLibrary->Tags->empty());
assert(Config.media_lib_primary_tag == MPD_TAG_ARTIST); assert(Config.media_lib_primary_tag == MPD_TAG_ARTIST);
@@ -2232,13 +2232,13 @@ void ShowArtistInfo::Run()
} }
if (!artist.empty() && myLastfm->SetArtistInfoArgs(artist, Config.lastfm_preferred_language)) if (!artist.empty() && myLastfm->SetArtistInfoArgs(artist, Config.lastfm_preferred_language))
myLastfm->SwitchTo(); myLastfm->switchTo();
# endif // HAVE_CURL_CURL_H # endif // HAVE_CURL_CURL_H
} }
void ShowLyrics::Run() void ShowLyrics::Run()
{ {
myLyrics->SwitchTo(); myLyrics->switchTo();
} }
void Quit::Run() void Quit::Run()
@@ -2254,17 +2254,17 @@ void NextScreen::Run()
if (Config.screen_switcher_previous) if (Config.screen_switcher_previous)
{ {
if (myScreen->isTabbable()) if (myScreen->isTabbable())
myPrevScreen->SwitchTo(); myPrevScreen->switchTo();
else else
myOldScreen->SwitchTo(); myOldScreen->switchTo();
} }
else if (!Config.screens_seq.empty()) else if (!Config.screens_seq.empty())
{ {
std::list<BasicScreen *>::const_iterator screen = std::find(Config.screens_seq.begin(), Config.screens_seq.end(), myScreen); std::list<BasicScreen *>::const_iterator screen = std::find(Config.screens_seq.begin(), Config.screens_seq.end(), myScreen);
if (++screen == Config.screens_seq.end()) if (++screen == Config.screens_seq.end())
Config.screens_seq.front()->SwitchTo(); Config.screens_seq.front()->switchTo();
else else
(*screen)->SwitchTo(); (*screen)->switchTo();
} }
} }
@@ -2276,17 +2276,17 @@ void PreviousScreen::Run()
if (Config.screen_switcher_previous) if (Config.screen_switcher_previous)
{ {
if (myScreen->isTabbable()) if (myScreen->isTabbable())
myPrevScreen->SwitchTo(); myPrevScreen->switchTo();
else else
myOldScreen->SwitchTo(); myOldScreen->switchTo();
} }
else if (!Config.screens_seq.empty()) else if (!Config.screens_seq.empty())
{ {
std::list<BasicScreen *>::const_iterator screen = std::find(Config.screens_seq.begin(), Config.screens_seq.end(), myScreen); std::list<BasicScreen *>::const_iterator screen = std::find(Config.screens_seq.begin(), Config.screens_seq.end(), myScreen);
if (screen == Config.screens_seq.begin()) if (screen == Config.screens_seq.begin())
Config.screens_seq.back()->SwitchTo(); Config.screens_seq.back()->switchTo();
else else
(*--screen)->SwitchTo(); (*--screen)->switchTo();
} }
} }
@@ -2299,7 +2299,7 @@ bool ShowHelp::canBeRun() const
void ShowHelp::Run() void ShowHelp::Run()
{ {
myHelp->SwitchTo(); myHelp->switchTo();
} }
#ifdef HAVE_TAGLIB_H #ifdef HAVE_TAGLIB_H
@@ -2311,7 +2311,7 @@ bool ShowPlaylist::canBeRun() const
void ShowPlaylist::Run() void ShowPlaylist::Run()
{ {
myPlaylist->SwitchTo(); myPlaylist->switchTo();
} }
#ifdef HAVE_TAGLIB_H #ifdef HAVE_TAGLIB_H
@@ -2323,7 +2323,7 @@ bool ShowBrowser::canBeRun() const
void ShowBrowser::Run() void ShowBrowser::Run()
{ {
myBrowser->SwitchTo(); myBrowser->switchTo();
} }
#ifdef HAVE_TAGLIB_H #ifdef HAVE_TAGLIB_H
@@ -2335,7 +2335,7 @@ bool ShowSearchEngine::canBeRun() const
void ShowSearchEngine::Run() void ShowSearchEngine::Run()
{ {
mySearcher->SwitchTo(); mySearcher->switchTo();
} }
#ifdef HAVE_TAGLIB_H #ifdef HAVE_TAGLIB_H
@@ -2347,7 +2347,7 @@ bool ShowMediaLibrary::canBeRun() const
void ShowMediaLibrary::Run() void ShowMediaLibrary::Run()
{ {
myLibrary->SwitchTo(); myLibrary->switchTo();
} }
#ifdef HAVE_TAGLIB_H #ifdef HAVE_TAGLIB_H
@@ -2359,7 +2359,7 @@ bool ShowPlaylistEditor::canBeRun() const
void ShowPlaylistEditor::Run() void ShowPlaylistEditor::Run()
{ {
myPlaylistEditor->SwitchTo(); myPlaylistEditor->switchTo();
} }
bool ShowTagEditor::canBeRun() const bool ShowTagEditor::canBeRun() const
@@ -2375,7 +2375,7 @@ void ShowTagEditor::Run()
{ {
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
if (isMPDMusicDirSet()) if (isMPDMusicDirSet())
myTagEditor->SwitchTo(); myTagEditor->switchTo();
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
} }
@@ -2395,7 +2395,7 @@ bool ShowOutputs::canBeRun() const
void ShowOutputs::Run() void ShowOutputs::Run()
{ {
# ifdef ENABLE_OUTPUTS # ifdef ENABLE_OUTPUTS
myOutputs->SwitchTo(); myOutputs->switchTo();
# endif // ENABLE_OUTPUTS # endif // ENABLE_OUTPUTS
} }
@@ -2415,7 +2415,7 @@ bool ShowVisualizer::canBeRun() const
void ShowVisualizer::Run() void ShowVisualizer::Run()
{ {
# ifdef ENABLE_VISUALIZER # ifdef ENABLE_VISUALIZER
myVisualizer->SwitchTo(); myVisualizer->switchTo();
# endif // ENABLE_VISUALIZER # endif // ENABLE_VISUALIZER
} }
@@ -2435,7 +2435,7 @@ bool ShowClock::canBeRun() const
void ShowClock::Run() void ShowClock::Run()
{ {
# ifdef ENABLE_CLOCK # ifdef ENABLE_CLOCK
myClock->SwitchTo(); myClock->switchTo();
# endif // ENABLE_CLOCK # endif // ENABLE_CLOCK
} }
@@ -2448,7 +2448,7 @@ bool ShowServerInfo::canBeRun() const
void ShowServerInfo::Run() void ShowServerInfo::Run()
{ {
myServerInfo->SwitchTo(); myServerInfo->switchTo();
} }
namespace {// namespace {//

View File

@@ -61,7 +61,7 @@ bool BrowserEntryMatcher(const Regex &rx, const MPD::Item &item, bool filter);
} }
void Browser::Init() void Browser::init()
{ {
w = new NC::Menu<MPD::Item>(0, MainStartY, COLS, MainHeight, Config.columns_in_browser && Config.titles_visibility ? Display::Columns(COLS) : "", Config.main_color, NC::brNone); w = new NC::Menu<MPD::Item>(0, MainStartY, COLS, MainHeight, Config.columns_in_browser && Config.titles_visibility ? Display::Columns(COLS) : "", Config.main_color, NC::brNone);
w->setHighlightColor(Config.main_highlight_color); w->setHighlightColor(Config.main_highlight_color);
@@ -77,17 +77,17 @@ void Browser::Init()
isInitialized = 1; isInitialized = 1;
} }
void Browser::Resize() void Browser::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
w->setTitle(Config.columns_in_browser && Config.titles_visibility ? Display::Columns(w->getWidth()) : ""); w->setTitle(Config.columns_in_browser && Config.titles_visibility ? Display::Columns(w->getWidth()) : "");
hasToBeResized = 0; hasToBeResized = 0;
} }
void Browser::SwitchTo() void Browser::switchTo()
{ {
using Global::myLockedScreen; using Global::myLockedScreen;
using Global::myInactiveScreen; using Global::myInactiveScreen;
@@ -100,13 +100,13 @@ void Browser::SwitchTo()
} }
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (isLocal() && Config.browser_sort_mode == smMTime) // local browser doesn't support sorting by mtime if (isLocal() && Config.browser_sort_mode == smMTime) // local browser doesn't support sorting by mtime
Config.browser_sort_mode = smName; Config.browser_sort_mode = smName;
@@ -122,14 +122,14 @@ void Browser::SwitchTo()
drawHeader(); drawHeader();
} }
std::wstring Browser::Title() std::wstring Browser::title()
{ {
std::wstring result = L"Browse: "; std::wstring result = L"Browse: ";
result += Scroller(ToWString(itsBrowsedDir), itsScrollBeginning, COLS-result.length()-(Config.new_design ? 2 : Global::VolumeState.length())); result += Scroller(ToWString(itsBrowsedDir), itsScrollBeginning, COLS-result.length()-(Config.new_design ? 2 : Global::VolumeState.length()));
return result; return result;
} }
void Browser::EnterPressed() void Browser::enterPressed()
{ {
if (w->empty()) if (w->empty())
return; return;
@@ -162,7 +162,7 @@ void Browser::EnterPressed()
} }
} }
void Browser::SpacePressed() void Browser::spacePressed()
{ {
if (w->empty()) if (w->empty())
return; return;
@@ -220,7 +220,7 @@ void Browser::SpacePressed()
w->scroll(NC::wDown); w->scroll(NC::wDown);
} }
void Browser::MouseButtonPressed(MEVENT me) void Browser::mouseButtonPressed(MEVENT me)
{ {
if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size()) if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size())
return; return;
@@ -238,7 +238,7 @@ void Browser::MouseButtonPressed(MEVENT me)
else else
{ {
size_t pos = w->choice(); size_t pos = w->choice();
SpacePressed(); spacePressed();
if (pos < w->size()-1) if (pos < w->size()-1)
w->scroll(NC::wUp); w->scroll(NC::wUp);
} }
@@ -248,17 +248,17 @@ void Browser::MouseButtonPressed(MEVENT me)
if (me.bstate & BUTTON1_PRESSED) if (me.bstate & BUTTON1_PRESSED)
{ {
size_t pos = w->choice(); size_t pos = w->choice();
SpacePressed(); spacePressed();
if (pos < w->size()-1) if (pos < w->size()-1)
w->scroll(NC::wUp); w->scroll(NC::wUp);
} }
else else
EnterPressed(); enterPressed();
break; break;
} }
} }
else else
Screen< NC::Menu<MPD::Item> >::MouseButtonPressed(me); Screen< NC::Menu<MPD::Item> >::mouseButtonPressed(me);
} }
/***********************************************************************/ /***********************************************************************/
@@ -373,7 +373,7 @@ void Browser::LocateSong(const MPD::Song &s)
itsBrowseLocally = !s.isFromDatabase(); itsBrowseLocally = !s.isFromDatabase();
if (myScreen != this) if (myScreen != this)
SwitchTo(); switchTo();
if (itsBrowsedDir != s.getDirectory()) if (itsBrowsedDir != s.getDirectory())
GetDirectory(s.getDirectory()); GetDirectory(s.getDirectory());

View File

@@ -31,16 +31,16 @@ class Browser : public Screen< NC::Menu<MPD::Item> >, public Filterable, public
Browser() : itsBrowseLocally(0), itsScrollBeginning(0), itsBrowsedDir("/") { } Browser() : itsBrowseLocally(0), itsScrollBeginning(0), itsBrowsedDir("/") { }
// Screen< NC::Menu<MPD::Item> > implementation // Screen< NC::Menu<MPD::Item> > implementation
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE; virtual void spacePressed() OVERRIDE;
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
@@ -81,7 +81,7 @@ class Browser : public Screen< NC::Menu<MPD::Item> >, public Filterable, public
} }
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; } virtual bool isLockable() OVERRIDE { return true; }
private: private:

View File

@@ -52,7 +52,7 @@ long Clock::older[6], Clock::next[6], Clock::newer[6], Clock::mask;
size_t Clock::Width; size_t Clock::Width;
const size_t Clock::Height = 8; const size_t Clock::Height = 8;
void Clock::Init() void Clock::init()
{ {
Width = Config.clock_display_seconds ? 60 : 40; Width = Config.clock_display_seconds ? 60 : 40;
@@ -61,10 +61,10 @@ void Clock::Init()
isInitialized = 1; isInitialized = 1;
} }
void Clock::Resize() void Clock::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
// used for clearing area out of clock window while resizing terminal // used for clearing area out of clock window while resizing terminal
itsPane->resize(width, MainHeight); itsPane->resize(width, MainHeight);
@@ -75,7 +75,7 @@ void Clock::Resize()
w->moveTo(x_offset+(width-Width)/2, MainStartY+(MainHeight-Height)/2); w->moveTo(x_offset+(width-Width)/2, MainStartY+(MainHeight-Height)/2);
} }
void Clock::SwitchTo() void Clock::switchTo()
{ {
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -83,23 +83,23 @@ void Clock::SwitchTo()
return; return;
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width, false); getWindowResizeParams(x_offset, width, false);
if (Width > width || Height > MainHeight) if (Width > width || Height > MainHeight)
{ {
Statusbar::msg("Screen is too small to display clock"); Statusbar::msg("Screen is too small to display clock");
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(myLockedScreen); updateInactiveScreen(myLockedScreen);
return; return;
} }
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
@@ -112,12 +112,12 @@ void Clock::SwitchTo()
w->display(); w->display();
} }
std::wstring Clock::Title() std::wstring Clock::title()
{ {
return L"Clock"; return L"Clock";
} }
void Clock::Update() void Clock::update()
{ {
if (Width > itsPane->getWidth() || Height > MainHeight) if (Width > itsPane->getWidth() || Height > MainHeight)
{ {
@@ -128,10 +128,10 @@ void Clock::Update()
{ {
if (myInactiveScreen != myLockedScreen) if (myInactiveScreen != myLockedScreen)
myScreen = myInactiveScreen; myScreen = myInactiveScreen;
myLockedScreen->SwitchTo(); myLockedScreen->switchTo();
} }
else else
myPlaylist->SwitchTo(); myPlaylist->switchTo();
} }
tm *time = localtime(&Global::Timer.tv_sec); tm *time = localtime(&Global::Timer.tv_sec);

View File

@@ -31,24 +31,24 @@
class Clock : public Screen<NC::Window> class Clock : public Screen<NC::Window>
{ {
public: public:
virtual void Resize(); virtual void resize() OVERRIDE;
virtual void SwitchTo(); virtual void switchTo() OVERRIDE;
virtual std::wstring Title(); virtual std::wstring title() OVERRIDE;
virtual void Update(); virtual void update() OVERRIDE;
virtual void Scroll(NC::Where) { } virtual void scroll(NC::Where) OVERRIDE { }
virtual void EnterPressed() { } virtual void enterPressed() OVERRIDE { }
virtual void SpacePressed() { } virtual void spacePressed() OVERRIDE { }
virtual void MouseButtonPressed(MEVENT) { } virtual void mouseButtonPressed(MEVENT) OVERRIDE { }
virtual bool isTabbable() { return true; }
virtual bool isMergable() { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; }
protected: protected:
virtual void Init(); virtual void init() OVERRIDE;
virtual bool isLockable() { return false; } virtual bool isLockable() OVERRIDE { return false; }
private: private:
NC::Window *itsPane; NC::Window *itsPane;

View File

@@ -95,7 +95,7 @@ std::string keyToString(const Key &key, bool *print_backspace)
} }
void Help::Init() void Help::init()
{ {
w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone); w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
GetKeybindings(); GetKeybindings();
@@ -103,16 +103,16 @@ void Help::Init()
isInitialized = 1; isInitialized = 1;
} }
void Help::Resize() void Help::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
hasToBeResized = 0; hasToBeResized = 0;
} }
void Help::SwitchTo() void Help::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -121,13 +121,13 @@ void Help::SwitchTo()
return; return;
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
@@ -135,7 +135,7 @@ void Help::SwitchTo()
drawHeader(); drawHeader();
} }
std::wstring Help::Title() std::wstring Help::title()
{ {
return L"Help"; return L"Help";
} }

View File

@@ -27,21 +27,21 @@
class Help : public Screen<NC::Scrollpad> class Help : public Screen<NC::Scrollpad>
{ {
public: public:
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE { } virtual void enterPressed() OVERRIDE { }
virtual void SpacePressed() OVERRIDE { } virtual void spacePressed() OVERRIDE { }
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; } virtual bool isLockable() OVERRIDE { return true; }
private: private:

View File

@@ -45,27 +45,27 @@ using Global::MainStartY;
Lastfm *myLastfm = new Lastfm; Lastfm *myLastfm = new Lastfm;
void Lastfm::Init() void Lastfm::init()
{ {
w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone); w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
isInitialized = 1; isInitialized = 1;
} }
void Lastfm::Resize() void Lastfm::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring Lastfm::Title() std::wstring Lastfm::title()
{ {
return itsTitle; return itsTitle;
} }
void Lastfm::Update() void Lastfm::update()
{ {
if (isReadyToTake) if (isReadyToTake)
Take(); Take();
@@ -81,23 +81,23 @@ void Lastfm::Take()
isReadyToTake = 0; isReadyToTake = 0;
} }
void Lastfm::SwitchTo() void Lastfm::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myOldScreen; using Global::myOldScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
if (myScreen == this) if (myScreen == this)
return myOldScreen->SwitchTo(); return myOldScreen->switchTo();
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
// get an old info if it waits // get an old info if it waits
if (isReadyToTake) if (isReadyToTake)

View File

@@ -37,15 +37,15 @@ class Lastfm : public Screen<NC::Scrollpad>
Lastfm() : isReadyToTake(0), isDownloadInProgress(0) { } Lastfm() : isReadyToTake(0), isDownloadInProgress(0) { }
// Screen<NC::Scrollpad> // Screen<NC::Scrollpad>
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE; virtual void update() OVERRIDE;
virtual void EnterPressed() OVERRIDE { } virtual void enterPressed() OVERRIDE { }
virtual void SpacePressed() OVERRIDE { } virtual void spacePressed() OVERRIDE { }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
virtual bool isTabbable() OVERRIDE { return false; } virtual bool isTabbable() OVERRIDE { return false; }
@@ -57,7 +57,7 @@ class Lastfm : public Screen<NC::Scrollpad>
bool SetArtistInfoArgs(const std::string &artist, const std::string &lang = ""); bool SetArtistInfoArgs(const std::string &artist, const std::string &lang = "");
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; } virtual bool isLockable() OVERRIDE { return false; }
private: private:

View File

@@ -50,22 +50,22 @@ size_t Lyrics::itsWorkersNumber = 0;
Lyrics *myLyrics = new Lyrics; Lyrics *myLyrics = new Lyrics;
void Lyrics::Init() void Lyrics::init()
{ {
w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone); w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
isInitialized = 1; isInitialized = 1;
} }
void Lyrics::Resize() void Lyrics::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
hasToBeResized = 0; hasToBeResized = 0;
} }
void Lyrics::Update() void Lyrics::update()
{ {
# ifdef HAVE_CURL_CURL_H # ifdef HAVE_CURL_CURL_H
if (isReadyToTake) if (isReadyToTake)
@@ -91,19 +91,19 @@ void Lyrics::Update()
} }
} }
void Lyrics::SwitchTo() void Lyrics::switchTo()
{ {
using Global::myLockedScreen; using Global::myLockedScreen;
using Global::myInactiveScreen; using Global::myInactiveScreen;
if (myScreen == this) if (myScreen == this)
return myOldScreen->SwitchTo(); return myOldScreen->switchTo();
if (!isInitialized) if (!isInitialized)
Init(); init();
if (hasToBeResized) if (hasToBeResized)
Resize(); resize();
itsScrollBegin = 0; itsScrollBegin = 0;
@@ -144,19 +144,19 @@ void Lyrics::SwitchTo()
// to adjust screen size then. // to adjust screen size then.
if (myLockedScreen) // BUG if (myLockedScreen) // BUG
{ {
UpdateInactiveScreen(this); updateInactiveScreen(this);
Resize(); resize();
} }
} }
std::wstring Lyrics::Title() std::wstring Lyrics::title()
{ {
std::wstring result = L"Lyrics: "; std::wstring result = L"Lyrics: ";
result += Scroller(ToWString(itsSong.toString("{%a - %t}", ", ")), itsScrollBegin, COLS-result.length()-(Config.new_design ? 2 : Global::VolumeState.length())); result += Scroller(ToWString(itsSong.toString("{%a - %t}", ", ")), itsScrollBegin, COLS-result.length()-(Config.new_design ? 2 : Global::VolumeState.length()));
return result; return result;
} }
void Lyrics::SpacePressed() void Lyrics::spacePressed()
{ {
Config.now_playing_lyrics = !Config.now_playing_lyrics; Config.now_playing_lyrics = !Config.now_playing_lyrics;
Statusbar::msg("Reload lyrics if song changes: %s", Config.now_playing_lyrics ? "On" : "Off"); Statusbar::msg("Reload lyrics if song changes: %s", Config.now_playing_lyrics ? "On" : "Off");

View File

@@ -38,15 +38,15 @@ class Lyrics : public Screen<NC::Scrollpad>
itsScrollBegin(0) { } itsScrollBegin(0) { }
// Screen<NC::Scrollpad> implementation // Screen<NC::Scrollpad> implementation
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE; virtual void update() OVERRIDE;
virtual void EnterPressed() OVERRIDE { } virtual void enterPressed() OVERRIDE { }
virtual void SpacePressed() OVERRIDE; virtual void spacePressed() OVERRIDE;
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
virtual bool isTabbable() OVERRIDE { return false; } virtual bool isTabbable() OVERRIDE { return false; }
@@ -64,7 +64,7 @@ class Lyrics : public Screen<NC::Scrollpad>
bool ReloadNP; bool ReloadNP;
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; } virtual bool isLockable() OVERRIDE { return false; }
private: private:

View File

@@ -112,7 +112,7 @@ public:
} }
void MediaLibrary::Init() void MediaLibrary::init()
{ {
hasTwoColumns = 0; hasTwoColumns = 0;
itsLeftColWidth = COLS/3-1; itsLeftColWidth = COLS/3-1;
@@ -149,10 +149,10 @@ void MediaLibrary::Init()
isInitialized = 1; isInitialized = 1;
} }
void MediaLibrary::Resize() void MediaLibrary::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
if (!hasTwoColumns) if (!hasTwoColumns)
{ {
itsLeftColStartX = x_offset; itsLeftColStartX = x_offset;
@@ -181,7 +181,7 @@ void MediaLibrary::Resize()
hasToBeResized = 0; hasToBeResized = 0;
} }
void MediaLibrary::Refresh() void MediaLibrary::refresh()
{ {
Tags->display(); Tags->display();
mvvline(MainStartY, itsMiddleColStartX-1, 0, MainHeight); mvvline(MainStartY, itsMiddleColStartX-1, 0, MainHeight);
@@ -195,7 +195,7 @@ void MediaLibrary::Refresh()
} }
} }
void MediaLibrary::SwitchTo() void MediaLibrary::switchTo()
{ {
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -229,28 +229,28 @@ void MediaLibrary::SwitchTo()
} }
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
myScreen = this; myScreen = this;
drawHeader(); drawHeader();
markSongsInPlaylist(songsProxyList()); markSongsInPlaylist(songsProxyList());
Refresh(); refresh();
} }
std::wstring MediaLibrary::Title() std::wstring MediaLibrary::title()
{ {
return L"Media library"; return L"Media library";
} }
void MediaLibrary::Update() void MediaLibrary::update()
{ {
if (!hasTwoColumns && Tags->reallyEmpty()) if (!hasTwoColumns && Tags->reallyEmpty())
{ {
@@ -372,12 +372,12 @@ void MediaLibrary::Update()
} }
} }
void MediaLibrary::EnterPressed() void MediaLibrary::enterPressed()
{ {
AddToPlaylist(true); AddToPlaylist(true);
} }
void MediaLibrary::SpacePressed() void MediaLibrary::spacePressed()
{ {
if (Config.space_selects) if (Config.space_selects)
{ {
@@ -408,7 +408,7 @@ void MediaLibrary::SpacePressed()
AddToPlaylist(0); AddToPlaylist(0);
} }
void MediaLibrary::MouseButtonPressed(MEVENT me) void MediaLibrary::mouseButtonPressed(MEVENT me)
{ {
auto tryNextColumn = [this]() -> bool { auto tryNextColumn = [this]() -> bool {
bool result = true; bool result = true;
@@ -442,13 +442,13 @@ void MediaLibrary::MouseButtonPressed(MEVENT me)
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
{ {
size_t pos = Tags->choice(); size_t pos = Tags->choice();
SpacePressed(); spacePressed();
if (pos < Tags->size()-1) if (pos < Tags->size()-1)
Tags->scroll(NC::wUp); Tags->scroll(NC::wUp);
} }
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
Albums->clear(); Albums->clear();
Songs->clear(); Songs->clear();
} }
@@ -470,13 +470,13 @@ void MediaLibrary::MouseButtonPressed(MEVENT me)
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
{ {
size_t pos = Albums->choice(); size_t pos = Albums->choice();
SpacePressed(); spacePressed();
if (pos < Albums->size()-1) if (pos < Albums->size()-1)
Albums->scroll(NC::wUp); Albums->scroll(NC::wUp);
} }
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
Songs->clear(); Songs->clear();
} }
else if (!Songs->empty() && Songs->hasCoords(me.x, me.y)) else if (!Songs->empty() && Songs->hasCoords(me.x, me.y))
@@ -489,15 +489,15 @@ void MediaLibrary::MouseButtonPressed(MEVENT me)
if (me.bstate & BUTTON1_PRESSED) if (me.bstate & BUTTON1_PRESSED)
{ {
size_t pos = Songs->choice(); size_t pos = Songs->choice();
SpacePressed(); spacePressed();
if (pos < Songs->size()-1) if (pos < Songs->size()-1)
Songs->scroll(NC::wUp); Songs->scroll(NC::wUp);
} }
else else
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
} }
@@ -800,7 +800,7 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
} }
if (myScreen != this) if (myScreen != this)
SwitchTo(); switchTo();
Statusbar::put() << "Jumping to song..."; Statusbar::put() << "Jumping to song...";
Global::wFooter->refresh(); Global::wFooter->refresh();
@@ -808,7 +808,7 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
{ {
Tags->showAll(); Tags->showAll();
if (Tags->empty()) if (Tags->empty())
Update(); update();
if (primary_tag != Tags->current().value()) if (primary_tag != Tags->current().value())
{ {
for (size_t i = 0; i < Tags->size(); ++i) for (size_t i = 0; i < Tags->size(); ++i)
@@ -826,7 +826,7 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
Albums->showAll(); Albums->showAll();
if (Albums->empty()) if (Albums->empty())
Update(); update();
std::string album = s.getAlbum(); std::string album = s.getAlbum();
std::string date = s.getDate(); std::string date = s.getDate();
@@ -849,7 +849,7 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
Songs->showAll(); Songs->showAll();
if (Songs->empty()) if (Songs->empty())
Update(); update();
if (s.getHash() != Songs->current().value().getHash()) if (s.getHash() != Songs->current().value().getHash())
{ {
@@ -867,7 +867,7 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
Albums->setHighlightColor(Config.main_highlight_color); Albums->setHighlightColor(Config.main_highlight_color);
Songs->setHighlightColor(Config.active_column_color); Songs->setHighlightColor(Config.active_column_color);
w = Songs; w = Songs;
Refresh(); refresh();
} }
void MediaLibrary::AddToPlaylist(bool add_n_play) void MediaLibrary::AddToPlaylist(bool add_n_play)

View File

@@ -27,17 +27,17 @@
class MediaLibrary : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable class MediaLibrary : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
{ {
public: public:
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Refresh() OVERRIDE; virtual void refresh() OVERRIDE;
virtual void Update() OVERRIDE; virtual void update() OVERRIDE;
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE; virtual void spacePressed() OVERRIDE;
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
@@ -90,7 +90,7 @@ class MediaLibrary : public Screen<NC::Window>, public Filterable, public HasCol
NC::Menu<MPD::Song> *Songs; NC::Menu<MPD::Song> *Songs;
protected: protected:
virtual void Init(); virtual void init();
virtual bool isLockable() { return true; } virtual bool isLockable() { return true; }
private: private:

View File

@@ -282,12 +282,12 @@ public:
void showFiltered() { m_options_ptr = &m_filtered_options; } void showFiltered() { m_options_ptr = &m_filtered_options; }
/// Refreshes the menu window /// Refreshes the menu window
/// @see Window::Refresh() /// @see Window::refresh()
virtual void refresh() OVERRIDE; virtual void refresh() OVERRIDE;
/// Scrolls by given amount of lines /// Scrolls by given amount of lines
/// @param where indicated where exactly one wants to go /// @param where indicated where exactly one wants to go
/// @see Window::Scroll() /// @see Window::scroll()
virtual void scroll(Where where) OVERRIDE; virtual void scroll(Where where) OVERRIDE;
/// Cleares all options, used filters etc. It doesn't reset highlighted position though. /// Cleares all options, used filters etc. It doesn't reset highlighted position though.
@@ -341,8 +341,8 @@ public:
size_t size() const { return m_options_ptr->size(); } size_t size() const { return m_options_ptr->size(); }
/// @return currently drawn item. The result is defined only within /// @return currently drawn item. The result is defined only within
/// drawing function that is called by Refresh() /// drawing function that is called by refresh()
/// @see Refresh() /// @see refresh()
ConstIterator drawn() const { return begin() + m_drawn_position; } ConstIterator drawn() const { return begin() + m_drawn_position; }
/// @return reference to last item on the list /// @return reference to last item on the list

View File

@@ -173,12 +173,12 @@ int main(int argc, char **argv)
gettimeofday(&Timer, 0); gettimeofday(&Timer, 0);
// go to playlist // go to playlist
myPlaylist->SwitchTo(); myPlaylist->switchTo();
myPlaylist->UpdateTimer(); myPlaylist->UpdateTimer();
// go to startup screen // go to startup screen
if (Config.startup_screen != myScreen) if (Config.startup_screen != myScreen)
Config.startup_screen->SwitchTo(); Config.startup_screen->switchTo();
Mpd.SetStatusUpdater(Status::update, 0); Mpd.SetStatusUpdater(Status::update, 0);
Mpd.SetErrorHandler(Status::handleError, 0); Mpd.SetErrorHandler(Status::handleError, 0);
@@ -247,7 +247,7 @@ int main(int argc, char **argv)
// header stuff end // header stuff end
if (input != Key::noOp) if (input != Key::noOp)
myScreen->RefreshWindow(); myScreen->refreshWindow();
input = Key::read(*wFooter); input = Key::read(*wFooter);
if (input == Key::noOp) if (input == Key::noOp)

View File

@@ -35,7 +35,7 @@ using Global::myScreen;
Outputs *myOutputs = new Outputs; Outputs *myOutputs = new Outputs;
void Outputs::Init() void Outputs::init()
{ {
w = new NC::Menu<MPD::Output>(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone); w = new NC::Menu<MPD::Output>(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
w->cyclicScrolling(Config.use_cyclic_scrolling); w->cyclicScrolling(Config.use_cyclic_scrolling);
@@ -47,7 +47,7 @@ void Outputs::Init()
FetchList(); FetchList();
} }
void Outputs::SwitchTo() void Outputs::switchTo()
{ {
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -55,13 +55,13 @@ void Outputs::SwitchTo()
return; return;
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
@@ -70,21 +70,21 @@ void Outputs::SwitchTo()
drawHeader(); drawHeader();
} }
void Outputs::Resize() void Outputs::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring Outputs::Title() std::wstring Outputs::title()
{ {
return L"Outputs"; return L"Outputs";
} }
void Outputs::EnterPressed() void Outputs::enterPressed()
{ {
if (w->current().value().isEnabled()) if (w->current().value().isEnabled())
{ {
@@ -100,7 +100,7 @@ void Outputs::EnterPressed()
FetchList(); FetchList();
} }
void Outputs::MouseButtonPressed(MEVENT me) void Outputs::mouseButtonPressed(MEVENT me)
{ {
if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size()) if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size())
return; return;
@@ -108,10 +108,10 @@ void Outputs::MouseButtonPressed(MEVENT me)
{ {
w->Goto(me.y); w->Goto(me.y);
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen< NC::Menu<MPD::Output> >::MouseButtonPressed(me); Screen< NC::Menu<MPD::Output> >::mouseButtonPressed(me);
} }
void Outputs::FetchList() void Outputs::FetchList()

View File

@@ -34,16 +34,16 @@ class Outputs : public Screen< NC::Menu<MPD::Output> >
public: public:
// Screen< NC::Menu<MPD::Output> > implementation // Screen< NC::Menu<MPD::Output> > implementation
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE { } virtual void spacePressed() OVERRIDE { }
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
@@ -52,7 +52,7 @@ class Outputs : public Screen< NC::Menu<MPD::Output> >
void FetchList(); void FetchList();
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; } virtual bool isLockable() OVERRIDE { return true; }
}; };

View File

@@ -56,7 +56,7 @@ bool playlistEntryMatcher(const Regex &rx, const MPD::Song &s);
} }
void Playlist::Init() void Playlist::init()
{ {
Items = new NC::Menu<MPD::Song>(0, MainStartY, COLS, MainHeight, Config.columns_in_playlist && Config.titles_visibility ? Display::Columns(COLS) : "", Config.main_color, NC::brNone); Items = new NC::Menu<MPD::Song>(0, MainStartY, COLS, MainHeight, Config.columns_in_playlist && Config.titles_visibility ? Display::Columns(COLS) : "", Config.main_color, NC::brNone);
Items->cyclicScrolling(Config.use_cyclic_scrolling); Items->cyclicScrolling(Config.use_cyclic_scrolling);
@@ -97,7 +97,7 @@ void Playlist::Init()
isInitialized = 1; isInitialized = 1;
} }
void Playlist::SwitchTo() void Playlist::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -107,15 +107,15 @@ void Playlist::SwitchTo()
return; return;
if (!isInitialized) if (!isInitialized)
Init(); init();
itsScrollBegin = 0; itsScrollBegin = 0;
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
@@ -126,10 +126,10 @@ void Playlist::SwitchTo()
drawHeader(); drawHeader();
} }
void Playlist::Resize() void Playlist::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
Items->resize(width, MainHeight); Items->resize(width, MainHeight);
Items->moveTo(x_offset, MainStartY); Items->moveTo(x_offset, MainStartY);
@@ -149,7 +149,7 @@ void Playlist::Resize()
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring Playlist::Title() std::wstring Playlist::title()
{ {
std::wstring result = L"Playlist "; std::wstring result = L"Playlist ";
if (ReloadTotalLength || ReloadRemaining) if (ReloadTotalLength || ReloadRemaining)
@@ -158,7 +158,7 @@ std::wstring Playlist::Title()
return result; return result;
} }
void Playlist::EnterPressed() void Playlist::enterPressed()
{ {
if (w == Items) if (w == Items)
{ {
@@ -238,7 +238,7 @@ void Playlist::EnterPressed()
} }
} }
void Playlist::SpacePressed() void Playlist::spacePressed()
{ {
if (w == Items && !Items->empty()) if (w == Items && !Items->empty())
{ {
@@ -247,7 +247,7 @@ void Playlist::SpacePressed()
} }
} }
void Playlist::MouseButtonPressed(MEVENT me) void Playlist::mouseButtonPressed(MEVENT me)
{ {
if (w == Items && !Items->empty() && Items->hasCoords(me.x, me.y)) if (w == Items && !Items->empty() && Items->hasCoords(me.x, me.y))
{ {
@@ -255,10 +255,10 @@ void Playlist::MouseButtonPressed(MEVENT me)
{ {
Items->Goto(me.y); Items->Goto(me.y);
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
else if (w == SortDialog && SortDialog->hasCoords(me.x, me.y)) else if (w == SortDialog && SortDialog->hasCoords(me.x, me.y))
{ {
@@ -266,10 +266,10 @@ void Playlist::MouseButtonPressed(MEVENT me)
{ {
SortDialog->Goto(me.y); SortDialog->Goto(me.y);
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
} }

View File

@@ -34,16 +34,16 @@ class Playlist : public Screen<NC::Window>, public Filterable, public HasSongs,
~Playlist() { } ~Playlist() { }
// Screen<NC::Window> implementation // Screen<NC::Window> implementation
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE; virtual void spacePressed() OVERRIDE;
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
@@ -99,7 +99,7 @@ class Playlist : public Screen<NC::Window>, public Filterable, public HasSongs,
static bool ReloadRemaining; static bool ReloadRemaining;
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; } virtual bool isLockable() OVERRIDE { return true; }
private: private:

View File

@@ -55,7 +55,7 @@ bool SongEntryMatcher(const Regex &rx, const MPD::Song &s);
} }
void PlaylistEditor::Init() void PlaylistEditor::init()
{ {
LeftColumnWidth = COLS/3-1; LeftColumnWidth = COLS/3-1;
RightColumnStartX = LeftColumnWidth+1; RightColumnStartX = LeftColumnWidth+1;
@@ -84,10 +84,10 @@ void PlaylistEditor::Init()
isInitialized = 1; isInitialized = 1;
} }
void PlaylistEditor::Resize() void PlaylistEditor::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
LeftColumnStartX = x_offset; LeftColumnStartX = x_offset;
LeftColumnWidth = width/3-1; LeftColumnWidth = width/3-1;
@@ -103,19 +103,19 @@ void PlaylistEditor::Resize()
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring PlaylistEditor::Title() std::wstring PlaylistEditor::title()
{ {
return L"Playlist editor"; return L"Playlist editor";
} }
void PlaylistEditor::Refresh() void PlaylistEditor::refresh()
{ {
Playlists->display(); Playlists->display();
mvvline(MainStartY, RightColumnStartX-1, 0, MainHeight); mvvline(MainStartY, RightColumnStartX-1, 0, MainHeight);
Content->display(); Content->display();
} }
void PlaylistEditor::SwitchTo() void PlaylistEditor::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -124,23 +124,23 @@ void PlaylistEditor::SwitchTo()
return; return;
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
myScreen = this; myScreen = this;
drawHeader(); drawHeader();
markSongsInPlaylist(contentProxyList()); markSongsInPlaylist(contentProxyList());
Refresh(); refresh();
} }
void PlaylistEditor::Update() void PlaylistEditor::update()
{ {
if (Playlists->reallyEmpty() || playlistsUpdateRequested) if (Playlists->reallyEmpty() || playlistsUpdateRequested)
{ {
@@ -246,12 +246,12 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
w->scroll(NC::wDown); w->scroll(NC::wDown);
} }
void PlaylistEditor::EnterPressed() void PlaylistEditor::enterPressed()
{ {
AddToPlaylist(true); AddToPlaylist(true);
} }
void PlaylistEditor::SpacePressed() void PlaylistEditor::spacePressed()
{ {
if (Config.space_selects) if (Config.space_selects)
{ {
@@ -276,7 +276,7 @@ void PlaylistEditor::SpacePressed()
AddToPlaylist(false); AddToPlaylist(false);
} }
void PlaylistEditor::MouseButtonPressed(MEVENT me) void PlaylistEditor::mouseButtonPressed(MEVENT me)
{ {
if (!Playlists->empty() && Playlists->hasCoords(me.x, me.y)) if (!Playlists->empty() && Playlists->hasCoords(me.x, me.y))
{ {
@@ -293,13 +293,13 @@ void PlaylistEditor::MouseButtonPressed(MEVENT me)
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
{ {
size_t pos = Playlists->choice(); size_t pos = Playlists->choice();
SpacePressed(); spacePressed();
if (pos < Playlists->size()-1) if (pos < Playlists->size()-1)
Playlists->scroll(NC::wUp); Playlists->scroll(NC::wUp);
} }
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
Content->clear(); Content->clear();
} }
else if (!Content->empty() && Content->hasCoords(me.x, me.y)) else if (!Content->empty() && Content->hasCoords(me.x, me.y))
@@ -317,15 +317,15 @@ void PlaylistEditor::MouseButtonPressed(MEVENT me)
if (me.bstate & BUTTON1_PRESSED) if (me.bstate & BUTTON1_PRESSED)
{ {
size_t pos = Content->choice(); size_t pos = Content->choice();
SpacePressed(); spacePressed();
if (pos < Content->size()-1) if (pos < Content->size()-1)
Content->scroll(NC::wUp); Content->scroll(NC::wUp);
} }
else else
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
} }
@@ -510,8 +510,8 @@ void PlaylistEditor::nextColumn()
void PlaylistEditor::Locate(const std::string &name) void PlaylistEditor::Locate(const std::string &name)
{ {
if (!isInitialized) if (!isInitialized)
Init(); init();
Update(); update();
for (size_t i = 0; i < Playlists->size(); ++i) for (size_t i = 0; i < Playlists->size(); ++i)
{ {
if (name == (*Playlists)[i].value()) if (name == (*Playlists)[i].value())
@@ -521,7 +521,7 @@ void PlaylistEditor::Locate(const std::string &name)
break; break;
} }
} }
SwitchTo(); switchTo();
} }
namespace {// namespace {//

View File

@@ -27,17 +27,17 @@
class PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable class PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasColumns, public HasSongs, public Searchable
{ {
public: public:
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Refresh() OVERRIDE; virtual void refresh() OVERRIDE;
virtual void Update() OVERRIDE; virtual void update() OVERRIDE;
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE; virtual void spacePressed() OVERRIDE;
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
@@ -79,7 +79,7 @@ class PlaylistEditor : public Screen<NC::Window>, public Filterable, public HasC
NC::Menu<MPD::Song> *Content; NC::Menu<MPD::Song> *Content;
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; } virtual bool isLockable() OVERRIDE { return true; }
private: private:

View File

@@ -30,7 +30,7 @@ using Global::myInactiveScreen;
namespace {// namespace {//
void DrawScreenSeparator(int x) void drawScreenSeparator(int x)
{ {
attron(COLOR_PAIR(Config.main_color)); attron(COLOR_PAIR(Config.main_color));
mvvline(Global::MainStartY, x, 0, Global::MainHeight); mvvline(Global::MainStartY, x, 0, Global::MainHeight);
@@ -40,7 +40,7 @@ void DrawScreenSeparator(int x)
} }
void GenericMouseButtonPressed(NC::Window *w, MEVENT me) void genericMouseButtonPressed(NC::Window *w, MEVENT me)
{ {
if (me.bstate & BUTTON2_PRESSED) if (me.bstate & BUTTON2_PRESSED)
{ {
@@ -60,7 +60,7 @@ void GenericMouseButtonPressed(NC::Window *w, MEVENT me)
} }
} }
void ScrollpadMouseButtonPressed(NC::Scrollpad *w, MEVENT me) void scrollpadMouseButtonPressed(NC::Scrollpad *w, MEVENT me)
{ {
if (me.bstate & BUTTON2_PRESSED) if (me.bstate & BUTTON2_PRESSED)
{ {
@@ -76,7 +76,7 @@ void ScrollpadMouseButtonPressed(NC::Scrollpad *w, MEVENT me)
/***********************************************************************/ /***********************************************************************/
void BasicScreen::GetWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen) void BasicScreen::getWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen)
{ {
width = COLS; width = COLS;
x_offset = 0; x_offset = 0;
@@ -92,15 +92,15 @@ void BasicScreen::GetWindowResizeParams(size_t &x_offset, size_t &width, bool ad
if (adjust_locked_screen) if (adjust_locked_screen)
{ {
myLockedScreen->Resize(); myLockedScreen->resize();
myLockedScreen->Refresh(); myLockedScreen->refresh();
DrawScreenSeparator(x_offset-1); drawScreenSeparator(x_offset-1);
} }
} }
} }
} }
bool BasicScreen::Lock() bool BasicScreen::lock()
{ {
if (myLockedScreen) if (myLockedScreen)
return false; return false;
@@ -113,18 +113,18 @@ bool BasicScreen::Lock()
return false; return false;
} }
void BasicScreen::Unlock() void BasicScreen::unlock()
{ {
if (myInactiveScreen && myInactiveScreen != myLockedScreen) if (myInactiveScreen && myInactiveScreen != myLockedScreen)
myScreen = myInactiveScreen; myScreen = myInactiveScreen;
myLockedScreen->SwitchTo(); myLockedScreen->switchTo();
myLockedScreen = 0; myLockedScreen = 0;
myInactiveScreen = 0; myInactiveScreen = 0;
} }
/***********************************************************************/ /***********************************************************************/
void ApplyToVisibleWindows(void (BasicScreen::*f)()) void applyToVisibleWindows(void (BasicScreen::*f)())
{ {
if (myLockedScreen && myScreen->isMergable()) if (myLockedScreen && myScreen->isMergable())
{ {
@@ -139,7 +139,7 @@ void ApplyToVisibleWindows(void (BasicScreen::*f)())
(myScreen->*f)(); (myScreen->*f)();
} }
void UpdateInactiveScreen(BasicScreen *screen_to_be_set) void updateInactiveScreen(BasicScreen *screen_to_be_set)
{ {
if (myInactiveScreen && myLockedScreen != myInactiveScreen && myLockedScreen == screen_to_be_set) if (myInactiveScreen && myLockedScreen != myInactiveScreen && myLockedScreen == screen_to_be_set)
{ {
@@ -151,8 +151,8 @@ void UpdateInactiveScreen(BasicScreen *screen_to_be_set)
// in such case we want to keep slave screen visible, so we never set it to null // in such case we want to keep slave screen visible, so we never set it to null
// as in "else" case. we also need to refresh it and redraw separator between // as in "else" case. we also need to refresh it and redraw separator between
// them as stacked screen probably has overwritten part ot it. // them as stacked screen probably has overwritten part ot it.
myInactiveScreen->Refresh(); myInactiveScreen->refresh();
DrawScreenSeparator(COLS*Config.locked_screen_width_part); drawScreenSeparator(COLS*Config.locked_screen_width_part);
} }
else else
{ {

View File

@@ -24,8 +24,8 @@
#include "menu.h" #include "menu.h"
#include "scrollpad.h" #include "scrollpad.h"
void GenericMouseButtonPressed(NC::Window *w, MEVENT me); void genericMouseButtonPressed(NC::Window *w, MEVENT me);
void ScrollpadMouseButtonPressed(NC::Scrollpad *w, MEVENT me); void scrollpadMouseButtonPressed(NC::Scrollpad *w, MEVENT me);
/// An interface for various instantiations of Screen template class. Since C++ doesn't like /// An interface for various instantiations of Screen template class. Since C++ doesn't like
/// comparison of two different instantiations of the same template class we need the most /// comparison of two different instantiations of the same template class we need the most
@@ -38,40 +38,40 @@ class BasicScreen
virtual ~BasicScreen() { } virtual ~BasicScreen() { }
/// @see Screen::ActiveWindow() /// @see Screen::activeWindow()
virtual NC::Window *ActiveWindow() = 0; virtual NC::Window *activeWindow() = 0;
/// @see Screen::Refresh() /// @see Screen::refresh()
virtual void Refresh() = 0; virtual void refresh() = 0;
/// @see Screen::RefreshWindow() /// @see Screen::refreshWindow()
virtual void RefreshWindow() = 0; virtual void refreshWindow() = 0;
/// @see Screen::Scroll() /// @see Screen::scroll()
virtual void Scroll(NC::Where where) = 0; virtual void scroll(NC::Where where) = 0;
/// Method used for switching to screen /// Method used for switching to screen
virtual void SwitchTo() = 0; virtual void switchTo() = 0;
/// Method that should resize screen /// Method that should resize screen
/// if requested by hasToBeResized /// if requested by hasToBeResized
virtual void Resize() = 0; virtual void resize() = 0;
/// @return title of the screen /// @return title of the screen
virtual std::wstring Title() = 0; virtual std::wstring title() = 0;
/// If the screen contantly has to update itself /// If the screen contantly has to update itself
/// somehow, it should be called by this function. /// somehow, it should be called by this function.
virtual void Update() = 0; virtual void update() = 0;
/// Invoked after Enter was pressed /// Invoked after Enter was pressed
virtual void EnterPressed() = 0; virtual void enterPressed() = 0;
/// Invoked after Space was pressed /// Invoked after Space was pressed
virtual void SpacePressed() = 0; virtual void spacePressed() = 0;
/// @see Screen::MouseButtonPressed() /// @see Screen::mouseButtonPressed()
virtual void MouseButtonPressed(MEVENT me) = 0; virtual void mouseButtonPressed(MEVENT me) = 0;
/// When this is overwritten with a function returning true, the /// When this is overwritten with a function returning true, the
/// screen will be used in tab switching. /// screen will be used in tab switching.
@@ -85,20 +85,20 @@ class BasicScreen
/// Locks current screen. /// Locks current screen.
/// @return true if lock was successful, false otherwise. Note that /// @return true if lock was successful, false otherwise. Note that
/// if there is already locked screen, it'll not overwrite it. /// if there is already locked screen, it'll not overwrite it.
bool Lock(); bool lock();
/// Should be set to true each time screen needs resize /// Should be set to true each time screen needs resize
bool hasToBeResized; bool hasToBeResized;
/// Unlocks a screen, ie. hides merged window (if there is one set). /// Unlocks a screen, ie. hides merged window (if there is one set).
static void Unlock(); static void unlock();
protected: protected:
/// Since screens initialization is lazy, we don't want to do /// Since screens initialization is lazy, we don't want to do
/// this in the constructor. This function should be invoked /// this in the constructor. This function should be invoked
/// only once and after that isInitialized flag has to be set /// only once and after that isInitialized flag has to be set
/// to true to somehow avoid next attempt of initialization. /// to true to somehow avoid next attempt of initialization.
virtual void Init() = 0; virtual void init() = 0;
/// @return true if screen can be locked. Note that returning /// @return true if screen can be locked. Note that returning
/// false here doesn't neccesarily mean that screen is also not /// false here doesn't neccesarily mean that screen is also not
@@ -106,25 +106,25 @@ class BasicScreen
/// make much sense, but it's perfectly fine to merge it). /// make much sense, but it's perfectly fine to merge it).
virtual bool isLockable() = 0; virtual bool isLockable() = 0;
/// Gets X offset and width of current screen to be used eg. in Resize() function. /// Gets X offset and width of current screen to be used eg. in resize() function.
/// @param adjust_locked_screen indicates whether this function should /// @param adjust_locked_screen indicates whether this function should
/// automatically adjust locked screen's dimensions (if there is one set) /// automatically adjust locked screen's dimensions (if there is one set)
/// if current screen is going to be subwindow. /// if current screen is going to be subwindow.
void GetWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen = true); void getWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen = true);
/// Flag that inditates whether the screen is initialized or not /// Flag that inditates whether the screen is initialized or not
bool isInitialized; bool isInitialized;
}; };
void ApplyToVisibleWindows(void (BasicScreen::*f)()); void applyToVisibleWindows(void (BasicScreen::*f)());
void UpdateInactiveScreen(BasicScreen *screen_to_be_set); void updateInactiveScreen(BasicScreen *screen_to_be_set);
bool isVisible(BasicScreen *screen); bool isVisible(BasicScreen *screen);
/// Class that all screens should derive from. It provides basic interface /// Class that all screens should derive from. It provides basic interface
/// for the screen to be working properly and assumes that we didn't forget /// for the screen to be working properly and assumes that we didn't forget
/// about anything vital. /// about anything vital.
/// ///
template <typename WindowType> class Screen : public BasicScreen template <typename WindowT> class Screen : public BasicScreen
{ {
public: public:
Screen() : w(0) { } Screen() : w(0) { }
@@ -134,17 +134,17 @@ template <typename WindowType> class Screen : public BasicScreen
/// it's useful to determine the one that is being /// it's useful to determine the one that is being
/// active /// active
/// @return address to window object cast to void * /// @return address to window object cast to void *
virtual NC::Window *ActiveWindow() OVERRIDE { virtual NC::Window *activeWindow() OVERRIDE {
return w; return w;
} }
/// Refreshes whole screen /// Refreshes whole screen
virtual void Refresh() OVERRIDE { virtual void refresh() OVERRIDE {
w->display(); w->display();
} }
/// Refreshes active window of the screen /// Refreshes active window of the screen
virtual void RefreshWindow() OVERRIDE { virtual void refreshWindow() OVERRIDE {
w->display(); w->display();
} }
@@ -152,19 +152,19 @@ template <typename WindowType> class Screen : public BasicScreen
/// if fancy scrolling feature is disabled, enters the /// if fancy scrolling feature is disabled, enters the
/// loop that holds main loop until user releases the key /// loop that holds main loop until user releases the key
/// @param where indicates where one wants to scroll /// @param where indicates where one wants to scroll
virtual void Scroll(NC::Where where) OVERRIDE { virtual void scroll(NC::Where where) OVERRIDE {
w->scroll(where); w->scroll(where);
} }
/// Invoked after there was one of mouse buttons pressed /// Invoked after there was one of mouse buttons pressed
/// @param me struct that contains coords of where the click /// @param me struct that contains coords of where the click
/// had its place and button actions /// had its place and button actions
virtual void MouseButtonPressed(MEVENT me) OVERRIDE { virtual void mouseButtonPressed(MEVENT me) OVERRIDE {
GenericMouseButtonPressed(w, me); genericMouseButtonPressed(w, me);
} }
/// @return pointer to currently active window /// @return pointer to currently active window
WindowType *Main() { WindowT *main() {
return w; return w;
} }
@@ -173,15 +173,14 @@ template <typename WindowType> class Screen : public BasicScreen
/// of window used by the screen. What is more, it should /// of window used by the screen. What is more, it should
/// always be assigned to the currently active window (if /// always be assigned to the currently active window (if
/// acreen contains more that one) /// acreen contains more that one)
WindowType *w; WindowT *w;
}; };
/// Specialization for Screen<Scrollpad>::MouseButtonPressed, that should /// Specialization for Screen<Scrollpad>::mouseButtonPressed, that should
/// not scroll whole page, but rather a few lines (the number of them is /// not scroll whole page, but rather a few lines (the number of them is
/// defined in the config) /// defined in the config)
template <> inline void Screen<NC::Scrollpad>::MouseButtonPressed(MEVENT me) template <> inline void Screen<NC::Scrollpad>::mouseButtonPressed(MEVENT me) {
{ scrollpadMouseButtonPressed(w, me);
ScrollpadMouseButtonPressed(w, me);
} }
#endif #endif

View File

@@ -73,20 +73,20 @@ struct Scrollpad: public Window
const std::wstring &content() { return m_buffer.str(); } const std::wstring &content() { return m_buffer.str(); }
/// Refreshes the window /// Refreshes the window
/// @see Window::Refresh() /// @see Window::refresh()
/// ///
virtual void refresh() OVERRIDE; virtual void refresh() OVERRIDE;
/// Scrolls by given amount of lines /// Scrolls by given amount of lines
/// @param where indicates where exactly one wants to go /// @param where indicates where exactly one wants to go
/// @see Window::Scroll() /// @see Window::scroll()
/// ///
virtual void scroll(Where where) OVERRIDE; virtual void scroll(Where where) OVERRIDE;
/// Resizes the window /// Resizes the window
/// @param new_width new window's width /// @param new_width new window's width
/// @param new_height new window's height /// @param new_height new window's height
/// @see Window::Resize() /// @see Window::resize()
/// ///
virtual void resize(size_t new_width, size_t new_height) OVERRIDE; virtual void resize(size_t new_width, size_t new_height) OVERRIDE;

View File

@@ -101,7 +101,7 @@ size_t SearchEngine::StaticOptions = 20;
size_t SearchEngine::ResetButton = 16; size_t SearchEngine::ResetButton = 16;
size_t SearchEngine::SearchButton = 15; size_t SearchEngine::SearchButton = 15;
void SearchEngine::Init() void SearchEngine::init()
{ {
w = new NC::Menu<SEItem>(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone); w = new NC::Menu<SEItem>(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
w->setHighlightColor(Config.main_highlight_color); w->setHighlightColor(Config.main_highlight_color);
@@ -114,17 +114,17 @@ void SearchEngine::Init()
isInitialized = 1; isInitialized = 1;
} }
void SearchEngine::Resize() void SearchEngine::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
w->setTitle(Config.columns_in_search_engine && Config.titles_visibility ? Display::Columns(w->getWidth()) : ""); w->setTitle(Config.columns_in_search_engine && Config.titles_visibility ? Display::Columns(w->getWidth()) : "");
hasToBeResized = 0; hasToBeResized = 0;
} }
void SearchEngine::SwitchTo() void SearchEngine::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -136,13 +136,13 @@ void SearchEngine::SwitchTo()
} }
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (w->empty()) if (w->empty())
Prepare(); Prepare();
@@ -154,12 +154,12 @@ void SearchEngine::SwitchTo()
markSongsInPlaylist(getProxySongList()); markSongsInPlaylist(getProxySongList());
} }
std::wstring SearchEngine::Title() std::wstring SearchEngine::title()
{ {
return L"Search engine"; return L"Search engine";
} }
void SearchEngine::EnterPressed() void SearchEngine::enterPressed()
{ {
size_t option = w->choice(); size_t option = w->choice();
if (option > ConstraintsNumber && option < SearchButton) if (option > ConstraintsNumber && option < SearchButton)
@@ -227,7 +227,7 @@ void SearchEngine::EnterPressed()
Statusbar::unlock(); Statusbar::unlock();
} }
void SearchEngine::SpacePressed() void SearchEngine::spacePressed()
{ {
if (!w->current().value().isSong()) if (!w->current().value().isSong())
return; return;
@@ -243,7 +243,7 @@ void SearchEngine::SpacePressed()
w->scroll(NC::wDown); w->scroll(NC::wDown);
} }
void SearchEngine::MouseButtonPressed(MEVENT me) void SearchEngine::mouseButtonPressed(MEVENT me)
{ {
if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size()) if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size())
return; return;
@@ -253,22 +253,22 @@ void SearchEngine::MouseButtonPressed(MEVENT me)
return; return;
w->refresh(); w->refresh();
if ((me.bstate & BUTTON3_PRESSED || w->choice() > ConstraintsNumber) && w->choice() < StaticOptions) if ((me.bstate & BUTTON3_PRESSED || w->choice() > ConstraintsNumber) && w->choice() < StaticOptions)
EnterPressed(); enterPressed();
else if (w->choice() >= StaticOptions) else if (w->choice() >= StaticOptions)
{ {
if (me.bstate & BUTTON1_PRESSED) if (me.bstate & BUTTON1_PRESSED)
{ {
size_t pos = w->choice(); size_t pos = w->choice();
SpacePressed(); spacePressed();
if (pos < w->size()-1) if (pos < w->size()-1)
w->scroll(NC::wUp); w->scroll(NC::wUp);
} }
else else
EnterPressed(); enterPressed();
} }
} }
else else
Screen< NC::Menu<SEItem> >::MouseButtonPressed(me); Screen< NC::Menu<SEItem> >::mouseButtonPressed(me);
} }
/***********************************************************************/ /***********************************************************************/

View File

@@ -77,16 +77,16 @@ class SearchEngine : public Screen< NC::Menu<SEItem> >, public Filterable, publi
{ {
public: public:
// Screen< NC::Menu<SEItem> > implementation // Screen< NC::Menu<SEItem> > implementation
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE; virtual void spacePressed() OVERRIDE;
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
@@ -116,7 +116,7 @@ class SearchEngine : public Screen< NC::Menu<SEItem> >, public Filterable, publi
static size_t ResetButton; static size_t ResetButton;
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; } virtual bool isLockable() OVERRIDE { return true; }
private: private:

View File

@@ -39,7 +39,7 @@ using Global::myOldScreen;
SelectedItemsAdder *mySelectedItemsAdder = new SelectedItemsAdder; SelectedItemsAdder *mySelectedItemsAdder = new SelectedItemsAdder;
void SelectedItemsAdder::Init() void SelectedItemsAdder::init()
{ {
SetDimensions(); SetDimensions();
itsPlaylistSelector = new NC::Menu<std::string>((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY, itsWidth, itsHeight, "Add selected item(s) to...", Config.main_color, Config.window_border); itsPlaylistSelector = new NC::Menu<std::string>((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY, itsWidth, itsHeight, "Add selected item(s) to...", Config.main_color, Config.window_border);
@@ -65,11 +65,11 @@ void SelectedItemsAdder::Init()
isInitialized = 1; isInitialized = 1;
} }
void SelectedItemsAdder::SwitchTo() void SelectedItemsAdder::switchTo()
{ {
if (myScreen == this) if (myScreen == this)
{ {
myOldScreen->SwitchTo(); myOldScreen->switchTo();
return; return;
} }
auto hs = dynamic_cast<HasSongs *>(myScreen); auto hs = dynamic_cast<HasSongs *>(myScreen);
@@ -83,16 +83,16 @@ void SelectedItemsAdder::SwitchTo()
} }
if (!isInitialized) if (!isInitialized)
Init(); init();
// default to main window // default to main window
w = itsPlaylistSelector; w = itsPlaylistSelector;
// Resize() can fall back to old screen, so we need it updated // resize() can fall back to old screen, so we need it updated
myOldScreen = myScreen; myOldScreen = myScreen;
if (hasToBeResized) if (hasToBeResized)
Resize(); resize();
bool playlists_not_active = myScreen == myBrowser && myBrowser->isLocal(); bool playlists_not_active = myScreen == myBrowser && myBrowser->isLocal();
if (playlists_not_active) if (playlists_not_active)
@@ -116,11 +116,11 @@ void SelectedItemsAdder::SwitchTo()
myScreen = this; myScreen = this;
} }
void SelectedItemsAdder::Resize() void SelectedItemsAdder::resize()
{ {
SetDimensions(); SetDimensions();
if (itsHeight < 5) // screen too low to display this window if (itsHeight < 5) // screen too low to display this window
return myOldScreen->SwitchTo(); return myOldScreen->switchTo();
itsPlaylistSelector->resize(itsWidth, itsHeight); itsPlaylistSelector->resize(itsWidth, itsHeight);
itsPlaylistSelector->moveTo((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY); itsPlaylistSelector->moveTo((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY);
size_t poss_width = std::min(itsPSWidth, size_t(COLS)); size_t poss_width = std::min(itsPSWidth, size_t(COLS));
@@ -129,13 +129,13 @@ void SelectedItemsAdder::Resize()
itsPositionSelector->moveTo((COLS-poss_width)/2, (MainHeight-poss_height)/2+MainStartY); itsPositionSelector->moveTo((COLS-poss_width)/2, (MainHeight-poss_height)/2+MainStartY);
if (myOldScreen && myOldScreen->hasToBeResized) // resize background window if (myOldScreen && myOldScreen->hasToBeResized) // resize background window
{ {
myOldScreen->Resize(); myOldScreen->resize();
myOldScreen->Refresh(); myOldScreen->refresh();
} }
hasToBeResized = 0; hasToBeResized = 0;
} }
void SelectedItemsAdder::Refresh() void SelectedItemsAdder::refresh()
{ {
if (w == itsPositionSelector) if (w == itsPositionSelector)
{ {
@@ -146,12 +146,12 @@ void SelectedItemsAdder::Refresh()
itsPlaylistSelector->display(); itsPlaylistSelector->display();
} }
std::wstring SelectedItemsAdder::Title() std::wstring SelectedItemsAdder::title()
{ {
return myOldScreen->Title(); return myOldScreen->title();
} }
void SelectedItemsAdder::EnterPressed() void SelectedItemsAdder::enterPressed()
{ {
size_t pos = w->choice(); size_t pos = w->choice();
@@ -198,9 +198,9 @@ void SelectedItemsAdder::EnterPressed()
if (pos != w->size()-1) if (pos != w->size()-1)
{ {
// refresh playlist's lists // refresh playlist's lists
if (myBrowser->Main() && !myBrowser->isLocal() && myBrowser->CurrentDir() == "/") if (myBrowser->main() && !myBrowser->isLocal() && myBrowser->CurrentDir() == "/")
myBrowser->GetDirectory("/"); myBrowser->GetDirectory("/");
if (myPlaylistEditor->Main()) if (myPlaylistEditor->main())
myPlaylistEditor->Playlists->clear(); // make playlist editor update itself myPlaylistEditor->Playlists->clear(); // make playlist editor update itself
} }
} }
@@ -248,10 +248,10 @@ void SelectedItemsAdder::EnterPressed()
if (successful_operation) if (successful_operation)
Statusbar::msg("Selected item(s) added"); Statusbar::msg("Selected item(s) added");
} }
SwitchTo(); switchTo();
} }
void SelectedItemsAdder::MouseButtonPressed(MEVENT me) void SelectedItemsAdder::mouseButtonPressed(MEVENT me)
{ {
if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size()) if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size())
return; return;
@@ -259,10 +259,10 @@ void SelectedItemsAdder::MouseButtonPressed(MEVENT me)
{ {
w->Goto(me.y); w->Goto(me.y);
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen< NC::Menu<std::string> >::MouseButtonPressed(me); Screen< NC::Menu<std::string> >::mouseButtonPressed(me);
} }
void SelectedItemsAdder::SetDimensions() void SelectedItemsAdder::SetDimensions()

View File

@@ -29,23 +29,23 @@ class SelectedItemsAdder : public Screen< NC::Menu<std::string> >
SelectedItemsAdder() : itsPSWidth(35), itsPSHeight(11) { } SelectedItemsAdder() : itsPSWidth(35), itsPSHeight(11) { }
// Screen< NC::Menu<std::string> > implementation // Screen< NC::Menu<std::string> > implementation
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual void Refresh() OVERRIDE; virtual void refresh() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE { } virtual void spacePressed() OVERRIDE { }
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isMergable() OVERRIDE { return false; } virtual bool isMergable() OVERRIDE { return false; }
virtual bool isTabbable() OVERRIDE { return false; } virtual bool isTabbable() OVERRIDE { return false; }
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; } virtual bool isLockable() OVERRIDE { return false; }
private: private:

View File

@@ -32,7 +32,7 @@ using Global::myOldScreen;
ServerInfo *myServerInfo = new ServerInfo; ServerInfo *myServerInfo = new ServerInfo;
void ServerInfo::Init() void ServerInfo::init()
{ {
SetDimensions(); SetDimensions();
w = new NC::Scrollpad((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY, itsWidth, itsHeight, "MPD server info", Config.main_color, Config.window_border); w = new NC::Scrollpad((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY, itsWidth, itsHeight, "MPD server info", Config.main_color, Config.window_border);
@@ -43,13 +43,13 @@ void ServerInfo::Init()
isInitialized = 1; isInitialized = 1;
} }
void ServerInfo::SwitchTo() void ServerInfo::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
if (myScreen == this) if (myScreen == this)
{ {
myOldScreen->SwitchTo(); myOldScreen->switchTo();
return; return;
} }
if (MainHeight < 5) if (MainHeight < 5)
@@ -59,39 +59,39 @@ void ServerInfo::SwitchTo()
} }
if (!isInitialized) if (!isInitialized)
Init(); init();
// Resize() can fall back to old screen, so we need it updated // resize() can fall back to old screen, so we need it updated
myOldScreen = myScreen; myOldScreen = myScreen;
if (hasToBeResized) if (hasToBeResized)
Resize(); resize();
myScreen = this; myScreen = this;
//w->Window::clear(); //w->Window::clear();
} }
void ServerInfo::Resize() void ServerInfo::resize()
{ {
SetDimensions(); SetDimensions();
if (itsHeight < 5) // screen too low to display this window if (itsHeight < 5) // screen too low to display this window
return myOldScreen->SwitchTo(); return myOldScreen->switchTo();
w->resize(itsWidth, itsHeight); w->resize(itsWidth, itsHeight);
w->moveTo((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY); w->moveTo((COLS-itsWidth)/2, (MainHeight-itsHeight)/2+MainStartY);
if (myOldScreen && myOldScreen->hasToBeResized) // resize background window if (myOldScreen && myOldScreen->hasToBeResized) // resize background window
{ {
myOldScreen->Resize(); myOldScreen->resize();
myOldScreen->Refresh(); myOldScreen->refresh();
} }
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring ServerInfo::Title() std::wstring ServerInfo::title()
{ {
return myOldScreen->Title(); return myOldScreen->title();
} }
void ServerInfo::Update() void ServerInfo::update()
{ {
static timeval past = { 0, 0 }; static timeval past = { 0, 0 };
if (Global::Timer.tv_sec <= past.tv_sec) if (Global::Timer.tv_sec <= past.tv_sec)

View File

@@ -27,21 +27,21 @@ class ServerInfo : public Screen<NC::Scrollpad>
{ {
public: public:
// Screen<NC::Scrollpad> implementation // Screen<NC::Scrollpad> implementation
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE; virtual void update() OVERRIDE;
virtual void EnterPressed() OVERRIDE { } virtual void enterPressed() OVERRIDE { }
virtual void SpacePressed() OVERRIDE { } virtual void spacePressed() OVERRIDE { }
virtual bool isMergable() OVERRIDE { return false; } virtual bool isMergable() OVERRIDE { return false; }
virtual bool isTabbable() OVERRIDE { return false; } virtual bool isTabbable() OVERRIDE { return false; }
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; } virtual bool isLockable() OVERRIDE { return false; }
private: private:

View File

@@ -50,47 +50,47 @@ const SongInfo::Metadata SongInfo::Tags[] =
{ 0, 0, 0 } { 0, 0, 0 }
}; };
void SongInfo::Init() void SongInfo::init()
{ {
w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone); w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
isInitialized = 1; isInitialized = 1;
} }
void SongInfo::Resize() void SongInfo::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring SongInfo::Title() std::wstring SongInfo::title()
{ {
return L"Song info"; return L"Song info";
} }
void SongInfo::SwitchTo() void SongInfo::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myOldScreen; using Global::myOldScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
if (myScreen == this) if (myScreen == this)
return myOldScreen->SwitchTo(); return myOldScreen->switchTo();
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
auto s = currentSong(myScreen); auto s = currentSong(myScreen);
if (!s) if (!s)
return; return;
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
myOldScreen = myScreen; myOldScreen = myScreen;
myScreen = this; myScreen = this;

View File

@@ -35,15 +35,15 @@ class SongInfo : public Screen<NC::Scrollpad>
}; };
// Screen<NC::Scrollpad> implementation // Screen<NC::Scrollpad> implementation
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE { } virtual void enterPressed() OVERRIDE { }
virtual void SpacePressed() OVERRIDE { } virtual void spacePressed() OVERRIDE { }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
virtual bool isTabbable() OVERRIDE { return false; } virtual bool isTabbable() OVERRIDE { return false; }
@@ -53,7 +53,7 @@ class SongInfo : public Screen<NC::Scrollpad>
static const Metadata Tags[]; static const Metadata Tags[];
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return false; } virtual bool isLockable() OVERRIDE { return false; }
private: private:

View File

@@ -90,9 +90,9 @@ void Status::trace()
Mpd.UpdateStatus(); Mpd.UpdateStatus();
} }
ApplyToVisibleWindows(&BasicScreen::Update); applyToVisibleWindows(&BasicScreen::update);
if (isVisible(myPlaylist) && myPlaylist->ActiveWindow() == myPlaylist->Items if (isVisible(myPlaylist) && myPlaylist->activeWindow() == myPlaylist->Items
&& Timer.tv_sec == myPlaylist->Timer().tv_sec+Config.playlist_disable_highlight_delay && Timer.tv_sec == myPlaylist->Timer().tv_sec+Config.playlist_disable_highlight_delay
&& myPlaylist->Items->isHighlighted() && myPlaylist->Items->isHighlighted()
&& Config.playlist_disable_highlight_delay) && Config.playlist_disable_highlight_delay)
@@ -121,7 +121,7 @@ void Status::handleError(MPD::Connection * , int errorid, const char *msg, void
else if ((errorid >> 8) == MPD_SERVER_ERROR_NO_EXIST && myScreen == myBrowser) else if ((errorid >> 8) == MPD_SERVER_ERROR_NO_EXIST && myScreen == myBrowser)
{ {
myBrowser->GetDirectory(getParentDirectory(myBrowser->CurrentDir())); myBrowser->GetDirectory(getParentDirectory(myBrowser->CurrentDir()));
myBrowser->Refresh(); myBrowser->refresh();
} }
else else
Statusbar::msg("MPD: %s", msg); Statusbar::msg("MPD: %s", msg);
@@ -176,35 +176,35 @@ void Status::Changes::playlist()
void Status::Changes::storedPlaylists() void Status::Changes::storedPlaylists()
{ {
if (myPlaylistEditor->Main()) if (myPlaylistEditor->main())
{ {
myPlaylistEditor->requestPlaylistsUpdate(); myPlaylistEditor->requestPlaylistsUpdate();
myPlaylistEditor->requestContentsUpdate(); myPlaylistEditor->requestContentsUpdate();
} }
if (myBrowser->Main() && myBrowser->CurrentDir() == "/") if (myBrowser->main() && myBrowser->CurrentDir() == "/")
{ {
myBrowser->GetDirectory("/"); myBrowser->GetDirectory("/");
if (isVisible(myBrowser)) if (isVisible(myBrowser))
myBrowser->Refresh(); myBrowser->refresh();
} }
} }
void Status::Changes::database() void Status::Changes::database()
{ {
if (myBrowser->Main()) if (myBrowser->main())
{ {
if (isVisible(myBrowser)) if (isVisible(myBrowser))
myBrowser->GetDirectory(myBrowser->CurrentDir()); myBrowser->GetDirectory(myBrowser->CurrentDir());
else else
myBrowser->Main()->clear(); myBrowser->main()->clear();
} }
# ifdef HAVE_TAGLIB_H # ifdef HAVE_TAGLIB_H
if (myTagEditor->Main()) if (myTagEditor->main())
{ {
myTagEditor->Dirs->clear(); myTagEditor->Dirs->clear();
} }
# endif // HAVE_TAGLIB_H # endif // HAVE_TAGLIB_H
if (myLibrary->Main()) if (myLibrary->main())
{ {
if (myLibrary->Columns() == 2) if (myLibrary->Columns() == 2)
myLibrary->Albums->clear(); myLibrary->Albums->clear();
@@ -254,7 +254,7 @@ void Status::Changes::playerState()
player_state.clear(); player_state.clear();
# ifdef ENABLE_VISUALIZER # ifdef ENABLE_VISUALIZER
if (isVisible(myVisualizer)) if (isVisible(myVisualizer))
myVisualizer->Main()->clear(); myVisualizer->main()->clear();
# endif // ENABLE_VISUALIZER # endif // ENABLE_VISUALIZER
break; break;
} }
@@ -565,5 +565,5 @@ void Status::update(MPD::Connection *, MPD::StatusChanges changes, void *)
if (changes.PlayerState || (changes.ElapsedTime && (!Config.new_design || Mpd.GetState() == MPD::psPlay))) if (changes.PlayerState || (changes.ElapsedTime && (!Config.new_design || Mpd.GetState() == MPD::psPlay)))
wFooter->refresh(); wFooter->refresh();
if (changes.Playlist || changes.Database || changes.PlayerState || changes.SongID) if (changes.Playlist || changes.Database || changes.PlayerState || changes.SongID)
ApplyToVisibleWindows(&BasicScreen::RefreshWindow); applyToVisibleWindows(&BasicScreen::refreshWindow);
} }

View File

@@ -192,7 +192,7 @@ void Statusbar::Helpers::ApplyFilterImmediately::operator()(const std::wstring &
{ {
m_ws = ws; m_ws = ws;
m_f->applyFilter(ToString(m_ws)); m_f->applyFilter(ToString(m_ws));
myScreen->RefreshWindow(); myScreen->refreshWindow();
} }
Status::trace(); Status::trace();
} }

View File

@@ -84,7 +84,7 @@ bool SongEntryMatcher(const Regex &rx, const MPD::MutableSong &s);
} }
void TagEditor::Init() void TagEditor::init()
{ {
PatternsFile = Config.ncmpcpp_directory + "patterns.list"; PatternsFile = Config.ncmpcpp_directory + "patterns.list";
SetDimensions(0, COLS); SetDimensions(0, COLS);
@@ -162,10 +162,10 @@ void TagEditor::SetDimensions(size_t x_offset, size_t width)
FParserWidthTwo = FParserWidth-FParserWidthOne; FParserWidthTwo = FParserWidth-FParserWidthOne;
} }
void TagEditor::Resize() void TagEditor::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
SetDimensions(x_offset, width); SetDimensions(x_offset, width);
Dirs->resize(LeftColumnWidth, MainHeight); Dirs->resize(LeftColumnWidth, MainHeight);
@@ -191,12 +191,12 @@ void TagEditor::Resize()
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring TagEditor::Title() std::wstring TagEditor::title()
{ {
return L"Tag editor"; return L"Tag editor";
} }
void TagEditor::SwitchTo() void TagEditor::switchTo()
{ {
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -204,22 +204,22 @@ void TagEditor::SwitchTo()
return; return;
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
myScreen = this; myScreen = this;
drawHeader(); drawHeader();
Refresh(); refresh();
} }
void TagEditor::Refresh() void TagEditor::refresh()
{ {
Dirs->display(); Dirs->display();
mvvline(MainStartY, MiddleColumnStartX-1, 0, MainHeight); mvvline(MainStartY, MiddleColumnStartX-1, 0, MainHeight);
@@ -238,7 +238,7 @@ void TagEditor::Refresh()
} }
} }
void TagEditor::Update() void TagEditor::update()
{ {
if (Dirs->reallyEmpty()) if (Dirs->reallyEmpty())
{ {
@@ -292,7 +292,7 @@ void TagEditor::Update()
} }
} }
void TagEditor::EnterPressed() void TagEditor::enterPressed()
{ {
using Global::wFooter; using Global::wFooter;
@@ -315,7 +315,7 @@ void TagEditor::EnterPressed()
if (choice == 3) // cancel if (choice == 3) // cancel
{ {
w = TagTypes; w = TagTypes;
Refresh(); refresh();
return; return;
} }
GetPatternList(); GetPatternList();
@@ -461,7 +461,7 @@ void TagEditor::EnterPressed()
{ {
SavePatternList(); SavePatternList();
w = TagTypes; w = TagTypes;
Refresh(); refresh();
return; return;
} }
} }
@@ -609,7 +609,7 @@ void TagEditor::EnterPressed()
} }
} }
void TagEditor::SpacePressed() void TagEditor::spacePressed()
{ {
if (w == Tags && !Tags->empty()) if (w == Tags && !Tags->empty())
{ {
@@ -618,7 +618,7 @@ void TagEditor::SpacePressed()
} }
} }
void TagEditor::MouseButtonPressed(MEVENT me) void TagEditor::mouseButtonPressed(MEVENT me)
{ {
auto tryPreviousColumn = [this]() -> bool { auto tryPreviousColumn = [this]() -> bool {
bool result = true; bool result = true;
@@ -650,10 +650,10 @@ void TagEditor::MouseButtonPressed(MEVENT me)
{ {
FParserDialog->Goto(me.y); FParserDialog->Goto(me.y);
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
} }
else if (w == FParser || w == FParserHelper) else if (w == FParser || w == FParserHelper)
@@ -671,10 +671,10 @@ void TagEditor::MouseButtonPressed(MEVENT me)
{ {
FParser->Goto(me.y); FParser->Goto(me.y);
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
else if (FParserHelper->hasCoords(me.x, me.y)) else if (FParserHelper->hasCoords(me.x, me.y))
{ {
@@ -685,7 +685,7 @@ void TagEditor::MouseButtonPressed(MEVENT me)
else else
return; return;
} }
ScrollpadMouseButtonPressed(FParserHelper, me); scrollpadMouseButtonPressed(FParserHelper, me);
} }
} }
else if (!Dirs->empty() && Dirs->hasCoords(me.x, me.y)) else if (!Dirs->empty() && Dirs->hasCoords(me.x, me.y))
@@ -696,12 +696,12 @@ void TagEditor::MouseButtonPressed(MEVENT me)
{ {
Dirs->Goto(me.y); Dirs->Goto(me.y);
if (me.bstate & BUTTON1_PRESSED) if (me.bstate & BUTTON1_PRESSED)
EnterPressed(); enterPressed();
else else
SpacePressed(); spacePressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
Tags->clear(); Tags->clear();
} }
else if (!TagTypes->empty() && TagTypes->hasCoords(me.x, me.y)) else if (!TagTypes->empty() && TagTypes->hasCoords(me.x, me.y))
@@ -723,10 +723,10 @@ void TagEditor::MouseButtonPressed(MEVENT me)
TagTypes->refresh(); TagTypes->refresh();
Tags->refresh(); Tags->refresh();
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
else if (!Tags->empty() && Tags->hasCoords(me.x, me.y)) else if (!Tags->empty() && Tags->hasCoords(me.x, me.y))
{ {
@@ -737,10 +737,10 @@ void TagEditor::MouseButtonPressed(MEVENT me)
Tags->Goto(me.y); Tags->Goto(me.y);
Tags->refresh(); Tags->refresh();
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
EnterPressed(); enterPressed();
} }
else else
Screen<NC::Window>::MouseButtonPressed(me); Screen<NC::Window>::mouseButtonPressed(me);
} }
} }
@@ -965,7 +965,7 @@ void TagEditor::LocateSong(const MPD::Song &s)
return; return;
if (Global::myScreen != this) if (Global::myScreen != this)
SwitchTo(); switchTo();
// go to right directory // go to right directory
if (itsBrowsedDir != s.getDirectory()) if (itsBrowsedDir != s.getDirectory())
@@ -979,7 +979,7 @@ void TagEditor::LocateSong(const MPD::Song &s)
if (itsBrowsedDir.empty()) if (itsBrowsedDir.empty())
itsBrowsedDir = "/"; itsBrowsedDir = "/";
Dirs->clear(); Dirs->clear();
Update(); update();
} }
if (itsBrowsedDir == "/") if (itsBrowsedDir == "/")
Dirs->reset(); // go to the first pos, which is "." (music dir root) Dirs->reset(); // go to the first pos, which is "." (music dir root)
@@ -998,7 +998,7 @@ void TagEditor::LocateSong(const MPD::Song &s)
Dirs->refresh(); Dirs->refresh();
Tags->clear(); Tags->clear();
Update(); update();
// reset TagTypes since it can be under Filename // reset TagTypes since it can be under Filename
// and then songs in right column are not visible. // and then songs in right column are not visible.

View File

@@ -38,17 +38,17 @@ class TagEditor : public Screen<NC::Window>, public Filterable, public HasColumn
public: public:
TagEditor() : FParser(0), FParserHelper(0), FParserLegend(0), FParserPreview(0), itsBrowsedDir("/") { } TagEditor() : FParser(0), FParserHelper(0), FParserLegend(0), FParserPreview(0), itsBrowsedDir("/") { }
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Refresh() OVERRIDE; virtual void refresh() OVERRIDE;
virtual void Update() OVERRIDE; virtual void update() OVERRIDE;
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE; virtual void spacePressed() OVERRIDE;
virtual void MouseButtonPressed(MEVENT) OVERRIDE; virtual void mouseButtonPressed(MEVENT) OVERRIDE;
virtual bool isTabbable() OVERRIDE { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
@@ -88,7 +88,7 @@ class TagEditor : public Screen<NC::Window>, public Filterable, public HasColumn
NC::Menu<MPD::MutableSong> *Tags; NC::Menu<MPD::MutableSong> *Tags;
protected: protected:
virtual void Init(); virtual void init();
virtual bool isLockable() { return true; } virtual bool isLockable() { return true; }
private: private:

View File

@@ -268,7 +268,7 @@ bool write(MPD::MutableSong &s)
} }
Mpd.CommitCommandsList(); Mpd.CommitCommandsList();
} }
else // only myBrowser->Main() else // only myBrowser->main()
myBrowser->GetDirectory(myBrowser->CurrentDir()); myBrowser->GetDirectory(myBrowser->CurrentDir());
} }
} }

View File

@@ -45,7 +45,7 @@ using Global::myOldScreen;
TinyTagEditor *myTinyTagEditor = new TinyTagEditor; TinyTagEditor *myTinyTagEditor = new TinyTagEditor;
void TinyTagEditor::Init() void TinyTagEditor::init()
{ {
w = new NC::Menu<NC::Buffer>(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone); w = new NC::Menu<NC::Buffer>(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
w->setHighlightColor(Config.main_highlight_color); w->setHighlightColor(Config.main_highlight_color);
@@ -55,16 +55,16 @@ void TinyTagEditor::Init()
isInitialized = 1; isInitialized = 1;
} }
void TinyTagEditor::Resize() void TinyTagEditor::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
hasToBeResized = 0; hasToBeResized = 0;
} }
void TinyTagEditor::SwitchTo() void TinyTagEditor::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -76,10 +76,10 @@ void TinyTagEditor::SwitchTo()
else if (getTags()) else if (getTags())
{ {
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
myOldScreen = myScreen; myOldScreen = myScreen;
myScreen = this; myScreen = this;
@@ -97,12 +97,12 @@ void TinyTagEditor::SwitchTo()
} }
} }
std::wstring TinyTagEditor::Title() std::wstring TinyTagEditor::title()
{ {
return L"Tiny tag editor"; return L"Tiny tag editor";
} }
void TinyTagEditor::EnterPressed() void TinyTagEditor::enterPressed()
{ {
size_t option = w->choice(); size_t option = w->choice();
Statusbar::lock(); Statusbar::lock();
@@ -150,10 +150,10 @@ void TinyTagEditor::EnterPressed()
Statusbar::msg("Error while writing tags"); Statusbar::msg("Error while writing tags");
} }
if (option > 21) if (option > 21)
myOldScreen->SwitchTo(); myOldScreen->switchTo();
} }
void TinyTagEditor::MouseButtonPressed(MEVENT me) void TinyTagEditor::mouseButtonPressed(MEVENT me)
{ {
if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size()) if (w->empty() || !w->hasCoords(me.x, me.y) || size_t(me.y) >= w->size())
return; return;
@@ -164,11 +164,11 @@ void TinyTagEditor::MouseButtonPressed(MEVENT me)
if (me.bstate & BUTTON3_PRESSED) if (me.bstate & BUTTON3_PRESSED)
{ {
w->refresh(); w->refresh();
EnterPressed(); enterPressed();
} }
} }
else else
Screen< NC::Menu<NC::Buffer> >::MouseButtonPressed(me); Screen< NC::Menu<NC::Buffer> >::mouseButtonPressed(me);
} }
void TinyTagEditor::SetEdited(const MPD::Song &s) void TinyTagEditor::SetEdited(const MPD::Song &s)
@@ -192,7 +192,7 @@ bool TinyTagEditor::getTags()
ext = lowercase(ext.substr(ext.rfind(".")+1)); ext = lowercase(ext.substr(ext.rfind(".")+1));
if (!isInitialized) if (!isInitialized)
Init(); init();
w->clear(); w->clear();
w->reset(); w->reset();

View File

@@ -32,16 +32,16 @@ class TinyTagEditor : public Screen< NC::Menu<NC::Buffer> >
{ {
public: public:
// Screen< NC::Menu<NC::Buffer> > implementation // Screen< NC::Menu<NC::Buffer> > implementation
virtual void Resize() OVERRIDE; virtual void resize() OVERRIDE;
virtual void SwitchTo() OVERRIDE; virtual void switchTo() OVERRIDE;
virtual std::wstring Title() OVERRIDE; virtual std::wstring title() OVERRIDE;
virtual void Update() OVERRIDE { } virtual void update() OVERRIDE { }
virtual void EnterPressed() OVERRIDE; virtual void enterPressed() OVERRIDE;
virtual void SpacePressed() OVERRIDE { } virtual void spacePressed() OVERRIDE { }
virtual void MouseButtonPressed(MEVENT me) OVERRIDE; virtual void mouseButtonPressed(MEVENT me) OVERRIDE;
virtual bool isMergable() OVERRIDE { return true; } virtual bool isMergable() OVERRIDE { return true; }
virtual bool isTabbable() OVERRIDE { return false; } virtual bool isTabbable() OVERRIDE { return false; }
@@ -50,7 +50,7 @@ class TinyTagEditor : public Screen< NC::Menu<NC::Buffer> >
void SetEdited(const MPD::Song &); void SetEdited(const MPD::Song &);
protected: protected:
virtual void Init() OVERRIDE; virtual void init() OVERRIDE;
virtual bool isLockable() OVERRIDE { return true; } virtual bool isLockable() OVERRIDE { return true; }
private: private:

View File

@@ -45,7 +45,7 @@ void drawHeader()
return; return;
if (Config.new_design) if (Config.new_design)
{ {
std::wstring title = myScreen->Title(); std::wstring title = myScreen->title();
*wHeader << NC::XY(0, 3) << wclrtoeol; *wHeader << NC::XY(0, 3) << wclrtoeol;
*wHeader << NC::fmtBold << Config.alternative_ui_separator_color; *wHeader << NC::fmtBold << Config.alternative_ui_separator_color;
mvwhline(wHeader->raw(), 2, 0, 0, COLS); mvwhline(wHeader->raw(), 2, 0, 0, COLS);
@@ -56,7 +56,7 @@ void drawHeader()
} }
else else
{ {
*wHeader << NC::XY(0, 0) << wclrtoeol << NC::fmtBold << myScreen->Title() << NC::fmtBoldEnd; *wHeader << NC::XY(0, 0) << wclrtoeol << NC::fmtBold << myScreen->title() << NC::fmtBoldEnd;
*wHeader << Config.volume_color; *wHeader << Config.volume_color;
*wHeader << NC::XY(wHeader->getWidth()-VolumeState.length(), 0) << VolumeState; *wHeader << NC::XY(wHeader->getWidth()-VolumeState.length(), 0) << VolumeState;
*wHeader << NC::clEnd; *wHeader << NC::clEnd;

View File

@@ -44,7 +44,7 @@ Visualizer *myVisualizer = new Visualizer;
const int Visualizer::WindowTimeout = 1000/25; /* 25 fps */ const int Visualizer::WindowTimeout = 1000/25; /* 25 fps */
void Visualizer::Init() void Visualizer::init()
{ {
w = new NC::Window(0, MainStartY, COLS, MainHeight, "", Config.visualizer_color, NC::brNone); w = new NC::Window(0, MainStartY, COLS, MainHeight, "", Config.visualizer_color, NC::brNone);
@@ -63,7 +63,7 @@ void Visualizer::Init()
isInitialized = 1; isInitialized = 1;
} }
void Visualizer::SwitchTo() void Visualizer::switchTo()
{ {
using Global::myScreen; using Global::myScreen;
using Global::myLockedScreen; using Global::myLockedScreen;
@@ -72,13 +72,13 @@ void Visualizer::SwitchTo()
return; return;
if (!isInitialized) if (!isInitialized)
Init(); init();
if (myLockedScreen) if (myLockedScreen)
UpdateInactiveScreen(this); updateInactiveScreen(this);
if (hasToBeResized || myLockedScreen) if (hasToBeResized || myLockedScreen)
Resize(); resize();
if (myScreen != this && myScreen->isTabbable()) if (myScreen != this && myScreen->isTabbable())
Global::myPrevScreen = myScreen; Global::myPrevScreen = myScreen;
@@ -95,21 +95,21 @@ void Visualizer::SwitchTo()
Global::wFooter->setTimeout(WindowTimeout); Global::wFooter->setTimeout(WindowTimeout);
} }
void Visualizer::Resize() void Visualizer::resize()
{ {
size_t x_offset, width; size_t x_offset, width;
GetWindowResizeParams(x_offset, width); getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight); w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY); w->moveTo(x_offset, MainStartY);
hasToBeResized = 0; hasToBeResized = 0;
} }
std::wstring Visualizer::Title() std::wstring Visualizer::title()
{ {
return L"Music visualizer"; return L"Music visualizer";
} }
void Visualizer::Update() void Visualizer::update()
{ {
if (itsFifo < 0) if (itsFifo < 0)
return; return;
@@ -155,7 +155,7 @@ void Visualizer::Update()
w->refresh(); w->refresh();
} }
void Visualizer::SpacePressed() void Visualizer::spacePressed()
{ {
# ifdef HAVE_FFTW3_H # ifdef HAVE_FFTW3_H
Config.visualizer_use_wave = !Config.visualizer_use_wave; Config.visualizer_use_wave = !Config.visualizer_use_wave;

View File

@@ -35,21 +35,22 @@
class Visualizer : public Screen<NC::Window> class Visualizer : public Screen<NC::Window>
{ {
public: public:
virtual void SwitchTo(); virtual void switchTo() OVERRIDE;
virtual void Resize(); virtual void resize() OVERRIDE;
virtual std::wstring Title(); virtual std::wstring title() OVERRIDE;
virtual void Update(); virtual void update() OVERRIDE;
virtual void Scroll(NC::Where) { } virtual void scroll(NC::Where) OVERRIDE { }
virtual void EnterPressed() { } virtual void enterPressed() OVERRIDE { }
virtual void SpacePressed(); virtual void spacePressed() OVERRIDE;
virtual void MouseButtonPressed(MEVENT) { } virtual void mouseButtonPressed(MEVENT) OVERRIDE { }
virtual bool isTabbable() { return true; }
virtual bool isMergable() { return true; } virtual bool isTabbable() OVERRIDE { return true; }
virtual bool isMergable() OVERRIDE { return true; }
// private members
void SetFD(); void SetFD();
void ResetFD(); void ResetFD();
void FindOutputID(); void FindOutputID();
@@ -57,7 +58,7 @@ class Visualizer : public Screen<NC::Window>
static const int WindowTimeout; static const int WindowTimeout;
protected: protected:
virtual void Init(); virtual void init();
virtual bool isLockable() { return true; } virtual bool isLockable() { return true; }
private: private:

View File

@@ -287,7 +287,7 @@ struct Window
void deleteHistory(); void deleteHistory();
/// Refreshed whole window and its border /// Refreshed whole window and its border
/// @see Refresh() /// @see refresh()
void display(); void display();
/// Refreshes whole window, but not the border /// Refreshes whole window, but not the border
@@ -424,20 +424,20 @@ protected:
/// ///
void showBorder() const; void showBorder() const;
/// Changes dimensions of window, called from Resize() /// Changes dimensions of window, called from resize()
/// @param width new window's width /// @param width new window's width
/// @param height new window's height /// @param height new window's height
/// @see Resize() /// @see resize()
/// ///
void adjustDimensions(size_t width, size_t height); void adjustDimensions(size_t width, size_t height);
/// Deletes old window and creates new. It's called by Resize(), /// Deletes old window and creates new. It's called by resize(),
/// SetBorder() or setTitle() since internally windows are /// SetBorder() or setTitle() since internally windows are
/// handled as curses pads and change in size requires to delete /// handled as curses pads and change in size requires to delete
/// them and create again, there is no way to change size of pad. /// them and create again, there is no way to change size of pad.
/// @see SetBorder() /// @see SetBorder()
/// @see setTitle() /// @see setTitle()
/// @see Resize() /// @see resize()
/// ///
virtual void recreate(size_t width, size_t height); virtual void recreate(size_t width, size_t height);