mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
- Shift+letter when clicking tileset,map or techtree will advance properly in the clicked direction
This commit is contained in:
parent
646a066ec4
commit
abb525fbd1
@ -462,7 +462,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||||||
if(b1) {
|
if(b1) {
|
||||||
bool bFound = false;
|
bool bFound = false;
|
||||||
if(advanceToItemStartingWith != "") {
|
if(advanceToItemStartingWith != "") {
|
||||||
for(unsigned int i = 0; i < items.size(); ++i) {
|
for(unsigned int i = selectedItemIndex - 1; i >= 0; --i) {
|
||||||
string item = items[i];
|
string item = items[i];
|
||||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
bFound = true;
|
bFound = true;
|
||||||
@ -470,6 +470,17 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(bFound == false) {
|
||||||
|
for(unsigned int i = items.size() - 1; i >= selectedItemIndex; --i) {
|
||||||
|
string item = items[i];
|
||||||
|
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||||
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
|
bFound = true;
|
||||||
|
selectedItemIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(bFound == false) {
|
if(bFound == false) {
|
||||||
selectedItemIndex--;
|
selectedItemIndex--;
|
||||||
@ -481,7 +492,7 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||||||
else if(b2) {
|
else if(b2) {
|
||||||
bool bFound = false;
|
bool bFound = false;
|
||||||
if(advanceToItemStartingWith != "") {
|
if(advanceToItemStartingWith != "") {
|
||||||
for(unsigned int i = 0; i < items.size(); ++i) {
|
for(unsigned int i = selectedItemIndex + 1; i < items.size(); ++i) {
|
||||||
string item = items[i];
|
string item = items[i];
|
||||||
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||||
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
@ -490,6 +501,17 @@ bool GraphicListBox::mouseClick(int x, int y,string advanceToItemStartingWith) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(bFound == false) {
|
||||||
|
for(unsigned int i = 0; i <= selectedItemIndex; ++i) {
|
||||||
|
string item = items[i];
|
||||||
|
//printf("Trying to match [%s] with item [%s]\n",advanceToItemStartingWith.c_str(),item.c_str());
|
||||||
|
if(StartsWith(toLower(item),toLower(advanceToItemStartingWith)) == true) {
|
||||||
|
bFound = true;
|
||||||
|
selectedItemIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(bFound == false) {
|
if(bFound == false) {
|
||||||
selectedItemIndex++;
|
selectedItemIndex++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user