13
0

temporal: remove the concept of a time domain for the tempo map (GUI edition)

This commit is contained in:
Paul Davis 2022-05-23 14:24:50 -06:00
parent e3501a05f8
commit 2ec6d45d6d
4 changed files with 17 additions and 60 deletions

View File

@ -3449,22 +3449,15 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
_editor->begin_reversible_command (_("copy meter mark"));
timepos_t pos;
if (map->time_domain() == AudioTime) {
pos = timepos_t (map->sample_at (bbt));
} else {
pos = timepos_t (map->quarters_at (bbt));
}
const timepos_t pos (map->quarters_at (bbt));
_marker->reset_meter (map->set_meter (meter, pos));
}
/* only snap to bars. leave snap mode alone for audio locked meters.*/
if (map->time_domain() != AudioTime) {
_editor->set_grid_to (GridTypeBar);
_editor->set_snap_mode (SnapMagnetic);
}
/* only snap to bars. */
_editor->set_grid_to (GridTypeBar);
_editor->set_snap_mode (SnapMagnetic);
}
if (_movable && (!first_move || !_copy)) {

View File

@ -1980,11 +1980,8 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
break;
}
entered_marker = m_marker;
if (m_marker->meter().map().time_domain() == BeatTime) {
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker"));
} else {
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker music"));
}
/* "music" currently serves as a stand-in for "entered". */
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker music"));
break;
case TempoMarkerItem:
@ -1992,11 +1989,8 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
break;
}
entered_marker = t_marker;
if (t_marker->tempo().map().time_domain() == BeatTime) {
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker"));
} else {
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker music"));
}
/* "music" currently serves as a stand-in for "entered". */
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker music"));
break;
case FadeInHandleItem:
@ -2107,24 +2101,16 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
if ((m_marker = static_cast<MeterMarker *> (item->get_data ("marker"))) == 0) {
break;
}
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker"));
entered_marker = 0;
if (m_marker->meter().map().time_domain() == BeatTime) {
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker music"));
} else {
m_marker->set_color_rgba (UIConfiguration::instance().color ("meter marker"));
}
break;
case TempoMarkerItem:
if ((t_marker = static_cast<TempoMarker *> (item->get_data ("marker"))) == 0) {
break;
}
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker"));
entered_marker = 0;
if (t_marker->tempo().map().time_domain() == BeatTime) {
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker music"));
} else {
t_marker->set_color_rgba (UIConfiguration::instance().color ("tempo marker"));
}
break;
case FadeInTrimHandleItem:

View File

@ -164,11 +164,7 @@ Editor::reassociate_metric_marker (TempoMap::SharedPtr const & tmap, TempoMap::M
void
Editor::make_bbt_marker (MusicTimePoint const * mtp)
{
if (mtp->map().time_domain() == BeatTime) {
bbt_marks.push_back (new BBTMarker (*this, *bbt_ruler, UIConfiguration::instance().color ("meter marker music"), "bar!", *mtp));
} else {
bbt_marks.push_back (new BBTMarker (*this, *bbt_ruler, UIConfiguration::instance().color ("meter marker"), "foo!", *mtp));
}
bbt_marks.push_back (new BBTMarker (*this, *bbt_ruler, UIConfiguration::instance().color ("meter marker"), "foo!", *mtp));
}
void
@ -177,11 +173,7 @@ Editor::make_meter_marker (Temporal::MeterPoint const * ms)
char buf[64];
snprintf (buf, sizeof(buf), "%d/%d", ms->divisions_per_bar(), ms->note_value ());
if (ms->map().time_domain() == BeatTime) {
meter_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker music"), buf, *ms));
} else {
meter_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker"), buf, *ms));
}
meter_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker"), buf, *ms));
}
void
@ -193,17 +185,7 @@ Editor::make_tempo_marker (Temporal::TempoPoint const * ts, double& min_tempo, d
min_tempo = min (min_tempo, ts->end_note_types_per_minute());
const std::string tname (X_(""));
char const * color_name;
/* XXX not sure this is the right thing to do here (differentiate time
* domains with color).
*/
if (ts->map().time_domain() == BeatTime) {
color_name = X_("tempo marker music");
} else {
color_name = X_("tempo marker music");
}
char const * color_name = X_("tempo marker");
tempo_marks.push_back (new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color (color_name), tname, *ts, ts->sample (sr), tc_color));
@ -642,11 +624,7 @@ Editor::mouse_add_new_meter_event (timepos_t pos)
XMLNode &before = map->get_state();
if (map->time_domain() == BeatTime) {
pos = timepos_t (map->quarters_at (requested));
} else {
pos = timepos_t (map->sample_at (requested));
}
pos = timepos_t (map->quarters_at (requested));
map->set_meter (Meter (bpb, note_type), pos);

View File

@ -79,7 +79,7 @@ TempoDialog::TempoDialog (TempoMap::SharedPtr const & map, TempoPoint& point, co
, tap_tempo_button (_("Tap tempo"))
{
Temporal::BBT_Time when (map->bbt_at (point.time()));
init (when, _section->note_types_per_minute(), _section->end_note_types_per_minute(), _section->note_type(), _section->type(), map->is_initial (point), map->time_domain());
init (when, _section->note_types_per_minute(), _section->end_note_types_per_minute(), _section->note_type(), _section->type(), map->is_initial (point), Temporal::BeatTime);
}
void
@ -498,7 +498,7 @@ MeterDialog::MeterDialog (TempoMap::SharedPtr const & map, timepos_t const & pos
MeterDialog::MeterDialog (Temporal::MeterPoint& section, const string&)
: ArdourDialog (_("Edit Time Signature"))
{
init (section.bbt(), section.divisions_per_bar(), section.note_value(), section.map().is_initial(section), section.map().time_domain());
init (section.bbt(), section.divisions_per_bar(), section.note_value(), section.map().is_initial(section), Temporal::BeatTime);
}
void