Linee e box in modo testo
git-svn-id: svn://10.65.10.50/trunk@2334 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									f5d1aa190a
								
							
						
					
					
						commit
						c872f8ceb5
					
				| @ -9,7 +9,7 @@ | ||||
| 
 | ||||
| class TFink_mask : public TMask | ||||
| {                               | ||||
|     TToken_string _chars;   | ||||
|     char _chars[11];   | ||||
|      | ||||
|     enum pos { // posizioni scatoletta
 | ||||
|       xl  = 1, | ||||
| @ -33,10 +33,11 @@ class TFink_mask : public TMask | ||||
| 
 | ||||
|    public:                | ||||
|                                    | ||||
|     TToken_string& get_chars() { return _chars; } | ||||
|     char* get_chars() { return _chars; } | ||||
|      | ||||
|     TFink_mask(const char* def) : TMask("ba21fn"), _chars(def,',')  | ||||
|     TFink_mask(const char* def) : TMask("ba21fn")  | ||||
|     {  | ||||
|       strncpy(_chars, def, 11); | ||||
|       set_handler(C_TR, char_handler); | ||||
|       set_handler(C_TL, char_handler); | ||||
|       set_handler(C_TM, char_handler); | ||||
| @ -90,30 +91,30 @@ void TFink_mask::paint_example() | ||||
|     line.spaces(); | ||||
|     if (i == yt) | ||||
|     {                | ||||
|       line.fill(_chars.get_char(9));  | ||||
|       line[xl-1] = _chars.get_char(0); | ||||
|       line[xm-1] = _chars.get_char(1); | ||||
|       line[xr-1] = _chars.get_char(2); | ||||
|       line.fill(_chars[9]);  | ||||
|       line[xl-1] = _chars[0]; | ||||
|       line[xm-1] = _chars[1]; | ||||
|       line[xr-1] = _chars[2]; | ||||
|     } | ||||
|     else if (i == ym)  | ||||
|     { | ||||
|       line.fill(_chars.get_char(9));  | ||||
|       line[xl-1] = _chars.get_char(6); | ||||
|       line[xm-1] = _chars.get_char(7); | ||||
|       line[xr-1] = _chars.get_char(8); | ||||
|       line.fill(_chars[9]);  | ||||
|       line[xl-1] = _chars[6]; | ||||
|       line[xm-1] = _chars[7]; | ||||
|       line[xr-1] = _chars[8]; | ||||
|     } | ||||
|     else if (i == yb)  | ||||
|     { | ||||
|       line.fill(_chars.get_char(9));  | ||||
|       line[xl-1] = _chars.get_char(3); | ||||
|       line[xm-1] = _chars.get_char(4); | ||||
|       line[xr-1] = _chars.get_char(5); | ||||
|       line.fill(_chars[9]);  | ||||
|       line[xl-1] = _chars[3]; | ||||
|       line[xm-1] = _chars[4]; | ||||
|       line[xr-1] = _chars[5]; | ||||
|     } | ||||
|     else | ||||
|     { | ||||
|       line[xl-1] = _chars.get_char(10); | ||||
|       line[xm-1] = _chars.get_char(10); | ||||
|       line[xr-1] = _chars.get_char(10); | ||||
|       line[xl-1] = _chars[10]; | ||||
|       line[xm-1] = _chars[10]; | ||||
|       line[xr-1] = _chars[10]; | ||||
|     } | ||||
|     stringat(ofs, i, line); | ||||
|   }  | ||||
| @ -125,7 +126,7 @@ void TFink_mask::start_run() | ||||
|   for (int i = 101; i <= 111; i++) | ||||
|   { | ||||
|     field(i).allow_pipe();   // allowa la pipa, se no son cazzi
 | ||||
|     field(i).set(_chars.get(i - 101));  | ||||
|     field(i).set(format("%c",_chars[i - 101]));  | ||||
|   } | ||||
| } | ||||
|                        | ||||
| @ -134,7 +135,7 @@ bool TFink_mask::stop_run(KEY k) | ||||
|   if (k == K_ENTER) | ||||
|   { | ||||
|     for (int i = 101; i <= 111; i++) | ||||
|       _chars.add(field(i).get(), i-101); | ||||
|       _chars[i-101] = field(i).get()[0]; | ||||
|   } | ||||
|   return TMask::stop_run(k); | ||||
| } | ||||
| @ -144,8 +145,8 @@ bool TFink_mask::char_handler(TMask_field& f, KEY k) | ||||
|   if (f.focusdirty() && k == K_TAB) | ||||
|   {  | ||||
|     TFink_mask& m = (TFink_mask&)f.mask(); | ||||
|     TToken_string& ch = m.get_chars(); | ||||
|     ch.add(f.get(), f.dlg() - 101); | ||||
|     char* ch = m.get_chars(); | ||||
|     ch[f.dlg() - 101] = f.get()[0]; | ||||
|     m.paint_example(); | ||||
|   } | ||||
|   return TRUE; | ||||
|  | ||||
| @ -2169,7 +2169,7 @@ bool TPrint_section::detail_field_handler(TMask_field& f, KEY k) | ||||
|             | ||||
|            for (int jj = 2; jj < des.items(); jj++) | ||||
|            { | ||||
|              CHECK (jj < (des.items() - 1), "AAARGH! LISTA special fatta col CULO!"); | ||||
|              CHECK (jj < (des.items() - 1), "AAARGH! 'Sta LISTA special e' fatta col CULO!"); | ||||
|              TString t1(des.get(jj++));  | ||||
|              TString t2(des.get(jj));   | ||||
|              codes.add(t1); | ||||
| @ -2704,7 +2704,7 @@ bool TForm::parse_general(TScanner &scanner) | ||||
|       else scanner.push(); | ||||
| 
 | ||||
|       if (scanner.popkey() == "GR")   // Carattere di posizionamento
 | ||||
|         _fink = scanner.string(); | ||||
|         set_fincatura(scanner.string()); | ||||
|       else scanner.push(); | ||||
|        | ||||
|       extended_parse_general(scanner); // Parse non-standard parameters
 | ||||
| @ -2726,7 +2726,8 @@ void TForm::print_general(ostream& out) const | ||||
|     out << "  INIZIO_POS " << _ipx << " " << _ipy << "\n"; | ||||
|     out << "  FINE_POS " << _fpx << "\n"; | ||||
|   }                                          | ||||
|   out << "  GRID \"" << (const char*)_fink << "\"\n"; | ||||
|   char fn[12]; strncpy(fn, _fink, 11); fn[11] = '\0'; | ||||
|   out << "  GRID \"" << (const char*)fn << "\"\n"; | ||||
|   out << "END\n" << endl; | ||||
| } | ||||
| 
 | ||||
| @ -3403,8 +3404,7 @@ void TForm::init() | ||||
|   _ipy= 0; | ||||
|   _fpx= 0; | ||||
|   _arrange= TRUE; | ||||
|   _fink= "+,+,+,+,+,+,+,+,+,-,|"; | ||||
|   _fink.separator(','); | ||||
|   set_fincatura(printer().get_fincatura()); | ||||
|   _dirty= FALSE;                          | ||||
|   _background_mode = printer().isgraphics() ? graphics : text; | ||||
| } | ||||
| @ -3479,6 +3479,13 @@ void TForm::read(const char* name, const char* code, int lev, const char* desc) | ||||
|   main_app().end_wait(); | ||||
| } | ||||
| 
 | ||||
| void TForm::set_fincatura(const char* s) | ||||
| {  | ||||
|   strncpy(_fink,s,sizeof(_fink));  | ||||
|   printer().set_fincatura(_fink); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| TForm::TForm() | ||||
| { | ||||
|   init(); | ||||
|  | ||||
| @ -74,15 +74,15 @@ class TForm : public TObject | ||||
|   bool   _arrange;        // if TRUE perform arranging every time 
 | ||||
|   int    _editlevel;      // Edit permission
 | ||||
|   TString _desc;          // form description
 | ||||
|   TToken_string _fink;    // finkatur characters       
 | ||||
|   char    _fink[11];      // finkatur characters       
 | ||||
|    | ||||
|   TPrint_section* exist(char s, pagetype t, bool create = FALSE);   // Can be NULL
 | ||||
|    | ||||
|   static void header_handler(TPrinter& p); | ||||
|   static void footer_handler(TPrinter& p);                                          | ||||
| 
 | ||||
|   TToken_string& get_fincatura()    { return _fink; } | ||||
|   void set_fincatura(const char* s) { _fink = s;    } | ||||
|   const char* get_fincatura()    { return _fink; } | ||||
|   void set_fincatura(const char* s); | ||||
|                                                 | ||||
|   // come sotto ma per printsection, all'uopo di chiamarle
 | ||||
|   // con ricorsiva insistenza                                              
 | ||||
| @ -169,19 +169,6 @@ public: | ||||
|   // cambia il formato di tutti i numeri nel form                                          
 | ||||
|   void change_number_format(int w, int dec, const char* p);                      | ||||
|                         | ||||
|   // fincazione                                              
 | ||||
|   char f_topleft()      const { return ((TToken_string&)_fink).get_char(0);  }                                               | ||||
|   char f_topmiddle()    const { return ((TToken_string&)_fink).get_char(1);  }                                               | ||||
|   char f_topright()     const { return ((TToken_string&)_fink).get_char(2);  }                                               | ||||
|   char f_botleft()      const { return ((TToken_string&)_fink).get_char(3);  }                                               | ||||
|   char f_botmiddle()    const { return ((TToken_string&)_fink).get_char(4);  }                                               | ||||
|   char f_botright()     const { return ((TToken_string&)_fink).get_char(5);  }                                               | ||||
|   char f_centerleft()   const { return ((TToken_string&)_fink).get_char(6);  }                                               | ||||
|   char f_centermiddle() const { return ((TToken_string&)_fink).get_char(7);  }                                               | ||||
|   char f_centerright()  const { return ((TToken_string&)_fink).get_char(8);  }                                               | ||||
|   char f_horizontal()   const { return ((TToken_string&)_fink).get_char(9);  }                                               | ||||
|   char f_vertical()     const { return ((TToken_string&)_fink).get_char(10); }                                               | ||||
|    | ||||
|   // editor interface
 | ||||
|   TForm_editor& editor() const; | ||||
|    | ||||
|  | ||||
| @ -49,6 +49,164 @@ void printer_destroy() | ||||
|   }   | ||||
| } | ||||
| 
 | ||||
| // ----------------------------------------------------------------------
 | ||||
| // TPrint_intersector
 | ||||
| // ----------------------------------------------------------------------
 | ||||
| 
 | ||||
| // TPrint_intersector: calcola intersezioni tra elementi grafici e 
 | ||||
| // restituisce, riga per riga, i necessari caratteri di fincatura per
 | ||||
| // finculare in modo carattere
 | ||||
| // usata da viswin e printwin
 | ||||
| class TPrint_intersector : public TString_array | ||||
| { | ||||
|     const char* _fink;     | ||||
| 
 | ||||
|     char check_intersection(int x, int y, char ch); | ||||
|     void h_line(int x1, int y1, int len); | ||||
|     void v_line(int x1, int y1, int len); | ||||
| 
 | ||||
|     // caratteri fincazione: l'ho fatto perche' e' inline                                              
 | ||||
|     char f_topleft()      const { return _fink[0];  }                                               | ||||
|     char f_topmiddle()    const { return _fink[1];  }                                               | ||||
|     char f_topright()     const { return _fink[2];  }                                               | ||||
|     char f_botleft()      const { return _fink[3];  }                                               | ||||
|     char f_botmiddle()    const { return _fink[4];  }                                               | ||||
|     char f_botright()     const { return _fink[5];  }                                               | ||||
|     char f_centerleft()   const { return _fink[6];  }                                               | ||||
|     char f_centermiddle() const { return _fink[7];  }                                               | ||||
|     char f_centerright()  const { return _fink[8];  }                                               | ||||
|     char f_horizontal()   const { return _fink[9];  }                                               | ||||
|     char f_vertical()     const { return _fink[10]; }                                               | ||||
| 
 | ||||
|      | ||||
|   public: | ||||
|                                                                   | ||||
|     // aggiunge un elemento grafico                                                           
 | ||||
|     void add(TGraphic_shape s, int x1, int y1, int x2, int y2); | ||||
|     // aggiunge alla stringa passata i necessari caratteri, leggendo
 | ||||
|     // dalla pagina interna
 | ||||
|     const char* get_chars(int line) const;   | ||||
|     // sbianca tutto
 | ||||
|     void clear(); | ||||
|      | ||||
|     TPrint_intersector(const char* fink, int pagesize) : TString_array(pagesize) , _fink(fink) | ||||
|     {} | ||||
|     virtual ~TPrint_intersector() {} | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| char TPrint_intersector::check_intersection(int x, int y, char ch) | ||||
| {  | ||||
|   char a = ' ', b = ' ', c = ' ', d = ' '; | ||||
|   if (y > 0 && objptr(y-1) != NULL) | ||||
|     b = row(y-1)[x]; | ||||
|   if (objptr(y+1) != NULL) | ||||
|     d = row(y+1)[x]; | ||||
|   if (x > 0) a = row(y)[x-1]; | ||||
|   if (x < row(y).len()-1) c = row(y)[x+1];  | ||||
|    | ||||
|   if (a == ' ' && b == ' ' && c != ' ' && d != ' ') | ||||
|     ch = f_topleft(); | ||||
|   else if (a == ' ' && b != ' ' && c != ' ' && d == ' ') | ||||
|     ch = f_botleft(); | ||||
|   else if (a != ' ' && b != ' ' && c == ' ' && d == ' ') | ||||
|     ch = f_botright(); | ||||
|   else if (a != ' ' && b == ' ' && c == ' ' && d != ' ') | ||||
|     ch = f_topright(); | ||||
|   else if (a != ' ' && b != ' ' && c == ' ' && d != ' ') | ||||
|     ch = f_centerright(); | ||||
|   else if (a == ' ' && b != ' ' && c != ' ' && d != ' ') | ||||
|     ch = f_centerleft(); | ||||
|   else if (a != ' ' && b != ' ' && c != ' ' && d == ' ') | ||||
|     ch = f_botmiddle(); | ||||
|   else if (a != ' ' && b == ' ' && c != ' ' && d != ' ') | ||||
|     ch = f_topmiddle(); | ||||
|   else if ((a != ' ' && b != ' ' && c != ' ' && d != ' ') || | ||||
|            ((a != ' ' && b == ' ' && c != ' ' && d == ' ') && ch == f_vertical()) || | ||||
|            ((a == ' ' && b != ' ' && c == ' ' && d != ' ') && ch == f_horizontal())) | ||||
|     ch = f_centermiddle(); | ||||
|       | ||||
|   return ch; | ||||
| } | ||||
| 
 | ||||
| void TPrint_intersector::h_line(int x1, int y1, int len) | ||||
| {           | ||||
|   if (objptr(y1) == NULL)  | ||||
|   { | ||||
|     TString* ss = new TString(256); | ||||
|     ss->spaces(); | ||||
|     TArray::add(ss, y1); | ||||
|   }        | ||||
|    | ||||
|   TString& s = row(y1); | ||||
|    | ||||
|   for (int i = x1; i < x1+len; i++) | ||||
|     s[i] = f_horizontal(); | ||||
|   for (i = x1; i < x1+len; i++) | ||||
|     s[i] = check_intersection(i, y1, f_horizontal()); | ||||
| } | ||||
| 
 | ||||
| void TPrint_intersector::v_line(int x1, int y1, int len) | ||||
| {   | ||||
|   for (int i = y1; i < y1+len; i++) | ||||
|   { | ||||
|     if (objptr(i) == NULL)  | ||||
|     { | ||||
|       TString* ss = new TString(256); | ||||
|       ss->spaces(); | ||||
|       TArray::add(ss, i); | ||||
|     } | ||||
|     row(i)[x1] = f_vertical(); | ||||
|   } | ||||
|   for (i = y1; i < y1+len; i++) | ||||
|     row(i)[x1] = check_intersection(x1, i, f_vertical()); | ||||
| } | ||||
| 
 | ||||
| void TPrint_intersector::add(TGraphic_shape s, int x1, int y1, int x2, int y2) | ||||
| {      | ||||
|   // rows/columns start at 0
 | ||||
|   x1 --; y1 --; | ||||
|   x2 --; y2 --; | ||||
| 
 | ||||
|   switch (s) | ||||
|   { | ||||
|     case line:    | ||||
|       if (x1 == x2)       // vertical
 | ||||
|         v_line(x1, y1, y2-y1+1); | ||||
|       else if (y1 == y2)  // horizontal
 | ||||
|         h_line(x1,y1, x2-x1+1); | ||||
|       else error_box("Linee oblique non supportate in modalita' testo"); | ||||
|       break; | ||||
|     case box:  | ||||
|       h_line(x1, y1, x2-x1+1); | ||||
|       h_line(x1, y2, x2-x1+1); | ||||
|       v_line(x1, y1, y2-y1+1); | ||||
|       v_line(x2, y1, y2-y1+1); | ||||
|       break; | ||||
|     default: | ||||
|       break; | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| const char* TPrint_intersector::get_chars(int line) const | ||||
| { | ||||
|    if (objptr(line) == NULL) | ||||
|      return ""; | ||||
|    else | ||||
|      return row(line); | ||||
| } | ||||
| 
 | ||||
| void TPrint_intersector::clear() | ||||
| {   | ||||
|   for (int i = 0; i < items(); i++) | ||||
|   { | ||||
|     TString* s = (TString*)objptr(i); | ||||
|     if (s != NULL) | ||||
|       s->spaces(); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| // PrDesc
 | ||||
| ///////////////////////////////////////////////////////////
 | ||||
| @ -122,6 +280,11 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background) | ||||
|   TToken_string tt; | ||||
|   TFilename bmp; | ||||
| 
 | ||||
|   if (!_isgraphics && _finker == NULL) | ||||
|     _finker = new TPrint_intersector(_fink, _formlen); | ||||
|   else if (_finker) | ||||
|     _finker->clear(); | ||||
| 
 | ||||
|   while ((ch = bg_desc[cnt++]) != '\0') | ||||
|   { | ||||
|     op = ch; | ||||
| @ -136,7 +299,6 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background) | ||||
|       continue;             // ignore whitespace
 | ||||
|       break; | ||||
|     case 'i': | ||||
|       tt << op; | ||||
|       cnt++; | ||||
|       for (x1 = 0; bg_desc[cnt] != ','; x1++) | ||||
|         bmp[x1] = bg_desc[cnt++]; | ||||
| @ -148,11 +310,15 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background) | ||||
|       read_int(bg_desc, x2, cnt); if (x2 <= 0) x2 = formwidth(); | ||||
|       read_int(bg_desc, y2, cnt); if (y2 <= 0) y2 = formlen(); | ||||
|       cnt++; | ||||
|       tt.add(id); | ||||
|       tt.add(x1); | ||||
|       tt.add(y1); | ||||
|       tt.add(x2);   | ||||
|       tt.add(y2);   | ||||
|       if (_isgraphics) | ||||
|       { | ||||
|         tt << op; | ||||
|         tt.add(id); | ||||
|         tt.add(x1); | ||||
|         tt.add(y1); | ||||
|         tt.add(x2);   | ||||
|         tt.add(y2);  | ||||
|       }  | ||||
|       break;   | ||||
|     case 'l':               // line
 | ||||
| 
 | ||||
| @ -165,11 +331,19 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background) | ||||
|       read_int (bg_desc, x2, cnt); | ||||
|       read_int (bg_desc, y2, cnt); | ||||
|       cnt++;                // skip separator
 | ||||
|       tt << op; | ||||
|       tt.add (x1 - 1); | ||||
|       tt.add (y1 - 1); | ||||
|       tt.add (x2 - 1); | ||||
|       tt.add (y2 - 1); | ||||
|       if (_isgraphics)  | ||||
|       { | ||||
|         tt << op; | ||||
|         tt.add (x1 - 1); | ||||
|         tt.add (y1 - 1); | ||||
|         tt.add (x2 - 1); | ||||
|         tt.add (y2 - 1);  | ||||
|       } | ||||
|       else | ||||
|       { | ||||
|         TGraphic_shape s = op == 'b' ? box : line; | ||||
|         _finker->add(s, x1, y1, x2, y2); | ||||
|       } | ||||
|       break; | ||||
|     case 't':               // text
 | ||||
|       cnt++; | ||||
| @ -900,9 +1074,14 @@ TPrinter::TPrinter() | ||||
|   _curprn = pn2.get_pos(p1); | ||||
|   CHECKS(_curprn >= 0, "Can't find printer ", (const char*)p1); | ||||
|    | ||||
|   set_fincatura("+++++++++-|");                 | ||||
|                    | ||||
| #else | ||||
|   _isgraphics = FALSE; | ||||
| #endif              | ||||
|   if (_isgraphics) | ||||
|     _finker = NULL; | ||||
|   else _finker = new TPrint_intersector(_fink, _formlen); | ||||
| } | ||||
| 
 | ||||
| TToken_string& TPrinter::getprinternames () | ||||
| @ -1978,6 +2157,9 @@ bool TFile_printer::set () | ||||
|   return ok; | ||||
| } | ||||
|   | ||||
| //
 | ||||
| // TFile printer fine
 | ||||
| // 
 | ||||
| const char* TPrinter::background_chars(int l) const  | ||||
| {  | ||||
|   return _finker == NULL ? "" : _finker->get_chars(l);  | ||||
| } | ||||
|   | ||||
|   | ||||
|  | ||||
| @ -37,6 +37,12 @@ enum TPrtype | ||||
|   export       = 6  // @emem Esporatzione di stampa
 | ||||
|   }; | ||||
| 
 | ||||
| enum TGraphic_shape | ||||
| {  | ||||
|   line, | ||||
|   box | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| // @class TPrintrow | Classe per la definizione della stampa di una riga
 | ||||
| //
 | ||||
| @ -193,6 +199,7 @@ public: | ||||
| 
 | ||||
| 
 | ||||
| class TPrinter; | ||||
| class TPrint_intersector; | ||||
| 
 | ||||
| // @type PRINTSECTIONHANDLER | Funzione definita dall'utente chiamata all'inizio della stampa
 | ||||
| //                           dell'header o del footer
 | ||||
| @ -201,6 +208,7 @@ typedef void (*PRINTSECTIONHANDLER)(TPrinter& printer); | ||||
| typedef void (*LINKHANDLER)(int, const char*); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| class TViswin;                | ||||
| 
 | ||||
| // @class TPrinter | Classe per la definzione delle operazioni sulla stampante
 | ||||
| @ -318,6 +326,14 @@ class TPrinter : public TObject | ||||
|   // @cmember Header del link ipertestuale
 | ||||
|   LINKHANDLER _linkhandler;    | ||||
|    | ||||
|    | ||||
|   // @cmember caratteri per fincatura
 | ||||
|   char _fink[11]; | ||||
|    | ||||
|   // @cmember fincatore per modo testo
 | ||||
|   TPrint_intersector* _finker;  | ||||
| 
 | ||||
|    | ||||
|   // @access Protected Member
 | ||||
| protected: | ||||
|   // @cmember Ritorna il carattere di newline
 | ||||
| @ -481,6 +497,23 @@ public: | ||||
|   bool ismultiplelink() | ||||
|   { return _multiple_link; } | ||||
| 
 | ||||
|   const char* get_fincatura() { return _fink; } | ||||
|   void set_fincatura(const char* s) { strncpy(_fink, s, sizeof(_fink)); } | ||||
|    | ||||
|   // caratteri fincazione                                              
 | ||||
|   char f_topleft()      const { return _fink[0];  }                                               | ||||
|   char f_topmiddle()    const { return _fink[1];  }                                               | ||||
|   char f_topright()     const { return _fink[2];  }                                               | ||||
|   char f_botleft()      const { return _fink[3];  }                                               | ||||
|   char f_botmiddle()    const { return _fink[4];  }                                               | ||||
|   char f_botright()     const { return _fink[5];  }                                               | ||||
|   char f_centerleft()   const { return _fink[6];  }                                               | ||||
|   char f_centermiddle() const { return _fink[7];  }                                               | ||||
|   char f_centerright()  const { return _fink[8];  }                                               | ||||
|   char f_horizontal()   const { return _fink[9];  }                                               | ||||
|   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
 | ||||
| @ -557,6 +590,8 @@ public: | ||||
|   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; } | ||||
|   // @cmember ritorna la riga di background se si stampa in modo testo
 | ||||
|   const char* background_chars(int l) const; | ||||
|     | ||||
|   // @cmember Ritorna la dimensione dei caratteri da stampare 
 | ||||
|   int get_char_size() const | ||||
| @ -722,4 +757,5 @@ TPrinter& printer(); | ||||
| // @func Distrugge la stampante corrente
 | ||||
| void printer_destroy(); | ||||
| 
 | ||||
| 
 | ||||
| #endif  // __PRINTER_H
 | ||||
|  | ||||
| @ -35,10 +35,7 @@ HIDDEN int LEN_SPACES(WINDOW win, int x) | ||||
| void TPrintwin::paint_background(long j) | ||||
| { | ||||
|   const bool isbackground = _bg->items() > 0 && printer().isgraphics(); | ||||
|   if (!isbackground) return;      | ||||
|    | ||||
|   int rw = (int)(j % _formlen); | ||||
|   TString& rwd = (TString&)(*_bg)[rw];   | ||||
|   int cnt = 0; char ch;   | ||||
|    | ||||
|   char curcol  = 'n'; | ||||
| @ -49,6 +46,17 @@ void TPrintwin::paint_background(long j) | ||||
|   unsigned int x1, y1, x2, y2, id;   | ||||
|   PNT b, e; | ||||
| 
 | ||||
|   if (!printer().isgraphics()) | ||||
|   {         | ||||
|     const char* line = printer().background_chars(rw); | ||||
|     set_color (COLOR_BLACK, COLOR_WHITE); | ||||
|     printat (_hofs, (int)j, "%s", line); | ||||
|     return; | ||||
|   } | ||||
|   if (!isbackground) return;      | ||||
| 
 | ||||
|   TString& rwd = (TString&)(*_bg)[rw];   | ||||
| 
 | ||||
|   while (ch = rwd[cnt++]) | ||||
|   {            | ||||
|     switch(ch) | ||||
| @ -193,7 +201,7 @@ void TPrintwin::paint_row(long j) | ||||
|         {   | ||||
|           int len = 0; | ||||
|           for (const char * end = beg; *end && (*end != ' ' || *(end+1) != ' '); end++)  | ||||
|             len++;                                 // Misura sringa da stampare
 | ||||
|             len++;                                 // Misura stringa da stampare
 | ||||
|           xvt_dwin_draw_text(win(), _hofs + LEN_SPACES(win(), pos), y, (char*)beg, len);                            | ||||
|           pos += len;                    | ||||
|           beg = end; | ||||
| @ -205,9 +213,9 @@ void TPrintwin::paint_row(long j) | ||||
|     set_font(printer().fontname(), XVT_FS_NONE, _char_size);                  | ||||
|     TString s(_txt.line(j));                 | ||||
| #if XVT_OS == XVT_OS_WIN | ||||
|     if ((j % _realformlen) == 0 && (j != 0)) // Questa e' la patch per TTY.DRV.
 | ||||
|     if ((j % _realformlen) == 0 && (j != 0)) // Questo e' il patch per TTY.DRV.
 | ||||
|       s.insert("\n");                        // Quando uscira' un nuovo driver, si dovra' controllare 
 | ||||
| #endif                                       // se esiste ancora questo piccolo bug.
 | ||||
| #endif                                       // se esiste ancora questo piccolo bigol.
 | ||||
|     xvt_dwin_draw_text(win(), 0, y, (char*)(const char*)s, -1);                            | ||||
|   }         | ||||
| }                    | ||||
|  | ||||
| @ -676,20 +676,28 @@ void TViswin::paint_screen () | ||||
| 
 | ||||
| 
 | ||||
| // j = riga totale, row = riga a video
 | ||||
| // @mfunc Permette di stampare i colori di bakcground
 | ||||
| // @mfunc Permette di stampare il background
 | ||||
| void TViswin::paint_background ( | ||||
|   long j,       // @parm Numero della riga di cui stamparne il bakcground
 | ||||
|   int row)      // @parm Numero della riga a video sulla quale vine stampato il backgropund
 | ||||
|   long j,       // @parm Numero della riga di cui stampare il background
 | ||||
|   int row)      // @parm Numero della riga a video sulla quale viene stampato il background
 | ||||
| {                        | ||||
|   const int rw = (int) (j % (long) _formlen); | ||||
|   const int ox = (int)origin().x; | ||||
|   const int mx = ox + columns(); | ||||
| 
 | ||||
|   if (!printer().isgraphics()) | ||||
|   {         | ||||
|     const char* line = printer().background_chars(rw); | ||||
|     set_color (COLOR_BLACK, COLOR_WHITE); | ||||
|     if (line != NULL && (int)strlen(line) > ox) | ||||
|       printat (X_OFFSET, row, "%s", &line[ox]); | ||||
|     return; | ||||
|   } | ||||
|   if (_bg->items() == 0) | ||||
|     return; | ||||
|    | ||||
|   const int rw = (int) (j % (long) _formlen); | ||||
|   const TString& rwd = (TString &)(*_bg)[rw]; | ||||
| 
 | ||||
|   const int ox = (int)origin().x; | ||||
|   const int mx = ox + columns(); | ||||
| 
 | ||||
|   char curcol = 'n'; | ||||
|   char curpen = 'n'; | ||||
|   char curpat = 'n'; | ||||
| @ -712,8 +720,8 @@ void TViswin::paint_background ( | ||||
|         b.h = e.h = tabx(2*x1+1) / 2; | ||||
|         b.v = taby(row); | ||||
|         e.v = taby(row + 1); | ||||
|         xvt_dwin_draw_set_pos (win (), b); | ||||
|         xvt_dwin_draw_line (win (), e); | ||||
|         xvt_dwin_draw_set_pos (win(), b); | ||||
|         xvt_dwin_draw_line (win(), e); | ||||
|       }   | ||||
|       break; | ||||
|     case 'o':           // verticale pezzo sopra
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user