mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-05 14:11:00 +01:00
Add and use some ZoomInfo and ViewInfo member functions, so we can eliminate...
... miscellaneous direct uses of ZoomInfo::zoom to test and set zoom level. This includes all the remaining assignments to it. But moving TrackInfo::PositionToTime and TrackInfo::TimeToPosition into ZoomInfo and using them is needed to eliminate many more uses. Also #if'd out the unused AudacityProject::OnZoomToggle().
This commit is contained in:
committed by
Paul Licameli
parent
8ba9ea5621
commit
5a6d5d1443
@@ -28,9 +28,9 @@ internally, not ints, allowing for (external) control of zooming.
|
||||
*//*******************************************************************/
|
||||
|
||||
#include "../Audacity.h"
|
||||
#include "AttachableScrollBar.h"
|
||||
|
||||
#include <wx/wxprec.h>
|
||||
#include "AttachableScrollBar.h"
|
||||
#include "../ViewInfo.h"
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ void AttachableScrollBar::SetScrollBarFromViewInfo()
|
||||
{
|
||||
ViewInfo & mViewInfo = *mpViewInfo;
|
||||
|
||||
mViewInfo.sbarTotal = (int) (mViewInfo.total * mViewInfo.zoom);
|
||||
mViewInfo.sbarScreen = (int) (mViewInfo.screen * mViewInfo.zoom);
|
||||
mViewInfo.sbarH = (int) (mViewInfo.h * mViewInfo.zoom);
|
||||
mViewInfo.sbarTotal = (int) (mViewInfo.GetTotalWidth());
|
||||
mViewInfo.sbarScreen = (int) (mViewInfo.GetScreenWidth());
|
||||
mViewInfo.sbarH = (int) (mViewInfo.GetBeforeScreenWidth());
|
||||
|
||||
SetScrollbar(mViewInfo.sbarH, mViewInfo.sbarScreen,
|
||||
mViewInfo.sbarTotal, mViewInfo.sbarScreen, TRUE);
|
||||
@@ -75,14 +75,8 @@ void AttachableScrollBar::SetViewInfoFromScrollBar()
|
||||
|
||||
mViewInfo.sbarH = GetThumbPosition();
|
||||
|
||||
if (mViewInfo.sbarH != hlast) {
|
||||
mViewInfo.h = mViewInfo.sbarH / mViewInfo.zoom;
|
||||
|
||||
if (mViewInfo.h > mViewInfo.total - mViewInfo.screen)
|
||||
mViewInfo.h = mViewInfo.total - mViewInfo.screen;
|
||||
if (mViewInfo.h < 0.0)
|
||||
mViewInfo.h = 0.0;
|
||||
}
|
||||
if (mViewInfo.sbarH != hlast)
|
||||
mViewInfo.SetBeforeScreenWidth(mViewInfo.sbarH);
|
||||
}
|
||||
|
||||
// Used to associated a ViewInfo structure with a scrollbar.
|
||||
|
||||
Reference in New Issue
Block a user