Logo Search packages:      
Sourcecode: rosegarden version File versions  Download package

virtual Rosegarden::ViewElementList::iterator LinedStaff::getClosestElementToCanvasCoords ( double  x,
int  y,
Rosegarden::Event *&  clef,
Rosegarden::Event *&  key,
bool  notesAndRestsOnly = false,
int  proximityThreshold = 10 
) [inline, virtual, inherited]

Return an iterator pointing to the nearest view element to the given canvas coordinates.

If notesAndRestsOnly is true, do not return any view element other than a note or rest.

If the closest view element is further away than proximityThreshold pixels in either x or y axis, return end(). If proximityThreshold is less than zero, treat it as infinite.

Also return the clef and key in force at these coordinates.

The default implementation should suit for subclasses that only show a single element per layout X coordinate.

Definition at line 525 of file linedstaff.h.

References LinedStaff::getClosestElementToLayoutX(), and LinedStaff::getLayoutCoordsForCanvasCoords().

Referenced by NotationSelectionPaster::handleLeftButtonPress(), TextInserter::handleLeftButtonPress(), and ClefInserter::handleLeftButtonPress().

      LinedStaffCoords layoutCoords = getLayoutCoordsForCanvasCoords(x, y);
      return getClosestElementToLayoutX
          (layoutCoords.first, clef, key,
           notesAndRestsOnly, proximityThreshold);

Generated by  Doxygen 1.6.0   Back to index