Latest updates from SciTech code tree including numerous warning fixes for

the Watcom and other compilers.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11217 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kendall Bennett
2001-07-31 17:50:16 +00:00
parent ac6f6ffccf
commit d699f48ba3
25 changed files with 251 additions and 135 deletions

View File

@@ -44,7 +44,7 @@ public:
wxEchoVariable() : wxObject() {}
~wxEchoVariable() {}
/****************************************************************************
/****************************************************************************
RETURNS:
The boolean value of the variable
@@ -65,8 +65,8 @@ public:
public:
// static function to retrieve any variable avaliable
static wxString GetValue(const wxString &cls, const char *parms = NULL);
};
static wxString FindValue(const wxString &cls, const char *parms = NULL);
};
/*--------------------------------- MACROS --------------------------------*/
@@ -83,13 +83,13 @@ public:
wxString wxEchoVariable##name :: GetValue(const char *parms) const { \
wxString _BEV_parm = wxString(parms);
#define END_ECHO_VARIABLE(name, returnval) \
#define END_ECHO_VARIABLE(returnval) \
return returnval; \
}
#define STRING_ECHO_VARIABLE(name, string) \
BEGIN_ECHO_VARIABLE(##name##); \
END_ECHO_VARIABLE(##name##, wxString(##string##))
END_ECHO_VARIABLE(wxString(##string##))
#endif // __WX_ECHOVAR_H

View File

@@ -66,8 +66,8 @@ public:
public:
// static function to retrieve any variable avaliable
static bool GetValue(const wxString &cls);
};
static bool FindValue(const wxString &cls);
};
/*--------------------------------- MACROS --------------------------------*/
@@ -82,14 +82,13 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxIfElseVariable##name##, wxIfElseVariable); \
bool wxIfElseVariable##name :: GetValue() const {
#define END_IFELSE_VARIABLE(name, returnval) \
#define END_IFELSE_VARIABLE(returnval) \
return returnval; \
}
#define IFELSE_VARIABLE(name, state) \
BEGIN_IFELSE_VARIABLE(##name##); \
END_IFELSE_VARIABLE(##name##, bool (state))
END_IFELSE_VARIABLE(bool (state))
#endif // __WX_IFELSEVAR_H

View File

@@ -5,19 +5,23 @@
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows License
* Version 3.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.wxwindows.org/licence3.txt
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* ========================================================================
* ======================================================================
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* | |
* |This copyrighted computer code is a proprietary trade secret of |
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
* |written authorization from SciTech to possess or use this code, you |
* |may be subject to civil and/or criminal penalties. |
* | |
* |If you received this code in error or you would like to report |
* |improper use, please immediately contact SciTech Software, Inc. at |
* |530-894-8400. |
* | |
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* ======================================================================
*
* Language: ANSI C++
* Environment: Any
@@ -30,6 +34,7 @@
#define __WX_APPLET_WINDOW_H
#include "wx/html/htmlwin.h"
#include "wx/process.h"
// Forward declare
class wxApplet;
@@ -89,7 +94,7 @@ protected:
wxToolBarBase *m_NavBar;
int m_NavBackId;
int m_NavForwardId;
wxString m_DocRoot;
public:
// Constructor
wxHtmlAppletWindow(
@@ -101,7 +106,8 @@ public:
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHW_SCROLLBAR_AUTO,
const wxString& name = "htmlAppletWindow");
const wxString& name = "htmlAppletWindow",
const wxString& docroot = "" );
// Destructor
~wxHtmlAppletWindow();
@@ -135,13 +141,13 @@ public:
void SendMessage(wxEvent& msg);
// Register a cookie of data in the applet manager
bool RegisterCookie(const wxString& name,wxObject *cookie);
static bool RegisterCookie(const wxString& name,wxObject *cookie);
// UnRegister a cookie of data in the applet manager
bool UnRegisterCookie(const wxString& name);
static bool UnRegisterCookie(const wxString& name);
// Find a cookie of data given it's public name
wxObject *FindCookie(const wxString& name);
static wxObject *FindCookie(const wxString& name);
// Event handlers to load a new page
void OnLoadPage(wxLoadPageEvent &event);
@@ -150,16 +156,36 @@ public:
void OnPageLoaded(wxPageLoadedEvent &event);
// LoadPage mutex locks
void Lock() { m_mutexLock = true;};
void UnLock() { m_mutexLock = false;};
void Lock(){ m_mutexLock = true;};
void UnLock(){ m_mutexLock = false;};
// Returns TRUE if the mutex is locked, FALSE otherwise.
bool IsLocked() { return m_mutexLock;};
bool IsLocked(){ return m_mutexLock;};
// Tries to lock the mutex. If it can't, returns immediately with false.
bool TryLock();
};
/****************************************************************************
REMARKS:
Defines the class for AppetProcess
***************************************************************************/
class AppletProcess : public wxProcess {
public:
AppletProcess(
wxWindow *parent)
: wxProcess(parent)
{
}
// instead of overriding this virtual function we might as well process the
// event from it in the frame class - this might be more convenient in some
// cases
virtual void OnTerminate(int pid, int status);
};
#endif // __WX_APPLET_WINDOW_H

View File

@@ -5,19 +5,23 @@
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows License
* Version 3.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.wxwindows.org/licence3.txt
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* ========================================================================
* ======================================================================
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* | |
* |This copyrighted computer code is a proprietary trade secret of |
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
* |written authorization from SciTech to possess or use this code, you |
* |may be subject to civil and/or criminal penalties. |
* | |
* |If you received this code in error or you would like to report |
* |improper use, please immediately contact SciTech Software, Inc. at |
* |530-894-8400. |
* | |
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* ======================================================================
*
* Language: ANSI C++
* Environment: Any
@@ -28,6 +32,9 @@
// For compilers that support precompilation
#include "wx/wxprec.h"
#include "wx/utils.h"
#include "wx/process.h"
#include "wx/spawnbrowser.h"
#include "wx/html/forcelnk.h"
// Include private headers
@@ -40,7 +47,6 @@
#include "wx/applet/prepecho.h"
#include "wx/applet/prepifelse.h"
/*---------------------------- Global variables ---------------------------*/
wxHashTable wxHtmlAppletWindow::m_Cookies;
@@ -75,7 +81,8 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
const wxPoint& pos,
const wxSize& size,
long style,
const wxString& name)
const wxString& name,
const wxString& docroot )
: wxHtmlWindow(parent,id,pos,size,style,name)
{
// Init our locks
@@ -91,10 +98,15 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
m_NavBar = NULL;
}
// Set up docroot
m_DocRoot = docroot;
// Add HTML preprocessors
// deleting preprocessors is done by the code within the window
incPreprocessor = new wxIncludePrep(); // #include preprocessor
incPreprocessor->ChangeDirectory(m_DocRoot);
wxEchoPrep * echoPreprocessor = new wxEchoPrep(); // #echo preprocessor
wxIfElsePrep * ifPreprocessor = new wxIfElsePrep();
@@ -206,21 +218,21 @@ bool wxHtmlAppletWindow::LoadPage(
{
wxString href(link);
// Check for abs path. If it is not then tack on the path
// supplied at creation.
if (!wxIsAbsolutePath(href))
href = m_DocRoot + href;
// 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;
return wxSpawnBrowser(this, cmdValue.c_str());
}
if (!(cmd.CmpNoCase("?EXECUTE"))){
wxMessageBox(cmdValue);
wxProcess *child = new AppletProcess(this);
wxExecute(cmdValue, false, child);
return true;
}
if (!(cmd.CmpNoCase("?VIRTUAL"))){
@@ -230,27 +242,19 @@ bool wxHtmlAppletWindow::LoadPage(
}
else {
#ifdef CHECKED
wxMessageBox("VIRTUAL LINK ERROR: " + cmdValue + " does not exist.");
wxLogError(_T("VIRTUAL LINK ERROR: '%s' does not exist."), cmdValue.c_str());
#endif
return true;
}
}
}
// Make a copy of the current path the translate for <!-- include files from what will be the new path
// we cannot just grab this value from the base class since it is not correct until after LoadPage is
// called. And we need the incPreprocessor to know the right path before LoadPage.
wxFileSystem fs;
fs.ChangePathTo(m_FS->GetPath(), true);
fs.ChangePathTo(link);
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(wxHtmlLinkInfo(href));
Show(false);
bool stat = wxHtmlWindow::LoadPage(href);
Show(true);
// Enable/Dis the navbar tools
if (m_NavBar) {
@@ -426,12 +430,9 @@ need to change the page for the current window to a new window.
void wxHtmlAppletWindow::OnLoadPage(
wxLoadPageEvent &event)
{
// Test the mutex lock. We have to do this here because wxHTML constantly
// calls wxYield which processes the message queue. This in turns means
// that we may end up processing a new 'loadPage' event while the new
// page is still loading! We need to avoid this so we use a simple
// lock to avoid loading a page while presently loading another page.
if (TryLock()) {
// Test the mutex lock.
if (!(IsLocked())){
Lock();
if (event.GetHtmlWindow() == this){
if (LoadPage(event.GetHRef())){
// wxPageLoadedEvent evt;
@@ -493,6 +494,18 @@ VirtualData::VirtualData(
m_href = href;
}
/****************************************************************************
PARAMETERS:
REMARKS:
****************************************************************************/
void AppletProcess::OnTerminate(
int,
int )
{
// we're not needed any more
delete this;
}
#include "wx/html/m_templ.h"
/****************************************************************************

View File

@@ -60,7 +60,7 @@ where these are used.
SEE ALSO:
wxEchoPrep
****************************************************************************/
static wxString wxEchoVariable::GetValue(
static wxString wxEchoVariable::FindValue(
const wxString &cls,
const char *parms)
{

View File

@@ -59,7 +59,7 @@ where these are used.
SEE ALSO:
wxIfElsePrep
****************************************************************************/
static bool wxIfElseVariable::GetValue(
static bool wxIfElseVariable::FindValue(
const wxString &cls)
{
wxObject * tmpclass;

View File

@@ -97,7 +97,7 @@ wxString wxEchoPrep::Process(
cname = tag.Mid(10, n);
// grab the value from the class, put it in tag since the data is no longer needed
tag = wxEchoVariable::GetValue(cname, NULL);
tag = wxEchoVariable::FindValue(cname, NULL);
}
else {
// Find the parms
@@ -114,7 +114,7 @@ wxString wxEchoPrep::Process(
cname = tag.Mid(10, n);
// grab the value from the class, put it in tag since the data is no longer needed
tag = wxEchoVariable::GetValue(cname, parms.c_str());
tag = wxEchoVariable::FindValue(cname, parms.c_str());
}

View File

@@ -130,7 +130,7 @@ wxString wxIfElsePrep::Process(
if (c != -1) cname = cname.Mid(0, c);
// Grab the value from the variable class identified by cname
value = wxIfElseVariable::GetValue(cname);
value = wxIfElseVariable::FindValue(cname);
// Find the end of the tag (<!--#endif-->) and copy it all into the variable code
end = ((output.Mid(b)).Lower()).Find("<!--#endif-->");

View File

@@ -98,11 +98,11 @@ wxString wxIncludePrep::Process(
#ifdef CHECKED
wxMessageBox(wxString("wxHTML #include error: File not Found ") + fname + wxString("."),"Error",wxICON_ERROR);
#endif
delete file;
continue;
}
wxString tmp;
do {
char tmp2[257];