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

View File

@@ -5,23 +5,19 @@
* Copyright (C) 1991-2001 SciTech Software, Inc. * Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved. * All rights reserved.
* *
* ====================================================================== * ========================================================================
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW| *
* | | * The contents of this file are subject to the wxWindows License
* |This copyrighted computer code is a proprietary trade secret of | * Version 3.0 (the "License"); you may not use this file except in
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 | * compliance with the License. You may obtain a copy of the License at
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, | * http://www.wxwindows.org/licence3.txt
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS | *
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express | * Software distributed under the License is distributed on an
* |written authorization from SciTech to possess or use this code, you | * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* |may be subject to civil and/or criminal penalties. | * implied. See the License for the specific language governing
* | | * rights and limitations under the License.
* |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++ * Language: ANSI C++
* Environment: Any * Environment: Any
@@ -66,6 +62,8 @@ public:
wxString& group, wxString& group,
wxString& href ); wxString& href );
VirtualData();
// Gets // Gets
wxString GetName(){ return m_name;}; wxString GetName(){ return m_name;};
wxString GetGroup(){ return m_group;}; wxString GetGroup(){ return m_group;};
@@ -88,15 +86,21 @@ private:
DECLARE_CLASS(wxHtmlAppletWindow); DECLARE_CLASS(wxHtmlAppletWindow);
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
bool m_mutexLock; bool m_mutexLock;
wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor wxIncludePrep *incPreprocessor; // deleted by list it is added too in constructor
protected: protected:
wxAppletList m_AppletList; wxAppletList m_AppletList;
static wxHashTable m_Cookies; static wxHashTable m_Cookies;
bool m_NavBarEnabled;
wxToolBarBase *m_NavBar; wxToolBarBase *m_NavBar;
int m_NavBackId; int m_NavBackId;
int m_NavForwardId; int m_NavForwardId;
wxString m_DocRoot; wxPalette m_globalPalette;
// Override this so we can do proper palette management!!
virtual void OnDraw(wxDC& dc);
public: public:
// Constructor // Constructor
wxHtmlAppletWindow( wxHtmlAppletWindow(
@@ -109,7 +113,7 @@ public:
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",
const wxString& docroot = "" ); const wxPalette& globalPalette = wxNullPalette);
// Destructor // Destructor
~wxHtmlAppletWindow(); ~wxHtmlAppletWindow();
@@ -142,6 +146,14 @@ public:
// Handles backwards navigation within the HTML stack // Handles backwards navigation within the HTML stack
bool HistoryBack(); 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 // Broadcast a message to all applets on the page
void SendMessage(wxEvent& msg); void SendMessage(wxEvent& msg);

View File

@@ -5,23 +5,19 @@
* Copyright (C) 1991-2001 SciTech Software, Inc. * Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved. * All rights reserved.
* *
* ====================================================================== * ========================================================================
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW| *
* | | * The contents of this file are subject to the wxWindows License
* |This copyrighted computer code is a proprietary trade secret of | * Version 3.0 (the "License"); you may not use this file except in
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 | * compliance with the License. You may obtain a copy of the License at
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, | * http://www.wxwindows.org/licence3.txt
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS | *
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express | * Software distributed under the License is distributed on an
* |written authorization from SciTech to possess or use this code, you | * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* |may be subject to civil and/or criminal penalties. | * implied. See the License for the specific language governing
* | | * rights and limitations under the License.
* |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++ * Language: ANSI C++
* Environment: Any * Environment: Any
@@ -88,24 +84,27 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
const wxSize& size, const wxSize& size,
long style, long style,
const wxString& name, const wxString& name,
const wxString& docroot ) const wxPalette& globalPalette)
: wxHtmlWindow(parent,id,pos,size,style,name) : wxHtmlWindow(parent,id,pos,size,style,name), m_globalPalette(globalPalette)
{ {
// Init our locks // Init our locks
UnLock(); UnLock();
// setup client navbars // setup client navbars
if (navBar) { if (navBar) {
m_NavBarEnabled = true;
m_NavBar = navBar; m_NavBar = navBar;
m_NavBackId = navBackId; m_NavBackId = navBackId;
m_NavForwardId = navForwardId; m_NavForwardId = navForwardId;
} }
else { else {
m_NavBarEnabled = false;
m_NavBar = NULL; m_NavBar = NULL;
} }
// Set up docroot m_NavBackId = navBackId;
m_DocRoot = docroot; m_NavForwardId = navForwardId;
// Set the key_type for applets // Set the key_type for applets
m_AppletList = wxAppletList(wxKEY_STRING); m_AppletList = wxAppletList(wxKEY_STRING);
@@ -114,7 +113,7 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
// deleting preprocessors is done by the code within the window // deleting preprocessors is done by the code within the window
incPreprocessor = new wxIncludePrep(); // #include preprocessor 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 wxEchoPrep * echoPreprocessor = new wxEchoPrep(); // #echo preprocessor
wxIfElsePrep * ifPreprocessor = new wxIfElsePrep(); 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: PARAMETERS:
className - Name of the applet class to create an object for className - Name of the applet class to create an object for
@@ -263,24 +283,11 @@ True if page loaded successfully, false if not
REMARKS: REMARKS:
Remove an applet from the manager. Called during applet destruction Remove an applet from the manager. Called during applet destruction
****************************************************************************/ ****************************************************************************/
#include "scitech"
bool wxHtmlAppletWindow::LoadPage( bool wxHtmlAppletWindow::LoadPage(
const wxString& link) const wxString& link)
{ {
wxString href(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) == '?'){ if (link.GetChar(0) == '?'){
wxString cmd = link.BeforeFirst('='); wxString cmd = link.BeforeFirst('=');
wxString cmdValue = link.AfterFirst('='); wxString cmdValue = link.AfterFirst('=');
@@ -329,11 +336,12 @@ bool wxHtmlAppletWindow::LoadPage(
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(wxHtmlLinkInfo(href)); (node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
Show(false); Show(false);
bool stat = wxHtmlWindow::LoadPage(href); bool stat = wxHtmlWindow::LoadPage(href);
Show(true); Show(true);
// Enable/Dis the navbar tools // Enable/Dis the navbar tools
if (m_NavBar) { if (m_NavBarEnabled) {
m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward()); m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward());
m_NavBar->EnableTool(m_NavBackId,HistoryCanBack()); m_NavBar->EnableTool(m_NavBackId,HistoryCanBack());
} }
@@ -388,6 +396,37 @@ bool wxHtmlAppletWindow::HistoryBack()
return wxHtmlWindow::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: PARAMETERS:
msg - wxEvent message to be sent to all wxApplets msg - wxEvent message to be sent to all wxApplets
@@ -570,6 +609,18 @@ VirtualData::VirtualData(
m_href = href; 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: PARAMETERS:
REMARKS: 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 // grab the value from the class, put it in tag since the data is no longer needed
tag = wxEchoVariable::FindValue(cname, parms.c_str()); tag = wxEchoVariable::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)); 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( int ReverseFind(
const wxString &tstr, const wxString &tstr,
const wxString &str) const wxString &str,
int start = -1)
{ {
wxASSERT( str.GetStringData()->IsValid() ); wxASSERT( str.GetStringData()->IsValid() );
// TODO could be made much quicker than that // TODO could be made much quicker than that
int p = tstr.Len()-str.Len()-1; 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 ) { while ( p >= 0 ) {
if ( wxStrncmp(tstr.c_str() + p, str.c_str(), str.Len()) == 0 ) if ( wxStrncmp(tstr.c_str() + p, str.c_str(), str.Len()) == 0 )
return p; return p;
@@ -64,6 +69,131 @@ int ReverseFind(
return -1; 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: PARAMETERS:
text - HTML to process for if/else blocks text - HTML to process for if/else blocks
@@ -72,7 +202,7 @@ RETURNS:
The string containing the processed HTML The string containing the processed HTML
REMARKS: 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 contained within the blocks, dependant on the value of the given boolean
variable. The variable is created by making a sub class of wxIfElseVariable. 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 Dynamic class construction is used at run time internally to create an instance
@@ -86,19 +216,81 @@ wxString wxIfElsePrep::Process(
{ {
int b; int b;
char ft[] = "<!--#if "; char ft[] = "<!--#if ";
char ftnot[] = "<!--#if NOT "; char ftend[] = "<!--#endif-->";
char ftelse[] = "<!--#else-->";
char ftnot[] = "<!--#if not ";
char ftnot2[] = "<!--#if !"; char ftnot2[] = "<!--#if !";
char ftelif[] = "<!--#elif ";
// make a copy so we can replace text as we go without affecting the original
// make a copy so we can replace text as we go without affecting the original
wxString output = text; 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) { while ((b = ReverseFind(output.Lower(), ft)) != -1) {
// Loop until every #if directive is found // Loop until every #if directive is found
// We search from the end of the string so that #if statements will properly recurse // 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--> // and we avoid the hassle of matching statements with the correct <!--#endif-->
bool notval = false; bool notval = false;
int off = 0; int off = 0;
int end, c, n; int end;
wxString usecode, code; wxString usecode, code;
wxString cname; wxString cname;
wxString tag; wxString tag;
@@ -106,15 +298,6 @@ wxString wxIfElsePrep::Process(
code = wxString(""); 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 // grab the tag and get the name of the variable
end = (output.Mid(b)).Find("-->"); end = (output.Mid(b)).Find("-->");
if (end == -1) { if (end == -1) {
@@ -125,30 +308,14 @@ wxString wxIfElsePrep::Process(
} }
end += 3; 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); output.Remove(b, end);
c = tag.Find("-->"); value = ParseIfStatementValue(tag);
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;
// Find the end of the tag (<!--#endif-->) and copy it all into the variable code // 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) { if (end == -1) {
#ifdef CHECKED #ifdef CHECKED
wxMessageBox("wxHTML #if error: Premature end of file while searching for matching #endif.","Error",wxICON_ERROR); 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); 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 // Find out if there is an else statement
end = (code.Lower()).Find("<!--#else-->"); end = (code.Lower()).Find(ftelse);
if (end != -1) { if (end != -1) {
if (!value) { if (!value) {
// Use the else statement // Use the else statement
usecode = code.Mid(end+12); usecode = code.Mid(end+strlen(ftelse));
} }
else { else {
// Use statement before #else // Use statement before #else

View File

@@ -59,8 +59,6 @@ wxString wxIncludePrep::Process(
int i; int i;
char ft[] = "<!--#include virtual="; char ft[] = "<!--#include virtual=";
wxFileSystem *fs = new wxFileSystem;
fs->ChangePathTo(DOC_ROOT, true);
int openedcount = 0; int openedcount = 0;
@@ -92,11 +90,12 @@ wxString wxIncludePrep::Process(
// remove the #include tag // remove the #include tag
output.Remove(i, n+21+3); output.Remove(i, n+21+3);
wxFSFile * file = fs->OpenFile(DOC_ROOT + fname); wxFSFile * file;
file = m_FS->OpenFile(fname);
if (!file) { if (!file) {
#ifdef CHECKED #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 #endif
delete file; delete file;
continue; continue;
@@ -125,7 +124,6 @@ wxString wxIncludePrep::Process(
delete file; delete file;
} }
delete fs;
return output; 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. value is the current directory. Directorys may be given as a relative path.
****************************************************************************/ ****************************************************************************/
void wxIncludePrep::ChangeDirectory( void wxIncludePrep::ChangeDirectory(
const wxString &dir) wxFileSystem *fs)
{ {
m_FS = fs;
DOC_ROOT = dir;
} }

View File

@@ -219,8 +219,8 @@
// suppress some Watcom C++ warnings // suppress some Watcom C++ warnings
#ifdef __WATCOMC__ #ifdef __WATCOMC__
# pragma warning 849 9 // Disable 'virtual function hidden' # pragma warning 849 9 // Disable 'virtual function hidden'
# pragma warning 549 9 // Disable 'operand contains compiler generated information' # pragma warning 549 9 // Disable 'operand contains compiler generated information'
#endif // __VISUALC__ #endif // __VISUALC__
// suppress some Salford C++ warnings // suppress some Salford C++ warnings
@@ -441,7 +441,24 @@ typedef int wxWindowID;
#elif defined(__WXPM__) #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 # ifdef WXMAKINGDLL
# define WXDLLEXPORT _Export # define WXDLLEXPORT _Export
@@ -1902,7 +1919,10 @@ typedef unsigned short WORD;
// WIN32 graphics types for OS/2 GPI // 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 // 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; typedef unsigned long COLORREF;
#define GetBValue(rgb) ((BYTE)((rgb) >> 16)) #define GetBValue(rgb) ((BYTE)((rgb) >> 16))
@@ -1931,7 +1951,7 @@ typedef struct tagLOGPALETTE
#elif defined(__WIN32__) #elif defined(__WIN32__)
typedef int (__stdcall *WXFARPROC)(); typedef int (__stdcall *WXFARPROC)();
#elif defined(__WXPM__) #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??? // 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*); typedef void* (_System *WXFARPROC)(unsigned long, unsigned long, void*, void*);
# else # else

View File

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

View File

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

View File

@@ -49,7 +49,7 @@ public:
// Set's the DC used for parsing. If SetDC() is not called, // Set's the DC used for parsing. If SetDC() is not called,
// parsing won't proceed // parsing won't proceed
virtual void SetDC(wxDC *dc, double pixel_scale = 1.0) virtual void SetDC(wxDC *dc, double pixel_scale = 1.0)
{ m_DC = dc; m_PixelScale = pixel_scale; } { m_DC = dc; m_PixelScale = pixel_scale; }
wxDC *GetDC() {return m_DC;} wxDC *GetDC() {return m_DC;}
@@ -61,13 +61,13 @@ public:
// height/width. They return h/w of default font // height/width. They return h/w of default font
// for this DC. If you want actual values, call // for this DC. If you want actual values, call
// GetDC()->GetChar...() // GetDC()->GetChar...()
// returns associated wxWindow // returns associated wxWindow
wxWindow *GetWindow() {return m_Window;} wxWindow *GetWindow() {return m_Window;}
// sets fonts to be used when displaying HTML page. // sets fonts to be used when displaying HTML page.
void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes); void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes);
// Adds tags module. see wxHtmlTagsModule for details. // Adds tags module. see wxHtmlTagsModule for details.
static void AddModule(wxHtmlTagsModule *module); static void AddModule(wxHtmlTagsModule *module);
@@ -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 // make conversion from wxColour and COLORREF a bit less painful
inline COLORREF wxColourToRGB(const wxColour& c) 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) inline void wxRGBToColour(wxColour& c, COLORREF rgb)

View File

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

View File

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

View File

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

View File

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

View File

@@ -53,7 +53,9 @@ public:
virtual void Iconize(bool bIconize = TRUE); virtual void Iconize(bool bIconize = TRUE);
virtual bool IsIconized(void) const; virtual bool IsIconized(void) const;
virtual void Restore(void); virtual void Restore(void);
#if wxUSE_MENUS_NATIVE
virtual void SetMenuBar(wxMenuBar* pMenubar); virtual void SetMenuBar(wxMenuBar* pMenubar);
#endif
virtual void SetIcon(const wxIcon& rIcon); virtual void SetIcon(const wxIcon& rIcon);
virtual bool ShowFullScreen( bool bShow virtual bool ShowFullScreen( bool bShow
,long lStyle = wxFULLSCREEN_ALL ,long lStyle = wxFULLSCREEN_ALL
@@ -175,10 +177,9 @@ protected:
,int nWeight ,int nWeight
); );
#if wxUSE_MENUS_NATIVE
// helper // helper
void DetachMenuBar(void); void DetachMenuBar(void);
#if wxUSE_MENUS_NATIVE
// perform MSW-specific action when menubar is changed // perform MSW-specific action when menubar is changed
virtual void AttachMenuBar(wxMenuBar* pMenubar); virtual void AttachMenuBar(wxMenuBar* pMenubar);
// a plug in for MDI frame classes which need to do something special when // 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; class WXDLLEXPORT wxWindow;
// array of notebook pages // array of notebook pages
typedef wxWindow WXDLLEXPORT wxNotebookPage; // so far, any window can be a page
WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayNBPages); WX_DEFINE_ARRAY(wxNotebookPage *, wxArrayNBPages);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@@ -15,7 +15,7 @@
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// undef everything // undef everything
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __WXMAC__ #if defined(__WXMAC__)
#define wxUSE_GUI 1 #define wxUSE_GUI 1
#define WXWIN_COMPATIBILITY 0 #define WXWIN_COMPATIBILITY 0
@@ -63,7 +63,7 @@
#define wxUSE_FFILE 1 #define wxUSE_FFILE 1
#define wxUSE_TEXTFILE 0 #define wxUSE_TEXTFILE 0
#define wxUSE_INTL 0 #define wxUSE_INTL 0
#define wxUSE_MENUS 0 // was 1 #define wxUSE_MENUS 0 // was 1
#define wxUSE_TOOLBAR 0 #define wxUSE_TOOLBAR 0
#define wxUSE_TOOLBAR_NATIVE 0 #define wxUSE_TOOLBAR_NATIVE 0
#define wxUSE_TOOLBAR_SIMPLE 0 #define wxUSE_TOOLBAR_SIMPLE 0
@@ -173,6 +173,162 @@
#define wxUSE_DYNAMIC_CLASSES 1 #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 #else
#define wxUSE_GUI 1 #define wxUSE_GUI 1

View File

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

View File

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

View File

@@ -1,3 +1,4 @@
#include "wx/defs.h"
#include "wx/setup.h" #include "wx/setup.h"
#include <math.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) // OS/2 supports that have them (HPFS, FAT32) and security (HPFS386)
static const wxChar *szMktempSuffix = wxT("XXX"); static const wxChar *szMktempSuffix = wxT("XXX");
m_strTemp << strName << szMktempSuffix; m_strTemp << strName << szMktempSuffix;
// Temporarily remove - MN
#ifndef __WATCOMC__
::DosCreateDir(m_strTemp.GetWriteBuf(MAX_PATH), NULL); ::DosCreateDir(m_strTemp.GetWriteBuf(MAX_PATH), NULL);
#endif
#else // Windows #else // Windows
wxString strPath; wxString strPath;
wxSplitPath(strName, &strPath, NULL, NULL); wxSplitPath(strName, &strPath, NULL, NULL);

View File

@@ -299,7 +299,7 @@ wxIsAbsolutePath (const wxString& filename)
// This seems wrong to me, but there is no fix. since // This seems wrong to me, but there is no fix. since
// "MacOS:MyText.txt" is absolute whereas "MyDir:MyText.txt" // "MacOS:MyText.txt" is absolute whereas "MyDir:MyText.txt"
// is not. Or maybe ":MyDir:MyText.txt" has to be used? RR. // is not. Or maybe ":MyDir:MyText.txt" has to be used? RR.
if (filename.Find(':') != wxNOT_FOUND && filename[0] != ':') if (filename.Find(':') != wxNOT_FOUND && filename[0] != ':')
return TRUE ; return TRUE ;
} }
@@ -1019,6 +1019,11 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite)
// //
// NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite // NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite
return ::CopyFile(file1, file2, !overwrite) != 0; 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 #else // !Win32
wxStructStat fbuf; wxStructStat fbuf;
@@ -1145,7 +1150,7 @@ bool wxMkdir(const wxString& dir, int perm)
#elif defined(__WXPM__) #elif defined(__WXPM__)
if (::DosCreateDir((PSZ)dirname, NULL) != 0) // enhance for EAB's?? if (::DosCreateDir((PSZ)dirname, NULL) != 0) // enhance for EAB's??
#else // !MSW and !OS/2 VAC++ #else // !MSW and !OS/2 VAC++
(void)perm; (void)perm;
if ( wxMkDir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 ) if ( wxMkDir(wxFNSTRINGCAST wxFNCONV(dirname)) != 0 )
#endif // !MSW/MSW #endif // !MSW/MSW
{ {
@@ -1726,41 +1731,41 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
#ifdef _MSC_VER #ifdef _MSC_VER
if (_getcwd(buf, sz) == NULL) { if (_getcwd(buf, sz) == NULL) {
#elif defined(__WXMAC__) && !defined(__UNIX__) #elif defined(__WXMAC__) && !defined(__UNIX__)
FSSpec cwdSpec ; FSSpec cwdSpec ;
FCBPBRec pb; FCBPBRec pb;
OSErr error; OSErr error;
Str255 fileName ; Str255 fileName ;
pb.ioNamePtr = (StringPtr) &fileName; pb.ioNamePtr = (StringPtr) &fileName;
pb.ioVRefNum = 0; pb.ioVRefNum = 0;
pb.ioRefNum = LMGetCurApRefNum(); pb.ioRefNum = LMGetCurApRefNum();
pb.ioFCBIndx = 0; pb.ioFCBIndx = 0;
error = PBGetFCBInfoSync(&pb); error = PBGetFCBInfoSync(&pb);
if ( error == noErr ) if ( error == noErr )
{ {
cwdSpec.vRefNum = pb.ioFCBVRefNum; cwdSpec.vRefNum = pb.ioFCBVRefNum;
cwdSpec.parID = pb.ioFCBParID; cwdSpec.parID = pb.ioFCBParID;
cwdSpec.name[0] = 0 ; cwdSpec.name[0] = 0 ;
wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ; wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ;
strcpy( buf , res ) ; strcpy( buf , res ) ;
buf[res.length()-1]=0 ; buf[res.length()-1]=0 ;
} }
else else
buf[0] = 0 ; buf[0] = 0 ;
/* /*
this version will not always give back the application directory on mac this version will not always give back the application directory on mac
enum enum
{ {
SFSaveDisk = 0x214, CurDirStore = 0x398 SFSaveDisk = 0x214, CurDirStore = 0x398
}; };
FSSpec cwdSpec ; FSSpec cwdSpec ;
FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ; FSMakeFSSpec( - *(short *) SFSaveDisk , *(long *) CurDirStore , NULL , &cwdSpec ) ;
wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ; wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
strcpy( buf , res ) ; strcpy( buf , res ) ;
*/ */
if (0) { if (0) {
#elif(__VISAGECPP__) #elif defined(__VISAGECPP__) || (defined (__OS2__) && defined (__WATCOMC__))
APIRET rc; APIRET rc;
rc = ::DosQueryCurrentDir( 0 // current drive rc = ::DosQueryCurrentDir( 0 // current drive
,buf ,buf

View File

@@ -37,6 +37,12 @@ extern "C"
#include "wx/intl.h" #include "wx/intl.h"
#include "wx/module.h" #include "wx/module.h"
#ifdef __WATCOMC__
#ifdef LINKAGEMODE
#undef LINKAGEMODE
#define LINKAGEMODE __cdecl
#endif
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxTIFFHandler // wxTIFFHandler
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -45,8 +51,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler)
static tsize_t LINKAGEMODE static tsize_t LINKAGEMODE
_tiffNullProc(thandle_t WXUNUSED(handle), _tiffNullProc(thandle_t WXUNUSED(handle),
tdata_t WXUNUSED(buf), tdata_t WXUNUSED(buf),
tsize_t WXUNUSED(size)) tsize_t WXUNUSED(size))
{ {
return (tsize_t) -1; return (tsize_t) -1;
} }
@@ -329,13 +335,13 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
unsigned char *ptr = image->GetData(); unsigned char *ptr = image->GetData();
for (int row = 0; row < image->GetHeight(); row++) for (int row = 0; row < image->GetHeight(); row++)
{ {
if (buf) if (buf)
memcpy(buf, ptr, image->GetWidth()); memcpy(buf, ptr, image->GetWidth());
if (TIFFWriteScanline(tif, buf ? buf : ptr, (uint32)row, 0) < 0) if (TIFFWriteScanline(tif, buf ? buf : ptr, (uint32)row, 0) < 0)
{ {
if (verbose) if (verbose)
wxLogError( _("TIFF: Error writing image.") ); wxLogError( _("TIFF: Error writing image.") );
TIFFClose( tif ); TIFFClose( tif );
if (buf) if (buf)

View File

@@ -6,7 +6,7 @@
// Created: 22/6/2000 // Created: 22/6/2000
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Thomas G. Lane, Vaclav Slavik, Julian Smart // Copyright: (c) Thomas G. Lane, Vaclav Slavik, Julian Smart
// Licence: wxWindows licence + JPEG library licence // Licence: wxWindows licence + JPEG library licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/* /*
@@ -54,7 +54,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#if defined(__VISAGECPP__) #if defined(__OS2__)
#define RGB_RED_OS2 0 #define RGB_RED_OS2 0
#define RGB_GREEN_OS2 1 #define RGB_GREEN_OS2 1
#define RGB_BLUE_OS2 2 #define RGB_BLUE_OS2 2
@@ -90,7 +90,23 @@ typedef struct {
JSAMPLE *sample_range_limit, *srl_orig; JSAMPLE *sample_range_limit, *srl_orig;
} j_decompress; } 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; 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));
};
/* /*
@@ -139,9 +155,9 @@ typedef j_decompress *j_decompress_ptr;
* probably need to change these scale factors. * probably need to change these scale factors.
*/ */
#define R_SCALE 2 /* scale R distances by this much */ #define R_SCALE 2 /* scale R distances by this much */
#define G_SCALE 3 /* scale G distances by this much */ #define G_SCALE 3 /* scale G distances by this much */
#define B_SCALE 1 /* and B by this much */ #define B_SCALE 1 /* and B by this much */
/* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined /* Relabel R/G/B as components 0/1/2, respecting the RGB ordering defined
* in jmorecfg.h. As the code stands, it will do the right thing for R,G,B * in jmorecfg.h. As the code stands, it will do the right thing for R,G,B
@@ -150,7 +166,7 @@ typedef j_decompress *j_decompress_ptr;
* you'll probably want to tweak the histogram sizes too. * you'll probably want to tweak the histogram sizes too.
*/ */
#if defined(__VISAGECPP__) #if defined(__OS2__)
#if RGB_RED_OS2 == 0 #if RGB_RED_OS2 == 0
#define C0_SCALE R_SCALE #define C0_SCALE R_SCALE
@@ -219,9 +235,9 @@ typedef j_decompress *j_decompress_ptr;
/* These will do the right thing for either R,G,B or B,G,R color order, /* These will do the right thing for either R,G,B or B,G,R color order,
* but you may not like the results for other color orders. * but you may not like the results for other color orders.
*/ */
#define HIST_C0_BITS 5 /* bits of precision in R/B histogram */ #define HIST_C0_BITS 5 /* bits of precision in R/B histogram */
#define HIST_C1_BITS 6 /* bits of precision in G histogram */ #define HIST_C1_BITS 6 /* bits of precision in G histogram */
#define HIST_C2_BITS 5 /* bits of precision in B/R histogram */ #define HIST_C2_BITS 5 /* bits of precision in B/R histogram */
/* Number of elements along histogram axes. */ /* Number of elements along histogram axes. */
#define HIST_C0_ELEMS (1<<HIST_C0_BITS) #define HIST_C0_ELEMS (1<<HIST_C0_BITS)
@@ -234,13 +250,13 @@ typedef j_decompress *j_decompress_ptr;
#define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS) #define C2_SHIFT (BITS_IN_JSAMPLE-HIST_C2_BITS)
typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */ typedef UINT16 histcell; /* histogram cell; prefer an unsigned type */
typedef histcell * histptr; /* for pointers to histogram cells */ typedef histcell * histptr; /* for pointers to histogram cells */
typedef histcell hist1d[HIST_C2_ELEMS]; /* typedefs for the array */ typedef histcell hist1d[HIST_C2_ELEMS]; /* typedefs for the array */
typedef hist1d * hist2d; /* type for the 2nd-level pointers */ typedef hist1d * hist2d; /* type for the 2nd-level pointers */
typedef hist2d * hist3d; /* type for top-level pointer */ typedef hist2d * hist3d; /* type for top-level pointer */
/* Declarations for Floyd-Steinberg dithering. /* Declarations for Floyd-Steinberg dithering.
@@ -248,8 +264,8 @@ typedef hist2d * hist3d; /* type for top-level pointer */
* Errors are accumulated into the array fserrors[], at a resolution of * Errors are accumulated into the array fserrors[], at a resolution of
* 1/16th of a pixel count. The error at a given pixel is propagated * 1/16th of a pixel count. The error at a given pixel is propagated
* to its not-yet-processed neighbors using the standard F-S fractions, * to its not-yet-processed neighbors using the standard F-S fractions,
* ... (here) 7/16 * ... (here) 7/16
* 3/16 5/16 1/16 * 3/16 5/16 1/16
* We work left-to-right on even rows, right-to-left on odd rows. * We work left-to-right on even rows, right-to-left on odd rows.
* *
* We can get away with a single array (holding one row's worth of errors) * We can get away with a single array (holding one row's worth of errors)
@@ -268,14 +284,14 @@ typedef hist2d * hist3d; /* type for top-level pointer */
*/ */
#if BITS_IN_JSAMPLE == 8 #if BITS_IN_JSAMPLE == 8
typedef INT16 FSERROR; /* 16 bits should be enough */ typedef INT16 FSERROR; /* 16 bits should be enough */
typedef int LOCFSERROR; /* use 'int' for calculation temps */ typedef int LOCFSERROR; /* use 'int' for calculation temps */
#else #else
typedef INT32 FSERROR; /* may need more than 16 bits */ typedef INT32 FSERROR; /* may need more than 16 bits */
typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */ typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */
#endif #endif
typedef FSERROR *FSERRPTR; /* pointer to error array (in storage!) */ typedef FSERROR *FSERRPTR; /* pointer to error array (in storage!) */
/* Private subobject */ /* Private subobject */
@@ -290,18 +306,18 @@ typedef struct {
} pub; } pub;
/* Space for the eventually created colormap is stashed here */ /* Space for the eventually created colormap is stashed here */
JSAMPARRAY sv_colormap; /* colormap allocated at init time */ JSAMPARRAY sv_colormap; /* colormap allocated at init time */
int desired; /* desired # of colors = size of colormap */ int desired; /* desired # of colors = size of colormap */
/* Variables for accumulating image statistics */ /* Variables for accumulating image statistics */
hist3d histogram; /* pointer to the histogram */ hist3d histogram; /* pointer to the histogram */
bool needs_zeroed; /* true if next pass must zero histogram */ bool needs_zeroed; /* true if next pass must zero histogram */
/* Variables for Floyd-Steinberg dithering */ /* Variables for Floyd-Steinberg dithering */
FSERRPTR fserrors; /* accumulated errors */ FSERRPTR fserrors; /* accumulated errors */
bool on_odd_row; /* flag to remember which row we are on */ bool on_odd_row; /* flag to remember which row we are on */
int * error_limiter; /* table for clamping the applied error */ int * error_limiter; /* table for clamping the applied error */
} my_cquantizer; } my_cquantizer;
typedef my_cquantizer * my_cquantize_ptr; typedef my_cquantizer * my_cquantize_ptr;
@@ -318,7 +334,7 @@ typedef my_cquantizer * my_cquantize_ptr;
void void
prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
JSAMPARRAY output_buf, int num_rows) JSAMPARRAY output_buf, int num_rows)
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
register JSAMPROW ptr; register JSAMPROW ptr;
@@ -336,8 +352,8 @@ prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
/* get pixel value and index into the histogram */ /* get pixel value and index into the histogram */
histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT] histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT]
[GETJSAMPLE(ptr[1]) >> C1_SHIFT] [GETJSAMPLE(ptr[1]) >> C1_SHIFT]
[GETJSAMPLE(ptr[2]) >> C2_SHIFT]; [GETJSAMPLE(ptr[2]) >> C2_SHIFT];
/* increment, check for overflow and undo increment if so. */ /* increment, check for overflow and undo increment if so. */
if (++(*histp) <= 0) if (++(*histp) <= 0)
(*histp)--; (*histp)--;
@@ -429,67 +445,67 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
if (c0max > c0min) if (c0max > c0min)
for (c0 = c0min; c0 <= c0max; c0++) for (c0 = c0min; c0 <= c0max; c0++)
for (c1 = c1min; c1 <= c1max; c1++) { for (c1 = c1min; c1 <= c1max; c1++) {
histp = & histogram[c0][c1][c2min]; histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++) for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) { if (*histp++ != 0) {
boxp->c0min = c0min = c0; boxp->c0min = c0min = c0;
goto have_c0min; goto have_c0min;
} }
} }
have_c0min: have_c0min:
if (c0max > c0min) if (c0max > c0min)
for (c0 = c0max; c0 >= c0min; c0--) for (c0 = c0max; c0 >= c0min; c0--)
for (c1 = c1min; c1 <= c1max; c1++) { for (c1 = c1min; c1 <= c1max; c1++) {
histp = & histogram[c0][c1][c2min]; histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++) for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) { if (*histp++ != 0) {
boxp->c0max = c0max = c0; boxp->c0max = c0max = c0;
goto have_c0max; goto have_c0max;
} }
} }
have_c0max: have_c0max:
if (c1max > c1min) if (c1max > c1min)
for (c1 = c1min; c1 <= c1max; c1++) for (c1 = c1min; c1 <= c1max; c1++)
for (c0 = c0min; c0 <= c0max; c0++) { for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1][c2min]; histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++) for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) { if (*histp++ != 0) {
boxp->c1min = c1min = c1; boxp->c1min = c1min = c1;
goto have_c1min; goto have_c1min;
} }
} }
have_c1min: have_c1min:
if (c1max > c1min) if (c1max > c1min)
for (c1 = c1max; c1 >= c1min; c1--) for (c1 = c1max; c1 >= c1min; c1--)
for (c0 = c0min; c0 <= c0max; c0++) { for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1][c2min]; histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++) for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) { if (*histp++ != 0) {
boxp->c1max = c1max = c1; boxp->c1max = c1max = c1;
goto have_c1max; goto have_c1max;
} }
} }
have_c1max: have_c1max:
if (c2max > c2min) if (c2max > c2min)
for (c2 = c2min; c2 <= c2max; c2++) for (c2 = c2min; c2 <= c2max; c2++)
for (c0 = c0min; c0 <= c0max; c0++) { for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1min][c2]; histp = & histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) { if (*histp != 0) {
boxp->c2min = c2min = c2; boxp->c2min = c2min = c2;
goto have_c2min; goto have_c2min;
} }
} }
have_c2min: have_c2min:
if (c2max > c2min) if (c2max > c2min)
for (c2 = c2max; c2 >= c2min; c2--) for (c2 = c2max; c2 >= c2min; c2--)
for (c0 = c0min; c0 <= c0max; c0++) { for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1min][c2]; histp = & histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS) for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) { if (*histp != 0) {
boxp->c2max = c2max = c2; boxp->c2max = c2max = c2;
goto have_c2max; goto have_c2max;
} }
} }
have_c2max: have_c2max:
@@ -512,9 +528,9 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
for (c1 = c1min; c1 <= c1max; c1++) { for (c1 = c1min; c1 <= c1max; c1++) {
histp = & histogram[c0][c1][c2min]; histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++, histp++) for (c2 = c2min; c2 <= c2max; c2++, histp++)
if (*histp != 0) { if (*histp != 0) {
ccount++; ccount++;
} }
} }
boxp->colorcount = ccount; boxp->colorcount = ccount;
} }
@@ -522,7 +538,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
int int
median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes, median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
int desired_colors) int desired_colors)
/* Repeatedly select and split the largest box until we have enough boxes */ /* Repeatedly select and split the largest box until we have enough boxes */
{ {
int n,lb; int n,lb;
@@ -538,9 +554,9 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
} else { } else {
b1 = find_biggest_volume(boxlist, numboxes); b1 = find_biggest_volume(boxlist, numboxes);
} }
if (b1 == NULL) /* no splittable boxes left! */ if (b1 == NULL) /* no splittable boxes left! */
break; break;
b2 = &boxlist[numboxes]; /* where new box will go */ b2 = &boxlist[numboxes]; /* where new box will go */
/* Copy the color bounds to the new box. */ /* Copy the color bounds to the new box. */
b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max; b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max;
b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min; b2->c0min = b1->c0min; b2->c1min = b1->c1min; b2->c2min = b1->c2min;
@@ -636,12 +652,12 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor)
for (c1 = c1min; c1 <= c1max; c1++) { for (c1 = c1min; c1 <= c1max; c1++) {
histp = & histogram[c0][c1][c2min]; histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++) { for (c2 = c2min; c2 <= c2max; c2++) {
if ((count = *histp++) != 0) { if ((count = *histp++) != 0) {
total += count; total += count;
c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count; c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count;
c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count; c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count;
c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count; c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count;
} }
} }
} }
@@ -760,7 +776,7 @@ select_colors (j_decompress_ptr cinfo, int desired_colors)
static int static int
find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
JSAMPLE colorlist[]) JSAMPLE colorlist[])
/* Locate the colormap entries close enough to an update box to be candidates /* Locate the colormap entries close enough to an update box to be candidates
* for the nearest entry to some cell(s) in the update box. The update box * for the nearest entry to some cell(s) in the update box. The update box
* is specified by the center coordinates of its first cell. The number of * is specified by the center coordinates of its first cell. The number of
@@ -775,7 +791,7 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
int centerc0, centerc1, centerc2; int centerc0, centerc1, centerc2;
int i, x, ncolors; int i, x, ncolors;
INT32 minmaxdist, min_dist, max_dist, tdist; INT32 minmaxdist, min_dist, max_dist, tdist;
INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */ INT32 mindist[MAXNUMCOLORS]; /* min distance to colormap entry i */
/* Compute true coordinates of update box's upper corner and center. /* Compute true coordinates of update box's upper corner and center.
* Actually we compute the coordinates of the center of the upper-corner * Actually we compute the coordinates of the center of the upper-corner
@@ -817,11 +833,11 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
/* within cell range so no contribution to min_dist */ /* within cell range so no contribution to min_dist */
min_dist = 0; min_dist = 0;
if (x <= centerc0) { if (x <= centerc0) {
tdist = (x - maxc0) * C0_SCALE; tdist = (x - maxc0) * C0_SCALE;
max_dist = tdist*tdist; max_dist = tdist*tdist;
} else { } else {
tdist = (x - minc0) * C0_SCALE; tdist = (x - minc0) * C0_SCALE;
max_dist = tdist*tdist; max_dist = tdist*tdist;
} }
} }
@@ -839,11 +855,11 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
} else { } else {
/* within cell range so no contribution to min_dist */ /* within cell range so no contribution to min_dist */
if (x <= centerc1) { if (x <= centerc1) {
tdist = (x - maxc1) * C1_SCALE; tdist = (x - maxc1) * C1_SCALE;
max_dist += tdist*tdist; max_dist += tdist*tdist;
} else { } else {
tdist = (x - minc1) * C1_SCALE; tdist = (x - minc1) * C1_SCALE;
max_dist += tdist*tdist; max_dist += tdist*tdist;
} }
} }
@@ -861,15 +877,15 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
} else { } else {
/* within cell range so no contribution to min_dist */ /* within cell range so no contribution to min_dist */
if (x <= centerc2) { if (x <= centerc2) {
tdist = (x - maxc2) * C2_SCALE; tdist = (x - maxc2) * C2_SCALE;
max_dist += tdist*tdist; max_dist += tdist*tdist;
} else { } else {
tdist = (x - minc2) * C2_SCALE; tdist = (x - minc2) * C2_SCALE;
max_dist += tdist*tdist; max_dist += tdist*tdist;
} }
} }
mindist[i] = min_dist; /* save away the results */ mindist[i] = min_dist; /* save away the results */
if (max_dist < minmaxdist) if (max_dist < minmaxdist)
minmaxdist = max_dist; minmaxdist = max_dist;
} }
@@ -889,7 +905,7 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
static void static void
find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2, find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[]) int numcolors, JSAMPLE colorlist[], JSAMPLE bestcolor[])
/* Find the closest colormap entry for each cell in the update box, /* Find the closest colormap entry for each cell in the update box,
* given the list of candidate colors prepared by find_nearby_colors. * given the list of candidate colors prepared by find_nearby_colors.
* Return the indexes of the closest entries in the bestcolor[] array. * Return the indexes of the closest entries in the bestcolor[] array.
@@ -899,13 +915,13 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
{ {
int ic0, ic1, ic2; int ic0, ic1, ic2;
int i, icolor; int i, icolor;
register INT32 * bptr; /* pointer into bestdist[] array */ register INT32 * bptr; /* pointer into bestdist[] array */
JSAMPLE * cptr; /* pointer into bestcolor[] array */ JSAMPLE * cptr; /* pointer into bestcolor[] array */
INT32 dist0, dist1; /* initial distance values */ INT32 dist0, dist1; /* initial distance values */
register INT32 dist2; /* current distance in inner loop */ register INT32 dist2; /* current distance in inner loop */
INT32 xx0, xx1; /* distance increments */ INT32 xx0, xx1; /* distance increments */
register INT32 xx2; register INT32 xx2;
INT32 inc0, inc1, inc2; /* initial values for increments */ INT32 inc0, inc1, inc2; /* initial values for increments */
/* This array holds the distance to the nearest-so-far color for each cell */ /* This array holds the distance to the nearest-so-far color for each cell */
INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; INT32 bestdist[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
@@ -945,20 +961,20 @@ find_best_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
dist1 = dist0; dist1 = dist0;
xx1 = inc1; xx1 = inc1;
for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) { for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) {
dist2 = dist1; dist2 = dist1;
xx2 = inc2; xx2 = inc2;
for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) { for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) {
if (dist2 < *bptr) { if (dist2 < *bptr) {
*bptr = dist2; *bptr = dist2;
*cptr = (JSAMPLE) icolor; *cptr = (JSAMPLE) icolor;
} }
dist2 += xx2; dist2 += xx2;
xx2 += 2 * STEP_C2 * STEP_C2; xx2 += 2 * STEP_C2 * STEP_C2;
bptr++; bptr++;
cptr++; cptr++;
} }
dist1 += xx1; dist1 += xx1;
xx1 += 2 * STEP_C1 * STEP_C1; xx1 += 2 * STEP_C1 * STEP_C1;
} }
dist0 += xx0; dist0 += xx0;
xx0 += 2 * STEP_C0 * STEP_C0; xx0 += 2 * STEP_C0 * STEP_C0;
@@ -975,13 +991,13 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
hist3d histogram = cquantize->histogram; hist3d histogram = cquantize->histogram;
int minc0, minc1, minc2; /* lower left corner of update box */ int minc0, minc1, minc2; /* lower left corner of update box */
int ic0, ic1, ic2; int ic0, ic1, ic2;
register JSAMPLE * cptr; /* pointer into bestcolor[] array */ register JSAMPLE * cptr; /* pointer into bestcolor[] array */
register histptr cachep; /* pointer into main cache array */ register histptr cachep; /* pointer into main cache array */
/* This array lists the candidate colormap indexes. */ /* This array lists the candidate colormap indexes. */
JSAMPLE colorlist[MAXNUMCOLORS]; JSAMPLE colorlist[MAXNUMCOLORS];
int numcolors; /* number of candidate colors */ int numcolors; /* number of candidate colors */
/* This array holds the actually closest colormap index for each cell. */ /* This array holds the actually closest colormap index for each cell. */
JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS]; JSAMPLE bestcolor[BOX_C0_ELEMS * BOX_C1_ELEMS * BOX_C2_ELEMS];
@@ -1005,10 +1021,10 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
/* Determine the actually nearest colors. */ /* Determine the actually nearest colors. */
find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist, find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist,
bestcolor); bestcolor);
/* Save the best color numbers (plus 1) in the main cache array */ /* Save the best color numbers (plus 1) in the main cache array */
c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */ c0 <<= BOX_C0_LOG; /* convert ID back to base cell indexes */
c1 <<= BOX_C1_LOG; c1 <<= BOX_C1_LOG;
c2 <<= BOX_C2_LOG; c2 <<= BOX_C2_LOG;
cptr = bestcolor; cptr = bestcolor;
@@ -1016,7 +1032,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) { for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
cachep = & histogram[c0+ic0][c1+ic1][c2]; cachep = & histogram[c0+ic0][c1+ic1][c2];
for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) { for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
*cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1); *cachep++ = (histcell) (GETJSAMPLE(*cptr++) + 1);
} }
} }
} }
@@ -1029,7 +1045,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2)
void void
pass2_no_dither (j_decompress_ptr cinfo, pass2_no_dither (j_decompress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
/* This version performs no dithering */ /* This version performs no dithering */
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
@@ -1053,7 +1069,7 @@ pass2_no_dither (j_decompress_ptr cinfo,
/* If we have not seen this color before, find nearest colormap entry */ /* If we have not seen this color before, find nearest colormap entry */
/* and update the cache */ /* and update the cache */
if (*cachep == 0) if (*cachep == 0)
fill_inverse_cmap(cinfo, c0,c1,c2); fill_inverse_cmap(cinfo, c0,c1,c2);
/* Now emit the colormap index for this cell */ /* Now emit the colormap index for this cell */
*outptr++ = (JSAMPLE) (*cachep - 1); *outptr++ = (JSAMPLE) (*cachep - 1);
} }
@@ -1063,20 +1079,20 @@ pass2_no_dither (j_decompress_ptr cinfo,
void void
pass2_fs_dither (j_decompress_ptr cinfo, pass2_fs_dither (j_decompress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)
/* This version performs Floyd-Steinberg dithering */ /* This version performs Floyd-Steinberg dithering */
{ {
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
hist3d histogram = cquantize->histogram; hist3d histogram = cquantize->histogram;
register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */
LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */
LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */ LOCFSERROR bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */
register FSERRPTR errorptr; /* => fserrors[] at column before current */ register FSERRPTR errorptr; /* => fserrors[] at column before current */
JSAMPROW inptr; /* => current input pixel */ JSAMPROW inptr; /* => current input pixel */
JSAMPROW outptr; /* => current output pixel */ JSAMPROW outptr; /* => current output pixel */
histptr cachep; histptr cachep;
int dir; /* +1 or -1 depending on direction */ int dir; /* +1 or -1 depending on direction */
int dir3; /* 3*dir, for advancing inptr & errorptr */ int dir3; /* 3*dir, for advancing inptr & errorptr */
int row; int row;
JDIMENSION col; JDIMENSION col;
JDIMENSION width = cinfo->output_width; JDIMENSION width = cinfo->output_width;
@@ -1092,7 +1108,7 @@ pass2_fs_dither (j_decompress_ptr cinfo,
outptr = output_buf[row]; outptr = output_buf[row];
if (cquantize->on_odd_row) { if (cquantize->on_odd_row) {
/* work right to left in this row */ /* work right to left in this row */
inptr += (width-1) * 3; /* so point to rightmost pixel */ inptr += (width-1) * 3; /* so point to rightmost pixel */
outptr += width-1; outptr += width-1;
dir = -1; dir = -1;
dir3 = -3; dir3 = -3;
@@ -1144,14 +1160,14 @@ pass2_fs_dither (j_decompress_ptr cinfo,
/* If we have not seen this color before, find nearest colormap */ /* If we have not seen this color before, find nearest colormap */
/* entry and update the cache */ /* entry and update the cache */
if (*cachep == 0) if (*cachep == 0)
fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT); fill_inverse_cmap(cinfo, cur0>>C0_SHIFT,cur1>>C1_SHIFT,cur2>>C2_SHIFT);
/* Now emit the colormap index for this cell */ /* Now emit the colormap index for this cell */
{ register int pixcode = *cachep - 1; { register int pixcode = *cachep - 1;
*outptr = (JSAMPLE) pixcode; *outptr = (JSAMPLE) pixcode;
/* Compute representation error for this pixel */ /* Compute representation error for this pixel */
cur0 -= GETJSAMPLE(colormap0[pixcode]); cur0 -= GETJSAMPLE(colormap0[pixcode]);
cur1 -= GETJSAMPLE(colormap1[pixcode]); cur1 -= GETJSAMPLE(colormap1[pixcode]);
cur2 -= GETJSAMPLE(colormap2[pixcode]); cur2 -= GETJSAMPLE(colormap2[pixcode]);
} }
/* Compute error fractions to be propagated to adjacent pixels. /* Compute error fractions to be propagated to adjacent pixels.
* Add these into the running sums, and simultaneously shift the * Add these into the running sums, and simultaneously shift the
@@ -1159,38 +1175,38 @@ pass2_fs_dither (j_decompress_ptr cinfo,
*/ */
{ register LOCFSERROR bnexterr, delta; { register LOCFSERROR bnexterr, delta;
bnexterr = cur0; /* Process component 0 */ bnexterr = cur0; /* Process component 0 */
delta = cur0 * 2; delta = cur0 * 2;
cur0 += delta; /* form error * 3 */ cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0); errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */ cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0; bpreverr0 = belowerr0 + cur0;
belowerr0 = bnexterr; belowerr0 = bnexterr;
cur0 += delta; /* form error * 7 */ cur0 += delta; /* form error * 7 */
bnexterr = cur1; /* Process component 1 */ bnexterr = cur1; /* Process component 1 */
delta = cur1 * 2; delta = cur1 * 2;
cur1 += delta; /* form error * 3 */ cur1 += delta; /* form error * 3 */
errorptr[1] = (FSERROR) (bpreverr1 + cur1); errorptr[1] = (FSERROR) (bpreverr1 + cur1);
cur1 += delta; /* form error * 5 */ cur1 += delta; /* form error * 5 */
bpreverr1 = belowerr1 + cur1; bpreverr1 = belowerr1 + cur1;
belowerr1 = bnexterr; belowerr1 = bnexterr;
cur1 += delta; /* form error * 7 */ cur1 += delta; /* form error * 7 */
bnexterr = cur2; /* Process component 2 */ bnexterr = cur2; /* Process component 2 */
delta = cur2 * 2; delta = cur2 * 2;
cur2 += delta; /* form error * 3 */ cur2 += delta; /* form error * 3 */
errorptr[2] = (FSERROR) (bpreverr2 + cur2); errorptr[2] = (FSERROR) (bpreverr2 + cur2);
cur2 += delta; /* form error * 5 */ cur2 += delta; /* form error * 5 */
bpreverr2 = belowerr2 + cur2; bpreverr2 = belowerr2 + cur2;
belowerr2 = bnexterr; belowerr2 = bnexterr;
cur2 += delta; /* form error * 7 */ cur2 += delta; /* form error * 7 */
} }
/* At this point curN contains the 7/16 error value to be propagated /* At this point curN contains the 7/16 error value to be propagated
* to the next pixel on the current line, and all the errors for the * to the next pixel on the current line, and all the errors for the
* next line have been shifted over. We are therefore ready to move on. * next line have been shifted over. We are therefore ready to move on.
*/ */
inptr += dir3; /* Advance pixel pointers to next column */ inptr += dir3; /* Advance pixel pointers to next column */
outptr += dir; outptr += dir;
errorptr += dir3; /* advance errorptr to current column */ errorptr += dir3; /* advance errorptr to current column */
} }
/* Post-loop cleanup: we must unload the final error values into the /* Post-loop cleanup: we must unload the final error values into the
* final fserrors[] entry. Note we need not unload belowerrN because * final fserrors[] entry. Note we need not unload belowerrN because
@@ -1229,7 +1245,7 @@ init_error_limit (j_decompress_ptr cinfo)
int in, out; int in, out;
table = (int *) malloc((MAXJSAMPLE*2+1) * sizeof(int)); table = (int *) malloc((MAXJSAMPLE*2+1) * sizeof(int));
table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */ table += MAXJSAMPLE; /* so can index -MAXJSAMPLE .. +MAXJSAMPLE */
cquantize->error_limiter = table; cquantize->error_limiter = table;
#define STEPSIZE ((MAXJSAMPLE+1)/16) #define STEPSIZE ((MAXJSAMPLE+1)/16)
@@ -1300,15 +1316,15 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan)
{ {
size_t arraysize = (size_t) ((cinfo->output_width + 2) * size_t arraysize = (size_t) ((cinfo->output_width + 2) *
(3 * sizeof(FSERROR))); (3 * sizeof(FSERROR)));
/* Allocate Floyd-Steinberg workspace if we didn't already. */ /* Allocate Floyd-Steinberg workspace if we didn't already. */
if (cquantize->fserrors == NULL) if (cquantize->fserrors == NULL)
cquantize->fserrors = (INT16*) malloc(arraysize); cquantize->fserrors = (INT16*) malloc(arraysize);
/* Initialize the propagated errors to zero. */ /* Initialize the propagated errors to zero. */
memset((void *) cquantize->fserrors, 0, arraysize); memset((void *) cquantize->fserrors, 0, arraysize);
/* Make the error-limit table if we didn't already. */ /* Make the error-limit table if we didn't already. */
if (cquantize->error_limiter == NULL) if (cquantize->error_limiter == NULL)
init_error_limit(cinfo); init_error_limit(cinfo);
cquantize->on_odd_row = FALSE; cquantize->on_odd_row = FALSE;
} }
@@ -1317,7 +1333,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, bool is_pre_scan)
if (cquantize->needs_zeroed) { if (cquantize->needs_zeroed) {
for (i = 0; i < HIST_C0_ELEMS; i++) { for (i = 0; i < HIST_C0_ELEMS; i++) {
memset((void *) histogram[i], 0, memset((void *) histogram[i], 0,
HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell)); HIST_C1_ELEMS*HIST_C2_ELEMS * sizeof(histcell));
} }
cquantize->needs_zeroed = FALSE; cquantize->needs_zeroed = FALSE;
} }
@@ -1349,10 +1365,10 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo)
int i; int i;
cquantize = (my_cquantize_ptr) malloc(sizeof(my_cquantizer)); 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.start_pass = start_pass_2_quant;
cquantize->pub.new_color_map = new_color_map_2_quant; cquantize->pub.new_color_map = new_color_map_2_quant;
cquantize->fserrors = NULL; /* flag optional arrays not allocated */ cquantize->fserrors = NULL; /* flag optional arrays not allocated */
cquantize->error_limiter = NULL; cquantize->error_limiter = NULL;
@@ -1410,22 +1426,22 @@ prepare_range_limit_table (j_decompress_ptr cinfo)
table = (JSAMPLE *) malloc((5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * sizeof(JSAMPLE)); table = (JSAMPLE *) malloc((5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
cinfo->srl_orig = table; cinfo->srl_orig = table;
table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */
cinfo->sample_range_limit = table; cinfo->sample_range_limit = table;
/* First segment of "simple" table: limit[x] = 0 for x < 0 */ /* First segment of "simple" table: limit[x] = 0 for x < 0 */
memset(table - (MAXJSAMPLE+1), 0, (MAXJSAMPLE+1) * sizeof(JSAMPLE)); memset(table - (MAXJSAMPLE+1), 0, (MAXJSAMPLE+1) * sizeof(JSAMPLE));
/* Main part of "simple" table: limit[x] = x */ /* Main part of "simple" table: limit[x] = x */
for (i = 0; i <= MAXJSAMPLE; i++) for (i = 0; i <= MAXJSAMPLE; i++)
table[i] = (JSAMPLE) i; table[i] = (JSAMPLE) i;
table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */
/* End of simple table, rest of first half of post-IDCT table */ /* End of simple table, rest of first half of post-IDCT table */
for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
table[i] = MAXJSAMPLE; table[i] = MAXJSAMPLE;
/* Second half of post-IDCT table */ /* Second half of post-IDCT table */
memset(table + (2 * (MAXJSAMPLE+1)), 0, memset(table + (2 * (MAXJSAMPLE+1)), 0,
(2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * sizeof(JSAMPLE)); (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
memcpy(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), memcpy(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE),
cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE)); cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
} }
@@ -1495,6 +1511,7 @@ bool wxQuantize::Quantize(const wxImage& src, wxImage& dest,
int h = src.GetHeight(); int h = src.GetHeight();
int windowsSystemColourCount = 20; int windowsSystemColourCount = 20;
int paletteShift = 0; int paletteShift = 0;
// Shift the palette up by the number of Windows system colours, // 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 // do NOT just shut off these warnings, drop me a line instead at
// <guille@iies.es> // <guille@iies.es>
#if defined(__VISUALC__) #if defined(__VISUALC__) || defined (__WATCOMC__)
#pragma message("wxStopWatch will be up to second resolution!") #pragma message("wxStopWatch will be up to second resolution!")
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
#pragma message "wxStopWatch will be up to second resolution!" #pragma message "wxStopWatch will be up to second resolution!"
#else #elif
#warning "wxStopWatch will be up to second resolution!" #warning "wxStopWatch will be up to second resolution!"
#endif // compiler #endif // compiler
#endif #endif

View File

@@ -13,7 +13,7 @@ $Id$
*/ */
#include "wx/defs.h"
#include "wx/setup.h" #include "wx/setup.h"
#if wxUSE_ZLIB && wxUSE_ZIPSTREAM #if wxUSE_ZLIB && wxUSE_ZIPSTREAM
@@ -854,11 +854,11 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
const char *c; const char *c;
char *c2; char *c2;
char szFileName2[UNZ_MAXFILENAMEINZIP+1]; char szFileName2[UNZ_MAXFILENAMEINZIP+1];
uLong num_fileSaved; uLong num_fileSaved;
uLong pos_in_central_dirSaved; uLong pos_in_central_dirSaved;
for (c = szFileName, c2 = szFileName2; *c != '\0'; c++, c2++) for (c = szFileName, c2 = szFileName2; *c != '\0'; c++, c2++)
if (*c == '\\') *c2 = '/'; if (*c == '\\') *c2 = '/';
else *c2 = *c; else *c2 = *c;
*c2 = '\0'; *c2 = '\0';

View File

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

View File

@@ -618,7 +618,7 @@ void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
void wxHtmlWindow::OnCellClicked(wxHtmlCell *cell, void wxHtmlWindow::OnCellClicked(wxHtmlCell *cell,
wxCoord x, wxCoord y, wxCoord x, wxCoord y,
const wxMouseEvent& event) const wxMouseEvent& event)
{ {
wxCHECK_RET( cell, _T("can't be called with NULL cell") ); wxCHECK_RET( cell, _T("can't be called with NULL cell") );
cell->OnMouseClick(this, x, y, event); cell->OnMouseClick(this, x, y, event);
@@ -785,4 +785,4 @@ IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule, wxModule)
#include "wx/html/forcelnk.h" #include "wx/html/forcelnk.h"
FORCE_WXHTML_MODULES() FORCE_WXHTML_MODULES()
#endif #endif

View File

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

View File

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

View File

@@ -25,7 +25,7 @@
#include "wx/utils.h" #include "wx/utils.h"
#endif #endif
#if wxUSE_GAUGE #if wxUSE_GAUGE
#include "wx/msw/gaugemsw.h" #include "wx/msw/gaugemsw.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
@@ -128,12 +128,12 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
wOrient = ZYZG_ORIENT_LEFTTORIGHT; wOrient = ZYZG_ORIENT_LEFTTORIGHT;
else else
wOrient = ZYZG_ORIENT_BOTTOMTOTOP; wOrient = ZYZG_ORIENT_BOTTOMTOTOP;
SendMessage(wx_button, ZYZG_SETORIENTATION, wOrient, 0); SendMessage(wx_button, ZYZG_SETORIENTATION, wOrient, 0);
SendMessage(wx_button, ZYZG_SETRANGE, range, 0); SendMessage(wx_button, ZYZG_SETRANGE, range, 0);
SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue())); SendMessage(GetHwnd(), ZYZG_SETFGCOLOR, 0, PALETTERGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); SendMessage(GetHwnd(), ZYZG_SETBKCOLOR, 0, PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
//SetBezelFace(1); //SetBezelFace(1);
//SetShadowWidth(1); //SetShadowWidth(1);
@@ -200,7 +200,7 @@ bool wxGaugeMSW::SetForegroundColour(const wxColour& col)
if ( !wxControl::SetForegroundColour(col) ) if ( !wxControl::SetForegroundColour(col) )
return FALSE; 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; return TRUE;
} }
@@ -210,7 +210,7 @@ bool wxGaugeMSW::SetBackgroundColour(const wxColour& col)
if ( !wxControl::SetBackgroundColour(col) ) if ( !wxControl::SetBackgroundColour(col) )
return FALSE; 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; return TRUE;
} }
@@ -218,7 +218,7 @@ bool wxGaugeMSW::SetBackgroundColour(const wxColour& col)
/** zyz3d.c /** zyz3d.c
* *
* DESCRIPTION: * DESCRIPTION:
* This module contains functions for creating nifty 3D borders * This module contains functions for creating nifty 3D borders
* around controls like zYzGauge. * around controls like zYzGauge.
* *
@@ -260,7 +260,7 @@ void FAR PASCAL Draw3DLine(HDC, WORD, WORD, WORD, WORD, WORD);
/** void FAR PASCAL Draw3DFaceFrame(HDC hdc, LPRECT rc, WORD wWidth) /** void FAR PASCAL Draw3DFaceFrame(HDC hdc, LPRECT rc, WORD wWidth)
* *
* DESCRIPTION: * DESCRIPTION:
* This function draws a flat frame with the current button-face * This function draws a flat frame with the current button-face
* color. * color.
* *
@@ -330,7 +330,7 @@ void FAR PASCAL Draw3DFaceFrame(HDC hdc, LPRECT rc, WORD wWidth)
/** void FAR PASCAL Draw3DRect(HDC, LPRECT, WORD, WORD) /** void FAR PASCAL Draw3DRect(HDC, LPRECT, WORD, WORD)
* *
* DESCRIPTION: * DESCRIPTION:
* Draws a 3D rectangle that is shaded. wFlags can be used to * Draws a 3D rectangle that is shaded. wFlags can be used to
* control how the rectangle looks. * control how the rectangle looks.
* *
@@ -392,7 +392,7 @@ void FAR PASCAL Draw3DRect(HDC hdc, LPRECT lpRect,
/** void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen, /** void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
* *
* DESCRIPTION: * DESCRIPTION:
* Draws a 3D line that can be used to make a 3D box. * Draws a 3D line that can be used to make a 3D box.
* *
* ARGUMENTS: * ARGUMENTS:
@@ -431,7 +431,7 @@ void FAR PASCAL Draw3DRect(HDC hdc, LPRECT lpRect,
** cjp */ ** cjp */
void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen, void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
WORD wShadowWidth, WORD wFlags) WORD wShadowWidth, WORD wFlags)
{ {
HBRUSH hOldBrush; HBRUSH hOldBrush;
HPEN hOldPen; HPEN hOldPen;
@@ -446,7 +446,7 @@ void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
Point[0].x = x; Point[0].x = x;
Point[0].y = y; Point[0].y = y;
/* To do this we'll simply draw a polygon with four sides, using /* To do this we'll simply draw a polygon with four sides, using
* the appropriate brush. I dare you to ask me why this isn't a * the appropriate brush. I dare you to ask me why this isn't a
* switch/case! * switch/case!
*/ */
@@ -505,7 +505,7 @@ void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
/* select 'dark' brush if 'in'--'light' for 'out' */ /* select 'dark' brush if 'in'--'light' for 'out' */
fDark = (wFlags & DRAW3D_IN) ? TRUE : FALSE; fDark = (wFlags & DRAW3D_IN) ? TRUE : FALSE;
} }
/* well maybe it's for the right side? */ /* well maybe it's for the right side? */
else if (wFlags & DRAW3D_RIGHTLINE) else if (wFlags & DRAW3D_RIGHTLINE)
{ {
@@ -549,7 +549,7 @@ void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
/** zyzgauge.c /** zyzgauge.c
* *
* DESCRIPTION: * DESCRIPTION:
* Yet another 'Gas Gauge Custom Control.' This control gives you * Yet another 'Gas Gauge Custom Control.' This control gives you
* a 'progress bar' class (named zYzGauge) for use in your applications. * a 'progress bar' class (named zYzGauge) for use in your applications.
* You can set the range, position, font, color, orientation, and 3d * You can set the range, position, font, color, orientation, and 3d
@@ -652,7 +652,7 @@ void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
/* static global variables */ /* static global variables */
static wxChar gszzYzGaugeClass[] = wxT("zYzGauge"); static wxChar gszzYzGaugeClass[] = wxT("zYzGauge");
/* window word position definitions */ /* window word position definitions */
#define ZYZG_WW_PZYZGAUGE 0 #define ZYZG_WW_PZYZGAUGE 0
@@ -692,7 +692,7 @@ static BOOL fSupport3D;
#if !defined(APIENTRY) // NT defines APIENTRY, 3.x not #if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
#define APIENTRY FAR PASCAL #define APIENTRY FAR PASCAL
#endif #endif
#ifdef __WIN32__ #ifdef __WIN32__
#define _EXPORT /**/ #define _EXPORT /**/
#else #else
@@ -709,7 +709,7 @@ LRESULT APIENTRY _EXPORT gaugeWndProc(HWND, UINT, WPARAM, LPARAM);
/** BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance) /** BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance)
* *
* DESCRIPTION: * DESCRIPTION:
* Registers the window class for the zYzGauge control. Performs * Registers the window class for the zYzGauge control. Performs
* other initialization for the zYzGauge text control. This must * other initialization for the zYzGauge text control. This must
* be done before the zYzGauge control is used--or it will fail * be done before the zYzGauge control is used--or it will fail
@@ -733,7 +733,7 @@ BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance)
static BOOL fRegistered = FALSE; static BOOL fRegistered = FALSE;
WNDCLASS wc; WNDCLASS wc;
HDC hdc; HDC hdc;
/* assume already registered if not first instance */ /* assume already registered if not first instance */
if (fRegistered) if (fRegistered)
return (TRUE); return (TRUE);
@@ -776,7 +776,7 @@ BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance)
} }
/* good! we have color: blue foreground, white background */ /* good! we have color: blue foreground, white background */
else else
{ {
rgbDefTextColor = RGB(0, 0, 255); rgbDefTextColor = RGB(0, 0, 255);
rgbDefBkColor = RGB(255, 255, 255); rgbDefBkColor = RGB(255, 255, 255);
@@ -804,7 +804,7 @@ BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance)
/** static void PASCAL gaugePaint(HWND hwnd, HDC hdc) /** static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
* *
* DESCRIPTION: * DESCRIPTION:
* This function is responsible for painting the zYzGauge control. * This function is responsible for painting the zYzGauge control.
* *
* ARGUMENTS: * ARGUMENTS:
@@ -876,7 +876,7 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
/* add all the other pixels into the border width */ /* add all the other pixels into the border width */
Offset += (2 * pgauge->wWidth3D) + pgauge->wWidthBezelFace + 1; Offset += (2 * pgauge->wWidth3D) + pgauge->wWidthBezelFace + 1;
} }
/* dup--one rc for 'how much filled', one rc for 'how much empty' */ /* dup--one rc for 'how much filled', one rc for 'how much empty' */
rc2 = rc1; rc2 = rc1;
@@ -925,7 +925,7 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
dwExtent = size.cx; dwExtent = size.cx;
#else #else
dwExtent = GetTextExtent(hdc, ach, wGomerX = lstrlen(ach)); dwExtent = GetTextExtent(hdc, ach, wGomerX = lstrlen(ach));
#endif #endif
/* Draw the finished (ie the percent done) side of box. If /* Draw the finished (ie the percent done) side of box. If
@@ -949,11 +949,11 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
/* unselect the font */ /* unselect the font */
SelectObject(hdc, hFont); SelectObject(hdc, hFont);
} /* gaugePaint() */ } /* gaugePaint() */
/** LRESULT FAR PASCAL gaugeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /** LRESULT FAR PASCAL gaugeWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
* *
* DESCRIPTION: * DESCRIPTION:
* This is the control's window procedure. Its purpose is to handle * This is the control's window procedure. Its purpose is to handle
* special messages for this custom control. * special messages for this custom control.
* *
@@ -968,7 +968,7 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
* ZYZG_SETORIENTATION : Sets the orientation of the gauge. This * ZYZG_SETORIENTATION : Sets the orientation of the gauge. This
* can be one of the ZYZG_ORIENT_?? msgs. * can be one of the ZYZG_ORIENT_?? msgs.
* *
* ZYZG_GETORIENTATION : Gets the current orientation of the * ZYZG_GETORIENTATION : Gets the current orientation of the
* gauge. * gauge.
* *
* ZYZG_SETPOSITION : Sets the current position of the gauge. * ZYZG_SETPOSITION : Sets the current position of the gauge.

View File

@@ -137,7 +137,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc,
return TRUE; return TRUE;
// wxColor <-> RGB // 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) #define UnRGB(col) GetRValue(col), GetGValue(col), GetBValue(col)
// set the colors // set the colors

View File

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

View File

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

View File

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

View File

@@ -23,6 +23,7 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/module.h"
#endif #endif
#include "wx/dcprint.h" #include "wx/dcprint.h"
@@ -204,7 +205,7 @@ wxDCCacheEntry* wxDC::FindBitmapInCache(
, int nHeight , 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(); wxNode* pNode = m_svBitmapCache.First();
BITMAPINFOHEADER2 vBmpHdr; BITMAPINFOHEADER2 vBmpHdr;

View File

@@ -225,7 +225,7 @@ void wxClientDC::InitDC()
// in wxUniv build we must manually do some DC adjustments usually // in wxUniv build we must manually do some DC adjustments usually
// performed by Windows for us // performed by Windows for us
#ifdef __WXUNIVERSAL__ #ifdef __WXUNIVERSAL__
wxPoint ptOrigin = m_canvas->GetClientAreaOrigin(); wxPoint ptOrigin = m_pCanvas->GetClientAreaOrigin();
if ( ptOrigin.x || ptOrigin.y ) if ( ptOrigin.x || ptOrigin.y )
{ {
// no need to shift DC origin if shift is null // 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 // 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__ #endif // __WXUNIVERSAL__
} // end of wxClientDC::InitDC } // end of wxClientDC::InitDC

View File

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

View File

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

View File

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

View File

@@ -161,6 +161,21 @@ wxFontRefData::~wxFontRefData()
// wxFont // 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() void wxFont::Init()
{ {
if ( wxTheFontList ) if ( wxTheFontList )

View File

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

View File

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

View File

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

View File

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

View File

@@ -28,7 +28,7 @@
#define BSD_SELECT /* use Berkley Sockets select */ #define BSD_SELECT /* use Berkley Sockets select */
#include <assert.h> #include <assert.h>
#include <sys\types.h> #include <sys/types.h>
#ifdef __EMX__ #ifdef __EMX__
#include <sys/time.h> #include <sys/time.h>
@@ -42,10 +42,11 @@
#else #else
#include <utils.h> #include <string.h>
#include <sys\time.h>
#include <sys/time.h>
#include <types.h> #include <types.h>
#include <in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#include <nerrno.h> #include <nerrno.h>
@@ -53,7 +54,7 @@
#if defined(__VISAGECPP__) && __IBMCPP__ < 400 #if defined(__VISAGECPP__) && __IBMCPP__ < 400
#include <machine\endian.h> #include <machine/endian.h>
#include <socket.h> #include <socket.h>
#include <ioctl.h> #include <ioctl.h>
#include <select.h> #include <select.h>
@@ -63,9 +64,9 @@
#else #else
#include <sys\socket.h> #include <sys/socket.h>
#include <sys\ioctl.h> #include <sys/ioctl.h>
#include <sys\select.h> #include <sys/select.h>
#ifdef __EMX__ #ifdef __EMX__
#define soclose(a) close(a) #define soclose(a) close(a)
@@ -80,7 +81,6 @@ int _System soclose(int);
#endif #endif
#endif #endif
#include <string.h>
#include <stdio.h> #include <stdio.h>
#if (defined(__VISAGECPP__) && __IBMCPP__ < 400) || defined(__EMX__) #if (defined(__VISAGECPP__) && __IBMCPP__ < 400) || defined(__EMX__)
# ifdef min # ifdef min
@@ -90,6 +90,7 @@ int _System soclose(int);
#endif #endif
#include <stddef.h> #include <stddef.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h>
#include <signal.h> #include <signal.h>
@@ -418,7 +419,7 @@ GSocketError GSocket_SetServer(GSocket *sck)
return GSOCK_IOERR; return GSOCK_IOERR;
} }
ioctl(sck->m_fd, FIONBIO, &arg); ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(sck); _GSocket_Enable_Events(sck);
/* Bind to the local address, /* Bind to the local address,
@@ -524,7 +525,7 @@ GSocket *GSocket_WaitConnection(GSocket *socket)
return NULL; return NULL;
} }
ioctl(connection->m_fd, FIONBIO, &arg); ioctl(connection->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(connection); _GSocket_Enable_Events(connection);
return connection; return connection;
@@ -593,14 +594,14 @@ GSocketError GSocket_Connect(GSocket *sck, GSocketStream stream)
return GSOCK_IOERR; return GSOCK_IOERR;
} }
ioctl(sck->m_fd, FIONBIO, &arg); ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(sck); _GSocket_Enable_Events(sck);
/* Connect it to the peer address, with a timeout (see below) */ /* Connect it to the peer address, with a timeout (see below) */
ret = connect(sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len); ret = connect(sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len);
printf("connect on %d to %X (%d) returned %d, errno = %d\n", printf("connect on %d to %X (%d) returned %d, errno = %d\n",
sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len, ret, errno); sck->m_fd, sck->m_peer->m_addr, sck->m_peer->m_len, ret, errno);
if (ret == -1) if (ret == -1)
{ {
err = errno; err = errno;
@@ -701,7 +702,7 @@ GSocketError GSocket_SetNonOriented(GSocket *sck)
return GSOCK_IOERR; return GSOCK_IOERR;
} }
ioctl(sck->m_fd, FIONBIO, &arg); ioctl(sck->m_fd, FIONBIO, (char*)&arg, sizeof(arg));
_GSocket_Enable_Events(sck); _GSocket_Enable_Events(sck);
/* Bind to the local address, /* Bind to the local address,
@@ -1006,7 +1007,7 @@ void GSocket_SetCallback(GSocket *socket, GSocketEventFlags flags,
if ((flags & (1 << count)) != 0) if ((flags & (1 << count)) != 0)
{ {
printf("Setting callback no %d for socket at %X to address %X,data %X\n", printf("Setting callback no %d for socket at %X to address %X,data %X\n",
count, socket, callback, cdata); count, socket, callback, cdata);
socket->m_cbacks[count] = callback; socket->m_cbacks[count] = callback;
socket->m_data[count] = cdata; socket->m_data[count] = cdata;
} }
@@ -1028,7 +1029,7 @@ void GSocket_UnsetCallback(GSocket *socket, GSocketEventFlags flags)
if ((flags & (1 << count)) != 0) if ((flags & (1 << count)) != 0)
{ {
printf("Removing callback no %d for socket at %X", printf("Removing callback no %d for socket at %X",
count, socket); count, socket);
socket->m_cbacks[count] = NULL; socket->m_cbacks[count] = NULL;
socket->m_data[count] = NULL; socket->m_data[count] = NULL;
} }
@@ -1197,7 +1198,7 @@ int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size)
ret = send(socket->m_fd, buffer, size, 0); ret = send(socket->m_fd, buffer, size, 0);
UNMASK_SIGNAL(); UNMASK_SIGNAL();
#else #else
ret = send(socket->m_fd, buffer, size, 0); ret = send(socket->m_fd, (char *)buffer, size, 0);
#endif #endif
return ret; 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); ret = sendto(socket->m_fd, buffer, size, 0, addr, len);
UNMASK_SIGNAL(); UNMASK_SIGNAL();
#else #else
ret = sendto(socket->m_fd, buffer, size, 0, addr, len); ret = sendto(socket->m_fd, (char *)buffer, size, 0, addr, len);
#endif #endif
/* Frees memory allocated from _GAddress_translate_to */ /* Frees memory allocated from _GAddress_translate_to */
@@ -1494,8 +1495,8 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname)
{ {
#else #else
/* Use gethostbyname by default */ /* Use gethostbyname by default */
int val = 1; //VA doesn't like constants in conditional expressions at all // int val = 1; //VA doesn't like constants in conditional expressions at all
if (val) if (1)
{ {
#endif #endif
struct in_addr *array_addr; struct in_addr *array_addr;

View File

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

View File

@@ -4,7 +4,7 @@
// Author: David Webster // Author: David Webster
// Modified by: // Modified by:
// Created: 10/15/99 // Created: 10/15/99
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Davdi Webster // Copyright: (c) Davdi Webster
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -19,8 +19,8 @@
#include "wx/window.h" #include "wx/window.h"
#include "wx/os2/private.h" #include "wx/os2/private.h"
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxRegionRefData implementation // wxRegionRefData implementation
@@ -31,6 +31,7 @@ public:
wxRegionRefData() wxRegionRefData()
{ {
m_hRegion = 0; m_hRegion = 0;
m_hPS = 0;
} }
wxRegionRefData(const wxRegionRefData& rData) wxRegionRefData(const wxRegionRefData& rData)
@@ -89,11 +90,13 @@ wxRegion::wxRegion()
} // end of wxRegion::wxRegion } // end of wxRegion::wxRegion
wxRegion::wxRegion( wxRegion::wxRegion(
WXHRGN hRegion WXHRGN hRegion,
WXHDC hPS
) )
{ {
m_refData = new wxRegionRefData; m_refData = new wxRegionRefData;
M_REGION = (HRGN) hRegion; M_REGION = (HRGN) hRegion;
(((wxRegionRefData*)m_refData)->m_hPS) = hPS;
} // end of wxRegion::wxRegion } // end of wxRegion::wxRegion
wxRegion::wxRegion( wxRegion::wxRegion(
@@ -396,8 +399,9 @@ void wxRegion::GetBox(
if (m_refData) if (m_refData)
{ {
RECTL vRect; RECTL vRect;
APIRET rc;
::GpiQueryRegionBox( ((wxRegionRefData*)m_refData)->m_hPS rc = ::GpiQueryRegionBox( ((wxRegionRefData*)m_refData)->m_hPS
,M_REGION ,M_REGION
,&vRect ,&vRect
); );

View File

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

View File

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

View File

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

View File

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

View File

@@ -92,7 +92,12 @@ void wxFrame::PositionMenuBar()
// the menubar is positioned above the client size, hence the negative // the menubar is positioned above the client size, hence the negative
// y coord // y coord
wxCoord heightMbar = m_frameMenuBar->GetSize().y; 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); GetClientSize().x, heightMbar);
} }
} }
@@ -136,7 +141,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
{ {
wxPoint pt = wxFrameBase::GetClientAreaOrigin(); wxPoint pt = wxFrameBase::GetClientAreaOrigin();
#if wxUSE_MENUS #if wxUSE_MENUS && !defined(__WXPM__)
if ( m_frameMenuBar ) if ( m_frameMenuBar )
{ {
pt.y += m_frameMenuBar->GetSize().y; 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) = void (wxRenderer::*pfn)(wxDC&, wxDirection, const wxRect&, int) =
scrollbarLike ? &wxRenderer::DrawScrollbarArrow scrollbarLike ? wxRenderer::DrawScrollbarArrow
: &wxRenderer::DrawArrow; : wxRenderer::DrawArrow;
(m_control->GetRenderer()->*pfn) (m_control->GetRenderer()->*pfn)
( (

View File

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

View File

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