mirror of
https://github.com/palera1n/palera1n.git
synced 2026-10-21 09:47:01 +02:00
make tui bigger but within 80x24
This commit is contained in:
1 parent
c2a452d3b1
commit
5f5210b08d
5 files changed
+36
-12
No files matched your search
+2
-4
@@ -12,10 +12,8 @@
|
||||
#include <unistd.h>
|
||||
#include <newt.h>
|
||||
|
||||
#define MAIN_OPTIONS "Options"
|
||||
#define MAIN_START "Start"
|
||||
#define MAIN_EXIT "Exit"
|
||||
#define BACK_BUTTON "Back"
|
||||
#define WIDTH 76
|
||||
#define HEIGHT 19
|
||||
|
||||
#define MSG_COLOR 1
|
||||
#define ICON_COLOR 2
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ endif
|
||||
xxd-%.c: %
|
||||
xxd -iC $< > $@
|
||||
|
||||
%.o: %.c
|
||||
%.o: %.c $(wildcard ../include/*.h)
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
palera1n: $(OBJECTS)
|
||||
|
||||
@@ -22,6 +22,22 @@ int destroy_window() {
|
||||
|
||||
int init_window() {
|
||||
setlocale(LC_ALL, NULL);
|
||||
if (getenv("NEWT_COLORS") == NULL)
|
||||
putenv(
|
||||
"NEWT_COLORS=root=,black\n"
|
||||
"border=white,black\n"
|
||||
"title=white,black\n"
|
||||
"roottext=red,black\n"
|
||||
"window=red,black\n"
|
||||
"textbox=white,black\n"
|
||||
"button=black,green\n"
|
||||
"compactbutton=white,black\n"
|
||||
"listbox=white,black\n"
|
||||
"actlistbox=black,white\n"
|
||||
"actsellistbox=black,green\n"
|
||||
"checkbox=green,black\n"
|
||||
"actcheckbox=black,green\n");
|
||||
|
||||
newtInit();
|
||||
newtCls();
|
||||
newtDrawRootText(0, 0, "Package Configuration");
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
tui_screen_t tui_screen_main() {
|
||||
int ret = MAIN_SCREEN;
|
||||
bool can_start = false;
|
||||
newtCenteredWindow(60, 16, "palera1n version 2.0.0");
|
||||
newtComponent optionsButton = newtCompactButton(30, 14, "Options");
|
||||
newtComponent startButton = newtCompactButton(41, 14, "Start");
|
||||
newtComponent exitButton = newtCompactButton(50, 14, "Exit");
|
||||
newtCenteredWindow(WIDTH, HEIGHT, "palera1n version 2.0.0");
|
||||
newtComponent optionsButton = newtCompactButton(46, 17, "Options");
|
||||
newtComponent startButton = newtCompactButton(57, 17, "Start");
|
||||
newtComponent exitButton = newtCompactButton(66, 17, "Exit");
|
||||
newtComponent welcome = newtLabel(1, 0, "Welcome to palera1n!");
|
||||
newtComponent form = newtForm(NULL, NULL, 0);
|
||||
newtFormAddComponents(form, optionsButton, startButton, exitButton, welcome, NULL);
|
||||
@@ -35,5 +35,6 @@ tui_screen_t tui_screen_main() {
|
||||
} else if (buttonPressed == exitButton) {
|
||||
ret = EXIT_SCREEN;
|
||||
}
|
||||
newtFormDestroy(form);
|
||||
return ret;
|
||||
}
|
||||
@@ -26,11 +26,12 @@ tui_screen_t tui_screen_options() {
|
||||
tui_bit_info_t setup_rootful_info = { &palerain_flags, palerain_option_setup_rootful };
|
||||
tui_bit_info_t force_revert_info = { &checkrain_flags, checkrain_option_force_revert };
|
||||
tui_bit_info_t safemode_info = { &checkrain_flags, checkrain_option_safemode };
|
||||
const char* bootargs_entered = NULL;
|
||||
|
||||
int ret = MAIN_SCREEN;
|
||||
|
||||
newtCenteredWindow(60, 16, "palera1n version 2.0.0");
|
||||
newtComponent backButton = newtCompactButton(50, 14, "Back");
|
||||
newtCenteredWindow(WIDTH, HEIGHT, "palera1n version 2.0.0");
|
||||
newtComponent backButton = newtCompactButton(66, 17, "Back");
|
||||
|
||||
newtComponent verboseBootBox = newtCheckbox(1, 1, "Verbose boot", CHECKBOX_STATE(kpf_flags, checkrain_option_verbose_boot), NULL, NULL);
|
||||
newtComponent rootfulBox = newtCheckbox(1, 2, "Rootful", CHECKBOX_STATE(palerain_flags, palerain_option_rootful), NULL, NULL);
|
||||
@@ -38,6 +39,11 @@ tui_screen_t tui_screen_options() {
|
||||
newtComponent forceRevertBox = newtCheckbox(1, 4, "Restore system", CHECKBOX_STATE(checkrain_flags, checkrain_option_force_revert), NULL, NULL);
|
||||
newtComponent safeModeBox = newtCheckbox(1, 5, "Safe mode", CHECKBOX_STATE(checkrain_flags, checkrain_option_safemode), NULL, NULL);
|
||||
|
||||
newtComponent bootCmdlineLabel = newtLabel(1, 6, "Kernel command line:");
|
||||
newtComponent bootCmdlineEntry = newtEntry(1, 7, NULL, WIDTH - 2, &bootargs_entered, NEWT_ENTRY_SCROLL);
|
||||
|
||||
newtComponent flowerChainBox /* dark blockchain */ = newtCheckbox(1, 8, "Flower chain", ' ', NULL, NULL);
|
||||
|
||||
newtComponentAddCallback(verboseBootBox, bitfield_check_cb, &verbose_info);
|
||||
newtComponentAddCallback(rootfulBox, bitfield_check_cb, &rootful_info);
|
||||
newtComponentAddCallback(rootfulSetupBox, bitfield_check_cb, &setup_rootful_info);
|
||||
@@ -46,12 +52,15 @@ tui_screen_t tui_screen_options() {
|
||||
|
||||
newtComponent form = newtForm(NULL, NULL, 0);
|
||||
newtFormAddComponents(form, backButton, verboseBootBox, rootfulBox,
|
||||
rootfulSetupBox, forceRevertBox, safeModeBox, NULL);
|
||||
rootfulSetupBox, forceRevertBox, safeModeBox, bootCmdlineLabel,
|
||||
bootCmdlineEntry, flowerChainBox, NULL);
|
||||
newtRunForm(form);
|
||||
newtRefresh();
|
||||
snprintf(xargs_cmd, 0x270, "xargs %s", bootargs_entered);
|
||||
newtComponent buttonPressed = newtFormGetCurrent(form);
|
||||
if (buttonPressed == backButton) {
|
||||
ret = MAIN_SCREEN;
|
||||
} else assert(0);
|
||||
newtFormDestroy(form);
|
||||
return ret;
|
||||
}
|
||||
Reference in new issue
Block a user