Fix merge regression: use TempoLines class instead of same built in to editor.
git-svn-id: svn://localhost/ardour2/branches/3.0@3795 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
ffaf827d93
commit
22dc575e4c
|
@ -274,6 +274,7 @@ Editor::Editor ()
|
|||
drag_info.item = 0;
|
||||
current_mixer_strip = 0;
|
||||
current_bbt_points = 0;
|
||||
tempo_lines = 0;
|
||||
|
||||
snap_type_strings = I18N (_snap_type_strings);
|
||||
snap_mode_strings = I18N (_snap_mode_strings);
|
||||
|
|
|
@ -61,9 +61,7 @@
|
|||
#include "editor_items.h"
|
||||
#include "region_selection.h"
|
||||
#include "canvas.h"
|
||||
#include "time_axis_view.h"
|
||||
#include "draginfo.h"
|
||||
#include "tempo_lines.h"
|
||||
|
||||
namespace Gtkmm2ext {
|
||||
class TearOff;
|
||||
|
@ -99,6 +97,7 @@ class Marker;
|
|||
class GroupedButtons;
|
||||
class AutomationLine;
|
||||
class Selection;
|
||||
class TempoLines;
|
||||
class TimeSelection;
|
||||
class TrackSelection;
|
||||
class AutomationSelection;
|
||||
|
@ -1530,9 +1529,7 @@ public:
|
|||
|
||||
ARDOUR::TempoMap::BBTPointList *current_bbt_points;
|
||||
|
||||
typedef vector<ArdourCanvas::SimpleLine*> TimeLineList;
|
||||
TimeLineList free_measure_lines;
|
||||
TimeLineList used_measure_lines;
|
||||
TempoLines* tempo_lines;
|
||||
|
||||
ArdourCanvas::Group* time_line_group;
|
||||
ArdourCanvas::SimpleLine* get_time_line ();
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "gui_thread.h"
|
||||
#include "time_axis_view.h"
|
||||
#include "ardour_ui.h"
|
||||
#include "tempo_lines.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
@ -171,36 +172,11 @@ Editor::compute_current_bbt_points (nframes_t leftmost, nframes_t rightmost)
|
|||
current_bbt_points = session->tempo_map().get_points (session->tempo_map().frame_time (previous_beat), session->tempo_map().frame_time (next_beat) + 1);
|
||||
}
|
||||
|
||||
ArdourCanvas::SimpleLine *
|
||||
Editor::get_time_line ()
|
||||
{
|
||||
ArdourCanvas::SimpleLine *line;
|
||||
|
||||
if (free_measure_lines.empty()) {
|
||||
line = new ArdourCanvas::SimpleLine (*time_line_group);
|
||||
used_measure_lines.push_back (line);
|
||||
} else {
|
||||
line = free_measure_lines.front();
|
||||
free_measure_lines.erase (free_measure_lines.begin());
|
||||
used_measure_lines.push_back (line);
|
||||
}
|
||||
|
||||
return line;
|
||||
}
|
||||
|
||||
void
|
||||
Editor::hide_measures ()
|
||||
{
|
||||
// from old pre-merge 3.0
|
||||
// tempo_lines->hide();
|
||||
// marker_tempo_lines->hide();
|
||||
|
||||
for (TimeLineList::iterator i = used_measure_lines.begin(); i != used_measure_lines.end(); ++i) {
|
||||
(*i)->hide();
|
||||
free_measure_lines.push_back (*i);
|
||||
}
|
||||
|
||||
used_measure_lines.clear ();
|
||||
if (tempo_lines)
|
||||
tempo_lines->hide();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -220,70 +196,15 @@ Editor::draw_measures ()
|
|||
return;
|
||||
}
|
||||
|
||||
TempoMap::BBTPointList::iterator i;
|
||||
ArdourCanvas::SimpleLine *line;
|
||||
gdouble xpos;
|
||||
double beat_density;
|
||||
|
||||
uint32_t beats = 0;
|
||||
uint32_t bars = 0;
|
||||
uint32_t color;
|
||||
|
||||
if (current_bbt_points == 0 || current_bbt_points->empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* get the first bar spacing */
|
||||
|
||||
i = current_bbt_points->end();
|
||||
i--;
|
||||
bars = (*i).bar - (*current_bbt_points->begin()).bar;
|
||||
beats = current_bbt_points->size() - bars;
|
||||
|
||||
beat_density = (beats * 10.0f) / track_canvas->get_width ();
|
||||
|
||||
if (beat_density > 4.0f) {
|
||||
/* if the lines are too close together, they become useless
|
||||
*/
|
||||
return;
|
||||
if (tempo_lines == 0) {
|
||||
tempo_lines = new TempoLines(*track_canvas, time_line_group);
|
||||
}
|
||||
|
||||
for (i = current_bbt_points->begin(); i != current_bbt_points->end(); ++i) {
|
||||
|
||||
switch ((*i).type) {
|
||||
case TempoMap::Bar:
|
||||
break;
|
||||
|
||||
case TempoMap::Beat:
|
||||
|
||||
if ((*i).beat == 1) {
|
||||
color = ARDOUR_UI::config()->canvasvar_MeasureLineBar.get();
|
||||
} else {
|
||||
color = ARDOUR_UI::config()->canvasvar_MeasureLineBeat.get();
|
||||
|
||||
if (beat_density > 2.0) {
|
||||
/* only draw beat lines if the gaps between beats are large.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xpos = frame_to_unit ((nframes64_t) (*i).frame);
|
||||
line = get_time_line ();
|
||||
line->property_x1() = xpos;
|
||||
line->property_x2() = xpos;
|
||||
line->property_y2() = canvas_height;
|
||||
line->property_color_rgba() = color;
|
||||
//line->raise_to_top();
|
||||
line->show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* the cursors are always on top of everything */
|
||||
//cursor_group->raise_to_top();
|
||||
|
||||
return;
|
||||
tempo_lines->draw(*current_bbt_points, frames_per_unit);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "tempo_lines.h"
|
||||
#include "ardour_ui.h"
|
||||
|
||||
|
||||
ArdourCanvas::SimpleLine *
|
||||
TempoLines::get_line ()
|
||||
{
|
||||
|
@ -68,10 +67,6 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
|
|||
_canvas.get_scroll_region (x1, y1, x2, who_cares);
|
||||
_canvas.root()->get_bounds(who_cares, who_cares, who_cares, y2);
|
||||
|
||||
// FIXME use canvas height
|
||||
//y2 = TimeAxisView::hLargest*5000; // five thousand largest tracks should be enough.. :)
|
||||
//y2 = 500000; // five thousand largest tracks should be enough.. :)
|
||||
|
||||
/* get the first bar spacing */
|
||||
|
||||
i = points.end();
|
||||
|
@ -86,7 +81,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
|
|||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (i = points.begin(); i != points.end(); ++i) {
|
||||
|
||||
switch ((*i).type) {
|
||||
|
@ -107,7 +102,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
|
|||
}
|
||||
}
|
||||
|
||||
xpos = rint((*i).frame / (double)frames_per_unit);
|
||||
xpos = rint(((nframes64_t)(*i).frame) / (double)frames_per_unit);
|
||||
line = get_line ();
|
||||
line->property_x1() = xpos;
|
||||
line->property_x2() = xpos;
|
||||
|
@ -119,4 +114,3 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -951,7 +951,7 @@ SMFSource::load_model(bool lock, bool force_reload)
|
|||
|
||||
if (ret > 0) { // didn't skip (meta) event
|
||||
// make ev.time absolute time in frames
|
||||
ev.time() = (double)time * frames_per_beat / (double)_ppqn;
|
||||
ev.time() = time * frames_per_beat / (EventTime)_ppqn;
|
||||
ev.set_event_type(EventTypeMap::instance().midi_event_type(buf[0]));
|
||||
_model->append(ev);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue