mainwnd::mainwnd(perform *a_p) { /* set the performance */ m_mainperf = a_p; /* main window */ set_window_title_filename( global_filename ); m_main_wid = manage( new mainwid( m_mainperf )); m_main_time = manage( new maintime( )); m_menubar = manage(new MenuBar()); m_menu_file = manage(new Menu()); m_menu_control = manage( new Menu()); m_menu_help = manage( new Menu()); /* fill with items */ m_menu_file->items().push_back(MenuElem("New", mem_fun(*this,&mainwnd::file_new_dialog))); m_menu_file->items().push_back(SeparatorElem()); m_menu_file->items().push_back(MenuElem("Open...", mem_fun(*this,&mainwnd::file_open_dialog))); m_menu_file->items().push_back(MenuElem("Import...", mem_fun(*this,&mainwnd::file_import_dialog))); m_menu_file->items().push_back(SeparatorElem()); m_menu_file->items().push_back(MenuElem("Save", mem_fun(*this,&mainwnd::file_save_dialog))); m_menu_file->items().push_back(MenuElem("Save As...", mem_fun(*this,&mainwnd::file_saveas_dialog))); m_menu_file->items().push_back(SeparatorElem()); m_menu_file->items().push_back(MenuElem("Options...", mem_fun(*this,&mainwnd::options_dialog))); m_menu_file->items().push_back(SeparatorElem()); m_menu_file->items().push_back(MenuElem("Exit", mem_fun(*this,&mainwnd::file_exit_dialog))); m_menu_help->items().push_back(MenuElem("About", mem_fun(*this,&mainwnd::about_dialog))); m_menubar->items().push_front(MenuElem("File", *m_menu_file)); m_menubar->items().push_back(MenuElem("Help", *m_menu_help)); HBox *hbox = manage( new HBox( false, 2 ) ); m_button_stop = manage( new Button( )); m_button_stop->add( *manage( new Image(Gdk::Pixbuf::create_from_xpm_data( stop_xpm )))); m_button_stop->signal_clicked().connect( mem_fun(*this,&mainwnd::stop_playing)); hbox->pack_start(*m_button_stop, false, false); m_button_play = manage( new Button() ); m_button_play->add( *manage( new Image(Gdk::Pixbuf::create_from_xpm_data( play2_xpm )))); m_button_play->signal_clicked().connect( mem_fun( *this, &mainwnd::start_playing)); hbox->pack_start(*m_button_play, false, false); //m_button_test = manage( new Button("test") ); //m_button_test->signal_clicked().connect( mem_fun( *this, &mainwnd::test)); //hbox->pack_start(*m_button_test, false, false); m_button_perfedit = manage( new Button( )); m_button_perfedit->add( *manage( new Image(Gdk::Pixbuf::create_from_xpm_data( perfedit_xpm )))); m_button_perfedit->signal_clicked().connect( mem_fun( *this, &mainwnd::open_performance_edit )); hbox->pack_end(*m_button_perfedit, false, false, 4); m_adjust_bpm = manage( new Adjustment( m_mainperf->get_bpm(), 20, 500, 1 )); m_spinbutton_bpm = manage( new SpinButton( *m_adjust_bpm )); m_spinbutton_bpm->set_editable( false ); hbox->pack_start(*(manage( new Label( " bpm " ))), false, false, 4); hbox->pack_start(*m_spinbutton_bpm, false, false ); m_adjust_ss = manage( new Adjustment( 0, 0, c_max_sets - 1, 1 )); m_spinbutton_ss = manage( new SpinButton( *m_adjust_ss )); m_spinbutton_ss->set_editable( false ); m_spinbutton_ss->set_wrap( true ); hbox->pack_end(*m_spinbutton_ss, false, false ); hbox->pack_end(*(manage( new Label( " set " ))), false, false, 4); m_adjust_bpm->signal_value_changed().connect( mem_fun(*this,&mainwnd::adj_callback_bpm )); m_adjust_ss->signal_value_changed().connect( mem_fun(*this,&mainwnd::adj_callback_ss )); m_entry_notes = manage( new Entry()); m_entry_notes->signal_changed().connect( mem_fun(*this,&mainwnd::edit_callback_notepad )); hbox->pack_start( *m_entry_notes, true, true ); /* 2nd hbox */ HBox *hbox2 = manage( new HBox( false, 0 ) ); hbox2->pack_start( *manage( new Image(Gdk::Pixbuf::create_from_xpm_data( seq24_xpm ))), false, false ); hbox2->pack_end( *m_main_time, false, false ); /* set up a vbox, put the menu in it, and add it */ VBox *vbox = new VBox(); vbox->set_border_width( 10 ); vbox->pack_start(*hbox2, false, false ); vbox->pack_start(*m_main_wid, true, true, 10 ); vbox->pack_start(*hbox, false, false ); VBox *ovbox = new VBox(); ovbox->pack_start(*m_menubar, false, false ); ovbox->pack_start( *vbox ); /* add box */ this->add (*ovbox); /* show everything */ show_all(); add_events( Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK ); m_entry_notes->set_text( * m_mainperf->get_screen_set_notepad( m_mainperf->get_screenset() )); m_timeout_connect = Glib::signal_timeout().connect(mem_fun(*this,&mainwnd::timer_callback), 25); m_quit = false; m_perf_edit = new perfedit( m_mainperf ); m_options = NULL; }
mainwnd::mainwnd(perform *a_p): m_mainperf(a_p), m_modified(false), m_options(NULL) { set_icon(Gdk::Pixbuf::create_from_xpm_data(seq24_32_xpm)); /*sjh stuff...*/ set_wsetlist_mode(m_mainperf->get_setlist_mode()); /*............*/ /* register for notification */ m_mainperf->m_notify.push_back( this ); /* main window */ update_window_title(); #if GTK_MINOR_VERSION < 12 m_tooltips = manage( new Tooltips() ); #endif m_main_wid = manage( new mainwid( m_mainperf )); m_main_time = manage( new maintime( )); m_menubar = manage(new MenuBar()); m_menu_file = manage(new Menu()); m_menubar->items().push_front(MenuElem("_File", *m_menu_file)); m_menu_view = manage( new Menu()); m_menubar->items().push_back(MenuElem("_View", *m_menu_view)); m_menu_help = manage( new Menu()); m_menubar->items().push_back(MenuElem("_Help", *m_menu_help)); /* file menu items */ m_menu_file->items().push_back(MenuElem("_New", Gtk::AccelKey("<control>N"), mem_fun(*this, &mainwnd::file_new))); m_menu_file->items().push_back(MenuElem("_Open...", Gtk::AccelKey("<control>O"), mem_fun(*this, &mainwnd::file_open))); m_menu_file->items().push_back(MenuElem("_Save", Gtk::AccelKey("<control>S"), mem_fun(*this, &mainwnd::file_save))); m_menu_file->items().push_back(MenuElem("Save _as...", mem_fun(*this, &mainwnd::file_save_as))); m_menu_file->items().push_back(MenuElem("Open _setlist...", mem_fun(*this, &mainwnd::file_open_setlist))); m_menu_file->items().push_back(SeparatorElem()); m_menu_file->items().push_back(MenuElem("_Import...", mem_fun(*this, &mainwnd::file_import_dialog))); m_menu_file->items().push_back(MenuElem("O_ptions...", mem_fun(*this,&mainwnd::options_dialog))); m_menu_file->items().push_back(SeparatorElem()); m_menu_file->items().push_back(MenuElem("E_xit", Gtk::AccelKey("<control>Q"), mem_fun(*this, &mainwnd::file_exit))); /* view menu items */ m_menu_view->items().push_back(MenuElem("_Song Editor...", Gtk::AccelKey("<control>E"), mem_fun(*this, &mainwnd::open_performance_edit))); /* help menu items */ m_menu_help->items().push_back(MenuElem("_About...", mem_fun(*this, &mainwnd::about_dialog))); /* top line items */ HBox *tophbox = manage( new HBox( false, 0 ) ); tophbox->pack_start( *m_s24_pic, // *manage(new Image(Gdk::Pixbuf::create_from_xpm_data(seq24_xpm))), false, false); // adjust placement... VBox *vbox_b = manage( new VBox() ); HBox *hbox3 = manage( new HBox( false, 0 ) ); vbox_b->pack_start( *hbox3, false, false ); tophbox->pack_end( *vbox_b, false, false ); hbox3->set_spacing( 10 ); /* timeline */ hbox3->pack_start( *m_main_time, false, false ); /* group learn button */ m_button_learn = manage( new Button( )); m_button_learn->set_focus_on_click( false ); m_button_learn->set_flags( m_button_learn->get_flags() & ~Gtk::CAN_FOCUS ); m_button_learn->set_image(*manage(new Image( Gdk::Pixbuf::create_from_xpm_data( learn_xpm )))); m_button_learn->signal_clicked().connect( mem_fun(*this, &mainwnd::learn_toggle)); add_tooltip( m_button_learn, "Mute Group Learn\n\n" "Click 'L' then press a mutegroup key to store the mute state of " "the sequences in that key.\n\n" "(see File/Options/Keyboard for available mutegroup keys " "and the corresponding hotkey for the 'L' button)" ); hbox3->pack_end( *m_button_learn, false, false ); /*this seems to be a dirty hack:*/ Button w; hbox3->set_focus_child( w ); // clear the focus not to trigger L via keys /* bottom line items */ HBox *bottomhbox = manage( new HBox(false, 10)); /* container for start+stop buttons */ HBox *startstophbox = manage(new HBox(false, 4)); bottomhbox->pack_start(*startstophbox, Gtk::PACK_SHRINK); /* stop button */ m_button_stop = manage( new Button()); m_button_stop->add(*manage(new Image( Gdk::Pixbuf::create_from_xpm_data( stop_xpm )))); m_button_stop->signal_clicked().connect( mem_fun(*this, &mainwnd::stop_playing));/*sjh - can't pass anything into the stop_playing function because of this. */ add_tooltip( m_button_stop, "Stop playing MIDI sequence" ); m_button_stop->set_can_focus(false); startstophbox->pack_start(*m_button_stop, Gtk::PACK_SHRINK); /* play button */ m_button_play = manage(new Button() ); m_button_play->add(*manage(new Image( Gdk::Pixbuf::create_from_xpm_data( play2_xpm )))); m_button_play->signal_clicked().connect( mem_fun( *this, &mainwnd::start_playing)); add_tooltip( m_button_play, "Play MIDI sequence" ); startstophbox->pack_start(*m_button_play, Gtk::PACK_SHRINK); /* bpm spin button with label*/ HBox *bpmhbox = manage(new HBox(false, 4)); bottomhbox->pack_start(*bpmhbox, Gtk::PACK_SHRINK); m_adjust_bpm = manage(new Adjustment(m_mainperf->get_bpm(), 20, 500, 1)); m_spinbutton_bpm = manage( new SpinButton( *m_adjust_bpm )); m_spinbutton_bpm->set_editable( false ); m_adjust_bpm->signal_value_changed().connect( mem_fun(*this, &mainwnd::adj_callback_bpm)); add_tooltip( m_spinbutton_bpm, "Adjust beats per minute (BPM) value"); Label* bpmlabel = manage(new Label("_bpm", true)); bpmlabel->set_mnemonic_widget(*m_spinbutton_bpm); bpmhbox->pack_start(*bpmlabel, Gtk::PACK_SHRINK); bpmhbox->pack_start(*m_spinbutton_bpm, Gtk::PACK_SHRINK); /* screen set name edit line */ HBox *notebox = manage(new HBox(false, 4)); bottomhbox->pack_start(*notebox, Gtk::PACK_EXPAND_WIDGET); m_entry_notes = manage( new Entry()); m_entry_notes->signal_changed().connect( mem_fun(*this, &mainwnd::edit_callback_notepad)); m_entry_notes->set_text(*m_mainperf->get_screen_set_notepad( m_mainperf->get_screenset())); add_tooltip( m_entry_notes, "Enter screen set name" ); Label* notelabel = manage(new Label("_Name", true)); notelabel->set_mnemonic_widget(*m_entry_notes); notebox->pack_start(*notelabel, Gtk::PACK_SHRINK); notebox->pack_start(*m_entry_notes, Gtk::PACK_EXPAND_WIDGET); /* sequence set spin button */ HBox *sethbox = manage(new HBox(false, 4)); bottomhbox->pack_start(*sethbox, Gtk::PACK_SHRINK); m_adjust_ss = manage( new Adjustment( 0, 0, c_max_sets - 1, 1 )); m_spinbutton_ss = manage( new SpinButton( *m_adjust_ss )); m_spinbutton_ss->set_editable( false ); m_spinbutton_ss->set_wrap( true ); m_adjust_ss->signal_value_changed().connect( mem_fun(*this, &mainwnd::adj_callback_ss )); add_tooltip( m_spinbutton_ss, "Select screen set" ); Label* setlabel = manage(new Label("_Set", true)); setlabel->set_mnemonic_widget(*m_spinbutton_ss); sethbox->pack_start(*setlabel, Gtk::PACK_SHRINK); sethbox->pack_start(*m_spinbutton_ss, Gtk::PACK_SHRINK); /* song edit button */ m_button_songedit = manage( new Button( )); m_button_songedit->add( *manage( new Image( Gdk::Pixbuf::create_from_xpm_data( perfedit_xpm )))); m_button_songedit->signal_clicked().connect( mem_fun( *this, &mainwnd::open_performance_edit )); add_tooltip( m_button_songedit, "Show or hide song editor window" ); bottomhbox->pack_end(*m_button_songedit, Gtk::PACK_SHRINK); /* vertical layout container for window content*/ VBox *contentvbox = new VBox(); contentvbox->set_spacing(10); contentvbox->set_border_width(10); contentvbox->pack_start(*tophbox, Gtk::PACK_SHRINK); contentvbox->pack_start(*m_main_wid, Gtk::PACK_SHRINK); contentvbox->pack_start(*bottomhbox, Gtk::PACK_SHRINK); /*main container for menu and window content */ VBox *mainvbox = new VBox(); mainvbox->pack_start(*m_menubar, false, false ); mainvbox->pack_start( *contentvbox ); /* add main layout box */ this->add (*mainvbox); /* show everything */ show_all(); add_events( Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK ); m_timeout_connect = Glib::signal_timeout().connect( mem_fun(*this, &mainwnd::timer_callback), 25); m_perf_edit = new perfedit( m_mainperf ); // m_playlist_wnd = new playlist_wnd( m_mainperf); m_playplay = new playlist_player(); m_sigpipe[0] = -1; m_sigpipe[1] = -1; install_signal_handlers(); }
perfedit::perfedit ( perform & p, bool second_perfedit, int ppqn ) : gui_window_gtk2 (p, 750, 500), m_peer_perfedit (nullptr), m_table (manage(new Gtk::Table(6, 3, false))), m_vadjust (manage(new Gtk::Adjustment(0, 0, 1, 1, 1, 1))), m_hadjust (manage(new Gtk::Adjustment(0, 0, 1, 1, 1, 1))), m_vscroll (manage(new Gtk::VScrollbar(*m_vadjust))), m_hscroll (manage(new Gtk::HScrollbar(*m_hadjust))), m_perfnames (manage(new perfnames(perf(), *this, *m_vadjust))), m_perfroll ( manage(new perfroll(perf(), *this, *m_hadjust, *m_vadjust, ppqn)) ), m_perftime (manage(new perftime(perf(), *this, *m_hadjust))), m_menu_snap (manage(new Gtk::Menu())), #ifdef SEQ64_STAZED_TRANSPOSE m_menu_xpose (manage(new Gtk::Menu())), m_button_xpose (manage(new Gtk::Button())), m_entry_xpose (manage(new Gtk::Entry())), #endif m_image_play (manage(new PIXBUF_IMAGE(play2_xpm))), m_button_snap (manage(new Gtk::Button())), m_entry_snap (manage(new Gtk::Entry())), m_button_stop (manage(new Gtk::Button())), m_button_play (manage(new Gtk::Button())), m_button_loop (manage(new Gtk::ToggleButton())), m_button_expand (manage(new Gtk::Button())), m_button_collapse (manage(new Gtk::Button())), m_button_copy (manage(new Gtk::Button())), m_button_grow (manage(new Gtk::Button())), m_button_undo (manage(new Gtk::Button())), m_button_redo (manage(new Gtk::Button())), // stazed #ifdef SEQ64_STAZED_JACK_SUPPORT m_button_jack (manage(new Gtk::ToggleButton())), m_button_follow (manage(new Gtk::ToggleButton())), #endif m_button_bpm (manage(new Gtk::Button())), m_entry_bpm (manage(new Gtk::Entry())), m_button_bw (manage(new Gtk::Button())), m_entry_bw (manage(new Gtk::Entry())), m_hbox (manage(new Gtk::HBox(false, 2))), m_hlbox (manage(new Gtk::HBox(false, 2))), m_tooltips (manage(new Gtk::Tooltips())), // valgrind complains! m_menu_bpm (manage(new Gtk::Menu())), m_menu_bw (manage(new Gtk::Menu())), m_snap (0), m_bpm (0), m_bw (0), m_ppqn (0), #ifdef SEQ64_PAUSE_SUPPORT m_is_running (false), #endif m_standard_bpm (SEQ64_DEFAULT_LINES_PER_MEASURE) /* 4 */ { std::string title = "Sequencer64 - Song Editor"; if (second_perfedit) title += " 2"; m_ppqn = choose_ppqn(ppqn); set_icon(Gdk::Pixbuf::create_from_xpm_data(perfedit_xpm)); set_title(title); /* caption bar */ m_table->set_border_width(2); m_hlbox->set_border_width(2); m_button_grow->add ( *manage(new Gtk::Arrow(Gtk::ARROW_RIGHT, Gtk::SHADOW_OUT)) ); m_button_grow->signal_clicked().connect(mem_fun(*this, &perfedit::grow)); add_tooltip(m_button_grow, "Increase size of grid."); /* * Fill the table */ m_table->attach(*m_hlbox, 0, 3, 0, 1, Gtk::FILL, Gtk::SHRINK, 2, 0); m_table->attach(*m_perfnames, 0, 1, 2, 3, Gtk::SHRINK, Gtk::FILL); m_table->attach(*m_perftime, 1, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); m_table->attach ( *m_perfroll, 1, 2, 2, 3, Gtk::FILL | Gtk::SHRINK, Gtk::FILL | Gtk::SHRINK ); m_table->attach(*m_vscroll, 2, 3, 2, 3, Gtk::SHRINK, Gtk::FILL | Gtk::EXPAND); m_table->attach(*m_hbox, 0, 1, 3, 4, Gtk::FILL, Gtk::SHRINK, 0, 2); m_table->attach(*m_hscroll, 1, 2, 3, 4, Gtk::FILL | Gtk::EXPAND, Gtk::SHRINK); m_table->attach(*m_button_grow, 2, 3, 3, 4, Gtk::SHRINK, Gtk::SHRINK); /* * To reduce the amount of written code, we now use a static array to * initialize some of the menu entries. We use the same list for the snap * menu and for the beat-width menu. This adds a beat-width of 32 to the * beat-width menu. A new feature! :-D */ #define SET_SNAP mem_fun(*this, &perfedit::set_snap) #define SET_BW mem_fun(*this, &perfedit::set_beat_width) static const int s_width_items [] = { 1, 2, 4, 8, 16, 32, 0, 3, 6, 12, 24, #ifdef USE_STAZED_EXTRA_SNAPS 0, 5, 10, 20, 40, 0, 7, 9, 11, 13, 14, 15 #endif }; static const int s_width_count = sizeof(s_width_items) / sizeof(int); for (int si = 0; si < s_width_count; ++si) { int item = s_width_items[si]; char fmt[8]; bool use_separator = false; if (item > 1) snprintf(fmt, sizeof fmt, "1/%d", item); else if (item == 0) use_separator = true; else snprintf(fmt, sizeof fmt, "%d", item); if (use_separator) { m_menu_snap->items().push_back(SeparatorElem()); } else { m_menu_snap->items().push_back ( MenuElem(fmt, sigc::bind(SET_SNAP, item)) ); snprintf(fmt, sizeof fmt, "%d", item); m_menu_bw->items().push_back(MenuElem(fmt, sigc::bind(SET_BW, item))); } } #define SET_POPUP mem_fun(*this, &perfedit::popup_menu) m_button_snap->add(*manage(new PIXBUF_IMAGE(snap_xpm))); m_button_snap->signal_clicked().connect ( sigc::bind<Gtk::Menu *>(SET_POPUP, m_menu_snap) ); add_tooltip(m_button_snap, "Grid snap (fraction of measure length)."); m_entry_snap->set_size_request(40, -1); m_entry_snap->set_editable(false); #ifdef SEQ64_STAZED_TRANSPOSE char num[12]; for (int i = -SEQ64_OCTAVE_SIZE; i <= SEQ64_OCTAVE_SIZE; ++i) { if (i != 0) snprintf(num, sizeof num, "%+d [%s]", i, c_interval_text[abs(i)]); else snprintf(num, sizeof num, "0 [normal]"); m_menu_xpose->items().push_front ( MenuElem ( num, sigc::bind ( mem_fun(*this, &perfedit::transpose_button_callback), i ) ) ); } m_button_xpose->add ( *manage(new Gtk::Image(Gdk::Pixbuf::create_from_xpm_data(transpose_xpm))) ); m_button_xpose->signal_clicked().connect ( sigc::bind<Gtk::Menu *> ( mem_fun(*this, &perfedit::popup_menu), m_menu_xpose ) ); add_tooltip(m_button_xpose, "Song-transpose all transposable sequences."); m_entry_xpose->set_size_request(30, -1); m_entry_xpose->set_editable(false); #endif // SEQ64_STAZED_TRANSPOSE #define SET_BPB mem_fun(*this, &perfedit::set_beats_per_bar) char b[4]; for (int i = 0; i < 16; ++i) { snprintf(b, sizeof b, "%d", i + 1); m_menu_bpm->items().push_back(MenuElem(b, sigc::bind(SET_BPB, i + 1))); } m_button_bpm->add(*manage(new PIXBUF_IMAGE(down_xpm))); m_button_bpm->signal_clicked().connect ( sigc::bind<Gtk::Menu *>(SET_POPUP, m_menu_bpm) ); add_tooltip ( m_button_bpm, "Time signature: beats per measure or bar." ); m_entry_bpm->set_width_chars(2); m_entry_bpm->set_editable(false); m_button_bw->add(*manage(new PIXBUF_IMAGE(down_xpm))); /* beat width */ m_button_bw->signal_clicked().connect ( sigc::bind<Gtk::Menu *>(SET_POPUP, m_menu_bw) ); add_tooltip(m_button_bw, "Time signature: length of measure or bar."); m_entry_bw->set_width_chars(2); m_entry_bw->set_editable(false); m_button_undo->add(*manage(new PIXBUF_IMAGE(undo_xpm))); m_button_undo->signal_clicked().connect(mem_fun(*this, &perfedit::undo)); add_tooltip(m_button_undo, "Undo the last action (Ctrl-Z)."); m_button_redo->add(*manage(new PIXBUF_IMAGE(redo_xpm))); m_button_redo->signal_clicked().connect(mem_fun(*this, &perfedit::redo)); add_tooltip(m_button_redo, "Redo the last undone action (Ctrl-R)."); m_button_expand->add(*manage(new PIXBUF_IMAGE(expand_xpm))); m_button_expand->signal_clicked().connect(mem_fun(*this, &perfedit::expand)); add_tooltip(m_button_expand, "Expand space between L and R markers."); m_button_collapse->add(*manage(new PIXBUF_IMAGE(collapse_xpm))); m_button_collapse->signal_clicked().connect ( mem_fun(*this, &perfedit::collapse) ); add_tooltip(m_button_collapse, "Collapse pattern between L and R markers."); m_button_copy->add(*manage(new PIXBUF_IMAGE(copy_xpm))); /* expand+copy */ m_button_copy->signal_clicked().connect(mem_fun(*this, &perfedit::copy)); add_tooltip(m_button_copy, "Expand and copy between the L and R markers."); m_button_loop->add(*manage(new PIXBUF_IMAGE(loop_xpm))); m_button_loop->signal_toggled().connect ( mem_fun(*this, &perfedit::set_looped) ); add_tooltip(m_button_loop, "Playback looped between the L and R markers."); m_button_stop->set_focus_on_click(false); m_button_stop->add(*manage(new PIXBUF_IMAGE(stop_xpm))); m_button_stop->signal_clicked().connect ( mem_fun(*this, &perfedit::stop_playing) ); add_tooltip(m_button_stop, "Stop playback."); m_button_stop->set_sensitive(true); m_button_play->set_focus_on_click(false); m_button_play->set_image(*m_image_play); m_button_play->signal_clicked().connect ( mem_fun(*this, &perfedit::start_playing) ); add_tooltip(m_button_play, "Begin playback at the L marker."); m_button_play->set_sensitive(true); #ifdef SEQ64_STAZED_JACK_SUPPORT m_button_jack->add(*manage(new PIXBUF_IMAGE(jack_black_xpm))); m_button_jack->signal_clicked().connect ( mem_fun(*this, &perfedit::set_jack_mode) ); add_tooltip(m_button_jack, "Toggle JACK sync connection."); if (rc().with_jack_transport()) m_button_jack->set_active(true); m_button_follow->add(*manage(new PIXBUF_IMAGE(transport_follow_xpm))); m_button_follow->signal_clicked().connect ( mem_fun(*this, &perfedit::set_follow_transport) ); add_tooltip(m_button_follow, "Toggle the following of JACK transport."); m_button_follow->set_active(true); #endif m_hlbox->pack_end(*m_button_copy , false, false); m_hlbox->pack_end(*m_button_expand , false, false); m_hlbox->pack_end(*m_button_collapse , false, false); m_hlbox->pack_end(*m_button_undo , false, false); m_hlbox->pack_end(*m_button_redo , false, false); // stazed m_hlbox->pack_start(*m_button_stop , false, false); m_hlbox->pack_start(*m_button_play , false, false); m_hlbox->pack_start(*m_button_loop , false, false); m_hlbox->pack_start(*m_button_bpm , false, false); m_hlbox->pack_start(*m_entry_bpm , false, false); m_hlbox->pack_start(*(manage(new Gtk::Label("/"))), false, false, 4); m_hlbox->pack_start(*m_button_bw , false, false); m_hlbox->pack_start(*m_entry_bw , false, false); m_hlbox->pack_start(*(manage(new Gtk::Label("x"))), false, false, 4); m_hlbox->pack_start(*m_button_snap , false, false); m_hlbox->pack_start(*m_entry_snap , false, false); #ifdef SEQ64_STAZED_TRANSPOSE m_hlbox->pack_start(*m_button_xpose , false, false); m_hlbox->pack_start(*m_entry_xpose , false, false); #endif #ifdef SEQ64_STAZED_JACK_SUPPORT m_hlbox->pack_start(*m_button_jack, false, false); m_hlbox->pack_start(*m_button_follow, false, false); #endif add(*m_table); /* * Here, the set_snap call depends on the others being done first. These * calls also depend upon the values being set to bogus (0) values in the * initializer list, otherwise no change will occur, and the items won't * be displayed. */ set_beats_per_bar(SEQ64_DEFAULT_BEATS_PER_MEASURE); /* time-sig numerator */ set_beat_width(SEQ64_DEFAULT_BEAT_WIDTH); /* time-sig denominator */ set_snap(SEQ64_DEFAULT_PERFEDIT_SNAP); #ifdef SEQ64_STAZED_TRANSPOSE set_transpose(0); #endif /* * Log the pointer to the appropriate perfedit object, if not already * done. */ if (second_perfedit) { if (is_nullptr(gs_perfedit_pointer_1)) gs_perfedit_pointer_1 = this; } else { if (is_nullptr(gs_perfedit_pointer_0)) gs_perfedit_pointer_0 = this; } }
QualifiersMenu::QualifiersMenu(const string& graphtype, const string& qual_class, const std::map<std::string, std::string>& configuration, const std::map<std::string, std::string>& menuconf, bool display_error) : AnnotationMenu(_(qual_class.c_str())) { std::map<std::string, std::string>::const_iterator it, itd; // m_labels = configuration; it = configuration.find(graphtype+","+qual_class); Glib::ustring qualifier_error = "" ; bool error = false ; if ( it != configuration.end() ) { vector<string> v1, v2; vector<string>::iterator it1, it2; StringOps(it->second).split(v1, ";,"); string sect=qual_class+","; for ( it1 = v1.begin(); it1 != v1.end(); ++it1 ) { // get qualifier subtypes and create corresponding submenu items v2.clear(); string key = (*it1)+",subtypes"; m_typeSubmenu[*it1] = NULL; itd = configuration.find(key); if ( itd != configuration.end() ) { it = menuconf.find(sect+*it1); if ( it != menuconf.end() ) m_labels[*it1] = it->second; else m_labels[*it1] = *it1 ; //> We have subtype different from other choice, let's configure if ( itd->second != "" && itd->second != QualifiersMenu::OTHER_CHOICE ) { StringOps(itd->second).split(v2, ";,"); m_typeSubmenu[*it1] = Gtk::manage (new Gtk::Menu()); for ( it2 = v2.begin(); it2 != v2.end(); ++it2 ) { key = *it1+string(",")+*it2; it = menuconf.find(sect+key); if ( it != menuconf.end() ) m_labels[key] = it->second; else m_labels[key] = *it2 ; m_typeSubmenu[*it1]->items().push_back(MenuElem(m_labels[key], sigc::bind<string, string>(sigc::mem_fun(*this, &QualifiersMenu::onSelectQualifier), (*it1), (*it2))) ); } key = (*it1)+",editable"; itd = configuration.find(key); bool need_other_choice = ( itd != configuration.end() && itd->second == "true" ); if ( need_other_choice ) { m_typeSubmenu[*it1]->items().push_back(MenuElem(_("_Other"), sigc::bind<string, string>(sigc::mem_fun(*this, &QualifiersMenu::onSelectQualifier), (*it1), QualifiersMenu::OTHER_CHOICE)) ); } items().push_back(MenuElem(m_labels[*it1], *(m_typeSubmenu[*it1]))); } else { //> Check editability key = (*it1)+",editable"; itd = configuration.find(key); bool need_other_choice = ( itd != configuration.end() && itd->second == "true" ); string desc = " " ; //> We don't have subtypes but editiability is OK, let's add editable text proposition if (need_other_choice) desc = QualifiersMenu::OTHER_CHOICE ; items().push_back(MenuElem(m_labels[*it1], sigc::bind<string, string>(sigc::mem_fun(*this, &QualifiersMenu::onSelectQualifier), (*it1), desc)) ); } } else { TRACE << "<!> qualifier menu: no details for key " << *it1 << endl ; qualifier_error.append("- " + *it1 + "\n") ; error = true ; } } } if (error && display_error) { Glib::ustring error = _("Some qualifier types or subtypes are used in conventions but are not specified: ") + Glib::ustring("\n") + qualifier_error ; error = error + "\n" + _("Check your conventions files.") ; dlg::warning(error, NULL) ; } m_nbItems = items().size(); }