cfiles.c Corretta gestione del prawin.ini quando questi non esiste

controls.cpp  Implementati 'outline' alcuni metodi inline
controls.h    Eliminato include <xi.h> ed aggiunto include <xvt_type.h>
execp.cpp     Tolti due include inutili <string.h> e <ctypes.h>
golem.cpp     Sostituita xi_invalidate_rect con xvt_dwin_invalidate_rect
msksheet.cpp  Sostituito <xi.h> con <xinclude.h>
progind.cpp   Eliminata dipendenza da <xi.h>
sheet.cpp     Aggiunto include <xinclude.h>
viswin.cpp    Sostituito XI_FU_MULTIPLE con 8 (Distanza dei bottoni dal fondo)
window.cpp    Sostituito <xi.h> con <xinclude.h>
xinclude.h    Includitore automagico di <xi.h> con relative #define


git-svn-id: svn://10.65.10.50/trunk@5807 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1997-12-30 10:07:11 +00:00
parent eaa1387389
commit 24619adf71
11 changed files with 68 additions and 39 deletions

View File

@ -418,6 +418,11 @@ const char* CGetPrawinName(void)
char tmp[_MAX_PATH]; char tmp[_MAX_PATH];
_splitpath(prefname(), drive, path, NULL, NULL); _splitpath(prefname(), drive, path, NULL, NULL);
_makepath(tmp, drive, path, "prawin", ".ini"); _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); prawin = malloc(_MAX_PATH);
_searchenv(tmp, NULL, prawin); _searchenv(tmp, NULL, prawin);
} }
@ -457,20 +462,17 @@ BOOLEAN CPutPrawin(const char* pref)
{ {
const char* prawin = CGetPrawinName(); const char* prawin = CGetPrawinName();
BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin); BOOLEAN good = WritePrivateProfileString("Main", "Firm", pref, prawin);
if (good)
{
int disk = toupper(*prawin) - 'A'; int disk = toupper(*prawin) - 'A';
if (GetDriveType(disk) == 3) // Aggiorna lo studio solo sui dischi locali if (GetDriveType(disk) == 3) // Aggiorna lo studio solo sui dischi locali
{ {
FILE* ppi; FILE* pppi; // PathPrefPuntoIni
WritePrivateProfileString("Main", "Study", __ptprf, prawin); WritePrivateProfileString("Main", "Study", __ptprf, prawin);
// Aggiorna anche il vecchio pathpref.ini // Aggiorna anche il vecchio pathpref.ini
ppi = fopen("pathpref.ini", "w"); pppi = fopen("pathpref.ini", "w");
fprintf(ppi, "%s\n", __ptprf); fprintf(pppi, "%s\n", __ptprf);
fclose(ppi); fclose(pppi);
}
} }
return good; return good;
} }
@ -550,6 +552,7 @@ const char* CGetPref()
fclose(f); fclose(f);
} }
} }
CPutPrawin(cprefix);
if (*__ptprf) if (*__ptprf)
{ {
char* copy_of_prefix = strdup(cprefix); char* copy_of_prefix = strdup(cprefix);

View File

@ -3,6 +3,9 @@
#define XVT_INCL_NATIVE #define XVT_INCL_NATIVE
#endif #endif
#define XI_INTERNAL
#include <xinclude.h>
#include <colors.h> #include <colors.h>
#include <config.h> #include <config.h>
#include <controls.h> #include <controls.h>
@ -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; 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 RCT& TControl::get_rect(RCT& r) const
{ {
xi_get_rect(_obj, (XinRect *) &r); 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 = (FONT_OBJ*)xi_tree_malloc(sizeof(FONT_OBJ), _obj->v.text);
*font = xi_create_copy_font_id(get_interface(), xvt_default_font(bold), NULL); *font = xi_create_copy_font_id(get_interface(), xvt_default_font(bold), NULL);
RCT rct; get_rect(rct); RCT rct; get_rect(rct);
xi_invalidate_rect(parent(), (XinRect *) &rct); xi_invalidate_rect(parent(), &rct);
#endif #endif
} }
@ -1329,7 +1338,7 @@ void TButton_control::create(WINDOW win, short cid,
update_tab_cid(); update_tab_cid();
} }
XI_BTN_TYPE TButton_control::button_type() const int TButton_control::button_type() const
{ {
return _obj->v.btn->type; 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; _bmp_up = _bmp_dn = 0;
} }
#ifdef XI_R4
#endif
} }
void TPushbutton_control::update() void TPushbutton_control::update()

View File

@ -8,16 +8,16 @@
class TWindow; // __WINDOW_H class TWindow; // __WINDOW_H
class TMask_field; // __MASKFLD_H class TMask_field; // __MASKFLD_H
#ifndef INCL_XI #ifndef XVT_INCL_XVTTYPE
#define XI_INTERNAL #include <xvt_type.h>
#include <xi.h>
#endif #endif
#ifndef XI_R4 #ifndef INCL_XI
#define XinRect RCT struct XI_OBJ;
#define XinPoint PNT struct XI_EVENT;
#endif #endif
void init_controls(); void init_controls();
void free_controls(); void free_controls();
XVT_FNTID xvt_default_font(bool bold = FALSE); 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, WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
const char* caption, TWindow* mask, bool tags); 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); short get_focus_id(WINDOW win);
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -51,7 +51,7 @@ protected:
TMask_field* _fld; TMask_field* _fld;
// @cmember Ricava l'interfaccia da una finestra // @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) // @cmember Cerca un controllo operabile (in avanti o all'indietro)
XI_OBJ* find_operable(XI_OBJ* container, bool forward, bool normal) const; XI_OBJ* find_operable(XI_OBJ* container, bool forward, bool normal) const;
@ -80,10 +80,10 @@ public:
bool is_edit_key(KEY k) const; bool is_edit_key(KEY k) const;
// @cmember Ritorna l'identificatore assegnato al controllo // @cmember Ritorna l'identificatore assegnato al controllo
short id() const { return _obj->cid; } short id() const;
WINDOW parent() const; WINDOW parent() const;
XI_OBJ_TYPE type() const { return _obj->type; } int type() const;
// @cmember Ritorna il prompt del controllo // @cmember Ritorna il prompt del controllo
virtual const char* caption() const; virtual const char* caption() const;
@ -199,7 +199,7 @@ public:
void uncheck() { check(FALSE); } void uncheck() { check(FALSE); }
bool toggle(); bool toggle();
XI_BTN_TYPE button_type() const; int button_type() const;
XI_OBJ* container() const; XI_OBJ* container() const;
TButton_control() {} TButton_control() {}

View File

@ -6,8 +6,6 @@
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#include <toolhelp.h> #include <toolhelp.h>
#include <string.h>
#include <ctype.h>
#endif #endif
#if XVT_OS == XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_SCOUNIX

View File

@ -509,7 +509,7 @@ void TGolem_field::set_window_data(const char* data)
btn->set_bmp(BMP_OLE, 0); btn->set_bmp(BMP_OLE, 0);
RCT rct; btn->get_rect(rct); 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 bool TGolem_field::is_editable() const

View File

@ -1,5 +1,5 @@
#define XI_INTERNAL #define XI_INTERNAL
#include <xi.h> #include <xinclude.h>
extern "C" extern "C"
{ {

View File

@ -6,6 +6,14 @@
#include <controls.h> #include <controls.h>
#include <urldefid.h> #include <urldefid.h>
#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"; const char* const TITLE_TEXT = "Attesa";
word TIndwin::measure_text(TToken_string& s, word& maxlen) const word TIndwin::measure_text(TToken_string& s, word& maxlen) const
@ -123,24 +131,24 @@ void TIndwin::update_bar()
if (CAMPI_SCAVATI) if (CAMPI_SCAVATI)
{ {
// Rettangolo scavato // 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); BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
b.left += 2; b.right -= 1; b.left += 2; b.right -= 1;
b.top += 2; b.bottom -= 1; b.top += 2; b.bottom -= 1;
// Rettangolo in rilievo // Rettangolo in rilievo
b.right = b.left + int((b.right-b.left)*prc); 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); BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
} }
else else
{ {
// Rettangolo in rilievo // Rettangolo in rilievo
b.right = b.left + int((r.right-r.left)*prc); 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); BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
// Rettangolo scavato // Rettangolo scavato
b.left = b.right; b.right = r.right; 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); BTN_LIGHT_COLOR, BTN_BACK_COLOR, BTN_DARK_COLOR);
} }

View File

@ -1,3 +1,5 @@
#include <xinclude.h>
#include <colors.h> #include <colors.h>
#include <config.h> #include <config.h>
#include <controls.h> #include <controls.h>

View File

@ -615,7 +615,7 @@ void TViswin::repos_buttons ()
space = 0; space = 0;
int x = space; 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++) for (int b = 0; b < buttons; b++)
{ {
const PNT p = { y, x }; const PNT p = { y, x };

View File

@ -2,7 +2,7 @@
#define STRICT #define STRICT
#define XI_INTERNAL #define XI_INTERNAL
#include <xi.h> #include <xinclude.h>
#include <applicat.h> #include <applicat.h>
#include <checks.h> #include <checks.h>

11
include/xinclude.h Executable file
View File

@ -0,0 +1,11 @@
#ifndef __XINCLUDE_H
#ifndef INCL_XI
#include <xi.h>
#endif
#ifdef OLDXVT_H
#define XI_R4
#endif
#endif