summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mainsbridge <beatroute@iprimus.com.au>2008-10-13 20:32:58 +0000
committerNick Mainsbridge <beatroute@iprimus.com.au>2008-10-13 20:32:58 +0000
commite43d43a42e9e890843f72f89884c949f3105addf (patch)
tree968490214226dd3b48d38dd72fd20798b8c1f6e4
parent027261bc33ee826b680066a92e1e79467dd9f15d (diff)
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
-rw-r--r--gtk2_ardour/automation_time_axis.cc9
-rw-r--r--gtk2_ardour/editor_tempodisplay.cc2
-rw-r--r--gtk2_ardour/tempo_lines.cc7
-rw-r--r--gtk2_ardour/tempo_lines.h3
4 files changed, 14 insertions, 7 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index f67dd96034..06a6e6c73c 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -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;
diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc
index 9615171bb9..65e086f9e1 100644
--- a/gtk2_ardour/editor_tempodisplay.cc
+++ b/gtk2_ardour/editor_tempodisplay.cc
@@ -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);
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index d27e671ea8..716dcdb139 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -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;
diff --git a/gtk2_ardour/tempo_lines.h b/gtk2_ardour/tempo_lines.h
index f435c83588..ea47ddfb5f 100644
--- a/gtk2_ardour/tempo_lines.h
+++ b/gtk2_ardour/tempo_lines.h
@@ -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__ */