Aggiustata merge_export_file

git-svn-id: svn://10.65.10.50/trunk@710 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1994-12-02 10:48:36 +00:00
parent 3195e247e2
commit 4bfb702751
3 changed files with 33 additions and 21 deletions

View File

@ -1,4 +1,4 @@
// $Id: printapp.cpp,v 1.15 1994-11-11 11:23:16 villa Exp $ // $Id: printapp.cpp,v 1.16 1994-12-02 10:48:30 villa Exp $
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
@ -16,20 +16,20 @@ const char *printf_types = "dDiIuUoOxXfeEgGcCnNsSpPrRtT";
// _FieldTok flags // _FieldTok flags
const word LONG_FLAG = 0x0001; const word LONG_FLAG = 0x0001;
const word PICTURE_FLAG = 0x0002; const word PICTURE_FLAG = 0x0002;
const word PAD_FLAG = 0x0004; const word PAD_FLAG = 0x0004;
const word ALIGN_FLAG = 0x0008; const word ALIGN_FLAG = 0x0008;
const word TRANS_FLAG = 0x0010; const word TRANS_FLAG = 0x0010;
const word DATE_FLAG = 0x0020; const word DATE_FLAG = 0x0020;
const word STRING_FLAG = 0x0040; const word STRING_FLAG = 0x0040;
const word NUMBER_FLAG = 0x0080; const word NUMBER_FLAG = 0x0080;
const word DEC_FLAG = 0x0100; const word DEC_FLAG = 0x0100;
const word FONT_FLAG = 0x0200; const word FONT_FLAG = 0x0200;
const word JUMP_FLAG = 0x0400; const word JUMP_FLAG = 0x0400;
const word RECNO_FLAG = 0x0800; const word RECNO_FLAG = 0x0800;
const word BOOLEAN_FLAG = 0x1000; const word BOOLEAN_FLAG = 0x1000;
const word IGNORE_FILL = 0x2000; const word IGNORE_FILL = 0x2000;
// ============================================================= // =============================================================
// print token containers // print token containers
@ -469,6 +469,19 @@ void TPrint_application::fill_page (int from)
} }
} }
void TPrint_application::merge_export_file(const char* file, bool header, bool direct)
{
if (direct) printer().merge_export_file(file, header);
else
{
set_row(_currow+1,"");
TTextfile txt(file);
for (long i = 0l; i < txt.lines(); i++)
set_row(_currow+(int)i+1 + (i == 0l ? 1 : 0), txt.line_formatted(i));
}
}
void TPrint_application::set_row (int r, const char *frmt,...) void TPrint_application::set_row (int r, const char *frmt,...)
{ {
CHECK (r >= 1, "Print rows start at 1"); CHECK (r >= 1, "Print rows start at 1");

View File

@ -461,9 +461,10 @@ public:
{ printer().set_export_file(name,header); } { printer().set_export_file(name,header); }
// infila un file di export fatto da un'altra printer (con formati e tutto, ignora // infila un file di export fatto da un'altra printer (con formati e tutto, ignora
// gli header supponendo che siano gia' presenti nel file) // gli header supponendo che siano gia' presenti nel file)
// se header == TRUE gli header stanno nel file e non vengono stampati // se header == TRUE gli header stanno nel file e non vengono stampati
void merge_export_file(const char* file, bool header = TRUE) // se direct == FALSE le rigne vengono aggiunte con set_row da printapp, altrimenti
{ printer().merge_export_file(file,header); } // si usa printer::merge_export_file
void merge_export_file(const char* file, bool header = TRUE, bool direct = FALSE);
void set_n_copies(int n) { _ncopies = n; } void set_n_copies(int n) { _ncopies = n; }

View File

@ -1330,13 +1330,11 @@ void TPrinter::set()
_printertype = winprinter; _printertype = winprinter;
break; break;
case 1: // file case 1: // file
_printertype = fileprinter; _printertype = fileprinter;
_printerfile = mask.get (MSK_1_FILENAME); _printerfile = mask.get (MSK_1_FILENAME);
_curcode = atoi (mask.get (MSK_1_CODES)); _curcode = atoi (mask.get (MSK_1_CODES));
break; break;
case 2: // video case 2: // video
_printertype = screenvis; _printertype = screenvis;
_curcode = 0; _curcode = 0;
break; break;
@ -1355,15 +1353,15 @@ void TPrinter::set()
void TPrinter::merge_export_file(const char* file, bool header) void TPrinter::merge_export_file(const char* file, bool header)
{ {
TTextfile txt(file); TTextfile txt(file);
for (long i = 0; i < txt.lines(); i++) for (long i = 0; i < txt.lines(); i++)
{ {
TPrintrow* p = new TPrintrow(); TPrintrow* p = new TPrintrow();
p->put(txt.line_formatted(i)); p->put(txt.line_formatted(i));
if (header) printrow(p); if (header) printrow(p);
else print(*p); else print(*p);
} }
} }
void TPrinter::close () void TPrinter::close ()