From c455ab932f89cc166fc38d3f2c2f942f6a130649 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 8 Jun 1999 20:56:50 +0000 Subject: [PATCH] Chianti, Pinot noir, WINE.. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2717 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- acconfig.h | 2 ++ include/wx/msw/private.h | 14 ++++++++ include/wx/msw/winundef.h | 5 +++ src/common/cmndata.cpp | 14 +++++++- src/common/filefn.cpp | 2 +- src/msw/Makefile.am | 76 +++++++++++++++++++++++++++++++++++++++ src/msw/app.cpp | 4 +++ src/msw/dcclient.cpp | 6 ++-- src/msw/dcprint.cpp | 2 +- src/msw/dib.cpp | 10 ++++-- src/msw/dibutils.cpp | 16 +++++++-- src/msw/window.cpp | 8 +++-- 12 files changed, 147 insertions(+), 12 deletions(-) diff --git a/acconfig.h b/acconfig.h index dab5753735..6615dd3cc8 100644 --- a/acconfig.h +++ b/acconfig.h @@ -15,8 +15,10 @@ /* wxWindows version (not used but required by autoheader) */ /* ------------------------------------------------------------------------ */ +#if 0 #undef PACKAGE #undef VERSION +#endif /* needed for older automake? */ #undef WITH_SYMBOL_UNDERSCORE diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index 2171b17c59..ff8642533c 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -50,10 +50,24 @@ WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDIPARENTFRAME_ICON; WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDICHILDFRAME_ICON; WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT; +// --------------------------------------------------------------------------- +// WINE implements the Win32 API +// --------------------------------------------------------------------------- + +#ifdef __WXWINE__ + #ifndef __WIN32__ + #define __WIN32__ + #endif + #ifndef STRICT + #define STRICT + #endif +#endif + // --------------------------------------------------------------------------- // this defines a CASTWNDPROC macro which casts a pointer to the type of a // window proc // --------------------------------------------------------------------------- + #if defined(__GNUWIN32__) && !defined(__MINGW32__) # define CASTWNDPROC (long unsigned) #else diff --git a/include/wx/msw/winundef.h b/include/wx/msw/winundef.h index 25bcb7d67e..4a56ddeb49 100644 --- a/include/wx/msw/winundef.h +++ b/include/wx/msw/winundef.h @@ -161,6 +161,11 @@ } #endif +// For WINE + +#if defined(GetWindowStyle) || defined(__WXWINE__) + #undef GetWindowStyle +#endif // For ming and cygwin diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index f88c5157fd..4b9261c7db 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -61,6 +61,11 @@ #include #endif // Win16 + #ifdef __WXWINE__ + #include + #include + #endif + #if defined(__WATCOMC__) || defined(__SC__) || defined(__SALFORDC__) #include #include @@ -319,7 +324,9 @@ void wxPrintData::ConvertToNative() //// Orientation +#ifndef __WXWINE__ devMode->dmOrientation = m_printOrientation; +#endif devMode->dmFields = DM_ORIENTATION; //// Collation @@ -353,6 +360,7 @@ void wxPrintData::ConvertToNative() devMode->dmFields |= DM_COLOR; +#ifndef __WXWINE__ //// Paper size if (m_paperId == wxPAPER_NONE) @@ -374,6 +382,7 @@ void wxPrintData::ConvertToNative() } } } +#endif //// Duplex @@ -433,10 +442,12 @@ void wxPrintData::ConvertFromNative() { DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode); +#ifndef __WXWINE__ //// Orientation if (devMode->dmFields & DM_ORIENTATION) m_printOrientation = devMode->dmOrientation; +#endif //// Collation @@ -484,6 +495,7 @@ void wxPrintData::ConvertFromNative() else m_colour = TRUE; +#ifndef __WXWINE__ //// Paper size if (devMode->dmFields & DM_PAPERSIZE) @@ -532,7 +544,7 @@ void wxPrintData::ConvertFromNative() m_paperSize.y = 0; m_paperId = wxPAPER_NONE; } - +#endif //// Duplex diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 51d2877c20..33b30d5832 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -994,7 +994,7 @@ bool wxMkdir(const wxString& dir, int perm) // assume mkdir() has 2 args on non Windows platforms and on Windows too // for the GNU compiler -#if !defined(__WXMSW__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) +#if !defined(__WXMSW__) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__) if ( mkdir(wxFNCONV(dirname), perm) != 0 ) #else // MSW if ( mkdir(wxFNCONV(dirname)) != 0 ) diff --git a/src/msw/Makefile.am b/src/msw/Makefile.am index fc8220380f..e072cbabb4 100644 --- a/src/msw/Makefile.am +++ b/src/msw/Makefile.am @@ -22,10 +22,86 @@ libwx_msw_la_SOURCES = \ extended.c \ parser.c \ \ + cmndata.cpp \ + dynarray.cpp \ + filefn.cpp \ + hash.cpp \ list.cpp \ + matrix.cpp \ + memory.cpp \ + module.cpp \ object.cpp \ + string.cpp \ + timercmn.cpp \ + utilscmn.cpp \ + tokenzr.cpp \ + variant.cpp \ + wxchar.cpp \ \ wincmn.cpp \ +\ + accel.cpp \ + app.cpp \ + bitmap.cpp \ + bmpbuttn.cpp \ + brush.cpp \ + button.cpp \ + caret.cpp \ + checkbox.cpp \ + checklst.cpp \ + choice.cpp \ + clipbrd.cpp \ + colour.cpp \ + combobox.cpp \ + control.cpp \ + cursor.cpp \ + data.cpp \ + dc.cpp \ + dcclient.cpp \ + dcmemory.cpp \ + dcscreen.cpp \ + dcprint.cpp \ + dialog.cpp \ + dirdlg \ + filedlg.cpp \ + font.cpp \ + frame.cpp \ + gaugemsw.cpp \ + gdiobj.cpp \ + icon.cpp \ + imaglist.cpp \ + listbox.cpp \ + listctrlc.cpp \ + main.cpp \ + mdi.cpp \ + menu.cpp \ + menuitem.cpp \ + minifram.cpp \ + notebook.cpp \ + ownerdrw.cpp \ + palette.cpp \ + pen.cpp \ + radiobox.cpp \ + radiobut.cpp \ + regconf.cpp \ + region.cpp \ + registry.cpp \ + scrolbar.cpp \ + settings.cpp \ + slidermsw.cpp \ + spinbutt.cpp \ + statbmp.cpp \ + statbox.cpp \ + stattext.cpp \ + tbarmsw.cpp \ + textctrl.cpp \ + thread.cpp \ + timer.cpp \ + tooltip.cpp \ + treectrl.cpp \ + utils.cpp \ + utilsexc.cpp \ + wave.cpp \ window.cpp # these are the sources which we build by our own rules diff --git a/src/msw/app.cpp b/src/msw/app.cpp index dc629191c1..6305cb017f 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -1117,7 +1117,11 @@ bool wxYield() MSG msg; // We want to go back to the main message loop // if we see a WM_QUIT. (?) +#ifdef __WXWINE__ + while (PeekMessage(&msg, (HWND)NULL, 0, 0, PM_NOREMOVE) && msg.message != WM_QUIT) +#else while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) && msg.message != WM_QUIT) +#endif { if ( !wxTheApp->DoMessage() ) break; diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index 763e70bb57..e29e8b472f 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -143,8 +143,10 @@ wxPaintDC::wxPaintDC() wxPaintDC::wxPaintDC(wxWindow *canvas) { wxCHECK_RET( canvas, "NULL canvas in wxPaintDC ctor" ); - wxCHECK_RET( g_isPainting, - _T("wxPaintDC may be created only in EVT_PAINT handler!") ); + +#ifdef __WXDEBUG__ + wxCHECK_RET( g_isPainting, _T("wxPaintDC may be created only in EVT_PAINT handler!") ); +#endif m_canvas = canvas; diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index 55eac864f7..0f402ccffb 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -30,7 +30,7 @@ #include "wx/dcprint.h" #include "math.h" -#if wxUSE_COMMON_DIALOGS +#if wxUSE_COMMON_DIALOGS || defined(__WXWINE__) #include #endif diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 871197195c..73c68707c8 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -357,7 +357,7 @@ HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal) DWORD PASCAL lread(int fh, void far *pv, DWORD ul) { DWORD ulT = ul; -#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) +#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__) BYTE *hp = (BYTE *) pv; #else BYTE huge *hp = (BYTE huge *) pv; @@ -387,7 +387,7 @@ DWORD PASCAL lread(int fh, void far *pv, DWORD ul) DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul) { DWORD ulT = ul; -#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) +#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__) BYTE *hp = (BYTE *) pv; #else BYTE huge *hp = (BYTE huge *) pv; @@ -642,6 +642,9 @@ BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, ****************************************************************************/ HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) { +#ifdef __WXWINE__ + return (FALSE); +#else NPLOGPALETTE npPal; RGBQUAD far *lpRGB; HPALETTE hLogPal; @@ -658,7 +661,6 @@ HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) */ npPal = (NPLOGPALETTE)malloc(sizeof(LOGPALETTE) + (WORD)lpInfo->biClrUsed * sizeof(PALETTEENTRY)); - if (!npPal) return(FALSE); @@ -690,6 +692,8 @@ HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) */ else return((HPALETTE) GetStockObject(DEFAULT_PALETTE)); +#endif + } bool wxLoadIntoBitmap(char *filename, wxBitmap *bitmap, wxPalette **pal) diff --git a/src/msw/dibutils.cpp b/src/msw/dibutils.cpp index 10a61b9249..3acbd1fbea 100644 --- a/src/msw/dibutils.cpp +++ b/src/msw/dibutils.cpp @@ -32,6 +32,10 @@ #include "wx/msw/dibutils.h" +#ifdef __WXWINE__ + #include +#endif + #if defined(__WIN32__) #if !defined(__MWERKS__) && !defined(__SALFORDC__) #include // for _fmemcpy() @@ -78,7 +82,7 @@ void ClearSystemPalette(void) BOOL bOK = FALSE; int nOK = 0; - //*** Reset everything in the system palette to black + // *** Reset everything in the system palette to black for(Counter = 0; Counter < 256; Counter++) { Palette.aEntries[Counter].peRed = 0; @@ -87,8 +91,12 @@ void ClearSystemPalette(void) Palette.aEntries[Counter].peFlags = PC_NOCOLLAPSE; } - //*** Create, select, realize, deselect, and delete the palette + // *** Create, select, realize, deselect, and delete the palette +#ifdef __WXWINE__ + ScreenDC = GetDC((HWND)NULL); +#else ScreenDC = GetDC(NULL); +#endif ScreenPalette = CreatePalette((LOGPALETTE *)&Palette); if (ScreenPalette) @@ -99,7 +107,11 @@ void ClearSystemPalette(void) bOK = DeleteObject(ScreenPalette); } +#ifdef __WXWINE__ + nOK = ReleaseDC((HWND)NULL, ScreenDC); +#else nOK = ReleaseDC(NULL, ScreenDC); +#endif return; } diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 7d1f201647..8da3bb78c9 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -903,7 +903,7 @@ WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D) return exStyle; } -#if WXWIN_COMPATIBILITY_2 +#if WXWIN_COMPATIBILITY // If nothing defined for this, try the parent. // E.g. we may be a button loaded from a resource, with no callback function // defined. @@ -1309,7 +1309,7 @@ void wxWindow::GetTextExtent(const wxString& string, if ( externalLeading ) *externalLeading = tm.tmExternalLeading; } -#if wxUSE_CARET +#if wxUSE_CARET && WXWIN_COMPATIBILITY // --------------------------------------------------------------------------- // Caret manipulation // --------------------------------------------------------------------------- @@ -2087,7 +2087,11 @@ bool wxWindow::MSWCreate(int id, if ( width > -1 ) width1 = width; if ( height > -1 ) height1 = height; +#ifdef __WXWINE__ + HWND hParent = (HWND)NULL; +#else HWND hParent = NULL; +#endif if ( parent ) hParent = (HWND) parent->GetHWND(); -- 2.45.2