Author: manolo
Date: 2011-04-05 09:20:02 -0700 (Tue, 05 Apr 2011)
New Revision: 8560
Log:
Mac OS: the "Print Front Window" item of the application menu now prints also 
the title bar.

Modified:
   branches/branch-1.3/src/Fl_cocoa.mm

Modified: branches/branch-1.3/src/Fl_cocoa.mm
===================================================================
--- branches/branch-1.3/src/Fl_cocoa.mm 2011-04-05 12:41:32 UTC (rev 8559)
+++ branches/branch-1.3/src/Fl_cocoa.mm 2011-04-05 16:20:02 UTC (rev 8560)
@@ -2818,7 +2818,7 @@
 {
   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 @@
   // 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 @@
   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();

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to