summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mainsbridge <beatroute@iprimus.com.au>2008-10-10 21:38:38 +0000
committerNick Mainsbridge <beatroute@iprimus.com.au>2008-10-10 21:38:38 +0000
commitff52fa56022aed33d8cc80511c2f5a5f4317d200 (patch)
treeefa70cbea57de1fa8ce53de885b951230ea91017
parent7ac8c745ed09a6257f06202d746d37fe333954c0 (diff)
Don't set colours twice in new TimeAxisViewItems (from 3.0), fix the nostar ruler hiding bug, rejig ruler bars again, this time making them physical_screen_width wide and never moving them - preventing artefacts while hiding.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3910 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/editor_canvas.cc58
-rw-r--r--gtk2_ardour/editor_route_list.cc7
-rw-r--r--gtk2_ardour/editor_rulers.cc22
-rw-r--r--gtk2_ardour/time_axis_view_item.cc7
5 files changed, 53 insertions, 44 deletions
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 2f036ca1f6..014f0d5da2 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -316,6 +316,9 @@ class Editor : public PublicEditor
void toggle_measure_visibility ();
void toggle_logo_visibility ();
+ double physical_screen_width;
+ double physical_screen_height;
+
/* SMPTE timecode & video sync */
void smpte_fps_chosen (ARDOUR::SmpteFormat format);
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index 55bb9e2a28..10892fe449 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -101,6 +101,14 @@ Editor::initialize_canvas ()
track_canvas->set_center_scroll_region (false);
track_canvas->set_dither (Gdk::RGB_DITHER_NONE);
+ Glib::RefPtr<Gdk::Screen> screen = get_screen();
+
+ if (!screen) {
+ screen = Gdk::Screen::get_default();
+ }
+ physical_screen_width = screen->get_width ();
+ physical_screen_height = screen->get_height ();
+
/* stuff for the verbose canvas cursor */
Pango::FontDescription* font = get_font_for_style (N_("VerboseCanvasCursor"));
@@ -144,33 +152,33 @@ Editor::initialize_canvas ()
_trackview_group = new ArdourCanvas::Group (*_master_group);
_region_motion_group = new ArdourCanvas::Group (*_trackview_group);
- meter_bar_group = new ArdourCanvas::Group (*_master_group);
- meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, max_canvas_coordinate, timebar_height);
+ meter_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
+ meter_bar = new ArdourCanvas::SimpleRect (*meter_bar_group, 0.0, 0.0, physical_screen_width, timebar_height);
meter_bar->property_outline_what() = (0x1 | 0x8);
meter_bar->property_outline_pixels() = 0;
- tempo_bar_group = new ArdourCanvas::Group (*_master_group);
- tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height));
+ tempo_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
+ tempo_bar = new ArdourCanvas::SimpleRect (*tempo_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height));
tempo_bar->property_outline_what() = (0x1 | 0x8);
tempo_bar->property_outline_pixels() = 0;
- range_marker_bar_group = new ArdourCanvas::Group (*_master_group);
- range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height));
+ range_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
+ range_marker_bar = new ArdourCanvas::SimpleRect (*range_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height));
range_marker_bar->property_outline_what() = (0x1 | 0x8);
range_marker_bar->property_outline_pixels() = 0;
- transport_marker_bar_group = new ArdourCanvas::Group (*_master_group);
- transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height));
+ transport_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
+ transport_marker_bar = new ArdourCanvas::SimpleRect (*transport_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height));
transport_marker_bar->property_outline_what() = (0x1 | 0x8);
transport_marker_bar->property_outline_pixels() = 0;
- marker_bar_group = new ArdourCanvas::Group (*_master_group);
- marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height));
+ marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
+ marker_bar = new ArdourCanvas::SimpleRect (*marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height));
marker_bar->property_outline_what() = (0x1 | 0x8);
marker_bar->property_outline_pixels() = 0;
- cd_marker_bar_group = new ArdourCanvas::Group (*_master_group);
- cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, max_canvas_coordinate, (timebar_height));
+ cd_marker_bar_group = new ArdourCanvas::Group (*track_canvas->root ());
+ cd_marker_bar = new ArdourCanvas::SimpleRect (*cd_marker_bar_group, 0.0, 0.0, physical_screen_width, (timebar_height));
cd_marker_bar->property_outline_what() = (0x1 | 0x8);
cd_marker_bar->property_outline_pixels() = 0;
@@ -292,8 +300,6 @@ Editor::track_canvas_size_allocated ()
canvas_width = canvas_allocation.get_width();
canvas_height = canvas_allocation.get_height();
- full_canvas_height = canvas_height;
-
if (session) {
TrackViewList::iterator i;
double height = 0;
@@ -302,6 +308,7 @@ Editor::track_canvas_size_allocated ()
if ((*i)->control_parent) {
height += (*i)->effective_height;
}
+ (*i)->clip_to_viewport ();
}
full_canvas_height = height + canvas_timebars_vsize;
@@ -324,16 +331,19 @@ Editor::track_canvas_size_allocated ()
transport_punchout_line->property_y2() = canvas_height;
vertical_adjustment.set_page_size (canvas_height);
}
-
- redisplay_tempo (false);
-
horizontal_adjustment.set_upper (session->current_end_frame()/frames_per_unit);
horizontal_adjustment.set_page_size (current_page_frames()/frames_per_unit);
reset_hscrollbar_stepping ();
-
update_fixed_rulers();
-
+ redisplay_tempo (false);
last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
+ if ((vertical_adjustment.get_value() + canvas_height) >= vertical_adjustment.get_upper()) {
+ /*
+ We're increasing the size of the canvas while the bottom is visible.
+ We scroll down to keep in step with the controls layout.
+ */
+ vertical_adjustment.set_value (full_canvas_height - canvas_height);
+ }
Resized (); /* EMIT_SIGNAL */
@@ -356,17 +366,12 @@ Editor::controls_layout_size_request (Requisition* req)
}
}
- RefPtr<Gdk::Screen> screen = get_screen();
-
- if (!screen) {
- screen = Gdk::Screen::get_default();
- }
- gint height = min ( (gint) pos, (screen->get_height() - 600));
+ gint height = min ((gint) pos, (gint) (physical_screen_height - 600));
gint width = max (edit_controls_vbox.get_width(), controls_layout.get_width());
/* don't get too big. the fudge factors here are just guesses */
- width = min (width, screen->get_width() - 300);
+ width = min (width, (gint) (physical_screen_width - 300));
if ((req->width != width) || (req->height != height)) {
changed = true;
@@ -812,7 +817,6 @@ Editor::scroll_canvas_vertically ()
double y_delta;
y_delta = last_trackview_group_vertical_offset - get_trackview_group_vertical_offset ();
-
_trackview_group->move (0, y_delta);
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc
index 4113655320..2055091953 100644
--- a/gtk2_ardour/editor_route_list.cc
+++ b/gtk2_ardour/editor_route_list.cc
@@ -314,15 +314,14 @@ Editor::redisplay_route_list ()
++n;
}
- full_canvas_height = position;
-
- vertical_adjustment.set_upper (position + canvas_timebars_vsize);
+ full_canvas_height = position + canvas_timebars_vsize;
+ vertical_adjustment.set_upper (full_canvas_height);
if ((vertical_adjustment.get_value() + canvas_height) > vertical_adjustment.get_upper()) {
/*
We're increasing the size of the canvas while the bottom is visible.
We scroll down to keep in step with the controls layout.
*/
- vertical_adjustment.set_value (position + canvas_timebars_vsize - canvas_height);
+ vertical_adjustment.set_value (full_canvas_height - canvas_height);
}
if (!route_redisplay_does_not_reset_order_keys && !route_redisplay_does_not_sync_order_keys) {
diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc
index 415945b36d..0ae1431766 100644
--- a/gtk2_ardour/editor_rulers.cc
+++ b/gtk2_ardour/editor_rulers.cc
@@ -666,7 +666,7 @@ Editor::update_ruler_visibility ()
old_unit_pos = meter_bar_group->property_y();
if (tbgpos != old_unit_pos) {
meter_bar_group->move ( 0.0, tbgpos - old_unit_pos);
- }
+ }
meter_bar_group->show();
meter_group->show();
tbpos += timebar_height;
@@ -780,18 +780,26 @@ Editor::update_ruler_visibility ()
marker_bar_group->hide();
marker_group->hide();
}
-
+
gdouble old_canvas_timebars_vsize = canvas_timebars_vsize;
canvas_timebars_vsize = (timebar_height * visible_timebars) - 1;
gdouble vertical_pos_delta = canvas_timebars_vsize - old_canvas_timebars_vsize;
+ vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta);
+ full_canvas_height += vertical_pos_delta;
- if (vertical_pos_delta < 0 && (vertical_adjustment.get_value() + canvas_height) >= vertical_adjustment.get_upper()) {
- /*if we're at the bottom of the canvas, don't move the _trackview_grooup*/
- vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta);
+ if (vertical_adjustment.get_value() !=0 && (vertical_adjustment.get_value() + canvas_height >= full_canvas_height)) {
+ /*if we're at the bottom of the canvas, don't move the _trackview_group*/
+ vertical_adjustment.set_value (full_canvas_height - canvas_height + 1);
} else {
- vertical_adjustment.set_upper(vertical_adjustment.get_upper() + vertical_pos_delta);
- _trackview_group->move (0, vertical_pos_delta);
+ _trackview_group->property_y () = - get_trackview_group_vertical_offset ();
+ _trackview_group->move (0, 0);
+ last_trackview_group_vertical_offset = get_trackview_group_vertical_offset ();
}
+
+ if (trackview_by_y_position(vertical_adjustment.get_value() + canvas_height) != 0) {
+ trackview_by_y_position(vertical_adjustment.get_value() + canvas_height)->clip_to_viewport ();
+ }
+
ruler_label_vbox.set_size_request (-1, (int)(timebar_height * visible_rulers));
time_canvas_vbox.set_size_request (-1,-1);
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index cbe34ad3a8..0a33b4c205 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -162,7 +162,6 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
frame->property_x2() = (double) trackview.editor.frame_to_pixel(duration);
frame->property_y2() = (double) trackview.current_height();
frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
- frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
/* by default draw all 4 edges */
@@ -197,8 +196,6 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
}
name_highlight->property_y1() = (double) (trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE);
name_highlight->property_y2() = (double) (trackview.current_height() - 1);
- name_highlight->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_NameHighlightFill.get();
- name_highlight->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_NameHighlightOutline.get();
name_highlight->set_data ("timeaxisviewitem", this);
@@ -215,15 +212,13 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
frame_handle_start->property_y1() = (double) 1.0;
frame_handle_start->property_y2() = (double) TimeAxisViewItem::GRAB_HANDLE_LENGTH+1;
frame_handle_start->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
- frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
-
+
frame_handle_end = new ArdourCanvas::SimpleRect (*group);
frame_handle_end->property_x1() = (double) (trackview.editor.frame_to_pixel(get_duration())) - (TimeAxisViewItem::GRAB_HANDLE_LENGTH);
frame_handle_end->property_x2() = (double) trackview.editor.frame_to_pixel(get_duration());
frame_handle_end->property_y1() = (double) 1;
frame_handle_end->property_y2() = (double) TimeAxisViewItem::GRAB_HANDLE_LENGTH + 1;
frame_handle_end->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
- frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
} else {
frame_handle_start = 0;