Patch level : 2.0 nopatch

Files correlati     : xvaga
Ricompilazione Demo : [ ]
Commento            :

Spostate un po' di funzioni da os_win32 a xvaga


git-svn-id: svn://10.65.10.50/trunk@10964 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-04-01 07:34:53 +00:00
parent 16ec92c13b
commit e79fd6cd85
5 changed files with 128 additions and 29 deletions

View File

@ -290,3 +290,36 @@ int OsWin32_Help(unsigned int handle, const char* hlp, unsigned int cmd, const c
}
return TRUE;
}
bool OsWin32_TestNetworkVersion()
{
// Win95 only!
char* VREDIRNAME = "vredir.vxd";
DWORD handle;
DWORD dwSize = ::GetFileVersionInfoSize(VREDIRNAME,&handle);
if (dwSize)
{
BYTE infoBuffer[512];
GetFileVersionInfo(VREDIRNAME,handle,dwSize,infoBuffer);
long *language;
void * lpBuffer;
UINT Size;
if (VerQueryValue(infoBuffer, "\\VarFileInfo\\Translation", (void **)&language, &Size) && Size!=0)
{
char szName[128];
sprintf(szName, "\\StringFileInfo\\%04x%04x\\FileVersion",LOWORD(*language), HIWORD(*language));
if (VerQueryValue(infoBuffer, szName, &lpBuffer, &Size) && Size!=0)
{
const char* s = (const char *)lpBuffer;
for (int i = 0; i < 2; i++)
s = strchr(s, '.')+1;
int subver=atoi(s);
if (subver >= 1111 && subver <= 1115)
return false;
}
}
}
return true;
}

View File

@ -16,4 +16,5 @@ void OsWin32_StretchBlt(unsigned int hDst, int xd, int yd, int wd, int hd,
unsigned int hSrc, int xs, int ys, int ws, int hs);
void OsWin32_UpdateWindow(unsigned int handle);
int OsWin32_Help(unsigned int handle, const char* hlp, unsigned int cmd, const char* topic);
int OsWin32_Help(unsigned int handle, const char* hlp, unsigned int cmd, const char* topic);
bool OsWin32_TestNetworkVersion();

View File

@ -472,20 +472,18 @@ void TDC::KillDC()
void TDC::SetClippingBox(const RCT* pRct)
{
#if wxCHECK_VERSION(2,3,0)
if (_dc != NULL)
_dc->DestroyClippingRegion();
#endif
if (pRct)
{
#if wxCHECK_VERSION(2,3,0)
if (_dc != NULL)
_dc->DestroyClippingRegion();
#endif
wxRect rct = NormalizeRCT(pRct);
GetDC().SetClippingRegion(rct);
_clip = *pRct;
}
else
{
if (_dc != NULL) // Inutile resettare il nulla!
_dc->DestroyClippingRegion();
_clip.left = _clip.top = 0;
_clip.right = _clip.bottom = 32000;
}
@ -1857,7 +1855,7 @@ void xvt_dwin_draw_dotted_rect(WINDOW win, RCT *rctp)
CBRUSH brush;
brush.color = dct.back_color;
brush.pat = PAT_HOLLOW;
xvt_dwin_set_cbrush(win, &pen);
xvt_dwin_set_cbrush(win, &brush);
xvt_dwin_draw_rect(win, rctp);
@ -2294,7 +2292,7 @@ void xvt_font_unmap(XVT_FNTID font_id)
BOOLEAN xvt_fsys_convert_dir_to_str(DIRECTORY *dirp, char *path, int sz_path)
{
strncpy(path, dirp->path, sz_path);
wxStrncpy(path, dirp->path, sz_path);
path[sz_path-1] = '\0';
return TRUE;
}
@ -3114,11 +3112,7 @@ void xvt_sbar_set_range(WINDOW win, SCROLL_TYPE t, int min, int max)
void xvt_scr_beep(void)
{
#ifdef WIN32
OsWin32_Beep(0);
#else
wxBell();
#endif
xvt_sys_beep(0);
}
WINDOW xvt_scr_get_focus_topwin(void)
@ -3163,7 +3157,6 @@ void xvt_scr_set_focus_vobj(WINDOW win)
{
CAST_WIN(win, w);
w.SetFocus();
}
///////////////////////////////////////////////////////////
@ -3287,6 +3280,15 @@ BOOLEAN xvt_str_match(const char *mbs, const char *pat, BOOLEAN case_sensitive)
// XVT system calls (added by Guy)
///////////////////////////////////////////////////////////
void xvt_sys_beep(int severity)
{
#ifdef WIN32
OsWin32_Beep(severity);
#else
wxBell();
#endif
}
int xvt_sys_get_profile_string(const char* file, const char* paragraph, const char* name,
const char* defval, char* value, int maxsize)
{
@ -3333,23 +3335,49 @@ BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph, cons
unsigned long xvt_sys_get_free_memory()
{
unsigned long mem = 1024*1024;
#ifdef WIN32
MEMORYSTATUS ms;
GlobalMemoryStatus(&ms);
mem = ms.dwAvailPhys;
#endif
unsigned long mem = ::wxGetFreeMemory();
return mem;
}
unsigned long xvt_sys_get_free_memory_kb()
{
unsigned long mem = xvt_sys_get_free_memory();
return (mem + 512) / 1024;
return mem / 1024; // Arrotondo per difetto
}
int xvt_sys_get_os_version()
{
int os = 0;
int major, minor;
switch (::wxGetOsVersion(&major, &minor))
{
case wxGTK:
os = XVT_WS_LINUX_GTK; break;
case wxWIN95:
os = minor == 0 ? XVT_WS_WIN_95 : XVT_WS_WIN_98; break;
case wxWINDOWS_NT:
os = XVT_WS_WIN_NT; break;
default:
break;
}
return os;
}
void xvt_sys_sleep(unsigned long msec)
{
wxThread::Sleep(msec);
}
BOOLEAN xvt_sys_test_network_version()
{
#ifdef WIN32
if (xvt_sys_get_os_version() == XVT_WS_WIN_95)
return OsWin32_TestNetworkVersion();
#endif
return TRUE;
}
///////////////////////////////////////////////////////////
// Timers
///////////////////////////////////////////////////////////
@ -3701,13 +3729,33 @@ WINDOW xvt_win_create(WIN_TYPE wtype, RCT *rct_p, char *title, int menu_rid, WIN
return (WINDOW)w;
}
long xvt_win_dispatch_event(WINDOW win, EVENT *event_p)
long xvt_win_dispatch_event(WINDOW win, EVENT* event_p)
{
XVT_ASSERT(event_p != NULL);
CAST_TWIN(win, w);
return w._eh(win, event_p);
}
void xvt_win_post_event(WINDOW win, EVENT* event_p)
{
XVT_ASSERT(win != NULL_WIN && event_p != NULL);
CAST_WIN(win, w);
switch (event_p->type)
{
case E_COMMAND:
{
wxCommandEvent e(wxEVT_COMMAND_MENU_SELECTED, event_p->v.cmd.tag);
e.SetEventObject(&w);
wxPostEvent(&w, e);
}
break;
default:
SORRY_BOX();
break;
}
}
void xvt_win_release_pointer(void)
{
if (_mouse_trapper != NULL)
@ -3828,4 +3876,4 @@ WINDOW statbar_create(int cid, int left, int top, int right, int bottom,
w.SetStatusWidths(2, widths);
return (WINDOW)&w;
}
}

View File

@ -238,13 +238,17 @@ SLIST_ELT xvt_slist_get_next(SLIST list, SLIST_ELT item);
char* xvt_str_duplicate(const char* str);
BOOLEAN xvt_str_match(const char* str, const char* pat, BOOLEAN case_sensitive);
// System calls by Guy
// System calls by XVAGA
void xvt_sys_beep(int severity);
int xvt_sys_get_profile_string(const char* file, const char* paragraph, const char* name,
const char* defval, char* value, int maxsize);
BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph, const char* name,
const char* value);
unsigned long xvt_sys_get_free_memory();
unsigned long xvt_sys_get_free_memory_kb();
int xvt_sys_get_os_version();
void xvt_sys_sleep(unsigned long msec);
BOOLEAN xvt_sys_test_network_version();
long xvt_timer_create(WINDOW win, long interval);
void xvt_timer_destroy(long id);
@ -269,7 +273,8 @@ void xvt_vobj_set_visible(WINDOW win, BOOLEAN show);
void xvt_vobj_translate_points(WINDOW from_win, WINDOW to_win, PNT *pntp, int npnts);
WINDOW xvt_win_create(WIN_TYPE wtype, RCT *rct_p, char *title, int menu_rid, WINDOW parent_win, long win_flags, EVENT_MASK mask, EVENT_HANDLER eh, long app_data);
long xvt_win_dispatch_event(WINDOW win, EVENT *event_p);
long xvt_win_dispatch_event(WINDOW win, EVENT* event_p);
void xvt_win_post_event(WINDOW win, EVENT* event_p); // Added by XVAGA
void xvt_win_release_pointer(void);
void xvt_win_set_caret_size(WINDOW win, int width, int height);
void xvt_win_set_caret_pos(WINDOW win, PNT p);

View File

@ -1,7 +1,19 @@
#define XVT_OS_WIN 300
#define XVT_OS_LINUX 300
#define XVT_OS_WIN32 400
#ifdef WIN32
#define XVT_OS XVT_OS_WIN32
#else
#define XVT_OS XVT_OS_LINUX
#endif
#define XVT_WS_LINUX_GTK 301
#define XVT_WS_WIN_95 401
#define XVT_WS_WIN_98 402
#define XVT_WS_WIN_ME 403
#define XVT_WS_WIN_NT 411
#define XVT_WS_WIN_2000 412
#define XVT_WS_WIN_XP 413
#define ATTR_WIN_BASE 10000
#define ATTR_WIN_CMD_LINE (ATTR_WIN_BASE + 0)