Patch level : 10.0
Files correlati : agalib Ricompilazione Demo : [ ] Commento : Nuova gestione barra di stato Possibilita' di memorizzare stampante per ogni singolo report git-svn-id: svn://10.65.10.50/trunk@17073 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									8a7c148eb6
								
							
						
					
					
						commit
						dd8f688115
					
				| @ -768,12 +768,12 @@ bool TApplication::set_firm(long newfirm) | ||||
| 
 | ||||
|       if (tipodir == 0 && !prefix().exist(newfirm) && | ||||
|           !prefix().build_firm_data(newfirm)) | ||||
|         return FALSE; | ||||
|         return false; | ||||
|       if (tipodir > 0) | ||||
|       { | ||||
|         if (_savefirm == 0) _savefirm = oldfirm;   // E' necessario ricordare la ditta ...
 | ||||
|         prefix().set(tipodir == 1 ? "com" : "");   // ... se si setta il prefix a com
 | ||||
|         return TRUE; | ||||
|         return true; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| @ -798,9 +798,10 @@ bool TApplication::set_firm(long newfirm) | ||||
|     WINDOW w = cur_win(); | ||||
|     if (w != NULL_WIN) | ||||
|     { | ||||
|       TWindow * win = (TWindow *) xvt_vobj_get_data(w); | ||||
|       TWindow* win = (TWindow*) xvt_vobj_get_data(w); | ||||
|       win->on_firm_change(); | ||||
|     } | ||||
|     xvtil_statbar_set("", true); // Aggiorna nome ditta nella barra
 | ||||
|     on_firm_change(); | ||||
|     on_config_change(); | ||||
|   } | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| #define MSK_TYPE        101 | ||||
| #define MSK_FILENAME    102 | ||||
| #define MSK_PRINTERS    103 | ||||
| #define MSK_ORIENTATION 333 | ||||
| #define MSK_ISGRAPHICS  334 | ||||
| #define MSK_SIZE        335 | ||||
| #define MSK_LINES       336 | ||||
|  | ||||
| @ -14,7 +14,7 @@ BEGIN | ||||
|   FLAGS "Z"      | ||||
| END | ||||
| 
 | ||||
| LIST MSK_PRINTERS 65 | ||||
| LIST MSK_PRINTERS 64 | ||||
| BEGIN | ||||
|   PROMPT 1 3 "Stampante " | ||||
| END | ||||
| @ -28,9 +28,9 @@ BEGIN | ||||
|   WARNING "E' necessario specificare un nome di file" | ||||
| END | ||||
| 
 | ||||
| GROUPBOX DLG_NULL 76 4 | ||||
| GROUPBOX DLG_NULL 42 5 | ||||
| BEGIN | ||||
|   PROMPT 1 4 "@bParametri di stampa" | ||||
|   PROMPT 1 4 "@bCarattere standard" | ||||
| END | ||||
| 
 | ||||
| LIST MSK_FONT 32 | ||||
| @ -41,13 +41,13 @@ END | ||||
|     | ||||
| LIST MSK_SIZE 3 | ||||
| BEGIN | ||||
|   PROMPT 50 5 "Dimensioni carattere "  | ||||
|   PROMPT 2 6 "Dimensioni carattere "  | ||||
|   ITEM "10|10" | ||||
| END | ||||
| 
 | ||||
| LIST MSK_LINES 3 | ||||
| BEGIN | ||||
|   PROMPT 50 6 "Linee per pollice    "  | ||||
|   PROMPT 2 7 "Linee per pollice    "  | ||||
|   ITEM "4|4" | ||||
|   ITEM "5|5" | ||||
|   ITEM "6|6" | ||||
| @ -57,11 +57,27 @@ BEGIN | ||||
|   ITEM "10|10"       | ||||
| END     | ||||
|         | ||||
| GROUPBOX DLG_NULL 33 5 | ||||
| BEGIN | ||||
|   PROMPT 44 4 "@bParametri di stampa" | ||||
| END | ||||
| 
 | ||||
| RADIOBUTTON MSK_ORIENTATION 1 20 | ||||
| BEGIN | ||||
|   PROMPT 45 4 "" | ||||
|   ITEM "1|Foglio verticale" | ||||
|   ITEM "2|Foglio orizzontale" | ||||
| END | ||||
| 
 | ||||
| BOOLEAN MSK_ISGRAPHICS | ||||
| BEGIN | ||||
|   PROMPT 2 6 "Stampa elementi grafici" | ||||
|   PROMPT 46 7 "Stampa elementi grafici" | ||||
| END | ||||
| 
 | ||||
| ENDPAGE | ||||
| 
 | ||||
| TOOLBAR "tobpar" 0 0 0 2 | ||||
| 
 | ||||
| BUTTON DLG_SETPRINT 10 2 | ||||
| BEGIN | ||||
|   PROMPT -14 -1 "~Imposta" | ||||
|  | ||||
| @ -4087,6 +4087,42 @@ bool TRectype::edit(int logicnum, const char* alternate_key_fields, const char* | ||||
|   return ok; | ||||
| } | ||||
| 
 | ||||
| bool TRectype::set_edit_info(const char* ut, const char* dt, const char* or) | ||||
| { | ||||
|   bool ok = false; | ||||
|   if (num() > LF_TAB) // Inutile tentare di gestire le tabelle
 | ||||
|   { | ||||
|     // Se esiste un campo alfanumerioco UT*
 | ||||
|     if (ut && *ut && type(ut) == _alfafld)    | ||||
|     { | ||||
|       put(ut, user()); // Scrivi utente corrente
 | ||||
|       ok = true; | ||||
| 
 | ||||
|       // Se esiste un campo data DT*
 | ||||
|       if (dt && *dt && type(dt) == _datefld)  | ||||
|       { | ||||
|         const TDate oggi(TODAY); | ||||
|         put(dt, oggi); // Scrivi data odierna
 | ||||
| 
 | ||||
|         // Se esisnte un campo long OR*
 | ||||
|         if (or && *or && (type(or) == _longfld || type(or) == _longzerofld)) | ||||
|           put(or, daytime()); // Scrivi ora attuale HHMMSS
 | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   return ok; | ||||
| } | ||||
| 
 | ||||
| bool TRectype::set_modify_info() | ||||
| { | ||||
|   return set_edit_info("UTCREAZ", "DTCREAZ", "ORCREAZ"); | ||||
| } | ||||
| 
 | ||||
| bool TRectype::set_creation_info() | ||||
| { | ||||
|   return set_edit_info("UTULAGG", "DTULAGG", "ORULAGG"); | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TRecfield (campo/sottocampo di un record)
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
|  | ||||
| @ -98,6 +98,8 @@ protected: | ||||
|   // @cmember Setta il contenuto del campo <p fieldname> (non tipizzata)
 | ||||
|   virtual void put_str(const char* fieldname, const char* val); | ||||
| 
 | ||||
|   bool set_edit_info(const char* ut, const char* dt, const char* or); | ||||
| 
 | ||||
| // @access Public Member
 | ||||
| public: | ||||
|   // @cmember Duplica il tipo di record
 | ||||
| @ -261,6 +263,9 @@ public: | ||||
|   virtual bool get_relapp(TString& app) const; | ||||
|   virtual bool edit(int logicnum = 0, const char * alternate_key_fields = NULL, const char* hint = NULL) const; | ||||
| 
 | ||||
|   virtual bool set_modify_info(); | ||||
|   virtual bool set_creation_info(); | ||||
| 
 | ||||
|   // @cmember Inizializza un record staccato da un file.
 | ||||
|   void init(int logicnum); | ||||
| 
 | ||||
|  | ||||
| @ -69,7 +69,6 @@ void TPrinter_setup_mask::fill_font_list() | ||||
|   }   | ||||
|    | ||||
|   TString oldfont = _font; // Memorizzo il font corrente in quanto poi cambia
 | ||||
| 
 | ||||
|   TList_field& lst = (TList_field&)field(MSK_FONT); | ||||
|   lst.replace_items(fn, fn);   | ||||
| 
 | ||||
| @ -77,6 +76,11 @@ void TPrinter_setup_mask::fill_font_list() | ||||
|   if (fn.get_pos(oldfont) < 0) | ||||
|     oldfont = fn.get(0); | ||||
|   set(MSK_FONT, oldfont, 0x1); | ||||
| 
 | ||||
|   long ph, pw; | ||||
|   xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, _pcd, &ph, &pw, NULL, NULL); | ||||
|   const int priter_orientation = ph > pw ? 1 : 2; | ||||
|   set(MSK_ORIENTATION, ph > pw ? 1 : 2); | ||||
| } | ||||
| 
 | ||||
| void TPrinter_setup_mask::fill_size_list() | ||||
| @ -114,7 +118,7 @@ void TPrinter_setup_mask::fill_size_list() | ||||
| bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) | ||||
| { | ||||
|   if (_skip_events) | ||||
|     return TRUE; | ||||
|     return true; | ||||
| 
 | ||||
|   switch (o.dlg()) | ||||
|   { | ||||
| @ -152,16 +156,27 @@ bool TPrinter_setup_mask::on_field_event(TOperable_field& o, TField_event e, lon | ||||
|       {                          | ||||
|         // see if user has changed printer
 | ||||
|         // determine name of currently selected printer 
 | ||||
|         TString name; | ||||
|         TString256 name; | ||||
|         xvt_print_get_name(_pcd, name.get_buffer(), name.size()); | ||||
|         set(MSK_PRINTERS, name, 0x1);     | ||||
|       } | ||||
|     } | ||||
|     break; | ||||
|   case MSK_ORIENTATION: | ||||
|     if (e == fe_modify || e == fe_close) | ||||
|     { | ||||
|       long ph, pw; | ||||
|       xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, _pcd, &ph, &pw, NULL, NULL); | ||||
|       const int priter_orientation = ph > pw ? 1 : 2; | ||||
|       const int user_orientation = atoi(o.get()); | ||||
|       if (user_orientation != priter_orientation) // Scambia orientamento della carta
 | ||||
|         xvt_app_escape(XVT_ESC_SET_PRINTER_INFO, _pcd, &pw, &ph, NULL, NULL); | ||||
|     } | ||||
|     break; | ||||
|   default: | ||||
|     break; | ||||
|   } | ||||
|   return TRUE; | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| TPrinter_setup_mask::TPrinter_setup_mask()  | ||||
| @ -186,7 +201,7 @@ TPrinter_setup_mask::TPrinter_setup_mask() | ||||
|   } | ||||
|   xvt_slist_destroy(plist); | ||||
| 
 | ||||
|   _skip_events = TRUE; | ||||
|   _skip_events = true; | ||||
|    | ||||
|   if (pr._printertype == fileprinter) | ||||
|     set (MSK_TYPE, "1"); | ||||
| @ -206,14 +221,14 @@ 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" : ""); | ||||
| 
 | ||||
|   _skip_events = FALSE; | ||||
|   _skip_events = false; | ||||
| } | ||||
| 
 | ||||
| TPrinter_setup_mask::~TPrinter_setup_mask() | ||||
| { | ||||
| } | ||||
| { } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // TPrinter
 | ||||
| @ -1218,10 +1233,10 @@ void TPrinter::init_formlen( | ||||
| } | ||||
| 
 | ||||
| TPrinter::TPrinter() | ||||
| : _vf(NULL), _ch_size (12), _date (TODAY), _multiple_link (FALSE), | ||||
|   _isgraphics (TRUE), _frozen (FALSE), _print_rcd(NULL), _lines_per_inch (6), | ||||
|   _l_offset(0), _c_offset(0), _export_header(FALSE), _export_header_len(0), | ||||
|   _appendfile(FALSE) | ||||
| : _vf(NULL), _ch_size (12), _date (TODAY), _multiple_link (false), | ||||
|   _isgraphics (true), _frozen (false), _print_rcd(NULL), _lines_per_inch (6), | ||||
|   _l_offset(0), _c_offset(0), _export_header(false), _export_header_len(0), | ||||
|   _appendfile(false), _manual_setup(false) | ||||
| 
 | ||||
| { | ||||
|   _footerhandler = _headerhandler = NULL; | ||||
| @ -1232,15 +1247,13 @@ TPrinter::TPrinter() | ||||
| 
 | ||||
|   _frompage = 0; | ||||
|   _topage = 0xffff; | ||||
|   _hwformfeed = FALSE; | ||||
|   _hwformfeed = false; | ||||
|   _currentpage = 1; | ||||
|   _currentrow = 1; | ||||
|   _fp = NULL; | ||||
|   _headersize = 0; | ||||
|   _footersize = 0; | ||||
|   _isopen = FALSE; | ||||
|    | ||||
| //  xvt_print_get_default_device(_defPrinter.get_buffer(), _defPrinter.size());
 | ||||
|   _isopen = false; | ||||
|    | ||||
| 	// read configuration file
 | ||||
|   read_configuration (); | ||||
| @ -1249,7 +1262,7 @@ TPrinter::TPrinter() | ||||
|    | ||||
|   set_fincatura("+++++++++-|");                 | ||||
| 
 | ||||
|   set_fink_mode(TRUE); | ||||
|   set_fink_mode(true); | ||||
|   _finker = _isgraphics && _fink_mode ? NULL : new TPrint_intersector(_fink, _formlen); | ||||
| } | ||||
| 
 | ||||
| @ -1281,14 +1294,14 @@ void TPrinter::read_configuration( | ||||
|     iniptr = new TConfig(CONFIG_GUI, "Printer"); | ||||
| 
 | ||||
|   const int what = iniptr->get_int("Type", NULL, -1, 4);      // Tipo stampante
 | ||||
|   _prname = iniptr->get("Name", NULL, -1, _defPrinter);       // Nome stampante corrente
 | ||||
|   _prname = iniptr->get("Name");                              // Nome stampante corrente
 | ||||
|   _printerfile = iniptr->get("File", NULL, -1, "");           // File di stampa                
 | ||||
|   set_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
 | ||||
|   set_graphics(iniptr->get_bool("Graphic", NULL, -1, TRUE));  // Grafica attiva
 | ||||
|   set_graphics(iniptr->get_bool("Graphic", NULL, -1, true));  // Grafica attiva
 | ||||
| 
 | ||||
| 	bool read_rcd = FALSE; | ||||
| 	bool read_rcd = false; | ||||
| 	 | ||||
| 	const TString& host = iniptr->get("Host"); | ||||
| 	if (host.not_empty()) | ||||
| @ -1369,10 +1382,12 @@ void TPrinter::read_configuration( | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void TPrinter::save_configuration() | ||||
| void TPrinter::save_configuration(const char* para) | ||||
| {  | ||||
|   TWait_cursor hourglass; | ||||
| 
 | ||||
|   if (para && *para) | ||||
|     _config = para; | ||||
|   CHECK(_config.not_empty(), "Invalid printer config"); | ||||
|   TConfig prini(_config == "Printer" ? CONFIG_GUI : CONFIG_STAMPE, _config); | ||||
|    | ||||
| @ -1401,12 +1416,12 @@ void TPrinter::save_configuration() | ||||
|     n++; | ||||
|     if (n == 24) | ||||
|     { | ||||
|       prini.set("rcd", val, NULL, TRUE, index++); | ||||
|       prini.set("rcd", val, NULL, true, index++); | ||||
|       val.cut(n = 0); | ||||
|     } | ||||
|   } | ||||
|   if (n > 0) | ||||
|     prini.set("rcd", val, NULL, TRUE, index); | ||||
|     prini.set("rcd", val, NULL, true, index); | ||||
|    | ||||
|   for (index++; prini.remove("rcd", index); index++); | ||||
| } | ||||
| @ -1418,7 +1433,6 @@ TPrinter::~TPrinter () | ||||
|     xvt_print_destroy(_print_rcd); | ||||
|     _print_rcd = NULL; | ||||
|   }                                                      | ||||
| //  xvt_print_set_default_device(_defPrinter);
 | ||||
| } | ||||
| 
 | ||||
| const char* TPrinter::class_name() const | ||||
| @ -1505,19 +1519,19 @@ void TPrinter::resetfooter () | ||||
| //
 | ||||
| // @rdesc Ritorna il risulato della stampa:
 | ||||
| //
 | ||||
| // @flag TRUE | Se la stampa ha avuto successo
 | ||||
| // @flag FALSE | Se la stampante non e' attiva
 | ||||
| // @flag true | Se la stampa ha avuto successo
 | ||||
| // @flag false | Se la stampante non e' attiva
 | ||||
| bool TPrinter::printrow( | ||||
|   TPrintrow* rowtoprint) // @parm Riga da stampare
 | ||||
| 
 | ||||
|   // @comm Se la pagina logica corrente e' precedente alla prima pagina logica o successiva
 | ||||
|   //     all'ultima pagina logica viene ritornato TRUE.
 | ||||
|   //     all'ultima pagina logica viene ritornato true.
 | ||||
| { | ||||
|   if (!isopen ()) | ||||
|     return FALSE; | ||||
|     return false; | ||||
| 
 | ||||
|   if (_currentpage < _frompage || _currentpage > _topage) | ||||
|     return TRUE; | ||||
|     return true; | ||||
| 
 | ||||
|   TString rw (rowtoprint == NULL ? "" : ((_printertype == screenvis || _printertype == winprinter ||  | ||||
|                                          _printertype == exportprinter) ?  | ||||
| @ -1557,7 +1571,7 @@ bool TPrinter::printrow( | ||||
|     if (!_vf->frozen ()) | ||||
|       _vf->add_line(rw); | ||||
|     else | ||||
|       _frozen = TRUE; | ||||
|       _frozen = true; | ||||
|   } | ||||
|   else | ||||
|   { | ||||
| @ -1583,8 +1597,8 @@ word TPrinter::rows_left() const | ||||
| //
 | ||||
| // @rdesc Ritorna il risultato della stampa:
 | ||||
| //
 | ||||
| // @flag TRUE | Se la stampa ha avuto successo
 | ||||
| // @flag FALSE | Se non e' riuscito ad effettuare la stampa
 | ||||
| // @flag true | Se la stampa ha avuto successo
 | ||||
| // @flag false | Se non e' riuscito ad effettuare la stampa
 | ||||
| bool TPrinter::print( | ||||
|   TPrintrow& rowtoprint)        // @parm Riga da stampare
 | ||||
| 
 | ||||
| @ -1592,7 +1606,7 @@ bool TPrinter::print( | ||||
|   //     della pagina corrente e l'header della successiva prima prima della stampa della riga
 | ||||
|   //     vera e propria.
 | ||||
| { | ||||
|   bool ok = TRUE; | ||||
|   bool ok = true; | ||||
| 
 | ||||
|   if (!(_printertype == exportprinter && !_export_header)) | ||||
|   { | ||||
| @ -1616,7 +1630,7 @@ bool TPrinter::printheader() | ||||
|   if (_headerhandler) | ||||
|     _headerhandler(*this); | ||||
| 
 | ||||
|   bool ok = TRUE; | ||||
|   bool ok = true; | ||||
|   int i; | ||||
|    | ||||
|   for (i = 0; i < _headersize && ok; i++) | ||||
| @ -1633,7 +1647,7 @@ bool TPrinter::printfooter() | ||||
|   if (_footerhandler) | ||||
|     _footerhandler (*this); | ||||
| 
 | ||||
|   bool ok = TRUE; | ||||
|   bool ok = true; | ||||
|   for (int i = 0; i < _footersize && ok; i++) | ||||
|     ok = printrow(getfooterline(i)); | ||||
| 
 | ||||
| @ -1649,11 +1663,11 @@ bool TPrinter::printfooter() | ||||
| void TPrinter::set_fink_mode( | ||||
|   bool f)      // @parm Indica il tipo di fincatura:
 | ||||
|   //
 | ||||
|   // @flag TRUE | Fincatura di tipo grafico
 | ||||
|   // @flag FALSE | Fincatura di tipo testo
 | ||||
|   // @flag true | Fincatura di tipo grafico
 | ||||
|   // @flag false | Fincatura di tipo testo
 | ||||
| 
 | ||||
|   // @comm Viene prima controllato che la stampante supporti la modalita' grafica,
 | ||||
|   //       in tal caso, se viene impostato il flag a TRUE e la stampante e' generica
 | ||||
|   //       in tal caso, se viene impostato il flag a true e la stampante e' generica
 | ||||
|   //       oppure non ha il flag di stampa elementi grafici attivato, la fincatura sara'
 | ||||
|   //       in modo testo.
 | ||||
| { | ||||
| @ -1666,8 +1680,8 @@ void TPrinter::set_fink_mode( | ||||
| //
 | ||||
| // @rdesc Ritorna il risulato dell'operazione:
 | ||||
| //
 | ||||
| // @flag TRUE | Se e' riuscito a saltare le righe
 | ||||
| // @flag FALSE | Se non e' riuscito a saltare le righe
 | ||||
| // @flag true | Se e' riuscito a saltare le righe
 | ||||
| // @flag false | Se non e' riuscito a saltare le righe
 | ||||
| bool TPrinter::skip( | ||||
|   int linestoskip)      // @parm Vengono accettati solo valori positivi
 | ||||
| 
 | ||||
| @ -1684,8 +1698,8 @@ bool TPrinter::skip( | ||||
| //
 | ||||
| // @rdesc Ritorna il risultato dell'operazione
 | ||||
| //
 | ||||
| // @flag TRUE | Se e' riuscito a saltare alla riga
 | ||||
| // @flag FALSE | Se non e' riuscito a saltare alla riga o se viene inserito un formfeed
 | ||||
| // @flag true | Se e' riuscito a saltare alla riga
 | ||||
| // @flag false | Se non e' riuscito a saltare alla riga o se viene inserito un formfeed
 | ||||
| bool TPrinter::jump( | ||||
|   int jumpline) // @parm Numero della riga a cui saltare nella stampa. Vengono accettai
 | ||||
|   //     solo valori positivi
 | ||||
| @ -1696,7 +1710,7 @@ bool TPrinter::jump( | ||||
|   // @xref <mf TPrinter::skip>
 | ||||
| { | ||||
|   int i = 0; | ||||
|   bool ok = TRUE; | ||||
|   bool ok = true; | ||||
| 
 | ||||
|   CHECK (jumpline >= 0, "Jumpline can't be negative"); | ||||
|   if (jumpline > _formlen - _footersize) | ||||
| @ -1704,9 +1718,9 @@ bool TPrinter::jump( | ||||
|   else | ||||
|     for (i = _currentrow; i < jumpline; i++) | ||||
|       if (!printrow()) | ||||
|         ok = FALSE; | ||||
|         ok = false; | ||||
|   if (jumpline > _formlen - _footersize) | ||||
|     ok = FALSE; | ||||
|     ok = false; | ||||
|   return ok; | ||||
| } | ||||
| 
 | ||||
| @ -1728,12 +1742,10 @@ void TPrinter::reset() | ||||
| 
 | ||||
| bool TPrinter::open() | ||||
| { | ||||
| //  xvt_print_set_default_device(_prname);
 | ||||
| 
 | ||||
|   if (_printertype == screenvis) | ||||
|   {  | ||||
|     CHECK(_vf == NULL, "Print preview already open"); | ||||
|     _vf = new TViswin (NULL, "Anteprima di stampa", TRUE, TRUE, | ||||
|     _vf = new TViswin (NULL, "Anteprima di stampa", true, true, | ||||
|                        _linksdescr.items () > 0); | ||||
|     _vf->open_modal (); | ||||
|   } | ||||
| @ -1741,13 +1753,13 @@ bool TPrinter::open() | ||||
|   { | ||||
|     // prepare text object for new text
 | ||||
|     _txt.destroy(); | ||||
|     _txt.interactive(FALSE); | ||||
|     _txt.interactive(false); | ||||
|   }   | ||||
| 
 | ||||
|   _currentrow = 1; | ||||
|   _currentpage = 1; | ||||
| 
 | ||||
|   return _isopen = TRUE; | ||||
|   return _isopen = true; | ||||
| } | ||||
| 
 | ||||
| bool TPrinter::set() | ||||
| @ -1772,6 +1784,7 @@ bool TPrinter::set() | ||||
|   } | ||||
|   else | ||||
|   { | ||||
|     _manual_setup = true; | ||||
|     _prname = mask.get(MSK_PRINTERS); | ||||
| 
 | ||||
|     switch (atoi (mask.get (MSK_TYPE))) | ||||
| @ -1800,7 +1813,7 @@ bool TPrinter::set() | ||||
|   } | ||||
| 
 | ||||
|   main_app().enable_menu_item (M_FILE_PG_SETUP); | ||||
|   return TRUE; | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| @ -1811,8 +1824,8 @@ void TPrinter::merge_export_file( | ||||
|   const char* file,  | ||||
|   bool header)  // @parm Indica se gli header sono presenti nel file:
 | ||||
|   //
 | ||||
|   // @flag TRUE | Gli header sono nel file e quindi non vengono stampanti (default)
 | ||||
|   // @flag FALSE | Gli header non sono nel file e quindi vengono stampanti
 | ||||
|   // @flag true | Gli header sono nel file e quindi non vengono stampanti (default)
 | ||||
|   // @flag false | Gli header non sono nel file e quindi vengono stampanti
 | ||||
| 
 | ||||
|   // @comm Vengono inseriti nel file di export i formati e tutto il resto. Vengono ignorati gli
 | ||||
|   //     header supponendo che siano gia' presenti nel file
 | ||||
| @ -1922,7 +1935,7 @@ void TPrinter::close () | ||||
|      | ||||
|     if (key == K_CTRL+'S') | ||||
|     { | ||||
|       _isopen = FALSE; | ||||
|       _isopen = false; | ||||
|       _currentrow = _currentpage = 1; | ||||
|       print_txt(_vf->text()); | ||||
|     } | ||||
| @ -1965,8 +1978,8 @@ void TPrinter::close () | ||||
|    | ||||
|   // Dealloca sfondi ormai inutili
 | ||||
|   _backgrounds.destroy(); | ||||
|   freeze (FALSE);              | ||||
|   _isopen = FALSE; | ||||
|   freeze (false);              | ||||
|   _isopen = false; | ||||
| } | ||||
| 
 | ||||
| //  
 | ||||
| @ -1988,8 +2001,8 @@ TFile_printer::TFile_printer (const char *ffile, const char *label, int len_rec, | ||||
|   _volume = 1; | ||||
|   _size = disk_sizes[tipo_disco]; | ||||
|   _num_rec_volume = int ((_size / len_rec) - _num_rec_testa_coda); | ||||
|   _nome_file_fissato = TRUE; | ||||
|   _label_fissata = TRUE; | ||||
|   _nome_file_fissato = true; | ||||
|   _label_fissata = true; | ||||
| } | ||||
| 
 | ||||
| void TFile_printer::open() | ||||
| @ -2015,7 +2028,7 @@ bool TFile_printer::genera_dischetti () | ||||
|     // copia il file sul dischetto
 | ||||
|     fcopy ((const char *) &_tmp_files[i], (const char *) _drive); | ||||
|   } | ||||
|   return TRUE; | ||||
|   return true; | ||||
| } | ||||
| 
 | ||||
| TFile_printer::~TFile_printer () | ||||
| @ -2173,3 +2186,13 @@ int TPrinter::calc_num_cols() const | ||||
|    | ||||
|   return numcols; | ||||
| } | ||||
| 
 | ||||
| void TPrinter::set_portrait_orientation(bool portrait) | ||||
| { | ||||
|   long pw, ph; // Printer width, height
 | ||||
|   PRINT_RCD* rcd = get_printrcd(); | ||||
|   xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, rcd, &ph, &pw, NULL, NULL); | ||||
|   const bool is_portrait = ph >= pw; | ||||
|   if (portrait != is_portrait) | ||||
|     xvt_app_escape(XVT_ESC_SET_PRINTER_INFO, rcd, &pw, &ph, NULL, NULL); | ||||
| } | ||||
|  | ||||
| @ -192,8 +192,6 @@ class TPrinter : public TObject | ||||
|   FILE* _fp; | ||||
|   // @cmember:(INTERNAL) Puntatore al file di visualizzaizone
 | ||||
|   TViswin* _vf; | ||||
|   // @cmember:(INTERNAL) Stampante di default di sistema       
 | ||||
|   TString _defPrinter;        | ||||
|   // @cmember:(INTERNAL) Testo da stampare
 | ||||
|   TTextfile _txt; | ||||
|   // @cmember:(INTERNAL) Nome del file di esportazione
 | ||||
| @ -299,6 +297,7 @@ class TPrinter : public TObject | ||||
|   // @cmember:(INTERNAL) Fincatore per modo testo
 | ||||
|   TPrint_intersector* _finker;  | ||||
| 
 | ||||
|   bool _manual_setup; | ||||
|    | ||||
|   // @access Protected Member
 | ||||
| protected: | ||||
| @ -315,9 +314,6 @@ protected: | ||||
|   // @cmember Stampa il footer della pagina
 | ||||
|   bool printfooter(); | ||||
| 
 | ||||
|   // @cmember Salva i parametri di configurazione correnti
 | ||||
|   void save_configuration(); | ||||
|    | ||||
|   // @access Public Member
 | ||||
| public: | ||||
| 
 | ||||
| @ -497,7 +493,6 @@ public: | ||||
|   char f_vertical() const  | ||||
|   { return _fink[10]; } | ||||
|    | ||||
| 
 | ||||
|   // @cmember Permette di saltare alcune righe dalla posizione corrente 
 | ||||
|   bool skip (int linetoskip); | ||||
|   // @cmember Permette di saltare alla riga indicata
 | ||||
| @ -613,6 +608,8 @@ public: | ||||
|    | ||||
|   // @cmember Legge la configurazione della stampante
 | ||||
|   void read_configuration(const char* parag = NULL); | ||||
|   // @cmember Salva i parametri di configurazione correnti
 | ||||
|   void save_configuration(const char* parag = NULL); | ||||
| 
 | ||||
|   // @cmember Crea un segnalibro
 | ||||
|   int set_bookmark(const char* txt, int father = -1); | ||||
| @ -624,6 +621,10 @@ public: | ||||
|   int calc_font_size(int columns) const; | ||||
|   // @cmember Calcola il numero di colonne per il font/size attuale
 | ||||
|   int calc_num_cols() const; | ||||
| 
 | ||||
|   void set_portrait_orientation(bool port = true); | ||||
|   void set_landscape_orientation(bool land = true) { set_portrait_orientation(!land); }  | ||||
|   bool manual_setup() const { return _manual_setup; } | ||||
| }; | ||||
| 
 | ||||
| // @doc EXTERNAL
 | ||||
|  | ||||
| @ -1151,14 +1151,16 @@ int TRelation_application::read(TMask& m) | ||||
|   return NOERR; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| int TRelation_application::write(const TMask& m) | ||||
| { | ||||
|   TRelation &r = *get_relation(); | ||||
|   m.autosave(r); | ||||
|   r.curr().set_creation_info(); | ||||
| 
 | ||||
|   // write relation and all independent sheets 
 | ||||
|   int err=r.write(); | ||||
| 
 | ||||
| /*
 | ||||
|   const int max = m.fields(); | ||||
|   for (int i = 0; i < max; i++) | ||||
|   { | ||||
| @ -1169,6 +1171,13 @@ int TRelation_application::write(const TMask& m) | ||||
|         err|=f.record()->write(FALSE); | ||||
|     } | ||||
|   } | ||||
| */ | ||||
|   FOR_EACH_MASK_SHEET(m, i, s) | ||||
|   { | ||||
|     if (s->record() && !s->external_record()) | ||||
|       err |= s->record()->write(false); | ||||
|   } | ||||
| 
 | ||||
|   return err; | ||||
| } | ||||
| 
 | ||||
| @ -1177,9 +1186,12 @@ int TRelation_application::rewrite(const TMask& m) | ||||
| { | ||||
|   TRelation& r = *get_relation(); | ||||
|   m.autosave(r); | ||||
|   r.curr().set_modify_info(); | ||||
|   // rewrite relation and all independent sheets 
 | ||||
|   r.rewrite(); | ||||
|   int err=r.status(); | ||||
| 
 | ||||
|   /*
 | ||||
|   const int max = m.fields(); | ||||
|   for (int i = 0; i < max; i++) | ||||
|   { | ||||
| @ -1190,6 +1202,13 @@ int TRelation_application::rewrite(const TMask& m) | ||||
|         err|=f.record()->write(TRUE); | ||||
|     } | ||||
|   } | ||||
|   */ | ||||
|   FOR_EACH_MASK_SHEET(m, i, s) | ||||
|   { | ||||
|     if (s->record() && !s->external_record()) | ||||
|       err |= s->record()->write(true); | ||||
|   } | ||||
| 
 | ||||
|   return err; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -1362,14 +1362,19 @@ void TCursor::filter( | ||||
|   case LF_TAB: | ||||
|     { | ||||
|       const TTable& f = (const TTable&)file(); | ||||
|       kf = kto = f.name(); | ||||
|       // kf = kto = f.name();
 | ||||
|       const TString4 k = f.name(); | ||||
|       kf.overwrite(k, 0); | ||||
|       kto.overwrite(k, 0); | ||||
|     }; | ||||
|     break; | ||||
|   case LF_TABMOD: | ||||
|     { | ||||
|       const TModule_table& t = (TModule_table&)file(); | ||||
|       kf.format("%2s%6ld%3s", (const char*)t.module(), t.customer(), (const char*)t.name()); | ||||
|       kto = kf; | ||||
|       TString16 k; | ||||
|       k.format("%2s%6ld%3s", (const char*)t.module(), t.customer(), (const char*)t.name()); | ||||
|       kf.overwrite(k, 0);  | ||||
|       kto.overwrite(k, 0); | ||||
|     } | ||||
|     break; | ||||
|   default: | ||||
|  | ||||
| @ -2089,6 +2089,7 @@ bool TReport::load(const char* fname) | ||||
|     _lpi = xml.GetIntAttr("lpi", 6); | ||||
|     _font.load(xml); | ||||
|     _use_printer_font = xml.GetBoolAttr("use_printer_font"); | ||||
|     _save_last_printer = xml.GetBoolAttr("save_printer"); | ||||
|     _orientation = xml.GetIntAttr("orientation"); | ||||
|     _page_split = xml.GetBoolAttr("page_split"); | ||||
|     _page_merge = xml.GetBoolAttr("page_merge"); | ||||
| @ -2169,6 +2170,7 @@ bool TReport::save(const char* fname) const | ||||
|     xml.SetAttr("libraries", _include); | ||||
|     _font.save(xml); | ||||
|     xml.SetAttr("use_printer_font", use_printer_font() ? 1 : 0); | ||||
|     xml.SetAttr("save_printer", save_last_printer() ? 1 : 0); | ||||
|     xml.SetAttr("orientation", orientation()); | ||||
|     xml.SetAttr("page_split", page_split_allowed()); | ||||
|     xml.SetAttr("page_merge", page_merge_allowed()); | ||||
| @ -3138,7 +3140,8 @@ bool TReport::archive() | ||||
| 
 | ||||
| TReport::TReport()  | ||||
|        : _cpi(0), _lpi(6), _include(15, ','), _recordset(NULL), _curr_field(NULL), | ||||
|          _use_printer_font(false), _orientation(0), _page_split(false), _page_merge(false), _rep_copy(1), _rep_copies(1) | ||||
|          _use_printer_font(false), _save_last_printer(false), _orientation(0),  | ||||
|          _page_split(false), _page_merge(false), _rep_copy(1), _rep_copies(1) | ||||
| {  | ||||
|   _expressions.set_report(this);   | ||||
|   _prescript.set_description("PRESCRIPT"); | ||||
|  | ||||
| @ -60,10 +60,6 @@ public: | ||||
|   XVT_FNTID get_preview_font(const TWindow& win, const TPoint& res) const; | ||||
|   void unmap(); | ||||
| 
 | ||||
|   //int leading() const { return _leading; }
 | ||||
|   //int ascent() const { return _ascent; }
 | ||||
|   //int descent() const { return _descent; }
 | ||||
| 
 | ||||
|   void save(TXmlItem& root) const; | ||||
|   bool load(const TXmlItem& root); | ||||
| 
 | ||||
| @ -462,7 +458,7 @@ class TReport : public TAlex_virtual_machine | ||||
|   TRecordset* _recordset; | ||||
|   TReport_expr_cache _expressions; | ||||
|   word _rep_page, _book_page, _rep_copy, _rep_copies; | ||||
|   bool _use_printer_font; | ||||
|   bool _use_printer_font, _save_last_printer; | ||||
|   int _orientation; | ||||
|   TString_array _allegati; | ||||
|   TReport_field* _curr_field; | ||||
| @ -508,6 +504,8 @@ public: | ||||
|   const TReport_font& print_font() const; | ||||
|   void set_use_printer_font(bool on) { _use_printer_font = on; } | ||||
|   bool use_printer_font() const { return _use_printer_font; } | ||||
|   void set_save_last_printer(bool on) { _save_last_printer = on; } | ||||
|   bool save_last_printer() const { return _save_last_printer; } | ||||
|   void set_orientation(int orion) { _orientation = orion; } | ||||
|   int orientation() const { return _orientation; } | ||||
|   const TString& get_class() const { return _class; } | ||||
|  | ||||
| @ -2324,23 +2324,34 @@ long TReport_book::print_section(TReport_section& rs) | ||||
| 
 | ||||
| bool TReport_book::init(TReport& rep) | ||||
| { | ||||
|   TPrinter& pr = printer(); | ||||
| 
 | ||||
|   bool save_profile = rep.save_last_printer(); | ||||
|   if (save_profile && !pr.manual_setup()) | ||||
|   { | ||||
|     const TString profile = rep.filename().name(); | ||||
|     TConfig prini(CONFIG_STAMPE, profile); | ||||
|     const TString& rep_printer = prini.get("Name"); | ||||
|     const TString& cur_printer = pr.printername(); | ||||
|     if (rep_printer.full() && rep_printer != cur_printer)  | ||||
|     { | ||||
|       pr.read_configuration(profile); // Uso la stampante preferita dal report
 | ||||
|       save_profile = false; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   // Controlla orientamento della carta prima di inizializzare
 | ||||
|   const int report_orientation = rep.orientation(); | ||||
|   if (report_orientation > 0) | ||||
|   { | ||||
|     PRINT_RCD* rcd = printer().get_printrcd(); | ||||
|     if (xvt_print_is_valid(rcd)) | ||||
|     { | ||||
|       long ph, pw, phr, pvr; | ||||
|       xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, rcd, &ph, &pw, &phr, &pvr); | ||||
|       const int priter_orientation = ph > pw ? 1 : 2; | ||||
|       if (report_orientation != priter_orientation) | ||||
|       { | ||||
|         // Scambia orientamento della carta
 | ||||
|         xvt_app_escape(XVT_ESC_SET_PRINTER_INFO, rcd, &pw, &ph, NULL, NULL); | ||||
|     pr.set_landscape_orientation(report_orientation == 2); | ||||
|     // I parametri verranno riletti dalla TBook::init()
 | ||||
|   } | ||||
|     } | ||||
| 
 | ||||
|   if (save_profile)  | ||||
|   { | ||||
|     const TString profile = rep.filename().name(); | ||||
|     pr.save_configuration(profile); | ||||
|   } | ||||
| 
 | ||||
|   if (!TBook::init()) | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| #include <config.h> | ||||
| #include <controls.h> | ||||
| #include <mask.h> | ||||
| #include <prefix.h> | ||||
| #include <urldefid.h> | ||||
| #include <utility.h>      | ||||
|   | ||||
| @ -551,11 +552,19 @@ void xvtil_statbar_set( | ||||
|   // @xref <f xvt_create_statbar> <f xvt_statbar_refresh>
 | ||||
| {                     | ||||
|   if (_statbar != NULL_WIN) | ||||
|   { | ||||
|     TToken_string t(80, '\t'); | ||||
|     t.add(text); | ||||
|     if (prefix_valid() && main_app().get_firm() > 0) | ||||
|     { | ||||
|       t.add(prefix().firm().get("RAGSOC")); | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|       const TDate oggi(TODAY); | ||||
|     TString256 t; | ||||
|     t << text << '\t' << oggi.string() << " - " << main_app().title(); | ||||
| 
 | ||||
|       t.add(oggi.string()); | ||||
|     } | ||||
|     t.add(main_app().title()); | ||||
|     if (def)                                           | ||||
|       statbar_set_default_title(_statbar, t); | ||||
|     statbar_set_title(_statbar, t); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user