Mutiple updates from SciTech for wxWindows including the following:

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


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

View File

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

View File

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

View File

@@ -5,23 +5,19 @@
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ======================================================================
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* | |
* |This copyrighted computer code is a proprietary trade secret of |
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
* |written authorization from SciTech to possess or use this code, you |
* |may be subject to civil and/or criminal penalties. |
* | |
* |If you received this code in error or you would like to report |
* |improper use, please immediately contact SciTech Software, Inc. at |
* |530-894-8400. |
* | |
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* ======================================================================
* ========================================================================
*
* The contents of this file are subject to the wxWindows License
* Version 3.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.wxwindows.org/licence3.txt
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
@@ -88,24 +84,27 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
const wxSize& size,
long style,
const wxString& name,
const wxString& docroot )
: wxHtmlWindow(parent,id,pos,size,style,name)
const wxPalette& globalPalette)
: wxHtmlWindow(parent,id,pos,size,style,name), m_globalPalette(globalPalette)
{
// Init our locks
UnLock();
// setup client navbars
if (navBar) {
m_NavBarEnabled = true;
m_NavBar = navBar;
m_NavBackId = navBackId;
m_NavForwardId = navForwardId;
}
else {
m_NavBarEnabled = false;
m_NavBar = NULL;
}
// Set up docroot
m_DocRoot = docroot;
m_NavBackId = navBackId;
m_NavForwardId = navForwardId;
// Set the key_type for applets
m_AppletList = wxAppletList(wxKEY_STRING);
@@ -114,7 +113,7 @@ wxHtmlAppletWindow::wxHtmlAppletWindow(
// deleting preprocessors is done by the code within the window
incPreprocessor = new wxIncludePrep(); // #include preprocessor
incPreprocessor->ChangeDirectory(m_DocRoot);
incPreprocessor->ChangeDirectory(m_FS); // give it access to our filesys object
wxEchoPrep * echoPreprocessor = new wxEchoPrep(); // #echo preprocessor
wxIfElsePrep * ifPreprocessor = new wxIfElsePrep();
@@ -132,6 +131,27 @@ wxHtmlAppletWindow::~wxHtmlAppletWindow()
{
}
#include "scitech.h"
/****************************************************************************
PARAMETERS:
dc - wxDC object to draw on
REMARKS:
This function handles drawing the HTML applet window. Because the standard
wxWindows classes don't properly handle palette management, we add code
in here to properly select the global palette that we use for all drawing
into the DC before we allow the regular wxWindows code to finish the
drawing process.
****************************************************************************/
void wxHtmlAppletWindow::OnDraw(
wxDC& dc)
{
// TODO: Only do this for <= 8bpp modes!
dc.SetPalette(m_globalPalette);
wxHtmlWindow::OnDraw(dc);
}
/****************************************************************************
PARAMETERS:
className - Name of the applet class to create an object for
@@ -263,24 +283,11 @@ True if page loaded successfully, false if not
REMARKS:
Remove an applet from the manager. Called during applet destruction
****************************************************************************/
#include "scitech"
bool wxHtmlAppletWindow::LoadPage(
const wxString& link)
{
wxString href(link);
// TODO: technically we allow no relative paths
// Check to see if it is a real url, if not it is a file
if (link.Mid(0, 5).CmpNoCase("http:") != 0) {
// Check for abs path. If it is not then tack on the path
// supplied at creation.
// TODO: Abs paths are only used in testing (remove this)
if (link.GetChar(1) != ':')
href = m_DocRoot + href;
}
if (link.GetChar(0) == '?'){
wxString cmd = link.BeforeFirst('=');
wxString cmdValue = link.AfterFirst('=');
@@ -329,11 +336,12 @@ bool wxHtmlAppletWindow::LoadPage(
for (wxAppletList::Node *node = m_AppletList.GetFirst(); node; node = node->GetNext())
(node->GetData())->OnLinkClicked(wxHtmlLinkInfo(href));
Show(false);
bool stat = wxHtmlWindow::LoadPage(href);
Show(true);
// Enable/Dis the navbar tools
if (m_NavBar) {
if (m_NavBarEnabled) {
m_NavBar->EnableTool(m_NavForwardId,HistoryCanForward());
m_NavBar->EnableTool(m_NavBackId,HistoryCanBack());
}
@@ -388,6 +396,37 @@ bool wxHtmlAppletWindow::HistoryBack()
return wxHtmlWindow::HistoryBack();
}
/****************************************************************************
REMARKS:
This function is used to disable the navigation bars. If you want to
toggle to the navbars off you must call this function.
****************************************************************************/
void wxHtmlAppletWindow::DisableNavBar()
{
m_NavBarEnabled = false;
}
/****************************************************************************
REMARKS:
This function is used to enable the nav bars. If you toggle the nav bars on
you must call this function.
****************************************************************************/
void wxHtmlAppletWindow::EnableNavBar()
{
m_NavBarEnabled = true;
}
/****************************************************************************
REMARKS:
This function is used to set the nav bar to a new nav bar if you deleted the
one that you were useing. Usally this happens when you toggle a nav bar
on or off.
****************************************************************************/
void wxHtmlAppletWindow::SetNavBar(wxToolBarBase *navBar)
{
m_NavBar = navBar;
}
/****************************************************************************
PARAMETERS:
msg - wxEvent message to be sent to all wxApplets
@@ -570,6 +609,18 @@ VirtualData::VirtualData(
m_href = href;
}
/****************************************************************************
PARAMETERS:
REMARKS:
VirtualData is used to store information on the virtual links.
****************************************************************************/
VirtualData::VirtualData()
{
m_name.Empty();
m_group.Empty();
m_href.Empty();
}
/****************************************************************************
PARAMETERS:
REMARKS:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,7 @@
// Created: 22/6/2000
// RCS-ID: $Id$
// 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 <string.h>
#if defined(__VISAGECPP__)
#if defined(__OS2__)
#define RGB_RED_OS2 0
#define RGB_GREEN_OS2 1
#define RGB_BLUE_OS2 2
@@ -90,7 +90,23 @@ typedef struct {
JSAMPLE *sample_range_limit, *srl_orig;
} j_decompress;
#ifdef __WINDOWS__
#define JMETHOD(type,methodname,arglist) type (__cdecl methodname) arglist
#else
#define JMETHOD(type,methodname,arglist) type (methodname) arglist
#endif
typedef j_decompress *j_decompress_ptr;
struct jpeg_color_quantizer {
JMETHOD(void, start_pass, (j_decompress_ptr cinfo, bool is_pre_scan));
JMETHOD(void, color_quantize, (j_decompress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPARRAY output_buf,
int num_rows));
JMETHOD(void, finish_pass, (j_decompress_ptr cinfo));
JMETHOD(void, new_color_map, (j_decompress_ptr cinfo));
};
/*
@@ -139,9 +155,9 @@ typedef j_decompress *j_decompress_ptr;
* probably need to change these scale factors.
*/
#define R_SCALE 2 /* scale R distances by this much */
#define G_SCALE 3 /* scale G distances by this much */
#define B_SCALE 1 /* and B by this much */
#define R_SCALE 2 /* scale R distances by this much */
#define G_SCALE 3 /* scale G distances 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
* 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.
*/
#if defined(__VISAGECPP__)
#if defined(__OS2__)
#if RGB_RED_OS2 == 0
#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,
* 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_C1_BITS 6 /* bits of precision in G histogram */
#define HIST_C2_BITS 5 /* bits of precision in B/R 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_C2_BITS 5 /* bits of precision in B/R histogram */
/* Number of elements along histogram axes. */
#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)
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 hist1d * hist2d; /* type for the 2nd-level pointers */
typedef hist2d * hist3d; /* type for top-level pointer */
typedef hist1d * hist2d; /* type for the 2nd-level pointers */
typedef hist2d * hist3d; /* type for top-level pointer */
/* 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
* 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,
* ... (here) 7/16
* 3/16 5/16 1/16
* ... (here) 7/16
* 3/16 5/16 1/16
* 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)
@@ -268,14 +284,14 @@ typedef hist2d * hist3d; /* type for top-level pointer */
*/
#if BITS_IN_JSAMPLE == 8
typedef INT16 FSERROR; /* 16 bits should be enough */
typedef int LOCFSERROR; /* use 'int' for calculation temps */
typedef INT16 FSERROR; /* 16 bits should be enough */
typedef int LOCFSERROR; /* use 'int' for calculation temps */
#else
typedef INT32 FSERROR; /* may need more than 16 bits */
typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */
typedef INT32 FSERROR; /* may need more than 16 bits */
typedef INT32 LOCFSERROR; /* be sure calculation temps are big enough */
#endif
typedef FSERROR *FSERRPTR; /* pointer to error array (in storage!) */
typedef FSERROR *FSERRPTR; /* pointer to error array (in storage!) */
/* Private subobject */
@@ -290,18 +306,18 @@ typedef struct {
} pub;
/* Space for the eventually created colormap is stashed here */
JSAMPARRAY sv_colormap; /* colormap allocated at init time */
int desired; /* desired # of colors = size of colormap */
JSAMPARRAY sv_colormap; /* colormap allocated at init time */
int desired; /* desired # of colors = size of colormap */
/* 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 */
FSERRPTR fserrors; /* accumulated errors */
bool on_odd_row; /* flag to remember which row we are on */
int * error_limiter; /* table for clamping the applied error */
FSERRPTR fserrors; /* accumulated errors */
bool on_odd_row; /* flag to remember which row we are on */
int * error_limiter; /* table for clamping the applied error */
} my_cquantizer;
typedef my_cquantizer * my_cquantize_ptr;
@@ -318,7 +334,7 @@ typedef my_cquantizer * my_cquantize_ptr;
void
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;
register JSAMPROW ptr;
@@ -336,8 +352,8 @@ prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf,
/* get pixel value and index into the histogram */
histp = & histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT]
[GETJSAMPLE(ptr[1]) >> C1_SHIFT]
[GETJSAMPLE(ptr[2]) >> C2_SHIFT];
[GETJSAMPLE(ptr[1]) >> C1_SHIFT]
[GETJSAMPLE(ptr[2]) >> C2_SHIFT];
/* increment, check for overflow and undo increment if so. */
if (++(*histp) <= 0)
(*histp)--;
@@ -429,67 +445,67 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
if (c0max > c0min)
for (c0 = c0min; c0 <= c0max; c0++)
for (c1 = c1min; c1 <= c1max; c1++) {
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c0min = c0min = c0;
goto have_c0min;
}
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c0min = c0min = c0;
goto have_c0min;
}
}
have_c0min:
if (c0max > c0min)
for (c0 = c0max; c0 >= c0min; c0--)
for (c1 = c1min; c1 <= c1max; c1++) {
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c0max = c0max = c0;
goto have_c0max;
}
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c0max = c0max = c0;
goto have_c0max;
}
}
have_c0max:
if (c1max > c1min)
for (c1 = c1min; c1 <= c1max; c1++)
for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c1min = c1min = c1;
goto have_c1min;
}
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c1min = c1min = c1;
goto have_c1min;
}
}
have_c1min:
if (c1max > c1min)
for (c1 = c1max; c1 >= c1min; c1--)
for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c1max = c1max = c1;
goto have_c1max;
}
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++)
if (*histp++ != 0) {
boxp->c1max = c1max = c1;
goto have_c1max;
}
}
have_c1max:
if (c2max > c2min)
for (c2 = c2min; c2 <= c2max; c2++)
for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) {
boxp->c2min = c2min = c2;
goto have_c2min;
}
histp = & histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) {
boxp->c2min = c2min = c2;
goto have_c2min;
}
}
have_c2min:
if (c2max > c2min)
for (c2 = c2max; c2 >= c2min; c2--)
for (c0 = c0min; c0 <= c0max; c0++) {
histp = & histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) {
boxp->c2max = c2max = c2;
goto have_c2max;
}
histp = & histogram[c0][c1min][c2];
for (c1 = c1min; c1 <= c1max; c1++, histp += HIST_C2_ELEMS)
if (*histp != 0) {
boxp->c2max = c2max = c2;
goto have_c2max;
}
}
have_c2max:
@@ -512,9 +528,9 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
for (c1 = c1min; c1 <= c1max; c1++) {
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++, histp++)
if (*histp != 0) {
ccount++;
}
if (*histp != 0) {
ccount++;
}
}
boxp->colorcount = ccount;
}
@@ -522,7 +538,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp)
int
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 */
{
int n,lb;
@@ -538,9 +554,9 @@ median_cut (j_decompress_ptr cinfo, boxptr boxlist, int numboxes,
} else {
b1 = find_biggest_volume(boxlist, numboxes);
}
if (b1 == NULL) /* no splittable boxes left! */
if (b1 == NULL) /* no splittable boxes left! */
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. */
b2->c0max = b1->c0max; b2->c1max = b1->c1max; b2->c2max = b1->c2max;
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++) {
histp = & histogram[c0][c1][c2min];
for (c2 = c2min; c2 <= c2max; c2++) {
if ((count = *histp++) != 0) {
total += count;
c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count;
c1total += ((c1 << C1_SHIFT) + ((1<<C1_SHIFT)>>1)) * count;
c2total += ((c2 << C2_SHIFT) + ((1<<C2_SHIFT)>>1)) * count;
}
if ((count = *histp++) != 0) {
total += count;
c0total += ((c0 << C0_SHIFT) + ((1<<C0_SHIFT)>>1)) * count;
c1total += ((c1 << C1_SHIFT) + ((1<<C1_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
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
* 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
@@ -775,7 +791,7 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
int centerc0, centerc1, centerc2;
int i, x, ncolors;
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.
* 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 */
min_dist = 0;
if (x <= centerc0) {
tdist = (x - maxc0) * C0_SCALE;
max_dist = tdist*tdist;
tdist = (x - maxc0) * C0_SCALE;
max_dist = tdist*tdist;
} else {
tdist = (x - minc0) * C0_SCALE;
max_dist = tdist*tdist;
tdist = (x - minc0) * C0_SCALE;
max_dist = tdist*tdist;
}
}
@@ -839,11 +855,11 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
} else {
/* within cell range so no contribution to min_dist */
if (x <= centerc1) {
tdist = (x - maxc1) * C1_SCALE;
max_dist += tdist*tdist;
tdist = (x - maxc1) * C1_SCALE;
max_dist += tdist*tdist;
} else {
tdist = (x - minc1) * C1_SCALE;
max_dist += tdist*tdist;
tdist = (x - minc1) * C1_SCALE;
max_dist += tdist*tdist;
}
}
@@ -861,15 +877,15 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
} else {
/* within cell range so no contribution to min_dist */
if (x <= centerc2) {
tdist = (x - maxc2) * C2_SCALE;
max_dist += tdist*tdist;
tdist = (x - maxc2) * C2_SCALE;
max_dist += tdist*tdist;
} else {
tdist = (x - minc2) * C2_SCALE;
max_dist += tdist*tdist;
tdist = (x - minc2) * C2_SCALE;
max_dist += tdist*tdist;
}
}
mindist[i] = min_dist; /* save away the results */
mindist[i] = min_dist; /* save away the results */
if (max_dist < minmaxdist)
minmaxdist = max_dist;
}
@@ -889,7 +905,7 @@ find_nearby_colors (j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
static void
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,
* given the list of candidate colors prepared by find_nearby_colors.
* 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 i, icolor;
register INT32 * bptr; /* pointer into bestdist[] array */
JSAMPLE * cptr; /* pointer into bestcolor[] array */
INT32 dist0, dist1; /* initial distance values */
register INT32 dist2; /* current distance in inner loop */
INT32 xx0, xx1; /* distance increments */
register INT32 * bptr; /* pointer into bestdist[] array */
JSAMPLE * cptr; /* pointer into bestcolor[] array */
INT32 dist0, dist1; /* initial distance values */
register INT32 dist2; /* current distance in inner loop */
INT32 xx0, xx1; /* distance increments */
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 */
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;
xx1 = inc1;
for (ic1 = BOX_C1_ELEMS-1; ic1 >= 0; ic1--) {
dist2 = dist1;
xx2 = inc2;
for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) {
if (dist2 < *bptr) {
*bptr = dist2;
*cptr = (JSAMPLE) icolor;
}
dist2 += xx2;
xx2 += 2 * STEP_C2 * STEP_C2;
bptr++;
cptr++;
}
dist1 += xx1;
xx1 += 2 * STEP_C1 * STEP_C1;
dist2 = dist1;
xx2 = inc2;
for (ic2 = BOX_C2_ELEMS-1; ic2 >= 0; ic2--) {
if (dist2 < *bptr) {
*bptr = dist2;
*cptr = (JSAMPLE) icolor;
}
dist2 += xx2;
xx2 += 2 * STEP_C2 * STEP_C2;
bptr++;
cptr++;
}
dist1 += xx1;
xx1 += 2 * STEP_C1 * STEP_C1;
}
dist0 += xx0;
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;
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;
register JSAMPLE * cptr; /* pointer into bestcolor[] array */
register histptr cachep; /* pointer into main cache array */
register JSAMPLE * cptr; /* pointer into bestcolor[] array */
register histptr cachep; /* pointer into main cache array */
/* This array lists the candidate colormap indexes. */
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. */
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. */
find_best_colors(cinfo, minc0, minc1, minc2, numcolors, colorlist,
bestcolor);
bestcolor);
/* 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;
c2 <<= BOX_C2_LOG;
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++) {
cachep = & histogram[c0+ic0][c1+ic1][c2];
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
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 */
{
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 */
/* and update the cache */
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 */
*outptr++ = (JSAMPLE) (*cachep - 1);
}
@@ -1063,20 +1079,20 @@ pass2_no_dither (j_decompress_ptr cinfo,
void
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 */
{
my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize;
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 bpreverr0, bpreverr1, bpreverr2; /* error for below/prev col */
register FSERRPTR errorptr; /* => fserrors[] at column before current */
JSAMPROW inptr; /* => current input pixel */
JSAMPROW outptr; /* => current output pixel */
register FSERRPTR errorptr; /* => fserrors[] at column before current */
JSAMPROW inptr; /* => current input pixel */
JSAMPROW outptr; /* => current output pixel */
histptr cachep;
int dir; /* +1 or -1 depending on direction */
int dir3; /* 3*dir, for advancing inptr & errorptr */
int dir; /* +1 or -1 depending on direction */
int dir3; /* 3*dir, for advancing inptr & errorptr */
int row;
JDIMENSION col;
JDIMENSION width = cinfo->output_width;
@@ -1092,7 +1108,7 @@ pass2_fs_dither (j_decompress_ptr cinfo,
outptr = output_buf[row];
if (cquantize->on_odd_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;
dir = -1;
dir3 = -3;
@@ -1144,14 +1160,14 @@ pass2_fs_dither (j_decompress_ptr cinfo,
/* If we have not seen this color before, find nearest colormap */
/* entry and update the cache */
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 */
{ register int pixcode = *cachep - 1;
*outptr = (JSAMPLE) pixcode;
/* Compute representation error for this pixel */
cur0 -= GETJSAMPLE(colormap0[pixcode]);
cur1 -= GETJSAMPLE(colormap1[pixcode]);
cur2 -= GETJSAMPLE(colormap2[pixcode]);
*outptr = (JSAMPLE) pixcode;
/* Compute representation error for this pixel */
cur0 -= GETJSAMPLE(colormap0[pixcode]);
cur1 -= GETJSAMPLE(colormap1[pixcode]);
cur2 -= GETJSAMPLE(colormap2[pixcode]);
}
/* Compute error fractions to be propagated to adjacent pixels.
* 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;
bnexterr = cur0; /* Process component 0 */
delta = cur0 * 2;
cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0;
belowerr0 = bnexterr;
cur0 += delta; /* form error * 7 */
bnexterr = cur1; /* Process component 1 */
delta = cur1 * 2;
cur1 += delta; /* form error * 3 */
errorptr[1] = (FSERROR) (bpreverr1 + cur1);
cur1 += delta; /* form error * 5 */
bpreverr1 = belowerr1 + cur1;
belowerr1 = bnexterr;
cur1 += delta; /* form error * 7 */
bnexterr = cur2; /* Process component 2 */
delta = cur2 * 2;
cur2 += delta; /* form error * 3 */
errorptr[2] = (FSERROR) (bpreverr2 + cur2);
cur2 += delta; /* form error * 5 */
bpreverr2 = belowerr2 + cur2;
belowerr2 = bnexterr;
cur2 += delta; /* form error * 7 */
bnexterr = cur0; /* Process component 0 */
delta = cur0 * 2;
cur0 += delta; /* form error * 3 */
errorptr[0] = (FSERROR) (bpreverr0 + cur0);
cur0 += delta; /* form error * 5 */
bpreverr0 = belowerr0 + cur0;
belowerr0 = bnexterr;
cur0 += delta; /* form error * 7 */
bnexterr = cur1; /* Process component 1 */
delta = cur1 * 2;
cur1 += delta; /* form error * 3 */
errorptr[1] = (FSERROR) (bpreverr1 + cur1);
cur1 += delta; /* form error * 5 */
bpreverr1 = belowerr1 + cur1;
belowerr1 = bnexterr;
cur1 += delta; /* form error * 7 */
bnexterr = cur2; /* Process component 2 */
delta = cur2 * 2;
cur2 += delta; /* form error * 3 */
errorptr[2] = (FSERROR) (bpreverr2 + cur2);
cur2 += delta; /* form error * 5 */
bpreverr2 = belowerr2 + cur2;
belowerr2 = bnexterr;
cur2 += delta; /* form error * 7 */
}
/* 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
* 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;
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
* final fserrors[] entry. Note we need not unload belowerrN because
@@ -1229,7 +1245,7 @@ init_error_limit (j_decompress_ptr cinfo)
int in, out;
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;
#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) *
(3 * sizeof(FSERROR)));
(3 * sizeof(FSERROR)));
/* Allocate Floyd-Steinberg workspace if we didn't already. */
if (cquantize->fserrors == NULL)
cquantize->fserrors = (INT16*) malloc(arraysize);
cquantize->fserrors = (INT16*) malloc(arraysize);
/* Initialize the propagated errors to zero. */
memset((void *) cquantize->fserrors, 0, arraysize);
/* Make the error-limit table if we didn't already. */
if (cquantize->error_limiter == NULL)
init_error_limit(cinfo);
init_error_limit(cinfo);
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) {
for (i = 0; i < HIST_C0_ELEMS; i++) {
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;
}
@@ -1349,10 +1365,10 @@ jinit_2pass_quantizer (j_decompress_ptr cinfo)
int i;
cquantize = (my_cquantize_ptr) malloc(sizeof(my_cquantizer));
cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize;
cinfo->cquantize = (jpeg_color_quantizer *) cquantize;
cquantize->pub.start_pass = start_pass_2_quant;
cquantize->pub.new_color_map = new_color_map_2_quant;
cquantize->fserrors = NULL; /* flag optional arrays not allocated */
cquantize->fserrors = NULL; /* flag optional arrays not allocated */
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));
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;
/* First segment of "simple" table: limit[x] = 0 for x < 0 */
memset(table - (MAXJSAMPLE+1), 0, (MAXJSAMPLE+1) * sizeof(JSAMPLE));
/* Main part of "simple" table: limit[x] = x */
for (i = 0; i <= MAXJSAMPLE; 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 */
for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++)
table[i] = MAXJSAMPLE;
/* Second half of post-IDCT table */
memset(table + (2 * (MAXJSAMPLE+1)), 0,
(2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
(2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
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 windowsSystemColourCount = 20;
int paletteShift = 0;
// Shift the palette up by the number of Windows system colours,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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