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

onelab

parent 5fd0dc0a
No related branches found
No related tags found
No related merge requests found
...@@ -38,10 +38,9 @@ namespace onelab{ ...@@ -38,10 +38,9 @@ namespace onelab{
// The base parameter class. // The base parameter class.
class parameter{ class parameter{
private: private:
// the name of the parameter, including its "path" in the // the name of the parameter, including its '/'-separated path in
// parameter hierarchy. The path separator '/' can be followed by // the parameter hierarchy. Parameters or subpaths can start with
// a number to force ordering (hence a parameter name cannot start // numbers to force their relative ordering.
// with a number).
std::string _name; std::string _name;
// optional help strings // optional help strings
std::string _shortHelp, _help; std::string _shortHelp, _help;
......
...@@ -772,13 +772,15 @@ void graphicWindow::resizeMessages(int dh) ...@@ -772,13 +772,15 @@ void graphicWindow::resizeMessages(int dh)
void graphicWindow::showMessages() void graphicWindow::showMessages()
{ {
int height = _savedMessageHeight; if(!win->shown()) return;
if(height < 10) height = 100; if(browser->h() < 10){
int maxh = win->h() - bottom->h(); int height = _savedMessageHeight;
if(height > maxh) height = maxh / 2; if(height < 1) height = 100;
resizeMessages(height - browser->h()); int maxh = win->h() - bottom->h();
if(browser->h()) if(height > maxh) height = maxh / 2;
browser->bottomline(browser->size()); resizeMessages(height - browser->h());
}
browser->bottomline(browser->size());
} }
void graphicWindow::hideMessages() void graphicWindow::hideMessages()
......
...@@ -340,16 +340,22 @@ onelabWindow::onelabWindow(int deltaFontSize) ...@@ -340,16 +340,22 @@ onelabWindow::onelabWindow(int deltaFontSize)
static std::string getShortName(const std::string &name) static std::string getShortName(const std::string &name)
{ {
std::string s = name;
// remove path
std::string::size_type last = name.find_last_of('/'); std::string::size_type last = name.find_last_of('/');
if(last != std::string::npos) if(last != std::string::npos)
return name.substr(last + 1); s = name.substr(last + 1);
return name; // remove starting numbers
while(s.size() && s[0] >= '0' && s[0] <= '9')
s = s.substr(1);
return s;
} }
void onelabWindow::rebuildTree() void onelabWindow::rebuildTree()
{ {
_tree->clear(); _tree->clear();
_tree->sortorder(FL_TREE_SORT_ASCENDING); _tree->sortorder(FL_TREE_SORT_ASCENDING);
_tree->selectmode(FL_TREE_SELECT_NONE);
for(unsigned int i = 0; i < _treeWidgets.size(); i++) for(unsigned int i = 0; i < _treeWidgets.size(); i++)
Fl::delete_widget(_treeWidgets[i]); Fl::delete_widget(_treeWidgets[i]);
_treeWidgets.clear(); _treeWidgets.clear();
...@@ -358,6 +364,7 @@ void onelabWindow::rebuildTree() ...@@ -358,6 +364,7 @@ void onelabWindow::rebuildTree()
onelab::server::instance()->get(numbers); onelab::server::instance()->get(numbers);
for(unsigned int i = 0; i < numbers.size(); i++){ for(unsigned int i = 0; i < numbers.size(); i++){
Fl_Tree_Item *n = _tree->add(numbers[i].getName().c_str()); Fl_Tree_Item *n = _tree->add(numbers[i].getName().c_str());
n->labelsize(FL_NORMAL_SIZE + 2);
std::string label = numbers[i].getShortHelp(); std::string label = numbers[i].getShortHelp();
if(label.empty()) label = getShortName(numbers[i].getName()); if(label.empty()) label = getShortName(numbers[i].getName());
_tree->begin(); _tree->begin();
...@@ -393,6 +400,7 @@ void onelabWindow::rebuildTree() ...@@ -393,6 +400,7 @@ void onelabWindow::rebuildTree()
onelab::server::instance()->get(strings); onelab::server::instance()->get(strings);
for(unsigned int i = 0; i < strings.size(); i++){ for(unsigned int i = 0; i < strings.size(); i++){
Fl_Tree_Item *n = _tree->add(strings[i].getName().c_str()); Fl_Tree_Item *n = _tree->add(strings[i].getName().c_str());
n->labelsize(FL_NORMAL_SIZE + 2);
std::string label = strings[i].getShortHelp(); std::string label = strings[i].getShortHelp();
if(label.empty()) label = getShortName(strings[i].getName()); if(label.empty()) label = getShortName(strings[i].getName());
_tree->begin(); _tree->begin();
...@@ -408,8 +416,21 @@ void onelabWindow::rebuildTree() ...@@ -408,8 +416,21 @@ void onelabWindow::rebuildTree()
n->widget(but); n->widget(but);
_tree->end(); _tree->end();
} }
for(Fl_Tree_Item *n = _tree->first(); n; n = n->next()){
if(n->has_children()){
_tree->begin();
Fl_Box *but = new Fl_Box(1,1,IW,1);
but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
_treeWidgets.push_back(but);
but->copy_label(getShortName(n->label()).c_str());
n->widget(but);
_tree->end();
}
}
_tree->redraw(); _tree->redraw();
} }
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment