mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-12 03:45:34 +00:00
feat(linux): mcompile remove -u option
This commit is contained in:
parent
fa57aa7ae9
commit
e353f4e8d6
6 changed files with 43 additions and 68 deletions
|
|
@ -28,6 +28,7 @@ TODO where to store VK_CANCEL.... in km_types.h or elsewhere?
|
|||
ToDo check up to 8 shiftstates ( find symbols-file with 8)
|
||||
TODO get_position_From_VirtualKey_US: take care of the other shiftstates
|
||||
ToDo make this better!!! get_VirtualKey_Other_From_SC
|
||||
ToDo use _free(keyvals); g_free(maps);
|
||||
|
||||
TODO next:
|
||||
- change mapping (win-lin) for writing All_Vector
|
||||
|
|
|
|||
|
|
@ -1493,3 +1493,33 @@ std::wstring get_VirtualKey_Other_from_iKey(KMX_DWORD iKey, ShiftState &ss, int
|
|||
return L"";
|
||||
}
|
||||
|
||||
|
||||
// _S2 This can go later
|
||||
/*KMX_DWORD get_VirtualKey_Other_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector) {
|
||||
|
||||
for( int i=0; i< (int)All_Vector[0].size();i++) {
|
||||
//number keys return unshifted value ( e.g. 1, not !)
|
||||
if(SC <= 19) {
|
||||
if ( All_Vector[0][i][0] == SC)
|
||||
return All_Vector[1][i][1];
|
||||
}
|
||||
|
||||
// other keys
|
||||
if((SC > 19) ) {
|
||||
if ( All_Vector[0][i][0] == SC) {
|
||||
|
||||
// normal capital characters return the value of capital char ( e.g. A)
|
||||
if ((All_Vector[1][i][2] >= 65 ) && (All_Vector[1][i][2] < 91 ))
|
||||
return All_Vector[1][i][2];
|
||||
|
||||
// special characters return Keyman defined values (e.g. VK_ACCENT)
|
||||
else
|
||||
//return All_Vector[1][i][1];
|
||||
return mapVK_To_char(SC);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -326,8 +326,6 @@ KMX_DWORD getKeyvalsFromKeymap(GdkKeymap *keymap, guint keycode, int shift_state
|
|||
|
||||
out =(KMX_DWORD) keyvals[shift_state_pos];
|
||||
|
||||
// _S2 QUESTION
|
||||
// _S2 what is 65104-65106, 65506, 21840
|
||||
// _S2 if out of range of what ( ascii??) return 0 or other value ?
|
||||
if (out > 255) {
|
||||
wprintf(L"out of range: found value out( %i) for keycode = %i /shift_state_pos %i (49= TLDE 21= VK_EQUALS on US keyboard) \n", out,keycode,shift_state_pos);
|
||||
|
|
@ -386,36 +384,6 @@ KMX_DWORD mapChar_To_VK(KMX_DWORD chr ){
|
|||
// else
|
||||
return chr;
|
||||
}
|
||||
|
||||
// _S2 This can go later
|
||||
/*KMX_DWORD get_VirtualKey_Other_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector) {
|
||||
|
||||
for( int i=0; i< (int)All_Vector[0].size();i++) {
|
||||
//number keys return unshifted value ( e.g. 1, not !)
|
||||
if(SC <= 19) {
|
||||
if ( All_Vector[0][i][0] == SC)
|
||||
return All_Vector[1][i][1];
|
||||
}
|
||||
|
||||
// other keys
|
||||
if((SC > 19) ) {
|
||||
if ( All_Vector[0][i][0] == SC) {
|
||||
|
||||
// normal capital characters return the value of capital char ( e.g. A)
|
||||
if ((All_Vector[1][i][2] >= 65 ) && (All_Vector[1][i][2] < 91 ))
|
||||
return All_Vector[1][i][2];
|
||||
|
||||
// special characters return Keyman defined values (e.g. VK_ACCENT)
|
||||
else
|
||||
//return All_Vector[1][i][1];
|
||||
return mapVK_To_char(SC);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
KMX_DWORD get_VirtualKey_Other_GDK( GdkKeymap *keymap, KMX_DWORD keycode) {
|
||||
|
||||
GdkModifierType consumed;
|
||||
|
|
|
|||
|
|
@ -496,8 +496,6 @@ int replace_PosKey_with_Keycode_use_Lin(std::string in);
|
|||
v_dw_2D create_empty_2D(int dim_rows, int dim_shifts);
|
||||
|
||||
// query All_Vector
|
||||
// return the VirtualKey of the Other Keyboard for given Scancode
|
||||
//KMX_DWORD get_VirtualKey_Other_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector);
|
||||
// _S2 can go later return the VirtualKey of the US Keyboard for given Scancode
|
||||
KMX_DWORD get_VirtualKey_US_From_SC(KMX_DWORD SC , v_dw_3D &All_Vector);
|
||||
// _S2 can go later return the Scancode of for given VirtualKey of Other Keyboard
|
||||
|
|
|
|||
|
|
@ -594,12 +594,12 @@ int KMX_GetMaxDeadkeyIndex(KMX_WCHAR *p) {
|
|||
|
||||
bool IsKeymanUsedKey_S2(std::wstring SC_Other) {
|
||||
|
||||
int SC_US = (int) (*SC_Other.c_str());
|
||||
int SC_US = (int) (*SC_Other.c_str());
|
||||
|
||||
if ((SC_US>= 0x20 && SC_US <= 0x7A) || (SC_US >= 0x88 && SC_US < 0xFF))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
if ((SC_US>= 0x20 && SC_US <= 0x7A) || (SC_US >= 0x88 && SC_US < 0xFF))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -743,18 +743,18 @@ bool KMX_ImportRules(KMX_WCHAR *kbid, LPKMX_KEYBOARD kp,v_dw_3D &All_Vector, Gd
|
|||
std::wstring VK_OtherTEST5 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftMenu, 0);
|
||||
std::wstring VK_OtherTEST7 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftMenuCtrl, 0);
|
||||
std::wstring VK_OtherTEST8 = get_KeySyms_according_to_Shiftstate( *keymap, 58, Xxxx, 0);
|
||||
std::wstring VK_OtherTEST9 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftXxxx, 0);
|
||||
std::wstring VK_OtherTEST9 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftXxxx, 0);
|
||||
std::wstring VK_OtherTEST10 = get_KeySyms_according_to_Shiftstate( *keymap, 58, Base, 1);
|
||||
std::wstring VK_OtherTEST11 = get_KeySyms_according_to_Shiftstate( *keymap, 58, Shft, 1);
|
||||
std::wstring VK_OtherTEST12 = get_KeySyms_according_to_Shiftstate( *keymap, 58, Ctrl, 1);
|
||||
std::wstring VK_OtherTEST13 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftCtrl, 1);
|
||||
std::wstring VK_OtherTEST13 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftCtrl, 1);
|
||||
std::wstring VK_OtherTEST14 = get_KeySyms_according_to_Shiftstate( *keymap, 58, Menu, 1);
|
||||
std::wstring VK_OtherTEST15 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftMenu, 1);
|
||||
std::wstring VK_OtherTEST17 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftMenuCtrl, 1);
|
||||
std::wstring VK_OtherTEST18 = get_KeySyms_according_to_Shiftstate( *keymap, 58, Xxxx, 1);
|
||||
std::wstring VK_OtherTEST19 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftXxxx, 1);
|
||||
std::wstring VK_OtherTEST18 = get_KeySyms_according_to_Shiftstate( *keymap, 58, Xxxx, 1);
|
||||
std::wstring VK_OtherTEST19 = get_KeySyms_according_to_Shiftstate( *keymap, 58, ShftXxxx, 1);
|
||||
*/
|
||||
// _S2 needs to be changed - temporary to get the same keys as keyman does when using USVirtualKeyToScanCode
|
||||
// _S2 needs to be changed - it's temporary to get the same keys as keyman does when using USVirtualKeyToScanCode
|
||||
if (!IsKeymanUsedKey_S2(VK_Other))
|
||||
VK_Other =L"\0";
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ int run(int argc, std::vector<std::u16string> str_argv, char* argv_ch[] = NULL){
|
|||
|
||||
if(argc < 3 || (argc < 5 && u16cmp(argv[1], u"-u") != 0)) { // I4273// I4273
|
||||
wprintf(
|
||||
L"Usage: mcompile -u infile.kmx outfile.kmx\n"
|
||||
L"Usage: mcompile -u infile.kmx outfile.kmx\n (not available for Linux)"
|
||||
L" mcompile [-d] infile.kmx kbdfile.dll kbid outfile.kmx\n"
|
||||
L" With -u parameter, converts keyboard from ANSI to Unicode\n"
|
||||
L" Otherwise, mcompile converts a Keyman mnemonic layout to a\n"
|
||||
|
|
@ -88,29 +88,7 @@ int run(int argc, std::vector<std::u16string> str_argv, char* argv_ch[] = NULL){
|
|||
return 1;
|
||||
}
|
||||
|
||||
// _S2 QUESTION -------u option will be done later. Do we need it?? ----------------------
|
||||
|
||||
/* if(wcscmp(argv[1], L"-u") == 0) { // I4273
|
||||
wchar_t *infile = argv[2], *outfile = argv[3];
|
||||
|
||||
LPKEYBOARD kmxfile;
|
||||
|
||||
if(!LoadKeyboard(infile, &kmxfile)) {
|
||||
LogError(L"Failed to load keyboard (%d)", GetLastError());
|
||||
// replaced by _S2 KMX_LogError(L"Failed to load keyboard (%d)\n", errno );
|
||||
return 3;
|
||||
}
|
||||
|
||||
if(ConvertKeyboardToUnicode(kmxfile)) {
|
||||
SaveKeyboard(kmxfile, outfile);
|
||||
}
|
||||
|
||||
//DeleteReallocatedPointers(kmxfile); :TODO
|
||||
delete[] kmxfile;
|
||||
|
||||
return 0; // I4279
|
||||
}*/
|
||||
//-----------------------------
|
||||
// -u option was removed for Linux
|
||||
|
||||
int bDeadkeyConversion = u16cmp(argv[1], u"-d") == 0; // I4552
|
||||
int n = (bDeadkeyConversion ? 2 : 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue