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
9b55dd18
Commit
9b55dd18
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
little hack to finish remote demonstrator (until we have proper
serialization of options)
parent
33f6455c
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Common/StringUtils.cpp
+11
-0
11 additions, 0 deletions
Common/StringUtils.cpp
Common/StringUtils.h
+1
-0
1 addition, 0 deletions
Common/StringUtils.h
Fltk/extraDialogs.cpp
+23
-17
23 additions, 17 deletions
Fltk/extraDialogs.cpp
Post/PViewDataRemote.h
+8
-1
8 additions, 1 deletion
Post/PViewDataRemote.h
with
43 additions
and
18 deletions
Common/StringUtils.cpp
+
11
−
0
View file @
9b55dd18
...
@@ -129,3 +129,14 @@ std::string ReplacePercentS(std::string in, std::string val)
...
@@ -129,3 +129,14 @@ std::string ReplacePercentS(std::string in, std::string val)
}
}
return
out
;
return
out
;
}
}
std
::
string
ConvertFileToString
(
std
::
string
fileName
)
{
FILE
*
fp
=
fopen
(
fileName
.
c_str
(),
"r"
);
if
(
!
fp
)
return
""
;
std
::
string
out
;
char
str
[
256
];
while
(
!
feof
(
fp
)
&&
fgets
(
str
,
sizeof
(
str
),
fp
))
out
+=
str
;
fclose
(
fp
);
return
out
;
}
This diff is collapsed.
Click to expand it.
Common/StringUtils.h
+
1
−
0
View file @
9b55dd18
...
@@ -18,5 +18,6 @@ std::string FixRelativePath(std::string reference, std::string in);
...
@@ -18,5 +18,6 @@ std::string FixRelativePath(std::string reference, std::string in);
std
::
vector
<
std
::
string
>
SplitFileName
(
std
::
string
fileName
);
std
::
vector
<
std
::
string
>
SplitFileName
(
std
::
string
fileName
);
std
::
vector
<
std
::
string
>
SplitWhiteSpace
(
std
::
string
in
,
unsigned
int
len
);
std
::
vector
<
std
::
string
>
SplitWhiteSpace
(
std
::
string
in
,
unsigned
int
len
);
std
::
string
ReplacePercentS
(
std
::
string
in
,
std
::
string
val
);
std
::
string
ReplacePercentS
(
std
::
string
in
,
std
::
string
val
);
std
::
string
ConvertFileToString
(
std
::
string
fileName
);
#endif
#endif
This diff is collapsed.
Click to expand it.
Fltk/extraDialogs.cpp
+
23
−
17
View file @
9b55dd18
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
// Stephen Guzik
// Stephen Guzik
//
//
#include
<stdio.h>
#include
<FL/Fl_Value_Slider.H>
#include
<FL/Fl_Value_Slider.H>
#include
<FL/Fl_Menu_Window.H>
#include
<FL/Fl_Menu_Window.H>
#include
<FL/Fl_Select_Browser.H>
#include
<FL/Fl_Select_Browser.H>
...
@@ -211,10 +212,8 @@ class ConnectionBrowser : public Fl_Hold_Browser {
...
@@ -211,10 +212,8 @@ class ConnectionBrowser : public Fl_Hold_Browser {
int
i
=
value
();
int
i
=
value
();
if
(
i
){
if
(
i
){
remove
(
i
);
remove
(
i
);
if
(
i
<=
size
())
if
(
i
<=
size
())
select
(
i
);
select
(
i
);
else
if
(
i
>
1
)
select
(
i
-
1
);
else
if
(
i
>
1
)
select
(
i
-
1
);
}
}
return
1
;
return
1
;
}
}
...
@@ -227,17 +226,12 @@ class ConnectionBrowser : public Fl_Hold_Browser {
...
@@ -227,17 +226,12 @@ class ConnectionBrowser : public Fl_Hold_Browser {
:
Fl_Hold_Browser
(
x
,
y
,
w
,
h
,
l
)
{}
:
Fl_Hold_Browser
(
x
,
y
,
w
,
h
,
l
)
{}
void
save
(
Fl_Preferences
&
prefs
)
void
save
(
Fl_Preferences
&
prefs
)
{
{
std
::
set
<
std
::
string
>
uniq
;
for
(
int
i
=
0
;
i
<
100
;
i
++
){
for
(
int
i
=
0
;
i
<
size
();
i
++
)
uniq
.
insert
(
text
(
i
+
1
));
char
name
[
256
];
char
name
[
256
];
int
j
=
0
;
for
(
std
::
set
<
std
::
string
>::
iterator
it
=
uniq
.
begin
();
it
!=
uniq
.
end
();
it
++
){
sprintf
(
name
,
"connection%02d"
,
j
++
);
prefs
.
set
(
name
,
it
->
c_str
());
}
for
(
int
i
=
j
;
i
<
100
;
i
++
){
sprintf
(
name
,
"connection%02d"
,
i
);
sprintf
(
name
,
"connection%02d"
,
i
);
if
(
prefs
.
entryExists
(
name
))
if
(
i
<
size
())
prefs
.
set
(
name
,
text
(
i
+
1
));
else
if
(
prefs
.
entryExists
(
name
))
prefs
.
deleteEntry
(
name
);
prefs
.
deleteEntry
(
name
);
}
}
}
}
...
@@ -288,7 +282,7 @@ std::string connectionChooser()
...
@@ -288,7 +282,7 @@ std::string connectionChooser()
int
old
=
chooser
->
browser
->
value
();
int
old
=
chooser
->
browser
->
value
();
chooser
->
browser
->
clear
();
chooser
->
browser
->
clear
();
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
char
name
[
256
],
value
[
1024
];
char
name
[
256
],
value
[
1024
];
sprintf
(
name
,
"connection%02d"
,
i
);
sprintf
(
name
,
"connection%02d"
,
i
);
if
(
prefs
.
entryExists
(
name
)){
if
(
prefs
.
entryExists
(
name
)){
...
@@ -301,7 +295,7 @@ std::string connectionChooser()
...
@@ -301,7 +295,7 @@ std::string connectionChooser()
if
(
old
>
0
&&
old
<=
n
)
if
(
old
>
0
&&
old
<=
n
)
chooser
->
input
->
value
(
chooser
->
browser
->
text
(
old
));
chooser
->
input
->
value
(
chooser
->
browser
->
text
(
old
));
else
else
chooser
->
input
->
value
(
chooser
->
browser
->
text
(
n
));
chooser
->
input
->
value
(
chooser
->
browser
->
text
(
1
));
}
}
else
else
chooser
->
input
->
value
(
"./gmsh ../tutorial/view3.pos"
);
chooser
->
input
->
value
(
"./gmsh ../tutorial/view3.pos"
);
...
@@ -314,7 +308,19 @@ std::string connectionChooser()
...
@@ -314,7 +308,19 @@ std::string connectionChooser()
Fl_Widget
*
o
=
Fl
::
readqueue
();
Fl_Widget
*
o
=
Fl
::
readqueue
();
if
(
!
o
)
break
;
if
(
!
o
)
break
;
if
(
o
==
chooser
->
ok
)
{
if
(
o
==
chooser
->
ok
)
{
chooser
->
browser
->
add
(
chooser
->
input
->
value
());
if
(
strlen
(
chooser
->
input
->
value
())){
// insert choosen value at the top of the history if it's not
// already present
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
chooser
->
browser
->
size
();
i
++
){
if
(
!
strcmp
(
chooser
->
input
->
value
(),
chooser
->
browser
->
text
(
i
+
1
))){
found
=
true
;
break
;
}
}
if
(
!
found
)
chooser
->
browser
->
insert
(
1
,
chooser
->
input
->
value
());
}
chooser
->
browser
->
save
(
prefs
);
chooser
->
browser
->
save
(
prefs
);
chooser
->
window
->
hide
();
chooser
->
window
->
hide
();
return
chooser
->
input
->
value
();
return
chooser
->
input
->
value
();
...
...
This diff is collapsed.
Click to expand it.
Post/PViewDataRemote.h
+
8
−
1
View file @
9b55dd18
...
@@ -13,6 +13,9 @@
...
@@ -13,6 +13,9 @@
#include
"GmshSocket.h"
#include
"GmshSocket.h"
#include
"PViewData.h"
#include
"PViewData.h"
#include
"SBoundingBox3d.h"
#include
"SBoundingBox3d.h"
#include
"Options.h"
#include
"StringUtils.h"
#include
"Context.h"
// The container for a remote dataset (does not contain any actual
// The container for a remote dataset (does not contain any actual
// data!)
// data!)
...
@@ -64,7 +67,11 @@ class PViewDataRemote : public PViewData {
...
@@ -64,7 +67,11 @@ class PViewDataRemote : public PViewData {
return
1
;
return
1
;
}
}
setDirty
(
true
);
setDirty
(
true
);
// server->SendString(GmshSocket::GMSH_PARSER_STRING, options);
std
::
string
fileName
=
CTX
::
instance
()
->
homeDir
+
CTX
::
instance
()
->
tmpFileName
;
// FIXME: until we rewrite the option code and allow nice serialization ;-)
PrintOptions
(
0
,
GMSH_FULLRC
,
1
,
0
,
fileName
.
c_str
());
std
::
string
options
=
ConvertFileToString
(
fileName
);
server
->
SendString
(
GmshSocket
::
GMSH_PARSE_STRING
,
options
.
c_str
());
server
->
SendString
(
GmshSocket
::
GMSH_VERTEX_ARRAY
,
"Send the vertex arrays!"
);
server
->
SendString
(
GmshSocket
::
GMSH_VERTEX_ARRAY
,
"Send the vertex arrays!"
);
return
1
;
return
1
;
}
}
...
...
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