- case Session::AutoLoop:
- break;
-
- case Session::AutoReturn:
- map_some_session_state (auto_return_button, &Session::get_auto_return);
- break;
-
- case Session::AutoInput:
- map_some_session_state (auto_input_button, &Session::get_auto_input);
- break;
-
- case Session::PunchOut:
- map_some_session_state (punch_in_button, &Session::get_punch_out);
- break;
-
- case Session::PunchIn:
- map_some_session_state (punch_in_button, &Session::get_punch_in);
- break;
-
- case Session::Clicking:
- map_some_session_state (click_button, &Session::get_clicking);
- break;
-
- case Session::SlaveType:
-// map_some_session_state (mtc_slave_button, &Session::get_mtc_slave);
- break;
-
- case Session::SendMTC:
-// map_some_session_state (send_mtc_button, &Session::get_send_mtc);
- break;
-
- case Session::SendMMC:
-// map_some_session_state (send_mmc_button, &Session::get_send_mmc);
- break;
-
- case Session::MMCControl:
-// map_some_session_state (mmc_control_button, &Session::get_mmc_control);
- break;
-
- case Session::MidiFeedback:
-// map_some_session_state (mmc_control_button, &Session::get_mmc_control);
- break;
- case Session::MidiControl:
-// map_some_session_state (mmc_control_button, &Session::get_mmc_control);
- break;
-
- case Session::Live:
- break;
-
- case Session::RecordingPlugins:
- break;
-
- case Session::CrossFadesActive:
- break;
-
- case Session::EditingMode:
- break;
-
- case Session::PlayRange:
- break;
-
- case Session::AlignChoice:
- /* don't care, this is handled by the options editor */
- break;
- case Session::SeamlessLoop:
- /* don't care, this is handled by the options editor */
- break;
-
- }
-}
-
-void
-ARDOUR_UI::control_methods_adjusted ()
-
-{
- int which_method;
-
- which_method = (int) online_control_button->adjustment.get_value();
- switch (which_method) {
- case 0:
- allow_mmc_and_local ();
- break;
- case 1:
- allow_mmc_only ();
- break;
- case 2:
- allow_local_only ();
- break;
- default:
- fatal << _("programming error: impossible control method") << endmsg;
- }
-}
-
-
-void
-ARDOUR_UI::mmc_device_id_adjusted ()
-
-{
-#if 0
- if (mmc) {
- int dev_id = (int) mmc_id_button->adjustment.get_value();
- mmc->set_device_id (dev_id);
- }
-#endif
-}
-
-void
-ARDOUR_UI::map_some_session_state (ToggleButton& button,
- bool (Session::*get)() const)
-
-{
- bool x;
-
- if (session == 0) {
- return;
- }
-
- if (button.get_active() != (x = (session->*get)())) {
- button.set_active (x);
- }
-}
-
-void
-ARDOUR_UI::toggle_some_session_state (ToggleButton& button,
- bool (Session::*get)() const,
- void (Session::*set)(bool))
-
-{
- bool button_state;
- bool session_state;
-
- if (session == 0) {
- return;
- }
-
- button_state = button.get_active ();
- session_state = (session->*get)();
-
- if (button_state != session_state) {
- (session->*set) (button_state);
-#if 0
-
- /* check that it worked, and reverse
- the button state if it didn't
- */
-
- if ((session->*get)() != button_state) {
- button->set_active (!button_state);
- }
-#endif
-
- }
-}
-
-gint
-ARDOUR_UI::session_menu (GdkEventButton *ev)
-{
- session_popup_menu->popup (0, 0);
- return TRUE;
-}
-
-void
-ARDOUR_UI::redisplay_recent_sessions ()
-{
- vector<string *> *sessions;
- vector<string *>::iterator i;
- RecentSessionsSorter cmp;
-
- recent_session_display.set_model (Glib::RefPtr<TreeModel>(0));
- recent_session_model->clear ();
-
- RecentSessions rs;
- ARDOUR::read_recent_sessions (rs);
-
- if (rs.empty()) {
- recent_session_display.set_model (recent_session_model);
- return;
- }
-
- /* sort them alphabetically */
- sort (rs.begin(), rs.end(), cmp);
- sessions = new vector<string*>;
-
- for (RecentSessions::iterator i = rs.begin(); i != rs.end(); ++i) {
- sessions->push_back (new string ((*i).second));
- }
-
- for (i = sessions->begin(); i != sessions->end(); ++i) {
-
- vector<string*>* states;
- vector<const gchar*> item;
- string fullpath = *(*i);
-
- /* remove any trailing / */
-
- if (fullpath[fullpath.length()-1] == '/') {
- fullpath = fullpath.substr (0, fullpath.length()-1);
- }
-
- /* now get available states for this session */
-
- if ((states = Session::possible_states (fullpath)) == 0) {
- /* no state file? */
- continue;
- }
-
- TreeModel::Row row = *(recent_session_model->append());
-
- row[recent_session_columns.visible_name] = PBD::basename (fullpath);
- row[recent_session_columns.fullpath] = fullpath;
-
- if (states->size() > 1) {
-
- /* add the children */
-
- for (vector<string*>::iterator i2 = states->begin(); i2 != states->end(); ++i2) {
-
- TreeModel::Row child_row = *(recent_session_model->append (row.children()));
-
- child_row[recent_session_columns.visible_name] = **i2;
- child_row[recent_session_columns.fullpath] = fullpath;
-
- delete *i2;
- }
- }
-
- delete states;
- }
-
- recent_session_display.set_model (recent_session_model);
- delete sessions;
-}
-
-void
-ARDOUR_UI::build_session_selector ()
-{
- session_selector_window = new ArdourDialog ("session selector");
-
- Gtk::ScrolledWindow *scroller = manage (new Gtk::ScrolledWindow);
-
- session_selector_window->add_button (Stock::OK, RESPONSE_ACCEPT);
- session_selector_window->add_button (Stock::CANCEL, RESPONSE_CANCEL);
-
- recent_session_model = TreeStore::create (recent_session_columns);
- recent_session_display.set_model (recent_session_model);
- recent_session_display.append_column (_("Recent Sessions"), recent_session_columns.visible_name);
- recent_session_display.set_headers_visible (false);
-
- scroller->add (recent_session_display);
- scroller->set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC);
-
- session_selector_window->set_name ("SessionSelectorWindow");
- session_selector_window->set_size_request (200, 400);
- session_selector_window->get_vbox()->pack_start (*scroller);
-}
-
-void
-ARDOUR_UI::open_recent_session ()
-{
- /* popup selector window */
-
- if (session_selector_window == 0) {
- build_session_selector ();
- }