summaryrefslogtreecommitdiff
path: root/gtk2_ardour/audio_region_view.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-06-19 08:15:25 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-06-19 08:15:25 -0400
commit9f0012aaaa50eba6606a2612e5c6ad828c4d40cf (patch)
tree9baf2a49daadb107c5e2c6726d39dd20b7ed8ac8 /gtk2_ardour/audio_region_view.cc
parent8491a015e33fd306548c324f32c0225a2bd866e2 (diff)
various tweaks to the height/sizing of audioregion views and their waveforms
Diffstat (limited to 'gtk2_ardour/audio_region_view.cc')
-rw-r--r--gtk2_ardour/audio_region_view.cc34
1 files changed, 22 insertions, 12 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 2ea91ff62f..a511ff771f 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -477,19 +477,23 @@ AudioRegionView::set_height (gdouble height)
uint32_t wcnt = waves.size();
- for (uint32_t n = 0; n < wcnt; ++n) {
- gdouble ht;
+ if (wcnt > 0) {
- if (height < NAME_HIGHLIGHT_THRESH) {
- ht = ((height - 2 * wcnt) / (double) wcnt);
+ gdouble ht;
+
+ if (!ARDOUR_UI::config()->get_show_name_highlight() || (height < NAME_HIGHLIGHT_THRESH)) {
+ ht = height / (double) wcnt;
} else {
- ht = (((height - 2 * wcnt) - NAME_HIGHLIGHT_SIZE) / (double) wcnt);
+ ht = (height - NAME_HIGHLIGHT_SIZE) / (double) wcnt;
+ }
+
+ for (uint32_t n = 0; n < wcnt; ++n) {
+
+ gdouble yoff = floor (ht * n);
+
+ waves[n]->set_height (ht);
+ waves[n]->set_y_position (yoff);
}
-
- gdouble yoff = n * (ht + 1);
-
- waves[n]->set_height (ht);
- waves[n]->set_y_position (yoff + 2);
}
if (gain_line) {
@@ -1126,12 +1130,18 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
uint32_t nwaves = std::min (nchans, audio_region()->n_channels());
gdouble ht;
+ /* reduce waveview height by 2.0 to account for our frame */
+
if (trackview.current_height() < NAME_HIGHLIGHT_THRESH) {
- ht = ((trackview.current_height()) / (double) nchans);
+ ht = ((trackview.current_height() - 2.0) / (double) nchans);
} else {
- ht = ((trackview.current_height() - NAME_HIGHLIGHT_SIZE) / (double) nchans);
+ ht = ((trackview.current_height() - NAME_HIGHLIGHT_SIZE - 2.0) / (double) nchans);
}
+ /* first waveview starts at 1.0, not 0.0 since that will overlap the
+ * frame
+ */
+
gdouble yoff = which * ht;
WaveView *wave = new WaveView (group, audio_region ());