GUI: home/end keys

This commit is contained in:
tildearrow 2022-01-11 18:54:31 -05:00
parent 5dfe19e52d
commit 80c03fcbae
2 changed files with 36 additions and 0 deletions

View file

@ -1835,6 +1835,34 @@ void FurnaceGUI::moveCursor(int x, int y) {
updateScroll(cursor.y); updateScroll(cursor.y);
} }
void FurnaceGUI::moveCursorTop() {
finishSelection();
curNibble=false;
if (cursor.y==0) {
cursor.xCoarse=0;
cursor.xFine=0;
} else {
cursor.y=0;
}
selStart=cursor;
selEnd=cursor;
updateScroll(cursor.y);
}
void FurnaceGUI::moveCursorBottom() {
finishSelection();
curNibble=false;
if (cursor.y==e->song.patLen-1) {
cursor.xCoarse=e->getTotalChannelCount()-1;
cursor.xFine=2+e->song.pat[cursor.xCoarse].effectRows*2;
} else {
cursor.y=e->song.patLen-1;
}
selStart=cursor;
selEnd=cursor;
updateScroll(cursor.y);
}
void FurnaceGUI::editAdvance() { void FurnaceGUI::editAdvance() {
finishSelection(); finishSelection();
cursor.y+=editStep; cursor.y+=editStep;
@ -2353,6 +2381,12 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
case SDLK_PAGEDOWN: case SDLK_PAGEDOWN:
moveCursor(0,16); moveCursor(0,16);
break; break;
case SDLK_HOME:
moveCursorTop();
break;
case SDLK_END:
moveCursorBottom();
break;
case SDLK_DELETE: case SDLK_DELETE:
doDelete(); doDelete();
break; break;

View file

@ -235,6 +235,8 @@ class FurnaceGUI {
void finishSelection(); void finishSelection();
void moveCursor(int x, int y); void moveCursor(int x, int y);
void moveCursorTop();
void moveCursorBottom();
void editAdvance(); void editAdvance();
void prepareUndo(ActionType action); void prepareUndo(ActionType action);
void makeUndo(ActionType action); void makeUndo(ActionType action);