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
8dfe776c
Commit
8dfe776c
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
refactoring
parent
e1c6e43b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Fltk/onelabWindow.cpp
+94
-139
94 additions, 139 deletions
Fltk/onelabWindow.cpp
Fltk/onelabWindow.h
+9
-4
9 additions, 4 deletions
Fltk/onelabWindow.h
with
103 additions
and
143 deletions
Fltk/onelabWindow.cpp
+
94
−
139
View file @
8dfe776c
...
...
@@ -206,9 +206,9 @@ bool onelab::localNetworkClient::run()
std
::
string
computeCommand
=
(
ps
.
empty
()
?
""
:
ps
[
0
].
getValue
());
if
(
modelName
.
size
())
command
.
append
(
"
\"
"
+
modelName
+
"
\"
"
);
if
(
action
==
"check"
)
command
.
append
(
" "
+
checkCommand
)
;
command
.
append
(
" "
+
checkCommand
)
;
else
if
(
action
==
"compute"
)
command
.
append
(
" "
+
computeCommand
);
command
.
append
(
" "
+
computeCommand
);
}
command
.
append
(
" "
+
getSocketSwitch
()
+
"
\"
"
+
getName
()
+
"
\"
%s"
);
}
...
...
@@ -1062,30 +1062,39 @@ static bool getFlColor(const std::string &str, Fl_Color &c)
return
false
;
}
void
onelabWindow
::
_addParameter
(
onelab
::
number
&
p
)
template
<
class
T
>
void
onelabWindow
::
_addParameter
(
T
&
p
)
{
std
::
string
label
=
p
.
getShortName
();
std
::
vector
<
double
>
choices
=
p
.
getChoices
();
bool
highlight
=
false
;
Fl_Color
c
;
if
(
getFlColor
(
p
.
getAttribute
(
"Highlight"
),
c
))
highlight
=
true
;
Fl_Tree_Item
*
n
=
_tree
->
add
(
p
.
getName
().
c_str
());
n
->
labelsize
(
FL_NORMAL_SIZE
+
5
);
_tree
->
begin
();
Fl_Widget
*
widget
;
Fl_Widget
*
widget
=
_addParameterWidget
(
p
,
n
,
highlight
,
c
);
_treeWidgets
.
push_back
(
widget
);
widget
->
copy_label
(
p
.
getShortName
().
c_str
());
n
->
widget
(
widget
);
_tree
->
end
();
}
Fl_Widget
*
onelabWindow
::
_addParameterWidget
(
onelab
::
number
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
)
{
// non-editable value
if
(
p
.
getReadOnly
()){
// non-editable value
Fl_Output
*
but
=
new
Fl_Output
(
1
,
1
,
_itemWidth
,
1
);
char
tmp
[
128
];
sprintf
(
tmp
,
"%g"
,
p
.
getValue
());
but
->
value
(
tmp
);
but
->
align
(
FL_ALIGN_RIGHT
);
if
(
highlight
)
but
->
color
(
c
);
widget
=
but
;
return
but
;
}
else
if
(
choices
.
size
()
&&
choices
.
size
()
==
p
.
getValueLabels
().
size
()){
// enumeration (display choices as value labels, not numbers)
// enumeration (display choices as value labels, not numbers)
if
(
p
.
getChoices
().
size
()
&&
p
.
getChoices
().
size
()
==
p
.
getValueLabels
().
size
()){
Fl_Choice
*
but
=
new
Fl_Choice
(
1
,
1
,
_itemWidth
,
1
);
std
::
vector
<
Fl_Menu_Item
>
menu
;
std
::
map
<
double
,
std
::
string
>
labels
(
p
.
getValueLabels
());
...
...
@@ -1099,167 +1108,113 @@ void onelabWindow::_addParameter(onelab::number &p)
Fl_Menu_Item
it
=
{
0
};
menu
.
push_back
(
it
);
but
->
copy
(
&
menu
[
0
]);
for
(
unsigned
int
i
=
0
;
i
<
c
hoices
.
size
();
i
++
){
if
(
p
.
getValue
()
==
c
hoices
[
i
]){
for
(
unsigned
int
i
=
0
;
i
<
p
.
getC
hoices
()
.
size
();
i
++
){
if
(
p
.
getValue
()
==
p
.
getC
hoices
()
[
i
]){
but
->
value
(
i
);
break
;
}
}
but
->
callback
(
onelab_choice_cb
,
(
void
*
)
n
);
but
->
align
(
FL_ALIGN_RIGHT
);
if
(
highlight
)
n
->
labelbgcolor
(
c
);
widget
=
but
;
return
but
;
}
else
if
(
choices
.
size
()
==
2
&&
choices
[
0
]
==
0
&&
choices
[
1
]
==
1
){
// check box (boolean choice)
// check box (boolean choice)
if
(
p
.
getChoices
().
size
()
==
2
&&
p
.
getChoices
()[
0
]
==
0
&&
p
.
getChoices
()[
1
]
==
1
){
Fl_Check_Button
*
but
=
new
Fl_Check_Button
(
1
,
1
,
_itemWidth
,
1
);
but
->
value
(
p
.
getValue
());
but
->
callback
(
onelab_check_button_cb
,
(
void
*
)
n
);
if
(
highlight
)
n
->
labelbgcolor
(
c
);
widget
=
but
;
}
else
{
// general number input
inputRange
*
but
=
new
inputRange
(
1
,
1
,
_itemWidth
,
1
,
onelab
::
parameter
::
maxNumber
());
but
->
value
(
p
.
getValue
());
but
->
minimum
(
p
.
getMin
());
but
->
maximum
(
p
.
getMax
());
but
->
step
(
p
.
getStep
());
but
->
choices
(
p
.
getChoices
());
but
->
loop
(
p
.
getAttribute
(
"Loop"
));
but
->
graph
(
p
.
getAttribute
(
"Graph"
));
but
->
callback
(
onelab_input_range_cb
,
(
void
*
)
n
);
but
->
when
(
FL_WHEN_RELEASE
|
FL_WHEN_ENTER_KEY
);
if
(
highlight
)
but
->
color
(
c
);
widget
=
but
;
}
_treeWidgets
.
push_back
(
widget
);
widget
->
copy_label
(
label
.
c_str
());
widget
->
align
(
FL_ALIGN_RIGHT
);
n
->
widget
(
widget
);
_tree
->
end
();
return
but
;
}
// general number input
inputRange
*
but
=
new
inputRange
(
1
,
1
,
_itemWidth
,
1
,
onelab
::
parameter
::
maxNumber
());
but
->
value
(
p
.
getValue
());
but
->
minimum
(
p
.
getMin
());
but
->
maximum
(
p
.
getMax
());
but
->
step
(
p
.
getStep
());
but
->
choices
(
p
.
getChoices
());
but
->
loop
(
p
.
getAttribute
(
"Loop"
));
but
->
graph
(
p
.
getAttribute
(
"Graph"
));
but
->
callback
(
onelab_input_range_cb
,
(
void
*
)
n
);
but
->
when
(
FL_WHEN_RELEASE
|
FL_WHEN_ENTER_KEY
);
but
->
align
(
FL_ALIGN_RIGHT
);
if
(
highlight
)
but
->
color
(
c
);
return
but
;
}
void
onelabWindow
::
_addParameter
(
onelab
::
string
&
p
)
Fl_Widget
*
onelabWindow
::
_addParameterWidget
(
onelab
::
string
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
)
{
std
::
string
label
=
p
.
getShortName
();
std
::
vector
<
std
::
string
>
choices
=
p
.
getChoices
();
bool
highlight
=
false
;
Fl_Color
c
;
if
(
getFlColor
(
p
.
getAttribute
(
"Highlight"
),
c
))
highlight
=
true
;
Fl_Tree_Item
*
n
=
_tree
->
add
(
p
.
getName
().
c_str
());
n
->
labelsize
(
FL_NORMAL_SIZE
+
5
);
_tree
->
begin
();
Fl_Widget
*
widget
;
// non-editable value
if
(
p
.
getReadOnly
()){
// non-editable value
Fl_Output
*
but
=
new
Fl_Output
(
1
,
1
,
_itemWidth
,
1
);
but
->
value
(
p
.
getValue
().
c_str
());
but
->
align
(
FL_ALIGN_RIGHT
);
if
(
highlight
)
but
->
color
(
c
);
widget
=
but
;
return
but
;
}
// general string input
Fl_Input_Choice
*
but
=
new
Fl_Input_Choice
(
1
,
1
,
_itemWidth
,
1
);
std
::
vector
<
Fl_Menu_Item
>
menu
;
for
(
unsigned
int
j
=
0
;
j
<
p
.
getChoices
().
size
();
j
++
){
char
*
str
=
strdup
(
p
.
getChoices
()[
j
].
c_str
());
_treeStrings
.
push_back
(
str
);
bool
divider
=
(
p
.
getKind
()
==
"file"
&&
j
==
p
.
getChoices
().
size
()
-
1
);
Fl_Menu_Item
it
=
{
str
,
0
,
0
,
0
,
divider
?
FL_MENU_DIVIDER
:
0
};
menu
.
push_back
(
it
);
}
else
{
// general string input
Fl_Input_Choice
*
but
=
new
Fl_Input_Choice
(
1
,
1
,
_itemWidth
,
1
);
std
::
vector
<
Fl_Menu_Item
>
menu
;
for
(
unsigned
int
j
=
0
;
j
<
choices
.
size
();
j
++
){
char
*
str
=
strdup
(
choices
[
j
].
c_str
());
_treeStrings
.
push_back
(
str
);
bool
divider
=
(
p
.
getKind
()
==
"file"
&&
j
==
choices
.
size
()
-
1
);
Fl_Menu_Item
it
=
{
str
,
0
,
0
,
0
,
divider
?
FL_MENU_DIVIDER
:
0
};
menu
.
push_back
(
it
);
}
if
(
p
.
getKind
()
==
"file"
){
Fl_Menu_Item
it
=
{
"Choose..."
,
0
,
onelab_input_choice_file_chooser_cb
,
(
void
*
)
n
};
menu
.
push_back
(
it
);
Fl_Menu_Item
it2
=
{
"Edit..."
,
0
,
onelab_input_choice_file_edit_cb
,
(
void
*
)
n
};
menu
.
push_back
(
it2
);
if
(
GuessFileFormatFromFileName
(
p
.
getValue
())
>=
0
){
Fl_Menu_Item
it3
=
{
"Merge..."
,
0
,
onelab_input_choice_file_merge_cb
,
(
void
*
)
n
};
menu
.
push_back
(
it3
);
}
}
Fl_Menu_Item
it
=
{
0
};
if
(
p
.
getKind
()
==
"file"
){
Fl_Menu_Item
it
=
{
"Choose..."
,
0
,
onelab_input_choice_file_chooser_cb
,
(
void
*
)
n
};
menu
.
push_back
(
it
);
but
->
menubutton
()
->
copy
(
&
menu
[
0
])
;
but
->
value
(
p
.
getValue
().
c_str
()
);
but
->
callback
(
onelab_input_choice_cb
,
(
void
*
)
n
);
but
->
when
(
FL_WHEN_RELEASE
|
FL_WHEN_ENTER_KEY
)
;
if
(
highlight
)
but
->
input
()
->
color
(
c
);
widget
=
but
;
Fl_Menu_Item
it2
=
{
"Edit..."
,
0
,
onelab_input_choice_file_edit_cb
,
(
void
*
)
n
}
;
menu
.
push_back
(
it2
);
if
(
GuessFileFormatFromFileName
(
p
.
getValue
())
>=
0
){
Fl_Menu_Item
it3
=
{
"Merge..."
,
0
,
onelab_input_choice_file_merge_cb
,
(
void
*
)
n
}
;
menu
.
push_back
(
it3
);
}
}
_treeWidgets
.
push_back
(
widget
);
widget
->
copy_label
(
label
.
c_str
());
widget
->
align
(
FL_ALIGN_RIGHT
);
n
->
widget
(
widget
);
_tree
->
end
();
Fl_Menu_Item
it
=
{
0
};
menu
.
push_back
(
it
);
but
->
menubutton
()
->
copy
(
&
menu
[
0
]);
but
->
value
(
p
.
getValue
().
c_str
());
but
->
callback
(
onelab_input_choice_cb
,
(
void
*
)
n
);
but
->
when
(
FL_WHEN_RELEASE
|
FL_WHEN_ENTER_KEY
);
but
->
align
(
FL_ALIGN_RIGHT
);
if
(
highlight
)
but
->
input
()
->
color
(
c
);
return
but
;
}
void
onelabWindow
::
_addParameter
(
onelab
::
region
&
p
)
Fl_Widget
*
onelabWindow
::
_addParameterWidget
(
onelab
::
region
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
)
{
std
::
string
label
=
p
.
getShortName
();
std
::
vector
<
std
::
set
<
std
::
string
>
>
choices
=
p
.
getChoices
();
bool
highlight
=
false
;
Fl_Color
c
;
if
(
getFlColor
(
p
.
getAttribute
(
"Highlight"
),
c
))
highlight
=
true
;
Fl_Tree_Item
*
n
=
_tree
->
add
(
p
.
getName
().
c_str
());
n
->
labelsize
(
FL_NORMAL_SIZE
+
5
);
_tree
->
begin
();
Fl_Widget
*
widget
;
if
(
1
){
//p.getReadOnly()){
// non-editable value
// non-editable value
//if(p.getReadOnly()){
Fl_Output
*
but
=
new
Fl_Output
(
1
,
1
,
_itemWidth
,
1
);
but
->
value
(
"TODO groups"
);
but
->
align
(
FL_ALIGN_RIGHT
);
if
(
highlight
)
but
->
color
(
c
);
widget
=
but
;
}
else
{
// general group input
}
_treeWidgets
.
push_back
(
widget
);
widget
->
copy_label
(
label
.
c_str
());
widget
->
align
(
FL_ALIGN_RIGHT
);
n
->
widget
(
widget
);
_tree
->
end
();
return
but
;
//}
}
void
onelabWindow
::
_addParameter
(
onelab
::
function
&
p
)
Fl_Widget
*
onelabWindow
::
_addParameterWidget
(
onelab
::
function
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
)
{
std
::
string
label
=
p
.
getShortName
();
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>
>
choices
=
p
.
getChoices
();
bool
highlight
=
false
;
Fl_Color
c
;
if
(
getFlColor
(
p
.
getAttribute
(
"Highlight"
),
c
))
highlight
=
true
;
Fl_Tree_Item
*
n
=
_tree
->
add
(
p
.
getName
().
c_str
());
n
->
labelsize
(
FL_NORMAL_SIZE
+
5
);
_tree
->
begin
();
Fl_Widget
*
widget
;
if
(
1
){
//p.getReadOnly()){
// non-editable value
// non-editable value
//if(p.getReadOnly()){
Fl_Output
*
but
=
new
Fl_Output
(
1
,
1
,
_itemWidth
,
1
);
but
->
value
(
"TODO function"
);
but
->
align
(
FL_ALIGN_RIGHT
);
if
(
highlight
)
but
->
color
(
c
);
widget
=
but
;
}
else
{
// general function input
}
_treeWidgets
.
push_back
(
widget
);
widget
->
copy_label
(
label
.
c_str
());
widget
->
align
(
FL_ALIGN_RIGHT
);
n
->
widget
(
widget
);
_tree
->
end
();
return
but
;
//}
}
void
onelabWindow
::
rebuildTree
()
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabWindow.h
+
9
−
4
View file @
8dfe776c
...
...
@@ -30,10 +30,15 @@ class onelabWindow{
int
_deltaFontSize
;
bool
_stop
;
int
_itemWidth
;
void
_addParameter
(
onelab
::
number
&
p
);
void
_addParameter
(
onelab
::
string
&
p
);
void
_addParameter
(
onelab
::
region
&
p
);
void
_addParameter
(
onelab
::
function
&
p
);
template
<
class
T
>
void
_addParameter
(
T
&
p
);
Fl_Widget
*
_addParameterWidget
(
onelab
::
number
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
);
Fl_Widget
*
_addParameterWidget
(
onelab
::
string
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
);
Fl_Widget
*
_addParameterWidget
(
onelab
::
region
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
);
Fl_Widget
*
_addParameterWidget
(
onelab
::
function
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
);
public:
onelabWindow
(
int
deltaFontSize
=
0
);
int
x
(){
return
_win
->
x
();
}
...
...
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