- va_list ap;
- static wxChar buffer[512];
-
- if (!wxTheApp->GetWantDebugOutput())
- return;
-
- va_start(ap, fmt);
-
- wvsprintf(buffer,fmt,ap);
- OutputDebugString((LPCTSTR)buffer);
-
- va_end(ap);
-}
-
-// Non-fatal error: pop up message box and (possibly) continue
-void wxError(const wxString& msg, const wxString& title)
-{
- wxSprintf(wxBuffer, wxT("%s\nContinue?"), WXSTRINGCAST msg);
- if (MessageBox(NULL, (LPCTSTR)wxBuffer, (LPCTSTR)WXSTRINGCAST title,
- MB_ICONSTOP | MB_YESNO) == IDNO)
- wxExit();
-}
-
-// Fatal error: pop up message box and abort
-void wxFatalError(const wxString& msg, const wxString& title)
-{
- wxSprintf(wxBuffer, wxT("%s: %s"), WXSTRINGCAST title, WXSTRINGCAST msg);
- FatalAppExit(0, (LPCTSTR)wxBuffer);
-}
-#endif // __WXMICROWIN__
-
-#endif // WXWIN_COMPATIBILITY_2_2
-
-#if wxUSE_GUI
-
-// ----------------------------------------------------------------------------
-// functions to work with .INI files
-// ----------------------------------------------------------------------------
-
-// Reading and writing resources (eg WIN.INI, .Xdefaults)
-#if wxUSE_RESOURCES
-bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file)
-{
- if (file != wxT(""))
-// Don't know what the correct cast should be, but it doesn't
-// compile in BC++/16-bit without this cast.
-#if !defined(__WIN32__)
- return (WritePrivateProfileString((const char*) section, (const char*) entry, (const char*) value, (const char*) file) != 0);
-#else
- return (WritePrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)value, (LPCTSTR)WXSTRINGCAST file) != 0);
-#endif
- else
- return (WriteProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)WXSTRINGCAST value) != 0);
-}
-
-bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
-{
- wxString buf;
- buf.Printf(wxT("%.4f"), value);
-
- return wxWriteResource(section, entry, buf, file);
-}
-
-bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
-{
- wxString buf;
- buf.Printf(wxT("%ld"), value);
-
- return wxWriteResource(section, entry, buf, file);
-}
-
-bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
-{
- wxString buf;
- buf.Printf(wxT("%d"), value);
-
- return wxWriteResource(section, entry, buf, file);
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file)
-{
- static const wxChar defunkt[] = wxT("$$default");
- if (file != wxT(""))
- {
- int n = GetPrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
- (LPTSTR)wxBuffer, 1000, (LPCTSTR)WXSTRINGCAST file);
- if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
- return FALSE;
- }
- else
- {
- int n = GetProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt,
- (LPTSTR)wxBuffer, 1000);
- if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0)
- return FALSE;
- }
- if (*value) delete[] (*value);
- *value = copystring(wxBuffer);
- return TRUE;
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file)
-{
- 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;
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file)
-{
- 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;
-}
-
-bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file)
-{
- 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;
-}
-#endif // wxUSE_RESOURCES
-
-// ---------------------------------------------------------------------------
-// helper functions for showing a "busy" cursor
-// ---------------------------------------------------------------------------
-
-static HCURSOR gs_wxBusyCursor = 0; // new, busy cursor
-static HCURSOR gs_wxBusyCursorOld = 0; // old cursor
-static int gs_wxBusyCursorCount = 0;
-
-extern HCURSOR wxGetCurrentBusyCursor()
-{
- return gs_wxBusyCursor;
-}
-
-// Set the cursor to the busy cursor for all windows
-void wxBeginBusyCursor(wxCursor *cursor)
-{
- if ( gs_wxBusyCursorCount++ == 0 )