Modifiche varie a viswin, browfile, printer
git-svn-id: svn://10.65.10.50/trunk@771 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1b2466f0cd
commit
aadf264df4
@ -65,6 +65,13 @@ BEGIN
|
||||
HELP "Dimensioni del carattere di stampa"
|
||||
END
|
||||
|
||||
BOOLEAN MSK_1_ISGRAPHICS
|
||||
BEGIN
|
||||
PROMPT 4 8 "Stampa elementi grafici"
|
||||
HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
|
||||
END
|
||||
|
||||
|
||||
LIST MSK_1_LINES 3
|
||||
BEGIN
|
||||
PROMPT 52 6 "Linee/Inch "
|
||||
@ -94,10 +101,9 @@ END
|
||||
|
||||
BOOLEAN MSK_1_ISGRAPHICS
|
||||
BEGIN
|
||||
PROMPT 4 8 "Stampa elementi grafici"
|
||||
PROMPT 4 8 "Salva configurazione"
|
||||
HELP "Indicare se stampare elementi grafici (linee, box, logo) quando la stampante lo consente"
|
||||
END
|
||||
|
||||
|
||||
GROUPBOX DLG_NULL 74 4
|
||||
BEGIN
|
||||
|
@ -1,64 +1,65 @@
|
||||
#ifndef __BROWFILE_H
|
||||
#define __BROWFILE_H
|
||||
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
class TViswin;
|
||||
|
||||
// viene chiamato sia al semplice passaggio del cursore sul testo
|
||||
// (con doubleclick = FALSE) o alla pressione di tasti o balle per
|
||||
// collegare (doubleclick = TRUE)
|
||||
// se non ritorna NULL, il testo usato per linkare viene sostituito
|
||||
// dal testo ritornato
|
||||
typedef const char* (*MASK_LINKHANDLER)(TMask&, int, const char*, bool doubleclick);
|
||||
|
||||
class TBrowsefile_field : public TMask_field
|
||||
{
|
||||
friend class TViswin;
|
||||
|
||||
TViswin* _viswin;
|
||||
MASK_LINKHANDLER _lh;
|
||||
TArray _links;
|
||||
TArray _background;
|
||||
bool _m_link;
|
||||
|
||||
protected:
|
||||
virtual word class_id() const;
|
||||
|
||||
virtual void parse_head(TScanner& scanner);
|
||||
virtual void create(WINDOW parent);
|
||||
|
||||
public:
|
||||
|
||||
TViswin* vis_win() const { return _viswin; }
|
||||
|
||||
void add_line(const char* l);
|
||||
void set_text(const char* file);
|
||||
// TBI posiziona su riga e colonna passate
|
||||
void goto_pos(long r, long c);
|
||||
void goto_top();
|
||||
void goto_end();
|
||||
void close();
|
||||
|
||||
// link processor
|
||||
void set_link_handler(MASK_LINKHANDLER lh) { _lh = lh; }
|
||||
MASK_LINKHANDLER get_link_handler() { return _lh; }
|
||||
TArray& links() { return _links; }
|
||||
void set_multiple_link(bool on) { _m_link = on; }
|
||||
bool is_multiple_link() { return _m_link; }
|
||||
int find_link(const char* descr);
|
||||
int enable_link (const char* descr, char fg, char bg = 'w');
|
||||
void disable_link(char fg, char bg = 'w');
|
||||
void disable_links() { _links.destroy(); }
|
||||
|
||||
// print background
|
||||
void set_background(const char* bg);
|
||||
TArray* get_bg_desc() { return &_background; }
|
||||
|
||||
TBrowsefile_field(TMask* m);
|
||||
virtual ~TBrowsefile_field();
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef __BROWFILE_H
|
||||
#define __BROWFILE_H
|
||||
|
||||
#ifndef __MASK_H
|
||||
#include <mask.h>
|
||||
#endif
|
||||
|
||||
class TViswin;
|
||||
|
||||
// viene chiamato sia al semplice passaggio del cursore sul testo
|
||||
// (con doubleclick = FALSE) o alla pressione di tasti o balle per
|
||||
// collegare (doubleclick = TRUE)
|
||||
// se non ritorna NULL, il testo usato per linkare viene sostituito
|
||||
// dal testo ritornato
|
||||
typedef const char* (*MASK_LINKHANDLER)(TMask&, int, const char*, bool doubleclick);
|
||||
|
||||
class TBrowsefile_field : public TMask_field
|
||||
{
|
||||
friend class TViswin;
|
||||
|
||||
TViswin* _viswin;
|
||||
MASK_LINKHANDLER _lh;
|
||||
TArray _links;
|
||||
TArray _background;
|
||||
bool _m_link;
|
||||
|
||||
protected:
|
||||
virtual word class_id() const;
|
||||
|
||||
virtual void parse_head(TScanner& scanner);
|
||||
virtual void create(WINDOW parent);
|
||||
|
||||
public:
|
||||
|
||||
TViswin* vis_win() const { return _viswin; }
|
||||
|
||||
void add_line(const char* l);
|
||||
long set_text(const char* file, const char* line = NULL);
|
||||
// TBI posiziona su riga e colonna passate
|
||||
void goto_pos(long r, long c);
|
||||
void goto_top();
|
||||
void goto_end();
|
||||
void refresh();
|
||||
void close();
|
||||
|
||||
// link processor
|
||||
void set_link_handler(MASK_LINKHANDLER lh) { _lh = lh; }
|
||||
MASK_LINKHANDLER get_link_handler() { return _lh; }
|
||||
TArray& links() { return _links; }
|
||||
void set_multiple_link(bool on) { _m_link = on; }
|
||||
bool is_multiple_link() { return _m_link; }
|
||||
int find_link(const char* descr);
|
||||
int enable_link (const char* descr, char fg, char bg = 'w');
|
||||
void disable_link(char fg, char bg = 'w');
|
||||
void disable_links() { _links.destroy(); }
|
||||
|
||||
// print background
|
||||
void set_background(const char* bg);
|
||||
TArray* get_bg_desc() { return &_background; }
|
||||
|
||||
TBrowsefile_field(TMask* m);
|
||||
virtual ~TBrowsefile_field();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -867,7 +867,8 @@ bool TPrinter::printrow(TPrintrow* rowtoprint)
|
||||
if (_currentpage < _frompage || _currentpage > _topage)
|
||||
return TRUE;
|
||||
|
||||
TString rw (rowtoprint == NULL ? "" : (_printertype == screenvis || _printertype == winprinter ?
|
||||
TString rw (rowtoprint == NULL ? "" : (_printertype == screenvis || _printertype == winprinter ||
|
||||
_printertype == export ?
|
||||
rowtoprint->row_codified () :
|
||||
rowtoprint->row ()));
|
||||
rw.rtrim ();
|
||||
@ -912,7 +913,7 @@ bool TPrinter::printrow(TPrintrow* rowtoprint)
|
||||
{
|
||||
// add line to txt
|
||||
if (!_frozen)
|
||||
_txt.append (rw);
|
||||
_txt.append(rw);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -47,10 +47,11 @@ extern "C"
|
||||
#define K_SHIFT_RIGHT (K_SHIFT + K_RIGHT)
|
||||
#define K_ALT_RIGHT (K_CTRL + 'K')
|
||||
#define K_ALT_LEFT (K_CTRL + 'L')
|
||||
#define CTRL_C ('C')
|
||||
#define CTRL_E ('E')
|
||||
#define CTRL_S ('S')
|
||||
#define CTRL_R ('R')
|
||||
#define CTRL_C (K_CTRL + 'C')
|
||||
#define CTRL_E (K_CTRL + 'E')
|
||||
#define CTRL_S (K_CTRL + 'S')
|
||||
#define CTRL_R (K_CTRL + 'R')
|
||||
#define K_CTRLTAB (K_CTRL + K_TAB)
|
||||
|
||||
// vista la mania degli 883, eccoti un po' di concerti di Mozart
|
||||
const long E_ADDLINE = 488L;
|
||||
@ -90,13 +91,18 @@ void TViswin::exec_link()
|
||||
stop_run(K_ENTER);
|
||||
}
|
||||
}
|
||||
} // _toplevel
|
||||
set_focus();
|
||||
check_link();
|
||||
_need_update = TRUE;
|
||||
force_update();
|
||||
do_events();
|
||||
check_link (&_point);
|
||||
} // _toplevel
|
||||
if (_toplevel)
|
||||
{
|
||||
set_focus();
|
||||
_inside_linkexec = TRUE;
|
||||
check_link();
|
||||
_need_update = TRUE;
|
||||
force_update();
|
||||
do_events();
|
||||
check_link (&_point);
|
||||
_inside_linkexec = FALSE;
|
||||
}
|
||||
} // linkID != -1
|
||||
else beep();
|
||||
}
|
||||
@ -111,7 +117,16 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
xvt_statbar_set(d);
|
||||
#endif
|
||||
xvt_enable_control (_link_button, TRUE);
|
||||
if (_link_button != -1) xvt_enable_control (_link_button, TRUE);
|
||||
|
||||
if (!_toplevel && !_inside_linkexec)
|
||||
{
|
||||
// chiama l'handler per maschere con FALSE come terzo parametro
|
||||
MASK_LINKHANDLER pl = _brwfld->_lh;
|
||||
if (pl != NULL)
|
||||
pl(_brwfld->mask(), _linkID,
|
||||
_multiple ? (const char*)_multiple_link : (const char*)_linktxt, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +141,7 @@ void TViswin::erase_link (long y, long x1, long x2)
|
||||
xvt_statbar_set ("");
|
||||
xvt_statbar_refresh ();
|
||||
#endif
|
||||
xvt_enable_control (_link_button, FALSE);
|
||||
if (_link_button != -1) xvt_enable_control (_link_button, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,15 +256,6 @@ bool TViswin::check_link (TPoint * p)
|
||||
strcpy (descr, pdescr);
|
||||
display_link (y, x1, x2, descr);
|
||||
|
||||
if (!_toplevel)
|
||||
{
|
||||
// chiama l'handler per maschere con FALSE come terzo parametro
|
||||
MASK_LINKHANDLER pl = _brwfld->_lh;
|
||||
if (pl != NULL)
|
||||
pl(_brwfld->mask(), _linkID,
|
||||
_multiple ? (const char*)_multiple_link : (const char*)_linktxt, FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -1518,12 +1524,25 @@ bool TViswin::on_key (KEY key)
|
||||
if (_toplevel)
|
||||
exec_link();
|
||||
break;
|
||||
case K_TAB:
|
||||
if (_curbut == (_buttons - 1))
|
||||
_curbut = 0;
|
||||
else
|
||||
_curbut++;
|
||||
case K_CTRLTAB:
|
||||
if (!_toplevel)
|
||||
_brwfld->mask().send_key(K_TAB,0);
|
||||
break;
|
||||
case K_TAB:
|
||||
if (!is_running())
|
||||
{
|
||||
_need_update = TRUE;
|
||||
update();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_curbut == (_buttons - 1))
|
||||
_curbut = 0;
|
||||
else
|
||||
_curbut++;
|
||||
}
|
||||
break;
|
||||
|
||||
case K_BTAB:
|
||||
if (_curbut == 0)
|
||||
_curbut = _buttons - 1;
|
||||
@ -1536,7 +1555,7 @@ bool TViswin::on_key (KEY key)
|
||||
{
|
||||
exec_link();
|
||||
}
|
||||
else
|
||||
else if (_toplevel)
|
||||
dispatch_e_char (_button[_curbut], K_SPACE);
|
||||
break;
|
||||
case K_LHOME:
|
||||
@ -1852,8 +1871,52 @@ void TViswin::close_print ()
|
||||
kill_timer (_wtimer);
|
||||
_need_update = TRUE;
|
||||
force_update ();
|
||||
}
|
||||
|
||||
|
||||
void TViswin::goto_end()
|
||||
{
|
||||
goto_pos(0l, _txt.lines () - _textrows);
|
||||
}
|
||||
|
||||
void TViswin::goto_top()
|
||||
{
|
||||
goto_pos(0l,0l);;
|
||||
}
|
||||
|
||||
void TViswin::goto_pos(long r, long c)
|
||||
{
|
||||
if (r >= _txt.lines() || c >= 256)
|
||||
return;
|
||||
check_link();
|
||||
erase_point();
|
||||
if (_isselection) erase_selection();
|
||||
_point.x = c;
|
||||
_point.y = r;
|
||||
update_thumb (c,r);
|
||||
check_link(&_point);
|
||||
if (_isselection) display_selection();
|
||||
display_point();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void TViswin::refresh()
|
||||
{
|
||||
_need_update = TRUE;
|
||||
force_update();
|
||||
}
|
||||
|
||||
int TViswin::search(const char* txt, long from, bool down)
|
||||
{
|
||||
return -1l;
|
||||
}
|
||||
|
||||
int TViswin::replace(long line, const char* txt, int pos, int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
TViswin ::TViswin (const char *fname,
|
||||
const char *title,
|
||||
bool editbutton,
|
||||
@ -1870,7 +1933,7 @@ TViswin ::TViswin (const char *fname,
|
||||
_link_displayed (FALSE), _point_displayed (FALSE), _selecting (FALSE),
|
||||
_scrolling (FALSE), _selflag (FALSE), _need_update (TRUE), _need_scroll (none),
|
||||
_multiple (FALSE), _rulers(rulers),
|
||||
_frozen (FALSE), _brwfld(brwfld)
|
||||
_frozen (FALSE), _brwfld(brwfld), _link_button(-1)
|
||||
{
|
||||
if (title == NULL)
|
||||
title = (fname ? fname : "Anteprima di stampa");
|
||||
@ -1969,16 +2032,18 @@ TViswin ::TViswin (const char *fname,
|
||||
_bg = _toplevel ? main_app().printer().getbgdesc() : _brwfld->get_bg_desc();
|
||||
_isbackground = _bg->items () > 0;
|
||||
_formlen = _toplevel ? main_app().printer().formlen() : maxalt;
|
||||
_linkID = -1;
|
||||
_inside_linkexec = FALSE;
|
||||
|
||||
for (i = 0; i < _links->items (); i++)
|
||||
{
|
||||
TToken_string & t = (TToken_string &) (*_links)[i];
|
||||
char f = *(t.get (1));
|
||||
char b = *(t.get (2));
|
||||
t.restart ();
|
||||
t.restart();
|
||||
_txt.set_hotspots(f, b);
|
||||
}
|
||||
_hotspots = &(_txt.hotspots ());
|
||||
_hotspots = &(_txt.hotspots());
|
||||
}
|
||||
|
||||
TViswin ::~TViswin ()
|
||||
@ -2029,11 +2094,18 @@ void TBrowsefile_field::create(WINDOW parent)
|
||||
}
|
||||
|
||||
|
||||
void TBrowsefile_field::set_text(const char* file)
|
||||
long TBrowsefile_field::set_text(const char* file, const char* line)
|
||||
// se line != NULL ritorna il numero dell'ultima riga del file che
|
||||
// comincia (trimmata) come passato; se non la trova ritorna -1
|
||||
{
|
||||
FILE* instr = fopen(file,"r");
|
||||
if (instr == NULL)
|
||||
error_box("File non trovato: %s", file);
|
||||
fatal_box("File non trovato: %s", file);
|
||||
|
||||
TString256 tmpp;
|
||||
long ret = -1l;
|
||||
long lines = 0l;
|
||||
|
||||
while (!feof(instr))
|
||||
{
|
||||
if (fgets(__tmp_string, sizeof (__tmp_string), instr) == NULL)
|
||||
@ -2041,8 +2113,18 @@ void TBrowsefile_field::set_text(const char* file)
|
||||
if (__tmp_string[strlen(__tmp_string)-1] == '\n')
|
||||
__tmp_string[strlen(__tmp_string)-1] = '\0';
|
||||
add_line(__tmp_string);
|
||||
if (line != NULL)
|
||||
{
|
||||
tmpp = __tmp_string;
|
||||
if (tmpp.find(line) != -1)
|
||||
ret = lines;
|
||||
}
|
||||
lines++;
|
||||
}
|
||||
fclose(instr);
|
||||
fclose(instr);
|
||||
|
||||
_viswin->close_print();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int TBrowsefile_field::find_link(const char* descr)
|
||||
@ -2070,6 +2152,7 @@ int TBrowsefile_field::enable_link(const char *descr, char fg, char bg)
|
||||
b[0] = bg;
|
||||
tt->add(b);
|
||||
lnk = _links.add(tt);
|
||||
_viswin->_txt.set_hotspots(fg, bg);
|
||||
}
|
||||
|
||||
return lnk;
|
||||
@ -2108,14 +2191,20 @@ void TBrowsefile_field::close()
|
||||
|
||||
void TBrowsefile_field::goto_pos(long r, long c)
|
||||
{
|
||||
_viswin->goto_pos(r,c);
|
||||
}
|
||||
|
||||
void TBrowsefile_field::goto_top()
|
||||
{
|
||||
dispatch_e_char(_viswin->win(), K_END);
|
||||
_viswin->goto_top();
|
||||
}
|
||||
|
||||
void TBrowsefile_field::goto_end()
|
||||
{
|
||||
dispatch_e_char(_viswin->win(), K_HOME);
|
||||
_viswin->goto_end();
|
||||
}
|
||||
|
||||
void TBrowsefile_field::refresh()
|
||||
{
|
||||
_viswin->refresh();
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ class TViswin : public TScroll_window
|
||||
bool _frozen;
|
||||
bool _toplevel;
|
||||
bool _rulers;
|
||||
bool _inside_linkexec;
|
||||
|
||||
// viene istanziato soltanto se e' usata come controllo BROWSEFILE
|
||||
TBrowsefile_field* _brwfld;
|
||||
@ -139,8 +140,16 @@ public:
|
||||
void abort_print();
|
||||
long lines() { return _txt.lines(); }
|
||||
|
||||
void add_line(const char* l);
|
||||
void goto_end();
|
||||
void goto_top();
|
||||
void goto_pos(long,long);
|
||||
void refresh();
|
||||
|
||||
void add_line(const char* l);
|
||||
|
||||
int search (const char* txt, long from = 0, bool down = FALSE);
|
||||
int replace(long line, const char* txt, int pos = 0, int len = -1);
|
||||
|
||||
TViswin (const char* fname = NULL,
|
||||
const char* title = NULL,
|
||||
bool editbutton = TRUE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user