do not assign one key twice to the same button

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@153 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2007-12-03 14:31:27 +00:00
parent aa49ab74ff
commit 62a08c4997
1 changed files with 13 additions and 1 deletions

View File

@ -35,8 +35,20 @@ BOOL bAppendMode;
void AssignKey(KeyList &Key, int Out) void AssignKey(KeyList &Key, int Out)
{ {
if (!bAppendMode) if( !bAppendMode ) {
Key.RemoveAll(); Key.RemoveAll();
} else {
POSITION pos = Key.GetHeadPosition();
if( pos != NULL ) {
// the list is not empty
while( true ) {
// we don't want to assign the same key twice
if( Key.GetAt( pos ) == Out ) return;
if( pos == Key.GetTailPosition() ) break;
Key.GetNext( pos );
}
}
}
Key.AddTail(Out); Key.AddTail(Out);
} }