screen: rename BasicScreen to BaseScreen
This commit is contained in:
@@ -201,7 +201,7 @@ void Action::ResizeScreen(bool reload_main_window)
|
|||||||
|
|
||||||
SetResizeFlags();
|
SetResizeFlags();
|
||||||
|
|
||||||
applyToVisibleWindows(&BasicScreen::resize);
|
applyToVisibleWindows(&BaseScreen::resize);
|
||||||
|
|
||||||
if (Config.header_visibility || Config.new_design)
|
if (Config.header_visibility || Config.new_design)
|
||||||
wHeader->resize(COLS, HeaderHeight);
|
wHeader->resize(COLS, HeaderHeight);
|
||||||
@@ -210,7 +210,7 @@ void Action::ResizeScreen(bool reload_main_window)
|
|||||||
wFooter->moveTo(0, FooterStartY);
|
wFooter->moveTo(0, FooterStartY);
|
||||||
wFooter->resize(COLS, Config.statusbar_visibility ? 2 : 1);
|
wFooter->resize(COLS, Config.statusbar_visibility ? 2 : 1);
|
||||||
|
|
||||||
applyToVisibleWindows(&BasicScreen::refresh);
|
applyToVisibleWindows(&BaseScreen::refresh);
|
||||||
|
|
||||||
Status::Changes::elapsedTime();
|
Status::Changes::elapsedTime();
|
||||||
if (!Mpd.isPlaying())
|
if (!Mpd.isPlaying())
|
||||||
@@ -1611,7 +1611,7 @@ void ToggleScreenLock::Run()
|
|||||||
|
|
||||||
if (myLockedScreen != 0)
|
if (myLockedScreen != 0)
|
||||||
{
|
{
|
||||||
BasicScreen::unlock();
|
BaseScreen::unlock();
|
||||||
Action::SetResizeFlags();
|
Action::SetResizeFlags();
|
||||||
myScreen->resize();
|
myScreen->resize();
|
||||||
Statusbar::msg("Screen unlocked");
|
Statusbar::msg("Screen unlocked");
|
||||||
|
|||||||
@@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
namespace Global {//
|
namespace Global {//
|
||||||
|
|
||||||
BasicScreen *myScreen;
|
BaseScreen *myScreen;
|
||||||
BasicScreen *myLockedScreen;
|
BaseScreen *myLockedScreen;
|
||||||
BasicScreen *myInactiveScreen;
|
BaseScreen *myInactiveScreen;
|
||||||
|
|
||||||
NC::Window *wHeader;
|
NC::Window *wHeader;
|
||||||
NC::Window *wFooter;
|
NC::Window *wFooter;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@
|
|||||||
namespace Global {//
|
namespace Global {//
|
||||||
|
|
||||||
// currently active screen (displayed in main window)
|
// currently active screen (displayed in main window)
|
||||||
extern BasicScreen *myScreen;
|
extern BaseScreen *myScreen;
|
||||||
|
|
||||||
// points at the screen that was locked (or is null if no screen is locked)
|
// points at the screen that was locked (or is null if no screen is locked)
|
||||||
extern BasicScreen *myLockedScreen;
|
extern BaseScreen *myLockedScreen;
|
||||||
|
|
||||||
// points at inactive screen, if locking was enabled and two screens are displayed
|
// points at inactive screen, if locking was enabled and two screens are displayed
|
||||||
extern BasicScreen *myInactiveScreen;
|
extern BaseScreen *myInactiveScreen;
|
||||||
|
|
||||||
// header window (above main window)
|
// header window (above main window)
|
||||||
extern NC::Window *wHeader;
|
extern NC::Window *wHeader;
|
||||||
|
|||||||
@@ -28,17 +28,17 @@
|
|||||||
#include "status.h"
|
#include "status.h"
|
||||||
#include "utility/wide_string.h"
|
#include "utility/wide_string.h"
|
||||||
|
|
||||||
inline HasColumns *hasColumns(BasicScreen *screen)
|
inline HasColumns *hasColumns(BaseScreen *screen)
|
||||||
{
|
{
|
||||||
return dynamic_cast<HasColumns *>(screen);
|
return dynamic_cast<HasColumns *>(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline HasSongs *hasSongs(BasicScreen *screen)
|
inline HasSongs *hasSongs(BaseScreen *screen)
|
||||||
{
|
{
|
||||||
return dynamic_cast<HasSongs *>(screen);
|
return dynamic_cast<HasSongs *>(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::shared_ptr<ProxySongList> proxySongList(BasicScreen *screen)
|
inline std::shared_ptr<ProxySongList> proxySongList(BaseScreen *screen)
|
||||||
{
|
{
|
||||||
auto ptr = nullProxySongList();
|
auto ptr = nullProxySongList();
|
||||||
auto hs = hasSongs(screen);
|
auto hs = hasSongs(screen);
|
||||||
@@ -47,7 +47,7 @@ inline std::shared_ptr<ProxySongList> proxySongList(BasicScreen *screen)
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline MPD::Song *currentSong(BasicScreen *screen)
|
inline MPD::Song *currentSong(BaseScreen *screen)
|
||||||
{
|
{
|
||||||
MPD::Song *ptr = 0;
|
MPD::Song *ptr = 0;
|
||||||
auto pl = proxySongList(screen);
|
auto pl = proxySongList(screen);
|
||||||
|
|||||||
@@ -68,15 +68,15 @@ struct Tabbable
|
|||||||
if (m_previous_screen)
|
if (m_previous_screen)
|
||||||
m_previous_screen->switchTo();
|
m_previous_screen->switchTo();
|
||||||
}
|
}
|
||||||
void setPreviousScreen(BasicScreen *screen) {
|
void setPreviousScreen(BaseScreen *screen) {
|
||||||
m_previous_screen = screen;
|
m_previous_screen = screen;
|
||||||
}
|
}
|
||||||
BasicScreen *previousScreen() const {
|
BaseScreen *previousScreen() const {
|
||||||
return m_previous_screen;
|
return m_previous_screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BasicScreen *m_previous_screen;
|
BaseScreen *m_previous_screen;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _INTERFACES_H
|
#endif // _INTERFACES_H
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ void scrollpadMouseButtonPressed(NC::Scrollpad &w, MEVENT me)
|
|||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
void BasicScreen::getWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen)
|
void BaseScreen::getWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen)
|
||||||
{
|
{
|
||||||
width = COLS;
|
width = COLS;
|
||||||
x_offset = 0;
|
x_offset = 0;
|
||||||
@@ -100,7 +100,7 @@ void BasicScreen::getWindowResizeParams(size_t &x_offset, size_t &width, bool ad
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BasicScreen::lock()
|
bool BaseScreen::lock()
|
||||||
{
|
{
|
||||||
if (myLockedScreen)
|
if (myLockedScreen)
|
||||||
return false;
|
return false;
|
||||||
@@ -113,7 +113,7 @@ bool BasicScreen::lock()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BasicScreen::unlock()
|
void BaseScreen::unlock()
|
||||||
{
|
{
|
||||||
if (myInactiveScreen && myInactiveScreen != myLockedScreen)
|
if (myInactiveScreen && myInactiveScreen != myLockedScreen)
|
||||||
myScreen = myInactiveScreen;
|
myScreen = myInactiveScreen;
|
||||||
@@ -125,7 +125,7 @@ void BasicScreen::unlock()
|
|||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
void applyToVisibleWindows(void (BasicScreen::*f)())
|
void applyToVisibleWindows(void (BaseScreen::*f)())
|
||||||
{
|
{
|
||||||
if (myLockedScreen && myScreen->isMergable())
|
if (myLockedScreen && myScreen->isMergable())
|
||||||
{
|
{
|
||||||
@@ -140,7 +140,7 @@ void applyToVisibleWindows(void (BasicScreen::*f)())
|
|||||||
(myScreen->*f)();
|
(myScreen->*f)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateInactiveScreen(BasicScreen *screen_to_be_set)
|
void updateInactiveScreen(BaseScreen *screen_to_be_set)
|
||||||
{
|
{
|
||||||
if (myInactiveScreen && myLockedScreen != myInactiveScreen && myLockedScreen == screen_to_be_set)
|
if (myInactiveScreen && myLockedScreen != myInactiveScreen && myLockedScreen == screen_to_be_set)
|
||||||
{
|
{
|
||||||
@@ -164,7 +164,7 @@ void updateInactiveScreen(BasicScreen *screen_to_be_set)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isVisible(BasicScreen *screen)
|
bool isVisible(BaseScreen *screen)
|
||||||
{
|
{
|
||||||
assert(screen != 0);
|
assert(screen != 0);
|
||||||
if (myLockedScreen && myScreen->isMergable())
|
if (myLockedScreen && myScreen->isMergable())
|
||||||
|
|||||||
14
src/screen.h
14
src/screen.h
@@ -30,10 +30,10 @@ void scrollpadMouseButtonPressed(NC::Scrollpad &w, MEVENT me);
|
|||||||
/// An interface for various instantiations of Screen template class. Since C++ doesn't like
|
/// An interface for various instantiations of Screen template class. Since C++ doesn't like
|
||||||
/// comparison of two different instantiations of the same template class we need the most
|
/// comparison of two different instantiations of the same template class we need the most
|
||||||
/// basic class to be non-template to allow it.
|
/// basic class to be non-template to allow it.
|
||||||
struct BasicScreen
|
struct BaseScreen
|
||||||
{
|
{
|
||||||
BasicScreen() : hasToBeResized(false) { }
|
BaseScreen() : hasToBeResized(false) { }
|
||||||
virtual ~BasicScreen() { }
|
virtual ~BaseScreen() { }
|
||||||
|
|
||||||
/// @see Screen::isActiveWindow()
|
/// @see Screen::isActiveWindow()
|
||||||
virtual bool isActiveWindow(const NC::Window &w_) = 0;
|
virtual bool isActiveWindow(const NC::Window &w_) = 0;
|
||||||
@@ -103,15 +103,15 @@ protected:
|
|||||||
void getWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen = true);
|
void getWindowResizeParams(size_t &x_offset, size_t &width, bool adjust_locked_screen = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
void applyToVisibleWindows(void (BasicScreen::*f)());
|
void applyToVisibleWindows(void (BaseScreen::*f)());
|
||||||
void updateInactiveScreen(BasicScreen *screen_to_be_set);
|
void updateInactiveScreen(BaseScreen *screen_to_be_set);
|
||||||
bool isVisible(BasicScreen *screen);
|
bool isVisible(BaseScreen *screen);
|
||||||
|
|
||||||
/// Class that all screens should derive from. It provides basic interface
|
/// Class that all screens should derive from. It provides basic interface
|
||||||
/// for the screen to be working properly and assumes that we didn't forget
|
/// for the screen to be working properly and assumes that we didn't forget
|
||||||
/// about anything vital.
|
/// about anything vital.
|
||||||
///
|
///
|
||||||
template <typename WindowT> struct Screen : public BasicScreen
|
template <typename WindowT> struct Screen : public BaseScreen
|
||||||
{
|
{
|
||||||
typedef WindowT WindowType;
|
typedef WindowT WindowType;
|
||||||
typedef typename std::add_lvalue_reference<WindowType>::type WindowReference;
|
typedef typename std::add_lvalue_reference<WindowType>::type WindowReference;
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ void SelectedItemsAdder::mouseButtonPressed(MEVENT me)
|
|||||||
Screen<WindowType>::mouseButtonPressed(me);
|
Screen<WindowType>::mouseButtonPressed(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectedItemsAdder::populatePlaylistSelector(BasicScreen *old_screen)
|
void SelectedItemsAdder::populatePlaylistSelector(BaseScreen *old_screen)
|
||||||
{
|
{
|
||||||
typedef SelectedItemsAdder Self;
|
typedef SelectedItemsAdder Self;
|
||||||
m_playlist_selector.reset();
|
m_playlist_selector.reset();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ protected:
|
|||||||
virtual bool isLockable() OVERRIDE { return false; }
|
virtual bool isLockable() OVERRIDE { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void populatePlaylistSelector(BasicScreen *screen);
|
void populatePlaylistSelector(BaseScreen *screen);
|
||||||
|
|
||||||
void addToCurrentPlaylist();
|
void addToCurrentPlaylist();
|
||||||
void addToNewPlaylist() const;
|
void addToNewPlaylist() const;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "strbuffer.h"
|
#include "strbuffer.h"
|
||||||
|
|
||||||
struct BasicScreen; // forward declaration for screens sequence
|
struct BaseScreen; // forward declaration for screens sequence
|
||||||
|
|
||||||
enum SortMode { smName, smMTime, smCustomFormat };
|
enum SortMode { smName, smMTime, smCustomFormat };
|
||||||
|
|
||||||
@@ -50,20 +50,20 @@ struct ScreenRef
|
|||||||
{
|
{
|
||||||
ScreenRef() : m_ptr(0) { }
|
ScreenRef() : m_ptr(0) { }
|
||||||
template <typename ScreenT>
|
template <typename ScreenT>
|
||||||
ScreenRef(ScreenT *&ptr) : m_ptr(reinterpret_cast<BasicScreen **>(&ptr)) { }
|
ScreenRef(ScreenT *&ptr) : m_ptr(reinterpret_cast<BaseScreen **>(&ptr)) { }
|
||||||
|
|
||||||
BasicScreen &operator*() const { return **m_ptr; }
|
BaseScreen &operator*() const { return **m_ptr; }
|
||||||
BasicScreen *operator->() const { return *m_ptr; }
|
BaseScreen *operator->() const { return *m_ptr; }
|
||||||
|
|
||||||
bool operator==(const ScreenRef &rhs) const { return m_ptr == rhs.m_ptr; }
|
bool operator==(const ScreenRef &rhs) const { return m_ptr == rhs.m_ptr; }
|
||||||
bool operator!=(const ScreenRef &rhs) const { return m_ptr != rhs.m_ptr; }
|
bool operator!=(const ScreenRef &rhs) const { return m_ptr != rhs.m_ptr; }
|
||||||
bool operator==(const BasicScreen *rhs) const { return *m_ptr == rhs; }
|
bool operator==(const BaseScreen *rhs) const { return *m_ptr == rhs; }
|
||||||
bool operator!=(const BasicScreen *rhs) const { return *m_ptr != rhs; }
|
bool operator!=(const BaseScreen *rhs) const { return *m_ptr != rhs; }
|
||||||
|
|
||||||
operator bool() { return m_ptr != 0; }
|
operator bool() { return m_ptr != 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BasicScreen **m_ptr;
|
BaseScreen **m_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Configuration
|
struct Configuration
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ void Status::trace()
|
|||||||
Mpd.UpdateStatus();
|
Mpd.UpdateStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
applyToVisibleWindows(&BasicScreen::update);
|
applyToVisibleWindows(&BaseScreen::update);
|
||||||
|
|
||||||
if (isVisible(myPlaylist)
|
if (isVisible(myPlaylist)
|
||||||
&& Timer.tv_sec == myPlaylist->Timer().tv_sec+Config.playlist_disable_highlight_delay
|
&& Timer.tv_sec == myPlaylist->Timer().tv_sec+Config.playlist_disable_highlight_delay
|
||||||
@@ -553,5 +553,5 @@ void Status::update(MPD::Connection *, MPD::StatusChanges changes, void *)
|
|||||||
if (changes.PlayerState || (changes.ElapsedTime && (!Config.new_design || Mpd.GetState() == MPD::psPlay)))
|
if (changes.PlayerState || (changes.ElapsedTime && (!Config.new_design || Mpd.GetState() == MPD::psPlay)))
|
||||||
wFooter->refresh();
|
wFooter->refresh();
|
||||||
if (changes.Playlist || changes.Database || changes.PlayerState || changes.SongID)
|
if (changes.Playlist || changes.Database || changes.PlayerState || changes.SongID)
|
||||||
applyToVisibleWindows(&BasicScreen::refreshWindow);
|
applyToVisibleWindows(&BaseScreen::refreshWindow);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
bool getTags();
|
bool getTags();
|
||||||
MPD::MutableSong itsEdited;
|
MPD::MutableSong itsEdited;
|
||||||
BasicScreen *m_previous_screen;
|
BaseScreen *m_previous_screen;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TinyTagEditor *myTinyTagEditor;
|
extern TinyTagEditor *myTinyTagEditor;
|
||||||
|
|||||||
Reference in New Issue
Block a user