From 24619adf719a75bb4541d8d63545646085f6fdbc Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 30 Dec 1997 10:07:11 +0000 Subject: [PATCH] cfiles.c Corretta gestione del prawin.ini quando questi non esiste controls.cpp Implementati 'outline' alcuni metodi inline controls.h Eliminato include ed aggiunto include execp.cpp Tolti due include inutili e golem.cpp Sostituita xi_invalidate_rect con xvt_dwin_invalidate_rect msksheet.cpp Sostituito con progind.cpp Eliminata dipendenza da sheet.cpp Aggiunto include viswin.cpp Sostituito XI_FU_MULTIPLE con 8 (Distanza dei bottoni dal fondo) window.cpp Sostituito con xinclude.h Includitore automagico di con relative #define git-svn-id: svn://10.65.10.50/trunk@5807 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/cfiles.c | 27 +++++++++++++++------------ include/controls.cpp | 15 +++++++++++---- include/controls.h | 26 +++++++++++++------------- include/execp.cpp | 2 -- include/golem.cpp | 2 +- include/msksheet.cpp | 2 +- include/progind.cpp | 16 ++++++++++++---- include/sheet.cpp | 2 ++ include/viswin.cpp | 2 +- include/window.cpp | 2 +- include/xinclude.h | 11 +++++++++++ 11 files changed, 68 insertions(+), 39 deletions(-) create mode 100755 include/xinclude.h diff --git a/include/cfiles.c b/include/cfiles.c index 1e252d6c0..2291668d0 100755 --- a/include/cfiles.c +++ b/include/cfiles.c @@ -418,6 +418,11 @@ const char* CGetPrawinName(void) char tmp[_MAX_PATH]; _splitpath(prefname(), drive, path, NULL, NULL); _makepath(tmp, drive, path, "prawin", ".ini"); + if (access(tmp, 0) != 0) // se non esiste ... + { + FILE* pw = fopen(tmp, "w"); // ... lo creo + fclose(pw); + } prawin = malloc(_MAX_PATH); _searchenv(tmp, NULL, prawin); } @@ -457,20 +462,17 @@ BOOLEAN CPutPrawin(const char* pref) { const char* prawin = CGetPrawinName(); BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin); - if (good) - { - int disk = toupper(*prawin) - 'A'; - if (GetDriveType(disk) == 3) // Aggiorna lo studio solo sui dischi locali - { - FILE* ppi; + int disk = toupper(*prawin) - 'A'; + if (GetDriveType(disk) == 3) // Aggiorna lo studio solo sui dischi locali + { + FILE* pppi; // PathPrefPuntoIni - WritePrivateProfileString("Main", "Study", __ptprf, prawin); + WritePrivateProfileString("Main", "Study", __ptprf, prawin); - // Aggiorna anche il vecchio pathpref.ini - ppi = fopen("pathpref.ini", "w"); - fprintf(ppi, "%s\n", __ptprf); - fclose(ppi); - } + // Aggiorna anche il vecchio pathpref.ini + pppi = fopen("pathpref.ini", "w"); + fprintf(pppi, "%s\n", __ptprf); + fclose(pppi); } return good; } @@ -550,6 +552,7 @@ const char* CGetPref() fclose(f); } } + CPutPrawin(cprefix); if (*__ptprf) { char* copy_of_prefix = strdup(cprefix); diff --git a/include/controls.cpp b/include/controls.cpp index 495112fb8..5d9a20751 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -2,6 +2,9 @@ #define STRICT #define XVT_INCL_NATIVE #endif + +#define XI_INTERNAL +#include #include #include @@ -816,6 +819,12 @@ void TControl::coord2rct(WINDOW win, short x, short y, short dx, short dy, RCT & rct.bottom = MAXY + dy * Y_FU_MULTIPLE - X_FU_DELTA; } +short TControl::id() const +{ return _obj->cid; } + +int TControl::type() const +{ return _obj->type; } + RCT& TControl::get_rect(RCT& r) const { xi_get_rect(_obj, (XinRect *) &r); @@ -1060,7 +1069,7 @@ void TText_control::set_caption(const char* text) font = (FONT_OBJ*)xi_tree_malloc(sizeof(FONT_OBJ), _obj->v.text); *font = xi_create_copy_font_id(get_interface(), xvt_default_font(bold), NULL); RCT rct; get_rect(rct); - xi_invalidate_rect(parent(), (XinRect *) &rct); + xi_invalidate_rect(parent(), &rct); #endif } @@ -1329,7 +1338,7 @@ void TButton_control::create(WINDOW win, short cid, update_tab_cid(); } -XI_BTN_TYPE TButton_control::button_type() const +int TButton_control::button_type() const { return _obj->v.btn->type; } @@ -1463,8 +1472,6 @@ void TPushbutton_control::set_bmp(short bmp_up, short bmp_dn) { _bmp_up = _bmp_dn = 0; } -#ifdef XI_R4 -#endif } void TPushbutton_control::update() diff --git a/include/controls.h b/include/controls.h index 54d976f8f..46151900d 100755 --- a/include/controls.h +++ b/include/controls.h @@ -8,16 +8,16 @@ class TWindow; // __WINDOW_H class TMask_field; // __MASKFLD_H -#ifndef INCL_XI -#define XI_INTERNAL -#include -#endif - -#ifndef XI_R4 -#define XinRect RCT -#define XinPoint PNT +#ifndef XVT_INCL_XVTTYPE +#include #endif +#ifndef INCL_XI +struct XI_OBJ; +struct XI_EVENT; +#endif + + void init_controls(); void free_controls(); XVT_FNTID xvt_default_font(bool bold = FALSE); @@ -26,7 +26,7 @@ XVT_FNTID xvt_load_default_font(); WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, const char* caption, TWindow* mask, bool tags); -void attach_interface(WINDOW win, COLOR back = COLOR_WHITE); +void attach_interface(WINDOW win, COLOR back); short get_focus_id(WINDOW win); /////////////////////////////////////////////////////////// @@ -51,7 +51,7 @@ protected: TMask_field* _fld; // @cmember Ricava l'interfaccia da una finestra - XI_OBJ* get_interface(WINDOW win = NULL_WIN) const; + XI_OBJ* get_interface(WINDOW win = 0L) const; // @cmember Cerca un controllo operabile (in avanti o all'indietro) XI_OBJ* find_operable(XI_OBJ* container, bool forward, bool normal) const; @@ -80,10 +80,10 @@ public: bool is_edit_key(KEY k) const; // @cmember Ritorna l'identificatore assegnato al controllo - short id() const { return _obj->cid; } + short id() const; WINDOW parent() const; - XI_OBJ_TYPE type() const { return _obj->type; } + int type() const; // @cmember Ritorna il prompt del controllo virtual const char* caption() const; @@ -199,7 +199,7 @@ public: void uncheck() { check(FALSE); } bool toggle(); - XI_BTN_TYPE button_type() const; + int button_type() const; XI_OBJ* container() const; TButton_control() {} diff --git a/include/execp.cpp b/include/execp.cpp index b16a91ed2..424a21f72 100755 --- a/include/execp.cpp +++ b/include/execp.cpp @@ -6,8 +6,6 @@ #if XVT_OS == XVT_OS_WIN #include -#include -#include #endif #if XVT_OS == XVT_OS_SCOUNIX diff --git a/include/golem.cpp b/include/golem.cpp index 14854af20..dc404f8cd 100755 --- a/include/golem.cpp +++ b/include/golem.cpp @@ -509,7 +509,7 @@ void TGolem_field::set_window_data(const char* data) btn->set_bmp(BMP_OLE, 0); RCT rct; btn->get_rect(rct); - xi_invalidate_rect(btn->parent(), (XinRect *) &rct); + xvt_dwin_invalidate_rect(btn->parent(), &rct); } bool TGolem_field::is_editable() const diff --git a/include/msksheet.cpp b/include/msksheet.cpp index c88978f39..9b01b013c 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -1,5 +1,5 @@ #define XI_INTERNAL -#include +#include extern "C" { diff --git a/include/progind.cpp b/include/progind.cpp index 2e4d8ab7b..8a53f5779 100755 --- a/include/progind.cpp +++ b/include/progind.cpp @@ -6,6 +6,14 @@ #include #include +#ifndef INCL_XI +extern "C" +{ + void XVT_CALLCONV1 xi_draw_3d_rect XVT_CC_ARGS( ( WINDOW win, RCT* rctp, BOOLEAN well, int height, + COLOR color_light, COLOR color_ctrl, COLOR color_dark ) ); +} +#endif + const char* const TITLE_TEXT = "Attesa"; word TIndwin::measure_text(TToken_string& s, word& maxlen) const @@ -123,24 +131,24 @@ void TIndwin::update_bar() if (CAMPI_SCAVATI) { // Rettangolo scavato - xi_draw_3d_rect(w, (XinRect *) &r, TRUE, 2, + xi_draw_3d_rect(w, &r, TRUE, 2, BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR); b.left += 2; b.right -= 1; b.top += 2; b.bottom -= 1; // Rettangolo in rilievo b.right = b.left + int((b.right-b.left)*prc); - xi_draw_3d_rect(w, (XinRect *) &b, FALSE, 2, + xi_draw_3d_rect(w, &b, FALSE, 2, BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR); } else { // Rettangolo in rilievo b.right = b.left + int((r.right-r.left)*prc); - xi_draw_3d_rect(w, (XinRect *) &b, FALSE, 2, + xi_draw_3d_rect(w, &b, FALSE, 2, BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR); // Rettangolo scavato b.left = b.right; b.right = r.right; - xi_draw_3d_rect(w, (XinRect *) &b, TRUE, 2, + xi_draw_3d_rect(w, &b, TRUE, 2, BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR); } diff --git a/include/sheet.cpp b/include/sheet.cpp index d786880a3..f817cc378 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/include/viswin.cpp b/include/viswin.cpp index 61982d2c6..28444015a 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -615,7 +615,7 @@ void TViswin::repos_buttons () space = 0; int x = space; - const int y = (wr.bottom - wr.top) - (br.bottom - br.top) - XI_FU_MULTIPLE; + const int y = (wr.bottom - wr.top) - (br.bottom - br.top) - 8; for (int b = 0; b < buttons; b++) { const PNT p = { y, x }; diff --git a/include/window.cpp b/include/window.cpp index 8dea5b91b..059ae2f3a 100755 --- a/include/window.cpp +++ b/include/window.cpp @@ -2,7 +2,7 @@ #define STRICT #define XI_INTERNAL -#include +#include #include #include diff --git a/include/xinclude.h b/include/xinclude.h new file mode 100755 index 000000000..a8c1361fe --- /dev/null +++ b/include/xinclude.h @@ -0,0 +1,11 @@ +#ifndef __XINCLUDE_H + +#ifndef INCL_XI +#include +#endif + +#ifdef OLDXVT_H +#define XI_R4 +#endif + +#endif