msksheet.cpp Tolto errore fatale di update di due righe dello sheet

printer.cpp  Gestione del tasto stampa dell'anteprima ristampando il textfile
printer.h    Aggiunta funzione print_txt per gestire la stampa o ristampa
viswin.h     Aggiunto metodo per ritornare il Textfile interno per la ristampa


git-svn-id: svn://10.65.10.50/trunk@1589 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-07-12 15:59:19 +00:00
parent 85e73d9aa5
commit 79c2bab453
4 changed files with 38 additions and 22 deletions

View File

@ -1028,8 +1028,17 @@ void TSpreadsheet::mask2str(int rec)
#endif #endif
} }
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
CHECK(_needs_update == -1 || _needs_update == rec, "Can't update two records"); if (_needs_update != rec)
_needs_update = rec; {
if (_needs_update >= 0)
{
#ifdef DBG
warning_box("Double update: %d and %d", _needs_update, rec);
#endif
update_rec(_needs_update);
}
_needs_update = rec;
}
#endif #endif
} }

View File

@ -816,7 +816,7 @@ HIDDEN bool font_handler(TMask_field& f, KEY key)
TPrinter::TPrinter() TPrinter::TPrinter()
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE), : _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12), _ncopies(1), _export_header(FALSE), _lines_per_inch (6), _ch_size (12), _ncopies(1), _export_header(FALSE),
_export_header_len(0) _export_header_len(0), _vf(NULL)
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
, _print_rcd(NULL) , _print_rcd(NULL)
#endif #endif
@ -1370,7 +1370,8 @@ bool TPrinter::open()
else else
#endif #endif
if (_printertype == screenvis) 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); _linksdescr.items () > 0);
_vf->open_modal (); _vf->open_modal ();
@ -1649,6 +1650,20 @@ int TPrinter::set_bookmark(const char* txt, int father)
} }
void TPrinter::print_txt(TTextfile& txt)
{
#if XVT_OS == XVT_OS_WIN
PrintWhat._prcd = _print_rcd;
PrintWhat._txt = &txt;
PrintWhat._graphics = _isgraphics;
PrintWhat._charsize = _ch_size;
xvt_print_open();
xvt_print_start_thread (start_winprint, (long) (&PrintWhat));
xvt_print_close();
#endif
}
void TPrinter::close () void TPrinter::close ()
{ {
const bool isfirstpage = (_currentpage == 1 && _frompage == 0) || const bool isfirstpage = (_currentpage == 1 && _frompage == 0) ||
@ -1670,42 +1685,32 @@ void TPrinter::close ()
_vf->close_print(); _vf->close_print();
const KEY key = _vf->run (); const KEY key = _vf->run ();
if (_vf->is_open ()) _vf->close_modal (); if (_vf->is_open ()) _vf->close_modal ();
delete _vf; _bookmarks.destroy();
freeze (FALSE); freeze (FALSE);
_bookmarks.destroy();
_vf = NULL;
if (key == K_CTRL+'S') if (key == K_CTRL+'S')
{ {
_isopen = FALSE; _isopen = FALSE;
_currentrow = _currentpage = 1; _currentrow = _currentpage = 1;
_printertype = winprinter; print_txt(_vf->text());
main_app().print();
_printertype = screenvis;
} }
delete _vf; _vf = NULL;
} }
else if (_printertype == export) else if (_printertype == export)
{ {
if (!_exportfile.empty() && _txt.lines() > 0L) if (_exportfile.not_empty() && _txt.lines() > 0L)
{ {
ofstream txt((const char*)_exportfile); ofstream txt((const char*)_exportfile);
for (long i = 0; i < _txt.lines(); i++) for (long i = 0; i < _txt.lines(); i++)
{
txt << _txt.line_formatted(i) << '\n'; txt << _txt.line_formatted(i) << '\n';
}
txt.close(); txt.close();
} }
} }
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
else if (_printertype == winprinter && _txt.lines() > 0L) else if (_printertype == winprinter && _txt.lines() > 0L)
{ {
PrintWhat._prcd = _print_rcd; print_txt(_txt);
PrintWhat._txt = &_txt;
PrintWhat._graphics = _isgraphics;
PrintWhat._charsize = _ch_size;
xvt_print_open();
xvt_print_start_thread (start_winprint, (long) (&PrintWhat));
xvt_print_close();
} }
else if (_printertype == fileprinter) else if (_printertype == fileprinter)
{ {
@ -1817,7 +1822,6 @@ TFile_printer::~TFile_printer ()
bool TFile_printer::set () bool TFile_printer::set ()
{ {
TMask m ("bagn004"); TMask m ("bagn004");
KEY tasto;
int f; int f;
// //

View File

@ -201,6 +201,7 @@ protected:
bool printfooter(); bool printfooter();
void save_configuration(); void save_configuration();
void print_txt(TTextfile& txt);
public: public:

View File

@ -153,7 +153,9 @@ public:
void close_print(); void close_print();
bool frozen() { return _frozen; } bool frozen() { return _frozen; }
void abort_print(); void abort_print();
long lines() { return _txt.lines(); } long lines() { return _txt.lines(); }
TTextfile& text() { return _txt; }
void goto_end(); void goto_end();
void goto_top(); void goto_top();