Bool WSetEditWindowID( HWND dlg, uint_16 id, Bool is_pop_sep, char *symbol ) { Bool ok; ok = (dlg != (HWND)NULL); if( ok ) { if( is_pop_sep ) { ok = WSetEditWithStr( GetDlgItem( dlg, IDM_MENUEDID ), "" ); } else { if( symbol != NULL ) { ok = WSetEditWithStr( GetDlgItem( dlg, IDM_MENUEDID ), symbol ); } else { ok = WSetEditWithSINT32( GetDlgItem( dlg, IDM_MENUEDID ), (int_32)id, 10 ); } } } if( ok ) { if( is_pop_sep ) { ok = WSetEditWithStr( GetDlgItem( dlg, IDM_MENUEDNUM ), "" ); } else { ok = WSetEditWithSINT32( GetDlgItem( dlg, IDM_MENUEDNUM ), (int_32)id, 10 ); } } return( ok ); }
Bool WSetEditWindowText( HWND dlg, MenuFlags flags, char *text ) { Bool ok; char *t; char *n; ok = (dlg != (HWND)NULL); if( ok ) { if( flags & MENU_SEPARATOR ) { t = ""; } else { t = text; if( t == NULL ) { t = ""; } } } if( ok ) { n = WConvertStringFrom( t, "\t\x8", "ta" ); if( n != NULL ) { ok = WSetEditWithStr( GetDlgItem( dlg, IDM_MENUEDTEXT ), n ); WMemFree( n ); } else { ok = WSetEditWithStr( GetDlgItem( dlg, IDM_MENUEDTEXT ), t ); } } return( ok ); }
void WResetEditWindow( WAccelEditInfo *einfo ) { if( einfo != NULL ) { WSetEditWithStr( GetDlgItem( einfo->edit_dlg, IDM_ACCEDKEY ), "" ); WSetEditWithStr( GetDlgItem( einfo->edit_dlg, IDM_ACCEDCMDID ), "" ); WSetEditWithStr( GetDlgItem( einfo->edit_dlg, IDM_ACCEDCMDNUM ), "" ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDVIRT, BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDASCII, BST_CHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDCNTL, BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDSHFT, BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDALT, BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDFLASH, BST_UNCHECKED ); } }
bool WSetEditWithSINT32( HWND edit, int_32 val, int base ) { char temp[35]; ltoa( val, temp, base ); if( base == 16 ) { memmove( temp + 2, temp, 33 ); temp[0] = '0'; temp[1] = 'x'; } else if( base == 8 ) { memmove( temp + 1, temp, 34 ); temp[0] = '0'; } return( WSetEditWithStr( edit, temp ) ); }
bool WSetEditWindowID( HWND dlg, char *symbol, uint_16 id ) { bool ok; ok = (dlg != (HWND)NULL); if( ok ) { if( symbol != NULL ) { ok = WSetEditWithStr( GetDlgItem( dlg, IDM_ACCEDCMDID ), symbol ); } else { ok = WSetEditWithSINT32( GetDlgItem( dlg, IDM_ACCEDCMDID ), (int_32)id, 10 ); } } if( ok ) { ok = WSetEditWithSINT32( GetDlgItem( dlg, IDM_ACCEDCMDNUM ), (int_32)id, 10 ); } return( ok ); }
static bool WSetEditWindowKey( HWND dlg, uint_16 key, uint_16 flags ) { char *text; HWND edit; bool ok; ok = (dlg != (HWND)NULL); if( ok ) { text = WGetKeyText( key, flags ); ok = (text != NULL); } if( ok ) { edit = GetDlgItem( dlg, IDM_ACCEDKEY ); ok = WSetEditWithStr( edit, text ); } return( ok ); }
static void handleSymbols( WMenuEditInfo *einfo ) { char *text; if( !WEditSymbols( einfo->win, &einfo->info->symbol_table, WGetEditInstance(), WMenuHelpRoutine ) ) { return; } WResolveMenuSymIDs( einfo ); text = WGetStrFromEdit( GetDlgItem( einfo->edit_dlg, IDM_MENUEDID ), NULL ); WRAddSymbolsToComboBox( einfo->info->symbol_table, einfo->edit_dlg, IDM_MENUEDID, WR_HASHENTRY_ALL ); if( text != NULL ) { WSetEditWithStr( GetDlgItem( einfo->edit_dlg, IDM_MENUEDID ), text ); WMemFree( text ); } WHandleSelChange( einfo ); }
bool WSetEditWithWResID( HWND edit, WResID *id ) { char *cp; bool ok; cp = NULL; ok = (edit != (HWND)NULL && id != NULL); if( ok ) { ok = ((cp = WResIDToStr( id )) != NULL); } if( ok ) { ok = WSetEditWithStr( edit, cp ); } if( cp != NULL ) { WRMemFree( cp ); } return( ok ); }
void WSetKey( WAccelEditInfo *einfo, BYTE scan_code ) { bool cntl; bool shift; bool alt; char *str; char scan_key; uint_16 key; uint_16 skey; bool is_virt; BYTE kbstate[256]; int ta_ret; #ifdef __NT__ WORD ta_key; #else DWORD ta_key; #endif if( einfo == NULL ) { return; } is_virt = TRUE; key = einfo->key_info.key; skey = WMapShiftedKeyToKey( key ); GetKeyboardState( kbstate ); cntl = (kbstate[VK_CONTROL] & 0x0080) != 0; shift = (kbstate[VK_SHIFT] & 0x0080) != 0; alt = (kbstate[VK_MENU] & 0x0080) != 0; str = WGetVKeyFromID( key ); if( str == NULL ) { // I am assumming that they key must be alphanumeric // as WGetVKeyFromID( key ) would filter out all others if( isalpha( key ) ) { if( alt ) { str = WGetASCIIVKText( key ); } else { if( cntl ) { key = toupper( key ) - '@'; } else { if( !shift ) { key = tolower( key ); } } str = WGetASCIIKeyText( key ); is_virt = FALSE; } } else if( isdigit( key ) ) { if( alt || cntl ) { str = WGetASCIIVKText( key ); } else { if( shift ) { key = WMapKeyToShiftedKey( key ); } str = WGetASCIIKeyText( key ); is_virt = FALSE; } } else if( isdigit( skey ) ) { str = WGetASCIIVKText( skey ); // The remaining keys are the ones where we did not get a // virtual key we could translate, an alpha-numeric key, // a shifted 0-9 ( ie !@#$%^&*() ). // The ToAscii function handles everything except the following // keys where cntl is pressed. These keys are `-=[]\;',./ // So, I throw up my hands in defeat and add a special case } else if( cntl && (scan_key = WMapScanCodeToKey( scan_code )) != 0 ) { str = WGetASCIIKeyText( scan_key ); } else { ta_ret = ToAscii( key, scan_code, kbstate, &ta_key, 0 ); if( ta_ret ) { if( shift ) { ta_key = WMapShiftedKeyToKey( ta_key ); } str = WGetASCIIKeyText( ta_key ); } } } WSetEditWithStr( GetDlgItem( einfo->edit_dlg, IDM_ACCEDKEY ), str ); WSetVirtKey( einfo->edit_dlg, is_virt ); if( is_virt ) { CheckDlgButton( einfo->edit_dlg, IDM_ACCEDALT, ( alt ) ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDCNTL, ( cntl ) ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDSHFT, ( shift ) ? BST_CHECKED : BST_UNCHECKED ); } }