diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2016-08-22 08:40:12 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-08-22 08:40:12 -0400 |
commit | 36f232d5585881d0451f4db9d2037dd1686e9d7a (patch) | |
tree | eeb5f688d41e0bc731de97ca348840867f3c0eed | |
parent | b339cde446137ef1ca74ac6f6d9586c2a98d004c (diff) |
factor out "new route insertion point" enums so they can be shared by relevant dialogs
-rw-r--r-- | gtk2_ardour/add_route_dialog.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/add_route_dialog.h | 10 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/route_dialogs.h | 34 |
5 files changed, 46 insertions, 13 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc index 90ccff58f7..a18ca05adc 100644 --- a/gtk2_ardour/add_route_dialog.cc +++ b/gtk2_ardour/add_route_dialog.cc @@ -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")) { diff --git a/gtk2_ardour/add_route_dialog.h b/gtk2_ardour/add_route_dialog.h index 6856220295..1a57103926 100644 --- a/gtk2_ardour/add_route_dialog.h +++ b/gtk2_ardour/add_route_dialog.h @@ -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: diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 6190d9d2d4..d1a14aed7b 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -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 */ diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index 59a3c963e5..a6d66b4fa4 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -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 index 0000000000..b9bc58f7a0 --- /dev/null +++ b/gtk2_ardour/route_dialogs.h @@ -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__ */ |