Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
e404a98f
Commit
e404a98f
authored
9 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
91dbd38f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Fltk/onelabGroup.cpp
+126
-0
126 additions, 0 deletions
Fltk/onelabGroup.cpp
Fltk/onelabGroup.h
+1
-0
1 addition, 0 deletions
Fltk/onelabGroup.h
with
127 additions
and
0 deletions
Fltk/onelabGroup.cpp
+
126
−
0
View file @
e404a98f
...
@@ -555,6 +555,12 @@ void onelabGroup::_addParameter(T &p)
...
@@ -555,6 +555,12 @@ void onelabGroup::_addParameter(T &p)
_tree
->
end
();
_tree
->
end
();
}
}
template
<
class
T
>
void
onelabGroup
::
_updateParameter
(
T
&
p
,
Fl_Tree_Item
*
n
)
{
printf
(
"updating parameter %s
\n
"
,
p
.
getName
().
c_str
());
}
void
onelabGroup
::
_addMenu
(
const
std
::
string
&
path
,
Fl_Callback
*
callback
,
void
*
data
)
void
onelabGroup
::
_addMenu
(
const
std
::
string
&
path
,
Fl_Callback
*
callback
,
void
*
data
)
{
{
Fl_Tree_Item
*
n
=
_tree
->
add
(
path
.
c_str
());
Fl_Tree_Item
*
n
=
_tree
->
add
(
path
.
c_str
());
...
@@ -1092,6 +1098,124 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::function &p, int ww, int hh,
...
@@ -1092,6 +1098,124 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::function &p, int ww, int hh,
}
}
}
}
// XXXXXXXXXXXXXXXXXXXXX
//#define NEW_CODE
#ifdef NEW_CODE
void
onelabGroup
::
rebuildTree
(
bool
fullRebuild
)
{
// Current version (until we have a message to explicitly remove/add a
// parameter):
// loop over all parameters in the tree and put all the names in a std::set<>
//
// loop over all (visible) parameters in the database and check if they exist
// in the std::set<>
//
// - if they are not the the set<>, add a new param in the tree ! add it at
// the right location
// - if they are in the set<> call updateParameterInTree
// - otherwise, remove the name from the set<>
//
// loop over all names remaining in the set<> and remove the corresponding
// parameters from the tree
// updateParameterInTree()
// - check if the value, any attributes, readOnly, etc. changed
// - if yes, modifiy accordingly
// - if not, do nothing
FL_NORMAL_SIZE
-=
CTX
::
instance
()
->
deltaFontSize
;
std
::
set
<
std
::
string
>
closed
=
_getClosedGmshMenus
();
_computeWidths
();
if
(
CTX
::
instance
()
->
guiColorScheme
){
_tree
->
openicon
(
&
open_pixmap_dark
);
_tree
->
closeicon
(
&
close_pixmap_dark
);
}
else
{
_tree
->
openicon
(
&
open_pixmap_light
);
_tree
->
closeicon
(
&
close_pixmap_light
);
}
_tree
->
sortorder
(
FL_TREE_SORT_ASCENDING
);
_tree
->
selectmode
(
FL_TREE_SELECT_NONE
);
static
bool
first
=
true
;
if
(
fullRebuild
){
printf
(
"tree full rebuild
\n
"
);
_tree
->
clear
();
first
=
true
;
}
else
{
printf
(
"tree update
\n
"
);
}
std
::
map
<
std
::
string
,
Fl_Tree_Item
*>
existing
;
for
(
Fl_Tree_Item
*
n
=
_tree
->
first
();
n
;
n
=
n
->
next
()){
existing
[
getPath
(
n
)]
=
n
;
}
if
(
first
){
//_addGmshMenus();
}
std
::
vector
<
onelab
::
number
>
numbers
;
onelab
::
server
::
instance
()
->
get
(
numbers
);
for
(
unsigned
int
i
=
0
;
i
<
numbers
.
size
();
i
++
){
if
(
!
numbers
[
i
].
getVisible
()
&&
!
CTX
::
instance
()
->
solver
.
showInvisibleParameters
)
continue
;
if
(
!
existing
.
count
(
numbers
[
i
].
getName
()))
_addParameter
(
numbers
[
i
]);
else
_updateParameter
(
numbers
[
i
],
existing
[
numbers
[
i
].
getName
()]);
}
/*
std::vector<onelab::string> strings;
onelab::server::instance()->get(strings);
for(unsigned int i = 0; i < strings.size(); i++){
if(!strings[i].getVisible() && !CTX::instance()->solver.showInvisibleParameters)
continue;
if(strings[i].getAttribute("Closed") == "1")
closed.insert(strings[i].getPath());
_addParameter(strings[i]);
}
std::vector<onelab::region> regions;
onelab::server::instance()->get(regions);
for(unsigned int i = 0; i < regions.size(); i++){
if(!regions[i].getVisible() && !CTX::instance()->solver.showInvisibleParameters)
continue;
if(regions[i].getAttribute("Closed") == "1")
closed.insert(regions[i].getPath());
_addParameter(regions[i]);
}
std::vector<onelab::function> functions;
onelab::server::instance()->get(functions);
for(unsigned int i = 0; i < functions.size(); i++){
if(!functions[i].getVisible() && !CTX::instance()->solver.showInvisibleParameters)
continue;
if(functions[i].getAttribute("Closed") == "1")
closed.insert(functions[i].getPath());
_addParameter(functions[i]);
}
*/
for
(
std
::
set
<
std
::
string
>::
iterator
it
=
closed
.
begin
();
it
!=
closed
.
end
();
it
++
){
if
(
it
->
size
())
_tree
->
close
(
it
->
c_str
(),
0
);
}
_tree
->
redraw
();
FL_NORMAL_SIZE
+=
CTX
::
instance
()
->
deltaFontSize
;
FlGui
::
check
();
// necessary e.g. on windows to avoid "ghosting"
}
#else
void
onelabGroup
::
rebuildTree
(
bool
deleteWidgets
)
void
onelabGroup
::
rebuildTree
(
bool
deleteWidgets
)
{
{
FL_NORMAL_SIZE
-=
CTX
::
instance
()
->
deltaFontSize
;
FL_NORMAL_SIZE
-=
CTX
::
instance
()
->
deltaFontSize
;
...
@@ -1229,6 +1353,8 @@ void onelabGroup::rebuildTree(bool deleteWidgets)
...
@@ -1229,6 +1353,8 @@ void onelabGroup::rebuildTree(bool deleteWidgets)
}
}
}
}
#endif
void
onelabGroup
::
openTreeItem
(
const
std
::
string
&
name
)
void
onelabGroup
::
openTreeItem
(
const
std
::
string
&
name
)
{
{
Fl_Tree_Item
*
n
=
_tree
->
find_item
(
name
.
c_str
());
Fl_Tree_Item
*
n
=
_tree
->
find_item
(
name
.
c_str
());
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabGroup.h
+
1
−
0
View file @
e404a98f
...
@@ -32,6 +32,7 @@ class onelabGroup : public Fl_Group{
...
@@ -32,6 +32,7 @@ class onelabGroup : public Fl_Group{
bool
_enableTreeWidgetResize
;
bool
_enableTreeWidgetResize
;
void
_computeWidths
();
void
_computeWidths
();
template
<
class
T
>
void
_addParameter
(
T
&
p
);
template
<
class
T
>
void
_addParameter
(
T
&
p
);
template
<
class
T
>
void
_updateParameter
(
T
&
p
,
Fl_Tree_Item
*
n
);
Fl_Widget
*
_addParameterWidget
(
onelab
::
number
&
p
,
int
ww
,
int
hh
,
Fl_Widget
*
_addParameterWidget
(
onelab
::
number
&
p
,
int
ww
,
int
hh
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
);
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
);
Fl_Widget
*
_addParameterWidget
(
onelab
::
string
&
p
,
int
ww
,
int
hh
,
Fl_Widget
*
_addParameterWidget
(
onelab
::
string
&
p
,
int
ww
,
int
hh
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment