*/
#include <cmath>
-#include <cassert>
#include <algorithm>
#include <gtkmm.h>
return;
}
- uint32_t const color = ARDOUR_UI::config()->color ("silence");
+ uint32_t const color = ARDOUR_UI::config()->color_mod ("silence", "silence");
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
- ArdourCanvas::Rectangle* cr = new ArdourCanvas::TimeRectangle (group);
+ ArdourCanvas::Rectangle* cr = new ArdourCanvas::Rectangle (group);
cr->set_ignore_events (true);
_silent_frames.push_back (cr);
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 ()
{
TimeAxisViewItem::set_colors ();
+ set_sync_mark_color ();
+}
+void
+RegionView::set_sync_mark_color ()
+{
if (sync_mark) {
- /* XXX: make these colours themable */
- 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));
+ ArdourCanvas::Color c = ARDOUR_UI::config()->color ("sync mark");
+ sync_mark->set_fill_color (c);
+ sync_mark->set_outline_color (c);
+ sync_line->set_outline_color (c);
}
}
-void
-RegionView::set_frame_color ()
+uint32_t
+RegionView::get_fill_color () const
{
- TimeAxisViewItem::set_frame_color ();
+ ArdourCanvas::Color f = TimeAxisViewItem::get_fill_color();
+ char const *modname;
+
+ if (_region->opaque()) {
+ modname = "opaque region base";
+ } else {
+ modname = "transparent region base";
+ }
+
+ return HSV(f).mod (ARDOUR_UI::config()->modifier (modname)).color ();
}
void
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 (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 (ArdourCanvas::rgba_to_color (0, 1.0, 0, 1.0)); // FIXME make a themeable colour
+
+ set_sync_mark_color ();
}
/* this has to handle both a genuine change of position, a change of samples_per_pixel
bool me = false;
/* the color that will be used to show parts of regions that will not be heard */
- uint32_t const non_playing_color = ARDOUR_UI::config()->color ("covered region");
+ uint32_t const non_playing_color = ARDOUR_UI::config()->color_mod ("covered region", "covered region base");
while (t < end) {
/* start off any new rect, if required */
if (cr == 0 || me != new_me) {
- cr = new ArdourCanvas::TimeRectangle (group);
+ cr = new ArdourCanvas::Rectangle (group);
_coverage_frames.push_back (cr);
cr->set_x0 (trackview.editor().sample_to_pixel (t - position));
cr->set_y0 (1);
/** Snap a frame offset within our region using the current snap settings.
* @param x Frame offset from this region's position.
+ * @param ensure_snap whether to ignore snap_mode (in the case of SnapOff) and magnetic snap.
+ * Used when inverting snap mode logic with key modifiers, or snap distance calculation.
* @return Snapped frame offset from this region's position.
*/
frameoffset_t
-RegionView::snap_frame_to_frame (frameoffset_t x) const
+RegionView::snap_frame_to_frame (frameoffset_t x, bool ensure_snap) const
{
PublicEditor& editor = trackview.editor();
/* try a snap in either direction */
framepos_t frame = session_frame;
- editor.snap_to (frame, RoundNearest);
+ editor.snap_to (frame, RoundNearest, false, ensure_snap);
/* if we went off the beginning of the region, snap forwards */
if (frame < _region->position ()) {
frame = session_frame;
- editor.snap_to (frame, RoundUpAlways);
+ editor.snap_to (frame, RoundUpAlways, false, ensure_snap);
}
/* back to region relative */