Audacity  2.2.2
AttachableScrollBar.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  AttachableScrollBar.cpp
6 
7  James Crook
8 
9  Audacity is free software.
10  This file is licensed under the wxWidgets license, see License.txt
11 
12 *****************************************************************//*******************************************************************/
29 
30 #include "../Audacity.h"
31 #include "AttachableScrollBar.h"
32 
33 #include <wx/wxprec.h>
34 #include "../ViewInfo.h"
35 
36 
37 BEGIN_EVENT_TABLE(AttachableScrollBar, wxScrollBar)
38  EVT_SCROLL(AttachableScrollBar::OnScroll)
40 
42  wxWindow* parent,
43  wxWindowID id,
44  const wxPoint& pos,
45  const wxSize& size,
46  long style) :
47  wxScrollBar( parent, id, pos, size, style )
48 {
49  mpViewInfo = NULL;
50 }
51 
53 {
54 }
55 
56 // Essentially a float to int conversion.
58 {
59  // FIXME: PRL Aug 2015: Screen Width in Viewinfo Not needed?
60 #if 0
61  ViewInfo & mViewInfo = *mpViewInfo;
62 
63  mViewInfo.sbarTotal = (int) (mViewInfo.GetTotalWidth());
64  mViewInfo.sbarScreen = (int) (mViewInfo.GetScreenWidth());
65  mViewInfo.sbarH = (int) (mViewInfo.GetBeforeScreenWidth());
66 
67  SetScrollbar(mViewInfo.sbarH, mViewInfo.sbarScreen,
68  mViewInfo.sbarTotal, mViewInfo.sbarScreen, TRUE);
69 #endif
70 }
71 
72 // Essentially an int to float conversion.
74 {
75  // FIXME: PRL Aug 2015: Screen Width in Viewinfo Not needed?
76 #if 0
77  ViewInfo & mViewInfo = *mpViewInfo;
78 
79  int hlast = mViewInfo.sbarH;
80 
81  mViewInfo.sbarH = GetThumbPosition();
82 
83  if (mViewInfo.sbarH != hlast)
84  mViewInfo.SetBeforeScreenWidth(mViewInfo.sbarH);
85 #endif
86 }
87 
88 // Used to associated a ViewInfo structure with a scrollbar.
90 {
91  mpViewInfo = view;
93 }
94 
95 void AttachableScrollBar::OnScroll(wxScrollEvent & event)
96 {
97  if( mpViewInfo == NULL )
98  {
99  event.Skip();
100  return;
101  }
103  event.Skip(); // This is so that the parent control can refresh whatever it needs to...
104 }
void SetBeforeScreenWidth(wxInt64 beforeWidth, wxInt64 screenWidth, double lowerBoundTime=0.0)
Definition: ViewInfo.cpp:161
An AttachableScrollBar is a scroll bar that can be attached to multiple items and so control their sc...
ViewInfo is used mainly to hold the zooming, selection and scroll information. It also has some statu...
Definition: ViewInfo.h:141
wxInt64 sbarH
Definition: ViewInfo.h:166
double GetBeforeScreenWidth() const
Definition: ViewInfo.h:149
wxInt64 sbarTotal
Definition: ViewInfo.h:168
double GetTotalWidth() const
Definition: ViewInfo.h:155
wxInt64 sbarScreen
Definition: ViewInfo.h:167
void OnScroll(wxScrollEvent &event)
void SetViewInfo(ViewInfo *view)
END_EVENT_TABLE()