another externs removed

This commit is contained in:
Andrzej Rybczak
2009-02-15 23:08:15 +01:00
parent 26365d9832
commit f9cdfa5d2b
9 changed files with 19 additions and 18 deletions

View File

@@ -185,7 +185,7 @@ void Browser::SpacePressed()
block_item_list_update = 1; block_item_list_update = 1;
if (Config.ncmpc_like_songs_adding && w->isBold()) if (Config.ncmpc_like_songs_adding && w->isBold())
{ {
block_playlist_update = 1; Playlist::BlockUpdate = 1;
long long hash = w->Current().song->GetHash(); long long hash = w->Current().song->GetHash();
for (size_t i = 0; i < myPlaylist->Main()->Size(); i++) for (size_t i = 0; i < myPlaylist->Main()->Size(); i++)
{ {

View File

@@ -46,18 +46,15 @@ namespace Global
extern pthread_mutex_t curl; extern pthread_mutex_t curl;
# endif # endif
extern bool dont_change_now_playing;
extern bool block_progressbar_update; extern bool block_progressbar_update;
extern bool block_playlist_update;
extern bool block_item_list_update; extern bool block_item_list_update;
extern bool header_update_status;
extern bool messages_allowed; extern bool messages_allowed;
extern bool redraw_header; extern bool redraw_header;
extern std::string volume_state; extern std::string volume_state;
extern bool header_update_status;
extern std::vector<int> vFoundPositions; extern std::vector<int> vFoundPositions;
extern int found_pos; extern int found_pos;
} }

View File

@@ -362,7 +362,7 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
} }
else else
{ {
block_playlist_update = 1; Playlist::BlockUpdate = 1;
for (size_t i = 0; i < myPlaylist->Main()->Size(); i++) for (size_t i = 0; i < myPlaylist->Main()->Size(); i++)
{ {
if (myPlaylist->Main()->at(i).GetHash() == hash) if (myPlaylist->Main()->at(i).GetHash() == hash)

View File

@@ -73,9 +73,7 @@ size_t Global::main_height;
time_t Global::timer; time_t Global::timer;
bool Global::dont_change_now_playing = 0;
bool Global::block_progressbar_update = 0; bool Global::block_progressbar_update = 0;
bool Global::block_playlist_update = 0;
bool Global::block_item_list_update = 0; bool Global::block_item_list_update = 0;
bool Global::messages_allowed = 0; bool Global::messages_allowed = 0;
@@ -204,7 +202,7 @@ int main(int argc, char *argv[])
TraceMpdStatus(); TraceMpdStatus();
block_item_list_update = 0; block_item_list_update = 0;
block_playlist_update = 0; Playlist::BlockUpdate = 0;
messages_allowed = 1; messages_allowed = 1;
// header stuff // header stuff
@@ -437,7 +435,7 @@ int main(int argc, char *argv[])
{ {
if (!myPlaylist->Main()->Empty() && myScreen == myPlaylist) if (!myPlaylist->Main()->Empty() && myScreen == myPlaylist)
{ {
block_playlist_update = 1; Playlist::BlockUpdate = 1;
if (myPlaylist->Main()->hasSelected()) if (myPlaylist->Main()->hasSelected())
{ {
vector<size_t> list; vector<size_t> list;
@@ -451,7 +449,7 @@ int main(int argc, char *argv[])
} }
else else
{ {
dont_change_now_playing = 1; Playlist::BlockNowPlayingUpdate = 1;
myPlaylist->Main()->SetTimeout(50); myPlaylist->Main()->SetTimeout(50);
while (!myPlaylist->Main()->Empty() && Keypressed(input, Key.Delete)) while (!myPlaylist->Main()->Empty() && Keypressed(input, Key.Delete))
{ {
@@ -466,7 +464,7 @@ int main(int argc, char *argv[])
myPlaylist->Main()->ReadKey(input); myPlaylist->Main()->ReadKey(input);
} }
myPlaylist->Main()->SetTimeout(ncmpcpp_window_timeout); myPlaylist->Main()->SetTimeout(ncmpcpp_window_timeout);
dont_change_now_playing = 0; Playlist::BlockNowPlayingUpdate = 0;
} }
Mpd->CommitQueue(); Mpd->CommitQueue();
} }
@@ -603,7 +601,7 @@ int main(int argc, char *argv[])
{ {
if (myScreen == myPlaylist && !myPlaylist->Main()->Empty()) if (myScreen == myPlaylist && !myPlaylist->Main()->Empty())
{ {
block_playlist_update = 1; Playlist::BlockUpdate = 1;
myPlaylist->Main()->SetTimeout(50); myPlaylist->Main()->SetTimeout(50);
if (myPlaylist->Main()->hasSelected()) if (myPlaylist->Main()->hasSelected())
{ {
@@ -706,7 +704,7 @@ int main(int argc, char *argv[])
{ {
if (myScreen == myPlaylist && !myPlaylist->Main()->Empty()) if (myScreen == myPlaylist && !myPlaylist->Main()->Empty())
{ {
block_playlist_update = 1; Playlist::BlockUpdate = 1;
myPlaylist->Main()->SetTimeout(50); myPlaylist->Main()->SetTimeout(50);
if (myPlaylist->Main()->hasSelected()) if (myPlaylist->Main()->hasSelected())
{ {

View File

@@ -32,6 +32,9 @@ using std::vector;
Playlist *myPlaylist = new Playlist; Playlist *myPlaylist = new Playlist;
bool Playlist::BlockNowPlayingUpdate = 0;
bool Playlist::BlockUpdate = 0;
void Playlist::Init() void Playlist::Init()
{ {
w = new Menu<MPD::Song>(0, main_start_y, COLS, main_height, Config.columns_in_playlist ? Display::Columns(Config.song_columns_list_format) : "", Config.main_color, brNone); w = new Menu<MPD::Song>(0, main_start_y, COLS, main_height, Config.columns_in_playlist ? Display::Columns(Config.song_columns_list_format) : "", Config.main_color, brNone);

View File

@@ -48,6 +48,9 @@ class Playlist : public Screen< Menu<MPD::Song> >
int NowPlaying; int NowPlaying;
int OldPlaying; int OldPlaying;
static bool BlockNowPlayingUpdate;
static bool BlockUpdate;
protected: protected:
std::string TotalLength(); std::string TotalLength();
}; };

View File

@@ -229,7 +229,7 @@ void PlaylistEditor::AddToPlaylist(bool add_n_play)
} }
else else
{ {
block_playlist_update = 1; Playlist::BlockUpdate = 1;
for (size_t i = 0; i < myPlaylist->Main()->Size(); i++) for (size_t i = 0; i < myPlaylist->Main()->Size(); i++)
{ {
if (myPlaylist->Main()->at(i).GetHash() == hash) if (myPlaylist->Main()->at(i).GetHash() == hash)

View File

@@ -259,7 +259,7 @@ void SearchEngine::SpacePressed()
block_item_list_update = 1; block_item_list_update = 1;
if (Config.ncmpc_like_songs_adding && w->isBold()) if (Config.ncmpc_like_songs_adding && w->isBold())
{ {
block_playlist_update = 1; Playlist::BlockUpdate = 1;
long long hash = w->Current().second->GetHash(); long long hash = w->Current().second->GetHash();
for (size_t i = 0; i < myPlaylist->Main()->Size(); i++) for (size_t i = 0; i < myPlaylist->Main()->Size(); i++)
{ {

View File

@@ -147,7 +147,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
wFooter->Bold(1); wFooter->Bold(1);
wFooter->GetXY(sx, sy); wFooter->GetXY(sx, sy);
if ((myPlaylist->NowPlaying != Mpd->GetCurrentSongPos() || changed.SongID) && !dont_change_now_playing) if ((myPlaylist->NowPlaying != Mpd->GetCurrentSongPos() || changed.SongID) && !Playlist::BlockNowPlayingUpdate)
{ {
myPlaylist->OldPlaying = myPlaylist->NowPlaying; myPlaylist->OldPlaying = myPlaylist->NowPlaying;
myPlaylist->NowPlaying = Mpd->GetCurrentSongPos(); myPlaylist->NowPlaying = Mpd->GetCurrentSongPos();
@@ -161,7 +161,7 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
if (changed.Playlist) if (changed.Playlist)
{ {
if (!block_playlist_update) if (!Playlist::BlockUpdate)
{ {
SongList list; SongList list;
size_t playlist_length = Mpd->GetPlaylistLength(); size_t playlist_length = Mpd->GetPlaylistLength();