change (GUI) Marker objects to accept any Canvas::Item as parent, and use this to draw BBT position markers in the BBT ruler
This commit is contained in:
parent
4f1ad4ed0d
commit
5153124664
@ -748,7 +748,7 @@ private:
|
|||||||
LocationMarkerMap location_markers;
|
LocationMarkerMap location_markers;
|
||||||
|
|
||||||
void update_marker_labels ();
|
void update_marker_labels ();
|
||||||
void update_marker_labels (ArdourCanvas::Container*);
|
void update_marker_labels (ArdourCanvas::Item*);
|
||||||
void check_marker_label (ArdourMarker*);
|
void check_marker_label (ArdourMarker*);
|
||||||
|
|
||||||
/** A set of lists of Markers that are in each of the canvas groups
|
/** A set of lists of Markers that are in each of the canvas groups
|
||||||
@ -757,7 +757,7 @@ private:
|
|||||||
* a marker has moved we can decide whether we need to update the labels
|
* a marker has moved we can decide whether we need to update the labels
|
||||||
* for all markers or for just a few.
|
* for all markers or for just a few.
|
||||||
*/
|
*/
|
||||||
std::map<ArdourCanvas::Container*, std::list<ArdourMarker*> > _sorted_marker_lists;
|
std::map<ArdourCanvas::Item*, std::list<ArdourMarker*> > _sorted_marker_lists;
|
||||||
void remove_sorted_marker (ArdourMarker*);
|
void remove_sorted_marker (ArdourMarker*);
|
||||||
|
|
||||||
void hide_marker (ArdourCanvas::Item*, GdkEvent*);
|
void hide_marker (ArdourCanvas::Item*, GdkEvent*);
|
||||||
|
@ -326,14 +326,14 @@ struct MarkerComparator {
|
|||||||
void
|
void
|
||||||
Editor::update_marker_labels ()
|
Editor::update_marker_labels ()
|
||||||
{
|
{
|
||||||
for (std::map<ArdourCanvas::Container *, std::list<ArdourMarker *> >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) {
|
for (std::map<ArdourCanvas::Item *, std::list<ArdourMarker *> >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) {
|
||||||
update_marker_labels (i->first);
|
update_marker_labels (i->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Look at all markers in a group and update label widths */
|
/** Look at all markers in a group and update label widths */
|
||||||
void
|
void
|
||||||
Editor::update_marker_labels (ArdourCanvas::Container* group)
|
Editor::update_marker_labels (ArdourCanvas::Item* group)
|
||||||
{
|
{
|
||||||
list<ArdourMarker*>& sorted = _sorted_marker_lists[group];
|
list<ArdourMarker*>& sorted = _sorted_marker_lists[group];
|
||||||
|
|
||||||
@ -1838,7 +1838,7 @@ Editor::toggle_marker_lines ()
|
|||||||
void
|
void
|
||||||
Editor::remove_sorted_marker (ArdourMarker* m)
|
Editor::remove_sorted_marker (ArdourMarker* m)
|
||||||
{
|
{
|
||||||
for (std::map<ArdourCanvas::Container *, std::list<ArdourMarker *> >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) {
|
for (std::map<ArdourCanvas::Item *, std::list<ArdourMarker *> >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) {
|
||||||
i->second.remove (m);
|
i->second.remove (m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,20 @@ Editor::draw_metric_marks (TempoMap::Metrics const & metrics)
|
|||||||
for (TempoMap::Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
|
for (TempoMap::Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) {
|
||||||
Temporal::MeterPoint *ms;
|
Temporal::MeterPoint *ms;
|
||||||
Temporal::TempoPoint *ts;
|
Temporal::TempoPoint *ts;
|
||||||
|
Temporal::MusicTimePoint *mtp;
|
||||||
|
|
||||||
if ((ms = dynamic_cast<Temporal::MeterPoint*>(*i)) != 0) {
|
/* must check MusicTimePoint first, since it IS-A TempoPoint
|
||||||
|
* and MeterPoint.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((mtp = dynamic_cast<Temporal::MusicTimePoint*>(*i)) != 0) {
|
||||||
|
|
||||||
|
if (ms->map().time_domain() == BeatTime) {
|
||||||
|
metric_marks.push_back (new BBTMarker (*this, *bbt_ruler, UIConfiguration::instance().color ("meter marker music"), "bar!", *mtp));
|
||||||
|
} else {
|
||||||
|
metric_marks.push_back (new BBTMarker (*this, *bbt_ruler, UIConfiguration::instance().color ("meter marker"), "foo!", *mtp));
|
||||||
|
}
|
||||||
|
} else if ((ms = dynamic_cast<Temporal::MeterPoint*>(*i)) != 0) {
|
||||||
snprintf (buf, sizeof(buf), "%d/%d", ms->divisions_per_bar(), ms->note_value ());
|
snprintf (buf, sizeof(buf), "%d/%d", ms->divisions_per_bar(), ms->note_value ());
|
||||||
if (ms->map().time_domain() == BeatTime) {
|
if (ms->map().time_domain() == BeatTime) {
|
||||||
metric_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker music"), buf, *ms));
|
metric_marks.push_back (new MeterMarker (*this, *meter_group, UIConfiguration::instance().color ("meter marker music"), buf, *ms));
|
||||||
|
@ -110,6 +110,7 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g
|
|||||||
*
|
*
|
||||||
* TempoMark:
|
* TempoMark:
|
||||||
* MeterMark:
|
* MeterMark:
|
||||||
|
* BBTPosition
|
||||||
*
|
*
|
||||||
* (3,0)
|
* (3,0)
|
||||||
* / \
|
* / \
|
||||||
@ -185,6 +186,7 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g
|
|||||||
|
|
||||||
case Tempo:
|
case Tempo:
|
||||||
case Meter:
|
case Meter:
|
||||||
|
case BBTPosition:
|
||||||
points = new ArdourCanvas::Points ();
|
points = new ArdourCanvas::Points ();
|
||||||
points->push_back (ArdourCanvas::Duple ( M3, 0.0));
|
points->push_back (ArdourCanvas::Duple ( M3, 0.0));
|
||||||
points->push_back (ArdourCanvas::Duple ( M6, MH * .6));
|
points->push_back (ArdourCanvas::Duple ( M6, MH * .6));
|
||||||
@ -269,8 +271,11 @@ ArdourMarker::ArdourMarker (PublicEditor& ed, ArdourCanvas::Container& parent, g
|
|||||||
|
|
||||||
_position = pos;
|
_position = pos;
|
||||||
unit_position = editor.sample_to_pixel (pos.samples());
|
unit_position = editor.sample_to_pixel (pos.samples());
|
||||||
|
std::cerr << "1marker @ " << unit_position << " from sample " << pos.samples() << std::endl;
|
||||||
unit_position -= _shift;
|
unit_position -= _shift;
|
||||||
|
|
||||||
|
std::cerr << "2marker @ " << unit_position << " from sample " << pos.samples() << " shift was " << _shift << std::endl;
|
||||||
|
|
||||||
group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (unit_position, 1));
|
group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (unit_position, 1));
|
||||||
#ifdef CANVAS_DEBUG
|
#ifdef CANVAS_DEBUG
|
||||||
group->name = string_compose ("Marker::group for %1", annotation);
|
group->name = string_compose ("Marker::group for %1", annotation);
|
||||||
@ -340,7 +345,7 @@ ArdourMarker::~ArdourMarker ()
|
|||||||
delete points;
|
delete points;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArdourMarker::reparent(ArdourCanvas::Container & parent)
|
void ArdourMarker::reparent(ArdourCanvas::Item & parent)
|
||||||
{
|
{
|
||||||
group->reparent (&parent);
|
group->reparent (&parent);
|
||||||
_parent = &parent;
|
_parent = &parent;
|
||||||
@ -631,7 +636,7 @@ ArdourMarker::set_right_label_limit (double p)
|
|||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text,
|
TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Item& parent, guint32 rgba, const string& text,
|
||||||
Temporal::TempoPoint& temp)
|
Temporal::TempoPoint& temp)
|
||||||
: ArdourMarker (editor, parent, rgba, text, Tempo, temp.time(), false)
|
: ArdourMarker (editor, parent, rgba, text, Tempo, temp.time(), false)
|
||||||
, _tempo (temp)
|
, _tempo (temp)
|
||||||
@ -672,7 +677,7 @@ TempoMarker::reset_tempo (Temporal::TempoPoint & t)
|
|||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text, Temporal::MeterPoint& m)
|
MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Item& parent, guint32 rgba, const string& text, Temporal::MeterPoint& m)
|
||||||
: ArdourMarker (editor, parent, rgba, text, Meter, m.time(), false)
|
: ArdourMarker (editor, parent, rgba, text, Meter, m.time(), false)
|
||||||
, _meter (m)
|
, _meter (m)
|
||||||
{
|
{
|
||||||
@ -691,10 +696,11 @@ MeterMarker::reset_meter (Temporal::MeterPoint & m)
|
|||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
BBTMarker::BBTMarker (PublicEditor& editor, ArdourCanvas::Container& parent, guint32 rgba, const string& text, Temporal::MusicTimePoint& p)
|
BBTMarker::BBTMarker (PublicEditor& editor, ArdourCanvas::Item& parent, guint32 rgba, const string& text, Temporal::MusicTimePoint& p)
|
||||||
: ArdourMarker (editor, parent, rgba, text, BBTPosition, p.time(), false)
|
: ArdourMarker (editor, parent, rgba, text, BBTPosition, p.time(), false)
|
||||||
, _point (p)
|
, _point (p)
|
||||||
{
|
{
|
||||||
|
cerr << "NEW BBT MARKER!\n";
|
||||||
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_bbt_marker_event), group, this));
|
group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_bbt_marker_event), group, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
|
|
||||||
ArdourMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Type,
|
ArdourMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Type,
|
||||||
ARDOUR::timepos_t const & position, bool handle_events = true, RegionView* rv = 0);
|
ARDOUR::timepos_t const & position, bool handle_events = true, RegionView* rv = 0);
|
||||||
|
|
||||||
virtual ~ArdourMarker ();
|
virtual ~ArdourMarker ();
|
||||||
|
|
||||||
static PBD::Signal1<void,ArdourMarker*> CatchDeletion;
|
static PBD::Signal1<void,ArdourMarker*> CatchDeletion;
|
||||||
@ -92,8 +92,8 @@ public:
|
|||||||
|
|
||||||
ARDOUR::timepos_t position() const { return _position; }
|
ARDOUR::timepos_t position() const { return _position; }
|
||||||
|
|
||||||
ArdourCanvas::Container * get_parent() { return _parent; }
|
ArdourCanvas::Item * get_parent() { return _parent; }
|
||||||
void reparent (ArdourCanvas::Container & parent);
|
void reparent (ArdourCanvas::Item & parent);
|
||||||
|
|
||||||
void hide ();
|
void hide ();
|
||||||
void show ();
|
void show ();
|
||||||
@ -118,8 +118,8 @@ protected:
|
|||||||
|
|
||||||
Pango::FontDescription name_font;
|
Pango::FontDescription name_font;
|
||||||
|
|
||||||
ArdourCanvas::Container* _parent;
|
ArdourCanvas::Item* _parent;
|
||||||
ArdourCanvas::Container *group;
|
ArdourCanvas::Item *group;
|
||||||
ArdourCanvas::Polygon *mark;
|
ArdourCanvas::Polygon *mark;
|
||||||
ArdourCanvas::Text *_name_item;
|
ArdourCanvas::Text *_name_item;
|
||||||
ArdourCanvas::Points *points;
|
ArdourCanvas::Points *points;
|
||||||
@ -159,7 +159,7 @@ private:
|
|||||||
class TempoMarker : public ArdourMarker
|
class TempoMarker : public ArdourMarker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TempoMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Temporal::TempoPoint&);
|
TempoMarker (PublicEditor& editor, ArdourCanvas::Item &, guint32 rgba, const std::string& text, Temporal::TempoPoint&);
|
||||||
~TempoMarker ();
|
~TempoMarker ();
|
||||||
|
|
||||||
void reset_tempo (Temporal::TempoPoint & t);
|
void reset_tempo (Temporal::TempoPoint & t);
|
||||||
@ -174,7 +174,7 @@ class TempoMarker : public ArdourMarker
|
|||||||
class MeterMarker : public ArdourMarker
|
class MeterMarker : public ArdourMarker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MeterMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Temporal::MeterPoint&);
|
MeterMarker (PublicEditor& editor, ArdourCanvas::Item &, guint32 rgba, const std::string& text, Temporal::MeterPoint&);
|
||||||
~MeterMarker ();
|
~MeterMarker ();
|
||||||
|
|
||||||
void reset_meter (Temporal::MeterPoint & m);
|
void reset_meter (Temporal::MeterPoint & m);
|
||||||
@ -188,7 +188,7 @@ class MeterMarker : public ArdourMarker
|
|||||||
class BBTMarker : public ArdourMarker
|
class BBTMarker : public ArdourMarker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BBTMarker (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, const std::string& text, Temporal::MusicTimePoint&);
|
BBTMarker (PublicEditor& editor, ArdourCanvas::Item &, guint32 rgba, const std::string& text, Temporal::MusicTimePoint&);
|
||||||
~BBTMarker ();
|
~BBTMarker ();
|
||||||
|
|
||||||
void reset_point (Temporal::MusicTimePoint &);
|
void reset_point (Temporal::MusicTimePoint &);
|
||||||
|
@ -234,6 +234,8 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
render_children (area, cr);
|
||||||
|
|
||||||
/* done! */
|
/* done! */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user