#include "canvas/pixbuf.h"
#include "canvas/text.h"
#include "canvas/line.h"
+#include "canvas/utils.h"
#include "ardour_ui.h"
#include "global_signals.h"
using namespace std;
using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
using namespace PBD;
using namespace Editing;
using namespace Gtk;
PBD::Signal1<void,RegionView*> RegionView::RegionViewGoingAway;
-RegionView::RegionView (ArdourCanvas::Group* parent,
+RegionView::RegionView (ArdourCanvas::Container* parent,
TimeAxisView& tv,
boost::shared_ptr<ARDOUR::Region> r,
double spu,
- Gdk::Color const & basic_color,
+ uint32_t basic_color,
bool automation)
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), false, automation,
(automation ? TimeAxisViewItem::ShowFrame :
GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RegionView::remove_ghost, this, _1), gui_context());
}
-RegionView::RegionView (ArdourCanvas::Group* parent,
+RegionView::RegionView (ArdourCanvas::Container* parent,
TimeAxisView& tv,
boost::shared_ptr<ARDOUR::Region> r,
double spu,
- Gdk::Color const & basic_color,
+ uint32_t basic_color,
bool recording,
TimeAxisViewItem::Visibility visibility)
: TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), recording, false, visibility)
}
void
-RegionView::init (Gdk::Color const & basic_color, bool wfd)
+RegionView::init (bool wfd)
{
editor = 0;
valid = true;
sync_mark = 0;
sync_line = 0;
- compute_colors (basic_color);
-
if (name_highlight) {
name_highlight->set_data ("regionview", this);
name_highlight->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_name_highlight_event), name_highlight, this));
return true;
}
+uint32_t
+RegionView::fill_opacity () const
+{
+ if (!_region->opaque()) {
+ return 60;
+ }
+
+ uint32_t normal_tavi_opacity = TimeAxisViewItem::fill_opacity ();
+
+ return normal_tavi_opacity;
+}
+
void
RegionView::set_colors ()
{
if (sync_mark) {
/* XXX: make these colours themable */
- sync_mark->set_fill_color (RGBA_TO_UINT (0, 255, 0, 255));
- sync_line->set_outline_color (RGBA_TO_UINT (0, 255, 0, 255));
+ sync_mark->set_fill_color (ArdourCanvas::rgba_to_color (0, 1.0, 0, 1.0));
+ sync_line->set_outline_color (ArdourCanvas::rgba_to_color (0, 1.0, 0, 1.0));
}
}
void
RegionView::set_frame_color ()
{
- if (_region->opaque()) {
- fill_opacity = 130;
- } else {
- fill_opacity = 60;
- }
-
TimeAxisViewItem::set_frame_color ();
}
-void
-RegionView::fake_set_opaque (bool yn)
-{
- if (yn) {
- fill_opacity = 130;
- } else {
- fill_opacity = 60;
- }
-
- set_frame_color ();
-}
-
void
RegionView::show_region_editor ()
{
sync_mark = new ArdourCanvas::Polygon (group);
CANVAS_DEBUG_NAME (sync_mark, string_compose ("sync mark for %1", get_item_name()));
- sync_mark->set_fill_color (RGBA_TO_UINT(0,255,0,255)); // FIXME make a themeable colour
+ sync_mark->set_fill_color (ArdourCanvas::rgba_to_color (0, 1.0, 0, 1.0)); // FIXME make a themeable colour
sync_line = new ArdourCanvas::Line (group);
CANVAS_DEBUG_NAME (sync_line, string_compose ("sync mark for %1", get_item_name()));
- sync_line->set_outline_color (RGBA_TO_UINT(0,255,0,255)); // FIXME make a themeable colour
+ sync_line->set_outline_color (ArdourCanvas::rgba_to_color (0, 1.0, 0, 1.0)); // FIXME make a themeable colour
}
/* this has to handle both a genuine change of position, a change of samples_per_pixel
sync_mark->set (points);
sync_mark->show ();
- sync_line->set (ArdourCanvas::Duple (offset, 0), ArdourCanvas::Duple (offset, trackview.current_height() - NAME_HIGHLIGHT_SIZE));
+ sync_line->set (ArdourCanvas::Duple (offset, 0), ArdourCanvas::Duple (offset, trackview.current_height() - NAME_HIGHLIGHT_SIZE - 1));
sync_line->show ();
}
}
sync_line->set (
ArdourCanvas::Duple (offset, 0),
- ArdourCanvas::Duple (offset, h - NAME_HIGHLIGHT_SIZE)
+ ArdourCanvas::Duple (offset, h - NAME_HIGHLIGHT_SIZE - 1)
);
}
for (list<ArdourCanvas::Rectangle*>::iterator i = _coverage_frames.begin(); i != _coverage_frames.end(); ++i) {
- (*i)->set_y1 (h + 1);
+ (*i)->set_y0 (1);
+ (*i)->set_y1 (h);
}
for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin(); i != _silent_frames.end(); ++i) {
- (*i)->set_y1 (h + 1);
+ (*i)->set_y0 (1);
+ (*i)->set_y1 (h);
}
}
_coverage_frames.push_back (cr);
cr->set_x0 (trackview.editor().sample_to_pixel (t - position));
cr->set_y0 (1);
- cr->set_y1 (_height + 1);
+ cr->set_y1 (_height);
cr->set_outline (false);
cr->set_ignore_events (true);
if (new_me) {