summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor.cc10
-rw-r--r--gtk2_ardour/rc_option_editor.cc11
-rw-r--r--libs/ardour/ardour/rc_configuration_vars.h1
-rw-r--r--libs/ardour/ardour/types.h7
-rw-r--r--libs/ardour/enums.cc20
-rw-r--r--libs/ardour/playlist.cc22
6 files changed, 66 insertions, 5 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 80b8973a2e..df1421b6ce 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -1796,10 +1796,18 @@ Editor::add_region_context_items (Menu_Helpers::MenuList& edit_items, boost::sha
_popup_region_menu_item->set_label (menu_item_name);
}
+ /* No latering allowed in later is higher layering model */
+ RefPtr<Action> act = ActionManager::get_action (X_("EditorMenu"), X_("RegionMenuLayering"));
+ if (act && Config->get_layer_model() == LaterHigher) {
+ act->set_sensitive (false);
+ } else if (act) {
+ act->set_sensitive (true);
+ }
+
const framepos_t position = get_preferred_edit_position (EDIT_IGNORE_NONE, true);
edit_items.push_back (*_popup_region_menu_item);
- if (track->playlist()->count_regions_at (position) > 1 && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
+ if (Config->get_layer_model() == Manual && track->playlist()->count_regions_at (position) > 1 && (layering_order_editor == 0 || !layering_order_editor->is_visible ())) {
edit_items.push_back (*manage (_region_actions->get_action ("choose-top-region-context-menu")->create_menu_item ()));
}
edit_items.push_back (SeparatorElem());
diff --git a/gtk2_ardour/rc_option_editor.cc b/gtk2_ardour/rc_option_editor.cc
index 2e42e0bad5..bcefc1260b 100644
--- a/gtk2_ardour/rc_option_editor.cc
+++ b/gtk2_ardour/rc_option_editor.cc
@@ -1678,6 +1678,17 @@ RCOptionEditor::RCOptionEditor ()
add_option (_("Editor"), bco);
+ ComboOption<LayerModel>* lm = new ComboOption<LayerModel> (
+ "layer-model",
+ _("Layering model"),
+ sigc::mem_fun (*_rc_config, &RCConfiguration::get_layer_model),
+ sigc::mem_fun (*_rc_config, &RCConfiguration::set_layer_model)
+ );
+
+ lm->add (LaterHigher, _("later is higher"));
+ lm->add (Manual, _("manual layering"));
+ add_option (_("Editor"), lm);
+
add_option (_("Editor"),
new BoolOption (
"rubberbanding-snaps-to-grid",
diff --git a/libs/ardour/ardour/rc_configuration_vars.h b/libs/ardour/ardour/rc_configuration_vars.h
index 832cb8e958..52c3309b65 100644
--- a/libs/ardour/ardour/rc_configuration_vars.h
+++ b/libs/ardour/ardour/rc_configuration_vars.h
@@ -90,6 +90,7 @@ CONFIG_VARIABLE (bool, use_osc, "use-osc", false)
/* editing related */
+CONFIG_VARIABLE (LayerModel, layer_model, "layer-model", Manual)
CONFIG_VARIABLE (bool, automation_follows_regions, "automation-follows-regions", true)
CONFIG_VARIABLE (bool, region_boundaries_from_selected_tracks, "region-boundaries-from-selected-tracks", true)
CONFIG_VARIABLE (bool, region_boundaries_from_onscreen_tracks, "region-boundaries-from-onscreen_tracks", true)
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index a43eb0125d..b1b4388a74 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -441,6 +441,11 @@ namespace ARDOUR {
MixerOrdered
};
+ enum LayerModel {
+ LaterHigher,
+ Manual
+ };
+
enum ListenPosition {
AfterFaderListen,
PreFaderListen
@@ -633,6 +638,7 @@ std::istream& operator>>(std::istream& o, ARDOUR::PFLPosition& sf);
std::istream& operator>>(std::istream& o, ARDOUR::AFLPosition& sf);
std::istream& operator>>(std::istream& o, ARDOUR::RemoteModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ListenPosition& sf);
+std::istream& operator>>(std::istream& o, ARDOUR::LayerModel& sf);
std::istream& operator>>(std::istream& o, ARDOUR::InsertMergePolicy& sf);
std::istream& operator>>(std::istream& o, ARDOUR::SyncSource& sf);
std::istream& operator>>(std::istream& o, ARDOUR::ShuttleBehaviour& sf);
@@ -652,6 +658,7 @@ std::ostream& operator<<(std::ostream& o, const ARDOUR::PFLPosition& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::AFLPosition& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::RemoteModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ListenPosition& sf);
+std::ostream& operator<<(std::ostream& o, const ARDOUR::LayerModel& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::InsertMergePolicy& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::SyncSource& sf);
std::ostream& operator<<(std::ostream& o, const ARDOUR::ShuttleBehaviour& sf);
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index b5a7447ab8..a1cf8d090c 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -74,6 +74,7 @@ setup_enum_writer ()
AFLPosition _AFLPosition;
RemoteModel _RemoteModel;
DenormalModel _DenormalModel;
+ LayerModel _LayerModel;
InsertMergePolicy _InsertMergePolicy;
ListenPosition _ListenPosition;
SampleFormat _SampleFormat;
@@ -298,7 +299,11 @@ setup_enum_writer ()
*/
enum_writer.add_to_hack_table ("EditorOrdered", "MixerOrdered");
- REGISTER_ENUM (InsertMergeReject);
+ REGISTER_ENUM (LaterHigher);
+ REGISTER_ENUM (Manual);
+ REGISTER (_LayerModel);
+
+ REGISTER_ENUM (InsertMergeReject);
REGISTER_ENUM (InsertMergeRelax);
REGISTER_ENUM (InsertMergeReplace);
REGISTER_ENUM (InsertMergeTruncateExisting);
@@ -805,6 +810,19 @@ std::ostream& operator<<(std::ostream& o, const ListenPosition& var)
std::string s = enum_2_string (var);
return o << s;
}
+std::istream& operator>>(std::istream& o, LayerModel& var)
+{
+ std::string s;
+ o >> s;
+ var = (LayerModel) string_2_enum (s, var);
+ return o;
+}
+
+std::ostream& operator<<(std::ostream& o, const LayerModel& var)
+{
+ std::string s = enum_2_string (var);
+ return o << s;
+}
std::istream& operator>>(std::istream& o, InsertMergePolicy& var)
{
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index d121ee04ff..20a2ef0197 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -2333,7 +2333,10 @@ struct RelayerSort {
void
Playlist::set_layer (boost::shared_ptr<Region> region, double new_layer)
{
- /* Remove the layer we are setting from our region list, and sort it */
+ /* Remove the layer we are setting from our region list, and sort it
+ * using the layer indeces.
+ */
+
RegionList copy = regions.rlist();
copy.remove (region);
copy.sort (RelayerSort ());
@@ -2362,6 +2365,12 @@ Playlist::setup_layering_indices (RegionList const & regions)
}
}
+struct LaterHigherSort {
+ bool operator () (boost::shared_ptr<Region> a, boost::shared_ptr<Region> b) {
+ return a->position() < b->position();
+ }
+};
+
/** Take the layering indices of each of our regions, compute the layers
* that they should be on, and write the layers back to the regions.
*/
@@ -2396,9 +2405,16 @@ Playlist::relayer ()
vector<vector<RegionList> > layers;
layers.push_back (vector<RegionList> (divisions));
- /* Sort our regions into layering index order */
+ /* Sort our regions into layering index order (for manual layering) or position order (for later is higher)*/
RegionList copy = regions.rlist();
- copy.sort (RelayerSort ());
+ switch (Config->get_layer_model()) {
+ case LaterHigher:
+ copy.sort (LaterHigherSort ());
+ break;
+ case Manual:
+ copy.sort (RelayerSort ());
+ break;
+ }
DEBUG_TRACE (DEBUG::Layering, "relayer() using:\n");
for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {