Remove redundant tests for __WIN32__ in wxMSW code.

This is always defined, Win16 is not supported since ages and Win64 defines
both __WIN32__ and __WIN64__.
This commit is contained in:
Vadim Zeitlin
2015-06-30 18:55:30 +02:00
parent d421373c2e
commit 30b523d1f2
24 changed files with 17 additions and 164 deletions

View File

@@ -20,7 +20,6 @@
// ----- taken from RPC.H
#ifndef UUID_DEFINED // in some cases RPC.H will be already
#ifdef __WIN32__ // included, so avoid redefinition
typedef struct
{
unsigned long Data1;
@@ -28,7 +27,6 @@
unsigned short Data3;
unsigned char Data4[8];
} UUID; // UUID = GUID = CLSID = LIBID = IID
#endif // WIN32
#endif // UUID_DEFINED
#ifndef GUID_DEFINED

View File

@@ -99,20 +99,8 @@ WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#define APIENTRY FAR PASCAL
#endif
#ifdef __WIN32__
#ifndef _EXPORT
#define _EXPORT
#else
#define _EXPORT _export
#endif
#ifndef __WIN32__
typedef signed short int SHORT;
#endif
#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
#ifndef STRICT
#define DLGPROC FARPROC
#endif
#endif
/*
@@ -160,7 +148,7 @@ extern LONG APIENTRY _EXPORT
// ---------------------------------------------------------------------------
// a wrapper macro for ZeroMemory()
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
#if !defined(__WXMICROWIN__)
#define wxZeroMemory(obj) ::ZeroMemory(&obj, sizeof(obj))
#else
#define wxZeroMemory(obj) memset((void*) & obj, 0, sizeof(obj))

View File

@@ -74,9 +74,7 @@ public:
virtual void MarkDirty();
virtual void DiscardEdits();
#ifdef __WIN32__
virtual bool EmulateKeyPress(const wxKeyEvent& event);
#endif // __WIN32__
#if wxUSE_RICHEDIT
// apply text attribute to the range of text (only works with richedit

View File

@@ -355,9 +355,7 @@ public:
#if wxUSE_HOTKEY
bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam);
#endif
#ifdef __WIN32__
int HandleMenuChar(int chAccel, WXLPARAM lParam);
#endif
// Create and process a clipboard event specified by type.
bool HandleClipboardEvent( WXUINT nMsg );

View File

@@ -1334,11 +1334,7 @@ void wxMSWDCImpl::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
}
else
{
#ifdef __WIN32__
::DrawIconEx(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon), icon.GetWidth(), icon.GetHeight(), 0, NULL, DI_NORMAL);
#else
::DrawIcon(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), GetHiconOf(icon));
#endif
}
CalcBoundingBox(x, y);
@@ -1390,7 +1386,6 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool
}
if ( useMask )
{
#ifdef __WIN32__
// use MaskBlt() with ROP which doesn't do anything to dst in the mask
// points
bool ok = false;
@@ -1435,7 +1430,6 @@ void wxMSWDCImpl::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool
}
if ( !ok )
#endif // Win32
{
// Rather than reproduce wxMSWDCImpl::Blit, let's do it at the wxWin API
// level
@@ -2326,7 +2320,6 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
if (useMask)
{
#ifdef __WIN32__
// we want the part of the image corresponding to the mask to be
// transparent, so use "DSTCOPY" ROP for the mask points (the usual
// meaning of fg and bg is inverted which corresponds to wxWin notion
@@ -2356,7 +2349,6 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
}
if ( !success )
#endif // Win32
{
// Blit bitmap with mask
HDC dc_mask ;

View File

@@ -46,10 +46,6 @@
#include "wx/printdlg.h"
#include "wx/msw/printdlg.h"
#ifndef __WIN32__
#include <print.h>
#endif
// mingw32 defines GDI_ERROR incorrectly
#if defined(__GNUWIN32__) || !defined(GDI_ERROR)
#undef GDI_ERROR

View File

@@ -46,12 +46,6 @@
// macros and constants
// ----------------------------------------------------------------------------
#ifdef __WIN32__
#define _EXPORT
#else
#define _EXPORT _export
#endif
#if wxUSE_UNICODE
#define DDE_CP CP_WINUNICODE
#else

View File

@@ -256,7 +256,6 @@ bool wxDirData::Read(wxString *filename)
if ( !IsFindDataOk(m_finddata) )
{
#ifdef __WIN32__
DWORD err = ::GetLastError();
if ( err != ERROR_FILE_NOT_FOUND && err != ERROR_NO_MORE_FILES )
@@ -264,7 +263,6 @@ bool wxDirData::Read(wxString *filename)
wxLogSysError(err, _("Cannot enumerate files in directory '%s'"),
m_dirname.c_str());
}
#endif // __WIN32__
//else: not an error, just no (such) files
return false;
@@ -283,14 +281,12 @@ bool wxDirData::Read(wxString *filename)
{
if ( !FindNext(m_finddata, m_filespec, PTR_TO_FINDDATA) )
{
#ifdef __WIN32__
DWORD err = ::GetLastError();
if ( err != ERROR_NO_MORE_FILES )
{
wxLogLastError(wxT("FindNext"));
}
#endif // __WIN32__
//else: not an error, just no more (such) files
return false;
@@ -436,8 +432,6 @@ bool wxDir::GetNext(wxString *filename) const
// wxGetDirectoryTimes: used by wxFileName::GetTimes()
// ----------------------------------------------------------------------------
#ifdef __WIN32__
extern bool
wxGetDirectoryTimes(const wxString& dirname,
FILETIME *ftAccess, FILETIME *ftCreate, FILETIME *ftMod)
@@ -467,6 +461,3 @@ wxGetDirectoryTimes(const wxString& dirname,
return true;
}
#endif // __WIN32__

View File

@@ -460,12 +460,8 @@ bool wxDragImage::Move(const wxPoint& pt)
rect.left = 0; rect.top = 0;
rect.right = 0; rect.bottom = 0;
DWORD style = ::GetWindowLong((HWND) m_window->GetHWND(), GWL_STYLE);
#ifdef __WIN32__
DWORD exStyle = ::GetWindowLong((HWND) m_window->GetHWND(), GWL_EXSTYLE);
::AdjustWindowRectEx(& rect, style, FALSE, exStyle);
#else
::AdjustWindowRect(& rect, style, FALSE);
#endif
// Subtract the (negative) values, i.e. add a small increment
pt2.x -= rect.left; pt2.y -= rect.top;
}

View File

@@ -52,11 +52,7 @@
// constants
// ----------------------------------------------------------------------------
#ifdef __WIN32__
# define wxMAXPATH 65534
#else
# define wxMAXPATH 1024
#endif
# define wxMAXFILE 1024

View File

@@ -156,14 +156,14 @@ void wxFontEnumeratorHelper::DoEnumerate()
m_facename.empty() ? NULL : wxMSW_CONV_LPCTSTR(m_facename),
(FONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this) ;
#else // __WIN32__
#else // !__WXWINCE__
LOGFONT lf;
lf.lfCharSet = (BYTE)m_charset;
wxStrlcpy(lf.lfFaceName, m_facename.c_str(), WXSIZEOF(lf.lfFaceName));
lf.lfPitchAndFamily = 0;
::EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this, 0 /* reserved */) ;
#endif // Win32/CE
#endif // WinCE/!WinCE
::ReleaseDC(NULL, hDC);
#endif

View File

@@ -201,7 +201,7 @@ wxFontEncoding wxGetFontEncFromCharSet(int cs)
fontEncoding = wxFONTENCODING_MAX;
break;
#if defined(__WIN32__) && !defined(__WXMICROWIN__)
#if !defined(__WXMICROWIN__)
case EASTEUROPE_CHARSET:
fontEncoding = wxFONTENCODING_CP1250;
break;

View File

@@ -29,7 +29,7 @@
#include <mmsystem.h>
// Why doesn't BC++ have joyGetPosEx?
#if !defined(__WIN32__) || defined(__BORLANDC__)
#if defined(__BORLANDC__)
#define NO_JOYGETPOSEX
#endif
@@ -408,41 +408,29 @@ int wxJoystick::GetNumberButtons() const
int wxJoystick::GetNumberAxes() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wNumAxes;
#else
return 0;
#endif
}
int wxJoystick::GetMaxButtons() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wMaxButtons;
#else
return 0;
#endif
}
int wxJoystick::GetMaxAxes() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wMaxAxes;
#else
return 0;
#endif
}
int wxJoystick::GetPollingMin() const
@@ -465,172 +453,120 @@ int wxJoystick::GetPollingMax() const
int wxJoystick::GetRudderMin() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wRmin;
#else
return 0;
#endif
}
int wxJoystick::GetRudderMax() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wRmax;
#else
return 0;
#endif
}
int wxJoystick::GetUMin() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wUmin;
#else
return 0;
#endif
}
int wxJoystick::GetUMax() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wUmax;
#else
return 0;
#endif
}
int wxJoystick::GetVMin() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wVmin;
#else
return 0;
#endif
}
int wxJoystick::GetVMax() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return 0;
else
return joyCaps.wVmax;
#else
return 0;
#endif
}
bool wxJoystick::HasRudder() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return false;
else
return ((joyCaps.wCaps & JOYCAPS_HASR) == JOYCAPS_HASR);
#else
return false;
#endif
}
bool wxJoystick::HasZ() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return false;
else
return ((joyCaps.wCaps & JOYCAPS_HASZ) == JOYCAPS_HASZ);
#else
return false;
#endif
}
bool wxJoystick::HasU() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return false;
else
return ((joyCaps.wCaps & JOYCAPS_HASU) == JOYCAPS_HASU);
#else
return false;
#endif
}
bool wxJoystick::HasV() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return false;
else
return ((joyCaps.wCaps & JOYCAPS_HASV) == JOYCAPS_HASV);
#else
return false;
#endif
}
bool wxJoystick::HasPOV() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return false;
else
return ((joyCaps.wCaps & JOYCAPS_HASPOV) == JOYCAPS_HASPOV);
#else
return false;
#endif
}
bool wxJoystick::HasPOV4Dir() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return false;
else
return ((joyCaps.wCaps & JOYCAPS_POV4DIR) == JOYCAPS_POV4DIR);
#else
return false;
#endif
}
bool wxJoystick::HasPOVCTS() const
{
#if defined(__WIN32__)
JOYCAPS joyCaps;
if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR)
return false;
else
return ((joyCaps.wCaps & JOYCAPS_POVCTS) == JOYCAPS_POVCTS);
#else
return false;
#endif
}
// Operations

View File

@@ -944,13 +944,11 @@ void wxMenu::SetTitle(const wxString& label)
}
}
#ifdef __WIN32__
// put the title string in bold face
if ( !m_title.empty() )
{
SetDefaultMenuItem(GetHmenu(), (UINT)idMenuTitle);
}
#endif // Win32
}
// ---------------------------------------------------------------------------

View File

@@ -615,7 +615,6 @@ void wxMenuItem::Check(bool check)
return;
}
#ifdef __WIN32__
// calling CheckMenuRadioItem() with such parameters hangs my system
// (NT4 SP6) and I suspect this could happen to the others as well,
// so don't do it!
@@ -630,7 +629,6 @@ void wxMenuItem::Check(bool check)
{
wxLogLastError(wxT("CheckMenuRadioItem"));
}
#endif // __WIN32__
// also uncheck all the other items in this radio group
wxMenuItemList::compatibility_iterator node = items.Item(start);

View File

@@ -326,7 +326,6 @@ void wxMetafileDCImpl::SetMapMode(wxMappingMode mode)
// wxMakeMetafilePlaceable
// ----------------------------------------------------------------------------
#ifdef __WIN32__
struct RECT32
{
short left;
@@ -343,16 +342,6 @@ struct mfPLACEABLEHEADER {
DWORD reserved;
WORD checksum;
};
#else
struct mfPLACEABLEHEADER {
DWORD key;
HANDLE hmf;
RECT bbox;
WORD inch;
DWORD reserved;
WORD checksum;
};
#endif
/*
* Pass filename of existing non-placeable metafile, and bounding box.

View File

@@ -190,7 +190,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
else
#endif
#if wxUSE_BMPBUTTON
#if defined(__WIN32__) && defined(BS_BITMAP)
if (style & BS_BITMAP)
{
// TODO: how to find the bitmap?
@@ -198,7 +197,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
wxLogError(wxT("Have not yet implemented bitmap button as BS_BITMAP button."));
}
else
#endif
if (style1 == BS_OWNERDRAW)
{
// TODO: how to find the bitmap?
@@ -285,7 +283,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
)
win = new wxStaticText;
#if wxUSE_STATBMP
#if defined(__WIN32__) && defined(BS_BITMAP)
else if (style1 == SS_BITMAP)
{
win = new wxStaticBitmap;
@@ -293,7 +290,6 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd)
// Help! this doesn't correspond with the wxWin implementation.
wxLogError(wxT("Please make SS_BITMAP statics into owner-draw buttons."));
}
#endif
#endif /* wxUSE_STATBMP */
}
#endif

View File

@@ -48,7 +48,7 @@ public:
wxRegionRefData(const wxRegionRefData& data) : wxGDIRefData()
{
#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
DWORD noBytes = ::GetRegionData(data.m_region, 0, NULL);
RGNDATA *rgnData = (RGNDATA*) new char[noBytes];
::GetRegionData(data.m_region, noBytes, rgnData);

View File

@@ -244,7 +244,7 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
static const int gs_metricsMap[] =
{
-1, // wxSystemMetric enums start at 1, so give a dummy value for pos 0.
#if defined(__WIN32__) && !defined(__WXWINCE__)
#if !defined(__WXWINCE__)
SM_CMOUSEBUTTONS,
#else
-1,
@@ -260,7 +260,7 @@ static const int gs_metricsMap[] =
#endif
SM_CXDOUBLECLK,
SM_CYDOUBLECLK,
#if defined(__WIN32__) && defined(SM_CXDRAG)
#if defined(SM_CXDRAG)
SM_CXDRAG,
SM_CYDRAG,
SM_CXEDGE,
@@ -288,7 +288,7 @@ static const int gs_metricsMap[] =
SM_CXSCREEN,
SM_CYSCREEN,
#if defined(__WIN32__) && defined(SM_CXSIZEFRAME)
#if defined(SM_CXSIZEFRAME)
SM_CXSIZEFRAME,
SM_CYSIZEFRAME,
SM_CXSMICON,
@@ -307,7 +307,7 @@ static const int gs_metricsMap[] =
#endif
SM_CYCAPTION,
SM_CYMENU,
#if defined(__WIN32__) && defined(SM_NETWORK)
#if defined(SM_NETWORK)
SM_NETWORK,
#else
-1,
@@ -317,7 +317,7 @@ static const int gs_metricsMap[] =
#else
-1,
#endif
#if defined(__WIN32__) && defined(SM_SHOWSOUNDS)
#if defined(SM_SHOWSOUNDS)
SM_SHOWSOUNDS,
#else
-1,

View File

@@ -24,7 +24,7 @@
#pragma hdrstop
#endif
#if wxUSE_SNGLINST_CHECKER && defined(__WIN32__)
#if wxUSE_SNGLINST_CHECKER
#ifndef WX_PRECOMP
#include "wx/string.h"

View File

@@ -299,7 +299,6 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
GetPosition(&x, &y);
GetSize(&w, &h);
#ifdef __WIN32__
// Normally we just use the handle of provided image but in some cases we
// create our own temporary bitmap, so the actual handle may end up being
// different from the original one.
@@ -334,8 +333,6 @@ void wxStaticBitmap::SetImageNoCopy( wxGDIImage* image)
m_currentHandle = (WXHANDLE)handle;
m_ownsCurrentHandle = handle != handleOrig;
#endif // Win32
if ( ImageIsOk() )
{
int width = image->GetWidth(),

View File

@@ -1272,8 +1272,6 @@ void wxTextCtrl::Clear()
}
}
#ifdef __WIN32__
bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& event)
{
SetFocus();
@@ -1289,8 +1287,6 @@ bool wxTextCtrl::EmulateKeyPress(const wxKeyEvent& event)
return GetValue().length() != lenOld;
}
#endif // __WIN32__
// ----------------------------------------------------------------------------
// Accessors
// ----------------------------------------------------------------------------

View File

@@ -86,7 +86,7 @@
#include <lm.h>
#endif // USE_NET_API
#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#if !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#ifndef __UNIX__
#include <io.h>
#endif
@@ -468,7 +468,6 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
if ( path.empty() )
return false;
#if defined(__WIN32__)
ULARGE_INTEGER bytesFree, bytesTotal;
// may pass the path as is, GetDiskFreeSpaceEx() is smart enough
@@ -507,7 +506,6 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
*pFree = wxDiskspaceSize_t(UL(bytesFree).LowPart);
#endif
}
#endif // Win32
return true;
#endif
@@ -890,7 +888,7 @@ bool wxShutdown(int WXUNUSED_IN_WINCE(flags))
#ifdef __WXWINCE__
// TODO-CE
return false;
#elif defined(__WIN32__)
#else
bool bOK = true;
if ( wxGetOsVersion(NULL, NULL) == wxOS_WINDOWS_NT ) // if is NT or 2K

View File

@@ -111,9 +111,7 @@
#include <mmsystem.h>
#endif
#ifdef __WIN32__
#include <windowsx.h>
#endif
#if defined(__WXWINCE__)
#include "wx/msw/wince/missing.h"
@@ -1635,7 +1633,7 @@ void wxWindowMSW::Update()
// just calling UpdateWindow() is not enough, what we did in our WM_PAINT
// handler needs to be really drawn right now
(void)::GdiFlush();
#endif // __WIN32__
#endif // !WinCE
}
// ---------------------------------------------------------------------------