13
0

add a selection frame to TimeAxisViewItem along with a slew of other height/positional fixes

This commit is contained in:
Paul Davis 2014-11-05 19:45:17 -05:00
parent 555ceba876
commit 33b2dccacc
2 changed files with 42 additions and 55 deletions

View File

@ -126,6 +126,7 @@ TimeAxisViewItem::TimeAxisViewItem(
: trackview (tv) : trackview (tv)
, frame_position (-1) , frame_position (-1)
, item_name (it_name) , item_name (it_name)
, selection_frame (0)
, _height (1.0) , _height (1.0)
, _recregion (recording) , _recregion (recording)
, _automation (automation) , _automation (automation)
@ -142,6 +143,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
, trackview (other.trackview) , trackview (other.trackview)
, frame_position (-1) , frame_position (-1)
, item_name (other.item_name) , item_name (other.item_name)
, selection_frame (0)
, _height (1.0) , _height (1.0)
, _recregion (other._recregion) , _recregion (other._recregion)
, _automation (other._automation) , _automation (other._automation)
@ -188,7 +190,7 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
warning << "Time Axis Item Duration == 0" << endl; warning << "Time Axis Item Duration == 0" << endl;
} }
vestigial_frame = new ArdourCanvas::TimeRectangle (group, ArdourCanvas::Rect (0.0, 1.0, 2.0, trackview.current_height())); vestigial_frame = new ArdourCanvas::TimeRectangle (group, ArdourCanvas::Rect (0.0, 0.0, 2.0, trackview.current_height()));
CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name())); CANVAS_DEBUG_NAME (vestigial_frame, string_compose ("vestigial frame for %1", get_item_name()));
vestigial_frame->hide (); vestigial_frame->hide ();
vestigial_frame->set_outline_color (ARDOUR_UI::config()->get_VestigialFrame()); vestigial_frame->set_outline_color (ARDOUR_UI::config()->get_VestigialFrame());
@ -198,37 +200,27 @@ TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_co
frame = new ArdourCanvas::TimeRectangle (group, frame = new ArdourCanvas::TimeRectangle (group,
ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::Rect (0.0, 0.0,
trackview.editor().sample_to_pixel(duration) + RIGHT_EDGE_SHIFT, trackview.editor().sample_to_pixel(duration) + RIGHT_EDGE_SHIFT,
trackview.current_height() - 1.0)); trackview.current_height()));
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name())); CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name()));
if (Config->get_show_name_highlight()) {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
} else {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM));
}
if (_recregion) { if (_recregion) {
frame->set_outline_color (ARDOUR_UI::config()->get_RecordingRect()); frame->set_outline_color (ARDOUR_UI::config()->get_RecordingRect());
} else { } else {
frame->set_outline_color (ARDOUR_UI::config()->get_TimeAxisFrame()); frame->set_outline_color (ARDOUR_UI::config()->get_TimeAxisFrame());
} }
} else {
frame = 0;
} }
if (Config->get_show_name_highlight() && (visibility & ShowNameHighlight)) { if (Config->get_show_name_highlight() && (visibility & ShowNameHighlight)) {
double width; double width;
double start; double start = 1.0;
if (visibility & FullWidthNameHighlight) { if (visibility & FullWidthNameHighlight) {
start = 0.0;
width = trackview.editor().sample_to_pixel(item_duration) + RIGHT_EDGE_SHIFT; width = trackview.editor().sample_to_pixel(item_duration) + RIGHT_EDGE_SHIFT;
} else { } else {
start = 1.0;
width = trackview.editor().sample_to_pixel(item_duration) - 2.0 + RIGHT_EDGE_SHIFT; width = trackview.editor().sample_to_pixel(item_duration) - 2.0 + RIGHT_EDGE_SHIFT;
} }
@ -539,25 +531,26 @@ TimeAxisViewItem::get_item_name() const
void void
TimeAxisViewItem::set_selected(bool yn) TimeAxisViewItem::set_selected(bool yn)
{ {
if (_selected != yn) { if (_selected == yn) {
return;
}
Selectable::set_selected (yn); Selectable::set_selected (yn);
set_frame_color (); set_frame_color ();
set_name_text_color (); set_name_text_color ();
if (frame) { if (_selected && frame) {
if (!Config->get_show_name_highlight() && yn) { if (!selection_frame) {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM|ArdourCanvas::Rectangle::TOP)); selection_frame = new ArdourCanvas::TimeRectangle (group);
frame->set_y0 (1.0); selection_frame->set_fill (false);
frame->set_y1 (_height - 1.0); selection_frame->set_outline_color (ARDOUR_UI::config()->get_SelectedTimeAxisFrame());
} else { selection_frame->set_ignore_events (true);
if (Config->get_show_name_highlight()) {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
} else {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM));
}
frame->set_y0 (0.0);
frame->set_y1 (_height);
} }
selection_frame->set (frame->get().shrink (1.0));
selection_frame->show ();
} else {
if (selection_frame) {
selection_frame->hide ();
} }
} }
} }
@ -609,27 +602,22 @@ TimeAxisViewItem::set_height (double height)
} }
if (frame) { if (frame) {
if (!Config->get_show_name_highlight() && _selected) {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM|ArdourCanvas::Rectangle::TOP));
frame->set_y0 (1.0); frame->set_y0 (1.0);
frame->set_y1 (_height - 1.0); frame->set_y1 (height);
} else {
if (Config->get_show_name_highlight()) {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
} else {
frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM));
}
frame->set_y0 (0.0);
frame->set_y1 (_height);
}
if (frame_handle_start) { if (frame_handle_start) {
frame_handle_start->set_y1 (height); frame_handle_start->set_y1 (height);
frame_handle_end->set_y1 (height); frame_handle_end->set_y1 (height);
} }
if (selection_frame) {
selection_frame->set (frame->get().shrink (1.0));
}
} }
vestigial_frame->set_y1 (height - 1.0); vestigial_frame->set_y0 (1.0);
vestigial_frame->set_y1 (height);
set_colors (); set_colors ();
} }
@ -656,7 +644,7 @@ TimeAxisViewItem::manage_name_highlight ()
if (name_highlight && wide_enough_for_name && high_enough_for_name) { if (name_highlight && wide_enough_for_name && high_enough_for_name) {
name_highlight->show(); name_highlight->show();
name_highlight->set (ArdourCanvas::Rect (0.0, (double) _height - NAME_HIGHLIGHT_SIZE, _width+RIGHT_EDGE_SHIFT, (double) _height - 1.0)); name_highlight->set (ArdourCanvas::Rect (1.0, (double) _height - NAME_HIGHLIGHT_SIZE, _width+RIGHT_EDGE_SHIFT, (double) _height - 1.0));
} else { } else {
name_highlight->hide(); name_highlight->hide();
@ -801,13 +789,7 @@ TimeAxisViewItem::set_frame_color()
set_frame_gradient (); set_frame_gradient ();
if (!_recregion) { if (!_recregion) {
uint32_t f; uint32_t f = ARDOUR_UI::config()->get_TimeAxisFrame();
if (_selected) {
f = ARDOUR_UI::config()->get_SelectedTimeAxisFrame();
} else {
f = ARDOUR_UI::config()->get_TimeAxisFrame();
}
if (!rect_visible) { if (!rect_visible) {
/* make the frame outline be visible but rather transparent */ /* make the frame outline be visible but rather transparent */
@ -948,6 +930,10 @@ TimeAxisViewItem::reset_width_dependent_items (double pixel_width)
if (frame) { if (frame) {
frame->show(); frame->show();
frame->set_x1 (pixel_width + RIGHT_EDGE_SHIFT); frame->set_x1 (pixel_width + RIGHT_EDGE_SHIFT);
if (selection_frame) {
selection_frame->set (frame->get().shrink (1.0));
}
} }
if (frame_handle_start) { if (frame_handle_start) {

View File

@ -243,6 +243,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
ArdourCanvas::Container* group; ArdourCanvas::Container* group;
ArdourCanvas::Rectangle* vestigial_frame; ArdourCanvas::Rectangle* vestigial_frame;
ArdourCanvas::Rectangle* frame; ArdourCanvas::Rectangle* frame;
ArdourCanvas::Rectangle* selection_frame;
ArdourCanvas::Text* name_text; ArdourCanvas::Text* name_text;
ArdourCanvas::Rectangle* name_highlight; ArdourCanvas::Rectangle* name_highlight;