actions: remove Actions::DesignChanged flag

This commit is contained in:
Andrzej Rybczak
2012-09-12 02:56:12 +02:00
parent 983c79ff61
commit 0179b5304c
3 changed files with 11 additions and 20 deletions

View File

@@ -64,7 +64,6 @@ using namespace std::placeholders;
using Global::myScreen; using Global::myScreen;
bool Action::OriginalStatusbarVisibility; bool Action::OriginalStatusbarVisibility;
bool Action::DesignChanged;
bool Action::ExitMainLoop = false; bool Action::ExitMainLoop = false;
size_t Action::HeaderHeight; size_t Action::HeaderHeight;
@@ -126,7 +125,7 @@ void Action::SetResizeFlags()
# endif // ENABLE_CLOCK # endif // ENABLE_CLOCK
} }
void Action::ResizeScreen() void Action::ResizeScreen(bool reload_main_window)
{ {
using Global::MainHeight; using Global::MainHeight;
using Global::wHeader; using Global::wHeader;
@@ -136,7 +135,7 @@ void Action::ResizeScreen()
resize_term(0, 0); resize_term(0, 0);
# else # else
// update internal screen dimensions // update internal screen dimensions
if (!DesignChanged) if (reload_main_window)
{ {
endwin(); endwin();
refresh(); refresh();
@@ -157,7 +156,7 @@ void Action::ResizeScreen()
if (!Config.header_visibility) if (!Config.header_visibility)
MainHeight += 2; MainHeight += 2;
if (!Config.statusbar_visibility) if (!Config.statusbar_visibility)
MainHeight++; ++MainHeight;
SetResizeFlags(); SetResizeFlags();
@@ -173,21 +172,12 @@ void Action::ResizeScreen()
ApplyToVisibleWindows(&BasicScreen::Refresh); ApplyToVisibleWindows(&BasicScreen::Refresh);
Status::Changes::elapsedTime(); Status::Changes::elapsedTime();
if (!Mpd.isPlaying() || DesignChanged) if (!Mpd.isPlaying())
{
Status::Changes::playerState(); Status::Changes::playerState();
if (DesignChanged)
Status::Changes::mixer();
}
// Note: routines for drawing separator if alternative user // Note: routines for drawing separator if alternative user
// interface is active and header is hidden are placed in // interface is active and header is hidden are placed in
// NcmpcppStatusChanges.StatusFlags // NcmpcppStatusChanges.StatusFlags
Status::Changes::flags(); Status::Changes::flags();
if (DesignChanged)
{
DesignChanged = false;
Statusbar::msg("User interface: %s", Config.new_design ? "Alternative" : "Classic");
}
drawHeader(); drawHeader();
wFooter->refresh(); wFooter->refresh();
refresh(); refresh();
@@ -207,7 +197,7 @@ void Action::SetWindowsDimensions()
MainHeight += 2; MainHeight += 2;
} }
if (!Config.statusbar_visibility) if (!Config.statusbar_visibility)
MainHeight++; ++MainHeight;
HeaderHeight = Config.new_design ? (Config.header_visibility ? 5 : 3) : 1; HeaderHeight = Config.new_design ? (Config.header_visibility ? 5 : 3) : 1;
FooterStartY = LINES-(Config.statusbar_visibility ? 2 : 1); FooterStartY = LINES-(Config.statusbar_visibility ? 2 : 1);
@@ -629,8 +619,10 @@ void ToggleInterface::Run()
SetWindowsDimensions(); SetWindowsDimensions();
Progressbar::unlock(); Progressbar::unlock();
Statusbar::unlock(); Statusbar::unlock();
DesignChanged = true; ResizeScreen(false);
ResizeScreen(); if (!Mpd.isPlaying())
Status::Changes::mixer();
Statusbar::msg("User interface: %s", Config.new_design ? "Alternative" : "Classic");
} }
bool JumpToParentDirectory::canBeRun() const bool JumpToParentDirectory::canBeRun() const

View File

@@ -74,7 +74,7 @@ struct Action
static void ValidateScreenSize(); static void ValidateScreenSize();
static void SetResizeFlags(); static void SetResizeFlags();
static void ResizeScreen(); static void ResizeScreen(bool reload_main_window);
static void SetWindowsDimensions(); static void SetWindowsDimensions();
static bool ConnectToMPD(); static bool ConnectToMPD();
@@ -85,7 +85,6 @@ struct Action
static Action *Get(const std::string &name); static Action *Get(const std::string &name);
static bool OriginalStatusbarVisibility; static bool OriginalStatusbarVisibility;
static bool DesignChanged;
static bool ExitMainLoop; static bool ExitMainLoop;
static size_t HeaderHeight; static size_t HeaderHeight;

View File

@@ -58,7 +58,7 @@ namespace
} }
else if (signal == SIGWINCH) else if (signal == SIGWINCH)
{ {
Action::ResizeScreen(); Action::ResizeScreen(true);
} }
} }
# endif // !WIN32 # endif // !WIN32