Audacity 3.2.0
Public Member Functions | Private Attributes | List of all members
anonymous_namespace{Printing.cpp}::AudacityPrintout Class Referencefinal
Inheritance diagram for anonymous_namespace{Printing.cpp}::AudacityPrintout:
[legend]
Collaboration diagram for anonymous_namespace{Printing.cpp}::AudacityPrintout:
[legend]

Public Member Functions

 AudacityPrintout (wxString title, TrackList *tracks, TrackPanel &panel)
 
bool OnPrintPage (int page)
 
bool HasPage (int page)
 
bool OnBeginDocument (int startPage, int endPage)
 
void GetPageInfo (int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
 

Private Attributes

TrackPanelmPanel
 
TrackListmTracks
 

Detailed Description

Definition at line 51 of file Printing.cpp.

Constructor & Destructor Documentation

◆ AudacityPrintout()

anonymous_namespace{Printing.cpp}::AudacityPrintout::AudacityPrintout ( wxString  title,
TrackList tracks,
TrackPanel panel 
)
inline

Definition at line 54 of file Printing.cpp.

55 :
56 wxPrintout(title),
57 mPanel(panel)
59 {
60 }
static const auto title
const auto tracks

Member Function Documentation

◆ GetPageInfo()

void AudacityPrintout::GetPageInfo ( int *  minPage,
int *  maxPage,
int *  selPageFrom,
int *  selPageTo 
)

Definition at line 159 of file Printing.cpp.

161{
162 *minPage = 1;
163 *maxPage = 1;
164 *selPageFrom = 1;
165 *selPageTo = 1;
166}

◆ HasPage()

bool AudacityPrintout::HasPage ( int  page)

Definition at line 149 of file Printing.cpp.

150{
151 return (page==1);
152}

◆ OnBeginDocument()

bool AudacityPrintout::OnBeginDocument ( int  startPage,
int  endPage 
)

Definition at line 154 of file Printing.cpp.

155{
156 return wxPrintout::OnBeginDocument(startPage, endPage);
157}

◆ OnPrintPage()

bool AudacityPrintout::OnPrintPage ( int  page)

Definition at line 72 of file Printing.cpp.

73{
74 wxDC *dc = GetDC();
75 if (!dc)
76 return false;
77
78 int width, height;
79 dc->GetSize(&width, &height);
80
81 int rulerScreenHeight = 40;
82 int screenTotalHeight =
83 ChannelView::GetTotalHeight(*mTracks) + rulerScreenHeight;
84
85 double scale = height / (double)screenTotalHeight;
86
87 int rulerPageHeight = (int)(rulerScreenHeight * scale);
89 ruler.SetBounds(0, 0, width, rulerPageHeight);
90 ruler.SetOrientation(wxHORIZONTAL);
92 ruler.SetLabelEdges(true);
93 ruler.Draw(*dc);
94
95 TrackArtist artist( &mPanel );
96 artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
97 *wxWHITE_PEN, *wxWHITE_PEN);
98 const double screenDuration = mTracks->GetEndTime();
99 SelectedRegion region{};
100 artist.pSelectedRegion = &region;
101 ZoomInfo zoomInfo(0.0, width / screenDuration);
102 artist.pZoomInfo = &zoomInfo;
103 int y = rulerPageHeight;
104
105 for (auto l : *mTracks) {
106 for (auto n : l->Channels()) {
107 auto &view = ChannelView::Get(*n);
108 wxRect r;
109 r.x = 0;
110 r.y = 0;
111 r.width = width;
112 // Note that the views as printed might not have the same proportional
113 // heights as displayed on the screen, because the fixed-sized separators
114 // are counted in those heights but not printed
115 auto trackHeight = (int)(view.GetHeight() * scale);
116 r.height = trackHeight;
117
118 const auto subViews = view.GetSubViews( r );
119 if (subViews.empty())
120 continue;
121
122 auto iter = subViews.begin(), end = subViews.end(), next = iter;
123 auto yy = iter->first;
124 for ( ; iter != end; iter = next ) {
125 ++next;
126 auto nextY = ( next == end )
127 ? trackHeight
128 : next->first;
129 r.y = y + yy;
130 r.SetHeight( nextY - yy );
131 yy = nextY;
132
134 *dc, {}, {}, &artist
135 };
136 iter->second->Draw( context, r, TrackArtist::PassTracks );
137 }
138
139 dc->SetPen(*wxBLACK_PEN);
140 AColor::Line(*dc, 0, y, width, y);
141
142 y += trackHeight;
143 }
144 };
145
146 return true;
147}
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:187
static int GetTotalHeight(const TrackList &list)
Definition: ChannelView.cpp:55
static ChannelView & Get(Channel &channel)
static const LinearUpdater & Instance()
Used to display a Ruler.
Definition: Ruler.h:34
void SetOrientation(int orient)
Definition: Ruler.cpp:141
void Draw(wxDC &dc) const
Definition: Ruler.cpp:441
void SetLabelEdges(bool labelEdges)
Definition: Ruler.cpp:179
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:304
void SetRange(double min, double max)
Definition: Ruler.cpp:152
Defines a selected portion of a project.
static const TimeFormat & Instance()
Definition: TimeFormat.cpp:15
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Definition: TrackArtist.h:39
double GetEndTime() const
Return the greatest end time of the tracks, or 0 when no tracks.
Definition: Track.cpp:991
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Definition: PackedArray.h:159

References Ruler::Draw(), PackedArray::end(), ChannelView::Get(), ChannelView::GetTotalHeight(), LinearUpdater::Instance(), TimeFormat::Instance(), AColor::Line(), TrackArtist::PassTracks, TrackArtist::pSelectedRegion, TrackArtist::pZoomInfo, anonymous_namespace{TimeTrackVRulerControls.cpp}::ruler(), TrackArtist::SetBackgroundBrushes(), Ruler::SetBounds(), Ruler::SetLabelEdges(), Ruler::SetOrientation(), and Ruler::SetRange().

Here is the call graph for this function:

Member Data Documentation

◆ mPanel

TrackPanel& anonymous_namespace{Printing.cpp}::AudacityPrintout::mPanel
private

Definition at line 68 of file Printing.cpp.

◆ mTracks

TrackList* anonymous_namespace{Printing.cpp}::AudacityPrintout::mTracks
private

Definition at line 69 of file Printing.cpp.


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