Mac OS: the "Print Front Window" item of the application menu now prints also the title bar.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8560 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2011-04-05 16:20:02 +00:00
parent b5ab77d07d
commit b197f40781

View File

@ -2818,7 +2818,7 @@ int Fl_X::screen_init(XRectangle screens[], float dpi[])
{
Fl_Printer printer;
//Fl_PostScript_File_Device printer;
int w, h;
int w, h, wh;
Fl_Window *win = Fl::first_window();
if(!win) return;
if( printer.start_job(1) ) return;
@ -2826,9 +2826,15 @@ int Fl_X::screen_init(XRectangle screens[], float dpi[])
// scale the printer device so that the window fits on the page
float scale = 1;
printer.printable_rect(&w, &h);
if (win->w()>w || win->h()>h) {
wh = win->h();
int bx, by, bt = 0;
if (win->border()) {
get_window_frame_sizes(bx, by, bt);
wh += bt;
}
if (win->w()>w || wh>h) {
scale = (float)w/win->w();
if ((float)h/win->h() < scale) scale = (float)h/win->h();
if ((float)h/wh < scale) scale = (float)h/wh;
printer.scale(scale);
}
//#define ROTATE 1
@ -2839,8 +2845,8 @@ int Fl_X::screen_init(XRectangle screens[], float dpi[])
printer.rotate(20.);
printer.print_widget( win, - win->w()/2, - win->h()/2 );
#else
printer.print_widget( win);
//printer.print_window_part( win, 0,0, win->w(), win->h() );
if (bt) printer.print_window_part(win, 0, -bt, win->w(), bt, 0, 1);
printer.print_widget(win, 0, bt);
#endif
printer.end_page();
printer.end_job();