#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/click_box.h"
#include "gtkmm2ext/fastmeter.h"
-#include "gtkmm2ext/stop_signal.h"
#include "gtkmm2ext/popup.h"
#include "gtkmm2ext/window_title.h"
#include "midi++/manager.h"
#include "ardour/ardour.h"
+#include "ardour/callback.h"
#include "ardour/profile.h"
#include "ardour/session_directory.h"
#include "ardour/session_route.h"
#include "startup.h"
#include "engine_dialog.h"
#include "processor_box.h"
+#include "time_axis_view_item.h"
+#include "window_proxy.h"
+#include "global_port_matrix.h"
+#include "location_ui.h"
#include "i18n.h"
auditioning_alert_button (_("AUDITION")),
solo_alert_button (_("SOLO")),
- shown_flag (false),
error_log_button (_("Errors"))
{
SessionEvent::create_per_thread_pool ("GUI", 512);
} catch (failed_constructor& err) {
- error << _("could not initialize Ardour.") << endmsg;
+ error << string_compose (_("could not initialize %1."), PROGRAM_NAME) << endmsg;
// pass it on up
throw;
}
reset_dpi();
+ TimeAxisViewItem::set_constant_heights ();
+
+ /* The following must happen after ARDOUR::init() so that Config is set up */
+
+ location_ui = new ActionWindowProxy<LocationUIWindow> (X_("locations"), Config->extra_xml (X_("UI")), X_("ToggleLocations"));
+ big_clock_window = new ActionWindowProxy<Gtk::Window> (X_("bigclock"), Config->extra_xml (X_("UI")), X_("ToggleBigClock"));
+
+ for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
+ _global_port_matrix[*i] = new ActionWindowProxy<GlobalPortMatrixWindow> (
+ string_compose ("GlobalPortMatrix-%1", (*i).to_string()),
+ Config->extra_xml (X_("UI")),
+ string_compose ("toggle-%1-connection-manager", (*i).to_string())
+ );
+ }
+
+ setup_clock ();
+
starting.connect (sigc::mem_fun(*this, &ARDOUR_UI::startup));
stopping.connect (sigc::mem_fun(*this, &ARDOUR_UI::shutdown));
/** @return true if a session was chosen and `apply' clicked, otherwise false if `cancel' was clicked */
bool
-ARDOUR_UI::run_startup (bool should_be_new)
+ARDOUR_UI::run_startup (bool should_be_new, string load_template)
{
- if (_startup == 0) {
- _startup = new ArdourStartup ();
- }
-
- XMLNode* audio_setup = Config->extra_xml ("AudioSetup");
+ delete _startup;
+ _startup = new ArdourStartup ();
+ XMLNode* audio_setup = Config->extra_xml ("AudioSetup");
+
if (audio_setup && _startup->engine_control()) {
_startup->engine_control()->set_state (*audio_setup);
}
_startup->set_new_only (should_be_new);
+ if (!load_template.empty()) {
+ _startup->set_load_template( load_template );
+ }
_startup->present ();
main().run();
engine->Stopped.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_stopped, this), gui_context());
engine->Running.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_running, this), gui_context());
- engine->Halted.connect (forever_connections, MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::engine_halted, this), gui_context());
engine->SampleRateChanged.connect (forever_connections, MISSING_INVALIDATOR, ui_bind (&ARDOUR_UI::update_sample_rate, this, _1), gui_context());
+ engine->Halted.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::engine_halted, this, _1, false));
+
+ ARDOUR::Port::set_connecting_blocked (ARDOUR_COMMAND_LINE::no_connect_ports);
+
post_engine ();
return 0;
/* Things to be done once we create the AudioEngine
*/
- MIDI::Manager::instance()->set_api_data (engine->jack());
- setup_midi ();
-
ARDOUR::init_post_engine ();
ActionManager::init ();
void
ARDOUR_UI::startup ()
{
- if (get_session_parameters (true, ARDOUR_COMMAND_LINE::new_session)) {
+
+#ifdef PHONE_HOME
+ call_the_mothership (VERSIONSTRING);
+#endif
+
+ if (get_session_parameters (true, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) {
exit (1);
}
goto_editor_window ();
+ /* Add the window proxies here; their addition may cause windows to be opened, and we want them
+ to be opened on top of the editor window that goto_editor_window() just opened.
+ */
+ add_window_proxy (location_ui);
+ add_window_proxy (big_clock_window);
+ for (ARDOUR::DataType::iterator i = ARDOUR::DataType::begin(); i != ARDOUR::DataType::end(); ++i) {
+ add_window_proxy (_global_port_matrix[*i]);
+ }
+
BootMessage (string_compose (_("%1 is ready for use"), PROGRAM_NAME));
- show ();
}
void
}
+void
+ARDOUR_UI::queue_finish ()
+{
+ Glib::signal_idle().connect (mem_fun (*this, &ARDOUR_UI::idle_finish));
+}
+
+bool
+ARDOUR_UI::idle_finish ()
+{
+ finish ();
+ return false; /* do not call again */
+}
+
void
ARDOUR_UI::finish()
{
if (_session) {
+ int tries = 0;
- if (_session->transport_rolling()) {
- _session->request_stop ();
- usleep (250000);
+ if (_session->transport_rolling() && (++tries < 8)) {
+ _session->request_stop (false, true);
+ usleep (10000);
}
if (_session->dirty()) {
point_one_second_connection.disconnect ();
point_oh_five_second_connection.disconnect ();
point_zero_one_second_connection.disconnect();
-
+ }
+
+ /* Save state before deleting the session, as that causes some
+ windows to be destroyed before their visible state can be
+ saved.
+ */
+ save_ardour_state ();
+
+ if (_session) {
// _session->set_deletion_in_progress ();
+ _session->set_clean ();
_session->remove_pending_capture_state ();
delete _session;
_session = 0;
ArdourDialog::close_all_dialogs ();
engine->stop (true);
- cerr << "Save before quit\n";
- save_ardour_state ();
quit ();
}
int
ARDOUR_UI::ask_about_saving_session (const string & what)
{
- ArdourDialog window (_("ardour: save session?"));
+ ArdourDialog window (_("Unsaved Session"));
Gtk::HBox dhbox; // the hbox for the image and text
Gtk::Label prompt_label;
Gtk::Image* dimage = manage (new Gtk::Image(Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG));
c = _session->capture_load ();
p = _session->playback_load ();
- push_buffer_stats (c, p);
-
snprintf (buf, sizeof (buf), _("Buffers p:%" PRIu32 "%% c:%" PRIu32 "%%"),
_session->playback_load(), _session->capture_load());
buffer_load_label.set_text (buf);
ARDOUR_UI::count_recenabled_streams (Route& route)
{
Track* track = dynamic_cast<Track*>(&route);
- if (track && track->diskstream()->record_enabled()) {
+ if (track && track->record_enabled()) {
rec_enabled_streams += track->n_inputs().n_total();
}
}
catch (...) {
MessageDialog msg (*editor,
- _("There are insufficient JACK ports available\n\
+ string_compose (_("There are insufficient JACK ports available\n\
to create a new track or bus.\n\
-You should save Ardour, exit and\n\
-restart JACK with more ports."));
+You should save %1, exit and\n\
+restart JACK with more ports."), PROGRAM_NAME));
msg.run ();
}
}
catch (...) {
MessageDialog msg (*editor,
- _("There are insufficient JACK ports available\n\
+ string_compose (_("There are insufficient JACK ports available\n\
to create a new track or bus.\n\
-You should save Ardour, exit and\n\
-restart JACK with more ports."));
+You should save %1, exit and\n\
+restart JACK with more ports."), PROGRAM_NAME));
pop_back_splash ();
msg.run ();
}
frames += tmnow.tm_min * (60 * _session->frame_rate());
frames += tmnow.tm_sec * _session->frame_rate();
- _session->request_locate (frames);
+ _session->request_locate (frames, _session->transport_rolling ());
/* force displayed area in editor to start no matter
what "follow playhead" setting is.
return;
}
- _session->request_stop ();
+ _session->request_stop (false, true);
}
void
ARDOUR_UI::transport_stop_and_forget_capture ()
{
if (_session) {
- _session->request_stop (true);
+ _session->request_stop (true, true);
}
}
bool rolling = _session->transport_rolling();
if (_session->get_play_loop()) {
- _session->request_play_loop (false, true);
+ /* XXX it is not possible to just leave seamless loop and keep
+ playing at present (nov 4th 2009)
+ */
+ if (!Config->get_seamless_loop()) {
+ _session->request_play_loop (false, true);
+ }
} else if (_session->get_play_range () && !join_play_range_button.get_active()) {
/* stop playing a range if we currently are */
_session->request_play_range (0, true);
_session->cancel_audition ();
return;
}
-
+
if (_session->config.get_external_sync()) {
switch (_session->config.get_sync_source()) {
case JACK:
_session->request_play_loop (false, true);
} else if (_session->get_play_range ()) {
affect_transport = false;
- _session->request_play_range (0, true);
+ _session->request_play_range (0, true);
}
}
}
void
-ARDOUR_UI::toggle_record_enable (uint32_t dstream)
+ARDOUR_UI::toggle_record_enable (uint32_t rid)
{
if (_session == 0) {
return;
boost::shared_ptr<Route> r;
- if ((r = _session->route_by_remote_id (dstream)) != 0) {
+ if ((r = _session->route_by_remote_id (rid)) != 0) {
Track* t;
if ((t = dynamic_cast<Track*>(r.get())) != 0) {
- t->diskstream()->set_record_enabled (!t->diskstream()->record_enabled());
+ t->set_record_enabled (!t->record_enabled(), this);
}
}
if (_session == 0) {
}
void
-ARDOUR_UI::engine_halted ()
+ARDOUR_UI::engine_halted (const char* reason, bool free_reason)
{
- ENSURE_GUI_THREAD (*this, &ARDOUR_UI::engine_halted)
+ if (!Gtkmm2ext::UI::instance()->caller_is_ui_thread()) {
+ /* we can't rely on the original string continuing to exist when we are called
+ again in the GUI thread, so make a copy and note that we need to
+ free it later.
+ */
+ char *copy = strdup (reason);
+ Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&ARDOUR_UI::engine_halted, this, copy, true));
+ return;
+ }
ActionManager::set_sensitive (ActionManager::jack_sensitive_actions, false);
ActionManager::set_sensitive (ActionManager::jack_opposite_sensitive_actions, true);
update_sample_rate (0);
- MessageDialog msg (*editor,
- _("\
+ string msgstr;
+
+ /* if the reason is a non-empty string, it means that the backend was shutdown
+ rather than just Ardour.
+ */
+
+ if (strlen (reason)) {
+ msgstr = string_compose (_("The audio backend (JACK) was shutdown because:\n\n%1"), reason);
+ } else {
+ msgstr = string_compose (_("\
JACK has either been shutdown or it\n\
-disconnected Ardour because Ardour\n\
+disconnected %1 because %1\n\
was not fast enough. Try to restart\n\
-JACK, reconnect and save the session."));
+JACK, reconnect and save the session."), PROGRAM_NAME);
+ }
+
+ MessageDialog msg (*editor, msgstr);
pop_back_splash ();
msg.run ();
+
+ if (free_reason) {
+ free ((char*) reason);
+ }
}
int32_t
/** Ask the user for the name of a new shapshot and then take it.
*/
+
void
-ARDOUR_UI::snapshot_session ()
+ARDOUR_UI::snapshot_session (bool switch_to_it)
{
ArdourPrompter prompter (true);
string snapname;
- 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);
prompter.set_name ("Prompter");
prompter.add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT);
prompter.set_title (_("Take Snapshot"));
- prompter.set_prompt (_("Name of New Snapshot"));
- prompter.set_initial_text (timebuf);
+ prompter.set_title (_("Take Snapshot"));
+ prompter.set_prompt (_("Name of new snapshot"));
+
+ if (!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);
+ prompter.set_initial_text (timebuf);
+ }
again:
switch (prompter.run()) {
vector<string> n = get_file_names_no_extension (p);
if (find (n.begin(), n.end(), snapname) != n.end()) {
- ArdourDialog confirm (_("Confirm snapshot overwrite"), true);
+ ArdourDialog confirm (_("Confirm Snapshot Overwrite"), true);
Label m (_("A snapshot already exists with that name. Do you want to overwrite it?"));
confirm.get_vbox()->pack_start (m, true, true);
confirm.add_button (Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
}
if (do_save) {
- save_state (snapname);
+ save_state (snapname, switch_to_it);
}
break;
}
}
void
-ARDOUR_UI::save_state (const string & name)
+ARDOUR_UI::save_state (const string & name, bool switch_to_it)
{
- save_state_canfail (name);
+ XMLNode* node = new XMLNode (X_("UI"));
+
+ for (list<WindowProxyBase*>::iterator i = _window_proxies.begin(); i != _window_proxies.end(); ++i) {
+ if (!(*i)->rc_configured()) {
+ node->add_child_nocopy (*((*i)->get_state ()));
+ }
+ }
+
+ _session->add_extra_xml (*node);
+
+ save_state_canfail (name, switch_to_it);
}
int
-ARDOUR_UI::save_state_canfail (string name)
+ARDOUR_UI::save_state_canfail (string name, bool switch_to_it)
{
if (_session) {
int ret;
name = _session->snap_name();
}
- if ((ret = _session->save_state (name)) != 0) {
+ if ((ret = _session->save_state (name, false, switch_to_it)) != 0) {
return ret;
}
}
return;
}
+ if (_session->step_editing()) {
+ return;
+ }
+
Session::RecordState const r = _session->record_status ();
- bool const h = _session->have_rec_enabled_diskstream ();
+ bool const h = _session->have_rec_enabled_track ();
if (r == Session::Enabled || (r == Session::Recording && !h)) {
if (onoff) {
if (!Glib::file_test (fontconfig, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_DIR)) {
MessageDialog msg (*_startup,
- _("Welcome to Ardour.\n\n"
- "The program will take a bit longer to start up\n"
- "while the system fonts are checked.\n\n"
- "This will only be done once, and you will\n"
- "not see this message again\n"),
- true,
+ string_compose (_("Welcome to %1.\n\n"
+ "The program will take a bit longer to start up\n"
+ "while the system fonts are checked.\n\n"
+ "This will only be done once, and you will\n"
+ "not see this message again\n"), PROGRAM_NAME),
+ true,
Gtk::MESSAGE_INFO,
Gtk::BUTTONS_OK);
pop_back_splash ();
msg.set_name (X_("OpenExistingDialog"));
msg.set_title (_("Open Existing Session"));
- msg.set_wmclass (X_("existing_session"), "Ardour");
+ msg.set_wmclass (X_("existing_session"), PROGRAM_NAME);
msg.set_position (Gtk::WIN_POS_MOUSE);
pop_back_splash ();
/** @param quit_on_cancel true if exit() should be called if the user clicks `cancel' in the new session dialog */
int
-ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new)
+ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, string load_template)
{
Glib::ustring session_name;
Glib::ustring session_path;
int ret = -1;
bool likely_new = false;
+ if (! load_template.empty()) {
+ should_be_new = true;
+ template_name = load_template;
+ }
+
while (ret != 0) {
if (!should_be_new && !ARDOUR_COMMAND_LINE::session_name.empty()) {
} else {
- bool const apply = run_startup (should_be_new);
+ bool const apply = run_startup (should_be_new, load_template);
if (!apply) {
if (quit_on_cancel) {
exit (1);
}
ARDOUR_COMMAND_LINE::session_name = "";
- get_session_parameters (true, false);
+
+ if (get_session_parameters (true, false)) {
+ exit (1);
+ }
+
+ goto_editor_window ();
}
int
goto out;
}
+ /* Now the session been created, add the transport controls */
+ new_session->add_controllable(roll_controllable);
+ new_session->add_controllable(stop_controllable);
+ new_session->add_controllable(goto_start_controllable);
+ new_session->add_controllable(goto_end_controllable);
+ new_session->add_controllable(auto_loop_controllable);
+ new_session->add_controllable(play_selection_controllable);
+ new_session->add_controllable(rec_controllable);
+
set_session (new_session);
session_loaded = true;
return 0;
}
-void
-ARDOUR_UI::show ()
-{
- if (editor) {
- editor->show_window ();
-
- if (!shown_flag) {
- editor->present ();
- }
-
- shown_flag = true;
- }
-}
-
void
ARDOUR_UI::launch_chat ()
{
about->show_all ();
}
+void
+ARDOUR_UI::launch_manual ()
+{
+ PBD::open_uri("http://ardour.org/flossmanual");
+}
+
+void
+ARDOUR_UI::launch_reference ()
+{
+ PBD::open_uri("http://ardour.org/refmanual");
+}
+
void
ARDOUR_UI::hide_about ()
{
return;
}
- ArdourDialog results (_("ardour: cleanup"), true, false);
+ ArdourDialog results (_("Clean-up"), true, false);
struct CleanupResultsModelColumns : public Gtk::TreeModel::ColumnRecord {
CleanupResultsModelColumns() {
checker.set_default_response (RESPONSE_CANCEL);
checker.set_name (_("CleanupDialog"));
- checker.set_wmclass (X_("ardour_cleanup"), "Ardour");
+ checker.set_wmclass (X_("ardour_cleanup"), PROGRAM_NAME);
checker.set_position (Gtk::WIN_POS_MOUSE);
switch (checker.run()) {
}
}
-void
-ARDOUR_UI::push_buffer_stats (uint32_t capture, uint32_t playback)
-{
- time_t now;
- time (&now);
-
- while (disk_buffer_stats.size() > 60) {
- disk_buffer_stats.pop_front ();
- }
-
- disk_buffer_stats.push_back (DiskBufferStat (now, capture, playback));
-}
-
-void
-ARDOUR_UI::write_buffer_stats ()
-{
- std::ofstream fout;
- struct tm tm;
- char buf[64];
- char path[PATH_MAX+1]; int fd;
-
- strcpy (path, "ardourBufferingXXXXXX");
-
- if ((fd = mkstemp (path )) < 0) {
- cerr << X_("cannot find temporary name for buffer stats") << endl;
- return;
- }
-
- fout.open (path);
- close (fd);
-
- if (!fout) {
- cerr << string_compose (X_("cannot open file %1 for buffer stats"), path) << endl;
- return;
- }
-
- for (list<DiskBufferStat>::iterator i = disk_buffer_stats.begin(); i != disk_buffer_stats.end(); ++i) {
- localtime_r (&(*i).when, &tm);
- strftime (buf, sizeof (buf), "%T", &tm);
- fout << buf << ' ' << (*i).capture << ' ' << (*i).playback << endl;
- }
-
- disk_buffer_stats.clear ();
-
- fout.close ();
-
- cerr << "buffering statistics can be found in: " << path << endl;
-}
-
void
ARDOUR_UI::disk_overrun_handler ()
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::disk_overrun_handler)
- write_buffer_stats ();
-
if (!have_disk_speed_dialog_displayed) {
have_disk_speed_dialog_displayed = true;
- MessageDialog* msg = new MessageDialog (*editor, _("\
+ MessageDialog* msg = new MessageDialog (*editor, string_compose (_("\
The disk system on your computer\n\
-was not able to keep up with Ardour.\n\
+was not able to keep up with %1.\n\
\n\
Specifically, it failed to write data to disk\n\
-quickly enough to keep up with recording.\n"));
+quickly enough to keep up with recording.\n"), PROGRAM_NAME));
msg->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::disk_speed_dialog_gone), msg));
msg->show ();
}
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::disk_underrun_handler)
- write_buffer_stats ();
-
if (!have_disk_speed_dialog_displayed) {
have_disk_speed_dialog_displayed = true;
MessageDialog* msg = new MessageDialog (*editor,
- _("The disk system on your computer\n\
-was not able to keep up with Ardour.\n\
+ 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\
-quickly enough to keep up with playback.\n"));
+quickly enough to keep up with playback.\n"), PROGRAM_NAME));
msg->signal_response().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::disk_speed_dialog_gone), msg));
msg->show ();
}
void
ARDOUR_UI::use_config ()
{
-
XMLNode* node = Config->extra_xml (X_("TransportControllables"));
if (node) {
set_transport_controllable_state (*node);
}
-
- node = Config->extra_xml (X_("UI"));
-
- if (node) {
- const XMLProperty* prop = node->property (X_("show-big-clock"));
- Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleBigClock"));
- if (act) {
- Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
- tact->set_active (string_is_affirmative (prop->value()));
- }
- }
}
void
secondary_clock.set (pos);
}
- if (big_clock_window) {
+ if (big_clock_window->get()) {
big_clock.set (pos);
}
}
+
+void
+ARDOUR_UI::step_edit_status_change (bool yn)
+{
+ // XXX should really store pre-step edit status of things
+ // we make insensitive
+
+ if (yn) {
+ rec_button.set_visual_state (3);
+ rec_button.set_sensitive (false);
+ } else {
+ rec_button.set_visual_state (0);
+ rec_button.set_sensitive (true);
+ }
+}
+
void
ARDOUR_UI::record_state_changed ()
{
ENSURE_GUI_THREAD (*this, &ARDOUR_UI::record_state_changed);
- if (!_session || !big_clock_window) {
+ if (!_session || !big_clock_window->get()) {
/* why bother - the clock isn't visible */
return;
}
Session::RecordState const r = _session->record_status ();
- bool const h = _session->have_rec_enabled_diskstream ();
+ bool const h = _session->have_rec_enabled_track ();
if (r == Session::Recording && h) {
big_clock.set_widget_name ("BigClockRecording");
}
void
-ARDOUR_UI::TransportControllable::set_value (float val)
+ARDOUR_UI::TransportControllable::set_value (double val)
{
if (type == ShuttleControl) {
double fract;
- if (val == 0.5f) {
+ if (val == 0.5) {
fract = 0.0;
} else {
- if (val < 0.5f) {
- fract = -((0.5f - val)/0.5f);
+ if (val < 0.5) {
+ fract = -((0.5 - val)/0.5);
} else {
- fract = ((val - 0.5f)/0.5f);
+ fract = ((val - 0.5)/0.5);
}
}
return;
}
- if (val < 0.5f) {
+ if (val < 0.5) {
/* do nothing: these are radio-style actions */
return;
}
}
}
-float
+double
ARDOUR_UI::TransportControllable::get_value (void) const
{
- float val = 0.0f;
+ float val = 0.0;
switch (type) {
case Roll:
}
}
+void
+ARDOUR_UI::toggle_translations ()
+{
+ using namespace Glib;
+
+ RefPtr<Action> act = ActionManager::get_action (X_("Main"), X_("EnableTranslation"));
+ if (act) {
+ RefPtr<ToggleAction> ract = RefPtr<ToggleAction>::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);
+ close (fd);
+ } else {
+/* 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,
+ Gtk::MESSAGE_WARNING,
+ Gtk::BUTTONS_OK);
+ win.set_secondary_text (string_compose (_("You must restart %1 for this to take effect."), PROGRAM_NAME));
+ win.set_position (Gtk::WIN_POS_CENTER);
+ win.present ();
+ win.run ();
+ }
+ }
+ }
+}
+
+/** 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
+ * state was saved as `visible'.
+ */
+void
+ARDOUR_UI::add_window_proxy (WindowProxyBase* p)
+{
+ _window_proxies.push_back (p);
+ p->maybe_show ();
+}
+
+/** Remove a window proxy from our list. Must be called if a WindowProxy
+ * is deleted, to prevent hanging pointers.
+ */
+void
+ARDOUR_UI::remove_window_proxy (WindowProxyBase* p)
+{
+ _window_proxies.remove (p);
+}