/* * Midi Specialist * * by Kelvin W Sherlock * * $Id: main.cpp,v 1.8 1999/03/30 16:46:25 baron Exp baron $ */ #include #include #include #include #include #include "main_window.h" bool global_quit_flag; class _Application: public BApplication { public: _Application(): BApplication("application/x-vnd.KWS-MidiSpecialist") { new Main_Window (BRect(100, 50, 600, 300), "Midi Specialist"); //MainWindow->Show(); } virtual void RefsReceived(BMessage *msg) { entry_ref ref; // The entry_ref to open int32 ref_num; // The index into the ref list // Loop through the ref list and open each one ref_num = 0; do { if (msg->FindRef("refs", ref_num, &ref) != B_OK) { return; } //TODO - better bounds new Main_Window(BRect(100, 50, 600, 300), &ref); ref_num++; } while (1); } virtual void AboutRequested(void) { BAlert *b; b = new BAlert("about", "Midi Specialist 0.0\n" "by Kelvin W Sherlock\n" "copyright 1999", "Cool", NULL, NULL, B_WIDTH_AS_USUAL, B_INFO_ALERT); b->Go(NULL); //asynchronous } virtual void ArgvReceived(int argc, char **argv) { int i; status_t err; struct entry_ref ref; printf("Argv!\n"); //argv[0] = name of program for(i = 1; i < argc; i++) { err = get_ref_for_path(argv[i], &ref); if (!err) { new Main_Window(BRect(100, 50, 600, 300), &ref); } } } private: }; int main(int argc, char **argv) { _Application *app; app = new _Application(); app->ArgvReceived(argc, argv); app->Run(); }