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
585f35ad
Commit
585f35ad
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
edit value range in separate window (the previous design was cute, but not practical...)
parent
52e35523
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Fltk/inputRange.h
+21
-32
21 additions, 32 deletions
Fltk/inputRange.h
with
21 additions
and
32 deletions
Fltk/inputRange.h
+
21
−
32
View file @
585f35ad
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include
<FL/Fl_Value_Input.H>
#include
<FL/Fl_Value_Input.H>
#include
<FL/Fl_Toggle_Button.H>
#include
<FL/Fl_Toggle_Button.H>
#include
<FL/Fl_Menu_Button.H>
#include
<FL/Fl_Menu_Button.H>
#include
<FL/fl_ask.H>
class
inputValue
:
public
Fl_Value_Input
class
inputValue
:
public
Fl_Value_Input
{
{
...
@@ -28,13 +29,13 @@ class inputValue : public Fl_Value_Input
...
@@ -28,13 +29,13 @@ class inputValue : public Fl_Value_Input
class
inputRange
:
public
Fl_Group
{
class
inputRange
:
public
Fl_Group
{
private:
private:
inputValue
*
_input
;
inputValue
*
_input
;
Fl_Input
*
_range
;
Fl_Toggle_Button
*
_loop_butt
;
Fl_Toggle_Button
*
_range_butt
,
*
_loop_butt
;
Fl_Button
*
_range_butt
,
*
_graph_butt
;
Fl_Button
*
_graph_butt
;
Fl_Menu_Button
*
_graph_menu
;
Fl_Menu_Button
*
_graph_menu
;
std
::
string
_loop_val
,
_graph_val
;
std
::
string
_loop_val
,
_graph_val
;
double
_min
,
_max
,
_step
,
_max_number
;
double
_min
,
_max
,
_step
,
_max_number
;
std
::
vector
<
double
>
_choices
;
std
::
vector
<
double
>
_choices
;
std
::
string
_range
,
_range_tooltip
;
bool
_do_callback_on_values
;
bool
_do_callback_on_values
;
double
_fixStep
(
double
step
)
double
_fixStep
(
double
step
)
{
{
...
@@ -76,11 +77,13 @@ class inputRange : public Fl_Group {
...
@@ -76,11 +77,13 @@ class inputRange : public Fl_Group {
_input
->
step
(
_fixStep
(
_step
));
_input
->
step
(
_fixStep
(
_step
));
_choices
.
clear
();
_choices
.
clear
();
}
}
_range
->
value
(
tmp
.
str
().
c_str
());
_range
=
tmp
.
str
();
_range_tooltip
=
std
::
string
(
"Range: "
)
+
_range
;
_range_butt
->
tooltip
(
_range_tooltip
.
c_str
());
}
}
void
_string2values
()
void
_string2values
()
{
{
std
::
string
str
(
_range
->
value
())
;
std
::
string
str
=
_range
;
if
(
str
.
find_first_of
(
','
)
!=
std
::
string
::
npos
){
if
(
str
.
find_first_of
(
','
)
!=
std
::
string
::
npos
){
// parse list of values
// parse list of values
std
::
string
::
size_type
first
=
0
;
std
::
string
::
size_type
first
=
0
;
...
@@ -134,17 +137,16 @@ class inputRange : public Fl_Group {
...
@@ -134,17 +137,16 @@ class inputRange : public Fl_Group {
_choices
.
clear
();
_choices
.
clear
();
}
}
}
}
void
_
show
_range
()
void
_
edit
_range
()
{
{
if
(
_range_butt
->
value
()){
const
char
*
ret
=
fl_input
(
"Edit range ([min:max], [min:max:step], or "
_input
->
size
(
_input
->
w
()
-
_range
->
w
(),
_input
->
h
());
"[val1, val2, ...]):"
,
_range
.
c_str
());
_input
->
redraw
();
if
(
ret
){
_range
->
show
();
_range
=
ret
;
}
_string2values
();
else
{
_values2string
();
_input
->
size
(
_input
->
w
()
+
_range
->
w
(),
_input
->
h
());
doCallbackOnValues
(
true
);
_input
->
redraw
();
do_callback
();
_range
->
hide
();
}
}
}
}
void
_set_loop_value
(
const
std
::
string
&
val
)
void
_set_loop_value
(
const
std
::
string
&
val
)
...
@@ -207,17 +209,10 @@ class inputRange : public Fl_Group {
...
@@ -207,17 +209,10 @@ class inputRange : public Fl_Group {
b
->
doCallbackOnValues
(
true
);
b
->
doCallbackOnValues
(
true
);
b
->
do_callback
();
b
->
do_callback
();
}
}
static
void
_range_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
inputRange
*
b
=
(
inputRange
*
)
data
;
b
->
_string2values
();
b
->
doCallbackOnValues
(
true
);
b
->
do_callback
();
}
static
void
_range_butt_cb
(
Fl_Widget
*
w
,
void
*
data
)
static
void
_range_butt_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
{
inputRange
*
b
=
(
inputRange
*
)
data
;
inputRange
*
b
=
(
inputRange
*
)
data
;
b
->
_
show
_range
();
b
->
_
edit
_range
();
}
}
static
void
_loop_butt_cb
(
Fl_Widget
*
w
,
void
*
data
)
static
void
_loop_butt_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
{
...
@@ -264,21 +259,15 @@ class inputRange : public Fl_Group {
...
@@ -264,21 +259,15 @@ class inputRange : public Fl_Group {
int
dot_w
=
FL_NORMAL_SIZE
-
2
,
loop_w
=
FL_NORMAL_SIZE
+
6
,
graph_w
=
loop_w
;
int
dot_w
=
FL_NORMAL_SIZE
-
2
,
loop_w
=
FL_NORMAL_SIZE
+
6
,
graph_w
=
loop_w
;
int
input_w
=
w
-
dot_w
-
loop_w
-
graph_w
;
int
input_w
=
w
-
dot_w
-
loop_w
-
graph_w
;
int
range_w
=
input_w
/
2
;
_input
=
new
inputValue
(
x
,
y
,
input_w
,
h
);
_input
=
new
inputValue
(
x
,
y
,
input_w
,
h
);
_input
->
callback
(
_input_cb
,
this
);
_input
->
callback
(
_input_cb
,
this
);
_input
->
when
(
FL_WHEN_ENTER_KEY
|
FL_WHEN_RELEASE
);
_input
->
when
(
FL_WHEN_ENTER_KEY
|
FL_WHEN_RELEASE
);
_range
=
new
Fl_Input
(
x
+
input_w
-
range_w
,
y
,
range_w
,
h
);
_range_butt
=
new
Fl_Button
(
x
+
input_w
,
y
,
dot_w
,
h
,
":"
);
_range
->
callback
(
_range_cb
,
this
);
_range
->
when
(
FL_WHEN_ENTER_KEY
|
FL_WHEN_RELEASE
);
_range
->
hide
();
if
(
readOnlyRange
)
_range
->
deactivate
();
_range_butt
=
new
Fl_Toggle_Button
(
x
+
input_w
,
y
,
dot_w
,
h
,
":"
);
_range_butt
->
callback
(
_range_butt_cb
,
this
);
_range_butt
->
callback
(
_range_butt_cb
,
this
);
_range_butt
->
tooltip
(
"Show range"
);
_range_butt
->
tooltip
(
"Edit range"
);
if
(
readOnlyRange
)
_range_butt
->
deactivate
();
_loop_butt
=
new
Fl_Toggle_Button
(
x
+
input_w
+
dot_w
,
y
,
loop_w
,
h
);
_loop_butt
=
new
Fl_Toggle_Button
(
x
+
input_w
+
dot_w
,
y
,
loop_w
,
h
);
_loop_butt
->
label
(
"@-1gmsh_rotate"
);
_loop_butt
->
label
(
"@-1gmsh_rotate"
);
...
...
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