void EditToolBar::EnableDisableButtons() { AudacityProject *p = GetActiveProject(); if (!p) return; // Is anything selected? bool selection = false; TrackListIterator iter(p->GetTracks()); for (Track *t = iter.First(); t; t = iter.Next()) if (t->GetSelected()) { selection = true; break; } selection &= (p->GetSel0() < p->GetSel1()); mButtons[ETBCutID]->SetEnabled(selection); mButtons[ETBCopyID]->SetEnabled(selection); mButtons[ETBTrimID]->SetEnabled(selection); mButtons[ETBSilenceID]->SetEnabled(selection); mButtons[ETBUndoID]->SetEnabled(p->GetUndoManager()->UndoAvailable()); mButtons[ETBRedoID]->SetEnabled(p->GetUndoManager()->RedoAvailable()); bool tracks = (!p->GetTracks()->IsEmpty()); mButtons[ETBZoomInID]->SetEnabled(tracks && (p->GetZoom() < gMaxZoom)); mButtons[ETBZoomOutID]->SetEnabled(tracks && (p->GetZoom() > gMinZoom) ); #if 0 // Disabled for version 1.2.0 since it doesn't work quite right... mButtons[ETBZoomToggleID]->SetEnabled(tracks); #endif mButtons[ETBZoomSelID]->SetEnabled(selection); mButtons[ETBZoomFitID]->SetEnabled(tracks); mButtons[ETBPasteID]->SetEnabled(p->Clipboard()); #ifdef EXPERIMENTAL_LINKING bool linkTracks; gPrefs->Read(wxT("/GUI/LinkTracks"), &linkTracks, true); if (linkTracks) mButtons[ETBLinkID]->PushDown(); else mButtons[ETBLinkID]->PopUp(); #endif }
void LOFImportFileHandle::doDuration() { if (callDurationFactor) { double longestDuration = mProject->GetTracks()->GetEndTime(); double realZoomValue = ((longestDuration/durationFactor)*(mProject->GetZoom())); mProject->Zoom(realZoomValue); callDurationFactor = false; } }