Skip to content
Snippets Groups Projects
Commit 62288077 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

trying to fix opening files through Mac finder

parent 983638db
No related branches found
No related tags found
No related merge requests found
...@@ -216,7 +216,7 @@ int GmshFLTK(int argc, char **argv) ...@@ -216,7 +216,7 @@ int GmshFLTK(int argc, char **argv)
FlGui::instance()->check(); FlGui::instance()->check();
// open project file and merge all other input files // open project file and merge all other input files
if(!FlGui::instance()->getOpenedThroughMacFinder()){ if(FlGui::getOpenedThroughMacFinder().empty()){
OpenProject(GModel::current()->getFileName()); OpenProject(GModel::current()->getFileName());
for(unsigned int i = 1; i < CTX::instance()->files.size(); i++){ for(unsigned int i = 1; i < CTX::instance()->files.size(); i++){
if(CTX::instance()->files[i] == "-new"){ if(CTX::instance()->files[i] == "-new"){
...@@ -227,6 +227,10 @@ int GmshFLTK(int argc, char **argv) ...@@ -227,6 +227,10 @@ int GmshFLTK(int argc, char **argv)
MergeFile(CTX::instance()->files[i]); MergeFile(CTX::instance()->files[i]);
} }
} }
else{
Msg::Info("AAAAAAAAAAAAAAAAAAAAA\n");
OpenProject(FlGui::getOpenedThroughMacFinder());
}
if(CTX::instance()->post.combineTime){ if(CTX::instance()->post.combineTime){
PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig);
......
...@@ -634,8 +634,12 @@ void OpenProject(const std::string &fileName) ...@@ -634,8 +634,12 @@ void OpenProject(const std::string &fileName)
void OpenProjectMacFinder(const char *fileName) void OpenProjectMacFinder(const char *fileName)
{ {
#if defined(HAVE_FLTK) #if defined(HAVE_FLTK)
if(FlGui::available()){ if(!FlGui::available()){
FlGui::instance()->setOpenedThroughMacFinder(true); // Gmsh is not ready: will open the file later
FlGui::setOpenedThroughMacFinder(fileName);
}
else if(FlGui::available()){
// Gmsh is running
OpenProject(fileName); OpenProject(fileName);
drawContext::global()->draw(); drawContext::global()->draw();
} }
......
...@@ -197,7 +197,7 @@ static int globalShortcut(int event) ...@@ -197,7 +197,7 @@ static int globalShortcut(int event)
return FlGui::instance()->testGlobalShortcuts(event); return FlGui::instance()->testGlobalShortcuts(event);
} }
FlGui::FlGui(int argc, char **argv) : _openedThroughMacFinder(false) FlGui::FlGui(int argc, char **argv)
{ {
// set X display // set X display
if(CTX::instance()->display.size()) if(CTX::instance()->display.size())
...@@ -306,6 +306,7 @@ FlGui::FlGui(int argc, char **argv) : _openedThroughMacFinder(false) ...@@ -306,6 +306,7 @@ FlGui::FlGui(int argc, char **argv) : _openedThroughMacFinder(false)
} }
FlGui *FlGui::_instance = 0; FlGui *FlGui::_instance = 0;
std::string FlGui::_openedThroughMacFinder = "";
FlGui *FlGui::instance(int argc, char **argv) FlGui *FlGui::instance(int argc, char **argv)
{ {
......
...@@ -43,7 +43,7 @@ class MElement; ...@@ -43,7 +43,7 @@ class MElement;
class FlGui{ class FlGui{
private: private:
static FlGui *_instance; static FlGui *_instance;
bool _openedThroughMacFinder; static std::string _openedThroughMacFinder;
public: public:
std::vector<GVertex*> selectedVertices; std::vector<GVertex*> selectedVertices;
std::vector<GEdge*> selectedEdges; std::vector<GEdge*> selectedEdges;
...@@ -80,8 +80,11 @@ class FlGui{ ...@@ -80,8 +80,11 @@ class FlGui{
// wait (at most time seconds) for any events, then process them // wait (at most time seconds) for any events, then process them
static void wait(double time); static void wait(double time);
// is a file opened through the Mac Finder? // is a file opened through the Mac Finder?
void setOpenedThroughMacFinder(bool val){ _openedThroughMacFinder = val; } static void setOpenedThroughMacFinder(const std::string &name)
bool getOpenedThroughMacFinder(){ return _openedThroughMacFinder; } {
_openedThroughMacFinder = name;
}
static std::string getOpenedThroughMacFinder(){ return _openedThroughMacFinder; }
// test application-level keyboard shortcuts // test application-level keyboard shortcuts
int testGlobalShortcuts(int event); int testGlobalShortcuts(int event);
// test the arrow shortcuts (not in the application-level shortcuts) // test the arrow shortcuts (not in the application-level shortcuts)
......
...@@ -3,17 +3,17 @@ nn = 40; // mesh subdivisions per turn ...@@ -3,17 +3,17 @@ nn = 40; // mesh subdivisions per turn
DefineConstant DefineConstant
[ [
turns = {5, Label "Number of coil turns"}, turns = {5, Label "Number of coil turns", Path "Parameters"},
r = {0.11, Label "Coil radius"}, r = {0.11, Label "Coil radius", Path "Parameters"},
rc = {0.01, Label "Coil wire radius"}, rc = {0.01, Label "Coil wire radius", Path "Parameters"},
hc = {0.25, Label "Coil height"}, hc = {0.25, Label "Coil height", Path "Parameters"},
ht = {0.4, Label "Tube height"}, ht = {0.4, Label "Tube height", Path "Parameters"},
rt1 = {0.075, Label "Tube internal radius"}, rt1 = {0.075, Label "Tube internal radius", Path "Parameters"},
rt2 = {0.092, Label "Tube external radius"}, rt2 = {0.092, Label "Tube external radius", Path "Parameters"},
lb = {1, Label "Infinite box width"}, lb = {1, Label "Infinite box width", Path "Parameters"},
left = {1, Choices{0,1}, Label "Terminals on the left?"} left = {1, Choices{0,1}, Label "Terminals on the left?", Path "Parameters"}
//macro = {"aa.pos", Label "Run my macro!", Kind "macro", Path "Actions"}, //macro = {"aa.pos", Label "Run my macro!", Kind "macro", Path "Actions"},
showLines = {1, Choices {0,1}, Label "Show lines?"} showLines = {1, Choices {0,1}, Label "Show lines?", Path "Options"}
]; ];
Geometry.Lines = showLines; Geometry.Lines = showLines;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment