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

Last change on this file since 4 was 4, checked in by ktk, 26 years ago

Import

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