View Issue Details

IDProjectCategoryView StatusLast Update
0009463ardourbugspublic2023-10-05 21:48
Reporterskygge Assigned To 
PrioritylowSeveritytrivialReproducibilityalways
Status newResolutionopen 
PlatformUbuntuOSLinuxOS Version(any)
Product Version7.5 
Summary0009463: MIDI clips are colored even if "Region color follows track color" is off.
Description"Region color follows track color" option works only for audio clips. The MIDI clips have colors even if you switch this option off in Preferences (Appearance -> Editor).
To "uncolor" the MIDI clips you have to select and deselect them or switch to "Range mode" for example.
Steps To ReproduceUcheck "Region color follows track color" in Preferences. Open a session with MIDI clips on a MIDI track. You can see that the MIDI regions still follow track color. If the session contains also audio tracks, you can notice that audio clips have no background color (which is correct). Change mode from Grab to Range - the MIDI clips become correctly rendered now.
Additional InformationAlso applies to 8.0.rcX (current master).
TagsNo tags attached.

Activities

x42

2023-10-05 21:48

administrator   ~0028144

This requires show-name-highlight to be enabled (which is off by default).

Some tech details for devs..

Resolving this cleanly will take some refactoring. Right now the color is changed a few times already. There are 5 (!) calls to MidiRegionView::get_fill_color() for a single MIDI region at session load. The attached patch would add 4 more.

The problem at hand is that,

1. TAV's c'tor () sets high_enough_for_name =1 and height to 1px
2. MidiStreamView::create_region_view creates a MRV, which calls MidiRegionView::init
2a. MRV::initi calls RegionView::region_muted() which calls RV::region_renamed() -> TAVI:::set_name_text() -> TAVI::manage_name_highlight
2b. The region height is still 1px, so high_enough_for_name = 0
3. MidiRegionView::get_fill_color()
    (!UIConfiguration::instance().get_show_name_highlight() || high_enough_for_name) is false, and the region uses the track's color

Only after the RV is added later in MidiStreamView::add_region_view_internal by calling MidiStreamView::display_region the correct height is available
and high_enough_for_name is set to true again.
fix_9463.diff (1,655 bytes)   
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 838d3faf63..b0b7f9d65c 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -267,7 +267,7 @@ MidiRegionView::init (bool /*wfd*/)
 
 	//set_height (trackview.current_height());
 
-	region_muted ();
+	region_muted (); // XXX this unsets high_enough_for_name
 	region_sync_changed ();
 	region_resized (ARDOUR::bounds_change);
 	//region_locked ();
@@ -3824,6 +3824,7 @@ MidiRegionView::get_fill_color() const
 		}
 	}
 
+	cout << "MidiRegionView::get_fill_color << " << high_enough_for_name << "\n";
 	Gtkmm2ext::Color c;
 	if (_selected) {
 		c = UIConfiguration::instance().color ("selected region base");
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index f0e43bf43a..7bfa5e562d 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -635,8 +635,8 @@ RegionView::update_cue_markers ()
 void
 RegionView::region_muted ()
 {
-	set_frame_color ();
 	region_renamed ();
+	set_frame_color ();
 }
 
 void
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 7109fb8e70..357d74525f 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -579,10 +579,10 @@ TimeAxisViewItem::manage_name_highlight ()
 		return;
 	}
 
-	if (_height < NAME_HIGHLIGHT_THRESH) {
-		high_enough_for_name = false;
-	} else {
-		high_enough_for_name = true;
+	bool high_enough = _height >= NAME_HIGHLIGHT_THRESH;
+	if (high_enough_for_name != high_enough) {
+		high_enough_for_name = high_enough;
+		set_frame_color ();
 	}
 
 	if (_width < 2.0) {
fix_9463.diff (1,655 bytes)   

Issue History

Date Modified Username Field Change
2023-09-30 20:59 skygge New Issue
2023-10-05 21:48 x42 Note Added: 0028144
2023-10-05 21:48 x42 File Added: fix_9463.diff