From e34b7a51b12d2b2b31007be7c2fbd630c1478666 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Sat, 15 Oct 2011 15:09:30 +0000 Subject: [PATCH] onelab --- Common/onelab.h | 7 +++---- Fltk/graphicWindow.cpp | 16 +++++++++------- Fltk/onelabWindow.cpp | 25 +++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/Common/onelab.h b/Common/onelab.h index f7ac2b4def..36f4a69115 100644 --- a/Common/onelab.h +++ b/Common/onelab.h @@ -38,10 +38,9 @@ namespace onelab{ // The base parameter class. class parameter{ private: - // the name of the parameter, including its "path" in the - // parameter hierarchy. The path separator '/' can be followed by - // a number to force ordering (hence a parameter name cannot start - // with a number). + // the name of the parameter, including its '/'-separated path in + // the parameter hierarchy. Parameters or subpaths can start with + // numbers to force their relative ordering. std::string _name; // optional help strings std::string _shortHelp, _help; diff --git a/Fltk/graphicWindow.cpp b/Fltk/graphicWindow.cpp index 79f648bd3b..9d417bd140 100644 --- a/Fltk/graphicWindow.cpp +++ b/Fltk/graphicWindow.cpp @@ -772,13 +772,15 @@ void graphicWindow::resizeMessages(int dh) void graphicWindow::showMessages() { - int height = _savedMessageHeight; - if(height < 10) height = 100; - int maxh = win->h() - bottom->h(); - if(height > maxh) height = maxh / 2; - resizeMessages(height - browser->h()); - if(browser->h()) - browser->bottomline(browser->size()); + if(!win->shown()) return; + if(browser->h() < 10){ + int height = _savedMessageHeight; + if(height < 1) height = 100; + int maxh = win->h() - bottom->h(); + if(height > maxh) height = maxh / 2; + resizeMessages(height - browser->h()); + } + browser->bottomline(browser->size()); } void graphicWindow::hideMessages() diff --git a/Fltk/onelabWindow.cpp b/Fltk/onelabWindow.cpp index 1deba9f52b..dcb35cc64c 100644 --- a/Fltk/onelabWindow.cpp +++ b/Fltk/onelabWindow.cpp @@ -340,16 +340,22 @@ onelabWindow::onelabWindow(int deltaFontSize) static std::string getShortName(const std::string &name) { + std::string s = name; + // remove path std::string::size_type last = name.find_last_of('/'); if(last != std::string::npos) - return name.substr(last + 1); - return name; + s = name.substr(last + 1); + // remove starting numbers + while(s.size() && s[0] >= '0' && s[0] <= '9') + s = s.substr(1); + return s; } void onelabWindow::rebuildTree() { _tree->clear(); _tree->sortorder(FL_TREE_SORT_ASCENDING); + _tree->selectmode(FL_TREE_SELECT_NONE); for(unsigned int i = 0; i < _treeWidgets.size(); i++) Fl::delete_widget(_treeWidgets[i]); _treeWidgets.clear(); @@ -358,6 +364,7 @@ void onelabWindow::rebuildTree() onelab::server::instance()->get(numbers); for(unsigned int i = 0; i < numbers.size(); i++){ Fl_Tree_Item *n = _tree->add(numbers[i].getName().c_str()); + n->labelsize(FL_NORMAL_SIZE + 2); std::string label = numbers[i].getShortHelp(); if(label.empty()) label = getShortName(numbers[i].getName()); _tree->begin(); @@ -393,6 +400,7 @@ void onelabWindow::rebuildTree() onelab::server::instance()->get(strings); for(unsigned int i = 0; i < strings.size(); i++){ Fl_Tree_Item *n = _tree->add(strings[i].getName().c_str()); + n->labelsize(FL_NORMAL_SIZE + 2); std::string label = strings[i].getShortHelp(); if(label.empty()) label = getShortName(strings[i].getName()); _tree->begin(); @@ -408,8 +416,21 @@ void onelabWindow::rebuildTree() n->widget(but); _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(); } #endif + -- GitLab