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

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

* empty log message *

File size: 3.1 KB
Line 
1/*
2 * PE2LX Icon 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 "icon.h"
26#include "icongrp.h"
27#include "misc.h"
28
29//******************************************************************************
30//******************************************************************************
31#ifdef __WATCOMC__
32#pragma off (unreferenced)
33#endif
34void ShowGroupIcon(int id, IconHeader *ihdr, int size)
35#ifdef __WATCOMC__
36#pragma on (unreferenced)
37#endif
38{
39 ResourceDirectory *rdir = (ResourceDirectory *)(ihdr + 1);
40 int i, groupsize = 0;
41 BITMAPARRAYFILEHEADER *bafh, *orgbafh;
42 OS2Icon *icon;
43
44 cout << "Icon Group id :" << id << endl;
45 cout << "Icon Group type :" << ihdr->wType << endl;
46 cout << "Icon Group count:" << ihdr->wCount << endl;
47 for(i=0;i<ihdr->wCount;i++) {
48 cout << "Icon :" << rdir->wNameOrdinal << endl;
49 cout << "Width :" << (int)rdir->bWidth << endl;
50 cout << "Height :" << (int)rdir->bHeight << endl;
51 cout << "Colors :" << (int)rdir->bColorCount << endl;
52 cout << "Bits :" << rdir->wBitCount << endl;
53 cout << "ResBytes:" << rdir->lBytesInRes << endl;
54 icon = OS2Icon::GetIcon(rdir->wNameOrdinal);
55 if(icon)
56 groupsize += icon->QueryIconSize();
57 rdir++;
58 }
59 bafh = (BITMAPARRAYFILEHEADER *)malloc(groupsize+ihdr->wCount*sizeof(BITMAPARRAYFILEHEADER));
60 orgbafh = bafh;
61
62 rdir = (ResourceDirectory *)(ihdr + 1);
63 for(i=0;i<ihdr->wCount;i++) {
64 bafh->usType = BFT_BITMAPARRAY;
65 bafh->cbSize = sizeof(BITMAPARRAYFILEHEADER);
66 bafh->cxDisplay = 0;
67 bafh->cyDisplay = 0;
68 icon = OS2Icon::GetIcon(rdir->wNameOrdinal);
69 if(icon == NULL) {
70 cout << "Can't find icon!" << endl;
71 rdir++;
72 continue;
73 }
74 if(i != ihdr->wCount -1) {
75 bafh->offNext = (int)&bafh->bfh - (int)orgbafh + icon->QueryIconSize();
76 }
77 else bafh->offNext = 0;
78
79 icon->SetIconHdrOffset((int)bafh - (int)orgbafh + sizeof(BITMAPARRAYFILEHEADER)-sizeof(BITMAPFILEHEADER));
80
81 memcpy((char *)&bafh->bfh, (char *)icon->GetIconHeader(), icon->QueryIconSize());
82 bafh = (BITMAPARRAYFILEHEADER *)((int)&bafh->bfh + icon->QueryIconSize());
83 rdir++;
84 }
85 OS2Exe.StoreResource(id, RT_POINTER, groupsize+ihdr->wCount*sizeof(BITMAPARRAYFILEHEADER), (char *)orgbafh);
86 free((char *)orgbafh);
87}
88//******************************************************************************
89//******************************************************************************
Note: See TracBrowser for help on using the repository browser.