Skip to content
Snippets Groups Projects
Commit 0b918815 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Show label and help as tooltip; allow multi-line strings with Str[] syntax
parent 24b7d828
No related branches found
No related tags found
No related merge requests found
...@@ -1125,6 +1125,12 @@ void onelabGroup::_addParameter(T &p) ...@@ -1125,6 +1125,12 @@ void onelabGroup::_addParameter(T &p)
Fl_Widget *widget = _addParameterWidget(p, n, highlight, c); Fl_Widget *widget = _addParameterWidget(p, n, highlight, c);
_treeWidgets.push_back(widget); _treeWidgets.push_back(widget);
widget->copy_label(p.getShortName().c_str()); widget->copy_label(p.getShortName().c_str());
if(p.getLabel().size()){
std::string help = p.getLabel();
if(p.getHelp().size())
help += ":\n" + p.getHelp();
widget->copy_tooltip(help.c_str());
}
n->widget(widget); n->widget(widget);
_tree->end(); _tree->end();
} }
...@@ -1665,7 +1671,7 @@ void onelabGroup::rebuildTree(bool deleteWidgets) ...@@ -1665,7 +1671,7 @@ void onelabGroup::rebuildTree(bool deleteWidgets)
} }
for(std::set<std::string>::iterator it = closed.begin(); it != closed.end(); it++) for(std::set<std::string>::iterator it = closed.begin(); it != closed.end(); it++)
_tree->close(it->c_str(), 0); if(it->size()) _tree->close(it->c_str(), 0);
_tree->redraw(); _tree->redraw();
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -5031,12 +5031,22 @@ StringExpr : ...@@ -5031,12 +5031,22 @@ StringExpr :
Free($5); Free($5);
Free($7); Free($7);
} }
| tStr '[' RecursiveListOfStringExprVar ']'
| tStr '[' StringExprVar ']'
{ {
$$ = $3; int size = 0;
for(int i = 0; i < List_Nbr($3); i++)
size += strlen(*(char**)List_Pointer($3, i)) + 1;
$$ = (char*)Malloc(size * sizeof(char));
$$[0] = '\0';
for(int i = 0; i < List_Nbr($3); i++){
char *s;
List_Read($3, i, &s);
strcat($$, s);
Free(s);
if(i != List_Nbr($3) - 1) strcat($$, "\n");
}
List_Delete($3);
} }
| tSprintf '(' StringExprVar ')' | tSprintf '(' StringExprVar ')'
{ {
$$ = $3; $$ = $3;
......
...@@ -1080,26 +1080,27 @@ Character expressions are defined as: ...@@ -1080,26 +1080,27 @@ Character expressions are defined as:
StrPrefix ( @var{char-expression} ) | StrPrefix ( @var{char-expression} ) |
StrRelative ( @var{char-expression} ) | StrRelative ( @var{char-expression} ) |
StrCat ( @var{char-expression} , @var{char-expression} ) | StrCat ( @var{char-expression} , @var{char-expression} ) |
Str [ @var{char-expression} , @dots{} ] |
Sprintf ( @var{char-expression} , @var{expression-list} ) | Sprintf ( @var{char-expression} , @var{expression-list} ) |
Sprintf|Str ( @var{char-expression} ) | Sprintf ( @var{char-expression} ) |
Sprintf ( @var{char-option} ) | Sprintf ( @var{char-option} ) |
GetEnv ( @var{char-expression} ) | GetEnv ( @var{char-expression} ) |
GetString ( @var{char-expression} , @var{char-expression} ) | GetString ( @var{char-expression} , @var{char-expression} ) |
StrReplace ( @var{char-expression} , @var{char-expression} , @var{char-expression} ) StrReplace ( @var{char-expression} , @var{char-expression} , @var{char-expression} )
@end example @end example
@noindent The third and fourth cases in this definition permit to take the @noindent @code{StrPrefix} and @code{StrRelative} permit to take the
prefix (e.g. to remove the extension) or the relative path of a prefix (e.g. to remove the extension) or the relative path of a file
string. The fifth case permits to concatenate two character expressions, name. @code{StrCat} and @code{Str} permit to concatenate character
and the sixth and seventh are equivalent to the @code{sprintf} C expressions (@code{Str} adds a newline character after each string
except the last). @code{Sprintf} is equivalent to the @code{sprintf} C
function (where @var{char-expression} is a format string that can function (where @var{char-expression} is a format string that can
contain floating point formatting characters: @code{%e}, @code{%g}, contain floating point formatting characters: @code{%e}, @code{%g},
etc.). The eigth case permits to use the value of a @var{char-option} as etc.) The various @w{@var{char-option}s} are listed in
a @var{char-expression}. The ninth case gets the value of an environment @ref{Options}. @code{GetEnvThe} gets the value of an environment
variable from the operating system. The last case in the definition variable from the operating system. @code{GetString} allows to ask the
allows to ask the user for a value interactively. The various user for a value interactively. @code{StrReplace}'s arguments are: input
@w{@var{char-option}s} are listed in @ref{Options}. @code{StrReplace}'s string, old substring, new substring.
arguments are: input string, old substring, new substring.
Character expressions are mostly used to specify non-numeric options and Character expressions are mostly used to specify non-numeric options and
input/output file names. See @ref{t8.geo}, for an interesting usage of input/output file names. See @ref{t8.geo}, for an interesting usage of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment