diff options
| -rw-r--r-- | fluid/factory.cxx | 42 | ||||
| -rw-r--r-- | fluid/file.cxx | 2 | ||||
| -rw-r--r-- | fluid/widget_browser.cxx | 2 |
3 files changed, 38 insertions, 8 deletions
diff --git a/fluid/factory.cxx b/fluid/factory.cxx index a58648261..974b5f62e 100644 --- a/fluid/factory.cxx +++ b/fluid/factory.cxx @@ -1217,7 +1217,7 @@ Fl_Menu_Item New_Menu[] = { /** Modify a menuitem to display an icon in front of the label. This is implemented using Fl_Multi_Label as the labeltype (FL_MULTI_LABEL). - The icon may be null. If ic is null only the text (is assigned + The icon may be null. If ic is null only the text is assigned to the label and Fl_Multi_Label is not used. \param[in] mi pointer to tme menu item that will be modified \param[in] ic icon for the menu, may be NULL @@ -1284,7 +1284,7 @@ Fl_Type *typename_to_prototype(const char *inName) This is used by the .fl file reader. New types are always created as the last child of the first compatible parent. New widgets have a default - setup. Their position, sizem and label will be read next in the file. + setup. Their position, size and label will be read next in the file. \param[in] inName a C string that described the type we want \param[in] strategy add after current or as last child @@ -1310,6 +1310,10 @@ Fl_Type *add_new_widget_from_file(const char *inName, Strategy strategy) { struct symbol {const char *name; int value;}; +/** + Table with all symbols known by the "fdesign" format reader. + This table does not need to be sorted alphabetically. + */ static symbol table[] = { {"BLACK", FL_BLACK}, {"RED", FL_RED}, @@ -1432,10 +1436,36 @@ static symbol table[] = { {"HOR_NICE_SLIDER", FL_HOR_NICE_SLIDER}, }; +/** + \brief Find a symbol in an array of name/value pairs and return the value. + + If numberok is 0, and the symbol was not found, v remains unchanged and the + function returns 0. + + If numberok is set and no label matched, the symbol is interpreted as a + string containing an integer. If the string is not an integer, v is set to 0 + and the function returns 0. + + If the symbol is found, or the integer could be read, v is set to the + value, and the function returns 1. + + \param[in] name find a symbol by this name, a leading "FL_" is ignored + \param[out] v value associated to the symbol, or the integer value + \param[in] numberok if set, the symbol can also be a text representing an + integer number + \return 0 if the symbol was not found and the integer was not valid + \return 1 otherwise and set v + */ int lookup_symbol(const char *name, int &v, int numberok) { - if (name[0]=='F' && name[1]=='L' && name[2]=='_') name += 3; - for (int i=0; i < int(sizeof(table)/sizeof(*table)); i++) - if (!fl_ascii_strcasecmp(name,table[i].name)) {v = table[i].value; return 1;} - if (numberok && ((v = atoi(name)) || !strcmp(name,"0"))) return 1; + if ((name[0]=='F') && (name[1]=='L') && (name[2]=='_')) + name += 3; + for (int i=0; i < int(sizeof(table)/sizeof(*table)); i++) { + if (!fl_ascii_strcasecmp(name,table[i].name)) { + v = table[i].value; + return 1; + } + } + if (numberok && ((v = atoi(name)) || !strcmp(name,"0"))) + return 1; return 0; } diff --git a/fluid/file.cxx b/fluid/file.cxx index 18d17efcc..f0d0baeae 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -227,7 +227,7 @@ void Fd_Project_Reader::read_children(Fl_Type *p, int paste, Strategy strategy, break; } - // Make sure that we don;t go through the list of options for child nodes + // Make sure that we don't go through the list of options for child nodes if (!skip_options) { // this is the first word in a .fd file: if (!strcmp(c,"Magic:")) { diff --git a/fluid/widget_browser.cxx b/fluid/widget_browser.cxx index 8354df0b9..c797ff94f 100644 --- a/fluid/widget_browser.cxx +++ b/fluid/widget_browser.cxx @@ -252,7 +252,7 @@ int Widget_Browser::item_height(void *l) const { \return height in FLTK units */ int Widget_Browser::incr_height() const { - return textsize()+2; + return textsize()+5; } /** |
