diff --git a/Common/Gmsh.cpp b/Common/Gmsh.cpp index 41a5d9a6cfb516521729ba9709b7916fffef58fc..fb440e1dc929ac2cccd190f2c718a8b698dd91ed 100644 --- a/Common/Gmsh.cpp +++ b/Common/Gmsh.cpp @@ -216,7 +216,7 @@ int GmshFLTK(int argc, char **argv) FlGui::instance()->check(); // open project file and merge all other input files - if(!FlGui::instance()->getOpenedThroughMacFinder()){ + if(FlGui::getOpenedThroughMacFinder().empty()){ OpenProject(GModel::current()->getFileName()); for(unsigned int i = 1; i < CTX::instance()->files.size(); i++){ if(CTX::instance()->files[i] == "-new"){ @@ -227,6 +227,10 @@ int GmshFLTK(int argc, char **argv) MergeFile(CTX::instance()->files[i]); } } + else{ + Msg::Info("AAAAAAAAAAAAAAAAAAAAA\n"); + OpenProject(FlGui::getOpenedThroughMacFinder()); + } if(CTX::instance()->post.combineTime){ PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig); diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp index 72098a2af4414f1f220d1965e3032b703b720b62..12420c090698a17b99fe911d1eeaea4311fa9ebe 100644 --- a/Common/OpenFile.cpp +++ b/Common/OpenFile.cpp @@ -634,8 +634,12 @@ void OpenProject(const std::string &fileName) void OpenProjectMacFinder(const char *fileName) { #if defined(HAVE_FLTK) - if(FlGui::available()){ - FlGui::instance()->setOpenedThroughMacFinder(true); + if(!FlGui::available()){ + // Gmsh is not ready: will open the file later + FlGui::setOpenedThroughMacFinder(fileName); + } + else if(FlGui::available()){ + // Gmsh is running OpenProject(fileName); drawContext::global()->draw(); } diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index 9495bf26b118d7c385ea9a9332a00f1504b2f0cb..5df833250437259fa9482422f6108776feb78c01 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -197,7 +197,7 @@ static int globalShortcut(int event) return FlGui::instance()->testGlobalShortcuts(event); } -FlGui::FlGui(int argc, char **argv) : _openedThroughMacFinder(false) +FlGui::FlGui(int argc, char **argv) { // set X display if(CTX::instance()->display.size()) @@ -306,6 +306,7 @@ FlGui::FlGui(int argc, char **argv) : _openedThroughMacFinder(false) } FlGui *FlGui::_instance = 0; +std::string FlGui::_openedThroughMacFinder = ""; FlGui *FlGui::instance(int argc, char **argv) { diff --git a/Fltk/FlGui.h b/Fltk/FlGui.h index d58b2135aec4d4f90711398f7e15cdbc255bdd9f..2edaf57891638504811f6e332cc8aab92c3b6b29 100644 --- a/Fltk/FlGui.h +++ b/Fltk/FlGui.h @@ -43,7 +43,7 @@ class MElement; class FlGui{ private: static FlGui *_instance; - bool _openedThroughMacFinder; + static std::string _openedThroughMacFinder; public: std::vector<GVertex*> selectedVertices; std::vector<GEdge*> selectedEdges; @@ -80,8 +80,11 @@ class FlGui{ // wait (at most time seconds) for any events, then process them static void wait(double time); // is a file opened through the Mac Finder? - void setOpenedThroughMacFinder(bool val){ _openedThroughMacFinder = val; } - bool getOpenedThroughMacFinder(){ return _openedThroughMacFinder; } + static void setOpenedThroughMacFinder(const std::string &name) + { + _openedThroughMacFinder = name; + } + static std::string getOpenedThroughMacFinder(){ return _openedThroughMacFinder; } // test application-level keyboard shortcuts int testGlobalShortcuts(int event); // test the arrow shortcuts (not in the application-level shortcuts) diff --git a/demos/indheat.geo b/demos/indheat.geo index 5e7c22fe4f7c2ab0aef01b80b48d3b498415356a..1c0bdc0d102a369c36913b2ef9d955506b3f3fbc 100644 --- a/demos/indheat.geo +++ b/demos/indheat.geo @@ -3,17 +3,17 @@ nn = 40; // mesh subdivisions per turn DefineConstant [ - turns = {5, Label "Number of coil turns"}, - r = {0.11, Label "Coil radius"}, - rc = {0.01, Label "Coil wire radius"}, - hc = {0.25, Label "Coil height"}, - ht = {0.4, Label "Tube height"}, - rt1 = {0.075, Label "Tube internal radius"}, - rt2 = {0.092, Label "Tube external radius"}, - lb = {1, Label "Infinite box width"}, - left = {1, Choices{0,1}, Label "Terminals on the left?"} + turns = {5, Label "Number of coil turns", Path "Parameters"}, + r = {0.11, Label "Coil radius", Path "Parameters"}, + rc = {0.01, Label "Coil wire radius", Path "Parameters"}, + hc = {0.25, Label "Coil height", Path "Parameters"}, + ht = {0.4, Label "Tube height", Path "Parameters"}, + rt1 = {0.075, Label "Tube internal radius", Path "Parameters"}, + rt2 = {0.092, Label "Tube external radius", Path "Parameters"}, + lb = {1, Label "Infinite box width", Path "Parameters"}, + left = {1, Choices{0,1}, Label "Terminals on the left?", Path "Parameters"} //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;