Skip to content

Commit

Permalink
Improve color customization. Fix scroll bug.
Browse files Browse the repository at this point in the history
Increments-patch-version-of: ttyr-terminal
Increments-minor-version-of: ttyr-tty
  • Loading branch information
dajofrey committed Jan 21, 2024
1 parent 6769bd6 commit 6d9e6e1
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 250 deletions.
1 change: 0 additions & 1 deletion build/automation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ SRC_FILES_TTYR_TTY = \
Common/About.c \
Common/Log.c \
Common/Config.c \
Common/IndexMap.c \
Common/Initialize.c \
Common/Terminate.c \

Expand Down
4 changes: 2 additions & 2 deletions build/data/misc/ttyr-terminal.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ttyr.terminal.font.size:20;
ttyr.terminal.blink.frequency:0.5;
ttyr.terminal.color.foreground:230,230,230,255;
ttyr.terminal.color.background:0,0,0,255;
ttyr.terminal.color.foreground:233,233,233,255;
ttyr.terminal.color.background:18,18,18,255;
ttyr.terminal.color.accent:179,179,179,255;
ttyr.terminal.border:2;
7 changes: 4 additions & 3 deletions build/data/misc/ttyr-tty.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ttyr.tty.shell.maxScroll:10000;
ttyr.tty.windows:9;
ttyr.tty.windows:6;
ttyr.tty.tabs:3;
ttyr.tty.menu.program:1;
ttyr.tty.menu.split:1;
Expand All @@ -8,5 +8,6 @@ ttyr.tty.menu.window:0;
ttyr.tty.menu.tab:0;
ttyr.tty.menu.close:1;
ttyr.tty.menu.debug:0;
ttyr.tty.titlebar.on:0;
ttyr.tty.titlebar.color:0,0,0,255;
ttyr.tty.titlebar.on:1;
ttyr.tty.titlebar.background:18,18,18,255;
ttyr.tty.titlebar.foreground:179,179,179,255;
20 changes: 10 additions & 10 deletions src/lib/ttyr-terminal/Common/Data/ttyr-terminal.conf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ unsigned char ttyr_terminal_conf_inc[] = {
0x35, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x65, 0x72, 0x6d,
0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x66,
0x6f, 0x72, 0x65, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x3a, 0x32, 0x33,
0x30, 0x2c, 0x32, 0x33, 0x30, 0x2c, 0x32, 0x33, 0x30, 0x2c, 0x32, 0x35,
0x33, 0x2c, 0x32, 0x33, 0x33, 0x2c, 0x32, 0x33, 0x33, 0x2c, 0x32, 0x35,
0x35, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x65, 0x72, 0x6d,
0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x62,
0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x3a, 0x30, 0x2c,
0x30, 0x2c, 0x30, 0x2c, 0x32, 0x35, 0x35, 0x3b, 0x0a, 0x74, 0x74, 0x79,
0x72, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x63,
0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x6e, 0x74, 0x3a,
0x31, 0x37, 0x39, 0x2c, 0x31, 0x37, 0x39, 0x2c, 0x31, 0x37, 0x39, 0x2c,
0x32, 0x35, 0x35, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x65,
0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x62, 0x6f, 0x72, 0x64, 0x65,
0x72, 0x3a, 0x32, 0x3b, 0x0a
0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x3a, 0x31, 0x38,
0x2c, 0x31, 0x38, 0x2c, 0x31, 0x38, 0x2c, 0x32, 0x35, 0x35, 0x3b, 0x0a,
0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61,
0x6c, 0x2e, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2e, 0x61, 0x63, 0x63, 0x65,
0x6e, 0x74, 0x3a, 0x31, 0x37, 0x39, 0x2c, 0x31, 0x37, 0x39, 0x2c, 0x31,
0x37, 0x39, 0x2c, 0x32, 0x35, 0x35, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72,
0x2e, 0x74, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x6c, 0x2e, 0x62, 0x6f,
0x72, 0x64, 0x65, 0x72, 0x3a, 0x32, 0x3b, 0x0a
};
unsigned int ttyr_terminal_conf_inc_len = 221;
unsigned int ttyr_terminal_conf_inc_len = 224;
36 changes: 20 additions & 16 deletions src/lib/ttyr-tty/Common/Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// INCLUDES ========================================================================================

#include "Config.h"
#include "IndexMap.h"
#include "Macros.h"

#include "../TTY/TTY.h"
Expand All @@ -23,7 +22,7 @@

// NAMES ===========================================================================================

const NH_BYTE *TTYR_TTY_SETTING_NAMES_PP[] = {
static const NH_BYTE *TTYR_TTY_SETTING_NAMES_PP[] = {
"ttyr.tty.shell.maxScroll",
"ttyr.tty.windows",
"ttyr.tty.tabs",
Expand All @@ -35,14 +34,15 @@ const NH_BYTE *TTYR_TTY_SETTING_NAMES_PP[] = {
"ttyr.tty.menu.close",
"ttyr.tty.menu.debug",
"ttyr.tty.titlebar.on",
"ttyr.tty.titlebar.color",
"ttyr.tty.titlebar.foreground",
"ttyr.tty.titlebar.background",
};

size_t TTYR_TTY_SETTING_NAMES_PP_COUNT =
static size_t TTYR_TTY_SETTING_NAMES_PP_COUNT =
sizeof(TTYR_TTY_SETTING_NAMES_PP) / sizeof(TTYR_TTY_SETTING_NAMES_PP[0]);

const NH_BYTE *ttyr_tty_getSettingName(
TTYR_TTY_SETTING_E setting)
unsigned int setting)
{
TTYR_TTY_BEGIN()
TTYR_TTY_END(TTYR_TTY_SETTING_NAMES_PP[setting])
Expand All @@ -51,17 +51,14 @@ TTYR_TTY_END(TTYR_TTY_SETTING_NAMES_PP[setting])
// FUNCTIONS =======================================================================================

static TTYR_TTY_RESULT ttyr_tty_getSetting(
ttyr_tty_Config *Config_p, NH_BYTE *namespace_p, NH_BYTE *setting_p)
ttyr_tty_Config *Config_p, NH_BYTE *namespace_p, int index)
{
TTYR_TTY_BEGIN()

unsigned int *index_p = nh_core_getFromHashMap(&TTYR_TTY_INDEXMAP.SettingNames, setting_p);
if (index_p == NULL) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)}

nh_List *Values_p = nh_core_getGlobalConfigSetting(namespace_p, -1, setting_p);
nh_List *Values_p = nh_core_getGlobalConfigSetting(namespace_p, -1, TTYR_TTY_SETTING_NAMES_PP[index]);
TTYR_TTY_CHECK_NULL(Values_p)

switch (*index_p) {
switch (index) {
case 0 :
if (Values_p->size != 1) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)}
Config_p->Shell.maxScroll = atoi(Values_p->pp[0]);
Expand Down Expand Up @@ -108,10 +105,17 @@ TTYR_TTY_BEGIN()
break;
case 11 :
if (Values_p->size != 4) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)}
Config_p->Titlebar.Color.r = ((float)atoi(Values_p->pp[0]))/255.0f;
Config_p->Titlebar.Color.g = ((float)atoi(Values_p->pp[1]))/255.0f;
Config_p->Titlebar.Color.b = ((float)atoi(Values_p->pp[2]))/255.0f;
Config_p->Titlebar.Color.a = ((float)atoi(Values_p->pp[3]))/255.0f;
Config_p->Titlebar.Foreground.r = ((float)atoi(Values_p->pp[0]))/255.0f;
Config_p->Titlebar.Foreground.g = ((float)atoi(Values_p->pp[1]))/255.0f;
Config_p->Titlebar.Foreground.b = ((float)atoi(Values_p->pp[2]))/255.0f;
Config_p->Titlebar.Foreground.a = ((float)atoi(Values_p->pp[3]))/255.0f;
break;
case 12 :
if (Values_p->size != 4) {TTYR_TTY_END(TTYR_TTY_ERROR_BAD_STATE)}
Config_p->Titlebar.Background.r = ((float)atoi(Values_p->pp[0]))/255.0f;
Config_p->Titlebar.Background.g = ((float)atoi(Values_p->pp[1]))/255.0f;
Config_p->Titlebar.Background.b = ((float)atoi(Values_p->pp[2]))/255.0f;
Config_p->Titlebar.Background.a = ((float)atoi(Values_p->pp[3]))/255.0f;
break;
}

Expand All @@ -129,7 +133,7 @@ TTYR_TTY_BEGIN()
TTYR_TTY_CHECK_NULL_2(Config, TTY_p)

for (int i = 0; i < TTYR_TTY_SETTING_NAMES_PP_COUNT; ++i) {
TTYR_TTY_CHECK_2(Config, ttyr_tty_getSetting(&Config, TTY_p->namespace_p, TTYR_TTY_SETTING_NAMES_PP[i]))
TTYR_TTY_CHECK_2(Config, ttyr_tty_getSetting(&Config, TTY_p->namespace_p, i))
}

TTYR_TTY_END(Config)
Expand Down
35 changes: 3 additions & 32 deletions src/lib/ttyr-tty/Common/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,6 @@

#endif

/** @addtogroup lib_nhtty_enums
* @{
*/

typedef enum TTYR_TTY_SETTING_E {
TTYR_TTY_SETTING_SHELL_MAX_SCROLL,
TTYR_TTY_SETTING_WINDOWS,
TTYR_TTY_SETTING_TABS,
TTYR_TTY_SETTING_MENU_PROGRAM,
TTYR_TTY_SETTING_MENU_SPLIT,
TTYR_TTY_SETTING_MENU_APPEND,
TTYR_TTY_SETTING_MENU_WINDOW,
TTYR_TTY_SETTING_MENU_TAB,
TTYR_TTY_SETTING_MENU_CLOSE,
TTYR_TTY_SETTING_MENU_DEBUG,
TTYR_TTY_SETTING_TITLEBAR_ON,
TTYR_TTY_SETTING_TITLEBAR_COLOR,
} TTYR_TTY_SETTING_E;

/** @} */

/** @addtogroup lib_nhtty_structs
* @{
*/
Expand All @@ -52,7 +31,8 @@

typedef struct ttyr_tty_TitlebarConfig {
NH_BOOL on;
nh_Color Color;
nh_Color Foreground;
nh_Color Background;
} ttyr_tty_TitlebarConfig;

typedef struct ttyr_tty_ShellConfig {
Expand All @@ -70,15 +50,6 @@

/** @} */

/** @addtogroup lib_nhtty_vars
* @{
*/

extern const NH_BYTE *TTYR_TTY_SETTING_NAMES_PP[];
extern size_t TTYR_TTY_SETTING_NAMES_PP_COUNT;

/** @} */

/** @addtogroup lib_nhtty_functions
* @{
*/
Expand All @@ -87,7 +58,7 @@
);

const NH_BYTE *ttyr_tty_getSettingName(
TTYR_TTY_SETTING_E setting
unsigned int setting
);

/** @} */
Expand Down
16 changes: 10 additions & 6 deletions src/lib/ttyr-tty/Common/Data/ttyr-tty.conf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ unsigned char ttyr_tty_conf_inc[] = {
0x6c, 0x6c, 0x2e, 0x6d, 0x61, 0x78, 0x53, 0x63, 0x72, 0x6f, 0x6c, 0x6c,
0x3a, 0x31, 0x30, 0x30, 0x30, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72,
0x2e, 0x74, 0x74, 0x79, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x73,
0x3a, 0x39, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79,
0x3a, 0x36, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79,
0x2e, 0x74, 0x61, 0x62, 0x73, 0x3a, 0x33, 0x3b, 0x0a, 0x74, 0x74, 0x79,
0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x70,
0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x3a, 0x31, 0x3b, 0x0a, 0x74, 0x74,
Expand All @@ -20,9 +20,13 @@ unsigned char ttyr_tty_conf_inc[] = {
0x79, 0x2e, 0x6d, 0x65, 0x6e, 0x75, 0x2e, 0x64, 0x65, 0x62, 0x75, 0x67,
0x3a, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79,
0x2e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x62, 0x61, 0x72, 0x2e, 0x6f, 0x6e,
0x3a, 0x30, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79,
0x2e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x62, 0x61, 0x72, 0x2e, 0x63, 0x6f,
0x6c, 0x6f, 0x72, 0x3a, 0x30, 0x2c, 0x30, 0x2c, 0x30, 0x2c, 0x32, 0x35,
0x35, 0x3b, 0x0a
0x3a, 0x31, 0x3b, 0x0a, 0x74, 0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79,
0x2e, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x62, 0x61, 0x72, 0x2e, 0x62, 0x61,
0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x3a, 0x31, 0x38, 0x2c,
0x31, 0x38, 0x2c, 0x31, 0x38, 0x2c, 0x32, 0x35, 0x35, 0x3b, 0x0a, 0x74,
0x74, 0x79, 0x72, 0x2e, 0x74, 0x74, 0x79, 0x2e, 0x74, 0x69, 0x74, 0x6c,
0x65, 0x62, 0x61, 0x72, 0x2e, 0x66, 0x6f, 0x72, 0x65, 0x67, 0x72, 0x6f,
0x75, 0x6e, 0x64, 0x3a, 0x31, 0x37, 0x39, 0x2c, 0x31, 0x37, 0x39, 0x2c,
0x31, 0x37, 0x39, 0x2c, 0x32, 0x35, 0x35, 0x3b, 0x0a
};
unsigned int ttyr_tty_conf_inc_len = 291;
unsigned int ttyr_tty_conf_inc_len = 345;
112 changes: 0 additions & 112 deletions src/lib/ttyr-tty/Common/IndexMap.c

This file was deleted.

47 changes: 0 additions & 47 deletions src/lib/ttyr-tty/Common/IndexMap.h

This file was deleted.

Loading

0 comments on commit 6d9e6e1

Please sign in to comment.