From e40a17842fc1d4ae27d2d68ef6c458e87d49e94d Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 29 Oct 2003 14:52:23 +0000 Subject: [PATCH] Patch level : 2.0 nopatch Files correlati : bagn003.msk Ricompilazione Demo : [ ] Commento : Migliorata gestione Stampante Generica solo testo git-svn-id: svn://10.65.10.50/trunk@11546 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/bagn003.h | 1 + include/bagn003.uml | 24 +++++++++++++++--------- include/form.cpp | 10 +++++++++- include/form.h | 5 +++++ include/printer.cpp | 31 ++++++++++++++++++++++++++----- include/printer.h | 11 ++++++++--- 6 files changed, 64 insertions(+), 18 deletions(-) diff --git a/include/bagn003.h b/include/bagn003.h index aee573d22..338a49380 100755 --- a/include/bagn003.h +++ b/include/bagn003.h @@ -5,3 +5,4 @@ #define F_COPIES 105 #define F_FROMPAGE 106 #define F_TOPAGE 107 +#define F_FORM 108 diff --git a/include/bagn003.uml b/include/bagn003.uml index 71e88234b..0fe39d54a 100755 --- a/include/bagn003.uml +++ b/include/bagn003.uml @@ -1,8 +1,8 @@ #include -PAGE "Stampa" -1 -1 66 10 +PAGE "Stampa" -1 -1 66 11 -GROUPBOX DLG_NULL 64 5 +GROUPBOX DLG_NULL 64 6 BEGIN PROMPT 1 0 "@bStampante" END @@ -13,45 +13,51 @@ BEGIN FLAGS "D" END +STRING F_FORM 80 50 +BEGIN + PROMPT 2 2 "Form " + FLAGS "D" +END + STRING F_FONT 80 32 BEGIN - PROMPT 2 2 "Font " + PROMPT 2 3 "Font " FLAGS "D" END NUMBER F_SIZE 4 BEGIN - PROMPT 48 2 "Carattere " + PROMPT 48 3 "Carattere " FLAGS "D" END BOOLEAN F_ISGRAPHICS BEGIN - PROMPT 2 3 "Stampa elementi grafici" + PROMPT 2 4 "Stampa elementi grafici" FLAGS "D" END GROUPBOX DLG_NULL 64 4 BEGIN - PROMPT 1 5 "@bSelezione" + PROMPT 1 6 "@bSelezione" END NUMBER F_FROMPAGE 4 BEGIN - PROMPT 2 6 "Da pagina " + PROMPT 2 7 "Da pagina " CHECKTYPE REQUIRED FLAGS "U" END NUMBER F_TOPAGE 4 BEGIN - PROMPT 2 7 "a pagina " + PROMPT 2 8 "a pagina " FLAGS "U" END NUMBER F_COPIES 3 BEGIN - PROMPT 43 6 "Numero di copie " + PROMPT 43 7 "Numero di copie " FLAGS "U" CHECKTYPE REQUIRED END diff --git a/include/form.cpp b/include/form.cpp index fceaa2b3d..ec15c6819 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -2436,6 +2436,12 @@ bool TPrint_section::update() if (!esito) ok = FALSE; } } + + if (ok && _sec_type == 'B' && _page_type == odd_page) + { + printer().set_form_name(_form->filename()); + } + return ok; } @@ -4527,7 +4533,9 @@ void TForm::read( // read base form TFilename n(_name); n.ext("frm"); n.custom_path(); - if (!n.exist()) + if (n.exist()) + _filename = n; + else fatal_box("Il form '%s' non esiste.",(const char*)n); TScanner scanner(n); diff --git a/include/form.h b/include/form.h index 0069d0e84..073b1139b 100755 --- a/include/form.h +++ b/include/form.h @@ -86,6 +86,8 @@ class TForm : public TObject // @cmember:(INTERNAL) Nome del profilo di stampa TString _name; + // @cmember:(INTERNAL) Nome fisico del file profilo di stampa + TFilename _filename; // @cmember:(INTERNAL) Codice del profilo di stampa TString _code; // @cmember:(INTERNAL) Nome del font da utilizzare @@ -300,6 +302,9 @@ public: // @cmember Ritorna il codice del profilo di stampa const TString& code() const { return _code; } + // @cmember Ritorna il nome fisico del file del profilo di stampa + const TFilename& filename() const + { return _filename; } // @cmember Ritorna se il form è un modulo a pagine fisse bool fixed_pages() const { return _npages>0; } diff --git a/include/printer.cpp b/include/printer.cpp index dc73276e4..59bdaa1d0 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -203,7 +203,7 @@ TPrinter_setup_mask::TPrinter_setup_mask() set(MSK_FONT, _font); // Fare solo quando la lista e' piena set(MSK_SIZE, pr._ch_size); // Fare solo quando la lista e' piena set(MSK_LINES, pr._lines_per_inch); - set(MSK_ISGRAPHICS, pr._isgraphics ? "X" : ""); + set(MSK_ISGRAPHICS, pr.isgraphics() ? "X" : ""); _skip_events = FALSE; } @@ -411,6 +411,7 @@ bool TPrint_txt_info::edit() TPrinter& p = printer(); TMask msk("bagn003"); msk.set(F_PRINTER, p.printername()); + msk.set(F_FORM, p.get_form_name()); msk.set(F_FONT, p.fontname()); msk.set(F_SIZE, p.get_char_size()); msk.set(F_ISGRAPHICS, p.isgraphics() ? "X" : ""); @@ -437,6 +438,28 @@ TPrint_txt_info::TPrint_txt_info(TTextfile& txt) _lastpage = (li+ps-1) / ps; } +// @cmember Ritorna vero se la stampante e' generica/solo testo +bool TPrinter::is_generic() const +{ + bool yes = _dots_per_line == 1; + if (!yes) + yes = _prname.find("Generic") >= 0; + return yes; +} + +// @cmember Ritorna vero se sono attivati gli elementi grafici +bool TPrinter::isgraphics() const +{ + return _isgraphics; +} + +// @cmember Attivati gli elementi grafici se possibile +bool TPrinter::set_graphics(bool g) +{ + _isgraphics = g && !is_generic(); + return _isgraphics; +} + BOOLEAN TPrinter::start_print(long data) { const TPrint_txt_info *pd = (TPrint_txt_info *) data; @@ -1221,7 +1244,7 @@ void TPrinter::read_configuration( _fontname = iniptr->get("Font", NULL, -1, XVT_FFN_FIXED); // Nome del font _ch_size = iniptr->get_int("Size", NULL, -1, 10); // Dimensione del font _lines_per_inch = iniptr->get_int("Lines", NULL, -1, 6); // Linee per pollice - _isgraphics = iniptr->get_bool("Graphic", NULL, -1, TRUE); // Grafica attiva + set_graphics(iniptr->get_bool("Graphic", NULL, -1, TRUE)); // Grafica attiva bool read_rcd = FALSE; @@ -1599,9 +1622,7 @@ void TPrinter::set_fink_mode( // oppure non ha il flag di stampa elementi grafici attivato, la fincatura sara' // in modo testo. { - _fink_mode = f; - if (_fink_mode && (is_generic() || !_isgraphics)) - _fink_mode = FALSE; + _fink_mode = f && isgraphics(); } // @doc EXTERNAL diff --git a/include/printer.h b/include/printer.h index 71a93bb8a..654472729 100755 --- a/include/printer.h +++ b/include/printer.h @@ -211,6 +211,8 @@ class TPrinter : public TObject TArray _footer; // @cmember:(INTERNAL) Nome della stampante corrente TString _prname; + // @cmember:(INTERNAL) Nome dell'ultimo TForm utilizzato + TFilename _formname; // @cmember:(INTERNAL) Lunghezza della pagina logica int _formlen; // @cmember:(INTERNAL) Larghezza della pagina logica @@ -579,9 +581,9 @@ public: // @cmember Ritorna la definizione di stampa in punti per linea int get_dots_per_line() const { return _dots_per_line; } // @cmember Ritorna se la stampante e' abilitata a stampare grafica - bool isgraphics() const { return _isgraphics; } + bool isgraphics() const; // @cmember Setta la stampante per l'abilitazione a stampare in grafica - void set_graphics(bool g) { _isgraphics=g; } + bool set_graphics(bool g); // @cmember Setta l'offset verticale e orizzontale in caratteri void set_offset(int a, int b) { _l_offset=a; _c_offset=b;} // @cmember ritorna la riga di background se si stampa in modo testo @@ -604,6 +606,9 @@ public: // @cmember Setta il nome del font di stampa void set_fontname(const char *name) { _fontname = name; } + + void set_form_name(const char* n) { _formname = n; } + const TFilename& get_form_name() const { return _formname; } // @cmember Legge la configurazione della stampante void read_configuration(const char* parag = NULL); @@ -612,7 +617,7 @@ public: int set_bookmark(const char* txt, int father = -1); // @cmember Ritorna vero se la stampante e' generica/solo testo - bool is_generic() { return (_dots_per_line == 1); } + bool is_generic() const; // @cmember Calcola la dimensione del font per le colonne desiderate int calc_font_size(int columns) const;