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

better interaction with Mac Finder

parent 90edd656
Branches
Tags
No related merge requests found
......@@ -210,6 +210,7 @@ int GmshFLTK(int argc, char **argv)
FlGui::instance()->check();
// open project file and merge all other input files
if(!FlGui::instance()->getOpenedThroughMacFinder()){
OpenProject(GModel::current()->getFileName());
for(unsigned int i = 1; i < CTX::instance()->files.size(); i++){
if(CTX::instance()->files[i] == "-new"){
......@@ -219,6 +220,7 @@ int GmshFLTK(int argc, char **argv)
else
MergeFile(CTX::instance()->files[i]);
}
}
if(CTX::instance()->post.combineTime){
PView::combine(true, 2, CTX::instance()->post.combineRemoveOrig);
......
......@@ -504,14 +504,8 @@ void OpenProject(std::string fileName)
void OpenProjectMacFinder(const char *fileName)
{
#if defined(HAVE_FLTK)
static int first = 1;
if(first || !FlGui::available()){
// just copy the filename: it will be opened when the GUI is ready
// in main()
GModel::current()->setFileName(fileName);
first = 0;
}
else{
if(FlGui::available()){
FlGui::instance()->setOpenedThroughMacFinder(true);
OpenProject(fileName);
drawContext::global()->draw();
}
......
......@@ -174,7 +174,7 @@ static int globalShortcut(int event)
return FlGui::instance()->testGlobalShortcuts(event);
}
FlGui::FlGui(int argc, char **argv)
FlGui::FlGui(int argc, char **argv) : _openedThroughMacFinder(false)
{
// set X display
if(CTX::instance()->display.size())
......
......@@ -43,6 +43,7 @@ class MElement;
class FlGui{
private:
static FlGui *_instance;
bool _openedThroughMacFinder;
public:
std::vector<GVertex*> selectedVertices;
std::vector<GEdge*> selectedEdges;
......@@ -80,6 +81,9 @@ class FlGui{
static void wait(){ Fl::wait(); }
// wait (at most time seconds) for any events, then process them
static void wait(double time){ Fl::wait(time); }
// is a file opened through the Mac Finder?
void setOpenedThroughMacFinder(bool val){ _openedThroughMacFinder = val; }
bool getOpenedThroughMacFinder(){ return _openedThroughMacFinder; }
// test application-level keyboard shortcuts
int testGlobalShortcuts(int event);
// test the arrow shortcuts (not in the application-level shortcuts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment