Corretta gestione messaggi
git-svn-id: svn://10.65.10.50/trunk@769 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
12bd1870ca
commit
fb30854f4c
27
include/b3.h
27
include/b3.h
@ -1,18 +1,17 @@
|
|||||||
#define F_GROUP 101
|
#define F_CLASS 101
|
||||||
#define F_KEY 102
|
#define F_KEY 102
|
||||||
#define F_CLASS 103
|
#define F_Y 103
|
||||||
#define F_X 104
|
#define F_X 104
|
||||||
#define F_Y 105
|
#define F_WIDTH 105
|
||||||
#define F_WIDTH 106
|
#define F_HEIGHT 106
|
||||||
#define F_HEIGTH 107
|
#define F_PROMPT 107
|
||||||
|
#define F_HIDDEN 108
|
||||||
#define F_PROMPT 108
|
#define F_DISABLED 109
|
||||||
#define F_PICTURE 121
|
#define F_AUTOMAGIC 110
|
||||||
#define F_FIELD 131
|
#define F_PICTURE 111
|
||||||
#define F_FIELD2 132
|
#define F_GROUP 112
|
||||||
|
#define F_FIELD 113
|
||||||
#define F_AUTOMAGIC 151
|
#define F_FIELD2 114
|
||||||
#define F_HIDDEN 152
|
#define F_DECIMALS 206
|
||||||
#define F_DISABLED 153
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,85 +1,102 @@
|
|||||||
#include <bagn003.h>
|
#include <bagn003.h>
|
||||||
|
|
||||||
PAGE "CAMPO DI STAMPA" -1 -1 60 12
|
PAGE "CAMPO DI STAMPA" -1 -1 60 14
|
||||||
|
|
||||||
LIST F_CLASS 10
|
LIST F_CLASS 10
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 1 "Tipo "
|
PROMPT 1 1 "Tipo "
|
||||||
FLAGS "D"
|
FLAGS "D"
|
||||||
ITEM "STRING|Testo" MESSAGE HIDE,2@
|
ITEM "STRINGA|Testo" MESSAGE HIDE,2@,SHOW F_HEIGHT
|
||||||
ITEM "NUMBER|Numero" MESSAGE SHOW,2@
|
ITEM "NUMERO|Numero" MESSAGE SHOW,2@,HIDE F_HEIGHT
|
||||||
ITEM "DATE|Data" MESSAGE HIDE,2@
|
ITEM "DATA|Data" MESSAGE HIDE,2@,SHOW F_HEIGHT
|
||||||
ITEM "LIST|Selettore" MESSAGE HIDE,2@
|
ITEM "LISTA|Lista" MESSAGE HIDE,2@,SHOW F_HEIGHT
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_KEY 44
|
STRING F_KEY 44
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 2 "Descrizione "
|
PROMPT 1 2 "Descrizione "
|
||||||
HELP "Descrizione del campo da configurare"
|
HELP "Descrizione del campo da configurare"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_Y 3
|
NUMBER F_Y 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 4 "Riga "
|
PROMPT 1 4 "Riga "
|
||||||
HELP "Riga in cui stampare il campo"
|
HELP "Riga in cui stampare"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_X 3
|
NUMBER F_X 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 21 4 "Colonna "
|
PROMPT 16 4 "Colonna "
|
||||||
HELP "Colonna in cui stampare il campo"
|
HELP "Colonna in cui stampare"
|
||||||
END
|
END
|
||||||
|
|
||||||
NUMBER F_WIDTH 3
|
NUMBER F_WIDTH 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 41 4 "Dimensione "
|
PROMPT 32 4 "Larghezza "
|
||||||
HELP "Lunghezza di stampa del campo"
|
HELP "Lunghezza massima da stampare"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_HEIGHT 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 48 4 "Altezza "
|
||||||
|
HELP "Righe massime su cui stampare"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_DECIMALS 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 48 4 "Decimali "
|
||||||
|
HELP "Numero di decimali"
|
||||||
|
MESSAGE COPY,F_HEIGHT
|
||||||
|
GROUP 2
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PROMPT 40
|
STRING F_PROMPT 40
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 5 "Testo "
|
PROMPT 1 5 "Testo "
|
||||||
HELP "Eventuale commento al valore del campo"
|
HELP "Eventuale testo fisso da stampare"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_HIDDEN
|
BOOLEAN F_HIDDEN
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 6 "Nascosto"
|
PROMPT 1 6 "Nascosto"
|
||||||
HELP "Inidcare se il campo va calcolato ma non visualizzato"
|
HELP "Il campo va elaborato ma non stampato"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_DISABLED
|
BOOLEAN F_DISABLED
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 21 6 "Disabilitato"
|
PROMPT 21 6 "Disabilitato"
|
||||||
HELP "Indicare se il campo viene ignorato"
|
HELP "Il campo viene completamente ignorato e quindi nemmeno stampato"
|
||||||
END
|
END
|
||||||
|
|
||||||
BOOLEAN F_AUTOMAGIC
|
BOOLEAN F_AUTOMAGIC
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 41 6 "Automatico"
|
PROMPT 41 6 "Automatico"
|
||||||
FLAGS "H"
|
HELP "Il campo viene calcolato automaticamente"
|
||||||
END
|
|
||||||
|
|
||||||
STRING F_FIELD 24
|
|
||||||
BEGIN
|
|
||||||
PROMPT 1 7 "Campo su file "
|
|
||||||
FLAGS "H"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_PICTURE 16
|
STRING F_PICTURE 16
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 8 "Formato di stampa "
|
PROMPT 1 7 "Formato di stampa "
|
||||||
HELP "Indicare il formato in cui stampare il campo (vedi codici sul manuale)"
|
HELP "Formato di stampa (vedere codici sul manuale)"
|
||||||
GROUP 2
|
|
||||||
END
|
END
|
||||||
|
|
||||||
|
|
||||||
STRING F_GROUP 16
|
STRING F_GROUP 16
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 "Gruppo di stampa "
|
PROMPT 1 8 "Gruppo di stampa "
|
||||||
HELP "Indicare il numero del gruppo nel quale rientra il campo"
|
HELP "Numeri dei gruppi di appartenenza"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRING F_FIELD 24
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 9 "Campo su file "
|
||||||
|
HELP "Nome del campo su file"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_FIELD2 24
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 10 "II campo su file "
|
||||||
|
HELP "Nome del campo su file da utilizzare se il primo e' vuoto"
|
||||||
|
END
|
||||||
|
|
||||||
BUTTON DLG_OK 9 2
|
BUTTON DLG_OK 9 2
|
||||||
BEGIN
|
BEGIN
|
||||||
|
288
include/form.cpp
288
include/form.cpp
@ -17,8 +17,8 @@
|
|||||||
struct TForm_flags : public TObject
|
struct TForm_flags : public TObject
|
||||||
{
|
{
|
||||||
bool automagic : 1;
|
bool automagic : 1;
|
||||||
bool disabled : 1;
|
bool enabled : 1;
|
||||||
bool hidden : 1;
|
bool shown : 1;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void print_on(ostream& out) const;
|
void print_on(ostream& out) const;
|
||||||
@ -34,18 +34,23 @@ public:
|
|||||||
|
|
||||||
TForm_flags::TForm_flags()
|
TForm_flags::TForm_flags()
|
||||||
{
|
{
|
||||||
hidden = automagic = disabled = FALSE;
|
automagic = FALSE;
|
||||||
|
shown = enabled = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TForm_flags::update(const char* s)
|
bool TForm_flags::update(const char* s)
|
||||||
{
|
{
|
||||||
for (; *s; s++) switch(toupper(*s))
|
for (; *s; s++) switch(toupper(*s))
|
||||||
{
|
{
|
||||||
case 'A': automagic = TRUE; break;
|
case 'A':
|
||||||
case 'D': disabled = TRUE; break;
|
automagic = TRUE; break;
|
||||||
case 'H': hidden = TRUE; break;
|
case 'D':
|
||||||
default : error_box("Unknown form item flag '%c'", *s); break;
|
enabled = FALSE; break;
|
||||||
}
|
case 'H':
|
||||||
|
shown = FALSE; break;
|
||||||
|
default :
|
||||||
|
error_box("Unknown form item flag '%c'", *s); break;
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,23 +59,23 @@ void TForm_flags::print_on(ostream& out) const
|
|||||||
TString16 s;
|
TString16 s;
|
||||||
|
|
||||||
if (automagic) s << "A";
|
if (automagic) s << "A";
|
||||||
if (disabled) s << "D";
|
if (!enabled) s << "D";
|
||||||
if (hidden) s << "H";
|
if (!shown) s << "H";
|
||||||
|
|
||||||
if (s.not_empty()) out << " FLAGS \"" << s << '"' << endl;
|
if (s.not_empty()) out << " FLAGS \"" << s << '"' << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TForm_flags::to_mask(TMask& m) const
|
void TForm_flags::to_mask(TMask& m) const
|
||||||
{
|
{
|
||||||
m.set(F_DISABLED, disabled ? "X" : " ");
|
m.set(F_DISABLED, enabled ? " " : "X");
|
||||||
m.set(F_HIDDEN, hidden ? "X" : " ");
|
m.set(F_HIDDEN, shown ? " " : "X");
|
||||||
m.set(F_AUTOMAGIC, automagic ? "X" : " ");
|
m.set(F_AUTOMAGIC, automagic ? "X" : " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TForm_flags::from_mask(const TMask& m)
|
void TForm_flags::from_mask(const TMask& m)
|
||||||
{
|
{
|
||||||
hidden = m.get_bool(F_HIDDEN);
|
shown = !m.get_bool(F_HIDDEN);
|
||||||
disabled = m.get_bool(F_DISABLED);
|
enabled = !m.get_bool(F_DISABLED);
|
||||||
automagic = m.get_bool(F_AUTOMAGIC);
|
automagic = m.get_bool(F_AUTOMAGIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +93,7 @@ class TForm_item : public TObject
|
|||||||
TArray _message;
|
TArray _message;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _x, _y, _width, _heigth;
|
int _x, _y, _width, _height;
|
||||||
TString _prompt;
|
TString _prompt;
|
||||||
|
|
||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
@ -98,10 +103,12 @@ protected:
|
|||||||
virtual void from_mask(const TMask& m);
|
virtual void from_mask(const TMask& m);
|
||||||
|
|
||||||
int width() const { return _width; }
|
int width() const { return _width; }
|
||||||
int heigth() const { return _heigth; }
|
int height() const { return _height; }
|
||||||
|
|
||||||
bool hidden() const { return _flag.hidden; }
|
bool shown() const { return _flag.shown; }
|
||||||
bool disabled() const { return _flag.disabled; }
|
bool hidden() const { return !_flag.shown; }
|
||||||
|
bool enabled() const { return _flag.enabled; }
|
||||||
|
bool disabled() const { return !_flag.enabled; }
|
||||||
bool automagic() const { return !_flag.automagic; }
|
bool automagic() const { return !_flag.automagic; }
|
||||||
|
|
||||||
virtual bool parse_head(TScanner&);
|
virtual bool parse_head(TScanner&);
|
||||||
@ -111,7 +118,7 @@ protected:
|
|||||||
virtual bool set(const char* s) { _prompt = s; return TRUE; }
|
virtual bool set(const char* s) { _prompt = s; return TRUE; }
|
||||||
|
|
||||||
TToken_string& message(int m = 0);
|
TToken_string& message(int m = 0);
|
||||||
void send_message(const TString& cmd, TForm_item* dest) const;
|
void send_message(const TString& cmd, TForm_item& dest) const;
|
||||||
bool do_message(int m = 0);
|
bool do_message(int m = 0);
|
||||||
|
|
||||||
void string_at(int x, int y, const char* s);
|
void string_at(int x, int y, const char* s);
|
||||||
@ -128,7 +135,7 @@ public:
|
|||||||
const TString& key() const { return _desc; }
|
const TString& key() const { return _desc; }
|
||||||
void to_row(TToken_string& row) const;
|
void to_row(TToken_string& row) const;
|
||||||
|
|
||||||
void show(bool on = TRUE) { _flag.hidden = !on; }
|
void show(bool on = TRUE) { _flag.shown = on; }
|
||||||
void hide() { show(FALSE); }
|
void hide() { show(FALSE); }
|
||||||
void enable(bool on = TRUE);
|
void enable(bool on = TRUE);
|
||||||
void disable() { enable(FALSE); }
|
void disable() { enable(FALSE); }
|
||||||
@ -138,13 +145,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
TForm_item::TForm_item(TPrint_section* section)
|
TForm_item::TForm_item(TPrint_section* section)
|
||||||
: _section(section), _x(-1), _y(-1), _width(0), _heigth(0)
|
: _section(section), _x(-1), _y(-1), _width(0), _height(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool TForm_item::parse_head(TScanner& scanner)
|
bool TForm_item::parse_head(TScanner& scanner)
|
||||||
{
|
{
|
||||||
_width = scanner.integer();
|
_width = scanner.integer();
|
||||||
if (_width) _heigth = scanner.integer();
|
if (_width) _height = scanner.integer();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,8 +161,8 @@ void TForm_item::print_on(ostream& out) const
|
|||||||
if (_width > 0)
|
if (_width > 0)
|
||||||
{
|
{
|
||||||
out << ' ' << _width;
|
out << ' ' << _width;
|
||||||
if (_heigth > 0)
|
if (_height > 0)
|
||||||
out << ' ' << _heigth;
|
out << ' ' << _height;
|
||||||
}
|
}
|
||||||
out << "\nBEGIN\n";
|
out << "\nBEGIN\n";
|
||||||
|
|
||||||
@ -217,18 +224,18 @@ bool TForm_item::parse_item(TScanner& scanner)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_box("Unknown symbol in item '%s': '%s'",
|
yesnofatal_box("Unknown symbol in item '%s': '%s'",
|
||||||
(const char*)key(), (const char*)scanner.token());
|
(const char*)key(), (const char*)scanner.token());
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TForm_item::parse(TScanner& scanner)
|
bool TForm_item::parse(TScanner& scanner)
|
||||||
{
|
{
|
||||||
bool ok = parse_head(scanner);
|
bool ok = parse_head(scanner);
|
||||||
|
|
||||||
if (ok && scanner.popkey() != "BE")
|
if (ok && scanner.popkey() != "BE")
|
||||||
ok = error_box("Missing BEGIN in form item %s", (const char*)key());
|
ok = yesnofatal_box("Missing BEGIN in form item %s", (const char*)key());
|
||||||
|
|
||||||
while (ok && scanner.popkey() != "EN")
|
while (ok && scanner.popkey() != "EN")
|
||||||
ok = parse_item(scanner);
|
ok = parse_item(scanner);
|
||||||
@ -238,9 +245,8 @@ bool TForm_item::parse(TScanner& scanner)
|
|||||||
|
|
||||||
void TForm_item::enable(bool on)
|
void TForm_item::enable(bool on)
|
||||||
{
|
{
|
||||||
_flag.disabled = !on;
|
_flag.enabled = on;
|
||||||
if (on) show();
|
show(on);
|
||||||
else hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -272,53 +278,52 @@ TToken_string& TForm_item::message(int m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TForm_item::send_message(const TString& cmd, TForm_item* des) const
|
void TForm_item::send_message(const TString& cmd, TForm_item& des) const
|
||||||
{
|
{
|
||||||
if (cmd == "ADD" || cmd == "SUM" || cmd == "INC")
|
if (cmd == "ADD" || cmd == "SUM" || cmd == "INC")
|
||||||
{
|
{
|
||||||
const real n((cmd[0] != 'I') ? get() : "1.0");
|
const real n((cmd[0] != 'I') ? get() : "1.0");
|
||||||
real r(des->get());
|
real r(des.get());
|
||||||
r += n;
|
r += n;
|
||||||
des->set(r.string());
|
des.set(r.string());
|
||||||
} else
|
} else
|
||||||
if (cmd == "COPY")
|
if (cmd == "COPY")
|
||||||
{
|
{
|
||||||
des->set(get());
|
des.set(get());
|
||||||
} else
|
} else
|
||||||
if (cmd == "APPEND")
|
if (cmd == "APPEND")
|
||||||
{
|
{
|
||||||
TString80 val;
|
TString80 val = des.get();
|
||||||
val = des->get();
|
|
||||||
if (val.not_empty()) val << ' ';
|
if (val.not_empty()) val << ' ';
|
||||||
val << get();
|
val << get();
|
||||||
des->set(val);
|
des.set(val);
|
||||||
} else
|
} else
|
||||||
|
|
||||||
if (cmd == "DISABLE")
|
if (cmd == "DISABLE")
|
||||||
{
|
{
|
||||||
des->disable();
|
des.disable();
|
||||||
} else
|
} else
|
||||||
if (cmd == "ENABLE")
|
if (cmd == "ENABLE")
|
||||||
{
|
{
|
||||||
des->enable();
|
des.enable();
|
||||||
} else
|
} else
|
||||||
if (cmd == "HIDE")
|
if (cmd == "HIDE")
|
||||||
{
|
{
|
||||||
des->hide();
|
des.hide();
|
||||||
} else
|
} else
|
||||||
if (cmd == "SHOW")
|
if (cmd == "SHOW")
|
||||||
{
|
{
|
||||||
des->show();
|
des.show();
|
||||||
} else
|
} else
|
||||||
if (cmd == "RESET")
|
if (cmd == "RESET")
|
||||||
{
|
{
|
||||||
des->set("");
|
des.set("");
|
||||||
} else
|
} else
|
||||||
if (cmd[0] == '"')
|
if (cmd[0] == '"')
|
||||||
{
|
{
|
||||||
TString80 val(cmd);
|
TString80 val(cmd);
|
||||||
val.strip("\"");
|
val.strip("\"");
|
||||||
des->set(val);
|
des.set(val);
|
||||||
} else
|
} else
|
||||||
error_box("Unknown message in item '%s': '%s'",
|
error_box("Unknown message in item '%s': '%s'",
|
||||||
(const char*)key(), (const char*)cmd);
|
(const char*)key(), (const char*)cmd);
|
||||||
@ -327,26 +332,21 @@ void TForm_item::send_message(const TString& cmd, TForm_item* des) const
|
|||||||
|
|
||||||
bool TForm_item::do_message(int num)
|
bool TForm_item::do_message(int num)
|
||||||
{
|
{
|
||||||
if (message(num).empty()) return FALSE;
|
TToken_string& messaggio = message(num);
|
||||||
|
if (messaggio.empty()) return FALSE;
|
||||||
|
|
||||||
TToken_string msg(16, ',');
|
TToken_string msg(16, ',');
|
||||||
TString16 cmd;
|
for (const char* m = messaggio.get(0); m; m = messaggio.get())
|
||||||
const char* m;
|
|
||||||
|
|
||||||
message(num).restart();
|
|
||||||
while ((m = message(num).get()) != NULL)
|
|
||||||
{
|
{
|
||||||
msg = m;
|
msg = m;
|
||||||
cmd = msg.get(); // Get command
|
const TString16 cmd = msg.get(); // Get command
|
||||||
|
const word id = msg.get_int(); // Get destination group
|
||||||
TFixed_string str(msg.get());
|
|
||||||
const word id = atoi(str); // Get destination id
|
|
||||||
|
|
||||||
// Send the message to all fields with the given group
|
// Send the message to all fields with the given group
|
||||||
for (int i = 0; i < section()->items(); i++)
|
for (int i = 0; i < section()->items(); i++)
|
||||||
{
|
{
|
||||||
TForm_item* des = section()->item(i);
|
TForm_item& des = section()->item(i);
|
||||||
if (des->in_group(id))
|
if (des.in_group(id))
|
||||||
send_message(cmd, des);
|
send_message(cmd, des);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -376,6 +376,7 @@ void TForm_item::to_mask(TMask& m) const
|
|||||||
m.set(F_Y, _y);
|
m.set(F_Y, _y);
|
||||||
m.set(F_PROMPT, _prompt);
|
m.set(F_PROMPT, _prompt);
|
||||||
m.set(F_WIDTH, _width);
|
m.set(F_WIDTH, _width);
|
||||||
|
m.set(F_HEIGHT, _height);
|
||||||
_flag.to_mask(m);
|
_flag.to_mask(m);
|
||||||
|
|
||||||
TString16 g;
|
TString16 g;
|
||||||
@ -390,27 +391,19 @@ void TForm_item::from_mask(const TMask& m)
|
|||||||
_y = atoi(m.get(F_Y));
|
_y = atoi(m.get(F_Y));
|
||||||
_prompt = m.get(F_PROMPT);
|
_prompt = m.get(F_PROMPT);
|
||||||
_width = atoi(m.get(F_WIDTH));
|
_width = atoi(m.get(F_WIDTH));
|
||||||
|
_height = atoi(m.get(F_HEIGHT));
|
||||||
TString16 flag;
|
_flag.from_mask(m);
|
||||||
if (m.get(F_AUTOMAGIC) == "X") flag << "A";
|
_group.reset();
|
||||||
if (m.get(F_HIDDEN) == "X") flag << "H";
|
_group.set(m.get(F_GROUP));
|
||||||
_flag.update(flag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TForm_item::edit(TMaskmode mode)
|
bool TForm_item::edit(TMaskmode mode)
|
||||||
{
|
{
|
||||||
TMask m("bagn003");
|
TMask m("bagn003");
|
||||||
if (mode == MODE_INS)
|
|
||||||
{
|
|
||||||
m.disable(0);
|
|
||||||
m.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
to_mask(m);
|
to_mask(m);
|
||||||
const bool dirty = (m.run() == K_ENTER) && m.dirty();
|
const bool dirty = (m.run() == K_ENTER) && m.dirty();
|
||||||
if (dirty) from_mask(m);
|
if (dirty) from_mask(m);
|
||||||
|
|
||||||
return dirty;
|
return dirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +418,7 @@ class TForm_string : public TForm_item
|
|||||||
TArray _field;
|
TArray _field;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char* class_name() const { return "STRING"; }
|
virtual const char* class_name() const { return "STRINGA"; }
|
||||||
virtual void print_body(ostream& out) const;
|
virtual void print_body(ostream& out) const;
|
||||||
|
|
||||||
virtual void to_mask(TMask& m) const;
|
virtual void to_mask(TMask& m) const;
|
||||||
@ -439,7 +432,7 @@ protected:
|
|||||||
|
|
||||||
const TString& picture() const { return _picture; }
|
const TString& picture() const { return _picture; }
|
||||||
|
|
||||||
TFieldref* field(int i) const { return (TFieldref*)_field.objptr(i); }
|
TFieldref& field(int i) const { return (TFieldref&)_field[i]; }
|
||||||
void put_paragraph(const char* s);
|
void put_paragraph(const char* s);
|
||||||
|
|
||||||
bool read();
|
bool read();
|
||||||
@ -472,14 +465,19 @@ void TForm_string::print_body(ostream& out) const
|
|||||||
if (_picture.not_empty())
|
if (_picture.not_empty())
|
||||||
out << " PICTURE \"" << _picture << "\"" << endl;
|
out << " PICTURE \"" << _picture << "\"" << endl;
|
||||||
for (int i = 0; i < _field.items(); i++)
|
for (int i = 0; i < _field.items(); i++)
|
||||||
out << " FIELD " << *field(i) << endl;
|
out << " FIELD " << field(i) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TForm_string::to_mask(TMask& m) const
|
void TForm_string::to_mask(TMask& m) const
|
||||||
{
|
{
|
||||||
TForm_item::to_mask(m);
|
TForm_item::to_mask(m);
|
||||||
TString f(24); f << *field(0);
|
for (int i = 0; i < 2; i++) if (i < _field.items())
|
||||||
m.set(F_FIELD, f);
|
{
|
||||||
|
TString80 f;
|
||||||
|
f << field(i);
|
||||||
|
m.set(i == 0 ? F_FIELD : F_FIELD2, f);
|
||||||
|
}
|
||||||
|
|
||||||
m.set(F_PICTURE, _picture);
|
m.set(F_PICTURE, _picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,7 +485,15 @@ void TForm_string::from_mask(const TMask& m)
|
|||||||
{
|
{
|
||||||
TForm_item::from_mask(m);
|
TForm_item::from_mask(m);
|
||||||
_picture = m.get(F_PICTURE);
|
_picture = m.get(F_PICTURE);
|
||||||
*field(0) = m.get(F_FIELD);
|
|
||||||
|
for (int i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
const TString& f = m.get(i == 0 ? F_FIELD : F_FIELD2);
|
||||||
|
if (f.not_empty())
|
||||||
|
_field.add(new TFieldref(f, 0), i);
|
||||||
|
else
|
||||||
|
_field.destroy(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TForm_string::set(const char* s)
|
bool TForm_string::set(const char* s)
|
||||||
@ -502,12 +508,12 @@ const char* TForm_string::get() const
|
|||||||
|
|
||||||
bool TForm_string::read()
|
bool TForm_string::read()
|
||||||
{
|
{
|
||||||
if (_field.items() && !disabled())
|
if (enabled() && _field.items())
|
||||||
{
|
{
|
||||||
const char* s = "";
|
const char* s = "";
|
||||||
for (int i = 0; i < _field.items(); i++)
|
for (int i = 0; i < _field.items(); i++)
|
||||||
{
|
{
|
||||||
s = field(i)->read(section()->form()->relation());
|
s = field(i).read(section()->form()->relation());
|
||||||
if (*s) break;
|
if (*s) break;
|
||||||
}
|
}
|
||||||
set(s);
|
set(s);
|
||||||
@ -521,11 +527,11 @@ void TForm_string::put_paragraph(const char* s)
|
|||||||
{
|
{
|
||||||
if (hidden()) return;
|
if (hidden()) return;
|
||||||
|
|
||||||
if (heigth() > 1)
|
if (height() > 1)
|
||||||
{
|
{
|
||||||
TParagraph_string p(s, width());
|
TParagraph_string p(s, width());
|
||||||
int i = _prompt.not_empty() ? 1 : 0;
|
int i = _prompt.not_empty() ? 1 : 0;
|
||||||
for (; (s = p.get()) != NULL && i < heigth(); i++)
|
for (; (s = p.get()) != NULL && i < height(); i++)
|
||||||
string_at(_x, _y+i, s);
|
string_at(_x, _y+i, s);
|
||||||
}
|
}
|
||||||
else string_at(-1, _y, s);
|
else string_at(-1, _y, s);
|
||||||
@ -539,10 +545,12 @@ bool TForm_string::update()
|
|||||||
{
|
{
|
||||||
if (_picture.not_empty())
|
if (_picture.not_empty())
|
||||||
{
|
{
|
||||||
TString p;
|
TString80 p;
|
||||||
p.picture(_picture, get());
|
p.picture(_picture, get());
|
||||||
put_paragraph(p);
|
put_paragraph(p);
|
||||||
} else put_paragraph(get());
|
}
|
||||||
|
else
|
||||||
|
put_paragraph(get());
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -554,9 +562,11 @@ bool TForm_string::update()
|
|||||||
class TForm_number : public TForm_string
|
class TForm_number : public TForm_string
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual const char* class_name() const { return "NUMBER"; }
|
virtual const char* class_name() const { return "NUMERO"; }
|
||||||
virtual bool parse_head(TScanner& scanner);
|
virtual bool parse_head(TScanner& scanner);
|
||||||
virtual bool update();
|
virtual bool update();
|
||||||
|
|
||||||
|
int decimals() const { return height(); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TForm_number(TPrint_section* section) : TForm_string(section) {}
|
TForm_number(TPrint_section* section) : TForm_string(section) {}
|
||||||
@ -566,7 +576,7 @@ public:
|
|||||||
bool TForm_number::parse_head(TScanner& scanner)
|
bool TForm_number::parse_head(TScanner& scanner)
|
||||||
{
|
{
|
||||||
_width = 0;
|
_width = 0;
|
||||||
_heigth = scanner.integer();
|
_height = scanner.integer();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,10 +585,11 @@ bool TForm_number::update()
|
|||||||
{
|
{
|
||||||
TForm_item::update();
|
TForm_item::update();
|
||||||
if (read())
|
if (read())
|
||||||
{
|
{
|
||||||
real n(get());
|
const char* s = get();
|
||||||
n.round(heigth());
|
real n(s);
|
||||||
const char* s = n.string(picture());
|
n.round(decimals());
|
||||||
|
s = n.string(picture());
|
||||||
put_paragraph(s);
|
put_paragraph(s);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -591,7 +602,7 @@ bool TForm_number::update()
|
|||||||
class TForm_date : public TForm_string
|
class TForm_date : public TForm_string
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual const char* class_name() const { return "DATE"; }
|
virtual const char* class_name() const { return "DATA"; }
|
||||||
virtual bool set(const char*);
|
virtual bool set(const char*);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -599,7 +610,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
TForm_date::TForm_date(TPrint_section* section)
|
TForm_date::TForm_date(TPrint_section* section)
|
||||||
: TForm_string(section)
|
: TForm_string(section)
|
||||||
{
|
{
|
||||||
if (automagic())
|
if (automagic())
|
||||||
@ -612,11 +623,13 @@ TForm_date::TForm_date(TPrint_section* section)
|
|||||||
|
|
||||||
bool TForm_date::set(const char* s)
|
bool TForm_date::set(const char* s)
|
||||||
{
|
{
|
||||||
TDate d(s);
|
const TDate d(s);
|
||||||
bool ok = d.ok();
|
TForm_string::set(d.string((width() == 8) ? 2 : 4));
|
||||||
if (ok)
|
#ifdef DBG
|
||||||
ok = TForm_string::set(d.string((width() == 8) ? 2 : 4));
|
return d.ok();
|
||||||
return ok;
|
#else
|
||||||
|
return TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -629,7 +642,7 @@ class TForm_list : public TForm_string
|
|||||||
TToken_string _values;
|
TToken_string _values;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const char* class_name() const { return "LIST"; }
|
virtual const char* class_name() const { return "LISTA"; }
|
||||||
virtual bool parse_item(TScanner& scanner);
|
virtual bool parse_item(TScanner& scanner);
|
||||||
virtual void print_body(ostream& out) const;
|
virtual void print_body(ostream& out) const;
|
||||||
virtual bool update();
|
virtual bool update();
|
||||||
@ -649,9 +662,11 @@ bool TForm_list::parse_item(TScanner& scanner)
|
|||||||
TToken_string s(scanner.string());
|
TToken_string s(scanner.string());
|
||||||
_codes.add(s.get());
|
_codes.add(s.get());
|
||||||
_values.add(s.get());
|
_values.add(s.get());
|
||||||
|
|
||||||
|
TString m(80);
|
||||||
while (scanner.popkey() == "ME")
|
while (scanner.popkey() == "ME")
|
||||||
{
|
{
|
||||||
TString m(scanner.line());
|
m = scanner.line();
|
||||||
m.strip_spaces();
|
m.strip_spaces();
|
||||||
message(_values.items()-1).add(m);
|
message(_values.items()-1).add(m);
|
||||||
}
|
}
|
||||||
@ -694,38 +709,21 @@ bool TForm_list::update()
|
|||||||
|
|
||||||
if (!read()) return ok;
|
if (!read()) return ok;
|
||||||
|
|
||||||
int pos = _codes.get_pos(get());
|
const TString& val =get();
|
||||||
|
const int pos = _codes.get_pos(val);
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
{
|
{
|
||||||
TString k(_codes.get(0));
|
ok = yesnofatal_box("Il campo '%s' non puo' valere '%s'",
|
||||||
ok = error_box("Il campo '%s' non puo' valere '%s': assumo '%s'",
|
(const char*)key(), (const char*)val);
|
||||||
(const char*)key(), get(), (const char*)k);
|
|
||||||
set(k);
|
|
||||||
pos = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_message(pos);
|
do_message(pos);
|
||||||
|
|
||||||
if (!hidden())
|
if (!hidden())
|
||||||
{
|
{
|
||||||
if (_prompt.not_empty())
|
const char* c = _values.get(pos);
|
||||||
{
|
if (c == NULL) c = val;
|
||||||
int found = -1;
|
if (c) string_at(_x, _y, c);
|
||||||
for (int i = 0; found < pos && _prompt[i]; i++)
|
|
||||||
if (_prompt[i] != ' ') found++;
|
|
||||||
if (found == pos)
|
|
||||||
{
|
|
||||||
char c[2] = { _prompt[i], '\0' };
|
|
||||||
string_at(_x+i, _y, c);
|
|
||||||
}
|
|
||||||
else error_box("Non trovo l'elemento %d in '%s'", (const char*)_prompt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char* c = _values.get(pos);
|
|
||||||
if (c == NULL) c = get();
|
|
||||||
if (c) string_at(_x, _y, c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
@ -743,7 +741,7 @@ void TPrint_section::init(const char* name, TForm* f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TPrint_section::TPrint_section(const char* name, TForm* f)
|
TPrint_section::TPrint_section(const char* name, TForm* f)
|
||||||
: _heigth(0)
|
: _height(0)
|
||||||
{
|
{
|
||||||
init(name, f);
|
init(name, f);
|
||||||
}
|
}
|
||||||
@ -769,15 +767,18 @@ TForm_item* TPrint_section::parse_item(TScanner& scanner)
|
|||||||
return new TForm_date(this);
|
return new TForm_date(this);
|
||||||
if (scanner.key() == "LI")
|
if (scanner.key() == "LI")
|
||||||
return new TForm_list(this);
|
return new TForm_list(this);
|
||||||
|
|
||||||
error_box("Elemento sconosciuto nella sezione %s: %s",
|
#ifdef DBG
|
||||||
(const char*)_name, (const char*)scanner.token());
|
yesnofatal_box("Elemento sconosciuto nella sezione '%s': '%s'",
|
||||||
|
(const char*)_name, (const char*)scanner.token());
|
||||||
|
#endif
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TPrint_section::parse(TScanner& scanner)
|
bool TPrint_section::parse(TScanner& scanner)
|
||||||
{
|
{
|
||||||
_heigth = scanner.integer();
|
_height = scanner.integer();
|
||||||
|
|
||||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||||
|
|
||||||
@ -808,24 +809,24 @@ bool TPrint_section::update()
|
|||||||
if (!esito) ok = FALSE;
|
if (!esito) ok = FALSE;
|
||||||
}
|
}
|
||||||
i = items();
|
i = items();
|
||||||
if (i < _heigth) row(_heigth-1);
|
if (i < _height) row(_height-1);
|
||||||
else if (i > _heigth)
|
else if (i > _height)
|
||||||
ok = warning_box("Sezione %s troppo lunga: %d > %d",
|
ok = warning_box("Sezione %s troppo lunga: %d > %d",
|
||||||
(const char*)_name, i, _heigth);
|
(const char*)_name, i, _height);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TPrint_section::edit(int mode)
|
bool TPrint_section::edit(int mode)
|
||||||
{
|
{
|
||||||
TString title(40);
|
TString80 title;
|
||||||
title = "Campi della sezione "; title << _name;
|
title = "Campi della sezione "; title << _name;
|
||||||
|
|
||||||
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@6|Descrizione@40", 0x8);
|
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Descrizione@40", 0x8);
|
||||||
|
|
||||||
for (int i = 0; i < items(); i++)
|
for (int i = 0; i < items(); i++)
|
||||||
{
|
{
|
||||||
TToken_string s(64);
|
TToken_string s(64);
|
||||||
item(i)->to_row(s);
|
item(i).to_row(s);
|
||||||
a.add(s);
|
a.add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -833,11 +834,11 @@ bool TPrint_section::edit(int mode)
|
|||||||
while (a.run() == K_ENTER)
|
while (a.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
i = (int)a.selected();
|
i = (int)a.selected();
|
||||||
const bool spork = item(i)->edit((TMaskmode)mode);
|
const bool spork = item(i).edit((TMaskmode)mode);
|
||||||
if (spork)
|
if (spork)
|
||||||
{
|
{
|
||||||
dirty = TRUE;
|
dirty = TRUE;
|
||||||
item(i)->to_row(a.row(i));
|
item(i).to_row(a.row(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dirty;
|
return dirty;
|
||||||
@ -845,9 +846,9 @@ bool TPrint_section::edit(int mode)
|
|||||||
|
|
||||||
void TPrint_section::print_on(ostream& out) const
|
void TPrint_section::print_on(ostream& out) const
|
||||||
{
|
{
|
||||||
out << "\nPAGE " << _name << ' ' << _heigth << '\n' << endl;
|
out << "\nPAGE " << _name << ' ' << _height << '\n' << endl;
|
||||||
for(int i = 0; i < items(); i++)
|
for(int i = 0; i < items(); i++)
|
||||||
out << *item(i);
|
out << item(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -918,9 +919,9 @@ bool TForm::parse_join(TScanner& scanner)
|
|||||||
exp.add(r);
|
exp.add(r);
|
||||||
r = scanner.pop();
|
r = scanner.pop();
|
||||||
}
|
}
|
||||||
if (exp.empty())
|
|
||||||
error_box("JOIN senza espressioni INTO");
|
|
||||||
}
|
}
|
||||||
|
if (exp.empty())
|
||||||
|
yesnofatal_box("JOIN senza espressioni INTO");
|
||||||
scanner.push();
|
scanner.push();
|
||||||
|
|
||||||
if (isdigit(j[0]))
|
if (isdigit(j[0]))
|
||||||
@ -939,7 +940,7 @@ bool TForm::set_header()
|
|||||||
|
|
||||||
const bool ok = _head.update();
|
const bool ok = _head.update();
|
||||||
|
|
||||||
int last = _head.last();
|
const int last = _head.last();
|
||||||
for (int j = 0; j <= last; j++)
|
for (int j = 0; j <= last; j++)
|
||||||
printer.setheaderline(j, _head.row(j));
|
printer.setheaderline(j, _head.row(j));
|
||||||
|
|
||||||
@ -954,7 +955,7 @@ bool TForm::set_footer()
|
|||||||
|
|
||||||
const bool ok = _foot.update();
|
const bool ok = _foot.update();
|
||||||
|
|
||||||
int last = _foot.last();
|
const int last = _foot.last();
|
||||||
for (int j = 0; j <= last; j++)
|
for (int j = 0; j <= last; j++)
|
||||||
printer.setfooterline(j, _foot.row(j));
|
printer.setfooterline(j, _foot.row(j));
|
||||||
|
|
||||||
@ -1015,10 +1016,13 @@ bool TForm::edit(int mode, int section)
|
|||||||
|
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case 0: dirty = _head.edit(mode); break;
|
case 0:
|
||||||
case 2: dirty = _foot.edit(mode); break;
|
dirty = _head.edit(mode); break;
|
||||||
default: dirty = _body.edit(mode); break;
|
case 2:
|
||||||
}
|
dirty = _foot.edit(mode); break;
|
||||||
|
default:
|
||||||
|
dirty = _body.edit(mode); break;
|
||||||
|
}
|
||||||
|
|
||||||
if (dirty && yesno_box("Salvare le modifiche?"))
|
if (dirty && yesno_box("Salvare le modifiche?"))
|
||||||
{
|
{
|
||||||
|
@ -19,11 +19,11 @@ class TForm_item;
|
|||||||
|
|
||||||
class TPrint_section : public TArray
|
class TPrint_section : public TArray
|
||||||
{
|
{
|
||||||
TString16 _name;
|
TString16 _name; // Nome della sezione di stampa
|
||||||
int _heigth;
|
int _height; // Altezza della sezione
|
||||||
|
|
||||||
TForm* _form;
|
TForm* _form; // Form cui appartiene alla sezione
|
||||||
TArray _item;
|
TArray _item; // Lista dei campi da stampare
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void print_on(ostream& out) const;
|
virtual void print_on(ostream& out) const;
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
TPrintrow& row(int num);
|
TPrintrow& row(int num);
|
||||||
TForm* form() const { return _form; }
|
TForm* form() const { return _form; }
|
||||||
|
|
||||||
TForm_item* item(int n) const { return (TForm_item*)_item.objptr(n); }
|
TForm_item& item(int n) const { return (TForm_item&)_item[n]; }
|
||||||
int items() const { return _item.items(); }
|
int items() const { return _item.items(); }
|
||||||
|
|
||||||
bool update();
|
bool update();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: mailbox.cpp,v 1.9 1994-12-07 12:20:58 guy Exp $
|
// $Id: mailbox.cpp,v 1.10 1994-12-15 18:06:18 guy Exp $
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
@ -20,7 +20,7 @@ TMessage::TMessage(const char* to, const char* sub,
|
|||||||
const char* text, const char* from)
|
const char* text, const char* from)
|
||||||
{
|
{
|
||||||
_to = to;
|
_to = to;
|
||||||
if (_to.len() != 6 || _to.strip(" -") != to)
|
if (to && *to && (_to.len() != 6 || _to.strip(" -") != to))
|
||||||
_to = cmd2name(to);
|
_to = cmd2name(to);
|
||||||
_subject = sub;
|
_subject = sub;
|
||||||
_text = text;
|
_text = text;
|
||||||
|
@ -1058,7 +1058,7 @@ void TMask::enable_key(byte key, bool on)
|
|||||||
if (on)
|
if (on)
|
||||||
{
|
{
|
||||||
fld(i).enable_default();
|
fld(i).enable_default();
|
||||||
if (!fld(i).showed())
|
if (!fld(i).shown())
|
||||||
fld(i).show_default();
|
fld(i).show_default();
|
||||||
}
|
}
|
||||||
else fld(i).disable();
|
else fld(i).disable();
|
||||||
@ -1108,17 +1108,24 @@ bool TMask::key_valid(int key) const
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TMask::show(short fld_id, bool on)
|
void TMask::show(short fld_id, bool on)
|
||||||
{
|
{
|
||||||
if (fld_id <= 0)
|
if (fld_id <= 0)
|
||||||
{
|
{
|
||||||
const int gr = -fld_id;
|
const int gr = -fld_id;
|
||||||
for (int i = 0; i < fields(); i++) if (gr == 0 || fld(i).in_group(gr))
|
for (int i = 0; i < fields(); i++)
|
||||||
fld(i).show(on);
|
{
|
||||||
} else field(fld_id).show(on);
|
TMask_field& f = fld(i);
|
||||||
|
if (gr == 0 || f.in_group(gr))
|
||||||
|
f.show(on);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else field(fld_id).show(on);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void TMask::show_default(short fld_id)
|
void TMask::show_default(short fld_id)
|
||||||
{
|
{
|
||||||
if (fld_id <= 0)
|
if (fld_id <= 0)
|
||||||
@ -1150,7 +1157,7 @@ void TMask::autosave(TRelation* r) const
|
|||||||
const TFieldref* fr =f.field();
|
const TFieldref* fr =f.field();
|
||||||
if (fr != NULL)
|
if (fr != NULL)
|
||||||
{
|
{
|
||||||
if (f.showed() || *fr->read(r) == '\0')
|
if (f.shown() || *fr->read(r) == '\0')
|
||||||
f.autosave(r);
|
f.autosave(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: maskfld.cpp,v 1.60 1994-12-07 18:03:37 guy Exp $
|
// $Id: maskfld.cpp,v 1.61 1994-12-15 18:06:23 guy Exp $
|
||||||
#include <xvt.h>
|
#include <xvt.h>
|
||||||
|
|
||||||
#include <applicat.h>
|
#include <applicat.h>
|
||||||
@ -31,7 +31,7 @@ TMask_field::TField_Flags::TField_Flags()
|
|||||||
{
|
{
|
||||||
automagic = persistent = FALSE;
|
automagic = persistent = FALSE;
|
||||||
enabled = enable_default = TRUE;
|
enabled = enable_default = TRUE;
|
||||||
showed = show_default = TRUE;
|
shown = show_default = TRUE;
|
||||||
uppercase = rightjust = FALSE;
|
uppercase = rightjust = FALSE;
|
||||||
zerofilled = FALSE;
|
zerofilled = FALSE;
|
||||||
dirty = focusdirty = FALSE;
|
dirty = focusdirty = FALSE;
|
||||||
@ -58,7 +58,7 @@ char TMask_field::TField_Flags::update(const char* s)
|
|||||||
case 'G':
|
case 'G':
|
||||||
ghost = TRUE; break;
|
ghost = TRUE; break;
|
||||||
case 'H':
|
case 'H':
|
||||||
show_default = showed = FALSE; break;
|
show_default = shown = FALSE; break;
|
||||||
case 'M':
|
case 'M':
|
||||||
roman = TRUE; break;
|
roman = TRUE; break;
|
||||||
case 'P':
|
case 'P':
|
||||||
@ -348,7 +348,7 @@ void TMask_field::show(bool on)
|
|||||||
show_window(_win, on);
|
show_window(_win, on);
|
||||||
if (_promptwin != NULL_WIN)
|
if (_promptwin != NULL_WIN)
|
||||||
show_window(_promptwin, on);
|
show_window(_promptwin, on);
|
||||||
_flags.showed = on;
|
_flags.shown = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ void TMask_field::show_default()
|
|||||||
// Certified 100%
|
// Certified 100%
|
||||||
bool TMask_field::active() const
|
bool TMask_field::active() const
|
||||||
{
|
{
|
||||||
return enabled() && showed() && class_id() != CLASS_FIELD;
|
return enabled() && shown() && class_id() != CLASS_FIELD;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -661,7 +661,7 @@ bool TMask_field::do_message(int num)
|
|||||||
if (value != prev)
|
if (value != prev)
|
||||||
{
|
{
|
||||||
f.set(value);
|
f.set(value);
|
||||||
if (f.showed() || f.ghost())
|
if (f.shown() || f.ghost())
|
||||||
f.on_hit();
|
f.on_hit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -674,7 +674,7 @@ bool TMask_field::do_message(int num)
|
|||||||
if (value != prev)
|
if (value != prev)
|
||||||
{
|
{
|
||||||
f.set(value);
|
f.set(value);
|
||||||
if (f.showed() || f.ghost())
|
if (f.shown() || f.ghost())
|
||||||
f.on_hit();
|
f.on_hit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1383,7 +1383,7 @@ TToken_string& TBrowse::create_siblings(TToken_string& siblings)
|
|||||||
{
|
{
|
||||||
const short id = _fld->atodlg(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.shown() || !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();
|
||||||
@ -1582,7 +1582,7 @@ 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() && showed());
|
show_window(_buttonwin, on && check_enabled() && shown());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TEdit_field::show(bool on)
|
void TEdit_field::show(bool on)
|
||||||
@ -2096,7 +2096,7 @@ bool TEdit_field::has_check() const
|
|||||||
|
|
||||||
bool TEdit_field::check(CheckTime t)
|
bool TEdit_field::check(CheckTime t)
|
||||||
{
|
{
|
||||||
if (check_enabled() || (t == STARTING_CHECK && showed()))
|
if (check_enabled() || (t == STARTING_CHECK && shown()))
|
||||||
{
|
{
|
||||||
if (_browse) return _browse->check(t); else
|
if (_browse) return _browse->check(t); else
|
||||||
if (_sheet) return _sheet->check(t);
|
if (_sheet) return _sheet->check(t);
|
||||||
@ -2703,7 +2703,7 @@ void TList_field::delete_item(const char* s)
|
|||||||
if (mask().is_running())
|
if (mask().is_running())
|
||||||
{
|
{
|
||||||
win_list_set_sel(win(), 0, TRUE);
|
win_list_set_sel(win(), 0, TRUE);
|
||||||
if (showed()) on_hit();
|
if (shown()) on_hit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3029,7 +3029,7 @@ void TRadio_field::show(bool on)
|
|||||||
|
|
||||||
for(int i = 0; i < _nitems; i++)
|
for(int i = 0; i < _nitems; i++)
|
||||||
show_window(_radio_ctl_win[i], on);
|
show_window(_radio_ctl_win[i], on);
|
||||||
_flags.showed = on;
|
_flags.shown = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return TRUE if focus has left the radio
|
// Return TRUE if focus has left the radio
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: maskfld.h,v 1.14 1994-11-29 17:34:31 alex Exp $ */
|
/* $Id: maskfld.h,v 1.15 1994-12-15 18:06:30 guy Exp $ */
|
||||||
#ifndef __MASKFLD_H
|
#ifndef __MASKFLD_H
|
||||||
#define __MASKFLD_H
|
#define __MASKFLD_H
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ protected:
|
|||||||
bool password : 1;
|
bool password : 1;
|
||||||
bool persistent : 1;
|
bool persistent : 1;
|
||||||
bool rightjust : 1;
|
bool rightjust : 1;
|
||||||
bool roman : 1; // Is a Roman number ?
|
bool roman : 1; // Is a Roman number ?
|
||||||
bool showed : 1; // Is visible
|
bool shown : 1; // Is visible
|
||||||
bool show_default : 1;
|
bool show_default : 1;
|
||||||
bool uppercase : 1;
|
bool uppercase : 1;
|
||||||
bool exchange : 1; // Value exchange
|
bool exchange : 1; // Value exchange
|
||||||
@ -153,7 +153,7 @@ public:
|
|||||||
|
|
||||||
virtual void show(bool on = TRUE);
|
virtual void show(bool on = TRUE);
|
||||||
void hide() { show(FALSE); }
|
void hide() { show(FALSE); }
|
||||||
bool showed() const { return _flags.showed; }
|
bool shown() const { return _flags.shown; }
|
||||||
void show_default();
|
void show_default();
|
||||||
|
|
||||||
bool active() const; // Is visible and enabled?
|
bool active() const; // Is visible and enabled?
|
||||||
|
@ -950,7 +950,7 @@ void TSpreadsheet::mask2str(int riga)
|
|||||||
for(int dlg = id; pos >= 0; pos = sheet_mask().id2pos(dlg += 100))
|
for(int dlg = id; pos >= 0; pos = sheet_mask().id2pos(dlg += 100))
|
||||||
{
|
{
|
||||||
const TMask_field& f = sheet_mask().fld(pos);
|
const TMask_field& f = sheet_mask().fld(pos);
|
||||||
if (f.showed())
|
if (f.shown())
|
||||||
{
|
{
|
||||||
r.add(f.get());
|
r.add(f.get());
|
||||||
break;
|
break;
|
||||||
@ -1204,7 +1204,7 @@ void TSheet_field::create(WINDOW parent)
|
|||||||
|
|
||||||
_win = _sheet->win();
|
_win = _sheet->win();
|
||||||
enable_window(_win, enabled());
|
enable_window(_win, enabled());
|
||||||
show_window(_win, showed());
|
show_window(_win, shown());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
#define VERSION 1.1
|
#define VERSION 1.2
|
||||||
|
@ -74,19 +74,19 @@ char* format(const char* fmt, ...)
|
|||||||
|
|
||||||
const char* cmd2name(const char* argv0, const char* argv1)
|
const char* cmd2name(const char* argv0, const char* argv1)
|
||||||
{
|
{
|
||||||
TFilename app(argv0); app.ext(""); app = app.name();
|
TFilename app(argv0);
|
||||||
if (argv1 != NULL && *argv1 != '\0') app << ' ' << argv1;
|
app = app.name();
|
||||||
|
if (argv1 && *argv1) app << ' ' << argv1;
|
||||||
else app << " -0";
|
else app << " -0";
|
||||||
app.lower();
|
app.lower();
|
||||||
|
|
||||||
const int par = app.find(" -");
|
const int par = app.find(" -");
|
||||||
if (par > 0)
|
CHECKS(par > 0, "Bad command line: ", (const char*)app);
|
||||||
{
|
|
||||||
const int num = atoi(app.mid(par+2)) + 1;
|
const int num = atoi(app.mid(par+2)) + 1;
|
||||||
const char c = (num > 9) ? ('a'+num-10) : ('0'+num);
|
const char c = (num > 9) ? ('a'+num-10) : ('0'+num);
|
||||||
app.cut(par);
|
app.cut(3);
|
||||||
app << c << "00";
|
app << c << "00";
|
||||||
}
|
|
||||||
|
|
||||||
return strcpy(__tmp_string, app);
|
return strcpy(__tmp_string, app);
|
||||||
}
|
}
|
||||||
|
@ -1795,9 +1795,11 @@ bool TViswin::call_editor ()
|
|||||||
strcpy (fs.name, "");
|
strcpy (fs.name, "");
|
||||||
|
|
||||||
save_dir ();
|
save_dir ();
|
||||||
if (save_file_dlg (&fs, "Salva il file con il nome:") == FL_OK)
|
ok = save_file_dlg (&fs, "Salva il file con il nome:") == FL_OK;
|
||||||
|
restore_dir ();
|
||||||
|
|
||||||
|
if (ok)
|
||||||
{
|
{
|
||||||
restore_dir ();
|
|
||||||
char path[256];
|
char path[256];
|
||||||
dir_to_str (&fs.dir, path, sizeof (path));
|
dir_to_str (&fs.dir, path, sizeof (path));
|
||||||
newfilename = path;
|
newfilename = path;
|
||||||
@ -1813,13 +1815,12 @@ bool TViswin::call_editor ()
|
|||||||
newfilename.insert (" ", 0);
|
newfilename.insert (" ", 0);
|
||||||
newfilename.insert (editor, 0);
|
newfilename.insert (editor, 0);
|
||||||
TExternal_app edit (newfilename);
|
TExternal_app edit (newfilename);
|
||||||
if (edit.run (TRUE))
|
if (edit.run(TRUE))
|
||||||
beep ();
|
beep ();
|
||||||
else
|
else
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
restore_dir ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
warning_box ("Nessun editor specificato nei parametri studio");
|
warning_box ("Nessun editor specificato nei parametri studio");
|
||||||
@ -1831,7 +1832,6 @@ void TViswin::add_line (const char *l)
|
|||||||
if (_isopen && !_frozen)
|
if (_isopen && !_frozen)
|
||||||
{
|
{
|
||||||
if (_txt.frozen ()) // error writing files
|
if (_txt.frozen ()) // error writing files
|
||||||
|
|
||||||
{
|
{
|
||||||
close_print ();
|
close_print ();
|
||||||
return;
|
return;
|
||||||
@ -2025,7 +2025,7 @@ void TBrowsefile_field::create(WINDOW parent)
|
|||||||
_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());
|
enable_window(_win, enabled());
|
||||||
show_window(_win, showed());
|
show_window(_win, shown());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user