Ricostruito editor dei forms e corretta dis/abilitazione campi statici
git-svn-id: svn://10.65.10.50/trunk@783 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1654274d5b
commit
4fae71bdd7
@ -2,6 +2,10 @@
|
||||
|
||||
#include <xvt.h>
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <extcdecl.h>
|
||||
#include <modaut.h>
|
||||
|
||||
@ -306,6 +310,13 @@ void TApplication::terminate()
|
||||
delete _printer;
|
||||
_printer = NULL;
|
||||
}
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (fexist("prassi.hlp"))
|
||||
{
|
||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
WinHelp(hwnd, "prassi.hlp", HELP_QUIT, 0L);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (use_files())
|
||||
|
15
include/b3.h
15
include/b3.h
@ -9,9 +9,22 @@
|
||||
#define F_DISABLED 109
|
||||
#define F_AUTOMAGIC 110
|
||||
#define F_PICTURE 111
|
||||
#define F_GROUP 112
|
||||
#define F_FIELD 113
|
||||
#define F_FIELD2 114
|
||||
#define F_GROUP 130
|
||||
#define F_GROUP1 131
|
||||
#define F_GROUP2 132
|
||||
#define F_GROUP3 133
|
||||
#define F_GROUP4 134
|
||||
#define F_GROUP5 135
|
||||
#define F_GROUP6 136
|
||||
#define F_GROUP7 137
|
||||
#define F_GROUP8 138
|
||||
#define F_GROUP9 139
|
||||
#define F_GROUP10 140
|
||||
#define F_GROUP11 141
|
||||
#define F_GROUP12 142
|
||||
#define F_ITEMS 200
|
||||
#define F_DECIMALS 206
|
||||
|
||||
|
||||
|
298
include/b3.uml
298
include/b3.uml
@ -1,113 +1,213 @@
|
||||
#include <bagn003.h>
|
||||
|
||||
PAGE "CAMPO DI STAMPA" -1 -1 60 14
|
||||
TOOLBAR "" 0 20 0 2
|
||||
|
||||
LIST F_CLASS 10
|
||||
BEGIN
|
||||
PROMPT 1 1 "Tipo "
|
||||
FLAGS "D"
|
||||
ITEM "STRINGA|Testo" MESSAGE HIDE,2@,SHOW F_HEIGHT
|
||||
ITEM "NUMERO|Numero" MESSAGE SHOW,2@,HIDE F_HEIGHT
|
||||
ITEM "DATA|Data" MESSAGE HIDE,2@,SHOW F_HEIGHT
|
||||
ITEM "LISTA|Lista" MESSAGE HIDE,2@,SHOW F_HEIGHT
|
||||
END
|
||||
|
||||
STRING F_KEY 44
|
||||
BEGIN
|
||||
PROMPT 1 2 "Descrizione "
|
||||
HELP "Descrizione del campo da configurare"
|
||||
END
|
||||
|
||||
NUMBER F_Y 3
|
||||
BEGIN
|
||||
PROMPT 1 4 "Riga "
|
||||
HELP "Riga in cui stampare"
|
||||
END
|
||||
|
||||
NUMBER F_X 3
|
||||
BEGIN
|
||||
PROMPT 16 4 "Colonna "
|
||||
HELP "Colonna in cui stampare"
|
||||
END
|
||||
|
||||
NUMBER F_WIDTH 3
|
||||
BEGIN
|
||||
PROMPT 32 4 "Larghezza "
|
||||
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
|
||||
|
||||
STRING F_PROMPT 40
|
||||
BEGIN
|
||||
PROMPT 1 5 "Testo "
|
||||
HELP "Eventuale testo fisso da stampare"
|
||||
END
|
||||
|
||||
BOOLEAN F_HIDDEN
|
||||
BEGIN
|
||||
PROMPT 1 6 "Nascosto"
|
||||
HELP "Il campo va elaborato ma non stampato"
|
||||
END
|
||||
|
||||
BOOLEAN F_DISABLED
|
||||
BEGIN
|
||||
PROMPT 21 6 "Disabilitato"
|
||||
HELP "Il campo viene completamente ignorato e quindi nemmeno stampato"
|
||||
END
|
||||
|
||||
BOOLEAN F_AUTOMAGIC
|
||||
BEGIN
|
||||
PROMPT 41 6 "Automatico"
|
||||
HELP "Il campo viene calcolato automaticamente"
|
||||
END
|
||||
|
||||
STRING F_PICTURE 16
|
||||
BEGIN
|
||||
PROMPT 1 7 "Formato di stampa "
|
||||
HELP "Formato di stampa (vedere codici sul manuale)"
|
||||
END
|
||||
|
||||
STRING F_GROUP 16
|
||||
BEGIN
|
||||
PROMPT 1 8 "Gruppo di stampa "
|
||||
HELP "Numeri dei gruppi di appartenenza"
|
||||
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 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 9 2
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "CAMPO DI STAMPA" -1 -1 60 14
|
||||
|
||||
LIST F_CLASS 10
|
||||
BEGIN
|
||||
PROMPT 1 1 "Tipo "
|
||||
FLAGS "DG"
|
||||
ITEM "STRINGA|Testo" MESSAGE HIDE,2@|SHOW,F_HEIGHT|HIDE,F_ITEMS
|
||||
ITEM "NUMERO|Numero" MESSAGE SHOW,2@|HIDE,F_HEIGHT|HIDE,F_ITEMS
|
||||
ITEM "DATA|Data" MESSAGE HIDE,2@|HIDE,F_HEIGHT|HIDE,F_ITEMS
|
||||
ITEM "LISTA|Lista" MESSAGE HIDE,2@|HIDE,F_HEIGHT|SHOW,F_ITEMS
|
||||
END
|
||||
|
||||
STRING F_KEY 80 60
|
||||
BEGIN
|
||||
PROMPT 1 2 "Descrizione "
|
||||
HELP "Descrizione del campo da configurare"
|
||||
END
|
||||
|
||||
NUMBER F_Y 3
|
||||
BEGIN
|
||||
PROMPT 1 3 "Riga "
|
||||
HELP "Riga in cui stampare"
|
||||
END
|
||||
|
||||
NUMBER F_X 3
|
||||
BEGIN
|
||||
PROMPT 24 3 "Colonna "
|
||||
HELP "Colonna in cui stampare"
|
||||
END
|
||||
|
||||
NUMBER F_WIDTH 3
|
||||
BEGIN
|
||||
PROMPT 1 4 "Larghezza "
|
||||
HELP "Lunghezza massima da stampare"
|
||||
END
|
||||
|
||||
NUMBER F_HEIGHT 2
|
||||
BEGIN
|
||||
PROMPT 24 4 "Altezza "
|
||||
HELP "Righe massime su cui stampare"
|
||||
END
|
||||
|
||||
NUMBER F_DECIMALS 2
|
||||
BEGIN
|
||||
PROMPT 24 4 "Decimali "
|
||||
HELP "Numero di decimali"
|
||||
MESSAGE COPY,F_HEIGHT
|
||||
GROUP 2
|
||||
END
|
||||
|
||||
STRING F_PROMPT 80 60
|
||||
BEGIN
|
||||
PROMPT 1 5 "Testo "
|
||||
HELP "Eventuale testo fisso da stampare"
|
||||
END
|
||||
|
||||
STRING F_PICTURE 80 40
|
||||
BEGIN
|
||||
PROMPT 1 6 "Formato "
|
||||
HELP "Formato di stampa (vedere codici sul manuale)"
|
||||
END
|
||||
|
||||
STRING F_FIELD 40
|
||||
BEGIN
|
||||
PROMPT 1 7 "Campo su file "
|
||||
HELP "Nome del campo su file"
|
||||
END
|
||||
|
||||
STRING F_FIELD2 40
|
||||
BEGIN
|
||||
PROMPT 1 8 "II campo "
|
||||
HELP "Nome del campo su file da utilizzare se il primo e' vuoto"
|
||||
END
|
||||
|
||||
BOOLEAN F_HIDDEN
|
||||
BEGIN
|
||||
PROMPT 60 6 "Nascosto"
|
||||
HELP "Il campo va elaborato ma non stampato"
|
||||
END
|
||||
|
||||
BOOLEAN F_DISABLED
|
||||
BEGIN
|
||||
PROMPT 60 7 "Disabilitato"
|
||||
HELP "Il campo viene completamente ignorato e quindi nemmeno stampato"
|
||||
END
|
||||
|
||||
BOOLEAN F_AUTOMAGIC
|
||||
BEGIN
|
||||
PROMPT 60 8 "Automatico"
|
||||
HELP "Il campo viene calcolato automaticamente"
|
||||
END
|
||||
|
||||
GROUPBOX F_GROUP 78 3
|
||||
BEGIN
|
||||
PROMPT 1 9 "Gruppi di stampa"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP1
|
||||
BEGIN
|
||||
PROMPT 4 10 "1"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP2
|
||||
BEGIN
|
||||
PROMPT 10 10 "2"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP3
|
||||
BEGIN
|
||||
PROMPT 16 10 "3"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP4
|
||||
BEGIN
|
||||
PROMPT 22 10 "4"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP5
|
||||
BEGIN
|
||||
PROMPT 28 10 "5"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP6
|
||||
BEGIN
|
||||
PROMPT 34 10 "6"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP7
|
||||
BEGIN
|
||||
PROMPT 40 10 "7"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP8
|
||||
BEGIN
|
||||
PROMPT 46 10 "8"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP9
|
||||
BEGIN
|
||||
PROMPT 52 10 "9"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP10
|
||||
BEGIN
|
||||
PROMPT 58 10 "10"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP11
|
||||
BEGIN
|
||||
PROMPT 64 10 "11"
|
||||
END
|
||||
|
||||
BOOLEAN F_GROUP12
|
||||
BEGIN
|
||||
PROMPT 70 10 "12"
|
||||
END
|
||||
|
||||
SPREADSHEET F_ITEMS
|
||||
BEGIN
|
||||
PROMPT 0 12 "Spreadsheet"
|
||||
ITEM "Codice@8"
|
||||
ITEM "Testo@32"
|
||||
ITEM "Messaggio@80"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Spreadsheet" -1 -1 46 6
|
||||
|
||||
STRING 101 8
|
||||
BEGIN
|
||||
PROMPT 1 1 "Codice "
|
||||
END
|
||||
|
||||
STRING 102 32
|
||||
BEGIN
|
||||
PROMPT 1 2 "Testo "
|
||||
END
|
||||
|
||||
STRING 103 80 32
|
||||
BEGIN
|
||||
PROMPT 1 3 "Messaggio "
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
@ -167,11 +167,7 @@ void TControl::create(
|
||||
if (bold) title += 2;
|
||||
|
||||
const int prop_count = 1;
|
||||
const char* prop_list[prop_count+1] =
|
||||
{
|
||||
title,
|
||||
NULL
|
||||
};
|
||||
const char* prop_list[prop_count+1] = { title, NULL };
|
||||
|
||||
_id = id;
|
||||
_caption = title; _caption.strip("~");
|
||||
@ -339,6 +335,7 @@ TText::TText(short left, short top, short right, short bottom,
|
||||
void TText::update() const
|
||||
{
|
||||
TControl::update();
|
||||
win_set_fore_color(_hdc, COLOR_BLACK);
|
||||
win_draw_text(_hdc, _client.left, _client.top+BASEY, (char*)caption(), -1);
|
||||
}
|
||||
|
||||
@ -362,7 +359,7 @@ public:
|
||||
TGroup::TGroup(short left, short top, short right, short bottom,
|
||||
const char* caption, WINDOW parent,
|
||||
long flags, long app_data, short id)
|
||||
: TText(left, top, right, bottom, caption, parent, flags, app_data,
|
||||
: TText(left, top, right, bottom, caption, parent, flags | CTL_FLAG_DISABLED, app_data,
|
||||
(id < 0) ? -2 : id)
|
||||
{}
|
||||
|
||||
@ -905,7 +902,7 @@ void TCheckbox::update() const
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
RECT r;
|
||||
r.left = x-2; r.top = _client.top;
|
||||
r.right = _client.right; r.bottom = y+3;
|
||||
r.right = _client.right-CHARX; r.bottom = y+3;
|
||||
|
||||
HWND hwnd = (HWND)get_value(_hdc, ATTR_NATIVE_WINDOW);
|
||||
HDC hdc = GetDC(hwnd);
|
||||
|
495
include/form.cpp
495
include/form.cpp
@ -2,7 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <applicat.h>
|
||||
#include <mask.h>
|
||||
#include <msksheet.h>
|
||||
#include <form.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
@ -10,6 +10,14 @@
|
||||
|
||||
#include <bagn003.h>
|
||||
|
||||
static TForm* _form = NULL;
|
||||
|
||||
static TForm& form()
|
||||
{
|
||||
CHECK(_form, "Can't print NULL form");
|
||||
return *_form;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TForm_flags
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -26,8 +34,8 @@ protected:
|
||||
public:
|
||||
TForm_flags();
|
||||
|
||||
void to_mask(TMask& m) const;
|
||||
void from_mask(const TMask& m);
|
||||
void print_on(TMask& m);
|
||||
void read_from(const TMask& m);
|
||||
|
||||
bool update(const char* s);
|
||||
};
|
||||
@ -54,6 +62,7 @@ bool TForm_flags::update(const char* s)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void TForm_flags::print_on(ostream& out) const
|
||||
{
|
||||
TString16 s;
|
||||
@ -65,14 +74,16 @@ void TForm_flags::print_on(ostream& out) const
|
||||
if (s.not_empty()) out << " FLAGS \"" << s << '"' << endl;
|
||||
}
|
||||
|
||||
void TForm_flags::to_mask(TMask& m) const
|
||||
|
||||
void TForm_flags::print_on(TMask& m)
|
||||
{
|
||||
m.set(F_DISABLED, enabled ? " " : "X");
|
||||
m.set(F_HIDDEN, shown ? " " : "X");
|
||||
m.set(F_AUTOMAGIC, automagic ? "X" : " ");
|
||||
}
|
||||
|
||||
void TForm_flags::from_mask(const TMask& m)
|
||||
|
||||
void TForm_flags::read_from(const TMask& m)
|
||||
{
|
||||
shown = !m.get_bool(F_HIDDEN);
|
||||
enabled = !m.get_bool(F_DISABLED);
|
||||
@ -99,9 +110,6 @@ protected:
|
||||
virtual void print_on(ostream& out) const;
|
||||
virtual void print_body(ostream& out) const;
|
||||
|
||||
virtual void to_mask(TMask& m) const;
|
||||
virtual void from_mask(const TMask& m);
|
||||
|
||||
int width() const { return _width; }
|
||||
int height() const { return _height; }
|
||||
|
||||
@ -127,7 +135,9 @@ public:
|
||||
virtual bool parse(TScanner&);
|
||||
virtual bool update();
|
||||
|
||||
bool edit(TMaskmode mode);
|
||||
virtual void print_on(TMask& m);
|
||||
virtual void read_from(const TMask& m);
|
||||
bool edit(TMask& m);
|
||||
|
||||
TPrint_section* section() const { return _section; }
|
||||
|
||||
@ -148,6 +158,7 @@ TForm_item::TForm_item(TPrint_section* section)
|
||||
: _section(section), _x(-1), _y(-1), _width(0), _height(0)
|
||||
{}
|
||||
|
||||
|
||||
bool TForm_item::parse_head(TScanner& scanner)
|
||||
{
|
||||
_width = scanner.integer();
|
||||
@ -155,6 +166,7 @@ bool TForm_item::parse_head(TScanner& scanner)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void TForm_item::print_on(ostream& out) const
|
||||
{
|
||||
out << class_name();
|
||||
@ -171,6 +183,7 @@ void TForm_item::print_on(ostream& out) const
|
||||
out << "END\n" << endl;
|
||||
}
|
||||
|
||||
|
||||
void TForm_item::print_body(ostream& out) const
|
||||
{
|
||||
if (_y >= 0)
|
||||
@ -191,6 +204,7 @@ void TForm_item::print_body(ostream& out) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TForm_item::parse_item(TScanner& scanner)
|
||||
{
|
||||
if (scanner.key() == "PR")
|
||||
@ -298,7 +312,6 @@ void TForm_item::send_message(const TString& cmd, TForm_item& des) const
|
||||
val << get();
|
||||
des.set(val);
|
||||
} else
|
||||
|
||||
if (cmd == "DISABLE")
|
||||
{
|
||||
des.disable();
|
||||
@ -343,9 +356,9 @@ bool TForm_item::do_message(int num)
|
||||
const word id = msg.get_int(); // Get destination group
|
||||
|
||||
// Send the message to all fields with the given group
|
||||
for (int i = 0; i < section()->items(); i++)
|
||||
for (word i = 0; i < section()->fields(); i++)
|
||||
{
|
||||
TForm_item& des = section()->item(i);
|
||||
TForm_item& des = section()->field(i);
|
||||
if (des.in_group(id))
|
||||
send_message(cmd, des);
|
||||
}
|
||||
@ -365,10 +378,12 @@ bool TForm_item::update()
|
||||
void TForm_item::to_row(TToken_string& row) const
|
||||
{
|
||||
row = class_name();
|
||||
row.add(_y);
|
||||
row.add(_x);
|
||||
row.add(key());
|
||||
}
|
||||
|
||||
void TForm_item::to_mask(TMask& m) const
|
||||
void TForm_item::print_on(TMask& m)
|
||||
{
|
||||
m.set(F_CLASS, class_name());
|
||||
m.set(F_KEY, key());
|
||||
@ -377,14 +392,13 @@ void TForm_item::to_mask(TMask& m) const
|
||||
m.set(F_PROMPT, _prompt);
|
||||
m.set(F_WIDTH, _width);
|
||||
m.set(F_HEIGHT, _height);
|
||||
_flag.to_mask(m);
|
||||
|
||||
TString16 g;
|
||||
g << _group;
|
||||
m.set(F_GROUP, g);
|
||||
_flag.print_on(m);
|
||||
|
||||
for (int g = 1; g <= 12; g++)
|
||||
m.set(F_GROUP+g, _group[g] ? "X" : " ");
|
||||
}
|
||||
|
||||
void TForm_item::from_mask(const TMask& m)
|
||||
void TForm_item::read_from(const TMask& m)
|
||||
{
|
||||
_desc = m.get(F_KEY);
|
||||
_x = atoi(m.get(F_X));
|
||||
@ -392,18 +406,26 @@ void TForm_item::from_mask(const TMask& m)
|
||||
_prompt = m.get(F_PROMPT);
|
||||
_width = atoi(m.get(F_WIDTH));
|
||||
_height = atoi(m.get(F_HEIGHT));
|
||||
_flag.from_mask(m);
|
||||
_flag.read_from(m);
|
||||
|
||||
_group.reset();
|
||||
_group.set(m.get(F_GROUP));
|
||||
for (int g = 1; g <= 12; g++)
|
||||
_group.set(g, m.get_bool(F_GROUP+g));
|
||||
}
|
||||
|
||||
|
||||
bool TForm_item::edit(TMaskmode mode)
|
||||
bool TForm_item::edit(TMask& m)
|
||||
{
|
||||
TMask m("bagn003");
|
||||
to_mask(m);
|
||||
m.reset();
|
||||
|
||||
if (m.insert_mode()) m.enable(F_CLASS);
|
||||
else print_on(m);
|
||||
|
||||
const bool dirty = (m.run() == K_ENTER) && m.dirty();
|
||||
if (dirty) from_mask(m);
|
||||
|
||||
if (m.insert_mode()) m.disable(F_CLASS);
|
||||
else if (dirty) read_from(m);
|
||||
|
||||
return dirty;
|
||||
}
|
||||
|
||||
@ -421,8 +443,8 @@ protected:
|
||||
virtual const char* class_name() const { return "STRINGA"; }
|
||||
virtual void print_body(ostream& out) const;
|
||||
|
||||
virtual void to_mask(TMask& m) const;
|
||||
virtual void from_mask(const TMask& m);
|
||||
virtual void print_on(TMask& m);
|
||||
virtual void read_from(const TMask& m);
|
||||
|
||||
virtual bool parse_item(TScanner&);
|
||||
virtual bool update();
|
||||
@ -468,9 +490,9 @@ void TForm_string::print_body(ostream& out) const
|
||||
out << " FIELD " << field(i) << endl;
|
||||
}
|
||||
|
||||
void TForm_string::to_mask(TMask& m) const
|
||||
void TForm_string::print_on(TMask& m)
|
||||
{
|
||||
TForm_item::to_mask(m);
|
||||
TForm_item::print_on(m);
|
||||
for (int i = 0; i < 2; i++) if (i < _field.items())
|
||||
{
|
||||
TString80 f;
|
||||
@ -481,9 +503,9 @@ void TForm_string::to_mask(TMask& m) const
|
||||
m.set(F_PICTURE, _picture);
|
||||
}
|
||||
|
||||
void TForm_string::from_mask(const TMask& m)
|
||||
void TForm_string::read_from(const TMask& m)
|
||||
{
|
||||
TForm_item::from_mask(m);
|
||||
TForm_item::read_from(m);
|
||||
_picture = m.get(F_PICTURE);
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
@ -643,7 +665,9 @@ class TForm_list : public TForm_string
|
||||
|
||||
protected:
|
||||
virtual const char* class_name() const { return "LISTA"; }
|
||||
virtual bool parse_item(TScanner& scanner);
|
||||
virtual bool parse_item(TScanner& scanner);
|
||||
virtual void print_on(TMask& m);
|
||||
virtual void read_from(const TMask& m);
|
||||
virtual void print_body(ostream& out) const;
|
||||
virtual bool update();
|
||||
|
||||
@ -677,6 +701,37 @@ bool TForm_list::parse_item(TScanner& scanner)
|
||||
return TForm_string::parse_item(scanner);
|
||||
}
|
||||
|
||||
void TForm_list::print_on(TMask& m)
|
||||
{
|
||||
TForm_string::print_on(m);
|
||||
TSheet_field& s = (TSheet_field&)m.field(F_ITEMS);
|
||||
|
||||
_codes.restart(); _values.restart();
|
||||
for (int i = 0; i < _codes.items(); i++)
|
||||
{
|
||||
TToken_string& row = s.row(i);
|
||||
row = _codes.get();
|
||||
row.add(_values.get());
|
||||
row.add(message(i));
|
||||
}
|
||||
s.force_update();
|
||||
}
|
||||
|
||||
void TForm_list::read_from(const TMask& m)
|
||||
{
|
||||
TForm_string::read_from(m);
|
||||
|
||||
TSheet_field& s = (TSheet_field&)m.field(F_ITEMS);
|
||||
|
||||
_codes = _values = "";
|
||||
for (int i = 0; i < s.items(); i++)
|
||||
{
|
||||
TToken_string& row = s.row(i);
|
||||
_codes.add(row.get(0));
|
||||
_values.add(row.get());
|
||||
message(i) = row.get();
|
||||
}
|
||||
}
|
||||
|
||||
void TForm_list::print_body(ostream& out) const
|
||||
{
|
||||
@ -713,11 +768,10 @@ bool TForm_list::update()
|
||||
const int pos = _codes.get_pos(val);
|
||||
if (pos < 0)
|
||||
{
|
||||
ok = yesnofatal_box("Il campo '%s' non puo' valere '%s'",
|
||||
(const char*)key(), (const char*)val);
|
||||
}
|
||||
|
||||
do_message(pos);
|
||||
ok = error_box("Il campo '%s' non puo' valere '%s'",
|
||||
(const char*)key(), (const char*)val);
|
||||
}
|
||||
else do_message(pos);
|
||||
|
||||
if (!hidden())
|
||||
{
|
||||
@ -734,17 +788,9 @@ bool TForm_list::update()
|
||||
// TPrint_section
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
void TPrint_section::init(const char* name, TForm* f)
|
||||
{
|
||||
_name = name;
|
||||
_form = f;
|
||||
}
|
||||
|
||||
TPrint_section::TPrint_section(const char* name, TForm* f)
|
||||
: _height(0)
|
||||
{
|
||||
init(name, f);
|
||||
}
|
||||
TPrint_section::TPrint_section(TForm* f)
|
||||
: _height(0), _form(f)
|
||||
{}
|
||||
|
||||
TPrintrow& TPrint_section::row(int num)
|
||||
{
|
||||
@ -757,31 +803,33 @@ TPrintrow& TPrint_section::row(int num)
|
||||
return *pr;
|
||||
}
|
||||
|
||||
TForm_item* TPrint_section::parse_item(TScanner& scanner)
|
||||
|
||||
TForm_item* TPrint_section::parse_item(const TString& s)
|
||||
{
|
||||
if (scanner.key() == "ST")
|
||||
if (s == "ST")
|
||||
return new TForm_string(this);
|
||||
if (scanner.key() == "NU")
|
||||
if (s == "NU")
|
||||
return new TForm_number(this);
|
||||
if (scanner.key() == "DA")
|
||||
if (s == "DA")
|
||||
return new TForm_date(this);
|
||||
if (scanner.key() == "LI")
|
||||
if (s == "LI")
|
||||
return new TForm_list(this);
|
||||
|
||||
#ifdef DBG
|
||||
yesnofatal_box("Elemento sconosciuto nella sezione '%s': '%s'",
|
||||
(const char*)_name, (const char*)scanner.token());
|
||||
#endif
|
||||
|
||||
CHECKS(NULL, "Elemento di stampa sconosciuto: ", (const char*)s);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
TForm_item* TPrint_section::parse_item(TScanner& scanner)
|
||||
{
|
||||
return parse_item(scanner.key());
|
||||
}
|
||||
|
||||
|
||||
bool TPrint_section::parse(TScanner& scanner)
|
||||
{
|
||||
_height = scanner.integer();
|
||||
|
||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
|
||||
while (scanner.popkey() != "EN")
|
||||
{
|
||||
TForm_item *fi = parse_item(scanner);
|
||||
@ -792,63 +840,102 @@ bool TPrint_section::parse(TScanner& scanner)
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
set_cursor(TASK_WIN, CURSOR_ARROW);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void TPrint_section::reset()
|
||||
{
|
||||
for (word i = 0; i < height(); i++)
|
||||
row(i).reset();
|
||||
}
|
||||
|
||||
bool TPrint_section::update()
|
||||
{
|
||||
destroy();
|
||||
const int last = _item.items();
|
||||
bool ok = TRUE;
|
||||
for (int i = 0; i < last; i++)
|
||||
|
||||
reset();
|
||||
for (word i = 0; i < fields(); i++)
|
||||
{
|
||||
bool esito = ((TForm_item&)_item[i]).update();
|
||||
const bool esito = field(i).update();
|
||||
if (!esito) ok = FALSE;
|
||||
}
|
||||
i = items();
|
||||
if (i < _height) row(_height-1);
|
||||
else if (i > _height)
|
||||
ok = warning_box("Sezione %s troppo lunga: %d > %d",
|
||||
(const char*)_name, i, _height);
|
||||
|
||||
const word l = last()-1;
|
||||
if (l >= _height)
|
||||
ok = warning_box("Sezione troppo lunga: %d > %d", l, _height);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TPrint_section::edit(int mode)
|
||||
{
|
||||
TString80 title;
|
||||
title = "Campi della sezione "; title << _name;
|
||||
|
||||
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Descrizione@40", 0x8);
|
||||
bool TPrint_section::edit()
|
||||
{
|
||||
TMask m("bagn003");
|
||||
|
||||
for (int i = 0; i < items(); i++)
|
||||
TString80 title("Campi della sezione");
|
||||
|
||||
TArray_sheet a(-1, -1, 0, 0, title, "Tipo@8|Riga|Col.|Descrizione@80", 0xE);
|
||||
|
||||
for (word i = 0; i < fields(); i++)
|
||||
{
|
||||
TToken_string s(64);
|
||||
item(i).to_row(s);
|
||||
TToken_string* s = new TToken_string(128);
|
||||
field(i).to_row(*s);
|
||||
a.add(s);
|
||||
}
|
||||
|
||||
bool dirty = FALSE;
|
||||
while (a.run() == K_ENTER)
|
||||
{
|
||||
i = (int)a.selected();
|
||||
const bool spork = item(i).edit((TMaskmode)mode);
|
||||
if (spork)
|
||||
bool dirty = FALSE;
|
||||
KEY k;
|
||||
do
|
||||
{
|
||||
k = a.run();
|
||||
i = (word)a.selected();
|
||||
|
||||
switch(k)
|
||||
{
|
||||
dirty = TRUE;
|
||||
item(i).to_row(a.row(i));
|
||||
}
|
||||
}
|
||||
case K_ENTER:
|
||||
m.set_mode(MODE_MOD);
|
||||
if (field(i).edit(m))
|
||||
{
|
||||
dirty = TRUE;
|
||||
field(i).to_row(a.row(i));
|
||||
}
|
||||
break;
|
||||
case K_INS:
|
||||
{
|
||||
m.set_mode(MODE_INS);
|
||||
TForm_string dummy(this);
|
||||
if (dummy.edit(m))
|
||||
{
|
||||
const TString& c = m.get(F_CLASS).left(2);
|
||||
TForm_item* item = parse_item(c);
|
||||
item->read_from(m);
|
||||
_item.insert(item, i);
|
||||
|
||||
TToken_string s(128); item->to_row(s);
|
||||
a.insert(s, i);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case K_DEL:
|
||||
if (yesno_box("Confermare la cancellazione"))
|
||||
{
|
||||
_item.destroy(i, TRUE);
|
||||
a.destroy(i);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} while (k != K_ESC);
|
||||
|
||||
return dirty;
|
||||
}
|
||||
|
||||
void TPrint_section::print_on(ostream& out) const
|
||||
{
|
||||
out << "\nPAGE " << _name << ' ' << _height << '\n' << endl;
|
||||
for(int i = 0; i < items(); i++)
|
||||
out << item(i);
|
||||
out << _height << endl;
|
||||
for(word i = 0; i < fields(); i++)
|
||||
out << field(i);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -933,96 +1020,189 @@ bool TForm::parse_join(TScanner& scanner)
|
||||
}
|
||||
|
||||
|
||||
bool TForm::set_header()
|
||||
TPrint_section& TForm::page2pos(const TArray& s, word p) const
|
||||
{
|
||||
pagetype pos = odd_page;
|
||||
if (p == 0 && s.objptr(last_page)) pos = last_page;
|
||||
if (p == 1 && s.objptr(first_page)) pos = first_page;
|
||||
if (pos == 0 && (p & 0x1) == 0 && s.objptr(even_page)) pos = even_page;
|
||||
return (TPrint_section&)s[pos];
|
||||
}
|
||||
|
||||
word TForm::set_header(word p, bool u)
|
||||
{
|
||||
TPrinter& printer = main_app().printer();
|
||||
printer.resetheader();
|
||||
|
||||
const bool ok = _head.update();
|
||||
TPrint_section& head = page2pos(_head, p);
|
||||
|
||||
if (u) head.update();
|
||||
else head.reset();
|
||||
|
||||
for (word j = 0; j < head.height(); j++)
|
||||
printer.setheaderline(j, head.row(j));
|
||||
|
||||
const int last = _head.last();
|
||||
for (int j = 0; j <= last; j++)
|
||||
printer.setheaderline(j, _head.row(j));
|
||||
|
||||
return ok;
|
||||
return head.height();
|
||||
}
|
||||
|
||||
word TForm::set_body(word p, bool u)
|
||||
{
|
||||
TPrint_section& body = page2pos(_body, p);
|
||||
|
||||
if (u) body.update();
|
||||
else body.reset();
|
||||
|
||||
if (u)
|
||||
{
|
||||
TPrinter& printer = main_app().printer();
|
||||
for (word j = 0; j < body.height(); j++)
|
||||
printer.print(body.row(j));
|
||||
}
|
||||
|
||||
return body.height();
|
||||
}
|
||||
|
||||
bool TForm::set_footer()
|
||||
word TForm::set_footer(word p, bool u)
|
||||
{
|
||||
TPrinter& printer = main_app().printer();
|
||||
printer.resetfooter();
|
||||
|
||||
const bool ok = _foot.update();
|
||||
TPrint_section& foot = page2pos(_foot, p);
|
||||
|
||||
if (u) foot.update();
|
||||
else foot.reset();
|
||||
|
||||
for (word j = 0; j < foot.height(); j++)
|
||||
printer.setfooterline(j, foot.row(j));
|
||||
|
||||
const int last = _foot.last();
|
||||
for (int j = 0; j <= last; j++)
|
||||
printer.setfooterline(j, _foot.row(j));
|
||||
return foot.height();
|
||||
}
|
||||
|
||||
return ok;
|
||||
void TForm::header_handler(TPrinter& p)
|
||||
{
|
||||
const word page = form().page(p);
|
||||
form().set_header(page, TRUE);
|
||||
form().set_footer(page, FALSE);
|
||||
}
|
||||
|
||||
void TForm::footer_handler(TPrinter& p)
|
||||
{
|
||||
const word page = form().page(p);
|
||||
form().set_footer(page, TRUE);
|
||||
if (page)
|
||||
form().set_header(page+1, FALSE);
|
||||
}
|
||||
|
||||
|
||||
word TForm::page(const TPrinter& p) const
|
||||
{
|
||||
return _lastpage ? 0 : p.getcurrentpage();
|
||||
}
|
||||
|
||||
long TForm::records() const
|
||||
{
|
||||
const long r = _cursor ? _cursor->items() : 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Stampa gli items dal from a to
|
||||
// se to < 0 stampa fino alla fine del file
|
||||
|
||||
bool TForm::print(long from, long to)
|
||||
{
|
||||
{
|
||||
CHECK(form == NULL, "Can't print two forms");
|
||||
_form = this;
|
||||
_lastpage = FALSE;
|
||||
|
||||
TPrinter& printer = main_app().printer();
|
||||
printer.setheaderhandler(header_handler);
|
||||
printer.setfooterhandler(footer_handler);
|
||||
|
||||
const bool was_open = printer.isopen();
|
||||
|
||||
if (!was_open && !printer.open())
|
||||
return FALSE;
|
||||
|
||||
if (to < 0) to = _cursor->items()-1;
|
||||
|
||||
bool ok = set_header() && set_footer();
|
||||
if (to < 0) to = records()-1;
|
||||
|
||||
bool ok = TRUE;
|
||||
|
||||
for (long i = from; i <= to && ok; i++)
|
||||
{
|
||||
if (from < 0) to = from;
|
||||
else *_cursor = i;
|
||||
else if (_cursor) *_cursor = i;
|
||||
|
||||
const word h = set_body(page(printer), FALSE);
|
||||
if (h > printer.rows_left())
|
||||
printer.formfeed();
|
||||
|
||||
ok &= _body.update();
|
||||
if (!ok) ok = yesno_box("Stampo ugualmente");
|
||||
if (!ok) break;
|
||||
|
||||
const word last = _body.last()+1;
|
||||
if (last < printer.rows() && last > printer.rows_left())
|
||||
ok = printer.formfeed();
|
||||
for (word j = 0; j < last && ok; j++)
|
||||
ok = printer.print(_body.row(j));
|
||||
set_body(page(printer), TRUE);
|
||||
}
|
||||
|
||||
|
||||
if (i > records())
|
||||
{
|
||||
if (_head.objptr(last_page) || _body.objptr(last_page) || _foot.objptr(last_page))
|
||||
{
|
||||
_lastpage = TRUE;
|
||||
set_header(0, TRUE);
|
||||
set_body(0, TRUE);
|
||||
printer.formfeed();
|
||||
}
|
||||
}
|
||||
|
||||
if (!was_open)
|
||||
printer.close();
|
||||
|
||||
_form = NULL;
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TForm::print_section(ostream& out, const TArray& s, const char* name) const
|
||||
{
|
||||
for (pagetype t = odd_page; t <= last_page; t = pagetype(t+1)) if (s.objptr(t))
|
||||
{
|
||||
out << "SECTION " << name << ' ' << int(t);
|
||||
out << s[t];
|
||||
out << "END\n" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
void TForm::print_on(ostream& out) const
|
||||
{
|
||||
if (relation())
|
||||
out << *relation() << endl;
|
||||
|
||||
print_section(out, _head, "HEADER");
|
||||
print_section(out, _body, "BODY");
|
||||
print_section(out, _foot, "FOOTER");
|
||||
|
||||
out << "END" << endl;
|
||||
}
|
||||
|
||||
TPrint_section& TForm::section(char s, pagetype t)
|
||||
{
|
||||
out << *_cursor->relation() << endl;
|
||||
if (_head.items()) out << _head;
|
||||
if (_body.items()) out << _body;
|
||||
if (_foot.items()) out << _foot;
|
||||
out << "ENDPAGE" << endl;
|
||||
TArray* a = NULL;
|
||||
switch (s)
|
||||
{
|
||||
case 'H':
|
||||
a = &_head; break;
|
||||
case 'F':
|
||||
a = &_foot; break;
|
||||
default:
|
||||
a = &_body; break;
|
||||
}
|
||||
|
||||
TPrint_section* sec = (TPrint_section*)a->objptr(t);
|
||||
if (sec == NULL) a->add(sec = new TPrint_section(this));
|
||||
return (TPrint_section&)*sec;
|
||||
}
|
||||
|
||||
|
||||
bool TForm::edit(int mode, int section)
|
||||
bool TForm::edit(char s, pagetype t)
|
||||
{
|
||||
bool dirty = FALSE;
|
||||
|
||||
switch (section)
|
||||
{
|
||||
case 0:
|
||||
dirty = _head.edit(mode); break;
|
||||
case 2:
|
||||
dirty = _foot.edit(mode); break;
|
||||
default:
|
||||
dirty = _body.edit(mode); break;
|
||||
}
|
||||
|
||||
section(s, t).edit();
|
||||
|
||||
if (dirty && yesno_box("Salvare le modifiche?"))
|
||||
{
|
||||
@ -1038,35 +1218,36 @@ bool TForm::edit(int mode, int section)
|
||||
}
|
||||
|
||||
|
||||
|
||||
TForm::TForm(const char* name) : _name(name)
|
||||
TForm::TForm(const char* name)
|
||||
: _name(name), _relation(NULL), _cursor(NULL)
|
||||
{
|
||||
const CURSOR oldcur = get_cursor(TASK_WIN);
|
||||
set_cursor(TASK_WIN, CURSOR_WAIT);
|
||||
|
||||
_name.ext("frm");
|
||||
TScanner scanner(_name);
|
||||
|
||||
bool ok = FALSE;
|
||||
bool ok = TRUE;
|
||||
if (scanner.popkey() == "US")
|
||||
ok = parse_use(scanner);
|
||||
|
||||
CHECKS(ok, "Missing USE in form: ", name);
|
||||
|
||||
while (ok && scanner.popkey() == "JO")
|
||||
ok = parse_join(scanner);
|
||||
scanner.push();
|
||||
|
||||
_head.init("HEADER", this);
|
||||
_body.init("BODY", this);
|
||||
_foot.init("FOOTER", this);
|
||||
|
||||
while (scanner.popkey() == "PA")
|
||||
{
|
||||
scanner.pop();
|
||||
if (scanner.token() == "HEADER") _head.parse(scanner); else
|
||||
if (scanner.token() == "BODY") _body.parse(scanner); else
|
||||
if (scanner.token() == "FOOTER") _foot.parse(scanner);
|
||||
ok = parse_use(scanner);
|
||||
while (ok && scanner.popkey() == "JO")
|
||||
ok = parse_join(scanner);
|
||||
}
|
||||
scanner.push();
|
||||
|
||||
while (scanner.popkey() != "" && ok)
|
||||
{
|
||||
const char sec = scanner.key()[0];
|
||||
const pagetype p = (pagetype)scanner.integer();
|
||||
TPrint_section& ps = section(sec, p);
|
||||
ok = ps.parse(scanner);
|
||||
}
|
||||
|
||||
set_cursor(TASK_WIN, oldcur);
|
||||
}
|
||||
|
||||
|
||||
TForm::~TForm()
|
||||
{
|
||||
if (_cursor)
|
||||
|
@ -5,73 +5,92 @@
|
||||
#include <printer.h>
|
||||
#endif
|
||||
|
||||
#ifndef __SCANNER_H
|
||||
#include <scanner.h>
|
||||
#endif
|
||||
|
||||
#ifndef __RELATION_H
|
||||
class TRelation;
|
||||
class TCursor;
|
||||
#endif
|
||||
|
||||
#ifndef __SCANNER_H
|
||||
#include <scanner.h>
|
||||
#endif
|
||||
enum pagetype { odd_page, even_page, first_page, last_page };
|
||||
|
||||
class TForm;
|
||||
class TForm_item;
|
||||
|
||||
class TPrint_section : public TArray
|
||||
{
|
||||
TString16 _name; // Nome della sezione di stampa
|
||||
int _height; // Altezza della sezione
|
||||
word _height; // Altezza della sezione
|
||||
|
||||
TForm* _form; // Form cui appartiene alla sezione
|
||||
TArray _item; // Lista dei campi da stampare
|
||||
|
||||
protected:
|
||||
virtual void print_on(ostream& out) const;
|
||||
TForm_item* parse_item(const TString& key);
|
||||
TForm_item* parse_item(TScanner& scanner);
|
||||
|
||||
public:
|
||||
TPrintrow& row(int num);
|
||||
TForm* form() const { return _form; }
|
||||
|
||||
TForm_item& item(int n) const { return (TForm_item&)_item[n]; }
|
||||
int items() const { return _item.items(); }
|
||||
|
||||
TForm_item& field(int n) const { return (TForm_item&)_item[n]; }
|
||||
word fields() const { return _item.items(); }
|
||||
word height() const { return _height; }
|
||||
|
||||
void reset();
|
||||
bool update();
|
||||
bool parse(TScanner& scanner);
|
||||
|
||||
bool edit(int mode);
|
||||
bool edit();
|
||||
|
||||
TPrint_section(const char* name = "", TForm* form = NULL);
|
||||
void init(const char* name, TForm* form);
|
||||
TPrint_section(TForm* parent);
|
||||
virtual ~TPrint_section() {}
|
||||
};
|
||||
|
||||
|
||||
class TForm : public TObject
|
||||
{
|
||||
TFilename _name;
|
||||
{
|
||||
TFilename _name; // Profile name
|
||||
|
||||
TRelation* _relation;
|
||||
TCursor* _cursor;
|
||||
TRelation* _relation; // Can be NULL
|
||||
TCursor* _cursor; // Can be NULL
|
||||
|
||||
TPrint_section _head;
|
||||
TPrint_section _body;
|
||||
TPrint_section _foot;
|
||||
TArray _head; // Headers
|
||||
TArray _body; // Bodies
|
||||
TArray _foot; // Footers
|
||||
|
||||
bool _lastpage;
|
||||
|
||||
TPrint_section& page2pos(const TArray& a, word p) const;
|
||||
|
||||
static void header_handler(TPrinter& p);
|
||||
static void footer_handler(TPrinter& p);
|
||||
|
||||
protected:
|
||||
TPrint_section& section(char s, pagetype t); // H = Header, B = Body, F = Footer
|
||||
|
||||
void print_section(ostream& out, const TArray& s, const char* name) const;
|
||||
virtual void print_on(ostream& out) const;
|
||||
|
||||
bool parse_use(TScanner&);
|
||||
bool parse_join(TScanner&);
|
||||
|
||||
bool set_header();
|
||||
bool set_footer();
|
||||
|
||||
word page(const TPrinter& p) const;
|
||||
|
||||
virtual long records() const;
|
||||
virtual word set_header(word p, bool u);
|
||||
virtual word set_body(word p, bool u);
|
||||
virtual word set_footer(word p, bool u);
|
||||
|
||||
public:
|
||||
bool print(long from = 0L, long to = -1L);
|
||||
|
||||
TRelation* relation() const { return _relation; }
|
||||
TCursor* cursor() const { return _cursor; }
|
||||
|
||||
bool edit(int mode, int section = 1);
|
||||
bool edit(char section, pagetype t);
|
||||
|
||||
TForm(const char* form);
|
||||
~TForm();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: maskfld.cpp,v 1.62 1994-12-16 15:49:54 guy Exp $
|
||||
// $Id: maskfld.cpp,v 1.63 1994-12-20 15:11:11 guy Exp $
|
||||
#include <xvt.h>
|
||||
|
||||
#include <applicat.h>
|
||||
@ -282,8 +282,8 @@ int TMask_field::create_prompt(WINDOW parent, int width, int heigth)
|
||||
|
||||
if (width)
|
||||
{
|
||||
// Static controls shouldn't be grayed
|
||||
const long flags = default_flags() & (~CTL_FLAG_DISABLED);
|
||||
const long flags = default_flags() & (~CTL_FLAG_DISABLED); // Static controls shouldn't be grayed
|
||||
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
char* k = strchr(_prompt, '~');
|
||||
if (k != NULL) *k = '&';
|
||||
@ -745,10 +745,17 @@ bool TMask_field::on_key(KEY key)
|
||||
send_key(key, 0);
|
||||
break;
|
||||
case K_F1:
|
||||
if (_help.not_empty())
|
||||
message_box(_help);
|
||||
else
|
||||
beep();
|
||||
#if XVT_OS == XVT_OS_WIN
|
||||
if (fexist("prassi.hlp"))
|
||||
{
|
||||
HWND hwnd = (HWND)get_value(TASK_WIN, ATTR_NATIVE_WINDOW);
|
||||
WinHelp(hwnd, "prassi.hlp", HELP_KEY, (DWORD)(const char*)mask().source_file());
|
||||
} else
|
||||
#endif
|
||||
if (_help.not_empty())
|
||||
message_box(_help);
|
||||
else
|
||||
beep();
|
||||
break;
|
||||
case K_F2:
|
||||
if (is_edit()) set("");
|
||||
|
@ -1 +1 @@
|
||||
#define VERSION 1.2
|
||||
#define VERSION 1.1
|
||||
|
@ -5,14 +5,6 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ARRAY_H
|
||||
#include <array.h>
|
||||
#endif
|
||||
|
||||
#ifndef __VISWIN_H
|
||||
#include <viswin.h>
|
||||
#endif
|
||||
@ -269,7 +261,7 @@ public:
|
||||
TPrtype printtype() { return _printertype; }
|
||||
void set_printtype(TPrtype dest) { _printertype=dest; }
|
||||
void set_printerfile(const char * ffile) { _printerfile=ffile; }
|
||||
word getcurrentpage() { return _currentpage; }
|
||||
word getcurrentpage() const { return _currentpage; }
|
||||
void setcurrentpage(word n) { _currentpage = n; }
|
||||
// dirige la stampa sul file specificato, preservando gli attributi di formato
|
||||
// se header == TRUE si stampano su file anche gli header
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: relation.cpp,v 1.26 1994-12-07 11:10:50 guy Exp $
|
||||
// $Id: relation.cpp,v 1.27 1994-12-20 15:11:20 guy Exp $
|
||||
// relation.cpp
|
||||
// fv 12/8/93
|
||||
// relation class for isam files
|
||||
@ -20,6 +20,7 @@
|
||||
// *** maximum number of elements in a cursor working page
|
||||
#define CMAXELPAGE 8000
|
||||
|
||||
#define print_name(out, f) out << (f.num() == LF_TABCOM ? "%" : "") << f.name()
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRelationdef
|
||||
@ -44,6 +45,7 @@ class TRelationdef : public TObject
|
||||
|
||||
protected:
|
||||
virtual void print_on(ostream& out) const;
|
||||
void print_on(TToken_string& out) const;
|
||||
|
||||
public:
|
||||
// @FPUB
|
||||
@ -62,20 +64,6 @@ public:
|
||||
// @END
|
||||
|
||||
|
||||
HIDDEN ostream& print_name(ostream& out, const TLocalisamfile& f)
|
||||
{
|
||||
const int logicnum = f.num();
|
||||
if (logicnum == LF_TABCOM || logicnum == LF_TAB)
|
||||
{
|
||||
if (logicnum == LF_TABCOM) out << '%';
|
||||
out << ((TTable&)f).name();
|
||||
}
|
||||
else
|
||||
out << logicnum;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
|
||||
int idx_to, const char* relexprs, byte alias,
|
||||
bool allow_lock, bool write_enable)
|
||||
@ -126,14 +114,21 @@ TRelationdef::TRelationdef(const TRelation* rel, int idx_file, byte key,
|
||||
|
||||
void TRelationdef::print_on(ostream& out) const
|
||||
{
|
||||
out << "JOIN "; print_name(out, _rel->file(_num));
|
||||
const TLocalisamfile& f = _rel->file(_num);
|
||||
|
||||
out << "JOIN ";
|
||||
print_name(out, f);
|
||||
|
||||
if (_numto > 0)
|
||||
{
|
||||
out << " TO ";
|
||||
const int alias = _rel->reldef(_numto-1).alias();
|
||||
if (alias > 0) out << alias << '@';
|
||||
else print_name(out, _rel->file(_numto));
|
||||
else
|
||||
{
|
||||
const TLocalisamfile& t = _rel->file(_numto);
|
||||
print_name(out, t);
|
||||
}
|
||||
}
|
||||
|
||||
if (_key > 1) out << " KEY " << (int)_key;
|
||||
@ -148,6 +143,35 @@ void TRelationdef::print_on(ostream& out) const
|
||||
}
|
||||
|
||||
|
||||
void TRelationdef::print_on(TToken_string& out) const
|
||||
{
|
||||
const TLocalisamfile& f = _rel->file(_num);
|
||||
|
||||
out = "";
|
||||
print_name(out, f);
|
||||
out << '|';
|
||||
|
||||
if (_numto > 0)
|
||||
{
|
||||
const int alias = _rel->reldef(_numto-1).alias();
|
||||
if (alias > 0)
|
||||
out << alias << '@';
|
||||
else
|
||||
{
|
||||
const TLocalisamfile& t = _rel->file(_numto);
|
||||
print_name(out, t);
|
||||
}
|
||||
}
|
||||
out.add(_key);
|
||||
out.add(_alias);
|
||||
out << '|';
|
||||
for (int i = 0; i < _fields.items(); i++)
|
||||
{
|
||||
if (i) out << ' ';
|
||||
out << _fields[i] << '=' << _exprs[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRelation
|
||||
@ -184,6 +208,22 @@ void TRelation::print_on(ostream& out) const
|
||||
out << _reldefs[r] << endl;
|
||||
}
|
||||
|
||||
void TRelation::print_on(TArray& a) const
|
||||
{
|
||||
const TLocalisamfile& f = file();
|
||||
TToken_string s(128);
|
||||
print_name(s, f);
|
||||
s.add(f.getkey());
|
||||
|
||||
a.destroy();
|
||||
a.add(s, 0);
|
||||
for (int i = 0; i < _reldefs.items(); i++)
|
||||
{
|
||||
((TRelationdef&)_reldefs[i]).print_on(s);
|
||||
a.add(s, i+1);
|
||||
}
|
||||
}
|
||||
|
||||
void TRelation::restore_status()
|
||||
{
|
||||
_status.restart();
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: relation.h,v 1.8 1994-10-20 13:32:24 guy Exp $ */
|
||||
/* $Id: relation.h,v 1.9 1994-12-20 15:11:23 guy Exp $ */
|
||||
// join.h
|
||||
// fv 12/8/93
|
||||
// join class for isam files
|
||||
@ -6,10 +6,6 @@
|
||||
#ifndef __RELATION_H
|
||||
#define __RELATION_H
|
||||
|
||||
#ifndef __ARRAY_H
|
||||
#include <array.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ISAM_H
|
||||
#include <isam.h>
|
||||
#endif
|
||||
@ -132,6 +128,8 @@ public:
|
||||
TRecnotype operator -=(const TRecnotype npos) { return skip(-npos); }
|
||||
TRecnotype operator ++() { return next(); }
|
||||
TRecnotype operator --() { return prev(); }
|
||||
|
||||
void print_on(TArray& a) const; // Mette la descrizione in un array di TToken_string
|
||||
|
||||
TRelation(int logicnum, bool linkrecinst = TRUE);
|
||||
TRelation(const char* tabname, bool linkrecinst = FALSE);
|
||||
|
@ -7,9 +7,7 @@
|
||||
|
||||
int TTable::name2log(const char* n)
|
||||
{
|
||||
return *n == '%' ? LF_TABCOM :
|
||||
*n == '#' ? LF_TABGEN :
|
||||
LF_TAB;
|
||||
return *n == '%' ? LF_TABCOM : (*n == '#' ? LF_TABGEN : LF_TAB);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
#ifndef __TEXTFILE_H
|
||||
#define __TEXTFILE_H
|
||||
|
||||
#ifndef __STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ARRAY_H
|
||||
#include <array.h>
|
||||
#endif
|
||||
@ -10,10 +14,6 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifndef __STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOW_H
|
||||
#include <window.h>
|
||||
#endif
|
||||
|
@ -81,9 +81,8 @@ const char* cmd2name(const char* argv0, const char* argv1)
|
||||
app.lower();
|
||||
|
||||
const int par = app.find(" -");
|
||||
CHECKS(par > 0, "Bad command line: ", (const char*)app);
|
||||
const int num = par > 0 ? atoi(app.mid(par+2))+1 : 1;
|
||||
|
||||
const int num = atoi(app.mid(par+2)) + 1;
|
||||
const char c = (num > 9) ? ('a'+num-10) : ('0'+num);
|
||||
app.cut(3);
|
||||
app << c << "00";
|
||||
|
Loading…
x
Reference in New Issue
Block a user