diff --git a/src/display.h b/src/display.h index ce972b9b..b3c9ed6c 100644 --- a/src/display.h +++ b/src/display.h @@ -34,8 +34,6 @@ namespace Display *menu << t; } - //void TotalPlaylistLength(Window &); - void StringPairs(const string_pair &, void *, Menu *); void SongsInColumns(const MPD::Song &, void *, Menu *); @@ -51,16 +49,5 @@ namespace Display void Clock(Window &, const tm *); } -namespace Refresh -{ - void MediaLibrary(); - - void PlaylistEditor(); - -# ifdef HAVE_TAGLIB_H - void TagEditor(); -# endif -} - #endif diff --git a/src/global.h b/src/global.h index 030b0884..ebeeddf7 100644 --- a/src/global.h +++ b/src/global.h @@ -69,7 +69,7 @@ namespace Global extern MPD::Connection *Mpd; // extern int now_playing; - extern int lock_statusbar_delay; +// extern int lock_statusbar_delay; // extern size_t browsed_dir_scroll_begin; extern size_t main_start_y; @@ -79,8 +79,8 @@ namespace Global extern time_t timer; // extern std::string browsed_dir; - extern std::string editor_browsed_dir; - extern std::string editor_highlighted_dir; +// extern std::string editor_browsed_dir; +// extern std::string editor_highlighted_dir; // extern std::string info_title; // extern BasicScreen myScreen; @@ -102,8 +102,6 @@ namespace Global extern std::string volume_state; extern bool header_update_status; - - extern bool header_update_status; // extern bool search_case_sensitive; // extern bool search_match_to_pattern; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index e6af1b00..10c070d9 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -68,15 +68,13 @@ Window *Global::wFooter; Connection *Global::Mpd; -int Global::lock_statusbar_delay = -1; - size_t Global::main_start_y; size_t Global::main_height; time_t Global::timer; -string Global::editor_browsed_dir = "/"; -string Global::editor_highlighted_dir; +//string Global::myTagEditor->CurrentDir() = "/"; +//string Global::editor_highlighted_dir; bool Global::dont_change_now_playing = 0; bool Global::block_progressbar_update = 0; @@ -947,7 +945,7 @@ int main(int argc, char *argv[]) Mpd->UpdateDirectory(myBrowser->CurrentDir()); # ifdef HAVE_TAGLIB_H else if (myScreen == myTagEditor && !Config.albums_in_tag_editor) - Mpd->UpdateDirectory(editor_browsed_dir); + Mpd->UpdateDirectory(myTagEditor->CurrentDir()); # endif // HAVE_TAGLIB_H else Mpd->UpdateDirectory("/"); @@ -1083,11 +1081,11 @@ int main(int argc, char *argv[]) UnlockStatusbar(); if (!new_dir.empty() && new_dir != old_dir) { - string full_old_dir = Config.mpd_music_dir + editor_browsed_dir + "/" + locale_to_utf_cpy(old_dir); - string full_new_dir = Config.mpd_music_dir + editor_browsed_dir + "/" + locale_to_utf_cpy(new_dir); + string full_old_dir = Config.mpd_music_dir + myTagEditor->CurrentDir() + "/" + locale_to_utf_cpy(old_dir); + string full_new_dir = Config.mpd_music_dir + myTagEditor->CurrentDir() + "/" + locale_to_utf_cpy(new_dir); if (rename(full_old_dir.c_str(), full_new_dir.c_str()) == 0) { - Mpd->UpdateDirectory(editor_browsed_dir); + Mpd->UpdateDirectory(myTagEditor->CurrentDir()); } else { diff --git a/src/search_engine.h b/src/search_engine.h index 931c66c6..cff8365e 100644 --- a/src/search_engine.h +++ b/src/search_engine.h @@ -24,7 +24,7 @@ #include "mpdpp.h" #include "ncmpcpp.h" -class SearchEngine : public Screen < Menu< std::pair > > +class SearchEngine : public Screen< Menu< std::pair > > { class SearchPattern : public MPD::Song { diff --git a/src/status_checker.cpp b/src/status_checker.cpp index 97686ac7..73ac1ee7 100644 --- a/src/status_checker.cpp +++ b/src/status_checker.cpp @@ -46,6 +46,8 @@ namespace { time_t time_of_statusbar_lock; + int lock_statusbar_delay = -1; + string switch_state; bool block_statusbar_update = 0; diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index 5e4da717..399b2743 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -437,12 +437,12 @@ void TagEditor::Update() else { int highlightme = -1; - Mpd->GetDirectories(editor_browsed_dir, list); + Mpd->GetDirectories(itsBrowsedDir, list); sort(list.begin(), list.end(), CaseInsensitiveSorting()); - if (editor_browsed_dir != "/") + if (itsBrowsedDir != "/") { - size_t slash = editor_browsed_dir.rfind("/"); - string parent = slash != string::npos ? editor_browsed_dir.substr(0, slash) : "/"; + size_t slash = itsBrowsedDir.rfind("/"); + string parent = slash != string::npos ? itsBrowsedDir.substr(0, slash) : "/"; Dirs->AddOption(make_pair("[..]", parent)); } else @@ -455,7 +455,7 @@ void TagEditor::Update() string to_display = slash != string::npos ? it->substr(slash+1) : *it; utf_to_locale(to_display); Dirs->AddOption(make_pair(to_display, *it)); - if (*it == editor_highlighted_dir) + if (*it == itsHighlightedDir) highlightme = Dirs->Size()-1; } if (highlightme != -1) @@ -513,8 +513,8 @@ void TagEditor::EnterPressed() Mpd->GetDirectories(LeftColumn->Current().second, test); if (!test.empty()) { - editor_highlighted_dir = editor_browsed_dir; - editor_browsed_dir = LeftColumn->Current().second; + itsHighlightedDir = itsBrowsedDir; + itsBrowsedDir = LeftColumn->Current().second; LeftColumn->Clear(0); LeftColumn->Reset(); } diff --git a/src/tag_editor.h b/src/tag_editor.h index 109a4bf8..73780a39 100644 --- a/src/tag_editor.h +++ b/src/tag_editor.h @@ -79,6 +79,8 @@ class TagEditor : public Screen Menu *TagTypes; Menu *Tags; + const std::string &CurrentDir() { return itsBrowsedDir; } + static void ReadTags(mpd_Song *); static bool WriteTags(MPD::Song &); @@ -87,6 +89,9 @@ class TagEditor : public Screen static void CapitalizeFirstLetters(MPD::Song &); static void LowerAllLetters(MPD::Song &); + std::string itsBrowsedDir; + std::string itsHighlightedDir; + static const size_t MiddleColumnWidth; static size_t LeftColumnWidth; static size_t MiddleColumnStartX;