Logo Search packages:      
Sourcecode: ardour version File versions

bool TimeAxisViewItem::set_position ( nframes_t  pos,
void *  src,
double *  delta = 0 
) [virtual]

Set the position of this item upon the timeline to the specified value

Parameters:
pos the new position
src the identity of the object that initiated the change
Returns:
true if the position change was a success, false otherwise

Reimplemented in ImageFrameView.

Definition at line 275 of file time_axis_view_item.cc.

References frame_position, position_locked, PositionChanged, and samples_per_unit.

Referenced by MarkerView::MarkerView(), ImageFrameView::set_position(), and set_samples_per_unit().

{
      if (position_locked) {
            return false;
      }

      frame_position = pos;
      
      /*  This sucks. The GnomeCanvas version I am using
          doesn't correctly implement gnome_canvas_group_set_arg(),
          so that simply setting the "x" arg of the group
          fails to move the group. Instead, we have to
          use gnome_canvas_item_move(), which does the right
          thing. I see that in GNOME CVS, the current (Sept 2001)
          version of GNOME Canvas rectifies this issue cleanly.
      */
      
      double old_unit_pos ;
      double new_unit_pos = pos / samples_per_unit ;

      old_unit_pos = group->property_x();

      if (new_unit_pos != old_unit_pos) {
            group->move (new_unit_pos - old_unit_pos, 0.0);
      }
      
      if (delta) {
            (*delta) = new_unit_pos - old_unit_pos;
      }
      
      PositionChanged (frame_position, src) ; /* EMIT_SIGNAL */

      return true;
}


Generated by  Doxygen 1.6.0   Back to index