diff --git a/ChangeLog b/ChangeLog index 97b4a747..ef8e5a42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22558,3 +22558,7 @@ 2021-10-27 Fred Gleason * Refactored the 'Add Clock' dialog in rdlogmanager(1) to allow specification of the clock code as well as name. +2021-10-27 Fred Gleason + * Fixed a bug in the 'Edit Audio' dialog in rdlibrary(1) that + would set the initial position of a newly-added marker off-screen + when the waveform view port was scrolled to the right. diff --git a/lib/rdmarkerview.cpp b/lib/rdmarkerview.cpp index 1cd1b4fd..1113de2b 100644 --- a/lib/rdmarkerview.cpp +++ b/lib/rdmarkerview.cpp @@ -812,8 +812,8 @@ void RDMarkerView::updateMenuData() { bool can_add= (d_deleting_roles.size()==0)&& - (Msec(d_mouse_pos)>=d_pointers[RDMarkerHandle::CutStart])&& - (Msec(d_mouse_pos)=d_pointers[RDMarkerHandle::CutStart])&& + (d_msec_posx()<=LEFT_MARGIN)||(e->x()>d_right_margin)) { + if(d_view->horizontalScrollBar()!=NULL) { + origin=d_view->horizontalScrollBar()->value(); + } + if((e->x()<=LEFT_MARGIN)||((e->x()+origin)>d_right_margin)) { QWidget::mousePressEvent(e); return; } @@ -1093,15 +1095,12 @@ void RDMarkerView::mousePressEvent(QMouseEvent *e) d_marker_menu_used=false; return; } - + d_msec_pos=(int64_t)(d_mouse_pos+origin)*(int64_t)d_shrink_factor*1152000/ + (int64_t)d_sample_rate; + switch(e->button()) { case Qt::LeftButton: - if(d_view->horizontalScrollBar()!=NULL) { - origin=d_view->horizontalScrollBar()->value(); - } - msec=(int64_t)(d_mouse_pos+origin)*(int64_t)d_shrink_factor*1152000/ - (int64_t)d_sample_rate; - emit positionClicked(msec); + emit positionClicked(d_msec_pos); break; case Qt::MidButton: diff --git a/lib/rdmarkerview.h b/lib/rdmarkerview.h index cb8b6cc6..92da7d68 100644 --- a/lib/rdmarkerview.h +++ b/lib/rdmarkerview.h @@ -171,6 +171,7 @@ class RDMarkerView : public RDWidget unsigned d_channels; int d_audio_length; int d_mouse_pos; + int d_msec_pos; int d_right_margin; QStringList d_pointer_fields; RDWaveFactory *d_wave_factory;