diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFView.h b/Meta/Lagom/Contrib/MacPDF/MacPDFView.h index e23684a91b..f96c2d9016 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFView.h +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFView.h @@ -23,4 +23,7 @@ - (void)setDelegate:(id)delegate; +- (IBAction)goToNextPage:(id)sender; +- (IBAction)goToPreviousPage:(id)sender; + @end diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm b/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm index 9b9fcc6088..89d11184ec 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFView.mm @@ -146,6 +146,18 @@ static NSBitmapImageRep* ns_from_gfx(NonnullRefPtr 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 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 diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h index 818bfd901e..92bd2d4977 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.h @@ -18,7 +18,11 @@ NS_ASSUME_NONNULL_BEGIN @interface MacPDFWindowController : NSWindowController - (instancetype)initWithDocument:(MacPDFDocument*)document; + +- (IBAction)goToNextPage:(id)sender; +- (IBAction)goToPreviousPage:(id)sender; - (IBAction)showGoToPageDialog:(id)sender; + - (void)pdfDidInitialize; @end diff --git a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm index 022c2af2ea..39a892bd5f 100644 --- a/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm +++ b/Meta/Lagom/Contrib/MacPDF/MacPDFWindowController.mm @@ -122,6 +122,16 @@ _outlineView.delegate = self; } +- (IBAction)goToNextPage:(id)sender +{ + [_pdfView goToNextPage:sender]; +} + +- (IBAction)goToPreviousPage:(id)sender +{ + [_pdfView goToPreviousPage:sender]; +} + - (IBAction)showGoToPageDialog:(id)sender { auto alert = [[NSAlert alloc] init]; diff --git a/Meta/Lagom/Contrib/MacPDF/MainMenu.xib b/Meta/Lagom/Contrib/MacPDF/MainMenu.xib index fbc59300b7..32ab8ed996 100644 --- a/Meta/Lagom/Contrib/MacPDF/MainMenu.xib +++ b/Meta/Lagom/Contrib/MacPDF/MainMenu.xib @@ -639,10 +639,22 @@ - + + + + + + + + + + + + + - +