ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
- : Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
+ : Gtkmm2ext::UI (PROGRAM_NAME, X_("gui"), argcp, argvp)
, session_loaded (false)
, gui_object_state (new GUIObjectState)
, primary_clock (new MainClock (X_("primary"), X_("transport"), true ))
if (affect_transport) {
if (rolling) {
_session->request_stop (with_abort, true);
- } else if (!_session->config.get_external_sync()) {
+ } else {
+ /* the only external sync condition we can be in here
+ * would be Engine (JACK) sync, in which case we still
+ * want to do this.
+ */
+
if (UIConfiguration::instance().get_follow_edits() && ( editor->get_selection().time.front().start == _session->transport_frame() ) ) { //if playhead is exactly at the start of a range, we can assume it was placed there by follow_edits
_session->request_play_range (&editor->get_selection().time, true);
_session->set_requested_return_frame( editor->get_selection().time.front().start ); //force an auto-return here
void
ARDOUR_UI::toggle_session_auto_loop ()
{
+ if (!_session) {
+ return;
+ }
+
Location * looploc = _session->locations()->auto_loop_location();
- if (!_session || !looploc) {
+ if (!looploc) {
return;
}
if ((r = _session->route_by_remote_id (rid)) != 0) {
- Track* t;
+ boost::shared_ptr<Track> t;
- if ((t = dynamic_cast<Track*>(r.get())) != 0) {
- t->set_record_enabled (!t->record_enabled(), this);
+ if ((t = boost::dynamic_pointer_cast<Track>(r)) != 0) {
+ t->set_record_enabled (!t->record_enabled(), Controllable::UseGroup);
}
}
}
}
}
+void
+ARDOUR_UI::quick_snapshot_session (bool switch_to_it)
+{
+ char timebuf[128];
+ time_t n;
+ struct tm local_time;
+
+ time (&n);
+ localtime_r (&n, &local_time);
+ strftime (timebuf, sizeof(timebuf), "%FT%H.%M.%S", &local_time);
+
+ save_state (timebuf, switch_to_it);
+}
+
+
bool
ARDOUR_UI::process_snapshot_session_prompter (ArdourPrompter& prompter, bool switch_to_it)
{
prompter.set_prompt (_("Name of new snapshot"));
}
- if (!switch_to_it) {
+ if (switch_to_it) {
+ prompter.set_initial_text (_session->snap_name());
+ } else {
char timebuf[128];
time_t n;
struct tm local_time;
ARDOUR_UI::load_from_application_api (const std::string& path)
{
ARDOUR_COMMAND_LINE::session_name = path;
+ /* Cancel SessionDialog if it's visible to make OSX delegates work.
+ *
+ * ARDOUR_UI::starting connects app->ShouldLoad signal and then shows a SessionDialog
+ * race-condition:
+ * - ShouldLoad does not arrive in time, ARDOUR_COMMAND_LINE::session_name is empty:
+ * -> ARDOUR_UI::get_session_parameters starts a SessionDialog.
+ * - ShouldLoad signal arrives, this function is called and sets ARDOUR_COMMAND_LINE::session_name
+ * -> SessionDialog is not displayed
+ */
+
+ if (_session_dialog) {
+ std::string session_name = basename_nosuffix (ARDOUR_COMMAND_LINE::session_name);
+ std::string session_path = path;
+ if (Glib::file_test (session_path, Glib::FILE_TEST_IS_REGULAR)) {
+ session_path = Glib::path_get_dirname (session_path);
+ }
+ // signal the existing dialog in ARDOUR_UI::get_session_parameters()
+ _session_dialog->set_provided_session (session_name, session_path);
+ _session_dialog->response (RESPONSE_NONE);
+ _session_dialog->hide();
+ return;
+ }
+ int rv;
if (Glib::file_test (path, Glib::FILE_TEST_IS_DIR)) {
/* /path/to/foo => /path/to/foo, foo */
- load_session (path, basename_nosuffix (path));
+ rv = load_session (path, basename_nosuffix (path));
} else {
/* /path/to/foo/foo.ardour => /path/to/foo, foo */
- load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
+ rv =load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
+ }
+
+ // if load_session fails -> pop up SessionDialog.
+ if (rv) {
+ ARDOUR_COMMAND_LINE::session_name = "";
+
+ if (get_session_parameters (true, false)) {
+ exit (1);
+ }
+
+ goto_editor_window ();
}
}
SessionDialog session_dialog (should_be_new, session_name, session_path, load_template, cancel_not_quit);
+ _session_dialog = &session_dialog;
while (ret != 0) {
if (!ARDOUR_COMMAND_LINE::session_name.empty()) {
switch (session_dialog.run()) {
case RESPONSE_ACCEPT:
break;
+ case RESPONSE_NONE:
+ /* this is used for async * app->ShouldLoad(). */
+ continue; // while loop
+ break;
default:
if (quit_on_cancel) {
// JE - Currently (July 2014) this section can only get reached if the
}
}
+ _session_dialog = NULL;
+
return ret;
}
void
ARDOUR_UI::launch_tracker ()
{
- PBD::open_uri ("http://tracker.ardour.org/bug_report_page.php");
+ PBD::open_uri ("http://tracker.ardour.org");
}
void
}
void
-ARDOUR_UI::TransportControllable::set_value (double val)
+ARDOUR_UI::TransportControllable::set_value (double val, PBD::Controllable::GroupControlDisposition /*group_override*/)
{
if (val < 0.5) {
/* do nothing: these are radio-style actions */