This simple program crashes when trying print Fl_Help_View, with Fl_PSfile_Device it don't crash but generates an invalid postscript file.
# data file for the Fltk User Interface Designer (fluid)
version 1.0300 
header_name {.h} 
code_name {.cxx}
decl {\#include <FL/Fl_Help_View.H>} {public global
} 

decl {\#include <Fl/Fl_Printer.H>} {public global
} 

Function {print_html()} {open return_type void
} {
  code {Fl_Printer printer;
//Fl_PSfile_Device printer;
int w, h;
float scale_tmp, scale;
printer.start_job(1);
w = h = 0;
printer.printable_rect(&w,&h);
// scale the printer device so that the window fits on the page
scale = 1;
if (view_html->w() > w || view_html->h() > h) {
  scale = (float)w/view_html->w();
  scale_tmp = (float)h / view_html->h();
  if ( scale_tmp < scale) scale = scale_tmp;
  printer.scale(scale, scale);
} else if (view_html->w() < w || view_html->h() < h) {
  scale = (float)w/view_html->w();
  scale_tmp = (float)h / view_html->h();
  if ( scale_tmp < scale) scale = scale_tmp;
  printer.scale(scale, scale);
}
printer.print_widget(view_html);
printer.end_page();
printer.end_job();} {}
} 

Function {} {open
} {
  Fl_Window {} {open
    xywh {35 131 800 500} type Double visible
  } {
    Fl_Group view_html {open
      xywh {10 5 781 432} color 7 labelsize 18
      code0 {o->load("test.html");}
      class Fl_Help_View
    } {}
    Fl_Button btnPrint {
      label Print
      callback {print_html();} selected
      xywh {350 460 82 25} labelsize 18
    }
  }
} 
Fecha Cantidad Total
2008-03 41 1.094,50
2008-03 2 4.672,19
2008-02 126 9.832,62
2008-02 4 453,86
2008-01 143 12.365,37
2008-01 2 117,57
2007-12 105 11.799,79
2007-12 2 100,53
2007-11 168 19.328,28
2007-11 5 1.262,34
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to