From 1be7f92adb9b0140ccbbc7a5b4d2731da0318837 Mon Sep 17 00:00:00 2001 From: David Webster Date: Thu, 21 Oct 1999 05:13:26 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4097 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/os2/clipbrd.h | 31 +-- src/os2/makefile.va | 295 +++++++++++++++++----------- src/os2/utils.cpp | 414 +++++++++++++++++++++++---------------- 3 files changed, 434 insertions(+), 306 deletions(-) diff --git a/include/wx/os2/clipbrd.h b/include/wx/os2/clipbrd.h index 481d239867..0d9110188d 100644 --- a/include/wx/os2/clipbrd.h +++ b/include/wx/os2/clipbrd.h @@ -15,9 +15,6 @@ #ifndef _WX_CLIPBRD_H_ #define _WX_CLIPBRD_H_ -#include "wx/defs.h" -#include "wx/setup.h" - #if wxUSE_CLIPBOARD #include "wx/list.h" @@ -83,28 +80,16 @@ public: // clears wxTheClipboard and the system's clipboard if possible virtual void Clear(); - /// X11 has two clipboards which get selected by this call. Empty on MSW. - void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { } - -}; - -// The global clipboard object -WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard; - -//----------------------------------------------------------------------------- -// wxClipboardModule: module responsible for initializing the global clipboard -// object -//----------------------------------------------------------------------------- - -class wxClipboardModule : public wxModule -{ - DECLARE_DYNAMIC_CLASS(wxClipboardModule) + // flushes the clipboard: this means that the data which is currently on + // clipboard will stay available even after the application exits (possibly + // eating memory), otherwise the clipboard will be emptied on exit + virtual bool Flush(); -public: - wxClipboardModule() { } + // X11 has two clipboards which get selected by this call. Empty on MSW. + void UsePrimarySelection( bool WXUNUSED(primary) = FALSE ) { } - bool OnInit(); - void OnExit(); +private: + bool m_clearOnExit; }; #endif // wxUSE_CLIPBOARD diff --git a/src/os2/makefile.va b/src/os2/makefile.va index 49d69a4e6c..0ce8ecf830 100644 --- a/src/os2/makefile.va +++ b/src/os2/makefile.va @@ -134,160 +134,202 @@ NONESSENTIALOBJS= \ ..\generic\$D\fontdlgg.obj COMMONOBJS = \ + ..\common\$D\appcmn.obj \ + ..\common\$D\choiccmn.obj \ ..\common\$D\cmndata.obj \ ..\common\$D\config.obj \ + ..\common\$D\ctrlcmn.obj \ + ..\common\$D\date.obj \ + ..\common\$D\datastrm.obj \ ..\common\$D\dcbase.obj \ ..\common\$D\db.obj \ ..\common\$D\dbtable.obj \ + ..\common\$D\dlgcmn.obj \ + ..\common\$D\docmdi.obj \ ..\common\$D\docview.obj \ ..\common\$D\docmdi.obj \ ..\common\$D\dynarray.obj \ ..\common\$D\dynlib.obj \ ..\common\$D\event.obj \ + ..\common\$D\extended.obj \ + ..\common\$D\ffile.obj \ ..\common\$D\file.obj \ - ..\common\$D\filefn.obj \ ..\common\$D\fileconf.obj \ + ..\common\$D\filefn.obj \ + ..\common\$D\filesys.obj \ + ..\common\$D\fontcmn.obj \ ..\common\$D\framecmn.obj \ + ..\common\$D\fs_inet.obj \ + ..\common\$D\fs_zip.obj \ ..\common\$D\ftp.obj \ ..\common\$D\gdicmn.obj \ - ..\common\$D\image.obj \ + ..\common\$D\gifdecod.obj \ + ..\common\$D\hash.obj \ + ..\common\$D\helpbase.obj \ + ..\common\$D\http.obj \ + ..\common\$D\imagall.obj \ ..\common\$D\imagbmp.obj \ + ..\common\$D\image.obj \ + ..\common\$D\imaggif.obj \ ..\common\$D\imagjpeg.obj \ + ..\common\$D\imagpcx.obj \ ..\common\$D\imagpng.obj \ - ..\common\$D\imaggif.obj \ + ..\common\$D\imagpnm.obj \ + ..\common\$D\init.obj \ ..\common\$D\intl.obj \ ..\common\$D\ipcbase.obj \ - ..\common\$D\helpbase.obj \ ..\common\$D\layout.obj \ + ..\common\$D\list.obj \ ..\common\$D\log.obj \ + ..\common\$D\longlong.obj \ + ..\common\$D\matrix.obj \ ..\common\$D\memory.obj \ ..\common\$D\mimetype.obj \ ..\common\$D\module.obj \ - ..\common\$D\odbc.obj \ + ..\common\$D\mstream.obj \ ..\common\$D\object.obj \ + ..\common\$D\objstrm.obj \ + ..\common\$D\odbc.obj \ + ..\common\$D\paper.obj \ ..\common\$D\prntbase.obj \ + ..\common\$D\process.obj \ + ..\common\$D\protocol.obj \ + ..\common\$D\resourc2.obj \ ..\common\$D\resource.obj \ + ..\common\$D\sckaddr.obj \ + ..\common\$D\sckfile.obj \ + ..\common\$D\sckipc.obj \ + ..\common\$D\sckstrm.obj \ + ..\common\$D\serbase.obj \ + ..\common\$D\sizer.obj \ + ..\common\$D\socket.obj \ + ..\common\$D\strconv.obj \ + ..\common\$D\stream.obj \ + ..\common\$D\string.obj \ ..\common\$D\tbarbase.obj \ ..\common\$D\tbarsmpl.obj \ ..\common\$D\textfile.obj \ + ..\common\$D\textsmpl.obj \ + ..\common\$D\textcmn.obj \ + ..\common\$D\textfile.obj \ + ..\common\$D\time.obj \ ..\common\$D\timercmn.obj \ + ..\common\$D\tokenzr.obj \ + ..\common\$D\txtstrm.obj \ + ..\common\$D\unzip.obj \ + ..\common\$D\url.obj \ ..\common\$D\utilscmn.obj \ - ..\common\$D\validate.obj \ ..\common\$D\valgen.obj \ + ..\common\$D\validate.obj \ ..\common\$D\valtext.obj \ - ..\common\$D\date.obj \ - ..\common\$D\hash.obj \ - ..\common\$D\list.obj \ - ..\common\$D\paper.obj \ - ..\common\$D\string.obj \ - ..\common\$D\socket.obj \ - ..\common\$D\sckaddr.obj \ - ..\common\$D\sckfile.obj \ - ..\common\$D\sckipc.obj \ - ..\common\$D\sckstrm.obj \ - ..\common\$D\url.obj \ - ..\common\$D\http.obj \ - ..\common\$D\protocol.obj \ - ..\common\$D\time.obj \ - ..\common\$D\tokenzr.obj \ - ..\common\$D\wxexpr.obj \ - ..\common\$D\y_tab.obj \ - ..\common\$D\extended.obj \ - ..\common\$D\process.obj \ - ..\common\$D\wfstream.obj \ - ..\common\$D\mstream.obj \ - ..\common\$D\zstream.obj \ - ..\common\$D\stream.obj \ - ..\common\$D\datstrm.obj \ - ..\common\$D\objstrm.obj \ ..\common\$D\variant.obj \ - ..\common\$D\dlgcmn.obj \ + ..\common\$D\wfstream.obj \ ..\common\$D\wincmn.obj \ - ..\common\$D\txtstrm.obj \ ..\common\$D\wxchar.obj \ - ..\common\$D\unzip.obj \ - ..\common\$D\filesys.obj \ - ..\common\$D\fs_inet.obj \ - ..\common\$D\fs_zip.obj + ..\common\$D\wxexpr.obj \ + ..\common\$D\y_tab.obj \ + ..\common\$D\zipstrm.obj \ + ..\common\$D\zstream.obj COMLIBOBJS1 = \ + appcmn.obj \ + choiccmn.obj \ cmndata.obj \ config.obj \ + ctrlcmn.obj \ + date.obj \ + datastrm.obj \ dcbase.obj \ db.obj \ dbtable.obj \ + dlgcmn.obj \ + docmdi.obj \ docview.obj \ docmdi.obj \ dynarray.obj \ dynlib.obj \ event.obj \ + extended.obj \ + ffile.obj \ file.obj \ - filefn.obj \ fileconf.obj \ + filefn.obj \ + filesys.obj \ + fontcmn.obj \ framecmn.obj \ + fs_inet.obj \ + fs_zip.obj \ ftp.obj \ gdicmn.obj \ - image.obj \ + gifdecod.obj \ + hash.obj \ + helpbase.obj \ + http.obj \ + imagall.obj \ imagbmp.obj \ + image.obj \ + imaggif.obj \ imagjpeg.obj \ + imagpcx.obj \ imagpng.obj \ - imaggif.obj \ + imagpnm.obj \ + init.obj \ intl.obj \ ipcbase.obj \ - helpbase.obj \ - layout.obj \ + layout.obj + +COMLIBOBJS2 = \ + list.obj \ log.obj \ + longlong.obj \ + matrix.obj \ memory.obj \ mimetype.obj \ module.obj \ - odbc.obj \ + mstream.obj \ object.obj \ + objstrm.obj \ + odbc.obj \ + paper.obj \ prntbase.obj \ + process.obj \ + protocol.obj \ + resourc2.obj \ resource.obj \ + sckaddr.obj \ + sckfile.obj \ + sckipc.obj \ + sckstrm.obj \ + serbase.obj \ + sizer.obj \ + socket.obj \ + strconv.obj \ + stream.obj \ + string.obj \ tbarbase.obj \ tbarsmpl.obj \ textfile.obj \ + textsmpl.obj \ + textcmn.obj \ + textfile.obj \ + time.obj \ timercmn.obj \ + tokenzr.obj \ + txtstrm.obj \ + unzip.obj \ + url.obj \ utilscmn.obj \ - validate.obj \ valgen.obj \ + validate.obj \ valtext.obj \ - date.obj \ - hash.obj \ - list.obj \ - paper.obj - -COMLIBOBJS2 = \ - string.obj \ - socket.obj \ - sckaddr.obj \ - sckfile.obj \ - sckipc.obj \ - sckstrm.obj \ - url.obj \ - http.obj \ - protocol.obj \ - time.obj \ - tokenzr.obj \ - wxexpr.obj \ - y_tab.obj \ - extended.obj \ - process.obj \ - wfstream.obj \ - mstream.obj \ - zstream.obj \ - stream.obj \ - datstrm.obj \ - objstrm.obj \ variant.obj \ - dlgcmn.obj \ + wfstream.obj \ wincmn.obj \ - txtstrm.obj \ wxchar.obj \ - unzip.obj \ - filesys.obj \ - fs_inet.obj \ - fs_zip.obj + wxexpr.obj \ + y_tab.obj \ + zipstrm.obj \ + zstream.obj \ OS2OBJS = \ ..\os2\$D\accel.obj \ @@ -492,83 +534,104 @@ $(HTMLDIR)\$D: md $(HTMLDIR)\$D $(COMLIBOBJS1): + copy ..\common\$D\appcmn.obj + copy ..\common\$D\choiccmn.obj copy ..\common\$D\cmndata.obj copy ..\common\$D\config.obj + copy ..\common\$D\ctrlcmn.obj + copy ..\common\$D\date.obj + copy ..\common\$D\datastrm.obj copy ..\common\$D\dcbase.obj copy ..\common\$D\db.obj copy ..\common\$D\dbtable.obj + copy ..\common\$D\dlgcmn.obj + copy ..\common\$D\docmdi.obj copy ..\common\$D\docview.obj copy ..\common\$D\docmdi.obj copy ..\common\$D\dynarray.obj copy ..\common\$D\dynlib.obj copy ..\common\$D\event.obj + copy ..\common\$D\extended.obj + copy ..\common\$D\ffile.obj copy ..\common\$D\file.obj - copy ..\common\$D\filefn.obj copy ..\common\$D\fileconf.obj + copy ..\common\$D\filefn.obj + copy ..\common\$D\filesys.obj + copy ..\common\$D\fontcmn.obj copy ..\common\$D\framecmn.obj + copy ..\common\$D\fs_inet.obj + copy ..\common\$D\fs_zip.obj copy ..\common\$D\ftp.obj copy ..\common\$D\gdicmn.obj - copy ..\common\$D\image.obj + copy ..\common\$D\gifdecod.obj + copy ..\common\$D\hash.obj + copy ..\common\$D\helpbase.obj + copy ..\common\$D\http.obj + copy ..\common\$D\imagall.obj copy ..\common\$D\imagbmp.obj + copy ..\common\$D\image.obj + copy ..\common\$D\imaggif.obj copy ..\common\$D\imagjpeg.obj + copy ..\common\$D\imagpcx.obj copy ..\common\$D\imagpng.obj - copy ..\common\$D\imaggif.obj + copy ..\common\$D\imagpnm.obj + copy ..\common\$D\init.obj copy ..\common\$D\intl.obj copy ..\common\$D\ipcbase.obj - copy ..\common\$D\helpbase.obj copy ..\common\$D\layout.obj + +$(COMLIBOBJS2): + copy ..\common\$D\list.obj copy ..\common\$D\log.obj + copy ..\common\$D\longlong.obj + copy ..\common\$D\matrix.obj copy ..\common\$D\memory.obj copy ..\common\$D\mimetype.obj copy ..\common\$D\module.obj - copy ..\common\$D\odbc.obj + copy ..\common\$D\mstream.obj copy ..\common\$D\object.obj + copy ..\common\$D\objstrm.obj + copy ..\common\$D\odbc.obj + copy ..\common\$D\paper.obj copy ..\common\$D\prntbase.obj + copy ..\common\$D\process.obj + copy ..\common\$D\protocol.obj + copy ..\common\$D\resourc2.obj copy ..\common\$D\resource.obj + copy ..\common\$D\sckaddr.obj + copy ..\common\$D\sckfile.obj + copy ..\common\$D\sckipc.obj + copy ..\common\$D\sckstrm.obj + copy ..\common\$D\serbase.obj + copy ..\common\$D\sizer.obj + copy ..\common\$D\socket.obj + copy ..\common\$D\strconv.obj + copy ..\common\$D\stream.obj + copy ..\common\$D\string.obj copy ..\common\$D\tbarbase.obj copy ..\common\$D\tbarsmpl.obj copy ..\common\$D\textfile.obj + copy ..\common\$D\textsmpl.obj + copy ..\common\$D\textcmn.obj + copy ..\common\$D\textfile.obj + copy ..\common\$D\time.obj copy ..\common\$D\timercmn.obj + copy ..\common\$D\tokenzr.obj + copy ..\common\$D\txtstrm.obj + copy ..\common\$D\unzip.obj + copy ..\common\$D\url.obj copy ..\common\$D\utilscmn.obj - copy ..\common\$D\validate.obj copy ..\common\$D\valgen.obj + copy ..\common\$D\validate.obj copy ..\common\$D\valtext.obj - copy ..\common\$D\date.obj - copy ..\common\$D\hash.obj - copy ..\common\$D\list.obj - copy ..\common\$D\paper.obj - -$(COMLIBOBJS2): - copy ..\common\$D\string.obj - copy ..\common\$D\socket.obj - copy ..\common\$D\sckaddr.obj - copy ..\common\$D\sckfile.obj - copy ..\common\$D\sckipc.obj - copy ..\common\$D\sckstrm.obj - copy ..\common\$D\url.obj - copy ..\common\$D\http.obj - copy ..\common\$D\protocol.obj - copy ..\common\$D\time.obj - copy ..\common\$D\tokenzr.obj - copy ..\common\$D\wxexpr.obj - copy ..\common\$D\y_tab.obj - copy ..\common\$D\extended.obj - copy ..\common\$D\process.obj - copy ..\common\$D\wfstream.obj - copy ..\common\$D\mstream.obj - copy ..\common\$D\zstream.obj - copy ..\common\$D\stream.obj - copy ..\common\$D\datstrm.obj - copy ..\common\$D\objstrm.obj copy ..\common\$D\variant.obj - copy ..\common\$D\dlgcmn.obj + copy ..\common\$D\wfstream.obj copy ..\common\$D\wincmn.obj - copy ..\common\$D\txtstrm.obj copy ..\common\$D\wxchar.obj - copy ..\common\$D\unzip.obj - copy ..\common\$D\filesys.obj - copy ..\common\$D\fs_inet.obj - copy ..\common\$D\fs_zip.obj + copy ..\common\$D\wxexpr.obj + copy ..\common\$D\y_tab.obj + copy ..\common\$D\zipstrm.obj + copy ..\common\$D\zstream.obj $(GENLIBOBJS): copy ..\generic\$D\caret.obj diff --git a/src/os2/utils.cpp b/src/os2/utils.cpp index fc30b63a6e..e9ace42626 100644 --- a/src/os2/utils.cpp +++ b/src/os2/utils.cpp @@ -336,39 +336,64 @@ bool wxWriteResource( ); } -bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file) +bool wxWriteResource( + const wxString& rSection +, const wxString& rEntry +, long lValue +, const wxString& rFile +) { - wxChar buf[50]; - wxSprintf(buf, "%ld", value); - return wxWriteResource(section, entry, buf, file); + wxChar zBuf[50]; + + wxSprintf(zBuf, "%ld", lValue); + return wxWriteResource( rSection + ,rEntry + ,zBuf + ,rFile + ); } -bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file) +bool wxWriteResource( + const wxString& rSection +, const wxString& rEntry +, int lValue +, const wxString& rFile +) { - wxChar buf[50]; - wxSprintf(buf, "%d", value); - return wxWriteResource(section, entry, buf, file); + wxChar zBuf[50]; + + wxSprintf(zBuf, "%d", lValue); + return wxWriteResource( rSection + ,rEntry + ,zBuf + ,rFile + ); } -bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file) +bool wxGetResource( + const wxString& rSection +, const wxString& rEntry +, wxChar** ppValue +, const wxString& rFile +) { HAB hab; HINI hIni; - static const wxChar defunkt[] = _T("$$default"); + static const wxChar zDefunkt[] = _T("$$default"); - if (file != "") + if (rFile != "") { - hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST file); + hIni = ::PrfOpenProfile(hab, (PSZ)WXSTRINGCAST rFile); if (hIni != 0L) { ULONG n = ::PrfQueryProfileString( hIni - ,(PSZ)WXSTRINGCAST section - ,(PSZ)WXSTRINGCAST entry - ,(PSZ)defunkt + ,(PSZ)WXSTRINGCAST rSection + ,(PSZ)WXSTRINGCAST rEntry + ,(PSZ)zDefunkt ,(void*)wxBuffer ,1000 ); - if (n == 0L || wxStrcmp(wxBuffer, defunkt) == 0) + if (n == 0L || wxStrcmp(wxBuffer, zDefunkt) == 0) return FALSE; } else @@ -377,58 +402,88 @@ bool wxGetResource(const wxString& section, const wxString& entry, wxChar **valu else { ULONG n = ::PrfQueryProfileString( HINI_PROFILE - ,(PSZ)WXSTRINGCAST section - ,(PSZ)WXSTRINGCAST entry - ,(PSZ)defunkt + ,(PSZ)WXSTRINGCAST rSection + ,(PSZ)WXSTRINGCAST rEntry + ,(PSZ)zDefunkt ,(void*)wxBuffer ,1000 ); - if (n == 0L || wxStrcmp(wxBuffer, defunkt) == 0) + if (n == 0L || wxStrcmp(wxBuffer, zDefunkt) == 0) return FALSE; } - if (*value) - delete[] (*value); - *value = copystring(wxBuffer); + if (*ppValue) + delete[] (*ppValue); + *ppValue = copystring(wxBuffer); return TRUE; } -bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) +bool wxGetResource( + const wxString& rSection +, const wxString& rEntry +, float* pValue +, const wxString& rFile +) { - wxChar *s = NULL; - bool succ = wxGetResource(section, entry, (wxChar **)&s, file); - if (succ) - { - *value = (float)wxStrtod(s, NULL); - delete[] s; - return TRUE; - } - else return FALSE; + wxChar* zStr = NULL; + bool bSucc = wxGetResource( rSection + ,rEntry + ,(wxChar **)&zStr + ,rFile + ); + + if (bSucc) + { + *pValue = (float)wxStrtod(zStr, NULL); + delete[] zStr; + return TRUE; + } + else return FALSE; } -bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file) +bool wxGetResource( + const wxString& rSection +, const wxString& rEntry +, long* pValue +, const wxString& rFile +) { - wxChar *s = NULL; - bool succ = wxGetResource(section, entry, (wxChar **)&s, file); - if (succ) - { - *value = wxStrtol(s, NULL, 10); - delete[] s; - return TRUE; - } - else return FALSE; + wxChar* zStr = NULL; + bool bSucc = wxGetResource( rSection + ,rEntry + ,(wxChar **)&zStr + ,rFile + ); + + if (bSucc) + { + *pValue = wxStrtol(zStr, NULL, 10); + delete[] zStr; + return TRUE; + } + else return FALSE; } -bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file) +bool wxGetResource( + const wxString& rSection +, const wxString& rEntry +, int* pValue +, const wxString& rFile +) { - wxChar *s = NULL; - bool succ = wxGetResource(section, entry, (wxChar **)&s, file); - if (succ) - { - *value = (int)wxStrtol(s, NULL, 10); - delete[] s; - return TRUE; - } - else return FALSE; + wxChar* zStr = NULL; + bool bSucc = wxGetResource( rSection + ,rEntry + ,(wxChar **)&zStr + ,rFile + ); + + if (bSucc) + { + *pValue = (int)wxStrtol(zStr, NULL, 10); + delete[] zStr; + return TRUE; + } + else return FALSE; } #endif // wxUSE_RESOURCES @@ -441,11 +496,13 @@ HCURSOR gs_wxBusyCursorOld = 0; // old cursor static int gs_wxBusyCursorCount = 0; // Set the cursor to the busy cursor for all windows -void wxBeginBusyCursor(wxCursor *cursor) +void wxBeginBusyCursor( + wxCursor* pCursor +) { if ( gs_wxBusyCursorCount++ == 0 ) { - gs_wxBusyCursor = (HCURSOR)cursor->GetHCURSOR(); + gs_wxBusyCursor = (HCURSOR)pCursor->GetHCURSOR(); ::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursor); } //else: nothing to do, already set @@ -454,10 +511,11 @@ void wxBeginBusyCursor(wxCursor *cursor) // Restore cursor to normal void wxEndBusyCursor() { - wxCHECK_RET( gs_wxBusyCursorCount > 0, - _T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")); + wxCHECK_RET( gs_wxBusyCursorCount > 0 + ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()") + ); - if ( --gs_wxBusyCursorCount == 0 ) + if (--gs_wxBusyCursorCount == 0) { ::WinSetPointer(HWND_DESKTOP, (HPOINTER)gs_wxBusyCursorOld); gs_wxBusyCursorOld = 0; @@ -467,187 +525,209 @@ void wxEndBusyCursor() // TRUE if we're between the above two calls bool wxIsBusy() { - return (gs_wxBusyCursorCount > 0); + return (gs_wxBusyCursorCount > 0); } // --------------------------------------------------------------------------- -const wxChar* wxGetHomeDir(wxString *pstr) +const wxChar* wxGetHomeDir( + wxString* pStr +) { - wxString& strDir = *pstr; + wxString& rStrDir = *pStr; - // OS/2 has no idea about home, - // so use the working directory instead? + // OS/2 has no idea about home, + // so use the working directory instead? - // 256 was taken from os2def.h + // 256 was taken from os2def.h #ifndef MAX_PATH # define MAX_PATH 256 #endif + char zDirName[256]; + ULONG ulDirLen; - char DirName[256]; - ULONG DirLen; - - ::DosQueryCurrentDir( 0, DirName, &DirLen); - strDir = DirName; - return strDir.c_str(); + ::DosQueryCurrentDir(0, zDirName, &ulDirLen); + rStrDir = zDirName; + return rStrDir.c_str(); } // Hack for OS/2 -wxChar *wxGetUserHome (const wxString& user) -{ - wxChar *home; - wxString user1(user); - - if (user1 != _T("")) { - wxChar tmp[64]; - if (wxGetUserId(tmp, sizeof(tmp)/sizeof(char))) { - // Guests belong in the temp dir - if (wxStricmp(tmp, _T("annonymous")) == 0) { - if ((home = wxGetenv(_T("TMP"))) != NULL || - (home = wxGetenv(_T("TMPDIR"))) != NULL || - (home = wxGetenv(_T("TEMP"))) != NULL) - return *home ? home : (wxChar*)_T("\\"); - } - if (wxStricmp(tmp, WXSTRINGCAST user1) == 0) - user1 = _T(""); - } - } - if (user1 == _T("")) - if ((home = wxGetenv(_T("HOME"))) != NULL) +wxChar* wxGetUserHome ( + const wxString& rUser +) +{ + wxChar* zHome; + wxString sUser1(rUser); + + if (sUser1 != _T("")) { - wxStrcpy(wxBuffer, home); - Unix2DosFilename(wxBuffer); - return wxBuffer; + wxChar zTmp[64]; + + if (wxGetUserId( zTmp + ,sizeof(zTmp)/sizeof(char) + )) + { + // Guests belong in the temp dir + if (wxStricmp(zTmp, _T("annonymous")) == 0) + { + if ((zHome = wxGetenv(_T("TMP"))) != NULL || + (zHome = wxGetenv(_T("TMPDIR"))) != NULL || + (zHome = wxGetenv(_T("TEMP"))) != NULL) + return *zHome ? zHome : (wxChar*)_T("\\"); + } + if (wxStricmp(zTmp, WXSTRINGCAST sUser1) == 0) + sUser1 = _T(""); + } } - return NULL; // No home known! + if (sUser1 == _T("")) + if ((zHome = wxGetenv(_T("HOME"))) != NULL) + { + wxStrcpy(wxBuffer, zHome); + Unix2DosFilename(wxBuffer); + return wxBuffer; + } + return NULL; // No home known! } // Check whether this window wants to process messages, e.g. Stop button // in long calculations. -bool wxCheckForInterrupt(wxWindow *wnd) +bool wxCheckForInterrupt( + wxWindow* pWnd +) { - if(wnd){ - QMSG msg; - HAB hab; - HWND hwndFilter; + if(pWnd) + { + QMSG vMsg; + HAB hab; + HWND hwndFilter; + HWND hwndWin= (HWND) pWnd->GetHWND(); - HWND win= (HWND) wnd->GetHWND(); - while(::WinPeekMsg(hab,&msg,hwndFilter,0,0,PM_REMOVE)) + while(::WinPeekMsg(hab, &vMsg, hwndFilter, 0, 0, PM_REMOVE)) + { + ::WinDispatchMsg(hab, &vMsg); + } + return TRUE;//*** temporary? + } + else { - ::WinDispatchMsg( hab, &msg ); + wxFAIL_MSG(_T("pWnd==NULL !!!")); + return FALSE;//*** temporary? } - return TRUE;//*** temporary? - } - else{ - wxFAIL_MSG(_T("wnd==NULL !!!")); - - return FALSE;//*** temporary? - } } -void wxGetMousePosition( int* x, int* y ) +void wxGetMousePosition( + int* pX +, int* pY +) { - POINTL pt; - ::WinQueryPointerPos( HWND_DESKTOP, & pt ); - *x = pt.x; - *y = pt.y; + POINTL vPt; + + ::WinQueryPointerPos(HWND_DESKTOP, &vPt); + *pX = vPt.x; + *pY = vPt.y; }; // Return TRUE if we have a colour display bool wxColourDisplay() { - bool flag; - // TODO: use DosQueryDevCaps to figure it out - return flag; + HPS hpsScreen; + HDC hdcScreen; + LONG lColors; + + hpsScreen = ::WinGetScreenPS(HWND_DESKTOP); + hdcScreen = ::GpiQueryDevice(hpsScreen); + ::DevQueryCaps(hdcScreen, CAPS_COLORS, 1L, &lColors); + return(lColors > 1L); } // Returns depth of screen int wxDisplayDepth() { - HDC hDc = ::WinOpenWindowDC((HWND)NULL); - long lArray[CAPS_COLOR_BITCOUNT]; - int nPlanes; - int nBitsPerPixel; - int nDepth; - - if(DevQueryCaps( hDc - ,CAPS_FAMILY - ,CAPS_COLOR_BITCOUNT - ,lArray - )) - { - nPlanes = (int)lArray[CAPS_COLOR_PLANES]; - nBitsPerPixel = (int)lArray[CAPS_COLOR_BITCOUNT]; - nDepth = nPlanes * nBitsPerPixel; - } - DevCloseDC(hDc); + HPS hpsScreen; + HDC hdcScreen; + LONG lPlanes; + LONG lBitsPerPixel; + LONG nDepth; + + hpsScreen = ::WinGetScreenPS(HWND_DESKTOP); + hdcScreen = ::GpiQueryDevice(hpsScreen); + ::DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes); + ::DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel); + + nDepth = (int)(lPlanes * lBitsPerPixel); + DevCloseDC(hdcScreen); return (nDepth); } // Get size of display -void wxDisplaySize(int *width, int *height) +void wxDisplaySize( + int* pWidth +, int* pHeight +) { - HDC hDc = ::WinOpenWindowDC((HWND)NULL); - long lArray[CAPS_HEIGHT]; + HPS hpsScreen; + HDC hdcScreen; - if(DevQueryCaps( hDc - ,CAPS_FAMILY - ,CAPS_HEIGHT - ,lArray - )) - { - *width = (int)lArray[CAPS_WIDTH]; - *height = (int)lArray[CAPS_HEIGHT]; - } - DevCloseDC(hDc); + hpsScreen = ::WinGetScreenPS(HWND_DESKTOP); + hdcScreen = ::GpiQueryDevice(hpsScreen); + ::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, (PLONG)pWidth); + ::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, (PLONG)pHeight); + DevCloseDC(hdcScreen); } -bool wxDirExists(const wxString& dir) +bool wxDirExists( + const wxString& rDir +) { - // TODO: Control program file stuff - return TRUE; + return (::DosSetCurrentDir(WXSTRINGCAST rDir)); } // --------------------------------------------------------------------------- // window information functions // --------------------------------------------------------------------------- -wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd) +wxString WXDLLEXPORT wxGetWindowText( + WXHWND hWnd +) { - wxString str; - long len = ::WinQueryWindowTextLength((HWND)hWnd) + 1; - ::WinQueryWindowText((HWND)hWnd, len, str.GetWriteBuf((int)len)); - str.UngetWriteBuf(); + wxString vStr; + long lLen = ::WinQueryWindowTextLength((HWND)hWnd) + 1; + + ::WinQueryWindowText((HWND)hWnd, lLen, vStr.GetWriteBuf((int)lLen)); + vStr.UngetWriteBuf(); - return str; + return vStr; } -wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd) +wxString WXDLLEXPORT wxGetWindowClass( + WXHWND hWnd +) { - wxString str; - - int len = 256; // some starting value + wxString vStr; + int nLen = 256; // some starting value for ( ;; ) { - int count = ::WinQueryClassName((HWND)hWnd, len, str.GetWriteBuf(len)); + int nCount = ::WinQueryClassName((HWND)hWnd, nLen, vStr.GetWriteBuf(nLen)); - str.UngetWriteBuf(); - if ( count == len ) + vStr.UngetWriteBuf(); + if (nCount == nLen ) { // the class name might have been truncated, retry with larger // buffer - len *= 2; + nLen *= 2; } else { break; } } - return str; + return vStr; } -WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd) +WXWORD WXDLLEXPORT wxGetWindowId( + WXHWND hWnd +) { return ::WinQueryWindowUShort((HWND)hWnd, QWS_ID); } -- 2.45.2