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