void gMenu::__cb_file() { /* An Fl_Menu_Button is made of many Fl_Menu_Item */ Fl_Menu_Item menu[] = { {"Open patch or project..."}, {"Save patch..."}, {"Save project..."}, {"Quit Giada"}, {0} }; Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50); b->box(G_BOX); b->textsize(11); b->textcolor(COLOR_TEXT_0); b->color(COLOR_BG_0); const Fl_Menu_Item *m = menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b); if (!m) return; if (strcmp(m->label(), "Open patch or project...") == 0) { gWindow *childWin = new gdBrowser("Load Patch", G_Conf.patchPath.c_str(), 0, BROWSER_LOAD_PATCH); gu_openSubWindow(mainWin, childWin, WID_FILE_BROWSER); return; } if (strcmp(m->label(), "Save patch...") == 0) { if (G_Mixer.hasLogicalSamples() || G_Mixer.hasEditedSamples()) if (!gdConfirmWin("Warning", "You should save a project in order to store\nyour takes and/or processed samples.")) return; gWindow *childWin = new gdBrowser("Save Patch", G_Conf.patchPath.c_str(), 0, BROWSER_SAVE_PATCH); gu_openSubWindow(mainWin, childWin, WID_FILE_BROWSER); return; } if (strcmp(m->label(), "Save project...") == 0) { gWindow *childWin = new gdBrowser("Save Project", G_Conf.patchPath.c_str(), 0, BROWSER_SAVE_PROJECT); gu_openSubWindow(mainWin, childWin, WID_FILE_BROWSER); return; } if (strcmp(m->label(), "Quit Giada") == 0) { mainWin->do_callback(); return; } }
void gdMainWindow::__cb_open_file_menu() { /* An Fl_Menu_Button is made of many Fl_Menu_Item */ Fl_Menu_Item menu[] = { {"Open patch or project..."}, {"Save patch..."}, {"Save project..."}, {"Quit Giada"}, {0} }; Fl_Menu_Button *b = new Fl_Menu_Button(0, 0, 100, 50); b->box(G_BOX); b->textsize(11); b->textcolor(COLOR_TEXT_0); b->color(COLOR_BG_0); const Fl_Menu_Item *m = menu->popup(Fl::event_x(), Fl::event_y(), 0, 0, b); if (!m) return; if (strcmp(m->label(), "Open patch or project...") == 0) { __cb_open_loadpatch_win(); return; } if (strcmp(m->label(), "Save patch...") == 0) { if (G_Mixer.hasLogicalSamples() || G_Mixer.hasEditedSamples()) if (!gdConfirmWin("Warning", "You should save a project in order to store\nyour takes and/or processed samples.")) return; __cb_open_savepatch_win(); return; } if (strcmp(m->label(), "Save project...") == 0) { __cb_open_saveproject_win(); return; } if (strcmp(m->label(), "Quit Giada") == 0) { __cb_endprogram(); return; } }