#include <math.h>
#if wxUSE_COMMON_DIALOGS
+#if wxUSE_NORLANDER_HEADERS
+ #include <windows.h>
+#endif
#include <commdlg.h>
#endif
static const int MM_POINTS = 9;
static const int MM_METRIC = 10;
-// ---------------------------------------------------------------------------
-// macros
-// ---------------------------------------------------------------------------
-
-// Logical to device
-// Absolute
-#define XLOG2DEV(x) (x)
-#define YLOG2DEV(y) (y)
-
-// Relative
-#define XLOG2DEVREL(x) (x)
-#define YLOG2DEVREL(y) (y)
-
-// Device to logical
-// Absolute
-#define XDEV2LOG(x) (x)
-
-#define YDEV2LOG(y) (y)
-
-// Relative
-#define XDEV2LOGREL(x) (x)
-#define YDEV2LOGREL(y) (y)
-
-/*
- * Have the same macros as for XView but not for every operation:
- * just for calculating window/viewport extent (a better way of scaling).
- */
-
-// Logical to device
-// Absolute
-#define MS_XLOG2DEV(x) LogicalToDevice(x)
-
-#define MS_YLOG2DEV(y) LogicalToDevice(y)
-
-// Relative
-#define MS_XLOG2DEVREL(x) LogicalToDeviceXRel(x)
-#define MS_YLOG2DEVREL(y) LogicalToDeviceYRel(y)
-
-// Device to logical
-// Absolute
-#define MS_XDEV2LOG(x) DeviceToLogicalX(x)
-
-#define MS_YDEV2LOG(y) DeviceToLogicalY(y)
-
-// Relative
-#define MS_XDEV2LOGREL(x) DeviceToLogicalXRel(x)
-#define MS_YDEV2LOGREL(y) DeviceToLogicalYRel(y)
-
-#define YSCALE(y) (yorigin - (y))
-
-#define wx_round(a) (int)((a)+.5)
-
// ===========================================================================
// implementation
// ===========================================================================
void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
{
- wxCHECK_RET( region.GetHRGN(), _T("invalid clipping region") );
+ wxCHECK_RET( region.GetHRGN(), T("invalid clipping region") );
wxRect box = region.GetBox();
void wxDC::Clear()
{
RECT rect;
- if (m_canvas)
+ if ( m_canvas )
+ {
GetClientRect((HWND) m_canvas->GetHWND(), &rect);
- else if (m_selectedBitmap.Ok())
+ }
+ else
{
+ wxCHECK_RET( m_selectedBitmap.Ok(), T("this DC can't be cleared") );
+
rect.left = 0; rect.top = 0;
rect.right = m_selectedBitmap.GetWidth();
rect.bottom = m_selectedBitmap.GetHeight();
}
+
(void) ::SetMapMode(GetHdc(), MM_TEXT);
DWORD colour = GetBkColor(GetHdc());
Arc(GetHdc(),xxx1,yyy1,xxx2,yyy2,
xx1,yy1,xx2,yy2);
- CalcBoundingBox((xc-radius), (yc-radius));
- CalcBoundingBox((xc+radius), (yc+radius));
+ CalcBoundingBox((long)(xc-radius), (long)(yc-radius));
+ CalcBoundingBox((long)(xc+radius), (long)(yc+radius));
}
void wxDC::DoDrawPoint(long x, long y)
HDC cdc = GetHdc();
HDC memdc = ::CreateCompatibleDC( cdc );
HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
+
+ wxASSERT_MSG( hbitmap, T("bitmap is ok but HBITMAP is NULL?") );
+
::SelectObject( memdc, hbitmap );
::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
::DeleteDC( memdc );
else
SetBkMode(GetHdc(), OPAQUE);
- (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), (char *) (const char *)text, strlen((const char *)text));
+ (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), WXSTRINGCAST text, wxStrlen(WXSTRINGCAST text));
if (m_textBackgroundColour.Ok())
(void)SetBkColor(GetHdc(), old_background);
+ // background colour is used only for DrawText, otherwise
+ // always TRANSPARENT, RR
+ SetBkMode(GetHdc(), TRANSPARENT);
+
CalcBoundingBox(x, y);
long w, h;
HFONT f = (HFONT) ::SelectObject(GetHdc(), (HFONT) m_font.GetResourceHandle());
if (f == (HFONT) NULL)
{
- wxLogDebug("::SelectObject failed in wxDC::SetFont.");
+ wxLogDebug(T("::SelectObject failed in wxDC::SetFont."));
}
if (!m_oldFont)
m_oldFont = (WXHFONT) f;
{
m_backgroundMode = mode;
+ // SetBackgroundColour now only refers to text background
+ // and m_backgroundMode is used there
+
+/*
if (m_backgroundMode == wxTRANSPARENT)
::SetBkMode(GetHdc(), TRANSPARENT);
else
- ::SetBkMode(GetHdc(), OPAQUE);
+ ::SetBkMode(GetHdc(), OPAQUE);
+*/
}
void wxDC::SetLogicalFunction(int function)
SIZE sizeRect;
TEXTMETRIC tm;
- GetTextExtentPoint(GetHdc(), (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect);
+ GetTextExtentPoint(GetHdc(), WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect);
GetTextMetrics(GetHdc(), &tm);
if (x) *x = XDEV2LOGREL(sizeRect.cx);