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
f8bfa5d8
Commit
f8bfa5d8
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
new MultipleChoice attribute for strings
parent
0c8d5f91
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Common/GmshMessage.cpp
+4
-1
4 additions, 1 deletion
Common/GmshMessage.cpp
Fltk/onelabGroup.cpp
+34
-1
34 additions, 1 deletion
Fltk/onelabGroup.cpp
with
38 additions
and
2 deletions
Common/GmshMessage.cpp
+
4
−
1
View file @
f8bfa5d8
...
...
@@ -924,7 +924,7 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
std
::
vector
<
onelab
::
string
>
ps
;
_onelabClient
->
get
(
ps
,
name
);
bool
noChoices
=
true
,
noClosed
=
true
;
bool
noChoices
=
true
,
noClosed
=
true
,
noMultipleChoice
=
true
;
if
(
ps
.
size
()){
if
(
fopt
.
count
(
"ReadOnly"
)
&&
fopt
[
"ReadOnly"
][
0
])
ps
[
0
].
setValue
(
val
);
// use local value
...
...
@@ -933,6 +933,7 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
// keep track of these attributes, which can be changed server-side
if
(
ps
[
0
].
getChoices
().
size
())
noChoices
=
false
;
if
(
ps
[
0
].
getAttribute
(
"Closed"
).
size
())
noClosed
=
false
;
if
(
ps
[
0
].
getAttribute
(
"MultipleChoice"
).
size
())
noMultipleChoice
=
false
;
}
else
{
ps
.
resize
(
1
);
...
...
@@ -942,6 +943,8 @@ void Msg::ExchangeOnelabParameter(const std::string &key,
if
(
copt
.
count
(
"Kind"
))
ps
[
0
].
setKind
(
copt
[
"Kind"
][
0
]);
if
(
noChoices
&&
copt
.
count
(
"Choices"
))
ps
[
0
].
setChoices
(
copt
[
"Choices"
]);
if
(
noClosed
&&
copt
.
count
(
"Closed"
))
ps
[
0
].
setAttribute
(
"Closed"
,
copt
[
"Closed"
][
0
]);
if
(
noMultipleChoice
&&
copt
.
count
(
"MultipleChoice"
))
ps
[
0
].
setAttribute
(
"MultipleChoice"
,
copt
[
"MultipleChoice"
][
0
]);
_setStandardOptions
(
&
ps
[
0
],
fopt
,
copt
);
_onelabClient
->
set
(
ps
[
0
]);
#endif
...
...
This diff is collapsed.
Click to expand it.
Fltk/onelabGroup.cpp
+
34
−
1
View file @
f8bfa5d8
...
...
@@ -1140,6 +1140,17 @@ static void onelab_string_input_choice_cb(Fl_Widget *w, void *data)
Fl_Input_Choice
*
o
=
(
Fl_Input_Choice
*
)
w
;
onelab
::
string
old
=
strings
[
0
];
strings
[
0
].
setValue
(
o
->
value
());
std
::
string
choices
;
for
(
int
i
=
0
;
i
<
o
->
menubutton
()
->
menu
()
->
size
();
i
++
){
if
(
o
->
menubutton
()
->
menu
()[
i
].
flags
&
FL_MENU_TOGGLE
){
if
(
o
->
menubutton
()
->
menu
()[
i
].
flags
&
FL_MENU_VALUE
)
choices
+=
"1"
;
else
choices
+=
"0"
;
}
}
if
(
choices
.
size
())
strings
[
0
].
setAttribute
(
"MultipleChoice"
,
choices
);
onelab
::
server
::
instance
()
->
set
(
strings
[
0
]);
autoCheck
(
old
,
strings
[
0
]);
}
...
...
@@ -1170,6 +1181,22 @@ static void onelab_input_choice_file_merge_cb(Fl_Widget *w, void *data)
drawContext
::
global
()
->
draw
();
}
static
void
multiple_choice_menu_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
Fl_Menu_Button
*
menu
=
(
Fl_Menu_Button
*
)
w
;
std
::
string
val
;
for
(
int
i
=
0
;
i
<
menu
->
size
()
-
1
;
i
++
)
{
const
Fl_Menu_Item
&
item
=
menu
->
menu
()[
i
];
if
(
item
.
value
()
&&
item
.
label
()){
if
(
val
.
size
())
val
+=
", "
;
val
+=
item
.
label
();
}
}
Fl_Input_Choice
*
but
=
(
Fl_Input_Choice
*
)
data
;
but
->
value
(
val
.
c_str
());
but
->
do_callback
();
}
Fl_Widget
*
onelabGroup
::
_addParameterWidget
(
onelab
::
string
&
p
,
Fl_Tree_Item
*
n
,
bool
highlight
,
Fl_Color
c
)
{
...
...
@@ -1212,13 +1239,19 @@ Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, Fl_Tree_Item *n,
// general string input
Fl_Input_Choice
*
but
=
new
Fl_Input_Choice
(
1
,
1
,
ww
,
1
);
std
::
string
multipleChoice
=
p
.
getAttribute
(
"MultipleChoice"
);
if
(
multipleChoice
.
size
())
but
->
menubutton
()
->
callback
(
multiple_choice_menu_cb
,
but
);
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
};
int
choice
=
multipleChoice
.
size
()
?
FL_MENU_TOGGLE
:
0
;
if
(
multipleChoice
.
size
()
>
j
&&
multipleChoice
[
j
]
==
'1'
)
choice
|=
FL_MENU_VALUE
;
Fl_Menu_Item
it
=
{
str
,
0
,
0
,
0
,
divider
?
FL_MENU_DIVIDER
:
choice
};
menu
.
push_back
(
it
);
}
if
(
p
.
getKind
()
==
"file"
){
...
...
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