diff --git a/English.lproj/MainMenu.nib/classes.nib b/English.lproj/MainMenu.nib/classes.nib
index 074fecf..ebcef93 100644
--- a/English.lproj/MainMenu.nib/classes.nib
+++ b/English.lproj/MainMenu.nib/classes.nib
@@ -1,6 +1,17 @@
{
IBClasses = (
- {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
+ {
+ ACTIONS = {
+ zoomIn = id;
+ zoomOut = id;
+ zoomToActualSize = id;
+ zoomToFit = id;
+ zoomToFitWidth = id;
+ };
+ CLASS = FirstResponder;
+ LANGUAGE = ObjC;
+ SUPERCLASS = NSObject;
+ },
{
ACTIONS = {playNewPitch = id; selectLilypondPath = id; };
CLASS = VLAppController;
diff --git a/English.lproj/MainMenu.nib/info.nib b/English.lproj/MainMenu.nib/info.nib
index f1c65c1..de6a62d 100644
--- a/English.lproj/MainMenu.nib/info.nib
+++ b/English.lproj/MainMenu.nib/info.nib
@@ -7,16 +7,16 @@
IBEditorPositions
29
- 214 402 301 44 0 0 1024 746
+ 232 309 349 44 0 0 1024 746
IBFramework Version
453.0
IBOpenObjects
- 29
217
+ 29
IBSystem Version
- 9A294
+ 9A300
diff --git a/English.lproj/MainMenu.nib/keyedobjects.nib b/English.lproj/MainMenu.nib/keyedobjects.nib
index 70a5b89..a8b88f1 100644
Binary files a/English.lproj/MainMenu.nib/keyedobjects.nib and b/English.lproj/MainMenu.nib/keyedobjects.nib differ
diff --git a/Sources/VLPDFView.mm b/Sources/VLPDFView.mm
index 46b51c0..fa1055f 100644
--- a/Sources/VLPDFView.mm
+++ b/Sources/VLPDFView.mm
@@ -8,6 +8,8 @@
#import "VLPDFView.h"
+#include
+
@implementation VLPDFView
- (BOOL)tryOpenURL:(NSURL *)url
@@ -35,4 +37,41 @@
return YES;
}
+- (IBAction) displaySinglePage: (id) sender
+{
+ // Display single page mode.
+ if ([self displayMode] > kPDFDisplaySinglePageContinuous)
+ [self setDisplayMode: [self displayMode] - 2];
+}
+
+- (IBAction) displayTwoUp: (id) sender
+{
+ // Display two-up.
+ if ([self displayMode] < kPDFDisplayTwoUp)
+ [self setDisplayMode: [self displayMode] + 2];
+}
+
+- (IBAction) zoomToFit: (id) sender
+{
+ NSSize sz = [self frame].size;
+ NSSize frame= [[self documentView] frame].size;
+
+ float scale = std::min(sz.width / frame.width, sz.height / frame.height);
+
+ [self setScaleFactor: scale];
+}
+
+- (IBAction) zoomToFitWidth: (id) sender
+{
+ NSSize sz = [self frame].size;
+ NSSize frame= [[self documentView] frame].size;
+
+ [self setScaleFactor: sz.width / frame.width];
+}
+
+- (IBAction) zoomToActualSize: (id) sender
+{
+ [self setScaleFactor: 1.0];
+}
+
@end
diff --git a/Sources/VLSheetView.mm b/Sources/VLSheetView.mm
index 2db8842..260f6a5 100644
--- a/Sources/VLSheetView.mm
+++ b/Sources/VLSheetView.mm
@@ -254,8 +254,8 @@ VLMusicElement sSemi2Accidental[12][12] = {
NSScrollView * scroll = [self enclosingScrollView];
NSSize sz = [scroll contentSize];
- sz.width /= fDisplayScale;
- sz.height /= fDisplayScale;
+ sz.width *= fDisplayScale;
+ sz.height *= fDisplayScale;
const VLSong * song = [self song];
const VLProperties & prop = song->fProperties.front();
@@ -269,10 +269,10 @@ VLMusicElement sSemi2Accidental[12][12] = {
fNumSystems = (song->CountMeasures()+fMeasPerSystem-1)/fMeasPerSystem;
sz.height = fNumSystems*kSystemH;
- NSSize frameSz = {sz.width * fDisplayScale, sz.height * fDisplayScale};
+ NSSize boundsSz = {sz.width / fDisplayScale, sz.height / fDisplayScale};
- [self setFrameSize:frameSz];
- [self setBoundsSize:sz];
+ [self setFrameSize:sz];
+ [self setBoundsSize:boundsSz];
[self setNeedsDisplay:YES];
if (fNeedsRecalc == kFirstRecalc) {
@@ -710,4 +710,23 @@ static int8_t sSharpAcc[] = {
[self setNeedsDisplay: YES];
}
+- (void) setScaleFactor:(float)scale
+{
+ fDisplayScale= scale;
+ fNeedsRecalc = kRecalc;
+ [self setNeedsDisplay: YES];
+}
+
+#if 0
+- (IBAction) zoomIn: (id) sender
+{
+ [self setScaleFactor: fDisplayScale * sqrt(2.0)];
+}
+
+- (IBAction) zoomOut: (id) sender
+{
+ [self setScaleFactor: fDisplayScale / sqrt(2.0)];
+}
+#endif
+
@end