Audacity  2.2.2
Public Member Functions | Private Attributes | List of all members
AudacityPrintout Class Referencefinal

Derived from wxPrintout, this class helps with printing. More...

Inheritance diagram for AudacityPrintout:

Public Member Functions

 AudacityPrintout (wxString title, TrackList *tracks)
 
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

TrackListmTracks
 

Detailed Description

Derived from wxPrintout, this class helps with printing.

Definition at line 45 of file Printing.cpp.

Constructor & Destructor Documentation

AudacityPrintout::AudacityPrintout ( wxString  title,
TrackList tracks 
)
inline

Definition at line 48 of file Printing.cpp.

49  :
50  wxPrintout(title),
51  mTracks(tracks)
52  {
53  }
TrackList * mTracks
Definition: Printing.cpp:61

Member Function Documentation

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

Definition at line 127 of file Printing.cpp.

129 {
130  *minPage = 1;
131  *maxPage = 1;
132  *selPageFrom = 1;
133  *selPageTo = 1;
134 }
bool AudacityPrintout::HasPage ( int  page)

Definition at line 117 of file Printing.cpp.

118 {
119  return (page==1);
120 }
bool AudacityPrintout::OnBeginDocument ( int  startPage,
int  endPage 
)

Definition at line 122 of file Printing.cpp.

123 {
124  return wxPrintout::OnBeginDocument(startPage, endPage);
125 }
bool AudacityPrintout::OnPrintPage ( int  page)

Definition at line 64 of file Printing.cpp.

References Ruler::Draw(), TrackArtist::DrawTrack(), TrackListIterator::First(), TrackList::GetEndTime(), Track::GetHeight(), TrackList::GetHeight(), AColor::Line(), mTracks, TrackListIterator::Next(), TrackArtist::SetBackgroundBrushes(), Ruler::SetBounds(), Ruler::SetFormat(), Ruler::SetLabelEdges(), Ruler::SetOrientation(), Ruler::SetRange(), and Ruler::TimeFormat.

65 {
66  wxDC *dc = GetDC();
67  if (!dc)
68  return false;
69 
70  int width, height;
71  dc->GetSize(&width, &height);
72 
73  int rulerScreenHeight = 40;
74  int screenTotalHeight = mTracks->GetHeight() + rulerScreenHeight;
75 
76  double scale = height / (double)screenTotalHeight;
77 
78  int rulerPageHeight = (int)(rulerScreenHeight * scale);
79  Ruler ruler;
80  ruler.SetBounds(0, 0, width, rulerPageHeight);
81  ruler.SetOrientation(wxHORIZONTAL);
82  ruler.SetRange(0.0, mTracks->GetEndTime());
84  ruler.SetLabelEdges(true);
85  ruler.Draw(*dc);
86 
87  TrackArtist artist;
88  artist.SetBackgroundBrushes(*wxWHITE_BRUSH, *wxWHITE_BRUSH,
89  *wxWHITE_PEN, *wxWHITE_PEN);
90  const double screenDuration = mTracks->GetEndTime();
91  ZoomInfo zoomInfo(0.0, width / screenDuration);
92  int y = rulerPageHeight;
93 
95  Track *n = iter.First();
96  while (n) {
97  wxRect r;
98  r.x = 0;
99  r.y = y;
100  r.width = width;
101  r.height = (int)(n->GetHeight() * scale);
102 
103  TrackPanelDrawingContext context{ *dc, {}, {} };
104  artist.DrawTrack(
105  context, n, r, SelectedRegion(), zoomInfo, false, false, false, false);
106 
107  dc->SetPen(*wxBLACK_PEN);
108  AColor::Line(*dc, 0, r.y, width, r.y);
109 
110  n = iter.Next();
111  y += r.height;
112  };
113 
114  return true;
115 }
void SetBackgroundBrushes(wxBrush unselectedBrush, wxBrush selectedBrush, wxPen unselectedPen, wxPen selectedPen)
Definition: TrackArtist.h:80
void Draw(wxDC &dc)
Definition: Ruler.cpp:1323
This class handles the actual rendering of WaveTracks (both waveforms and spectra), NoteTracks, LabelTracks and TimeTracks.
Definition: TrackArtist.h:50
int GetHeight() const
Definition: Track.cpp:1372
double GetEndTime() const
Definition: Track.cpp:1418
void SetBounds(int left, int top, int right, int bottom)
Definition: Ruler.cpp:358
TrackList * mTracks
Definition: Printing.cpp:61
void SetOrientation(int orient)
Definition: Ruler.cpp:222
void DrawTrack(TrackPanelDrawingContext &context, const Track *t, const wxRect &rect, const SelectedRegion &selectedRegion, const ZoomInfo &zoomInfo, bool drawEnvelope, bool bigPoints, bool drawSliders, bool hasSolo)
Defines a selected portion of a project.
void SetLabelEdges(bool labelEdges)
Definition: Ruler.cpp:274
Fundamental data object of Audacity, placed in the TrackPanel. Classes derived form it include the Wa...
Definition: Track.h:102
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: AColor.cpp:122
An iterator for a TrackList.
Definition: Track.h:402
void SetFormat(RulerFormat format)
Definition: Ruler.cpp:188
void SetRange(double min, double max)
Definition: Ruler.cpp:236
Used to display a Ruler.
Definition: Ruler.h:32
int GetHeight() const
Definition: Track.cpp:180

Member Data Documentation

TrackList* AudacityPrintout::mTracks
private

Definition at line 61 of file Printing.cpp.

Referenced by OnPrintPage().


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