tempo mapping: half-way towards working drags again
For some reason, mid-drag changes are not visible
This commit is contained in:
parent
4f87506e5c
commit
518fc7754f
|
@ -208,8 +208,6 @@ Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::cerr << "event for " << enum_2_string (type) << ' ' << item->whoami() << std::endl;
|
||||
|
||||
gint ret = FALSE;
|
||||
|
||||
switch (event->type) {
|
||||
|
|
|
@ -2356,8 +2356,6 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, bool from_aut
|
|||
*/
|
||||
|
||||
ctx->cursor_ctx->change (cursors()->time_fx);
|
||||
} else {
|
||||
ctx->cursor_ctx->change (cursors()->trimmer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2952,17 +2950,12 @@ Editor::choose_mapping_drag (ArdourCanvas::Item* item, GdkEvent* event)
|
|||
return;
|
||||
}
|
||||
|
||||
std::cerr << " cursor stack: " << _cursor_stack.size() << std::endl;
|
||||
/* Use cursor state to determine if we are close enough to a beat line
|
||||
* to do a twist. We computed that in the motion handler.
|
||||
*/
|
||||
|
||||
if (_cursor_stack.empty() || _cursor_stack.back() != cursors()->grabber) {
|
||||
/* This is the final tempo, or the next one is a BBT marker.
|
||||
* No twisting, just stretch this one.
|
||||
*/
|
||||
std::cerr << "stretch!\n";
|
||||
begin_reversible_command (_("map tempo/stretch"));
|
||||
XMLNode* before_state = &map->get_state();
|
||||
_drags->set (new MappingStretchDrag (this, item, map, *after, *before_state), event);
|
||||
std::cerr << ":Stretch\n";
|
||||
if (_cursor_stack.empty() || _cursor_stack.back() != cursors()->time_fx) {
|
||||
std::cerr << "do nothing\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ Editor::make_tempo_marker (Temporal::TempoPoint const * ts, double& min_tempo, d
|
|||
const std::string tname (X_(""));
|
||||
char const * color_name = X_("tempo marker");
|
||||
|
||||
tempo_marks.insert (before, new TempoMarker (*this, *tempo_group, UIConfiguration::instance().color (color_name), tname, *ts, ts->sample (sr), tc_color));
|
||||
tempo_marks.insert (before, new TempoMarker (*this, *tempo_group, *mapping_group, UIConfiguration::instance().color (color_name), tname, *ts, ts->sample (sr), tc_color));
|
||||
|
||||
/* XXX the point of this code was "a jump in tempo by more than 1 ntpm results in a red
|
||||
tempo mark pointer." (3a7bc1fd3f32f0)
|
||||
|
@ -476,7 +476,7 @@ Editor::maybe_draw_grid_lines ()
|
|||
metric_get_minsec (grid_marks, _leftmost_sample, rightmost_sample, 12);
|
||||
}
|
||||
|
||||
grid_lines->draw ( grid_marks );
|
||||
grid_lines->draw (grid_marks);
|
||||
grid_lines->show();
|
||||
}
|
||||
|
||||
|
|
|
@ -672,14 +672,24 @@ MetricMarker::MetricMarker (PublicEditor& ed, ArdourCanvas::Item& parent, guint3
|
|||
|
||||
/***********************************************************************/
|
||||
|
||||
TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Item& parent, guint32 rgba, const string& text, Temporal::TempoPoint const & temp, samplepos_t sample, uint32_t curve_color)
|
||||
TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Item& parent, ArdourCanvas::Item& text_parent, guint32 rgba, const string& text, Temporal::TempoPoint const & temp, samplepos_t sample, uint32_t curve_color)
|
||||
: MetricMarker (editor, parent, rgba, text, Tempo, temp.time(), false)
|
||||
, _tempo (&temp)
|
||||
, _mapping_text (new ArdourCanvas::Text (&text_parent))
|
||||
{
|
||||
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_tempo_marker_event), group, this));
|
||||
/* points[1].x gives the width of the marker */
|
||||
_curve = new TempoCurve (editor, *group, curve_color, temp, true, (*points)[1].x);
|
||||
_curve->the_item().lower_to_bottom ();
|
||||
|
||||
_mapping_text->set_color (0xffffff);
|
||||
_mapping_text->set_font_description (ARDOUR_UI_UTILS::get_font_for_style (N_("MarkerText")));
|
||||
_mapping_text->set_position (ArdourCanvas::Duple (unit_position, 0.0));
|
||||
_mapping_text->set_ignore_events (true);
|
||||
|
||||
char buf[64];
|
||||
snprintf (buf, sizeof (buf), "%.2f", _tempo->note_types_per_minute ());
|
||||
_mapping_text->set (buf);
|
||||
}
|
||||
|
||||
TempoMarker::~TempoMarker ()
|
||||
|
@ -687,10 +697,24 @@ TempoMarker::~TempoMarker ()
|
|||
delete _curve;
|
||||
}
|
||||
|
||||
void
|
||||
TempoMarker::reposition ()
|
||||
{
|
||||
MetricMarker::reposition ();
|
||||
|
||||
_mapping_text->set_position (ArdourCanvas::Duple (unit_position, _mapping_text->position().y));
|
||||
}
|
||||
|
||||
void
|
||||
TempoMarker::update ()
|
||||
{
|
||||
set_position (_tempo->time());
|
||||
|
||||
_mapping_text->set_position (ArdourCanvas::Duple (unit_position, _mapping_text->position().y));
|
||||
|
||||
char buf[64];
|
||||
snprintf (buf, sizeof (buf), "%.2f", _tempo->note_types_per_minute ());
|
||||
_mapping_text->set (buf);
|
||||
}
|
||||
|
||||
TempoCurve&
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "canvas/fwd.h"
|
||||
#include "canvas/types.h"
|
||||
#include "canvas/circle.h"
|
||||
#include "canvas/text.h"
|
||||
|
||||
namespace Temporal {
|
||||
class Point;
|
||||
|
@ -158,7 +159,7 @@ protected:
|
|||
|
||||
int _cue_index;
|
||||
|
||||
void reposition ();
|
||||
virtual void reposition ();
|
||||
void setup_line_x ();
|
||||
void setup_name_display ();
|
||||
|
||||
|
@ -179,11 +180,12 @@ class MetricMarker : public ArdourMarker
|
|||
class TempoMarker : public MetricMarker
|
||||
{
|
||||
public:
|
||||
TempoMarker (PublicEditor& editor, ArdourCanvas::Item &, guint32 rgba, const std::string& text, Temporal::TempoPoint const &, samplepos_t sample, uint32_t curve_color);
|
||||
TempoMarker (PublicEditor& editor, ArdourCanvas::Item & parent, ArdourCanvas::Item & text_parent, guint32 rgba, const std::string& text, Temporal::TempoPoint const &, samplepos_t sample, uint32_t curve_color);
|
||||
~TempoMarker ();
|
||||
|
||||
void reset_tempo (Temporal::TempoPoint const & t);
|
||||
void update ();
|
||||
void reposition ();
|
||||
|
||||
Temporal::TempoPoint const & tempo() const { return *_tempo; }
|
||||
Temporal::Point const & point() const;
|
||||
|
@ -193,6 +195,7 @@ class TempoMarker : public MetricMarker
|
|||
private:
|
||||
Temporal::TempoPoint const * _tempo;
|
||||
TempoCurve* _curve;
|
||||
ArdourCanvas::Text* _mapping_text;
|
||||
};
|
||||
|
||||
class MeterMarker : public MetricMarker
|
||||
|
|
Loading…
Reference in New Issue