some general source code tweaks
This commit is contained in:
@@ -1,10 +1,40 @@
|
|||||||
bin_PROGRAMS = ncmpcpp
|
bin_PROGRAMS = ncmpcpp
|
||||||
ncmpcpp_SOURCES = actions.cpp browser.cpp charset.cpp clock.cpp conv.cpp \
|
ncmpcpp_SOURCES = \
|
||||||
curl_handle.cpp display.cpp error.cpp help.cpp helpers.cpp lastfm.cpp \
|
actions.cpp \
|
||||||
lastfm_service.cpp lyrics.cpp lyrics_fetcher.cpp media_library.cpp menu.cpp mpdpp.cpp \
|
browser.cpp \
|
||||||
ncmpcpp.cpp outputs.cpp playlist.cpp playlist_editor.cpp screen.cpp scrollpad.cpp \
|
charset.cpp \
|
||||||
search_engine.cpp sel_items_adder.cpp server_info.cpp settings.cpp song.cpp song_info.cpp \
|
clock.cpp \
|
||||||
status.cpp tag_editor.cpp tiny_tag_editor.cpp tolower.cpp visualizer.cpp \
|
conv.cpp \
|
||||||
|
curl_handle.cpp \
|
||||||
|
display.cpp \
|
||||||
|
error.cpp \
|
||||||
|
global.cpp \
|
||||||
|
help.cpp \
|
||||||
|
helpers.cpp \
|
||||||
|
lastfm.cpp \
|
||||||
|
lastfm_service.cpp \
|
||||||
|
lyrics.cpp \
|
||||||
|
lyrics_fetcher.cpp \
|
||||||
|
media_library.cpp \
|
||||||
|
menu.cpp \
|
||||||
|
mpdpp.cpp \
|
||||||
|
ncmpcpp.cpp \
|
||||||
|
outputs.cpp \
|
||||||
|
playlist.cpp \
|
||||||
|
playlist_editor.cpp \
|
||||||
|
screen.cpp \
|
||||||
|
scrollpad.cpp \
|
||||||
|
search_engine.cpp \
|
||||||
|
sel_items_adder.cpp \
|
||||||
|
server_info.cpp \
|
||||||
|
settings.cpp \
|
||||||
|
song.cpp \
|
||||||
|
song_info.cpp \
|
||||||
|
status.cpp \
|
||||||
|
tag_editor.cpp \
|
||||||
|
tiny_tag_editor.cpp \
|
||||||
|
tolower.cpp \
|
||||||
|
visualizer.cpp \
|
||||||
window.cpp
|
window.cpp
|
||||||
|
|
||||||
# set the include path found by configure
|
# set the include path found by configure
|
||||||
@@ -12,9 +42,37 @@ INCLUDES= $(all_includes)
|
|||||||
|
|
||||||
# the library search path.
|
# the library search path.
|
||||||
ncmpcpp_LDFLAGS = $(all_libraries)
|
ncmpcpp_LDFLAGS = $(all_libraries)
|
||||||
noinst_HEADERS = browser.h charset.h clock.h conv.h curl_handle.h display.h \
|
noinst_HEADERS = \
|
||||||
error.h global.h help.h helpers.h lastfm.h lastfm_service.h lyrics.h \
|
browser.h \
|
||||||
lyrics_fetcher.h macro_utilities.h media_library.h menu.h mpdpp.h outputs.h \
|
charset.h \
|
||||||
playlist_editor.h screen.h scrollpad.h search_engine.h sel_items_adder.h server_info.h \
|
clock.h \
|
||||||
settings.h song.h song_info.h tag_editor.h tiny_tag_editor.h tolower.h \
|
conv.h \
|
||||||
visualizer.h window.h
|
curl_handle.h \
|
||||||
|
display.h \
|
||||||
|
error.h \
|
||||||
|
global.h \
|
||||||
|
help.h \
|
||||||
|
helpers.h \
|
||||||
|
lastfm.h \
|
||||||
|
lastfm_service.h \
|
||||||
|
lyrics.h \
|
||||||
|
lyrics_fetcher.h \
|
||||||
|
macro_utilities.h \
|
||||||
|
media_library.h \
|
||||||
|
menu.h \
|
||||||
|
mpdpp.h \
|
||||||
|
outputs.h \
|
||||||
|
playlist_editor.h \
|
||||||
|
screen.h \
|
||||||
|
scrollpad.h \
|
||||||
|
search_engine.h \
|
||||||
|
sel_items_adder.h \
|
||||||
|
server_info.h \
|
||||||
|
settings.h \
|
||||||
|
song.h \
|
||||||
|
song_info.h \
|
||||||
|
tag_editor.h \
|
||||||
|
tiny_tag_editor.h \
|
||||||
|
tolower.h \
|
||||||
|
visualizer.h \
|
||||||
|
window.h
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ void Action::ResizeScreen()
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
RedrawHeader = 1;
|
RedrawHeader = true;
|
||||||
MainHeight = LINES-(Config.new_design ? 7 : 4);
|
MainHeight = LINES-(Config.new_design ? 7 : 4);
|
||||||
|
|
||||||
ValidateScreenSize();
|
ValidateScreenSize();
|
||||||
@@ -184,7 +184,7 @@ void Action::ResizeScreen()
|
|||||||
wFooter->Resize(COLS, Config.statusbar_visibility ? 2 : 1);
|
wFooter->Resize(COLS, Config.statusbar_visibility ? 2 : 1);
|
||||||
|
|
||||||
ApplyToVisibleWindows(&BasicScreen::Refresh);
|
ApplyToVisibleWindows(&BasicScreen::Refresh);
|
||||||
RedrawStatusbar = 1;
|
RedrawStatusbar = true;
|
||||||
MPD::StatusChanges changes;
|
MPD::StatusChanges changes;
|
||||||
if (!Mpd.isPlaying() || DesignChanged)
|
if (!Mpd.isPlaying() || DesignChanged)
|
||||||
{
|
{
|
||||||
@@ -199,7 +199,7 @@ void Action::ResizeScreen()
|
|||||||
NcmpcppStatusChanged(&Mpd, changes, 0);
|
NcmpcppStatusChanged(&Mpd, changes, 0);
|
||||||
if (DesignChanged)
|
if (DesignChanged)
|
||||||
{
|
{
|
||||||
RedrawStatusbar = 1;
|
RedrawStatusbar = true;
|
||||||
NcmpcppStatusChanged(&Mpd, MPD::StatusChanges(), 0);
|
NcmpcppStatusChanged(&Mpd, MPD::StatusChanges(), 0);
|
||||||
DesignChanged = 0;
|
DesignChanged = 0;
|
||||||
ShowMessage("User interface: %s", Config.new_design ? "Alternative" : "Classic");
|
ShowMessage("User interface: %s", Config.new_design ? "Alternative" : "Classic");
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ void Browser::SwitchTo()
|
|||||||
if (myScreen != this && myScreen->isTabbable())
|
if (myScreen != this && myScreen->isTabbable())
|
||||||
Global::myPrevScreen = myScreen;
|
Global::myPrevScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
RedrawHeader = 1;
|
RedrawHeader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::basic_string<my_char_t> Browser::Title()
|
std::basic_string<my_char_t> Browser::Title()
|
||||||
@@ -129,7 +129,7 @@ void Browser::EnterPressed()
|
|||||||
case itDirectory:
|
case itDirectory:
|
||||||
{
|
{
|
||||||
GetDirectory(item.name, itsBrowsedDir);
|
GetDirectory(item.name, itsBrowsedDir);
|
||||||
RedrawHeader = 1;
|
RedrawHeader = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case itSong:
|
case itSong:
|
||||||
@@ -222,7 +222,7 @@ void Browser::MouseButtonPressed(MEVENT me)
|
|||||||
if (me.bstate & BUTTON1_PRESSED)
|
if (me.bstate & BUTTON1_PRESSED)
|
||||||
{
|
{
|
||||||
GetDirectory(w->Current().name);
|
GetDirectory(w->Current().name);
|
||||||
RedrawHeader = 1;
|
RedrawHeader = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -527,7 +527,7 @@ void Browser::ChangeBrowseMode()
|
|||||||
itsBrowsedDir.resize(itsBrowsedDir.length()-1);
|
itsBrowsedDir.resize(itsBrowsedDir.length()-1);
|
||||||
w->Reset();
|
w->Reset();
|
||||||
GetDirectory(itsBrowsedDir);
|
GetDirectory(itsBrowsedDir);
|
||||||
RedrawHeader = 1;
|
RedrawHeader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Browser::DeleteItem(const MPD::Item &item)
|
bool Browser::DeleteItem(const MPD::Item &item)
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ void Clock::SwitchTo()
|
|||||||
if (myScreen != this && myScreen->isTabbable())
|
if (myScreen != this && myScreen->isTabbable())
|
||||||
Global::myPrevScreen = myScreen;
|
Global::myPrevScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
Prepare();
|
Prepare();
|
||||||
itsPane->Refresh();
|
itsPane->Refresh();
|
||||||
// clearing screen apparently fixes the problem with last digits being misrendered
|
// clearing screen apparently fixes the problem with last digits being misrendered
|
||||||
|
|||||||
@@ -21,17 +21,11 @@
|
|||||||
#ifndef _ERROR_H
|
#ifndef _ERROR_H
|
||||||
#define _ERROR_H
|
#define _ERROR_H
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
|
||||||
# define GNUC_NORETURN __attribute__((noreturn))
|
|
||||||
#else
|
|
||||||
# define GNUC_NORETURN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include "gcc.h"
|
||||||
|
|
||||||
#define Error(msg) std::cerr << "ncmpcpp: " << msg;
|
#define Error(msg) std::cerr << "ncmpcpp: " << msg;
|
||||||
|
|
||||||
void FatalError(const std::string &msg) GNUC_NORETURN;
|
void FatalError(const std::string &msg) GNUC_NORETURN;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,11 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||||
|
# define GNUC_NORETURN __attribute__((noreturn))
|
||||||
# define GNUC_UNUSED __attribute__((unused))
|
# define GNUC_UNUSED __attribute__((unused))
|
||||||
# define GNUC_PRINTF(a, b) __attribute__((format(printf, a, b)))
|
# define GNUC_PRINTF(a, b) __attribute__((format(printf, a, b)))
|
||||||
#else
|
#else
|
||||||
|
# define GNUC_NORETURN
|
||||||
# define GNUC_UNUSED
|
# define GNUC_UNUSED
|
||||||
# define GNUC_PRINTF(a, b)
|
# define GNUC_PRINTF(a, b)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
36
src/global.h
36
src/global.h
@@ -29,27 +29,51 @@
|
|||||||
|
|
||||||
namespace Global
|
namespace Global
|
||||||
{
|
{
|
||||||
|
// currently active screen (displayed in main window)
|
||||||
extern BasicScreen *myScreen;
|
extern BasicScreen *myScreen;
|
||||||
extern BasicScreen *myOldScreen; // for info, lyrics, popups
|
|
||||||
extern BasicScreen *myPrevScreen; // "real" screen switching (browser, search, etc.)
|
|
||||||
extern BasicScreen *myLockedScreen; // points at the screen that was locked (or is null if no screen is locked)
|
|
||||||
extern BasicScreen *myInactiveScreen; // points at inactive screen, if locking was enabled and two screens are displayed
|
|
||||||
|
|
||||||
|
// for info, lyrics, popups to remember which screen return to
|
||||||
|
extern BasicScreen *myOldScreen;
|
||||||
|
|
||||||
|
// "real" screen switching (browser, search, etc.)
|
||||||
|
extern BasicScreen *myPrevScreen;
|
||||||
|
|
||||||
|
// points at the screen that was locked (or is null if no screen is locked)
|
||||||
|
extern BasicScreen *myLockedScreen;
|
||||||
|
|
||||||
|
// points at inactive screen, if locking was enabled and two screens are displayed
|
||||||
|
extern BasicScreen *myInactiveScreen;
|
||||||
|
|
||||||
|
// header window (above main window)
|
||||||
extern Window *wHeader;
|
extern Window *wHeader;
|
||||||
|
|
||||||
|
// footer window (below main window)
|
||||||
extern Window *wFooter;
|
extern Window *wFooter;
|
||||||
|
|
||||||
|
// Y coordinate of top of main window
|
||||||
extern size_t MainStartY;
|
extern size_t MainStartY;
|
||||||
|
|
||||||
|
// height of main window
|
||||||
extern size_t MainHeight;
|
extern size_t MainHeight;
|
||||||
|
|
||||||
extern bool MessagesAllowed;
|
// indicates whether messages from ShowMessage function should be shown
|
||||||
|
extern bool ShowMessages;
|
||||||
|
|
||||||
|
// indicates whether seeking action in currently in progress
|
||||||
extern bool SeekingInProgress;
|
extern bool SeekingInProgress;
|
||||||
|
|
||||||
|
// indicates whether header should be immediately repainted
|
||||||
extern bool RedrawHeader;
|
extern bool RedrawHeader;
|
||||||
|
|
||||||
|
// indicates whether statusbar should be immediately repainted
|
||||||
extern bool RedrawStatusbar;
|
extern bool RedrawStatusbar;
|
||||||
|
|
||||||
|
// string that represents volume in right top corner. being global
|
||||||
|
// to be used for calculating width offsets in various files.
|
||||||
extern std::string VolumeState;
|
extern std::string VolumeState;
|
||||||
|
|
||||||
|
// global timer
|
||||||
extern timeval Timer;
|
extern timeval Timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void Help::SwitchTo()
|
|||||||
if (myScreen != this && myScreen->isTabbable())
|
if (myScreen != this && myScreen->isTabbable())
|
||||||
Global::myPrevScreen = myScreen;
|
Global::myPrevScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void Lastfm::SwitchTo()
|
|||||||
myOldScreen = myScreen;
|
myOldScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
|
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lastfm::Load()
|
void Lastfm::Load()
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void Lyrics::Update()
|
|||||||
const MPD::Song *s = myPlaylist->NowPlayingSong();
|
const MPD::Song *s = myPlaylist->NowPlayingSong();
|
||||||
if (s && !s->GetArtist().empty() && !s->GetTitle().empty())
|
if (s && !s->GetArtist().empty() && !s->GetTitle().empty())
|
||||||
{
|
{
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
itsScrollBegin = 0;
|
itsScrollBegin = 0;
|
||||||
itsSong = *s;
|
itsSong = *s;
|
||||||
Load();
|
Load();
|
||||||
@@ -125,7 +125,7 @@ void Lyrics::SwitchTo()
|
|||||||
itsSong = *s;
|
itsSong = *s;
|
||||||
Load();
|
Load();
|
||||||
|
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ void MediaLibrary::SwitchTo()
|
|||||||
if (myScreen != this && myScreen->isTabbable())
|
if (myScreen != this && myScreen->isTabbable())
|
||||||
Global::myPrevScreen = myScreen;
|
Global::myPrevScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
Refresh();
|
Refresh();
|
||||||
UpdateSongList(Songs);
|
UpdateSongList(Songs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,25 +41,6 @@
|
|||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "visualizer.h"
|
#include "visualizer.h"
|
||||||
|
|
||||||
using namespace Global;
|
|
||||||
using namespace MPD;
|
|
||||||
|
|
||||||
BasicScreen *Global::myScreen;
|
|
||||||
BasicScreen *Global::myOldScreen;
|
|
||||||
BasicScreen *Global::myPrevScreen;
|
|
||||||
BasicScreen *Global::myLockedScreen;
|
|
||||||
BasicScreen *Global::myInactiveScreen;
|
|
||||||
|
|
||||||
Window *Global::wHeader;
|
|
||||||
Window *Global::wFooter;
|
|
||||||
|
|
||||||
size_t Global::MainStartY;
|
|
||||||
size_t Global::MainHeight;
|
|
||||||
|
|
||||||
bool Global::MessagesAllowed = 0;
|
|
||||||
bool Global::SeekingInProgress = 0;
|
|
||||||
bool Global::RedrawHeader = 1;
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::ofstream errorlog;
|
std::ofstream errorlog;
|
||||||
@@ -94,6 +75,20 @@ namespace
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
using Global::myScreen;
|
||||||
|
using Global::myOldScreen;
|
||||||
|
using Global::myPrevScreen;
|
||||||
|
using Global::myLockedScreen;
|
||||||
|
using Global::myInactiveScreen;
|
||||||
|
|
||||||
|
using Global::wHeader;
|
||||||
|
using Global::wFooter;
|
||||||
|
|
||||||
|
using Global::RedrawHeader;
|
||||||
|
using Global::ShowMessages;
|
||||||
|
using Global::VolumeState;
|
||||||
|
using Global::Timer;
|
||||||
|
|
||||||
srand(time(0));
|
srand(time(0));
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
@@ -212,7 +207,7 @@ int main(int argc, char **argv)
|
|||||||
wFooter->AddFDCallback(Mpd.GetFD(), StatusbarMPDCallback);
|
wFooter->AddFDCallback(Mpd.GetFD(), StatusbarMPDCallback);
|
||||||
Mpd.OrderDataFetching(); // we need info about new connection
|
Mpd.OrderDataFetching(); // we need info about new connection
|
||||||
}
|
}
|
||||||
MessagesAllowed = 0;
|
ShowMessages = false;
|
||||||
# ifdef ENABLE_VISUALIZER
|
# ifdef ENABLE_VISUALIZER
|
||||||
myVisualizer->ResetFD();
|
myVisualizer->ResetFD();
|
||||||
if (myScreen == myVisualizer)
|
if (myScreen == myVisualizer)
|
||||||
@@ -224,7 +219,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
TraceMpdStatus();
|
TraceMpdStatus();
|
||||||
|
|
||||||
MessagesAllowed = 1;
|
ShowMessages = true;
|
||||||
|
|
||||||
if (Action::OrderResize)
|
if (Action::OrderResize)
|
||||||
Action::ResizeScreen();
|
Action::ResizeScreen();
|
||||||
@@ -234,7 +229,7 @@ int main(int argc, char **argv)
|
|||||||
&& (myScreen == myPlaylist || myScreen == myBrowser || myScreen == myLyrics)
|
&& (myScreen == myPlaylist || myScreen == myBrowser || myScreen == myLyrics)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
RedrawHeader = 1;
|
RedrawHeader = true;
|
||||||
gettimeofday(&past, 0);
|
gettimeofday(&past, 0);
|
||||||
}
|
}
|
||||||
if (Config.header_visibility && RedrawHeader)
|
if (Config.header_visibility && RedrawHeader)
|
||||||
@@ -258,7 +253,7 @@ int main(int argc, char **argv)
|
|||||||
*wHeader << clEnd;
|
*wHeader << clEnd;
|
||||||
}
|
}
|
||||||
wHeader->Refresh();
|
wHeader->Refresh();
|
||||||
RedrawHeader = 0;
|
RedrawHeader = false;
|
||||||
}
|
}
|
||||||
// header stuff end
|
// header stuff end
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void Outputs::SwitchTo()
|
|||||||
myScreen = this;
|
myScreen = this;
|
||||||
w->Window::Clear();
|
w->Window::Clear();
|
||||||
|
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Outputs::Resize()
|
void Outputs::Resize()
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ using Global::MainStartY;
|
|||||||
Playlist *myPlaylist = new Playlist;
|
Playlist *myPlaylist = new Playlist;
|
||||||
|
|
||||||
bool Playlist::ReloadTotalLength = 0;
|
bool Playlist::ReloadTotalLength = 0;
|
||||||
bool Playlist::ReloadRemaining = 0;
|
bool Playlist::ReloadRemaining = false;
|
||||||
|
|
||||||
const size_t Playlist::SortOptions = 10;
|
const size_t Playlist::SortOptions = 10;
|
||||||
const size_t Playlist::SortDialogWidth = 30;
|
const size_t Playlist::SortDialogWidth = 30;
|
||||||
@@ -112,7 +112,7 @@ void Playlist::SwitchTo()
|
|||||||
EnableHighlighting();
|
EnableHighlighting();
|
||||||
if (w != Items) // even if sorting window is active, background has to be refreshed anyway
|
if (w != Items) // even if sorting window is active, background has to be refreshed anyway
|
||||||
Items->Display();
|
Items->Display();
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::Resize()
|
void Playlist::Resize()
|
||||||
@@ -460,7 +460,7 @@ std::string Playlist::TotalLength()
|
|||||||
itsRemainingTime = 0;
|
itsRemainingTime = 0;
|
||||||
for (size_t i = NowPlaying; i < Items->Size(); ++i)
|
for (size_t i = NowPlaying; i < Items->Size(); ++i)
|
||||||
itsRemainingTime += (*Items)[i].GetTotalLength();
|
itsRemainingTime += (*Items)[i].GetTotalLength();
|
||||||
ReloadRemaining = 0;
|
ReloadRemaining = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
result << '(' << Items->Size() << (Items->Size() == 1 ? " item" : " items");
|
result << '(' << Items->Size() << (Items->Size() == 1 ? " item" : " items");
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void PlaylistEditor::SwitchTo()
|
|||||||
if (myScreen != this && myScreen->isTabbable())
|
if (myScreen != this && myScreen->isTabbable())
|
||||||
Global::myPrevScreen = myScreen;
|
Global::myPrevScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
Refresh();
|
Refresh();
|
||||||
UpdateSongList(Content);
|
UpdateSongList(Content);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void SearchEngine::SwitchTo()
|
|||||||
if (myScreen != this && myScreen->isTabbable())
|
if (myScreen != this && myScreen->isTabbable())
|
||||||
Global::myPrevScreen = myScreen;
|
Global::myPrevScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
|
|
||||||
if (!w->Back().first)
|
if (!w->Back().first)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void SongInfo::SwitchTo()
|
|||||||
myOldScreen = myScreen;
|
myOldScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
|
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
|
|
||||||
w->Clear();
|
w->Clear();
|
||||||
w->Reset();
|
w->Reset();
|
||||||
|
|||||||
@@ -43,14 +43,12 @@
|
|||||||
using Global::myScreen;
|
using Global::myScreen;
|
||||||
using Global::myLockedScreen;
|
using Global::myLockedScreen;
|
||||||
using Global::myInactiveScreen;
|
using Global::myInactiveScreen;
|
||||||
using Global::wFooter;
|
|
||||||
using Global::Timer;
|
|
||||||
using Global::wHeader;
|
|
||||||
using Global::VolumeState;
|
|
||||||
|
|
||||||
bool Global::RedrawStatusbar = 0;
|
using Global::wFooter;
|
||||||
std::string Global::VolumeState;
|
using Global::wHeader;
|
||||||
timeval Global::Timer;
|
|
||||||
|
using Global::Timer;
|
||||||
|
using Global::VolumeState;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@@ -191,7 +189,6 @@ void NcmpcppErrorCallback(MPD::Connection *, int errorid, const char *msg, void
|
|||||||
// for errorid:
|
// for errorid:
|
||||||
// - 0-7 bits define MPD_ERROR_* codes, compare them with (0xff & errorid)
|
// - 0-7 bits define MPD_ERROR_* codes, compare them with (0xff & errorid)
|
||||||
// - 8-15 bits define MPD_SERVER_ERROR_* codes, compare them with (errorid >> 8)
|
// - 8-15 bits define MPD_SERVER_ERROR_* codes, compare them with (errorid >> 8)
|
||||||
|
|
||||||
if ((errorid >> 8) == MPD_SERVER_ERROR_PERMISSION)
|
if ((errorid >> 8) == MPD_SERVER_ERROR_PERMISSION)
|
||||||
{
|
{
|
||||||
wFooter->SetGetStringHelper(0);
|
wFooter->SetGetStringHelper(0);
|
||||||
@@ -262,8 +259,8 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
|
|||||||
}
|
}
|
||||||
FreeSongList(list);
|
FreeSongList(list);
|
||||||
|
|
||||||
Playlist::ReloadTotalLength = 1;
|
Playlist::ReloadTotalLength = true;
|
||||||
Playlist::ReloadRemaining = 1;
|
Playlist::ReloadRemaining = true;
|
||||||
|
|
||||||
if (myPlaylist->Items->Empty())
|
if (myPlaylist->Items->Empty())
|
||||||
{
|
{
|
||||||
@@ -330,7 +327,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
|
|||||||
if (!np.Empty())
|
if (!np.Empty())
|
||||||
WindowTitle(utf_to_locale_cpy(np.toString(Config.song_window_title_format)));
|
WindowTitle(utf_to_locale_cpy(np.toString(Config.song_window_title_format)));
|
||||||
player_state = Config.new_design ? "[playing]" : "Playing: ";
|
player_state = Config.new_design ? "[playing]" : "Playing: ";
|
||||||
Playlist::ReloadRemaining = 1;
|
Playlist::ReloadRemaining = true;
|
||||||
if (Mpd.GetOldState() == MPD::psStop) // show track info in status immediately
|
if (Mpd.GetOldState() == MPD::psStop) // show track info in status immediately
|
||||||
changed.ElapsedTime = 1;
|
changed.ElapsedTime = 1;
|
||||||
break;
|
break;
|
||||||
@@ -345,7 +342,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
|
|||||||
WindowTitle("ncmpcpp ver. "VERSION);
|
WindowTitle("ncmpcpp ver. "VERSION);
|
||||||
if (!block_progressbar_update)
|
if (!block_progressbar_update)
|
||||||
DrawProgressbar(0, 0);
|
DrawProgressbar(0, 0);
|
||||||
Playlist::ReloadRemaining = 1;
|
Playlist::ReloadRemaining = true;
|
||||||
myPlaylist->NowPlaying = -1;
|
myPlaylist->NowPlaying = -1;
|
||||||
if (Config.new_design)
|
if (Config.new_design)
|
||||||
{
|
{
|
||||||
@@ -403,7 +400,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
|
|||||||
if (Config.now_playing_lyrics && isVisible(myLyrics) && Global::myOldScreen == myPlaylist)
|
if (Config.now_playing_lyrics && isVisible(myLyrics) && Global::myOldScreen == myPlaylist)
|
||||||
myLyrics->ReloadNP = 1;
|
myLyrics->ReloadNP = 1;
|
||||||
}
|
}
|
||||||
Playlist::ReloadRemaining = 1;
|
Playlist::ReloadRemaining = true;
|
||||||
playing_song_scroll_begin = 0;
|
playing_song_scroll_begin = 0;
|
||||||
first_line_scroll_begin = 0;
|
first_line_scroll_begin = 0;
|
||||||
second_line_scroll_begin = 0;
|
second_line_scroll_begin = 0;
|
||||||
@@ -497,7 +494,7 @@ void NcmpcppStatusChanged(MPD::Connection *, MPD::StatusChanges changed, void *)
|
|||||||
}
|
}
|
||||||
if (!block_progressbar_update)
|
if (!block_progressbar_update)
|
||||||
DrawProgressbar(Mpd.GetElapsedTime(), Mpd.GetTotalTime());
|
DrawProgressbar(Mpd.GetElapsedTime(), Mpd.GetTotalTime());
|
||||||
Global::RedrawStatusbar = 0;
|
Global::RedrawStatusbar = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -676,7 +673,7 @@ void DrawProgressbar(unsigned elapsed, unsigned time)
|
|||||||
|
|
||||||
void ShowMessage(const char *format, ...)
|
void ShowMessage(const char *format, ...)
|
||||||
{
|
{
|
||||||
if (Global::MessagesAllowed && allow_statusbar_unlock)
|
if (Global::ShowMessages && allow_statusbar_unlock)
|
||||||
{
|
{
|
||||||
time(&time_of_statusbar_lock);
|
time(&time_of_statusbar_lock);
|
||||||
lock_statusbar_delay = Config.message_delay_time;
|
lock_statusbar_delay = Config.message_delay_time;
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ void TagEditor::SwitchTo()
|
|||||||
if (myScreen != this && myScreen->isTabbable())
|
if (myScreen != this && myScreen->isTabbable())
|
||||||
Global::myPrevScreen = myScreen;
|
Global::myPrevScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void TinyTagEditor::SwitchTo()
|
|||||||
|
|
||||||
myOldScreen = myScreen;
|
myOldScreen = myScreen;
|
||||||
myScreen = this;
|
myScreen = this;
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void Visualizer::SwitchTo()
|
|||||||
|
|
||||||
if (itsFifo >= 0)
|
if (itsFifo >= 0)
|
||||||
Global::wFooter->SetTimeout(WindowTimeout);
|
Global::wFooter->SetTimeout(WindowTimeout);
|
||||||
Global::RedrawHeader = 1;
|
Global::RedrawHeader = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Visualizer::Resize()
|
void Visualizer::Resize()
|
||||||
|
|||||||
Reference in New Issue
Block a user