remove some backup files created by editplus
authorSteven Edwards <winehacker@gmail.com>
Thu, 10 Mar 2005 04:05:53 +0000 (04:05 +0000)
committerSteven Edwards <winehacker@gmail.com>
Thu, 10 Mar 2005 04:05:53 +0000 (04:05 +0000)
svn path=/trunk/; revision=13905

rosapps/games/solitaire/cardlib/cardbutton.cpp.bak [deleted file]
rosapps/games/solitaire/cardlib/cardrgnmouse.cpp.bak [deleted file]

diff --git a/rosapps/games/solitaire/cardlib/cardbutton.cpp.bak b/rosapps/games/solitaire/cardlib/cardbutton.cpp.bak
deleted file mode 100644 (file)
index 123f254..0000000
+++ /dev/null
@@ -1,489 +0,0 @@
-//\r
-//     CardLib - CardButton class\r
-//\r
-//     Freeware\r
-//     Copyright J Brown 2001\r
-//\r
-#include <windows.h>\r
-#include <tchar.h>\r
-\r
-#include "cardlib.h"\r
-#include "cardwindow.h"\r
-#include "cardbutton.h"\r
-#include "cardcolor.h"\r
-\r
-HPALETTE UseNicePalette(HDC, HPALETTE);\r
-void    RestorePalette(HDC, HPALETTE);\r
-\r
-void PaintRect(HDC hdc, RECT *rect, COLORREF colour);\r
-\r
-CardButton::CardButton(CardWindow &parent, int Id, TCHAR *szText, UINT Style, bool visible,\r
-                                               int x, int y, int width, int height)\r
-\r
- : parentWnd(parent), id(Id), fVisible(visible), uStyle(Style), ButtonCallback(0)\r
-{\r
-       crText = RGB(255,255,255);\r
-       crBack = RGB(0, 128, 0);\r
-       \r
-       xadjust = 0;\r
-       yadjust = 0;\r
-       xjustify = 0;\r
-       yjustify = 0;\r
-\r
-       fMouseDown = false;\r
-       fButtonDown = false;\r
-\r
-       hIcon = 0;\r
-\r
-       SetText(szText);\r
-       Move(x, y, width, height);\r
-\r
-       mxlock = CreateMutex(0, FALSE, 0);\r
-\r
-       hFont = 0;\r
-}\r
-\r
-CardButton::~CardButton()\r
-{\r
-       CloseHandle(mxlock);\r
-}\r
-\r
-void CardButton::DrawRect(HDC hdc, RECT *rect, bool fNormal)\r
-{\r
-       RECT fill;\r
-\r
-       HANDLE hOld;\r
-\r
-       HPEN hhi = CreatePen(0, 0, MAKE_PALETTERGB(crHighlight));\r
-       HPEN hsh = CreatePen(0, 0, MAKE_PALETTERGB(crShadow));\r
-       HPEN hbl = (HPEN)GetStockObject(BLACK_PEN);\r
-       \r
-       int x           = rect->left;\r
-       int y           = rect->top;\r
-       int width       = rect->right-rect->left - 1;\r
-       int height      = rect->bottom-rect->top - 1;\r
-       \r
-       SetRect(&fill, x+1, y+1, x+width-1, y+height-1);\r
-\r
-       int one = 1;\r
-       \r
-       if(!fNormal)\r
-       {\r
-               x += width;\r
-               y += height;\r
-               width = -width;\r
-               height = -height;\r
-               one = -1;\r
-               OffsetRect(&fill, 1, 1);\r
-       }\r
-       \r
-       if(fNormal)\r
-               hOld = SelectObject(hdc, hhi);\r
-       else\r
-               hOld = SelectObject(hdc, hhi);\r
-\r
-       MoveToEx(hdc, x, y+height, 0);\r
-       LineTo(hdc, x, y);\r
-       LineTo(hdc, x+width, y);\r
-       SelectObject(hdc, hOld);\r
-\r
-       hOld = SelectObject(hdc, hbl);\r
-       LineTo(hdc, x+width, y+height);\r
-       LineTo(hdc, x-one, y+height);\r
-       SelectObject(hdc, hOld);\r
-\r
-       hOld = SelectObject(hdc, hsh);\r
-       MoveToEx(hdc, x+one, y+height-one, 0);\r
-       LineTo(hdc, x+width-one, y+height-one);\r
-       LineTo(hdc, x+width-one, y);\r
-       SelectObject(hdc, hOld);\r
-\r
-       PaintRect(hdc, &fill, MAKE_PALETTERGB(crBack));\r
-\r
-       DeleteObject(hhi);\r
-       DeleteObject(hsh);\r
-}\r
-\r
-void CardButton::Clip(HDC hdc)\r
-{\r
-       if(fVisible == false) return;\r
-       \r
-       ExcludeClipRect(hdc, rect.left,  rect.top, rect.right, rect.bottom);\r
-}\r
-\r
-void CardButton::Draw(HDC hdc, bool fNormal)\r
-{\r
-       SIZE textsize;\r
-       int x, y;               //text x, y\r
-       int ix, iy;             //icon x, y\r
-       int iconwidth = 0;\r
-\r
-       RECT cliprect;\r
-\r
-       if(fVisible == 0) return;\r
-\r
-       if(hFont == 0)\r
-               SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));    \r
-       else\r
-               SelectObject(hdc, hFont);       \r
-       \r
-       GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textsize);\r
-       \r
-       if(hIcon)\r
-       {\r
-               x = rect.left + 32 + 8;\r
-       }\r
-       else\r
-       {\r
-               if(uStyle & CB_ALIGN_LEFT)\r
-               {\r
-                       x = rect.left + iconwidth;\r
-               }\r
-               else if(uStyle & CB_ALIGN_RIGHT)\r
-               {\r
-                       x = rect.left + (rect.right-rect.left-iconwidth-textsize.cx);\r
-               }\r
-               else    //centered\r
-               {\r
-                       x = rect.right - rect.left - iconwidth;\r
-                       x = (x - textsize.cx) / 2;\r
-                       x += rect.left + iconwidth;\r
-               }\r
-       }\r
-       \r
-       y = rect.bottom - rect.top;\r
-       y = (y - textsize.cy) / 2;\r
-       y += rect.top;\r
-       \r
-       //calc icon position..\r
-       ix = rect.left + 4;\r
-       iy = rect.top + (rect.bottom-rect.top-32) / 2;\r
-\r
-       //if button is pressed, then shift text\r
-       if(fNormal == false && (uStyle & CB_PUSHBUTTON))\r
-       {\r
-               x += 1;\r
-               y += 1;\r
-               ix += 1;\r
-               iy += 1;\r
-       }\r
-\r
-       SetRect(&cliprect, x, y, x+textsize.cx, y+textsize.cy);\r
-       ExcludeClipRect(hdc, x, y, x+textsize.cx, y+textsize.cy);\r
-\r
-       //\r
-       //      Calc icon pos\r
-       //\r
-       \r
-       if(hIcon)\r
-       {\r
-               ExcludeClipRect(hdc, ix, iy, ix + 32, iy + 32);\r
-       }\r
-       \r
-       if(uStyle & CB_PUSHBUTTON)\r
-       {\r
-               DrawRect(hdc, &rect, fNormal);\r
-\r
-               SetBkColor(hdc,   MAKE_PALETTERGB(crBack));\r
-               SetTextColor(hdc, crText);//MAKE_PALETTERGB(crText));\r
-               \r
-               SelectClipRgn(hdc, 0);          \r
-\r
-               ExtTextOut(hdc, x, y, ETO_OPAQUE, &cliprect, szText, lstrlen(szText), 0);\r
-       }\r
-       else\r
-       {\r
-               SetBkColor(hdc,   MAKE_PALETTERGB(crBack));\r
-               SetTextColor(hdc, crText);//MAKE_PALETTERGB(crText));\r
-\r
-               SelectClipRgn(hdc, 0);\r
-\r
-               ExtTextOut(hdc, x, y, ETO_OPAQUE, &rect, szText, lstrlen(szText), 0);\r
-       }\r
-\r
-       if(hIcon)\r
-       {\r
-               HBRUSH hbr = CreateSolidBrush(MAKE_PALETTERGB(crBack));\r
-               DrawIconEx(hdc, ix, iy, hIcon, 32, 32, 0, hbr, 0);\r
-               DeleteObject(hbr);\r
-       }\r
-\r
-}\r
-\r
-void CardButton::AdjustPosition(int winwidth, int winheight)\r
-{\r
-       int width = rect.right-rect.left;\r
-       int height = rect.bottom-rect.top;\r
-\r
-       width = width & ~0x1;\r
-\r
-       switch(xjustify)\r
-       {\r
-       case CS_XJUST_NONE:\r
-               break;\r
-\r
-       case CS_XJUST_CENTER:           //centered\r
-               rect.left = (winwidth - (width)) / 2;\r
-               rect.left += xadjust;\r
-               rect.right = rect.left+width;\r
-               break;\r
-\r
-       case CS_XJUST_RIGHT:            //right-aligned\r
-               rect.left = winwidth - width;\r
-               rect.left += xadjust;\r
-               rect.right = rect.left+width;\r
-               break;\r
-       }\r
-\r
-       switch(yjustify)\r
-       {\r
-       case CS_YJUST_NONE:\r
-               break;\r
-\r
-       case CS_YJUST_CENTER:           //centered\r
-               rect.top = (winheight - (height)) / 2;\r
-               rect.top += yadjust;\r
-               rect.bottom = rect.top+height;\r
-               break;\r
-\r
-       case CS_YJUST_BOTTOM:           //right-aligned\r
-               rect.top = winheight - height;\r
-               rect.top += yadjust;\r
-               rect.bottom = rect.top+height;\r
-               break;\r
-       }\r
-\r
-}\r
-\r
-int CardButton::OnLButtonDown(HWND hwnd, int x, int y)\r
-{\r
-       if((uStyle & CB_PUSHBUTTON) == 0) \r
-               return 0;\r
-\r
-       //make sure that the user is allowed to do something\r
-       if(WaitForSingleObject(mxlock, 0) != WAIT_OBJECT_0)\r
-       {\r
-               return 0;\r
-       }\r
-       else\r
-       {\r
-               ReleaseMutex(mxlock);\r
-       }\r
-       \r
-       fMouseDown = true;\r
-       fButtonDown = true;\r
-\r
-       Redraw();\r
-\r
-       SetCapture(hwnd);\r
-\r
-       return 1;\r
-}\r
-\r
-int CardButton::OnMouseMove(HWND hwnd, int x, int y)\r
-{\r
-       if(fMouseDown)\r
-       {\r
-               bool fOldButtonDown = fButtonDown;\r
-\r
-               POINT pt;\r
-               \r
-               pt.x = x;\r
-               pt.y = y;\r
-               \r
-               if(PtInRect(&rect, pt))\r
-                       fButtonDown = true;\r
-               else\r
-                       fButtonDown = false;\r
-               \r
-               if(fButtonDown != fOldButtonDown)\r
-                       Redraw();\r
-       }\r
-       \r
-       return 0;\r
-}\r
-\r
-int CardButton::OnLButtonUp(HWND hwnd, int x, int y)\r
-{\r
-       if(fMouseDown)\r
-       {\r
-               fMouseDown = false;\r
-               fButtonDown = false;\r
-               \r
-               if(uStyle & CB_PUSHBUTTON)\r
-               {\r
-                       Redraw();\r
-                       ReleaseCapture();\r
-               }\r
-               \r
-               //if have clicked the button\r
-               if(parentWnd.CardButtonFromPoint(x, y) == this)\r
-               {\r
-                       if(ButtonCallback)\r
-                       {\r
-                               ButtonCallback(*this);  \r
-                       }\r
-                       else\r
-                       {\r
-                               HWND hwnd = (HWND)parentWnd;\r
-                               SendMessage(GetParent(hwnd), WM_COMMAND, MAKEWPARAM(id, BN_CLICKED), (LONG)hwnd);\r
-                       }\r
-               }\r
-       }\r
-\r
-       return 0;\r
-}\r
-\r
-#define _countof(array) (sizeof(array)/sizeof(array[0]))\r
-\r
-CardButton *CardWindow::CreateButton(int id, TCHAR *szText, UINT uStyle, bool fVisible, int x, int y, int width, int height)\r
-{\r
-       CardButton *cb;\r
-\r
-       if(nNumButtons == MAXBUTTONS) \r
-               return 0;\r
-\r
-       cb = new CardButton(*this, id, szText, uStyle, fVisible, x, y, width, height);\r
-       Buttons[nNumButtons++] = cb;\r
-\r
-       if(uStyle & CB_PUSHBUTTON)\r
-       {\r
-               cb->SetBackColor(CardButton::GetFace(crBackgnd));\r
-               //cb->SetBackColor(ScaleLumRGB(crBackgnd, 0.1));\r
-               cb->SetForeColor(RGB(255,255,255));\r
-       }\r
-       else\r
-       {\r
-               cb->SetBackColor(crBackgnd);\r
-               cb->SetForeColor(RGB(255,255,255));\r
-       }\r
-       \r
-       return cb;\r
-}\r
-\r
-void CardButton::SetText(TCHAR *lpszFormat, ...)\r
-{\r
-       int count;\r
-\r
-       va_list args;\r
-       va_start(args, lpszFormat);\r
-\r
-       count = wvsprintf(szText, lpszFormat, args);\r
-       va_end(args);\r
-}\r
-\r
-int CardButton::Id()\r
-{\r
-       return id;\r
-}\r
-\r
-void CardButton::Show(bool fShow)\r
-{\r
-       fVisible = fShow;\r
-}\r
-\r
-void CardButton::Move(int x, int y, int width, int height)\r
-{\r
-       SetRect(&rect, x, y, x+width, y+height);\r
-}\r
-\r
-void CardButton::Redraw()\r
-{\r
-       HDC hdc = GetDC((HWND)parentWnd);\r
-\r
-       HPALETTE hOldPal = UseNicePalette(hdc, __hPalette);\r
-\r
-       Draw(hdc, !fButtonDown);\r
-       \r
-       RestorePalette(hdc, hOldPal);\r
-       \r
-       ReleaseDC((HWND)parentWnd, hdc);\r
-}\r
-\r
-void CardButton::SetForeColor(COLORREF cr)\r
-{\r
-       crText = cr;\r
-}\r
-\r
-void CardButton::SetBackColor(COLORREF cr)\r
-{\r
-       crBack = cr;\r
-\r
-       crHighlight = GetHighlight(cr);\r
-       crShadow    = GetShadow(cr);\r
-       \r
-       //crHighlight = ScaleLumRGB(cr, +0.25);\r
-       //crShadow    = ScaleLumRGB(cr, -0.25);\r
-}\r
-\r
-//     Static member\r
-COLORREF CardButton::GetHighlight(COLORREF crBase)\r
-{\r
-       return ColorScaleRGB(crBase, RGB(255,255,255), 0.25);\r
-}\r
-\r
-//     Static member\r
-COLORREF CardButton::GetShadow(COLORREF crBase)\r
-{\r
-       return ColorScaleRGB(crBase, RGB(0,  0,  0),   0.25);\r
-}\r
-\r
-COLORREF CardButton::GetFace(COLORREF crBase)\r
-{\r
-       return ColorScaleRGB(crBase, RGB(255,255,255), 0.1);\r
-}\r
-\r
-void CardButton::SetPlacement(UINT xJustify, UINT yJustify, int xAdjust, int yAdjust)\r
-{\r
-       xadjust = xAdjust;\r
-       yadjust = yAdjust;\r
-       xjustify = xJustify;\r
-       yjustify = yJustify;\r
-}\r
-\r
-void CardButton::SetIcon(HICON hicon, bool fRedraw)\r
-{\r
-       hIcon = hicon;\r
-       \r
-       if(fRedraw)\r
-               Redraw();\r
-}\r
-\r
-void CardButton::SetFont(HFONT font)\r
-{\r
-       //don't delete the existing font..\r
-       hFont = font;\r
-}\r
-\r
-void CardButton::SetButtonProc(pButtonProc proc)\r
-{\r
-       ButtonCallback  = proc;\r
-}\r
-\r
-bool CardButton::Lock()\r
-{\r
-       DWORD dw = WaitForSingleObject(mxlock, 0);\r
-\r
-       if(dw == WAIT_OBJECT_0)\r
-               return true; \r
-       else\r
-               return false;\r
-}\r
-\r
-bool CardButton::UnLock()\r
-{\r
-       if(ReleaseMutex(mxlock))\r
-               return true;\r
-       else\r
-               return false;\r
-}\r
-\r
-void CardButton::SetStyle(UINT style)\r
-{\r
-       uStyle = style;\r
-}\r
-\r
-UINT CardButton::GetStyle()\r
-{\r
-       return uStyle;\r
-}
\ No newline at end of file
diff --git a/rosapps/games/solitaire/cardlib/cardrgnmouse.cpp.bak b/rosapps/games/solitaire/cardlib/cardrgnmouse.cpp.bak
deleted file mode 100644 (file)
index 1a913dc..0000000
+++ /dev/null
@@ -1,618 +0,0 @@
-//\r
-//     CardLib - CardRegion mouse-related stuff\r
-//\r
-//     Freeware\r
-//     Copyright J Brown 2001\r
-//\r
-#include <windows.h>\r
-#include <math.h>\r
-\r
-#include "cardlib.h"\r
-#include "cardwindow.h"\r
-#include "cardregion.h"\r
-\r
-double __CARDZOOMSPEED = 32;\r
-\r
-int ClipCard(HDC hdc, int x, int y, int width, int height);\r
-void DrawCard(HDC hdc, int x, int y, HDC hdcSource, int width, int height);\r
-\r
-#ifdef _DEBUG\r
-\r
-static pDebugClickProc DebugStackClickProc = 0;\r
-\r
-void CardLib_SetStackClickProc(pDebugClickProc proc)\r
-{\r
-       DebugStackClickProc = proc;\r
-}\r
-\r
-#endif\r
-\r
-CardRegion *CardWindow::GetBestStack(int x, int y, int w, int h)\r
-{\r
-       int maxoverlap    =  0;\r
-       int maxoverlapidx = -1;\r
-\r
-       //find the stack which is most covered by the dropped\r
-       //cards. Only include those which allow drops.\r
-       //\r
-       for(int i = 0; i < nNumCardRegions; i++)\r
-       {\r
-               int percent = Regions[i]->GetOverlapRatio(x, y, w, h);\r
-\r
-               //if this stack has the biggest coverage yet\r
-               if(percent > maxoverlap && Regions[i]->IsVisible())\r
-               {\r
-                       maxoverlap = percent;\r
-                       maxoverlapidx = i;\r
-               }\r
-       }\r
-       \r
-       //if we found a stack to drop onto\r
-       if(maxoverlapidx != -1)\r
-       {\r
-               return Regions[maxoverlapidx];\r
-       }\r
-       else\r
-       {\r
-               return 0;\r
-       }\r
-}\r
-\r
-bool CardRegion::IsPointInStack(int x, int y)\r
-{\r
-       int axpos = xoffset < 0 ? xpos + (nNumApparentCards-1)*xoffset : xpos;\r
-       int aypos = yoffset < 0 ? ypos + (nNumApparentCards-1)*yoffset : ypos;\r
-       \r
-       if(x >= axpos && x < axpos + width && y >= aypos && y < aypos + height && fVisible)\r
-               return true;\r
-       else\r
-               return false;\r
-}\r
-\r
-int CardRegion::GetNumDragCards(int x, int y)\r
-{\r
-       int cardindex = 0;              //index from stack start\r
-       int maxidx;\r
-\r
-       //make x,y relative to the stack's upper left corner\r
-       x -= xpos + (xoffset < 0 ? (nNumApparentCards/*cardstack.NumCards()*/ - 1) * xoffset : 0);\r
-       y -= ypos + (yoffset < 0 ? (nNumApparentCards/*cardstack.NumCards()*/ - 1) * yoffset : 0);\r
-       \r
-       //if stack is empty, cannot drag any cards from it\r
-       if(cardstack.NumCards() <= 0)\r
-               return 0;\r
-\r
-       //see which card in the stack has been clicked on\r
-       //top-bottom ordering\r
-       if(yoffset > 0)\r
-       {\r
-               if(y < height - __cardheight)\r
-                       cardindex = y / yoffset;\r
-               else\r
-                       cardindex = cardstack.NumCards() - 1;\r
-       }\r
-       else if(yoffset < 0)\r
-       {\r
-               if(y < __cardheight)\r
-                       cardindex = cardstack.NumCards() - 1;\r
-               else\r
-                       cardindex = cardstack.NumCards() - ((y - __cardheight) / -yoffset) - 2;\r
-       }\r
-       else    //yoffset == 0\r
-       {\r
-               cardindex = cardstack.NumCards() - 1;\r
-       }\r
-\r
-       maxidx = cardindex;\r
-\r
-       //if left-right\r
-       if(xoffset > 0)\r
-       {\r
-               if(x < width - __cardwidth)\r
-                       cardindex = x / xoffset;\r
-               else\r
-                       cardindex = cardstack.NumCards() - 1;\r
-       }\r
-       else if(xoffset < 0)\r
-       {\r
-               if(x < __cardwidth)\r
-                       cardindex = cardstack.NumCards() - 1;\r
-               else\r
-                       cardindex = cardstack.NumCards() - ((x - __cardwidth) / -xoffset) - 2;\r
-       }\r
-       else\r
-       {\r
-               cardindex = cardstack.NumCards() - 1;\r
-       }\r
-\r
-       if(cardindex > maxidx) cardindex = maxidx;\r
-\r
-       if(cardindex > cardstack.NumCards())\r
-               cardindex = 1;\r
-\r
-       //if are trying to drag too many cards at once\r
-       return cardstack.NumCards() - cardindex;\r
-}\r
-\r
-bool CardRegion::CanDragCards(int iNumCards)\r
-{\r
-       if(iNumCards <= 0) return false;\r
-       if(nThreedCount > 1 && iNumCards > 1) return false;\r
-\r
-       if(WaitForSingleObject(mxlock, 0) != WAIT_OBJECT_0)\r
-       {\r
-//             TRACE("Failed to gain access to card stack\n");\r
-               return false;\r
-       }\r
-\r
-       ReleaseMutex(mxlock);\r
-\r
-       switch(uDragRule)\r
-       {\r
-       case CS_DRAG_ALL:\r
-               return true;\r
-               \r
-       case CS_DRAG_TOP:\r
-\r
-               if(iNumCards == 1)\r
-                       return true;\r
-               else\r
-                       return false;\r
-               \r
-       case CS_DRAG_NONE:\r
-               return false;\r
-               \r
-       case CS_DRAG_CALLBACK:\r
-               \r
-               if(CanDragCallback)\r
-               {\r
-                       return CanDragCallback(*this, iNumCards);\r
-               }\r
-               else\r
-               {\r
-                       return false;\r
-               }\r
-               \r
-       default:\r
-               return false;\r
-       }\r
-}\r
-\r
-bool CardRegion::CanDropCards(CardStack &cards)\r
-{\r
-       if(WaitForSingleObject(mxlock, 0) != WAIT_OBJECT_0)\r
-       {\r
-               return false;\r
-       }\r
-\r
-       ReleaseMutex(mxlock);\r
-\r
-       switch(uDropRule)\r
-       {\r
-       case CS_DROP_ALL:\r
-               return true;\r
-\r
-       case CS_DROP_NONE:\r
-               return false;\r
-\r
-       case CS_DROP_CALLBACK:\r
-               \r
-               if(CanDropCallback)\r
-               {\r
-                       return CanDropCallback(*this, cards);\r
-               }\r
-               else\r
-               {\r
-                       return false;\r
-               }\r
-\r
-       default:\r
-               return false;\r
-       }\r
-}\r
-\r
-bool CardRegion::OnLButtonDblClk(int x, int y)\r
-{\r
-       iNumDragCards = GetNumDragCards(x, y); \r
-\r
-       if(DblClickCallback)\r
-               DblClickCallback(*this, iNumDragCards);\r
-\r
-       return true;\r
-}\r
-\r
-bool CardRegion::OnLButtonDown(int x, int y)\r
-{\r
-       iNumDragCards = GetNumDragCards(x, y); \r
-\r
-#ifdef _DEBUG\r
-       if(DebugStackClickProc)\r
-       {\r
-               if(!DebugStackClickProc(*this))\r
-                       return false;\r
-       }\r
-#endif\r
-\r
-       if(ClickCallback)\r
-               ClickCallback(*this, iNumDragCards);\r
-\r
-       if(CanDragCards(iNumDragCards) != false)\r
-    {\r
-\r
-               //offset of the mouse cursor relative to the top-left corner\r
-               //of the cards that are being dragged\r
-               mousexoffset = x - xpos - xoffset * (nNumApparentCards - iNumDragCards);\r
-               mouseyoffset = y - ypos - yoffset * (nNumApparentCards - iNumDragCards);\r
-               \r
-               if(xoffset < 0)\r
-                       mousexoffset += -xoffset * (iNumDragCards - 1);\r
-\r
-               if(yoffset < 0)\r
-                       mouseyoffset += -yoffset * (iNumDragCards - 1);\r
-               \r
-               //remove the cards from the source stack\r
-               dragstack = cardstack.Pop(iNumDragCards);\r
-\r
-               //prepare the back buffer, and the drag image\r
-               PrepareDragBitmaps(iNumDragCards);\r
-\r
-               oldx = x - mousexoffset;\r
-               oldy = y - mouseyoffset;\r
-               \r
-               Update();                       //Update this stack's card count + size\r
-\r
-               SetCapture((HWND)parentWnd);\r
-\r
-               //set AFTER settings the dragstack...\r
-               fMouseDragging = true;\r
-\r
-               return true;\r
-       }\r
-\r
-       return false;\r
-}\r
-\r
-bool CardRegion::OnLButtonUp(int x, int y)\r
-{\r
-       CardRegion *pDestStack = 0;\r
-       HDC hdc;\r
-       int dropstackid = CS_DROPZONE_NODROP;\r
-       \r
-       RECT dragrect;\r
-       DropZone *dropzone;\r
-\r
-       fMouseDragging = false;\r
-\r
-       //first of all, see if any drop zones have been registered\r
-       SetRect(&dragrect, x-mousexoffset, y-mouseyoffset, x-mousexoffset+nDragCardWidth, y-mouseyoffset+nDragCardHeight);\r
-\r
-       dropzone = parentWnd.GetDropZoneFromRect(&dragrect);\r
-\r
-       if(dropzone)\r
-       {\r
-               dropstackid = dropzone->DropCards(dragstack);\r
-               \r
-               if(dropstackid != CS_DROPZONE_NODROP)\r
-                       pDestStack = parentWnd.CardRegionFromId(dropstackid);\r
-               else\r
-                       pDestStack = 0;\r
-       }\r
-       else\r
-       {\r
-               pDestStack = parentWnd.GetBestStack(x - mousexoffset, y - mouseyoffset, nDragCardWidth, nDragCardHeight);\r
-       }\r
-       \r
-       // If have found a stack to drop onto\r
-       //\r
-       if(pDestStack && pDestStack->CanDropCards(dragstack)) \r
-       {\r
-               hdc = GetDC((HWND)parentWnd);\r
-               //                      UseNicePalette(hdc);\r
-               ZoomCard(hdc, x - mousexoffset, y  - mouseyoffset, pDestStack);\r
-               ReleaseDC((HWND)parentWnd, hdc);\r
-               \r
-               //\r
-               //add the cards to the destination stack\r
-               //\r
-               CardStack temp = pDestStack->GetCardStack();\r
-               temp.Push(dragstack);\r
-               \r
-               pDestStack->SetCardStack(temp);\r
-//             pDestStack->Update();           //Update this stack's card count + size\r
-//             pDestStack->UpdateFaceDir(temp);\r
-               \r
-               //      Call the remove callback on THIS stack, if one is specified\r
-               //\r
-               if(RemoveCallback)\r
-                       RemoveCallback(*this, iNumDragCards);\r
-\r
-               //      Call the add callback, if one is specified\r
-               //\r
-               if(pDestStack->AddCallback)\r
-                       pDestStack->AddCallback(*pDestStack, pDestStack->cardstack);//index, deststack->numcards);\r
-               \r
-               RedrawIfNotDim(pDestStack, true);\r
-       }       \r
-\r
-       //\r
-       //      Otherwise, let the cards snap back onto this stack\r
-       //\r
-       else\r
-       {\r
-               \r
-               hdc = GetDC((HWND)parentWnd);\r
-               ZoomCard(hdc, x - mousexoffset, y - mouseyoffset, this);\r
-               cardstack += dragstack;\r
-               ReleaseDC((HWND)parentWnd, hdc);\r
-\r
-               Update();               //Update this stack's card count + size\r
-       }\r
-       \r
-       ReleaseDragBitmaps();\r
-       ReleaseCapture();\r
-       \r
-       return true;\r
-}\r
-\r
-bool CardRegion::OnMouseMove(int x, int y)\r
-{\r
-       HDC hdc;\r
-\r
-       hdc = GetDC((HWND)parentWnd);\r
-               \r
-       x -= mousexoffset;\r
-       y -= mouseyoffset;\r
-               \r
-       MoveDragCardTo(hdc, x, y);\r
-\r
-       //BitBlt(hdc, nDragCardWidth+10, 0, nDragCardWidth, nDragCardHeight, hdcBackGnd, 0, 0, SRCCOPY);\r
-       //BitBlt(hdc, 0, 0, nDragCardWidth, nDragCardHeight, hdcDragCard, 0, 0, SRCCOPY);\r
-       \r
-       ReleaseDC((HWND)parentWnd, hdc);\r
-               \r
-       oldx = x;\r
-       oldy = y;\r
-       \r
-       return true;\r
-}\r
-\r
-//\r
-//     There is a bug in BitBlt when the source x,y\r
-//     become < 0. So this wrapper function simply adjusts\r
-//     the coords so that we never try to blt in from this range\r
-//\r
-BOOL ClippedBitBlt(HDC hdcDest, int x, int y, int width, int height, HDC hdcSrc, int srcx, int srcy, DWORD dwROP)\r
-{\r
-       if(srcx < 0)\r
-       {\r
-               x = 0 - srcx;\r
-               width = width + srcx;\r
-               srcx = 0;\r
-       }\r
-\r
-       if(srcy < 0)\r
-       {\r
-               y = 0 - srcy;\r
-               height = height + srcy;\r
-               srcy = 0;\r
-       }\r
-\r
-       return BitBlt(hdcDest, x, y, width, height, hdcSrc, srcx, srcy, dwROP);\r
-}\r
-\r
-void CardRegion::MoveDragCardTo(HDC hdc, int x, int y)\r
-{\r
-       RECT inter, rect1, rect2;\r
-\r
-       //mask off the new position of the drag-card, so\r
-       //that it will not be painted over\r
-       ClipCard(hdc, x, y, nDragCardWidth, nDragCardHeight);\r
-       \r
-       //restore the area covered by the card at its previous position\r
-       BitBlt(hdc, oldx, oldy, nDragCardWidth, nDragCardHeight, hdcBackGnd, 0, 0, SRCCOPY);\r
-\r
-       //remove clipping so we can draw the card at its new place\r
-       SelectClipRgn(hdc, NULL);\r
-       \r
-       //if the card's old and new positions overlap, then we\r
-       //need some funky code to update the "saved background" image,\r
-       SetRect(&rect1, oldx, oldy, oldx+nDragCardWidth, oldy+nDragCardHeight);\r
-       SetRect(&rect2,    x,    y,    x+nDragCardWidth,    y+nDragCardHeight);\r
-       \r
-       if(IntersectRect(&inter, &rect1, &rect2))\r
-       {\r
-               int interwidth = inter.right-inter.left;\r
-               int interheight = inter.bottom-inter.top;\r
-               int destx, desty, srcx, srcy;\r
-               \r
-               if(rect2.left > rect1.left) \r
-               {       \r
-                       destx = 0; srcx = nDragCardWidth - interwidth; \r
-               }\r
-               else\r
-               {\r
-                       destx = nDragCardWidth  - interwidth; srcx = 0;\r
-               }\r
-               \r
-               if(rect2.top  > rect1.top) \r
-               {\r
-                       desty = 0; srcy = nDragCardHeight - interheight;\r
-               }\r
-               else \r
-               {\r
-                       desty = nDragCardHeight - interheight; srcy = 0;\r
-               }\r
-               \r
-               //shift the bit we didn't use for the restore (due to the clipping)\r
-               //into the opposite corner\r
-               BitBlt(hdcBackGnd, destx,desty, interwidth, interheight, hdcBackGnd, srcx, srcy, SRCCOPY);\r
-               \r
-               ExcludeClipRect(hdcBackGnd, destx, desty, destx+interwidth, desty+interheight);\r
-               \r
-               //this bit requires us to clip the BitBlt (from screen to background)\r
-               //as BitBlt is a bit buggy it seems\r
-               ClippedBitBlt(hdcBackGnd, 0,0, nDragCardWidth, nDragCardHeight, hdc, x, y, SRCCOPY);\r
-               SelectClipRgn(hdcBackGnd, NULL);\r
-       }\r
-       else\r
-       {\r
-               BitBlt(hdcBackGnd, 0,0, nDragCardWidth, nDragCardHeight, hdc, x, y, SRCCOPY);\r
-       }\r
-       \r
-       //finally draw the card to the screen\r
-       DrawCard(hdc, x, y, hdcDragCard, nDragCardWidth, nDragCardHeight);\r
-}\r
-\r
-\r
-//extern "C" int _fltused(void) { return 0; }\r
-//extern "C" int _ftol(void) { return 0; }\r
-\r
-//\r
-//     Better do this in fixed-point, to stop\r
-//     VC from linking in floatingpoint-long conversions\r
-//\r
-//#define FIXED_PREC_MOVE\r
-#ifdef  FIXED_PREC_MOVE\r
-#define PRECISION 12\r
-void ZoomCard(HDC hdc, int xpos, int ypos, CARDSTACK *dest)\r
-{\r
-       long dx, dy, x , y;\r
-\r
-       \r
-       int apparentcards;\r
-       x = xpos << PRECISION; y = ypos << PRECISION;\r
-\r
-       oldx = (int)xpos;\r
-       oldy = (int)ypos;\r
-\r
-       apparentcards=dest->numcards/dest->threedcount;\r
-\r
-       int idestx = dest->xpos + dest->xoffset * (apparentcards);// - iNumDragCards); \r
-       int idesty = dest->ypos + dest->yoffset * (apparentcards);// - iNumDragCards);\r
-\r
-       //normalise the motion vector\r
-       dx = (idestx<<PRECISION) - x;\r
-       dy = (idesty<<PRECISION) - y;\r
-       long recip = (1 << PRECISION) / 1;//sqrt(dx*dx + dy*dy);\r
-\r
-       dx *= recip * 16;//CARDZOOMSPEED; \r
-       dy *= recip * 16;//CARDZOOMSPEED;\r
-\r
-       //if(dx < 0) dxinc = 1.001; else\r
-\r
-       for(;;)\r
-       {\r
-               int ix, iy;\r
-               x += dx;\r
-               y += dy;\r
-\r
-               ix = (int)x>>PRECISION;\r
-               iy = (int)y>>PRECISION;\r
-               if(dx < 0 && ix < idestx) ix = idestx;\r
-               else if(dx > 0 && ix > idestx) ix = idestx;\r
-\r
-               if(dy < 0 && iy < idesty) iy = idesty;\r
-               else if(dy > 0 && iy > idesty) iy = idesty;\r
-\r
-               MoveDragCardTo(hdc, ix, iy);\r
-\r
-               if(ix == idestx && iy == idesty)\r
-                       break;\r
-\r
-               oldx = (int)x >> PRECISION;\r
-               oldy = (int)y >> PRECISION;\r
-\r
-               //dx *= 1.2;\r
-               //dy *= 1.2;\r
-\r
-               Sleep(10);\r
-       }\r
-}\r
-#else\r
-void CardRegion::ZoomCard(HDC hdc, int xpos, int ypos, CardRegion *pDestStack)\r
-{\r
-       double dx, dy, x ,y;\r
-       int apparentcards;\r
-       x = (double)xpos; y = (double)ypos;\r
-\r
-       oldx = (int)x;\r
-       oldy = (int)y;\r
-\r
-       apparentcards = pDestStack->cardstack.NumCards() / pDestStack->nThreedCount;\r
-\r
-       int idestx = pDestStack->xpos + pDestStack->xoffset * (apparentcards);\r
-       int idesty = pDestStack->ypos + pDestStack->yoffset * (apparentcards);\r
-\r
-       if(pDestStack->yoffset < 0)\r
-               idesty += pDestStack->yoffset * (iNumDragCards-1);\r
-\r
-       if(pDestStack->xoffset < 0)\r
-               idestx += pDestStack->xoffset * (iNumDragCards-1);\r
-\r
-       //normalise the motion vector\r
-       dx = idestx - x;\r
-       dy = idesty - y;\r
-       double recip = 1.0 / sqrt(dx*dx + dy*dy);\r
-       dx *= recip * __CARDZOOMSPEED; dy *= recip * __CARDZOOMSPEED;\r
-\r
-       //if(dx < 0) dxinc = 1.001; else\r
-\r
-       for(;;)\r
-       {\r
-               bool attarget = true;\r
-               int ix, iy;\r
-               x += dx;\r
-               y += dy;\r
-\r
-               ix = (int)x;\r
-               iy = (int)y;\r
-               if(dx < 0.0 && ix < idestx) ix = idestx; \r
-               else if(dx > 0.0 && ix > idestx) ix = idestx;\r
-               else attarget = false;\r
-\r
-               if(dy < 0.0 && iy < idesty) iy = idesty;\r
-               else if(dy > 0.0 && iy > idesty) iy = idesty;\r
-               else attarget = false;\r
-\r
-               //if the target stack wants the drag cards drawn differently\r
-               //to how they are, then redraw the drag card image just before\r
-               //the cards land\r
-               /*if(attarget == true)\r
-               {\r
-                       for(int i = 0; i < iNumDragCards; i++)\r
-                       {\r
-                               int xdraw = pDestStack->xoffset*i;\r
-                               int ydraw = pDestStack->yoffset*i;\r
-\r
-                               if(pDestStack->yoffset < 0)\r
-                                       ydraw = -pDestStack->yoffset * (iNumDragCards-i-1);\r
-                               if(pDestStack->xoffset < 0)\r
-                                       xdraw = -pDestStack->xoffset * (iNumDragCards-i-1);\r
-\r
-                               if(pDestStack->facedirection == CS_FACEUP && \r
-                                       pDestStack->numcards+i >= dest->numfacedown)\r
-                               {\r
-                                       //cdtDraw(hdcDragCard, xdraw, ydraw, iDragCards[i], ectFACES, 0);\r
-                               }\r
-                               else\r
-                               {\r
-                                       //cdtDraw(hdcDragCard, xdraw, ydraw, CARDSTACK::backcard, ectBACKS, 0);\r
-                               }\r
-                       }\r
-               }*/\r
-\r
-               MoveDragCardTo(hdc, ix, iy);\r
-\r
-               if(attarget || ix == idestx && iy == idesty)\r
-                       break;\r
-\r
-               oldx = (int)x;\r
-               oldy = (int)y;\r
-\r
-               //dx *= 1.2;\r
-               //dy *= 1.2;\r
-\r
-               Sleep(10);\r
-       }\r
-}\r
-#endif
\ No newline at end of file