Commit 21c9b863 by Christophe Geuzaine

fix for mac finder

parent 843bbd1b
Pipeline #958 passed with stage
in 35 minutes 40 seconds
......@@ -370,8 +370,11 @@ int GmshFLTK(int argc, char **argv)
// display GUI immediately for quick launch time
FlGui::instance()->check();
// open project file and merge all other input files
if(FlGui::getOpenedThroughMacFinder().empty()){
if(FlGui::getOpenedThroughMacFinder().size() &&
CTX::instance()->files.empty()){
OpenProject(FlGui::getOpenedThroughMacFinder());
}
else{
OpenProject(GModel::current()->getFileName());
bool open = false;
for(unsigned int i = 0; i < CTX::instance()->files.size(); i++){
......@@ -390,9 +393,8 @@ int GmshFLTK(int argc, char **argv)
MergeFile(CTX::instance()->files[i]);
}
}
else{
OpenProject(FlGui::getOpenedThroughMacFinder());
}
FlGui::instance()->setFinishedProcessingCommandLine();
if(CTX::instance()->post.combineTime){
PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig);
......
......@@ -752,11 +752,11 @@ void OpenProject(const std::string &fileName)
void OpenProjectMacFinder(const char *fileName)
{
#if defined(HAVE_FLTK)
if(!FlGui::available()){
if(!FlGui::available() || !FlGui::getFinishedProcessingCommandLine()){
// Gmsh is not ready: will open the file later
FlGui::setOpenedThroughMacFinder(fileName);
}
else if(FlGui::available()){
else{
// Gmsh is running
OpenProject(fileName);
drawContext::global()->draw();
......
......@@ -99,6 +99,16 @@ std::string FlGui::getOpenedThroughMacFinder()
return _openedThroughMacFinder;
}
void FlGui::setFinishedProcessingCommandLine()
{
_finishedProcessingCommandLine = true;
}
bool FlGui::getFinishedProcessingCommandLine()
{
return _finishedProcessingCommandLine;
}
static int globalShortcut(int event)
{
if(!FlGui::available()) return 0;
......@@ -503,10 +513,11 @@ FlGui::FlGui(int argc, char **argv)
FlGui *FlGui::_instance = 0;
std::string FlGui::_openedThroughMacFinder = "";
bool FlGui::_finishedProcessingCommandLine = false;
bool FlGui::available()
{
return (_instance != 0);
return (_instance != 0) && _finishedProcessingCommandLine;
}
FlGui *FlGui::instance(int argc, char **argv)
......
......@@ -49,6 +49,7 @@ class FlGui{
private:
static FlGui *_instance;
static std::string _openedThroughMacFinder;
static bool _finishedProcessingCommandLine;
std::string _lastStatus;
public:
std::vector<GVertex*> selectedVertices;
......@@ -97,6 +98,8 @@ class FlGui{
// is a file opened through the Mac Finder?
static void setOpenedThroughMacFinder(const std::string &name);
static std::string getOpenedThroughMacFinder();
static void setFinishedProcessingCommandLine();
static bool getFinishedProcessingCommandLine();
// test application-level keyboard shortcuts
int testGlobalShortcuts(int event);
// test the arrow shortcuts (not in the application-level shortcuts)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment