update SVN properties Modified: trunk/rosapps/games/solitaire/cardlib/card.h Modified: trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardbutton.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardbutton.h Modified: trunk/rosapps/games/solitaire/cardlib/cardcolor.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardcolor.h Modified: trunk/rosapps/games/solitaire/cardlib/cardcount.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardcount.h Modified: trunk/rosapps/games/solitaire/cardlib/cardlib.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardlib.h Modified: trunk/rosapps/games/solitaire/cardlib/cardregion.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardregion.h Modified: trunk/rosapps/games/solitaire/cardlib/cardrgndraw.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardrgnmouse.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardstack.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardstack.h Modified: trunk/rosapps/games/solitaire/cardlib/cardwindow.cpp Modified: trunk/rosapps/games/solitaire/cardlib/cardwindow.h Modified: trunk/rosapps/games/solitaire/cardlib/dropzone.cpp Modified: trunk/rosapps/games/solitaire/cardlib/dropzone.h Modified: trunk/rosapps/games/solitaire/cardlib/globals.h Modified: trunk/rosapps/games/solitaire/solcreate.cpp Modified: trunk/rosapps/games/solitaire/solgame.cpp Modified: trunk/rosapps/games/solitaire/solitaire.cpp Modified: trunk/rosapps/packmgr/cmd-line/main.c Modified: trunk/rosapps/packmgr/cmd-line/main.h Modified: trunk/rosapps/packmgr/gui/main.c Modified: trunk/rosapps/packmgr/gui/main.h Modified: trunk/rosapps/packmgr/gui/resource.h Modified: trunk/rosapps/packmgr/lib/download.cpp Modified: trunk/rosapps/packmgr/lib/error.h Modified: trunk/rosapps/packmgr/lib/expat.h Modified: trunk/rosapps/packmgr/lib/functions.cpp Modified: trunk/rosapps/packmgr/lib/log.cpp Modified: trunk/rosapps/packmgr/lib/log.h Modified: trunk/rosapps/packmgr/lib/main.cpp Modified: trunk/rosapps/packmgr/lib/options.cpp Modified: trunk/rosapps/packmgr/lib/package.cpp Modified: trunk/rosapps/packmgr/lib/package.h Modified: trunk/rosapps/packmgr/lib/package.hpp Modified: trunk/rosapps/packmgr/lib/script.cpp Modified: trunk/rosapps/packmgr/lib/script.h Modified: trunk/rosapps/packmgr/lib/tree.cpp Modified: trunk/rosapps/sysutils/ctm/resource.h Modified: trunk/rosapps/sysutils/dosfsck/boot.c Modified: trunk/rosapps/sysutils/dosfsck/boot.h Modified: trunk/rosapps/sysutils/dosfsck/byteorder.h Modified: trunk/rosapps/sysutils/dosfsck/byteswap.h Modified: trunk/rosapps/sysutils/dosfsck/byteswap1.h Modified: trunk/rosapps/sysutils/dosfsck/check.c Modified: trunk/rosapps/sysutils/dosfsck/check.h Modified: trunk/rosapps/sysutils/dosfsck/common.c Modified: trunk/rosapps/sysutils/dosfsck/common.h Modified: trunk/rosapps/sysutils/dosfsck/compiler.h Modified: trunk/rosapps/sysutils/dosfsck/dosfsck.c Modified: trunk/rosapps/sysutils/dosfsck/dosfsck.h Modified: trunk/rosapps/sysutils/dosfsck/fat.c Modified: trunk/rosapps/sysutils/dosfsck/fat.h Modified: trunk/rosapps/sysutils/dosfsck/file.c Modified: trunk/rosapps/sysutils/dosfsck/file.h Modified: trunk/rosapps/sysutils/dosfsck/io.c Modified: trunk/rosapps/sysutils/dosfsck/io.h Modified: trunk/rosapps/sysutils/dosfsck/lfn.c Modified: trunk/rosapps/sysutils/dosfsck/lfn.h Modified: trunk/rosapps/sysutils/dosfsck/msdos_fs.h Modified: trunk/rosapps/sysutils/dosfsck/swab.h Modified: trunk/rosapps/sysutils/dosfsck/version.h Modified: trunk/rosapps/sysutils/dosfsck/vfat.h Modified: trunk/rosapps/sysutils/mkdosfs/mkdosfs.c _____
Modified: trunk/rosapps/games/solitaire/cardlib/card.h --- trunk/rosapps/games/solitaire/cardlib/card.h 2005-08-07 07:32:36 UTC (rev 17142) +++ trunk/rosapps/games/solitaire/cardlib/card.h 2005-08-07 07:33:14 UTC (rev 17143) @@ -1,105 +1,105 @@
-// -// CardLib - Card class -// -// Freeware -// Copyright J Brown 2001 -// - -#ifndef _CARD_INCLUDED -#define _CARD_INCLUDED - -enum eSuit { Clubs = 0, Diamonds = 1, Hearts = 2, Spades = 3 }; -enum eValue { Ace = 1, Two = 2, Three = 3, Four = 4, Five = 5, Six = 6, Seven = 7, - Eight = 8, Nine = 9, Ten = 10, Jack = 11, Queen = 12, King = 13 }; - -inline int MAKE_CARD(int Value, int Suit) -{ - if(Value < 1) Value = 1; - if(Value == 14) Value = 1; - if(Value > 13) Value = 13; - - if(Suit < 0) Suit = 0; - if(Suit > 3) Suit = 3; - - return ((Value - 1) * 4 + Suit); -} - -class Card -{ - friend class CardStack; - -public: - - Card() - { - nValue = 0; //ace of spades by default - fFaceUp = true; - } - - Card(int value, int suit) //specify a face value [1-13] and suit [0-3] - { - nValue = MAKE_CARD(value, suit); - fFaceUp = true; - } - - Card(int index) //specify a 0-51 index - { - if(index < 0) index = 0; - if(index > 51) index = 51; - - nValue = index; - fFaceUp = true; - } - - int Suit() const - { - return (nValue % 4); - } - - int LoVal() const - { - return (nValue / 4) + 1; - } - - int HiVal() const - { - return ((nValue < 4) ? 14 : (nValue / 4) + 1); - } - - int Idx() const //unique value (0-51 etc) - { - return nValue; - } - - bool FaceUp() const - { - return fFaceUp; - } - - bool FaceDown() const - { - return !fFaceUp; - } - - void SetFaceUp(bool fTrue) - { - fFaceUp = fTrue; - } - - bool IsBlack() const - { - return Suit() == 0 || Suit() == 3; - } - - bool IsRed() const - { - return !IsBlack(); - } - -private: - - int nValue; - bool fFaceUp; -}; - -#endif +// +// CardLib - Card class +// +// Freeware +// Copyright J Brown 2001 +// + +#ifndef _CARD_INCLUDED +#define _CARD_INCLUDED + +enum eSuit { Clubs = 0, Diamonds = 1, Hearts = 2, Spades = 3 }; +enum eValue { Ace = 1, Two = 2, Three = 3, Four = 4, Five = 5, Six = 6, Seven = 7, + Eight = 8, Nine = 9, Ten = 10, Jack = 11, Queen = 12, King = 13 }; + +inline int MAKE_CARD(int Value, int Suit) +{ + if(Value < 1) Value = 1; + if(Value == 14) Value = 1; + if(Value > 13) Value = 13; + + if(Suit < 0) Suit = 0; + if(Suit > 3) Suit = 3; + + return ((Value - 1) * 4 + Suit); +} + +class Card +{ + friend class CardStack; + +public: + + Card() + { + nValue = 0; //ace of spades by default + fFaceUp = true; + } + + Card(int value, int suit) //specify a face value [1-13] and suit [0-3] + { + nValue = MAKE_CARD(value, suit); + fFaceUp = true; + } + + Card(int index) //specify a 0-51 index + { + if(index < 0) index = 0; + if(index > 51) index = 51; + + nValue = index; + fFaceUp = true; + } + + int Suit() const + { + return (nValue % 4); + } + + int LoVal() const + { + return (nValue / 4) + 1; + } + + int HiVal() const + { + return ((nValue < 4) ? 14 : (nValue / 4) + 1); + } + + int Idx() const //unique value (0-51 etc) + { + return nValue; + } + + bool FaceUp() const + { + return fFaceUp; + } + + bool FaceDown() const + { + return !fFaceUp; + } + + void SetFaceUp(bool fTrue) + { + fFaceUp = fTrue; + } + + bool IsBlack() const + { + return Suit() == 0 || Suit() == 3; + } + + bool IsRed() const + { + return !IsBlack(); + } + +private: + + int nValue; + bool fFaceUp; +}; + +#endif Property changes on: trunk/rosapps/games/solitaire/cardlib/card.h ___________________________________________________________________ Name: svn:eol-style + native _____
Modified: trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp --- trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp 2005-08-07 07:32:36 UTC (rev 17142) +++ trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp 2005-08-07 07:33:14 UTC (rev 17143) @@ -1,281 +1,281 @@
-// -// CardLib - Card bitmap support -// -// Freeware -// Copyright J Brown 2001 -// -#include <windows.h> -#include "globals.h" -#include "cardcolor.h" - -#ifndef __REACTOS__ -#pragma comment( lib, "..\CardLib\cards16.lib" ) - -extern "C" HINSTANCE WINAPI LoadLibrary16( PSTR ); -extern "C" void WINAPI FreeLibrary16( HINSTANCE ); -#endif - -#define NUMCARDBITMAPS (52+16) - -void PaintRect(HDC hdc, RECT *rect, COLORREF col); - -void LoadCardBitmapsFromLibrary(HINSTANCE hCardDll, int *pwidth, int *pheight) -{ - HBITMAP hBitmap; - HDC hdcCard = NULL; - HANDLE hOld; - int i, xpos; - int width, height; - BITMAP bmp; - - for(i = 0; i < NUMCARDBITMAPS; i++) - { - //convert into the range used by the cdt_xxx functions - int val; - - if(i < 52) val = (i % 4) * 13 + (i/4); - else val = i; - - hBitmap = LoadBitmap(hCardDll, MAKEINTRESOURCE(val + 1)); - GetObject(hBitmap, sizeof(bmp), &bmp); - - width = bmp.bmWidth; - height = bmp.bmHeight; - - if(i == 0) //if first time through, create BIG bitmap.. - { - HDC hdc = GetDC(0); - __hdcCardBitmaps = CreateCompatibleDC(hdc); - __hbmCardBitmaps = CreateCompatibleBitmap(hdc, width * NUMCARDBITMAPS, height); - SelectObject(__hdcCardBitmaps, __hbmCardBitmaps); - - hdcCard = CreateCompatibleDC(0); - - ReleaseDC(0, hdc); - } - - hOld = SelectObject(hdcCard, hBitmap); - BitBlt(__hdcCardBitmaps, i*width, 0, width, height, hdcCard, 0, 0, SRCCOPY); - SelectObject(hdcCard, hOld); - - //Now draw a black border around each card... - xpos = i*width; - MoveToEx(__hdcCardBitmaps, xpos+2, 0, 0); - LineTo(__hdcCardBitmaps, xpos+width - 3, 0); - LineTo(__hdcCardBitmaps, xpos+width - 1, 2); - LineTo(__hdcCardBitmaps, xpos+width - 1, height - 3); //vertical - LineTo(__hdcCardBitmaps, xpos+width - 3, height - 1); - LineTo(__hdcCardBitmaps, xpos+2, height - 1); - LineTo(__hdcCardBitmaps, xpos+0, height - 3); - LineTo(__hdcCardBitmaps, xpos+0, 2); - LineTo(__hdcCardBitmaps, xpos+2, 0); - - DeleteObject(hBitmap); - } - - DeleteDC(hdcCard); - - *pwidth = width; - *pheight = height; - -} - -void LoadCardBitmaps(void) -{ - HINSTANCE hCardDll; - - - //If Windows NT/2000/XP - if(GetVersion() < 0x80000000) - { - hCardDll = LoadLibrary("cards.dll"); - - if(hCardDll == 0) - { - MessageBox(0, "Error loading cards.dll (32bit)", "Shed", MB_OK | MB_ICONEXCLAMATION); - PostQuitMessage(0); - return; - } - - LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight); - - FreeLibrary(hCardDll); - } -#ifndef __REACTOS__ - //Else, Win9X - else - { - hCardDll = LoadLibrary16("cards.dll"); - - if(hCardDll == 0) - { - MessageBox(0, "Error loading cards.dll (16bit)", "Shed", MB_OK | MB_ICONEXCLAMATION); - PostQuitMessage(0); - return; - } - - LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight); - - FreeLibrary16(hCardDll); - } -#endif -} - -void FreeCardBitmaps() -{ - DeleteObject (__hbmCardBitmaps); - DeleteDC (__hdcCardBitmaps); -} -// -// Paint a checkered rectangle, with each alternate -// pixel being assigned a different colour -// -static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) -{ - static WORD wCheckPat[8] = - { - 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555 - }; - - HBITMAP hbmp; - HBRUSH hbr, hbrold; - COLORREF fgold, bgold; - - hbmp = CreateBitmap(8, 8, 1, 1, wCheckPat); - hbr = CreatePatternBrush(hbmp); - - //UnrealizeObject(hbr); - - SetBrushOrgEx(hdc, rect->left, rect->top, 0); - - hbrold = (HBRUSH)SelectObject(hdc, hbr); - - fgold = SetTextColor(hdc, fg); - bgold = SetBkColor(hdc, bg); - - PatBlt(hdc, rect->left, rect->top, - rect->right - rect->left, - rect->bottom - rect->top, - PATCOPY); - - SetBkColor(hdc, bgold); - SetTextColor(hdc, fgold); - - SelectObject(hdc, hbrold); - DeleteObject(hbr); - DeleteObject(hbmp); -} - -void GetSinkCols(COLORREF crBase, COLORREF *fg, COLORREF *bg, COLORREF *sh1, COLORREF *sh2) -{ - if(bg) *bg = crBase; - if(fg) *fg = ColorScaleRGB(crBase, RGB(255,255,255), 0.2);//RGB(49, 99, 140); - if(sh1) *sh1 = ColorScaleRGB(crBase, RGB(0,0,0), 0.4); - if(sh2) *sh2 = ColorScaleRGB(crBase, RGB(0,0,0), 0.2); -} - -HBITMAP CreateSinkBmp(HDC hdcCompat, HDC hdc, COLORREF col, int width, int height) -{ - HANDLE hold, hpold; - HBITMAP hbm = CreateCompatibleBitmap(hdcCompat, width, height); - - HPEN hpfg, hpbg, hpsh, hpsh2; - - RECT rect; - COLORREF fg, bg, shadow, shadow2; - - GetSinkCols(col, &fg, &bg, &shadow, &shadow2); - - hold = SelectObject(hdc, hbm); - - //fill with a solid base colour - SetRect(&rect, 0,0,width,height); - PaintRect(hdc, &rect, MAKE_PALETTERGB(bg)); - - //draw the outline - hpfg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(fg)); - hpbg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(bg)); - hpsh = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow)); - hpsh2= CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow2)); - - hpold = SelectObject(hdc, hpsh); - MoveToEx(hdc, 2, 0, NULL); - LineTo (hdc, width-3,0); - LineTo (hdc, width-1, 2); - - SelectObject(hdc, hpold); - hpold = SelectObject(hdc, hpsh2); - LineTo (hdc, width-1, height-3); //vertical - LineTo (hdc, width-3, height-1); - LineTo (hdc, 2, height-1); - LineTo (hdc, 0, height-3); - SelectObject(hdc, hpold); - hpold = SelectObject(hdc, hpsh); - - //MoveToEx( hdc, 0, height-3,0); - LineTo (hdc, 0, 2); - LineTo (hdc, 2, 0); - - SelectObject(hdc, hpold); - - //draw the highlight (vertical) - hpold = SelectObject(hdc, hpfg); - MoveToEx(hdc, width - 2, 3, NULL); - LineTo (hdc, width - 2, height - 2); - - //(horz) - MoveToEx(hdc, width - 3, height-2, NULL); - LineTo (hdc, 3, height-2); - SelectObject(hdc, hpold); - - //draw the background - InflateRect(&rect, -2, -2); - DrawCheckedRect(hdc, &rect, MAKE_PALETTERGB(bg), MAKE_PALETTERGB(fg)); - - //overwrite the top-left background pixel - SetPixel(hdc, 2, 2, MAKE_PALETTERGB(bg)); - - DeleteObject(hpsh); - DeleteObject(hpsh2); - DeleteObject(hpfg); - DeleteObject(hpbg); - - - return hbm; -} - - - -void CopyColor(PALETTEENTRY *pe, COLORREF col) -{ - pe->peBlue = GetBValue(col); - pe->peGreen = GetGValue(col); - pe->peRed = GetRValue(col); - pe->peFlags = 0; -} - -HPALETTE MakePaletteFromCols(COLORREF cols[], int nNumColours) -{ - LOGPALETTE *lp; - HPALETTE hPalette; - - // Allocate memory for the logical palette - lp = (LOGPALETTE *)HeapAlloc( - GetProcessHeap(), 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * nNumColours); - - lp->palNumEntries = nNumColours; - lp->palVersion = 0x300; - - //copy the colours into the logical palette format - for(int i = 0; i < nNumColours; i++) - { - CopyColor(&lp->palPalEntry[i], cols[i]); - } - - // create palette! - hPalette = CreatePalette(lp); - - HeapFree(GetProcessHeap(), 0, lp); - - return hPalette; -} +// +// CardLib - Card bitmap support +// +// Freeware +// Copyright J Brown 2001 +// +#include <windows.h> +#include "globals.h" +#include "cardcolor.h" + +#ifndef __REACTOS__ +#pragma comment( lib, "..\CardLib\cards16.lib" ) + +extern "C" HINSTANCE WINAPI LoadLibrary16( PSTR ); +extern "C" void WINAPI FreeLibrary16( HINSTANCE ); +#endif + +#define NUMCARDBITMAPS (52+16) + +void PaintRect(HDC hdc, RECT *rect, COLORREF col); + +void LoadCardBitmapsFromLibrary(HINSTANCE hCardDll, int *pwidth, int *pheight) +{ + HBITMAP hBitmap; + HDC hdcCard = NULL; + HANDLE hOld; + int i, xpos; + int width, height; + BITMAP bmp; + + for(i = 0; i < NUMCARDBITMAPS; i++) + { + //convert into the range used by the cdt_xxx functions + int val; + + if(i < 52) val = (i % 4) * 13 + (i/4); + else val = i; + + hBitmap = LoadBitmap(hCardDll, MAKEINTRESOURCE(val + 1)); + GetObject(hBitmap, sizeof(bmp), &bmp); + + width = bmp.bmWidth; + height = bmp.bmHeight; + + if(i == 0) //if first time through, create BIG bitmap.. + { + HDC hdc = GetDC(0); + __hdcCardBitmaps = CreateCompatibleDC(hdc); + __hbmCardBitmaps = CreateCompatibleBitmap(hdc, width * NUMCARDBITMAPS, height); + SelectObject(__hdcCardBitmaps, __hbmCardBitmaps); + + hdcCard = CreateCompatibleDC(0); + + ReleaseDC(0, hdc); + } + + hOld = SelectObject(hdcCard, hBitmap); + BitBlt(__hdcCardBitmaps, i*width, 0, width, height, hdcCard, 0, 0, SRCCOPY); + SelectObject(hdcCard, hOld); + + //Now draw a black border around each card... + xpos = i*width; + MoveToEx(__hdcCardBitmaps, xpos+2, 0, 0); + LineTo(__hdcCardBitmaps, xpos+width - 3, 0); + LineTo(__hdcCardBitmaps, xpos+width - 1, 2); + LineTo(__hdcCardBitmaps, xpos+width - 1, height - 3); //vertical + LineTo(__hdcCardBitmaps, xpos+width - 3, height - 1); + LineTo(__hdcCardBitmaps, xpos+2, height - 1); + LineTo(__hdcCardBitmaps, xpos+0, height - 3); + LineTo(__hdcCardBitmaps, xpos+0, 2); + LineTo(__hdcCardBitmaps, xpos+2, 0); + + DeleteObject(hBitmap); + } + + DeleteDC(hdcCard); + + *pwidth = width; + *pheight = height; + +} + +void LoadCardBitmaps(void) +{ + HINSTANCE hCardDll; + + + //If Windows NT/2000/XP + if(GetVersion() < 0x80000000) + { + hCardDll = LoadLibrary("cards.dll"); + + if(hCardDll == 0) + { + MessageBox(0, "Error loading cards.dll (32bit)", "Shed", MB_OK | MB_ICONEXCLAMATION); + PostQuitMessage(0); + return; + } + + LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight); + + FreeLibrary(hCardDll); + } +#ifndef __REACTOS__ + //Else, Win9X + else + { + hCardDll = LoadLibrary16("cards.dll"); + + if(hCardDll == 0) + { + MessageBox(0, "Error loading cards.dll (16bit)", "Shed", MB_OK | MB_ICONEXCLAMATION); + PostQuitMessage(0); + return; + } + + LoadCardBitmapsFromLibrary(hCardDll, &__cardwidth, &__cardheight); + + FreeLibrary16(hCardDll); + } +#endif +} + +void FreeCardBitmaps() +{ + DeleteObject (__hbmCardBitmaps); + DeleteDC (__hdcCardBitmaps); +} +// +// Paint a checkered rectangle, with each alternate +// pixel being assigned a different colour +// +static void DrawCheckedRect(HDC hdc, RECT *rect, COLORREF fg, COLORREF bg) +{ + static WORD wCheckPat[8] = + { + 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555 + }; + + HBITMAP hbmp; + HBRUSH hbr, hbrold; + COLORREF fgold, bgold; + + hbmp = CreateBitmap(8, 8, 1, 1, wCheckPat); + hbr = CreatePatternBrush(hbmp); + + //UnrealizeObject(hbr); + + SetBrushOrgEx(hdc, rect->left, rect->top, 0); + + hbrold = (HBRUSH)SelectObject(hdc, hbr); + + fgold = SetTextColor(hdc, fg); + bgold = SetBkColor(hdc, bg); + + PatBlt(hdc, rect->left, rect->top, + rect->right - rect->left, + rect->bottom - rect->top, + PATCOPY); + + SetBkColor(hdc, bgold); + SetTextColor(hdc, fgold); + + SelectObject(hdc, hbrold); + DeleteObject(hbr); + DeleteObject(hbmp); +} + +void GetSinkCols(COLORREF crBase, COLORREF *fg, COLORREF *bg, COLORREF *sh1, COLORREF *sh2) +{ + if(bg) *bg = crBase; + if(fg) *fg = ColorScaleRGB(crBase, RGB(255,255,255), 0.2);//RGB(49, 99, 140); + if(sh1) *sh1 = ColorScaleRGB(crBase, RGB(0,0,0), 0.4); + if(sh2) *sh2 = ColorScaleRGB(crBase, RGB(0,0,0), 0.2); +} + +HBITMAP CreateSinkBmp(HDC hdcCompat, HDC hdc, COLORREF col, int width, int height) +{ + HANDLE hold, hpold; + HBITMAP hbm = CreateCompatibleBitmap(hdcCompat, width, height); + + HPEN hpfg, hpbg, hpsh, hpsh2; + + RECT rect; + COLORREF fg, bg, shadow, shadow2; + + GetSinkCols(col, &fg, &bg, &shadow, &shadow2); + + hold = SelectObject(hdc, hbm); + + //fill with a solid base colour + SetRect(&rect, 0,0,width,height); + PaintRect(hdc, &rect, MAKE_PALETTERGB(bg)); + + //draw the outline + hpfg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(fg)); + hpbg = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(bg)); + hpsh = CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow)); + hpsh2= CreatePen(PS_SOLID, 0, MAKE_PALETTERGB(shadow2)); + + hpold = SelectObject(hdc, hpsh); + MoveToEx(hdc, 2, 0, NULL); + LineTo (hdc, width-3,0); + LineTo (hdc, width-1, 2); + + SelectObject(hdc, hpold); + hpold = SelectObject(hdc, hpsh2); + LineTo (hdc, width-1, height-3); //vertical + LineTo (hdc, width-3, height-1); + LineTo (hdc, 2, height-1); + LineTo (hdc, 0, height-3); + SelectObject(hdc, hpold); + hpold = SelectObject(hdc, hpsh); + + //MoveToEx( hdc, 0, height-3,0); + LineTo (hdc, 0, 2); + LineTo (hdc, 2, 0); + + SelectObject(hdc, hpold); + + //draw the highlight (vertical) + hpold = SelectObject(hdc, hpfg); + MoveToEx(hdc, width - 2, 3, NULL); + LineTo (hdc, width - 2, height - 2); + + //(horz) + MoveToEx(hdc, width - 3, height-2, NULL); + LineTo (hdc, 3, height-2); + SelectObject(hdc, hpold); + + //draw the background + InflateRect(&rect, -2, -2); + DrawCheckedRect(hdc, &rect, MAKE_PALETTERGB(bg), MAKE_PALETTERGB(fg)); + + //overwrite the top-left background pixel + SetPixel(hdc, 2, 2, MAKE_PALETTERGB(bg)); + + DeleteObject(hpsh); + DeleteObject(hpsh2); + DeleteObject(hpfg); + DeleteObject(hpbg); + + + return hbm; +} + + + +void CopyColor(PALETTEENTRY *pe, COLORREF col) +{ + pe->peBlue = GetBValue(col); + pe->peGreen = GetGValue(col); + pe->peRed = GetRValue(col); + pe->peFlags = 0; +} + +HPALETTE MakePaletteFromCols(COLORREF cols[], int nNumColours) +{ + LOGPALETTE *lp; + HPALETTE hPalette; + + // Allocate memory for the logical palette + lp = (LOGPALETTE *)HeapAlloc( + GetProcessHeap(), 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * nNumColours); + + lp->palNumEntries = nNumColours; + lp->palVersion = 0x300; + + //copy the colours into the logical palette format + for(int i = 0; i < nNumColours; i++) + { + CopyColor(&lp->palPalEntry[i], cols[i]); + } + + // create palette! + hPalette = CreatePalette(lp); + + HeapFree(GetProcessHeap(), 0, lp); + + return hPalette; +} Property changes on: trunk/rosapps/games/solitaire/cardlib/cardbitmaps.cpp ___________________________________________________________________ Name: svn:eol-style + native _____
Modified: trunk/rosapps/games/solitaire/cardlib/cardbutton.cpp --- trunk/rosapps/games/solitaire/cardlib/cardbutton.cpp 2005-08-07 07:32:36 UTC (rev 17142) +++ trunk/rosapps/games/solitaire/cardlib/cardbutton.cpp 2005-08-07 07:33:14 UTC (rev 17143) @@ -1,489 +1,489 @@
-// -// CardLib - CardButton class -// -// Freeware -// Copyright J Brown 2001 -// -#include <windows.h> -#include <tchar.h> - -#include "cardlib.h" -#include "cardwindow.h" -#include "cardbutton.h" -#include "cardcolor.h" - -HPALETTE UseNicePalette(HDC, HPALETTE); -void RestorePalette(HDC, HPALETTE); - -void PaintRect(HDC hdc, RECT *rect, COLORREF colour); - -CardButton::CardButton(CardWindow &parent, int Id, TCHAR *szText, UINT Style, bool visible, - int x, int y, int width, int height) - - : parentWnd(parent), id(Id), uStyle(Style), fVisible(visible), ButtonCallback(0) -{ - crText = RGB(255,255,255); - crBack = RGB(0, 128, 0); - - xadjust = 0; - yadjust = 0; - xjustify = 0; - yjustify = 0; - - fMouseDown = false; - fButtonDown = false; - - hIcon = 0; - - SetText(szText); - Move(x, y, width, height); - - mxlock = CreateMutex(0, FALSE, 0); - - hFont = 0; -} - -CardButton::~CardButton() -{ - CloseHandle(mxlock); -} - -void CardButton::DrawRect(HDC hdc, RECT *rect, bool fNormal) -{ - RECT fill; - - HANDLE hOld; - - HPEN hhi = CreatePen(0, 0, MAKE_PALETTERGB(crHighlight)); - HPEN hsh = CreatePen(0, 0, MAKE_PALETTERGB(crShadow)); - HPEN hbl = (HPEN)GetStockObject(BLACK_PEN); - - int x = rect->left; - int y = rect->top; - int width = rect->right-rect->left - 1; - int height = rect->bottom-rect->top - 1; - - SetRect(&fill, x+1, y+1, x+width-1, y+height-1); - - int one = 1; - - if(!fNormal) - { - x += width; - y += height; - width = -width; - height = -height; - one = -1; - OffsetRect(&fill, 1, 1); - } - - if(fNormal) - hOld = SelectObject(hdc, hhi); - else - hOld = SelectObject(hdc, hhi); - - MoveToEx(hdc, x, y+height, 0); - LineTo(hdc, x, y); - LineTo(hdc, x+width, y); - SelectObject(hdc, hOld); - - hOld = SelectObject(hdc, hbl); - LineTo(hdc, x+width, y+height); - LineTo(hdc, x-one, y+height); - SelectObject(hdc, hOld); - - hOld = SelectObject(hdc, hsh); - MoveToEx(hdc, x+one, y+height-one, 0); - LineTo(hdc, x+width-one, y+height-one); - LineTo(hdc, x+width-one, y); - SelectObject(hdc, hOld); - - PaintRect(hdc, &fill, MAKE_PALETTERGB(crBack)); - - DeleteObject(hhi); - DeleteObject(hsh); -} - -void CardButton::Clip(HDC hdc) -{ - if(fVisible == false) return; - - ExcludeClipRect(hdc, rect.left, rect.top, rect.right, rect.bottom); -} - -void CardButton::Draw(HDC hdc, bool fNormal) -{ - SIZE textsize; - int x, y; //text x, y - int ix, iy; //icon x, y - int iconwidth = 0; - - RECT cliprect; - - if(fVisible == 0) return; - - if(hFont == 0) - SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); - else - SelectObject(hdc, hFont); - - GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textsize); - - if(hIcon) - { - x = rect.left + 32 + 8; - } - else - { - if(uStyle & CB_ALIGN_LEFT) - { - x = rect.left + iconwidth; - } - else if(uStyle & CB_ALIGN_RIGHT) - { - x = rect.left + (rect.right-rect.left-iconwidth-textsize.cx); - } - else //centered - { - x = rect.right - rect.left - iconwidth; - x = (x - textsize.cx) / 2; - x += rect.left + iconwidth; - } - } - - y = rect.bottom - rect.top; - y = (y - textsize.cy) / 2; - y += rect.top; - - //calc icon position.. - ix = rect.left + 4; - iy = rect.top + (rect.bottom-rect.top-32) / 2; - - //if button is pressed, then shift text - if(fNormal == false && (uStyle & CB_PUSHBUTTON)) - { - x += 1; - y += 1; - ix += 1; - iy += 1; - } - - SetRect(&cliprect, x, y, x+textsize.cx, y+textsize.cy); - ExcludeClipRect(hdc, x, y, x+textsize.cx, y+textsize.cy); - - // - // Calc icon pos - // - - if(hIcon) - { - ExcludeClipRect(hdc, ix, iy, ix + 32, iy + 32); - } - - if(uStyle & CB_PUSHBUTTON) - { - DrawRect(hdc, &rect, fNormal); - - SetBkColor(hdc, MAKE_PALETTERGB(crBack)); - SetTextColor(hdc, crText);//MAKE_PALETTERGB(crText)); - - SelectClipRgn(hdc, 0); - - ExtTextOut(hdc, x, y, ETO_OPAQUE, &cliprect, szText, lstrlen(szText), 0); - } - else - { - SetBkColor(hdc, MAKE_PALETTERGB(crBack)); - SetTextColor(hdc, crText);//MAKE_PALETTERGB(crText)); - - SelectClipRgn(hdc, 0); - - ExtTextOut(hdc, x, y, ETO_OPAQUE, &rect, szText, lstrlen(szText), 0); - } - - if(hIcon) - { [truncated at 1000 lines; 29211 more skipped]