From 57c208c5759da71a637f0f0f5b7d3dc3eda09c02 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 19 Jan 1999 18:23:02 +0000 Subject: [PATCH] TWIN32 compatibility added; wxMotif uses wxGTK's wxPostScriptDC; wxByte replaces byte (can conflict with windows.h) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/motif.rsp | 2 + distrib/msw/msw.rsp | 2 + docs/motif/todo.txt | 4 +- docs/msw/install.txt | 12 +++++ include/wx/defs.h | 13 +++++- include/wx/gtk/wave.h | 10 ++-- include/wx/gtk1/wave.h | 10 ++-- include/wx/msw/bitmap.h | 6 +-- include/wx/msw/pen.h | 4 +- include/wx/msw/private.h | 4 ++ include/wx/msw/setup.h | 13 ++++++ include/wx/msw/tbar95.h | 6 +-- include/wx/msw/wave.h | 6 +-- include/wx/msw/window.h | 4 +- include/wx/msw/wx.rc | 2 +- include/wx/postscrp.h | 2 +- include/wx/wxprec.h | 4 ++ samples/minimal/makefile.g95 | 2 +- samples/printing/printing.cpp | 2 +- src/common/filefn.cpp | 3 ++ src/common/parser.y | 2 +- src/common/postscrp.cpp | 2 +- src/gtk/dcps.cpp | 87 ++++++++++++++++++++++++++++++++++- src/gtk/wave.cpp | 8 ++-- src/gtk1/dcps.cpp | 87 ++++++++++++++++++++++++++++++++++- src/gtk1/wave.cpp | 8 ++-- src/makeg95.env | 21 +++++---- src/motif/makefile.unx | 1 + src/msw/accel.cpp | 6 +-- src/msw/app.cpp | 70 +++++++++++++++++----------- src/msw/bitmap.cpp | 28 +++++------ src/msw/brush.cpp | 2 +- src/msw/clipbrd.cpp | 12 +++-- src/msw/colordlg.cpp | 2 +- src/msw/control.cpp | 2 +- src/msw/curico.cpp | 80 ++++++++++++++++---------------- src/msw/cursor.cpp | 26 +++++------ src/msw/dc.cpp | 14 ++++-- src/msw/dcmemory.cpp | 2 +- src/msw/dcprint.cpp | 2 +- src/msw/dcscreen.cpp | 4 +- src/msw/dde.cpp | 12 +++-- src/msw/dib.cpp | 6 ++- src/msw/gauge95.cpp | 2 +- src/msw/imaglist.cpp | 22 ++++++++- src/msw/joystick.cpp | 36 ++++++++------- src/msw/listbox.cpp | 2 + src/msw/listctrl.cpp | 4 +- src/msw/main.cpp | 14 +++++- src/msw/makefile.g95 | 7 ++- src/msw/minifram.cpp | 2 + src/msw/nativdlg.cpp | 8 +++- src/msw/notebook.cpp | 6 ++- src/msw/ownerdrw.cpp | 2 +- src/msw/registry.cpp | 13 ++++-- src/msw/settings.cpp | 2 +- src/msw/slider95.cpp | 2 +- src/msw/spinbutt.cpp | 7 ++- src/msw/statbr95.cpp | 2 +- src/msw/tabctrl.cpp | 4 +- src/msw/taskbar.cpp | 4 +- src/msw/tbar95.cpp | 4 +- src/msw/textctrl.cpp | 24 +++++++--- src/msw/treectrl.cpp | 2 +- src/msw/utils.cpp | 31 +++++++------ src/msw/utilsexc.cpp | 4 +- src/msw/wave.cpp | 14 +++--- src/msw/window.cpp | 6 ++- 68 files changed, 575 insertions(+), 244 deletions(-) diff --git a/distrib/msw/motif.rsp b/distrib/msw/motif.rsp index b1ac434215..9694bc765d 100644 --- a/distrib/msw/motif.rsp +++ b/distrib/msw/motif.rsp @@ -63,6 +63,8 @@ setup/shared/sharedSysV misc/afm/*.afm +src/gtk/dcps.cpp + src/motif/*.cpp src/motif/*.c src/motif/*.h diff --git a/distrib/msw/msw.rsp b/distrib/msw/msw.rsp index 38721864cd..7934c19e9c 100644 --- a/distrib/msw/msw.rsp +++ b/distrib/msw/msw.rsp @@ -19,6 +19,8 @@ src/makeg95.env src/makesl.env src/makeprog.sl src/ntwxwin.mak +src/maketwin.env +src/makeprog.twn src/makefile.bcc src/makefile.dos src/makefile.nt diff --git a/docs/motif/todo.txt b/docs/motif/todo.txt index fcffaadfbf..403e317428 100644 --- a/docs/motif/todo.txt +++ b/docs/motif/todo.txt @@ -43,6 +43,8 @@ High Priority - Use wxImage to load other formats into wxBitmaps, such as PNG, BMP. +- Printing dialogs need some tidying. + Low Priority ------------ @@ -59,8 +61,6 @@ Low Priority when implemented as extra bitmap handlers, the code won't be linked unless needed. Update: see if wxImage can handle these formats. -- Print/preview framework in print.cpp (see wxGTK). - - Enhance event handling such that you override e.g. left-click and unless you call the base OnMouseEvent, the click won't be sent to the button. Required for Dialog Editor. diff --git a/docs/msw/install.txt b/docs/msw/install.txt index abe454e918..bce03f2bcd 100644 --- a/docs/msw/install.txt +++ b/docs/msw/install.txt @@ -230,6 +230,18 @@ References: http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/index.html - See also http://web.ukonline.co.uk/julian.smart/wxwin/gnuwin32.htm +TWIN32 and gcc on Linux +----------------------- + +The wxWindows 2 for Windows port may be compiled using +the TWIN32 emulator package from www.willows.com. However, +TWIN32 is by no means finished so this should be taken as +something to think about for the future, rather than +a tool for writing products with. + +Use makefile.twn in much the same way as makefile.g95, as +described above. Not all sample makefiles are supplied yet. + Notes ----- diff --git a/include/wx/defs.h b/include/wx/defs.h index 1bc6681f55..506b03ffec 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -79,6 +79,10 @@ #define __WIN95__ #endif +#if defined(TWIN32) && !defined(__TWIN32__) +#define __TWIN32__ +#endif + #endif // wxMSW // Make sure the environment is set correctly @@ -134,9 +138,12 @@ #endif #if ( defined(_MSC_VER) && (_MSC_VER <= 800) ) || defined(__GNUWIN32__) || (defined(__BORLANDC__) && defined(__WIN16__)) || defined(__SC__) || defined(__SALFORDC__) - #define byte unsigned char +// Not a good idea, because later system files (e.g. windows.h) +// may try to define it. Use wxByte instead. +// #define byte unsigned char #endif +typedef unsigned char wxByte; typedef short int WXTYPE; typedef int wxWindowID; @@ -212,6 +219,10 @@ class WXDLLEXPORT wxEvent; // Error codes // ---------------------------------------------------------------------------- +#ifdef ERR_PARAM +#undef ERR_PARAM +#endif + /// Standard error codes enum ErrCode { diff --git a/include/wx/gtk/wave.h b/include/wx/gtk/wave.h index 6b4095c243..14bdf11293 100644 --- a/include/wx/gtk/wave.h +++ b/include/wx/gtk/wave.h @@ -16,10 +16,6 @@ #pragma interface "wave.h" #endif -#ifndef byte -#define byte unsigned char -#endif - #include "wx/object.h" #ifndef AUDIODEV @@ -31,14 +27,14 @@ class wxWave : public wxObject public: wxWave(); wxWave(const wxString& fileName, bool isResource = FALSE); - wxWave(int size, const byte* data); + wxWave(int size, const wxByte* data); ~wxWave(); public: // Create from resource or file bool Create(const wxString& fileName, bool isResource = FALSE); // Create from data - bool Create(int size, const byte* data); + bool Create(int size, const wxByte* data); bool IsOk() const { return (m_waveData ? TRUE : FALSE); }; bool Play(bool async = TRUE, bool looped = FALSE); @@ -47,7 +43,7 @@ protected: bool Free(); private: - byte* m_waveData; + wxByte* m_waveData; int m_waveLength; bool m_isResource; diff --git a/include/wx/gtk1/wave.h b/include/wx/gtk1/wave.h index 6b4095c243..14bdf11293 100644 --- a/include/wx/gtk1/wave.h +++ b/include/wx/gtk1/wave.h @@ -16,10 +16,6 @@ #pragma interface "wave.h" #endif -#ifndef byte -#define byte unsigned char -#endif - #include "wx/object.h" #ifndef AUDIODEV @@ -31,14 +27,14 @@ class wxWave : public wxObject public: wxWave(); wxWave(const wxString& fileName, bool isResource = FALSE); - wxWave(int size, const byte* data); + wxWave(int size, const wxByte* data); ~wxWave(); public: // Create from resource or file bool Create(const wxString& fileName, bool isResource = FALSE); // Create from data - bool Create(int size, const byte* data); + bool Create(int size, const wxByte* data); bool IsOk() const { return (m_waveData ? TRUE : FALSE); }; bool Play(bool async = TRUE, bool looped = FALSE); @@ -47,7 +43,7 @@ protected: bool Free(); private: - byte* m_waveData; + wxByte* m_waveData; int m_waveLength; bool m_isResource; diff --git a/include/wx/msw/bitmap.h b/include/wx/msw/bitmap.h index ba8dc5ade1..94ac9fa3fe 100644 --- a/include/wx/msw/bitmap.h +++ b/include/wx/msw/bitmap.h @@ -162,10 +162,10 @@ public: inline wxPalette *GetColourMap(void) const { return GetPalette(); } void SetColourMap(wxPalette *cmap) { SetPalette(*cmap); }; #endif - inline wxPalette* GetPalette(void) const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : NULL); } + inline wxPalette* GetPalette(void) const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : (wxPalette*) NULL); } void SetPalette(const wxPalette& palette); - inline wxMask *GetMask(void) const { return (M_BITMAPDATA ? M_BITMAPDATA->m_bitmapMask : NULL); } + inline wxMask *GetMask(void) const { return (M_BITMAPDATA ? M_BITMAPDATA->m_bitmapMask : (wxMask*) NULL); } void SetMask(wxMask *mask) ; inline wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; } @@ -192,7 +192,7 @@ public: void SetHBITMAP(WXHBITMAP bmp); inline WXHBITMAP GetHBITMAP(void) const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); } inline void SetSelectedInto(wxDC *dc) { if (M_BITMAPDATA) M_BITMAPDATA->m_selectedInto = dc; } - inline wxDC *GetSelectedInto(void) const { return (M_BITMAPDATA ? M_BITMAPDATA->m_selectedInto : NULL); } + inline wxDC *GetSelectedInto(void) const { return (M_BITMAPDATA ? M_BITMAPDATA->m_selectedInto : (wxDC*) NULL); } bool FreeResource(bool force = FALSE); // Creates a bitmap that matches the device context's depth, from diff --git a/include/wx/msw/pen.h b/include/wx/msw/pen.h index 6bfd8c646a..d30a10ff83 100644 --- a/include/wx/msw/pen.h +++ b/include/wx/msw/pen.h @@ -79,10 +79,10 @@ public: inline int GetJoin() const { return (M_PENDATA ? M_PENDATA->m_join : 0); }; inline int GetCap() const { return (M_PENDATA ? M_PENDATA->m_cap : 0); }; inline int GetDashes(wxDash **ptr) const { - *ptr = (M_PENDATA ? M_PENDATA->m_dash : NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0); + *ptr = (M_PENDATA ? M_PENDATA->m_dash : (wxDash*) NULL); return (M_PENDATA ? M_PENDATA->m_nbDash : 0); } - inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : NULL); }; + inline wxBitmap *GetStipple() const { return (M_PENDATA ? (& M_PENDATA->m_stipple) : (wxBitmap*) NULL); }; // Internal bool RealizeResource(); diff --git a/include/wx/msw/private.h b/include/wx/msw/private.h index bef4c75a13..14ebb23d13 100644 --- a/include/wx/msw/private.h +++ b/include/wx/msw/private.h @@ -182,11 +182,15 @@ inline bool wxStyleHasBorder(long style) #endif #if defined(__WIN95__) && defined(__WXDEBUG__) && wxUSE_DBWIN32 + +#ifndef __TWIN32__ #ifdef OutputDebugString #undef OutputDebugString #endif #define OutputDebugString OutputDebugStringW95 +#endif + extern void OutputDebugStringW95(const char*, ...); #endif diff --git a/include/wx/msw/setup.h b/include/wx/msw/setup.h index 3c75cb1d7e..5e58c37d5f 100644 --- a/include/wx/msw/setup.h +++ b/include/wx/msw/setup.h @@ -268,6 +268,19 @@ #define wxUSE_OWNER_DRAWN 0 #endif +#ifdef __TWIN32__ + +#undef wxUSE_THREADS +#define wxUSE_THREADS 0 + +#undef wxUSE_DBWIN32 +#define wxUSE_DBWIN32 0 + +#undef wxUSE_ODBC +#define wxUSE_ODBC 0 + +#endif + // Minimal setup e.g. for compiling small utilities #define MINIMAL_WXWINDOWS_SETUP 0 diff --git a/include/wx/msw/tbar95.h b/include/wx/msw/tbar95.h index 3a20875d47..78ef1e5ff8 100644 --- a/include/wx/msw/tbar95.h +++ b/include/wx/msw/tbar95.h @@ -44,9 +44,9 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase const wxString& name = wxToolBarNameStr); // Call default behaviour - void OnPaint(wxPaintEvent& event) { Default() ; } - void OnSize(wxSizeEvent& event) { Default() ; } - void OnKillFocus(wxFocusEvent& event) { Default() ; } + void OnPaint(wxPaintEvent& WXUNUSED(event)) { Default() ; } + void OnSize(wxSizeEvent& WXUNUSED(event)) { Default() ; } + void OnKillFocus(wxFocusEvent& WXUNUSED(event)) { Default() ; } void OnMouseEvent(wxMouseEvent& event); // Handle wxToolBar95 events diff --git a/include/wx/msw/wave.h b/include/wx/msw/wave.h index 953a01bfcd..d95560bc6f 100644 --- a/include/wx/msw/wave.h +++ b/include/wx/msw/wave.h @@ -23,14 +23,14 @@ class WXDLLEXPORT wxWave : public wxObject public: wxWave(); wxWave(const wxString& fileName, bool isResource = FALSE); - wxWave(int size, const byte* data); + wxWave(int size, const wxByte* data); ~wxWave(); public: // Create from resource or file bool Create(const wxString& fileName, bool isResource = FALSE); // Create from data - bool Create(int size, const byte* data); + bool Create(int size, const wxByte* data); bool IsOk() const { return (m_waveData ? TRUE : FALSE); }; bool Play(bool async = TRUE, bool looped = FALSE) const; @@ -39,7 +39,7 @@ protected: bool Free(); private: - byte* m_waveData; + wxByte* m_waveData; int m_waveLength; bool m_isResource; }; diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index ce6e781f84..27d739947d 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -462,7 +462,7 @@ public: // Does this window want to accept keyboard focus? virtual bool AcceptsFocus() const; - virtual void PrepareDC( wxDC &dc ) {}; + virtual void PrepareDC( wxDC& WXUNUSED(dc) ) {}; public: //////////////////////////////////////////////////////////////////////// //// IMPLEMENTATION @@ -765,7 +765,7 @@ inline int wxWindow::GetId() const { return m_windowId; } inline void wxWindow::SetId(int id) { m_windowId = id; } inline wxWindow *wxWindow::GetParent() const { return m_windowParent; } inline void wxWindow::SetParent(wxWindow *p) { m_windowParent = p; } -inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : NULL); } +inline wxWindow *wxWindow::GetGrandParent() const { return (m_windowParent ? m_windowParent->m_windowParent : (wxWindow*) NULL); } inline wxList& wxWindow::GetChildren() const { return (wxList&) *m_children; } inline wxFont& wxWindow::GetFont() const { return (wxFont&) m_windowFont; } inline wxString wxWindow::GetName() const { return m_windowName; } diff --git a/include/wx/msw/wx.rc b/include/wx/msw/wx.rc index 23c577ae53..a8eed6817b 100644 --- a/include/wx/msw/wx.rc +++ b/include/wx/msw/wx.rc @@ -29,7 +29,7 @@ // // -#if defined( __GNUWIN32__ ) || defined(__MWERKS__) +#if (defined( __GNUWIN32__ ) && !defined(__TWIN32__)) || defined(__MWERKS__) #include #else #include diff --git a/include/wx/postscrp.h b/include/wx/postscrp.h index f0c1e5e0dc..9fac6e46d5 100644 --- a/include/wx/postscrp.h +++ b/include/wx/postscrp.h @@ -43,7 +43,7 @@ public: # endif #endif -#ifdef __WXGTK__ +#if defined(__WXGTK__) || defined(__WXMOTIF__) // wxGTK has its own wxPostscriptDC diff --git a/include/wx/wxprec.h b/include/wx/wxprec.h index 0643443e9d..b1a93f2493 100644 --- a/include/wx/wxprec.h +++ b/include/wx/wxprec.h @@ -59,6 +59,10 @@ #undef FindResource #endif +#ifdef LoadAccelerators +#undef LoadAccelerators +#endif + #else // always include this file (under Unix it's generated by configure) #include "wx/setup.h" diff --git a/samples/minimal/makefile.g95 b/samples/minimal/makefile.g95 index 6ad1b1b2ad..baa1edd9c5 100644 --- a/samples/minimal/makefile.g95 +++ b/samples/minimal/makefile.g95 @@ -31,7 +31,7 @@ $(OBJDIR)/minimal.$(OBJSUFF): minimal.$(SRCSUFF) $(CC) -c $(CPPFLAGS) -o $@ minimal.$(SRCSUFF) $(OBJDIR)/minimal_resources.o: minimal.rc - $(RESCOMP) -i minimal.rc -o $(OBJDIR)/minimal_resources.o $(RESFLAGS) + $(RESCOMP) $(RCINPUTSWITCH) minimal.rc $(RCOUTPUTSWITCH) $(OBJDIR)/minimal_resources.o $(RESFLAGS) clean: rm -f $(OBJECTS) minimal$(GUISUFFIX).exe core *.rsc *.res diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index ae9b4126bb..45339ea6b3 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -319,7 +319,7 @@ void MyFrame::Draw(wxDC& dc) dc.DrawLine(0, 0, 200, 200); dc.DrawLine(200, 0, 0, 200); - wxIcon my_icon( wxICON(mondrian) ); + wxIcon my_icon = wxICON(mondrian) ; dc.DrawIcon( my_icon, 100, 100); } diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 00f7106afb..e828319ae0 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -64,7 +64,10 @@ #endif #ifdef __GNUWIN32__ +#ifndef __TWIN32__ #include +#endif + #define stricmp strcasecmp #endif diff --git a/src/common/parser.y b/src/common/parser.y index 685531559d..16b9b2c33f 100644 --- a/src/common/parser.y +++ b/src/common/parser.y @@ -3,7 +3,7 @@ #ifdef _MSC_VER #include #endif -#ifdef __GNUWIN32__ +#if defined(__GNUWIN32__) && !defined(__TWIN32__) #include #endif diff --git a/src/common/postscrp.cpp b/src/common/postscrp.cpp index 2987647f36..1d22267c6f 100644 --- a/src/common/postscrp.cpp +++ b/src/common/postscrp.cpp @@ -131,7 +131,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject) #endif -#ifndef __WXGTK__ +#if !defined(__WXGTK__) && !defined(__WXMOTIF__) // these should move into wxPostscriptDC: double UnderlinePosition = 0.0F; diff --git a/src/gtk/dcps.cpp b/src/gtk/dcps.cpp index 710668c98a..6dfe6ffdaf 100644 --- a/src/gtk/dcps.cpp +++ b/src/gtk/dcps.cpp @@ -9,10 +9,12 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +#ifndef __WXMOTIF__ #ifdef __GNUG__ #pragma implementation #pragma interface #endif +#endif #include "wx/defs.h" @@ -28,8 +30,12 @@ #include "wx/image.h" #include "wx/log.h" +#include + +#ifdef __WXGTK__ #include "gdk/gdk.h" #include "gtk/gtk.h" +#endif //----------------------------------------------------------------------------- // start and end of document/page @@ -784,7 +790,8 @@ void wxPostScriptDC::SetFont (const wxFont& font) if (!font.Ok()) return; m_font = font; - + +#ifdef __WXGTK__ char *name = wxTheFontNameDirectory->GetPostScriptName( m_font.GetFamily(), m_font.GetWeight(), m_font.GetStyle() ); @@ -794,6 +801,84 @@ void wxPostScriptDC::SetFont (const wxFont& font) << "/" << name << " findfont\n" << YLOG2DEVREL(font.GetPointSize()) << " scalefont setfont\n"; +#else + char buf[100]; + const char *name; + const char *style = ""; + int Style = m_font.GetStyle (); + int Weight = m_font.GetWeight (); + + switch (m_font.GetFamily ()) + { + case wxTELETYPE: + case wxMODERN: + name = "/Courier"; + break; + case wxSWISS: + name = "/Helvetica"; + break; + case wxROMAN: +// name = "/Times-Roman"; + name = "/Times"; // Altered by EDZ + break; + case wxSCRIPT: + name = "/Zapf-Chancery-MediumItalic"; + Style = wxNORMAL; + Weight = wxNORMAL; + break; + default: + case wxDEFAULT: // Sans Serif Font + name = "/LucidaSans"; + } + + if (Style == wxNORMAL && (Weight == wxNORMAL || Weight == wxLIGHT)) + { + if (m_font.GetFamily () == wxROMAN) + style = "-Roman"; + else + style = ""; + } + else if (Style == wxNORMAL && Weight == wxBOLD) + style = "-Bold"; + + else if (Style == wxITALIC && (Weight == wxNORMAL || Weight == wxLIGHT)) + { + if (m_font.GetFamily () == wxROMAN) + style = "-Italic"; + else + style = "-Oblique"; + } + else if (Style == wxITALIC && Weight == wxBOLD) + { + if (m_font.GetFamily () == wxROMAN) + style = "-BoldItalic"; + else + style = "-BoldOblique"; + } + else if (Style == wxSLANT && (Weight == wxNORMAL || Weight == wxLIGHT)) + { + if (m_font.GetFamily () == wxROMAN) + style = "-Italic"; + else + style = "-Oblique"; + } + else if (Style == wxSLANT && Weight == wxBOLD) + { + if (m_font.GetFamily () == wxROMAN) + style = "-BoldItalic"; + else + style = "-BoldOblique"; + } + else + style = ""; + + strcpy (buf, name); + strcat (buf, style); + *m_pstream << buf << " findfont\n"; + // *m_pstream << (m_font.GetPointSize() * m_scaleFactor) << " scalefont setfont\n"; + // No scale factor in this implementation? + *m_pstream << (m_font.GetPointSize()) << " scalefont setfont\n"; +#endif } void wxPostScriptDC::SetPen( const wxPen& pen ) diff --git a/src/gtk/wave.cpp b/src/gtk/wave.cpp index 2436c23461..0801a93663 100644 --- a/src/gtk/wave.cpp +++ b/src/gtk/wave.cpp @@ -48,7 +48,7 @@ wxWave::wxWave(const wxString& sFileName, bool isResource) Create(sFileName, isResource); } -wxWave::wxWave(int size, const byte* data) +wxWave::wxWave(int size, const wxByte* data) : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) { Create(size, data); @@ -80,7 +80,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_waveLength = (int) fileWave.Length(); - m_waveData = new byte[m_waveLength]; + m_waveData = new wxByte[m_waveLength]; if (!m_waveData) { return FALSE; @@ -92,12 +92,12 @@ bool wxWave::Create(const wxString& fileName, bool isResource) } } -bool wxWave::Create(int size, const byte* data) +bool wxWave::Create(int size, const wxByte* data) { Free(); m_isResource = FALSE; m_waveLength=size; - m_waveData = new byte[size]; + m_waveData = new wxByte[size]; if (!m_waveData) { return FALSE; diff --git a/src/gtk1/dcps.cpp b/src/gtk1/dcps.cpp index 710668c98a..6dfe6ffdaf 100644 --- a/src/gtk1/dcps.cpp +++ b/src/gtk1/dcps.cpp @@ -9,10 +9,12 @@ // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// +#ifndef __WXMOTIF__ #ifdef __GNUG__ #pragma implementation #pragma interface #endif +#endif #include "wx/defs.h" @@ -28,8 +30,12 @@ #include "wx/image.h" #include "wx/log.h" +#include + +#ifdef __WXGTK__ #include "gdk/gdk.h" #include "gtk/gtk.h" +#endif //----------------------------------------------------------------------------- // start and end of document/page @@ -784,7 +790,8 @@ void wxPostScriptDC::SetFont (const wxFont& font) if (!font.Ok()) return; m_font = font; - + +#ifdef __WXGTK__ char *name = wxTheFontNameDirectory->GetPostScriptName( m_font.GetFamily(), m_font.GetWeight(), m_font.GetStyle() ); @@ -794,6 +801,84 @@ void wxPostScriptDC::SetFont (const wxFont& font) << "/" << name << " findfont\n" << YLOG2DEVREL(font.GetPointSize()) << " scalefont setfont\n"; +#else + char buf[100]; + const char *name; + const char *style = ""; + int Style = m_font.GetStyle (); + int Weight = m_font.GetWeight (); + + switch (m_font.GetFamily ()) + { + case wxTELETYPE: + case wxMODERN: + name = "/Courier"; + break; + case wxSWISS: + name = "/Helvetica"; + break; + case wxROMAN: +// name = "/Times-Roman"; + name = "/Times"; // Altered by EDZ + break; + case wxSCRIPT: + name = "/Zapf-Chancery-MediumItalic"; + Style = wxNORMAL; + Weight = wxNORMAL; + break; + default: + case wxDEFAULT: // Sans Serif Font + name = "/LucidaSans"; + } + + if (Style == wxNORMAL && (Weight == wxNORMAL || Weight == wxLIGHT)) + { + if (m_font.GetFamily () == wxROMAN) + style = "-Roman"; + else + style = ""; + } + else if (Style == wxNORMAL && Weight == wxBOLD) + style = "-Bold"; + + else if (Style == wxITALIC && (Weight == wxNORMAL || Weight == wxLIGHT)) + { + if (m_font.GetFamily () == wxROMAN) + style = "-Italic"; + else + style = "-Oblique"; + } + else if (Style == wxITALIC && Weight == wxBOLD) + { + if (m_font.GetFamily () == wxROMAN) + style = "-BoldItalic"; + else + style = "-BoldOblique"; + } + else if (Style == wxSLANT && (Weight == wxNORMAL || Weight == wxLIGHT)) + { + if (m_font.GetFamily () == wxROMAN) + style = "-Italic"; + else + style = "-Oblique"; + } + else if (Style == wxSLANT && Weight == wxBOLD) + { + if (m_font.GetFamily () == wxROMAN) + style = "-BoldItalic"; + else + style = "-BoldOblique"; + } + else + style = ""; + + strcpy (buf, name); + strcat (buf, style); + *m_pstream << buf << " findfont\n"; + // *m_pstream << (m_font.GetPointSize() * m_scaleFactor) << " scalefont setfont\n"; + // No scale factor in this implementation? + *m_pstream << (m_font.GetPointSize()) << " scalefont setfont\n"; +#endif } void wxPostScriptDC::SetPen( const wxPen& pen ) diff --git a/src/gtk1/wave.cpp b/src/gtk1/wave.cpp index 2436c23461..0801a93663 100644 --- a/src/gtk1/wave.cpp +++ b/src/gtk1/wave.cpp @@ -48,7 +48,7 @@ wxWave::wxWave(const wxString& sFileName, bool isResource) Create(sFileName, isResource); } -wxWave::wxWave(int size, const byte* data) +wxWave::wxWave(int size, const wxByte* data) : m_waveLength(0), m_isResource(FALSE), m_waveData(NULL) { Create(size, data); @@ -80,7 +80,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_waveLength = (int) fileWave.Length(); - m_waveData = new byte[m_waveLength]; + m_waveData = new wxByte[m_waveLength]; if (!m_waveData) { return FALSE; @@ -92,12 +92,12 @@ bool wxWave::Create(const wxString& fileName, bool isResource) } } -bool wxWave::Create(int size, const byte* data) +bool wxWave::Create(int size, const wxByte* data) { Free(); m_isResource = FALSE; m_waveLength=size; - m_waveData = new byte[size]; + m_waveData = new wxByte[size]; if (!m_waveData) { return FALSE; diff --git a/src/makeg95.env b/src/makeg95.env index 83f77c93c8..53fcbc41c9 100644 --- a/src/makeg95.env +++ b/src/makeg95.env @@ -36,16 +36,20 @@ CCLEX=gcc MAKE=make # LEX -LEX=flex.exe -t -L +LEX=flex -t -L -# YACC. byacc or bison -# YACC=byacc.exe -YACC=bison.exe +# YACC. yacc or bison +# YACC=yacc +YACC=bison -# Resource compiler +# Settings for Cyginw/Mingw32 RESCOMP=windres.exe +RCINPUTSWITCH=-i +RCOUTPUTSWITCH=-o +RCINCSWITCH=--include-dir +RCDEFSWITCH=--define -RESFLAGS=--include-dir $(WXDIR)/include --define __WIN32__ --define __WIN95__ --define __GNUWIN32__ +RESFLAGS=$(RCINCSWITCH) $(WXDIR)/include $(RCDEFSWITCH) __WIN32__ $(RCDEFSWITCH) __WIN95__ $(RCDEFSWITCH) __GNUWIN32__ ########################## Compiler flags ############################# @@ -103,7 +107,7 @@ RANLIB = ranlib #COMPLIBS=-lgcc # Compiler or system-specific include paths -COMPPATHS= +COMPPATHS=-I$(TWINDIR)/include -DTWIN32 -D__TWIN32__ ########################## Directories ############################### @@ -136,7 +140,8 @@ OBJDIR = objects$(GUISUFFIX) # You shouldn't need to change these... CPPFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) CFLAGS = $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) $(WARN) $(OPT) -LDFLAGS = -Wl,--subsystem,windows -mwindows -L$(WXDIR)/lib +WINDOWSLDFLAGS=-Wl,--subsystem,windows -mwindows +LDFLAGS = $(WINDOWSLDFLAGS) -L$(WXDIR)/lib .SUFFIXES: .rc .$(RESSUFF) .$(RSCSUFF) .cpp .c diff --git a/src/motif/makefile.unx b/src/motif/makefile.unx index 6349e83663..37e6ca122c 100644 --- a/src/motif/makefile.unx +++ b/src/motif/makefile.unx @@ -91,6 +91,7 @@ LIB_CPP_SRC=\ dc.cpp \ dcclient.cpp \ dcmemory.cpp \ + dcps.cpp \ dcscreen.cpp \ dialog.cpp \ dnd.cpp \ diff --git a/src/msw/accel.cpp b/src/msw/accel.cpp index 680ec4e770..3e68b6bcaa 100644 --- a/src/msw/accel.cpp +++ b/src/msw/accel.cpp @@ -63,7 +63,7 @@ wxAcceleratorRefData::~wxAcceleratorRefData() if (m_hAccel) { // This function not available in WIN16 -#ifndef __WIN16__ +#if !defined(__WIN16__) && !defined(__TWIN32__) DestroyAcceleratorTable((HACCEL) m_hAccel); #endif } @@ -85,7 +85,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) m_refData = new wxAcceleratorRefData; HACCEL hAccel = -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) #ifdef UNICODE ::LoadAcceleratorsW(wxGetInstance(), (const char *)resource); #else @@ -104,7 +104,7 @@ extern int wxCharCodeWXToMSW(int id, bool *isVirtual); wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]) { // Not available in WIN16 -#ifndef __WIN16__ +#if !defined(__WIN16__) && !defined(__TWIN32__) m_refData = new wxAcceleratorRefData; ACCEL* arr = new ACCEL[n]; diff --git a/src/msw/app.cpp b/src/msw/app.cpp index a1b24b0f1a..6f3427a7bc 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -68,7 +68,7 @@ #include #include -#if defined(__WIN95__) && !defined(__GNUWIN32__) +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif @@ -116,15 +116,15 @@ char wxMDIChildFrameClassName[] = "wxMDIChildFrameClass"; char wxPanelClassName[] = "wxPanelClass"; char wxCanvasClassName[] = "wxCanvasClass"; -HICON wxSTD_FRAME_ICON = NULL; -HICON wxSTD_MDICHILDFRAME_ICON = NULL; -HICON wxSTD_MDIPARENTFRAME_ICON = NULL; +HICON wxSTD_FRAME_ICON = (HICON) NULL; +HICON wxSTD_MDICHILDFRAME_ICON = (HICON) NULL; +HICON wxSTD_MDIPARENTFRAME_ICON = (HICON) NULL; -HICON wxDEFAULT_FRAME_ICON = NULL; -HICON wxDEFAULT_MDICHILDFRAME_ICON = NULL; -HICON wxDEFAULT_MDIPARENTFRAME_ICON = NULL; +HICON wxDEFAULT_FRAME_ICON = (HICON) NULL; +HICON wxDEFAULT_MDICHILDFRAME_ICON = (HICON) NULL; +HICON wxDEFAULT_MDIPARENTFRAME_ICON = (HICON) NULL; -HBRUSH wxDisableButtonBrush = 0; +HBRUSH wxDisableButtonBrush = (HBRUSH) 0; LRESULT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM); @@ -140,8 +140,14 @@ LRESULT APIENTRY wxWndProc(HWND, UINT, WPARAM, LPARAM); long wxApp::sm_lastMessageTime = 0; -#ifdef __WIN95__ - static HINSTANCE gs_hRichEdit = NULL; +#if defined(__WIN95__) && !defined(__TWIN32__) +#define wxUSE_RICHEDIT 1 +#else +#define wxUSE_RICHEDIT 0 +#endif + +#if wxUSE_RICHEDIT + static HINSTANCE gs_hRichEdit = (HINSTANCE) NULL; #endif //// Initialize @@ -183,12 +189,16 @@ bool wxApp::Initialize() #if defined(__WIN95__) InitCommonControls(); + +#if wxUSE_RICHEDIT gs_hRichEdit = LoadLibrary("RICHED32.DLL"); - if (gs_hRichEdit == NULL) + if (gs_hRichEdit == (HINSTANCE) NULL) { wxMessageBox("Could not initialise Rich Edit DLL"); } +#endif + #endif int iMsg = 96; @@ -275,8 +285,8 @@ bool wxApp::RegisterWindowClasses() wndclass.cbClsExtra = 0; wndclass.cbWndExtra = sizeof( DWORD ); // was 4 wndclass.hInstance = wxhInstance; - wndclass.hIcon = NULL; // wxSTD_FRAME_ICON; - wndclass.hCursor = LoadCursor( NULL, IDC_ARROW ); + wndclass.hIcon = (HICON) NULL; // wxSTD_FRAME_ICON; + wndclass.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW ); wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1) ; // wndclass.hbrBackground = GetStockObject( WHITE_BRUSH ); wndclass.lpszMenuName = NULL; @@ -299,10 +309,10 @@ bool wxApp::RegisterWindowClasses() wndclass1.cbClsExtra = 0; wndclass1.cbWndExtra = sizeof( DWORD ); // was 4 wndclass1.hInstance = wxhInstance; - wndclass1.hIcon = NULL; // wxSTD_MDIPARENTFRAME_ICON; - wndclass1.hCursor = LoadCursor( NULL, IDC_ARROW ); + wndclass1.hIcon = (HICON) NULL; // wxSTD_MDIPARENTFRAME_ICON; + wndclass1.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW ); // wndclass1.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE+1) ; - wndclass1.hbrBackground = NULL; + wndclass1.hbrBackground = (HBRUSH) NULL; wndclass1.lpszMenuName = NULL; wndclass1.lpszClassName = wxMDIFrameClassName; @@ -321,8 +331,8 @@ bool wxApp::RegisterWindowClasses() wndclass4.cbClsExtra = 0; wndclass4.cbWndExtra = sizeof( DWORD ); // was 4 wndclass4.hInstance = wxhInstance; - wndclass4.hIcon = NULL; // wxSTD_MDICHILDFRAME_ICON; - wndclass4.hCursor = LoadCursor( NULL, IDC_ARROW ); + wndclass4.hIcon = (HICON) NULL; // wxSTD_MDICHILDFRAME_ICON; + wndclass4.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW ); // TODO: perhaps this should be NULL so that Windows doesn't // paint the background itself (would OnEraseBackground duplicate // this?) @@ -348,8 +358,8 @@ bool wxApp::RegisterWindowClasses() wndclass2.cbClsExtra = 0; wndclass2.cbWndExtra = sizeof( DWORD ); // was 4 wndclass2.hInstance = wxhInstance; - wndclass2.hIcon = NULL; - wndclass2.hCursor = NULL; + wndclass2.hIcon = (HICON) NULL; + wndclass2.hCursor = (HCURSOR) NULL; // wndclass2.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1) ; wndclass2.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH ); wndclass2.lpszMenuName = NULL; @@ -373,10 +383,10 @@ bool wxApp::RegisterWindowClasses() wndclass3.cbClsExtra = 0; wndclass3.cbWndExtra = sizeof( DWORD ); // was 4 wndclass3.hInstance = wxhInstance; - wndclass3.hIcon = NULL; - wndclass3.hCursor = NULL; + wndclass3.hIcon = (HICON) NULL; + wndclass3.hCursor = (HCURSOR) NULL; // wndclass3.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ; - wndclass3.hbrBackground = NULL; + wndclass3.hbrBackground = (HBRUSH) NULL; wndclass3.lpszMenuName = NULL; wndclass3.lpszClassName = wxCanvasClassName; if (!RegisterClass( &wndclass3)) @@ -500,10 +510,14 @@ void wxApp::CleanUp() wxSetKeyboardHook(FALSE); #ifdef __WIN95__ - if (gs_hRichEdit != NULL) + +#if wxUSE_RICHEDIT + if (gs_hRichEdit != (HINSTANCE) NULL) FreeLibrary(gs_hRichEdit); #endif +#endif + #if wxUSE_PENWINDOWS wxCleanUpPenWin(); #endif @@ -922,7 +936,7 @@ bool wxApp::ProcessMessage(WXMSG *Msg) // Try translations first; find the youngest window with // a translation table. - for (hWnd = msg->hwnd; hWnd != NULL; hWnd = ::GetParent(hWnd)) + for (hWnd = msg->hwnd; hWnd != (HWND) NULL; hWnd = ::GetParent(hWnd)) { wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd); if (wnd) @@ -933,7 +947,7 @@ bool wxApp::ProcessMessage(WXMSG *Msg) } // Anyone for a non-translation message? Try youngest descendants first. - for (hWnd = msg->hwnd; hWnd != NULL; hWnd = ::GetParent(hWnd)) + for (hWnd = msg->hwnd; hWnd != (HWND) NULL; hWnd = ::GetParent(hWnd)) { wxWindow *wnd = wxFindWinFromHandle((WXHWND) hWnd); if (wnd) @@ -1033,7 +1047,7 @@ void wxApp::DeletePendingObjects() } } -void wxApp::OnEndSession(wxCloseEvent& event) +void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) { if (GetTopWindow()) GetTopWindow()->Close(TRUE); @@ -1136,6 +1150,6 @@ HINSTANCE wxGetInstance() // For some reason, with MSVC++ 1.5, WinMain isn't linked in properly // if in a separate file. So include it here to ensure it's linked. -#if (defined(_MSC_VER) && !defined(__WIN32__)) || defined(__GNUWIN32__) +#if (defined(_MSC_VER) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__TWIN32__)) #include "main.cpp" #endif diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 4372ee26a4..948d339184 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -91,7 +91,7 @@ wxBitmap::~wxBitmap(void) wxTheBitmapList->DeleteObject(this); } -bool wxBitmap::FreeResource(bool force) +bool wxBitmap::FreeResource(bool WXUNUSED(force)) { if ( !M_BITMAPDATA ) return FALSE; @@ -187,9 +187,9 @@ bool wxBitmap::Create(int w, int h, int d) } else { - HDC dc = GetDC(NULL); + HDC dc = GetDC((HWND) NULL); M_BITMAPDATA->m_hBitmap = (WXHBITMAP) CreateCompatibleBitmap(dc, w, h); - ReleaseDC(NULL, dc); + ReleaseDC((HWND) NULL, dc); M_BITMAPDATA->m_depth = wxDisplayDepth(); } if (M_BITMAPDATA->m_hBitmap) @@ -385,9 +385,9 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const { wxMemoryDC memDC; wxBitmap tmpBitmap(this->GetWidth(), this->GetHeight(), dc.GetDepth()); - HPALETTE hPal = NULL; + HPALETTE hPal = (HPALETTE) NULL; LPBITMAPINFO lpDib; - void *lpBits = NULL; + void *lpBits = (void*) NULL; /* wxASSERT( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) ); @@ -577,18 +577,18 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) -bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) +bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth)) { return FALSE; } -bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long type, - int desiredWidth, int desiredHeight) +bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), long WXUNUSED(type), + int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { return FALSE; } -bool wxBitmapHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) +bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), int WXUNUSED(type), const wxPalette *WXUNUSED(palette)) { return FALSE; } @@ -613,8 +613,8 @@ public: }; IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler) -bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight) +bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags), + int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { // TODO: load colourmap. M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name); @@ -652,8 +652,8 @@ public: }; IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler) -bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight) +bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags), + int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { #if wxUSE_IMAGE_LOADING_IN_MSW wxPalette *palette = NULL; @@ -677,7 +677,7 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla #endif } -bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *pal) +bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int WXUNUSED(type), const wxPalette *pal) { #if wxUSE_IMAGE_LOADING_IN_MSW wxPalette *actualPalette = (wxPalette *)pal; diff --git a/src/msw/brush.cpp b/src/msw/brush.cpp index 4a46f5c0b4..9c33fc9edd 100644 --- a/src/msw/brush.cpp +++ b/src/msw/brush.cpp @@ -168,7 +168,7 @@ WXHANDLE wxBrush::GetResourceHandle(void) return (WXHANDLE) M_BRUSHDATA->m_hBrush; } -bool wxBrush::FreeResource(bool force) +bool wxBrush::FreeResource(bool WXUNUSED(force)) { if (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush != 0)) { diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 8a18cf4e5c..efca97a0bb 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -100,8 +100,8 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int h { wxBitmap *wxBM = (wxBitmap *)obj; - HDC hdcMem = CreateCompatibleDC(NULL); - HDC hdcSrc = CreateCompatibleDC(NULL); + HDC hdcMem = CreateCompatibleDC((HDC) NULL); + HDC hdcSrc = CreateCompatibleDC((HDC) NULL); HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, (HBITMAP) wxBM->GetHBITMAP()); HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc, wxBM->GetWidth(), wxBM->GetHeight()); @@ -133,7 +133,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int h { #if wxUSE_IMAGE_LOADING_IN_MSW HBITMAP hBitmap=(HBITMAP) ((wxBitmap *)obj)->GetHBITMAP(); - HANDLE hDIB=BitmapToDIB(hBitmap,NULL); // NULL==uses system palette + HANDLE hDIB=BitmapToDIB(hBitmap,(HPALETTE) NULL); // NULL==uses system palette bool success = (::SetClipboardData(CF_DIB,hDIB) != 0); #else bool success=FALSE; @@ -220,8 +220,8 @@ wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len) if (!hBitmap) return NULL; - HDC hdcMem = CreateCompatibleDC(NULL); - HDC hdcSrc = CreateCompatibleDC(NULL); + HDC hdcMem = CreateCompatibleDC((HDC) NULL); + HDC hdcSrc = CreateCompatibleDC((HDC) NULL); HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, hBitmap); GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); @@ -343,6 +343,7 @@ wxClipboard::~wxClipboard() void wxClipboard::Clear() { +#if wxUSE_DRAG_AND_DROP wxNode* node = m_data.First(); while (node) { @@ -351,6 +352,7 @@ void wxClipboard::Clear() node = node->Next(); } m_data.Clear(); +#endif } bool wxClipboard::Open() diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp index d9cbc6a244..78a01e7dde 100644 --- a/src/msw/colordlg.cpp +++ b/src/msw/colordlg.cpp @@ -89,7 +89,7 @@ int wxColourDialog::ShowModal(void) custColours[i] = RGB(m_colourData.custColours[i].Red(), m_colourData.custColours[i].Green(), m_colourData.custColours[i].Blue()); chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR); - chooseColorStruct.hwndOwner = (HWND) (m_dialogParent ? (HWND) m_dialogParent->GetHWND() : NULL); + chooseColorStruct.hwndOwner = (HWND) (m_dialogParent ? (HWND) m_dialogParent->GetHWND() : (HWND) NULL); chooseColorStruct.rgbResult = RGB(m_colourData.dataColour.Red(), m_colourData.dataColour.Green(), m_colourData.dataColour.Blue()); chooseColorStruct.lpCustColors = custColours; diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 6c1cbf8c8d..a0bcf8dff2 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -30,7 +30,7 @@ #include "wx/msw/private.h" -#if defined(__WIN95__) && !defined(__GNUWIN32__) +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index 854a6a65ab..4811882fac 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -19,9 +19,11 @@ #include #include +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif #include "wx/msw/curicop.h" #include "wx/msw/curico.h" @@ -39,9 +41,9 @@ HICON ReadIconFile( char *szFileName, HINSTANCE hInst, int *W, int *H) { HICON hIcon; HANDLE hDIB; - if( (hDIB = ReadIcon(szFileName, W, H)) == NULL) + if( (hDIB = ReadIcon(szFileName, W, H)) == (HANDLE) NULL) // read the icon DIB from file - return NULL; + return (HICON) NULL; hIcon = MakeIcon( hDIB, hInst); // create an icon from DIB GlobalFree( hDIB); return hIcon; @@ -62,9 +64,9 @@ HICON CursorToIcon( char *szFileName, HINSTANCE hInst, int *W, int *H) { HANDLE hDIB; // Handle to DIB memory HICON hIcon; // Handle to Icon - if( (hDIB = ReadCur( szFileName, NULL, W, H)) == NULL) + if( (hDIB = ReadCur( szFileName, NULL, W, H)) == (HANDLE) NULL) // Read cursor DIB - return NULL; + return (HICON) NULL; hIcon = MakeIcon( hDIB, hInst); // make icon from cursor DIB GlobalFree( hDIB); return hIcon; @@ -98,11 +100,10 @@ HANDLE ReadIcon( char *szFileName, int *W, int *H) ++nDirEntries; if((cbHead != sizeof( ICONFILEHEADER)) || (cbRes != sizeof( ICONFILERES))) - return NULL; - + return (HANDLE) NULL; // Verify that it's an .ICON file if( iconFileHead.wResourceType != 1) - return NULL; + return (HANDLE) NULL; // inserted by P.S. while( (nDirEntries < iconFileHead.wResourceCount) && @@ -110,7 +111,7 @@ HANDLE ReadIcon( char *szFileName, int *W, int *H) { cbRes = _lread( hFile, (LPSTR )&iconFileRes, sizeof( ICONFILERES)); if(cbRes != sizeof( ICONFILERES)) - return NULL; + return (HANDLE) NULL; else ++nDirEntries; } @@ -122,8 +123,9 @@ HANDLE ReadIcon( char *szFileName, int *W, int *H) // Allocate and lock memory to read in the DIB hDIB = GlobalAlloc(GHND, iconFileRes.dwDIBSize); - if(hDIB == NULL) - return NULL; + if(hDIB == (HANDLE) NULL) + return (HANDLE) NULL; + #ifdef __WINDOWS_386__ lpDIB = (LPBITMAPINFO)MK_FP32(GlobalLock(hDIB)); #else @@ -143,7 +145,7 @@ HANDLE ReadIcon( char *szFileName, int *W, int *H) if( (DWORD )cbBits != iconFileRes.dwDIBSize) { GlobalFree( hDIB); - return NULL; + return (HANDLE) NULL; } return hDIB; } @@ -219,13 +221,13 @@ HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes); hXorDDB = GlobalAlloc( GHND, dwBmpSize); - if(hXorDDB == NULL) + if(hXorDDB == (HANDLE) NULL) { // clean up before quitting DeleteObject( hbmXor); DeleteDC( hDC); GlobalUnlock( hDIB); - return NULL; + return (HICON) NULL; } #ifdef __WINDOWS_386__ @@ -277,8 +279,8 @@ HCURSOR ReadCursorFile( char *szFileName, HINSTANCE hInst, int *W, int *H, POINT ptHotSpot; // read cur DIB from file - if( (hDIB = ReadCur( szFileName, (LPPOINT )&ptHotSpot, W, H)) == NULL) - return NULL; + if( (hDIB = ReadCur( szFileName, (LPPOINT )&ptHotSpot, W, H)) == (HANDLE) NULL) + return (HCURSOR) NULL; hCursor = MakeCursor( hDIB, (LPPOINT )&ptHotSpot, hInst);//create cur from DIB if(XHot != 0) *XHot = ptHotSpot.x; @@ -305,9 +307,9 @@ HCURSOR IconToCursor( char *szFileName, HINSTANCE hInst, int XHot, int YHot, HANDLE hDIB; POINT ptHotSpot; - if( (hDIB = ReadIcon( szFileName, W, H)) == NULL) + if( (hDIB = ReadIcon( szFileName, W, H)) == (HANDLE) NULL) //read icon file to get icon DIB - return NULL; + return (HCURSOR) NULL; // Set the hot spot of the cursor ptHotSpot.x = XHot; ptHotSpot.y = YHot; @@ -345,11 +347,11 @@ HANDLE ReadCur( char *szFileName, LPPOINT lpptHotSpot, int *W, int *H) ++nDirEntries; if((cbHead != sizeof( CURFILEHEADER)) || (cbRes != sizeof( CURFILERES))) - return NULL; + return (HANDLE) NULL; // Verify that it's an .CUR file if ((curFileRes.bReserved1 != 0) || (curFileHead.wResourceType != 2)) - return NULL; + return (HANDLE) NULL; // following added by P.S. while( (nDirEntries < curFileHead.wResourceCount) && @@ -357,7 +359,7 @@ HANDLE ReadCur( char *szFileName, LPPOINT lpptHotSpot, int *W, int *H) { cbRes = _lread( hFile, (LPSTR )&curFileRes, sizeof( CURFILERES)); if(cbRes != sizeof( CURFILERES)) - return NULL; + return (HANDLE) NULL; else ++nDirEntries; } @@ -369,8 +371,8 @@ HANDLE ReadCur( char *szFileName, LPPOINT lpptHotSpot, int *W, int *H) // Allocate & lock memory to read in the DIB hDIB = GlobalAlloc(GHND, curFileRes.dwDIBSize); - if(hDIB == NULL) - return NULL; + if(hDIB == (HANDLE) NULL) + return (HANDLE) NULL; #ifdef __WINDOWS_386__ lpDIB = (LPBITMAPINFO )MK_FP32(GlobalLock(hDIB)); @@ -390,9 +392,9 @@ HANDLE ReadCur( char *szFileName, LPPOINT lpptHotSpot, int *W, int *H) { GlobalUnlock( hDIB); GlobalFree( hDIB); - return NULL; + return (HANDLE) NULL; } - if(lpptHotSpot != NULL) // If it is necessary to know the hot spot + if(lpptHotSpot != (LPPOINT) NULL) // If it is necessary to know the hot spot { lpptHotSpot->x = (int )curFileRes.wXHotspot; lpptHotSpot->y = (int )curFileRes.wYHotspot; @@ -433,13 +435,13 @@ HBITMAP ColorDDBToMonoDDB ( HBITMAP hbm) dwLen = bi.biSize + PaletteSize((LPSTR)&bi); - hdc = GetDC( NULL); + hdc = GetDC( (HWND) NULL); hdib = GlobalAlloc( GHND, dwLen); - if (hdib == NULL) + if (hdib == (HANDLE) NULL) { - ReleaseDC( NULL, hdc); - return NULL; + ReleaseDC( (HWND) NULL, hdc); + return (HBITMAP) NULL; } #ifdef __WINDOWS_386__ @@ -469,8 +471,8 @@ HBITMAP ColorDDBToMonoDDB ( HBITMAP hbm) else { GlobalFree( hdib); - ReleaseDC( NULL, hdc); - return NULL; + ReleaseDC( (HWND) NULL, hdc); + return (HBITMAP) NULL; } // Call GetDIBits with a NON-NULL lpBits parameter, to actually @@ -487,9 +489,9 @@ HBITMAP ColorDDBToMonoDDB ( HBITMAP hbm) (LPBITMAPINFO)lpbi, DIB_RGB_COLORS) == 0) { GlobalUnlock( hdib); - hdib = NULL; - ReleaseDC( NULL, hdc); - return NULL; + hdib = (HANDLE) NULL; + ReleaseDC( (HWND) NULL, hdc); + return (HBITMAP) NULL; } // Finally, create a monochrome DDB, and put the DIB into @@ -503,7 +505,7 @@ HBITMAP ColorDDBToMonoDDB ( HBITMAP hbm) GlobalUnlock( hdib); GlobalFree( hdib); - ReleaseDC(NULL, hdc); + ReleaseDC((HWND) NULL, hdc); return hbmMono; } @@ -581,12 +583,12 @@ HCURSOR MakeCursor( HANDLE hDIB, LPPOINT lpptHotSpot, HINSTANCE hInst) dwBmpSize = (DWORD )(bmpXor.bmWidthBytes * bmpXor.bmHeight * bmpXor.bmPlanes); hXorDDB = GlobalAlloc( GHND, dwBmpSize); - if(hXorDDB == NULL) + if(hXorDDB == (HANDLE) NULL) { // clean up before quitting DeleteObject( hbmXor); DeleteDC( hDC); GlobalUnlock( hDIB); - return NULL; + return (HCURSOR) NULL; } #ifdef __WINDOWS_386__ lpXorDDB = (LPSTR)MK_FP32(GlobalLock( hXorDDB)); @@ -766,7 +768,7 @@ HCURSOR MakeCursorFromBitmap(HINSTANCE hInst, HBITMAP hBitmap, POINT *pPoint) NPSTR andBits; NPSTR xorBits; - hDC = GetDC(NULL); + hDC = GetDC((HWND) NULL); hDCColor = CreateCompatibleDC(hDC); hDCMono = CreateCompatibleDC(hDC); hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32); @@ -843,7 +845,7 @@ HICON MakeIconFromBitmap(HINSTANCE hInst, HBITMAP hBitmap) NPSTR andBits; NPSTR xorBits; - hDC = GetDC(NULL); + hDC = GetDC((HWND) NULL); hDCColor = CreateCompatibleDC(hDC); hDCMono = CreateCompatibleDC(hDC); hAndBmp = CreateCompatibleBitmap(hDCMono, 32, 32); @@ -882,7 +884,7 @@ HICON MakeIconFromBitmap(HINSTANCE hInst, HBITMAP hBitmap) DeleteDC(hDCMono); DeleteObject(hAndBmp); DeleteObject(hXorBmp); - ReleaseDC(NULL, hDC); + ReleaseDC((HWND) NULL, hDC); #ifndef __WIN32__ LocalUnlock(LocalHandle((WORD) andBits)); LocalUnlock(LocalHandle((WORD) xorBits)); diff --git a/src/msw/cursor.cpp b/src/msw/cursor.cpp index 39272263ac..6e8fc77ee2 100644 --- a/src/msw/cursor.cpp +++ b/src/msw/cursor.cpp @@ -125,29 +125,29 @@ wxCursor::wxCursor(int cursor_type) switch (cursor_type) { case wxCURSOR_WAIT: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_WAIT); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_WAIT); break; case wxCURSOR_IBEAM: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_IBEAM); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_IBEAM); break; case wxCURSOR_CROSS: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_CROSS); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_CROSS); break; case wxCURSOR_SIZENWSE: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENWSE); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZENWSE); break; case wxCURSOR_SIZENESW: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENESW); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZENESW); break; case wxCURSOR_SIZEWE: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZEWE); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZEWE); break; case wxCURSOR_SIZENS: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_SIZENS); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_SIZENS); break; case wxCURSOR_CHAR: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW); break; } case wxCURSOR_HAND: @@ -177,17 +177,17 @@ wxCursor::wxCursor(int cursor_type) } case wxCURSOR_LEFT_BUTTON: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW); break; } case wxCURSOR_RIGHT_BUTTON: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW); break; } case wxCURSOR_MIDDLE_BUTTON: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW); break; } case wxCURSOR_SIZING: @@ -232,7 +232,7 @@ wxCursor::wxCursor(int cursor_type) } default: case wxCURSOR_ARROW: - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(NULL, IDC_ARROW); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor((HINSTANCE) NULL, IDC_ARROW); break; } } @@ -242,7 +242,7 @@ wxCursor::~wxCursor(void) // FreeResource(TRUE); } -bool wxCursor::FreeResource(bool force) +bool wxCursor::FreeResource(bool WXUNUSED(force)) { if (M_CURSORDATA && M_CURSORDATA->m_hCursor && M_CURSORDATA->m_destroyCursor) { diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 1df225556d..73f3390952 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -255,7 +255,7 @@ void wxDC::SetPalette(const wxPalette& palette) m_oldPalette = 0; } - m_palette = m_palette; + m_palette = palette; if (!m_palette.Ok()) { @@ -380,7 +380,7 @@ void wxDC::DrawArc(long x1,long y1,long x2,long y2, long xc, long yc) double radius = (double)sqrt(dx*dx+dy*dy) ;; if (x1==x2 && x2==y2) { - DrawEllipse(xc,yc,(double)(radius*2.0),(double)(radius*2)) ; + DrawEllipse(xc,yc,(long)(radius*2.0),(long)(radius*2.0)) ; return ; } @@ -605,7 +605,7 @@ void wxDC::DrawEllipticArc(long x,long y,long w,long h,double sa,double ea) void wxDC::DrawIcon(const wxIcon& icon, long x, long y) { -#if defined(__WIN32__) && !defined(__SC__) +#if defined(__WIN32__) && !defined(__SC__) && !defined(__TWIN32__) ::DrawIconEx((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), (HICON) icon.GetHICON(), icon.GetWidth(), icon.GetHeight(), 0, 0, DI_NORMAL); #else @@ -677,7 +677,7 @@ void wxDC::SetFont(const wxFont& the_font) if (m_font.Ok() && m_font.GetResourceHandle()) { HFONT f = (HFONT) ::SelectObject((HDC) m_hDC, (HFONT) m_font.GetResourceHandle()); - if (f == NULL) + if (f == (HFONT) NULL) { wxDebugMsg("::SelectObject failed in wxDC::SetFont."); } @@ -894,10 +894,14 @@ bool wxDC::StartDoc(const wxString& message) #else #ifdef UNICODE ::StartDocW((HDC) m_hDC, &docinfo); +#else +#ifdef __TWIN32__ + ::StartDoc((HDC) m_hDC, &docinfo); #else ::StartDocA((HDC) m_hDC, &docinfo); #endif #endif +#endif #ifndef __WIN16__ if (ret <= 0) @@ -1680,7 +1684,7 @@ static bool wx_spline_add_point(double x, double y) static void wx_spline_draw_point_array(wxDC *dc) { - dc->DrawLines(&wx_spline_point_list, (double)0.0, (double)0.0); + dc->DrawLines(&wx_spline_point_list, 0, 0); wxNode *node = wx_spline_point_list.First(); while (node) { diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index f3de3b4b4a..dd76ffcd3a 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -39,7 +39,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) wxMemoryDC::wxMemoryDC(void) { - m_hDC = (WXHDC) ::CreateCompatibleDC(NULL); + m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) NULL); m_ok = (m_hDC != 0); m_bOwnsDC = TRUE; diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index 3dc7c60567..43a6be9b8d 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -65,7 +65,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam PRINTDLG pd; pd.lStructSize = sizeof( PRINTDLG ); - pd.hwndOwner=NULL; + pd.hwndOwner=(HWND) NULL; pd.hDevMode=(HANDLE)NULL; pd.hDevNames=(HANDLE)NULL; pd.Flags=PD_RETURNDC | PD_NOSELECTION | PD_NOPAGENUMS; diff --git a/src/msw/dcscreen.cpp b/src/msw/dcscreen.cpp index 71d61dd7d9..7960fbd3e8 100644 --- a/src/msw/dcscreen.cpp +++ b/src/msw/dcscreen.cpp @@ -34,14 +34,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) // Create a DC representing the whole screen wxScreenDC::wxScreenDC(void) { - m_hDC = (WXHDC) ::GetDC(NULL); + m_hDC = (WXHDC) ::GetDC((HWND) NULL); m_hDCCount ++; } wxScreenDC::~wxScreenDC(void) { SelectOldObjects(m_hDC); - ::ReleaseDC(NULL, (HDC) m_hDC); + ::ReleaseDC((HWND) NULL, (HDC) m_hDC); m_hDC = 0; m_hDCCount --; } diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index 5cdd617036..8ee9071160 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -34,9 +34,11 @@ #include "wx/msw/private.h" #include "wx/dde.h" +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif #include #include @@ -197,7 +199,7 @@ bool wxDDEServer::Create(const wxString& server_name) m_serviceName = server_name; HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)server_name, CP_WINANSI); - if (DdeNameService(DDEIdInst, serviceName, NULL, DNS_REGISTER) == 0) + if (DdeNameService(DDEIdInst, serviceName, (HSZ) NULL, DNS_REGISTER) == 0) { DDEPrintError(); return FALSE; @@ -309,8 +311,8 @@ wxConnectionBase *wxDDEClient::MakeConnection(const wxString& /* host */, const HSZ topic_atom = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)topic, CP_WINANSI); HCONV hConv = DdeConnect(DDEIdInst, serviceName, topic_atom, (PCONVCONTEXT)NULL); - if (hConv == NULL) - return NULL; + if (hConv == (HCONV) NULL) + return (wxConnectionBase*) NULL; else { wxDDEConnection *connection = (wxDDEConnection*) OnMakeConnection(); @@ -322,7 +324,7 @@ wxConnectionBase *wxDDEClient::MakeConnection(const wxString& /* host */, const m_connections.Append(connection); return connection; } - else return NULL; + else return (wxConnectionBase*) NULL; } } @@ -778,7 +780,7 @@ void DDEPrintError(void) err = "Unrecognised error type."; break; } - MessageBox(NULL, (LPCSTR)err, "DDE Error", MB_OK | MB_ICONINFORMATION); + MessageBox((HWND) NULL, (LPCSTR)err, "DDE Error", MB_OK | MB_ICONINFORMATION); } #endif diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 7e5d0959de..bd573f2791 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -48,9 +48,11 @@ #include "wx/msw/dib.h" +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif #ifndef SEEK_CUR /* flags for _lseek */ @@ -259,7 +261,7 @@ HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal) dwLen = bi.biSize + PaletteSize(&bi); - hdc = GetDC(NULL); + hdc = GetDC((HWND) NULL); hpal = SelectPalette(hdc, hpal, FALSE); RealizePalette(hdc); @@ -327,7 +329,7 @@ HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal) GlobalUnlock(hdib); hdib = NULL; SelectPalette(hdc, hpal, FALSE); - ReleaseDC(NULL, hdc); + ReleaseDC((HWND) NULL, hdc); return NULL; } diff --git a/src/msw/gauge95.cpp b/src/msw/gauge95.cpp index 31b9f85f19..3f934a58c0 100644 --- a/src/msw/gauge95.cpp +++ b/src/msw/gauge95.cpp @@ -29,7 +29,7 @@ #include "wx/msw/gauge95.h" #include "wx/msw/private.h" -#if defined(__WIN95__) && !defined(__GNUWIN32__) +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif diff --git a/src/msw/imaglist.cpp b/src/msw/imaglist.cpp index 7cdad3e830..494ff86607 100644 --- a/src/msw/imaglist.cpp +++ b/src/msw/imaglist.cpp @@ -35,7 +35,7 @@ #include "wx/msw/imaglist.h" #include "wx/msw/private.h" -#ifndef __GNUWIN32__ +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif @@ -104,9 +104,14 @@ int wxImageList::Add(const wxBitmap& bitmap, const wxBitmap& mask) // 'bitmap'. int wxImageList::Add(const wxBitmap& bitmap, const wxColour& maskColour) { +#ifdef __TWIN32__ + wxFAIL_MSG("ImageList_AddMasked not implemented in TWIN32"); + return -1; +#else HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP(); COLORREF colorRef = PALETTERGB(maskColour.Red(), maskColour.Green(), maskColour.Blue()); return ImageList_AddMasked((HIMAGELIST) GetHIMAGELIST(), hBitmap1, colorRef); +#endif } // Adds a bitmap and mask from an icon. @@ -121,11 +126,16 @@ int wxImageList::Add(const wxIcon& icon) // 'bitmap' and 'mask'. bool wxImageList::Replace(int index, const wxBitmap& bitmap, const wxBitmap& mask) { +#ifdef __TWIN32__ + wxFAIL_MSG("ImageList_Replace not implemented in TWIN32"); + return FALSE; +#else HBITMAP hBitmap1 = (HBITMAP) bitmap.GetHBITMAP(); HBITMAP hBitmap2 = 0; if ( mask.Ok() ) hBitmap2 = (HBITMAP) mask.GetHBITMAP(); return (ImageList_Replace((HIMAGELIST) GetHIMAGELIST(), index, hBitmap1, hBitmap2) != 0); +#endif } /* Not supported by Win95 @@ -150,7 +160,12 @@ bool wxImageList::Replace(int index, const wxIcon& icon) // Removes the image at the given index. bool wxImageList::Remove(int index) { +#ifdef __TWIN32__ + wxFAIL_MSG("ImageList_Replace not implemented in TWIN32"); + return FALSE; +#else return (ImageList_Remove((HIMAGELIST) GetHIMAGELIST(), index) != 0); +#endif } // Remove all images @@ -171,6 +186,10 @@ bool wxImageList::RemoveAll(void) bool wxImageList::Draw(int index, wxDC& dc, int x, int y, int flags, bool solidBackground) { +#ifdef __TWIN32__ + wxFAIL_MSG("ImageList_Replace not implemented in TWIN32"); + return FALSE; +#else HDC hDC = (HDC) dc.GetHDC(); if ( !hDC ) return FALSE; @@ -204,6 +223,7 @@ bool wxImageList::Draw(int index, wxDC& dc, int x, int y, return (ImageList_Draw((HIMAGELIST) GetHIMAGELIST(), index, hDC, x, y, style) != 0); +#endif } #endif diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index 6f5dfcd0b5..5fa69fd9ce 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -30,12 +30,14 @@ typedef UINT MMRESULT; #endif +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include #endif +#endif // Why doesn't BC++ have joyGetPosEx? -#if !defined(__WIN32__) || defined(__BORLANDC__) +#if !defined(__WIN32__) || defined(__BORLANDC__) || defined(__TWIN32__) #define NO_JOYGETPOSEX #endif @@ -299,7 +301,7 @@ int wxJoystick::GetNumberButtons(void) const int wxJoystick::GetNumberAxes(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -312,7 +314,7 @@ int wxJoystick::GetNumberAxes(void) const int wxJoystick::GetMaxButtons(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -325,7 +327,7 @@ int wxJoystick::GetMaxButtons(void) const int wxJoystick::GetMaxAxes(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -356,7 +358,7 @@ int wxJoystick::GetPollingMax(void) const int wxJoystick::GetRudderMin(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -369,7 +371,7 @@ int wxJoystick::GetRudderMin(void) const int wxJoystick::GetRudderMax(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -382,7 +384,7 @@ int wxJoystick::GetRudderMax(void) const int wxJoystick::GetUMin(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -395,7 +397,7 @@ int wxJoystick::GetUMin(void) const int wxJoystick::GetUMax(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -408,7 +410,7 @@ int wxJoystick::GetUMax(void) const int wxJoystick::GetVMin(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -421,7 +423,7 @@ int wxJoystick::GetVMin(void) const int wxJoystick::GetVMax(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return 0; @@ -435,7 +437,7 @@ int wxJoystick::GetVMax(void) const bool wxJoystick::HasRudder(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return FALSE; @@ -448,7 +450,7 @@ bool wxJoystick::HasRudder(void) const bool wxJoystick::HasZ(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return FALSE; @@ -461,7 +463,7 @@ bool wxJoystick::HasZ(void) const bool wxJoystick::HasU(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return FALSE; @@ -474,7 +476,7 @@ bool wxJoystick::HasU(void) const bool wxJoystick::HasV(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return FALSE; @@ -487,7 +489,7 @@ bool wxJoystick::HasV(void) const bool wxJoystick::HasPOV(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return FALSE; @@ -500,7 +502,7 @@ bool wxJoystick::HasPOV(void) const bool wxJoystick::HasPOV4Dir(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return FALSE; @@ -513,7 +515,7 @@ bool wxJoystick::HasPOV4Dir(void) const bool wxJoystick::HasPOVCTS(void) const { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) JOYCAPS joyCaps; if (joyGetDevCaps(m_joystick, & joyCaps, sizeof(JOYCAPS)) != JOYERR_NOERROR) return FALSE; diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 2b973f90d2..29eda8f233 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -33,9 +33,11 @@ #include #include +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include #endif +#endif #ifdef GetCharWidth #undef GetCharWidth diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 0ba3d68da5..f19fcfb670 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -31,13 +31,15 @@ #include "wx/msw/private.h" -#ifndef __GNUWIN32__ +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem); static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ITEM& tvItem, HWND getFullInfo = 0); diff --git a/src/msw/main.cpp b/src/msw/main.cpp index 1db4fedfc8..45db41d119 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -40,15 +40,25 @@ #if !defined(_WINDLL) +#ifdef __TWIN32__ + +extern "C" +BOOL PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) + +#else + #ifdef __WATCOMC__ int PASCAL #else int APIENTRY #endif - WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR m_lpCmdLine, int nCmdShow ) + WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) +#endif +// __TWIN32__ + { - return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, m_lpCmdLine, nCmdShow); + return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, lpCmdLine, nCmdShow); } #endif diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 2106fb52ba..4cd5a40d0e 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -293,11 +293,16 @@ $(COMMDIR)/lex_yy.c: $(COMMDIR)/lexer.l # Replace yacc with bison if you run into compilation # problems with y_tab.c. + $(COMMDIR)/y_tab.c: $(COMMDIR)/parser.y $(YACC) -o $(COMMDIR)/y_tab.c $(COMMDIR)/parser.y -# mv y.tab.c $(COMMDIR)/y_tab.c +# If you use e.g. gcc on Unix, uncomment these lines +# and comment out the above. +#$(COMMDIR)/y_tab.c: $(COMMDIR)/parser.y +# $(YACC) $(COMMDIR)/parser.y +# mv y.tab.c $(COMMDIR)/y_tab.c # Extra targets rcparser: diff --git a/src/msw/minifram.cpp b/src/msw/minifram.cpp index cabb6e5ede..282ae2bbdd 100644 --- a/src/msw/minifram.cpp +++ b/src/msw/minifram.cpp @@ -32,9 +32,11 @@ #include "wx/minifram.h" #include "wx/msw/private.h" +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxMiniFrame, wxFrame) diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index 120ecad6b1..a99be6dbf8 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -58,7 +58,7 @@ bool wxWindow::LoadNativeDialog(wxWindow* parent, wxWindowID& id) if (hWndNext) child = CreateWindowFromHWND(this, (WXHWND) hWndNext); - while (hWndNext != NULL) + while (hWndNext != (HWND) NULL) { hWndNext = ::GetWindow(hWndNext, GW_HWNDNEXT); if (hWndNext) @@ -139,9 +139,13 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) #else #ifdef UNICODE GetClassNameW((HWND) hWnd, buf, 256); +#else +#ifdef __TWIN32__ + GetClassName((HWND) hWnd, buf, 256); #else GetClassNameA((HWND) hWnd, buf, 256); #endif +#endif #endif wxString str(buf); @@ -224,7 +228,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { win = new wxScrollBar; } -#if defined(__WIN95__) +#if defined(__WIN95__) && !defined(__TWIN32__) else if (str == "MSCTLS_UPDOWN32") { win = new wxSpinButton; diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 6fbfb93887..07112916d4 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -40,9 +40,13 @@ #include // for SetWindowFont +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" -#else //!GnuWin32 +#endif +#endif + +#if !defined(__GNUWIN32__) || defined(__TWIN32__) #include #endif diff --git a/src/msw/ownerdrw.cpp b/src/msw/ownerdrw.cpp index 65477ba905..232d56c290 100644 --- a/src/msw/ownerdrw.cpp +++ b/src/msw/ownerdrw.cpp @@ -89,7 +89,7 @@ bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight) // Win32 GDI functions and not wxWindows ones. Might help to whoever decides to // port this code to X. (VZ) -#if defined(__WIN32__) && !defined(__SC__) +#if defined(__WIN32__) && !defined(__SC__) && !defined(__TWIN32__) #define O_DRAW_NATIVE_API // comments below explain why I use it #endif diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 5d44fc5a73..be45070aec 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -314,7 +314,7 @@ bool wxRegKey::GetKeyInfo(ulong *pnSubKeys, ulong *pnMaxValueLen) const #endif { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) m_dwLastError = ::RegQueryInfoKey ( (HKEY) m_hKey, @@ -474,7 +474,7 @@ bool wxRegKey::DeleteValue(const char *szValue) if ( !Open() ) return FALSE; - #ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) m_dwLastError = RegDeleteValue((HKEY) m_hKey, (char*) (const char*) szValue); if ( m_dwLastError != ERROR_SUCCESS ) { wxLogSysError(m_dwLastError, _("can't delete value '%s' from key '%s'"), @@ -568,6 +568,10 @@ wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue) #ifdef __WIN32__ bool wxRegKey::SetValue(const char *szValue, long lValue) { +#ifdef __TWIN32__ + wxFAIL_MSG("RegSetValueEx not implemented by TWIN32"); + return FALSE; +#else if ( CONST_CAST Open() ) { m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_DWORD, (RegString)&lValue, sizeof(lValue)); @@ -578,6 +582,7 @@ bool wxRegKey::SetValue(const char *szValue, long lValue) wxLogSysError(m_dwLastError, _("can't set value of '%s'"), GetFullName(this, szValue)); return FALSE; +#endif } bool wxRegKey::QueryValue(const char *szValue, long *plValue) const @@ -646,7 +651,7 @@ bool wxRegKey::QueryValue(const char *szValue, wxString& strValue) const bool wxRegKey::SetValue(const char *szValue, const wxString& strValue) { if ( CONST_CAST Open() ) { - #ifdef __WIN32__ +#if defined( __WIN32__) && !defined(__TWIN32__) m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_SZ, (RegString)strValue.c_str(), strValue.Len() + 1); @@ -697,7 +702,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const if ( lIndex == -1 ) return FALSE; - #ifdef __WIN32__ +#if defined( __WIN32__) && !defined(__TWIN32__) char szValueName[1024]; // @@ use RegQueryInfoKey... DWORD dwValueLen = WXSIZEOF(szValueName); diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index 418477ee81..e81d059ce0 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -49,7 +49,7 @@ wxColour wxSystemSettings::GetSystemColour(int index) wxFont wxSystemSettings::GetSystemFont(int index) { HFONT hFont = (HFONT) ::GetStockObject(index); - if ( hFont != NULL ) + if ( hFont != (HFONT) NULL ) { LOGFONT lf; if ( ::GetObject(hFont, sizeof(LOGFONT), &lf) != 0 ) diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index f572ef6eeb..b06bc4aaaa 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -31,7 +31,7 @@ #include "wx/msw/slider95.h" #include "wx/msw/private.h" -#if defined(__WIN95__) && !defined(__GNUWIN32__) +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif diff --git a/src/msw/spinbutt.cpp b/src/msw/spinbutt.cpp index bb3e75b68d..03657deaa0 100644 --- a/src/msw/spinbutt.cpp +++ b/src/msw/spinbutt.cpp @@ -24,12 +24,15 @@ #include "wx/wx.h" #endif -#if defined(__WIN95__) +// Can't resolve reference to CreateUpDownControl in +// TWIN32, but could probably use normal CreateWindow instead. + +#if defined(__WIN95__) && !defined(__TWIN32__) #include "wx/spinbutt.h" #include "wx/msw/private.h" -#ifndef __GNUWIN32__ +#if !defined(__GNUWIN32__) || defined(__TWIN32__) #include #endif diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index 1499d2463e..a040fbaed1 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -36,7 +36,7 @@ #include #include -#if !defined(__GNUWIN32__) +#if !defined(__GNUWIN32__) || defined(__TWIN32__) #include #endif diff --git a/src/msw/tabctrl.cpp b/src/msw/tabctrl.cpp index 6f0a4dd47f..9537e0fbc9 100644 --- a/src/msw/tabctrl.cpp +++ b/src/msw/tabctrl.cpp @@ -32,13 +32,15 @@ #include -#ifndef __GNUWIN32__ +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif #include "wx/msw/dib.h" #include "wx/msw/tabctrl.h" diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index 809c2b7af8..b34e42e02e 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -28,16 +28,18 @@ #include "wx/utils.h" #endif -#ifdef __WIN95__ +#if defined(__WIN95__) && !defined(__TWIN32__) #include #include #include #include +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include #endif +#endif #ifdef __SALFORDC__ #include diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index fbf1a2848a..d83469d6a6 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -32,13 +32,15 @@ #include -#ifndef __GNUWIN32__ +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif #include "wx/msw/dib.h" #include "wx/tbar95.h" diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 0d1a52dc6f..17cd5ae0c6 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -66,7 +66,13 @@ #include -#if defined(__WIN95__) && !defined(__GNUWIN32__) +#if defined(__WIN95__) && !defined(__TWIN32__) +#define wxUSE_RICHEDIT 1 +#else +#define wxUSE_RICHEDIT 0 +#endif + +#if wxUSE_RICHEDIT && !defined(__GNUWIN32__) #include #endif @@ -152,7 +158,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, msStyle |= ES_PASSWORD; char *windowClass = "EDIT"; -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if ( m_windowStyle & wxTE_MULTILINE ) { msStyle |= ES_AUTOVSCROLL; @@ -168,7 +174,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, // If we're in Win95, and we want a simple 2D border, // then make it an EDIT control instead. -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if (m_windowStyle & wxSIMPLE_BORDER) { windowClass = "EDIT"; @@ -196,7 +202,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, } #endif -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if (m_isRich) { // Have to enable events @@ -244,9 +250,13 @@ void wxTextCtrl::AdoptAttributesFromHWND(void) #else #ifdef UNICODE GetClassNameW((HWND) hWnd, buf, 256); +#else +#ifdef __TWIN32__ + GetClassName((HWND) hWnd, buf, 256); #else GetClassNameA((HWND) hWnd, buf, 256); #endif +#endif #endif wxString str(buf); @@ -394,7 +404,7 @@ void wxTextCtrl::SetInsertionPoint(long pos) { HWND hWnd = (HWND) GetHWND(); #ifdef __WIN32__ -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if ( m_isRich) { CHARRANGE range; @@ -424,7 +434,7 @@ void wxTextCtrl::SetInsertionPointEnd(void) long wxTextCtrl::GetInsertionPoint(void) const { -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if (m_isRich) { CHARRANGE range; @@ -1099,7 +1109,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) // For Rich Edit controls. Do we need it? #if 0 -#if defined(__WIN95__) +#if wxUSE_RICHEDIT bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam) { wxCommandEvent event(0, m_windowId); diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index f33b099016..7673df85ed 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -40,7 +40,7 @@ #include "wx/msw/private.h" -#ifndef __GNUWIN32__ +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) #include #endif diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index c12877f753..a42f71bca7 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -29,6 +29,7 @@ #include "wx/msw/private.h" #include "wx/timer.h" +#include "wx/intl.h" #include @@ -42,7 +43,7 @@ #endif #endif //GNUWIN32 -#ifdef __GNUWIN32__ +#if defined(__GNUWIN32__) && !defined(__TWIN32__) #include #include #endif //GNUWIN32 @@ -135,7 +136,7 @@ static const char eUSERNAME[] = "UserName"; // Get full hostname (eg. DoDo.BSn-Germany.crg.de) bool wxGetHostName(char *buf, int maxSize) { -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) DWORD nSize = maxSize; return (::GetComputerName(buf, &nSize) != 0); #else @@ -154,7 +155,7 @@ bool wxGetHostName(char *buf, int maxSize) // Get user ID e.g. jacs bool wxGetUserId(char *buf, int maxSize) { -#if defined(__WIN32__) && !defined(__win32s__) +#if defined(__WIN32__) && !defined(__win32s__) && !defined(__TWIN32__) // VZ: why should it be so complicated?? #if 0 @@ -288,7 +289,7 @@ wxShell(const wxString& command) // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) long wxGetFreeMemory(void) { -#if defined(__WIN32__) && !defined(__BORLANDC__) +#if defined(__WIN32__) && !defined(__BORLANDC__) && !defined(__TWIN32__) MEMORYSTATUS memStatus; memStatus.dwLength = sizeof(MEMORYSTATUS); GlobalMemoryStatus(&memStatus); @@ -567,7 +568,7 @@ const char* wxGetHomeDir(wxString *pstr) { wxString& strDir = *pstr; - #ifdef __UNIX__ + #if defined(__UNIX__) && !defined(__TWIN32__) const char *szHome = getenv("HOME"); if ( szHome == NULL ) { // we're homeless... @@ -677,7 +678,7 @@ bool wxCheckForInterrupt(wxWindow *wnd) char *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType) { char *s = NULL; -#ifndef __WIN32__ +#if !defined(__WIN32__) || defined(__TWIN32__) HRSRC hResource = ::FindResource(wxGetInstance(), WXSTRINGCAST resourceName, WXSTRINGCAST resourceType); #else #ifdef UNICODE @@ -721,34 +722,34 @@ void wxGetMousePosition( int* x, int* y ) // Return TRUE if we have a colour display bool wxColourDisplay(void) { - HDC dc = ::GetDC(NULL); + HDC dc = ::GetDC((HWND) NULL); bool flag; int noCols = GetDeviceCaps(dc, NUMCOLORS); if ((noCols == -1) || (noCols > 2)) flag = TRUE; else flag = FALSE; - ReleaseDC(NULL, dc); + ReleaseDC((HWND) NULL, dc); return flag; } // Returns depth of screen int wxDisplayDepth(void) { - HDC dc = ::GetDC(NULL); + HDC dc = ::GetDC((HWND) NULL); int planes = GetDeviceCaps(dc, PLANES); int bitsPerPixel = GetDeviceCaps(dc, BITSPIXEL); int depth = planes*bitsPerPixel; - ReleaseDC(NULL, dc); + ReleaseDC((HWND) NULL, dc); return depth; } // Get size of display void wxDisplaySize(int *width, int *height) { - HDC dc = ::GetDC(NULL); + HDC dc = ::GetDC((HWND) NULL); *width = GetDeviceCaps(dc, HORZRES); *height = GetDeviceCaps(dc, VERTRES); - ReleaseDC(NULL, dc); + ReleaseDC((HWND) NULL, dc); } bool wxDirExists(const wxString& dir) @@ -982,7 +983,7 @@ To download dbwin32, see e.g.: http://ftp.digital.com/pub/micro/NT/WinSite/programr/dbwin32.zip */ -#if !defined(__MWERKS__) && !defined(__SALFORDC__) +#if !defined(__MWERKS__) && !defined(__SALFORDC__) && !defined(__TWIN32__) #include #endif @@ -1009,8 +1010,12 @@ void OutputDebugStringW95(const char* lpOutputString, ...) */ #ifdef _UNICODE ::OutputDebugStringW(achBuffer); +#else +#ifdef __TWIN32__ + ::OutputDebugString(achBuffer); #else ::OutputDebugStringA(achBuffer); +#endif #endif /* bail if it's not Win95 */ diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 4cf07e8861..e74411c229 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -41,9 +41,11 @@ #endif #ifdef __GNUWIN32__ +#ifndef __TWIN32__ #include #include #endif +#endif #ifdef __WIN32__ #include @@ -111,7 +113,7 @@ long wxExecute(const wxString& command, bool sync, wxProcess *handler) if (command == "") return 0; -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) char * cl; char * argp; int clen; diff --git a/src/msw/wave.cpp b/src/msw/wave.cpp index 23f09f7c47..805a64fa0e 100644 --- a/src/msw/wave.cpp +++ b/src/msw/wave.cpp @@ -35,9 +35,11 @@ #include #endif +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif +#endif wxWave::wxWave() : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) @@ -50,7 +52,7 @@ wxWave::wxWave(const wxString& sFileName, bool isResource) Create(sFileName, isResource); } -wxWave::wxWave(int size, const byte* data) +wxWave::wxWave(int size, const wxByte* data) : m_waveData(NULL), m_waveLength(0), m_isResource(FALSE) { Create(size, data); @@ -70,7 +72,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_isResource = TRUE; HRSRC hresInfo; -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, "WAVE"); #else hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, "WAVE"); @@ -82,7 +84,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) if (waveData) { - m_waveData= (byte*)::LockResource(waveData); + m_waveData= (wxByte*)::LockResource(waveData); m_waveLength = (int) ::SizeofResource((HMODULE) wxhInstance, hresInfo); } @@ -98,7 +100,7 @@ bool wxWave::Create(const wxString& fileName, bool isResource) m_waveLength = (int) fileWave.Length(); - m_waveData = (byte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); + m_waveData = (wxByte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) return FALSE; @@ -108,12 +110,12 @@ bool wxWave::Create(const wxString& fileName, bool isResource) } } -bool wxWave::Create(int size, const byte* data) +bool wxWave::Create(int size, const wxByte* data) { Free(); m_isResource = FALSE; m_waveLength=size; - m_waveData = (byte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); + m_waveData = (wxByte*)::GlobalLock(::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, m_waveLength)); if (!m_waveData) return FALSE; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 45ca481c75..7df1986533 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -61,9 +61,11 @@ #include #endif +#ifndef __TWIN32__ #ifdef __GNUWIN32__ #include #endif +#endif #ifdef GetCharWidth #undef GetCharWidth @@ -1420,7 +1422,7 @@ void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win) { // adding NULL hWnd is (first) surely a result of an error and // (secondly) breaks menu command processing - wxCHECK_RET( hWnd != NULL, "attempt to add a NULL hWnd to window list" ); + wxCHECK_RET( hWnd != (HWND) NULL, "attempt to add a NULL hWnd to window list" ); if ( !wxWinHandleList->Find((long)hWnd) ) wxWinHandleList->Append((long)hWnd, win); @@ -2963,7 +2965,7 @@ void wxSetKeyboardHook(bool doIt) { wxTheKeyboardHookProc = MakeProcInstance((FARPROC) wxKeyboardHook, wxGetInstance()); wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(), -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__TWIN32__) GetCurrentThreadId()); // (DWORD)GetCurrentProcess()); // This is another possibility. Which is right? #else -- 2.45.2