Patch level :4.0 673
Files correlati : Ricompilazione Demo : [ ] Commento :corretti 46 errori di riporto! git-svn-id: svn://10.65.10.50/trunk@15154 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									797e8900fb
								
							
						
					
					
						commit
						0270efe4ef
					
				@ -918,6 +918,7 @@ bool TBook::open_page()
 | 
			
		||||
  _print_aborted = false;
 | 
			
		||||
  _page_is_open = true;
 | 
			
		||||
  return _page_is_open;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TBook::close_page()
 | 
			
		||||
{
 | 
			
		||||
@ -1399,6 +1400,8 @@ bool TBook::print_page(TWindow& win, size_t page)
 | 
			
		||||
      xvt_dwin_draw_roundrect(w, &rct, rad, rad);
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
    if (str.starts_with("<text"))
 | 
			
		||||
    {
 | 
			
		||||
      TString stringona(512); // Testo completo di un campo
 | 
			
		||||
      while (!ifs.eof())
 | 
			
		||||
      {
 | 
			
		||||
@ -1630,89 +1633,6 @@ void TBook::close_output()
 | 
			
		||||
  _out = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TBook::split_file_if_needed()
 | 
			
		||||
{
 | 
			
		||||
  const int mf = (_max_frame * _phr) / (100 * cpi());   // log2dev dei poveri
 | 
			
		||||
  const int colonne = (mf+_pw-1) / _pw;
 | 
			
		||||
  if (colonne < 2)
 | 
			
		||||
    return false;
 | 
			
		||||
 | 
			
		||||
  TString str(1024);
 | 
			
		||||
  str.format(FR("Spezzatura delle pagine su %d fogli"), colonne);
 | 
			
		||||
 | 
			
		||||
  if (!yesno_box(str))
 | 
			
		||||
    return false;
 | 
			
		||||
  
 | 
			
		||||
  TProgind pi(pages(), str, true, true);
 | 
			
		||||
 | 
			
		||||
  TFilename temp; temp.temp();
 | 
			
		||||
  ofstream out(temp);
 | 
			
		||||
  TPointer_array index;
 | 
			
		||||
  
 | 
			
		||||
  close_output();  // Chiudo file di stampa eventualmente aperto
 | 
			
		||||
  ifstream ifs(_file); // Apro file di stampa da splittare
 | 
			
		||||
 | 
			
		||||
  char* buffer = str.get_buffer();
 | 
			
		||||
  for (unsigned int page = 1; page <= pages(); page++) 
 | 
			
		||||
  {
 | 
			
		||||
    if (!pi.setstatus(page))
 | 
			
		||||
      break;
 | 
			
		||||
    const streampos pos = _index.get_long(page);
 | 
			
		||||
    for (int c = 0; c < colonne; c++)
 | 
			
		||||
    {
 | 
			
		||||
      const TRectangle rct_page(c*_pw, 0, _pw, _ph);
 | 
			
		||||
      
 | 
			
		||||
      ifs.seekg(pos);
 | 
			
		||||
      while (!ifs.eof())
 | 
			
		||||
      {
 | 
			
		||||
        ifs.getline(buffer, str.size());
 | 
			
		||||
        
 | 
			
		||||
        if (str.starts_with("<page "))
 | 
			
		||||
        {
 | 
			
		||||
          const int p = (page-1)*colonne+1+c;
 | 
			
		||||
          index.add_long(out.tellp(), p);
 | 
			
		||||
          str.format("<page number=%d>", p);
 | 
			
		||||
        } else
 | 
			
		||||
        if (str.starts_with("<frame "))
 | 
			
		||||
        {
 | 
			
		||||
          long x, y, dx, dy;
 | 
			
		||||
          sscanf(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
 | 
			
		||||
          str.format("<frame x=%ld y=%ld dx=%ld dy=%ld />", x-rct_page.x, y, dx, dy);
 | 
			
		||||
        } else
 | 
			
		||||
        if (str.starts_with("</page "))
 | 
			
		||||
        {
 | 
			
		||||
          str.format("</page number=%d>", index.last());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        out << str << endl;
 | 
			
		||||
        if (str.starts_with("</page "))
 | 
			
		||||
          break;
 | 
			
		||||
      } 
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  out.close();
 | 
			
		||||
  
 | 
			
		||||
  // Sostituisce il file di stampa con quello splittato ed aggiorna l'indice delle pagine
 | 
			
		||||
  fcopy(temp, _file);
 | 
			
		||||
  xvt_fsys_removefile(temp);
 | 
			
		||||
  _index = index;
 | 
			
		||||
  _pages = _index.last();
 | 
			
		||||
  _max_frame = 0; // Impedisce ulteriore splitting
 | 
			
		||||
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TBook::close_output()
 | 
			
		||||
{
 | 
			
		||||
  if (_out != NULL)
 | 
			
		||||
  {
 | 
			
		||||
    _out->close();
 | 
			
		||||
    delete _out;
 | 
			
		||||
  }
 | 
			
		||||
  _out = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TBook::split_file(int colonne)
 | 
			
		||||
{
 | 
			
		||||
  TProgind pi(pages(), TR("Rigenerazione pagine"), true, true);
 | 
			
		||||
@ -2054,7 +1974,7 @@ bool TBook::print_or_preview()
 | 
			
		||||
 | 
			
		||||
TBook::TBook(const char* name) 
 | 
			
		||||
     : _out(NULL), _is_temporary(false),
 | 
			
		||||
       _pw(0), _ph(0), _pvr(0), _phr(0), _max_frame(0),
 | 
			
		||||
       _pw(0), _ph(0), _pvr(0), _phr(0), _max_frame(0,0),
 | 
			
		||||
       _pages(0), _page(0), _rcd(NULL), _printwin(NULL), _page_is_open(false)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,6 @@ class TBook : public TObject
 | 
			
		||||
  ofstream* _out;             // File di output 
 | 
			
		||||
  TPointer_array _index;      // Indice delle pagine
 | 
			
		||||
  bool _is_temporary;         // Flag di file di output temporaneo             
 | 
			
		||||
  int _max_frame;             // Massimo rettangolo scritto sul file di output
 | 
			
		||||
  
 | 
			
		||||
  DRAW_CTOOLS _tools;
 | 
			
		||||
  TReport_font _font;
 | 
			
		||||
@ -25,7 +24,7 @@ class TBook : public TObject
 | 
			
		||||
  TReport_image_cache _images;
 | 
			
		||||
 | 
			
		||||
  size_t _pagefrom, _pageto, _copies;
 | 
			
		||||
  TPoint _max_frame;
 | 
			
		||||
  TPoint _max_frame;  // Massimo rettangolo scritto sul file di output
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  PRINT_RCD* _rcd;
 | 
			
		||||
@ -44,8 +43,6 @@ protected:
 | 
			
		||||
  void join_file(int pps);
 | 
			
		||||
  bool split_file_if_needed();
 | 
			
		||||
  bool is_pdf() const { return _pdf_file.full(); }
 | 
			
		||||
  void close_output();
 | 
			
		||||
  bool split_file_if_needed();
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  virtual bool open_page();
 | 
			
		||||
@ -81,7 +78,7 @@ public:
 | 
			
		||||
  virtual int logical_page_height() const { return page_size().y * lpi() / page_res().y * 100; }
 | 
			
		||||
  
 | 
			
		||||
  virtual bool print_page(TWindow& win, size_t page);
 | 
			
		||||
	virtual void print_doc(TWindow& win, const TFilename& name);
 | 
			
		||||
//	virtual void print_doc(TWindow& win, const TFilename& name);
 | 
			
		||||
  virtual bool on_link(const TReport_link&) { return false; }
 | 
			
		||||
 | 
			
		||||
  virtual bool print(size_t pagefrom = 0, size_t pageto = 0, size_t copies = 0);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user