archives.cpp Tolto include windows.h

checks.cpp      Tolto include windows.h
colors.cpp      Tolto include windows.h
controls.cpp    Aggiunto cambiamento del font runtime dei TText_control
execp.cpp       Tolto include windows.h
form.cpp        Tolto include windows.h
mask.cpp        Corretta formattazione di due righe
maskfld.cpp     Aggiunto messaggio CHECK
msksheet.cpp    Tolto include windows.h
relapp.cpp      Tolto include windows.h
strings.pp      Corretto CHECK della TFixed_string::format()
viswin.cpp      Tolto include windows.h
window.cpp      Tolto include windows.h
xvtility.cpp    Corretto calcolo altezza righe delle maschere


git-svn-id: svn://10.65.10.50/trunk@4085 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1997-01-17 11:07:43 +00:00
parent 685df10815
commit 55a36762ef
14 changed files with 134 additions and 99 deletions

View File

@ -1,8 +1,9 @@
#define STRICT
#include <windows.h>
#include <direct.h> #include <direct.h>
#include <al.h> #include <al.h>
#define XVT_INCL_NATIVE
#define STRICT
#include <archives.h> #include <archives.h>
#include <config.h> #include <config.h>
#include <isam.h> #include <isam.h>

View File

@ -3,13 +3,11 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef XVT #ifdef XVT
#ifndef XVT_INCL_XVT #define XVT_INCL_NATIVE
#define STRICT
#include <xvt.h> #include <xvt.h>
#endif
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#include <keys.h> #include <keys.h>
#else #else
#include <xvtility.h> #include <xvtility.h>

View File

@ -1,11 +1,12 @@
#if XVT_OS == XVT_OS_WIN #define XVT_INCL_NATIVE
#define STRICT #define STRICT
#include <windows.h>
#include <commdlg.h>
#endif
#include <colors.h> #include <colors.h>
#if XVT_OS == XVT_OS_WIN
#include <commdlg.h>
#endif
COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue) COLOR RGB2COLOR(unsigned char red, unsigned char green, unsigned char blue)
{ {
COLOR def = MAKE_COLOR(red, green, blue); COLOR def = MAKE_COLOR(red, green, blue);

View File

@ -1,6 +1,6 @@
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#define STRICT #define STRICT
#include <windows.h> #define XVT_INCL_NATIVE
#endif #endif
#include <colors.h> #include <colors.h>
@ -8,7 +8,6 @@
#include <controls.h> #include <controls.h>
#include <mask.h> #include <mask.h>
#include <urldefid.h> #include <urldefid.h>
#include <window.h>
COLOR MASK_BACK_COLOR = COLOR_DKCYAN; COLOR MASK_BACK_COLOR = COLOR_DKCYAN;
COLOR MASK_LIGHT_COLOR = COLOR_CYAN; COLOR MASK_LIGHT_COLOR = COLOR_CYAN;
@ -36,6 +35,11 @@ typedef struct _stx_data
unsigned long attrib; unsigned long attrib;
} STX_DATA; } STX_DATA;
extern "C"
{
#include <xiutils.h>
}
#endif #endif
HIDDEN bool _button_blocked = FALSE; HIDDEN bool _button_blocked = FALSE;
@ -154,13 +158,19 @@ XVT_FNTID xvt_default_font(bool bold)
HDC hdc = (HDC)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_GRAPHIC_CONTEXT); HDC hdc = (HDC)xvt_vobj_get_attr(TASK_WIN, ATTR_NATIVE_GRAPHIC_CONTEXT);
GetTextMetrics(hdc, &tm); GetTextMetrics(hdc, &tm);
const int COLX = GetSystemMetrics(SM_CXSCREEN) / 80; RCT pc; xvt_vobj_get_client_rect(TASK_WIN, &pc);
ROWY = (pc.bottom - pc.top) / 23;
const int COLX = (pc.right - pc.left) / 80;
CHARX = tm.tmAveCharWidth+1; CHARX = tm.tmAveCharWidth+1;
if (CHARX > COLX) CHARX = COLX; if (CHARX > COLX)
CHARX = COLX;
CHARY = tm.tmHeight; CHARY = tm.tmHeight;
BASEY = tm.tmAscent; BASEY = tm.tmAscent;
if (CHARY > ROWY-2) CHARY = ROWY-2; if (CHARY > ROWY-2)
CHARY = ROWY-2;
#endif #endif
} }
@ -1019,6 +1029,11 @@ void TText_control::set_caption(const char* text)
const char* c = parse_caption(text, bold, color); const char* c = parse_caption(text, bold, color);
xi_set_text(_obj, (char*)c); xi_set_text(_obj, (char*)c);
_obj->v.text->fore_color = color; _obj->v.text->fore_color = color;
FONT_OBJ* &font = _obj->v.text->font;
if (font == NULL)
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);
} }

View File

@ -1,4 +1,7 @@
#include <stdio.h> #include <stdio.h>
#define XVT_INCL_NATIVE
#define STRICT
#include <xvt.h> #include <xvt.h>
#if XVT_OS == XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_SCOUNIX
@ -7,8 +10,6 @@
#endif #endif
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#include <toolhelp.h> #include <toolhelp.h>
#include <hlapi_c.h> #include <hlapi_c.h>
#endif #endif

View File

@ -1,10 +1,8 @@
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#define STRICT #define STRICT
#include <windows.h> #define XVT_INCL_NATIVE
#endif
#include <applicat.h> #include <applicat.h>
#include <form.h> #include <form.h>

View File

@ -1,11 +1,8 @@
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT #define XVT_INCL_NATIVE
#define WIN32_LEAN_AND_MEAN
#define STRICT #define STRICT
#include <windows.h>
#endif
#include <applicat.h> #include <applicat.h>
#include <controls.h> #include <controls.h>

View File

@ -273,8 +273,16 @@ void TMask_field::construct(TScanner& scanner, WINDOW parent)
NFCHECK("Testata errata o BEGIN mancante nel campo %d", _ctl_data._dlg); NFCHECK("Testata errata o BEGIN mancante nel campo %d", _ctl_data._dlg);
scanner.push(); scanner.push();
} }
if (_ctl_data._dlg > 0 && mask().id2pos(_ctl_data._dlg) >= 0) if (_ctl_data._dlg > 0)
{
const TMask& m = mask();
for (int f = m.fields()-1; f >= 0; f--)
{
const TMask_field& mf = m.fld(f);
if (mf.dlg() == _ctl_data._dlg && mf.parent() == parent)
NFCHECK("Esistono due campi con identificatore %d", _ctl_data._dlg); NFCHECK("Esistono due campi con identificatore %d", _ctl_data._dlg);
}
}
#endif #endif
while(scanner.popkey() != "EN") // END of control while(scanner.popkey() != "EN") // END of control
@ -767,26 +775,27 @@ HIDDEN void run_app(TMask& mask, TToken_string& msg)
// Certified 90% // Certified 90%
bool TOperable_field::do_message(int num) bool TOperable_field::do_message(int num)
{ {
const int MAX_CMD = 17; const int MAX_CMD = 18;
static const char* commands[MAX_CMD] = static const char* commands[MAX_CMD] =
{ {
"ADD", // 0 "ADD", // 0
"CLEAR", // 1 "CH", // 1
"CO", // 2 "CLEAR", // 2
"DEL", // 3 "CO", // 3
"DIRTY", // 4 "DEL", // 4
"DISABLE", // 5 "DIRTY", // 5
"ENABLE", // 6 "DISABLE", // 6
"ENABLEDEF", // 7 "ENABLE", // 7
"EXIT", // 8 "ENABLEDEF", // 8
"HIDE", // 9 "EXIT", // 9
"NORMAL", // 10 "HIDE", // 10
"PUSH", // 11 "NORMAL", // 11
"REQUIRED", // 12 "PUSH", // 12
"RESET", // 13 "REQUIRED", // 13
"RU", // 14 "RESET", // 14
"SHOW", // 15 "RU", // 15
"TAB", // 16 "SHOW", // 16
"TAB", // 17
}; };
TToken_string* mess = message(num); TToken_string* mess = message(num);
@ -822,12 +831,12 @@ bool TOperable_field::do_message(int num)
} }
} }
if (cmd == 8) if (cmd == 9)
{ {
mask().stop_run(atoi(dlg)); mask().stop_run(atoi(dlg));
continue; continue;
} else } else
if (cmd == 14) if (cmd == 15)
{ {
run_app(mask(), msg); run_app(mask(), msg);
continue; continue;
@ -837,40 +846,46 @@ bool TOperable_field::do_message(int num)
const bool broadcast = dlg && strchr(dlg, '@'); const bool broadcast = dlg && strchr(dlg, '@');
if (broadcast) fld = -fld; if (broadcast) fld = -fld;
if (value[0] == '"') value = value.strip("\"'"); if (value[0] == '"')
value = value.strip("\"'");
else switch (cmd) else switch (cmd)
{ {
case 0: case 0:
modify_list(TRUE, mask().field(fld), msg); continue; modify_list(TRUE, mask().field(fld), msg);
continue;
case 1: case 1:
mask().field(fld).set_dirty();
mask().field(fld).on_key(K_TAB);
continue;
case 2:
mask().disable(fld); mask().disable(fld);
mask().reset(fld); mask().reset(fld);
continue; continue;
case 2:
value = copy_value(msg, get()); break;
case 3: case 3:
modify_list(FALSE, mask().field(fld), msg); continue; value = copy_value(msg, get()); break;
case 4: case 4:
mask().field(fld).set_dirty(); continue; modify_list(FALSE, mask().field(fld), msg); continue;
case 5: case 5:
mask().disable(fld); continue; mask().field(fld).set_dirty(); continue;
case 6: case 6:
mask().enable(fld); continue; mask().disable(fld); continue;
case 7: case 7:
mask().enable(fld); continue;
case 8:
mask().enable_default(fld); continue; mask().enable_default(fld); continue;
case 9:
mask().hide(fld); continue;
case 10: case 10:
mask().field(fld).check_type(CHECK_NORMAL); continue; mask().hide(fld); continue;
case 11: case 11:
mask().field(fld).on_hit(); continue; mask().field(fld).check_type(CHECK_NORMAL); continue;
case 12: case 12:
mask().field(fld).check_type(CHECK_REQUIRED); continue; mask().field(fld).on_hit(); continue;
case 13: case 13:
mask().field(fld).check_type(CHECK_REQUIRED); continue;
case 14:
key = K_F2; break; key = K_F2; break;
case 15:
mask().show(fld); continue;
case 16: case 16:
mask().show(fld); continue;
case 17:
mask().field(fld).on_key(K_TAB); continue; mask().field(fld).on_key(K_TAB); continue;
default: default:
key = atoi(value); key = atoi(value);
@ -2921,15 +2936,31 @@ bool TEdit_field::on_key(KEY key)
if (_browse) k = _browse->run(); if (_browse) k = _browse->run();
else beep(); else beep();
if (k != K_F9) set_focus(); if (k != K_F9)
set_focus();
if (k == K_ENTER) if (k == K_ENTER)
{ {
bool ok = TRUE;
set_dirty(); set_dirty();
if (on_hit()) // Controlla i validate che non vengono fatti da on_hit
const int vf = validate_func();
if (vf >= 0 && vf != AUTOEXIT_FUNC && vf != NUMCALC_FUNC &&
vf != STRCALC_FUNC && vf != 21)
{
ok = validate(K_TAB);
if (!ok && has_warning())
default_error_box();
}
// Esegue handler
if (ok)
ok = on_hit();
if (ok)
{ {
TMask & m = mask(); TMask & m = mask();
if (m.is_running()) if (m.is_running())
{ {
set_focusdirty(FALSE); // Evita doppia esecuzione handlers! set_focusdirty(FALSE); // Evita doppia esecuzione handlers!
@ -2942,7 +2973,7 @@ bool TEdit_field::on_key(KEY key)
} }
} }
} }
return TRUE; return ok;
} }
else else
return FALSE; return FALSE;

View File

@ -1,15 +1,10 @@
#define XI_INTERNAL #define XI_INTERNAL
#include <xi.h> #include <xi.h>
#ifdef __cplusplus extern "C"
extern "C" { {
#endif
#include <xiutils.h> #include <xiutils.h>
#ifdef __cplusplus
} }
#endif
#include <colors.h> #include <colors.h>
#include <config.h> #include <config.h>

View File

@ -3,13 +3,10 @@
#include <urldefid.h> #include <urldefid.h>
#include <relapp.h> #include <relapp.h>
#include <utility.h> #include <utility.h>
#define STRICT
#define XVT_INCL_NATIVE
#include <xvtility.h>
#if XVT_OS == XVT_OS_WIN #define XVT_INCL_NATIVE
#include <windows.h> #define STRICT
#endif #include <xvtility.h>
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TRelation_application // TRelation_application

View File

@ -874,7 +874,7 @@ TString& TFixed_string::format(
va_start(pars, fmt); va_start(pars, fmt);
const int tot = vsprintf(_str, fmt, pars); const int tot = vsprintf(_str, fmt, pars);
va_end(pars); va_end(pars);
CHECK(tot >= 0 && tot < size(), "Ue'! Quanto scrivi con 'sta format?"); CHECK(tot >= 0 && tot <= size(), "Ue'! Quanto scrivi con 'sta format?");
return *this; return *this;
} }

View File

@ -1,3 +1,6 @@
#define XVT_INCL_NATIVE
#define STRICT
#include <browfile.h> #include <browfile.h>
#include <colors.h> #include <colors.h>
#include <config.h> #include <config.h>
@ -25,11 +28,6 @@ const int PRINT_HEIGHT = 10;
#define DLG_LINK_TITLE "Colle~ga" #define DLG_LINK_TITLE "Colle~ga"
#define DLG_PRINT_TITLE "~Stampa" #define DLG_PRINT_TITLE "~Stampa"
#if XVT_OS == XVT_OS_WIN
#define STRICT
#include <windows.h>
#endif
#define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY) #define BACKGROUND (_toplevel ? MASK_BACK_COLOR : COLOR_GRAY)
#define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE) #define FOREGROUND (_toplevel ? COLOR_BLACK : COLOR_WHITE)

View File

@ -1,9 +1,9 @@
#define XVT_INCL_NATIVE
#define STRICT #define STRICT
#define XI_INTERNAL #define XI_INTERNAL
#include <xi.h> #include <xi.h>
#define XVT_INCL_NATIVE
#include <applicat.h> #include <applicat.h>
#include <checks.h> #include <checks.h>
#include <urldefid.h> #include <urldefid.h>
@ -13,11 +13,6 @@
#include <window.h> #include <window.h>
#include <colors.h> #include <colors.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#include <windows.h>
#endif
HIDDEN MENU_ITEM* find_menu_item(MENU_ITEM* menu, MENU_TAG id, bool ismbar) HIDDEN MENU_ITEM* find_menu_item(MENU_ITEM* menu, MENU_TAG id, bool ismbar)
{ {
MENU_ITEM* fnd = NULL; MENU_ITEM* fnd = NULL;

View File

@ -1,3 +1,5 @@
#define XVT_INCL_NATIVE
#include <applicat.h> #include <applicat.h>
#include <colors.h> #include <colors.h>
#include <config.h> #include <config.h>
@ -27,8 +29,6 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#include <windows.h>
#ifndef ATTR_WIN_USE_CTL3D #ifndef ATTR_WIN_USE_CTL3D
#include <ctl3d.h> #include <ctl3d.h>
#endif #endif
@ -43,7 +43,7 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); } extern "C" { WINDOW xvtwi_hwnd_to_window(HWND); }
short CHARX = 8; short CHARX = 8;
short ROWY = GetSystemMetrics(SM_CYSCREEN) / 25; short ROWY = -GetSystemMetrics(SM_CYSCREEN) / 25; // Not so good!
short CHARY = 14; short CHARY = 14;
short BASEY = 12; short BASEY = 12;
@ -297,6 +297,14 @@ RCT& resize_rect(
} }
wt = WC_EDIT; wt = WC_EDIT;
} }
else
{
if (ROWY <= 0) // Not yet initialized
{
RCT pc; xvt_vobj_get_client_rect(TASK_WIN, &pc);
ROWY = (pc.bottom - pc.top) / 23;
}
}
switch (wt) switch (wt)
{ {