Audacity  2.3.1
Public Member Functions | Public Attributes | List of all members
ViewInfo Class Referencefinal

ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some status flags. More...

#include <ViewInfo.h>

Inheritance diagram for ViewInfo:
ZoomInfo

Public Member Functions

 ViewInfo (double start, double screenDuration, double pixelsPerSecond)
 
void UpdatePrefs ()
 
double GetBeforeScreenWidth () const
 
void SetBeforeScreenWidth (wxInt64 beforeWidth, wxInt64 screenWidth, double lowerBoundTime=0.0)
 
double GetTotalWidth () const
 
void WriteXMLAttributes (XMLWriter &xmlFile) const
 
bool ReadXMLAttribute (const wxChar *attr, const wxChar *value)
 
void OnTimer (wxCommandEvent &event)
 
- Public Member Functions inherited from ZoomInfo
 ZoomInfo (double start, double pixelsPerSecond)
 
 ~ZoomInfo ()
 
 ZoomInfo (const ZoomInfo &) PROHIBITED
 
ZoomInfooperator= (const ZoomInfo &) PROHIBITED
 
void UpdatePrefs ()
 
double PositionToTime (wxInt64 position, wxInt64 origin=0, bool ignoreFisheye=false) const
 
wxInt64 TimeToPosition (double time, wxInt64 origin=0, bool ignoreFisheye=false) const
 STM: Converts a project time to screen x position. More...
 
double TimeRangeToPixelWidth (double timeRange) const
 
double OffsetTimeByPixels (double time, wxInt64 offset, bool ignoreFisheye=false) const
 
bool ZoomInAvailable () const
 
bool ZoomOutAvailable () const
 
void SetZoom (double pixelsPerSecond)
 
double GetZoom ()
 
void ZoomBy (double multiplier)
 
void FindIntervals (double rate, Intervals &results, wxInt64 width, wxInt64 origin=0) const
 
FisheyeState GetFisheyeState () const
 
bool InFisheye (wxInt64, wxInt64 WXUNUSED(origin=0)) const
 
wxInt64 GetFisheyeLeftBoundary (wxInt64 WXUNUSED(origin=0)) const
 
wxInt64 GetFisheyeRightBoundary (wxInt64 WXUNUSED(origin=0)) const
 

Public Attributes

SelectedRegion selectedRegion
 
double total
 
wxInt64 sbarH
 
wxInt64 sbarScreen
 
wxInt64 sbarTotal
 
double sbarScale
 
int scrollStep
 
bool bUpdateTrackIndicator
 
bool bScrollBeyondZero
 
bool bAdjustSelectionEdges
 
double mRecentStreamTime
 
- Public Attributes inherited from ZoomInfo
int vpos
 
double h
 
float dBr
 

Additional Inherited Members

- Public Types inherited from ZoomInfo
enum  FisheyeState { HIDDEN, PINNED, NUM_STATES }
 
typedef std::vector< IntervalIntervals
 
- Static Public Member Functions inherited from ZoomInfo
static double GetDefaultZoom ()
 
static double GetMaxZoom ()
 
static double GetMinZoom ()
 
- Protected Attributes inherited from ZoomInfo
double zoom
 

Detailed Description

ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some status flags.

Definition at line 141 of file ViewInfo.h.

Constructor & Destructor Documentation

ViewInfo::ViewInfo ( double  start,
double  screenDuration,
double  pixelsPerSecond 
)

Definition at line 134 of file ViewInfo.cpp.

References UpdatePrefs().

135  : ZoomInfo(start, pixelsPerSecond)
136  , selectedRegion()
137  , total(screenDuration)
138  , sbarH(0)
139  , sbarScreen(1)
140  , sbarTotal(1)
141  , sbarScale(1.0)
142  , scrollStep(16)
143  , bUpdateTrackIndicator(true)
144  , bScrollBeyondZero(false)
145  , mRecentStreamTime(-1.0)
146 {
147  UpdatePrefs();
148 }
bool bUpdateTrackIndicator
Definition: ViewInfo.h:182
SelectedRegion selectedRegion
Definition: ViewInfo.h:160
wxInt64 sbarH
Definition: ViewInfo.h:166
void UpdatePrefs()
Definition: ViewInfo.cpp:150
wxInt64 sbarTotal
Definition: ViewInfo.h:168
bool bScrollBeyondZero
Definition: ViewInfo.h:184
ZoomInfo(double start, double pixelsPerSecond)
Definition: ViewInfo.cpp:29
wxInt64 sbarScreen
Definition: ViewInfo.h:167
int scrollStep
Definition: ViewInfo.h:177
double total
Definition: ViewInfo.h:164
double sbarScale
Definition: ViewInfo.h:174
double mRecentStreamTime
Definition: ViewInfo.h:189

Member Function Documentation

double ViewInfo::GetBeforeScreenWidth ( ) const
inline

Definition at line 149 of file ViewInfo.h.

References ZoomInfo::zoom.

Referenced by AudacityProject::FixScrollbars(), and AttachableScrollBar::SetScrollBarFromViewInfo().

150  {
151  return h * zoom;
152  }
double h
Definition: ViewInfo.h:47
double zoom
Definition: ViewInfo.h:50
double ViewInfo::GetTotalWidth ( ) const
inline

Definition at line 155 of file ViewInfo.h.

References ZoomInfo::zoom.

Referenced by AudacityProject::FixScrollbars(), and AttachableScrollBar::SetScrollBarFromViewInfo().

156  { return total * zoom; }
double zoom
Definition: ViewInfo.h:50
double total
Definition: ViewInfo.h:164
void ViewInfo::OnTimer ( wxCommandEvent &  event)

Definition at line 203 of file ViewInfo.cpp.

References gAudioIO, AudioIO::GetStreamTime(), and mRecentStreamTime.

Referenced by AudacityProject::AudacityProject().

204 {
206  event.Skip();
207 }
double GetStreamTime()
During playback, the track time most recently played.
Definition: AudioIO.cpp:2903
AudioIO * gAudioIO
Definition: AudioIO.cpp:492
double mRecentStreamTime
Definition: ViewInfo.h:189
bool ViewInfo::ReadXMLAttribute ( const wxChar *  attr,
const wxChar *  value 
)

Definition at line 178 of file ViewInfo.cpp.

References Internat::CompatibleToDouble(), ZoomInfo::h, SelectedRegion::HandleXMLAttribute(), selectedRegion, ZoomInfo::vpos, and ZoomInfo::zoom.

Referenced by AudacityProject::HandleXMLTag().

179 {
180  if (selectedRegion.HandleXMLAttribute(attr, value, wxT("sel0"), wxT("sel1")))
181  return true;
182 
183  if (!wxStrcmp(attr, wxT("vpos"))) {
184  long longVpos;
185  wxString(value).ToLong(&longVpos);
186  vpos = (int)(longVpos);
187  return true;
188  }
189 
190  if (!wxStrcmp(attr, wxT("h"))) {
192  return true;
193  }
194 
195  if (!wxStrcmp(attr, wxT("zoom"))) {
197  return true;
198  }
199 
200  return false;
201 }
SelectedRegion selectedRegion
Definition: ViewInfo.h:160
double h
Definition: ViewInfo.h:47
double zoom
Definition: ViewInfo.h:50
static bool CompatibleToDouble(const wxString &stringToConvert, double *result)
Convert a string to a number.
Definition: Internat.cpp:122
bool HandleXMLAttribute(const wxChar *attr, const wxChar *value, const wxChar *legacyT0Name=sDefaultT0Name, const wxChar *legacyT1Name=sDefaultT1Name)
int vpos
Definition: ViewInfo.h:45
void ViewInfo::SetBeforeScreenWidth ( wxInt64  beforeWidth,
wxInt64  screenWidth,
double  lowerBoundTime = 0.0 
)

Definition at line 161 of file ViewInfo.cpp.

References ZoomInfo::h, min(), total, and ZoomInfo::zoom.

Referenced by AudacityProject::DoScroll(), and AttachableScrollBar::SetViewInfoFromScrollBar().

162 {
163  h =
164  std::max(lowerBoundTime,
165  std::min(total - screenWidth / zoom,
166  beforeWidth / zoom));
167 }
double h
Definition: ViewInfo.h:47
double zoom
Definition: ViewInfo.h:50
int min(int a, int b)
double total
Definition: ViewInfo.h:164
void ViewInfo::UpdatePrefs ( )

Definition at line 150 of file ViewInfo.cpp.

References bAdjustSelectionEdges, bScrollBeyondZero, gPrefs, TracksBehaviorsPrefs::ScrollingPreferenceDefault(), TracksBehaviorsPrefs::ScrollingPreferenceKey(), and ZoomInfo::UpdatePrefs().

Referenced by AudacityProject::HandleXMLTag(), TrackPanel::UpdatePrefs(), and ViewInfo().

151 {
153 #ifdef EXPERIMENTAL_SCROLLING_LIMITS
156 #endif
157  gPrefs->Read(wxT("/GUI/AdjustSelectionEdges"), &bAdjustSelectionEdges,
158  true);
159 }
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
static const wxChar * ScrollingPreferenceKey()
bool bAdjustSelectionEdges
Definition: ViewInfo.h:185
void UpdatePrefs()
Definition: ViewInfo.cpp:41
bool bScrollBeyondZero
Definition: ViewInfo.h:184
static bool ScrollingPreferenceDefault()
void ViewInfo::WriteXMLAttributes ( XMLWriter xmlFile) const

Definition at line 169 of file ViewInfo.cpp.

Referenced by AudacityProject::WriteXML().

171 {
172  selectedRegion.WriteXMLAttributes(xmlFile, wxT("sel0"), wxT("sel1"));
173  xmlFile.WriteAttr(wxT("vpos"), vpos);
174  xmlFile.WriteAttr(wxT("h"), h, 10);
175  xmlFile.WriteAttr(wxT("zoom"), zoom, 10);
176 }
SelectedRegion selectedRegion
Definition: ViewInfo.h:160
virtual void WriteAttr(const wxString &name, const wxString &value)
Definition: XMLWriter.cpp:131
double h
Definition: ViewInfo.h:47
double zoom
Definition: ViewInfo.h:50
int vpos
Definition: ViewInfo.h:45
void WriteXMLAttributes(XMLWriter &xmlFile, const wxChar *legacyT0Name=sDefaultT0Name, const wxChar *legacyT1Name=sDefaultT1Name) const

Member Data Documentation

bool ViewInfo::bAdjustSelectionEdges
bool ViewInfo::bScrollBeyondZero
bool ViewInfo::bUpdateTrackIndicator
double ViewInfo::mRecentStreamTime
wxInt64 ViewInfo::sbarH
double ViewInfo::sbarScale
wxInt64 ViewInfo::sbarScreen
wxInt64 ViewInfo::sbarTotal
int ViewInfo::scrollStep
SelectedRegion ViewInfo::selectedRegion

Definition at line 160 of file ViewInfo.h.

Referenced by SelectHandle::AdjustFreqSelection(), SetLabelCommand::Apply(), SelectTimeCommand::Apply(), ExportCommand::Apply(), AudacityProject::AS_ModifySelection(), SelectHandle::AssignSelection(), LabelTextHandle::Cancel(), SelectHandle::Cancel(), AdornedRulerPanel::QPHandle::Cancel(), LabelTrack::Char(), AudacityProject::Clear(), LabelTextHandle::Click(), CutlineHandle::Click(), LabelGlyphHandle::Click(), SelectHandle::Click(), TimeShiftHandle::Click(), AdornedRulerPanel::QPHandle::Click(), MenuCommandHandler::DialogForLabelName(), MenuCommandHandler::DoBoundaryMove(), LabelTrack::DoCaptureKey(), MenuCommandHandler::DoClipLeftOrRight(), MenuCommandHandler::DoCursorClipBoundary(), AdornedRulerPanel::DoDrawSelection(), MenuCommandHandler::DoPlayStopSelect(), MenuCommandHandler::DoSelectClip(), MenuCommandHandler::DoSelectClipBoundary(), TimeShiftHandle::DoSlideVertical(), LabelGlyphHandle::Drag(), SelectHandle::Drag(), TimeShiftHandle::Drag(), AdornedRulerPanel::DragSelection(), TrackPanel::DrawTracks(), LabelDialog::FindInitialRow(), AudacityProject::FixScrollbars(), FreqWindow::GetAudio(), AudacityProject::GetRegionsByLabel(), CompareAudioCommand::GetSelection(), MenuManager::GetUpdateFlags(), AudacityProject::GetZoomOfSelection(), MenuCommandHandler::HandleAlign(), MenuCommandHandler::HandlePasteNothingSelected(), MenuCommandHandler::HandlePasteText(), SelectHandle::HitTest(), AudacityProject::InitialState(), LabelTrack::KeyDown(), AudacityProject::ModifyState(), SelectHandle::MoveSnappingFreqSelection(), MenuCommandHandler::MoveWhenAudioInactive(), MenuCommandHandler::OnAddLabel(), EffectUIHost::OnApply(), LabelTrack::OnChar(), MenuCommandHandler::OnClipMove(), MenuCommandHandler::OnCopy(), MenuCommandHandler::OnCopyLabels(), MenuCommandHandler::OnCursorPositionStore(), MenuCommandHandler::OnCursorSelEnd(), MenuCommandHandler::OnCursorSelStart(), MenuCommandHandler::OnCursorTrackEnd(), MenuCommandHandler::OnCursorTrackStart(), MenuCommandHandler::OnCut(), MenuCommandHandler::OnCutLabels(), MenuCommandHandler::OnDeleteLabels(), MenuCommandHandler::OnDisjoin(), MenuCommandHandler::OnDisjoinLabels(), MenuCommandHandler::OnDuplicate(), MenuCommandHandler::OnExportSelection(), ContrastDialog::OnGetBackground(), ContrastDialog::OnGetForeground(), MenuCommandHandler::OnGoSelEnd(), MenuCommandHandler::OnGoSelStart(), MenuCommandHandler::OnJoin(), MenuCommandHandler::OnJoinLabels(), HighlightTextCtrl::OnMouseEvent(), TrackPanel::OnPaint(), AdornedRulerPanel::OnPaint(), MenuCommandHandler::OnPaste(), MenuCommandHandler::OnPasteNewLabel(), MenuCommandHandler::OnPasteOver(), EffectUIHost::OnPlay(), MenuCommandHandler::OnPlayAfterSelectionEnd(), MenuCommandHandler::OnPlayAfterSelectionStart(), EffectUIHost::OnPlayback(), MenuCommandHandler::OnPlayBeforeAndAfterSelectionEnd(), MenuCommandHandler::OnPlayBeforeAndAfterSelectionStart(), MenuCommandHandler::OnPlayBeforeSelectionEnd(), MenuCommandHandler::OnPlayBeforeSelectionStart(), MenuCommandHandler::OnPlayToSelection(), MenuCommandHandler::OnPunchAndRoll(), MenuCommandHandler::OnRedo(), LabelDialog::OnSelectCell(), MenuCommandHandler::OnSelectCursorEnd(), MenuCommandHandler::OnSelectCursorStoredCursor(), MenuCommandHandler::OnSelectionRestore(), MenuCommandHandler::OnSelectionSave(), MenuCommandHandler::OnSelectNone(), MenuCommandHandler::OnSelectSomething(), MenuCommandHandler::OnSelectStartCursor(), MenuCommandHandler::OnSelectTimeAndTracks(), MenuCommandHandler::OnSelectTrackStartToEnd(), MenuCommandHandler::OnSetLeftSelection(), MenuCommandHandler::OnSetRightSelection(), MenuCommandHandler::OnSilence(), MenuCommandHandler::OnSilenceLabels(), MenuCommandHandler::OnSplit(), MenuCommandHandler::OnSplitCut(), MenuCommandHandler::OnSplitCutLabels(), MenuCommandHandler::OnSplitDelete(), MenuCommandHandler::OnSplitDeleteLabels(), MenuCommandHandler::OnSplitNew(), MenuCommandHandler::OnStopSelect(), TrackPanel::OnTimer(), MenuCommandHandler::OnTrim(), MenuCommandHandler::OnUndo(), MenuCommandHandler::OnZeroCrossing(), MenuCommandHandler::OnZoomSel(), AudacityProject::PushState(), ReadXMLAttribute(), LabelGlyphHandle::Release(), AudacityProject::Rewind(), MenuCommandHandler::SeekWhenAudioInactive(), AudacityProject::SelectAllIfNone(), SelectionState::SelectTrackLength(), AudacityProject::SetSel0(), AudacityProject::SetSel1(), ContrastDialog::SetStartAndEndTime(), AudacityProject::SetStateTo(), AudacityProject::SkipEnd(), SelectHandle::SnapCenterOnce(), AudacityProject::SnapSelection(), AudacityProject::SSBL_ModifySpectralSelection(), SelectHandle::StartFreqSelection(), SelectHandle::StartSelection(), SelectHandle::StartSnappingFreqSelection(), AudacityProject::TP_DisplaySelection(), TrackPanel::UpdateViewIfNoTracks(), AudacityProject::Zoom(), and AudacityProject::ZoomInByFactor().

double ViewInfo::total

Definition at line 164 of file ViewInfo.h.

Referenced by AudacityProject::FixScrollbars(), and SetBeforeScreenWidth().


The documentation for this class was generated from the following files: