13
0

Patch from Lincoln (#3319) to make the range selection box not display trim handles but make it trimmable along the whole edge. Also clean up record box rendering.

git-svn-id: svn://localhost/ardour2/branches/3.0@7431 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-07-16 20:03:16 +00:00
parent eb4d9be40c
commit da67628bcf
4 changed files with 69 additions and 40 deletions

View File

@ -121,7 +121,10 @@ AudioStreamView::create_region_view (boost::shared_ptr<Region> r, bool wait_for_
if (recording) {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color, recording, TimeAxisViewItem::Visibility(
TimeAxisViewItem::ShowFrame | TimeAxisViewItem::HideFrameRight));
TimeAxisViewItem::ShowFrame |
TimeAxisViewItem::HideFrameRight |
TimeAxisViewItem::HideFrameLeft |
TimeAxisViewItem::HideFrameTB));
} else {
region_view = new AudioRegionView (_canvas_group, _trackview, region,
_samples_per_unit, region_color);
@ -160,6 +163,7 @@ RegionView*
AudioStreamView::add_region_view_internal (boost::shared_ptr<Region> r, bool wait_for_waves, bool recording)
{
RegionView *region_view = create_region_view (r, wait_for_waves, recording);
if (region_view == 0) {
return 0;
}
@ -486,7 +490,7 @@ AudioStreamView::setup_rec_box ()
assert(region);
region->block_property_changes ();
region->set_position (_trackview.session()->transport_frame(), this);
rec_regions.push_back (make_pair(region, (RegionView*)0));
rec_regions.push_back (make_pair(region, (RegionView*) 0));
}
/* start a new rec box */
@ -521,8 +525,8 @@ AudioStreamView::setup_rec_box ()
rec_rect->property_y1() = 1.0;
rec_rect->property_x2() = xend;
rec_rect->property_y2() = child_height ();
rec_rect->property_outline_what() = 0x0;
rec_rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
rec_rect->property_outline_what() = 0x1 | 0x2 | 0x4 | 0x8;
rec_rect->property_fill_color_rgba() = fill_color;
rec_rect->lower_to_bottom();
@ -640,6 +644,7 @@ AudioStreamView::update_rec_regions ()
}
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion>(iter->first);
if (!region) {
iter = tmp;
continue;

View File

@ -568,7 +568,7 @@ StreamView::update_contents_height ()
}
for (vector<RecBoxInfo>::iterator i = rec_rects.begin(); i != rec_rects.end(); ++i) {
i->rectangle->property_y2() = height - 1.0;
i->rectangle->property_y2() = height;
}
}

View File

@ -379,19 +379,53 @@ TimeAxisView::hide ()
void
TimeAxisView::step_height (bool bigger)
{
static const uint32_t step = 20;
static const uint32_t step = 25;
if (bigger) {
set_height (height + step);
} else {
if (height > step) {
set_height (std::max (height - step, preset_height (HeightSmall)));
} else if (height != preset_height (HeightSmall)) {
set_height (HeightSmall);
if (height == preset_height(HeightSmall)) {
set_height (preset_height(HeightSmaller));
}
else if (height == preset_height(HeightSmaller)) {
set_height (preset_height(HeightNormal));
}
else {
set_height (height + step);
}
} else {
if ( height == preset_height(HeightSmall)){
return;
}
if (height == preset_height (HeightSmaller)) {
set_height (preset_height(HeightSmall));
}
else if (height > step) {
if ( height <= preset_height (HeightNormal) && height > preset_height (HeightSmaller)){
set_height (preset_height(HeightSmaller));
}
else {
set_height (height - step);
}
}
}
}
/*
switch (h) {
case HeightLargest:
return extra_height + 48 + 250;
case HeightLarger:
return extra_height + 48 + 150;
case HeightLarge:
return extra_height + 48 + 50;
case HeightNormal:
return extra_height + 48;
case HeightSmall:
return 27;
case HeightSmaller:
return smaller_height;
}
*/
void
TimeAxisView::set_heights (uint32_t h)
{
@ -714,12 +748,12 @@ TimeAxisView::show_selection (TimeSelection& ts)
rect->start_trim->property_x1() = x1;
rect->start_trim->property_y1() = 1.0;
rect->start_trim->property_x2() = x1 + trim_handle_size;
rect->start_trim->property_y2() = 1.0 + trim_handle_size;
rect->start_trim->property_y2() = y2;
rect->end_trim->property_x1() = x2 - trim_handle_size;
rect->end_trim->property_y1() = 1.0;
rect->end_trim->property_x2() = x2;
rect->end_trim->property_y2() = 1.0 + trim_handle_size;
rect->end_trim->property_y2() = y2;
rect->start_trim->show();
rect->end_trim->show();
@ -815,24 +849,22 @@ TimeAxisView::get_selection_rect (uint32_t id)
rect = new SelectionRect;
rect->rect = new SimpleRect (*selection_group);
rect->rect->property_outline_what() = 0x0;
rect->rect->property_x1() = 0.0;
rect->rect->property_y1() = 0.0;
rect->rect->property_x2() = 0.0;
rect->rect->property_y2() = 0.0;
rect->rect->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectionRect.get();
rect->rect->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
rect->start_trim = new SimpleRect (*selection_group);
rect->start_trim->property_outline_what() = 0x0;
rect->start_trim->property_x1() = 0.0;
rect->start_trim->property_x2() = 0.0;
rect->start_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
rect->start_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
rect->end_trim = new SimpleRect (*selection_group);
rect->end_trim->property_outline_what() = 0x0;
rect->end_trim->property_x1() = 0.0;
rect->end_trim->property_x2() = 0.0;
rect->end_trim->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
rect->end_trim->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_Selection.get();
free_selection_rects.push_front (rect);
@ -1034,7 +1066,7 @@ TimeAxisView::compute_heights ()
const int border_width = 2;
extra_height = (2 * border_width)
//+ 2 // 2 pixels for the hseparator between TimeAxisView control areas
+ 10; // resizer button (3 x 2 pixel elements + 2 x 2 pixel gaps)
+ 6; // resizer button (3 x 2 pixel elements + 2 x 2 pixel gaps)
window.add (one_row_table);

View File

@ -131,8 +131,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
void
TimeAxisViewItem::init (
const string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool wide, bool high
)
const string& it_name, double spu, Gdk::Color const & base_color, nframes64_t start, nframes64_t duration, Visibility vis, bool wide, bool high)
{
item_name = it_name;
samples_per_unit = spu;
@ -164,38 +163,31 @@ TimeAxisViewItem::init (
if (visibility & ShowFrame) {
frame = new ArdourCanvas::SimpleRect (*group, 0.0, 1.0, trackview.editor().frame_to_pixel(duration), trackview.current_height());
frame->property_outline_pixels() = 1;
frame->property_outline_what() = 0xF;
frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
/* by default draw all 4 edges */
uint32_t outline_what = 0x1|0x2|0x4|0x8;
if (visibility & HideFrameLeft) {
outline_what &= ~(0x1);
if(_recregion){
frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
}
if (visibility & HideFrameRight) {
outline_what &= ~(0x2);
else {
frame->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
}
if (visibility & HideFrameTB) {
outline_what &= ~(0x4 | 0x8);
}
frame->property_outline_what() = outline_what;
frame->property_outline_what() = 0x1|0x2|0x4|0x8;
} else {
frame = 0;
}
if (visibility & ShowNameHighlight) {
if (visibility & FullWidthNameHighlight) {
name_highlight = new ArdourCanvas::SimpleRect (*group, 0.0, trackview.editor().frame_to_pixel(item_duration), trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height() - 1);
} else {
name_highlight = new ArdourCanvas::SimpleRect (*group, 1.0, trackview.editor().frame_to_pixel(item_duration) - 1, trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE, trackview.current_height() - 1);
}
name_highlight->set_data ("timeaxisviewitem", this);
} else {