diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/gwin/gwin_label.c | 48 | ||||
| -rw-r--r-- | src/gwin/gwin_label.h | 4 | 
2 files changed, 3 insertions, 49 deletions
diff --git a/src/gwin/gwin_label.c b/src/gwin/gwin_label.c index 79f0388d..ff70fdde 100644 --- a/src/gwin/gwin_label.c +++ b/src/gwin/gwin_label.c @@ -20,21 +20,6 @@  #define gh2obj					((GLabelObject *)gh)  #define gw2obj					((GLabelObject *)gw) -// simple: single line with no wrapping -static gCoord getwidth(const char *text, gFont font, gCoord maxwidth) { -	(void) maxwidth; - -	return gdispGetStringWidth(text, font)+2;		// Allow one pixel of padding on each side -} - -// simple: single line with no wrapping -static gCoord getheight(const char *text, gFont font, gCoord maxwidth) { -	(void) text; -	(void) maxwidth; - -	return gdispGetFontMetric(font, gFontHeight); -} -  static const gwidgetVMT labelVMT = {  	{  		"Label",					// The class name @@ -76,20 +61,6 @@ static const gwidgetVMT labelVMT = {  };  GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit) { -	uint16_t flags = 0; - -	// auto assign width -	if (pInit->g.width <= 0) { - -		flags |= GLABEL_FLG_WAUTO; -		pInit->g.width = getwidth(pInit->text, gwinGetDefaultFont(), gdispGGetWidth(g) - pInit->g.x); -	} -  -	// auto assign height -	if (pInit->g.height <= 0) { -		flags |= GLABEL_FLG_HAUTO; -		pInit->g.height = getheight(pInit->text, gwinGetDefaultFont(), gdispGGetWidth(g) - pInit->g.x); -	}  	if (!(widget = (GLabelObject *)_gwidgetCreate(g, &widget->w, pInit, &labelVMT)))  		return 0; @@ -99,7 +70,6 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit)  		widget->attr = 0;  	#endif -	widget->w.g.flags |= flags;	  	gwinSetVisible(&widget->w.g, pInit->g.show);  	return (GHandle)widget; @@ -137,24 +107,10 @@ static void gwinLabelDraw(GWidgetObject *gw, gJustify justify) {  	if (gw->g.vmt != (gwinVMT *)&labelVMT)  		return; -	w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.width; -	h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.height; +	w = gw->g.width; +	h = gw->g.height;  	c = (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text; -	if (gw->g.width != w || gw->g.height != h) { -		/* Only allow the widget to be resize if it will grow larger. -		 * Growing smaller is problematic because it requires a temporary change in visibility. -		 * This is a work-around for a crashing bug caused by calling gwinResize() in the draw function -		 * (dubious) as it may try to reclaim the drawing lock. -		 */ -		if (gw->g.width < w || gw->g.height < h) { -			gwinResize(&gw->g, (w > gw->g.width ? w : gw->g.width), (h > gw->g.height ? h : gw->g.height)); -			return; -		} -		w = gw->g.width; -		h = gw->g.height; -	} -  	#if GWIN_LABEL_ATTRIBUTE  		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); diff --git a/src/gwin/gwin_label.h b/src/gwin/gwin_label.h index 281fb408..9308efae 100644 --- a/src/gwin/gwin_label.h +++ b/src/gwin/gwin_label.h @@ -38,9 +38,7 @@   * @note	Used only for writing a custom draw routine.   * @{   */ -#define GLABEL_FLG_WAUTO		0x01 -#define GLABEL_FLG_HAUTO		0x02 -#define GLABEL_FLG_BORDER		0x04 +#define GLABEL_FLG_BORDER		0x01  /** @} */  // An label window  | 
