do not restrict statusbar_visibility option if alternative ui is active

This commit is contained in:
Andrzej Rybczak
2009-08-26 05:11:20 +02:00
parent 56a1d7456c
commit b13479e014
2 changed files with 14 additions and 18 deletions

View File

@@ -132,19 +132,15 @@ int main(int argc, char *argv[])
InitScreen("ncmpc++ ver. "VERSION, Config.colors_enabled);
bool real_header_visibility = Config.header_visibility;
bool real_statusbar_visibility = Config.statusbar_visibility;
if (Config.new_design)
{
Config.header_visibility = 1;
Config.statusbar_visibility = 0;
}
size_t header_height, footer_start_y, footer_height;
SetWindowsDimensions(header_height, footer_start_y, footer_height);
if (Config.header_visibility)
if (Config.header_visibility || Config.new_design)
{
wHeader = new Window(0, 0, COLS, header_height, "", Config.header_color, brNone);
wHeader->Display();
@@ -333,16 +329,7 @@ int main(int argc, char *argv[])
if (Keypressed(input, Key.ToggleInterface))
{
Config.new_design = !Config.new_design;
if (Config.new_design)
{
Config.header_visibility = 1;
Config.statusbar_visibility = 0;
}
else
{
Config.header_visibility = real_header_visibility;
Config.statusbar_visibility = real_statusbar_visibility;
}
Config.statusbar_visibility = Config.new_design ? 0 : real_statusbar_visibility;
SetWindowsDimensions(header_height, footer_start_y, footer_height);
UnlockProgressbar();
UnlockStatusbar();
@@ -452,7 +439,7 @@ int main(int argc, char *argv[])
myScreen->Resize();
if (Config.header_visibility)
if (Config.header_visibility || Config.new_design)
wHeader->Resize(COLS, header_height);
footer_start_y = LINES-(Config.statusbar_visibility ? 2 : 1);
@@ -468,6 +455,9 @@ int main(int argc, char *argv[])
if (design_changed)
changes.Volume = 1;
}
// Note: routines for drawing separator if alternative user
// interface is active and header is hidden are placed in
// NcmpcppStatusChanges.StatusFlags
changes.StatusFlags = 1; // force status update
NcmpcppStatusChanged(&Mpd, changes, 0);
if (design_changed)

View File

@@ -554,7 +554,7 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *)
mpd_db_updating = Mpd.GetDBIsUpdating() ? 'U' : 0;
ShowMessage(!mpd_db_updating ? "Database update finished!" : "Database update started!");
}
if (changed.StatusFlags && Config.header_visibility)
if (changed.StatusFlags && (Config.header_visibility || Config.new_design))
{
std::string switch_state;
@@ -569,6 +569,12 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *)
switch_state += mpd_db_updating ? mpd_db_updating : '-';
switch_state += ']';
*wHeader << XY(COLS-switch_state.length(), 1) << fmtBold << Config.state_flags_color << switch_state << clEnd << fmtBoldEnd;
if (Config.new_design && !Config.header_visibility) // in this case also draw separator
{
*wHeader << fmtBold << clBlack;
mvwhline(wHeader->Raw(), 2, 0, 0, COLS);
*wHeader << clEnd << fmtBoldEnd;
}
wHeader->Refresh();
}
else
@@ -603,7 +609,7 @@ void NcmpcppStatusChanged(Connection *, StatusChanges changed, void *)
refresh();
}
}
if (changed.Volume && Config.header_visibility)
if (changed.Volume && (Config.header_visibility || Config.new_design))
{
VolumeState = Config.new_design ? " Vol: " : " Volume: ";
int volume = Mpd.GetVolume();