global: remove RedrawHeader
This commit is contained in:
@@ -127,7 +127,6 @@ void Action::SetResizeFlags()
|
||||
void Action::ResizeScreen()
|
||||
{
|
||||
using Global::MainHeight;
|
||||
using Global::RedrawHeader;
|
||||
using Global::RedrawStatusbar;
|
||||
using Global::wHeader;
|
||||
using Global::wFooter;
|
||||
@@ -152,7 +151,6 @@ void Action::ResizeScreen()
|
||||
}
|
||||
# endif
|
||||
|
||||
RedrawHeader = true;
|
||||
MainHeight = LINES-(Config.new_design ? 7 : 4);
|
||||
|
||||
ValidateScreenSize();
|
||||
@@ -194,6 +192,7 @@ void Action::ResizeScreen()
|
||||
DesignChanged = 0;
|
||||
ShowMessage("User interface: %s", Config.new_design ? "Alternative" : "Classic");
|
||||
}
|
||||
DrawHeader();
|
||||
wFooter->refresh();
|
||||
refresh();
|
||||
}
|
||||
@@ -737,11 +736,10 @@ void MasterScreen::Run()
|
||||
{
|
||||
using Global::myInactiveScreen;
|
||||
using Global::myLockedScreen;
|
||||
using Global::RedrawHeader;
|
||||
|
||||
myInactiveScreen = myScreen;
|
||||
myScreen = myLockedScreen;
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
bool SlaveScreen::canBeRun() const
|
||||
@@ -759,11 +757,10 @@ void SlaveScreen::Run()
|
||||
{
|
||||
using Global::myInactiveScreen;
|
||||
using Global::myLockedScreen;
|
||||
using Global::RedrawHeader;
|
||||
|
||||
myScreen = myInactiveScreen;
|
||||
myInactiveScreen = myLockedScreen;
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
void VolumeUp::Run()
|
||||
@@ -1229,15 +1226,13 @@ bool JumpToPlayingSong::canBeRun() const
|
||||
|
||||
void JumpToPlayingSong::Run()
|
||||
{
|
||||
using Global::RedrawHeader;
|
||||
|
||||
if (myScreen == myPlaylist)
|
||||
myPlaylist->Items->highlight(myPlaylist->NowPlaying);
|
||||
else if (myScreen == myBrowser)
|
||||
{
|
||||
const MPD::Song *s = myPlaylist->NowPlayingSong();
|
||||
myBrowser->LocateSong(*s);
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
else if (myScreen == myLibrary)
|
||||
{
|
||||
@@ -1882,7 +1877,6 @@ bool ApplyFilter::canBeRun() const
|
||||
|
||||
void ApplyFilter::Run()
|
||||
{
|
||||
using Global::RedrawHeader;
|
||||
using Global::wFooter;
|
||||
|
||||
Filterable *f = dynamic_cast<Filterable *>(myScreen);
|
||||
@@ -1908,7 +1902,7 @@ void ApplyFilter::Run()
|
||||
{
|
||||
myPlaylist->EnableHighlighting();
|
||||
Playlist::ReloadTotalLength = true;
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
ListsChangeFinisher();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ using namespace std::placeholders;
|
||||
using Global::MainHeight;
|
||||
using Global::MainStartY;
|
||||
using Global::myScreen;
|
||||
using Global::RedrawHeader;
|
||||
|
||||
using MPD::itDirectory;
|
||||
using MPD::itSong;
|
||||
@@ -116,7 +115,7 @@ void Browser::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
std::basic_string<my_char_t> Browser::Title()
|
||||
@@ -146,7 +145,7 @@ void Browser::EnterPressed()
|
||||
}
|
||||
else
|
||||
GetDirectory(item.name, itsBrowsedDir);
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
break;
|
||||
}
|
||||
case itSong:
|
||||
@@ -236,7 +235,7 @@ void Browser::MouseButtonPressed(MEVENT me)
|
||||
if (me.bstate & BUTTON1_PRESSED)
|
||||
{
|
||||
GetDirectory(w->current().value().name);
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -574,7 +573,7 @@ void Browser::ChangeBrowseMode()
|
||||
itsBrowsedDir.resize(itsBrowsedDir.length()-1);
|
||||
w->reset();
|
||||
GetDirectory(itsBrowsedDir);
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
bool Browser::deleteItem(const MPD::Item &item)
|
||||
|
||||
@@ -102,7 +102,7 @@ void Clock::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
Prepare();
|
||||
itsPane->refresh();
|
||||
// clearing screen apparently fixes the problem with last digits being misrendered
|
||||
|
||||
@@ -35,7 +35,6 @@ size_t Global::MainHeight;
|
||||
bool Global::ShowMessages = false;
|
||||
bool Global::SeekingInProgress = false;
|
||||
|
||||
bool Global::RedrawHeader = true;
|
||||
bool Global::RedrawStatusbar = true;
|
||||
|
||||
std::string Global::VolumeState;
|
||||
|
||||
@@ -61,9 +61,6 @@ namespace Global
|
||||
// indicates whether seeking action in currently in progress
|
||||
extern bool SeekingInProgress;
|
||||
|
||||
// indicates whether header should be immediately repainted
|
||||
extern bool RedrawHeader;
|
||||
|
||||
// indicates whether statusbar should be immediately repainted
|
||||
extern bool RedrawStatusbar;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "global.h"
|
||||
#include "help.h"
|
||||
#include "settings.h"
|
||||
#include "status.h"
|
||||
|
||||
using Global::MainHeight;
|
||||
using Global::MainStartY;
|
||||
@@ -129,8 +130,7 @@ void Help::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
Global::RedrawHeader = true;
|
||||
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
std::basic_string<my_char_t> Help::Title()
|
||||
|
||||
@@ -105,8 +105,7 @@ void Lastfm::SwitchTo()
|
||||
|
||||
myOldScreen = myScreen;
|
||||
myScreen = this;
|
||||
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
void Lastfm::Load()
|
||||
|
||||
@@ -80,7 +80,7 @@ void Lyrics::Update()
|
||||
const MPD::Song *s = myPlaylist->NowPlayingSong();
|
||||
if (s && !s->getArtist().empty() && !s->getTitle().empty())
|
||||
{
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
itsScrollBegin = 0;
|
||||
itsSong = *s;
|
||||
Load();
|
||||
@@ -129,7 +129,7 @@ void Lyrics::SwitchTo()
|
||||
itsSong = *s;
|
||||
Load();
|
||||
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -205,7 +205,7 @@ void MediaLibrary::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
markSongsInPlaylist(songsProxyList());
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,6 @@ int main(int argc, char **argv)
|
||||
using Global::wHeader;
|
||||
using Global::wFooter;
|
||||
|
||||
using Global::RedrawHeader;
|
||||
using Global::ShowMessages;
|
||||
using Global::VolumeState;
|
||||
using Global::Timer;
|
||||
@@ -237,32 +236,10 @@ int main(int argc, char **argv)
|
||||
&& (myScreen == myPlaylist || myScreen == myBrowser || myScreen == myLyrics)
|
||||
)
|
||||
{
|
||||
RedrawHeader = true;
|
||||
DrawHeader();
|
||||
gettimeofday(&past, 0);
|
||||
}
|
||||
if (Config.header_visibility && RedrawHeader)
|
||||
{
|
||||
if (Config.new_design)
|
||||
{
|
||||
std::basic_string<my_char_t> title = myScreen->Title();
|
||||
*wHeader << NC::XY(0, 3) << wclrtoeol;
|
||||
*wHeader << NC::fmtBold << Config.alternative_ui_separator_color;
|
||||
mvwhline(wHeader->raw(), 2, 0, 0, COLS);
|
||||
mvwhline(wHeader->raw(), 4, 0, 0, COLS);
|
||||
*wHeader << NC::XY((COLS-NC::Window::length(title))/2, 3);
|
||||
*wHeader << Config.header_color << title << NC::clEnd;
|
||||
*wHeader << NC::clEnd << NC::fmtBoldEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
*wHeader << NC::XY(0, 0) << wclrtoeol << NC::fmtBold << myScreen->Title() << NC::fmtBoldEnd;
|
||||
*wHeader << Config.volume_color;
|
||||
*wHeader << NC::XY(wHeader->getWidth()-VolumeState.length(), 0) << VolumeState;
|
||||
*wHeader << NC::clEnd;
|
||||
}
|
||||
wHeader->refresh();
|
||||
RedrawHeader = false;
|
||||
}
|
||||
|
||||
// header stuff end
|
||||
|
||||
if (input != Key::noOp)
|
||||
|
||||
@@ -65,8 +65,7 @@ void Outputs::SwitchTo()
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
w->Window::clear();
|
||||
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
void Outputs::Resize()
|
||||
|
||||
@@ -121,7 +121,7 @@ void Playlist::SwitchTo()
|
||||
EnableHighlighting();
|
||||
if (w != Items) // even if sorting window is active, background has to be refreshed anyway
|
||||
Items->display();
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
|
||||
void Playlist::Resize()
|
||||
|
||||
@@ -132,7 +132,7 @@ void PlaylistEditor::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
markSongsInPlaylist(contentProxyList());
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@@ -148,8 +148,7 @@ void SearchEngine::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
Global::RedrawHeader = true;
|
||||
|
||||
DrawHeader();
|
||||
markSongsInPlaylist(getProxySongList());
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,7 @@ void SongInfo::SwitchTo()
|
||||
|
||||
myOldScreen = myScreen;
|
||||
myScreen = this;
|
||||
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
|
||||
w->clear();
|
||||
w->reset();
|
||||
|
||||
@@ -643,6 +643,31 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
|
||||
ApplyToVisibleWindows(&BasicScreen::RefreshWindow);
|
||||
}
|
||||
|
||||
void DrawHeader()
|
||||
{
|
||||
if (!Config.header_visibility)
|
||||
return;
|
||||
if (Config.new_design)
|
||||
{
|
||||
std::basic_string<my_char_t> title = myScreen->Title();
|
||||
*wHeader << NC::XY(0, 3) << wclrtoeol;
|
||||
*wHeader << NC::fmtBold << Config.alternative_ui_separator_color;
|
||||
mvwhline(wHeader->raw(), 2, 0, 0, COLS);
|
||||
mvwhline(wHeader->raw(), 4, 0, 0, COLS);
|
||||
*wHeader << NC::XY((COLS-NC::Window::length(title))/2, 3);
|
||||
*wHeader << Config.header_color << title << NC::clEnd;
|
||||
*wHeader << NC::clEnd << NC::fmtBoldEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
*wHeader << NC::XY(0, 0) << wclrtoeol << NC::fmtBold << myScreen->Title() << NC::fmtBoldEnd;
|
||||
*wHeader << Config.volume_color;
|
||||
*wHeader << NC::XY(wHeader->getWidth()-VolumeState.length(), 0) << VolumeState;
|
||||
*wHeader << NC::clEnd;
|
||||
}
|
||||
wHeader->refresh();
|
||||
}
|
||||
|
||||
NC::Window &Statusbar()
|
||||
{
|
||||
*wFooter << NC::XY(0, Config.statusbar_visibility) << wclrtoeol;
|
||||
|
||||
@@ -40,6 +40,8 @@ void TraceMpdStatus();
|
||||
void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges, void *);
|
||||
void NcmpcppErrorCallback(MPD::Connection *, int, const char *, void *);
|
||||
|
||||
void DrawHeader();
|
||||
|
||||
NC::Window &Statusbar();
|
||||
void DrawProgressbar(unsigned elapsed, unsigned time);
|
||||
void ShowMessage(const char *, ...) GNUC_PRINTF(1, 2);
|
||||
|
||||
@@ -225,7 +225,7 @@ void TagEditor::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ void TinyTagEditor::SwitchTo()
|
||||
|
||||
myOldScreen = myScreen;
|
||||
myScreen = this;
|
||||
Global::RedrawHeader = true;
|
||||
DrawHeader();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -81,6 +81,7 @@ void Visualizer::SwitchTo()
|
||||
if (myScreen != this && myScreen->isTabbable())
|
||||
Global::myPrevScreen = myScreen;
|
||||
myScreen = this;
|
||||
DrawHeader();
|
||||
w->clear();
|
||||
|
||||
SetFD();
|
||||
@@ -90,7 +91,6 @@ void Visualizer::SwitchTo()
|
||||
|
||||
if (itsFifo >= 0)
|
||||
Global::wFooter->setTimeout(WindowTimeout);
|
||||
Global::RedrawHeader = true;
|
||||
}
|
||||
|
||||
void Visualizer::Resize()
|
||||
|
||||
Reference in New Issue
Block a user