require a bit bigger screen so all possible dialogs will fit

This commit is contained in:
Andrzej Rybczak
2012-09-13 20:21:02 +02:00
parent dd7665bb7d
commit fcc097fc76
5 changed files with 8 additions and 37 deletions

View File

@@ -84,10 +84,10 @@ void Action::ValidateScreenSize()
{ {
using Global::MainHeight; using Global::MainHeight;
if (COLS < 20 || MainHeight < 3) if (COLS < 30 || MainHeight < 5)
{ {
NC::destroyScreen(); NC::destroyScreen();
std::cout << "Screen is too small!\n"; std::cout << "Screen is too small to handle ncmpcpp correctly\n";
exit(1); exit(1);
} }
} }

View File

@@ -137,14 +137,9 @@ void Playlist::resize()
if (w == SortDialog) // if sorting window is active, playlist needs refreshing if (w == SortDialog) // if sorting window is active, playlist needs refreshing
Items->display(); Items->display();
SortDialogHeight = std::min(int(MainHeight), 17); SortDialogHeight = std::min(size_t(17), MainHeight);
if (Items->getWidth() >= SortDialogWidth && MainHeight >= 5) SortDialog->resize(SortDialogWidth, SortDialogHeight);
{ SortDialog->moveTo(x_offset+(width-SortDialogWidth)/2, (MainHeight-SortDialogHeight)/2+MainStartY);
SortDialog->resize(SortDialogWidth, SortDialogHeight);
SortDialog->moveTo(x_offset+(width-SortDialogWidth)/2, (MainHeight-SortDialogHeight)/2+MainStartY);
}
else // if screen is too low to display sorting window, fall back to items list
w = Items;
hasToBeResized = 0; hasToBeResized = 0;
} }
@@ -390,13 +385,8 @@ void Playlist::Sort()
{ {
if (isFiltered()) if (isFiltered())
return; return;
if (Items->getWidth() < SortDialogWidth || MainHeight < 5) SortDialog->reset();
Statusbar::msg("Screen is too small to display dialog window"); w = SortDialog;
else
{
SortDialog->reset();
w = SortDialog;
}
} }
void Playlist::Reverse() void Playlist::Reverse()

View File

@@ -76,12 +76,6 @@ void SelectedItemsAdder::switchTo()
if (!hs || !hs->allowsSelection()) if (!hs || !hs->allowsSelection())
return; return;
if (MainHeight < 5)
{
Statusbar::msg("Screen is too small to display this window");
return;
}
if (!isInitialized) if (!isInitialized)
init(); init();

View File

@@ -52,11 +52,6 @@ void ServerInfo::switchTo()
myOldScreen->switchTo(); myOldScreen->switchTo();
return; return;
} }
if (MainHeight < 5)
{
Statusbar::msg("Screen is too small to display this window");
return;
}
if (!isInitialized) if (!isInitialized)
init(); init();

View File

@@ -155,7 +155,7 @@ void TagEditor::SetDimensions(size_t x_offset, size_t width)
RightColumnStartX = MiddleColumnStartX+MiddleColumnWidth+1; RightColumnStartX = MiddleColumnStartX+MiddleColumnWidth+1;
FParserDialogWidth = std::min(30, COLS); FParserDialogWidth = std::min(30, COLS);
FParserDialogHeight = std::min(size_t(6), MainHeight); FParserDialogHeight = std::min(size_t(5), MainHeight);
FParserWidth = width*0.9; FParserWidth = width*0.9;
FParserHeight = std::min(size_t(LINES*0.8), MainHeight); FParserHeight = std::min(size_t(LINES*0.8), MainHeight);
FParserWidthOne = FParserWidth/2; FParserWidthOne = FParserWidth/2;
@@ -185,9 +185,6 @@ void TagEditor::resize()
FParserLegend->moveTo(x_offset+(width-FParserWidth)/2+FParserWidthOne, (MainHeight-FParserHeight)/2+MainStartY); FParserLegend->moveTo(x_offset+(width-FParserWidth)/2+FParserWidthOne, (MainHeight-FParserHeight)/2+MainStartY);
FParserPreview->moveTo(x_offset+(width-FParserWidth)/2+FParserWidthOne, (MainHeight-FParserHeight)/2+MainStartY); FParserPreview->moveTo(x_offset+(width-FParserWidth)/2+FParserWidthOne, (MainHeight-FParserHeight)/2+MainStartY);
if (MainHeight < 5 && (w == FParserDialog || w == FParser || w == FParserHelper)) // screen too low
w = TagTypes; // fall back to main columns
hasToBeResized = 0; hasToBeResized = 0;
} }
@@ -534,11 +531,6 @@ void TagEditor::enterPressed()
{ {
if (w == TagTypes) if (w == TagTypes)
{ {
if (size_t(COLS) < FParserDialogWidth || MainHeight < FParserDialogHeight)
{
Statusbar::msg("Screen is too small to display additional windows");
return;
}
FParserDialog->reset(); FParserDialog->reset();
w = FParserDialog; w = FParserDialog;
} }