Browse Source

Added type gJustify to replace V2.x justify_t, and values gJustifyXXX replace justifyXXX

remotes/origin_old/release/v2.9
inmarket 3 years ago
parent
commit
2e8eaa3471
  1. 1
      changelog.txt
  2. 2
      demos/3rdparty/notepad-2/notepadApp.c
  3. 10
      demos/applications/notepad/main.c
  4. 8
      demos/benchmarks/main.c
  5. 12
      demos/games/tetris/tetris.c
  6. 14
      demos/modules/gdisp/fonts/main.c
  7. 8
      demos/modules/gdisp/multiple_displays/main.c
  8. 8
      demos/modules/gtrans/basic/main.c
  9. 2
      demos/tools/touch_calibration_grabber/main.c
  10. 10
      demos/tools/touch_driver_test/main.c
  11. 2
      demos/tools/touch_raw_readings/main.c
  12. 2
      demos/tools/uGFXnetDisplay/main.c
  13. 40
      src/gdisp/gdisp.c
  14. 45
      src/gdisp/gdisp.h
  15. 2
      src/gdisp/gdisp_driver.h
  16. 4
      src/gdisp/gdisp_options.h
  17. 4
      src/ginput/ginput_mouse.c
  18. 4
      src/gwin/gwin.c
  19. 4
      src/gwin/gwin.h
  20. 20
      src/gwin/gwin_button.c
  21. 8
      src/gwin/gwin_checkbox.c
  22. 2
      src/gwin/gwin_frame.c
  23. 2
      src/gwin/gwin_keyboard.c
  24. 8
      src/gwin/gwin_label.c
  25. 2
      src/gwin/gwin_list.c
  26. 4
      src/gwin/gwin_progressbar.c
  27. 14
      src/gwin/gwin_radio.c
  28. 4
      src/gwin/gwin_slider.c
  29. 8
      src/gwin/gwin_tabset.c
  30. 2
      src/gwin/gwin_textedit.c

1
changelog.txt

@ -24,6 +24,7 @@ CHANGE: Added type gCoord to replace V2.x coord_t
CHANGE: Added type gPixel to replace V2.x pixel_t
CHANGE: Added type gColor to replace V2.x color_t
CHANGE: Added type gPowermode to replace V2.x powermode_t, and values gPowerXXX replace powerXXX
CHANGE: Added type gJustify to replace V2.x justify_t, and values gJustifyXXX replace justifyXXX
FIX: Added gfxRealloc() to Qt port
FIX: Fixed UC1610 driver private area initialisation
FIX: Fixed ST7735 driver and added kapacuk changes

2
demos/3rdparty/notepad-2/notepadApp.c

@ -351,7 +351,7 @@ static DECLARE_THREAD_FUNCTION(notepadThread, param) {
NPAD_TITLETEXT_STR,
font,
nCurColorScheme.titleTextColor,
justifyLeft);
gJustifyLeft);
/* Create the drawing window, draw its border */
gdispDrawBox(NPAD_DRAWING_AREA_START_X - 1,

10
demos/applications/notepad/main.c

@ -61,11 +61,11 @@ void drawScreen(void) {
gdispDrawBox (5 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, GFX_WHITE); /* White */
/* pens */
gdispFillStringBox(OFFSET * 2, DRAW_PEN(1), PEN_SIZE, PEN_SIZE, "1", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(2), PEN_SIZE, PEN_SIZE, "2", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(3), PEN_SIZE, PEN_SIZE, "3", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(4), PEN_SIZE, PEN_SIZE, "4", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(5), PEN_SIZE, PEN_SIZE, "5", font2, GFX_WHITE, GFX_BLACK, justifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(1), PEN_SIZE, PEN_SIZE, "1", font2, GFX_WHITE, GFX_BLACK, gJustifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(2), PEN_SIZE, PEN_SIZE, "2", font2, GFX_WHITE, GFX_BLACK, gJustifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(3), PEN_SIZE, PEN_SIZE, "3", font2, GFX_WHITE, GFX_BLACK, gJustifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(4), PEN_SIZE, PEN_SIZE, "4", font2, GFX_WHITE, GFX_BLACK, gJustifyCenter);
gdispFillStringBox(OFFSET * 2, DRAW_PEN(5), PEN_SIZE, PEN_SIZE, "5", font2, GFX_WHITE, GFX_BLACK, gJustifyCenter);
gdispCloseFont(font1);
gdispCloseFont(font2);

8
demos/benchmarks/main.c

@ -98,10 +98,10 @@ void benchmark(void) {
height = gdispGetHeight();
font = gdispOpenFont("UI2 Double");
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, gJustifyCenter);
font = gdispOpenFont("UI2");
gdispDrawStringBox(0, height/2, width, 30, "5000 random rectangles", font, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, height/2, width, 30, "5000 random rectangles", font, GFX_WHITE, gJustifyCenter);
gfxSleepMilliseconds(3000);
@ -131,8 +131,8 @@ void benchmark(void) {
font = gdispOpenFont("UI2 Double");
gdispClear(GFX_BLACK);
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, height/2, width, 30, pps_str, font, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, 0, width, 30, "ChibiOS/GFX - Benchmark", font, GFX_WHITE, gJustifyCenter);
gdispDrawStringBox(0, height/2, width, 30, pps_str, font, GFX_WHITE, gJustifyCenter);
//gdispDrawString(20, height/2, pps_str, font, GFX_WHITE);
}

12
demos/games/tetris/tetris.c

@ -262,12 +262,12 @@ static void printGameOver(void) {
}
static void printTouchAreas(void) {
gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetFontMetric(font16, fontHeight), "Touch Area's", font16, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetHeight()/4, "Pause", font16, GFX_GRAY, justifyCenter);
gdispDrawStringBox(0, gdispGetHeight()/4, gdispGetWidth(), gdispGetHeight()/2, "Rotate", font16, GFX_GRAY, justifyCenter);
gdispDrawStringBox(0, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Left", font16, GFX_GRAY, justifyCenter);
gdispDrawStringBox(gdispGetWidth()/4, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/2, gdispGetHeight()/4, "Down", font16, GFX_GRAY, justifyCenter);
gdispDrawStringBox(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Right", font16, GFX_GRAY, justifyCenter);
gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetFontMetric(font16, fontHeight), "Touch Area's", font16, GFX_WHITE, gJustifyCenter);
gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetHeight()/4, "Pause", font16, GFX_GRAY, gJustifyCenter);
gdispDrawStringBox(0, gdispGetHeight()/4, gdispGetWidth(), gdispGetHeight()/2, "Rotate", font16, GFX_GRAY, gJustifyCenter);
gdispDrawStringBox(0, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Left", font16, GFX_GRAY, gJustifyCenter);
gdispDrawStringBox(gdispGetWidth()/4, gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/2, gdispGetHeight()/4, "Down", font16, GFX_GRAY, gJustifyCenter);
gdispDrawStringBox(gdispGetWidth()-(gdispGetWidth()/4), gdispGetHeight()-(gdispGetHeight()/4), gdispGetWidth()/4, gdispGetHeight()/4, "Right", font16, GFX_GRAY, gJustifyCenter);
gdispDrawLine(0, gdispGetHeight()/4, gdispGetWidth()-1, gdispGetHeight()/4, GFX_GRAY);
gdispDrawLine(0, gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()-1, gdispGetHeight()-gdispGetHeight()/4, GFX_GRAY);
gdispDrawLine(gdispGetWidth()/4, gdispGetHeight()-gdispGetHeight()/4, gdispGetWidth()/4, gdispGetHeight()-1, GFX_GRAY);

14
demos/modules/gdisp/fonts/main.c

@ -60,21 +60,21 @@ int main(void) {
line2 = "0123456789~!@#$%^&*_-+=(){}[]<>|/\\:;,.?'\"`";
// Font 1
gdispFillStringBox(0, y, width, fheight1, line1, font1, GFX_BLACK, GFX_WHITE, justifyCenter);
gdispFillStringBox(0, y, width, fheight1, line1, font1, GFX_BLACK, GFX_WHITE, gJustifyCenter);
y += fheight1+1;
gdispFillStringBox(0, y, width, fheight1, line2, font1, GFX_BLACK, GFX_WHITE, justifyCenter);
gdispFillStringBox(0, y, width, fheight1, line2, font1, GFX_BLACK, GFX_WHITE, gJustifyCenter);
y += fheight1+1;
// Font 2
gdispFillStringBox(0, y, width, fheight2, line1, font2, GFX_BLACK, GFX_WHITE, justifyCenter);
gdispFillStringBox(0, y, width, fheight2, line1, font2, GFX_BLACK, GFX_WHITE, gJustifyCenter);
y += fheight2+1;
gdispFillStringBox(0, y, width, fheight2, line2, font2, GFX_BLACK, GFX_WHITE, justifyCenter);
gdispFillStringBox(0, y, width, fheight2, line2, font2, GFX_BLACK, GFX_WHITE, gJustifyCenter);
y += fheight2+1;
// Font 1 drawing White on the (black) background
gdispDrawStringBox(0, y, width, fheight1, line1, font1, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, y, width, fheight1, line1, font1, GFX_WHITE, gJustifyCenter);
y += fheight1+1;
gdispDrawStringBox(0, y, width, fheight1, line2, font1, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, y, width, fheight1, line2, font1, GFX_WHITE, gJustifyCenter);
y += fheight1+1;
// Show Sizes
@ -85,7 +85,7 @@ int main(void) {
buf[4] = (fheight2-2)/10 + '0';
buf[5] = (fheight2-2)%10 + '0';
buf[6] = 0;
gdispFillStringBox(0, y, width, fheight1, buf, font1, GFX_RED, GFX_WHITE, justifyCenter);
gdispFillStringBox(0, y, width, fheight1, buf, font1, GFX_RED, GFX_WHITE, gJustifyCenter);
// Wait forever
while(1) {

8
demos/modules/gdisp/multiple_displays/main.c

@ -72,10 +72,10 @@
sprintg(buf, "Display %u", display);
if (width < 128) {
gdispGDrawBox(g, 0, 0, width/2, height/2, GFX_YELLOW);
gdispGFillStringBox(g, 0, height/2, width, height/2, buf, f, GFX_BLACK, GFX_BLUE, justifyCenter);
gdispGFillStringBox(g, 0, height/2, width, height/2, buf, f, GFX_BLACK, GFX_BLUE, gJustifyCenter);
} else {
gdispGDrawBox(g, 10, 10, width/2, height/2, GFX_YELLOW);
gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, GFX_WHITE, GFX_BLUE, justifyCenter);
gdispGFillStringBox(g, width/2, height/2, width/2-10, height/2-10, buf, f, GFX_WHITE, GFX_BLUE, gJustifyCenter);
}
gdispGDrawLine(g, 5, 30, width-50, height-40, GFX_RED);
@ -115,10 +115,10 @@
sprintg(buf, "Display %u", display);
if (width < 128) {
gdispDrawBox(0, 0, width/2, height/2, GFX_YELLOW);
gdispFillStringBox(0, height/2, width, height/2, buf, f, GFX_BLACK, GFX_BLUE, justifyCenter);
gdispFillStringBox(0, height/2, width, height/2, buf, f, GFX_BLACK, GFX_BLUE, gJustifyCenter);
} else {
gdispDrawBox(10, 10, width/2, height/2, GFX_YELLOW);
gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, GFX_WHITE, GFX_BLUE, justifyCenter);
gdispFillStringBox(width/2, height/2, width/2-10, height/2-10, buf, f, GFX_WHITE, GFX_BLUE, gJustifyCenter);
}
gdispDrawLine(5, 30, width-50, height-40, GFX_RED);

8
demos/modules/gtrans/basic/main.c

@ -68,14 +68,14 @@ void updateText()
gCoord height = 30;
// Translate some basic strings
gdispFillStringBox(20, 20, width, height, gt("Welcome"), font, COLOR_TEXT, COLOR_BACKGROUND, justifyLeft);
gdispFillStringBox(20, 60, width, height, gt("This is a translated uGFX application"), font, COLOR_TEXT, COLOR_BACKGROUND, justifyLeft);
gdispFillStringBox(20, 100, width, height, gt("Goodbye"), font, COLOR_TEXT, COLOR_BACKGROUND, justifyLeft);
gdispFillStringBox(20, 20, width, height, gt("Welcome"), font, COLOR_TEXT, COLOR_BACKGROUND, gJustifyLeft);
gdispFillStringBox(20, 60, width, height, gt("This is a translated uGFX application"), font, COLOR_TEXT, COLOR_BACKGROUND, gJustifyLeft);
gdispFillStringBox(20, 100, width, height, gt("Goodbye"), font, COLOR_TEXT, COLOR_BACKGROUND, gJustifyLeft);
// A more complex example using string formatting
char buffer[128];
sprintf(buffer, gt("The temperature is %d degrees"), 18);
gdispFillStringBox(20, 140, width, height, buffer, font, COLOR_TEXT, COLOR_BACKGROUND, justifyLeft);
gdispFillStringBox(20, 140, width, height, buffer, font, COLOR_TEXT, COLOR_BACKGROUND, gJustifyLeft);
}
int main(void)

2
demos/tools/touch_calibration_grabber/main.c

@ -56,7 +56,7 @@ int main(void) {
font = gdispOpenFont("UI2");
gwinSetDefaultFont(font);
bHeight = gdispGetFontMetric(font, fontHeight)+4;
gdispFillStringBox(0, 0, swidth, bHeight, "Touchscreen Calibration Grabber", font, GFX_RED, GFX_WHITE, justifyCenter);
gdispFillStringBox(0, 0, swidth, bHeight, "Touchscreen Calibration Grabber", font, GFX_RED, GFX_WHITE, gJustifyCenter);
// Create our main display writing window
{

10
demos/tools/touch_driver_test/main.c

@ -46,14 +46,14 @@ static void DrawHeader(const char *title, gBool btnNext, gBool btnPrev, gBool bt
#if GDISP_NEED_CLIP
gdispSetClip(0, 0, swidth, sheight);
#endif
gdispFillStringBox(0, 0, swidth, bHeight, "Touch Calibration", font, GFX_RED, GFX_WHITE, justifyLeft);
gdispFillStringBox(0, 0, swidth, bHeight, "Touch Calibration", font, GFX_RED, GFX_WHITE, gJustifyLeft);
if (btnNext)
gdispFillStringBox(swidth-1*bWidth, 0, bWidth , bHeight, "Next", font, GFX_BLACK, GFX_GRAY, justifyCenter);
gdispFillStringBox(swidth-1*bWidth, 0, bWidth , bHeight, "Next", font, GFX_BLACK, GFX_GRAY, gJustifyCenter);
if (btnPrev)
gdispFillStringBox(swidth-2*bWidth, 0, bWidth-1, bHeight, "Prev", font, GFX_BLACK, GFX_GRAY, justifyCenter);
gdispFillStringBox(swidth-2*bWidth, 0, bWidth-1, bHeight, "Prev", font, GFX_BLACK, GFX_GRAY, gJustifyCenter);
if (btnPlusMinus) {
gdispFillStringBox(swidth-2*bWidth-1*bWidth2, 0, bWidth2-1, bHeight, "+", font, GFX_BLACK, GFX_GRAY, justifyCenter);
gdispFillStringBox(swidth-2*bWidth-2*bWidth2, 0, bWidth2-1, bHeight, "-", font, GFX_BLACK, GFX_GRAY, justifyCenter);
gdispFillStringBox(swidth-2*bWidth-1*bWidth2, 0, bWidth2-1, bHeight, "+", font, GFX_BLACK, GFX_GRAY, gJustifyCenter);
gdispFillStringBox(swidth-2*bWidth-2*bWidth2, 0, bWidth2-1, bHeight, "-", font, GFX_BLACK, GFX_GRAY, gJustifyCenter);
}
gwinClear(ghc);
gwinSetColor(ghc, GFX_YELLOW);

2
demos/tools/touch_raw_readings/main.c

@ -61,7 +61,7 @@ int main(void) {
font = gdispOpenFont("UI2");
gwinSetDefaultFont(font);
bHeight = gdispGetFontMetric(font, fontHeight)+4;
gdispFillStringBox(0, 0, swidth, bHeight, "Raw Touch Readings", font, GFX_RED, GFX_WHITE, justifyCenter);
gdispFillStringBox(0, 0, swidth, bHeight, "Raw Touch Readings", font, GFX_RED, GFX_WHITE, gJustifyCenter);
// Create our main display writing window
{

2
demos/tools/uGFXnetDisplay/main.c

@ -336,7 +336,7 @@ int main(proto_args) {
font = gdispOpenFont("UI2");
// Open the connection
gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetHeight(), "Connecting to host...", font, GFX_WHITE, justifyCenter);
gdispDrawStringBox(0, 0, gdispGetWidth(), gdispGetHeight(), "Connecting to host...", font, GFX_WHITE, gJustifyCenter);
StartSockets();
netfd = doConnect(cmd_args);
if (netfd == (SOCKET_TYPE)-1)

40
src/gdisp/gdisp.c

@ -3439,7 +3439,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, justify_t justify) {
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gJustify justify) {
gCoord totalHeight;
if (!font)
@ -3448,7 +3448,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
// Apply padding
#if GDISP_NEED_TEXT_BOXPADLR != 0 || GDISP_NEED_TEXT_BOXPADTB != 0
if (!(justify & justifyNoPad)) {
if (!(justify & gJustifyNoPad)) {
#if GDISP_NEED_TEXT_BOXPADLR != 0
x += GDISP_NEED_TEXT_BOXPADLR;
cx -= 2*GDISP_NEED_TEXT_BOXPADLR;
@ -3468,7 +3468,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
// Calculate the total text height
#if GDISP_NEED_TEXT_WORDWRAP
if (!(justify & justifyNoWordWrap)) {
if (!(justify & gJustifyNoWordWrap)) {
// Count the number of lines
totalHeight = 0;
mf_wordwrap(font, cx, str, mf_countline_callback, &totalHeight);
@ -3479,23 +3479,23 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
// Select the anchor position
switch((justify & JUSTIFYMASK_TOPBOTTOM)) {
case justifyTop:
case gJustifyTop:
break;
case justifyBottom:
case gJustifyBottom:
y += cy - totalHeight;
break;
default: // justifyMiddle
default: // gJustifyMiddle
y += (cy+1 - totalHeight)/2;
break;
}
switch((justify & JUSTIFYMASK_LEFTRIGHT)) {
case justifyCenter:
case gJustifyCenter:
x += (cx + 1) / 2;
break;
case justifyRight:
case gJustifyRight:
x += cx;
break;
default: // justifyLeft
default: // gJustifyLeft
break;
}
@ -3503,7 +3503,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
g->t.font = font;
g->t.color = color;
#if GDISP_NEED_TEXT_WORDWRAP
if (!(justify & justifyNoWordWrap)) {
if (!(justify & gJustifyNoWordWrap)) {
g->t.lrj = (justify & JUSTIFYMASK_LEFTRIGHT);
g->t.wrapx = x;
g->t.wrapy = y;
@ -3517,7 +3517,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgcolor, justify_t justify) {
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgcolor, gJustify justify) {
gCoord totalHeight;
if (!font)
@ -3537,7 +3537,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
// Apply padding
#if GDISP_NEED_TEXT_BOXPADLR != 0 || GDISP_NEED_TEXT_BOXPADTB != 0
if (!(justify & justifyNoPad)) {
if (!(justify & gJustifyNoPad)) {
#if GDISP_NEED_TEXT_BOXPADLR != 0
x += GDISP_NEED_TEXT_BOXPADLR;
cx -= 2*GDISP_NEED_TEXT_BOXPADLR;
@ -3557,7 +3557,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
// Calculate the total text height
#if GDISP_NEED_TEXT_WORDWRAP
if (!(justify & justifyNoWordWrap)) {
if (!(justify & gJustifyNoWordWrap)) {
// Count the number of lines
totalHeight = 0;
mf_wordwrap(font, cx, str, mf_countline_callback, &totalHeight);
@ -3568,23 +3568,23 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
// Select the anchor position
switch((justify & JUSTIFYMASK_TOPBOTTOM)) {
case justifyTop:
case gJustifyTop:
break;
case justifyBottom:
case gJustifyBottom:
y += cy - totalHeight;
break;
default: // justifyMiddle
default: // gJustifyMiddle
y += (cy+1 - totalHeight)/2;
break;
}
switch((justify & JUSTIFYMASK_LEFTRIGHT)) {
case justifyCenter:
case gJustifyCenter:
x += (cx + 1) / 2;
break;
case justifyRight:
case gJustifyRight:
x += cx;
break;
default: // justifyLeft
default: // gJustifyLeft
break;
}
@ -3593,7 +3593,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
g->t.color = color;
g->t.bgcolor = bgcolor;
#if GDISP_NEED_TEXT_WORDWRAP
if (!(justify & justifyNoWordWrap)) {
if (!(justify & gJustifyNoWordWrap)) {
g->t.lrj = (justify & JUSTIFYMASK_LEFTRIGHT);
g->t.wrapx = x;
g->t.wrapy = y;

45
src/gdisp/gdisp.h

@ -54,23 +54,23 @@ typedef struct gPoint {
} gPoint;
/**
* @enum justify
* @enum gJustify
* @brief Type for the text justification.
*/
typedef enum justify {
justifyLeft = 0x00, /**< Justify Left (the default) */
justifyCenter = 0x01, /**< Justify Center */
justifyRight = 0x02, /**< Justify Right */
justifyTop = 0x10, /**< Justify Top */
justifyMiddle = 0x00, /**< Justify Middle (the default) */
justifyBottom = 0x20, /**< Justify Bottom */
justifyWordWrap = 0x00, /**< Word wrap (the default if GDISP_NEED_TEXT_WORDWRAP is on) */
justifyNoWordWrap = 0x40, /**< No word wrap */
justifyPad = 0x00, /**< Pad the text box (the default) */
justifyNoPad = 0x04 /**< No padding the text box */
} justify_t;
#define JUSTIFYMASK_LEFTRIGHT (justifyLeft|justifyCenter|justifyRight)
#define JUSTIFYMASK_TOPBOTTOM (justifyTop|justifyMiddle|justifyBottom)
typedef enum gJustify {
gJustifyLeft = 0x00, /**< Justify Left (the default) */
gJustifyCenter = 0x01, /**< Justify Center */
gJustifyRight = 0x02, /**< Justify Right */
gJustifyTop = 0x10, /**< Justify Top */
gJustifyMiddle = 0x00, /**< Justify Middle (the default) */
gJustifyBottom = 0x20, /**< Justify Bottom */
gJustifyWordWrap = 0x00, /**< Word wrap (the default if GDISP_NEED_TEXT_WORDWRAP is on) */
gJustifyNoWordWrap = 0x40, /**< No word wrap */
gJustifyPad = 0x00, /**< Pad the text box (the default) */
gJustifyNoPad = 0x04 /**< No padding the text box */
} gJustify;
#define JUSTIFYMASK_LEFTRIGHT (gJustifyLeft|gJustifyCenter|gJustifyRight)
#define JUSTIFYMASK_TOPBOTTOM (gJustifyTop|gJustifyMiddle|gJustifyBottom)
/**
* @enum fontmetric
@ -981,7 +981,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, justify_t justify);
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gJustify justify);
#define gdispDrawStringBox(x,y,cx,cy,s,f,c,j) gdispGDrawStringBox(GDISP,x,y,cx,cy,s,f,c,j)
/**
@ -1000,7 +1000,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgColor, justify_t justify);
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, font_t font, gColor color, gColor bgColor, gJustify justify);
#define gdispFillStringBox(x,y,cx,cy,s,f,c,b,j) gdispGFillStringBox(GDISP,x,y,cx,cy,s,f,c,b,j)
/**
@ -1235,6 +1235,17 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#define powerDeepSleep gPowerDeepSleep
#define powerSleep gPowerSleep
#define powerOn gPowerOn
typedef gJustify justify_t;
#define justifyLeft gJustifyLeft
#define justifyCenter gJustifyCenter
#define justifyRight gJustifyRight
#define justifyTop gJustifyTop
#define justifyMiddle gJustifyMiddle
#define justifyBottom gJustifyBottom
#define justifyWordWrap gJustifyWordWrap
#define justifyNoWordWrap gJustifyNoWordWrap
#define justifyPad gJustifyPad
#define justifyNoPad gJustifyNoPad
typedef gColor color_t;
typedef gPixel pixel_t;
typedef gCoord coord_t;

2
src/gdisp/gdisp_driver.h

@ -369,7 +369,7 @@ struct GDisplay {
gCoord clipx1, clipy1;
#if GDISP_NEED_TEXT_WORDWRAP
gCoord wrapx, wrapy;
justify_t lrj;
gJustify lrj;
#endif
} t;
#endif

4
src/gdisp/gdisp_options.h

@ -577,7 +577,7 @@
/**
* @brief Adding pixels to the left and right side of the box to pad text.
* @details Only has an effect with @p gdispGDrawStringBox() and @p gdispGFillStringBox()
* @note Can be turned off by using justifyNoPad
* @note Can be turned off by using gJustifyNoPad
* @details Defaults to 1
*/
#ifndef GDISP_NEED_TEXT_BOXPADLR
@ -586,7 +586,7 @@
/**
* @brief Adding pixels to the top and bottom side of the box to pad text.
* @details Only has an effect with @p gdispGDrawStringBox() and @p gdispGFillStringBox()
* @note Can be turned off by using justifyNoPad
* @note Can be turned off by using gJustifyNoPad
* @details Defaults to 1
*/
#ifndef GDISP_NEED_TEXT_BOXPADTB

4
src/ginput/ginput_mouse.c

@ -505,7 +505,7 @@ static void MousePoll(void *param) {
gdispGFillStringBox(m->display,
0, CALIBRATION_TITLE_Y, w, CALIBRATION_TITLE_HEIGHT,
CALIBRATION_TITLE, font1, CALIBRATION_TITLE_COLOR, CALIBRATION_TITLE_BACKGROUND,
justifyCenter);
gJustifyCenter);
#endif
// Calculate the calibration
@ -603,7 +603,7 @@ static void MousePoll(void *param) {
gdispGFillStringBox(m->display,
0, CALIBRATION_ERROR_Y, w, CALIBRATION_ERROR_HEIGHT,
CALIBRATION_ERROR_TEXT, font2, CALIBRATION_ERROR_COLOR, CALIBRATION_ERROR_BACKGROUND,
justifyCenter);
gJustifyCenter);
gfxSleepMilliseconds(CALIBRATION_ERROR_DELAY);
#endif
} else

4
src/gwin/gwin.c

@ -370,13 +370,13 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s
_gwinDrawEnd(gh);
}
void gwinDrawStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, justify_t justify) {
void gwinDrawStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gJustify justify) {
if (!gh->font || !_gwinDrawStart(gh)) return;
gdispGDrawStringBox(gh->display, gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, justify);
_gwinDrawEnd(gh);
}
void gwinFillStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, justify_t justify) {
void gwinFillStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gJustify justify) {
if (!gh->font || !_gwinDrawStart(gh)) return;
gdispGFillStringBox(gh->display, gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, gh->bgcolor, justify);
_gwinDrawEnd(gh);

4
src/gwin/gwin.h

@ -950,7 +950,7 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s
*
* @api
*/
void gwinDrawStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, justify_t justify);
void gwinDrawStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gJustify justify);
/**
* @brief Draw a text string verticly centered within the specified filled box.
@ -967,7 +967,7 @@ void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord s
*
* @api
*/
void gwinFillStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, justify_t justify);
void gwinFillStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gJustify justify);
#endif
/*-------------------------------------------------

20
src/gwin/gwin_button.c

@ -171,7 +171,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
pcol = getButtonColors(gw);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
@ -198,7 +198,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha)
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
@ -219,10 +219,10 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
if (gw->g.width >= 2*BTN_CNR_SIZE+10) {
gdispGFillRoundedBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, BTN_CNR_SIZE-1, pcol->fill);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+BTN_CNR_SIZE, gw->g.width-2, gw->g.height-(2*BTN_CNR_SIZE), gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+BTN_CNR_SIZE, gw->g.width-2, gw->g.height-(2*BTN_CNR_SIZE), gw->text, gw->g.font, pcol->text, gJustifyCenter);
gdispGDrawRoundedBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, BTN_CNR_SIZE, pcol->edge);
} else {
gdispGFillStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge);
}
}
@ -239,7 +239,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillEllipse(gw->g.display, gw->g.x+gw->g.width/2, gw->g.y+gw->g.height/2, gw->g.width/2-2, gw->g.height/2-2, pcol->fill);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
gdispGDrawEllipse(gw->g.display, gw->g.x+gw->g.width/2, gw->g.y+gw->g.height/2, gw->g.width/2-1, gw->g.height/2-1, pcol->edge);
}
#endif
@ -293,7 +293,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
}
void gwinButtonDraw_ArrowDown(GWidgetObject *gw, void *param) {
@ -344,7 +344,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
}
void gwinButtonDraw_ArrowLeft(GWidgetObject *gw, void *param) {
@ -395,7 +395,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
}
void gwinButtonDraw_ArrowRight(GWidgetObject *gw, void *param) {
@ -446,7 +446,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
}
#endif
@ -467,7 +467,7 @@ static const GColorSet *getButtonColors(GWidgetObject *gw) {
}
gdispGImageDraw(gw->g.display, (gdispImage *)param, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 0, sy);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
}
#endif

8
src/gwin/gwin_checkbox.c

@ -196,7 +196,7 @@ void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) {
_gwidgetDrawFocusRect(gw, 1, 1, ld-2, ld-2);
// Draw the text
gdispGFillStringBox(gw->g.display, gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyLeft);
gdispGFillStringBox(gw->g.display, gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, gJustifyLeft);
#undef gcw
}
@ -228,7 +228,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
_gwidgetDrawFocusRect(gw, ep+1, 1, ld-2, ld-2);
// Draw the text
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, ep-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyRight);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, ep-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, gJustifyRight);
#undef gcw
}
@ -245,7 +245,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
pcol = _gwinGetFlashedColor(gw, pcol, gTrue);
#endif
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
}
@ -273,7 +273,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha)
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
}

2
src/gwin/gwin_frame.c

@ -242,7 +242,7 @@ void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param) {
btn = gdispBlendColor(pcol->edge, contrast, 128);
// Render the frame
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, FRM_BORDER_T, gw->text, gw->g.font, contrast, pcol->edge, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, FRM_BORDER_T, gw->text, gw->g.font, contrast, pcol->edge, gJustifyCenter);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+FRM_BORDER_T, FRM_BORDER_L, gw->g.height-(FRM_BORDER_T+FRM_BORDER_B), pcol->edge);
gdispGFillArea(gw->g.display, gw->g.x+gw->g.width-FRM_BORDER_R, gw->g.y+FRM_BORDER_T, FRM_BORDER_R, gw->g.height-(FRM_BORDER_T+FRM_BORDER_B), pcol->edge);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+gw->g.height-FRM_BORDER_B, gw->g.width, FRM_BORDER_B, pcol->edge);

2
src/gwin/gwin_keyboard.c

@ -552,7 +552,7 @@ void gwinKeyboardDraw_Normal(GWidgetObject *gw, void *param) {
break;
default: // Regular character
gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, cx, cy, pcap, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, cx, cy, pcap, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
break;
}

8
src/gwin/gwin_label.c

@ -129,7 +129,7 @@ void gwinLabelSetBorder(GHandle gh, gBool border) {
}
#endif // GWIN_LABEL_ATTRIBUTE
static void gwinLabelDraw(GWidgetObject *gw, justify_t justify) {
static void gwinLabelDraw(GWidgetObject *gw, gJustify justify) {
gCoord w, h;
gColor c;
@ -173,19 +173,19 @@ static void gwinLabelDraw(GWidgetObject *gw, justify_t justify) {
void gwinLabelDrawJustifiedLeft(GWidgetObject *gw, void *param) {
(void)param;
gwinLabelDraw(gw, justifyLeft);
gwinLabelDraw(gw, gJustifyLeft);
}
void gwinLabelDrawJustifiedRight(GWidgetObject *gw, void *param) {
(void)param;
gwinLabelDraw(gw, justifyRight);
gwinLabelDraw(gw, gJustifyRight);
}
void gwinLabelDrawJustifiedCenter(GWidgetObject *gw, void *param) {
(void)param;
gwinLabelDraw(gw, justifyCenter);
gwinLabelDraw(gw, gJustifyCenter);
}
#undef gh2obj

2
src/gwin/gwin_list.c

@ -797,7 +797,7 @@ void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
}
}
#endif
gdispGFillStringBox(gw->g.display, gw->g.x+x+LST_HORIZ_PAD, gw->g.y+y, iwidth-LST_HORIZ_PAD, iheight, qi2li->text, gw->g.font, ps->text, fill, justifyLeft);
gdispGFillStringBox(gw->g.display, gw->g.x+x+LST_HORIZ_PAD, gw->g.y+y, iwidth-LST_HORIZ_PAD, iheight, qi2li->text, gw->g.font, ps->text, fill, gJustifyLeft);
}
// Fill any remaining item space

4
src/gwin/gwin_progressbar.c

@ -255,7 +255,7 @@ void gwinProgressbarDraw_Std(GWidgetObject *gw, void *param) {
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge
gdispGDrawLine(gw->g.display, gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, pcol->edge); // Thumb
}
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
#undef gsw
}
@ -306,7 +306,7 @@ void gwinProgressbarDraw_Image(GWidgetObject *gw, void *param) {
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge
gdispGDrawLine(gw->g.display, gw->g.x+gsw->dpos, gw->g.y+1, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-2, pcol->edge); // Thumb
}
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
#undef gsw
}

14
src/gwin/gwin_radio.c

@ -210,7 +210,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
_gwidgetDrawFocusCircle(gw, df);
gdispGFillStringBox(gw->g.display, gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyLeft);
gdispGFillStringBox(gw->g.display, gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, gJustifyLeft);
#undef gcw
}
@ -227,7 +227,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
pcol = _gwinGetFlashedColor(gw, pcol, gFalse);
#endif
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
@ -248,9 +248,9 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
if ((gw->g.flags & GRADIO_FLG_PRESSED)) {
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge);
gdispGFillStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
} else {
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
}
@ -277,7 +277,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha)
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
@ -297,7 +297,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
if ((gw->g.flags & GRADIO_FLG_PRESSED)) {
tcol = gdispBlendColor(pcol->edge, gw->pstyle->background, GRADIO_OUTLINE_FADE);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, pcol->text, gw->g.bgcolor, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, pcol->text, gw->g.bgcolor, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y, gw->g.x+gw->g.width-(GRADIO_TAB_CNR+1), gw->g.y, tcol);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-(GRADIO_TAB_CNR+1), gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+GRADIO_TAB_CNR, tcol);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y+GRADIO_TAB_CNR, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, tcol);
@ -309,7 +309,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha)
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
}
// Render highlighted border if focused

4
src/gwin/gwin_slider.c

@ -381,7 +381,7 @@ void gwinSliderDraw_Std(GWidgetObject *gw, void *param) {
}
// Draw the string
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
#undef gsw
}
@ -431,7 +431,7 @@ void gwinSliderDraw_Image(GWidgetObject *gw, void *param) {
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge
gdispGDrawLine(gw->g.display, gw->g.x+gsw->dpos, gw->g.y+1, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-2, pcol->edge); // Thumb
}
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, gJustifyCenter);
#undef gsw
#undef gi

8
src/gwin/gwin_tabset.c

@ -401,14 +401,14 @@ void gwinTabsetSetTab(GHandle gh) {
pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
gdispGDrawBox(gw->g.display, gw->g.x+x, gw->g.y+y, w, GWIN_TABSET_TABHEIGHT, pcol->edge);
gdispGFillStringBox(gw->g.display, gw->g.x+x+1, gw->g.y+y+1, w-2, GWIN_TABSET_TABHEIGHT-1, text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x+x+1, gw->g.y+y+1, w-2, GWIN_TABSET_TABHEIGHT-1, text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
}
static void bgarea(GWidgetObjset *gw, const char *text, gCoord y, gCoord x, gCoord w) {
const GColorSet * pcol;
pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, w-1, GWIN_TABSET_TABHEIGHT, text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, w-1, GWIN_TABSET_TABHEIGHT, text, gw->g.font, pcol->text, pcol->fill, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+x+w-1, gw->g.y+y, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, gw->g.x+x+w-2, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
}
@ -428,7 +428,7 @@ void gwinTabsetSetTab(GHandle gh) {
pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
tcol = gdispBlendColor(pcol->edge, gw->pstyle->background, GTABSET_OUTLINE_FADE);
gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, w, GWIN_TABSET_TABHEIGHT, text, gw->g.font, pcol->text, gw->g.bgcolor, justifyCenter);
gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, w, GWIN_TABSET_TABHEIGHT, text, gw->g.font, pcol->text, gw->g.bgcolor, gJustifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y, gw->g.x+x+w-(GTABSET_TAB_CNR+1), gw->g.y+y, tcol);
gdispGDrawLine(gw->g.display, gw->g.x+x+w-(GTABSET_TAB_CNR+1), gw->g.y+y, gw->g.x+x+w-1, gw->g.y+y+GTABSET_TAB_CNR, tcol);
gdispGDrawLine(gw->g.display, gw->g.x+x+w-1, gw->g.y+y+GTABSET_TAB_CNR, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, tcol);
@ -449,7 +449,7 @@ void gwinTabsetSetTab(GHandle gh) {
for(alpha = 0, i = 0; i < GWIN_TABSET_TABHEIGHT; i++, alpha += FIXED(255)/GWIN_TABSET_TABHEIGHT)
gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y+i, gw->g.x+x+w-2, gw->g.y+y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));
gdispGDrawLine(gw->g.display, gw->g.x+x+w-1, gw->g.y+y, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
gdispGDrawStringBox(gw->g.display, gw->g.x+x+1, gw->g.y+y+1, w-2, GWIN_TABSET_TABHEIGHT-2, text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawStringBox(gw->g.display, gw->g.x+x+1, gw->g.y+y+1, w-2, GWIN_TABSET_TABHEIGHT-2, text, gw->g.font, pcol->text, gJustifyCenter);
}
static void ntarea(GWidgetObject *gw, gCoord y, gCoord x, gCoord w) {
const GColorSet * pcol;

2
src/gwin/gwin_textedit.c

@ -300,7 +300,7 @@ void gwinTexteditDefaultDraw(GWidgetObject* gw, void* param)
#if TEXT_PADDING_LEFT
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, TEXT_PADDING_LEFT, gw->g.height, pcol->fill);
#endif
gdispGFillStringBox(gw->g.display, gw->g.x + TEXT_PADDING_LEFT, gw->g.y, gw->g.width-TEXT_PADDING_LEFT, gw->g.height, p, gw->g.font, pcol->text, pcol->fill, justifyLeft);
gdispGFillStringBox(gw->g.display, gw->g.x + TEXT_PADDING_LEFT, gw->g.y, gw->g.width-TEXT_PADDING_LEFT, gw->g.height, p, gw->g.font, pcol->text, pcol->fill, gJustifyLeft);
// Render cursor (if focused)
if (gwinGetFocus() == (GHandle)gw) {

Loading…
Cancel
Save