Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2eae3ac
inital text viewer skelethon
frostmorn Oct 31, 2025
2975ada
noffs/doffs inital calculation in textviewer
frostmorn Nov 1, 2025
32686bd
first page rendered woooaH
frostmorn Nov 1, 2025
090e1dc
scrollDown/Up
frostmorn Nov 1, 2025
5ec1b99
added some security checks
frostmorn Nov 1, 2025
fa0fe9c
unify entry point loggage in DBG contexts
frostmorn Nov 2, 2025
8a9e674
apply canvas options before calculating doffs , cause width of string…
frostmorn Nov 2, 2025
2cc99c8
block based flineBack
frostmorn Nov 2, 2025
512d47f
lazy refresh, pageUp/Down inital
frostmorn Nov 2, 2025
4bd8f96
faster scrollUp/PageDown, buggy PageUp
frostmorn Nov 2, 2025
67b1b13
remove some debug checks
frostmorn Nov 2, 2025
ebbe6bb
Implemented text scale, spacing, changed default font
frostmorn Nov 2, 2025
008404c
reload on font/spacing changes
frostmorn Nov 2, 2025
29a889b
pageup sucksless, but still sucks. well, at least this one works
frostmorn Nov 3, 2025
988a122
count max lines to be displayed, and remove few security checks
frostmorn Nov 3, 2025
4378a28
add textfile icon to fmanager
frostmorn Nov 3, 2025
b3d8773
first try in satisfying checks
frostmorn Nov 3, 2025
0a042b7
and another one
frostmorn Nov 3, 2025
c6a29fe
Merge branch 'main' into txt_viewer
frostmorn Nov 8, 2025
7fbb731
fix issues with last lines, encoding detection, large lines patch, an…
frostmorn Nov 9, 2025
451c042
cppchecks
frostmorn Nov 9, 2025
0039f73
yeh yeh
frostmorn Nov 9, 2025
3c89362
some renaming and movage of repeatable stuff to abstract widget. impl…
frostmorn Nov 9, 2025
5204d86
satisfy cppcheck
frostmorn Nov 9, 2025
028c900
change maxLines calc logic
frostmorn Nov 11, 2025
c7b1f03
rename doffs -> dptrs, noffs-> nptrs, implement different seek scroll…
frostmorn Nov 12, 2025
5aca42c
code formatting
frostmorn Nov 12, 2025
33f9ed5
lazyFile readage in tBlockRefresh
frostmorn Nov 16, 2025
f7380b5
switch to By Page only scrolling
frostmorn Nov 20, 2025
477493a
toolbar inital
frostmorn Nov 21, 2025
853f76a
updates to txtviewer app skelethon
frostmorn Nov 21, 2025
89fc6df
inc/dec spacing txtView inital txtviewerapp
frostmorn Nov 21, 2025
8277602
progressbar, font size/spacing adjust, minor improvements to txtview
frostmorn Nov 26, 2025
b570e14
added force update option to a toolbar widget
frostmorn Nov 26, 2025
6b5dfd7
count displayed bytes, use them in progress
frostmorn Nov 26, 2025
ad606ad
use friendly sizes in progress bar
frostmorn Nov 26, 2025
41f31ce
restore default file caching cause it actually does something(funny),…
frostmorn Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 38 additions & 16 deletions src/apps/fmanager/fmanager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "fmanager.h"

#include "keira/keira_macro.h"
void FileManagerApp::alert(const String& title, const String& message) {
lilka::Alert alert(title, message);
alert.draw(canvas);
Expand Down Expand Up @@ -105,6 +105,14 @@ FileManagerApp::FileManagerApp(const String& path) :
FM_CALLBACK_CAST(onFileOpenWithMODPlayer),
FM_CALLBACK_PTHIS
);
fileOpenWithMenu.addItem(
K_S_FMANAGER_TXT_VIEWER,
0,
lilka::colors::White,
"",
FM_CALLBACK_CAST(onFileOpenWithTextViewer),
FM_CALLBACK_PTHIS
);
fileOpenWithMenu.addItem(
K_S_MENU_BACK, 0, lilka::colors::White, "", FM_CALLBACK_CAST(onAnyMenuBack), FM_CALLBACK_PTHIS
);
Expand Down Expand Up @@ -288,6 +296,10 @@ FMEntry FileManagerApp::pathToEntry(const String& path) {
newEntry.type = FT_LT;
newEntry.icon = FT_LT_ICON;
newEntry.color = FT_LT_COLOR;
} else if (lowerCasedPath.endsWith(".txt")) {
newEntry.type = FT_TXT;
newEntry.icon = FT_TXT_ICON;
newEntry.color = FT_TXT_COLOR;
} else {
newEntry.type = FT_OTHER;
newEntry.icon = FT_OTHER_ICON;
Expand Down Expand Up @@ -327,6 +339,9 @@ void FileManagerApp::openCurrentEntry() {
case FT_LT:
K_FT_LT_HANDLER(path);
break;
case FT_TXT:
K_FT_TXT_HANDLER(path);
break;
case FT_DIR:
FT_DEFAULT_DIR_HANDLER;
break;
Expand Down Expand Up @@ -412,52 +427,59 @@ void FileManagerApp::fileOpenWithMenuShow() {
}

void FileManagerApp::onFileOpenWithNESEmulator() {
FM_DBG lilka::serial.log("Enter onFileOpenWithNESEmulator");
FM_DBG LEP;
auto button = fileOpenWithMenu.getButton();
if (button == FM_EXIT_BUTTON) return; // Exit

K_FT_NES_HANDLER(lilka::fileutils.joinPath(currentEntry.path, currentEntry.name));
}

void FileManagerApp::onFileOpenWithMultiBootLoader() {
FM_DBG lilka::serial.log("Enter onFileOpenWithMultiBootLoader");
FM_DBG LEP;
auto button = fileOpenWithMenu.getButton();
if (button == FM_EXIT_BUTTON) return; // Exit

FM_DEFAULT_FT_BIN_HANDLER(lilka::fileutils.joinPath(currentEntry.path, currentEntry.name));
}

void FileManagerApp::onFileOpenWithLua() {
FM_DBG lilka::serial.log("Enter onFileOpenWithLua");
FM_DBG LEP;
auto button = fileOpenWithMenu.getButton();
if (button == FM_EXIT_BUTTON) return; // Exit

K_FT_LUA_SCRIPT_HANDLER(lilka::fileutils.joinPath(currentEntry.path, currentEntry.name));
}

void FileManagerApp::onFileOpenWithMJS() {
FM_DBG lilka::serial.log("Enter onFileOpenWithMJS");
FM_DBG LEP;
auto button = fileOpenWithMenu.getButton();
if (button == FM_EXIT_BUTTON) return; // Exit

K_FT_JS_SCRIPT_HANDLER(lilka::fileutils.joinPath(currentEntry.path, currentEntry.name));
}

void FileManagerApp::onFileOpenWithLilTracker() {
FM_DBG lilka::serial.log("Enter onFileOpenWithLilTracker");
FM_DBG LEP;
auto button = fileOpenWithMenu.getButton();
if (button == FM_EXIT_BUTTON) return; // Exit

K_FT_LT_HANDLER(lilka::fileutils.joinPath(currentEntry.path, currentEntry.name));
}

void FileManagerApp::onFileOpenWithMODPlayer() {
FM_DBG lilka::serial.log("Enter onFileOpenWithMODPlayer");
FM_DBG LEP;
auto button = fileOpenWithMenu.getButton();
if (button == FM_EXIT_BUTTON) return; // Exit

K_FT_MOD_HANDLER(lilka::fileutils.joinPath(currentEntry.path, currentEntry.name));
}
void FileManagerApp::onFileOpenWithTextViewer() {
FM_DBG LEP;
auto button = fileOpenWithMenu.getButton();
if (button == FM_EXIT_BUTTON) return; // Exit

K_FT_TXT_HANDLER(lilka::fileutils.joinPath(currentEntry.path, currentEntry.name));
}

// FILE SELECTION MENU BELOW:
void FileManagerApp::onFileSelectionOptionsMenuCopy() {
Expand Down Expand Up @@ -528,7 +550,7 @@ void FileManagerApp::onFileSelectionOptionsMenuClearSelection() {

// FILE OPTIONS MENU BELOW:
void FileManagerApp::fileOptionsMenuShow() {
FM_DBG lilka::serial.log("Enter fileOptionsMenuShow");
FM_DBG LEP;
fileOptionsMenu.setCursor(0);
while (!fileOptionsMenu.isFinished()) {
fileOptionsMenu.update();
Expand All @@ -539,7 +561,7 @@ void FileManagerApp::fileOptionsMenuShow() {

void FileManagerApp::onFileOptionsMenuOpen() {
auto button = fileOptionsMenu.getButton();
FM_DBG lilka::serial.log("Enter onFileOptionsMenuOpen");
FM_DBG LEP;
if (button == FM_OKAY_BUTTON) {
if (isCurrentDirSelected()) {
FM_UI_CANT_DO_OP;
Expand All @@ -551,8 +573,8 @@ void FileManagerApp::onFileOptionsMenuOpen() {
}

void FileManagerApp::onFileOptionsMenuOpenWith() {
FM_DBG LEP;
auto button = fileOptionsMenu.getButton();
FM_DBG lilka::serial.log("Enter onFileOptionsMenuOpenWith");
if (button == FM_OKAY_BUTTON) {
if (isCurrentDirSelected()) {
FM_UI_CANT_DO_OP;
Expand All @@ -565,8 +587,8 @@ void FileManagerApp::onFileOptionsMenuOpenWith() {
}

void FileManagerApp::onFileOptionsMenuMKDir() {
FM_DBG LEP;
auto button = fileOptionsMenu.getButton();
FM_DBG lilka::serial.log("Enter onFileOptionsMenuMKDir");
if (button == FM_OKAY_BUTTON) {
mkdirInput.setValue(FM_DEFAULT_NEW_FOLDER_NAME);
while (!mkdirInput.isFinished()) {
Expand Down Expand Up @@ -595,8 +617,8 @@ void FileManagerApp::onFileOptionsMenuMKDir() {
}

void FileManagerApp::onFileOptionsMenuDelete() {
FM_DBG LEP;
auto button = fileOptionsMenu.getButton();
FM_DBG lilka::serial.log("Enter onFileOptionsMenuDelete");
if (button == FM_OKAY_BUTTON) {
if (mode == FM_MODE_SELECT) {
lilka::Alert checkAlert(
Expand Down Expand Up @@ -630,8 +652,8 @@ void FileManagerApp::onFileOptionsMenuDelete() {
}

void FileManagerApp::onFileOptionsMenuRename() {
FM_DBG LEP;
auto button = fileOptionsMenu.getButton();
FM_DBG lilka::serial.log("Enter onFileOptionsMenuRename");
if (button == FM_OKAY_BUTTON) {
if (isCurrentDirSelected()) {
FM_UI_CANT_DO_OP;
Expand Down Expand Up @@ -673,8 +695,8 @@ void FileManagerApp::onFileOptionsMenuRename() {
}

void FileManagerApp::onFileOptionsMenuInfo() {
FM_DBG LEP;
auto button = fileOptionsMenu.getButton();
FM_DBG lilka::serial.log("Enter onFileOptionsMenuRename");
if (button == FM_OKAY_BUTTON) {
fileInfoShowAlert();
exitChildDialogs = true;
Expand Down Expand Up @@ -791,7 +813,7 @@ void FileManagerApp::fileLoadAsRom(const String& path) {
}

void FileManagerApp::onAnyMenuBack() {
FM_DBG lilka::serial.log("Enter onAnyMenuBack");
FM_DBG LEP;
}

void FileManagerApp::fileSelectionOptionsMenuShow() {
Expand Down Expand Up @@ -925,9 +947,9 @@ void FileManagerApp::fileListMenuShow() {
}

void FileManagerApp::onFileListMenuItem() {
FM_DBG LEP;
auto button = fileListMenu.getButton();
auto index = fileListMenu.getCursor();
FM_DBG lilka::serial.log("Enter onFileListMenuItem");

if (fileListMenu.getCursor() == currentDirEntries.size()) {
currentEntry = pathToEntry(lilka::fileutils.joinPath(currentPath, "."));
Expand Down
17 changes: 16 additions & 1 deletion src/apps/fmanager/fmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define FT_JS_SCRIPT_COLOR lilka::colors::Butterscotch
#define FT_MOD_COLOR lilka::colors::Plum_web
#define FT_LT_COLOR lilka::colors::Pink_lace
#define FT_TXT_COLOR lilka::colors::Cedar_chest
#define FT_DIR_COLOR lilka::colors::Arylide_yellow
#define FT_OTHER_COLOR lilka::colors::Light_gray
///////////////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -48,6 +49,7 @@
#define FT_JS_SCRIPT_ICON &js_img
#define FT_MOD_ICON &music_img
#define FT_LT_ICON &music_img
#define FT_TXT_ICON &textfile_img
#define FT_DIR_ICON &folder_img
#define FT_OTHER_ICON &normalfile_img
#define FM_SELECTED_FOLDER_ICON &selectedfolder_img
Expand Down Expand Up @@ -108,6 +110,7 @@
#include "../icons/music.h"
#include "../icons/selectedfile.h"
#include "../icons/selectedfolder.h"
#include "../icons/textfile.h"

// very bad test
// /sd/1 => /sd/1122/1
Expand All @@ -121,7 +124,18 @@
# define FM_DBG if (0)
#endif

typedef enum { FT_NONE, FT_NES_ROM, FT_BIN, FT_LUA_SCRIPT, FT_JS_SCRIPT, FT_MOD, FT_LT, FT_DIR, FT_OTHER } FileType;
typedef enum {
FT_NONE,
FT_NES_ROM,
FT_BIN,
FT_LUA_SCRIPT,
FT_JS_SCRIPT,
FT_MOD,
FT_LT,
FT_TXT,
FT_DIR,
FT_OTHER
} FileType;
typedef enum {
FM_MODE_VIEW, // Standard mode
FM_MODE_SELECT, // if selectedEntries contain something
Expand Down Expand Up @@ -293,6 +307,7 @@ class FileManagerApp : public App {
void onFileOpenWithMJS();
void onFileOpenWithLilTracker();
void onFileOpenWithMODPlayer();
void onFileOpenWithTextViewer();

// Callbacks [fileListMenu]:
void onFileListMenuItem();
Expand Down
Loading
Loading