Use central method to check for engine where required
authorRobin Gareus <robin@gareus.org>
Tue, 27 Nov 2018 23:01:50 +0000 (00:01 +0100)
committerRobin Gareus <robin@gareus.org>
Tue, 27 Nov 2018 23:01:50 +0000 (00:01 +0100)
These are generally places where tracks/busses are created or port
connections change.

gtk2_ardour/ardour_ui.cc
gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_ops.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/processor_box.cc
gtk2_ardour/route_ui.cc
gtk2_ardour/sfdb_ui.cc

index 7fcb7c74b59183f3cec59bef8d5ceb54a048a6f0..148bf0317e6b729a62199be96ec81b4bdb7f6707 100644 (file)
@@ -4362,8 +4362,7 @@ ARDOUR_UI::add_route_dialog_response (int r)
                                return;
                }
                add_route_dialog->ArdourDialog::on_response (r);
-               MessageDialog msg (_("Not connected to audio engine - Adding Tracks/Busses is not possible"));
-               msg.run ();
+               ARDOUR_UI_UTILS::no_engine_notify ();
                return;
        }
 
index 72a86808d0aac88ae02c2f4c323206cc170e7922..1f8e81e7aa63a4b20a7a7643838522eb6aef8219 100644 (file)
@@ -373,6 +373,9 @@ Editor::track_canvas_drag_data_received (const RefPtr<Gdk::DragContext>& context
                                         const SelectionData& data,
                                         guint info, guint time)
 {
+       if (ARDOUR_UI_UTILS::no_engine_notify ()) {
+               return;
+       }
        if (data.get_target() == "regions") {
                drop_regions (context, x, y, data, info, time);
        } else {
index 5310eeed337ed104e63abe3a2ed50e51b58927d6..7b8ffca7502c7d4890cccec4fa70ee44e83a26a8 100644 (file)
@@ -1428,8 +1428,7 @@ RegionMoveDrag::finished (GdkEvent* ev, bool movement_occurred)
 RouteTimeAxisView*
 RegionMoveDrag::create_destination_time_axis (boost::shared_ptr<Region> region, TimeAxisView* original)
 {
-       if (!AudioEngine::instance()->running ()) {
-               error << _("Not connected to audio engine - Could not create new track after region placed in the drop zone") << endmsg;
+       if (ARDOUR_UI_UTILS::no_engine_notify ()) {
                return NULL;
        }
 
index 3675a02fc528274cc518d48af57ce669cc178222..e73ea5fab023e61aeac91639f4c2a94f974ab088 100644 (file)
@@ -45,7 +45,6 @@
 #include "widgets/prompter.h"
 
 #include "ardour/audio_track.h"
-#include "ardour/audioengine.h"
 #include "ardour/audioregion.h"
 #include "ardour/boost_debug.h"
 #include "ardour/dB.h"
 #include "transpose_dialog.h"
 #include "transform_dialog.h"
 #include "ui_config.h"
+#include "utils.h"
 #include "vca_time_axis.h"
 
 #include "pbd/i18n.h"
@@ -7421,9 +7421,7 @@ Editor::_remove_tracks ()
                return;
        }
 
-       if (!AudioEngine::instance()->running ()) {
-               MessageDialog msg (_("Not connected to audio engine - Removing Tracks/Busses is not possible"));
-               msg.run ();
+       if (ARDOUR_UI_UTILS::no_engine_notify ()) {
                return;
        }
 
index 7b943859704a6a116e93ba5b049d3ef37bb0cacb..d0404058e280a479bf82f7ee6792313f8f711b09 100644 (file)
@@ -873,9 +873,7 @@ gint
 MixerStrip::output_press (GdkEventButton *ev)
 {
        using namespace Menu_Helpers;
-       if (!_session->engine().connected()) {
-               MessageDialog msg (_("Not connected to audio engine - no I/O changes are possible"));
-               msg.run ();
+       if (ARDOUR_UI_UTILS::no_engine_notify ()) {
                return true;
        }
 
@@ -989,9 +987,7 @@ MixerStrip::input_press (GdkEventButton *ev)
        input_menu.set_name ("ArdourContextMenu");
        citems.clear();
 
-       if (!_session->engine().connected()) {
-               MessageDialog msg (_("Not connected to audio engine - no I/O changes are possible"));
-               msg.run ();
+       if (ARDOUR_UI_UTILS::no_engine_notify ()) {
                return true;
        }
 
index 550bdc28263801a3ea3a7dca57008e28da04917c..2658f575384585ab98bea04b24ed378e2b340d85 100644 (file)
@@ -3720,9 +3720,7 @@ ProcessorBox::get_editor_window (boost::shared_ptr<Processor> processor, bool us
 
        } else if ((port_insert = boost::dynamic_pointer_cast<PortInsert> (processor)) != 0) {
 
-               if (!_session->engine().connected()) {
-                       MessageDialog msg ( _("Not connected to audio engine - no I/O changes are possible"));
-                       msg.run ();
+               if (ARDOUR_UI_UTILS::no_engine_notify ()) {
                        return 0;
                }
 
index f7c4d0cac039a5a54996040cfd280f03ebf21fd8..157bb40a308b7646bc5b5a0b8fdf47dc1a93600b 100644 (file)
@@ -2323,9 +2323,7 @@ RouteUI::manage_pins ()
 void
 RouteUI::fan_out (bool to_busses, bool group)
 {
-       if (!AudioEngine::instance()->running ()) {
-               MessageDialog msg (_("Not connected to audio engine - Fanning out to Tracks/Busses is not possible"));
-               msg.run ();
+       if (ARDOUR_UI_UTILS::no_engine_notify ()) {
                return;
        }
 
index 2c4d5b4db673bd8209a3e2658c3570bacfecead3..9e473e3cc701335d79ef2cbbcce6d6125d2f9bdb 100644 (file)
@@ -2057,7 +2057,7 @@ SoundFileOmega::do_something (int action)
 {
        SoundFileBrowser::do_something (action);
 
-       if (action == RESPONSE_CLOSE) {
+       if (action == RESPONSE_CLOSE || ARDOUR_UI_UTILS::no_engine_notify ()) {
                hide ();
                return;
        }