/*
ALTKEYSM.h
Copyright (C) 2007 Paul C. Pratt
You can redistribute this file and/or modify it under the terms
of version 2 of the GNU General Public License as published by
the Free Software Foundation. You should have received a copy
of the license along with this file; see the file COPYING.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
license for more details.
*//*
ALTernate KEYs Mode
*/#ifdef ALTKEYSM_H#error "header already included"#else#define ALTKEYSM_H#endifLOCALVARblnrAltKeysLockText=falseblnr;LOCALVARblnrAltKeysTrueCmnd=falseblnr;LOCALVARblnrAltKeysTrueOption=falseblnr;LOCALVARblnrAltKeysTrueShift=falseblnr;LOCALVARblnrAltKeysModOn=falseblnr;LOCALVARblnrAltKeysTextOn=falseblnr;LOCALPROCCheckAltKeyUseMode(void){blnrNewAltKeysTextOn;AltKeysModOn=AltKeysTrueCmnd||AltKeysTrueOption||AltKeysTrueShift;NewAltKeysTextOn=AltKeysLockText||AltKeysModOn;if(NewAltKeysTextOn!=AltKeysTextOn){DisconnectKeyCodes(kKeepMaskControl|kKeepMaskCapsLock|(AltKeysTrueCmnd?kKeepMaskCommand:0)|(AltKeysTrueOption?kKeepMaskOption:0)|(AltKeysTrueShift?kKeepMaskShift:0));AltKeysTextOn=NewAltKeysTextOn;}}LOCALPROCKeyboard_UpdateKeyMap1(intkey,blnrdown){if(MKC_Command==key){AltKeysTrueCmnd=down;CheckAltKeyUseMode();Keyboard_UpdateKeyMap(key,down);}elseif(MKC_Option==key){AltKeysTrueOption=down;CheckAltKeyUseMode();Keyboard_UpdateKeyMap(key,down);}elseif(MKC_Shift==key){AltKeysTrueShift=down;CheckAltKeyUseMode();Keyboard_UpdateKeyMap(key,down);}elseif(MKC_SemiColon==key){if(down&&!AltKeysModOn){if(AltKeysLockText){AltKeysLockText=falseblnr;NeedWholeScreenDraw=trueblnr;SpecialModeClr(SpclModeAltKeyText);CheckAltKeyUseMode();}}else{Keyboard_UpdateKeyMap(key,down);}}elseif(AltKeysTextOn){Keyboard_UpdateKeyMap(key,down);}elseif(MKC_M==key){if(down){if(!AltKeysLockText){AltKeysLockText=trueblnr;SpecialModeSet(SpclModeAltKeyText);NeedWholeScreenDraw=trueblnr;CheckAltKeyUseMode();}}}else{switch(key){caseMKC_A:key=MKC_SemiColon;break;caseMKC_B:key=MKC_BackSlash;break;caseMKC_C:key=MKC_F3;break;caseMKC_D:key=MKC_Option;break;caseMKC_E:key=MKC_BackSpace;break;caseMKC_F:key=MKC_Command;break;caseMKC_G:key=MKC_Enter;break;caseMKC_H:key=MKC_Equal;break;caseMKC_I:key=MKC_Up;break;caseMKC_J:key=MKC_Left;break;caseMKC_K:key=MKC_Down;break;caseMKC_L:key=MKC_Right;break;caseMKC_M:/* handled above */break;caseMKC_N:key=MKC_Minus;break;caseMKC_O:key=MKC_RightBracket;break;caseMKC_P:return;/* none */break;caseMKC_Q:key=MKC_Grave;break;caseMKC_R:key=MKC_Return;break;caseMKC_S:key=MKC_Shift;break;caseMKC_T:key=MKC_Tab;break;caseMKC_U:key=MKC_LeftBracket;break;caseMKC_V:key=MKC_F4;break;caseMKC_W:return;/* none */break;caseMKC_X:key=MKC_F2;break;caseMKC_Y:key=MKC_Escape;break;caseMKC_Z:key=MKC_F1;break;default:break;}Keyboard_UpdateKeyMap(key,down);}}LOCALPROCDisconnectKeyCodes1(ui5bKeepMask){DisconnectKeyCodes(KeepMask);if(!(0!=(KeepMask&kKeepMaskCommand))){AltKeysTrueCmnd=falseblnr;}if(!(0!=(KeepMask&kKeepMaskOption))){AltKeysTrueOption=falseblnr;}if(!(0!=(KeepMask&kKeepMaskShift))){AltKeysTrueShift=falseblnr;}AltKeysModOn=AltKeysTrueCmnd||AltKeysTrueOption||AltKeysTrueShift;AltKeysTextOn=AltK