mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Don't change the selected line when scrolling.
With the mouse wheel or otherwise, it's confusing.
This commit is contained in:
parent
0019666939
commit
d39662f291
2 changed files with 26 additions and 19 deletions
|
@ -441,19 +441,15 @@ void CtrlDisAsmView::onVScroll(WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
case SB_LINEDOWN:
|
||||
windowStart += instructionSize;
|
||||
curAddress += instructionSize;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
windowStart -= instructionSize;
|
||||
curAddress -= instructionSize;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
windowStart += visibleRows*instructionSize;
|
||||
curAddress += visibleRows*instructionSize;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
windowStart -= visibleRows*instructionSize;
|
||||
curAddress -= visibleRows*instructionSize;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
@ -509,35 +505,29 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
|
|||
switch (wParam & 0xFFFF)
|
||||
{
|
||||
case VK_DOWN:
|
||||
if (curAddress == windowEnd-instructionSize)
|
||||
{
|
||||
windowStart += instructionSize;
|
||||
}
|
||||
curAddress += instructionSize;
|
||||
scrollAddressIntoView();
|
||||
break;
|
||||
case VK_UP:
|
||||
if (curAddress == windowStart)
|
||||
{
|
||||
windowStart -= instructionSize;
|
||||
}
|
||||
curAddress-=instructionSize;
|
||||
scrollAddressIntoView();
|
||||
break;
|
||||
case VK_NEXT:
|
||||
if (curAddress != windowEnd-instructionSize)
|
||||
{
|
||||
if (curAddress != windowEnd-instructionSize && curAddressIsVisible()) {
|
||||
curAddress = windowEnd-instructionSize;
|
||||
scrollAddressIntoView();
|
||||
} else {
|
||||
windowStart += visibleRows*instructionSize;
|
||||
curAddress += visibleRows*instructionSize;
|
||||
scrollAddressIntoView();
|
||||
}
|
||||
break;
|
||||
case VK_PRIOR:
|
||||
if (curAddress != windowStart)
|
||||
{
|
||||
if (curAddress != windowStart && curAddressIsVisible()) {
|
||||
curAddress = windowStart;
|
||||
scrollAddressIntoView();
|
||||
} else {
|
||||
windowStart -= visibleRows*instructionSize;
|
||||
curAddress -= visibleRows*instructionSize;
|
||||
scrollAddressIntoView();
|
||||
}
|
||||
break;
|
||||
case VK_LEFT:
|
||||
|
@ -591,6 +581,22 @@ void CtrlDisAsmView::onKeyUp(WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
|
||||
void CtrlDisAsmView::scrollAddressIntoView()
|
||||
{
|
||||
u32 windowEnd = windowStart + visibleRows * instructionSize;
|
||||
|
||||
if (curAddress < windowStart)
|
||||
windowStart = curAddress;
|
||||
else if (curAddress >= windowEnd)
|
||||
windowStart = curAddress - visibleRows * instructionSize + instructionSize;
|
||||
}
|
||||
|
||||
bool CtrlDisAsmView::curAddressIsVisible()
|
||||
{
|
||||
u32 windowEnd = windowStart + visibleRows * instructionSize;
|
||||
return curAddress >= windowStart && curAddress < windowEnd;
|
||||
}
|
||||
|
||||
void CtrlDisAsmView::redraw()
|
||||
{
|
||||
if (dontRedraw == true) return;
|
||||
|
|
|
@ -82,6 +82,8 @@ public:
|
|||
void onMouseDown(WPARAM wParam, LPARAM lParam, int button);
|
||||
void onMouseUp(WPARAM wParam, LPARAM lParam, int button);
|
||||
void onMouseMove(WPARAM wParam, LPARAM lParam, int button);
|
||||
void scrollAddressIntoView();
|
||||
bool curAddressIsVisible();
|
||||
void redraw();
|
||||
|
||||
void getOpcodeText(u32 address, char* dest);
|
||||
|
@ -134,7 +136,6 @@ public:
|
|||
void scrollWindow(int lines)
|
||||
{
|
||||
windowStart += lines*instructionSize;
|
||||
curAddress += lines*instructionSize;
|
||||
redraw();
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue