fix possible issues with additinal windows due to too small screen size
This commit is contained in:
@@ -1538,11 +1538,16 @@ int main(int argc, char *argv[])
|
|||||||
ShowMessage("No selected items!");
|
ShowMessage("No selected items!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (MainHeight < 5)
|
||||||
|
{
|
||||||
|
ShowMessage("Screen is too small to display this window!");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const size_t dialog_width = COLS*0.8;
|
const size_t dialog_width = COLS*0.8;
|
||||||
const size_t dialog_height = LINES*0.6;
|
const size_t dialog_height = std::min(size_t(LINES*0.6), MainHeight);
|
||||||
|
|
||||||
Menu<std::string> mDialog((COLS-dialog_width)/2, (LINES-dialog_height)/2, dialog_width, dialog_height, "Add selected items to...", Config.main_color, Config.window_border);
|
Menu<std::string> mDialog((COLS-dialog_width)/2, (MainHeight-dialog_height)/2+MainStartY, dialog_width, dialog_height, "Add selected items to...", Config.main_color, Config.window_border);
|
||||||
mDialog.SetTimeout(ncmpcpp_window_timeout);
|
mDialog.SetTimeout(ncmpcpp_window_timeout);
|
||||||
mDialog.CyclicScrolling(Config.use_cyclic_scrolling);
|
mDialog.CyclicScrolling(Config.use_cyclic_scrolling);
|
||||||
mDialog.SetItemDisplayer(Display::Generic);
|
mDialog.SetItemDisplayer(Display::Generic);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void Playlist::Init()
|
|||||||
|
|
||||||
SortDialogHeight = std::min(int(MainHeight-2), 18);
|
SortDialogHeight = std::min(int(MainHeight-2), 18);
|
||||||
|
|
||||||
SortDialog = new Menu< std::pair<std::string, MPD::Song::GetFunction> >((COLS-SortDialogWidth)/2, (LINES-SortDialogHeight)/2, SortDialogWidth, SortDialogHeight, "Sort songs by...", Config.main_color, Config.window_border);
|
SortDialog = new Menu< std::pair<std::string, MPD::Song::GetFunction> >((COLS-SortDialogWidth)/2, (MainHeight-SortDialogHeight)/2+MainStartY, SortDialogWidth, SortDialogHeight, "Sort songs by...", Config.main_color, Config.window_border);
|
||||||
SortDialog->SetTimeout(ncmpcpp_window_timeout);
|
SortDialog->SetTimeout(ncmpcpp_window_timeout);
|
||||||
SortDialog->CyclicScrolling(Config.use_cyclic_scrolling);
|
SortDialog->CyclicScrolling(Config.use_cyclic_scrolling);
|
||||||
SortDialog->SetItemDisplayer(Display::Pairs);
|
SortDialog->SetItemDisplayer(Display::Pairs);
|
||||||
@@ -107,10 +107,10 @@ void Playlist::Resize()
|
|||||||
w->Resize(COLS, MainHeight);
|
w->Resize(COLS, MainHeight);
|
||||||
w->MoveTo(0, MainStartY);
|
w->MoveTo(0, MainStartY);
|
||||||
w->SetTitle(Config.columns_in_playlist ? Display::Columns() : "");
|
w->SetTitle(Config.columns_in_playlist ? Display::Columns() : "");
|
||||||
SortDialogHeight = std::min(int(MainHeight-2), 18);
|
SortDialogHeight = std::min(int(MainHeight), 18);
|
||||||
if (MainHeight > 6)
|
if (MainHeight > 5)
|
||||||
SortDialog->Resize(SortDialogWidth, SortDialogHeight);
|
SortDialog->Resize(SortDialogWidth, SortDialogHeight);
|
||||||
SortDialog->MoveTo((COLS-SortDialogWidth)/2, (LINES-SortDialogHeight)/2);
|
SortDialog->MoveTo((COLS-SortDialogWidth)/2, (MainHeight-SortDialogHeight)/2+MainStartY);
|
||||||
hasToBeResized = 0;
|
hasToBeResized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1250,12 +1250,18 @@ string TagEditor::ParseFilename(Song &s, string mask, bool preview)
|
|||||||
|
|
||||||
void TagEditor::DealWithFilenames(SongList &v)
|
void TagEditor::DealWithFilenames(SongList &v)
|
||||||
{
|
{
|
||||||
int width = 30;
|
size_t width = 30;
|
||||||
int height = 6;
|
size_t height = 6;
|
||||||
|
|
||||||
|
if (size_t(COLS) < width || MainHeight < height)
|
||||||
|
{
|
||||||
|
ShowMessage("Screen is too small to display additional windows!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GetPatternList();
|
GetPatternList();
|
||||||
|
|
||||||
Menu<string> *Main = new Menu<string>((COLS-width)/2, (LINES-height)/2, width, height, "", Config.main_color, Config.window_border);
|
Menu<string> *Main = new Menu<string>((COLS-width)/2, (MainHeight-height)/2+MainStartY, width, height, "", Config.main_color, Config.window_border);
|
||||||
Main->SetTimeout(ncmpcpp_window_timeout);
|
Main->SetTimeout(ncmpcpp_window_timeout);
|
||||||
Main->CyclicScrolling(Config.use_cyclic_scrolling);
|
Main->CyclicScrolling(Config.use_cyclic_scrolling);
|
||||||
Main->SetItemDisplayer(Display::Generic);
|
Main->SetItemDisplayer(Display::Generic);
|
||||||
@@ -1278,7 +1284,7 @@ void TagEditor::DealWithFilenames(SongList &v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
width = COLS*0.9;
|
width = COLS*0.9;
|
||||||
height = LINES*0.8;
|
height = std::min(size_t(LINES*0.8), MainHeight);
|
||||||
bool exit = 0;
|
bool exit = 0;
|
||||||
bool preview = 1;
|
bool preview = 1;
|
||||||
size_t choice = Main->Choice();
|
size_t choice = Main->Choice();
|
||||||
@@ -1295,7 +1301,7 @@ void TagEditor::DealWithFilenames(SongList &v)
|
|||||||
|
|
||||||
if (choice != 3)
|
if (choice != 3)
|
||||||
{
|
{
|
||||||
Legend = new Scrollpad((COLS-width)/2+one_width, (LINES-height)/2, two_width, height, "Legend", Config.main_color, Config.window_border);
|
Legend = new Scrollpad((COLS-width)/2+one_width, (MainHeight-height)/2+MainStartY, two_width, height, "Legend", Config.main_color, Config.window_border);
|
||||||
Legend->SetTimeout(ncmpcpp_window_timeout);
|
Legend->SetTimeout(ncmpcpp_window_timeout);
|
||||||
*Legend << "%a - artist\n";
|
*Legend << "%a - artist\n";
|
||||||
*Legend << "%t - title\n";
|
*Legend << "%t - title\n";
|
||||||
@@ -1316,7 +1322,7 @@ void TagEditor::DealWithFilenames(SongList &v)
|
|||||||
Preview->SetTitle("Preview");
|
Preview->SetTitle("Preview");
|
||||||
Preview->SetTimeout(ncmpcpp_window_timeout);
|
Preview->SetTimeout(ncmpcpp_window_timeout);
|
||||||
|
|
||||||
Main = new Menu<string>((COLS-width)/2, (LINES-height)/2, one_width, height, "", Config.main_color, Config.active_window_border);
|
Main = new Menu<string>((COLS-width)/2, (MainHeight-height)/2+MainStartY, one_width, height, "", Config.main_color, Config.active_window_border);
|
||||||
Main->SetTimeout(ncmpcpp_window_timeout);
|
Main->SetTimeout(ncmpcpp_window_timeout);
|
||||||
Main->CyclicScrolling(Config.use_cyclic_scrolling);
|
Main->CyclicScrolling(Config.use_cyclic_scrolling);
|
||||||
Main->SetItemDisplayer(Display::Generic);
|
Main->SetItemDisplayer(Display::Generic);
|
||||||
|
|||||||
Reference in New Issue
Block a user