refactor(windows): consolidate mc_kmxfile.h

Use legacy_kmx_memory.h instead of mc_kmxfile.h for mcompile. Removing
the unused 'hbitmap' and replacing with the binary file dword data.

Test-bot: skip
This commit is contained in:
Marc Durdin 2025-09-30 14:22:13 +02:00
parent 3be434aa65
commit 31c8f09155
4 changed files with 29 additions and 97 deletions

View file

@ -21,41 +21,37 @@ typedef struct tagKEY
typedef struct tagGROUP
{
PWSTR dpName;
LPKEY dpKeyArray; // [LPKEY] address of first item in key array
LPKEY dpKeyArray; // [LPKEY] address of first item in key array
PWSTR dpMatch;
PWSTR dpNoMatch;
DWORD cxKeyArray; // in array entries
BOOL fUsingKeys; // group(xx) [using keys] <-- specified or not
DWORD cxKeyArray; // in array entries
BOOL fUsingKeys; // group(xx) [using keys] <-- specified or not
} GROUP, * LPGROUP;
typedef struct tagKEYBOARD
{
DWORD dwIdentifier; // Keyman compiled keyboard id
DWORD dwIdentifier; // Keyman compiled keyboard id
DWORD dwFileVersion; // Version of the file - Keyman 4.0 is 0x0400
DWORD dwFileVersion; // Version of the file - Keyman 4.0 is 0x0400
DWORD dwCheckSum; // As stored in keyboard. DEPRECATED as of 16.0
DWORD xxkbdlayout; // as stored in HKEY_LOCAL_MACHINE//system//currentcontrolset//control//keyboard layouts
DWORD IsRegistered; // layout id, from same registry key
DWORD version; // keyboard version
DWORD dwCheckSum; // As stored in keyboard. DEPRECATED as of 16.0
DWORD xxkbdlayout; // as stored in HKEY_LOCAL_MACHINE//system//currentcontrolset//control//keyboard layouts
DWORD IsRegistered; // layout id, from same registry key
DWORD version; // keyboard version
DWORD cxStoreArray; // in array entries
DWORD cxGroupArray; // in array entries
DWORD cxStoreArray; // in array entries
DWORD cxGroupArray; // in array entries
LPSTORE dpStoreArray; // [LPSTORE] address of first item in store array, from start of file
LPGROUP dpGroupArray; // [LPGROUP] address of first item in group array, from start of file
LPSTORE dpStoreArray; // [LPSTORE] address of first item in store array, from start of file
LPGROUP dpGroupArray; // [LPGROUP] address of first item in group array, from start of file
DWORD StartGroup[2]; // index of starting groups [2 of them]
DWORD StartGroup[2]; // index of starting groups [2 of them]
// Ansi=0, Unicode=1
DWORD dwFlags; // Flags for the keyboard file
DWORD dwFlags; // Flags for the keyboard file
DWORD dwHotKey; // standard windows hotkey (hiword=shift/ctrl/alt stuff, loword=vkey)
DWORD dwHotKey; // standard windows hotkey (hiword=shift/ctrl/alt stuff, loword=vkey)
//PWSTR dpName; // offset of name
//PWSTR dpLanguageName; // offset of language name;
//PWSTR dpCopyright; // offset of copyright
//PWSTR dpMessage; // offset of message in Keyboard About box
HBITMAP hBitmap; // handle to the bitmap in the file;
DWORD dpBitmapOffset; // 0038 offset of the bitmaps in the file
DWORD dwBitmapSize; // 003C size in bytes of the bitmaps
} KEYBOARD, * LPKEYBOARD;

View file

@ -1,66 +0,0 @@
#include <Windows.h>
#ifndef _KMXFILE_H
#define _KMXFILE_H
typedef struct tagSTORE {
DWORD dwSystemID;
PWSTR dpName;
PWSTR dpString;
} STORE, *LPSTORE;
typedef struct tagKEY {
WCHAR Key;
DWORD Line;
DWORD ShiftFlags;
PWSTR dpOutput;
PWSTR dpContext;
} KEY, *LPKEY;
typedef struct tagGROUP {
PWSTR dpName;
LPKEY dpKeyArray; // [LPKEY] address of first item in key array
PWSTR dpMatch;
PWSTR dpNoMatch;
DWORD cxKeyArray; // in array entries
BOOL fUsingKeys; // group(xx) [using keys] <-- specified or not
} GROUP, *LPGROUP;
typedef struct tagKEYBOARD {
DWORD dwIdentifier; // Keyman compiled keyboard id
DWORD dwFileVersion; // Version of the file - Keyman 4.0 is 0x0400
DWORD dwCheckSum; // As stored in keyboard. DEPRECATED as of 16.0
DWORD xxkbdlayout; // as stored in HKEY_LOCAL_MACHINE//system//currentcontrolset//control//keyboard layouts
DWORD IsRegistered; // layout id, from same registry key
DWORD version; // keyboard version
DWORD cxStoreArray; // in array entries
DWORD cxGroupArray; // in array entries
LPSTORE dpStoreArray; // [LPSTORE] address of first item in store array, from start of file
LPGROUP dpGroupArray; // [LPGROUP] address of first item in group array, from start of file
DWORD StartGroup[2]; // index of starting groups [2 of them]
// Ansi=0, Unicode=1
DWORD dwFlags; // Flags for the keyboard file
DWORD dwHotKey; // standard windows hotkey (hiword=shift/ctrl/alt stuff, loword=vkey)
//PWSTR dpName; // offset of name
//PWSTR dpLanguageName; // offset of language name;
//PWSTR dpCopyright; // offset of copyright
//PWSTR dpMessage; // offset of message in Keyboard About box
DWORD dpBitmapOffset; // 0038 offset of the bitmaps in the file
DWORD dwBitmapSize; // 003C size in bytes of the bitmaps
//HBITMAP hBitmap; // handle to the bitmap in the file;
} KEYBOARD, *LPKEYBOARD;
BOOL LoadKeyboard(LPWSTR fileName, LPKEYBOARD *lpKeyboard);
#endif

View file

@ -1,20 +1,20 @@
/*
Name: mcompile
Copyright: Copyright (C) 2003-2017 SIL International.
Documentation:
Description:
Documentation:
Description:
Create Date: 3 Aug 2014
Modified Date: 3 Aug 2014
Authors: mcdurdin
Related Files:
Dependencies:
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
Bugs:
Todo:
Notes:
History: 03 Aug 2014 - mcdurdin - I4353 - V9.0 - mnemonic layout recompiler mixes up deadkey rules
*/
#include <vector>
@ -28,3 +28,5 @@ struct DeadkeyMapping { // I4353
};
extern std::vector<DeadkeyMapping> FDeadkeys; // I4353
BOOL LoadKeyboard(LPWSTR fileName, LPKEYBOARD *lpKeyboard);

View file

@ -8,8 +8,8 @@
#include "targetver.h"
#include <Windows.h>
#include "../../../../common/windows/cpp/include/legacy_kmx_memory.h"
#include "mcompile.h"
#include "mc_kmxfile.h"
#include "mc_syskbd.h"
#include "../../../../common/windows/cpp/include/crc32.h"
#include "../../../../common/include/kmx_file.h"