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
126
ba/ba0.cpp
126
ba/ba0.cpp
@ -1,4 +1,5 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
|
#include <colors.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <isam.h>
|
#include <isam.h>
|
||||||
@ -14,10 +15,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include <cpb.h>
|
|
||||||
}
|
|
||||||
#include <dos.h>
|
#include <dos.h>
|
||||||
#else
|
#else
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
@ -32,53 +29,35 @@ extern "C"
|
|||||||
|
|
||||||
class TPicture_mask : public TMask
|
class TPicture_mask : public TMask
|
||||||
{
|
{
|
||||||
static short _id;
|
TImage _image;
|
||||||
static PICTURE _picture;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handler(WINDOW win, EVENT* ep);
|
virtual void handler(WINDOW win, EVENT* ep);
|
||||||
void set_picture(short id);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TPicture_mask(const char* name, int dx, int dy, short picture_id);
|
TPicture_mask(const char* name, int dx, int dy, short id);
|
||||||
void reset();
|
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 (id == 0 && MASK_BACK_COLOR != COLOR_DKCYAN)
|
||||||
#if XVT_OS == XVT_OS_WIN
|
_image.set_clut(6, MASK_BACK_COLOR);
|
||||||
if (_picture)
|
else
|
||||||
picture_free(_picture); // xvt_pict_destroy(_picture);
|
_image.set_palette(win());
|
||||||
|
_image.set_pos(1, 1);
|
||||||
_picture = xvt_picture_load(id, FALSE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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 (ep->type == E_UPDATE)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (_picture)
|
if (_image.ok())
|
||||||
cpb_win_picture_draw_at(win, _picture, 1, 1);
|
{
|
||||||
|
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
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -124,7 +109,7 @@ class TMenu_application : public TApplication
|
|||||||
static bool _find_button;
|
static bool _find_button;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void test_temp() const;
|
void test_temp();
|
||||||
void load_menu();
|
void load_menu();
|
||||||
int do_level();
|
int do_level();
|
||||||
int find_menu(const char* s) const;
|
int find_menu(const char* s) const;
|
||||||
@ -192,11 +177,11 @@ bool TMenu_application::build_firm_data(long codditta, bool flagcom)
|
|||||||
TDir dir, dir1;
|
TDir dir, dir1;
|
||||||
TTrec rec;
|
TTrec rec;
|
||||||
|
|
||||||
prefhndl->set("");
|
prefix().set("");
|
||||||
dir1.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
dir1.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||||
const long maxeod0 = dir1.eod();
|
const long maxeod0 = dir1.eod();
|
||||||
|
|
||||||
prefhndl->set_codditta(codditta);
|
prefix().set_codditta(codditta);
|
||||||
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
dir.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||||
if (dir.eod() == 0)
|
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++)
|
for (int i = LF_DIR + 1; i <= maxeod0; i++)
|
||||||
{
|
{
|
||||||
p.addstatus(1);
|
p.addstatus(1);
|
||||||
prefhndl->set("");
|
prefix().set("");
|
||||||
dir.get(i, _nolock, _nordir, _sysdirop);
|
dir.get(i, _nolock, _nordir, _sysdirop);
|
||||||
rec.get(i);
|
rec.get(i);
|
||||||
bool create_now = dir.is_active();
|
bool create_now = dir.is_active();
|
||||||
|
|
||||||
prefhndl->set_codditta(codditta);
|
prefix().set_codditta(codditta);
|
||||||
dir.put(i, _nordir, _sysdirop);
|
dir.put(i, _nordir, _sysdirop);
|
||||||
rec.put(i);
|
rec.put(i);
|
||||||
const char* name = dir.name();
|
const char* name = dir.name();
|
||||||
@ -394,11 +379,11 @@ int TMenu_application::do_level()
|
|||||||
TToken_string& row = (TToken_string&)_menu[first];
|
TToken_string& row = (TToken_string&)_menu[first];
|
||||||
const TString80 head(row.get(1));
|
const TString80 head(row.get(1));
|
||||||
|
|
||||||
const int width = 72;
|
const int width = 74;
|
||||||
const int height = 18;
|
const int height = 18;
|
||||||
const int bwidth = 20;
|
const int bwidth = 20;
|
||||||
const int x = width-bwidth-12;
|
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);
|
TPicture_mask menu(head, width, height, pic);
|
||||||
|
|
||||||
int y = 1;
|
int y = 1;
|
||||||
@ -454,34 +439,35 @@ int TMenu_application::do_level()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TMenu_application::test_temp() const
|
void TMenu_application::test_temp()
|
||||||
{
|
{
|
||||||
|
begin_wait();
|
||||||
|
|
||||||
TFilename dir; dir.tempdir(); // Directory temporanea
|
TFilename dir; dir.tempdir(); // Directory temporanea
|
||||||
|
dir << '/' << '*';
|
||||||
|
TToken_string files(dir);
|
||||||
|
const int count = list_files(files);
|
||||||
|
|
||||||
TFilename name;
|
end_wait();
|
||||||
name << dir << "/" << "*.*"; // Cerca tutti i file
|
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
if (count > 0 && yesno_box("Cancellare %d file temporane%c in %s?",
|
||||||
struct _find_t f;
|
count, (count > 1) ? 'i' : 'o', dir.path()))
|
||||||
if (_dos_findfirst(name, _A_NORMAL, &f) == 0 &&
|
|
||||||
yesno_box("Cancellare i file temporanei?"))
|
|
||||||
{
|
{
|
||||||
TIndwin pi(40, "Cancellazione file temporanei", FALSE, FALSE);
|
TProgind bar(count, "Cancellazione file temporanei", TRUE, TRUE);
|
||||||
do
|
for (const char* e = files.get(0); e; e = files.get())
|
||||||
{
|
{
|
||||||
name = dir;
|
if (bar.iscancelled()) break;
|
||||||
name << "/" << f.name;
|
remove(e);
|
||||||
remove(name);
|
bar.addstatus(1);
|
||||||
} while (_dos_findnext(&f) == 0);
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TMenu_application::check_user()
|
bool TMenu_application::check_user()
|
||||||
{
|
{
|
||||||
TMask m("ba0100a");
|
TMask m("ba0100a");
|
||||||
TLocalisamfile users(LF_USER);
|
TLocalisamfile users(LF_USER);
|
||||||
TString16 user, pwd;
|
TString16 utente, pwd;
|
||||||
|
|
||||||
bool ok = FALSE;
|
bool ok = FALSE;
|
||||||
for (int i = 0 ; i < 3 && !ok; i++)
|
for (int i = 0 ; i < 3 && !ok; i++)
|
||||||
@ -489,20 +475,20 @@ bool TMenu_application::check_user()
|
|||||||
if (m.run() == K_ESC)
|
if (m.run() == K_ESC)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
user = m.get(F_USER);
|
utente = m.get(F_USER);
|
||||||
users.zero();
|
users.zero();
|
||||||
users.put("USERNAME", user);
|
users.put("USERNAME", utente);
|
||||||
|
|
||||||
pwd = "";
|
pwd = "";
|
||||||
if (users.read() == NOERR)
|
if (users.read() == NOERR)
|
||||||
pwd = decode(users.get("PASSWORD"));
|
pwd = decode(users.get("PASSWORD"));
|
||||||
else
|
else
|
||||||
if (user == "PRASSI")
|
if (utente == "PRASSI")
|
||||||
pwd = "pr.assi";
|
pwd = "pr.assi";
|
||||||
|
|
||||||
ok = pwd.not_empty() && pwd == m.get(F_PASSWORD);
|
ok = pwd.not_empty() && pwd == m.get(F_PASSWORD);
|
||||||
if (ok)
|
if (ok)
|
||||||
set_user(user);
|
user() = utente;
|
||||||
else
|
else
|
||||||
error_box("Utente e/o password errata:\nfare attenzione alle maiuscole");
|
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();
|
_ditta_asked = ok = set_firm();
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
prefhndl->set(NULL);
|
prefix().set(NULL);
|
||||||
TExternal_app a(option);
|
TExternal_app a(option);
|
||||||
a.run();
|
a.run();
|
||||||
prefhndl->set("DEF"); // Aggiorna prefix se hanno cambiato ditta
|
prefix().set("DEF"); // Aggiorna prefix se hanno cambiato ditta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -592,9 +578,11 @@ bool TMenu_application::menu(MENU_TAG)
|
|||||||
return FALSE;
|
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];
|
const char* menu = (argc < 2) ? "prassi.mnu" : argv[1];
|
||||||
|
|
||||||
TMenu_application ma(menu);
|
TMenu_application ma(menu);
|
||||||
ma.run(argc, argv, "Menu Principale");
|
ma.run(argc, argv, "Menu Principale");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
11
ba/ba0.url
11
ba/ba0.url
@ -3,14 +3,3 @@
|
|||||||
MENU TASK_MENUBAR
|
MENU TASK_MENUBAR
|
||||||
SUBMENU MENU_FILE "~File"
|
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);
|
_mask->reset (F_TAB);
|
||||||
|
|
||||||
const TRecnotype oldeox = atol(_mask->get(FLD_EOX));
|
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 char* name = _mask->get(FLD_NOME);
|
||||||
const bool enable_extend = (com ? *name != '$' : *name == '$') && (riga_sel > 0);
|
const bool enable_extend = (com ? *name != '$' : *name == '$') && (riga_sel > 0);
|
||||||
|
|
||||||
@ -480,16 +480,16 @@ void TManutenzione_app::delete_riga ()
|
|||||||
void TManutenzione_app::update_dir()
|
void TManutenzione_app::update_dir()
|
||||||
|
|
||||||
{
|
{
|
||||||
const TString pref(prefhndl->name());
|
const TString pref(prefix().name());
|
||||||
const bool is_com = prefhndl->is_com();
|
const bool is_com = prefix().is_com();
|
||||||
|
|
||||||
prefhndl->set("");
|
prefix().set("");
|
||||||
|
|
||||||
TDir d;
|
TDir d;
|
||||||
d.get(LF_DIR);
|
d.get(LF_DIR);
|
||||||
const int orig_items = (int)d.eod();
|
const int orig_items = (int)d.eod();
|
||||||
|
|
||||||
prefhndl->set(pref);
|
prefix().set(pref);
|
||||||
|
|
||||||
d.get(LF_DIR);
|
d.get(LF_DIR);
|
||||||
const int items = (int)d.eod();
|
const int items = (int)d.eod();
|
||||||
@ -504,7 +504,7 @@ void TManutenzione_app::update_dir()
|
|||||||
for (int i = 2; i <= items; i++)
|
for (int i = 2; i <= items; i++)
|
||||||
{
|
{
|
||||||
p.addstatus(1);
|
p.addstatus(1);
|
||||||
prefhndl->set("");
|
prefix().set("");
|
||||||
d.get(i, _nolock, _nordir, _sysdirop);
|
d.get(i, _nolock, _nordir, _sysdirop);
|
||||||
TString desc(d.des());
|
TString desc(d.des());
|
||||||
TString s(d.name());
|
TString s(d.name());
|
||||||
@ -512,7 +512,7 @@ void TManutenzione_app::update_dir()
|
|||||||
|
|
||||||
long flags = d.flags();
|
long flags = d.flags();
|
||||||
word len = d.len();
|
word len = d.len();
|
||||||
prefhndl->set(pref);
|
prefix().set(pref);
|
||||||
d.get(i, _nolock, _nordir, _sysdirop);
|
d.get(i, _nolock, _nordir, _sysdirop);
|
||||||
bool to_create = (is_com ? d.is_com() : d.is_firm());
|
bool to_create = (is_com ? d.is_com() : d.is_firm());
|
||||||
|
|
||||||
@ -538,20 +538,20 @@ void TManutenzione_app::update_dir()
|
|||||||
f.build(10L);
|
f.build(10L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prefhndl->set(pref);
|
prefix().set(pref);
|
||||||
|
|
||||||
if (items >= orig_items) return;
|
if (items >= orig_items) return;
|
||||||
|
|
||||||
for (i = items + 1; i <= orig_items; i++)
|
for (i = items + 1; i <= orig_items; i++)
|
||||||
{
|
{
|
||||||
prefhndl->set("");
|
prefix().set("");
|
||||||
d.get(i, _nolock, _nordir, _sysdirop);
|
d.get(i, _nolock, _nordir, _sysdirop);
|
||||||
prefhndl->set(pref);
|
prefix().set(pref);
|
||||||
d.set_len(0);
|
d.set_len(0);
|
||||||
d.flags() = 0L;
|
d.flags() = 0L;
|
||||||
d.put(i, _nordir, _sysdirop);
|
d.put(i, _nordir, _sysdirop);
|
||||||
}
|
}
|
||||||
prefhndl->set(pref);
|
prefix().set(pref);
|
||||||
d.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
d.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||||
d.eod() = orig_items;
|
d.eod() = orig_items;
|
||||||
d.put(LF_DIR, _nordir, _sysdirop);
|
d.put(LF_DIR, _nordir, _sysdirop);
|
||||||
@ -560,7 +560,7 @@ void TManutenzione_app::update_dir()
|
|||||||
void TManutenzione_app::convert_dir()
|
void TManutenzione_app::convert_dir()
|
||||||
|
|
||||||
{
|
{
|
||||||
const TString pref(prefhndl->name());
|
const TString pref(prefix().name());
|
||||||
TDir d;
|
TDir d;
|
||||||
TTrec r;
|
TTrec r;
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ void TManutenzione_app::convert_dir()
|
|||||||
const int items = (int)d.eod();
|
const int items = (int)d.eod();
|
||||||
TString80 s("Aggiornamento archivi ");
|
TString80 s("Aggiornamento archivi ");
|
||||||
|
|
||||||
if (prefhndl->is_com()) s << "comuni";
|
if (prefix().is_com()) s << "comuni";
|
||||||
else s << " della ditta " << atol (pref);
|
else s << " della ditta " << atol (pref);
|
||||||
|
|
||||||
TProgind p(items ? items : 1, s, TRUE, TRUE, 70);
|
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++)
|
for (int i = 2; i <= items; i++)
|
||||||
{
|
{
|
||||||
p.addstatus(1);
|
p.addstatus(1);
|
||||||
prefhndl->set("");
|
prefix().set("");
|
||||||
r.get(i);
|
r.get(i);
|
||||||
prefhndl->set(pref);
|
prefix().set(pref);
|
||||||
TSystemisamfile f(i);
|
TSystemisamfile f(i);
|
||||||
f.update(r);
|
f.update(r);
|
||||||
}
|
}
|
||||||
prefhndl->set("");
|
prefix().set("");
|
||||||
const long level = prefhndl->filelevel();
|
const long level = prefix().filelevel();
|
||||||
prefhndl->set(pref);
|
prefix().set(pref);
|
||||||
d.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
d.get(LF_DIR, _nolock, _nordir, _sysdirop);
|
||||||
d.flags() = level;
|
d.flags() = level;
|
||||||
d.put(LF_DIR, _nordir, _sysdirop);
|
d.put(LF_DIR, _nordir, _sysdirop);
|
||||||
@ -597,12 +597,12 @@ void TManutenzione_app::update()
|
|||||||
{
|
{
|
||||||
long firm = get_firm();
|
long firm = get_firm();
|
||||||
TString pref;
|
TString pref;
|
||||||
if (firm == 0) pref = prefhndl->name();
|
if (firm == 0) pref = prefix().name();
|
||||||
|
|
||||||
do_events();
|
do_events();
|
||||||
|
|
||||||
begin_wait();
|
begin_wait();
|
||||||
prefhndl->set("com");
|
prefix().set("com");
|
||||||
update_dir();
|
update_dir();
|
||||||
convert_dir();
|
convert_dir();
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ void TManutenzione_app::update()
|
|||||||
const long codditta = ditte.get_long("CODDITTA");
|
const long codditta = ditte.get_long("CODDITTA");
|
||||||
const TRecnotype rec = ditte.recno();
|
const TRecnotype rec = ditte.recno();
|
||||||
|
|
||||||
if (prefhndl->exist(codditta))
|
if (prefix().exist(codditta))
|
||||||
{
|
{
|
||||||
ditte.close();
|
ditte.close();
|
||||||
set_firm(codditta);
|
set_firm(codditta);
|
||||||
@ -627,7 +627,7 @@ void TManutenzione_app::update()
|
|||||||
ditte.close();
|
ditte.close();
|
||||||
|
|
||||||
if (firm > 0) set_firm(firm);
|
if (firm > 0) set_firm(firm);
|
||||||
else prefhndl->set(pref);
|
else prefix().set(pref);
|
||||||
|
|
||||||
end_wait();
|
end_wait();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ BEGIN
|
|||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
END
|
END
|
||||||
|
|
||||||
SPREADSHEET F_FIELDS 0 7
|
SPREADSHEET F_FIELDS 0 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 4 ""
|
PROMPT 0 4 ""
|
||||||
ITEM "Nome@10"
|
ITEM "Nome@10"
|
||||||
|
@ -15,8 +15,10 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
rt = ba2100(argc, argv); break;
|
rt = ba2100(argc, argv); break;
|
||||||
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
case 1:
|
case 1:
|
||||||
rt = ba2200(argc, argv); break;
|
rt = ba2200(argc, argv); break;
|
||||||
|
#endif
|
||||||
case 2:
|
case 2:
|
||||||
rt = ba2300(argc, argv) ; break;
|
rt = ba2300(argc, argv) ; break;
|
||||||
case 3:
|
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_SAVE MENU_FILE_ALT+103
|
||||||
#define M_FIL1_SAVEAS MENU_FILE_ALT+104
|
#define M_FIL1_SAVEAS MENU_FILE_ALT+104
|
||||||
#define M_FIL1_QUIT MENU_FILE_ALT+105
|
#define M_FIL1_QUIT MENU_FILE_ALT+105
|
||||||
#define MENU_EDIT BAR_ITEM(1)
|
|
||||||
|
|
||||||
MENU MENU_FILE_ALT
|
MENU MENU_FILE_ALT
|
||||||
ITEM M_FIL1_NEW "~Nuovo"
|
ITEM M_FIL1_NEW "~Nuovo"
|
||||||
ITEM M_FIL1_OPEN "~Apri"
|
ITEM M_FIL1_OPEN "~Apri"
|
||||||
ITEM M_FIL1_SAVE "~Salva"
|
ITEM M_FIL1_SAVE "~Salva"
|
||||||
ITEM M_FIL1_SAVEAS "Salva ~con Nome"
|
ITEM M_FIL1_SAVEAS "Salva ~con Nome"
|
||||||
ITEM M_FIL1_QUIT "~Esci"
|
ITEM M_FIL1_QUIT "~Fine"
|
||||||
SEPARATOR
|
SEPARATOR
|
||||||
ITEM M_FILE_ABOUT "~Informazioni"
|
ITEM M_FILE_ABOUT "~Informazioni"
|
||||||
|
|
||||||
MENU TASK_MENUBAR
|
MENU TASK_MENUBAR
|
||||||
SUBMENU MENU_FILE "~File"
|
SUBMENU MENU_FILE "~File"
|
||||||
ITEM MENU_ITEM(11) "~Relazione"
|
SUBMENU BAR_ITEM(1) "~Dati"
|
||||||
SUBMENU BAR_ITEM(2) "~Intestazione"
|
SUBMENU BAR_ITEM(2) "~Testa"
|
||||||
SUBMENU BAR_ITEM(3) "~Corpo"
|
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)
|
MENU BAR_ITEM(2)
|
||||||
ITEM MENU_ITEM(21) "~Normale"
|
ITEM MENU_ITEM(21) "~Normale"
|
||||||
@ -43,6 +47,11 @@ MENU BAR_ITEM(4)
|
|||||||
ITEM MENU_ITEM(43) "~Primo"
|
ITEM MENU_ITEM(43) "~Primo"
|
||||||
ITEM MENU_ITEM(44) "~Ultimo"
|
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)
|
MENUBAR MENU_BAR(1)
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
|
#include <config.h>
|
||||||
#include <form.h>
|
#include <form.h>
|
||||||
#include <msksheet.h>
|
#include <msksheet.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
@ -23,6 +24,7 @@ protected:
|
|||||||
|
|
||||||
bool edit_relation();
|
bool edit_relation();
|
||||||
bool edit(char s, pagetype p);
|
bool edit(char s, pagetype p);
|
||||||
|
bool form_config() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TForm_editor();
|
TForm_editor();
|
||||||
@ -84,6 +86,8 @@ bool TForm_editor::menu(MENU_TAG tag)
|
|||||||
{
|
{
|
||||||
case MENU_ITEM(11):
|
case MENU_ITEM(11):
|
||||||
sec = 'R'; pt = odd_page; break;
|
sec = 'R'; pt = odd_page; break;
|
||||||
|
case MENU_ITEM(12):
|
||||||
|
sec = 'D'; pt = odd_page; break;
|
||||||
case MENU_ITEM(21):
|
case MENU_ITEM(21):
|
||||||
sec = 'H'; pt = odd_page; break;
|
sec = 'H'; pt = odd_page; break;
|
||||||
case MENU_ITEM(22):
|
case MENU_ITEM(22):
|
||||||
@ -108,6 +112,14 @@ bool TForm_editor::menu(MENU_TAG tag)
|
|||||||
sec = 'F'; pt = first_page; break;
|
sec = 'F'; pt = first_page; break;
|
||||||
case MENU_ITEM(44):
|
case MENU_ITEM(44):
|
||||||
sec = 'F'; pt = last_page; break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -128,7 +140,7 @@ bool TForm_editor::file_handler(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
if (k == K_TAB && f.dirty())
|
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");
|
if (*d == '\0') ok = error_box("Nome di file o tabella errato");
|
||||||
f.mask().set(f.dlg()+1, d);
|
f.mask().set(f.dlg()+1, d);
|
||||||
}
|
}
|
||||||
@ -206,15 +218,19 @@ bool TForm_editor::edit(char s, pagetype t)
|
|||||||
|
|
||||||
if (s == 'R')
|
if (s == 'R')
|
||||||
dirty = edit_relation();
|
dirty = edit_relation();
|
||||||
|
if (s == 'D')
|
||||||
|
form_config();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TString80 caption;
|
TString80 caption;
|
||||||
switch(s)
|
switch(s)
|
||||||
{
|
{
|
||||||
case 'F':
|
case 'F':
|
||||||
caption << "Pie' di pagina"; break;
|
caption << "Piede"; break;
|
||||||
|
case 'G':
|
||||||
|
caption << "Sfondo"; break;
|
||||||
case 'H':
|
case 'H':
|
||||||
caption << "Intestazione"; break;
|
caption << "Testa"; break;
|
||||||
default:
|
default:
|
||||||
caption << "Corpo"; break;
|
caption << "Corpo"; break;
|
||||||
}
|
}
|
||||||
@ -235,7 +251,7 @@ bool TForm_editor::edit(char s, pagetype t)
|
|||||||
if (!_form->exist(s, t))
|
if (!_form->exist(s, t))
|
||||||
{
|
{
|
||||||
const KEY k = yesnocancel_box("La sezione %s non esiste:\n"
|
const KEY k = yesnocancel_box("La sezione %s non esiste:\n"
|
||||||
"si desidera ricopiare quella standard?",
|
"si desidera generare quella standard?",
|
||||||
(const char*)caption);
|
(const char*)caption);
|
||||||
if (k == K_ESC)
|
if (k == K_ESC)
|
||||||
dirty = FALSE;
|
dirty = FALSE;
|
||||||
@ -266,6 +282,64 @@ bool TForm_editor::edit(char s, pagetype t)
|
|||||||
return dirty;
|
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[])
|
int ba2100(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TForm_editor a;
|
TForm_editor a;
|
||||||
|
@ -25,6 +25,8 @@ BEGIN
|
|||||||
ITEM "DATA|Data" MESSAGE HIDE,F_DECIMALS|HIDE,F_HEIGHT|HIDE,F_ITEMS
|
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 "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 "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
|
END
|
||||||
|
|
||||||
STRING F_KEY 80 60
|
STRING F_KEY 80 60
|
||||||
|
@ -4,17 +4,17 @@ PAGE "SEZIONE DI STAMPA" -1 -1 30 7
|
|||||||
|
|
||||||
NUMBER F_HEIGHT 3
|
NUMBER F_HEIGHT 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Altezza "
|
PROMPT 1 1 "Altezza in righe "
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_X 3
|
NUMBER F_X 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 2 "Offset X "
|
PROMPT 1 2 "Spostamento orizzontale "
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_Y 3
|
NUMBER F_Y 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 3 "Offset Y "
|
PROMPT 1 3 "Spostamento verticale "
|
||||||
END
|
END
|
||||||
|
|
||||||
BUTTON DLG_EDIT 10 2
|
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)
|
bool TArchive::backup(const char* dir, char floppy, const char* desc)
|
||||||
{
|
{
|
||||||
const TString16 old(prefhndl->name());
|
const TString16 old(prefix().name());
|
||||||
prefhndl->set(NULL);
|
prefix().set(NULL);
|
||||||
|
|
||||||
save_dir();
|
xvt_fsys_save_dir();
|
||||||
chdir(dir);
|
chdir(dir);
|
||||||
|
|
||||||
const TFilename d(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);
|
if (ok) ok = fsplit(work, floppy, desc);
|
||||||
remove(work);
|
remove(work);
|
||||||
|
|
||||||
restore_dir();
|
xvt_fsys_restore_dir();
|
||||||
prefhndl->set(old);
|
prefix().set(old);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -310,13 +310,13 @@ bool TArchive::restore(const char* dir, char floppy, bool tmp)
|
|||||||
"nel direttorio %s. Continuare?", floppy, (const char*)work))
|
"nel direttorio %s. Continuare?", floppy, (const char*)work))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
const TString16 old(prefhndl->name());
|
const TString16 old(prefix().name());
|
||||||
prefhndl->set(NULL);
|
prefix().set(NULL);
|
||||||
save_dir();
|
xvt_fsys_save_dir();
|
||||||
bool ok = chdir(work) == 0;
|
bool ok = chdir(work) == 0;
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
prefhndl->set(old);
|
prefix().set(old);
|
||||||
return error_box("Impossibile accedere a %s", (const char*)work);
|
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);
|
remove(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
restore_dir();
|
xvt_fsys_restore_dir();
|
||||||
prefhndl->set(old);
|
prefix().set(old);
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -373,8 +373,8 @@ TProgress_win::TProgress_win(const char* title, TArchive* _arc)
|
|||||||
set_handler(DLG_CANCEL, cancel_handler);
|
set_handler(DLG_CANCEL, cancel_handler);
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
HWND txt = (HWND)get_value(wtxt, ATTR_NATIVE_WINDOW);
|
HWND txt = (HWND)xvt_vobj_get_attr(wtxt, ATTR_NATIVE_WINDOW);
|
||||||
HWND num = (HWND)get_value(wnum, 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);
|
_monitor = new ALWindowsMessage(AL_MONITOR_OBJECTS, txt, AL_SEND_RATIO, num);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <printapp.h>
|
#include <printapp.h>
|
||||||
#include <relation.h>
|
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
@ -79,11 +78,6 @@ bool BA3200_application::set_print(int)
|
|||||||
|
|
||||||
_cur->setregion (from, to);
|
_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();
|
set_headers();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -211,8 +205,11 @@ void BA3200_application::set_headers()
|
|||||||
//set_header (last_riga, (const char *)sep);
|
//set_header (last_riga, (const char *)sep);
|
||||||
sep.fill(' ');
|
sep.fill(' ');
|
||||||
set_header (last_riga, (const char *)sep);
|
set_header (last_riga, (const char *)sep);
|
||||||
|
#ifdef DBG
|
||||||
set_background(format("W1l{1 3 %d 3}W1l{1 %d %d %d}", LungRiga, last_riga, LungRiga, last_riga));
|
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()
|
void BA3200_application::set_rows()
|
||||||
|
@ -14,3 +14,4 @@
|
|||||||
#define F_ANNO 114
|
#define F_ANNO 114
|
||||||
#define F_CODLIB 115
|
#define F_CODLIB 115
|
||||||
#define F_INDEX 116
|
#define F_INDEX 116
|
||||||
|
#define F_DESVID 117
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#define F_DATASCAD 113
|
#define F_DATASCAD 113
|
||||||
#define F_NUMPAG 114
|
#define F_NUMPAG 114
|
||||||
#define F_STAMPAINT 117
|
#define F_STAMPAINT 117
|
||||||
|
#define F_DESVID 123
|
||||||
#define F_STAMPAINDCOMP 118
|
#define F_STAMPAINDCOMP 118
|
||||||
#define F_MODULO 119
|
#define F_MODULO 119
|
||||||
#define F_STAMPA 120
|
#define F_STAMPA 120
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
|
|
||||||
// campi maschera batb%dpn.msk
|
|
||||||
|
|
||||||
#define F_CODICE 101
|
#define F_CODICE 101
|
||||||
#define F_DESCR 102
|
#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
|
STRING F_CODICE 1
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 4 2 "Codice "
|
PROMPT 2 2 "Codice "
|
||||||
FIELD CODTAB
|
FIELD CODTAB
|
||||||
FLAGS "U"
|
FLAGS "U"
|
||||||
KEY 1
|
KEY 1
|
||||||
@ -25,7 +25,7 @@ END
|
|||||||
|
|
||||||
STRING F_DESCR 50
|
STRING F_DESCR 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 4 4 "Descrizione "
|
PROMPT 2 3 "Descrizione "
|
||||||
FIELD LF_TABCOM->S0
|
FIELD LF_TABCOM->S0
|
||||||
KEY 2
|
KEY 2
|
||||||
USE %LNG KEY 2
|
USE %LNG KEY 2
|
||||||
@ -37,6 +37,48 @@ BEGIN
|
|||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
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
|
ENDPAGE
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
|
||||||
|
@ -23,14 +23,13 @@
|
|||||||
|
|
||||||
#define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
|
#define BITTEST(w,p) (((w) & (0x0001 << (p))) != 0)
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Metodi di accesso globali all'applicazione corrente
|
// Metodi di accesso globali all'applicazione corrente
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HIDDEN TApplication* _application = NULL;
|
HIDDEN TApplication* _application = NULL;
|
||||||
|
|
||||||
TString16 TApplication::_user;
|
|
||||||
|
|
||||||
TApplication& main_app()
|
TApplication& main_app()
|
||||||
{
|
{
|
||||||
CHECK(_application, "NULL application!");
|
CHECK(_application, "NULL application!");
|
||||||
@ -45,7 +44,7 @@ bool xvt_running() { return _application != NULL; }
|
|||||||
|
|
||||||
HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
HIDDEN long backdrop_eh( WINDOW win, EVENT* ep)
|
||||||
{
|
{
|
||||||
clear_window(win, MASK_DARK_COLOR);
|
xvt_dwin_clear(win, MASK_DARK_COLOR);
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,16 +54,16 @@ HIDDEN void create_backdrop( void )
|
|||||||
xvt_create_statbar();
|
xvt_create_statbar();
|
||||||
xvt_statbar_set("");
|
xvt_statbar_set("");
|
||||||
#else
|
#else
|
||||||
xvt_escape(XVT_ESC_CH_COLOR, XVT_CH_CLR_MENU, COLOR_BLACK, COLOR_WHITE);
|
xvt_app_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_app_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_app_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_app_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_app_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_MNEMONIC, COLOR_RED, COLOR_WHITE);
|
||||||
|
|
||||||
RCT rct;
|
RCT rct;
|
||||||
get_client_rect( SCREEN_WIN, &rct );
|
xvt_vobj_get_client_rect( SCREEN_WIN, &rct );
|
||||||
create_window(W_PLAIN, &rct, (char*) "BACKDROP", 0, TASK_WIN,
|
xvt_win_create(W_PLAIN, &rct, (char*) "BACKDROP", 0, TASK_WIN,
|
||||||
WSF_NO_MENUBAR | WSF_CH_BACKDROP , EM_UPDATE,
|
WSF_NO_MENUBAR | WSF_CH_BACKDROP , EM_UPDATE,
|
||||||
backdrop_eh, 0L );
|
backdrop_eh, 0L );
|
||||||
#endif
|
#endif
|
||||||
@ -102,39 +101,39 @@ void TBanner::handler(WINDOW win, EVENT* ep)
|
|||||||
{
|
{
|
||||||
if (ep->type == E_UPDATE)
|
if (ep->type == E_UPDATE)
|
||||||
{
|
{
|
||||||
const int BIGY = CHARY<<1;
|
const int BIGY = 3*CHARY/2;
|
||||||
|
|
||||||
clear(COLOR_LTGRAY);
|
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_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();
|
char* t = (char*)(const char*)main_app().title();
|
||||||
int w = win_get_text_width(win, t, -1);
|
int w = xvt_dwin_get_text_width(win, t, -1);
|
||||||
int a; win_get_font_metrics(win, NULL, &a, NULL);
|
int a; xvt_dwin_get_font_metrics(win, NULL, &a, NULL);
|
||||||
int x = (r.right-w)>>1, y = (r.bottom+a)>>1 ;
|
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);
|
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.";
|
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;
|
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";
|
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;
|
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.left += 5; r.right -= 4;
|
||||||
r.top += 5; r.bottom -= 4;
|
r.top += 5; r.bottom -= 4;
|
||||||
set_pen(COLOR_WHITE); win_draw_rect(win, &r);
|
set_pen(COLOR_WHITE); xvt_dwin_draw_rect(win, &r);
|
||||||
offset_rect(&r, -1, -1);
|
xvt_rect_offset(&r, -1, -1);
|
||||||
set_pen(COLOR_BLACK); win_draw_rect(win, &r);
|
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
|
else
|
||||||
TWindow::handler(win, ep);
|
TWindow::handler(win, ep);
|
||||||
@ -200,7 +199,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
|||||||
set_firm();
|
set_firm();
|
||||||
break;
|
break;
|
||||||
case M_FILE_REVERT:
|
case M_FILE_REVERT:
|
||||||
config();
|
if (config())
|
||||||
on_config_change();
|
on_config_change();
|
||||||
break;
|
break;
|
||||||
case (M_FILE+11):
|
case (M_FILE+11):
|
||||||
@ -223,7 +222,7 @@ long TApplication::handler(WINDOW win, EVENT* ep)
|
|||||||
if (ep->v.query)
|
if (ep->v.query)
|
||||||
{
|
{
|
||||||
if (can_close())
|
if (can_close())
|
||||||
quit_OK();
|
xvt_app_allow_quit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
stop_run();
|
stop_run();
|
||||||
@ -238,9 +237,9 @@ default:
|
|||||||
|
|
||||||
void TApplication::stop_run()
|
void TApplication::stop_run()
|
||||||
{
|
{
|
||||||
if (_savefirm) prefhndl->set_codditta(_savefirm);
|
if (_savefirm) prefix().set_codditta(_savefirm);
|
||||||
terminate();
|
terminate();
|
||||||
xvt_terminate();
|
xvt_app_destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -295,7 +294,7 @@ void TApplication::terminate()
|
|||||||
|
|
||||||
if (fexist("prassi.hlp"))
|
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);
|
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -350,9 +349,10 @@ void TApplication::set_perms()
|
|||||||
}
|
}
|
||||||
_user_aut.set(0, TRUE);
|
_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++)
|
for (int i = 1 ; i < ENDAUT; i++)
|
||||||
_user_aut.set(i);
|
_user_aut.set(i);
|
||||||
@ -362,7 +362,7 @@ void TApplication::set_perms()
|
|||||||
TLocalisamfile users(LF_USER);
|
TLocalisamfile users(LF_USER);
|
||||||
|
|
||||||
users.zero();
|
users.zero();
|
||||||
users.put("USERNAME", _user);
|
users.put("USERNAME", utente);
|
||||||
if (users.read() == NOERR)
|
if (users.read() == NOERR)
|
||||||
{
|
{
|
||||||
const TString80 aut(users.get("AUTSTR"));
|
const TString80 aut(users.get("AUTSTR"));
|
||||||
@ -379,14 +379,14 @@ void TApplication::set_perms()
|
|||||||
void TApplication::check_parameters(int & argc, char* argv[])
|
void TApplication::check_parameters(int & argc, char* argv[])
|
||||||
{
|
{
|
||||||
if (strncmp(argv[argc-1], "-u", 2) == 0)
|
if (strncmp(argv[argc-1], "-u", 2) == 0)
|
||||||
_user = &argv[--argc][2];
|
user() = &argv[--argc][2];
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
else _user = "PRASSI";
|
else user() = "PRASSI";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
const long twin_style = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE | WSF_MAXIMIZED;
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,13 +397,13 @@ void TApplication::run(int argc, char* argv[], const char* title)
|
|||||||
|
|
||||||
base.ext(""); base.lower();
|
base.ext(""); base.lower();
|
||||||
_title = title;
|
_title = title;
|
||||||
if (_user.empty())
|
if (user().empty())
|
||||||
check_parameters(argc, argv);
|
check_parameters(argc, argv);
|
||||||
|
|
||||||
__argc = argc;
|
__argc = argc;
|
||||||
__argv = (const char**)argv;
|
__argv = (const char**)argv;
|
||||||
|
|
||||||
int addbar;
|
int addbar = 0;
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
addbar = atoi(argv[1]+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());
|
const TFixed_string mod(get_module_name());
|
||||||
if (mod.empty()) return;
|
if (mod.empty()) return;
|
||||||
|
|
||||||
TString80 caption;
|
TString caption; caption << "PRASSI S.p.A. - " << mod;
|
||||||
caption << "PRASSI S.p.A. - " << mod;
|
|
||||||
|
|
||||||
static XVT_CONFIG cfg;
|
XVT_CONFIG cfg;
|
||||||
cfg.base_appl_name = (char*)base.name();
|
cfg.base_appl_name = (char*)base.name();
|
||||||
cfg.appl_name = (char*)(const char*)_title;
|
cfg.appl_name = (char*)(const char*)_title;
|
||||||
cfg.taskwin_title = (char*)(const char*)caption;
|
cfg.taskwin_title = (char*)(const char*)caption;
|
||||||
@ -443,7 +442,7 @@ void TApplication::run(int argc, char* argv[], const char* title)
|
|||||||
customize_controls(TRUE);
|
customize_controls(TRUE);
|
||||||
|
|
||||||
_application = this;
|
_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)
|
void TApplication::check_menu_item(MENU_TAG item)
|
||||||
{
|
{
|
||||||
win_menu_check(TASK_WIN, item, TRUE);
|
xvt_menu_set_item_checked(TASK_WIN, item, TRUE);
|
||||||
win_update_menu_bar(TASK_WIN);
|
xvt_menu_update(TASK_WIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TApplication::uncheck_menu_item(MENU_TAG item)
|
void TApplication::uncheck_menu_item(MENU_TAG item)
|
||||||
{
|
{
|
||||||
win_menu_check(TASK_WIN, item, FALSE);
|
xvt_menu_set_item_checked(TASK_WIN, item, FALSE);
|
||||||
win_update_menu_bar(TASK_WIN);
|
xvt_menu_update(TASK_WIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TApplication::enable_menu_item(MENU_TAG item, bool on)
|
void TApplication::enable_menu_item(MENU_TAG item, bool on)
|
||||||
{
|
{
|
||||||
win_menu_enable(TASK_WIN, item, on);
|
xvt_menu_set_item_enabled(TASK_WIN, item, on);
|
||||||
win_update_menu_bar(TASK_WIN);
|
xvt_menu_update(TASK_WIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void TApplication::dispatch_e_menu(MENU_TAG item)
|
void TApplication::dispatch_e_menu(MENU_TAG item)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#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);
|
PostMessage(w, WM_COMMAND, item, 0L);
|
||||||
#else
|
#else
|
||||||
::dispatch_e_menu(TASK_WIN, item);
|
::dispatch_e_menu(TASK_WIN, item);
|
||||||
@ -511,12 +506,12 @@ bool TApplication::has_module(int module, int checktype) const
|
|||||||
|
|
||||||
long TApplication::get_firm() const
|
long TApplication::get_firm() const
|
||||||
{
|
{
|
||||||
return prefhndl->get_codditta();
|
return prefix().get_codditta();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TApplication::get_firm_dir() const
|
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);
|
newfirm = mask.get_long(F_CODDITTA);
|
||||||
const int tipodir = mask.get_int(F_TIPO);
|
const int tipodir = mask.get_int(F_TIPO);
|
||||||
|
|
||||||
if (tipodir == 0 && !prefhndl->exist(newfirm) &&
|
if (tipodir == 0 && !prefix().exist(newfirm) &&
|
||||||
!build_firm_data(newfirm))
|
!build_firm_data(newfirm))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (tipodir > 0)
|
if (tipodir > 0)
|
||||||
{
|
{
|
||||||
if (_savefirm == 0) _savefirm = oldfirm;
|
if (_savefirm == 0) _savefirm = oldfirm; // E' necessario ricordare la ditta ...
|
||||||
prefhndl->set(tipodir == 1 ? "com" : "");
|
prefix().set(tipodir == 1 ? "com" : ""); // ... se si setta il prefix a com
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,9 +551,9 @@ bool TApplication::set_firm(long newfirm)
|
|||||||
if (newfirm == oldfirm || newfirm < 1)
|
if (newfirm == oldfirm || newfirm < 1)
|
||||||
return newfirm > 0;
|
return newfirm > 0;
|
||||||
|
|
||||||
if (prefhndl->test(newfirm))
|
if (prefix().test(newfirm))
|
||||||
{
|
{
|
||||||
prefhndl->set_codditta(newfirm);
|
prefix().set_codditta(newfirm);
|
||||||
_savefirm = 0;
|
_savefirm = 0;
|
||||||
|
|
||||||
WINDOW w = cur_win();
|
WINDOW w = cur_win();
|
||||||
@ -568,7 +563,7 @@ bool TApplication::set_firm(long newfirm)
|
|||||||
e.type = E_COMMAND;
|
e.type = E_COMMAND;
|
||||||
e.v.cmd.tag = M_FILE_NEW;
|
e.v.cmd.tag = M_FILE_NEW;
|
||||||
e.v.cmd.shift = e.v.cmd.control = 0;
|
e.v.cmd.shift = e.v.cmd.control = 0;
|
||||||
dispatch_event(w, &e);
|
xvt_win_dispatch_event(w, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
on_firm_change();
|
on_firm_change();
|
||||||
@ -644,7 +639,7 @@ void TApplication::set_cursor(bool w)
|
|||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
if (_count == 0)
|
if (_count == 0)
|
||||||
::set_cursor(ww, CURSOR_WAIT);
|
xvt_win_set_cursor(ww, CURSOR_WAIT);
|
||||||
_count++;
|
_count++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -652,7 +647,7 @@ void TApplication::set_cursor(bool w)
|
|||||||
_count--;
|
_count--;
|
||||||
CHECK(_count >= 0, "end_wait without matching begin_wait");
|
CHECK(_count >= 0, "end_wait without matching begin_wait");
|
||||||
if (_count == 0)
|
if (_count == 0)
|
||||||
::set_cursor(ww, CURSOR_ARROW);
|
xvt_win_set_cursor(ww, CURSOR_ARROW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,11 +33,9 @@ class TApplication
|
|||||||
TPrinter* _printer;
|
TPrinter* _printer;
|
||||||
|
|
||||||
long _savefirm;
|
long _savefirm;
|
||||||
bool _create_ok;
|
bool _create_ok; // Succesfully created
|
||||||
word _waiting;
|
word _waiting;
|
||||||
|
|
||||||
static TString16 _user;
|
|
||||||
|
|
||||||
void terminate(); // End of application
|
void terminate(); // End of application
|
||||||
void set_cursor(bool w); // Change mouse cursor
|
void set_cursor(bool w); // Change mouse cursor
|
||||||
bool config(); // Change parameters
|
bool config(); // Change parameters
|
||||||
@ -55,12 +53,10 @@ protected:
|
|||||||
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
|
virtual bool menu(MENU_TAG) { return TRUE; } // Controlla il menu
|
||||||
virtual bool build_firm_data(long cod, bool flagcom = FALSE) { return TRUE;}
|
virtual bool build_firm_data(long cod, bool flagcom = FALSE) { return TRUE;}
|
||||||
virtual bool destroy(); // Rimuove l'applicazione
|
virtual bool destroy(); // Rimuove l'applicazione
|
||||||
virtual void print();
|
|
||||||
|
|
||||||
virtual void on_config_change();
|
virtual void on_config_change();
|
||||||
virtual void on_firm_change();
|
virtual void on_firm_change();
|
||||||
|
|
||||||
void set_user(const char * user) { _user = user; }
|
|
||||||
void set_perms();
|
void set_perms();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -72,6 +68,9 @@ public:
|
|||||||
// @DES Queste funzioni possono essere ridefinite da ogni applicazione
|
// @DES Queste funzioni possono essere ridefinite da ogni applicazione
|
||||||
// @FPUB
|
// @FPUB
|
||||||
virtual word class_id() const { return CLASS_APPLICATION; }
|
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 stop_run(); // Forza chiusura applicazione
|
||||||
|
|
||||||
void check_menu_item(MENU_TAG item); // Check menu
|
void check_menu_item(MENU_TAG item); // Check menu
|
||||||
@ -92,7 +91,6 @@ public:
|
|||||||
TPrinter& printer();
|
TPrinter& printer();
|
||||||
|
|
||||||
static void check_parameters(int & argc, char *argv[]);
|
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 has_module(int module, int checktype = CHK_ALL) const;
|
||||||
bool set_firm(long cod = -1);
|
bool set_firm(long cod = -1);
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#ifndef __ASSOC_H
|
#ifndef __ASSOC_H
|
||||||
#define __ASSOC_H
|
#define __ASSOC_H
|
||||||
|
|
||||||
#ifndef __ARRAY_H
|
|
||||||
#include <array.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XVT_OS
|
#ifdef XVT_OS
|
||||||
#include <xvt_os.h>
|
#include <xvt.h>
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <keys.h>
|
#include <keys.h>
|
||||||
@ -40,7 +40,7 @@ int fatal_box(const char* fmt, ...)
|
|||||||
exit(1);
|
exit(1);
|
||||||
#else
|
#else
|
||||||
beep();
|
beep();
|
||||||
if (xvt_running()) xvt_fatal("%s", msg);
|
if (xvt_running()) xvt_dm_post_fatal_exit("%s", msg);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", msg);
|
fprintf(stderr, "%s\n", msg);
|
||||||
@ -62,7 +62,7 @@ int error_box(const char* fmt, ...)
|
|||||||
MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION);
|
MessageBox(GetFocus(), msg, "ERRORE", MB_OK | MB_ICONEXCLAMATION);
|
||||||
#else
|
#else
|
||||||
beep();
|
beep();
|
||||||
if (xvt_running()) xvt_error("%s", msg);
|
if (xvt_running()) xvt_dm_post_error("%s", msg);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", msg);
|
fprintf(stderr, "%s\n", msg);
|
||||||
@ -83,7 +83,7 @@ int warning_box(const char* fmt, ...)
|
|||||||
MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION);
|
MessageBox(GetFocus(), msg, "ATTENZIONE", MB_OK | MB_ICONQUESTION);
|
||||||
#else
|
#else
|
||||||
beep();
|
beep();
|
||||||
xvt_note("%s", msg);
|
xvt_dm_post_note("%s", msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -97,7 +97,7 @@ int message_box(const char* fmt, ...)
|
|||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
|
MessageBox(GetFocus(), msg, "INFORMAZIONE", MB_OK | MB_ICONINFORMATION);
|
||||||
#else
|
#else
|
||||||
xvt_note("%s", msg);
|
xvt_dm_post_note("%s", msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -111,7 +111,7 @@ int sorry_box(const char* fmt, ...)
|
|||||||
MessageBeep(MB_OK);
|
MessageBeep(MB_OK);
|
||||||
MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION);
|
MessageBox(GetFocus(), msg, "SPIACENTE", MB_OK | MB_ICONINFORMATION);
|
||||||
#else
|
#else
|
||||||
xvt_note("%s", msg);
|
xvt_dm_post_note("%s", msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -125,7 +125,7 @@ int yesno_box(const char* fmt, ...)
|
|||||||
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
|
int r = MessageBox(GetFocus(), msg, "RICHIESTA", MB_YESNO | MB_ICONQUESTION);
|
||||||
return r == IDYES;
|
return r == IDYES;
|
||||||
#else
|
#else
|
||||||
ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", NULL, "%s", msg);
|
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", NULL, "%s", msg);
|
||||||
return r == RESP_DEFAULT;
|
return r == RESP_DEFAULT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ int yesnocancel_box(const char* fmt, ...)
|
|||||||
r = K_ESC;
|
r = K_ESC;
|
||||||
return r;
|
return r;
|
||||||
#else
|
#else
|
||||||
ASK_RESPONSE r = xvt_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg);
|
ASK_RESPONSE r = xvt_dm_post_ask((char*) "Si", (char*) "No", (char*) "Annulla", "%s", msg);
|
||||||
if (r == RESP_DEFAULT) r = K_YES;
|
if (r == RESP_DEFAULT) r = K_YES;
|
||||||
else
|
else
|
||||||
if (r == RESP_2) r = K_NO;
|
if (r == RESP_2) r = K_NO;
|
||||||
|
@ -54,16 +54,16 @@ bool TConfig_application::menu(MENU_TAG m)
|
|||||||
|
|
||||||
void TConfig_application::do_config(int m)
|
void TConfig_application::do_config(int m)
|
||||||
{
|
{
|
||||||
for (;;)
|
TString par(name());
|
||||||
{
|
|
||||||
TString par = name();
|
|
||||||
if (m < _paragraphs.items())
|
if (m < _paragraphs.items())
|
||||||
par = (TString&)_paragraphs[m];
|
par = (TString&)_paragraphs[m];
|
||||||
else par.cut(2);
|
else par.cut(2);
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
TConfig cnf(_which_config, par);
|
TConfig cnf(_which_config, par);
|
||||||
|
|
||||||
TString maskname(cnf.get("EdMask"));
|
const TFilename maskname(cnf.get("EdMask"));
|
||||||
if (!maskname.empty())
|
if (!maskname.empty())
|
||||||
{
|
{
|
||||||
TMask m(maskname);
|
TMask m(maskname);
|
||||||
|
@ -56,15 +56,13 @@ bool TConfig::_read_paragraph()
|
|||||||
void TConfig::_write_paragraph(ofstream& out)
|
void TConfig::_write_paragraph(ofstream& out)
|
||||||
{
|
{
|
||||||
_data.restart();
|
_data.restart();
|
||||||
TString cnf(16);
|
out << '[' << _paragraph << ']' << endl;
|
||||||
cnf << '[' << _paragraph << ']';
|
|
||||||
out << cnf << '\n';
|
|
||||||
for (int i = 0; i < _data.items(); i++)
|
for (int i = 0; i < _data.items(); i++)
|
||||||
{
|
{
|
||||||
THash_object* o = _data.get_hashobj();
|
THash_object* o = _data.get_hashobj();
|
||||||
out << o->key() << "\t= " << (TString&)(o->obj()) << '\n';
|
out << o->key() << "\t= " << (TString&)(o->obj()) << '\n';
|
||||||
}
|
}
|
||||||
out << '\n';
|
out << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TConfig::_write_file()
|
void TConfig::_write_file()
|
||||||
@ -75,8 +73,8 @@ void TConfig::_write_file()
|
|||||||
ofstream out(temp);
|
ofstream out(temp);
|
||||||
|
|
||||||
TFixed_string l(__tmp_string, sizeof(__tmp_string));
|
TFixed_string l(__tmp_string, sizeof(__tmp_string));
|
||||||
TString cnf(16);
|
TString80 cnf; cnf << '[' << _paragraph << ']';
|
||||||
cnf << '[' << _paragraph << ']';
|
|
||||||
bool skip = FALSE, done = FALSE;
|
bool skip = FALSE, done = FALSE;
|
||||||
|
|
||||||
while (!in.eof())
|
while (!in.eof())
|
||||||
@ -124,27 +122,38 @@ void TConfig::_check_paragraph(const char* section)
|
|||||||
|
|
||||||
bool TConfig::exist(const char* var, int index)
|
bool TConfig::exist(const char* var, int index)
|
||||||
{
|
{
|
||||||
|
if (index >= 0)
|
||||||
|
{
|
||||||
TString80 vvar(var);
|
TString80 vvar(var);
|
||||||
if (index != -1) vvar << '(' << index << ')';
|
vvar << '(' << index << ')';
|
||||||
return _data.is_key(vvar);
|
return _data.is_key(vvar);
|
||||||
|
}
|
||||||
|
return _data.is_key(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
TString& TConfig::get(const char* var, const char* section, int index, const char* def)
|
TString& TConfig::get(const char* var, const char* section, int index, const char* def)
|
||||||
{
|
{
|
||||||
// ritorna valore di variabile nella sezione corrente o in
|
// ritorna valore di variabile nella sezione corrente o in
|
||||||
// quella specificata
|
// quella specificata
|
||||||
static TFixed_string s(&__tmp_string[256], 256);
|
HIDDEN TString256 s;
|
||||||
TString80 vvar(var); if (index != -1) vvar << '(' << index << ')';
|
|
||||||
|
const char* v = var;
|
||||||
|
if (index >= 0) // Mette indice tra parentesi
|
||||||
|
{
|
||||||
|
s = var;
|
||||||
|
s << '(' << index << ')';
|
||||||
|
v = s;
|
||||||
|
}
|
||||||
|
|
||||||
_check_paragraph(section);
|
_check_paragraph(section);
|
||||||
|
|
||||||
if (_data.is_key(vvar))
|
if (_data.is_key(v))
|
||||||
s = (TString&)_data[vvar];
|
s = (TString&)_data[v];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = def;
|
s = def;
|
||||||
if (s.not_empty())
|
if (s.not_empty())
|
||||||
set(var, s, section, TRUE, index);
|
set(var, def, section, TRUE, index);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -250,7 +259,11 @@ void TConfig::init(const char *fn, const char* pa)
|
|||||||
_dirty = FALSE;
|
_dirty = FALSE;
|
||||||
|
|
||||||
if (!fexist(_file))
|
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())
|
if (_paragraph.empty())
|
||||||
{
|
{
|
||||||
@ -282,14 +295,8 @@ TConfig::TConfig(int which_config, const char* paragraph)
|
|||||||
}
|
}
|
||||||
_file << "config";
|
_file << "config";
|
||||||
if (!fexist(_file))
|
if (!fexist(_file))
|
||||||
{
|
make_dir(_file);
|
||||||
#if XVT_OS==XVT_OS_SCOUNIX
|
_file << '/' << user() << ".ini";
|
||||||
mkdir(_file, 0777);
|
|
||||||
#else
|
|
||||||
mkdir(_file);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
_file << '/' << main_app().user() << ".ini";
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_file = "prassi.ini";
|
_file = "prassi.ini";
|
||||||
|
@ -2,7 +2,6 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
#include <xvtcm.h>
|
#include <xvtcm.h>
|
||||||
#include <cpb.h>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if XVT_OS != XVT_OS_WIN
|
#if XVT_OS != XVT_OS_WIN
|
||||||
@ -13,7 +12,7 @@ extern "C"
|
|||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <xvtility.h>
|
#include <window.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
@ -21,148 +20,34 @@ extern "C"
|
|||||||
// TPicture_array
|
// TPicture_array
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class TPicture_array
|
class TPicture_array : public TArray
|
||||||
{
|
{
|
||||||
enum { MAXPIC = 128 };
|
|
||||||
PICTURE _picture[MAXPIC];
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PICTURE getbmp(short id, bool convert = FALSE);
|
TImage* add(short id, bool convert = FALSE);
|
||||||
PICTURE operator[](short id) { return _picture[id-BMP_OK]; }
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
TPicture_array();
|
TImage& image(short id) { return (TImage&)operator[](id); }
|
||||||
~TPicture_array() { reset(); }
|
const TImage& image(short id) const { return (const TImage&)operator[](id); }
|
||||||
|
bool exist(short id) const { return objptr(id) != NULL; }
|
||||||
|
|
||||||
|
TPicture_array() : TArray(128) {}
|
||||||
|
~TPicture_array() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TImage* TPicture_array::add(short id, bool convert)
|
||||||
HIDDEN byte COLOR2PIC(COLOR c)
|
|
||||||
{
|
{
|
||||||
static unsigned long color[16][2] =
|
TImage* i = (TImage*)objptr(id);
|
||||||
{
|
|
||||||
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
|
|
||||||
};
|
|
||||||
|
|
||||||
int idx, f = 0, l = 15;
|
if (i == NULL)
|
||||||
c &= 0x00FFFFFF;
|
|
||||||
while (TRUE)
|
|
||||||
{
|
{
|
||||||
idx = (f+l)>>1;
|
i = new TImage(id);
|
||||||
if (c == color[idx][0]) break;
|
TArray::add(i, id);
|
||||||
if (c > color[idx][0]) f = idx+1;
|
if (convert)
|
||||||
else l = idx-1;
|
i->convert_to_default_colors();
|
||||||
if (f > l)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte b = (byte)color[idx][1];
|
return i;
|
||||||
return b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
// Static data and functions
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -175,7 +60,7 @@ HIDDEN TPicture_array cpb;
|
|||||||
|
|
||||||
HIDDEN void get_geometry(WINDOW win)
|
HIDDEN void get_geometry(WINDOW win)
|
||||||
{
|
{
|
||||||
get_client_rect(win, &_client);
|
xvt_vobj_get_client_rect(win, &_client);
|
||||||
_client.right--; _client.bottom--;
|
_client.right--; _client.bottom--;
|
||||||
_hdc = win;
|
_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;)
|
for (short d = 0; d < depth;)
|
||||||
{
|
{
|
||||||
win_set_cpen(win, &pen);
|
xvt_dwin_set_cpen(win, &pen);
|
||||||
|
|
||||||
PNT p; // Current vertex of the rectangle
|
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)
|
if (lt != COLOR_LTGRAY)
|
||||||
{
|
{
|
||||||
p.h = r.left; p.v = r.bottom;
|
p.h = r.left; p.v = r.bottom;
|
||||||
win_move_to(win, p);
|
xvt_dwin_draw_set_pos(win, p);
|
||||||
|
|
||||||
p.v = r.top;
|
p.v = r.top;
|
||||||
win_draw_line(win, p);
|
xvt_dwin_draw_line(win, p);
|
||||||
p.h = r.right;
|
p.h = r.right;
|
||||||
win_draw_line(win, p);
|
xvt_dwin_draw_line(win, p);
|
||||||
drawed = TRUE;
|
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)
|
if (pen.color != rb)
|
||||||
{
|
{
|
||||||
pen.color = rb;
|
pen.color = rb;
|
||||||
win_set_cpen(win, &pen);
|
xvt_dwin_set_cpen(win, &pen);
|
||||||
}
|
}
|
||||||
if (!drawed)
|
if (!drawed)
|
||||||
{
|
{
|
||||||
p.h = r.right; p.v = r.top;
|
p.h = r.right; p.v = r.top;
|
||||||
win_move_to(win, p);
|
xvt_dwin_draw_set_pos(win, p);
|
||||||
}
|
}
|
||||||
p.v = r.bottom;
|
p.v = r.bottom;
|
||||||
win_draw_line(win, p);
|
xvt_dwin_draw_line(win, p);
|
||||||
p.h = r.left;
|
p.h = r.left;
|
||||||
win_draw_line(win, p);
|
xvt_dwin_draw_line(win, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++d < depth)
|
if (++d < depth)
|
||||||
@ -255,18 +140,47 @@ void TControl::create(
|
|||||||
short left, short top, short right, short bottom, const char* title,
|
short left, short top, short right, short bottom, const char* title,
|
||||||
WINDOW parent, long flags, long app_data, short id)
|
WINDOW parent, long flags, long app_data, short id)
|
||||||
{
|
{
|
||||||
bool bold = *title == '@';
|
bool bold = FALSE;
|
||||||
if (bold) title += 2;
|
_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 int prop_count = 1;
|
||||||
const char* prop_list[prop_count+1] = { title, NULL };
|
const char* prop_list[prop_count+1] = { title, NULL };
|
||||||
|
|
||||||
_id = id;
|
_id = id;
|
||||||
_caption = title; _caption.strip("~");
|
|
||||||
_disabled = (flags & CTL_FLAG_DISABLED) != 0;
|
_disabled = (flags & CTL_FLAG_DISABLED) != 0;
|
||||||
_checked = (flags & CTL_FLAG_CHECKED) != 0;
|
_checked = (flags & CTL_FLAG_CHECKED) != 0;
|
||||||
_multiple = (flags & CTL_FLAG_MULTIPLE) != 0;
|
_multiple = (flags & CTL_FLAG_MULTIPLE) != 0;
|
||||||
_focused = FALSE;
|
_focused = FALSE;
|
||||||
|
_caption = title; _caption.strip("~");
|
||||||
|
|
||||||
creating = this;
|
creating = this;
|
||||||
ctl_flags = flags;
|
ctl_flags = flags;
|
||||||
@ -276,8 +190,8 @@ void TControl::create(
|
|||||||
CHECKD(_win, "Can't create control ", id);
|
CHECKD(_win, "Can't create control ", id);
|
||||||
|
|
||||||
creating = NULL;
|
creating = NULL;
|
||||||
set_app_data(_win, app_data);
|
xvt_vobj_set_data(_win, app_data);
|
||||||
xvt_set_font(_win, FF_FIXED, bold ? FS_BOLD : 0);
|
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)
|
long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
||||||
{
|
{
|
||||||
static bool tracking = FALSE;
|
HIDDEN bool tracking = FALSE;
|
||||||
static bool pressed = FALSE;
|
HIDDEN bool pressed = FALSE;
|
||||||
|
|
||||||
if (ep->type == E_CREATE)
|
if (ep->type == E_CREATE)
|
||||||
xvtcm_eh_start(win, ep);
|
xvtcm_eh_start(win, ep);
|
||||||
@ -313,7 +227,7 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
|||||||
cc->update();
|
cc->update();
|
||||||
break;
|
break;
|
||||||
case E_MOUSE_DOWN:
|
case E_MOUSE_DOWN:
|
||||||
trap_mouse(win);
|
xvt_win_trap_pointer(win);
|
||||||
tracking = pressed = TRUE;
|
tracking = pressed = TRUE;
|
||||||
cc->mouse_down(ep->v.mouse.where);
|
cc->mouse_down(ep->v.mouse.where);
|
||||||
break;
|
break;
|
||||||
@ -326,7 +240,7 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
|||||||
cc->mouse_up();
|
cc->mouse_up();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dispatch_e_char(get_parent(win), key);
|
dispatch_e_char(xvt_vobj_get_parent(win), key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,8 +249,8 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
|||||||
if (tracking)
|
if (tracking)
|
||||||
{
|
{
|
||||||
RCT r;
|
RCT r;
|
||||||
get_client_rect(win, &r);
|
xvt_vobj_get_client_rect(win, &r);
|
||||||
if (pt_in_rect(&r, ep->v.mouse.where))
|
if (xvt_rect_has_point(&r, ep->v.mouse.where))
|
||||||
{
|
{
|
||||||
if (!pressed)
|
if (!pressed)
|
||||||
{
|
{
|
||||||
@ -357,7 +271,7 @@ long XVT_CALLCONV1 TControl::handler(WINDOW win, EVENT* ep)
|
|||||||
case E_MOUSE_UP:
|
case E_MOUSE_UP:
|
||||||
if (tracking)
|
if (tracking)
|
||||||
{
|
{
|
||||||
release_mouse();
|
xvt_win_release_pointer();
|
||||||
tracking = FALSE;
|
tracking = FALSE;
|
||||||
if (pressed)
|
if (pressed)
|
||||||
{
|
{
|
||||||
@ -384,7 +298,7 @@ void TControl::enable(bool on)
|
|||||||
{
|
{
|
||||||
_disabled = !on;
|
_disabled = !on;
|
||||||
update();
|
update();
|
||||||
enable_window(win(), on);
|
xvt_vobj_set_enabled(win(), on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,8 +311,8 @@ void TControl::update() const
|
|||||||
{
|
{
|
||||||
if (_win != _hdc)
|
if (_win != _hdc)
|
||||||
get_geometry(_win);
|
get_geometry(_win);
|
||||||
clear_window(_hdc, MASK_BACK_COLOR);
|
xvt_dwin_clear(_hdc, MASK_BACK_COLOR);
|
||||||
win_set_fore_color(_hdc, disabled() ? DISABLED_COLOR : NORMAL_COLOR);
|
xvt_dwin_set_fore_color(_hdc, disabled() ? DISABLED_COLOR : color());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TControl::set_caption(const char* t)
|
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
|
void TText::update() const
|
||||||
{
|
{
|
||||||
TControl::update();
|
TControl::update();
|
||||||
win_set_fore_color(_hdc, NORMAL_COLOR);
|
xvt_dwin_set_fore_color(_hdc, color());
|
||||||
win_draw_text(_hdc, _client.left, _client.top+BASEY, (char*)caption(), -1);
|
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.pat = PAT_SOLID;
|
||||||
pen.style = P_SOLID;
|
pen.style = P_SOLID;
|
||||||
pen.color = c;
|
pen.color = c;
|
||||||
win_set_cpen(_hdc, &pen);
|
xvt_dwin_set_cpen(_hdc, &pen);
|
||||||
|
|
||||||
CBRUSH brush = { PAT_HOLLOW, MASK_BACK_COLOR };
|
CBRUSH brush = { PAT_HOLLOW, MASK_BACK_COLOR };
|
||||||
win_set_cbrush(_hdc, &brush);
|
xvt_dwin_set_cbrush(_hdc, &brush);
|
||||||
win_draw_roundrect(_hdc, (RCT*)&r, ROWY, ROWY);
|
xvt_dwin_draw_roundrect(_hdc, (RCT*)&r, ROWY, ROWY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TGroup::update() const
|
void TGroup::update() const
|
||||||
@ -528,7 +442,7 @@ void TButton::draw_pressed(bool pressed) const
|
|||||||
{
|
{
|
||||||
get_geometry(win());
|
get_geometry(win());
|
||||||
|
|
||||||
clear_window(_hdc, COLOR_LTGRAY);
|
xvt_dwin_clear(_hdc, COLOR_LTGRAY);
|
||||||
RCT r = _client;
|
RCT r = _client;
|
||||||
xvt_draw_rect(_hdc, r, COLOR_BLACK, COLOR_BLACK);
|
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.id = id();
|
||||||
e.v.ctl.ci.type = type();
|
e.v.ctl.ci.type = type();
|
||||||
e.v.ctl.ci.win = win();
|
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)
|
void TButton::check(bool on)
|
||||||
@ -579,9 +493,8 @@ void TButton::check(bool on)
|
|||||||
|
|
||||||
class TPush_button : public TButton
|
class TPush_button : public TButton
|
||||||
{
|
{
|
||||||
PICTURE _picup, _picdn;
|
TImage *_picup, *_picdn;
|
||||||
byte _dx, _dy;
|
short _accel, _dx, _dy;
|
||||||
int _accel;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void draw_pressed(bool pressed) const;
|
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)
|
long flags, long app_data, short id)
|
||||||
: TButton(left-(id == DLG_F9), top, right, bottom,
|
: TButton(left-(id == DLG_F9), top, right, bottom,
|
||||||
capt, parent, flags, app_data, id),
|
capt, parent, flags, app_data, id),
|
||||||
_picup(0L), _picdn(0L)
|
_picup(NULL), _picdn(NULL)
|
||||||
{
|
{
|
||||||
switch(id)
|
switch(id)
|
||||||
{
|
{
|
||||||
@ -677,18 +590,21 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
|||||||
if (diesis != NULL)
|
if (diesis != NULL)
|
||||||
{
|
{
|
||||||
int pid = atoi(++diesis);
|
int pid = atoi(++diesis);
|
||||||
_picup = cpb.getbmp(pid);
|
_picup = cpb.add(pid);
|
||||||
diesis = strchr(diesis, '#');
|
diesis = strchr(diesis, '#');
|
||||||
if (diesis != NULL)
|
if (diesis != NULL)
|
||||||
{
|
{
|
||||||
pid = atoi(++diesis);
|
pid = atoi(++diesis);
|
||||||
_picdn = cpb.getbmp(pid);
|
_picdn = cpb.add(pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT r;
|
_dx = (width - _picup->width()) >> 1;
|
||||||
cpb_get_picture_size(_picup, &r);
|
_dy = (height - _picup->height()) >> 1;
|
||||||
_dx = byte((width-r.right+1) >> 1);
|
|
||||||
_dy = byte((height-r.bottom) >> 1);
|
_picup->set_pos(_dx, _dy);
|
||||||
|
if (_picdn)
|
||||||
|
_picdn->set_pos(_dx+DEPTH, _dy+DEPTH);
|
||||||
|
|
||||||
_accel = -1;
|
_accel = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -698,8 +614,8 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
|||||||
if (_accel > 0)
|
if (_accel > 0)
|
||||||
_accel *= CHARX;
|
_accel *= CHARX;
|
||||||
|
|
||||||
_dx = (width - win_get_text_width(win(), (char*)caption(), -1)) >> 1;
|
_dx = (width - xvt_dwin_get_text_width(win(), (char*)caption(), -1)) >> 1;
|
||||||
_dy = byte((height-CHARY)/2 + BASEY - DEPTH);
|
_dy = (height-CHARY)/2 + BASEY - DEPTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,26 +627,34 @@ void TPush_button::draw_pressed(bool pressed) const
|
|||||||
{
|
{
|
||||||
TButton::draw_pressed(pressed);
|
TButton::draw_pressed(pressed);
|
||||||
|
|
||||||
const int p = pressed ? DEPTH : 0;
|
|
||||||
if (_picup)
|
if (_picup)
|
||||||
{
|
{
|
||||||
const PICTURE pic = (pressed && _picdn) ? _picdn : _picup;
|
const TImage* i = pressed ? _picdn : _picup;
|
||||||
cpb_win_picture_draw_at(_hdc, pic, _dx+p, _dy+p);
|
if (i == NULL)
|
||||||
|
{
|
||||||
|
RCT dst = _picup->rect();
|
||||||
|
xvt_rect_offset(&dst, _dx+DEPTH, _dy+DEPTH);
|
||||||
|
_picup->draw(_hdc, dst);
|
||||||
|
}
|
||||||
|
else i->draw(_hdc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char* t = caption();
|
const char* t = caption();
|
||||||
|
|
||||||
win_set_fore_color(_hdc, COLOR_WHITE);
|
const short x = _dx + DEPTH*pressed;
|
||||||
win_draw_text(_hdc, _dx+p+1, _dy+p+1, (char*)t, -1);
|
const short y = _dy + DEPTH*pressed;
|
||||||
if (_accel >= 0)
|
|
||||||
win_draw_text(_hdc, _dx+_accel+p+1, _dy+p+3, "_", 1);
|
|
||||||
|
|
||||||
const COLOR c = disabled() ? DISABLED_COLOR : NORMAL_COLOR;
|
xvt_dwin_set_fore_color(_hdc, COLOR_WHITE);
|
||||||
win_set_fore_color(_hdc, c);
|
xvt_dwin_draw_text(_hdc, x+1, y+1, (char*)t, -1);
|
||||||
win_draw_text(_hdc, _dx+p, _dy+p, (char*)t, -1);
|
|
||||||
if (_accel >= 0)
|
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.pat = PAT_SOLID;
|
||||||
pen.style = P_SOLID;
|
pen.style = P_SOLID;
|
||||||
pen.color = COLOR_RED;
|
pen.color = COLOR_RED;
|
||||||
win_set_cpen(_hdc, &pen);
|
xvt_dwin_set_cpen(_hdc, &pen);
|
||||||
CBRUSH brush = { PAT_HOLLOW, COLOR_WHITE };
|
CBRUSH brush = { PAT_HOLLOW, COLOR_WHITE };
|
||||||
win_set_cbrush(_hdc, &brush);
|
xvt_dwin_set_cbrush(_hdc, &brush);
|
||||||
win_draw_rect(_hdc, &_client);
|
xvt_dwin_draw_rect(_hdc, &_client);
|
||||||
} else
|
} else
|
||||||
if (disabled() && _picup)
|
if (disabled() && _picup)
|
||||||
{
|
{
|
||||||
@ -756,7 +680,7 @@ void TPush_button::update() const
|
|||||||
pen.pat = PAT_SOLID;
|
pen.pat = PAT_SOLID;
|
||||||
pen.style = P_SOLID;
|
pen.style = P_SOLID;
|
||||||
pen.color = COLOR_LTGRAY;
|
pen.color = COLOR_LTGRAY;
|
||||||
win_set_cpen(_hdc, &pen);
|
xvt_dwin_set_cpen(_hdc, &pen);
|
||||||
|
|
||||||
const int sx = _client.left+DEPTH+1;
|
const int sx = _client.left+DEPTH+1;
|
||||||
const int sy = _client.top+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)
|
for (int i = sx; i < ex; i += 2)
|
||||||
{
|
{
|
||||||
PNT p = { sy, i };
|
PNT p = { sy, i };
|
||||||
win_move_to(_hdc, p);
|
xvt_dwin_draw_set_pos(_hdc, p);
|
||||||
p.v = ey;
|
p.v = ey;
|
||||||
win_draw_line(_hdc, p);
|
xvt_dwin_draw_line(_hdc, p);
|
||||||
}
|
}
|
||||||
for (i = sy; i < ey; i += 2)
|
for (i = sy; i < ey; i += 2)
|
||||||
{
|
{
|
||||||
PNT p = { i, sx };
|
PNT p = { i, sx };
|
||||||
win_move_to(_hdc, p);
|
xvt_dwin_draw_set_pos(_hdc, p);
|
||||||
p.h = ex;
|
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)
|
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;
|
const int w = (flag == 3) ? width : width2;
|
||||||
if (flag == 2) r.right -= w;
|
if (flag == 2) r.right -= w;
|
||||||
|
|
||||||
create(r.right-w, r.bottom-height, r.right, r.bottom,
|
create(r.right-w, r.bottom-height, r.right, r.bottom,
|
||||||
"", parent, 0L, 0L, DLG_PAGE);
|
"", 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)
|
void TPage_button::mouse_down(PNT where)
|
||||||
@ -828,14 +752,14 @@ void TPage_button::mouse_down(PNT where)
|
|||||||
|
|
||||||
void TPage_button::mouse_up()
|
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
|
void TPage_button::update() const
|
||||||
{
|
{
|
||||||
TControl::update();
|
TControl::update();
|
||||||
if (_flag)
|
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)
|
void TPage_button::set_flag(byte f)
|
||||||
@ -871,29 +795,29 @@ public:
|
|||||||
TTag_button::TTag_button(WINDOW parent, byte p, byte tot)
|
TTag_button::TTag_button(WINDOW parent, byte p, byte tot)
|
||||||
: _parent(parent), _page(p), _pages(tot), _curr(p)
|
: _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);
|
create(0, 0, r.right, CHARY, "", parent,0L,0L, DLG_PAGETAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTag_button::update() const
|
void TTag_button::update() const
|
||||||
{
|
{
|
||||||
get_geometry(win());
|
get_geometry(win());
|
||||||
clear_window(_hdc, MASK_DARK_COLOR);
|
xvt_dwin_clear(_hdc, MASK_DARK_COLOR);
|
||||||
|
|
||||||
for (int i = 0; i < _pages; i++)
|
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};
|
CBRUSH b = { PAT_SOLID, (i == _page) ? MASK_BACK_COLOR : MASK_DARK_COLOR};
|
||||||
win_set_cbrush(_hdc, &b);
|
xvt_dwin_set_cbrush(_hdc, &b);
|
||||||
win_set_std_cpen(_hdc, TL_PEN_BLACK);
|
xvt_dwin_set_std_cpen(_hdc, TL_PEN_BLACK);
|
||||||
win_draw_rect(_hdc, &r);
|
xvt_dwin_draw_rect(_hdc, &r);
|
||||||
|
|
||||||
if (i == _page)
|
if (i == _page)
|
||||||
xvt_draw_rect(_hdc, r, MASK_LIGHT_COLOR, MASK_BACK_COLOR);
|
xvt_draw_rect(_hdc, r, MASK_LIGHT_COLOR, MASK_BACK_COLOR);
|
||||||
|
|
||||||
char n[4]; sprintf(n, "%d", i+1);
|
char n[4]; sprintf(n, "%d", i+1);
|
||||||
win_set_fore_color(_hdc, NORMAL_COLOR);
|
xvt_dwin_set_fore_color(_hdc, color());
|
||||||
win_draw_text(_hdc, (width-CHARX)/2 + i*width, BASEY, n, -1);
|
xvt_dwin_draw_text(_hdc, (width-CHARX)/2 + i*width, BASEY, n, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPEN pen;
|
CPEN pen;
|
||||||
@ -901,16 +825,16 @@ void TTag_button::update() const
|
|||||||
pen.pat = PAT_SOLID;
|
pen.pat = PAT_SOLID;
|
||||||
pen.style = P_SOLID;
|
pen.style = P_SOLID;
|
||||||
pen.color = MASK_LIGHT_COLOR;
|
pen.color = MASK_LIGHT_COLOR;
|
||||||
win_set_cpen(_hdc, &pen);
|
xvt_dwin_set_cpen(_hdc, &pen);
|
||||||
|
|
||||||
PNT p = { _client.bottom, 0 };
|
PNT p = { _client.bottom, 0 };
|
||||||
win_move_to(_hdc, p);
|
xvt_dwin_draw_set_pos(_hdc, p);
|
||||||
p.h = width*_page;
|
p.h = width*_page;
|
||||||
win_draw_line(_hdc, p);
|
xvt_dwin_draw_line(_hdc, p);
|
||||||
p.h += width+1;
|
p.h += width+1;
|
||||||
win_move_to(_hdc, p);
|
xvt_dwin_draw_set_pos(_hdc, p);
|
||||||
p.h = _client.right;
|
p.h = _client.right;
|
||||||
win_draw_line(_hdc, p);
|
xvt_dwin_draw_line(_hdc, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTag_button::mouse_down(PNT where)
|
void TTag_button::mouse_down(PNT where)
|
||||||
@ -938,8 +862,6 @@ void TTag_button::set_pages(byte p)
|
|||||||
|
|
||||||
class TCheckbox : public TButton
|
class TCheckbox : public TButton
|
||||||
{
|
{
|
||||||
static int _dy;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual WIN_TYPE type() const;
|
virtual WIN_TYPE type() const;
|
||||||
virtual void draw_pressed(bool pressed) const;
|
virtual void draw_pressed(bool pressed) const;
|
||||||
@ -954,8 +876,6 @@ public:
|
|||||||
virtual ~TCheckbox();
|
virtual ~TCheckbox();
|
||||||
};
|
};
|
||||||
|
|
||||||
int TCheckbox::_dy = -1;
|
|
||||||
|
|
||||||
TCheckbox::TCheckbox(
|
TCheckbox::TCheckbox(
|
||||||
short left, short top, short right, short bottom,
|
short left, short top, short right, short bottom,
|
||||||
const char* caption, WINDOW parent,
|
const char* caption, WINDOW parent,
|
||||||
@ -963,16 +883,17 @@ TCheckbox::TCheckbox(
|
|||||||
: TButton(left, top, right, bottom,
|
: TButton(left, top, right, bottom,
|
||||||
caption, parent, flags, app_data, id)
|
caption, parent, flags, app_data, id)
|
||||||
{
|
{
|
||||||
if (_dy < 0)
|
if (!cpb.exist(BMP_CHECK_ON))
|
||||||
{
|
{
|
||||||
cpb.getbmp(BMP_CHECK_ON, TRUE);
|
TImage* i = cpb.add(BMP_CHECK_ON, TRUE);
|
||||||
cpb.getbmp(BMP_CHECK_OFF, TRUE);
|
|
||||||
cpb.getbmp(BMP_RADIO_ON, TRUE);
|
|
||||||
PICTURE p = cpb.getbmp(BMP_RADIO_OFF, TRUE);
|
|
||||||
|
|
||||||
RCT r;
|
const short dx = 0;
|
||||||
cpb_get_picture_size(p, &r);
|
const short dy = BASEY - i->height() + 2;
|
||||||
_dy = BASEY - r.bottom + 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
|
void TCheckbox::draw_pressed(bool pressed) const
|
||||||
{
|
{
|
||||||
get_geometry(win());
|
get_geometry(win());
|
||||||
PICTURE pic;
|
short pic;
|
||||||
if (radio())
|
if (radio())
|
||||||
pic = pressed ? cpb[BMP_RADIO_ON] : cpb[BMP_RADIO_OFF];
|
pic = pressed ? BMP_RADIO_ON : BMP_RADIO_OFF;
|
||||||
else
|
else
|
||||||
pic = pressed ? cpb[BMP_CHECK_ON] : cpb[BMP_CHECK_OFF];
|
pic = pressed ? BMP_CHECK_ON : BMP_CHECK_OFF;
|
||||||
cpb_win_picture_draw_at(_hdc, pic, _client.left, _client.top+_dy);
|
cpb.image(pic).draw(_hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1014,14 +935,14 @@ void TCheckbox::update() const
|
|||||||
r.left = x-2; r.top = _client.top;
|
r.left = x-2; r.top = _client.top;
|
||||||
r.right = _client.right-CHARX; r.bottom = y+3;
|
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);
|
HDC hdc = GetDC(hwnd);
|
||||||
DrawFocusRect(hdc, &r);
|
DrawFocusRect(hdc, &r);
|
||||||
ReleaseDC(hwnd, hdc);
|
ReleaseDC(hwnd, hdc);
|
||||||
#endif
|
#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()
|
void free_controls_bmp()
|
||||||
{
|
{
|
||||||
cpb.reset();
|
cpb.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TControl* TControl::WINDOW2TControl(WINDOW win)
|
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);
|
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;
|
return *model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ WINDOW xvt_create_checkbox(
|
|||||||
WINDOW _win;
|
WINDOW _win;
|
||||||
short _id;
|
short _id;
|
||||||
TString80 _caption;
|
TString80 _caption;
|
||||||
|
COLOR _color;
|
||||||
|
|
||||||
bool _disabled : 1;
|
bool _disabled : 1;
|
||||||
bool _checked : 1;
|
bool _checked : 1;
|
||||||
@ -88,6 +89,9 @@ public:
|
|||||||
const char* caption() const { return _caption; }
|
const char* caption() const { return _caption; }
|
||||||
void set_caption(const char* c);
|
void set_caption(const char* c);
|
||||||
|
|
||||||
|
COLOR color() const { return _color; }
|
||||||
|
void set_color(COLOR c) { _color = c; }
|
||||||
|
|
||||||
bool checked() const { return _checked; }
|
bool checked() const { return _checked; }
|
||||||
virtual void check(bool on);
|
virtual void check(bool on);
|
||||||
|
|
||||||
|
@ -12,15 +12,12 @@
|
|||||||
#define DAYBIAS 36525L
|
#define DAYBIAS 36525L
|
||||||
#define NULLDATE -99999L
|
#define NULLDATE -99999L
|
||||||
|
|
||||||
const TDate nodate, botime, eotime(31,12,2050);
|
|
||||||
HIDDEN TDate __tmp_date;
|
HIDDEN TDate __tmp_date;
|
||||||
HIDDEN char __date_tmp_string[20];
|
HIDDEN char __date_tmp_string[20];
|
||||||
|
|
||||||
TDate::TDate(const TDate &d) : _val(d._val) {}
|
TDate::TDate(const TDate &d) : _val(d._val) {}
|
||||||
|
|
||||||
|
|
||||||
TDate::TDate(long l) : _val(l)
|
TDate::TDate(long l) : _val(l)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (_val == TODAY)
|
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 "";
|
if (!ok()) return "";
|
||||||
@ -193,6 +190,20 @@ char* TDate::string(int yeardgts, char sep) const
|
|||||||
else sprintf(s, "%04d", year);
|
else sprintf(s, "%04d", year);
|
||||||
__date_tmp_string[6] = '\0';
|
__date_tmp_string[6] = '\0';
|
||||||
strcat(__date_tmp_string, s);
|
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
|
else
|
||||||
if (yeardgts == ANSI)
|
if (yeardgts == ANSI)
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#define TODAY -1
|
#define TODAY -1
|
||||||
#define ANSI -1
|
#define ANSI -1
|
||||||
|
|
||||||
|
enum TDate_order { gma_date, mga_date, amg_date };
|
||||||
|
|
||||||
class TDate : public TObject
|
class TDate : public TObject
|
||||||
{
|
{
|
||||||
// @DPRIV
|
// @DPRIV
|
||||||
@ -28,7 +30,8 @@ class TDate : public TObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @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)
|
// @DES Ritorna la data in formato di stringa (anche in formato ANSI)
|
||||||
// @FPUB
|
// @FPUB
|
||||||
int day() const ; // Ritorna il giorno
|
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)
|
const char* itow(byte dayofweek); // Ritorna il nome del giorno (1-7)
|
||||||
|
|
||||||
// @DPUB
|
// @DPUB
|
||||||
extern const TDate nodate, botime, eotime;
|
const TDate botime(0,0,0), eotime(31,12,2050);
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
#endif // __DATE_H
|
#endif // __DATE_H
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
#ifndef APPNAME
|
#ifndef APPNAME
|
||||||
#define APPNAME PRASSI
|
#define APPNAME PRASSI
|
||||||
#define QAPPNAME "PRASSI"
|
#define QAPPNAME "PRASSI"
|
||||||
#define LIBDIR f:\xvt.322\xvtwin\lib
|
#define LIBDIR f:\xvt.400\win_x86\ptk\lib
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NO_STD_EDIT_MENU
|
#define NO_STD_EDIT_MENU
|
||||||
#define NO_STD_FILE_MENU
|
#define NO_STD_FILE_MENU
|
||||||
#define NO_STD_FONT_MENU
|
#define NO_STD_FONT_MENU
|
||||||
#define NO_STD_HELP_MENU
|
|
||||||
#define NO_STD_ABOUT_BOX
|
#define NO_STD_ABOUT_BOX
|
||||||
|
#define NO_STD_HELP_MENU
|
||||||
|
#define NO_HELP_RESOURCES
|
||||||
#include <url.h>
|
#include <url.h>
|
||||||
|
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -54,48 +55,48 @@ MENU M_EDIT
|
|||||||
ACCEL MENU_FILE "f" ALT
|
ACCEL MENU_FILE "f" ALT
|
||||||
|
|
||||||
#if XVTWS == WINWS
|
#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>
|
#scan <xil.h>
|
||||||
#transparent $$$
|
#transparent $$$
|
||||||
XI_CURSOR_RESIZE cursor DISCARDABLE f:\p.due\bmp\resize.cur
|
XI_CURSOR_RESIZE cursor f:/p.due/bmp/resize.cur
|
||||||
XI_CURSOR_HAND cursor DISCARDABLE f:\p.due\bmp\hand.cur
|
XI_CURSOR_HAND cursor f:/p.due/bmp/hand.cur
|
||||||
XI_CURSOR_VRESIZE cursor DISCARDABLE f:\p.due\bmp\vresize.cur
|
XI_CURSOR_VRESIZE cursor f:/p.due/bmp/vresize.cur
|
||||||
COMBO_ICON icon DISCARDABLE f:\p.due\bmp\combo.ico
|
COMBO_ICON icon f:/p.due/bmp/combo.ico
|
||||||
ICO_SEARCH icon DISCARDABLE f:\p.due\bmp\search.ico
|
ICO_SEARCH icon 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
|
|
||||||
|
|
||||||
$$$
|
$$$
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
|
#include <prefix.h>
|
||||||
|
|
||||||
bool TExternal_app::can_run() const
|
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);
|
TString256 path(_path);
|
||||||
|
|
||||||
if (user)
|
if (utente)
|
||||||
path << " -u" << main_app().user();
|
path << " -u" << user();
|
||||||
|
|
||||||
_error = 0;
|
_error = 0;
|
||||||
_exitcode = 0;
|
_exitcode = 0;
|
||||||
|
|
||||||
// save cwd
|
// save cwd
|
||||||
save_dir();
|
xvt_fsys_save_dir();
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (can_run())
|
if (can_run())
|
||||||
@ -67,7 +68,7 @@ int TExternal_app::run(bool async, bool user)
|
|||||||
{
|
{
|
||||||
if (i == 0 && TaskFindHandle(&te, child) == FALSE)
|
if (i == 0 && TaskFindHandle(&te, child) == FALSE)
|
||||||
break;
|
break;
|
||||||
process_events();
|
xvt_app_process_pending_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
tw.maximize();
|
tw.maximize();
|
||||||
@ -132,12 +133,12 @@ int TExternal_app::run(bool async, bool user)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_error = errno;
|
_error = errno;
|
||||||
xvt_escape(XVT_ESC_CH_REFRESH);
|
xvt_app_escape(XVT_ESC_CH_REFRESH);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// restore cwd
|
// restore cwd
|
||||||
restore_dir();
|
xvt_fsys_restore_dir();
|
||||||
|
|
||||||
// update counts
|
// update counts
|
||||||
if (_exitcode == 0)
|
if (_exitcode == 0)
|
||||||
|
@ -46,7 +46,6 @@ extern "C" {
|
|||||||
// Guy moved these outside extern
|
// Guy moved these outside extern
|
||||||
extern isfdptr* openf;
|
extern isfdptr* openf;
|
||||||
extern Str80 cprefix;
|
extern Str80 cprefix;
|
||||||
extern long stdlevel;
|
|
||||||
|
|
||||||
#ifdef __STDTYPES_CPP
|
#ifdef __STDTYPES_CPP
|
||||||
#define extern
|
#define extern
|
||||||
|
184
include/form.cpp
184
include/form.cpp
@ -46,8 +46,11 @@ TForm_flags::TForm_flags()
|
|||||||
shown = enabled = TRUE;
|
shown = enabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read from string
|
||||||
|
// Certified 100%
|
||||||
bool TForm_flags::update(const char* s)
|
bool TForm_flags::update(const char* s)
|
||||||
{
|
{
|
||||||
|
CHECK(s, "NULL flags string");
|
||||||
for (; *s; s++) switch(toupper(*s))
|
for (; *s; s++) switch(toupper(*s))
|
||||||
{
|
{
|
||||||
case 'A':
|
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
|
void TForm_flags::print_on(ostream& out) const
|
||||||
{
|
{
|
||||||
TString16 s;
|
TString16 s;
|
||||||
@ -75,7 +80,8 @@ void TForm_flags::print_on(ostream& out) const
|
|||||||
out << " FLAGS \"" << s << '"' << endl;
|
out << " FLAGS \"" << s << '"' << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set mask fields
|
||||||
|
// Certified 100%
|
||||||
void TForm_flags::print_on(TMask& m)
|
void TForm_flags::print_on(TMask& m)
|
||||||
{
|
{
|
||||||
m.set(F_DISABLED, enabled ? " " : "X");
|
m.set(F_DISABLED, enabled ? " " : "X");
|
||||||
@ -84,6 +90,8 @@ void TForm_flags::print_on(TMask& m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get mask fields
|
||||||
|
// Certified 100%
|
||||||
void TForm_flags::read_from(const TMask& m)
|
void TForm_flags::read_from(const TMask& m)
|
||||||
{
|
{
|
||||||
shown = !m.get_bool(F_HIDDEN);
|
shown = !m.get_bool(F_HIDDEN);
|
||||||
@ -118,7 +126,7 @@ protected:
|
|||||||
bool hidden() const { return !_flag.shown; }
|
bool hidden() const { return !_flag.shown; }
|
||||||
bool enabled() const { return _flag.enabled; }
|
bool enabled() const { return _flag.enabled; }
|
||||||
bool disabled() 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_head(TScanner&);
|
||||||
virtual bool parse_item(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)
|
bool TForm_string::set(const char* s)
|
||||||
{
|
{
|
||||||
_str = s;
|
_str = s;
|
||||||
if (width()) _str.cut(width());
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TForm_string::get() const
|
const char* TForm_string::get() const
|
||||||
{ return _str; }
|
{ return _str; }
|
||||||
|
|
||||||
|
|
||||||
|
// Se un campo e' abilitato ed ha almeno un riferimento su file leggilo
|
||||||
bool TForm_string::read()
|
bool TForm_string::read()
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
@ -549,11 +558,8 @@ bool TForm_string::read()
|
|||||||
{
|
{
|
||||||
const char* s = "";
|
const char* s = "";
|
||||||
const TRelation* r = section().form().relation();
|
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);
|
s = field(i).read(r);
|
||||||
if (*s) break;
|
|
||||||
}
|
|
||||||
set(s);
|
set(s);
|
||||||
}
|
}
|
||||||
} else ok = FALSE;
|
} else ok = FALSE;
|
||||||
@ -828,13 +834,14 @@ public:
|
|||||||
virtual ~TForm_group() {}
|
virtual ~TForm_group() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TPrint_section
|
// TPrint_section
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TMask* TPrint_section::_msk = NULL;
|
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()
|
TPrint_section::~TPrint_section()
|
||||||
@ -850,6 +857,8 @@ const TPrint_section& TPrint_section::copy(const TPrint_section& ps)
|
|||||||
{
|
{
|
||||||
_item = ps._item;
|
_item = ps._item;
|
||||||
_height = ps._height;
|
_height = ps._height;
|
||||||
|
_x = ps._x;
|
||||||
|
_y = ps._y;
|
||||||
return ps;
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -884,7 +893,7 @@ TForm_item* TPrint_section::parse_item(const TString& s)
|
|||||||
if (s == "GR")
|
if (s == "GR")
|
||||||
return new TForm_group(this);
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +913,7 @@ bool TPrint_section::parse(TScanner& scanner)
|
|||||||
while (scanner.popkey() != "EN")
|
while (scanner.popkey() != "EN")
|
||||||
{
|
{
|
||||||
TForm_item *fi = parse_item(scanner);
|
TForm_item *fi = parse_item(scanner);
|
||||||
if (!fi) return FALSE;
|
if (fi == NULL) return FALSE;
|
||||||
|
|
||||||
if (fi->parse(scanner))
|
if (fi->parse(scanner))
|
||||||
_item.add(fi);
|
_item.add(fi);
|
||||||
@ -958,7 +967,7 @@ bool TPrint_section::edit(const char* title, bool all)
|
|||||||
_y = m.get_int(F_Y);
|
_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++)
|
for (word i = 0; i < fields(); i++)
|
||||||
{
|
{
|
||||||
@ -997,6 +1006,8 @@ bool TPrint_section::edit(const char* title, bool all)
|
|||||||
{
|
{
|
||||||
const TString& c = _msk->get(F_CLASS).left(2);
|
const TString& c = _msk->get(F_CLASS).left(2);
|
||||||
TForm_item* item = parse_item(c);
|
TForm_item* item = parse_item(c);
|
||||||
|
if (item != NULL)
|
||||||
|
{
|
||||||
item->read_from(*_msk);
|
item->read_from(*_msk);
|
||||||
_item.insert(item, i);
|
_item.insert(item, i);
|
||||||
|
|
||||||
@ -1004,6 +1015,7 @@ bool TPrint_section::edit(const char* title, bool all)
|
|||||||
a.insert(s, i);
|
a.insert(s, i);
|
||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else error_box("L'inserimento e' disabilitato");
|
} else error_box("L'inserimento e' disabilitato");
|
||||||
break;
|
break;
|
||||||
case K_DEL:
|
case K_DEL:
|
||||||
@ -1024,11 +1036,96 @@ bool TPrint_section::edit(const char* title, bool all)
|
|||||||
|
|
||||||
void TPrint_section::print_on(ostream& out) const
|
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++)
|
for(word i = 0; i < fields(); i++)
|
||||||
out << field(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
|
// TForm
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -1105,12 +1202,14 @@ bool TForm::parse_join(TScanner& scanner)
|
|||||||
TPrint_section* TForm::exist(char s, pagetype t, bool create)
|
TPrint_section* TForm::exist(char s, pagetype t, bool create)
|
||||||
{
|
{
|
||||||
TArray* a = NULL;
|
TArray* a = NULL;
|
||||||
switch (s)
|
switch (toupper(s))
|
||||||
{
|
{
|
||||||
case 'H':
|
case 'G':
|
||||||
a = &_head; break;
|
a = &_back; break;
|
||||||
case 'F':
|
case 'F':
|
||||||
a = &_foot; break;
|
a = &_foot; break;
|
||||||
|
case 'H':
|
||||||
|
a = &_head; break;
|
||||||
default:
|
default:
|
||||||
a = &_body; break;
|
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);
|
TPrint_section* sec = (TPrint_section*)a->objptr(t);
|
||||||
if (sec == NULL && create)
|
if (sec == NULL && create)
|
||||||
{
|
{
|
||||||
sec = new TPrint_section(this);
|
sec = (s == 'G') ? new TGraphic_section(this) : new TPrint_section(this);
|
||||||
a->add(sec, t);
|
a->add(sec, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1131,12 +1230,25 @@ TPrint_section& TForm::section(char s, word p)
|
|||||||
pagetype pos = odd_page;
|
pagetype pos = odd_page;
|
||||||
if (p == 0 && exist(s, last_page)) pos = last_page;
|
if (p == 0 && exist(s, last_page)) pos = last_page;
|
||||||
if (p == 1 && exist(s, first_page)) pos = first_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);
|
TPrint_section* sec = exist(s, pos, TRUE);
|
||||||
return *sec;
|
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)
|
word TForm::set_header(word p, bool u)
|
||||||
{
|
{
|
||||||
@ -1198,6 +1310,7 @@ word TForm::set_footer(word p, bool u)
|
|||||||
void TForm::header_handler(TPrinter& p)
|
void TForm::header_handler(TPrinter& p)
|
||||||
{
|
{
|
||||||
const word page = form().page(p);
|
const word page = form().page(p);
|
||||||
|
form().set_background(page, TRUE);
|
||||||
form().set_header(page, TRUE);
|
form().set_header(page, TRUE);
|
||||||
form().set_footer(page, FALSE);
|
form().set_footer(page, FALSE);
|
||||||
}
|
}
|
||||||
@ -1237,8 +1350,11 @@ bool TForm::print(long from, long to)
|
|||||||
|
|
||||||
_lastpage = FALSE; // non e' l'ultima pagina
|
_lastpage = FALSE; // non e' l'ultima pagina
|
||||||
|
|
||||||
|
set_background(1, TRUE);
|
||||||
|
|
||||||
if (!was_open && !printer.open())
|
if (!was_open && !printer.open())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
do_events();
|
||||||
|
|
||||||
if (to < 0) to = records()-1;
|
if (to < 0) to = records()-1;
|
||||||
|
|
||||||
@ -1261,6 +1377,7 @@ bool TForm::print(long from, long to)
|
|||||||
if (exist('H', last_page) || exist('B', last_page) || exist('F', last_page))
|
if (exist('H', last_page) || exist('B', last_page) || exist('F', last_page))
|
||||||
{
|
{
|
||||||
_lastpage = TRUE;
|
_lastpage = TRUE;
|
||||||
|
set_background(0, TRUE);
|
||||||
set_header(0, TRUE);
|
set_header(0, TRUE);
|
||||||
set_body(0, TRUE);
|
set_body(0, TRUE);
|
||||||
printer.formfeed();
|
printer.formfeed();
|
||||||
@ -1284,7 +1401,14 @@ void TForm::print_section(ostream& out, char s) const
|
|||||||
const TPrint_section* sec = ((TForm*)this)->exist(s, t);
|
const TPrint_section* sec = ((TForm*)this)->exist(s, t);
|
||||||
if (sec && sec->ok())
|
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 << "SECTION " << name << ' ' << int(t);
|
||||||
out << *sec;
|
out << *sec;
|
||||||
out << "END\n" << endl;
|
out << "END\n" << endl;
|
||||||
@ -1300,8 +1424,9 @@ void TForm::print_on(ostream& out) const
|
|||||||
main_app().begin_wait();
|
main_app().begin_wait();
|
||||||
|
|
||||||
if (relation())
|
if (relation())
|
||||||
out << *relation() << endl;
|
out << *relation() << "\nEND" << endl;
|
||||||
|
|
||||||
|
print_section(out, 'G');
|
||||||
print_section(out, 'H');
|
print_section(out, 'H');
|
||||||
print_section(out, 'B');
|
print_section(out, 'B');
|
||||||
print_section(out, 'F');
|
print_section(out, 'F');
|
||||||
@ -1315,12 +1440,19 @@ void TForm::print_on(ostream& out) const
|
|||||||
word TForm::height()
|
word TForm::height()
|
||||||
{
|
{
|
||||||
word h = 0;
|
word h = 0;
|
||||||
|
|
||||||
|
if (_back.items() == 0)
|
||||||
|
{
|
||||||
if (_head.items())
|
if (_head.items())
|
||||||
h += section('H', 1).height();
|
h += section('H', 1).height();
|
||||||
if (_body.items())
|
if (_body.items())
|
||||||
h += section('B', 1).height();
|
h += section('B', 1).height();
|
||||||
if (_foot.items())
|
if (_foot.items())
|
||||||
h += section('F', 1).height();
|
h += section('F', 1).height();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
h = main_app().printer().formlen();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,22 +1466,22 @@ TForm::TForm(const char* name)
|
|||||||
TScanner scanner(_name);
|
TScanner scanner(_name);
|
||||||
|
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
if (scanner.popkey() == "US")
|
if (scanner.popkey() == "US") // Parse relation
|
||||||
{
|
{
|
||||||
ok = parse_use(scanner);
|
ok = parse_use(scanner);
|
||||||
while (ok && scanner.popkey() == "JO")
|
while (ok && scanner.popkey() == "JO")
|
||||||
ok = parse_join(scanner);
|
ok = parse_join(scanner);
|
||||||
}
|
}
|
||||||
|
else scanner.push();
|
||||||
|
|
||||||
while (ok)
|
while (ok)
|
||||||
{
|
{
|
||||||
scanner.popkey();
|
if (scanner.popkey() != "SE") // SECTION or END
|
||||||
const char sec = toupper(scanner.key()[0]);
|
|
||||||
if (sec <= ' ' || sec == 'E')
|
|
||||||
break;
|
break;
|
||||||
const pagetype p = (pagetype)scanner.integer();
|
const char sec = scanner.popkey()[0]; // Section name (GR, HE, BO, FO)
|
||||||
TPrint_section* ps = exist(sec, p, TRUE);
|
const pagetype p = (pagetype)scanner.integer(); // Section type (odd, even, first, last)
|
||||||
ok = ps->parse(scanner);
|
TPrint_section* ps = exist(sec, p, TRUE); // Create section
|
||||||
|
ok = ps->parse(scanner); // Parse section
|
||||||
}
|
}
|
||||||
|
|
||||||
main_app().end_wait();
|
main_app().end_wait();
|
||||||
|
@ -37,7 +37,7 @@ class TPrint_section : public TArray
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void print_on(ostream& out) const;
|
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);
|
TForm_item* parse_item(TScanner& scanner);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -54,7 +54,7 @@ public:
|
|||||||
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
virtual bool ok() const { return height() > 0 || fields() > 0; }
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
bool update();
|
virtual bool update();
|
||||||
bool parse(TScanner& scanner);
|
bool parse(TScanner& scanner);
|
||||||
|
|
||||||
bool edit(const char* title, bool all);
|
bool edit(const char* title, bool all);
|
||||||
@ -78,6 +78,7 @@ class TForm : public TObject
|
|||||||
TArray _head; // Headers
|
TArray _head; // Headers
|
||||||
TArray _body; // Bodies
|
TArray _body; // Bodies
|
||||||
TArray _foot; // Footers
|
TArray _foot; // Footers
|
||||||
|
TArray _back; // Graphic background
|
||||||
|
|
||||||
bool _lastpage; // I am about to print the last page
|
bool _lastpage; // I am about to print the last page
|
||||||
|
|
||||||
@ -101,6 +102,7 @@ protected:
|
|||||||
word page(const TPrinter& p) const;
|
word page(const TPrinter& p) const;
|
||||||
|
|
||||||
virtual long records() const;
|
virtual long records() const;
|
||||||
|
virtual word set_background(word p, bool u);
|
||||||
virtual word set_header(word p, bool u);
|
virtual word set_header(word p, bool u);
|
||||||
virtual word set_body(word p, bool u);
|
virtual word set_body(word p, bool u);
|
||||||
virtual word set_footer(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 TLocalisamfile::open(unsigned int mode)
|
||||||
|
|
||||||
{
|
{
|
||||||
int err = NOERR;
|
int err = NOERR;
|
||||||
const int logicnum = num();
|
const int logicnum = num();
|
||||||
@ -702,13 +701,14 @@ int TLocalisamfile::open(unsigned int mode)
|
|||||||
{
|
{
|
||||||
_was_open = FALSE;
|
_was_open = FALSE;
|
||||||
_isamfile = openf[logicnum - 1];
|
_isamfile = openf[logicnum - 1];
|
||||||
_current->_i = filehnd();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = _open();
|
err = _open();
|
||||||
_was_open = TRUE;
|
_was_open = TRUE;
|
||||||
}
|
}
|
||||||
|
_current->_i = filehnd();
|
||||||
|
|
||||||
setstatus(err);
|
setstatus(err);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -923,7 +923,7 @@ bool TSystemisamfile::exec_convapp(long flev, const bool before)
|
|||||||
|
|
||||||
if (flev == 0) flev = 199401;
|
if (flev == 0) flev = 199401;
|
||||||
else flev++;
|
else flev++;
|
||||||
for (long l = flev; l <= stdlevel; l++)
|
for (long l = flev; l <= get_std_level(); l++)
|
||||||
{
|
{
|
||||||
TString16 paragraph(format("%06ld", l));
|
TString16 paragraph(format("%06ld", l));
|
||||||
TConfig conv(CONFIG_FCONV, paragraph);
|
TConfig conv(CONFIG_FCONV, paragraph);
|
||||||
@ -958,7 +958,7 @@ bool TSystemisamfile::getlcf(long flev)
|
|||||||
_exps.destroy();
|
_exps.destroy();
|
||||||
if (flev == 0) flev = 199401;
|
if (flev == 0) flev = 199401;
|
||||||
else flev++;
|
else flev++;
|
||||||
for (long l = flev; l <= stdlevel; l++)
|
for (long l = flev; l <= get_std_level(); l++)
|
||||||
{
|
{
|
||||||
TString16 paragraph(format("%06ld", l));
|
TString16 paragraph(format("%06ld", l));
|
||||||
TConfig conv(CONFIG_FCONV, paragraph);
|
TConfig conv(CONFIG_FCONV, paragraph);
|
||||||
@ -1009,14 +1009,14 @@ int TSystemisamfile::update(TTrec& newrec, bool vis)
|
|||||||
|
|
||||||
dir.get(num(), _lock, _nordir, _sysdirop);
|
dir.get(num(), _lock, _nordir, _sysdirop);
|
||||||
const char p = *dir.name();
|
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();
|
const bool toconvert = is_com ? dir.is_com() : dir.is_firm();
|
||||||
|
|
||||||
int err = NOERR;
|
int err = NOERR;
|
||||||
TTrec oldrec;
|
TTrec oldrec;
|
||||||
|
|
||||||
oldrec.get(num());
|
oldrec.get(num());
|
||||||
const long lev = prefhndl->filelevel();
|
const long lev = prefix().filelevel();
|
||||||
const bool lcf = getlcf(lev);
|
const bool lcf = getlcf(lev);
|
||||||
exec_convapp(lev, TRUE);
|
exec_convapp(lev, TRUE);
|
||||||
|
|
||||||
@ -1176,8 +1176,9 @@ int TSystemisamfile::load(const char* from, char fs, char fd, char rs, bool vis,
|
|||||||
{
|
{
|
||||||
f.equal();
|
f.equal();
|
||||||
const long level = atol(f.line());
|
const long level = atol(f.line());
|
||||||
if (level > stdlevel)
|
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, stdlevel / 100, stdlevel % 100);
|
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);
|
lcf = getlcf(level);
|
||||||
nflds = 0;
|
nflds = 0;
|
||||||
TToken_string s2(f.line());
|
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);
|
TProgind p(nitems, s, TRUE, TRUE, 70);
|
||||||
TString s1;
|
TString s1;
|
||||||
|
|
||||||
fprintf(f, "[Header]\nVersion=%ld", prefhndl->filelevel());
|
fprintf(f, "[Header]\nVersion=%ld", prefix().filelevel());
|
||||||
for (int k = 0; k < nflds; k++)
|
for (int k = 0; k < nflds; k++)
|
||||||
{
|
{
|
||||||
if ((k % 10) == 0) fprintf(f, "\nFields=");
|
if ((k % 10) == 0) fprintf(f, "\nFields=");
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __KEYS_H
|
#ifndef __KEYS_H
|
||||||
#define __KEYS_H
|
#define __KEYS_H
|
||||||
|
|
||||||
#ifndef XVT_INCL_CONST
|
#ifndef XVT_INCL_DEFS
|
||||||
#include <xvtconst.h>
|
#include <xvt_defs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* @M */
|
/* @M */
|
||||||
|
@ -19,7 +19,6 @@ HIDDEN const char* const MASK_EXT = "msk";
|
|||||||
|
|
||||||
HIDDEN bool moving_focus = FALSE;
|
HIDDEN bool moving_focus = FALSE;
|
||||||
|
|
||||||
bool TMask::on_dirty( TMask_field& c ) {return TRUE;}
|
|
||||||
|
|
||||||
bool TMask::test_focus_change(WINDOW next)
|
bool TMask::test_focus_change(WINDOW next)
|
||||||
{
|
{
|
||||||
@ -34,12 +33,12 @@ bool TMask::test_focus_change(WINDOW next)
|
|||||||
set_focus();
|
set_focus();
|
||||||
prev.set_focusdirty(FALSE);
|
prev.set_focusdirty(FALSE);
|
||||||
}
|
}
|
||||||
// NUOVO
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( prev.focusdirty() )
|
if ( prev.focusdirty() )
|
||||||
ok = on_dirty( prev );
|
ok = on_dirty( prev );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -49,7 +48,7 @@ void TMask::control_handler(EVENT* ep)
|
|||||||
const WINDOW win = ep->v.ctl.ci.win;
|
const WINDOW win = ep->v.ctl.ci.win;
|
||||||
const WIN_TYPE type = ep->v.ctl.ci.type;
|
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");
|
CHECK(f != NULL, "Invalid field pointer in control");
|
||||||
|
|
||||||
if (type == WC_CHECKBOX)
|
if (type == WC_CHECKBOX)
|
||||||
@ -122,13 +121,13 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
|||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (win != toolwin())
|
if (win != toolwin())
|
||||||
{
|
{
|
||||||
clear_window(win, MASK_BACK_COLOR);
|
xvt_dwin_clear(win, MASK_BACK_COLOR);
|
||||||
RCT r; get_client_rect(win, &r); r.right--; r.bottom--;
|
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);
|
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
|
#else
|
||||||
clear_window(win, MASK_BACK_COLOR);
|
xvt_dwin_clear(win, MASK_BACK_COLOR);
|
||||||
#endif
|
#endif
|
||||||
update();
|
update();
|
||||||
return;
|
return;
|
||||||
@ -154,7 +153,7 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
|||||||
case DLG_F9:
|
case DLG_F9:
|
||||||
{
|
{
|
||||||
WINDOW w = ep->v.ctl.ci.win;
|
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();
|
w = f->win();
|
||||||
if (test_focus_change(w))
|
if (test_focus_change(w))
|
||||||
f->on_key(K_F9); // Attiva ricerca sul campo associato al bottone
|
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;
|
const int k = p*2;
|
||||||
t[k] = '['; t[k+2] = ']';
|
t[k] = '['; t[k+2] = ']';
|
||||||
RCT r; set_rect(&r, 0, 0, t.size()*CHARX, CHARY);
|
RCT r; xvt_rect_set(&r, 0, 0, t.size()*CHARX, CHARY);
|
||||||
create_control(WC_TEXT, &r, t, _pagewin[p], 0, 0, DLG_NULL);
|
xvt_ctl_create(WC_TEXT, &r, t, _pagewin[p], 0, 0, DLG_NULL);
|
||||||
t[k] = ' ';
|
t[k] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -299,7 +298,7 @@ TMask::~TMask()
|
|||||||
for (int p = 0; p <= MAX_PAGES; p++)
|
for (int p = 0; p <= MAX_PAGES; p++)
|
||||||
if (_pagewin[p])
|
if (_pagewin[p])
|
||||||
{
|
{
|
||||||
close_window(_pagewin[p]);
|
xvt_vobj_destroy(_pagewin[p]);
|
||||||
_pagewin[p] = NULL_WIN;
|
_pagewin[p] = NULL_WIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,7 +316,7 @@ void TMask::open()
|
|||||||
{
|
{
|
||||||
_open = TRUE;
|
_open = TRUE;
|
||||||
if (toolwin())
|
if (toolwin())
|
||||||
show_window(toolwin(), TRUE);
|
xvt_vobj_set_visible(toolwin(), TRUE);
|
||||||
next_page(0);
|
next_page(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -369,7 +368,7 @@ void TMask::close()
|
|||||||
_open = FALSE;
|
_open = FALSE;
|
||||||
_page = -1;
|
_page = -1;
|
||||||
for (int p = 0; p <= MAX_PAGES; p++)
|
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
|
void TMask::set_mask_fields() const
|
||||||
@ -663,8 +662,8 @@ void TMask::set_focus()
|
|||||||
{
|
{
|
||||||
const WINDOW pw = win(); // previous window
|
const WINDOW pw = win(); // previous window
|
||||||
_page = page; // update page number
|
_page = page; // update page number
|
||||||
show_window(win(), TRUE); // show new page
|
xvt_vobj_set_visible(win(), TRUE); // show new page
|
||||||
if (pw) show_window(pw, FALSE); // hide old page
|
if (pw) xvt_vobj_set_visible(pw, FALSE); // hide old page
|
||||||
}
|
}
|
||||||
|
|
||||||
f.highlight();
|
f.highlight();
|
||||||
@ -810,6 +809,11 @@ bool TMask::on_key(KEY key)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMask::on_dirty(TMask_field&)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TMask_field* TMask::parse_field(TScanner& scanner)
|
TMask_field* TMask::parse_field(TScanner& scanner)
|
||||||
{
|
{
|
||||||
@ -844,7 +848,7 @@ WINDOW TMask::read_page(TScanner& scanner, bool toolbar)
|
|||||||
if (toolwin())
|
if (toolwin())
|
||||||
{
|
{
|
||||||
scanner.line();
|
scanner.line();
|
||||||
set_rect(&r, 0, 0, 0, tooly);
|
xvt_rect_set(&r, 0, 0, 0, tooly);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -954,13 +958,13 @@ void TMask::next_page(int p)
|
|||||||
_page = k;
|
_page = k;
|
||||||
} else _page = 0;
|
} else _page = 0;
|
||||||
|
|
||||||
const WINDOW w = win(); // Current page window
|
|
||||||
if (_page != prev)
|
if (_page != prev)
|
||||||
{
|
{
|
||||||
show_window(w, TRUE);
|
const WINDOW w = _pagewin[_page];
|
||||||
|
xvt_vobj_set_visible(w, TRUE);
|
||||||
if (prev >= 0)
|
if (prev >= 0)
|
||||||
{
|
{
|
||||||
show_window(_pagewin[prev], FALSE);
|
xvt_vobj_set_visible(_pagewin[prev], FALSE);
|
||||||
_focus = find_first_field(w, +1);
|
_focus = find_first_field(w, +1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1029,7 +1033,7 @@ void TMask::activate(bool on)
|
|||||||
{
|
{
|
||||||
TWindow::activate(on);
|
TWindow::activate(on);
|
||||||
if (toolwin() != NULL_WIN)
|
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
|
const char* TMask::get_caption() const
|
||||||
{
|
{
|
||||||
char* title = &__tmp_string[512];
|
char* title = &__tmp_string[512];
|
||||||
get_title(_pagewin[0], title, 80);
|
xvt_vobj_get_title(_pagewin[0], title, 80);
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMask::set_caption(const char* c)
|
void TMask::set_caption(const char* c)
|
||||||
{
|
{
|
||||||
for (int p = 0; p < _pages; p++)
|
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:
|
protected:
|
||||||
// Ritorna la finestra della pagina corrente (Usare con attenzione)
|
// 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]; }
|
WINDOW toolwin() const { return _pagewin[MAX_PAGES]; }
|
||||||
|
|
||||||
int find_field_win(WINDOW win) const; // number of field with window win
|
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 <xvt.h>
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
@ -276,14 +275,14 @@ WINDOW TMask_field::wincreate(WIN_TYPE ct, short dx, short dy,
|
|||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
WINDOW TMask_field::parent() const
|
WINDOW TMask_field::parent() const
|
||||||
{ return get_parent(win()); }
|
{ return xvt_vobj_get_parent(win()); }
|
||||||
|
|
||||||
|
|
||||||
// Certified 90%
|
// Certified 90%
|
||||||
int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
||||||
{
|
{
|
||||||
const WIN_TYPE wt = (heigth < 3) ? WC_TEXT : WC_GROUPBOX;
|
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
|
_prompt.rtrim(); // Could save some bytes
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
@ -293,6 +292,8 @@ int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
|||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
const int k = _prompt.find('~');
|
const int k = _prompt.find('~');
|
||||||
if (k >= 0) _prompt[k] = '&';
|
if (k >= 0) _prompt[k] = '&';
|
||||||
|
if (required() && _prompt[0] != '@')
|
||||||
|
_prompt.insert("@b", 0);
|
||||||
#endif
|
#endif
|
||||||
_promptwin = xvt_create_control
|
_promptwin = xvt_create_control
|
||||||
(
|
(
|
||||||
@ -313,9 +314,9 @@ int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
|||||||
void TMask_field::destroy()
|
void TMask_field::destroy()
|
||||||
{
|
{
|
||||||
if (_win)
|
if (_win)
|
||||||
{ close_window(_win); _win = NULL_WIN; }
|
{ xvt_vobj_destroy(_win); _win = NULL_WIN; }
|
||||||
if (_promptwin)
|
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();
|
const word c = class_id();
|
||||||
if (c != CLASS_FIELD)
|
if (c != CLASS_FIELD)
|
||||||
{
|
{
|
||||||
enable_window(_win, on);
|
xvt_vobj_set_enabled(_win, on);
|
||||||
_flags.enabled = on;
|
_flags.enabled = on;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,9 +352,9 @@ void TMask_field::enable_default()
|
|||||||
// Certified 100%
|
// Certified 100%
|
||||||
void TMask_field::show(bool on)
|
void TMask_field::show(bool on)
|
||||||
{
|
{
|
||||||
show_window(_win, on);
|
xvt_vobj_set_visible(_win, on);
|
||||||
if (_promptwin != NULL_WIN)
|
if (_promptwin != NULL_WIN)
|
||||||
show_window(_promptwin, on);
|
xvt_vobj_set_visible(_promptwin, on);
|
||||||
_flags.shown = on;
|
_flags.shown = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +395,7 @@ void TMask_field::set_dirty(bool d)
|
|||||||
// Certified 99%
|
// Certified 99%
|
||||||
const char* TMask_field::get_window_data() const
|
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)
|
void TMask_field::set_window_data(const char* data)
|
||||||
{
|
{
|
||||||
if (data != NULL)
|
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)
|
void TMask_field::set_prompt(const char* p)
|
||||||
{
|
{
|
||||||
if (_promptwin != NULL_WIN)
|
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));
|
const TString16 mod(topic.left(2));
|
||||||
if (mod != "ba") hlp.insert(mod, 0);
|
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);
|
WinHelp(hwnd, hlp, HELP_MULTIKEY, (DWORD)&mk);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -863,7 +864,7 @@ bool TMask_field::on_key(KEY key)
|
|||||||
|
|
||||||
void TMask_field::highlight() const
|
void TMask_field::highlight() const
|
||||||
{
|
{
|
||||||
set_front_window(win());
|
xvt_scr_set_focus_vobj(win());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMask_field::set_focus() const
|
void TMask_field::set_focus() const
|
||||||
@ -1418,7 +1419,7 @@ bool TBrowse::do_insert()
|
|||||||
if (_insert[0] == 'M')
|
if (_insert[0] == 'M')
|
||||||
{
|
{
|
||||||
TString80 nm(_insert.mid(1));
|
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));
|
app = format("ba3 -0 %s", (const char*)nm.mid(4));
|
||||||
// Obbligatorio usare la format globale
|
// Obbligatorio usare la format globale
|
||||||
else // Programma generico di browse/edit
|
else // Programma generico di browse/edit
|
||||||
@ -1429,12 +1430,12 @@ bool TBrowse::do_insert()
|
|||||||
{
|
{
|
||||||
app = _insert.mid(1);
|
app = _insert.mid(1);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (strnicmp(app, main_app().name(), 3) == 0)
|
if (strnicmp(app, main_app().name(), 3) == 0)
|
||||||
app.insert("a", 3);
|
app.insert("a", 3);
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
TMailbox mail;
|
TMailbox mail;
|
||||||
TMessage msg(app, MSG_AI, "");
|
TMessage msg(app, MSG_AI, "");
|
||||||
mail.send(msg);
|
mail.send(msg);
|
||||||
@ -1522,7 +1523,7 @@ KEY TBrowse::run()
|
|||||||
_cursor->read(_isgteq);
|
_cursor->read(_isgteq);
|
||||||
|
|
||||||
const TLocalisamfile& f = _cursor->file();
|
const TLocalisamfile& f = _cursor->file();
|
||||||
TString80 caption(prefhndl->description(f.name()));
|
TString80 caption(prefix().description(f.name()));
|
||||||
if (!isalnum(caption[0]))
|
if (!isalnum(caption[0]))
|
||||||
caption = "Selezione";
|
caption = "Selezione";
|
||||||
|
|
||||||
@ -1537,14 +1538,15 @@ KEY TBrowse::run()
|
|||||||
byte buttons = 0;
|
byte buttons = 0;
|
||||||
if (_insert.not_empty())
|
if (_insert.not_empty())
|
||||||
{
|
{
|
||||||
TFilename path;
|
buttons = 1; // Mette il bottone di gestione, a meno che ...
|
||||||
if (_insert[0] == 'M')
|
|
||||||
path = "ba3 -0";
|
|
||||||
else
|
|
||||||
path = _insert.mid(1);
|
|
||||||
|
|
||||||
if (main_app().name() != cmd2name(path)) // Se non lancerei me stesso
|
const TString& maskname = _fld->mask().source_file();
|
||||||
buttons = 1;
|
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);
|
TBrowse_sheet s(_cursor, _items, caption, _head, buttons, _fld, sib);
|
||||||
@ -1653,14 +1655,14 @@ void TEdit_field::enable(bool on)
|
|||||||
{
|
{
|
||||||
TMask_field::enable(on);
|
TMask_field::enable(on);
|
||||||
if (_buttonwin != NULL_WIN)
|
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)
|
void TEdit_field::show(bool on)
|
||||||
{
|
{
|
||||||
TMask_field::show(on);
|
TMask_field::show(on);
|
||||||
if (_buttonwin != NULL_WIN)
|
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();
|
key = scanner.integer();
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (key < 1)
|
if (key < 1 || key > 15)
|
||||||
{
|
{
|
||||||
yesnofatal_box("Chiave %d non valida nella USE del campo %d", key, dlg());
|
yesnofatal_box("Chiave %d non valida nella USE del campo %d", key, dlg());
|
||||||
key = 1;
|
key = 1;
|
||||||
@ -1763,13 +1765,10 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
_browse = new TBrowse(this, r, key, filter);
|
_browse = new TBrowse(this, r, key, filter);
|
||||||
|
|
||||||
if (tabmaskname.not_empty())
|
if (tabmaskname.not_empty())
|
||||||
{
|
|
||||||
if (strncmp(main_app().name(), "ba3", 3) != 0)
|
|
||||||
{
|
{
|
||||||
tabmaskname.insert("MBATB", 0);
|
tabmaskname.insert("MBATB", 0);
|
||||||
_browse->set_insert(tabmaskname);
|
_browse->set_insert(tabmaskname);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1923,7 +1922,7 @@ void TEdit_field::create(WINDOW parent)
|
|||||||
wincreate(WC_EDIT, _width+delta, 1, _str, parent, bandiere);
|
wincreate(WC_EDIT, _width+delta, 1, _str, parent, bandiere);
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#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
|
SendMessage(hwnd, EM_LIMITTEXT, _size, 0L); // Limita il testo
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1943,7 +1942,7 @@ void TEdit_field::create(WINDOW parent)
|
|||||||
void TEdit_field::destroy()
|
void TEdit_field::destroy()
|
||||||
{
|
{
|
||||||
if (_buttonwin)
|
if (_buttonwin)
|
||||||
{ close_window(_buttonwin); _buttonwin = NULL_WIN; }
|
{ xvt_vobj_destroy(_buttonwin); _buttonwin = NULL_WIN; }
|
||||||
TMask_field::destroy();
|
TMask_field::destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2002,7 +2001,7 @@ const char* TEdit_field::picture_data(const char* data, bool video)
|
|||||||
if (video)
|
if (video)
|
||||||
{
|
{
|
||||||
data = format(data);
|
data = format(data);
|
||||||
set_title(win(), (char*)data);
|
xvt_vobj_set_title(win(), (char*)data);
|
||||||
return get_window_data();
|
return get_window_data();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2184,7 +2183,7 @@ void TEdit_field::enable_check(bool on)
|
|||||||
{
|
{
|
||||||
_check_enabled = on;
|
_check_enabled = on;
|
||||||
if (_buttonwin != NULL_WIN)
|
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)
|
if (_flags.firm)
|
||||||
{
|
{
|
||||||
const long f = atol(n);
|
const long f = atol(n);
|
||||||
if (f > 0 && prefhndl->exist(f))
|
if (f > 0 && prefix().exist(f))
|
||||||
main_app().set_firm(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 )
|
if (pos < 0 )
|
||||||
{
|
{
|
||||||
_codes.add(item);
|
_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 )
|
if (pos >= 0 )
|
||||||
{
|
{
|
||||||
_codes.destroy(pos);
|
_codes.destroy(pos);
|
||||||
win_list_delete(win(), pos);
|
xvt_list_rem(win(), pos);
|
||||||
if (mask().is_running())
|
if (mask().is_running())
|
||||||
{
|
{
|
||||||
win_list_set_sel(win(), 0, TRUE);
|
xvt_list_set_sel(win(), 0, TRUE);
|
||||||
if (shown()) on_hit();
|
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())
|
for (const char* item = _values.get(0); item; item = _values.get())
|
||||||
slist_add(lst, (SLIST_ELT)NULL, (char*)item, 0L);
|
xvt_slist_add_at_elt(lst, (SLIST_ELT)NULL, (char*)item, 0L);
|
||||||
win_list_add(win(), -1, (char*)lst);
|
xvt_list_add(win(), -1, (char*)lst);
|
||||||
slist_dispose(lst);
|
xvt_slist_destroy(lst);
|
||||||
|
|
||||||
const char* init = "";
|
const char* init = "";
|
||||||
if (roman() && automagic())
|
if (roman() && automagic())
|
||||||
@ -2862,7 +2863,7 @@ void TList_field::replace_items(const char* codes, const char* values)
|
|||||||
|
|
||||||
if (win() != NULL_WIN)
|
if (win() != NULL_WIN)
|
||||||
{
|
{
|
||||||
win_list_clear(win());
|
xvt_list_clear(win());
|
||||||
add_list();
|
add_list();
|
||||||
current(0);
|
current(0);
|
||||||
}
|
}
|
||||||
@ -2921,12 +2922,12 @@ void TList_field::set_window_data(const char* data)
|
|||||||
|
|
||||||
void TList_field::current(int n)
|
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
|
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
|
#ifdef DBG
|
||||||
if (sel < 0 && items() > 0)
|
if (sel < 0 && items() > 0)
|
||||||
error_box("Lista senza selezione nel campo %d", dlg());
|
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')
|
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!");
|
CHECK(index >= 0, "List with no selection!");
|
||||||
int newindex = -1;
|
int newindex = -1;
|
||||||
|
|
||||||
@ -2982,7 +2983,7 @@ bool TList_field::on_key(KEY key)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
flag = win_list_get_elt(win(), i, item, 16);
|
flag = xvt_list_get_elt(win(), i, item, 16);
|
||||||
if (!flag)
|
if (!flag)
|
||||||
{
|
{
|
||||||
CHECK(i, "La lista e' vuota!");
|
CHECK(i, "La lista e' vuota!");
|
||||||
@ -3011,10 +3012,10 @@ bool TList_field::on_key(KEY key)
|
|||||||
|
|
||||||
if (newindex >= 0)
|
if (newindex >= 0)
|
||||||
{
|
{
|
||||||
win_list_suspend(win());
|
xvt_list_suspend(win());
|
||||||
win_list_set_sel(win(), index, FALSE);
|
xvt_list_set_sel(win(), index, FALSE);
|
||||||
win_list_set_sel(win(), newindex, TRUE);
|
xvt_list_set_sel(win(), newindex, TRUE);
|
||||||
win_list_resume(win());
|
xvt_list_resume(win());
|
||||||
}
|
}
|
||||||
} // alphanumeric
|
} // alphanumeric
|
||||||
|
|
||||||
@ -3083,11 +3084,11 @@ void TRadio_field::create(WINDOW parent)
|
|||||||
void TRadio_field::destroy()
|
void TRadio_field::destroy()
|
||||||
{
|
{
|
||||||
if (_promptwin)
|
if (_promptwin)
|
||||||
{ close_window(_promptwin); _promptwin = NULL_WIN; }
|
{ xvt_vobj_destroy(_promptwin); _promptwin = NULL_WIN; }
|
||||||
|
|
||||||
for(int i = 0; i < _nitems; i++)
|
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;
|
_radio_ctl_win[i] = NULL_WIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3126,10 +3127,10 @@ void TRadio_field::enable(bool on)
|
|||||||
void TRadio_field::show(bool on)
|
void TRadio_field::show(bool on)
|
||||||
{
|
{
|
||||||
if (_promptwin)
|
if (_promptwin)
|
||||||
show_window(_promptwin, on);
|
xvt_vobj_set_visible(_promptwin, on);
|
||||||
|
|
||||||
for(int i = 0; i < _nitems; i++)
|
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;
|
_flags.shown = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +46,8 @@ class TSpreadsheet : public TWindow
|
|||||||
bool _check_enabled; // Perform OFF_ROW and OFF_CELL checks
|
bool _check_enabled; // Perform OFF_ROW and OFF_CELL checks
|
||||||
bool _update; // It's safe to update the display
|
bool _update; // It's safe to update the display
|
||||||
|
|
||||||
static void xiev_handler(XI_OBJ *itf, XI_EVENT *xiev);
|
|
||||||
void init();
|
void init();
|
||||||
|
friend void XVT_CALLCONV1 xiev_handler(XI_OBJ *itf, XI_EVENT *xiev);
|
||||||
protected:
|
protected:
|
||||||
void list_handler(XI_EVENT *xiev);
|
void list_handler(XI_EVENT *xiev);
|
||||||
|
|
||||||
@ -110,9 +109,8 @@ void TSpreadsheet::init()
|
|||||||
static bool first = TRUE;
|
static bool first = TRUE;
|
||||||
if (!first) return;
|
if (!first) return;
|
||||||
|
|
||||||
DRAW_CTOOLS ct;
|
XVT_FNTID font = xvt_dwin_get_font(TASK_WIN);
|
||||||
win_get_draw_ctools(TASK_WIN, &ct);
|
xi_set_font_id(font);
|
||||||
xi_set_font(&ct.font);
|
|
||||||
|
|
||||||
xi_init();
|
xi_init();
|
||||||
xi_set_pref(XI_PREF_3D_LOOK, TRUE);
|
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,
|
0, 0, rct.bottom-rct.top,
|
||||||
XI_ATR_ENABLED | XI_ATR_VISIBLE,
|
XI_ATR_ENABLED | XI_ATR_VISIBLE,
|
||||||
NORMAL_COLOR, NORMAL_BACK_COLOR, // normal
|
NORMAL_COLOR, NORMAL_BACK_COLOR, // normal
|
||||||
NORMAL_COLOR, DISABLED_BACK_COLOR, // disabled
|
NORMAL_COLOR, MASK_BACK_COLOR, // disabled
|
||||||
COLOR_RED, // active
|
COLOR_RED, // active
|
||||||
LIST_CID);
|
LIST_CID);
|
||||||
listdef->v.list->sizable_columns = TRUE;
|
listdef->v.list->sizable_columns = TRUE;
|
||||||
@ -282,10 +280,10 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
|||||||
|
|
||||||
RCT itfrct;
|
RCT itfrct;
|
||||||
xi_get_def_rect(itfdef, &itfrct);
|
xi_get_def_rect(itfdef, &itfrct);
|
||||||
offset_rect(&itfrct, rct.left, rct.top);
|
xvt_rect_offset(&itfrct, rct.left, rct.top);
|
||||||
itfrct.bottom++;
|
itfrct.bottom++;
|
||||||
|
|
||||||
WINDOW win = create_window(W_NO_BORDER, &itfrct, "", 0, parent,
|
WINDOW win = xvt_win_create(W_NO_BORDER, &itfrct, "", 0, parent,
|
||||||
0, EM_ALL, (EVENT_HANDLER)xi_event, 0L);
|
0, EM_ALL, (EVENT_HANDLER)xi_event, 0L);
|
||||||
CHECK(win, "Can't create a window for the spreadsheet");
|
CHECK(win, "Can't create a window for the spreadsheet");
|
||||||
|
|
||||||
@ -386,8 +384,7 @@ void TSpreadsheet::update_rec(int rec)
|
|||||||
|
|
||||||
void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
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);
|
const int r = row2rec(riga);
|
||||||
|
|
||||||
for (; colonna < _columns; colonna++)
|
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);
|
TSpreadsheet* es = (TSpreadsheet*)xi_get_app_data(itf);
|
||||||
CHECK(es, "NULL Edit sheet in xi event");
|
CHECK(es, "NULL Edit sheet in xi event");
|
||||||
@ -545,15 +543,6 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
TMask_field* f = field(cid);
|
TMask_field* f = field(cid);
|
||||||
const int acqua = f->class_id();
|
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
|
src = row(rec).get(col); // Set value for cell
|
||||||
if (src && *src && f->is_edit())
|
if (src && *src && f->is_edit())
|
||||||
{
|
{
|
||||||
@ -566,7 +555,6 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
}
|
}
|
||||||
if (cell_disabled(rec, col))
|
if (cell_disabled(rec, col))
|
||||||
xiev->v.cell_request.back_color = DISABLED_BACK_COLOR;
|
xiev->v.cell_request.back_color = DISABLED_BACK_COLOR;
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -690,11 +678,10 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
const int next = _cur_rec + (_lastab == K_TAB ? +1 : -1);
|
const int next = _cur_rec + (_lastab == K_TAB ? +1 : -1);
|
||||||
|
_update = rec2row(next) >= 0; // Disable update if next record is not visible
|
||||||
_update = rec2row(next) >= 0;
|
mask2str(_cur_rec); // Update sheet for with mask contents
|
||||||
mask2str(_cur_rec);
|
|
||||||
ok = notify(_cur_rec, K_ENTER); // Notify edit
|
ok = notify(_cur_rec, K_ENTER); // Notify edit
|
||||||
_update = TRUE;
|
_update = TRUE; // Reenable update
|
||||||
}
|
}
|
||||||
if (!ok)
|
if (!ok)
|
||||||
xiev->refused = TRUE;
|
xiev->refused = TRUE;
|
||||||
@ -983,14 +970,16 @@ bool TSpreadsheet::on_key(KEY k)
|
|||||||
if (k == K_ENTER)
|
if (k == K_ENTER)
|
||||||
notify(n, K_ENTER); // Notifica avvenuto cambiamento
|
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();
|
open();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_TAB:
|
case K_TAB:
|
||||||
case K_BTAB:
|
case K_BTAB:
|
||||||
case K_SHIFT_TAB:
|
case K_SHIFT_TAB:
|
||||||
dispatch_e_char(get_parent(win()), k);
|
dispatch_e_char(xvt_vobj_get_parent(win()), k);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1007,7 +996,7 @@ bool TSpreadsheet::on_key(KEY k)
|
|||||||
|
|
||||||
TMask& TSpreadsheet::mask() const
|
TMask& TSpreadsheet::mask() const
|
||||||
{
|
{
|
||||||
TMask* m = (TMask*)get_app_data(parent());
|
TMask* m = (TMask*)xvt_vobj_get_data(parent());
|
||||||
return *m;
|
return *m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1277,7 +1266,7 @@ void TSheet_field::create(WINDOW parent)
|
|||||||
m.sheets(), _head, parent, this);
|
m.sheets(), _head, parent, this);
|
||||||
|
|
||||||
_win = _sheet->win();
|
_win = _sheet->win();
|
||||||
show_window(_win, shown());
|
xvt_vobj_set_visible(_win, shown());
|
||||||
if (!enabled()) disable();
|
if (!enabled()) disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,14 +14,46 @@
|
|||||||
#include <scanner.h>
|
#include <scanner.h>
|
||||||
#include <utility.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";
|
HIDDEN const char* const glockname = "xx";
|
||||||
|
|
||||||
TPrefix::TPrefix() : _filelevel(0), _items(0)
|
TPrefix::TPrefix() : _filelevel(0), _items(0)
|
||||||
{
|
{
|
||||||
CHECK(prefhndl == NULL, "Can't create two prefix objects");
|
|
||||||
|
|
||||||
_prefix = ".";
|
_prefix = ".";
|
||||||
_dirfl = dirfl;
|
_dirfl = dirfl;
|
||||||
_recfl = recfl;
|
_recfl = recfl;
|
||||||
|
@ -55,19 +55,11 @@ public:
|
|||||||
|
|
||||||
const char* firm2dir(long codditta);
|
const char* firm2dir(long codditta);
|
||||||
|
|
||||||
#ifdef __PREFIX_CPP
|
TString& user();
|
||||||
#define extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// @DPUB
|
TPrefix& prefix_init();
|
||||||
extern TPrefix* prefhndl
|
TPrefix& prefix();
|
||||||
// @END
|
void prefix_destroy();
|
||||||
#ifdef __PREFIX_CPP
|
|
||||||
= NULL ;
|
|
||||||
#undef extern
|
|
||||||
#else
|
|
||||||
;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // __PREFIX_H
|
#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 <ctype.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
TLocalisamfile *fff;
|
TLocalisamfile *fff;
|
||||||
|
|
||||||
const char *printf_types = "dDiIuUoOxXfeEgGcCnNsSpPrRtT";
|
const char* const printf_types = "dDiIuUoOxXfeEgGcCnNsSpPrRtT";
|
||||||
|
|
||||||
// _FieldTok flags
|
// _FieldTok flags
|
||||||
|
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <extcdecl.h>
|
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
|
#include <printwin.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <viswin.h>
|
#include <viswin.h>
|
||||||
@ -24,6 +25,10 @@
|
|||||||
|
|
||||||
#include <bagn001a.h>
|
#include <bagn001a.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// PrDesc
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
struct PrDesc
|
struct PrDesc
|
||||||
{
|
{
|
||||||
TTextfile *_txt;
|
TTextfile *_txt;
|
||||||
@ -49,10 +54,11 @@ void TPrinter::_get_windows_printer_names (TToken_string & t)
|
|||||||
|
|
||||||
for (int i = 0; i < 4095; i++)
|
for (int i = 0; i < 4095; i++)
|
||||||
{
|
{
|
||||||
if (buf[i] == '\0' && buf[i + 1] == '\0')
|
if (buf[i] == '\0')
|
||||||
break;
|
{
|
||||||
if (buf[i] == '\0' && buf[i + 1] != '\0')
|
if (buf[i+1] != '\0') buf[i] = '|';
|
||||||
buf[i] = '|';
|
else break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
t = buf;
|
t = buf;
|
||||||
delete buf;
|
delete buf;
|
||||||
@ -62,57 +68,37 @@ BOOLEAN XVT_CALLCONV1 TPrinter::start_winprint (long data)
|
|||||||
{
|
{
|
||||||
PrDesc *pd = (PrDesc *) data;
|
PrDesc *pd = (PrDesc *) data;
|
||||||
TTextfile& txt = *(pd->_txt);
|
TTextfile& txt = *(pd->_txt);
|
||||||
TPrintwin pw(pd->_prcd, txt, pd->_charsize);
|
TPrintwin pw(txt);
|
||||||
pw.print_background (pd->_graphics);
|
|
||||||
pw.do_print();
|
pw.do_print();
|
||||||
return pw.aborted();
|
return pw.aborted();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// utils del caz
|
// 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];
|
char nbuf[16];
|
||||||
int j = 0;
|
|
||||||
while (!isdigit (s[cnt]))
|
while (!isdigit (s[cnt]))
|
||||||
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';
|
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)
|
void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
||||||
{
|
{
|
||||||
char op;
|
TString_array pix;
|
||||||
|
char op, ch;
|
||||||
int x1, x2, y1, y2;
|
int x1, x2, y1, y2;
|
||||||
TToken_string tt (20);
|
int id, cnt = 0;
|
||||||
TString txt (80);
|
|
||||||
TArray pix;
|
TToken_string tt;
|
||||||
char ch;
|
TFilename bmp;
|
||||||
int cnt = 0;
|
|
||||||
|
|
||||||
while ((ch = bg_desc[cnt++]) != '\0')
|
while ((ch = bg_desc[cnt++]) != '\0')
|
||||||
{
|
{
|
||||||
@ -122,24 +108,41 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
|||||||
bf[1] = '\0';
|
bf[1] = '\0';
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case ' ': // ignore whitespace
|
case ' ':
|
||||||
|
|
||||||
case '\t':
|
case '\t':
|
||||||
case '\n':
|
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;
|
break;
|
||||||
case 'l': // line
|
case 'l': // line
|
||||||
|
|
||||||
case 'b': // box
|
case 'b': // box
|
||||||
|
|
||||||
case 'r': // round box
|
case 'r': // round box
|
||||||
|
|
||||||
cnt++;
|
cnt++;
|
||||||
read_int (bg_desc, x1, cnt);
|
read_int (bg_desc, x1, cnt);
|
||||||
read_int (bg_desc, y1, cnt);
|
read_int (bg_desc, y1, cnt);
|
||||||
read_int (bg_desc, x2, cnt);
|
read_int (bg_desc, x2, cnt);
|
||||||
read_int (bg_desc, y2, cnt);
|
read_int (bg_desc, y2, cnt);
|
||||||
cnt++;
|
cnt++; // skip separator
|
||||||
tt << op;
|
tt << op;
|
||||||
tt.add (x1 - 1);
|
tt.add (x1 - 1);
|
||||||
tt.add (y1 - 1);
|
tt.add (y1 - 1);
|
||||||
@ -147,19 +150,18 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
|||||||
tt.add (y2 - 1);
|
tt.add (y2 - 1);
|
||||||
break;
|
break;
|
||||||
case 't': // text
|
case 't': // text
|
||||||
|
|
||||||
cnt++;
|
cnt++;
|
||||||
read_int (bg_desc, x1, cnt);
|
read_int (bg_desc, x1, cnt);
|
||||||
read_int (bg_desc, y1, cnt);
|
read_int (bg_desc, y1, cnt);
|
||||||
cnt++;
|
cnt++;
|
||||||
txt = "";
|
|
||||||
while ((ch = bg_desc[cnt++]) != '}')
|
|
||||||
txt << ch;
|
|
||||||
tt << op;
|
tt << op;
|
||||||
tt.add (x1 - 1);
|
tt.add (x1-1);
|
||||||
tt.add (y1 - 1);
|
tt.add (y1-1);
|
||||||
tt.add (txt);
|
tt << '|';
|
||||||
|
while ((ch = bg_desc[cnt++]) != '}')
|
||||||
|
tt << ch;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P': // set pen style
|
case 'P': // set pen style
|
||||||
|
|
||||||
case 'B': // set brush
|
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++)
|
for (int l = 0; l < _formlen; l++)
|
||||||
{
|
{
|
||||||
|
if (background.objptr(l) == NULL) // Se la riga non esiste creala
|
||||||
TString *rwd = (TString *) background.objptr (l);
|
|
||||||
if (rwd == NULL)
|
|
||||||
{
|
{
|
||||||
background.add (rwd = new TString, l);
|
TString* r = new TString(15);
|
||||||
if (curcol != 'n')
|
if (curcol != 'n') *r << 'C' << curcol; // Setta valori se diversi da default
|
||||||
(*rwd) << 'C' << curcol;
|
if (curpat != 'n') *r << 'B' << curpat;
|
||||||
if (curpat != 'n')
|
if (curwid != '1') *r << 'W' << curwid;
|
||||||
(*rwd) << 'B' << curpat;
|
if (curpen != 'n') *r << 'P' << curcol;
|
||||||
if (curwid != '1')
|
background.add(r, l);
|
||||||
(*rwd) << 'W' << curwid;
|
|
||||||
if (curpen != 'n')
|
|
||||||
(*rwd) << 'P' << curcol;
|
|
||||||
}
|
}
|
||||||
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];
|
TToken_string& tt = pix.row(j);
|
||||||
tt.restart ();
|
|
||||||
|
|
||||||
// la stringa contiene l'opcode piu' i parametri in binario,
|
// la stringa contiene l'opcode piu' i parametri in binario,
|
||||||
// incrementati di 1 per evitare lo 0
|
// incrementati di 1 per evitare lo 0
|
||||||
|
|
||||||
switch (*(tt.get (0)))
|
switch (*(tt.get(0)))
|
||||||
{
|
{
|
||||||
case 'b':
|
case 'b':
|
||||||
x1 = tt.get_int (1) + 1;
|
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;
|
x2 = tt.get_int (3) + 1;
|
||||||
y2 = tt.get_int (4) + 1;
|
y2 = tt.get_int (4) + 1;
|
||||||
if (y1 == l + 1) // at ze biginnin
|
if (y1 == l + 1) // at ze biginnin
|
||||||
|
|
||||||
{
|
{
|
||||||
(*rwd) << 'u' << char (x1);
|
rwd << 'u' << char (x1);
|
||||||
(*rwd) << 'r' << char (x1) << char (x2);
|
rwd << 'r' << char (x1) << char (x2);
|
||||||
(*rwd) << 'u' << char (x2);
|
rwd << 'u' << char (x2);
|
||||||
}
|
}
|
||||||
else if (y2 == l + 1) // at ze end
|
else if (y2 == l + 1) // at ze end
|
||||||
|
|
||||||
{
|
{
|
||||||
(*rwd) << 'o' << char (x1);
|
rwd << 'o' << char (x1);
|
||||||
(*rwd) << 'r' << char (x1) << char (x2);
|
rwd << 'r' << char (x1) << char (x2);
|
||||||
(*rwd) << 'o' << char (x2);
|
rwd << 'o' << char (x2);
|
||||||
}
|
}
|
||||||
else if (y1 < l + 1 && y2 > l + 1) // in ze middol
|
else if (y1 < l + 1 && y2 > l + 1) // in ze middol
|
||||||
|
|
||||||
{
|
{
|
||||||
(*rwd) << 'v' << char (x1);
|
rwd << 'v' << char (x1);
|
||||||
(*rwd) << 'v' << char (x2);
|
rwd << 'v' << char (x2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
@ -248,37 +243,47 @@ void TPrinter::parse_background(const char* bg_desc, TArray& background)
|
|||||||
if (y1 == y2 && y1 == l + 1) // orizzontale
|
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
|
else if (y1 <= l + 1 && y2 >= l + 1) // verticale
|
||||||
|
|
||||||
{
|
{
|
||||||
(*rwd) << 'v' << char (x1);
|
rwd << 'v' << char (x1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
x1 = tt.get_int (1) + 1;
|
x1 = tt.get_int (1) + 1;
|
||||||
y1 = tt.get_int (2) + 1; // al gh'e'
|
y1 = tt.get_int (2) + 1; // al gh'e'
|
||||||
|
|
||||||
if (y1 == l + 1)
|
if (y1 == l + 1)
|
||||||
{
|
{}
|
||||||
}
|
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;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
curwid = *(tt.get (1));
|
curwid = *(tt.get (1));
|
||||||
(*rwd) << 'W' << curwid;
|
rwd << 'W' << curwid;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
curpen = *(tt.get (1));
|
curpen = *(tt.get (1));
|
||||||
(*rwd) << 'P' << curpen;
|
rwd << 'P' << curpen;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
curpat = *(tt.get (1));
|
curpat = *(tt.get (1));
|
||||||
(*rwd) << 'B' << curpat;
|
rwd << 'B' << curpat;
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
curcol = *(tt.get (1));
|
curcol = *(tt.get (1));
|
||||||
(*rwd) << 'C' << curcol;
|
rwd << 'C' << curcol;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -627,22 +632,70 @@ bool printers_on_key (TMask_field & f, KEY key)
|
|||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
|
|
||||||
bool set_windows_print_device (TMask_field& f, KEY key)
|
void TPrinter::set_printrcd()
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_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)
|
||||||
{
|
{
|
||||||
static char szDevice[80];
|
|
||||||
if (key == K_SPACE && f.mask().is_running())
|
if (key == K_SPACE && f.mask().is_running())
|
||||||
{
|
{
|
||||||
if (main_app().printer().get_printrcd() != NULL)
|
TPrinter& printer = main_app().printer();
|
||||||
free_print_rcd (main_app().printer().get_printrcd ());
|
|
||||||
TToken_string & pn = main_app().printer().getprinternames ();
|
char szDevice[80];
|
||||||
|
TToken_string & pn = printer.getprinternames ();
|
||||||
TString pdev (pn.get (atoi (f.get())));
|
TString pdev (pn.get (atoi (f.get())));
|
||||||
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
|
GetProfileString ("devices", pdev, "", szDevice, sizeof (szDevice));
|
||||||
pdev << "," << szDevice;
|
pdev << "," << szDevice;
|
||||||
// scrivi (e semmai lo si risistema poi)
|
// scrivi (e semmai lo si risistema poi)
|
||||||
WriteProfileString("windows", "device", pdev);
|
WriteProfileString("windows", "device", pdev);
|
||||||
main_app().printer().set_printrcd(
|
printer.set_printrcd();
|
||||||
get_print_rcd(&(main_app().printer ().get_printrcdsize ())));
|
printer.set_win_formlen();
|
||||||
main_app().printer().set_win_formlen();
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -651,7 +704,7 @@ bool set_windows_print_device (TMask_field& f, KEY key)
|
|||||||
|
|
||||||
TPrinter::TPrinter()
|
TPrinter::TPrinter()
|
||||||
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
|
: _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;
|
_footerhandler = _headerhandler = NULL;
|
||||||
@ -675,38 +728,33 @@ TPrinter::TPrinter()
|
|||||||
|
|
||||||
// read configuration file
|
// read configuration file
|
||||||
read_configuration (_config);
|
read_configuration (_config);
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
print_begin ();
|
TConfig cnf (CONFIG_GENERAL, "Print");
|
||||||
_print_rcd = get_print_rcd (&_print_rcd_size);
|
_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 ();
|
set_win_formlen ();
|
||||||
|
|
||||||
static char defPrinter[80];
|
char defPrinter[80];
|
||||||
static char szDevice[50];
|
char szDevice[50];
|
||||||
|
|
||||||
// get default printer driver
|
// get default printer driver
|
||||||
GetProfileString ("windows", "device", ",,,", defPrinter, sizeof(defPrinter));
|
GetProfileString ("windows", "device", ",,,", defPrinter, sizeof(defPrinter));
|
||||||
TString pdev (defPrinter);
|
TToken_string pdev (defPrinter, ',');
|
||||||
GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice));
|
GetProfileString ("devices", pdev, "", szDevice, sizeof(szDevice));
|
||||||
pdev << "," << szDevice;
|
pdev.add(szDevice);
|
||||||
TToken_string dio (pdev, ',');
|
|
||||||
TToken_string pn2(1024);
|
|
||||||
|
|
||||||
// get printer names
|
// get printer names
|
||||||
_get_windows_printer_names (pn2);
|
TToken_string pn2(1024);
|
||||||
|
_get_windows_printer_names(pn2);
|
||||||
|
|
||||||
// determine index of current default printer
|
const TString80 p1(pdev.get(0));
|
||||||
for (int i = 0; i < pn2.items (); i++)
|
_curprn = pn2.get_pos(p1);
|
||||||
{
|
CHECKS(_curprn >= 0, "Can't find printer ", (const char*)p1);
|
||||||
if (TString(dio.get(0)) == TString(pn2.get(i)))
|
|
||||||
{
|
|
||||||
_curprn = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
#else
|
||||||
_isgraphics = FALSE;
|
_isgraphics = FALSE;
|
||||||
@ -758,7 +806,7 @@ void TPrinter::read_configuration(const char *conf)
|
|||||||
|
|
||||||
TFilename s ("printer.def");
|
TFilename s ("printer.def");
|
||||||
#if XVT_OS == XVT_OS_SCOUNIX
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
s << format (".%d", getuid ());
|
s << '.' << getuid ();
|
||||||
#endif
|
#endif
|
||||||
if (fexist (s))
|
if (fexist (s))
|
||||||
{
|
{
|
||||||
@ -810,7 +858,8 @@ void TPrinter::read_configuration(const char *conf)
|
|||||||
TPrinter::~TPrinter ()
|
TPrinter::~TPrinter ()
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
print_end ();
|
xvt_print_destroy(_print_rcd);
|
||||||
|
xvt_print_close();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -850,7 +899,6 @@ void TPrinter::setheaderline (int linetoset, const TPrintrow & line)
|
|||||||
void TPrinter::setfooterline (int linetoset, TPrintrow* line)
|
void TPrinter::setfooterline (int linetoset, TPrintrow* line)
|
||||||
{
|
{
|
||||||
_footer.add (line, linetoset);
|
_footer.add (line, linetoset);
|
||||||
// if (linetoset >= _footersize) _footersize = linetoset+1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TPrinter::setfooterline (int linetoset, const TPrintrow& line)
|
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_FILENAME, _printerfile);
|
||||||
mask.set(MSK_1_NPAGES, _ncopies);
|
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++)
|
for (i = 0; i < _printers.items (); i++)
|
||||||
{
|
{
|
||||||
@ -1207,19 +1255,20 @@ void TPrinter::set()
|
|||||||
mask.hide(MSK_1_SIZE);
|
mask.hide(MSK_1_SIZE);
|
||||||
mask.hide(MSK_1_LINES);
|
mask.hide(MSK_1_LINES);
|
||||||
mask.disable(DLG_SETPRINT);
|
mask.disable(DLG_SETPRINT);
|
||||||
if (!_multiple_copies) mask.hide(MSK_1_NPAGES);
|
if (!_multiple_copies)
|
||||||
|
mask.hide(MSK_1_NPAGES);
|
||||||
|
|
||||||
pn1 = "";
|
pn1 = "";
|
||||||
pn2 = "";
|
pn2 = "";
|
||||||
|
|
||||||
for (i = 0; i < ((PrinterDef &)_printers[_curprn])._names.items(); i++)
|
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]);
|
pn2.add((TString &)((PrinterDef &) _printers[_curprn])._names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
((TList_field &)(mask.field (MSK_1_CODES))).replace_items(pn1, pn2);
|
((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)
|
if (_printertype == fileprinter)
|
||||||
mask.set (MSK_1_TYPE, "1");
|
mask.set (MSK_1_TYPE, "1");
|
||||||
else if (_printertype == screenvis)
|
else if (_printertype == screenvis)
|
||||||
@ -1227,8 +1276,8 @@ void TPrinter::set()
|
|||||||
else
|
else
|
||||||
mask.set (MSK_1_TYPE, "0");
|
mask.set (MSK_1_TYPE, "0");
|
||||||
|
|
||||||
mask.set(MSK_1_PRINTERS, format("%d", _curprn));
|
mask.set(MSK_1_PRINTERS, _curprn));
|
||||||
mask.set(MSK_1_CODES, format("%d", _curcode));
|
mask.set(MSK_1_CODES, _curcode));
|
||||||
KEY k;
|
KEY k;
|
||||||
|
|
||||||
if ((k = mask.run()) == K_ESC)
|
if ((k = mask.run()) == K_ESC)
|
||||||
@ -1244,7 +1293,7 @@ void TPrinter::set()
|
|||||||
|
|
||||||
PrinterDef& def = (PrinterDef &) get_description (_curprn);
|
PrinterDef& def = (PrinterDef &) get_description (_curprn);
|
||||||
switch (atoi(mask.get (MSK_1_TYPE)))
|
switch (atoi(mask.get (MSK_1_TYPE)))
|
||||||
{
|
{
|
||||||
case 0: // stampante
|
case 0: // stampante
|
||||||
|
|
||||||
_printertype = normprinter;
|
_printertype = normprinter;
|
||||||
@ -1272,15 +1321,15 @@ void TPrinter::set()
|
|||||||
_printertype = screenvis;
|
_printertype = screenvis;
|
||||||
_curcode = 0;
|
_curcode = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
_get_windows_printer_names(pn2);
|
_get_windows_printer_names(pn2);
|
||||||
char old_default[80];
|
char old_default[80];
|
||||||
GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default));
|
GetProfileString ("windows", "device", ",,,", old_default, sizeof(old_default));
|
||||||
|
|
||||||
for (i = 0; i < pn2.items (); i++)
|
for (i = 0; i < pn2.items (); i++)
|
||||||
pn1.add(i);
|
pn1.add(i);
|
||||||
|
|
||||||
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
|
((TList_field &) (mask.field (MSK_1_PRINTERS))).replace_items(pn1, pn2);
|
||||||
@ -1306,69 +1355,57 @@ void TPrinter::set()
|
|||||||
int oldprn = _curprn;
|
int oldprn = _curprn;
|
||||||
|
|
||||||
while ((k = mask.run ()) != K_ESC && k != K_ENTER && k != K_INS)
|
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
|
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd
|
||||||
if (_print_rcd != NULL)
|
if (xvt_dm_post_page_setup(get_printrcd()))
|
||||||
{
|
|
||||||
if (page_setup_dlg(_print_rcd))
|
|
||||||
{
|
{
|
||||||
// see if user has changed printer
|
// see if user has changed printer
|
||||||
// determine index of currently selected printer
|
// determine index of currently selected printer
|
||||||
// ACTHUNG! Deep hacking of XVT internals! NON PORTABLE!
|
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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));
|
mask.set(MSK_1_PRINTERS, pn1.get(_curprn));
|
||||||
|
|
||||||
set_win_formlen();
|
set_win_formlen(); // Update dimensions
|
||||||
}
|
|
||||||
mask.set_focus();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
beep ();
|
beep ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_curprn = atoi(mask.get(MSK_1_PRINTERS));
|
_curprn = atoi(mask.get(MSK_1_PRINTERS));
|
||||||
|
|
||||||
if (k == K_INS)
|
if (k == K_INS)
|
||||||
{
|
{
|
||||||
// tutto resta com'e'
|
// tutto resta com'e'
|
||||||
mask.save ();
|
mask.save ();
|
||||||
TConfig cnf (CONFIG_GENERAL, "Stampa");
|
TConfig cnf (CONFIG_GENERAL, "Print");
|
||||||
cnf.set("Size", mask.get(MSK_1_SIZE));
|
cnf.set("Size", mask.get(MSK_1_SIZE), "12");
|
||||||
cnf.set("Lines",mask.get(MSK_1_LINES));
|
cnf.set("Lines", mask.get(MSK_1_LINES), "6");
|
||||||
}
|
}
|
||||||
if (k == K_ESC || k == K_ENTER)
|
if (k == K_ESC || k == K_ENTER)
|
||||||
{
|
{
|
||||||
// riaggiusta stampante default windows come prima
|
// riaggiusta stampante default windows come prima
|
||||||
// curprn e rcd sono quelle di prima
|
// curprn e rcd sono quelle di prima
|
||||||
main_app().enable_menu_item(M_FILE_PG_SETUP);
|
main_app().enable_menu_item(M_FILE_PG_SETUP);
|
||||||
WriteProfileString("windows","device", old_default);
|
WriteProfileString("windows","device", old_default);
|
||||||
}
|
}
|
||||||
if (k == K_ESC)
|
if (k == K_ESC)
|
||||||
{
|
{
|
||||||
if (_print_rcd != NULL)
|
|
||||||
free_print_rcd (_print_rcd);
|
|
||||||
_curprn = oldprn;
|
_curprn = oldprn;
|
||||||
_print_rcd = get_print_rcd(&_print_rcd_size);
|
set_printrcd();
|
||||||
set_win_formlen();
|
set_win_formlen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ncopies = atoi (mask.get (MSK_1_NPAGES));
|
_ncopies = atoi (mask.get (MSK_1_NPAGES));
|
||||||
|
|
||||||
switch (atoi (mask.get (MSK_1_TYPE)))
|
switch (atoi (mask.get (MSK_1_TYPE)))
|
||||||
{
|
{
|
||||||
case 0: // stampante
|
case 0: // stampante
|
||||||
_printertype = winprinter;
|
_printertype = winprinter;
|
||||||
break;
|
break;
|
||||||
@ -1381,16 +1418,16 @@ void TPrinter::set()
|
|||||||
_printertype = screenvis;
|
_printertype = screenvis;
|
||||||
_curcode = 0;
|
_curcode = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_isgraphics = mask.get_bool (MSK_1_ISGRAPHICS);
|
_isgraphics = mask.get_bool (MSK_1_ISGRAPHICS);
|
||||||
_ch_size = atoi (mask.get (MSK_1_SIZE));
|
_ch_size = mask.get_int (MSK_1_SIZE);
|
||||||
_lines_per_inch = atoi (mask.get (MSK_1_LINES));
|
_lines_per_inch = mask.get_int (MSK_1_LINES);
|
||||||
set_win_formlen ();
|
set_win_formlen ();
|
||||||
|
|
||||||
#endif
|
#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)
|
if (_printertype == screenvis)
|
||||||
{
|
{
|
||||||
_vf->close_print();
|
_vf->close_print();
|
||||||
_vf->run ();
|
const KEY key = _vf->run ();
|
||||||
if (_vf->is_open ()) _vf->close_modal ();
|
if (_vf->is_open ()) _vf->close_modal ();
|
||||||
delete _vf;
|
delete _vf;
|
||||||
freeze (FALSE);
|
freeze (FALSE);
|
||||||
_vf = NULL;
|
_vf = NULL;
|
||||||
|
|
||||||
|
if (key == K_CTRL+'S')
|
||||||
|
{
|
||||||
|
_isopen = FALSE;
|
||||||
|
_currentrow = _currentpage = 1;
|
||||||
|
_printertype = winprinter;
|
||||||
|
main_app().print();
|
||||||
|
_printertype = screenvis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (_printertype == export)
|
else if (_printertype == export)
|
||||||
{
|
{
|
||||||
@ -1451,7 +1497,7 @@ else if (_printertype == winprinter && _txt.lines() > 0L)
|
|||||||
PrintWhat._txt = &_txt;
|
PrintWhat._txt = &_txt;
|
||||||
PrintWhat._graphics = _isgraphics;
|
PrintWhat._graphics = _isgraphics;
|
||||||
PrintWhat._charsize = _ch_size;
|
PrintWhat._charsize = _ch_size;
|
||||||
start_print_thread (start_winprint, (long) (&PrintWhat));
|
xvt_print_start_thread (start_winprint, (long) (&PrintWhat));
|
||||||
}
|
}
|
||||||
else if (_printertype == fileprinter)
|
else if (_printertype == fileprinter)
|
||||||
{
|
{
|
||||||
@ -1540,7 +1586,7 @@ bool TFile_printer::genera_dischetti ()
|
|||||||
// e eventualmente lo formatta
|
// e eventualmente lo formatta
|
||||||
if (_formatta)
|
if (_formatta)
|
||||||
{
|
{
|
||||||
TString dep (30);
|
TString80 dep;
|
||||||
if (_label != NULL)
|
if (_label != NULL)
|
||||||
dep << FORMAT_COMMAND << " " << "/v:" << _label << " " << _drive;
|
dep << FORMAT_COMMAND << " " << "/v:" << _label << " " << _drive;
|
||||||
else
|
else
|
||||||
|
@ -5,22 +5,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __VISWIN_H
|
|
||||||
#include <viswin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __DATE_H
|
#ifndef __DATE_H
|
||||||
#include <date.h>
|
#include <date.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __PRINTWIN_H
|
|
||||||
#include <printwin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __TEXT_H
|
#ifndef __TEXT_H
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// @DPUB
|
// @DPUB
|
||||||
enum TPrintstyle {
|
enum TPrintstyle {
|
||||||
normalstyle = 0,
|
normalstyle = 0,
|
||||||
@ -116,6 +109,8 @@ typedef void (*LINKHANDLER)(int, const char*);
|
|||||||
// class TPrinter : public TObject
|
// class TPrinter : public TObject
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
|
class TViswin;
|
||||||
|
|
||||||
class TPrinter : public TObject
|
class TPrinter : public TObject
|
||||||
{
|
{
|
||||||
// @DPROT
|
// @DPROT
|
||||||
@ -135,8 +130,9 @@ class TPrinter : public TObject
|
|||||||
int _curprn; // current printer index
|
int _curprn; // current printer index
|
||||||
int _curcode; // current printer index
|
int _curcode; // current printer index
|
||||||
int _formlen; // length of the logic page
|
int _formlen; // length of the logic page
|
||||||
|
int _formwidth; // size of the logic page
|
||||||
int _currentrow; // next row to print
|
int _currentrow; // next row to print
|
||||||
int _ch_size;
|
int _ch_size; // Font height
|
||||||
word _currentpage; // logic page containing _currentrow
|
word _currentpage; // logic page containing _currentrow
|
||||||
word _frompage; // first page to print (normally 0)
|
word _frompage; // first page to print (normally 0)
|
||||||
word _topage; // last page to print (normally = USHRT_MAX)
|
word _topage; // last page to print (normally = USHRT_MAX)
|
||||||
@ -147,7 +143,10 @@ class TPrinter : public TObject
|
|||||||
TFilename _printerfile; // filename for printing on file
|
TFilename _printerfile; // filename for printing on file
|
||||||
TArray _linksdescr;
|
TArray _linksdescr;
|
||||||
bool _multiple_link; //
|
bool _multiple_link; //
|
||||||
TArray _background;
|
|
||||||
|
TString_array _background;
|
||||||
|
TString_array _image_names;
|
||||||
|
|
||||||
const char* _bg_desc;
|
const char* _bg_desc;
|
||||||
TToken_string _printer_names;
|
TToken_string _printer_names;
|
||||||
bool _isgraphics;
|
bool _isgraphics;
|
||||||
@ -189,8 +188,8 @@ public:
|
|||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
static BOOLEAN XVT_CALLCONV1 start_winprint(long);
|
static BOOLEAN XVT_CALLCONV1 start_winprint(long);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void set_config_file (const char * ffile) { _config = ffile ; }
|
void set_config_file (const char * ffile) { _config = ffile ; }
|
||||||
void set_from_page (word from) { _frompage = from; }
|
void set_from_page (word from) { _frompage = from; }
|
||||||
void set_to_page (word to) { _topage = to; }
|
void set_to_page (word to) { _topage = to; }
|
||||||
@ -201,14 +200,15 @@ public:
|
|||||||
// che servizio e'?
|
// che servizio e'?
|
||||||
void parse_background(const char* bgdesc, TArray& bg);
|
void parse_background(const char* bgdesc, TArray& bg);
|
||||||
|
|
||||||
int descriptions()
|
int descriptions() { return _printers.items(); }
|
||||||
{ return _printers.items(); }
|
const PrinterDef& get_description(word i) const { return (const PrinterDef&) _printers[i]; }
|
||||||
const PrinterDef& get_description(word i) const
|
|
||||||
{ return (const PrinterDef&) _printers[i]; }
|
|
||||||
virtual const char* class_name() const;
|
virtual const char* class_name() const;
|
||||||
virtual word class_id() const;
|
virtual word class_id() const;
|
||||||
|
|
||||||
int formlen () const { return _formlen; }
|
int formlen () const { return _formlen; }
|
||||||
|
int formwidth () const { return _formwidth; }
|
||||||
|
|
||||||
word frompage () const { return _frompage; }
|
word frompage () const { return _frompage; }
|
||||||
word topage () const { return _topage; }
|
word topage () const { return _topage; }
|
||||||
int headersize () const { return _headersize; }
|
int headersize () const { return _headersize; }
|
||||||
@ -227,7 +227,8 @@ public:
|
|||||||
void resetheader();
|
void resetheader();
|
||||||
void resetfooter();
|
void resetfooter();
|
||||||
void setbackground(const char* bg);
|
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; }
|
bool frozen() { return _frozen; }
|
||||||
void freeze(bool b = TRUE) { _frozen = b; }
|
void freeze(bool b = TRUE) { _frozen = b; }
|
||||||
int n_copies() { return _ncopies; }
|
int n_copies() { return _ncopies; }
|
||||||
@ -275,18 +276,17 @@ public:
|
|||||||
word rows() const { return _formlen-_headersize-_footersize; }
|
word rows() const { return _formlen-_headersize-_footersize; }
|
||||||
word rows_left() const;
|
word rows_left() const;
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
PRINT_RCD* get_printrcd() { return _print_rcd; }
|
void set_printrcd();
|
||||||
void set_printrcd(PRINT_RCD* p) { _print_rcd = p; }
|
PRINT_RCD* get_printrcd(int* size = NULL);
|
||||||
int& get_printrcdsize() { return _print_rcd_size; }
|
void set_win_formlen(WINDOW prwin = NULL_WIN);
|
||||||
void set_win_formlen();
|
|
||||||
#endif
|
#endif
|
||||||
void set_lines_per_inch(int n) { _lines_per_inch = n; }
|
void set_lines_per_inch(int n) { _lines_per_inch = n; }
|
||||||
int get_lines_per_inch(int n) { return _lines_per_inch; }
|
int get_lines_per_inch() const { return _lines_per_inch; }
|
||||||
int get_vert_offset() { return _vert_offset; }
|
int get_vert_offset() const { return _vert_offset; }
|
||||||
int get_horz_offset() { return _horz_offset; }
|
int get_horz_offset() const { return _horz_offset; }
|
||||||
int get_dots_per_line() { return _dots_per_line; }
|
int get_dots_per_line() const { return _dots_per_line; }
|
||||||
bool isgraphics() { return _isgraphics; }
|
bool isgraphics() const { return _isgraphics; }
|
||||||
int get_char_size() { return _ch_size; }
|
int get_char_size() const { return _ch_size; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,20 +1,31 @@
|
|||||||
|
#include <applicat.h>
|
||||||
#include <printwin.h>
|
#include <printwin.h>
|
||||||
#include <xvtility.h>
|
#include <xvtility.h>
|
||||||
#include <applicat.h>
|
|
||||||
|
|
||||||
static char __spc[] = " "
|
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);
|
||||||
|
|
||||||
#define LEN_SPACES(x) (win_get_text_width(win(),__spc,x))
|
#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)
|
void TPrintwin::paint_background(long j)
|
||||||
{
|
{
|
||||||
_isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
|
const bool isbackground = _bg->items() > 0 && main_app().printer().isgraphics();
|
||||||
if (!_isbackground) return;
|
if (!isbackground) return;
|
||||||
|
|
||||||
int rw = (int)(j % _formlen);
|
int rw = (int)(j % _formlen);
|
||||||
TString& rwd = (TString&)(*_bg)[rw];
|
TString& rwd = (TString&)(*_bg)[rw];
|
||||||
int cnt = 0; char ch;
|
int cnt = 0; char ch;
|
||||||
@ -24,48 +35,87 @@ void TPrintwin::paint_background(long j)
|
|||||||
char curpat = 'n';
|
char curpat = 'n';
|
||||||
char curwid = '1';
|
char curwid = '1';
|
||||||
|
|
||||||
unsigned int x1, x2; PNT b, e;
|
unsigned int x1, y1, x2, y2, id;
|
||||||
|
PNT b, e;
|
||||||
|
|
||||||
while (ch = rwd[cnt++])
|
while (ch = rwd[cnt++])
|
||||||
{
|
{
|
||||||
switch(ch)
|
switch(ch)
|
||||||
{
|
{
|
||||||
case 'v': // verticale intera
|
case 'v': // verticale intera
|
||||||
x1 = (unsigned char)rwd[cnt++]-1;
|
x1 = (byte)rwd[cnt++]-1;
|
||||||
b.h = e.h = LEN_SPACES(x1)+LEN_SPACES(1)/2+_hofs;
|
b.h = e.h = LEN_SPACES(win(), x1)+LEN_SPACES(win(), 1)/2+_hofs;
|
||||||
b.v = rw * _chary + _vofs; e.v = rw * _chary + _vofs;
|
b.v = rw * _chary + _vofs; e.v = rw * _chary + _vofs;
|
||||||
win_move_to(win(),b);
|
xvt_dwin_draw_set_pos(win(),b);
|
||||||
win_draw_line(win(),e);
|
xvt_dwin_draw_line(win(),e);
|
||||||
break;
|
break;
|
||||||
case 'o': // verticale pezzo sopra
|
case 'o': // verticale pezzo sopra
|
||||||
x1 = (unsigned char)rwd[cnt++]-1;
|
x1 = (byte)rwd[cnt++]-1;
|
||||||
b.h = e.h = LEN_SPACES(x1)+LEN_SPACES(1)/2 + _hofs;
|
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;
|
b.v = rw * _chary + _vofs; e.v = rw * _chary - _chary/2 + _vofs;
|
||||||
win_move_to(win(),b);
|
xvt_dwin_draw_set_pos(win(),b);
|
||||||
win_draw_line(win(),e);
|
xvt_dwin_draw_line(win(),e);
|
||||||
break;
|
break;
|
||||||
case 'u': // verticale pezzo sotto
|
case 'u': // verticale pezzo sotto
|
||||||
x1 = (unsigned char)rwd[cnt++]-1;
|
x1 = (byte)rwd[cnt++]-1;
|
||||||
b.h = e.h = LEN_SPACES(x1)+LEN_SPACES(1)/2 + _hofs;
|
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;
|
b.v = rw*_chary + _chary/2 + _vofs; e.v = rw * _chary + _vofs;
|
||||||
win_move_to(win(),b);
|
xvt_dwin_draw_set_pos(win(),b);
|
||||||
win_draw_line(win(),e);
|
xvt_dwin_draw_line(win(),e);
|
||||||
break;
|
break;
|
||||||
case 'h': // orizzontale intera
|
case 'h': // orizzontale intera
|
||||||
x1 = (unsigned char)rwd[cnt++]-1;
|
x1 = (byte)rwd[cnt++]-1;
|
||||||
x2 = (unsigned char)rwd[cnt++]-1;
|
x2 = (byte)rwd[cnt++]-1;
|
||||||
b.v = e.v = rw*_chary + _chary/2 + _vofs;
|
b.v = e.v = rw*_chary + _chary/2 + _vofs;
|
||||||
b.h = LEN_SPACES(x1)+_hofs; e.h = LEN_SPACES(x2)+_hofs;
|
b.h = LEN_SPACES(win(), x1)+_hofs; e.h = LEN_SPACES(win(), x2)+_hofs;
|
||||||
win_move_to(win(),b);
|
xvt_dwin_draw_set_pos(win(),b);
|
||||||
win_draw_line(win(),e);
|
xvt_dwin_draw_line(win(),e);
|
||||||
break;
|
break;
|
||||||
case 'r': // orizzontale scorciata agli estremi
|
case 'r': // orizzontale scorciata agli estremi
|
||||||
x1 = (unsigned char)rwd[cnt++]-1;
|
x1 = (byte)rwd[cnt++]-1;
|
||||||
x2 = (unsigned char)rwd[cnt++]-1;
|
x2 = (byte)rwd[cnt++]-1;
|
||||||
b.v = e.v = rw*_chary + _chary/2 + _vofs;
|
b.v = e.v = rw*_chary + _chary/2 + _vofs;
|
||||||
b.h = LEN_SPACES(x1)+LEN_SPACES(1)/2 + _hofs;
|
b.h = LEN_SPACES(win(), x1)+LEN_SPACES(win(), 1)/2 + _hofs;
|
||||||
e.h = LEN_SPACES(x2)+LEN_SPACES(1)/2+_hofs;
|
e.h = LEN_SPACES(win(), x2)+LEN_SPACES(win(), 1)/2+_hofs;
|
||||||
win_move_to(win(),b);
|
xvt_dwin_draw_set_pos(win(),b);
|
||||||
win_draw_line(win(),e);
|
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;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
curwid = rwd[cnt++];
|
curwid = rwd[cnt++];
|
||||||
@ -97,15 +147,17 @@ void TPrintwin::paint_background(long j)
|
|||||||
|
|
||||||
void TPrintwin::paint_row(long j)
|
void TPrintwin::paint_row(long j)
|
||||||
{
|
{
|
||||||
static char line[257];
|
char line[257];
|
||||||
|
|
||||||
const char* cp; int pos = 0;
|
const char* cp; int pos = 0;
|
||||||
int pixpos = 0;
|
int pixpos = 0;
|
||||||
int row = (int)(j % _formlen);
|
int row = (int)(j % _formlen);
|
||||||
|
|
||||||
strcpy(line,_txt.line(j));
|
paint_background(j);
|
||||||
|
|
||||||
|
strcpy(line,_txt.line(j));
|
||||||
_txt.read_line(j);
|
_txt.read_line(j);
|
||||||
|
|
||||||
while(cp = _txt.piece())
|
while(cp = _txt.piece())
|
||||||
{
|
{
|
||||||
pos += strlen(cp);
|
pos += strlen(cp);
|
||||||
@ -113,36 +165,25 @@ void TPrintwin::paint_row(long j)
|
|||||||
int st = _txt.get_style();
|
int st = _txt.get_style();
|
||||||
long bg = trans_color(_txt.get_background());
|
long bg = trans_color(_txt.get_background());
|
||||||
long fg = trans_color(_txt.get_foreground());
|
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);
|
set_color(fg,bg);
|
||||||
#else
|
#else
|
||||||
set_color(COLOR_BLACK, COLOR_WHITE);
|
set_color(COLOR_BLACK, COLOR_WHITE);
|
||||||
#endif
|
#endif
|
||||||
win_draw_text(win(), pixpos+_hofs, row*_chary + _chary + _vofs - _descent,
|
xvt_dwin_draw_text(win(),
|
||||||
|
pixpos + _hofs,
|
||||||
|
row*_chary + _chary - _descent + _vofs,
|
||||||
(char *)cp, -1);
|
(char *)cp, -1);
|
||||||
#if XVT_OS == XVT_OS_WIN
|
pixpos = xvt_dwin_get_text_width(win(), line, pos);
|
||||||
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);
|
|
||||||
}
|
|
||||||
paint_background(j);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TPrintwin::print_band(int page, RCT& r)
|
bool TPrintwin::print_band(int page, RCT& r)
|
||||||
{
|
{
|
||||||
int j = page*_formlen;
|
const int j = page * _formlen;
|
||||||
int rows = (r.bottom - r.top) / _chary;
|
const int rows = (r.bottom - r.top) / _chary;
|
||||||
int top = r.top / _chary;
|
const int top = r.top / _chary;
|
||||||
|
|
||||||
for (int k = top; k < top+rows; k++)
|
for (int k = top; k < top+rows; k++)
|
||||||
{
|
{
|
||||||
@ -162,45 +203,55 @@ bool TPrintwin::do_print()
|
|||||||
|
|
||||||
while (ok && !_aborted)
|
while (ok && !_aborted)
|
||||||
{
|
{
|
||||||
_aborted = !(bool)start_page(_printrcd);
|
_aborted = !(bool)xvt_print_open_page(_printrcd);
|
||||||
while (!_aborted && ok && (rct = next_band()) != NULL)
|
while (!_aborted && ok && (rct = xvt_print_get_next_band()) != NULL)
|
||||||
ok = print_band(page, *rct);
|
ok = print_band(page, *rct);
|
||||||
finish_page(_printrcd);
|
xvt_print_close_page(_printrcd);
|
||||||
page++;
|
page++;
|
||||||
}
|
}
|
||||||
return !_aborted;
|
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()
|
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);
|
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 _aborted;
|
||||||
bool _isbackground;
|
|
||||||
PRINT_RCD* _printrcd;
|
PRINT_RCD* _printrcd;
|
||||||
int _formlen;
|
int _formlen;
|
||||||
int _formwidth;
|
int _formwidth;
|
||||||
TArray* _bg;
|
TArray* _bg;
|
||||||
TTextfile& _txt;
|
TTextfile& _txt;
|
||||||
|
|
||||||
|
TArray _images;
|
||||||
|
|
||||||
int _lead, _ascent, _descent;
|
int _lead, _ascent, _descent;
|
||||||
int _hofs, _vofs;
|
int _hofs, _vofs;
|
||||||
int _chary;
|
int _chary;
|
||||||
@ -39,13 +40,10 @@ public:
|
|||||||
// check if aborted; also returned by do_print
|
// check if aborted; also returned by do_print
|
||||||
bool aborted() const { return _aborted; }
|
bool aborted() const { return _aborted; }
|
||||||
|
|
||||||
// inhibits background printing
|
|
||||||
void print_background(bool b) { _isbackground = b; }
|
|
||||||
|
|
||||||
// starts printing; FALSE if aborted
|
// starts printing; FALSE if aborted
|
||||||
bool do_print();
|
bool do_print();
|
||||||
|
|
||||||
TPrintwin(PRINT_RCD* pr, TTextfile& txt, int chsize = 12);
|
TPrintwin(TTextfile& txt);
|
||||||
virtual ~TPrintwin();
|
virtual ~TPrintwin();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: progind.cpp,v 1.3 1994-11-11 18:04:23 guy Exp $
|
// $Id: progind.cpp,v 1.4 1995-03-22 09:06:23 guy Exp $
|
||||||
|
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
@ -46,7 +46,7 @@ TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
|||||||
create(-1, -1, hor, ver, TITLE_TEXT);
|
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;
|
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);
|
_text = xvt_ctl_create(WC_TEXT, &r, (char*)txt, win(), CTL_FLAG_CENTER_JUST, 0l, DLG_NULL);
|
||||||
|
|
||||||
if (cancel)
|
if (cancel)
|
||||||
_cancel = xvt_create_control(WC_PUSHBUTTON, -11, -1, 9, 2,
|
_cancel = xvt_create_control(WC_PUSHBUTTON, -11, -1, 9, 2,
|
||||||
@ -57,7 +57,7 @@ TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
|||||||
|
|
||||||
void TIndwin::set_text(const char* t)
|
void TIndwin::set_text(const char* t)
|
||||||
{
|
{
|
||||||
set_title(_text, (char*)t);
|
xvt_vobj_set_title(_text, (char*)t);
|
||||||
}
|
}
|
||||||
|
|
||||||
TIndwin::~TIndwin()
|
TIndwin::~TIndwin()
|
||||||
@ -91,7 +91,7 @@ void TIndwin::update_bar()
|
|||||||
|
|
||||||
const double prc = (double)_status/_max;
|
const double prc = (double)_status/_max;
|
||||||
|
|
||||||
RCT r; get_client_rect(win(), &r);
|
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
||||||
r.left = CHARX; r.right -= CHARX;
|
r.left = CHARX; r.right -= CHARX;
|
||||||
r.top = (int)_bar;
|
r.top = (int)_bar;
|
||||||
r.bottom = r.top + 3*CHARY;
|
r.bottom = r.top + 3*CHARY;
|
||||||
@ -104,16 +104,16 @@ void TIndwin::update_bar()
|
|||||||
RCT b = r;
|
RCT b = r;
|
||||||
set_brush(COLOR_BLUE);
|
set_brush(COLOR_BLUE);
|
||||||
b.right = b.left + int(width*prc);
|
b.right = b.left + int(width*prc);
|
||||||
win_draw_rect(win(), &b);
|
xvt_dwin_draw_rect(win(), &b);
|
||||||
|
|
||||||
set_brush(COLOR_WHITE);
|
set_brush(COLOR_WHITE);
|
||||||
b.left = b.right; b.right = r.right;
|
b.left = b.right; b.right = r.right;
|
||||||
win_draw_rect(win(), &b);
|
xvt_dwin_draw_rect(win(), &b);
|
||||||
|
|
||||||
set_mode(M_XOR);
|
set_mode(M_XOR);
|
||||||
win_set_fore_color(win(), COLOR_BLUE);
|
xvt_dwin_set_fore_color(win(), COLOR_BLUE);
|
||||||
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
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);
|
xvt_dwin_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
||||||
set_mode(M_COPY);
|
set_mode(M_COPY);
|
||||||
|
|
||||||
check_stop();
|
check_stop();
|
||||||
@ -130,7 +130,7 @@ void TIndwin::handler(WINDOW w, EVENT* e)
|
|||||||
switch(e->type)
|
switch(e->type)
|
||||||
{
|
{
|
||||||
case E_UPDATE:
|
case E_UPDATE:
|
||||||
clear_window(w, COLOR_WHITE);
|
xvt_dwin_clear(w, COLOR_WHITE);
|
||||||
update();
|
update();
|
||||||
return;
|
return;
|
||||||
case E_CONTROL:
|
case E_CONTROL:
|
||||||
@ -173,14 +173,14 @@ void TTimerind::handler(WINDOW w, EVENT* e)
|
|||||||
case E_CREATE:
|
case E_CREATE:
|
||||||
case E_UPDATE:
|
case E_UPDATE:
|
||||||
if (_status == 0L)
|
if (_status == 0L)
|
||||||
_timer_id = set_timer(w, _interval);
|
_timer_id = xvt_timer_create(w, _interval);
|
||||||
break;
|
break;
|
||||||
case E_TIMER:
|
case E_TIMER:
|
||||||
if (e->v.timer.id == _timer_id)
|
if (e->v.timer.id == _timer_id)
|
||||||
{
|
{
|
||||||
_status += _interval;
|
_status += _interval;
|
||||||
force_update();
|
force_update();
|
||||||
set_timer(w, _interval);
|
xvt_timer_create(w, _interval);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -198,7 +198,7 @@ TTimerind::TTimerind(long msec, const char* txt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TTimerind::~TTimerind()
|
TTimerind::~TTimerind()
|
||||||
{ kill_timer(_timer_id); }
|
{ xvt_timer_destroy(_timer_id); }
|
||||||
|
|
||||||
// C-style binding
|
// C-style binding
|
||||||
// uses static pointer for single instance of TIndwin
|
// uses static pointer for single instance of TIndwin
|
||||||
|
@ -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 <mailbox.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -431,7 +431,7 @@ bool TRelation_application::modify_mode()
|
|||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
{
|
{
|
||||||
if (err == _islocked)
|
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
|
else
|
||||||
error_box("Impossibile leggere i dati: errore %d", err);
|
error_box("Impossibile leggere i dati: errore %d", err);
|
||||||
query_mode();
|
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
|
// relation.cpp
|
||||||
// fv 12/8/93
|
// fv 12/8/93
|
||||||
// relation class for isam files
|
// relation class for isam files
|
||||||
@ -163,7 +163,7 @@ void TRelationdef::print_on(TToken_string& out) const
|
|||||||
|
|
||||||
out = "";
|
out = "";
|
||||||
print_name(out, f);
|
print_name(out, f);
|
||||||
out.add(prefhndl->description(f.name()));
|
out.add(prefix().description(f.name()));
|
||||||
out << '|';
|
out << '|';
|
||||||
|
|
||||||
if (_numto > 0)
|
if (_numto > 0)
|
||||||
@ -259,7 +259,7 @@ void TRelation::print_on(TArray& a) const
|
|||||||
const TLocalisamfile& f = file();
|
const TLocalisamfile& f = file();
|
||||||
TToken_string s(128);
|
TToken_string s(128);
|
||||||
print_name(s, f);
|
print_name(s, f);
|
||||||
s.add(prefhndl->description(f.name()));
|
s.add(prefix().description(f.name()));
|
||||||
s.add("");
|
s.add("");
|
||||||
s.add(f.getkey());
|
s.add(f.getkey());
|
||||||
s.add(" | ");
|
s.add(" | ");
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#define SCAD_CODPAG "CODPAG"
|
#define SCAD_CODPAG "CODPAG"
|
||||||
#define SCAD_TIPOPAG "TIPOPAG"
|
#define SCAD_TIPOPAG "TIPOPAG"
|
||||||
#define SCAD_ULTCLASS "ULTCLASS"
|
#define SCAD_ULTCLASS "ULTCLASS"
|
||||||
|
#define SCAD_IMPORTO "IMPORTO"
|
||||||
#define SCAD_IMPORTOVAL "IMPORTOVAL"
|
#define SCAD_IMPORTOVAL "IMPORTOVAL"
|
||||||
#define SCAD_DATASCAD "DATASCAD"
|
#define SCAD_DATASCAD "DATASCAD"
|
||||||
#define SCAD_TIPOCF "TIPOCF"
|
#define SCAD_TIPOCF "TIPOCF"
|
||||||
|
@ -65,7 +65,7 @@ TSheet::TSheet(short x, short y, short dx, short dy,
|
|||||||
|
|
||||||
if (dx == 0) // Calculates window width
|
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;
|
dx = r.right/CHARX -6;
|
||||||
|
|
||||||
const int larg = width();
|
const int larg = width();
|
||||||
@ -112,8 +112,8 @@ void TSheet::repos_buttons() const
|
|||||||
if (buttons == MAX_BUT-1) { buttons++; break; }
|
if (buttons == MAX_BUT-1) { buttons++; break; }
|
||||||
if (buttons == 0) return;
|
if (buttons == 0) return;
|
||||||
|
|
||||||
RCT wr; get_client_rect(win(), &wr);
|
RCT wr; xvt_vobj_get_client_rect(win(), &wr);
|
||||||
RCT br; get_client_rect(_button[0], &br);
|
RCT br; xvt_vobj_get_client_rect(_button[0], &br);
|
||||||
|
|
||||||
int space = (wr.right - buttons * br.right) / (buttons+1);
|
int space = (wr.right - buttons * br.right) / (buttons+1);
|
||||||
if (space < 0) space = 0;
|
if (space < 0) space = 0;
|
||||||
@ -122,8 +122,8 @@ void TSheet::repos_buttons() const
|
|||||||
const int y = wr.bottom - br.bottom-4;
|
const int y = wr.bottom - br.bottom-4;
|
||||||
for (int b = 0; b < buttons; b++, x += br.right+space)
|
for (int b = 0; b < buttons; b++, x += br.right+space)
|
||||||
{
|
{
|
||||||
RCT r; set_rect(&r, x, y, x+br.right, y+br.bottom);
|
RCT r; xvt_rect_set(&r, x, y, x+br.right, y+br.bottom);
|
||||||
move_window(_button[b], &r);
|
xvt_vobj_move(_button[b], &r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,21 +458,16 @@ bool TSheet::update_row(long n)
|
|||||||
{
|
{
|
||||||
const int i = row_to_page(n);
|
const int i = row_to_page(n);
|
||||||
if (i >= _page.items()) return FALSE;
|
if (i >= _page.items()) return FALSE;
|
||||||
|
TToken_string& t = _page.row(i);
|
||||||
TToken_string& t = (TToken_string&)(_page[i]);
|
|
||||||
t.restart();
|
t.restart();
|
||||||
|
|
||||||
const short y = row_to_win(n);
|
const bool chk = n >= 0 && _checked[n] && !_disabled[n];
|
||||||
const char* s;
|
|
||||||
|
|
||||||
int x = 0;
|
|
||||||
const bool chk = _checked[n] && !_disabled[n];
|
|
||||||
bool changed = FALSE;
|
bool changed = FALSE;
|
||||||
|
|
||||||
if (chk)
|
if (chk)
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
|
||||||
set_color(MASK_BACK_COLOR, NORMAL_BACK_COLOR);
|
set_color(MASK_BACK_COLOR, NORMAL_BACK_COLOR);
|
||||||
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
else if (_disabled[n])
|
else if (_disabled[n])
|
||||||
{
|
{
|
||||||
@ -480,7 +475,18 @@ bool TSheet::update_row(long n)
|
|||||||
changed = TRUE;
|
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;
|
int x1 = x;
|
||||||
if (n >= 0)
|
if (n >= 0)
|
||||||
@ -502,13 +508,18 @@ bool TSheet::update_row(long n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
x1 += (_size[j]-strlen(s)) >> 1; // Centra le testate
|
x1 += (_size[j]-strlen(s)) >> 1; // Centra le testate
|
||||||
|
}
|
||||||
|
|
||||||
stringat(x1, y, s);
|
stringat(x1, y, s);
|
||||||
}
|
}
|
||||||
if (changed)
|
if (changed)
|
||||||
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
|
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
|
||||||
|
|
||||||
|
if (n < 0)
|
||||||
|
set_font("", XVT_FS_NONE, 0);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,7 +544,7 @@ void TSheet::update()
|
|||||||
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
|
set_color(NORMAL_COLOR, NORMAL_BACK_COLOR);
|
||||||
set_pen(NORMAL_COLOR);
|
set_pen(NORMAL_COLOR);
|
||||||
set_brush(NORMAL_BACK_COLOR);
|
set_brush(NORMAL_BACK_COLOR);
|
||||||
set_font(FF_FIXED);
|
set_font(XVT_FFN_FIXED);
|
||||||
_visible_rows = rows() - reserved_rows() - head_on();
|
_visible_rows = rows() - reserved_rows() - head_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,7 +573,7 @@ void TSheet::update()
|
|||||||
if (last > items()) last = items();
|
if (last > items()) last = items();
|
||||||
for (long n = first(); n < last; n++) update_row(n);
|
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());
|
invert_row(selected());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,6 +628,7 @@ TArray_sheet::TArray_sheet(short x, short y, short dx, short dy,
|
|||||||
select(0);
|
select(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Certified 90%
|
||||||
bool TArray_sheet::destroy(int i)
|
bool TArray_sheet::destroy(int i)
|
||||||
{
|
{
|
||||||
uncheck(-1);
|
uncheck(-1);
|
||||||
@ -624,6 +636,8 @@ bool TArray_sheet::destroy(int i)
|
|||||||
return _data.destroy(i, TRUE);
|
return _data.destroy(i, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copia le righe nella pagina da visualizzare
|
||||||
|
// Certified 100%
|
||||||
void TArray_sheet::page_build(long first, byte num)
|
void TArray_sheet::page_build(long first, byte num)
|
||||||
{
|
{
|
||||||
for (byte i = 0; i < num; i++)
|
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())
|
_cursor(cursor), _records(cursor->items())
|
||||||
{
|
{
|
||||||
TToken_string fldlst(fields);
|
TToken_string fldlst(fields);
|
||||||
int campi = 0;
|
int campo = 0;
|
||||||
for (const char* t = fldlst.get(0); t; t = fldlst.get(), campi++)
|
for (const char* t = fldlst.get(0); t; t = fldlst.get(), campo++)
|
||||||
if (*t > ' ' && *t != '"')
|
if (*t > ' ' && *t != '"')
|
||||||
{
|
{
|
||||||
TFieldref fr(t, 0);
|
const TFieldref fr(t, 0);
|
||||||
TRecfield* rf = new TRecfield(_cursor->curr(fr.file()),
|
TRecfield* rf = new TRecfield(_cursor->curr(fr.file()),
|
||||||
fr.name(), fr.from(), fr.to() - 1);
|
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);
|
TToken_string l(256);
|
||||||
|
|
||||||
*_cursor = (TRecnotype)first;
|
*_cursor = (TRecnotype)first;
|
||||||
for (byte r = 0; r < rows; r++, ++(*_cursor))
|
for (int r = 0; r < rows; r++, ++(*_cursor))
|
||||||
{
|
{
|
||||||
l.cut(0);
|
l.cut(0);
|
||||||
const int last = _fields.last();
|
const int last = _fields.last();
|
||||||
for (int i = 0; i <= last; i++)
|
for (int i = 0; i <= last; i++)
|
||||||
{
|
{
|
||||||
TRecfield* rf = (TRecfield*)_fields.objptr(i);
|
const TRecfield* rf = (TRecfield*)_fields.objptr(i);
|
||||||
TFixed_string s(rf ? (const char*)*rf : "");
|
const char* s = rf ? (const char*)*rf : "";
|
||||||
l.add(s);
|
l.add(s);
|
||||||
}
|
}
|
||||||
set_row(l, r);
|
set_row(l, r);
|
||||||
@ -727,23 +748,23 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
|
|||||||
if (s && s->items() > 2)
|
if (s && s->items() > 2)
|
||||||
{
|
{
|
||||||
int maxlen = 0;
|
int maxlen = 0;
|
||||||
SLIST lst = slist_new();
|
SLIST lst = xvt_slist_create();
|
||||||
for (const char* item = s->get(0); item; item = s->get())
|
for (const char* item = s->get(0); item; item = s->get())
|
||||||
{
|
{
|
||||||
item = s->get();
|
item = s->get();
|
||||||
const int len = strlen(item);
|
const int len = strlen(item);
|
||||||
if (len > maxlen) maxlen = len;
|
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,
|
WINDOW listbox = xvt_create_control(WC_LISTBUTTON, f->size()+3, -3, maxlen+3, 3,
|
||||||
"", win(), 0, 0L, DLG_FINDREC);
|
"", win(), 0, 0L, DLG_FINDREC);
|
||||||
win_list_add(listbox, -1, (char*)lst);
|
xvt_list_add(listbox, -1, (char*)lst);
|
||||||
slist_dispose(lst);
|
xvt_slist_destroy(lst);
|
||||||
|
|
||||||
TString16 id; id << f->dlg();
|
TString16 id; id << f->dlg();
|
||||||
const int sel = s->get_pos(id) >> 1;
|
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
|
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
|
int left = CHARX; // left coord of next control to draw
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
const short id = i ? DLG_EDIT : DLG_FINDREC;
|
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)
|
if (w != NULL_WIN)
|
||||||
{
|
{
|
||||||
RCT r; get_client_rect(w, &r);
|
RCT r; xvt_vobj_get_client_rect(w, &r);
|
||||||
r.left = left;
|
r.left = left;
|
||||||
r.top = wr.bottom - 4*CHARY + 4;
|
r.top = wr.bottom - 4*CHARY + 4;
|
||||||
r.right += r.left;
|
r.right += r.left;
|
||||||
r.bottom += r.top;
|
r.bottom += r.top;
|
||||||
move_window(w, &r);
|
xvt_vobj_move(w, &r);
|
||||||
left = r.right+CHARX; // Increase left coord
|
left = r.right+CHARX; // Increase left coord
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -782,7 +803,7 @@ void TBrowse_sheet::repos_buttons() const
|
|||||||
|
|
||||||
bool TBrowse_sheet::on_key(KEY k)
|
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;
|
const bool alnum = k >= ' ' && k < K_UP;
|
||||||
|
|
||||||
if (ctl != NULL_WIN && (alnum || k == K_BACKSPACE || k == K_DEL))
|
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);
|
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);
|
else field().set_field_data(val);
|
||||||
|
|
||||||
((TBrowse*)field().browse())->do_input(FALSE);
|
((TBrowse*)field().browse())->do_input(FALSE);
|
||||||
@ -813,7 +834,7 @@ bool TBrowse_sheet::on_key(KEY k)
|
|||||||
{
|
{
|
||||||
beep();
|
beep();
|
||||||
val = old;
|
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);
|
else field().set_field_data(val);
|
||||||
*_cursor = oldsel;
|
*_cursor = oldsel;
|
||||||
}
|
}
|
||||||
@ -823,14 +844,14 @@ bool TBrowse_sheet::on_key(KEY k)
|
|||||||
if (ctl != NULL_WIN)
|
if (ctl != NULL_WIN)
|
||||||
{
|
{
|
||||||
val = corre ? field().get_window_data() : field().get_field_data();
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
field().set("");
|
field().set("");
|
||||||
if (ctl != NULL_WIN) set_title(ctl, "");
|
if (ctl != NULL_WIN) xvt_vobj_set_title(ctl, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSheet::on_key(k);
|
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)
|
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)
|
if (what >= 0)
|
||||||
stop_run(K_CTRL + what);
|
stop_run(K_CTRL + what);
|
||||||
else
|
else
|
||||||
set_front_window(win);
|
set_focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TCursor_sheet::handler(win, ep);
|
TCursor_sheet::handler(win, ep);
|
||||||
|
@ -87,6 +87,9 @@ public:
|
|||||||
long selected() const { return _curr; }
|
long selected() const { return _curr; }
|
||||||
void select(long n);
|
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]; }
|
bool checked(long n) const { return _checked[n]; }
|
||||||
void check(long n, bool on = TRUE);
|
void check(long n, bool on = TRUE);
|
||||||
void uncheck(long n) { check(n, FALSE); }
|
void uncheck(long n) { check(n, FALSE); }
|
||||||
|
@ -19,7 +19,10 @@
|
|||||||
#define REFKEY "CAMPOKEY"
|
#define REFKEY "CAMPOKEY"
|
||||||
#define VERKEY "ìpÙˆ¬cê<"
|
#define VERKEY "ìpÙˆ¬cê<"
|
||||||
|
|
||||||
long stdlevel ;
|
HIDDEN long _stdlevel = 0;
|
||||||
|
|
||||||
|
long get_std_level()
|
||||||
|
{ return _stdlevel; }
|
||||||
|
|
||||||
int get_serial_number()
|
int get_serial_number()
|
||||||
{
|
{
|
||||||
@ -33,18 +36,16 @@ int get_serial_number()
|
|||||||
|
|
||||||
void init_global_vars()
|
void init_global_vars()
|
||||||
{
|
{
|
||||||
CHECK(prefhndl == NULL, "Can't init global vars two times");
|
TPrefix& pref = prefix_init();
|
||||||
prefhndl = new TPrefix;
|
|
||||||
|
|
||||||
// prefhndl->set("DEF");
|
pref.set("");
|
||||||
prefhndl->set("");
|
_stdlevel = pref.filelevel();
|
||||||
stdlevel = prefhndl->filelevel();
|
|
||||||
|
|
||||||
FileDes d;
|
FileDes d;
|
||||||
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
||||||
|
|
||||||
long maxfdir = d.EOX;
|
long maxfdir = d.EOX;
|
||||||
prefhndl->set("DEF");
|
pref.set("DEF");
|
||||||
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
CGetFile(LF_DIR, &d, _nolock, NORDIR);
|
||||||
if (d.EOD > maxfdir) maxfdir = d.EOD;
|
if (d.EOD > maxfdir) maxfdir = d.EOD;
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ void init_global_vars()
|
|||||||
|
|
||||||
#if XVT_OS == XVT_OS_SCOUNIX
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
const bool muflag = CGetAut(MUAUT);
|
const bool muflag = CGetAut(MUAUT);
|
||||||
if (SerNo /* && fexist("net.ini") */ && !muflag)
|
if (SerNo && !muflag)
|
||||||
fatal_box("Abnormal termination: check protection or serial number\n");
|
fatal_box("Abnormal termination: check protection or serial number\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -72,11 +73,11 @@ void free_global_vars()
|
|||||||
#if XVT_OS != XVT_OS_SCOUNIX
|
#if XVT_OS != XVT_OS_SCOUNIX
|
||||||
HL_LOGOUT();
|
HL_LOGOUT();
|
||||||
#endif
|
#endif
|
||||||
if (prefhndl != NULL)
|
if (openf != NULL)
|
||||||
{
|
{
|
||||||
delete openf;
|
delete openf;
|
||||||
delete openrec;
|
delete openrec;
|
||||||
delete prefhndl;
|
prefix_destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +89,6 @@ void free_global_vars()
|
|||||||
|
|
||||||
void* operator new(size_t size)
|
void* operator new(size_t size)
|
||||||
{
|
{
|
||||||
// void* mem = (void*)xvt_fmalloc(size);
|
|
||||||
void* mem = (void*)malloc(size);
|
void* mem = (void*)malloc(size);
|
||||||
if (mem == NULL)
|
if (mem == NULL)
|
||||||
fatal_box("Out of memory: can't allocate %u bytes", size);
|
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)
|
void operator delete(void* ptr)
|
||||||
{
|
{
|
||||||
CHECK(ptr, "Can't delete a NULL pointer");
|
CHECK(ptr, "Can't delete a NULL pointer");
|
||||||
// xvt_ffree((char*)ptr);
|
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
#ifndef __STDTYPES_H
|
#ifndef __STDTYPES_H
|
||||||
#define __STDTYPES_H
|
#define __STDTYPES_H
|
||||||
|
|
||||||
#ifndef XVT_INCL_OS
|
|
||||||
#include <xvt_os.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// @M
|
// @M
|
||||||
#define pure =0
|
#define pure =0
|
||||||
|
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
|
|
||||||
|
#if XVT_OS == XVT_OS_WIN
|
||||||
|
#define HIDDEN static near
|
||||||
|
#else
|
||||||
#define HIDDEN static
|
#define HIDDEN static
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EOL -1
|
#define EOL -1
|
||||||
#define NOERR 0
|
#define NOERR 0
|
||||||
@ -51,6 +50,7 @@ typedef UINT16 KEY;
|
|||||||
|
|
||||||
// @FPUB
|
// @FPUB
|
||||||
int get_serial_number();
|
int get_serial_number();
|
||||||
|
long get_std_level();
|
||||||
void init_global_vars();
|
void init_global_vars();
|
||||||
void free_global_vars();
|
void free_global_vars();
|
||||||
|
|
||||||
|
@ -4,22 +4,18 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strstream.h>
|
#include <strstream.h>
|
||||||
|
|
||||||
#ifndef FOXPRO
|
|
||||||
#include <applicat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
#include <prefix.h>
|
||||||
|
#include <utility.h>
|
||||||
|
|
||||||
#if XVT_OS==XVT_OS_SCOUNIX
|
#if XVT_OS==XVT_OS_SCOUNIX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
#else
|
||||||
#include <direct.h>
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <utility.h>
|
|
||||||
|
|
||||||
class TString512 : public TFixed_string
|
class TString512 : public TFixed_string
|
||||||
{
|
{
|
||||||
char _str512[513];
|
char _str512[513];
|
||||||
@ -318,7 +314,7 @@ const TString& TString::mid(int from, int count) const
|
|||||||
if (from > l) from = l;
|
if (from > l) from = l;
|
||||||
if (count < 0) count = l-from;
|
if (count < 0) count = l-from;
|
||||||
|
|
||||||
spark.strncpy(&_str[from],count);
|
spark.strncpy(&_str[from], count);
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,6 +633,12 @@ TString& TFixed_string::format(const char* fmt, ...)
|
|||||||
// Filename
|
// Filename
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
const char SLASH =
|
||||||
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
|
'/';
|
||||||
|
#else
|
||||||
|
'\\';
|
||||||
|
#endif
|
||||||
|
|
||||||
// Certified 90%
|
// Certified 90%
|
||||||
const char* TFilename::ext() const
|
const char* TFilename::ext() const
|
||||||
@ -660,28 +662,32 @@ void TFilename::ext(const char* e)
|
|||||||
// Certified 90%
|
// Certified 90%
|
||||||
const char* TFilename::name() const
|
const char* TFilename::name() const
|
||||||
{
|
{
|
||||||
const char* d = strrchr(_str, '/');
|
for (int i = strlen(_str)-1; i >= 0; i--)
|
||||||
if (d == NULL) d = strrchr(_str, '\\');
|
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
||||||
if (d == NULL) d = strchr(_str, ':');
|
break;
|
||||||
if (d == NULL) d = _str-1;
|
|
||||||
return d+1;
|
return &_str[i+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 90%
|
// Certified 90%
|
||||||
const char* TFilename::path() const
|
const char* TFilename::path() const
|
||||||
{
|
{
|
||||||
const char* d = strrchr(_str, '/');
|
for (int i = strlen(_str)-1; i >= 0; i--)
|
||||||
if (d == NULL) d = strrchr(_str, '\\');
|
if (_str[i] == '/' || _str[i] == '\\' || _str[i] == ':')
|
||||||
if (d == NULL)
|
break;
|
||||||
{
|
|
||||||
d = strchr(_str, ':');
|
spark.strncpy(_str, i+1);
|
||||||
if (d != NULL) d++;
|
|
||||||
}
|
|
||||||
if (d == NULL) spark.cut(0);
|
|
||||||
else spark.strncpy(_str, d - _str);
|
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TFilename& TFilename::add(const char* n)
|
||||||
|
{
|
||||||
|
if (not_empty()) *this << SLASH;
|
||||||
|
*this << n;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
bool TFilename::ok() const
|
bool TFilename::ok() const
|
||||||
{
|
{
|
||||||
const int l = len();
|
const int l = len();
|
||||||
@ -745,45 +751,25 @@ const TFilename& TFilename::tempdir()
|
|||||||
if (!is_not_slash(_str[last]))
|
if (!is_not_slash(_str[last]))
|
||||||
_tempdir.cut(last);
|
_tempdir.cut(last);
|
||||||
|
|
||||||
int res = 0;
|
bool ok = TRUE;
|
||||||
|
|
||||||
_tempdir.lower();
|
_tempdir.lower();
|
||||||
if (!fexist(_tempdir))
|
if (!fexist(_tempdir))
|
||||||
{
|
ok = make_dir(_tempdir);
|
||||||
#if XVT_OS==XVT_OS_SCOUNIX
|
|
||||||
res = mkdir(_tempdir, 0777);
|
|
||||||
#else
|
|
||||||
res = mkdir(_tempdir);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef FOXPRO
|
if (ok)
|
||||||
|
|
||||||
if (res == 0)
|
|
||||||
{
|
{
|
||||||
TString16 user(TApplication::user());
|
TString16 user(user());
|
||||||
|
|
||||||
user.lower();
|
user.lower();
|
||||||
if (user.not_empty() && _tempdir.find(user) != _tempdir.len() - user.len())
|
if (user.not_empty() && _tempdir.find(user) != _tempdir.len() - user.len())
|
||||||
#if XVT_OS==XVT_OS_SCOUNIX
|
_tempdir << SLASH << user;
|
||||||
_tempdir << '/' << user;
|
|
||||||
#else
|
|
||||||
_tempdir << '\\' << user;
|
|
||||||
#endif
|
|
||||||
_tempdir.lower();
|
_tempdir.lower();
|
||||||
if (!fexist(_tempdir))
|
if (!fexist(_tempdir))
|
||||||
{
|
ok = make_dir(_tempdir);
|
||||||
#if XVT_OS==XVT_OS_SCOUNIX
|
|
||||||
res = mkdir(_tempdir, 0777);
|
|
||||||
#else
|
|
||||||
res = mkdir(_tempdir);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FOXPRO */
|
if (!ok)
|
||||||
|
|
||||||
if (res != 0)
|
|
||||||
fatal_box("Impossibile creare la directory '%s' per i file temporanei", (const char*)_tempdir);
|
fatal_box("Impossibile creare la directory '%s' per i file temporanei", (const char*)_tempdir);
|
||||||
|
|
||||||
_tempdir.insert("TMP=", 0);
|
_tempdir.insert("TMP=", 0);
|
||||||
@ -1134,3 +1120,15 @@ int TString_array::add(const TToken_string& s, int n)
|
|||||||
row(n) = s;
|
row(n) = s;
|
||||||
return n;
|
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;
|
||||||
|
}
|
@ -225,6 +225,8 @@ public:
|
|||||||
const char* ext() const; // Ritorna l'estensione
|
const char* ext() const; // Ritorna l'estensione
|
||||||
void ext(const char*); // Imposta come estensione la stringa puntata da char*
|
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* name() const; // Ritorna il nome del file
|
||||||
const char* path() const; // Ritorna il nome del direttorio
|
const char* path() const; // Ritorna il nome del direttorio
|
||||||
const TFilename& temp(const char* prefix = NULL); // Genera il nome di un file temporaneo
|
const TFilename& temp(const char* prefix = NULL); // Genera il nome di un file temporaneo
|
||||||
@ -301,9 +303,13 @@ class TString_array : public TArray
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TToken_string& row(int n) { return (TToken_string&)operator[](n); }
|
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(TToken_string* s, int n = -1) { return TArray::add(s, n); }
|
||||||
int add(const TToken_string& s, int n = -1);
|
int add(const TToken_string& s, int n = -1);
|
||||||
int add(const char* 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) {}
|
TString_array(int size = 8) : TArray(size) {}
|
||||||
virtual ~TString_array() {}
|
virtual ~TString_array() {}
|
||||||
|
@ -43,12 +43,6 @@ style TTextfile::_trans_style (char ch)
|
|||||||
case 'u':
|
case 'u':
|
||||||
return underlined;
|
return underlined;
|
||||||
break;
|
break;
|
||||||
case 'o':
|
|
||||||
return overstrike;
|
|
||||||
break;
|
|
||||||
case 'k':
|
|
||||||
return smallcaps;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return normal;
|
return normal;
|
||||||
break;
|
break;
|
||||||
|
@ -6,10 +6,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __ARRAY_H
|
|
||||||
#include <array.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
@ -20,8 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
enum direction {up, down, updown};
|
enum direction {up, down, updown};
|
||||||
enum style {normal = 0, bold = FS_BOLD, italic = FS_ITALIC, underlined = 0x0004,
|
enum style {normal = XVT_FS_NONE, bold = XVT_FS_BOLD, italic = XVT_FS_ITALIC, underlined = XVT_FS_UNDERLINE };
|
||||||
overstrike = 0x0008, smallcaps = 0x0010};
|
|
||||||
|
|
||||||
class TTextfile: public TObject
|
class TTextfile: public TObject
|
||||||
{
|
{
|
||||||
@ -117,7 +112,6 @@ public:
|
|||||||
// replace txt=txt in line=line at pos=pos for len=len
|
// 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);
|
int replace(long line, const char* txt, int pos = 0, int len = -1);
|
||||||
|
|
||||||
|
|
||||||
// hypertext cazzuls
|
// hypertext cazzuls
|
||||||
// le si dice il colore che devono avere i punti selezionabili;
|
// le si dice il colore che devono avere i punti selezionabili;
|
||||||
// ritorna l'array in cui vengono messi gli hotspots relativi alla
|
// ritorna l'array in cui vengono messi gli hotspots relativi alla
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// .MSK Tokens by Guy 21-10-93
|
// .MSK Tokens by Guy 21-10-93
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
#include <keys.h>
|
|
||||||
#include <xvtconst.h>
|
|
||||||
|
|
||||||
#define ALIAS AL
|
#define ALIAS AL
|
||||||
#define BEGIN BE
|
#define BEGIN BE
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <lffiles.h>
|
#include <lffiles.h>
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
|
#include <keys.h>
|
||||||
#include <tokens.h>
|
#include <tokens.h>
|
||||||
|
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
Identificatori (tag) per i menu' e le voci dei menu' ad uso di URL
|
Identificatori (tag) per i menu' e le voci dei menu' ad uso di URL
|
||||||
*/
|
*/
|
||||||
#define TASK_MENUBAR 10000
|
#define TASK_MENUBAR 10000
|
||||||
#define ALT_MENUBAR 11000
|
|
||||||
|
|
||||||
#define MENU_BAR(i) (10000+i)
|
#define MENU_BAR(i) (10000+i)
|
||||||
#define BAR_ITEM(i) (5000+100*i)
|
#define BAR_ITEM(i) (5000+100*i)
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <direct.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <strings.h>
|
#include <xvt.h>
|
||||||
|
|
||||||
#define __UTILITY_CPP
|
#define __UTILITY_CPP
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_SCOUNIX
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
int remove(const char* path)
|
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
|
// Best function of the year
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
char* format(const char* fmt, ...)
|
char* format(const char* fmt, ...)
|
||||||
@ -82,6 +131,8 @@ char* format(const char* fmt, ...)
|
|||||||
return(__tmp_string);
|
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)
|
const char* cmd2name(const char* argv0, const char* argv1)
|
||||||
{
|
{
|
||||||
TFilename app(argv0);
|
TFilename app(argv0);
|
||||||
@ -238,9 +289,7 @@ HIDDEN const char * const key = "QSECOFR-";
|
|||||||
|
|
||||||
const char * encode( const char * data)
|
const char * encode( const char * data)
|
||||||
{
|
{
|
||||||
const int len = strlen(data);
|
for (int i = 0; data[i]; i++)
|
||||||
|
|
||||||
for (int i = 0; i < len; i++)
|
|
||||||
__tmp_string[i] = data[i] + (i < 8 ? key[i] : data[i - 8]);
|
__tmp_string[i] = data[i] + (i < 8 ? key[i] : data[i - 8]);
|
||||||
__tmp_string[i] = '\0';
|
__tmp_string[i] = '\0';
|
||||||
return __tmp_string;
|
return __tmp_string;
|
||||||
@ -248,9 +297,7 @@ const char * encode( const char * data)
|
|||||||
|
|
||||||
const char * decode( const char * data)
|
const char * decode( const char * data)
|
||||||
{
|
{
|
||||||
const int len = strlen(data);
|
for (int i = 0; data[i]; i++)
|
||||||
|
|
||||||
for (int i = 0; i < len; i++)
|
|
||||||
__tmp_string[i] = data[i] - (i < 8 ? key[i] : __tmp_string[i - 8]);
|
__tmp_string[i] = data[i] - (i < 8 ? key[i] : __tmp_string[i - 8]);
|
||||||
__tmp_string[i] = '\0';
|
__tmp_string[i] = '\0';
|
||||||
return __tmp_string;
|
return __tmp_string;
|
||||||
@ -260,10 +307,10 @@ const char * decode( const char * data)
|
|||||||
|
|
||||||
int stricmp(const char* s1, const char* s2)
|
int stricmp(const char* s1, const char* s2)
|
||||||
{
|
{
|
||||||
while (toupper(*s1) == toupper(*s2))
|
for(int d = 0 ; (d = toupper(*s1)-toupper(*s2)) == 0; s1++, s2++)
|
||||||
if (*s1++ == '\0' && *s2++ == '\0')
|
if (*s1 == '\0' && *s2 == '\0')
|
||||||
return 0;
|
return 0;
|
||||||
return *s1 - *s2;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __UTILITY_H
|
#ifndef __UTILITY_H
|
||||||
#define __UTILITY_H
|
#define __UTILITY_H
|
||||||
|
|
||||||
#ifndef __STDTYPES_H
|
#ifndef __STRINGS_H
|
||||||
#include <stdtypes.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* @FPUB */
|
/* @FPUB */
|
||||||
@ -12,8 +12,11 @@ int rtoi(const char * roman);
|
|||||||
const char* itor(int i);
|
const char* itor(int i);
|
||||||
bool fcopy(const char* orig, const char* dest, bool append=FALSE);
|
bool fcopy(const char* orig, const char* dest, bool append=FALSE);
|
||||||
bool fexist(const char* file);
|
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 != '/'; }
|
inline bool is_not_slash(char s) { return s != '\\' && s != '/'; }
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_SCOUNIX
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <nditte.h>
|
#include <nditte.h>
|
||||||
|
|
||||||
|
|
||||||
typedef bool (*VAL_FUNC)(TEdit_field&, KEY k);
|
typedef bool (*VAL_FUNC)(TEdit_field&, KEY k);
|
||||||
HIDDEN const TArray* _parms;
|
HIDDEN const TArray* _parms;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#include <xvt.h>
|
||||||
|
|
||||||
#include <browfile.h>
|
#include <browfile.h>
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
@ -8,18 +10,11 @@
|
|||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <viswin.h>
|
#include <viswin.h>
|
||||||
|
|
||||||
#include <bagn005.h>
|
#include <bagn005.h>
|
||||||
|
|
||||||
#ifndef __PRINTER_H
|
const char* const PRINT_FONT = XVT_FFN_FIXED;
|
||||||
typedef void (*LINKHANDLER) (int, const char *);
|
const int PRINT_HEIGHT = 10;
|
||||||
#endif
|
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#include <cpb.h>
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BUTTONROW_SIZE (_showbuts ? 3 : 0)
|
#define BUTTONROW_SIZE (_showbuts ? 3 : 0)
|
||||||
#define X_OFFSET (_rulers ? 6 : 1)
|
#define X_OFFSET (_rulers ? 6 : 1)
|
||||||
@ -33,6 +28,7 @@ extern "C"
|
|||||||
#define DLG_PRINT_TITLE "~Stampa"
|
#define DLG_PRINT_TITLE "~Stampa"
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
|
#include <windows.h>
|
||||||
#define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY)
|
#define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY)
|
||||||
#define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE)
|
#define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE)
|
||||||
#else
|
#else
|
||||||
@ -54,22 +50,38 @@ extern "C"
|
|||||||
#define CTRL_R (K_CTRL + 'R')
|
#define CTRL_R (K_CTRL + 'R')
|
||||||
|
|
||||||
// vista la mania degli 883, eccoti un po' di concerti di Mozart
|
// vista la mania degli 883, eccoti un po' di concerti di Mozart
|
||||||
const long E_ADDLINE = 488L;
|
|
||||||
const long E_ADDLINE_ONSCREEN = 467L;
|
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)
|
void TViswin::check_menu_item(MENU_TAG item, bool on)
|
||||||
{
|
{
|
||||||
win_menu_check(win(), item, on);
|
xvt_menu_set_item_checked(win(), item, on);
|
||||||
win_update_menu_bar(win());
|
xvt_menu_update(win());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TViswin::enable_menu_item(MENU_TAG item, bool on)
|
void TViswin::enable_menu_item(MENU_TAG item, bool on)
|
||||||
{
|
{
|
||||||
win_menu_enable(win(), item, on);
|
xvt_menu_set_item_enabled(win(), item, on);
|
||||||
win_update_menu_bar(win());
|
xvt_menu_update(win());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,7 +143,7 @@ void TViswin::display_link (long y, long x1, long x2, const char *d)
|
|||||||
_link_displayed = TRUE;
|
_link_displayed = TRUE;
|
||||||
if (in_update) return;
|
if (in_update) return;
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#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);
|
xvt_statbar_set(dd);
|
||||||
#endif
|
#endif
|
||||||
if (_link_button != -1)
|
if (_link_button != -1)
|
||||||
@ -351,18 +363,20 @@ void TViswin::shift_screen (scroll dir)
|
|||||||
{
|
{
|
||||||
case up:
|
case up:
|
||||||
case down:
|
case down:
|
||||||
set_rect (&r, 0, (CHARY*Y_OFFSET) + 2, (int) (CHARX * (_textcolumns + X_OFFSET)),
|
xvt_rect_set (&r, 0, taby(Y_OFFSET)+2,
|
||||||
(int)(CHARY * (_textrows + Y_OFFSET)));
|
tabx(int(_textcolumns) + X_OFFSET), taby(int(_textrows) + Y_OFFSET));
|
||||||
win_scroll_rect (win (), &r, 0, dir == down ? CHARY : -CHARY);
|
xvt_dwin_scroll_rect (win (), &r, 0, dir == down ? taby(1) : -taby(1));
|
||||||
paint_row (dir == up ? origin ().y + _textrows - 1 : origin ().y);
|
paint_row (dir == up ? origin ().y + _textrows - 1 : origin ().y);
|
||||||
break;
|
break;
|
||||||
case left:
|
case left:
|
||||||
case right:
|
case right:
|
||||||
set_rect (&r, CHARX * X_OFFSET, 0, (int) (CHARX * (_textcolumns + X_OFFSET) + 2),
|
xvt_rect_set (&r,
|
||||||
(int) (CHARY * (_textrows + 1) - 2));
|
tabx(X_OFFSET), 0,
|
||||||
win_scroll_rect (win (), &r, dir == right ? CHARX : -CHARX, 0);
|
tabx(int(_textcolumns) + X_OFFSET) + 2,
|
||||||
paint_column (dir == left ? origin ().x + _textcolumns - 1 : origin ().x,
|
taby(int(_textrows) + 1) - 2);
|
||||||
dir == left);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -411,9 +425,9 @@ void TViswin::repos_buttons ()
|
|||||||
autoscroll (TRUE);
|
autoscroll (TRUE);
|
||||||
|
|
||||||
RCT wr;
|
RCT wr;
|
||||||
get_client_rect (win (), &wr);
|
xvt_vobj_get_client_rect (win (), &wr);
|
||||||
RCT br;
|
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);
|
int space = (wr.right - buttons * br.right) / (buttons + 1);
|
||||||
if (space < 0)
|
if (space < 0)
|
||||||
@ -424,9 +438,12 @@ void TViswin::repos_buttons ()
|
|||||||
for (int b = 0; b < buttons; b++, x += br.right + space)
|
for (int b = 0; b < buttons; b++, x += br.right + space)
|
||||||
{
|
{
|
||||||
RCT r;
|
RCT r;
|
||||||
set_rect (&r, x, y, x + br.right, y + br.bottom);
|
xvt_rect_set (&r, x, y, x + br.right, y + br.bottom);
|
||||||
move_window (_button[b], &r);
|
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 ()
|
void TViswin::open ()
|
||||||
@ -445,7 +462,7 @@ void TViswin::paint_screen ()
|
|||||||
bool first = TRUE;
|
bool first = TRUE;
|
||||||
for (long j = 0; j < _textrows; j++)
|
for (long j = 0; j < _textrows; j++)
|
||||||
{
|
{
|
||||||
long rw = origin ().y + j;
|
const long rw = origin ().y + j;
|
||||||
if (rw < _txt.lines ())
|
if (rw < _txt.lines ())
|
||||||
paint_row (rw);
|
paint_row (rw);
|
||||||
else if (!_isopen)
|
else if (!_isopen)
|
||||||
@ -456,17 +473,17 @@ void TViswin::paint_screen ()
|
|||||||
set_pen (COLOR_BLACK);
|
set_pen (COLOR_BLACK);
|
||||||
|
|
||||||
PNT b, e;
|
PNT b, e;
|
||||||
b.h = CHARX * 5;
|
b.h = tabx(5);
|
||||||
b.v = (CHARY * (int) (j + (long)Y_OFFSET - origin ().y)) - 2;
|
b.v = taby((int) (j + (long)Y_OFFSET - origin ().y)) - 2;
|
||||||
e.h = CHARX * columns ();
|
e.h = tabx(columns());
|
||||||
e.v = b.v;
|
e.v = b.v;
|
||||||
win_move_to (win (), b);
|
xvt_dwin_draw_set_pos (win (), b);
|
||||||
win_draw_line (win (), e);
|
xvt_dwin_draw_line (win (), e);
|
||||||
set_pen (COLOR_LTGRAY);
|
set_pen (COLOR_LTGRAY);
|
||||||
e.v++;
|
e.v++;
|
||||||
b.v++;
|
b.v++;
|
||||||
win_move_to (win (), b);
|
xvt_dwin_draw_set_pos (win (), b);
|
||||||
win_draw_line (win (), e);
|
xvt_dwin_draw_line (win (), e);
|
||||||
set_brush (COLOR_DKGRAY);
|
set_brush (COLOR_DKGRAY);
|
||||||
bar (5, (int)(j+(long)Y_OFFSET-origin().y),(int)columns(),
|
bar (5, (int)(j+(long)Y_OFFSET-origin().y),(int)columns(),
|
||||||
(int)(rows()-(long)BUTTONROW_SIZE));
|
(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)
|
void TViswin::paint_background (long j, int row)
|
||||||
{
|
{
|
||||||
if (!_isbackground)
|
if (_bg->items() == 0)
|
||||||
return;
|
return;
|
||||||
int rw = (int) (j % (long) _formlen);
|
|
||||||
|
const int rw = (int) (j % (long) _formlen);
|
||||||
TString & rwd = (TString &)(*_bg)[rw];
|
TString & rwd = (TString &)(*_bg)[rw];
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
char ch;
|
char ch;
|
||||||
@ -491,7 +511,7 @@ void TViswin::paint_background (long j, int row)
|
|||||||
char curpat = 'n';
|
char curpat = 'n';
|
||||||
char curwid = '1';
|
char curwid = '1';
|
||||||
|
|
||||||
unsigned int x1, x2;
|
unsigned int x1, x2, y1, y2, id;
|
||||||
PNT b, e;
|
PNT b, e;
|
||||||
while (ch = rwd[cnt++])
|
while (ch = rwd[cnt++])
|
||||||
{
|
{
|
||||||
@ -499,50 +519,90 @@ void TViswin::paint_background (long j, int row)
|
|||||||
{
|
{
|
||||||
case 'v': // verticale intera
|
case 'v': // verticale intera
|
||||||
|
|
||||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
x1 = (byte)rwd[cnt++] + (X_OFFSET -1);
|
||||||
b.h = e.h = x1 * CHARX + CHARX / 2;
|
b.h = e.h = tabx(x1) + tabx(1) / 2;
|
||||||
b.v = row * CHARY;
|
b.v = taby(row);
|
||||||
e.v = (row + 1) * CHARY;
|
e.v = taby(row + 1);
|
||||||
win_move_to (win (), b);
|
xvt_dwin_draw_set_pos (win (), b);
|
||||||
win_draw_line (win (), e);
|
xvt_dwin_draw_line (win (), e);
|
||||||
break;
|
break;
|
||||||
case 'o': // verticale pezzo sopra
|
case 'o': // verticale pezzo sopra
|
||||||
|
|
||||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
x1 = (byte)rwd[cnt++] + (X_OFFSET -1);
|
||||||
b.h = e.h = x1 * CHARX + CHARX / 2;
|
b.h = e.h = tabx(x1) + tabx(1) / 2;
|
||||||
b.v = row * CHARY;
|
b.v = taby(row);
|
||||||
e.v = (row + 1) * CHARY - CHARY / 2;
|
e.v = taby(row + 1) - taby(1) / 2;
|
||||||
win_move_to (win (), b);
|
xvt_dwin_draw_set_pos (win (), b);
|
||||||
win_draw_line (win (), e);
|
xvt_dwin_draw_line (win (), e);
|
||||||
break;
|
break;
|
||||||
case 'u': // verticale pezzo sotto
|
case 'u': // verticale pezzo sotto
|
||||||
|
|
||||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
x1 = (byte) rwd[cnt++] + (X_OFFSET -1);
|
||||||
b.h = e.h = x1 * CHARX + CHARX / 2;
|
b.h = e.h = tabx(x1) + tabx(1) / 2;
|
||||||
b.v = row * CHARY + CHARY / 2;
|
b.v = taby(row) + taby(1) / 2;
|
||||||
e.v = (row + 1) * CHARY;
|
e.v = taby(row + 1);
|
||||||
win_move_to (win (), b);
|
xvt_dwin_draw_set_pos (win (), b);
|
||||||
win_draw_line (win (), e);
|
xvt_dwin_draw_line (win (), e);
|
||||||
break;
|
break;
|
||||||
case 'h': // orizzontale intera
|
case 'h': // orizzontale intera
|
||||||
|
|
||||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
x1 = (byte) rwd[cnt++] + (X_OFFSET -1) - int(origin().x);
|
||||||
x2 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
x2 = (byte) rwd[cnt++] + (X_OFFSET -1) - int(origin().x);
|
||||||
b.v = e.v = row * CHARY + CHARY / 2;
|
b.v = e.v = taby(row) + taby(1) / 2;
|
||||||
b.h = x1 * CHARX;
|
b.h = tabx(x1);
|
||||||
e.h = (x2 + 1) * CHARX;
|
e.h = tabx(x2 + 1);
|
||||||
win_move_to (win (), b);
|
xvt_dwin_draw_set_pos (win (), b);
|
||||||
win_draw_line (win (), e);
|
xvt_dwin_draw_line (win (), e);
|
||||||
break;
|
break;
|
||||||
case 'r': // orizzontale scorciata agli estremi
|
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;
|
||||||
|
|
||||||
x1 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
case 'i':
|
||||||
x2 = (unsigned char) rwd[cnt++] + (X_OFFSET -1);
|
id = (byte)(rwd[cnt++])-1; // Numero immagine
|
||||||
b.v = e.v = row * CHARY + CHARY / 2;
|
y1 = (byte)(rwd[cnt++])-1; // Riga sorgente
|
||||||
b.h = x1 * CHARX + CHARX / 2;
|
x1 = (byte)(rwd[cnt++])-1; // Colonna destinazione
|
||||||
e.h = x2 * CHARX + CHARX / 2;
|
x2 = (byte)(rwd[cnt++]); // Larghezza destinazione (in caratteri)
|
||||||
win_move_to (win (), b);
|
y2 = (byte)(rwd[cnt++]); // Altezza destinazione (in caratteri)
|
||||||
win_draw_line (win (), e);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
curwid = rwd[cnt++];
|
curwid = rwd[cnt++];
|
||||||
@ -580,10 +640,10 @@ void TViswin::paint_row (long j)
|
|||||||
if (need_paint_sel (FALSE))
|
if (need_paint_sel (FALSE))
|
||||||
adjust_selection (p1, p2);
|
adjust_selection (p1, p2);
|
||||||
int row = (int) (j + (long)Y_OFFSET - y);
|
int row = (int) (j + (long)Y_OFFSET - y);
|
||||||
static char fill[] = " "
|
char fill[] = " "
|
||||||
" ";
|
" ";
|
||||||
autoscroll(FALSE);
|
autoscroll(FALSE);
|
||||||
set_font(FF_FIXED, 0);
|
set_font(PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||||
set_mode(M_COPY);
|
set_mode(M_COPY);
|
||||||
set_opaque_text(TRUE);
|
set_opaque_text(TRUE);
|
||||||
if (_rulers)
|
if (_rulers)
|
||||||
@ -598,41 +658,31 @@ void TViswin::paint_row (long j)
|
|||||||
set_brush (COLOR_WHITE);
|
set_brush (COLOR_WHITE);
|
||||||
RCT r;
|
RCT r;
|
||||||
r.top = row * CHARY;
|
r.top = row * CHARY;
|
||||||
r.left = CHARX * (X_OFFSET -1),
|
r.left = tabx(X_OFFSET -1),
|
||||||
r.bottom = r.top + CHARY + 2;
|
r.bottom = r.top + taby(1) + 2;
|
||||||
r.right = CHARX * 255;
|
r.right = tabx(255);
|
||||||
win_draw_rect (win (), &r);
|
xvt_dwin_draw_rect (win (), &r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
paint_background (j, row);
|
||||||
|
set_opaque_text(FALSE);
|
||||||
|
|
||||||
const char *cp;
|
const char *cp;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
_txt.read_line (j, origin ().x);
|
_txt.read_line (j, origin ().x);
|
||||||
while (cp = _txt.piece ())
|
while ((cp = _txt.piece ()) != NULL)
|
||||||
{
|
{
|
||||||
#if XVT_OS != XVT_OS_SCOUNIX
|
#if XVT_OS != XVT_OS_SCOUNIX
|
||||||
int st = _txt.get_style ();
|
const int st = _txt.get_style();
|
||||||
long bg = trans_color (_txt.get_background ());
|
const COLOR bg = trans_color (_txt.get_background());
|
||||||
long fg = trans_color (_txt.get_foreground ());
|
const COLOR fg = trans_color (_txt.get_foreground());
|
||||||
// per ora disabilitiamo il grassetto
|
set_font(PRINT_FONT, st, PRINT_HEIGHT);
|
||||||
set_font (FF_FIXED, (st & 0x000f) & ~FS_BOLD);
|
set_color(fg, bg);
|
||||||
set_color (fg, bg);
|
|
||||||
#else
|
#else
|
||||||
set_color (COLOR_BLACK, COLOR_WHITE);
|
set_color (COLOR_BLACK, COLOR_WHITE);
|
||||||
#endif
|
#endif
|
||||||
printat (X_OFFSET + pos, row, "%s", cp);
|
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);
|
pos += strlen (cp);
|
||||||
}
|
}
|
||||||
if (_scrolling && (pos < _textcolumns))
|
if (_scrolling && (pos < _textcolumns))
|
||||||
@ -640,29 +690,28 @@ void TViswin::paint_row (long j)
|
|||||||
set_color (COLOR_BLACK, COLOR_WHITE);
|
set_color (COLOR_BLACK, COLOR_WHITE);
|
||||||
printat (X_OFFSET + pos, row, "%s", fill);
|
printat (X_OFFSET + pos, row, "%s", fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN // paint page limits
|
#if XVT_OS == XVT_OS_WIN // paint page limits
|
||||||
if ((j % _formlen) == (_formlen - 1) && _toplevel) // last row
|
if ((j % _formlen) == (_formlen - 1) && _toplevel) // last row
|
||||||
|
|
||||||
{
|
{
|
||||||
PNT b, e;
|
PNT b, e;
|
||||||
|
|
||||||
b.h = CHARX * (X_OFFSET -1);
|
b.h = tabx(X_OFFSET -1);
|
||||||
b.v = (row + Y_OFFSET) * CHARY - 1;
|
b.v = taby(row + Y_OFFSET) - 1;
|
||||||
e.h = CHARX * 132;
|
e.h = tabx(132);
|
||||||
e.v = (row + Y_OFFSET) * CHARY - 1;
|
e.v = taby(row + Y_OFFSET) - 1;
|
||||||
set_pen (COLOR_LTGRAY, 2, PAT_SOLID, P_DASH);
|
set_pen (COLOR_LTGRAY, 2, PAT_SOLID, P_DASH);
|
||||||
win_move_to (win(), b);
|
xvt_dwin_draw_set_pos (win(), b);
|
||||||
win_draw_line (win(), e);
|
xvt_dwin_draw_line (win(), e);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
paint_background (j, row);
|
|
||||||
autoscroll (TRUE);
|
autoscroll (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TViswin::paint_column (long j, bool end)
|
void TViswin::paint_column (long j, bool end)
|
||||||
{
|
{
|
||||||
paint_header ();
|
paint_header ();
|
||||||
set_opaque_text (TRUE);
|
set_opaque_text (FALSE);
|
||||||
set_mode (M_COPY);
|
set_mode (M_COPY);
|
||||||
TPoint p1, p2;
|
TPoint p1, p2;
|
||||||
if (need_paint_sel (FALSE))
|
if (need_paint_sel (FALSE))
|
||||||
@ -670,35 +719,35 @@ void TViswin::paint_column (long j, bool end)
|
|||||||
set_color (COLOR_BLACK, COLOR_WHITE);
|
set_color (COLOR_BLACK, COLOR_WHITE);
|
||||||
|
|
||||||
autoscroll (FALSE);
|
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);
|
const char *c = (const char *) _txt.line (origin ().y + l);
|
||||||
#if XVT_OS != XVT_OS_SCOUNIX
|
#if XVT_OS != XVT_OS_SCOUNIX
|
||||||
int st = _txt.get_style ((int) j);
|
int st = _txt.get_style ((int) j);
|
||||||
set_font (FF_FIXED, st & 0x000f);
|
set_font (PRINT_FONT, st, PRINT_HEIGHT);
|
||||||
long bg = trans_color (_txt.get_background ((int) j));
|
COLOR bg = trans_color (_txt.get_background ((int) j));
|
||||||
long fg = trans_color (_txt.get_foreground ((int) j));
|
COLOR fg = trans_color (_txt.get_foreground ((int) j));
|
||||||
set_color (fg, bg);
|
set_color (fg, bg);
|
||||||
#endif
|
#endif
|
||||||
int col = end ? (int) (_textcolumns + X_OFFSET -1) : X_OFFSET;
|
|
||||||
printat (col, (int) l + Y_OFFSET, "%c",
|
printat (col, (int) l + Y_OFFSET, "%c",
|
||||||
(unsigned int) j < strlen (c) ? c[(int) j] : ' ');
|
(unsigned int) j < strlen (c) ? c[(int) j] : ' ');
|
||||||
#if XVT_OS == XVT_OS_WIN
|
}
|
||||||
if ((st & underlined) && strlen (c) > (word) j)
|
|
||||||
{
|
xvt_dwin_set_clip(win(), NULL);
|
||||||
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);
|
|
||||||
}
|
|
||||||
autoscroll (TRUE);
|
autoscroll (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,8 +756,8 @@ void TViswin::draw_crossbars ()
|
|||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
|
|
||||||
if (_cross.v > CHARY && _cross.v < (rows () - BUTTONROW_SIZE) * CHARY &&
|
if (_cross.v > taby(1) && _cross.v < taby(rows () - BUTTONROW_SIZE) &&
|
||||||
_cross.h > CHARX * (X_OFFSET - 1) && _cross.h < columns () * CHARX)
|
_cross.h > tabx (X_OFFSET - 1) && _cross.h < tabx(columns()) )
|
||||||
{
|
{
|
||||||
set_pen (COLOR_BLACK);
|
set_pen (COLOR_BLACK);
|
||||||
set_mode (M_XOR);
|
set_mode (M_XOR);
|
||||||
@ -717,17 +766,17 @@ void TViswin::draw_crossbars ()
|
|||||||
|
|
||||||
autoscroll (FALSE);
|
autoscroll (FALSE);
|
||||||
b1.h = _cross.h;
|
b1.h = _cross.h;
|
||||||
b1.v = CHARY * Y_OFFSET;
|
b1.v = taby(Y_OFFSET);
|
||||||
e1.h = _cross.h;
|
e1.h = _cross.h;
|
||||||
e1.v = ((rows() - BUTTONROW_SIZE + (_rulers ? 0 : 1)) * CHARY);
|
e1.v = taby((rows() - BUTTONROW_SIZE + (_rulers ? 0 : 1)));
|
||||||
b2.h = CHARX * (X_OFFSET -1);
|
b2.h = tabx(X_OFFSET -1);
|
||||||
b2.v = _cross.v;
|
b2.v = _cross.v;
|
||||||
e2.h = CHARX * columns();
|
e2.h = tabx(columns());
|
||||||
e2.v = _cross.v;
|
e2.v = _cross.v;
|
||||||
win_move_to (win (), b1);
|
xvt_dwin_draw_set_pos (win (), b1);
|
||||||
win_draw_line (win (), e1);
|
xvt_dwin_draw_line (win (), e1);
|
||||||
win_move_to (win (), b2);
|
xvt_dwin_draw_set_pos (win (), b2);
|
||||||
win_draw_line (win (), e2);
|
xvt_dwin_draw_line (win (), e2);
|
||||||
autoscroll (TRUE);
|
autoscroll (TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -802,13 +851,14 @@ void TViswin::paint_header ()
|
|||||||
set_mode (M_COPY);
|
set_mode (M_COPY);
|
||||||
set_opaque_text (TRUE);
|
set_opaque_text (TRUE);
|
||||||
set_color (FOREGROUND, BACKGROUND);
|
set_color (FOREGROUND, BACKGROUND);
|
||||||
set_font (FF_FIXED, 0);
|
set_font (PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||||
TString htmpst (10);
|
TString16 htmpst;
|
||||||
for (int i = 1; i < 26; i++)
|
for (int i = 1; i < 26; i++)
|
||||||
{
|
{
|
||||||
htmpst.format ("%d", i);
|
htmpst.format ("%d", i);
|
||||||
htmpst.right_just (10, '.');
|
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);
|
autoscroll (FALSE);
|
||||||
set_color (COLOR_WHITE, BACKGROUND);
|
set_color (COLOR_WHITE, BACKGROUND);
|
||||||
@ -841,35 +891,17 @@ void TViswin::paint_selection ()
|
|||||||
void TViswin::paint_waitbar (bool xor)
|
void TViswin::paint_waitbar (bool xor)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
static int pic;
|
HIDDEN int pic = 0;
|
||||||
#endif
|
((TImage&)_modules[pic]).draw(win());
|
||||||
|
pic = (pic+1) & 0x3;
|
||||||
|
#else
|
||||||
autoscroll (FALSE);
|
autoscroll (FALSE);
|
||||||
if (xor)
|
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);
|
invert_bar (3, rows() - 2, 4, rows() - 1);
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
printat (3, rows() - 2, "%c", '*');
|
||||||
#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
|
|
||||||
}
|
|
||||||
autoscroll (TRUE);
|
autoscroll (TRUE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TViswin::update ()
|
void TViswin::update ()
|
||||||
@ -910,11 +942,9 @@ void TViswin::update ()
|
|||||||
bar ((X_OFFSET -1), rows()-BUTTONROW_SIZE, columns() + 1, rows() + 1);
|
bar ((X_OFFSET -1), rows()-BUTTONROW_SIZE, columns() + 1, rows() + 1);
|
||||||
if (_showbuts && _isopen)
|
if (_showbuts && _isopen)
|
||||||
paint_waitbar (FALSE);
|
paint_waitbar (FALSE);
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
else if (_showbuts)
|
else
|
||||||
cpb_win_picture_draw_at (win(), _modpic, 4,
|
if (_showbuts) ((TImage&)_modules[4]).draw(win());
|
||||||
4 + (int) (rows () - (long)BUTTONROW_SIZE) * CHARY);
|
|
||||||
#endif
|
#endif
|
||||||
autoscroll (TRUE);
|
autoscroll (TRUE);
|
||||||
paint_header ();
|
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)
|
void TViswin::handler (WINDOW win, EVENT * ep)
|
||||||
{
|
{
|
||||||
int kdiff_x, kdiff_y;
|
int kdiff_x, kdiff_y;
|
||||||
@ -991,7 +1034,11 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
dispatch_e_char(win, CTRL_E);
|
dispatch_e_char(win, CTRL_E);
|
||||||
break;
|
break;
|
||||||
case M_EDIT_SEL_ALL: // stampa
|
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;
|
break;
|
||||||
case M_FONT: // mostra righelli
|
case M_FONT: // mostra righelli
|
||||||
show_rulers(!_rulers);
|
show_rulers(!_rulers);
|
||||||
@ -1042,7 +1089,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DLG_PRINT:
|
case DLG_PRINT:
|
||||||
_txt.print ();
|
dispatch_e_menu(win, M_EDIT_SEL_ALL);
|
||||||
break;
|
break;
|
||||||
case DLG_EDIT:
|
case DLG_EDIT:
|
||||||
check_link ();
|
check_link ();
|
||||||
@ -1059,22 +1106,22 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
case E_TIMER:
|
case E_TIMER:
|
||||||
if (ep->v.timer.id == _timer)
|
if (ep->v.timer.id == _timer)
|
||||||
{
|
{
|
||||||
kill_timer (_timer);
|
xvt_timer_destroy (_timer);
|
||||||
_istimer = FALSE;
|
_istimer = FALSE;
|
||||||
}
|
}
|
||||||
else if (ep->v.timer.id == _wtimer)
|
else if (ep->v.timer.id == _wtimer)
|
||||||
{
|
{
|
||||||
if (_showbuts) paint_waitbar ();
|
if (_showbuts) paint_waitbar ();
|
||||||
kill_timer (_wtimer);
|
xvt_timer_destroy (_wtimer);
|
||||||
if (_isopen)
|
if (_isopen)
|
||||||
_wtimer = set_timer (win, 150l);
|
_wtimer = xvt_timer_create (win, 150l);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_MOUSE_DBL:
|
case E_MOUSE_DBL:
|
||||||
break;
|
break;
|
||||||
case E_MOUSE_DOWN:
|
case E_MOUSE_DOWN:
|
||||||
p = ep->v.mouse.where;
|
p = ep->v.mouse.where;
|
||||||
trap_mouse (win);
|
xvt_win_trap_pointer (win);
|
||||||
|
|
||||||
if (ep->v.mouse.button == 0) // left button: text selection
|
if (ep->v.mouse.button == 0) // left button: text selection
|
||||||
|
|
||||||
@ -1106,7 +1153,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case E_MOUSE_UP:
|
case E_MOUSE_UP:
|
||||||
release_mouse ();
|
xvt_win_release_pointer ();
|
||||||
|
|
||||||
if (ep->v.mouse.button == 0) // left button: text selection/move
|
if (ep->v.mouse.button == 0) // left button: text selection/move
|
||||||
// point
|
// point
|
||||||
@ -1328,11 +1375,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
check_link (&_point);
|
check_link (&_point);
|
||||||
_need_update = FALSE;
|
_need_update = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(-1, 0);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(-1, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1350,11 +1393,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
check_link (&_point);
|
check_link (&_point);
|
||||||
_need_update = FALSE;
|
_need_update = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(0, -1);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(0, -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SC_LINE_UP:
|
case SC_LINE_UP:
|
||||||
@ -1370,11 +1409,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
update_thumb (origin().x, origin().y - 1l);
|
update_thumb (origin().x, origin().y - 1l);
|
||||||
_need_scroll = down;
|
_need_scroll = down;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(-1, 0);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(-1, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1388,11 +1423,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
_point.x--;
|
_point.x--;
|
||||||
_need_scroll = right;
|
_need_scroll = right;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(0, -1);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(0, -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SC_PAGE_DOWN:
|
case SC_PAGE_DOWN:
|
||||||
@ -1413,11 +1444,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
check_link (&_point);
|
check_link (&_point);
|
||||||
_need_update = FALSE;
|
_need_update = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(-1, _txt.lines()-_textrows-1);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(-1, _txt.lines()-_textrows-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1435,11 +1462,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
check_link (&_point);
|
check_link (&_point);
|
||||||
_need_update = FALSE;
|
_need_update = FALSE;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(255-_textcolumns, -1);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(255-_textcolumns, -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SC_LINE_DOWN:
|
case SC_LINE_DOWN:
|
||||||
@ -1455,11 +1478,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
_point.y++;
|
_point.y++;
|
||||||
_need_scroll = up;
|
_need_scroll = up;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(-1, _txt.lines()-_textrows-1);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(-1, _txt.lines()-_textrows-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1473,11 +1492,7 @@ void TViswin::handler (WINDOW win, EVENT * ep)
|
|||||||
_need_scroll = left;
|
_need_scroll = left;
|
||||||
_point.x++;
|
_point.x++;
|
||||||
}
|
}
|
||||||
else
|
else scroll_error(255-_textcolumns, -1);
|
||||||
{
|
|
||||||
beep ();
|
|
||||||
update_thumb(255-_textcolumns, -1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SC_THUMB:
|
case SC_THUMB:
|
||||||
@ -1545,7 +1560,7 @@ bool TViswin::on_key (KEY key)
|
|||||||
|
|
||||||
if (_istimer)
|
if (_istimer)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
_timer = set_timer (win (), 50l);
|
_timer = xvt_timer_create (win (), 50l);
|
||||||
_istimer = TRUE;
|
_istimer = TRUE;
|
||||||
|
|
||||||
if (key == K_UP || key == K_DOWN || key == K_LEFT || key == K_RIGHT)
|
if (key == K_UP || key == K_DOWN || key == K_LEFT || key == K_RIGHT)
|
||||||
@ -1580,7 +1595,7 @@ bool TViswin::on_key (KEY key)
|
|||||||
break;
|
break;
|
||||||
case CTRL_S:
|
case CTRL_S:
|
||||||
if (_isprint)
|
if (_isprint)
|
||||||
_txt.print ();
|
stop_run(CTRL_S);
|
||||||
break;
|
break;
|
||||||
case CTRL_R:
|
case CTRL_R:
|
||||||
_need_update = TRUE;
|
_need_update = TRUE;
|
||||||
@ -1893,18 +1908,18 @@ bool TViswin::call_editor ()
|
|||||||
{
|
{
|
||||||
TFilename newfilename; newfilename.tempdir();
|
TFilename newfilename; newfilename.tempdir();
|
||||||
FILE_SPEC fs;
|
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.type, "txt");
|
||||||
strcpy (fs.name, "");
|
strcpy (fs.name, "");
|
||||||
|
|
||||||
save_dir ();
|
xvt_fsys_save_dir ();
|
||||||
ok = save_file_dlg (&fs, "Salva il file con il nome:") == FL_OK;
|
ok = xvt_dm_post_file_save (&fs, "Salva il file con il nome:") == FL_OK;
|
||||||
restore_dir ();
|
xvt_fsys_restore_dir ();
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
char path[256];
|
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 = path;
|
||||||
newfilename << '/' << fs.name;
|
newfilename << '/' << fs.name;
|
||||||
|
|
||||||
@ -1944,7 +1959,7 @@ void TViswin::add_line (const char *l)
|
|||||||
ev.type = E_USER;
|
ev.type = E_USER;
|
||||||
ev.v.user.id = (_txt.lines() - origin().y) <= _textrows ?
|
ev.v.user.id = (_txt.lines() - origin().y) <= _textrows ?
|
||||||
E_ADDLINE_ONSCREEN : E_ADDLINE;
|
E_ADDLINE_ONSCREEN : E_ADDLINE;
|
||||||
dispatch_event (win (), &ev);
|
xvt_win_dispatch_event (win (), &ev);
|
||||||
do_events ();
|
do_events ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1952,12 +1967,14 @@ void TViswin::add_line (const char *l)
|
|||||||
void TViswin::close_print ()
|
void TViswin::close_print ()
|
||||||
{
|
{
|
||||||
_isopen = FALSE;
|
_isopen = FALSE;
|
||||||
if (_showbuts) kill_timer (_wtimer);
|
if (_showbuts) xvt_timer_destroy (_wtimer);
|
||||||
_need_update = TRUE;
|
_need_update = TRUE;
|
||||||
if (_toplevel)
|
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);
|
enable_menu_item(M_EDIT_CLIPBOARD, FALSE);
|
||||||
|
xvt_enable_control(_print_button, TRUE);
|
||||||
|
enable_menu_item(M_EDIT_SEL_ALL, TRUE);
|
||||||
}
|
}
|
||||||
force_update ();
|
force_update ();
|
||||||
}
|
}
|
||||||
@ -2081,7 +2098,7 @@ void TViswin::show_buttons(bool on)
|
|||||||
|
|
||||||
for (int i = 0; i < _buttons; i++)
|
for (int i = 0; i < _buttons; i++)
|
||||||
if (_button[i] != NULL_WIN)
|
if (_button[i] != NULL_WIN)
|
||||||
show_window(_button[i],on);
|
xvt_vobj_set_visible(_button[i],on);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2136,7 +2153,7 @@ TViswin::TViswin(const char *fname,
|
|||||||
|
|
||||||
RCT r;
|
RCT r;
|
||||||
|
|
||||||
get_client_rect (parent, &r);
|
xvt_vobj_get_client_rect (parent, &r);
|
||||||
int maxlarg = width == 0 ? (r.right / CHARX - 6) : width;
|
int maxlarg = width == 0 ? (r.right / CHARX - 6) : width;
|
||||||
int maxalt = height == 0 ? (r.bottom / CHARY - 6) : height;
|
int maxalt = height == 0 ? (r.bottom / CHARY - 6) : height;
|
||||||
|
|
||||||
@ -2147,8 +2164,8 @@ TViswin::TViswin(const char *fname,
|
|||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
_picture[i] = cpb_picture_load (BMP_MODULE1 + i);
|
_modules.add(new TImage(BMP_MODULE1 + i), i);
|
||||||
_modpic = cpb_picture_load (BMP_MODULE);
|
_modules.add(new TImage(BMP_MODULE), i);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long flags = WSF_HSCROLL | WSF_VSCROLL;
|
long flags = WSF_HSCROLL | WSF_VSCROLL;
|
||||||
@ -2161,7 +2178,7 @@ TViswin::TViswin(const char *fname,
|
|||||||
create (x, y, maxlarg, maxalt, title, flags, rt, parent,
|
create (x, y, maxlarg, maxalt, title, flags, rt, parent,
|
||||||
_toplevel ? VISWIN_BAR : 0);
|
_toplevel ? VISWIN_BAR : 0);
|
||||||
set_opaque_text (TRUE);
|
set_opaque_text (TRUE);
|
||||||
set_font (FF_FIXED);
|
set_font (PRINT_FONT, XVT_FS_NONE, PRINT_HEIGHT);
|
||||||
|
|
||||||
if (_toplevel)
|
if (_toplevel)
|
||||||
{
|
{
|
||||||
@ -2182,7 +2199,6 @@ TViswin::TViswin(const char *fname,
|
|||||||
add_button (DLG_QUIT, DLG_QUIT_TITLE);
|
add_button (DLG_QUIT, DLG_QUIT_TITLE);
|
||||||
_buttons = 1;
|
_buttons = 1;
|
||||||
|
|
||||||
|
|
||||||
if (_isedit)
|
if (_isedit)
|
||||||
{
|
{
|
||||||
add_button (DLG_EDIT, DLG_EDIT_TITLE);
|
add_button (DLG_EDIT, DLG_EDIT_TITLE);
|
||||||
@ -2194,20 +2210,20 @@ TViswin::TViswin(const char *fname,
|
|||||||
_buttons++;
|
_buttons++;
|
||||||
xvt_enable_control(_link_button, FALSE);
|
xvt_enable_control(_link_button, FALSE);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
if (_isprint)
|
if (_isprint)
|
||||||
{
|
{
|
||||||
add_button (DLG_PRINT, DLG_PRINT_TITLE);
|
_print_button = add_button (DLG_PRINT, DLG_PRINT_TITLE);
|
||||||
|
xvt_enable_control(_print_button, FALSE);
|
||||||
|
enable_menu_item(M_EDIT_SEL_ALL, FALSE);
|
||||||
_buttons++;
|
_buttons++;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else _buttons = 0;
|
else _buttons = 0;
|
||||||
|
|
||||||
_curbut = 0;
|
_curbut = 0;
|
||||||
|
|
||||||
if (_isopen && _showbuts)
|
if (_isopen && _showbuts)
|
||||||
_wtimer = set_timer(win(), 150l);
|
_wtimer = xvt_timer_create(win(), 150l);
|
||||||
|
|
||||||
_point.set (0, 0);
|
_point.set (0, 0);
|
||||||
autoscroll (FALSE);
|
autoscroll (FALSE);
|
||||||
@ -2218,8 +2234,7 @@ TViswin::TViswin(const char *fname,
|
|||||||
_links = _toplevel ? &(main_app().printer().links()) : &(_brwfld->_links);
|
_links = _toplevel ? &(main_app().printer().links()) : &(_brwfld->_links);
|
||||||
_multiple = _toplevel ? (main_app().printer ().ismultiplelink()) :
|
_multiple = _toplevel ? (main_app().printer ().ismultiplelink()) :
|
||||||
(_brwfld->is_multiple_link());
|
(_brwfld->is_multiple_link());
|
||||||
_bg = _toplevel ? main_app().printer().getbgdesc() : _brwfld->get_bg_desc();
|
_bg = _toplevel ? &(main_app().printer().getbgdesc()) : _brwfld->get_bg_desc();
|
||||||
_isbackground = _bg->items () > 0;
|
|
||||||
_formlen = _toplevel ? main_app().printer().formlen() : maxalt;
|
_formlen = _toplevel ? main_app().printer().formlen() : maxalt;
|
||||||
_linkID = -1;
|
_linkID = -1;
|
||||||
_inside_linkexec = FALSE;
|
_inside_linkexec = FALSE;
|
||||||
@ -2238,12 +2253,7 @@ TViswin::TViswin(const char *fname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TViswin ::~TViswin ()
|
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
|
// 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,
|
_viswin = new TViswin(_prompt, _prompt, FALSE, FALSE, FALSE, _x, _y,
|
||||||
_size, _width, _flags.rightjust ? TRUE : FALSE, parent, this);
|
_size, _width, _flags.rightjust ? TRUE : FALSE, parent, this);
|
||||||
_win = _viswin->win();
|
_win = _viswin->win();
|
||||||
enable_window(_win, enabled());
|
xvt_vobj_set_enabled(_win, enabled());
|
||||||
show_window(_win, shown());
|
xvt_vobj_set_visible(_win, shown());
|
||||||
|
|
||||||
main_app().end_wait();
|
main_app().end_wait();
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,6 @@
|
|||||||
#ifndef __VISWIN_H
|
#ifndef __VISWIN_H
|
||||||
#define __VISWIN_H
|
#define __VISWIN_H
|
||||||
|
|
||||||
#ifndef __ARRAY_H
|
|
||||||
#include <array.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __WINDOW_H
|
#ifndef __WINDOW_H
|
||||||
#include <window.h>
|
#include <window.h>
|
||||||
#endif
|
#endif
|
||||||
@ -51,7 +47,9 @@ class TViswin : public TScroll_window
|
|||||||
WINDOW _button[MAXBUT]; // button array
|
WINDOW _button[MAXBUT]; // button array
|
||||||
int _curbut; // button which currently has focus
|
int _curbut; // button which currently has focus
|
||||||
int _buttons; // button count
|
int _buttons; // button count
|
||||||
|
|
||||||
WINDOW _link_button;
|
WINDOW _link_button;
|
||||||
|
WINDOW _print_button;
|
||||||
|
|
||||||
long _textrows; // righe di testo
|
long _textrows; // righe di testo
|
||||||
long _textcolumns; // indovina indovinello
|
long _textcolumns; // indovina indovinello
|
||||||
@ -76,15 +74,16 @@ class TViswin : public TScroll_window
|
|||||||
TArray* _hotspots; // hotspots
|
TArray* _hotspots; // hotspots
|
||||||
|
|
||||||
bool need_paint_sel(bool smart = TRUE);
|
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;
|
bool _multiple;
|
||||||
TString80 _linktxt;
|
TString80 _linktxt;
|
||||||
int _linkID;
|
int _linkID;
|
||||||
TToken_string _multiple_link;
|
TToken_string _multiple_link;
|
||||||
|
|
||||||
TArray* _bg;
|
TArray* _bg;
|
||||||
bool _isbackground;
|
|
||||||
bool _frozen;
|
bool _frozen;
|
||||||
bool _toplevel;
|
bool _toplevel;
|
||||||
bool _rulers;
|
bool _rulers;
|
||||||
@ -99,6 +98,9 @@ protected:
|
|||||||
virtual bool on_key (KEY);
|
virtual bool on_key (KEY);
|
||||||
virtual void open();
|
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 shift_screen(scroll);
|
||||||
void paint_screen();
|
void paint_screen();
|
||||||
void draw_crossbars();
|
void draw_crossbars();
|
||||||
@ -130,6 +132,7 @@ protected:
|
|||||||
void exec_link();
|
void exec_link();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void scroll_error(long x, long y);
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual void handler(WINDOW win, EVENT* ep);
|
virtual void handler(WINDOW win, EVENT* ep);
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <window.h>
|
#include <window.h>
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
|
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@ -28,10 +27,15 @@ class TWindow_manager
|
|||||||
char _current; // Stack pointer
|
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:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
TWindow_manager(); // Costruttore
|
TWindow_manager(); // Costruttore
|
||||||
~TWindow_manager() { destroy(); }
|
~TWindow_manager();
|
||||||
|
|
||||||
|
void free_handle();
|
||||||
|
void lock_handle();
|
||||||
|
|
||||||
void reg(TWindow* m);
|
void reg(TWindow* m);
|
||||||
// Registra la finestra corrente
|
// Registra la finestra corrente
|
||||||
@ -44,9 +48,16 @@ public:
|
|||||||
} WinManager;
|
} 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()
|
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 TWindow_manager::can_close() const
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
@ -78,7 +104,7 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
|||||||
if (m->child)
|
if (m->child)
|
||||||
xvt_menu_enable(m->child, on);
|
xvt_menu_enable(m->child, on);
|
||||||
break;
|
break;
|
||||||
case 65535: // Separator
|
case -1: // Separator
|
||||||
case M_FILE_NEW:
|
case M_FILE_NEW:
|
||||||
case M_FILE_REVERT:
|
case M_FILE_REVERT:
|
||||||
case M_FILE_QUIT:
|
case M_FILE_QUIT:
|
||||||
@ -88,7 +114,7 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
|||||||
case (M_FILE+11):
|
case (M_FILE+11):
|
||||||
break; // Leave them as they are
|
break; // Leave them as they are
|
||||||
default:
|
default:
|
||||||
win_menu_enable(TASK_WIN, m->tag, on);
|
xvt_menu_set_item_enabled(TASK_WIN, m->tag, on);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m++;
|
m++;
|
||||||
@ -98,10 +124,10 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
|
|||||||
|
|
||||||
void TWindow_manager::menu_enable(bool on) const
|
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);
|
xvt_menu_enable(mi, on);
|
||||||
win_update_menu_bar(TASK_WIN);
|
xvt_menu_update(TASK_WIN);
|
||||||
menu_free(mi);
|
xvt_res_free_menu_tree(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,7 +142,7 @@ void TWindow_manager::reg(TWindow* m)
|
|||||||
menu_enable(FALSE);
|
menu_enable(FALSE);
|
||||||
break;
|
break;
|
||||||
case 1 :
|
case 1 :
|
||||||
win_menu_enable(TASK_WIN, M_FILE_QUIT, FALSE);
|
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_QUIT, FALSE);
|
||||||
default:
|
default:
|
||||||
_window[_current-1]->deactivate(); break;
|
_window[_current-1]->deactivate(); break;
|
||||||
}
|
}
|
||||||
@ -144,8 +170,8 @@ void TWindow_manager::unreg(const TWindow* m)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
cur_win()->activate();
|
cur_win()->activate();
|
||||||
win_menu_enable(TASK_WIN, M_FILE_QUIT, _current == 0);
|
xvt_menu_set_item_enabled(TASK_WIN, M_FILE_QUIT, _current == 0);
|
||||||
win_update_menu_bar(TASK_WIN);
|
xvt_menu_update(TASK_WIN);
|
||||||
cur_win()->set_focus();
|
cur_win()->set_focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,6 +192,155 @@ WINDOW cur_win()
|
|||||||
return w ? w->win() : NULL_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
|
// TWindow
|
||||||
@ -183,7 +358,7 @@ TWindow::TWindow()
|
|||||||
|
|
||||||
long XVT_CALLCONV1 TWindow::window_handler(WINDOW win, EVENT* ep)
|
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");
|
CHECK(w != NULL, "Invalid window");
|
||||||
w->handler(win, ep);
|
w->handler(win, ep);
|
||||||
|
|
||||||
@ -220,7 +395,7 @@ TWindow::~TWindow()
|
|||||||
{
|
{
|
||||||
if (_win != NULL_WIN)
|
if (_win != NULL_WIN)
|
||||||
{
|
{
|
||||||
close_window(_win);
|
xvt_vobj_destroy(_win);
|
||||||
_win = NULL_WIN;
|
_win = NULL_WIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,8 +404,9 @@ TWindow::~TWindow()
|
|||||||
void TWindow::open()
|
void TWindow::open()
|
||||||
{
|
{
|
||||||
CHECK(win() != NULL_WIN, "Can't open a NULL window");
|
CHECK(win() != NULL_WIN, "Can't open a NULL window");
|
||||||
show_window(win(), _open = TRUE);
|
xvt_vobj_set_visible(win(), _open = TRUE);
|
||||||
set_front_window(win());
|
xvt_scr_set_focus_vobj(win());
|
||||||
|
xvt_vobj_raise(win());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -247,7 +423,7 @@ void TWindow::open_modal()
|
|||||||
void TWindow::close()
|
void TWindow::close()
|
||||||
{
|
{
|
||||||
CHECK(_win != NULL_WIN, "Can't close a NULL window");
|
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);
|
stop_run(K_ESC);
|
||||||
break;
|
break;
|
||||||
case E_UPDATE:
|
case E_UPDATE:
|
||||||
clear_window(win, NORMAL_BACK_COLOR);
|
xvt_dwin_clear(win, NORMAL_BACK_COLOR);
|
||||||
update();
|
update();
|
||||||
break;
|
break;
|
||||||
case E_CHAR:
|
case E_CHAR:
|
||||||
@ -317,27 +493,30 @@ void TWindow::handler(WINDOW win, EVENT* ep)
|
|||||||
TPoint TWindow::size() const
|
TPoint TWindow::size() const
|
||||||
{
|
{
|
||||||
RCT r;
|
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);
|
return TPoint(r.right / CHARX, r.bottom / CHARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
WINDOW TWindow::parent() const
|
WINDOW TWindow::parent() const
|
||||||
{
|
{
|
||||||
return get_parent(win());
|
return xvt_vobj_get_parent(win());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TWindow::set_focus()
|
void TWindow::set_focus()
|
||||||
{
|
{
|
||||||
if (_win)
|
if (_win)
|
||||||
set_front_window(_win);
|
{
|
||||||
|
xvt_scr_set_focus_vobj(_win);
|
||||||
|
xvt_vobj_raise(_win);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TWindow::iconize() const
|
void TWindow::iconize() const
|
||||||
{
|
{
|
||||||
#if XVTWS != WMWS
|
#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);
|
ShowWindow(hwnd, SW_MINIMIZE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -345,30 +524,30 @@ void TWindow::iconize() const
|
|||||||
void TWindow::maximize() const
|
void TWindow::maximize() const
|
||||||
{
|
{
|
||||||
#if XVTWS != WMWS
|
#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);
|
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
|
||||||
#else
|
#else
|
||||||
RCT r; set_rect(&r, 1,1,79,23);
|
RCT r; xvt_rect_set(&r, 1,1,79,23);
|
||||||
move_window(win(),&r);
|
xvt_vobj_move(win(),&r);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TWindow::activate(bool on)
|
void TWindow::activate(bool on)
|
||||||
{
|
{
|
||||||
enable_window(win(), _active = on);
|
xvt_vobj_set_enabled(win(), _active = on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TWindow::set_caption(const char* title)
|
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
|
const char* TWindow::get_caption() const
|
||||||
{
|
{
|
||||||
char* title = &__tmp_string[512];
|
char* title = &__tmp_string[512];
|
||||||
get_title(win(), title, 80);
|
xvt_vobj_get_title(win(), title, 80);
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +555,7 @@ const char* TWindow::get_caption() const
|
|||||||
void TWindow::force_update()
|
void TWindow::force_update()
|
||||||
{
|
{
|
||||||
if (win() != NULL_WIN)
|
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)
|
if (_ctools_saved == FALSE)
|
||||||
{
|
{
|
||||||
win_get_draw_ctools(win(), &_ct);
|
xvt_dwin_get_draw_ctools(win(), &_ct);
|
||||||
return _ctools_saved = TRUE;
|
return _ctools_saved = TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -395,7 +574,7 @@ bool TWindow::restore_ctools()
|
|||||||
{
|
{
|
||||||
if (_ctools_saved)
|
if (_ctools_saved)
|
||||||
{
|
{
|
||||||
win_set_draw_ctools(win(), &_ct);
|
xvt_dwin_set_draw_ctools(win(), &_ct);
|
||||||
_ctools_saved = FALSE;
|
_ctools_saved = FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -405,8 +584,8 @@ bool TWindow::restore_ctools()
|
|||||||
|
|
||||||
void TWindow::set_color(COLOR fore, COLOR back)
|
void TWindow::set_color(COLOR fore, COLOR back)
|
||||||
{
|
{
|
||||||
win_set_fore_color(win(), fore);
|
xvt_dwin_set_fore_color(win(), fore);
|
||||||
win_set_back_color(win(), back);
|
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.style = style;
|
||||||
pen.color = color;
|
pen.color = color;
|
||||||
|
|
||||||
win_set_cpen(win(), &pen);
|
xvt_dwin_set_cpen(win(), &pen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TWindow::hide_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)
|
void TWindow::set_brush(COLOR color, PAT_STYLE pat)
|
||||||
{
|
{
|
||||||
CBRUSH brush = { pat, color };
|
CBRUSH brush = { pat, color };
|
||||||
win_set_cbrush(win(), &brush);
|
xvt_dwin_set_cbrush(win(), &brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TWindow::hide_brush()
|
void TWindow::hide_brush()
|
||||||
{
|
{
|
||||||
CBRUSH brush = { PAT_HOLLOW, COLOR_WHITE };
|
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
|
set_brush(COLOR_BLACK); // Needed for Windows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const PNT f = log2dev(left,top);
|
const PNT f = log2dev(left,top);
|
||||||
const PNT t = log2dev(right,bottom);
|
const PNT t = log2dev(right,bottom);
|
||||||
RCT r;
|
RCT r;
|
||||||
@ -482,7 +660,7 @@ void TWindow::frame(short left, short top, short right, short bottom,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
win_draw_rect(win(), &r);
|
xvt_dwin_draw_rect(win(), &r);
|
||||||
|
|
||||||
if (saved) restore_ctools();
|
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)
|
void TWindow::set_opaque_text(bool o)
|
||||||
{
|
{
|
||||||
DRAW_CTOOLS ct;
|
DRAW_CTOOLS ct;
|
||||||
win_get_draw_ctools(win(), &ct);
|
xvt_dwin_get_draw_ctools(win(), &ct);
|
||||||
ct.opaque_text = o;
|
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);
|
xvt_set_font(win(), family, style, dim);
|
||||||
}
|
}
|
||||||
@ -548,7 +726,7 @@ void TWindow::stringat(short x, short y, const char* str)
|
|||||||
pnt.v += BASEY;
|
pnt.v += BASEY;
|
||||||
#endif
|
#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, ...)
|
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;
|
if (t.v == 0) t.v = -CHARY; else t.v += CHARY>>1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
win_move_to(_win, f);
|
xvt_dwin_draw_set_pos(_win, f);
|
||||||
win_draw_line(_win, t);
|
xvt_dwin_draw_line(_win, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TWindow::icon(short x0, short y0, int iconid)
|
void TWindow::icon(short x0, short y0, int iconid)
|
||||||
@ -584,15 +762,15 @@ void TWindow::icon(short x0, short y0, int iconid)
|
|||||||
#else
|
#else
|
||||||
PNT f = log2dev(x0,y0);
|
PNT f = log2dev(x0,y0);
|
||||||
if (iconid < 0) iconid = ICON_RSRC;
|
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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TWindow::clear(COLOR color)
|
void TWindow::clear(COLOR color)
|
||||||
{ clear_window(win(), color); }
|
{ xvt_dwin_clear(win(), color); }
|
||||||
|
|
||||||
void TWindow::set_mode(DRAW_MODE mode)
|
void TWindow::set_mode(DRAW_MODE mode)
|
||||||
{ win_set_draw_mode(win(), mode); }
|
{ xvt_dwin_set_draw_mode(win(), mode); }
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TTemp_window
|
// TTemp_window
|
||||||
@ -642,14 +820,14 @@ void TScroll_window::set_scroll_max(long maxx, long maxy)
|
|||||||
if (_has_hscroll && maxx >= 0)
|
if (_has_hscroll && maxx >= 0)
|
||||||
{
|
{
|
||||||
_max.x = maxx;
|
_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)
|
if (_has_vscroll && maxy >= 0)
|
||||||
{
|
{
|
||||||
_shift = 0;
|
_shift = 0;
|
||||||
while ((maxy >> _shift) > 0x7FFF) _shift++;
|
while ((maxy >> _shift) > 0x7FFF) _shift++;
|
||||||
_max.y = maxy;
|
_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 (y >= 0 && y <= _max.y) _origin.y = y;
|
||||||
|
|
||||||
if (_has_hscroll)
|
if (_has_hscroll)
|
||||||
set_scroll_pos(win(), HSCROLL, int(_origin.x));
|
xvt_sbar_set_pos(win(), HSCROLL, int(_origin.x));
|
||||||
if (_has_vscroll)
|
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)
|
void TScroll_window::handler(WINDOW win, EVENT* ep)
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#ifndef __WINDOW_H
|
#ifndef __WINDOW_H
|
||||||
#define __WINDOW_H
|
#define __WINDOW_H
|
||||||
|
|
||||||
|
#ifndef __OBJECT_H
|
||||||
|
#include <object.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __XVTILITY_H
|
#ifndef __XVTILITY_H
|
||||||
#include <xvtility.h>
|
#include <xvtility.h>
|
||||||
#endif
|
#endif
|
||||||
@ -35,6 +39,43 @@ struct TPoint
|
|||||||
bool operator !=(const TPoint& p) { return p.x != x || p.y != y; }
|
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
|
// @C
|
||||||
// Classe TWindow
|
// Classe TWindow
|
||||||
@ -139,7 +180,7 @@ public:
|
|||||||
void hide_pen(); // Nasconde la penna
|
void hide_pen(); // Nasconde la penna
|
||||||
void hide_brush(); // Nasconde il pennello
|
void hide_brush(); // Nasconde il pennello
|
||||||
void set_brush(COLOR color, PAT_STYLE = PAT_SOLID); // Sceglie pennello con colore color
|
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
|
// 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);
|
void frame(short left, short top, short right, short bottom, int flag);
|
||||||
|
@ -19,6 +19,8 @@ void fatal_hook()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HIDDEN XVT_FNTID DEF_FONT = NULL;
|
||||||
|
|
||||||
#if XVTWS == WMWS
|
#if XVTWS == WMWS
|
||||||
|
|
||||||
short CHARX = 8;
|
short CHARX = 8;
|
||||||
@ -39,9 +41,7 @@ COLOR FOCUS_BACK_COLOR = COLOR_WHITE;
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#ifdef __CTL3D__
|
|
||||||
#include <ctl3d.h>
|
#include <ctl3d.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
HIDDEN COLORREF COLOR2RGB(COLOR c)
|
HIDDEN COLORREF COLOR2RGB(COLOR c)
|
||||||
{
|
{
|
||||||
@ -56,7 +56,7 @@ HIDDEN COLOR RGB2COLOR(COLORREF c)
|
|||||||
const byte red = byte(c & 0xFF);
|
const byte red = byte(c & 0xFF);
|
||||||
const byte gre = byte((c >> 8) & 0xFF);
|
const byte gre = byte((c >> 8) & 0xFF);
|
||||||
const byte blu = byte((c >> 16) & 0xFF);
|
const byte blu = byte((c >> 16) & 0xFF);
|
||||||
return MAKE_COLOR(red, gre, blu);
|
return XVT_MAKE_COLOR(red, gre, blu);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef XVT_CALLCONV1
|
#ifndef XVT_CALLCONV1
|
||||||
@ -100,6 +100,62 @@ HIDDEN HBRUSH FocusBrush = 0;
|
|||||||
|
|
||||||
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
|
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,
|
static BOOLEAN event_hook(HWND hwnd,
|
||||||
UINT msg,
|
UINT msg,
|
||||||
UINT wparam,
|
UINT wparam,
|
||||||
@ -108,16 +164,14 @@ static BOOLEAN event_hook(HWND hwnd,
|
|||||||
{
|
{
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
#ifdef __CTL3D__
|
|
||||||
case WM_SYSCOLORCHANGE:
|
case WM_SYSCOLORCHANGE:
|
||||||
Ctl3dColorChange();
|
Ctl3dColorChange();
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case WM_CTLCOLOR:
|
case WM_CTLCOLOR:
|
||||||
{
|
{
|
||||||
#ifdef __CTL3D__
|
#ifdef __CTL3D__
|
||||||
*ret = Ctl3dCtlColorEx(msg, wparam, lparam);
|
*ret = Ctl3dCtlColorEx(msg, wparam, lparam);
|
||||||
return TRUE;
|
return FALSE; // Non fare altro
|
||||||
#else
|
#else
|
||||||
const word type = HIWORD(lparam);
|
const word type = HIWORD(lparam);
|
||||||
if (type == CTLCOLOR_LISTBOX || type == CTLCOLOR_EDIT ||
|
if (type == CTLCOLOR_LISTBOX || type == CTLCOLOR_EDIT ||
|
||||||
@ -134,7 +188,7 @@ static BOOLEAN event_hook(HWND hwnd,
|
|||||||
SetBkColor(hdc, MaskColor);
|
SetBkColor(hdc, MaskColor);
|
||||||
}
|
}
|
||||||
*ret = MaskBrush;
|
*ret = MaskBrush;
|
||||||
return TRUE;
|
return FALSE; // Non fare altro
|
||||||
}
|
}
|
||||||
|
|
||||||
bool focus = GetFocus() == hwnd;
|
bool focus = GetFocus() == hwnd;
|
||||||
@ -144,7 +198,7 @@ static BOOLEAN event_hook(HWND hwnd,
|
|||||||
SetBkColor(hdc, focus ? FocusBackColor : NormalBackColor);
|
SetBkColor(hdc, focus ? FocusBackColor : NormalBackColor);
|
||||||
}
|
}
|
||||||
*ret = focus ? FocusBrush : NormalBrush;
|
*ret = focus ? FocusBrush : NormalBrush;
|
||||||
return TRUE;
|
return FALSE; // Non fare altro
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -161,14 +215,14 @@ static BOOLEAN event_hook(HWND hwnd,
|
|||||||
break;
|
break;
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
|
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];
|
char name[16];
|
||||||
GetClassName(hwnd, name, 5);
|
GetClassName(hwnd, name, 5);
|
||||||
if (stricmp(name, "Edit") == 0)
|
|
||||||
{
|
if (stricmp(name, "Edit") == 0) switch(wparam)
|
||||||
KEY key;
|
|
||||||
switch(wparam)
|
|
||||||
{
|
{
|
||||||
case VK_PRIOR:
|
case VK_PRIOR:
|
||||||
key = K_PREV; break;
|
key = K_PREV; break;
|
||||||
@ -181,11 +235,17 @@ static BOOLEAN event_hook(HWND hwnd,
|
|||||||
default:
|
default:
|
||||||
key = 0; break;
|
key = 0; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wparam == VK_F1)
|
||||||
|
key = K_F1;
|
||||||
|
|
||||||
if (key > 0)
|
if (key > 0)
|
||||||
{
|
{
|
||||||
WINDOW w = cur_win();
|
WINDOW w = cur_win();
|
||||||
if (w != NULL_WIN)
|
if (w != NULL_WIN)
|
||||||
|
{
|
||||||
dispatch_e_char(w, key);
|
dispatch_e_char(w, key);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,7 +267,7 @@ static BOOLEAN event_hook(HWND hwnd,
|
|||||||
break;
|
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 (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 (y >= 0) y++;
|
||||||
if (x > 0 || (wt != WO_TE && x == 0))
|
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 width = pc.right;
|
||||||
const int tot = 80*CHARX;
|
const int tot = 80*CHARX;
|
||||||
if (width > tot) x += (width-tot) / (CHARX<<1);
|
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;
|
RCT pc;
|
||||||
if (parent == NULL_WIN) parent = TASK_WIN;
|
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 MAXX = pc.right;
|
||||||
const short MAXY = pc.bottom;
|
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()
|
void beep()
|
||||||
{ xvt_beep(); }
|
{ xvt_scr_beep(); }
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -362,7 +422,7 @@ void TEvent_manager::push(WINDOW w, const EVENT& e)
|
|||||||
_e[_end] = e;
|
_e[_end] = e;
|
||||||
const int next = (_end+1) % MAX;
|
const int next = (_end+1) % MAX;
|
||||||
if (next == _begin)
|
if (next == _begin)
|
||||||
warning_box("Hey %s, clicca piu' piano!", (const char*)main_app().user());
|
warning_box("Hey, clicca piu' piano!");
|
||||||
else
|
else
|
||||||
_end = next;
|
_end = next;
|
||||||
}
|
}
|
||||||
@ -373,13 +433,13 @@ void TEvent_manager::pop()
|
|||||||
{
|
{
|
||||||
const int i = _begin;
|
const int i = _begin;
|
||||||
_begin = (++_begin) % MAX; // Other events may occur!
|
_begin = (++_begin) % MAX; // Other events may occur!
|
||||||
dispatch_event(_w[i], &_e[i]);
|
xvt_win_dispatch_event(_w[i], &_e[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_events()
|
void do_events()
|
||||||
{
|
{
|
||||||
process_events();
|
xvt_app_process_pending_events();
|
||||||
EM.pop();
|
EM.pop();
|
||||||
#if XVT_OS == XVT_OS_SCOUNIX
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
nap(20);
|
nap(20);
|
||||||
@ -426,7 +486,6 @@ void dispatch_e_char(WINDOW win, KEY key)
|
|||||||
EM.push(win, e);
|
EM.push(win, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dispatch_e_scroll(WINDOW win, KEY key)
|
void dispatch_e_scroll(WINDOW win, KEY key)
|
||||||
{
|
{
|
||||||
EVENT e;
|
EVENT e;
|
||||||
@ -484,7 +543,7 @@ void dispatch_e_scroll(WINDOW win, KEY key)
|
|||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (w != SC_NONE) dispatch_event(win, &e);
|
if (w != SC_NONE) xvt_win_dispatch_event(win, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void customize_controls(bool on)
|
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_COLOR = colors.get_color("Focus", NULL, -1, FOCUS_COLOR);
|
||||||
FOCUS_BACK_COLOR = colors.get_color("FocusBack", NULL, -1, FOCUS_BACK_COLOR);
|
FOCUS_BACK_COLOR = colors.get_color("FocusBack", NULL, -1, FOCUS_BACK_COLOR);
|
||||||
|
|
||||||
#if XVTWS == WMWS
|
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
// set_value(NULL_WIN,ATTR_CH_SHADOW,XVT_CH_SHADOW_WINDOW|XVT_CH_SHADOW_DIALOG);
|
#if XVTWS == WMWS
|
||||||
set_value(NULL_WIN, ATTR_CH_TOGGLE_COMBO, (long)K_F9);
|
// 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
|
#endif
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (on)
|
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
||||||
{
|
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||||
set_value(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
||||||
set_value(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
allow_another_instance();
|
||||||
set_value(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
|
||||||
#ifdef __CTL3D__
|
HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||||
HINSTANCE _hInstance = (HINSTANCE)get_value(NULL_WIN, ATTR_WIN_INSTANCE);
|
|
||||||
Ctl3dRegister(_hInstance);
|
Ctl3dRegister(_hInstance);
|
||||||
Ctl3dAutoSubclass(_hInstance);
|
Ctl3dAutoSubclass(_hInstance);
|
||||||
#else
|
|
||||||
MaskColor = COLOR2RGB(MASK_BACK_COLOR);
|
MaskColor = COLOR2RGB(MASK_BACK_COLOR);
|
||||||
MaskBrush = CreateSolidBrush(MaskColor);
|
MaskBrush = CreateSolidBrush(MaskColor);
|
||||||
|
|
||||||
@ -534,27 +591,32 @@ void customize_controls(bool on)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef __CTL3D__
|
#if XVT_OS == XVT_OS_WIN
|
||||||
HINSTANCE _hInstance = (HINSTANCE)get_value(NULL_WIN, ATTR_WIN_INSTANCE);
|
HINSTANCE _hInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||||
Ctl3dUnregister(_hInstance);
|
Ctl3dUnregister(_hInstance);
|
||||||
#else
|
|
||||||
DeleteObject(NormalFont);
|
DeleteObject(NormalFont);
|
||||||
DeleteObject(MaskBrush);
|
DeleteObject(MaskBrush);
|
||||||
DeleteObject(NormalBrush);
|
DeleteObject(NormalBrush);
|
||||||
DeleteObject(FocusBrush);
|
DeleteObject(FocusBrush);
|
||||||
#endif
|
|
||||||
free_controls_bmp();
|
free_controls_bmp();
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
xvt_font_destroy(DEF_FONT);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DBG
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
XVT_FNTID xvt_default_font()
|
||||||
void xvt_init_font()
|
|
||||||
{
|
{
|
||||||
|
if (DEF_FONT == NULL)
|
||||||
|
{
|
||||||
|
DEF_FONT = xvt_dwin_get_font(TASK_WIN);
|
||||||
|
|
||||||
|
#if XVT_OS == XVT_OS_WIN
|
||||||
NormalFont = GetStockObject(ANSI_FIXED_FONT);
|
NormalFont = GetStockObject(ANSI_FIXED_FONT);
|
||||||
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
|
GetObject(NormalFont, sizeof(LOGFONT), &LogFont);
|
||||||
|
|
||||||
@ -563,26 +625,44 @@ void xvt_init_font()
|
|||||||
if (CHARY > 0)
|
if (CHARY > 0)
|
||||||
{
|
{
|
||||||
LogFont.lfHeight = CHARY;
|
LogFont.lfHeight = CHARY;
|
||||||
LogFont.lfWidth = (int)font.get_long("Width");
|
LogFont.lfWeight = FontWeight = font.get_int("Weight");
|
||||||
LogFont.lfWeight = FontWeight = (int)font.get_long("Weight");
|
LogFont.lfPitchAndFamily = font.get_int("Pitch");
|
||||||
LogFont.lfCharSet = (int)font.get_long("CharSet");
|
|
||||||
LogFont.lfPitchAndFamily = (int)font.get_long("Pitch");
|
|
||||||
strcpy(LogFont.lfFaceName, font.get("Name"));
|
strcpy(LogFont.lfFaceName, font.get("Name"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogFont.lfHeight = CHARY = 10;
|
LogFont.lfHeight = CHARY = 10;
|
||||||
FontWeight = 400;
|
FontWeight = 300; // Normal weight
|
||||||
}
|
}
|
||||||
NormalFont = CreateFontIndirect(&LogFont);
|
NormalFont = CreateFontIndirect(&LogFont);
|
||||||
xvt_set_font(TASK_WIN, FF_FIXED, 0);
|
|
||||||
|
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
|
// Get true text size
|
||||||
TEXTMETRIC tm;
|
TEXTMETRIC tm;
|
||||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
HWND hdc = (HDC)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_GRAPHIC_CONTEXT);
|
||||||
HDC hdc = GetDC(hwnd);
|
|
||||||
GetTextMetrics(hdc, &tm);
|
GetTextMetrics(hdc, &tm);
|
||||||
ReleaseDC(hwnd, hdc);
|
|
||||||
|
|
||||||
const int COLX = GetSystemMetrics(SM_CXSCREEN) / 80;
|
const int COLX = GetSystemMetrics(SM_CXSCREEN) / 80;
|
||||||
CHARX = tm.tmAveCharWidth+1;
|
CHARX = tm.tmAveCharWidth+1;
|
||||||
@ -591,29 +671,26 @@ void xvt_init_font()
|
|||||||
CHARY = tm.tmHeight;
|
CHARY = tm.tmHeight;
|
||||||
BASEY = tm.tmAscent;
|
BASEY = tm.tmAscent;
|
||||||
if (CHARY > ROWY-2) CHARY = ROWY-2;
|
if (CHARY > ROWY-2) CHARY = ROWY-2;
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void xvt_set_font(WINDOW win, int 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
|
#endif
|
||||||
|
|
||||||
FONT font;
|
return DEF_FONT;
|
||||||
select_font(family, style, dim < 1 ? CHARY : dim, &font);
|
}
|
||||||
win_set_font(win, &font, FALSE);
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
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,7 +706,7 @@ WINDOW xvt_create_window(WIN_TYPE wt,
|
|||||||
RCT& rect = resize_rect(x, y, dx, dy, wt, parent);
|
RCT& rect = resize_rect(x, y, dx, dy, wt, parent);
|
||||||
|
|
||||||
if (wt == WD_MODAL) wt = W_DOC;
|
if (wt == WD_MODAL) wt = W_DOC;
|
||||||
WINDOW win = create_window(wt,
|
WINDOW win = xvt_win_create(wt,
|
||||||
&rect,
|
&rect,
|
||||||
(char*)caption,
|
(char*)caption,
|
||||||
menu, parent,
|
menu, parent,
|
||||||
@ -637,11 +714,11 @@ WINDOW xvt_create_window(WIN_TYPE wt,
|
|||||||
EM_ALL, eh,
|
EM_ALL, eh,
|
||||||
app_data);
|
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
|
#if XVT_OS == XVT_OS_WIN
|
||||||
static bool to_set = TRUE;
|
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)
|
if (to_set)
|
||||||
{
|
{
|
||||||
word style = GetClassWord(hwnd, GCW_STYLE);
|
word style = GetClassWord(hwnd, GCW_STYLE);
|
||||||
@ -715,11 +792,11 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (*caption == '@') caption += 2;
|
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);
|
flags, app_data, id);
|
||||||
|
|
||||||
if (win == NULL_WIN)
|
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)
|
if (wt == WC_EDIT || wt == WC_LISTBUTTON)
|
||||||
#endif
|
#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);
|
SendMessage(hwnd, WM_SETFONT, NormalFont, FALSE);
|
||||||
if (_bandiere & CTL_FLAG_MAC_MONACO9)
|
if (_bandiere & CTL_FLAG_MAC_MONACO9)
|
||||||
SendMessage(hwnd, EM_SETPASSWORDCHAR, (WORD)'#', 0);
|
SendMessage(hwnd, EM_SETPASSWORDCHAR, (WORD)'#', 0);
|
||||||
#ifdef DBG
|
|
||||||
DWORD stylecheck = GetWindowLong(hwnd, GWL_STYLE);
|
|
||||||
stylecheck |= 0;
|
|
||||||
#endif
|
|
||||||
#ifdef __CTL3D__
|
#ifdef __CTL3D__
|
||||||
Ctl3dSubclassCtl(hwnd);
|
Ctl3dSubclassCtl(hwnd);
|
||||||
#endif
|
#endif
|
||||||
@ -754,7 +827,7 @@ const char* xvt_get_title(WINDOW win)
|
|||||||
const TControl* c = TControl::WINDOW2TControl(win);
|
const TControl* c = TControl::WINDOW2TControl(win);
|
||||||
return c->caption();
|
return c->caption();
|
||||||
#else
|
#else
|
||||||
get_title(win, __tmp_string, 80);
|
xvt_vobj_get_title(win, __tmp_string, 80);
|
||||||
return __tmp_string;
|
return __tmp_string;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -765,7 +838,7 @@ void xvt_set_title(WINDOW win, const char* cap)
|
|||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
c->set_caption(cap);
|
c->set_caption(cap);
|
||||||
#else
|
#else
|
||||||
set_title(win, cap);
|
xvt_vobj_set_title(win, cap);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,7 +849,7 @@ void xvt_set_front_control(WINDOW win)
|
|||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
c->focus(TRUE);
|
c->focus(TRUE);
|
||||||
#endif
|
#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);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
c->enable(on);
|
c->enable(on);
|
||||||
#else
|
#else
|
||||||
enable_window(win, on);
|
xvt_vobj_set_enabled(win, on);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,7 +870,7 @@ void xvt_check_box(WINDOW win, bool on)
|
|||||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||||
c->check(on);
|
c->check(on);
|
||||||
#else
|
#else
|
||||||
win_check_box(win, on);
|
xvt_ctl_set_checked(win, on);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,7 +881,7 @@ bool xvt_get_checked_state(WINDOW win)
|
|||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
return c->checked();
|
return c->checked();
|
||||||
#else
|
#else
|
||||||
return get_checked_state(win) ? TRUE : FALSE;
|
return xvt_ctl_is_checked(win) ? TRUE : FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,7 +892,7 @@ void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
|||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
xvt_check_box(ctls[i], ctls[i] == win);
|
xvt_check_box(ctls[i], ctls[i] == win);
|
||||||
#else
|
#else
|
||||||
win_check_radio_button(win, (WINDOW*)ctls, count);
|
xvt_ctl_check_radio_button(win, (WINDOW*)ctls, count);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -841,11 +914,11 @@ int xvt_get_checked_radio(const WINDOW* ctls, int count)
|
|||||||
// Gestione Status bar
|
// Gestione Status bar
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HIDDEN WINDOW statbar = NULL_WIN;
|
HIDDEN WINDOW _statbar = NULL_WIN;
|
||||||
|
|
||||||
WINDOW xvt_create_statbar()
|
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
|
#if XVT_OS == XVT_OS_WIN
|
||||||
const int prop_count = 4;
|
const int prop_count = 4;
|
||||||
@ -858,15 +931,15 @@ WINDOW xvt_create_statbar()
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
|
_statbar = statbar_create(0, 0, 600, 1024, 800, prop_count, prop_list,
|
||||||
TASK_WIN, 0, 0, "");
|
TASK_WIN, 0, 0, "");
|
||||||
|
CHECK(_statbar, "Can't create the status bar");
|
||||||
|
|
||||||
|
statbar_set_fontid(_statbar, xvt_default_font());
|
||||||
|
|
||||||
xvt_init_font();
|
|
||||||
DRAW_CTOOLS ct; win_get_draw_ctools(TASK_WIN, &ct);
|
|
||||||
statbar_set_font(statbar, &ct.font);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return statbar;
|
return _statbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_statbar_set(const char* text, bool def)
|
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);
|
TString256 t(text);
|
||||||
t << '\t' << oggi.string() << " - " << main_app().title();
|
t << '\t' << oggi.string() << " - " << main_app().title();
|
||||||
if (def)
|
if (def)
|
||||||
statbar_set_default_title(statbar, (char*)(const char*)t);
|
statbar_set_default_title(_statbar, (char*)(const char*)t);
|
||||||
statbar_set_title(statbar, (char*)(const char*)t);
|
statbar_set_title(_statbar, (char*)(const char*)t);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void xvt_statbar_refresh()
|
void xvt_statbar_refresh()
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
statbar_set_title(statbar, NULL);
|
statbar_set_title(_statbar, NULL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -910,9 +983,9 @@ HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag)
|
|||||||
|
|
||||||
bool xvt_test_menu_tag(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);
|
const bool ok = test_menu_tag(mi, tag);
|
||||||
menu_free(mi);
|
xvt_res_free_menu_tree(mi);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,39 +995,63 @@ bool xvt_test_menu_tag(MENU_TAG tag)
|
|||||||
|
|
||||||
COLOR trans_color(char c)
|
COLOR trans_color(char c)
|
||||||
{
|
{
|
||||||
|
COLOR col;
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
case 'n': return COLOR_BLACK; break;
|
case 'b':
|
||||||
case 'r': return COLOR_RED; break;
|
col = COLOR_BLUE; break;
|
||||||
case 'g': return COLOR_GREEN; break;
|
case 'c':
|
||||||
case 'b': return COLOR_BLUE; break;
|
col = COLOR_CYAN; break;
|
||||||
case 'c': return COLOR_CYAN; break;
|
case 'd':
|
||||||
case 'y': return COLOR_YELLOW; break;
|
col = COLOR_DKGRAY; break;
|
||||||
case 'v': return COLOR_MAGENTA; break;
|
case 'g':
|
||||||
case 'w': return COLOR_WHITE; break;
|
col = COLOR_GREEN; break;
|
||||||
case 'm': return MASK_BACK_COLOR; break;
|
case 'k':
|
||||||
case 'd': return COLOR_DKGRAY; break;
|
col = COLOR_GRAY; break;
|
||||||
case 'l': return COLOR_LTGRAY; break;
|
case 'l':
|
||||||
case 'k': return COLOR_GRAY; break;
|
col = COLOR_LTGRAY; break;
|
||||||
default: CHECK(0,"trans_color: Undefined color"); 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 -1;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
PAT_STYLE trans_brush(char p)
|
PAT_STYLE trans_brush(char p)
|
||||||
{
|
{
|
||||||
switch (p)
|
switch (p)
|
||||||
{
|
{
|
||||||
case 'n' : return PAT_NONE; break;
|
case 'n' :
|
||||||
case 'h' : return PAT_HOLLOW; break;
|
return PAT_NONE; break;
|
||||||
case 's' : return PAT_SOLID; break;
|
case 'h' :
|
||||||
case '-' : return PAT_HORZ; break;
|
return PAT_HOLLOW; break;
|
||||||
case '|' : return PAT_VERT; break;
|
case 's' :
|
||||||
case '/' : return PAT_FDIAG; break;
|
return PAT_SOLID; break;
|
||||||
case '\\': return PAT_BDIAG; break;
|
case '-' :
|
||||||
case 'X' : return PAT_DIAGCROSS; break;
|
return PAT_HORZ; break;
|
||||||
case '+' : return PAT_CROSS; break;
|
case '|' :
|
||||||
default : CHECK(0,"trans_brush: Undefined pattern"); break;
|
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;
|
return PAT_NONE;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ WINDOW xvt_create_window
|
|||||||
void dispatch_e_char(WINDOW win, KEY key);
|
void dispatch_e_char(WINDOW win, KEY key);
|
||||||
void dispatch_e_scroll(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);
|
void xvt_set_front_control(WINDOW win);
|
||||||
const char* xvt_get_title(WINDOW win);
|
const char* xvt_get_title(WINDOW win);
|
||||||
void xvt_set_title(WINDOW win, const char* title);
|
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);
|
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count);
|
||||||
int xvt_get_checked_radio(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);
|
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);
|
bool xvt_test_menu_tag(MENU_TAG tag);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user