From dc1efb1d9f4e4ce7d8f889dad3aaab7026b73058 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Thu, 24 Feb 2000 15:04:24 +0000
Subject: [PATCH] Some Motif fixes; makefile fixes; added
 wxTransferStreamToFile/FileToStream for wxWin streams; fixed wxSP_... ids
 that clashed with wxTextCtrl; added generic GetPixel implementation for
 GTK/Motif

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 demos/life/game.cpp                     |   2 +-
 distrib/msw/generic.rsp                 |  24 ++-
 distrib/msw/glcanvas.rsp                |   2 -
 distrib/msw/gtk.rsp                     |   4 +-
 distrib/msw/makefile.rsp                |   9 +-
 distrib/msw/motif.rsp                   |   1 +
 distrib/msw/msw.rsp                     |   1 +
 distrib/msw/ogl.rsp                     |   2 -
 distrib/msw/tex2rtf.rsp                 |   1 -
 docs/motif/issues.txt                   |   2 +
 include/wx/defs.h                       |   9 +-
 include/wx/docview.h                    |   5 +
 include/wx/memory.h                     |   2 +
 samples/wizard/wiztest.cpp              |   8 +-
 samples/wizard/wiztest.def              |   7 +
 src/common/docview.cpp                  |  36 ++++
 src/common/memory.cpp                   |  23 ++-
 src/gtk/dcclient.cpp                    |  14 +-
 src/gtk1/dcclient.cpp                   |  14 +-
 src/html/helpdata.cpp                   |   4 +-
 src/jpeg/makefile.wat                   | 233 ++++++++++++++++++++++++
 src/motif/app.cpp                       |   2 +-
 src/motif/checkbox.cpp                  |   3 +-
 src/motif/dcclient.cpp                  |  17 +-
 src/motif/frame.cpp                     |  68 +++++++
 src/motif/statbmp.cpp                   |   8 +-
 src/msw/dc.cpp                          |   8 +-
 utils/glcanvas/samples/cube/Makefile    |  10 +-
 utils/glcanvas/samples/isosurf/Makefile |   9 +-
 utils/glcanvas/samples/penguin/Makefile |  13 +-
 utils/ogl/samples/ogledit/Makefile      |  39 ++++
 utils/ogl/samples/ogledit/doc.cpp       |  43 ++++-
 utils/ogl/samples/ogledit/doc.h         |  14 +-
 utils/ogl/samples/studio/Makefile       |  57 ++++++
 utils/ogl/samples/studio/symbols.cpp    |   2 +-
 35 files changed, 643 insertions(+), 53 deletions(-)
 create mode 100644 samples/wizard/wiztest.def
 create mode 100644 src/jpeg/makefile.wat
 create mode 100644 utils/ogl/samples/ogledit/Makefile
 create mode 100644 utils/ogl/samples/studio/Makefile

diff --git a/demos/life/game.cpp b/demos/life/game.cpp
index d729a82cea..6178c756a9 100644
--- a/demos/life/game.cpp
+++ b/demos/life/game.cpp
@@ -294,7 +294,7 @@ CellBox* Life::LinkBox(wxInt32 x, wxInt32 y, bool create)
         if ((c->m_x == x) && (c->m_y == y)) return c;
 
     // if not found, and (create == TRUE), create a new one
-    return create? CreateBox(x, y, hv) : NULL;
+    return create? CreateBox(x, y, hv) : (CellBox*) NULL;
 }
 
 // KillBox:
diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp
index cd60163102..08e45c9cd2 100644
--- a/distrib/msw/generic.rsp
+++ b/distrib/msw/generic.rsp
@@ -18,7 +18,6 @@ template.mak
 wx-config.in
 makefile.unx.in
 wxinstall
-Makefile
 descrip.mms
 setup.h_vms
 src/common/descrip.mms
@@ -66,10 +65,8 @@ src/make.env
 src/makeprog.env
 src/makelib.env
 
-src/Makefile
 src/*.inc
 src/mkdir
-src/Makefile
 src/make.env.in
 src/makeprog.env.in
 src/makelib.env.in
@@ -151,7 +148,7 @@ misc/afm/*.afm
 misc/gs_afm/*.afm
 
 utils/*.txt
-utils/make*
+utils/make*.*
 utils/configure
 utils/configure.in
 
@@ -215,7 +212,6 @@ utils/makegen/*.xpm
 utils/makegen/*.txt
 utils/makegen/templates/make*
 
-utils/dialoged/Makefile
 utils/dialoged/src/bitmaps/*.xbm
 utils/dialoged/src/bitmaps/*.xpm
 utils/dialoged/src/*.h
@@ -1002,6 +998,24 @@ samples/calendar/*.ico
 samples/calendar/*.xpm
 samples/calendar/*.txt
 
+samples/statbar/*.cpp
+samples/statbar/*.h
+samples/statbar/makefile*
+samples/statbar/*.rc
+samples/statbar/*.def
+samples/statbar/*.ico
+samples/statbar/*.xpm
+samples/statbar/*.txt
+
+samples/plot/*.cpp
+samples/plot/*.h
+samples/plot/makefile*
+samples/plot/*.rc
+samples/plot/*.def
+samples/plot/*.ico
+samples/plot/*.xpm
+samples/plot/*.txt
+
 samples/exec/*.cpp
 samples/exec/*.h
 samples/exec/makefile*
diff --git a/distrib/msw/glcanvas.rsp b/distrib/msw/glcanvas.rsp
index 12a4744fa4..923fc507bd 100644
--- a/distrib/msw/glcanvas.rsp
+++ b/distrib/msw/glcanvas.rsp
@@ -6,12 +6,10 @@ utils/glcanvas/win/make*.*
 utils/glcanvas/gtk/*.cpp
 utils/glcanvas/gtk/*.h
 utils/glcanvas/gtk/make*.*
-utils/glcanvas/gtk/Makefile
 utils/glcanvas/motif/*.cpp
 utils/glcanvas/motif/*.h
 utils/glcanvas/motif/make*.*
 utils/glcanvas/motif/*.txt
-utils/glcanvas/motif/Makefile
 utils/glcanvas/samples/cube/*.cpp
 utils/glcanvas/samples/cube/*.h
 utils/glcanvas/samples/cube/*.rc
diff --git a/distrib/msw/gtk.rsp b/distrib/msw/gtk.rsp
index 5b4e32b747..25001e7cc2 100644
--- a/distrib/msw/gtk.rsp
+++ b/distrib/msw/gtk.rsp
@@ -1,5 +1,3 @@
-configure
-
 distrib/gtk/copy_src
 distrib/gtk/README.txt
 distrib/gtk/Setup
@@ -14,7 +12,7 @@ include/wx/gtk/*.xpm
 include/install-sh
 include/wx/install-sh
 
-src/gtk/Makefile
+src/gtk/files.lst
 src/gtk/*.cpp
 src/gtk/*.c
 src/gtk/*.inc
diff --git a/distrib/msw/makefile.rsp b/distrib/msw/makefile.rsp
index c8abfe9f2d..481f54a8b1 100644
--- a/distrib/msw/makefile.rsp
+++ b/distrib/msw/makefile.rsp
@@ -1,5 +1,4 @@
 Makefile.in
-src/Makefile
 locale/Makefile
 samples/Makefile.in
 samples/calendar/Makefile.in
@@ -32,6 +31,7 @@ samples/mdi/Makefile.in
 samples/minifram/Makefile.in
 samples/minimal/Makefile.in
 samples/notebook/Makefile.in
+samples/plot/Makefile.in
 samples/printing/Makefile.in
 samples/proplist/Makefile.in
 samples/propsize/Makefile.in
@@ -40,6 +40,7 @@ samples/sashtest/Makefile.in
 samples/scroll/Makefile.in
 samples/scrollsub/Makefile.in
 samples/splitter/Makefile.in
+samples/statbar/Makefile.in
 samples/text/Makefile.in
 samples/thread/Makefile.in
 samples/toolbar/Makefile.in
@@ -57,6 +58,12 @@ demos/fractal/Makefile.in
 demos/poem/Makefile.in
 demos/life/Makefile.in
 utils/glcanvas/motif/Makefile.in
+utils/HelpGen/Makefile.in
+utils/tex2rtf/Makefile.in
+utils/tex2rtf/src/Makefile.in
+utils/dialoged/Makefile.in
+utils/dialoged/src/Makefile.in
+utils/hhp2cached/Makefile.in
 utils/Makefile.in
 utils/wxMMedia2/Makefile.in
 utils/wxMMedia2/lib/Makefile.in
diff --git a/distrib/msw/motif.rsp b/distrib/msw/motif.rsp
index 71b76e4d98..db6bd0600f 100644
--- a/distrib/msw/motif.rsp
+++ b/distrib/msw/motif.rsp
@@ -1,5 +1,6 @@
 src/motif.inc
 
+src/motif/files.lst
 src/motif/*.cpp
 src/motif/*.c
 src/motif/*.h
diff --git a/distrib/msw/msw.rsp b/distrib/msw/msw.rsp
index 4fb8eeb92f..dcdddd05bd 100644
--- a/distrib/msw/msw.rsp
+++ b/distrib/msw/msw.rsp
@@ -53,6 +53,7 @@ src/common/doslex.c
 src/common/y_tab.c
 src/common/lex_yy.c
 
+src/msw/files.lst
 src/msw/*.cpp
 src/msw/*.h
 src/msw/makefile.*
diff --git a/distrib/msw/ogl.rsp b/distrib/msw/ogl.rsp
index 8a742c2744..de8ca90dfd 100644
--- a/distrib/msw/ogl.rsp
+++ b/distrib/msw/ogl.rsp
@@ -1,5 +1,4 @@
 utils/ogl/Makefile.in
-utils/ogl/Makefile
 
 utils/ogl/src/*.cpp
 utils/ogl/src/*.h
@@ -8,7 +7,6 @@ utils/ogl/src/*.def
 utils/ogl/src/*.xbm
 utils/ogl/src/*.xpm
 utils/ogl/src/make*.*
-utils/ogl/src/Makefile
 utils/ogl/src/*.txt
 utils/ogl/src/*.ico
 utils/ogl/src/*.bmp
diff --git a/distrib/msw/tex2rtf.rsp b/distrib/msw/tex2rtf.rsp
index 294535d9d6..5f531b87f0 100644
--- a/distrib/msw/tex2rtf.rsp
+++ b/distrib/msw/tex2rtf.rsp
@@ -1,7 +1,6 @@
 utils/tex2rtf/src/*.cpp
 utils/tex2rtf/src/*.h
 utils/tex2rtf/src/make*.*
-utils/tex2rtf/src/Makefile
 utils/tex2rtf/src/*.xbm
 utils/tex2rtf/src/*.xpm
 utils/tex2rtf/src/*.sty
diff --git a/docs/motif/issues.txt b/docs/motif/issues.txt
index bb4c54218e..743cbdb1e0 100644
--- a/docs/motif/issues.txt
+++ b/docs/motif/issues.txt
@@ -10,4 +10,6 @@ Outstanding issues
 - Should scrollbars take on the background colour? Not right for
   e.g. wxScrolledWindows, so maybe have wxSystemSettings value for
   scrollbar colour, and/or ability to set scrollbar colour independently.
+- wxFrame can accept events, but apps cannot draw into it for some reason,
+  so the rotate sample won't work. Workaround: use an embedded wxWindow.
 
diff --git a/include/wx/defs.h b/include/wx/defs.h
index 5a81d4ac0c..82bfc41fb3 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -1102,12 +1102,15 @@ enum wxStretch
 // #define wxLC_SHOW_SEL_ALWAYS
 
 /*
- * wxSpinButton flags
+ * wxSpinButton flags.
+ * Note that a wxSpinCtrl is sometimes defined as
+ * a wxTextCtrl, and so the flags must be different
+ * from wxTextCtrl's.
  */
 #define wxSP_HORIZONTAL       wxHORIZONTAL // 4
 #define wxSP_VERTICAL         wxVERTICAL   // 8
-#define wxSP_ARROW_KEYS       0x0010
-#define wxSP_WRAP             0x0020
+#define wxSP_ARROW_KEYS       0x1000
+#define wxSP_WRAP             0x2000
 
 /*
  * wxSplitterWindow flags
diff --git a/include/wx/docview.h b/include/wx/docview.h
index b2c0b7dedf..592a7439db 100644
--- a/include/wx/docview.h
+++ b/include/wx/docview.h
@@ -619,6 +619,11 @@ protected:
 // converts from/to a stream to/from a temporary file.
 bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, ostream& stream);
 bool WXDLLEXPORT wxTransferStreamToFile(istream& stream, const wxString& filename);
+#else
+// For compatibility with existing file formats:
+// converts from/to a stream to/from a temporary file.
+bool WXDLLEXPORT wxTransferFileToStream(const wxString& filename, wxOutputStream& stream);
+bool WXDLLEXPORT wxTransferStreamToFile(wxInputStream& stream, const wxString& filename);
 #endif
 
 #endif // _WX_DOCH__
diff --git a/include/wx/memory.h b/include/wx/memory.h
index 21b9545a96..48fb5c449e 100644
--- a/include/wx/memory.h
+++ b/include/wx/memory.h
@@ -196,6 +196,8 @@ protected:
     static int debugLevel;
     static bool debugOn;
 
+	static int m_balign;			// byte alignment
+	static int m_balignmask;		// mask for performing byte alignment
 public:
     // Set a checkpoint to dump only the memory from
     // a given point
diff --git a/samples/wizard/wiztest.cpp b/samples/wizard/wiztest.cpp
index cd078af265..d6f249de35 100644
--- a/samples/wizard/wiztest.cpp
+++ b/samples/wizard/wiztest.cpp
@@ -146,7 +146,13 @@ public:
     wxRadioboxPage(wxWizard *parent) : wxWizardPageSimple(parent)
     {
         // should correspond to the enum above
-        static wxString choices[] = { "forward", "backward", "both", "neither" };
+        //        static wxString choices[] = { "forward", "backward", "both", "neither" };
+        // The above syntax can cause an internal compiler error with gcc.
+        wxString choices[4];
+        choices[0] = "forward";
+        choices[1] = "backward";
+        choices[2] = "both";
+        choices[3] = "neither";
 
         m_radio = new wxRadioBox(this, -1, "Allow to proceed:",
                                  wxPoint(5, 5), wxDefaultSize,
diff --git a/samples/wizard/wiztest.def b/samples/wizard/wiztest.def
new file mode 100644
index 0000000000..f843fd9a98
--- /dev/null
+++ b/samples/wizard/wiztest.def
@@ -0,0 +1,7 @@
+NAME         Wiztest
+DESCRIPTION  'Wiztest wxWindows application'
+EXETYPE      WINDOWS
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4048
+STACKSIZE    16000
diff --git a/src/common/docview.cpp b/src/common/docview.cpp
index 8f693926e5..1f8003aff7 100644
--- a/src/common/docview.cpp
+++ b/src/common/docview.cpp
@@ -2191,6 +2191,42 @@ bool wxTransferStreamToFile(istream& stream, const wxString& filename)
     fclose (fd1);
     return TRUE;
 }
+#else
+bool wxTransferFileToStream(const wxString& filename, wxOutputStream& stream)
+{
+    FILE *fd1;
+    int ch;
+
+    if ((fd1 = fopen (filename.fn_str(), "rb")) == NULL)
+        return FALSE;
+
+    while ((ch = getc (fd1)) != EOF)
+        stream.PutC((char) ch);
+
+    fclose (fd1);
+    return TRUE;
+}
+
+bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
+{
+    FILE *fd1;
+    char ch;
+
+    if ((fd1 = fopen (filename.fn_str(), "wb")) == NULL)
+    {
+        return FALSE;
+    }
+
+    int len = stream.StreamSize();
+    // TODO: is this the correct test for EOF?
+    while (stream.TellI() < (len - 1))
+    {
+        ch = stream.GetC();
+        putc (ch, fd1);
+    }
+    fclose (fd1);
+    return TRUE;
+}
 #endif
 
 #endif // wxUSE_DOC_VIEW_ARCHITECTURE
diff --git a/src/common/memory.cpp b/src/common/memory.cpp
index d30fc10ee8..a67263d476 100644
--- a/src/common/memory.cpp
+++ b/src/common/memory.cpp
@@ -473,6 +473,11 @@ int wxDebugContext::debugLevel = 1;
 bool wxDebugContext::debugOn = TRUE;
 wxMemStruct *wxDebugContext::checkPoint = NULL;
 
+// For faster alignment calculation
+static wxMarkerType markerCalc[2];
+int wxDebugContext::m_balign = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]);
+int wxDebugContext::m_balignmask = (int)((char *)&markerCalc[1] - (char*)&markerCalc[0]) - 1;
+
 wxDebugContext::wxDebugContext(void)
 {
 //  m_streamBuf = new wxDebugStreamBuf;
@@ -596,6 +601,9 @@ char * wxDebugContext::StartPos (const char * caller)
 
   I don't know how portable this stuff is, but it seems to work for me at
   the moment. It would be real nice if I knew more about this!
+
+  // Note: this function is now obsolete (along with CalcAlignment)
+  // because the calculations are done statically, for greater speed.
 */
 size_t wxDebugContext::GetPadding (const size_t size)
 {
@@ -603,11 +611,22 @@ size_t wxDebugContext::GetPadding (const size_t size)
     return (pad) ? sizeof(wxMarkerType) - pad : 0;
 }
 
-
-
 size_t wxDebugContext::PaddedSize (const size_t size)
 {
+    // Added by Terry Farnham <TJRT@pacbell.net> to replace
+    // slow GetPadding call.
+	int padb;
+
+	padb = size & m_balignmask;
+	if(padb)
+		return(size + m_balign - padb);
+	else
+		return(size);
+
+// Old (slow) code
+#if 0
     return size + GetPadding (size);
+#endif
 }
 
 /*
diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp
index 8c72dd103b..84ad260e39 100644
--- a/src/gtk/dcclient.cpp
+++ b/src/gtk/dcclient.cpp
@@ -342,10 +342,18 @@ void wxWindowDC::DoFloodFill( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
     wxFAIL_MSG( wxT("wxWindowDC::DoFloodFill not implemented") );
 }
 
-bool wxWindowDC::DoGetPixel( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
+bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
 {
-    wxFAIL_MSG( wxT("wxWindowDC::DoGetPixel not implemented") );
-    return FALSE;
+    // Generic (and therefore rather inefficient) method.
+    // Could be improved.
+    wxMemoryDC memdc;
+    wxBitmap bitmap(1, 1);
+    memdc.SelectObject(bitmap);
+    memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
+    memdc.SelectObject(wxNullBitmap);
+    wxImage image(bitmap);
+    col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
+    return TRUE;
 }
 
 void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp
index 8c72dd103b..84ad260e39 100644
--- a/src/gtk1/dcclient.cpp
+++ b/src/gtk1/dcclient.cpp
@@ -342,10 +342,18 @@ void wxWindowDC::DoFloodFill( wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
     wxFAIL_MSG( wxT("wxWindowDC::DoFloodFill not implemented") );
 }
 
-bool wxWindowDC::DoGetPixel( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
+bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
 {
-    wxFAIL_MSG( wxT("wxWindowDC::DoGetPixel not implemented") );
-    return FALSE;
+    // Generic (and therefore rather inefficient) method.
+    // Could be improved.
+    wxMemoryDC memdc;
+    wxBitmap bitmap(1, 1);
+    memdc.SelectObject(bitmap);
+    memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
+    memdc.SelectObject(wxNullBitmap);
+    wxImage image(bitmap);
+    col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
+    return TRUE;
 }
 
 void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp
index 7c3616de5f..4e186d55f0 100644
--- a/src/html/helpdata.cpp
+++ b/src/html/helpdata.cpp
@@ -222,7 +222,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
     HP_TagHandler *handler = new HP_TagHandler(book);
     parser.AddTagHandler(handler);
 
-    f = ( contentsfile.IsEmpty() ? NULL : fsys.OpenFile(contentsfile) );
+    f = ( contentsfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(contentsfile) );
     if (f) {
         sz = f -> GetStream() -> GetSize();
         buf = new char[sz + 1];
@@ -237,7 +237,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
     else
         wxLogError(_("Cannot open contents file: %s"), contentsfile.mb_str());
 
-    f = ( indexfile.IsEmpty() ? NULL : fsys.OpenFile(indexfile) );
+    f = ( indexfile.IsEmpty() ? (wxFSFile*) NULL : fsys.OpenFile(indexfile) );
     if (f) {
         sz = f -> GetStream() -> GetSize();
         buf = new char[sz + 1];
diff --git a/src/jpeg/makefile.wat b/src/jpeg/makefile.wat
new file mode 100644
index 0000000000..d953e466f8
--- /dev/null
+++ b/src/jpeg/makefile.wat
@@ -0,0 +1,233 @@
+# Makefile for Independent JPEG Group's software
+
+# This makefile is suitable for Watcom C/C++ 10.0 on MS-DOS (using
+# dos4g extender), OS/2, and Windows NT console mode.
+# Thanks to Janos Haide, jhaide@btrvtech.com.
+
+# Read installation instructions before saying "wmake" !!
+
+# Uncomment line for desired system
+SYSTEM=DOS
+#SYSTEM=OS2
+#SYSTEM=NT
+
+# The name of your C compiler:
+CC= wcl386
+
+# You may need to adjust these cc options:
+CFLAGS= -4r -ort -wx -zq -bt=$(SYSTEM)
+# Caution: avoid -ol or -ox; these generate bad code with 10.0 or 10.0a.
+# Generally, we recommend defining any configuration symbols in jconfig.h,
+# NOT via -D switches here.
+
+# Link-time cc options:
+!ifeq SYSTEM DOS
+LDFLAGS= -zq -l=dos4g
+!else ifeq SYSTEM OS2
+LDFLAGS= -zq -l=os2v2
+!else ifeq SYSTEM NT
+LDFLAGS= -zq -l=nt
+!endif
+
+# Put here the object file name for the correct system-dependent memory
+# manager file.  jmemnobs should work fine for dos4g or OS/2 environment.
+SYSDEPMEM= jmemnobs.obj
+
+# End of configurable options.
+
+
+# source files: JPEG library proper
+LIBSOURCES= jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c jchuff.c &
+        jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c &
+        jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c &
+        jdatadst.c jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c &
+        jdinput.c jdmainct.c jdmarker.c jdmaster.c jdmerge.c jdphuff.c &
+        jdpostct.c jdsample.c jdtrans.c jerror.c jfdctflt.c jfdctfst.c &
+        jfdctint.c jidctflt.c jidctfst.c jidctint.c jidctred.c jquant1.c &
+        jquant2.c jutils.c jmemmgr.c
+# memmgr back ends: compile only one of these into a working library
+SYSDEPSOURCES= jmemansi.c jmemname.c jmemnobs.c jmemdos.c jmemmac.c
+# source files: cjpeg/djpeg/jpegtran applications, also rdjpgcom/wrjpgcom
+APPSOURCES= cjpeg.c djpeg.c jpegtran.c rdjpgcom.c wrjpgcom.c cdjpeg.c &
+        rdcolmap.c rdswitch.c transupp.c rdppm.c wrppm.c rdgif.c wrgif.c &
+        rdtarga.c wrtarga.c rdbmp.c wrbmp.c rdrle.c wrrle.c
+SOURCES= $(LIBSOURCES) $(SYSDEPSOURCES) $(APPSOURCES)
+# files included by source files
+INCLUDES= jchuff.h jdhuff.h jdct.h jerror.h jinclude.h jmemsys.h jmorecfg.h &
+        jpegint.h jpeglib.h jversion.h cdjpeg.h cderror.h transupp.h
+# documentation, test, and support files
+DOCS= README install.doc usage.doc cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 &
+        wrjpgcom.1 wizard.doc example.c libjpeg.doc structure.doc &
+        coderules.doc filelist.doc change.log
+MKFILES= configure makefile.cfg makefile.ansi makefile.unix makefile.bcc &
+        makefile.mc6 makefile.dj makefile.wat makefile.vc makelib.ds &
+        makeapps.ds makeproj.mac makcjpeg.st makdjpeg.st makljpeg.st &
+        maktjpeg.st makefile.manx makefile.sas makefile.mms makefile.vms &
+        makvms.opt
+CONFIGFILES= jconfig.cfg jconfig.bcc jconfig.mc6 jconfig.dj jconfig.wat &
+        jconfig.vc jconfig.mac jconfig.st jconfig.manx jconfig.sas &
+        jconfig.vms
+CONFIGUREFILES= config.guess config.sub install-sh ltconfig ltmain.sh
+OTHERFILES= jconfig.doc ckconfig.c ansi2knr.c ansi2knr.1 jmemdosa.asm
+TESTFILES= testorig.jpg testimg.ppm testimg.bmp testimg.jpg testprog.jpg &
+        testimgp.jpg
+DISTFILES= $(DOCS) $(MKFILES) $(CONFIGFILES) $(SOURCES) $(INCLUDES) &
+        $(CONFIGUREFILES) $(OTHERFILES) $(TESTFILES)
+# library object files common to compression and decompression
+COMOBJECTS= jcomapi.obj jutils.obj jerror.obj jmemmgr.obj $(SYSDEPMEM)
+# compression library object files
+CLIBOBJECTS= jcapimin.obj jcapistd.obj jctrans.obj jcparam.obj jdatadst.obj &
+        jcinit.obj jcmaster.obj jcmarker.obj jcmainct.obj jcprepct.obj &
+        jccoefct.obj jccolor.obj jcsample.obj jchuff.obj jcphuff.obj &
+        jcdctmgr.obj jfdctfst.obj jfdctflt.obj jfdctint.obj
+# decompression library object files
+DLIBOBJECTS= jdapimin.obj jdapistd.obj jdtrans.obj jdatasrc.obj &
+        jdmaster.obj jdinput.obj jdmarker.obj jdhuff.obj jdphuff.obj &
+        jdmainct.obj jdcoefct.obj jdpostct.obj jddctmgr.obj jidctfst.obj &
+        jidctflt.obj jidctint.obj jidctred.obj jdsample.obj jdcolor.obj &
+        jquant1.obj jquant2.obj jdmerge.obj
+# These objectfiles are included in libjpeg.lib
+LIBOBJECTS= $(CLIBOBJECTS) $(DLIBOBJECTS) $(COMOBJECTS)
+# object files for sample applications (excluding library files)
+COBJECTS= cjpeg.obj rdppm.obj rdgif.obj rdtarga.obj rdrle.obj rdbmp.obj &
+        rdswitch.obj cdjpeg.obj
+DOBJECTS= djpeg.obj wrppm.obj wrgif.obj wrtarga.obj wrrle.obj wrbmp.obj &
+        rdcolmap.obj cdjpeg.obj
+TROBJECTS= jpegtran.obj rdswitch.obj cdjpeg.obj transupp.obj
+
+
+all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe
+
+libjpeg.lib: $(LIBOBJECTS)
+	- del libjpeg.lib
+	* wlib -n libjpeg.lib $(LIBOBJECTS)
+
+cjpeg.exe: $(COBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) $(COBJECTS) libjpeg.lib
+
+djpeg.exe: $(DOBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) $(DOBJECTS) libjpeg.lib
+
+jpegtran.exe: $(TROBJECTS) libjpeg.lib
+	$(CC) $(LDFLAGS) $(TROBJECTS) libjpeg.lib
+
+rdjpgcom.exe: rdjpgcom.c
+	$(CC) $(CFLAGS) $(LDFLAGS) rdjpgcom.c
+
+wrjpgcom.exe: wrjpgcom.c
+	$(CC) $(CFLAGS) $(LDFLAGS) wrjpgcom.c
+
+.c.obj:
+	$(CC) $(CFLAGS) -c $<
+
+jconfig.h: jconfig.doc
+	echo You must prepare a system-dependent jconfig.h file.
+	echo Please read the installation directions in install.doc.
+	exit 1
+
+clean: .SYMBOLIC
+	- del *.obj
+	- del libjpeg.lib
+	- del cjpeg.exe
+	- del djpeg.exe
+	- del jpegtran.exe
+	- del rdjpgcom.exe
+	- del wrjpgcom.exe
+	- del testout*.*
+
+test: cjpeg.exe djpeg.exe jpegtran.exe  .SYMBOLIC
+	- del testout*.*
+	djpeg -dct int -ppm -outfile testout.ppm  testorig.jpg
+	djpeg -dct int -bmp -colors 256 -outfile testout.bmp  testorig.jpg
+	cjpeg -dct int -outfile testout.jpg  testimg.ppm
+	djpeg -dct int -ppm -outfile testoutp.ppm testprog.jpg
+	cjpeg -dct int -progressive -opt -outfile testoutp.jpg testimg.ppm
+	jpegtran -outfile testoutt.jpg testprog.jpg
+!ifeq SYSTEM DOS
+	fc /b testimg.ppm testout.ppm
+	fc /b testimg.bmp testout.bmp
+	fc /b testimg.jpg testout.jpg
+	fc /b testimg.ppm testoutp.ppm
+	fc /b testimgp.jpg testoutp.jpg
+	fc /b testorig.jpg testoutt.jpg
+!else
+	echo n > n.tmp
+	comp testimg.ppm testout.ppm < n.tmp
+	comp testimg.bmp testout.bmp < n.tmp
+	comp testimg.jpg testout.jpg < n.tmp
+	comp testimg.ppm testoutp.ppm < n.tmp
+	comp testimgp.jpg testoutp.jpg < n.tmp
+	comp testorig.jpg testoutt.jpg < n.tmp
+	del n.tmp
+!endif
+
+
+jcapimin.obj: jcapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcapistd.obj: jcapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccoefct.obj: jccoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jccolor.obj: jccolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcdctmgr.obj: jcdctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jchuff.obj: jchuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcinit.obj: jcinit.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmainct.obj: jcmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmarker.obj: jcmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcmaster.obj: jcmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcomapi.obj: jcomapi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcparam.obj: jcparam.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcphuff.obj: jcphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jchuff.h
+jcprepct.obj: jcprepct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jcsample.obj: jcsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jctrans.obj: jctrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapimin.obj: jdapimin.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdapistd.obj: jdapistd.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdatadst.obj: jdatadst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdatasrc.obj: jdatasrc.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h
+jdcoefct.obj: jdcoefct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdcolor.obj: jdcolor.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jddctmgr.obj: jddctmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jdhuff.obj: jdhuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdinput.obj: jdinput.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmainct.obj: jdmainct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmarker.obj: jdmarker.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmaster.obj: jdmaster.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdmerge.obj: jdmerge.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdphuff.obj: jdphuff.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdhuff.h
+jdpostct.obj: jdpostct.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdsample.obj: jdsample.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jdtrans.obj: jdtrans.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jerror.obj: jerror.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jversion.h jerror.h
+jfdctflt.obj: jfdctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctfst.obj: jfdctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jfdctint.obj: jfdctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctflt.obj: jidctflt.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctfst.obj: jidctfst.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctint.obj: jidctint.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jidctred.obj: jidctred.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jdct.h
+jquant1.obj: jquant1.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jquant2.obj: jquant2.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jutils.obj: jutils.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h
+jmemmgr.obj: jmemmgr.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemansi.obj: jmemansi.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemname.obj: jmemname.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemnobs.obj: jmemnobs.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemdos.obj: jmemdos.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+jmemmac.obj: jmemmac.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h jmemsys.h
+cjpeg.obj: cjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+djpeg.obj: djpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h jversion.h
+jpegtran.obj: jpegtran.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h transupp.h jversion.h
+rdjpgcom.obj: rdjpgcom.c jinclude.h jconfig.h
+wrjpgcom.obj: wrjpgcom.c jinclude.h jconfig.h
+cdjpeg.obj: cdjpeg.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdcolmap.obj: rdcolmap.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdswitch.obj: rdswitch.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+transupp.obj: transupp.c jinclude.h jconfig.h jpeglib.h jmorecfg.h jpegint.h jerror.h transupp.h
+rdppm.obj: rdppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrppm.obj: wrppm.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdgif.obj: rdgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrgif.obj: wrgif.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdtarga.obj: rdtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrtarga.obj: wrtarga.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdbmp.obj: rdbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrbmp.obj: wrbmp.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+rdrle.obj: rdrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
+wrrle.obj: wrrle.c cdjpeg.h jinclude.h jconfig.h jpeglib.h jmorecfg.h jerror.h cderror.h
diff --git a/src/motif/app.cpp b/src/motif/app.cpp
index 53b01e0f35..67a241c4e4 100644
--- a/src/motif/app.cpp
+++ b/src/motif/app.cpp
@@ -349,7 +349,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
 
     if (event->type == KeyPress)
     {
-#ifdef __WXDEBUG__
+#if 0 // def __WXDEBUG__
         Widget widget = XtWindowToWidget(event->xany.display, event->xany.window);
         wxLogDebug("Got key press event for 0x%08x (parent = 0x%08x)",
                    widget, XtParent(widget));
diff --git a/src/motif/checkbox.cpp b/src/motif/checkbox.cpp
index ac259ac03a..32b1413b6a 100644
--- a/src/motif/checkbox.cpp
+++ b/src/motif/checkbox.cpp
@@ -60,8 +60,9 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
     char* label1 = (label.IsNull() ? "" : (char*) (const char*) label);
     XmString text = XmStringCreateSimple (label1);
 #endif
+    wxString label1(wxStripMenuCodes(label));
 
-    wxXmString text( label );
+    wxXmString text( label1 );
     
     Widget parentWidget = (Widget) parent->GetClientWidget();
     XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp
index aa4970ddef..8c42391326 100644
--- a/src/motif/dcclient.cpp
+++ b/src/motif/dcclient.cpp
@@ -235,11 +235,18 @@ void wxWindowDC::DoFloodFill( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1),
     wxFAIL_MSG("not implemented");
 }
 
-bool wxWindowDC::DoGetPixel( wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
+bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
 {
-    wxFAIL_MSG("not implemented");
-
-    return FALSE;
+    // Generic (and therefore rather inefficient) method.
+    // Could be improved.
+    wxMemoryDC memdc;
+    wxBitmap bitmap(1, 1);
+    memdc.SelectObject(bitmap);
+    memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
+    memdc.SelectObject(wxNullBitmap);
+    wxImage image(bitmap);
+    col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
+    return TRUE;
 }
 
 void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
@@ -1266,7 +1273,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
                 // draw black pixels, ignore white ones (i.e. transparent b/g)
                 if (image.GetRed(sx, sy) == 0)
                 {
-                    DrawPoint(x1 + maxx - rx, cy + y1 - ry);
+                    DrawPoint((wxCoord) (x1 + maxx - rx), (wxCoord) (cy + y1 - ry));
                 }
                 else
                 {
diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp
index 3e4095b159..fac74a74a7 100644
--- a/src/motif/frame.cpp
+++ b/src/motif/frame.cpp
@@ -71,6 +71,10 @@
 // private functions
 // ----------------------------------------------------------------------------
 
+static void wxFrameEventHandler(Widget    wid,
+                             XtPointer WXUNUSED(client_data),
+                             XEvent*   event,
+                             Boolean*  continueToDispatch);
 static void wxCloseFrameCallback(Widget, XtPointer, XmAnyCallbackStruct *cbs);
 static void wxFrameFocusProc(Widget workArea, XtPointer clientData,
                             XmAnyCallbackStruct *cbs);
@@ -235,6 +239,12 @@ bool wxFrame::Create(wxWindow *parent,
     XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
         wxUniversalRepaintProc, (XtPointer) this);
 
+    XtAddEventHandler((Widget) m_clientArea,
+        ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask,
+        FALSE,
+        wxFrameEventHandler,
+        (XtPointer)this);
+
     XtVaSetValues((Widget) m_frameWidget,
         XmNworkWindow, (Widget) m_workArea,
         NULL);
@@ -243,6 +253,7 @@ bool wxFrame::Create(wxWindow *parent,
     XtManageChild((Widget) m_workArea);
 
     wxAddWindowToTable((Widget) m_workArea, this);
+    wxAddWindowToTable((Widget) m_clientArea, this);
 
     XtTranslations ptr;
 
@@ -332,8 +343,14 @@ wxFrame::~wxFrame()
     m_isBeingDeleted = TRUE;
 
     if (m_clientArea)
+    {
       XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, FALSE,
           wxUniversalRepaintProc, (XtPointer) this);
+      XtRemoveEventHandler((Widget) m_clientArea, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask,
+          FALSE,
+          wxFrameEventHandler, (XtPointer) this);
+      wxDeleteWindowFromTable((Widget) m_clientArea);
+    }
 
     if (GetMainWidget())
         Show(FALSE);
@@ -854,3 +871,54 @@ void wxCloseFrameCallback(Widget WXUNUSED(widget), XtPointer client_data, XmAnyC
     frame->GetEventHandler()->ProcessEvent(closeEvent);
 }
 
+static void wxFrameEventHandler(Widget    wid,
+                             XtPointer WXUNUSED(client_data),
+                             XEvent*   event,
+                             Boolean*  continueToDispatch)
+{
+    wxFrame *frame = (wxFrame *)wxGetWindowFromTable(wid);
+    if (frame)
+    {
+        wxMouseEvent wxevent(wxEVT_NULL);
+        if (wxTranslateMouseEvent(wxevent, frame, wid, event))
+        {
+            wxevent.SetEventObject(frame);
+            wxevent.SetId(frame->GetId());
+            frame->GetEventHandler()->ProcessEvent(wxevent);
+        }
+        else
+        {
+            // An attempt to implement OnCharHook by calling OnCharHook first;
+            // if this returns TRUE, set continueToDispatch to False
+            // (don't continue processing).
+            // Otherwise set it to True and call OnChar.
+            wxKeyEvent keyEvent(wxEVT_CHAR);
+            if (wxTranslateKeyEvent(keyEvent, frame, wid, event))
+            {
+                keyEvent.SetEventObject(frame);
+                keyEvent.SetId(frame->GetId());
+                keyEvent.SetEventType(wxEVT_CHAR_HOOK);
+                if (frame->GetEventHandler()->ProcessEvent(keyEvent))
+                {
+                    *continueToDispatch = False;
+                    return;
+                }
+                else
+                {
+                    // For simplicity, OnKeyDown is the same as OnChar
+                    // TODO: filter modifier key presses from OnChar
+                    keyEvent.SetEventType(wxEVT_KEY_DOWN);
+
+                    // Only process OnChar if OnKeyDown didn't swallow it
+                    if (!frame->GetEventHandler()->ProcessEvent (keyEvent))
+                    {
+                        keyEvent.SetEventType(wxEVT_CHAR);
+                        frame->GetEventHandler()->ProcessEvent(keyEvent);
+                    }
+                }
+            }
+        }
+    }
+    *continueToDispatch = True;
+}
+
diff --git a/src/motif/statbmp.cpp b/src/motif/statbmp.cpp
index 9d8c27fd00..3d35638883 100644
--- a/src/motif/statbmp.cpp
+++ b/src/motif/statbmp.cpp
@@ -74,7 +74,13 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id,
     ChangeFont(FALSE);
 
     SetCanAddEventHandler(TRUE);
-    AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y);
+
+    wxSize actualSize(size);
+    if (actualSize.x == -1)
+      actualSize.x = bitmap.GetWidth();
+    if (actualSize.y == -1)
+      actualSize.y = bitmap.GetHeight();
+    AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, actualSize.x, actualSize.y);
 
     ChangeBackgroundColour ();
 
diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp
index 11d5f1aab8..354c617418 100644
--- a/src/msw/dc.cpp
+++ b/src/msw/dc.cpp
@@ -318,12 +318,15 @@ bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
     // get the color of the pixel
     COLORREF pixelcolor = ::GetPixel(GetHdc(), XLOG2DEV(x), YLOG2DEV(y));
 
+    // JACS: what was this for?
+#if 0
     // get the color of the pen
     COLORREF pencolor = 0x00ffffff;
     if (m_pen.Ok())
     {
         pencolor = m_pen.GetColour().GetPixel();
     }
+#endif
 
     // return the color of the pixel
     if( col )
@@ -335,7 +338,10 @@ bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
 
     // check, if color of the pixels is the same as the color of the current
     // pen and return TRUE if it is, FALSE otherwise
-    return pixelcolor == pencolor;
+    // JACS, 24/02/2000: can't understand the reason for this, so returning TRUE instead.
+    // return pixelcolor == pencolor;
+
+    return TRUE;
 }
 
 void wxDC::DoCrossHair(wxCoord x, wxCoord y)
diff --git a/utils/glcanvas/samples/cube/Makefile b/utils/glcanvas/samples/cube/Makefile
index 2b48e8478a..f1e4059dad 100644
--- a/utils/glcanvas/samples/cube/Makefile
+++ b/utils/glcanvas/samples/cube/Makefile
@@ -13,15 +13,19 @@
 #
 
 CC = gcc
+WXCONFIG=../../../../wx-config
+WXINCLUDE=-I../../../../include
+WXLIB=-L../../../../lib
 
 cube: cube.o glcanvas.o
-	$(CC) -o cube cube.o glcanvas.o `wx-config --libs` -lMesaGL -lMesaGLU
+	$(CC) -o cube cube.o glcanvas.o `$(WXCONFIG) --libs` $(WXLIB) -lMesaGL -lMesaGLU
 
 cube.o: cube.cpp
-	$(CC) `wx-config --cflags` -I../../gtk -c cube.cpp
+	$(CC) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c cube.cpp
 
 glcanvas.o: ../../gtk/glcanvas.cpp
-	$(CC) `wx-config --cflags` `gtk-config --cflags` -I../../gtk -c ../../gtk/glcanvas.cpp
+	$(CC) `$(WXCONFIG) --cflags` `gtk-config --cflags` -I../../gtk $(WXINCLUDE) -c ../../gtk/glcanvas.cpp
 
 clean: 
 	rm -f *.o cube
+
diff --git a/utils/glcanvas/samples/isosurf/Makefile b/utils/glcanvas/samples/isosurf/Makefile
index ca096666db..97ba2a59b1 100644
--- a/utils/glcanvas/samples/isosurf/Makefile
+++ b/utils/glcanvas/samples/isosurf/Makefile
@@ -13,17 +13,20 @@
 #
 
 CC = g++
+WXCONFIG=../../../../wx-config
+WXINCLUDE=-I../../../../include
+WXLIB=-L../../../../lib
 
 isosurf: isosurf.o glcanvas.o
 	$(CC) -o isosurf \
 	isosurf.o glcanvas.o \
-	`wx-config --libs` -lMesaGL -lMesaGLU
+	`$(WXCONFIG) --libs` $(WXLIB) -lMesaGL -lMesaGLU
 
 isosurf.o: isosurf.cpp
-	$(CC) `wx-config --cflags` -I../../gtk -c isosurf.cpp
+	$(CC) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c isosurf.cpp
 
 glcanvas.o: ../../gtk/glcanvas.cpp
-	$(CC) `wx-config --cflags` `gtk-config --cflags` -I../../gtk -c ../../gtk/glcanvas.cpp
+	$(CC) `$(WXCONFIG) --cflags` `gtk-config --cflags` -I../../gtk -c $(WXINCLUDE) ../../gtk/glcanvas.cpp
 
 clean: 
 	rm -f *.o isosurf
diff --git a/utils/glcanvas/samples/penguin/Makefile b/utils/glcanvas/samples/penguin/Makefile
index 340df1537f..437f7bc1bb 100644
--- a/utils/glcanvas/samples/penguin/Makefile
+++ b/utils/glcanvas/samples/penguin/Makefile
@@ -14,21 +14,24 @@
 
 CPP = gcc
 CC = gcc
+WXCONFIG=../../../../wx-config
+WXINCLUDE=-I../../../../include
+WXLIB=-L../../../../lib
 
 Penguin: penguin.o trackball.o lw.o glcanvas.o
-	$(CPP) -o Penguin penguin.o trackball.o lw.o glcanvas.o `wx-config --libs` -lMesaGL -lMesaGLU
+	$(CPP) -o Penguin penguin.o trackball.o lw.o glcanvas.o `$(WXCONFIG) --libs` $(WXLIB) -lMesaGL -lMesaGLU
 
 penguin.o: penguin.cpp
-	$(CPP) `wx-config --cflags` -I../../gtk -c penguin.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c penguin.cpp
 
 lw.o: lw.cpp
-	$(CPP) `wx-config --cflags` -I../../gtk -c lw.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c lw.cpp
 
 trackball.o: trackball.c
-	$(CC) `wx-config --cflags` -I../../gtk -c trackball.c
+	$(CC) `$(WXCONFIG) --cflags` -I../../gtk $(WXINCLUDE) -c trackball.c
 
 glcanvas.o: ../../gtk/glcanvas.cpp
-	$(CPP) `wx-config --cflags` `gtk-config --cflags` -g -I../../gtk -c ../../gtk/glcanvas.cpp
+	$(CPP) `$(WXCONFIG) --cflags` `gtk-config --cflags` -g -I../../gtk $(WXINCLUDE) -c ../../gtk/glcanvas.cpp
 
 clean: 
 	rm -f *.o Penguin
diff --git a/utils/ogl/samples/ogledit/Makefile b/utils/ogl/samples/ogledit/Makefile
new file mode 100644
index 0000000000..1ed28860e7
--- /dev/null
+++ b/utils/ogl/samples/ogledit/Makefile
@@ -0,0 +1,39 @@
+#
+# File:		Makefile
+# Author:	Julian Smart
+# Created:	1999
+# Updated:	
+# Copyright:	(c) 2000 Julian Smart
+#
+# Makefile for OGL demo (GTK version)
+#
+# This makefile requires wxWindows/GTK to be 
+# installed (possibly using "make install")
+# on your system.
+#
+
+CPP = gcc
+CC = gcc
+WXCONFIG=../../../../wx-config
+WXINCLUDE=-I../../../../include
+WXLIB=-L../../../../lib
+
+OBJECTS=ogledit.o palette.o doc.o view.o
+
+ogledit: $(OBJECTS)
+	$(CPP) -o ogledit $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
+
+ogledit.o: ogledit.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c ogledit.cpp
+
+palette.o: palette.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c palette.cpp
+
+doc.o: doc.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
+
+view.o: view.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
+
+clean: 
+	rm -f *.o ogledit
diff --git a/utils/ogl/samples/ogledit/doc.cpp b/utils/ogl/samples/ogledit/doc.cpp
index 5e11ad2d05..b5f2ef9e89 100644
--- a/utils/ogl/samples/ogledit/doc.cpp
+++ b/utils/ogl/samples/ogledit/doc.cpp
@@ -28,11 +28,15 @@
 #error You must set wxUSE_DOC_VIEW_ARCHITECTURE to 1 in wx_setup.h!
 #endif
 
+#include <wx/wxexpr.h>
 #include "ogledit.h"
 #include "doc.h"
-#include <wx/wxexpr.h>
 #include "view.h"
 
+#if wxUSE_STD_IOSTREAM
+#include <iostream.h>
+#endif
+
 IMPLEMENT_DYNAMIC_CLASS(DiagramDocument, wxDocument)
 
 DiagramDocument::DiagramDocument(void)
@@ -49,6 +53,7 @@ bool DiagramDocument::OnCloseDocument(void)
   return TRUE;
 }
 
+#if wxUSE_STD_IOSTREAM
 ostream& DiagramDocument::SaveObject(ostream& stream)
 {
   wxDocument::SaveObject(stream);
@@ -79,6 +84,42 @@ istream& DiagramDocument::LoadObject(istream& stream)
 
   return stream;
 }
+#else
+
+wxOutputStream& DiagramDocument::SaveObject(wxOutputStream& stream)
+{
+  wxDocument::SaveObject(stream);
+  char buf[400];
+  (void) wxGetTempFileName("diag", buf);
+
+  diagram.SaveFile(buf);
+
+  wxTransferFileToStream(buf, stream);
+
+  wxRemoveFile(buf);
+  
+
+  return stream;
+}
+
+wxInputStream& DiagramDocument::LoadObject(wxInputStream& stream)
+{
+  wxDocument::LoadObject(stream);
+
+
+  char buf[400];
+  (void) wxGetTempFileName("diag", buf);
+
+  wxTransferStreamToFile(stream, buf);
+
+  diagram.DeleteAllShapes();
+  diagram.LoadFile(buf);
+  wxRemoveFile(buf);
+
+  return stream;
+}
+
+#endif
 
 /*
  * Implementation of drawing command
diff --git a/utils/ogl/samples/ogledit/doc.h b/utils/ogl/samples/ogledit/doc.h
index 968fad13ac..a16ec0bf72 100644
--- a/utils/ogl/samples/ogledit/doc.h
+++ b/utils/ogl/samples/ogledit/doc.h
@@ -22,6 +22,11 @@
 
 #include "ogl.h"
 
+#if wxUSE_STD_IOSTREAM
+class ostream;
+class istream;
+#endif
+
 /*
  * Override a few members for this application
  */
@@ -92,8 +97,13 @@ class DiagramDocument: public wxDocument
   DiagramDocument(void);
   ~DiagramDocument(void);
 
-  ostream& SaveObject(ostream& stream);
-  istream& LoadObject(istream& stream);
+#if wxUSE_STD_IOSTREAM
+    virtual ostream& SaveObject(ostream& stream);
+    virtual istream& LoadObject(istream& stream);
+#else
+    virtual wxOutputStream& SaveObject(wxOutputStream& stream);
+    virtual wxInputStream& LoadObject(wxInputStream& stream);
+#endif
   
   inline wxDiagram *GetDiagram() { return &diagram; }
   
diff --git a/utils/ogl/samples/studio/Makefile b/utils/ogl/samples/studio/Makefile
new file mode 100644
index 0000000000..a576d543ce
--- /dev/null
+++ b/utils/ogl/samples/studio/Makefile
@@ -0,0 +1,57 @@
+#
+# File:		Makefile
+# Author:	Julian Smart
+# Created:	1999
+# Updated:	
+# Copyright:	(c) 2000 Julian Smart
+#
+# Makefile for OGL demo (GTK version)
+#
+# This makefile requires wxWindows/GTK to be 
+# installed (possibly using "make install")
+# on your system.
+#
+
+CPP = gcc
+CC = gcc
+WXCONFIG=../../../../wx-config
+WXINCLUDE=-I../../../../include
+WXLIB=-L../../../../lib
+
+OBJECTS=studio.o cspalette.o csprint.o dialogs.o doc.o mainfrm.o project.o shapes.o symbols.o view.o
+
+studio: $(OBJECTS)
+	$(CPP) -o studio $(OBJECTS) `$(WXCONFIG) --libs` $(WXLIB) -logl
+
+studio.o: studio.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c studio.cpp
+
+cspalette.o: cspalette.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c cspalette.cpp
+
+doc.o: doc.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c doc.cpp
+
+view.o: view.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c view.cpp
+
+dialogs.o: dialogs.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c dialogs.cpp
+
+mainfrm.o: mainfrm.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c mainfrm.cpp
+
+project.o: project.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c project.cpp
+
+shapes.o: shapes.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c shapes.cpp
+
+symbols.o: symbols.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c symbols.cpp
+
+csprint.o: csprint.cpp
+	$(CPP) `$(WXCONFIG) --cflags` -I../../src $(WXINCLUDE) -c csprint.cpp
+
+clean: 
+	rm -f *.o studio
diff --git a/utils/ogl/samples/studio/symbols.cpp b/utils/ogl/samples/studio/symbols.cpp
index 52ee3a0a59..6a422c0702 100644
--- a/utils/ogl/samples/studio/symbols.cpp
+++ b/utils/ogl/samples/studio/symbols.cpp
@@ -189,9 +189,9 @@ wxBitmap* csSymbolDatabase::CreateToolBitmap(csSymbol* symbol)
     double centreX = (double)((objectBitmapSize/scaleFactor)/2.0)-1;
     double centreY = centreX;
 
+    memDC.SelectObject(*newBitmap);
     memDC.SetUserScale(scaleFactor, scaleFactor);
 
-    memDC.SelectObject(*newBitmap);
     memDC.SetBackground(wxBrush(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE), wxSOLID));
     memDC.Clear();
     symbol->GetShape()->Show(TRUE);
-- 
2.50.0

