From 9d85ffedb3e35b003f9b0fc1178974e7cf924ed4 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Sun, 5 Mar 2017 10:25:16 +0100 Subject: Fix Native_File_Chooser --- gui.cpp | 48 +++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/gui.cpp b/gui.cpp index 54dfc8b..5dbf43f 100644 --- a/gui.cpp +++ b/gui.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include //#include @@ -151,39 +152,28 @@ Simulation *simulation; static void openBotFileChooser(){ - - Fl_Native_File_Chooser fc; - // fc.type(Fl_Native_File_Chooser::BROWSE_MULTI_FILE); - // fc.title("Add bots to sim"); - // fc.filter("Robocom Bot Files (*.rob)\t*.rob"); + Fl_Native_File_Chooser fc(Fl_Native_File_Chooser::BROWSE_MULTI_FILE); + fc.title("Add bots to sim"); +#ifdef __APPLE__ + fc.filter("Robocom Bot Files\t*.rob"); +#else + fc.filter("Robocom Bot Files (*.rob)\t*.rob"); +#endif switch(fc.show()) { - case -1: - cout << "Error: " << fc.errmsg() << endl; - break; - case 1: - cout << "Cancelled" << endl; - break; - default: - int count = fc.count(); - for(int i=0; iadd(fc.filename(i)); + case -1: + cout << "Native File Chooser error: " << fc.errmsg() << endl; + break; + case 1: + break; + default: { + int count = fc.count(); + for(int i=0; iadd(fc.filename(i)); + } + break; } - break; } - - // Fl_File_Chooser *fc=new Fl_File_Chooser( - // "programs","Robocom Bot Files (*.rob)",Fl_File_Chooser::MULTI,"Add bots to sim"); - // fc->callback([](Fl_File_Chooser *fc,void*){ - // if(fc->shown())return; - // int count=fc->count(); - // for(int i=1;i<=count;i++){ - // cout << fc->value(i) << endl; - // simulation->add(fc->value(i)); - // } - // }); - // fc->show(); } static BotList* makeBotlist(Fl_Group *parent){ -- cgit v1.2.3-70-g09d2