apps/graphics/pdcurs34: Extend configuration to select the font size.

This commit is contained in:
Gregory Nutt 2017-11-18 12:11:02 -06:00
parent eb065a756e
commit 7664889170
5 changed files with 208 additions and 27 deletions

View File

@ -3,31 +3,15 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
config GRAPHICS_PDCURSES
bool "pdcurses Text User Interface"
menuconfig GRAPHICS_PDCURSES
bool "pdcurses Text User Interface (TUI)"
default n
select NXFONTS
---help---
Enable support for the pdcurses Text User Interface (TUI) libray.
if GRAPHICS_PDCURSES
config PDCURSES_WIDE
bool "Wide character support"
default n
depends on EXPERIMENTAL
config PDCURSES_FORCE_UTF8
bool "Force UTF8 character set"
default n
depends on PDCURSES_WIDE
config PDCURSES_DEBUG
bool "Enable pdcurses debug ouput"
default n
config PDCURSES_PANEL_DEBUG
bool "Enable special debug output for panels"
default n
source "$APPSDIR/graphics/pdcurs34/pdcurses/Kconfig"
source "$APPSDIR/graphics/pdcurs34/nuttx/Kconfig"
endif # GRAPHICS_PDCURSES

View File

@ -0,0 +1,124 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
choice
prompt "TUI Font Selection"
default PDCURSES_FOUNT_6X9
config PDCURSES_FOUNT_4X6
bool "4x6"
select NXFONT_X11_MISC_FIXED_4X6
---help---
Enables font ID FONTID_X11_MISC_FIXED_4X6 == 21.
config PDCURSES_FOUNT_5X7
bool "5x7"
select NXFONT_X11_MISC_FIXED_5X7
---help---
Enables font ID FONTID_X11_MISC_FIXED_5X7 == 22.
config PDCURSES_FOUNT_5X8
bool "5x8"
select NXFONT_X11_MISC_FIXED_5X8
---help---
Enables font ID FONTID_X11_MISC_FIXED_5X8 == 23.
config PDCURSES_FOUNT_6X9
bool "6x9"
select NXFONT_X11_MISC_FIXED_6X9
---help---
Enables font ID FONTID_X11_MISC_FIXED_6X9 == 24.
config PDCURSES_FOUNT_6X10
bool "6x10"
select NXFONT_X11_MISC_FIXED_6X10
---help---
Enables font ID FONTID_X11_MISC_FIXED_6X10 == 25.
config PDCURSES_FOUNT_6X12
bool "6x12"
select NXFONT_X11_MISC_FIXED_6X12
---help---
Enables font ID FONTID_X11_MISC_FIXED_6X12 == 26.
config PDCURSES_FOUNT_6X13
bool "6x13"
select NXFONT_X11_MISC_FIXED_6X13
---help---
Enables font ID FONTID_X11_MISC_FIXED_6X13 == 27.
config PDCURSES_FOUNT_6X13B
bool "6x13 Bold"
select NXFONT_X11_MISC_FIXED_6X13B
---help---
Enables font ID FONTID_X11_MISC_FIXED_6X13B == 28.
config PDCURSES_FOUNT_7X13
bool "7x13"
select NXFONT_X11_MISC_FIXED_7X13
---help---
Enables font ID FONTID_X11_MISC_FIXED_7X13 == 30.
config PDCURSES_FOUNT_7X13B
bool "7x13 Bold"
select NXFONT_X11_MISC_FIXED_7X13B
---help---
Enables font ID FONTID_X11_MISC_FIXED_7X13B == 31.
config PDCURSES_FOUNT_7X14
bool "7x14"
select NXFONT_X11_MISC_FIXED_7X14
---help---
Enables font ID FONTID_X11_MISC_FIXED_7X14 == 33.
config PDCURSES_FOUNT_7X14B
bool "7x14 Bold"
select NXFONT_X11_MISC_FIXED_7X14B
---help---
Enables font ID FONTID_X11_MISC_FIXED_7X14B == 34.
config PDCURSES_FOUNT_8X13
bool "8x13"
select NXFONT_X11_MISC_FIXED_8X13
---help---
Enables font ID FONTID_X11_MISC_FIXED_8X13 == 35.
config PDCURSES_FOUNT_8X13B
bool "8x13 Bold"
select NXFONT_X11_MISC_FIXED_8X13B
---help---
Enables font ID FONTID_X11_MISC_FIXED_8X13B == 36.
config PDCURSES_FOUNT_9X15
bool "9x15"
select NXFONT_X11_MISC_FIXED_9X15
---help---
Enables font ID FONTID_X11_MISC_FIXED_9X15 == 38.
config PDCURSES_FOUNT_9X15B
bool "9x15 Bold"
select NXFONT_X11_MISC_FIXED_9x15B
---help---
Enables font ID FONTID_X11_MISC_FIXED_9X15B == 39.
config PDCURSES_FOUNT_9X18
bool "9x18"
select NXFONT_X11_MISC_FIXED_9X18
---help---
Enables font ID FONTID_X11_MISC_FIXED_9X18 == 40.
config PDCURSES_FOUNT_9X18B
bool "9x18 Bold"
select NXFONT_X11_MISC_FIXED_9X18B
---help---
Enables font ID FONTID_X11_MISC_FIXED_9X18B == 41.
config PDCURSES_FOUNT_10X20
bool "10x20"
select NXFONT_X11_MISC_FIXED_10X20
---help---
Enables font ID FONTID_X11_MISC_FIXED_10X20 == 42.
endchoice # TUI Font Selection

View File

@ -40,6 +40,54 @@
* Included Files
****************************************************************************/
#include "nuttx/config.h"
#include "nuttx/nx/nxfonts.h"
#include "curspriv.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#if defined(CONFIG_PDCURSES_FOUNT_4X6)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_4X6
#elif defined(CONFIG_PDCURSES_FOUNT_5X7)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_5X7
#elif defined(CONFIG_PDCURSES_FOUNT_5X8)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_5X8
#elif defined(CONFIG_PDCURSES_FOUNT_6X9)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_6X9
#elif defined(CONFIG_PDCURSES_FOUNT_6X10)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_6X10
#elif defined(CONFIG_PDCURSES_FOUNT_6X12)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_6X12
#elif defined(CONFIG_PDCURSES_FOUNT_6X13)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_6X13
#elif defined(CONFIG_PDCURSES_FOUNT_6X13B)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_6X13B
#elif defined(CONFIG_PDCURSES_FOUNT_7X13)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_7X13
#elif defined(CONFIG_PDCURSES_FOUNT_7X13B)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_7X13B
#elif defined(CONFIG_PDCURSES_FOUNT_7X14)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_7X14
#elif defined(CONFIG_PDCURSES_FOUNT_7X14B)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_7X14B
#elif defined(CONFIG_PDCURSES_FOUNT_8X13)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_8X13
#elif defined(CONFIG_PDCURSES_FOUNT_8X13B)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_8X13B
#elif defined(CONFIG_PDCURSES_FOUNT_9X15)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_9X15
#elif defined(CONFIG_PDCURSES_FOUNT_9X15B)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_9X15B
#elif defined(CONFIG_PDCURSES_FOUNT_9X18)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_9X18
#elif defined(CONFIG_PDCURSES_FOUNT_9X18B)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_9X18B
#elif defined(CONFIG_PDCURSES_FOUNT_10X20)
# define PDCURSES_FONTID ID FONTID_X11_MISC_FIXED_10X20
#else
# error No fixed width font selected
#endif
#endif /* __APPS_GRAPHICS_PDCURS34_NUTTX_PDCNUTTX_H */

View File

@ -0,0 +1,22 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
config PDCURSES_WIDE
bool "Wide character support"
default n
depends on EXPERIMENTAL
config PDCURSES_FORCE_UTF8
bool "Force UTF8 character set"
default n
depends on PDCURSES_WIDE
config PDCURSES_DEBUG
bool "Enable pdcurses debug ouput"
default n
config PDCURSES_PANEL_DEBUG
bool "Enable special debug output for panels"
default n

View File

@ -87,13 +87,13 @@
* color-pair consist of.
*
* assume_default_colors() and use_default_colors() emulate the
* ncurses extensions of the same names. assume_default_colors(f,
* ncurses extensions of the same names. assume_default_colors(f,
* b) is essentially the same as init_pair(0, f, b) (which isn't
* allowed); it redefines the default colors. use_default_colors()
* allowed); it redefines the default colors. use_default_colors()
* allows the use of -1 as a foreground or background color with
* init_pair(), and calls assume_default_colors(-1, -1); -1
* represents the foreground or background color that the terminal
* had at startup. If the environment variable PDC_ORIGINAL_COLORS
* had at startup. If the environment variable PDC_ORIGINAL_COLORS
* is set at the time start_color() is called, that's equivalent to
* calling use_default_colors().
*
@ -164,18 +164,21 @@ int start_color(void)
}
pdc_color_started = true;
PDC_set_blink(false); /* Also sets COLORS, to 8 or 16 */
#ifndef CONFIG_DISABLE_ENVIRON
/* If the environment variable PDC_ORIGINAL_COLORS is set at the time
* start_color() is called, that's equivalent to calling use_default_colors().
*/
if (!default_colors && SP->orig_attr && getenv("PDC_ORIGINAL_COLORS"))
{
default_colors = true;
}
#endif
PDC_init_atrtab();
memset(pair_set, 0, PDC_COLOR_PAIRS);
return OK;
}