summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-06-24 16:28:53 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-06-24 16:28:53 -0400
commita1f858d3b207739e0719c1fc28003f1d9dd3965d (patch)
tree23c9c35f6b95e116f11354b0c78841036dcdc6bb /gtk2_ardour
parent0ce393f05144762a20d72975d0254ebca0789973 (diff)
an awful lot of tweaks to drawing details
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/audio_region_view.cc5
-rw-r--r--gtk2_ardour/editor_cursors.cc10
-rw-r--r--gtk2_ardour/tempo_lines.cc8
-rw-r--r--gtk2_ardour/theme_manager.cc4
-rw-r--r--gtk2_ardour/time_axis_view_item.cc58
-rw-r--r--gtk2_ardour/time_axis_view_item.h2
6 files changed, 48 insertions, 39 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 47aebb765f..077755ff83 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -1208,14 +1208,13 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
v = min (1.0, v * 3.0);
c = ArdourCanvas::hsv_to_color (h, s, v, _region->muted() ? MUTED_ALPHA : 1.0);
-
+
wave->set_fill_color (c);
}
wave->set_clip_color (ARDOUR_UI::config()->get_canvasvar_WaveFormClip());
wave->set_zero_color (ARDOUR_UI::config()->get_canvasvar_ZeroLine());
- // CAIROCANVAS
- // wave->property_zero_line() = true;
+ wave->set_show_zero_line (true);
switch (Config->get_waveform_shape()) {
case Rectified:
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index 9d8c255d2f..557120c1db 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -45,11 +45,11 @@ EditorCursor::EditorCursor (Editor& ed, bool (Editor::*callbck)(GdkEvent*,Ardour
_time_bars_canvas_item.set_head_width (0, 16);
_time_bars_canvas_item.set_head_outward (0, false);
_time_bars_canvas_item.set_show_head (1, false); // head only
- _time_bars_canvas_item.set_outline_width (1.5);
+ _time_bars_canvas_item.set_outline_width (0.5);
_time_bars_canvas_item.set_data ("cursor", this);
_track_canvas_item.set_data ("cursor", this);
- _track_canvas_item.set_outline_width (1.5);
+ _track_canvas_item.set_outline_width (0.5);
_time_bars_canvas_item.Event.connect (sigc::bind (sigc::mem_fun (ed, callbck), &_time_bars_canvas_item));
_track_canvas_item.Event.connect (sigc::bind (sigc::mem_fun (ed, callbck), &_track_canvas_item));
@@ -70,7 +70,11 @@ EditorCursor::set_position (framepos_t frame)
{
PositionChanged (frame);
- double const new_pos = _editor.sample_to_pixel (frame);
+ /* See Cairo FAQ question on single pixel lines to understand
+ why we add 0.5
+ */
+
+ double const new_pos = _editor.sample_to_pixel (frame) + 0.5;
if (new_pos != _time_bars_canvas_item.x ()) {
_time_bars_canvas_item.set_x (new_pos);
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc
index d73fb54b81..6bf7dfbde9 100644
--- a/gtk2_ardour/tempo_lines.cc
+++ b/gtk2_ardour/tempo_lines.cc
@@ -111,8 +111,12 @@ TempoLines::draw (const ARDOUR::TempoMap::BBTPointList::const_iterator& begin,
line->set_ignore_events (true);
}
- line->set_x0 (xpos);
- line->set_x1 (xpos);
+ /* move to 0.5 offset to ensure single pixel lines (see Cairo
+ * FAQ for info on why we do this).
+ */
+
+ line->set_x0 (xpos + 0.5);
+ line->set_x1 (xpos + 0.5);
line->set_y0 (0.0);
line->set_y1 (_height);
line->set_outline_color (color);
diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc
index 1fabfacb7e..947d92bddf 100644
--- a/gtk2_ardour/theme_manager.cc
+++ b/gtk2_ardour/theme_manager.cc
@@ -59,9 +59,9 @@ ThemeManager::ThemeManager()
, light_button (_("Light Theme"))
, reset_button (_("Restore Defaults"))
, flat_buttons (_("Draw \"flat\" buttons"))
- , waveform_gradient_depth (0, 1.0, 0.1)
+ , waveform_gradient_depth (0, 1.0, 0.05)
, waveform_gradient_depth_label (_("Waveforms color gradient depth"))
- , timeline_item_gradient_depth (0, 2.0, 0.1)
+ , timeline_item_gradient_depth (0, 1.0, 0.05)
, timeline_item_gradient_depth_label (_("Timeline item gradient depth"))
, all_dialogs (_("All floating windows are dialogs"))
{
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index ebda7312d4..d8d3cee807 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -731,30 +731,15 @@ TimeAxisViewItem::set_colors()
set_trim_handle_colors();
}
-/**
- * Sets the frame color depending on whether this item is selected
- */
-void
-TimeAxisViewItem::set_frame_color()
+uint32_t
+TimeAxisViewItem::get_fill_color () const
{
uint32_t f = 0;
- if (!frame) {
- return;
- }
-
if (_selected) {
f = ARDOUR_UI::config()->get_canvasvar_SelectedFrameBase();
- if (fill_opacity) {
- f = UINT_RGBA_CHANGE_A (f, fill_opacity);
- }
-
- if (!rect_visible) {
- f = UINT_RGBA_CHANGE_A (f, 0);
- }
-
} else {
if (_recregion) {
@@ -766,15 +751,32 @@ TimeAxisViewItem::set_frame_color()
} else {
f = fill_color;
}
+ }
+ }
- if (fill_opacity) {
- f = UINT_RGBA_CHANGE_A (f, fill_opacity);
- }
+ return f;
+}
- if (!rect_visible) {
- f = UINT_RGBA_CHANGE_A (f, 0);
- }
- }
+/**
+ * Sets the frame color depending on whether this item is selected
+ */
+void
+TimeAxisViewItem::set_frame_color()
+{
+ uint32_t f = 0;
+
+ if (!frame) {
+ return;
+ }
+
+ f = get_fill_color ();
+
+ if (fill_opacity) {
+ f = UINT_RGBA_CHANGE_A (f, fill_opacity);
+ }
+
+ if (!rect_visible) {
+ f = UINT_RGBA_CHANGE_A (f, 0);
}
frame->set_fill_color (f);
@@ -806,7 +808,7 @@ TimeAxisViewItem::set_frame_gradient ()
ArdourCanvas::Fill::StopList stops;
double r, g, b, a;
double h, s, v;
- ArdourCanvas::Color f (frame->fill_color());
+ ArdourCanvas::Color f (get_fill_color());
/* need to get alpha value */
ArdourCanvas::color_to_rgba (f, r, g, b, a);
@@ -816,10 +818,8 @@ TimeAxisViewItem::set_frame_gradient ()
/* now a darker version */
ArdourCanvas::color_to_hsv (f, h, s, v);
- s *= ARDOUR_UI::config()->get_timeline_item_gradient_depth();
- if (s > 1.0) {
- s = 1.0;
- }
+
+ v = min (1.0, v * (1.0 - ARDOUR_UI::config()->get_timeline_item_gradient_depth()));
ArdourCanvas::Color darker = ArdourCanvas::hsv_to_color (h, s, v, a);
stops.push_back (std::make_pair (1.0, darker));
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index fc9ab4106e..054d496013 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -74,6 +74,8 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
void set_y (double);
void set_color (Gdk::Color const &);
+ uint32_t get_fill_color () const;
+
ArdourCanvas::Item* get_canvas_frame();
ArdourCanvas::Group* get_canvas_group();
ArdourCanvas::Item* get_name_highlight();