#define MAINDEBUG 0 #include #include #include #include "ui_hd24connect.h" #include #include #include //dave #ifdef LINUX #include //dave #endif #include "images/hd24connect_64x64.xpm" //dave #include #include #include #include #ifndef MAX_PATH #define MAX_PATH 127 #endif #ifdef WINDOWS #include #define IDI_ICON1 101 #endif string device; string headerfilename; int force; int maintmode; int wavefixmode; int testmode; #ifdef LINUX #define TIMEOUT 0.03 #endif #define ARGDEV "--dev=" #define ARGHEADER "--header=" #define ARGFORCE "--force" #define ARGMAINT "--maint" #define ARGWAVEFIX "--wavefix" #define ARGTEST "--test" #include "selftest.cpp" int parsecommandline(int argc, char ** argv) { int invalid=0; force=0; maintmode=0; wavefixmode=0; testmode=0; device=""; for (int c=1;cc_str(),hd24fs::MODE_RDWR); } else { cout << "Trying to use " << device << " as hd24 device." << endl; sysob=new hd24fs(imagedir->c_str(),hd24fs::MODE_RDWR,&device,(force==1)); if (!(sysob->isOpen())) { if (!force) { cout << "Cannot open hd24 device" << endl; delete sysob; return 1; } } } delete imagedir; if (headerfilename!="") { if (!(sysob->useheaderfile(headerfilename))) { cout << "Couldn't load header file "<setmaintenancemode(maintmode); sysob->setwavefixmode(wavefixmode); #if (MAINDEBUG==1) cout << "mdb(3c)" << endl; #endif Fl_Window *window = ui.make_window(sysob); #if (MAINDEBUG==1) cout << "mdb(3d)" << endl; #endif #ifdef WINDOWS window->icon((char *)LoadIcon(fl_display,MAKEINTRESOURCE(IDI_ICON1))); #endif window->end(); window->show(); //argc, argv); #ifdef LINUX //dave Pixmap p, mask; XpmCreatePixmapFromData(fl_display,DefaultRootWindow(fl_display),(char **)hd24connect_xpm, &p, &mask, NULL); /* FLTK support for transparent background is broken. So instead of this: window->icon((char *)p); We will write the following: */ XWMHints *hints=NULL; hints = XGetWMHints(fl_display, fl_xid(window)); hints->icon_pixmap = p; hints->icon_mask = mask; hints->flags = IconPixmapHint | IconMaskHint; XSetWMHints(fl_display, fl_xid(window), hints); /* -- end of transparency fix */ #endif #if (MAINDEBUG==1) cout << "mdb(3)" << endl; #endif #if (MAINDEBUG==1) cout << "mdb(4)" << endl; #endif if (!(sysob->isOpen())) { window->deactivate(); fl_message("No valid HD24 drive is connected to the system.\nUse the File menu to resolve this problem."); window->activate(); } // run normally. result= Fl::run(); ui.control->ready(0); #ifndef WINDOWS cout << "Thank you for using HD24connect." << endl; #endif // ui.finish(); #ifdef hints if (hints!=NULL) { delete hints; } #endif return result; }