DeviceButtonToLocalizedAndTranslatedString -> DeviceInputToTranslatedString

DeviceInputToTranslatedString -> DeviceInputToLocalizedAndTranslatedString
This commit is contained in:
Glenn Maynard
2006-06-15 03:39:25 +00:00
parent 0a5256bb03
commit 179c00cf40
3 changed files with 13 additions and 12 deletions
+8 -8
View File
@@ -148,14 +148,14 @@ RString DeviceButtonToString( DeviceButton key )
return "unknown"; return "unknown";
} }
RString DeviceButtonToTranslatedString( DeviceButton key ) RString DeviceInputToTranslatedString( DeviceInput di )
{ {
/* All printable ASCII except for uppercase alpha characters line up. */ /* All printable ASCII except for uppercase alpha characters line up. */
if( key >= 33 && key < 127 && if( di.button >= 33 && di.button < 127 &&
!(key >= 'A' && key <= 'Z' ) ) !(di.button >= 'A' && di.button <= 'Z' ) )
return WStringToRString( wstring()+INPUTMAN->DeviceButtonToChar(key,false) ); return WStringToRString( wstring()+INPUTMAN->DeviceInputToChar(di,false) );
return DeviceButtonToString( key ); return DeviceButtonToString( di.button );
} }
static LocalizedString HOME ( "DeviceButton", "Home" ); static LocalizedString HOME ( "DeviceButton", "Home" );
@@ -172,9 +172,9 @@ static LocalizedString PGUP ( "DeviceButton", "PgUp" );
static LocalizedString PGDN ( "DeviceButton", "PgDn" ); static LocalizedString PGDN ( "DeviceButton", "PgDn" );
static LocalizedString BACKSLASH ( "DeviceButton", "Backslash" ); static LocalizedString BACKSLASH ( "DeviceButton", "Backslash" );
RString DeviceButtonToLocalizedAndTranslatedString( DeviceButton key ) RString DeviceInputToLocalizedAndTranslatedString( DeviceInput di )
{ {
switch( key ) switch( di.button )
{ {
case KEY_HOME: return HOME.GetValue(); case KEY_HOME: return HOME.GetValue();
case KEY_END: return END.GetValue(); case KEY_END: return END.GetValue();
@@ -189,7 +189,7 @@ RString DeviceButtonToLocalizedAndTranslatedString( DeviceButton key )
case KEY_PGUP: return PGUP.GetValue(); case KEY_PGUP: return PGUP.GetValue();
case KEY_PGDN: return PGDN.GetValue(); case KEY_PGDN: return PGDN.GetValue();
case KEY_BACKSLASH: return BACKSLASH.GetValue(); case KEY_BACKSLASH: return BACKSLASH.GetValue();
default: return Capitalize( DeviceButtonToTranslatedString(key) ); default: return Capitalize( DeviceInputToTranslatedString(di) );
} }
} }
+3 -2
View File
@@ -292,8 +292,6 @@ enum DeviceButton
}; };
RString DeviceButtonToString( DeviceButton i ); RString DeviceButtonToString( DeviceButton i );
RString DeviceButtonToTranslatedString( DeviceButton i );
RString DeviceButtonToLocalizedAndTranslatedString( DeviceButton i );
DeviceButton StringToDeviceButton( const RString& s ); DeviceButton StringToDeviceButton( const RString& s );
struct DeviceInput struct DeviceInput
@@ -341,6 +339,9 @@ public:
bool IsJoystick() const { return ::IsJoystick(device); } bool IsJoystick() const { return ::IsJoystick(device); }
}; };
RString DeviceInputToTranslatedString( DeviceInput di );
RString DeviceInputToLocalizedAndTranslatedString( DeviceInput di );
#endif #endif
/* /*
* Copyright (c) 2001-2002 Chris Danford * Copyright (c) 2001-2002 Chris Danford
+2 -2
View File
@@ -3585,9 +3585,9 @@ static RString GetDeviceButtonsLocalized( const vector<EditButton> &veb, const M
DeviceInput diPress = editmap.button[*eb][s]; DeviceInput diPress = editmap.button[*eb][s];
DeviceInput diHold = editmap.hold[*eb][s]; DeviceInput diHold = editmap.hold[*eb][s];
if( diPress.IsValid() ) if( diPress.IsValid() )
vsPress.push_back( DeviceButtonToLocalizedAndTranslatedString(diPress.button) ); vsPress.push_back( DeviceInputToLocalizedAndTranslatedString(diPress) );
if( diHold.IsValid() ) if( diHold.IsValid() )
vsHold.push_back( DeviceButtonToLocalizedAndTranslatedString(diHold.button) ); vsHold.push_back( DeviceInputToLocalizedAndTranslatedString(diHold) );
} }
} }