X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui.cc;h=bfe8458b62b029a888238af4fa0dc677fb0dee4a;hb=7590b859fd0f836c624394c674aac09f812b3cfb;hp=e969f31cf13a266c14d18221ff2d8721be5c507a;hpb=a8fbb47e0ae9a27a78a00e68117139e1cc5993f0;p=ardour.git diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index e969f31cf1..bfe8458b62 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -80,33 +80,35 @@ typedef uint64_t microseconds_t; +#include "about.h" #include "actions.h" +#include "add_route_dialog.h" +#include "ambiguous_file_dialog.h" #include "ardour_ui.h" -#include "public_editor.h" #include "audio_clock.h" +#include "bundle_manager.h" +#include "engine_dialog.h" +#include "gain_meter.h" +#include "global_port_matrix.h" +#include "gui_thread.h" #include "keyboard.h" +#include "location_ui.h" +#include "missing_file_dialog.h" +#include "missing_plugin_dialog.h" #include "mixer_ui.h" -#include "prompter.h" #include "opts.h" -#include "add_route_dialog.h" -#include "about.h" -#include "splash.h" -#include "utils.h" -#include "gui_thread.h" -#include "theme_manager.h" -#include "bundle_manager.h" -#include "session_metadata_dialog.h" -#include "gain_meter.h" +#include "processor_box.h" +#include "prompter.h" +#include "public_editor.h" #include "route_time_axis.h" +#include "session_metadata_dialog.h" +#include "speaker_dialog.h" +#include "splash.h" #include "startup.h" -#include "engine_dialog.h" -#include "processor_box.h" +#include "theme_manager.h" #include "time_axis_view_item.h" +#include "utils.h" #include "window_proxy.h" -#include "global_port_matrix.h" -#include "location_ui.h" -#include "missing_file_dialog.h" -#include "missing_plugin_dialog.h" #include "i18n.h" @@ -121,7 +123,7 @@ UIConfiguration *ARDOUR_UI::ui_config = 0; sigc::signal ARDOUR_UI::Blink; sigc::signal ARDOUR_UI::RapidScreenUpdate; sigc::signal ARDOUR_UI::SuperRapidScreenUpdate; -sigc::signal ARDOUR_UI::Clock; +sigc::signal ARDOUR_UI::Clock; bool could_be_a_valid_path (const string& path); @@ -175,7 +177,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) auditioning_alert_button (_("AUDITION")), solo_alert_button (_("SOLO")), - _menu_bar_clock (X_("menu_bar"), false, X_("MenuBarClock"), true, true, false, false), error_log_button (_("Errors")) @@ -275,6 +276,10 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) ARDOUR::Session::MissingFile.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::missing_file, this, _1, _2, _3)); + /* and ambiguous files */ + + ARDOUR::FileSource::AmbiguousFileName.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::ambiguous_file, this, _1, _2, _3)); + /* lets get this party started */ try { @@ -313,6 +318,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) location_ui = new ActionWindowProxy (X_("locations"), Config->extra_xml (X_("UI")), X_("ToggleLocations")); big_clock_window = new ActionWindowProxy (X_("bigclock"), Config->extra_xml (X_("UI")), X_("ToggleBigClock")); + speaker_config_window = new ActionWindowProxy (X_("speakerconf"), Config->extra_xml (X_("UI")), X_("toggle-speaker-config")); for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) { _global_port_matrix[*i] = new ActionWindowProxy ( @@ -323,6 +329,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) } setup_clock (); + speaker_config_window->set (new SpeakerDialog); starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup)); stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown)); @@ -415,10 +422,11 @@ ARDOUR_UI::post_engine () if (ARDOUR_COMMAND_LINE::show_key_actions) { vector names; vector paths; + vector tooltips; vector keys; vector bindings; - ActionManager::get_all_actions (names, paths, keys, bindings); + ActionManager::get_all_actions (names, paths, tooltips, keys, bindings); vector::iterator n; vector::iterator k; @@ -952,7 +960,7 @@ ARDOUR_UI::every_point_zero_one_seconds () } void -ARDOUR_UI::update_sample_rate (nframes_t) +ARDOUR_UI::update_sample_rate (framecnt_t) { char buf[32]; @@ -964,14 +972,14 @@ ARDOUR_UI::update_sample_rate (nframes_t) } else { - nframes_t rate = engine->frame_rate(); + framecnt_t rate = engine->frame_rate(); if (fmod (rate, 1000.0) != 0.0) { snprintf (buf, sizeof (buf), _("%.1f kHz / %4.1f ms"), (float) rate/1000.0f, (engine->frames_per_cycle() / (float) rate) * 1000.0f); } else { - snprintf (buf, sizeof (buf), _("%u kHz / %4.1f ms"), + snprintf (buf, sizeof (buf), _("%" PRId64 " kHz / %4.1f ms"), rate/1000, (engine->frames_per_cycle() / (float) rate) * 1000.0f); } @@ -1024,7 +1032,7 @@ ARDOUR_UI::update_disk_space() framecnt_t frames = _session->available_capture_duration(); char buf[64]; - nframes_t fr = _session->frame_rate(); + framecnt_t fr = _session->frame_rate(); if (frames == max_framecnt) { strcpy (buf, _("Disk: 24hrs+")); @@ -1326,7 +1334,7 @@ ARDOUR_UI::open_session () void -ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t how_many) +ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t how_many, string const & name_template) { list > tracks; @@ -1338,7 +1346,7 @@ ARDOUR_UI::session_add_midi_route (bool disk, RouteGroup* route_group, uint32_t try { if (disk) { - tracks = _session->new_midi_track (ARDOUR::Normal, route_group, how_many); + tracks = _session->new_midi_track (ARDOUR::Normal, route_group, how_many, name_template); if (tracks.size() != how_many) { if (how_many == 1) { @@ -1366,7 +1374,15 @@ restart JACK with more ports."), PROGRAM_NAME)); void -ARDOUR_UI::session_add_audio_route (bool track, bool aux, int32_t input_channels, int32_t output_channels, ARDOUR::TrackMode mode, RouteGroup* route_group, uint32_t how_many) +ARDOUR_UI::session_add_audio_route ( + bool track, + int32_t input_channels, + int32_t output_channels, + ARDOUR::TrackMode mode, + RouteGroup* route_group, + uint32_t how_many, + string const & name_template + ) { list > tracks; RouteList routes; @@ -1378,7 +1394,7 @@ ARDOUR_UI::session_add_audio_route (bool track, bool aux, int32_t input_channels try { if (track) { - tracks = _session->new_audio_track (input_channels, output_channels, mode, route_group, how_many); + tracks = _session->new_audio_track (input_channels, output_channels, mode, route_group, how_many, name_template); if (tracks.size() != how_many) { if (how_many == 1) { @@ -1391,7 +1407,7 @@ ARDOUR_UI::session_add_audio_route (bool track, bool aux, int32_t input_channels } else { - routes = _session->new_audio_route (aux, input_channels, output_channels, route_group, how_many); + routes = _session->new_audio_route (input_channels, output_channels, route_group, how_many, name_template); if (routes.size() != how_many) { if (how_many == 1) { @@ -1415,9 +1431,9 @@ restart JACK with more ports."), PROGRAM_NAME)); } void -ARDOUR_UI::do_transport_locate (nframes_t new_position, bool with_roll) +ARDOUR_UI::do_transport_locate (framepos_t new_position, bool with_roll) { - nframes_t _preroll = 0; + framecnt_t _preroll = 0; if (_session) { // XXX CONFIG_CHANGE FIX - requires AnyTime handling @@ -1497,7 +1513,7 @@ void ARDOUR_UI::transport_goto_end () { if (_session) { - nframes_t const frame = _session->current_end_frame(); + framepos_t const frame = _session->current_end_frame(); _session->request_locate (frame); /* force displayed area in editor to start no matter @@ -1583,7 +1599,8 @@ ARDOUR_UI::transport_roll () if (_session->is_auditioning()) { return; } - + +#if 0 if (_session->config.get_external_sync()) { switch (_session->config.get_sync_source()) { case JACK: @@ -1593,6 +1610,7 @@ ARDOUR_UI::transport_roll () return; } } +#endif bool rolling = _session->transport_rolling(); @@ -1630,6 +1648,7 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode) return; } +#if 0 if (_session->config.get_external_sync()) { switch (_session->config.get_sync_source()) { case JACK: @@ -1639,6 +1658,7 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode) return; } } +#endif bool rolling = _session->transport_rolling(); bool affect_transport = true; @@ -1679,21 +1699,30 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode) void ARDOUR_UI::toggle_session_auto_loop () { - if (_session) { - if (_session->get_play_loop()) { - if (_session->transport_rolling()) { - Location * looploc = _session->locations()->auto_loop_location(); - if (looploc) { - _session->request_locate (looploc->start(), true); - } - } else { - _session->request_play_loop (false); - } - } else { + if (!_session) { + return; + } + + if (_session->get_play_loop()) { + + if (_session->transport_rolling()) { + Location * looploc = _session->locations()->auto_loop_location(); + if (looploc) { - _session->request_play_loop (true); + _session->request_locate (looploc->start(), true); + _session->request_play_loop (false); } + + } else { + _session->request_play_loop (false); + } + } else { + + Location * looploc = _session->locations()->auto_loop_location(); + + if (looploc) { + _session->request_play_loop (true); } } } @@ -2218,8 +2247,8 @@ ARDOUR_UI::save_template () } prompter.set_name (X_("Prompter")); - prompter.set_title (_("Save Mix Template")); - prompter.set_prompt (_("Name for mix template:")); + prompter.set_title (_("Save Template")); + prompter.set_prompt (_("Name for template:")); prompter.set_initial_text(_session->name() + _("-template")); prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); @@ -2625,6 +2654,12 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri } else { ret = load_session (session_path, session_name, template_name); + + if (ret == -2) { + /* not connected to the AudioEngine, so quit to avoid an infinite loop */ + exit (1); + } + if (!ARDOUR_COMMAND_LINE::immediate_save.empty()) { _session->save_state (ARDOUR_COMMAND_LINE::immediate_save, false); exit (1); @@ -2655,6 +2690,7 @@ ARDOUR_UI::close_session() goto_editor_window (); } +/** @return -2 if the load failed because we are not connected to the AudioEngine */ int ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, std::string mix_template) { @@ -2665,7 +2701,7 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, session_loaded = false; if (!check_audioengine()) { - return -1; + return -2; } unload_status = unload_session (); @@ -2677,7 +2713,7 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, goto out; } - loading_message (string_compose (_("Please wait while %1loads your session"), PROGRAM_NAME)); + loading_message (string_compose (_("Please wait while %1 loads your session"), PROGRAM_NAME)); try { new_session = new Session (*engine, path, snap_name, 0, mix_template); @@ -2819,6 +2855,13 @@ ARDOUR_UI::build_session (const std::string& path, const std::string& snap_name, new_session->add_instant_xml (*n, false); } + /* Put the playhead at 0 and scroll fully left */ + n = new_session->instant_xml (X_("Editor")); + if (n) { + n->add_property (X_("playhead"), X_("0")); + n->add_property (X_("left-frame"), X_("0")); + } + set_session (new_session); session_loaded = true; @@ -3170,7 +3213,6 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) uint32_t output_chan; string name_template = add_route_dialog->name_template (); bool track = add_route_dialog->track (); - bool aux = !track && add_route_dialog->aux(); RouteGroup* route_group = add_route_dialog->route_group (); AutoConnectOption oac = Config->get_output_auto_connect(); @@ -3185,7 +3227,7 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) if (add_route_dialog->type() == ARDOUR::DataType::MIDI) { if (track) { - session_add_midi_track (route_group, count); + session_add_midi_track (route_group, count, name_template); } else { MessageDialog msg (*editor, _("Sorry, MIDI Busses are not supported at this time.")); @@ -3194,9 +3236,9 @@ ARDOUR_UI::add_route (Gtk::Window* float_window) } } else { if (track) { - session_add_audio_track (input_chan, output_chan, add_route_dialog->mode(), route_group, count); + session_add_audio_track (input_chan, output_chan, add_route_dialog->mode(), route_group, count, name_template); } else { - session_add_audio_bus (aux, input_chan, output_chan, route_group, count); + session_add_audio_bus (input_chan, output_chan, route_group, count, name_template); } } } @@ -3257,7 +3299,7 @@ ARDOUR_UI::keyboard_settings () const } void -ARDOUR_UI::create_xrun_marker(nframes_t where) +ARDOUR_UI::create_xrun_marker (framepos_t where) { editor->mouse_add_new_marker (where, false, true); } @@ -3271,7 +3313,7 @@ ARDOUR_UI::halt_on_xrun_message () } void -ARDOUR_UI::xrun_handler(nframes_t where) +ARDOUR_UI::xrun_handler (framepos_t where) { if (!_session) { return; @@ -3384,7 +3426,7 @@ what you would like to do.\n")); } int -ARDOUR_UI::sr_mismatch_dialog (nframes_t desired, nframes_t actual) +ARDOUR_UI::sr_mismatch_dialog (framecnt_t desired, framecnt_t actual) { HBox* hbox = new HBox(); Image* image = new Image (Stock::DIALOG_QUESTION, ICON_SIZE_DIALOG); @@ -3451,7 +3493,7 @@ ARDOUR_UI::use_config () } void -ARDOUR_UI::update_transport_clocks (nframes_t pos) +ARDOUR_UI::update_transport_clocks (framepos_t pos) { if (Config->get_primary_clock_delta_edit_cursor()) { primary_clock.set (pos, false, editor->get_preferred_edit_position(), 1); @@ -3734,3 +3776,15 @@ ARDOUR_UI::missing_file (Session*s, std::string str, DataType type) return result; } + +int +ARDOUR_UI::ambiguous_file (std::string file, std::string path, std::vector hits) +{ + AmbiguousFileDialog dialog (file, hits); + + dialog.show (); + dialog.present (); + + dialog.run (); + return dialog.get_which (); +}