Compare commits

...

3 Commits

7 changed files with 29 additions and 25 deletions

View File

@ -42,8 +42,9 @@ FEATURE: Added keyboard support to radio buttons (by Steffan)
FEATURE: Added internal use only GFX_COMPILESTAGE (used to control compilation) FEATURE: Added internal use only GFX_COMPILESTAGE (used to control compilation)
FEATURE: Added support for ChibiOS Kernel V5 FEATURE: Added support for ChibiOS Kernel V5
FEATURE: Added WS29EPD WaveShare E-Paper display FEATURE: Added WS29EPD WaveShare E-Paper display
FIX: Fixing GQUEUE full synchronous function signatures FIX: Fixed GQUEUE full synchronous function signatures
CHANGE: Removing label widget auto-sizing functionality CHANGE: Removed label widget auto-sizing during redraw. It will still auto-size during creation
FIX: Fixed realloc bug for RAW32 (and derivitives)
*** Release 2.8 *** *** Release 2.8 ***

View File

@ -2,7 +2,7 @@
* This file is subject to the terms of the GFX License. If a copy of * This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at: * the license was not distributed with this file, you can obtain one at:
* *
* http://ugfx.com/license.html * http://ugfx.io/license.html
*/ */
/** /**

View File

@ -2,7 +2,7 @@
* This file is subject to the terms of the GFX License. If a copy of * This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at: * the license was not distributed with this file, you can obtain one at:
* *
* http://ugfx.com/license.html * http://ugfx.io/license.html
*/ */
/** /**

View File

@ -2,7 +2,7 @@
* This file is subject to the terms of the GFX License. If a copy of * This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at: * the license was not distributed with this file, you can obtain one at:
* *
* http://ugfx.com/license.html * http://ugfx.io/license.html
*/ */
/** /**

View File

@ -184,7 +184,7 @@
* This file is subject to the terms of the GFX License. If a copy of * This file is subject to the terms of the GFX License. If a copy of
* the license was not distributed with this file, you can obtain one at: * the license was not distributed with this file, you can obtain one at:
* *
* http://ugfx.com/license.html * http://ugfx.io/license.html
*/ */
</pre> </pre>

View File

@ -135,7 +135,7 @@
// We need to do this the hard way // We need to do this the hard way
pfree = gfxAlloc(sz); pfree = gfxAlloc(sz);
if (pfree) if (!pfree)
return 0; return 0;
memcpy(pfree, ptr, p->sz - sizeof(memslot)); memcpy(pfree, ptr, p->sz - sizeof(memslot));
gfxFree(ptr); gfxFree(ptr);

View File

@ -61,6 +61,13 @@ static const gwidgetVMT labelVMT = {
}; };
GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit) { GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit) {
// auto assign width
if (pInit->g.width <= 0)
pInit->g.width = gdispGetStringWidth(pInit->text, gwinGetDefaultFont())+2; // Allow one pixel of padding on each side
// auto assign height
if (pInit->g.height <= 0)
pInit->g.height = gdispGetFontMetric(gwinGetDefaultFont(), gFontHeight);
if (!(widget = (GLabelObject *)_gwidgetCreate(g, &widget->w, pInit, &labelVMT))) if (!(widget = (GLabelObject *)_gwidgetCreate(g, &widget->w, pInit, &labelVMT)))
return 0; return 0;
@ -100,32 +107,28 @@ void gwinLabelSetBorder(GHandle gh, gBool border) {
#endif // GWIN_LABEL_ATTRIBUTE #endif // GWIN_LABEL_ATTRIBUTE
void gwinLabelDrawJustified(GWidgetObject *gw, void *param) { void gwinLabelDrawJustified(GWidgetObject *gw, void *param) {
gCoord w, h; gColor c;
gColor c; gJustify justify = (gJustify)param;
gJustify justify = (gJustify)param;
// is it a valid handle? // is it a valid handle?
if (gw->g.vmt != (gwinVMT *)&labelVMT) if (gw->g.vmt != (gwinVMT *)&labelVMT)
return; return;
w = gw->g.width;
h = gw->g.height;
c = (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text; c = (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text;
#if GWIN_LABEL_ATTRIBUTE #if GWIN_LABEL_ATTRIBUTE
if (gw2obj->attr) { if (gw2obj->attr) {
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw2obj->tab, h, gw2obj->attr, gw->g.font, c, gw->pstyle->background, justify); gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw2obj->tab, gw->g.height, gw2obj->attr, gw->g.font, c, gw->pstyle->background, justify);
gdispGFillStringBox(gw->g.display, gw->g.x + gw2obj->tab, gw->g.y, w-gw2obj->tab, h, gw->text, gw->g.font, c, gw->pstyle->background, justify); gdispGFillStringBox(gw->g.display, gw->g.x + gw2obj->tab, gw->g.y, gw->g.width-gw2obj->tab, gw->g.height, gw->text, gw->g.font, c, gw->pstyle->background, justify);
} else } else
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, w, h, gw->text, gw->g.font, c, gw->pstyle->background, justify); gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, c, gw->pstyle->background, justify);
#else #else
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, w, h, gw->text, gw->g.font, c, gw->pstyle->background, justify); gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, c, gw->pstyle->background, justify);
#endif #endif
// render the border (if any) // render the border (if any)
if (gw->g.flags & GLABEL_FLG_BORDER) if (gw->g.flags & GLABEL_FLG_BORDER)
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, w, h, (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge); gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge);
} }
void gwinLabelDrawJustifiedLeft(GWidgetObject *gw, void *param) { void gwinLabelDrawJustifiedLeft(GWidgetObject *gw, void *param) {