source: trunk/src/pe2lx/cursorgrp.cpp@ 46

Last change on this file since 46 was 46, checked in by sandervl, 26 years ago

* empty log message *

File size: 3.4 KB
Line 
1/*
2 * PE2LX cursor group code
3 *
4 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
5 *
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10#define INCL_GPIBITMAPS
11#define INCL_BITMAPFILEFORMAT
12#define INCL_DOSFILEMGR /* File Manager values */
13#define INCL_DOSERRORS /* DOS Error values */
14#define INCL_DOSPROCESS /* DOS Process values */
15#define INCL_DOSMISC /* DOS Miscellanous values */
16#define INCL_WIN
17#include <os2.h>
18#include <stdio.h>
19#include <string.h>
20#include <stdlib.h>
21#include <iostream.h>
22#include <string.h>
23#include "pefile.h"
24#include "lx.h"
25#include "cursor.h"
26#include "cursorgrp.h"
27#include "misc.h"
28
29//******************************************************************************
30//******************************************************************************
31#ifdef __WATCOMC__
32#pragma off (unreferenced)
33#endif
34void ShowGroupCursor(int id, CursorHeader *chdr, int size)
35#ifdef __WATCOMC__
36#pragma on (unreferenced)
37#endif
38{
39 CursorResDir *rdir = (CursorResDir *)(chdr + 1);
40 int i, groupsize = 0;
41 BITMAPARRAYFILEHEADER *bafh, *orgbafh;
42 OS2Cursor *Cursor;
43
44 cout << "Cursor Group type :" << chdr->wType << endl;
45 cout << "Cursor Group count:" << chdr->cwCount << endl;
46 for(i=0;i<chdr->cwCount;i++) {
47 cout << "Cursor :" << rdir->wNameOrdinal << endl;
48 cout << "Width :" << (int)rdir->wWidth << endl;
49 cout << "Height :" << (int)rdir->wHeight << endl;
50 cout << "Bits :" << rdir->wBitCount << endl;
51 cout << "ResBytes:" << rdir->lBytesInRes << endl;
52 Cursor = OS2Cursor::GetCursor(rdir->wNameOrdinal);
53 groupsize += Cursor->QueryCursorSize();
54 rdir++;
55 }
56 bafh = (BITMAPARRAYFILEHEADER *)malloc(groupsize+chdr->cwCount*sizeof(BITMAPARRAYFILEHEADER));
57 orgbafh = bafh;
58#if 1
59 rdir = (CursorResDir *)(chdr + 1);
60 for(i=0;i<chdr->cwCount;i++) {
61 bafh->usType = BFT_BITMAPARRAY;
62 bafh->cbSize = sizeof(BITMAPARRAYFILEHEADER);
63 bafh->cxDisplay = 0;
64 bafh->cyDisplay = 0;
65 Cursor = OS2Cursor::GetCursor(rdir->wNameOrdinal);
66 if(Cursor == NULL) {
67 cout << "Can't find Cursor!" << endl;
68 rdir++;
69 continue;
70 }
71 if(i != chdr->cwCount -1) {
72 bafh->offNext = (int)&bafh->bfh - (int)orgbafh + Cursor->QueryCursorSize();
73 }
74 else bafh->offNext = 0;
75
76 Cursor->SetCursorHdrOffset((int)bafh - (int)orgbafh + sizeof(BITMAPARRAYFILEHEADER)-sizeof(BITMAPFILEHEADER));
77
78 memcpy((char *)&bafh->bfh, (char *)Cursor->GetCursorHeader(rdir->wWidth, rdir->wHeight, rdir->wPlanes, rdir->wBitCount),
79 Cursor->QueryCursorSize());
80 bafh = (BITMAPARRAYFILEHEADER *)((int)&bafh->bfh + Cursor->QueryCursorSize());
81 rdir++;
82 }
83 OS2Exe.StoreResource(id, RT_POINTER, groupsize+chdr->cwCount*sizeof(BITMAPARRAYFILEHEADER), (char *)orgbafh);
84#else
85 rdir = (CursorResDir *)(chdr + 1);
86 Cursor = OS2Cursor::GetCursor(rdir->wNameOrdinal);
87 OS2Exe.StoreResource(id, RT_POINTER, Cursor->QueryCursorSize(),
88 (char *)Cursor->GetCursorHeader(rdir->wWidth,
89 rdir->wHeight, rdir->wPlanes, rdir->wBitCount));
90#endif
91 free((char *)orgbafh);
92}
93//******************************************************************************
94//******************************************************************************
Note: See TracBrowser for help on using the repository browser.