Some string cleanup
This commit is contained in:
18
dw/fltkui.cc
18
dw/fltkui.cc
@ -1502,11 +1502,11 @@ void FltkOptionMenuResource::setItem (int index, bool selected)
|
||||
((Fl_Choice *)widget)->value(menu+index);
|
||||
}
|
||||
|
||||
void FltkOptionMenuResource::pushGroup (const char *name, bool enabled)
|
||||
void FltkOptionMenuResource::pushGroup (const std::string &name, bool enabled)
|
||||
{
|
||||
Fl_Menu_Item *item = newItem();
|
||||
|
||||
item->text = dStrdup(name);
|
||||
item->text = dStrdup( name.c_str() );
|
||||
|
||||
if (enabled == false)
|
||||
item->flags = FL_MENU_INACTIVE;
|
||||
@ -1628,11 +1628,11 @@ void FltkListResource::widgetCallback (Fl_Widget *widget, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
void *FltkListResource::newItem (const char *str, bool enabled, bool selected)
|
||||
void *FltkListResource::newItem (const std::string &str, bool enabled, bool selected)
|
||||
{
|
||||
Fl_Browser *b = (Fl_Browser *) widget;
|
||||
int index = b->size() + 1;
|
||||
char *label = (char *)malloc(strlen(str) + 1 + currDepth + 4),
|
||||
char *label = (char *)malloc(str.size() + 1 + currDepth + 4),
|
||||
*s = label;
|
||||
|
||||
memset(s, '\a', currDepth);
|
||||
@ -1646,7 +1646,7 @@ void *FltkListResource::newItem (const char *str, bool enabled, bool selected)
|
||||
*s++ = '@';
|
||||
*s++ = '.';
|
||||
|
||||
strcpy(s, str);
|
||||
strcpy(s, str.c_str());
|
||||
|
||||
b->add(label);
|
||||
free(label);
|
||||
@ -1689,18 +1689,18 @@ void FltkListResource::setItem (int index, bool selected)
|
||||
b->select(index + 1, selected);
|
||||
}
|
||||
|
||||
void FltkListResource::pushGroup (const char *name, bool enabled)
|
||||
void FltkListResource::pushGroup (const std::string &name_, bool enabled)
|
||||
{
|
||||
bool en = false;
|
||||
bool selected = false;
|
||||
|
||||
auto name= name_;
|
||||
// Fl_Browser_::incr_height() for item height won't do the right thing if
|
||||
// the first item doesn't have anything to it.
|
||||
if (!name || !*name)
|
||||
name = " ";
|
||||
if( name.empty() ) name= " ";
|
||||
|
||||
// TODO: Proper disabling of item groups
|
||||
newItem(name, en, selected);
|
||||
newItem(name.c_str(), en, selected);
|
||||
|
||||
if (currDepth < 3)
|
||||
currDepth++;
|
||||
|
Reference in New Issue
Block a user