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
9d8c1214
Commit
9d8c1214
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
better getAnswer on cl
parent
b993cd38
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Common/CreateFile.cpp
+10
-10
10 additions, 10 deletions
Common/CreateFile.cpp
Common/GmshMessage.cpp
+13
-19
13 additions, 19 deletions
Common/GmshMessage.cpp
Common/OpenFile.cpp
+14
-15
14 additions, 15 deletions
Common/OpenFile.cpp
with
37 additions
and
44 deletions
Common/CreateFile.cpp
+
10
−
10
View file @
9d8c1214
...
...
@@ -147,18 +147,18 @@ static PixelBuffer *GetCompositePixelBuffer(GLenum format, GLenum type)
void
CreateOutputFile
(
std
::
string
fileName
,
int
format
)
{
if
(
fileName
.
empty
())
fileName
=
GetDefaultFileName
(
format
);
int
old
f
ormat
=
CTX
::
instance
()
->
print
.
format
;
int
old
F
ormat
=
CTX
::
instance
()
->
print
.
format
;
CTX
::
instance
()
->
print
.
format
=
format
;
CTX
::
instance
()
->
printing
=
1
;
bool
printEndMessage
=
true
;
if
(
format
!=
FORMAT_AUTO
)
Msg
::
StatusBar
(
2
,
true
,
"Writing '%s'"
,
fileName
.
c_str
());
bool
printEndMessage
=
true
;
switch
(
format
)
{
case
FORMAT_AUTO
:
...
...
@@ -254,14 +254,14 @@ void CreateOutputFile(std::string fileName, int format)
case
FORMAT_GEO
:
GModel
::
current
()
->
writeGEO
(
fileName
,
CTX
::
instance
()
->
print
.
geoLabels
);
break
;
#if defined(HAVE_OCC)
case
FORMAT_BREP
:
GModel
::
current
()
->
writeOCCBREP
(
fileName
);
break
;
case
FORMAT_STEP
:
GModel
::
current
()
->
writeOCCSTEP
(
fileName
);
break
;
#endif
#if defined(HAVE_FLTK)
case
FORMAT_PPM
:
...
...
@@ -278,13 +278,13 @@ void CreateOutputFile(std::string fileName, int format)
break
;
}
int
old
_g
radient
=
CTX
::
instance
()
->
bgGradient
;
int
old
G
radient
=
CTX
::
instance
()
->
bgGradient
;
if
(
format
==
FORMAT_GIF
&&
CTX
::
instance
()
->
print
.
gifTransparent
)
CTX
::
instance
()
->
bgGradient
=
0
;
PixelBuffer
*
buffer
=
GetCompositePixelBuffer
(
GL_RGB
,
GL_UNSIGNED_BYTE
);
CTX
::
instance
()
->
bgGradient
=
old
_g
radient
;
CTX
::
instance
()
->
bgGradient
=
old
G
radient
;
if
(
format
==
FORMAT_PPM
)
create_ppm
(
fp
,
buffer
);
...
...
@@ -327,7 +327,7 @@ void CreateOutputFile(std::string fileName, int format)
GLint
height
=
FlGui
::
instance
()
->
getCurrentOpenglWindow
()
->
h
();
GLint
viewport
[
4
]
=
{
0
,
0
,
width
,
height
};
int
old
_g
radient
=
CTX
::
instance
()
->
bgGradient
;
int
old
G
radient
=
CTX
::
instance
()
->
bgGradient
;
if
(
!
CTX
::
instance
()
->
print
.
epsBackground
)
CTX
::
instance
()
->
bgGradient
=
0
;
PixelBuffer
buffer
(
width
,
height
,
GL_RGB
,
GL_FLOAT
);
...
...
@@ -382,7 +382,7 @@ void CreateOutputFile(std::string fileName, int format)
res
=
gl2psEndPage
();
}
CTX
::
instance
()
->
bgGradient
=
old
_g
radient
;
CTX
::
instance
()
->
bgGradient
=
old
G
radient
;
fclose
(
fp
);
}
break
;
...
...
@@ -427,7 +427,7 @@ void CreateOutputFile(std::string fileName, int format)
if
(
printEndMessage
)
Msg
::
StatusBar
(
2
,
true
,
"Wrote '%s'"
,
fileName
.
c_str
());
CTX
::
instance
()
->
print
.
format
=
old
f
ormat
;
CTX
::
instance
()
->
print
.
format
=
old
F
ormat
;
CTX
::
instance
()
->
printing
=
0
;
#if defined(HAVE_OPENGL)
...
...
This diff is collapsed.
Click to expand it.
Common/GmshMessage.cpp
+
13
−
19
View file @
9d8c1214
...
...
@@ -500,7 +500,7 @@ double Msg::GetValue(const char *text, double defaultval)
}
#endif
printf
(
"%s (default=%.16g) "
,
text
,
defaultval
);
printf
(
"%s (default=%.16g)
:
"
,
text
,
defaultval
);
char
str
[
256
];
char
*
ret
=
fgets
(
str
,
sizeof
(
str
),
stdin
);
if
(
!
ret
||
!
strlen
(
str
)
||
!
strcmp
(
str
,
"
\n
"
))
...
...
@@ -521,24 +521,18 @@ int Msg::GetAnswer(const char *question, int defaultval, const char *zero,
return
fl_choice
(
question
,
zero
,
one
,
two
,
""
);
#endif
while
(
1
){
if
(
two
)
printf
(
"%s
\n\n
[%s]
,
[%s]
or
[%s]
?
(default=%
s)
"
,
question
,
zero
,
one
,
two
,
(
defaultval
==
2
)
?
two
:
defaultval
?
one
:
zero
);
printf
(
"%s
\n\n
0=
[%s]
1=
[%s]
2=
[%s] (default=%
d):
"
,
question
,
zero
,
one
,
two
,
defaultval
);
else
printf
(
"%s
\n\n
[%s]
or
[%s]
?
(default=%
s)
"
,
question
,
zero
,
one
,
defaultval
?
one
:
zero
);
printf
(
"%s
\n\n
0=
[%s]
1=
[%s] (default=%
d):
"
,
question
,
zero
,
one
,
defaultval
);
char
str
[
256
];
char
*
ret
=
fgets
(
str
,
sizeof
(
str
),
stdin
);
if
(
!
ret
||
!
strlen
(
str
)
||
!
strcmp
(
str
,
"
\n
"
))
return
defaultval
;
else
if
(
!
strcmp
(
str
,
zero
))
return
0
;
else
if
(
!
strcmp
(
str
,
one
))
return
1
;
else
if
(
two
&&
!
strcmp
(
str
,
two
))
return
2
;
}
else
return
atoi
(
ret
);
}
void
Msg
::
InitClient
(
std
::
string
sockname
)
...
...
This diff is collapsed.
Click to expand it.
Common/OpenFile.cpp
+
14
−
15
View file @
9d8c1214
...
...
@@ -3,6 +3,7 @@
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#include
<sstream>
#include
<string.h>
#include
"GmshConfig.h"
#include
"GmshMessage.h"
...
...
@@ -246,13 +247,13 @@ int MergeFile(std::string fileName, bool warnIfMissing)
std
::
vector
<
std
::
string
>
split
=
SplitFileName
(
fileName
);
std
::
string
noExt
=
split
[
0
]
+
split
[
1
],
ext
=
split
[
2
];
#if defined(HAVE_FLTK)
if
(
FlGui
::
available
())
{
if
(
ext
==
".gz"
)
{
// the real solution would be to rewrite all our I/O functions in
// terms of gzFile, but until then, this is better than nothing
if
(
fl_choice
(
"File '%s' is in gzip format.
\n\n
Do you want to uncompress it?"
,
"Cancel"
,
"Uncompress"
,
NULL
,
fileName
.
c_str
())){
std
::
ostringstream
sstream
;
sstream
<<
"File '"
<<
fileName
<<
"' is in gzip format.
\n\n
"
<<
"Do you want to uncompress it?"
;
if
(
Msg
::
GetAnswer
(
sstream
.
str
().
c_str
(),
0
,
"Cancel"
,
"Uncompress"
)){
if
(
SystemCall
(
std
::
string
(
"gunzip -c "
)
+
fileName
+
" > "
+
noExt
))
Msg
::
Error
(
"Failed to uncompress `%s': check directory permissions"
,
fileName
.
c_str
());
...
...
@@ -260,8 +261,6 @@ int MergeFile(std::string fileName, bool warnIfMissing)
return
MergeFile
(
noExt
);
}
}
}
#endif
CTX
::
instance
()
->
geom
.
draw
=
0
;
// don't try to draw the model while reading
...
...
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