Fix floating line at the top of the groups column.
[dcpomatic.git] / src / wx / audio_mapping_view.cc
index 2413502b8353fa1a0ee70ef70525ac428b3697e4..67ece1f7b1ef0ec4961f8157c080c5c3e11326dd 100644 (file)
@@ -261,10 +261,18 @@ AudioMappingView::paint_row_labels (wxDC& dc)
                        );
        }
 
-       /* Group labels and lines */
-
        int y = TOP_HEIGHT;
-       for (auto i: _input_groups) {
+       for (auto const& i: _input_groups) {
+               dc.DrawLine (wxPoint(MINIMUM_COLUMN_WIDTH, y), wxPoint(MINIMUM_COLUMN_WIDTH * 2, y));
+               y += (i.to - i.from + 1) * ROW_HEIGHT;
+       }
+       dc.DrawLine (wxPoint(MINIMUM_COLUMN_WIDTH, y), wxPoint(MINIMUM_COLUMN_WIDTH * 2, y));
+
+       /* Group labels and lines; be careful here as wxDCClipper does not restore the old
+        * clipping rectangle after it is destroyed
+        */
+       y = TOP_HEIGHT;
+       for (auto const& i: _input_groups) {
                int const height = (i.to - i.from + 1) * ROW_HEIGHT;
                dc.GetTextExtent (std_to_wx(i.name), &label_width, &label_height);
                if (label_width > height) {
@@ -286,11 +294,8 @@ AudioMappingView::paint_row_labels (wxDC& dc)
                                );
                }
 
-               dc.DrawLine (wxPoint(MINIMUM_COLUMN_WIDTH, y), wxPoint(MINIMUM_COLUMN_WIDTH * 2, y));
                y += height;
        }
-
-       dc.DrawLine (wxPoint(MINIMUM_COLUMN_WIDTH, y), wxPoint(MINIMUM_COLUMN_WIDTH * 2, y));
 }
 
 void