static void on_pick_button_click(Fl_Widget *sender, void *obj) { Fl_Native_File_Chooser native; native.title("Pick a file"); native.type(Fl_Native_File_Chooser::BROWSE_MULTI_FILE); native.filter("CSV\t*.csv"); if (native.show() == 0) { bool encode = (((window *)obj)->encode_check->value() == 1); bool open = (((window *)obj)->open_file_check->value() == 1); int count = native.count(); for (int i = 0; i < count; ++i) { std::string filename = native.filename(i); if (csv2html(filename, encode) && open) { std::string uri("file://"); if (filename[0] != '/') { uri.push_back('/'); // Windows } uri += filename + ".html"; char errmsg[512]; fl_open_uri(uri.c_str(), errmsg, sizeof(errmsg)); } } } }
static void url_cb(Fl_Widget *) { char errmsg[512] = {0}; std::string warnmsg; if (!fl_open_uri(PROJECT_URL, errmsg, sizeof(errmsg))) { title = "Error"; warnmsg = "Error: " + std::string(errmsg); msg = warnmsg.c_str(); dialog_message(MESSAGE_TYPE_INFO); } }
static void on_author_click(Fl_Widget *sender, void *obj) { char errmsg[512]; fl_open_uri("https://github.com/limingjie/csv2html", errmsg, sizeof(errmsg)); }
static const char *help_link(Fl_Widget *w, const char *uri) { fl_open_uri(uri); return 0; }
FL_EXPORT_C(int,flc_open_uri)(const char *uri){ return fl_open_uri(uri); }
FL_EXPORT_C(int,flc_open_uri_with_msg)(const char *uri,char *msg){ return fl_open_uri(uri,msg,0); }
FL_EXPORT_C(int,flc_open_uri_with_msglen)(const char *uri,int msglen){ return fl_open_uri(uri,0,msglen); }