]> git.saurik.com Git - wxWidgets.git/commitdiff
Merged latest changes from SciTech code base into wxWindows CVS Tree.
authorKendall Bennett <KendallB@scitechsoft.com>
Fri, 8 Jun 2001 19:37:56 +0000 (19:37 +0000)
committerKendall Bennett <KendallB@scitechsoft.com>
Fri, 8 Jun 2001 19:37:56 +0000 (19:37 +0000)
Includes updates to remove Watcom compiler warnings and the latest
updates to the wxApplet code.

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

16 files changed:
contrib/include/wx/applet/applet.h
contrib/include/wx/applet/window.h
contrib/include/wx/xml/xmlio.h
contrib/src/applet/applet.cpp
contrib/src/applet/appletwindow.cpp
contrib/src/xml/expat/xmltok/xmlrole.c
contrib/src/xml/expat/xmltok/xmltok_impl.c
contrib/src/xml/xmlexpat.cpp
contrib/src/xml/xmlres.cpp
include/wx/datstrm.h
include/wx/html/htmlwin.h
src/common/datetime.cpp
src/common/datstrm.cpp
src/common/imagxpm.cpp
src/common/string.cpp
src/msw/window.cpp

index 60bc247cbf7d193a13dfeb33547fe8e46c5c9821..c67272bacaec3fbf1b967ca958169e91cf7a095e 100644 (file)
 #define __WX_APPLET_H
 
 #include "wx/panel.h"
-#include "wx/applet/window.h"
+#include "wx/html/htmlwin.h"
+
+// Forward declaration
+class wxHtmlAppletWindow;
 
 /*--------------------------- Class Definitions ---------------------------*/
 
@@ -46,38 +49,41 @@ class wxApplet : public wxPanel {
 private:
     DECLARE_ABSTRACT_CLASS(wxApplet);
     DECLARE_EVENT_TABLE();
-    
+
 protected:
-    wxHtmlAppletWindow  *m_Parent;
+    wxHtmlAppletWindow  *m_parent;
 
-            // Special handler for background erase messages            
+            // Special handler for background erase messages
             void OnEraseBackground(wxEraseEvent&);
-        
+
 public:
             // Constructor (called during dynamic creation)
-            wxApplet() { m_Parent = NULL; }
-    
+            wxApplet() { m_parent = NULL; };
+
             // Psuedo virtual constructor
     virtual bool Create(
                 wxHtmlAppletWindow *parent,
+                const wxHtmlTag& params,
                 const wxSize& size,
                 long style = wxTAB_TRAVERSAL | wxNO_BORDER);
-                
+
             // Virtual destructor
     virtual ~wxApplet();
 
             // Handle HTML navigation to a new URL
-    virtual void OnLinkClicked(const wxHtmlLinkInfo& link) = 0; 
-            
+    virtual void OnLinkClicked(const wxHtmlLinkInfo& link) = 0;
+
             // Handle HTML navigation forward command in applet
     virtual void OnHistoryForward() = 0;
-            
+
             // Handle HTML navigation back command in applet
     virtual void OnHistoryBack() = 0;
-            
+
             // Handle messages from the wxAppletManager and other applets
     virtual void OnMessage(wxEvent& msg) = 0;
     };
-    
+
+
+
 #endif // __WX_APPLET_H
 
index 2840c22c83f1e1168442e4aa09c1e9f6b92e199c..6ac0fcc72b46ce379c26904ea4b65aaac46785cd 100644 (file)
 
 #include "wx/html/htmlwin.h"
 
-/*--------------------------- Class Definitions ---------------------------*/
+// Forward declare
+class wxApplet;
+class wxLoadPageEvent;
+class wxPageLoadedEvent;
+class wxIncludePrep;
 
 // Declare a linked list of wxApplet pointers
-class wxApplet;
 WX_DECLARE_LIST(wxApplet, wxAppletList);
 
+/*--------------------------- Class Definitions ---------------------------*/
+
 /****************************************************************************
-MEMBERS:
-appletModules   - List of register applet modules   
-appletList      - List of all active applets instances
-cookies         - Hash table for managing cookies       
+REMARKS:
+Defines the class for virtual-link data types
+****************************************************************************/
+class VirtualData : public wxObject {
+private:
+    wxString m_name;
+    wxString m_group;
+    wxString m_href;
 
+public:
+            // Ctors
+            VirtualData(
+                wxString& name,
+                wxString& group,
+                wxString& href );
+
+            // Gets
+            wxString GetName(){ return m_name;};
+            wxString GetGroup(){ return m_group;};
+            wxString GetHref(){ return m_href;};
+
+            // Sets
+            void SetName (wxString& s){ m_name = s; };
+            void SetGroup(wxString& s){ m_group = s; };
+            void SetHref (wxString& s){ m_href = s; };
+    };
+
+/****************************************************************************
 REMARKS:
 Defines the class for wxAppletWindow. This class is derived from the
 wxHtmlWindow class and extends it with functionality to handle embedded
@@ -56,59 +84,75 @@ class wxHtmlAppletWindow : public wxHtmlWindow {
 private:
     DECLARE_CLASS(wxHtmlAppletWindow);
     DECLARE_EVENT_TABLE();
-    
+
+    wxIncludePrep *incPreprocessor;  // deleted by list it is added too in constructor
 protected:
-    wxAppletList    m_AppletList;       
-    wxHashTable     m_Cookies;
-        
+       wxAppletList            m_AppletList;           
+       static wxHashTable      m_Cookies;
+    wxToolBarBase       *m_NavBar;
+    int                 m_NavBackId;
+    int                 m_NavForwardId;
+               
 public:
             // Constructor
             wxHtmlAppletWindow(
                 wxWindow *parent,
                 wxWindowID id = -1,
+                wxToolBarBase *navBar = NULL,
+                int navBackId = -1,
+                int navForwardId = -1,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = wxHW_SCROLLBAR_AUTO,
                 const wxString& name = "htmlAppletWindow");
-                
+
             // Destructor
             ~wxHtmlAppletWindow();
-    
+
             // Create an instance of an applet based on it's class name
             wxApplet *CreateApplet(
-                const wxString& className,          
+                const wxString& classId,
+                const wxString& iName,
+                const wxHtmlTag &params,
                 const wxSize& size);
-                
+
             // Find an instance of an applet based on it's class name
-            wxApplet *FindApplet(const wxString& className);            
-            
+            wxApplet *FindApplet(const wxString& className);
+
             // Remove an applet from the window. Called during applet destruction
-            bool RemoveApplet(const wxApplet *applet);          
+            bool RemoveApplet(const wxApplet *applet);
 
             // Load a new URL page
-            bool LoadPage(const wxString& hRef);
-            
+    virtual bool LoadPage(const wxString& location);
+
             // Called when users clicked on hypertext link.
-            void OnLinkClicked(const wxHtmlLinkInfo& link);
-            
+    virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
+
             // Handles forward navigation within the HTML stack
             bool HistoryForward();
-            
+
             // Handles backwards navigation within the HTML stack
             bool HistoryBack();
-            
+
             // Broadcast a message to all applets on the page
             void SendMessage(wxEvent& msg);
-            
+
             // Register a cookie of data in the applet manager
             bool RegisterCookie(const wxString& name,wxObject *cookie);
-            
+
             // UnRegister a cookie of data in the applet manager
             bool UnRegisterCookie(const wxString& name);
-            
+
             // Find a cookie of data given it's public name
             wxObject *FindCookie(const wxString& name);
+                       
+            // Event handlers to load a new page       
+                       void OnLoadPage(wxLoadPageEvent &event);
+
+            // Event handlers to load a new page       
+               void OnPageLoaded(wxPageLoadedEvent &event);
+
     };
-    
+
 #endif // __WX_APPLET_WINDOW_H
 
index 452db4f80dc5484c4ca49e914fd7cdaefa95353c..a38e8a54c589a8e04d8db73ea8ab48f860da8a23 100644 (file)
@@ -28,7 +28,7 @@ public:
     virtual bool CanSave() { return FALSE; }
 
     virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
-    virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) { return FALSE; }
+    virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) { (void)stream; (void)doc; return FALSE; }
 };
 
 
@@ -36,10 +36,10 @@ class WXXMLDLLEXPORT wxXmlIOHandlerWriter : public wxXmlIOHandler
 {
 public:
     virtual wxXmlIOType GetType() { return wxXML_IO_TEXT_OUTPUT; }
-    virtual bool CanLoad(wxInputStream& stream) { return FALSE; }
+    virtual bool CanLoad(wxInputStream& stream) { (void)stream; return FALSE; }
     virtual bool CanSave() { return TRUE; }
 
-    virtual bool Load(wxInputStream& stream, wxXmlDocument& doc) { return FALSE; }
+    virtual bool Load(wxInputStream& stream, wxXmlDocument& doc) { (void)stream; (void)doc; return FALSE; }
     virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
 };
 
index 0083d5ff9ded10da24ea81f12100002230f9e93f..69f8f2620f46b6beff65bcf46e3deca046e4e058 100644 (file)
@@ -35,6 +35,7 @@
 
 // Include private headers
 #include "wx/applet/applet.h"
+#include "wx/applet/window.h"
 
 /*------------------------- Implementation --------------------------------*/
 
@@ -54,12 +55,13 @@ Psuedo virtual constructor for the wxApplet class.
 ****************************************************************************/
 bool wxApplet::Create(
     wxHtmlAppletWindow *parent,
+    const wxHtmlTag& ,
     const wxSize& size,
     long style)
 {
     bool ret = wxPanel::Create(parent, -1, wxDefaultPosition, size, style);
     if (ret) {
-        m_Parent = parent;
+        m_parent = parent;
         }
     return ret;
 }
@@ -70,7 +72,7 @@ Destructor for the wxApplet class.
 ****************************************************************************/
 wxApplet::~wxApplet()
 {
-    m_Parent->RemoveApplet(this);           
+    m_parent->RemoveApplet(this);
 }
 
 /****************************************************************************
@@ -78,7 +80,7 @@ REMARKS:
 Special handler for background erase messages. We do nothing in here which
 causes the background to not be erased which is exactly what we want. All
 the wxApplet classes display over an HTML window, so we want the HTML
-background to show through.             
+background to show through.
 ****************************************************************************/
 void wxApplet::OnEraseBackground(wxEraseEvent&)
 {
index 66c9fe0d9378753b8ae71bbf1a99928851c39d66..b7effb3bd048d552e07085c29f501167bfabd025 100644 (file)
 
 // For compilers that support precompilation
 #include "wx/wxprec.h"
+#include "wx/html/forcelnk.h"
 
 // Include private headers
 #include "wx/applet/applet.h"
+#include "wx/applet/window.h"
+#include "wx/applet/loadpage.h"
 
+// Preprocessor Stuff
+#include "wx/applet/prepinclude.h"
+#include "wx/applet/prepecho.h"
+#include "wx/applet/prepifelse.h"
+
+
+/*---------------------------- Global variables ---------------------------*/
+
+wxHashTable wxHtmlAppletWindow::m_Cookies;             
+               
 /*------------------------- Implementation --------------------------------*/
 
 // Empty event handler. We include this event handler simply so that
 // sub-classes of wxApplet can reference wxApplet in the event tables
 // that they create as necessary.
 BEGIN_EVENT_TABLE(wxHtmlAppletWindow, wxHtmlWindow)
+       EVT_LOAD_PAGE(wxHtmlAppletWindow::OnLoadPage)
+    EVT_PAGE_LOADED(wxHtmlAppletWindow::OnPageLoaded)
 END_EVENT_TABLE()
 
 // Implement the class functions for wxHtmlAppletWindow
@@ -58,14 +73,37 @@ Constructor for the applet window class.
 wxHtmlAppletWindow::wxHtmlAppletWindow(
     wxWindow *parent,
     wxWindowID id,
+    wxToolBarBase *navBar,
+    int navBackId,
+    int navForwardId,
     const wxPoint& pos,
     const wxSize& size,
     long style,
     const wxString& name)
     : wxHtmlWindow(parent,id,pos,size,style,name)
 {
-    // Ensure all cookie data is destroyed when window is killed
-    m_Cookies.DeleteContents(true);
+    //setup client navbars
+    if (navBar) {
+        m_NavBar = navBar;
+        m_NavBackId = navBackId;
+        m_NavForwardId = navForwardId;
+        }
+    else {
+        m_NavBar = NULL;
+        }
+
+    //Add HTML preprocessors
+    // deleting preprocessors is done by the code within the window
+
+    incPreprocessor = new wxIncludePrep(); // #include preprocessor
+    wxEchoPrep * echoPreprocessor = new wxEchoPrep(); // #echo preprocessor
+    wxIfElsePrep * ifPreprocessor = new wxIfElsePrep();
+
+    this->AddProcessor(incPreprocessor);
+    this->AddProcessor(echoPreprocessor);
+    this->AddProcessor(ifPreprocessor);
+
+
 }
 
 /****************************************************************************
@@ -91,15 +129,13 @@ created dynamically based on string values embedded in the custom tags of an
 HTML page.
 ****************************************************************************/
 wxApplet *wxHtmlAppletWindow::CreateApplet(
-    const wxString& className,          
+    const wxString& classId,
+    const wxString& iName,
+    const wxHtmlTag& params,
     const wxSize& size)
 {
-    // We presently only allow one applet per page of the same class!
-    if (m_AppletList.Find(className))
-        return NULL;
-
     // Dynamically create the class instance at runtime
-    wxClassInfo *info = wxClassInfo::FindClass(className.c_str());
+    wxClassInfo *info = wxClassInfo::FindClass(classId.c_str());
     if (!info)
         return NULL;
     wxObject *obj = info->CreateObject();
@@ -108,11 +144,11 @@ wxApplet *wxHtmlAppletWindow::CreateApplet(
     wxApplet *applet = wxDynamicCast(obj,wxApplet);
     if (!applet)
         return NULL;
-    if (!applet->Create(this,size)) {
+    if (!applet->Create(this,params,size)) {
         delete applet;
         return NULL;
         }
-    m_AppletList.Append(className,applet);
+    m_AppletList.Append(iName,applet);
     return applet;
 }
 
@@ -133,7 +169,7 @@ wxApplet *wxHtmlAppletWindow::FindApplet(
     if (!node)
         return NULL;
     return node->GetData();
-}           
+}
 
 /****************************************************************************
 PARAMETERS:
@@ -156,7 +192,7 @@ bool wxHtmlAppletWindow::RemoveApplet(
             }
         }
     return false;
-}           
+}
 
 /****************************************************************************
 PARAMETERS:
@@ -169,11 +205,64 @@ REMARKS:
 Remove an applet from the manager. Called during applet destruction
 ****************************************************************************/
 bool wxHtmlAppletWindow::LoadPage(
-    const wxString& hRef)
+    const wxString& link)
 {
+    wxString    href(link);
+
+    // TODO: This needs to be made platform inde if possible.
+    if (link.GetChar(0) == '?'){
+        wxString cmd = link.BeforeFirst('=');
+        wxString cmdValue = link.AfterFirst('=');
+
+        if(!(cmd.CmpNoCase("?EXTERNAL"))){
+#ifdef  __WINDOWS__
+                ShellExecute(this ? (HWND)this->GetHWND() : NULL,NULL,cmdValue.c_str(),NULL,"",SW_SHOWNORMAL);
+#else
+                #error Platform not implemented yet!
+#endif
+            return true;
+            }
+        if (!(cmd.CmpNoCase("?EXECUTE"))){
+            wxMessageBox(cmdValue);
+            return true;
+            }
+        if (!(cmd.CmpNoCase("?VIRTUAL"))){
+            VirtualData& temp = *((VirtualData*)FindCookie(cmdValue));
+            if (&temp) {
+                href = temp.GetHref();
+                }
+            else {
+#ifdef CHECKED
+                wxMessageBox("VIRTUAL LINK ERROR: " + cmdValue + " does not exist.");
+#endif
+                return true;
+                }
+            }
+        }
+
+    // Grab the directory from the string for use in the include preprocessor
+    // make sure we get either type of / or \.
+    int ch = link.Find('\\', true);
+    if (ch == -1) ch = link.Find('/', true);
+    if (ch != -1) {
+        wxFileSystem fs;
+        wxString tmp = link.Mid(0, ch+1);
+        fs.ChangePathTo(incPreprocessor->GetDirectory(), true);
+        fs.ChangePathTo(tmp, true);
+        incPreprocessor->ChangeDirectory(fs.GetPath());
+        }
+
+    // Inform all the applets that the new page is being loaded
     for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
-        (node->GetData())->OnLinkClicked(hRef);
-    return wxHtmlWindow::LoadPage(hRef);
+        (node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
+    bool stat = wxHtmlWindow::LoadPage(href);
+
+    // Enable/Dis the navbar tools
+    if (m_NavBar) {
+        m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward());
+        m_NavBar->EnableTool(m_NavBackId,HistoryCanBack());
+        }
+    return stat;
 }
 
 /****************************************************************************
@@ -187,9 +276,7 @@ call the LoadPage function above to load the new page and display it.
 void wxHtmlAppletWindow::OnLinkClicked(
     const wxHtmlLinkInfo& link)
 {
-    for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
-        (node->GetData())->OnLinkClicked(link);
-    wxHtmlWindow::LoadPage(link.GetHref());
+    LoadPage(link.GetHref());
 }
 
 /****************************************************************************
@@ -200,10 +287,12 @@ command prior to being destructed when the current page is destroyed.
 ****************************************************************************/
 bool wxHtmlAppletWindow::HistoryForward()
 {
-    if (!HistoryCanForward())   
+    if (!HistoryCanForward())
         return false;
+
     for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
         (node->GetData())->OnHistoryForward();
+
     return wxHtmlWindow::HistoryForward();
 }
 
@@ -215,10 +304,12 @@ command prior to being destructed when the current page is destroyed.
 ****************************************************************************/
 bool wxHtmlAppletWindow::HistoryBack()
 {
-    if (!HistoryCanBack())  
+    if (!HistoryCanBack())
         return false;
+
     for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
         (node->GetData())->OnHistoryBack();
+
     return wxHtmlWindow::HistoryBack();
 }
 
@@ -239,21 +330,24 @@ value (ie: by default it is true).
 ****************************************************************************/
 void wxHtmlAppletWindow::SendMessage(
     wxEvent& msg)
-{   
+{
     // Preset the skip flag
     msg.Skip();
-    
+
     // 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())
+        if (!msg.GetSkipped()){
+            wxMessageBox("BREAK");
             break;
+            }
         }
 }
 
 /****************************************************************************
 PARAMETERS:
-msg - wxEvent message to be sent to all wxApplets
+name    - Uniq wxString used as hash key
+cookie  - wxObject data returned when name is found.
 
 RETURNS:
 True if new cookie was added, false if cookie with same name already exists.
@@ -281,13 +375,13 @@ bool wxHtmlAppletWindow::RegisterCookie(
     // Fail if the named cookie already exists!
     if (m_Cookies.Get(name))
         return false;
-    m_Cookies.Put(name,cookie); 
+    m_Cookies.Put(name,cookie);
     return true;
 }
 
 /****************************************************************************
 PARAMETERS:
-msg - wxEvent message to be sent to all wxApplets
+name - wxString uniq haskey used to remove item from hash
 
 RETURNS:
 True if found and deleted, false if not found in table.
@@ -326,6 +420,57 @@ wxObject *wxHtmlAppletWindow::FindCookie(
     return m_Cookies.Get(name);
 }
 
+/****************************************************************************
+PARAMETERS:
+event   - Event to handle
+
+REMARKS:
+This function handles delayed LoadPage events posted from applets that
+need to change the page for the current window to a new window.
+****************************************************************************/
+void wxHtmlAppletWindow::OnLoadPage(
+    wxLoadPageEvent &event)
+{
+    if (event.GetHtmlWindow() == this){
+        if (LoadPage(event.GetHRef())){
+            wxPageLoadedEvent evt;
+            }
+        }
+}
+
+/****************************************************************************
+PARAMETERS:
+event   - Event to handle
+
+REMARKS:
+This function handles delayed LoadPage events posted from applets that
+need to change the page for the current window to a new window.
+****************************************************************************/
+void wxHtmlAppletWindow::OnPageLoaded(
+    wxPageLoadedEvent &)
+{
+    Enable(true);
+}
+
+/****************************************************************************
+PARAMETERS:
+name    - name of the last applet that changed the data in this object
+group   - name of the group the allplet belongs to.
+href    - webpage to go to.
+
+REMARKS:
+VirtualData is used to store information on the virtual links.
+****************************************************************************/
+VirtualData::VirtualData(
+    wxString& name,
+    wxString& group,
+    wxString& href )
+{
+    m_name = name;
+    m_group = group;
+    m_href = href;
+}
+
 #include "wx/html/m_templ.h"
 
 /****************************************************************************
@@ -334,38 +479,62 @@ Implementation for the <embed> HTML tag handler. This handler takes care
 of automatically constructing the wxApplet objects of the appropriate
 class based on the <embed> tag information.
 ****************************************************************************/
-TAG_HANDLER_BEGIN(Embed, "EMBED")
+TAG_HANDLER_BEGIN(wxApplet, "WXAPPLET")
 
 TAG_HANDLER_PROC(tag)
 {
-    wxWindow            *wnd;
-    wxHtmlAppletWindow  *appletWindow;
-    wxApplet            *applet;
-    int                 width, height;
-    int                 floatPercent = 0;
-
-    wnd = m_WParser->GetWindow();
-    if ((appletWindow = wxDynamicCast(wnd,wxHtmlAppletWindow)) != NULL) {
-        tag.ScanParam("WIDTH", "%i", &width);
-        tag.ScanParam("HEIGHT", "%i", &height);
-        if (tag.HasParam("FLOAT"))
-            tag.ScanParam("FLOAT", "%i", &floatPercent);
-        if (tag.HasParam("APPLET")) {
-            if ((applet = appletWindow->CreateApplet(tag.GetParam("APPLET"), wxSize(width, height))) != NULL) {
-                applet->Show(true);
-                m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(applet,floatPercent));
+       wxWindow                        *wnd;
+       wxHtmlAppletWindow      *appletWindow;
+       wxApplet                        *applet;
+    wxString            classId;
+    wxString            name;
+    int                                width, height;
+
+       wnd = m_WParser->GetWindow();
+
+       if ((appletWindow = wxDynamicCast(wnd,wxHtmlAppletWindow)) != NULL){
+               tag.ScanParam("WIDTH", "%i", &width);
+               tag.ScanParam("HEIGHT", "%i", &height); 
+        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 , wxSize(width, height))) != NULL){
+                               applet->Show(true);
+                               m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(applet,0));
+                               }
+            else
+                wxMessageBox("wxApplet error: Could not create:" + classId + "," + name);
+                       }
+        else{
+            wxMessageBox("wxApplet tag error: Can not find CLASSID param.","Error",wxICON_ERROR);
+            return false;
             }
-        else if (tag.HasParam("TEXT")) {
-            // TODO: Somehow get the text returned from this class displayed on the page!
-            }
+        //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 false;
+
+       return false;
 }
 
-TAG_HANDLER_END(Embed)
+TAG_HANDLER_END(wxApplet)
+
+TAGS_MODULE_BEGIN(wxApplet)
+    TAGS_MODULE_ADD(wxApplet)
+TAGS_MODULE_END(wxApplet)
 
-TAGS_MODULE_BEGIN(Embed)
-    TAGS_MODULE_ADD(Embed)
-TAGS_MODULE_END(Embed)
+// This is our little forcelink hack.
+FORCE_LINK(loadpage)
 
index 8eaba3a741fbaa56a95c0e1da73f03d45c2922e8..50265f80769660be71eefa399dff71f9a33c46a6 100644 (file)
@@ -26,9 +26,12 @@ static const char KW_FIXED[] = { ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\
 static const char KW_ID[] = { ASCII_I, ASCII_D, '\0' };
 static const char KW_IDREF[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' };
 static const char KW_IDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
+/* Remove compiler warnings for not using when XML_DTD is not defined */
+#ifdef XML_DTD
+static const char KW_INCLUDE[] = { ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' };
 static const char KW_IGNORE[] = { ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' };
+#endif
 static const char KW_IMPLIED[] = { ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' };
-static const char KW_INCLUDE[] = { ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' };
 static const char KW_NDATA[] = { ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' };
 static const char KW_NMTOKEN[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' };
 static const char KW_NMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' };
index b46e441673a194b470dbacc3358983f11e91505e..8bb0c6207085cfb68d0e8d5e5cfd60a131569690 100644 (file)
@@ -3,10 +3,17 @@ Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
 See the file copying.txt for copying permission.
 */
 
+#undef INVALID_LEAD_CASE
+
 #ifndef IS_INVALID_CHAR
 #define IS_INVALID_CHAR(enc, ptr, n) (0)
-#endif
-
+#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \
+    case BT_LEAD ## n: \
+      if (end - ptr < n) \
+       return XML_TOK_PARTIAL_CHAR; \
+      ptr += n; \
+      break;
+#else
 #define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \
     case BT_LEAD ## n: \
       if (end - ptr < n) \
@@ -17,6 +24,7 @@ See the file copying.txt for copying permission.
       } \
       ptr += n; \
       break;
+#endif
 
 #define INVALID_CASES(ptr, nextTokPtr) \
   INVALID_LEAD_CASE(2, ptr, nextTokPtr) \
@@ -304,6 +312,7 @@ int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *en
 {
   if (ptr == end)
     return XML_TOK_NONE;
+#if !(MINBPC(enc) == 1)
   if (MINBPC(enc) > 1) {
     size_t n = end - ptr;
     if (n & (MINBPC(enc) - 1)) {
@@ -312,7 +321,8 @@ int PREFIX(cdataSectionTok)(const ENCODING *enc, const char *ptr, const char *en
        return XML_TOK_PARTIAL;
       end = ptr + n;
     }
-  }
+ }
+#endif
   switch (BYTE_TYPE(enc, ptr)) {
   case BT_RSQB:
     ptr += MINBPC(enc);
@@ -574,7 +584,7 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
        hadColon = 0;
 #endif
        for (;;) {
-         
+       
          ptr += MINBPC(enc);
          if (ptr == end)
            return XML_TOK_PARTIAL;
@@ -783,6 +793,7 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
 {
   if (ptr == end)
     return XML_TOK_NONE;
+#if !(MINBPC(enc) == 1)
   if (MINBPC(enc) > 1) {
     size_t n = end - ptr;
     if (n & (MINBPC(enc) - 1)) {
@@ -792,6 +803,7 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
       end = ptr + n;
     }
   }
+#endif
   switch (BYTE_TYPE(enc, ptr)) {
   case BT_LT:
     return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -971,6 +983,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
   int tok;
   if (ptr == end)
     return XML_TOK_NONE;
+#if !(MINBPC(enc) == 1)
   if (MINBPC(enc) > 1) {
     size_t n = end - ptr;
     if (n & (MINBPC(enc) - 1)) {
@@ -980,6 +993,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
       end = ptr + n;
     }
   }
+#endif
   switch (BYTE_TYPE(enc, ptr)) {
   case BT_QUOT:
     return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr);
@@ -1086,6 +1100,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
     return XML_TOK_DECL_CLOSE;
   case BT_NUM:
     return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr);
+#ifdef XML_MIN_SIZE
 #define LEAD_CASE(n) \
   case BT_LEAD ## n: \
     if (end - ptr < n) \
@@ -1102,6 +1117,14 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
     } \
     *nextTokPtr = ptr; \
     return XML_TOK_INVALID;
+#else
+#define LEAD_CASE(n) \
+    case BT_LEAD ## n: \
+    if (end - ptr < n) \
+      return XML_TOK_PARTIAL_CHAR; \
+    *nextTokPtr = ptr; \
+    return XML_TOK_INVALID;
+#endif
     LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
 #undef LEAD_CASE
   case BT_NMSTRT:
@@ -1119,6 +1142,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
     ptr += MINBPC(enc);
     break;
   case BT_NONASCII:
+#ifdef XML_MIN_SIZE
     if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {
       ptr += MINBPC(enc);
       tok = XML_TOK_NAME;
@@ -1129,6 +1153,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
       tok = XML_TOK_NMTOKEN;
       break;
     }
+#endif
     /* fall through */
   default:
     *nextTokPtr = ptr;
@@ -1413,7 +1438,7 @@ int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
 }
 
 /* This must only be called for a well-formed start-tag or empty element tag.
-Returns the number of attributes.  Pointers to the first attsMax attributes 
+Returns the number of attributes.  Pointers to the first attsMax attributes
 are stored in atts. */
 
 static
index 206973a4a988f946d7c00dc3631062e3288eca1c..193d31305153efd3f1d8103fbdb43f2b4c6dc323 100644 (file)
@@ -7,7 +7,7 @@
 // Copyright:   (c) 2001 Vaclav Slavik
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
+
 #ifdef __GNUG__
 // nothing - already in xml.cpp
 #endif
@@ -87,9 +87,9 @@ static void StartElementHnd(void *userData, const char *name, const char **atts)
     ctx->lastAsText = NULL;
 }
 
-static void EndElementHnd(void *userData, const char *name)
+static void EndElementHnd(void *userData, const char* WXUNUSED(name))
 {
-    wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;   
+    wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
 
     ctx->node = ctx->node->GetParent();
     ctx->lastAsText = NULL;
@@ -97,19 +97,19 @@ static void EndElementHnd(void *userData, const char *name)
 
 static void TextHnd(void *userData, const char *s, int len)
 {
-    wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;   
+    wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
     char *buf = new char[len + 1];
-    
+
     buf[len] = '\0';
     memcpy(buf, s, (size_t)len);
-    
+
     if (ctx->lastAsText)
     {
-        ctx->lastAsText->SetContent(ctx->lastAsText->GetContent() + 
+        ctx->lastAsText->SetContent(ctx->lastAsText->GetContent() +
                                     CharToString(buf));
     }
     else
-    {    
+    {
         bool whiteOnly = TRUE;
         for (char *c = buf; *c != '\0'; c++)
             if (*c != ' ' && *c != '\t' && *c != '\n' && *c != '\r')
@@ -119,7 +119,7 @@ static void TextHnd(void *userData, const char *s, int len)
             }
         if (!whiteOnly)
         {
-            ctx->lastAsText = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"), 
+            ctx->lastAsText = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"),
                                             CharToString(buf));
             ctx->node->AddChild(ctx->lastAsText);
         }
@@ -130,14 +130,14 @@ static void TextHnd(void *userData, const char *s, int len)
 
 static void CommentHnd(void *userData, const char *data)
 {
-    wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;   
+    wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
+
     if (ctx->node)
     {
         // VS: ctx->node == NULL happens if there is a comment before
         //     the root element (e.g. wxDesigner's output). We ignore such
         //     comments, no big deal...
-        ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE, 
+        ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE,
                             wxT("comment"), CharToString(data)));
     }
     ctx->lastAsText = NULL;
@@ -148,7 +148,7 @@ static void DefaultHnd(void *userData, const char *s, int len)
     // XML header:
     if (len > 6 && memcmp(s, "<?xml ", 6) == 0)
     {
-        wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;   
+        wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
 
         wxString buf = CharToString(s, (size_t)len);
         int pos;
@@ -158,7 +158,7 @@ static void DefaultHnd(void *userData, const char *s, int len)
         pos = buf.Find(wxT("version="));
         if (pos != wxNOT_FOUND)
             ctx->version = buf.Mid(pos + 9).BeforeFirst(buf[(size_t)pos+8]);
-    }    
+    }
 }
 
 bool wxXmlIOHandlerExpat::Load(wxInputStream& stream, wxXmlDocument& doc)
@@ -170,23 +170,23 @@ bool wxXmlIOHandlerExpat::Load(wxInputStream& stream, wxXmlDocument& doc)
     XML_Parser parser = XML_ParserCreate(NULL);
 
     ctx.root = ctx.node = NULL;
-    XML_SetUserData(parser, (void*)&ctx);   
+    XML_SetUserData(parser, (void*)&ctx);
     XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
     XML_SetCharacterDataHandler(parser, TextHnd);
     XML_SetCommentHandler(parser, CommentHnd);
     XML_SetDefaultHandler(parser, DefaultHnd);
 
-    do 
+    do
     {
         size_t len = stream.Read(buf, BUFSIZE).LastRead();
         done = (len < BUFSIZE);
-        if (!XML_Parse(parser, buf, len, done)) 
+        if (!XML_Parse(parser, buf, len, done))
         {
             wxLogError(_("XML parsing error: '%s' at line %d"),
                        XML_ErrorString(XML_GetErrorCode(parser)),
                        XML_GetCurrentLineNumber(parser));
           return FALSE;
-        }   
+        }
     } while (!done);
 
     doc.SetVersion(ctx.version);
index 62a1188d87bd6edf7fefdf5ebdc207c1d1b89beb..59ca58d5c864dfd1cf0e992335502e4c1c996fc6 100644 (file)
@@ -603,9 +603,9 @@ wxColour wxXmlResourceHandler::GetColour(const wxString& param)
         return wxNullColour;
     }
 
-    return wxColour((tmp & 0xFF0000) >> 16 ,
-                    (tmp & 0x00FF00) >> 8,
-                    (tmp & 0x0000FF));
+    return wxColour((unsigned char) ((tmp & 0xFF0000) >> 16) ,
+                    (unsigned char) ((tmp & 0x00FF00) >> 8),
+                    (unsigned char) ((tmp & 0x0000FF)));
 }
 
 
index 1f692499cc79937848ed88d5f708f0ce239cb943..74e5375e31234c22c18ac385852777dab7835eb2 100644 (file)
@@ -43,7 +43,7 @@ public:
     wxDataInputStream& operator>>(float& f);
 
     void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
-  
+
 protected:
     wxInputStream *m_input;
     bool m_be_order;
@@ -62,7 +62,7 @@ public:
     void WriteString(const wxString& string);
 
     wxDataOutputStream& operator<<(const wxChar *string);
-    wxDataOutputStream& operator<<(wxString& string);
+    wxDataOutputStream& operator<<(const wxString& string);
     wxDataOutputStream& operator<<(wxInt8 c);
     wxDataOutputStream& operator<<(wxInt16 i);
     wxDataOutputStream& operator<<(wxInt32 i);
@@ -72,8 +72,8 @@ public:
     wxDataOutputStream& operator<<(double f);
     wxDataOutputStream& operator<<(float f);
 
-    void BigEndianOrdered(bool be_order) { m_be_order = be_order; } 
-  
+    void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
+
 protected:
     wxOutputStream *m_output;
     bool m_be_order;
index 2bf22cd0cc8d5563f165f9340c45208eea7b1280..b53d4d472eb94ada64d6edf97f9549ef8352f29d 100644 (file)
@@ -72,7 +72,7 @@ public:
     // After the page is loaded, the method calls SetPage() to display it.
     // Note : you can also use path relative to previously loaded page
     // Return value : same as SetPage
-    bool LoadPage(const wxString& location);
+    virtual bool LoadPage(const wxString& location);
 
     // Returns full location of opened page
     wxString GetOpenedPage() const {return m_OpenedPage;}
index d95ea2093a1b506ac5e6fe17b00c74f75bd703a6..5b8f33ddb352541b6825d383bb515f3ca3798388 100644 (file)
@@ -1330,8 +1330,6 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const
     // check that the algorithm gave us something reasonable
     wxASSERT_MSG( (0 < month) && (month <= 12), _T("invalid month") );
     wxASSERT_MSG( (1 <= day) && (day < 32), _T("invalid day") );
-    wxASSERT_MSG( (INT_MIN <= year) && (year <= INT_MAX),
-                  _T("year range overflow") );
 
     // construct Tm from these values
     Tm tm;
index d6f97b7e65ff74583cf2a9a93a360110d12475c8..e0bd854d4cbfb81db6eab43437e6358956c96fd5 100644 (file)
@@ -105,7 +105,7 @@ wxString wxDataInputStream::ReadString()
 #endif
     return s;
   }
-  else 
+  else
     return wxEmptyString;
 }
 
@@ -237,7 +237,7 @@ wxDataOutputStream& wxDataOutputStream::operator<<(const wxChar *string)
   return *this;
 }
 
-wxDataOutputStream& wxDataOutputStream::operator<<(wxString& string)
+wxDataOutputStream& wxDataOutputStream::operator<<(const wxString& string)
 {
   WriteString(string);
   return *this;
index 19ae615e707bdef45da73729263ef263e2d5992f..0bf15e77225c7c3eb8ae3e6d3c5130ab3b278c73 100644 (file)
@@ -96,7 +96,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler)
 
 bool wxXPMHandler::LoadFile(wxImage *image,
                             wxInputStream& stream,
-                            bool verbose, int WXUNUSED(index))
+                            bool WXUNUSED(verbose), int WXUNUSED(index))
 {
     wxXPMDecoder decoder;
 
index c1a8c1a84d3edb9e5f20aff866a203ea427d69ae..a53c4378f9a6f3d2fd100dfab3019d18e61d01cd 100644 (file)
@@ -1879,13 +1879,6 @@ void wxArrayString::Grow()
     else {
       // otherwise when it's called for the first time, nIncrement would be 0
       // and the array would never be expanded
-#if defined(__VISAGECPP__) && defined(__WXDEBUG__)
-      int array_size = ARRAY_DEFAULT_INITIAL_SIZE;
-      wxASSERT( array_size != 0 );
-#else
-      wxASSERT( ARRAY_DEFAULT_INITIAL_SIZE != 0 );
-#endif
-
       // add 50% but not too much
       size_t nIncrement = m_nSize < ARRAY_DEFAULT_INITIAL_SIZE
                           ? ARRAY_DEFAULT_INITIAL_SIZE : m_nSize >> 1;
index 4986e29e79131602aedc3948e59a23f995eb0ff7..b296e289c192b67909e86d5138925d85d6e5ee42 100644 (file)
@@ -288,7 +288,7 @@ wxWindow::~wxWindow()
     m_isBeingDeleted = TRUE;
 
     MSWDetachWindowMenu();
-    
+
     // VS: make sure there's no wxFrame with last focus set to us:
     for (wxWindow *win = GetParent(); win; win = win->GetParent())
     {
@@ -3461,6 +3461,9 @@ bool wxWindow::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam)
     return GetEventHandler()->ProcessEvent(event);
 
 #else
+    (void) wParam;
+    (void) lParam;
+
     return FALSE;
 #endif
 }