All pastes #74 Raw Edit

slePP

public text v1 · immutable
#74 ·published 2004-04-03 12:53 UTC
rendered paste body
	/* Scale it into inches */
	int ppiPrinterX, ppiPrinterY;
    GetPPIPrinter(&ppiPrinterX, &ppiPrinterY);

    int pageWidth, pageHeight;
    GetPageSizePixels(&pageWidth, &pageHeight);

    int w, h;
    dc->GetSize(&w, &h);

	float scaleX = ((1.0/25.4) * (float)ppiPrinterX) * ((float)w/(float)pageWidth);
	float scaleY = ((1.0/25.4) * (float)ppiPrinterY) * ((float)h/(float)pageWidth);
	float scale = wxMin(scaleX, scaleY);
	
	wxLogMessage("Printer: %dx%d, Page: %dx%d, Size: %dx%d, Scale: %fx%f", ppiPrinterX, ppiPrinterY, pageWidth, pageHeight, w, h, scaleX, scaleY);
    dc->SetUserScale(scale, scale);	
	
	wxString title = _("History Print for ");
	title << name;
	
	wxFont fnt;
	fnt = config->Read("Printing/HeadingFont", "Bitstream Charter 12");
	dc->SetFont(fnt);
	dc->GetTextExtent(title, &w, &h);
	dc->DrawText(title, 20, 20);
	
	fnt = config->Read("Printing/BodyFont", "Serif Bold 12");
	dc->SetFont(fnt);
	dc->DrawText(_("And just a test."), 20, 40);
	dc->DrawText(_("And just a test."), 40, 50);
	dc->DrawText(_("And just a test."), 50, 60);
	dc->DrawText(_("And just a test."), 50, 70);
	
	dc->DrawLine(10,10,10,20);
	dc->DrawLine(10,20,20,20);
	dc->DrawLine(20,20,20,10);
	dc->DrawLine(20,10,10,10);