View Issue Details

IDProjectCategoryView StatusLast Update
0002816ardourfeaturespublic2020-04-19 20:14
Reporterlincoln Assigned Topaul  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Summary0002816: Region view trim handles + tweaks
DescriptionI am attaching a patch that enables regions to have trim handles on the edges of the regions and not just the name strip. This was pretty trivial to implement and it is really just re-using existing code.

With this in place you can trim regions even at minimal height.

I have also done some tweaks to the region views so that the name strip is a bit smaller, made the name text a bit grey and not black, and made the overall hieght of a region view to fit within the track lane and not spill over to the next by 1 pixel.
TagsNo tags attached.

Activities

2009-08-08 13:56

 

region-boundary-trim-handles-frame-tweaks.patch (5,359 bytes)   
Index: gtk2_ardour/region_view.cc
===================================================================
--- gtk2_ardour/region_view.cc	(revision 5496)
+++ gtk2_ardour/region_view.cc	(working copy)
@@ -154,6 +154,15 @@
 	if (name_highlight) {
 		name_highlight->set_data ("regionview", this);
 		name_highlight->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
+		
+		frame_handle_start->set_data ("regionview", this);
+		frame_handle_start->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), frame_handle_start, this));
+
+		frame_handle_end->set_data ("regionview", this);
+		frame_handle_end->signal_event().connect (bind (mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), frame_handle_end, this));
+
+		frame_handle_start->raise_to_top();
+		frame_handle_end->raise_to_top();
 	}
 
 	if (name_pixbuf) {
Index: gtk2_ardour/time_axis_view_item.cc
===================================================================
--- gtk2_ardour/time_axis_view_item.cc	(revision 5496)
+++ gtk2_ardour/time_axis_view_item.cc	(working copy)
@@ -84,15 +84,15 @@
 		win.add (foo);
 
 		Glib::RefPtr<Pango::Layout> layout = foo.create_pango_layout (X_("Hg")); /* ascender + descender */
-		int width;
-		int height;
+		int width = 0;
+		int height = 0;
 
 		layout->set_font_description (*NAME_FONT);
 		Gtkmm2ext::get_ink_pixel_size (layout, width, height);
 
-		NAME_Y_OFFSET = height + 5;
-		NAME_HIGHLIGHT_SIZE = height + 6;
-		NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 2;
+		NAME_Y_OFFSET = height + 3;
+		NAME_HIGHLIGHT_SIZE = height + 2;
+		NAME_HIGHLIGHT_THRESH = NAME_HIGHLIGHT_SIZE * 3;
 
 		have_name_font = true;
 	}
@@ -199,21 +199,13 @@
 		name_pixbuf = 0;
 	}
 
-	/* create our grab handles used for trimming/duration etc */
+	/* create our grab handles used for trimming/duration etc */	
+	frame_handle_start = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 5.0, trackview.current_height());
+	frame_handle_start->property_outline_what() = 0x0;
 
-	if (visibility & ShowHandles) {
-	
-		frame_handle_start = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 1.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH+1);
-		frame_handle_start->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
+	frame_handle_end = new ArdourCanvas::SimpleRect (*group, 0.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH, 5.0, trackview.current_height());
+	frame_handle_end->property_outline_what() = 0x0;
 
-		frame_handle_end = new ArdourCanvas::SimpleRect (*group, trackview.editor().frame_to_pixel(get_duration()) - TimeAxisViewItem::GRAB_HANDLE_LENGTH, trackview.editor().frame_to_pixel(get_duration()), 1.0, TimeAxisViewItem::GRAB_HANDLE_LENGTH + 1);
-		frame_handle_end->property_outline_color_rgba() = ARDOUR_UI::config()->canvasvar_FrameHandle.get();
-
-	} else {
-		frame_handle_start = 0;
-		frame_handle_end = 0;
-	}
-
 	set_color (base_color) ;
 
 	set_duration (item_duration, this) ;
@@ -552,7 +544,7 @@
 	cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, pb_width, NAME_HIGHLIGHT_SIZE );
 	cairo_t *cr = cairo_create (surface);
 	cairo_text_extents_t te;
-	cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
+	cairo_set_source_rgba (cr, 0.2, 0.2, 0.2, 1.0);
 	cairo_select_font_face (cr, NAME_FONT->get_family().c_str(),
 				CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
 	cairo_set_font_size (cr, 10);
@@ -589,8 +581,8 @@
 		}
 
 		if (height > NAME_HIGHLIGHT_SIZE) {
-			name_highlight->property_y1() = (double) height+1 - NAME_HIGHLIGHT_SIZE;
-			name_highlight->property_y2() = (double) height;
+			name_highlight->property_y1() = (double) height - 1 - NAME_HIGHLIGHT_SIZE;
+			name_highlight->property_y2() = (double) height - 2;
 		}
 		else {
 			/* it gets hidden now anyway */
@@ -600,14 +592,16 @@
 	}
 
 	if (visibility & ShowNameText) {
-		name_pixbuf->property_y() = height+1 - NAME_Y_OFFSET;
+		name_pixbuf->property_y() =  height - 1 - NAME_Y_OFFSET;
 	}
 
 	if (frame) {
-		frame->property_y2() = height+1;
+		frame->property_y2() = height - 1;
+		frame_handle_start->property_y2() = height - 1;
+		frame_handle_end->property_y2() = height - 1;
 	}
 
-	vestigial_frame->property_y2() = height+1;
+	vestigial_frame->property_y2() = height - 1;
 }
 
 /**
@@ -799,10 +793,10 @@
 	if (frame_handle_start) {
 		if (position_locked) {
 			frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
-			frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
+			frame_handle_end->property_fill_color_rgba() =  ARDOUR_UI::config()->canvasvar_TrimHandleLocked.get();
 		} else {
-			frame_handle_start->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandle.get();
-			frame_handle_end->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_TrimHandle.get();
+			frame_handle_start->property_fill_color_rgba() = RGBA_TO_UINT(1, 1, 1, 0); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
+			frame_handle_end->property_fill_color_rgba() = RGBA_TO_UINT(1, 1, 1, 0); //ARDOUR_UI::config()->canvasvar_TrimHandle.get();
 		}
 	}
 }

paul

2009-08-10 03:08

administrator   ~0006491

great stuff. committed to svn. thanks!

system

2020-04-19 20:14

developer   ~0021973

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2009-08-08 13:56 lincoln New Issue
2009-08-08 13:56 lincoln File Added: region-boundary-trim-handles-frame-tweaks.patch
2009-08-10 03:08 paul cost => 0.00
2009-08-10 03:08 paul Note Added: 0006491
2009-08-10 03:08 paul Status new => resolved
2009-08-10 03:08 paul Resolution open => fixed
2009-08-10 03:08 paul Assigned To => paul
2020-04-19 20:14 system Note Added: 0021973
2020-04-19 20:14 system Status resolved => closed