diff --git a/include/screens/scriptBrowse.hpp b/include/screens/scriptBrowse.hpp index 79f816f..aba3270 100644 --- a/include/screens/scriptBrowse.hpp +++ b/include/screens/scriptBrowse.hpp @@ -40,9 +40,10 @@ public: ScriptBrowse(); private: - nlohmann::json currentFile; + int listMode = 0; std::vector dirContents; mutable int screenPos = 0; + mutable int screenPosList = 0; mutable int selection = 0; int keyRepeatDelay = 0; int fastMode = false; diff --git a/source/screens/scriptBrowse.cpp b/source/screens/scriptBrowse.cpp index c44faf7..af41fe4 100644 --- a/source/screens/scriptBrowse.cpp +++ b/source/screens/scriptBrowse.cpp @@ -35,6 +35,7 @@ #include #define ENTRIES_PER_SCREEN 3 +#define ENTRIES_PER_LIST 7 nlohmann::json infoJson; @@ -127,21 +128,39 @@ void ScriptBrowse::Draw(void) const { Gui::DrawStringCentered(0, 215, 0.7f, Config::TxtColor, Lang::get("FUTURE_SCRIPT"), 400); } Gui::DrawBottom(); - for(int i=0;i screenPos + ENTRIES_PER_SCREEN - 1) { - screenPos = selection - ENTRIES_PER_SCREEN + 1; + if (hDown & KEY_X) { + if (listMode == 0) { + listMode = 1; + } else { + listMode = 0; + } + } + + if (listMode == 0) { + if(selection < screenPos) { + screenPos = selection; + } else if (selection > screenPos + ENTRIES_PER_SCREEN - 1) { + screenPos = selection - ENTRIES_PER_SCREEN + 1; + } + } else if (listMode == 1) { + if(selection < screenPosList) { + screenPosList = selection; + } else if (selection > screenPosList + ENTRIES_PER_LIST - 1) { + screenPosList = selection - ENTRIES_PER_LIST + 1; + } } } \ No newline at end of file