13
0

visual tweak patch from lincoln, for time axis views

git-svn-id: svn://localhost/ardour2/branches/3.0@6857 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2010-04-03 22:35:44 +00:00
parent 9644362c92
commit 7c9c3b8f6c
4 changed files with 47 additions and 30 deletions

View File

@ -473,22 +473,23 @@ AudioRegionView::set_height (gdouble height)
// FIXME: ick
height -= 2;
for (uint32_t n=0; n < wcnt; ++n) {
for (uint32_t n = 0; n < wcnt; ++n) {
gdouble ht;
if ((height) < NAME_HIGHLIGHT_THRESH) {
ht = ((height-2*wcnt) / (double) wcnt);
ht = ((height - 2 * wcnt) / (double) wcnt);
} else {
ht = (((height-2*wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
}
gdouble yoff = n * (ht+1);
gdouble yoff = n * (ht + 1);
waves[n]->property_height() = ht;
waves[n]->property_y() = yoff + 2;
}
if (gain_line) {
if ((height/wcnt) < NAME_HIGHLIGHT_THRESH) {
gain_line->hide ();
} else {
@ -496,11 +497,16 @@ AudioRegionView::set_height (gdouble height)
gain_line->show ();
}
}
gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE - 2));
gain_line->set_height ((uint32_t) rint (height - NAME_HIGHLIGHT_SIZE));
}
manage_zero_line ();
reset_fade_shapes ();
if (name_pixbuf) {
name_pixbuf->raise_to_top();
}
}
void

View File

@ -55,8 +55,7 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
xf->length(), false, TimeAxisViewItem::Visibility (TimeAxisViewItem::ShowFrame)),
crossfade (xf),
left_view (lview),
right_view (rview)
right_view (rview)
{
_valid = true;
_visible = true;
@ -76,7 +75,6 @@ CrossfadeView::CrossfadeView (ArdourCanvas::Group *parent,
frame->property_outline_what() = 0;
/* never show the vestigial frame */
vestigial_frame->hide();
show_vestigial = false;
@ -114,9 +112,9 @@ CrossfadeView::set_height (double height)
{
double h = 0;
if (height <= TimeAxisView::hSmaller) {
h = height - 3;
TimeAxisViewItem::set_height (height);
} else {
h = height - NAME_HIGHLIGHT_SIZE - 3;
TimeAxisViewItem::set_height (height - NAME_HIGHLIGHT_SIZE);
}
TimeAxisViewItem::set_height (h);
@ -165,6 +163,20 @@ CrossfadeView::redraw_curves ()
return;
}
/*
At "height - 3.0" the bottom of the crossfade touches the name highlight or the bottom of the track (if the
track is either Small or Smaller.
*/
double tav_height = get_time_axis_view().current_height();
if (tav_height == TimeAxisView::hSmaller ||
tav_height == TimeAxisView::hSmall) {
_height = tav_height - 3.0;
} else {
_height = tav_height - NAME_HIGHLIGHT_SIZE - 3.0;
}
if (_height < 0) {
/* no space allocated yet */
return;
@ -192,14 +204,17 @@ CrossfadeView::redraw_curves ()
p.set_x(i);
p.set_y(2.0 + _height - (_height * vec[i]));
}
fade_in->property_points() = *points;
crossfade->fade_out().curve().get_vector (0, crossfade->length(), vec, npoints);
for (int i = 0, pci = 0; i < npoints; ++i) {
Art::Point &p = (*points)[pci++];
p.set_x(i);
p.set_y(2.0 + _height - (_height * vec[i]));
}
fade_out->property_points() = *points;
delete [] vec;
@ -266,4 +281,3 @@ CrossfadeView::fake_hide ()
{
group->hide();
}

View File

@ -147,7 +147,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
controls_table.show_all ();
controls_table.set_no_show_all ();
resizer.set_size_request (10, 10);
resizer.set_size_request (10, 6);
resizer.set_name ("ResizeHandle");
resizer.signal_expose_event().connect (sigc::mem_fun (*this, &TimeAxisView::resizer_expose));
resizer.signal_button_press_event().connect (sigc::mem_fun (*this, &TimeAxisView::resizer_button_press));
@ -166,8 +166,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
HSeparator* separator = manage (new HSeparator());
controls_vbox.pack_start (controls_table, false, false);
controls_vbox.pack_end (*separator, false, false);
controls_vbox.pack_end (resizer_box, false, true);
controls_vbox.pack_end (resizer_box, false, false);
controls_vbox.show ();
//controls_ebox.set_name ("TimeAxisViewControlsBaseUnselected");
@ -178,9 +177,13 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
controls_ebox.signal_button_release_event().connect (sigc::mem_fun (*this, &TimeAxisView::controls_ebox_button_release));
controls_ebox.signal_scroll_event().connect (sigc::mem_fun (*this, &TimeAxisView::controls_ebox_scroll), true);
controls_hbox.pack_start (controls_ebox,true,true);
controls_hbox.pack_start (controls_ebox, false, false);
controls_hbox.show ();
time_axis_vbox.pack_start (controls_hbox, true, true);
time_axis_vbox.pack_end (*separator, false, false);
time_axis_vbox.show();
ColorsChanged.connect (sigc::mem_fun (*this, &TimeAxisView::color_handler));
GhostRegion::CatchDeletion.connect (*this, invalidator (*this), ui_bind (&TimeAxisView::erase_ghost, this, _1), gui_context());
@ -235,11 +238,11 @@ guint32
TimeAxisView::show_at (double y, int& nth, VBox *parent)
{
if (control_parent) {
control_parent->reorder_child (controls_hbox, nth);
control_parent->reorder_child (time_axis_vbox, nth);
} else {
control_parent = parent;
parent->pack_start (controls_hbox, false, false);
parent->reorder_child (controls_hbox, nth);
parent->pack_start (time_axis_vbox, false, false);
parent->reorder_child (time_axis_vbox, nth);
}
_order = nth;
@ -258,7 +261,7 @@ TimeAxisView::show_at (double y, int& nth, VBox *parent)
_canvas_display->raise_to_top ();
if (_marked_for_display) {
controls_hbox.show ();
time_axis_vbox.show ();
controls_ebox.show ();
_canvas_background->show ();
}
@ -364,7 +367,7 @@ TimeAxisView::hide ()
_canvas_background->hide ();
if (control_parent) {
control_parent->remove (controls_hbox);
control_parent->remove (time_axis_vbox);
control_parent = 0;
}
@ -413,7 +416,7 @@ TimeAxisView::set_heights (uint32_t h)
void
TimeAxisView::set_height(uint32_t h)
{
controls_ebox.property_height_request () = h;
time_axis_vbox.property_height_request () = h;
height = h;
for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
@ -624,11 +627,11 @@ TimeAxisView::set_selected (bool yn)
if (_selected) {
controls_ebox.set_name (controls_base_selected_name);
controls_hbox.set_name (controls_base_selected_name);
time_axis_vbox.set_name (controls_base_selected_name);
controls_vbox.set_name (controls_base_selected_name);
} else {
controls_ebox.set_name (controls_base_unselected_name);
controls_hbox.set_name (controls_base_unselected_name);
time_axis_vbox.set_name (controls_base_unselected_name);
controls_vbox.set_name (controls_base_unselected_name);
hide_selection ();
@ -1348,13 +1351,6 @@ TimeAxisView::resizer_expose (GdkEventExpose* event)
win->draw_line (light, 1, 5, w - 1, 5);
win->draw_point (light, w - 1, 4);
/* handle/line #3 */
win->draw_line (dark, 0, 8, w - 2, 8);
win->draw_point (dark, 0, 9);
win->draw_line (light, 1, 9, w - 1, 9);
win->draw_point (light, w - 1, 8);
/* use vertical resize mouse cursor */
win->set_cursor(Gdk::Cursor(Gdk::SB_V_DOUBLE_ARROW));

View File

@ -229,6 +229,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
Gtk::Table controls_table;
Gtk::EventBox controls_ebox;
Gtk::VBox controls_vbox;
Gtk::VBox time_axis_vbox;
Gtk::DrawingArea resizer;
Gtk::HBox resizer_box;
Gtk::HBox name_hbox;