get rid of some externs

This commit is contained in:
Andrzej Rybczak
2009-02-15 20:44:42 +01:00
parent c547fbe03b
commit 9dd21b7653
7 changed files with 24 additions and 34 deletions

View File

@@ -34,8 +34,6 @@ namespace Display
*menu << t;
}
//void TotalPlaylistLength(Window &);
void StringPairs(const string_pair &, void *, Menu<string_pair> *);
void SongsInColumns(const MPD::Song &, void *, Menu<MPD::Song> *);
@@ -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

View File

@@ -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;

View File

@@ -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
{

View File

@@ -24,7 +24,7 @@
#include "mpdpp.h"
#include "ncmpcpp.h"
class SearchEngine : public Screen < Menu< std::pair<Buffer *, MPD::Song *> > >
class SearchEngine : public Screen< Menu< std::pair<Buffer *, MPD::Song *> > >
{
class SearchPattern : public MPD::Song
{

View File

@@ -46,6 +46,8 @@ namespace
{
time_t time_of_statusbar_lock;
int lock_statusbar_delay = -1;
string switch_state;
bool block_statusbar_update = 0;

View File

@@ -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();
}

View File

@@ -79,6 +79,8 @@ class TagEditor : public Screen<Window>
Menu<std::string> *TagTypes;
Menu<MPD::Song> *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<Window>
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;