From eb9ed8599b78da80e6b8168fd0ee110d66ad452a Mon Sep 17 00:00:00 2001 From: villa Date: Fri, 2 Dec 1994 11:26:36 +0000 Subject: [PATCH] Aggiustata stampa su file sotto windows git-svn-id: svn://10.65.10.50/trunk@711 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/printer.cpp | 32 ++++++++++++++++++++++++++++++-- include/viswin.cpp | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/include/printer.cpp b/include/printer.cpp index 71131d00c..e1564b693 100755 --- a/include/printer.cpp +++ b/include/printer.cpp @@ -632,7 +632,8 @@ bool set_windows_print_device (TMask_field& f, KEY key) pdev << "," << szDevice; // scrivi (e semmai lo si risistema poi) WriteProfileString("windows", "device", pdev); - main_app().printer().set_printrcd(get_print_rcd (&(MainApp ()->printer ().get_printrcdsize ()))); + main_app().printer().set_printrcd( + get_print_rcd(&(main_app().printer ().get_printrcdsize ()))); main_app().printer().set_win_formlen(); } return TRUE; @@ -915,6 +916,18 @@ bool TPrinter::printrow(TPrintrow* rowtoprint) return TRUE; } +#if XVT_OS != XVT_OS_SCOUNIX + + if (_printertype == fileprinter) + { + // add line to txt + if (!_frozen) + _txt.append (rw); + return TRUE; + + } +#else + const PrinterDef & pd = get_description (_curprn); int prvstl = -1; for (idx = 0; idx < lun; idx++) @@ -932,6 +945,8 @@ bool TPrinter::printrow(TPrintrow* rowtoprint) if (newline ()) putc (newline (), _fp); +#endif + return TRUE; } @@ -1102,7 +1117,8 @@ bool TPrinter::open() _linksdescr.items () > 0); _vf->open_modal (); } - else if (_printertype == winprinter || _printertype == export) + else if (_printertype == winprinter || _printertype == export + || _printertype == fileprinter) { // prepare text object for new text _txt.destroy (); @@ -1408,6 +1424,18 @@ else if (_printertype == winprinter && _txt.lines() > 0L) PrintWhat._charsize = _ch_size; start_print_thread (start_winprint, (long) (&PrintWhat)); } +else if (_printertype == fileprinter) +{ + FILE* fp = fopen(_printerfile, "w"); + if (fp == NULL) + { + error_box("Impossibile aprire il file %s", (const char*)_printerfile); + return; + } + for (long i = 0; i < _txt.lines(); i++) + fprintf(fp,"%s\n", _txt.line(i)); + fclose(fp); +} #endif else if (_printertype == localprinter) { diff --git a/include/viswin.cpp b/include/viswin.cpp index d0f4f8dff..9a6cede9d 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -1793,7 +1793,7 @@ bool TViswin::call_editor () TString newfilename; static FILE_SPEC fs; - get_default_dir (&fs.dir); + get_default_dir(&fs.dir); strcpy (fs.type, "txt"); save_dir (); if (save_file_dlg (&fs, "Salva il file con il nome:") == FL_OK)