]> git.saurik.com Git - wxWidgets.git/commitdiff
Mutiple updates from SciTech for wxWindows including the following:
authorKendall Bennett <KendallB@scitechsoft.com>
Wed, 17 Oct 2001 22:25:56 +0000 (22:25 +0000)
committerKendall Bennett <KendallB@scitechsoft.com>
Wed, 17 Oct 2001 22:25:56 +0000 (22:25 +0000)
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

62 files changed:
contrib/include/wx/applet/prepinclude.h
contrib/include/wx/applet/window.h
contrib/src/applet/appletwindow.cpp
contrib/src/applet/prepecho.cpp
contrib/src/applet/prepifelse.cpp
contrib/src/applet/prepinclude.cpp
include/wx/defs.h
include/wx/generic/panelg.h
include/wx/html/htmlwin.h
include/wx/html/winpars.h
include/wx/msw/private.h
include/wx/os2/app.h
include/wx/os2/colour.h
include/wx/os2/dialog.h
include/wx/os2/font.h
include/wx/os2/frame.h
include/wx/os2/notebook.h
include/wx/os2/region.h
include/wx/os2/window.h
include/wx/popupwin.h
include/wx/univ/setup.h
samples/minimal/minimal.rcO
src/common/event.cpp
src/common/extended.c
src/common/file.cpp
src/common/filefn.cpp
src/common/imagtiff.cpp
src/common/quantize.cpp
src/common/timercmn.cpp
src/common/unzip.c
src/generic/panelg.cpp
src/html/htmlwin.cpp
src/msw/bitmap.cpp
src/msw/dc.cpp
src/msw/gaugemsw.cpp
src/msw/ownerdrw.cpp
src/msw/utilsexc.cpp
src/os2/app.cpp
src/os2/clipbrd.cpp
src/os2/dc.cpp
src/os2/dcclient.cpp
src/os2/dialog.cpp
src/os2/dir.cpp
src/os2/dirdlg.cpp
src/os2/font.cpp
src/os2/fontenum.cpp
src/os2/fontutil.cpp
src/os2/frame.cpp
src/os2/gdiimage.cpp
src/os2/gsocket.c
src/os2/pnghand.cpp
src/os2/region.cpp
src/os2/settings.cpp
src/os2/textctrl.cpp
src/os2/thread.cpp
src/os2/utils.cpp
src/os2/window.cpp
src/os2/xpmhand.cpp
src/univ/framuniv.cpp
src/univ/scrarrow.cpp
src/univ/theme.cpp
src/univ/winuniv.cpp

index 12cb6d7e79140cde609f80ec1a2d8060375895cd..21178334d1f41e5effbf611187ac4a5de224a036 100644 (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 *);
     };
        
        
index 753fac62d6f210922b62df26aadd9a5f902cc1f6..e8aac05b146824866785a2cd50198dcfa2255e34 100644 (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);
 
index 6c6d5895dae276e6afd80fa0d38fbe925ef49920..cd9cc4e7dc0ab89b188d197f1ac5b2bee6101d00 100644 (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:
index 85f7198f72b2905512b946131aa15460194d574c..67b38016fea7ab43432c7b6733311099507e8cf4 100644 (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));
                }
        
index 2880af3bef16dde97587bf651001d50ca7e05b49..7cda90bc5f2d857c13edcded85ac47fb48c07213 100644 (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 !";
 
-       
-       // make a copy so we can replace text as we go without affecting the original
+    char ftelif[] = "<!--#elif ";
+       
+    // make a copy so we can replace text as we go without affecting the original
        wxString output = text;
+
+    // Avoid duplication of our parsing code by turning any #elif blocks into appropriate
+    // else/if blocks
+    while ((b = ReverseFind(output.Lower(), ftelif)) != -1) {
+        int e;
+        // Replace beginning of block
+        e = output.find("-->", b + strlen(ftelif));
+
+        if (e == wxString::npos) {
+            #ifdef CHECKED             
+            wxMessageBox("wxHTML #elif error: Premature end of file while parsing #elif.","Error",wxICON_ERROR);
+            #endif
+            break;
+            }
+
+        // Convert to lower case so find is easy, grab everything after #elif tag
+        wxString remains = (output.Mid(e+strlen("-->"))).Lower();
+
+        // find matching else or endif
+        int nextif, nextendif;
+        int ifcount = 1, min = 0;
+        do {
+            nextif = remains.find(ft, min);
+            nextendif = remains.find(ftend, min);
+            if (nextif < nextendif && nextif != wxString::npos) {
+                ifcount++;
+                min = nextif+1;
+                }
+            else {
+                ifcount--;
+                min = nextendif+1;
+                }
+
+            if (nextendif == wxString::npos) {
+                #ifdef CHECKED         
+                wxMessageBox("wxHTML #elif error: Premature end of file before finding #endif.","Error",wxICON_ERROR);
+                #endif
+                break;
+                }
+            // once ifcount reaches 0 again we have found our matchin #endif
+            } while (ifcount > 0);
+
+        // If it couldn't be found die gracefully
+        if (nextendif == wxString::npos) {
+                // We already displayed a message, just break all the way out
+                break;
+                }
+
+        int elifsize = e - (b + strlen(ftelif)) + strlen("-->");
+        // Create the #if/else block, removing the #elif code
+        output = output.Mid(0, b) +
+            wxString(wxString(ftelse)+wxString(ft)) +
+            output.Mid(b+strlen(ftelif), elifsize+nextendif) +
+            wxString(ftend) +
+            output.Mid(b+strlen(ftelif)+elifsize+nextendif);
+
+        }
+       
+    // Parse out the if else blocks themselves
     while ((b = ReverseFind(output.Lower(), ft)) != -1) {
                // Loop until every #if directive is found
                // We search from the end of the string so that #if statements will properly recurse
                // and we avoid the hassle of matching statements with the correct <!--#endif-->
         bool notval = false;
         int off = 0;
-        int end, c, n;
+        int end;
         wxString usecode, code;
         wxString cname;
         wxString tag;
@@ -106,15 +298,6 @@ wxString wxIfElsePrep::Process(
 
         code = wxString("");
 
-        if (output.Mid(b, strlen(ftnot) ).CmpNoCase(ftnot) == 0 ) {
-            notval = true;
-            off = 4;
-            }
-        else if (output.Mid(b, strlen(ftnot2) ).CmpNoCase(ftnot2) == 0 ) {
-            notval = true;
-            off = 1;
-            }
-
         // grab the tag and get the name of the variable
         end = (output.Mid(b)).Find("-->");
         if (end == -1) {
@@ -125,30 +308,14 @@ wxString wxIfElsePrep::Process(
                        }
 
         end += 3;
-        tag = output.Mid(b, end);
+        // remove the <!--#if and --> sections from the tag before passing it on to be parsed
+        tag = output.Mid(b+strlen(ft), end-strlen(ft)-3);
         output.Remove(b, end);
 
-        c = tag.Find("-->");
-        n = c;
-
-        // find the classname
-        c = (tag.Mid(8+off, n-(8+off))).Find(" ");
-           if (c == -1) n -= (8+off);
-        else n = c;
-        cname = tag.Mid(8+off, n);
-
-        cname.Trim(false);
-        c = cname.Find("\"");
-        if (c != -1) cname = cname.Mid(c+1);
-       c = cname.Find("\"");
-           if (c != -1) cname = cname.Mid(0, c);
-
-        // Grab the value from the variable class identified by cname
-        value = wxIfElseVariable::FindValue(cname);
-        if (notval) value = !value;
+        value = ParseIfStatementValue(tag);
 
         // Find the end of the tag (<!--#endif-->) and copy it all into the variable code
-        end = ((output.Mid(b)).Lower()).Find("<!--#endif-->");
+        end = ((output.Mid(b)).Lower()).Find(ftend);
         if (end == -1) {
 #ifdef CHECKED         
             wxMessageBox("wxHTML #if error: Premature end of file while searching for matching #endif.","Error",wxICON_ERROR);
@@ -157,14 +324,14 @@ wxString wxIfElsePrep::Process(
                        }
 
         code = output.Mid(b, end);
-        output.Remove(b, end+13); // remove the entire #if block from original document
+        output.Remove(b, end+strlen(ftend)); // remove the entire #if block from original document
 
         // Find out if there is an else statement
-        end = (code.Lower()).Find("<!--#else-->");
+        end = (code.Lower()).Find(ftelse);
         if (end != -1) {
             if (!value) {
                 // Use the else statement
-                usecode = code.Mid(end+12);
+                usecode = code.Mid(end+strlen(ftelse));
                 }
             else {
                 // Use statement before #else
index b9678148a7611833667511713f33cc7c7e1f0e7b..83d494875e8818b05257a301562b92441e33a292 100644 (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;
 }
 
index 7fbae0d9ede68f304717bb54ad6165e88a16cd07..5de3bdf6974dc077e576066a3fdf6837f48f1529 100644 (file)
 
 // 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
index dfda5d8ef0786838ad9a11ce35c1db6b4a382059..076011ac792eff8a6ccf36e350114cfa19d56eb4 100644 (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:
index debdcb626f9f571ddd355a0980fa0e11a04706a7..5ef878c088555e1b39d94cd4d24fafc42abe46c2 100644 (file)
@@ -240,3 +240,4 @@ private:
 #endif
 
 #endif // _WX_HTMLWIN_H_
+
index 1b6b02a6d67ec1d2e3b6679e6918353528ac82d7..69f81a56a1958658f774dbfca4a7e5d8a589bc41 100644 (file)
@@ -49,7 +49,7 @@ public:
 
     // Set's the DC used for parsing. If SetDC() is not called,
     // 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; }
 
     wxDC *GetDC() {return m_DC;}
@@ -61,13 +61,13 @@ public:
     // height/width. They return h/w of default font
     // for this DC. If you want actual values, call
     // GetDC()->GetChar...()
+
     // returns associated wxWindow
     wxWindow *GetWindow() {return m_Window;}
 
     // sets fonts to be used when displaying HTML page.
     void SetFonts(wxString normal_face, wxString fixed_face, const int *sizes);
+
     // Adds tags module. see wxHtmlTagsModule for details.
     static void AddModule(wxHtmlTagsModule *module);
 
@@ -236,3 +236,4 @@ public:
 
 
 
+
index dffa2e32af48345ae57535a70be25f0159841b76..d643ce0773b0b33d07dd95450e5fcffbec236cef 100644 (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)
index 35a8cc9440bf386fbd053a3c40ef4d11627147fd..31d405384db6435064beb7d13ad534de3f4511c6 100644 (file)
 #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"
 
index b82c55433e3c0b653de840d908960ff411cf3b08..e706844681353f08e3177b5f7b42fb7476f47c15 100644 (file)
@@ -35,6 +35,8 @@ public:
              ,unsigned char cBlue
             );
 
+    wxColour( unsigned long colRGB ) { Set(colRGB); }
+
     //
     // Implicit conversion from the colour name
     //
index 5a01bed637ad96ddbe888856ca193308f4b9f8a2..49f5af72ec8139479c470a1bd06ce53f271aab03 100644 (file)
@@ -41,6 +41,7 @@ public:
     {
         long                        lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
 
+        bModal = false;
         Create( pParent
                ,-1
                ,rsTitle
index fc8c8e55560eb7f1915173d7d7be4773759933fe..a40017aec141e9f961d80a80644acdd95a88b9b4 100644 (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
index ed2be613806a2d2626be6d43f13b653d6718a846..cb078d738007407cb3aba2bd9079775a5384e3b4 100644 (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
index 7e533d6966b429072280860efd2c0753b381c9be..2a1b3b95a1017372292f4bf40b5980cd2238050a 100644 (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);
 
 // ----------------------------------------------------------------------------
index 0fca2f9090eefe1c77198edeb53db7449d391b49..e8868bf6315e49dbe3f7ce2abb88f254a9d02aa6 100644 (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();
index edc0e474bbeffdc8589695bb8d0e8d0a759109c5..23c386d90dbf97081d4fd7c8aaa2579eda1b3504 100644 (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);
index 85ce6295e64d869479692f4204e7af92038702d5..accdde8d5d9610b81fe83a78497d7df3574d4849 100644 (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__
index d03467448f8d131f1d3b6e935872703dfe1a9e0d..197d646c420d3ab178918c9001c21a86a4e6d67e 100644 (file)
@@ -15,7 +15,7 @@
 // ----------------------------------------------------------------------------
 // undef everything
 // ----------------------------------------------------------------------------
-#ifdef __WXMAC__
+#if defined(__WXMAC__)
 
 #define wxUSE_GUI            1
 #define WXWIN_COMPATIBILITY  0
@@ -63,7 +63,7 @@
 #define wxUSE_FFILE               1
 #define wxUSE_TEXTFILE            0
 #define wxUSE_INTL                0
-#define wxUSE_MENUS 0 // was 1 
+#define wxUSE_MENUS 0 // was 1
 #define wxUSE_TOOLBAR 0
 #define wxUSE_TOOLBAR_NATIVE 0
 #define wxUSE_TOOLBAR_SIMPLE 0
 #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
index 42078bed505ec156c8ed1df8e466be941d939adc..3d546d491698f56948cc93c9b73f66603438e301 100644 (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
 
index f75175f1654c9bce1f549674f388d7ae8b269e94..221360d838a463bba53f53e8fd9ddac87a15e373 100644 (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__)
index cf9f95fd2f8e3e805ae9ca2e55185079d7ad4834..e6869ff475a99a78ad73d18c017f13020f24f1e7 100644 (file)
@@ -1,3 +1,4 @@
+#include "wx/defs.h"
 #include "wx/setup.h"
 
 #include <math.h>
index b662a72b34428070b4c1539b6d3a4f4572f236b6..667b99a32c19d318f63d23ac5294c4b3805a03ac 100644 (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);
index 1f02317c40acec0b7bf7abe9e3b6fabbf2f58dbc..ada206ba1c3e16a77428fd5f3d0bfa5871c0cbd2 100644 (file)
@@ -299,7 +299,7 @@ wxIsAbsolutePath (const wxString& filename)
         // This seems wrong to me, but there is no fix. since
         // "MacOS:MyText.txt" is absolute whereas "MyDir:MyText.txt"
         // is not. Or maybe ":MyDir:MyText.txt" has to be used? RR.
-    
+
         if (filename.Find(':') != wxNOT_FOUND && filename[0] != ':')
             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
     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 ) ;
-               
-               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__)
+    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 ;
+
+    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
index c030a83c848aff8fcb90219b68aaa49b0b75de23..182a16f33af422a8b71c405dddba78f394ad4b39 100644 (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)
index 07c63c52e246df6542279b99013b887be1413fd1..47ca3a956d2317df58d39041f569bb7d9de9962b 100644 (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,
index 234ea9e0c29c81299a05b91369b552a236217921..7746d40ca743c75651a0061c68f67095d5c51122 100644 (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
index 02a37dc16c5f4d02923baec9ed5ee167a0ec5124..402cd3cf0fef87c6201d238c2295ce1cf21e4a4b 100644 (file)
@@ -13,7 +13,7 @@ $Id$
 */
 
 
-
+#include "wx/defs.h"
 #include "wx/setup.h"
 
 #if wxUSE_ZLIB && wxUSE_ZIPSTREAM
@@ -854,11 +854,11 @@ extern int ZEXPORT unzLocateFile (file, szFileName, iCaseSensitivity)
     const char *c;
     char *c2;
     char szFileName2[UNZ_MAXFILENAMEINZIP+1];
-    
+
        uLong num_fileSaved;
        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 = '/';
         else *c2 = *c;
     *c2 = '\0';
index 249c75e9d6b4401c2a6fd389d0b6a7b8e39da359..927afc68fff4886a66562c6b70a086e3012859a7 100644 (file)
@@ -81,6 +81,13 @@ wxPanel::~wxPanel()
 {
 }
 
+void wxPanel::InitDialog()
+{
+    wxInitDialogEvent event(GetId());
+    event.SetEventObject(this);
+    GetEventHandler()->ProcessEvent(event);
+}
+
 // ----------------------------------------------------------------------------
 // event handlers
 // ----------------------------------------------------------------------------
index ada2a4d19e587ff54bf62ac82017900994c7849e..0f5fc11366aae060807e9cf4eea4cb7b5b0fdfd1 100644 (file)
@@ -618,7 +618,7 @@ void wxHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
 void wxHtmlWindow::OnCellClicked(wxHtmlCell *cell,
                                  wxCoord x, wxCoord y,
                                  const wxMouseEvent& event)
-{ 
+{
     wxCHECK_RET( cell, _T("can't be called with NULL cell") );
 
     cell->OnMouseClick(this, x, y, event);
@@ -785,4 +785,4 @@ IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule, wxModule)
 #include "wx/html/forcelnk.h"
 FORCE_WXHTML_MODULES()
 
-#endif
+#endif
\ No newline at end of file
index a68e54fa7dbf1e4e18c8b9bc21c7effa742771fb..df9dcd8c70d12b07dd5ece02d5d82154b2285bec 100644 (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 );
index 596a748cf3917739ff11776631d9668fa5c21502..dcf230b0b696e7ae133f6fa47b8ac29ae890bccd 100644 (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;
 
index ee41a2ac0ea19a4115d198f38d79906ff05601e3..380a30e516691b774bd401402acea5710886d8c1 100644 (file)
@@ -25,7 +25,7 @@
 #include "wx/utils.h"
 #endif
 
-#if wxUSE_GAUGE 
+#if wxUSE_GAUGE
 
 #include "wx/msw/gaugemsw.h"
 #include "wx/msw/private.h"
@@ -128,12 +128,12 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id,
     wOrient = ZYZG_ORIENT_LEFTTORIGHT;
   else
     wOrient = ZYZG_ORIENT_BOTTOMTOTOP;
-  
+
   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;
 }
@@ -218,7 +218,7 @@ bool wxGaugeMSW::SetBackgroundColour(const wxColour& col)
 
 /** zyz3d.c
  *
- *  DESCRIPTION: 
+ *  DESCRIPTION:
  *      This module contains functions for creating nifty 3D borders
  *      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)
  *
- *  DESCRIPTION: 
+ *  DESCRIPTION:
  *      This function draws a flat frame with the current button-face
  *      color.
  *
@@ -330,7 +330,7 @@ void FAR PASCAL Draw3DFaceFrame(HDC hdc, LPRECT rc, WORD wWidth)
 
 /** void FAR PASCAL Draw3DRect(HDC, LPRECT, WORD, WORD)
  *
- *  DESCRIPTION: 
+ *  DESCRIPTION:
  *      Draws a 3D rectangle that is shaded.  wFlags can be used to
  *      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,
  *
- *  DESCRIPTION: 
+ *  DESCRIPTION:
  *      Draws a 3D line that can be used to make a 3D box.
  *
  *  ARGUMENTS:
@@ -431,7 +431,7 @@ void FAR PASCAL Draw3DRect(HDC hdc, LPRECT lpRect,
  ** cjp */
 
 void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
-                               WORD wShadowWidth, WORD wFlags) 
+                               WORD wShadowWidth, WORD wFlags)
 {
     HBRUSH  hOldBrush;
     HPEN    hOldPen;
@@ -446,7 +446,7 @@ void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
     Point[0].x = x;
     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
      *  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' */
         fDark = (wFlags & DRAW3D_IN) ? TRUE : FALSE;
     }
-    
+
     /* well maybe it's for the right side? */
     else if (wFlags & DRAW3D_RIGHTLINE)
     {
@@ -549,7 +549,7 @@ void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen,
 
 /** zyzgauge.c
  *
- *  DESCRIPTION: 
+ *  DESCRIPTION:
  *      Yet another 'Gas Gauge Custom Control.'  This control gives you
  *      a 'progress bar' class (named zYzGauge) for use in your applications.
  *      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 wxChar gszzYzGaugeClass[] = wxT("zYzGauge");
-    
+
 
 /* window word position definitions */
 #define ZYZG_WW_PZYZGAUGE   0
@@ -692,7 +692,7 @@ static BOOL     fSupport3D;
 #if !defined(APIENTRY)    // NT defines APIENTRY, 3.x not
 #define APIENTRY FAR PASCAL
 #endif
+
 #ifdef __WIN32__
 #define _EXPORT /**/
 #else
@@ -709,7 +709,7 @@ LRESULT APIENTRY _EXPORT gaugeWndProc(HWND, UINT, WPARAM, LPARAM);
 
 /** BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance)
  *
- *  DESCRIPTION: 
+ *  DESCRIPTION:
  *      Registers the window class for the zYzGauge control.  Performs
  *      other initialization for the zYzGauge text control.  This must
  *      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;
     WNDCLASS    wc;
     HDC         hdc;
-    
+
     /* assume already registered if not first instance */
     if (fRegistered)
         return (TRUE);
@@ -776,7 +776,7 @@ BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance)
         }
 
         /* good! we have color: blue foreground, white background */
-        else 
+        else
         {
             rgbDefTextColor = RGB(0, 0, 255);
             rgbDefBkColor = RGB(255, 255, 255);
@@ -804,7 +804,7 @@ BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance)
 
 /** static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
  *
- *  DESCRIPTION: 
+ *  DESCRIPTION:
  *      This function is responsible for painting the zYzGauge control.
  *
  *  ARGUMENTS:
@@ -876,7 +876,7 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
         /* add all the other pixels into the border width */
         Offset += (2 * pgauge->wWidth3D) + pgauge->wWidthBezelFace + 1;
     }
-   
+
     /* dup--one rc for 'how much filled', one rc for 'how much empty' */
     rc2 = rc1;
 
@@ -925,7 +925,7 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc)
     dwExtent = size.cx;
 #else
     dwExtent = GetTextExtent(hdc, ach, wGomerX = lstrlen(ach));
-#endif  
+#endif
 
 
     /*  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 */
     SelectObject(hdc, hFont);
 } /* gaugePaint() */
-  
+
 
 /** 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
  *      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
  *                                  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.
  *
  *          ZYZG_SETPOSITION    :   Sets the current position of the gauge.
index 9e37e54adaf9bd9e994d6aae2f22407cdf0ce10e..010429a8783f8fe40e055decf4578f9b68bdad42 100644 (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
index e63bb93ba0f3d2172379c6b9d0aefef4e5c9942d..8fcae76c3c5789222d8cab80b2d7614bd1735ec6 100644 (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);
index 6ef2a2253d6e1220891dd821d2ab0e8d04d5440d..f95e76b44bfc01db7b06e733498e0d0166c745df 100644 (file)
 
 #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
 
index 9e7824568ecd08ae21a8a3a9696e847e6cf50abb..2618dc688536171494dbff10719574db76716e43 100644 (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
 }
 
index c0f1fefcd4c7e747bd837345e85cb19c04b8c93b..d2fe58841f1c9dcba262546909b3d211028c5526 100644 (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;
 
index c034242afef449a6fe60309c8572cbc853f2bb0d..74264492a43e35788d0f68dabecfa67de49b6e00 100644 (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
 
index a0b3fa7c7be5b2f598c37a665fb84567b0650b02..aff9dac0157f71310a06426da6d6bf3cfc7c4c3b 100644 (file)
@@ -157,7 +157,7 @@ wxDialog::~wxDialog()
     m_isBeingDeleted = TRUE;
     wxTopLevelWindows.DeleteObject(this);
     Show(FALSE);
-    if (!IsModal)
+    if (!IsModal())
         wxModelessWindows.DeleteObject(this);
 
     //
index befb4533baf6e17dac75b53cdbefe958ccc68cc7..c7844fb1f4036865a762d2d704cccb9bafe8718a 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/types.h>
 
 #define INCL_DOSFILEMGR
+#define INCL_DOSERRORS
 #include <os2.h>
 
 #ifdef __EMX__
index 31dd1bf89b1628f4f99881d068a9d1a2a94ba84f..c4a85eef972f6374b0ad9bb8ad4e111e748fb1b4 100644 (file)
@@ -27,7 +27,6 @@
 #include "wx/os2/private.h"
 #include "wx/cmndata.h"
 
-#include <math.h>
 #include <stdlib.h>
 #include <string.h>
 
index 0b60d983789bd21908894edced075e81b5eef4f6..5f42a49ab85a6857f5b591553089d7ac67f46ad6 100644 (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 )
index 00454cee9bf07d93bfa171a2e3d1f13126bfb31a..476798911f0ab5bc727294adbd165b45071a4bed 100644 (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
index 7fb1ff865ce045b0c4ede82d4ecdb338861a6a7d..fe12e118393a9ae102f58728a39cd270a7fd4e18 100644 (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
index f64008680829526c085212b28d441531455ff427..b7a9a6729ba1642e46fba5cf499d35238a688cae 100644 (file)
 extern wxWindowList wxModelessWindows;
 extern wxList WXDLLEXPORT wxPendingDelete;
 extern wxChar wxFrameClassName[];
+
+#if wxUSE_MENUS_NATIVE
 extern wxMenu *wxCurrentPopupMenu;
+#endif
 
-extern void  wxAssociateWinWithHandle( HWND      hWnd
-                                      ,wxWindow* pWin
+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))
         {
index 8c1fe4a289b3ef9205ee4ac1b1aa735c5fb048e6..dcb5e1d4df2aa8fa230664459a7ae8279cfe1c99 100644 (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);
index d3078a272d1ab9c20c08a82792405eabad9a83e3..222c0e24d1149e96e1dc67d01282de9eca769e50 100644 (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>
 
 #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;
index ef2eacda48928a855e26d04c16171610ae3d65ef..56cdb1f65456371b6f27130a80cb651b8bd63e1a 100644 (file)
 #   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));
index b3ff3e34d72f7903b1407761fcdc80d77cc876a9..733998bbf754a61b0bc162efdd27558a64c95020 100644 (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
                            );
index 7983add4ee62cb342a436146a14a53d7a9bbfca9..05ba3aaf808e493eb7ad038fe50703d06af32437 100644 (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"
index 2849aec84f07e89727e1c78aa3623b328ced8a79..8fe19038cf05699b011c17dcb61240e65ade45cb 100644 (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
index 94de24c7cdc4d2353d6cf4f6b4c5a488db934f68..f7890fa08475d3c64e56a3618de93ddb458df216 100644 (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
index a4531b6a12b420b56941ca814baac0782592fe8e..5f9b616d9e6a419dd83043be7b526c380abcfe55 100644 (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;
-
-    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);
+    static LONG                     nDepth = 0;
+
+    // The screen colordepth ain't gonna change. No reason to query
+    // it over and over!
+    if (!nDepth) {
+        hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
+        hdcScreen = ::GpiQueryDevice(hpsScreen);
+        ::DevQueryCaps(hdcScreen, CAPS_COLOR_PLANES, 1L, &lPlanes);
+        ::DevQueryCaps(hdcScreen, CAPS_COLOR_BITCOUNT, 1L, &lBitsPerPixel);
+
+        nDepth = (int)(lPlanes * lBitsPerPixel);
+        ::DevCloseDC(hdcScreen);
+        ::WinReleasePS(hpsScreen);
+    }
     return (nDepth);
 }
 
@@ -787,14 +798,18 @@ void wxDisplaySize(
 {
     HPS                             hpsScreen;
     HDC                             hdcScreen;
-    LONG                            lWidth;
-    LONG                            lHeight;
-
-    hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
-    hdcScreen = ::GpiQueryDevice(hpsScreen);
-    ::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, &lWidth);
-    ::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, &lHeight);
-    DevCloseDC(hdcScreen);
+    static LONG                     lWidth  = 0;
+    static LONG                     lHeight = 0;
+
+    // The screen size ain't gonna change either so just cache the values
+    if (!lWidth) {
+        hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
+        hdcScreen = ::GpiQueryDevice(hpsScreen);
+        ::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, &lWidth);
+        ::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, &lHeight);
+        ::DevCloseDC(hdcScreen);
+        ::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)
index bd50f98ca95ba20f8d9690ede9e90042d3624b7c..70e3b0958e5aeb6981ea452808b4b79023b12503 100644 (file)
@@ -33,6 +33,7 @@
     #include "wx/listbox.h"
     #include "wx/button.h"
     #include "wx/msgdlg.h"
+    #include "wx/scrolwin.h"
 
     #include <stdio.h>
 #endif
 // ---------------------------------------------------------------------------
 
 //
-// The last Windows message we got (MT-UNSAFE)
+// The last PM message we got (MT-UNSAFE)
 //
 QMSG                      s_currentMsg;
 
+#if wxUSE_MENUS_NATIVE
 wxMenu*                   wxCurrentPopupMenu = NULL;
-extern wxList WXDLLEXPORT wxPendingDelete;
+#endif // wxUSE_MENUS_NATIVE
+
 #if !defined(__VISAGECPP__) || (__IBMCPP__ < 400)
 extern wxChar             wxCanvasClassName[];
 #endif
@@ -121,9 +124,9 @@ MRESULT EXPENTRY wxWndProc( HWND hWnd
     const char *wxGetMessageName(int message);
 #endif  //__WXDEBUG__
 
-void      wxRemoveHandleAssociation(wxWindow* pWin);
-void      wxAssociateWinWithHandle( HWND      hWnd
-                                   ,wxWindow* pWin
+void      wxRemoveHandleAssociation(wxWindowOS2* pWin);
+void      wxAssociateWinWithHandle( HWND         hWnd
+                                   ,wxWindowOS2* pWin
                                   );
 wxWindow* wxFindWinFromHandle(WXHWND hWnd);
 
@@ -131,12 +134,14 @@ wxWindow* wxFindWinFromHandle(WXHWND hWnd);
 // This magical function is used to translate VK_APPS key presses to right
 // mouse clicks
 //
+// Unused?
+#if 0
 static void TranslateKbdEventToMouse( wxWindow* pWin
                                      ,int*      pX
                                      ,int*      pY
                                      ,MPARAM*   pFlags
                                     );
-
+#endif
 //
 // get the current state of SHIFT/CTRL keys
 //
@@ -146,9 +151,15 @@ static inline bool IsCtrlDown() { return (::WinGetKeyState(HWND_DESKTOP, VK_CTRL
 // event tables
 // ---------------------------------------------------------------------------
 
+// in wxUniv-OS/2 this class is abstract because it doesn't have DoPopupMenu()
+// method
+#ifdef __WXUNIVERSAL__
+    IMPLEMENT_ABSTRACT_CLASS(wxWindowOS2, wxWindowBase)
+#else // __WXPM__
     IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+#endif // __WXUNIVERSAL__/__WXPM__
 
-BEGIN_EVENT_TABLE(wxWindow, wxWindowBase)
+BEGIN_EVENT_TABLE(wxWindowOS2, wxWindowBase)
     EVT_ERASE_BACKGROUND(wxWindowOS2::OnEraseBackground)
     EVT_SYS_COLOUR_CHANGED(wxWindowOS2::OnSysColourChanged)
     EVT_INIT_DIALOG(wxWindowOS2::OnInitDialog)
@@ -160,6 +171,10 @@ END_EVENT_TABLE()
 // implementation
 // ===========================================================================
 
+// ---------------------------------------------------------------------------
+// wxWindow utility functions
+// ---------------------------------------------------------------------------
+
 //
 // Find an item given the PM Window id
 //
@@ -167,21 +182,24 @@ wxWindow* wxWindowOS2::FindItem(
   long                              lId
 ) const
 {
-    wxControl*                      pItem = wxDynamicCast( this
-                                                          ,wxControl
-                                                         );
+#if wxUSE_CONTROLS
+    wxControl*                      pItem = wxDynamicCast(this, wxControl);
 
     if (pItem)
     {
         //
         // I it we or one of our "internal" children?
         //
-        if (pItem->GetId() == lId ||
-             (pItem->GetSubcontrols().Index(lId) != wxNOT_FOUND))
+        if (pItem->GetId() == lId
+#ifndef __WXUNIVERSAL__
+            || (pItem->GetSubcontrols().Index(lId) != wxNOT_FOUND)
+#endif
+            )
         {
             return pItem;
         }
     }
+#endif // wxUSE_CONTROLS
 
     wxWindowList::Node*             pCurrent = GetChildren().GetFirst();
 
@@ -220,7 +238,11 @@ wxWindow* wxWindowOS2::FindItemByHWND(
         if (pWnd)
             return(pWnd);
 
-        if (!bControlOnly || pParent->IsKindOf(CLASSINFO(wxControl)))
+        if (!bControlOnly
+#if wxUSE_CONTROLS
+            || pParent->IsKindOf(CLASSINFO(wxControl))
+#endif // wxUSE_CONTROLS
+            )
         {
             wxWindow*               pItem = pCurrent->GetData();
 
@@ -316,9 +338,11 @@ wxWindowOS2::~wxWindowOS2()
                 pFrame->SetLastFocus((wxWindow*)NULL);
         }
     }
+
+    DestroyChildren();
+
     if (m_parent)
         m_parent->RemoveChild(this);
-    DestroyChildren();
 
     if (m_hWnd)
     {
@@ -331,6 +355,7 @@ wxWindowOS2::~wxWindowOS2()
     }
 } // end of wxWindowOS2::~wxWindowOS2
 
+// real construction (Init() must have been called before!)
 bool wxWindowOS2::Create(
   wxWindow*                         pParent
 , wxWindowID                        vId
@@ -342,7 +367,8 @@ bool wxWindowOS2::Create(
 {
     HWND                            hParent = NULLHANDLE;
     wxPoint                         vPos = rPos; // The OS/2 position
-    ULONG                           ulCreateFlags = 0L;
+    ULONG                           ulCreateFlags = 0;
+    WXDWORD                         dwExStyle = 0;
 
     wxCHECK_MSG(pParent, FALSE, wxT("can't create wxWindow without parent"));
 
@@ -402,6 +428,10 @@ bool wxWindowOS2::Create(
     ulCreateFlags |=  WS_VISIBLE;
 
 
+#ifdef __WXUNIVERSAL__
+    // no 3d effects, we draw them ourselves
+    WXDWORD exStyle = 0;
+#else // !wxUniversal
     if (lStyle & wxCLIP_SIBLINGS)
         ulCreateFlags |= WS_CLIPSIBLINGS;
 
@@ -412,9 +442,9 @@ bool wxWindowOS2::Create(
     //
     //
     bool                            bWant3D;
-    WXDWORD                         dwExStyle = Determine3DEffects( WS_EX_CLIENTEDGE
-                                                                   ,&bWant3D
-                                                                  );
+    dwExStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &bWant3D);
+
+#endif
 
     //
     // Add the simple border style as we'll use this to draw borders
@@ -422,6 +452,17 @@ bool wxWindowOS2::Create(
     if (lStyle & wxSIMPLE_BORDER)
         dwExStyle |= wxSIMPLE_BORDER;
 
+    if (lStyle & wxPOPUP_WINDOW)
+    {
+        // a popup window floats on top of everything
+//TODO: fix this...
+//        exStyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
+
+        // it is also created hidden as other top level windows
+        ulCreateFlags &= ~WS_VISIBLE;
+        m_isShown = FALSE;
+    }
+
     //
     // Generic OS/2 Windows are created with no owner, no Z Order, no Control data,
     // and no presentation parameters
@@ -452,6 +493,7 @@ bool wxWindowOS2::Create(
 void wxWindowOS2::SetFocus()
 {
     HWND                            hWnd = GetHwnd();
+    wxCHECK_RET( hWnd, _T("can't set focus to invalid window") );
 
     if (hWnd)
         ::WinSetFocus(HWND_DESKTOP, hWnd);
@@ -489,7 +531,7 @@ bool wxWindowOS2::Enable(
         pChild->Enable(bEnable);
         pNode = pNode->GetNext();
     }
-    return(TRUE);
+    return TRUE;
 } // end of wxWindowOS2::Enable
 
 bool wxWindowOS2::Show(
@@ -507,7 +549,7 @@ bool wxWindowOS2::Show(
     {
         ::WinSetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER);
     }
-    return(TRUE);
+    return TRUE;
 } // end of wxWindowOS2::Show
 
 void wxWindowOS2::Raise()
@@ -575,7 +617,7 @@ bool wxWindowOS2::SetFont(
         wxChar                      zFont[128];
 
         sprintf(zFont, "%d.%s", rFont.GetPointSize(), rFont.GetFaceName().c_str());
-        return(::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont));
+        return (bool)::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont), (PVOID)zFont);
     }
     return(TRUE);
 }
@@ -590,25 +632,18 @@ bool wxWindowOS2::SetCursor(
         return FALSE;
     }
 
-    wxASSERT_MSG( m_cursor.Ok(),
-                  wxT("cursor must be valid after call to the base version"));
+    if ( m_cursor.Ok() ) {
+        HWND                            hWnd = GetHwnd();
+        POINTL                          vPoint;
+        RECTL                           vRect;
 
-    HWND                            hWnd = GetHwnd();
-    POINTL                          vPoint;
-    RECTL                           vRect;
-    HPS                             hPS;
-    HRGN                            hRGN;
-
-    hPS = ::WinGetPS(hWnd);
-
-    ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
-    ::WinQueryWindowRect(hWnd, &vRect);
-
-    hRGN = ::GpiCreateRegion(hPS, 1L, &vRect);
+        ::WinQueryPointerPos(HWND_DESKTOP, &vPoint);
+        ::WinQueryWindowRect(hWnd, &vRect);
 
-    if ((::GpiPtInRegion(hPS, hRGN, &vPoint) == PRGN_INSIDE) && !wxIsBusy())
-    {
-        ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
+        if (::WinPtInRect(vHabmain, &vRect, &vPoint) && !wxIsBusy())
+        {
+            ::WinSetPointer(HWND_DESKTOP, (HPOINTER)m_cursor.GetHCURSOR());
+        }
     }
     return TRUE;
 } // end of wxWindowOS2::SetCursor
@@ -740,21 +775,21 @@ int wxWindowOS2::GetScrollThumb(
 void wxWindowOS2::SetScrollPos(
   int                               nOrient
 , int                               nPos
-, bool                              bRefresh
+, bool                              WXUNUSED(bRefresh)
 )
 {
     if (nOrient == wxHORIZONTAL )
         ::WinSendMsg(m_hWndScrollBarHorz, SBM_SETPOS, (MPARAM)nPos, (MPARAM)NULL);
     else
         ::WinSendMsg(m_hWndScrollBarVert, SBM_SETPOS, (MPARAM)nPos, (MPARAM)NULL);
-} // end of wxWindowOS2::SetScrollPos(
+} // end of wxWindowOS2::SetScrollPos
 
 void wxWindowOS2::SetScrollbar(
   int                               nOrient
 , int                               nPos
 , int                               nThumbVisible
 , int                               nRange
-, bool                              bRefresh
+, bool                              WXUNUSED(bRefresh)
 )
 {
     int                             nOldRange = nRange - nThumbVisible;
@@ -1162,7 +1197,7 @@ void wxWindowOS2::SetupColours()
 } // end of wxWindowOS2::SetupColours
 
 void wxWindowOS2::OnIdle(
-  wxIdleEvent&                      rEvent
+  wxIdleEvent&                      WXUNUSED(rEvent)
 )
 {
     //
@@ -1224,7 +1259,7 @@ bool wxWindowOS2::Reparent(
 
 void wxWindowOS2::Clear()
 {
-    wxClientDC                      vDc(this);
+    wxClientDC                      vDc((wxWindow*)this);
     wxBrush                         vBrush( GetBackgroundColour()
                                            ,wxSOLID
                                           );
@@ -1375,10 +1410,12 @@ void wxWindowOS2::DoGetPosition(
         // We may be faking the client origin. So a window that's really at (0,
         // 30) may appear (to wxWin apps) to be at (0, 0).
         //
-        wxPoint                     vPt(pParent->GetClientAreaOrigin());
+        if (pParent) {
+            wxPoint                     vPt(pParent->GetClientAreaOrigin());
 
-        vPoint.x -= vPt.x;
-        vPoint.y -= vPt.y;
+            vPoint.x -= vPt.x;
+            vPoint.y -= vPt.y;
+        }
     }
 
     if (pX)
@@ -1393,14 +1430,18 @@ void wxWindowOS2::DoScreenToClient(
 ) const
 {
     HWND                            hWnd = GetHwnd();
-    SWP                             vSwp;
+    POINTL                          ptl;
+
+    ptl.x = pX ? *pX : 0;
+    ptl.y = pY ? *pY : 0;
 
-    ::WinQueryWindowPos(hWnd, &vSwp);
+    ::WinMapWindowPoints(HWND_DESKTOP, hWnd, &ptl, 1);
 
     if (pX)
-        *pX -= vSwp.x;
+        *pX = ptl.x;
     if (pY)
-        *pY -= vSwp.y;
+        *pY = ptl.y;
+
 } // end of wxWindowOS2::DoScreenToClient
 
 void wxWindowOS2::DoClientToScreen(
@@ -1409,14 +1450,17 @@ void wxWindowOS2::DoClientToScreen(
 ) const
 {
     HWND                            hWnd = GetHwnd();
-    SWP                             vSwp;
+    POINTL                          ptl;
 
-    ::WinQueryWindowPos(hWnd, &vSwp);
+    ptl.x = pX ? *pX : 0;
+    ptl.y = pY ? *pY : 0;
+
+    ::WinMapWindowPoints(hWnd, HWND_DESKTOP, &ptl, 1);
 
     if (pX)
-        *pX += vSwp.x;
+        *pX = ptl.x;
     if (pY)
-        *pY += vSwp.y;
+        *pY = ptl.y;
 } // end of wxWindowOS2::DoClientToScreen
 
 //
@@ -1506,21 +1550,12 @@ void wxWindowOS2::DoSetSize(
     int                             nCurrentHeight;
     wxSize                          vSize(-1, -1);
 
-    GetPosition( &nCurrentX
-                ,&nCurrentY
-               );
-    GetSize( &nCurrentWidth
-            ,&nCurrentHeight
-           );
+    GetPosition(&nCurrentX, &nCurrentY);
+    GetSize(&nCurrentWidth, &nCurrentHeight);
 
-    //
     // ... and don't do anything (avoiding flicker) if it's already ok
-    //
-    if ( nX == nCurrentX &&
-         nY == nCurrentY &&
-         nWidth == nCurrentWidth &&
-         nHeight == nCurrentHeight
-       )
+    if (nX == nCurrentX && nY == nCurrentY &&
+        nWidth == nCurrentWidth && nHeight == nCurrentHeight)
     {
         return;
     }
@@ -1530,10 +1565,7 @@ void wxWindowOS2::DoSetSize(
     if (nY == -1 && !(nSizeFlags & wxSIZE_ALLOW_MINUS_ONE))
         nY = nCurrentY;
 
-    AdjustForParentClientOrigin( nX
-                                ,nY
-                                ,nSizeFlags
-                               );
+    AdjustForParentClientOrigin(nX, nY, nSizeFlags);
 
     if (nWidth == -1)
     {
@@ -1582,6 +1614,7 @@ void wxWindowOS2::DoSetClientSize(
 {
     wxWindow*                       pParent = GetParent();
     HWND                            hWnd = GetHwnd();
+#if 0
     HWND                            hParentWnd = (HWND)0;
     HWND                            hClientWnd = (HWND)0;
     RECTL                           vRect;
@@ -1613,23 +1646,51 @@ void wxWindowOS2::DoSetClientSize(
     vPoint.x = vRect2.xLeft;
     vPoint.y = vRect2.yBottom;
     if (pParent)
-    {
+    {             x
         vPoint.x -= vRect3.xLeft;
         vPoint.y -= vRect3.yBottom;
     }
+#else
+    HWND                            hParentWnd = (HWND)0;
+    HWND                            hClientWnd = (HWND)0;
+    RECTL                           vRect;
+    RECT                            vRect2;
 
-    DoMoveWindow( vPoint.x
-                 ,vPoint.y
-                 ,nActualWidth
-                 ,nActualHeight
-                );
+    hClientWnd = ::WinWindowFromID(GetHwnd(), FID_CLIENT);
+    ::WinQueryWindowRect(hClientWnd, &vRect2);
+    ::WinQueryWindowRect(hWnd, &vRect2);
 
-    wxSizeEvent                     vEvent( wxSize( nWidth
-                                                  ,nHeight
-                                                 )
-                                           ,m_windowId
-                                          );
+    if (pParent)
+        hParentWnd = (HWND) pParent->GetHWND();
 
+    ::WinQueryWindowRect(hWnd, &vRect);
+    //
+    // Find the difference between the entire window (title bar and all)
+    // and the client area; add this to the new client size to move the
+    // window. OS/2 is backward from windows on height
+    //
+    int nActualWidth  = vRect2.xRight - vRect2.xLeft - vRect.xRight + nWidth;
+    int nActualHeight = vRect2.yTop - vRect2.yBottom - vRect.yTop + nHeight;
+
+    nActualWidth  = nWidth;
+    nActualHeight = nHeight;
+    //
+    // If there's a parent, must subtract the parent's bottom left corner
+    // since MoveWindow moves relative to the parent
+    //
+    POINTL                          vPoint;
+
+    vPoint.x = vRect2.xLeft;
+    vPoint.y = vRect2.yBottom;
+    if (pParent)
+    {
+        ::WinMapWindowPoints(hWnd, hParentWnd, &vPoint, 1);
+    }
+#endif
+
+    DoMoveWindow(vPoint.x, vPoint.y, nActualWidth, nActualHeight);
+
+    wxSizeEvent                     vEvent(wxSize(nWidth, nHeight), m_windowId);
     vEvent.SetEventObject(this);
     GetEventHandler()->ProcessEvent(vEvent);
 } // end of wxWindowOS2::DoSetClientSize
@@ -1647,7 +1708,6 @@ int wxWindowOS2::GetCharHeight() const
 {
     HPS                             hPs;
     FONTMETRICS                     vFontMetrics;
-    BOOL                            bRc;
 
     hPs = ::WinGetPS(GetHwnd());
 
@@ -1689,6 +1749,13 @@ void wxWindowOS2::GetTextExtent(
     HPS                             hPs;
 
     hPs = ::WinGetPS(GetHwnd());
+
+    // Just prevent compiler warnings
+    wxString dummy = rString;
+    pX = pX;
+    pY = pY;
+    pDescent = pDescent;
+    pExternalLeading = pExternalLeading;
 /*
 // TODO: Will have to play with fonts later
 
@@ -1793,7 +1860,8 @@ void wxWindowOS2::GetCaretPos(
 // ---------------------------------------------------------------------------
 // popup menu
 // ---------------------------------------------------------------------------
-
+//
+#if wxUSE_MENUS_NATIVE
 static void wxYieldForCommandsOnly()
 {
     //
@@ -1802,18 +1870,15 @@ static void wxYieldForCommandsOnly()
     //
     QMSG                            vMsg;
 
-    while (::WinPeekMsg( vHabmain
-                        ,&vMsg
-                        ,(HWND)0
-                        ,WM_COMMAND
-                        ,WM_COMMAND
-                        ,PM_REMOVE
-                       ) && vMsg.msg != WM_QUIT)
+    while (::WinPeekMsg(vHabmain, &vMsg, (HWND)0, WM_COMMAND,
+           WM_COMMAND,PM_REMOVE) && vMsg.msg != WM_QUIT)
     {
         wxTheApp->DoMessage((WXMSG*)&vMsg);
     }
 }
+#endif // wxUSE_MENUS_NATIVE
 
+#if wxUSE_MENUS_NATIVE
 bool wxWindowOS2::DoPopupMenu(
   wxMenu*                           pMenu
 , int                               nX
@@ -1841,7 +1906,7 @@ bool wxWindowOS2::DoPopupMenu(
                    ,PU_MOUSEBUTTON2DOWN | PU_MOUSEBUTTON2 | PU_KEYBOARD
                   );
     // we need to do it righ now as otherwise the events are never going to be
-    // sent to wxCurrentPopupMenu from HandleCommand()
+    // sent to wxCurrentPopupMenu from ;()
     //
     // note that even eliminating (ugly) wxCurrentPopupMenu global wouldn't
     // help and we'd still need wxYieldForCommandsOnly() as the menu may be
@@ -1853,6 +1918,7 @@ bool wxWindowOS2::DoPopupMenu(
     pMenu->SetInvokingWindow(NULL);
     return TRUE;
 } // end of wxWindowOS2::DoPopupMenu
+#endif // wxUSE_MENUS_NATIVE
 
 // ===========================================================================
 // pre/post message processing
@@ -1865,15 +1931,17 @@ MRESULT wxWindowOS2::OS2DefWindowProc(
 )
 {
     if (m_fnOldWndProc)
-        return (MRESULT)m_fnOldWndProc(GetHWND(), (ULONG)uMsg, (MPARAM)wParam, (MPARAM)lParam);
+        return (MRESULT)m_fnOldWndProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
     else
-        return ::WinDefWindowProc(GetHWND(), (ULONG)uMsg, (MPARAM)wParam, (MPARAM)lParam);
+        return ::WinDefWindowProc(GetHWND(), uMsg, (MPARAM)wParam, (MPARAM)lParam);
 } // end of wxWindowOS2::OS2DefWindowProc
 
 bool wxWindowOS2::OS2ProcessMessage(
   WXMSG*                            pMsg
 )
 {
+// wxUniversal implements tab traversal itself
+#ifndef __WXUNIVERSAL__
     QMSG*                           pQMsg = (QMSG*)pMsg;
 
     if (m_hWnd != 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL))
@@ -2035,6 +2103,9 @@ bool wxWindowOS2::OS2ProcessMessage(
         if (::WinSendMsg(pQMsg->hwnd, WM_QUERYDLGCODE, pQMsg, 0));
             return TRUE;
     }
+#else
+    pMsg = pMsg; // just shut up the compiler
+#endif // __WXUNIVERSAL__
 
 #if wxUSE_TOOLTIPS
     if ( m_tooltip )
@@ -2054,9 +2125,10 @@ bool wxWindowOS2::OS2TranslateMessage(
   WXMSG*                            pMsg
 )
 {
-#if wxUSE_ACCEL
+#if wxUSE_ACCEL && !defined(__WXUNIVERSAL__)
   return m_acceleratorTable.Translate(m_hWnd, pMsg);
 #else
+  pMsg = pMsg;
   return FALSE;
 #endif //wxUSE_ACCEL
 } // end of wxWindowOS2::OS2TranslateMessage
@@ -2132,7 +2204,7 @@ void wxWindowOS2::UnpackMenuSelect(
 // Hook for new window just as it's being created, when the window isn't yet
 // associated with the handle
 //
-wxWindow*                           wxWndHook = NULL;
+wxWindowOS2*                         wxWndHook = NULL;
 
 //
 // Main window proc
@@ -2152,7 +2224,7 @@ MRESULT EXPENTRY wxWndProc(
                wxGetMessageName(ulMsg), wParam, lParam);
 #endif // __WXDEBUG__
 
-    wxWindow*                       pWnd = wxFindWinFromHandle((WXHWND)hWnd);
+    wxWindowOS2*                    pWnd = wxFindWinFromHandle((WXHWND)hWnd);
 
     //
     // When we get the first message for the HWND we just created, we associate
@@ -2203,10 +2275,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
     // Did we process the uMsg?
     //
     bool                            bProcessed = FALSE;
-    bool                            bAllow;
     MRESULT                         mResult;
-    WXHICON                         hIcon;
-    WXHBRUSH                        hBrush;
 
     //
     // For most messages we should return 0 when we do process the message
@@ -2378,7 +2447,8 @@ MRESULT wxWindowOS2::OS2WindowProc(
 
                 if (uKeyFlags & KC_KEYUP)
                 {
-                    bProcessed = HandleKeyUp((WXDWORD)wParam, lParam);
+                    //TODO: check if the cast to WXWORD isn't causing trouble
+                    bProcessed = HandleKeyUp((WXWORD)wParam, lParam);
                     break;
                 }
                 else // keydown event
@@ -2388,7 +2458,7 @@ MRESULT wxWindowOS2::OS2WindowProc(
                     // return 0 now (we've handled it). DON't RETURN
                     // we still need to process further
                     //
-                    HandleKeyDown((WXDWORD)wParam, lParam);
+                    HandleKeyDown((WXWORD)wParam, lParam);
                     if (uKeyFlags & KC_VIRTUALKEY)
                     {
                         USHORT          uVk = SHORT2FROMMP((MPARAM)lParam);
@@ -2422,13 +2492,13 @@ MRESULT wxWindowOS2::OS2WindowProc(
                             case VK_DOWN:
                             case VK_UP:
                             default:
-                                bProcessed = HandleChar((WXDWORD)wParam, lParam);
+                                bProcessed = HandleChar((WXWORD)wParam, lParam);
                          }
                          break;
                     }
                     else // WM_CHAR -- Always an ASCII character
                     {
-                        bProcessed = HandleChar((WXDWORD)wParam, lParam, TRUE);
+                        bProcessed = HandleChar((WXWORD)wParam, lParam, TRUE);
                         break;
                     }
                 }
@@ -2561,10 +2631,10 @@ MRESULT wxWindowOS2::OS2WindowProc(
 // Dialog window proc
 //
 MRESULT wxDlgProc(
-  HWND                              hWnd
+  HWND                              WXUNUSED(hWnd)
 , UINT                              uMsg
-, MPARAM                            wParam
-, MPARAM                            lParam)
+, MPARAM                            WXUNUSED(wParam)
+, MPARAM                            WXUNUSED(lParam))
 {
     if (uMsg == WM_INITDLG)
     {
@@ -2597,7 +2667,7 @@ wxWindow* wxFindWinFromHandle(
 
 void wxAssociateWinWithHandle(
   HWND                              hWnd
-, wxWindow*                         pWin
+, wxWindowOS2*                      pWin
 )
 {
     //
@@ -2627,7 +2697,7 @@ void wxAssociateWinWithHandle(
 } // end of wxAssociateWinWithHandle
 
 void wxRemoveHandleAssociation(
-  wxWindow*                         pWin
+  wxWindowOS2*                      pWin
 )
 {
     wxWinHandleList->DeleteObject(pWin);
@@ -2643,6 +2713,7 @@ void wxWindowOS2::OS2DestroyWindow()
 
 void wxWindowOS2::OS2DetachWindowMenu()
 {
+#ifndef __WXUNIVERSAL__
     if (m_hMenu)
     {
         HMENU                       hMenu = (HMENU)m_hMenu;
@@ -2671,6 +2742,7 @@ void wxWindowOS2::OS2DetachWindowMenu()
             }
         }
     }
+#endif // __WXUNIVERSAL__
 } // end of wxWindowOS2::OS2DetachWindowMenu
 
 bool wxWindowOS2::OS2Create(
@@ -2683,7 +2755,7 @@ bool wxWindowOS2::OS2Create(
 , long                              lWidth
 , long                              lHeight
 , WXHWND                            hOwner
-, WXHWND                            hZOrder
+, WXHWND                            WXUNUSED(hZOrder)
 , unsigned long                     ulId
 , void*                             pCtlData
 , void*                             pPresParams
@@ -2704,9 +2776,6 @@ bool wxWindowOS2::OS2Create(
     // Find parent's size, if it exists, to set up a possible default
     // panel size the size of the parent window
     //
-    RECTL                           vParentRect;
-    HWND                            hWndClient;
-
     lX1 = lX;
     lY1 = lY;
     if (lWidth > -1L)
@@ -2752,23 +2821,32 @@ bool wxWindowOS2::OS2Create(
         }
     }
 
+   HWND parent;
+   if ( GetWindowStyleFlag() & wxPOPUP_WINDOW )
+   {
+       // popup windows should have desktop as parent because they shouldn't
+       // be limited to the parents client area as child windows usually are
+       parent = HWND_DESKTOP;
+   }
+   else if ( hParent )
+   {
+       parent = hParent;
+   }
+   else
+   {
+       // top level window
+       parent = NULL;
+   }
+
     //
     // We will either have a registered class via string name or a standard PM Class via a long
     //
-    m_hWnd = (WXHWND)::WinCreateWindow( (HWND)hParent
-                                       ,zClass
-                                       ,(PSZ)zTitle ? zTitle : wxT("")
-                                       ,(ULONG)dwStyle
-                                       ,(LONG)lX1
-                                       ,(LONG)lY1
-                                       ,(LONG)lWidth
-                                       ,(LONG)lHeight
-                                       ,hOwner
-                                       ,HWND_TOP
-                                       ,(ULONG)nControlId
-                                       ,pCtlData
-                                       ,pPresParams
-                                      );
+    m_hWnd = (WXHWND)::WinCreateWindow(parent, zClass,
+                                       (PSZ)zTitle ? zTitle : wxT(""),
+                                       dwStyle, lX1, lY1, lWidth, lHeight,
+                                       hOwner, HWND_TOP, (ULONG)nControlId,
+                                       pCtlData, pPresParams);
+
     if (!m_hWnd)
     {
         vError = ::WinGetLastError(vHabmain);
@@ -2820,11 +2898,11 @@ bool wxWindowOS2::OS2Create(
 // ---------------------------------------------------------------------------
 
 bool wxWindowOS2::HandleCreate(
-  WXLPCREATESTRUCT                  vCs
+  WXLPCREATESTRUCT                  WXUNUSED(vCs)
 , bool*                             pbMayCreate
 )
 {
-    wxWindowCreateEvent             vEvent(this);
+    wxWindowCreateEvent             vEvent((wxWindow*)this);
 
     (void)GetEventHandler()->ProcessEvent(vEvent);
     *pbMayCreate = TRUE;
@@ -2833,7 +2911,7 @@ bool wxWindowOS2::HandleCreate(
 
 bool wxWindowOS2::HandleDestroy()
 {
-    wxWindowDestroyEvent            vEvent(this);
+    wxWindowDestroyEvent            vEvent((wxWindow*)this);
 
     (void)GetEventHandler()->ProcessEvent(vEvent);
 
@@ -2935,12 +3013,10 @@ bool wxWindowOS2::HandleKillFocus(
 
 bool wxWindowOS2::HandleShow(
   bool                              bShow
-, int                               nStatus
+, int                               WXUNUSED(nStatus)
 )
 {
-    wxShowEvent                     vEvent( GetId()
-                                           ,bShow
-                                          );
+    wxShowEvent                     vEvent(GetId(), bShow);
 
     vEvent.m_eventObject = this;
     return GetEventHandler()->ProcessEvent(vEvent);
@@ -2956,14 +3032,14 @@ bool wxWindowOS2::HandleInitDialog(
     return GetEventHandler()->ProcessEvent(vEvent);
 } // end of wxWindowOS2::HandleInitDialog
 
-bool wxWindowOS2::HandleEndDrag(WXWPARAM wParam)
+bool wxWindowOS2::HandleEndDrag(WXWPARAM WXUNUSED(wParam))
 {
    // TODO: We'll handle drag and drop later
     return FALSE;
 }
 
 bool wxWindowOS2::HandleSetCursor(
-  USHORT                            vId
+  USHORT                            WXUNUSED(vId)
 , WXHWND                            hPointer
 )
 {
@@ -2983,9 +3059,10 @@ bool wxWindowOS2::OS2OnDrawItem(
 , WXDRAWITEMSTRUCT*                 pItemStruct
 )
 {
+#if wxUSE_OWNER_DRAWN
     wxDC                            vDc;
 
-#if wxUSE_OWNER_DRAWN
+#if wxUSE_MENUS_NATIVE
     //
     // Is it a menu item?
     //
@@ -3120,6 +3197,7 @@ bool wxWindowOS2::OS2OnDrawItem(
         // otherwise, we'd have to do it ourselves.
         //
     }
+#endif // wxUSE_MENUS_NATIVE
 
     wxWindow*                       pItem = FindItem(vId);
 
@@ -3127,6 +3205,9 @@ bool wxWindowOS2::OS2OnDrawItem(
     {
         return ((wxControl *)pItem)->OS2OnDraw(pItemStruct);
     }
+#else
+    vId = vId;
+    pItemStruct = pItemStruct;
 #endif
     return FALSE;
 } // end of wxWindowOS2::OS2OnDrawItem
@@ -3136,6 +3217,7 @@ bool wxWindowOS2::OS2OnMeasureItem(
 , WXMEASUREITEMSTRUCT*              pItemStruct
 )
 {
+#if wxUSE_OWNER_DRAWN
     //
     // Is it a menu item?
     //
@@ -3171,6 +3253,10 @@ bool wxWindowOS2::OS2OnMeasureItem(
     {
         return ((wxControl *)pItem)->OS2OnMeasure(pItemStruct);
     }
+#else
+    lId = lId;
+    pItemStruct = pItemStruct;
+#endif // wxUSE_OWNER_DRAWN
     return FALSE;
 }
 
@@ -3187,7 +3273,7 @@ bool wxWindowOS2::HandleSysColorChange()
 } // end of wxWindowOS2::HandleSysColorChange
 
 bool wxWindowOS2::HandleCtlColor(
-  WXHBRUSH*                         phBrush
+  WXHBRUSH*                         WXUNUSED(phBrush)
 )
 {
     //
@@ -3197,8 +3283,8 @@ bool wxWindowOS2::HandleCtlColor(
 } // end of wxWindowOS2::HandleCtlColor
 
 bool wxWindowOS2::HandleWindowParams(
-  PWNDPARAMS                        pWndParams
-, WXLPARAM                          lParam
+  PWNDPARAMS                        WXUNUSED(pWndParams)
+, WXLPARAM                          WXUNUSED(lParam)
 )
 {
 // TODO: I'll do something here, just not sure what yet
@@ -3206,12 +3292,12 @@ bool wxWindowOS2::HandleWindowParams(
 }
 
 // Define for each class of dialog and control
-WXHBRUSH wxWindowOS2::OnCtlColor(WXHDC hDC,
-                              WXHWND hWnd,
-                              WXUINT nCtlColor,
-                              WXUINT message,
-                              WXWPARAM wParam,
-                              WXLPARAM lParam)
+WXHBRUSH wxWindowOS2::OnCtlColor(WXHDC WXUNUSED(hDC),
+                                 WXHWND WXUNUSED(hWnd),
+                                 WXUINT WXUNUSED(nCtlColor),
+                                 WXUINT WXUNUSED(message),
+                                 WXWPARAM WXUNUSED(wParam),
+                                 WXLPARAM WXUNUSED(lParam))
 {
     return (WXHBRUSH)0;
 }
@@ -3230,7 +3316,7 @@ bool wxWindowOS2::HandlePaletteChanged()
 } // end of wxWindowOS2::HandlePaletteChanged
 
 bool wxWindowOS2::HandlePresParamChanged(
-  WXWPARAM                          wParam
+  WXWPARAM                          WXUNUSED(wParam)
 )
 {
     //
@@ -3277,20 +3363,29 @@ void wxWindowOS2::OnSysColourChanged(
 
 bool wxWindowOS2::HandlePaint()
 {
-    HRGN                            hRgn = NULLHANDLE;
-    wxPaintEvent                    vEvent;
+    HRGN                            hRgn;
+    wxPaintEvent                    vEvent(m_windowId);
     HPS                             hPS;
     RECTL                           vRect;
+    bool                            bProcessed;
+
+    // Create empty region
+    // TODO: get HPS somewhere else if possible
+    hPS  = ::WinGetPS(GetHwnd());
+    hRgn = ::GpiCreateRegion(hPS, 0, NULL);
 
-    if (::WinQueryUpdateRegion(GetHwnd(), hRgn) == RGN_NULL)
+    if (::WinQueryUpdateRegion(GetHwnd(), hRgn) == RGN_ERROR)
     {
          wxLogLastError("CreateRectRgn");
          return FALSE;
     }
 
-    m_updateRegion = wxRegion(hRgn);
+    m_updateRegion = wxRegion(hRgn, hPS);
+
     vEvent.SetEventObject(this);
-    if (!GetEventHandler()->ProcessEvent(vEvent))
+    bProcessed = GetEventHandler()->ProcessEvent(vEvent);
+
+    if (!bProcessed)
     {
         HPS                         hPS;
 
@@ -3300,6 +3395,7 @@ bool wxWindowOS2::HandlePaint()
                              );
         if(hPS)
         {
+#if 0
             ::GpiCreateLogColorTable( hPS
                                      ,0L
                                      ,LCOLF_CONSECRGB
@@ -3307,6 +3403,7 @@ bool wxWindowOS2::HandlePaint()
                                      ,(LONG)wxTheColourDatabase->m_nSize
                                      ,(PLONG)wxTheColourDatabase->m_palTable
                                     );
+#endif
             ::GpiCreateLogColorTable( hPS
                                      ,0L
                                      ,LCOLF_RGB
@@ -3343,7 +3440,11 @@ bool wxWindowOS2::HandlePaint()
             ::WinEndPaint(hPS);
         }
     }
-    return (GetEventHandler()->ProcessEvent(vEvent));
+
+    ::GpiDestroyRegion(hPS, hRgn);
+    ::WinReleasePS(hPS);
+
+    return GetEventHandler()->ProcessEvent(vEvent); //bProcessed;
 } // end of wxWindowOS2::HandlePaint
 
 bool wxWindowOS2::HandleEraseBkgnd(
@@ -3351,6 +3452,7 @@ bool wxWindowOS2::HandleEraseBkgnd(
 )
 {
     SWP                             vSwp;
+    bool                            rc;
 
     ::WinQueryWindowPos(GetHwnd(), &vSwp);
     if (vSwp.fl & SWP_MINIMIZE)
@@ -3359,14 +3461,14 @@ bool wxWindowOS2::HandleEraseBkgnd(
     wxDC                            vDC;
 
     vDC.m_hPS = (HPS)hDC; // this is really a PS
-    vDC.SetWindow(this);
+    vDC.SetWindow((wxWindow*)this);
     vDC.BeginDrawing();
 
     wxEraseEvent                    vEvent(m_windowId, &vDC);
 
     vEvent.SetEventObject(this);
 
-    bool                            rc = GetEventHandler()->ProcessEvent(vEvent);
+    rc = GetEventHandler()->ProcessEvent(vEvent);
 
     vDC.EndDrawing();
     vDC.m_hPS = NULLHANDLE;
@@ -3379,9 +3481,11 @@ void wxWindowOS2::OnEraseBackground(
 {
     RECTL                           vRect;
     HPS                             hPS = rEvent.m_dc->m_hPS;
+    APIRET                          rc;
+    LONG                            lColor = m_backgroundColour.GetPixel();
 
-    ::WinQueryWindowRect(GetHwnd(), &vRect);
-    ::WinFillRect(hPS, &vRect,  m_backgroundColour.GetPixel());
+    rc = ::WinQueryWindowRect(GetHwnd(), &vRect);
+    rc = ::WinFillRect(hPS, &vRect, lColor);
 }  // end of wxWindowOS2::OnEraseBackground
 
 // ---------------------------------------------------------------------------
@@ -3409,11 +3513,7 @@ bool wxWindowOS2::HandleMove(
 , int                               nY
 )
 {
-    wxMoveEvent                     vEvent( wxPoint( nX
-                                                    ,nY
-                                                   )
-                                           ,m_windowId
-                                          );
+    wxMoveEvent                     vEvent(wxPoint(nX, nY), m_windowId);
 
     vEvent.SetEventObject(this);
     return GetEventHandler()->ProcessEvent(vEvent);
@@ -3425,11 +3525,7 @@ bool wxWindowOS2::HandleSize(
 , WXUINT                            WXUNUSED(nFlag)
 )
 {
-    wxSizeEvent                     vEvent( wxSize( nWidth
-                                                   ,nHeight
-                                                  )
-                                           ,m_windowId
-                                          );
+    wxSizeEvent                     vEvent(wxSize(nWidth, nHeight), m_windowId);
 
     vEvent.SetEventObject(this);
     return GetEventHandler()->ProcessEvent(vEvent);
@@ -3471,6 +3567,7 @@ bool wxWindowOS2::HandleCommand(
 , WXHWND                            hControl
 )
 {
+#if wxUSE_MENUS_NATIVE
     if (wxCurrentPopupMenu)
     {
         wxMenu*                     pPopupMenu = wxCurrentPopupMenu;
@@ -3478,6 +3575,7 @@ bool wxWindowOS2::HandleCommand(
         wxCurrentPopupMenu = NULL;
         return pPopupMenu->OS2Command(wCmd, wId);
     }
+#endif // wxUSE_MENUS_NATIVE
 
     wxWindow*                       pWin = FindItem(wId);
 
@@ -3487,15 +3585,14 @@ bool wxWindowOS2::HandleCommand(
     }
 
     if (pWin)
-        return pWin->OS2Command( wCmd
-                                ,wId
-                               );
+        return pWin->OS2Command(wCmd, wId);
+
     return FALSE;
 } // end of wxWindowOS2::HandleCommand
 
 bool wxWindowOS2::HandleSysCommand(
   WXWPARAM                          wParam
-, WXLPARAM                          lParam
+, WXLPARAM                          WXUNUSED(lParam)
 )
 {
     //
@@ -3515,7 +3612,7 @@ bool wxWindowOS2::HandleSysCommand(
 // ---------------------------------------------------------------------------
 // mouse events
 // ---------------------------------------------------------------------------
-
+//TODO!!! check against MSW
 void wxWindowOS2::InitMouseEvent(
   wxMouseEvent&                     rEvent
 , int                               nX
@@ -3849,10 +3946,10 @@ bool wxWindowOS2::OS2OnScroll(
 // ===========================================================================
 
 void wxGetCharSize(
-  WXHWND                            hWnd
-, int*                              pX
-, int*                              pY
-,wxFont*                            pTheFont
+  WXHWND                            WXUNUSED(hWnd)
+, int*                              WXUNUSED(pX)
+, int*                              WXUNUSED(pY)
+,wxFont*                            WXUNUSED(pTheFont)
 )
 {
   // TODO: we'll do this later
@@ -4458,6 +4555,8 @@ const char* wxGetMessageName(
 
 #endif // __WXDEBUG__
 
+// Unused?
+#if 0
 static void TranslateKbdEventToMouse(
   wxWindow*                         pWin
 , int*                              pX
@@ -4486,11 +4585,12 @@ static void TranslateKbdEventToMouse(
 
     pWin->ScreenToClient(pX, pY);
 } // end of TranslateKbdEventToMouse
+#endif
 
 // Find the wxWindow at the current mouse position, returning the mouse
 // position.
 wxWindow* wxFindWindowAtPointer(
-  wxPoint&                          rPt
+  wxPoint&                          WXUNUSED(rPt)
 )
 {
     return wxFindWindowAtPoint(wxGetMousePosition());
index ee64879e4a35ee774853644a167350c0c518b394..494bcf600886abbf9cd790c799c96705440e7c0c 100644 (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"
index 4f5bca178c660669d4f6865a36457ff416f5264b..6c38c6201c8435c8bc5dce44e0ba01ccd07cf5d3 100644 (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;
index 3bcf176b16977ddd3f2eec5f4f31d7925024e688..c3db2abdf8298e1ea24ffd7b9bad1e0dc71498ad 100644 (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)
     (
index f9e384c6831f4a6c83fd434bb1c2cd58a7195986..254254b69ac24b1ef915554b6f68eb61d7bc7273 100644 (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
     }
 
index 18242c45b5870c00205b440dca9e6d23069b61f9..4ce63facfe380c72be8b4ba6a0058b2ad75168ef 100644 (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)