Mutiple updates from SciTech for wxWindows including the following:

1. Updates to HTML applet classes in client side include syntax
2. Updates to wxUniversal for OS/2
3. Updates for better palette management on Windows
4. Misc other fixes and changes to fix build system for Watcom 11.0


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12045 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kendall Bennett
2001-10-17 22:25:56 +00:00
parent 7361f176df
commit 19193a2c85
62 changed files with 1309 additions and 658 deletions

View File

@@ -41,10 +41,9 @@ wxIncludePrep class Definition
class wxIncludePrep : public wxHtmlProcessor {
private:
//DECLARE_DYNAMIC_CLASS(wxIncludePrep);
wxString DOC_ROOT;
wxFileSystem *m_FS;
public:
wxIncludePrep() : wxHtmlProcessor() {DOC_ROOT = wxString("");}
wxIncludePrep() : wxHtmlProcessor() {}
~wxIncludePrep() {}
// Process input text and return processed result
@@ -54,8 +53,7 @@ public:
// is the processor applied to the text.
int GetPriority() const { return wxHTML_PRIORITY_SYSTEM; }
void ChangeDirectory(const wxString &dir);
wxString GetDirectory() { return DOC_ROOT; }
void ChangeDirectory(wxFileSystem *);
};

View File

@@ -5,23 +5,19 @@
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ======================================================================
* |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|
* ======================================================================
* ========================================================================
*
* 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.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
@@ -66,6 +62,8 @@ public:
wxString& group,
wxString& href );
VirtualData();
// Gets
wxString GetName(){ return m_name;};
wxString GetGroup(){ return m_group;};
@@ -90,13 +88,19 @@ private:
bool m_mutexLock;
wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
protected:
wxAppletList m_AppletList;
static wxHashTable m_Cookies;
bool m_NavBarEnabled;
wxToolBarBase *m_NavBar;
int m_NavBackId;
int m_NavForwardId;
wxString m_DocRoot;
wxPalette m_globalPalette;
// Override this so we can do proper palette management!!
virtual void OnDraw(wxDC& dc);
public:
// Constructor
wxHtmlAppletWindow(
@@ -109,7 +113,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxHW_SCROLLBAR_AUTO,
const wxString& name = "htmlAppletWindow",
const wxString& docroot = "" );
const wxPalette& globalPalette = wxNullPalette);
// Destructor
~wxHtmlAppletWindow();
@@ -142,6 +146,14 @@ public:
// Handles backwards navigation within the HTML stack
bool HistoryBack();
// Disables Nav bars
void DisableNavBar();
// Enables Nav bars
void EnableNavBar();
void SetNavBar(wxToolBarBase *navBar);
// Broadcast a message to all applets on the page
void SendMessage(wxEvent& msg);

View File

@@ -5,23 +5,19 @@
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ======================================================================
* |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|
* ======================================================================
* ========================================================================
*
* 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.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
@@ -88,24 +84,27 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
const wxSize& size,
long style,
const wxString& name,
const wxString& docroot )
: wxHtmlWindow(parent,id,pos,size,style,name)
const wxPalette& globalPalette)
: wxHtmlWindow(parent,id,pos,size,style,name), m_globalPalette(globalPalette)
{
// Init our locks
UnLock();
// setup client navbars
if (navBar) {
m_NavBarEnabled = true;
m_NavBar = navBar;
m_NavBackId = navBackId;
m_NavForwardId = navForwardId;
}
else {
m_NavBarEnabled = false;
m_NavBar = NULL;
}
// Set up docroot
m_DocRoot = docroot;
m_NavBackId = navBackId;
m_NavForwardId = navForwardId;
// Set the key_type for applets
m_AppletList = wxAppletList(wxKEY_STRING);
@@ -114,7 +113,7 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
// deleting preprocessors is done by the code within the window
incPreprocessor = new wxIncludePrep(); // #include preprocessor
incPreprocessor->ChangeDirectory(m_DocRoot);
incPreprocessor->ChangeDirectory(m_FS); // give it access to our filesys object
wxEchoPrep * echoPreprocessor = new wxEchoPrep(); // #echo preprocessor
wxIfElsePrep * ifPreprocessor = new wxIfElsePrep();
@@ -132,6 +131,27 @@ wxHtmlAppletWindow::~wxHtmlAppletWindow()
{
}
#include "scitech.h"
/****************************************************************************
PARAMETERS:
dc - wxDC object to draw on
REMARKS:
This function handles drawing the HTML applet window. Because the standard
wxWindows classes don't properly handle palette management, we add code
in here to properly select the global palette that we use for all drawing
into the DC before we allow the regular wxWindows code to finish the
drawing process.
****************************************************************************/
void wxHtmlAppletWindow::OnDraw(
wxDC& dc)
{
// TODO: Only do this for <= 8bpp modes!
dc.SetPalette(m_globalPalette);
wxHtmlWindow::OnDraw(dc);
}
/****************************************************************************
PARAMETERS:
className - Name of the applet class to create an object for
@@ -263,24 +283,11 @@ True if page loaded successfully, false if not
REMARKS:
Remove an applet from the manager. Called during applet destruction
****************************************************************************/
#include "scitech"
bool wxHtmlAppletWindow::LoadPage(
const wxString& link)
{
wxString href(link);
// TODO: technically we allow no relative paths
// Check to see if it is a real url, if not it is a file
if (link.Mid(0, 5).CmpNoCase("http:") != 0) {
// Check for abs path. If it is not then tack on the path
// supplied at creation.
// TODO: Abs paths are only used in testing (remove this)
if (link.GetChar(1) != ':')
href = m_DocRoot + href;
}
if (link.GetChar(0) == '?'){
wxString cmd = link.BeforeFirst('=');
wxString cmdValue = link.AfterFirst('=');
@@ -329,11 +336,12 @@ bool wxHtmlAppletWindow::LoadPage(
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) {
if (m_NavBarEnabled) {
m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward());
m_NavBar->EnableTool(m_NavBackId,HistoryCanBack());
}
@@ -388,6 +396,37 @@ bool wxHtmlAppletWindow::HistoryBack()
return wxHtmlWindow::HistoryBack();
}
/****************************************************************************
REMARKS:
This function is used to disable the navigation bars. If you want to
toggle to the navbars off you must call this function.
****************************************************************************/
void wxHtmlAppletWindow::DisableNavBar()
{
m_NavBarEnabled = false;
}
/****************************************************************************
REMARKS:
This function is used to enable the nav bars. If you toggle the nav bars on
you must call this function.
****************************************************************************/
void wxHtmlAppletWindow::EnableNavBar()
{
m_NavBarEnabled = true;
}
/****************************************************************************
REMARKS:
This function is used to set the nav bar to a new nav bar if you deleted the
one that you were useing. Usally this happens when you toggle a nav bar
on or off.
****************************************************************************/
void wxHtmlAppletWindow::SetNavBar(wxToolBarBase *navBar)
{
m_NavBar = navBar;
}
/****************************************************************************
PARAMETERS:
msg - wxEvent message to be sent to all wxApplets
@@ -570,6 +609,18 @@ VirtualData::VirtualData(
m_href = href;
}
/****************************************************************************
PARAMETERS:
REMARKS:
VirtualData is used to store information on the virtual links.
****************************************************************************/
VirtualData::VirtualData()
{
m_name.Empty();
m_group.Empty();
m_href.Empty();
}
/****************************************************************************
PARAMETERS:
REMARKS:

View File

@@ -115,9 +115,14 @@ wxString wxEchoPrep::Process(
// grab the value from the class, put it in tag since the data is no longer needed
tag = wxEchoVariable::FindValue(cname, parms.c_str());
}
}
// remove ampersands and <> chars
tag.Replace("&", "&amp;");
tag.Replace("<", "&lt;");
tag.Replace(">", "&gt;");
output = (output.Mid(0,i) + tag + output.Mid(i));
}

View File

@@ -49,12 +49,17 @@ do not correctly pass the given return value.
****************************************************************************/
int ReverseFind(
const wxString &tstr,
const wxString &str)
const wxString &str,
int start = -1)
{
wxASSERT( str.GetStringData()->IsValid() );
// TODO could be made much quicker than that
int p = tstr.Len()-str.Len()-1;
int p2 = start-str.Len();
// if the user supplied a valid start point, use it
if (start != -1 && p > p2) p = p2;
while ( p >= 0 ) {
if ( wxStrncmp(tstr.c_str() + p, str.c_str(), str.Len()) == 0 )
return p;
@@ -64,6 +69,131 @@ int ReverseFind(
return -1;
}
/****************************************************************************
PARAMETERS:
str - text of #if statement
RETURNS:
true or false depending on how it evaluated
REMARKS:
SEE ALSO:
wxIfElseVariable
****************************************************************************/
bool ParseIfStatementValue(wxString &str) {
// Find out if the tag has parenthesis
// recursive to parse the text within the parenthesis,
// replacing the text with 1 or 0, (hardcoded true or false)
int b;
while ((b = str.Find('(')) != -1) {
int e;
// Find the matching parenthesis
int nextbeg, nextend;
int parencount = 1, min = b+1;
do {
nextbeg = str.find('(', min);
nextend = str.find(')', min);
if (nextbeg < nextend && nextbeg != wxString::npos) {
parencount++;
min = nextbeg+1;
}
else {
parencount--;
min = nextend+1;
}
if (nextend == wxString::npos) {
#ifdef CHECKED
wxMessageBox("wxHTML #if\\else error: Unmatched parenthesis in #if expression.","Error",wxICON_ERROR);
#endif
return true;
}
// once parencount reaches 0 again we have found our matchin )
} while (parencount > 0);
e = nextend;
// Extract the expression from the parenthesis block and recurse
// to solve it.
wxString tag;
tag = str.Mid(b+1, e-b-1);
bool val = ParseIfStatementValue(tag);
// Add extra spaces just in case of NOT(VAL)
if (val) str = str.Mid(0, b) + " 1" + str.Mid(e+1);
else str = str.Mid(0, b) + " 0" + str.Mid(e+1);
}
// Remove spaces from left and right
str.Trim(false);
str.Trim(true);
// Convert text method of operators "AND" and "OR" to c style
// this makes only one special case necessary for each later on
str.Replace(" AND ", "&&");
str.Replace(" OR ", "||");
// We use ReverseFind so that the whole left expression gets evaluated agains
// the right single item, creating a left -> right evaluation
// Search for || operators, recurse to solve (so we don't have to handle special cases here)
int and, or;
and = ReverseFind(str, "&&");
or = ReverseFind(str, "||");
if ( (and != -1) || (or != -1) ) {
wxString tag1, tag2;
// handle the rightmost first to force left->right evaluation
if (and > or) {
return (
ParseIfStatementValue(tag2 = str.Mid(and+2)) &&
ParseIfStatementValue(tag1 = str.Mid(0, and)) );
}
else {
return (
ParseIfStatementValue(tag2 = str.Mid(or+2)) ||
ParseIfStatementValue(tag1 = str.Mid(0, or)) );
}
}
// By the time we get to this place in the function we are guarenteed to have a single
// variable operation, perhaps with a NOT or ! operator
bool notval = false;
// search for a NOT or ! operator
if (str.Mid(0, 1) == "!") {
str.Remove(0, 1);
str.Trim(false); // trim spaces from left
notval = true;
}
else if (str.Mid(0,4).CmpNoCase("NOT ") == 0) {
str.Remove(0, 4);
str.Trim(false); // trim any extra spaces from left
notval = true;
}
// now all we have left is the name of the class or a hardcoded 0 or 1
if (str == "") {
#ifdef CHECKED
wxMessageBox("wxHTML #if\\else error: Empty expression in #if\\#elif statement.","Error",wxICON_ERROR);
#endif
return true;
}
// check for hardcoded 0 and 1 cases, (these are used by parenthesis catcher)
// this just decomplicates the recursion algorithm
if (str == "0") return notval;
if (str == "1") return !notval;
// Grab the value from the variable class identified by cname
bool value = wxIfElseVariable::FindValue(str);
if (notval) value = !value;
return value;
}
/****************************************************************************
PARAMETERS:
text - HTML to process for if/else blocks
@@ -72,7 +202,7 @@ RETURNS:
The string containing the processed HTML
REMARKS:
This function replaces #if, #else, and #endif directives with the text
This function replaces #if, #else, #elif, and #endif directives with the text
contained within the blocks, dependant on the value of the given boolean
variable. The variable is created by making a sub class of wxIfElseVariable.
Dynamic class construction is used at run time internally to create an instance
@@ -86,19 +216,81 @@ wxString wxIfElsePrep::Process(
{
int b;
char ft[] = "<!--#if ";
char ftnot[] = "<!--#if NOT ";
char ftend[] = "<!--#endif-->";
char ftelse[] = "<!--#else-->";
char ftnot[] = "<!--#if not ";
char ftnot2[] = "<!--#if !";
char ftelif[] = "<!--#elif ";
// make a copy so we can replace text as we go without affecting the original
wxString output = text;
// Avoid duplication of our parsing code by turning any #elif blocks into appropriate
// else/if blocks
while ((b = ReverseFind(output.Lower(), ftelif)) != -1) {
int e;
// Replace beginning of block
e = output.find("-->", b + strlen(ftelif));
if (e == wxString::npos) {
#ifdef CHECKED
wxMessageBox("wxHTML #elif error: Premature end of file while parsing #elif.","Error",wxICON_ERROR);
#endif
break;
}
// Convert to lower case so find is easy, grab everything after #elif tag
wxString remains = (output.Mid(e+strlen("-->"))).Lower();
// find matching else or endif
int nextif, nextendif;
int ifcount = 1, min = 0;
do {
nextif = remains.find(ft, min);
nextendif = remains.find(ftend, min);
if (nextif < nextendif && nextif != wxString::npos) {
ifcount++;
min = nextif+1;
}
else {
ifcount--;
min = nextendif+1;
}
if (nextendif == wxString::npos) {
#ifdef CHECKED
wxMessageBox("wxHTML #elif error: Premature end of file before finding #endif.","Error",wxICON_ERROR);
#endif
break;
}
// once ifcount reaches 0 again we have found our matchin #endif
} while (ifcount > 0);
// If it couldn't be found die gracefully
if (nextendif == wxString::npos) {
// We already displayed a message, just break all the way out
break;
}
int elifsize = e - (b + strlen(ftelif)) + strlen("-->");
// Create the #if/else block, removing the #elif code
output = output.Mid(0, b) +
wxString(wxString(ftelse)+wxString(ft)) +
output.Mid(b+strlen(ftelif), elifsize+nextendif) +
wxString(ftend) +
output.Mid(b+strlen(ftelif)+elifsize+nextendif);
}
// Parse out the if else blocks themselves
while ((b = ReverseFind(output.Lower(), ft)) != -1) {
// Loop until every #if directive is found
// We search from the end of the string so that #if statements will properly recurse
// and we avoid the hassle of matching statements with the correct <!--#endif-->
bool notval = false;
int off = 0;
int end, c, n;
int end;
wxString usecode, code;
wxString cname;
wxString tag;
@@ -106,15 +298,6 @@ wxString wxIfElsePrep::Process(
code = wxString("");
if (output.Mid(b, strlen(ftnot) ).CmpNoCase(ftnot) == 0 ) {
notval = true;
off = 4;
}
else if (output.Mid(b, strlen(ftnot2) ).CmpNoCase(ftnot2) == 0 ) {
notval = true;
off = 1;
}
// grab the tag and get the name of the variable
end = (output.Mid(b)).Find("-->");
if (end == -1) {
@@ -125,30 +308,14 @@ wxString wxIfElsePrep::Process(
}
end += 3;
tag = output.Mid(b, end);
// remove the <!--#if and --> sections from the tag before passing it on to be parsed
tag = output.Mid(b+strlen(ft), end-strlen(ft)-3);
output.Remove(b, end);
c = tag.Find("-->");
n = c;
// find the classname
c = (tag.Mid(8+off, n-(8+off))).Find(" ");
if (c == -1) n -= (8+off);
else n = c;
cname = tag.Mid(8+off, n);
cname.Trim(false);
c = cname.Find("\"");
if (c != -1) cname = cname.Mid(c+1);
c = cname.Find("\"");
if (c != -1) cname = cname.Mid(0, c);
// Grab the value from the variable class identified by cname
value = wxIfElseVariable::FindValue(cname);
if (notval) value = !value;
value = ParseIfStatementValue(tag);
// Find the end of the tag (<!--#endif-->) and copy it all into the variable code
end = ((output.Mid(b)).Lower()).Find("<!--#endif-->");
end = ((output.Mid(b)).Lower()).Find(ftend);
if (end == -1) {
#ifdef CHECKED
wxMessageBox("wxHTML #if error: Premature end of file while searching for matching #endif.","Error",wxICON_ERROR);
@@ -157,14 +324,14 @@ wxString wxIfElsePrep::Process(
}
code = output.Mid(b, end);
output.Remove(b, end+13); // remove the entire #if block from original document
output.Remove(b, end+strlen(ftend)); // remove the entire #if block from original document
// Find out if there is an else statement
end = (code.Lower()).Find("<!--#else-->");
end = (code.Lower()).Find(ftelse);
if (end != -1) {
if (!value) {
// Use the else statement
usecode = code.Mid(end+12);
usecode = code.Mid(end+strlen(ftelse));
}
else {
// Use statement before #else

View File

@@ -59,8 +59,6 @@ wxString wxIncludePrep::Process(
int i;
char ft[] = "<!--#include virtual=";
wxFileSystem *fs = new wxFileSystem;
fs->ChangePathTo(DOC_ROOT, true);
int openedcount = 0;
@@ -92,11 +90,12 @@ wxString wxIncludePrep::Process(
// remove the #include tag
output.Remove(i, n+21+3);
wxFSFile * file = fs->OpenFile(DOC_ROOT + fname);
wxFSFile * file;
file = m_FS->OpenFile(fname);
if (!file) {
#ifdef CHECKED
wxMessageBox(wxString("wxHTML #include error: File not Found ") + DOC_ROOT + fname + wxString("."),"Error",wxICON_ERROR);
wxMessageBox(wxString("wxHTML #include error: File not Found ") + fname + wxString("."),"Error",wxICON_ERROR);
#endif
delete file;
continue;
@@ -125,7 +124,6 @@ wxString wxIncludePrep::Process(
delete file;
}
delete fs;
return output;
}
@@ -138,9 +136,8 @@ This function sets the directory to get included HTML files from. The default
value is the current directory. Directorys may be given as a relative path.
****************************************************************************/
void wxIncludePrep::ChangeDirectory(
const wxString &dir)
wxFileSystem *fs)
{
DOC_ROOT = dir;
m_FS = fs;
}

View File

@@ -441,7 +441,24 @@ typedef int wxWindowID;
#elif defined(__WXPM__)
# if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
# if defined (__WATCOMC__)
# ifdef WXMAKINGDLL
# define WXDLLEXPORT __declspec( dllexport )
# define WXDLLEXPORT_DATA(type) __declspec( dllexport ) type
# define WXDLLEXPORT_CTORFN
// __declspec(dllimport) prepends __imp to imported symbols. We do NOT want that!
//# elif defined(WXUSINGDLL)
//# define WXDLLEXPORT __declspec( dllimport )
//# define WXDLLEXPORT_DATA(type) __declspec( dllimport ) type
//# define WXDLLEXPORT_CTORFN
# else
# define WXDLLEXPORT
# define WXDLLEXPORT_DATA(type) type
# define WXDLLEXPORT_CTORFN
# endif
# elif (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
# ifdef WXMAKINGDLL
# define WXDLLEXPORT _Export
@@ -1902,7 +1919,10 @@ typedef unsigned short WORD;
// WIN32 graphics types for OS/2 GPI
// RGB under OS2 is more like a PALETTEENTRY struct under Windows so we need a real RGB def
#define OS2RGB(r,g,b) ((DWORD ((BYTE) (b) | ((WORD) (g) << 8)) | (((DWORD)(BYTE)(r)) << 16)))
// WARNING: The OS/2 headers typedef BYTE simply as 'char'; if the default is signed, all
// hell will break loose!
//#define OS2RGB(r,g,b) ((DWORD ((BYTE) (b) | ((WORD) (g) << 8)) | (((DWORD)(BYTE)(r)) << 16)))
#define OS2RGB(r,g,b) ((DWORD)((unsigned char)(b) | ((unsigned char)(g) << 8)) | ((unsigned char)(r) << 16))
typedef unsigned long COLORREF;
#define GetBValue(rgb) ((BYTE)((rgb) >> 16))
@@ -1931,7 +1951,7 @@ typedef struct tagLOGPALETTE
#elif defined(__WIN32__)
typedef int (__stdcall *WXFARPROC)();
#elif defined(__WXPM__)
# if defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )
# if (defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )) || defined (__WATCOMC__)
// VA 3.0 for some reason needs base data types when typedefing a proc proto???
typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*);
# else

View File

@@ -79,6 +79,8 @@ public:
// calls layout for layout constraints and sizers
void OnSize(wxSizeEvent& event);
virtual void InitDialog();
WX_DECLARE_CONTROL_CONTAINER();
protected:

View File

@@ -240,3 +240,4 @@ private:
#endif
#endif // _WX_HTMLWIN_H_

View File

@@ -236,3 +236,4 @@ public:

View File

@@ -204,7 +204,7 @@ extern LONG APIENTRY _EXPORT
// make conversion from wxColour and COLORREF a bit less painful
inline COLORREF wxColourToRGB(const wxColour& c)
{
return RGB(c.Red(), c.Green(), c.Blue());
return PALETTERGB(c.Red(), c.Green(), c.Blue());
}
inline void wxRGBToColour(wxColour& c, COLORREF rgb)

View File

@@ -12,6 +12,13 @@
#ifndef _WX_APP_H_
#define _WX_APP_H_
#ifdef __WATCOMC__
#include <sys/ioctl.h>
#include <sys/select.h>
#else
#include <sys/time.h>
#include <sys/types.h>
@@ -24,6 +31,8 @@
#define INCL_ORDERS
#endif
#endif
#include "wx/event.h"
#include "wx/icon.h"

View File

@@ -35,6 +35,8 @@ public:
,unsigned char cBlue
);
wxColour( unsigned long colRGB ) { Set(colRGB); }
//
// Implicit conversion from the colour name
//

View File

@@ -41,6 +41,7 @@ public:
{
long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
bModal = false;
Create( pParent
,-1
,rsTitle

View File

@@ -43,19 +43,7 @@ public:
(void)Create(nSize, nFamily, nStyle, nWeight, bUnderlined, rsFace, vEncoding);
}
wxFont(const wxNativeFontInfo& rInfo)
{
Init();
(void)Create( rInfo.pointSize
,rInfo.family
,rInfo.style
,rInfo.weight
,rInfo.underlined
,rInfo.faceName
,rInfo.encoding
);
}
wxFont(const wxNativeFontInfo& rInfo);
bool Create( int nSize
,int nFamily

View File

@@ -53,7 +53,9 @@ public:
virtual void Iconize(bool bIconize = TRUE);
virtual bool IsIconized(void) const;
virtual void Restore(void);
#if wxUSE_MENUS_NATIVE
virtual void SetMenuBar(wxMenuBar* pMenubar);
#endif
virtual void SetIcon(const wxIcon& rIcon);
virtual bool ShowFullScreen( bool bShow
,long lStyle = wxFULLSCREEN_ALL
@@ -175,10 +177,9 @@ protected:
,int nWeight
);
#if wxUSE_MENUS_NATIVE
// helper
void DetachMenuBar(void);
#if wxUSE_MENUS_NATIVE
// perform MSW-specific action when menubar is changed
virtual void AttachMenuBar(wxMenuBar* pMenubar);
// a plug in for MDI frame classes which need to do something special when

View File

@@ -28,7 +28,6 @@ class WXDLLEXPORT wxImageList;
class WXDLLEXPORT wxWindow;
// array of notebook pages
typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayNBPages);
// ----------------------------------------------------------------------------

View File

@@ -45,7 +45,7 @@ public:
,const wxPoint& rBottomRight
);
wxRegion(const wxRect& rRect);
wxRegion(WXHRGN hRegion); // Hangs on to this region
wxRegion(WXHRGN hRegion, WXHDC hPS); // Hangs on to this region
wxRegion();
~wxRegion();

View File

@@ -109,10 +109,12 @@ public:
,int* pExternalLeading = (int *)NULL
,const wxFont* pTheFont = (const wxFont *)NULL
) const;
#if wxUSE_MENUS_NATIVE
virtual bool DoPopupMenu( wxMenu* pMenu
,int nX
,int nY
);
#endif // wxUSE_MENUS_NATIVE
virtual void SetScrollbar( int nOrient
,int nPos
@@ -180,6 +182,7 @@ public:
) const;
#endif // wxUSE_CARET
#ifndef __WXUNIVERSAL__
// Native resource loading (implemented in src/os2/nativdlg.cpp)
// FIXME: should they really be all virtual?
virtual bool LoadNativeDialog( wxWindow* pParent
@@ -190,6 +193,7 @@ public:
);
wxWindow* GetWindowChild1(wxWindowID vId);
wxWindow* GetWindowChild(wxWindowID vId);
#endif //__WXUNIVERSAL__
// implementation from now on
// --------------------------
@@ -266,6 +270,7 @@ public:
) const;
#endif // WXWIN_COMPATIBILITY
#ifndef __WXUNIVERSAL__
// Create an appropriate wxWindow from a HWND
virtual wxWindow* CreateWindowFromHWND( wxWindow* pParent
,WXHWND hWnd
@@ -273,6 +278,7 @@ public:
// Make sure the window style reflects the HWND style (roughly)
virtual void AdoptAttributesFromHWND(void);
#endif
// Setup background and foreground colours correctly
virtual void SetupColours(void);

View File

@@ -19,7 +19,6 @@
#include "wx/window.h"
#if wxUSE_POPUPWIN
// ----------------------------------------------------------------------------
// wxPopupWindow: a special kind of top level window used for popup menus,
// combobox popups and such.
@@ -50,9 +49,12 @@ public:
const wxSize& size);
};
// include the real class declaration
#ifdef __WXMSW__
#include "wx/msw/popupwin.h"
#elif __WXPM__
#include "wx/os2/popupwin.h"
#elif __WXGTK__
#include "wx/gtk/popupwin.h"
#elif __WXMGL__

View File

@@ -15,7 +15,7 @@
// ----------------------------------------------------------------------------
// undef everything
// ----------------------------------------------------------------------------
#ifdef __WXMAC__
#if defined(__WXMAC__)
#define wxUSE_GUI 1
#define WXWIN_COMPATIBILITY 0
@@ -173,6 +173,162 @@
#define wxUSE_DYNAMIC_CLASSES 1
#elif defined(__WXPM__)
#define wxUSE_GUI 1
#define WXWIN_COMPATIBILITY 0
#define wxICON_IS_BITMAP 0
#define wxFONT_SIZE_COMPATIBILITY 0
#define wxDIALOG_UNIT_COMPATIBILITY 0
#define wxUSE_DEBUG_CONTEXT 0
#define wxUSE_MEMORY_TRACING 0
#define wxUSE_GLOBAL_MEMORY_OPERATORS 0
#define wxUSE_DEBUG_NEW_ALWAYS 0
#define wxUSE_ON_FATAL_EXCEPTION 0
#define wxUSE_UNICODE 0
#define wxUSE_WCHAR_T 0
#define wxUSE_LOG 1
#define wxUSE_LOGGUI 1
#define wxUSE_LOGWINDOW 1
#define wxUSE_LOG_DIALOG 0
#define wxUSE_THREADS 0
#define wxUSE_STREAMS 0
#define wxUSE_STD_IOSTREAM 0
#define wxUSE_SERIAL 0
#define wxUSE_LONGLONG 1
#define wxUSE_TIMER 1
#define wxUSE_STOPWATCH 1
#define wxUSE_TIMEDATE 0
#define wxUSE_DATETIME 1
#define wxUSE_CONFIG 0
#define wxUSE_CONFIG_NATIVE 0
#define wxUSE_DIALUP_MANAGER 0
#define wxUSE_DYNLIB_CLASS 0
#define wxUSE_SOCKETS 0
#define wxUSE_FILESYSTEM 0
#define wxUSE_FS_ZIP 0
#define wxUSE_FS_INET 0
#define wxUSE_ZIPSTREAM 0
#define wxUSE_ZLIB 0
#define wxUSE_APPLE_IEEE 0
#define wxUSE_FILE 1
#define wxUSE_FFILE 1
#define wxUSE_TEXTFILE 0
#define wxUSE_INTL 0
#define wxUSE_MENUS 1
#define wxUSE_TOOLBAR 0
#define wxUSE_TOOLBAR_NATIVE 0
#define wxUSE_TOOLBAR_SIMPLE 0
#define wxUSE_NOTEBOOK 1
#define wxUSE_FONTMAP 0
#define wxUSE_MIMETYPE 0
#define wxUSE_IMAGE 1
#define wxUSE_SYSTEM_OPTIONS 1
#define wxUSE_CONTROLS 1
#define wxUSE_POPUPWIN 1
#define wxUSE_BUTTON 1
#define wxUSE_BMPBUTTON 1
#define wxUSE_CALENDARCTRL 0
#define wxUSE_CARET 1
#define wxUSE_CHECKBOX 1
#define wxUSE_CHECKLISTBOX 1
#define wxUSE_CHOICE 0
#define wxUSE_COMBOBOX 1
#define wxUSE_GAUGE 1
#define wxUSE_IMAGLIST 1
#define wxUSE_LISTBOX 1
#define wxUSE_LISTCTRL 0
#define wxUSE_RADIOBOX 1
#define wxUSE_RADIOBTN 1
#define wxUSE_SASH 0
#define wxUSE_SCROLLBAR 1
#define wxUSE_SLIDER 1
#define wxUSE_SPINBTN 1
#define wxUSE_SPINCTRL 1
#define wxUSE_STATBOX 1
#define wxUSE_STATLINE 1
#define wxUSE_STATTEXT 1
#define wxUSE_STATBMP 1
//#define wxUSE_STATUSBAR 0
#define wxUSE_TEXTCTRL 1
#define wxUSE_TOOLTIPS 0
#define wxUSE_TREECTRL 0
#define wxUSE_NATIVE_STATUSBAR 0
#define wxUSE_BUTTONBAR 0
#define wxUSE_GRID 0
#define wxUSE_NEW_GRID 0
#define wxUSE_VALIDATORS 0
#define wxUSE_DC_CACHEING 1
#define wxUSE_ACCEL 1
#define wxUSE_GENERIC_DIALOGS_IN_MSW 0
#define wxUSE_COMMON_DIALOGS 0
#define wxUSE_TEXTDLG 0
#define wxUSE_PROGRESSDLG 0
#define wxUSE_BUSYINFO 0
#define wxUSE_DIRDLG 0
#define wxUSE_FONTDLG 0
#define wxUSE_FILEDLG 0
#define wxUSE_COLOURDLG 0
#define wxUSE_TEXTDLG 0
#define wxUSE_CHOICEDLG 0
#define wxUSE_NUMBERDLG 0
#define wxUSE_STARTUP_TIPS 0
#define wxUSE_MSGDLG 1
#define wxUSE_SPLITTER 1
#define wxUSE_TAB_DIALOG 0
#define wxUSE_METAFILE 0
#define wxUSE_ENH_METAFILE 0
#define wxUSE_WIN_METAFILES_ALWAYS 0
#define wxUSE_DOC_VIEW_ARCHITECTURE 0
#define wxUSE_MDI_ARCHITECTURE 0
#define wxUSE_PRINTING_ARCHITECTURE 0
#define wxUSE_HTML 0
#define wxUSE_PLOT 0
#define wxUSE_GLCANVAS 0
#define wxUSE_TREELAYOUT 0
#define wxUSE_IPC 0
#define wxUSE_HELP 0
#define wxUSE_MS_HTML_HELP 0
#define wxUSE_WXHTML_HELP 0
#define wxUSE_RESOURCES 0
#define wxUSE_CONSTRAINTS 1
#define wxUSE_CLIPBOARD 0
#define wxUSE_DATAOBJ 1
#define wxUSE_SPLINES 0
#define wxUSE_DRAG_AND_DROP 0
#define wxUSE_XPM_IN_MSW 1
#define wxUSE_XPM 1
#define wxUSE_IMAGE_LOADING_IN_MSW 1
#define wxUSE_RESOURCE_LOADING_IN_MSW 0
#define wxUSE_WX_RESOURCES 0
#define wxUSE_POSTSCRIPT 0
#define wxUSE_AFM_FOR_POSTSCRIPT 0
#define wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW 0
#define wxUSE_ODBC 0
#define wxODBC_FWD_ONLY_CURSORS 0
#define wxODBC_BACKWARD_COMPATABILITY 0
#define REMOVE_UNUSED_ARG 1
#define wxUSE_IOSTREAMH 0
#define wxUSE_LIBPNG 0
#define wxUSE_LIBJPEG 0
#define wxUSE_LIBTIFF 0
#define wxUSE_GIF 0
#define wxUSE_PNM 0
#define wxUSE_PCX 0
#define wxUSE_MFC 0
#define wxUSE_OLE 0
#define wxUSE_CTL3D 0
#define wxUSE_ITSY_BITSY 0
#define wxUSE_DYNAMIC_CLASSES 1
#define wxUSE_JOYSTICK 1
#define wxUSE_REGEX 0
#define wxUSE_STATUSBAR 1
#else
#define wxUSE_GUI 1

View File

@@ -1,5 +1,5 @@
ICON 1 PRELOAD "mondros2.ico"
#include "..\\..\\include\wx\os2\wx.rc"
#include "wx/os2/wx.rc"
#define MINIMAL_QUIT 1
#define MINIMAL_ABOUT 102

View File

@@ -920,6 +920,8 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
info = CLASSINFO(wxWindowGTK);
# elif defined(__WXMGL__)
info = CLASSINFO(wxWindowMGL);
# elif defined(__WXPM__)
info = CLASSINFO(wxWindowOS2);
# elif defined(__WXMAC__)
info = CLASSINFO(wxWindowMac);
# elif defined(__WXMOTIF__)

View File

@@ -1,3 +1,4 @@
#include "wx/defs.h"
#include "wx/setup.h"
#include <math.h>

View File

@@ -473,7 +473,10 @@ bool wxTempFile::Open(const wxString& strName)
// OS/2 supports that have them (HPFS, FAT32) and security (HPFS386)
static const wxChar *szMktempSuffix = wxT("XXX");
m_strTemp << strName << szMktempSuffix;
// Temporarily remove - MN
#ifndef __WATCOMC__
::DosCreateDir(m_strTemp.GetWriteBuf(MAX_PATH), NULL);
#endif
#else // Windows
wxString strPath;
wxSplitPath(strName, &strPath, NULL, NULL);

View File

@@ -1019,6 +1019,11 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite)
//
// NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite
return ::CopyFile(file1, file2, !overwrite) != 0;
#elif defined(__WXPM__)
if (::DosCopy(file2, file2, overwrite ? DCPY_EXISTING : 0) == 0)
return TRUE;
else
return FALSE;
#else // !Win32
wxStructStat fbuf;
@@ -1760,7 +1765,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
strcpy( buf , res ) ;
*/
if (0) {
#elif(__VISAGECPP__)
#elif defined(__VISAGECPP__) || (defined (__OS2__) && defined (__WATCOMC__))
APIRET rc;
rc = ::DosQueryCurrentDir( 0 // current drive
,buf

View File

@@ -37,6 +37,12 @@ extern "C"
#include "wx/intl.h"
#include "wx/module.h"
#ifdef __WATCOMC__
#ifdef LINKAGEMODE
#undef LINKAGEMODE
#define LINKAGEMODE __cdecl
#endif
#endif
//-----------------------------------------------------------------------------
// wxTIFFHandler
//-----------------------------------------------------------------------------

View File

@@ -54,7 +54,7 @@
#include <stdlib.h>
#include <string.h>
#if defined(__VISAGECPP__)
#if defined(__OS2__)
#define RGB_RED_OS2 0
#define RGB_GREEN_OS2 1
#define RGB_BLUE_OS2 2
@@ -90,7 +90,23 @@ typedef struct {
JSAMPLE *sample_range_limit, *srl_orig;
} j_decompress;
#ifdef __WINDOWS__
#define JMETHOD(type,methodname,arglist) type (__cdecl methodname) arglist
#else
#define JMETHOD(type,methodname,arglist) type (methodname) arglist
#endif
typedef j_decompress *j_decompress_ptr;
struct jpeg_color_quantizer {
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, bool is_pre_scan));
JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPARRAY output_buf,
int num_rows));
JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
};
/*
@@ -150,7 +166,7 @@ typedef j_decompress *j_decompress_ptr;
* you'll probably want to tweak the histogram sizes too.
*/
#if defined(__VISAGECPP__)
#if defined(__OS2__)
#if RGB_RED_OS2 == 0
#define C0_SCALE R_SCALE
@@ -1349,7 +1365,7 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo)
int i;
cquantize = (my_cquantize_ptr) malloc(sizeof(my_cquantizer));
cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
cinfo->cquantize = (jpeg_color_quantizer *) cquantize;
cquantize->pub.start_pass = start_pass_2_quant;
cquantize->pub.new_color_map = new_color_map_2_quant;
cquantize->fserrors = NULL; /* flag optional arrays not allocated */
@@ -1495,6 +1511,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest,
int h = src.GetHeight();
int windowsSystemColourCount = 20;
int paletteShift = 0;
// Shift the palette up by the number of Windows system colours,

View File

@@ -330,11 +330,11 @@ wxLongLong wxGetLocalTimeMillis()
// do NOT just shut off these warnings, drop me a line instead at
// <guille@iies.es>
#if defined(__VISUALC__)
#if defined(__VISUALC__) || defined (__WATCOMC__)
#pragma message("wxStopWatch will be up to second resolution!")
#elif defined(__BORLANDC__)
#pragma message "wxStopWatch will be up to second resolution!"
#else
#elif
#warning "wxStopWatch will be up to second resolution!"
#endif // compiler
#endif

View File

@@ -13,7 +13,7 @@ $Id$
*/
#include "wx/defs.h"
#include "wx/setup.h"
#if wxUSE_ZLIB && wxUSE_ZIPSTREAM

View File

@@ -81,6 +81,13 @@ wxPanel::~wxPanel()
{
}
void wxPanel::InitDialog()
{
wxInitDialogEvent event(GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
// ----------------------------------------------------------------------------
// event handlers
// ----------------------------------------------------------------------------

View File

@@ -431,6 +431,9 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
if (depth == -1) depth = wxDisplayDepth();
SetDepth( depth );
// Copy the palette from the source image
SetPalette(image.GetPalette());
// create a DIB header
int headersize = sizeof(BITMAPINFOHEADER);
BITMAPINFO *lpDIBh = (BITMAPINFO *) malloc( headersize );

View File

@@ -252,7 +252,7 @@ void wxDC::SelectOldObjects(WXHDC dc)
#if wxUSE_PALETTE
if (m_oldPalette)
{
::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, TRUE);
::SelectPalette((HDC) dc, (HPALETTE) m_oldPalette, FALSE);
}
m_oldPalette = 0;
#endif // wxUSE_PALETTE
@@ -868,6 +868,7 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
height = bmp.GetHeight();
HBITMAP hbmpMask = 0;
HPALETTE oldPal = 0;
if ( useMask )
{
@@ -896,13 +897,19 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
if (wxSystemOptions::GetOptionInt(wxT("no-maskblt")) == 0)
#endif
{
HDC cdc = GetHdc();
HDC hdcMem = ::CreateCompatibleDC(GetHdc());
::SelectObject(hdcMem, GetHbitmapOf(bmp));
ok = ::MaskBlt(GetHdc(), x, y, width, height,
if (bmp.GetPalette() && (::GetDeviceCaps(cdc,BITSPIXEL) <= 8)) {
oldPal = ::SelectPalette( hdcMem, (HPALETTE)bmp.GetPalette()->GetHPALETTE(), FALSE);
::RealizePalette(hdcMem);
}
ok = ::MaskBlt(cdc, x, y, width, height,
hdcMem, 0, 0,
hbmpMask, 0, 0,
MAKEROP4(SRCCOPY, DSTCOPY)) != 0;
if (oldPal)
::SelectPalette(hdcMem, oldPal, FALSE);
::DeleteDC(hdcMem);
}
@@ -938,8 +945,14 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
::SetBkColor(GetHdc(), m_textBackgroundColour.GetPixel() );
}
if (bmp.GetPalette() && (::GetDeviceCaps(cdc,BITSPIXEL) <= 8)) {
oldPal = ::SelectPalette( memdc, (HPALETTE)bmp.GetPalette()->GetHPALETTE(), FALSE);
::RealizePalette(memdc);
}
::SelectObject( memdc, hbitmap );
::BitBlt( cdc, x, y, width, height, memdc, 0, 0, SRCCOPY);
if (oldPal)
::SelectPalette(memdc, oldPal, FALSE);
::DeleteDC( memdc );
::SetTextColor(GetHdc(), old_textground);
@@ -1084,7 +1097,7 @@ void wxDC::SetPalette(const wxPalette& palette)
// that's not yet selected out.
if (m_oldPalette)
{
::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, TRUE);
::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, FALSE);
m_oldPalette = 0;
}
@@ -1096,7 +1109,7 @@ void wxDC::SetPalette(const wxPalette& palette)
// the original colourmap
if (m_oldPalette)
{
::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, TRUE);
::SelectPalette(GetHdc(), (HPALETTE) m_oldPalette, FALSE);
m_oldPalette = 0;
}
@@ -1105,7 +1118,7 @@ void wxDC::SetPalette(const wxPalette& palette)
if (m_palette.Ok() && m_palette.GetHPALETTE())
{
HPALETTE oldPal = ::SelectPalette(GetHdc(), (HPALETTE) m_palette.GetHPALETTE(), TRUE);
HPALETTE oldPal = ::SelectPalette(GetHdc(), (HPALETTE) m_palette.GetHPALETTE(), FALSE);
if (!m_oldPalette)
m_oldPalette = (WXHPALETTE) oldPal;

View File

@@ -132,8 +132,8 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
SendMessage(wx_button, ZYZG_SETORIENTATION, wOrient, 0);
SendMessage(wx_button, ZYZG_SETRANGE, range, 0);
SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, PALETTERGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
//SetBezelFace(1);
//SetShadowWidth(1);
@@ -200,7 +200,7 @@ bool wxGaugeMSW::SetForegroundColour(const wxColour& col)
if ( !wxControl::SetForegroundColour(col) )
return FALSE;
SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, RGB(col.Red(), col.Green(), col.Blue()));
SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, PALETTERGB(col.Red(), col.Green(), col.Blue()));
return TRUE;
}
@@ -210,7 +210,7 @@ bool wxGaugeMSW::SetBackgroundColour(const wxColour& col)
if ( !wxControl::SetBackgroundColour(col) )
return FALSE;
SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, RGB(col.Red(), col.Green(), col.Blue()));
SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, PALETTERGB(col.Red(), col.Green(), col.Blue()));
return TRUE;
}

View File

@@ -137,7 +137,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
return TRUE;
// wxColor <-> RGB
#define ToRGB(col) RGB(col.Red(), col.Green(), col.Blue())
#define ToRGB(col) PALETTERGB(col.Red(), col.Green(), col.Blue())
#define UnRGB(col) GetRValue(col), GetGValue(col), GetBValue(col)
// set the colors

View File

@@ -259,8 +259,10 @@ size_t wxPipeOutputStream::OnSysWrite(const void *buffer, size_t len)
#ifdef __WIN32__
static DWORD wxExecuteThread(wxExecuteData *data)
static DWORD __stdcall wxExecuteThread(void *arg)
{
wxExecuteData *data = (wxExecuteData*)arg;
WaitForSingleObject(data->hProcess, INFINITE);
// get the exit code
@@ -646,7 +648,7 @@ long wxExecute(const wxString& cmd, bool sync, wxProcess *handler)
DWORD tid;
HANDLE hThread = ::CreateThread(NULL,
0,
(LPTHREAD_START_ROUTINE)wxExecuteThread,
wxExecuteThread,
(void *)data,
0,
&tid);

View File

@@ -39,26 +39,26 @@
#ifdef __EMX__
#include <sys\ioctl.h>
#include <sys\select.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#else
#include <nerrno.h>
#include <ioctl.h>
#include <select.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/time.h>
#endif // ndef for __EMX__
#endif //
#ifndef __EMX__
#define select(a,b,c,d,e) bsdselect(a,b,c,d,e)
int _System bsdselect(int,
extern "C" int _System bsdselect(int,
struct fd_set *,
struct fd_set *,
struct fd_set *,
struct timeval *);
#endif
#if wxUSE_THREADS
@@ -326,7 +326,6 @@ bool wxApp::RegisterWindowClasses(
HAB vHab
)
{
APIRET rc;
ERRORID vError = 0L;
wxString sError;
@@ -654,6 +653,9 @@ bool wxApp::OnInitGui()
ERRORID vError;
wxString sError;
if (!wxAppBase::OnInitGui())
return FALSE;
m_hMq = ::WinCreateMsgQueue(vHabmain, 0);
if (!m_hMq)
{
@@ -662,6 +664,7 @@ bool wxApp::OnInitGui()
wxLogDebug(sError);
return FALSE;
}
return TRUE;
} // end of wxApp::OnInitGui
@@ -998,9 +1001,9 @@ void wxApp::OnIdle(
// automated DC cache management: clear the cached DCs and bitmap
// if it's likely that the app has finished with them, that is, we
// get an idle event and we're not dragging anything.
if (!::WinGetKeyState(MK_LBUTTON) &&
!::WinGetKeyState(MK_MBUTTON) &&
!::WinGetKeyState(MK_RBUTTON))
if (!::WinGetKeyState(HWND_DESKTOP, VK_BUTTON1) &&
!::WinGetKeyState(HWND_DESKTOP, VK_BUTTON3) &&
!::WinGetKeyState(HWND_DESKTOP, VK_BUTTON2))
wxDC::ClearCache();
#endif // wxUSE_DC_CACHEING

View File

@@ -520,6 +520,8 @@ bool wxClipboard::AddData( wxDataObject *data )
#else // !wxUSE_DRAG_AND_DROP
*/
return FALSE;
#else
return FALSE;
#endif // wxUSE_DRAG_AND_DROP/!wxUSE_DRAG_AND_DROP
}
@@ -606,6 +608,8 @@ bool wxClipboard::GetData( wxDataObject& data )
#else
*/
return FALSE;
#else
return FALSE;
#endif
}

View File

@@ -23,6 +23,7 @@
#include "wx/log.h"
#include "wx/icon.h"
#include "wx/msgdlg.h"
#include "wx/module.h"
#endif
#include "wx/dcprint.h"
@@ -204,7 +205,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache(
, int nHeight
)
{
int nDepth = 24 // we'll fix this later ::GetDeviceCaps((HDC) dc, PLANES) * ::GetDeviceCaps((HDC) dc, BITSPIXEL);
int nDepth = 24; // we'll fix this later ::GetDeviceCaps((HDC) dc, PLANES) * ::GetDeviceCaps((HDC) dc, BITSPIXEL);
wxNode* pNode = m_svBitmapCache.First();
BITMAPINFOHEADER2 vBmpHdr;

View File

@@ -225,7 +225,7 @@ void wxClientDC::InitDC()
// in wxUniv build we must manually do some DC adjustments usually
// performed by Windows for us
#ifdef __WXUNIVERSAL__
wxPoint ptOrigin = m_canvas->GetClientAreaOrigin();
wxPoint ptOrigin = m_pCanvas->GetClientAreaOrigin();
if ( ptOrigin.x || ptOrigin.y )
{
// no need to shift DC origin if shift is null
@@ -233,7 +233,7 @@ void wxClientDC::InitDC()
}
// clip the DC to avoid overwriting the non client area
SetClippingRegion(wxPoint(0, 0), m_canvas->GetClientSize());
SetClippingRegion(wxPoint(0, 0), m_pCanvas->GetClientSize());
#endif // __WXUNIVERSAL__
} // end of wxClientDC::InitDC

View File

@@ -157,7 +157,7 @@ wxDialog::~wxDialog()
m_isBeingDeleted = TRUE;
wxTopLevelWindows.DeleteObject(this);
Show(FALSE);
if (!IsModal)
if (!IsModal())
wxModelessWindows.DeleteObject(this);
//

View File

@@ -35,6 +35,7 @@
#include <sys/types.h>
#define INCL_DOSFILEMGR
#define INCL_DOSERRORS
#include <os2.h>
#ifdef __EMX__

View File

@@ -27,7 +27,6 @@
#include "wx/os2/private.h"
#include "wx/cmndata.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>

View File

@@ -161,6 +161,21 @@ wxFontRefData::~wxFontRefData()
// wxFont
// ----------------------------------------------------------------------------
wxFont::wxFont(const wxNativeFontInfo& rInfo)
{
Init();
(void)Create( rInfo.pointSize
,rInfo.family
,rInfo.style
,rInfo.weight
,rInfo.underlined
,rInfo.faceName
,rInfo.encoding
);
}
void wxFont::Init()
{
if ( wxTheFontList )

View File

@@ -24,6 +24,8 @@
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_FONTMAP
#ifndef WX_PRECOMP
#include "wx/font.h"
#endif
@@ -216,3 +218,4 @@ int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
}
*/
#endif // wxUSE_FONTMAP

View File

@@ -332,9 +332,9 @@ void wxFillLogFont(
,&vInfo
))
{
if ( !wxTheFontMapper->GetAltForEncoding( vEncoding
,&vInfo
))
#if wxUSE_FONTMAP
if (!wxTheFontMapper->GetAltForEncoding(vEncoding, &vInfo))
#endif // wxUSE_FONTMAP
{
//
// Unsupported encoding, replace with the default

View File

@@ -53,10 +53,13 @@
extern wxWindowList wxModelessWindows;
extern wxList WXDLLEXPORT wxPendingDelete;
extern wxChar wxFrameClassName[];
#if wxUSE_MENUS_NATIVE
extern wxMenu *wxCurrentPopupMenu;
#endif
extern void wxAssociateWinWithHandle( HWND hWnd
,wxWindow* pWin
,wxWindowOS2* pWin
);
// ----------------------------------------------------------------------------
@@ -553,6 +556,7 @@ void wxFrameOS2::PositionStatusBar()
} // end of wxFrameOS2::PositionStatusBar
#endif // wxUSE_STATUSBAR
#if wxUSE_MENUS_NATIVE
void wxFrameOS2::DetachMenuBar()
{
if (m_frameMenuBar)
@@ -619,6 +623,8 @@ void wxFrameOS2::AttachMenuBar(
wxMenuBar* pMenubar
)
{
wxFrameBase::AttachMenuBar(pMenubar);
m_frameMenuBar = pMenubar;
if (!pMenubar)
@@ -674,6 +680,7 @@ void wxFrameOS2::InternalSetMenuBar()
}
::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)FCF_MENU, (MPARAM)0);
} // end of wxFrameOS2::InternalSetMenuBar
#endif // wxUSE_MENUS_NATIVE
//
// Responds to colour changes, and passes event on to children
@@ -1296,7 +1303,7 @@ bool wxFrameOS2::OS2TranslateMessage(
if (!pMenuBar)
return FALSE;
#if wxUSE_ACCEL
#if wxUSE_ACCEL && wxUSE_MENUS_NATIVE
const wxAcceleratorTable& rAcceleratorTable = pMenuBar->GetAccelTable();
return rAcceleratorTable.Translate(GetHWND(), pMsg);
#else
@@ -1469,6 +1476,7 @@ bool wxFrameOS2::HandleCommand(
//
if (nCmd == CMDSRC_MENU || nCmd == CMDSRC_ACCELERATOR)
{
#if wxUSE_MENUS_NATIVE
if (wxCurrentPopupMenu)
{
wxMenu* pPopupMenu = wxCurrentPopupMenu;
@@ -1478,7 +1486,9 @@ bool wxFrameOS2::HandleCommand(
return pPopupMenu->OS2Command( nCmd
,nId
);
return TRUE;
}
#endif
if (ProcessCommand(nId))
{

View File

@@ -346,8 +346,10 @@ void wxGDIImage::InitStandardHandlers()
AddHandler(new wxBMPResourceHandler);
AddHandler(new wxBMPFileHandler);
#if wxUSE_XPM_IN_OS2
AddHandler(new wxXPMFileHandler);
AddHandler(new wxXPMDataHandler);
#endif
AddHandler(new wxICOResourceHandler);
AddHandler(new wxICOFileHandler);

View File

@@ -28,7 +28,7 @@
#define BSD_SELECT /* use Berkley Sockets select */
#include <assert.h>
#include <sys\types.h>
#include <sys/types.h>
#ifdef __EMX__
#include <sys/time.h>
@@ -42,10 +42,11 @@
#else
#include <utils.h>
#include <sys\time.h>
#include <string.h>
#include <sys/time.h>
#include <types.h>
#include <in.h>
#include <netinet/in.h>
#include <netdb.h>
#include <nerrno.h>
@@ -53,7 +54,7 @@
#if defined(__VISAGECPP__) && __IBMCPP__ < 400
#include <machine\endian.h>
#include <machine/endian.h>
#include <socket.h>
#include <ioctl.h>
#include <select.h>
@@ -63,9 +64,9 @@
#else
#include <sys\socket.h>
#include <sys\ioctl.h>
#include <sys\select.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#ifdef __EMX__
#define soclose(a) close(a)
@@ -80,7 +81,6 @@ int _System soclose(int);
#endif
#endif
#include <string.h>
#include <stdio.h>
#if (defined(__VISAGECPP__) && __IBMCPP__ < 400) || defined(__EMX__)
# ifdef min
@@ -90,6 +90,7 @@ int _System soclose(int);
#endif
#include <stddef.h>
#include <ctype.h>
#include <stdlib.h>
#include <signal.h>
@@ -418,7 +419,7 @@ GSocketError GSocket_SetServer(GSocket *sck)
return GSOCK_IOERR;
}
ioctl(sck->m_fd, FIONBIO, &arg);
ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(sck);
/* Bind to the local address,
@@ -524,7 +525,7 @@ GSocket *GSocket_WaitConnection(GSocket *socket)
return NULL;
}
ioctl(connection->m_fd, FIONBIO, &arg);
ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(connection);
return connection;
@@ -593,7 +594,7 @@ GSocketError GSocket_Connect(GSocket *sck, GSocketStream stream)
return GSOCK_IOERR;
}
ioctl(sck->m_fd, FIONBIO, &arg);
ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(sck);
/* Connect it to the peer address, with a timeout (see below) */
@@ -701,7 +702,7 @@ GSocketError GSocket_SetNonOriented(GSocket *sck)
return GSOCK_IOERR;
}
ioctl(sck->m_fd, FIONBIO, &arg);
ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(sck);
/* Bind to the local address,
@@ -1197,7 +1198,7 @@ int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size)
ret = send(socket->m_fd, buffer, size, 0);
UNMASK_SIGNAL();
#else
ret = send(socket->m_fd, buffer, size, 0);
ret = send(socket->m_fd, (char *)buffer, size, 0);
#endif
return ret;
}
@@ -1226,7 +1227,7 @@ int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size)
ret = sendto(socket->m_fd, buffer, size, 0, addr, len);
UNMASK_SIGNAL();
#else
ret = sendto(socket->m_fd, buffer, size, 0, addr, len);
ret = sendto(socket->m_fd, (char *)buffer, size, 0, addr, len);
#endif
/* Frees memory allocated from _GAddress_translate_to */
@@ -1494,8 +1495,8 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname)
{
#else
/* Use gethostbyname by default */
int val = 1; //VA doesn't like constants in conditional expressions at all
if (val)
// int val = 1; //VA doesn't like constants in conditional expressions at all
if (1)
{
#endif
struct in_addr *array_addr;

View File

@@ -22,17 +22,17 @@
# include <fstream>
#endif
#define INCL_PM
#include <os2.h>
#include "wx/palette.h"
#include "wx/bitmap.h"
#include "wx/utils.h"
#define INCL_PM
#include <os2.h>
#include "wx/os2/pngread.h"
extern "C" {
#include "../png/png.h"
#include "png.h"
}
extern "C" void png_read_init PNGARG((png_structp png_ptr));

View File

@@ -31,6 +31,7 @@ public:
wxRegionRefData()
{
m_hRegion = 0;
m_hPS = 0;
}
wxRegionRefData(const wxRegionRefData& rData)
@@ -89,11 +90,13 @@ wxRegion::wxRegion()
} // end of wxRegion::wxRegion
wxRegion::wxRegion(
WXHRGN hRegion
WXHRGN hRegion,
WXHDC hPS
)
{
m_refData = new wxRegionRefData;
M_REGION = (HRGN) hRegion;
(((wxRegionRefData*)m_refData)->m_hPS) = hPS;
} // end of wxRegion::wxRegion
wxRegion::wxRegion(
@@ -396,8 +399,9 @@ void wxRegion::GetBox(
if (m_refData)
{
RECTL vRect;
APIRET rc;
::GpiQueryRegionBox( ((wxRegionRefData*)m_refData)->m_hPS
rc = ::GpiQueryRegionBox( ((wxRegionRefData*)m_refData)->m_hPS
,M_REGION
,&vRect
);

View File

@@ -18,6 +18,7 @@
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/gdicmn.h"
#include "wx/module.h"
#endif
#include "wx/settings.h"

View File

@@ -18,6 +18,7 @@
#ifndef WX_PRECOMP
#include "wx/textctrl.h"
#include "wx/scrolwin.h"
#include "wx/settings.h"
#include "wx/brush.h"
#include "wx/utils.h"
@@ -43,7 +44,7 @@
# include <fstream>
#endif
#if defined(__EMX__) && !defined(MLE_INDEX)
#if !defined(MLE_INDEX)
#define MLE_INDEX 0
#define MLE_RGB 1
#endif

View File

@@ -21,6 +21,9 @@
#include <stdio.h>
#include "wx/module.h"
#include "wx/intl.h"
#include "wx/utils.h"
#include "wx/log.h"
#include "wx/thread.h"
#define INCL_DOSSEMAPHORES

View File

@@ -105,7 +105,7 @@ bool wxGetUserId(
, int nType
)
{
#ifndef __EMX__
#if defined(__VISAGECPP__)
long lrc;
// UPM procs return 0 on success
lrc = U32ELOCU((unsigned char*)zBuf, (unsigned long *)&nType);
@@ -750,6 +750,7 @@ void wxGetMousePosition(
// Return TRUE if we have a colour display
bool wxColourDisplay()
{
#if 0
HPS hpsScreen;
HDC hdcScreen;
LONG lColors;
@@ -758,6 +759,11 @@ bool wxColourDisplay()
hdcScreen = ::GpiQueryDevice(hpsScreen);
::DevQueryCaps(hdcScreen, CAPS_COLORS, 1L, &lColors);
return(lColors > 1L);
#else
// I don't see how the PM display could not be color. Besides, this
// was leaking DCs and PSs!!! MN
return true;
#endif
}
// Returns depth of screen
@@ -767,15 +773,20 @@ int wxDisplayDepth()
HDC hdcScreen;
LONG lPlanes;
LONG lBitsPerPixel;
LONG nDepth;
static LONG nDepth = 0;
// The screen colordepth ain't gonna change. No reason to query
// it over and over!
if (!nDepth) {
hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
hdcScreen = ::GpiQueryDevice(hpsScreen);
::DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
::DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
nDepth = (int)(lPlanes * lBitsPerPixel);
DevCloseDC(hdcScreen);
::DevCloseDC(hdcScreen);
::WinReleasePS(hpsScreen);
}
return (nDepth);
}
@@ -787,14 +798,18 @@ void wxDisplaySize(
{
HPS hpsScreen;
HDC hdcScreen;
LONG lWidth;
LONG lHeight;
static LONG lWidth = 0;
static LONG lHeight = 0;
// The screen size ain't gonna change either so just cache the values
if (!lWidth) {
hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
hdcScreen = ::GpiQueryDevice(hpsScreen);
::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, &lWidth);
::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, &lHeight);
DevCloseDC(hdcScreen);
::DevCloseDC(hdcScreen);
::WinReleasePS(hpsScreen);
}
*pWidth = (int)lWidth;
*pHeight = (int)lHeight;
}
@@ -822,6 +837,8 @@ void wxDisplaySizeMM(
,1L
,(PLONG)pHeight
);
::DevCloseDC(hdcScreen);
::WinReleasePS(hpsScreen);
}
void wxClientDisplayRect(int *x, int *y, int *width, int *height)

File diff suppressed because it is too large Load Diff

View File

@@ -36,7 +36,7 @@
#if wxUSE_XPM_IN_OS2
#define FOR_MSW 1
#include "../xpm/xpm.h"
#include "xpm.h"
#endif
#include "wx/xpmhand.h"

View File

@@ -92,7 +92,12 @@ void wxFrame::PositionMenuBar()
// the menubar is positioned above the client size, hence the negative
// y coord
wxCoord heightMbar = m_frameMenuBar->GetSize().y;
m_frameMenuBar->SetSize(0, -heightMbar,
m_frameMenuBar->SetSize(0,
#ifdef __WXPM__
GetClientSize().y - heightMbar,
#else
-heightMbar,
#endif
GetClientSize().x, heightMbar);
}
}
@@ -136,7 +141,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
{
wxPoint pt = wxFrameBase::GetClientAreaOrigin();
#if wxUSE_MENUS
#if wxUSE_MENUS && !defined(__WXPM__)
if ( m_frameMenuBar )
{
pt.y += m_frameMenuBar->GetSize().y;

View File

@@ -135,8 +135,8 @@ void wxScrollArrows::DrawArrow(Arrow arrow,
};
void (wxRenderer::*pfn)(wxDC&, wxDirection, const wxRect&, int) =
scrollbarLike ? &wxRenderer::DrawScrollbarArrow
: &wxRenderer::DrawArrow;
scrollbarLike ? wxRenderer::DrawScrollbarArrow
: wxRenderer::DrawArrow;
(m_control->GetRenderer()->*pfn)
(

View File

@@ -103,6 +103,8 @@ wxThemeInfo::wxThemeInfo(Constructor c,
nameDefTheme = _T("gtk");
#elif defined(__WXMGL__)
nameDefTheme = _T("win32");
#elif defined(__WXPM__)
nameDefTheme = _T("win32");
#endif
}

View File

@@ -73,6 +73,8 @@
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowGTK)
#elif defined(__WXMGL__)
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowMGL)
#elif defined(__WXPM__)
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowOS2)
#endif
BEGIN_EVENT_TABLE(wxWindow, wxWindowNative)