On my tests with the new printing capabilities I'm getting trouble with printing from Fl_Help_View.

It stop working after the message "end_page error -1" on XPS printer, with Fl_PSfile_Device it seems to work but generates an invalid postscript file.

Obs: I'm using my version of Fl_Help_View, but probably it should happen with the original one too.

Any comment/suggestion/help are welcome !
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
# data file for the Fltk User Interface Designer (fluid)
version 1.0300 
header_name {.h} 
code_name {.cxx}
decl {\#include <FL/Fl_Double_Window.H>} {public global
} 

decl {\#include <FL/Fl_Input.H>} {public global
} 

decl {\#include <FL/Fl_Help_View.H>} {public global
} 

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

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

decl {\#include <vector>} {public global
} 

decl {\#include <string>} {public global
} 

decl {\#include <sstream>} {public global
} 

decl {template<typename T>
void show_create(T*& aptr) {
  if (!aptr) aptr = new T();
  aptr->show();
}} {
  comment {This template checks if the pointer is already assigned,
if not it creates a new object.} public global
} 

Function {validate_product_id(Fl_Input *o, void *v)} {return_type void
} {
  code {//printf("Hello, World!\\n");} {}
} 

class DAD_Base_Window {
  comment {This is the base class for all application windows and is used to 
hold common code/functionality.} open : {public Fl_Double_Window}
} {
  decl {DAD_Base_Window *callee;} {protected local
  }
  Function {DAD_Base_Window(int X, int Y, int W, int H, const char *L) : 
Fl_Double_Window(X, Y, W, H, L)} {open
  } {
    code {callee = NULL;} {}
  }
  Function {DAD_Base_Window(int W, int H, const char *L):Fl_Double_Window(0, 0, 
W, H, L)} {open
  } {
    code {//printf("Hello, World!\\n");} {}
  }
  Function {make_window_when_null(DAD_Base_Window &aref)} {open return_type 
{static DAD_Base_Window*}
  } {
    code {//if (!aref) aref = 
return &aref;} {}
  }
} 

widget_class DAD_Invoice_Print {
  label {Invoice Print}
  xywh {82 59 658 692} type Double color 7 hide resizable
  class Fl_Double_Window
} {
  Fl_Scroll pi_scroll {open
    xywh {4 2 650 688} color 7
  } {
    Fl_Group pageA4 {open
      xywh {20 10 628 685} color 7
    } {
      Fl_Box logo {
        label FLTK
        image {../help/logotipo-santiagopidal-s.bmp} xywh {28 20 200 41} 
labeltype SHADOW_LABEL labelfont 3 labelsize 47 align 148
      }
      Fl_Box companyBox {
        label {FLTK (pronounced "fulltick") is a cross-platform C++ GUI toolkit 
for UNIX®/Linux® (X11), Microsoft® Windows®, and MacOS® X. FLTK provides 
modern GUI functionality without the bloat and supports 3D graphics via 
OpenGL® and its built-in GLUT emulation.}
        xywh {28 66 308 80} labelfont 2 labelsize 12 align 144
      }
      Fl_Group invoiceNumber {open
        xywh {347 20 286 40} box BORDER_FRAME color 31
      } {
        Fl_Box box_header_number_date {
          xywh {348 21 284 18} box FLAT_BOX color 47 labeltype NO_LABEL
        }
        Fl_Box hline_header_number_date {
          xywh {347 39 286 1} box BORDER_FRAME color 31 labeltype NO_LABEL 
labelsize 18
        }
        Fl_Box vline_header_number_date {
          xywh {492 20 1 40} box BORDER_FRAME color 39 labeltype NO_LABEL
        }
        Fl_Box header_date_box {
          label DATE
          xywh {492 20 139 20} labelfont 1 labelsize 12
        }
      }
      Fl_Box box_to {
        xywh {347 65 286 85} box BORDER_FRAME color 31 labelfont 1 labelsize 16 
align 21
      }
      Fl_Box box_header {
        xywh {28 160 606 20} box BORDER_FRAME color 31
      }
      Fl_Box box_header_fill {
        xywh {29 161 604 18} box FLAT_BOX color 47 labeltype NO_LABEL labelsize 
18
      }
      Fl_Box header_code_box {
        label CODE
        xywh {29 161 54 18} color 47 labelfont 1 labelsize 10
      }
      Fl_Box header_description_box {
        label DESCRIPTION
        xywh {82 161 338 18} color 47 labelfont 1 labelsize 10
      }
      Fl_Box header_quantity_box {
        label {QTY.}
        xywh {421 161 41 18} color 47 labelfont 1 labelsize 10
      }
      Fl_Box header_price_box {
        label PRICE
        xywh {461 161 64 18} color 47 labelfont 1 labelsize 10
      }
      Fl_Box header_discount_box {
        label {DISC.}
        xywh {525 161 40 18} color 47 labelfont 1 labelsize 10
      }
      Fl_Box header_subtotal_box {
        label SUBTOTAL
        xywh {567 161 66 18} color 47 labelfont 1 labelsize 10
      }
      Fl_Box box_totals {
        xywh {28 615 606 30} box BORDER_FRAME color 31
      }
      Fl_Box notes_box {
        label {FLTK is provided under the terms of the GNU Library Public 
License, Version 2 with exceptions that allow for static linking.}
        xywh {28 648 606 37} labelfont 2 labelsize 12 align 149
      }
      Fl_Box box_header_totals {
        xywh {28 596 606 20} box BORDER_FRAME color 31
      }
      Fl_Box box_header_totals_fill {
        xywh {29 597 604 18} box FLAT_BOX color 47
      }
      Fl_Box vline_totals_1 {
        xywh {92 596 1 49} box BORDER_FRAME color 31 labeltype NO_LABEL
      }
      Fl_Box {} {
        xywh {217 596 1 49} box BORDER_FRAME color 31 labeltype NO_LABEL
      }
      Fl_Box {} {
        xywh {349 596 1 49} box BORDER_FRAME color 31 labeltype NO_LABEL
      }
      Fl_Box {} {
        xywh {488 596 1 49} box BORDER_FRAME color 31 labeltype NO_LABEL
      }
      Fl_Box header_totals_page_box {
        label PAGE
        xywh {29 597 63 18} color 47 labelfont 1 labelsize 12
      }
      Fl_Box header_totals_subtotal_box {
        label SUBTOTAL
        xywh {93 597 124 18} color 47 labelfont 1 labelsize 12
      }
      Fl_Box header_totals_vat_percent_box {
        label {V.A.T. %}
        xywh {218 597 131 18} color 47 labelfont 1 labelsize 12
      }
      Fl_Box header_totals_vat_amount_box {
        label {TOTAL V.A.T.}
        xywh {351 597 137 18} color 47 labelfont 1 labelsize 12
      }
      Fl_Box header_totals_total_box {
        label TOTAL
        xywh {489 597 144 18} color 47 labelfont 1 labelsize 12
      }
      Fl_Box invoice_lines_box {
        image {/home/mingo/dadbiz-1.8/dadbiz/help/alfarero2.bmp} xywh {28 179 
606 406} box BORDER_FRAME color 31
      }
      Fl_Box vline_lines_1 {
        xywh {82 160 1 425} box BORDER_FRAME color 31
      }
      Fl_Box {} {
        xywh {420 160 1 425} box BORDER_FRAME color 31
      }
      Fl_Box {} {
        xywh {461 160 1 425} box BORDER_FRAME color 31
      }
      Fl_Box {} {
        xywh {524 160 1 425} box BORDER_FRAME color 31
      }
      Fl_Box {} {
        xywh {566 160 1 425} box BORDER_FRAME color 31
      }
      Fl_Group printDataGroup {open
        xywh {20 10 628 637}
      } {
        Fl_Box invoiceTypeBox {
          label {Invoice Nº}
          xywh {350 20 139 20} labelfont 1 labelsize 12
        }
        Fl_Box numberBox {
          label {2010/4687}
          xywh {350 40 139 20} labelfont 5 labelsize 15 align 16
        }
        Fl_Box dateBox {
          label {01/03/2010}
          xywh {496 40 133 20} labelfont 5 labelsize 15 align 16
        }
        Fl_Box clientBox {
          label {Domingo Alvarez Duarte
50.566.789-L
c/ Felicidad, 34 4ºB
29999 - Málaga
Málaga - Spain}
          xywh {349 66 277 82} labelsize 12 align 84
        }
        Fl_Group dataLinesGroup {open
          xywh {28 179 605 407} align 16
        } {
          Fl_Box codeBox {
            label {123
345
567
675
567
}
            xywh {29 180 52 404} labelsize 11 align 25
          }
          Fl_Box descriptionBox {
            label {Ceramica
Barro
Card
France
Debit
AZULEJOS BLANCOS 15X15/45 PRODESCO
ESMALTE  DE ALTA TEMPERATURA ANARANJADO 0-6002}
            xywh {86 180 332 404} labelsize 11 align 85
          }
          Fl_Box quantityBox {
            label {123
345
567
675
567
}
            xywh {422 180 38 404} labelsize 11 align 25
          }
          Fl_Box priceBox {
            label {12.456,88
345
567
675
567
}
            xywh {463 180 61 404} labelsize 11 align 25
          }
          Fl_Box discountBox {
            label {123
345
567
675
567
}
            xywh {526 180 39 404} labelsize 11 align 25
          }
          Fl_Box lineTotalBox {
            label {23.456,90
345
567
675
567
}
            xywh {568 180 63 404} labelsize 11 align 25
          }
        }
        Fl_Group {} {open
          xywh {28 595 609 52}
        } {
          Fl_Box invoicePageBox {
            label {1/1}
            xywh {28 618 65 25} labelfont 5 labelsize 15
          }
          Fl_Box fisrtTotalBox {
            label {12.345,78}
            xywh {95 618 120 25} labelfont 5 labelsize 15
          }
          Fl_Box vatPercentageBox {
            label 16
            xywh {223 618 125 25} labelfont 5 labelsize 15
          }
          Fl_Box vatAmountBox {
            label {12.345,78}
            xywh {350 618 138 25} labelfont 5 labelsize 15
          }
          Fl_Box totalBox {
            label {12.345,78}
            xywh {488 618 144 25} labelfont 5 labelsize 15
          }
        }
      }
    }
  }
} 

widget_class DAD_Address_Book_Html {
  label {Address Book Html} open
  xywh {122 83 800 560} type Double color 7 hide resizable
  class Fl_Double_Window
} {
  decl {Fl_Text_Buffer   textbuf;} {protected local
  }
  Fl_Tabs tabs {open
    xywh {0 0 800 560} resizable
  } {
    Fl_Group tabView {
      label View open
      xywh {0 33 800 527} color 7 labelsize 20 hide
    } {
      Fl_Help_View htmlView {
        xywh {0 33 800 527} labelsize 18
        code0 {o->load("test.html");}
      }
    }
    Fl_Group tabEdit {
      label {Edit/Print} open
      xywh {0 37 800 523} labelsize 20
    } {
      Fl_Text_Editor editor {
        xywh {0 87 800 473} labelsize 18 textsize 18
        code0 {o->buffer(&textbuf);}
        code1 {o->buffer()->text(htmlView->value());}
      }
      Fl_Button btnShow {
        label Show
        callback {htmlView->value(textbuf.text());
tabView->show();}
        xywh {10 45 82 25} labelsize 18
      }
      Fl_Button btnShowPrint {
        label Print
        callback {print_html();}
        xywh {105 45 82 25} labelsize 18
      }
    }
  }
  Function {print_html()} {open return_type void
  } {
    code {htmlView->value(textbuf.text());
tabView->show();
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 (htmlView->w() > w || htmlView->h() > h) {
  scale = (float)w/htmlView->w();
  scale_tmp = (float)h / htmlView->h();
  if ( scale_tmp < scale) scale = scale_tmp;
  printer.scale(scale, scale);
} else if (htmlView->w() < w || htmlView->h() < h) {
  scale = (float)w/htmlView->w();
  scale_tmp = (float)h / htmlView->h();
  if ( scale_tmp < scale) scale = scale_tmp;
  printer.scale(scale, scale);
}
printer.print_widget(htmlView);
printer.end_page();
printer.end_job();} {selected
    }
  }
} 

widget_class Address_Book_Line {open
  xywh {169 189 380 12} type Double hide
  class Fl_Group
} {
  Function {Address_Book_Line() : Fl_Group(0,0,380,12,0)} {open return_type void
  } {
    code {//printf("Hello, World!\\n");} {}
  }
  Fl_Box line_id_box {
    label ID
    xywh {2 1 29 10} labelsize 8 align 88
  }
  Fl_Box line_name_box {
    label Name
    xywh {62 1 180 10} labelsize 8 align 84
  }
  Fl_Box line_contact_box {
    label Contact
    xywh {254 1 60 10} labelsize 8 align 84
  }
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to