Skip to content

Commit f5f3ff7

Browse files
committed
Make DC sample compatible with wxWidgets UTF-8 build
1 parent fa2beca commit f5f3ff7

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

samples/pdfdc/printing.cpp

+39-39
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ bool MyApp::OnInit(void)
188188
g_pageSetupData->SetMarginBottomRight(wxPoint(15, 15));
189189

190190
// Create the main frame window
191-
frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets Printing Demo"),
191+
frame = new MyFrame((wxFrame *) NULL, "wxWidgets Printing Demo",
192192
wxPoint(0, 0), wxSize(400, 400));
193193

194194
#if wxUSE_STATUSBAR
@@ -202,14 +202,14 @@ bool MyApp::OnInit(void)
202202
// Make a menubar
203203
wxMenu *file_menu = new wxMenu;
204204

205-
file_menu->Append(WXPRINT_PRINT, _T("&Print..."), _T("Print"));
206-
file_menu->Append(WXPRINT_PDF, _T("PDF..."), _T("PDF"));
207-
file_menu->Append(WXPRINT_PDF_TPL, _T("PDF Template..."), _T("PDF Template"));
208-
file_menu->Append(WXPRINT_PAGE_SETUP, _T("Page Set&up..."), _T("Page setup"));
205+
file_menu->Append(WXPRINT_PRINT, "&Print...", "Print");
206+
file_menu->Append(WXPRINT_PDF, "PDF...", "PDF");
207+
file_menu->Append(WXPRINT_PDF_TPL, "PDF Template...", "PDF Template");
208+
file_menu->Append(WXPRINT_PAGE_SETUP, "Page Set&up...", "Page setup");
209209
#ifdef __WXMAC__
210-
file_menu->Append(WXPRINT_PAGE_MARGINS, _T("Page Margins..."), _T("Page margins"));
210+
file_menu->Append(WXPRINT_PAGE_MARGINS, "Page Margins...", "Page margins");
211211
#endif
212-
file_menu->Append(WXPRINT_PREVIEW, _T("Print Pre&view"), _T("Preview"));
212+
file_menu->Append(WXPRINT_PREVIEW, "Print Pre&view", "Preview");
213213

214214
#if wxUSE_ACCEL
215215
// Accelerators
@@ -221,39 +221,39 @@ bool MyApp::OnInit(void)
221221

222222
#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
223223
file_menu->AppendSeparator();
224-
file_menu->Append(WXPRINT_PRINT_PS, _T("Print PostScript..."), _T("Print (PostScript)"));
225-
file_menu->Append(WXPRINT_PAGE_SETUP_PS, _T("Page Setup PostScript..."), _T("Page setup (PostScript)"));
226-
file_menu->Append(WXPRINT_PREVIEW_PS, _T("Print Preview PostScript"), _T("Preview (PostScript)"));
224+
file_menu->Append(WXPRINT_PRINT_PS, "Print PostScript...", "Print (PostScript)");
225+
file_menu->Append(WXPRINT_PAGE_SETUP_PS, "Page Setup PostScript...", "Page setup (PostScript)");
226+
file_menu->Append(WXPRINT_PREVIEW_PS, "Print Preview PostScript", "Preview (PostScript)");
227227
#endif
228228

229229
file_menu->AppendSeparator();
230-
file_menu->Append(WXPRINT_ANGLEUP, _T("Angle up\tAlt-U"), _T("Raise rotated text angle"));
231-
file_menu->Append(WXPRINT_ANGLEDOWN, _T("Angle down\tAlt-D"), _T("Lower rotated text angle"));
230+
file_menu->Append(WXPRINT_ANGLEUP, "Angle up\tAlt-U", "Raise rotated text angle");
231+
file_menu->Append(WXPRINT_ANGLEDOWN, "Angle down\tAlt-D", "Lower rotated text angle");
232232
file_menu->AppendSeparator();
233-
file_menu->Append(WXPRINT_QUIT, _T("E&xit"), _T("Exit program"));
233+
file_menu->Append(WXPRINT_QUIT, "E&xit", "Exit program");
234234

235235
wxMenu *printing_menu = new wxMenu;
236-
printing_menu->Append(WXPDFPRINT_PAGE_SETUP_ALL, _T("PDF Page Setup All..."), _T("PDF Page Setup (All)"));
237-
printing_menu->Append(WXPDFPRINT_PAGE_SETUP_MINIMAL, _T("PDF Page Setup Minimal..."), _T("PDF Page Setup (Minimal)"));
238-
printing_menu->Append(WXPDFPRINT_PRINT_DIALOG_ALL, _T("PDF Print Dialog All..."), _T("PDF Print Dialog (All)"));
239-
printing_menu->Append(WXPDFPRINT_PRINT_DIALOG_MINIMAL, _T("PDF Print Dialog Minimal..."), _T("PDF Print Dialog (Minimal)"));
236+
printing_menu->Append(WXPDFPRINT_PAGE_SETUP_ALL, "PDF Page Setup All...", "PDF Page Setup (All)");
237+
printing_menu->Append(WXPDFPRINT_PAGE_SETUP_MINIMAL, "PDF Page Setup Minimal...", "PDF Page Setup (Minimal)");
238+
printing_menu->Append(WXPDFPRINT_PRINT_DIALOG_ALL, "PDF Print Dialog All...", "PDF Print Dialog (All)");
239+
printing_menu->Append(WXPDFPRINT_PRINT_DIALOG_MINIMAL, "PDF Print Dialog Minimal...", "PDF Print Dialog (Minimal)");
240240
#if wxUSE_RICHTEXT
241-
printing_menu->Append(WXPDFPRINT_RICHTEXT_PRINT, _T("PDF RichText Print..."), _T("PDF RichText (Print)"));
242-
printing_menu->Append(WXPDFPRINT_RICHTEXT_PREVIEW, _T("PDF RichText Preview..."), _T("PDF RichText (Preview)"));
241+
printing_menu->Append(WXPDFPRINT_RICHTEXT_PRINT, "PDF RichText Print...", "PDF RichText (Print)");
242+
printing_menu->Append(WXPDFPRINT_RICHTEXT_PREVIEW, "PDF RichText Preview...", "PDF RichText (Preview)");
243243
#endif
244244
#if wxUSE_HTML
245-
printing_menu->Append(WXPDFPRINT_HTML_PRINT, _T("PDF Html Print..."), _T("PDF Html (Print)"));
246-
printing_menu->Append(WXPDFPRINT_HTML_PREVIEW, _T("PDF Html Preview..."), _T("PDF Html (Preview)"));
245+
printing_menu->Append(WXPDFPRINT_HTML_PRINT, "PDF Html Print...", "PDF Html (Print)");
246+
printing_menu->Append(WXPDFPRINT_HTML_PREVIEW, "PDF Html Preview...", "PDF Html (Preview)");
247247
#endif
248248

249249
wxMenu *help_menu = new wxMenu;
250-
help_menu->Append(WXPRINT_ABOUT, _T("&About"), _T("About this demo"));
250+
help_menu->Append(WXPRINT_ABOUT, "&About", "About this demo");
251251

252252
wxMenuBar *menu_bar = new wxMenuBar;
253253

254-
menu_bar->Append(file_menu, _T("&File"));
255-
menu_bar->Append(printing_menu, _T("wxPdf&Printing"));
256-
menu_bar->Append(help_menu, _T("&Help"));
254+
menu_bar->Append(file_menu, "&File");
255+
menu_bar->Append(printing_menu, "wxPdf&Printing");
256+
menu_bar->Append(help_menu, "&Help");
257257

258258
// Associate the menu bar with the frame
259259
frame->SetMenuBar(menu_bar);
@@ -273,7 +273,7 @@ bool MyApp::OnInit(void)
273273
frame->Show();
274274

275275
#if wxUSE_STATUSBAR
276-
frame->SetStatusText(_T("Printing demo"));
276+
frame->SetStatusText("Printing demo");
277277
#endif // wxUSE_STATUSBAR
278278

279279
SetTopWindow(frame);
@@ -367,13 +367,13 @@ void MyFrame::OnPrint(wxCommandEvent& WXUNUSED(event))
367367
wxPrintDialogData printDialogData(* g_printData);
368368

369369
wxPrinter printer(& printDialogData);
370-
MyPrintout printout(_T("My printout"));
370+
MyPrintout printout(wxS("My printout"));
371371
if (!printer.Print(this, &printout, true /*prompt*/))
372372
{
373373
if (wxPrinter::GetLastError() == wxPRINTER_ERROR)
374-
wxMessageBox(_T("There was a problem printing.\nPerhaps your current printer is not set correctly?"), _T("Printing"), wxOK);
374+
wxMessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wxOK);
375375
else
376-
wxMessageBox(_T("You canceled printing"), _T("Printing"), wxOK);
376+
wxMessageBox("You canceled printing", "Printing", wxOK);
377377
}
378378
else
379379
{
@@ -470,11 +470,11 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
470470
if (!preview->Ok())
471471
{
472472
delete preview;
473-
wxMessageBox(_T("There was a problem previewing.\nPerhaps your current printer is not set correctly?"), _T("Previewing"), wxOK);
473+
wxMessageBox("There was a problem previewing.\nPerhaps your current printer is not set correctly?", "Previewing", wxOK);
474474
return;
475475
}
476476

477-
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, _T("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
477+
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
478478
frame->Centre(wxBOTH);
479479
frame->Initialize();
480480
frame->Show();
@@ -495,7 +495,7 @@ void MyFrame::OnPageSetup(wxCommandEvent& WXUNUSED(event))
495495
void MyFrame::OnPrintPS(wxCommandEvent& WXUNUSED(event))
496496
{
497497
wxPostScriptPrinter printer(g_printData);
498-
MyPrintout printout(_T("My printout"));
498+
MyPrintout printout("My printout");
499499
printer.Print(this, &printout, true/*prompt*/);
500500

501501
(*g_printData) = printer.GetPrintData();
@@ -506,7 +506,7 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
506506
// Pass two printout objects: for preview, and possible printing.
507507
wxPrintDialogData printDialogData(* g_printData);
508508
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout, new MyPrintout, & printDialogData);
509-
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, _T("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
509+
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview", wxPoint(100, 100), wxSize(600, 650));
510510
frame->Centre(wxBOTH);
511511
frame->Initialize();
512512
frame->Show();
@@ -541,8 +541,8 @@ void MyFrame::OnPageMargins(wxCommandEvent& WXUNUSED(event))
541541

542542
void MyFrame::OnPrintAbout(wxCommandEvent& WXUNUSED(event))
543543
{
544-
(void)wxMessageBox(_T("wxWidgets printing demo\nAuthor: Julian Smart"),
545-
_T("About wxWidgets printing demo"), wxOK|wxCENTRE);
544+
(void)wxMessageBox("wxWidgets printing demo\nAuthor: Julian Smart",
545+
"About wxWidgets printing demo", wxOK|wxCENTRE);
546546
}
547547

548548
void MyFrame::OnAngleUp(wxCommandEvent& WXUNUSED(event))
@@ -726,7 +726,7 @@ void MyFrame::OnPdfPageSetupMinimal(wxCommandEvent& WXUNUSED(event) )
726726
dialogData->EnablePaper(true);
727727
dialogData->EnableOrientation(false);
728728

729-
wxPdfPageSetupDialog* dialog = new wxPdfPageSetupDialog(this, dialogData, _T("Minimal PDF Page Setup"));
729+
wxPdfPageSetupDialog* dialog = new wxPdfPageSetupDialog(this, dialogData, "Minimal PDF Page Setup");
730730
if( dialog->ShowModal() == wxID_OK )
731731
{
732732
// dialogData now has user choices
@@ -1476,7 +1476,7 @@ void MyPrintout::DrawPageTwo()
14761476
dc->SetBrush(*wxTRANSPARENT_BRUSH);
14771477

14781478
{ // GetTextExtent demo:
1479-
wxString words[7] = {_T("This "), _T("is "), _T("GetTextExtent "), _T("testing "), _T("string. "), _T("Enjoy "), _T("it!")};
1479+
wxString words[7] = {"This ", "is ", "GetTextExtent ", "testing ", "string. ", "Enjoy ", "it!"};
14801480
wxCoord w, h;
14811481
wxCoord x = 200, y= 250;
14821482
wxFont fnt(15, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
@@ -1498,7 +1498,7 @@ void MyPrintout::DrawPageTwo()
14981498

14991499
dc->SetFont(wxGetApp().m_testFont);
15001500

1501-
dc->DrawText(_T("Some test text"), 200, 300 );
1501+
dc->DrawText("Some test text", 200, 300 );
15021502

15031503
// TESTING
15041504

@@ -1521,7 +1521,7 @@ void MyPrintout::DrawPageTwo()
15211521
dc->DrawLine( (long)leftMarginLogical, (long)bottomMarginLogical,
15221522
(long)rightMarginLogical, (long)bottomMarginLogical);
15231523

1524-
WritePageHeader(this, dc, _T("A header"), logUnitsFactor);
1524+
WritePageHeader(this, dc, wxS("A header"), logUnitsFactor);
15251525
}
15261526

15271527
// Writes a header on a page. Margin units are in millimetres.

0 commit comments

Comments
 (0)