Aggiustata stampa su file sotto windows

git-svn-id: svn://10.65.10.50/trunk@711 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1994-12-02 11:26:36 +00:00
parent 4bfb702751
commit eb9ed8599b
2 changed files with 31 additions and 3 deletions

View File

@ -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)
{

View File

@ -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)