Layering - the return of "later is higher".
Currently we don't do anything special on layering prefs change
(relayer only occurs when each playlist is first edited). The idea here is
that "undo" is still available to restore previous layering in case of any
surprises.
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user