X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/636773ddad93b2b9ec98c166a3a41251e52407a8..2f1e3c464ce0886163be49d4a10843f2b4c9679b:/src/common/utilscmn.cpp diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index f9e56b9f2b..5a91c57e8f 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -29,14 +29,13 @@ #endif #ifndef WX_PRECOMP - #include "wx/defs.h" + #include "wx/app.h" #include "wx/string.h" #include "wx/utils.h" #include "wx/intl.h" #include "wx/log.h" #if wxUSE_GUI - #include "wx/app.h" #include "wx/window.h" #include "wx/frame.h" #include "wx/menu.h" @@ -50,10 +49,10 @@ #endif // wxUSE_GUI #endif // WX_PRECOMP -#ifndef __WIN16__ +#include "wx/apptrait.h" + #include "wx/process.h" #include "wx/txtstrm.h" -#endif #include #include @@ -89,7 +88,7 @@ #include "wx/msw/private.h" #endif -#if 1 // def __WXBASE__ +#if wxUSE_BASE // ---------------------------------------------------------------------------- // common data @@ -145,8 +144,8 @@ wxRegisterId (long id) #if WXWIN_COMPATIBILITY_2_4 -WXDLLEXPORT_DATA(const wxChar *) wxFloatToStringStr = wxT("%.2f"); -WXDLLEXPORT_DATA(const wxChar *) wxDoubleToStringStr = wxT("%.2f"); +WXDLLIMPEXP_DATA_BASE(const wxChar *) wxFloatToStringStr = wxT("%.2f"); +WXDLLIMPEXP_DATA_BASE(const wxChar *) wxDoubleToStringStr = wxT("%.2f"); void StringToFloat (const wxChar *s, float *number) @@ -292,6 +291,16 @@ wxString wxGetDataDir() return dir; } +int wxGetOsVersion(int *verMaj, int *verMin) +{ + // we want this function to work even if there is no wxApp + wxConsoleAppTraits traitsConsole; + wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; + if ( ! traits ) + traits = &traitsConsole; + + return traits->GetOSVersion(verMaj, verMin); +} // ---------------------------------------------------------------------------- // network and user id functions @@ -472,11 +481,6 @@ static long wxDoExecuteWithCapture(const wxString& command, wxArrayString& output, wxArrayString* error) { -#ifdef __WIN16__ - wxFAIL_MSG("Sorry, this version of wxExecute not implemented on WIN16."); - - return 0; -#else // !Win16 // create a wxProcess which will capture the output wxProcess *process = new wxProcess; process->Redirect(); @@ -501,7 +505,6 @@ static long wxDoExecuteWithCapture(const wxString& command, delete process; return rc; -#endif // IO redirection supported } long wxExecute(const wxString& command, wxArrayString& output) @@ -530,7 +533,7 @@ bool wxYieldIfNeeded() return wxTheApp && wxTheApp->Yield(TRUE); } -#endif // __WXBASE__ +#endif // wxUSE_BASE // ============================================================================ // GUI-only functions from now on @@ -554,7 +557,9 @@ wxChar *wxStripMenuCodes(const wxChar *in, wxChar *out) } else { - out = copystring(s); + // MYcopystring - for easier search... + out = new wxChar[s.length() + 1]; + wxStrcpy(out, s.c_str()); } return out; @@ -825,20 +830,6 @@ wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit) } #endif // wxUSE_FONTDLG -// ---------------------------------------------------------------------------- -// missing C RTL functions (FIXME shouldn't be here at all) -// ---------------------------------------------------------------------------- - -#if defined( __MWERKS__ ) && !defined(__MACH__) -char *strdup(const char *s) -{ - return strcpy( (char*) malloc( strlen( s ) + 1 ) , s ) ; -} -int isascii( int c ) -{ - return ( c >= 0 && c < 128 ) ; -} -#endif // __MWERKS__ // ---------------------------------------------------------------------------- // wxSafeYield and supporting functions