Jump to content

Bezet

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Bezet

  1. Hello,

    I'm not sure if its best place to report bug but couldn't find another. 

    In  gwinListAddItem function item counter is incremented but its never decremented, in my opinion it should be decremented in gwinListItemDelete

    My proposition is to put gh2Obj->cnt--;   in gwinListItemDelete function;

    Below are original functions bodys in 2.5 ugfx .

    void gwinListItemDelete(GHandle gh, int item) {
    	const gfxQueueASyncItem	*	qi;
    	int							i;
    
    	// is it a valid handle?
    	if (gh->vmt != (gwinVMT *)&listVMT)
    		return;
    
    	// watch out for an invalid item
    	if (item < 0 || item >= gh2obj->cnt)
    		return;
    
    	for(qi = gfxQueueASyncPeek(&gh2obj->list_head), i = 0; qi; qi = gfxQueueASyncNext(qi), i++) {
    		if (i == item) {
    			gfxQueueASyncRemove(&gh2obj->list_head, (gfxQueueASyncItem*)qi);
    			gfxFree((void *)qi);
    			if (gh2obj->top >= item && gh2obj->top)
    				gh2obj->top--;
    			_gwinUpdate(gh);
    			break;
    		}
    	}
    }

     

     

    int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) {
    	ListItem	*newItem;
    
    	// is it a valid handle?
    	if (gh->vmt != (gwinVMT *)&listVMT)
    		return -1;
    
    	if (useAlloc) {
    		size_t len = strlen(item_name)+1;
    		if (!(newItem = gfxAlloc(sizeof(ListItem) + len)))
    			return -1;
    
    		memcpy((char *)(newItem+1), item_name, len);
    		item_name = (const char *)(newItem+1);
    	} else {
    		if (!(newItem = gfxAlloc(sizeof(ListItem))))
    			return -1;
    	}
    
    	// the item is not selected when added
    	newItem->flags = 0;
    	newItem->param = 0;
    	newItem->text = item_name;
    	#if GWIN_NEED_LIST_IMAGES
    		newItem->pimg = 0;
    	#endif
    
    	// select the item if it's the first in the list
    	if (gh2obj->cnt == 0 && !(gh->flags & GLIST_FLG_MULTISELECT))
    		newItem->flags |= GLIST_FLG_SELECTED;
    
    	// add the new item to the list
    	gfxQueueASyncPut(&gh2obj->list_head, &newItem->q_item);
    
    	// increment the total amount of entries in the list widget
    	gh2obj->cnt++;
    
    	_gwinUpdate(gh);
    
    	// return the position in the list (-1 because we start with index 0)
    	return gh2obj->cnt-1;
    }

     

  2. To solve this problem in preview generator:

    .build/obj/GFXLIB/src/gdisp/gdisp.o: In function `gdispGDrawArc':
    ugfx_library/src/gdisp/gdisp.c:1728: undefined reference to `sin'
    ugfx_library/src/gdisp/gdisp.c:1728: undefined reference to `cos'
    ugfx_library/src/gdisp/gdisp.c:1728: undefined reference to `round'

    You need to add '-lm' parameter for LDFLAGS. For example at line 172 in 'ugfx_studio_0.14_linux/ugfx_library/tools/gmake_scripts/compiler_gcc.mk' 

    LDFLAGS  += $(patsubst %,-L%,$(LIBPATH)) $(patsubst %,-l%,$(patsubst -l%,%,$(LIBS))) -lm

     

     

    Looks like you forget about  'clean' option for preview generator. 

×
×
  • Create New...