diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-01-22 15:02:49 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-01-23 14:25:38 -0700 |
commit | 87a5990e54c3b4cc43ceaae023b8dfcb902169dd (patch) | |
tree | 52038c8b7bbc71fd008bbc9fe9ec82792d5feef3 /libs | |
parent | 24f8a90278e0578a755933a4361920ba7e040289 (diff) |
MIDI-region specific naming logic
plus slight cleanup of Region::set_name().
Note that issues with ARDOUR::legalize_for_path() not excluding colons still remain
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/midi_region.h | 2 | ||||
-rw-r--r-- | libs/ardour/midi_region.cc | 14 | ||||
-rw-r--r-- | libs/ardour/region.cc | 10 |
3 files changed, 21 insertions, 5 deletions
diff --git a/libs/ardour/ardour/midi_region.h b/libs/ardour/ardour/midi_region.h index 7181ab8d1b..3b75e29bbb 100644 --- a/libs/ardour/ardour/midi_region.h +++ b/libs/ardour/ardour/midi_region.h @@ -154,6 +154,8 @@ class LIBARDOUR_API MidiRegion : public Region void recompute_at_start (); void recompute_at_end (); + bool set_name (const std::string & str); + void set_position_internal (samplepos_t pos, bool allow_bbt_recompute, const int32_t sub_num); void set_position_music_internal (double qn); void set_length_internal (samplecnt_t len, const int32_t sub_num); diff --git a/libs/ardour/midi_region.cc b/libs/ardour/midi_region.cc index f89f04fd21..0f9bb5c346 100644 --- a/libs/ardour/midi_region.cc +++ b/libs/ardour/midi_region.cc @@ -823,3 +823,17 @@ MidiRegion::trim_to_internal (samplepos_t position, samplecnt_t length, const in send_change (what_changed); } } + +bool +MidiRegion::set_name (const std::string& str) +{ + if (_name == str) { + return true; + } + + if (Session::session_name_is_legal (str) != 0) { + return false; + } + + return Region::set_name (str); +} diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index fb82c5c675..a2bee99a7f 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -447,13 +447,13 @@ Region::set_playlist (boost::weak_ptr<Playlist> wpl) bool Region::set_name (const std::string& str) { - if (_name != str) { - SessionObject::set_name(str); // EMIT SIGNAL NameChanged() - assert(_name == str); - - send_change (Properties::name); + if (_name == str) { + return true; } + SessionObject::set_name (str); // EMIT SIGNAL NameChanged() + assert (_name == str); + send_change (Properties::name); return true; } |