From 86bd8244c465fa1aa63c92a6e38f954435e1b664 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 Aug 1994 13:04:28 +0000 Subject: [PATCH] Aggiornato ba0 in base alla moderna gestione dei bottoni delle maschere~aere git-svn-id: svn://10.65.10.50/trunk@63 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba0.cpp | 446 ++++++++++++++++++++++++------------------------ ba/ba2300a.uml | 2 +- ba/ba2300b.uml | 2 +- ba/ba2300c.uml | 2 +- ba/ba2300d.uml | 2 +- ba/batb%ban.uml | 44 ++--- 6 files changed, 253 insertions(+), 245 deletions(-) diff --git a/ba/ba0.cpp b/ba/ba0.cpp index 10e0096fb..782f50d86 100755 --- a/ba/ba0.cpp +++ b/ba/ba0.cpp @@ -1,220 +1,226 @@ -#include -#include -#include -#include -#include -#include -#include - -#if XVT_OS == XVT_OS_WIN -extern "C" { -#include -} -#endif - -#include "ba0.h" - -/////////////////////////////////////////////////////////// -// Picture Mask -/////////////////////////////////////////////////////////// - -class TPicture_mask : public TMask -{ - PICTURE _picture; - - virtual void handler(WINDOW win, EVENT* ep); - -public: - TPicture_mask(const char* name, int dx, int dy, short picture_id); - ~TPicture_mask(); -}; - -TPicture_mask::TPicture_mask(const char* name, int dx, int dy, - short picture_id) - : TMask(name, 1, dx, dy), _picture(0L) -{ -#if XVT_OS == XVT_OS_WIN - _picture = cpb_picture_load(picture_id); -#endif -} - -TPicture_mask::~TPicture_mask() -{ -#if XVT_OS == XVT_OS_WIN - if (_picture) - picture_free(_picture); -#endif -} - - -void TPicture_mask::handler(WINDOW win, EVENT* ep) -{ - TMask::handler(win, ep); - - if (ep->type == E_UPDATE) - { -#if XVT_OS == XVT_OS_WIN - if (_picture) - cpb_win_picture_draw_at(win, _picture, 1, 1); - else -#endif - { - const int max = 16; - for (int i = 0; i < max; i++) - { - TTemp_window w(win); - w.rect(i*2, i, max-i*2, max-i); - } - } - } -} - -/////////////////////////////////////////////////////////// -// Menu application -/////////////////////////////////////////////////////////// - -class TMenu_application : public TApplication -{ - const char* _name; - - enum { MAXLEVEL = 1024 }; - int _first[MAXLEVEL]; - TArray _menu; // TAG|DESCRIPTION|ACTION - - int _level, _max; - -protected: - void load_menu(); - int do_level(); - bool create(); - -public: - TMenu_application(const char* name) : _name(name) {} -}; - -void TMenu_application::load_menu() -{ - TScanner s(_name); - - _max = -1; - while (s.line().not_empty()) - { - TToken_string* ts = new TToken_string(s.token()); - int l = ts->get_int(); - - if (l < _max) - { - error_box("Item of level %d while %d was expected)", l, _max); - l = _max; - } - if (l > _max) - { - if (l >= MAXLEVEL) - { - error_box("Too many menu levels: %d", l); - l = _max; - } - _first[_max = l] = _menu.items(); - } - - _menu.add(ts); - } - _first[++_max] = _menu.items(); -} - - -HIDDEN bool menu_item_handler(TMask_field&f, KEY k) -{ - if (k == K_SPACE) - f.mask().stop_run(f.dlg()); - return TRUE; -} - - -int TMenu_application::do_level() -{ - const int first = _first[_level]; - const int last = _first[_level+1]; - const char* head = ((TToken_string&)_menu[first]).get(1); - - const int width = 72; - const int heigth = 18; - const int bwidth = 20; - const int x = width-bwidth-12; - - TPicture_mask menu(head, width, heigth, BA0_PICTURE); - - int y = 1; - -#if XVT_OS == XVT_OS_WIN - TString t(format("#%d", BMP_STOPREC)); -#else - TString t; -#endif - - TString item(32); - for (int i = first+1; i < last; i++, y++) - { - TToken_string& row = (TToken_string&)_menu[i]; - item = row.get(1); - menu.add_button(100+y, 0, t, x, y, 1, 1); - menu.set_handler(100+y, menu_item_handler); - menu.add_static(-1, 0, item, x+4, y); - } - - t = first ? "Menu precedente" : "Fine"; - const short id = first ? DLG_CANCEL : DLG_QUIT; - menu.add_button(id, 0, t, x, heigth-2, bwidth, 2); - - menu.run(); - int k = menu.last_key(); - int m =(k == K_QUIT || k == K_ESC) ? -1 : first+k-100; - return m; -} - - -bool TMenu_application::create() -{ - load_menu(); - int refarray[256]; - int i = 0; - - _level = 0; - while (i >= 0) - { - int m = do_level(); - if (m >= 0) - { - const char* option = ((TToken_string&)_menu[m]).get(2); - if (option && *option) - { - int l = atoi(option); - if (l > 0) - { - const char* flags = ((TToken_string&)_menu[m]).get(3); - - if (flags && strchr(flags, 'F') != NULL) set_firm(); - refarray[i++] = _level; - if (l < _max) _level = l; - } - else - { - TExternal_app a(option); - a.run(); - } - } - } - else _level = (--i >= 0) ? refarray[i] : 0; - } - - stop_run(); - return TRUE; -} - -int main(int argc, char** argv) -{ - const char* menu = (argc < 2) ? "prassi.mnu" : argv[1]; - TMenu_application ma(menu); - ma.run(argc, argv, "PRASSI"); - return TRUE; -} +#include +#include +#include +#include +#include +#include +#include + +#if XVT_OS == XVT_OS_WIN +extern "C" { +#include +} +#endif + +#include "ba0.h" + +/////////////////////////////////////////////////////////// +// Picture Mask +/////////////////////////////////////////////////////////// + +class TPicture_mask : public TMask +{ + PICTURE _picture; + + virtual void handler(WINDOW win, EVENT* ep); + +public: + TPicture_mask(const char* name, int dx, int dy, short picture_id); + ~TPicture_mask(); +}; + +TPicture_mask::TPicture_mask(const char* name, int dx, int dy, + short picture_id) +: TMask(name, 1, dx, dy), _picture(0L) +{ +#if XVT_OS == XVT_OS_WIN + _picture = cpb_picture_load(picture_id); +#endif +} + +TPicture_mask::~TPicture_mask() +{ +#if XVT_OS == XVT_OS_WIN + if (_picture) + picture_free(_picture); +#endif +} + + +void TPicture_mask::handler(WINDOW win, EVENT* ep) +{ + TMask::handler(win, ep); + + if (ep->type == E_UPDATE) + { +#if XVT_OS == XVT_OS_WIN + if (_picture) + cpb_win_picture_draw_at(win, _picture, 1, 1); + else +#endif + { + const int max = 16; + for (int i = 0; i < max; i++) + { + TTemp_window w(win); + w.rect(i*2, i, max-i*2, max-i); + } + } + } +} + +/////////////////////////////////////////////////////////// +// Menu application +/////////////////////////////////////////////////////////// + +class TMenu_application : public TApplication +{ + const char* _name; + + enum { MAXLEVEL = 1024 }; + int _first[MAXLEVEL]; + TArray _menu; // TAG|DESCRIPTION|ACTION + + int _level, _max; + +protected: + void load_menu(); + int do_level(); + bool create(); + +public: + TMenu_application(const char* name) : _name(name) {} +}; + + +static short last_button = 0; + +void TMenu_application::load_menu() +{ + TScanner s(_name); + + _max = -1; + while (s.line().not_empty()) + { + TToken_string* ts = new TToken_string(s.token()); + int l = ts->get_int(); + + if (l < _max) + { + error_box("Item of level %d while %d was expected)", l, _max); + l = _max; + } + if (l > _max) + { + if (l >= MAXLEVEL) + { + error_box("Too many menu levels: %d", l); + l = _max; + } + _first[_max = l] = _menu.items(); + } + + _menu.add(ts); + } + _first[++_max] = _menu.items(); +} + + +HIDDEN bool menu_item_handler(TMask_field&f, KEY k) +{ + if (k == K_SPACE) + { + last_button = f.dlg(); + f.mask().stop_run(K_AUTO_ENTER); + } + return TRUE; +} + + +int TMenu_application::do_level() +{ + const int first = _first[_level]; + const int last = _first[_level+1]; + const char* head = ((TToken_string&)_menu[first]).get(1); + + const int width = 72; + const int heigth = 18; + const int bwidth = 20; + const int x = width-bwidth-12; + + TPicture_mask menu(head, width, heigth, BA0_PICTURE); + + int y = 1; + +#if XVT_OS == XVT_OS_WIN + TString t(format("#%d", BMP_STOPREC)); +#else + TString t; +#endif + + TString item(32); + for (int i = first+1; i < last; i++, y++) + { + TToken_string& row = (TToken_string&)_menu[i]; + item = row.get(1); + menu.add_button(100+y, 0, t, x, y, 1, 1); + menu.set_handler(100+y, menu_item_handler); + menu.add_static(-1, 0, item, x+4, y); + } + + t = first ? "Menu precedente" : "Fine"; + const short id = first ? DLG_CANCEL : DLG_QUIT; + menu.add_button(id, 0, t, x, heigth-2, bwidth, 2); + + menu.run(); + int k = menu.last_key(); + int m =(k == K_QUIT || k == K_ESC) ? -1 : first+last_button-100; + return m; +} + + +bool TMenu_application::create() +{ + load_menu(); + int refarray[256]; + int i = 0; + + _level = 0; + while (i >= 0) + { + int m = do_level(); + if (m >= 0) + { + const char* option = ((TToken_string&)_menu[m]).get(2); + if (option && *option) + { + int l = atoi(option); + if (l > 0) + { + const char* flags = ((TToken_string&)_menu[m]).get(3); + + if (flags && strchr(flags, 'F') != NULL) set_firm(); + refarray[i++] = _level; + if (l < _max) _level = l; + } + else + { + TExternal_app a(option); + a.run(); + } + } + } + else _level = (--i >= 0) ? refarray[i] : 0; + } + + stop_run(); + return TRUE; +} + +int main(int argc, char** argv) +{ + const char* menu = (argc < 2) ? "prassi.mnu" : argv[1]; + TMenu_application ma(menu); + ma.run(argc, argv, "PRASSI"); + return TRUE; +} diff --git a/ba/ba2300a.uml b/ba/ba2300a.uml index c258408b3..4a5aa3ce5 100755 --- a/ba/ba2300a.uml +++ b/ba/ba2300a.uml @@ -1,4 +1,4 @@ -#include +#include "ba2300.h" PAGE "SELECT PRINTER" -1 -1 40 15 diff --git a/ba/ba2300b.uml b/ba/ba2300b.uml index 676664f51..2c3d8fead 100755 --- a/ba/ba2300b.uml +++ b/ba/ba2300b.uml @@ -1,4 +1,4 @@ -#include +#include "ba2300.h" PAGE "ADD/MODIFY PRINTER" -1 -1 64 17 diff --git a/ba/ba2300c.uml b/ba/ba2300c.uml index b7cdde061..e6bb20cd9 100755 --- a/ba/ba2300c.uml +++ b/ba/ba2300c.uml @@ -1,4 +1,4 @@ -#include +#include "ba2300.h" PAGE "VIEW PRINTER" -1 -1 64 17 diff --git a/ba/ba2300d.uml b/ba/ba2300d.uml index 2f02db638..7ca0a25be 100755 --- a/ba/ba2300d.uml +++ b/ba/ba2300d.uml @@ -1,4 +1,4 @@ -#include +#include "ba2300.h" PAGE "ADD NEW CODE" -1 -1 76 7 diff --git a/ba/batb%ban.uml b/ba/batb%ban.uml index 863e26495..91dedafea 100755 --- a/ba/batb%ban.uml +++ b/ba/batb%ban.uml @@ -1,5 +1,4 @@ #include -#include TOOLBAR "" 0 20 0 2 @@ -11,19 +10,20 @@ PAGE "Tabella banche" -1 -1 78 18 NUMBER H_CODICEABI 5 BEGIN + PROMPT 0 0 "" FLAGS "HRZ" + GROUP GR_SEARCH USE %BAN SELECT CODTAB[6,10]="" INPUT CODTAB[1,5] F_CODICEABI DISPLAY "Codice ABI" CODTAB[1,5] DISPLAY "Codice CAB" CODTAB[6,10] DISPLAY "Istituto@50" S0 OUTPUT F_ISTIT S0 - GROUP GR_SEARCH END -NUMBER F_CODICEABI 5 +NUMBER F_CODICEABI 5 5 BEGIN - PROMPT 4 1 "Codice ABI " + PROMPT 6 1 "Codice ABI " FIELD %BAN->CODTAB[1,5] FLAGS "RZ" KEY 1 @@ -39,34 +39,33 @@ BEGIN MESSAGE COPY,H_CODICEABI END -NUMBER F_CODICECAB 5 +NUMBER F_CODICECAB 5 5 BEGIN - PROMPT 29 1 "Codice CAB " + PROMPT 28 1 "Codice CAB " FIELD %BAN->CODTAB[6,10] FLAGS "RZ" KEY 1 COPY ALL F_CODICEABI + MESSAGE SHOW,F_ISTIT|EMPTY HIDE,F_ISTIT VALIDATE AUTOEXIT_FUNC 2 F_CODICEABI F_CODICECAB - MESSAGE SHOW,F_ISTIT - MESSAGE EMPTY HIDE,F_ISTIT END -NUMBER F_CODICEDIP 4 +NUMBER F_CODICEDIP 4 4 BEGIN - PROMPT 52 1 "Codice Dipendenza " + PROMPT 50 1 "Codice Dipendenza " FIELD %BAN->I0 FLAGS "RZ" END STRING F_ISTIT 50 BEGIN - PROMPT 4 3 "Istituto " + PROMPT 6 3 "Istituto " FLAGS "D" END STRING F_DENOM 50 BEGIN - PROMPT 4 5 "Denominazione " + PROMPT 6 5 "Denominazione " FIELD %BAN->S0 KEY 2 USE %BAN KEY 2 @@ -79,26 +78,30 @@ BEGIN CHECKTYPE REQUIRED END +GROUPBOX DLG_NULL 72 7 +BEGIN + PROMPT 4 8 "Sede" +END + STRING F_INDIRIZZO 35 BEGIN - PROMPT 4 7 "Indirizzo " + PROMPT 6 9 "Indirizzo " FIELD %BAN->S2 END STRING F_CIV 10 BEGIN - PROMPT 57 7 "N." + PROMPT 60 9 "N. " FIELD %BAN->S7 END STRING F_COMUNE 4 BEGIN - PROMPT 4 9 "Comune " + PROMPT 6 11 "Comune " FIELD %BAN->S5 USE LF_COMUNI INPUT STATO "" INPUT COM F_COMUNE -#include OUTPUT F_COMUNE COM OUTPUT F_DENCOM DENCOM OUTPUT F_PROV PROVCOM @@ -110,26 +113,25 @@ END STRING F_DENCOM 50 BEGIN - PROMPT 4 11 "Denominazione " + PROMPT 6 12 "Denominazione " USE LF_COMUNI KEY 2 INPUT DENCOM F_DENCOM -#include COPY OUTPUT F_COMUNE CHECKTYPE NORMAL END STRING F_PROV 2 BEGIN - PROMPT 4 13 "Provincia " + PROMPT 6 13 "Provincia " FLAGS "D" END STRING F_CAP 5 BEGIN - PROMPT 56 13 "C.A.P. " + PROMPT 60 13 "C.A.P. " FIELD %BAN->S3 END ENDPAGE -ENDMASK \ No newline at end of file +ENDMASK