make defining screens with main window type as non-pointer possible

This commit is contained in:
Andrzej Rybczak
2012-09-14 15:40:31 +02:00
parent 9e93f7baf9
commit 4d6ea660bc
34 changed files with 358 additions and 203 deletions

View File

@@ -96,18 +96,18 @@ std::string keyToString(const Key &key, bool *print_backspace)
}
Help::Help()
: Screen(NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone))
{
w = new NC::Scrollpad(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::brNone);
GetKeybindings();
w->flush();
w.flush();
}
void Help::resize()
{
size_t x_offset, width;
getWindowResizeParams(x_offset, width);
w->resize(width, MainHeight);
w->moveTo(x_offset, MainStartY);
w.resize(width, MainHeight);
w.moveTo(x_offset, MainStartY);
hasToBeResized = 0;
}
@@ -154,25 +154,25 @@ std::string Help::DisplayKeys(const ActionType at)
void Help::Section(const char *type, const char *title_)
{
*w << L"\n " << NC::fmtBold << ToWString(type) << L" - ";
*w << ToWString(title_) << NC::fmtBoldEnd << L"\n\n";
w << L"\n " << NC::fmtBold << ToWString(type) << L" - ";
w << ToWString(title_) << NC::fmtBoldEnd << L"\n\n";
}
void Help::KeyDesc(const ActionType at, const char *desc)
{
*w << L" " << DisplayKeys(at) << L" : " << ToWString(desc) << '\n';
w << L" " << DisplayKeys(at) << L" : " << ToWString(desc) << '\n';
}
void Help::MouseDesc(std::string action, const char *desc, bool indent)
{
action.resize(31 - (indent ? 2 : 0), ' ');
*w << L" " << (indent ? L" " : L"") << ToWString(action);
*w << L": " << ToWString(desc) << '\n';
w << L" " << (indent ? L" " : L"") << ToWString(action);
w << L": " << ToWString(desc) << '\n';
}
void Help::MouseColumn(const char *column)
{
*w << NC::fmtBold << L" " << ToWString(column) << L" column:\n" << NC::fmtBoldEnd;
w << NC::fmtBold << L" " << ToWString(column) << L" column:\n" << NC::fmtBoldEnd;
}
void Help::GetKeybindings()
@@ -188,7 +188,7 @@ void Help::GetKeybindings()
KeyDesc(aPageDown, "Page down");
KeyDesc(aMoveHome, "Home");
KeyDesc(aMoveEnd, "End");
*w << '\n';
w << '\n';
if (Config.screen_switcher_previous)
{
KeyDesc(aNextScreen, "Switch between current and last screen");
@@ -217,7 +217,7 @@ void Help::GetKeybindings()
# ifdef ENABLE_CLOCK
KeyDesc(aShowClock, "Show clock");
# endif // ENABLE_CLOCK
*w << '\n';
w << '\n';
KeyDesc(aShowServerInfo, "Show server info");
KeysSection("Global");
@@ -230,7 +230,7 @@ void Help::GetKeybindings()
KeyDesc(aSeekBackward, "Seek backward in playing song");
KeyDesc(aVolumeDown, "Decrease volume by 2%");
KeyDesc(aVolumeUp, "Increase volume by 2%");
*w << '\n';
w << '\n';
KeyDesc(aToggleSpaceMode, "Toggle space mode (select/add)");
KeyDesc(aToggleAddMode, "Toggle add mode (add or remove/always add)");
KeyDesc(aToggleMouse, "Toggle mouse support");
@@ -239,7 +239,7 @@ void Help::GetKeybindings()
KeyDesc(aSelectAlbum, "Select songs of album around the cursor");
KeyDesc(aAddSelectedItems, "Add selected items to playlist");
KeyDesc(aAddRandomItems, "Add random items to playlist");
*w << '\n';
w << '\n';
KeyDesc(aToggleRepeat, "Toggle repeat mode");
KeyDesc(aToggleRandom, "Toggle random mode");
KeyDesc(aToggleSingle, "Toggle single mode");
@@ -250,7 +250,7 @@ void Help::GetKeybindings()
KeyDesc(aToggleCrossfade, "Toggle crossfade mode");
KeyDesc(aSetCrossfade, "Set crossfade");
KeyDesc(aUpdateDatabase, "Start music database update");
*w << '\n';
w << '\n';
KeyDesc(aApplyFilter, "Apply filter");
KeyDesc(aFindItemForward, "Find item forward");
KeyDesc(aFindItemBackward, "Find item backward");
@@ -276,7 +276,7 @@ void Help::GetKeybindings()
KeyDesc(aToggleFetchingLyricsInBackground, "Toggle fetching lyrics for playing songs in background");
# endif // HAVE_CURL_CURL_H
KeyDesc(aShowLyrics, "Show/hide song lyrics");
*w << '\n';
w << '\n';
KeyDesc(aQuit, "Quit");
KeysSection("Playlist");
@@ -386,7 +386,7 @@ void Help::GetKeybindings()
MouseSection("Global");
MouseDesc("Left click on \"Playing/Paused\"", "Play/pause");
MouseDesc("Left click on progressbar", "Jump to pointed position in playing song");
*w << '\n';
w << '\n';
MouseDesc("Mouse wheel on \"Volume: xx\"", "Play/pause");
MouseDesc("Mouse wheel on main window", "Scroll");
@@ -397,7 +397,7 @@ void Help::GetKeybindings()
MouseSection("Browser");
MouseDesc("Left click on directory", "Enter pointed directory");
MouseDesc("Right click on directory", "Add pointed directory to playlist");
*w << '\n';
w << '\n';
MouseDesc("Left click on song/playlist", "Add pointed item to playlist");
MouseDesc("Right click on song/playlist", "Add pointed item to playlist and play it");
@@ -409,7 +409,7 @@ void Help::GetKeybindings()
MouseColumn("Left/middle");
MouseDesc("Left click", "Select pointed item", true);
MouseDesc("Right click", "Add item to playlist", true);
*w << '\n';
w << '\n';
MouseColumn("Right");
MouseDesc("Left Click", "Add pointed item to playlist", true);
MouseDesc("Right Click", "Add pointed item to playlist and play it", true);
@@ -418,7 +418,7 @@ void Help::GetKeybindings()
MouseColumn("Left");
MouseDesc("Left click", "Select pointed item", true);
MouseDesc("Right click", "Add item to playlist", true);
*w << '\n';
w << '\n';
MouseColumn("Right");
MouseDesc("Left click", "Add pointed item to playlist", true);
MouseDesc("Right click", "Add pointed item to playlist and play it", true);
@@ -432,11 +432,11 @@ void Help::GetKeybindings()
MouseColumn("Left");
MouseDesc("Left click", "Enter pointed directory/select pointed album", true);
MouseDesc("Right click", "Toggle view (directories/albums)", true);
*w << '\n';
w << '\n';
MouseColumn("Middle");
MouseDesc("Left click", "Select option", true);
MouseDesc("Right click", "Set value/execute", true);
*w << '\n';
w << '\n';
MouseColumn("Right");
MouseDesc("Left click", "Select pointed item", true);
MouseDesc("Right click", "Set value", true);