Merged latest changes from SciTech code base into wxWindows CVS Tree.
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
This commit is contained in:
@@ -34,7 +34,10 @@
|
|||||||
#define __WX_APPLET_H
|
#define __WX_APPLET_H
|
||||||
|
|
||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
#include "wx/applet/window.h"
|
#include "wx/html/htmlwin.h"
|
||||||
|
|
||||||
|
// Forward declaration
|
||||||
|
class wxHtmlAppletWindow;
|
||||||
|
|
||||||
/*--------------------------- Class Definitions ---------------------------*/
|
/*--------------------------- Class Definitions ---------------------------*/
|
||||||
|
|
||||||
@@ -46,38 +49,41 @@ class wxApplet : public wxPanel {
|
|||||||
private:
|
private:
|
||||||
DECLARE_ABSTRACT_CLASS(wxApplet);
|
DECLARE_ABSTRACT_CLASS(wxApplet);
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
protected:
|
|
||||||
wxHtmlAppletWindow *m_Parent;
|
|
||||||
|
|
||||||
// Special handler for background erase messages
|
protected:
|
||||||
|
wxHtmlAppletWindow *m_parent;
|
||||||
|
|
||||||
|
// Special handler for background erase messages
|
||||||
void OnEraseBackground(wxEraseEvent&);
|
void OnEraseBackground(wxEraseEvent&);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor (called during dynamic creation)
|
// Constructor (called during dynamic creation)
|
||||||
wxApplet() { m_Parent = NULL; }
|
wxApplet() { m_parent = NULL; };
|
||||||
|
|
||||||
// Psuedo virtual constructor
|
// Psuedo virtual constructor
|
||||||
virtual bool Create(
|
virtual bool Create(
|
||||||
wxHtmlAppletWindow *parent,
|
wxHtmlAppletWindow *parent,
|
||||||
|
const wxHtmlTag& params,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER);
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER);
|
||||||
|
|
||||||
// Virtual destructor
|
// Virtual destructor
|
||||||
virtual ~wxApplet();
|
virtual ~wxApplet();
|
||||||
|
|
||||||
// Handle HTML navigation to a new URL
|
// 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
|
// Handle HTML navigation forward command in applet
|
||||||
virtual void OnHistoryForward() = 0;
|
virtual void OnHistoryForward() = 0;
|
||||||
|
|
||||||
// Handle HTML navigation back command in applet
|
// Handle HTML navigation back command in applet
|
||||||
virtual void OnHistoryBack() = 0;
|
virtual void OnHistoryBack() = 0;
|
||||||
|
|
||||||
// Handle messages from the wxAppletManager and other applets
|
// Handle messages from the wxAppletManager and other applets
|
||||||
virtual void OnMessage(wxEvent& msg) = 0;
|
virtual void OnMessage(wxEvent& msg) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __WX_APPLET_H
|
#endif // __WX_APPLET_H
|
||||||
|
|
||||||
|
@@ -35,18 +35,46 @@
|
|||||||
|
|
||||||
#include "wx/html/htmlwin.h"
|
#include "wx/html/htmlwin.h"
|
||||||
|
|
||||||
/*--------------------------- Class Definitions ---------------------------*/
|
// Forward declare
|
||||||
|
class wxApplet;
|
||||||
|
class wxLoadPageEvent;
|
||||||
|
class wxPageLoadedEvent;
|
||||||
|
class wxIncludePrep;
|
||||||
|
|
||||||
// Declare a linked list of wxApplet pointers
|
// Declare a linked list of wxApplet pointers
|
||||||
class wxApplet;
|
|
||||||
WX_DECLARE_LIST(wxApplet, wxAppletList);
|
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:
|
REMARKS:
|
||||||
Defines the class for wxAppletWindow. This class is derived from the
|
Defines the class for wxAppletWindow. This class is derived from the
|
||||||
wxHtmlWindow class and extends it with functionality to handle embedded
|
wxHtmlWindow class and extends it with functionality to handle embedded
|
||||||
@@ -56,59 +84,75 @@ class wxHtmlAppletWindow : public wxHtmlWindow {
|
|||||||
private:
|
private:
|
||||||
DECLARE_CLASS(wxHtmlAppletWindow);
|
DECLARE_CLASS(wxHtmlAppletWindow);
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
|
wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
|
||||||
protected:
|
protected:
|
||||||
wxAppletList m_AppletList;
|
wxAppletList m_AppletList;
|
||||||
wxHashTable m_Cookies;
|
static wxHashTable m_Cookies;
|
||||||
|
wxToolBarBase *m_NavBar;
|
||||||
|
int m_NavBackId;
|
||||||
|
int m_NavForwardId;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
wxHtmlAppletWindow(
|
wxHtmlAppletWindow(
|
||||||
wxWindow *parent,
|
wxWindow *parent,
|
||||||
wxWindowID id = -1,
|
wxWindowID id = -1,
|
||||||
|
wxToolBarBase *navBar = NULL,
|
||||||
|
int navBackId = -1,
|
||||||
|
int navForwardId = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxHW_SCROLLBAR_AUTO,
|
long style = wxHW_SCROLLBAR_AUTO,
|
||||||
const wxString& name = "htmlAppletWindow");
|
const wxString& name = "htmlAppletWindow");
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~wxHtmlAppletWindow();
|
~wxHtmlAppletWindow();
|
||||||
|
|
||||||
// Create an instance of an applet based on it's class name
|
// Create an instance of an applet based on it's class name
|
||||||
wxApplet *CreateApplet(
|
wxApplet *CreateApplet(
|
||||||
const wxString& className,
|
const wxString& classId,
|
||||||
|
const wxString& iName,
|
||||||
|
const wxHtmlTag ¶ms,
|
||||||
const wxSize& size);
|
const wxSize& size);
|
||||||
|
|
||||||
// Find an instance of an applet based on it's class name
|
// 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
|
// 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
|
// Load a new URL page
|
||||||
bool LoadPage(const wxString& hRef);
|
virtual bool LoadPage(const wxString& location);
|
||||||
|
|
||||||
// Called when users clicked on hypertext link.
|
// 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
|
// Handles forward navigation within the HTML stack
|
||||||
bool HistoryForward();
|
bool HistoryForward();
|
||||||
|
|
||||||
// Handles backwards navigation within the HTML stack
|
// Handles backwards navigation within the HTML stack
|
||||||
bool HistoryBack();
|
bool HistoryBack();
|
||||||
|
|
||||||
// Broadcast a message to all applets on the page
|
// Broadcast a message to all applets on the page
|
||||||
void SendMessage(wxEvent& msg);
|
void SendMessage(wxEvent& msg);
|
||||||
|
|
||||||
// Register a cookie of data in the applet manager
|
// Register a cookie of data in the applet manager
|
||||||
bool RegisterCookie(const wxString& name,wxObject *cookie);
|
bool RegisterCookie(const wxString& name,wxObject *cookie);
|
||||||
|
|
||||||
// UnRegister a cookie of data in the applet manager
|
// UnRegister a cookie of data in the applet manager
|
||||||
bool UnRegisterCookie(const wxString& name);
|
bool UnRegisterCookie(const wxString& name);
|
||||||
|
|
||||||
// Find a cookie of data given it's public name
|
// Find a cookie of data given it's public name
|
||||||
wxObject *FindCookie(const wxString& 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
|
#endif // __WX_APPLET_WINDOW_H
|
||||||
|
|
||||||
|
@@ -28,7 +28,7 @@ public:
|
|||||||
virtual bool CanSave() { return FALSE; }
|
virtual bool CanSave() { return FALSE; }
|
||||||
|
|
||||||
virtual bool Load(wxInputStream& stream, wxXmlDocument& doc);
|
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:
|
public:
|
||||||
virtual wxXmlIOType GetType() { return wxXML_IO_TEXT_OUTPUT; }
|
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 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);
|
virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
// Include private headers
|
// Include private headers
|
||||||
#include "wx/applet/applet.h"
|
#include "wx/applet/applet.h"
|
||||||
|
#include "wx/applet/window.h"
|
||||||
|
|
||||||
/*------------------------- Implementation --------------------------------*/
|
/*------------------------- Implementation --------------------------------*/
|
||||||
|
|
||||||
@@ -54,12 +55,13 @@ Psuedo virtual constructor for the wxApplet class.
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
bool wxApplet::Create(
|
bool wxApplet::Create(
|
||||||
wxHtmlAppletWindow *parent,
|
wxHtmlAppletWindow *parent,
|
||||||
|
const wxHtmlTag& ,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style)
|
long style)
|
||||||
{
|
{
|
||||||
bool ret = wxPanel::Create(parent, -1, wxDefaultPosition, size, style);
|
bool ret = wxPanel::Create(parent, -1, wxDefaultPosition, size, style);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
m_Parent = parent;
|
m_parent = parent;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -70,7 +72,7 @@ Destructor for the wxApplet class.
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
wxApplet::~wxApplet()
|
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
|
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
|
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
|
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&)
|
void wxApplet::OnEraseBackground(wxEraseEvent&)
|
||||||
{
|
{
|
||||||
|
@@ -32,16 +32,31 @@
|
|||||||
|
|
||||||
// For compilers that support precompilation
|
// For compilers that support precompilation
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
#include "wx/html/forcelnk.h"
|
||||||
|
|
||||||
// Include private headers
|
// Include private headers
|
||||||
#include "wx/applet/applet.h"
|
#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 --------------------------------*/
|
/*------------------------- Implementation --------------------------------*/
|
||||||
|
|
||||||
// Empty event handler. We include this event handler simply so that
|
// Empty event handler. We include this event handler simply so that
|
||||||
// sub-classes of wxApplet can reference wxApplet in the event tables
|
// sub-classes of wxApplet can reference wxApplet in the event tables
|
||||||
// that they create as necessary.
|
// that they create as necessary.
|
||||||
BEGIN_EVENT_TABLE(wxHtmlAppletWindow, wxHtmlWindow)
|
BEGIN_EVENT_TABLE(wxHtmlAppletWindow, wxHtmlWindow)
|
||||||
|
EVT_LOAD_PAGE(wxHtmlAppletWindow::OnLoadPage)
|
||||||
|
EVT_PAGE_LOADED(wxHtmlAppletWindow::OnPageLoaded)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Implement the class functions for wxHtmlAppletWindow
|
// Implement the class functions for wxHtmlAppletWindow
|
||||||
@@ -58,14 +73,37 @@ Constructor for the applet window class.
|
|||||||
wxHtmlAppletWindow::wxHtmlAppletWindow(
|
wxHtmlAppletWindow::wxHtmlAppletWindow(
|
||||||
wxWindow *parent,
|
wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
|
wxToolBarBase *navBar,
|
||||||
|
int navBackId,
|
||||||
|
int navForwardId,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
: wxHtmlWindow(parent,id,pos,size,style,name)
|
: wxHtmlWindow(parent,id,pos,size,style,name)
|
||||||
{
|
{
|
||||||
// Ensure all cookie data is destroyed when window is killed
|
//setup client navbars
|
||||||
m_Cookies.DeleteContents(true);
|
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.
|
HTML page.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
wxApplet *wxHtmlAppletWindow::CreateApplet(
|
wxApplet *wxHtmlAppletWindow::CreateApplet(
|
||||||
const wxString& className,
|
const wxString& classId,
|
||||||
|
const wxString& iName,
|
||||||
|
const wxHtmlTag& params,
|
||||||
const wxSize& size)
|
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
|
// Dynamically create the class instance at runtime
|
||||||
wxClassInfo *info = wxClassInfo::FindClass(className.c_str());
|
wxClassInfo *info = wxClassInfo::FindClass(classId.c_str());
|
||||||
if (!info)
|
if (!info)
|
||||||
return NULL;
|
return NULL;
|
||||||
wxObject *obj = info->CreateObject();
|
wxObject *obj = info->CreateObject();
|
||||||
@@ -108,11 +144,11 @@ wxApplet *wxHtmlAppletWindow::CreateApplet(
|
|||||||
wxApplet *applet = wxDynamicCast(obj,wxApplet);
|
wxApplet *applet = wxDynamicCast(obj,wxApplet);
|
||||||
if (!applet)
|
if (!applet)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!applet->Create(this,size)) {
|
if (!applet->Create(this,params,size)) {
|
||||||
delete applet;
|
delete applet;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
m_AppletList.Append(className,applet);
|
m_AppletList.Append(iName,applet);
|
||||||
return applet;
|
return applet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +169,7 @@ wxApplet *wxHtmlAppletWindow::FindApplet(
|
|||||||
if (!node)
|
if (!node)
|
||||||
return NULL;
|
return NULL;
|
||||||
return node->GetData();
|
return node->GetData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
PARAMETERS:
|
PARAMETERS:
|
||||||
@@ -156,7 +192,7 @@ bool wxHtmlAppletWindow::RemoveApplet(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
PARAMETERS:
|
PARAMETERS:
|
||||||
@@ -169,11 +205,64 @@ REMARKS:
|
|||||||
Remove an applet from the manager. Called during applet destruction
|
Remove an applet from the manager. Called during applet destruction
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
bool wxHtmlAppletWindow::LoadPage(
|
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())
|
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
|
||||||
(node->GetData())->OnLinkClicked(hRef);
|
(node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
|
||||||
return wxHtmlWindow::LoadPage(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(
|
void wxHtmlAppletWindow::OnLinkClicked(
|
||||||
const wxHtmlLinkInfo& link)
|
const wxHtmlLinkInfo& link)
|
||||||
{
|
{
|
||||||
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
|
LoadPage(link.GetHref());
|
||||||
(node->GetData())->OnLinkClicked(link);
|
|
||||||
wxHtmlWindow::LoadPage(link.GetHref());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -200,10 +287,12 @@ command prior to being destructed when the current page is destroyed.
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
bool wxHtmlAppletWindow::HistoryForward()
|
bool wxHtmlAppletWindow::HistoryForward()
|
||||||
{
|
{
|
||||||
if (!HistoryCanForward())
|
if (!HistoryCanForward())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
|
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
|
||||||
(node->GetData())->OnHistoryForward();
|
(node->GetData())->OnHistoryForward();
|
||||||
|
|
||||||
return wxHtmlWindow::HistoryForward();
|
return wxHtmlWindow::HistoryForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,10 +304,12 @@ command prior to being destructed when the current page is destroyed.
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
bool wxHtmlAppletWindow::HistoryBack()
|
bool wxHtmlAppletWindow::HistoryBack()
|
||||||
{
|
{
|
||||||
if (!HistoryCanBack())
|
if (!HistoryCanBack())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
|
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
|
||||||
(node->GetData())->OnHistoryBack();
|
(node->GetData())->OnHistoryBack();
|
||||||
|
|
||||||
return wxHtmlWindow::HistoryBack();
|
return wxHtmlWindow::HistoryBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,21 +330,24 @@ value (ie: by default it is true).
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void wxHtmlAppletWindow::SendMessage(
|
void wxHtmlAppletWindow::SendMessage(
|
||||||
wxEvent& msg)
|
wxEvent& msg)
|
||||||
{
|
{
|
||||||
// Preset the skip flag
|
// Preset the skip flag
|
||||||
msg.Skip();
|
msg.Skip();
|
||||||
|
|
||||||
// Process all applets in turn and send them the message
|
// Process all applets in turn and send them the message
|
||||||
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext()) {
|
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext()) {
|
||||||
(node->GetData())->OnMessage(msg);
|
(node->GetData())->OnMessage(msg);
|
||||||
if (!msg.GetSkipped())
|
if (!msg.GetSkipped()){
|
||||||
|
wxMessageBox("BREAK");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
PARAMETERS:
|
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:
|
RETURNS:
|
||||||
True if new cookie was added, false if cookie with same name already exists.
|
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!
|
// Fail if the named cookie already exists!
|
||||||
if (m_Cookies.Get(name))
|
if (m_Cookies.Get(name))
|
||||||
return false;
|
return false;
|
||||||
m_Cookies.Put(name,cookie);
|
m_Cookies.Put(name,cookie);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
PARAMETERS:
|
PARAMETERS:
|
||||||
msg - wxEvent message to be sent to all wxApplets
|
name - wxString uniq haskey used to remove item from hash
|
||||||
|
|
||||||
RETURNS:
|
RETURNS:
|
||||||
True if found and deleted, false if not found in table.
|
True if found and deleted, false if not found in table.
|
||||||
@@ -326,6 +420,57 @@ wxObject *wxHtmlAppletWindow::FindCookie(
|
|||||||
return m_Cookies.Get(name);
|
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"
|
#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
|
of automatically constructing the wxApplet objects of the appropriate
|
||||||
class based on the <embed> tag information.
|
class based on the <embed> tag information.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
TAG_HANDLER_BEGIN(Embed, "EMBED")
|
TAG_HANDLER_BEGIN(wxApplet, "WXAPPLET")
|
||||||
|
|
||||||
TAG_HANDLER_PROC(tag)
|
TAG_HANDLER_PROC(tag)
|
||||||
{
|
{
|
||||||
wxWindow *wnd;
|
wxWindow *wnd;
|
||||||
wxHtmlAppletWindow *appletWindow;
|
wxHtmlAppletWindow *appletWindow;
|
||||||
wxApplet *applet;
|
wxApplet *applet;
|
||||||
int width, height;
|
wxString classId;
|
||||||
int floatPercent = 0;
|
wxString name;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
wnd = m_WParser->GetWindow();
|
wnd = m_WParser->GetWindow();
|
||||||
if ((appletWindow = wxDynamicCast(wnd,wxHtmlAppletWindow)) != NULL) {
|
|
||||||
tag.ScanParam("WIDTH", "%i", &width);
|
if ((appletWindow = wxDynamicCast(wnd,wxHtmlAppletWindow)) != NULL){
|
||||||
tag.ScanParam("HEIGHT", "%i", &height);
|
tag.ScanParam("WIDTH", "%i", &width);
|
||||||
if (tag.HasParam("FLOAT"))
|
tag.ScanParam("HEIGHT", "%i", &height);
|
||||||
tag.ScanParam("FLOAT", "%i", &floatPercent);
|
if (tag.HasParam("CLASSID")){
|
||||||
if (tag.HasParam("APPLET")) {
|
classId = tag.GetParam("CLASSID");
|
||||||
if ((applet = appletWindow->CreateApplet(tag.GetParam("APPLET"), wxSize(width, height))) != NULL) {
|
if ( classId.IsNull() || classId.Len() == 0 ){
|
||||||
applet->Show(true);
|
wxMessageBox("wxApplet tag error: CLASSID is NULL or empty.","Error",wxICON_ERROR);
|
||||||
m_WParser->OpenContainer()->InsertCell(new wxHtmlWidgetCell(applet,floatPercent));
|
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")) {
|
//Add more param parsing here. If or when spec changes.
|
||||||
// TODO: Somehow get the text returned from this class displayed on the page!
|
//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(Embed)
|
TAGS_MODULE_BEGIN(wxApplet)
|
||||||
TAGS_MODULE_ADD(Embed)
|
TAGS_MODULE_ADD(wxApplet)
|
||||||
TAGS_MODULE_END(Embed)
|
TAGS_MODULE_END(wxApplet)
|
||||||
|
|
||||||
|
// This is our little forcelink hack.
|
||||||
|
FORCE_LINK(loadpage)
|
||||||
|
|
||||||
|
@@ -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_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_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' };
|
static const char KW_IDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' };
|
||||||
static const char KW_IGNORE[] = { ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' };
|
/* Remove compiler warnings for not using when XML_DTD is not defined */
|
||||||
static const char KW_IMPLIED[] = { ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' };
|
#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_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_NDATA[] = { ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\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_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' };
|
static const char KW_NMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' };
|
||||||
|
@@ -3,10 +3,17 @@ Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
|
|||||||
See the file copying.txt for copying permission.
|
See the file copying.txt for copying permission.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#undef INVALID_LEAD_CASE
|
||||||
|
|
||||||
#ifndef IS_INVALID_CHAR
|
#ifndef IS_INVALID_CHAR
|
||||||
#define IS_INVALID_CHAR(enc, ptr, n) (0)
|
#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) \
|
#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \
|
||||||
case BT_LEAD ## n: \
|
case BT_LEAD ## n: \
|
||||||
if (end - ptr < n) \
|
if (end - ptr < n) \
|
||||||
@@ -17,6 +24,7 @@ See the file copying.txt for copying permission.
|
|||||||
} \
|
} \
|
||||||
ptr += n; \
|
ptr += n; \
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INVALID_CASES(ptr, nextTokPtr) \
|
#define INVALID_CASES(ptr, nextTokPtr) \
|
||||||
INVALID_LEAD_CASE(2, 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)
|
if (ptr == end)
|
||||||
return XML_TOK_NONE;
|
return XML_TOK_NONE;
|
||||||
|
#if !(MINBPC(enc) == 1)
|
||||||
if (MINBPC(enc) > 1) {
|
if (MINBPC(enc) > 1) {
|
||||||
size_t n = end - ptr;
|
size_t n = end - ptr;
|
||||||
if (n & (MINBPC(enc) - 1)) {
|
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;
|
return XML_TOK_PARTIAL;
|
||||||
end = ptr + n;
|
end = ptr + n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
switch (BYTE_TYPE(enc, ptr)) {
|
switch (BYTE_TYPE(enc, ptr)) {
|
||||||
case BT_RSQB:
|
case BT_RSQB:
|
||||||
ptr += MINBPC(enc);
|
ptr += MINBPC(enc);
|
||||||
@@ -574,7 +584,7 @@ int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
|
|||||||
hadColon = 0;
|
hadColon = 0;
|
||||||
#endif
|
#endif
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
ptr += MINBPC(enc);
|
ptr += MINBPC(enc);
|
||||||
if (ptr == end)
|
if (ptr == end)
|
||||||
return XML_TOK_PARTIAL;
|
return XML_TOK_PARTIAL;
|
||||||
@@ -783,6 +793,7 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||||||
{
|
{
|
||||||
if (ptr == end)
|
if (ptr == end)
|
||||||
return XML_TOK_NONE;
|
return XML_TOK_NONE;
|
||||||
|
#if !(MINBPC(enc) == 1)
|
||||||
if (MINBPC(enc) > 1) {
|
if (MINBPC(enc) > 1) {
|
||||||
size_t n = end - ptr;
|
size_t n = end - ptr;
|
||||||
if (n & (MINBPC(enc) - 1)) {
|
if (n & (MINBPC(enc) - 1)) {
|
||||||
@@ -792,6 +803,7 @@ int PREFIX(contentTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||||||
end = ptr + n;
|
end = ptr + n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
switch (BYTE_TYPE(enc, ptr)) {
|
switch (BYTE_TYPE(enc, ptr)) {
|
||||||
case BT_LT:
|
case BT_LT:
|
||||||
return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr);
|
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;
|
int tok;
|
||||||
if (ptr == end)
|
if (ptr == end)
|
||||||
return XML_TOK_NONE;
|
return XML_TOK_NONE;
|
||||||
|
#if !(MINBPC(enc) == 1)
|
||||||
if (MINBPC(enc) > 1) {
|
if (MINBPC(enc) > 1) {
|
||||||
size_t n = end - ptr;
|
size_t n = end - ptr;
|
||||||
if (n & (MINBPC(enc) - 1)) {
|
if (n & (MINBPC(enc) - 1)) {
|
||||||
@@ -980,6 +993,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||||||
end = ptr + n;
|
end = ptr + n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
switch (BYTE_TYPE(enc, ptr)) {
|
switch (BYTE_TYPE(enc, ptr)) {
|
||||||
case BT_QUOT:
|
case BT_QUOT:
|
||||||
return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr);
|
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;
|
return XML_TOK_DECL_CLOSE;
|
||||||
case BT_NUM:
|
case BT_NUM:
|
||||||
return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr);
|
return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr);
|
||||||
|
#ifdef XML_MIN_SIZE
|
||||||
#define LEAD_CASE(n) \
|
#define LEAD_CASE(n) \
|
||||||
case BT_LEAD ## n: \
|
case BT_LEAD ## n: \
|
||||||
if (end - ptr < n) \
|
if (end - ptr < n) \
|
||||||
@@ -1102,6 +1117,14 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||||||
} \
|
} \
|
||||||
*nextTokPtr = ptr; \
|
*nextTokPtr = ptr; \
|
||||||
return XML_TOK_INVALID;
|
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)
|
LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4)
|
||||||
#undef LEAD_CASE
|
#undef LEAD_CASE
|
||||||
case BT_NMSTRT:
|
case BT_NMSTRT:
|
||||||
@@ -1119,6 +1142,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||||||
ptr += MINBPC(enc);
|
ptr += MINBPC(enc);
|
||||||
break;
|
break;
|
||||||
case BT_NONASCII:
|
case BT_NONASCII:
|
||||||
|
#ifdef XML_MIN_SIZE
|
||||||
if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {
|
if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) {
|
||||||
ptr += MINBPC(enc);
|
ptr += MINBPC(enc);
|
||||||
tok = XML_TOK_NAME;
|
tok = XML_TOK_NAME;
|
||||||
@@ -1129,6 +1153,7 @@ int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end,
|
|||||||
tok = XML_TOK_NMTOKEN;
|
tok = XML_TOK_NMTOKEN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* fall through */
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
*nextTokPtr = ptr;
|
*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.
|
/* 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. */
|
are stored in atts. */
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
// Copyright: (c) 2001 Vaclav Slavik
|
// Copyright: (c) 2001 Vaclav Slavik
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
// nothing - already in xml.cpp
|
// nothing - already in xml.cpp
|
||||||
#endif
|
#endif
|
||||||
@@ -87,9 +87,9 @@ static void StartElementHnd(void *userData, const char *name, const char **atts)
|
|||||||
ctx->lastAsText = NULL;
|
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->node = ctx->node->GetParent();
|
||||||
ctx->lastAsText = NULL;
|
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)
|
static void TextHnd(void *userData, const char *s, int len)
|
||||||
{
|
{
|
||||||
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
|
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
|
||||||
char *buf = new char[len + 1];
|
char *buf = new char[len + 1];
|
||||||
|
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
memcpy(buf, s, (size_t)len);
|
memcpy(buf, s, (size_t)len);
|
||||||
|
|
||||||
if (ctx->lastAsText)
|
if (ctx->lastAsText)
|
||||||
{
|
{
|
||||||
ctx->lastAsText->SetContent(ctx->lastAsText->GetContent() +
|
ctx->lastAsText->SetContent(ctx->lastAsText->GetContent() +
|
||||||
CharToString(buf));
|
CharToString(buf));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool whiteOnly = TRUE;
|
bool whiteOnly = TRUE;
|
||||||
for (char *c = buf; *c != '\0'; c++)
|
for (char *c = buf; *c != '\0'; c++)
|
||||||
if (*c != ' ' && *c != '\t' && *c != '\n' && *c != '\r')
|
if (*c != ' ' && *c != '\t' && *c != '\n' && *c != '\r')
|
||||||
@@ -119,7 +119,7 @@ static void TextHnd(void *userData, const char *s, int len)
|
|||||||
}
|
}
|
||||||
if (!whiteOnly)
|
if (!whiteOnly)
|
||||||
{
|
{
|
||||||
ctx->lastAsText = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"),
|
ctx->lastAsText = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"),
|
||||||
CharToString(buf));
|
CharToString(buf));
|
||||||
ctx->node->AddChild(ctx->lastAsText);
|
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)
|
static void CommentHnd(void *userData, const char *data)
|
||||||
{
|
{
|
||||||
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
|
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
|
||||||
|
|
||||||
if (ctx->node)
|
if (ctx->node)
|
||||||
{
|
{
|
||||||
// VS: ctx->node == NULL happens if there is a comment before
|
// VS: ctx->node == NULL happens if there is a comment before
|
||||||
// the root element (e.g. wxDesigner's output). We ignore such
|
// the root element (e.g. wxDesigner's output). We ignore such
|
||||||
// comments, no big deal...
|
// comments, no big deal...
|
||||||
ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE,
|
ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE,
|
||||||
wxT("comment"), CharToString(data)));
|
wxT("comment"), CharToString(data)));
|
||||||
}
|
}
|
||||||
ctx->lastAsText = NULL;
|
ctx->lastAsText = NULL;
|
||||||
@@ -148,7 +148,7 @@ static void DefaultHnd(void *userData, const char *s, int len)
|
|||||||
// XML header:
|
// XML header:
|
||||||
if (len > 6 && memcmp(s, "<?xml ", 6) == 0)
|
if (len > 6 && memcmp(s, "<?xml ", 6) == 0)
|
||||||
{
|
{
|
||||||
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
|
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
|
||||||
|
|
||||||
wxString buf = CharToString(s, (size_t)len);
|
wxString buf = CharToString(s, (size_t)len);
|
||||||
int pos;
|
int pos;
|
||||||
@@ -158,7 +158,7 @@ static void DefaultHnd(void *userData, const char *s, int len)
|
|||||||
pos = buf.Find(wxT("version="));
|
pos = buf.Find(wxT("version="));
|
||||||
if (pos != wxNOT_FOUND)
|
if (pos != wxNOT_FOUND)
|
||||||
ctx->version = buf.Mid(pos + 9).BeforeFirst(buf[(size_t)pos+8]);
|
ctx->version = buf.Mid(pos + 9).BeforeFirst(buf[(size_t)pos+8]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxXmlIOHandlerExpat::Load(wxInputStream& stream, wxXmlDocument& doc)
|
bool wxXmlIOHandlerExpat::Load(wxInputStream& stream, wxXmlDocument& doc)
|
||||||
@@ -170,23 +170,23 @@ bool wxXmlIOHandlerExpat::Load(wxInputStream& stream, wxXmlDocument& doc)
|
|||||||
XML_Parser parser = XML_ParserCreate(NULL);
|
XML_Parser parser = XML_ParserCreate(NULL);
|
||||||
|
|
||||||
ctx.root = ctx.node = NULL;
|
ctx.root = ctx.node = NULL;
|
||||||
XML_SetUserData(parser, (void*)&ctx);
|
XML_SetUserData(parser, (void*)&ctx);
|
||||||
XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
|
XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
|
||||||
XML_SetCharacterDataHandler(parser, TextHnd);
|
XML_SetCharacterDataHandler(parser, TextHnd);
|
||||||
XML_SetCommentHandler(parser, CommentHnd);
|
XML_SetCommentHandler(parser, CommentHnd);
|
||||||
XML_SetDefaultHandler(parser, DefaultHnd);
|
XML_SetDefaultHandler(parser, DefaultHnd);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
size_t len = stream.Read(buf, BUFSIZE).LastRead();
|
size_t len = stream.Read(buf, BUFSIZE).LastRead();
|
||||||
done = (len < BUFSIZE);
|
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"),
|
wxLogError(_("XML parsing error: '%s' at line %d"),
|
||||||
XML_ErrorString(XML_GetErrorCode(parser)),
|
XML_ErrorString(XML_GetErrorCode(parser)),
|
||||||
XML_GetCurrentLineNumber(parser));
|
XML_GetCurrentLineNumber(parser));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} while (!done);
|
} while (!done);
|
||||||
|
|
||||||
doc.SetVersion(ctx.version);
|
doc.SetVersion(ctx.version);
|
||||||
|
@@ -603,9 +603,9 @@ wxColour wxXmlResourceHandler::GetColour(const wxString& param)
|
|||||||
return wxNullColour;
|
return wxNullColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxColour((tmp & 0xFF0000) >> 16 ,
|
return wxColour((unsigned char) ((tmp & 0xFF0000) >> 16) ,
|
||||||
(tmp & 0x00FF00) >> 8,
|
(unsigned char) ((tmp & 0x00FF00) >> 8),
|
||||||
(tmp & 0x0000FF));
|
(unsigned char) ((tmp & 0x0000FF)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ public:
|
|||||||
wxDataInputStream& operator>>(float& f);
|
wxDataInputStream& operator>>(float& f);
|
||||||
|
|
||||||
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
|
void BigEndianOrdered(bool be_order) { m_be_order = be_order; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxInputStream *m_input;
|
wxInputStream *m_input;
|
||||||
bool m_be_order;
|
bool m_be_order;
|
||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
void WriteString(const wxString& string);
|
void WriteString(const wxString& string);
|
||||||
|
|
||||||
wxDataOutputStream& operator<<(const wxChar *string);
|
wxDataOutputStream& operator<<(const wxChar *string);
|
||||||
wxDataOutputStream& operator<<(wxString& string);
|
wxDataOutputStream& operator<<(const wxString& string);
|
||||||
wxDataOutputStream& operator<<(wxInt8 c);
|
wxDataOutputStream& operator<<(wxInt8 c);
|
||||||
wxDataOutputStream& operator<<(wxInt16 i);
|
wxDataOutputStream& operator<<(wxInt16 i);
|
||||||
wxDataOutputStream& operator<<(wxInt32 i);
|
wxDataOutputStream& operator<<(wxInt32 i);
|
||||||
@@ -72,8 +72,8 @@ public:
|
|||||||
wxDataOutputStream& operator<<(double f);
|
wxDataOutputStream& operator<<(double f);
|
||||||
wxDataOutputStream& operator<<(float 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:
|
protected:
|
||||||
wxOutputStream *m_output;
|
wxOutputStream *m_output;
|
||||||
bool m_be_order;
|
bool m_be_order;
|
||||||
|
@@ -72,7 +72,7 @@ public:
|
|||||||
// After the page is loaded, the method calls SetPage() to display it.
|
// After the page is loaded, the method calls SetPage() to display it.
|
||||||
// Note : you can also use path relative to previously loaded page
|
// Note : you can also use path relative to previously loaded page
|
||||||
// Return value : same as SetPage
|
// Return value : same as SetPage
|
||||||
bool LoadPage(const wxString& location);
|
virtual bool LoadPage(const wxString& location);
|
||||||
|
|
||||||
// Returns full location of opened page
|
// Returns full location of opened page
|
||||||
wxString GetOpenedPage() const {return m_OpenedPage;}
|
wxString GetOpenedPage() const {return m_OpenedPage;}
|
||||||
|
@@ -1330,8 +1330,6 @@ wxDateTime::Tm wxDateTime::GetTm(const TimeZone& tz) const
|
|||||||
// check that the algorithm gave us something reasonable
|
// check that the algorithm gave us something reasonable
|
||||||
wxASSERT_MSG( (0 < month) && (month <= 12), _T("invalid month") );
|
wxASSERT_MSG( (0 < month) && (month <= 12), _T("invalid month") );
|
||||||
wxASSERT_MSG( (1 <= day) && (day < 32), _T("invalid day") );
|
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
|
// construct Tm from these values
|
||||||
Tm tm;
|
Tm tm;
|
||||||
|
@@ -105,7 +105,7 @@ wxString wxDataInputStream::ReadString()
|
|||||||
#endif
|
#endif
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +237,7 @@ wxDataOutputStream& wxDataOutputStream::operator<<(const wxChar *string)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataOutputStream& wxDataOutputStream::operator<<(wxString& string)
|
wxDataOutputStream& wxDataOutputStream::operator<<(const wxString& string)
|
||||||
{
|
{
|
||||||
WriteString(string);
|
WriteString(string);
|
||||||
return *this;
|
return *this;
|
||||||
|
@@ -96,7 +96,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxXPMHandler,wxImageHandler)
|
|||||||
|
|
||||||
bool wxXPMHandler::LoadFile(wxImage *image,
|
bool wxXPMHandler::LoadFile(wxImage *image,
|
||||||
wxInputStream& stream,
|
wxInputStream& stream,
|
||||||
bool verbose, int WXUNUSED(index))
|
bool WXUNUSED(verbose), int WXUNUSED(index))
|
||||||
{
|
{
|
||||||
wxXPMDecoder decoder;
|
wxXPMDecoder decoder;
|
||||||
|
|
||||||
|
@@ -1879,13 +1879,6 @@ void wxArrayString::Grow()
|
|||||||
else {
|
else {
|
||||||
// otherwise when it's called for the first time, nIncrement would be 0
|
// otherwise when it's called for the first time, nIncrement would be 0
|
||||||
// and the array would never be expanded
|
// 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
|
// add 50% but not too much
|
||||||
size_t nIncrement = m_nSize < ARRAY_DEFAULT_INITIAL_SIZE
|
size_t nIncrement = m_nSize < ARRAY_DEFAULT_INITIAL_SIZE
|
||||||
? ARRAY_DEFAULT_INITIAL_SIZE : m_nSize >> 1;
|
? ARRAY_DEFAULT_INITIAL_SIZE : m_nSize >> 1;
|
||||||
|
@@ -288,7 +288,7 @@ wxWindow::~wxWindow()
|
|||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = TRUE;
|
||||||
|
|
||||||
MSWDetachWindowMenu();
|
MSWDetachWindowMenu();
|
||||||
|
|
||||||
// VS: make sure there's no wxFrame with last focus set to us:
|
// VS: make sure there's no wxFrame with last focus set to us:
|
||||||
for (wxWindow *win = GetParent(); win; win = win->GetParent())
|
for (wxWindow *win = GetParent(); win; win = win->GetParent())
|
||||||
{
|
{
|
||||||
@@ -3461,6 +3461,9 @@ bool wxWindow::HandleMouseWheel(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
return GetEventHandler()->ProcessEvent(event);
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
(void) wParam;
|
||||||
|
(void) lParam;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user