From 73974df1f951f176f592fd900352c41281eb5df2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 4 Oct 1999 22:55:10 +0000 Subject: [PATCH] MSW compilation (and other) fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3829 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/event.h | 1 + include/wx/msw/setup0.h | 18 ++++++++++++------ include/wx/msw/timer.h | 8 ++++---- include/wx/wxchar.h | 3 +++ src/common/docview.cpp | 8 ++++---- src/msw/dde.cpp | 2 +- src/msw/dib.cpp | 16 ++++++++-------- src/msw/metafile.cpp | 2 +- src/msw/pnghand.cpp | 14 +++++--------- src/msw/textctrl.cpp | 4 ++-- src/msw/timer.cpp | 27 +++++++++++++++------------ src/msw/treectrl.cpp | 2 +- src/msw/xpmhand.cpp | 4 ++-- 13 files changed, 59 insertions(+), 50 deletions(-) diff --git a/include/wx/event.h b/include/wx/event.h index c1c6517..77dc0db 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -37,6 +37,7 @@ class WXDLLEXPORT wxList; class WXDLLEXPORT wxClientData; class WXDLLEXPORT wxDC; class WXDLLEXPORT wxMenu; + class WXDLLEXPORT wxWindow; #endif // wxUSE_GUI // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 978a35b..4acb6ca8 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -12,13 +12,12 @@ #ifndef _WX_SETUP_H_ #define _WX_SETUP_H_ -/* - * General features - * - */ +// ---------------------------------------------------------------------------- +// global settings +// ---------------------------------------------------------------------------- -#define wxUSE_CONFIG 1 - // Use wxConfig, with CreateConfig in wxApp +// define this to 0 when building wxBase library +#define wxUSE_GUI 1 #define WXWIN_COMPATIBILITY 0 // Compatibility with 1.68 API. @@ -27,6 +26,13 @@ // the compatibility code is now very minimal so there // is little advantage to setting it to 1. +// ---------------------------------------------------------------------------- +// General features +// ---------------------------------------------------------------------------- + +#define wxUSE_CONFIG 1 + // Use wxConfig, with CreateConfig in wxApp + #define wxUSE_POSTSCRIPT 0 // 0 for no PostScript device context #define wxUSE_AFM_FOR_POSTSCRIPT 0 diff --git a/include/wx/msw/timer.h b/include/wx/msw/timer.h index 1320d5e..36fc33a 100644 --- a/include/wx/msw/timer.h +++ b/include/wx/msw/timer.h @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_TIMER_H_ @@ -37,9 +37,9 @@ public: bool OneShot() const { return oneShot; } protected: - bool oneShot ; - int milli ; - int lastMilli ; + bool oneShot; + int milli; + int lastMilli; long id; diff --git a/include/wx/wxchar.h b/include/wx/wxchar.h index 83273ef..17afab7 100644 --- a/include/wx/wxchar.h +++ b/include/wx/wxchar.h @@ -47,6 +47,9 @@ # define HAVE_WCSLEN 1 # include + +# define T(x) _T(x) + # if wxUSE_UNICODE // temporary - preserve binary compatibility typedef _TCHAR wxChar; typedef _TSCHAR wxSChar; diff --git a/src/common/docview.cpp b/src/common/docview.cpp index ef12c9a..56bbc40 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1279,7 +1279,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, int noTemplates) { - const wxChar **strings = new wxChar *[noTemplates]; + wxChar **strings = new wxChar *[noTemplates]; wxChar **data = new wxChar *[noTemplates]; int i; int n = 0; @@ -1287,7 +1287,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, { if (templates[i]->IsVisible()) { - strings[n] = templates[i]->m_description; + strings[n] = (wxChar *)templates[i]->m_description.c_str(); data[n] = (wxChar *)templates[i]; n ++; } @@ -1316,7 +1316,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, int noTemplates) { - const wxChar **strings = new wxChar *[noTemplates]; + wxChar **strings = new wxChar *[noTemplates]; wxChar **data = new wxChar *[noTemplates]; int i; int n = 0; @@ -1324,7 +1324,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, { if (templates[i]->IsVisible() && (templates[i]->GetViewName() != T(""))) { - strings[n] = templates[i]->m_viewTypeName; + strings[n] = (wxChar *)templates[i]->m_viewTypeName.c_str(); data[n] = (wxChar *)templates[i]; n ++; } diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index 0390230..80c49e0 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -441,7 +441,7 @@ bool wxDDEConnection::Disconnect(void) return (DdeDisconnect((HCONV) m_hConv) != 0); } -bool wxDDEConnection::Execute(wxChar *data, int size, wxIPCFormat format) +bool wxDDEConnection::Execute(const wxChar *data, int size, wxIPCFormat format) { DWORD result; if (size < 0) diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index a2d7f69..e42603f 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -83,14 +83,14 @@ #define PALVERSION 0x300 #define MAXPALETTE 256 /* max. # supported palette entries */ -DWORD PASCAL lread(int fh, VOID FAR *pv, DWORD ul); -DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul); - -BOOL WriteDIB (LPTSTR szFile,HANDLE hdib); -WORD PaletteSize (VOID FAR * pv); -WORD DibNumColors (VOID FAR * pv); -// HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal); -BOOL PASCAL MakeBitmapAndPalette(HDC,HANDLE,HPALETTE *,HBITMAP *); +static DWORD PASCAL lread(int fh, VOID FAR *pv, DWORD ul); +static DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul); + +static BOOL WriteDIB (LPTSTR szFile,HANDLE hdib); +static WORD PaletteSize (VOID FAR * pv); +static WORD DibNumColors (VOID FAR * pv); +// HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal); +static BOOL PASCAL MakeBitmapAndPalette(HDC,HANDLE,HPALETTE *,HBITMAP *); /**************************************************************************** * * diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index 2f570b8..72bf474 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -340,7 +340,7 @@ bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, i p < (WORD *)&pMFHead ->checksum; ++p) pMFHead ->checksum ^= *p; - FILE *fd = fopen(filename.mb_str(wxConvFile), "rb"); + FILE *fd = fopen(filename.fn_str(), "rb"); if (!fd) return FALSE; wxChar tempFileBuf[256]; diff --git a/src/msw/pnghand.cpp b/src/msw/pnghand.cpp index 7b83b89..9e1d349 100644 --- a/src/msw/pnghand.cpp +++ b/src/msw/pnghand.cpp @@ -386,35 +386,30 @@ wxMask *wxPNGReader::CreateMask() bool wxPNGReader::ReadFile(wxChar * ImageFileName) { - int number_passes; - if (ImageFileName) wxStrcpy(filename, ImageFileName); - FILE *fp; - png_struct *png_ptr; - png_info *info_ptr; - /* open the file */ - fp = fopen(wxConvFile.cWX2MB(filename), "rb"); + FILE *fp = fopen(wxConvFile.cWX2MB(filename), "rb"); if (!fp) return FALSE; /* allocate the necessary structures */ - png_ptr = new (png_struct); + png_struct *png_ptr = new (png_struct); if (!png_ptr) { fclose(fp); return FALSE; } - info_ptr = new (png_info); + png_info *info_ptr = new (png_info); if (!info_ptr) { fclose(fp); delete(png_ptr); return FALSE; } + /* set error handling */ if (setjmp(png_ptr->jmpbuf)) { @@ -478,6 +473,7 @@ bool wxPNGReader::ReadFile(wxChar * ImageFileName) byte *row_pointers = new byte[row_stride]; /* turn on interlace handling */ + int number_passes; if (info_ptr->interlace_type) number_passes = png_set_interlace_handling(png_ptr); else diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 79cab1c..dea366f 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -167,14 +167,14 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, m_lDlgCode |= DLGC_WANTTAB; // do create the control - either an EDIT or RICHEDIT - const wxChar *windowClass = T("EDIT("); + const wxChar *windowClass = T("EDIT"); #if wxUSE_RICHEDIT if ( m_windowStyle & wxTE_RICH ) { msStyle |= ES_AUTOVSCROLL; m_isRich = TRUE; - windowClass = T("RICHEDIT("); + windowClass = T("RICHEDIT"); } else m_isRich = FALSE; diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index d8cc8bd..79419ea 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -54,7 +54,7 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); // ---------------------------------------------------------------------------- #ifdef __WIN32__ - #define _EXPORT /**/ + #define _EXPORT #else #define _EXPORT _export #endif @@ -70,14 +70,15 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); // ---------------------------------------------------------------------------- // wxTimer class // ---------------------------------------------------------------------------- -wxTimer::wxTimer(void) + +wxTimer::wxTimer() { - milli = 0 ; - lastMilli = -1 ; + milli = 0; + lastMilli = -1; id = 0; } -wxTimer::~wxTimer(void) +wxTimer::~wxTimer() { Stop(); @@ -86,7 +87,7 @@ wxTimer::~wxTimer(void) bool wxTimer::Start(int milliseconds, bool mode) { - oneShot = mode ; + oneShot = mode; if (milliseconds < 0) milliseconds = lastMilli; @@ -114,19 +115,21 @@ bool wxTimer::Start(int milliseconds, bool mode) } } -void wxTimer::Stop(void) +void wxTimer::Stop() { - if (id) { + if ( id ) + { KillTimer(NULL, (UINT)id); - wxTimerList.DeleteObject(this); /* @@@@ */ + wxTimerList.DeleteObject(this); } - id = 0 ; - milli = 0 ; + id = 0; + milli = 0; } // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- + void wxProcessTimer(wxTimer& timer) { // Avoid to process spurious timer events diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index e51192d..530535f 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -463,7 +463,7 @@ size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, { TraverseCounter counter(this, item, recursively); - return counter.GetCount(); + return counter.GetCount() - 1; } // ---------------------------------------------------------------------------- diff --git a/src/msw/xpmhand.cpp b/src/msw/xpmhand.cpp index a90fa6e..89e5cf8 100644 --- a/src/msw/xpmhand.cpp +++ b/src/msw/xpmhand.cpp @@ -60,7 +60,7 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla if (dc) { xpmAttr.valuemask = XpmReturnPixels; - int errorStatus = XpmReadFileToImage(&dc, wxMBSTRINGCAST name.mb_str(wxConvFile), &ximage, (XImage **) NULL, &xpmAttr); + int errorStatus = XpmReadFileToImage(&dc, wxMBSTRINGCAST name.fn_str(), &ximage, (XImage **) NULL, &xpmAttr); DeleteDC(dc); if (errorStatus == XpmSuccess) { @@ -108,7 +108,7 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type ximage.height = M_BITMAPHANDLERDATA->m_height; ximage.depth = M_BITMAPHANDLERDATA->m_depth; ximage.bitmap = (HBITMAP)M_BITMAPHANDLERDATA->m_hBitmap; - int errorStatus = XpmWriteFileFromImage(&dc, wxMBSTRINGCAST name.mb_str(wxConvFile), + int errorStatus = XpmWriteFileFromImage(&dc, wxMBSTRINGCAST name.fn_str(), &ximage, (XImage *) NULL, (XpmAttributes *) NULL); if (dc) -- 2.7.4