]> git.saurik.com Git - wxWidgets.git/commitdiff
Merges from Scitech Branch (George Davison):
authorKendall Bennett <KendallB@scitechsoft.com>
Thu, 7 Feb 2002 18:46:31 +0000 (18:46 +0000)
committerKendall Bennett <KendallB@scitechsoft.com>
Thu, 7 Feb 2002 18:46:31 +0000 (18:46 +0000)
Added wxDisplayChangedEvent and triggering in MSW, when display mode changes
this event gets triggered. I don't know what should happen with other OS's
since I am not familiar with how they handle mode changes.

Watcome Version 11 now compiles with wide character support.

Fixed watcom warnings in
html/htmlwin.h
imagbmp.h
listctrl.h
imagbmp.cpp
quantize.cpp
strconv.cpp
variant.cpp
dirctrlg.cpp
treectlg.cpp
m_style.cpp
fontenum.cpp
listctrl.cpp
ole\dataobj.cpp
textctrl.cpp
window.cpp
xml.cpp

msw/setup.h
with watcom version 11 it now compiles with wide character support.

xrc/xml.cpp
fixed memory leak and compile warnings

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

46 files changed:
contrib/include/wx/applet/applet.h
contrib/include/wx/applet/echovar.h
contrib/include/wx/applet/ifelsevar.h
contrib/include/wx/applet/loadpage.h
contrib/include/wx/applet/plugin.h
contrib/include/wx/applet/prepecho.h
contrib/include/wx/applet/prepifelse.h
contrib/include/wx/applet/prepinclude.h
contrib/include/wx/applet/window.h
contrib/src/applet/applet.cpp
contrib/src/applet/appletwindow.cpp
contrib/src/applet/echovar.cpp
contrib/src/applet/ifelsevar.cpp
contrib/src/applet/loadpage.cpp
contrib/src/applet/plugin.cpp
contrib/src/applet/prepecho.cpp
contrib/src/applet/prepifelse.cpp
contrib/src/applet/prepinclude.cpp
contrib/src/xrc/xml.cpp
include/wx/dc.h
include/wx/event.h
include/wx/html/htmlwin.h
include/wx/imagbmp.h
include/wx/listctrl.h
include/wx/msw/dc.h
include/wx/msw/window.h
include/wx/window.h
src/common/event.cpp
src/common/filename.cpp
src/common/imagbmp.cpp
src/common/quantize.cpp
src/common/strconv.cpp
src/common/variant.cpp
src/common/wincmn.cpp
src/generic/dirctrlg.cpp
src/generic/splash.cpp
src/generic/treectlg.cpp
src/html/m_style.cpp
src/msw/dc.cpp
src/msw/dcclient.cpp
src/msw/fontenum.cpp
src/msw/listctrl.cpp
src/msw/ole/dataobj.cpp
src/msw/textctrl.cpp
src/msw/window.cpp
src/xrc/xml.cpp

index 3965ca1fc2b92f100cac067fef97b2bf645ed22d..42c8e18dde8e40b8ab66c25028709a73250073db 100644 (file)
@@ -34,7 +34,7 @@
 
 // Forward declaration
 class wxHtmlAppletWindow;
 
 // Forward declaration
 class wxHtmlAppletWindow;
-
+class wxAppletEvent;
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
@@ -76,7 +76,7 @@ public:
     virtual void OnHistoryBack() = 0;
 
             // Handle messages from the wxAppletManager and other applets
     virtual void OnHistoryBack() = 0;
 
             // Handle messages from the wxAppletManager and other applets
-    virtual void OnMessage(wxEvent& msg) = 0;
+    virtual void OnMessage(wxAppletEvent& msg) = 0;
     };
 
 
     };
 
 
index 9fd5708f5c222bdf8b5f83466289121b1dd23d6b..33b91e244ed5f83b35d488752deb3f9aaf02fed3 100644 (file)
 #ifndef __WX_ECHOVAR_H
 #define __WX_ECHOVAR_H
 
 #ifndef __WX_ECHOVAR_H
 #define __WX_ECHOVAR_H
 
+#include "wx/object.h"
+#include "wx/hash.h"
+
 /*--------------------------- Class Definitions ---------------------------*/
 
 /*--------------------------- Class Definitions ---------------------------*/
 
+/****************************************************************************
+RETURNS:
+The string value of the variable
+
+PARAMETERS:
+parms   - Optional parameter string passed from parm= field in HTML
+
+REMARKS:
+To create new variables for the #echo HTML preprocessing directives
+you need to derive classes from wxEchoVariable and override the
+pure virtual GetValue function. However this should not be done directly
+but by using the BEGIN_ECHO_VARIABLE and END_ECHO_VARIABLE macros
+
+SEE ALSO:
+wxEchoPrep, BEGIN_ECHO_VARIABLE, END_ECHO_VARIABLE
+****************************************************************************/
+typedef wxString (*wxEchoVariableGetValueFn)(const char *parms);
+
 /****************************************************************************
 REMARKS:
 wxEchoVariable class Definition
 ****************************************************************************/
 class wxEchoVariable : public wxObject {
 /****************************************************************************
 REMARKS:
 wxEchoVariable class Definition
 ****************************************************************************/
 class wxEchoVariable : public wxObject {
-private:
-    DECLARE_ABSTRACT_CLASS(wxEchoVariable);
+protected:
+    const wxChar                *m_varName;
+    wxEchoVariableGetValueFn    m_getValueFn;
+    static wxEchoVariable       *sm_first;
+    wxEchoVariable              *m_next;
+    static wxHashTable          *sm_varTable;
+
+    static inline wxEchoVariable *wxEchoVariable::FindVariable(const wxChar *varName);
 
 public:
 
 public:
-    wxEchoVariable() : wxObject() {}
-    ~wxEchoVariable() {}
+    // Constructor to create the echo variable and register the class
+    wxEchoVariable(
+        const char *varName,
+        wxEchoVariableGetValueFn getValueFn);
+
+    // Member variable access functions
+    const wxChar *GetClassName() const          { return m_varName; }
+    wxEchoVariableGetValueFn GetValueFn() const { return m_getValueFn; }
+    static const wxEchoVariable* GetFirst()     { return sm_first; }
+    const wxEchoVariable* GetNext() const       { return m_next; }
        
        
-    /****************************************************************************
-    RETURNS:
-    The boolean value of the variable
+    // Static functions to retrieve any variable avaliable
+    static wxString GetValue(const wxChar *varName,const wxChar *parms = NULL);
+    static bool Exists(const wxChar *varName);
 
 
-    PARAMETERS:
-    parms   - Optional parameter string passed from parm= field in HTML
+    // Initializes parent pointers and hash table for fast searching.
+    static void Initialize();
 
 
-    REMARKS:
-    To create new variables for the #echo HTML preprocessing directives
-    you need to derive classes from wxEchoVariable and override the
-    pure virtual GetValue function. However this should not be done directly
-    but by using the BEGIN_ECHO_VARIABLE and END_ECHO_VARIABLE macros
+    // Cleans up hash table used for fast searching.
+    static void CleanUp();
+    };
+       
+/****************************************************************************
+PARAMETERS:
+class   - Name of class for echo variable to find
 
 
-    SEE ALSO:
-    wxEchoPrep, BEGIN_ECHO_VARIABLE, END_ECHO_VARIABLE
-    ****************************************************************************/
-    virtual wxString GetValue(const char *parms = NULL) const = 0;
+RETURNS:
+Pointer to the echo variable class
 
 
+REMARKS:
+Inline helper function to find the echo variable from it's class name.
+****************************************************************************/
+inline wxEchoVariable *wxEchoVariable::FindVariable(
+    const wxChar *varName)
+{
+    if (sm_varTable)
+        return (wxEchoVariable*)sm_varTable->Get(varName);
+    else {
+        wxEchoVariable *info = sm_first;
+        while (info) {
+            if (info->m_varName && wxStrcmp(info->m_varName, varName) == 0)
+                return info;
+            info = info->m_next;
+            }
+        return NULL;
+        }
+}
 
 
-public:
-    // static function to retrieve any variable avaliable
-    static wxString FindValue(const wxString &cls, const char *parms = NULL);
-    };
-       
 /*--------------------------------- MACROS --------------------------------*/
 
 /*--------------------------------- MACROS --------------------------------*/
 
-#define ECHO_PARM (_BEV_parm)
 #define BEGIN_ECHO_VARIABLE(name)                                           \
 #define BEGIN_ECHO_VARIABLE(name)                                           \
-    class wxEchoVariable##name : public wxEchoVariable {                    \
-    private:                                                                \
-        DECLARE_DYNAMIC_CLASS(wxEchoVariable##name##);                      \
-    public:                                                                 \
-        wxEchoVariable##name##() : wxEchoVariable() {}                      \
-        virtual wxString GetValue(const char *parms = NULL) const;          \
-        };                                                                  \
-    IMPLEMENT_DYNAMIC_CLASS(wxEchoVariable##name##, wxEchoVariable);        \
-    wxString wxEchoVariable##name :: GetValue(const char *parms) const {    \
+wxString wxEchoVariableFn##name(const char *parms);                         \
+wxEchoVariable wxEchoVariable##name(#name,wxEchoVariableFn##name);          \
+wxString wxEchoVariableFn##name(const char *parms) {                        \
     wxString _BEV_parm = wxString(parms);
 
 #define END_ECHO_VARIABLE(returnval)                                        \
     wxString _BEV_parm = wxString(parms);
 
 #define END_ECHO_VARIABLE(returnval)                                        \
index 5a95b84ff77e728153252426f1c7c7d4735303dc..b857b2bfc674048550f47b793071ed504f3b9c37 100644 (file)
 #ifndef __WX_IFELSEVAR_H
 #define __WX_IFELSEVAR_H
 
 #ifndef __WX_IFELSEVAR_H
 #define __WX_IFELSEVAR_H
 
+#include "wx/object.h"
+#include "wx/hash.h"
+
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
+RETURNS:
+The boolean value of the variable
+
 REMARKS:
 REMARKS:
-This class is used to create variables for the HTML preprocessor #if, #else,
-and #endif directives.
+To create new variables for the #if, #else and #endif HTML preprocessing
+blocks you need to derive classes from wxIfElseVariable and override the
+pure virtual GetValue function. However this should not be done directly
+but by using the BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros
 
 SEE ALSO:
 
 SEE ALSO:
-wxIfElsePrep
+wxIfElsePrep, BEGIN_IFELSE_VARIABLE, END_IFELSE_VARIABLE
+****************************************************************************/
+typedef bool (*wxIfElseVariableGetValueFn)();
+
+/****************************************************************************
+REMARKS:
+wxIfElseVariable class Definition
 ****************************************************************************/
 class wxIfElseVariable : public wxObject {
 ****************************************************************************/
 class wxIfElseVariable : public wxObject {
-private:
-    DECLARE_ABSTRACT_CLASS(wxIfElseVariable);
+protected:
+    const wxChar                *m_varName;
+    wxIfElseVariableGetValueFn  m_getValueFn;
+    static wxIfElseVariable     *sm_first;
+    wxIfElseVariable            *m_next;
+    static wxHashTable          *sm_varTable;
+    bool                        forced;
+    bool                        forceVal;
+
+    static inline wxIfElseVariable *wxIfElseVariable::FindVariable(const wxChar *varName);
 
 public:
 
 public:
-    wxIfElseVariable() : wxObject() {}
-    ~wxIfElseVariable() {}
+    // Constructor to create the echo variable and register the class
+    wxIfElseVariable(
+        const char *varName,
+        wxIfElseVariableGetValueFn getValueFn);
+
+    // Member variable access functions
+    const wxChar *GetClassName() const            { return m_varName; }
+    wxIfElseVariableGetValueFn GetValueFn() const { return m_getValueFn; }
+    static const wxIfElseVariable* GetFirst()     { return sm_first; }
+    const wxIfElseVariable* GetNext() const       { return m_next; }
        
        
-    /****************************************************************************
-    RETURNS:
-    The boolean value of the variable
+    // Static functions to retrieve any variable avaliable
+    static bool GetValue(const wxChar *varName);
+    static bool Exists(const wxChar *varName);
+    static void Force(const wxChar *varName, bool val);
 
 
-    REMARKS:
-    To create new variables for the #if, #else and #endif HTML preprocessing
-    blocks you need to derive classes from wxIfElseVariable and override the
-    pure virtual GetValue function. However this should not be done directly
-    but by using the BEGIN_IFELSE_VARIABLE and END_IFELSE_VARIABLE macros
+    // Initializes parent pointers and hash table for fast searching.
+    static void Initialize();
 
 
-    SEE ALSO:
-    wxIfElsePrep, BEGIN_IFELSE_VARIABLE, END_IFELSE_VARIABLE
-    ****************************************************************************/
-    virtual bool GetValue() const = 0;
+    // Cleans up hash table used for fast searching.
+    static void CleanUp();
+    };
+       
+/****************************************************************************
+PARAMETERS:
+class   - Name of class for echo variable to find
 
 
+RETURNS:
+Pointer to the echo variable class
 
 
-public:
-    // static function to retrieve any variable avaliable
-    static bool FindValue(const wxString &cls);
-    };
+REMARKS:
+Inline helper function to find the echo variable from it's class name.
+****************************************************************************/
+inline wxIfElseVariable *wxIfElseVariable::FindVariable(
+    const wxChar *varName)
+{
+    if (sm_varTable)
+        return (wxIfElseVariable*)sm_varTable->Get(varName);
+    else {
+        wxIfElseVariable *info = sm_first;
+        while (info) {
+            if (info->m_varName && wxStrcmp(info->m_varName, varName) == 0)
+                return info;
+            info = info->m_next;
+            }
+        return NULL;
+        }
+}
 
 /*--------------------------------- MACROS --------------------------------*/
 
 #define BEGIN_IFELSE_VARIABLE(name)                                         \
 
 /*--------------------------------- MACROS --------------------------------*/
 
 #define BEGIN_IFELSE_VARIABLE(name)                                         \
-    class wxIfElseVariable##name : public wxIfElseVariable {                \
-    private:                                                                \
-        DECLARE_DYNAMIC_CLASS(wxIfElseVariable##name##);                    \
-    public:                                                                 \
-        wxIfElseVariable##name##() : wxIfElseVariable() {}                  \
-        virtual bool GetValue() const;                                      \
-        };                                                                  \
-    IMPLEMENT_DYNAMIC_CLASS(wxIfElseVariable##name##, wxIfElseVariable);    \
-    bool wxIfElseVariable##name :: GetValue() const {
+bool wxIfElseVariableFn##name();                                            \
+wxIfElseVariable wxIfElseVariable##name(#name,wxIfElseVariableFn##name);    \
+bool wxIfElseVariableFn##name() {                                           \
 
 #define END_IFELSE_VARIABLE(returnval)                                      \
     return returnval;                                                       \
 
 #define END_IFELSE_VARIABLE(returnval)                                      \
     return returnval;                                                       \
index f20cd0c3fef2006ff0fc5d1511cc37e327397da2..4be49c0dc9a62ba72348d5704792afe9e6f2199f 100644 (file)
@@ -68,14 +68,15 @@ public:
             // Destructor
             ~wxLoadPageEvent() {}
 
             // Destructor
             ~wxLoadPageEvent() {}
 
+            // Clone Virtual
+            virtual wxEvent *Clone() const { return new wxLoadPageEvent(m_hRef, m_htmlWindow); }
+
             // Return the hmtl window for the load page operation
             wxHtmlAppletWindow  *GetHtmlWindow() { return m_htmlWindow; };
 
             // Get the hRef string for the load page operation
             const wxString & GetHRef() { return m_hRef; };
 
             // Return the hmtl window for the load page operation
             wxHtmlAppletWindow  *GetHtmlWindow() { return m_htmlWindow; };
 
             // Get the hRef string for the load page operation
             const wxString & GetHRef() { return m_hRef; };
 
-            // Copy constructor for the object
-            void CopyObject(wxObject& obj) const;
     };
 
 
     };
 
 
@@ -97,8 +98,10 @@ public:
             // Destructor
             ~wxPageLoadedEvent() {}
 
             // Destructor
             ~wxPageLoadedEvent() {}
 
-            // Copy constructor for the object
-            void CopyObject(wxObject& obj) const;
+            // Clone Virtual
+            virtual wxEvent *Clone() const {
+                return new wxPageLoadedEvent(); }
+
     };
 
 // Define the macro to create our event type
     };
 
 // Define the macro to create our event type
index 1aff089a25761a3dcb877c70b09cf7394574e4d4..dbbecb0e710757584715d76919cd2919c528cff5 100644 (file)
 // Forward declaration
 class wxHtmlAppletWindow;
 
 // Forward declaration
 class wxHtmlAppletWindow;
 
+#include "wx/event.h"
+
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
 REMARKS:
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
 REMARKS:
-Defines the abstract base class for wxQlet objects.
+Defines the abstract base class for wxPlugIn objects.
 ****************************************************************************/
 ****************************************************************************/
-class wxPlugIn : public wxObject {
+class wxPlugIn : public wxEvtHandler {
 private:
 private:
+    wxHtmlAppletWindow *m_parent;
     DECLARE_ABSTRACT_CLASS(wxPlugIn);
 
     DECLARE_ABSTRACT_CLASS(wxPlugIn);
 
-    wxHtmlAppletWindow *m_parent;
 public:
             // Constructor (called during dynamic creation)
             wxPlugIn() { m_parent = NULL; };
 public:
             // Constructor (called during dynamic creation)
             wxPlugIn() { m_parent = NULL; };
@@ -50,8 +52,12 @@ public:
             // Psuedo virtual constructor
     virtual bool Create(wxHtmlAppletWindow *parent);
 
             // Psuedo virtual constructor
     virtual bool Create(wxHtmlAppletWindow *parent);
 
+            // Function that actually executes the main plugin code
+    virtual void Run(const wxString& cmdLine);
+
             // Virtual destructor
     virtual ~wxPlugIn();
     };
             // Virtual destructor
     virtual ~wxPlugIn();
     };
+
 #endif // __WX_PLUGIN_H
 
 #endif // __WX_PLUGIN_H
 
index 50cde400b016f1668c45977f5f7843b7b37e0a63..118174a05a05e2079686e7d927f33b792f136a82 100644 (file)
@@ -30,6 +30,7 @@
 #ifndef __WX_PREPECHO_H
 #define __WX_PREPECHO_H
 
 #ifndef __WX_PREPECHO_H
 #define __WX_PREPECHO_H
 
+#include "wx/object.h"
 #include "wx/html/htmlproc.h"
 
 /*--------------------------- Class Definitions ---------------------------*/
 #include "wx/html/htmlproc.h"
 
 /*--------------------------- Class Definitions ---------------------------*/
index 216f5d5ba5c607f60d5c34a178cb2256418c84ba..67f28bd75a6e24376fa3b081d9ed9c3e43f24e00 100644 (file)
@@ -30,6 +30,7 @@
 #ifndef __WX_PREPIFELSE_H
 #define __WX_PREPIFELSE_H
 
 #ifndef __WX_PREPIFELSE_H
 #define __WX_PREPIFELSE_H
 
+#include "wx/object.h"
 #include "wx/html/htmlproc.h"
 
 /*--------------------------- Class Definitions ---------------------------*/
 #include "wx/html/htmlproc.h"
 
 /*--------------------------- Class Definitions ---------------------------*/
index 21178334d1f41e5effbf611187ac4a5de224a036..c021cf56dc2ef95ced424939a1c8f953faf54fe8 100644 (file)
 #ifndef __WX_PREPINCLUDE_H
 #define __WX_PREPINCLUDE_H
 
 #ifndef __WX_PREPINCLUDE_H
 #define __WX_PREPINCLUDE_H
 
+#include "wx/object.h"
 #include "wx/html/htmlproc.h"
 
 #include "wx/html/htmlproc.h"
 
+/*------------------------------- Prototypes ------------------------------*/
+
+class wxFileSystem;
+
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
 /*--------------------------- Class Definitions ---------------------------*/
 
 /****************************************************************************
index 340023b8867ac6a9b7899e08984f8c6e0e11b778..5746a12543aee479f0177c3557d090d057af7f76 100644 (file)
@@ -46,6 +46,21 @@ class wxToolBarBase;
 WX_DECLARE_LIST(wxApplet, wxAppletList);
 
 /*--------------------------- Class Definitions ---------------------------*/
 WX_DECLARE_LIST(wxApplet, wxAppletList);
 
 /*--------------------------- Class Definitions ---------------------------*/
+class wxAppletEvent {
+protected:
+    int               m_id;
+    wxObject         *m_eventObject;
+public:
+    wxAppletEvent(int id) { m_eventObject=NULL; m_id = id; }
+
+    int GetId() const { return m_id; }
+    void SetId(int Id) { m_id = Id; }
+
+    wxObject *GetEventObject() const { return m_eventObject; }
+    void SetEventObject(wxObject *obj) { m_eventObject = obj; }
+
+};
+
 
 /****************************************************************************
 REMARKS:
 
 /****************************************************************************
 REMARKS:
@@ -53,16 +68,21 @@ Defines the class for virtual-link data types
 ****************************************************************************/
 class VirtualData : public wxObject {
 private:
 ****************************************************************************/
 class VirtualData : public wxObject {
 private:
+    DECLARE_DYNAMIC_CLASS(VirtualData);
+       
+protected:
     wxString m_name;
     wxString m_group;
     wxString m_href;
     wxString m_name;
     wxString m_group;
     wxString m_href;
+    wxString m_plugIn;
 
 public:
             // Ctors
             VirtualData(
                 wxString& name,
                 wxString& group,
 
 public:
             // Ctors
             VirtualData(
                 wxString& name,
                 wxString& group,
-                wxString& href );
+                wxString& href,
+                wxString& plugin );
 
             VirtualData();
 
 
             VirtualData();
 
@@ -70,11 +90,14 @@ public:
             wxString GetName(){ return m_name;};
             wxString GetGroup(){ return m_group;};
             wxString GetHref(){ return m_href;};
             wxString GetName(){ return m_name;};
             wxString GetGroup(){ return m_group;};
             wxString GetHref(){ return m_href;};
+            wxString GetPlugIn(){ return m_plugIn;};
 
             // Sets
             void SetName (wxString& s){ m_name = s; };
             void SetGroup(wxString& s){ m_group = s; };
             void SetHref (wxString& s){ m_href = s; };
 
             // Sets
             void SetName (wxString& s){ m_name = s; };
             void SetGroup(wxString& s){ m_group = s; };
             void SetHref (wxString& s){ m_href = s; };
+            void SetPlugIn (wxString& s){ m_plugIn = s;};
+            void EmptyPlugIn () { m_plugIn = "";};
     };
 
 /****************************************************************************
     };
 
 /****************************************************************************
@@ -98,7 +121,7 @@ protected:
     wxToolBarBase       *m_NavBar;
     int                 m_NavBackId;
     int                 m_NavForwardId;
     wxToolBarBase       *m_NavBar;
     int                 m_NavBackId;
     int                 m_NavForwardId;
-    wxPalette           m_globalPalette;
+    wxString            m_openedlast;
        
             // Override this so we can do proper palette management!!
     virtual void OnDraw(wxDC& dc);
        
             // Override this so we can do proper palette management!!
     virtual void OnDraw(wxDC& dc);
@@ -114,8 +137,7 @@ public:
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = wxHW_SCROLLBAR_AUTO,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = wxHW_SCROLLBAR_AUTO,
-                const wxString& name = "htmlAppletWindow",
-                const wxPalette& globalPalette = wxNullPalette);
+                const wxString& name = "htmlAppletWindow");
 
             // Destructor
             ~wxHtmlAppletWindow();
 
             // Destructor
             ~wxHtmlAppletWindow();
@@ -128,7 +150,7 @@ public:
                 const wxSize& size);
 
             // Create an instance of an Qlet based on it's class name
                 const wxSize& size);
 
             // Create an instance of an Qlet based on it's class name
-            bool CreatePlugIn(const wxString& classId );
+            bool CreatePlugIn(const wxString& classId,const wxString& cmdLine = "");
 
             // Find an instance of an applet based on it's class name
             wxApplet *FindApplet(const wxString& className);
 
             // Find an instance of an applet based on it's class name
             wxApplet *FindApplet(const wxString& className);
@@ -157,7 +179,7 @@ public:
             void SetNavBar(wxToolBarBase *navBar);
 
             // Broadcast a message to all applets on the page
             void SetNavBar(wxToolBarBase *navBar);
 
             // Broadcast a message to all applets on the page
-            void SendMessage(wxEvent& msg);
+            void SendAppletMessage(wxAppletEvent& msg);
 
             // Register a cookie of data in the applet manager
             static bool RegisterCookie(const wxString& name,wxObject *cookie);
 
             // Register a cookie of data in the applet manager
             static bool RegisterCookie(const wxString& name,wxObject *cookie);
@@ -184,25 +206,7 @@ public:
             // Tries to lock the mutex. If it can't, returns immediately with false.
             bool TryLock();
 
             // Tries to lock the mutex. If it can't, returns immediately with false.
             bool TryLock();
 
-    };
-
-/****************************************************************************
-REMARKS:
-Defines the class for AppetProcess
-***************************************************************************/
-class AppletProcess : public wxProcess {
-public:
-            AppletProcess(
-                wxWindow *parent)
-                : wxProcess(parent)
-            {
-            }
-
-            // instead of overriding this virtual function we might as well process the
-            // event from it in the frame class - this might be more convenient in some
-            // cases
-    virtual void OnTerminate(int pid, int status);
-
+            wxString GetLastOpened() { return m_openedlast; }
     };
 
 /****************************************************************************
     };
 
 /****************************************************************************
@@ -213,7 +217,7 @@ class wxHtmlAppletCell : public wxHtmlCell
 {
 public:
     wxHtmlAppletCell(wxWindow *wnd, int w = 0);
 {
 public:
     wxHtmlAppletCell(wxWindow *wnd, int w = 0);
-    ~wxHtmlAppletCell() { m_Wnd->Destroy(); }
+    virtual ~wxHtmlAppletCell();
     virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
     virtual void DrawInvisible(wxDC& dc, int x, int y);
     virtual void Layout(int w);
     virtual void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
     virtual void DrawInvisible(wxDC& dc, int x, int y);
     virtual void Layout(int w);
@@ -223,6 +227,5 @@ protected:
             // width float is used in adjustWidth (it is in percents)
 };
 
             // width float is used in adjustWidth (it is in percents)
 };
 
-
 #endif // __WX_APPLET_WINDOW_H
 
 #endif // __WX_APPLET_WINDOW_H
 
index 660f609ae25541e73d2c51b6d6d24fe7ab47f505..1765f9b54e76a775c7f5637763086bccd3b79fb3 100644 (file)
@@ -26,9 +26,6 @@
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-
 // Include private headers
 #include "wx/applet/applet.h"
 #include "wx/applet/window.h"
 // Include private headers
 #include "wx/applet/applet.h"
 #include "wx/applet/window.h"
index cd9cc4e7dc0ab89b188d197f1ac5b2bee6101d00..9329a0bb20470721d75e28d4a92fd157740ace57 100644 (file)
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-#include "wx/utils.h"
-#include "wx/process.h"
-#include "wx/spawnbrowser.h"
-#include "wx/html/forcelnk.h"
-
-// crt
-#ifdef __WXMSW__
-#include <process.h>        // spawnl()
-#endif
-
 // Include private headers
 #include "wx/applet/applet.h"
 #include "wx/applet/window.h"
 // Include private headers
 #include "wx/applet/applet.h"
 #include "wx/applet/window.h"
 #include "wx/applet/prepecho.h"
 #include "wx/applet/prepifelse.h"
 
 #include "wx/applet/prepecho.h"
 #include "wx/applet/prepifelse.h"
 
+// wxWindows headers
+
+// Kind of pointless to use precompiled headers when this is the only
+// file in this lib that would need them.
+#include "wx/defs.h"
+#include "wx/spawnbrowser.h"
+#include "wx/html/forcelnk.h"
+#include "wx/log.h"
+#include "wx/msgdlg.h"
+#include "wx/tbarbase.h"
+
+// crt
+#ifdef __WXMSW__
+#include <process.h>        // spawnl()
+#endif
+
 /*---------------------------- Global variables ---------------------------*/
 
 wxHashTable wxHtmlAppletWindow::m_Cookies;             
 /*---------------------------- Global variables ---------------------------*/
 
 wxHashTable wxHtmlAppletWindow::m_Cookies;             
@@ -66,6 +70,9 @@ END_EVENT_TABLE()
 // Implement the class functions for wxHtmlAppletWindow
 IMPLEMENT_CLASS(wxHtmlAppletWindow, wxHtmlWindow);
 
 // Implement the class functions for wxHtmlAppletWindow
 IMPLEMENT_CLASS(wxHtmlAppletWindow, wxHtmlWindow);
 
+// Implement the dynamic class so it can be constructed dynamically
+IMPLEMENT_DYNAMIC_CLASS(VirtualData, wxObject);
+       
 // Define the wxAppletList implementation
 #include "wx/listimpl.cpp"
 WX_DEFINE_LIST(wxAppletList);
 // Define the wxAppletList implementation
 #include "wx/listimpl.cpp"
 WX_DEFINE_LIST(wxAppletList);
@@ -83,9 +90,8 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
     const wxPoint& pos,
     const wxSize& size,
     long style,
     const wxPoint& pos,
     const wxSize& size,
     long style,
-    const wxString& name,
-    const wxPalette& globalPalette)
-    : wxHtmlWindow(parent,id,pos,size,style,name), m_globalPalette(globalPalette)
+    const wxString& name)
+    : wxHtmlWindow(parent,id,pos,size,style,name), m_AppletList(wxKEY_STRING)
 {
     // Init our locks
     UnLock();
 {
     // Init our locks
     UnLock();
@@ -105,22 +111,13 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
     m_NavBackId = navBackId;
     m_NavForwardId = navForwardId;
 
     m_NavBackId = navBackId;
     m_NavForwardId = navForwardId;
 
-
-    // Set the key_type for applets
-    m_AppletList = wxAppletList(wxKEY_STRING);
-
     // Add HTML preprocessors
     // deleting preprocessors is done by the code within the window
     // Add HTML preprocessors
     // deleting preprocessors is done by the code within the window
-
     incPreprocessor = new wxIncludePrep(); // #include preprocessor
     incPreprocessor->ChangeDirectory(m_FS); // give it access to our filesys object
     incPreprocessor = new wxIncludePrep(); // #include preprocessor
     incPreprocessor->ChangeDirectory(m_FS); // give it access to our filesys object
-
-    wxEchoPrep * echoPreprocessor = new wxEchoPrep(); // #echo preprocessor
-    wxIfElsePrep * ifPreprocessor = new wxIfElsePrep();
-
     this->AddProcessor(incPreprocessor);
     this->AddProcessor(incPreprocessor);
-    this->AddProcessor(echoPreprocessor);
-    this->AddProcessor(ifPreprocessor);
+    this->AddProcessor(new wxEchoPrep());
+    this->AddProcessor(new wxIfElsePrep());
 }
 
 /****************************************************************************
 }
 
 /****************************************************************************
@@ -131,24 +128,15 @@ wxHtmlAppletWindow::~wxHtmlAppletWindow()
 {
 }
 
 {
 }
 
-#include "scitech.h"
-
 /****************************************************************************
 PARAMETERS:
 dc  - wxDC object to draw on
 
 REMARKS:
 /****************************************************************************
 PARAMETERS:
 dc  - wxDC object to draw on
 
 REMARKS:
-This function handles drawing the HTML applet window. Because the standard
-wxWindows classes don't properly handle palette management, we add code
-in here to properly select the global palette that we use for all drawing
-into the DC before we allow the regular wxWindows code to finish the
-drawing process.
 ****************************************************************************/
 void wxHtmlAppletWindow::OnDraw(
     wxDC& dc)
 {
 ****************************************************************************/
 void wxHtmlAppletWindow::OnDraw(
     wxDC& dc)
 {
-    // TODO: Only do this for <= 8bpp modes!
-    dc.SetPalette(m_globalPalette);
     wxHtmlWindow::OnDraw(dc);
 }
 
     wxHtmlWindow::OnDraw(dc);
 }
 
@@ -173,12 +161,7 @@ wxApplet *wxHtmlAppletWindow::CreateApplet(
     const wxSize& size)
 {
     // Dynamically create the class instance at runtime
     const wxSize& size)
 {
     // Dynamically create the class instance at runtime
-    wxClassInfo *info = wxClassInfo::FindClass(classId.c_str());
-    if (!info)
-        return NULL;
-    wxObject *obj = info->CreateObject();
-    if (!obj)
-        return NULL;
+    wxObject *obj = wxCreateDynamicObject(classId.c_str());
     wxApplet *applet = wxDynamicCast(obj,wxApplet);
     if (!applet)
         return NULL;
     wxApplet *applet = wxDynamicCast(obj,wxApplet);
     if (!applet)
         return NULL;
@@ -212,15 +195,12 @@ created dynamically based on string values embedded in the custom tags of an
 HTML page.
 ****************************************************************************/
 bool wxHtmlAppletWindow::CreatePlugIn(
 HTML page.
 ****************************************************************************/
 bool wxHtmlAppletWindow::CreatePlugIn(
-    const wxString& classId )
+    const wxString& classId,
+    const wxString& cmdLine)
 {
 {
-    // Dynamically create the class instance at runtime
-    wxClassInfo *info = wxClassInfo::FindClass(classId.c_str());
-    if (!info)
-        return false;
-    wxObject *obj = info->CreateObject();
-    if (!obj)
-        return false;
+    // Dynamically create the class instance at runtime, execute it
+    // and then destroy it.
+    wxObject *obj = wxCreateDynamicObject(classId.c_str());
     wxPlugIn *plugIn = wxDynamicCast(obj,wxPlugIn);
     if (!plugIn)
         return false;
     wxPlugIn *plugIn = wxDynamicCast(obj,wxPlugIn);
     if (!plugIn)
         return false;
@@ -228,6 +208,8 @@ bool wxHtmlAppletWindow::CreatePlugIn(
         delete plugIn;
         return false;
         }
         delete plugIn;
         return false;
         }
+    plugIn->Run(cmdLine);
+    delete plugIn;
     return true;
 }
 
     return true;
 }
 
@@ -293,22 +275,53 @@ bool wxHtmlAppletWindow::LoadPage(
         wxString cmdValue = link.AfterFirst('=');
 
         // Launches the default Internet browser for the system.
         wxString cmdValue = link.AfterFirst('=');
 
         // Launches the default Internet browser for the system.
-        if(!(cmd.CmpNoCase("?EXTERNAL"))){
+        if(!(cmd.CmpNoCase("?EXTERNAL"))) {
             return wxSpawnBrowser(this, cmdValue.c_str());
             }
 
         // Launches an external program on the system.
             return wxSpawnBrowser(this, cmdValue.c_str());
             }
 
         // Launches an external program on the system.
-        if (!(cmd.CmpNoCase("?EXECUTE"))){
-            int code = spawnl( P_NOWAIT, cmdValue , NULL );
-            return (!code);
+        if (!(cmd.CmpNoCase("?EXECUTE"))) {
+            int waitflag = P_NOWAIT;
+            bool ret;
+            wxString currentdir;
+            wxString filename, path, ext;
+
+            // Parse the params sent to the execute command. For now the only
+            // parm is "wait". wait will cause spawn wait, default is nowait.
+            // Since we only need one param for now I am not going to make this
+            // any smater then it needs to be. If we need more params later i'll
+            // fix it.
+            int i = cmdValue.Find('(');
+            if (i != -1) {
+                wxString param = cmdValue.AfterFirst('(');
+                cmdValue.Truncate(i);
+                if (!param.CmpNoCase("wait)"))
+                    waitflag = P_WAIT;
+                }
+
+            currentdir = wxGetCwd();
+            //we don't want to change the path of the virtual file system so we have to use these
+            //functions rather than the filesystem
+            wxSplitPath(cmdValue, &path, &filename, &ext);
+            if (path.CmpNoCase("") != 0) wxSetWorkingDirectory(path);
+
+            ret = !spawnl( waitflag, cmdValue , NULL );
+            //HACK should use wxExecute
+            //ret = wxExecute(filename, bool sync = FALSE, wxProcess *callback = NULL)
+            wxSetWorkingDirectory(currentdir);
+
+            return ret;
             }
 
         // Looks for a href in a variable stored as a cookie. The href can be
         // changed on the fly.
         if (!(cmd.CmpNoCase("?VIRTUAL"))){
             }
 
         // Looks for a href in a variable stored as a cookie. The href can be
         // changed on the fly.
         if (!(cmd.CmpNoCase("?VIRTUAL"))){
-            VirtualData& temp = *((VirtualData*)FindCookie(cmdValue));
-            if (&temp) {
-                href = temp.GetHref();
+            wxObject *obj = FindCookie(cmdValue);
+            VirtualData *virtData = wxDynamicCast(obj,VirtualData);
+            if (virtData) {
+                // recurse and loadpage, just in case the link is like another
+                // ? link
+                return LoadPage(virtData->GetHref());
                 }
             else {
 #ifdef CHECKED
                 }
             else {
 #ifdef CHECKED
@@ -320,16 +333,32 @@ bool wxHtmlAppletWindow::LoadPage(
 
         // This launches a qlet - It is like an applet but is more generic in that it
         // can be of any wxWin type so it then has the freedom to do more stuff.
 
         // This launches a qlet - It is like an applet but is more generic in that it
         // can be of any wxWin type so it then has the freedom to do more stuff.
-        if (!(cmd.CmpNoCase("?WXAPPLET"))){
-            if (!cmdValue.IsNull()){
-                if (!CreatePlugIn(cmdValue)){
+        if (!(cmd.CmpNoCase("?WXPLUGIN"))){
+            if (!cmdValue.IsNull()) {
+                // TODO: We are going to need to add code to parse the command line
+                //       parameters string in here in the future...
+                wxString cmdLine = link.AfterFirst('(');
+                cmdLine = cmdLine.BeforeLast(')');
+                if (!CreatePlugIn(cmdValue,cmdLine)) {
 #ifdef CHECKED
 #ifdef CHECKED
-                    wxLogError(_T("Launch Applet ERROR: '%s' does not exist."), cmdValue.c_str());
+                    wxLogError(_T("Launch PlugIn ERROR: '%s' does not exist."), cmdValue.c_str());
 #endif
                     }
                 }
              return true;
             }
 #endif
                     }
                 }
              return true;
             }
+
+        // This used in a link or href will take you back in the history.
+        if (!(cmd.CmpNoCase("?BACK"))){
+            HistoryBack();
+            return true;
+            }
+
+        // This used in a link or href will take you forward in the history
+        if (!(cmd.CmpNoCase("?FORWARD"))){
+            HistoryForward();
+            return true;
+            }
         }
 
     // Inform all the applets that the new page is being loaded
         }
 
     // Inform all the applets that the new page is being loaded
@@ -337,6 +366,7 @@ bool wxHtmlAppletWindow::LoadPage(
         (node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
     Show(false);
 
         (node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
     Show(false);
 
+    m_openedlast = href;
     bool stat = wxHtmlWindow::LoadPage(href);
     Show(true);
 
     bool stat = wxHtmlWindow::LoadPage(href);
     Show(true);
 
@@ -437,24 +467,16 @@ to all other applets on the current page. This is the primary form of
 communication between applets on the page if they need to inform each
 other of internal information.
 
 communication between applets on the page if they need to inform each
 other of internal information.
 
-Note that the event handling terminates as soon as the first wxApplet
-handles the event. If the event should be handled by all wxApplet's,
-the event handlers for the applets should not reset the wxEvent::Skip()
-value (ie: by default it is true).
 ****************************************************************************/
 ****************************************************************************/
-void wxHtmlAppletWindow::SendMessage(
-    wxEvent& msg)
+void wxHtmlAppletWindow::SendAppletMessage(
+    wxAppletEvent& msg)
 {
 {
-    // Preset the skip flag
-    msg.Skip();
+    // TODO: make a named target for messages, only send a message to the correct
+    // named applet
 
     // Process all applets in turn and send them the message
     for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext()) {
         (node->GetData())->OnMessage(msg);
 
     // Process all applets in turn and send them the message
     for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext()) {
         (node->GetData())->OnMessage(msg);
-        if (!msg.GetSkipped()){
-            wxMessageBox("BREAK");
-            break;
-            }
         }
 }
 
         }
 }
 
@@ -546,10 +568,10 @@ void wxHtmlAppletWindow::OnLoadPage(
     wxLoadPageEvent &event)
 {
     // Test the mutex lock.
     wxLoadPageEvent &event)
 {
     // Test the mutex lock.
-    if (!(IsLocked())){
+    if (!(IsLocked())) {
         Lock();
         Lock();
-        if (event.GetHtmlWindow() == this){
-            if (LoadPage(event.GetHRef())){
+        if (event.GetHtmlWindow() == this) {
+            if (LoadPage(event.GetHRef())) {
                 // wxPageLoadedEvent evt;
                 // NOTE: This is reserved for later use as we might need to send
                 // page loaded events to applets.
                 // wxPageLoadedEvent evt;
                 // NOTE: This is reserved for later use as we might need to send
                 // page loaded events to applets.
@@ -602,11 +624,13 @@ VirtualData is used to store information on the virtual links.
 VirtualData::VirtualData(
     wxString& name,
     wxString& group,
 VirtualData::VirtualData(
     wxString& name,
     wxString& group,
-    wxString& href )
+    wxString& href,
+    wxString& plugin )
 {
     m_name = name;
     m_group = group;
     m_href = href;
 {
     m_name = name;
     m_group = group;
     m_href = href;
+    m_plugIn = plugin;
 }
 
 /****************************************************************************
 }
 
 /****************************************************************************
@@ -621,18 +645,6 @@ VirtualData::VirtualData()
     m_href.Empty();
 }
 
     m_href.Empty();
 }
 
-/****************************************************************************
-PARAMETERS:
-REMARKS:
-****************************************************************************/
-void AppletProcess::OnTerminate(
-    int,
-    int )
-{
-    // we're not needed any more
-    delete this;
-}
-
 #include "wx/html/m_templ.h"
 
 /****************************************************************************
 #include "wx/html/m_templ.h"
 
 /****************************************************************************
@@ -652,63 +664,66 @@ TAG_HANDLER_PROC(tag)
     wxString            name;
     int                                width, height;
 
     wxString            name;
     int                                width, height;
 
+    // Get access to our wxHtmlAppletWindow class
        wnd = m_WParser->GetWindow();
        wnd = m_WParser->GetWindow();
+       if ((appletWindow = wxDynamicCast(wnd,wxHtmlAppletWindow)) == NULL)
+        return false;
 
 
-       if ((appletWindow = wxDynamicCast(wnd,wxHtmlAppletWindow)) != NULL){
-        wxSize size = wxDefaultSize;
-               int al;
-        if (tag.HasParam("WIDTH")) {
-            tag.GetParamAsInt("WIDTH", &width);
-            size.SetWidth(width);
-            }
-               
-        if (tag.HasParam("HEIGHT")) {
-            tag.GetParamAsInt("HEIGHT", &height);
-            size.SetHeight(height);
-            }
+    // Parse the applet dimensions from the tag
+    wxSize size = wxDefaultSize;
+    int al;
+    if (tag.HasParam("WIDTH")) {
+        tag.GetParamAsInt("WIDTH", &width);
+        size.SetWidth(width);
+        }
+    if (tag.HasParam("HEIGHT")) {
+        tag.GetParamAsInt("HEIGHT", &height);
+        size.SetHeight(height);
+        }
 
 
-        al = wxHTML_ALIGN_BOTTOM;
-        if (tag.HasParam(wxT("ALIGN"))) {
-            wxString alstr = tag.GetParam(wxT("ALIGN"));
-            alstr.MakeUpper();  // for the case alignment was in ".."
-            if (alstr == wxT("TEXTTOP") || alstr == wxT("TOP"))
-                al = wxHTML_ALIGN_TOP;
-            else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER")))
-                al = wxHTML_ALIGN_CENTER;
-            }
+    // Parse the applet alignment from the tag
+    al = wxHTML_ALIGN_BOTTOM;
+    if (tag.HasParam(wxT("ALIGN"))) {
+        wxString alstr = tag.GetParam(wxT("ALIGN"));
+        alstr.MakeUpper();  // for the case alignment was in ".."
+        if (alstr == wxT("TEXTTOP") || alstr == wxT("TOP"))
+            al = wxHTML_ALIGN_TOP;
+        else if ((alstr == wxT("CENTER")) || (alstr == wxT("ABSCENTER")))
+            al = wxHTML_ALIGN_CENTER;
+        }
 
 
-        if (tag.HasParam("CLASSID")){
-            classId = tag.GetParam("CLASSID");
-            if ( classId.IsNull() || classId.Len() == 0 ){
-                wxMessageBox("wxApplet tag error: CLASSID is NULL or empty.","Error",wxICON_ERROR);
-                return false;
-                }
-            if (tag.HasParam("NAME"))
-                name = tag.GetParam("NAME");
-
-            // If the name is NULL or len is zero then we assume that the html guy
-            // didn't include the name param which is optional.
-            if ( name.IsNull() || name.Len() == 0 )
-                name = classId;
-
-            // We got all the params and can now create the applet
-                       if ((applet = appletWindow->CreateApplet(classId, name, tag , size)) != NULL){
-                               applet->Show(true);
-                               m_WParser->OpenContainer()->InsertCell(new wxHtmlAppletCell(applet,al));
-                               }
-            else
-                wxMessageBox("wxApplet error: Could not create:" + classId + "," + name);
-                       }
-        else{
-            wxMessageBox("wxApplet tag error: Can not find CLASSID param.","Error",wxICON_ERROR);
+    // Create the applet based on it's class
+    if (tag.HasParam("CLASSID")) {
+        classId = tag.GetParam("CLASSID");
+        if (classId.IsNull() || classId.Len() == 0) {
+            wxMessageBox("wxApplet tag error: CLASSID is NULL or empty.","Error",wxICON_ERROR);
             return false;
             }
             return false;
             }
-        //Add more param parsing here. If or when spec changes.
-        //For now we'll ignore any other params those HTML guys
-        //might put in our tag.
+        if (tag.HasParam("NAME"))
+            name = tag.GetParam("NAME");
+
+        // If the name is NULL or len is zero then we assume that the html guy
+        // didn't include the name param which is optional.
+        if (name.IsNull() || name.Len() == 0)
+            name = classId;
+
+        // We got all the params and can now create the applet
+        if ((applet = appletWindow->CreateApplet(classId, name, tag , size)) != NULL) {
+            applet->Show(true);
+            m_WParser->OpenContainer()->InsertCell(new wxHtmlAppletCell(applet,al));
+            }
+        else
+            wxMessageBox("wxApplet error: Could not create:" + classId + "," + name);
+        }
+    else {
+        wxMessageBox("wxApplet tag error: Can not find CLASSID param.","Error",wxICON_ERROR);
+        return false;
         }
 
         }
 
-       return false;
+    // Add more param parsing here. If or when spec changes.
+    // For now we'll ignore any other params those HTML guys
+    // might put in our tag.
+       return true;
 }
 
 TAG_HANDLER_END(wxApplet)
 }
 
 TAG_HANDLER_END(wxApplet)
@@ -717,16 +732,20 @@ TAGS_MODULE_BEGIN(wxApplet)
     TAGS_MODULE_ADD(wxApplet)
 TAGS_MODULE_END(wxApplet)
 
     TAGS_MODULE_ADD(wxApplet)
 TAGS_MODULE_END(wxApplet)
 
-/*********************************************************************************
-wxHtmlAppletCell
-*********************************************************************************/
-wxHtmlAppletCell::wxHtmlAppletCell(wxWindow *wnd, int align) : wxHtmlCell()
+/****************************************************************************
+REMARKS:
+Constructor for the HTML cell class to store our wxApplet windows in
+the HTML page to be rendered by wxHTML.
+****************************************************************************/
+wxHtmlAppletCell::wxHtmlAppletCell(
+    wxWindow *wnd,
+    int align)
+    : wxHtmlCell()
 {
     int sx, sy;
     m_Wnd = wnd;
     m_Wnd->GetSize(&sx, &sy);
     m_Width = sx, m_Height = sy;
 {
     int sx, sy;
     m_Wnd = wnd;
     m_Wnd->GetSize(&sx, &sy);
     m_Width = sx, m_Height = sy;
-
     switch (align) {
         case wxHTML_ALIGN_TOP :
             m_Descent = m_Height;
     switch (align) {
         case wxHTML_ALIGN_TOP :
             m_Descent = m_Height;
@@ -739,59 +758,76 @@ wxHtmlAppletCell::wxHtmlAppletCell(wxWindow *wnd, int align) : wxHtmlCell()
             m_Descent = 0;
             break;
         }
             m_Descent = 0;
             break;
         }
-
     SetCanLiveOnPagebreak(FALSE);
 }
 
     SetCanLiveOnPagebreak(FALSE);
 }
 
+/****************************************************************************
+REMARKS:
+Implementation for the HTML cell class to store our wxApplet windows in
+the HTML page to be rendered by wxHTML.
+****************************************************************************/
+wxHtmlAppletCell::~wxHtmlAppletCell()
+{
+    delete m_Wnd;
+}
 
 
-void wxHtmlAppletCell::Draw(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(view_y1), int WXUNUSED(view_y2))
+/****************************************************************************
+REMARKS:
+Code to draw the html applet cell
+****************************************************************************/
+void wxHtmlAppletCell::Draw(
+    wxDC& WXUNUSED(dc),
+    int WXUNUSED(x),
+    int WXUNUSED(y),
+    int WXUNUSED(view_y1),
+    int WXUNUSED(view_y2))
 {
 {
-    int absx = 0, absy = 0, stx, sty;
-    wxHtmlCell *c = this;
+    int         absx = 0, absy = 0, stx, sty;
+    wxHtmlCell  *c = this;
 
 
-    while (c)
-    {
+    while (c) {
         absx += c->GetPosX();
         absy += c->GetPosY();
         c = c->GetParent();
         absx += c->GetPosX();
         absy += c->GetPosY();
         c = c->GetParent();
-    }
-
+        }
     ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
     m_Wnd->Move(absx - wxHTML_SCROLL_STEP * stx, absy  - wxHTML_SCROLL_STEP * sty);
 }
 
     ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
     m_Wnd->Move(absx - wxHTML_SCROLL_STEP * stx, absy  - wxHTML_SCROLL_STEP * sty);
 }
 
-
-
-void wxHtmlAppletCell::DrawInvisible(wxDC& WXUNUSED(dc), int WXUNUSED(x), int WXUNUSED(y))
+/****************************************************************************
+REMARKS:
+Code to draw the html applet cell invisibly
+****************************************************************************/
+void wxHtmlAppletCell::DrawInvisible(
+    wxDC& WXUNUSED(dc),
+    int WXUNUSED(x),
+    int WXUNUSED(y))
 {
 {
-    int absx = 0, absy = 0, stx, sty;
-    wxHtmlCell *c = this;
+    int         absx = 0, absy = 0, stx, sty;
+    wxHtmlCell  *c = this;
 
 
-    while (c)
-    {
+    while (c) {
         absx += c->GetPosX();
         absy += c->GetPosY();
         c = c->GetParent();
         absx += c->GetPosX();
         absy += c->GetPosY();
         c = c->GetParent();
-    }
-
+        }
     ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
     m_Wnd->Move(absx - wxHTML_SCROLL_STEP * stx, absy  - wxHTML_SCROLL_STEP * sty);
 }
 
     ((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
     m_Wnd->Move(absx - wxHTML_SCROLL_STEP * stx, absy  - wxHTML_SCROLL_STEP * sty);
 }
 
-
-
-void wxHtmlAppletCell::Layout(int w)
+/****************************************************************************
+REMARKS:
+Code to layout the html applet cell.
+****************************************************************************/
+void wxHtmlAppletCell::Layout(
+    int w)
 {
     int sx, sy;
     m_Wnd->GetSize(&sx, &sy);
     m_Width = sx, m_Height = sy;
 {
     int sx, sy;
     m_Wnd->GetSize(&sx, &sy);
     m_Width = sx, m_Height = sy;
-
     wxHtmlCell::Layout(w);
 }
 
     wxHtmlCell::Layout(w);
 }
 
-
-
-
 // This is our little forcelink hack.
 FORCE_LINK(loadpage)
 
 // This is our little forcelink hack.
 FORCE_LINK(loadpage)
 
index 5f98f1dd63d898055fa89848ddfa877b577c21e8..3da0f23d4577a3d9629fd7d48b1261999216af21 100644 (file)
 ****************************************************************************/
 
 // For compilers that support precompilation
 ****************************************************************************/
 
 // For compilers that support precompilation
-#include "wx/wxprec.h"
+
+#include "wx/applet/echovar.h"
+#include "wx/msgdlg.h"
 #include "wx/html/forcelnk.h"
 
 // Include private headers
 #include "wx/html/forcelnk.h"
 
 // Include private headers
-#include "wx/applet/echovar.h"
 
 /*---------------------------- Global variables ---------------------------*/
 
 
 /*---------------------------- Global variables ---------------------------*/
 
-// Implement the dynamic class so it can be constructed dynamically
-IMPLEMENT_ABSTRACT_CLASS(wxEchoVariable, wxObject);
+static wxEchoVariable   *wxEchoVariable::sm_first = NULL;
+static wxHashTable      *wxEchoVariable::sm_varTable = NULL;
 
 /*----------------------------- Implementation ----------------------------*/
 
 /****************************************************************************
 PARAMETERS:
 
 /*----------------------------- Implementation ----------------------------*/
 
 /****************************************************************************
 PARAMETERS:
-cls     - The String name of the class
-parms   - an optional parameter string to pass off to the child class
+varName         - The String name of the class
+getValueFn      - Pointer to the function that returns the echo variable value
 
 
-RETURNS:
-The string value of the variable
+REMARKS:
+Constructor for the wxEchoVariable class that self registers itself with
+the list of all echo variables when the static class instance is created
+at program init time (remember all the constructors get called before
+the main program function!).
+****************************************************************************/
+wxEchoVariable::wxEchoVariable(
+    const char *varName,
+    wxEchoVariableGetValueFn getValueFn)
+{
+    m_varName = varName;
+    m_getValueFn = getValueFn;
+    m_next = sm_first;
+    sm_first = this;
+}
 
 
+/****************************************************************************
 REMARKS:
 REMARKS:
-To grab a value from any class which is derived from this one simple use this
-static function and the name of the derived class to get the value.
-This static function is the only function implemented in this base class
-basically this is provided for an easier method of grabbing a variable. We
-keep all the dynamic object handling in this class to avoid confusing the source
-where these are used.
+Initializes parent pointers and hash table for fast searching for echo
+variables.
+****************************************************************************/
+void wxEchoVariable::Initialize()
+{
+    wxEchoVariable::sm_varTable = new wxHashTable(wxKEY_STRING);
+
+    // Index all class infos by their class name
+    wxEchoVariable *info = sm_first;
+    while (info) {
+        if (info->m_varName)
+            sm_varTable->Put(info->m_varName, info);
+        info = info->m_next;
+        }
+}
 
 
-SEE ALSO:
-wxEchoPrep
+/****************************************************************************
+REMARKS:
+Clean up echo variable hash tables on application exit.
 ****************************************************************************/
 ****************************************************************************/
-static wxString wxEchoVariable::FindValue(
-    const wxString &cls,
-    const char *parms)
+void wxEchoVariable::CleanUp()
 {
 {
-    wxObject * tmpclass;
+    delete wxEchoVariable::sm_varTable;
+    wxEchoVariable::sm_varTable = NULL;
+}
 
 
-    tmpclass = wxCreateDynamicObject(wxString("wxEchoVariable") + cls);
-    if (!tmpclass) {
-#ifdef CHECKED         
-        wxMessageBox(wxString("wxHTML #echo error: Class not found (") + cls + wxString(")."),"Error",wxICON_ERROR);
-#endif
-        return wxString("");
-        }
+/****************************************************************************
+PARAMETERS:
+varName         - The String name of the class
+parms           - Parameter string for the echo variable
 
 
-    wxEchoVariable * ev = wxDynamicCast(tmpclass, wxEchoVariable);
-               
-    if (!ev) {
+REMARKS:
+Constructor for the wxEchoVariable class that self registers itself with
+the list of all echo variables when the static class instance is created
+at program init time (remember all the constructors get called before
+the main program function!).
+****************************************************************************/
+wxString wxEchoVariable::GetValue(
+    const wxChar *varName,
+    const wxChar *parms)
+{
+    wxEchoVariable *info = wxEchoVariable::FindVariable(varName);
+    if (info)
+        return info->m_getValueFn(parms);
 #ifdef CHECKED         
 #ifdef CHECKED         
-        wxMessageBox(wxString("wxHTML #echo error: Class is not a valid echo variable (") + cls + wxString(")."),"Error",wxICON_ERROR);
+    wxMessageBox(wxString("wxHTML #echo error: Class is not a valid echo variable (") + varName + wxString(")."),"Error",wxICON_ERROR);
 #endif         
 #endif         
-        return wxString("");
-               }
-
-    return ev->GetValue(parms);
+    return wxString("");
 }
 
 }
 
+/****************************************************************************
+PARAMETERS:
+varName       - The String name of the class
+
+RETURNS:
+True if the echo variable exists, false if not.
+****************************************************************************/
+bool wxEchoVariable::Exists(
+    const wxChar *varName)
+{
+    return wxEchoVariable::FindVariable(varName) != NULL;
+}
 
 /*------------------------ Macro Documentation ---------------------------*/
 
 
 /*------------------------ Macro Documentation ---------------------------*/
 
@@ -177,4 +218,5 @@ void STRING_ECHO_VARIABLE(
     wxString string);
 
 // hack to make this file link
     wxString string);
 
 // hack to make this file link
-FORCE_LINK_ME(echovar)                         
+FORCE_LINK_ME(echovar)
+
index 7c82bb5a74e552a745d9475fa6865b55cd92ccf5..e7280b23fef6c892d08c1fd9e1884890949c3c59 100644 (file)
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-#include "wx/html/forcelnk.h"
-
 // Include private headers
 #include "wx/applet/ifelsevar.h"
 
 // Include private headers
 #include "wx/applet/ifelsevar.h"
 
+// wxWindows forcelink macro
+#include "wx/html/forcelnk.h"
+#include "wx/msgdlg.h"
+
 /*---------------------------- Global variables ---------------------------*/
 
 /*---------------------------- Global variables ---------------------------*/
 
-// Implement the dynamic class so it can be constructed dynamically
-IMPLEMENT_ABSTRACT_CLASS(wxIfElseVariable, wxObject);
+static wxIfElseVariable *wxIfElseVariable::sm_first = NULL;
+static wxHashTable      *wxIfElseVariable::sm_varTable = NULL;
 
 /*----------------------------- Implementation ----------------------------*/
 
 /****************************************************************************
 PARAMETERS:
 
 /*----------------------------- Implementation ----------------------------*/
 
 /****************************************************************************
 PARAMETERS:
-cls     - The String name of the class
+varName         - The String name of the class
+getValueFn      - Pointer to the function that returns the echo variable value
 
 
-RETURNS:
-The boolean value of the variable
+REMARKS:
+Constructor for the wxIfElseVariable class that self registers itself with
+the list of all echo variables when the static class instance is created
+at program init time (remember all the constructors get called before
+the main program function!).
+****************************************************************************/
+wxIfElseVariable::wxIfElseVariable(
+    const char *varName,
+    wxIfElseVariableGetValueFn getValueFn)
+{
+    m_varName = varName;
+    m_getValueFn = getValueFn;
+    m_next = sm_first;
+    sm_first = this;
+}
 
 
+/****************************************************************************
 REMARKS:
 REMARKS:
-To grab a value from any class which is derived from this one simple use this
-static function and the name of the derived class to get the value.
-This static function is the only function implemented in this base class
-basically this is provided for an easier method of grabbing a variable. We
-keep all the dynamic object handling in this class to avoid confusing the source
-where these are used.
+Initializes parent pointers and hash table for fast searching for echo
+variables.
+****************************************************************************/
+void wxIfElseVariable::Initialize()
+{
+    wxIfElseVariable::sm_varTable = new wxHashTable(wxKEY_STRING);
+
+    // Index all class infos by their class name
+    wxIfElseVariable *info = sm_first;
+    while (info) {
+        if (info->m_varName)
+            sm_varTable->Put(info->m_varName, info);
+        info = info->m_next;
+        }
+}
 
 
-SEE ALSO:
-wxIfElsePrep
+/****************************************************************************
+REMARKS:
+Clean up echo variable hash tables on application exit.
 ****************************************************************************/
 ****************************************************************************/
-static bool wxIfElseVariable::FindValue(
-    const wxString &cls)
+void wxIfElseVariable::CleanUp()
 {
 {
-    wxObject * tmpclass;
+    delete wxIfElseVariable::sm_varTable;
+    wxIfElseVariable::sm_varTable = NULL;
+}
 
 
-    tmpclass = wxCreateDynamicObject(wxString("wxIfElseVariable") + cls);
-    if (!tmpclass) {
-#ifdef CHECKED         
-        wxMessageBox(wxString("wxHTML #if error: Class not found (") + cls + wxString(")."),"Error",wxICON_ERROR);
-#endif
-        return wxString("");
-        }
+/****************************************************************************
+PARAMETERS:
+varName       - The String name of the class
 
 
-    wxIfElseVariable * ev = wxDynamicCast(tmpclass, wxIfElseVariable);
-               
-    if (!ev) {
+REMARKS:
+Constructor for the wxIfElseVariable class that self registers itself with
+the list of all ifelse variables when the static class instance is created
+at program init time (remember all the constructors get called before
+the main program function!).
+****************************************************************************/
+bool wxIfElseVariable::GetValue(
+    const wxChar *varName)
+{
+    wxIfElseVariable *info = wxIfElseVariable::FindVariable(varName);
+    if (info) {
+        // Return the forced value if the variable has been forced.
+        if (info->forced)
+            return info->forceVal;
+        return info->m_getValueFn();
+        }
 #ifdef CHECKED         
 #ifdef CHECKED         
-        wxMessageBox(wxString("wxHTML #if error: Class is not a valid ifelse variable (") + cls + wxString(")."),"Error",wxICON_ERROR);
+    wxMessageBox(wxString("wxHTML #if error: Class is not a valid if else variable (") + varName + wxString(")."),"Error",wxICON_ERROR);
 #endif         
 #endif         
-        return wxString("");
-               }
+    return wxString("");
+}
+
+/****************************************************************************
+PARAMETERS:
+varName       - The String name of the class
+
+RETURNS:
+True if the if/else variable exists, false if not.
+****************************************************************************/
+bool wxIfElseVariable::Exists(
+    const wxChar *varName)
+{
+    return wxIfElseVariable::FindVariable(varName) != NULL;
+}
 
 
-    return ev->GetValue();
+/****************************************************************************
+PARAMETERS:
+varName     - The String name of the class
+val         - Value to force the if/else variable with
+
+REMARKS:
+Function to forcibly override the value of an if/else variable for
+testing purposes. Once the variable has been forced, it will always return
+the forced value until the application exists.
+
+NOTE:   This is only available when compiled in CHECKED mode.
+****************************************************************************/
+void wxIfElseVariable::Force(
+    const wxChar *varName,
+    bool val)
+{
+    wxIfElseVariable *info = wxIfElseVariable::FindVariable(varName);
+    if (info) {
+        info->forced = true;
+        info->forceVal = val;
+        }
+    else {
+#ifdef CHECKED         
+        wxMessageBox(wxString("wxHTML #if error: Class is not a valid if else variable (") + varName + wxString(")."),"Error",wxICON_ERROR);
+#endif
+        }              
 }
 
 /*------------------------ Macro Documentation ---------------------------*/
 }
 
 /*------------------------ Macro Documentation ---------------------------*/
@@ -155,5 +228,5 @@ void IFELSE_VARIABLE(
     const char *name,
     bool state);
 
     const char *name,
     bool state);
 
-
 FORCE_LINK_ME(ifelsevar)
 FORCE_LINK_ME(ifelsevar)
+
index 32f8af20c4fd4dcf7e5adf7ecefa7ef4cd83611a..705a2e4a61faed62a4f33a1fbb7f282524a037ec 100644 (file)
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-#include "wx/html/forcelnk.h"
-
 // Include private headers
 #include "wx/applet/loadpage.h"
 
 // Include private headers
 #include "wx/applet/loadpage.h"
 
+// wxWindows forcelink macro
+#include "wx/html/forcelnk.h"
+
 /*------------------------- Implementation --------------------------------*/
 
 // Implement the class functions for wxLoadPageEvent
 /*------------------------- Implementation --------------------------------*/
 
 // Implement the class functions for wxLoadPageEvent
@@ -59,20 +58,6 @@ wxLoadPageEvent::wxLoadPageEvent(
     m_eventType = wxEVT_LOAD_PAGE;
 }
 
     m_eventType = wxEVT_LOAD_PAGE;
 }
 
-/****************************************************************************
-REMARKS:
-Function to copy the wxLoadPageEvent object
-****************************************************************************/
-void wxLoadPageEvent::CopyObject(
-    wxObject& obj_d) const
-{
-    wxLoadPageEvent *obj = (wxLoadPageEvent*)&obj_d;
-    wxEvent::CopyObject(obj_d);
-    obj->m_hRef         = m_hRef;
-    obj->m_htmlWindow   = m_htmlWindow;
-}
-
-
 /****************************************************************************
 REMARKS:
 Constructor for the wxPageLoadedEvent class
 /****************************************************************************
 REMARKS:
 Constructor for the wxPageLoadedEvent class
@@ -82,17 +67,6 @@ wxPageLoadedEvent::wxPageLoadedEvent()
     m_eventType = wxEVT_LOAD_PAGE;
 }
 
     m_eventType = wxEVT_LOAD_PAGE;
 }
 
-/****************************************************************************
-REMARKS:
-Function to copy the wxPageLoadedEvent object
-****************************************************************************/
-void wxPageLoadedEvent::CopyObject(
-    wxObject& obj_d) const
-{
-    wxPageLoadedEvent *obj = (wxPageLoadedEvent*)&obj_d;
-    wxEvent::CopyObject(obj_d);
-}
-
 // This is out little force link hack
 FORCE_LINK_ME(loadpage)
 
 // This is out little force link hack
 FORCE_LINK_ME(loadpage)
 
index 9802ce799144cc906f0506049714f357171db4e9..2e67780b9874bf0735582f7793deb7353b55c394 100644 (file)
@@ -26,9 +26,6 @@
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-
 // Include private headers
 #include "wx/applet/plugin.h"
 #include "wx/applet/window.h"
 // Include private headers
 #include "wx/applet/plugin.h"
 #include "wx/applet/window.h"
@@ -36,7 +33,7 @@
 /*------------------------- Implementation --------------------------------*/
 
 // Implement the abstract class functions
 /*------------------------- Implementation --------------------------------*/
 
 // Implement the abstract class functions
-IMPLEMENT_ABSTRACT_CLASS(wxPlugIn, wxObject);
+IMPLEMENT_ABSTRACT_CLASS(wxPlugIn, wxEvtHandler);
 
 /****************************************************************************
 REMARKS:
 
 /****************************************************************************
 REMARKS:
@@ -57,4 +54,12 @@ wxPlugIn::~wxPlugIn()
 {
 }
 
 {
 }
 
+/****************************************************************************
+REMARKS:
+Destructor for the wxPlugIn class.
+****************************************************************************/
+void wxPlugIn::Run(
+    const wxString& WXUNUSED(cmdLine))
+{
+}
 
 
index 67b38016fea7ab43432c7b6733311099507e8cf4..8181077116509652ad21c04ec51293622e10ec24 100644 (file)
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-#include "wx/html/forcelnk.h"
-
 // Include private headers
 #include "wx/applet/prepecho.h"
 #include "wx/applet/echovar.h"
 
 // Include private headers
 #include "wx/applet/prepecho.h"
 #include "wx/applet/echovar.h"
 
-/*---------------------------- Global variables ---------------------------*/
+// Force Link macro
+#include "wx/html/forcelnk.h"
 
 
+// wxWindows headers
+#include "wx/msgdlg.h"
 
 /*----------------------------- Implementation ----------------------------*/
 
 
 /*----------------------------- Implementation ----------------------------*/
 
@@ -68,7 +67,6 @@ wxString wxEchoPrep::Process(
        
        while ((i = (output.Lower()).Find(ft)) != -1) {
                // Loop until every #echo directive is found
        
        while ((i = (output.Lower()).Find(ft)) != -1) {
                // Loop until every #echo directive is found
-               
                int n, c, end;
         wxString cname, parms;
         wxString tag;
                int n, c, end;
         wxString cname, parms;
         wxString tag;
@@ -97,7 +95,7 @@ wxString wxEchoPrep::Process(
             cname = tag.Mid(10, n);
 
             // grab the value from the class, put it in tag since the data is no longer needed
             cname = tag.Mid(10, n);
 
             // grab the value from the class, put it in tag since the data is no longer needed
-            tag = wxEchoVariable::FindValue(cname, NULL);
+            tag = wxEchoVariable::GetValue(cname, NULL);
             }
         else {
             // Find the parms
             }
         else {
             // Find the parms
@@ -114,9 +112,7 @@ wxString wxEchoPrep::Process(
             cname = tag.Mid(10, n);
 
             // grab the value from the class, put it in tag since the data is no longer needed
             cname = tag.Mid(10, n);
 
             // grab the value from the class, put it in tag since the data is no longer needed
-            tag = wxEchoVariable::FindValue(cname, parms.c_str());
-
-
+            tag = wxEchoVariable::GetValue(cname, parms.c_str());
             }
         // remove ampersands and <> chars
         tag.Replace("&", "&amp;");
             }
         // remove ampersands and <> chars
         tag.Replace("&", "&amp;");
@@ -125,7 +121,6 @@ wxString wxEchoPrep::Process(
 
         output = (output.Mid(0,i) + tag + output.Mid(i));
                }
 
         output = (output.Mid(0,i) + tag + output.Mid(i));
                }
-       
     return output;
 }
 
     return output;
 }
 
index 7cda90bc5f2d857c13edcded85ac47fb48c07213..0724dae64483b61966471dd868ec95401b777262 100644 (file)
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-#include "wx/html/forcelnk.h"
-
 // Include private headers
 #include "wx/applet/prepifelse.h"
 #include "wx/applet/ifelsevar.h"
 // Include private headers
 #include "wx/applet/prepifelse.h"
 #include "wx/applet/ifelsevar.h"
+#include "wx/applet/echovar.h"
+#include "wx/string.h"
 
 
-/*---------------------------- Global variables ---------------------------*/
-
+// Force link macro
+#include "wx/html/forcelnk.h"
+// wxWindows
+#include "wx/msgdlg.h"
 
 /*----------------------------- Implementation ----------------------------*/
 
 
 /*----------------------------- Implementation ----------------------------*/
 
@@ -65,10 +65,56 @@ int ReverseFind(
             return p;
         p--;
         }
             return p;
         p--;
         }
-
     return -1;
 }
 
     return -1;
 }
 
+/* {SECRET} */
+/****************************************************************************
+REMARKS:
+tells if a character is a letter.
+replace this when wxWindows gets regex library. (without strange licensing
+restrictions)
+****************************************************************************/
+bool IsLetter(
+    char c, bool acceptspace = false)
+{
+    if (acceptspace && (c == ' ')) return true;
+    if (c >= '0' && c <= '9') return true;
+    return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || c == '\"' || c == '\'' );
+}
+
+#define IsQuote(c) (c == '\'' || c == '\"')
+
+/* {SECRET} */
+/****************************************************************************
+REMARKS:
+tells if a character is a letter.
+replace this when wxWindows gets regex library. (without strange licensing
+restrictions)
+****************************************************************************/
+wxString GetEquals(
+    wxString var,
+    wxString value)
+{
+    if (!wxEchoVariable::Exists(var)) {
+        // TODO: when we implement the set variable, check for a set variable as well
+        #ifdef CHECKED         
+            wxMessageBox(wxString("wxHTML #if\\else error: Variable ") + var + wxString(" not found."),"Error",wxICON_ERROR);
+        #endif
+        return wxString("0"); // false
+        }
+
+    wxString tmp = wxEchoVariable::GetValue(var);
+
+    if (IsQuote( value.GetChar(0) ))
+        value = value.Mid(1);
+    if (IsQuote(value.GetChar(value.Length()-1)))
+        value = value.Mid(0,value.Length()-1);
+
+    if (tmp.CmpNoCase(value) == 0) return wxString("1");
+    return wxString("0");
+}
+
 /****************************************************************************
 PARAMETERS:
 str        - text of #if statement
 /****************************************************************************
 PARAMETERS:
 str        - text of #if statement
@@ -77,12 +123,14 @@ RETURNS:
 true or false depending on how it evaluated
 
 REMARKS:
 true or false depending on how it evaluated
 
 REMARKS:
+TODO: rewrite this whole thing using regular expressions when they are done.
 
 SEE ALSO:
 wxIfElseVariable
 ****************************************************************************/
 
 SEE ALSO:
 wxIfElseVariable
 ****************************************************************************/
-bool ParseIfStatementValue(wxString &str) {
-
+bool ParseIfStatementValue(
+    wxString &str)
+{
     // Find out if the tag has parenthesis
     // recursive to parse the text within the parenthesis,
     // replacing the text with 1 or 0, (hardcoded true or false)
     // Find out if the tag has parenthesis
     // recursive to parse the text within the parenthesis,
     // replacing the text with 1 or 0, (hardcoded true or false)
@@ -93,7 +141,6 @@ bool ParseIfStatementValue(wxString &str) {
         int nextbeg, nextend;
         int parencount = 1, min = b+1;
         do {
         int nextbeg, nextend;
         int parencount = 1, min = b+1;
         do {
-
             nextbeg = str.find('(', min);
             nextend = str.find(')', min);
             if (nextbeg < nextend && nextbeg != wxString::npos) {
             nextbeg = str.find('(', min);
             nextend = str.find(')', min);
             if (nextbeg < nextend && nextbeg != wxString::npos) {
@@ -106,9 +153,9 @@ bool ParseIfStatementValue(wxString &str) {
                 }
 
             if (nextend == wxString::npos) {
                 }
 
             if (nextend == wxString::npos) {
-                #ifdef CHECKED         
+#ifdef CHECKED         
                 wxMessageBox("wxHTML #if\\else error: Unmatched parenthesis in #if expression.","Error",wxICON_ERROR);
                 wxMessageBox("wxHTML #if\\else error: Unmatched parenthesis in #if expression.","Error",wxICON_ERROR);
-                #endif
+#endif
                 return true;
                 }
             // once parencount reaches 0 again we have found our matchin )
                 return true;
                 }
             // once parencount reaches 0 again we have found our matchin )
@@ -124,7 +171,6 @@ bool ParseIfStatementValue(wxString &str) {
         // Add extra spaces just in case of NOT(VAL)
         if (val) str = str.Mid(0, b) + " 1" + str.Mid(e+1);
         else str = str.Mid(0, b) + " 0" + str.Mid(e+1);
         // Add extra spaces just in case of NOT(VAL)
         if (val) str = str.Mid(0, b) + " 1" + str.Mid(e+1);
         else str = str.Mid(0, b) + " 0" + str.Mid(e+1);
-
         }
 
     // Remove spaces from left and right
         }
 
     // Remove spaces from left and right
@@ -135,6 +181,51 @@ bool ParseIfStatementValue(wxString &str) {
     // this makes only one special case necessary for each later on
     str.Replace(" AND ", "&&");
     str.Replace(" OR ", "||");
     // this makes only one special case necessary for each later on
     str.Replace(" AND ", "&&");
     str.Replace(" OR ", "||");
+    str.Replace(" EQUALS ", "==");
+
+    // Check for equals statements
+    // == statements are special because they are evaluated as a single block
+    int equ;
+    equ = str.find("==");
+    while (equ != wxString::npos) {
+        int begin, end;
+        int begin2, end2; // ends of words
+        begin = equ-1;
+        end = equ+2;
+
+        // remove spaces, find extents
+        while (end < str.Length() && str.GetChar(end) == ' ')
+            end++;
+        while (begin >= 0 && str.GetChar(begin) == ' ')
+            begin--;
+        end2 = end;
+        begin2 = begin;
+        if (str.GetChar(end2) == '\'' || str.GetChar(end2) == '\"') {
+            end2++;
+            while (end2 < str.Length() && str.GetChar(end2) != '\'' && str.GetChar(end2) != '\"' )
+                end2++;
+            end2++;
+            }
+        else {
+            while (end2 < str.Length() && IsLetter(str.GetChar(end2)))
+                end2++;
+            }
+        while (begin >= 0 && IsLetter(str.GetChar(begin)))
+            begin--;
+
+        if (begin < 0) begin = 0;
+        else begin++;
+        if (end2 >= str.Length()) end2 = str.Length();
+
+        wxString tmpeq = GetEquals(str.Mid(begin, begin2-begin+1), str.Mid(end, end2-end));
+        str = str.Mid(0, begin) + wxString(" ") + tmpeq + wxString(" ") +
+            str.Mid(end2);
+        equ = str.find("==");
+
+        // Remove spaces from left and right
+        str.Trim(false);
+        str.Trim(true);
+        }
 
     // We use ReverseFind so that the whole left expression gets evaluated agains
     // the right single item, creating a left -> right evaluation
 
     // We use ReverseFind so that the whole left expression gets evaluated agains
     // the right single item, creating a left -> right evaluation
@@ -145,7 +236,7 @@ bool ParseIfStatementValue(wxString &str) {
     if ( (and != -1) || (or != -1) ) {
         wxString tag1, tag2;
         // handle the rightmost first to force left->right evaluation
     if ( (and != -1) || (or != -1) ) {
         wxString tag1, tag2;
         // handle the rightmost first to force left->right evaluation
-        if (and > or) {
+        if ( (and > or) ) {
             return (
                 ParseIfStatementValue(tag2 = str.Mid(and+2)) &&
                 ParseIfStatementValue(tag1 = str.Mid(0, and)) );
             return (
                 ParseIfStatementValue(tag2 = str.Mid(and+2)) &&
                 ParseIfStatementValue(tag1 = str.Mid(0, and)) );
@@ -155,7 +246,6 @@ bool ParseIfStatementValue(wxString &str) {
                 ParseIfStatementValue(tag2 = str.Mid(or+2)) ||
                 ParseIfStatementValue(tag1 = str.Mid(0, or)) );
             }
                 ParseIfStatementValue(tag2 = str.Mid(or+2)) ||
                 ParseIfStatementValue(tag1 = str.Mid(0, or)) );
             }
-
         }
 
     // By the time we get to this place in the function we are guarenteed to have a single
         }
 
     // By the time we get to this place in the function we are guarenteed to have a single
@@ -175,11 +265,10 @@ bool ParseIfStatementValue(wxString &str) {
         }
 
     // now all we have left is the name of the class or a hardcoded 0 or 1
         }
 
     // now all we have left is the name of the class or a hardcoded 0 or 1
-
     if (str == "") {
     if (str == "") {
-        #ifdef CHECKED         
+#ifdef CHECKED         
         wxMessageBox("wxHTML #if\\else error: Empty expression in #if\\#elif statement.","Error",wxICON_ERROR);
         wxMessageBox("wxHTML #if\\else error: Empty expression in #if\\#elif statement.","Error",wxICON_ERROR);
-        #endif
+#endif
         return true;
         }
 
         return true;
         }
 
@@ -189,7 +278,7 @@ bool ParseIfStatementValue(wxString &str) {
     if (str == "1") return !notval;
 
     // Grab the value from the variable class identified by cname
     if (str == "1") return !notval;
 
     // Grab the value from the variable class identified by cname
-    bool value = wxIfElseVariable::FindValue(str);
+    bool value = wxIfElseVariable::GetValue(str);
     if (notval) value = !value;
     return value;
 
     if (notval) value = !value;
     return value;
 
@@ -220,7 +309,6 @@ wxString wxIfElsePrep::Process(
     char ftelse[] = "<!--#else-->";
     char ftnot[] = "<!--#if not ";
     char ftnot2[] = "<!--#if !";
     char ftelse[] = "<!--#else-->";
     char ftnot[] = "<!--#if not ";
     char ftnot2[] = "<!--#if !";
-
     char ftelif[] = "<!--#elif ";
        
     // make a copy so we can replace text as we go without affecting the original
     char ftelif[] = "<!--#elif ";
        
     // make a copy so we can replace text as we go without affecting the original
@@ -234,9 +322,9 @@ wxString wxIfElsePrep::Process(
         e = output.find("-->", b + strlen(ftelif));
 
         if (e == wxString::npos) {
         e = output.find("-->", b + strlen(ftelif));
 
         if (e == wxString::npos) {
-            #ifdef CHECKED             
+#ifdef CHECKED         
             wxMessageBox("wxHTML #elif error: Premature end of file while parsing #elif.","Error",wxICON_ERROR);
             wxMessageBox("wxHTML #elif error: Premature end of file while parsing #elif.","Error",wxICON_ERROR);
-            #endif
+#endif
             break;
             }
 
             break;
             }
 
@@ -259,9 +347,9 @@ wxString wxIfElsePrep::Process(
                 }
 
             if (nextendif == wxString::npos) {
                 }
 
             if (nextendif == wxString::npos) {
-                #ifdef CHECKED         
+#ifdef CHECKED         
                 wxMessageBox("wxHTML #elif error: Premature end of file before finding #endif.","Error",wxICON_ERROR);
                 wxMessageBox("wxHTML #elif error: Premature end of file before finding #endif.","Error",wxICON_ERROR);
-                #endif
+#endif
                 break;
                 }
             // once ifcount reaches 0 again we have found our matchin #endif
                 break;
                 }
             // once ifcount reaches 0 again we have found our matchin #endif
@@ -269,9 +357,9 @@ wxString wxIfElsePrep::Process(
 
         // If it couldn't be found die gracefully
         if (nextendif == wxString::npos) {
 
         // If it couldn't be found die gracefully
         if (nextendif == wxString::npos) {
-                // We already displayed a message, just break all the way out
-                break;
-                }
+            // We already displayed a message, just break all the way out
+            break;
+            }
 
         int elifsize = e - (b + strlen(ftelif)) + strlen("-->");
         // Create the #if/else block, removing the #elif code
 
         int elifsize = e - (b + strlen(ftelif)) + strlen("-->");
         // Create the #if/else block, removing the #elif code
@@ -280,7 +368,6 @@ wxString wxIfElsePrep::Process(
             output.Mid(b+strlen(ftelif), elifsize+nextendif) +
             wxString(ftend) +
             output.Mid(b+strlen(ftelif)+elifsize+nextendif);
             output.Mid(b+strlen(ftelif), elifsize+nextendif) +
             wxString(ftend) +
             output.Mid(b+strlen(ftelif)+elifsize+nextendif);
-
         }
        
     // Parse out the if else blocks themselves
         }
        
     // Parse out the if else blocks themselves
@@ -350,4 +437,5 @@ wxString wxIfElsePrep::Process(
     return output;
 }
 
     return output;
 }
 
-FORCE_LINK(ifelsevar)                          
+FORCE_LINK(ifelsevar)
+                               
index 83d494875e8818b05257a301562b92441e33a292..bf03a84ef865b339df0807b58301dbc26c479942 100644 (file)
 *
 ****************************************************************************/
 
 *
 ****************************************************************************/
 
-// For compilers that support precompilation
-#include "wx/wxprec.h"
-//#include "wx/file.h"
-#include "wx/filesys.h"
 // Include private headers
 #include "wx/applet/prepinclude.h"
 // Include private headers
 #include "wx/applet/prepinclude.h"
+#include "wx/applet/echovar.h"
+
+// wxWindows
+#include "wx/filesys.h"
+#include "wx/msgdlg.h"
+
+/*----------------------------- Implementation ----------------------------*/
 
 #define RECURSE_LIMIT 50
 
 #define RECURSE_LIMIT 50
-/*---------------------------- Global variables ---------------------------*/
 
 
+/****************************************************************************
+PARAMETERS:
+text        - text to process for echo variables
 
 
-/*----------------------------- Implementation ----------------------------*/
+RETURNS:
+The string containing the processed filename
+
+REMARKS:
+This routine searches through the text of the filename for variables contained
+in % percent signs
+****************************************************************************/
+wxString ParseFilename(
+    wxString &text)
+{
+    int f = 0;
+    int e;
+    while ((f = text.find('%', f)) != wxString::npos) {
+        f++;
+        e = text.find('%', f);
+#ifdef CHECKED 
+        if (e == wxString::npos) {
+            wxMessageBox(wxString("wxHTML #include error: % signs should bracket variable names in file attribute. To use a percent sign in a filename write double percents (%%)."), "Error" ,wxICON_ERROR);
+            return text;
+            }
+#endif                 
+        if (e == f)
+            text.replace(f-1, 2, "%");
+        else {
+            wxString varname = text.Mid(f, (e-f));
+            text.replace(f-1, (e-f)+2, wxEchoVariable::GetValue(varname));
+            }
+        }
+    return text;
+}
 
 /****************************************************************************
 PARAMETERS:
 
 /****************************************************************************
 PARAMETERS:
@@ -58,8 +92,6 @@ wxString wxIncludePrep::Process(
 {
     int i;
        char ft[] = "<!--#include virtual=";
 {
     int i;
        char ft[] = "<!--#include virtual=";
-       
-
     int openedcount = 0;
 
     // make a copy so we can replace text as we go without affecting the original
     int openedcount = 0;
 
     // make a copy so we can replace text as we go without affecting the original
@@ -91,7 +123,7 @@ wxString wxIncludePrep::Process(
         output.Remove(i, n+21+3);
 
         wxFSFile * file;
         output.Remove(i, n+21+3);
 
         wxFSFile * file;
-        file = m_FS->OpenFile(fname);
+        file = m_FS->OpenFile(ParseFilename(fname));
        
         if (!file) {
 #ifdef CHECKED         
        
         if (!file) {
 #ifdef CHECKED         
@@ -112,14 +144,12 @@ wxString wxIncludePrep::Process(
                        } while (c == 256);
 
                output = (output.Mid(0,i) + tmp + output.Mid(i));
                        } while (c == 256);
 
                output = (output.Mid(0,i) + tmp + output.Mid(i));
-
-        #ifdef CHECKED 
+#ifdef CHECKED 
         if (openedcount > RECURSE_LIMIT) {
             wxMessageBox(wxString("wxHTML #include error: More than RECURSE_LIMIT files have been #included you may have a file that is directly or indirectly including itself, causing an endless loop"), "Error" ,wxICON_ERROR);
             break;
             }
         if (openedcount > RECURSE_LIMIT) {
             wxMessageBox(wxString("wxHTML #include error: More than RECURSE_LIMIT files have been #included you may have a file that is directly or indirectly including itself, causing an endless loop"), "Error" ,wxICON_ERROR);
             break;
             }
-        #endif                 
-
+#endif                 
         openedcount++;
         delete file;
         }
         openedcount++;
         delete file;
         }
index d7001dd1e9b1bb260f71a799df0d0966f9ef85cc..32ee02a04b11f08f660468273f63caef805c8310 100644 (file)
@@ -332,7 +332,7 @@ bool wxXmlDocument::Save(const wxString& filename) const
 //  wxXmlDocument loading routines
 //-----------------------------------------------------------------------------
 
 //  wxXmlDocument loading routines
 //-----------------------------------------------------------------------------
 
-/* 
+/*
     FIXME:
        - process all elements, including CDATA
  */
     FIXME:
        - process all elements, including CDATA
  */
@@ -349,12 +349,12 @@ inline static wxString CharToString(wxMBConv *conv,
     {
         size_t nLen = (len != wxSTRING_MAXLEN) ? len :
                           nLen = wxConvUTF8.MB2WC((wchar_t*) NULL, s, 0);
     {
         size_t nLen = (len != wxSTRING_MAXLEN) ? len :
                           nLen = wxConvUTF8.MB2WC((wchar_t*) NULL, s, 0);
-    
+
         wchar_t *buf = new wchar_t[nLen+1];
         wxConvUTF8.MB2WC(buf, s, nLen);
         buf[nLen] = 0;
         wchar_t *buf = new wchar_t[nLen+1];
         wxConvUTF8.MB2WC(buf, s, nLen);
         buf[nLen] = 0;
-        return wxString(buf, *conv, len);
         delete[] buf;
         delete[] buf;
+        return wxString(buf, *conv, len);
     }
     else
         return wxString(s, len);
     }
     else
         return wxString(s, len);
@@ -473,21 +473,21 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData),
     char mbBuf[255];
     wchar_t wcBuf[255];
     size_t i;
     char mbBuf[255];
     wchar_t wcBuf[255];
     size_t i;
-    
+
     for (i = 0; i < 255; i++)
     for (i = 0; i < 255; i++)
-        mbBuf[i] = i+1;
+        mbBuf[i] = (char) (i+1);
     mbBuf[255] = 0;
     conv.MB2WC(wcBuf, mbBuf, 255);
     wcBuf[255] = 0;
     mbBuf[255] = 0;
     conv.MB2WC(wcBuf, mbBuf, 255);
     wcBuf[255] = 0;
-    
+
     info->map[0] = 0;
     for (i = 0; i < 255; i++)
         info->map[i+1] = (int)wcBuf[i];
     info->map[0] = 0;
     for (i = 0; i < 255; i++)
         info->map[i+1] = (int)wcBuf[i];
-    
+
     info->data = NULL;
     info->convert = NULL;
     info->release = NULL;
     info->data = NULL;
     info->convert = NULL;
     info->release = NULL;
-    
+
     return 1;
 }
 
     return 1;
 }
 
@@ -512,7 +512,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
     if ( encoding != wxT("UTF-8") && encoding != wxT("utf-8") )
         ctx.conv = new wxCSConv(encoding);
 #endif
     if ( encoding != wxT("UTF-8") && encoding != wxT("utf-8") )
         ctx.conv = new wxCSConv(encoding);
 #endif
-    
+
     XML_SetUserData(parser, (void*)&ctx);
     XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
     XML_SetCharacterDataHandler(parser, TextHnd);
     XML_SetUserData(parser, (void*)&ctx);
     XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
     XML_SetCharacterDataHandler(parser, TextHnd);
@@ -542,7 +542,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
     if ( ctx.conv )
         delete ctx.conv;
 #endif
     if ( ctx.conv )
         delete ctx.conv;
 #endif
-    
+
     return TRUE;
 
 }
     return TRUE;
 
 }
@@ -572,7 +572,7 @@ inline static void OutputString(wxOutputStream& stream, const wxString& str,
 #endif
 }
 
 #endif
 }
 
-// Same as above, but create entities first. 
+// Same as above, but create entities first.
 // Translates '<' to "&lt;", '>' to "&gt;" and '&' to "&amp;"
 static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
                             wxMBConv *convMem, wxMBConv *convFile)
 // Translates '<' to "&lt;", '>' to "&gt;" and '&' to "&amp;"
 static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
                             wxMBConv *convMem, wxMBConv *convFile)
@@ -580,25 +580,25 @@ static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
     wxString buf;
     size_t i, last, len;
     wxChar c;
     wxString buf;
     size_t i, last, len;
     wxChar c;
-    
+
     len = str.Len();
     last = 0;
     for (i = 0; i < len; i++)
     {
         c = str.GetChar(i);
     len = str.Len();
     last = 0;
     for (i = 0; i < len; i++)
     {
         c = str.GetChar(i);
-        if (c == wxT('<') || c == wxT('>') || 
+        if (c == wxT('<') || c == wxT('>') ||
             (c == wxT('&') && str.Mid(i+1, 4) != wxT("amp;")))
         {
             OutputString(stream, str.Mid(last, i - last), convMem, convFile);
             switch (c)
             {
             (c == wxT('&') && str.Mid(i+1, 4) != wxT("amp;")))
         {
             OutputString(stream, str.Mid(last, i - last), convMem, convFile);
             switch (c)
             {
-                case wxT('<'): 
+                case wxT('<'):
                     OutputString(stream, wxT("&lt;"), NULL, NULL);
                     break;
                     OutputString(stream, wxT("&lt;"), NULL, NULL);
                     break;
-                case wxT('>'): 
+                case wxT('>'):
                     OutputString(stream, wxT("&gt;"), NULL, NULL);
                     break;
                     OutputString(stream, wxT("&gt;"), NULL, NULL);
                     break;
-                case wxT('&'): 
+                case wxT('&'):
                     OutputString(stream, wxT("&amp;"), NULL, NULL);
                     break;
                 default: break;
                     OutputString(stream, wxT("&amp;"), NULL, NULL);
                     break;
                 default: break;
@@ -628,11 +628,11 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
         case wxXML_TEXT_NODE:
             OutputStringEnt(stream, node->GetContent(), convMem, convFile);
             break;
         case wxXML_TEXT_NODE:
             OutputStringEnt(stream, node->GetContent(), convMem, convFile);
             break;
-            
+
         case wxXML_ELEMENT_NODE:
             OutputString(stream, wxT("<"), NULL, NULL);
             OutputString(stream, node->GetName(), NULL, NULL);
         case wxXML_ELEMENT_NODE:
             OutputString(stream, wxT("<"), NULL, NULL);
             OutputString(stream, node->GetName(), NULL, NULL);
-            
+
             prop = node->GetProperties();
             while (prop)
             {
             prop = node->GetProperties();
             while (prop)
             {
@@ -642,7 +642,7 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
                 // FIXME - what if prop contains '"'?
                 prop = prop->GetNext();
             }
                 // FIXME - what if prop contains '"'?
                 prop = prop->GetNext();
             }
-            
+
             if (node->GetChildren())
             {
                 OutputString(stream, wxT(">"), NULL, NULL);
             if (node->GetChildren())
             {
                 OutputString(stream, wxT(">"), NULL, NULL);
@@ -665,13 +665,13 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
             else
                 OutputString(stream, wxT("/>"), NULL, NULL);
             break;
             else
                 OutputString(stream, wxT("/>"), NULL, NULL);
             break;
-             
+
         case wxXML_COMMENT_NODE:
             OutputString(stream, wxT("<!--"), NULL, NULL);
             OutputString(stream, node->GetContent(), convMem, convFile);
             OutputString(stream, wxT("-->"), NULL, NULL);
             break;
         case wxXML_COMMENT_NODE:
             OutputString(stream, wxT("<!--"), NULL, NULL);
             OutputString(stream, node->GetContent(), convMem, convFile);
             OutputString(stream, wxT("-->"), NULL, NULL);
             break;
-            
+
         default:
             wxFAIL_MSG(wxT("unsupported node type"));
     }
         default:
             wxFAIL_MSG(wxT("unsupported node type"));
     }
@@ -681,9 +681,9 @@ bool wxXmlDocument::Save(wxOutputStream& stream) const
 {
     if ( !IsOk() )
         return FALSE;
 {
     if ( !IsOk() )
         return FALSE;
-        
+
     wxString s;
     wxString s;
-    
+
     wxMBConv *convMem = NULL, *convFile = NULL;
 #if wxUSE_UNICODE
     convFile = new wxCSConv(GetFileEncoding());
     wxMBConv *convMem = NULL, *convFile = NULL;
 #if wxUSE_UNICODE
     convFile = new wxCSConv(GetFileEncoding());
@@ -694,18 +694,18 @@ bool wxXmlDocument::Save(wxOutputStream& stream) const
         convMem = new wxCSConv(GetEncoding());
     }
 #endif
         convMem = new wxCSConv(GetEncoding());
     }
 #endif
-    
+
     s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
              GetVersion().c_str(), GetFileEncoding().c_str());
     OutputString(stream, s, NULL, NULL);
     s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
              GetVersion().c_str(), GetFileEncoding().c_str());
     OutputString(stream, s, NULL, NULL);
-    
+
     OutputNode(stream, GetRoot(), 0, convMem, convFile);
     OutputString(stream, wxT("\n"), NULL, NULL);
     OutputNode(stream, GetRoot(), 0, convMem, convFile);
     OutputString(stream, wxT("\n"), NULL, NULL);
-    
+
     if ( convFile )
         delete convFile;
     if ( convMem )
         delete convMem;
     if ( convFile )
         delete convFile;
     if ( convMem )
         delete convMem;
-        
+
     return TRUE;
 }
     return TRUE;
 }
index 9eb23674a124e5d9639fd30f08f8dfd9a66c6c03..b13bc4bcb78e0be7fded896b699c67135d7ababb 100644 (file)
@@ -28,7 +28,6 @@
 #include "wx/brush.h"
 #include "wx/pen.h"
 #include "wx/palette.h"
 #include "wx/brush.h"
 #include "wx/pen.h"
 #include "wx/palette.h"
-
 #include "wx/list.h"            // we use wxList in inline functions
 
 class WXDLLEXPORT wxDCBase;
 #include "wx/list.h"            // we use wxList in inline functions
 
 class WXDLLEXPORT wxDCBase;
@@ -741,6 +740,7 @@ protected:
 
 #if wxUSE_PALETTE
     wxPalette         m_palette;
 
 #if wxUSE_PALETTE
     wxPalette         m_palette;
+    bool              m_custompalette;
 #endif // wxUSE_PALETTE
 
 private:
 #endif // wxUSE_PALETTE
 
 private:
index b96e4458be3fc4d61290c4460d83a8f0f1474218..cedaf922eb274300ee738c656cdbf4862cdde054 100644 (file)
@@ -230,20 +230,21 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT, 423)
     DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424)
     DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425)
     DECLARE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT, 423)
     DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424)
     DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425)
-    DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 426)
-    DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 427)
-    DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 428)
-    DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 429)
-    DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 430)
-    DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 431)
-    DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 432)
-    DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 433)
-    DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 434)
-    DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 435)
-    DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 436)
-    DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 437)
-    DECLARE_EVENT_TYPE(wxEVT_IDLE, 438)
-    DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 439)
+    DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426)
+    DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427)
+    DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428)
+    DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429)
+    DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430)
+    DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431)
+    DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432)
+    DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433)
+    DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434)
+    DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435)
+    DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436)
+    DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437)
+    DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438)
+    DECLARE_EVENT_TYPE(wxEVT_IDLE, 439)
+    DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
 
         // Generic command events
         // Note: a click is a higher-level event than button down/up
 
         // Generic command events
         // Note: a click is a higher-level event than button down/up
@@ -1380,6 +1381,21 @@ private:
     DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
 };
 
     DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
 };
 
+/*
+ wxEVT_DISPLAY_CHANGED
+ */
+class WXDLLEXPORT wxDisplayChangedEvent : public wxEvent
+{
+private:
+    DECLARE_DYNAMIC_CLASS(wxDisplayChangedEvent)
+
+public:
+    wxDisplayChangedEvent()
+        { m_eventType = wxEVT_DISPLAY_CHANGED; }
+
+    virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); }
+};
+
 /*
  wxEVT_PALETTE_CHANGED
  */
 /*
  wxEVT_PALETTE_CHANGED
  */
@@ -1899,6 +1915,7 @@ typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&);
 typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
 typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
 typedef void (wxEvtHandler::*wxSysColourChangedFunction)(wxSysColourChangedEvent&);
 typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
 typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
 typedef void (wxEvtHandler::*wxSysColourChangedFunction)(wxSysColourChangedEvent&);
+typedef void (wxEvtHandler::*wxDisplayChangedFunction)(wxDisplayChangedEvent&);
 typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
 typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
 typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
 typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
 typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
 typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
@@ -1968,6 +1985,7 @@ typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
 #define EVT_DROP_FILES(func)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_DROP_FILES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDropFilesEventFunction) & func, (wxObject *) NULL ),
 #define EVT_INIT_DIALOG(func)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_INIT_DIALOG, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxInitDialogEventFunction) & func, (wxObject *) NULL ),
 #define EVT_SYS_COLOUR_CHANGED(func)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_SYS_COLOUR_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSysColourChangedFunction) & func, (wxObject *) NULL ),
 #define EVT_DROP_FILES(func)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_DROP_FILES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDropFilesEventFunction) & func, (wxObject *) NULL ),
 #define EVT_INIT_DIALOG(func)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_INIT_DIALOG, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxInitDialogEventFunction) & func, (wxObject *) NULL ),
 #define EVT_SYS_COLOUR_CHANGED(func)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_SYS_COLOUR_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSysColourChangedFunction) & func, (wxObject *) NULL ),
+#define EVT_DISPLAY_CHANGED(func)  DECLARE_EVENT_TABLE_ENTRY( wxEVT_DISPLAY_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDisplayChangedFunction) & func, (wxObject *) NULL ),
 #define EVT_SHOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, (wxObject *) NULL ),
 #define EVT_MAXIMIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, (wxObject *) NULL ),
 #define EVT_ICONIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, (wxObject *) NULL ),
 #define EVT_SHOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, (wxObject *) NULL ),
 #define EVT_MAXIMIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, (wxObject *) NULL ),
 #define EVT_ICONIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, (wxObject *) NULL ),
index cbda2b6ad3c80c32fbe3a0e25b01578ea1b6ee56..d31dd8b880fa09f812e5254f8d736023f35fb85a 100644 (file)
@@ -85,7 +85,7 @@ public:
     // specify document location, use LoadPage() istead
     // Return value : FALSE if an error occured, TRUE otherwise
     bool SetPage(const wxString& source);
     // specify document location, use LoadPage() istead
     // Return value : FALSE if an error occured, TRUE otherwise
     bool SetPage(const wxString& source);
-    
+
     // Append to current page
     bool AppendToPage(const wxString& source);
 
     // Append to current page
     bool AppendToPage(const wxString& source);
 
@@ -175,14 +175,14 @@ public:
     // Called when user clicked on hypertext link. Default behavior is to
     // call LoadPage(loc)
     virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
     // Called when user clicked on hypertext link. Default behavior is to
     // call LoadPage(loc)
     virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
-    
-    // Called when wxHtmlWindow wants to fetch data from an URL (e.g. when 
-    // loading a page or loading an image). The data are downloaded if and only if 
+
+    // Called when wxHtmlWindow wants to fetch data from an URL (e.g. when
+    // loading a page or loading an image). The data are downloaded if and only if
     // OnOpeningURL returns TRUE. If OnOpeningURL returns wxHTML_REDIRECT,
     // it must set *redirect to the new URL
     // OnOpeningURL returns TRUE. If OnOpeningURL returns wxHTML_REDIRECT,
     // it must set *redirect to the new URL
-    virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType type,
-                                             const wxString& url,
-                                             wxString *redirect) const 
+    virtual wxHtmlOpeningStatus OnOpeningURL(wxHtmlURLType WXUNUSED(type),
+                                             const wxString& WXUNUSED(url),
+                                             wxString *WXUNUSED(redirect)) const
         { return wxHTML_OPEN; }
 
 protected:
         { return wxHTML_OPEN; }
 
 protected:
index 0d67d7a8fb4d1dc6d944a78edddac065a4d243d4..d687121f67dbc81f753d45631a884b3ab1580b05 100644 (file)
@@ -53,11 +53,11 @@ public:
     virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
     virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
     virtual bool DoCanRead( wxInputStream& stream );
     virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
     virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
     virtual bool DoCanRead( wxInputStream& stream );
-                                
+
 protected:
 protected:
-    bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose, 
+    bool SaveDib(wxImage *image, wxOutputStream& stream, bool verbose,
                  bool IsBmp, bool IsMask);
                  bool IsBmp, bool IsMask);
-    bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors, 
+    bool DoLoadDib(wxImage *image, int width, int height, int bpp, int ncolors,
                    int comp, off_t bmpOffset, wxInputStream& stream,
                    bool verbose, bool IsBmp, bool hasPalette);
     bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp);
                    int comp, off_t bmpOffset, wxInputStream& stream,
                    bool verbose, bool IsBmp, bool hasPalette);
     bool LoadDib(wxImage *image, wxInputStream& stream, bool verbose, bool IsBmp);
@@ -115,7 +115,7 @@ public:
         m_type = wxBITMAP_TYPE_CUR;
         m_mime = _T("image/x-cur");
     };
         m_type = wxBITMAP_TYPE_CUR;
         m_mime = _T("image/x-cur");
     };
-    
+
     // VS: This handler's meat is implemented inside wxICOHandler (the two
     //     formats are almost identical), but we hide this fact at
     //     the API level, since it is a mere implementation detail.
     // VS: This handler's meat is implemented inside wxICOHandler (the two
     //     formats are almost identical), but we hide this fact at
     //     the API level, since it is a mere implementation detail.
@@ -141,10 +141,10 @@ public:
         m_type = wxBITMAP_TYPE_ANI;
         m_mime = _T("image/x-ani");
     };
         m_type = wxBITMAP_TYPE_ANI;
         m_mime = _T("image/x-ani");
     };
-    
+
 
 #if wxUSE_STREAMS
 
 #if wxUSE_STREAMS
-    virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ) {return FALSE ;};
+    virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=TRUE) ){return FALSE ;};
     virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
     virtual bool DoCanRead( wxInputStream& stream );
     virtual int GetImageCount( wxInputStream& stream );
     virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
     virtual bool DoCanRead( wxInputStream& stream );
     virtual int GetImageCount( wxInputStream& stream );
index 63d8e981b020b1558a3048e1ac25eea11ba0ccf3..4609981ce7629372098f41c19f3ea14da1b894b4 100644 (file)
@@ -300,7 +300,7 @@ public:
                 const wxValidator& validator = wxDefaultValidator,
                 const wxString &name = "listctrl" )
     {
                 const wxValidator& validator = wxDefaultValidator,
                 const wxString &name = "listctrl" )
     {
-        Create(parent, id, pos, size, style, wxDefaultValidator, name);
+        Create(parent, id, pos, size, style, validator, name);
     }
 
     // focus/selection stuff
     }
 
     // focus/selection stuff
index 9087250fe7c7629d37aecb9fa2dea92a7c906973..682bdb16b255f1f5c4a54a61ac996208c52f1fdd 100644 (file)
@@ -102,7 +102,13 @@ public:
     virtual void SelectOldObjects(WXHDC dc);
 
     wxWindow *GetWindow() const { return m_canvas; }
     virtual void SelectOldObjects(WXHDC dc);
 
     wxWindow *GetWindow() const { return m_canvas; }
-    void SetWindow(wxWindow *win) { m_canvas = win; }
+    void SetWindow(wxWindow *win) {
+        m_canvas = win;
+#if wxUSE_PALETTE
+        // if we have palettes use the correct one for this window
+        InitializePalette();
+#endif
+        }
 
     WXHDC GetHDC() const { return m_hDC; }
     void SetHDC(WXHDC dc, bool bOwnsDC = FALSE)
 
     WXHDC GetHDC() const { return m_hDC; }
     void SetHDC(WXHDC dc, bool bOwnsDC = FALSE)
@@ -184,6 +190,15 @@ protected:
                                int fillStyle = wxODDEVEN_RULE);
 
 
                                int fillStyle = wxODDEVEN_RULE);
 
 
+#if wxUSE_PALETTE
+    // MSW specific, select a logical palette into the HDC
+    // (tell windows to translate pixel from other palettes to our custom one
+    // and vice versa)
+    // Realize tells it to also reset the system palette to this one.
+    void DoSelectPalette(bool realize = false);
+    // Find out what palette our parent window has, then select it into the dc
+    void InitializePalette();
+#endif
     // common part of DoDrawText() and DoDrawRotatedText()
     void DrawAnyText(const wxString& text, wxCoord x, wxCoord y);
 
     // common part of DoDrawText() and DoDrawRotatedText()
     void DrawAnyText(const wxString& text, wxCoord x, wxCoord y);
 
index d16f521fd619e03fa2240e2efa216afeca738a9a..0df7b55a36b1499aad4ea13c8f2a7eed532a538a 100644 (file)
@@ -331,6 +331,8 @@ public:
     bool HandlePaletteChanged(WXHWND hWndPalChange);
     bool HandleQueryNewPalette();
     bool HandleSysColorChange();
     bool HandlePaletteChanged(WXHWND hWndPalChange);
     bool HandleQueryNewPalette();
     bool HandleSysColorChange();
+    bool HandleDisplayChange();
+
 
     bool HandleQueryEndSession(long logOff, bool *mayEnd);
     bool HandleEndSession(bool endSession, long logOff);
 
     bool HandleQueryEndSession(long logOff, bool *mayEnd);
     bool HandleEndSession(bool endSession, long logOff);
index 0fd38143f05b53299703ccf4477b359182f14e7e..1e4736b97b7e6fbb2ab20aaf0de5658b01ec2b57 100644 (file)
 
 #include "wx/validate.h"        // for wxDefaultValidator (always include it)
 
 
 #include "wx/validate.h"        // for wxDefaultValidator (always include it)
 
+#if wxUSE_PALETTE
+       #include "wx/dcclient.h"
+       #include "wx/palette.h"
+#endif // wxUSE_PALETTE
+
 #if wxUSE_ACCEL
     #include "wx/accel.h"
 #endif // wxUSE_ACCEL
 #if wxUSE_ACCEL
     #include "wx/accel.h"
 #endif // wxUSE_ACCEL
@@ -761,6 +766,21 @@ public:
         // platform-specific APIs
     virtual WXWidget GetHandle() const = 0;
 
         // platform-specific APIs
     virtual WXWidget GetHandle() const = 0;
 
+#if wxUSE_PALETTE
+        // Store the palette used by DCs in wxWindow so that the dcs can share
+        // a palette. And we can respond to palette messages.
+    wxPalette GetPalette() const { return m_palette; }
+        // When palette is changed tell the DC to set the system palette to the
+        // new one.
+    void SetPalette(wxPalette &pal) {
+                       m_custompalette=true;
+                       m_palette=pal;
+            wxWindowDC d((wxWindow *) this);
+                       d.SetPalette(pal);
+                       }
+    bool HasCustomPalette() { return m_custompalette; }
+#endif // wxUSE_PALETTE
+
 protected:
     // the window id - a number which uniquely identifies a window among
     // its siblings unless it is -1
 protected:
     // the window id - a number which uniquely identifies a window among
     // its siblings unless it is -1
@@ -844,6 +864,11 @@ protected:
     wxString             m_windowName;
     bool                 m_themeEnabled;
 
     wxString             m_windowName;
     bool                 m_themeEnabled;
 
+#ifdef wxUSE_PALETTE
+    wxPalette            m_palette;
+    bool                 m_custompalette;
+#endif
+
 protected:
 
     // common part of all ctors: it is not virtual because it is called from
 protected:
 
     // common part of all ctors: it is not virtual because it is called from
index 914df7085594ddbd5a393baeb4ca2291bd985017..97d84b676c5b03343d317aba96c4fe742330ecb3 100644 (file)
@@ -79,6 +79,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
     IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxSetCursorEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxSetCursorEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
+    IMPLEMENT_DYNAMIC_CLASS(wxDisplayChangedEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxNavigationKeyEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxPaletteChangedEvent, wxEvent)
@@ -224,6 +225,7 @@ DEFINE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT)
 DEFINE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT)
 DEFINE_EVENT_TYPE(wxEVT_CONTEXT_MENU)
 DEFINE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT)
 DEFINE_EVENT_TYPE(wxEVT_CONTEXT_MENU)
 DEFINE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_SETTING_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE)
 DEFINE_EVENT_TYPE(wxEVT_PALETTE_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_SETTING_CHANGED)
 DEFINE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE)
 DEFINE_EVENT_TYPE(wxEVT_PALETTE_CHANGED)
index 5474b78d004a89c283950999d720bc2c247add30..99832bf9957d8852e6005e480415bc8cf70cb6a8 100644 (file)
@@ -359,7 +359,7 @@ void wxFileName::Assign(const wxString& fullpathOrig,
                   _T("the path shouldn't contain file name nor extension") );
 
 #else // !__WXDEBUG__
                   _T("the path shouldn't contain file name nor extension") );
 
 #else // !__WXDEBUG__
-    SplitPath(fullname, NULL /* no path */, &name, &ext, format);
+    SplitPath(fullname, NULL /* no path */, &name, &ext, format); 
     SplitPath(fullpath, &volume, &path, NULL, NULL, format);
 #endif // __WXDEBUG__/!__WXDEBUG__
 
     SplitPath(fullpath, &volume, &path, NULL, NULL, format);
 #endif // __WXDEBUG__/!__WXDEBUG__
 
@@ -1043,8 +1043,10 @@ wxString wxFileName::GetFullName() const
     return fullname;
 }
 
     return fullname;
 }
 
-wxString wxFileName::GetPath( bool add_separator, wxPathFormat format ) const
+wxString wxFileName::GetPath( bool, wxPathFormat format ) const
 {
 {
+    // Should add_seperator parameter be used?
+
     format = GetFormat( format );
 
     wxString fullpath;
     format = GetFormat( format );
 
     wxString fullpath;
@@ -1776,4 +1778,3 @@ void wxFileName::MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint3
   gMacDefaultExtensions.Add( rec ) ;
 }
 #endif
   gMacDefaultExtensions.Add( rec ) ;
 }
 #endif
-
index 48e6ccdc61f6840b83c337e3d5244111532a625e..bd8a08abeb78e5deb41def8e1b9e52944ad29545 100644 (file)
@@ -67,7 +67,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBMPHandler,wxImageHandler)
 bool wxBMPHandler::SaveFile(wxImage *image,
                             wxOutputStream& stream,
                             bool verbose)
 bool wxBMPHandler::SaveFile(wxImage *image,
                             wxOutputStream& stream,
                             bool verbose)
-{      
+{
     return SaveDib(image, stream, verbose, TRUE/*IsBmp*/, FALSE/*IsMask*/);
 }
 
     return SaveDib(image, stream, verbose, TRUE/*IsBmp*/, FALSE/*IsMask*/);
 }
 
@@ -82,7 +82,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
 
     if ( !image->Ok() )
     {
 
     if ( !image->Ok() )
     {
-        if ( verbose ) 
+        if ( verbose )
             wxLogError(_("BMP: Couldn't save invalid image."));
         return FALSE;
     }
             wxLogError(_("BMP: Couldn't save invalid image."));
         return FALSE;
     }
@@ -92,7 +92,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
     if ( image->HasOption(wxBMP_FORMAT) )
         format = image->GetOptionInt(wxBMP_FORMAT);
 
     if ( image->HasOption(wxBMP_FORMAT) )
         format = image->GetOptionInt(wxBMP_FORMAT);
 
-    unsigned bpp;     // # of bits per pixel
+    wxUint16 bpp;     // # of bits per pixel
     int palette_size; // # of color map entries, ie. 2^bpp colors
 
     // set the bpp and appropriate palette_size, and do additional checks
     int palette_size; // # of color map entries, ie. 2^bpp colors
 
     // set the bpp and appropriate palette_size, and do additional checks
@@ -179,7 +179,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
     hdr.h_res = hdr.v_res = wxUINT32_SWAP_ON_BE(72);  // 72dpi is standard
     hdr.num_clrs = wxUINT32_SWAP_ON_BE(palette_size); // # colors in colormap
     hdr.num_signif_clrs = 0;     // all colors are significant
     hdr.h_res = hdr.v_res = wxUINT32_SWAP_ON_BE(72);  // 72dpi is standard
     hdr.num_clrs = wxUINT32_SWAP_ON_BE(palette_size); // # colors in colormap
     hdr.num_signif_clrs = 0;     // all colors are significant
-    
+
     if ( IsBmp )
     {
         if (// VS: looks ugly but compilers tend to do ugly things with structs,
     if ( IsBmp )
     {
         if (// VS: looks ugly but compilers tend to do ugly things with structs,
@@ -188,7 +188,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
             !stream.Write(&hdr.magic, 2) ||
             !stream.Write(&hdr.filesize, 4) ||
             !stream.Write(&hdr.reserved, 4) ||
             !stream.Write(&hdr.magic, 2) ||
             !stream.Write(&hdr.filesize, 4) ||
             !stream.Write(&hdr.reserved, 4) ||
-            !stream.Write(&hdr.data_offset, 4) 
+            !stream.Write(&hdr.data_offset, 4)
            )
         {
             if (verbose)
            )
         {
             if (verbose)
@@ -443,7 +443,7 @@ typedef struct
     unsigned char r, g, b;
 }  _cmap;
 
     unsigned char r, g, b;
 }  _cmap;
 
-bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height, 
+bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
                              int bpp, int ncolors, int comp,
                              off_t bmpOffset, wxInputStream& stream,
                              bool verbose, bool IsBmp, bool hasPalette)
                              int bpp, int ncolors, int comp,
                              off_t bmpOffset, wxInputStream& stream,
                              bool verbose, bool IsBmp, bool hasPalette)
@@ -474,7 +474,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
     // destroy existing here instead of:
     image->Destroy();
     image->Create(width, height);
     // destroy existing here instead of:
     image->Destroy();
     image->Create(width, height);
-    
+
     unsigned char *ptr = image->GetData();
 
     if ( !ptr )
     unsigned char *ptr = image->GetData();
 
     if ( !ptr )
@@ -753,7 +753,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
     return stream.IsOk();
 }
 
     return stream.IsOk();
 }
 
-bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream, 
+bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
                            bool verbose, bool IsBmp)
 {
     wxUint16        aWord;
                            bool verbose, bool IsBmp)
 {
     wxUint16        aWord;
@@ -785,7 +785,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
     int width = (int)wxINT32_SWAP_ON_BE(dbuf[0]);
     int height = (int)wxINT32_SWAP_ON_BE(dbuf[1]);
     if ( !IsBmp)height = height  / 2; // for icons divide by 2
     int width = (int)wxINT32_SWAP_ON_BE(dbuf[0]);
     int height = (int)wxINT32_SWAP_ON_BE(dbuf[1]);
     if ( !IsBmp)height = height  / 2; // for icons divide by 2
-        
+
     if ( width > 32767 )
     {
         if (verbose)
     if ( width > 32767 )
     {
         if (verbose)
@@ -815,7 +815,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
 
     stream.Read(dbuf, 4 * 4);
     int comp = (int)wxINT32_SWAP_ON_BE(dbuf[0]);
 
     stream.Read(dbuf, 4 * 4);
     int comp = (int)wxINT32_SWAP_ON_BE(dbuf[0]);
-    if ( comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && 
+    if ( comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 &&
          comp != BI_BITFIELDS )
     {
         if (verbose)
          comp != BI_BITFIELDS )
     {
         if (verbose)
@@ -865,7 +865,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
     return TRUE;
 }
 
     return TRUE;
 }
 
-bool wxBMPHandler::LoadFile(wxImage *image, wxInputStream& stream, 
+bool wxBMPHandler::LoadFile(wxImage *image, wxInputStream& stream,
                             bool verbose, int WXUNUSED(index))
 {
     // Read a single DIB fom the file:
                             bool verbose, int WXUNUSED(index))
 {
     // Read a single DIB fom the file:
@@ -935,7 +935,7 @@ bool wxICOHandler::SaveFile(wxImage *image,
 
     int images = 1; // only generate one image
 
 
     int images = 1; // only generate one image
 
-    // VS: This is a hack of sort - since ICO and CUR files are almost 
+    // VS: This is a hack of sort - since ICO and CUR files are almost
     //     identical, we have all the meat in wxICOHandler and check for
     //     the actual (handler) type when the code has to distinguish between
     //     the two formats
     //     identical, we have all the meat in wxICOHandler and check for
     //     the actual (handler) type when the code has to distinguish between
     //     the two formats
@@ -966,7 +966,7 @@ bool wxICOHandler::SaveFile(wxImage *image,
         wxImage mask;
 
         if ( image->HasMask() )
         wxImage mask;
 
         if ( image->HasMask() )
-        {            
+        {
             // make another image with black/white:
             mask = image->ConvertToMono (image->GetMaskRed(), image->GetMaskGreen(), image->GetMaskBlue() );
 
             // make another image with black/white:
             mask = image->ConvertToMono (image->GetMaskRed(), image->GetMaskGreen(), image->GetMaskBlue() );
 
@@ -982,8 +982,8 @@ bool wxICOHandler::SaveFile(wxImage *image,
                 {
                     for (j = 0; j < mask.GetHeight(); j++)
                     {
                 {
                     for (j = 0; j < mask.GetHeight(); j++)
                     {
-                        if ((r == mask.GetRed(i, j)) && 
-                            (g == mask.GetGreen(i, j))&& 
+                        if ((r == mask.GetRed(i, j)) &&
+                            (g == mask.GetGreen(i, j))&&
                             (b == mask.GetBlue(i, j)) )
                                 image->SetRGB(i, j, 0, 0, 0 );
                     }
                             (b == mask.GetBlue(i, j)) )
                                 image->SetRGB(i, j, 0, 0, 0 );
                     }
@@ -1106,16 +1106,17 @@ bool wxICOHandler::SaveFile(wxImage *image,
     return TRUE;
 }
 
     return TRUE;
 }
 
-bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream, 
+bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
                             bool verbose, int index)
 {
     stream.SeekI(0);
     return DoLoadFile(image, stream, verbose, index);
 }
 
                             bool verbose, int index)
 {
     stream.SeekI(0);
     return DoLoadFile(image, stream, verbose, index);
 }
 
-bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream, 
+bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
                             bool verbose, int index)
 {
                             bool verbose, int index)
 {
+    (void) verbose;
     bool bResult = FALSE;
     bool IsBmp = FALSE;
 
     bool bResult = FALSE;
     bool IsBmp = FALSE;
 
@@ -1126,7 +1127,7 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
     wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount);
     // nType is 1 for Icons, 2 for Cursors:
     wxUint16 nType = wxUINT16_SWAP_ON_BE(IconDir.idType);
     wxUint16 nIcons = wxUINT16_SWAP_ON_BE(IconDir.idCount);
     // nType is 1 for Icons, 2 for Cursors:
     wxUint16 nType = wxUINT16_SWAP_ON_BE(IconDir.idType);
-    
+
     // loop round the icons and choose the best one:
     ICONDIRENTRY *pIconDirEntry = new ICONDIRENTRY[nIcons];
     ICONDIRENTRY *pCurrentEntry = pIconDirEntry;
     // loop round the icons and choose the best one:
     ICONDIRENTRY *pIconDirEntry = new ICONDIRENTRY[nIcons];
     ICONDIRENTRY *pCurrentEntry = pIconDirEntry;
@@ -1144,7 +1145,7 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
             if ( pCurrentEntry->bColorCount == 0 )
                 pCurrentEntry->bColorCount = 255;
             if ( pCurrentEntry->bColorCount >= colmax )
             if ( pCurrentEntry->bColorCount == 0 )
                 pCurrentEntry->bColorCount = 255;
             if ( pCurrentEntry->bColorCount >= colmax )
-            {                
+            {
                 iSel = i;
                 wMax = pCurrentEntry->bWidth;
                 colmax = pCurrentEntry->bColorCount;
                 iSel = i;
                 wMax = pCurrentEntry->bWidth;
                 colmax = pCurrentEntry->bColorCount;
@@ -1152,14 +1153,14 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
         }
         pCurrentEntry++;
     }
         }
         pCurrentEntry++;
     }
-    
+
     if ( index != -1 )
     {
         // VS: Note that we *have* to run the loop above even if index != -1, because
         //     it reads ICONDIRENTRies.
         iSel = index;
     }
     if ( index != -1 )
     {
         // VS: Note that we *have* to run the loop above even if index != -1, because
         //     it reads ICONDIRENTRies.
         iSel = index;
     }
-    
+
     if ( iSel == wxNOT_FOUND || iSel < 0 || iSel >= nIcons )
     {
         wxLogError(_("ICO: Invalid icon index."));
     if ( iSel == wxNOT_FOUND || iSel < 0 || iSel >= nIcons )
     {
         wxLogError(_("ICO: Invalid icon index."));
@@ -1230,11 +1231,11 @@ bool wxCURHandler::DoCanRead(wxInputStream& stream)
 
 IMPLEMENT_DYNAMIC_CLASS(wxANIHandler, wxCURHandler)
 
 
 IMPLEMENT_DYNAMIC_CLASS(wxANIHandler, wxCURHandler)
 
-bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream, 
+bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
                             bool verbose, int index)
 {
                             bool verbose, int index)
 {
-    wxInt32 FCC1, FCC2; 
-    wxUint32 datalen;        
+    wxInt32 FCC1, FCC2;
+    wxUint32 datalen;
     static const char *rifftxt = "RIFF";
     static const char *listtxt = "LIST";
     static const char *icotxt  = "icon";
     static const char *rifftxt = "RIFF";
     static const char *listtxt = "LIST";
     static const char *icotxt  = "icon";
@@ -1244,15 +1245,15 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
     wxInt32 *ico32  = (wxInt32 *) icotxt;
 
     int iIcon = 0;
     wxInt32 *ico32  = (wxInt32 *) icotxt;
 
     int iIcon = 0;
-    
+
     stream.SeekI(0);
     stream.Read(&FCC1, 4);
     stream.SeekI(0);
     stream.Read(&FCC1, 4);
-    if ( FCC1 != *riff32 ) 
+    if ( FCC1 != *riff32 )
         return FALSE;
 
     // we have a riff file:
     while (stream.IsOk())
         return FALSE;
 
     // we have a riff file:
     while (stream.IsOk())
-    {                    
+    {
         // we always have a data size
         stream.Read(&datalen, 4);
 
         // we always have a data size
         stream.Read(&datalen, 4);
 
@@ -1261,12 +1262,12 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
         {
            stream.Read(&FCC2, 4);
         }
         {
            stream.Read(&FCC2, 4);
         }
-        else 
+        else
         {
             if (FCC1 == *ico32 && iIcon >= index)
             {
                 return DoLoadFile(image, stream, verbose, -1);
         {
             if (FCC1 == *ico32 && iIcon >= index)
             {
                 return DoLoadFile(image, stream, verbose, -1);
-            }    
+            }
             else
             {
                 stream.SeekI(stream.TellI() + datalen);
             else
             {
                 stream.SeekI(stream.TellI() + datalen);
@@ -1274,7 +1275,7 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
                     iIcon ++;
             }
         }
                     iIcon ++;
             }
         }
-        
+
         // try to read next data chunk:
         stream.Read(&FCC1, 4);
     }
         // try to read next data chunk:
         stream.Read(&FCC1, 4);
     }
@@ -1283,8 +1284,8 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
 
 bool wxANIHandler::DoCanRead(wxInputStream& stream)
 {
 
 bool wxANIHandler::DoCanRead(wxInputStream& stream)
 {
-    wxInt32 FCC1, FCC2; 
-    wxUint32 datalen ;        
+    wxInt32 FCC1, FCC2;
+    wxUint32 datalen ;
     static const char *rifftxt = "RIFF";
     static const char *listtxt = "LIST";
     static const char *anihtxt = "anih";
     static const char *rifftxt = "RIFF";
     static const char *listtxt = "LIST";
     static const char *anihtxt = "anih";
@@ -1292,30 +1293,30 @@ bool wxANIHandler::DoCanRead(wxInputStream& stream)
     wxInt32 *riff32 = (wxInt32 *) rifftxt;
     wxInt32 *list32 = (wxInt32 *) listtxt;
     wxInt32 *anih32 = (wxInt32 *) anihtxt;
     wxInt32 *riff32 = (wxInt32 *) rifftxt;
     wxInt32 *list32 = (wxInt32 *) listtxt;
     wxInt32 *anih32 = (wxInt32 *) anihtxt;
-            
+
     stream.SeekI(0);
     stream.Read(&FCC1, 4);
     stream.SeekI(0);
     stream.Read(&FCC1, 4);
-    if ( FCC1 != *riff32 ) 
+    if ( FCC1 != *riff32 )
         return FALSE;
 
     // we have a riff file:
     while ( stream.IsOk() )
     {
         if ( FCC1 != *anih32 )
         return FALSE;
 
     // we have a riff file:
     while ( stream.IsOk() )
     {
         if ( FCC1 != *anih32 )
-            return TRUE;    
+            return TRUE;
         // we always have a data size:
         stream.Read(&datalen, 4);
         // we always have a data size:
         stream.Read(&datalen, 4);
+
         // now either data or a FCC:
         // now either data or a FCC:
-        if ( (FCC1 == *riff32) || (FCC1 == *list32) ) 
+        if ( (FCC1 == *riff32) || (FCC1 == *list32) )
         {
                    stream.Read(&FCC2, 4);
         }
         {
                    stream.Read(&FCC2, 4);
         }
-        else 
+        else
         {
             stream.SeekI(stream.TellI() + datalen);
         }
         {
             stream.SeekI(stream.TellI() + datalen);
         }
-        
+
         // try to read next data chunk:
         stream.Read(&FCC1, 4);
     }
         // try to read next data chunk:
         stream.Read(&FCC1, 4);
     }
@@ -1325,8 +1326,8 @@ bool wxANIHandler::DoCanRead(wxInputStream& stream)
 
 int wxANIHandler::GetImageCount(wxInputStream& stream)
 {
 
 int wxANIHandler::GetImageCount(wxInputStream& stream)
 {
-    wxInt32 FCC1, FCC2; 
-    wxUint32 datalen ;        
+    wxInt32 FCC1, FCC2;
+    wxUint32 datalen ;
     static const char *rifftxt = "RIFF";
     static const char *listtxt = "LIST";
     static const char *anihtxt = "anih";
     static const char *rifftxt = "RIFF";
     static const char *listtxt = "LIST";
     static const char *anihtxt = "anih";
@@ -1334,7 +1335,7 @@ int wxANIHandler::GetImageCount(wxInputStream& stream)
     wxInt32 *riff32 = (wxInt32 *) rifftxt;
     wxInt32 *list32 = (wxInt32 *) listtxt;
     wxInt32 *anih32 = (wxInt32 *) anihtxt;
     wxInt32 *riff32 = (wxInt32 *) rifftxt;
     wxInt32 *list32 = (wxInt32 *) listtxt;
     wxInt32 *anih32 = (wxInt32 *) anihtxt;
-            
+
     stream.SeekI(0);
     stream.Read(&FCC1, 4);
     if ( FCC1 != *riff32 )
     stream.SeekI(0);
     stream.Read(&FCC1, 4);
     if ( FCC1 != *riff32 )
@@ -1345,9 +1346,9 @@ int wxANIHandler::GetImageCount(wxInputStream& stream)
     {
         // we always have a data size:
         stream.Read(&datalen, 4);
     {
         // we always have a data size:
         stream.Read(&datalen, 4);
+
         // now either data or a FCC:
         // now either data or a FCC:
-        if ( (FCC1 == *riff32) || (FCC1 == *list32) ) 
+        if ( (FCC1 == *riff32) || (FCC1 == *list32) )
        {
            stream.Read(&FCC2, 4);
         }
        {
            stream.Read(&FCC2, 4);
         }
@@ -1361,10 +1362,10 @@ int wxANIHandler::GetImageCount(wxInputStream& stream)
                 delete[] pData;
                 return nIcons;
             }
                 delete[] pData;
                 return nIcons;
             }
-            else 
+            else
                 stream.SeekI(stream.TellI() + datalen);
         }
                 stream.SeekI(stream.TellI() + datalen);
         }
-        
+
         // try to read next data chunk:
         stream.Read(&FCC1, 4);
     }
         // try to read next data chunk:
         stream.Read(&FCC1, 4);
     }
index a29113876e5ab86dd6634c1ddfdab162b7ec388c..1d1e1500fb7c06e7635ca3def11144298c96b6d1 100644 (file)
@@ -334,7 +334,7 @@ typedef my_cquantizer * my_cquantize_ptr;
 
 void
 prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
 
 void
 prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
-          JSAMPARRAY output_buf, int num_rows)
+          JSAMPARRAY WXUNUSED(output_buf), int num_rows)
 {
   my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
   register JSAMPROW ptr;
 {
   my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
   register JSAMPROW ptr;
@@ -1284,7 +1284,7 @@ finish_pass1 (j_decompress_ptr cinfo)
 
 
 void
 
 
 void
-finish_pass2 (j_decompress_ptr cinfo)
+finish_pass2 (j_decompress_ptr WXUNUSED(cinfo))
 {
   /* no work */
 }
 {
   /* no work */
 }
index 5f069277de949d704d7c7e33a1629437adce4f20..c8207ca44e4fa48f52ecd9ecb4942c7fdc323565 100644 (file)
@@ -124,7 +124,7 @@ static size_t encode_utf16(wxUint32 input, wchar_t *output)
 {
     if (input<=0xffff)
     {
 {
     if (input<=0xffff)
     {
-        if (output) *output++ = input;
+        if (output) *output++ = (wchar_t) input;
         return 1;
     }
     else if (input>=0x110000)
         return 1;
     }
     else if (input>=0x110000)
@@ -135,8 +135,8 @@ static size_t encode_utf16(wxUint32 input, wchar_t *output)
     {
         if (output)
         {
     {
         if (output)
         {
-            *output++ = (input >> 10)+0xd7c0;
-            *output++ = (input&0x3ff)+0xdc00;
+            *output++ = (wchar_t) ((input >> 10)+0xd7c0);
+            *output++ = (wchar_t) ((input&0x3ff)+0xdc00);
         }
         return 2;
     }
         }
         return 2;
     }
@@ -389,7 +389,7 @@ size_t wxMBConvUTF8::WC2MB(char *buf, const wchar_t *psz, size_t n) const
         {
             // plain ASCII char
             if (buf)
         {
             // plain ASCII char
             if (buf)
-                *buf++ = cc;
+                *buf++ = (char) cc;
             len++;
         }
 
             len++;
         }
 
@@ -398,9 +398,9 @@ size_t wxMBConvUTF8::WC2MB(char *buf, const wchar_t *psz, size_t n) const
             len += cnt + 1;
             if (buf)
             {
             len += cnt + 1;
             if (buf)
             {
-                *buf++ = (-128 >> cnt) | ((cc >> (cnt * 6)) & (0x3f >> cnt));
+                *buf++ = (char) ((-128 >> cnt) | ((cc >> (cnt * 6)) & (0x3f >> cnt)));
                 while (cnt--)
                 while (cnt--)
-                    *buf++ = 0x80 | ((cc >> (cnt * 6)) & 0x3f);
+                    *buf++ = (char) (0x80 | ((cc >> (cnt * 6)) & 0x3f));
             }
         }
     }
             }
         }
     }
@@ -778,7 +778,7 @@ public:
                w2m.Init(wxFONTENCODING_UNICODE, enc);
     }
 
                w2m.Init(wxFONTENCODING_UNICODE, enc);
     }
 
-    size_t MB2WC(wchar_t *buf, const char *psz, size_t n)
+    size_t MB2WC(wchar_t *buf, const char *psz, size_t WXUNUSED(n))
     {
         size_t inbuf = strlen(psz);
         if (buf)
     {
         size_t inbuf = strlen(psz);
         if (buf)
@@ -786,7 +786,7 @@ public:
         return inbuf;
     }
 
         return inbuf;
     }
 
-    size_t WC2MB(char *buf, const wchar_t *psz, size_t n)
+    size_t WC2MB(char *buf, const wchar_t *psz, size_t WXUNUSED(n))
     {
 #if ( defined(__BORLANDC__) && (__BORLANDC__ > 0x530) ) \
     || ( defined(__MWERKS__) && defined(__WXMSW__) )
     {
 #if ( defined(__BORLANDC__) && (__BORLANDC__ > 0x530) ) \
     || ( defined(__MWERKS__) && defined(__WXMSW__) )
index 6449a5fdd4aba61af4a32c36e52fcd1c0efc4451..859f722a799739a856055f178520eb7d45a68877 100644 (file)
@@ -1810,7 +1810,7 @@ void wxVariant::operator= (const TIMESTAMP_STRUCT* value)
 
 #endif // wxUSE_ODBC
 
 
 #endif // wxUSE_ODBC
 
-bool wxVariant::operator==(const wxArrayString& value) const
+bool wxVariant::operator==(const wxArrayString& WXUNUSED(value)) const
 {
     wxFAIL_MSG( _T("TODO") );
 
 {
     wxFAIL_MSG( _T("TODO") );
 
index ce68b5ac34ac2e916e0eaa1d26ae815de77ce137..83253625efabc394d73b78426e2b9a21b18085db 100644 (file)
@@ -167,6 +167,10 @@ void wxWindowBase::InitBase()
     m_caret = (wxCaret *)NULL;
 #endif // wxUSE_CARET
 
     m_caret = (wxCaret *)NULL;
 #endif // wxUSE_CARET
 
+#if wxUSE_PALETTE
+    m_custompalette = false;
+#endif // wxUSE_PALETTE
+
     // Whether we're using the current theme for this window (wxGTK only for now)
     m_themeEnabled = FALSE;
 }
     // Whether we're using the current theme for this window (wxGTK only for now)
     m_themeEnabled = FALSE;
 }
@@ -1002,7 +1006,7 @@ void wxWindowBase::OnHelp(wxHelpEvent& event)
 #endif // wxUSE_HELP
 
 // ----------------------------------------------------------------------------
 #endif // wxUSE_HELP
 
 // ----------------------------------------------------------------------------
-// tooltips
+// tooltipsroot.Replace("\\", "/");
 // ----------------------------------------------------------------------------
 
 #if wxUSE_TOOLTIPS
 // ----------------------------------------------------------------------------
 
 #if wxUSE_TOOLTIPS
index 417ad1069fdf6e6490a86786fc77cc02c16ac046..c56008620eb1bc057f89a4031cfa2d1be0de1453 100644 (file)
@@ -407,7 +407,7 @@ static int LINKAGEMODE wxDirCtrlStringCompareFunction(const void *first, const v
 {
     wxString *strFirst = (wxString *)first;
     wxString *strSecond = (wxString *)second;
 {
     wxString *strFirst = (wxString *)first;
     wxString *strSecond = (wxString *)second;
-    
+
     return strFirst->CmpNoCase(*strSecond);
 }
 
     return strFirst->CmpNoCase(*strSecond);
 }
 
@@ -454,7 +454,7 @@ bool wxDirItemData::HasSubDirs() const
     return dir.HasSubDirs();
 }
 
     return dir.HasSubDirs();
 }
 
-bool wxDirItemData::HasFiles(const wxString& spec) const
+bool wxDirItemData::HasFiles(const wxString& WXUNUSED(spec)) const
 {
     if (m_path.IsEmpty())
         return FALSE;
 {
     if (m_path.IsEmpty())
         return FALSE;
@@ -578,8 +578,8 @@ void wxGenericDirCtrl::Init()
 void wxGenericDirCtrl::ShowHidden( bool show )
 {
     m_showHidden = show;
 void wxGenericDirCtrl::ShowHidden( bool show )
 {
     m_showHidden = show;
-    
-    // reparse FIXME 
+
+    // reparse FIXME
 }
 
 void wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int imageId)
 }
 
 void wxGenericDirCtrl::AddSection(const wxString& path, const wxString& name, int imageId)
index 144bac64698b91f96baf0a8d00a1cff2fd235a86..dfb01335a6e5adf29164ed4608b140ed3fad2dc7 100644 (file)
@@ -108,6 +108,16 @@ wxSplashScreenWindow::wxSplashScreenWindow(const wxBitmap& bitmap, wxWindow* par
     wxWindow(parent, id, pos, size, style)
 {
     m_bitmap = bitmap;
     wxWindow(parent, id, pos, size, style)
 {
     m_bitmap = bitmap;
+
+#ifndef __WXGTK__
+    bool hiColour = (wxDisplayDepth() >= 16) ;
+
+    if (bitmap.GetPalette() && !hiColour)
+    {
+        SetPalette(* bitmap.GetPalette());
+    }
+#endif
+
 }
 
 void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
 }
 
 void wxSplashScreenWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
@@ -131,7 +141,6 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x)
 
     if (bitmap.GetPalette() && !hiColour)
     {
 
     if (bitmap.GetPalette() && !hiColour)
     {
-        dc.SetPalette(* bitmap.GetPalette());
         dcMem.SetPalette(* bitmap.GetPalette());
     }
 #endif // USE_PALETTE_IN_SPLASH
         dcMem.SetPalette(* bitmap.GetPalette());
     }
 #endif // USE_PALETTE_IN_SPLASH
@@ -143,7 +152,6 @@ static void wxDrawSplashBitmap(wxDC& dc, const wxBitmap& bitmap, int WXUNUSED(x)
 #ifdef USE_PALETTE_IN_SPLASH
     if (bitmap.GetPalette() && !hiColour)
     {
 #ifdef USE_PALETTE_IN_SPLASH
     if (bitmap.GetPalette() && !hiColour)
     {
-        dc.SetPalette(wxNullPalette);
         dcMem.SetPalette(wxNullPalette);
     }
 #endif // USE_PALETTE_IN_SPLASH
         dcMem.SetPalette(wxNullPalette);
     }
 #endif // USE_PALETTE_IN_SPLASH
index d16901dee43b4357e014cfbd75def25711688673..89e0197b8bc47836cce9b69132c36e4baedf775c 100644 (file)
@@ -368,7 +368,7 @@ void wxTreeTextCtrl::OnChar( wxKeyEvent &event )
 
         if (!wxPendingDelete.Member(this))
             wxPendingDelete.Append(this);
 
         if (!wxPendingDelete.Member(this))
             wxPendingDelete.Append(this);
-            
+
         m_finished = TRUE;
         m_owner->SetFocus(); // This doesn't work. TODO.
 
         m_finished = TRUE;
         m_owner->SetFocus(); // This doesn't work. TODO.
 
@@ -424,7 +424,7 @@ void wxTreeTextCtrl::OnKillFocus( wxFocusEvent &event )
 
     (*m_accept) = TRUE;
     (*m_res) = GetValue();
 
     (*m_accept) = TRUE;
     (*m_res) = GetValue();
-    
+
     if ((*m_res) != m_startValue)
         m_owner->OnRenameAccept();
 }
     if ((*m_res) != m_startValue)
         m_owner->OnRenameAccept();
 }
@@ -716,7 +716,7 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent,
 #ifdef __WXMAC__
     int major,minor;
     wxGetOsVersion( &major, &minor );
 #ifdef __WXMAC__
     int major,minor;
     wxGetOsVersion( &major, &minor );
-    
+
     if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS;
     if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS;
     style &= ~wxTR_LINES_AT_ROOT;
     if (style & wxTR_HAS_BUTTONS) style |= wxTR_MAC_BUTTONS;
     if (style & wxTR_HAS_BUTTONS) style &= ~wxTR_HAS_BUTTONS;
     style &= ~wxTR_LINES_AT_ROOT;
@@ -766,7 +766,7 @@ wxGenericTreeCtrl::~wxGenericTreeCtrl()
 {
     delete m_hilightBrush;
     delete m_hilightUnfocusedBrush;
 {
     delete m_hilightBrush;
     delete m_hilightUnfocusedBrush;
-    
+
     if (m_arrowRight) delete m_arrowRight;
     if (m_arrowDown) delete m_arrowDown;
 
     if (m_arrowRight) delete m_arrowRight;
     if (m_arrowDown) delete m_arrowDown;
 
@@ -789,13 +789,13 @@ size_t wxGenericTreeCtrl::GetCount() const
 
 void wxGenericTreeCtrl::SetIndent(unsigned int indent)
 {
 
 void wxGenericTreeCtrl::SetIndent(unsigned int indent)
 {
-    m_indent = indent;
+    m_indent = (unsigned short) indent;
     m_dirty = TRUE;
 }
 
 void wxGenericTreeCtrl::SetSpacing(unsigned int spacing)
 {
     m_dirty = TRUE;
 }
 
 void wxGenericTreeCtrl::SetSpacing(unsigned int spacing)
 {
-    m_spacing = spacing;
+    m_spacing = (unsigned short) spacing;
     m_dirty = TRUE;
 }
 
     m_dirty = TRUE;
 }
 
@@ -2115,7 +2115,7 @@ void wxGenericTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level
             else if (HasFlag(wxTR_TWIST_BUTTONS))
             {
                 // draw the twisty button here
             else if (HasFlag(wxTR_TWIST_BUTTONS))
             {
                 // draw the twisty button here
-                
+
                 if (HasFlag(wxTR_AQUA_BUTTONS))
                 {
                     if (item->IsExpanded())
                 if (HasFlag(wxTR_AQUA_BUTTONS))
                 {
                     if (item->IsExpanded())
index 112bf3aff4721e1e93f89a798cdeb99d5f3eb794..9355867e81c90d0f0187253f6b079b14719f2de6 100644 (file)
@@ -32,7 +32,7 @@ FORCE_LINK_ME(m_style)
 
 TAG_HANDLER_BEGIN(STYLE, "STYLE")
 
 
 TAG_HANDLER_BEGIN(STYLE, "STYLE")
 
-    TAG_HANDLER_PROC(tag)
+    TAG_HANDLER_PROC(WXUNUSED(tag))
     {
         // VS: Ignore styles for now. We must have this handler present,
         //     because CSS style text would be rendered verbatim otherwise
     {
         // VS: Ignore styles for now. We must have this handler present,
         //     because CSS style text would be rendered verbatim otherwise
index bfc738c185ff28c84610f0071570cd2474cb6792..05445fae717820f4f8006c509390011d2a4311e1 100644 (file)
@@ -1143,7 +1143,7 @@ void wxDC::DoDrawRotatedText(const wxString& text,
 
 #if wxUSE_PALETTE
 
 
 #if wxUSE_PALETTE
 
-void wxDC::SetPalette(const wxPalette& palette)
+void wxDC::DoSelectPalette(bool realize)
 {
 #ifdef __WXMICROWIN__
     if (!GetHDC()) return;
 {
 #ifdef __WXMICROWIN__
     if (!GetHDC()) return;
@@ -1157,31 +1157,44 @@ void wxDC::SetPalette(const wxPalette& palette)
         m_oldPalette = 0;
     }
 
         m_oldPalette = 0;
     }
 
-    m_palette = palette;
-
-    if (!m_palette.Ok())
-    {
-        // Setting a NULL colourmap is a way of restoring
-        // the original colourmap
-        if (m_oldPalette)
-        {
-            ::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, FALSE);
-            m_oldPalette = 0;
-        }
-
-        return;
-    }
-
     if (m_palette.Ok() && m_palette.GetHPALETTE())
     {
         HPALETTE oldPal = ::SelectPalette(GetHdc(), (HPALETTE) m_palette.GetHPALETTE(), FALSE);
         if (!m_oldPalette)
             m_oldPalette = (WXHPALETTE) oldPal;
 
     if (m_palette.Ok() && m_palette.GetHPALETTE())
     {
         HPALETTE oldPal = ::SelectPalette(GetHdc(), (HPALETTE) m_palette.GetHPALETTE(), FALSE);
         if (!m_oldPalette)
             m_oldPalette = (WXHPALETTE) oldPal;
 
-        ::RealizePalette(GetHdc());
+        if (realize)
+            ::RealizePalette(GetHdc());
     }
     }
+
+
+}
+
+void wxDC::SetPalette(const wxPalette& palette)
+{
+    if (palette.Ok()) {
+        m_palette = palette;
+        DoSelectPalette(true);
+        }
 }
 
 }
 
+void wxDC::InitializePalette()
+{
+    if (wxDisplayDepth() <= 8) {
+        // look for any window or parent that has a custom palette. If any has
+        // one then we need to use it in drawing operations
+        wxWindow *win = m_canvas;
+        while (!win->HasCustomPalette() && win->GetParent()) win = win->GetParent();
+        if (win->HasCustomPalette()) {
+            m_palette = win->GetPalette();
+            m_custompalette = true;
+            // turn on MSW translation for this palette
+            DoSelectPalette();
+            }
+        else
+            m_custompalette = false;
+        }
+}
 #endif // wxUSE_PALETTE
 
 void wxDC::SetFont(const wxFont& the_font)
 #endif // wxUSE_PALETTE
 
 void wxDC::SetFont(const wxFont& the_font)
index d853cf580eafd5a10763882121c4b132161c9818..6d5df17f484938b49ad871ffd07347b9eae9a8f0 100644 (file)
@@ -113,6 +113,11 @@ void wxWindowDC::InitDC()
 
     // default bg colour is pne of the window
     SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
 
     // default bg colour is pne of the window
     SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
+
+    // since we are a window dc we need to grab the palette from the window
+#if wxUSE_PALETTE
+    InitializePalette();
+#endif
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
index dec87f4fc1b712cf5ec7aa3ebb42ad33492e3250..80ce3c606e6415059843c7a7dd0453802db34dba 100644 (file)
@@ -275,8 +275,9 @@ bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
 
 #ifndef __WXMICROWIN__
 int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
 
 #ifndef __WXMICROWIN__
 int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
-                                  DWORD dwStyle, LONG lParam)
+                                  DWORD WXUNUSED(dwStyle), LONG lParam)
 {
 {
+
     // we used to process TrueType fonts only, but there doesn't seem to be any
     // reasons to restrict ourselves to them here
 #if 0
     // we used to process TrueType fonts only, but there doesn't seem to be any
     // reasons to restrict ourselves to them here
 #if 0
index 91284a31d6abc16d72f39d3ee6de0873329a7826..0646ed78148501e57b575d6e82760790e5e7cf1d 100644 (file)
@@ -2339,7 +2339,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl,
         lvItem.mask |= LVIF_PARAM;
 }
 
         lvItem.mask |= LVIF_PARAM;
 }
 
-static void wxConvertToMSWListCol(int col, const wxListItem& item,
+static void wxConvertToMSWListCol(int WXUNUSED(col), const wxListItem& item,
                                   LV_COLUMN& lvCol)
 {
     wxZeroMemory(lvCol);
                                   LV_COLUMN& lvCol)
 {
     wxZeroMemory(lvCol);
index 65151fbf5e73e43dd6906bb44c53f14f98335f2b..e816a3d629cc51f368333dd2250e2c71372e68a7 100644 (file)
@@ -685,13 +685,13 @@ void wxDataObject::SetAutoDelete()
     m_pIDataObject = NULL;
 }
 
     m_pIDataObject = NULL;
 }
 
-size_t wxDataObject::GetBufferOffset( const wxDataFormat& format )
+size_t wxDataObject::GetBufferOffset( const wxDataFormat& WXUNUSED(format) )
 {
     return sizeof(size_t);
 }
 
 const void* wxDataObject::GetSizeFromBuffer( const void* buffer, size_t* size,
 {
     return sizeof(size_t);
 }
 
 const void* wxDataObject::GetSizeFromBuffer( const void* buffer, size_t* size,
-                                             const wxDataFormat& format )
+                                             const wxDataFormat& WXUNUSED(format) )
 {
     size_t* p = (size_t*)buffer;
     *size = *p;
 {
     size_t* p = (size_t*)buffer;
     *size = *p;
@@ -700,7 +700,7 @@ const void* wxDataObject::GetSizeFromBuffer( const void* buffer, size_t* size,
 }
 
 void* wxDataObject::SetSizeInBuffer( void* buffer, size_t size,
 }
 
 void* wxDataObject::SetSizeInBuffer( void* buffer, size_t size,
-                                       const wxDataFormat& format )
+                                       const wxDataFormat& WXUNUSED(format) )
 {
     size_t* p = (size_t*)buffer;
     *p = size;
 {
     size_t* p = (size_t*)buffer;
     *p = size;
@@ -1070,13 +1070,13 @@ class CFSTR_SHELLURLDataObject:public wxCustomDataObject
 public:
     CFSTR_SHELLURLDataObject() : wxCustomDataObject(CFSTR_SHELLURL) {}
 protected:
 public:
     CFSTR_SHELLURLDataObject() : wxCustomDataObject(CFSTR_SHELLURL) {}
 protected:
-    virtual size_t GetBufferOffset( const wxDataFormat& format )
+    virtual size_t GetBufferOffset( const wxDataFormat& WXUNUSED(format) )
     {
         return 0;
     }
 
     virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
     {
         return 0;
     }
 
     virtual const void* GetSizeFromBuffer( const void* buffer, size_t* size,
-                                           const wxDataFormat& format )
+                                           const wxDataFormat& WXUNUSED(format) )
     {
         // CFSTR_SHELLURL is _always_ ANSI text
         *size = strlen( (const char*)buffer );
     {
         // CFSTR_SHELLURL is _always_ ANSI text
         *size = strlen( (const char*)buffer );
@@ -1084,8 +1084,8 @@ protected:
         return buffer;
     }
 
         return buffer;
     }
 
-    virtual void* SetSizeInBuffer( void* buffer, size_t size,
-                                   const wxDataFormat& format )
+    virtual void* SetSizeInBuffer( void* buffer, size_t WXUNUSED(size),
+                                   const wxDataFormat& WXUNUSED(format) )
     {
         return buffer;
     }
     {
         return buffer;
     }
index 6f16032cc9f290dfc25cf3158cc43303e411fc7d..eb7c59e6ec28153543596efcb98c06ada37f56f5 100644 (file)
@@ -1087,7 +1087,7 @@ bool wxTextCtrl::MSWShouldPreProcessMessage(WXMSG* pMsg)
     // usual preprocessing for them
     if ( msg->message == WM_KEYDOWN )
     {
     // usual preprocessing for them
     if ( msg->message == WM_KEYDOWN )
     {
-        WORD vkey = msg->wParam;
+        WORD vkey = (WORD) msg->wParam;
         if ( (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN )
         {
             if ( vkey == VK_BACK )
         if ( (HIWORD(msg->lParam) & KF_ALTDOWN) == KF_ALTDOWN )
         {
             if ( vkey == VK_BACK )
@@ -1437,7 +1437,7 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
 // EN_LINK processing
 // ----------------------------------------------------------------------------
 
 // EN_LINK processing
 // ----------------------------------------------------------------------------
 
-bool wxTextCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
+bool wxTextCtrl::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM *result)
 {
     NMHDR *hdr = (NMHDR* )lParam;
     if ( hdr->code == EN_LINK )
 {
     NMHDR *hdr = (NMHDR* )lParam;
     if ( hdr->code == EN_LINK )
index 0d91882294aa19ecae29c400ee402708577d1466..b47f269cfd1770a7aeeb5b7451c3ceaf64cc2205 100644 (file)
@@ -890,14 +890,14 @@ void wxWindowMSW::SetScrollbar(int orient, int pos, int thumbVisible,
 
 void wxWindowMSW::ScrollWindow(int dx, int dy, const wxRect *prect)
 {
 
 void wxWindowMSW::ScrollWindow(int dx, int dy, const wxRect *prect)
 {
-    RECT rect, *pr;
+    RECT rect;
+    RECT *pr;
     if ( prect )
     {
         rect.left = prect->x;
         rect.top = prect->y;
         rect.right = prect->x + prect->width;
         rect.bottom = prect->y + prect->height;
     if ( prect )
     {
         rect.left = prect->x;
         rect.top = prect->y;
         rect.right = prect->x + prect->width;
         rect.bottom = prect->y + prect->height;
-
         pr = &rect;
     }
     else
         pr = &rect;
     }
     else
@@ -1951,11 +1951,12 @@ bool wxWindowMSW::MSWTranslateMessage(WXMSG* pMsg)
 #if wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
     return m_acceleratorTable.Translate(this, pMsg);
 #else
 #if wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
     return m_acceleratorTable.Translate(this, pMsg);
 #else
+    (void) pMsg;
     return FALSE;
 #endif // wxUSE_ACCEL
 }
 
     return FALSE;
 #endif // wxUSE_ACCEL
 }
 
-bool wxWindowMSW::MSWShouldPreProcessMessage(WXMSG* pMsg)
+bool wxWindowMSW::MSWShouldPreProcessMessage(WXMSG* WXUNUSED(pMsg))
 {
     // preprocess all messages by default
     return TRUE;
 {
     // preprocess all messages by default
     return TRUE;
@@ -2501,6 +2502,10 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
             processed = HandleSysColorChange();
             break;
 
             processed = HandleSysColorChange();
             break;
 
+        case WM_DISPLAYCHANGE:
+            processed = HandleDisplayChange();
+            break;
+
         case WM_PALETTECHANGED:
             processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
             break;
         case WM_PALETTECHANGED:
             processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
             break;
@@ -3289,6 +3294,14 @@ bool wxWindowMSW::HandleSysColorChange()
     return FALSE;
 }
 
     return FALSE;
 }
 
+bool wxWindowMSW::HandleDisplayChange()
+{
+    wxDisplayChangedEvent event;
+    event.SetEventObject(this);
+
+    return GetEventHandler()->ProcessEvent(event);
+}
+
 bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush,
                               WXHDC pDC,
                               WXHWND pWnd,
 bool wxWindowMSW::HandleCtlColor(WXHBRUSH *brush,
                               WXHDC pDC,
                               WXHWND pWnd,
@@ -3335,6 +3348,32 @@ WXHBRUSH wxWindowMSW::OnCtlColor(WXHDC WXUNUSED(hDC),
 
 bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange)
 {
 
 bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange)
 {
+#if wxUSE_PALETTE
+        // same as below except we don't respond to our own messages
+        if (hWndPalChange != GetHWND()) {
+        // check to see if we our our parents have a custom palette
+        wxWindow *win = this;
+        while (!win->HasCustomPalette() && win->GetParent()) win = win->GetParent();
+        if (win->HasCustomPalette()) {
+            /* realize the palette to see whether redrawing is needed */
+            HDC hdc = GetDC((HWND) hWndPalChange);
+            win->m_palette.SetHPALETTE( (WXHPALETTE)
+                ::SelectPalette(hdc, (HPALETTE) win->m_palette.GetHPALETTE(), false) );
+
+            int result = ::RealizePalette(hdc);
+            /* restore the palette (before releasing the DC) */
+            win->m_palette.SetHPALETTE( (WXHPALETTE)
+                ::SelectPalette(hdc, (HPALETTE) win->m_palette.GetHPALETTE(), true) );
+            RealizePalette(hdc);
+            ReleaseDC((HWND) hWndPalChange, hdc);
+            /* now check for the need to redraw */
+            if (result > 0)
+                InvalidateRect((HWND) hWndPalChange, NULL, TRUE);
+            }
+
+        }
+#endif
+
     wxPaletteChangedEvent event(GetId());
     event.SetEventObject(this);
     event.SetChangedWindow(wxFindWinFromHandle(hWndPalChange));
     wxPaletteChangedEvent event(GetId());
     event.SetEventObject(this);
     event.SetChangedWindow(wxFindWinFromHandle(hWndPalChange));
@@ -3344,6 +3383,29 @@ bool wxWindowMSW::HandlePaletteChanged(WXHWND hWndPalChange)
 
 bool wxWindowMSW::HandleQueryNewPalette()
 {
 
 bool wxWindowMSW::HandleQueryNewPalette()
 {
+
+#if wxUSE_PALETTE
+    // check to see if we our our parents have a custom palette
+    wxWindow *win = this;
+    while (!win->HasCustomPalette() && win->GetParent()) win = win->GetParent();
+    if (win->HasCustomPalette()) {
+        /* realize the palette to see whether redrawing is needed */
+        HDC hdc = GetDC((HWND) GetHWND());
+        win->m_palette.SetHPALETTE( (WXHPALETTE)
+             ::SelectPalette(hdc, (HPALETTE) win->m_palette.GetHPALETTE(), false) );
+
+        int result = ::RealizePalette(hdc);
+        /* restore the palette (before releasing the DC) */
+        win->m_palette.SetHPALETTE( (WXHPALETTE)
+             ::SelectPalette(hdc, (HPALETTE) win->m_palette.GetHPALETTE(), true) );
+        ::RealizePalette(hdc);
+        ::ReleaseDC((HWND) GetHWND(), hdc);
+        /* now check for the need to redraw */
+        if (result > 0)
+            ::InvalidateRect((HWND) GetHWND(), NULL, TRUE);
+        }
+#endif
+
     wxQueryNewPaletteEvent event(GetId());
     event.SetEventObject(this);
 
     wxQueryNewPaletteEvent event(GetId());
     event.SetEventObject(this);
 
@@ -3351,7 +3413,7 @@ bool wxWindowMSW::HandleQueryNewPalette()
 }
 
 // Responds to colour changes: passes event on to children.
 }
 
 // Responds to colour changes: passes event on to children.
-void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& event)
+void wxWindowMSW::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
 {
     // the top level window also reset the standard colour map as it might have
     // changed (there is no need to do it for the non top level windows as we
 {
     // the top level window also reset the standard colour map as it might have
     // changed (there is no need to do it for the non top level windows as we
index d7001dd1e9b1bb260f71a799df0d0966f9ef85cc..32ee02a04b11f08f660468273f63caef805c8310 100644 (file)
@@ -332,7 +332,7 @@ bool wxXmlDocument::Save(const wxString& filename) const
 //  wxXmlDocument loading routines
 //-----------------------------------------------------------------------------
 
 //  wxXmlDocument loading routines
 //-----------------------------------------------------------------------------
 
-/* 
+/*
     FIXME:
        - process all elements, including CDATA
  */
     FIXME:
        - process all elements, including CDATA
  */
@@ -349,12 +349,12 @@ inline static wxString CharToString(wxMBConv *conv,
     {
         size_t nLen = (len != wxSTRING_MAXLEN) ? len :
                           nLen = wxConvUTF8.MB2WC((wchar_t*) NULL, s, 0);
     {
         size_t nLen = (len != wxSTRING_MAXLEN) ? len :
                           nLen = wxConvUTF8.MB2WC((wchar_t*) NULL, s, 0);
-    
+
         wchar_t *buf = new wchar_t[nLen+1];
         wxConvUTF8.MB2WC(buf, s, nLen);
         buf[nLen] = 0;
         wchar_t *buf = new wchar_t[nLen+1];
         wxConvUTF8.MB2WC(buf, s, nLen);
         buf[nLen] = 0;
-        return wxString(buf, *conv, len);
         delete[] buf;
         delete[] buf;
+        return wxString(buf, *conv, len);
     }
     else
         return wxString(s, len);
     }
     else
         return wxString(s, len);
@@ -473,21 +473,21 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData),
     char mbBuf[255];
     wchar_t wcBuf[255];
     size_t i;
     char mbBuf[255];
     wchar_t wcBuf[255];
     size_t i;
-    
+
     for (i = 0; i < 255; i++)
     for (i = 0; i < 255; i++)
-        mbBuf[i] = i+1;
+        mbBuf[i] = (char) (i+1);
     mbBuf[255] = 0;
     conv.MB2WC(wcBuf, mbBuf, 255);
     wcBuf[255] = 0;
     mbBuf[255] = 0;
     conv.MB2WC(wcBuf, mbBuf, 255);
     wcBuf[255] = 0;
-    
+
     info->map[0] = 0;
     for (i = 0; i < 255; i++)
         info->map[i+1] = (int)wcBuf[i];
     info->map[0] = 0;
     for (i = 0; i < 255; i++)
         info->map[i+1] = (int)wcBuf[i];
-    
+
     info->data = NULL;
     info->convert = NULL;
     info->release = NULL;
     info->data = NULL;
     info->convert = NULL;
     info->release = NULL;
-    
+
     return 1;
 }
 
     return 1;
 }
 
@@ -512,7 +512,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
     if ( encoding != wxT("UTF-8") && encoding != wxT("utf-8") )
         ctx.conv = new wxCSConv(encoding);
 #endif
     if ( encoding != wxT("UTF-8") && encoding != wxT("utf-8") )
         ctx.conv = new wxCSConv(encoding);
 #endif
-    
+
     XML_SetUserData(parser, (void*)&ctx);
     XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
     XML_SetCharacterDataHandler(parser, TextHnd);
     XML_SetUserData(parser, (void*)&ctx);
     XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
     XML_SetCharacterDataHandler(parser, TextHnd);
@@ -542,7 +542,7 @@ bool wxXmlDocument::Load(wxInputStream& stream, const wxString& encoding)
     if ( ctx.conv )
         delete ctx.conv;
 #endif
     if ( ctx.conv )
         delete ctx.conv;
 #endif
-    
+
     return TRUE;
 
 }
     return TRUE;
 
 }
@@ -572,7 +572,7 @@ inline static void OutputString(wxOutputStream& stream, const wxString& str,
 #endif
 }
 
 #endif
 }
 
-// Same as above, but create entities first. 
+// Same as above, but create entities first.
 // Translates '<' to "&lt;", '>' to "&gt;" and '&' to "&amp;"
 static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
                             wxMBConv *convMem, wxMBConv *convFile)
 // Translates '<' to "&lt;", '>' to "&gt;" and '&' to "&amp;"
 static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
                             wxMBConv *convMem, wxMBConv *convFile)
@@ -580,25 +580,25 @@ static void OutputStringEnt(wxOutputStream& stream, const wxString& str,
     wxString buf;
     size_t i, last, len;
     wxChar c;
     wxString buf;
     size_t i, last, len;
     wxChar c;
-    
+
     len = str.Len();
     last = 0;
     for (i = 0; i < len; i++)
     {
         c = str.GetChar(i);
     len = str.Len();
     last = 0;
     for (i = 0; i < len; i++)
     {
         c = str.GetChar(i);
-        if (c == wxT('<') || c == wxT('>') || 
+        if (c == wxT('<') || c == wxT('>') ||
             (c == wxT('&') && str.Mid(i+1, 4) != wxT("amp;")))
         {
             OutputString(stream, str.Mid(last, i - last), convMem, convFile);
             switch (c)
             {
             (c == wxT('&') && str.Mid(i+1, 4) != wxT("amp;")))
         {
             OutputString(stream, str.Mid(last, i - last), convMem, convFile);
             switch (c)
             {
-                case wxT('<'): 
+                case wxT('<'):
                     OutputString(stream, wxT("&lt;"), NULL, NULL);
                     break;
                     OutputString(stream, wxT("&lt;"), NULL, NULL);
                     break;
-                case wxT('>'): 
+                case wxT('>'):
                     OutputString(stream, wxT("&gt;"), NULL, NULL);
                     break;
                     OutputString(stream, wxT("&gt;"), NULL, NULL);
                     break;
-                case wxT('&'): 
+                case wxT('&'):
                     OutputString(stream, wxT("&amp;"), NULL, NULL);
                     break;
                 default: break;
                     OutputString(stream, wxT("&amp;"), NULL, NULL);
                     break;
                 default: break;
@@ -628,11 +628,11 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
         case wxXML_TEXT_NODE:
             OutputStringEnt(stream, node->GetContent(), convMem, convFile);
             break;
         case wxXML_TEXT_NODE:
             OutputStringEnt(stream, node->GetContent(), convMem, convFile);
             break;
-            
+
         case wxXML_ELEMENT_NODE:
             OutputString(stream, wxT("<"), NULL, NULL);
             OutputString(stream, node->GetName(), NULL, NULL);
         case wxXML_ELEMENT_NODE:
             OutputString(stream, wxT("<"), NULL, NULL);
             OutputString(stream, node->GetName(), NULL, NULL);
-            
+
             prop = node->GetProperties();
             while (prop)
             {
             prop = node->GetProperties();
             while (prop)
             {
@@ -642,7 +642,7 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
                 // FIXME - what if prop contains '"'?
                 prop = prop->GetNext();
             }
                 // FIXME - what if prop contains '"'?
                 prop = prop->GetNext();
             }
-            
+
             if (node->GetChildren())
             {
                 OutputString(stream, wxT(">"), NULL, NULL);
             if (node->GetChildren())
             {
                 OutputString(stream, wxT(">"), NULL, NULL);
@@ -665,13 +665,13 @@ static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent,
             else
                 OutputString(stream, wxT("/>"), NULL, NULL);
             break;
             else
                 OutputString(stream, wxT("/>"), NULL, NULL);
             break;
-             
+
         case wxXML_COMMENT_NODE:
             OutputString(stream, wxT("<!--"), NULL, NULL);
             OutputString(stream, node->GetContent(), convMem, convFile);
             OutputString(stream, wxT("-->"), NULL, NULL);
             break;
         case wxXML_COMMENT_NODE:
             OutputString(stream, wxT("<!--"), NULL, NULL);
             OutputString(stream, node->GetContent(), convMem, convFile);
             OutputString(stream, wxT("-->"), NULL, NULL);
             break;
-            
+
         default:
             wxFAIL_MSG(wxT("unsupported node type"));
     }
         default:
             wxFAIL_MSG(wxT("unsupported node type"));
     }
@@ -681,9 +681,9 @@ bool wxXmlDocument::Save(wxOutputStream& stream) const
 {
     if ( !IsOk() )
         return FALSE;
 {
     if ( !IsOk() )
         return FALSE;
-        
+
     wxString s;
     wxString s;
-    
+
     wxMBConv *convMem = NULL, *convFile = NULL;
 #if wxUSE_UNICODE
     convFile = new wxCSConv(GetFileEncoding());
     wxMBConv *convMem = NULL, *convFile = NULL;
 #if wxUSE_UNICODE
     convFile = new wxCSConv(GetFileEncoding());
@@ -694,18 +694,18 @@ bool wxXmlDocument::Save(wxOutputStream& stream) const
         convMem = new wxCSConv(GetEncoding());
     }
 #endif
         convMem = new wxCSConv(GetEncoding());
     }
 #endif
-    
+
     s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
              GetVersion().c_str(), GetFileEncoding().c_str());
     OutputString(stream, s, NULL, NULL);
     s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
              GetVersion().c_str(), GetFileEncoding().c_str());
     OutputString(stream, s, NULL, NULL);
-    
+
     OutputNode(stream, GetRoot(), 0, convMem, convFile);
     OutputString(stream, wxT("\n"), NULL, NULL);
     OutputNode(stream, GetRoot(), 0, convMem, convFile);
     OutputString(stream, wxT("\n"), NULL, NULL);
-    
+
     if ( convFile )
         delete convFile;
     if ( convMem )
         delete convMem;
     if ( convFile )
         delete convFile;
     if ( convMem )
         delete convMem;
-        
+
     return TRUE;
 }
     return TRUE;
 }