From c263f7d5b44860e748234089e1f459b75752405b Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 27 Mar 2003 12:15:57 +0000 Subject: [PATCH] Patch level : 2.0 nopatch Files correlati : tutti Ricompilazione Demo : [ ] Commento : Eliminata una valaga di roba inutile in xvt_defs.h ed aggiunta qualche funzioncina in avt.h git-svn-id: svn://10.65.10.50/trunk@10950 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/xvaga.cpp | 79 +++++++++++++++++++++++++++++++++++++++++++----- xvaga/xvt.h | 6 ++++ xvaga/xvt_defs.h | 31 +------------------ 3 files changed, 78 insertions(+), 38 deletions(-) diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index c4552bc55..9b414a92f 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -28,7 +28,7 @@ MENU_ITEM* xvt_menu_duplicate_tree(const MENU_ITEM* m); XVT_CONFIG* _config_ = NULL; wxWindow* _task_win = NULL; wxWindow* _mouse_trapper = NULL; -RCT* _startup_rect = NULL; +RCT _startup_rect = { 0,0,0,0 }; wxString _startup_dir; static EVENT_HANDLER _task_win_handler = NULL; @@ -1140,12 +1140,12 @@ void xvt_app_create(int argc, char **argv, unsigned long flags, wxSize size = wxDefaultSize; long style = wxDEFAULT_FRAME_STYLE; - if (_startup_rect != NULL) + if (_startup_rect.right > _startup_rect.left) { - pos.x = _startup_rect->left; - pos.y = _startup_rect->top; - size.x = _startup_rect->right - _startup_rect->left; - size.y = _startup_rect->bottom - _startup_rect->top; + pos.x = _startup_rect.left; + pos.y = _startup_rect.top; + size.x = _startup_rect.right - _startup_rect.left; + size.y = _startup_rect.bottom - _startup_rect.top; } else style |= wxMAXIMIZE; @@ -3197,6 +3197,54 @@ BOOLEAN xvt_str_match(const char *mbs, const char *pat, BOOLEAN case_sensitive) return text.Matches(pattern); } +/////////////////////////////////////////////////////////// +// XVT system calls (added by Guy) +/////////////////////////////////////////////////////////// + +int xvt_sys_get_profile_string(const char* file, const char* paragraph, const char* name, + const char* defval, char* value, int maxsize) +{ +#ifdef WIN32 + int len = GetPrivateProfileString(paragraph, name, defval, value, maxsize, file); +#else + wxFileConfig ini("", "", file); + + wxString path; + path << "/" << paragraph; + ini.SetPath(path); + + int len = 0; + wxString val; + if (!ini.Read(name, &val)) + val = defval; + + len = val.Length(); + if (value) + { + wxStrncpy(value, val, maxsize); + value[maxsize-1] = '\0'; + } +#endif + + return len; +} + +BOOLEAN xvt_sys_set_profile_string(const char* file, const char* paragraph, const char* name, + const char* value) +{ +#ifdef WIN32 + return WritePrivateProfileString(paragraph, name, value, file); +#else + wxFileConfig ini("", "", file); + + wxString path; + path << "/" << paragraph; + ini.SetPath(path); + + return ini.Write(name, value); +#endif +} + /////////////////////////////////////////////////////////// // Timers /////////////////////////////////////////////////////////// @@ -3265,6 +3313,15 @@ long xvt_vobj_get_attr(WINDOW win, long data) ret = (long)xcc; } break; + case ATTR_FRAME_WIDTH: + ret = wxSystemSettings::GetSystemMetric(wxSYS_FRAMESIZE_X); + break; + case ATTR_FRAME_HEIGHT: + ret = wxSystemSettings::GetSystemMetric(wxSYS_FRAMESIZE_Y); + break; + case ATTR_TITLE_HEIGHT: + ret = wxSystemSettings::GetSystemMetric(wxSYS_CAPTION_Y); + break; case ATTR_CTL_VERT_SBAR_WIDTH: ret = wxSystemSettings::GetSystemMetric(wxSYS_VSCROLL_X); break; @@ -3295,6 +3352,12 @@ long xvt_vobj_get_attr(WINDOW win, long data) ret = w.GetHandle(); } break; + case ATTR_SCREEN_HEIGHT: + ret = wxSystemSettings::GetSystemMetric(wxSYS_SCREEN_Y); + break; + case ATTR_SCREEN_WIDTH: + ret = wxSystemSettings::GetSystemMetric(wxSYS_SCREEN_X); + break; case ATTR_SCREEN_WINDOW: ret = NULL_WIN; // Non bellissimo ma per ora... break; @@ -3393,9 +3456,9 @@ void xvt_vobj_set_attr(WINDOW win, long data, long value) switch(data) { case ATTR_ERRMSG_HANDLER: _error_handler = (XVT_ERRMSG_HANDLER)value; break; - case ATTR_EVENT_HOOK: break; // TBI?: Native events hook! + case ATTR_EVENT_HOOK: SORRY_BOX(); break; // TBI?: Native events hook! case ATTR_WIN_PM_DRAWABLE_TWIN: break; // Ignored: Always TRUE - case ATTR_WIN_PM_TWIN_STARTUP_RCT: _startup_rect = (RCT*)value; break; + case ATTR_WIN_PM_TWIN_STARTUP_RCT: _startup_rect = *(RCT*)value; break; case ATTR_WIN_PM_TWIN_STARTUP_STYLE: break; // TBI default: SORRY_BOX(); break; } diff --git a/xvaga/xvt.h b/xvaga/xvt.h index d47d4ca07..99798c356 100755 --- a/xvaga/xvt.h +++ b/xvaga/xvt.h @@ -231,6 +231,12 @@ 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 +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); + long xvt_timer_create(WINDOW win, long interval); void xvt_timer_destroy(long id); diff --git a/xvaga/xvt_defs.h b/xvaga/xvt_defs.h index 366939e2f..d9b8ea0ff 100755 --- a/xvaga/xvt_defs.h +++ b/xvaga/xvt_defs.h @@ -5,7 +5,7 @@ * Agreement with XVT Software. * * $RCSfile: xvt_defs.h,v $ - * $Revision: 1.2 $ + * $Revision: 1.3 $ * * Purpose: Global XVT macro definitions. * @@ -14,35 +14,6 @@ #ifndef XVT_INCL_DEFS #define XVT_INCL_DEFS -/*--------------------------------------------------------------------------- - Machine-related constants noramlly found in limits.h ----------------------------------------------------------------------------*/ -#ifndef UINT_MAX -#define UINT_MAX (unsigned)(~0) -#endif -/* I18N OK - Must leave in because already in the API */ -#ifndef UCHAR_MAX -#define UCHAR_MAX (unsigned char)(~0) -#endif -#ifndef CHAR_MAX -#define CHAR_MAX ((char)(UCHAR_MAX >> 1)) -#endif -#ifndef USHRT_MAX -#define USHRT_MAX (unsigned short)(~0) -#endif -#ifndef ULONG_MAX -#define ULONG_MAX (unsigned long)(~0L) -#endif -#ifndef INT_MAX -#define INT_MAX ((int)(UINT_MAX >> 1)) -#endif -#ifndef SHRT_MAX -#define SHRT_MAX ((short)(USHRT_MAX >> 1)) -#endif -#ifndef LONG_MAX -#define LONG_MAX ((long)(ULONG_MAX >> 1)) -#endif - /*--------------------------------------------------------------------------- Resource ID constants ---------------------------------------------------------------------------*/