From c2ff79b17b1f3e8117e23179340cf69a85b5fe61 Mon Sep 17 00:00:00 2001 From: David Webster Date: Thu, 29 Jul 1999 04:56:34 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3189 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/ownerdrw.h | 10 ++--- include/wx/printdlg.h | 2 +- include/wx/wxprec.h | 5 --- src/common/docview.cpp | 3 +- src/common/dynlib.cpp | 25 ++++++++++-- src/common/file.cpp | 12 ++++++ src/common/fileconf.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++- src/common/filefn.cpp | 72 ++++++++++++++++++++++++++-------- 8 files changed, 196 insertions(+), 35 deletions(-) diff --git a/include/wx/ownerdrw.h b/include/wx/ownerdrw.h index fa89707..e92483c 100644 --- a/include/wx/ownerdrw.h +++ b/include/wx/ownerdrw.h @@ -2,7 +2,7 @@ // Name: ownerdrw.h // Purpose: interface for owner-drawn GUI elements // Author: Vadim Zeitlin -// Modified by: +// Modified by: // Created: 11.11.97 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin @@ -52,7 +52,7 @@ public: wxColour& GetBackgroundColour() const { return (wxColour&) m_colBack ; } - void SetBitmaps(const wxBitmap& bmpChecked, + void SetBitmaps(const wxBitmap& bmpChecked, const wxBitmap& bmpUnchecked = wxNullBitmap) { m_bmpChecked = bmpChecked; m_bmpUnchecked = bmpUnchecked; @@ -94,10 +94,10 @@ public: // constants used in OnDrawItem // (they have the same values as corresponding Win32 constants) enum wxODAction - { + { wxODDrawAll = 0x0001, // redraw entire control wxODSelectChanged = 0x0002, // selection changed (see Status.Select) - wxODFocusChanged = 0x0004, // keyboard focus changed (see Status.Focus) + wxODFocusChanged = 0x0004 // keyboard focus changed (see Status.Focus) }; enum wxODStatus @@ -107,7 +107,7 @@ public: wxODDisabled = 0x0004, // item is to be drawn as disabled wxODChecked = 0x0008, // item is to be checked wxODHasFocus = 0x0010, // item has the keyboard focus - wxODDefault = 0x0020, // item is the default item + wxODDefault = 0x0020 // item is the default item }; // virtual functions to implement drawing (return TRUE if processed) diff --git a/include/wx/printdlg.h b/include/wx/printdlg.h index 8a9480c..9063c3f 100644 --- a/include/wx/printdlg.h +++ b/include/wx/printdlg.h @@ -17,7 +17,7 @@ #include "wx/generic/prntdlgg.h" #endif -#if !defined(__WXMSW__) && !defined(__WXMAC__) +#if !defined(__WXMSW__) && !defined(__WXMAC__) && !defined(__WXPM__) #define wxPrintDialog wxGenericPrintDialog #define sm_classwxPrintDialog sm_classwxGenericPrintDialog diff --git a/include/wx/wxprec.h b/include/wx/wxprec.h index c79a641..a71f66e 100644 --- a/include/wx/wxprec.h +++ b/include/wx/wxprec.h @@ -32,11 +32,6 @@ #include "wx/msw/winundef.h" #endif -#ifdef __WXPM__ -#define INCL_OS2 -#include -#endif - #include "wx/wx.h" diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 33cde3d..e5dda96 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -42,6 +42,7 @@ #include "wx/intl.h" #endif + #ifdef __WXGTK__ #include "wx/mdi.h" #endif @@ -834,7 +835,7 @@ void wxDocManager::OnPrintSetup(wxCommandEvent& WXUNUSED(event)) wxPrintDialogData data; - wxPrintDialog printerDialog(parentWin, & data); + wxPrintDialog printerDialog(parentWin, &data); printerDialog.GetPrintDialogData().SetSetupDialog(TRUE); printerDialog.ShowModal(); #endif // wxUSE_PRINTING_ARCHITECTURE diff --git a/src/common/dynlib.cpp b/src/common/dynlib.cpp index 26844df..f0ac7a1 100644 --- a/src/common/dynlib.cpp +++ b/src/common/dynlib.cpp @@ -26,7 +26,6 @@ #ifdef __BORLANDC__ #pragma hdrstop #endif - #if wxUSE_DYNLIB_CLASS #include "wx/dynlib.h" @@ -66,6 +65,14 @@ # endif // Win32/16 # define wxDllGetSymbol(handle, name) ::GetProcAddress(handle, name) # define wxDllClose ::FreeLibrary + +#elif defined(__OS2__) + +# define INCL_DOS +# include +# define wxDllOpen(error, lib, handle) DosLoadModule(error, sizeof(error), lib, &handle) +# define wxDllGetSymbol(handle, modaddr) DosQueryProcAddr(handle, 1L, NULL, (PFN*)modaddr) +# define wxDllClose(handle) DosFreeModule(handle) #else # error "Don't know how to load shared libraries on this platform." #endif // OS @@ -92,7 +99,7 @@ static wxString ConstructLibraryName(const wxString& basename) # else //__HPUX__ fullname << ".so"; # endif //__HPUX__ -#elif defined(__WINDOWS__) +#elif defined(__WINDOWS__) || defined(__OS2__) fullname << ".dll"; #endif @@ -179,7 +186,7 @@ wxDllLoader::GetProgramHandle(void) #ifdef __UNIX__ return dlopen(NULL, RTLD_NOW/*RTLD_LAZY*/); #else - wxFAIL_MSG(_("This method is not implemented under Windows")); + wxFAIL_MSG(_("This method is not implemented under Windows or OS/2")); return 0; #endif @@ -204,6 +211,9 @@ wxDllLoader::LoadLibrary(const wxString & libname, bool *success) wxASSERT_MSG( 1 , (char*)myErrName ) ; return NULL ; } +#elif defined(__OS2__) + char zError[256] = ""; + wxDllOpen(zError, libname, handle); #else // !Mac handle = wxDllOpen(libname); #endif // OS @@ -245,6 +255,8 @@ wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name) if ( FindSymbol( dllHandle , symName , &symAddress , &symClass ) == noErr ) symbol = (void *)symAddress ; +#elif defined( __OS2__ ) + wxDllGetSymbol(dllHandle, symbol); #else symbol = wxDllGetSymbol(dllHandle, name); #endif @@ -283,9 +295,14 @@ wxLibrary *wxLibraries::LoadLibrary(const wxString& name) wxLibrary *lib; wxClassInfo *old_sm_first; +#if defined(__VISAGECPP__) + node = m_loaded.Find(name.GetData()); + if (node != NULL) + return ((wxLibrary *)node->Data()); +#else // !OS/2 if ( (node = m_loaded.Find(name.GetData())) ) return ((wxLibrary *)node->Data()); - +#endif // If DLL shares data, this is necessary. old_sm_first = wxClassInfo::sm_first; wxClassInfo::sm_first = NULL; diff --git a/src/common/file.cpp b/src/common/file.cpp index 2cdd6e8..6b65c35 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -60,6 +60,11 @@ #ifdef __GNUWIN32__ #include #endif +#elif (defined(__WXPM__)) + #include + #include + #define W_OK 2 + #define R_OK 4 #elif (defined(__WXSTUBS__)) // Have to ifdef this for different environments #include @@ -479,6 +484,13 @@ bool wxTempFile::Open(const wxString& strName) static const wxChar *szMktempSuffix = _T("XXXXXX"); m_strTemp << strName << szMktempSuffix; mktemp(MBSTRINGCAST m_strTemp.mb_str()); // will do because length doesn't change +#elif defined(__WXPM__) + // for now just create a file + // future enhancements can be to set some extended attributes for file systems + // OS/2 supports that have them (HPFS, FAT32) and security (HPFS386) + static const wxChar *szMktempSuffix = _T("XXX"); + m_strTemp << strName << szMktempSuffix; + mkdir(m_strTemp.GetWriteBuf(MAX_PATH)); #else // Windows wxString strPath; wxSplitPath(strName, &strPath, NULL, NULL); diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index c15130a..0193dbd 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -46,6 +46,13 @@ #if defined(__WXMSW__) && !defined(_WINDOWS_) #include #endif //windows.h +#if defined(__WXPM__) + #define INCL_DOS + #include + #define LINKAGEMODE _Optlink +#else + #define LINKAGEMODE +#endif #include #include @@ -67,8 +74,8 @@ // ---------------------------------------------------------------------------- // compare functions for sorting the arrays -static int CompareEntries(ConfigEntry *p1, ConfigEntry *p2); -static int CompareGroups(ConfigGroup *p1, ConfigGroup *p2); +static int LINKAGEMODE CompareEntries(ConfigEntry *p1, ConfigEntry *p2); +static int LINKAGEMODE CompareGroups(ConfigGroup *p1, ConfigGroup *p2); // filter strings static wxString FilterInValue(const wxString& str); @@ -93,6 +100,97 @@ wxString wxFileConfig::GetGlobalDir() #ifdef __UNIX__ strDir = _T("/etc/"); + #elif defined(__WXPM__) + ULONG aulSysInfo[QSV_MAX] = {0}; + UINT drive; + APIRET rc; + + rc = DosQuerySysInfo( 1L, QSV_MAX, (PVOID)aulSysInfo, sizeof(ULONG)*QSV_MAX); + if (rc == 0) + { + drive = aulSysInfo[QSV_BOOT_DRIVE - 1]; + switch(drive) + { + case 1: + strDir = "A:\\OS2\\"; + break; + case 2: + strDir = "B:\\OS2\\"; + break; + case 3: + strDir = "C:\\OS2\\"; + break; + case 4: + strDir = "D:\\OS2\\"; + break; + case 5: + strDir = "E:\\OS2\\"; + break; + case 6: + strDir = "F:\\OS2\\"; + break; + case 7: + strDir = "G:\\OS2\\"; + break; + case 8: + strDir = "H:\\OS2\\"; + break; + case 9: + strDir = "I:\\OS2\\"; + break; + case 10: + strDir = "J:\\OS2\\"; + break; + case 11: + strDir = "K:\\OS2\\"; + break; + case 12: + strDir = "L:\\OS2\\"; + break; + case 13: + strDir = "M:\\OS2\\"; + break; + case 14: + strDir = "N:\\OS2\\"; + break; + case 15: + strDir = "O:\\OS2\\"; + break; + case 16: + strDir = "P:\\OS2\\"; + break; + case 17: + strDir = "Q:\\OS2\\"; + break; + case 18: + strDir = "R:\\OS2\\"; + break; + case 19: + strDir = "S:\\OS2\\"; + break; + case 20: + strDir = "T:\\OS2\\"; + break; + case 21: + strDir = "U:\\OS2\\"; + break; + case 22: + strDir = "V:\\OS2\\"; + break; + case 23: + strDir = "W:\\OS2\\"; + break; + case 24: + strDir = "X:\\OS2\\"; + break; + case 25: + strDir = "Y:\\OS2\\"; + break; + case 26: + strDir = "Z:\\OS2\\"; + break; + } + } #elif defined(__WXSTUBS__) wxASSERT_MSG( FALSE, _T("TODO") ) ; #elif defined(__WXMAC__) diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 13ecede..c809581 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -58,6 +58,10 @@ #include #endif +#ifdef __OS2__ + #include + #include +#endif #ifdef __WINDOWS__ #if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) #include @@ -471,8 +475,25 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) #endif /* Expand inline environment variables */ +#ifdef __VISAGECPP__ + while (*d) + { + *d++ = *s; + if(*s == _T('\\')) + { + *(d - 1) = *++s; + if (*d) + { + s++; + continue; + } + else + break; + } + else +#else while ((*d++ = *s)) { -#ifndef __WXMSW__ +# ifndef __WXMSW__ if (*s == _T('\\')) { if ((*(d - 1) = *++s)) { s++; @@ -480,6 +501,7 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) } else break; } else +# endif #endif #ifdef __WXMSW__ if (*s++ == _T('$') && (*s == _T('{') || *s == _T(')'))) @@ -490,7 +512,13 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) register wxChar *start = d; register int braces = (*s == _T('{') || *s == _T('(')); register wxChar *value; +#ifdef __VISAGECPP__ + // VA gives assignment in logical expr warning + while (*d) + *d++ = *s; +#else while ((*d++ = *s)) +#endif if (braces ? (*s == _T('}') || *s == _T(')')) : !(wxIsalnum(*s) || *s == _T('_')) ) break; else @@ -498,7 +526,12 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) *--d = 0; value = wxGetenv(braces ? start + 1 : start); if (value) { +#ifdef __VISAGECPP__ + // VA gives assignment in logical expr warning + for ((d = start - 1); (*d); *d++ = *value++); +#else for ((d = start - 1); (*d++ = *value++);); +#endif d--; if (braces && *s) s++; @@ -550,8 +583,13 @@ wxChar *wxExpandPath(wxChar *buf, const wxChar *name) *(d - 1) = SEP; } s = nm; +#ifdef __VISAGECPP__ + // VA gives assignment in logical expr warning + while (*d) + *d++ = *s++; +#else while ((*d++ = *s++)); - +#endif delete[] nm_tmp; // clean up alloc /* Now clean up the buffer */ return wxRealPath(buf); @@ -632,7 +670,7 @@ wxChar *wxFileNameFromPath (wxChar *path) #endif return tcp + 1; } /* while */ -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) if (wxIsalpha (*path) && *(path + 1) == _T(':')) return path + 2; #endif @@ -659,7 +697,7 @@ wxString wxFileNameFromPath (const wxString& path1) #endif return wxString(tcp + 1); } /* while */ -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) if (wxIsalpha (*path) && *(path + 1) == _T(':')) return wxString(path + 2); #endif @@ -703,7 +741,7 @@ wxPathOnly (wxChar *path) else i --; } -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) // Try Drive specifier if (wxIsalpha (buf[0]) && buf[1] == _T(':')) { @@ -751,7 +789,7 @@ wxString wxPathOnly (const wxString& path) else i --; } -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) // Try Drive specifier if (wxIsalpha (buf[0]) && buf[1] == _T(':')) { @@ -830,7 +868,7 @@ wxDos2UnixFilename (wxChar *s) { if (*s == _T('\\')) *s = _T('/'); -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) else *s = wxTolower(*s); // Case INDEPENDENT #endif @@ -839,14 +877,14 @@ wxDos2UnixFilename (wxChar *s) } void -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) wxUnix2DosFilename (wxChar *s) #else wxUnix2DosFilename (wxChar *WXUNUSED(s)) #endif { // Yes, I really mean this to happen under DOS only! JACS -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXPM__) if (s) while (*s) { @@ -992,12 +1030,12 @@ bool wxMkdir(const wxString& dir, int perm) const wxChar *dirname = dir.c_str(); #endif // Mac/!Mac - // assume mkdir() has 2 args on non Windows platforms and on Windows too + // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too // for the GNU compiler -#if !defined(__WXMSW__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__) +#if (!(defined(__WXMSW__) || defined(__WXPM__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__) if ( mkdir(wxFNCONV(dirname), perm) != 0 ) -#else // MSW - if ( mkdir(wxFNCONV(dirname)) != 0 ) +#else // MSW and OS/2 + if ( mkdir((char*)wxFNCONV(dirname)) != 0 ) #endif // !MSW/MSW { wxLogSysError(_("Directory '%s' couldn't be created"), dirname); @@ -1464,8 +1502,8 @@ wxString wxGetCwd() bool wxSetWorkingDirectory(const wxString& d) { -#if defined( __UNIX__ ) || defined( __WXMAC__ ) - return (chdir(d.fn_str()) == 0); +#if defined( __UNIX__ ) || defined( __WXMAC__ ) || defined(__WXPM__) + return (chdir((char*)d.fn_str()) == 0); #elif defined(__WINDOWS__) #ifdef __WIN32__ @@ -1581,7 +1619,7 @@ void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName, pDot = NULL; } #endif // MSW/Unix - + if ( pDot < pLastSeparator ) { // the dot is part of the path, not the start of the extension @@ -1590,7 +1628,7 @@ void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName, if ( pstrPath ) { - if ( pLastSeparator ) + if ( pLastSeparator ) *pstrPath = wxString(pszFileName, pLastSeparator - pszFileName); else pstrPath->Empty(); -- 2.7.4