factor out "new route insertion point" enums so they can be shared by relevant dialogs
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Aug 2016 12:40:12 +0000 (08:40 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Aug 2016 12:40:12 +0000 (08:40 -0400)
gtk2_ardour/add_route_dialog.cc
gtk2_ardour/add_route_dialog.h
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/route_dialogs.h [new file with mode: 0644]

index 90ccff58f77d23b7254c18085df146ebd957f3ca..a18ca05adc8f33cf090635863f52a68d5fe38d24 100644 (file)
@@ -614,9 +614,11 @@ AddRouteDialog::new_group_dialog_finished (int r, RouteGroupDialog* d)
        delete_when_idle (d);
 }
 
-AddRouteDialog::InsertAt
+RouteDialogs::InsertAt
 AddRouteDialog::insert_at ()
 {
+       using namespace RouteDialogs;
+
        std::string str = insert_at_combo.get_active_text();
 
        if (str == _("First")) {
index 685622029516d3c8e6763f1e8f89509d5613c9a8..1a571039260211a14e3ba2ba132f4bbd1dcb3273 100644 (file)
@@ -40,6 +40,7 @@
 
 #include "ardour_dialog.h"
 #include "instrument_selector.h"
+#include "route_dialogs.h"
 
 class Editor;
 class RouteGroupDialog;
@@ -70,13 +71,8 @@ class AddRouteDialog : public ArdourDialog
 
        ARDOUR::TrackMode mode();
        ARDOUR::RouteGroup* route_group ();
-       enum InsertAt {
-               BeforeSelection,
-               AfterSelection,
-               First,
-               Last
-       };
-       InsertAt insert_at();
+
+       RouteDialogs::InsertAt insert_at();
        bool use_strict_io();
 
   private:
index 6190d9d2d48fc1706c483be1e75df8c7ea086ffa..d1a14aed7b00bf77b82f33a8bd31ac6c48681e88 100644 (file)
@@ -3971,7 +3971,7 @@ ARDOUR_UI::cleanup_peakfiles ()
 }
 
 PresentationInfo::order_t
-ARDOUR_UI::translate_order (AddRouteDialog::InsertAt place)
+ARDOUR_UI::translate_order (RouteDialogs::InsertAt place)
 {
        if (editor->get_selection().tracks.empty()) {
                return PresentationInfo::max_order;
@@ -3984,18 +3984,18 @@ ARDOUR_UI::translate_order (AddRouteDialog::InsertAt place)
          the highest order key in the selection + 1 (if available).
        */
 
-       if (place == AddRouteDialog::AfterSelection) {
+       if (place == RouteDialogs::AfterSelection) {
                RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView*> (editor->get_selection().tracks.back());
                if (rtav) {
                        order_hint = rtav->route()->presentation_info().order();
                        order_hint++;
                }
-       } else if (place == AddRouteDialog::BeforeSelection) {
+       } else if (place == RouteDialogs::BeforeSelection) {
                RouteTimeAxisView *rtav = dynamic_cast<RouteTimeAxisView*> (editor->get_selection().tracks.front());
                if (rtav) {
                        order_hint = rtav->route()->presentation_info().order();
                }
-       } else if (place == AddRouteDialog::First) {
+       } else if (place == RouteDialogs::First) {
                order_hint = 0;
        } else {
                /* leave order_hint at max_order */
index 59a3c963e5f417062b3e07c2e5da9e72c7da08a8..a6d66b4fa48fb45f2738251c88ff655332cea8c6 100644 (file)
@@ -91,6 +91,7 @@
 #include "location_ui.h"
 #include "lua_script_manager.h"
 #include "rc_option_editor.h"
+#include "route_dialogs.h"
 #include "route_params_ui.h"
 #include "session_option_editor.h"
 #include "speaker_dialog.h"
@@ -680,7 +681,7 @@ private:
        bool save_as_progress_update (float fraction, int64_t cnt, int64_t total, Gtk::Label* label, Gtk::ProgressBar* bar);
        void save_session_as ();
        void rename_session ();
-       ARDOUR::PresentationInfo::order_t translate_order (AddRouteDialog::InsertAt);
+       ARDOUR::PresentationInfo::order_t translate_order (RouteDialogs::InsertAt);
 
        int         create_mixer ();
        int         create_editor ();
diff --git a/gtk2_ardour/route_dialogs.h b/gtk2_ardour/route_dialogs.h
new file mode 100644 (file)
index 0000000..b9bc58f
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+    Copyright (C) 2016 Paul Davis
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __gtk_ardour_route_dialogs_h__
+#define __gtk_ardour_route_dialogs_h__
+
+namespace RouteDialogs {
+
+enum InsertAt {
+       BeforeSelection,
+       AfterSelection,
+       First,
+       Last
+};
+
+}
+
+#endif /* __gtk_ardour_route_dialogs_h__ */