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 void SetValue(int);
virtual void DoGetSize( int* pnWidth
,int* pnHeight
) const;
void GetSize( int* pnX
,int* pnY
) const;

View File

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

View 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

View 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
@@ -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
,OD_MEMORY
,"*"
,4
,(PDEVOPENDATA)pszData
,5L
,(PDEVOPENDATA)&vDop
,NULLHANDLE
);
hPSMem = ::GpiCreatePS( vHabmain
,hDCMem
,&vSizlPage
,PU_PELS | GPIA_ASSOC | GPIT_MICRO
,PU_PELS | GPIA_ASSOC
);
hBitmap = ::GpiCreateBitmap( hPSMem
,&vDIBh
,0L
,NULL
,NULL
);
::GpiSetBitmap(hPSMem, hBitmap);
lScans = ::GpiQueryBitmapBits( hPSMem
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
//
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;
}
if ((pDC = GetSelectedInto()) == NULL)
{
::GpiSetBitmap(hPSMem, NULLHANDLE);
::GpiDestroyPS(hPSMem);
::DevCloseDC(hDCMem);
}
//
// Similarly, set data according to the possible mask bitmap
@@ -948,8 +975,8 @@ wxImage wxBitmap::ConvertToImage() const
HDC hMemDC = ::DevOpenDC( vHabmain
,OD_MEMORY
,"*"
,4
,(PDEVOPENDATA)pszData
,5L
,(PDEVOPENDATA)&vDop
,NULLHANDLE
);
HPS hMemPS = ::GpiCreatePS( vHabmain
@@ -1009,8 +1036,6 @@ wxImage wxBitmap::ConvertToImage() const
//
// Free allocated resources
//
::GpiDestroyPS(hPSMem);
::DevCloseDC(hDCMem);
free(lpBits);
return vImage;
} // end of wxBitmap::ConvertToImage

View 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);

View 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

View 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

View 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)

View 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);

View 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()