unicode strings for indicators

This commit is contained in:
Gwenhael Le Moine 2023-09-24 22:29:45 +02:00
parent 123efa0762
commit 4c469e9457
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
2 changed files with 14 additions and 13 deletions

View file

@ -1,8 +1,8 @@
# Makefile to build x48ng without autotools # Makefile to build x48ng without autotools
VERSION_MAJOR = 0 VERSION_MAJOR = 0
VERSION_MINOR = 27 VERSION_MINOR = 28
PATCHLEVEL = 1 PATCHLEVEL = 0
MAKEFLAGS +=-j$(NUM_CORES) -l$(NUM_CORES) MAKEFLAGS +=-j$(NUM_CORES) -l$(NUM_CORES)
@ -23,8 +23,8 @@ CFLAGS += $(shell pkg-config --cflags SDL_gfx sdl12_compat)
LIBS += $(shell pkg-config --libs SDL_gfx sdl12_compat) LIBS += $(shell pkg-config --libs SDL_gfx sdl12_compat)
### Text UI ### Text UI
CFLAGS += $(shell pkg-config --cflags ncurses) CFLAGS += $(shell pkg-config --cflags ncursesw -DNCURSES_WIDECHAR=1)
LIBS += $(shell pkg-config --libs ncurses) LIBS += $(shell pkg-config --libs ncursesw)
### debugger ### debugger
CFLAGS += $(shell pkg-config --cflags readline) CFLAGS += $(shell pkg-config --cflags readline)

View file

@ -8,6 +8,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h> #include <unistd.h>
#include <locale.h>
#include <ncurses.h> #include <ncurses.h>
@ -37,7 +38,7 @@ typedef struct tui_ann_struct_t {
int bit; int bit;
int x; int x;
int y; int y;
char icon; wchar_t* icon;
} tui_ann_struct_t; } tui_ann_struct_t;
typedef struct tui_button_t { typedef struct tui_button_t {
@ -51,12 +52,12 @@ typedef struct tui_button_t {
/* variables */ /* variables */
/*************/ /*************/
static tui_ann_struct_t ann_tbl[] = { static tui_ann_struct_t ann_tbl[] = {
{ANN_LEFT, 16, 4, '<'}, /* '↰' */ {ANN_LEFT, 16, 4, L"\u21b0" }, /* ↰ */
{ ANN_RIGHT, 61, 4, '>'}, /* '↱ */ { ANN_RIGHT, 61, 4, L"\u21b1" }, /* ↱ */
{ ANN_ALPHA, 106, 4, 'a'}, /* 'α' */ { ANN_ALPHA, 106, 4, L"\u03b1" }, /* α */
{ ANN_BATTERY, 151, 4, 'B'}, /* '🪫' */ { ANN_BATTERY, 151, 4, L"\u1faab"}, /* 🪫 */
{ ANN_BUSY, 196, 4, '*'}, /* '⌛' */ { ANN_BUSY, 196, 4, L"\u231b" }, /* ⌛ */
{ ANN_IO, 241, 4, '^'}, /* '☃' */ { ANN_IO, 241, 4, L"\u21c4" }, /* ⇄ */
/* { 0 } */ /* { 0 } */
}; };
@ -635,13 +636,13 @@ void text_draw_annunc( void )
return; return;
last_annunc_state = val; last_annunc_state = val;
for ( int i = 0; i < 6; i++ ) for ( int i = 0; i < 6; i++ )
mvaddch( 0, 3 + ( i * 4 ), ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? ann_tbl[ i ].icon : ' ' ); mvaddwstr( 0, 4 + ( i * 4 ), ( ( ann_tbl[ i ].bit & val ) == ann_tbl[ i ].bit ) ? ann_tbl[ i ].icon : L" " );
} }
void init_text_ui( int argc, char** argv ) void init_text_ui( int argc, char** argv )
{ {
setlocale( LC_ALL, "" );
buttons = ( tui_button_t* )malloc( sizeof( buttons_gx ) ); buttons = ( tui_button_t* )malloc( sizeof( buttons_gx ) );
if ( opt_gx ) if ( opt_gx )