XVT 4.0
git-svn-id: svn://10.65.10.50/trunk@1149 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
69c57c5a6f
commit
ca8c00bfce
140
ba/ba0.cpp
140
ba/ba0.cpp
@ -1,4 +1,5 @@
|
||||
#include <applicat.h>
|
||||
#include <colors.h>
|
||||
#include <execp.h>
|
||||
#include <mask.h>
|
||||
#include <isam.h>
|
||||
@ -14,10 +15,6 @@
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
extern "C"
|
||||
{
|
||||
#include <cpb.h>
|
||||
}
|
||||
#include <dos.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
@ -32,53 +29,35 @@ extern "C"
|
||||
|
||||
class TPicture_mask : public TMask
|
||||
{
|
||||
static short _id;
|
||||
static PICTURE _picture;
|
||||
TImage _image;
|
||||
|
||||
protected:
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
void set_picture(short id);
|
||||
|
||||
public:
|
||||
TPicture_mask(const char* name, int dx, int dy, short picture_id);
|
||||
void reset();
|
||||
TPicture_mask(const char* name, int dx, int dy, short id);
|
||||
virtual ~TPicture_mask() {}
|
||||
};
|
||||
|
||||
short TPicture_mask::_id = 0;
|
||||
PICTURE TPicture_mask::_picture = 0L;
|
||||
|
||||
void TPicture_mask::set_picture(short id)
|
||||
TPicture_mask::TPicture_mask(const char* name, int dx, int dy, short id)
|
||||
: TMask(name, 1, dx, dy), _image("")
|
||||
{
|
||||
if (id != _id)
|
||||
char* n = format("ba%02d.bmp", id);
|
||||
if (id > 0 && !fexist(n))
|
||||
n = format("ba%02d.bmp", id = 0);
|
||||
_image.load(n);
|
||||
|
||||
if (_image.ok())
|
||||
{
|
||||
_id = id;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (_picture)
|
||||
picture_free(_picture); // xvt_pict_destroy(_picture);
|
||||
|
||||
_picture = xvt_picture_load(id, FALSE);
|
||||
#endif
|
||||
if (id == 0 && MASK_BACK_COLOR != COLOR_DKCYAN)
|
||||
_image.set_clut(6, MASK_BACK_COLOR);
|
||||
else
|
||||
_image.set_palette(win());
|
||||
_image.set_pos(1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void TPicture_mask::reset()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (_picture)
|
||||
{
|
||||
picture_free(_picture); // xvt_pict_destroy(_picture);
|
||||
_picture = 0L;
|
||||
_id = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TPicture_mask::TPicture_mask(const char* name, int dx, int dy, short pic)
|
||||
: TMask(name, 1, dx, dy)
|
||||
{
|
||||
set_picture(pic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TPicture_mask::handler(WINDOW win, EVENT* ep)
|
||||
@ -88,8 +67,14 @@ void TPicture_mask::handler(WINDOW win, EVENT* ep)
|
||||
if (ep->type == E_UPDATE)
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (_picture)
|
||||
cpb_win_picture_draw_at(win, _picture, 1, 1);
|
||||
if (_image.ok())
|
||||
{
|
||||
RCT src; xvt_rect_set(&src, 0, 0, _image.width(), _image.height());
|
||||
const short maxx = 42*CHARX;
|
||||
const short maxy = short((long)maxx*src.bottom/src.right);
|
||||
RCT dst; xvt_rect_set(&dst, 1, 1, maxx, maxy);
|
||||
_image.draw(win, dst);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
@ -124,7 +109,7 @@ class TMenu_application : public TApplication
|
||||
static bool _find_button;
|
||||
|
||||
protected:
|
||||
void test_temp() const;
|
||||
void test_temp();
|
||||
void load_menu();
|
||||
int do_level();
|
||||
int find_menu(const char* s) const;
|
||||
@ -192,11 +177,11 @@ bool TMenu_application::build_firm_data(long codditta, bool flagcom)
|
||||
TDir dir, dir1;
|
||||
TTrec rec;
|
||||
|
||||
prefhndl->set("");
|
||||
prefix().set("");
|
||||
dir1.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
const long maxeod0 = dir1.eod();
|
||||
|
||||
prefhndl->set_codditta(codditta);
|
||||
prefix().set_codditta(codditta);
|
||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
if (dir.eod() == 0)
|
||||
{
|
||||
@ -219,12 +204,12 @@ bool TMenu_application::build_firm_data(long codditta, bool flagcom)
|
||||
for (int i = LF_DIR + 1; i <= maxeod0; i++)
|
||||
{
|
||||
p.addstatus(1);
|
||||
prefhndl->set("");
|
||||
prefix().set("");
|
||||
dir.get(i, _nolock, _nordir, _sysdirop);
|
||||
rec.get(i);
|
||||
bool create_now = dir.is_active();
|
||||
|
||||
prefhndl->set_codditta(codditta);
|
||||
prefix().set_codditta(codditta);
|
||||
dir.put(i, _nordir, _sysdirop);
|
||||
rec.put(i);
|
||||
const char* name = dir.name();
|
||||
@ -394,11 +379,11 @@ int TMenu_application::do_level()
|
||||
TToken_string& row = (TToken_string&)_menu[first];
|
||||
const TString80 head(row.get(1));
|
||||
|
||||
const int width = 72;
|
||||
const int width = 74;
|
||||
const int height = 18;
|
||||
const int bwidth = 20;
|
||||
const int x = width-bwidth-12;
|
||||
const short pic = BA0_PICTURE+(short)row.get_int();
|
||||
const short pic = (short)row.get_int();
|
||||
TPicture_mask menu(head, width, height, pic);
|
||||
|
||||
int y = 1;
|
||||
@ -454,34 +439,35 @@ int TMenu_application::do_level()
|
||||
}
|
||||
|
||||
|
||||
void TMenu_application::test_temp() const
|
||||
{
|
||||
TFilename dir; dir.tempdir(); // Directory temporanea
|
||||
void TMenu_application::test_temp()
|
||||
{
|
||||
begin_wait();
|
||||
|
||||
TFilename name;
|
||||
name << dir << "/" << "*.*"; // Cerca tutti i file
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
struct _find_t f;
|
||||
if (_dos_findfirst(name, _A_NORMAL, &f) == 0 &&
|
||||
yesno_box("Cancellare i file temporanei?"))
|
||||
{
|
||||
TIndwin pi(40, "Cancellazione file temporanei", FALSE, FALSE);
|
||||
do
|
||||
{
|
||||
name = dir;
|
||||
name << "/" << f.name;
|
||||
remove(name);
|
||||
} while (_dos_findnext(&f) == 0);
|
||||
TFilename dir; dir.tempdir(); // Directory temporanea
|
||||
dir << '/' << '*';
|
||||
TToken_string files(dir);
|
||||
const int count = list_files(files);
|
||||
|
||||
end_wait();
|
||||
|
||||
if (count > 0 && yesno_box("Cancellare %d file temporane%c in %s?",
|
||||
count, (count > 1) ? 'i' : 'o', dir.path()))
|
||||
{
|
||||
TProgind bar(count, "Cancellazione file temporanei", TRUE, TRUE);
|
||||
for (const char* e = files.get(0); e; e = files.get())
|
||||
{
|
||||
if (bar.iscancelled()) break;
|
||||
remove(e);
|
||||
bar.addstatus(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TMenu_application::check_user()
|
||||
{
|
||||
TMask m("ba0100a");
|
||||
TLocalisamfile users(LF_USER);
|
||||
TString16 user, pwd;
|
||||
TString16 utente, pwd;
|
||||
|
||||
bool ok = FALSE;
|
||||
for (int i = 0 ; i < 3 && !ok; i++)
|
||||
@ -489,20 +475,20 @@ bool TMenu_application::check_user()
|
||||
if (m.run() == K_ESC)
|
||||
break;
|
||||
|
||||
user = m.get(F_USER);
|
||||
utente = m.get(F_USER);
|
||||
users.zero();
|
||||
users.put("USERNAME", user);
|
||||
users.put("USERNAME", utente);
|
||||
|
||||
pwd = "";
|
||||
if (users.read() == NOERR)
|
||||
pwd = decode(users.get("PASSWORD"));
|
||||
else
|
||||
if (user == "PRASSI")
|
||||
if (utente == "PRASSI")
|
||||
pwd = "pr.assi";
|
||||
|
||||
ok = pwd.not_empty() && pwd == m.get(F_PASSWORD);
|
||||
if (ok)
|
||||
set_user(user);
|
||||
user() = utente;
|
||||
else
|
||||
error_box("Utente e/o password errata:\nfare attenzione alle maiuscole");
|
||||
}
|
||||
@ -565,10 +551,10 @@ bool TMenu_application::menu(MENU_TAG)
|
||||
_ditta_asked = ok = set_firm();
|
||||
if (ok)
|
||||
{
|
||||
prefhndl->set(NULL);
|
||||
prefix().set(NULL);
|
||||
TExternal_app a(option);
|
||||
a.run();
|
||||
prefhndl->set("DEF"); // Aggiorna prefix se hanno cambiato ditta
|
||||
prefix().set("DEF"); // Aggiorna prefix se hanno cambiato ditta
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -590,11 +576,13 @@ bool TMenu_application::menu(MENU_TAG)
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int XVT_CALLCONV1 main(int argc, char** argv)
|
||||
{
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TApplication::check_parameters(argc, argv);
|
||||
const char* menu = (argc < 2) ? "prassi.mnu" : argv[1];
|
||||
|
||||
TMenu_application ma(menu);
|
||||
ma.run(argc, argv, "Menu Principale");
|
||||
return TRUE;
|
||||
|
11
ba/ba0.url
11
ba/ba0.url
@ -3,14 +3,3 @@
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#transparent $$$
|
||||
883 bitmap DISCARDABLE f:\p.due\bmp\menubmp\ba00.bmp
|
||||
884 bitmap DISCARDABLE f:\p.due\bmp\menubmp\ba01.bmp
|
||||
885 bitmap DISCARDABLE f:\p.due\bmp\menubmp\ba02.bmp
|
||||
886 bitmap DISCARDABLE f:\p.due\bmp\menubmp\ba03.bmp
|
||||
887 bitmap DISCARDABLE f:\p.due\bmp\menubmp\ba04.bmp
|
||||
$$$
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -353,7 +353,7 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga)
|
||||
_mask->reset (F_TAB);
|
||||
|
||||
const TRecnotype oldeox = atol(_mask->get(FLD_EOX));
|
||||
const bool com = prefhndl->is_com() || !*prefhndl->name();
|
||||
const bool com = prefix().is_com() || !*prefix().name();
|
||||
const char* name = _mask->get(FLD_NOME);
|
||||
const bool enable_extend = (com ? *name != '$' : *name == '$') && (riga_sel > 0);
|
||||
|
||||
@ -480,16 +480,16 @@ void TManutenzione_app::delete_riga ()
|
||||
void TManutenzione_app::update_dir()
|
||||
|
||||
{
|
||||
const TString pref(prefhndl->name());
|
||||
const bool is_com = prefhndl->is_com();
|
||||
const TString pref(prefix().name());
|
||||
const bool is_com = prefix().is_com();
|
||||
|
||||
prefhndl->set("");
|
||||
prefix().set("");
|
||||
|
||||
TDir d;
|
||||
d.get(LF_DIR);
|
||||
const int orig_items = (int)d.eod();
|
||||
|
||||
prefhndl->set(pref);
|
||||
prefix().set(pref);
|
||||
|
||||
d.get(LF_DIR);
|
||||
const int items = (int)d.eod();
|
||||
@ -504,7 +504,7 @@ void TManutenzione_app::update_dir()
|
||||
for (int i = 2; i <= items; i++)
|
||||
{
|
||||
p.addstatus(1);
|
||||
prefhndl->set("");
|
||||
prefix().set("");
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
TString desc(d.des());
|
||||
TString s(d.name());
|
||||
@ -512,7 +512,7 @@ void TManutenzione_app::update_dir()
|
||||
|
||||
long flags = d.flags();
|
||||
word len = d.len();
|
||||
prefhndl->set(pref);
|
||||
prefix().set(pref);
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
bool to_create = (is_com ? d.is_com() : d.is_firm());
|
||||
|
||||
@ -538,20 +538,20 @@ void TManutenzione_app::update_dir()
|
||||
f.build(10L);
|
||||
}
|
||||
}
|
||||
prefhndl->set(pref);
|
||||
prefix().set(pref);
|
||||
|
||||
if (items >= orig_items) return;
|
||||
|
||||
for (i = items + 1; i <= orig_items; i++)
|
||||
{
|
||||
prefhndl->set("");
|
||||
prefix().set("");
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
prefhndl->set(pref);
|
||||
prefix().set(pref);
|
||||
d.set_len(0);
|
||||
d.flags() = 0L;
|
||||
d.put(i, _nordir, _sysdirop);
|
||||
}
|
||||
prefhndl->set(pref);
|
||||
prefix().set(pref);
|
||||
d.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
d.eod() = orig_items;
|
||||
d.put(LF_DIR, _nordir, _sysdirop);
|
||||
@ -560,7 +560,7 @@ void TManutenzione_app::update_dir()
|
||||
void TManutenzione_app::convert_dir()
|
||||
|
||||
{
|
||||
const TString pref(prefhndl->name());
|
||||
const TString pref(prefix().name());
|
||||
TDir d;
|
||||
TTrec r;
|
||||
|
||||
@ -568,7 +568,7 @@ void TManutenzione_app::convert_dir()
|
||||
const int items = (int)d.eod();
|
||||
TString80 s("Aggiornamento archivi ");
|
||||
|
||||
if (prefhndl->is_com()) s << "comuni";
|
||||
if (prefix().is_com()) s << "comuni";
|
||||
else s << " della ditta " << atol (pref);
|
||||
|
||||
TProgind p(items ? items : 1, s, TRUE, TRUE, 70);
|
||||
@ -578,15 +578,15 @@ void TManutenzione_app::convert_dir()
|
||||
for (int i = 2; i <= items; i++)
|
||||
{
|
||||
p.addstatus(1);
|
||||
prefhndl->set("");
|
||||
prefix().set("");
|
||||
r.get(i);
|
||||
prefhndl->set(pref);
|
||||
prefix().set(pref);
|
||||
TSystemisamfile f(i);
|
||||
f.update(r);
|
||||
}
|
||||
prefhndl->set("");
|
||||
const long level = prefhndl->filelevel();
|
||||
prefhndl->set(pref);
|
||||
prefix().set("");
|
||||
const long level = prefix().filelevel();
|
||||
prefix().set(pref);
|
||||
d.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||
d.flags() = level;
|
||||
d.put(LF_DIR, _nordir, _sysdirop);
|
||||
@ -597,12 +597,12 @@ void TManutenzione_app::update()
|
||||
{
|
||||
long firm = get_firm();
|
||||
TString pref;
|
||||
if (firm == 0) pref = prefhndl->name();
|
||||
if (firm == 0) pref = prefix().name();
|
||||
|
||||
do_events();
|
||||
|
||||
begin_wait();
|
||||
prefhndl->set("com");
|
||||
prefix().set("com");
|
||||
update_dir();
|
||||
convert_dir();
|
||||
|
||||
@ -614,7 +614,7 @@ void TManutenzione_app::update()
|
||||
const long codditta = ditte.get_long("CODDITTA");
|
||||
const TRecnotype rec = ditte.recno();
|
||||
|
||||
if (prefhndl->exist(codditta))
|
||||
if (prefix().exist(codditta))
|
||||
{
|
||||
ditte.close();
|
||||
set_firm(codditta);
|
||||
@ -627,7 +627,7 @@ void TManutenzione_app::update()
|
||||
ditte.close();
|
||||
|
||||
if (firm > 0) set_firm(firm);
|
||||
else prefhndl->set(pref);
|
||||
else prefix().set(pref);
|
||||
|
||||
end_wait();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
SPREADSHEET F_FIELDS 0 7
|
||||
SPREADSHEET F_FIELDS 0 8
|
||||
BEGIN
|
||||
PROMPT 0 4 ""
|
||||
ITEM "Nome@10"
|
||||
|
@ -361,7 +361,7 @@ return TRUE;
|
||||
|
||||
bool TAttivazione_moduli::destroy()
|
||||
{
|
||||
if (_msk != NULL) delete _msk;
|
||||
if (_msk != NULL) delete _msk;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,10 @@ int main(int argc, char** argv)
|
||||
{
|
||||
case 0:
|
||||
rt = ba2100(argc, argv); break;
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
case 1:
|
||||
rt = ba2200(argc, argv); break;
|
||||
#endif
|
||||
case 2:
|
||||
rt = ba2300(argc, argv) ; break;
|
||||
case 3:
|
||||
|
19
ba/ba2.url
19
ba/ba2.url
@ -7,23 +7,27 @@
|
||||
#define M_FIL1_SAVE MENU_FILE_ALT+103
|
||||
#define M_FIL1_SAVEAS MENU_FILE_ALT+104
|
||||
#define M_FIL1_QUIT MENU_FILE_ALT+105
|
||||
#define MENU_EDIT BAR_ITEM(1)
|
||||
|
||||
MENU MENU_FILE_ALT
|
||||
ITEM M_FIL1_NEW "~Nuovo"
|
||||
ITEM M_FIL1_OPEN "~Apri"
|
||||
ITEM M_FIL1_SAVE "~Salva"
|
||||
ITEM M_FIL1_SAVEAS "Salva ~con Nome"
|
||||
ITEM M_FIL1_QUIT "~Esci"
|
||||
ITEM M_FIL1_QUIT "~Fine"
|
||||
SEPARATOR
|
||||
ITEM M_FILE_ABOUT "~Informazioni"
|
||||
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
ITEM MENU_ITEM(11) "~Relazione"
|
||||
SUBMENU BAR_ITEM(2) "~Intestazione"
|
||||
SUBMENU BAR_ITEM(1) "~Dati"
|
||||
SUBMENU BAR_ITEM(2) "~Testa"
|
||||
SUBMENU BAR_ITEM(3) "~Corpo"
|
||||
SUBMENU BAR_ITEM(4) "~Pie' di pagina"
|
||||
SUBMENU BAR_ITEM(4) "~Piede"
|
||||
SUBMENU BAR_ITEM(5) "~Sfondo"
|
||||
|
||||
MENU BAR_ITEM(1)
|
||||
ITEM MENU_ITEM(11) "~Relazione"
|
||||
ITEM MENU_ITEM(12) "~Parametri"
|
||||
|
||||
MENU BAR_ITEM(2)
|
||||
ITEM MENU_ITEM(21) "~Normale"
|
||||
@ -43,6 +47,11 @@ MENU BAR_ITEM(4)
|
||||
ITEM MENU_ITEM(43) "~Primo"
|
||||
ITEM MENU_ITEM(44) "~Ultimo"
|
||||
|
||||
MENU BAR_ITEM(5)
|
||||
ITEM MENU_ITEM(51) "~Normale"
|
||||
ITEM MENU_ITEM(52) "~Pari"
|
||||
ITEM MENU_ITEM(53) "~Primo"
|
||||
ITEM MENU_ITEM(54) "~Ultimo"
|
||||
|
||||
MENUBAR MENU_BAR(1)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <applicat.h>
|
||||
#include <config.h>
|
||||
#include <form.h>
|
||||
#include <msksheet.h>
|
||||
#include <prefix.h>
|
||||
@ -23,6 +24,7 @@ protected:
|
||||
|
||||
bool edit_relation();
|
||||
bool edit(char s, pagetype p);
|
||||
bool form_config() const;
|
||||
|
||||
public:
|
||||
TForm_editor();
|
||||
@ -84,6 +86,8 @@ bool TForm_editor::menu(MENU_TAG tag)
|
||||
{
|
||||
case MENU_ITEM(11):
|
||||
sec = 'R'; pt = odd_page; break;
|
||||
case MENU_ITEM(12):
|
||||
sec = 'D'; pt = odd_page; break;
|
||||
case MENU_ITEM(21):
|
||||
sec = 'H'; pt = odd_page; break;
|
||||
case MENU_ITEM(22):
|
||||
@ -108,6 +112,14 @@ bool TForm_editor::menu(MENU_TAG tag)
|
||||
sec = 'F'; pt = first_page; break;
|
||||
case MENU_ITEM(44):
|
||||
sec = 'F'; pt = last_page; break;
|
||||
case MENU_ITEM(51):
|
||||
sec = 'G'; pt = odd_page; break;
|
||||
case MENU_ITEM(52):
|
||||
sec = 'G'; pt = even_page; break;
|
||||
case MENU_ITEM(53):
|
||||
sec = 'G'; pt = first_page; break;
|
||||
case MENU_ITEM(54):
|
||||
sec = 'G'; pt = last_page; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -128,7 +140,7 @@ bool TForm_editor::file_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (k == K_TAB && f.dirty())
|
||||
{
|
||||
const char* d = prefhndl->description(f.get());
|
||||
const char* d = prefix().description(f.get());
|
||||
if (*d == '\0') ok = error_box("Nome di file o tabella errato");
|
||||
f.mask().set(f.dlg()+1, d);
|
||||
}
|
||||
@ -206,15 +218,19 @@ bool TForm_editor::edit(char s, pagetype t)
|
||||
|
||||
if (s == 'R')
|
||||
dirty = edit_relation();
|
||||
if (s == 'D')
|
||||
form_config();
|
||||
else
|
||||
{
|
||||
TString80 caption;
|
||||
switch(s)
|
||||
{
|
||||
case 'F':
|
||||
caption << "Pie' di pagina"; break;
|
||||
caption << "Piede"; break;
|
||||
case 'G':
|
||||
caption << "Sfondo"; break;
|
||||
case 'H':
|
||||
caption << "Intestazione"; break;
|
||||
caption << "Testa"; break;
|
||||
default:
|
||||
caption << "Corpo"; break;
|
||||
}
|
||||
@ -235,7 +251,7 @@ bool TForm_editor::edit(char s, pagetype t)
|
||||
if (!_form->exist(s, t))
|
||||
{
|
||||
const KEY k = yesnocancel_box("La sezione %s non esiste:\n"
|
||||
"si desidera ricopiare quella standard?",
|
||||
"si desidera generare quella standard?",
|
||||
(const char*)caption);
|
||||
if (k == K_ESC)
|
||||
dirty = FALSE;
|
||||
@ -266,9 +282,67 @@ bool TForm_editor::edit(char s, pagetype t)
|
||||
return dirty;
|
||||
}
|
||||
|
||||
|
||||
bool TForm_editor::form_config() const
|
||||
{
|
||||
TFilename cnfnam(_form->name().path());
|
||||
const TString16 n(_form->name().name());
|
||||
cnfnam.add(n.left(3));
|
||||
cnfnam.ext("ini");
|
||||
|
||||
TFilename cnfpar(_form->name());
|
||||
cnfpar.ext("");
|
||||
|
||||
TConfig cnf(cnfnam, cnfpar);
|
||||
bool ok = FALSE;
|
||||
|
||||
const TFilename maskname(cnf.get("EdMask"));
|
||||
if (maskname.empty())
|
||||
return warning_box("Nessun parametro da configurare");
|
||||
|
||||
TMask m(maskname);
|
||||
|
||||
// carica campi
|
||||
for (int i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
{
|
||||
const char* fname = fref->name();
|
||||
if (fname != NULL)
|
||||
{
|
||||
const TString& oldvl = cnf.get(fname);
|
||||
if (!oldvl.empty())
|
||||
f.set(oldvl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m.run() == K_ENTER && m.dirty())
|
||||
{
|
||||
// aggiusta campi
|
||||
for (i = 0; i < m.fields(); i++)
|
||||
{
|
||||
TMask_field& f = m.fld(i);
|
||||
if (f.dirty())
|
||||
{
|
||||
const TFieldref* fref = f.field();
|
||||
if (fref != NULL)
|
||||
cnf.set(fref->name(), f.get(), NULL, TRUE);
|
||||
}
|
||||
}
|
||||
ok = TRUE;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int ba2100(int argc, char* argv[])
|
||||
{
|
||||
TForm_editor a;
|
||||
TForm_editor a;
|
||||
a.run(argc, argv, "Parametrizzazione stampa");
|
||||
return 0;
|
||||
}
|
||||
|
@ -25,6 +25,8 @@ BEGIN
|
||||
ITEM "DATA|Data" MESSAGE HIDE,F_DECIMALS|HIDE,F_HEIGHT|HIDE,F_ITEMS
|
||||
ITEM "LISTA|Lista" MESSAGE HIDE,F_DECIMALS|HIDE,F_HEIGHT|SHOW,F_ITEMS
|
||||
ITEM "GRUPPO|Gruppo" MESSAGE HIDE,F_DECIMALS|HIDE,F_HEIGHT|HIDE,F_ITEMS
|
||||
ITEM "LINEA|Linea" MESSAGE HIDE,F_DECIMALS|SHOW,F_HEIGHT|HIDE,F_ITEMS
|
||||
ITEM "FIGURA|Figura" MESSAGE HIDE,F_DECIMALS|SHOW,F_HEIGHT|HIDE,F_ITEMS
|
||||
END
|
||||
|
||||
STRING F_KEY 80 60
|
||||
|
@ -4,17 +4,17 @@ PAGE "SEZIONE DI STAMPA" -1 -1 30 7
|
||||
|
||||
NUMBER F_HEIGHT 3
|
||||
BEGIN
|
||||
PROMPT 1 1 "Altezza "
|
||||
PROMPT 1 1 "Altezza in righe "
|
||||
END
|
||||
|
||||
NUMBER F_X 3
|
||||
BEGIN
|
||||
PROMPT 1 2 "Offset X "
|
||||
PROMPT 1 2 "Spostamento orizzontale "
|
||||
END
|
||||
|
||||
NUMBER F_Y 3
|
||||
BEGIN
|
||||
PROMPT 1 3 "Offset Y "
|
||||
PROMPT 1 3 "Spostamento verticale "
|
||||
END
|
||||
|
||||
BUTTON DLG_EDIT 10 2
|
||||
|
@ -254,10 +254,10 @@ bool TArchive::fbuild(const char* filename, char floppy) const
|
||||
|
||||
bool TArchive::backup(const char* dir, char floppy, const char* desc)
|
||||
{
|
||||
const TString16 old(prefhndl->name());
|
||||
prefhndl->set(NULL);
|
||||
const TString16 old(prefix().name());
|
||||
prefix().set(NULL);
|
||||
|
||||
save_dir();
|
||||
xvt_fsys_save_dir();
|
||||
chdir(dir);
|
||||
|
||||
const TFilename d(dir);
|
||||
@ -283,8 +283,8 @@ bool TArchive::backup(const char* dir, char floppy, const char* desc)
|
||||
if (ok) ok = fsplit(work, floppy, desc);
|
||||
remove(work);
|
||||
|
||||
restore_dir();
|
||||
prefhndl->set(old);
|
||||
xvt_fsys_restore_dir();
|
||||
prefix().set(old);
|
||||
|
||||
return ok;
|
||||
}
|
||||
@ -310,13 +310,13 @@ bool TArchive::restore(const char* dir, char floppy, bool tmp)
|
||||
"nel direttorio %s. Continuare?", floppy, (const char*)work))
|
||||
return FALSE;
|
||||
|
||||
const TString16 old(prefhndl->name());
|
||||
prefhndl->set(NULL);
|
||||
save_dir();
|
||||
const TString16 old(prefix().name());
|
||||
prefix().set(NULL);
|
||||
xvt_fsys_save_dir();
|
||||
bool ok = chdir(work) == 0;
|
||||
if (!ok)
|
||||
{
|
||||
prefhndl->set(old);
|
||||
prefix().set(old);
|
||||
return error_box("Impossibile accedere a %s", (const char*)work);
|
||||
}
|
||||
|
||||
@ -342,8 +342,8 @@ bool TArchive::restore(const char* dir, char floppy, bool tmp)
|
||||
remove(output);
|
||||
}
|
||||
|
||||
restore_dir();
|
||||
prefhndl->set(old);
|
||||
xvt_fsys_restore_dir();
|
||||
prefix().set(old);
|
||||
|
||||
return ok;
|
||||
}
|
||||
@ -373,8 +373,8 @@ TProgress_win::TProgress_win(const char* title, TArchive* _arc)
|
||||
set_handler(DLG_CANCEL, cancel_handler);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HWND txt = (HWND)get_value(wtxt, ATTR_NATIVE_WINDOW);
|
||||
HWND num = (HWND)get_value(wnum, ATTR_NATIVE_WINDOW);
|
||||
HWND txt = (HWND)xvt_vobj_get_attr(wtxt, ATTR_NATIVE_WINDOW);
|
||||
HWND num = (HWND)xvt_vobj_get_attr(wnum, ATTR_NATIVE_WINDOW);
|
||||
_monitor = new ALWindowsMessage(AL_MONITOR_OBJECTS, txt, AL_SEND_RATIO, num);
|
||||
#endif
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include <mask.h>
|
||||
#include <printapp.h>
|
||||
#include <relation.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
@ -79,11 +78,6 @@ bool BA3200_application::set_print(int)
|
||||
|
||||
_cur->setregion (from, to);
|
||||
|
||||
/*
|
||||
if (_stampa_ca7)
|
||||
set_background("W1l{1 3 132 3}W1l{1 5 132 5}");
|
||||
else set_background("W1l{1 3 132 3}W1l{1 6 132 6}");
|
||||
*/
|
||||
set_headers();
|
||||
return TRUE;
|
||||
}
|
||||
@ -211,8 +205,11 @@ void BA3200_application::set_headers()
|
||||
//set_header (last_riga, (const char *)sep);
|
||||
sep.fill(' ');
|
||||
set_header (last_riga, (const char *)sep);
|
||||
|
||||
set_background(format("W1l{1 3 %d 3}W1l{1 %d %d %d}", LungRiga, last_riga, LungRiga, last_riga));
|
||||
#ifdef DBG
|
||||
set_background(format("i{modulo.bmp,20,20,60,38}W2l{1,3,%d,3}l{1,%d,%d,%d}", LungRiga, last_riga, LungRiga, last_riga));
|
||||
#else
|
||||
set_background(format("W2l{1,3,%d,3}l{1,%d,%d,%d}", LungRiga, last_riga, LungRiga, last_riga));
|
||||
#endif
|
||||
}
|
||||
|
||||
void BA3200_application::set_rows()
|
||||
|
@ -15,7 +15,7 @@ class BA3700_application : public TRelation_application
|
||||
{
|
||||
TRelation* _rel;
|
||||
TMask* _msk;
|
||||
TPagamento* _pag;
|
||||
TPagamento* _pag;
|
||||
TSheet_field* _cs;
|
||||
int _mode; // Modo maschera corrente
|
||||
int _interv_rate;
|
||||
|
33
ba/batbinl.h
33
ba/batbinl.h
@ -1,16 +1,17 @@
|
||||
#define F_ANNOREG 101
|
||||
#define F_MESE 102
|
||||
#define F_PINI_LU 103
|
||||
#define F_PFIN_LU 104
|
||||
#define F_DITTA 105
|
||||
#define F_RAGSOC 106
|
||||
#define F_CODREG 107
|
||||
#define F_DESCREG 108
|
||||
#define F_PINI_RU 109
|
||||
#define F_PFIN_RU 110
|
||||
#define F_CODVID 111
|
||||
#define F_STAMPATO 112
|
||||
#define F_PANN_LU 113
|
||||
#define F_ANNO 114
|
||||
#define F_CODLIB 115
|
||||
#define F_INDEX 116
|
||||
#define F_ANNOREG 101
|
||||
#define F_MESE 102
|
||||
#define F_PINI_LU 103
|
||||
#define F_PFIN_LU 104
|
||||
#define F_DITTA 105
|
||||
#define F_RAGSOC 106
|
||||
#define F_CODREG 107
|
||||
#define F_DESCREG 108
|
||||
#define F_PINI_RU 109
|
||||
#define F_PFIN_RU 110
|
||||
#define F_CODVID 111
|
||||
#define F_STAMPATO 112
|
||||
#define F_PANN_LU 113
|
||||
#define F_ANNO 114
|
||||
#define F_CODLIB 115
|
||||
#define F_INDEX 116
|
||||
#define F_DESVID 117
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define F_DATASCAD 113
|
||||
#define F_NUMPAG 114
|
||||
#define F_STAMPAINT 117
|
||||
#define F_DESVID 123
|
||||
#define F_STAMPAINDCOMP 118
|
||||
#define F_MODULO 119
|
||||
#define F_STAMPA 120
|
||||
|
12
ba/batblng.h
12
ba/batblng.h
@ -1,9 +1,9 @@
|
||||
|
||||
|
||||
// campi maschera batb%dpn.msk
|
||||
|
||||
#define F_CODICE 101
|
||||
#define F_DESCR 102
|
||||
#define F_CODICE 101
|
||||
#define F_DESCR 102
|
||||
#define F_DATA 103
|
||||
#define F_DATASEP 104
|
||||
#define F_MIGLIAIA 105
|
||||
#define F_DECIMALI 106
|
||||
|
||||
|
||||
|
||||
|
@ -10,7 +10,7 @@ PAGE "Tabella lingue" -1 -1 78 8
|
||||
|
||||
STRING F_CODICE 1
|
||||
BEGIN
|
||||
PROMPT 4 2 "Codice "
|
||||
PROMPT 2 2 "Codice "
|
||||
FIELD CODTAB
|
||||
FLAGS "U"
|
||||
KEY 1
|
||||
@ -25,7 +25,7 @@ END
|
||||
|
||||
STRING F_DESCR 50
|
||||
BEGIN
|
||||
PROMPT 4 4 "Descrizione "
|
||||
PROMPT 2 3 "Descrizione "
|
||||
FIELD LF_TABCOM->S0
|
||||
KEY 2
|
||||
USE %LNG KEY 2
|
||||
@ -37,6 +37,48 @@ BEGIN
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 1 5 "@bFormato data"
|
||||
END
|
||||
|
||||
LIST F_DATA 3 18
|
||||
BEGIN
|
||||
PROMPT 2 6 "Ordine data "
|
||||
ITEM "GMA|Giorno-Mese-Anno"
|
||||
ITEM "MGA|Mese-Giorno-Anno"
|
||||
ITEM "AMG|Anno-Mese-Giorno"
|
||||
FIELD S7[1,3]
|
||||
END
|
||||
|
||||
STRING F_DATASEP 1
|
||||
BEGIN
|
||||
PROMPT 42 6 "Separatore data "
|
||||
FIELD S7[4,4]
|
||||
END
|
||||
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 1 9 "@bFormato valuta"
|
||||
END
|
||||
|
||||
LIST F_MIGLIAIA 1 14
|
||||
BEGIN
|
||||
PROMPT 2 10 "Separatore migliaia "
|
||||
ITEM ".|Punto (.)" MESSAGE "I",F_DECIMALI
|
||||
ITEM ",|Virgola (,)" MESSAGE "E",F_DECIMALI
|
||||
FIELD S8
|
||||
END
|
||||
|
||||
LIST F_DECIMALI 1 14
|
||||
BEGIN
|
||||
PROMPT 42 10 "Separatore decimali "
|
||||
ITEM "I|Virgola (,)"
|
||||
ITEM "E|Punto (.)"
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
||||
|
||||
|
@ -23,14 +23,13 @@
|
||||
|
||||
#define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Metodi di accesso globali all'applicazione corrente
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
HIDDEN TApplication* _application = NULL;
|
||||
|
||||
TString16 TApplication::_user;
|
||||
|
||||
TApplication& main_app()
|
||||
{
|
||||
CHECK(_application, "NULL application!");
|
||||
@ -45,7 +44,7 @@ bool xvt_running() { return _application != NULL; }
|
||||
|
||||
HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||
{
|
||||
clear_window(win, MASK_DARK_COLOR);
|
||||
xvt_dwin_clear(win, MASK_DARK_COLOR);
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@ -55,18 +54,18 @@ HIDDEN void create_backdrop( void )
|
||||
xvt_create_statbar();
|
||||
xvt_statbar_set("");
|
||||
#else
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_CONTROL, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DISABLED, COLOR_GRAY, COLOR_WHITE);
|
||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MNEMONIC, COLOR_RED, COLOR_WHITE);
|
||||
xvt_app_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_app_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DIALOG, COLOR_BLUE, COLOR_WHITE);
|
||||
xvt_app_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_WINDOW, COLOR_RED, COLOR_WHITE);
|
||||
xvt_app_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_CONTROL, COLOR_BLACK, COLOR_WHITE);
|
||||
xvt_app_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_DISABLED, COLOR_GRAY, COLOR_WHITE);
|
||||
xvt_app_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MNEMONIC, COLOR_RED, COLOR_WHITE);
|
||||
|
||||
RCT rct;
|
||||
get_client_rect( SCREEN_WIN, &rct );
|
||||
create_window(W_PLAIN, &rct, (char*) "BACKDROP", 0, TASK_WIN,
|
||||
WSF_NO_MENUBAR | WSF_CH_BACKDROP , EM_UPDATE,
|
||||
backdrop_eh, 0L );
|
||||
xvt_vobj_get_client_rect( SCREEN_WIN, &rct );
|
||||
xvt_win_create(W_PLAIN, &rct, (char*) "BACKDROP", 0, TASK_WIN,
|
||||
WSF_NO_MENUBAR | WSF_CH_BACKDROP , EM_UPDATE,
|
||||
backdrop_eh, 0L );
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -102,39 +101,39 @@ void TBanner::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
if (ep->type == E_UPDATE)
|
||||
{
|
||||
const int BIGY = CHARY<<1;
|
||||
const int BIGY = 3*CHARY/2;
|
||||
|
||||
clear(COLOR_LTGRAY);
|
||||
RCT r; get_client_rect(win, &r);
|
||||
RCT r; xvt_vobj_get_client_rect(win, &r);
|
||||
|
||||
set_color(COLOR_WHITE, COLOR_LTGRAY);
|
||||
set_font(FF_TIMES, FS_BOLD | FS_ITALIC, BIGY);
|
||||
set_font(XVT_FFN_TIMES, XVT_FS_BOLD | XVT_FS_ITALIC, BIGY);
|
||||
char* t = (char*)(const char*)main_app().title();
|
||||
int w = win_get_text_width(win, t, -1);
|
||||
int a; win_get_font_metrics(win, NULL, &a, NULL);
|
||||
int w = xvt_dwin_get_text_width(win, t, -1);
|
||||
int a; xvt_dwin_get_font_metrics(win, NULL, &a, NULL);
|
||||
int x = (r.right-w)>>1, y = (r.bottom+a)>>1 ;
|
||||
win_draw_text(win, x+1, y+1, t, -1);
|
||||
xvt_dwin_draw_text(win, x+1, y+1, t, -1);
|
||||
set_color(COLOR_BLACK, COLOR_LTGRAY);
|
||||
win_draw_text(win, x, y, t, -1);
|
||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||
|
||||
set_font(FF_TIMES);
|
||||
set_font(XVT_FFN_TIMES);
|
||||
t = "PRASSI S.p.A.";
|
||||
w = win_get_text_width(win, t, -1);
|
||||
w = xvt_dwin_get_text_width(win, t, -1);
|
||||
x = (r.right-r.left-w)>>1, y = BIGY;
|
||||
win_draw_text(win, x, y, t, -1);
|
||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||
|
||||
t = "Caricamento in corso";
|
||||
w = win_get_text_width(win, t, -1);
|
||||
w = xvt_dwin_get_text_width(win, t, -1);
|
||||
x = (r.right-r.left-w)>>1, y = r.bottom - CHARY;
|
||||
win_draw_text(win, x, y, t, -1);
|
||||
xvt_dwin_draw_text(win, x, y, t, -1);
|
||||
|
||||
r.left += 5; r.right -= 4;
|
||||
r.top += 5; r.bottom -= 4;
|
||||
set_pen(COLOR_WHITE); win_draw_rect(win, &r);
|
||||
offset_rect(&r, -1, -1);
|
||||
set_pen(COLOR_BLACK); win_draw_rect(win, &r);
|
||||
set_pen(COLOR_WHITE); xvt_dwin_draw_rect(win, &r);
|
||||
xvt_rect_offset(&r, -1, -1);
|
||||
set_pen(COLOR_BLACK); xvt_dwin_draw_rect(win, &r);
|
||||
|
||||
win_draw_icon(win, CHARX<<1, CHARX<<1, ICON_RSRC);
|
||||
xvt_dwin_draw_icon(win, CHARX<<1, CHARX<<1, ICON_RSRC);
|
||||
}
|
||||
else
|
||||
TWindow::handler(win, ep);
|
||||
@ -200,8 +199,8 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
set_firm();
|
||||
break;
|
||||
case M_FILE_REVERT:
|
||||
config();
|
||||
on_config_change();
|
||||
if (config())
|
||||
on_config_change();
|
||||
break;
|
||||
case (M_FILE+11):
|
||||
about();
|
||||
@ -223,7 +222,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
||||
if (ep->v.query)
|
||||
{
|
||||
if (can_close())
|
||||
quit_OK();
|
||||
xvt_app_allow_quit();
|
||||
}
|
||||
else
|
||||
stop_run();
|
||||
@ -238,9 +237,9 @@ default:
|
||||
|
||||
void TApplication::stop_run()
|
||||
{
|
||||
if (_savefirm) prefhndl->set_codditta(_savefirm);
|
||||
if (_savefirm) prefix().set_codditta(_savefirm);
|
||||
terminate();
|
||||
xvt_terminate();
|
||||
xvt_app_destroy();
|
||||
}
|
||||
|
||||
|
||||
@ -295,7 +294,7 @@ void TApplication::terminate()
|
||||
|
||||
if (fexist("prassi.hlp"))
|
||||
{
|
||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
|
||||
}
|
||||
#endif
|
||||
@ -350,9 +349,10 @@ void TApplication::set_perms()
|
||||
}
|
||||
_user_aut.set(0, TRUE);
|
||||
|
||||
if (_user.not_empty())
|
||||
const TString& utente = user();
|
||||
if (utente.not_empty())
|
||||
{
|
||||
if (_user == "PRASSI")
|
||||
if (utente == "PRASSI")
|
||||
{
|
||||
for (int i = 1 ; i < ENDAUT; i++)
|
||||
_user_aut.set(i);
|
||||
@ -362,7 +362,7 @@ void TApplication::set_perms()
|
||||
TLocalisamfile users(LF_USER);
|
||||
|
||||
users.zero();
|
||||
users.put("USERNAME", _user);
|
||||
users.put("USERNAME", utente);
|
||||
if (users.read() == NOERR)
|
||||
{
|
||||
const TString80 aut(users.get("AUTSTR"));
|
||||
@ -379,14 +379,14 @@ void TApplication::set_perms()
|
||||
void TApplication::check_parameters(int & argc, char* argv[])
|
||||
{
|
||||
if (strncmp(argv[argc-1], "-u", 2) == 0)
|
||||
_user = &argv[--argc][2];
|
||||
user() = &argv[--argc][2];
|
||||
#ifdef DBG
|
||||
else _user = "PRASSI";
|
||||
else user() = "PRASSI";
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
const long twin_style = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE | WSF_MAXIMIZED;
|
||||
set_value(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, twin_style);
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, twin_style);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -397,13 +397,13 @@ void TApplication::run(int argc, char* argv[], const char* title)
|
||||
|
||||
base.ext(""); base.lower();
|
||||
_title = title;
|
||||
if (_user.empty())
|
||||
if (user().empty())
|
||||
check_parameters(argc, argv);
|
||||
|
||||
__argc = argc;
|
||||
__argv = (const char**)argv;
|
||||
|
||||
int addbar;
|
||||
int addbar = 0;
|
||||
if (argc > 1)
|
||||
{
|
||||
addbar = atoi(argv[1]+1);
|
||||
@ -430,10 +430,9 @@ void TApplication::run(int argc, char* argv[], const char* title)
|
||||
const TFixed_string mod(get_module_name());
|
||||
if (mod.empty()) return;
|
||||
|
||||
TString80 caption;
|
||||
caption << "PRASSI S.p.A. - " << mod;
|
||||
TString caption; caption << "PRASSI S.p.A. - " << mod;
|
||||
|
||||
static XVT_CONFIG cfg;
|
||||
XVT_CONFIG cfg;
|
||||
cfg.base_appl_name = (char*)base.name();
|
||||
cfg.appl_name = (char*)(const char*)_title;
|
||||
cfg.taskwin_title = (char*)(const char*)caption;
|
||||
@ -443,7 +442,7 @@ void TApplication::run(int argc, char* argv[], const char* title)
|
||||
customize_controls(TRUE);
|
||||
|
||||
_application = this;
|
||||
xvt_system(argc, argv, 0L, task_eh, &cfg);
|
||||
xvt_app_create(argc, argv, 0L, task_eh, &cfg);
|
||||
}
|
||||
|
||||
|
||||
@ -466,31 +465,27 @@ void TApplication::print()
|
||||
|
||||
void TApplication::check_menu_item(MENU_TAG item)
|
||||
{
|
||||
win_menu_check(TASK_WIN, item, TRUE);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
xvt_menu_set_item_checked(TASK_WIN, item, TRUE);
|
||||
xvt_menu_update(TASK_WIN);
|
||||
}
|
||||
|
||||
void TApplication::uncheck_menu_item(MENU_TAG item)
|
||||
{
|
||||
win_menu_check(TASK_WIN, item, FALSE);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
xvt_menu_set_item_checked(TASK_WIN, item, FALSE);
|
||||
xvt_menu_update(TASK_WIN);
|
||||
}
|
||||
|
||||
|
||||
void TApplication::enable_menu_item(MENU_TAG item, bool on)
|
||||
{
|
||||
win_menu_enable(TASK_WIN, item, on);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
xvt_menu_set_item_enabled(TASK_WIN, item, on);
|
||||
xvt_menu_update(TASK_WIN);
|
||||
}
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
void TApplication::dispatch_e_menu(MENU_TAG item)
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HWND w = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
HWND w = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
PostMessage(w, WM_COMMAND, item, 0L);
|
||||
#else
|
||||
::dispatch_e_menu(TASK_WIN, item);
|
||||
@ -511,12 +506,12 @@ bool TApplication::has_module(int module, int checktype) const
|
||||
|
||||
long TApplication::get_firm() const
|
||||
{
|
||||
return prefhndl->get_codditta();
|
||||
return prefix().get_codditta();
|
||||
}
|
||||
|
||||
const char* TApplication::get_firm_dir() const
|
||||
{
|
||||
return format("%s%s", __ptprf, prefhndl->name());
|
||||
return format("%s%s", __ptprf, prefix().name());
|
||||
}
|
||||
|
||||
|
||||
@ -541,13 +536,13 @@ bool TApplication::set_firm(long newfirm)
|
||||
newfirm = mask.get_long(F_CODDITTA);
|
||||
const int tipodir = mask.get_int(F_TIPO);
|
||||
|
||||
if (tipodir == 0 && !prefhndl->exist(newfirm) &&
|
||||
if (tipodir == 0 && !prefix().exist(newfirm) &&
|
||||
!build_firm_data(newfirm))
|
||||
return FALSE;
|
||||
if (tipodir > 0)
|
||||
{
|
||||
if (_savefirm == 0) _savefirm = oldfirm;
|
||||
prefhndl->set(tipodir == 1 ? "com" : "");
|
||||
if (_savefirm == 0) _savefirm = oldfirm; // E' necessario ricordare la ditta ...
|
||||
prefix().set(tipodir == 1 ? "com" : ""); // ... se si setta il prefix a com
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -556,9 +551,9 @@ bool TApplication::set_firm(long newfirm)
|
||||
if (newfirm == oldfirm || newfirm < 1)
|
||||
return newfirm > 0;
|
||||
|
||||
if (prefhndl->test(newfirm))
|
||||
if (prefix().test(newfirm))
|
||||
{
|
||||
prefhndl->set_codditta(newfirm);
|
||||
prefix().set_codditta(newfirm);
|
||||
_savefirm = 0;
|
||||
|
||||
WINDOW w = cur_win();
|
||||
@ -568,7 +563,7 @@ bool TApplication::set_firm(long newfirm)
|
||||
e.type = E_COMMAND;
|
||||
e.v.cmd.tag = M_FILE_NEW;
|
||||
e.v.cmd.shift = e.v.cmd.control = 0;
|
||||
dispatch_event(w, &e);
|
||||
xvt_win_dispatch_event(w, &e);
|
||||
}
|
||||
|
||||
on_firm_change();
|
||||
@ -644,7 +639,7 @@ void TApplication::set_cursor(bool w)
|
||||
if (w)
|
||||
{
|
||||
if (_count == 0)
|
||||
::set_cursor(ww, CURSOR_WAIT);
|
||||
xvt_win_set_cursor(ww, CURSOR_WAIT);
|
||||
_count++;
|
||||
}
|
||||
else
|
||||
@ -652,7 +647,7 @@ void TApplication::set_cursor(bool w)
|
||||
_count--;
|
||||
CHECK(_count >= 0, "end_wait without matching begin_wait");
|
||||
if (_count == 0)
|
||||
::set_cursor(ww, CURSOR_ARROW);
|
||||
xvt_win_set_cursor(ww, CURSOR_ARROW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,9 @@ class TApplication
|
||||
TPrinter* _printer;
|
||||
|
||||
long _savefirm;
|
||||
bool _create_ok;
|
||||
bool _create_ok; // Succesfully created
|
||||
word _waiting;
|
||||
|
||||
static TString16 _user;
|
||||
|
||||
void terminate(); // End of application
|
||||
void set_cursor(bool w); // Change mouse cursor
|
||||
bool config(); // Change parameters
|
||||
@ -55,12 +53,10 @@ protected:
|
||||
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
|
||||
virtual bool build_firm_data(long cod, bool flagcom = FALSE) { return TRUE;}
|
||||
virtual bool destroy(); // Rimuove l'applicazione
|
||||
virtual void print();
|
||||
|
||||
virtual void on_config_change();
|
||||
virtual void on_firm_change();
|
||||
|
||||
void set_user(const char * user) { _user = user; }
|
||||
void set_perms();
|
||||
|
||||
public:
|
||||
@ -72,6 +68,9 @@ public:
|
||||
// @DES Queste funzioni possono essere ridefinite da ogni applicazione
|
||||
// @FPUB
|
||||
virtual word class_id() const { return CLASS_APPLICATION; }
|
||||
virtual bool ok() const { return _create_ok; }
|
||||
virtual void print();
|
||||
|
||||
void stop_run(); // Forza chiusura applicazione
|
||||
|
||||
void check_menu_item(MENU_TAG item); // Check menu
|
||||
@ -92,7 +91,6 @@ public:
|
||||
TPrinter& printer();
|
||||
|
||||
static void check_parameters(int & argc, char *argv[]);
|
||||
static const TString& user() { return _user; }
|
||||
|
||||
bool has_module(int module, int checktype = CHK_ALL) const;
|
||||
bool set_firm(long cod = -1);
|
||||
|
@ -1,10 +1,6 @@
|
||||
#ifndef __ASSOC_H
|
||||
#define __ASSOC_H
|
||||
|
||||
#ifndef __ARRAY_H
|
||||
#include <array.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
@ -1,220 +1,220 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef FOXPRO
|
||||
#undef XVT_OS
|
||||
#include <windows.h>
|
||||
#include <pro_ext.h>
|
||||
#endif
|
||||
|
||||
#ifdef XVT_OS
|
||||
#include <xvt_os.h>
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#include <keys.h>
|
||||
#else
|
||||
#include <xvtility.h>
|
||||
#endif
|
||||
#include <applicat.h>
|
||||
#endif /* XVT_OS */
|
||||
|
||||
|
||||
#include <checks.h>
|
||||
|
||||
#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr)
|
||||
|
||||
#ifdef XVT_OS
|
||||
|
||||
int fatal_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_ICONHAND);
|
||||
MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL);
|
||||
|
||||
if (xvt_running())
|
||||
main_app().stop_run();
|
||||
else
|
||||
exit(1);
|
||||
#else
|
||||
beep();
|
||||
if (xvt_running()) xvt_fatal("%s", msg);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
getchar();
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int error_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_ICONEXCLAMATION);
|
||||
MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION);
|
||||
#else
|
||||
beep();
|
||||
if (xvt_running()) xvt_error("%s", msg);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
getchar();
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int warning_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_ICONQUESTION);
|
||||
MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION);
|
||||
#else
|
||||
beep();
|
||||
xvt_note("%s", msg);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int message_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
|
||||
#else
|
||||
xvt_note("%s", msg);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sorry_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_OK);
|
||||
MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION);
|
||||
#else
|
||||
xvt_note("%s", msg);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int yesno_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
|
||||
return r == IDYES;
|
||||
#else
|
||||
ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", NULL, "%s", msg);
|
||||
return r == RESP_DEFAULT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int yesnofatal_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#ifdef DBG
|
||||
char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg);
|
||||
const int ret = yesno_box("%s", s);
|
||||
if (!ret) fatal_box("");
|
||||
#else
|
||||
fatal_box("%s", msg);
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int yesnocancel_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNOCANCEL | MB_ICONQUESTION);
|
||||
if (r == IDYES) r = K_YES;
|
||||
else
|
||||
if (r == IDNO) r = K_NO;
|
||||
else
|
||||
r = K_ESC;
|
||||
return r;
|
||||
#else
|
||||
ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg);
|
||||
if (r == RESP_DEFAULT) r = K_YES;
|
||||
else
|
||||
if (r == RESP_2) r = K_NO;
|
||||
else
|
||||
r = K_ESC;
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
int __trace(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
FILE* f = fopen("trace.log", "a");
|
||||
if (f != NULL)
|
||||
{
|
||||
fprintf(f, "%s\n", msg);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
return f != NULL;
|
||||
}
|
||||
|
||||
#endif // XVT_OS
|
||||
|
||||
|
||||
#ifdef FOXPRO
|
||||
|
||||
int error_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fatal_box(const char* fmt, ...)
|
||||
{
|
||||
MessageBeep(MB_ICONHAND);
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int message_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int yesnofatal_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
#endif // FOXPRO
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef FOXPRO
|
||||
#undef XVT_OS
|
||||
#include <windows.h>
|
||||
#include <pro_ext.h>
|
||||
#endif
|
||||
|
||||
#ifdef XVT_OS
|
||||
#include <xvt.h>
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#include <keys.h>
|
||||
#else
|
||||
#include <xvtility.h>
|
||||
#endif
|
||||
#include <applicat.h>
|
||||
#endif /* XVT_OS */
|
||||
|
||||
|
||||
#include <checks.h>
|
||||
|
||||
#define buildmsg() char msg[256];va_list argptr;va_start(argptr,fmt);vsprintf(msg,fmt,argptr);va_end(argptr)
|
||||
|
||||
#ifdef XVT_OS
|
||||
|
||||
int fatal_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_ICONHAND);
|
||||
MessageBox(GetFocus(), msg, "ERRORE FATALE", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL);
|
||||
|
||||
if (xvt_running())
|
||||
main_app().stop_run();
|
||||
else
|
||||
exit(1);
|
||||
#else
|
||||
beep();
|
||||
if (xvt_running()) xvt_dm_post_fatal_exit("%s", msg);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
getchar();
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int error_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_ICONEXCLAMATION);
|
||||
MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION);
|
||||
#else
|
||||
beep();
|
||||
if (xvt_running()) xvt_dm_post_error("%s", msg);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
getchar();
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int warning_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_ICONQUESTION);
|
||||
MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION);
|
||||
#else
|
||||
beep();
|
||||
xvt_dm_post_note("%s", msg);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int message_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
|
||||
#else
|
||||
xvt_dm_post_note("%s", msg);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sorry_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
MessageBeep(MB_OK);
|
||||
MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION);
|
||||
#else
|
||||
xvt_dm_post_note("%s", msg);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int yesno_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
|
||||
return r == IDYES;
|
||||
#else
|
||||
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", NULL, "%s", msg);
|
||||
return r == RESP_DEFAULT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int yesnofatal_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#ifdef DBG
|
||||
char s[256]; sprintf(s, "%s\nContinuare ugualmente?", msg);
|
||||
const int ret = yesno_box("%s", s);
|
||||
if (!ret) fatal_box("");
|
||||
#else
|
||||
fatal_box("%s", msg);
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
int yesnocancel_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNOCANCEL | MB_ICONQUESTION);
|
||||
if (r == IDYES) r = K_YES;
|
||||
else
|
||||
if (r == IDNO) r = K_NO;
|
||||
else
|
||||
r = K_ESC;
|
||||
return r;
|
||||
#else
|
||||
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg);
|
||||
if (r == RESP_DEFAULT) r = K_YES;
|
||||
else
|
||||
if (r == RESP_2) r = K_NO;
|
||||
else
|
||||
r = K_ESC;
|
||||
return r;
|
||||
#endif
|
||||
}
|
||||
|
||||
int __trace(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
FILE* f = fopen("trace.log", "a");
|
||||
if (f != NULL)
|
||||
{
|
||||
fprintf(f, "%s\n", msg);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
return f != NULL;
|
||||
}
|
||||
|
||||
#endif // XVT_OS
|
||||
|
||||
|
||||
#ifdef FOXPRO
|
||||
|
||||
int error_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fatal_box(const char* fmt, ...)
|
||||
{
|
||||
MessageBeep(MB_ICONHAND);
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int message_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int yesnofatal_box(const char* fmt, ...)
|
||||
{
|
||||
buildmsg();
|
||||
_UserError(msg);
|
||||
return 0;
|
||||
}
|
||||
#endif // FOXPRO
|
||||
|
||||
|
@ -54,16 +54,16 @@ bool TConfig_application::menu(MENU_TAG m)
|
||||
|
||||
void TConfig_application::do_config(int m)
|
||||
{
|
||||
TString par(name());
|
||||
if (m < _paragraphs.items())
|
||||
par = (TString&)_paragraphs[m];
|
||||
else par.cut(2);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
TString par = name();
|
||||
if (m < _paragraphs.items())
|
||||
par = (TString&)_paragraphs[m];
|
||||
else par.cut(2);
|
||||
|
||||
TConfig cnf(_which_config, par);
|
||||
|
||||
TString maskname(cnf.get("EdMask"));
|
||||
const TFilename maskname(cnf.get("EdMask"));
|
||||
if (!maskname.empty())
|
||||
{
|
||||
TMask m(maskname);
|
||||
|
@ -56,15 +56,13 @@ bool TConfig::_read_paragraph()
|
||||
void TConfig::_write_paragraph(ofstream& out)
|
||||
{
|
||||
_data.restart();
|
||||
TString cnf(16);
|
||||
cnf << '[' << _paragraph << ']';
|
||||
out << cnf << '\n';
|
||||
out << '[' << _paragraph << ']' << endl;
|
||||
for (int i = 0; i < _data.items(); i++)
|
||||
{
|
||||
THash_object* o = _data.get_hashobj();
|
||||
out << o->key() << "\t= " << (TString&)(o->obj()) << '\n';
|
||||
}
|
||||
out << '\n';
|
||||
out << endl;
|
||||
}
|
||||
|
||||
void TConfig::_write_file()
|
||||
@ -75,8 +73,8 @@ void TConfig::_write_file()
|
||||
ofstream out(temp);
|
||||
|
||||
TFixed_string l(__tmp_string, sizeof(__tmp_string));
|
||||
TString cnf(16);
|
||||
cnf << '[' << _paragraph << ']';
|
||||
TString80 cnf; cnf << '[' << _paragraph << ']';
|
||||
|
||||
bool skip = FALSE, done = FALSE;
|
||||
|
||||
while (!in.eof())
|
||||
@ -124,27 +122,38 @@ void TConfig::_check_paragraph(const char* section)
|
||||
|
||||
bool TConfig::exist(const char* var, int index)
|
||||
{
|
||||
TString80 vvar(var);
|
||||
if (index != -1) vvar << '(' << index << ')';
|
||||
return _data.is_key(vvar);
|
||||
if (index >= 0)
|
||||
{
|
||||
TString80 vvar(var);
|
||||
vvar << '(' << index << ')';
|
||||
return _data.is_key(vvar);
|
||||
}
|
||||
return _data.is_key(var);
|
||||
}
|
||||
|
||||
TString& TConfig::get(const char* var, const char* section, int index, const char* def)
|
||||
{
|
||||
// ritorna valore di variabile nella sezione corrente o in
|
||||
// quella specificata
|
||||
static TFixed_string s(&__tmp_string[256], 256);
|
||||
TString80 vvar(var); if (index != -1) vvar << '(' << index << ')';
|
||||
HIDDEN TString256 s;
|
||||
|
||||
const char* v = var;
|
||||
if (index >= 0) // Mette indice tra parentesi
|
||||
{
|
||||
s = var;
|
||||
s << '(' << index << ')';
|
||||
v = s;
|
||||
}
|
||||
|
||||
_check_paragraph(section);
|
||||
|
||||
if (_data.is_key(vvar))
|
||||
s = (TString&)_data[vvar];
|
||||
if (_data.is_key(v))
|
||||
s = (TString&)_data[v];
|
||||
else
|
||||
{
|
||||
s = def;
|
||||
if (s.not_empty())
|
||||
set(var, s, section, TRUE, index);
|
||||
set(var, def, section, TRUE, index);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -250,7 +259,11 @@ void TConfig::init(const char *fn, const char* pa)
|
||||
_dirty = FALSE;
|
||||
|
||||
if (!fexist(_file))
|
||||
fatal_box("Impossibile aprire il file di configurazione %s", fn );
|
||||
{
|
||||
warning_box("Creazione del file di configurazione %s", fn );
|
||||
ofstream c(fn);
|
||||
c.close();
|
||||
}
|
||||
|
||||
if (_paragraph.empty())
|
||||
{
|
||||
@ -282,14 +295,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
||||
}
|
||||
_file << "config";
|
||||
if (!fexist(_file))
|
||||
{
|
||||
#if XVT_OS==XVT_OS_SCOUNIX
|
||||
mkdir(_file, 0777);
|
||||
#else
|
||||
mkdir(_file);
|
||||
#endif
|
||||
}
|
||||
_file << '/' << main_app().user() << ".ini";
|
||||
make_dir(_file);
|
||||
_file << '/' << user() << ".ini";
|
||||
break;
|
||||
default:
|
||||
_file = "prassi.ini";
|
||||
|
@ -2,7 +2,6 @@ extern "C"
|
||||
{
|
||||
#include <xvt.h>
|
||||
#include <xvtcm.h>
|
||||
#include <cpb.h>
|
||||
}
|
||||
|
||||
#if XVT_OS != XVT_OS_WIN
|
||||
@ -13,7 +12,7 @@ extern "C"
|
||||
#include <controls.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <xvtility.h>
|
||||
#include <window.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
@ -21,148 +20,34 @@ extern "C"
|
||||
// TPicture_array
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TPicture_array
|
||||
class TPicture_array : public TArray
|
||||
{
|
||||
enum { MAXPIC = 128 };
|
||||
PICTURE _picture[MAXPIC];
|
||||
|
||||
public:
|
||||
PICTURE getbmp(short id, bool convert = FALSE);
|
||||
PICTURE operator[](short id) { return _picture[id-BMP_OK]; }
|
||||
void reset();
|
||||
TImage* add(short id, bool convert = FALSE);
|
||||
|
||||
TImage& image(short id) { return (TImage&)operator[](id); }
|
||||
const TImage& image(short id) const { return (const TImage&)operator[](id); }
|
||||
bool exist(short id) const { return objptr(id) != NULL; }
|
||||
|
||||
TPicture_array();
|
||||
~TPicture_array() { reset(); }
|
||||
TPicture_array() : TArray(128) {}
|
||||
~TPicture_array() {}
|
||||
};
|
||||
|
||||
TImage* TPicture_array::add(short id, bool convert)
|
||||
{
|
||||
TImage* i = (TImage*)objptr(id);
|
||||
|
||||
HIDDEN byte COLOR2PIC(COLOR c)
|
||||
{
|
||||
static unsigned long color[16][2] =
|
||||
if (i == NULL)
|
||||
{
|
||||
0x000000, 0x00, // BLACK
|
||||
0x0000FF, 0x04, // BLUE
|
||||
0x000080, 0x0C, // LTBLUE
|
||||
0x008000, 0x02, // DKGREEN
|
||||
0x008080, 0x06, // DKCYAN
|
||||
0x00FF00, 0xFA, // GREEN
|
||||
0x00FFFF, 0xFE, // CYAN
|
||||
0x800000, 0x01, // DKRED
|
||||
0x800080, 0xFD, // DKMAGENTA
|
||||
0x808000, 0x03, // DKYELLOW
|
||||
0x808080, 0xF8, // GRAY
|
||||
0xC0C0C0, 0x07, // LTGRAY
|
||||
0xFF0000, 0xF9, // RED
|
||||
0xFF00FF, 0x05, // MAGENTA
|
||||
0xFFFF00, 0xFB, // YELLOW
|
||||
0xFFFFFF, 0xFF, // WHITE
|
||||
};
|
||||
i = new TImage(id);
|
||||
TArray::add(i, id);
|
||||
if (convert)
|
||||
i->convert_to_default_colors();
|
||||
}
|
||||
|
||||
int idx, f = 0, l = 15;
|
||||
c &= 0x00FFFFFF;
|
||||
while (TRUE)
|
||||
{
|
||||
idx = (f+l)>>1;
|
||||
if (c == color[idx][0]) break;
|
||||
if (c > color[idx][0]) f = idx+1;
|
||||
else l = idx-1;
|
||||
if (f > l)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const byte b = (byte)color[idx][1];
|
||||
return b;
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
PICTURE xvt_picture_load(short id, bool convert)
|
||||
{
|
||||
static bool _can_convert = 2;
|
||||
if (_can_convert == 2)
|
||||
{
|
||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
HDC hdc = GetDC(hwnd);
|
||||
const int bits = GetDeviceCaps(hdc, BITSPIXEL);
|
||||
_can_convert = bits == 8;
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
PICTURE cpb = cpb_picture_load(id);
|
||||
CHECKD(cpb, "Can't load picture ", id);
|
||||
|
||||
if (convert && _can_convert && MASK_BACK_COLOR != COLOR_DKCYAN)
|
||||
{
|
||||
long size;
|
||||
char huge * buf = picture_lock(cpb, &size);
|
||||
if (buf != NULL)
|
||||
{
|
||||
RCT r; cpb_get_picture_size(cpb, &r);
|
||||
const byte newba = COLOR2PIC(MASK_BACK_COLOR);
|
||||
const byte newlt = COLOR2PIC(MASK_LIGHT_COLOR);
|
||||
const byte newdk = COLOR2PIC(MASK_DARK_COLOR);
|
||||
|
||||
const long first = 14;
|
||||
const long last = first + (long)r.right*r.bottom;
|
||||
for (long i = first; i < last; i++) switch((byte)buf[i])
|
||||
{
|
||||
case 0x06:
|
||||
buf[i] = newba; break;
|
||||
case 0xF8:
|
||||
buf[i] = newdk; break;
|
||||
case 0xFE:
|
||||
buf[i] = newlt; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const PICTURE old = cpb;
|
||||
cpb = picture_make(buf, size, &r);
|
||||
picture_unlock(old);
|
||||
picture_free(old);
|
||||
}
|
||||
}
|
||||
|
||||
return cpb;
|
||||
}
|
||||
|
||||
|
||||
PICTURE TPicture_array::getbmp(short id, bool convert)
|
||||
{
|
||||
const int i = id-BMP_OK;
|
||||
CHECKD(i >= 0 && i < MAXPIC, "Control ID out of range", id);
|
||||
|
||||
if (_picture[i] != NULL)
|
||||
{
|
||||
if (i < 100) return _picture[i];
|
||||
picture_free(_picture[i]);
|
||||
}
|
||||
_picture[i] = xvt_picture_load(id, convert);
|
||||
|
||||
if (_picture[i] == NULL)
|
||||
error_box("Can't load picture %d", id);
|
||||
|
||||
return _picture[i];
|
||||
}
|
||||
|
||||
|
||||
TPicture_array::TPicture_array()
|
||||
{
|
||||
memset(_picture, 0, sizeof(_picture));
|
||||
}
|
||||
|
||||
void TPicture_array::reset()
|
||||
{
|
||||
for (int i = 0; i < MAXPIC; i++)
|
||||
if (_picture[i] != NULL)
|
||||
{
|
||||
picture_free(_picture[i]);
|
||||
_picture[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Static data and functions
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -175,7 +60,7 @@ HIDDEN TPicture_array cpb;
|
||||
|
||||
HIDDEN void get_geometry(WINDOW win)
|
||||
{
|
||||
get_client_rect(win, &_client);
|
||||
xvt_vobj_get_client_rect(win, &_client);
|
||||
_client.right--; _client.bottom--;
|
||||
_hdc = win;
|
||||
}
|
||||
@ -207,7 +92,7 @@ void xvt_draw_rect(WINDOW win, const RCT& rect, COLOR lt, COLOR rb, short depth)
|
||||
|
||||
for (short d = 0; d < depth;)
|
||||
{
|
||||
win_set_cpen(win, &pen);
|
||||
xvt_dwin_set_cpen(win, &pen);
|
||||
|
||||
PNT p; // Current vertex of the rectangle
|
||||
|
||||
@ -215,12 +100,12 @@ void xvt_draw_rect(WINDOW win, const RCT& rect, COLOR lt, COLOR rb, short depth)
|
||||
if (lt != COLOR_LTGRAY)
|
||||
{
|
||||
p.h = r.left; p.v = r.bottom;
|
||||
win_move_to(win, p);
|
||||
xvt_dwin_draw_set_pos(win, p);
|
||||
|
||||
p.v = r.top;
|
||||
win_draw_line(win, p);
|
||||
xvt_dwin_draw_line(win, p);
|
||||
p.h = r.right;
|
||||
win_draw_line(win, p);
|
||||
xvt_dwin_draw_line(win, p);
|
||||
drawed = TRUE;
|
||||
}
|
||||
|
||||
@ -229,17 +114,17 @@ void xvt_draw_rect(WINDOW win, const RCT& rect, COLOR lt, COLOR rb, short depth)
|
||||
if (pen.color != rb)
|
||||
{
|
||||
pen.color = rb;
|
||||
win_set_cpen(win, &pen);
|
||||
xvt_dwin_set_cpen(win, &pen);
|
||||
}
|
||||
if (!drawed)
|
||||
{
|
||||
p.h = r.right; p.v = r.top;
|
||||
win_move_to(win, p);
|
||||
xvt_dwin_draw_set_pos(win, p);
|
||||
}
|
||||
p.v = r.bottom;
|
||||
win_draw_line(win, p);
|
||||
xvt_dwin_draw_line(win, p);
|
||||
p.h = r.left;
|
||||
win_draw_line(win, p);
|
||||
xvt_dwin_draw_line(win, p);
|
||||
}
|
||||
|
||||
if (++d < depth)
|
||||
@ -255,18 +140,47 @@ void TControl::create(
|
||||
short left, short top, short right, short bottom, const char* title,
|
||||
WINDOW parent, long flags, long app_data, short id)
|
||||
{
|
||||
bool bold = *title == '@';
|
||||
if (bold) title += 2;
|
||||
bool bold = FALSE;
|
||||
_color = NORMAL_COLOR;
|
||||
|
||||
while (*title == '@' || *title == '$')
|
||||
{
|
||||
switch (*title++)
|
||||
{
|
||||
case '@':
|
||||
if (toupper(*title) == 'B') bold = TRUE;
|
||||
break;
|
||||
case '$':
|
||||
title++; // Skip [
|
||||
if (isalpha(*title))
|
||||
_color = trans_color(*title);
|
||||
else
|
||||
{
|
||||
int r = 0, g = 0, b = 0;
|
||||
sscanf(title, "%d,%d,%d", &r, &g, &b);
|
||||
_color = MAKE_COLOR(r, g, b);
|
||||
}
|
||||
while (*title != ']') // Find ]
|
||||
{
|
||||
CHECK(*title, "Bad prompt format");
|
||||
title++;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
title++;
|
||||
}
|
||||
|
||||
const int prop_count = 1;
|
||||
const char* prop_list[prop_count+1] = { title, NULL };
|
||||
|
||||
_id = id;
|
||||
_caption = title; _caption.strip("~");
|
||||
_disabled = (flags & CTL_FLAG_DISABLED) != 0;
|
||||
_checked = (flags & CTL_FLAG_CHECKED) != 0;
|
||||
_multiple = (flags & CTL_FLAG_MULTIPLE) != 0;
|
||||
_focused = FALSE;
|
||||
_caption = title; _caption.strip("~");
|
||||
|
||||
creating = this;
|
||||
ctl_flags = flags;
|
||||
@ -276,8 +190,8 @@ void TControl::create(
|
||||
CHECKD(_win, "Can't create control ", id);
|
||||
|
||||
creating = NULL;
|
||||
set_app_data(_win, app_data);
|
||||
xvt_set_font(_win, FF_FIXED, bold ? FS_BOLD : 0);
|
||||
xvt_vobj_set_data(_win, app_data);
|
||||
xvt_set_font(_win, "", int(bold ? XVT_FS_BOLD : XVT_FS_NONE));
|
||||
}
|
||||
|
||||
|
||||
@ -288,8 +202,8 @@ TControl::~TControl()
|
||||
|
||||
long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
static bool tracking = FALSE;
|
||||
static bool pressed = FALSE;
|
||||
HIDDEN bool tracking = FALSE;
|
||||
HIDDEN bool pressed = FALSE;
|
||||
|
||||
if (ep->type == E_CREATE)
|
||||
xvtcm_eh_start(win, ep);
|
||||
@ -313,7 +227,7 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
||||
cc->update();
|
||||
break;
|
||||
case E_MOUSE_DOWN:
|
||||
trap_mouse(win);
|
||||
xvt_win_trap_pointer(win);
|
||||
tracking = pressed = TRUE;
|
||||
cc->mouse_down(ep->v.mouse.where);
|
||||
break;
|
||||
@ -326,7 +240,7 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
||||
cc->mouse_up();
|
||||
break;
|
||||
default:
|
||||
dispatch_e_char(get_parent(win), key);
|
||||
dispatch_e_char(xvt_vobj_get_parent(win), key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -335,8 +249,8 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
||||
if (tracking)
|
||||
{
|
||||
RCT r;
|
||||
get_client_rect(win, &r);
|
||||
if (pt_in_rect(&r, ep->v.mouse.where))
|
||||
xvt_vobj_get_client_rect(win, &r);
|
||||
if (xvt_rect_has_point(&r, ep->v.mouse.where))
|
||||
{
|
||||
if (!pressed)
|
||||
{
|
||||
@ -357,7 +271,7 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
||||
case E_MOUSE_UP:
|
||||
if (tracking)
|
||||
{
|
||||
release_mouse();
|
||||
xvt_win_release_pointer();
|
||||
tracking = FALSE;
|
||||
if (pressed)
|
||||
{
|
||||
@ -384,7 +298,7 @@ void TControl::enable(bool on)
|
||||
{
|
||||
_disabled = !on;
|
||||
update();
|
||||
enable_window(win(), on);
|
||||
xvt_vobj_set_enabled(win(), on);
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,8 +311,8 @@ void TControl::update() const
|
||||
{
|
||||
if (_win != _hdc)
|
||||
get_geometry(_win);
|
||||
clear_window(_hdc, MASK_BACK_COLOR);
|
||||
win_set_fore_color(_hdc, disabled() ? DISABLED_COLOR : NORMAL_COLOR);
|
||||
xvt_dwin_clear(_hdc, MASK_BACK_COLOR);
|
||||
xvt_dwin_set_fore_color(_hdc, disabled() ? DISABLED_COLOR : color());
|
||||
}
|
||||
|
||||
void TControl::set_caption(const char* t)
|
||||
@ -433,8 +347,8 @@ TText::TText(short left, short top, short right, short bottom,
|
||||
void TText::update() const
|
||||
{
|
||||
TControl::update();
|
||||
win_set_fore_color(_hdc, NORMAL_COLOR);
|
||||
win_draw_text(_hdc, _client.left, _client.top+BASEY, (char*)caption(), -1);
|
||||
xvt_dwin_set_fore_color(_hdc, color());
|
||||
xvt_dwin_draw_text(_hdc, _client.left, _client.top+BASEY, (char*)caption(), -1);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -468,11 +382,11 @@ void TGroup::draw_round_rect(const RCT& r, COLOR c) const
|
||||
pen.pat = PAT_SOLID;
|
||||
pen.style = P_SOLID;
|
||||
pen.color = c;
|
||||
win_set_cpen(_hdc, &pen);
|
||||
xvt_dwin_set_cpen(_hdc, &pen);
|
||||
|
||||
CBRUSH brush = { PAT_HOLLOW, MASK_BACK_COLOR };
|
||||
win_set_cbrush(_hdc, &brush);
|
||||
win_draw_roundrect(_hdc, (RCT*)&r, ROWY, ROWY);
|
||||
xvt_dwin_set_cbrush(_hdc, &brush);
|
||||
xvt_dwin_draw_roundrect(_hdc, (RCT*)&r, ROWY, ROWY);
|
||||
}
|
||||
|
||||
void TGroup::update() const
|
||||
@ -528,7 +442,7 @@ void TButton::draw_pressed(bool pressed) const
|
||||
{
|
||||
get_geometry(win());
|
||||
|
||||
clear_window(_hdc, COLOR_LTGRAY);
|
||||
xvt_dwin_clear(_hdc, COLOR_LTGRAY);
|
||||
RCT r = _client;
|
||||
xvt_draw_rect(_hdc, r, COLOR_BLACK, COLOR_BLACK);
|
||||
|
||||
@ -564,7 +478,7 @@ void TButton::mouse_up()
|
||||
e.v.ctl.id = id();
|
||||
e.v.ctl.ci.type = type();
|
||||
e.v.ctl.ci.win = win();
|
||||
dispatch_event(get_parent(win()), &e);
|
||||
xvt_win_dispatch_event(xvt_vobj_get_parent(win()), &e);
|
||||
}
|
||||
|
||||
void TButton::check(bool on)
|
||||
@ -579,9 +493,8 @@ void TButton::check(bool on)
|
||||
|
||||
class TPush_button : public TButton
|
||||
{
|
||||
PICTURE _picup, _picdn;
|
||||
byte _dx, _dy;
|
||||
int _accel;
|
||||
TImage *_picup, *_picdn;
|
||||
short _accel, _dx, _dy;
|
||||
|
||||
protected:
|
||||
void draw_pressed(bool pressed) const;
|
||||
@ -599,7 +512,7 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
long flags, long app_data, short id)
|
||||
: TButton(left-(id == DLG_F9), top, right, bottom,
|
||||
capt, parent, flags, app_data, id),
|
||||
_picup(0L), _picdn(0L)
|
||||
_picup(NULL), _picdn(NULL)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
@ -677,18 +590,21 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
if (diesis != NULL)
|
||||
{
|
||||
int pid = atoi(++diesis);
|
||||
_picup = cpb.getbmp(pid);
|
||||
_picup = cpb.add(pid);
|
||||
diesis = strchr(diesis, '#');
|
||||
if (diesis != NULL)
|
||||
{
|
||||
pid = atoi(++diesis);
|
||||
_picdn = cpb.getbmp(pid);
|
||||
}
|
||||
|
||||
RCT r;
|
||||
cpb_get_picture_size(_picup, &r);
|
||||
_dx = byte((width-r.right+1) >> 1);
|
||||
_dy = byte((height-r.bottom) >> 1);
|
||||
_picdn = cpb.add(pid);
|
||||
}
|
||||
|
||||
_dx = (width - _picup->width()) >> 1;
|
||||
_dy = (height - _picup->height()) >> 1;
|
||||
|
||||
_picup->set_pos(_dx, _dy);
|
||||
if (_picdn)
|
||||
_picdn->set_pos(_dx+DEPTH, _dy+DEPTH);
|
||||
|
||||
_accel = -1;
|
||||
}
|
||||
else
|
||||
@ -698,8 +614,8 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
if (_accel > 0)
|
||||
_accel *= CHARX;
|
||||
|
||||
_dx = (width - win_get_text_width(win(), (char*)caption(), -1)) >> 1;
|
||||
_dy = byte((height-CHARY)/2 + BASEY - DEPTH);
|
||||
_dx = (width - xvt_dwin_get_text_width(win(), (char*)caption(), -1)) >> 1;
|
||||
_dy = (height-CHARY)/2 + BASEY - DEPTH;
|
||||
}
|
||||
}
|
||||
|
||||
@ -711,26 +627,34 @@ void TPush_button::draw_pressed(bool pressed) const
|
||||
{
|
||||
TButton::draw_pressed(pressed);
|
||||
|
||||
const int p = pressed ? DEPTH : 0;
|
||||
if (_picup)
|
||||
{
|
||||
const PICTURE pic = (pressed && _picdn) ? _picdn : _picup;
|
||||
cpb_win_picture_draw_at(_hdc, pic, _dx+p, _dy+p);
|
||||
{
|
||||
const TImage* i = pressed ? _picdn : _picup;
|
||||
if (i == NULL)
|
||||
{
|
||||
RCT dst = _picup->rect();
|
||||
xvt_rect_offset(&dst, _dx+DEPTH, _dy+DEPTH);
|
||||
_picup->draw(_hdc, dst);
|
||||
}
|
||||
else i->draw(_hdc);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* t = caption();
|
||||
|
||||
win_set_fore_color(_hdc, COLOR_WHITE);
|
||||
win_draw_text(_hdc, _dx+p+1, _dy+p+1, (char*)t, -1);
|
||||
if (_accel >= 0)
|
||||
win_draw_text(_hdc, _dx+_accel+p+1, _dy+p+3, "_", 1);
|
||||
|
||||
const COLOR c = disabled() ? DISABLED_COLOR : NORMAL_COLOR;
|
||||
win_set_fore_color(_hdc, c);
|
||||
win_draw_text(_hdc, _dx+p, _dy+p, (char*)t, -1);
|
||||
const short x = _dx + DEPTH*pressed;
|
||||
const short y = _dy + DEPTH*pressed;
|
||||
|
||||
xvt_dwin_set_fore_color(_hdc, COLOR_WHITE);
|
||||
xvt_dwin_draw_text(_hdc, x+1, y+1, (char*)t, -1);
|
||||
if (_accel >= 0)
|
||||
win_draw_text(_hdc, _dx+_accel+p, _dy+p+2, "_", 1);
|
||||
xvt_dwin_draw_text(_hdc, x+_accel+1, y+1, "_", 1);
|
||||
|
||||
const COLOR c = disabled() ? DISABLED_COLOR : color();
|
||||
xvt_dwin_set_fore_color(_hdc, c);
|
||||
xvt_dwin_draw_text(_hdc, x, y, (char*)t, -1);
|
||||
if (_accel >= 0)
|
||||
xvt_dwin_draw_text(_hdc, x+_accel, y+0, "_", 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -744,10 +668,10 @@ void TPush_button::update() const
|
||||
pen.pat = PAT_SOLID;
|
||||
pen.style = P_SOLID;
|
||||
pen.color = COLOR_RED;
|
||||
win_set_cpen(_hdc, &pen);
|
||||
xvt_dwin_set_cpen(_hdc, &pen);
|
||||
CBRUSH brush = { PAT_HOLLOW, COLOR_WHITE };
|
||||
win_set_cbrush(_hdc, &brush);
|
||||
win_draw_rect(_hdc, &_client);
|
||||
xvt_dwin_set_cbrush(_hdc, &brush);
|
||||
xvt_dwin_draw_rect(_hdc, &_client);
|
||||
} else
|
||||
if (disabled() && _picup)
|
||||
{
|
||||
@ -756,7 +680,7 @@ void TPush_button::update() const
|
||||
pen.pat = PAT_SOLID;
|
||||
pen.style = P_SOLID;
|
||||
pen.color = COLOR_LTGRAY;
|
||||
win_set_cpen(_hdc, &pen);
|
||||
xvt_dwin_set_cpen(_hdc, &pen);
|
||||
|
||||
const int sx = _client.left+DEPTH+1;
|
||||
const int sy = _client.top+DEPTH+1;
|
||||
@ -766,16 +690,16 @@ void TPush_button::update() const
|
||||
for (int i = sx; i < ex; i += 2)
|
||||
{
|
||||
PNT p = { sy, i };
|
||||
win_move_to(_hdc, p);
|
||||
xvt_dwin_draw_set_pos(_hdc, p);
|
||||
p.v = ey;
|
||||
win_draw_line(_hdc, p);
|
||||
xvt_dwin_draw_line(_hdc, p);
|
||||
}
|
||||
for (i = sy; i < ey; i += 2)
|
||||
{
|
||||
PNT p = { i, sx };
|
||||
win_move_to(_hdc, p);
|
||||
xvt_dwin_draw_set_pos(_hdc, p);
|
||||
p.h = ex;
|
||||
win_draw_line(_hdc, p);
|
||||
xvt_dwin_draw_line(_hdc, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -802,13 +726,13 @@ public:
|
||||
|
||||
TPage_button::TPage_button(WINDOW parent, byte flag) : _flag(flag)
|
||||
{
|
||||
RCT r; get_client_rect(parent, &r);
|
||||
RCT r; xvt_vobj_get_client_rect(parent, &r);
|
||||
const int w = (flag == 3) ? width : width2;
|
||||
if (flag == 2) r.right -= w;
|
||||
|
||||
create(r.right-w, r.bottom-height, r.right, r.bottom,
|
||||
"", parent, 0L, 0L, DLG_PAGE);
|
||||
cpb.getbmp(BMP_BOOK1 + flag -1, flag == 3);
|
||||
cpb.add(BMP_BOOK1 + flag -1, flag == 3);
|
||||
}
|
||||
|
||||
void TPage_button::mouse_down(PNT where)
|
||||
@ -828,14 +752,14 @@ void TPage_button::mouse_down(PNT where)
|
||||
|
||||
void TPage_button::mouse_up()
|
||||
{
|
||||
dispatch_e_char(get_parent(win()), checked() ? K_PREV : K_NEXT);
|
||||
dispatch_e_char(xvt_vobj_get_parent(win()), checked() ? K_PREV : K_NEXT);
|
||||
}
|
||||
|
||||
void TPage_button::update() const
|
||||
{
|
||||
TControl::update();
|
||||
if (_flag)
|
||||
cpb_win_picture_draw_at(_hdc, cpb[BMP_BOOK1 + _flag -1], 0, 0);
|
||||
cpb.image(BMP_BOOK1 + _flag -1).draw(_hdc);
|
||||
}
|
||||
|
||||
void TPage_button::set_flag(byte f)
|
||||
@ -871,29 +795,29 @@ public:
|
||||
TTag_button::TTag_button(WINDOW parent, byte p, byte tot)
|
||||
: _parent(parent), _page(p), _pages(tot), _curr(p)
|
||||
{
|
||||
RCT r; get_client_rect(parent, &r);
|
||||
RCT r; xvt_vobj_get_client_rect(parent, &r);
|
||||
create(0, 0, r.right, CHARY, "", parent,0L,0L, DLG_PAGETAGS);
|
||||
}
|
||||
|
||||
void TTag_button::update() const
|
||||
{
|
||||
get_geometry(win());
|
||||
clear_window(_hdc, MASK_DARK_COLOR);
|
||||
xvt_dwin_clear(_hdc, MASK_DARK_COLOR);
|
||||
|
||||
for (int i = 0; i < _pages; i++)
|
||||
{
|
||||
RCT r; set_rect(&r, width*i, 0, width*(i+1), _client.bottom+4);
|
||||
RCT r; xvt_rect_set(&r, width*i, 0, width*(i+1), _client.bottom+4);
|
||||
CBRUSH b = { PAT_SOLID, (i == _page) ? MASK_BACK_COLOR : MASK_DARK_COLOR};
|
||||
win_set_cbrush(_hdc, &b);
|
||||
win_set_std_cpen(_hdc, TL_PEN_BLACK);
|
||||
win_draw_rect(_hdc, &r);
|
||||
xvt_dwin_set_cbrush(_hdc, &b);
|
||||
xvt_dwin_set_std_cpen(_hdc, TL_PEN_BLACK);
|
||||
xvt_dwin_draw_rect(_hdc, &r);
|
||||
|
||||
if (i == _page)
|
||||
xvt_draw_rect(_hdc, r, MASK_LIGHT_COLOR, MASK_BACK_COLOR);
|
||||
|
||||
char n[4]; sprintf(n, "%d", i+1);
|
||||
win_set_fore_color(_hdc, NORMAL_COLOR);
|
||||
win_draw_text(_hdc, (width-CHARX)/2 + i*width, BASEY, n, -1);
|
||||
xvt_dwin_set_fore_color(_hdc, color());
|
||||
xvt_dwin_draw_text(_hdc, (width-CHARX)/2 + i*width, BASEY, n, -1);
|
||||
}
|
||||
|
||||
CPEN pen;
|
||||
@ -901,16 +825,16 @@ void TTag_button::update() const
|
||||
pen.pat = PAT_SOLID;
|
||||
pen.style = P_SOLID;
|
||||
pen.color = MASK_LIGHT_COLOR;
|
||||
win_set_cpen(_hdc, &pen);
|
||||
xvt_dwin_set_cpen(_hdc, &pen);
|
||||
|
||||
PNT p = { _client.bottom, 0 };
|
||||
win_move_to(_hdc, p);
|
||||
xvt_dwin_draw_set_pos(_hdc, p);
|
||||
p.h = width*_page;
|
||||
win_draw_line(_hdc, p);
|
||||
xvt_dwin_draw_line(_hdc, p);
|
||||
p.h += width+1;
|
||||
win_move_to(_hdc, p);
|
||||
xvt_dwin_draw_set_pos(_hdc, p);
|
||||
p.h = _client.right;
|
||||
win_draw_line(_hdc, p);
|
||||
xvt_dwin_draw_line(_hdc, p);
|
||||
}
|
||||
|
||||
void TTag_button::mouse_down(PNT where)
|
||||
@ -938,8 +862,6 @@ void TTag_button::set_pages(byte p)
|
||||
|
||||
class TCheckbox : public TButton
|
||||
{
|
||||
static int _dy;
|
||||
|
||||
protected:
|
||||
virtual WIN_TYPE type() const;
|
||||
virtual void draw_pressed(bool pressed) const;
|
||||
@ -954,8 +876,6 @@ public:
|
||||
virtual ~TCheckbox();
|
||||
};
|
||||
|
||||
int TCheckbox::_dy = -1;
|
||||
|
||||
TCheckbox::TCheckbox(
|
||||
short left, short top, short right, short bottom,
|
||||
const char* caption, WINDOW parent,
|
||||
@ -963,16 +883,17 @@ TCheckbox::TCheckbox(
|
||||
: TButton(left, top, right, bottom,
|
||||
caption, parent, flags, app_data, id)
|
||||
{
|
||||
if (_dy < 0)
|
||||
{
|
||||
cpb.getbmp(BMP_CHECK_ON, TRUE);
|
||||
cpb.getbmp(BMP_CHECK_OFF, TRUE);
|
||||
cpb.getbmp(BMP_RADIO_ON, TRUE);
|
||||
PICTURE p = cpb.getbmp(BMP_RADIO_OFF, TRUE);
|
||||
if (!cpb.exist(BMP_CHECK_ON))
|
||||
{
|
||||
TImage* i = cpb.add(BMP_CHECK_ON, TRUE);
|
||||
|
||||
RCT r;
|
||||
cpb_get_picture_size(p, &r);
|
||||
_dy = BASEY - r.bottom + 2;
|
||||
const short dx = 0;
|
||||
const short dy = BASEY - i->height() + 2;
|
||||
i->set_pos(dx, dy);
|
||||
|
||||
i = cpb.add(BMP_CHECK_OFF, TRUE); i->set_pos(dx, dy);
|
||||
i = cpb.add(BMP_RADIO_ON, TRUE); i->set_pos(dx, dy);
|
||||
i = cpb.add(BMP_RADIO_OFF, TRUE); i->set_pos(dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -991,12 +912,12 @@ WIN_TYPE TCheckbox::type() const
|
||||
void TCheckbox::draw_pressed(bool pressed) const
|
||||
{
|
||||
get_geometry(win());
|
||||
PICTURE pic;
|
||||
short pic;
|
||||
if (radio())
|
||||
pic = pressed ? cpb[BMP_RADIO_ON] : cpb[BMP_RADIO_OFF];
|
||||
pic = pressed ? BMP_RADIO_ON : BMP_RADIO_OFF;
|
||||
else
|
||||
pic = pressed ? cpb[BMP_CHECK_ON] : cpb[BMP_CHECK_OFF];
|
||||
cpb_win_picture_draw_at(_hdc, pic, _client.left, _client.top+_dy);
|
||||
pic = pressed ? BMP_CHECK_ON : BMP_CHECK_OFF;
|
||||
cpb.image(pic).draw(_hdc);
|
||||
}
|
||||
|
||||
|
||||
@ -1014,14 +935,14 @@ void TCheckbox::update() const
|
||||
r.left = x-2; r.top = _client.top;
|
||||
r.right = _client.right-CHARX; r.bottom = y+3;
|
||||
|
||||
HWND hwnd = (HWND)get_value(_hdc, ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(_hdc, ATTR_NATIVE_WINDOW);
|
||||
HDC hdc = GetDC(hwnd);
|
||||
DrawFocusRect(hdc, &r);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
#endif
|
||||
}
|
||||
|
||||
win_draw_text(_hdc, x, y, (char*)caption(), -1);
|
||||
xvt_dwin_draw_text(_hdc, x, y, (char*)caption(), -1);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -1131,14 +1052,15 @@ WINDOW xvt_create_groupbox(
|
||||
|
||||
void free_controls_bmp()
|
||||
{
|
||||
cpb.reset();
|
||||
cpb.destroy();
|
||||
}
|
||||
|
||||
|
||||
TControl* TControl::WINDOW2TControl(WINDOW win)
|
||||
{
|
||||
CHECK(win, "Can't get the control model from a NULL window");
|
||||
TControl** model = (TControl**)xvtcm_get_model(win, 0);
|
||||
CHECK(model && *model, "Can't get the model from a window");
|
||||
CHECK(model && *model, "Can't get the control model from a window");
|
||||
return *model;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ WINDOW xvt_create_checkbox(
|
||||
WINDOW _win;
|
||||
short _id;
|
||||
TString80 _caption;
|
||||
COLOR _color;
|
||||
|
||||
bool _disabled : 1;
|
||||
bool _checked : 1;
|
||||
@ -87,6 +88,9 @@ public:
|
||||
short id() const { return _id; }
|
||||
const char* caption() const { return _caption; }
|
||||
void set_caption(const char* c);
|
||||
|
||||
COLOR color() const { return _color; }
|
||||
void set_color(COLOR c) { _color = c; }
|
||||
|
||||
bool checked() const { return _checked; }
|
||||
virtual void check(bool on);
|
||||
|
@ -12,15 +12,12 @@
|
||||
#define DAYBIAS 36525L
|
||||
#define NULLDATE -99999L
|
||||
|
||||
const TDate nodate, botime, eotime(31,12,2050);
|
||||
HIDDEN TDate __tmp_date;
|
||||
HIDDEN char __date_tmp_string[20];
|
||||
|
||||
TDate::TDate(const TDate &d) : _val(d._val) {}
|
||||
|
||||
|
||||
TDate::TDate(long l) : _val(l)
|
||||
|
||||
{
|
||||
if (_val == TODAY)
|
||||
{
|
||||
@ -167,7 +164,7 @@ void TDate::read_from(istream& in)
|
||||
}
|
||||
|
||||
|
||||
char* TDate::string(int yeardgts, char sep) const
|
||||
char* TDate::string(int yeardgts, char sep, TDate_order ord) const
|
||||
|
||||
{
|
||||
if (!ok()) return "";
|
||||
@ -193,6 +190,20 @@ char* TDate::string(int yeardgts, char sep) const
|
||||
else sprintf(s, "%04d", year);
|
||||
__date_tmp_string[6] = '\0';
|
||||
strcat(__date_tmp_string, s);
|
||||
|
||||
if (ord == amg_date)
|
||||
{
|
||||
char* d = __date_tmp_string;
|
||||
const char g[3] = { d[0], d[1], '\0' };
|
||||
const char m[3] = { d[3], d[4], '\0' };
|
||||
sprintf(d, "%s%c%s%c%s", &d[6], sep, m, sep, g);
|
||||
}
|
||||
else if (ord == mga_date)
|
||||
{
|
||||
char* d = __date_tmp_string;
|
||||
char c = d[0]; d[0] = d[3]; d[3] = c;
|
||||
c = d[1]; d[1] = d[4]; d[4] = c;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (yeardgts == ANSI)
|
||||
|
@ -12,6 +12,8 @@
|
||||
#define TODAY -1
|
||||
#define ANSI -1
|
||||
|
||||
enum TDate_order { gma_date, mga_date, amg_date };
|
||||
|
||||
class TDate : public TObject
|
||||
{
|
||||
// @DPRIV
|
||||
@ -28,7 +30,8 @@ class TDate : public TObject
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
char* string(int yeardgts = 4, char sep = '-') const ;
|
||||
char* string(int yeardgts = 4, char sep = '-', TDate_order ord = gma_date) const ;
|
||||
|
||||
// @DES Ritorna la data in formato di stringa (anche in formato ANSI)
|
||||
// @FPUB
|
||||
int day() const ; // Ritorna il giorno
|
||||
@ -92,7 +95,7 @@ const char* itom(byte month); // Ritorna il nome del mese (1-12)
|
||||
const char* itow(byte dayofweek); // Ritorna il nome del giorno (1-7)
|
||||
|
||||
// @DPUB
|
||||
extern const TDate nodate, botime, eotime;
|
||||
const TDate botime(0,0,0), eotime(31,12,2050);
|
||||
// @END
|
||||
|
||||
#endif // __DATE_H
|
||||
|
@ -1,14 +1,15 @@
|
||||
#ifndef APPNAME
|
||||
#define APPNAME PRASSI
|
||||
#define QAPPNAME "PRASSI"
|
||||
#define LIBDIR f:\xvt.322\xvtwin\lib
|
||||
#define LIBDIR f:\xvt.400\win_x86\ptk\lib
|
||||
#endif
|
||||
|
||||
#define NO_STD_EDIT_MENU
|
||||
#define NO_STD_FILE_MENU
|
||||
#define NO_STD_FONT_MENU
|
||||
#define NO_STD_HELP_MENU
|
||||
#define NO_STD_ABOUT_BOX
|
||||
#define NO_STD_HELP_MENU
|
||||
#define NO_HELP_RESOURCES
|
||||
#include <url.h>
|
||||
|
||||
#include <urldefid.h>
|
||||
@ -16,35 +17,35 @@
|
||||
MENUBAR TASK_MENUBAR
|
||||
|
||||
MENU MENU_FILE
|
||||
ITEM M_FILE_NEW "Scelta ~Ditta..."
|
||||
ITEM M_FILE_NEW "Scelta ~Ditta..."
|
||||
ITEM M_FILE_REVERT "Impostazione ~Parametri..."
|
||||
SEPARATOR
|
||||
ITEM M_FILE_PG_SETUP "~Impostazione Stampante..."
|
||||
ITEM M_FILE_PRINT "~Stampa" DISABLED
|
||||
ITEM M_FILE_PRINT "~Stampa" DISABLED
|
||||
SEPARATOR
|
||||
ITEM (M_FILE+11) "I~nformazioni"
|
||||
ITEM M_FILE_QUIT "~Fine"
|
||||
ITEM (M_FILE+11) "I~nformazioni"
|
||||
ITEM M_FILE_QUIT "~Fine"
|
||||
|
||||
MENUBAR VISWIN_BAR
|
||||
|
||||
MENU VISWIN_BAR
|
||||
SUBMENU MENU_VISWIN "~Visualizzazione"
|
||||
SUBMENU M_EDIT "~Edit"
|
||||
SUBMENU M_EDIT "~Edit"
|
||||
|
||||
MENU MENU_VISWIN
|
||||
ITEM M_EDIT_CLIPBOARD "Interrompi\tESC"
|
||||
ITEM M_EDIT_CUT "~Collega...\tCtrl+C" DISABLED
|
||||
ITEM M_EDIT_CLIPBOARD "Interrompi\tESC"
|
||||
ITEM M_EDIT_CUT "~Collega...\tCtrl+C" DISABLED
|
||||
ITEM M_EDIT_PASTE "~Esporta...\tCtrl+E"
|
||||
ITEM M_EDIT_SEL_ALL "~Stampa... \tCtrl+S" DISABLED
|
||||
SEPARATOR
|
||||
ITEM M_FONT "Mostra ~righelli" CHECKABLE
|
||||
ITEM M_STYLE "Mostra ~bottoni" CHECKABLE
|
||||
ITEM M_EDIT_UNDO "Ri~disegna"
|
||||
ITEM M_FONT "Mostra ~righelli" CHECKABLE
|
||||
ITEM M_STYLE "Mostra ~bottoni" CHECKABLE
|
||||
ITEM M_EDIT_UNDO "Ri~disegna"
|
||||
SEPARATOR
|
||||
ITEM M_EDIT_QUIT "Chiudi\tESC+ESC"
|
||||
ITEM M_EDIT_QUIT "Chiudi\tESC+ESC"
|
||||
|
||||
MENU M_EDIT
|
||||
ITEM M_EDIT_COPY "~Copia" DISABLED
|
||||
ITEM M_EDIT_COPY "~Copia" DISABLED
|
||||
ITEM M_EDIT_CLEAR "~Annulla" DISABLED
|
||||
SEPARATOR
|
||||
ITEM M_EDIT_SEARCH "Cerca...\tF7"
|
||||
@ -54,48 +55,48 @@ MENU M_EDIT
|
||||
ACCEL MENU_FILE "f" ALT
|
||||
|
||||
#if XVTWS == WINWS
|
||||
image BMP_OK "f:/p.due/bmp/ok.bmp"
|
||||
image BMP_CANCEL "f:/p.due/bmp/cancel.bmp"
|
||||
image BMP_QUIT "f:/p.due/bmp/quit.bmp"
|
||||
image BMP_QUITDN "f:/p.due/bmp/quitdn.bmp"
|
||||
image BMP_SELECT "f:/p.due/bmp/select.bmp"
|
||||
// image BMP_FIRSTREC "f:/p.due/bmp/firstrec.bmp"
|
||||
// image BMP_PREVREC "f:/p.due/bmp/prevrec.bmp"
|
||||
// image BMP_NEXTREC "f:/p.due/bmp/nextrec.bmp"
|
||||
// image BMP_LASTREC "f:/p.due/bmp/lastrec.bmp"
|
||||
image BMP_STOPREC "f:/p.due/bmp/stoprec.bmp"
|
||||
image BMP_SAVEREC "f:/p.due/bmp/saverec.bmp"
|
||||
image BMP_SAVERECDN "f:/p.due/bmp/saverecd.bmp"
|
||||
image BMP_NEWREC "f:/p.due/bmp/newrec.bmp"
|
||||
image BMP_NEWRECDN "f:/p.due/bmp/newrecdn.bmp"
|
||||
image BMP_DELREC "f:/p.due/bmp/delrec.bmp"
|
||||
image BMP_DELRECDN "f:/p.due/bmp/delrecdn.bmp"
|
||||
image BMP_FINDREC "f:/p.due/bmp/findrec.bmp"
|
||||
image BMP_SEARCH "f:/p.due/bmp/search.bmp"
|
||||
image BMP_CHECK_ON "f:/p.due/bmp/checkon.bmp"
|
||||
image BMP_CHECK_OFF "f:/p.due/bmp/checkoff.bmp"
|
||||
image BMP_RADIO_ON "f:/p.due/bmp/radioon.bmp"
|
||||
image BMP_RADIO_OFF "f:/p.due/bmp/radiooff.bmp"
|
||||
image BMP_MODULE1 "f:/p.due/bmp/module1.bmp"
|
||||
image BMP_MODULE2 "f:/p.due/bmp/module2.bmp"
|
||||
image BMP_MODULE3 "f:/p.due/bmp/module3.bmp"
|
||||
image BMP_MODULE4 "f:/p.due/bmp/module4.bmp"
|
||||
image BMP_BOOK1 "f:/p.due/bmp/book1.bmp"
|
||||
image BMP_BOOK2 "f:/p.due/bmp/book2.bmp"
|
||||
image BMP_BOOK3 "f:/p.due/bmp/book3.bmp"
|
||||
image BMP_MODULE "f:/p.due/bmp/module.bmp"
|
||||
image BMP_EDIT "f:/p.due/bmp/edit.bmp"
|
||||
image BMP_LINK "f:/p.due/bmp/link.bmp"
|
||||
image BMP_PRINT "f:/p.due/bmp/print.bmp"
|
||||
image BMP_SETPRINT "f:/p.due/bmp/setprint.bmp"
|
||||
image BMP_RECALC "f:/p.due/bmp/recalc.bmp"
|
||||
|
||||
#scan <xil.h>
|
||||
#transparent $$$
|
||||
XI_CURSOR_RESIZE cursor DISCARDABLE f:\p.due\bmp\resize.cur
|
||||
XI_CURSOR_HAND cursor DISCARDABLE f:\p.due\bmp\hand.cur
|
||||
XI_CURSOR_VRESIZE cursor DISCARDABLE f:\p.due\bmp\vresize.cur
|
||||
COMBO_ICON icon DISCARDABLE f:\p.due\bmp\combo.ico
|
||||
ICO_SEARCH icon DISCARDABLE f:\p.due\bmp\search.ico
|
||||
BMP_OK bitmap DISCARDABLE f:\p.due\bmp\ok.bmp
|
||||
BMP_CANCEL bitmap DISCARDABLE f:\p.due\bmp\cancel.bmp
|
||||
BMP_QUIT bitmap DISCARDABLE f:\p.due\bmp\quit.bmp
|
||||
BMP_QUITDN bitmap DISCARDABLE f:\p.due\bmp\quitdn.bmp
|
||||
BMP_SELECT bitmap DISCARDABLE f:\p.due\bmp\select.bmp
|
||||
// BMP_FIRSTREC bitmap DISCARDABLE f:\p.due\bmp\firstrec.bmp
|
||||
// BMP_PREVREC bitmap DISCARDABLE f:\p.due\bmp\prevrec.bmp
|
||||
// BMP_NEXTREC bitmap DISCARDABLE f:\p.due\bmp\nextrec.bmp
|
||||
// BMP_LASTREC bitmap DISCARDABLE f:\p.due\bmp\lastrec.bmp
|
||||
BMP_STOPREC bitmap DISCARDABLE f:\p.due\bmp\stoprec.bmp
|
||||
BMP_SAVEREC bitmap DISCARDABLE f:\p.due\bmp\saverec.bmp
|
||||
BMP_SAVERECDN bitmap DISCARDABLE f:\p.due\bmp\saverecd.bmp
|
||||
BMP_NEWREC bitmap DISCARDABLE f:\p.due\bmp\newrec.bmp
|
||||
BMP_NEWRECDN bitmap DISCARDABLE f:\p.due\bmp\newrecdn.bmp
|
||||
BMP_DELREC bitmap DISCARDABLE f:\p.due\bmp\delrec.bmp
|
||||
BMP_DELRECDN bitmap DISCARDABLE f:\p.due\bmp\delrecdn.bmp
|
||||
BMP_FINDREC bitmap DISCARDABLE f:\p.due\bmp\findrec.bmp
|
||||
BMP_SEARCH bitmap DISCARDABLE f:\p.due\bmp\search.bmp
|
||||
BMP_CHECK_ON bitmap DISCARDABLE f:\p.due\bmp\checkon.bmp
|
||||
BMP_CHECK_OFF bitmap DISCARDABLE f:\p.due\bmp\checkoff.bmp
|
||||
BMP_RADIO_ON bitmap DISCARDABLE f:\p.due\bmp\radioon.bmp
|
||||
BMP_RADIO_OFF bitmap DISCARDABLE f:\p.due\bmp\radiooff.bmp
|
||||
BMP_MODULE1 bitmap DISCARDABLE f:\p.due\bmp\module1.bmp
|
||||
BMP_MODULE2 bitmap DISCARDABLE f:\p.due\bmp\module2.bmp
|
||||
BMP_MODULE3 bitmap DISCARDABLE f:\p.due\bmp\module3.bmp
|
||||
BMP_MODULE4 bitmap DISCARDABLE f:\p.due\bmp\module4.bmp
|
||||
BMP_BOOK1 bitmap DISCARDABLE f:\p.due\bmp\book1.bmp
|
||||
BMP_BOOK2 bitmap DISCARDABLE f:\p.due\bmp\book2.bmp
|
||||
BMP_BOOK3 bitmap DISCARDABLE f:\p.due\bmp\book3.bmp
|
||||
BMP_MODULE bitmap DISCARDABLE f:\p.due\bmp\module.bmp
|
||||
BMP_EDIT bitmap DISCARDABLE f:\p.due\bmp\edit.bmp
|
||||
BMP_LINK bitmap DISCARDABLE f:\p.due\bmp\link.bmp
|
||||
BMP_PRINT bitmap DISCARDABLE f:\p.due\bmp\print.bmp
|
||||
BMP_SETPRINT bitmap DISCARDABLE f:\p.due\bmp\setprint.bmp
|
||||
BMP_RECALC bitmap DISCARDABLE f:\p.due\bmp\recalc.bmp
|
||||
|
||||
XI_CURSOR_RESIZE cursor f:/p.due/bmp/resize.cur
|
||||
XI_CURSOR_HAND cursor f:/p.due/bmp/hand.cur
|
||||
XI_CURSOR_VRESIZE cursor f:/p.due/bmp/vresize.cur
|
||||
COMBO_ICON icon f:/p.due/bmp/combo.ico
|
||||
ICO_SEARCH icon f:/p.due/bmp/search.ico
|
||||
$$$
|
||||
#endif
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <applicat.h>
|
||||
#include <execp.h>
|
||||
#include <prefix.h>
|
||||
|
||||
bool TExternal_app::can_run() const
|
||||
{
|
||||
@ -30,18 +31,18 @@ bool TExternal_app::can_run() const
|
||||
}
|
||||
|
||||
|
||||
int TExternal_app::run(bool async, bool user)
|
||||
int TExternal_app::run(bool async, bool utente)
|
||||
{
|
||||
TString256 path(_path);
|
||||
|
||||
if (user)
|
||||
path << " -u" << main_app().user();
|
||||
if (utente)
|
||||
path << " -u" << user();
|
||||
|
||||
_error = 0;
|
||||
_exitcode = 0;
|
||||
|
||||
// save cwd
|
||||
save_dir();
|
||||
xvt_fsys_save_dir();
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (can_run())
|
||||
@ -67,7 +68,7 @@ int TExternal_app::run(bool async, bool user)
|
||||
{
|
||||
if (i == 0 && TaskFindHandle(&te, child) == FALSE)
|
||||
break;
|
||||
process_events();
|
||||
xvt_app_process_pending_events();
|
||||
}
|
||||
|
||||
tw.maximize();
|
||||
@ -132,12 +133,12 @@ int TExternal_app::run(bool async, bool user)
|
||||
break;
|
||||
}
|
||||
_error = errno;
|
||||
xvt_escape(XVT_ESC_CH_REFRESH);
|
||||
xvt_app_escape(XVT_ESC_CH_REFRESH);
|
||||
|
||||
#endif
|
||||
|
||||
// restore cwd
|
||||
restore_dir();
|
||||
xvt_fsys_restore_dir();
|
||||
|
||||
// update counts
|
||||
if (_exitcode == 0)
|
||||
|
@ -46,7 +46,6 @@ extern "C" {
|
||||
// Guy moved these outside extern
|
||||
extern isfdptr* openf;
|
||||
extern Str80 cprefix;
|
||||
extern long stdlevel;
|
||||
|
||||
#ifdef __STDTYPES_CPP
|
||||
#define extern
|
||||
|
226
include/form.cpp
226
include/form.cpp
@ -46,8 +46,11 @@ TForm_flags::TForm_flags()
|
||||
shown = enabled = TRUE;
|
||||
}
|
||||
|
||||
// Read from string
|
||||
// Certified 100%
|
||||
bool TForm_flags::update(const char* s)
|
||||
{
|
||||
CHECK(s, "NULL flags string");
|
||||
for (; *s; s++) switch(toupper(*s))
|
||||
{
|
||||
case 'A':
|
||||
@ -63,6 +66,8 @@ bool TForm_flags::update(const char* s)
|
||||
}
|
||||
|
||||
|
||||
// Print on stream
|
||||
// Certified 100%
|
||||
void TForm_flags::print_on(ostream& out) const
|
||||
{
|
||||
TString16 s;
|
||||
@ -75,19 +80,22 @@ void TForm_flags::print_on(ostream& out) const
|
||||
out << " FLAGS \"" << s << '"' << endl;
|
||||
}
|
||||
|
||||
|
||||
// Set mask fields
|
||||
// Certified 100%
|
||||
void TForm_flags::print_on(TMask& m)
|
||||
{
|
||||
m.set(F_DISABLED, enabled ? " " : "X");
|
||||
m.set(F_HIDDEN, shown ? " " : "X");
|
||||
m.set(F_DISABLED, enabled ? " " : "X");
|
||||
m.set(F_HIDDEN, shown ? " " : "X");
|
||||
m.set(F_AUTOMAGIC, automagic ? "X" : " ");
|
||||
}
|
||||
|
||||
|
||||
// Get mask fields
|
||||
// Certified 100%
|
||||
void TForm_flags::read_from(const TMask& m)
|
||||
{
|
||||
shown = !m.get_bool(F_HIDDEN);
|
||||
enabled = !m.get_bool(F_DISABLED);
|
||||
shown = !m.get_bool(F_HIDDEN);
|
||||
enabled = !m.get_bool(F_DISABLED);
|
||||
automagic = m.get_bool(F_AUTOMAGIC);
|
||||
}
|
||||
|
||||
@ -118,7 +126,7 @@ protected:
|
||||
bool hidden() const { return !_flag.shown; }
|
||||
bool enabled() const { return _flag.enabled; }
|
||||
bool disabled() const { return !_flag.enabled; }
|
||||
bool automagic() const { return !_flag.automagic; }
|
||||
bool automagic() const { return _flag.automagic; }
|
||||
|
||||
virtual bool parse_head(TScanner&);
|
||||
virtual bool parse_item(TScanner&);
|
||||
@ -532,13 +540,14 @@ void TForm_string::read_from(const TMask& m)
|
||||
bool TForm_string::set(const char* s)
|
||||
{
|
||||
_str = s;
|
||||
if (width()) _str.cut(width());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const char* TForm_string::get() const
|
||||
{ return _str; }
|
||||
|
||||
|
||||
// Se un campo e' abilitato ed ha almeno un riferimento su file leggilo
|
||||
bool TForm_string::read()
|
||||
{
|
||||
bool ok = TRUE;
|
||||
@ -549,11 +558,8 @@ bool TForm_string::read()
|
||||
{
|
||||
const char* s = "";
|
||||
const TRelation* r = section().form().relation();
|
||||
for (int i = 0; i < _field.items(); i++)
|
||||
{
|
||||
for (int i = 0; i < _field.items() && *s == '\0'; i++)
|
||||
s = field(i).read(r);
|
||||
if (*s) break;
|
||||
}
|
||||
set(s);
|
||||
}
|
||||
} else ok = FALSE;
|
||||
@ -828,13 +834,14 @@ public:
|
||||
virtual ~TForm_group() {}
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TPrint_section
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TMask* TPrint_section::_msk = NULL;
|
||||
|
||||
TPrint_section::TPrint_section(TForm* f) : _height(0), _form(f)
|
||||
TPrint_section::TPrint_section(TForm* f) : _height(0), _x(0), _y(0), _form(f)
|
||||
{}
|
||||
|
||||
TPrint_section::~TPrint_section()
|
||||
@ -850,6 +857,8 @@ const TPrint_section& TPrint_section::copy(const TPrint_section& ps)
|
||||
{
|
||||
_item = ps._item;
|
||||
_height = ps._height;
|
||||
_x = ps._x;
|
||||
_y = ps._y;
|
||||
return ps;
|
||||
}
|
||||
|
||||
@ -884,7 +893,7 @@ TForm_item* TPrint_section::parse_item(const TString& s)
|
||||
if (s == "GR")
|
||||
return new TForm_group(this);
|
||||
|
||||
CHECKS(NULL, "Campo di stampa sconosciuto: ", (const char*)s);
|
||||
error_box("Campo di stampa non ammesso per la sezione di stampa: %s", (const char*)s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -904,7 +913,7 @@ bool TPrint_section::parse(TScanner& scanner)
|
||||
while (scanner.popkey() != "EN")
|
||||
{
|
||||
TForm_item *fi = parse_item(scanner);
|
||||
if (!fi) return FALSE;
|
||||
if (fi == NULL) return FALSE;
|
||||
|
||||
if (fi->parse(scanner))
|
||||
_item.add(fi);
|
||||
@ -958,7 +967,7 @@ bool TPrint_section::edit(const char* title, bool all)
|
||||
_y = m.get_int(F_Y);
|
||||
}
|
||||
|
||||
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Riga|Col.|Gr.|Descrizione@40", all ? 0xE : 0x8);
|
||||
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Riga@R|Col.@R|Gr.@R|Descrizione@40", all ? 0xE : 0x8);
|
||||
|
||||
for (word i = 0; i < fields(); i++)
|
||||
{
|
||||
@ -997,12 +1006,15 @@ bool TPrint_section::edit(const char* title, bool all)
|
||||
{
|
||||
const TString& c = _msk->get(F_CLASS).left(2);
|
||||
TForm_item* item = parse_item(c);
|
||||
item->read_from(*_msk);
|
||||
_item.insert(item, i);
|
||||
|
||||
TToken_string s(128); item->print_on(s);
|
||||
a.insert(s, i);
|
||||
dirty = TRUE;
|
||||
if (item != NULL)
|
||||
{
|
||||
item->read_from(*_msk);
|
||||
_item.insert(item, i);
|
||||
|
||||
TToken_string s(128); item->print_on(s);
|
||||
a.insert(s, i);
|
||||
dirty = TRUE;
|
||||
}
|
||||
}
|
||||
} else error_box("L'inserimento e' disabilitato");
|
||||
break;
|
||||
@ -1024,11 +1036,96 @@ bool TPrint_section::edit(const char* title, bool all)
|
||||
|
||||
void TPrint_section::print_on(ostream& out) const
|
||||
{
|
||||
out << ' ' << _height << ' ' << _x << ' ' << _y << endl;
|
||||
out << ' ' << _height << ' ' << _x << ' ' << _y << endl << endl;
|
||||
for(word i = 0; i < fields(); i++)
|
||||
out << field(i);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TGraphic_section
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TGraphic_section : public TPrint_section
|
||||
{
|
||||
TString _back;
|
||||
|
||||
protected:
|
||||
TForm_item* parse_item(const TString& s);
|
||||
bool update();
|
||||
|
||||
public:
|
||||
void append(const char* s) { _back << s; }
|
||||
|
||||
TGraphic_section(TForm* f) : TPrint_section(f) {}
|
||||
virtual ~TGraphic_section() {}
|
||||
};
|
||||
|
||||
class TForm_picture : public TForm_item
|
||||
{
|
||||
protected:
|
||||
virtual const char* class_name() const { return "FIGURA"; }
|
||||
virtual bool update();
|
||||
|
||||
public:
|
||||
TForm_picture(TGraphic_section* section) : TForm_item(section) {};
|
||||
virtual ~TForm_picture() {}
|
||||
};
|
||||
|
||||
class TForm_line : public TForm_item
|
||||
{
|
||||
protected:
|
||||
virtual const char* class_name() const { return "LINEA"; }
|
||||
virtual bool update();
|
||||
|
||||
public:
|
||||
TForm_line(TGraphic_section* section) : TForm_item(section) {};
|
||||
virtual ~TForm_line() {}
|
||||
};
|
||||
|
||||
bool TForm_picture::update()
|
||||
{
|
||||
const bool ok = _prompt.not_empty();
|
||||
if (ok)
|
||||
{
|
||||
TString80 i;
|
||||
i << "i{" << _prompt << ',' << _x << ',' << _y << ','
|
||||
<< (_x+width()-1) << ',' << (_y+height()-1) << '}';
|
||||
((TGraphic_section&)section()).append(i);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TForm_line::update()
|
||||
{
|
||||
TString80 i;
|
||||
const int w = _prompt[0] == '@' ? 3 : 1;
|
||||
i << 'W' << w << "l{" << _x << ',' << _y << ','
|
||||
<< (_x+width()-1) << ',' << (_y+height()-1) << '}';
|
||||
|
||||
((TGraphic_section&)section()).append(i);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
TForm_item* TGraphic_section::parse_item(const TString& s)
|
||||
{
|
||||
if (s == "FI")
|
||||
return new TForm_picture(this);
|
||||
else if (s == "LI")
|
||||
return new TForm_line(this);
|
||||
|
||||
error_box("Campo di stampa non ammesso per lo sfondo: %s", (const char*)s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool TGraphic_section::update()
|
||||
{
|
||||
_back.cut(0);
|
||||
const bool ok = TPrint_section::update();
|
||||
main_app().printer().setbackground(_back);
|
||||
return ok;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TForm
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -1105,12 +1202,14 @@ bool TForm::parse_join(TScanner& scanner)
|
||||
TPrint_section* TForm::exist(char s, pagetype t, bool create)
|
||||
{
|
||||
TArray* a = NULL;
|
||||
switch (s)
|
||||
switch (toupper(s))
|
||||
{
|
||||
case 'H':
|
||||
a = &_head; break;
|
||||
case 'G':
|
||||
a = &_back; break;
|
||||
case 'F':
|
||||
a = &_foot; break;
|
||||
case 'H':
|
||||
a = &_head; break;
|
||||
default:
|
||||
a = &_body; break;
|
||||
}
|
||||
@ -1118,7 +1217,7 @@ TPrint_section* TForm::exist(char s, pagetype t, bool create)
|
||||
TPrint_section* sec = (TPrint_section*)a->objptr(t);
|
||||
if (sec == NULL && create)
|
||||
{
|
||||
sec = new TPrint_section(this);
|
||||
sec = (s == 'G') ? new TGraphic_section(this) : new TPrint_section(this);
|
||||
a->add(sec, t);
|
||||
}
|
||||
|
||||
@ -1131,15 +1230,28 @@ TPrint_section& TForm::section(char s, word p)
|
||||
pagetype pos = odd_page;
|
||||
if (p == 0 && exist(s, last_page)) pos = last_page;
|
||||
if (p == 1 && exist(s, first_page)) pos = first_page;
|
||||
if (pos == 0 && (p & 0x1) == 0 && exist(s, even_page)) pos = even_page;
|
||||
if (pos == odd_page && (p & 0x1) == 0 && exist(s, even_page)) pos = even_page;
|
||||
|
||||
TPrint_section* sec = exist(s, pos, TRUE);
|
||||
return *sec;
|
||||
}
|
||||
|
||||
word TForm::set_background(word p, bool u)
|
||||
{
|
||||
word len = 0;
|
||||
|
||||
if (u && _back.items())
|
||||
{
|
||||
TPrint_section& graph = section('G', p);
|
||||
graph.update();
|
||||
len = main_app().printer().formlen();
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
word TForm::set_header(word p, bool u)
|
||||
{
|
||||
{
|
||||
TPrinter& printer = main_app().printer();
|
||||
printer.resetheader();
|
||||
|
||||
@ -1154,7 +1266,7 @@ word TForm::set_header(word p, bool u)
|
||||
|
||||
for (word j = 0; j < head.height(); j++)
|
||||
printer.setheaderline(j, head.row(j));
|
||||
|
||||
|
||||
return head.height();
|
||||
}
|
||||
|
||||
@ -1198,6 +1310,7 @@ word TForm::set_footer(word p, bool u)
|
||||
void TForm::header_handler(TPrinter& p)
|
||||
{
|
||||
const word page = form().page(p);
|
||||
form().set_background(page, TRUE);
|
||||
form().set_header(page, TRUE);
|
||||
form().set_footer(page, FALSE);
|
||||
}
|
||||
@ -1236,10 +1349,13 @@ bool TForm::print(long from, long to)
|
||||
const bool was_open = printer.isopen();
|
||||
|
||||
_lastpage = FALSE; // non e' l'ultima pagina
|
||||
|
||||
set_background(1, TRUE);
|
||||
|
||||
if (!was_open && !printer.open())
|
||||
return FALSE;
|
||||
|
||||
do_events();
|
||||
|
||||
if (to < 0) to = records()-1;
|
||||
|
||||
bool ok = TRUE;
|
||||
@ -1261,6 +1377,7 @@ bool TForm::print(long from, long to)
|
||||
if (exist('H', last_page) || exist('B', last_page) || exist('F', last_page))
|
||||
{
|
||||
_lastpage = TRUE;
|
||||
set_background(0, TRUE);
|
||||
set_header(0, TRUE);
|
||||
set_body(0, TRUE);
|
||||
printer.formfeed();
|
||||
@ -1284,7 +1401,14 @@ void TForm::print_section(ostream& out, char s) const
|
||||
const TPrint_section* sec = ((TForm*)this)->exist(s, t);
|
||||
if (sec && sec->ok())
|
||||
{
|
||||
const char* name = s == 'H' ? "HEADER" : (s == 'F' ? "FOOTER" : "BODY");
|
||||
const char* name;
|
||||
switch (s)
|
||||
{
|
||||
case 'F': name = "FOOTER"; break;
|
||||
case 'G': name = "GRAPHICS"; break;
|
||||
case 'H': name = "HEADER"; break;
|
||||
default : name = "BODY"; break;
|
||||
}
|
||||
out << "SECTION " << name << ' ' << int(t);
|
||||
out << *sec;
|
||||
out << "END\n" << endl;
|
||||
@ -1300,8 +1424,9 @@ void TForm::print_on(ostream& out) const
|
||||
main_app().begin_wait();
|
||||
|
||||
if (relation())
|
||||
out << *relation() << endl;
|
||||
out << *relation() << "\nEND" << endl;
|
||||
|
||||
print_section(out, 'G');
|
||||
print_section(out, 'H');
|
||||
print_section(out, 'B');
|
||||
print_section(out, 'F');
|
||||
@ -1315,12 +1440,19 @@ void TForm::print_on(ostream& out) const
|
||||
word TForm::height()
|
||||
{
|
||||
word h = 0;
|
||||
if (_head.items())
|
||||
h += section('H', 1).height();
|
||||
if (_body.items())
|
||||
h += section('B', 1).height();
|
||||
if (_foot.items())
|
||||
h += section('F', 1).height();
|
||||
|
||||
if (_back.items() == 0)
|
||||
{
|
||||
if (_head.items())
|
||||
h += section('H', 1).height();
|
||||
if (_body.items())
|
||||
h += section('B', 1).height();
|
||||
if (_foot.items())
|
||||
h += section('F', 1).height();
|
||||
}
|
||||
else
|
||||
h = main_app().printer().formlen();
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
@ -1334,22 +1466,22 @@ TForm::TForm(const char* name)
|
||||
TScanner scanner(_name);
|
||||
|
||||
bool ok = TRUE;
|
||||
if (scanner.popkey() == "US")
|
||||
if (scanner.popkey() == "US") // Parse relation
|
||||
{
|
||||
ok = parse_use(scanner);
|
||||
while (ok && scanner.popkey() == "JO")
|
||||
ok = parse_join(scanner);
|
||||
}
|
||||
}
|
||||
else scanner.push();
|
||||
|
||||
while (ok)
|
||||
{
|
||||
scanner.popkey();
|
||||
const char sec = toupper(scanner.key()[0]);
|
||||
if (sec <= ' ' || sec == 'E')
|
||||
{
|
||||
if (scanner.popkey() != "SE") // SECTION or END
|
||||
break;
|
||||
const pagetype p = (pagetype)scanner.integer();
|
||||
TPrint_section* ps = exist(sec, p, TRUE);
|
||||
ok = ps->parse(scanner);
|
||||
const char sec = scanner.popkey()[0]; // Section name (GR, HE, BO, FO)
|
||||
const pagetype p = (pagetype)scanner.integer(); // Section type (odd, even, first, last)
|
||||
TPrint_section* ps = exist(sec, p, TRUE); // Create section
|
||||
ok = ps->parse(scanner); // Parse section
|
||||
}
|
||||
|
||||
main_app().end_wait();
|
||||
|
@ -37,7 +37,7 @@ class TPrint_section : public TArray
|
||||
|
||||
protected:
|
||||
virtual void print_on(ostream& out) const;
|
||||
TForm_item* parse_item(const TString& key);
|
||||
virtual TForm_item* parse_item(const TString& key);
|
||||
TForm_item* parse_item(TScanner& scanner);
|
||||
|
||||
public:
|
||||
@ -54,7 +54,7 @@ public:
|
||||
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
||||
|
||||
void reset();
|
||||
bool update();
|
||||
virtual bool update();
|
||||
bool parse(TScanner& scanner);
|
||||
|
||||
bool edit(const char* title, bool all);
|
||||
@ -78,6 +78,7 @@ class TForm : public TObject
|
||||
TArray _head; // Headers
|
||||
TArray _body; // Bodies
|
||||
TArray _foot; // Footers
|
||||
TArray _back; // Graphic background
|
||||
|
||||
bool _lastpage; // I am about to print the last page
|
||||
|
||||
@ -101,6 +102,7 @@ protected:
|
||||
word page(const TPrinter& p) const;
|
||||
|
||||
virtual long records() const;
|
||||
virtual word set_background(word p, bool u);
|
||||
virtual word set_header(word p, bool u);
|
||||
virtual word set_body(word p, bool u);
|
||||
virtual word set_footer(word p, bool u);
|
||||
|
@ -693,7 +693,6 @@ int TLocalisamfile::close()
|
||||
}
|
||||
|
||||
int TLocalisamfile::open(unsigned int mode)
|
||||
|
||||
{
|
||||
int err = NOERR;
|
||||
const int logicnum = num();
|
||||
@ -702,13 +701,14 @@ int TLocalisamfile::open(unsigned int mode)
|
||||
{
|
||||
_was_open = FALSE;
|
||||
_isamfile = openf[logicnum - 1];
|
||||
_current->_i = filehnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
err = _open();
|
||||
_was_open = TRUE;
|
||||
}
|
||||
_current->_i = filehnd();
|
||||
|
||||
setstatus(err);
|
||||
return err;
|
||||
}
|
||||
@ -923,7 +923,7 @@ bool TSystemisamfile::exec_convapp(long flev, const bool before)
|
||||
|
||||
if (flev == 0) flev = 199401;
|
||||
else flev++;
|
||||
for (long l = flev; l <= stdlevel; l++)
|
||||
for (long l = flev; l <= get_std_level(); l++)
|
||||
{
|
||||
TString16 paragraph(format("%06ld", l));
|
||||
TConfig conv(CONFIG_FCONV, paragraph);
|
||||
@ -958,7 +958,7 @@ bool TSystemisamfile::getlcf(long flev)
|
||||
_exps.destroy();
|
||||
if (flev == 0) flev = 199401;
|
||||
else flev++;
|
||||
for (long l = flev; l <= stdlevel; l++)
|
||||
for (long l = flev; l <= get_std_level(); l++)
|
||||
{
|
||||
TString16 paragraph(format("%06ld", l));
|
||||
TConfig conv(CONFIG_FCONV, paragraph);
|
||||
@ -1009,14 +1009,14 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
||||
|
||||
dir.get(num(), _lock, _nordir, _sysdirop);
|
||||
const char p = *dir.name();
|
||||
const bool is_com = prefhndl->is_com();
|
||||
const bool is_com = prefix().is_com();
|
||||
const bool toconvert = is_com ? dir.is_com() : dir.is_firm();
|
||||
|
||||
int err = NOERR;
|
||||
TTrec oldrec;
|
||||
|
||||
oldrec.get(num());
|
||||
const long lev = prefhndl->filelevel();
|
||||
const long lev = prefix().filelevel();
|
||||
const bool lcf = getlcf(lev);
|
||||
exec_convapp(lev, TRUE);
|
||||
|
||||
@ -1176,8 +1176,9 @@ int TSystemisamfile::load(const char* from, char fs, char fd, char rs, bool vis,
|
||||
{
|
||||
f.equal();
|
||||
const long level = atol(f.line());
|
||||
if (level > stdlevel)
|
||||
error_box("L' archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.", from, level / 100, level % 100, stdlevel / 100, stdlevel % 100);
|
||||
if (level > get_std_level())
|
||||
error_box("L'archivio %s e' stato generato con gli archivi di livello %ld%/%ld.\n Il livello attuale e' %ld/%ld.\n Convertire gli archivi e ripetere l' operazione.",
|
||||
from, level/100, level%100, get_std_level()/100, get_std_level()%100);
|
||||
lcf = getlcf(level);
|
||||
nflds = 0;
|
||||
TToken_string s2(f.line());
|
||||
@ -1328,7 +1329,7 @@ int TSystemisamfile::dump(const char* to, int nkey, char fs, char fd, char rs, b
|
||||
TProgind p(nitems, s, TRUE, TRUE, 70);
|
||||
TString s1;
|
||||
|
||||
fprintf(f, "[Header]\nVersion=%ld", prefhndl->filelevel());
|
||||
fprintf(f, "[Header]\nVersion=%ld", prefix().filelevel());
|
||||
for (int k = 0; k < nflds; k++)
|
||||
{
|
||||
if ((k % 10) == 0) fprintf(f, "\nFields=");
|
||||
|
@ -1,26 +1,26 @@
|
||||
#ifndef __KEYS_H
|
||||
#define __KEYS_H
|
||||
|
||||
#ifndef XVT_INCL_CONST
|
||||
#include <xvtconst.h>
|
||||
#endif
|
||||
|
||||
/* @M */
|
||||
#define K_BACKSPACE 8
|
||||
#define K_TAB 9
|
||||
#define K_ENTER 13
|
||||
#define K_ESC 27
|
||||
#define K_SPACE 32
|
||||
#define K_SHIFT 1000
|
||||
#define K_CTRL 10000
|
||||
#define K_CTRL_ENTER K_CTRL+K_ENTER
|
||||
#define K_AUTO_ENTER 21013
|
||||
#define K_QUIT 20334
|
||||
#define K_FORCE_CLOSE 21334
|
||||
#define K_SAVE 20082
|
||||
#define K_SHIFT_TAB K_SHIFT+K_TAB
|
||||
#define K_NO 20000+'N'
|
||||
#define K_YES 20000+'Y'
|
||||
|
||||
/* @END */
|
||||
#endif
|
||||
#ifndef __KEYS_H
|
||||
#define __KEYS_H
|
||||
|
||||
#ifndef XVT_INCL_DEFS
|
||||
#include <xvt_defs.h>
|
||||
#endif
|
||||
|
||||
/* @M */
|
||||
#define K_BACKSPACE 8
|
||||
#define K_TAB 9
|
||||
#define K_ENTER 13
|
||||
#define K_ESC 27
|
||||
#define K_SPACE 32
|
||||
#define K_SHIFT 1000
|
||||
#define K_CTRL 10000
|
||||
#define K_CTRL_ENTER K_CTRL+K_ENTER
|
||||
#define K_AUTO_ENTER 21013
|
||||
#define K_QUIT 20334
|
||||
#define K_FORCE_CLOSE 21334
|
||||
#define K_SAVE 20082
|
||||
#define K_SHIFT_TAB K_SHIFT+K_TAB
|
||||
#define K_NO 20000+'N'
|
||||
#define K_YES 20000+'Y'
|
||||
|
||||
/* @END */
|
||||
#endif
|
||||
|
@ -19,7 +19,6 @@ HIDDEN const char* const MASK_EXT = "msk";
|
||||
|
||||
HIDDEN bool moving_focus = FALSE;
|
||||
|
||||
bool TMask::on_dirty( TMask_field& c ) {return TRUE;}
|
||||
|
||||
bool TMask::test_focus_change(WINDOW next)
|
||||
{
|
||||
@ -34,12 +33,12 @@ bool TMask::test_focus_change(WINDOW next)
|
||||
set_focus();
|
||||
prev.set_focusdirty(FALSE);
|
||||
}
|
||||
// NUOVO
|
||||
else
|
||||
{
|
||||
if ( prev.focusdirty() )
|
||||
ok = on_dirty( prev );
|
||||
}
|
||||
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -49,7 +48,7 @@ void TMask::control_handler(EVENT* ep)
|
||||
const WINDOW win = ep->v.ctl.ci.win;
|
||||
const WIN_TYPE type = ep->v.ctl.ci.type;
|
||||
|
||||
TMask_field* f = (TMask_field*)get_app_data(win);
|
||||
TMask_field* f = (TMask_field*)xvt_vobj_get_data(win);
|
||||
CHECK(f != NULL, "Invalid field pointer in control");
|
||||
|
||||
if (type == WC_CHECKBOX)
|
||||
@ -122,13 +121,13 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (win != toolwin())
|
||||
{
|
||||
clear_window(win, MASK_BACK_COLOR);
|
||||
RCT r; get_client_rect(win, &r); r.right--; r.bottom--;
|
||||
xvt_dwin_clear(win, MASK_BACK_COLOR);
|
||||
RCT r; xvt_vobj_get_client_rect(win, &r); r.right--; r.bottom--;
|
||||
xvt_draw_rect(win, r, MASK_LIGHT_COLOR, MASK_DARK_COLOR, 1);
|
||||
}
|
||||
else clear_window(win, MASK_DARK_COLOR);
|
||||
else xvt_dwin_clear(win, MASK_DARK_COLOR);
|
||||
#else
|
||||
clear_window(win, MASK_BACK_COLOR);
|
||||
xvt_dwin_clear(win, MASK_BACK_COLOR);
|
||||
#endif
|
||||
update();
|
||||
return;
|
||||
@ -154,7 +153,7 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
||||
case DLG_F9:
|
||||
{
|
||||
WINDOW w = ep->v.ctl.ci.win;
|
||||
TMask_field* f = (TMask_field*)get_app_data(w);
|
||||
TMask_field* f = (TMask_field*)xvt_vobj_get_data(w);
|
||||
w = f->win();
|
||||
if (test_focus_change(w))
|
||||
f->on_key(K_F9); // Attiva ricerca sul campo associato al bottone
|
||||
@ -278,8 +277,8 @@ void TMask::add_buttons()
|
||||
{
|
||||
const int k = p*2;
|
||||
t[k] = '['; t[k+2] = ']';
|
||||
RCT r; set_rect(&r, 0, 0, t.size()*CHARX, CHARY);
|
||||
create_control(WC_TEXT, &r, t, _pagewin[p], 0, 0, DLG_NULL);
|
||||
RCT r; xvt_rect_set(&r, 0, 0, t.size()*CHARX, CHARY);
|
||||
xvt_ctl_create(WC_TEXT, &r, t, _pagewin[p], 0, 0, DLG_NULL);
|
||||
t[k] = ' ';
|
||||
}
|
||||
}
|
||||
@ -299,7 +298,7 @@ TMask::~TMask()
|
||||
for (int p = 0; p <= MAX_PAGES; p++)
|
||||
if (_pagewin[p])
|
||||
{
|
||||
close_window(_pagewin[p]);
|
||||
xvt_vobj_destroy(_pagewin[p]);
|
||||
_pagewin[p] = NULL_WIN;
|
||||
}
|
||||
}
|
||||
@ -317,7 +316,7 @@ void TMask::open()
|
||||
{
|
||||
_open = TRUE;
|
||||
if (toolwin())
|
||||
show_window(toolwin(), TRUE);
|
||||
xvt_vobj_set_visible(toolwin(), TRUE);
|
||||
next_page(0);
|
||||
}
|
||||
else
|
||||
@ -369,7 +368,7 @@ void TMask::close()
|
||||
_open = FALSE;
|
||||
_page = -1;
|
||||
for (int p = 0; p <= MAX_PAGES; p++)
|
||||
if (_pagewin[p]) show_window(_pagewin[p], FALSE);
|
||||
if (_pagewin[p]) xvt_vobj_set_visible(_pagewin[p], FALSE);
|
||||
}
|
||||
|
||||
void TMask::set_mask_fields() const
|
||||
@ -663,8 +662,8 @@ void TMask::set_focus()
|
||||
{
|
||||
const WINDOW pw = win(); // previous window
|
||||
_page = page; // update page number
|
||||
show_window(win(), TRUE); // show new page
|
||||
if (pw) show_window(pw, FALSE); // hide old page
|
||||
xvt_vobj_set_visible(win(), TRUE); // show new page
|
||||
if (pw) xvt_vobj_set_visible(pw, FALSE); // hide old page
|
||||
}
|
||||
|
||||
f.highlight();
|
||||
@ -810,6 +809,11 @@ bool TMask::on_key(KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TMask::on_dirty(TMask_field&)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
TMask_field* TMask::parse_field(TScanner& scanner)
|
||||
{
|
||||
@ -844,7 +848,7 @@ WINDOW TMask::read_page(TScanner& scanner, bool toolbar)
|
||||
if (toolwin())
|
||||
{
|
||||
scanner.line();
|
||||
set_rect(&r, 0, 0, 0, tooly);
|
||||
xvt_rect_set(&r, 0, 0, 0, tooly);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -954,13 +958,13 @@ void TMask::next_page(int p)
|
||||
_page = k;
|
||||
} else _page = 0;
|
||||
|
||||
const WINDOW w = win(); // Current page window
|
||||
if (_page != prev)
|
||||
{
|
||||
show_window(w, TRUE);
|
||||
{
|
||||
const WINDOW w = _pagewin[_page];
|
||||
xvt_vobj_set_visible(w, TRUE);
|
||||
if (prev >= 0)
|
||||
{
|
||||
show_window(_pagewin[prev], FALSE);
|
||||
xvt_vobj_set_visible(_pagewin[prev], FALSE);
|
||||
_focus = find_first_field(w, +1);
|
||||
}
|
||||
}
|
||||
@ -1029,7 +1033,7 @@ void TMask::activate(bool on)
|
||||
{
|
||||
TWindow::activate(on);
|
||||
if (toolwin() != NULL_WIN)
|
||||
show_window(toolwin(), on);
|
||||
xvt_vobj_set_visible(toolwin(), on);
|
||||
}
|
||||
|
||||
|
||||
@ -1359,14 +1363,14 @@ bool TMask::load(bool reset)
|
||||
const char* TMask::get_caption() const
|
||||
{
|
||||
char* title = &__tmp_string[512];
|
||||
get_title(_pagewin[0], title, 80);
|
||||
xvt_vobj_get_title(_pagewin[0], title, 80);
|
||||
return title;
|
||||
}
|
||||
|
||||
void TMask::set_caption(const char* c)
|
||||
{
|
||||
for (int p = 0; p < _pages; p++)
|
||||
set_title(_pagewin[p], (char*)c);
|
||||
xvt_vobj_set_title(_pagewin[p], (char*)c);
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,7 @@ class TMask : public TWindow
|
||||
|
||||
protected:
|
||||
// Ritorna la finestra della pagina corrente (Usare con attenzione)
|
||||
WINDOW win() const { return _page == -1 ? NULL_WIN : _pagewin[_page]; }
|
||||
WINDOW win() const { return _page < 0 ? _pagewin[0] : _pagewin[_page]; }
|
||||
WINDOW toolwin() const { return _pagewin[MAX_PAGES]; }
|
||||
|
||||
int find_field_win(WINDOW win) const; // number of field with window win
|
||||
|
@ -1,4 +1,3 @@
|
||||
// $Id: maskfld.cpp,v 1.83 1995-03-13 11:48:49 pirro Exp $
|
||||
#include <xvt.h>
|
||||
|
||||
#include <applicat.h>
|
||||
@ -276,14 +275,14 @@ WINDOW TMask_field::wincreate(WIN_TYPE ct, short dx, short dy,
|
||||
|
||||
// Certified 100%
|
||||
WINDOW TMask_field::parent() const
|
||||
{ return get_parent(win()); }
|
||||
{ return xvt_vobj_get_parent(win()); }
|
||||
|
||||
|
||||
// Certified 90%
|
||||
int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
||||
{
|
||||
const WIN_TYPE wt = (heigth < 3) ? WC_TEXT : WC_GROUPBOX;
|
||||
if (width < 1) width = _prompt.len();
|
||||
if (width < 1) width = _prompt.len() - (_prompt[0] == '@' ? 2 : 0);
|
||||
_prompt.rtrim(); // Could save some bytes
|
||||
|
||||
if (width)
|
||||
@ -293,6 +292,8 @@ int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
const int k = _prompt.find('~');
|
||||
if (k >= 0) _prompt[k] = '&';
|
||||
if (required() && _prompt[0] != '@')
|
||||
_prompt.insert("@b", 0);
|
||||
#endif
|
||||
_promptwin = xvt_create_control
|
||||
(
|
||||
@ -313,9 +314,9 @@ int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
||||
void TMask_field::destroy()
|
||||
{
|
||||
if (_win)
|
||||
{ close_window(_win); _win = NULL_WIN; }
|
||||
{ xvt_vobj_destroy(_win); _win = NULL_WIN; }
|
||||
if (_promptwin)
|
||||
{ close_window(_promptwin); _promptwin = NULL_WIN; }
|
||||
{ xvt_vobj_destroy(_promptwin); _promptwin = NULL_WIN; }
|
||||
}
|
||||
|
||||
|
||||
@ -334,7 +335,7 @@ void TMask_field::enable(bool on)
|
||||
const word c = class_id();
|
||||
if (c != CLASS_FIELD)
|
||||
{
|
||||
enable_window(_win, on);
|
||||
xvt_vobj_set_enabled(_win, on);
|
||||
_flags.enabled = on;
|
||||
}
|
||||
}
|
||||
@ -351,9 +352,9 @@ void TMask_field::enable_default()
|
||||
// Certified 100%
|
||||
void TMask_field::show(bool on)
|
||||
{
|
||||
show_window(_win, on);
|
||||
xvt_vobj_set_visible(_win, on);
|
||||
if (_promptwin != NULL_WIN)
|
||||
show_window(_promptwin, on);
|
||||
xvt_vobj_set_visible(_promptwin, on);
|
||||
_flags.shown = on;
|
||||
}
|
||||
|
||||
@ -394,7 +395,7 @@ void TMask_field::set_dirty(bool d)
|
||||
// Certified 99%
|
||||
const char* TMask_field::get_window_data() const
|
||||
{
|
||||
return get_title(win(), (char*)(const char*)fpark, fpark.size());
|
||||
return xvt_vobj_get_title(win(), (char*)(const char*)fpark, fpark.size());
|
||||
}
|
||||
|
||||
|
||||
@ -402,7 +403,7 @@ const char* TMask_field::get_window_data() const
|
||||
void TMask_field::set_window_data(const char* data)
|
||||
{
|
||||
if (data != NULL)
|
||||
set_title(win(), (char*)data);
|
||||
xvt_vobj_set_title(win(), (char*)data);
|
||||
}
|
||||
|
||||
|
||||
@ -452,7 +453,7 @@ void TMask_field::reset()
|
||||
void TMask_field::set_prompt(const char* p)
|
||||
{
|
||||
if (_promptwin != NULL_WIN)
|
||||
set_title(_promptwin, (char*) p);
|
||||
xvt_vobj_set_title(_promptwin, (char*) p);
|
||||
}
|
||||
|
||||
|
||||
@ -818,7 +819,7 @@ bool TMask_field::on_key(KEY key)
|
||||
const TString16 mod(topic.left(2));
|
||||
if (mod != "ba") hlp.insert(mod, 0);
|
||||
|
||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
WinHelp(hwnd, hlp, HELP_MULTIKEY, (DWORD)&mk);
|
||||
break;
|
||||
}
|
||||
@ -863,7 +864,7 @@ bool TMask_field::on_key(KEY key)
|
||||
|
||||
void TMask_field::highlight() const
|
||||
{
|
||||
set_front_window(win());
|
||||
xvt_scr_set_focus_vobj(win());
|
||||
}
|
||||
|
||||
void TMask_field::set_focus() const
|
||||
@ -1418,7 +1419,7 @@ bool TBrowse::do_insert()
|
||||
if (_insert[0] == 'M')
|
||||
{
|
||||
TString80 nm(_insert.mid(1));
|
||||
if (strncmp(nm, "BATB", 4) == 0) // Programma gestione tabelle
|
||||
if (nm.compare("batb", 4, TRUE) == 0) // Programma gestione tabelle
|
||||
app = format("ba3 -0 %s", (const char*)nm.mid(4));
|
||||
// Obbligatorio usare la format globale
|
||||
else // Programma generico di browse/edit
|
||||
@ -1429,12 +1430,12 @@ bool TBrowse::do_insert()
|
||||
{
|
||||
app = _insert.mid(1);
|
||||
}
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (strnicmp(app, main_app().name(), 3) == 0)
|
||||
app.insert("a", 3);
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (strnicmp(app, main_app().name(), 3) == 0)
|
||||
app.insert("a", 3);
|
||||
#endif
|
||||
*/
|
||||
TMailbox mail;
|
||||
TMessage msg(app, MSG_AI, "");
|
||||
mail.send(msg);
|
||||
@ -1522,7 +1523,7 @@ KEY TBrowse::run()
|
||||
_cursor->read(_isgteq);
|
||||
|
||||
const TLocalisamfile& f = _cursor->file();
|
||||
TString80 caption(prefhndl->description(f.name()));
|
||||
TString80 caption(prefix().description(f.name()));
|
||||
if (!isalnum(caption[0]))
|
||||
caption = "Selezione";
|
||||
|
||||
@ -1537,14 +1538,15 @@ KEY TBrowse::run()
|
||||
byte buttons = 0;
|
||||
if (_insert.not_empty())
|
||||
{
|
||||
TFilename path;
|
||||
if (_insert[0] == 'M')
|
||||
path = "ba3 -0";
|
||||
else
|
||||
path = _insert.mid(1);
|
||||
|
||||
if (main_app().name() != cmd2name(path)) // Se non lancerei me stesso
|
||||
buttons = 1;
|
||||
buttons = 1; // Mette il bottone di gestione, a meno che ...
|
||||
|
||||
const TString& maskname = _fld->mask().source_file();
|
||||
if (maskname.compare("batb", 4, TRUE) == 0 && _fld->in_key(0))
|
||||
{
|
||||
const char* tabname = _cursor->file().name();
|
||||
if (maskname.mid(4, 3).compare(tabname, 3, TRUE) == 0)
|
||||
buttons = 0;
|
||||
}
|
||||
}
|
||||
|
||||
TBrowse_sheet s(_cursor, _items, caption, _head, buttons, _fld, sib);
|
||||
@ -1653,14 +1655,14 @@ void TEdit_field::enable(bool on)
|
||||
{
|
||||
TMask_field::enable(on);
|
||||
if (_buttonwin != NULL_WIN)
|
||||
show_window(_buttonwin, on && check_enabled() && shown());
|
||||
xvt_vobj_set_visible(_buttonwin, on && check_enabled() && shown());
|
||||
}
|
||||
|
||||
void TEdit_field::show(bool on)
|
||||
{
|
||||
TMask_field::show(on);
|
||||
if (_buttonwin != NULL_WIN)
|
||||
show_window(_buttonwin, on && check_enabled() && enabled());
|
||||
xvt_vobj_set_visible(_buttonwin, on && check_enabled() && enabled());
|
||||
}
|
||||
|
||||
|
||||
@ -1745,7 +1747,7 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
||||
{
|
||||
key = scanner.integer();
|
||||
#ifdef DBG
|
||||
if (key < 1)
|
||||
if (key < 1 || key > 15)
|
||||
{
|
||||
yesnofatal_box("Chiave %d non valida nella USE del campo %d", key, dlg());
|
||||
key = 1;
|
||||
@ -1764,11 +1766,8 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
||||
|
||||
if (tabmaskname.not_empty())
|
||||
{
|
||||
if (strncmp(main_app().name(), "ba3", 3) != 0)
|
||||
{
|
||||
tabmaskname.insert("MBATB", 0);
|
||||
_browse->set_insert(tabmaskname);
|
||||
}
|
||||
tabmaskname.insert("MBATB", 0);
|
||||
_browse->set_insert(tabmaskname);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -1923,7 +1922,7 @@ void TEdit_field::create(WINDOW parent)
|
||||
wincreate(WC_EDIT, _width+delta, 1, _str, parent, bandiere);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
|
||||
SendMessage(hwnd, EM_LIMITTEXT, _size, 0L); // Limita il testo
|
||||
#endif
|
||||
|
||||
@ -1943,7 +1942,7 @@ void TEdit_field::create(WINDOW parent)
|
||||
void TEdit_field::destroy()
|
||||
{
|
||||
if (_buttonwin)
|
||||
{ close_window(_buttonwin); _buttonwin = NULL_WIN; }
|
||||
{ xvt_vobj_destroy(_buttonwin); _buttonwin = NULL_WIN; }
|
||||
TMask_field::destroy();
|
||||
}
|
||||
|
||||
@ -2002,7 +2001,7 @@ const char* TEdit_field::picture_data(const char* data, bool video)
|
||||
if (video)
|
||||
{
|
||||
data = format(data);
|
||||
set_title(win(), (char*)data);
|
||||
xvt_vobj_set_title(win(), (char*)data);
|
||||
return get_window_data();
|
||||
}
|
||||
|
||||
@ -2184,7 +2183,7 @@ void TEdit_field::enable_check(bool on)
|
||||
{
|
||||
_check_enabled = on;
|
||||
if (_buttonwin != NULL_WIN)
|
||||
show_window(_buttonwin, on);
|
||||
xvt_vobj_set_visible(_buttonwin, on);
|
||||
}
|
||||
|
||||
|
||||
@ -2598,8 +2597,10 @@ bool TReal_field::on_key(KEY key)
|
||||
if (_flags.firm)
|
||||
{
|
||||
const long f = atol(n);
|
||||
if (f > 0 && prefhndl->exist(f))
|
||||
if (f > 0 && prefix().exist(f))
|
||||
main_app().set_firm(f);
|
||||
else
|
||||
return error_box("Ditta non utilizzabile in contabilita'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2794,7 +2795,7 @@ void TList_field::add_item(const char* s)
|
||||
if (pos < 0 )
|
||||
{
|
||||
_codes.add(item);
|
||||
win_list_add(win(), -1, (char*)t.get());
|
||||
xvt_list_add(win(), -1, (char*)t.get());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2807,10 +2808,10 @@ void TList_field::delete_item(const char* s)
|
||||
if (pos >= 0 )
|
||||
{
|
||||
_codes.destroy(pos);
|
||||
win_list_delete(win(), pos);
|
||||
xvt_list_rem(win(), pos);
|
||||
if (mask().is_running())
|
||||
{
|
||||
win_list_set_sel(win(), 0, TRUE);
|
||||
xvt_list_set_sel(win(), 0, TRUE);
|
||||
if (shown()) on_hit();
|
||||
}
|
||||
}
|
||||
@ -2842,11 +2843,11 @@ void TList_field::add_list()
|
||||
}
|
||||
}
|
||||
|
||||
SLIST lst = slist_new();
|
||||
SLIST lst = xvt_slist_create();
|
||||
for (const char* item = _values.get(0); item; item = _values.get())
|
||||
slist_add(lst, (SLIST_ELT)NULL, (char*)item, 0L);
|
||||
win_list_add(win(), -1, (char*)lst);
|
||||
slist_dispose(lst);
|
||||
xvt_slist_add_at_elt(lst, (SLIST_ELT)NULL, (char*)item, 0L);
|
||||
xvt_list_add(win(), -1, (char*)lst);
|
||||
xvt_slist_destroy(lst);
|
||||
|
||||
const char* init = "";
|
||||
if (roman() && automagic())
|
||||
@ -2862,7 +2863,7 @@ void TList_field::replace_items(const char* codes, const char* values)
|
||||
|
||||
if (win() != NULL_WIN)
|
||||
{
|
||||
win_list_clear(win());
|
||||
xvt_list_clear(win());
|
||||
add_list();
|
||||
current(0);
|
||||
}
|
||||
@ -2921,12 +2922,12 @@ void TList_field::set_window_data(const char* data)
|
||||
|
||||
void TList_field::current(int n)
|
||||
{
|
||||
win_list_set_sel(win(), n, TRUE);
|
||||
xvt_list_set_sel(win(), n, TRUE);
|
||||
}
|
||||
|
||||
int TList_field::current() const
|
||||
{
|
||||
const int sel = win_list_get_sel_index(win());
|
||||
const int sel = xvt_list_get_sel_index(win());
|
||||
#ifdef DBG
|
||||
if (sel < 0 && items() > 0)
|
||||
error_box("Lista senza selezione nel campo %d", dlg());
|
||||
@ -2968,7 +2969,7 @@ bool TList_field::on_key(KEY key)
|
||||
{
|
||||
if (key >= '0' && key <= 'z')
|
||||
{
|
||||
const int index = win_list_get_sel_index(win());
|
||||
const int index = xvt_list_get_sel_index(win());
|
||||
CHECK(index >= 0, "List with no selection!");
|
||||
int newindex = -1;
|
||||
|
||||
@ -2982,7 +2983,7 @@ bool TList_field::on_key(KEY key)
|
||||
|
||||
do
|
||||
{
|
||||
flag = win_list_get_elt(win(), i, item, 16);
|
||||
flag = xvt_list_get_elt(win(), i, item, 16);
|
||||
if (!flag)
|
||||
{
|
||||
CHECK(i, "La lista e' vuota!");
|
||||
@ -3011,10 +3012,10 @@ bool TList_field::on_key(KEY key)
|
||||
|
||||
if (newindex >= 0)
|
||||
{
|
||||
win_list_suspend(win());
|
||||
win_list_set_sel(win(), index, FALSE);
|
||||
win_list_set_sel(win(), newindex, TRUE);
|
||||
win_list_resume(win());
|
||||
xvt_list_suspend(win());
|
||||
xvt_list_set_sel(win(), index, FALSE);
|
||||
xvt_list_set_sel(win(), newindex, TRUE);
|
||||
xvt_list_resume(win());
|
||||
}
|
||||
} // alphanumeric
|
||||
|
||||
@ -3083,11 +3084,11 @@ void TRadio_field::create(WINDOW parent)
|
||||
void TRadio_field::destroy()
|
||||
{
|
||||
if (_promptwin)
|
||||
{ close_window(_promptwin); _promptwin = NULL_WIN; }
|
||||
{ xvt_vobj_destroy(_promptwin); _promptwin = NULL_WIN; }
|
||||
|
||||
for(int i = 0; i < _nitems; i++)
|
||||
{
|
||||
close_window(_radio_ctl_win[i]);
|
||||
xvt_vobj_destroy(_radio_ctl_win[i]);
|
||||
_radio_ctl_win[i] = NULL_WIN;
|
||||
}
|
||||
}
|
||||
@ -3126,10 +3127,10 @@ void TRadio_field::enable(bool on)
|
||||
void TRadio_field::show(bool on)
|
||||
{
|
||||
if (_promptwin)
|
||||
show_window(_promptwin, on);
|
||||
xvt_vobj_set_visible(_promptwin, on);
|
||||
|
||||
for(int i = 0; i < _nitems; i++)
|
||||
show_window(_radio_ctl_win[i], on);
|
||||
xvt_vobj_set_visible(_radio_ctl_win[i], on);
|
||||
_flags.shown = on;
|
||||
}
|
||||
|
||||
|
@ -46,9 +46,8 @@ class TSpreadsheet : public TWindow
|
||||
bool _check_enabled; // Perform OFF_ROW and OFF_CELL checks
|
||||
bool _update; // It's safe to update the display
|
||||
|
||||
static void xiev_handler(XI_OBJ *itf, XI_EVENT *xiev);
|
||||
void init();
|
||||
|
||||
friend void XVT_CALLCONV1 xiev_handler(XI_OBJ *itf, XI_EVENT *xiev);
|
||||
protected:
|
||||
void list_handler(XI_EVENT *xiev);
|
||||
|
||||
@ -109,10 +108,9 @@ void TSpreadsheet::init()
|
||||
{
|
||||
static bool first = TRUE;
|
||||
if (!first) return;
|
||||
|
||||
DRAW_CTOOLS ct;
|
||||
win_get_draw_ctools(TASK_WIN, &ct);
|
||||
xi_set_font(&ct.font);
|
||||
|
||||
XVT_FNTID font = xvt_dwin_get_font(TASK_WIN);
|
||||
xi_set_font_id(font);
|
||||
|
||||
xi_init();
|
||||
xi_set_pref(XI_PREF_3D_LOOK, TRUE);
|
||||
@ -207,7 +205,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
0, 0, rct.bottom-rct.top,
|
||||
XI_ATR_ENABLED | XI_ATR_VISIBLE,
|
||||
NORMAL_COLOR, NORMAL_BACK_COLOR, // normal
|
||||
NORMAL_COLOR, DISABLED_BACK_COLOR, // disabled
|
||||
NORMAL_COLOR, MASK_BACK_COLOR, // disabled
|
||||
COLOR_RED, // active
|
||||
LIST_CID);
|
||||
listdef->v.list->sizable_columns = TRUE;
|
||||
@ -282,11 +280,11 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
|
||||
RCT itfrct;
|
||||
xi_get_def_rect(itfdef, &itfrct);
|
||||
offset_rect(&itfrct, rct.left, rct.top);
|
||||
xvt_rect_offset(&itfrct, rct.left, rct.top);
|
||||
itfrct.bottom++;
|
||||
|
||||
WINDOW win = create_window(W_NO_BORDER, &itfrct, "", 0, parent,
|
||||
0, EM_ALL, (EVENT_HANDLER)xi_event, 0L);
|
||||
WINDOW win = xvt_win_create(W_NO_BORDER, &itfrct, "", 0, parent,
|
||||
0, EM_ALL, (EVENT_HANDLER)xi_event, 0L);
|
||||
CHECK(win, "Can't create a window for the spreadsheet");
|
||||
|
||||
set_win(win); // Set TWindow::_win
|
||||
@ -386,8 +384,7 @@ void TSpreadsheet::update_rec(int rec)
|
||||
|
||||
void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
||||
{
|
||||
set_front_window(win()); // It seems necessary
|
||||
|
||||
xvt_scr_set_focus_vobj(win());
|
||||
const int r = row2rec(riga);
|
||||
|
||||
for (; colonna < _columns; colonna++)
|
||||
@ -489,7 +486,8 @@ bool TSpreadsheet::test_focus_change()
|
||||
}
|
||||
|
||||
|
||||
void TSpreadsheet::xiev_handler(XI_OBJ *itf, XI_EVENT *xiev)
|
||||
//void TSpreadsheet::xiev_handler(XI_OBJ *itf, XI_EVENT *xiev)
|
||||
void XVT_CALLCONV1 xiev_handler(XI_OBJ *itf, XI_EVENT *xiev)
|
||||
{
|
||||
TSpreadsheet* es = (TSpreadsheet*)xi_get_app_data(itf);
|
||||
CHECK(es, "NULL Edit sheet in xi event");
|
||||
@ -545,15 +543,6 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
TMask_field* f = field(cid);
|
||||
const int acqua = f->class_id();
|
||||
|
||||
// if (acqua == CLASS_BUTTON_FIELD)
|
||||
// {
|
||||
// if (isdigit(_button[0]))
|
||||
// xiev->v.cell_request.icon_rid = atoi(_button);
|
||||
// else
|
||||
// src = _button;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
src = row(rec).get(col); // Set value for cell
|
||||
if (src && *src && f->is_edit())
|
||||
{
|
||||
@ -566,7 +555,6 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
}
|
||||
if (cell_disabled(rec, col))
|
||||
xiev->v.cell_request.back_color = DISABLED_BACK_COLOR;
|
||||
// }
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -688,13 +676,12 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
str2mask(_cur_rec); // It shouldn't have to be necessary
|
||||
bool ok = sheet_mask().check_fields();
|
||||
if (ok)
|
||||
{
|
||||
{
|
||||
const int next = _cur_rec + (_lastab == K_TAB ? +1 : -1);
|
||||
|
||||
_update = rec2row(next) >= 0;
|
||||
mask2str(_cur_rec);
|
||||
_update = rec2row(next) >= 0; // Disable update if next record is not visible
|
||||
mask2str(_cur_rec); // Update sheet for with mask contents
|
||||
ok = notify(_cur_rec, K_ENTER); // Notify edit
|
||||
_update = TRUE;
|
||||
_update = TRUE; // Reenable update
|
||||
}
|
||||
if (!ok)
|
||||
xiev->refused = TRUE;
|
||||
@ -776,7 +763,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
case K_BTAB:
|
||||
_lastab = k;
|
||||
break;
|
||||
case K_UP:
|
||||
case K_UP:
|
||||
_lastab = K_BTAB;
|
||||
break;
|
||||
case K_DOWN:
|
||||
@ -983,14 +970,16 @@ bool TSpreadsheet::on_key(KEY k)
|
||||
if (k == K_ENTER)
|
||||
notify(n, K_ENTER); // Notifica avvenuto cambiamento
|
||||
|
||||
set_front_window(win()); // Aggiorna sheet a video
|
||||
xvt_R3_set_front_window(win());
|
||||
/* xvt_scr_set_focus_vobj(win()); -- set_focus does not raise window */
|
||||
/* xvt_vobj_raise(win()); -- note: raise is illegal on controls */ // Aggiorna sheet a video
|
||||
open();
|
||||
}
|
||||
break;
|
||||
case K_TAB:
|
||||
case K_BTAB:
|
||||
case K_SHIFT_TAB:
|
||||
dispatch_e_char(get_parent(win()), k);
|
||||
dispatch_e_char(xvt_vobj_get_parent(win()), k);
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
@ -1007,7 +996,7 @@ bool TSpreadsheet::on_key(KEY k)
|
||||
|
||||
TMask& TSpreadsheet::mask() const
|
||||
{
|
||||
TMask* m = (TMask*)get_app_data(parent());
|
||||
TMask* m = (TMask*)xvt_vobj_get_data(parent());
|
||||
return *m;
|
||||
}
|
||||
|
||||
@ -1277,7 +1266,7 @@ void TSheet_field::create(WINDOW parent)
|
||||
m.sheets(), _head, parent, this);
|
||||
|
||||
_win = _sheet->win();
|
||||
show_window(_win, shown());
|
||||
xvt_vobj_set_visible(_win, shown());
|
||||
if (!enabled()) disable();
|
||||
}
|
||||
|
||||
|
@ -1,33 +1,33 @@
|
||||
#define PART_ANNO "ANNO"
|
||||
#define PART_NUMPART "NUMPART"
|
||||
#define PART_NRIGA "NRIGA"
|
||||
#define PART_TIPOMOV "TIPOMOV"
|
||||
#define PART_NREG "NREG"
|
||||
#define PART_NUMRIG "NUMRIG"
|
||||
#define PART_DATAREG "DATAREG"
|
||||
#define PART_DATADOC "DATADOC"
|
||||
#define PART_NUMDOC "NUMDOC"
|
||||
#define PART_DESCR "DESCR"
|
||||
#define PART_REG "REG"
|
||||
#define PART_PROTIVA "PROTIVA"
|
||||
#define PART_CODCAUS "CODCAUS"
|
||||
#define PART_SEZ "SEZ"
|
||||
#define PART_IMPORTO "IMPORTO"
|
||||
#define PART_IMPOSTA "IMPOSTA"
|
||||
#define PART_SPESE "SPESE"
|
||||
#define PART_CODPAG "CODPAG"
|
||||
#define PART_CODVAL "CODVAL"
|
||||
#define PART_CAMBIO "CAMBIO"
|
||||
#define PART_IMPORTOVAL "IMPORTOVAL"
|
||||
#define PART_DATACAM "DATACAM"
|
||||
#define PART_TIPOCF "TIPOCF"
|
||||
#define PART_GRUPPO "GRUPPO"
|
||||
#define PART_CONTO "CONTO"
|
||||
#define PART_SOTTOCONTO "SOTTOCONTO"
|
||||
#define PART_CODABI "CODABI"
|
||||
#define PART_CODCAB "CODCAB"
|
||||
#define PART_CODAG "CODAG"
|
||||
#define PART_IMPTOTPAG "IMPTOTPAG"
|
||||
#define PART_DATARIFPAG "DATARIFPAG"
|
||||
#define PART_NUMRIFPAG "NUMRIFPAG"
|
||||
#define PART_CHIUSA "CHIUSA"
|
||||
#define PART_ANNO "ANNO"
|
||||
#define PART_NUMPART "NUMPART"
|
||||
#define PART_NRIGA "NRIGA"
|
||||
#define PART_TIPOMOV "TIPOMOV"
|
||||
#define PART_NREG "NREG"
|
||||
#define PART_NUMRIG "NUMRIG"
|
||||
#define PART_DATAREG "DATAREG"
|
||||
#define PART_DATADOC "DATADOC"
|
||||
#define PART_NUMDOC "NUMDOC"
|
||||
#define PART_DESCR "DESCR"
|
||||
#define PART_REG "REG"
|
||||
#define PART_PROTIVA "PROTIVA"
|
||||
#define PART_CODCAUS "CODCAUS"
|
||||
#define PART_SEZ "SEZ"
|
||||
#define PART_IMPORTO "IMPORTO"
|
||||
#define PART_IMPOSTA "IMPOSTA"
|
||||
#define PART_SPESE "SPESE"
|
||||
#define PART_CODPAG "CODPAG"
|
||||
#define PART_CODVAL "CODVAL"
|
||||
#define PART_CAMBIO "CAMBIO"
|
||||
#define PART_IMPORTOVAL "IMPORTOVAL"
|
||||
#define PART_DATACAM "DATACAM"
|
||||
#define PART_TIPOCF "TIPOCF"
|
||||
#define PART_GRUPPO "GRUPPO"
|
||||
#define PART_CONTO "CONTO"
|
||||
#define PART_SOTTOCONTO "SOTTOCONTO"
|
||||
#define PART_CODABI "CODABI"
|
||||
#define PART_CODCAB "CODCAB"
|
||||
#define PART_CODAG "CODAG"
|
||||
#define PART_IMPTOTPAG "IMPTOTPAG"
|
||||
#define PART_DATARIFPAG "DATARIFPAG"
|
||||
#define PART_NUMRIFPAG "NUMRIFPAG"
|
||||
#define PART_CHIUSA "CHIUSA"
|
||||
|
@ -14,14 +14,46 @@
|
||||
#include <scanner.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <lffiles.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// extern variables are NO-NO!
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
HIDDEN TString16 _user;
|
||||
HIDDEN TPrefix* _prefhndl = NULL;
|
||||
|
||||
TString& user()
|
||||
{
|
||||
return _user;
|
||||
}
|
||||
|
||||
TPrefix& prefix_init()
|
||||
{
|
||||
CHECK(_prefhndl == NULL, "Can't create two prefix objects");
|
||||
_prefhndl = new TPrefix;
|
||||
return *_prefhndl;
|
||||
}
|
||||
|
||||
TPrefix& prefix()
|
||||
{
|
||||
CHECK(_prefhndl, "Can't access null prefix");
|
||||
return *_prefhndl;
|
||||
}
|
||||
|
||||
void prefix_destroy()
|
||||
{
|
||||
delete _prefhndl;
|
||||
_prefhndl = NULL;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TPrefix
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
HIDDEN const char* const glockname = "xx";
|
||||
|
||||
TPrefix::TPrefix() : _filelevel(0), _items(0)
|
||||
{
|
||||
CHECK(prefhndl == NULL, "Can't create two prefix objects");
|
||||
|
||||
_prefix = ".";
|
||||
_dirfl = dirfl;
|
||||
_recfl = recfl;
|
||||
|
@ -55,19 +55,11 @@ public:
|
||||
|
||||
const char* firm2dir(long codditta);
|
||||
|
||||
#ifdef __PREFIX_CPP
|
||||
#define extern
|
||||
#endif
|
||||
TString& user();
|
||||
|
||||
// @DPUB
|
||||
extern TPrefix* prefhndl
|
||||
// @END
|
||||
#ifdef __PREFIX_CPP
|
||||
= NULL ;
|
||||
#undef extern
|
||||
#else
|
||||
;
|
||||
#endif
|
||||
TPrefix& prefix_init();
|
||||
TPrefix& prefix();
|
||||
void prefix_destroy();
|
||||
|
||||
#endif // __PREFIX_H
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: printapp.cpp,v 1.18 1995-02-21 10:21:35 villa Exp $
|
||||
// $Id: printapp.cpp,v 1.19 1995-03-22 09:06:11 guy Exp $
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
TLocalisamfile *fff;
|
||||
|
||||
const char *printf_types = "dDiIuUoOxXfeEgGcCnNsSpPrRtT";
|
||||
const char* const printf_types = "dDiIuUoOxXfeEgGcCnNsSpPrRtT";
|
||||
|
||||
// _FieldTok flags
|
||||
|
||||
|
@ -15,14 +15,19 @@
|
||||
|
||||
#include <applicat.h>
|
||||
#include <execp.h>
|
||||
#include <extcdecl.h>
|
||||
#include <mask.h>
|
||||
|
||||
#include <mask.h>
|
||||
#include <printwin.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <viswin.h>
|
||||
#include <config.h>
|
||||
|
||||
#include <bagn001a.h>
|
||||
#include <bagn001a.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// PrDesc
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
struct PrDesc
|
||||
{
|
||||
@ -49,10 +54,11 @@ void TPrinter::_get_windows_printer_names (TToken_string & t)
|
||||
|
||||
for (int i = 0; i < 4095; i++)
|
||||
{
|
||||
if (buf[i] == '\0' && buf[i + 1] == '\0')
|
||||
break;
|
||||
if (buf[i] == '\0' && buf[i + 1] != '\0')
|
||||
buf[i] = '|';
|
||||
if (buf[i] == '\0')
|
||||
{
|
||||
if (buf[i+1] != '\0') buf[i] = '|';
|
||||
else break;
|
||||
}
|
||||
}
|
||||
t = buf;
|
||||
delete buf;
|
||||
@ -62,57 +68,37 @@ BOOLEAN XVT_CALLCONV1 TPrinter::start_winprint (long data)
|
||||
{
|
||||
PrDesc *pd = (PrDesc *) data;
|
||||
TTextfile& txt = *(pd->_txt);
|
||||
TPrintwin pw(pd->_prcd, txt, pd->_charsize);
|
||||
pw.print_background (pd->_graphics);
|
||||
TPrintwin pw(txt);
|
||||
pw.do_print();
|
||||
return pw.aborted();
|
||||
}
|
||||
#endif
|
||||
|
||||
// utils del caz
|
||||
HIDDEN void read_int (const char *s, int &n, int &cnt)
|
||||
HIDDEN int read_int (const char *s, int &n, int &cnt)
|
||||
{
|
||||
static char nbuf[10];
|
||||
int j = 0;
|
||||
char nbuf[16];
|
||||
|
||||
while (!isdigit (s[cnt]))
|
||||
cnt++;
|
||||
while (isdigit (s[cnt]))
|
||||
nbuf[j++] = s[cnt++];
|
||||
|
||||
for (int j = 0; isdigit (s[cnt]); j++)
|
||||
nbuf[j] = s[cnt++];
|
||||
nbuf[j] = '\0';
|
||||
n = atoi (nbuf);
|
||||
|
||||
return n = atoi (nbuf);
|
||||
}
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
void TPrinter::set_win_formlen ()
|
||||
{
|
||||
long pw, ph, phr, pvr;
|
||||
xvt_escape (XVT_ESC_GET_PRINTER_INFO, _print_rcd, &ph, &pw, &pvr, &phr);
|
||||
if (pvr != 0)
|
||||
{
|
||||
_formlen = (int) (ph * _lines_per_inch / pvr);
|
||||
|
||||
_dots_per_line = (int) (pvr / _lines_per_inch);
|
||||
if (_dots_per_line < 1) _dots_per_line = 1;
|
||||
|
||||
_vert_offset = (int) (ph % (long) (_formlen * _dots_per_line));
|
||||
_horz_offset = 0; // not implemented (font dependent)
|
||||
|
||||
}
|
||||
else
|
||||
warning_box ("Il driver di stampante non e' valido.\n"
|
||||
"Non stampare prima di averlo reinstallato");
|
||||
}
|
||||
#endif
|
||||
|
||||
void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
||||
{
|
||||
char op;
|
||||
TString_array pix;
|
||||
char op, ch;
|
||||
int x1, x2, y1, y2;
|
||||
TToken_string tt (20);
|
||||
TString txt (80);
|
||||
TArray pix;
|
||||
char ch;
|
||||
int cnt = 0;
|
||||
int id, cnt = 0;
|
||||
|
||||
TToken_string tt;
|
||||
TFilename bmp;
|
||||
|
||||
while ((ch = bg_desc[cnt++]) != '\0')
|
||||
{
|
||||
@ -122,24 +108,41 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
||||
bf[1] = '\0';
|
||||
switch (op)
|
||||
{
|
||||
case ' ': // ignore whitespace
|
||||
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
continue;
|
||||
continue; // ignore whitespace
|
||||
break;
|
||||
case 'i':
|
||||
tt << op;
|
||||
cnt++;
|
||||
for (x1 = 0; bg_desc[cnt] != ','; x1++)
|
||||
bmp[x1] = bg_desc[cnt++];
|
||||
bmp[x1] = '\0';
|
||||
id = _image_names.find(bmp);
|
||||
if (id < 0) id = _image_names.add(bmp);
|
||||
read_int(bg_desc, x1, cnt); if (x1 <= 0) x1 = 1;
|
||||
read_int(bg_desc, y1, cnt); if (y1 <= 0) y1 = 1;
|
||||
read_int(bg_desc, x2, cnt); if (x2 <= 0) x2 = formwidth();
|
||||
read_int(bg_desc, y2, cnt); if (y2 <= 0) y2 = formlen();
|
||||
cnt++;
|
||||
tt.add(id);
|
||||
tt.add(x1);
|
||||
tt.add(y1);
|
||||
tt.add(x2);
|
||||
tt.add(y2);
|
||||
break;
|
||||
case 'l': // line
|
||||
|
||||
case 'b': // box
|
||||
|
||||
case 'r': // round box
|
||||
|
||||
cnt++;
|
||||
read_int (bg_desc, x1, cnt);
|
||||
read_int (bg_desc, y1, cnt);
|
||||
read_int (bg_desc, x2, cnt);
|
||||
read_int (bg_desc, y2, cnt);
|
||||
cnt++;
|
||||
cnt++; // skip separator
|
||||
tt << op;
|
||||
tt.add (x1 - 1);
|
||||
tt.add (y1 - 1);
|
||||
@ -147,19 +150,18 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
||||
tt.add (y2 - 1);
|
||||
break;
|
||||
case 't': // text
|
||||
|
||||
cnt++;
|
||||
read_int (bg_desc, x1, cnt);
|
||||
read_int (bg_desc, y1, cnt);
|
||||
cnt++;
|
||||
txt = "";
|
||||
while ((ch = bg_desc[cnt++]) != '}')
|
||||
txt << ch;
|
||||
tt << op;
|
||||
tt.add (x1 - 1);
|
||||
tt.add (y1 - 1);
|
||||
tt.add (txt);
|
||||
tt.add (x1-1);
|
||||
tt.add (y1-1);
|
||||
tt << '|';
|
||||
while ((ch = bg_desc[cnt++]) != '}')
|
||||
tt << ch;
|
||||
break;
|
||||
|
||||
case 'P': // set pen style
|
||||
|
||||
case 'B': // set brush
|
||||
@ -190,29 +192,25 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
||||
|
||||
for (int l = 0; l < _formlen; l++)
|
||||
{
|
||||
|
||||
TString *rwd = (TString *) background.objptr (l);
|
||||
if (rwd == NULL)
|
||||
{
|
||||
background.add (rwd = new TString, l);
|
||||
if (curcol != 'n')
|
||||
(*rwd) << 'C' << curcol;
|
||||
if (curpat != 'n')
|
||||
(*rwd) << 'B' << curpat;
|
||||
if (curwid != '1')
|
||||
(*rwd) << 'W' << curwid;
|
||||
if (curpen != 'n')
|
||||
(*rwd) << 'P' << curcol;
|
||||
if (background.objptr(l) == NULL) // Se la riga non esiste creala
|
||||
{
|
||||
TString* r = new TString(15);
|
||||
if (curcol != 'n') *r << 'C' << curcol; // Setta valori se diversi da default
|
||||
if (curpat != 'n') *r << 'B' << curpat;
|
||||
if (curwid != '1') *r << 'W' << curwid;
|
||||
if (curpen != 'n') *r << 'P' << curcol;
|
||||
background.add(r, l);
|
||||
}
|
||||
for (int j = 0; j < pix.items (); j++)
|
||||
|
||||
TString& rwd = (TString&)background[l];
|
||||
for (int j = 0; j < pix.items(); j++)
|
||||
{
|
||||
TToken_string & tt = (TToken_string &) pix[j];
|
||||
tt.restart ();
|
||||
TToken_string& tt = pix.row(j);
|
||||
|
||||
// la stringa contiene l'opcode piu' i parametri in binario,
|
||||
// incrementati di 1 per evitare lo 0
|
||||
|
||||
switch (*(tt.get (0)))
|
||||
switch (*(tt.get(0)))
|
||||
{
|
||||
case 'b':
|
||||
x1 = tt.get_int (1) + 1;
|
||||
@ -220,24 +218,21 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
||||
x2 = tt.get_int (3) + 1;
|
||||
y2 = tt.get_int (4) + 1;
|
||||
if (y1 == l + 1) // at ze biginnin
|
||||
|
||||
{
|
||||
(*rwd) << 'u' << char (x1);
|
||||
(*rwd) << 'r' << char (x1) << char (x2);
|
||||
(*rwd) << 'u' << char (x2);
|
||||
rwd << 'u' << char (x1);
|
||||
rwd << 'r' << char (x1) << char (x2);
|
||||
rwd << 'u' << char (x2);
|
||||
}
|
||||
else if (y2 == l + 1) // at ze end
|
||||
|
||||
{
|
||||
(*rwd) << 'o' << char (x1);
|
||||
(*rwd) << 'r' << char (x1) << char (x2);
|
||||
(*rwd) << 'o' << char (x2);
|
||||
rwd << 'o' << char (x1);
|
||||
rwd << 'r' << char (x1) << char (x2);
|
||||
rwd << 'o' << char (x2);
|
||||
}
|
||||
else if (y1 < l + 1 && y2 > l + 1) // in ze middol
|
||||
|
||||
{
|
||||
(*rwd) << 'v' << char (x1);
|
||||
(*rwd) << 'v' << char (x2);
|
||||
rwd << 'v' << char (x1);
|
||||
rwd << 'v' << char (x2);
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
@ -248,38 +243,48 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
||||
if (y1 == y2 && y1 == l + 1) // orizzontale
|
||||
|
||||
{
|
||||
(*rwd) << 'h' << char (x1) << char (x2);
|
||||
rwd << 'h' << char (x1) << char (x2);
|
||||
}
|
||||
else if (y1 <= l + 1 && y2 >= l + 1) // verticale
|
||||
|
||||
{
|
||||
(*rwd) << 'v' << char (x1);
|
||||
rwd << 'v' << char (x1);
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
x1 = tt.get_int (1) + 1;
|
||||
y1 = tt.get_int (2) + 1; // al gh'e'
|
||||
|
||||
if (y1 == l + 1)
|
||||
{
|
||||
}
|
||||
break;
|
||||
{}
|
||||
break;
|
||||
case 'i':
|
||||
id = tt.get_int();
|
||||
x1 = tt.get_int();
|
||||
y1 = tt.get_int();
|
||||
x2 = tt.get_int();
|
||||
y2 = tt.get_int();
|
||||
if (l+1 >= y1 && l+1 <= y2)
|
||||
rwd << 'i' << char(id+1) << char(l-y1+2) << char(x1)
|
||||
<< char(x2-x1+1) << char(y2-y1+1);
|
||||
break;
|
||||
case 'W':
|
||||
curwid = *(tt.get (1));
|
||||
(*rwd) << 'W' << curwid;
|
||||
rwd << 'W' << curwid;
|
||||
break;
|
||||
case 'P':
|
||||
curpen = *(tt.get (1));
|
||||
(*rwd) << 'P' << curpen;
|
||||
rwd << 'P' << curpen;
|
||||
break;
|
||||
case 'B':
|
||||
curpat = *(tt.get (1));
|
||||
(*rwd) << 'B' << curpat;
|
||||
rwd << 'B' << curpat;
|
||||
break;
|
||||
case 'C':
|
||||
curcol = *(tt.get (1));
|
||||
(*rwd) << 'C' << curcol;
|
||||
rwd << 'C' << curcol;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -627,22 +632,70 @@ bool printers_on_key (TMask_field & f, KEY key)
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
|
||||
bool set_windows_print_device (TMask_field& f, KEY key)
|
||||
void TPrinter::set_printrcd()
|
||||
{
|
||||
static char szDevice[80];
|
||||
if (key == K_SPACE && f.mask().is_running())
|
||||
if (_print_rcd != NULL)
|
||||
xvt_print_destroy(_print_rcd);
|
||||
_print_rcd = xvt_print_create(&_print_rcd_size);
|
||||
}
|
||||
|
||||
PRINT_RCD* TPrinter::get_printrcd(int *size)
|
||||
{
|
||||
if (_print_rcd == NULL || !xvt_print_is_valid(_print_rcd))
|
||||
set_printrcd();
|
||||
if (size != NULL) *size = _print_rcd_size;
|
||||
return _print_rcd;
|
||||
}
|
||||
|
||||
void TPrinter::set_win_formlen(WINDOW prwin)
|
||||
{
|
||||
long pw, ph, phr, pvr; // Printer width, height, horizontal and vertical resolution
|
||||
xvt_app_escape (XVT_ESC_GET_PRINTER_INFO, get_printrcd(), &ph, &pw, &pvr, &phr);
|
||||
|
||||
if (pvr != 0)
|
||||
{
|
||||
if (main_app().printer().get_printrcd() != NULL)
|
||||
free_print_rcd (main_app().printer().get_printrcd ());
|
||||
TToken_string & pn = main_app().printer().getprinternames ();
|
||||
_formlen = int(ph * _lines_per_inch / pvr); // Total number of lines per page
|
||||
_dots_per_line = int(pvr / _lines_per_inch); // Number of point per line
|
||||
_vert_offset = (int)(ph - ((long)_formlen * _dots_per_line)) >> 1;
|
||||
|
||||
if (prwin != NULL_WIN)
|
||||
{
|
||||
TString256 spc; spc.spaces(256); // Compute maximun number of chars per line
|
||||
int w = 0;
|
||||
for (_formwidth = 256; _formwidth >= 80; _formwidth--)
|
||||
{
|
||||
w = xvt_dwin_get_text_width(prwin, (char*)(const char*)spc, _formwidth);
|
||||
if (w < pw) break;
|
||||
}
|
||||
_horz_offset = (_formwidth > 80) ? (int)(pw - w)/2 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_formwidth = 256;
|
||||
_horz_offset = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
warning_box ("Il driver di stampante non e' valido.\n"
|
||||
"Non stampare prima di averlo reinstallato");
|
||||
}
|
||||
|
||||
// Handler della maschera di setup
|
||||
HIDDEN bool set_windows_print_device (TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE && f.mask().is_running())
|
||||
{
|
||||
TPrinter& printer = main_app().printer();
|
||||
|
||||
char szDevice[80];
|
||||
TToken_string & pn = printer.getprinternames ();
|
||||
TString pdev (pn.get (atoi (f.get())));
|
||||
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
|
||||
pdev << "," << szDevice;
|
||||
// scrivi (e semmai lo si risistema poi)
|
||||
WriteProfileString("windows", "device", pdev);
|
||||
main_app().printer().set_printrcd(
|
||||
get_print_rcd(&(main_app().printer ().get_printrcdsize ())));
|
||||
main_app().printer().set_win_formlen();
|
||||
printer.set_printrcd();
|
||||
printer.set_win_formlen();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -651,7 +704,7 @@ bool set_windows_print_device (TMask_field& f, KEY key)
|
||||
|
||||
TPrinter::TPrinter()
|
||||
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
|
||||
_lines_per_inch (6), _ch_size (12), _ncopies(1)
|
||||
_lines_per_inch (6), _ch_size (12), _ncopies(1), _print_rcd(NULL)
|
||||
|
||||
{
|
||||
_footerhandler = _headerhandler = NULL;
|
||||
@ -675,39 +728,34 @@ TPrinter::TPrinter()
|
||||
|
||||
// read configuration file
|
||||
read_configuration (_config);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
print_begin ();
|
||||
_print_rcd = get_print_rcd (&_print_rcd_size);
|
||||
TConfig cnf (CONFIG_GENERAL, "Print");
|
||||
_ch_size = cnf.get_int("Size", NULL, -1, 12);
|
||||
_lines_per_inch = cnf.get_int("Lines", NULL, -1, 6);
|
||||
|
||||
xvt_print_open ();
|
||||
|
||||
set_printrcd();
|
||||
set_win_formlen ();
|
||||
|
||||
static char defPrinter[80];
|
||||
static char szDevice[50];
|
||||
char defPrinter[80];
|
||||
char szDevice[50];
|
||||
|
||||
// get default printer driver
|
||||
GetProfileString ("windows", "device", ",,,", defPrinter, sizeof(defPrinter));
|
||||
TString pdev (defPrinter);
|
||||
TToken_string pdev (defPrinter, ',');
|
||||
GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice));
|
||||
pdev << "," << szDevice;
|
||||
TToken_string dio (pdev, ',');
|
||||
TToken_string pn2(1024);
|
||||
pdev.add(szDevice);
|
||||
|
||||
// get printer names
|
||||
_get_windows_printer_names (pn2);
|
||||
TToken_string pn2(1024);
|
||||
_get_windows_printer_names(pn2);
|
||||
|
||||
// determine index of current default printer
|
||||
for (int i = 0; i < pn2.items (); i++)
|
||||
{
|
||||
if (TString(dio.get(0)) == TString(pn2.get(i)))
|
||||
{
|
||||
_curprn = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const TString80 p1(pdev.get(0));
|
||||
_curprn = pn2.get_pos(p1);
|
||||
CHECKS(_curprn >= 0, "Can't find printer ", (const char*)p1);
|
||||
|
||||
TConfig cnf (CONFIG_GENERAL, "Stampa");
|
||||
_ch_size = cnf.get_int("Size",NULL,-1,12);
|
||||
_lines_per_inch = cnf.get_int("Lines",NULL,-1,6);
|
||||
|
||||
#else
|
||||
_isgraphics = FALSE;
|
||||
#endif
|
||||
@ -758,7 +806,7 @@ void TPrinter::read_configuration(const char *conf)
|
||||
|
||||
TFilename s ("printer.def");
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
s << format (".%d", getuid ());
|
||||
s << '.' << getuid ();
|
||||
#endif
|
||||
if (fexist (s))
|
||||
{
|
||||
@ -810,7 +858,8 @@ void TPrinter::read_configuration(const char *conf)
|
||||
TPrinter::~TPrinter ()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
print_end ();
|
||||
xvt_print_destroy(_print_rcd);
|
||||
xvt_print_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -850,7 +899,6 @@ void TPrinter::setheaderline (int linetoset, const TPrintrow & line)
|
||||
void TPrinter::setfooterline (int linetoset, TPrintrow* line)
|
||||
{
|
||||
_footer.add (line, linetoset);
|
||||
// if (linetoset >= _footersize) _footersize = linetoset+1;
|
||||
}
|
||||
|
||||
void TPrinter::setfooterline (int linetoset, const TPrintrow& line)
|
||||
@ -1195,7 +1243,7 @@ void TPrinter::set()
|
||||
mask.set(MSK_1_FILENAME, _printerfile);
|
||||
mask.set(MSK_1_NPAGES, _ncopies);
|
||||
|
||||
#if XVT_OS != XVT_OS_WIN
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
|
||||
for (i = 0; i < _printers.items (); i++)
|
||||
{
|
||||
@ -1207,19 +1255,20 @@ void TPrinter::set()
|
||||
mask.hide(MSK_1_SIZE);
|
||||
mask.hide(MSK_1_LINES);
|
||||
mask.disable(DLG_SETPRINT);
|
||||
if (!_multiple_copies) mask.hide(MSK_1_NPAGES);
|
||||
if (!_multiple_copies)
|
||||
mask.hide(MSK_1_NPAGES);
|
||||
|
||||
pn1 = "";
|
||||
pn2 = "";
|
||||
|
||||
for (i = 0; i < ((PrinterDef &)_printers[_curprn])._names.items(); i++)
|
||||
{
|
||||
pn1.add(format ("%d", i));
|
||||
pn1.add(i);
|
||||
pn2.add((TString &)((PrinterDef &) _printers[_curprn])._names[i]);
|
||||
}
|
||||
|
||||
((TList_field &)(mask.field (MSK_1_CODES))).replace_items(pn1, pn2);
|
||||
mask.set_handler (MSK_1_PRINTERS, printers_on_key);
|
||||
mask.xvt_win_set_handler (MSK_1_PRINTERS, printers_on_key);
|
||||
if (_printertype == fileprinter)
|
||||
mask.set (MSK_1_TYPE, "1");
|
||||
else if (_printertype == screenvis)
|
||||
@ -1227,15 +1276,15 @@ void TPrinter::set()
|
||||
else
|
||||
mask.set (MSK_1_TYPE, "0");
|
||||
|
||||
mask.set(MSK_1_PRINTERS, format("%d", _curprn));
|
||||
mask.set(MSK_1_CODES, format("%d", _curcode));
|
||||
mask.set(MSK_1_PRINTERS, _curprn));
|
||||
mask.set(MSK_1_CODES, _curcode));
|
||||
KEY k;
|
||||
|
||||
if ((k = mask.run()) == K_ESC)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (k == K_INS) // premuto REGISTRA
|
||||
mask.save();
|
||||
mask.save();
|
||||
|
||||
// get user choices
|
||||
|
||||
@ -1244,44 +1293,44 @@ void TPrinter::set()
|
||||
|
||||
PrinterDef& def = (PrinterDef &) get_description (_curprn);
|
||||
switch (atoi(mask.get (MSK_1_TYPE)))
|
||||
{
|
||||
case 0: // stampante
|
||||
|
||||
_printertype = normprinter;
|
||||
_curcode = atoi (mask.get (MSK_1_CODES));
|
||||
switch (atoi (def._printertype))
|
||||
{
|
||||
case 0: // stampante
|
||||
|
||||
case 0:
|
||||
_printertype = normprinter;
|
||||
_curcode = atoi (mask.get (MSK_1_CODES));
|
||||
switch (atoi (def._printertype))
|
||||
{
|
||||
case 0:
|
||||
_printertype = normprinter;
|
||||
break;
|
||||
case 1:
|
||||
_printertype = localprinter;
|
||||
break;
|
||||
case 2:
|
||||
_printertype = spoolprinter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // file
|
||||
_printertype = fileprinter;
|
||||
_printerfile = mask.get (MSK_1_FILENAME);
|
||||
_curcode = atoi (mask.get (MSK_1_CODES));
|
||||
case 1:
|
||||
_printertype = localprinter;
|
||||
break;
|
||||
case 2: // video
|
||||
|
||||
_printertype = screenvis;
|
||||
_curcode = 0;
|
||||
case 2:
|
||||
_printertype = spoolprinter;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: // file
|
||||
_printertype = fileprinter;
|
||||
_printerfile = mask.get (MSK_1_FILENAME);
|
||||
_curcode = atoi (mask.get (MSK_1_CODES));
|
||||
break;
|
||||
case 2: // video
|
||||
|
||||
_printertype = screenvis;
|
||||
_curcode = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
_get_windows_printer_names(pn2);
|
||||
char old_default[80];
|
||||
GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default));
|
||||
_get_windows_printer_names(pn2);
|
||||
char old_default[80];
|
||||
GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default));
|
||||
|
||||
for (i = 0; i < pn2.items (); i++)
|
||||
pn1.add(i);
|
||||
for (i = 0; i < pn2.items (); i++)
|
||||
pn1.add(i);
|
||||
|
||||
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
|
||||
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
|
||||
@ -1294,11 +1343,11 @@ void TPrinter::set()
|
||||
mask.set(MSK_1_LINES, _lines_per_inch);
|
||||
|
||||
if (_printertype == fileprinter)
|
||||
mask.set (MSK_1_TYPE, "1");
|
||||
mask.set (MSK_1_TYPE, "1");
|
||||
else if (_printertype == screenvis)
|
||||
mask.set (MSK_1_TYPE, "2");
|
||||
mask.set (MSK_1_TYPE, "2");
|
||||
else
|
||||
mask.set (MSK_1_TYPE, "0");
|
||||
mask.set (MSK_1_TYPE, "0");
|
||||
|
||||
mask.set_handler (MSK_1_PRINTERS, set_windows_print_device);
|
||||
|
||||
@ -1306,91 +1355,79 @@ void TPrinter::set()
|
||||
int oldprn = _curprn;
|
||||
|
||||
while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS)
|
||||
{
|
||||
if (k == DLG_SETPRINT)
|
||||
{
|
||||
if (k == DLG_SETPRINT)
|
||||
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd
|
||||
if (xvt_dm_post_page_setup(get_printrcd()))
|
||||
{
|
||||
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd
|
||||
if (_print_rcd != NULL)
|
||||
{
|
||||
if (page_setup_dlg(_print_rcd))
|
||||
{
|
||||
// see if user has changed printer
|
||||
// determine index of currently selected printer
|
||||
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
|
||||
// if (_print_rcd != NULL)
|
||||
// free_print_rcd (_print_rcd);
|
||||
// _print_rcd = get_print_rcd(&_print_rcd_size);
|
||||
for (i = 0; i < pn2.items(); i++)
|
||||
if (strcmp((const char *)(_print_rcd + 4), pn2.get(i)) == 0)
|
||||
{
|
||||
_curprn = i;
|
||||
break;
|
||||
}
|
||||
|
||||
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
|
||||
// see if user has changed printer
|
||||
// determine index of currently selected printer
|
||||
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
|
||||
|
||||
const char* name = (const char *)(_print_rcd + 4);
|
||||
_curprn = pn2.get_pos(name);
|
||||
CHECKS(_curprn >= 0, "Can't find printer ", name);
|
||||
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
|
||||
|
||||
set_win_formlen();
|
||||
}
|
||||
mask.set_focus();
|
||||
}
|
||||
else
|
||||
beep ();
|
||||
set_win_formlen(); // Update dimensions
|
||||
}
|
||||
else
|
||||
beep ();
|
||||
}
|
||||
}
|
||||
|
||||
_curprn = atoi(mask.get(MSK_1_PRINTERS));
|
||||
_curprn = atoi(mask.get(MSK_1_PRINTERS));
|
||||
|
||||
if (k == K_INS)
|
||||
{
|
||||
// tutto resta com'e'
|
||||
mask.save ();
|
||||
TConfig cnf (CONFIG_GENERAL, "Stampa");
|
||||
cnf.set("Size", mask.get(MSK_1_SIZE));
|
||||
cnf.set("Lines",mask.get(MSK_1_LINES));
|
||||
}
|
||||
if (k == K_ESC || k == K_ENTER)
|
||||
{
|
||||
// riaggiusta stampante default windows come prima
|
||||
// curprn e rcd sono quelle di prima
|
||||
main_app().enable_menu_item(M_FILE_PG_SETUP);
|
||||
WriteProfileString("windows","device", old_default);
|
||||
}
|
||||
if (k == K_ESC)
|
||||
{
|
||||
if (_print_rcd != NULL)
|
||||
free_print_rcd (_print_rcd);
|
||||
_curprn = oldprn;
|
||||
_print_rcd = get_print_rcd(&_print_rcd_size);
|
||||
set_win_formlen();
|
||||
return;
|
||||
}
|
||||
|
||||
_ncopies = atoi (mask.get (MSK_1_NPAGES));
|
||||
|
||||
switch (atoi (mask.get (MSK_1_TYPE)))
|
||||
{
|
||||
case 0: // stampante
|
||||
_printertype = winprinter;
|
||||
break;
|
||||
case 1: // file
|
||||
_printertype = fileprinter;
|
||||
_printerfile = mask.get (MSK_1_FILENAME);
|
||||
_curcode = atoi (mask.get (MSK_1_CODES));
|
||||
break;
|
||||
case 2: // video
|
||||
_printertype = screenvis;
|
||||
_curcode = 0;
|
||||
break;
|
||||
}
|
||||
if (k == K_INS)
|
||||
{
|
||||
// tutto resta com'e'
|
||||
mask.save ();
|
||||
TConfig cnf (CONFIG_GENERAL, "Print");
|
||||
cnf.set("Size", mask.get(MSK_1_SIZE), "12");
|
||||
cnf.set("Lines", mask.get(MSK_1_LINES), "6");
|
||||
}
|
||||
if (k == K_ESC || k == K_ENTER)
|
||||
{
|
||||
// riaggiusta stampante default windows come prima
|
||||
// curprn e rcd sono quelle di prima
|
||||
main_app().enable_menu_item(M_FILE_PG_SETUP);
|
||||
WriteProfileString("windows","device", old_default);
|
||||
}
|
||||
if (k == K_ESC)
|
||||
{
|
||||
_curprn = oldprn;
|
||||
set_printrcd();
|
||||
set_win_formlen();
|
||||
return;
|
||||
}
|
||||
|
||||
_isgraphics = mask.get_bool (MSK_1_ISGRAPHICS);
|
||||
_ch_size = atoi (mask.get (MSK_1_SIZE));
|
||||
_lines_per_inch = atoi (mask.get (MSK_1_LINES));
|
||||
set_win_formlen ();
|
||||
_ncopies = atoi (mask.get (MSK_1_NPAGES));
|
||||
|
||||
switch (atoi (mask.get (MSK_1_TYPE)))
|
||||
{
|
||||
case 0: // stampante
|
||||
_printertype = winprinter;
|
||||
break;
|
||||
case 1: // file
|
||||
_printertype = fileprinter;
|
||||
_printerfile = mask.get (MSK_1_FILENAME);
|
||||
_curcode = atoi (mask.get (MSK_1_CODES));
|
||||
break;
|
||||
case 2: // video
|
||||
_printertype = screenvis;
|
||||
_curcode = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
_isgraphics = mask.get_bool (MSK_1_ISGRAPHICS);
|
||||
_ch_size = mask.get_int (MSK_1_SIZE);
|
||||
_lines_per_inch = mask.get_int (MSK_1_LINES);
|
||||
set_win_formlen ();
|
||||
|
||||
#endif
|
||||
|
||||
main_app().enable_menu_item (M_FILE_PG_SETUP);
|
||||
main_app().enable_menu_item (M_FILE_PG_SETUP);
|
||||
}
|
||||
|
||||
|
||||
@ -1426,11 +1463,20 @@ void TPrinter::close ()
|
||||
if (_printertype == screenvis)
|
||||
{
|
||||
_vf->close_print();
|
||||
_vf->run ();
|
||||
const KEY key = _vf->run ();
|
||||
if (_vf->is_open ()) _vf->close_modal ();
|
||||
delete _vf;
|
||||
freeze (FALSE);
|
||||
_vf = NULL;
|
||||
|
||||
if (key == K_CTRL+'S')
|
||||
{
|
||||
_isopen = FALSE;
|
||||
_currentrow = _currentpage = 1;
|
||||
_printertype = winprinter;
|
||||
main_app().print();
|
||||
_printertype = screenvis;
|
||||
}
|
||||
}
|
||||
else if (_printertype == export)
|
||||
{
|
||||
@ -1451,7 +1497,7 @@ else if (_printertype == winprinter && _txt.lines() > 0L)
|
||||
PrintWhat._txt = &_txt;
|
||||
PrintWhat._graphics = _isgraphics;
|
||||
PrintWhat._charsize = _ch_size;
|
||||
start_print_thread (start_winprint, (long) (&PrintWhat));
|
||||
xvt_print_start_thread (start_winprint, (long) (&PrintWhat));
|
||||
}
|
||||
else if (_printertype == fileprinter)
|
||||
{
|
||||
@ -1540,7 +1586,7 @@ bool TFile_printer::genera_dischetti ()
|
||||
// e eventualmente lo formatta
|
||||
if (_formatta)
|
||||
{
|
||||
TString dep (30);
|
||||
TString80 dep;
|
||||
if (_label != NULL)
|
||||
dep << FORMAT_COMMAND << " " << "/v:" << _label << " " << _drive;
|
||||
else
|
||||
|
@ -5,22 +5,15 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef __VISWIN_H
|
||||
#include <viswin.h>
|
||||
#endif
|
||||
|
||||
#ifndef __DATE_H
|
||||
#include <date.h>
|
||||
#endif
|
||||
|
||||
#ifndef __PRINTWIN_H
|
||||
#include <printwin.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TEXT_H
|
||||
#include <text.h>
|
||||
#endif
|
||||
|
||||
|
||||
// @DPUB
|
||||
enum TPrintstyle {
|
||||
normalstyle = 0,
|
||||
@ -116,6 +109,8 @@ typedef void (*LINKHANDLER)(int, const char*);
|
||||
// class TPrinter : public TObject
|
||||
// @END
|
||||
|
||||
class TViswin;
|
||||
|
||||
class TPrinter : public TObject
|
||||
{
|
||||
// @DPROT
|
||||
@ -134,20 +129,24 @@ class TPrinter : public TObject
|
||||
TArray _printers; // printers descriptions
|
||||
int _curprn; // current printer index
|
||||
int _curcode; // current printer index
|
||||
int _formlen; // length of the logic page
|
||||
int _currentrow; // next row to print
|
||||
int _ch_size;
|
||||
word _currentpage; // logic page containing _currentrow
|
||||
word _frompage; // first page to print (normally 0)
|
||||
word _topage; // last page to print (normally = USHRT_MAX)
|
||||
bool _hwformfeed; // if TRUE a ff will be printed after any footer
|
||||
int _formlen; // length of the logic page
|
||||
int _formwidth; // size of the logic page
|
||||
int _currentrow; // next row to print
|
||||
int _ch_size; // Font height
|
||||
word _currentpage; // logic page containing _currentrow
|
||||
word _frompage; // first page to print (normally 0)
|
||||
word _topage; // last page to print (normally = USHRT_MAX)
|
||||
bool _hwformfeed; // if TRUE a ff will be printed after any footer
|
||||
TPrtype _printertype; // specifies the kind of output the user wants
|
||||
bool _isopen; // printer open
|
||||
TDate _date; // printing date
|
||||
bool _isopen; // printer open
|
||||
TDate _date; // printing date
|
||||
TFilename _printerfile; // filename for printing on file
|
||||
TArray _linksdescr;
|
||||
bool _multiple_link; //
|
||||
TArray _background;
|
||||
|
||||
TString_array _background;
|
||||
TString_array _image_names;
|
||||
|
||||
const char* _bg_desc;
|
||||
TToken_string _printer_names;
|
||||
bool _isgraphics;
|
||||
@ -189,8 +188,8 @@ public:
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
static BOOLEAN XVT_CALLCONV1 start_winprint(long);
|
||||
|
||||
#endif
|
||||
|
||||
void set_config_file (const char * ffile) { _config = ffile ; }
|
||||
void set_from_page (word from) { _frompage = from; }
|
||||
void set_to_page (word to) { _topage = to; }
|
||||
@ -201,14 +200,15 @@ public:
|
||||
// che servizio e'?
|
||||
void parse_background(const char* bgdesc, TArray& bg);
|
||||
|
||||
int descriptions()
|
||||
{ return _printers.items(); }
|
||||
const PrinterDef& get_description(word i) const
|
||||
{ return (const PrinterDef&) _printers[i]; }
|
||||
int descriptions() { return _printers.items(); }
|
||||
const PrinterDef& get_description(word i) const { return (const PrinterDef&) _printers[i]; }
|
||||
|
||||
virtual const char* class_name() const;
|
||||
virtual word class_id() const;
|
||||
|
||||
int formlen () const { return _formlen; }
|
||||
int formwidth () const { return _formwidth; }
|
||||
|
||||
word frompage () const { return _frompage; }
|
||||
word topage () const { return _topage; }
|
||||
int headersize () const { return _headersize; }
|
||||
@ -227,7 +227,8 @@ public:
|
||||
void resetheader();
|
||||
void resetfooter();
|
||||
void setbackground(const char* bg);
|
||||
TArray* getbgdesc() { return &_background; }
|
||||
TString_array& image_names() { return _image_names; }
|
||||
TString_array& getbgdesc() { return _background; }
|
||||
bool frozen() { return _frozen; }
|
||||
void freeze(bool b = TRUE) { _frozen = b; }
|
||||
int n_copies() { return _ncopies; }
|
||||
@ -275,18 +276,17 @@ public:
|
||||
word rows() const { return _formlen-_headersize-_footersize; }
|
||||
word rows_left() const;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
PRINT_RCD* get_printrcd() { return _print_rcd; }
|
||||
void set_printrcd(PRINT_RCD* p) { _print_rcd = p; }
|
||||
int& get_printrcdsize() { return _print_rcd_size; }
|
||||
void set_win_formlen();
|
||||
void set_printrcd();
|
||||
PRINT_RCD* get_printrcd(int* size = NULL);
|
||||
void set_win_formlen(WINDOW prwin = NULL_WIN);
|
||||
#endif
|
||||
void set_lines_per_inch(int n) { _lines_per_inch = n; }
|
||||
int get_lines_per_inch(int n) { return _lines_per_inch; }
|
||||
int get_vert_offset() { return _vert_offset; }
|
||||
int get_horz_offset() { return _horz_offset; }
|
||||
int get_dots_per_line() { return _dots_per_line; }
|
||||
bool isgraphics() { return _isgraphics; }
|
||||
int get_char_size() { return _ch_size; }
|
||||
void set_lines_per_inch(int n) { _lines_per_inch = n; }
|
||||
int get_lines_per_inch() const { return _lines_per_inch; }
|
||||
int get_vert_offset() const { return _vert_offset; }
|
||||
int get_horz_offset() const { return _horz_offset; }
|
||||
int get_dots_per_line() const { return _dots_per_line; }
|
||||
bool isgraphics() const { return _isgraphics; }
|
||||
int get_char_size() const { return _ch_size; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,20 +1,31 @@
|
||||
#include <applicat.h>
|
||||
#include <printwin.h>
|
||||
#include <xvtility.h>
|
||||
#include <applicat.h>
|
||||
|
||||
static char __spc[] = " "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" "
|
||||
" ";
|
||||
|
||||
#define LEN_SPACES(x) (win_get_text_width(win(),__spc,x))
|
||||
HIDDEN int LEN_SPACES(WINDOW win, int x)
|
||||
{
|
||||
HIDDEN long w = 0L;
|
||||
if (w == 0L)
|
||||
{
|
||||
TString256 spc; spc.spaces(256);
|
||||
w = xvt_dwin_get_text_width(win,(char*)(const char*)spc,256);
|
||||
}
|
||||
const int k = int((w*x) >> 8);
|
||||
|
||||
#ifdef DBG
|
||||
TString256 spc; spc.spaces(x);
|
||||
const int k1 = xvt_dwin_get_text_width(win,(char*)(const char*)spc,x);
|
||||
CHECK(k == k1, "Maguire disagrees");
|
||||
#endif
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
void TPrintwin::paint_background(long j)
|
||||
{
|
||||
_isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
|
||||
if (!_isbackground) return;
|
||||
const bool isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
|
||||
if (!isbackground) return;
|
||||
|
||||
int rw = (int)(j % _formlen);
|
||||
TString& rwd = (TString&)(*_bg)[rw];
|
||||
int cnt = 0; char ch;
|
||||
@ -24,49 +35,88 @@ void TPrintwin::paint_background(long j)
|
||||
char curpat = 'n';
|
||||
char curwid = '1';
|
||||
|
||||
unsigned int x1, x2; PNT b, e;
|
||||
unsigned int x1, y1, x2, y2, id;
|
||||
PNT b, e;
|
||||
|
||||
while (ch = rwd[cnt++])
|
||||
{
|
||||
switch(ch)
|
||||
{
|
||||
case 'v': // verticale intera
|
||||
x1 = (unsigned char)rwd[cnt++]-1;
|
||||
b.h = e.h = LEN_SPACES(x1)+LEN_SPACES(1)/2+_hofs;
|
||||
x1 = (byte)rwd[cnt++]-1;
|
||||
b.h = e.h = LEN_SPACES(win(), x1)+LEN_SPACES(win(), 1)/2+_hofs;
|
||||
b.v = rw * _chary + _vofs; e.v = rw * _chary + _vofs;
|
||||
win_move_to(win(),b);
|
||||
win_draw_line(win(),e);
|
||||
xvt_dwin_draw_set_pos(win(),b);
|
||||
xvt_dwin_draw_line(win(),e);
|
||||
break;
|
||||
case 'o': // verticale pezzo sopra
|
||||
x1 = (unsigned char)rwd[cnt++]-1;
|
||||
b.h = e.h = LEN_SPACES(x1)+LEN_SPACES(1)/2 + _hofs;
|
||||
x1 = (byte)rwd[cnt++]-1;
|
||||
b.h = e.h = LEN_SPACES(win(), x1)+LEN_SPACES(win(), 1)/2 + _hofs;
|
||||
b.v = rw * _chary + _vofs; e.v = rw * _chary - _chary/2 + _vofs;
|
||||
win_move_to(win(),b);
|
||||
win_draw_line(win(),e);
|
||||
xvt_dwin_draw_set_pos(win(),b);
|
||||
xvt_dwin_draw_line(win(),e);
|
||||
break;
|
||||
case 'u': // verticale pezzo sotto
|
||||
x1 = (unsigned char)rwd[cnt++]-1;
|
||||
b.h = e.h = LEN_SPACES(x1)+LEN_SPACES(1)/2 + _hofs;
|
||||
x1 = (byte)rwd[cnt++]-1;
|
||||
b.h = e.h = LEN_SPACES(win(), x1)+LEN_SPACES(win(), 1)/2 + _hofs;
|
||||
b.v = rw*_chary + _chary/2 + _vofs; e.v = rw * _chary + _vofs;
|
||||
win_move_to(win(),b);
|
||||
win_draw_line(win(),e);
|
||||
xvt_dwin_draw_set_pos(win(),b);
|
||||
xvt_dwin_draw_line(win(),e);
|
||||
break;
|
||||
case 'h': // orizzontale intera
|
||||
x1 = (unsigned char)rwd[cnt++]-1;
|
||||
x2 = (unsigned char)rwd[cnt++]-1;
|
||||
x1 = (byte)rwd[cnt++]-1;
|
||||
x2 = (byte)rwd[cnt++]-1;
|
||||
b.v = e.v = rw*_chary + _chary/2 + _vofs;
|
||||
b.h = LEN_SPACES(x1)+_hofs; e.h = LEN_SPACES(x2)+_hofs;
|
||||
win_move_to(win(),b);
|
||||
win_draw_line(win(),e);
|
||||
b.h = LEN_SPACES(win(), x1)+_hofs; e.h = LEN_SPACES(win(), x2)+_hofs;
|
||||
xvt_dwin_draw_set_pos(win(),b);
|
||||
xvt_dwin_draw_line(win(),e);
|
||||
break;
|
||||
case 'r': // orizzontale scorciata agli estremi
|
||||
x1 = (unsigned char)rwd[cnt++]-1;
|
||||
x2 = (unsigned char)rwd[cnt++]-1;
|
||||
x1 = (byte)rwd[cnt++]-1;
|
||||
x2 = (byte)rwd[cnt++]-1;
|
||||
b.v = e.v = rw*_chary + _chary/2 + _vofs;
|
||||
b.h = LEN_SPACES(x1)+LEN_SPACES(1)/2 + _hofs;
|
||||
e.h = LEN_SPACES(x2)+LEN_SPACES(1)/2+_hofs;
|
||||
win_move_to(win(),b);
|
||||
win_draw_line(win(),e);
|
||||
b.h = LEN_SPACES(win(), x1)+LEN_SPACES(win(), 1)/2 + _hofs;
|
||||
e.h = LEN_SPACES(win(), x2)+LEN_SPACES(win(), 1)/2+_hofs;
|
||||
xvt_dwin_draw_set_pos(win(),b);
|
||||
xvt_dwin_draw_line(win(),e);
|
||||
break;
|
||||
case 'i':
|
||||
id = (byte)(rwd[cnt++])-1; // Numero immagine
|
||||
y1 = (byte)(rwd[cnt++])-1; // Riga sorgente
|
||||
x1 = (byte)(rwd[cnt++])-1; // Colonna destinazione
|
||||
x2 = (byte)(rwd[cnt++]); // Larghezza destinazione (in caratteri)
|
||||
y2 = (byte)(rwd[cnt++]); // Altezza destinazione (in caratteri)
|
||||
if (id >= 0)
|
||||
{
|
||||
const short width = LEN_SPACES(win(), x2); // Larghezza in pixel
|
||||
|
||||
TImage* i = (TImage*)_images.objptr(id);
|
||||
if (i == NULL)
|
||||
{
|
||||
const TString_array& a = main_app().printer().image_names();
|
||||
const TImage src(a.row(id));
|
||||
if (src.ok())
|
||||
{
|
||||
i = new TImage(src, width, _chary*y2);
|
||||
_images.add(i, id);
|
||||
}
|
||||
}
|
||||
|
||||
if (i && i->ok())
|
||||
{
|
||||
RCT src; xvt_rect_set(&src, 0, int(_chary*y1),
|
||||
width, min(int(_chary*(y1+1)), i->height()));
|
||||
if (src.top < i->height())
|
||||
{
|
||||
PNT p;
|
||||
p.h = LEN_SPACES(win(), x1) + _hofs;
|
||||
p.v = _chary*rw + _vofs;
|
||||
RCT dst = src; xvt_rect_set_pos(&dst, p);
|
||||
i->draw(win(), dst, src);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
curwid = rwd[cnt++];
|
||||
set_pen(trans_color(curcol), curwid- '0', trans_brush(curpat),
|
||||
@ -97,15 +147,17 @@ void TPrintwin::paint_background(long j)
|
||||
|
||||
void TPrintwin::paint_row(long j)
|
||||
{
|
||||
static char line[257];
|
||||
char line[257];
|
||||
|
||||
const char* cp; int pos = 0;
|
||||
int pixpos = 0;
|
||||
int row = (int)(j % _formlen);
|
||||
|
||||
paint_background(j);
|
||||
|
||||
strcpy(line,_txt.line(j));
|
||||
|
||||
_txt.read_line(j);
|
||||
|
||||
while(cp = _txt.piece())
|
||||
{
|
||||
pos += strlen(cp);
|
||||
@ -113,36 +165,25 @@ void TPrintwin::paint_row(long j)
|
||||
int st = _txt.get_style();
|
||||
long bg = trans_color(_txt.get_background());
|
||||
long fg = trans_color(_txt.get_foreground());
|
||||
set_font(FF_FIXED, st & 0x000f, _char_size);
|
||||
set_font(XVT_FFN_FIXED, st, _char_size);
|
||||
set_color(fg,bg);
|
||||
#else
|
||||
set_color(COLOR_BLACK, COLOR_WHITE);
|
||||
#endif
|
||||
win_draw_text(win(), pixpos+_hofs, row*_chary + _chary + _vofs - _descent,
|
||||
(char *)cp, -1);
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (st & underlined)
|
||||
{
|
||||
PNT b, e;
|
||||
|
||||
set_pen(COLOR_BLACK);
|
||||
b.h = pixpos + _hofs; b.v = row*_chary + _chary + _vofs;
|
||||
e.h = (pixpos+win_get_text_width(win(), line, pos)) + _hofs; e.v = b.v;
|
||||
win_move_to (win(),b);
|
||||
win_draw_line(win(),e);
|
||||
}
|
||||
#endif
|
||||
pixpos = win_get_text_width(win(), line, pos);
|
||||
xvt_dwin_draw_text(win(),
|
||||
pixpos + _hofs,
|
||||
row*_chary + _chary - _descent + _vofs,
|
||||
(char *)cp, -1);
|
||||
pixpos = xvt_dwin_get_text_width(win(), line, pos);
|
||||
}
|
||||
paint_background(j);
|
||||
}
|
||||
|
||||
|
||||
bool TPrintwin::print_band(int page, RCT& r)
|
||||
{
|
||||
int j = page*_formlen;
|
||||
int rows = (r.bottom - r.top) / _chary;
|
||||
int top = r.top / _chary;
|
||||
const int j = page * _formlen;
|
||||
const int rows = (r.bottom - r.top) / _chary;
|
||||
const int top = r.top / _chary;
|
||||
|
||||
for (int k = top; k < top+rows; k++)
|
||||
{
|
||||
@ -162,45 +203,55 @@ bool TPrintwin::do_print()
|
||||
|
||||
while (ok && !_aborted)
|
||||
{
|
||||
_aborted = !(bool)start_page(_printrcd);
|
||||
while (!_aborted && ok && (rct = next_band()) != NULL)
|
||||
_aborted = !(bool)xvt_print_open_page(_printrcd);
|
||||
while (!_aborted && ok && (rct = xvt_print_get_next_band()) != NULL)
|
||||
ok = print_band(page, *rct);
|
||||
finish_page(_printrcd);
|
||||
xvt_print_close_page(_printrcd);
|
||||
page++;
|
||||
}
|
||||
return !_aborted;
|
||||
}
|
||||
|
||||
|
||||
TPrintwin::TPrintwin(TTextfile& txt)
|
||||
: _txt(txt), _inited(FALSE), _aborted(FALSE)
|
||||
{
|
||||
TPrinter& p = main_app().printer();
|
||||
|
||||
_printrcd = p.get_printrcd();
|
||||
|
||||
WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title());
|
||||
set_win(prwin);
|
||||
|
||||
_char_size = p.get_char_size();
|
||||
set_font(XVT_FFN_FIXED, XVT_FS_NONE, _char_size);
|
||||
|
||||
#if XVT_OS != XVT_OS_SCOUNIX
|
||||
p.set_win_formlen(prwin); // Calcola offset e altre misure pagina
|
||||
#endif
|
||||
|
||||
_inited = TRUE;
|
||||
if (prwin != NULL_WIN)
|
||||
{
|
||||
xvt_dwin_get_font_metrics(prwin, &_lead, &_ascent, &_descent);
|
||||
|
||||
_bg = &p.getbgdesc();
|
||||
|
||||
_chary = p.get_dots_per_line();
|
||||
_formlen = p.formlen();
|
||||
_formwidth = p.formwidth();
|
||||
_hofs = p.get_horz_offset();
|
||||
_vofs = p.get_vert_offset();
|
||||
}
|
||||
else _aborted = TRUE;
|
||||
}
|
||||
|
||||
|
||||
TPrintwin::~TPrintwin()
|
||||
{
|
||||
if (_inited && win() != NULL_WIN) close_print_window(win(), _printrcd);
|
||||
if (_inited && win() != NULL_WIN)
|
||||
xvt_vobj_destroy(win());
|
||||
set_win(NULL_WIN);
|
||||
}
|
||||
|
||||
|
||||
TPrintwin::TPrintwin(PRINT_RCD* p, TTextfile& txt, int chsz) :
|
||||
_printrcd(p), _aborted(FALSE), _txt(txt), _char_size(chsz), _inited(FALSE)
|
||||
{
|
||||
WINDOW w = new_print_window(_printrcd, (char*)(const char*)main_app().title());
|
||||
set_win(w);
|
||||
_inited = TRUE;
|
||||
if (w != NULL_WIN)
|
||||
{
|
||||
_bg = main_app().printer().getbgdesc();
|
||||
_isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
|
||||
_formlen = main_app().printer().formlen();
|
||||
|
||||
set_font(FF_SYSTEM,0,_char_size);
|
||||
|
||||
win_get_font_metrics(win(), &_lead, &_ascent, &_descent);
|
||||
|
||||
_chary = main_app().printer().get_dots_per_line();
|
||||
|
||||
RCT rct; get_client_rect(win(),&rct);
|
||||
|
||||
_vofs = main_app().printer().get_vert_offset();
|
||||
_hofs = (rct.right - rct.left) % LEN_SPACES(1);
|
||||
}
|
||||
else _aborted = TRUE;
|
||||
}
|
||||
|
@ -17,13 +17,14 @@ class TPrintwin : public TWindow
|
||||
{
|
||||
|
||||
bool _aborted;
|
||||
bool _isbackground;
|
||||
PRINT_RCD* _printrcd;
|
||||
int _formlen;
|
||||
int _formwidth;
|
||||
TArray* _bg;
|
||||
TTextfile& _txt;
|
||||
|
||||
TArray _images;
|
||||
|
||||
int _lead, _ascent, _descent;
|
||||
int _hofs, _vofs;
|
||||
int _chary;
|
||||
@ -39,13 +40,10 @@ public:
|
||||
// check if aborted; also returned by do_print
|
||||
bool aborted() const { return _aborted; }
|
||||
|
||||
// inhibits background printing
|
||||
void print_background(bool b) { _isbackground = b; }
|
||||
|
||||
// starts printing; FALSE if aborted
|
||||
bool do_print();
|
||||
|
||||
TPrintwin(PRINT_RCD* pr, TTextfile& txt, int chsize = 12);
|
||||
TPrintwin(TTextfile& txt);
|
||||
virtual ~TPrintwin();
|
||||
};
|
||||
|
||||
|
@ -1,267 +1,267 @@
|
||||
// $Id: progind.cpp,v 1.3 1994-11-11 18:04:23 guy Exp $
|
||||
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
|
||||
const char* const CANCEL_TEXT = "Annulla";
|
||||
const char* const TITLE_TEXT = "Attesa";
|
||||
|
||||
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||
{
|
||||
word lines = 0;
|
||||
for(const char* t = s.get(0); t; t = s.get())
|
||||
{
|
||||
const word l = strlen(t);
|
||||
if (l > maxlen) maxlen = l;
|
||||
lines++;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
// Certified 70%
|
||||
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
{
|
||||
_cancel = _bar = _text = NULL_WIN;
|
||||
|
||||
_status = 0l;
|
||||
_max = max;
|
||||
if (_max <= 0) _max = 1;
|
||||
_flags = 0x0;
|
||||
|
||||
TToken_string testo(txt, '\n');
|
||||
word maxlen = div;
|
||||
const word lines = measure_text(testo, maxlen);
|
||||
|
||||
int ver = lines+2;
|
||||
|
||||
int hor = maxlen+2; if (hor > 78) hor = 78;
|
||||
|
||||
if (bar)
|
||||
{
|
||||
_bar = ver * CHARY;
|
||||
ver += 3;
|
||||
}
|
||||
ver += cancel ? 3 : 0;
|
||||
|
||||
create(-1, -1, hor, ver, TITLE_TEXT);
|
||||
|
||||
RCT r; r.left = CHARX; r.top = CHARY; r.right = CHARX*(hor-2); r.bottom = r.top + lines*CHARY+4;
|
||||
_text = create_control(WC_TEXT, &r, (char*)txt, win(), CTL_FLAG_CENTER_JUST, 0l, DLG_NULL);
|
||||
|
||||
if (cancel)
|
||||
_cancel = xvt_create_control(WC_PUSHBUTTON, -11, -1, 9, 2,
|
||||
CANCEL_TEXT, win(), 0, 0l, DLG_CANCEL);
|
||||
open_modal();
|
||||
do_events();
|
||||
}
|
||||
|
||||
void TIndwin::set_text(const char* t)
|
||||
{
|
||||
set_title(_text, (char*)t);
|
||||
}
|
||||
|
||||
TIndwin::~TIndwin()
|
||||
{ close_modal(); }
|
||||
|
||||
bool TIndwin::can_be_closed() const
|
||||
{
|
||||
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
||||
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
||||
return ok;
|
||||
}
|
||||
|
||||
KEY TIndwin::check_stop()
|
||||
{
|
||||
KEY k = 0;
|
||||
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
||||
{
|
||||
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
||||
stop_run(k);
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
void TIndwin::update_bar()
|
||||
{
|
||||
if (_status >= _max)
|
||||
{
|
||||
_status = _max;
|
||||
_flags |= IND_FINISHED;
|
||||
}
|
||||
|
||||
const double prc = (double)_status/_max;
|
||||
|
||||
RCT r; get_client_rect(win(), &r);
|
||||
r.left = CHARX; r.right -= CHARX;
|
||||
r.top = (int)_bar;
|
||||
r.bottom = r.top + 3*CHARY;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
r.top += 6;
|
||||
r.bottom -= 6;
|
||||
#endif
|
||||
const int width = r.right - r.left;
|
||||
|
||||
RCT b = r;
|
||||
set_brush(COLOR_BLUE);
|
||||
b.right = b.left + int(width*prc);
|
||||
win_draw_rect(win(), &b);
|
||||
|
||||
set_brush(COLOR_WHITE);
|
||||
b.left = b.right; b.right = r.right;
|
||||
win_draw_rect(win(), &b);
|
||||
|
||||
set_mode(M_XOR);
|
||||
win_set_fore_color(win(), COLOR_BLUE);
|
||||
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
||||
win_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
||||
set_mode(M_COPY);
|
||||
|
||||
check_stop();
|
||||
}
|
||||
|
||||
void TIndwin::update()
|
||||
{
|
||||
if (_bar) update_bar();
|
||||
}
|
||||
|
||||
|
||||
void TIndwin::handler(WINDOW w, EVENT* e)
|
||||
{
|
||||
switch(e->type)
|
||||
{
|
||||
case E_UPDATE:
|
||||
clear_window(w, COLOR_WHITE);
|
||||
update();
|
||||
return;
|
||||
case E_CONTROL:
|
||||
if (e->v.ctl.id == DLG_CANCEL)
|
||||
dispatch_e_char(w, K_ESC);
|
||||
break;
|
||||
case E_CHAR:
|
||||
// allowed only if cancel button is there
|
||||
if (e->v.chr.ch == K_ESC)
|
||||
{
|
||||
if (_cancel)
|
||||
{
|
||||
_flags |= IND_CANCELLED;
|
||||
check_stop();
|
||||
}
|
||||
else return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TWindow::handler(w,e);
|
||||
}
|
||||
|
||||
|
||||
// TProgind --------------------------------------------------------------
|
||||
|
||||
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: TIndwin(max, txt, cancel, bar, div)
|
||||
{}
|
||||
|
||||
// TTimerind ------------------------------------------------------------
|
||||
|
||||
long TTimerind::_timer_id = 0L;
|
||||
|
||||
void TTimerind::handler(WINDOW w, EVENT* e)
|
||||
{
|
||||
switch(e->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
case E_UPDATE:
|
||||
if (_status == 0L)
|
||||
_timer_id = set_timer(w, _interval);
|
||||
break;
|
||||
case E_TIMER:
|
||||
if (e->v.timer.id == _timer_id)
|
||||
{
|
||||
_status += _interval;
|
||||
force_update();
|
||||
set_timer(w, _interval);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TIndwin::handler(w,e);
|
||||
}
|
||||
|
||||
TTimerind::TTimerind(long msec, const char* txt,
|
||||
bool cancel, bool bar, int div, int i) :
|
||||
TIndwin(msec, txt, cancel, bar, div)
|
||||
{
|
||||
_interval = i;
|
||||
_timer_id = 0L;
|
||||
}
|
||||
|
||||
TTimerind::~TTimerind()
|
||||
{ kill_timer(_timer_id); }
|
||||
|
||||
// C-style binding
|
||||
// uses static pointer for single instance of TIndwin
|
||||
|
||||
static TIndwin* __indwin__p = NULL;
|
||||
|
||||
void progind_create(long m, char* t, bool b, bool c, int n)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TProgind(m,t,b,c,n);
|
||||
}
|
||||
|
||||
void progind_set_status(long l)
|
||||
{
|
||||
((TProgind*)__indwin__p)->setstatus(l);
|
||||
}
|
||||
|
||||
void progind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool progind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool progind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void progind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
void timerind_create(long l, char* title, bool bar, bool cancel,
|
||||
int divisions, int interval)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
||||
}
|
||||
|
||||
void timerind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool timerind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool timerind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void timerind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
// $Id: progind.cpp,v 1.4 1995-03-22 09:06:23 guy Exp $
|
||||
|
||||
#include <defmask.h>
|
||||
#include <progind.h>
|
||||
|
||||
const char* const CANCEL_TEXT = "Annulla";
|
||||
const char* const TITLE_TEXT = "Attesa";
|
||||
|
||||
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||
{
|
||||
word lines = 0;
|
||||
for(const char* t = s.get(0); t; t = s.get())
|
||||
{
|
||||
const word l = strlen(t);
|
||||
if (l > maxlen) maxlen = l;
|
||||
lines++;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
// Certified 70%
|
||||
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
{
|
||||
_cancel = _bar = _text = NULL_WIN;
|
||||
|
||||
_status = 0l;
|
||||
_max = max;
|
||||
if (_max <= 0) _max = 1;
|
||||
_flags = 0x0;
|
||||
|
||||
TToken_string testo(txt, '\n');
|
||||
word maxlen = div;
|
||||
const word lines = measure_text(testo, maxlen);
|
||||
|
||||
int ver = lines+2;
|
||||
|
||||
int hor = maxlen+2; if (hor > 78) hor = 78;
|
||||
|
||||
if (bar)
|
||||
{
|
||||
_bar = ver * CHARY;
|
||||
ver += 3;
|
||||
}
|
||||
ver += cancel ? 3 : 0;
|
||||
|
||||
create(-1, -1, hor, ver, TITLE_TEXT);
|
||||
|
||||
RCT r; r.left = CHARX; r.top = CHARY; r.right = CHARX*(hor-2); r.bottom = r.top + lines*CHARY+4;
|
||||
_text = xvt_ctl_create(WC_TEXT, &r, (char*)txt, win(), CTL_FLAG_CENTER_JUST, 0l, DLG_NULL);
|
||||
|
||||
if (cancel)
|
||||
_cancel = xvt_create_control(WC_PUSHBUTTON, -11, -1, 9, 2,
|
||||
CANCEL_TEXT, win(), 0, 0l, DLG_CANCEL);
|
||||
open_modal();
|
||||
do_events();
|
||||
}
|
||||
|
||||
void TIndwin::set_text(const char* t)
|
||||
{
|
||||
xvt_vobj_set_title(_text, (char*)t);
|
||||
}
|
||||
|
||||
TIndwin::~TIndwin()
|
||||
{ close_modal(); }
|
||||
|
||||
bool TIndwin::can_be_closed() const
|
||||
{
|
||||
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
||||
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
||||
return ok;
|
||||
}
|
||||
|
||||
KEY TIndwin::check_stop()
|
||||
{
|
||||
KEY k = 0;
|
||||
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
||||
{
|
||||
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
||||
stop_run(k);
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
void TIndwin::update_bar()
|
||||
{
|
||||
if (_status >= _max)
|
||||
{
|
||||
_status = _max;
|
||||
_flags |= IND_FINISHED;
|
||||
}
|
||||
|
||||
const double prc = (double)_status/_max;
|
||||
|
||||
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
||||
r.left = CHARX; r.right -= CHARX;
|
||||
r.top = (int)_bar;
|
||||
r.bottom = r.top + 3*CHARY;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
r.top += 6;
|
||||
r.bottom -= 6;
|
||||
#endif
|
||||
const int width = r.right - r.left;
|
||||
|
||||
RCT b = r;
|
||||
set_brush(COLOR_BLUE);
|
||||
b.right = b.left + int(width*prc);
|
||||
xvt_dwin_draw_rect(win(), &b);
|
||||
|
||||
set_brush(COLOR_WHITE);
|
||||
b.left = b.right; b.right = r.right;
|
||||
xvt_dwin_draw_rect(win(), &b);
|
||||
|
||||
set_mode(M_XOR);
|
||||
xvt_dwin_set_fore_color(win(), COLOR_BLUE);
|
||||
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
||||
xvt_dwin_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
||||
set_mode(M_COPY);
|
||||
|
||||
check_stop();
|
||||
}
|
||||
|
||||
void TIndwin::update()
|
||||
{
|
||||
if (_bar) update_bar();
|
||||
}
|
||||
|
||||
|
||||
void TIndwin::handler(WINDOW w, EVENT* e)
|
||||
{
|
||||
switch(e->type)
|
||||
{
|
||||
case E_UPDATE:
|
||||
xvt_dwin_clear(w, COLOR_WHITE);
|
||||
update();
|
||||
return;
|
||||
case E_CONTROL:
|
||||
if (e->v.ctl.id == DLG_CANCEL)
|
||||
dispatch_e_char(w, K_ESC);
|
||||
break;
|
||||
case E_CHAR:
|
||||
// allowed only if cancel button is there
|
||||
if (e->v.chr.ch == K_ESC)
|
||||
{
|
||||
if (_cancel)
|
||||
{
|
||||
_flags |= IND_CANCELLED;
|
||||
check_stop();
|
||||
}
|
||||
else return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TWindow::handler(w,e);
|
||||
}
|
||||
|
||||
|
||||
// TProgind --------------------------------------------------------------
|
||||
|
||||
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||
: TIndwin(max, txt, cancel, bar, div)
|
||||
{}
|
||||
|
||||
// TTimerind ------------------------------------------------------------
|
||||
|
||||
long TTimerind::_timer_id = 0L;
|
||||
|
||||
void TTimerind::handler(WINDOW w, EVENT* e)
|
||||
{
|
||||
switch(e->type)
|
||||
{
|
||||
case E_CREATE:
|
||||
case E_UPDATE:
|
||||
if (_status == 0L)
|
||||
_timer_id = xvt_timer_create(w, _interval);
|
||||
break;
|
||||
case E_TIMER:
|
||||
if (e->v.timer.id == _timer_id)
|
||||
{
|
||||
_status += _interval;
|
||||
force_update();
|
||||
xvt_timer_create(w, _interval);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
TIndwin::handler(w,e);
|
||||
}
|
||||
|
||||
TTimerind::TTimerind(long msec, const char* txt,
|
||||
bool cancel, bool bar, int div, int i) :
|
||||
TIndwin(msec, txt, cancel, bar, div)
|
||||
{
|
||||
_interval = i;
|
||||
_timer_id = 0L;
|
||||
}
|
||||
|
||||
TTimerind::~TTimerind()
|
||||
{ xvt_timer_destroy(_timer_id); }
|
||||
|
||||
// C-style binding
|
||||
// uses static pointer for single instance of TIndwin
|
||||
|
||||
static TIndwin* __indwin__p = NULL;
|
||||
|
||||
void progind_create(long m, char* t, bool b, bool c, int n)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TProgind(m,t,b,c,n);
|
||||
}
|
||||
|
||||
void progind_set_status(long l)
|
||||
{
|
||||
((TProgind*)__indwin__p)->setstatus(l);
|
||||
}
|
||||
|
||||
void progind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool progind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool progind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void progind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
void timerind_create(long l, char* title, bool bar, bool cancel,
|
||||
int divisions, int interval)
|
||||
{
|
||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
||||
}
|
||||
|
||||
void timerind_cancel()
|
||||
{
|
||||
__indwin__p->cancel();
|
||||
}
|
||||
|
||||
bool timerind_iscancelled()
|
||||
{
|
||||
return __indwin__p->iscancelled();
|
||||
}
|
||||
|
||||
bool timerind_isfinished()
|
||||
{
|
||||
return __indwin__p->isfinished();
|
||||
}
|
||||
|
||||
void timerind_destroy()
|
||||
{
|
||||
delete __indwin__p;
|
||||
__indwin__p = NULL;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relapp.cpp,v 1.48 1995-01-27 18:00:47 guy Exp $
|
||||
// $Id: relapp.cpp,v 1.49 1995-03-22 09:06:25 guy Exp $
|
||||
#include <mailbox.h>
|
||||
#include <sheet.h>
|
||||
#include <urldefid.h>
|
||||
@ -431,7 +431,7 @@ bool TRelation_application::modify_mode()
|
||||
if (err != NOERR)
|
||||
{
|
||||
if (err == _islocked)
|
||||
message_box("I dati sono gia' in uso ad un altro utente");
|
||||
message_box("I dati sono gia' in uso ad un altro programma");
|
||||
else
|
||||
error_box("Impossibile leggere i dati: errore %d", err);
|
||||
query_mode();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relation.cpp,v 1.32 1995-02-10 17:42:31 guy Exp $
|
||||
// $Id: relation.cpp,v 1.33 1995-03-22 09:06:27 guy Exp $
|
||||
// relation.cpp
|
||||
// fv 12/8/93
|
||||
// relation class for isam files
|
||||
@ -163,7 +163,7 @@ void TRelationdef::print_on(TToken_string& out) const
|
||||
|
||||
out = "";
|
||||
print_name(out, f);
|
||||
out.add(prefhndl->description(f.name()));
|
||||
out.add(prefix().description(f.name()));
|
||||
out << '|';
|
||||
|
||||
if (_numto > 0)
|
||||
@ -259,7 +259,7 @@ void TRelation::print_on(TArray& a) const
|
||||
const TLocalisamfile& f = file();
|
||||
TToken_string s(128);
|
||||
print_name(s, f);
|
||||
s.add(prefhndl->description(f.name()));
|
||||
s.add(prefix().description(f.name()));
|
||||
s.add("");
|
||||
s.add(f.getkey());
|
||||
s.add(" | ");
|
||||
|
@ -1,17 +1,18 @@
|
||||
#define SCAD_ANNO "ANNO"
|
||||
#define SCAD_NUMPART "NUMPART"
|
||||
#define SCAD_NRATA "NRATA"
|
||||
#define SCAD_CODPAG "CODPAG"
|
||||
#define SCAD_TIPOPAG "TIPOPAG"
|
||||
#define SCAD_ULTCLASS "ULTCLASS"
|
||||
#define SCAD_IMPORTOVAL "IMPORTOVAL"
|
||||
#define SCAD_DATASCAD "DATASCAD"
|
||||
#define SCAD_TIPOCF "TIPOCF"
|
||||
#define SCAD_GRUPPO "GRUPPO"
|
||||
#define SCAD_CONTO "CONTO"
|
||||
#define SCAD_SOTTOCONTO "SOTTOCONTO"
|
||||
#define SCAD_NSOLL "NSOLL"
|
||||
#define SCAD_DATASOLL "DATASOLL"
|
||||
#define SCAD_GGRIT "GGRIT"
|
||||
#define SCAD_PAGATA "PAGATA"
|
||||
#define SCAD_IMPORTOPAG "IMPORTOPAG"
|
||||
#define SCAD_ANNO "ANNO"
|
||||
#define SCAD_NUMPART "NUMPART"
|
||||
#define SCAD_NRATA "NRATA"
|
||||
#define SCAD_CODPAG "CODPAG"
|
||||
#define SCAD_TIPOPAG "TIPOPAG"
|
||||
#define SCAD_ULTCLASS "ULTCLASS"
|
||||
#define SCAD_IMPORTO "IMPORTO"
|
||||
#define SCAD_IMPORTOVAL "IMPORTOVAL"
|
||||
#define SCAD_DATASCAD "DATASCAD"
|
||||
#define SCAD_TIPOCF "TIPOCF"
|
||||
#define SCAD_GRUPPO "GRUPPO"
|
||||
#define SCAD_CONTO "CONTO"
|
||||
#define SCAD_SOTTOCONTO "SOTTOCONTO"
|
||||
#define SCAD_NSOLL "NSOLL"
|
||||
#define SCAD_DATASOLL "DATASOLL"
|
||||
#define SCAD_GGRIT "GGRIT"
|
||||
#define SCAD_PAGATA "PAGATA"
|
||||
#define SCAD_IMPORTOPAG "IMPORTOPAG"
|
||||
|
@ -44,7 +44,7 @@ TSheet::TSheet(short x, short y, short dx, short dy,
|
||||
_size[_columns] = item.len();
|
||||
_type[_columns] = '\0';
|
||||
}
|
||||
|
||||
|
||||
item.trim();
|
||||
new_head.add(item);
|
||||
}
|
||||
@ -65,7 +65,7 @@ TSheet::TSheet(short x, short y, short dx, short dy,
|
||||
|
||||
if (dx == 0) // Calculates window width
|
||||
{
|
||||
RCT r; get_client_rect(parent, &r);
|
||||
RCT r; xvt_vobj_get_client_rect(parent, &r);
|
||||
dx = r.right/CHARX -6;
|
||||
|
||||
const int larg = width();
|
||||
@ -112,8 +112,8 @@ void TSheet::repos_buttons() const
|
||||
if (buttons == MAX_BUT-1) { buttons++; break; }
|
||||
if (buttons == 0) return;
|
||||
|
||||
RCT wr; get_client_rect(win(), &wr);
|
||||
RCT br; get_client_rect(_button[0], &br);
|
||||
RCT wr; xvt_vobj_get_client_rect(win(), &wr);
|
||||
RCT br; xvt_vobj_get_client_rect(_button[0], &br);
|
||||
|
||||
int space = (wr.right - buttons * br.right) / (buttons+1);
|
||||
if (space < 0) space = 0;
|
||||
@ -122,8 +122,8 @@ void TSheet::repos_buttons() const
|
||||
const int y = wr.bottom - br.bottom-4;
|
||||
for (int b = 0; b < buttons; b++, x += br.right+space)
|
||||
{
|
||||
RCT r; set_rect(&r, x, y, x+br.right, y+br.bottom);
|
||||
move_window(_button[b], &r);
|
||||
RCT r; xvt_rect_set(&r, x, y, x+br.right, y+br.bottom);
|
||||
xvt_vobj_move(_button[b], &r);
|
||||
}
|
||||
}
|
||||
|
||||
@ -458,21 +458,16 @@ bool TSheet::update_row(long n)
|
||||
{
|
||||
const int i = row_to_page(n);
|
||||
if (i >= _page.items()) return FALSE;
|
||||
|
||||
TToken_string& t = (TToken_string&)(_page[i]);
|
||||
TToken_string& t = _page.row(i);
|
||||
t.restart();
|
||||
|
||||
const short y = row_to_win(n);
|
||||
const char* s;
|
||||
|
||||
int x = 0;
|
||||
const bool chk = _checked[n] && !_disabled[n];
|
||||
const bool chk = n >= 0 && _checked[n] && !_disabled[n];
|
||||
bool changed = FALSE;
|
||||
|
||||
if (chk)
|
||||
{
|
||||
changed = TRUE;
|
||||
set_color(MASK_BACK_COLOR, NORMAL_BACK_COLOR);
|
||||
changed = TRUE;
|
||||
}
|
||||
else if (_disabled[n])
|
||||
{
|
||||
@ -480,7 +475,18 @@ bool TSheet::update_row(long n)
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
for (int j = 0; (s = t.get()) != NULL; x += _size[j++]+1)
|
||||
if (n < 0)
|
||||
set_font("", XVT_FS_BOLD, 0);
|
||||
|
||||
int minx = (int)origin().x;
|
||||
int maxx = minx + columns();
|
||||
minx -= 80;
|
||||
|
||||
int x = 0;
|
||||
const int y = row_to_win(n);
|
||||
const char* s;
|
||||
|
||||
for (int j = 0; x < maxx && (s = t.get()) != NULL; x += _size[j++]+1) if (x > minx)
|
||||
{
|
||||
int x1 = x;
|
||||
if (n >= 0)
|
||||
@ -502,12 +508,17 @@ bool TSheet::update_row(long n)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 += (_size[j]-strlen(s)) >> 1; // Centra le testate
|
||||
}
|
||||
|
||||
stringat(x1, y, s);
|
||||
}
|
||||
if (changed)
|
||||
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
|
||||
|
||||
if (n < 0)
|
||||
set_font("", XVT_FS_NONE, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -533,7 +544,7 @@ void TSheet::update()
|
||||
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
|
||||
set_pen(NORMAL_COLOR);
|
||||
set_brush(NORMAL_BACK_COLOR);
|
||||
set_font(FF_FIXED);
|
||||
set_font(XVT_FFN_FIXED);
|
||||
_visible_rows = rows() - reserved_rows() - head_on();
|
||||
}
|
||||
|
||||
@ -562,7 +573,7 @@ void TSheet::update()
|
||||
if (last > items()) last = items();
|
||||
for (long n = first(); n < last; n++) update_row(n);
|
||||
|
||||
if (get_front_window() == win())
|
||||
if (xvt_scr_get_focus_vobj() == win())
|
||||
invert_row(selected());
|
||||
}
|
||||
|
||||
@ -617,6 +628,7 @@ TArray_sheet::TArray_sheet(short x, short y, short dx, short dy,
|
||||
select(0);
|
||||
}
|
||||
|
||||
// Certified 90%
|
||||
bool TArray_sheet::destroy(int i)
|
||||
{
|
||||
uncheck(-1);
|
||||
@ -624,6 +636,8 @@ bool TArray_sheet::destroy(int i)
|
||||
return _data.destroy(i, TRUE);
|
||||
}
|
||||
|
||||
// Copia le righe nella pagina da visualizzare
|
||||
// Certified 100%
|
||||
void TArray_sheet::page_build(long first, byte num)
|
||||
{
|
||||
for (byte i = 0; i < num; i++)
|
||||
@ -662,14 +676,21 @@ TCursor_sheet::TCursor_sheet(TCursor* cursor, const char* fields,
|
||||
_cursor(cursor), _records(cursor->items())
|
||||
{
|
||||
TToken_string fldlst(fields);
|
||||
int campi = 0;
|
||||
for (const char* t = fldlst.get(0); t; t = fldlst.get(), campi++)
|
||||
int campo = 0;
|
||||
for (const char* t = fldlst.get(0); t; t = fldlst.get(), campo++)
|
||||
if (*t > ' ' && *t != '"')
|
||||
{
|
||||
TFieldref fr(t, 0);
|
||||
const TFieldref fr(t, 0);
|
||||
TRecfield* rf = new TRecfield(_cursor->curr(fr.file()),
|
||||
fr.name(), fr.from(), fr.to() - 1);
|
||||
_fields.add(rf, campi);
|
||||
_fields.add(rf, campo);
|
||||
|
||||
const TFieldtypes tipo = rf->type();
|
||||
if (tipo == _intfld || tipo == _longfld || tipo == _realfld)
|
||||
{
|
||||
byte& c = column_flag(campo);
|
||||
if (c == '\0') c = 'R'; // Allinea a destra tutti i campi numerici
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -689,14 +710,14 @@ void TCursor_sheet::page_build(long first, byte rows)
|
||||
TToken_string l(256);
|
||||
|
||||
*_cursor = (TRecnotype)first;
|
||||
for (byte r = 0; r < rows; r++, ++(*_cursor))
|
||||
for (int r = 0; r < rows; r++, ++(*_cursor))
|
||||
{
|
||||
l.cut(0);
|
||||
const int last = _fields.last();
|
||||
for (int i = 0; i <= last; i++)
|
||||
{
|
||||
TRecfield* rf = (TRecfield*)_fields.objptr(i);
|
||||
TFixed_string s(rf ? (const char*)*rf : "");
|
||||
const TRecfield* rf = (TRecfield*)_fields.objptr(i);
|
||||
const char* s = rf ? (const char*)*rf : "";
|
||||
l.add(s);
|
||||
}
|
||||
set_row(l, r);
|
||||
@ -727,23 +748,23 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
|
||||
if (s && s->items() > 2)
|
||||
{
|
||||
int maxlen = 0;
|
||||
SLIST lst = slist_new();
|
||||
SLIST lst = xvt_slist_create();
|
||||
for (const char* item = s->get(0); item; item = s->get())
|
||||
{
|
||||
item = s->get();
|
||||
const int len = strlen(item);
|
||||
if (len > maxlen) maxlen = len;
|
||||
slist_add(lst, (SLIST_ELT)NULL, (char*)item, 0L);
|
||||
xvt_slist_add_at_elt(lst, (SLIST_ELT)NULL, (char*)item, 0L);
|
||||
}
|
||||
|
||||
WINDOW listbox = xvt_create_control(WC_LISTBUTTON, f->size()+3, -3, maxlen+3, 3,
|
||||
"", win(), 0, 0L, DLG_FINDREC);
|
||||
win_list_add(listbox, -1, (char*)lst);
|
||||
slist_dispose(lst);
|
||||
xvt_list_add(listbox, -1, (char*)lst);
|
||||
xvt_slist_destroy(lst);
|
||||
|
||||
TString16 id; id << f->dlg();
|
||||
const int sel = s->get_pos(id) >> 1;
|
||||
win_list_set_sel(listbox, sel, TRUE);
|
||||
xvt_list_set_sel(listbox, sel, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -758,22 +779,22 @@ void TBrowse_sheet::repos_buttons() const
|
||||
{
|
||||
TSheet::repos_buttons(); // Repos toolbar
|
||||
|
||||
RCT wr; get_client_rect(win(), &wr); // Get window size
|
||||
RCT wr; xvt_vobj_get_client_rect(win(), &wr); // Get window size
|
||||
|
||||
int left = CHARX; // left coord of next control to draw
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
const short id = i ? DLG_EDIT : DLG_FINDREC;
|
||||
const WINDOW w = get_ctl_window(win(), id);
|
||||
const WINDOW w = xvt_win_get_ctl(win(), id);
|
||||
if (w != NULL_WIN)
|
||||
{
|
||||
RCT r; get_client_rect(w, &r);
|
||||
RCT r; xvt_vobj_get_client_rect(w, &r);
|
||||
r.left = left;
|
||||
r.top = wr.bottom - 4*CHARY + 4;
|
||||
r.right += r.left;
|
||||
r.bottom += r.top;
|
||||
move_window(w, &r);
|
||||
xvt_vobj_move(w, &r);
|
||||
left = r.right+CHARX; // Increase left coord
|
||||
}
|
||||
}
|
||||
@ -782,7 +803,7 @@ void TBrowse_sheet::repos_buttons() const
|
||||
|
||||
bool TBrowse_sheet::on_key(KEY k)
|
||||
{
|
||||
const WINDOW ctl = get_ctl_window(win(), DLG_EDIT);
|
||||
const WINDOW ctl = xvt_win_get_ctl(win(), DLG_EDIT);
|
||||
const bool alnum = k >= ' ' && k < K_UP;
|
||||
|
||||
if (ctl != NULL_WIN && (alnum || k == K_BACKSPACE || k == K_DEL))
|
||||
@ -804,7 +825,7 @@ bool TBrowse_sheet::on_key(KEY k)
|
||||
}
|
||||
else val.rtrim(1);
|
||||
|
||||
if (corre) set_title(fldwin, (char*)(const char*)val);
|
||||
if (corre) xvt_vobj_set_title(fldwin, (char*)(const char*)val);
|
||||
else field().set_field_data(val);
|
||||
|
||||
((TBrowse*)field().browse())->do_input(FALSE);
|
||||
@ -813,7 +834,7 @@ bool TBrowse_sheet::on_key(KEY k)
|
||||
{
|
||||
beep();
|
||||
val = old;
|
||||
if (corre) set_title(fldwin, (char*)(const char*)val);
|
||||
if (corre) xvt_vobj_set_title(fldwin, (char*)(const char*)val);
|
||||
else field().set_field_data(val);
|
||||
*_cursor = oldsel;
|
||||
}
|
||||
@ -823,14 +844,14 @@ bool TBrowse_sheet::on_key(KEY k)
|
||||
if (ctl != NULL_WIN)
|
||||
{
|
||||
val = corre ? field().get_window_data() : field().get_field_data();
|
||||
set_title(ctl, (char*)(const char*)val);
|
||||
xvt_vobj_set_title(ctl, (char*)(const char*)val);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
field().set("");
|
||||
if (ctl != NULL_WIN) set_title(ctl, "");
|
||||
if (ctl != NULL_WIN) xvt_vobj_set_title(ctl, "");
|
||||
}
|
||||
|
||||
return TSheet::on_key(k);
|
||||
@ -841,11 +862,11 @@ void TBrowse_sheet::handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
if (ep->type == E_CONTROL && ep->v.ctl.id == DLG_FINDREC)
|
||||
{
|
||||
const int what = win_list_get_sel_index(ep->v.ctl.ci.win);
|
||||
const int what = xvt_list_get_sel_index(ep->v.ctl.ci.win);
|
||||
if (what >= 0)
|
||||
stop_run(K_CTRL + what);
|
||||
else
|
||||
set_front_window(win);
|
||||
else
|
||||
set_focus();
|
||||
return;
|
||||
}
|
||||
TCursor_sheet::handler(win, ep);
|
||||
|
@ -86,6 +86,9 @@ public:
|
||||
|
||||
long selected() const { return _curr; }
|
||||
void select(long n);
|
||||
|
||||
byte column_flag(int c) const { return _type[c]; }
|
||||
byte& column_flag(int c) { return _type[c]; }
|
||||
|
||||
bool checked(long n) const { return _checked[n]; }
|
||||
void check(long n, bool on = TRUE);
|
||||
|
@ -19,7 +19,10 @@
|
||||
#define REFKEY "CAMPOKEY"
|
||||
#define VERKEY "ìpÙˆ¬cê<"
|
||||
|
||||
long stdlevel ;
|
||||
HIDDEN long _stdlevel = 0;
|
||||
|
||||
long get_std_level()
|
||||
{ return _stdlevel; }
|
||||
|
||||
int get_serial_number()
|
||||
{
|
||||
@ -33,18 +36,16 @@ int get_serial_number()
|
||||
|
||||
void init_global_vars()
|
||||
{
|
||||
CHECK(prefhndl == NULL, "Can't init global vars two times");
|
||||
prefhndl = new TPrefix;
|
||||
TPrefix& pref = prefix_init();
|
||||
|
||||
// prefhndl->set("DEF");
|
||||
prefhndl->set("");
|
||||
stdlevel = prefhndl->filelevel();
|
||||
pref.set("");
|
||||
_stdlevel = pref.filelevel();
|
||||
|
||||
FileDes d;
|
||||
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
||||
|
||||
long maxfdir = d.EOX;
|
||||
prefhndl->set("DEF");
|
||||
pref.set("DEF");
|
||||
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
||||
if (d.EOD > maxfdir) maxfdir = d.EOD;
|
||||
|
||||
@ -62,7 +63,7 @@ void init_global_vars()
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
const bool muflag = CGetAut(MUAUT);
|
||||
if (SerNo /* && fexist("net.ini") */ && !muflag)
|
||||
if (SerNo && !muflag)
|
||||
fatal_box("Abnormal termination: check protection or serial number\n");
|
||||
#endif
|
||||
}
|
||||
@ -72,11 +73,11 @@ void free_global_vars()
|
||||
#if XVT_OS != XVT_OS_SCOUNIX
|
||||
HL_LOGOUT();
|
||||
#endif
|
||||
if (prefhndl != NULL)
|
||||
if (openf != NULL)
|
||||
{
|
||||
delete openf;
|
||||
delete openrec;
|
||||
delete prefhndl;
|
||||
prefix_destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +89,6 @@ void free_global_vars()
|
||||
|
||||
void* operator new(size_t size)
|
||||
{
|
||||
// void* mem = (void*)xvt_fmalloc(size);
|
||||
void* mem = (void*)malloc(size);
|
||||
if (mem == NULL)
|
||||
fatal_box("Out of memory: can't allocate %u bytes", size);
|
||||
@ -98,7 +98,6 @@ void* operator new(size_t size)
|
||||
void operator delete(void* ptr)
|
||||
{
|
||||
CHECK(ptr, "Can't delete a NULL pointer");
|
||||
// xvt_ffree((char*)ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,17 @@
|
||||
#ifndef __STDTYPES_H
|
||||
#define __STDTYPES_H
|
||||
|
||||
#ifndef XVT_INCL_OS
|
||||
#include <xvt_os.h>
|
||||
#endif
|
||||
|
||||
|
||||
// @M
|
||||
#define pure =0
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#define HIDDEN static near
|
||||
#else
|
||||
#define HIDDEN static
|
||||
#endif
|
||||
|
||||
#define EOL -1
|
||||
#define NOERR 0
|
||||
@ -51,6 +50,7 @@ typedef UINT16 KEY;
|
||||
|
||||
// @FPUB
|
||||
int get_serial_number();
|
||||
long get_std_level();
|
||||
void init_global_vars();
|
||||
void free_global_vars();
|
||||
|
||||
|
@ -4,22 +4,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <strstream.h>
|
||||
|
||||
#ifndef FOXPRO
|
||||
#include <applicat.h>
|
||||
#endif
|
||||
|
||||
#include <strings.h>
|
||||
#include <prefix.h>
|
||||
#include <utility.h>
|
||||
|
||||
#if XVT_OS==XVT_OS_SCOUNIX
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <direct.h>
|
||||
#include <process.h>
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#include <utility.h>
|
||||
|
||||
class TString512 : public TFixed_string
|
||||
{
|
||||
char _str512[513];
|
||||
@ -318,7 +314,7 @@ const TString& TString::mid(int from, int count) const
|
||||
if (from > l) from = l;
|
||||
if (count < 0) count = l-from;
|
||||
|
||||
spark.strncpy(&_str[from],count);
|
||||
spark.strncpy(&_str[from], count);
|
||||
return spark;
|
||||
}
|
||||
|
||||
@ -637,6 +633,12 @@ TString& TFixed_string::format(const char* fmt, ...)
|
||||
// Filename
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
const char SLASH =
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
'/';
|
||||
#else
|
||||
'\\';
|
||||
#endif
|
||||
|
||||
// Certified 90%
|
||||
const char* TFilename::ext() const
|
||||
@ -660,28 +662,32 @@ void TFilename::ext(const char* e)
|
||||
// Certified 90%
|
||||
const char* TFilename::name() const
|
||||
{
|
||||
const char* d = strrchr(_str, '/');
|
||||
if (d == NULL) d = strrchr(_str, '\\');
|
||||
if (d == NULL) d = strchr(_str, ':');
|
||||
if (d == NULL) d = _str-1;
|
||||
return d+1;
|
||||
for (int i = strlen(_str)-1; i >= 0; i--)
|
||||
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
||||
break;
|
||||
|
||||
return &_str[i+1];
|
||||
}
|
||||
|
||||
// Certified 90%
|
||||
const char* TFilename::path() const
|
||||
{
|
||||
const char* d = strrchr(_str, '/');
|
||||
if (d == NULL) d = strrchr(_str, '\\');
|
||||
if (d == NULL)
|
||||
{
|
||||
d = strchr(_str, ':');
|
||||
if (d != NULL) d++;
|
||||
}
|
||||
if (d == NULL) spark.cut(0);
|
||||
else spark.strncpy(_str, d - _str);
|
||||
{
|
||||
for (int i = strlen(_str)-1; i >= 0; i--)
|
||||
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
||||
break;
|
||||
|
||||
spark.strncpy(_str, i+1);
|
||||
return spark;
|
||||
}
|
||||
|
||||
|
||||
TFilename& TFilename::add(const char* n)
|
||||
{
|
||||
if (not_empty()) *this << SLASH;
|
||||
*this << n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool TFilename::ok() const
|
||||
{
|
||||
const int l = len();
|
||||
@ -745,45 +751,25 @@ const TFilename& TFilename::tempdir()
|
||||
if (!is_not_slash(_str[last]))
|
||||
_tempdir.cut(last);
|
||||
|
||||
int res = 0;
|
||||
bool ok = TRUE;
|
||||
|
||||
_tempdir.lower();
|
||||
if (!fexist(_tempdir))
|
||||
{
|
||||
#if XVT_OS==XVT_OS_SCOUNIX
|
||||
res = mkdir(_tempdir, 0777);
|
||||
#else
|
||||
res = mkdir(_tempdir);
|
||||
#endif
|
||||
}
|
||||
ok = make_dir(_tempdir);
|
||||
|
||||
#ifndef FOXPRO
|
||||
|
||||
if (res == 0)
|
||||
if (ok)
|
||||
{
|
||||
TString16 user(TApplication::user());
|
||||
TString16 user(user());
|
||||
|
||||
user.lower();
|
||||
if (user.not_empty() && _tempdir.find(user) != _tempdir.len() - user.len())
|
||||
#if XVT_OS==XVT_OS_SCOUNIX
|
||||
_tempdir << '/' << user;
|
||||
#else
|
||||
_tempdir << '\\' << user;
|
||||
#endif
|
||||
_tempdir << SLASH << user;
|
||||
_tempdir.lower();
|
||||
if (!fexist(_tempdir))
|
||||
{
|
||||
#if XVT_OS==XVT_OS_SCOUNIX
|
||||
res = mkdir(_tempdir, 0777);
|
||||
#else
|
||||
res = mkdir(_tempdir);
|
||||
#endif
|
||||
}
|
||||
ok = make_dir(_tempdir);
|
||||
}
|
||||
|
||||
#endif /* FOXPRO */
|
||||
|
||||
if (res != 0)
|
||||
if (!ok)
|
||||
fatal_box("Impossibile creare la directory '%s' per i file temporanei", (const char*)_tempdir);
|
||||
|
||||
_tempdir.insert("TMP=", 0);
|
||||
@ -1134,3 +1120,15 @@ int TString_array::add(const TToken_string& s, int n)
|
||||
row(n) = s;
|
||||
return n;
|
||||
}
|
||||
|
||||
int TString_array::find(const char* s, int from) const
|
||||
{
|
||||
int found = -1;
|
||||
for (int i = from; i < items(); i++)
|
||||
if (row(i).compare(s, -1, TRUE) == 0)
|
||||
{
|
||||
found = i;
|
||||
break;
|
||||
}
|
||||
return found;
|
||||
}
|
@ -224,6 +224,8 @@ public:
|
||||
|
||||
const char* ext() const; // Ritorna l'estensione
|
||||
void ext(const char*); // Imposta come estensione la stringa puntata da char*
|
||||
|
||||
TFilename& add(const char* n);
|
||||
|
||||
const char* name() const; // Ritorna il nome del file
|
||||
const char* path() const; // Ritorna il nome del direttorio
|
||||
@ -301,9 +303,13 @@ class TString_array : public TArray
|
||||
{
|
||||
public:
|
||||
TToken_string& row(int n) { return (TToken_string&)operator[](n); }
|
||||
const TToken_string& row(int n) const { return (TToken_string&)operator[](n); }
|
||||
TToken_string* rowptr(int n) { return (TToken_string*)objptr(n); }
|
||||
|
||||
int add(TToken_string* s, int n = -1) { return TArray::add(s, n); }
|
||||
int add(const TToken_string& s, int n = -1);
|
||||
int add(const char* s, int n = -1);
|
||||
int find(const char* s, int from = 0) const;
|
||||
|
||||
TString_array(int size = 8) : TArray(size) {}
|
||||
virtual ~TString_array() {}
|
||||
|
@ -43,12 +43,6 @@ style TTextfile::_trans_style (char ch)
|
||||
case 'u':
|
||||
return underlined;
|
||||
break;
|
||||
case 'o':
|
||||
return overstrike;
|
||||
break;
|
||||
case 'k':
|
||||
return smallcaps;
|
||||
break;
|
||||
default:
|
||||
return normal;
|
||||
break;
|
||||
|
262
include/text.h
262
include/text.h
@ -1,134 +1,128 @@
|
||||
/* actually -*-c++-*- */
|
||||
#ifndef __TEXTFILE_H
|
||||
#define __TEXTFILE_H
|
||||
|
||||
#ifndef __STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ARRAY_H
|
||||
#include <array.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
||||
|
||||
enum direction {up, down, updown};
|
||||
enum style {normal = 0, bold = FS_BOLD, italic = FS_ITALIC, underlined = 0x0004,
|
||||
overstrike = 0x0008, smallcaps = 0x0010};
|
||||
|
||||
class TTextfile: public TObject
|
||||
{
|
||||
enum {DEFAULT_PAGESIZE = 128};
|
||||
|
||||
TArray _page;
|
||||
TBit_array _dirty_lines;
|
||||
long _page_start;
|
||||
long _page_end;
|
||||
long _page_size;
|
||||
long _lines;
|
||||
long _cur_line;
|
||||
TFilename _filename;
|
||||
TFilename _indname;
|
||||
FILE* _index;
|
||||
FILE* _instr;
|
||||
direction _direction;
|
||||
TToken_string _line;
|
||||
long _styles[256];
|
||||
int _item;
|
||||
TArray _hotspots;
|
||||
TArray _spots;
|
||||
bool _dirty;
|
||||
bool _isopen;
|
||||
bool _istemp;
|
||||
bool _accept;
|
||||
|
||||
void _read_page(long line);
|
||||
bool _in_page(long l)
|
||||
{ return l >= _page_start && l < _page_end; }
|
||||
void _save_changes();
|
||||
|
||||
// void _parse_style(long j);
|
||||
style _trans_style(char c);
|
||||
|
||||
public:
|
||||
|
||||
long lines() { return _lines; }
|
||||
bool changed() { return _dirty; }
|
||||
|
||||
// line() ritorna la stringa di caratteri senza formattazione
|
||||
const char* line(long row, long column = 0, int howmuch = -1);
|
||||
// line_formatted() la ritorna, come e' logico attendersi, con
|
||||
// la formattazione
|
||||
const char* line_formatted(long row);
|
||||
// appende una riga al text (con i formati del caso)
|
||||
bool append(const char* l);
|
||||
|
||||
// chide tutti i files per poter copiare o eseguire operazioni
|
||||
// dopo close() non si puo' piu' fare nulla
|
||||
void close();
|
||||
void print();
|
||||
// chiude l'aggiunta di nuove linee
|
||||
void freeze() { _accept = FALSE; }
|
||||
bool frozen() { return !_accept; }
|
||||
|
||||
// per leggere il testo formattato, si fa prima read_line, poi
|
||||
// si prende un pezzo per volta
|
||||
// style() ritorna lo stile (vedi enum) del piece() corrente
|
||||
// se chiamata con parametri ritorna lo stile del carattere alla
|
||||
// posizione data
|
||||
// get_background() e get_foreground() ritornano il suo colore di bg e fg
|
||||
// piece() ritorna il pezzo di linea successivo con stile e colore
|
||||
// invarianti, o NULL quando non ce n'e' piu'
|
||||
// bello, vero?
|
||||
|
||||
void read_line(long j, long b = 0, bool pg = TRUE);
|
||||
const char* piece();
|
||||
int get_style(int pos = -1);
|
||||
char get_background(int pos = -1);
|
||||
char get_foreground(int pos = -1);
|
||||
|
||||
long get_attribute(int pos = -1);
|
||||
|
||||
// ritorna la parola alla posizione indicata
|
||||
const char* word_at(long x, long y);
|
||||
// TBI ritorna il pezzo di testo da x a y
|
||||
// allochera' un altro TText che deve essere disfatto dall'utente
|
||||
TTextfile* section(TPoint& from, TPoint& to) { return this; }
|
||||
const char* name() { return (const char*)_filename; }
|
||||
|
||||
// scrive il testo (non formattato) su file, da punto a punto
|
||||
// (tutto per default)
|
||||
bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL);
|
||||
// disfa tutto e svuota il file
|
||||
void destroy();
|
||||
|
||||
// search and replace (una riga per volta, rispetta i formati)
|
||||
// txt = text to search; pos = int to put the char position in;
|
||||
// from = where to start; down = FALSE == up
|
||||
long search (const char* txt, int& pos, long from = 0,
|
||||
bool down = TRUE, bool casesens = FALSE);
|
||||
// replace txt=txt in line=line at pos=pos for len=len
|
||||
int replace(long line, const char* txt, int pos = 0, int len = -1);
|
||||
|
||||
|
||||
// hypertext cazzuls
|
||||
// le si dice il colore che devono avere i punti selezionabili;
|
||||
// ritorna l'array in cui vengono messi gli hotspots relativi alla
|
||||
// pagina in memoria (come TToken_string con x|y|text)
|
||||
void set_hotspots(char fg, char bg = 'w');
|
||||
TArray& hotspots() { return _spots; }
|
||||
|
||||
TTextfile(const char* file = NULL, int pagesize = DEFAULT_PAGESIZE,
|
||||
direction preferred = updown);
|
||||
virtual ~TTextfile();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* actually -*-c++-*- */
|
||||
#ifndef __TEXTFILE_H
|
||||
#define __TEXTFILE_H
|
||||
|
||||
#ifndef __STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
||||
|
||||
enum direction {up, down, updown};
|
||||
enum style {normal = XVT_FS_NONE, bold = XVT_FS_BOLD, italic = XVT_FS_ITALIC, underlined = XVT_FS_UNDERLINE };
|
||||
|
||||
class TTextfile: public TObject
|
||||
{
|
||||
enum {DEFAULT_PAGESIZE = 128};
|
||||
|
||||
TArray _page;
|
||||
TBit_array _dirty_lines;
|
||||
long _page_start;
|
||||
long _page_end;
|
||||
long _page_size;
|
||||
long _lines;
|
||||
long _cur_line;
|
||||
TFilename _filename;
|
||||
TFilename _indname;
|
||||
FILE* _index;
|
||||
FILE* _instr;
|
||||
direction _direction;
|
||||
TToken_string _line;
|
||||
long _styles[256];
|
||||
int _item;
|
||||
TArray _hotspots;
|
||||
TArray _spots;
|
||||
bool _dirty;
|
||||
bool _isopen;
|
||||
bool _istemp;
|
||||
bool _accept;
|
||||
|
||||
void _read_page(long line);
|
||||
bool _in_page(long l)
|
||||
{ return l >= _page_start && l < _page_end; }
|
||||
void _save_changes();
|
||||
|
||||
// void _parse_style(long j);
|
||||
style _trans_style(char c);
|
||||
|
||||
public:
|
||||
|
||||
long lines() { return _lines; }
|
||||
bool changed() { return _dirty; }
|
||||
|
||||
// line() ritorna la stringa di caratteri senza formattazione
|
||||
const char* line(long row, long column = 0, int howmuch = -1);
|
||||
// line_formatted() la ritorna, come e' logico attendersi, con
|
||||
// la formattazione
|
||||
const char* line_formatted(long row);
|
||||
// appende una riga al text (con i formati del caso)
|
||||
bool append(const char* l);
|
||||
|
||||
// chide tutti i files per poter copiare o eseguire operazioni
|
||||
// dopo close() non si puo' piu' fare nulla
|
||||
void close();
|
||||
void print();
|
||||
// chiude l'aggiunta di nuove linee
|
||||
void freeze() { _accept = FALSE; }
|
||||
bool frozen() { return !_accept; }
|
||||
|
||||
// per leggere il testo formattato, si fa prima read_line, poi
|
||||
// si prende un pezzo per volta
|
||||
// style() ritorna lo stile (vedi enum) del piece() corrente
|
||||
// se chiamata con parametri ritorna lo stile del carattere alla
|
||||
// posizione data
|
||||
// get_background() e get_foreground() ritornano il suo colore di bg e fg
|
||||
// piece() ritorna il pezzo di linea successivo con stile e colore
|
||||
// invarianti, o NULL quando non ce n'e' piu'
|
||||
// bello, vero?
|
||||
|
||||
void read_line(long j, long b = 0, bool pg = TRUE);
|
||||
const char* piece();
|
||||
int get_style(int pos = -1);
|
||||
char get_background(int pos = -1);
|
||||
char get_foreground(int pos = -1);
|
||||
|
||||
long get_attribute(int pos = -1);
|
||||
|
||||
// ritorna la parola alla posizione indicata
|
||||
const char* word_at(long x, long y);
|
||||
// TBI ritorna il pezzo di testo da x a y
|
||||
// allochera' un altro TText che deve essere disfatto dall'utente
|
||||
TTextfile* section(TPoint& from, TPoint& to) { return this; }
|
||||
const char* name() { return (const char*)_filename; }
|
||||
|
||||
// scrive il testo (non formattato) su file, da punto a punto
|
||||
// (tutto per default)
|
||||
bool write(const char* path, TPoint* from = NULL, TPoint* to = NULL);
|
||||
// disfa tutto e svuota il file
|
||||
void destroy();
|
||||
|
||||
// search and replace (una riga per volta, rispetta i formati)
|
||||
// txt = text to search; pos = int to put the char position in;
|
||||
// from = where to start; down = FALSE == up
|
||||
long search (const char* txt, int& pos, long from = 0,
|
||||
bool down = TRUE, bool casesens = FALSE);
|
||||
// replace txt=txt in line=line at pos=pos for len=len
|
||||
int replace(long line, const char* txt, int pos = 0, int len = -1);
|
||||
|
||||
// hypertext cazzuls
|
||||
// le si dice il colore che devono avere i punti selezionabili;
|
||||
// ritorna l'array in cui vengono messi gli hotspots relativi alla
|
||||
// pagina in memoria (come TToken_string con x|y|text)
|
||||
void set_hotspots(char fg, char bg = 'w');
|
||||
TArray& hotspots() { return _spots; }
|
||||
|
||||
TTextfile(const char* file = NULL, int pagesize = DEFAULT_PAGESIZE,
|
||||
direction preferred = updown);
|
||||
virtual ~TTextfile();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
// .MSK Tokens by Guy 21-10-93
|
||||
///////////////////////////////////////////////////////////
|
||||
#include <keys.h>
|
||||
#include <xvtconst.h>
|
||||
|
||||
#define ALIAS AL
|
||||
#define BEGIN BE
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <lffiles.h>
|
||||
#include <defmask.h>
|
||||
#include <keys.h>
|
||||
#include <tokens.h>
|
||||
|
||||
#define FALSE 0
|
||||
|
@ -9,7 +9,6 @@
|
||||
Identificatori (tag) per i menu' e le voci dei menu' ad uso di URL
|
||||
*/
|
||||
#define TASK_MENUBAR 10000
|
||||
#define ALT_MENUBAR 11000
|
||||
|
||||
#define MENU_BAR(i) (10000+i)
|
||||
#define BAR_ITEM(i) (5000+100*i)
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <strings.h>
|
||||
#include <xvt.h>
|
||||
|
||||
#define __UTILITY_CPP
|
||||
#include <utility.h>
|
||||
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
#include <unistd.h>
|
||||
int remove(const char* path)
|
||||
@ -68,6 +68,55 @@ bool fexist(const char* file)
|
||||
}
|
||||
|
||||
|
||||
bool make_dir(const char* dir)
|
||||
{
|
||||
int res =
|
||||
#if XVT_OS==XVT_OS_SCOUNIX
|
||||
mkdir(dir, 0777);
|
||||
#else
|
||||
mkdir(dir);
|
||||
#endif
|
||||
return res == 0;
|
||||
}
|
||||
|
||||
int list_files(TToken_string& filelist)
|
||||
{
|
||||
TFilename dir(filelist.get(0));
|
||||
for (int i = dir.len()-1; i >= 0; i--)
|
||||
if (dir[i] == '/' || dir[i] == '\\') break;
|
||||
|
||||
const TString16 mask(dir.mid(i+1));
|
||||
dir.cut(i > 0 ? i : 0);
|
||||
|
||||
xvt_fsys_save_dir();
|
||||
DIRECTORY directory; xvt_fsys_convert_str_to_dir((char*)(const char*)dir, &directory);
|
||||
BOOLEAN ok = xvt_fsys_set_dir(&directory);
|
||||
if (!ok) fatal_box ("Impossibile entrare in %s", (const char*)dir);
|
||||
|
||||
SLIST files = xvt_fsys_list_files("", (char*)(const char*)mask, FALSE);
|
||||
|
||||
const int count = xvt_slist_count(files);
|
||||
filelist.spaces(count*12);
|
||||
filelist.cut(0);
|
||||
|
||||
for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e))
|
||||
{
|
||||
char* f = xvt_slist_get(files, e, NULL);
|
||||
if (dir.not_empty())
|
||||
{
|
||||
filelist.add(dir);
|
||||
filelist << '/' << f;
|
||||
}
|
||||
else
|
||||
filelist.add(f);
|
||||
}
|
||||
|
||||
xvt_slist_destroy(files);
|
||||
xvt_fsys_restore_dir();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// Best function of the year
|
||||
// Certified 99%
|
||||
char* format(const char* fmt, ...)
|
||||
@ -82,6 +131,8 @@ char* format(const char* fmt, ...)
|
||||
return(__tmp_string);
|
||||
}
|
||||
|
||||
|
||||
// Converte la coppia nome-parametro in una stringa una che identifica il programma
|
||||
const char* cmd2name(const char* argv0, const char* argv1)
|
||||
{
|
||||
TFilename app(argv0);
|
||||
@ -238,9 +289,7 @@ HIDDEN const char * const key = "QSECOFR-";
|
||||
|
||||
const char * encode( const char * data)
|
||||
{
|
||||
const int len = strlen(data);
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
for (int i = 0; data[i]; i++)
|
||||
__tmp_string[i] = data[i] + (i < 8 ? key[i] : data[i - 8]);
|
||||
__tmp_string[i] = '\0';
|
||||
return __tmp_string;
|
||||
@ -248,9 +297,7 @@ const char * encode( const char * data)
|
||||
|
||||
const char * decode( const char * data)
|
||||
{
|
||||
const int len = strlen(data);
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
for (int i = 0; data[i]; i++)
|
||||
__tmp_string[i] = data[i] - (i < 8 ? key[i] : __tmp_string[i - 8]);
|
||||
__tmp_string[i] = '\0';
|
||||
return __tmp_string;
|
||||
@ -260,10 +307,10 @@ const char * decode( const char * data)
|
||||
|
||||
int stricmp(const char* s1, const char* s2)
|
||||
{
|
||||
while (toupper(*s1) == toupper(*s2))
|
||||
if (*s1++ == '\0' && *s2++ == '\0')
|
||||
for(int d = 0 ; (d = toupper(*s1)-toupper(*s2)) == 0; s1++, s2++)
|
||||
if (*s1 == '\0' && *s2 == '\0')
|
||||
return 0;
|
||||
return *s1 - *s2;
|
||||
return d;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef __UTILITY_H
|
||||
#define __UTILITY_H
|
||||
|
||||
#ifndef __STDTYPES_H
|
||||
#include <stdtypes.h>
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
/* @FPUB */
|
||||
@ -12,8 +12,11 @@ int rtoi(const char * roman);
|
||||
const char* itor(int i);
|
||||
bool fcopy(const char* orig, const char* dest, bool append=FALSE);
|
||||
bool fexist(const char* file);
|
||||
const char * encode(const char * data);
|
||||
const char * decode(const char * data);
|
||||
|
||||
bool make_dir(const char* file);
|
||||
int list_files(TToken_string& names);
|
||||
const char * encode(const char* data);
|
||||
const char * decode(const char* data);
|
||||
inline bool is_not_slash(char s) { return s != '\\' && s != '/'; }
|
||||
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <nditte.h>
|
||||
|
||||
|
||||
typedef bool (*VAL_FUNC)(TEdit_field&, KEY k);
|
||||
HIDDEN const TArray* _parms;
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <xvt.h>
|
||||
|
||||
#include <browfile.h>
|
||||
#include <colors.h>
|
||||
#include <config.h>
|
||||
@ -8,18 +10,11 @@
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
#include <viswin.h>
|
||||
|
||||
#include <bagn005.h>
|
||||
|
||||
#ifndef __PRINTER_H
|
||||
typedef void (*LINKHANDLER) (int, const char *);
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
extern "C"
|
||||
{
|
||||
#include <cpb.h>
|
||||
}
|
||||
#endif
|
||||
const char* const PRINT_FONT = XVT_FFN_FIXED;
|
||||
const int PRINT_HEIGHT = 10;
|
||||
|
||||
#define BUTTONROW_SIZE (_showbuts ? 3 : 0)
|
||||
#define X_OFFSET (_rulers ? 6 : 1)
|
||||
@ -33,6 +28,7 @@ extern "C"
|
||||
#define DLG_PRINT_TITLE "~Stampa"
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY)
|
||||
#define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE)
|
||||
#else
|
||||
@ -54,22 +50,38 @@ extern "C"
|
||||
#define CTRL_R (K_CTRL + 'R')
|
||||
|
||||
// vista la mania degli 883, eccoti un po' di concerti di Mozart
|
||||
const long E_ADDLINE = 488L;
|
||||
const long E_ADDLINE_ONSCREEN = 467L;
|
||||
static bool in_update;
|
||||
const long E_ADDLINE = 488L;
|
||||
HIDDEN bool in_update;
|
||||
|
||||
|
||||
int TViswin::tabx(int x) const
|
||||
{
|
||||
HIDDEN long w = 0L;
|
||||
if (w == 0L)
|
||||
{
|
||||
TString256 t; t.spaces(256);
|
||||
w = xvt_dwin_get_text_width(win(), (char*)(const char*)t, 256);
|
||||
}
|
||||
return int((w*x) >> 8);
|
||||
}
|
||||
|
||||
int TViswin::taby(int y) const
|
||||
{
|
||||
return y * CHARY;
|
||||
}
|
||||
|
||||
|
||||
void TViswin::check_menu_item(MENU_TAG item, bool on)
|
||||
{
|
||||
win_menu_check(win(), item, on);
|
||||
win_update_menu_bar(win());
|
||||
xvt_menu_set_item_checked(win(), item, on);
|
||||
xvt_menu_update(win());
|
||||
}
|
||||
|
||||
void TViswin::enable_menu_item(MENU_TAG item, bool on)
|
||||
{
|
||||
win_menu_enable(win(), item, on);
|
||||
win_update_menu_bar(win());
|
||||
xvt_menu_set_item_enabled(win(), item, on);
|
||||
xvt_menu_update(win());
|
||||
}
|
||||
|
||||
|
||||
@ -131,7 +143,7 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
|
||||
_link_displayed = TRUE;
|
||||
if (in_update) return;
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
TString dd(d); if (dd.len() > 40) dd.cut(40);
|
||||
TString80 dd; dd.strncpy(d, 40);
|
||||
xvt_statbar_set(dd);
|
||||
#endif
|
||||
if (_link_button != -1)
|
||||
@ -351,18 +363,20 @@ void TViswin::shift_screen (scroll dir)
|
||||
{
|
||||
case up:
|
||||
case down:
|
||||
set_rect (&r, 0, (CHARY*Y_OFFSET) + 2, (int) (CHARX * (_textcolumns + X_OFFSET)),
|
||||
(int)(CHARY * (_textrows + Y_OFFSET)));
|
||||
win_scroll_rect (win (), &r, 0, dir == down ? CHARY : -CHARY);
|
||||
xvt_rect_set (&r, 0, taby(Y_OFFSET)+2,
|
||||
tabx(int(_textcolumns) + X_OFFSET), taby(int(_textrows) + Y_OFFSET));
|
||||
xvt_dwin_scroll_rect (win (), &r, 0, dir == down ? taby(1) : -taby(1));
|
||||
paint_row (dir == up ? origin ().y + _textrows - 1 : origin ().y);
|
||||
break;
|
||||
case left:
|
||||
case right:
|
||||
set_rect (&r, CHARX * X_OFFSET, 0, (int) (CHARX * (_textcolumns + X_OFFSET) + 2),
|
||||
(int) (CHARY * (_textrows + 1) - 2));
|
||||
win_scroll_rect (win (), &r, dir == right ? CHARX : -CHARX, 0);
|
||||
paint_column (dir == left ? origin ().x + _textcolumns - 1 : origin ().x,
|
||||
dir == left);
|
||||
xvt_rect_set (&r,
|
||||
tabx(X_OFFSET), 0,
|
||||
tabx(int(_textcolumns) + X_OFFSET) + 2,
|
||||
taby(int(_textrows) + 1) - 2);
|
||||
xvt_dwin_scroll_rect (win (), &r, dir == right ? tabx(1) : -tabx(1), 0);
|
||||
|
||||
paint_column (dir == left ? origin ().x + _textcolumns - 1 : origin ().x, dir == left);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -411,9 +425,9 @@ void TViswin::repos_buttons ()
|
||||
autoscroll (TRUE);
|
||||
|
||||
RCT wr;
|
||||
get_client_rect (win (), &wr);
|
||||
xvt_vobj_get_client_rect (win (), &wr);
|
||||
RCT br;
|
||||
get_client_rect (_button[0], &br);
|
||||
xvt_vobj_get_client_rect (_button[0], &br);
|
||||
|
||||
int space = (wr.right - buttons * br.right) / (buttons + 1);
|
||||
if (space < 0)
|
||||
@ -424,9 +438,12 @@ void TViswin::repos_buttons ()
|
||||
for (int b = 0; b < buttons; b++, x += br.right + space)
|
||||
{
|
||||
RCT r;
|
||||
set_rect (&r, x, y, x + br.right, y + br.bottom);
|
||||
move_window (_button[b], &r);
|
||||
xvt_rect_set (&r, x, y, x + br.right, y + br.bottom);
|
||||
xvt_vobj_move (_button[b], &r);
|
||||
}
|
||||
|
||||
for (int i = 0; i < _modules.items(); i++)
|
||||
((TImage&)_modules[i]).set_pos(4, 4+int(rows()-BUTTONROW_SIZE)*CHARY);
|
||||
}
|
||||
|
||||
void TViswin::open ()
|
||||
@ -445,7 +462,7 @@ void TViswin::paint_screen ()
|
||||
bool first = TRUE;
|
||||
for (long j = 0; j < _textrows; j++)
|
||||
{
|
||||
long rw = origin ().y + j;
|
||||
const long rw = origin ().y + j;
|
||||
if (rw < _txt.lines ())
|
||||
paint_row (rw);
|
||||
else if (!_isopen)
|
||||
@ -456,17 +473,17 @@ void TViswin::paint_screen ()
|
||||
set_pen (COLOR_BLACK);
|
||||
|
||||
PNT b, e;
|
||||
b.h = CHARX * 5;
|
||||
b.v = (CHARY * (int) (j + (long)Y_OFFSET - origin ().y)) - 2;
|
||||
e.h = CHARX * columns ();
|
||||
b.h = tabx(5);
|
||||
b.v = taby((int) (j + (long)Y_OFFSET - origin ().y)) - 2;
|
||||
e.h = tabx(columns());
|
||||
e.v = b.v;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
xvt_dwin_draw_set_pos (win (), b);
|
||||
xvt_dwin_draw_line (win (), e);
|
||||
set_pen (COLOR_LTGRAY);
|
||||
e.v++;
|
||||
b.v++;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
xvt_dwin_draw_set_pos (win (), b);
|
||||
xvt_dwin_draw_line (win (), e);
|
||||
set_brush (COLOR_DKGRAY);
|
||||
bar (5, (int)(j+(long)Y_OFFSET-origin().y),(int)columns(),
|
||||
(int)(rows()-(long)BUTTONROW_SIZE));
|
||||
@ -477,11 +494,14 @@ void TViswin::paint_screen ()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// j = riga totale, row = riga a video
|
||||
void TViswin::paint_background (long j, int row)
|
||||
{
|
||||
if (!_isbackground)
|
||||
if (_bg->items() == 0)
|
||||
return;
|
||||
int rw = (int) (j % (long) _formlen);
|
||||
|
||||
const int rw = (int) (j % (long) _formlen);
|
||||
TString & rwd = (TString &)(*_bg)[rw];
|
||||
int cnt = 0;
|
||||
char ch;
|
||||
@ -491,7 +511,7 @@ void TViswin::paint_background (long j, int row)
|
||||
char curpat = 'n';
|
||||
char curwid = '1';
|
||||
|
||||
unsigned int x1, x2;
|
||||
unsigned int x1, x2, y1, y2, id;
|
||||
PNT b, e;
|
||||
while (ch = rwd[cnt++])
|
||||
{
|
||||
@ -499,50 +519,90 @@ void TViswin::paint_background (long j, int row)
|
||||
{
|
||||
case 'v': // verticale intera
|
||||
|
||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
||||
b.h = e.h = x1 * CHARX + CHARX / 2;
|
||||
b.v = row * CHARY;
|
||||
e.v = (row + 1) * CHARY;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
x1 = (byte)rwd[cnt++] + (X_OFFSET -1);
|
||||
b.h = e.h = tabx(x1) + tabx(1) / 2;
|
||||
b.v = taby(row);
|
||||
e.v = taby(row + 1);
|
||||
xvt_dwin_draw_set_pos (win (), b);
|
||||
xvt_dwin_draw_line (win (), e);
|
||||
break;
|
||||
case 'o': // verticale pezzo sopra
|
||||
|
||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
||||
b.h = e.h = x1 * CHARX + CHARX / 2;
|
||||
b.v = row * CHARY;
|
||||
e.v = (row + 1) * CHARY - CHARY / 2;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
x1 = (byte)rwd[cnt++] + (X_OFFSET -1);
|
||||
b.h = e.h = tabx(x1) + tabx(1) / 2;
|
||||
b.v = taby(row);
|
||||
e.v = taby(row + 1) - taby(1) / 2;
|
||||
xvt_dwin_draw_set_pos (win (), b);
|
||||
xvt_dwin_draw_line (win (), e);
|
||||
break;
|
||||
case 'u': // verticale pezzo sotto
|
||||
|
||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
||||
b.h = e.h = x1 * CHARX + CHARX / 2;
|
||||
b.v = row * CHARY + CHARY / 2;
|
||||
e.v = (row + 1) * CHARY;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
x1 = (byte) rwd[cnt++] + (X_OFFSET -1);
|
||||
b.h = e.h = tabx(x1) + tabx(1) / 2;
|
||||
b.v = taby(row) + taby(1) / 2;
|
||||
e.v = taby(row + 1);
|
||||
xvt_dwin_draw_set_pos (win (), b);
|
||||
xvt_dwin_draw_line (win (), e);
|
||||
break;
|
||||
case 'h': // orizzontale intera
|
||||
|
||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
||||
x2 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
||||
b.v = e.v = row * CHARY + CHARY / 2;
|
||||
b.h = x1 * CHARX;
|
||||
e.h = (x2 + 1) * CHARX;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
x1 = (byte) rwd[cnt++] + (X_OFFSET -1) - int(origin().x);
|
||||
x2 = (byte) rwd[cnt++] + (X_OFFSET -1) - int(origin().x);
|
||||
b.v = e.v = taby(row) + taby(1) / 2;
|
||||
b.h = tabx(x1);
|
||||
e.h = tabx(x2 + 1);
|
||||
xvt_dwin_draw_set_pos (win (), b);
|
||||
xvt_dwin_draw_line (win (), e);
|
||||
break;
|
||||
case 'r': // orizzontale scorciata agli estremi
|
||||
x1 = (byte) rwd[cnt++] + (X_OFFSET -1);
|
||||
x2 = (byte) rwd[cnt++] + (X_OFFSET -1);
|
||||
b.v = e.v = taby(row) + taby(1) / 2;
|
||||
b.h = tabx(x1) + tabx(1) / 2;
|
||||
e.h = tabx(x2) + tabx(1) / 2;
|
||||
xvt_dwin_draw_set_pos (win (), b);
|
||||
xvt_dwin_draw_line (win (), e);
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
id = (byte)(rwd[cnt++])-1; // Numero immagine
|
||||
y1 = (byte)(rwd[cnt++])-1; // Riga sorgente
|
||||
x1 = (byte)(rwd[cnt++])-1; // Colonna destinazione
|
||||
x2 = (byte)(rwd[cnt++]); // Larghezza destinazione (in caratteri)
|
||||
y2 = (byte)(rwd[cnt++]); // Altezza destinazione (in caratteri)
|
||||
if (id >= 0)
|
||||
{
|
||||
const int width = tabx(x2);
|
||||
TImage* i = (TImage*)_images.objptr(id);
|
||||
if (i == NULL && y1 == 0)
|
||||
{
|
||||
const TString_array& a = main_app().printer().image_names();
|
||||
const TImage src(a.row(id));
|
||||
if (src.ok())
|
||||
{
|
||||
i = new TImage(src, width, y2*CHARY);
|
||||
_images.add(i, id);
|
||||
}
|
||||
}
|
||||
|
||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
||||
x2 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
||||
b.v = e.v = row * CHARY + CHARY / 2;
|
||||
b.h = x1 * CHARX + CHARX / 2;
|
||||
e.h = x2 * CHARX + CHARX / 2;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
if (i && i->ok())
|
||||
{
|
||||
short delta = tabx(short(origin().x-x1)); // Primo pixel sorgente
|
||||
if (delta < 0) delta = 0;
|
||||
if (delta < width)
|
||||
{
|
||||
const int scroll = (row == 1) ? 2 : 0;
|
||||
PNT p; p.h = delta; p.v = taby(y1);
|
||||
RCT src; xvt_rect_set(&src, p.h, p.v, width, min(p.v+taby(1)+scroll , i->height()));
|
||||
if (src.top < i->height())
|
||||
{
|
||||
p.h = tabx(x1+X_OFFSET); p.v = taby(row);
|
||||
RCT dst = src; xvt_rect_set_pos(&dst, p);
|
||||
i->draw(win(), dst, src);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'W':
|
||||
curwid = rwd[cnt++];
|
||||
@ -580,10 +640,10 @@ void TViswin::paint_row (long j)
|
||||
if (need_paint_sel (FALSE))
|
||||
adjust_selection (p1, p2);
|
||||
int row = (int) (j + (long)Y_OFFSET - y);
|
||||
static char fill[] = " "
|
||||
char fill[] = " "
|
||||
" ";
|
||||
autoscroll(FALSE);
|
||||
set_font(FF_FIXED, 0);
|
||||
set_font(PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||
set_mode(M_COPY);
|
||||
set_opaque_text(TRUE);
|
||||
if (_rulers)
|
||||
@ -598,41 +658,31 @@ void TViswin::paint_row (long j)
|
||||
set_brush (COLOR_WHITE);
|
||||
RCT r;
|
||||
r.top = row * CHARY;
|
||||
r.left = CHARX * (X_OFFSET -1),
|
||||
r.bottom = r.top + CHARY + 2;
|
||||
r.right = CHARX * 255;
|
||||
win_draw_rect (win (), &r);
|
||||
r.left = tabx(X_OFFSET -1),
|
||||
r.bottom = r.top + taby(1) + 2;
|
||||
r.right = tabx(255);
|
||||
xvt_dwin_draw_rect (win (), &r);
|
||||
}
|
||||
|
||||
paint_background (j, row);
|
||||
set_opaque_text(FALSE);
|
||||
|
||||
const char *cp;
|
||||
int pos = 0;
|
||||
_txt.read_line (j, origin ().x);
|
||||
while (cp = _txt.piece ())
|
||||
while ((cp = _txt.piece ()) != NULL)
|
||||
{
|
||||
#if XVT_OS != XVT_OS_SCOUNIX
|
||||
int st = _txt.get_style ();
|
||||
long bg = trans_color (_txt.get_background ());
|
||||
long fg = trans_color (_txt.get_foreground ());
|
||||
// per ora disabilitiamo il grassetto
|
||||
set_font (FF_FIXED, (st & 0x000f) & ~FS_BOLD);
|
||||
set_color (fg, bg);
|
||||
const int st = _txt.get_style();
|
||||
const COLOR bg = trans_color (_txt.get_background());
|
||||
const COLOR fg = trans_color (_txt.get_foreground());
|
||||
set_font(PRINT_FONT, st, PRINT_HEIGHT);
|
||||
set_color(fg, bg);
|
||||
#else
|
||||
set_color (COLOR_BLACK, COLOR_WHITE);
|
||||
#endif
|
||||
printat (X_OFFSET + pos, row, "%s", cp);
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (st & underlined)
|
||||
{
|
||||
PNT b, e;
|
||||
|
||||
set_pen (COLOR_BLACK);
|
||||
b.h = CHARX*(X_OFFSET + pos);
|
||||
b.v = (row+Y_OFFSET) * CHARY;
|
||||
e.h = CHARX*(X_OFFSET + pos + strlen (cp));
|
||||
e.v = (row+Y_OFFSET)*CHARY;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
}
|
||||
#endif
|
||||
pos += strlen (cp);
|
||||
}
|
||||
if (_scrolling && (pos < _textcolumns))
|
||||
@ -640,29 +690,28 @@ void TViswin::paint_row (long j)
|
||||
set_color (COLOR_BLACK, COLOR_WHITE);
|
||||
printat (X_OFFSET + pos, row, "%s", fill);
|
||||
}
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN // paint page limits
|
||||
if ((j % _formlen) == (_formlen - 1) && _toplevel) // last row
|
||||
|
||||
{
|
||||
PNT b, e;
|
||||
|
||||
b.h = CHARX * (X_OFFSET -1);
|
||||
b.v = (row + Y_OFFSET) * CHARY - 1;
|
||||
e.h = CHARX * 132;
|
||||
e.v = (row + Y_OFFSET) * CHARY - 1;
|
||||
b.h = tabx(X_OFFSET -1);
|
||||
b.v = taby(row + Y_OFFSET) - 1;
|
||||
e.h = tabx(132);
|
||||
e.v = taby(row + Y_OFFSET) - 1;
|
||||
set_pen (COLOR_LTGRAY, 2, PAT_SOLID, P_DASH);
|
||||
win_move_to (win(), b);
|
||||
win_draw_line (win(), e);
|
||||
xvt_dwin_draw_set_pos (win(), b);
|
||||
xvt_dwin_draw_line (win(), e);
|
||||
}
|
||||
#endif
|
||||
paint_background (j, row);
|
||||
autoscroll (TRUE);
|
||||
}
|
||||
|
||||
void TViswin::paint_column (long j, bool end)
|
||||
{
|
||||
paint_header ();
|
||||
set_opaque_text (TRUE);
|
||||
set_opaque_text (FALSE);
|
||||
set_mode (M_COPY);
|
||||
TPoint p1, p2;
|
||||
if (need_paint_sel (FALSE))
|
||||
@ -670,35 +719,35 @@ void TViswin::paint_column (long j, bool end)
|
||||
set_color (COLOR_BLACK, COLOR_WHITE);
|
||||
|
||||
autoscroll (FALSE);
|
||||
for (long l = 0l; l < _textrows && l < (_txt.lines () - origin ().y); l++)
|
||||
|
||||
RCT clipper;
|
||||
xvt_rect_set(&clipper, tabx(X_OFFSET), 0, tabx(X_OFFSET+1), taby(int(_textrows)));
|
||||
if (end)
|
||||
xvt_rect_offset(&clipper, tabx(int(_textcolumns)), 0);
|
||||
xvt_dwin_set_clip(win(), &clipper);
|
||||
|
||||
const int col = end ? (int) (_textcolumns + X_OFFSET -1) : X_OFFSET;
|
||||
set_brush(COLOR_WHITE);
|
||||
bar(col, Y_OFFSET, col+1, int(_textrows + Y_OFFSET));
|
||||
|
||||
for (long l = 0L; l < _textrows && l < (_txt.lines () - origin ().y); l++)
|
||||
{
|
||||
paint_background (l, (int) l + 1);
|
||||
|
||||
const char *c = (const char *) _txt.line (origin ().y + l);
|
||||
#if XVT_OS != XVT_OS_SCOUNIX
|
||||
int st = _txt.get_style ((int) j);
|
||||
set_font (FF_FIXED, st & 0x000f);
|
||||
long bg = trans_color (_txt.get_background ((int) j));
|
||||
long fg = trans_color (_txt.get_foreground ((int) j));
|
||||
set_font (PRINT_FONT, st, PRINT_HEIGHT);
|
||||
COLOR bg = trans_color (_txt.get_background ((int) j));
|
||||
COLOR fg = trans_color (_txt.get_foreground ((int) j));
|
||||
set_color (fg, bg);
|
||||
#endif
|
||||
int col = end ? (int) (_textcolumns + X_OFFSET -1) : X_OFFSET;
|
||||
printat (col, (int) l + Y_OFFSET, "%c",
|
||||
(unsigned int) j < strlen (c) ? c[(int) j] : ' ');
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if ((st & underlined) && strlen (c) > (word) j)
|
||||
{
|
||||
PNT b, e;
|
||||
|
||||
set_pen (COLOR_BLACK);
|
||||
b.h = CHARX * col;
|
||||
b.v = (int) (l + 2l) * CHARY;
|
||||
e.h = CHARX * (col + 1);
|
||||
e.v = (int) (l + 2l) * CHARY;
|
||||
win_move_to (win (), b);
|
||||
win_draw_line (win (), e);
|
||||
}
|
||||
#endif
|
||||
paint_background ((int) l, (int) l + 1);
|
||||
}
|
||||
|
||||
xvt_dwin_set_clip(win(), NULL);
|
||||
|
||||
autoscroll (TRUE);
|
||||
}
|
||||
|
||||
@ -707,8 +756,8 @@ void TViswin::draw_crossbars ()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
|
||||
if (_cross.v > CHARY && _cross.v < (rows () - BUTTONROW_SIZE) * CHARY &&
|
||||
_cross.h > CHARX * (X_OFFSET - 1) && _cross.h < columns () * CHARX)
|
||||
if (_cross.v > taby(1) && _cross.v < taby(rows () - BUTTONROW_SIZE) &&
|
||||
_cross.h > tabx (X_OFFSET - 1) && _cross.h < tabx(columns()) )
|
||||
{
|
||||
set_pen (COLOR_BLACK);
|
||||
set_mode (M_XOR);
|
||||
@ -717,17 +766,17 @@ void TViswin::draw_crossbars ()
|
||||
|
||||
autoscroll (FALSE);
|
||||
b1.h = _cross.h;
|
||||
b1.v = CHARY * Y_OFFSET;
|
||||
b1.v = taby(Y_OFFSET);
|
||||
e1.h = _cross.h;
|
||||
e1.v = ((rows() - BUTTONROW_SIZE + (_rulers ? 0 : 1)) * CHARY);
|
||||
b2.h = CHARX * (X_OFFSET -1);
|
||||
e1.v = taby((rows() - BUTTONROW_SIZE + (_rulers ? 0 : 1)));
|
||||
b2.h = tabx(X_OFFSET -1);
|
||||
b2.v = _cross.v;
|
||||
e2.h = CHARX * columns();
|
||||
e2.h = tabx(columns());
|
||||
e2.v = _cross.v;
|
||||
win_move_to (win (), b1);
|
||||
win_draw_line (win (), e1);
|
||||
win_move_to (win (), b2);
|
||||
win_draw_line (win (), e2);
|
||||
xvt_dwin_draw_set_pos (win (), b1);
|
||||
xvt_dwin_draw_line (win (), e1);
|
||||
xvt_dwin_draw_set_pos (win (), b2);
|
||||
xvt_dwin_draw_line (win (), e2);
|
||||
autoscroll (TRUE);
|
||||
}
|
||||
#endif
|
||||
@ -802,13 +851,14 @@ void TViswin::paint_header ()
|
||||
set_mode (M_COPY);
|
||||
set_opaque_text (TRUE);
|
||||
set_color (FOREGROUND, BACKGROUND);
|
||||
set_font (FF_FIXED, 0);
|
||||
TString htmpst (10);
|
||||
set_font (PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||
TString16 htmpst;
|
||||
for (int i = 1; i < 26; i++)
|
||||
{
|
||||
htmpst.format ("%d", i);
|
||||
htmpst.right_just (10, '.');
|
||||
printat (i * 10 - 4, (int) origin ().y, "%s", (const char *) htmpst);
|
||||
xvt_dwin_draw_text(win(), tabx(i*10 - 4 - int(origin().x)), BASEY,
|
||||
(char*)(const char*)htmpst, 10);
|
||||
}
|
||||
autoscroll (FALSE);
|
||||
set_color (COLOR_WHITE, BACKGROUND);
|
||||
@ -841,35 +891,17 @@ void TViswin::paint_selection ()
|
||||
void TViswin::paint_waitbar (bool xor)
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
static int pic;
|
||||
#endif
|
||||
HIDDEN int pic = 0;
|
||||
((TImage&)_modules[pic]).draw(win());
|
||||
pic = (pic+1) & 0x3;
|
||||
#else
|
||||
autoscroll (FALSE);
|
||||
if (xor)
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
cpb_win_picture_draw_at(win(),_picture[pic],4,4+(int)(rows()-(long)BUTTONROW_SIZE)*CHARY);
|
||||
if (pic == 3)
|
||||
pic = 0;
|
||||
else
|
||||
pic++;
|
||||
#else
|
||||
invert_bar (3, rows() - 2, 4, rows() - 1);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
cpb_win_picture_draw_at (win (), _picture[pic], 4,
|
||||
4 + (int) (rows () - (long)BUTTONROW_SIZE) * CHARY);
|
||||
if (pic == 3)
|
||||
pic = 0;
|
||||
else
|
||||
pic++;
|
||||
#else
|
||||
printat (3, rows () - 2, "%c", '*');
|
||||
#endif
|
||||
}
|
||||
else
|
||||
printat (3, rows() - 2, "%c", '*');
|
||||
autoscroll (TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TViswin::update ()
|
||||
@ -910,11 +942,9 @@ void TViswin::update ()
|
||||
bar ((X_OFFSET -1), rows()-BUTTONROW_SIZE, columns() + 1, rows() + 1);
|
||||
if (_showbuts && _isopen)
|
||||
paint_waitbar (FALSE);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
else if (_showbuts)
|
||||
cpb_win_picture_draw_at (win(), _modpic, 4,
|
||||
4 + (int) (rows () - (long)BUTTONROW_SIZE) * CHARY);
|
||||
else
|
||||
if (_showbuts) ((TImage&)_modules[4]).draw(win());
|
||||
#endif
|
||||
autoscroll (TRUE);
|
||||
paint_header ();
|
||||
@ -941,6 +971,19 @@ void TViswin::abort_print ()
|
||||
}
|
||||
}
|
||||
|
||||
void TViswin::scroll_error(long x, long y)
|
||||
{
|
||||
beep();
|
||||
update_thumb(x, y);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
POINT p; GetCursorPos(&p);
|
||||
if (x < 0) p.x -= 16;
|
||||
if (y < 0) p.y -= 16;
|
||||
SetCursorPos(p.x, p.y);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
{
|
||||
int kdiff_x, kdiff_y;
|
||||
@ -991,7 +1034,11 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
dispatch_e_char(win, CTRL_E);
|
||||
break;
|
||||
case M_EDIT_SEL_ALL: // stampa
|
||||
dispatch_e_char(win, CTRL_S);
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
xvt_statbar_set ("");
|
||||
xvt_statbar_refresh ();
|
||||
stop_run(CTRL_S);
|
||||
#endif
|
||||
break;
|
||||
case M_FONT: // mostra righelli
|
||||
show_rulers(!_rulers);
|
||||
@ -1041,8 +1088,8 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
stop_run (K_ENTER);
|
||||
}
|
||||
break;
|
||||
case DLG_PRINT:
|
||||
_txt.print ();
|
||||
case DLG_PRINT:
|
||||
dispatch_e_menu(win, M_EDIT_SEL_ALL);
|
||||
break;
|
||||
case DLG_EDIT:
|
||||
check_link ();
|
||||
@ -1059,22 +1106,22 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
case E_TIMER:
|
||||
if (ep->v.timer.id == _timer)
|
||||
{
|
||||
kill_timer (_timer);
|
||||
xvt_timer_destroy (_timer);
|
||||
_istimer = FALSE;
|
||||
}
|
||||
else if (ep->v.timer.id == _wtimer)
|
||||
{
|
||||
if (_showbuts) paint_waitbar ();
|
||||
kill_timer (_wtimer);
|
||||
xvt_timer_destroy (_wtimer);
|
||||
if (_isopen)
|
||||
_wtimer = set_timer (win, 150l);
|
||||
_wtimer = xvt_timer_create (win, 150l);
|
||||
}
|
||||
break;
|
||||
case E_MOUSE_DBL:
|
||||
break;
|
||||
case E_MOUSE_DOWN:
|
||||
p = ep->v.mouse.where;
|
||||
trap_mouse (win);
|
||||
xvt_win_trap_pointer (win);
|
||||
|
||||
if (ep->v.mouse.button == 0) // left button: text selection
|
||||
|
||||
@ -1106,7 +1153,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
}
|
||||
break;
|
||||
case E_MOUSE_UP:
|
||||
release_mouse ();
|
||||
xvt_win_release_pointer ();
|
||||
|
||||
if (ep->v.mouse.button == 0) // left button: text selection/move
|
||||
// point
|
||||
@ -1328,11 +1375,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
check_link (&_point);
|
||||
_need_update = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(-1, 0);
|
||||
}
|
||||
else scroll_error(-1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1350,11 +1393,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
check_link (&_point);
|
||||
_need_update = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(0, -1);
|
||||
}
|
||||
else scroll_error(0, -1);
|
||||
}
|
||||
break;
|
||||
case SC_LINE_UP:
|
||||
@ -1370,11 +1409,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
update_thumb (origin().x, origin().y - 1l);
|
||||
_need_scroll = down;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(-1, 0);
|
||||
}
|
||||
else scroll_error(-1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1388,11 +1423,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
_point.x--;
|
||||
_need_scroll = right;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(0, -1);
|
||||
}
|
||||
else scroll_error(0, -1);
|
||||
}
|
||||
break;
|
||||
case SC_PAGE_DOWN:
|
||||
@ -1413,11 +1444,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
check_link (&_point);
|
||||
_need_update = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(-1, _txt.lines()-_textrows-1);
|
||||
}
|
||||
else scroll_error(-1, _txt.lines()-_textrows-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1435,11 +1462,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
check_link (&_point);
|
||||
_need_update = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(255-_textcolumns, -1);
|
||||
}
|
||||
else scroll_error(255-_textcolumns, -1);
|
||||
}
|
||||
break;
|
||||
case SC_LINE_DOWN:
|
||||
@ -1455,11 +1478,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
_point.y++;
|
||||
_need_scroll = up;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(-1, _txt.lines()-_textrows-1);
|
||||
}
|
||||
else scroll_error(-1, _txt.lines()-_textrows-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1473,11 +1492,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
||||
_need_scroll = left;
|
||||
_point.x++;
|
||||
}
|
||||
else
|
||||
{
|
||||
beep ();
|
||||
update_thumb(255-_textcolumns, -1);
|
||||
}
|
||||
else scroll_error(255-_textcolumns, -1);
|
||||
}
|
||||
break;
|
||||
case SC_THUMB:
|
||||
@ -1545,7 +1560,7 @@ bool TViswin::on_key (KEY key)
|
||||
|
||||
if (_istimer)
|
||||
return TRUE;
|
||||
_timer = set_timer (win (), 50l);
|
||||
_timer = xvt_timer_create (win (), 50l);
|
||||
_istimer = TRUE;
|
||||
|
||||
if (key == K_UP || key == K_DOWN || key == K_LEFT || key == K_RIGHT)
|
||||
@ -1580,7 +1595,7 @@ bool TViswin::on_key (KEY key)
|
||||
break;
|
||||
case CTRL_S:
|
||||
if (_isprint)
|
||||
_txt.print ();
|
||||
stop_run(CTRL_S);
|
||||
break;
|
||||
case CTRL_R:
|
||||
_need_update = TRUE;
|
||||
@ -1893,18 +1908,18 @@ bool TViswin::call_editor ()
|
||||
{
|
||||
TFilename newfilename; newfilename.tempdir();
|
||||
FILE_SPEC fs;
|
||||
str_to_dir((char*)(const char*)newfilename, &fs.dir);
|
||||
xvt_fsys_convert_str_to_dir((char*)(const char*)newfilename, &fs.dir);
|
||||
strcpy (fs.type, "txt");
|
||||
strcpy (fs.name, "");
|
||||
|
||||
save_dir ();
|
||||
ok = save_file_dlg (&fs, "Salva il file con il nome:") == FL_OK;
|
||||
restore_dir ();
|
||||
xvt_fsys_save_dir ();
|
||||
ok = xvt_dm_post_file_save (&fs, "Salva il file con il nome:") == FL_OK;
|
||||
xvt_fsys_restore_dir ();
|
||||
|
||||
if (ok)
|
||||
{
|
||||
char path[256];
|
||||
dir_to_str (&fs.dir, path, sizeof (path));
|
||||
xvt_fsys_convert_dir_to_str (&fs.dir, path, sizeof (path));
|
||||
newfilename = path;
|
||||
newfilename << '/' << fs.name;
|
||||
|
||||
@ -1944,7 +1959,7 @@ void TViswin::add_line (const char *l)
|
||||
ev.type = E_USER;
|
||||
ev.v.user.id = (_txt.lines() - origin().y) <= _textrows ?
|
||||
E_ADDLINE_ONSCREEN : E_ADDLINE;
|
||||
dispatch_event (win (), &ev);
|
||||
xvt_win_dispatch_event (win (), &ev);
|
||||
do_events ();
|
||||
}
|
||||
}
|
||||
@ -1952,12 +1967,14 @@ void TViswin::add_line (const char *l)
|
||||
void TViswin::close_print ()
|
||||
{
|
||||
_isopen = FALSE;
|
||||
if (_showbuts) kill_timer (_wtimer);
|
||||
if (_showbuts) xvt_timer_destroy (_wtimer);
|
||||
_need_update = TRUE;
|
||||
if (_toplevel)
|
||||
{
|
||||
win_set_menu_text(win(), M_EDIT_QUIT, "Chiudi\tESC");
|
||||
xvt_menu_set_item_title(win(), M_EDIT_QUIT, "Chiudi\tESC");
|
||||
enable_menu_item(M_EDIT_CLIPBOARD, FALSE);
|
||||
xvt_enable_control(_print_button, TRUE);
|
||||
enable_menu_item(M_EDIT_SEL_ALL, TRUE);
|
||||
}
|
||||
force_update ();
|
||||
}
|
||||
@ -2081,7 +2098,7 @@ void TViswin::show_buttons(bool on)
|
||||
|
||||
for (int i = 0; i < _buttons; i++)
|
||||
if (_button[i] != NULL_WIN)
|
||||
show_window(_button[i],on);
|
||||
xvt_vobj_set_visible(_button[i],on);
|
||||
refresh();
|
||||
}
|
||||
|
||||
@ -2136,7 +2153,7 @@ TViswin::TViswin(const char *fname,
|
||||
|
||||
RCT r;
|
||||
|
||||
get_client_rect (parent, &r);
|
||||
xvt_vobj_get_client_rect (parent, &r);
|
||||
int maxlarg = width == 0 ? (r.right / CHARX - 6) : width;
|
||||
int maxalt = height == 0 ? (r.bottom / CHARY - 6) : height;
|
||||
|
||||
@ -2147,8 +2164,8 @@ TViswin::TViswin(const char *fname,
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
for (i = 0; i < 4; i++)
|
||||
_picture[i] = cpb_picture_load (BMP_MODULE1 + i);
|
||||
_modpic = cpb_picture_load (BMP_MODULE);
|
||||
_modules.add(new TImage(BMP_MODULE1 + i), i);
|
||||
_modules.add(new TImage(BMP_MODULE), i);
|
||||
#endif
|
||||
|
||||
long flags = WSF_HSCROLL | WSF_VSCROLL;
|
||||
@ -2161,7 +2178,7 @@ TViswin::TViswin(const char *fname,
|
||||
create (x, y, maxlarg, maxalt, title, flags, rt, parent,
|
||||
_toplevel ? VISWIN_BAR : 0);
|
||||
set_opaque_text (TRUE);
|
||||
set_font (FF_FIXED);
|
||||
set_font (PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||
|
||||
if (_toplevel)
|
||||
{
|
||||
@ -2182,7 +2199,6 @@ TViswin::TViswin(const char *fname,
|
||||
add_button (DLG_QUIT, DLG_QUIT_TITLE);
|
||||
_buttons = 1;
|
||||
|
||||
|
||||
if (_isedit)
|
||||
{
|
||||
add_button (DLG_EDIT, DLG_EDIT_TITLE);
|
||||
@ -2194,20 +2210,20 @@ TViswin::TViswin(const char *fname,
|
||||
_buttons++;
|
||||
xvt_enable_control(_link_button, FALSE);
|
||||
}
|
||||
/*
|
||||
if (_isprint)
|
||||
{
|
||||
add_button (DLG_PRINT, DLG_PRINT_TITLE);
|
||||
_buttons++;
|
||||
}
|
||||
*/
|
||||
if (_isprint)
|
||||
{
|
||||
_print_button = add_button (DLG_PRINT, DLG_PRINT_TITLE);
|
||||
xvt_enable_control(_print_button, FALSE);
|
||||
enable_menu_item(M_EDIT_SEL_ALL, FALSE);
|
||||
_buttons++;
|
||||
}
|
||||
}
|
||||
else _buttons = 0;
|
||||
|
||||
_curbut = 0;
|
||||
|
||||
if (_isopen && _showbuts)
|
||||
_wtimer = set_timer(win(), 150l);
|
||||
_wtimer = xvt_timer_create(win(), 150l);
|
||||
|
||||
_point.set (0, 0);
|
||||
autoscroll (FALSE);
|
||||
@ -2218,8 +2234,7 @@ TViswin::TViswin(const char *fname,
|
||||
_links = _toplevel ? &(main_app().printer().links()) : &(_brwfld->_links);
|
||||
_multiple = _toplevel ? (main_app().printer ().ismultiplelink()) :
|
||||
(_brwfld->is_multiple_link());
|
||||
_bg = _toplevel ? main_app().printer().getbgdesc() : _brwfld->get_bg_desc();
|
||||
_isbackground = _bg->items () > 0;
|
||||
_bg = _toplevel ? &(main_app().printer().getbgdesc()) : _brwfld->get_bg_desc();
|
||||
_formlen = _toplevel ? main_app().printer().formlen() : maxalt;
|
||||
_linkID = -1;
|
||||
_inside_linkexec = FALSE;
|
||||
@ -2238,12 +2253,7 @@ TViswin::TViswin(const char *fname,
|
||||
}
|
||||
|
||||
TViswin ::~TViswin ()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
for (int i = 0; i < 4; i++)
|
||||
picture_free (_picture[i]);
|
||||
#endif
|
||||
}
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Campo di visualizzazione sulle maschere
|
||||
@ -2282,8 +2292,8 @@ void TBrowsefile_field::create(WINDOW parent)
|
||||
_viswin = new TViswin(_prompt, _prompt, FALSE, FALSE, FALSE, _x, _y,
|
||||
_size, _width, _flags.rightjust ? TRUE : FALSE, parent, this);
|
||||
_win = _viswin->win();
|
||||
enable_window(_win, enabled());
|
||||
show_window(_win, shown());
|
||||
xvt_vobj_set_enabled(_win, enabled());
|
||||
xvt_vobj_set_visible(_win, shown());
|
||||
|
||||
main_app().end_wait();
|
||||
}
|
||||
|
@ -2,10 +2,6 @@
|
||||
#ifndef __VISWIN_H
|
||||
#define __VISWIN_H
|
||||
|
||||
#ifndef __ARRAY_H
|
||||
#include <array.h>
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
@ -51,7 +47,9 @@ class TViswin : public TScroll_window
|
||||
WINDOW _button[MAXBUT]; // button array
|
||||
int _curbut; // button which currently has focus
|
||||
int _buttons; // button count
|
||||
|
||||
WINDOW _link_button;
|
||||
WINDOW _print_button;
|
||||
|
||||
long _textrows; // righe di testo
|
||||
long _textcolumns; // indovina indovinello
|
||||
@ -76,15 +74,16 @@ class TViswin : public TScroll_window
|
||||
TArray* _hotspots; // hotspots
|
||||
|
||||
bool need_paint_sel(bool smart = TRUE);
|
||||
PICTURE _picture[MAXPIC]; // pictures
|
||||
PICTURE _modpic;
|
||||
|
||||
TArray _modules; // Scrolling module icons
|
||||
TArray _images; // pictures properly resized
|
||||
|
||||
bool _multiple;
|
||||
TString80 _linktxt;
|
||||
int _linkID;
|
||||
TToken_string _multiple_link;
|
||||
|
||||
TArray* _bg;
|
||||
bool _isbackground;
|
||||
bool _frozen;
|
||||
bool _toplevel;
|
||||
bool _rulers;
|
||||
@ -99,6 +98,9 @@ protected:
|
||||
virtual bool on_key (KEY);
|
||||
virtual void open();
|
||||
|
||||
int tabx(int x) const; // Convert charx to pixels
|
||||
int taby(int y) const; // Convert chary to pixels
|
||||
|
||||
void shift_screen(scroll);
|
||||
void paint_screen();
|
||||
void draw_crossbars();
|
||||
@ -130,6 +132,7 @@ protected:
|
||||
void exec_link();
|
||||
|
||||
protected:
|
||||
void scroll_error(long x, long y);
|
||||
|
||||
virtual void update();
|
||||
virtual void handler(WINDOW win, EVENT* ep);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <window.h>
|
||||
#include <colors.h>
|
||||
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@ -22,16 +21,21 @@
|
||||
class TWindow_manager
|
||||
{
|
||||
// @DPRIV
|
||||
enum { MAX_WIN = 4 }; // Max number of modal windows
|
||||
enum { MAX_WIN = 4 }; // Max number of modal windows
|
||||
|
||||
TWindow* _window[MAX_WIN]; // Stack of active windows
|
||||
char _current; // Stack pointer
|
||||
void menu_enable(bool) const; // Abilita o disabilita il menu della task window
|
||||
|
||||
void menu_enable(bool) const; // Abilita o disabilita il menu della task window
|
||||
|
||||
FILE* _lowhandle;
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
TWindow_manager(); // Costruttore
|
||||
~TWindow_manager() { destroy(); }
|
||||
~TWindow_manager();
|
||||
|
||||
void free_handle();
|
||||
void lock_handle();
|
||||
|
||||
void reg(TWindow* m);
|
||||
// Registra la finestra corrente
|
||||
@ -44,9 +48,16 @@ public:
|
||||
} WinManager;
|
||||
|
||||
|
||||
TWindow_manager::TWindow_manager() : _current(-1)
|
||||
{}
|
||||
TWindow_manager::TWindow_manager() : _current(-1), _lowhandle(NULL)
|
||||
{
|
||||
lock_handle();
|
||||
}
|
||||
|
||||
TWindow_manager::~TWindow_manager()
|
||||
{
|
||||
destroy();
|
||||
free_handle();
|
||||
}
|
||||
|
||||
void TWindow_manager::destroy()
|
||||
{
|
||||
@ -58,6 +69,21 @@ void TWindow_manager::destroy()
|
||||
}
|
||||
}
|
||||
|
||||
void TWindow_manager::lock_handle()
|
||||
{
|
||||
CHECK(_lowhandle == NULL, "Can't relock low handle");
|
||||
_lowhandle = fopen("prassi.ini", "r");
|
||||
CHECK(_lowhandle != NULL, "Can't lock low handle");
|
||||
}
|
||||
|
||||
void TWindow_manager::free_handle()
|
||||
{
|
||||
CHECK(_lowhandle, "Can't unlock low handle");
|
||||
fclose(_lowhandle);
|
||||
_lowhandle = NULL;
|
||||
}
|
||||
|
||||
|
||||
bool TWindow_manager::can_close() const
|
||||
{
|
||||
bool ok = TRUE;
|
||||
@ -78,7 +104,7 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
||||
if (m->child)
|
||||
xvt_menu_enable(m->child, on);
|
||||
break;
|
||||
case 65535: // Separator
|
||||
case -1: // Separator
|
||||
case M_FILE_NEW:
|
||||
case M_FILE_REVERT:
|
||||
case M_FILE_QUIT:
|
||||
@ -88,7 +114,7 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
||||
case (M_FILE+11):
|
||||
break; // Leave them as they are
|
||||
default:
|
||||
win_menu_enable(TASK_WIN, m->tag, on);
|
||||
xvt_menu_set_item_enabled(TASK_WIN, m->tag, on);
|
||||
break;
|
||||
}
|
||||
m++;
|
||||
@ -98,10 +124,10 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
||||
|
||||
void TWindow_manager::menu_enable(bool on) const
|
||||
{
|
||||
MENU_ITEM *mi = win_menu_fetch(TASK_WIN);
|
||||
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
||||
xvt_menu_enable(mi, on);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
menu_free(mi);
|
||||
xvt_menu_update(TASK_WIN);
|
||||
xvt_res_free_menu_tree(mi);
|
||||
}
|
||||
|
||||
|
||||
@ -116,7 +142,7 @@ void TWindow_manager::reg(TWindow* m)
|
||||
menu_enable(FALSE);
|
||||
break;
|
||||
case 1 :
|
||||
win_menu_enable(TASK_WIN, M_FILE_QUIT, FALSE);
|
||||
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_QUIT, FALSE);
|
||||
default:
|
||||
_window[_current-1]->deactivate(); break;
|
||||
}
|
||||
@ -144,8 +170,8 @@ void TWindow_manager::unreg(const TWindow* m)
|
||||
else
|
||||
{
|
||||
cur_win()->activate();
|
||||
win_menu_enable(TASK_WIN, M_FILE_QUIT, _current == 0);
|
||||
win_update_menu_bar(TASK_WIN);
|
||||
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_QUIT, _current == 0);
|
||||
xvt_menu_update(TASK_WIN);
|
||||
cur_win()->set_focus();
|
||||
}
|
||||
}
|
||||
@ -166,6 +192,155 @@ WINDOW cur_win()
|
||||
return w ? w->win() : NULL_WIN;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TImage
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Setta l'immagine e le sue dimensioni (cancella immagine precedente)
|
||||
// Certified 99%
|
||||
XVT_IMAGE TImage::set(XVT_IMAGE i)
|
||||
{
|
||||
if (_image)
|
||||
xvt_image_destroy(_image);
|
||||
_image = i;
|
||||
if (i)
|
||||
{
|
||||
_src.left = _src.top = 0;
|
||||
xvt_image_get_dimensions(i, &_src.right, &_src.bottom);
|
||||
_dst = _src;
|
||||
}
|
||||
return _image;
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
XVT_IMAGE TImage::load(const char* n)
|
||||
{
|
||||
WinManager.free_handle();
|
||||
XVT_IMAGE i = xvt_image_read_bmp((char*)n);
|
||||
WinManager.lock_handle();
|
||||
|
||||
if (i != NULL) set(i);
|
||||
return i;
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
XVT_IMAGE TImage::load(short id)
|
||||
{
|
||||
return set(xvt_res_get_image(id));
|
||||
}
|
||||
|
||||
|
||||
// Certified 100%
|
||||
TImage::TImage(const char* n) : _image(NULL)
|
||||
{
|
||||
if (n && *n) load(n);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
TImage::TImage(short id) : _image(NULL)
|
||||
{
|
||||
if (id > 0) load(id);
|
||||
}
|
||||
|
||||
// Certified 90%
|
||||
TImage::TImage(const TImage& im, short w, short h) : _image(NULL)
|
||||
{
|
||||
const XVT_IMAGE_FORMAT fmt = xvt_image_get_format(im._image);
|
||||
set(xvt_image_create(fmt, w, h, NULL));
|
||||
|
||||
if (ok())
|
||||
{
|
||||
if (fmt == XVT_IMAGE_CL8)
|
||||
{
|
||||
const short colors = xvt_image_get_ncolors(im._image);
|
||||
xvt_image_set_ncolors(_image, colors);
|
||||
for (short c = 0; c < colors; c++)
|
||||
xvt_image_set_clut(_image, c, xvt_image_get_clut((XVT_IMAGE)im._image, c));
|
||||
}
|
||||
xvt_image_transfer(_image, (XVT_IMAGE)im._image, &_src, (RCT*)&im._src);
|
||||
}
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
TImage::~TImage()
|
||||
{
|
||||
if (_image != NULL)
|
||||
xvt_image_destroy(_image);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::set_pos(int x, int y)
|
||||
{
|
||||
_dst = _src;
|
||||
xvt_rect_offset(&_dst, x, y);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w) const
|
||||
{
|
||||
xvt_dwin_draw_image(w, _image, (RCT*)&_dst, (RCT*)&_src);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w, int x, int y) const
|
||||
{
|
||||
RCT dst = _src;
|
||||
xvt_rect_offset(&dst, x, y);
|
||||
xvt_dwin_draw_image(w, _image, &dst, (RCT*)&_src);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w, const RCT& dst) const
|
||||
{
|
||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&_src);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::draw(WINDOW w, const RCT& dst, const RCT& src) const
|
||||
{
|
||||
xvt_dwin_draw_image(w, _image, (RCT*)&dst, (RCT*)&src);
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
void TImage::set_palette(WINDOW w) const
|
||||
{
|
||||
XVT_PALETTE p = xvt_palet_create(XVT_PALETTE_USER, NULL);
|
||||
xvt_palet_add_colors_from_image(p, _image);
|
||||
xvt_vobj_set_palet(w, p);
|
||||
xvt_palet_destroy(p);
|
||||
}
|
||||
|
||||
// Certified 100%
|
||||
void TImage::set_clut(byte n, COLOR c)
|
||||
{
|
||||
if (xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
xvt_image_set_clut(_image, n, c);
|
||||
}
|
||||
|
||||
// Certified 99%
|
||||
void TImage::convert_to_default_colors()
|
||||
{
|
||||
if (MASK_BACK_COLOR != COLOR_DKCYAN && xvt_image_get_format(_image) == XVT_IMAGE_CL8)
|
||||
{
|
||||
short dx, dy; xvt_image_get_dimensions(_image, &dx, &dy);
|
||||
for (short y = 0; y < dy; y++) for (short x = 0; x < dx; x++)
|
||||
{
|
||||
const COLOR c = xvt_image_get_pixel(_image, x, y);
|
||||
switch (c)
|
||||
{
|
||||
case COLOR_DKCYAN & 0x00FFFFFF:
|
||||
xvt_image_set_pixel(_image, x, y, MASK_BACK_COLOR); break;
|
||||
case COLOR_CYAN & 0x00FFFFFF:
|
||||
xvt_image_set_pixel(_image, x, y, MASK_LIGHT_COLOR); break;
|
||||
case COLOR_GRAY & 0x00FFFFFF:
|
||||
xvt_image_set_pixel(_image, x, y, MASK_DARK_COLOR); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TWindow
|
||||
@ -183,7 +358,7 @@ TWindow::TWindow()
|
||||
|
||||
long XVT_CALLCONV1 TWindow::window_handler(WINDOW win, EVENT* ep)
|
||||
{
|
||||
TWindow* w = (TWindow*)get_app_data(win);
|
||||
TWindow* w = (TWindow*)xvt_vobj_get_data(win);
|
||||
CHECK(w != NULL, "Invalid window");
|
||||
w->handler(win, ep);
|
||||
|
||||
@ -220,7 +395,7 @@ TWindow::~TWindow()
|
||||
{
|
||||
if (_win != NULL_WIN)
|
||||
{
|
||||
close_window(_win);
|
||||
xvt_vobj_destroy(_win);
|
||||
_win = NULL_WIN;
|
||||
}
|
||||
}
|
||||
@ -229,8 +404,9 @@ TWindow::~TWindow()
|
||||
void TWindow::open()
|
||||
{
|
||||
CHECK(win() != NULL_WIN, "Can't open a NULL window");
|
||||
show_window(win(), _open = TRUE);
|
||||
set_front_window(win());
|
||||
xvt_vobj_set_visible(win(), _open = TRUE);
|
||||
xvt_scr_set_focus_vobj(win());
|
||||
xvt_vobj_raise(win());
|
||||
}
|
||||
|
||||
|
||||
@ -247,7 +423,7 @@ void TWindow::open_modal()
|
||||
void TWindow::close()
|
||||
{
|
||||
CHECK(_win != NULL_WIN, "Can't close a NULL window");
|
||||
show_window(_win, _open = FALSE);
|
||||
xvt_vobj_set_visible(_win, _open = FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -299,7 +475,7 @@ void TWindow::handler(WINDOW win, EVENT* ep)
|
||||
stop_run(K_ESC);
|
||||
break;
|
||||
case E_UPDATE:
|
||||
clear_window(win, NORMAL_BACK_COLOR);
|
||||
xvt_dwin_clear(win, NORMAL_BACK_COLOR);
|
||||
update();
|
||||
break;
|
||||
case E_CHAR:
|
||||
@ -317,27 +493,30 @@ void TWindow::handler(WINDOW win, EVENT* ep)
|
||||
TPoint TWindow::size() const
|
||||
{
|
||||
RCT r;
|
||||
get_client_rect(_win ? _win : TASK_WIN, &r);
|
||||
xvt_vobj_get_client_rect(win() ? win() : TASK_WIN, &r);
|
||||
return TPoint(r.right / CHARX, r.bottom / CHARY);
|
||||
}
|
||||
|
||||
WINDOW TWindow::parent() const
|
||||
{
|
||||
return get_parent(win());
|
||||
return xvt_vobj_get_parent(win());
|
||||
}
|
||||
|
||||
|
||||
void TWindow::set_focus()
|
||||
{
|
||||
if (_win)
|
||||
set_front_window(_win);
|
||||
{
|
||||
xvt_scr_set_focus_vobj(_win);
|
||||
xvt_vobj_raise(_win);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TWindow::iconize() const
|
||||
{
|
||||
#if XVTWS != WMWS
|
||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_MINIMIZE);
|
||||
#endif
|
||||
}
|
||||
@ -345,30 +524,30 @@ void TWindow::iconize() const
|
||||
void TWindow::maximize() const
|
||||
{
|
||||
#if XVTWS != WMWS
|
||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
|
||||
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
|
||||
#else
|
||||
RCT r; set_rect(&r, 1,1,79,23);
|
||||
move_window(win(),&r);
|
||||
RCT r; xvt_rect_set(&r, 1,1,79,23);
|
||||
xvt_vobj_move(win(),&r);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TWindow::activate(bool on)
|
||||
{
|
||||
enable_window(win(), _active = on);
|
||||
xvt_vobj_set_enabled(win(), _active = on);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::set_caption(const char* title)
|
||||
{
|
||||
set_title(win(), (char*)title);
|
||||
xvt_vobj_set_title(win(), (char*)title);
|
||||
}
|
||||
|
||||
|
||||
const char* TWindow::get_caption() const
|
||||
{
|
||||
char* title = &__tmp_string[512];
|
||||
get_title(win(), title, 80);
|
||||
xvt_vobj_get_title(win(), title, 80);
|
||||
return title;
|
||||
}
|
||||
|
||||
@ -376,7 +555,7 @@ const char* TWindow::get_caption() const
|
||||
void TWindow::force_update()
|
||||
{
|
||||
if (win() != NULL_WIN)
|
||||
invalidate_rect(win(), NULL);
|
||||
xvt_dwin_invalidate_rect(win(), NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -384,7 +563,7 @@ bool TWindow::save_ctools()
|
||||
{
|
||||
if (_ctools_saved == FALSE)
|
||||
{
|
||||
win_get_draw_ctools(win(), &_ct);
|
||||
xvt_dwin_get_draw_ctools(win(), &_ct);
|
||||
return _ctools_saved = TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -395,7 +574,7 @@ bool TWindow::restore_ctools()
|
||||
{
|
||||
if (_ctools_saved)
|
||||
{
|
||||
win_set_draw_ctools(win(), &_ct);
|
||||
xvt_dwin_set_draw_ctools(win(), &_ct);
|
||||
_ctools_saved = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
@ -405,8 +584,8 @@ bool TWindow::restore_ctools()
|
||||
|
||||
void TWindow::set_color(COLOR fore, COLOR back)
|
||||
{
|
||||
win_set_fore_color(win(), fore);
|
||||
win_set_back_color(win(), back);
|
||||
xvt_dwin_set_fore_color(win(), fore);
|
||||
xvt_dwin_set_back_color(win(), back);
|
||||
}
|
||||
|
||||
|
||||
@ -419,27 +598,27 @@ void TWindow::set_pen(COLOR color, int width, PAT_STYLE pat, PEN_STYLE style)
|
||||
pen.style = style;
|
||||
pen.color = color;
|
||||
|
||||
win_set_cpen(win(), &pen);
|
||||
xvt_dwin_set_cpen(win(), &pen);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::hide_pen()
|
||||
{
|
||||
win_set_std_cpen(win(), TL_PEN_HOLLOW);
|
||||
xvt_dwin_set_std_cpen(win(), TL_PEN_HOLLOW);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::set_brush(COLOR color, PAT_STYLE pat)
|
||||
{
|
||||
CBRUSH brush = { pat, color };
|
||||
win_set_cbrush(win(), &brush);
|
||||
xvt_dwin_set_cbrush(win(), &brush);
|
||||
}
|
||||
|
||||
|
||||
void TWindow::hide_brush()
|
||||
{
|
||||
CBRUSH brush = { PAT_HOLLOW, COLOR_WHITE };
|
||||
win_set_cbrush(win(), &brush);
|
||||
xvt_dwin_set_cbrush(win(), &brush);
|
||||
}
|
||||
|
||||
|
||||
@ -467,7 +646,6 @@ void TWindow::frame(short left, short top, short right, short bottom,
|
||||
set_brush(COLOR_BLACK); // Needed for Windows
|
||||
}
|
||||
|
||||
|
||||
const PNT f = log2dev(left,top);
|
||||
const PNT t = log2dev(right,bottom);
|
||||
RCT r;
|
||||
@ -482,7 +660,7 @@ void TWindow::frame(short left, short top, short right, short bottom,
|
||||
}
|
||||
#endif
|
||||
|
||||
win_draw_rect(win(), &r);
|
||||
xvt_dwin_draw_rect(win(), &r);
|
||||
|
||||
if (saved) restore_ctools();
|
||||
}
|
||||
@ -508,12 +686,12 @@ void TWindow::invert_bar(short left, short top, short right, short bottom)
|
||||
void TWindow::set_opaque_text(bool o)
|
||||
{
|
||||
DRAW_CTOOLS ct;
|
||||
win_get_draw_ctools(win(), &ct);
|
||||
xvt_dwin_get_draw_ctools(win(), &ct);
|
||||
ct.opaque_text = o;
|
||||
win_set_draw_ctools(win(), &ct);
|
||||
xvt_dwin_set_draw_ctools(win(), &ct);
|
||||
}
|
||||
|
||||
void TWindow::set_font(int family, int style, int dim)
|
||||
void TWindow::set_font(const char* family, int style, int dim)
|
||||
{
|
||||
xvt_set_font(win(), family, style, dim);
|
||||
}
|
||||
@ -548,7 +726,7 @@ void TWindow::stringat(short x, short y, const char* str)
|
||||
pnt.v += BASEY;
|
||||
#endif
|
||||
|
||||
win_draw_text(win(), pnt.h, pnt.v, (char *)str, -1);
|
||||
xvt_dwin_draw_text(win(), pnt.h, pnt.v, (char *)str, -1);
|
||||
}
|
||||
|
||||
void TWindow::printat(short x, short y, const char* fmt, ...)
|
||||
@ -573,8 +751,8 @@ void TWindow::line(short x0, short y0, short x1, short y1)
|
||||
if (t.v == 0) t.v = -CHARY; else t.v += CHARY>>1;
|
||||
#endif
|
||||
|
||||
win_move_to(_win, f);
|
||||
win_draw_line(_win, t);
|
||||
xvt_dwin_draw_set_pos(_win, f);
|
||||
xvt_dwin_draw_line(_win, t);
|
||||
}
|
||||
|
||||
void TWindow::icon(short x0, short y0, int iconid)
|
||||
@ -584,15 +762,15 @@ void TWindow::icon(short x0, short y0, int iconid)
|
||||
#else
|
||||
PNT f = log2dev(x0,y0);
|
||||
if (iconid < 0) iconid = ICON_RSRC;
|
||||
win_draw_icon(win(), f.h, f.v, iconid);
|
||||
xvt_dwin_draw_icon(win(), f.h, f.v, iconid);
|
||||
#endif
|
||||
}
|
||||
|
||||
void TWindow::clear(COLOR color)
|
||||
{ clear_window(win(), color); }
|
||||
{ xvt_dwin_clear(win(), color); }
|
||||
|
||||
void TWindow::set_mode(DRAW_MODE mode)
|
||||
{ win_set_draw_mode(win(), mode); }
|
||||
{ xvt_dwin_set_draw_mode(win(), mode); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTemp_window
|
||||
@ -642,14 +820,14 @@ void TScroll_window::set_scroll_max(long maxx, long maxy)
|
||||
if (_has_hscroll && maxx >= 0)
|
||||
{
|
||||
_max.x = maxx;
|
||||
set_scroll_range(win(), HSCROLL, 0, int(maxx));
|
||||
xvt_sbar_set_range(win(), HSCROLL, 0, int(maxx));
|
||||
}
|
||||
if (_has_vscroll && maxy >= 0)
|
||||
{
|
||||
_shift = 0;
|
||||
while ((maxy >> _shift) > 0x7FFF) _shift++;
|
||||
_max.y = maxy;
|
||||
set_scroll_range(win(), VSCROLL, 0, int(maxy >> _shift));
|
||||
xvt_sbar_set_range(win(), VSCROLL, 0, int(maxy >> _shift));
|
||||
}
|
||||
}
|
||||
|
||||
@ -659,9 +837,9 @@ void TScroll_window::update_thumb(long x, long y)
|
||||
if (y >= 0 && y <= _max.y) _origin.y = y;
|
||||
|
||||
if (_has_hscroll)
|
||||
set_scroll_pos(win(), HSCROLL, int(_origin.x));
|
||||
xvt_sbar_set_pos(win(), HSCROLL, int(_origin.x));
|
||||
if (_has_vscroll)
|
||||
set_scroll_pos(win(), VSCROLL, int(_origin.y >> _shift));
|
||||
xvt_sbar_set_pos(win(), VSCROLL, int(_origin.y >> _shift));
|
||||
}
|
||||
|
||||
void TScroll_window::handler(WINDOW win, EVENT* ep)
|
||||
|
@ -1,6 +1,10 @@
|
||||
#ifndef __WINDOW_H
|
||||
#define __WINDOW_H
|
||||
|
||||
#ifndef __OBJECT_H
|
||||
#include <object.h>
|
||||
#endif
|
||||
|
||||
#ifndef __XVTILITY_H
|
||||
#include <xvtility.h>
|
||||
#endif
|
||||
@ -35,6 +39,43 @@ struct TPoint
|
||||
bool operator !=(const TPoint& p) { return p.x != x || p.y != y; }
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TImage
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TImage : public TObject
|
||||
{
|
||||
XVT_IMAGE _image;
|
||||
RCT _src, _dst;
|
||||
|
||||
public:
|
||||
void set_palette(WINDOW w) const;
|
||||
void set_pos(int x, int y);
|
||||
|
||||
void draw(WINDOW w) const ; // Draw at default position with default size
|
||||
void draw(WINDOW w, int x, int y) const; // Draw with default size at x,y
|
||||
void draw(WINDOW w, const RCT& dst) const; // Draw/resize
|
||||
void draw(WINDOW w, const RCT& dst, const RCT& src) const;
|
||||
|
||||
XVT_IMAGE set(XVT_IMAGE i);
|
||||
XVT_IMAGE load(const char* n);
|
||||
XVT_IMAGE load(short id);
|
||||
|
||||
virtual bool ok() const { return _image != NULL; }
|
||||
|
||||
short width() const { return _src.right; }
|
||||
short height() const { return _src.bottom; }
|
||||
const RCT& rect() const { return _src; }
|
||||
|
||||
void convert_to_default_colors();
|
||||
void set_clut(byte n, COLOR c);
|
||||
|
||||
TImage(const char* n);
|
||||
TImage(short id);
|
||||
TImage(const TImage& i, short width, short height);
|
||||
|
||||
virtual ~TImage();
|
||||
};
|
||||
|
||||
// @C
|
||||
// Classe TWindow
|
||||
@ -139,7 +180,7 @@ public:
|
||||
void hide_pen(); // Nasconde la penna
|
||||
void hide_brush(); // Nasconde il pennello
|
||||
void set_brush(COLOR color, PAT_STYLE = PAT_SOLID); // Sceglie pennello con colore color
|
||||
void set_font(int family = FF_SYSTEM, int style = 0, int dim = 0); // Sceglie il font
|
||||
void set_font(const char* family = XVT_FFN_FIXED, int style = 0, int dim = 0); // Sceglie il font
|
||||
|
||||
// Disegna un rettangolo con la possibilita' di settare la penna e il draw_mode
|
||||
void frame(short left, short top, short right, short bottom, int flag);
|
||||
|
@ -19,6 +19,8 @@ void fatal_hook()
|
||||
}
|
||||
#endif
|
||||
|
||||
HIDDEN XVT_FNTID DEF_FONT = NULL;
|
||||
|
||||
#if XVTWS == WMWS
|
||||
|
||||
short CHARX = 8;
|
||||
@ -39,9 +41,7 @@ COLOR FOCUS_BACK_COLOR = COLOR_WHITE;
|
||||
#else
|
||||
|
||||
#include <windows.h>
|
||||
#ifdef __CTL3D__
|
||||
#include <ctl3d.h>
|
||||
#endif
|
||||
|
||||
HIDDEN COLORREF COLOR2RGB(COLOR c)
|
||||
{
|
||||
@ -56,7 +56,7 @@ HIDDEN COLOR RGB2COLOR(COLORREF c)
|
||||
const byte red = byte(c & 0xFF);
|
||||
const byte gre = byte((c >> 8) & 0xFF);
|
||||
const byte blu = byte((c >> 16) & 0xFF);
|
||||
return MAKE_COLOR(red, gre, blu);
|
||||
return XVT_MAKE_COLOR(red, gre, blu);
|
||||
}
|
||||
|
||||
#ifndef XVT_CALLCONV1
|
||||
@ -100,6 +100,62 @@ HIDDEN HBRUSH FocusBrush = 0;
|
||||
|
||||
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
|
||||
// By Matt Pietrek
|
||||
bool allow_another_instance()
|
||||
{
|
||||
HINSTANCE hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
|
||||
HMODULE hModuleSel = SELECTOROF( // Convert the HINSTANCE to an HMODULE
|
||||
GlobalLock(GetModuleHandle((const char*)MAKELP(0,hInstance))));
|
||||
|
||||
if ( hModuleSel == 0 ) // Make sure we succeeded.
|
||||
return 0;
|
||||
|
||||
// Make pointers to the resident names table and the OFSTRUCT
|
||||
LPSTR moduleName = (LPSTR)MAKELP( hModuleSel, *(WORD FAR *)MAKELP(hModuleSel, 0x26));
|
||||
LPSTR fileName = (LPSTR)MAKELP( hModuleSel, *(WORD FAR *)MAKELP(hModuleSel, 0x0A));
|
||||
|
||||
// Get the module name length, and advance to the actual string
|
||||
BYTE cbModuleName = *moduleName++; // First byte is a length byte
|
||||
|
||||
// Convert the first uppercase letter of the modulename to lowercase
|
||||
while ( cbModuleName )
|
||||
{
|
||||
if ( isupper(*moduleName) )
|
||||
{
|
||||
*moduleName = tolower(*moduleName); break;
|
||||
}
|
||||
cbModuleName--; moduleName++;
|
||||
}
|
||||
|
||||
if ( cbModuleName == 0 ) // Make sure we succeeded
|
||||
return FALSE;
|
||||
|
||||
// Position to the end of the filename. First byte is a length byte
|
||||
fileName += *fileName - 1;
|
||||
|
||||
// Find the first uppercase letter in the filename. Convert to lowercase
|
||||
while ( TRUE )
|
||||
{
|
||||
// Stop when we come to a directory separator or colon
|
||||
if ( (*fileName=='\\') || (*fileName=='/') || (*fileName==':') )
|
||||
return 0;
|
||||
|
||||
if ( isupper(*fileName) )
|
||||
{
|
||||
*fileName = tolower(*fileName); break;
|
||||
}
|
||||
fileName--;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static BOOLEAN event_hook(HWND hwnd,
|
||||
UINT msg,
|
||||
UINT wparam,
|
||||
@ -108,16 +164,14 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
#ifdef __CTL3D__
|
||||
case WM_SYSCOLORCHANGE:
|
||||
Ctl3dColorChange();
|
||||
break;
|
||||
#endif
|
||||
case WM_CTLCOLOR:
|
||||
{
|
||||
#ifdef __CTL3D__
|
||||
*ret = Ctl3dCtlColorEx(msg, wparam, lparam);
|
||||
return TRUE;
|
||||
return FALSE; // Non fare altro
|
||||
#else
|
||||
const word type = HIWORD(lparam);
|
||||
if (type == CTLCOLOR_LISTBOX || type == CTLCOLOR_EDIT ||
|
||||
@ -134,7 +188,7 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
SetBkColor(hdc, MaskColor);
|
||||
}
|
||||
*ret = MaskBrush;
|
||||
return TRUE;
|
||||
return FALSE; // Non fare altro
|
||||
}
|
||||
|
||||
bool focus = GetFocus() == hwnd;
|
||||
@ -144,7 +198,7 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
SetBkColor(hdc, focus ? FocusBackColor : NormalBackColor);
|
||||
}
|
||||
*ret = focus ? FocusBrush : NormalBrush;
|
||||
return TRUE;
|
||||
return FALSE; // Non fare altro
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -161,33 +215,39 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
|
||||
wparam == VK_UP || wparam == VK_DOWN )
|
||||
wparam == VK_UP || wparam == VK_DOWN ||
|
||||
wparam == VK_F1 )
|
||||
{
|
||||
KEY key = 0;
|
||||
char name[16];
|
||||
GetClassName(hwnd, name, 5);
|
||||
if (stricmp(name, "Edit") == 0)
|
||||
|
||||
if (stricmp(name, "Edit") == 0) switch(wparam)
|
||||
{
|
||||
KEY key;
|
||||
switch(wparam)
|
||||
{
|
||||
case VK_PRIOR:
|
||||
key = K_PREV; break;
|
||||
case VK_NEXT:
|
||||
key = K_NEXT; break;
|
||||
case VK_UP:
|
||||
key = K_UP; break;
|
||||
case VK_DOWN:
|
||||
key = K_DOWN; break;
|
||||
default:
|
||||
key = 0; break;
|
||||
}
|
||||
if (key > 0)
|
||||
{
|
||||
WINDOW w = cur_win();
|
||||
if (w != NULL_WIN)
|
||||
dispatch_e_char(w, key);
|
||||
}
|
||||
case VK_PRIOR:
|
||||
key = K_PREV; break;
|
||||
case VK_NEXT:
|
||||
key = K_NEXT; break;
|
||||
case VK_UP:
|
||||
key = K_UP; break;
|
||||
case VK_DOWN:
|
||||
key = K_DOWN; break;
|
||||
default:
|
||||
key = 0; break;
|
||||
}
|
||||
|
||||
if (wparam == VK_F1)
|
||||
key = K_F1;
|
||||
|
||||
if (key > 0)
|
||||
{
|
||||
WINDOW w = cur_win();
|
||||
if (w != NULL_WIN)
|
||||
{
|
||||
dispatch_e_char(w, key);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WM_MENUCHAR:
|
||||
@ -207,7 +267,7 @@ static BOOLEAN event_hook(HWND hwnd,
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return TRUE; // Continua col processo normale
|
||||
}
|
||||
|
||||
|
||||
@ -235,12 +295,12 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
|
||||
if (parent != TASK_WIN)
|
||||
{
|
||||
if (get_window_type(parent) == W_PLAIN) // Mask with Toolbar
|
||||
if (xvt_vobj_get_type(parent) == W_PLAIN) // Mask with Toolbar
|
||||
{
|
||||
if (y >= 0) y++;
|
||||
if (x > 0 || (wt != WO_TE && x == 0))
|
||||
{
|
||||
RCT pc; get_client_rect(parent, &pc); // Get parent window size
|
||||
RCT pc; xvt_vobj_get_client_rect(parent, &pc); // Get parent window size
|
||||
const int width = pc.right;
|
||||
const int tot = 80*CHARX;
|
||||
if (width > tot) x += (width-tot) / (CHARX<<1);
|
||||
@ -284,7 +344,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
{
|
||||
RCT pc;
|
||||
if (parent == NULL_WIN) parent = TASK_WIN;
|
||||
get_client_rect(parent, &pc); // Get parent window size
|
||||
xvt_vobj_get_client_rect(parent, &pc); // Get parent window size
|
||||
const short MAXX = pc.right;
|
||||
const short MAXY = pc.bottom;
|
||||
|
||||
@ -333,7 +393,7 @@ RCT& resize_rect(short x, short y, short dx, short dy, WIN_TYPE wt, WINDOW paren
|
||||
|
||||
|
||||
void beep()
|
||||
{ xvt_beep(); }
|
||||
{ xvt_scr_beep(); }
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -362,7 +422,7 @@ void TEvent_manager::push(WINDOW w, const EVENT& e)
|
||||
_e[_end] = e;
|
||||
const int next = (_end+1) % MAX;
|
||||
if (next == _begin)
|
||||
warning_box("Hey %s, clicca piu' piano!", (const char*)main_app().user());
|
||||
warning_box("Hey, clicca piu' piano!");
|
||||
else
|
||||
_end = next;
|
||||
}
|
||||
@ -373,13 +433,13 @@ void TEvent_manager::pop()
|
||||
{
|
||||
const int i = _begin;
|
||||
_begin = (++_begin) % MAX; // Other events may occur!
|
||||
dispatch_event(_w[i], &_e[i]);
|
||||
xvt_win_dispatch_event(_w[i], &_e[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void do_events()
|
||||
{
|
||||
process_events();
|
||||
xvt_app_process_pending_events();
|
||||
EM.pop();
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
nap(20);
|
||||
@ -426,7 +486,6 @@ void dispatch_e_char(WINDOW win, KEY key)
|
||||
EM.push(win, e);
|
||||
}
|
||||
|
||||
|
||||
void dispatch_e_scroll(WINDOW win, KEY key)
|
||||
{
|
||||
EVENT e;
|
||||
@ -484,7 +543,7 @@ void dispatch_e_scroll(WINDOW win, KEY key)
|
||||
break;
|
||||
};
|
||||
|
||||
if (w != SC_NONE) dispatch_event(win, &e);
|
||||
if (w != SC_NONE) xvt_win_dispatch_event(win, &e);
|
||||
}
|
||||
|
||||
void customize_controls(bool on)
|
||||
@ -501,25 +560,23 @@ void customize_controls(bool on)
|
||||
FOCUS_COLOR = colors.get_color("Focus", NULL, -1, FOCUS_COLOR);
|
||||
FOCUS_BACK_COLOR = colors.get_color("FocusBack", NULL, -1, FOCUS_BACK_COLOR);
|
||||
|
||||
#if XVTWS == WMWS
|
||||
if (on)
|
||||
{
|
||||
// set_value(NULL_WIN,ATTR_CH_SHADOW,XVT_CH_SHADOW_WINDOW|XVT_CH_SHADOW_DIALOG);
|
||||
set_value(NULL_WIN, ATTR_CH_TOGGLE_COMBO, (long)K_F9);
|
||||
}
|
||||
#if XVTWS == WMWS
|
||||
// xvt_vobj_set_attr(NULL_WIN,ATTR_CH_SHADOW,XVT_CH_SHADOW_WINDOW|XVT_CH_SHADOW_DIALOG);
|
||||
xvt_vobj_set_attr(NULL_WIN, ATTR_CH_TOGGLE_COMBO, (long)K_F9);
|
||||
#endif
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (on)
|
||||
{
|
||||
set_value(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
||||
set_value(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||
set_value(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
||||
#ifdef __CTL3D__
|
||||
HINSTANCE _hInstance = (HINSTANCE)get_value(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
||||
allow_another_instance();
|
||||
|
||||
HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
Ctl3dRegister(_hInstance);
|
||||
Ctl3dAutoSubclass(_hInstance);
|
||||
#else
|
||||
|
||||
MaskColor = COLOR2RGB(MASK_BACK_COLOR);
|
||||
MaskBrush = CreateSolidBrush(MaskColor);
|
||||
|
||||
@ -533,87 +590,107 @@ void customize_controls(bool on)
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef __CTL3D__
|
||||
HINSTANCE _hInstance = (HINSTANCE)get_value(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||
Ctl3dUnregister(_hInstance);
|
||||
#else
|
||||
|
||||
DeleteObject(NormalFont);
|
||||
DeleteObject(MaskBrush);
|
||||
DeleteObject(NormalBrush);
|
||||
DeleteObject(FocusBrush);
|
||||
#endif
|
||||
|
||||
free_controls_bmp();
|
||||
#endif
|
||||
xvt_font_destroy(DEF_FONT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DBG
|
||||
if (on) set_value(NULL_WIN,ATTR_FATAL_ERR_HANDLER, (long)fatal_hook);
|
||||
if (on) xvt_vobj_set_attr(NULL_WIN,ATTR_FATAL_ERR_HANDLER, (long)fatal_hook);
|
||||
#endif
|
||||
}
|
||||
|
||||
XVT_FNTID xvt_default_font()
|
||||
{
|
||||
if (DEF_FONT == NULL)
|
||||
{
|
||||
DEF_FONT = xvt_dwin_get_font(TASK_WIN);
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
void xvt_init_font()
|
||||
{
|
||||
NormalFont = GetStockObject(ANSI_FIXED_FONT);
|
||||
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
|
||||
NormalFont = GetStockObject(ANSI_FIXED_FONT);
|
||||
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
|
||||
|
||||
TConfig font(CONFIG_GENERAL, "Font");
|
||||
CHARY = (int)font.get_long("Height");
|
||||
if (CHARY > 0)
|
||||
{
|
||||
LogFont.lfHeight = CHARY;
|
||||
LogFont.lfWidth = (int)font.get_long("Width");
|
||||
LogFont.lfWeight = FontWeight = (int)font.get_long("Weight");
|
||||
LogFont.lfCharSet = (int)font.get_long("CharSet");
|
||||
LogFont.lfPitchAndFamily = (int)font.get_long("Pitch");
|
||||
strcpy(LogFont.lfFaceName, font.get("Name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFont.lfHeight = CHARY = 10;
|
||||
FontWeight = 400;
|
||||
}
|
||||
NormalFont = CreateFontIndirect(&LogFont);
|
||||
xvt_set_font(TASK_WIN, FF_FIXED, 0);
|
||||
TConfig font(CONFIG_GENERAL, "Font");
|
||||
CHARY = (int)font.get_long("Height");
|
||||
if (CHARY > 0)
|
||||
{
|
||||
LogFont.lfHeight = CHARY;
|
||||
LogFont.lfWeight = FontWeight = font.get_int("Weight");
|
||||
LogFont.lfPitchAndFamily = font.get_int("Pitch");
|
||||
strcpy(LogFont.lfFaceName, font.get("Name"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFont.lfHeight = CHARY = 10;
|
||||
FontWeight = 300; // Normal weight
|
||||
}
|
||||
NormalFont = CreateFontIndirect(&LogFont);
|
||||
|
||||
TToken_string desc(128, '/');
|
||||
desc.add("WIN01");
|
||||
desc.add(LogFont.lfHeight);
|
||||
desc.add(LogFont.lfWidth);
|
||||
desc.add(LogFont.lfEscapement);
|
||||
desc.add(LogFont.lfOrientation);
|
||||
desc.add(LogFont.lfWeight);
|
||||
desc.add(LogFont.lfItalic);
|
||||
desc.add(LogFont.lfUnderline);
|
||||
desc.add(LogFont.lfStrikeOut);
|
||||
desc.add(LogFont.lfCharSet);
|
||||
desc.add(LogFont.lfOutPrecision);
|
||||
desc.add(LogFont.lfClipPrecision);
|
||||
desc.add(LogFont.lfQuality);
|
||||
desc.add(LogFont.lfPitchAndFamily);
|
||||
desc.add(LogFont.lfFaceName);
|
||||
|
||||
xvt_font_set_native_desc(DEF_FONT, (char*)(const char*)desc);
|
||||
CHECK(xvt_font_has_valid_native_desc(DEF_FONT), "Bad font description");
|
||||
xvt_font_map_using_default(DEF_FONT);
|
||||
CHECK(xvt_font_is_mapped(DEF_FONT), "Can't map native font");
|
||||
xvt_dwin_set_font(TASK_WIN, DEF_FONT);
|
||||
|
||||
// Get true text size
|
||||
TEXTMETRIC tm;
|
||||
HWND hdc = (HDC)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_GRAPHIC_CONTEXT);
|
||||
GetTextMetrics(hdc, &tm);
|
||||
|
||||
const int COLX = GetSystemMetrics(SM_CXSCREEN) / 80;
|
||||
CHARX = tm.tmAveCharWidth+1;
|
||||
if (CHARX > COLX) CHARX = COLX;
|
||||
|
||||
// Get true text size
|
||||
TEXTMETRIC tm;
|
||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
HDC hdc = GetDC(hwnd);
|
||||
GetTextMetrics(hdc, &tm);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
|
||||
const int COLX = GetSystemMetrics(SM_CXSCREEN) / 80;
|
||||
CHARX = tm.tmAveCharWidth+1;
|
||||
if (CHARX > COLX) CHARX = COLX;
|
||||
|
||||
CHARY = tm.tmHeight;
|
||||
BASEY = tm.tmAscent;
|
||||
if (CHARY > ROWY-2) CHARY = ROWY-2;
|
||||
}
|
||||
CHARY = tm.tmHeight;
|
||||
BASEY = tm.tmAscent;
|
||||
if (CHARY > ROWY-2) CHARY = ROWY-2;
|
||||
}
|
||||
#endif
|
||||
|
||||
void xvt_set_font(WINDOW win, int family, int style, int dim)
|
||||
return DEF_FONT;
|
||||
}
|
||||
|
||||
void xvt_set_font(WINDOW win, const char* family, int style, int dim)
|
||||
{
|
||||
CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (dim < 1)
|
||||
{
|
||||
LogFont.lfWeight = FontWeight + ((style & FS_BOLD) ? 300 : 0);
|
||||
LogFont.lfItalic = (style & FS_ITALIC) ? TRUE : FALSE;
|
||||
set_value(NULL_WIN, ATTR_WIN_PM_LOGFONT, (long)&LogFont);
|
||||
set_value(NULL_WIN, ATTR_WIN_PM_USERFONT, TRUE);
|
||||
win_set_font(win, NULL, FALSE);
|
||||
set_value(NULL_WIN, ATTR_WIN_PM_USERFONT, FALSE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
FONT font;
|
||||
select_font(family, style, dim < 1 ? CHARY : dim, &font);
|
||||
win_set_font(win, &font, FALSE);
|
||||
XVT_FNTID font = xvt_dwin_get_font(TASK_WIN);
|
||||
if (family && *family) xvt_font_set_family(font, (char*)family);
|
||||
if (dim != 0) xvt_font_set_size(font, dim);
|
||||
if (style != XVT_FS_NONE) xvt_font_set_style(font, style);
|
||||
|
||||
if(!xvt_font_is_mapped(font));
|
||||
xvt_font_map(font, win);
|
||||
|
||||
xvt_dwin_set_font(win, font);
|
||||
xvt_font_destroy(font);
|
||||
}
|
||||
|
||||
|
||||
@ -629,19 +706,19 @@ WINDOW xvt_create_window(WIN_TYPE wt,
|
||||
RCT& rect = resize_rect(x, y, dx, dy, wt, parent);
|
||||
|
||||
if (wt == WD_MODAL) wt = W_DOC;
|
||||
WINDOW win = create_window(wt,
|
||||
&rect,
|
||||
(char*)caption,
|
||||
menu, parent,
|
||||
flags,
|
||||
EM_ALL, eh,
|
||||
app_data);
|
||||
WINDOW win = xvt_win_create(wt,
|
||||
&rect,
|
||||
(char*)caption,
|
||||
menu, parent,
|
||||
flags,
|
||||
EM_ALL, eh,
|
||||
app_data);
|
||||
|
||||
CHECKD(win, "Can't create a window: XVT error ", get_xvterrno());
|
||||
CHECK(win, "Can't create a window: XVT error");
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
static bool to_set = TRUE;
|
||||
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
|
||||
if (to_set)
|
||||
{
|
||||
word style = GetClassWord(hwnd, GCW_STYLE);
|
||||
@ -715,11 +792,11 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
||||
}
|
||||
|
||||
while (*caption == '@') caption += 2;
|
||||
win = create_control(wt, &r, (char*)caption, parent,
|
||||
win = xvt_ctl_create(wt, &r, (char*)caption, parent,
|
||||
flags, app_data, id);
|
||||
|
||||
if (win == NULL_WIN)
|
||||
fatal_box("Can't create control %d: XVT error %d", id, get_xvterrno());
|
||||
fatal_box("Can't create control %d", id);
|
||||
}
|
||||
|
||||
|
||||
@ -730,14 +807,10 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
||||
if (wt == WC_EDIT || wt == WC_LISTBUTTON)
|
||||
#endif
|
||||
{
|
||||
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
|
||||
HWND hwnd = (HWND)xvt_vobj_get_attr(win, ATTR_NATIVE_WINDOW);
|
||||
SendMessage(hwnd, WM_SETFONT, NormalFont, FALSE);
|
||||
if (_bandiere & CTL_FLAG_MAC_MONACO9)
|
||||
SendMessage(hwnd, EM_SETPASSWORDCHAR, (WORD)'#', 0);
|
||||
#ifdef DBG
|
||||
DWORD stylecheck = GetWindowLong(hwnd, GWL_STYLE);
|
||||
stylecheck |= 0;
|
||||
#endif
|
||||
#ifdef __CTL3D__
|
||||
Ctl3dSubclassCtl(hwnd);
|
||||
#endif
|
||||
@ -754,7 +827,7 @@ const char* xvt_get_title(WINDOW win)
|
||||
const TControl* c = TControl::WINDOW2TControl(win);
|
||||
return c->caption();
|
||||
#else
|
||||
get_title(win, __tmp_string, 80);
|
||||
xvt_vobj_get_title(win, __tmp_string, 80);
|
||||
return __tmp_string;
|
||||
#endif
|
||||
}
|
||||
@ -765,7 +838,7 @@ void xvt_set_title(WINDOW win, const char* cap)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
c->set_caption(cap);
|
||||
#else
|
||||
set_title(win, cap);
|
||||
xvt_vobj_set_title(win, cap);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -776,7 +849,7 @@ void xvt_set_front_control(WINDOW win)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
c->focus(TRUE);
|
||||
#endif
|
||||
set_front_window(win);
|
||||
xvt_scr_set_focus_vobj(win);
|
||||
}
|
||||
|
||||
|
||||
@ -786,7 +859,7 @@ void xvt_enable_control(WINDOW win, bool on)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
c->enable(on);
|
||||
#else
|
||||
enable_window(win, on);
|
||||
xvt_vobj_set_enabled(win, on);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -797,7 +870,7 @@ void xvt_check_box(WINDOW win, bool on)
|
||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||
c->check(on);
|
||||
#else
|
||||
win_check_box(win, on);
|
||||
xvt_ctl_set_checked(win, on);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -808,7 +881,7 @@ bool xvt_get_checked_state(WINDOW win)
|
||||
TControl* c = TControl::WINDOW2TControl(win);
|
||||
return c->checked();
|
||||
#else
|
||||
return get_checked_state(win) ? TRUE : FALSE;
|
||||
return xvt_ctl_is_checked(win) ? TRUE : FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -819,7 +892,7 @@ void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
||||
for (int i = 0; i < count; i++)
|
||||
xvt_check_box(ctls[i], ctls[i] == win);
|
||||
#else
|
||||
win_check_radio_button(win, (WINDOW*)ctls, count);
|
||||
xvt_ctl_check_radio_button(win, (WINDOW*)ctls, count);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -841,11 +914,11 @@ int xvt_get_checked_radio(const WINDOW* ctls, int count)
|
||||
// Gestione Status bar
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
HIDDEN WINDOW statbar = NULL_WIN;
|
||||
HIDDEN WINDOW _statbar = NULL_WIN;
|
||||
|
||||
WINDOW xvt_create_statbar()
|
||||
{
|
||||
CHECK(statbar == NULL_WIN, "Onli uan stabar, plis");
|
||||
CHECK(_statbar == NULL_WIN, "Onli uan stabar, plis");
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
const int prop_count = 4;
|
||||
@ -858,15 +931,15 @@ WINDOW xvt_create_statbar()
|
||||
NULL
|
||||
};
|
||||
|
||||
statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
|
||||
TASK_WIN, 0, 0, "");
|
||||
_statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
|
||||
TASK_WIN, 0, 0, "");
|
||||
CHECK(_statbar, "Can't create the status bar");
|
||||
|
||||
xvt_init_font();
|
||||
DRAW_CTOOLS ct; win_get_draw_ctools(TASK_WIN, &ct);
|
||||
statbar_set_font(statbar, &ct.font);
|
||||
statbar_set_fontid(_statbar, xvt_default_font());
|
||||
|
||||
#endif
|
||||
|
||||
return statbar;
|
||||
return _statbar;
|
||||
}
|
||||
|
||||
void xvt_statbar_set(const char* text, bool def)
|
||||
@ -876,15 +949,15 @@ void xvt_statbar_set(const char* text, bool def)
|
||||
TString256 t(text);
|
||||
t << '\t' << oggi.string() << " - " << main_app().title();
|
||||
if (def)
|
||||
statbar_set_default_title(statbar, (char*)(const char*)t);
|
||||
statbar_set_title(statbar, (char*)(const char*)t);
|
||||
statbar_set_default_title(_statbar, (char*)(const char*)t);
|
||||
statbar_set_title(_statbar, (char*)(const char*)t);
|
||||
#endif
|
||||
}
|
||||
|
||||
void xvt_statbar_refresh()
|
||||
{
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
statbar_set_title(statbar, NULL);
|
||||
statbar_set_title(_statbar, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -910,9 +983,9 @@ HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag)
|
||||
|
||||
bool xvt_test_menu_tag(MENU_TAG tag)
|
||||
{
|
||||
MENU_ITEM *mi = win_menu_fetch(TASK_WIN);
|
||||
MENU_ITEM *mi = xvt_menu_get_tree(TASK_WIN);
|
||||
const bool ok = test_menu_tag(mi, tag);
|
||||
menu_free(mi);
|
||||
xvt_res_free_menu_tree(mi);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -921,41 +994,65 @@ bool xvt_test_menu_tag(MENU_TAG tag)
|
||||
// used by print functions
|
||||
|
||||
COLOR trans_color(char c)
|
||||
{
|
||||
{
|
||||
COLOR col;
|
||||
switch (c)
|
||||
{
|
||||
case 'n': return COLOR_BLACK; break;
|
||||
case 'r': return COLOR_RED; break;
|
||||
case 'g': return COLOR_GREEN; break;
|
||||
case 'b': return COLOR_BLUE; break;
|
||||
case 'c': return COLOR_CYAN; break;
|
||||
case 'y': return COLOR_YELLOW; break;
|
||||
case 'v': return COLOR_MAGENTA; break;
|
||||
case 'w': return COLOR_WHITE; break;
|
||||
case 'm': return MASK_BACK_COLOR; break;
|
||||
case 'd': return COLOR_DKGRAY; break;
|
||||
case 'l': return COLOR_LTGRAY; break;
|
||||
case 'k': return COLOR_GRAY; break;
|
||||
default: CHECK(0,"trans_color: Undefined color"); break;
|
||||
}
|
||||
return -1;
|
||||
case 'b':
|
||||
col = COLOR_BLUE; break;
|
||||
case 'c':
|
||||
col = COLOR_CYAN; break;
|
||||
case 'd':
|
||||
col = COLOR_DKGRAY; break;
|
||||
case 'g':
|
||||
col = COLOR_GREEN; break;
|
||||
case 'k':
|
||||
col = COLOR_GRAY; break;
|
||||
case 'l':
|
||||
col = COLOR_LTGRAY; break;
|
||||
case 'm':
|
||||
col = MASK_BACK_COLOR; break;
|
||||
case 'n':
|
||||
col = COLOR_BLACK; break;
|
||||
case 'r':
|
||||
col = COLOR_RED; break;
|
||||
case 'v':
|
||||
col = COLOR_MAGENTA; break;
|
||||
case 'w':
|
||||
col = COLOR_WHITE; break;
|
||||
case 'y':
|
||||
col = COLOR_YELLOW; break;
|
||||
default:
|
||||
CHECK(0,"trans_color: Undefined color"); break;
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
PAT_STYLE trans_brush(char p)
|
||||
{
|
||||
switch (p)
|
||||
{
|
||||
case 'n' : return PAT_NONE; break;
|
||||
case 'h' : return PAT_HOLLOW; break;
|
||||
case 's' : return PAT_SOLID; break;
|
||||
case '-' : return PAT_HORZ; break;
|
||||
case '|' : return PAT_VERT; break;
|
||||
case '/' : return PAT_FDIAG; break;
|
||||
case '\\': return PAT_BDIAG; break;
|
||||
case 'X' : return PAT_DIAGCROSS; break;
|
||||
case '+' : return PAT_CROSS; break;
|
||||
default : CHECK(0,"trans_brush: Undefined pattern"); break;
|
||||
}
|
||||
case 'n' :
|
||||
return PAT_NONE; break;
|
||||
case 'h' :
|
||||
return PAT_HOLLOW; break;
|
||||
case 's' :
|
||||
return PAT_SOLID; break;
|
||||
case '-' :
|
||||
return PAT_HORZ; break;
|
||||
case '|' :
|
||||
return PAT_VERT; break;
|
||||
case '/' :
|
||||
return PAT_FDIAG; break;
|
||||
case '\\':
|
||||
return PAT_BDIAG; break;
|
||||
case 'X' :
|
||||
return PAT_DIAGCROSS; break;
|
||||
case '+' :
|
||||
return PAT_CROSS; break;
|
||||
default :
|
||||
CHECK(0,"trans_brush: Undefined pattern"); break;
|
||||
}
|
||||
return PAT_NONE;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ WINDOW xvt_create_window
|
||||
void dispatch_e_char(WINDOW win, KEY key);
|
||||
void dispatch_e_scroll(WINDOW win, KEY key);
|
||||
|
||||
void xvt_set_font(WINDOW win, int family, int style, int dim = 0);
|
||||
void xvt_set_font(WINDOW win, const char* family, int style, int dim = 0);
|
||||
void xvt_set_front_control(WINDOW win);
|
||||
const char* xvt_get_title(WINDOW win);
|
||||
void xvt_set_title(WINDOW win, const char* title);
|
||||
@ -63,7 +63,6 @@ WINDOW xvt_create_window
|
||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
||||
int xvt_get_checked_radio(const WINDOW* ctls, int count);
|
||||
void xvt_change_page_tags(WINDOW pag, bool on, WINDOW tag, byte p);
|
||||
PICTURE xvt_picture_load(short id, bool convert_colors = FALSE);
|
||||
|
||||
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user