#include "canvas/polygon.h"
#include "canvas/debug.h"
#include "canvas/pixbuf.h"
#include "canvas/text.h"
#include "canvas/line.h"
#include "canvas/polygon.h"
#include "canvas/debug.h"
#include "canvas/pixbuf.h"
#include "canvas/text.h"
#include "canvas/line.h"
_region->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RegionView::region_changed, this, _1), gui_context());
_region->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RegionView::region_changed, this, _1), gui_context());
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler));
/* XXX sync mark drag? */
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler));
/* XXX sync mark drag? */
framecnt_t s = _region->start();
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
framecnt_t s = _region->start();
for (AudioIntervalResult::const_iterator i = silences.begin(); i != silences.end(); ++i) {
- _silence_text->set_font_description (get_font_for_style (N_("SilenceText")));
- _silence_text->set_color (UIConfiguration::instance().color ("silence text"));
+ _silence_text->set_font_description (get_font_for_style (N_("SilenceText")));
+ _silence_text->set_color (UIConfiguration::instance().color ("silence text"));
- _silence_text->set_x_position (trackview.editor().sample_to_pixel (silences.front().first - _region->start()) + 10.0);
- _silence_text->set_y_position (20.0);
+ _silence_text->set_x_position (trackview.editor().sample_to_pixel (silences.front().first - _region->start()) + 10.0);
+ _silence_text->set_y_position (20.0);
string text = string_compose (ngettext ("%1 silent segment", "%1 silent segments", silences.size()), silences.size())
+ ", "
+ string_compose (_("shortest = %1 %2"), ms, sunits);
string text = string_compose (ngettext ("%1 silent segment", "%1 silent segments", silences.size()), silences.size())
+ ", "
+ string_compose (_("shortest = %1 %2"), ms, sunits);
- if (shortest_audible != max_framepos) {
- /* ms are now in seconds */
- double ma = (float) shortest_audible / _region->session().frame_rate();
- char const * aunits;
-
- if (ma >= 60.0) {
- aunits = _("minutes");
- ma /= 60.0;
- } else if (ma < 1.0) {
- aunits = _("msecs");
- ma *= 1000.0;
- } else {
- aunits = _("secs");
- }
+ if (shortest_audible != max_framepos) {
+ /* ms are now in seconds */
+ double ma = (float) shortest_audible / _region->session().frame_rate();
+ char const * aunits;
+
+ if (ma >= 60.0) {
+ aunits = _("minutes");
+ ma /= 60.0;
+ } else if (ma < 1.0) {
+ aunits = _("msecs");
+ ma *= 1000.0;
+ } else {
+ aunits = _("secs");
+ }
RegionView::hide_silent_frames ()
{
for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
RegionView::hide_silent_frames ()
{
for (list<ArdourCanvas::Rectangle*>::iterator i = _silent_frames.begin (); i != _silent_frames.end (); ++i) {
sync_mark->set_fill_color (c);
sync_mark->set_outline_color (c);
sync_line->set_outline_color (c);
sync_mark->set_fill_color (c);
sync_mark->set_outline_color (c);
sync_line->set_outline_color (c);
/* the color that will be used to show parts of regions that will not be heard */
uint32_t const non_playing_color = UIConfiguration::instance().color_mod ("covered region", "covered region base");
/* the color that will be used to show parts of regions that will not be heard */
uint32_t const non_playing_color = UIConfiguration::instance().color_mod ("covered region", "covered region base");
while (t < end) {
t++;
/* is this region is on top at time t? */
bool const new_me = (pl->top_unmuted_region_at (t) == _region);
while (t < end) {
t++;
/* is this region is on top at time t? */
bool const new_me = (pl->top_unmuted_region_at (t) == _region);
/* finish off any old rect, if required */
if (cr && me != new_me) {
cr->set_x1 (trackview.editor().sample_to_pixel (t - position));
/* finish off any old rect, if required */
if (cr && me != new_me) {
cr->set_x1 (trackview.editor().sample_to_pixel (t - position));
if (cr) {
/* finish off the last rectangle */
cr->set_x1 (trackview.editor().sample_to_pixel (end - position));
if (cr) {
/* finish off the last rectangle */
cr->set_x1 (trackview.editor().sample_to_pixel (end - position));
// Only trim region on the right if the last frame has gone beyond the right region's first frame.
if (region_right != 0 && (region_right->first_frame() < _region->last_frame() || regions_touching)) {
// Only trim region on the right if the last frame has gone beyond the right region's first frame.
if (region_right != 0 && (region_right->first_frame() < _region->last_frame() || regions_touching)) {
* Used when inverting snap mode logic with key modifiers, or snap distance calculation.
* @return Snapped frame offset from this region's position.
*/
* Used when inverting snap mode logic with key modifiers, or snap distance calculation.
* @return Snapped frame offset from this region's position.
*/
RegionView::snap_frame_to_frame (frameoffset_t x, bool ensure_snap) const
{
PublicEditor& editor = trackview.editor();
RegionView::snap_frame_to_frame (frameoffset_t x, bool ensure_snap) const
{
PublicEditor& editor = trackview.editor();
/* x is region relative, convert it to global absolute frames */
framepos_t const session_frame = x + _region->position();
/* try a snap in either direction */
/* x is region relative, convert it to global absolute frames */
framepos_t const session_frame = x + _region->position();
/* try a snap in either direction */
editor.snap_to (frame, RoundNearest, false, ensure_snap);
/* if we went off the beginning of the region, snap forwards */
editor.snap_to (frame, RoundNearest, false, ensure_snap);
/* if we went off the beginning of the region, snap forwards */
editor.snap_to (frame, RoundUpAlways, false, ensure_snap);
}
editor.snap_to (frame, RoundUpAlways, false, ensure_snap);
}
- /* back to region relative */
- return frame - _region->position();
+ /* back to region relative, keeping the relevant divisor */
+ return MusicFrame (frame.frame - _region->position(), frame.division);