#include <ardour/audioengine.h>
#include <ardour/playlist.h>
#include <ardour/utils.h>
+#include <ardour/plugin.h>
#include <ardour/audio_diskstream.h>
#include <ardour/audiofilesource.h>
#include <ardour/recent_sessions.h>
shuttle_controllable ("shuttle", *this, TransportControllable::ShuttleControl),
shuttle_controller_binding_proxy (shuttle_controllable),
- roll_button (roll_controllable),
- stop_button (stop_controllable),
- goto_start_button (goto_start_controllable),
- goto_end_button (goto_end_controllable),
- auto_loop_button (auto_loop_controllable),
- play_selection_button (play_selection_controllable),
- rec_button (rec_controllable),
+ roll_button (&roll_controllable),
+ stop_button (&stop_controllable),
+ goto_start_button (&goto_start_controllable),
+ goto_end_button (&goto_end_controllable),
+ auto_loop_button (&auto_loop_controllable),
+ play_selection_button (&play_selection_controllable),
+ rec_button (&rec_controllable),
shuttle_units_button (_("% ")),
session_loaded = false;
last_speed_displayed = -1.0f;
ignore_dual_punch = false;
+ _mixer_on_top = false;
+
+ roll_button.unset_flags (Gtk::CAN_FOCUS);
+ stop_button.unset_flags (Gtk::CAN_FOCUS);
+ goto_start_button.unset_flags (Gtk::CAN_FOCUS);
+ goto_end_button.unset_flags (Gtk::CAN_FOCUS);
+ auto_loop_button.unset_flags (Gtk::CAN_FOCUS);
+ play_selection_button.unset_flags (Gtk::CAN_FOCUS);
+ rec_button.unset_flags (Gtk::CAN_FOCUS);
last_configure_time= 0;
ARDOUR::Diskstream::DiskOverrun.connect (mem_fun(*this, &ARDOUR_UI::disk_overrun_handler));
ARDOUR::Diskstream::DiskUnderrun.connect (mem_fun(*this, &ARDOUR_UI::disk_underrun_handler));
+ ARDOUR::Plugin::PresetFileExists.connect (mem_fun(*this, &ARDOUR_UI::preset_file_exists_handler));
+
/* handle dialog requests */
ARDOUR::Session::Dialog.connect (mem_fun(*this, &ARDOUR_UI::session_dialog));
/* set default clock modes */
if (Profile->get_sae()) {
- primary_clock.set_mode (AudioClock::MinSec);
+ primary_clock.set_mode (AudioClock::BBT);
+ secondary_clock.set_mode (AudioClock::MinSec);
} else {
primary_clock.set_mode (AudioClock::SMPTE);
+ secondary_clock.set_mode (AudioClock::BBT);
}
- secondary_clock.set_mode (AudioClock::BBT);
/* start the time-of-day-clock */
ARDOUR_UI::startup ()
{
string name, path;
-
+
new_session_dialog = new NewSessionDialog();
bool backend_audio_is_running = EngineControl::engine_running();
session->set_deletion_in_progress ();
}
+ ArdourDialog::close_all_dialogs ();
engine->stop (true);
save_ardour_state ();
quit ();
}
void
-ARDOUR_UI::transport_goto_start ()
+ARDOUR_UI::transport_goto_start ()
{
if (session) {
session->goto_start();
_("\
JACK has either been shutdown or it\n\
disconnected Ardour because Ardour\n\
-was not fast enough. You can save the\n\
-session and/or try to reconnect to JACK ."));
+was not fast enough. Try to restart\n\
+JACK, reconnect and save the session."));
pop_back_splash ();
msg.run ();
}
}
}
-gint
-ARDOUR_UI::hide_and_quit (GdkEventAny *ev, ArdourDialog *window)
-{
- window->hide();
- Gtk::Main::quit ();
- return TRUE;
-}
-
void
ARDOUR_UI::save_template ()
splash->message (msg);
flush_pending ();
}
-
+
void
ARDOUR_UI::idle_load (const Glib::ustring& path)
{
load_session (Glib::path_get_dirname (path), basename_nosuffix (path));
}
} else {
+
ARDOUR_COMMAND_LINE::session_name = path;
+
if (new_session_dialog) {
+
+
/* make it break out of Dialog::run() and
start again.
*/
+
new_session_dialog->response (1);
}
}
case Gtk::RESPONSE_CANCEL:
case Gtk::RESPONSE_DELETE_EVENT:
if (!session) {
+ if (engine && engine->running()) {
+ engine->stop (true);
+ }
quit();
}
new_session_dialog->hide ();
if (session_name[0] == '/' ||
(session_name.length() > 2 && session_name[0] == '.' && session_name[1] == '/') ||
(session_name.length() > 3 && session_name[0] == '.' && session_name[1] == '.' && session_name[2] == '/')) {
-
+
session_path = Glib::path_get_dirname (session_name);
session_name = Glib::path_get_basename (session_name);
loadit:
new_session_dialog->hide ();
-
+
if (load_session (session_path, session_name, template_name)) {
/* force a retry */
response = Gtk::RESPONSE_NONE;
MessageDialog msg (err.what(),
true,
Gtk::MESSAGE_INFO,
- Gtk::BUTTONS_OK_CANCEL);
+ Gtk::BUTTONS_CLOSE);
- msg.set_title (_("Loading Error"));
- msg.set_secondary_text (_("Click the OK button to try again."));
+ msg.set_title (_("Port Registration Error"));
+ msg.set_secondary_text (_("Click the Close button to try again."));
msg.set_position (Gtk::WIN_POS_CENTER);
pop_back_splash ();
msg.present ();
MessageDialog msg (string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"), path, snap_name),
true,
Gtk::MESSAGE_INFO,
- Gtk::BUTTONS_OK_CANCEL);
+ Gtk::BUTTONS_CLOSE);
msg.set_title (_("Loading Error"));
- msg.set_secondary_text (_("Click the OK button to try again."));
+ msg.set_secondary_text (_("Click the Close button to try again."));
msg.set_position (Gtk::WIN_POS_CENTER);
pop_back_splash ();
msg.present ();
connect_to_session (new_session);
session_loaded = true;
+
+ new_session->save_state(new_session->name());
+
return 0;
}
return;
}
+ string template_path = add_route_dialog->track_template();
+
+ if (!template_path.empty()) {
+ session->new_route_from_template (count, template_path);
+ return;
+ }
+
uint32_t input_chan = add_route_dialog->channels ();
uint32_t output_chan;
string name_template = add_route_dialog->name_template ();
/* XXX do something with name template */
- cerr << "Adding with " << input_chan << " in and " << output_chan << "out\n";
-
if (track) {
session_add_audio_track (input_chan, output_chan, add_route_dialog->mode(), count);
} else {
} else {
node = Config->instant_xml(X_("Editor"), get_user_ardour_path());
}
+
+ if (!node) {
+ if (getenv("ARDOUR_INSTANT_XML_PATH")) {
+ node = Config->instant_xml(X_("Editor"), getenv("ARDOUR_INSTANT_XML_PATH"));
+ }
+ }
if (!node) {
node = new XMLNode (X_("Editor"));
void
ARDOUR_UI::create_xrun_marker(nframes_t where)
{
- ENSURE_GUI_THREAD (bind(mem_fun(*this, &ARDOUR_UI::create_xrun_marker), where));
editor->mouse_add_new_marker (where, false, true);
}
void
ARDOUR_UI::xrun_handler(nframes_t where)
{
- if (Config->get_create_xrun_marker() && session->actively_recording()) {
+ if (!session) {
+ return;
+ }
+
+ ENSURE_GUI_THREAD (bind(mem_fun(*this, &ARDOUR_UI::xrun_handler), where));
+
+ if (session && Config->get_create_xrun_marker() && session->actively_recording()) {
create_xrun_marker(where);
}
- if (Config->get_stop_recording_on_xrun() && session->actively_recording()) {
+ if (session && Config->get_stop_recording_on_xrun() && session->actively_recording()) {
halt_on_xrun_message ();
}
}
+bool
+ARDOUR_UI::preset_file_exists_handler ()
+{
+ /* if driven from another thread, say "do not overwrite" and show the user nothing.
+ */
+
+ if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) { \
+ return false;
+ }
+
+ HBox* hbox = new HBox();
+ Image* image = new Image (Stock::DIALOG_QUESTION, ICON_SIZE_DIALOG);
+ Gtk::Dialog dialog (_("Preset Exists"), true, false);
+ Label message (_("\
+A preset with this name already exists for this plugin.\n\
+\n\
+What you would like to do?\n"));
+ image->set_alignment(ALIGN_CENTER, ALIGN_TOP);
+ hbox->pack_start (*image, PACK_EXPAND_WIDGET, 12);
+ hbox->pack_end (message, PACK_EXPAND_PADDING, 12);
+ dialog.get_vbox()->pack_start(*hbox, PACK_EXPAND_PADDING, 6);
+ dialog.add_button (_("Overwrite the existing preset"), RESPONSE_ACCEPT);
+ dialog.add_button (_("Leave the existing preset alone"), RESPONSE_REJECT);
+ dialog.set_default_response (RESPONSE_ACCEPT);
+ dialog.set_position (WIN_POS_MOUSE);
+ dialog.set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY); // need to make it float above the preset name dialog
+
+ message.show();
+ image->show();
+ hbox->show();
+
+ switch (dialog.run ()) {
+ case RESPONSE_ACCEPT:
+ return true;
+ default:
+ return false;
+ }
+}
+
void
ARDOUR_UI::disk_overrun_handler ()
{