Getting various compilers to work with wxWin again

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2734 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-06-09 18:16:38 +00:00
parent 4286a5b595
commit 25889d3c43
28 changed files with 180 additions and 51 deletions

View File

@@ -316,7 +316,8 @@ Here are the steps required:
socket-related files in src/msw/makefile.g95.
- Set your WXWIN variable to where wxWindows is installed.
For Cygwin/Mingw32, use forward slashes in the path, not backslashes.
*** IMPORTANT: For Cygwin/Mingw32, use forward slashes in the path, not
backslashes.
- Use the makefile.g95 files for compiling wxWindows and samples,
e.g.:

View File

@@ -158,7 +158,7 @@ class WXDLLEXPORT wxPrintData: public wxObject
void operator=(const wxPrintSetupData& setupData);
#endif
#ifdef __WXMSW__
#if defined(__WXMSW__)
// Convert to/from the DEVMODE structure
void ConvertToNative();
void ConvertFromNative();

View File

@@ -72,6 +72,7 @@ enum
// Windows using PostScript print/preview)
// ----------------------------------------------------------------------------
#if wxUSE_POSTSCRIPT
class WXDLLEXPORT wxGenericPrintDialog : public wxDialog
{
DECLARE_DYNAMIC_CLASS(wxGenericPrintDialog)
@@ -150,6 +151,8 @@ public:
wxPrintData& GetPrintData() { return m_printData; }
#endif // wxUSE_POSTSCRIPT
};
#endif
// wxUSE_POSTSCRIPT
class WXDLLEXPORT wxGenericPageSetupDialog : public wxDialog
{

View File

@@ -59,7 +59,7 @@ public:
void Resume() { m_state = Continue; }
/// Callback for optional abort button
void OnCancel(wxEvent& WXUNUSED(event)) { m_state = Canceled; }
void OnCancel(wxCommandEvent& WXUNUSED(event)) { m_state = Canceled; }
/// callback to disable "hard" window closing
void OnClose(wxCloseEvent& event);

View File

@@ -33,7 +33,7 @@ public:
// ctor & dtor
wxDataObject();
~wxDataObject();
virtual ~wxDataObject();
// pure virtuals to override
// get the best suited format for our data
@@ -114,9 +114,9 @@ public:
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDF_BITMAP; }
virtual size_t GetDataSize() const
{ wxASSERT(false); return 0; } // BEMIMP
{ wxASSERT(FALSE); return 0; } // BEMIMP
virtual void GetDataHere(void *pBuf) const
{ wxASSERT(false); } // BEMIMP
{ wxASSERT(FALSE); } // BEMIMP
private:
wxBitmap m_bitmap;

View File

@@ -9,8 +9,12 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/* THIS SHOULD NOT BE USED since you might include it once e.g. in window.h,
* then again _AFTER_ you've included windows.h, in which case it won't work
* a 2nd time -- JACS
#ifndef _WX_WINUNDEF_H_
#define _WX_WINUNDEF_H_
*/
// windows.h #defines the following identifiers which are also used in wxWin
@@ -117,7 +121,7 @@
#ifdef StartDoc
#undef StartDoc
#ifdef __MINGW32__
#ifdef __GNUWIN32__
#define DOCINFOW DOCINFO
#define DOCINFOA DOCINFO
#endif
@@ -196,4 +200,5 @@
// #undef GetNextChild
//endif
#endif // _WX_WINUNDEF_H_
// #endif // _WX_WINUNDEF_H_

View File

@@ -43,6 +43,28 @@ private:
typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
// Truncation in 16-bit BC++ means we need to define these differently
#if defined(__BORLANDC__) && defined(__WIN16__)
#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
{ \
wxEVT_COMMAND_NB_PAGE_CHANGED, \
id, \
-1, \
(wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
NULL \
},
#define EVT_NOTEBOOK_PAGE_CHANGING(id, fn) \
{ \
wxEVT_COMMAND_NB_PAGE_CHANGING, \
id, \
-1, \
(wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn, \
NULL \
},
#else
#define EVT_NOTEBOOK_PAGE_CHANGED(id, fn) \
{ \
wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, \
@@ -61,6 +83,8 @@ typedef void (wxEvtHandler::*wxNotebookEventFunction)(wxNotebookEvent&);
NULL \
},
#endif
// ----------------------------------------------------------------------------
// wxNotebook class itself
// ----------------------------------------------------------------------------

View File

@@ -195,6 +195,10 @@ typedef _TUCHAR wxUChar;
#endif
#elif defined(__GNUWIN32__) && !defined(__MINGW32__) // Cygwin (not Mingw32) doesn't have wcslen.h, needed in buffer.h
#define wxUSE_WCHAR_T 0
#elif defined(__BORLANDC__) // WIN16 BC++
#define wxUSE_WCHAR_T 0
#elif defined(__WATCOMC__)
#define wxUSE_WCHAR_T 0
#else
// add additional compiler checks if this fails
#define wxUSE_WCHAR_T 1
@@ -319,7 +323,50 @@ typedef unsigned char wxUChar;
#define wxSetlocale setlocale
// string.h functions
#define wxStricmp strcasecmp
// #define wxStricmp strcasecmp
// Taken from string.h since it tests for platform more correctly
// portable strcasecmp/_stricmp
inline int WXDLLEXPORT wxStricmp(const char *psz1, const char *psz2)
{
#if defined(__VISUALC__) || ( defined(__MWERKS__) && defined(__INTEL__) )
return _stricmp(psz1, psz2);
#elif defined(__SC__)
return _stricmp(psz1, psz2);
#elif defined(__SALFORDC__)
return stricmp(psz1, psz2);
#elif defined(__BORLANDC__)
return stricmp(psz1, psz2);
#elif defined(__WATCOMC__)
return stricmp(psz1, psz2);
#elif defined(__UNIX__) || defined(__GNUWIN32__)
return strcasecmp(psz1, psz2);
#elif defined(__MWERKS__) && !defined(__INTEL__)
register char c1, c2;
do {
c1 = tolower(*psz1++);
c2 = tolower(*psz2++);
} while ( c1 && (c1 == c2) );
return c1 - c2;
#else
// almost all compilers/libraries provide this function (unfortunately under
// different names), that's why we don't implement our own which will surely
// be more efficient than this code (uncomment to use):
/*
register char c1, c2;
do {
c1 = tolower(*psz1++);
c2 = tolower(*psz2++);
} while ( c1 && (c1 == c2) );
return c1 - c2;
*/
#error "Please define string case-insensitive compare for your OS/compiler"
#endif // OS/compiler
}
// #define wxStrtok strtok_r // this needs a configure check
// leave the rest to defaults below

View File

@@ -225,8 +225,9 @@ wxPrintData::~wxPrintData()
#endif
}
#if defined(__WXMSW__) && defined(__WIN32__)
#if defined(__WXMSW__) // && defined(__WIN32__)
#ifdef __WIN32__
static wxString wxGetPrintDlgError()
{
DWORD err = CommDlgExtendedError();
@@ -259,8 +260,7 @@ static wxString wxGetPrintDlgError()
}
return msg;
}
#endif
void wxPrintData::ConvertToNative()
{
@@ -331,8 +331,10 @@ void wxPrintData::ConvertToNative()
//// Collation
#ifndef __WIN16__
devMode->dmCollate = (m_printCollate ? DMCOLLATE_TRUE : DMCOLLATE_FALSE);
devMode->dmFields |= DM_COLLATE;
#endif
//// Number of copies
@@ -451,6 +453,7 @@ void wxPrintData::ConvertFromNative()
//// Collation
#ifndef __WIN16__
if (devMode->dmFields & DM_COLLATE)
{
if (devMode->dmCollate == DMCOLLATE_TRUE)
@@ -458,6 +461,7 @@ void wxPrintData::ConvertFromNative()
else
m_printCollate = FALSE;
}
#endif
//// Number of copies
@@ -734,8 +738,8 @@ void wxPrintDialogData::ConvertToNative()
#ifdef __GNUWIN32__
pd->lStructSize = 66 ;
#else
#endif
pd->lStructSize = sizeof(PRINTDLG);
#endif
pd->hwndOwner = (HWND)NULL;
pd->hDevMode = NULL; // Will be created by PrintDlg
pd->hDevNames = NULL; // Ditto

View File

@@ -1146,7 +1146,11 @@ void wxTrace(const wxChar *fmt ...)
}
else
#ifdef __WXMSW__
#ifdef __WIN32__
OutputDebugString((LPCTSTR)buffer) ;
#else
OutputDebugString((const char*) buffer) ;
#endif
#else
fprintf(stderr, buffer);
#endif
@@ -1178,7 +1182,11 @@ void wxTraceLevel(int level, const wxChar *fmt ...)
}
else
#ifdef __WXMSW__
#ifdef __WIN32__
OutputDebugString((LPCTSTR)buffer) ;
#else
OutputDebugString((const char*) buffer) ;
#endif
#else
fprintf(stderr, buffer);
#endif

View File

@@ -31,6 +31,7 @@
#include "wx/gdicmn.h"
#include "wx/intl.h"
#include "wx/imaglist.h"
#include "wx/icon.h"
#include "wx/generic/dirdlgg.h"

View File

@@ -31,7 +31,7 @@
#include <wx/log.h>
#include <wx/settings.h>
#include <wx/generic/imaglist.h>
#include <wx/generic/notebook.h>
#include <wx/notebook.h>
#include <wx/dcclient.h>
// ----------------------------------------------------------------------------
@@ -479,7 +479,7 @@ bool wxNotebook::RefreshLayout(bool force)
m_tabView->SetViewRect(rect);
m_tabView->Layout();
m_tabView->LayoutTabs();
// Need to do it a 2nd time to get the tab height with
// the new view width, since changing the view width changes the
@@ -492,7 +492,7 @@ bool wxNotebook::RefreshLayout(bool force)
m_tabView->SetViewRect(rect);
m_tabView->Layout();
m_tabView->LayoutTabs();
if (!force && (rect == oldRect))
return FALSE;

View File

@@ -65,18 +65,21 @@
// wxWin macros
// ----------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
#if wxUSE_POSTSCRIPT
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
END_EVENT_TABLE()
#endif
IMPLEMENT_CLASS(wxGenericPageSetupDialog, wxDialog)
BEGIN_EVENT_TABLE(wxGenericPageSetupDialog, wxDialog)
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPageSetupDialog::OnPrinter)
@@ -89,6 +92,8 @@
extern wxPrintPaperDatabase *wxThePrintPaperDatabase;
#if wxUSE_POSTSCRIPT
// ============================================================================
// implementation
// ============================================================================

View File

@@ -31,11 +31,7 @@
#ifdef __WXMSW__
#include <windows.h>
#ifdef DrawText
#undef DrawText
#endif
#include "wx/msw/winundef.h"
#endif
#if !USE_SHARED_LIBRARY

View File

@@ -926,7 +926,7 @@ bool wxTreeCtrl::TagNextChildren(wxGenericTreeItem *crt_item, wxGenericTreeItem
size_t count = children.Count();
for (size_t n=(size_t)(index+1); n<count; ++n)
if (TagAllChildrenUntilLast(children[n], last_item, select)) return true;
if (TagAllChildrenUntilLast(children[n], last_item, select)) return TRUE;
return TagNextChildren(parent, last_item, select);
}
@@ -936,17 +936,17 @@ bool wxTreeCtrl::TagAllChildrenUntilLast(wxGenericTreeItem *crt_item, wxGenericT
crt_item->SetHilight(select);
RefreshLine(crt_item);
if (crt_item==last_item) return true;
if (crt_item==last_item) return TRUE;
if (crt_item->HasChildren())
{
wxArrayTreeItems& children = crt_item->GetChildren();
size_t count = children.Count();
for ( size_t n = 0; n < count; ++n )
if (TagAllChildrenUntilLast(children[n], last_item, select)) return true;
if (TagAllChildrenUntilLast(children[n], last_item, select)) return TRUE;
}
return false;
return FALSE;
}
void wxTreeCtrl::SelectItemRange(wxGenericTreeItem *item1, wxGenericTreeItem *item2)
@@ -988,8 +988,8 @@ void wxTreeCtrl::SelectItem(const wxTreeItemId& itemId,
// to keep going anyhow !!!
if (is_single)
{
unselect_others=true;
extended_select=false;
unselect_others=TRUE;
extended_select=FALSE;
}
wxGenericTreeItem *item = itemId.m_pItem;
@@ -1029,7 +1029,7 @@ void wxTreeCtrl::SelectItem(const wxTreeItemId& itemId,
}
else
{
bool select=true; // the default
bool select=TRUE; // the default
// Check if we need to toggle hilight (ctrl mode)
if (!unselect_others)

View File

@@ -60,10 +60,14 @@ int wxCaretBase::GetBlinkTime()
//static
void wxCaretBase::SetBlinkTime(int milliseconds)
{
#ifdef __WIN16__
::SetCaretBlinkTime(milliseconds) ;
#else
if ( !::SetCaretBlinkTime(milliseconds) )
{
wxLogLastError("SetCaretBlinkTime");
}
#endif
}
// ---------------------------------------------------------------------------
@@ -77,6 +81,10 @@ bool wxCaret::MSWCreateCaret()
if ( !m_hasCaret )
{
#ifdef __WIN16__
::CreateCaret(GetWinHwnd(GetWindow()), 0, m_width, m_height) ;
m_hasCaret = TRUE;
#else
if ( !::CreateCaret(GetWinHwnd(GetWindow()), 0, m_width, m_height) )
{
wxLogLastError("CreateCaret");
@@ -85,6 +93,7 @@ bool wxCaret::MSWCreateCaret()
{
m_hasCaret = TRUE;
}
#endif
}
return m_hasCaret;
@@ -112,10 +121,14 @@ void wxCaret::OnKillFocus()
{
m_hasCaret = FALSE;
#ifdef __WIN16__
::DestroyCaret() ;
#else
if ( !::DestroyCaret() )
{
wxLogLastError("DestroyCaret");
}
#endif
}
}
@@ -133,20 +146,28 @@ void wxCaret::DoShow()
(void)MSWCreateCaret();
}
#ifdef __WIN16__
::ShowCaret(GetWinHwnd(GetWindow())) ;
#else
if ( !::ShowCaret(GetWinHwnd(GetWindow())) )
{
wxLogLastError("ShowCaret");
}
#endif
}
void wxCaret::DoHide()
{
if ( m_hasCaret )
{
#ifdef __WIN16__
::HideCaret(GetWinHwnd(GetWindow())) ;
#else
if ( !::HideCaret(GetWinHwnd(GetWindow())) )
{
wxLogLastError("HideCaret");
}
#endif
}
}
@@ -158,10 +179,14 @@ void wxCaret::DoMove()
{
if ( m_hasCaret )
{
#ifdef __WIN16__
::SetCaretPos(m_x, m_y) ;
#else
if ( !::SetCaretPos(m_x, m_y) )
{
wxLogLastError("SetCaretPos");
}
#endif
}
//else: we don't have caret right now, nothing to do (this does happen)
}

View File

@@ -559,7 +559,7 @@ void wxDC::DoDrawRoundedRectangle(long x, long y, long width, long height, doubl
long y2 = (y+height);
(void)RoundRect(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2),
YLOG2DEV(y2), 2*XLOG2DEV(radius), 2*YLOG2DEV(radius));
YLOG2DEV(y2), (int) (2*XLOG2DEV(radius)), (int)( 2*YLOG2DEV(radius)));
CalcBoundingBox(x, y);
CalcBoundingBox(x2, y2);

View File

@@ -79,7 +79,7 @@ static PAINTSTRUCT g_paintStruct;
// created in resopnse to WM_PAINT message - doing this from elsewhere is a
// common programming error among wxWindows programmers and might lead to
// very subtle and difficult to debug refresh/repaint bugs.
extern bool g_isPainting = FALSE;
bool g_isPainting = FALSE;
#endif // __WXDEBUG__
// ===========================================================================

View File

@@ -27,6 +27,7 @@
#include "wx/dcmemory.h"
#include <windows.h>
#include "wx/msw/winundef.h"
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)

View File

@@ -20,14 +20,6 @@
* This will produce a big PCH file.
*/
#if defined(__BORLANDC__)
#if !(defined(__WIN32__) || defined(__NT__) || defined(__WIN32__))
#pragma hdrfile "c:\wx\src\msw\wx.pch"
#endif
#pragma hdrstart
#endif
#include "wx/wxprec.h"
#ifdef __BORLANDC__

View File

@@ -84,6 +84,7 @@ GENERICOBJS= \
COMMONOBJS = \
$(COMMDIR)\config.obj \
$(COMMDIR)\cmndata.obj \
$(COMMDIR)\dcbase.obj \
$(COMMDIR)\docview.obj \
$(COMMDIR)\docmdi.obj \
$(COMMDIR)\dynarray.obj \
@@ -702,6 +703,11 @@ $(COMMDIR)/cmndata.obj: $*.$(SRCSUFF)
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(COMMDIR)/dcbase.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
$(COMMDIR)/docview.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)

View File

@@ -65,7 +65,6 @@ COMMONOBJS = cmndata.obj &
gdicmn.obj &
image.obj &
imagpng.obj &
imagjpeg.obj &
intl.obj &
ipcbase.obj &
helpbase.obj &
@@ -95,6 +94,7 @@ COMMONOBJS = cmndata.obj &
sckfile.obj &
sckipc.obj &
sckstrm.obj &
sckint.obj &
url.obj &
http.obj &
protocol.obj &
@@ -115,6 +115,7 @@ COMMONOBJS = cmndata.obj &
wxchar.obj
# Can't compile these yet under Watcom C++
# imagjpeg.obj &
# odbc.obj &
# db.obj &
# dbtable.obj &
@@ -569,7 +570,7 @@ image.obj: $(COMMDIR)\image.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
imagpng.obj: $(COMMDIR)\imagpng.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
*$(CCC) $(CPPFLAGS) -i=..\png -i=..\zlib $(IFLAGS) $<
imagjpeg.obj: $(COMMDIR)\imagjpeg.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
@@ -655,6 +656,9 @@ string.obj: $(COMMDIR)\string.cpp
socket.obj: $(COMMDIR)\socket.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
sckint.obj: $(COMMDIR)\sckint.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
sckaddr.obj: $(COMMDIR)\sckaddr.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<

View File

@@ -967,7 +967,11 @@ BOOL PASCAL DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc,
rgbText = SetTextColor( hDC, rgbText ) ;
SetBkMode( hDC, nBkMode ) ;
#ifdef __WIN16__
GlobalFreePtr( (unsigned int) lpsz ) ;
#else
GlobalFreePtr( lpsz ) ;
#endif
}
}

View File

@@ -668,7 +668,11 @@ bool ConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
case VT_BOOL:
{
#if defined(__WATCOMC__) || (defined(_MSC_VER) && (_MSC_VER <= 1000)) //GC
#ifndef HAVE_BOOL // Can't use bool operator if no native bool type
variant = (long) (oleVariant.bool != 0);
#else
variant = (bool) (oleVariant.bool != 0);
#endif
#else
variant = (bool) (oleVariant.boolVal != 0);
#endif

View File

@@ -1183,6 +1183,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
void wxTextCtrl::AdjustSpaceLimit()
{
#ifndef __WIN16__
unsigned int len = ::GetWindowTextLength(GetHwnd()),
limit = ::SendMessage(GetHwnd(), EM_GETLIMITTEXT, 0, 0);
if ( len > limit )
@@ -1198,6 +1199,7 @@ void wxTextCtrl::AdjustSpaceLimit()
else
::SendMessage(GetHwnd(), EM_LIMITTEXT, limit, 0);
}
#endif
}
// For Rich Edit controls. Do we need it?

View File

@@ -534,11 +534,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
#endif // wxUSE_RESOURCES
// ---------------------------------------------------------------------------
// helper functiosn for showing a "busy" cursor
// helper functions for showing a "busy" cursor
// ---------------------------------------------------------------------------
extern HCURSOR gs_wxBusyCursor = 0; // new, busy cursor
static HCURSOR gs_wxBusyCursorOld = 0; // old cursor
HCURSOR gs_wxBusyCursor = 0; // new, busy cursor
HCURSOR gs_wxBusyCursorOld = 0; // old cursor
static int gs_wxBusyCursorCount = 0;
// Set the cursor to the busy cursor for all windows

View File

@@ -1561,7 +1561,7 @@ void wxWindow::UnpackScroll(WXWPARAM wParam, WXLPARAM lParam,
void wxWindow::UnpackCtlColor(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *nCtlColor, WXHDC *hdc, WXHWND *hwnd)
{
*control = (WXHWND)LOWORD(lParam);
*hwnd = (WXHWND)LOWORD(lParam);
*nCtlColor = (int)HIWORD(lParam);
*hdc = (WXHDC)wParam;
}
@@ -1945,7 +1945,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
break;
case WM_GETMINMAXINFO:
processed = HandleGetMinMaxInfo((LPMINMAXINFO)lParam);
processed = HandleGetMinMaxInfo((MINMAXINFO*)lParam);
break;
case WM_SETCURSOR:

View File

@@ -7,6 +7,7 @@
# Makefile : Builds PNG library for Watcom C++, WIN32
WXDIR = ..\..
EXTRACPPFLAGS=-i=..\zlib
!include $(WXDIR)\src\makewat.env
@@ -34,7 +35,3 @@ clean: .SYMBOLIC
cleanall: clean
#accel.obj: $(MSWDIR)\accel.cpp
# *$(CCC) $(CPPFLAGS) $(IFLAGS) $<