mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
void Print(Report& r, PrinterJob& pd, bool center) variant
git-svn-id: svn://ultimatepp.org/upp/trunk@686 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1c89d5e633
commit
b408880937
3 changed files with 24 additions and 12 deletions
|
|
@ -136,6 +136,7 @@ public:
|
|||
};
|
||||
|
||||
String Pdf(Report& report);
|
||||
void Print(Report& r, PrinterJob& pd, bool center = true);
|
||||
bool DefaultPrint(Report& r, int i, const char *_name = t_("Report"));
|
||||
bool Print(Report& r, int i, const char *name = t_("Report"));
|
||||
bool Perform(Report& r, const char *name = t_("Report"));
|
||||
|
|
|
|||
|
|
@ -8,3 +8,4 @@ LAYOUT(ReportWindowLayout, 340, 276)
|
|||
ITEM(Button, pdf, SetLabel(t_("PDF export..")).RightPosZ(8, 88).TopPosZ(168, 24))
|
||||
ITEM(Button, cancel, SetLabel(t_("Cancel")).RightPosZ(8, 88).BottomPosZ(4, 24))
|
||||
END_LAYOUT
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,27 @@ NAMESPACE_UPP
|
|||
|
||||
#define LLOG(x) // LOG(x)
|
||||
|
||||
void Print(Report& r, PrinterJob& pd, bool center)
|
||||
{
|
||||
Draw& w = pd;
|
||||
Size sz = w.GetPageMMs();
|
||||
Point mg = r.GetMargins();
|
||||
Size pgsz = r.GetPage(0).GetSize();
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
if(center) {
|
||||
x = Nvl(mg.x, (6000 * sz.cx / 254 - pgsz.cx) / 2);
|
||||
y = Nvl(mg.y, (6000 * sz.cy / 254 - pgsz.cy) / 2);
|
||||
}
|
||||
for(int i = 0; i < pd.GetPageCount(); i++) {
|
||||
Drawing iw = r.GetPage(pd[i]);
|
||||
Size sz = iw.GetSize();
|
||||
w.StartPage();
|
||||
w.DrawDrawing(x, y, sz.cx, sz.cy, iw);
|
||||
w.EndPage();
|
||||
}
|
||||
}
|
||||
|
||||
bool Print0(Report& r, int i, const char *_name, bool dodlg) {
|
||||
PrinterJob pd(_name);
|
||||
pd.CurrentPage(i);
|
||||
|
|
@ -12,18 +33,7 @@ bool Print0(Report& r, int i, const char *_name, bool dodlg) {
|
|||
pd.Landscape(pgsz.cx > pgsz.cy);
|
||||
if(dodlg && !pd.Execute())
|
||||
return false;
|
||||
Draw& w = pd;
|
||||
Size sz = w.GetPageMMs();
|
||||
Point mg = r.GetMargins();
|
||||
int x = Nvl(mg.x, (6000 * sz.cx / 254 - pgsz.cx) / 2);
|
||||
int y = Nvl(mg.y, (6000 * sz.cy / 254 - pgsz.cy) / 2);
|
||||
for(int i = 0; i < pd.GetPageCount(); i++) {
|
||||
Drawing iw = r.GetPage(pd[i]);
|
||||
Size sz = iw.GetSize();
|
||||
w.StartPage();
|
||||
w.DrawDrawing(x, y, sz.cx, sz.cy, iw);
|
||||
w.EndPage();
|
||||
}
|
||||
Print(r, pd);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue