20#include <wx/printdlg.h>
47 static wxPrintData theData;
61 bool OnPrintPage(
int page);
62 bool HasPage(
int page);
63 bool OnBeginDocument(
int startPage,
int endPage);
64 void GetPageInfo(
int *minPage,
int *maxPage,
65 int *selPageFrom,
int *selPageTo);
72bool AudacityPrintout::OnPrintPage(
int WXUNUSED(page))
79 dc->GetSize(&width, &height);
81 int rulerScreenHeight = 40;
82 int screenTotalHeight =
85 double scale = height / (double)screenTotalHeight;
87 int rulerPageHeight = (int)(rulerScreenHeight * scale);
97 *wxWHITE_PEN, *wxWHITE_PEN);
98 const double screenDuration = mTracks->GetEndTime();
101 ZoomInfo zoomInfo(0.0, width / screenDuration);
103 int y = rulerPageHeight;
105 for (
auto l : *mTracks) {
106 for (
auto n : l->Channels()) {
115 auto trackHeight = (int)(view.GetHeight() * scale);
116 r.height = trackHeight;
118 const auto subViews = view.GetSubViews( r );
119 if (subViews.empty())
122 auto iter = subViews.begin(),
end = subViews.end(), next = iter;
123 auto yy = iter->first;
124 for ( ; iter !=
end; iter = next ) {
126 auto nextY = ( next ==
end )
130 r.SetHeight( nextY - yy );
139 dc->SetPen(*wxBLACK_PEN);
149bool AudacityPrintout::HasPage(
int page)
154bool AudacityPrintout::OnBeginDocument(
int startPage,
int endPage)
156 return wxPrintout::OnBeginDocument(startPage, endPage);
159void AudacityPrintout::GetPageInfo(
int *minPage,
int *maxPage,
160 int *selPageFrom,
int *selPageTo)
170 wxPageSetupData pageSetupData;
172 wxPageSetupDialog pageSetupDialog(parent, &pageSetupData);
173 pageSetupDialog.ShowModal();
175 gPrintData() = pageSetupDialog.GetPageSetupData().GetPrintData();
182 wxPrintDialogData printDialogData(
gPrintData());
184 wxPrinter printer(&printDialogData);
186 if (!printer.Print(parent, &printout,
true)) {
187 if (wxPrinter::GetLastError() == wxPRINTER_ERROR) {
189 XO(
"There was a problem printing."),
198 gPrintData() = printer.GetPrintDialogData().GetPrintData();
221 static auto items = std::shared_ptr{
233 {
"File", { OrderingHint::Before,
"Exit" } }
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
const ReservedCommandFlag & AudioIONotBusyFlag()
const ReservedCommandFlag & TracksExistFlag()
const TranslatableString name
XXO("&Cut/Copy/Paste Toolbar")
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
accessors for certain important windows associated with each project
declares abstract base class Track, TrackList, and iterators over TrackList
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
static int GetTotalHeight(const TrackList &list)
static ChannelView & Get(Channel &channel)
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
static const LinearUpdater & Instance()
Generates classes whose instances register items at construction.
void SetOrientation(int orient)
void Draw(wxDC &dc) const
void SetLabelEdges(bool labelEdges)
void SetBounds(int left, int top, int right, int bottom)
void SetRange(double min, double max)
Defines a selected portion of a project.
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
void SetBackgroundBrushes(wxBrush unselectedBrushIn, wxBrush selectedBrushIn, wxPen unselectedPenIn, wxPen selectedPenIn)
const SelectedRegion * pSelectedRegion
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
static TrackList & Get(AudacityProject &project)
The TrackPanel class coordinates updates and operations on the main part of the screen which contains...
static TrackPanel & Get(AudacityProject &project)
AudacityPrintout(wxString title, TrackList *tracks, TrackPanel &panel)
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
wxPrintData & gPrintData()
void OnPrint(const CommandContext &context)
void OnPageSetup(const CommandContext &context)
void HandlePageSetup(wxWindow *parent)
void HandlePrint(wxWindow *parent, const wxString &name, TrackList *tracks, TrackPanel &panel)