| 1283 | } |
| 1284 | |
| 1285 | AdornedRulerPanel::AdornedRulerPanel(AudacityProject* project, |
| 1286 | wxWindow *parent, |
| 1287 | wxWindowID id, |
| 1288 | const wxPoint& pos, |
| 1289 | const wxSize& size, |
| 1290 | ViewInfo *viewinfo |
| 1291 | ) : CellularPanel(parent, id, pos, size, viewinfo) |
| 1292 | , mProject { project } |
| 1293 | , mUpdater { ProjectTimeRuler::Get(*project).GetUpdater() } |
| 1294 | , mRuler { ProjectTimeRuler::Get(*project).GetRuler() } |
| 1295 | { |
| 1296 | SetLayoutDirection(wxLayout_LeftToRight); |
| 1297 | |
| 1298 | mQPCell = std::make_shared<QPCell>( this ); |
| 1299 | mScrubbingCell = std::make_shared<ScrubbingCell>( this ); |
| 1300 | |
| 1301 | for (auto &button : mButtons) |
| 1302 | button = nullptr; |
| 1303 | |
| 1304 | SetLabel( XO("Timeline") ); |
| 1305 | SetName(); |
| 1306 | SetBackgroundStyle(wxBG_STYLE_PAINT); |
| 1307 | |
| 1308 | mLeftOffset = 0; |
| 1309 | mIndTime = -1; |
| 1310 | |
| 1311 | mLeftDownClick = -1; |
| 1312 | mMouseEventState = mesNone; |
| 1313 | mIsDragging = false; |
| 1314 | |
| 1315 | mOuter = GetClientRect(); |
| 1316 | |
| 1317 | mTimeDisplayMode = TimeDisplayModePreference.ReadEnum(); |
| 1318 | |
| 1319 | mUpdater.SetData(mViewInfo, mLeftOffset); |
| 1320 | |
| 1321 | mRuler.SetLabelEdges( false ); |
| 1322 | |
| 1323 | mTracks = &TrackList::Get( *project ); |
| 1324 | |
| 1325 | mIsRecording = false; |
| 1326 | |
| 1327 | mPlayRegionDragsSelection = (gPrefs->Read(wxT("/QuickPlay/DragSelection"), 0L) == 1)? true : false; |
| 1328 | |
| 1329 | #if wxUSE_TOOLTIPS |
| 1330 | wxToolTip::Enable(true); |
| 1331 | #endif |
| 1332 | |
| 1333 | mAudioIOSubscription = AudioIO::Get() |
| 1334 | ->Subscribe(*this, &AdornedRulerPanel::OnAudioStartStop); |
| 1335 | |
| 1336 | // Delay until after CommandManager has been populated: |
| 1337 | this->CallAfter( &AdornedRulerPanel::UpdatePrefs ); |
| 1338 | |
| 1339 | mThemeChangeSubscription = |
| 1340 | theTheme.Subscribe(*this, &AdornedRulerPanel::OnThemeChange); |
| 1341 | |
| 1342 | // Bind event that updates the play region |