Updates to OS/2 to catch up with lib changes and for image processing.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster
2002-04-26 12:58:11 +00:00
parent 54905eba2a
commit 1cee3f6006
10 changed files with 175 additions and 104 deletions

View File

@@ -66,6 +66,9 @@ public:
virtual int GetValue(void) const ; virtual int GetValue(void) const ;
virtual void SetValue(int); virtual void SetValue(int);
virtual void DoGetSize( int* pnWidth
,int* pnHeight
) const;
void GetSize( int* pnX void GetSize( int* pnX
,int* pnY ,int* pnY
) const; ) const;

View File

@@ -118,7 +118,6 @@ public:
,long lTo ,long lTo
); );
virtual void SetEditable(bool bEditable); virtual void SetEditable(bool bEditable);
virtual void SetFocus(void);
virtual void SetWindowStyleFlag(long lStyle); virtual void SetWindowStyleFlag(long lStyle);
// //

View File

@@ -95,6 +95,7 @@ public:
virtual bool Show(bool bShow = TRUE); virtual bool Show(bool bShow = TRUE);
virtual bool Enable(bool bEnable = TRUE); virtual bool Enable(bool bEnable = TRUE);
virtual void SetFocus(void); virtual void SetFocus(void);
virtual void SetFocusFromKbd(void);
virtual bool Reparent(wxWindow* pNewParent); virtual bool Reparent(wxWindow* pNewParent);
virtual void WarpPointer( int x virtual void WarpPointer( int x
,int y ,int y

View File

@@ -548,7 +548,7 @@ bool wxBitmap::CreateFromImage (
SetWidth(nWidth); SetWidth(nWidth);
SetHeight(nBmpHeight); SetHeight(nBmpHeight);
if (nDepth == -1) if (nDepth == -1)
nDepth = 16; // wxDisplayDepth(); nDepth = wxDisplayDepth();
SetDepth(nDepth); SetDepth(nDepth);
#if wxUSE_PALETTE #if wxUSE_PALETTE
@@ -817,6 +817,7 @@ bool wxBitmap::CreateFromImage (
wxImage wxBitmap::ConvertToImage() const wxImage wxBitmap::ConvertToImage() const
{ {
wxImage vImage; wxImage vImage;
wxDC* pDC;
wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") ); wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
@@ -836,12 +837,13 @@ wxImage wxBitmap::ConvertToImage() const
long lScans; long lScans;
BITMAPINFOHEADER2 vDIBh; BITMAPINFOHEADER2 vDIBh;
BITMAPINFO2 vDIBInfo; BITMAPINFO2 vDIBInfo;
HDC hDCMem;
PSZ pszData[4] = { "Display", NULL, NULL, NULL };
HPS hPSMem; HPS hPSMem;
HPS hPS; HPS hPS;
SIZEL vSizlPage = {0,0};
HBITMAP hBitmap; HBITMAP hBitmap;
HBITMAP hOldBitmap;
DEVOPENSTRUC vDop = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
SIZEL vSizlPage = {0,0};
HDC hDCMem;
vImage.Create( nWidth vImage.Create( nWidth
,nHeight ,nHeight
@@ -886,33 +888,53 @@ wxImage wxBitmap::ConvertToImage() const
} }
// //
// Copy data from the device-dependent bitmap to the DIB // May already be selected into a PS
// //
if ((pDC = GetSelectedInto()) != NULL)
{
hPSMem = pDC->GetHPS();
}
else
{
hDCMem = ::DevOpenDC( vHabmain hDCMem = ::DevOpenDC( vHabmain
,OD_MEMORY ,OD_MEMORY
,"*" ,"*"
,4 ,5L
,(PDEVOPENDATA)pszData ,(PDEVOPENDATA)&vDop
,NULLHANDLE ,NULLHANDLE
); );
hPSMem = ::GpiCreatePS( vHabmain hPSMem = ::GpiCreatePS( vHabmain
,hDCMem ,hDCMem
,&vSizlPage ,&vSizlPage
,PU_PELS | GPIA_ASSOC | GPIT_MICRO ,PU_PELS | GPIA_ASSOC
); );
hBitmap = ::GpiCreateBitmap( hPSMem hBitmap = (HBITMAP)GetHBITMAP();
,&vDIBh if ((hOldBitmap = ::GpiSetBitmap(hPSMem, hBitmap)) == HBM_ERROR)
,0L {
,NULL ERRORID vError;
,NULL wxString sError;
);
::GpiSetBitmap(hPSMem, hBitmap); vError = ::WinGetLastError(vHabmain);
lScans = ::GpiQueryBitmapBits( hPSMem sError = wxPMErrorToStr(vError);
}
}
//
// Copy data from the device-dependent bitmap to the DIB
//
if ((lScans = ::GpiQueryBitmapBits( hPSMem
,0L ,0L
,(LONG)nHeight ,(LONG)nHeight
,(PBYTE)lpBits ,(PBYTE)lpBits
,&vDIBInfo ,&vDIBInfo
); )) == GPI_ALTERROR)
{
ERRORID vError;
wxString sError;
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
}
// //
// Copy DIB data into the wxImage object // Copy DIB data into the wxImage object
@@ -933,7 +955,12 @@ wxImage wxBitmap::ConvertToImage() const
} }
ptbits += nPadding; ptbits += nPadding;
} }
if ((pDC = GetSelectedInto()) == NULL)
{
::GpiSetBitmap(hPSMem, NULLHANDLE); ::GpiSetBitmap(hPSMem, NULLHANDLE);
::GpiDestroyPS(hPSMem);
::DevCloseDC(hDCMem);
}
// //
// Similarly, set data according to the possible mask bitmap // Similarly, set data according to the possible mask bitmap
@@ -948,8 +975,8 @@ wxImage wxBitmap::ConvertToImage() const
HDC hMemDC = ::DevOpenDC( vHabmain HDC hMemDC = ::DevOpenDC( vHabmain
,OD_MEMORY ,OD_MEMORY
,"*" ,"*"
,4 ,5L
,(PDEVOPENDATA)pszData ,(PDEVOPENDATA)&vDop
,NULLHANDLE ,NULLHANDLE
); );
HPS hMemPS = ::GpiCreatePS( vHabmain HPS hMemPS = ::GpiCreatePS( vHabmain
@@ -1009,8 +1036,6 @@ wxImage wxBitmap::ConvertToImage() const
// //
// Free allocated resources // Free allocated resources
// //
::GpiDestroyPS(hPSMem);
::DevCloseDC(hDCMem);
free(lpBits); free(lpBits);
return vImage; return vImage;
} // end of wxBitmap::ConvertToImage } // end of wxBitmap::ConvertToImage

View File

@@ -1040,54 +1040,6 @@ void wxDC::DoDrawRectangle(
,0L ,0L
,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(vX, vY);
CalcBoundingBox(vX2, vY2); CalcBoundingBox(vX2, vY2);

View File

@@ -190,4 +190,82 @@ void wxMemoryDC::DoDrawRectangle(
) )
{ {
wxDC::DoDrawRectangle(vX, vY, vWidth, vHeight); 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 } // end of wxMemoryDC::DoDrawRectangle

View File

@@ -772,6 +772,16 @@ int wxSlider::GetSelStart() const
return 0; return 0;
} // end of wxSlider::GetSelStart } // end of wxSlider::GetSelStart
void wxSlider::DoGetSize(
int* pnWidth
, int* pnHeight
) const
{
GetSize( pnWidth
,pnHeight
);
} // end of wxSlider::DoGetSize
void wxSlider::GetSize( void wxSlider::GetSize(
int* pnWidth int* pnWidth
, int* pnHeight , int* pnHeight

View File

@@ -1066,15 +1066,6 @@ void wxTextCtrl::OnChar(
rEvent.Skip(); rEvent.Skip();
} // end of wxTextCtrl::OnChar } // end of wxTextCtrl::OnChar
void wxTextCtrl::SetFocus()
{
wxTextCtrlBase::SetFocus();
if ( !HasFlag(wxTE_MULTILINE) )
{
SetSelection(-1, -1);
}
} // end of wxTextCtrl::SetFocus
bool wxTextCtrl::OS2Command( bool wxTextCtrl::OS2Command(
WXUINT uParam WXUINT uParam
, WXWORD WXUNUSED(vId) , WXWORD WXUNUSED(vId)

View File

@@ -465,6 +465,14 @@ void wxWindowOS2::SetFocus()
::WinSetFocus(HWND_DESKTOP, hWnd); ::WinSetFocus(HWND_DESKTOP, hWnd);
} // end of wxWindowOS2::SetFocus } // end of wxWindowOS2::SetFocus
void wxWindowOS2::SetFocusFromKbd()
{
//
// Nothing else to do under OS/2
//
wxWindowBase::SetFocusFromKbd();
} // end of wxWindowOS2::SetFocus
wxWindow* wxWindowBase::FindFocus() wxWindow* wxWindowBase::FindFocus()
{ {
HWND hWnd = ::WinQueryFocus(HWND_DESKTOP); HWND hWnd = ::WinQueryFocus(HWND_DESKTOP);

View File

@@ -4,7 +4,7 @@ DATA MULTIPLE NONSHARED READWRITE LOADONCALL
CODE LOADONCALL CODE LOADONCALL
EXPORTS EXPORTS
;From library: F:\DEV\WX2\WXWINDOWS\LIB\wx.lib ;From library: H:\dev\wx2\wxwindows\lib\wx.lib
;From object file: dummy.cpp ;From object file: dummy.cpp
;PUBDEFs (Symbols available from object file): ;PUBDEFs (Symbols available from object file):
wxDummyChar wxDummyChar
@@ -1925,7 +1925,7 @@ EXPORTS
wxEVT_NC_LEFT_DCLICK wxEVT_NC_LEFT_DCLICK
wxEVT_INIT_DIALOG wxEVT_INIT_DIALOG
wxEVT_COMMAND_SET_FOCUS 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): ;PUBDEFs (Symbols available from object file):
ConvertToIeeeExtended ConvertToIeeeExtended
ConvertFromIeeeExtended ConvertFromIeeeExtended
@@ -6037,7 +6037,7 @@ EXPORTS
Read32__17wxTextInputStreamFv Read32__17wxTextInputStreamFv
;wxTextInputStream::SkipIfEndOfLine(char) ;wxTextInputStream::SkipIfEndOfLine(char)
SkipIfEndOfLine__17wxTextInputStreamFc 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): ;PUBDEFs (Symbols available from object file):
unzReadCurrentFile unzReadCurrentFile
unzGetCurrentFileInfo unzGetCurrentFileInfo
@@ -6983,6 +6983,8 @@ EXPORTS
DeleteRelatedConstraints__12wxWindowBaseFv DeleteRelatedConstraints__12wxWindowBaseFv
;wxWindowBase::SetHelpText(const wxString&) ;wxWindowBase::SetHelpText(const wxString&)
SetHelpText__12wxWindowBaseFRC8wxString SetHelpText__12wxWindowBaseFRC8wxString
;wxGetTopLevelParent(wxWindow*)
wxGetTopLevelParent__FP8wxWindow
;From object file: ..\common\wxchar.cpp ;From object file: ..\common\wxchar.cpp
;PUBDEFs (Symbols available from object file): ;PUBDEFs (Symbols available from object file):
;wxOKlibc() ;wxOKlibc()
@@ -10762,6 +10764,8 @@ EXPORTS
wxConstructorForwxHtmlFilterHTML__Fv wxConstructorForwxHtmlFilterHTML__Fv
;wxHtmlFilterHTML::sm_classwxHtmlFilterHTML ;wxHtmlFilterHTML::sm_classwxHtmlFilterHTML
sm_classwxHtmlFilterHTML__16wxHtmlFilterHTML sm_classwxHtmlFilterHTML__16wxHtmlFilterHTML
;wxPrivate_ReadString(wxString&,wxInputStream*)
wxPrivate_ReadString__FR8wxStringP13wxInputStream
;wxHtmlFilterPlainText::ReadFile(const wxFSFile&) const ;wxHtmlFilterPlainText::ReadFile(const wxFSFile&) const
ReadFile__21wxHtmlFilterPlainTextCFRC8wxFSFile ReadFile__21wxHtmlFilterPlainTextCFRC8wxFSFile
;wxHtmlFilterHTML::ReadFile(const wxFSFile&) const ;wxHtmlFilterHTML::ReadFile(const wxFSFile&) const
@@ -14297,8 +14301,6 @@ EXPORTS
Copy__10wxTextCtrlFv Copy__10wxTextCtrlFv
;wxTextCtrl::SetStyle(long,long,const wxTextAttr&) ;wxTextCtrl::SetStyle(long,long,const wxTextAttr&)
SetStyle__10wxTextCtrlFlT1RC10wxTextAttr SetStyle__10wxTextCtrlFlT1RC10wxTextAttr
;wxTextCtrl::SetFocus()
SetFocus__10wxTextCtrlFv
;wxTextCtrl::CanRedo() const ;wxTextCtrl::CanRedo() const
CanRedo__10wxTextCtrlCFv CanRedo__10wxTextCtrlCFv
;wxTextCtrl::OS2GetStyle(long,unsigned long*) const ;wxTextCtrl::OS2GetStyle(long,unsigned long*) const
@@ -14799,14 +14801,16 @@ EXPORTS
wxCharCodeOS2ToWX__Fi wxCharCodeOS2ToWX__Fi
;wxWindow::HandleMouseMove(int,int,unsigned int) ;wxWindow::HandleMouseMove(int,int,unsigned int)
HandleMouseMove__8wxWindowFiT1Ui HandleMouseMove__8wxWindowFiT1Ui
;wxWindow::Raise() ;wxWindow::SetFocusFromKbd()
Raise__8wxWindowFv SetFocusFromKbd__8wxWindowFv
;wxWindowCreationHook::~wxWindowCreationHook() ;wxWindowCreationHook::~wxWindowCreationHook()
__dt__20wxWindowCreationHookFv __dt__20wxWindowCreationHookFv
;wxWindow::Update() ;wxWindow::Update()
Update__8wxWindowFv Update__8wxWindowFv
;wxWindow::UnsubclassWin() ;wxWindow::UnsubclassWin()
UnsubclassWin__8wxWindowFv UnsubclassWin__8wxWindowFv
;wxWindow::Raise()
Raise__8wxWindowFv
;wxWindow::Lower() ;wxWindow::Lower()
Lower__8wxWindowFv Lower__8wxWindowFv
;wxWindow::HandleMaximize() ;wxWindow::HandleMaximize()