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

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

* empty log message *

File size: 2.0 KB
Line 
1/*
2 * PE2LX accelerator resource support code
3 *
4 * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
5 *
6 * Project Odin Software License can be found in LICENSE.TXT
7 *
8 */
9#define INCL_GPIBITMAPS
10#define INCL_BITMAPFILEFORMAT
11#define INCL_DOSFILEMGR /* File Manager values */
12#define INCL_DOSERRORS /* DOS Error values */
13#define INCL_DOSPROCESS /* DOS Process values */
14#define INCL_DOSMISC /* DOS Miscellanous values */
15#define INCL_WIN
16#include <os2.h>
17#include <stdio.h>
18#include <string.h>
19#include <stdlib.h>
20#include <iostream.h>
21#include <string.h>
22#include "pefile.h"
23#include "lx.h"
24#include "icon.h"
25#include "accelerator.h"
26#include "misc.h"
27
28//******************************************************************************
29//******************************************************************************
30void ShowAccelerator(int id, WINACCEL *accdata, int size)
31{
32 ACCELTABLE *OS2Acc;
33 int os2size,i;
34
35 //First save original win32 resource
36 OS2Exe.StoreWin32Resource(id, RT_ACCELTABLE, size, (char *)accdata);
37
38 os2size = sizeof(ACCELTABLE) + ((size/8)-1)*sizeof(ACCEL);
39 OS2Acc = (ACCELTABLE *)malloc(os2size);
40 memset(OS2Acc, 0, os2size);
41 OS2Acc->cAccel = size/8;
42 OS2Acc->codepage = 437;
43
44 for(i=0;i<OS2Acc->cAccel;i++) {
45 OS2Acc->aaccel[i].key = accdata->key;
46 OS2Acc->aaccel[i].cmd = accdata->cmd;
47 if(accdata[i].fVirt & FVIRTKEY)
48 OS2Acc->aaccel[i].fs |= AF_VIRTUALKEY;
49 if(accdata[i].fVirt & FNOINVERT)
50 OS2Acc->aaccel[i].fs |= AF_CHAR;
51 if(accdata[i].fVirt & FSHIFT)
52 OS2Acc->aaccel[i].fs |= AF_SHIFT;
53 if(accdata[i].fVirt & FCONTROL)
54 OS2Acc->aaccel[i].fs |= AF_CONTROL;
55 if(accdata[i].fVirt & FALT)
56 OS2Acc->aaccel[i].fs |= AF_ALT;
57 }
58 OS2Exe.StoreResource(id, RT_ACCELTABLE, os2size, (char *)OS2Acc);
59 free(OS2Acc);
60}
61//******************************************************************************
62//******************************************************************************
Note: See TracBrowser for help on using the repository browser.