summaryrefslogtreecommitdiff
path: root/embedserv/source/embed/tracker.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2006-06-20 04:42:11 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2006-06-20 04:42:11 +0000
commit20f4b3125dfc18cbe1c08d933ed8a42fb801268c (patch)
tree95c4bed1058909e53009239119a1dd9d0d929cf3 /embedserv/source/embed/tracker.cxx
parent81bc1d96cd5426e1b043333a44aac31f046fa94f (diff)
INTEGRATION: CWS warnings01 (1.3.16); FILE MERGED
2006/02/20 15:31:47 cd 1.3.16.1: #i55991# Warning free code for Windows C++ compiler
Diffstat (limited to 'embedserv/source/embed/tracker.cxx')
-rw-r--r--embedserv/source/embed/tracker.cxx233
1 files changed, 120 insertions, 113 deletions
diff --git a/embedserv/source/embed/tracker.cxx b/embedserv/source/embed/tracker.cxx
index 727e4212c..7dad9c3bd 100644
--- a/embedserv/source/embed/tracker.cxx
+++ b/embedserv/source/embed/tracker.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: tracker.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 18:54:46 $
+ * last change: $Author: hr $ $Date: 2006-06-20 05:42:11 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -33,6 +33,7 @@
*
************************************************************************/
+#include "stdafx.h"
#include <stddef.h>
#include "syswinwrapper.hxx"
@@ -62,7 +63,7 @@ const AFX_HANDLEINFO _afxHandleInfo[] =
{ offsetof(RECT, right), offsetof(RECT, top), 0, 0, -1, 0, 0, 2 },
{ offsetof(RECT, right), offsetof(RECT, bottom), 0, 0, -1, -1, 3, 1 },
{ offsetof(RECT, left), offsetof(RECT, bottom), 0, 0, 0, -1, 2, 0 },
-
+
// side handles (top, right, bottom, left)
{ offsetof(RECT, left), offsetof(RECT, top), 1, 0, 0, 0, 4, 6 },
{ offsetof(RECT, right), offsetof(RECT, top), 0, 1, -1, 0, 7, 5 },
@@ -88,7 +89,8 @@ const AFX_RECTINFO _afxRectInfo[] =
};
-HBRUSH HalftoneBrush() {
+HBRUSH HalftoneBrush()
+{
if (_afxHalftoneBrush == NULL)
{
WORD grayPattern[8];
@@ -123,58 +125,59 @@ void DrawDragRect(
CombineRgn(rgnNew,rgnOutside,rgnInside,RGN_XOR);
HBRUSH hBrushOld = NULL;
- if (hBrush == NULL)
- hBrush = HalftoneBrush();
- if (hBrushLast == NULL)
- hBrushLast = hBrush;
-
- HRGN rgnLast,rgnUpdate;
- if (lpRectLast != NULL)
- {
- // find difference between new region and old region
- rgnLast = CreateRectRgn(0, 0, 0, 0);
+ if (hBrush == NULL)
+ hBrush = HalftoneBrush();
+ if (hBrushLast == NULL)
+ hBrushLast = hBrush;
+
+ HRGN rgnLast(NULL);
+ HRGN rgnUpdate(NULL);
+ if (lpRectLast != NULL)
+ {
+ // find difference between new region and old region
+ rgnLast = CreateRectRgn(0, 0, 0, 0);
SetRectRgn(
rgnOutside,
lpRectLast->left,
lpRectLast->top,
lpRectLast->right,
lpRectLast->bottom);
- rect = *lpRectLast;
- InflateRect(&rect,-sizeLast.cx, -sizeLast.cy);
- IntersectRect(&rect,&rect, lpRectLast);
- SetRectRgn(rgnInside,rect.left,rect.top,rect.right,rect.bottom);
- CombineRgn(rgnLast,rgnOutside,rgnInside, RGN_XOR);
+ rect = *lpRectLast;
+ InflateRect(&rect,-sizeLast.cx, -sizeLast.cy);
+ IntersectRect(&rect,&rect, lpRectLast);
+ SetRectRgn(rgnInside,rect.left,rect.top,rect.right,rect.bottom);
+ CombineRgn(rgnLast,rgnOutside,rgnInside, RGN_XOR);
// // only diff them if brushes are the same
- if (hBrush == hBrushLast)
- {
- rgnUpdate = CreateRectRgn(0, 0, 0, 0);
- CombineRgn(rgnUpdate,rgnLast,rgnNew, RGN_XOR);
- }
- }
- if (hBrush != hBrushLast && lpRectLast != NULL)
- {
- // brushes are different -- erase old region first
+ if (hBrush == hBrushLast)
+ {
+ rgnUpdate = CreateRectRgn(0, 0, 0, 0);
+ CombineRgn(rgnUpdate,rgnLast,rgnNew, RGN_XOR);
+ }
+ }
+ if (hBrush != hBrushLast && lpRectLast != NULL)
+ {
+ // brushes are different -- erase old region first
SelectClipRgn(hDC,rgnLast);
- GetClipBox(hDC,&rect);
- hBrushOld = (HBRUSH)SelectObject(hDC,(HGDIOBJ)hBrushLast);
- PatBlt(hDC,rect.left,rect.top,(rect.right-rect.left),(rect.bottom-rect.top),PATINVERT);
+ GetClipBox(hDC,&rect);
+ hBrushOld = (HBRUSH)SelectObject(hDC,(HGDIOBJ)hBrushLast);
+ PatBlt(hDC,rect.left,rect.top,(rect.right-rect.left),(rect.bottom-rect.top),PATINVERT);
SelectObject(hDC,(HGDIOBJ)hBrushOld);
- hBrushOld = NULL;
- }
+ hBrushOld = NULL;
+ }
- // draw into the update/new region
- SelectClipRgn(hDC,rgnUpdate);
+ // draw into the update/new region
+ SelectClipRgn(hDC,rgnUpdate);
- GetClipBox(hDC,&rect);
- hBrushOld = (HBRUSH) SelectObject(hDC,(HGDIOBJ) hBrush);
- PatBlt(hDC,rect.left, rect.top,(rect.right-rect.left),(rect.bottom-rect.top), PATINVERT);
-
+ GetClipBox(hDC,&rect);
+ hBrushOld = (HBRUSH) SelectObject(hDC,(HGDIOBJ) hBrush);
+ PatBlt(hDC,rect.left, rect.top,(rect.right-rect.left),(rect.bottom-rect.top), PATINVERT);
+
// cleanup DC
- if (hBrushOld != NULL)
- SelectObject(hDC,(HGDIOBJ)hBrushOld);
- SelectClipRgn(hDC,NULL);
+ if (hBrushOld != NULL)
+ SelectObject(hDC,(HGDIOBJ)hBrushOld);
+ SelectClipRgn(hDC,NULL);
}
@@ -214,7 +217,6 @@ using namespace winwrap;
Tracker::Tracker()
{
-
}
@@ -258,14 +260,14 @@ void Tracker::Construct()
// create black dotted pen
_afxBlackDottedPen = CreatePen(PS_DOT, 0, RGB(0, 0, 0));
}
-
+
// get default handle size from Windows profile setting
static const TCHAR szWindows[] = TEXT("windows");
static const TCHAR szInplaceBorderWidth[] =
TEXT("oleinplaceborderwidth");
_afxHandleSize = GetProfileInt(szWindows, szInplaceBorderWidth, 4);
bInitialized = TRUE;
-
+
_afxCursors[0] = _afxCursors[2] = LoadCursor(0,IDC_SIZENWSE);
_afxCursors[4] = _afxCursors[6] = LoadCursor(0,IDC_SIZENS);
_afxCursors[1] = _afxCursors[3] = LoadCursor(0,IDC_SIZENESW);
@@ -316,15 +318,15 @@ BOOL Tracker::SetCursor(HWND pWnd, UINT nHitTest) const
POINT point;
GetCursorPos(&point);
ScreenToClient(pWnd,&point);
-
+
// do hittest and normalize hit
int nHandle = HitTestHandles(point);
if (nHandle < 0)
return FALSE;
-
+
// need to normalize the hittest such that we get proper cursors
nHandle = NormalizeHit(nHandle);
-
+
// handle special case of hitting area between handles
// (logically the same -- handled as a move -- but different cursor)
if (nHandle == hitMiddle && !PtInRect(&m_rect,point))
@@ -367,14 +369,14 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
// save original width & height in pixels
int nWidth = m_rect.right - m_rect.left;
int nHeight = m_rect.bottom - m_rect.top;
-
+
// set capture to the window which received this message
SetCapture(hWnd);
UpdateWindow(hWnd);
if (hWndClipTo != NULL)
UpdateWindow(hWndClipTo);
RECT rectSave = m_rect;
-
+
// find out what x/y coords we are supposed to modify
int *px, *py;
int xDiff, yDiff;
@@ -410,74 +412,74 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
switch (msg.message)
{
// handle movement/accept messages
- case WM_LBUTTONUP:
- case WM_MOUSEMOVE:
- rectOld = m_rect;
- // handle resize cases (and part of move)
- if (px != NULL)
- *px = (int)(short)LOWORD(msg.lParam) - xDiff;
- if (py != NULL)
- *py = (int)(short)HIWORD(msg.lParam) - yDiff;
-
- // handle move case
- if (nHandle == hitMiddle)
- {
- m_rect.right = m_rect.left + nWidth;
- m_rect.bottom = m_rect.top + nHeight;
- }
- // allow caller to adjust the rectangle if necessary
- AdjustRect(nHandle,&m_rect);
-
- // only redraw and callback if the rect actually changed!
- m_bFinalErase = (msg.message == WM_LBUTTONUP);
- if (!EqualRect(&rectOld,&m_rect) || m_bFinalErase)
- {
- if (bMoved)
- {
- m_bErase = TRUE;
- DrawTrackerRect(&rectOld,hWndClipTo,hDrawDC,hWnd);
- }
- OnChangedRect(rectOld);
- if (msg.message != WM_LBUTTONUP)
- bMoved = TRUE;
- }
- if (m_bFinalErase)
- goto ExitLoop;
-
- if (!EqualRect(&rectOld,&m_rect))
- {
- m_bErase = FALSE;
- DrawTrackerRect(&m_rect,hWndClipTo,hDrawDC,hWnd);
- }
- break;
-
- // handle cancel messages
- case WM_KEYDOWN:
- if (msg.wParam != VK_ESCAPE)
- break;
- case WM_RBUTTONDOWN:
+ case WM_LBUTTONUP:
+ case WM_MOUSEMOVE:
+ rectOld = m_rect;
+ // handle resize cases (and part of move)
+ if (px != NULL)
+ *px = (int)(short)LOWORD(msg.lParam) - xDiff;
+ if (py != NULL)
+ *py = (int)(short)HIWORD(msg.lParam) - yDiff;
+
+ // handle move case
+ if (nHandle == hitMiddle)
+ {
+ m_rect.right = m_rect.left + nWidth;
+ m_rect.bottom = m_rect.top + nHeight;
+ }
+ // allow caller to adjust the rectangle if necessary
+ AdjustRect(nHandle,&m_rect);
+
+ // only redraw and callback if the rect actually changed!
+ m_bFinalErase = (msg.message == WM_LBUTTONUP);
+ if (!EqualRect(&rectOld,&m_rect) || m_bFinalErase)
+ {
if (bMoved)
{
- m_bErase = m_bFinalErase = TRUE;
- DrawTrackerRect(&m_rect, hWndClipTo, hDrawDC, hWnd);
+ m_bErase = TRUE;
+ DrawTrackerRect(&rectOld,hWndClipTo,hDrawDC,hWnd);
}
- m_rect = rectSave;
+ OnChangedRect(rectOld);
+ if (msg.message != WM_LBUTTONUP)
+ bMoved = TRUE;
+ }
+ if (m_bFinalErase)
goto ExitLoop;
-
- // just dispatch rest of the messages
- default:
- DispatchMessage(&msg);
+
+ if (!EqualRect(&rectOld,&m_rect))
+ {
+ m_bErase = FALSE;
+ DrawTrackerRect(&m_rect,hWndClipTo,hDrawDC,hWnd);
+ }
+ break;
+
+ // handle cancel messages
+ case WM_KEYDOWN:
+ if (msg.wParam != VK_ESCAPE)
break;
+ case WM_RBUTTONDOWN:
+ if (bMoved)
+ {
+ m_bErase = m_bFinalErase = TRUE;
+ DrawTrackerRect(&m_rect, hWndClipTo, hDrawDC, hWnd);
+ }
+ m_rect = rectSave;
+ goto ExitLoop;
+
+ // just dispatch rest of the messages
+ default:
+ DispatchMessage(&msg);
+ break;
}
}
-
- ExitLoop:
+
+ ExitLoop:
if (hWndClipTo != NULL)
ReleaseDC(hWndClipTo,hDrawDC);
else
ReleaseDC(hWnd,hDrawDC);
ReleaseCapture();
-
+
// restore rect in case bMoved is still FALSE
if (!bMoved)
m_rect = rectSave;
@@ -489,9 +491,8 @@ BOOL Tracker::TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo)
}
-void Tracker::OnChangedRect(const RECT& rectOld)
-{
-
+void Tracker::OnChangedRect(const RECT& /*rectOld*/)
+{
}
@@ -499,7 +500,7 @@ void Tracker::AdjustRect(int nHandle, LPRECT)
{
if(nHandle == hitMiddle)
return;
-
+
// convert the handle into locations within m_rect
int *px, *py;
GetModifyPointers(nHandle, &px, &py, NULL, NULL);
@@ -557,7 +558,7 @@ void Tracker::DrawTrackerRect(
size.cy = 1; // CY_BORDER;
}
}
-
+
// and draw it
if (m_bFinalErase || !m_bErase)
DrawDragRect(pDC,&rect,size,&m_rectLast,m_sizeLast);
@@ -702,7 +703,7 @@ int Tracker::GetHandleSize(LPRECT lpRect) const
{
if (lpRect == NULL)
lpRect = (LPRECT)&m_rect;
-
+
int size = m_nHandleSize;
if (!(m_nStyle & resizeOutside))
{
@@ -806,7 +807,7 @@ void Tracker::GetModifyPointers(
// fill in the part of the rect that this handle modifies
// (Note: handles that map to themselves along a given axis when that
// axis is inverted don't modify the value on that axis)
-
+
const AFX_HANDLEINFO* pHandleInfo = &_afxHandleInfo[nHandle];
if (pHandleInfo->nInvertX != nHandle)
{
@@ -834,3 +835,9 @@ void Tracker::GetModifyPointers(
}
}
+// Fix strange warnings about some
+// ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions.
+// warning C4505: 'xxx' : unreferenced local function has been removed
+#if defined(_MSC_VER)
+#pragma warning(disable: 4505)
+#endif