mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 14:47:35 +00:00
MacPDF: Make opt-up and opt-down always go to previous / next page
When the outline has focus, arrow keys navigate the outline instead of changing the current page. Add opt-up and opt-down as a way to move by one page even when the outline has focus. (This matches Preview.app.) xib change: Added two menu Previous Page with key equivalent opt-up and Next Page with key equivalent opt-down to Go menu and bound them to goToPreviousPage: and goToNextPage: on First Responder. When the outline has focus, the responder chain is outline -> window, so also add the actions on the window controller, and let that forward to the PDF view.
This commit is contained in:
parent
44f7d7406c
commit
627b152d49
5 changed files with 45 additions and 6 deletions
|
@ -146,6 +146,18 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr<Gfx::Bitmap> bitmap_p)
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (IBAction)goToNextPage:(id)sender
|
||||
{
|
||||
int current_page = _page_index + 1;
|
||||
[self goToPage:current_page + 1];
|
||||
}
|
||||
|
||||
- (IBAction)goToPreviousPage:(id)sender
|
||||
{
|
||||
int current_page = _page_index + 1;
|
||||
[self goToPage:current_page - 1];
|
||||
}
|
||||
|
||||
- (void)keyDown:(NSEvent*)event
|
||||
{
|
||||
// Calls moveLeft: or moveRight: below.
|
||||
|
@ -155,15 +167,13 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr<Gfx::Bitmap> bitmap_p)
|
|||
// Called on left arrow.
|
||||
- (IBAction)moveLeft:(id)sender
|
||||
{
|
||||
int current_page = _page_index + 1;
|
||||
[self goToPage:current_page - 1];
|
||||
[self goToPreviousPage:self];
|
||||
}
|
||||
|
||||
// Called on right arrow.
|
||||
- (IBAction)moveRight:(id)sender
|
||||
{
|
||||
int current_page = _page_index + 1;
|
||||
[self goToPage:current_page + 1];
|
||||
[self goToNextPage:self];
|
||||
}
|
||||
|
||||
#pragma mark - State restoration
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue