#include "wx/log.h"
#include "wx/icon.h"
#include "wx/msgdlg.h"
+ #include "wx/module.h"
#endif
#include "wx/dcprint.h"
, 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;
void wxDC::Clear()
{
+ //
+ // If this is a canvas DC then just fill with the background color
+ // Otherwise purge the whole thing
+ //
+ if (m_pCanvas)
+ {
+ RECTL vRect;
+
+ ::GpiQueryClipBox(m_hPS, &vRect);
+ ::WinFillRect(m_hPS, &vRect, ::GpiQueryBackColor(m_hPS));
+ }
+ else
::GpiErase(m_hPS);
} // end of wxDC::Clear
-void wxDC::DoFloodFill(
+bool wxDC::DoFloodFill(
wxCoord vX
, wxCoord vY
, const wxColour& rCol
lOptions = FF_SURFACE;
::GpiFloodFill(m_hPS, lOptions, lColor);
+
+ return TRUE;
} // end of wxDC::DoFloodFill
bool wxDC::DoGetPixel(
, bool bUseMask
)
{
- POINTL vPoint = {vX, vY};
+ if (!bUseMask && !IsKindOf(CLASSINFO(wxPrinterDC)))
+ {
+ HBITMAP hBitmap = (HBITMAP)rBmp.GetHBITMAP();
+ wxBitmap vNewBitmap( rBmp.GetWidth()
+ ,rBmp.GetHeight()
+ ,rBmp.GetDepth()
+ );
+ HBITMAP hBitmapOld = ::GpiSetBitmap((HPS)GetHPS(), vNewBitmap.GetHBITMAP());
+ LONG lOldTextground = ::GpiQueryColor((HPS)GetHPS());
+ LONG lOldBackground = ::GpiQueryBackColor((HPS)GetHPS());
+
+ if (m_textForegroundColour.Ok())
+ {
+ ::GpiSetColor( (HPS)GetHPS()
+ ,m_textForegroundColour.GetPixel()
+ );
+ }
+ if (m_textBackgroundColour.Ok())
+ {
+ ::GpiSetBackColor( (HPS)GetHPS()
+ ,m_textBackgroundColour.GetPixel()
+ );
+ }
- ::WinDrawBitmap( GetHPS()
- ,(HBITMAP)GetHbitmapOf(rBmp)
- ,NULL
- ,&vPoint
- ,0L
- ,0L
- ,DBM_NORMAL
- );
+ vY = OS2Y(vY,rBmp.GetHeight());
+
+ POINTL vPoint[4] = { vX, vY + rBmp.GetHeight()
+ ,vX + rBmp.GetWidth(), vY
+ ,0, 0
+ ,rBmp.GetWidth(), rBmp.GetHeight()
+ };
+ ::GpiWCBitBlt( (HPS)GetHPS()
+ ,hBitmap
+ ,4
+ ,vPoint
+ ,ROP_SRCCOPY
+ ,BBO_IGNORE
+ );
+ ::GpiSetBitmap((HPS)GetHPS(), hBitmapOld);
+ ::GpiSetColor((HPS)GetHPS(), lOldTextground);
+ ::GpiSetBackColor((HPS)GetHPS(), lOldBackground);
+ }
} // end of wxDC::DoDrawBitmap
void wxDC::DoDrawText(
// set GDI objects
// ---------------------------------------------------------------------------
+void wxDC::DoSelectPalette(
+ bool bRealize
+)
+{
+ //
+ // Set the old object temporarily, in case the assignment deletes an object
+ // that's not yet selected out.
+ //
+ if (m_hOldPalette)
+ {
+ m_hOldPalette = 0;
+ }
+
+ if (m_palette.Ok())
+ {
+ HPALETTE hOldPal;
+
+ hOldPal = ::GpiSelectPalette((HDC) m_hPS, (HPALETTE) m_palette.GetHPALETTE());
+ if (!m_hOldPalette)
+ m_hOldPalette = (WXHPALETTE)hOldPal;
+ }
+} // end of wxDC::DoSelectPalette
+
+void wxDC::InitializePalette()
+{
+ if (wxDisplayDepth() <= 8 )
+ {
+ //
+ // Look for any window or parent that has a custom palette. If any has
+ // one then we need to use it in drawing operations
+ //
+ wxWindow* pWin = m_pCanvas->GetAncestorWithCustomPalette();
+
+ m_hasCustomPalette = pWin && pWin->HasCustomPalette();
+ if (m_hasCustomPalette)
+ {
+ m_palette = pWin->GetPalette();
+
+ //
+ // turn on PM translation for this palette
+ //
+ DoSelectPalette();
+ }
+ }
+} // end of wxDC::InitializePalette
+
void wxDC::SetPalette(
const wxPalette& rPalette
)
ulOptions = PU_ARBITRARY | GPIF_DEFAULT;
::GpiSetPS(m_hPS, &vSize, ulOptions);
}
- m_nWindowExtX = (int)MS_XDEV2LOGREL(VIEWPORT_EXTENT);
- m_nWindowExtY = (int)MS_YDEV2LOGREL(VIEWPORT_EXTENT);
+ m_nWindowExtX = (int)MS_XDEV2LOG(VIEWPORT_EXTENT);
+ m_nWindowExtY = (int)MS_YDEV2LOG(VIEWPORT_EXTENT);
// ????
}; // end of wxDC::SetMapMode
wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
{
- return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_signX*m_scaleX));
+ // axis orientation is not taken into account for conversion of a distance
+ return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_scaleX));
}
wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
{
- return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY));
+ // axis orientation is not taken into account for conversion of a distance
+ return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_scaleY));
}
wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
{
- return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX);
+ // axis orientation is not taken into account for conversion of a distance
+ return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_scaleX);
}
wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
{
- return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY);
+ // axis orientation is not taken into account for conversion of a distance
+ return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_scaleY);
}
// ---------------------------------------------------------------------------