Aggiunta possibilita' di stampa copie multiple e opzione per rifare la

stampa dopo un 'link' da viswin


git-svn-id: svn://10.65.10.50/trunk@107 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
villa 1994-08-31 07:29:38 +00:00
parent da21d18988
commit 1ba40c21b0
8 changed files with 886 additions and 874 deletions

View File

@ -4,17 +4,18 @@
#define MSK_1_FILENAME 102 #define MSK_1_FILENAME 102
#define MSK_1_PRINTERS 103 #define MSK_1_PRINTERS 103
#define MSK_1_CODES 111 #define MSK_1_CODES 111
// IMPORTANTE! lasciare il numero 111, // IMPORTANTE! lasciare il numero 111,
// in modo che la maschera sia compatibile // in modo che la maschera sia compatibile
// con i metodi di ba2300, usati anche // con i metodi di ba2300, usati anche
// da printer // da printer
#define MSK_1_SAVE 112 #define MSK_1_SAVE 112
#define MSK_1_SETUP 333 #define MSK_1_SETUP 333
#define MSK_1_ISGRAPHICS 334 #define MSK_1_ISGRAPHICS 334
#define MSK_1_SIZE 335 #define MSK_1_SIZE 335
#define MSK_1_LINES 336 #define MSK_1_LINES 336
#define MSK_1_NPAGES 337
#define MSK_1_PRINTERFILE prn.epf #define MSK_1_PRINTERFILE prn.epf
#define MSK_1_NAMESFILE nms.epf #define MSK_1_NAMESFILE nms.epf
#define PRINTERSFILE "prn.epf" #define PRINTERSFILE "prn.epf"
#define NAMESFILE "nms.epf" #define NAMESFILE "nms.epf"

View File

@ -88,6 +88,11 @@ BEGIN
HELP "Selezionare il numero di linee per pollice" HELP "Selezionare il numero di linee per pollice"
END END
NUMBER MSK_1_NPAGES 3 0
BEGIN
PROMPT 57 7 "N.o copie "
END
BUTTON DLG_OK 9 2 BUTTON DLG_OK 9 2
BEGIN BEGIN

View File

@ -401,7 +401,8 @@ break;
const int col = cid - FIRST_FIELD; const int col = cid - FIRST_FIELD;
TMask_field* f = field(cid); TMask_field* f = field(cid);
src = row(rec).get(col); // Set value for cell src = row(rec).get(col); // Set value for cell
if (src && *src && (f->class_id()==CLASS_REAL_FIELD || f->class_id()==CLASS_DATE_FIELD)) if (src && *src && (f->class_id() == CLASS_REAL_FIELD
|| f->class_id() == CLASS_DATE_FIELD))
{ {
src = f->picture_data(src, FALSE); // Get formatted string src = f->picture_data(src, FALSE); // Get formatted string
} }

View File

@ -1,4 +1,4 @@
// $Id: printapp.cpp,v 1.4 1994-08-29 11:04:37 alex Exp $ // $Id: printapp.cpp,v 1.5 1994-08-31 07:29:29 villa Exp $
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
@ -784,57 +784,73 @@ set_translation (int lognum, const char *field,
_transtab.add (new _Transfield (lognum, field, from, to)); _transtab.add (new _Transfield (lognum, field, from, to));
} }
void TPrint_application :: void TPrint_application::print ()
print ()
{ {
// open printer if needed // open printer if needed
if (!(printer ().isopen ())) if (!(printer ().isopen ()))
if (!printer ().open ()) if (!printer ().open ())
return; return;
// never print multiple copies if printer is viswin
// only application may repeat printing by setting _repeat_print
int nc = printer().printtype() == screenvis ? 1 : _ncopies;
// NULL cursor passed only prints once // NULL cursor passed only prints once
// pre and post process do everything // pre and post process do everything
if (_cur == NULL) if (_cur == NULL)
{ {
int cnt = 0; //************************************************
bool ok = TRUE; while (_repeat_print || nc--)
do {
{ _repeat_print = FALSE;
if (preprocess_print (0, cnt))
int cnt = 0;
bool ok = TRUE;
do
{ {
int cnt2 = 0; if (preprocess_print (0, cnt))
do {
{ int cnt2 = 0;
if (preprocess_page (0, cnt2)) do
{ {
set_page (0, cnt2); if (preprocess_page (0, cnt2))
ok = print_one (0); {
} set_page (0, cnt2);
} ok = print_one (0);
while (ok && postprocess_page (0, cnt2++) == REPEAT_PAGE); }
} }
} while (ok && postprocess_page (0, cnt2++) == REPEAT_PAGE);
while (ok && postprocess_print (0, cnt++) == REPEAT_PAGE); }
}
while (ok && postprocess_print (0, cnt++) == REPEAT_PAGE);
// *****************************************************
}
} }
else else
{ {
// cursor exists // cursor exists *********************************************
(*_cur) = 0l; while (_repeat_print || nc--)
_cur->freeze (TRUE); {
_repeat_print = FALSE;
(*_cur) = 0l;
_cur->freeze (TRUE);
if (_cur->items () >= _wthr && if (_cur->items () >= _wthr &&
(_force_progind || printer ().printtype () != screenvis)) (_force_progind || printer ().printtype () != screenvis))
_prind = new TProgind (_cur->items (), _prind = new TProgind (_cur->items (),
(char *) (const char *) _wmess, (char *) (const char *) _wmess,
_wcancel, _wbar, 35); _wcancel, _wbar, 35);
print_tree (_pr_tree); print_tree (_pr_tree);
_cur->freeze (FALSE); _cur->freeze (FALSE);
if (_prind) if (_prind)
{ {
delete _prind;; delete _prind;;
_prind = NULL; _prind = NULL;
} }
}
// ************************************************************************
} }
if (printer().isopen ()) if (printer().isopen ())
{ {
@ -893,8 +909,7 @@ print_tree (link_item * head)
return go; return go;
} }
bool TPrint_application :: bool TPrint_application::print_one (int file)
print_one (int file)
{ {
int i = 0; int i = 0;
@ -1257,6 +1272,8 @@ TPrint_application::TPrint_application ():TApplication (), _transtab (10),
_footer (10), _rows (100) _footer (10), _rows (100)
{ {
_cur = NULL; _cur = NULL;
_repeat_print = FALSE;
_ncopies = 1;
_currow = _maxrow = 0; _currow = _maxrow = 0;
_auto_ff = FALSE; _auto_ff = FALSE;
_wbar = _wcancel = TRUE; _wbar = _wcancel = TRUE;

View File

@ -43,7 +43,7 @@ struct link_item {
int _cnt; int _cnt;
link_item(int l) link_item(int l)
{ _logicnum = l; _son = NULL; _brother = NULL; _cnt = 0; } { _logicnum = l; _son = NULL; _brother = NULL; _cnt = 0; }
}; };
class TProgind; class TProgind;
@ -76,6 +76,8 @@ class TPrint_application : public TApplication
TProgind* _prind; TProgind* _prind;
const char* _picture; const char* _picture;
MENU_TAG _last_choice; MENU_TAG _last_choice;
int _ncopies;
bool _repeat_print;
// set the printer // set the printer
void set_printer() { printer().set(); } void set_printer() { printer().set(); }
@ -182,23 +184,23 @@ protected:
// returning FALSE cancels page printing // returning FALSE cancels page printing
// counter is the current print page number // counter is the current print page number
virtual bool preprocess_page(int file, int counter) virtual bool preprocess_page(int file, int counter)
{ return TRUE; } { return TRUE; }
// same before each print request // same before each print request
// e.g. to initialize counters // e.g. to initialize counters
// returning FALSE cancels print request or subtree // returning FALSE cancels print request or subtree
virtual bool preprocess_print(int file, int counter) virtual bool preprocess_print(int file, int counter)
{ return TRUE; } { return TRUE; }
// postprocessing; returning REPEAT_PAGE reprints the // postprocessing; returning REPEAT_PAGE reprints the
// whole page (after all sons are printed) or print // whole page (after all sons are printed) or print
// counter is the current page or print number // counter is the current page or print number
virtual print_action postprocess_page(int file, int counter) virtual print_action postprocess_page(int file, int counter)
{ return NEXT_PAGE; } { return NEXT_PAGE; }
virtual print_action postprocess_print(int file, int counter) virtual print_action postprocess_print(int file, int counter)
{ return NEXT_PAGE; } { return NEXT_PAGE; }
// executed after all print job is completed // executed after all print job is completed
virtual void postclose_print() {} virtual void postclose_print() {}
// called when LINK button is pressed with active selection in // called when LINK button is pressed with active selection in
// preview window // preview window
@ -291,16 +293,16 @@ public:
// di foreground, opzionalmente seguito da una virgola e dal // di foreground, opzionalmente seguito da una virgola e dal
// colore di background (bianco per default). I colori si // colore di background (bianco per default). I colori si
// specificano con un singolo carattere come segue: // specificano con un singolo carattere come segue:
// n nero // n nero
// g verde // g verde
// b blu // b blu
// c cyan // c cyan
// y giallo // y giallo
// v magenta // v magenta
// m colore background maschere (azzurrotto) // m colore background maschere (azzurrotto)
// d grigio scuro // d grigio scuro
// l grigio chiaro // l grigio chiaro
// k grigio normale // k grigio normale
// ------------------------------------------------------ // ------------------------------------------------------
// Se si fa enable_link(..) con un certo colore, tutto // Se si fa enable_link(..) con un certo colore, tutto
// cio; che e' scritto in quel colore diventa selezionabile // cio; che e' scritto in quel colore diventa selezionabile
@ -329,9 +331,7 @@ public:
// Il posto giusto per chiamarla: user_create() // Il posto giusto per chiamarla: user_create()
// --------------------------------------------- // ---------------------------------------------
void set_translation(int lognum, const char* field, void set_translation(int lognum, const char* field,
const char* from, const char* to); const char* from, const char* to);
// -------------------------------------------------------- // --------------------------------------------------------
@ -379,14 +379,14 @@ public:
// set_auto_ff(TRUE) fa si' che dopo ogni pagina logica (relativa ad // set_auto_ff(TRUE) fa si' che dopo ogni pagina logica (relativa ad
// un record) si stampi un form feed. (anche se il cursore e' nullo) // un record) si stampi un form feed. (anche se il cursore e' nullo)
void set_auto_ff( bool b = TRUE) void set_auto_ff( bool b = TRUE)
{ _auto_ff = b; } { _auto_ff = b; }
// il carattere specificato con set_fillchar (default ' ') viene // il carattere specificato con set_fillchar (default ' ') viene
// usato per riempire davanti e dietro i campi in cui si e' specificata // usato per riempire davanti e dietro i campi in cui si e' specificata
// una dimensione maggiore della lunghezza effettiva del contenuto, // una dimensione maggiore della lunghezza effettiva del contenuto,
// (a meno che non si sia usato un codice di formato maiuscolo) // (a meno che non si sia usato un codice di formato maiuscolo)
void set_fillchar(char c) void set_fillchar(char c)
{ _fillchar = c; } { _fillchar = c; }
// riempie di righe vuote la pagina corrente fino alla dimensione // riempie di righe vuote la pagina corrente fino alla dimensione
// della pagina // della pagina
@ -427,35 +427,40 @@ public:
// progress indicator control // progress indicator control
void set_wait_message(const char* m) void set_wait_message(const char* m)
{ _wmess = m; } { _wmess = m; }
void set_wait_bar(bool m) void set_wait_bar(bool m)
// default yes // default yes
{ _wbar = m; } { _wbar = m; }
void set_wait_cancel(bool m) void set_wait_cancel(bool m)
// default yes // default yes
{ _wcancel = m; } { _wcancel = m; }
void set_wait_threshold(int m) void set_wait_threshold(int m)
// minimum number of print items to show progress indicator; // minimum number of print items to show progress indicator;
// default 2 // default 2
{ _wthr = m; } { _wthr = m; }
// questa forza la progind anche se si stampa su video // questa forza la progind anche se si stampa su video
void force_progind(bool b = TRUE) void force_progind(bool b = TRUE)
{ _force_progind = b; } { _force_progind = b; }
// questa forza la rilettura delle setrow in set_page ad ogni // questa forza la rilettura delle setrow in set_page ad ogni
// record stampato, in modo che i dati siano // record stampato, in modo che i dati siano
// sempre quelli del record corrente anche se si usano codici % // sempre quelli del record corrente anche se si usano codici %
// s'intende che rallenta un po' la stampa // s'intende che rallenta un po' la stampa
void force_setpage(bool b = TRUE) void force_setpage(bool b = TRUE)
{ _force_setpage = b; } { _force_setpage = b; }
void set_config_file(const char* s) void set_config_file(const char* s)
{ _confpr = s; } { _confpr = s; }
word get_page_number() word get_page_number()
{ return printer().getcurrentpage(); } { return printer().getcurrentpage(); }
void set_page_number(word n) void set_page_number(word n)
{ printer().setcurrentpage(n); } { printer().setcurrentpage(n); }
void set_n_copies(int n) { _ncopies = n; }
int get_n_copies() { return _ncopies; }
void repeat_print() { _repeat_print = TRUE; }
TPrint_application(); TPrint_application();
virtual ~TPrint_application(); virtual ~TPrint_application();

View File

@ -14,7 +14,7 @@
#include <mask.h> #include <mask.h>
#include <utility.h> #include <utility.h>
#include <viswin.h> #include <viswin.h>
#include <applicat.h> #include <printapp.h>
#include <extcdecl.h> #include <extcdecl.h>
#include <printer.h> #include <printer.h>
@ -298,8 +298,7 @@ bool printers_on_key (TMask_field & f, KEY key);
// fv support structs for config // fv support structs for config
bool PrinterDef :: bool PrinterDef::read (const char *name, FILE * fd)
read (const char *name, FILE * fd)
{ {
_printername = name; _printername = name;
_printername.trim (); _printername.trim ();
@ -380,10 +379,9 @@ read (const char *name, FILE * fd)
return TRUE; return TRUE;
} }
bool PrinterDef :: bool PrinterDef::isdefault ()
isdefault ()
{ {
return strcmp (_printername, "Default") == 0; return strcmp(_printername, "Default") == 0;
} }
////////// TPRINTROW ////////// ////////// TPRINTROW //////////
@ -407,15 +405,12 @@ TPrintrow ::TPrintrow (const TPrintrow & pr)
_lastpos = pr._lastpos; _lastpos = pr._lastpos;
} }
TObject *TPrintrow :: TObject *TPrintrow::dup () const
dup ()
const
{ {
return new TPrintrow (*this); return new TPrintrow (*this);
} }
const char *TPrintrow ::class_name () const char *TPrintrow ::class_name () const
const
{ {
return "Printrow"; return "Printrow";
} }
@ -441,8 +436,7 @@ reset ()
return *this; return *this;
} }
const char *TPrintrow :: const char *TPrintrow::row_codified ()
row_codified ()
{ {
// returns the row with @-codes for font style and color // returns the row with @-codes for font style and color
char last_attr = -1; char last_attr = -1;
@ -488,7 +482,7 @@ row_codified ()
return __tmp_string; return __tmp_string;
} }
TPrintrow & TPrintrow ::put (const char *str, int position, int len) TPrintrow & TPrintrow::put(const char *str, int position, int len)
{ {
if (len < 1) if (len < 1)
len = strlen (str); len = strlen (str);
@ -609,8 +603,7 @@ TPrintrow & TPrintrow ::put (const char *str, int position, int len)
////////// TPRINTER ////////// ////////// TPRINTER //////////
bool bool printers_on_key (TMask_field & f, KEY key)
printers_on_key (TMask_field & f, KEY key)
{ {
if (key == K_SPACE) if (key == K_SPACE)
{ {
@ -632,8 +625,7 @@ printers_on_key (TMask_field & f, KEY key)
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
bool bool set_windows_print_device (TMask_field & f, KEY key)
set_windows_print_device (TMask_field & f, KEY key)
{ {
static char szDevice[80]; static char szDevice[80];
if (key == K_SPACE) if (key == K_SPACE)
@ -834,29 +826,25 @@ setfooterline (int linetoset, TPrintrow * line)
// if (linetoset >= _footersize) _footersize = linetoset+1; // if (linetoset >= _footersize) _footersize = linetoset+1;
} }
void TPrinter :: void TPrinter::setfooterline (int linetoset, const TPrintrow & line)
setfooterline (int linetoset, const TPrintrow & line)
{ {
TPrintrow *p = new TPrintrow (line); TPrintrow *p = new TPrintrow (line);
setfooterline (linetoset, p); setfooterline (linetoset, p);
} }
void TPrinter :: void TPrinter::resetheader ()
resetheader ()
{ {
_header.destroy (); _header.destroy ();
_headersize = 0; _headersize = 0;
} }
void TPrinter :: void TPrinter::resetfooter ()
resetfooter ()
{ {
_footer.destroy (); _footer.destroy ();
// _footersize = 0; // _footersize = 0;
} }
bool TPrinter :: bool TPrinter::printrow (TPrintrow * rowtoprint)
printrow (TPrintrow * rowtoprint)
{ {
if (!isopen ()) if (!isopen ())
return FALSE; return FALSE;
@ -931,9 +919,7 @@ printrow (TPrintrow * rowtoprint)
return TRUE; return TRUE;
} }
word TPrinter :: word TPrinter::rows_left () const
rows_left ()
const
{ {
word left = _formlen - _currentrow - _footersize + 1; word left = _formlen - _currentrow - _footersize + 1;
if (_currentrow < 2) if (_currentrow < 2)
@ -961,8 +947,7 @@ bool TPrinter ::print (TPrintrow & rowtoprint)
return ok; return ok;
} }
bool TPrinter :: bool TPrinter::printheader ()
printheader ()
{ {
if (_headerhandler) if (_headerhandler)
_headerhandler (*this); _headerhandler (*this);
@ -975,8 +960,7 @@ printheader ()
return ok; return ok;
} }
bool TPrinter :: bool TPrinter::printfooter ()
printfooter ()
{ {
if (_footerhandler) if (_footerhandler)
_footerhandler (*this); _footerhandler (*this);
@ -996,8 +980,7 @@ printfooter ()
return ok; return ok;
} }
bool TPrinter :: bool TPrinter::skip (int linestoskip)
skip (int linestoskip)
{ {
int jumpline; int jumpline;
@ -1006,8 +989,7 @@ skip (int linestoskip)
return jump (jumpline); return jump (jumpline);
} }
bool TPrinter :: bool TPrinter::jump (int jumpline)
jump (int jumpline)
{ {
int i = 0; int i = 0;
bool ok = TRUE; bool ok = TRUE;
@ -1024,8 +1006,7 @@ jump (int jumpline)
return ok; return ok;
} }
bool TPrinter :: bool TPrinter::formfeed ()
formfeed ()
{ {
const int lastrow = _formlen - _footersize; const int lastrow = _formlen - _footersize;
for (; _currentrow <= lastrow; _currentrow++) for (; _currentrow <= lastrow; _currentrow++)
@ -1033,8 +1014,7 @@ formfeed ()
return printfooter (); return printfooter ();
} }
void TPrinter :: void TPrinter::reset ()
reset ()
{ {
resetheader (); resetheader ();
resetfooter (); resetfooter ();
@ -1042,8 +1022,7 @@ reset ()
_currentrow = 1; _currentrow = 1;
} }
bool TPrinter :: bool TPrinter::printformfeed ()
printformfeed ()
{ {
#if XVT_OS != XVT_OS_WIN #if XVT_OS != XVT_OS_WIN
const PrinterDef & pd = get_description (_curprn); const PrinterDef & pd = get_description (_curprn);
@ -1054,8 +1033,7 @@ printformfeed ()
return TRUE; return TRUE;
} }
bool TPrinter :: bool TPrinter::open ()
open ()
{ {
// qui // qui
#if XVT_OS==XVT_OS_SCOUNIX #if XVT_OS==XVT_OS_SCOUNIX
@ -1139,10 +1117,9 @@ open ()
return _isopen = TRUE; return _isopen = TRUE;
} }
void TPrinter :: void TPrinter::set()
set ()
{ {
TMask mask ("bagn001a.msk"); TMask mask ("bagn001a");
TToken_string pn1 (50), pn2 (100); TToken_string pn1 (50), pn2 (100);
int i; int i;
@ -1176,6 +1153,7 @@ set ()
mask.set (MSK_1_PRINTERS, format ("%d", _curprn)); mask.set (MSK_1_PRINTERS, format ("%d", _curprn));
mask.set (MSK_1_CODES, format ("%d", _curcode)); mask.set (MSK_1_CODES, format ("%d", _curcode));
mask.set (MSK_1_FILENAME, _printerfile); mask.set (MSK_1_FILENAME, _printerfile);
mask.set (MSK_1_NPAGES, format("%d",((TPrint_application*)MainApp())->get_n_copies()));
mask.reset (MSK_1_SAVE); mask.reset (MSK_1_SAVE);
if (mask.run () == K_ESC) if (mask.run () == K_ESC)
@ -1194,6 +1172,7 @@ set ()
// get user choices // get user choices
_curprn = atoi (mask.get (MSK_1_PRINTERS)); _curprn = atoi (mask.get (MSK_1_PRINTERS));
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
PrinterDef & def = (PrinterDef &) get_description (_curprn); PrinterDef & def = (PrinterDef &) get_description (_curprn);
switch (atoi (mask.get (MSK_1_TYPE))) switch (atoi (mask.get (MSK_1_TYPE)))
{ {
@ -1263,6 +1242,7 @@ set ()
mask.set (MSK_1_ISGRAPHICS, _isgraphics ? "X" : ""); mask.set (MSK_1_ISGRAPHICS, _isgraphics ? "X" : "");
mask.set (MSK_1_SIZE, format ("%d", _ch_size)); mask.set (MSK_1_SIZE, format ("%d", _ch_size));
mask.set (MSK_1_LINES, format ("%d", _lines_per_inch)); mask.set (MSK_1_LINES, format ("%d", _lines_per_inch));
mask.set (MSK_1_NPAGES, format("%d",((TPrint_application*)MainApp())->get_n_copies()));
if (_printertype == fileprinter) if (_printertype == fileprinter)
mask.set (MSK_1_TYPE, "1"); mask.set (MSK_1_TYPE, "1");
@ -1319,7 +1299,7 @@ set ()
mask.set_workfile (s); mask.set_workfile (s);
mask.save (); mask.save ();
} }
((TPrint_application*)MainApp())->set_n_copies(atoi (mask.get (MSK_1_NPAGES)));
switch (atoi (mask.get (MSK_1_TYPE))) switch (atoi (mask.get (MSK_1_TYPE)))
{ {
case 0: // stampante case 0: // stampante
@ -1349,8 +1329,7 @@ set ()
MainApp ()->enable_menu_item (M_FILE_PG_SETUP); MainApp ()->enable_menu_item (M_FILE_PG_SETUP);
} }
void TPrinter :: void TPrinter::close ()
close ()
{ {
if (isopen () && _currentrow > 1 && if (isopen () && _currentrow > 1 &&
(_footersize || (_printertype != screenvis && _printertype != winprinter))) (_footersize || (_printertype != screenvis && _printertype != winprinter)))
@ -1434,8 +1413,7 @@ TFile_printer ::TFile_printer (const char *ffile, const char *label, int len_rec
} }
void TFile_printer :: void TFile_printer::open()
open ()
{ {
} }

View File

@ -7,7 +7,8 @@
#include <config.h> #include <config.h>
#include <execp.h> #include <execp.h>
#include <urldefid.h> #include <urldefid.h>
#include <applicat.h> #include <printapp.h>
#include <mailbox.h>
#ifndef __PRINTER_H #ifndef __PRINTER_H
typedef void (*LINKHANDLER) (int, const char *); typedef void (*LINKHANDLER) (int, const char *);
@ -58,6 +59,46 @@ extern "C"
const long E_ADDLINE = 488l; const long E_ADDLINE = 488l;
const long E_ADDLINE_ONSCREEN = 467l; const long E_ADDLINE_ONSCREEN = 467l;
void TViswin::exec_link()
{
if (_linkID != -1)
{
LINKHANDLER pl = MainApp ()->printer ().getlinkhandler ();
if (pl)
(*pl) (_linkID, _multiple ? (const char *) _multiple_link :
_linktxt);
// dai opzione per rifare la stampa se e' arrivato un messaggio
// dall'applicazione chiamata
// schiaffa indi il tutto in una funzione
TMailbox m;
if (m.next_s(MSG_LN) != NULL)
{
if (yesno_box("Si desidera riaggiornare la stampa?"))
{
((TPrint_application*)MainApp())->repeat_print();
#if XVT_OS == XVT_OS_WIN
xvt_statbar_set ("");
xvt_statbar_refresh ();
#endif
stop_run(K_ENTER);
}
}
set_focus();
check_link();
_need_update = TRUE;
force_update();
do_events();
check_link (&_point);
}
else
beep();
}
void TViswin::display_link (long y, long x1, long x2, const char *d) void TViswin::display_link (long y, long x1, long x2, const char *d)
{ {
if (!_link_displayed) if (!_link_displayed)
@ -72,6 +113,7 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
} }
} }
void TViswin::erase_link (long y, long x1, long x2) void TViswin::erase_link (long y, long x1, long x2)
{ {
if (_link_displayed) if (_link_displayed)
@ -209,7 +251,7 @@ bool TViswin::in_text (const TPoint & p) const
} }
bool TViswin ::need_paint_sel (bool smart) bool TViswin::need_paint_sel (bool smart)
{ {
TPoint p1, p2; TPoint p1, p2;
adjust_selection (p1, p2); adjust_selection (p1, p2);
@ -880,21 +922,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
check_link (&_point); check_link (&_point);
break; break;
case DLG_LINK: case DLG_LINK:
if (_linkID != -1) exec_link();
{
LINKHANDLER pl = MainApp ()->printer ().getlinkhandler ();
if (pl)
(*pl) (_linkID, _multiple ? (const char *) _multiple_link :
_linktxt);
set_focus ();
check_link ();
_need_update = TRUE;
force_update ();
do_events ();
check_link (&_point);
}
else
beep ();
break; break;
} }
break; break;
@ -1356,8 +1384,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
update (); update ();
} }
bool TViswin :: bool TViswin::on_key (KEY key)
on_key (KEY key)
{ {
EVENT_TYPE type = E_USER; EVENT_TYPE type = E_USER;
@ -1388,21 +1415,7 @@ on_key (KEY key)
} }
break; break;
case CTRL_C: case CTRL_C:
if (_linkID != -1) exec_link();
{
LINKHANDLER pl = MainApp ()->printer ().getlinkhandler ();
if (pl)
(*pl) (_linkID, _multiple ? (const char *) _multiple_link :
_linktxt);
set_focus ();
check_link ();
_need_update = TRUE;
force_update ();
do_events ();
check_link (&_point);
}
else
beep ();
break; break;
case CTRL_S: case CTRL_S:
if (_isprint) if (_isprint)
@ -1451,17 +1464,7 @@ on_key (KEY key)
case K_CTRL_ENTER: case K_CTRL_ENTER:
if (_linkID != -1) if (_linkID != -1)
{ {
LINKHANDLER pl = MainApp ()->printer ().getlinkhandler (); exec_link();
if (pl)
(*pl) (_linkID, _multiple ? (const char *) _multiple_link :
_linktxt);
_need_update = TRUE;
set_focus ();
check_link ();
_need_update = TRUE;
force_update ();
do_events ();
check_link (&_point);
} }
else else
dispatch_e_char (_button[_curbut], K_SPACE); dispatch_e_char (_button[_curbut], K_SPACE);

View File

@ -111,6 +111,8 @@ protected:
void erase_link(long, long, long); void erase_link(long, long, long);
void display_link(long, long, long, const char*); void display_link(long, long, long, const char*);
void freeze() { _frozen = TRUE; } void freeze() { _frozen = TRUE; }
void exec_link();
protected: protected:
virtual void update(); virtual void update();
@ -122,7 +124,7 @@ public:
// il punto di inizio selezione e quello di fine selezione; se // il punto di inizio selezione e quello di fine selezione; se
// non c'e' selezione non viene chiamata affatto (il bottone non fa nulla) // non c'e' selezione non viene chiamata affatto (il bottone non fa nulla)
// Se serve, si faccia stop_run() qui dentro // Se serve, si faccia stop_run() qui dentro
virtual void process_link(TTextfile& txt, TPoint start, TPoint end) { } virtual void process_link(TTextfile& txt, TPoint start, TPoint end) { }
void close_print(); void close_print();
bool frozen() { return _frozen; } bool frozen() { return _frozen; }
void abort_print(); void abort_print();
@ -130,10 +132,10 @@ public:
void add_line(const char* l); void add_line(const char* l);
TViswin (const char* fname = NULL, TViswin (const char* fname = NULL,
const char* title = NULL, const char* title = NULL,
bool editbutton = TRUE, bool editbutton = TRUE,
bool printbutton = TRUE, bool printbutton = TRUE,
bool linkbutton = TRUE); bool linkbutton = TRUE);
virtual ~TViswin (); virtual ~TViswin ();
}; };