summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-07-17 18:34:35 +0200
committerRobin Gareus <robin@gareus.org>2017-07-17 21:06:04 +0200
commit601c317d70a03190257577bd867cefc2c70d3275 (patch)
tree077071290f084431a912414c4e87b6127c586677
parent1f5ebc54853446a786925941bd014666e75221d2 (diff)
Clean up library inheritance (colors.h, utils.h)
make libwidget independent of libcanvas. Confine basics to pbd and gtkmm2ext.
-rw-r--r--gtk2_ardour/audio_region_view.cc26
-rw-r--r--gtk2_ardour/automation_line.cc2
-rw-r--r--gtk2_ardour/canvas_test.cc2
-rw-r--r--gtk2_ardour/color_theme_manager.cc7
-rw-r--r--gtk2_ardour/editor_canvas.cc4
-rw-r--r--gtk2_ardour/editor_cursors.cc2
-rw-r--r--gtk2_ardour/editor_cursors.h2
-rw-r--r--gtk2_ardour/editor_group_tabs.cc10
-rw-r--r--gtk2_ardour/export_report.cc17
-rw-r--r--gtk2_ardour/ghostregion.h2
-rw-r--r--gtk2_ardour/meter_patterns.cc12
-rw-r--r--gtk2_ardour/midi_region_view.h4
-rw-r--r--gtk2_ardour/mini_timeline.cc20
-rw-r--r--gtk2_ardour/mini_timeline.h2
-rw-r--r--gtk2_ardour/mixer_group_tabs.cc10
-rw-r--r--gtk2_ardour/note_base.cc2
-rw-r--r--gtk2_ardour/panner2d.cc2
-rw-r--r--gtk2_ardour/patch_change.cc4
-rw-r--r--gtk2_ardour/patch_change.h4
-rw-r--r--gtk2_ardour/port_matrix_column_labels.cc6
-rw-r--r--gtk2_ardour/port_matrix_row_labels.cc6
-rw-r--r--gtk2_ardour/processor_box.cc7
-rw-r--r--gtk2_ardour/region_view.cc10
-rw-r--r--gtk2_ardour/route_time_axis.cc2
-rw-r--r--gtk2_ardour/shuttle_control.cc6
-rw-r--r--gtk2_ardour/stereo_panner.cc4
-rw-r--r--gtk2_ardour/time_axis_view.cc10
-rw-r--r--gtk2_ardour/time_axis_view_item.cc14
-rw-r--r--gtk2_ardour/toolbar_test.cc2
-rw-r--r--gtk2_ardour/ui_config.cc22
-rw-r--r--gtk2_ardour/ui_config.h28
-rw-r--r--gtk2_ardour/utils.cc6
-rw-r--r--gtk2_ardour/utils.h2
-rw-r--r--libs/ardour/lua_api.cc4
-rw-r--r--libs/canvas/arc.cc1
-rw-r--r--libs/canvas/arrow.cc2
-rw-r--r--libs/canvas/canvas.cc9
-rw-r--r--libs/canvas/canvas/arrow.h4
-rw-r--r--libs/canvas/canvas/box.h2
-rw-r--r--libs/canvas/canvas/canvas.h8
-rw-r--r--libs/canvas/canvas/fill.h22
-rw-r--r--libs/canvas/canvas/flag.h10
-rw-r--r--libs/canvas/canvas/grid.h2
-rw-r--r--libs/canvas/canvas/line_set.h8
-rw-r--r--libs/canvas/canvas/outline.h12
-rw-r--r--libs/canvas/canvas/ruler.h15
-rw-r--r--libs/canvas/canvas/text.h36
-rw-r--r--libs/canvas/canvas/types.h3
-rw-r--r--libs/canvas/canvas/utils.h6
-rw-r--r--libs/canvas/canvas/wave_view.h8
-rw-r--r--libs/canvas/canvas/wave_view_private.h8
-rw-r--r--libs/canvas/canvas/xfade_curve.h10
-rw-r--r--libs/canvas/fill.cc10
-rw-r--r--libs/canvas/flag.cc4
-rw-r--r--libs/canvas/line_set.cc5
-rw-r--r--libs/canvas/meter.cc3
-rw-r--r--libs/canvas/outline.cc5
-rw-r--r--libs/canvas/rectangle.cc1
-rw-r--r--libs/canvas/ruler.cc7
-rw-r--r--libs/canvas/stateful_image.cc3
-rw-r--r--libs/canvas/text.cc13
-rw-r--r--libs/canvas/utils.cc45
-rw-r--r--libs/canvas/wave_view.cc6
-rw-r--r--libs/canvas/widget.cc1
-rw-r--r--libs/canvas/wscript2
-rw-r--r--libs/canvas/xfade_curve.cc13
-rw-r--r--libs/gtkmm2ext/colors.cc (renamed from libs/canvas/colors.cc)82
-rw-r--r--libs/gtkmm2ext/colorspace.cc (renamed from libs/canvas/colorspace.cc)6
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/colors.h (renamed from libs/canvas/canvas/colors.h)58
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/colorspace.h (renamed from libs/canvas/canvas/colorspace.h)11
-rw-r--r--libs/gtkmm2ext/wscript2
-rw-r--r--libs/surfaces/push2/knob.cc8
-rw-r--r--libs/surfaces/push2/knob.h12
-rw-r--r--libs/surfaces/push2/menu.cc8
-rw-r--r--libs/surfaces/push2/menu.h10
-rw-r--r--libs/surfaces/push2/mix.cc5
-rw-r--r--libs/surfaces/push2/push2.cc37
-rw-r--r--libs/surfaces/push2/push2.h10
-rw-r--r--libs/surfaces/push2/scale.cc3
-rw-r--r--libs/surfaces/push2/track_mix.cc2
-rw-r--r--libs/widgets/ardour_button.cc28
-rw-r--r--libs/widgets/ardour_dropdown.cc2
-rw-r--r--libs/widgets/ardour_icon.cc52
-rw-r--r--libs/widgets/ardour_knob.cc27
-rw-r--r--libs/widgets/widgets/ui_config.h4
-rw-r--r--libs/widgets/wscript2
86 files changed, 443 insertions, 473 deletions
diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc
index 0ad6ed778f..e81043588c 100644
--- a/gtk2_ardour/audio_region_view.cc
+++ b/gtk2_ardour/audio_region_view.cc
@@ -25,8 +25,6 @@
#include <gtkmm.h>
-#include <gtkmm2ext/gtk_ui.h>
-
#include "ardour/playlist.h"
#include "ardour/audioregion.h"
#include "ardour/audiosource.h"
@@ -38,6 +36,10 @@
#include "evoral/Curve.hpp"
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/utils.h"
+#include "gtkmm2ext/colors.h"
+
#include "canvas/rectangle.h"
#include "canvas/polygon.h"
#include "canvas/poly_line.h"
@@ -45,8 +47,6 @@
#include "canvas/text.h"
#include "canvas/xfade_curve.h"
#include "canvas/debug.h"
-#include "canvas/utils.h"
-#include "canvas/colors.h"
#include "streamview.h"
#include "audio_region_view.h"
@@ -184,7 +184,7 @@ AudioRegionView::init (bool wfd)
// needs to be created first, RegionView::init() calls set_height()
pending_peak_data = new ArdourCanvas::Rectangle (group);
CANVAS_DEBUG_NAME (pending_peak_data, string_compose ("pending peak rectangle for %1", region()->name()));
- pending_peak_data->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 0.0));
+ pending_peak_data->set_outline_color (Gtkmm2ext::rgba_to_color (0, 0, 0, 0.0));
pending_peak_data->set_pattern (pending_peak_pattern);
pending_peak_data->set_data ("regionview", this);
pending_peak_data->hide ();
@@ -198,28 +198,28 @@ AudioRegionView::init (bool wfd)
if (!_recregion) {
fade_in_handle = new ArdourCanvas::Rectangle (group);
CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in handle for %1", region()->name()));
- fade_in_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
+ fade_in_handle->set_outline_color (Gtkmm2ext::rgba_to_color (0, 0, 0, 1.0));
fade_in_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle"));
fade_in_handle->set_data ("regionview", this);
fade_in_handle->hide ();
fade_out_handle = new ArdourCanvas::Rectangle (group);
CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out handle for %1", region()->name()));
- fade_out_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
+ fade_out_handle->set_outline_color (Gtkmm2ext::rgba_to_color (0, 0, 0, 1.0));
fade_out_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle"));
fade_out_handle->set_data ("regionview", this);
fade_out_handle->hide ();
fade_in_trim_handle = new ArdourCanvas::Rectangle (group);
CANVAS_DEBUG_NAME (fade_in_handle, string_compose ("fade in trim handle for %1", region()->name()));
- fade_in_trim_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
+ fade_in_trim_handle->set_outline_color (Gtkmm2ext::rgba_to_color (0, 0, 0, 1.0));
fade_in_trim_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle"));
fade_in_trim_handle->set_data ("regionview", this);
fade_in_trim_handle->hide ();
fade_out_trim_handle = new ArdourCanvas::Rectangle (group);
CANVAS_DEBUG_NAME (fade_out_handle, string_compose ("fade out trim handle for %1", region()->name()));
- fade_out_trim_handle->set_outline_color (ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
+ fade_out_trim_handle->set_outline_color (Gtkmm2ext::rgba_to_color (0, 0, 0, 1.0));
fade_out_trim_handle->set_fill_color (UIConfiguration::instance().color ("inactive fade handle"));
fade_out_trim_handle->set_data ("regionview", this);
fade_out_trim_handle->hide ();
@@ -1548,10 +1548,10 @@ AudioRegionView::set_waveform_colors ()
void
AudioRegionView::set_some_waveform_colors (vector<ArdourCanvas::WaveView*>& waves_to_color)
{
- ArdourCanvas::Color fill;
- ArdourCanvas::Color outline;
- ArdourCanvas::Color clip = UIConfiguration::instance().color ("clipped waveform");
- ArdourCanvas::Color zero = UIConfiguration::instance().color ("zero line");
+ Gtkmm2ext::Color fill;
+ Gtkmm2ext::Color outline;
+ Gtkmm2ext::Color clip = UIConfiguration::instance().color ("clipped waveform");
+ Gtkmm2ext::Color zero = UIConfiguration::instance().color ("zero line");
if (_selected) {
if (_region->muted()) {
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index 9c1aa13198..6283ce2bc8 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -250,7 +250,7 @@ AutomationLine::set_line_color (uint32_t color)
_line_color = color;
line->set_outline_color (color);
- ArdourCanvas::SVAModifier mod = UIConfiguration::instance().modifier ("automation line fill");
+ Gtkmm2ext::SVAModifier mod = UIConfiguration::instance().modifier ("automation line fill");
line->set_fill_color ((color & 0xffffff00) + mod.a()*255);
}
diff --git a/gtk2_ardour/canvas_test.cc b/gtk2_ardour/canvas_test.cc
index 6f904a1611..9dc16ba7d4 100644
--- a/gtk2_ardour/canvas_test.cc
+++ b/gtk2_ardour/canvas_test.cc
@@ -22,7 +22,7 @@
#include "canvas/types.h"
#include "canvas/canvas.h"
#include "canvas/container.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/debug.h"
#include "canvas/grid.h"
#include "canvas/scroll_group.h"
diff --git a/gtk2_ardour/color_theme_manager.cc b/gtk2_ardour/color_theme_manager.cc
index 634db8e1c4..f43d8ff2de 100644
--- a/gtk2_ardour/color_theme_manager.cc
+++ b/gtk2_ardour/color_theme_manager.cc
@@ -53,6 +53,7 @@ using namespace std;
using namespace Gtk;
using namespace PBD;
using namespace ARDOUR;
+using namespace Gtkmm2ext;
using namespace ARDOUR_UI_UTILS;
ColorThemeManager::ColorThemeManager ()
@@ -273,8 +274,8 @@ ColorThemeManager::palette_canvas_allocated (Gtk::Allocation& alloc, ArdourCanva
struct NamedColor {
string name;
- ArdourCanvas::HSV color;
- NamedColor (string s, ArdourCanvas::HSV c) : name (s), color (c) {}
+ Gtkmm2ext::HSV color;
+ NamedColor (string s, Gtkmm2ext::HSV c) : name (s), color (c) {}
};
struct SortByHue {
@@ -378,7 +379,7 @@ ColorThemeManager::edit_palette_color (std::string name)
using namespace ArdourCanvas;
double r,g, b, a;
UIConfiguration* uic (&UIConfiguration::instance());
- ArdourCanvas::Color c = uic->color (name);
+ Gtkmm2ext::Color c = uic->color (name);
Gdk::Color gdkcolor;
color_to_rgba (c, r, g, b, a);
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc
index fdcbb47fbb..3ff0cf4c4a 100644
--- a/gtk2_ardour/editor_canvas.cc
+++ b/gtk2_ardour/editor_canvas.cc
@@ -918,8 +918,8 @@ Editor::set_horizontal_position (double p)
void
Editor::color_handler()
{
- ArdourCanvas::Color base = UIConfiguration::instance().color ("ruler base");
- ArdourCanvas::Color text = UIConfiguration::instance().color ("ruler text");
+ Gtkmm2ext::Color base = UIConfiguration::instance().color ("ruler base");
+ Gtkmm2ext::Color text = UIConfiguration::instance().color ("ruler text");
timecode_ruler->set_fill_color (base);
timecode_ruler->set_outline_color (text);
minsec_ruler->set_fill_color (base);
diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc
index 40245778d5..de89274fcc 100644
--- a/gtk2_ardour/editor_cursors.cc
+++ b/gtk2_ardour/editor_cursors.cc
@@ -101,7 +101,7 @@ EditorCursor::hide ()
}
void
-EditorCursor::set_color (ArdourCanvas::Color color)
+EditorCursor::set_color (Gtkmm2ext::Color color)
{
_track_canvas_item->set_color (color);
}
diff --git a/gtk2_ardour/editor_cursors.h b/gtk2_ardour/editor_cursors.h
index 5c1125c801..f6d4997690 100644
--- a/gtk2_ardour/editor_cursors.h
+++ b/gtk2_ardour/editor_cursors.h
@@ -41,7 +41,7 @@ public:
void show ();
void hide ();
- void set_color (ArdourCanvas::Color);
+ void set_color (Gtkmm2ext::Color);
void set_sensitive (bool);
framepos_t current_frame () const {
diff --git a/gtk2_ardour/editor_group_tabs.cc b/gtk2_ardour/editor_group_tabs.cc
index 5ca976b983..44b63bae38 100644
--- a/gtk2_ardour/editor_group_tabs.cc
+++ b/gtk2_ardour/editor_group_tabs.cc
@@ -21,7 +21,7 @@
#include "ardour/route_group.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "editor.h"
#include "editor_group_tabs.h"
@@ -93,9 +93,9 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab)
double r, g, b, a;
if (tab.group && tab.group->is_active()) {
- ArdourCanvas::color_to_rgba (tab.color, r, g, b, a);
+ Gtkmm2ext::color_to_rgba (tab.color, r, g, b, a);
} else {
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a);
}
a = 1.0;
@@ -121,8 +121,8 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab)
cairo_move_to (cr, (get_width() - text_height) * .5, (text_width + tab.to + tab.from) * .5);
- ArdourCanvas::Color c = ArdourCanvas::contrasting_text_color (ArdourCanvas::rgba_to_color (r, g, b, a));
- ArdourCanvas::color_to_rgba (c, r, g, b, a);
+ Gtkmm2ext::Color c = Gtkmm2ext::contrasting_text_color (Gtkmm2ext::rgba_to_color (r, g, b, a));
+ Gtkmm2ext::color_to_rgba (c, r, g, b, a);
cairo_set_source_rgb (cr, r, g, b);
cairo_save (cr);
diff --git a/gtk2_ardour/export_report.cc b/gtk2_ardour/export_report.cc
index 200b2c3340..5840597554 100644
--- a/gtk2_ardour/export_report.cc
+++ b/gtk2_ardour/export_report.cc
@@ -25,10 +25,9 @@
#include "pbd/openuri.h"
#include "pbd/basename.h"
+
#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/utils.h"
-#include "canvas/utils.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "audiographer/general/analyser.h"
@@ -530,8 +529,8 @@ ExportReport::init (const AnalysisResults & ar, bool with_file)
rint ((g + 59.0) * 10.0 - h * .5), 5,
h + 2, w + 2, 4);
const float pk = (g + 59.0) / 54.0;
- ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, .3 + pk * .4, .6);
- ArdourCanvas::set_source_rgba (cr, c);
+ Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, .3 + pk * .4, .6);
+ Gtkmm2ext::set_source_rgba (cr, c);
cr->fill ();
cr->save ();
@@ -731,8 +730,8 @@ ExportReport::init (const AnalysisResults & ar, bool with_file)
for (size_t x = 0 ; x < width; ++x) {
for (size_t y = 0 ; y < height; ++y) {
const float pk = p->spectrum[x][y];
- ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
- ArdourCanvas::set_source_rgba (cr, c);
+ Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
+ Gtkmm2ext::set_source_rgba (cr, c);
cr->rectangle (m_l + x - .5, y - .5, 1, 1);
cr->fill ();
}
@@ -792,8 +791,8 @@ ExportReport::init (const AnalysisResults & ar, bool with_file)
for (size_t y = 0 ; y < innerheight - 2; ++y) {
const float pk = 1.0 - (float) y / innerheight;
- ArdourCanvas::Color c = ArdourCanvas::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
- ArdourCanvas::set_source_rgba (cr, c);
+ Gtkmm2ext::Color c = Gtkmm2ext::hsva_to_color (252 - 260 * pk, .9, sqrt(pk));
+ Gtkmm2ext::set_source_rgba (cr, c);
cr->rectangle (2, innertop + y + .5, m_r - 4 - anw, 1);
cr->fill ();
}
diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h
index 1f1189f62a..7192538394 100644
--- a/gtk2_ardour/ghostregion.h
+++ b/gtk2_ardour/ghostregion.h
@@ -122,7 +122,7 @@ public:
private:
ArdourCanvas::Container* _note_group;
- ArdourCanvas::Color _outline;
+ Gtkmm2ext::Color _outline;
ArdourCanvas::Rectangle* _tmp_rect;
ArdourCanvas::Polygon* _tmp_poly;
diff --git a/gtk2_ardour/meter_patterns.cc b/gtk2_ardour/meter_patterns.cc
index 5db4482adc..97b04b9ce5 100644
--- a/gtk2_ardour/meter_patterns.cc
+++ b/gtk2_ardour/meter_patterns.cc
@@ -248,18 +248,18 @@ static void set_bg_color (Gtk::Widget& w, cairo_t* cr, MeterType type) {
double r,g,b,a;
switch(type) {
case MeterVU:
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu bg"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu bg"), r, g, b, a);
break;
case MeterIEC1DIN:
case MeterIEC1NOR:
case MeterIEC2BBC:
case MeterIEC2EBU:
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm bg"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm bg"), r, g, b, a);
break;
case MeterK12:
case MeterK14:
case MeterK20:
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm bg"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm bg"), r, g, b, a);
break;
default:
{
@@ -277,16 +277,16 @@ static void set_fg_color(Gtk::Widget&, MeterType type, Gdk::Color * c) {
double r,g,b,a;
switch(type) {
case MeterVU:
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu fg"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip vu fg"), r, g, b, a);
break;
case MeterIEC1DIN:
case MeterIEC1NOR:
case MeterIEC2BBC:
case MeterIEC2EBU:
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm fg"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip ppm fg"), r, g, b, a);
break;
default:
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm fg"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("meterstrip dpm fg"), r, g, b, a);
break;
}
c->set_rgb_p (r, g, b);
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 145529317a..20a1ee5b25 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -521,8 +521,8 @@ private:
bool _mouse_changed_selection;
- ArdourCanvas::Color _patch_change_outline;
- ArdourCanvas::Color _patch_change_fill;
+ Gtkmm2ext::Color _patch_change_outline;
+ Gtkmm2ext::Color _patch_change_fill;
Evoral::Beats snap_frame_to_grid_underneath (framepos_t p, int32_t divisions, bool shift_snap) const;
diff --git a/gtk2_ardour/mini_timeline.cc b/gtk2_ardour/mini_timeline.cc
index b5259af310..443da0a6f6 100644
--- a/gtk2_ardour/mini_timeline.cc
+++ b/gtk2_ardour/mini_timeline.cc
@@ -20,12 +20,10 @@
#include "ardour/session.h"
#include "ardour/tempo.h"
+#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/keyboard.h"
-#include "canvas/colors.h"
-#include "canvas/utils.h"
-
#include "widgets/tooltips.h"
#include "ardour_ui.h"
@@ -306,14 +304,14 @@ MiniTimeline::format_time (framepos_t when)
}
void
-MiniTimeline::draw_dots (cairo_t* cr, int left, int right, int y, ArdourCanvas::Color color)
+MiniTimeline::draw_dots (cairo_t* cr, int left, int right, int y, Gtkmm2ext::Color color)
{
if (left + 1 >= right) {
return;
}
cairo_move_to (cr, left + .5, y + .5);
cairo_line_to (cr, right - .5, y + .5);
- ArdourCanvas::set_source_rgb_a(cr, color, 0.3);
+ Gtkmm2ext::set_source_rgb_a(cr, color, 0.3);
const double dashes[] = { 0, 1 };
cairo_set_dash (cr, dashes, 2, 1);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
@@ -358,7 +356,7 @@ MiniTimeline::draw_mark (cairo_t* cr, int x0, int x1, const std::string& label,
prelight ? "entered marker" : "location marker");
double r, g, b, a;
- ArdourCanvas::color_to_rgba (color, r, g, b, a);
+ Gtkmm2ext::color_to_rgba (color, r, g, b, a);
if (rw < x0) {
rw = x1;
@@ -445,7 +443,7 @@ MiniTimeline::draw_edge (cairo_t* cr, int x0, int x1, bool left, const std::stri
prelight ? "entered marker" : "location marker");
double r, g, b, a;
- ArdourCanvas::color_to_rgba (color, r, g, b, a);
+ Gtkmm2ext::color_to_rgba (color, r, g, b, a);
if (with_label) {
const int y = PADDING;
@@ -494,8 +492,8 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
{
cairo_t* cr = ctx->cobj();
// TODO cache, set_colors()
- ArdourCanvas::Color base = UIConfiguration::instance().color ("ruler base");
- ArdourCanvas::Color text = UIConfiguration::instance().color ("ruler text");
+ Gtkmm2ext::Color base = UIConfiguration::instance().color ("ruler base");
+ Gtkmm2ext::Color text = UIConfiguration::instance().color ("ruler text");
if (_n_labels == 0) {
return;
@@ -505,7 +503,7 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
const int height = get_height ();
Gtkmm2ext::rounded_rectangle (cr, 0, 0, width, height, 4);
- ArdourCanvas::set_source_rgba(cr, base);
+ Gtkmm2ext::set_source_rgba(cr, base);
cairo_fill (cr);
Gtkmm2ext::rounded_rectangle (cr, PADDING, PADDING, width - PADDING - PADDING, height - PADDING - PADDING, 4);
@@ -537,7 +535,7 @@ MiniTimeline::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
draw_dots (cr, dot_left, x0, y0 + _time_height * .5, text);
cairo_move_to (cr, x0, y0);
- ArdourCanvas::set_source_rgba(cr, text);
+ Gtkmm2ext::set_source_rgba(cr, text);
pango_cairo_show_layout (cr, _layout->gobj());
dot_left = x0 + lw;
}
diff --git a/gtk2_ardour/mini_timeline.h b/gtk2_ardour/mini_timeline.h
index bfa84edef3..1dd1a527b7 100644
--- a/gtk2_ardour/mini_timeline.h
+++ b/gtk2_ardour/mini_timeline.h
@@ -64,7 +64,7 @@ private:
void calculate_time_width ();
void calculate_time_spacing ();
void update_minitimeline ();
- void draw_dots (cairo_t*, int left, int right, int y, ArdourCanvas::Color);
+ void draw_dots (cairo_t*, int left, int right, int y, Gtkmm2ext::Color);
int draw_mark (cairo_t*, int x0, int x1, const std::string&, bool& prelight);
int draw_edge (cairo_t*, int x0, int x1, bool left, const std::string&, bool& prelight);
diff --git a/gtk2_ardour/mixer_group_tabs.cc b/gtk2_ardour/mixer_group_tabs.cc
index c26a553905..8b5907c7d8 100644
--- a/gtk2_ardour/mixer_group_tabs.cc
+++ b/gtk2_ardour/mixer_group_tabs.cc
@@ -23,7 +23,7 @@
#include "ardour/route_group.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "mixer_group_tabs.h"
#include "mixer_strip.h"
@@ -113,9 +113,9 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab)
double r, g, b, a;
if (tab.group && tab.group->is_active()) {
- ArdourCanvas::color_to_rgba (tab.color, r, g, b, a);
+ Gtkmm2ext::color_to_rgba (tab.color, r, g, b, a);
} else {
- ArdourCanvas::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a);
+ Gtkmm2ext::color_to_rgba (UIConfiguration::instance().color ("inactive group tab"), r, g, b, a);
}
a = 1.0;
@@ -140,8 +140,8 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab)
cairo_move_to (cr, tab.from + (tab.to - tab.from - text_width) * .5, (get_height () - text_height) * .5);
- ArdourCanvas::Color c = ArdourCanvas::contrasting_text_color (ArdourCanvas::rgba_to_color (r, g, b, a));
- ArdourCanvas::color_to_rgba (c, r, g, b, a);
+ Gtkmm2ext::Color c = Gtkmm2ext::contrasting_text_color (Gtkmm2ext::rgba_to_color (r, g, b, a));
+ Gtkmm2ext::color_to_rgba (c, r, g, b, a);
cairo_set_source_rgb (cr, r, g, b);
pango_cairo_show_layout (cr, layout->gobj ());
diff --git a/gtk2_ardour/note_base.cc b/gtk2_ardour/note_base.cc
index 5142586715..283910d1c8 100644
--- a/gtk2_ardour/note_base.cc
+++ b/gtk2_ardour/note_base.cc
@@ -142,7 +142,7 @@ NoteBase::on_channel_selection_change(uint16_t selection)
{
// make note change its color if its channel is not marked active
if ( (selection & (1 << _note->channel())) == 0 ) {
- const ArdourCanvas::Color inactive_ch = UIConfiguration::instance().color ("midi note inactive channel");
+ const Gtkmm2ext::Color inactive_ch = UIConfiguration::instance().color ("midi note inactive channel");
set_fill_color(inactive_ch);
set_outline_color(calculate_outline(inactive_ch, _selected));
} else {
diff --git a/gtk2_ardour/panner2d.cc b/gtk2_ardour/panner2d.cc
index eebc53d550..3a8ee3d95a 100644
--- a/gtk2_ardour/panner2d.cc
+++ b/gtk2_ardour/panner2d.cc
@@ -33,7 +33,7 @@
#include "ardour/pannable.h"
#include "ardour/speakers.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "panner2d.h"
#include "keyboard.h"
diff --git a/gtk2_ardour/patch_change.cc b/gtk2_ardour/patch_change.cc
index 3070011380..739cda4702 100644
--- a/gtk2_ardour/patch_change.cc
+++ b/gtk2_ardour/patch_change.cc
@@ -51,8 +51,8 @@ PatchChange::PatchChange(MidiRegionView& region,
double y,
ARDOUR::InstrumentInfo& info,
ARDOUR::MidiModel::PatchChangePtr patch,
- ArdourCanvas::Color outline_color,
- ArdourCanvas::Color fill_color)
+ Gtkmm2ext::Color outline_color,
+ Gtkmm2ext::Color fill_color)
: _region (region)
, _info (info)
, _patch (patch)
diff --git a/gtk2_ardour/patch_change.h b/gtk2_ardour/patch_change.h
index 791252e7ae..e10b2fdda1 100644
--- a/gtk2_ardour/patch_change.h
+++ b/gtk2_ardour/patch_change.h
@@ -41,8 +41,8 @@ public:
double y,
ARDOUR::InstrumentInfo& info,
ARDOUR::MidiModel::PatchChangePtr patch,
- ArdourCanvas::Color outline_color,
- ArdourCanvas::Color fill_color);
+ Gtkmm2ext::Color outline_color,
+ Gtkmm2ext::Color fill_color);
~PatchChange();
diff --git a/gtk2_ardour/port_matrix_column_labels.cc b/gtk2_ardour/port_matrix_column_labels.cc
index 4cf12b58b3..372e6fe7c5 100644
--- a/gtk2_ardour/port_matrix_column_labels.cc
+++ b/gtk2_ardour/port_matrix_column_labels.cc
@@ -20,7 +20,7 @@
#include <iostream>
#include "gtkmm2ext/keyboard.h"
#include "ardour/bundle.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "utils.h"
#include "port_matrix_column_labels.h"
#include "port_matrix.h"
@@ -294,7 +294,7 @@ PortMatrixColumnLabels::render_bundle_name (
cairo_stroke (cr);
Gdk::Color textcolor;
- ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, ArdourCanvas::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
+ ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, Gtkmm2ext::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
set_source_rgb (cr, textcolor);
double const q = ((grid_spacing() * sin (angle())) - _text_height) / 2 + _descender_height;
@@ -348,7 +348,7 @@ PortMatrixColumnLabels::render_channel_name (
cairo_stroke (cr);
Gdk::Color textcolor;
- ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, ArdourCanvas::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
+ ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, Gtkmm2ext::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
set_source_rgb (cr, textcolor);
double const q = ((grid_spacing() * sin (angle())) - _text_height) / 2 + _descender_height;
diff --git a/gtk2_ardour/port_matrix_row_labels.cc b/gtk2_ardour/port_matrix_row_labels.cc
index c6b02eb488..ff7ac6a48a 100644
--- a/gtk2_ardour/port_matrix_row_labels.cc
+++ b/gtk2_ardour/port_matrix_row_labels.cc
@@ -22,7 +22,7 @@
#include <cairo.h>
#include "gtkmm2ext/keyboard.h"
#include "ardour/bundle.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "utils.h"
#include "port_matrix_row_labels.h"
#include "port_matrix.h"
@@ -236,7 +236,7 @@ PortMatrixRowLabels::render_bundle_name (
double const off = (grid_spacing() - ext.height) / 2;
Gdk::Color textcolor;
- ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, ArdourCanvas::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
+ ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, Gtkmm2ext::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
set_source_rgb (cr, textcolor);
cairo_move_to (cr, xoff + x + name_pad(), yoff + name_pad() + off);
cairo_show_text (cr, b->name().c_str());
@@ -264,7 +264,7 @@ PortMatrixRowLabels::render_channel_name (
double const off = (grid_spacing() - ext.height) / 2;
Gdk::Color textcolor;
- ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, ArdourCanvas::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
+ ARDOUR_UI_UTILS::set_color_from_rgba(textcolor, Gtkmm2ext::contrasting_text_color(ARDOUR_UI_UTILS::gdk_color_to_rgba(bg_colour)));
set_source_rgb (cr, textcolor);
cairo_move_to (cr, port_name_x() + xoff + name_pad(), yoff + name_pad() + off);
cairo_show_text (cr, bc.bundle->channel_name(bc.channel).c_str());
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 1f5538c577..fa1b300e7b 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -27,13 +27,12 @@
#include <sigc++/bind.h>
-#include "canvas/utils.h"
-
#include <glibmm/miscutils.h>
#include <glibmm/fileutils.h>
#include <gtkmm/messagedialog.h>
+#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/gtk_ui.h"
#include "gtkmm2ext/menu_elems.h"
#include "gtkmm2ext/utils.h"
@@ -1730,12 +1729,12 @@ ProcessorEntry::PluginDisplay::on_expose_event (GdkEventExpose* ev)
bool failed = false;
std::string name = get_name();
- ArdourCanvas::Color fill_color = UIConfiguration::instance().color (string_compose ("%1: fill active", name), &failed);
+ Gtkmm2ext::Color fill_color = UIConfiguration::instance().color (string_compose ("%1: fill active", name), &failed);
Gtkmm2ext::rounded_rectangle (cr, .5, -1.5, width - 1, height + 1, 7);
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
cairo_set_line_width(cr, 1.0);
- ArdourCanvas::set_source_rgb_a (cr, fill_color, 1.0);
+ Gtkmm2ext::set_source_rgb_a (cr, fill_color, 1.0);
cairo_stroke (cr);
cairo_destroy(cr);
diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc
index 893a973ddd..b5ffc582ce 100644
--- a/gtk2_ardour/region_view.cc
+++ b/gtk2_ardour/region_view.cc
@@ -28,13 +28,13 @@
#include "ardour/profile.h"
#include "ardour/session.h"
+#include "gtkmm2ext/colors.h"
+
#include "canvas/polygon.h"
#include "canvas/debug.h"
#include "canvas/pixbuf.h"
#include "canvas/text.h"
#include "canvas/line.h"
-#include "canvas/utils.h"
-#include "canvas/colors.h"
#include "streamview.h"
#include "region_view.h"
@@ -512,7 +512,7 @@ void
RegionView::set_sync_mark_color ()
{
if (sync_mark) {
- ArdourCanvas::Color c = UIConfiguration::instance().color ("sync mark");
+ Gtkmm2ext::Color c = UIConfiguration::instance().color ("sync mark");
sync_mark->set_fill_color (c);
sync_mark->set_outline_color (c);
sync_line->set_outline_color (c);
@@ -522,7 +522,7 @@ RegionView::set_sync_mark_color ()
uint32_t
RegionView::get_fill_color () const
{
- ArdourCanvas::Color f = TimeAxisViewItem::get_fill_color();
+ Gtkmm2ext::Color f = TimeAxisViewItem::get_fill_color();
char const *modname;
if (_region->opaque() && (!ARDOUR::Profile->get_mixbus() || (!_dragging && !_region->muted ()))) {
@@ -531,7 +531,7 @@ RegionView::get_fill_color () const
modname = "transparent region base";
}
- return HSV(f).mod (UIConfiguration::instance().modifier (modname)).color ();
+ return Gtkmm2ext::HSV(f).mod (UIConfiguration::instance().modifier (modname)).color ();
}
void
diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc
index 816365948a..25bc095389 100644
--- a/gtk2_ardour/route_time_axis.cc
+++ b/gtk2_ardour/route_time_axis.cc
@@ -965,7 +965,7 @@ RouteTimeAxisView::show_timestretch (framepos_t start, framepos_t end, int layer
if (timestretch_rect == 0) {
timestretch_rect = new ArdourCanvas::Rectangle (canvas_display ());
- timestretch_rect->set_fill_color (ArdourCanvas::HSV (UIConfiguration::instance().color ("time stretch fill")).mod (UIConfiguration::instance().modifier ("time stretch fill")).color());
+ timestretch_rect->set_fill_color (Gtkmm2ext::HSV (UIConfiguration::instance().color ("time stretch fill")).mod (UIConfiguration::instance().modifier ("time stretch fill")).color());
timestretch_rect->set_outline_color (UIConfiguration::instance().color ("time stretch outline"));
}
diff --git a/gtk2_ardour/shuttle_control.cc b/gtk2_ardour/shuttle_control.cc
index 027a432593..ce3ce3c593 100644
--- a/gtk2_ardour/shuttle_control.cc
+++ b/gtk2_ardour/shuttle_control.cc
@@ -27,14 +27,12 @@
#include "ardour/rc_configuration.h"
#include "ardour/session.h"
+#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/keyboard.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/rgb_macros.h"
-#include "canvas/utils.h"
-#include "canvas/colors.h"
-
#include "widgets/tooltips.h"
#include "actions.h"
@@ -611,7 +609,7 @@ ShuttleControl::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangl
rounded_rectangle (cr, x + 1, 1, marker_size - 2, get_height() - 2, 3.5);
if (_flat_buttons) {
uint32_t col = UIConfiguration::instance().color ("shuttle");
- ArdourCanvas::set_source_rgba (cr, col);
+ Gtkmm2ext::set_source_rgba (cr, col);
} else {
cairo_set_source (cr, pattern);
}
diff --git a/gtk2_ardour/stereo_panner.cc b/gtk2_ardour/stereo_panner.cc
index b825c01fd1..e5b91d3978 100644
--- a/gtk2_ardour/stereo_panner.cc
+++ b/gtk2_ardour/stereo_panner.cc
@@ -36,7 +36,7 @@
#include "ardour/panner.h"
#include "ardour/panner_shell.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "stereo_panner.h"
#include "stereo_panner_editor.h"
@@ -674,7 +674,7 @@ StereoPanner::set_colors ()
{
colors[Normal].fill = UIConfiguration::instance().color_mod ("stereo panner fill", "panner fill");
// colors[Normal].outline = UIConfiguration::instance().color ("stereo panner outline");
- colors[Normal].outline = ArdourCanvas::HSV (colors[Normal].fill).outline().color ();
+ colors[Normal].outline = Gtkmm2ext::HSV (colors[Normal].fill).outline().color ();
colors[Normal].text = UIConfiguration::instance().color ("stereo panner text");
colors[Normal].background = UIConfiguration::instance().color ("stereo panner bg");
colors[Normal].rule = UIConfiguration::instance().color ("stereo panner rule");
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index 403c5d73ef..dbaaf0268d 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -32,14 +32,14 @@
#include "ardour/profile.h"
+#include "gtkmm2ext/colors.h"
+#include "gtkmm2ext/doi.h"
+#include "gtkmm2ext/utils.h"
+
#include "canvas/canvas.h"
#include "canvas/rectangle.h"
#include "canvas/debug.h"
#include "canvas/utils.h"
-#include "canvas/colors.h"
-
-#include "gtkmm2ext/doi.h"
-#include "gtkmm2ext/utils.h"
#include "widgets/tooltips.h"
@@ -129,7 +129,7 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie
_canvas_separator = new ArdourCanvas::Line(_canvas_display);
CANVAS_DEBUG_NAME (_canvas_separator, "separator for TAV");
_canvas_separator->set (ArdourCanvas::Duple(0.0, 0.0), ArdourCanvas::Duple(ArdourCanvas::COORD_MAX, 0.0));
- _canvas_separator->set_outline_color(ArdourCanvas::rgba_to_color (0, 0, 0, 1.0));
+ _canvas_separator->set_outline_color(Gtkmm2ext::rgba_to_color (0, 0, 0, 1.0));
_canvas_separator->set_outline_width(1.0);
_canvas_separator->hide();
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index 0587db9e2c..3f1adb9a1c 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -32,7 +32,7 @@
#include "canvas/rectangle.h"
#include "canvas/debug.h"
#include "canvas/text.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "ardour/profile.h"
@@ -666,10 +666,10 @@ TimeAxisViewItem::set_name_text_color ()
f = get_fill_color ();
}
- name_text->set_color (ArdourCanvas::contrasting_text_color (f));
+ name_text->set_color (contrasting_text_color (f));
}
-ArdourCanvas::Color
+Gtkmm2ext::Color
TimeAxisViewItem::get_fill_color () const
{
const std::string mod_name = (_dragging ? "dragging region" : fill_color_name);
@@ -714,20 +714,20 @@ TimeAxisViewItem::set_frame_gradient ()
ArdourCanvas::Fill::StopList stops;
double r, g, b, a;
double h, s, v;
- ArdourCanvas::Color f (get_fill_color());
+ Color f (get_fill_color());
/* need to get alpha value */
- ArdourCanvas::color_to_rgba (f, r, g, b, a);
+ color_to_rgba (f, r, g, b, a);
stops.push_back (std::make_pair (0.0, f));
/* now a darker version */
- ArdourCanvas::color_to_hsv (f, h, s, v);
+ color_to_hsv (f, h, s, v);
v = min (1.0, v * (1.0 - UIConfiguration::instance().get_timeline_item_gradient_depth()));
- ArdourCanvas::Color darker = ArdourCanvas::hsva_to_color (h, s, v, a);
+ Color darker = hsva_to_color (h, s, v, a);
stops.push_back (std::make_pair (1.0, darker));
frame->set_gradient (stops, true);
diff --git a/gtk2_ardour/toolbar_test.cc b/gtk2_ardour/toolbar_test.cc
index ab248fde72..338e8f8f2c 100644
--- a/gtk2_ardour/toolbar_test.cc
+++ b/gtk2_ardour/toolbar_test.cc
@@ -26,7 +26,7 @@
#include "canvas/types.h"
#include "canvas/canvas.h"
#include "canvas/container.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/debug.h"
#include "canvas/grid.h"
#include "canvas/scroll_group.h"
diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc
index a5f80dc741..b6531e91d6 100644
--- a/gtk2_ardour/ui_config.cc
+++ b/gtk2_ardour/ui_config.cc
@@ -60,7 +60,7 @@
using namespace std;
using namespace PBD;
using namespace ARDOUR;
-using namespace ArdourCanvas;
+using namespace Gtkmm2ext;
static const char* ui_config_file_name = "ui_config";
static const char* default_ui_config_file_name = "default_ui_config";
@@ -143,7 +143,7 @@ UIConfiguration::reset_gtk_theme ()
if (g->first.find ("gtk_") == 0) {
const string gtk_name = g->first.substr (4);
- ArdourCanvas::Color a_color = color (g->second);
+ Gtkmm2ext::Color a_color = color (g->second);
color_scheme_string += gtk_name + ":#" + color_to_hex_string_no_alpha (a_color) + ';';
}
@@ -617,7 +617,7 @@ UIConfiguration::load_colors (XMLNode const & node)
color = child->property (X_("value"));
if (name && color) {
- ArdourCanvas::Color c;
+ Gtkmm2ext::Color c;
c = strtoul (color->value().c_str(), 0, 16);
/* insert or replace color name definition */
colors[name->value()] = c;
@@ -661,7 +661,7 @@ UIConfiguration::set_variables (const XMLNode& node)
#undef CANVAS_FONT_VARIABLE
}
-ArdourCanvas::SVAModifier
+Gtkmm2ext::SVAModifier
UIConfiguration::modifier (string const & name) const
{
Modifiers::const_iterator m = modifiers.find (name);
@@ -671,19 +671,19 @@ UIConfiguration::modifier (string const & name) const
return SVAModifier ();
}
-ArdourCanvas::Color
+Gtkmm2ext::Color
UIConfiguration::color_mod (std::string const & colorname, std::string const & modifiername) const
{
return HSV (color (colorname)).mod (modifier (modifiername)).color ();
}
-ArdourCanvas::Color
-UIConfiguration::color_mod (const ArdourCanvas::Color& color, std::string const & modifiername) const
+Gtkmm2ext::Color
+UIConfiguration::color_mod (const Gtkmm2ext::Color& color, std::string const & modifiername) const
{
return HSV (color).mod (modifier (modifiername)).color ();
}
-ArdourCanvas::Color
+Gtkmm2ext::Color
UIConfiguration::color (const std::string& name, bool* failed) const
{
ColorAliases::const_iterator e = color_aliases.find (name);
@@ -731,7 +731,7 @@ UIConfiguration::quantized (Color c) const
}
void
-UIConfiguration::set_color (string const& name, ArdourCanvas::Color color)
+UIConfiguration::set_color (string const& name, Gtkmm2ext::Color color)
{
Colors::iterator i = colors.find (name);
if (i == colors.end()) {
@@ -791,7 +791,7 @@ UIConfiguration::load_rc_file (bool themechange, bool allow_own)
}
std::string
-UIConfiguration::color_to_hex_string (ArdourCanvas::Color c)
+UIConfiguration::color_to_hex_string (Gtkmm2ext::Color c)
{
char buf[16];
int retval = g_snprintf (buf, sizeof(buf), "%08x", c);
@@ -803,7 +803,7 @@ UIConfiguration::color_to_hex_string (ArdourCanvas::Color c)
}
std::string
-UIConfiguration::color_to_hex_string_no_alpha (ArdourCanvas::Color c)
+UIConfiguration::color_to_hex_string_no_alpha (Gtkmm2ext::Color c)
{
c >>= 8; // shift/remove alpha
char buf[16];
diff --git a/gtk2_ardour/ui_config.h b/gtk2_ardour/ui_config.h
index 159884a14f..4b7de631d6 100644
--- a/gtk2_ardour/ui_config.h
+++ b/gtk2_ardour/ui_config.h
@@ -34,7 +34,7 @@
#include "pbd/xml++.h"
#include "pbd/configuration_variable.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "widgets/ui_config.h"
#include "utils.h"
@@ -64,29 +64,29 @@ public:
std::string color_file_name (bool use_my, bool with_version) const;
- typedef std::map<std::string,ArdourCanvas::Color> Colors;
+ typedef std::map<std::string,Gtkmm2ext::Color> Colors;
typedef std::map<std::string,std::string> ColorAliases;
- typedef std::map<std::string,ArdourCanvas::SVAModifier> Modifiers;
+ typedef std::map<std::string,Gtkmm2ext::SVAModifier> Modifiers;
Colors colors;
ColorAliases color_aliases;
Modifiers modifiers;
void set_alias (std::string const & name, std::string const & alias);
- void set_color (const std::string& name, ArdourCanvas::Color);
- void set_modifier (std::string const &, ArdourCanvas::SVAModifier svam);
+ void set_color (const std::string& name, Gtkmm2ext::Color);
+ void set_modifier (std::string const &, Gtkmm2ext::SVAModifier svam);
- std::string color_as_alias (ArdourCanvas::Color c);
- ArdourCanvas::Color quantized (ArdourCanvas::Color) const;
+ std::string color_as_alias (Gtkmm2ext::Color c);
+ Gtkmm2ext::Color quantized (Gtkmm2ext::Color) const;
- ArdourCanvas::Color color (const std::string&, bool* failed = 0) const;
- ArdourCanvas::Color color_mod (std::string const & color, std::string const & modifier) const;
- ArdourCanvas::Color color_mod (const ArdourCanvas::Color& color, std::string const & modifier) const;
- ArdourCanvas::HSV color_hsv (const std::string&) const;
- ArdourCanvas::SVAModifier modifier (const std::string&) const;
+ Gtkmm2ext::Color color (const std::string&, bool* failed = 0) const;
+ Gtkmm2ext::Color color_mod (std::string const & color, std::string const & modifier) const;
+ Gtkmm2ext::Color color_mod (const Gtkmm2ext::Color& color, std::string const & modifier) const;
+ Gtkmm2ext::HSV color_hsv (const std::string&) const;
+ Gtkmm2ext::SVAModifier modifier (const std::string&) const;
- static std::string color_to_hex_string (ArdourCanvas::Color c);
- static std::string color_to_hex_string_no_alpha (ArdourCanvas::Color c);
+ static std::string color_to_hex_string (Gtkmm2ext::Color c);
+ static std::string color_to_hex_string_no_alpha (Gtkmm2ext::Color c);
void reset_dpi ();
float get_ui_scale ();
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index d1331706aa..97c36b7faf 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -46,11 +46,11 @@
#include "ardour/filesystem_paths.h"
#include "ardour/search_paths.h"
-#include "canvas/item.h"
-#include "canvas/utils.h"
-
+#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/utils.h"
+#include "canvas/item.h"
+
#include "debug.h"
#include "public_editor.h"
#include "keyboard.h"
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index c9a52c96cf..6713844ba6 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -69,8 +69,6 @@ uint32_t gdk_color_to_rgba (Gdk::Color const&);
void set_color_from_rgb (Gdk::Color&, uint32_t);
void set_color_from_rgba (Gdk::Color&, uint32_t);
-uint32_t contrasting_text_color (uint32_t c);
-
bool relay_key_press (GdkEventKey* ev, Gtk::Window* win);
bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev);
bool emulate_key_event (unsigned int);
diff --git a/libs/ardour/lua_api.cc b/libs/ardour/lua_api.cc
index 0e82276b1e..42f270e452 100644
--- a/libs/ardour/lua_api.cc
+++ b/libs/ardour/lua_api.cc
@@ -486,7 +486,7 @@ ARDOUR::LuaAPI::hsla_to_rgba (lua_State *L)
a = luabridge::Stack<double>::get (L, 4);
}
- // we can't use ArdourCanvas::hsva_to_color here
+ // we can't use Gtkmm2ext::hsva_to_color here
// besides we want HSL not HSV and without intermediate
// color_to_rgba (rgba_to_color ())
double r, g, b;
@@ -515,7 +515,7 @@ ARDOUR::LuaAPI::color_to_rgba (lua_State *L)
/* libardour is no user of libcanvas, otherwise
* we could just call
- * ArdourCanvas::color_to_rgba (color, r, g, b, a);
+ * Gtkmm2ext::color_to_rgba (color, r, g, b, a);
*/
r = ((color >> 24) & 0xff) / 255.0;
g = ((color >> 16) & 0xff) / 255.0;
diff --git a/libs/canvas/arc.cc b/libs/canvas/arc.cc
index 49b3f63f0a..7465c52531 100644
--- a/libs/canvas/arc.cc
+++ b/libs/canvas/arc.cc
@@ -25,7 +25,6 @@
#include "canvas/circle.h"
#include "canvas/types.h"
#include "canvas/debug.h"
-#include "canvas/utils.h"
#include "canvas/canvas.h"
using namespace std;
diff --git a/libs/canvas/arrow.cc b/libs/canvas/arrow.cc
index 1f8f5b44ec..eef82dc4d7 100644
--- a/libs/canvas/arrow.cc
+++ b/libs/canvas/arrow.cc
@@ -262,7 +262,7 @@ Arrow::setup_polygon (int which)
* @param color New color.
*/
void
-Arrow::set_color (Color color)
+Arrow::set_color (Gtkmm2ext::Color color)
{
_line->set_outline_color (color);
for (int i = 0; i < 2; ++i) {
diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc
index 47784626aa..3c89ebd6e2 100644
--- a/libs/canvas/canvas.cc
+++ b/libs/canvas/canvas.cc
@@ -38,11 +38,10 @@
#include "pbd/stacktrace.h"
#include "canvas/canvas.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/debug.h"
#include "canvas/line.h"
#include "canvas/scroll_group.h"
-#include "canvas/utils.h"
#ifdef __APPLE__
#include <gdk/gdk.h>
@@ -57,7 +56,7 @@ uint32_t Canvas::tooltip_timeout_msecs = 750;
/** Construct a new Canvas */
Canvas::Canvas ()
: _root (this)
- , _bg_color (rgba_to_color (0, 1.0, 0.0, 1.0))
+ , _bg_color (Gtkmm2ext::rgba_to_color (0, 1.0, 0.0, 1.0))
, _last_render_start_timestamp(0)
{
set_epoch ();
@@ -407,7 +406,7 @@ Canvas::set_tooltip_timeout (uint32_t msecs)
}
void
-Canvas::set_background_color (Color c)
+Canvas::set_background_color (Gtkmm2ext::Color c)
{
_bg_color = c;
@@ -926,7 +925,7 @@ GtkCanvas::on_expose_event (GdkEventExpose* ev)
/* draw background color */
draw_context->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
- set_source_rgba (draw_context, _bg_color);
+ Gtkmm2ext::set_source_rgba (draw_context, _bg_color);
draw_context->fill ();
/* render canvas */
diff --git a/libs/canvas/canvas/arrow.h b/libs/canvas/canvas/arrow.h
index ba74fa90e7..e04d450c18 100644
--- a/libs/canvas/canvas/arrow.h
+++ b/libs/canvas/canvas/arrow.h
@@ -58,7 +58,7 @@ public:
void set_head_height (int, Distance);
void set_head_width (int, Distance);
void set_outline_width (Distance);
- void set_color (Color);
+ void set_color (Gtkmm2ext::Color);
Coord x () const;
Coord y1 () const;
@@ -67,7 +67,7 @@ public:
void set_y0 (Coord);
void set_y1 (Coord);
- bool covers (Duple const &) const;
+ bool covers (Duple const &) const;
private:
void setup_polygon (int);
diff --git a/libs/canvas/canvas/box.h b/libs/canvas/canvas/box.h
index b3b2b85303..cefbc716df 100644
--- a/libs/canvas/canvas/box.h
+++ b/libs/canvas/canvas/box.h
@@ -56,7 +56,7 @@ public:
/* aliases so that CSS box model terms work */
void set_border_width (double w) { set_outline_width (w); }
- void set_border_color (Color c) { set_outline_color (c); }
+ void set_border_color (Gtkmm2ext::Color c) { set_outline_color (c); }
void add (Item*);
void pack_start (Item*, double extra_padding = 0);
diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h
index 3bcf58256d..6d8fd89a7a 100644
--- a/libs/canvas/canvas/canvas.h
+++ b/libs/canvas/canvas/canvas.h
@@ -98,8 +98,8 @@ public:
return &_root;
}
- void set_background_color (ArdourCanvas::Color);
- ArdourCanvas::Color background_color() const { return _bg_color; }
+ void set_background_color (Gtkmm2ext::Color);
+ Gtkmm2ext::Color background_color() const { return _bg_color; }
/** Called when an item is being destroyed */
virtual void item_going_away (Item *, Rect) {}
@@ -170,8 +170,8 @@ public:
virtual Glib::RefPtr<Pango::Context> get_pango_context() = 0;
protected:
- Root _root;
- Color _bg_color;
+ Root _root;
+ Gtkmm2ext::Color _bg_color;
mutable gint64 _last_render_start_timestamp;
diff --git a/libs/canvas/canvas/fill.h b/libs/canvas/canvas/fill.h
index 42160a6190..95a29fd760 100644
--- a/libs/canvas/canvas/fill.h
+++ b/libs/canvas/canvas/fill.h
@@ -38,10 +38,10 @@ public:
Fill (Item& self);
virtual ~Fill() {}
- virtual void set_fill_color (Color);
+ virtual void set_fill_color (Gtkmm2ext::Color);
virtual void set_fill (bool);
- Color fill_color () const {
+ Gtkmm2ext::Color fill_color () const {
return _fill_color;
}
@@ -49,23 +49,23 @@ public:
return _fill;
}
- typedef std::vector<std::pair<double,Color> > StopList;
+ typedef std::vector<std::pair<double,Gtkmm2ext::Color> > StopList;
- void set_gradient (StopList const & stops, bool is_vertical);
+ void set_gradient (StopList const & stops, bool is_vertical);
- void set_pattern (Cairo::RefPtr<Cairo::Pattern>);
+ void set_pattern (Cairo::RefPtr<Cairo::Pattern>);
protected:
void setup_fill_context (Cairo::RefPtr<Cairo::Context>) const;
- void setup_gradient_context (Cairo::RefPtr<Cairo::Context>, Rect const &, Duple const &) const;
+ void setup_gradient_context (Cairo::RefPtr<Cairo::Context>, Rect const &, Duple const &) const;
- Item& _self;
- Color _fill_color;
+ Item& _self;
+ Gtkmm2ext::Color _fill_color;
bool _fill;
bool _transparent;
- StopList _stops;
- bool _vertical_gradient;
- Cairo::RefPtr<Cairo::Pattern> _pattern;
+ StopList _stops;
+ bool _vertical_gradient;
+ Cairo::RefPtr<Cairo::Pattern> _pattern;
};
diff --git a/libs/canvas/canvas/flag.h b/libs/canvas/canvas/flag.h
index 580adb2837..ac77cc759f 100644
--- a/libs/canvas/canvas/flag.h
+++ b/libs/canvas/canvas/flag.h
@@ -35,23 +35,23 @@ class Rectangle;
class LIBCANVAS_API Flag : public Container
{
public:
- Flag (Canvas *, Distance, Color, Color, Duple, bool invert=false);
- Flag (Item*, Distance, Color, Color, Duple, bool invert=false);
+ Flag (Canvas *, Distance, Gtkmm2ext::Color, Gtkmm2ext::Color, Duple, bool invert=false);
+ Flag (Item*, Distance, Gtkmm2ext::Color, Gtkmm2ext::Color, Duple, bool invert=false);
void set_text (std::string const &);
void set_height (Distance);
void set_font_description (Pango::FontDescription);
- bool covers (Duple const &) const;
+ bool covers (Duple const &) const;
double width() const;
private:
void setup (Distance height, Duple position);
- Color _outline_color;
- Color _fill_color;
+ Gtkmm2ext::Color _outline_color;
+ Gtkmm2ext::Color _fill_color;
Text* _text;
Line* _line;
Rectangle* _rectangle;
diff --git a/libs/canvas/canvas/grid.h b/libs/canvas/canvas/grid.h
index 8e6dd3b7de..aa14f2b17a 100644
--- a/libs/canvas/canvas/grid.h
+++ b/libs/canvas/canvas/grid.h
@@ -45,7 +45,7 @@ public:
/* aliases so that CSS box model terms work */
void set_border_width (double w) { set_outline_width (w); }
- void set_border_color (Color c) { set_outline_color (c); }
+ void set_border_color (Gtkmm2ext::Color c) { set_outline_color (c); }
void place (Item*, double x, double y, double col_span = 1, double row_span = 1);
diff --git a/libs/canvas/canvas/line_set.h b/libs/canvas/canvas/line_set.h
index c305cceab5..ccce24aa89 100644
--- a/libs/canvas/canvas/line_set.h
+++ b/libs/canvas/canvas/line_set.h
@@ -41,20 +41,20 @@ public:
void compute_bounding_box () const;
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
- bool covers (Duple const &) const;
+ bool covers (Duple const &) const;
void set_extent (Distance);
Distance extent() const { return _extent; }
- void add (Coord, Distance, Color);
+ void add (Coord, Distance, Gtkmm2ext::Color);
void clear ();
struct Line {
- Line (Coord p, Distance width_, Color color_) : pos (p), width (width_), color (color_) {}
+ Line (Coord p, Distance width_, Gtkmm2ext::Color color_) : pos (p), width (width_), color (color_) {}
Coord pos;
Distance width;
- Color color;
+ Gtkmm2ext::Color color;
};
private:
diff --git a/libs/canvas/canvas/outline.h b/libs/canvas/canvas/outline.h
index 38f8eb2e32..b33c993077 100644
--- a/libs/canvas/canvas/outline.h
+++ b/libs/canvas/canvas/outline.h
@@ -37,11 +37,11 @@ public:
Outline (Item& self);
virtual ~Outline() {}
- Color outline_color () const {
+ Gtkmm2ext::Color outline_color () const {
return _outline_color;
}
- virtual void set_outline_color (Color);
+ virtual void set_outline_color (Gtkmm2ext::Color);
Distance outline_width () const {
return _outline_width;
@@ -59,10 +59,10 @@ protected:
void setup_outline_context (Cairo::RefPtr<Cairo::Context>) const;
- Item& _self;
- Color _outline_color;
- Distance _outline_width;
- bool _outline;
+ Item& _self;
+ Gtkmm2ext::Color _outline_color;
+ Distance _outline_width;
+ bool _outline;
};
}
diff --git a/libs/canvas/canvas/ruler.h b/libs/canvas/canvas/ruler.h
index 751ddcc104..59ce625dca 100644
--- a/libs/canvas/canvas/ruler.h
+++ b/libs/canvas/canvas/ruler.h
@@ -70,19 +70,18 @@ public:
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
- void set_divide_colors (Color top, Color bottom);
+ void set_divide_colors (Gtkmm2ext::Color top, Gtkmm2ext::Color bottom);
void set_divide_height (double);
private:
const Metric* _metric;
- /* lower and upper and sample positions, which are also canvas coordinates
- */
+ /* lower and upper and sample positions, which are also canvas coordinates */
- Coord _lower;
- Coord _upper;
- double _divide_height;
- Color _divider_color_top;
- Color _divider_color_bottom;
+ Coord _lower;
+ Coord _upper;
+ double _divide_height;
+ Gtkmm2ext::Color _divider_color_top;
+ Gtkmm2ext::Color _divider_color_bottom;
Pango::FontDescription* _font_description;
mutable std::vector<Mark> marks;
diff --git a/libs/canvas/canvas/text.h b/libs/canvas/canvas/text.h
index bd6c049606..c05bc69050 100644
--- a/libs/canvas/canvas/text.h
+++ b/libs/canvas/canvas/text.h
@@ -33,43 +33,43 @@ class LIBCANVAS_API Text : public Item
public:
Text (Canvas*);
Text (Item*);
- ~Text();
+ ~Text();
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const;
- ArdourCanvas::Color color () const { return _color; }
- void set_color (ArdourCanvas::Color);
+ Gtkmm2ext::Color color () const { return _color; }
+ void set_color (Gtkmm2ext::Color);
void set (std::string const &);
void set_font_description (Pango::FontDescription);
void set_alignment (Pango::Alignment);
- void clamp_width (double);
+ void clamp_width (double);
- double width() const;
- double height() const;
+ double width() const;
+ double height() const;
- void set_size_chars (int nchars);
- void dump (std::ostream&) const;
+ void set_size_chars (int nchars);
+ void dump (std::ostream&) const;
std::string text() const { return _text; }
double text_width() const;
private:
std::string _text;
- ArdourCanvas::Color _color;
+ Gtkmm2ext::Color _color;
Pango::FontDescription* _font_description;
Pango::Alignment _alignment;
- mutable Cairo::RefPtr<Cairo::ImageSurface> _image;
- mutable Duple _origin;
- mutable double _width;
- mutable double _height;
- mutable bool _need_redraw;
- mutable double _width_correction;
- double _clamped_width;
-
- void _redraw () const;
+ mutable Cairo::RefPtr<Cairo::ImageSurface> _image;
+ mutable Duple _origin;
+ mutable double _width;
+ mutable double _height;
+ mutable bool _need_redraw;
+ mutable double _width_correction;
+ double _clamped_width;
+
+ void _redraw () const;
};
}
diff --git a/libs/canvas/canvas/types.h b/libs/canvas/canvas/types.h
index a3f1b81ea1..9a4f2f7b3b 100644
--- a/libs/canvas/canvas/types.h
+++ b/libs/canvas/canvas/types.h
@@ -28,6 +28,8 @@
#include <cairomm/refptr.h>
+#include "gtkmm2ext/colors.h"
+
#include "canvas/visibility.h"
namespace Cairo {
@@ -39,7 +41,6 @@ namespace ArdourCanvas
typedef double Coord;
typedef double Distance;
-typedef uint32_t Color;
extern LIBCANVAS_API Coord const COORD_MAX;
diff --git a/libs/canvas/canvas/utils.h b/libs/canvas/canvas/utils.h
index 42551a6c9a..8137b2abf7 100644
--- a/libs/canvas/canvas/utils.h
+++ b/libs/canvas/canvas/utils.h
@@ -27,12 +27,6 @@
namespace ArdourCanvas {
- extern LIBCANVAS_API void set_source_rgba (Cairo::RefPtr<Cairo::Context>, Color);
- extern LIBCANVAS_API void set_source_rgb_a (Cairo::RefPtr<Cairo::Context>, Color, float alpha); //override the color's alpha
-
- extern LIBCANVAS_API void set_source_rgba (cairo_t*, Color);
- extern LIBCANVAS_API void set_source_rgb_a (cairo_t*, Color, float alpha); //override the color's alpha
-
Distance LIBCANVAS_API distance_to_segment_squared (Duple const & p, Duple const & p1, Duple const & p2, double& t, Duple& at);
}
diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h
index de6b38d13e..1767262151 100644
--- a/libs/canvas/canvas/wave_view.h
+++ b/libs/canvas/canvas/wave_view.h
@@ -100,8 +100,8 @@ public:
*/
void set_start_shift (double pixels);
- void set_fill_color (Color);
- void set_outline_color (Color);
+ void set_fill_color (Gtkmm2ext::Color);
+ void set_outline_color (Gtkmm2ext::Color);
void region_resized ();
void gain_changed ();
@@ -109,8 +109,8 @@ public:
void set_show_zero_line (bool);
bool show_zero_line () const;
- void set_zero_color (Color);
- void set_clip_color (Color);
+ void set_zero_color (Gtkmm2ext::Color);
+ void set_clip_color (Gtkmm2ext::Color);
void set_logscaled (bool);
void set_gradient_depth (double);
diff --git a/libs/canvas/canvas/wave_view_private.h b/libs/canvas/canvas/wave_view_private.h
index dca09c90b5..d870300998 100644
--- a/libs/canvas/canvas/wave_view_private.h
+++ b/libs/canvas/canvas/wave_view_private.h
@@ -48,10 +48,10 @@ public: // member variables
double samples_per_pixel;
double amplitude;
double amplitude_above_axis;
- Color fill_color;
- Color outline_color;
- Color zero_color;
- Color clip_color;
+ Gtkmm2ext::Color fill_color;
+ Gtkmm2ext::Color outline_color;
+ Gtkmm2ext::Color zero_color;
+ Gtkmm2ext::Color clip_color;
bool show_zero;
bool logscaled;
WaveView::Shape shape;
diff --git a/libs/canvas/canvas/xfade_curve.h b/libs/canvas/canvas/xfade_curve.h
index b6e871936b..50ce96e769 100644
--- a/libs/canvas/canvas/xfade_curve.h
+++ b/libs/canvas/canvas/xfade_curve.h
@@ -48,13 +48,13 @@ public:
void set_points_per_segment (uint32_t n);
void set_inout (Points const & in, Points const & out);
- void set_outline_color (Color c) {
+ void set_outline_color (Gtkmm2ext::Color c) {
begin_visual_change ();
_outline_color = c;
end_visual_change ();
};
- void set_fill_color (Color c) {
+ void set_fill_color (Gtkmm2ext::Color c) {
begin_visual_change ();
_fill_color = c;
end_visual_change ();
@@ -76,9 +76,9 @@ private:
CanvasCurve _in;
CanvasCurve _out;
- XFadePosition _xfadeposition;
- Color _outline_color;
- Color _fill_color;
+ XFadePosition _xfadeposition;
+ Gtkmm2ext::Color _outline_color;
+ Gtkmm2ext::Color _fill_color;
bool show_background_fade;
diff --git a/libs/canvas/fill.cc b/libs/canvas/fill.cc
index 42fe155684..9fe1d5b4e7 100644
--- a/libs/canvas/fill.cc
+++ b/libs/canvas/fill.cc
@@ -27,8 +27,6 @@
#include "canvas/fill.h"
#include "canvas/item.h"
#include "canvas/types.h"
-#include "canvas/utils.h"
-#include "canvas/colors.h"
using namespace std;
using namespace ArdourCanvas;
@@ -42,14 +40,14 @@ Fill::Fill (Item& self)
}
void
-Fill::set_fill_color (Color color)
+Fill::set_fill_color (Gtkmm2ext::Color color)
{
if (_fill_color != color) {
_self.begin_visual_change ();
_fill_color = color;
double r, g, b, a;
- color_to_rgba (color, r, g, b, a);
+ Gtkmm2ext::color_to_rgba (color, r, g, b, a);
if (a == 0.0) {
_transparent = true;
} else {
@@ -76,7 +74,7 @@ Fill::setup_fill_context (Cairo::RefPtr<Cairo::Context> context) const
if (_pattern) {
context->set_source (_pattern);
} else {
- set_source_rgba (context, _fill_color);
+ Gtkmm2ext::set_source_rgba (context, _fill_color);
}
}
@@ -93,7 +91,7 @@ Fill::setup_gradient_context (Cairo::RefPtr<Cairo::Context> context, Rect const
for (StopList::const_iterator s = _stops.begin(); s != _stops.end(); ++s) {
double r, g, b, a;
- color_to_rgba (s->second, r, g, b, a);
+ Gtkmm2ext::color_to_rgba (s->second, r, g, b, a);
_gradient->add_color_stop_rgba (s->first, r, g, b, a);
}
diff --git a/libs/canvas/flag.cc b/libs/canvas/flag.cc
index b00426ff92..25f1893366 100644
--- a/libs/canvas/flag.cc
+++ b/libs/canvas/flag.cc
@@ -25,7 +25,7 @@
using namespace std;
using namespace ArdourCanvas;
-Flag::Flag (Canvas* canvas, Distance height, Color outline_color, Color fill_color, Duple position, bool invert)
+Flag::Flag (Canvas* canvas, Distance height, Gtkmm2ext::Color outline_color, Gtkmm2ext::Color fill_color, Duple position, bool invert)
: Container (canvas)
, _outline_color (outline_color)
, _fill_color (fill_color)
@@ -34,7 +34,7 @@ Flag::Flag (Canvas* canvas, Distance height, Color outline_color, Color fill_col
setup (height, position);
}
-Flag::Flag (Item* parent, Distance height, Color outline_color, Color fill_color, Duple position, bool invert)
+Flag::Flag (Item* parent, Distance height, Gtkmm2ext::Color outline_color, Gtkmm2ext::Color fill_color, Duple position, bool invert)
: Container (parent)
, _outline_color (outline_color)
, _fill_color (fill_color)
diff --git a/libs/canvas/line_set.cc b/libs/canvas/line_set.cc
index 0c225789ab..d58cb900b6 100644
--- a/libs/canvas/line_set.cc
+++ b/libs/canvas/line_set.cc
@@ -18,7 +18,6 @@
*/
#include "canvas/line_set.h"
-#include "canvas/utils.h"
using namespace std;
using namespace ArdourCanvas;
@@ -108,7 +107,7 @@ LineSet::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
Rect intersection (isect);
- set_source_rgba (context, i->color);
+ Gtkmm2ext::set_source_rgba (context, i->color);
context->set_line_width (i->width);
/* Not 100% sure that the computation of the invariant
@@ -131,7 +130,7 @@ LineSet::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
}
void
-LineSet::add (Coord y, Distance width, Color color)
+LineSet::add (Coord y, Distance width, Gtkmm2ext::Color color)
{
begin_change ();
diff --git a/libs/canvas/meter.cc b/libs/canvas/meter.cc
index 833ab8c404..b539a1b4ae 100644
--- a/libs/canvas/meter.cc
+++ b/libs/canvas/meter.cc
@@ -31,9 +31,8 @@
#include <gtkmm2ext/rgb_macros.h>
#include "canvas/canvas.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/meter.h"
-#include "canvas/utils.h"
using namespace Glib;
using namespace std;
diff --git a/libs/canvas/outline.cc b/libs/canvas/outline.cc
index 9416859e59..4f26de693b 100644
--- a/libs/canvas/outline.cc
+++ b/libs/canvas/outline.cc
@@ -26,7 +26,6 @@
#include "canvas/item.h"
#include "canvas/outline.h"
-#include "canvas/utils.h"
#include "canvas/debug.h"
using namespace ArdourCanvas;
@@ -40,7 +39,7 @@ Outline::Outline (Item& self)
}
void
-Outline::set_outline_color (Color color)
+Outline::set_outline_color (Gtkmm2ext::Color color)
{
if (color != _outline_color) {
_self.begin_visual_change ();
@@ -74,7 +73,7 @@ Outline::set_outline (bool outline)
void
Outline::setup_outline_context (Cairo::RefPtr<Cairo::Context> context) const
{
- set_source_rgba (context, _outline_color);
+ Gtkmm2ext::set_source_rgba (context, _outline_color);
context->set_line_width (_outline_width);
}
diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc
index 1ef783479b..488d5bf1fe 100644
--- a/libs/canvas/rectangle.cc
+++ b/libs/canvas/rectangle.cc
@@ -25,7 +25,6 @@
#include "canvas/canvas.h"
#include "canvas/rectangle.h"
#include "canvas/debug.h"
-#include "canvas/utils.h"
using namespace std;
using namespace ArdourCanvas;
diff --git a/libs/canvas/ruler.cc b/libs/canvas/ruler.cc
index 9c1f78253f..9949836fa1 100644
--- a/libs/canvas/ruler.cc
+++ b/libs/canvas/ruler.cc
@@ -25,7 +25,6 @@
#include "canvas/ruler.h"
#include "canvas/types.h"
#include "canvas/debug.h"
-#include "canvas/utils.h"
#include "canvas/canvas.h"
using namespace std;
@@ -199,12 +198,12 @@ Ruler::render (Rect const & area, Cairo::RefPtr<Cairo::Context> cr) const
cr->set_line_width (1.0);
- set_source_rgba (cr, _divider_color_top);
+ Gtkmm2ext::set_source_rgba (cr, _divider_color_top);
cr->move_to (self.x0, self.y0 + _divide_height-1.0+0.5);
cr->line_to (self.x1, self.y0 + _divide_height-1.0+0.5);
cr->stroke ();
- set_source_rgba (cr, _divider_color_bottom);
+ Gtkmm2ext::set_source_rgba (cr, _divider_color_bottom);
cr->move_to (self.x0, self.y0 + _divide_height+0.5);
cr->line_to (self.x1, self.y0 + _divide_height+0.5);
cr->stroke ();
@@ -222,7 +221,7 @@ Ruler::set_divide_height (double h)
}
void
-Ruler::set_divide_colors (Color t, Color b)
+Ruler::set_divide_colors (Gtkmm2ext::Color t, Gtkmm2ext::Color b)
{
_divider_color_bottom = b;
_divider_color_top = t;
diff --git a/libs/canvas/stateful_image.cc b/libs/canvas/stateful_image.cc
index 3242ab7b80..897500d5fd 100644
--- a/libs/canvas/stateful_image.cc
+++ b/libs/canvas/stateful_image.cc
@@ -9,7 +9,6 @@
#include "pbd/xml++.h"
#include "canvas/stateful_image.h"
-#include "canvas/utils.h"
#include "pbd/i18n.h"
@@ -68,7 +67,7 @@ StatefulImage::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context)
}
// layout->set_alignment (_alignment);
- set_source_rgba (context, _text_color);
+ Gtkmm2ext::set_source_rgba (context, _text_color);
context->move_to (_text_x, _text_y);
layout->show_in_cairo_context (context);
}
diff --git a/libs/canvas/text.cc b/libs/canvas/text.cc
index f17df46615..19c4b417f9 100644
--- a/libs/canvas/text.cc
+++ b/libs/canvas/text.cc
@@ -27,8 +27,7 @@
#include "canvas/text.h"
#include "canvas/canvas.h"
-#include "canvas/utils.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
using namespace std;
using namespace ArdourCanvas;
@@ -169,14 +168,14 @@ Text::_redraw () const
/* and draw, in the appropriate color of course */
if (_outline) {
- set_source_rgba (img_context, _outline_color);
+ Gtkmm2ext::set_source_rgba (img_context, _outline_color);
layout->update_from_cairo_context (img_context);
pango_cairo_layout_path (img_context->cobj(), layout->gobj());
img_context->stroke_preserve ();
- set_source_rgba (img_context, _color);
+ Gtkmm2ext::set_source_rgba (img_context, _color);
img_context->fill ();
} else {
- set_source_rgba (img_context, _color);
+ Gtkmm2ext::set_source_rgba (img_context, _color);
layout->show_in_cairo_context (img_context);
}
@@ -286,7 +285,7 @@ Text::set_font_description (Pango::FontDescription font_description)
}
void
-Text::set_color (Color color)
+Text::set_color (Gtkmm2ext::Color color)
{
if (color == _color) {
return;
@@ -296,7 +295,7 @@ Text::set_color (Color color)
_color = color;
if (_outline) {
- set_outline_color (contrasting_text_color (_color));
+ set_outline_color (Gtkmm2ext::contrasting_text_color (_color));
}
_need_redraw = true;
diff --git a/libs/canvas/utils.cc b/libs/canvas/utils.cc
index 2c8905b331..46afda045a 100644
--- a/libs/canvas/utils.cc
+++ b/libs/canvas/utils.cc
@@ -27,50 +27,6 @@
using namespace std;
using namespace ArdourCanvas;
-void
-ArdourCanvas::set_source_rgba (Cairo::RefPtr<Cairo::Context> context, Color color)
-{
- context->set_source_rgba (
- ((color >> 24) & 0xff) / 255.0,
- ((color >> 16) & 0xff) / 255.0,
- ((color >> 8) & 0xff) / 255.0,
- ((color >> 0) & 0xff) / 255.0
- );
-}
-
-void
-ArdourCanvas::set_source_rgb_a (Cairo::RefPtr<Cairo::Context> context, Color color, float alpha)
-{
- context->set_source_rgba (
- ((color >> 24) & 0xff) / 255.0,
- ((color >> 16) & 0xff) / 255.0,
- ((color >> 8) & 0xff) / 255.0,
- alpha
- );
-}
-
-void
-ArdourCanvas::set_source_rgba (cairo_t *cr, Color color)
-{
- cairo_set_source_rgba ( cr,
- ((color >> 24) & 0xff) / 255.0,
- ((color >> 16) & 0xff) / 255.0,
- ((color >> 8) & 0xff) / 255.0,
- ((color >> 0) & 0xff) / 255.0
- );
-}
-
-void
-ArdourCanvas::set_source_rgb_a (cairo_t *cr, Color color, float alpha)
-{
- cairo_set_source_rgba ( cr,
- ((color >> 24) & 0xff) / 255.0,
- ((color >> 16) & 0xff) / 255.0,
- ((color >> 8) & 0xff) / 255.0,
- alpha
- );
-}
-
ArdourCanvas::Distance
ArdourCanvas::distance_to_segment_squared (Duple const & p, Duple const & p1, Duple const & p2, double& t, Duple& at)
{
@@ -136,4 +92,3 @@ ArdourCanvas::distance_to_segment_squared (Duple const & p, Duple const & p1, Du
return ((dpqx * dpqx) + (dpqy * dpqy));
}
-
diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc
index 861386a3a4..8024b2655d 100644
--- a/libs/canvas/wave_view.cc
+++ b/libs/canvas/wave_view.cc
@@ -44,14 +44,11 @@
#include "ardour/session.h"
#include "canvas/canvas.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/debug.h"
-#include "canvas/utils.h"
#include "canvas/wave_view.h"
#include "canvas/wave_view_private.h"
-#include "evoral/Range.hpp"
-
#include <gdkmm/general.h>
#include "gtkmm2ext/gui_thread.h"
@@ -60,6 +57,7 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
using namespace ArdourCanvas;
+using namespace Gtkmm2ext;
double WaveView::_global_gradient_depth = 0.6;
bool WaveView::_global_logscaled = false;
diff --git a/libs/canvas/widget.cc b/libs/canvas/widget.cc
index 5968de5fbb..0f49554a42 100644
--- a/libs/canvas/widget.cc
+++ b/libs/canvas/widget.cc
@@ -24,7 +24,6 @@
#include "canvas/canvas.h"
#include "canvas/widget.h"
#include "canvas/debug.h"
-#include "canvas/utils.h"
using namespace std;
using namespace ArdourCanvas;
diff --git a/libs/canvas/wscript b/libs/canvas/wscript
index 89d9f8e30b..0d99e6856d 100644
--- a/libs/canvas/wscript
+++ b/libs/canvas/wscript
@@ -33,8 +33,6 @@ canvas_sources = [
'box.cc',
'canvas.cc',
'circle.cc',
- 'colors.cc',
- 'colorspace.cc',
'container.cc',
'curve.cc',
'debug.cc',
diff --git a/libs/canvas/xfade_curve.cc b/libs/canvas/xfade_curve.cc
index 01a15408ad..9f3c158dcd 100644
--- a/libs/canvas/xfade_curve.cc
+++ b/libs/canvas/xfade_curve.cc
@@ -24,7 +24,6 @@
#include "canvas/xfade_curve.h"
#include "canvas/interpolated_curve.h"
-#include "canvas/utils.h"
using namespace ArdourCanvas;
using std::min;
@@ -250,10 +249,10 @@ XFadeCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) co
Cairo::Path *path_in = get_path(draw, context, _in);
Cairo::Path *path_out = get_path(draw, context, _out);
- Color outline_shaded = _outline_color;
+ Gtkmm2ext::Color outline_shaded = _outline_color;
outline_shaded = 0.5 * (outline_shaded & 0xff) + (outline_shaded & ~0xff);
- Color fill_shaded = _fill_color;
+ Gtkmm2ext::Color fill_shaded = _fill_color;
fill_shaded = 0.5 * (fill_shaded & 0xff) + (fill_shaded & ~0xff);
#define IS_START (_xfadeposition == Start)
@@ -262,7 +261,7 @@ XFadeCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) co
context->begin_new_path ();
context->append_path (IS_START ? *path_in : *path_out);
close_path(draw, context, IS_START ?_in : _out, false);
- set_source_rgba (context, _fill_color);
+ Gtkmm2ext::set_source_rgba (context, _fill_color);
context->fill ();
if (show_background_fade) {
@@ -276,7 +275,7 @@ XFadeCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) co
context->begin_new_path ();
context->append_path (IS_START ? *path_out: *path_in);
close_path(draw, context, IS_START ? _out : _in, true);
- set_source_rgba (context, fill_shaded);
+ Gtkmm2ext::set_source_rgba (context, fill_shaded);
context->set_fill_rule (Cairo::FILL_RULE_WINDING);
context->fill ();
context->restore ();
@@ -285,7 +284,7 @@ XFadeCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) co
/* draw lines over fills */
/* fade in line */
if (IS_START || show_background_fade) {
- set_source_rgba (context, IS_START ? _outline_color : outline_shaded);
+ Gtkmm2ext::set_source_rgba (context, IS_START ? _outline_color : outline_shaded);
context->set_line_width (IS_START ? 1.0 : .5);
context->begin_new_path ();
@@ -295,7 +294,7 @@ XFadeCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) co
/* fade out line */
if (!IS_START || show_background_fade) {
- set_source_rgba (context, IS_START ? outline_shaded :_outline_color);
+ Gtkmm2ext::set_source_rgba (context, IS_START ? outline_shaded :_outline_color);
context->set_line_width (IS_START ? .5 : 1.0);
context->begin_new_path ();
diff --git a/libs/canvas/colors.cc b/libs/gtkmm2ext/colors.cc
index c288d4e383..73cf061899 100644
--- a/libs/canvas/colors.cc
+++ b/libs/gtkmm2ext/colors.cc
@@ -25,30 +25,30 @@
#include "pbd/failed_constructor.h"
#include "pbd/string_convert.h"
-#include "canvas/colors.h"
-#include "canvas/colorspace.h"
+#include "gtkmm2ext/colors.h"
+#include "gtkmm2ext/colorspace.h"
using namespace std;
-using namespace ArdourCanvas;
+using namespace Gtkmm2ext;
using std::max;
using std::min;
-ArdourCanvas::Color
-ArdourCanvas::change_alpha (Color c, double a)
+Gtkmm2ext::Color
+Gtkmm2ext::change_alpha (Color c, double a)
{
return ((c & ~0xff) | (lrintf (a*255.0) & 0xff));
}
void
-ArdourCanvas::color_to_hsv (Color color, double& h, double& s, double& v)
+Gtkmm2ext::color_to_hsv (Color color, double& h, double& s, double& v)
{
double a;
color_to_hsva (color, h, s, v, a);
}
void
-ArdourCanvas::color_to_hsva (Color color, double& h, double& s, double& v, double& a)
+Gtkmm2ext::color_to_hsva (Color color, double& h, double& s, double& v, double& a)
{
double r, g, b;
double cmax;
@@ -106,8 +106,8 @@ ArdourCanvas::color_to_hsva (Color color, double& h, double& s, double& v, doubl
}
}
-ArdourCanvas::Color
-ArdourCanvas::hsva_to_color (double h, double s, double v, double a)
+Gtkmm2ext::Color
+Gtkmm2ext::hsva_to_color (double h, double s, double v, double a)
{
s = min (1.0, max (0.0, s));
v = min (1.0, max (0.0, v));
@@ -139,7 +139,7 @@ ArdourCanvas::hsva_to_color (double h, double s, double v, double a)
}
void
-ArdourCanvas::color_to_rgba (Color color, double& r, double& g, double& b, double& a)
+Gtkmm2ext::color_to_rgba (Color color, double& r, double& g, double& b, double& a)
{
r = ((color >> 24) & 0xff) / 255.0;
g = ((color >> 16) & 0xff) / 255.0;
@@ -147,8 +147,8 @@ ArdourCanvas::color_to_rgba (Color color, double& r, double& g, double& b, doubl
a = ((color >> 0) & 0xff) / 255.0;
}
-ArdourCanvas::Color
-ArdourCanvas::rgba_to_color (double r, double g, double b, double a)
+Gtkmm2ext::Color
+Gtkmm2ext::rgba_to_color (double r, double g, double b, double a)
{
/* clamp to [0 .. 1] range */
@@ -203,18 +203,18 @@ luminance (uint32_t c)
double r, g, b, a;
- ArdourCanvas::color_to_rgba (c, r, g, b, a);
+ Gtkmm2ext::color_to_rgba (c, r, g, b, a);
return (gam_sRGB (rY*inv_gam_sRGB(r) + gY*inv_gam_sRGB(g) + bY*inv_gam_sRGB(b))) / 255.0;
}
uint32_t
-ArdourCanvas::contrasting_text_color (uint32_t c)
+Gtkmm2ext::contrasting_text_color (uint32_t c)
{
/* use a slightly off-white... XXX should really look this up */
- static const uint32_t white = ArdourCanvas::rgba_to_color (0.98, 0.98, 0.98, 1.0);
- static const uint32_t black = ArdourCanvas::rgba_to_color (0.0, 0.0, 0.0, 1.0);
+ static const uint32_t white = Gtkmm2ext::rgba_to_color (0.98, 0.98, 0.98, 1.0);
+ static const uint32_t black = Gtkmm2ext::rgba_to_color (0.0, 0.0, 0.0, 1.0);
return (luminance (c) < 0.50) ? white : black;
}
@@ -515,7 +515,7 @@ HSV::print (std::ostream& o) const
}
-std::ostream& operator<<(std::ostream& o, const ArdourCanvas::HSV& hsv) { hsv.print (o); return o; }
+std::ostream& operator<<(std::ostream& o, const Gtkmm2ext::HSV& hsv) { hsv.print (o); return o; }
HSV
HSV::mod (SVAModifier const & svam)
@@ -647,10 +647,54 @@ SVAModifier::operator () (HSV& hsv) const
return r;
}
-ArdourCanvas::Color
-ArdourCanvas::color_at_alpha (ArdourCanvas::Color c, double a)
+Color
+Gtkmm2ext::color_at_alpha (Gtkmm2ext::Color c, double a)
{
double r, g, b, unused;
color_to_rgba (c, r, g, b, unused);
return rgba_to_color( r,g,b, a );
}
+
+void
+Gtkmm2ext::set_source_rgba (Cairo::RefPtr<Cairo::Context> context, Color color)
+{
+ context->set_source_rgba (
+ ((color >> 24) & 0xff) / 255.0,
+ ((color >> 16) & 0xff) / 255.0,
+ ((color >> 8) & 0xff) / 255.0,
+ ((color >> 0) & 0xff) / 255.0
+ );
+}
+
+void
+Gtkmm2ext::set_source_rgb_a (Cairo::RefPtr<Cairo::Context> context, Color color, float alpha)
+{
+ context->set_source_rgba (
+ ((color >> 24) & 0xff) / 255.0,
+ ((color >> 16) & 0xff) / 255.0,
+ ((color >> 8) & 0xff) / 255.0,
+ alpha
+ );
+}
+
+void
+Gtkmm2ext::set_source_rgba (cairo_t *cr, Color color)
+{
+ cairo_set_source_rgba ( cr,
+ ((color >> 24) & 0xff) / 255.0,
+ ((color >> 16) & 0xff) / 255.0,
+ ((color >> 8) & 0xff) / 255.0,
+ ((color >> 0) & 0xff) / 255.0
+ );
+}
+
+void
+Gtkmm2ext::set_source_rgb_a (cairo_t *cr, Color color, float alpha)
+{
+ cairo_set_source_rgba ( cr,
+ ((color >> 24) & 0xff) / 255.0,
+ ((color >> 16) & 0xff) / 255.0,
+ ((color >> 8) & 0xff) / 255.0,
+ alpha
+ );
+}
diff --git a/libs/canvas/colorspace.cc b/libs/gtkmm2ext/colorspace.cc
index 50cbac8fb1..b614616800 100644
--- a/libs/canvas/colorspace.cc
+++ b/libs/gtkmm2ext/colorspace.cc
@@ -135,7 +135,9 @@
#include <string.h>
#include <ctype.h>
-#include "canvas/colorspace.h"
+#include "gtkmm2ext/colorspace.h"
+
+namespace Gtkmm2ext {
/** @brief Min of A and B */
#define MIN(A,B) (((A) <= (B)) ? (A) : (B))
@@ -938,3 +940,5 @@ void Cat02lms2Rgb(double *R, double *G, double *B, double L, double M, double S)
Cat02lms2Xyz(&X, &Y, &Z, L, M, S);
Xyz2Rgb(R, G, B, X, Y, Z);
}
+
+} /* namespace */
diff --git a/libs/canvas/canvas/colors.h b/libs/gtkmm2ext/gtkmm2ext/colors.h
index f48e2347a3..3ec6ae3a81 100644
--- a/libs/canvas/canvas/colors.h
+++ b/libs/gtkmm2ext/gtkmm2ext/colors.h
@@ -17,36 +17,45 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef __ardour_canvas_colors_h__
-#define __ardour_canvas_colors_h__
+#ifndef _GTKMM2EXT_COLORS_H_
+#define _GTKMM2EXT_COLORS_H_
#include <cairomm/context.h>
-#include "canvas/visibility.h"
-#include "canvas/types.h"
+#include "gtkmm2ext/visibility.h"
-namespace ArdourCanvas
+namespace Gtkmm2ext
{
-struct LIBCANVAS_API HSV;
-struct LIBCANVAS_API HSVA;
+typedef uint32_t Color;
-extern LIBCANVAS_API Color change_alpha (Color, double alpha);
+/* conventient way to use Gtkmm2ext::Color with libcairo */
+extern LIBGTKMM2EXT_API void set_source_rgba (Cairo::RefPtr<Cairo::Context>, Gtkmm2ext::Color);
+extern LIBGTKMM2EXT_API void set_source_rgb_a (Cairo::RefPtr<Cairo::Context>, Gtkmm2ext::Color, float alpha); //override the color's alpha
-extern LIBCANVAS_API Color hsva_to_color (double h, double s, double v, double a = 1.0);
-extern LIBCANVAS_API void color_to_hsva (Color color, double& h, double& s, double& v, double& a);
-extern LIBCANVAS_API Color color_at_alpha (Color, double a);
-extern LIBCANVAS_API void color_to_hsv (Color color, double& h, double& s, double& v);
-extern LIBCANVAS_API void color_to_rgba (Color, double& r, double& g, double& b, double& a);
-extern LIBCANVAS_API Color rgba_to_color (double r, double g, double b, double a);
+extern LIBGTKMM2EXT_API void set_source_rgba (cairo_t*, Gtkmm2ext::Color);
+extern LIBGTKMM2EXT_API void set_source_rgb_a (cairo_t*, Gtkmm2ext::Color, float alpha); //override the color's alpha
-uint32_t LIBCANVAS_API contrasting_text_color (uint32_t c);
-struct LIBCANVAS_API HSV;
+struct LIBGTKMM2EXT_API HSV;
+struct LIBGTKMM2EXT_API HSVA;
-class LIBCANVAS_API SVAModifier
+extern LIBGTKMM2EXT_API Color change_alpha (Color, double alpha);
+
+extern LIBGTKMM2EXT_API Color hsva_to_color (double h, double s, double v, double a = 1.0);
+extern LIBGTKMM2EXT_API void color_to_hsva (Color color, double& h, double& s, double& v, double& a);
+extern LIBGTKMM2EXT_API Color color_at_alpha (Color, double a);
+extern LIBGTKMM2EXT_API void color_to_hsv (Color color, double& h, double& s, double& v);
+extern LIBGTKMM2EXT_API void color_to_rgba (Color, double& r, double& g, double& b, double& a);
+extern LIBGTKMM2EXT_API Color rgba_to_color (double r, double g, double b, double a);
+
+uint32_t LIBGTKMM2EXT_API contrasting_text_color (uint32_t c);
+
+struct LIBGTKMM2EXT_API HSV;
+
+class LIBGTKMM2EXT_API SVAModifier
{
- public:
+public:
enum Type {
Add,
Multiply,
@@ -65,14 +74,14 @@ class LIBCANVAS_API SVAModifier
std::string to_string () const;
void from_string (std::string const &);
- private:
+private:
Type type;
double _s;
double _v;
double _a;
};
-struct LIBCANVAS_API HSV
+struct LIBGTKMM2EXT_API HSV
{
HSV ();
HSV (double h, double s, double v, double a = 1.0);
@@ -118,13 +127,12 @@ struct LIBCANVAS_API HSV
void print (std::ostream&) const;
- protected:
+protected:
void clamp ();
};
+} /* namespace */
-}
-
-std::ostream& operator<<(std::ostream& o, const ArdourCanvas::HSV& hsv);
+std::ostream& operator<<(std::ostream& o, const Gtkmm2ext::HSV& hsv);
-#endif /* __ardour_canvas_colors_h__ */
+#endif
diff --git a/libs/canvas/canvas/colorspace.h b/libs/gtkmm2ext/gtkmm2ext/colorspace.h
index 77d0961934..ed350133e8 100644
--- a/libs/canvas/canvas/colorspace.h
+++ b/libs/gtkmm2ext/gtkmm2ext/colorspace.h
@@ -3,14 +3,17 @@
* @author Pascal Getreuer 2005-2010 <getreuer@gmail.com>
*/
-#ifndef _ARDOURCANVAS_COLORSPACE_H_
-#define _ARDOURCANVAS_COLORSPACE_H_
+#ifndef _GTKMM2EXT_COLORSPACE_H_
+#define _GTKMM2EXT_COLORSPACE_H_
/** @brief XYZ color of the D65 white point */
#define WHITEPOINT_X 0.950456
#define WHITEPOINT_Y 1.0
#define WHITEPOINT_Z 1.088754
+namespace Gtkmm2ext
+{
+
void Rgb2Yuv(double *Y, double *U, double *V, double R, double G, double B);
void Yuv2Rgb(double *R, double *G, double *B, double Y, double U, double V);
void Rgb2Ycbcr(double *Y, double *Cb, double *Cr, double R, double G, double B);
@@ -51,4 +54,6 @@ void Lch2Rgb(double *R, double *G, double *B, double L, double C, double H);
void Rgb2Cat02lms(double *L, double *M, double *S, double R, double G, double B);
void Cat02lms2Rgb(double *R, double *G, double *B, double L, double M, double S);
-#endif /* _ARDOURCANVAS_COLORSPACE_H_ */
+} /* namespace */
+
+#endif
diff --git a/libs/gtkmm2ext/wscript b/libs/gtkmm2ext/wscript
index 700d1dee14..8da17f58b0 100644
--- a/libs/gtkmm2ext/wscript
+++ b/libs/gtkmm2ext/wscript
@@ -31,6 +31,8 @@ gtkmm2ext_sources = [
'cell_renderer_color_selector.cc',
'cell_renderer_pixbuf_multi.cc',
'cell_renderer_pixbuf_toggle.cc',
+ 'colors.cc',
+ 'colorspace.cc',
'cursors.cc',
'debug.cc',
'dndtreeview.cc',
diff --git a/libs/surfaces/push2/knob.cc b/libs/surfaces/push2/knob.cc
index fe745405b5..8bd5005c10 100644
--- a/libs/surfaces/push2/knob.cc
+++ b/libs/surfaces/push2/knob.cc
@@ -28,7 +28,7 @@
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/rgb_macros.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/text.h"
#include "knob.h"
@@ -75,7 +75,7 @@ Push2Knob::~Push2Knob ()
}
void
-Push2Knob::set_text_color (Color c)
+Push2Knob::set_text_color (Gtkmm2ext::Color c)
{
text->set_color (c);
}
@@ -145,8 +145,8 @@ Push2Knob::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) con
double red_start, green_start, blue_start, astart;
double red_end, green_end, blue_end, aend;
- ArdourCanvas::color_to_rgba (arc_start_color, red_start, green_start, blue_start, astart);
- ArdourCanvas::color_to_rgba (arc_end_color, red_end, green_end, blue_end, aend);
+ Gtkmm2ext::color_to_rgba (arc_start_color, red_start, green_start, blue_start, astart);
+ Gtkmm2ext::color_to_rgba (arc_end_color, red_end, green_end, blue_end, aend);
//vary the arc color over the travel of the knob
float intensity = fabsf (_val - zero) / std::max(zero, (1.f - zero));
diff --git a/libs/surfaces/push2/knob.h b/libs/surfaces/push2/knob.h
index 71cdf8db32..150d18f538 100644
--- a/libs/surfaces/push2/knob.h
+++ b/libs/surfaces/push2/knob.h
@@ -56,9 +56,9 @@ public:
void set_controllable (boost::shared_ptr<ARDOUR::AutomationControl> c);
boost::shared_ptr<ARDOUR::AutomationControl> controllable() const { return _controllable; }
- void set_text_color (ArdourCanvas::Color);
- void set_arc_start_color (ArdourCanvas::Color);
- void set_arc_end_color (ArdourCanvas::Color);
+ void set_text_color (Gtkmm2ext::Color);
+ void set_arc_start_color (Gtkmm2ext::Color);
+ void set_arc_end_color (Gtkmm2ext::Color);
void set_radius (double r);
void render (ArdourCanvas::Rect const &, Cairo::RefPtr<Cairo::Context>) const;
@@ -77,9 +77,9 @@ public:
float _val; // current value [0..1]
float _normal; // default value, arc
- ArdourCanvas::Color text_color;
- ArdourCanvas::Color arc_start_color;
- ArdourCanvas::Color arc_end_color;
+ Gtkmm2ext::Color text_color;
+ Gtkmm2ext::Color arc_start_color;
+ Gtkmm2ext::Color arc_end_color;
ArdourCanvas::Text* text;
void set_pan_azimuth_text (double);
diff --git a/libs/surfaces/push2/menu.cc b/libs/surfaces/push2/menu.cc
index b6558ac0ff..5a70a0ebd0 100644
--- a/libs/surfaces/push2/menu.cc
+++ b/libs/surfaces/push2/menu.cc
@@ -26,7 +26,7 @@
#include "canvas/text.h"
#include "canvas/types.h"
#include "canvas/rectangle.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas.h"
#include "gui.h"
@@ -262,7 +262,7 @@ Push2Menu::set_active (uint32_t index)
}
void
-Push2Menu::set_text_color (Color c)
+Push2Menu::set_text_color (Gtkmm2ext::Color c)
{
text_color = c;
@@ -273,10 +273,10 @@ Push2Menu::set_text_color (Color c)
}
void
-Push2Menu::set_active_color (Color c)
+Push2Menu::set_active_color (Gtkmm2ext::Color c)
{
active_color = c;
- contrast_color = contrasting_text_color (active_color);
+ contrast_color = Gtkmm2ext::contrasting_text_color (active_color);
if (active_bg) {
active_bg->set_fill_color (c);
}
diff --git a/libs/surfaces/push2/menu.h b/libs/surfaces/push2/menu.h
index ef4b9e2311..41f46c8fc4 100644
--- a/libs/surfaces/push2/menu.h
+++ b/libs/surfaces/push2/menu.h
@@ -58,8 +58,8 @@ class Push2Menu : public ArdourCanvas::Container
void set_layout (int cols, int rows);
void set_font_description (Pango::FontDescription);
- void set_text_color (ArdourCanvas::Color);
- void set_active_color (ArdourCanvas::Color);
+ void set_text_color (Gtkmm2ext::Color);
+ void set_active_color (Gtkmm2ext::Color);
bool can_scroll_left() const { return first >= nrows; }
bool can_scroll_right() const { return last < displays.size() - 1; }
@@ -86,9 +86,9 @@ class Push2Menu : public ArdourCanvas::Container
uint32_t last;
uint32_t _active;
- ArdourCanvas::Color text_color;
- ArdourCanvas::Color active_color;
- ArdourCanvas::Color contrast_color;
+ Gtkmm2ext::Color text_color;
+ Gtkmm2ext::Color active_color;
+ Gtkmm2ext::Color contrast_color;
Pango::FontDescription font_description;
inline int active_row () const { return _active % nrows; }
diff --git a/libs/surfaces/push2/mix.cc b/libs/surfaces/push2/mix.cc
index 4582cd0d30..fb2bfd222f 100644
--- a/libs/surfaces/push2/mix.cc
+++ b/libs/surfaces/push2/mix.cc
@@ -43,7 +43,7 @@
#include "ardour/utils.h"
#include "ardour/vca_manager.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/line.h"
#include "canvas/rectangle.h"
#include "canvas/text.h"
@@ -68,6 +68,7 @@ using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;
+using namespace Gtkmm2ext;
using namespace ArdourCanvas;
MixLayout::MixLayout (Push2& p, Session & s, std::string const & name)
@@ -481,7 +482,7 @@ MixLayout::show_selection (uint32_t n)
{
lower_backgrounds[n]->show ();
lower_backgrounds[n]->set_fill_color (stripable[n]->presentation_info().color());
- lower_text[n]->set_color (ArdourCanvas::contrasting_text_color (lower_backgrounds[n]->fill_color()));
+ lower_text[n]->set_color (contrasting_text_color (lower_backgrounds[n]->fill_color()));
}
void
diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc
index 00c7ef43d2..7b9a348841 100644
--- a/libs/surfaces/push2/push2.cc
+++ b/libs/surfaces/push2/push2.cc
@@ -45,7 +45,7 @@
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/rgb_macros.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas.h"
#include "gui.h"
@@ -68,6 +68,7 @@ using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;
+using namespace Gtkmm2ext;
#include "pbd/abstract_ui.cc" // instantiate template
@@ -1296,7 +1297,7 @@ Push2::update_selection_color ()
}
selection_color = get_color_index (current_midi_track->presentation_info().color());
- contrast_color = get_color_index (ArdourCanvas::HSV (current_midi_track->presentation_info().color()).opposite().color());
+ contrast_color = get_color_index (Gtkmm2ext::HSV (current_midi_track->presentation_info().color()).opposite().color());
reset_pad_colors ();
}
@@ -1569,7 +1570,7 @@ Push2::stripable_selection_changed ()
new_pad_target->input()->connect (new_pad_target->input()->nth (0), pad_port->name(), this);
current_pad_target = new_pad_target;
selection_color = get_color_index (new_pad_target->presentation_info().color());
- contrast_color = get_color_index (ArdourCanvas::HSV (new_pad_target->presentation_info().color()).opposite().color());
+ contrast_color = get_color_index (Gtkmm2ext::HSV (new_pad_target->presentation_info().color()).opposite().color());
} else {
current_pad_target.reset ();
selection_color = LED::Green;
@@ -1590,7 +1591,7 @@ Push2::button_by_id (ButtonID bid)
}
uint8_t
-Push2::get_color_index (ArdourCanvas::Color rgba)
+Push2::get_color_index (Color rgba)
{
ColorMap::iterator i = color_map.find (rgba);
@@ -1600,7 +1601,7 @@ Push2::get_color_index (ArdourCanvas::Color rgba)
double dr, dg, db, da;
int r, g, b;
- ArdourCanvas::color_to_rgba (rgba, dr, dg, db, da);
+ color_to_rgba (rgba, dr, dg, db, da);
int w = 126; /* not sure where/when we should get this value */
@@ -1675,26 +1676,26 @@ Push2::build_color_map ()
void
Push2::fill_color_table ()
{
- colors.insert (make_pair (DarkBackground, ArdourCanvas::rgba_to_color (0, 0, 0, 1)));
- colors.insert (make_pair (LightBackground, ArdourCanvas::rgba_to_color (0.98, 0.98, 0.98, 1)));
+ colors.insert (make_pair (DarkBackground, Gtkmm2ext::rgba_to_color (0, 0, 0, 1)));
+ colors.insert (make_pair (LightBackground, Gtkmm2ext::rgba_to_color (0.98, 0.98, 0.98, 1)));
- colors.insert (make_pair (ParameterName, ArdourCanvas::rgba_to_color (0.98, 0.98, 0.98, 1)));
+ colors.insert (make_pair (ParameterName, Gtkmm2ext::rgba_to_color (0.98, 0.98, 0.98, 1)));
- colors.insert (make_pair (KnobArcBackground, ArdourCanvas::rgba_to_color (0.3, 0.3, 0.3, 1.0)));
- colors.insert (make_pair (KnobArcStart, ArdourCanvas::rgba_to_color (1.0, 0.0, 0.0, 1.0)));
- colors.insert (make_pair (KnobArcEnd, ArdourCanvas::rgba_to_color (0.0, 1.0, 0.0, 1.0)));
+ colors.insert (make_pair (KnobArcBackground, Gtkmm2ext::rgba_to_color (0.3, 0.3, 0.3, 1.0)));
+ colors.insert (make_pair (KnobArcStart, Gtkmm2ext::rgba_to_color (1.0, 0.0, 0.0, 1.0)));
+ colors.insert (make_pair (KnobArcEnd, Gtkmm2ext::rgba_to_color (0.0, 1.0, 0.0, 1.0)));
- colors.insert (make_pair (KnobLineShadow, ArdourCanvas::rgba_to_color (0, 0, 0, 0.3)));
- colors.insert (make_pair (KnobLine, ArdourCanvas::rgba_to_color (1, 1, 1, 1)));
+ colors.insert (make_pair (KnobLineShadow, Gtkmm2ext::rgba_to_color (0, 0, 0, 0.3)));
+ colors.insert (make_pair (KnobLine, Gtkmm2ext::rgba_to_color (1, 1, 1, 1)));
- colors.insert (make_pair (KnobForeground, ArdourCanvas::rgba_to_color (0.2, 0.2, 0.2, 1)));
- colors.insert (make_pair (KnobBackground, ArdourCanvas::rgba_to_color (0.2, 0.2, 0.2, 1)));
- colors.insert (make_pair (KnobShadow, ArdourCanvas::rgba_to_color (0, 0, 0, 0.1)));
- colors.insert (make_pair (KnobBorder, ArdourCanvas::rgba_to_color (0, 0, 0, 1)));
+ colors.insert (make_pair (KnobForeground, Gtkmm2ext::rgba_to_color (0.2, 0.2, 0.2, 1)));
+ colors.insert (make_pair (KnobBackground, Gtkmm2ext::rgba_to_color (0.2, 0.2, 0.2, 1)));
+ colors.insert (make_pair (KnobShadow, Gtkmm2ext::rgba_to_color (0, 0, 0, 0.1)));
+ colors.insert (make_pair (KnobBorder, Gtkmm2ext::rgba_to_color (0, 0, 0, 1)));
}
-ArdourCanvas::Color
+Gtkmm2ext::Color
Push2::get_color (ColorName name)
{
Colors::iterator c = colors.find (name);
diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h
index 361801529a..7c9d147e7d 100644
--- a/libs/surfaces/push2/push2.h
+++ b/libs/surfaces/push2/push2.h
@@ -38,7 +38,7 @@
#include "control_protocol/control_protocol.h"
#include "control_protocol/types.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "midi_byte_array.h"
@@ -359,8 +359,8 @@ class Push2 : public ARDOUR::ControlProtocol
void write (const MidiByteArray&);
- uint8_t get_color_index (ArdourCanvas::Color rgba);
- ArdourCanvas::Color get_color (ColorName);
+ uint8_t get_color_index (Gtkmm2ext::Color rgba);
+ Gtkmm2ext::Color get_color (ColorName);
PressureMode pressure_mode () const { return _pressure_mode; }
void set_pressure_mode (PressureMode);
@@ -583,7 +583,7 @@ class Push2 : public ARDOUR::ControlProtocol
/* color map (device side) */
- typedef std::map<ArdourCanvas::Color,uint8_t> ColorMap;
+ typedef std::map<Gtkmm2ext::Color,uint8_t> ColorMap;
typedef std::stack<uint8_t> ColorMapFreeList;
ColorMap color_map;
ColorMapFreeList color_map_free_list;
@@ -591,7 +591,7 @@ class Push2 : public ARDOUR::ControlProtocol
/* our own colors */
- typedef std::map<ColorName,ArdourCanvas::Color> Colors;
+ typedef std::map<ColorName,Gtkmm2ext::Color> Colors;
Colors colors;
void fill_color_table ();
void reset_pad_colors ();
diff --git a/libs/surfaces/push2/scale.cc b/libs/surfaces/push2/scale.cc
index ac77c4ca32..e5f04604d4 100644
--- a/libs/surfaces/push2/scale.cc
+++ b/libs/surfaces/push2/scale.cc
@@ -20,7 +20,7 @@
#include "gtkmm2ext/gui_thread.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "canvas/rectangle.h"
#include "canvas/text.h"
@@ -38,6 +38,7 @@ using namespace std;
using namespace PBD;
using namespace Glib;
using namespace ArdourSurface;
+using namespace Gtkmm2ext;
using namespace ArdourCanvas;
static double unselected_root_alpha = 0.5;
diff --git a/libs/surfaces/push2/track_mix.cc b/libs/surfaces/push2/track_mix.cc
index a04ac0af24..ed4c9c3aa3 100644
--- a/libs/surfaces/push2/track_mix.cc
+++ b/libs/surfaces/push2/track_mix.cc
@@ -531,7 +531,7 @@ TrackMixLayout::color_changed ()
return;
}
- Color rgba = stripable->presentation_info().color();
+ Gtkmm2ext::Color rgba = stripable->presentation_info().color();
selection_color = p2.get_color_index (rgba);
name_text->set_color (rgba);
diff --git a/libs/widgets/ardour_button.cc b/libs/widgets/ardour_button.cc
index 8c16bcdca1..9687427608 100644
--- a/libs/widgets/ardour_button.cc
+++ b/libs/widgets/ardour_button.cc
@@ -29,12 +29,10 @@
#include "pbd/error.h"
#include "pbd/stacktrace.h"
-#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/gui_thread.h"
-
-#include "canvas/utils.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/utils.h"
#include "widgets/ardour_button.h"
#include "widgets/tooltips.h"
@@ -314,15 +312,15 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
if ((_elements & Body)==Body) {
rounded_function (cr, 1, 1, get_width() - 2, get_height() - 2, corner_radius);
if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) {
- ArdourCanvas::set_source_rgba (cr, fill_inactive_color);
+ Gtkmm2ext::set_source_rgba (cr, fill_inactive_color);
cairo_fill (cr);
} else if ( (active_state() == Gtkmm2ext::ExplicitActive) && !((_elements & Indicator)==Indicator) ) {
//background color
- ArdourCanvas::set_source_rgba (cr, fill_active_color);
+ Gtkmm2ext::set_source_rgba (cr, fill_active_color);
cairo_fill (cr);
} else { //inactive, or it has an indicator
//background color
- ArdourCanvas::set_source_rgba (cr, fill_inactive_color);
+ Gtkmm2ext::set_source_rgba (cr, fill_inactive_color);
}
cairo_fill (cr);
}
@@ -332,7 +330,7 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
if (active_state() == Gtkmm2ext::ImplicitActive && !((_elements & Indicator)==Indicator)) {
cairo_set_line_width (cr, 2.0);
rounded_function (cr, 2, 2, get_width() - 4, get_height() - 4, corner_radius-0.5);
- ArdourCanvas::set_source_rgba (cr, fill_active_color);
+ Gtkmm2ext::set_source_rgba (cr, fill_active_color);
cairo_stroke (cr);
}
}
@@ -418,7 +416,7 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
cairo_clip(cr);
cairo_new_path (cr);
- ArdourCanvas::set_source_rgba (cr, text_color);
+ Gtkmm2ext::set_source_rgba (cr, text_color);
const double text_ypos = (get_height() - _text_height) * .5;
if (_elements & Menu) {
@@ -520,7 +518,7 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
cairo_fill(cr);
//led color
- ArdourCanvas::set_source_rgba (cr, led_color);
+ Gtkmm2ext::set_source_rgba (cr, led_color);
cairo_arc (cr, 0, 0, _diameter * .5 - 3 * UIConfigurationBase::instance().get_ui_scale(), 0, 2 * M_PI);
cairo_fill(cr);
@@ -531,7 +529,7 @@ ArdourButton::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_
if ((visual_state() & Gtkmm2ext::Insensitive)) {
rounded_function (cr, 0, 0, get_width(), get_height(), corner_radius);
uint32_t ins_color = UIConfigurationBase::instance().color ("gtk_background");
- ArdourCanvas::set_source_rgb_a (cr, ins_color, 0.6);
+ Gtkmm2ext::set_source_rgb_a (cr, ins_color, 0.6);
cairo_fill (cr);
}
@@ -736,8 +734,8 @@ ArdourButton::set_colors ()
}
}
- text_active_color = ArdourCanvas::contrasting_text_color (fill_active_color);
- text_inactive_color = ArdourCanvas::contrasting_text_color (fill_inactive_color);
+ text_active_color = Gtkmm2ext::contrasting_text_color (fill_active_color);
+ text_inactive_color = Gtkmm2ext::contrasting_text_color (fill_inactive_color);
led_active_color = UIConfigurationBase::instance().color (string_compose ("%1: led active", name), &failed);
if (failed) {
@@ -748,7 +746,7 @@ ArdourButton::set_colors ()
* active color.
*/
- ArdourCanvas::HSV inactive (led_active_color);
+ Gtkmm2ext::HSV inactive (led_active_color);
inactive.v = 0.35;
led_inactive_color = inactive.color ();
diff --git a/libs/widgets/ardour_dropdown.cc b/libs/widgets/ardour_dropdown.cc
index 24c8d030a0..6be0ab84d6 100644
--- a/libs/widgets/ardour_dropdown.cc
+++ b/libs/widgets/ardour_dropdown.cc
@@ -31,8 +31,6 @@
#include "gtkmm2ext/rgb_macros.h"
#include "gtkmm2ext/gui_thread.h"
-#include "ardour/rc_configuration.h" // for widget prelight preference
-
#include "widgets/ardour_dropdown.h"
#include "pbd/i18n.h"
diff --git a/libs/widgets/ardour_icon.cc b/libs/widgets/ardour_icon.cc
index f111e8919c..b05ed63bcb 100644
--- a/libs/widgets/ardour_icon.cc
+++ b/libs/widgets/ardour_icon.cc
@@ -22,6 +22,7 @@
#include <assert.h>
#include <algorithm> // std:min
+#include "gtkmm2ext/colors.h"
#include "widgets/ardour_icon.h"
using namespace ArdourWidgets::ArdourIcon;
@@ -37,35 +38,22 @@ using namespace ArdourWidgets::ArdourIcon;
#define OUTLINEWIDTH 1.5 // px
-#define VECTORICONSTROKEFILL(fillalpha) \
- cairo_set_line_width (cr, OUTLINEWIDTH); \
- cairo_set_source_rgba (cr, 0, 0, 0, 1.0); \
- cairo_stroke_preserve (cr); \
- cairo_set_source_rgba (cr, 1, 1, 1, (fillalpha)); \
- cairo_fill (cr);
-
-#define VECTORICONSTROKEOUTLINE(LW, color) \
- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); \
- cairo_set_line_width (cr, (LW) + OUTLINEWIDTH); \
- ardour_icon_set_source_inv_rgba (cr, color); \
- cairo_stroke_preserve (cr); \
- ardour_icon_set_source_rgba (cr, color); \
- cairo_set_line_width (cr, (LW)); \
- cairo_stroke (cr);
+#define VECTORICONSTROKEFILL(fillalpha) \
+ cairo_set_line_width (cr, OUTLINEWIDTH); \
+ cairo_set_source_rgba (cr, 0, 0, 0, 1.0); \
+ cairo_stroke_preserve (cr); \
+ cairo_set_source_rgba (cr, 1, 1, 1, (fillalpha)); \
+ cairo_fill (cr);
+#define VECTORICONSTROKEOUTLINE(LW, color) \
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); \
+ cairo_set_line_width (cr, (LW) + OUTLINEWIDTH); \
+ ardour_icon_set_source_inv_rgba (cr, color); \
+ cairo_stroke_preserve (cr); \
+ Gtkmm2ext::set_source_rgba (cr, color); \
+ cairo_set_line_width (cr, (LW)); \
+ cairo_stroke (cr);
-/** convert 32bit 'RRGGBBAA' to cairo doubles
- * from libs/canvas/utils.cc and canvas/types.h: typedef uint32_t Color;
- */
-static void ardour_icon_set_source_rgba (cairo_t *cr, uint32_t color)
-{
- cairo_set_source_rgba (cr,
- ((color >> 24) & 0xff) / 255.0,
- ((color >> 16) & 0xff) / 255.0,
- ((color >> 8) & 0xff) / 255.0,
- ((color >> 0) & 0xff) / 255.0
- );
-}
/** inverse color */
static void ardour_icon_set_source_inv_rgba (cairo_t *cr, uint32_t color)
@@ -127,7 +115,7 @@ static void icon_tool_content (cairo_t *cr, const int width, const int height) {
cairo_move_to (cr, EM_POINT( 5.0, -5.0));
cairo_close_path (cr);
- ardour_icon_set_source_rgba (cr, 0xffffffff);
+ Gtkmm2ext::set_source_rgba (cr, 0xffffffff);
cairo_set_line_width (cr, 3 * em);
cairo_stroke (cr);
#undef EM_POINT
@@ -800,7 +788,7 @@ static void icon_zoom (cairo_t *cr, const enum ArdourWidgets::ArdourIcon::Icon i
#undef LINE45DEG
// lens
- ardour_icon_set_source_rgba (cr, fg_color);
+ Gtkmm2ext::set_source_rgba (cr, fg_color);
cairo_arc (cr, x, y, r, 0, 2 * M_PI);
cairo_fill_preserve (cr);
@@ -899,7 +887,7 @@ static void icon_close_cross (cairo_t *cr, const int width, const int height, co
const double x = width * .5;
const double y = height * .5;
const double o = .5 + std::min (x, y) * .4;
- ardour_icon_set_source_rgba (cr, fg_color);
+ Gtkmm2ext::set_source_rgba (cr, fg_color);
cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, x-o, y-o);
cairo_line_to (cr, x+o, y+o);
@@ -959,7 +947,7 @@ static void icon_strip_width (cairo_t *cr, const int width, const int height, co
const double ya0= height * .35;
const double ya1= height * .65;
- ardour_icon_set_source_rgba (cr, fg_color);
+ Gtkmm2ext::set_source_rgba (cr, fg_color);
cairo_set_line_width (cr, 1);
// left + right
@@ -992,7 +980,7 @@ static void icon_din_midi (cairo_t *cr, const int width, const int height, const
const double x = width * .5;
const double y = height * .5;
const double r = std::min (x, y) * .75;
- ardour_icon_set_source_rgba (cr, fg_color);
+ Gtkmm2ext::set_source_rgba (cr, fg_color);
cairo_set_line_width (cr, 1);
cairo_arc (cr, x, y, r, .57 * M_PI, 2.43 * M_PI);
cairo_stroke (cr);
diff --git a/libs/widgets/ardour_knob.cc b/libs/widgets/ardour_knob.cc
index 6948a88993..40adeb7d90 100644
--- a/libs/widgets/ardour_knob.cc
+++ b/libs/widgets/ardour_knob.cc
@@ -28,19 +28,14 @@
#include "pbd/error.h"
#include "pbd/stacktrace.h"
-#include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/colors.h"
#include "gtkmm2ext/gui_thread.h"
#include "gtkmm2ext/keyboard.h"
-
-#include "pbd/controllable.h"
+#include "gtkmm2ext/rgb_macros.h"
+#include "gtkmm2ext/utils.h"
#include "widgets/ardour_knob.h"
#include "widgets/ui_config.h"
-//#include "timers.h"
-
-#include "canvas/colors.h"
-#include "canvas/utils.h"
#include "pbd/i18n.h"
@@ -109,7 +104,7 @@ ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*
cairo_translate (cr, xc, yc); //after this, everything is based on the center of the knob
//get the knob color from the theme
- ArdourCanvas::Color knob_color = UIConfigurationBase::instance().color (string_compose ("%1", get_name()));
+ Gtkmm2ext::Color knob_color = UIConfigurationBase::instance().color (string_compose ("%1", get_name()));
float center_radius = 0.48*scale;
float border_width = 0.8;
@@ -134,11 +129,11 @@ ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*
//look up the arc colors from the config
double red_start, green_start, blue_start, unused;
- ArdourCanvas::Color arc_start_color = UIConfigurationBase::instance().color ( string_compose ("%1: arc start", get_name()));
- ArdourCanvas::color_to_rgba( arc_start_color, red_start, green_start, blue_start, unused );
+ Gtkmm2ext::Color arc_start_color = UIConfigurationBase::instance().color ( string_compose ("%1: arc start", get_name()));
+ Gtkmm2ext::color_to_rgba( arc_start_color, red_start, green_start, blue_start, unused );
double red_end, green_end, blue_end;
- ArdourCanvas::Color arc_end_color = UIConfigurationBase::instance().color ( string_compose ("%1: arc end", get_name()) );
- ArdourCanvas::color_to_rgba( arc_end_color, red_end, green_end, blue_end, unused );
+ Gtkmm2ext::Color arc_end_color = UIConfigurationBase::instance().color ( string_compose ("%1: arc end", get_name()) );
+ Gtkmm2ext::color_to_rgba( arc_end_color, red_end, green_end, blue_end, unused );
//vary the arc color over the travel of the knob
float intensity = fabsf (_val - zero) / std::max(zero, (1.f - zero));
@@ -198,7 +193,7 @@ ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*
cairo_restore(cr);
//inner circle
- ArdourCanvas::set_source_rgba(cr, knob_color);
+ Gtkmm2ext::set_source_rgba(cr, knob_color);
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_fill (cr);
@@ -216,7 +211,7 @@ ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*
cairo_pattern_destroy (shade_pattern);
//flat top over beveled edge
- ArdourCanvas::set_source_rgb_a (cr, knob_color, 0.5 );
+ Gtkmm2ext::set_source_rgb_a (cr, knob_color, 0.5 );
cairo_arc (cr, 0, 0, center_radius-pointer_thickness, 0, 2.0*G_PI);
cairo_fill (cr);
} else {
@@ -232,7 +227,7 @@ ArdourKnob::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*
} else {
//inner circle
- ArdourCanvas::set_source_rgba(cr, knob_color);
+ Gtkmm2ext::set_source_rgba(cr, knob_color);
cairo_arc (cr, 0, 0, center_radius, 0, 2.0*G_PI);
cairo_fill (cr);
}
diff --git a/libs/widgets/widgets/ui_config.h b/libs/widgets/widgets/ui_config.h
index 4087dae192..1270816985 100644
--- a/libs/widgets/widgets/ui_config.h
+++ b/libs/widgets/widgets/ui_config.h
@@ -4,7 +4,7 @@
#include <cassert>
#include "pbd/stateful.h"
-#include "canvas/colors.h"
+#include "gtkmm2ext/colors.h"
#include "widgets/visibility.h"
@@ -24,7 +24,7 @@ public:
virtual float get_ui_scale () = 0;
virtual bool get_widget_prelight () const = 0;
- virtual ArdourCanvas::Color color (const std::string&, bool* failed = 0) const = 0;
+ virtual Gtkmm2ext::Color color (const std::string&, bool* failed = 0) const = 0;
};
}
diff --git a/libs/widgets/wscript b/libs/widgets/wscript
index cf274e418c..0559abe4dc 100644
--- a/libs/widgets/wscript
+++ b/libs/widgets/wscript
@@ -78,7 +78,7 @@ def build(bld):
obj.export_includes = ['.']
obj.includes = ['.']
obj.uselib = 'SIGCPP CAIROMM GTKMM BOOST XML'
- obj.use = [ 'libpbd', 'libcanvas', 'libgtkmm2ext' ]
+ obj.use = [ 'libpbd', 'libgtkmm2ext' ]
obj.name = 'libwidgets'
obj.target = 'widgets'
obj.vnum = WIDGETS_LIB_VERSION