set tempo lines to be physical_screen_height high, add xml null check.

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3962 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Nick Mainsbridge 2008-10-13 20:32:58 +00:00
parent 027261bc33
commit e43d43a42e
4 changed files with 14 additions and 7 deletions

View file

@ -305,7 +305,10 @@ AutomationTimeAxisView::set_height (uint32_t h)
bool changed_between_small_and_normal = ( (h == hSmall || h == hSmaller) ^ (height == hSmall || height == hSmaller) );
TimeAxisView* state_parent = get_parent_with_state ();
XMLNode* xml_node = state_parent->get_child_xml_node (_state_name);
XMLNode* xml_node;
if (state_parent) {
xml_node = state_parent->get_child_xml_node (_state_name);
}
TimeAxisView::set_height (h);
base_rect->property_y2() = h;
@ -320,7 +323,9 @@ AutomationTimeAxisView::set_height (uint32_t h)
char buf[32];
snprintf (buf, sizeof (buf), "%u", height);
xml_node->add_property ("height", buf);
if (xml_node) {
xml_node->add_property ("height", buf);
}
if (changed_between_small_and_normal || first_call_to_set_height) {
first_call_to_set_height = false;

View file

@ -196,7 +196,7 @@ Editor::draw_measures ()
}
if (tempo_lines == 0) {
tempo_lines = new TempoLines(*track_canvas, time_line_group);
tempo_lines = new TempoLines(*track_canvas, time_line_group, physical_screen_height);
}
tempo_lines->draw(*current_bbt_points, frames_per_unit);

View file

@ -26,11 +26,12 @@ using namespace std;
#define MAX_CACHED_LINES 128
TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group)
TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height)
: _canvas(canvas)
, _group(group)
, _clean_left(DBL_MAX)
, _clean_right(0.0)
, _height(screen_height)
{
}
@ -85,7 +86,6 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
const size_t needed = points.size();
_canvas.get_scroll_region (x1, y1, x2, who_cares);
_canvas.root()->get_bounds(who_cares, who_cares, who_cares, y2);
/* get the first bar spacing */
@ -219,7 +219,8 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
line = new ArdourCanvas::SimpleLine (*_group);
line->property_x1() = xpos;
line->property_x2() = xpos;
line->property_y2() = y2;
line->property_y1() = 0.0;
line->property_y2() = _height;
line->property_color_rgba() = color;
_lines.insert(make_pair(xpos, line));
inserted_last_time = true;

View file

@ -35,7 +35,7 @@ typedef boost::fast_pool_allocator<
class TempoLines {
public:
TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group);
TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group, double screen_height);
void tempo_map_changed();
@ -56,6 +56,7 @@ private:
ArdourCanvas::Group* _group;
double _clean_left;
double _clean_right;
double _height;
};
#endif /* __ardour_tempo_lines_h__ */