]> git.saurik.com Git - wxWidgets.git/commitdiff
Updates to OS/2 to catch up with lib changes and for image processing.
authorDavid Webster <Dave.Webster@bhmi.com>
Fri, 26 Apr 2002 12:58:11 +0000 (12:58 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Fri, 26 Apr 2002 12:58:11 +0000 (12:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/os2/slider.h
include/wx/os2/textctrl.h
include/wx/os2/window.h
src/os2/bitmap.cpp
src/os2/dc.cpp
src/os2/dcmemory.cpp
src/os2/slider.cpp
src/os2/textctrl.cpp
src/os2/window.cpp
src/os2/wx23.def

index e3f6f87fa594b8d078a4d2e6db405915cfac13bb..887177c827ace0303dc197ee26fe32d57b0813ee 100644 (file)
@@ -66,6 +66,9 @@ public:
          virtual int  GetValue(void) const ;
          virtual void SetValue(int);
 
+         virtual void DoGetSize( int* pnWidth
+                                ,int* pnHeight
+                               ) const;
                  void GetSize( int* pnX
                               ,int* pnY
                              ) const;
index b7a701274ff621bc2ccf62be72d49a74c0f6499b..8770ddbda25ab094d3cd2fbb3ab2f6e5ec216370 100644 (file)
@@ -118,7 +118,6 @@ public:
                               ,long lTo
                              );
     virtual void SetEditable(bool bEditable);
-    virtual void SetFocus(void);
     virtual void SetWindowStyleFlag(long lStyle);
 
     //
index 33ac3ce48baf5fe63d9f922b58219e34add3ba44..620b4455534cf543e95c2ef4803b4d87a3ca5446 100644 (file)
@@ -95,6 +95,7 @@ public:
     virtual bool     Show(bool bShow = TRUE);
     virtual bool     Enable(bool bEnable = TRUE);
     virtual void     SetFocus(void);
+    virtual void     SetFocusFromKbd(void);
     virtual bool     Reparent(wxWindow* pNewParent);
     virtual void     WarpPointer( int x
                                  ,int y
index 6a6be7033f60b6271c367570d395789e1606809b..6ea8aa4752793b3888f62fbe460ded4fd8ea3d62 100644 (file)
@@ -548,7 +548,7 @@ bool wxBitmap::CreateFromImage (
     SetWidth(nWidth);
     SetHeight(nBmpHeight);
     if (nDepth == -1)
-        nDepth = 16; // wxDisplayDepth();
+        nDepth = wxDisplayDepth();
     SetDepth(nDepth);
 
 #if wxUSE_PALETTE
@@ -817,6 +817,7 @@ bool wxBitmap::CreateFromImage (
 wxImage wxBitmap::ConvertToImage() const
 {
     wxImage                         vImage;
+    wxDC*                           pDC;
 
     wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
 
@@ -836,12 +837,13 @@ wxImage wxBitmap::ConvertToImage() const
     long                            lScans;
     BITMAPINFOHEADER2               vDIBh;
     BITMAPINFO2                     vDIBInfo;
-    HDC                             hDCMem;
-    PSZ                             pszData[4] = { "Display", NULL, NULL, NULL };
     HPS                             hPSMem;
     HPS                             hPS;
-    SIZEL                           vSizlPage = {0,0};
     HBITMAP                         hBitmap;
+    HBITMAP                         hOldBitmap;
+    DEVOPENSTRUC                    vDop  = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
+    SIZEL                           vSizlPage = {0,0};
+    HDC                             hDCMem;
 
     vImage.Create( nWidth
                   ,nHeight
@@ -885,34 +887,54 @@ wxImage wxBitmap::ConvertToImage() const
         return wxNullImage;
     }
 
+    //
+    // May already be selected into a PS
+    //
+    if ((pDC = GetSelectedInto()) != NULL)
+    {
+        hPSMem = pDC->GetHPS();
+    }
+    else
+    {
+        hDCMem = ::DevOpenDC( vHabmain
+                             ,OD_MEMORY
+                             ,"*"
+                             ,5L
+                             ,(PDEVOPENDATA)&vDop
+                             ,NULLHANDLE
+                            );
+        hPSMem = ::GpiCreatePS( vHabmain
+                               ,hDCMem
+                               ,&vSizlPage
+                               ,PU_PELS | GPIA_ASSOC
+                              );
+        hBitmap = (HBITMAP)GetHBITMAP();
+        if ((hOldBitmap = ::GpiSetBitmap(hPSMem, hBitmap)) == HBM_ERROR)
+        {
+            ERRORID                 vError;
+            wxString                sError;
+
+            vError = ::WinGetLastError(vHabmain);
+            sError = wxPMErrorToStr(vError);
+        }
+    }
+
     //
     // Copy data from the device-dependent bitmap to the DIB
     //
-    hDCMem = ::DevOpenDC( vHabmain
-                         ,OD_MEMORY
-                         ,"*"
-                         ,4
-                         ,(PDEVOPENDATA)pszData
-                         ,NULLHANDLE
-                        );
-    hPSMem = ::GpiCreatePS( vHabmain
-                           ,hDCMem
-                           ,&vSizlPage
-                           ,PU_PELS | GPIA_ASSOC | GPIT_MICRO
-                          );
-    hBitmap = ::GpiCreateBitmap( hPSMem
-                                ,&vDIBh
-                                ,0L
-                                ,NULL
-                                ,NULL
-                               );
-    ::GpiSetBitmap(hPSMem, hBitmap);
-    lScans = ::GpiQueryBitmapBits( hPSMem
-                                  ,0L
-                                  ,(LONG)nHeight
-                                  ,(PBYTE)lpBits
-                                  ,&vDIBInfo
-                                 );
+    if ((lScans = ::GpiQueryBitmapBits( hPSMem
+                                       ,0L
+                                       ,(LONG)nHeight
+                                       ,(PBYTE)lpBits
+                                       ,&vDIBInfo
+                                      )) == GPI_ALTERROR)
+    {
+        ERRORID                     vError;
+        wxString                    sError;
+
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
 
     //
     // Copy DIB data into the wxImage object
@@ -933,7 +955,12 @@ wxImage wxBitmap::ConvertToImage() const
         }
         ptbits += nPadding;
     }
-    ::GpiSetBitmap(hPSMem, NULLHANDLE);
+    if ((pDC = GetSelectedInto()) == NULL)
+    {
+        ::GpiSetBitmap(hPSMem, NULLHANDLE);
+        ::GpiDestroyPS(hPSMem);
+        ::DevCloseDC(hDCMem);
+    }
 
     //
     // Similarly, set data according to the possible mask bitmap
@@ -945,13 +972,13 @@ wxImage wxBitmap::ConvertToImage() const
         //
         // Memory DC/PS created, color set, data copied, and memory DC/PS deleted
         //
-        HDC                         hMemDC = ::DevOpenDC( vHabmain
-                                                         ,OD_MEMORY
-                                                         ,"*"
-                                                         ,4
-                                                         ,(PDEVOPENDATA)pszData
-                                                         ,NULLHANDLE
-                                                        );
+        HDC                        hMemDC = ::DevOpenDC( vHabmain
+                                                        ,OD_MEMORY
+                                                        ,"*"
+                                                        ,5L
+                                                        ,(PDEVOPENDATA)&vDop
+                                                        ,NULLHANDLE
+                                                       );
         HPS                         hMemPS = ::GpiCreatePS( vHabmain
                                                            ,hMemDC
                                                            ,&vSizlPage
@@ -1009,8 +1036,6 @@ wxImage wxBitmap::ConvertToImage() const
     //
     // Free allocated resources
     //
-    ::GpiDestroyPS(hPSMem);
-    ::DevCloseDC(hDCMem);
     free(lpBits);
     return vImage;
 } // end of wxBitmap::ConvertToImage
index 9a58657da1af201924e7fac723b0ebee3c370bbc..8bf6f5b5207a464d0d6fb1239845bd706c6a1343 100644 (file)
@@ -1040,54 +1040,6 @@ void wxDC::DoDrawRectangle(
                  ,0L
                  ,0L
                 );
-        //
-        // Debug testing:
-        //
-        if (m_vSelectedBitmap != wxNullBitmap)
-        {
-            BITMAPINFOHEADER2           vHeader;
-            BITMAPINFO2                 vInfo;
-
-            vHeader.cbFix = 16L;
-            if (::GpiQueryBitmapInfoHeader(m_hPS, &vHeader))
-            {
-                int                     nBytesPerLine = vHeader.cBitCount/8;
-                unsigned char*          pucData = NULL;
-                unsigned char*          pucBits;
-                LONG                    lScans = 0L;
-
-                vInfo.cbFix = 16;
-                vInfo.cx              = vHeader.cx;
-                vInfo.cy              = vHeader.cy;
-                vInfo.cPlanes         = vHeader.cPlanes;
-                vInfo.cBitCount       = vHeader.cBitCount;
-                pucData = (unsigned char*)malloc(nBytesPerLine * vHeight);
-                pucBits = pucData;
-                for (int i = 0; i < vHeight; i++)
-                {
-                    if (i <= m_vSelectedBitmap.GetHeight())
-                    {
-                        for (int j = 0; j < vWidth; j++)
-                        {
-                            if (j <= m_vSelectedBitmap.GetWidth())
-                            {
-                                vPoint[0].x = j; vPoint[0].y = i;
-                                lColor = ::GpiQueryPel(m_hPS, &vPoint[0]);
-                                *(pucBits++) = lColor >> 24;
-                                *(pucBits++) = lColor >> 16;
-                                *(pucBits++) = lColor >> 8;
-                            }
-                        }
-                    }
-                }
-                lScans = ::GpiSetBitmapBits( m_hPS
-                                            ,0             // Start at the bottom
-                                            ,(LONG)vHeight // One line per scan
-                                            ,(PBYTE)pucData
-                                            ,&vInfo
-                                           );
-            }
-        }
     }
     CalcBoundingBox(vX, vY);
     CalcBoundingBox(vX2, vY2);
index 456e93e3d36c259529495c3042361f4d84b3365f..435bbf1f3fd37b3d442f55a9e59e6b8e8e3873b7 100644 (file)
@@ -190,4 +190,82 @@ void wxMemoryDC::DoDrawRectangle(
 )
 {
     wxDC::DoDrawRectangle(vX, vY, vWidth, vHeight);
+
+    //
+    // Debug testing:
+    //
+    if (m_vSelectedBitmap.GetHBITMAP() != NULLHANDLE)
+    {
+        BITMAPINFOHEADER2           vHeader;
+        BITMAPINFO2                 vInfo;
+
+        vHeader.cbFix = 16L;
+        if (::GpiQueryBitmapInfoHeader(m_vSelectedBitmap.GetHBITMAP(), &vHeader))
+        {
+            unsigned char*          pucData = NULL;
+            unsigned char*          pucBits;
+            int                     nBytesPerLine = vWidth * 3;
+            LONG                    lScans = 0L;
+            POINTL                  vPoint;
+            LONG                    lColor;
+
+            vInfo.cbFix     = 16;
+            vInfo.cx        = vHeader.cx;
+            vInfo.cy        = vHeader.cy;
+            vInfo.cPlanes   = vHeader.cPlanes;
+            vInfo.cBitCount = 24;
+            pucData = (unsigned char*)malloc(nBytesPerLine * m_vSelectedBitmap.GetHeight());
+            if ((lScans = ::GpiQueryBitmapBits( m_hPS
+                                               ,0L
+                                               ,(LONG)m_vSelectedBitmap.GetHeight()
+                                               ,(PBYTE)pucData
+                                               ,&vInfo
+                                              )) == GPI_ALTERROR)
+            {
+                ERRORID                     vError;
+                wxString                    sError;
+
+                vError = ::WinGetLastError(vHabmain);
+                sError = wxPMErrorToStr(vError);
+            }
+            pucBits = pucData;
+            for (int i = 0; i < m_vSelectedBitmap.GetHeight(); i++)
+            {
+                for (int j = vX; j < m_vSelectedBitmap.GetWidth(); j++)
+                {
+                    if (i >= vY && j >= vX && i < vHeight && j < vWidth)
+                    {
+                        vPoint.x = j; vPoint.y = i;
+                        if (i == vY || j == vX ||
+                            i == m_vSelectedBitmap.GetWidth() -1 ||
+                            j == m_vSelectedBitmap.GetHeight()
+                           )
+                            lColor = m_pen.GetColour().GetPixel();
+                        else
+                            lColor = m_brush.GetColour().GetPixel();
+                        *(pucBits++) = (unsigned char)lColor;
+                        *(pucBits++) = (unsigned char)(lColor >> 8);
+                        *(pucBits++) = (unsigned char)(lColor >> 16);
+                    }
+                    else
+                        pucBits += 3;
+                }
+            }
+            if ((lScans = ::GpiSetBitmapBits( m_hPS
+                                             ,0
+                                             ,(LONG)m_vSelectedBitmap.GetHeight()
+                                             ,(PBYTE)pucData
+                                             ,&vInfo
+                                            )) == GPI_ALTERROR)
+            {
+                ERRORID             vError;
+                wxString            sError;
+
+                vError = ::WinGetLastError(vHabmain);
+                sError = wxPMErrorToStr(vError);
+            }
+            free(pucData);
+        }
+    }
 } // end of wxMemoryDC::DoDrawRectangle
+
index b190205052f71eb75cd10b046b46a066513d52c8..cf5d9798f5fd2ed4d92704b2bdf7096eb198d790 100644 (file)
@@ -772,6 +772,16 @@ int wxSlider::GetSelStart() const
     return 0;
 } // end of wxSlider::GetSelStart
 
+void wxSlider::DoGetSize(
+  int*                              pnWidth
+, int*                              pnHeight
+) const
+{
+    GetSize( pnWidth
+            ,pnHeight
+           );
+} // end of wxSlider::DoGetSize
+
 void wxSlider::GetSize(
   int*                              pnWidth
 , int*                              pnHeight
index f375a3888662a05ae03507ebf7dc37eaf327b822..b99d13006c242d2f9bdbcbcee4bacb971bb6f0d4 100644 (file)
@@ -1066,15 +1066,6 @@ void wxTextCtrl::OnChar(
     rEvent.Skip();
 } // end of wxTextCtrl::OnChar
 
-void wxTextCtrl::SetFocus()
-{
-    wxTextCtrlBase::SetFocus();
-    if ( !HasFlag(wxTE_MULTILINE) )
-    {
-        SetSelection(-1, -1);
-    }
-} // end of wxTextCtrl::SetFocus
-
 bool wxTextCtrl::OS2Command(
   WXUINT                            uParam
 , WXWORD                            WXUNUSED(vId)
index 0e3bf3063f69eb2e6a1aa4d8b60f43dc62e3661e..dc57ab19112e7dc5a2815ed179100c5b91bafbbc 100644 (file)
@@ -465,6 +465,14 @@ void wxWindowOS2::SetFocus()
         ::WinSetFocus(HWND_DESKTOP, hWnd);
 } // end of wxWindowOS2::SetFocus
 
+void wxWindowOS2::SetFocusFromKbd()
+{
+    //
+    // Nothing else to do under OS/2
+    //
+    wxWindowBase::SetFocusFromKbd();
+} // end of wxWindowOS2::SetFocus
+
 wxWindow* wxWindowBase::FindFocus()
 {
     HWND                            hWnd = ::WinQueryFocus(HWND_DESKTOP);
index e1835626716fcc70a20640c016b605fde95adce8..13dfe46c8e86c9e4dfbe03fa3b1294d5f91e5c2f 100644 (file)
@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
 CODE LOADONCALL
 
 EXPORTS
-;From library:  F:\DEV\WX2\WXWINDOWS\LIB\wx.lib
+;From library:  H:\dev\wx2\wxwindows\lib\wx.lib
   ;From object file:  dummy.cpp
     ;PUBDEFs (Symbols available from object file):
       wxDummyChar
@@ -1925,7 +1925,7 @@ EXPORTS
       wxEVT_NC_LEFT_DCLICK
       wxEVT_INIT_DIALOG
       wxEVT_COMMAND_SET_FOCUS
-  ;From object file:  F:\DEV\WX2\WXWINDOWS\src\common\extended.c
+  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\extended.c
     ;PUBDEFs (Symbols available from object file):
       ConvertToIeeeExtended
       ConvertFromIeeeExtended
@@ -6037,7 +6037,7 @@ EXPORTS
       Read32__17wxTextInputStreamFv
       ;wxTextInputStream::SkipIfEndOfLine(char)
       SkipIfEndOfLine__17wxTextInputStreamFc
-  ;From object file:  F:\DEV\WX2\WXWINDOWS\src\common\unzip.c
+  ;From object file:  H:\DEV\WX2\WXWINDOWS\src\common\unzip.c
     ;PUBDEFs (Symbols available from object file):
       unzReadCurrentFile
       unzGetCurrentFileInfo
@@ -6983,6 +6983,8 @@ EXPORTS
       DeleteRelatedConstraints__12wxWindowBaseFv
       ;wxWindowBase::SetHelpText(const wxString&)
       SetHelpText__12wxWindowBaseFRC8wxString
+      ;wxGetTopLevelParent(wxWindow*)
+      wxGetTopLevelParent__FP8wxWindow
   ;From object file:  ..\common\wxchar.cpp
     ;PUBDEFs (Symbols available from object file):
       ;wxOKlibc()
@@ -10762,6 +10764,8 @@ EXPORTS
       wxConstructorForwxHtmlFilterHTML__Fv
       ;wxHtmlFilterHTML::sm_classwxHtmlFilterHTML
       sm_classwxHtmlFilterHTML__16wxHtmlFilterHTML
+      ;wxPrivate_ReadString(wxString&,wxInputStream*)
+      wxPrivate_ReadString__FR8wxStringP13wxInputStream
       ;wxHtmlFilterPlainText::ReadFile(const wxFSFile&) const
       ReadFile__21wxHtmlFilterPlainTextCFRC8wxFSFile
       ;wxHtmlFilterHTML::ReadFile(const wxFSFile&) const
@@ -14297,8 +14301,6 @@ EXPORTS
       Copy__10wxTextCtrlFv
       ;wxTextCtrl::SetStyle(long,long,const wxTextAttr&)
       SetStyle__10wxTextCtrlFlT1RC10wxTextAttr
-      ;wxTextCtrl::SetFocus()
-      SetFocus__10wxTextCtrlFv
       ;wxTextCtrl::CanRedo() const
       CanRedo__10wxTextCtrlCFv
       ;wxTextCtrl::OS2GetStyle(long,unsigned long*) const
@@ -14799,14 +14801,16 @@ EXPORTS
       wxCharCodeOS2ToWX__Fi
       ;wxWindow::HandleMouseMove(int,int,unsigned int)
       HandleMouseMove__8wxWindowFiT1Ui
-      ;wxWindow::Raise()
-      Raise__8wxWindowFv
+      ;wxWindow::SetFocusFromKbd()
+      SetFocusFromKbd__8wxWindowFv
       ;wxWindowCreationHook::~wxWindowCreationHook()
       __dt__20wxWindowCreationHookFv
       ;wxWindow::Update()
       Update__8wxWindowFv
       ;wxWindow::UnsubclassWin()
       UnsubclassWin__8wxWindowFv
+      ;wxWindow::Raise()
+      Raise__8wxWindowFv
       ;wxWindow::Lower()
       Lower__8wxWindowFv
       ;wxWindow::HandleMaximize()