Potenziamento degli sheet: riconoscono numeri romani e allineamenti a destra.
Gli operatori left, mid, sub e right delle stringhe ritornano un TString&. Corretta la relapp nel caso di ripensamento dopo aver premuto Annulla o Fine. git-svn-id: svn://10.65.10.50/trunk@302 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
12dd4aadd3
commit
5df8cfc13b
@ -79,7 +79,6 @@ HIDDEN void create_backdrop( void )
|
|||||||
|
|
||||||
class TBanner : public TWindow
|
class TBanner : public TWindow
|
||||||
{
|
{
|
||||||
enum { FONT_SIZE = 28 };
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handler(WINDOW win, EVENT* ep);
|
virtual void handler(WINDOW win, EVENT* ep);
|
||||||
|
|
||||||
@ -90,7 +89,7 @@ public:
|
|||||||
|
|
||||||
TBanner::TBanner()
|
TBanner::TBanner()
|
||||||
{
|
{
|
||||||
create(-1, 2, 72, 6, "BANNER", WSF_NONE, W_PLAIN);
|
create(-1, 6, 72, 6, "BANNER", WSF_NONE, W_PLAIN);
|
||||||
hide_brush();
|
hide_brush();
|
||||||
open_modal();
|
open_modal();
|
||||||
do_events();
|
do_events();
|
||||||
@ -109,7 +108,7 @@ void TBanner::handler(WINDOW win, EVENT* ep)
|
|||||||
RCT r; get_client_rect(win, &r);
|
RCT r; 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, FONT_SIZE);
|
set_font(FF_TIMES, FS_BOLD | FS_ITALIC, CHARY<<1);
|
||||||
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 = win_get_text_width(win, t, -1);
|
||||||
int x = (r.right-r.left-w)>>1, y = r.bottom - 4*CHARY;
|
int x = (r.right-r.left-w)>>1, y = r.bottom - 4*CHARY;
|
||||||
@ -186,11 +185,13 @@ void TApplication::wait_for(const char* command)
|
|||||||
TTemp_window tw(TASK_WIN);
|
TTemp_window tw(TASK_WIN);
|
||||||
tw.iconize();
|
tw.iconize();
|
||||||
name2id(cmd2name(command));
|
name2id(cmd2name(command));
|
||||||
|
|
||||||
|
const long old_hook = get_value(TASK_WIN, ATTR_EVENT_HOOK);
|
||||||
set_value(TASK_WIN, ATTR_EVENT_HOOK, (long)waiting_event_hook);
|
set_value(TASK_WIN, ATTR_EVENT_HOOK, (long)waiting_event_hook);
|
||||||
while (waiting_for) do_events();
|
while (waiting_for) do_events();
|
||||||
|
|
||||||
// We need to restore these things
|
// We need to restore these things
|
||||||
customize_controls(TRUE);
|
set_value(TASK_WIN, ATTR_EVENT_HOOK, old_hook);
|
||||||
xvt_statbar_refresh();
|
xvt_statbar_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +426,7 @@ void TApplication::about() const
|
|||||||
{
|
{
|
||||||
#include <prassi.ver>
|
#include <prassi.ver>
|
||||||
const TFilename n(__argv[0]);
|
const TFilename n(__argv[0]);
|
||||||
message_box("PRASSI Versione SMAU 1.%g\nProgramma %s\nLibreria del %s",
|
message_box("PRASSI Versione Beta %3.1f\nProgramma %s\nLibreria del %s",
|
||||||
VERSION, (const char*)n.name(), __DATE__);
|
VERSION, (const char*)n.name(), __DATE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +759,11 @@ void TTag_button::update() const
|
|||||||
win_draw_rect(_hdc, &r);
|
win_draw_rect(_hdc, &r);
|
||||||
|
|
||||||
if (i == _page)
|
if (i == _page)
|
||||||
xvt_draw_rect(_hdc, r, COLOR_CYAN, COLOR_GRAY);
|
#ifdef __CTL3D__
|
||||||
|
xvt_draw_rect(_hdc, r, COLOR_WHITE, COLOR_GRAY);
|
||||||
|
#else
|
||||||
|
xvt_draw_rect(_hdc, r, COLOR_CYAN, COLOR_GRAY);
|
||||||
|
#endif
|
||||||
|
|
||||||
char n[4]; sprintf(n, "%d", i+1);
|
char n[4]; sprintf(n, "%d", i+1);
|
||||||
win_draw_text(_hdc, (width-CHARX)/2 + i*width, CHARY-3, n, -1);
|
win_draw_text(_hdc, (width-CHARX)/2 + i*width, CHARY-3, n, -1);
|
||||||
@ -769,7 +773,11 @@ void TTag_button::update() const
|
|||||||
pen.width = 1;
|
pen.width = 1;
|
||||||
pen.pat = PAT_SOLID;
|
pen.pat = PAT_SOLID;
|
||||||
pen.style = P_SOLID;
|
pen.style = P_SOLID;
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
pen.color = COLOR_WHITE;
|
||||||
|
#else
|
||||||
pen.color = COLOR_CYAN;
|
pen.color = COLOR_CYAN;
|
||||||
|
#endif
|
||||||
win_set_cpen(_hdc, &pen);
|
win_set_cpen(_hdc, &pen);
|
||||||
|
|
||||||
PNT p = { _client.bottom, 0 };
|
PNT p = { _client.bottom, 0 };
|
||||||
|
@ -174,12 +174,18 @@ const char* TBaseisamfile::name() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char* TBaseisamfile::filename() const
|
const char* TBaseisamfile::filename() const
|
||||||
|
|
||||||
{
|
{
|
||||||
NOT_OPEN(name());
|
NOT_OPEN(name());
|
||||||
return _isamfile->d->SysName;
|
return _isamfile->d->SysName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* TBaseisamfile::description() const
|
||||||
|
{
|
||||||
|
NOT_OPEN(name());
|
||||||
|
return _isamfile->d->Des;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TBaseisamfile::setkey(int nkey)
|
void TBaseisamfile::setkey(int nkey)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -234,7 +234,8 @@ public:
|
|||||||
bool good() const { return status() == NOERR;} // Vero se _lasterr non contiene codici d'errore
|
bool good() const { return status() == NOERR;} // Vero se _lasterr non contiene codici d'errore
|
||||||
bool bad() const { return status() != NOERR;} // Vero se _lasterr contiene codici d'errore
|
bool bad() const { return status() != NOERR;} // Vero se _lasterr contiene codici d'errore
|
||||||
bool empty(); // Vero se il file e' vuoto
|
bool empty(); // Vero se il file e' vuoto
|
||||||
int num() const { return _logicnum;} // Ritorna il numero logico del record corrente
|
int num() const { return _logicnum;} // Ritorna il numero logico del record corrente
|
||||||
|
const char* description() const;
|
||||||
TRecnotype eod() const { return filehnd()->d->EOD;}
|
TRecnotype eod() const { return filehnd()->d->EOD;}
|
||||||
|
|
||||||
isdef* filehnd() const { return (isdef*) _isamfile;} // Ritorna l'handle del file isam nella tabella
|
isdef* filehnd() const { return (isdef*) _isamfile;} // Ritorna l'handle del file isam nella tabella
|
||||||
|
@ -95,16 +95,6 @@ void TMask::control_handler(EVENT* ep)
|
|||||||
{
|
{
|
||||||
if (ep->v.ctl.ci.v.edit.active)
|
if (ep->v.ctl.ci.v.edit.active)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
TMask_field& old = fld(_focus);
|
|
||||||
if (old.dlg() != f->dlg() && old.on_key(K_TAB) == FALSE)
|
|
||||||
set_focus_win(old.win(), TRUE);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
set_focus_win(win, FALSE);
|
|
||||||
f->set_focusdirty(FALSE);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (test_focus_change(win))
|
if (test_focus_change(win))
|
||||||
{
|
{
|
||||||
set_focus_win(win, FALSE);
|
set_focus_win(win, FALSE);
|
||||||
@ -128,7 +118,11 @@ void TMask::handler(WINDOW win, EVENT* ep)
|
|||||||
{
|
{
|
||||||
clear_window(win, MASK_BACK_COLOR);
|
clear_window(win, MASK_BACK_COLOR);
|
||||||
RCT r; get_client_rect(win, &r);
|
RCT r; get_client_rect(win, &r);
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
xvt_draw_rect(win, r, COLOR_WHITE, COLOR_GRAY, 1);
|
||||||
|
#else
|
||||||
xvt_draw_rect(win, r, COLOR_CYAN, COLOR_GRAY, 1);
|
xvt_draw_rect(win, r, COLOR_CYAN, COLOR_GRAY, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else clear_window(win, COLOR_GRAY);
|
else clear_window(win, COLOR_GRAY);
|
||||||
#else
|
#else
|
||||||
@ -699,9 +693,9 @@ bool TMask::stop_run(KEY key)
|
|||||||
{
|
{
|
||||||
const bool ok = check_fields();
|
const bool ok = check_fields();
|
||||||
if (!ok) return FALSE;
|
if (!ok) return FALSE;
|
||||||
if (is_running()) // Gestisce correttamenete le maschere chiuse
|
|
||||||
get_mask_fields();
|
|
||||||
}
|
}
|
||||||
|
if (is_running()) // Gestisce correttamenete le maschere chiuse
|
||||||
|
get_mask_fields();
|
||||||
|
|
||||||
return TWindow::stop_run(key);
|
return TWindow::stop_run(key);
|
||||||
}
|
}
|
||||||
@ -865,21 +859,23 @@ int TMask::find_first_field(WINDOW w, int dir) const
|
|||||||
|
|
||||||
bool TMask::check_current_page()
|
bool TMask::check_current_page()
|
||||||
{
|
{
|
||||||
if (!test_focus_change())
|
/*
|
||||||
return FALSE;
|
if (!test_focus_change())
|
||||||
|
return FALSE;
|
||||||
if (sheets() > 0)
|
|
||||||
return TRUE;
|
if (sheets() > 0)
|
||||||
|
return TRUE;
|
||||||
const int last = fields();
|
|
||||||
const WINDOW page = win();
|
const int last = fields();
|
||||||
|
const WINDOW page = win();
|
||||||
for (int i = 0; i < last; i++)
|
|
||||||
{
|
for (int i = 0; i < last; i++)
|
||||||
TMask_field& f = fld(i);
|
{
|
||||||
if (f.parent() == page && f.active() && f.on_key(K_ENTER) == FALSE)
|
TMask_field& f = fld(i);
|
||||||
return FALSE;
|
if (f.parent() == page && f.active() && f.on_key(K_ENTER) == FALSE)
|
||||||
}
|
return FALSE;
|
||||||
|
}
|
||||||
|
*/
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: maskfld.cpp,v 1.24 1994-09-27 09:55:43 alex Exp $
|
// $Id: maskfld.cpp,v 1.25 1994-10-03 08:47:14 guy Exp $
|
||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
@ -968,14 +968,13 @@ bool TList_sheet::check(CheckTime t)
|
|||||||
// Certified 100%
|
// Certified 100%
|
||||||
TBrowse::TBrowse(TEdit_field* f, TRelation* r, int key, const char* filter)
|
TBrowse::TBrowse(TEdit_field* f, TRelation* r, int key, const char* filter)
|
||||||
: _relation(r), _cursor(new TCursor (r, filter, key)),
|
: _relation(r), _cursor(new TCursor (r, filter, key)),
|
||||||
_fld(f), _filter(filter), _secondary(FALSE),
|
_fld(f), _filter(filter), _secondary(FALSE), _checked(FALSE)
|
||||||
_checked(FALSE)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
TBrowse::TBrowse(TEdit_field* f, TCursor* c)
|
TBrowse::TBrowse(TEdit_field* f, TCursor* c)
|
||||||
: _relation(NULL), _cursor(c), _fld(f)
|
: _relation(NULL), _cursor(c), _fld(f), _secondary(FALSE), _checked(FALSE)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -1237,10 +1236,19 @@ void TBrowse::do_output(CheckTime t)
|
|||||||
if (t != STARTING_CHECK || f.field() == NULL || f.mask().mode() == MODE_INS)
|
if (t != STARTING_CHECK || f.field() == NULL || f.mask().mode() == MODE_INS)
|
||||||
{
|
{
|
||||||
sum.cut(0);
|
sum.cut(0);
|
||||||
for(const char* fr = flds.get(); fr; fr = flds.get())
|
for(const char* fr = flds.get(0); fr; fr = flds.get())
|
||||||
{
|
{
|
||||||
TFieldref fld(fr, 0);
|
const char* val;
|
||||||
const char* val = fld.read(_cursor->relation());
|
if (*fr == '"')
|
||||||
|
{
|
||||||
|
const TString80 v(fr);
|
||||||
|
val = v.mid(1, v.len()-2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const TFieldref fld(fr, 0);
|
||||||
|
val = fld.read(_cursor->relation());
|
||||||
|
}
|
||||||
sum << val;
|
sum << val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1323,27 +1331,28 @@ TToken_string& TBrowse::create_siblings(TToken_string& siblings)
|
|||||||
return siblings; // Non saprei come fare
|
return siblings; // Non saprei come fare
|
||||||
|
|
||||||
TBit_array key(4); // Elenco delle chiavi gia' utilizzate
|
TBit_array key(4); // Elenco delle chiavi gia' utilizzate
|
||||||
|
key.set(_cursor->key());
|
||||||
|
|
||||||
// Scorre la lista dei campi di output
|
// Scorre la lista dei campi di output
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (const char* i = _out_id.get(0); i; i = _out_id.get(), n++)
|
for (const char* i = _out_id.get(0); i; i = _out_id.get(), n++)
|
||||||
{
|
{
|
||||||
const short id = atoi(i);
|
const short id = _fld->atodlg(i);
|
||||||
const TMask_field& f = mask.field(id);
|
const TMask_field& f = mask.field(id);
|
||||||
if (!f.showed() || !f.is_edit()) // Scarta i campi non editabili
|
if (!f.showed() || !f.is_edit()) // Scarta i campi non editabili
|
||||||
continue;
|
continue;
|
||||||
const TEdit_field& e = (const TEdit_field&)f;
|
const TEdit_field& e = (const TEdit_field&)f;
|
||||||
const TBrowse* b = e.browse();
|
const TBrowse* b = e.browse();
|
||||||
if (b == NULL)
|
if (b == NULL)
|
||||||
continue; // Scarta i campi senza ricerca (improbabile)
|
continue; // Scarta i campi senza ricerca
|
||||||
|
|
||||||
const TCursor* c = b->cursor();
|
const TCursor* c = b->cursor();
|
||||||
|
|
||||||
// Considera ricerche sullo stesso file ma con chiave diversa
|
// Considera ricerche sullo stesso file ma con chiave diversa
|
||||||
if (c && c->file().num() == _cursor->file().num() &&
|
if (c && c->file().num() == _cursor->file().num() &&
|
||||||
key[c->key()] == FALSE)
|
(key[c->key()] == FALSE || id == _fld->dlg()))
|
||||||
{
|
{
|
||||||
const TString16 fn(_out_fn.get(n)); // Legge nome del campo su file
|
const TString16 fn(_out_fn.get(n)); // Legge nome del campo su file
|
||||||
const int pos = _items.get_pos(fn); // Determina header corrispondente
|
const int pos = _items.get_pos(fn); // Determina header corrispondente
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
{
|
{
|
||||||
@ -1366,8 +1375,23 @@ KEY TBrowse::run()
|
|||||||
do_input(TRUE);
|
do_input(TRUE);
|
||||||
_cursor->read();
|
_cursor->read();
|
||||||
|
|
||||||
const char* caption = field().prompt();
|
TString80 caption;
|
||||||
if (!isalnum(*caption)) caption = "Selezione";
|
const TLocalisamfile& f = _cursor->file();
|
||||||
|
if (f.tab())
|
||||||
|
{
|
||||||
|
TFilename name("batb");
|
||||||
|
if (f.num() == LF_TABCOM) name << '%';
|
||||||
|
name << _cursor->file().name() << ".msk";
|
||||||
|
TScanner m(name.lower());
|
||||||
|
while (m.line().left(2) != "PA"); // Find PAGE
|
||||||
|
const int apicia = m.token().find('"')+1;
|
||||||
|
const int apicic = m.token().find('"', apicia);
|
||||||
|
caption = m.token().sub(apicia, apicic);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
caption = f.description();
|
||||||
|
if (!isalnum(*caption))
|
||||||
|
caption = "Selezione";
|
||||||
|
|
||||||
KEY k = K_ESC;
|
KEY k = K_ESC;
|
||||||
long selected = 0;
|
long selected = 0;
|
||||||
@ -1410,7 +1434,7 @@ bool TBrowse::check(CheckTime t)
|
|||||||
{
|
{
|
||||||
bool passed = TRUE;
|
bool passed = TRUE;
|
||||||
|
|
||||||
if (_secondary && t != RUNNING_CHECK)
|
if (_secondary == TRUE && t != RUNNING_CHECK)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
// if (_checked && t == FINAL_CHECK)
|
// if (_checked && t == FINAL_CHECK)
|
||||||
// return TRUE;
|
// return TRUE;
|
||||||
@ -1500,12 +1524,13 @@ void TEdit_field::show(bool on)
|
|||||||
void TEdit_field::parse_head(TScanner& scanner)
|
void TEdit_field::parse_head(TScanner& scanner)
|
||||||
{
|
{
|
||||||
_size = scanner.integer();
|
_size = scanner.integer();
|
||||||
|
#ifdef DBG
|
||||||
if (_size < 1)
|
if (_size < 1)
|
||||||
{
|
{
|
||||||
_size = 8;
|
_size = 8;
|
||||||
error_box("Il campo %d ha dimensione nulla (uso %d)", dlg(), _size);
|
yesnofatal_box("Il campo %d ha dimensione nulla (uso %d)", dlg(), _size);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
_width = scanner.integer();
|
_width = scanner.integer();
|
||||||
if (_width == 0) _width = _size;
|
if (_width == 0) _width = _size;
|
||||||
}
|
}
|
||||||
@ -1514,19 +1539,12 @@ void TEdit_field::parse_head(TScanner& scanner)
|
|||||||
const TBrowse* TEdit_field::get_browse(TScanner& scanner) const
|
const TBrowse* TEdit_field::get_browse(TScanner& scanner) const
|
||||||
{
|
{
|
||||||
const int id = scanner.integer();
|
const int id = scanner.integer();
|
||||||
TMask_field& m = mask().field(id);
|
const TEdit_field& f = mask().efield(id);
|
||||||
if (!m.is_edit())
|
const TBrowse* b = (const TBrowse*)f.browse();
|
||||||
{
|
#ifdef DBG
|
||||||
error_box("Il campo %d non puo' fare una COPY del campo %d",
|
|
||||||
dlg(), id);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
TEdit_field& f = (TEdit_field&)m ;
|
|
||||||
TBrowse* b = (TBrowse*) f.browse();
|
|
||||||
if (b == NULL)
|
if (b == NULL)
|
||||||
error_box("La USE del campo %d non puo' essere copiata da %d",
|
error_box("La USE del campo %d non puo' essere copiata nel campo %d", id, dlg());
|
||||||
id, dlg());
|
#endif
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1536,6 +1554,11 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
if (scanner.key() == "PI") // PICTURE
|
if (scanner.key() == "PI") // PICTURE
|
||||||
{
|
{
|
||||||
_picture = scanner.string();
|
_picture = scanner.string();
|
||||||
|
#ifdef DBG
|
||||||
|
if (_picture == "." && _size > 9 && _size != 15)
|
||||||
|
::warning_box("Guy propone una dimensione di 15 per il campo %d: %s\nMa probabilmente ha toppato ...",
|
||||||
|
dlg(), (const char*)_prompt);
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1551,9 +1574,11 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
|
|
||||||
if (scanner.key() == "US") // USE
|
if (scanner.key() == "US") // USE
|
||||||
{
|
{
|
||||||
|
#ifdef DBG
|
||||||
if (_browse != NULL)
|
if (_browse != NULL)
|
||||||
return error_box("USE duplicata nel campo %d", dlg());
|
return error_box("USE duplicata nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
|
|
||||||
int key = 1;
|
int key = 1;
|
||||||
TRelation* r;
|
TRelation* r;
|
||||||
|
|
||||||
@ -1565,20 +1590,24 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
tabmaskname = scanner.pop();
|
tabmaskname = scanner.pop();
|
||||||
|
#ifdef DBG
|
||||||
if (tabmaskname.len() > 4)
|
if (tabmaskname.len() > 4)
|
||||||
return error_box("'%s' non e' una tabella valida: %d",
|
return error_box("'%s' non e' una tabella valida: %d",
|
||||||
(const char*)tabmaskname, dlg());
|
(const char*)tabmaskname, dlg());
|
||||||
|
#endif
|
||||||
r = new TRelation(tabmaskname);
|
r = new TRelation(tabmaskname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanner.popkey() == "KE")
|
if (scanner.popkey() == "KE")
|
||||||
{
|
{
|
||||||
key = scanner.integer();
|
key = scanner.integer();
|
||||||
|
#ifdef DBG
|
||||||
if (key < 1)
|
if (key < 1)
|
||||||
{
|
{
|
||||||
error_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;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else scanner.push();
|
else scanner.push();
|
||||||
|
|
||||||
@ -1607,10 +1636,8 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
const TString16 what(scanner.popkey());
|
const TString16 what(scanner.popkey());
|
||||||
|
|
||||||
const TBrowse* b = get_browse(scanner);
|
const TBrowse* b = get_browse(scanner);
|
||||||
#ifdef DBG
|
if (b == NULL) return FALSE;
|
||||||
if (b == NULL)
|
|
||||||
return yesnofatal_box("Impossibile COPYare la browse nel campo %d", dlg());
|
|
||||||
#endif
|
|
||||||
if (what == "US" || what == "AL")
|
if (what == "US" || what == "AL")
|
||||||
_browse = new TBrowse(this, b->cursor());
|
_browse = new TBrowse(this, b->cursor());
|
||||||
|
|
||||||
@ -1633,15 +1660,18 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
|
|
||||||
if (scanner.key() == "SH") // SHEET
|
if (scanner.key() == "SH") // SHEET
|
||||||
{
|
{
|
||||||
|
#ifdef DBG
|
||||||
if (_sheet) return error_box("SHEET duplicato nel campo %d", dlg());
|
if (_sheet) return error_box("SHEET duplicato nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
_sheet = new TList_sheet(this, _prompt, scanner.string());
|
_sheet = new TList_sheet(this, _prompt, scanner.string());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanner.key() == "IT") // ITEM
|
if (scanner.key() == "IT") // ITEM
|
||||||
{
|
{
|
||||||
if (_sheet == NULL)
|
#ifdef DBG
|
||||||
return error_box("ITEM senza SHEET nel campo %d", dlg());
|
if (_sheet == NULL) return error_box("ITEM senza SHEET nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
_sheet->read_item(scanner);
|
_sheet->read_item(scanner);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1650,14 +1680,17 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
{
|
{
|
||||||
if (_browse) _browse->parse_input(scanner); else
|
if (_browse) _browse->parse_input(scanner); else
|
||||||
if (_sheet) _sheet->parse_input(scanner);
|
if (_sheet) _sheet->parse_input(scanner);
|
||||||
|
#ifdef DBG
|
||||||
else error_box("INPUT senza USE o SHEET nel campo %d", dlg());
|
else error_box("INPUT senza USE o SHEET nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanner.key() == "DI")
|
if (scanner.key() == "DI")
|
||||||
{
|
{
|
||||||
if(!_browse)
|
#ifdef DBG
|
||||||
return error_box("DISPLAY senza USE nel campo %d", dlg());
|
if(!_browse) return error_box("DISPLAY senza USE nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
_browse->parse_display(scanner);
|
_browse->parse_display(scanner);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1666,13 +1699,17 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
{
|
{
|
||||||
if (_browse) _browse->parse_output(scanner);
|
if (_browse) _browse->parse_output(scanner);
|
||||||
else if (_sheet) _sheet->parse_output(scanner);
|
else if (_sheet) _sheet->parse_output(scanner);
|
||||||
|
#ifdef DBG
|
||||||
else return error_box("OUTPUT senza USE nel campo %d", dlg());
|
else return error_box("OUTPUT senza USE nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanner.key() == "AD")
|
if (scanner.key() == "AD")
|
||||||
{
|
{
|
||||||
|
#ifdef DBG
|
||||||
if(!_browse) return error_box("ADD senza USE nel campo %d", dlg());
|
if(!_browse) return error_box("ADD senza USE nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
_browse->parse_insert(scanner);
|
_browse->parse_insert(scanner);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1681,12 +1718,16 @@ bool TEdit_field::parse_item(TScanner& scanner)
|
|||||||
{
|
{
|
||||||
const char* n = scanner.pop();
|
const char* n = scanner.pop();
|
||||||
_validate_func = isdigit(*n) ? atoi(n) : -1;
|
_validate_func = isdigit(*n) ? atoi(n) : -1;
|
||||||
|
#ifdef DBG
|
||||||
if (_validate_func < 0)
|
if (_validate_func < 0)
|
||||||
return yesnofatal_box("Funzione di validazione '%s' errata nel campo %d", n, dlg());
|
return yesnofatal_box("Funzione di validazione '%s' errata nel campo %d", n, dlg());
|
||||||
|
#endif
|
||||||
|
|
||||||
const int _nparms = scanner.integer();
|
const int _nparms = scanner.integer();
|
||||||
|
#ifdef DBG
|
||||||
if (_nparms < 0)
|
if (_nparms < 0)
|
||||||
return yesnofatal_box("Numero di parametri VALIDATE errato nel campo %d", dlg());
|
return yesnofatal_box("Numero di parametri VALIDATE errato nel campo %d", dlg());
|
||||||
|
#endif
|
||||||
|
|
||||||
for(int i = 0; i < _nparms; i++)
|
for(int i = 0; i < _nparms; i++)
|
||||||
_validate_parms.add(scanner.operand());
|
_validate_parms.add(scanner.operand());
|
||||||
@ -1737,7 +1778,7 @@ void TEdit_field::create(WINDOW parent)
|
|||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
HWND hwnd = (HWND)get_value(win(), ATTR_NATIVE_WINDOW);
|
||||||
SendMessage(hwnd, EM_LIMITTEXT, _size, 0L); // Limita il testo
|
SendMessage(hwnd, EM_LIMITTEXT, _size, 0L); // Limita il testo
|
||||||
long style = GetWindowLong(hwnd, GWL_STYLE);
|
long style = GetWindowLong(hwnd, GWL_STYLE);
|
||||||
if (_flags.uppercase) style != ES_UPPERCASE; // Edit in maiuscolo
|
if (_flags.uppercase) style != ES_UPPERCASE; // Edit in maiuscolo
|
||||||
SetWindowLong(hwnd, GWL_STYLE, style);
|
SetWindowLong(hwnd, GWL_STYLE, style);
|
||||||
|
@ -115,7 +115,7 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
|||||||
{
|
{
|
||||||
const int NUMBER_WIDTH = 3;
|
const int NUMBER_WIDTH = 3;
|
||||||
const int MAX_COL = 32;
|
const int MAX_COL = 32;
|
||||||
int width[MAX_COL];
|
int m_width[MAX_COL], v_width[MAX_COL];
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
@ -127,23 +127,31 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
|||||||
for (const char* h = header.get(); h; h = header.get(), i++)
|
for (const char* h = header.get(); h; h = header.get(), i++)
|
||||||
{
|
{
|
||||||
CHECKD(i < MAX_COL, "Tu meni calumns in scit: ", i);
|
CHECKD(i < MAX_COL, "Tu meni calumns in scit: ", i);
|
||||||
int w;
|
|
||||||
char* at = strchr(h, '@');
|
|
||||||
if (at)
|
|
||||||
{
|
|
||||||
w = atoi(at+1);
|
|
||||||
*at = '\0';
|
|
||||||
} else w = strlen(h);
|
|
||||||
|
|
||||||
width[i] = w+1;
|
|
||||||
|
|
||||||
const int cid = FIRST_FIELD+i; // Column & Field ID
|
const int cid = FIRST_FIELD+i; // Column & Field ID
|
||||||
const TMask_field* f = field(cid); // Field on mask
|
const TMask_field* f = field(cid); // Field on mask
|
||||||
CHECKD(f, "The spreadsheet mask needs ALSO field ", cid);
|
CHECKD(f, "The spreadsheet mask needs ALSO field ", cid);
|
||||||
if (f->has_query()) w += 2;
|
|
||||||
|
|
||||||
tot_width += w;
|
TString80 testa(h);
|
||||||
new_header.add(h);
|
const int at = testa.find('@');
|
||||||
|
int m, v;
|
||||||
|
if (at >= 0)
|
||||||
|
{
|
||||||
|
m = atoi(testa.mid(at+1));
|
||||||
|
testa.cut(at);
|
||||||
|
v = max(at, m+(f->has_query() ? 1 : 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m = testa.len();
|
||||||
|
v = m+(f->has_query() ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_width[i] = m+1; // m = number of allowed chars
|
||||||
|
v_width[i] = v+1; // v = width of column
|
||||||
|
tot_width += v_width[i];
|
||||||
|
|
||||||
|
new_header.add(testa);
|
||||||
}
|
}
|
||||||
_columns = i;
|
_columns = i;
|
||||||
|
|
||||||
@ -192,15 +200,13 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
|||||||
{
|
{
|
||||||
const int cid = FIRST_FIELD+i; // Column & Field ID
|
const int cid = FIRST_FIELD+i; // Column & Field ID
|
||||||
const TMask_field* f = field(cid); // Field on mask
|
const TMask_field* f = field(cid); // Field on mask
|
||||||
const int w = width[i] + (f->has_query() ? 2 : 0); // Column width
|
|
||||||
|
|
||||||
long flags = XI_ATR_EDITMENU | XI_ATR_AUTOSCROLL;
|
long flags = XI_ATR_EDITMENU | XI_ATR_AUTOSCROLL;
|
||||||
if (f->class_id() == CLASS_REAL_FIELD) flags |= XI_ATR_RJUST;
|
if (f->class_id() == CLASS_REAL_FIELD) flags |= XI_ATR_RJUST;
|
||||||
if (f->active()) flags |= XI_ATR_ENABLED;
|
if (f->active()) flags |= XI_ATR_ENABLED;
|
||||||
else _column_disabled.set(i);
|
else _column_disabled.set(i);
|
||||||
|
|
||||||
coldef = xi_add_column_def(listdef, cid,
|
coldef = xi_add_column_def(listdef, cid, flags, cid, v_width[i], m_width[i], (char*)h);
|
||||||
flags, cid, w, width[i], (char*)h);
|
|
||||||
coldef->v.column->heading_platform = TRUE;
|
coldef->v.column->heading_platform = TRUE;
|
||||||
coldef->v.column->center_heading = TRUE;
|
coldef->v.column->center_heading = TRUE;
|
||||||
}
|
}
|
||||||
@ -363,14 +369,14 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
|||||||
case XIE_GET_FIRST:
|
case XIE_GET_FIRST:
|
||||||
{
|
{
|
||||||
const long max = items();
|
const long max = items();
|
||||||
if (max <= 0L)
|
if (max > 0L)
|
||||||
{
|
{
|
||||||
xiev->refused = TRUE;
|
long n = max * (long)xiev->v.rec_request.percent / 100L;
|
||||||
break;
|
if (n < 0L) n = 0L;
|
||||||
|
xiev->v.rec_request.data_rec = n;
|
||||||
}
|
}
|
||||||
long n = max * (long)xiev->v.rec_request.percent / 100L;
|
else
|
||||||
if (n < 0L) n = 0L;
|
xiev->refused = TRUE;
|
||||||
xiev->v.rec_request.data_rec = n;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XIE_GET_LAST:
|
case XIE_GET_LAST:
|
||||||
@ -617,10 +623,9 @@ break;
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_ESC:
|
case K_ESC:
|
||||||
case K_CTRL+K_ENTER:
|
|
||||||
{
|
{
|
||||||
const bool ok = (bool)xi_move_focus(_itf);
|
xi_set_focus(_itf);
|
||||||
dispatch_e_char(parent(), k == K_ESC ? K_ESC : K_TAB);
|
dispatch_e_char(parent(), K_ESC);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1030,10 +1035,10 @@ TToken_string& TSheet_field::row(int n)
|
|||||||
|
|
||||||
void TSheet_field::force_update(int r)
|
void TSheet_field::force_update(int r)
|
||||||
{
|
{
|
||||||
#if XVTWS == WMWS
|
#if XVT_OS == XVT_OS_WIN
|
||||||
_sheet->open();
|
|
||||||
#else
|
|
||||||
_sheet->update(r);
|
_sheet->update(r);
|
||||||
|
#else
|
||||||
|
_sheet->open();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
#define VERSION 1.5
|
#define VERSION 1.7
|
||||||
|
@ -227,7 +227,7 @@ char *real ::literals () const
|
|||||||
|
|
||||||
__tmp_real = *this;
|
__tmp_real = *this;
|
||||||
__tmp_real.round (0);
|
__tmp_real.round (0);
|
||||||
TString r (__tmp_real.string (0, 0));
|
TString80 r (__tmp_real.string (0, 0));
|
||||||
const bool negativo = r[0] == '-';
|
const bool negativo = r[0] == '-';
|
||||||
if (negativo)
|
if (negativo)
|
||||||
r.ltrim (1);
|
r.ltrim (1);
|
||||||
@ -235,7 +235,7 @@ char *real ::literals () const
|
|||||||
TFixed_string risultato (__string, 80);
|
TFixed_string risultato (__string, 80);
|
||||||
risultato.cut (0);
|
risultato.cut (0);
|
||||||
|
|
||||||
TString centinaia (16);
|
TString16 centinaia;
|
||||||
|
|
||||||
for (int migliaia = 0;; migliaia++)
|
for (int migliaia = 0;; migliaia++)
|
||||||
{
|
{
|
||||||
@ -319,7 +319,7 @@ char *real ::points (int dec) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HIDDEN int get_picture_decimals (const TString & picture)
|
HIDDEN int get_picture_decimals (const TString& picture)
|
||||||
{
|
{
|
||||||
int decimali = 0;
|
int decimali = 0;
|
||||||
const int virgola = picture.find (',');
|
const int virgola = picture.find (',');
|
||||||
@ -344,8 +344,8 @@ char *real ::string (const char *picture)
|
|||||||
if (strcmp (picture, "LETTERE") == 0)
|
if (strcmp (picture, "LETTERE") == 0)
|
||||||
return literals ();
|
return literals ();
|
||||||
|
|
||||||
TString v (string ());
|
TString80 v (string());
|
||||||
TString f (picture);
|
TString80 f (picture);
|
||||||
|
|
||||||
const int voluti = get_picture_decimals (f);
|
const int voluti = get_picture_decimals (f);
|
||||||
const int virgola = v.find ('.');
|
const int virgola = v.find ('.');
|
||||||
@ -363,7 +363,7 @@ char *real ::string (const char *picture)
|
|||||||
if (strchr ("#@~", z))
|
if (strchr ("#@~", z))
|
||||||
{
|
{
|
||||||
char c = v[j--];
|
char c = v[j--];
|
||||||
if (v[j] == '.')
|
if (j >= 0 && v[j] == '.')
|
||||||
j--;
|
j--;
|
||||||
if (z == '~')
|
if (z == '~')
|
||||||
c = ' ';
|
c = ' ';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: relapp.cpp,v 1.11 1994-09-22 07:48:03 guy Exp $
|
// $Id: relapp.cpp,v 1.12 1994-10-03 08:47:24 guy Exp $
|
||||||
#include <mailbox.h>
|
#include <mailbox.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -568,7 +568,6 @@ bool TRelation_application::save(bool check_dirty)
|
|||||||
}
|
}
|
||||||
if (_mask->last_key() == K_ESC || _mask->last_key() == K_QUIT)
|
if (_mask->last_key() == K_ESC || _mask->last_key() == K_QUIT)
|
||||||
{
|
{
|
||||||
_mask->get_mask_fields();
|
|
||||||
if (!_mask->check_fields()) // Exit with ESC didn't check values
|
if (!_mask->check_fields()) // Exit with ESC didn't check values
|
||||||
{
|
{
|
||||||
_mask->first_focus(-_mask->fld(_mask->focus_field()).dlg());
|
_mask->first_focus(-_mask->fld(_mask->focus_field()).dlg());
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <relation.h>
|
#include <relation.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef __MASK_H
|
#ifndef __MASK_H
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#endif
|
#endif
|
||||||
@ -20,7 +19,7 @@ class TRelation_application : public TApplication
|
|||||||
{
|
{
|
||||||
TMask * _mask;
|
TMask * _mask;
|
||||||
TKey_array* _maskeys;
|
TKey_array* _maskeys;
|
||||||
long _first, _last;
|
TRecnotype _first, _last;
|
||||||
int _search_id;
|
int _search_id;
|
||||||
|
|
||||||
TString _autoins_caller;
|
TString _autoins_caller;
|
||||||
@ -43,50 +42,65 @@ class TRelation_application : public TApplication
|
|||||||
virtual bool main_loop(); // Ciclo principale
|
virtual bool main_loop(); // Ciclo principale
|
||||||
TMask_field* get_search_field() const;
|
TMask_field* get_search_field() const;
|
||||||
|
|
||||||
protected:
|
bool autonum(TMask* m, bool rec);
|
||||||
TLocalisamfile& file() const { return get_relation()->lfile(); }
|
void set_fixed(); // Fissa i campi non modificabili
|
||||||
void set_fixed(); // Fissa i campi non modificabili
|
bool search_mode(); // Attiva la maschera di ricerca
|
||||||
bool search_mode(); // Attiva la maschera di ricerca
|
|
||||||
void query_mode(bool pre_ins = FALSE); // Entra in modo ricerca
|
void query_mode(bool pre_ins = FALSE); // Entra in modo ricerca
|
||||||
bool modify_mode(); // Entra in modo modifica
|
bool modify_mode(); // Entra in modo modifica
|
||||||
void setkey();
|
void setkey();
|
||||||
bool lnflag() const { return _lnflag;}
|
bool lnflag() const { return _lnflag;}
|
||||||
long first() const { return _first;}
|
bool has_filtered_cursor() const { return filtered() || force_cursor_usage();}
|
||||||
long last() const { return _first;}
|
|
||||||
|
protected:
|
||||||
|
TLocalisamfile& file() const { return get_relation()->lfile(); } // File principale della relazione
|
||||||
|
TRecnotype first() const { return _first;}
|
||||||
|
TRecnotype last() const { return _first;}
|
||||||
TMask& curr_mask() const { return *_mask; }
|
TMask& curr_mask() const { return *_mask; }
|
||||||
const TString& autoins_caller() const { return _autoins_caller;}
|
const TString& autoins_caller() const { return _autoins_caller;}
|
||||||
virtual bool menu(MENU_TAG m);
|
virtual bool menu(MENU_TAG m);
|
||||||
|
|
||||||
virtual bool user_create() pure;
|
virtual bool user_create() pure; // Inizializzazione dati utente
|
||||||
virtual bool user_destroy() pure;
|
virtual bool user_destroy() pure; // Distruzione dati utente
|
||||||
virtual TMask* get_mask(int mode) pure;
|
|
||||||
virtual bool changing_mask(int mode) pure;
|
// La richiesta della maschera da utilizzare per ogni fase di lavoro (ricerca, inserimento,
|
||||||
virtual TRelation* get_relation() const pure;
|
// modifica avviene sempre in due tempi: changing_mask e get_mask. Cio' serve per gestire
|
||||||
virtual int read(TMask& m);
|
// Correttamente le applicazioni con mashere multiple. La prima funzione serve a sapere se
|
||||||
virtual int write(const TMask& m);
|
// la futura get_mask ritornera' una maschera diversa dalla corrente.
|
||||||
virtual int rewrite(const TMask& m);
|
virtual bool changing_mask(int mode) pure;
|
||||||
virtual bool remove();
|
virtual TMask* get_mask(int mode) pure; // Richiede la maschera da usare
|
||||||
|
|
||||||
|
virtual TRelation* get_relation() const pure; // Relazione da modificare
|
||||||
|
virtual int read(TMask& m); // Legge dalla relazione i valori nella maschera
|
||||||
|
virtual int write(const TMask& m); // Scrive sulla relazione i valori dalla maschera
|
||||||
|
virtual int rewrite(const TMask& m); // Riscrive sulla relazione i valori dalla maschera
|
||||||
|
virtual bool remove(); // Cancella il record corrente
|
||||||
|
|
||||||
|
// Richiede una stringa nella forma CAMPO1|VALORE1|CAMPO2|VALORE2|...|CAMPOn|VALOREn
|
||||||
|
// contenente le coppie NUMERO_CAMPO_MASCHERA - VALORE_DA_ASSEGNARE che descrivono il
|
||||||
|
// prossimo codice libero da utilizzare per la autonumerazione.
|
||||||
|
// Nel caso di banale numerazione progressiva potrebbe essere implementata come
|
||||||
|
// return format("%d|%s", F_NUM, get_relation()->items());
|
||||||
virtual const char* get_next_key() { return ""; }
|
virtual const char* get_next_key() { return ""; }
|
||||||
|
|
||||||
|
// Richiede se il record corrente e' protetto (non cancellabile)
|
||||||
virtual bool protected_record(TRectype&) { return FALSE; }
|
virtual bool protected_record(TRectype&) { return FALSE; }
|
||||||
virtual void init_query_mode(TMask&) { }
|
|
||||||
|
virtual void init_query_mode(TMask&) { } // Inizializza la maschera per il modo ricerca
|
||||||
virtual void init_query_insert_mode(TMask& m) { init_query_mode(m); }
|
virtual void init_query_insert_mode(TMask& m) { init_query_mode(m); }
|
||||||
virtual void init_insert_mode(TMask&) { }
|
virtual void init_insert_mode(TMask&) { } // Inizializza la maschera per il modo inserimento
|
||||||
virtual void init_modify_mode(TMask&) { }
|
virtual void init_modify_mode(TMask&) { } // Inizializza la maschera per il modo modifica
|
||||||
|
|
||||||
|
virtual bool force_cursor_usage() const { return FALSE;}
|
||||||
virtual void write_enable(const bool on = TRUE) { get_relation()->write_enable(-1, on); }
|
virtual void write_enable(const bool on = TRUE) { get_relation()->write_enable(-1, on); }
|
||||||
void write_disable() { write_enable(FALSE); }
|
void write_disable() { write_enable(FALSE); }
|
||||||
|
|
||||||
bool autonum(TMask* m, bool rec);
|
void set_search_field(short id) { _search_id = id;} // Impone il campo da utilizzare col bottone Ricerca
|
||||||
void set_search_field(short id) { _search_id = id;}
|
|
||||||
bool has_filtered_cursor() const { return filtered() || force_cursor_usage();}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TRelation_application();
|
TRelation_application();
|
||||||
virtual ~TRelation_application();
|
virtual ~TRelation_application();
|
||||||
bool filtered() const { return _fixed.not_empty(); }
|
bool filtered() const { return _fixed.not_empty(); }
|
||||||
void set_first(long first) { _first = first;}
|
|
||||||
void set_last(long last) { _last = last;}
|
|
||||||
bool find(byte key = 0);
|
bool find(byte key = 0);
|
||||||
virtual bool force_cursor_usage() const { return FALSE;}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <printer.h>
|
#include <printer.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
|
#include <utility.h>
|
||||||
|
|
||||||
TSheet::TSheet(short x, short y, short dx, short dy,
|
TSheet::TSheet(short x, short y, short dx, short dy,
|
||||||
const char* title, const char* head, byte buttons,
|
const char* title, const char* head, byte buttons,
|
||||||
@ -26,10 +27,14 @@ TSheet::TSheet(short x, short y, short dx, short dy,
|
|||||||
const int et = item.find('@');
|
const int et = item.find('@');
|
||||||
if (et >= 0)
|
if (et >= 0)
|
||||||
{
|
{
|
||||||
_size[_columns] = atoi(item.mid(et+1));
|
const char t = item.right(1)[0];
|
||||||
|
_type[_columns] = isalpha(t) ? toupper(t) : '\0';
|
||||||
|
const int l = atoi(item.mid(et+1));
|
||||||
item.cut(et);
|
item.cut(et);
|
||||||
if (_columns == 0 && et == 0)
|
if (_columns == 0 && et == 0 && l <= 1)
|
||||||
_checkable = _size[0] == 1;
|
_checkable = _size[0] = 1;
|
||||||
|
else
|
||||||
|
_size[_columns] = l > 0 ? l : item.len();
|
||||||
} else _size[_columns] = item.len();
|
} else _size[_columns] = item.len();
|
||||||
|
|
||||||
item.trim();
|
item.trim();
|
||||||
@ -417,11 +422,26 @@ bool TSheet::update_row(long n)
|
|||||||
for (int j = 0; (s = t.get()) != NULL; x += _size[j++]+1)
|
for (int j = 0; (s = t.get()) != NULL; x += _size[j++]+1)
|
||||||
{
|
{
|
||||||
int x1 = x;
|
int x1 = x;
|
||||||
if (n < 0) // Centra le testate
|
if (n >= 0)
|
||||||
x1 += (_size[j]-strlen(s)) / 2;
|
{
|
||||||
else
|
|
||||||
if (_checkable && j == 0)
|
if (_checkable && j == 0)
|
||||||
s = _checked[n] ? "X" : " ";
|
s = _checked[n] ? "X" : " ";
|
||||||
|
|
||||||
|
switch (_type[j])
|
||||||
|
{
|
||||||
|
case 'R':
|
||||||
|
x1 += _size[j]-strlen(s); // Allinea a destra
|
||||||
|
break;
|
||||||
|
case 'M':
|
||||||
|
s = itor(atoi(s)); // Numeri romani
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
x1 += (_size[j]-strlen(s)) >> 1; // Centra le testate
|
||||||
|
|
||||||
stringat(x1, y, s);
|
stringat(x1, y, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +581,7 @@ TCursor_sheet::TCursor_sheet(TCursor* cursor, const char* fields,
|
|||||||
{
|
{
|
||||||
TToken_string fldlst(fields);
|
TToken_string fldlst(fields);
|
||||||
int campi = 0;
|
int campi = 0;
|
||||||
for (const char* t = fldlst.get(); t; t = fldlst.get(), campi++)
|
for (const char* t = fldlst.get(0); t; t = fldlst.get(), campi++)
|
||||||
if (*t > ' ' && *t != '\"')
|
if (*t > ' ' && *t != '\"')
|
||||||
{
|
{
|
||||||
TFieldref fr(t, 0);
|
TFieldref fr(t, 0);
|
||||||
@ -685,9 +705,9 @@ bool TBrowse_sheet::on_key(KEY k)
|
|||||||
if (alnum || k == K_BACKSPACE || k == K_DEL)
|
if (alnum || k == K_BACKSPACE || k == K_DEL)
|
||||||
{
|
{
|
||||||
const long oldsel = selected();
|
const long oldsel = selected();
|
||||||
const TString old(_field->get());
|
const TString80 old(_field->get());
|
||||||
|
|
||||||
TString val(old.size()+1); val = old;
|
TString80 val((const char*)old);
|
||||||
if (alnum)
|
if (alnum)
|
||||||
{
|
{
|
||||||
if (val.len() >= field().size())
|
if (val.len() >= field().size())
|
||||||
@ -739,7 +759,7 @@ void TBrowse_sheet::handler(WINDOW win, EVENT* ep)
|
|||||||
KEY TBrowse_sheet::run()
|
KEY TBrowse_sheet::run()
|
||||||
{
|
{
|
||||||
const bool spork = field().dirty(); // Store field status
|
const bool spork = field().dirty(); // Store field status
|
||||||
const TString old(field().get());
|
const TString80 old(field().get());
|
||||||
|
|
||||||
const KEY key = TCursor_sheet::run();
|
const KEY key = TCursor_sheet::run();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class TSheet : public TScroll_window
|
|||||||
TArray _page;
|
TArray _page;
|
||||||
|
|
||||||
byte _columns;
|
byte _columns;
|
||||||
byte _size[MAX_COL];
|
byte _size[MAX_COL], _type[MAX_COL];
|
||||||
long _curr, _last_update;
|
long _curr, _last_update;
|
||||||
|
|
||||||
short _visible_rows;
|
short _visible_rows;
|
||||||
|
@ -236,45 +236,45 @@ int TString::find(const char* s, int from) const
|
|||||||
|
|
||||||
|
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
const char* TString::left(int count) const
|
const TString& TString::left(int count) const
|
||||||
{
|
{
|
||||||
spark.strncpy(_str, count);
|
spark.strncpy(_str, count);
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
const char* TString::right(int count) const
|
const TString& TString::right(int count) const
|
||||||
{
|
{
|
||||||
int from = len()-count;
|
int from = len()-count;
|
||||||
if (from < 0) from = 0;
|
if (from < 0) from = 0;
|
||||||
spark = &_str[from];
|
spark = _str + from;
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Certified 90%
|
// Certified 100%
|
||||||
const char* TString::mid(int from, int count) const
|
const TString& TString::mid(int from, int count) const
|
||||||
{
|
{
|
||||||
const int l = len();
|
const int l = len();
|
||||||
|
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
if (from < 0)
|
if (from < 0)
|
||||||
{
|
{
|
||||||
error_box("Ivalid MID parameter: from = %d", from);
|
yesnofatal_box("Ivalid MID parameter: from = %d", from);
|
||||||
from = 0;
|
from = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (from > l) from = l;
|
if (from > l) from = l;
|
||||||
if (count < 1) count = l-from;
|
if (count < 0) count = l-from;
|
||||||
|
|
||||||
spark.strncpy(&_str[from],count);
|
spark.strncpy(&_str[from],count);
|
||||||
return spark;
|
return spark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Certified 100% (uses mid)
|
// Certified 100%
|
||||||
const char* TString::sub(int from, int to) const
|
const TString& TString::sub(int from, int to) const
|
||||||
{
|
{
|
||||||
const int count = to-from;
|
const int count = to-from;
|
||||||
return mid(from, count);
|
return mid(from, count);
|
||||||
@ -283,9 +283,7 @@ const char* TString::sub(int from, int to) const
|
|||||||
// Certified 100%
|
// Certified 100%
|
||||||
TString& TString::cut(int n)
|
TString& TString::cut(int n)
|
||||||
{
|
{
|
||||||
CHECKD(n >= 0, "Can't cut the string at ", n);
|
_str[n] = '\0';
|
||||||
if (n <= size())
|
|
||||||
_str[n] = '\0';
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,7 +402,7 @@ TString& TString::picture(const char* pic, const char* s)
|
|||||||
for (int i = len()-1; i >= 0; i--)
|
for (int i = len()-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
const char k = pic[i];
|
const char k = pic[i];
|
||||||
if (k == '#') _str[i] = (l >= 0) ? s[l--] : ' ';
|
if (k == '#') _str[i] = (l >= 0) ? s[l--] : ' ';
|
||||||
else if (k == '~') { _str[i] = ' '; l--; }
|
else if (k == '~') { _str[i] = ' '; l--; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,9 +463,9 @@ TString& TString::insert(const char* s, int pos)
|
|||||||
{
|
{
|
||||||
const int l = strlen(s);
|
const int l = strlen(s);
|
||||||
make_room(l);
|
make_room(l);
|
||||||
mid(pos); // Scrivi in spark la stringa da pos in poi
|
mid(pos); // Scrivi in spark la stringa da pos in poi
|
||||||
overwrite(s, pos); // Aggiungi s
|
overwrite(s, pos); // Aggiungi s
|
||||||
strcpy(&_str[pos+l], spark); // Aggiungi spark
|
strcpy(&_str[pos+l], spark); // Aggiungi spark
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -504,7 +502,8 @@ TFixed_string::~TFixed_string()
|
|||||||
void TFixed_string::resize(int size, bool)
|
void TFixed_string::resize(int size, bool)
|
||||||
{
|
{
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
fatal_box("Impossibile ridimensionare una stringa fissa da %d a %d", _size, size);
|
fatal_box("Impossibile ridimensionare una stringa fissa da %d a %d caratteri:\n'%s'",
|
||||||
|
_size, size, _str);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +542,7 @@ const char* TFilename::ext() const
|
|||||||
{
|
{
|
||||||
const char* d = strrchr(name(), '.');
|
const char* d = strrchr(name(), '.');
|
||||||
if (d && is_not_slash(*(++d))) return d;
|
if (d && is_not_slash(*(++d))) return d;
|
||||||
return NULL;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 90%
|
// Certified 90%
|
||||||
@ -569,33 +568,46 @@ const char* TFilename::name() const
|
|||||||
|
|
||||||
|
|
||||||
// Certified 70%
|
// Certified 70%
|
||||||
TString& TFilename::tempdir()
|
const TFilename& TFilename::tempdir()
|
||||||
{
|
{
|
||||||
const char* dirpref = getenv("TEMP");
|
const char* dirpref = getenv("TEMP");
|
||||||
if (dirpref == NULL) dirpref = getenv("TMP");
|
if (dirpref == NULL) dirpref = getenv("TMP");
|
||||||
if (dirpref == NULL) dirpref = "/tmp";
|
if (dirpref == NULL) dirpref = "/tmp";
|
||||||
|
|
||||||
if (!fexist(dirpref))
|
|
||||||
#if XVT_OS==XVT_OS_SCOUNIX
|
|
||||||
mkdir(dirpref, 0777);
|
|
||||||
#else
|
|
||||||
mkdir(dirpref);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
set(dirpref);
|
set(dirpref);
|
||||||
|
const int last = len()-1;
|
||||||
|
if (!is_not_slash(_str[last])) cut(last);
|
||||||
|
|
||||||
|
if (!fexist(_str))
|
||||||
|
{
|
||||||
|
int res =
|
||||||
|
#if XVT_OS==XVT_OS_SCOUNIX
|
||||||
|
mkdir(_str, 0777);
|
||||||
|
#else
|
||||||
|
mkdir(_str);
|
||||||
|
#endif
|
||||||
|
if (res == 0)
|
||||||
|
warning_box("E' stata creata la directory per i file temporanei '%s'", _str);
|
||||||
|
else
|
||||||
|
fatal_box("Impossibile creare la directory '%s' per i file temporanei", _str);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Certified 50%
|
// Certified 50%
|
||||||
TString& TFilename::temp(const char* prefix)
|
const TFilename& TFilename::temp(const char* prefix)
|
||||||
{
|
{
|
||||||
const TString dirpref(tempdir());
|
const TFilename dirpref(tempdir());
|
||||||
char* t = NULL;
|
char* t = NULL;
|
||||||
|
|
||||||
|
TString16 est;
|
||||||
|
|
||||||
if (prefix)
|
if (prefix)
|
||||||
{
|
{
|
||||||
set(prefix);
|
set(prefix);
|
||||||
|
est = ext(); // Memorizza eventuale estensione
|
||||||
|
if (est.not_empty()) ext(""); // Toglie " "
|
||||||
|
|
||||||
strip("$#");
|
strip("$#");
|
||||||
t = tempnam((char*)(const char*)dirpref, (char*)_str);
|
t = tempnam((char*)(const char*)dirpref, (char*)_str);
|
||||||
set(t);
|
set(t);
|
||||||
@ -619,6 +631,13 @@ TString& TFilename::temp(const char* prefix)
|
|||||||
set(t);
|
set(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (est.not_empty()) ext(est); // Ripristina estensione
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char* const e = ext();
|
||||||
|
if (e == NULL || *e == '\0') // Aggiunge estensione
|
||||||
|
ext("tmp");
|
||||||
|
}
|
||||||
if (t) free(t);
|
if (t) free(t);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -727,14 +746,14 @@ const char* TToken_string::get(int n)
|
|||||||
// Certified 99%
|
// Certified 99%
|
||||||
char TToken_string::get_char(int n)
|
char TToken_string::get_char(int n)
|
||||||
{
|
{
|
||||||
const char* num = get(n);
|
const char* const car = get(n);
|
||||||
return num ? *num : '\0';
|
return car ? *car : '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 99%
|
// Certified 99%
|
||||||
int TToken_string::get_int(int n)
|
int TToken_string::get_int(int n)
|
||||||
{
|
{
|
||||||
const char* num = get(n);
|
const char* const num = get(n);
|
||||||
return num ? atoi(num) : 0;
|
return num ? atoi(num) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -742,7 +761,7 @@ int TToken_string::get_int(int n)
|
|||||||
// Certified 99%
|
// Certified 99%
|
||||||
long TToken_string::get_long(int n)
|
long TToken_string::get_long(int n)
|
||||||
{
|
{
|
||||||
const char* num = get(n);
|
const char* const num = get(n);
|
||||||
return num ? atol(num) : 0L;
|
return num ? atol(num) : 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,7 +783,7 @@ bool TToken_string::set_item(const char* v, int n)
|
|||||||
int e = find(_separator, i);
|
int e = find(_separator, i);
|
||||||
if (e < 0) e = len();
|
if (e < 0) e = len();
|
||||||
|
|
||||||
spark = &_str[e]; // Salva items seguenti
|
spark = &_str[e]; // Salva items seguenti
|
||||||
cut(i); // Considera solo items precedenti
|
cut(i); // Considera solo items precedenti
|
||||||
*this << v << spark; // Aggiunge item desiderato e seguenti
|
*this << v << spark; // Aggiunge item desiderato e seguenti
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -877,7 +896,7 @@ void TToken_string::destroy(int n)
|
|||||||
|
|
||||||
TParagraph_string::TParagraph_string(const char* s, int width)
|
TParagraph_string::TParagraph_string(const char* s, int width)
|
||||||
: TToken_string(s, '|'), _width(width)
|
: TToken_string(s, '|'), _width(width)
|
||||||
{ tokenize(); }
|
{ tokenize(); }
|
||||||
|
|
||||||
const TString& TParagraph_string::operator =(const char* s)
|
const TString& TParagraph_string::operator =(const char* s)
|
||||||
{
|
{
|
||||||
|
@ -72,10 +72,10 @@ public:
|
|||||||
int find(char, int from = 0) const; // Ritorna la posizione del carattere char nell'oggetto TString
|
int find(char, int from = 0) const; // Ritorna la posizione del carattere char nell'oggetto TString
|
||||||
int find(const char* s, int from = 0) const; // Ritorna la posizione della stringa s nell'oggetto TString
|
int find(const char* s, int from = 0) const; // Ritorna la posizione della stringa s nell'oggetto TString
|
||||||
|
|
||||||
const char* left(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da sinistra
|
const TString& left(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da sinistra
|
||||||
const char* mid(int from, int count = -1) const; // Ritorna l'oggetto TString composto dai count caratteri a partire da from
|
const TString& mid(int from, int count = -1) const; // Ritorna l'oggetto TString composto dai count caratteri a partire da from
|
||||||
const char* sub(int from, int to = -1) const; // Ritorna la stringa da FROM a TO (escluso)
|
const TString& sub(int from, int to = -1) const; // Ritorna la stringa da FROM a TO (escluso)
|
||||||
const char* right(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da destra
|
const TString& right(int count) const; // Ritorna l'oggetto TString composto dai count caratteri da destra
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// @DES Modifying methods
|
// @DES Modifying methods
|
||||||
@ -188,15 +188,15 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
// Classe TFilename : public TString
|
// Classe TFilename : public TString80 (256 su Windows'95)
|
||||||
// @END
|
// @END
|
||||||
|
|
||||||
class TFilename : public TString
|
class TFilename : public TString80
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// @FPUB
|
// @FPUB
|
||||||
|
|
||||||
TFilename(const char* n = "") : TString(24) { set(n); }
|
TFilename(const char* n = "") : TString80(n) {}
|
||||||
|
|
||||||
const TString& operator =(const char* s) { return set(s); }
|
const TString& operator =(const char* s) { return set(s); }
|
||||||
// assegnazione tra TFile e stringa
|
// assegnazione tra TFile e stringa
|
||||||
@ -205,8 +205,8 @@ public:
|
|||||||
void ext(const char*); // Imposta come estensione la stringa puntata da char*
|
void ext(const char*); // Imposta come estensione la stringa puntata da char*
|
||||||
|
|
||||||
const char* name() const; // Ritorna il nome del file
|
const char* name() const; // Ritorna il nome del file
|
||||||
TString& 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
|
||||||
TString& tempdir(); // Genera il nome della directory temporanea
|
const TFilename& tempdir(); // Genera il nome della directory temporanea
|
||||||
};
|
};
|
||||||
|
|
||||||
// @C
|
// @C
|
||||||
|
@ -5,19 +5,18 @@
|
|||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_SCOUNIX
|
#if XVT_OS == XVT_OS_SCOUNIX
|
||||||
extern "C" {long nap(long period);}
|
extern "C" { long nap(long period); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
// FATAL_HOOK che intercetta errori fatali XVT
|
// FATAL_HOOK che intercetta errori fatali XVT
|
||||||
// put breakpoint here
|
// put breakpoint here
|
||||||
void fatal_hook()
|
void fatal_hook()
|
||||||
{
|
{
|
||||||
#ifdef DBG
|
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
dummy++;
|
dummy++;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if XVTWS == WMWS
|
#if XVTWS == WMWS
|
||||||
|
|
||||||
@ -38,6 +37,9 @@ COLOR FOCUS_BACK_COLOR = COLOR_WHITE;
|
|||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
#include <ctl3d.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
HIDDEN COLORREF COLOR2RGB(COLOR c)
|
HIDDEN COLORREF COLOR2RGB(COLOR c)
|
||||||
{
|
{
|
||||||
@ -73,15 +75,20 @@ HIDDEN LOGFONT NormalLogFont =
|
|||||||
0, 0,
|
0, 0,
|
||||||
300, FALSE, FALSE, FALSE,
|
300, FALSE, FALSE, FALSE,
|
||||||
OEM_CHARSET,
|
OEM_CHARSET,
|
||||||
OUT_CHARACTER_PRECIS,
|
OUT_TT_PRECIS,
|
||||||
CLIP_DEFAULT_PRECIS,
|
CLIP_STROKE_PRECIS,
|
||||||
PROOF_QUALITY,
|
PROOF_QUALITY,
|
||||||
VARIABLE_PITCH | FF_SWISS,
|
FIXED_PITCH | FF_ROMAN,
|
||||||
NULL
|
(LPSTR)"Times New Roman"
|
||||||
};
|
};
|
||||||
HIDDEN HFONT NormalFont = CreateFontIndirect(&NormalLogFont);
|
HIDDEN HFONT NormalFont = CreateFontIndirect(&NormalLogFont);
|
||||||
|
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
COLOR MASK_BACK_COLOR = COLOR_LTGRAY;
|
||||||
|
#else
|
||||||
COLOR MASK_BACK_COLOR = MAKE_COLOR(0,128,128);
|
COLOR MASK_BACK_COLOR = MAKE_COLOR(0,128,128);
|
||||||
|
#endif
|
||||||
|
|
||||||
COLOR NORMAL_COLOR = COLOR_BLACK;
|
COLOR NORMAL_COLOR = COLOR_BLACK;
|
||||||
COLOR NORMAL_BACK_COLOR = COLOR_LTGRAY;
|
COLOR NORMAL_BACK_COLOR = COLOR_LTGRAY;
|
||||||
COLOR DISABLED_COLOR = COLOR_GRAY;
|
COLOR DISABLED_COLOR = COLOR_GRAY;
|
||||||
@ -90,8 +97,8 @@ COLOR DISABLED_BACK_COLOR = MASK_BACK_COLOR;
|
|||||||
HIDDEN COLORREF MaskColor = COLOR2RGB(MASK_BACK_COLOR);
|
HIDDEN COLORREF MaskColor = COLOR2RGB(MASK_BACK_COLOR);
|
||||||
HIDDEN HBRUSH MaskBrush = CreateSolidBrush(MaskColor);
|
HIDDEN HBRUSH MaskBrush = CreateSolidBrush(MaskColor);
|
||||||
|
|
||||||
HIDDEN COLORREF FocusForeColor = COLOR2RGB(COLOR_BLACK); // GetSysColor(COLOR_HIGHLIGHTTEXT);
|
HIDDEN COLORREF FocusForeColor = COLOR2RGB(COLOR_BLACK);
|
||||||
HIDDEN COLORREF FocusBackColor = COLOR2RGB(COLOR_CYAN); // GetSysColor(COLOR_HIGHLIGHT);
|
HIDDEN COLORREF FocusBackColor = COLOR2RGB(COLOR_CYAN);
|
||||||
HIDDEN HBRUSH FocusBrush = CreateSolidBrush(FocusBackColor);
|
HIDDEN HBRUSH FocusBrush = CreateSolidBrush(FocusBackColor);
|
||||||
|
|
||||||
COLOR FOCUS_COLOR = RGB2COLOR(FocusForeColor);
|
COLOR FOCUS_COLOR = RGB2COLOR(FocusForeColor);
|
||||||
@ -101,18 +108,26 @@ HIDDEN COLORREF NormalForeColor = COLOR2RGB(NORMAL_COLOR);
|
|||||||
HIDDEN COLORREF NormalBackColor = COLOR2RGB(NORMAL_BACK_COLOR);
|
HIDDEN COLORREF NormalBackColor = COLOR2RGB(NORMAL_BACK_COLOR);
|
||||||
HIDDEN HBRUSH NormalBrush = CreateSolidBrush(NormalBackColor);
|
HIDDEN HBRUSH NormalBrush = CreateSolidBrush(NormalBackColor);
|
||||||
|
|
||||||
HIDDEN BOOLEAN event_hook(HWND hwnd,
|
static BOOLEAN event_hook(HWND hwnd,
|
||||||
UINT msg,
|
UINT msg,
|
||||||
UINT wparam,
|
UINT wparam,
|
||||||
ULONG lparam,
|
ULONG lparam,
|
||||||
long* ret)
|
long* ret)
|
||||||
{
|
{
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
case WM_SYSCOLORCHANGE:
|
||||||
|
Ctl3dColorChange();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case WM_CTLCOLOR:
|
case WM_CTLCOLOR:
|
||||||
{
|
{
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
*ret = Ctl3dCtlColorEx(msg, wparam, lparam);
|
||||||
|
return TRUE;
|
||||||
|
#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 ||
|
||||||
type == CTLCOLOR_MSGBOX)
|
type == CTLCOLOR_MSGBOX)
|
||||||
{
|
{
|
||||||
@ -139,64 +154,83 @@ HIDDEN BOOLEAN event_hook(HWND hwnd,
|
|||||||
*ret = focus ? FocusBrush : NormalBrush;
|
*ret = focus ? FocusBrush : NormalBrush;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
{
|
|
||||||
const word notify = HIWORD(lparam);
|
|
||||||
if (notify == EN_KILLFOCUS || notify == EN_SETFOCUS)
|
|
||||||
{
|
{
|
||||||
HWND hwnd = LOWORD(lparam); // Ridisegna BENE il campo
|
const word notify = HIWORD(lparam);
|
||||||
InvalidateRect(hwnd, NULL, TRUE);
|
if (notify == EN_KILLFOCUS || notify == EN_SETFOCUS)
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case WM_KEYDOWN:
|
|
||||||
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
|
|
||||||
wparam == VK_UP || wparam == VK_DOWN )
|
|
||||||
{
|
|
||||||
char name[16];
|
|
||||||
GetClassName(hwnd, name, 5);
|
|
||||||
if (stricmp(name, "Edit") == 0)
|
|
||||||
{
|
|
||||||
KEY key;
|
|
||||||
switch(wparam)
|
|
||||||
{
|
{
|
||||||
case VK_PRIOR:
|
HWND hwnd = LOWORD(lparam); // Ridisegna BENE il campo
|
||||||
key = K_PREV; break;
|
InvalidateRect(hwnd, NULL, TRUE);
|
||||||
case VK_NEXT:
|
|
||||||
key = K_NEXT; break;
|
|
||||||
case VK_UP:
|
|
||||||
key = K_UP; break;
|
|
||||||
case VK_DOWN:
|
|
||||||
key = K_DOWN; break;
|
|
||||||
default:
|
|
||||||
key = 0; break;
|
|
||||||
}
|
}
|
||||||
if (key > 0)
|
}
|
||||||
|
break;
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
if (wparam == VK_PRIOR || wparam == VK_NEXT ||
|
||||||
|
wparam == VK_UP || wparam == VK_DOWN )
|
||||||
{
|
{
|
||||||
WINDOW w = cur_win();
|
char name[16];
|
||||||
if (w != NULL_WIN)
|
GetClassName(hwnd, name, 5);
|
||||||
dispatch_e_char(w, key);
|
if (stricmp(name, "Edit") == 0)
|
||||||
}
|
{
|
||||||
}
|
KEY key;
|
||||||
}
|
switch(wparam)
|
||||||
break;
|
{
|
||||||
case WM_MENUCHAR:
|
case VK_PRIOR:
|
||||||
{
|
key = K_PREV; break;
|
||||||
WINDOW w = cur_win();
|
case VK_NEXT:
|
||||||
if (w != NULL_WIN)
|
key = K_NEXT; break;
|
||||||
{
|
case VK_UP:
|
||||||
const KEY key = toupper(wparam)+K_CTRL;
|
key = K_UP; break;
|
||||||
dispatch_e_char(w, key);
|
case VK_DOWN:
|
||||||
}
|
key = K_DOWN; break;
|
||||||
}
|
default:
|
||||||
break;
|
key = 0; break;
|
||||||
default:
|
}
|
||||||
break;
|
if (key > 0)
|
||||||
}
|
{
|
||||||
|
WINDOW w = cur_win();
|
||||||
|
if (w != NULL_WIN)
|
||||||
|
dispatch_e_char(w, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_MENUCHAR:
|
||||||
|
{
|
||||||
|
WINDOW w = cur_win();
|
||||||
|
if (w != NULL_WIN)
|
||||||
|
{
|
||||||
|
const KEY key = toupper(wparam)+K_CTRL;
|
||||||
|
dispatch_e_char(w, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HIDDEN WIN_TYPE _wc_type = W_NONE;
|
||||||
|
|
||||||
|
static void createwindow_hook(DWORD* exstyle, LPCSTR* classname, LPCSTR* windowname, DWORD* styl,
|
||||||
|
int* x, int* y, int* width, int* height, HWND* parent, HMENU* menu,
|
||||||
|
HINSTANCE inst, void **)
|
||||||
|
{
|
||||||
|
if (_wc_type == WC_EDIT)
|
||||||
|
{
|
||||||
|
*y++;
|
||||||
|
} else
|
||||||
|
if (_wc_type == WC_GROUPBOX)
|
||||||
|
{
|
||||||
|
*classname = "Static";
|
||||||
|
}
|
||||||
|
_wc_type = W_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -460,13 +494,24 @@ void customize_controls(bool on)
|
|||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
const long style = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE | WSF_MAXIMIZED;
|
const long taskwin_style = WSF_ICONIZABLE | WSF_SIZE | WSF_CLOSE | WSF_MAXIMIZED;
|
||||||
set_value(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, style);
|
set_value(NULL_WIN,ATTR_WIN_PM_TWIN_STARTUP_STYLE, taskwin_style);
|
||||||
set_value(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
set_value(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
|
||||||
set_value(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
set_value(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
|
||||||
|
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
set_value(NULL_WIN,ATTR_WIN_CREATEWINDOW_HOOK, (long)createwindow_hook);
|
||||||
|
HINSTANCE _hInstance = (HINSTANCE)get_value(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||||
|
Ctl3dRegister(_hInstance);
|
||||||
|
Ctl3dAutoSubclass(_hInstance);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
HINSTANCE _hInstance = (HINSTANCE)get_value(NULL_WIN, ATTR_WIN_INSTANCE);
|
||||||
|
Ctl3dUnregister(_hInstance);
|
||||||
|
#endif
|
||||||
DeleteObject(NormalFont);
|
DeleteObject(NormalFont);
|
||||||
DeleteObject(MaskBrush);
|
DeleteObject(MaskBrush);
|
||||||
DeleteObject(NormalBrush);
|
DeleteObject(NormalBrush);
|
||||||
@ -474,15 +519,16 @@ void customize_controls(bool on)
|
|||||||
free_controls_bmp();
|
free_controls_bmp();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (on) set_value(NULL_WIN,ATTR_FATAL_ERR_HANDLER, (long)fatal_hook);
|
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
|
if (on) set_value(NULL_WIN,ATTR_FATAL_ERR_HANDLER, (long)fatal_hook);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void xvt_set_font(WINDOW win, int family, int style, int dim)
|
void xvt_set_font(WINDOW win, int family, int style, int dim)
|
||||||
{
|
{
|
||||||
CHECK(win > 0, "Can't set the font in a NULL window");
|
CHECK(win != NULL_WIN, "Can't set the font in a NULL window");
|
||||||
|
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
@ -552,6 +598,13 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
|||||||
WINDOW win = NULL_WIN;
|
WINDOW win = NULL_WIN;
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
|
_wc_type = wt;
|
||||||
|
|
||||||
|
if (wt == WC_PUSHBUTTON)
|
||||||
|
win = xvt_create_pushbutton(r.left, r.top, r.right, r.bottom,
|
||||||
|
caption, parent, flags, app_data, id);
|
||||||
|
|
||||||
|
#ifndef __CTL3D__
|
||||||
if (wt == WC_CHECKBOX)
|
if (wt == WC_CHECKBOX)
|
||||||
win = xvt_create_checkbox(r.left, r.top, r.right, r.bottom,
|
win = xvt_create_checkbox(r.left, r.top, r.right, r.bottom,
|
||||||
caption, parent, flags, app_data, id);
|
caption, parent, flags, app_data, id);
|
||||||
@ -560,10 +613,6 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
|||||||
win = xvt_create_radiobutton(r.left, r.top, r.right, r.bottom,
|
win = xvt_create_radiobutton(r.left, r.top, r.right, r.bottom,
|
||||||
caption, parent, flags, app_data, id);
|
caption, parent, flags, app_data, id);
|
||||||
|
|
||||||
if (wt == WC_PUSHBUTTON)
|
|
||||||
win = xvt_create_pushbutton(r.left, r.top, r.right, r.bottom,
|
|
||||||
caption, parent, flags, app_data, id);
|
|
||||||
|
|
||||||
if (wt == WC_GROUPBOX)
|
if (wt == WC_GROUPBOX)
|
||||||
{
|
{
|
||||||
win = xvt_create_groupbox(r.left, r.top, r.right, r.bottom,
|
win = xvt_create_groupbox(r.left, r.top, r.right, r.bottom,
|
||||||
@ -575,7 +624,8 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
|||||||
win = xvt_create_text(r.left, r.top, r.right, r.bottom,
|
win = xvt_create_text(r.left, r.top, r.right, r.bottom,
|
||||||
caption, parent, flags, app_data, id);
|
caption, parent, flags, app_data, id);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (win == NULL_WIN)
|
if (win == NULL_WIN)
|
||||||
@ -598,11 +648,18 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN
|
||||||
if (wt == WC_EDIT || wt == WC_LISTBUTTON)
|
#ifdef __CTL3D__
|
||||||
{
|
if (wt != WC_PUSHBUTTON)
|
||||||
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
|
#else
|
||||||
SendMessage(hwnd, WM_SETFONT, NormalFont, TRUE);
|
if (wt == WC_EDIT || wt == WC_LISTBUTTON)
|
||||||
}
|
#endif
|
||||||
|
{
|
||||||
|
HWND hwnd = (HWND)get_value(win, ATTR_NATIVE_WINDOW);
|
||||||
|
SendMessage(hwnd, WM_SETFONT, NormalFont, TRUE);
|
||||||
|
#ifdef __CTL3D__
|
||||||
|
Ctl3dSubclassCtl(hwnd);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
@ -611,7 +668,7 @@ WINDOW xvt_create_control(WIN_TYPE wt,
|
|||||||
|
|
||||||
const char* xvt_get_title(WINDOW win)
|
const char* xvt_get_title(WINDOW win)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
return c->caption();
|
return c->caption();
|
||||||
#else
|
#else
|
||||||
@ -623,7 +680,7 @@ const char* xvt_get_title(WINDOW win)
|
|||||||
|
|
||||||
void xvt_set_front_control(WINDOW win)
|
void xvt_set_front_control(WINDOW win)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
c->focus(TRUE);
|
c->focus(TRUE);
|
||||||
#endif
|
#endif
|
||||||
@ -633,7 +690,7 @@ void xvt_set_front_control(WINDOW win)
|
|||||||
|
|
||||||
void xvt_enable_control(WINDOW win, bool on)
|
void xvt_enable_control(WINDOW win, bool on)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
c->enable(on);
|
c->enable(on);
|
||||||
#else
|
#else
|
||||||
@ -644,7 +701,7 @@ void xvt_enable_control(WINDOW win, bool on)
|
|||||||
|
|
||||||
void xvt_check_box(WINDOW win, bool on)
|
void xvt_check_box(WINDOW win, bool on)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
TControl* c = (TControl*)TControl::WINDOW2TControl(win);
|
||||||
c->check(on);
|
c->check(on);
|
||||||
#else
|
#else
|
||||||
@ -655,18 +712,18 @@ void xvt_check_box(WINDOW win, bool on)
|
|||||||
|
|
||||||
bool xvt_get_checked_state(WINDOW win)
|
bool xvt_get_checked_state(WINDOW win)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
TControl* c = TControl::WINDOW2TControl(win);
|
TControl* c = TControl::WINDOW2TControl(win);
|
||||||
return c->checked();
|
return c->checked();
|
||||||
#else
|
#else
|
||||||
return get_checked_state(win);
|
return get_checked_state(win) ? TRUE : FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
void xvt_check_radio_button(WINDOW win, const WINDOW* ctls, int count)
|
||||||
{
|
{
|
||||||
#if XVT_OS == XVT_OS_WIN
|
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
|
||||||
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
|
||||||
@ -693,7 +750,7 @@ int xvt_get_checked_radio(const WINDOW* ctls, int count)
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HIDDEN WINDOW statbar = NULL_WIN;
|
HIDDEN WINDOW statbar = NULL_WIN;
|
||||||
HIDDEN TString80 stattext;
|
HIDDEN TString256 stattext;
|
||||||
|
|
||||||
WINDOW xvt_create_statbar()
|
WINDOW xvt_create_statbar()
|
||||||
{
|
{
|
||||||
@ -749,8 +806,6 @@ void xvt_statbar_refresh()
|
|||||||
|
|
||||||
HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag)
|
HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag)
|
||||||
{
|
{
|
||||||
CHECK(mi, "Can't test NULL MENU_ITEM");
|
|
||||||
|
|
||||||
while (mi->tag)
|
while (mi->tag)
|
||||||
{
|
{
|
||||||
if (mi->tag == tag) return TRUE;
|
if (mi->tag == tag) return TRUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user