From 7f555861b7e50f335c7b929bb76be38e9ebd69c5 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Wed, 16 Sep 1998 21:52:23 +0000
Subject: [PATCH] Made wxStubs compile on Unix. Improvements to doc/view on
 MDI, including multiple menus for wxFileHistory. Added wxDirExists to wxMSW;
 moved wxMatchWild to filefn.cpp

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 distrib/msw/generic.rsp      |  28 +++--
 docs/latex/wx/docmanag.tex   |  46 ++++++--
 docs/latex/wx/document.tex   |   4 +
 docs/latex/wx/filehist.tex   |  65 ++++++++---
 docs/latex/wx/menu.tex       |  12 +++
 docs/latex/wx/strlist.tex    |   6 ++
 include/wx/defs.h            |   1 +
 include/wx/docview.h         |  44 ++++++--
 include/wx/msw/app.h         |   2 +-
 include/wx/msw/control.h     |   2 +-
 include/wx/msw/metafile.h    |   6 +-
 include/wx/msw/window.h      |   1 +
 include/wx/msw/wx.rc         |   2 +-
 include/wx/stubs/app.h       |   2 +-
 include/wx/stubs/bitmap.h    |   4 +-
 include/wx/stubs/control.h   |   2 +-
 include/wx/stubs/pen.h       |   4 +-
 include/wx/stubs/setup.h     |   4 +-
 include/wx/stubs/textctrl.h  |   4 +-
 include/wx/stubs/window.h    |  11 +-
 include/wx/zstream.h         |   2 +-
 samples/minimal/makefile.unx |  16 +++
 src/common/docmdi.cpp        |   5 +-
 src/common/docview.cpp       | 144 +++++++++++++++++++------
 src/common/filefn.cpp        | 157 +++++++++++++++++++++++++++
 src/common/socket.cpp        |   6 ++
 src/common/zstream.cpp       |   4 +-
 src/generic/listctrl.cpp     |  36 +++----
 src/gtk/utilsgtk.cpp         | 156 ---------------------------
 src/gtk1/utilsgtk.cpp        | 156 ---------------------------
 src/make.env                 | 121 +++++++++++++++++++++
 src/makeprog.env             |  11 ++
 src/msw/metafile.cpp         |  22 ++--
 src/msw/utils.cpp            | 193 +++++++++++++++++++++++++++++++++
 src/stubs.inc                | 201 +++++++++++++++++++++++++++++++++++
 src/stubs/app.cpp            |  14 +++
 src/stubs/dialog.cpp         |   3 +
 src/stubs/dnd.cpp            |  12 +--
 src/stubs/makefile.unx       | 199 ++++++++++++++++++++++++++++++++++
 src/stubs/notebook.cpp       |   4 +-
 src/stubs/print.cpp          |  10 +-
 src/stubs/slider.cpp         |   5 +
 src/stubs/textctrl.cpp       |   2 -
 43 files changed, 1265 insertions(+), 464 deletions(-)
 create mode 100644 samples/minimal/makefile.unx
 create mode 100644 src/make.env
 create mode 100644 src/makeprog.env
 create mode 100644 src/stubs.inc
 create mode 100644 src/stubs/makefile.unx

diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp
index d05047be27..b21b78523a 100644
--- a/distrib/msw/generic.rsp
+++ b/distrib/msw/generic.rsp
@@ -321,15 +321,25 @@ samples/ipc/*.xpm
 samples/ipc/*.ico
 samples/ipc/*.rc
 
-samples/types/*.cpp
-samples/types/*.h
-samples/types/*.def
-samples/types/*.rc
-samples/types/*.txt
-samples/types/makefile*
-samples/types/*.xbm
-samples/types/*.xpm
-samples/types/*.ico
+samples/typetest/*.cpp
+samples/typetest/*.h
+samples/typetest/*.def
+samples/typetest/*.rc
+samples/typetest/*.txt
+samples/typetest/makefile*
+samples/typetest/*.xbm
+samples/typetest/*.xpm
+samples/typetest/*.ico
+
+samples/sashtest/*.cpp
+samples/sashtest/*.h
+samples/sashtest/*.def
+samples/sashtest/*.rc
+samples/sashtest/*.txt
+samples/sashtest/makefile*
+samples/sashtest/*.xbm
+samples/sashtest/*.xpm
+samples/sashtest/*.ico
 
 samples/resource/*.cpp
 samples/resource/*.h
diff --git a/docs/latex/wx/docmanag.tex b/docs/latex/wx/docmanag.tex
index 1cfbfbe0b7..19eaa58a66 100644
--- a/docs/latex/wx/docmanag.tex
+++ b/docs/latex/wx/docmanag.tex
@@ -12,7 +12,7 @@ and \helpref{wxDocTemplate}{wxdoctemplate} classes.
 \wxheading{See also}
 
 \helpref{wxDocManager overview}{wxdocmanageroverview}, \helpref{wxDocument}{wxdocument},\rtfsp
-\helpref{wxView}{wxview}, \helpref{wxDocTemplate}{wxdoctemplate}
+\helpref{wxView}{wxview}, \helpref{wxDocTemplate}{wxdoctemplate}, \helpref{wxFileHistory}{wxfilehistory}
 
 \latexignore{\rtfignore{\wxheading{Members}}}
 
@@ -139,28 +139,54 @@ of view is presented to the user.
 
 Removes the template from the list of templates.
 
-\membersection{wxDocManager::FileHistoryLoad}
+\membersection{wxDocManager::FileHistoryAddFilesToMenu}\label{wxdocmanagerfilehistoryaddfilestomenu}
 
-\func{void}{FileHistoryLoad}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
+\func{void}{FileHistoryAddFilesToMenu}{\void}
 
-Loads the file history from a resource file, using the given section. This must be called
-explicitly by the application.
+Appends the files in the history list, to all menus managed by the file history object.
+
+\func{void}{FileHistoryAddFilesToMenu}{\param{wxMenu*}{ menu}}
+
+Appends the files in the history list, to the given menu only.
+
+\membersection{wxDocManager::FileHistoryLoad}\label{wxdocmanagerfilehistoryload}
+
+\func{void}{FileHistoryLoad}{\param{wxConfigBase\& }{config}}
+
+Loads the file history from a config object.
+
+\wxheading{See also}
 
-\membersection{wxDocManager::FileHistorySave}
+\helpref{wxConfig}{wxconfigbase}
 
-\func{void}{FileHistorySave}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
+\membersection{wxDocManager::FileHistoryRemoveMenu}\label{wxdocmanagerfilehistoryremovemenu}
 
-Saves the file history into a resource file, using the given section. This must be called
+\func{void}{FileHistoryRemoveMenu}{\param{wxMenu*}{ menu}}
+
+Removes the given menu from the list of menus managed by the file history object.
+
+\membersection{wxDocManager::FileHistorySave}\label{wxdocmanagerfilehistorysave}
+
+\func{void}{FileHistorySave}{\param{wxConfigBase\& }{resourceFile}}
+
+Saves the file history into a config object. This must be called
 explicitly by the application.
 
-\membersection{wxDocManager::FileHistoryUseMenu}
+\wxheading{See also}
+
+\helpref{wxConfig}{wxconfigbase}
 
-\func{void}{FileHistoryUseMenu}{\param{wxMenu *}{menu}}
+\membersection{wxDocManager::FileHistoryUseMenu}\label{wxdocmanagerfilehistoryusemenu}
+
+\func{void}{FileHistoryUseMenu}{\param{wxMenu*}{ menu}}
 
 Use this menu for appending recently-visited document filenames, for convenient
 access. Calling this function with a valid menu pointer enables the history
 list functionality.
 
+Note that you can add multiple menus using this function, to be managed by the
+file history object.
+
 \membersection{wxDocManager::FindTemplateForPath}
 
 \func{wxDocTemplate *}{FindTemplateForPath}{\param{const wxString\& }{path}}
diff --git a/docs/latex/wx/document.tex b/docs/latex/wx/document.tex
index 99a4553c03..a5b7e6b077 100644
--- a/docs/latex/wx/document.tex
+++ b/docs/latex/wx/document.tex
@@ -324,4 +324,8 @@ Sets the title for this document. The document title is used for an associated
 frame (if any), and is usually constructed by the framework from
 the filename.
 
+\membersection{wxDocument::UpdateAllViews}\label{wxdocumentupdateallviews}
 
+\func{void}{UpdateAllViews}{\param{wxView* }{sender = NULL}}
+
+Updates all views. If {\it sender} is non-NULL, does not update this view.
diff --git a/docs/latex/wx/filehist.tex b/docs/latex/wx/filehist.tex
index e136f1c6d8..1d9001be31 100644
--- a/docs/latex/wx/filehist.tex
+++ b/docs/latex/wx/filehist.tex
@@ -3,13 +3,17 @@
 The wxFileHistory encapsulates a user interface convenience, the
 list of most recently visited files as shown on a menu (usually the File menu).
 
+wxFileHistory can manage one or more file menus. More than one menu may be required
+in an MDI application, where the file history should appear on each MDI child menu
+as well as the MDI parent frame.
+
 \wxheading{Derived from}
 
 \helpref{wxObject}{wxobject}
 
 \wxheading{See also}
 
-\overview{wxFileHistory overview}{wxfilehistoryoverview}
+\helpref{wxFileHistory overview}{wxfilehistoryoverview}, \helpref{wxDocManager}{wxdocmanager}
 
 \latexignore{\rtfignore{\wxheading{Members}}}
 
@@ -56,38 +60,65 @@ Destructor.
 
 Adds a file to the file history list, if the object has a pointer to an appropriate file menu.
 
-\membersection{wxFileHistory::FileHistoryLoad}
-
-\func{void}{FileHistoryLoad}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
+\membersection{wxFileHistory::AddFilesToMenu}\label{wxfilehistoryaddfilestomenu}
 
-Loads the file history from a resource file, using the given section. This must be called
-explicitly by the application.
+\func{void}{AddFilesToMenu}{\void}
 
-\membersection{wxFileHistory::FileHistorySave}
+Appends the files in the history list, to all menus managed by the file history object.
 
-\func{void}{FileHistorySave}{\param{const wxString\& }{resourceFile}, \param{const wxString\& }{sectionName}}
+\func{void}{AddFilesToMenu}{\param{wxMenu*}{ menu}}
 
-Saves the file history into a resource file, using the given section. This must be called
-explicitly by the application.
+Appends the files in the history list, to the given menu only.
 
-\membersection{wxFileHistory::FileHistoryUseMenu}
+\membersection{wxFileHistory::GetHistoryFile}\label{wxfilehistorygethistoryfile}
 
-\func{void}{FileHistoryUseMenu}{\param{wxMenu* }{menu}}
+\constfunc{wxString}{GetHistoryFile}{\param{int}{ index}}
 
-Use this menu for appending recently-visited document filenames, for convenient
-access. Calling this function with a valid menu pointer enables the history
-list functionality.
+Returns the file at this index (zero-based).
 
 \membersection{wxFileHistory::GetMaxFiles}
 
-\func{int}{GetMaxFiles}{\void}
+\constfunc{int}{GetMaxFiles}{\void}
 
 Returns the maximum number of files that can be stored.
 
 \membersection{wxFileHistory::GetNoHistoryFiles}
 
-\func{int}{GetNoHistoryFiles}{\void}
+\constfunc{int}{GetNoHistoryFiles}{\void}
 
 Returns the number of files currently stored in the file history.
 
+\membersection{wxFileHistory::Load}
+
+\func{void}{Load}{\param{wxConfigBase\& }{config}}
+
+Loads the file history from the given config object. This function should be called explicitly by the application.
+
+\wxheading{See also}
+
+\helpref{wxConfig}{wxconfigbase}
+
+\membersection{wxFileHistory::RemoveMenu}
+
+\func{void}{RemoveMenu}{\param{wxMenu* }{menu}}
+
+Removes this menu from the list of those managed by this object.
+
+\membersection{wxFileHistory::Save}
+
+\func{void}{Save}{\param{wxConfigBase\& }{config}}
+
+Saves the file history into the given config object. This must be called
+explicitly by the application.
+
+\wxheading{See also}
+
+\helpref{wxConfig}{wxconfigbase}
+
+\membersection{wxFileHistory::UseMenu}
+
+\func{void}{UseMenu}{\param{wxMenu* }{menu}}
+
+Adds this menu to the list of those managed by this object.
+
 
diff --git a/docs/latex/wx/menu.tex b/docs/latex/wx/menu.tex
index c39660ccbf..8d2b277cf5 100644
--- a/docs/latex/wx/menu.tex
+++ b/docs/latex/wx/menu.tex
@@ -525,6 +525,18 @@ Use only after the menubar has been associated with a frame.
 
 \helpref{wxMenuBar::SetLabelTop}{wxmenubarsetlabeltop}
 
+\membersection{wxMenuBar::GetMenu}\label{wxmenubargetmenu}
+
+\constfunc{wxMenu*}{GetMenu}{\param{int}{ menuIndex}}
+
+Returns the menu at {\it menuIndex} (zero-based).
+
+\membersection{wxMenuBar::GetMenuCount}\label{wxmenubargetmenucount}
+
+\constfunc{int}{GetMenuCount}{\void}
+
+Returns the number of menus in this menubar.
+
 \membersection{wxMenuBar::IsChecked}\label{wxmenubarischecked}
 
 \constfunc{bool}{IsChecked}{\param{int}{ id}}
diff --git a/docs/latex/wx/strlist.tex b/docs/latex/wx/strlist.tex
index 0c45fe457e..6488e8a3c8 100644
--- a/docs/latex/wx/strlist.tex
+++ b/docs/latex/wx/strlist.tex
@@ -39,6 +39,12 @@ Deletes string list, deallocating strings.
 
 Adds string to list, allocating memory.
 
+\membersection{wxStringList::Clear}
+
+\func{void}{Clear}{\void}
+
+Clears all strings from the list.
+
 \membersection{wxStringList::Delete}
 
 \func{void}{Delete}{\param{const wxString\& }{s}}
diff --git a/include/wx/defs.h b/include/wx/defs.h
index c4ff0facb3..0cbd0e9eff 100644
--- a/include/wx/defs.h
+++ b/include/wx/defs.h
@@ -824,6 +824,7 @@ enum {
 #define wxID_PASTE              5032
 #define wxID_CLEAR              5033
 #define wxID_FIND               5034
+#define wxID_DUPLICATE          5035
 
 #define wxID_FILE1              5050
 #define wxID_FILE2              5051
diff --git a/include/wx/docview.h b/include/wx/docview.h
index 008929ec76..6bc84b0f0a 100644
--- a/include/wx/docview.h
+++ b/include/wx/docview.h
@@ -34,6 +34,7 @@ class WXDLLEXPORT wxPrintInfo;
 class WXDLLEXPORT wxCommand;
 class WXDLLEXPORT wxCommandProcessor;
 class WXDLLEXPORT wxFileHistory;
+class WXDLLEXPORT wxConfigBase;
 
 class WXDLLIMPORT ostream;
 class WXDLLIMPORT istream;
@@ -332,8 +333,11 @@ class WXDLLEXPORT wxDocManager: public wxEvtHandler
   virtual int GetNoHistoryFiles(void) const;
   virtual wxString GetHistoryFile(int i) const;
   virtual void FileHistoryUseMenu(wxMenu *menu);
-  virtual void FileHistoryLoad(const wxString& resourceFile, const wxString& section);
-  virtual void FileHistorySave(const wxString& resourceFile, const wxString& section);
+  virtual void FileHistoryRemoveMenu(wxMenu *menu);
+  virtual void FileHistoryLoad(wxConfigBase& config);
+  virtual void FileHistorySave(wxConfigBase& config);
+  virtual void FileHistoryAddFilesToMenu();
+  virtual void FileHistoryAddFilesToMenu(wxMenu* menu);
  protected:
   long              m_flags;
   int               m_defaultDocumentNameCounter;
@@ -465,7 +469,8 @@ class WXDLLEXPORT wxCommandProcessor: public wxObject
   virtual bool Submit(wxCommand *command, bool storeIt = TRUE);
   virtual bool Undo(void);
   virtual bool Redo(void);
-  virtual bool CanUndo(void);
+  virtual bool CanUndo(void) const;
+  virtual bool CanRedo(void) const;
 
   // Call this to manage an edit menu.
   inline void SetEditMenu(wxMenu *menu) { m_commandEditMenu = menu; }
@@ -484,6 +489,8 @@ class WXDLLEXPORT wxCommandProcessor: public wxObject
   wxMenu*       m_commandEditMenu;
 };
 
+// File history management
+
 class WXDLLEXPORT wxFileHistory: public wxObject
 {
   DECLARE_DYNAMIC_CLASS(wxFileHistory)
@@ -491,21 +498,36 @@ class WXDLLEXPORT wxFileHistory: public wxObject
   wxFileHistory(int maxFiles = 9);
   ~wxFileHistory(void);
 
-  // File history management
+// Operations
   virtual void AddFileToHistory(const wxString& file);
-  inline virtual int GetNoHistoryFiles(void) const { return m_fileHistoryN; }
-  virtual wxString GetHistoryFile(int i) const;
   virtual int GetMaxFiles(void) const { return m_fileMaxFiles; }
-  virtual void FileHistoryUseMenu(wxMenu *menu);
-  virtual void FileHistoryLoad(const wxString& resourceFile, const wxString& section);
-  virtual void FileHistorySave(const wxString& resourceFile, const wxString& section);
+  virtual void UseMenu(wxMenu *menu);
+
+  // Remove menu from the list (MDI child may be closing)
+  virtual void RemoveMenu(wxMenu *menu);
+
+  virtual void Load(wxConfigBase& config);
+  virtual void Save(wxConfigBase& config);
+
+  virtual void AddFilesToMenu();
+  virtual void AddFilesToMenu(wxMenu* menu); // Single menu
+
+// Accessors
+  virtual wxString GetHistoryFile(int i) const;
+
+  // A synonym for GetNoHistoryFiles
+  virtual int GetCount() const { return m_fileHistoryN; }
+  inline int GetNoHistoryFiles(void) const { return m_fileHistoryN; }
+
+  inline wxList& GetMenus() const { return (wxList&) m_fileMenus; }
+
  protected:
   // Last n files
   char**            m_fileHistory;
   // Number of files saved
   int               m_fileHistoryN;
-  // Menu to maintain
-  wxMenu*           m_fileMenu;
+  // Menus to maintain (may need several for an MDI app)
+  wxList            m_fileMenus;
   // Max files to maintain
   int               m_fileMaxFiles;
 };
diff --git a/include/wx/msw/app.h b/include/wx/msw/app.h
index 0889410bf6..f5c3d40607 100644
--- a/include/wx/msw/app.h
+++ b/include/wx/msw/app.h
@@ -57,7 +57,7 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
   virtual bool Pending() ;
   virtual void Dispatch() ;
 
-  virtual void OnIdle(wxIdleEvent& event);
+  void OnIdle(wxIdleEvent& event);
 
 // Generic
   virtual bool OnInit() { return FALSE; };
diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h
index 495799bf32..7516125e92 100644
--- a/include/wx/msw/control.h
+++ b/include/wx/msw/control.h
@@ -28,7 +28,7 @@ public:
    wxControl(void);
    ~wxControl(void);
 
-   virtual void Command(wxCommandEvent& WXUNUSED(event)) = 0;        // Simulates an event
+   virtual void Command(wxCommandEvent& WXUNUSED(event)) {};        // Simulates an event
    virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
                                                                  // appropriate event handlers
    virtual void SetClientSize(int width, int height);
diff --git a/include/wx/msw/metafile.h b/include/wx/msw/metafile.h
index 993e8738fa..60d3c1db50 100644
--- a/include/wx/msw/metafile.h
+++ b/include/wx/msw/metafile.h
@@ -71,9 +71,9 @@ class WXDLLEXPORT wxMetaFileDC: public wxDC
   // Should be called at end of drawing
   virtual wxMetaFile *Close(void);
   virtual void SetMapMode(int mode);
-  virtual void GetTextExtent(const wxString& string, float *x, float *y,
-                     float *descent = NULL, float *externalLeading = NULL,
-                     wxFont *theFont = NULL, bool use16bit = FALSE);
+  virtual void GetTextExtent(const wxString& string, long *x, long *y,
+                     long *descent = NULL, long *externalLeading = NULL,
+                     wxFont *theFont = NULL, bool use16bit = FALSE) const;
 
   // Implementation
   inline wxMetaFile *GetMetaFile(void) { return m_metaFile; }
diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h
index 716be46606..d47ad0e97d 100644
--- a/include/wx/msw/window.h
+++ b/include/wx/msw/window.h
@@ -403,6 +403,7 @@ public:
   // Does this window want to accept keyboard focus?
   virtual bool AcceptsFocus() const;
 
+  virtual void PrepareDC( wxDC &dc ) {};
 public:
   ////////////////////////////////////////////////////////////////////////
   //// IMPLEMENTATION
diff --git a/include/wx/msw/wx.rc b/include/wx/msw/wx.rc
index 9bbc41a3ed..a3877551d7 100644
--- a/include/wx/msw/wx.rc
+++ b/include/wx/msw/wx.rc
@@ -67,7 +67,7 @@ BEGIN
     BEGIN
         MENUITEM "&Cascade",                    4002
         MENUITEM "&Tile",                       4001
-        MENUITEM "&Arrange icons",              4003
+        MENUITEM "&Arrange Icons",              4003
         MENUITEM "&Next",                       4004
     END
 END
diff --git a/include/wx/stubs/app.h b/include/wx/stubs/app.h
index 3b1467fec5..948e6b4fe6 100644
--- a/include/wx/stubs/app.h
+++ b/include/wx/stubs/app.h
@@ -59,7 +59,7 @@ class WXDLLEXPORT wxApp: public wxEvtHandler
   virtual bool Pending() ;
   virtual void Dispatch() ;
 
-  virtual void OnIdle(wxIdleEvent& event);
+  void OnIdle(wxIdleEvent& event);
 
 // Generic
   virtual bool OnInit() { return FALSE; };
diff --git a/include/wx/stubs/bitmap.h b/include/wx/stubs/bitmap.h
index 195944f835..0b1efd764e 100644
--- a/include/wx/stubs/bitmap.h
+++ b/include/wx/stubs/bitmap.h
@@ -161,10 +161,10 @@ public:
   void SetQuality(int q);
   void SetOk(bool isOk);
 
-  inline wxPalette* GetPalette() const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : NULL); }
+  inline wxPalette* GetPalette() const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : (wxPalette*) NULL); }
   void SetPalette(const wxPalette& palette);
 
-  inline wxMask *GetMask() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_bitmapMask : NULL); }
+  inline wxMask *GetMask() 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; }
diff --git a/include/wx/stubs/control.h b/include/wx/stubs/control.h
index 5432b5c5e7..c75756a72a 100644
--- a/include/wx/stubs/control.h
+++ b/include/wx/stubs/control.h
@@ -28,7 +28,7 @@ public:
    wxControl();
    ~wxControl();
 
-   virtual void Command(wxCommandEvent& WXUNUSED(event)) = 0;        // Simulates an event
+   virtual void Command(wxCommandEvent& WXUNUSED(event)) {};        // Simulates an event
    virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
                                                                  // appropriate event handlers
    virtual void SetLabel(const wxString& label);
diff --git a/include/wx/stubs/pen.h b/include/wx/stubs/pen.h
index da7b165e38..2d0aa7b846 100644
--- a/include/wx/stubs/pen.h
+++ b/include/wx/stubs/pen.h
@@ -85,10 +85,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); };
 
 // Implementation
 
diff --git a/include/wx/stubs/setup.h b/include/wx/stubs/setup.h
index dc99dbf74b..864edf23a9 100644
--- a/include/wx/stubs/setup.h
+++ b/include/wx/stubs/setup.h
@@ -17,6 +17,8 @@
  *
  */
 
+#define USE_CONSTRAINTS       1
+                                // Use constraints mechanism
 #define USE_CONFIG           1
                                 // Use wxConfig, with CreateConfig in wxApp
 #define _WX_GOODCOMPILER__
@@ -92,7 +94,7 @@
 #define USE_C_MAIN 0
                                   // Set to 1 to use main.c instead of main.cpp (UNIX only)
 
-#define USE_ODBC                   1
+#define USE_ODBC                   0
                                     // Define 1 to use ODBC classes
 
 #define USE_IOSTREAMH     1
diff --git a/include/wx/stubs/textctrl.h b/include/wx/stubs/textctrl.h
index 7c3d7b1ac2..2ed500aafe 100644
--- a/include/wx/stubs/textctrl.h
+++ b/include/wx/stubs/textctrl.h
@@ -122,8 +122,8 @@ public:
   // callbacks
   // ---------
   void OnDropFiles(wxDropFilesEvent& event);
-  void OnChar(wxKeyEvent& event); // Process 'enter' if required
-  void OnEraseBackground(wxEraseEvent& event);
+//  void OnChar(wxKeyEvent& event); // Process 'enter' if required
+//  void OnEraseBackground(wxEraseEvent& event);
   
   // Implementation
   // --------------
diff --git a/include/wx/stubs/window.h b/include/wx/stubs/window.h
index 541dd58040..6e87206d56 100644
--- a/include/wx/stubs/window.h
+++ b/include/wx/stubs/window.h
@@ -334,12 +334,6 @@ public:
   virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL);
 #endif
 
-  // Native resource loading
-  virtual bool LoadNativeDialog(wxWindow* parent, wxWindowID& id);
-  virtual bool LoadNativeDialog(wxWindow* parent, const wxString& name);
-  virtual wxWindow* GetWindowChild1(wxWindowID& id);
-  virtual wxWindow* GetWindowChild(wxWindowID& id);
-
   virtual void GetTextExtent(const wxString& string, int *x, int *y,
                              int *descent = NULL,
                              int *externalLeading = NULL,
@@ -376,6 +370,9 @@ public:
   // Does this window want to accept keyboard focus?
   virtual bool AcceptsFocus() const;
 
+  virtual void PrepareDC( wxDC &dc ) {};
+
+
 public:
   ////////////////////////////////////////////////////////////////////////
   //// IMPLEMENTATION
@@ -501,7 +498,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 m_children; }
 inline wxFont *wxWindow::GetFont() const { return (wxFont *) & m_windowFont; }
 inline wxString wxWindow::GetName() const { return m_windowName; }
diff --git a/include/wx/zstream.h b/include/wx/zstream.h
index 6d68c5fc75..3f2de88380 100644
--- a/include/wx/zstream.h
+++ b/include/wx/zstream.h
@@ -16,7 +16,7 @@
 #endif
 
 #include <wx/stream.h>
-#include "../zlib/zlib.h"
+#include "../zlib/zlib.h"   // don't change this, Robert
 
 class wxZlibInputStream: public wxFilterInputStream {
  public:
diff --git a/samples/minimal/makefile.unx b/samples/minimal/makefile.unx
new file mode 100644
index 0000000000..7365f9c19c
--- /dev/null
+++ b/samples/minimal/makefile.unx
@@ -0,0 +1,16 @@
+#
+# File:		makefile.unx
+# Author:	Julian Smart
+# Created:	1998
+# Updated:	
+# Copyright:	(c) 1998 Julian Smart
+#
+# "%W% %G%"
+#
+# Makefile for minimal example (UNIX).
+
+include ../../src/makeprog.env
+
+PROGRAM=minimal
+
+OBJECTS=$(PROGRAM).o
diff --git a/src/common/docmdi.cpp b/src/common/docmdi.cpp
index ecb7b1504c..a0de68f3d4 100644
--- a/src/common/docmdi.cpp
+++ b/src/common/docmdi.cpp
@@ -108,9 +108,6 @@ wxDocMDIChildFrame::~wxDocMDIChildFrame(void)
 // Extend event processing to search the view's event table
 bool wxDocMDIChildFrame::ProcessEvent(wxEvent& event)
 {
-    if (m_childView)
-        m_childView->Activate(TRUE);
-
 	if ( !m_childView || ! m_childView->ProcessEvent(event) )
     {
         // Only hand up to the parent if it's a menu command
@@ -127,7 +124,7 @@ void wxDocMDIChildFrame::OnActivate(wxActivateEvent& event)
 {
   wxMDIChildFrame::OnActivate(event);
 
-  if (m_childView)
+  if (event.GetActive() && m_childView)
     m_childView->Activate(event.GetActive());
 }
 
diff --git a/src/common/docview.cpp b/src/common/docview.cpp
index cec8525fab..b54ea6d75b 100644
--- a/src/common/docview.cpp
+++ b/src/common/docview.cpp
@@ -48,6 +48,7 @@
 #include "wx/printdlg.h"
 #include "wx/generic/prntdlgg.h"
 #include "wx/generic/printps.h"
+#include "wx/confbase.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -290,6 +291,7 @@ bool wxDocument::OnOpenDocument(const wxString& file)
   }
   SetFilename(file, TRUE);
   Modify(FALSE);
+  m_savedYet = TRUE;
 
   UpdateAllViews();
   
@@ -1059,19 +1061,37 @@ wxString wxDocManager::GetHistoryFile(int i) const
 void wxDocManager::FileHistoryUseMenu(wxMenu *menu)
 {
   if (m_fileHistory)
-    m_fileHistory->FileHistoryUseMenu(menu);
+    m_fileHistory->UseMenu(menu);
 }
 
-void wxDocManager::FileHistoryLoad(const wxString& resourceFile, const wxString& section)
+void wxDocManager::FileHistoryRemoveMenu(wxMenu *menu)
 {
   if (m_fileHistory)
-    m_fileHistory->FileHistoryLoad(resourceFile, section);
+    m_fileHistory->RemoveMenu(menu);
 }
 
-void wxDocManager::FileHistorySave(const wxString& resourceFile, const wxString& section)
+void wxDocManager::FileHistoryLoad(wxConfigBase& config)
 {
   if (m_fileHistory)
-    m_fileHistory->FileHistorySave(resourceFile, section);
+    m_fileHistory->Load(config);
+}
+
+void wxDocManager::FileHistorySave(wxConfigBase& config)
+{
+  if (m_fileHistory)
+    m_fileHistory->Save(config);
+}
+
+void wxDocManager::FileHistoryAddFilesToMenu(wxMenu* menu)
+{
+  if (m_fileHistory)
+    m_fileHistory->AddFilesToMenu(menu);
+}
+
+void wxDocManager::FileHistoryAddFilesToMenu()
+{
+  if (m_fileHistory)
+    m_fileHistory->AddFilesToMenu();
 }
 
 int wxDocManager::GetNoHistoryFiles(void) const
@@ -1610,13 +1630,18 @@ bool wxCommandProcessor::Redo(void)
   return FALSE;
 }
 
-bool wxCommandProcessor::CanUndo(void)
+bool wxCommandProcessor::CanUndo(void) const
 {
   if (m_currentCommand)
     return ((wxCommand *)m_currentCommand->Data())->CanUndo();
   return FALSE;
 }
 
+bool wxCommandProcessor::CanRedo(void) const
+{
+  return ((m_currentCommand && m_currentCommand->Next()));
+}
+
 void wxCommandProcessor::Initialize(void)
 {
   m_currentCommand = m_commands.Last();
@@ -1704,7 +1729,6 @@ void wxCommandProcessor::ClearCommands(void)
 wxFileHistory::wxFileHistory(int maxFiles)
 {
   m_fileMaxFiles = maxFiles;
-  m_fileMenu = (wxMenu *) NULL;
   m_fileHistoryN = 0;
   m_fileHistory = new char *[m_fileMaxFiles];
 }
@@ -1720,18 +1744,14 @@ wxFileHistory::~wxFileHistory(void)
 // File history management
 void wxFileHistory::AddFileToHistory(const wxString& file)
 {
-  if (!m_fileMenu)
-    return;
-    
   int i;
-
   // Check we don't already have this file
   for (i = 0; i < m_fileHistoryN; i++)
   {
-    if (m_fileHistory[i] && wxString(m_fileHistory[i]) == file)
-      return;
+      if (m_fileHistory[i] && wxString(m_fileHistory[i]) == file)
+          return;
   }
-  
+
   // Add to the project file history:
   // Move existing files (if any) down so we can insert file at beginning.
   
@@ -1743,9 +1763,15 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
   }
   if (m_fileHistoryN < m_fileMaxFiles)
   {
-    if (m_fileHistoryN == 0)
-      m_fileMenu->AppendSeparator();
-    m_fileMenu->Append(wxID_FILE1+m_fileHistoryN, _("[EMPTY]"));
+    wxNode* node = m_fileMenus.First();
+    while (node)
+    {
+        wxMenu* menu = (wxMenu*) node->Data();
+        if (m_fileHistoryN == 0)
+            menu->AppendSeparator();
+        menu->Append(wxID_FILE1+m_fileHistoryN, _("[EMPTY]"));
+        node = node->Next();
+    }
     m_fileHistoryN ++;
   }
   // Shuffle filenames down
@@ -1760,7 +1786,13 @@ void wxFileHistory::AddFileToHistory(const wxString& file)
     {
       char buf[400];
       sprintf(buf, "&%d %s", i+1, m_fileHistory[i]);
-      m_fileMenu->SetLabel(wxID_FILE1+i, buf);
+      wxNode* node = m_fileMenus.First();
+      while (node)
+      {
+        wxMenu* menu = (wxMenu*) node->Data();
+        menu->SetLabel(wxID_FILE1+i, buf);
+        node = node->Next();
+      }
     }
 }
 
@@ -1772,40 +1804,84 @@ wxString wxFileHistory::GetHistoryFile(int i) const
     return wxString("");
 }
 
-void wxFileHistory::FileHistoryUseMenu(wxMenu *menu)
+void wxFileHistory::UseMenu(wxMenu *menu)
 {
-  m_fileMenu = menu;
+  if (!m_fileMenus.Member(menu))
+    m_fileMenus.Append(menu);
 }
 
-void wxFileHistory::FileHistoryLoad(const wxString& resourceFile, const wxString& section)
+void wxFileHistory::RemoveMenu(wxMenu *menu)
+{
+  m_fileMenus.DeleteObject(menu);
+}
+
+void wxFileHistory::Load(wxConfigBase& config)
 {
-#if USE_RESOURCES
   m_fileHistoryN = 0;
   char buf[400];
   sprintf(buf, "file%d", m_fileHistoryN+1);
-  char *historyFile = (char *) NULL;
-  while ((m_fileHistoryN <= m_fileMaxFiles) && wxGetResource(section, buf, &historyFile, resourceFile) && historyFile)
+  wxString historyFile("");
+  while ((m_fileHistoryN <= m_fileMaxFiles) && config.Read(buf, &historyFile) && (historyFile != ""))
   {
-    // wxGetResource allocates memory so this is o.k.
-    m_fileHistory[m_fileHistoryN] = historyFile;
+    m_fileHistory[m_fileHistoryN] = copystring((const char*) historyFile);
     m_fileHistoryN ++;
     sprintf(buf, "file%d", m_fileHistoryN+1);
-    historyFile = (char *) NULL;
+    historyFile = "";
   }
-#endif
+  AddFilesToMenu();
 }
 
-void wxFileHistory::FileHistorySave(const wxString& resourceFile, const wxString& section)
+void wxFileHistory::Save(wxConfigBase& config)
 {
-#if USE_RESOURCES
-  char buf[400];
   int i;
   for (i = 0; i < m_fileHistoryN; i++)
   {
-    sprintf(buf, "file%d", i+1);
-    wxWriteResource(section, buf, m_fileHistory[i], resourceFile);
+    wxString buf;
+    buf.Printf("file%d", i+1);
+    config.Write(buf, wxString(m_fileHistory[i]));
   }
-#endif
+}
+
+void wxFileHistory::AddFilesToMenu()
+{
+    if (m_fileHistoryN > 0)
+    {
+        wxNode* node = m_fileMenus.First();
+        while (node)
+        {
+            wxMenu* menu = (wxMenu*) node->Data();
+            menu->AppendSeparator();
+            int i;
+            for (i = 0; i < m_fileHistoryN; i++)
+            {
+                if (m_fileHistory[i])
+                {
+                    wxString buf;
+                    buf.Printf("&%d %s", i+1, m_fileHistory[i]);
+                    menu->Append(wxID_FILE1+i, buf);
+                }
+            }
+            node = node->Next();
+        }
+    }
+}
+
+void wxFileHistory::AddFilesToMenu(wxMenu* menu)
+{
+    if (m_fileHistoryN > 0)
+    {
+        menu->AppendSeparator();
+        int i;
+        for (i = 0; i < m_fileHistoryN; i++)
+        {
+            if (m_fileHistory[i])
+            {
+                wxString buf;
+                buf.Printf("&%d %s", i+1, m_fileHistory[i]);
+                menu->Append(wxID_FILE1+i, buf);
+            }
+        }
+    }
 }
 
 #if 0
diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp
index d0a65e01ec..52af1f7b4c 100644
--- a/src/common/filefn.cpp
+++ b/src/common/filefn.cpp
@@ -1371,3 +1371,160 @@ void WXDLLEXPORT wxSplitPath(const char *pszFileName,
       pstrExt->Empty();
   }
 }
+
+//------------------------------------------------------------------------
+// wild character routines
+//------------------------------------------------------------------------
+
+bool wxIsWild( const wxString& pattern )
+{
+  wxString tmp = pattern;
+  char *pat = WXSTRINGCAST(tmp);
+    while (*pat) {
+	switch (*pat++) {
+	case '?': case '*': case '[': case '{':
+	    return TRUE;
+	case '\\':
+	    if (!*pat++)
+		return FALSE;
+	}
+    }
+    return FALSE;
+};
+
+
+bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
+{
+  wxString tmp1 = pat;
+  char *pattern = WXSTRINGCAST(tmp1);
+  wxString tmp2 = text;
+  char *str = WXSTRINGCAST(tmp2);
+    char c;
+    char *cp;
+    bool done = FALSE, ret_code, ok;
+    // Below is for vi fans
+    const char OB = '{', CB = '}';
+
+    // dot_special means '.' only matches '.'
+    if (dot_special && *str == '.' && *pattern != *str)
+	return FALSE;
+
+    while ((*pattern != '\0') && (!done)
+    && (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
+	switch (*pattern) {
+	case '\\':
+	    pattern++;
+	    if (*pattern != '\0')
+		pattern++;
+	    break;
+	case '*':
+	    pattern++;
+	    ret_code = FALSE;
+	    while ((*str!='\0')
+	    && (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
+		/*loop*/;
+	    if (ret_code) {
+		while (*str != '\0')
+		    str++;
+		while (*pattern != '\0')
+		    pattern++;
+	    }
+	    break;
+	case '[':
+	    pattern++;
+	  repeat:
+	    if ((*pattern == '\0') || (*pattern == ']')) {
+		done = TRUE;
+		break;
+	    }
+	    if (*pattern == '\\') {
+		pattern++;
+		if (*pattern == '\0') {
+		    done = TRUE;
+		    break;
+		}
+	    }
+	    if (*(pattern + 1) == '-') {
+		c = *pattern;
+		pattern += 2;
+		if (*pattern == ']') {
+		    done = TRUE;
+		    break;
+		}
+		if (*pattern == '\\') {
+		    pattern++;
+		    if (*pattern == '\0') {
+			done = TRUE;
+			break;
+		    }
+		}
+		if ((*str < c) || (*str > *pattern)) {
+		    pattern++;
+		    goto repeat;
+		}
+	    } else if (*pattern != *str) {
+		pattern++;
+		goto repeat;
+	    }
+	    pattern++;
+	    while ((*pattern != ']') && (*pattern != '\0')) {
+		if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
+		    pattern++;
+		pattern++;
+	    }
+	    if (*pattern != '\0') {
+		pattern++, str++;
+	    }
+	    break;
+	case '?':
+	    pattern++;
+	    str++;
+	    break;
+	case OB:
+	    pattern++;
+	    while ((*pattern != CB) && (*pattern != '\0')) {
+		cp = str;
+		ok = TRUE;
+		while (ok && (*cp != '\0') && (*pattern != '\0')
+		&&  (*pattern != ',') && (*pattern != CB)) {
+		    if (*pattern == '\\')
+			pattern++;
+		    ok = (*pattern++ == *cp++);
+		}
+		if (*pattern == '\0') {
+		    ok = FALSE;
+		    done = TRUE;
+		    break;
+		} else if (ok) {
+		    str = cp;
+		    while ((*pattern != CB) && (*pattern != '\0')) {
+			if (*++pattern == '\\') {
+			    if (*++pattern == CB)
+				pattern++;
+			}
+		    }
+		} else {
+		    while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
+			if (*++pattern == '\\') {
+                            if (*++pattern == CB || *pattern == ',')
+				pattern++;
+			}
+		    }
+		}
+		if (*pattern != '\0')
+		    pattern++;
+	    }
+	    break;
+	default:
+	    if (*str == *pattern) {
+		str++, pattern++;
+	    } else {
+		done = TRUE;
+	    }
+	}
+    }
+    while (*pattern == '*')
+	pattern++;
+    return ((*str == '\0') && (*pattern == '\0'));
+};
+
diff --git a/src/common/socket.cpp b/src/common/socket.cpp
index da261af97d..53ddde5e89 100644
--- a/src/common/socket.cpp
+++ b/src/common/socket.cpp
@@ -31,6 +31,9 @@
 #include <wx/timer.h>
 #include <wx/utils.h>
 
+// Not enough OS behaviour defined for wxStubs
+#ifndef __WXSTUBS__
+
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -1537,3 +1540,6 @@ HWND wxSocketHandler::GetHWND() const
 }
 
 #endif
+
+#endif
+  // __WXSTUBS__
diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp
index 569401fdce..d2b33bc0e0 100644
--- a/src/common/zstream.cpp
+++ b/src/common/zstream.cpp
@@ -41,7 +41,7 @@ wxZlibInputStream::wxZlibInputStream(wxInputStream& stream)
 
   m_inflate.zalloc = (alloc_func)0;
   m_inflate.zfree = (free_func)0;
-  m_inflate.opaque = (voidpf)0;
+  m_inflate.opaque = (void*)0;
 
   err = inflateInit(&m_inflate);
   if (err != Z_OK) {
@@ -107,7 +107,7 @@ wxZlibOutputStream::wxZlibOutputStream(wxOutputStream& stream)
 
   m_deflate.zalloc = (alloc_func)0;
   m_deflate.zfree = (free_func)0;
-  m_deflate.opaque = (voidpf)0;
+  m_deflate.opaque = (void*)0;
 
   err = deflateInit(&m_deflate, Z_DEFAULT_COMPRESSION);
   if (err != Z_OK) {
diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp
index a5e2c19778..957a697493 100644
--- a/src/generic/listctrl.cpp
+++ b/src/generic/listctrl.cpp
@@ -542,7 +542,7 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
 	if (hilight)
 	  dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
 	else
-          dc->SetTextForeground( info->GetColour() );
+          dc->SetTextForeground( * info->GetColour() );
       dc->DrawText( s, info->GetX()+2, info->GetY() );
       dc->DestroyClippingRegion();
       node = node->Next();
@@ -565,7 +565,7 @@ void wxListLineData::DoDraw( wxPaintDC *dc, bool hilight, bool paintBG )
 	if (hilight)
 	  dc->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
 	else
-          dc->SetTextForeground( item->GetColour() );
+          dc->SetTextForeground( * item->GetColour() );
         dc->DrawText( s, m_bound_label.x, m_bound_label.y );
       }
     }
@@ -978,9 +978,9 @@ void wxListMainWindow::HilightAll( bool on )
 
 void wxListMainWindow::ActivateLine( wxListLineData *line )
 {
-  if (!m_parent) return;
-  wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, m_parent->GetId() );
-  le.SetEventObject( m_parent );
+  if (!GetParent()) return;
+  wxListEvent le( wxEVT_COMMAND_LIST_KEY_DOWN, GetParent()->GetId() );
+  le.SetEventObject( GetParent() );
   le.m_code = 0;
   le.m_itemIndex = GetIndexOfLine( line );
   le.m_col = 0;
@@ -990,9 +990,9 @@ void wxListMainWindow::ActivateLine( wxListLineData *line )
 
 void wxListMainWindow::SendNotify( wxListLineData *line, wxEventType command )
 {
-  if (!m_parent) return;
-  wxListEvent le( command, m_parent->GetId() );
-  le.SetEventObject( m_parent );
+  if (!GetParent()) return;
+  wxListEvent le( command, GetParent()->GetId() );
+  le.SetEventObject( GetParent() );
   le.m_code = 0;
   le.m_itemIndex = GetIndexOfLine( line );
   le.m_col = 0;
@@ -1032,10 +1032,10 @@ void wxListMainWindow::StartLabelEdit( wxListLineData *line )
 
 void wxListMainWindow::RenameLine( wxListLineData *line, const wxString &newName )
 {
-  if (!m_parent) return;
+  if (!GetParent()) return;
   
-  wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, m_parent->GetId() );
-  le.SetEventObject( m_parent );
+  wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
+  le.SetEventObject( GetParent() );
   le.m_code = 0;
   le.m_itemIndex = GetIndexOfLine( line );
   le.m_col = 0;
@@ -1087,7 +1087,7 @@ void wxListMainWindow::OnRenameAccept()
 
 void wxListMainWindow::OnMouse( wxMouseEvent &event )
 {
-  if (m_parent->ProcessEvent( event)) return;
+  if (GetParent()->ProcessEvent( event)) return;
 
   if (!m_current) return;
   if (m_dirty) return;
@@ -1117,7 +1117,7 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
   if (event.Dragging() && (m_dragCount > 3))
   {
     m_dragCount = 0;
-    wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, m_parent->GetId() );
+    wxListEvent le( wxEVT_COMMAND_LIST_BEGIN_DRAG, GetParent()->GetId() );
     le.SetEventObject( this );
     le.m_code = 0;
     le.m_itemIndex = 0;
@@ -1398,11 +1398,11 @@ void wxListMainWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
   m_hasFocus = TRUE;
   RefreshLine( m_current );
   
-  if (!m_parent) return;
+  if (!GetParent()) return;
   
-  wxFocusEvent event( wxEVT_SET_FOCUS, m_parent->GetId() );
-  event.SetEventObject( m_parent );
-  m_parent->ProcessEvent( event );
+  wxFocusEvent event( wxEVT_SET_FOCUS, GetParent()->GetId() );
+  event.SetEventObject( GetParent() );
+  GetParent()->ProcessEvent( event );
 }
 
 void wxListMainWindow::OnKillFocus( wxFocusEvent &WXUNUSED(event) )
@@ -2054,7 +2054,7 @@ void wxListMainWindow::SortItems( wxListCtrlCompare fn, long data )
 
 bool wxListMainWindow::OnListNotify( wxListEvent &event )
 {
-  if (m_parent) m_parent->ProcessEvent( event );
+  if (GetParent()) GetParent()->ProcessEvent( event );
   return FALSE;
 }
 
diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp
index 25210a4e0b..4a6dbc728d 100644
--- a/src/gtk/utilsgtk.cpp
+++ b/src/gtk/utilsgtk.cpp
@@ -198,162 +198,6 @@ bool wxDirExists( const wxString& dir )
   return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
 };
 
-//------------------------------------------------------------------------
-// wild character routines
-//------------------------------------------------------------------------
-
-bool wxIsWild( const wxString& pattern )
-{
-  wxString tmp = pattern;
-  char *pat = WXSTRINGCAST(tmp);
-    while (*pat) {
-	switch (*pat++) {
-	case '?': case '*': case '[': case '{':
-	    return TRUE;
-	case '\\':
-	    if (!*pat++)
-		return FALSE;
-	}
-    }
-    return FALSE;
-};
-
-
-bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
-{
-  wxString tmp1 = pat;
-  char *pattern = WXSTRINGCAST(tmp1);
-  wxString tmp2 = text;
-  char *str = WXSTRINGCAST(tmp2);
-    char c;
-    char *cp;
-    bool done = FALSE, ret_code, ok;
-    // Below is for vi fans
-    const char OB = '{', CB = '}';
-
-    // dot_special means '.' only matches '.'
-    if (dot_special && *str == '.' && *pattern != *str)
-	return FALSE;
-
-    while ((*pattern != '\0') && (!done)
-    && (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
-	switch (*pattern) {
-	case '\\':
-	    pattern++;
-	    if (*pattern != '\0')
-		pattern++;
-	    break;
-	case '*':
-	    pattern++;
-	    ret_code = FALSE;
-	    while ((*str!='\0')
-	    && (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
-		/*loop*/;
-	    if (ret_code) {
-		while (*str != '\0')
-		    str++;
-		while (*pattern != '\0')
-		    pattern++;
-	    }
-	    break;
-	case '[':
-	    pattern++;
-	  repeat:
-	    if ((*pattern == '\0') || (*pattern == ']')) {
-		done = TRUE;
-		break;
-	    }
-	    if (*pattern == '\\') {
-		pattern++;
-		if (*pattern == '\0') {
-		    done = TRUE;
-		    break;
-		}
-	    }
-	    if (*(pattern + 1) == '-') {
-		c = *pattern;
-		pattern += 2;
-		if (*pattern == ']') {
-		    done = TRUE;
-		    break;
-		}
-		if (*pattern == '\\') {
-		    pattern++;
-		    if (*pattern == '\0') {
-			done = TRUE;
-			break;
-		    }
-		}
-		if ((*str < c) || (*str > *pattern)) {
-		    pattern++;
-		    goto repeat;
-		}
-	    } else if (*pattern != *str) {
-		pattern++;
-		goto repeat;
-	    }
-	    pattern++;
-	    while ((*pattern != ']') && (*pattern != '\0')) {
-		if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
-		    pattern++;
-		pattern++;
-	    }
-	    if (*pattern != '\0') {
-		pattern++, str++;
-	    }
-	    break;
-	case '?':
-	    pattern++;
-	    str++;
-	    break;
-	case OB:
-	    pattern++;
-	    while ((*pattern != CB) && (*pattern != '\0')) {
-		cp = str;
-		ok = TRUE;
-		while (ok && (*cp != '\0') && (*pattern != '\0')
-		&&  (*pattern != ',') && (*pattern != CB)) {
-		    if (*pattern == '\\')
-			pattern++;
-		    ok = (*pattern++ == *cp++);
-		}
-		if (*pattern == '\0') {
-		    ok = FALSE;
-		    done = TRUE;
-		    break;
-		} else if (ok) {
-		    str = cp;
-		    while ((*pattern != CB) && (*pattern != '\0')) {
-			if (*++pattern == '\\') {
-			    if (*++pattern == CB)
-				pattern++;
-			}
-		    }
-		} else {
-		    while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
-			if (*++pattern == '\\') {
-                            if (*++pattern == CB || *pattern == ',')
-				pattern++;
-			}
-		    }
-		}
-		if (*pattern != '\0')
-		    pattern++;
-	    }
-	    break;
-	default:
-	    if (*str == *pattern) {
-		str++, pattern++;
-	    } else {
-		done = TRUE;
-	    }
-	}
-    }
-    while (*pattern == '*')
-	pattern++;
-    return ((*str == '\0') && (*pattern == '\0'));
-};
-
 //------------------------------------------------------------------------
 // subprocess routines
 //------------------------------------------------------------------------
diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp
index 25210a4e0b..4a6dbc728d 100644
--- a/src/gtk1/utilsgtk.cpp
+++ b/src/gtk1/utilsgtk.cpp
@@ -198,162 +198,6 @@ bool wxDirExists( const wxString& dir )
   return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
 };
 
-//------------------------------------------------------------------------
-// wild character routines
-//------------------------------------------------------------------------
-
-bool wxIsWild( const wxString& pattern )
-{
-  wxString tmp = pattern;
-  char *pat = WXSTRINGCAST(tmp);
-    while (*pat) {
-	switch (*pat++) {
-	case '?': case '*': case '[': case '{':
-	    return TRUE;
-	case '\\':
-	    if (!*pat++)
-		return FALSE;
-	}
-    }
-    return FALSE;
-};
-
-
-bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
-{
-  wxString tmp1 = pat;
-  char *pattern = WXSTRINGCAST(tmp1);
-  wxString tmp2 = text;
-  char *str = WXSTRINGCAST(tmp2);
-    char c;
-    char *cp;
-    bool done = FALSE, ret_code, ok;
-    // Below is for vi fans
-    const char OB = '{', CB = '}';
-
-    // dot_special means '.' only matches '.'
-    if (dot_special && *str == '.' && *pattern != *str)
-	return FALSE;
-
-    while ((*pattern != '\0') && (!done)
-    && (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
-	switch (*pattern) {
-	case '\\':
-	    pattern++;
-	    if (*pattern != '\0')
-		pattern++;
-	    break;
-	case '*':
-	    pattern++;
-	    ret_code = FALSE;
-	    while ((*str!='\0')
-	    && (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
-		/*loop*/;
-	    if (ret_code) {
-		while (*str != '\0')
-		    str++;
-		while (*pattern != '\0')
-		    pattern++;
-	    }
-	    break;
-	case '[':
-	    pattern++;
-	  repeat:
-	    if ((*pattern == '\0') || (*pattern == ']')) {
-		done = TRUE;
-		break;
-	    }
-	    if (*pattern == '\\') {
-		pattern++;
-		if (*pattern == '\0') {
-		    done = TRUE;
-		    break;
-		}
-	    }
-	    if (*(pattern + 1) == '-') {
-		c = *pattern;
-		pattern += 2;
-		if (*pattern == ']') {
-		    done = TRUE;
-		    break;
-		}
-		if (*pattern == '\\') {
-		    pattern++;
-		    if (*pattern == '\0') {
-			done = TRUE;
-			break;
-		    }
-		}
-		if ((*str < c) || (*str > *pattern)) {
-		    pattern++;
-		    goto repeat;
-		}
-	    } else if (*pattern != *str) {
-		pattern++;
-		goto repeat;
-	    }
-	    pattern++;
-	    while ((*pattern != ']') && (*pattern != '\0')) {
-		if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
-		    pattern++;
-		pattern++;
-	    }
-	    if (*pattern != '\0') {
-		pattern++, str++;
-	    }
-	    break;
-	case '?':
-	    pattern++;
-	    str++;
-	    break;
-	case OB:
-	    pattern++;
-	    while ((*pattern != CB) && (*pattern != '\0')) {
-		cp = str;
-		ok = TRUE;
-		while (ok && (*cp != '\0') && (*pattern != '\0')
-		&&  (*pattern != ',') && (*pattern != CB)) {
-		    if (*pattern == '\\')
-			pattern++;
-		    ok = (*pattern++ == *cp++);
-		}
-		if (*pattern == '\0') {
-		    ok = FALSE;
-		    done = TRUE;
-		    break;
-		} else if (ok) {
-		    str = cp;
-		    while ((*pattern != CB) && (*pattern != '\0')) {
-			if (*++pattern == '\\') {
-			    if (*++pattern == CB)
-				pattern++;
-			}
-		    }
-		} else {
-		    while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
-			if (*++pattern == '\\') {
-                            if (*++pattern == CB || *pattern == ',')
-				pattern++;
-			}
-		    }
-		}
-		if (*pattern != '\0')
-		    pattern++;
-	    }
-	    break;
-	default:
-	    if (*str == *pattern) {
-		str++, pattern++;
-	    } else {
-		done = TRUE;
-	    }
-	}
-    }
-    while (*pattern == '*')
-	pattern++;
-    return ((*str == '\0') && (*pattern == '\0'));
-};
-
 //------------------------------------------------------------------------
 // subprocess routines
 //------------------------------------------------------------------------
diff --git a/src/make.env b/src/make.env
new file mode 100644
index 0000000000..a5a1a2d4a1
--- /dev/null
+++ b/src/make.env
@@ -0,0 +1,121 @@
+# generic.env
+# Linux/generic
+#
+# Common makefile settings for wxWindows programs
+# This file is included by all the other makefiles, thus changes 
+# made here take effect everywhere (except where overriden).
+#
+# An alternative to editing this file is to create a shell script
+# to export specific variables, and call make with the -e switch
+# to override makefile variables. See wx/install/install.txt.
+# And you can override specific variables on the make command line, e.g.
+#
+# make -f makefile.unix DEBUG=''
+#
+# You may prefer to use the GNU configure script than raw makefiles -
+# see contrib/wxshlib.
+#
+
+########################### Programs #################################
+
+# Replace this with your own path if necessary
+WXDIR       = /home/jacs/wx2
+
+# C++ compiler
+CC          = g++
+
+# C compiler
+CCC         = gcc
+
+# Compiler for lex/yacc .c programs
+CCLEX       = $(CCC)
+
+LEX         = lex
+YACC        = yacc
+MAKE        = make
+AROPTIONS   = ruv
+RANLIB      = ranlib
+
+############################ Switches #################################
+
+# Debug/trace mode. 1 or more for debugging.
+DEBUG       = 0
+GUI         = -D__WXSTUBS__ -D__LINUX__ -D__UNIX__
+GUISUFFIX   = _stubs
+
+########################## Compiler flags #############################
+
+# Misc options
+OPTIONS     = -D__WXDEBUG__ -DWXDEBUG
+COPTIONS    =
+DEBUGFLAGS  = -ggdb
+INCLUDE     =
+WARN        = -Wall -Wno-unused # -w
+CWARN       = -Wall -Wno-unused # -w
+OPT         = # -O2
+
+############################ Includes #################################
+
+# Compiler or system-specific include paths
+COMPPATHS   =
+XINCLUDE    = -I/usr/openwin/include -I/usr/include/X11 -I/usr/include/Xm \
+              -I/usr/include/X11/Xm -I/usr/include
+XLIB        = -L/usr/local/X11/lib -L/usr/openwin/lib -L/usr/X11/lib -L/usr/X11R6/lib
+
+############################ Libraries ################################
+
+COMPLIBS    = -lstdc++
+GUILDLIBS   = -lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm
+
+############################# Suffixes ################################
+
+# Change cpp to c if you want to use main.c instead of main.cpp.
+# Edit wx_setup.h accordingly (USE_C_MAIN=1)
+
+OBJSUFF     =o
+SRCSUFF     =cpp
+MAINSUFF    =cpp
+
+####################### No changes below this line ####################
+
+WXINC       = $(WXDIR)/include
+WXLIB       = $(WXDIR)/lib/libwx$(GUISUFFIX).a
+INC         = -I$(WXINC) -I$(WXDIR)/src/png -I$(WXDIR)/src/zlib $(COMPPATHS)
+
+# Directory for object files
+OBJDIR = objects$(GUISUFFIX)
+
+CPPFLAGS    = $(EXTRACPPFLAGS) $(XINCLUDE) $(INC) $(OPTIONS) $(GUI) $(DEBUGFLAGS) -DDEBUG='$(DEBUG)' $(WARN) $(OPT)
+CFLAGS      = $(EXTRACFLAGS) $(XINCLUDE) $(INC) $(COPTIONS) $(GUI) $(DEBUGFLAGS) -DDEBUG='$(DEBUG)' $(CWARN) $(OPT)
+LDFLAGS     = $(EXTRALDFLAGS) $(XLIB) -L$(WXDIR)/lib
+LDLIBS      = $(EXTRALDLIBS) $(GUILDLIBS)
+
+# Clears all default suffixes
+.SUFFIXES:	.o .cpp .c
+
+.c.o :
+	$(CC) -c $(CFLAGS) -o $@ $<
+
+.cpp.o :
+	$(CC) -c $(CPPFLAGS) -o $@ $<
+
+####################### Targets to allow multiple GUIs ####################
+
+dummy:
+	echo Use a target: one of motif, stubs
+
+stubs:
+	make -f makefile.unx all GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
+
+motif:
+	make -f makefile.unx all GUI='-D__WXMOTIF__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
+
+cleanstubs:
+	make -f makefile.unx clean GUI='-D__WXSTUBS__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_stubs' GUILDLIBS='-lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
+
+cleanmotif:
+	make -f makefile.unx clean GUI='-D__WXMOTIF__ -D__LINUX__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm'
+
+$(OBJDIR):
+	mkdir $(OBJDIR)
+
diff --git a/src/makeprog.env b/src/makeprog.env
new file mode 100644
index 0000000000..8a1ee6de2b
--- /dev/null
+++ b/src/makeprog.env
@@ -0,0 +1,11 @@
+# Replace this with your own path if necessary
+WXDIR       = /home/jacs/wx2
+include $(WXDIR)/src/make.env
+
+all:    $(PROGRAM)$(GUISUFFIX)
+
+$(PROGRAM)$(GUISUFFIX):	$(OBJECTS) $(WXLIB)
+	$(CC) $(LDFLAGS) -o $(PROGRAM)$(GUISUFFIX) $(OBJECTS) $(LDLIBS)
+
+clean:
+	rm -f $(OBJECTS) minimal$(GUISUFFIX) core
diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp
index ec79708311..28d972b3a2 100644
--- a/src/msw/metafile.cpp
+++ b/src/msw/metafile.cpp
@@ -108,9 +108,13 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
 
   if (!file.IsNull() && wxFileExists(file))
     wxRemoveFile(file);
-  m_hDC = (WXHDC) CreateMetaFile(file);
 
-  m_ok = TRUE;
+  if (!file.IsNull() && (file != ""))
+    m_hDC = (WXHDC) CreateMetaFile(file);
+  else
+    m_hDC = (WXHDC) CreateMetaFile(NULL);
+
+  m_ok = (m_hDC != (WXHDC) 0) ;
 
   // Actual Windows mapping mode, for future reference.
   m_windowsMappingMode = MM_TEXT;
@@ -145,12 +149,12 @@ wxMetaFileDC::~wxMetaFileDC(void)
   m_hDC = 0;
 }
 
-void wxMetaFileDC::GetTextExtent(const wxString& string, float *x, float *y,
-                                 float *descent, float *externalLeading, wxFont *theFont, bool use16bit)
+void wxMetaFileDC::GetTextExtent(const wxString& string, long *x, long *y,
+                                 long *descent, long *externalLeading, wxFont *theFont, bool use16bit) const
 {
   wxFont *fontToUse = theFont;
   if (!fontToUse)
-    fontToUse = &m_font;
+    fontToUse = (wxFont*) &m_font;
 
   HDC dc = GetDC(NULL);
 
@@ -161,10 +165,10 @@ void wxMetaFileDC::GetTextExtent(const wxString& string, float *x, float *y,
 
   ReleaseDC(NULL, dc);
 
-  *x = (float)XDEV2LOGREL(sizeRect.cx);
-  *y = (float)YDEV2LOGREL(sizeRect.cy);
-  if (descent) *descent = (float)tm.tmDescent;
-  if (externalLeading) *externalLeading = (float)tm.tmExternalLeading;
+  *x = XDEV2LOGREL(sizeRect.cx);
+  *y = YDEV2LOGREL(sizeRect.cy);
+  if (descent) *descent = tm.tmDescent;
+  if (externalLeading) *externalLeading = tm.tmExternalLeading;
 }
 
 wxMetaFile *wxMetaFileDC::Close(void)
diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp
index 5fd182e3fa..9cb654cd38 100644
--- a/src/msw/utils.cpp
+++ b/src/msw/utils.cpp
@@ -697,3 +697,196 @@ void wxDisplaySize(int *width, int *height)
   ReleaseDC(NULL, dc);
 }
 
+bool wxDirExists(const wxString& dir)
+{
+  /* MATTHEW: [6] Always use same code for Win32, call FindClose */
+#if defined(__WIN32__)
+  WIN32_FIND_DATA fileInfo;
+#else
+#ifdef __BORLANDC__
+  struct ffblk fileInfo;
+#else
+  struct find_t fileInfo;
+#endif
+#endif
+
+#if defined(__WIN32__)
+	HANDLE h = FindFirstFile((LPTSTR) WXSTRINGCAST dir,(LPWIN32_FIND_DATA)&fileInfo);
+
+	if (h==INVALID_HANDLE_VALUE)
+	 return FALSE;
+	else {
+	 FindClose(h);
+	 return ((fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
+	}
+#else
+  // In Borland findfirst has a different argument
+  // ordering from _dos_findfirst. But _dos_findfirst
+  // _should_ be ok in both MS and Borland... why not?
+#ifdef __BORLANDC__
+  return ((findfirst(WXSTRINGCAST dir, &fileInfo, _A_SUBDIR) == 0  && (fileInfo.ff_attrib & _A_SUBDIR) != 0));
+#else
+  return (((_dos_findfirst(WXSTRINGCAST dir, _A_SUBDIR, &fileInfo) == 0) && (fileInfo.attrib & _A_SUBDIR)) != 0);
+#endif
+#endif
+}
+
+#if 0
+//------------------------------------------------------------------------
+// wild character routines
+//------------------------------------------------------------------------
+
+bool wxIsWild( const wxString& pattern )
+{
+  wxString tmp = pattern;
+  char *pat = WXSTRINGCAST(tmp);
+    while (*pat) {
+	switch (*pat++) {
+	case '?': case '*': case '[': case '{':
+	    return TRUE;
+	case '\\':
+	    if (!*pat++)
+		return FALSE;
+	}
+    }
+    return FALSE;
+};
+
+
+bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
+{
+  wxString tmp1 = pat;
+  char *pattern = WXSTRINGCAST(tmp1);
+  wxString tmp2 = text;
+  char *str = WXSTRINGCAST(tmp2);
+    char c;
+    char *cp;
+    bool done = FALSE, ret_code, ok;
+    // Below is for vi fans
+    const char OB = '{', CB = '}';
+
+    // dot_special means '.' only matches '.'
+    if (dot_special && *str == '.' && *pattern != *str)
+	return FALSE;
+
+    while ((*pattern != '\0') && (!done)
+    && (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
+	switch (*pattern) {
+	case '\\':
+	    pattern++;
+	    if (*pattern != '\0')
+		pattern++;
+	    break;
+	case '*':
+	    pattern++;
+	    ret_code = FALSE;
+	    while ((*str!='\0')
+	    && (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
+		/*loop*/;
+	    if (ret_code) {
+		while (*str != '\0')
+		    str++;
+		while (*pattern != '\0')
+		    pattern++;
+	    }
+	    break;
+	case '[':
+	    pattern++;
+	  repeat:
+	    if ((*pattern == '\0') || (*pattern == ']')) {
+		done = TRUE;
+		break;
+	    }
+	    if (*pattern == '\\') {
+		pattern++;
+		if (*pattern == '\0') {
+		    done = TRUE;
+		    break;
+		}
+	    }
+	    if (*(pattern + 1) == '-') {
+		c = *pattern;
+		pattern += 2;
+		if (*pattern == ']') {
+		    done = TRUE;
+		    break;
+		}
+		if (*pattern == '\\') {
+		    pattern++;
+		    if (*pattern == '\0') {
+			done = TRUE;
+			break;
+		    }
+		}
+		if ((*str < c) || (*str > *pattern)) {
+		    pattern++;
+		    goto repeat;
+		}
+	    } else if (*pattern != *str) {
+		pattern++;
+		goto repeat;
+	    }
+	    pattern++;
+	    while ((*pattern != ']') && (*pattern != '\0')) {
+		if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
+		    pattern++;
+		pattern++;
+	    }
+	    if (*pattern != '\0') {
+		pattern++, str++;
+	    }
+	    break;
+	case '?':
+	    pattern++;
+	    str++;
+	    break;
+	case OB:
+	    pattern++;
+	    while ((*pattern != CB) && (*pattern != '\0')) {
+		cp = str;
+		ok = TRUE;
+		while (ok && (*cp != '\0') && (*pattern != '\0')
+		&&  (*pattern != ',') && (*pattern != CB)) {
+		    if (*pattern == '\\')
+			pattern++;
+		    ok = (*pattern++ == *cp++);
+		}
+		if (*pattern == '\0') {
+		    ok = FALSE;
+		    done = TRUE;
+		    break;
+		} else if (ok) {
+		    str = cp;
+		    while ((*pattern != CB) && (*pattern != '\0')) {
+			if (*++pattern == '\\') {
+			    if (*++pattern == CB)
+				pattern++;
+			}
+		    }
+		} else {
+		    while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
+			if (*++pattern == '\\') {
+                            if (*++pattern == CB || *pattern == ',')
+				pattern++;
+			}
+		    }
+		}
+		if (*pattern != '\0')
+		    pattern++;
+	    }
+	    break;
+	default:
+	    if (*str == *pattern) {
+		str++, pattern++;
+	    } else {
+		done = TRUE;
+	    }
+	}
+    }
+    while (*pattern == '*')
+	pattern++;
+    return ((*str == '\0') && (*pattern == '\0'));
+};
+
+#endif
+
diff --git a/src/stubs.inc b/src/stubs.inc
new file mode 100644
index 0000000000..2da8b4457c
--- /dev/null
+++ b/src/stubs.inc
@@ -0,0 +1,201 @@
+# needed for unactivated
+NONE =
+
+# define library name
+LIB_TARGET=wx_stubs
+LIB_MAJOR=1
+LIB_MINOR=0
+
+# define library sources
+
+LIB_CPP_SRC=\
+\
+ common/cmndata.cpp \
+ common/config.cpp \
+ common/date.cpp \
+ common/docmdi.cpp \
+ common/docview.cpp \
+ common/dynarray.cpp \
+ common/dynlib.cpp \
+ common/event.cpp \
+ common/file.cpp \
+ common/fileconf.cpp \
+ common/filefn.cpp \
+ common/gdicmn.cpp \
+ common/hash.cpp \
+ common/helpbase.cpp \
+ common/intl.cpp \
+ common/ipcbase.cpp \
+ common/layout.cpp \
+ common/list.cpp \
+ common/log.cpp \
+ common/matrix.cpp \
+ common/memory.cpp \
+ common/module.cpp \
+ common/object.cpp \
+ common/odbc.cpp \
+ common/postscrp.cpp \
+ common/prntbase.cpp \
+ common/resource.cpp \
+ common/serbase.cpp \
+ common/string.cpp \
+ common/textfile.cpp \
+ common/time.cpp \
+ common/timercmn.cpp \
+ common/utilscmn.cpp \
+ common/wincmn.cpp \
+ common/framecmn.cpp \
+ common/stream.cpp \
+ common/datstrm.cpp \
+ common/fstream.cpp \
+ common/mstream.cpp \
+ common/zstream.cpp \
+ common/objstrm.cpp \
+ common/sckstrm.cpp \
+ common/validate.cpp \
+ common/valtext.cpp \
+ common/variant.cpp \
+ common/wxexpr.cpp \
+ common/socket.cpp \
+ common/sckaddr.cpp \
+ common/sckipc.cpp \
+ common/protocol.cpp \
+ common/ftp.cpp \
+ common/http.cpp \
+ common/url.cpp \
+ common/tokenzr.cpp \
+\
+ stubs/accel.cpp \
+ stubs/app.cpp \
+ stubs/bitmap.cpp \
+ stubs/bmpbuttn.cpp \
+ stubs/brush.cpp \
+ stubs/button.cpp \
+ stubs/checkbox.cpp \
+ stubs/choice.cpp \
+ stubs/clipbrd.cpp \
+ stubs/colour.cpp \
+ stubs/colordlg.cpp \
+ stubs/control.cpp \
+ stubs/combobox.cpp \
+ stubs/cursor.cpp \
+ stubs/data.cpp \
+ stubs/dc.cpp \
+ stubs/dcclient.cpp \
+ stubs/dcmemory.cpp \
+ stubs/dcscreen.cpp \
+ stubs/dialog.cpp \
+ stubs/dirdlg.cpp \
+ stubs/dnd.cpp \
+ stubs/filedlg.cpp \
+ stubs/font.cpp \
+ stubs/fontdlg.cpp \
+ stubs/frame.cpp \
+ stubs/gauge.cpp \
+ stubs/gdiobj.cpp \
+ stubs/helpxxxx.cpp \
+ stubs/icon.cpp \
+ stubs/imaglist.cpp \
+ stubs/listbox.cpp \
+ stubs/joystick.cpp \
+ stubs/main.cpp \
+ stubs/mdi.cpp \
+ stubs/menu.cpp \
+ stubs/menuitem.cpp \
+ stubs/metafile.cpp \
+ stubs/minifram.cpp \
+ stubs/msgdlg.cpp \
+ stubs/notebook.cpp \
+ stubs/palette.cpp \
+ stubs/pen.cpp \
+ stubs/print.cpp \
+ stubs/radiobox.cpp \
+ stubs/radiobut.cpp \
+ stubs/region.cpp \
+ stubs/scrolbar.cpp \
+ stubs/settings.cpp \
+ stubs/slider.cpp \
+ stubs/spinbutt.cpp \
+ stubs/statbox.cpp \
+ stubs/statbmp.cpp \
+ stubs/stattext.cpp \
+ stubs/statusbr.cpp \
+ stubs/taskbar.cpp \
+ stubs/textctrl.cpp \
+ stubs/thread.cpp \
+ stubs/timer.cpp \
+ stubs/toolbar.cpp \
+ stubs/treectrl.cpp \
+ stubs/utils.cpp \
+ stubs/utilsexc.cpp \
+ stubs/wave.cpp \
+ stubs/window.cpp \
+\
+ generic/choicdgg.cpp \
+ generic/colrdlgg.cpp \
+ generic/fontdlgg.cpp \
+ generic/gridg.cpp \
+ generic/imaglist.cpp \
+ generic/listctrl.cpp \
+ generic/laywin.cpp \
+ generic/msgdlgg.cpp \
+ generic/panelg.cpp \
+ generic/printps.cpp \
+ generic/prntdlgg.cpp \
+ generic/sashwin.cpp \
+ generic/scrolwin.cpp \
+ generic/splitter.cpp \
+ generic/statusbr.cpp \
+ generic/tabg.cpp \
+ generic/textdlgg.cpp \
+ generic/treectrl.cpp
+ 
+ 
+LIB_C_SRC=\
+ common/extended.c \
+ png/png.c \
+ png/pngset.c \
+ png/pngget.c \
+ png/pngrutil.c \
+ png/pngtrans.c \
+ png/pngwutil.c \
+ png/pngread.c \
+ png/pngrio.c \
+ png/pngwio.c \
+ png/pngwrite.c \
+ png/pngrtran.c \
+ png/pngwtran.c \
+ png/pngmem.c \
+ png/pngerror.c \
+ png/pngpread.c \
+\
+ zlib/adler32.c \
+ zlib/compress.c \
+ zlib/crc32.c \
+ zlib/gzio.c \
+ zlib/uncompr.c \
+ zlib/deflate.c \
+ zlib/trees.c \
+ zlib/zutil.c \
+ zlib/inflate.c \
+ zlib/infblock.c \
+ zlib/inftrees.c \
+ zlib/infcodes.c \
+ zlib/infutil.c \
+ zlib/inffast.c \
+\
+  iodbc/dlf.c \
+  iodbc/dlproc.c \
+  iodbc/herr.c \
+  iodbc/henv.c \
+  iodbc/hdbc.c \
+  iodbc/hstmt.c \
+  iodbc/connect.c \
+  iodbc/prepare.c \
+  iodbc/result.c \
+  iodbc/execute.c \
+  iodbc/fetch.c \
+  iodbc/info.c \
+  iodbc/catalog.c \
+  iodbc/misc.c \
+  iodbc/itrace.c
diff --git a/src/stubs/app.cpp b/src/stubs/app.cpp
index d879be6712..67271c4c3b 100644
--- a/src/stubs/app.cpp
+++ b/src/stubs/app.cpp
@@ -95,6 +95,7 @@ void wxApp::CommonCleanUp()
   wxDeleteStockObjects() ;
 
   // Destroy all GDI lists, etc.
+
   delete wxTheBrushList;
   wxTheBrushList = NULL;
 
@@ -121,6 +122,10 @@ void wxApp::CommonCleanUp()
   delete[] wxBuffer;
   wxBuffer = NULL;
 
+  wxClassInfo::CleanUpClasses();
+
+  // do it as the very last thing because everything else can log messages
+  wxLog::DontCreateOnDemand();
   // do it as the very last thing because everything else can log messages
   delete wxLog::SetActiveTarget(NULL);
 }
@@ -177,12 +182,21 @@ int wxEntry( int argc, char *argv[] )
   int retValue = 0;
   
   if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
+
+  if (wxTheApp->GetTopWindow())
+  {
+    delete wxTheApp->GetTopWindow();
+    wxTheApp->SetTopWindow(NULL);
+  }
   
   wxTheApp->DeletePendingObjects();  
   
   wxTheApp->OnExit();
   
   wxApp::CommonCleanUp();
+
+  delete wxTheApp;
+  wxTheApp = NULL;
   
 #if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT
   // At this point we want to check if there are any memory
diff --git a/src/stubs/dialog.cpp b/src/stubs/dialog.cpp
index c278536c60..d29f2bbc8f 100644
--- a/src/stubs/dialog.cpp
+++ b/src/stubs/dialog.cpp
@@ -289,3 +289,6 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& event)
   Refresh();
 }
 
+void wxDialog::Fit()
+{
+}
diff --git a/src/stubs/dnd.cpp b/src/stubs/dnd.cpp
index ec82cb6dc1..50bfbd9162 100644
--- a/src/stubs/dnd.cpp
+++ b/src/stubs/dnd.cpp
@@ -99,21 +99,21 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
 wxDropSource::wxDropSource( wxWindow *win )
 {
     // TODO
-    m_window = win;
+  //    m_window = win;
     m_data = NULL;
 
-    m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
-    m_goaheadCursor = wxCursor( wxCURSOR_HAND );
+    //    m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
+    //    m_goaheadCursor = wxCursor( wxCURSOR_HAND );
 };
 
 wxDropSource::wxDropSource( wxDataObject &data, wxWindow *win )
 {
     // TODO
-    m_window = win;
+  //    m_window = win;
     m_data = &data;
 
-    m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
-    m_goaheadCursor = wxCursor( wxCURSOR_HAND );
+    //    m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
+    //    m_goaheadCursor = wxCursor( wxCURSOR_HAND );
 };
 
 void wxDropSource::SetData( wxDataObject &data )
diff --git a/src/stubs/makefile.unx b/src/stubs/makefile.unx
new file mode 100644
index 0000000000..6d6c5c43ed
--- /dev/null
+++ b/src/stubs/makefile.unx
@@ -0,0 +1,199 @@
+#
+# File:		makefile.unx
+# Author:	Julian Smart
+# Created:	1998
+# Updated:	
+# Copyright:	(c) 1998
+#
+#
+# Makefile for wxStubs library, Unix
+
+EXTRACFLAGS=-DLEX_SCANNER
+
+include ../make.env
+
+LIB_CPP_SRC=\
+\
+ ../common/cmndata.cpp \
+ ../common/config.cpp \
+ ../common/date.cpp \
+ ../common/docmdi.cpp \
+ ../common/docview.cpp \
+ ../common/dynarray.cpp \
+ ../common/dynlib.cpp \
+ ../common/event.cpp \
+ ../common/file.cpp \
+ ../common/fileconf.cpp \
+ ../common/filefn.cpp \
+ ../common/gdicmn.cpp \
+ ../common/hash.cpp \
+ ../common/helpbase.cpp \
+ ../common/intl.cpp \
+ ../common/ipcbase.cpp \
+ ../common/layout.cpp \
+ ../common/list.cpp \
+ ../common/log.cpp \
+ ../common/matrix.cpp \
+ ../common/memory.cpp \
+ ../common/module.cpp \
+ ../common/object.cpp \
+ ../common/odbc.cpp \
+ ../common/postscrp.cpp \
+ ../common/prntbase.cpp \
+ ../common/resource.cpp \
+ ../common/serbase.cpp \
+ ../common/string.cpp \
+ ../common/textfile.cpp \
+ ../common/tbarbase.cpp \
+ ../common/tbarsmpl.cpp \
+ ../common/timercmn.cpp \
+ ../common/utilscmn.cpp \
+ ../common/wincmn.cpp \
+ ../common/framecmn.cpp \
+ ../common/stream.cpp \
+ ../common/datstrm.cpp \
+ ../common/fstream.cpp \
+ ../common/mstream.cpp \
+ ../common/zstream.cpp \
+ ../common/objstrm.cpp \
+ ../common/sckstrm.cpp \
+ ../common/validate.cpp \
+ ../common/valtext.cpp \
+ ../common/variant.cpp \
+ ../common/wxexpr.cpp \
+ ../common/socket.cpp \
+ ../common/sckaddr.cpp \
+ ../common/sckipc.cpp \
+ ../common/protocol.cpp \
+ ../common/ftp.cpp \
+ ../common/http.cpp \
+ ../common/url.cpp \
+ ../common/tokenzr.cpp \
+\
+ accel.cpp \
+ app.cpp \
+ bitmap.cpp \
+ bmpbuttn.cpp \
+ brush.cpp \
+ button.cpp \
+ checkbox.cpp \
+ choice.cpp \
+ clipbrd.cpp \
+ colour.cpp \
+ colordlg.cpp \
+ control.cpp \
+ combobox.cpp \
+ cursor.cpp \
+ data.cpp \
+ dc.cpp \
+ dcclient.cpp \
+ dcmemory.cpp \
+ dcscreen.cpp \
+ dialog.cpp \
+ dirdlg.cpp \
+ dnd.cpp \
+ filedlg.cpp \
+ font.cpp \
+ fontdlg.cpp \
+ frame.cpp \
+ gauge.cpp \
+ gdiobj.cpp \
+ helpxxxx.cpp \
+ icon.cpp \
+ listbox.cpp \
+ joystick.cpp \
+ main.cpp \
+ mdi.cpp \
+ menu.cpp \
+ menuitem.cpp \
+ metafile.cpp \
+ minifram.cpp \
+ msgdlg.cpp \
+ notebook.cpp \
+ palette.cpp \
+ pen.cpp \
+ print.cpp \
+ radiobox.cpp \
+ radiobut.cpp \
+ region.cpp \
+ scrolbar.cpp \
+ settings.cpp \
+ slider.cpp \
+ spinbutt.cpp \
+ statbox.cpp \
+ statbmp.cpp \
+ stattext.cpp \
+ taskbar.cpp \
+ textctrl.cpp \
+ thread.cpp \
+ timer.cpp \
+ toolbar.cpp \
+ utils.cpp \
+ utilsexc.cpp \
+ wave.cpp \
+ window.cpp \
+\
+ ../generic/choicdgg.cpp \
+ ../generic/colrdlgg.cpp \
+ ../generic/fontdlgg.cpp \
+ ../generic/gridg.cpp \
+ ../generic/imaglist.cpp \
+ ../generic/listctrl.cpp \
+ ../generic/laywin.cpp \
+ ../generic/msgdlgg.cpp \
+ ../generic/panelg.cpp \
+ ../generic/printps.cpp \
+ ../generic/prntdlgg.cpp \
+ ../generic/sashwin.cpp \
+ ../generic/scrolwin.cpp \
+ ../generic/splitter.cpp \
+ ../generic/statusbr.cpp \
+ ../generic/tabg.cpp \
+ ../generic/textdlgg.cpp \
+ ../generic/treectrl.cpp
+
+# If you're not using the generic ones, you
+# may wish to define platform-specific ones
+# treectrl.cpp \
+# listctrl.cpp \
+# imaglist.cpp \
+# statusbr.cpp \
+ 
+LIB_C_SRC=\
+\
+ ../common/y_tab.c \
+ ../common/extended.c
+
+all:    $(WXLIB)
+
+# Define library objects
+OBJECTS=\
+ $(LIB_CPP_SRC:.cpp=.o) $(LIB_C_SRC:.c=.o)
+
+$(WXLIB) : $(OBJECTS)
+	ar $(AROPTIONS) $@ $(OBJECTS)
+	$(RANLIB) $@
+
+../common/y_tab.$(OBJSUFF):	../common/y_tab.c ../common/lex_yy.c
+	$(CCLEX) -c $(CFLAGS) -o $@ ../common/y_tab.c
+
+# Replace lex with flex if you run into compilation
+# problems with lex_yy.c. See also note about LEX_SCANNER
+# above.
+../common/lex_yy.c:	../common/lexer.l
+	$(LEX) -o../common/lex.yy.c ../common/lexer.l 
+	sed -e "s/BUFSIZ/5000/g" < ../common/lex.yy.c | \
+	sed -e "s/yyoutput(c)/void yyoutput(c)/g" | \
+        sed -e "s/YYLMAX 200/YYLMAX 5000/g" > ../common/lex_yy.c
+	/bin/rm -f ../common/lex.yy.c
+
+# Replace yacc with bison if you run into compilation
+# problems with y_tab.c.
+../common/y_tab.c:	../common/parser.y
+	$(YACC) ../common/parser.y
+	mv y.tab.c ../common/y_tab.c
+
+
+clean:
+	rm -f $(OBJECTS) $(WXLIB)
+
diff --git a/src/stubs/notebook.cpp b/src/stubs/notebook.cpp
index cd85a27ad7..233bc5639b 100644
--- a/src/stubs/notebook.cpp
+++ b/src/stubs/notebook.cpp
@@ -277,8 +277,8 @@ void wxNotebook::OnSize(wxSizeEvent& event)
     int w, h;
     GetSize(&w, &h);
 
-    uint nCount = m_aPages.Count();
-    for ( uint nPage = 0; nPage < nCount; nPage++ ) {
+    unsigned int nCount = m_aPages.Count();
+    for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
         wxNotebookPage *pPage = m_aPages[nPage];
         pPage->SetSize(0, 0, w, h);
         if ( pPage->GetAutoLayout() )
diff --git a/src/stubs/print.cpp b/src/stubs/print.cpp
index 1939136855..61fd6e7e99 100644
--- a/src/stubs/print.cpp
+++ b/src/stubs/print.cpp
@@ -42,13 +42,13 @@ bool wxPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
 
 bool wxPrinter::PrintDialog(wxWindow *parent)
 {
-    wxPrintDialog dialog(parent, & printData);
+    wxPrintDialog dialog(parent, & m_printData);
     return (dialog.ShowModal() == wxID_OK);
 }
 
 bool wxPrinter::Setup(wxWindow *parent)
 {
-    wxPrintDialog dialog(parent, & printData);
+    wxPrintDialog dialog(parent, & m_printData);
     dialog.GetPrintData().SetSetupDialog(TRUE);
     return (dialog.ShowModal() == wxID_OK);
 }
@@ -69,10 +69,10 @@ wxPrintPreview::~wxPrintPreview()
 
 bool wxPrintPreview::Print(bool interactive)
 {
-    if (!printPrintout)
+    if (!m_printPrintout)
         return FALSE;
-    wxPrinter printer(&printData);
-    return printer.Print(previewFrame, printPrintout, interactive);
+    wxPrinter printer(&m_printData);
+    return printer.Print(m_previewFrame, m_printPrintout, interactive);
 }
 
 void wxPrintPreview::DetermineScaling()
diff --git a/src/stubs/slider.cpp b/src/stubs/slider.cpp
index 0be5a60de7..c9952342a9 100644
--- a/src/stubs/slider.cpp
+++ b/src/stubs/slider.cpp
@@ -17,8 +17,13 @@
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
+
+BEGIN_EVENT_TABLE(wxSlider, wxControl)
+END_EVENT_TABLE()
 #endif
 
+
+
 // Slider
 wxSlider::wxSlider()
 {
diff --git a/src/stubs/textctrl.cpp b/src/stubs/textctrl.cpp
index f4fbdd3bbb..6083ace113 100644
--- a/src/stubs/textctrl.cpp
+++ b/src/stubs/textctrl.cpp
@@ -34,9 +34,7 @@
 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
 
 BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
-	EVT_CHAR(wxTextCtrl::OnChar)
 	EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
-	EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
 END_EVENT_TABLE()
 #endif
 
-- 
2.47.2

