X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui.cc;h=eefef2b329f615dad20068ac0c509d955a327aa3;hb=40e2a6b16b47acf1f19a31f5e6d1cd463c45e1b6;hp=9ae8a6264837a0c20b4c34904b82fe9da285c9c0;hpb=fee370943854ff99aba1794382b6700b9feeb751;p=ardour.git diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 9ae8a62648..eefef2b329 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -49,6 +49,7 @@ #include "pbd/file_utils.h" #include "gtkmm2ext/application.h" +#include "gtkmm2ext/bindings.h" #include "gtkmm2ext/gtk_ui.h" #include "gtkmm2ext/utils.h" #include "gtkmm2ext/click_box.h" @@ -305,11 +306,15 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) keyboard = new ArdourKeyboard(*this); + XMLNode* node = ARDOUR_UI::instance()->keyboard_settings(); if (node) { keyboard->set_state (*node, Stateful::loading_state_version); } + /* we don't like certain modifiers */ + Bindings::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK); + reset_dpi(); TimeAxisViewItem::set_constant_heights (); @@ -329,7 +334,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[]) } setup_clock (); - speaker_config_window->set (new SpeakerDialog); + speaker_config_window->set (new SpeakerDialog); starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup)); stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown)); @@ -422,10 +427,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; @@ -756,15 +762,15 @@ ARDOUR_UI::check_memory_locking () if (ram == 0 || ((double) limits.rlim_cur / ram) < 0.75) { - MessageDialog msg ( - string_compose (_("WARNING: Your system has a limit for maximum amount of locked memory. " - "This might cause %1 to run out of memory before your system " - "runs out of memory. \n\n" - "You can view the memory limit with 'ulimit -l', " - "and it is normally controlled by /etc/security/limits.conf"), - PROGRAM_NAME).c_str()); - + string_compose ( + _("WARNING: Your system has a limit for maximum amount of locked memory. " + "This might cause %1 to run out of memory before your system " + "runs out of memory. \n\n" + "You can view the memory limit with 'ulimit -l', " + "and it is normally controlled by /etc/security/limits.conf"), + PROGRAM_NAME).c_str()); + VBox* vbox = msg.get_vbox(); HBox hbox; CheckButton cb (_("Do not show this window again")); @@ -1268,9 +1274,10 @@ ARDOUR_UI::check_audioengine () { if (engine) { if (!engine->connected()) { - MessageDialog msg (string_compose (_("%1 is not connected to JACK\n" - "You cannot open or close sessions in this condition"), - PROGRAM_NAME)); + MessageDialog msg (string_compose ( + _("%1 is not connected to JACK\n" + "You cannot open or close sessions in this condition"), + PROGRAM_NAME)); pop_back_splash (); msg.run (); return false; @@ -1333,7 +1340,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; @@ -1345,7 +1352,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) { @@ -1373,7 +1380,15 @@ restart JACK with more ports."), PROGRAM_NAME)); void -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) +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; @@ -1385,7 +1400,7 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t 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) { @@ -1398,7 +1413,7 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t } else { - routes = _session->new_audio_route (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) { @@ -1639,7 +1654,6 @@ 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: @@ -1649,7 +1663,6 @@ ARDOUR_UI::toggle_roll (bool with_abort, bool roll_out_of_bounded_mode) return; } } -#endif bool rolling = _session->transport_rolling(); bool affect_transport = true; @@ -2083,7 +2096,7 @@ ARDOUR_UI::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%T", &local_time); @@ -2238,8 +2251,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); @@ -2427,7 +2440,7 @@ ARDOUR_UI::build_session_from_nsd (const std::string& session_path, const std::s } /// @todo some minor tweaks. - + bus_profile.output_ac = AutoConnectOption (0); if (_startup->connect_outputs ()) { @@ -2566,7 +2579,7 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri /* absolute path or cwd-relative path specified for session name: infer session folder from what was given. */ - + session_path = Glib::path_get_dirname (session_name); session_name = Glib::path_get_basename (session_name); @@ -2575,16 +2588,18 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri session_path = _startup->session_folder(); if (session_name.find ('/') != string::npos) { - MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n" - "session names may not contain a '/' character")); + MessageDialog msg (*_startup, + _("To ensure compatibility with various systems\n" + "session names may not contain a '/' character")); msg.run (); ARDOUR_COMMAND_LINE::session_name = ""; // cancel that continue; } - + if (session_name.find ('\\') != string::npos) { - MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n" - "session names may not contain a '\\' character")); + MessageDialog msg (*_startup, + _("To ensure compatibility with various systems\n" + "session names may not contain a '\\' character")); msg.run (); ARDOUR_COMMAND_LINE::session_name = ""; // cancel that continue; @@ -2620,16 +2635,18 @@ ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, stri } if (session_name.find ('/') != std::string::npos) { - MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n" - "session names may not contain a '/' character")); + MessageDialog msg (*_startup, + _("To ensure compatibility with various systems\n" + "session names may not contain a '/' character")); msg.run (); ARDOUR_COMMAND_LINE::session_name = ""; // cancel that continue; } if (session_name.find ('\\') != std::string::npos) { - MessageDialog msg (*_startup, _("To ensure compatibility with various systems\n" - "session names may not contain a '\\' character")); + MessageDialog msg (*_startup, + _("To ensure compatibility with various systems\n" + "session names may not contain a '\\' character")); msg.run (); ARDOUR_COMMAND_LINE::session_name = ""; // cancel that continue; @@ -2645,6 +2662,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); @@ -2675,6 +2698,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) { @@ -2685,7 +2709,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 (); @@ -2697,7 +2721,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); @@ -2733,7 +2757,9 @@ ARDOUR_UI::load_session (const std::string& path, const std::string& snap_name, catch (...) { - MessageDialog msg (string_compose(_("Session \"%1 (snapshot %2)\" did not load successfully"),path, snap_name), + MessageDialog msg (string_compose( + _("Session \"%1 (snapshot %2)\" did not load successfully"), + path, snap_name), true, Gtk::MESSAGE_INFO, BUTTONS_OK); @@ -2940,7 +2966,7 @@ ARDOUR_UI::display_cleanup_results (ARDOUR::CleanupReport& rep, const gchar* lis if (removed == 0) { MessageDialog msgd (*editor, - _("No audio files were ready for cleanup"), + _("No files were ready for cleanup"), true, Gtk::MESSAGE_INFO, (Gtk::ButtonsType)(Gtk::BUTTONS_OK) ); @@ -2987,11 +3013,11 @@ require some unused files to continue to exist.")); dimage->set_alignment(ALIGN_LEFT, ALIGN_TOP); - const string dead_sound_directory = _session->session_directory().dead_sound_path().to_string(); + const string dead_directory = _session->session_directory().dead_path().to_string(); /* subst: %1 - number of files removed - %2 - location of "dead_sounds" + %2 - location of "dead" %3 - size of files affected %4 - prefix for "bytes" to produce sensible results (e.g. mega, kilo, giga) */ @@ -2999,20 +3025,24 @@ require some unused files to continue to exist.")); const char* bprefix; double space_adjusted = 0; - if (rep.space < 100000.0f) { + if (rep.space < 1000) { + bprefix = X_(""); + space_adjusted = rep.space; + } else if (rep.space < 1000000) { bprefix = X_("kilo"); - } else if (rep.space < 1000000.0f * 1000) { - bprefix = X_("mega"); space_adjusted = truncf((float)rep.space / 1000.0); + } else if (rep.space < 1000000 * 1000) { + bprefix = X_("mega"); + space_adjusted = truncf((float)rep.space / (1000.0 * 1000.0)); } else { bprefix = X_("giga"); - space_adjusted = truncf((float)rep.space / (1000000.0 * 1000)); + space_adjusted = truncf((float)rep.space / (1000.0 * 1000 * 1000.0)); } if (removed > 1) { - txt.set_text (string_compose (plural_msg, removed, _session->path() + "dead_sounds", space_adjusted, bprefix)); + txt.set_text (string_compose (plural_msg, removed, dead_directory, space_adjusted, bprefix)); } else { - txt.set_text (string_compose (singular_msg, removed, _session->path() + "dead_sounds", space_adjusted, bprefix)); + txt.set_text (string_compose (singular_msg, removed, dead_directory, space_adjusted, bprefix)); } dhbox.pack_start (*dimage, true, false, 5); @@ -3068,8 +3098,7 @@ ARDOUR_UI::cleanup () checker.set_secondary_text(_("Cleanup is a destructive operation.\n\ ALL undo/redo information will be lost if you cleanup.\n\ -After cleanup, unused audio files will be moved to a \ -\"dead sounds\" location.")); +Cleanup will move all unused files to a \"dead\" location.")); checker.add_button (Stock::CANCEL, RESPONSE_CANCEL); checker.add_button (_("Clean Up"), RESPONSE_ACCEPT); @@ -3109,17 +3138,19 @@ After cleanup, unused audio files will be moved to a \ _("cleaned files"), _("\ The following %1 files were not in use and \n\ -have been moved to:\n\ -%2. \n\n\ -Flushing the wastebasket will \n\ -release an additional\n\ +have been moved to:\n\n\ +%2\n\n\ +After a restart of Ardour,\n\n\ +Session -> Cleanup -> Flush Wastebasket\n\n\ +will release an additional\n\ %3 %4bytes of disk space.\n"), _("\ The following file was not in use and \n \ has been moved to:\n \ -%2. \n\n\ -Flushing the wastebasket will \n\ -release an additional\n\ +%2\n\n\ +After a restart of Ardour,\n\n\ +Session -> Cleanup -> Flush Wastebasket\n\n\ +will release an additional\n\ %3 %4bytes of disk space.\n" )); @@ -3211,7 +3242,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.")); @@ -3220,9 +3251,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 (input_chan, output_chan, route_group, count); + session_add_audio_bus (input_chan, output_chan, route_group, count, name_template); } } } @@ -3279,6 +3310,7 @@ ARDOUR_UI::keyboard_settings () const if (!node) { node = new XMLNode (X_("Keyboard")); } + return node; } @@ -3339,8 +3371,8 @@ ARDOUR_UI::disk_underrun_handler () if (!have_disk_speed_dialog_displayed) { have_disk_speed_dialog_displayed = true; - MessageDialog* msg = new MessageDialog (*editor, - string_compose (_("The disk system on your computer\n\ + MessageDialog* msg = new MessageDialog ( + *editor, string_compose (_("The disk system on your computer\n\ was not able to keep up with %1.\n\ \n\ Specifically, it failed to read data from disk\n\ @@ -3685,16 +3717,16 @@ void ARDOUR_UI::toggle_translations () { using namespace Glib; - + RefPtr act = ActionManager::get_action (X_("Main"), X_("EnableTranslation")); if (act) { RefPtr ract = RefPtr::cast_dynamic (act); if (ract) { - + string i18n_killer = ARDOUR::translation_kill_path(); - + bool already_enabled = !ARDOUR::translations_are_disabled (); - + if (ract->get_active ()) { /* we don't care about errors */ int fd = ::open (i18n_killer.c_str(), O_RDONLY|O_CREAT, 0644); @@ -3703,7 +3735,7 @@ ARDOUR_UI::toggle_translations () /* we don't care about errors */ unlink (i18n_killer.c_str()); } - + if (already_enabled != ract->get_active()) { MessageDialog win (already_enabled ? _("Translations disabled") : _("Translations enabled"), false, @@ -3716,7 +3748,7 @@ ARDOUR_UI::toggle_translations () } } } -} +} /** Add a window proxy to our list, so that its state will be saved. * This call also causes the window to be created and opened if its