Skip to content

Commit 0c8b7bd

Browse files
author
Chris Warren-Smith
committed
UI: refactoring to allow alternative keypad layouts
1 parent 6e87d5c commit 0c8b7bd

File tree

10 files changed

+975
-704
lines changed

10 files changed

+975
-704
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function(checkDebugMode)
4141
set(SANITIZER_FLAGS "-fstack-protector-all -fno-omit-frame-pointer -fsanitize=address,undefined")
4242
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
4343
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
44+
set(_DEBUG)
4445
message(STATUS "Debug mode enabled via --with-debug")
4546
endif()
4647
endfunction()

ide/config.h.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This file is part of SmallBASIC
22
//
3-
// SmallBASIC module header
3+
// SmallBASIC module header used with CMake
44
//
55
// This program is distributed under the terms of the GPL v2.0 or later
66
// Download the GNU Public License (GPL) from www.gnu.org
@@ -18,7 +18,8 @@ extern "C" {
1818
#cmakedefine01 _UnixOS
1919
#cmakedefine01 IMPL_DEV_READ
2020
#cmakedefine01 IMPL_LOG_WRITE
21-
#cmakedefine _SDL_VERSION "@_SDL_VERSION@"
21+
#cmakedefine01 _DEBUG
22+
#cmakedefine _SDL_VERSION "@_SDL_VERSION@ "
2223
#cmakedefine VERSION "@VERSION@"
2324
#cmakedefine BUILD_DATE @BUILD_DATE@
2425
#cmakedefine SB_DWORD_VER @SB_DWORD_VER@

keypad/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ declare -a IMAGE_FILES=(\
1111
"arrow-enter"\
1212
"search"\
1313
"layers"\
14+
"arrow-left"\
15+
"arrow-right"\
1416
"arrow-down"\
1517
"arrow-download"\
1618
"arrow-up" \

src/platform/android/jni/editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void Runtime::editSource(strlib::String loadPath, bool restoreOnExit) {
156156
if (_keypad != nullptr) {
157157
_output->addInput(_keypad);
158158
} else {
159-
_keypad = new KeypadInput(false, false, charWidth, charHeight);
159+
_keypad = new KeypadInput(w, false, false, charWidth, charHeight);
160160
_output->addInput(_keypad);
161161
}
162162

src/platform/android/webui/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
"dependencies": {
77
"@emotion/react": "^11.14.0",
88
"@emotion/styled": "^11.14.1",
9-
"@mui/icons-material": "^7.2.0",
10-
"@mui/material": "^7.2.0",
11-
"@mui/x-data-grid": "^8.8.0",
12-
"react": "^18.3.1",
13-
"react-dom": "^18.3.1",
14-
"react-router-dom": "^6.27.0",
9+
"@mui/icons-material": "^7.3.1",
10+
"@mui/material": "^7.3.1",
11+
"@mui/x-data-grid": "^8.10.1",
12+
"react": "^19.1.1",
13+
"react-dom": "^19.1.1",
14+
"react-router-dom": "^7.8.1",
1515
"react-router-hash-link": "^2.4.3"
1616
},
1717
"devDependencies": {
18-
"@eslint/js": "^9.31.0",
19-
"@vitejs/plugin-react": "^4.6.0",
20-
"eslint": "^9.31.0",
18+
"@eslint/js": "^9.33.0",
19+
"@vitejs/plugin-react": "^5.0.0",
20+
"eslint": "^9.33.0",
2121
"eslint-config-react": "^1.1.7",
2222
"eslint-define-config": "^2.1.0",
2323
"eslint-plugin-import": "^2.32.0",
@@ -26,8 +26,8 @@
2626
"eslint-plugin-react-refresh": "^0.4.20",
2727
"eslint-plugin-unused-imports": "^4.1.4",
2828
"globals": "^16.3.0",
29-
"npm-check-updates": "^18.0.1",
30-
"vite": "^6.3.5",
29+
"npm-check-updates": "^18.0.2",
30+
"vite": "^7.1.2",
3131
"vite-plugin-eslint": "^1.8.1"
3232
},
3333
"scripts": {

src/platform/sdl/editor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ void Runtime::editSource(String loadPath, bool restoreOnExit) {
232232
if (_keypad != nullptr) {
233233
_output->addInput(_keypad);
234234
} else {
235-
_keypad = new KeypadInput(false, true, charWidth, charHeight);
235+
_keypad = new KeypadInput(w, false, true, charWidth, charHeight);
236236
_output->addInput(_keypad);
237237
}
238238

src/ui/keycode.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ enum KeyCode : char {
2222
K_LINE_DOWN= (char)-11,
2323
K_PAGE_DOWN= (char)-12,
2424
K_TAG = (char)-13,
25+
K_LEFT = (char)-14,
26+
K_RIGHT = (char)-15,
27+
K_UPPER = (char)-16,
2528
K_NULL = 0,
2629
K_BACKSPACE = 8,
2730
K_TAB = 9,
@@ -77,15 +80,3 @@ enum KeyCode : char {
7780
K_TILDE = 126, // ~
7881
K_DEL = 127 // DEL
7982
};
80-
81-
inline bool isPrintable(KeyCode key) {
82-
return key >= K_SPACE && key <= K_TILDE;
83-
}
84-
85-
inline bool isArrow(KeyCode key) {
86-
return key == K_LINE_UP || key == K_PAGE_UP || key == K_LINE_DOWN || key == K_PAGE_DOWN;
87-
}
88-
89-
inline bool isRightMargin(KeyCode key) {
90-
return key == K_ENTER || key == K_HELP || key == K_BACKSPACE;
91-
}

0 commit comments

Comments
 (0)