Corretta ripetizione stampa dopo link; cambiamenti cosmetici
git-svn-id: svn://10.65.10.50/trunk@230 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8097b5d8eb
commit
4e053141b7
@ -1,4 +1,4 @@
|
||||
// $Id: printapp.cpp,v 1.5 1994-08-31 07:29:29 villa Exp $
|
||||
// $Id: printapp.cpp,v 1.6 1994-09-14 07:33:25 villa Exp $
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -77,9 +77,7 @@ class _Token:public TObject
|
||||
{
|
||||
_row = r;
|
||||
}
|
||||
virtual ~ _Token ()
|
||||
{
|
||||
}
|
||||
virtual ~ _Token () {}
|
||||
};
|
||||
|
||||
class _PrintfTok : public _Token
|
||||
@ -94,9 +92,7 @@ class _PrintfTok:public _Token
|
||||
row (rw);
|
||||
_val = val;
|
||||
}
|
||||
virtual ~ _PrintfTok ()
|
||||
{
|
||||
}
|
||||
virtual ~ _PrintfTok () {}
|
||||
};
|
||||
|
||||
class _FieldTok : public _Token
|
||||
@ -150,8 +146,7 @@ class _PrintfRef:public _Token
|
||||
}
|
||||
};
|
||||
|
||||
void TPrint_application ::
|
||||
_reset_tree (link_item * head)
|
||||
void TPrint_application::_reset_tree (link_item * head)
|
||||
{
|
||||
if (head)
|
||||
{
|
||||
@ -163,8 +158,7 @@ _reset_tree (link_item * head)
|
||||
}
|
||||
}
|
||||
|
||||
link_item *TPrint_application ::
|
||||
_look_print_node (link_item * head, int logicnum)
|
||||
link_item *TPrint_application::_look_print_node (link_item * head, int logicnum)
|
||||
{
|
||||
// look for <from> node to attach to
|
||||
// since it reflects a relation, it won't have more than
|
||||
@ -182,14 +176,12 @@ _look_print_node (link_item * head, int logicnum)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
add_file (const char *tab, int from)
|
||||
void TPrint_application::add_file (const char *tab, int from)
|
||||
{
|
||||
add_file (TTable ::name2log (tab), from);
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
add_file (int file, int from)
|
||||
void TPrint_application::add_file (int file, int from)
|
||||
{
|
||||
link_item *nw = new link_item (file);
|
||||
if (_pr_tree == NULL)
|
||||
@ -221,8 +213,7 @@ add_file (int file, int from)
|
||||
|
||||
static char tb[120];
|
||||
|
||||
int TPrint_application ::
|
||||
enable_link (const char *descr, char fg, char bg)
|
||||
int TPrint_application::enable_link (const char *descr, char fg, char bg)
|
||||
{
|
||||
TToken_string *tt = new TToken_string (30);
|
||||
char b[2];
|
||||
@ -236,8 +227,7 @@ enable_link (const char *descr, char fg, char bg)
|
||||
return printer().links ().items () - 1;
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
disable_link (char fg, char bg)
|
||||
void TPrint_application::disable_link (char fg, char bg)
|
||||
{
|
||||
for (int i = 0; i < printer().links ().items (); i++)
|
||||
{
|
||||
@ -253,21 +243,18 @@ disable_link (char fg, char bg)
|
||||
}
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
set_multiple_link (bool on)
|
||||
void TPrint_application::set_multiple_link (bool on)
|
||||
{
|
||||
printer().setmultiplelink (on);
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
_pp_link (int id, const char *text)
|
||||
void TPrint_application::_pp_link (int id, const char *text)
|
||||
{
|
||||
TPrint_application *prapp = (TPrint_application *) MainApp ();
|
||||
prapp->process_link (id, text);
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
_pp_header (TPrinter &)
|
||||
void TPrint_application::_pp_header (TPrinter &)
|
||||
{
|
||||
TPrint_application *prapp = (TPrint_application *) MainApp ();
|
||||
|
||||
@ -282,8 +269,7 @@ _pp_header (TPrinter &)
|
||||
new TPrintrow ((TPrintrow &) (prapp->_header)[i]));
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
_pp_footer (TPrinter &)
|
||||
void TPrint_application::_pp_footer (TPrinter &)
|
||||
{
|
||||
TPrint_application *prapp = (TPrint_application *) MainApp ();
|
||||
|
||||
@ -296,14 +282,12 @@ _pp_footer (TPrinter &)
|
||||
new TPrintrow ((TPrintrow &) (prapp->_footer)[i]));
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
set_background (const char *bgdesc)
|
||||
void TPrint_application::set_background (const char *bgdesc)
|
||||
{
|
||||
printer().setbackground (bgdesc);
|
||||
}
|
||||
|
||||
const char *
|
||||
FLD (int lognum, const char *f, int from, int to)
|
||||
const char* FLD (int lognum, const char *f, int from, int to)
|
||||
{
|
||||
sprintf (tb, "%c|%d|%s|%d|%d", 'n', lognum, f, from, to);
|
||||
char *p = new char[strlen (tb) + 1];
|
||||
@ -311,8 +295,7 @@ FLD (int lognum, const char *f, int from, int to)
|
||||
return p;
|
||||
}
|
||||
|
||||
const char *
|
||||
FLD (int lognum, const char *f, const char *picture)
|
||||
const char* FLD (int lognum, const char *f, const char *picture)
|
||||
{
|
||||
sprintf (tb, "%c|%d|%s|%s", 'p', lognum, f, picture);
|
||||
char *p = new char[strlen (tb) + 1];
|
||||
@ -320,8 +303,7 @@ FLD (int lognum, const char *f, const char *picture)
|
||||
return p;
|
||||
}
|
||||
|
||||
const char *
|
||||
FLD (const char *tabname, const char *f, int from, int to)
|
||||
const char* FLD (const char *tabname, const char *f, int from, int to)
|
||||
{
|
||||
CHECKS (strlen (tabname) < 5, "Invalid table name", tabname);
|
||||
int lognum = TTable ::name2log (tabname);
|
||||
@ -331,8 +313,7 @@ FLD (const char *tabname, const char *f, int from, int to)
|
||||
return p;
|
||||
}
|
||||
|
||||
const char *
|
||||
FLD (const char *tabname, const char *f, const char *picture)
|
||||
const char* FLD (const char *tabname, const char *f, const char *picture)
|
||||
{
|
||||
CHECKS (strlen (tabname) < 5, "Invalid table name", tabname);
|
||||
int lognum = TTable ::name2log (tabname);
|
||||
@ -370,8 +351,7 @@ TString & fill_str (TString & t, char f)
|
||||
// printer().setlinkdescr(descr);
|
||||
// }
|
||||
|
||||
void TPrint_application ::
|
||||
select_cursor (int c)
|
||||
void TPrint_application::select_cursor (int c)
|
||||
{
|
||||
if (c == -1)
|
||||
_cur = NULL;
|
||||
@ -379,8 +359,7 @@ select_cursor (int c)
|
||||
_cur = (TCursor *) & _cursors[c];
|
||||
}
|
||||
|
||||
TCursor *TPrint_application ::
|
||||
get_cursor (int c)
|
||||
TCursor* TPrint_application::get_cursor (int c)
|
||||
{
|
||||
if (c == -1)
|
||||
return NULL;
|
||||
@ -388,8 +367,7 @@ get_cursor (int c)
|
||||
return (TCursor *) & _cursors[c];
|
||||
}
|
||||
|
||||
int TPrint_application ::
|
||||
add_cursor (TCursor * c)
|
||||
int TPrint_application::add_cursor (TCursor * c)
|
||||
{
|
||||
if (c == NULL)
|
||||
return -1;
|
||||
@ -398,8 +376,7 @@ add_cursor (TCursor * c)
|
||||
return _cursors.items () - 1;
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
reset_row (int r)
|
||||
void TPrint_application::reset_row (int r)
|
||||
{
|
||||
r--;
|
||||
int tmp = _rows.items ();
|
||||
@ -417,16 +394,14 @@ reset_row (int r)
|
||||
_maxrow--;
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
reset_print ()
|
||||
void TPrint_application::reset_print ()
|
||||
{
|
||||
_rows.destroy ();
|
||||
_maxrow = 0;
|
||||
_print_defined = FALSE;
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
set_header (int r, const char *fmt,...)
|
||||
void TPrint_application::set_header (int r, const char *fmt,...)
|
||||
{
|
||||
CHECK (r >= 1, "Header rows start at 1");
|
||||
va_list vl;
|
||||
@ -443,8 +418,7 @@ set_header (int r, const char *fmt,...)
|
||||
pp->put (__tmp_string);
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
set_footer (int r, const char *fmt,...)
|
||||
void TPrint_application::set_footer (int r, const char *fmt,...)
|
||||
{
|
||||
CHECK (r >= 1, "Footer rows start at 1");
|
||||
va_list vl;
|
||||
@ -460,22 +434,19 @@ set_footer (int r, const char *fmt,...)
|
||||
pp->put (__tmp_string);
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
reset_header ()
|
||||
void TPrint_application::reset_header ()
|
||||
{
|
||||
_header.destroy ();
|
||||
printer().resetheader ();
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
reset_footer ()
|
||||
void TPrint_application::reset_footer ()
|
||||
{
|
||||
_footer.destroy ();
|
||||
printer().resetfooter ();
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
fill_page (int from)
|
||||
void TPrint_application::fill_page (int from)
|
||||
{
|
||||
from--;
|
||||
for (int i = (from == -1 ? _maxrow : from); i <= printer().formlen (); i++)
|
||||
@ -485,8 +456,7 @@ fill_page (int from)
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
@ -777,8 +747,7 @@ set_row (int r, const char *frmt,...)
|
||||
va_end (params);
|
||||
}
|
||||
|
||||
void TPrint_application ::
|
||||
set_translation (int lognum, const char *field,
|
||||
void TPrint_application::set_translation (int lognum, const char *field,
|
||||
const char *from, const char *to)
|
||||
{
|
||||
_transtab.add (new _Transfield (lognum, field, from, to));
|
||||
@ -791,6 +760,9 @@ void TPrint_application::print ()
|
||||
if (!printer().open ())
|
||||
return;
|
||||
|
||||
// only external apps can change it
|
||||
_repeat_print = FALSE;
|
||||
|
||||
// never print multiple copies if printer is viswin
|
||||
// only application may repeat printing by setting _repeat_print
|
||||
int nc = printer().printtype() == screenvis ? 1 : _ncopies;
|
||||
@ -801,9 +773,8 @@ void TPrint_application::print ()
|
||||
if (_cur == NULL)
|
||||
{
|
||||
//************************************************
|
||||
while (_repeat_print || nc--)
|
||||
while (nc--)
|
||||
{
|
||||
_repeat_print = FALSE;
|
||||
|
||||
int cnt = 0;
|
||||
bool ok = TRUE;
|
||||
@ -830,9 +801,8 @@ void TPrint_application::print ()
|
||||
else
|
||||
{
|
||||
// cursor exists *********************************************
|
||||
while (_repeat_print || nc--)
|
||||
while (nc--)
|
||||
{
|
||||
_repeat_print = FALSE;
|
||||
(*_cur) = 0l;
|
||||
_cur->freeze (TRUE);
|
||||
|
||||
@ -850,7 +820,7 @@ void TPrint_application::print ()
|
||||
_prind = NULL;
|
||||
}
|
||||
}
|
||||
// ************************************************************************
|
||||
// ****************************************************************
|
||||
}
|
||||
if (printer().isopen ())
|
||||
{
|
||||
@ -861,8 +831,7 @@ void TPrint_application::print ()
|
||||
postclose_print ();
|
||||
}
|
||||
|
||||
bool TPrint_application ::
|
||||
print_tree (link_item * head)
|
||||
bool TPrint_application::print_tree (link_item * head)
|
||||
{
|
||||
bool go = TRUE;
|
||||
while (head)
|
||||
@ -1242,7 +1211,7 @@ void TPrint_application::do_print (int n)
|
||||
{
|
||||
while (set_print (n))
|
||||
{
|
||||
print ();
|
||||
do { print(); } while (_repeat_print);
|
||||
enable_print_menu ();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user