mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Add zoom options
This commit is contained in:
parent
9c2dcd582e
commit
5c36dd0883
13
English.lproj/MainMenu.nib/classes.nib
generated
13
English.lproj/MainMenu.nib/classes.nib
generated
|
@ -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;
|
||||
|
|
6
English.lproj/MainMenu.nib/info.nib
generated
6
English.lproj/MainMenu.nib/info.nib
generated
|
@ -7,16 +7,16 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>29</key>
|
||||
<string>214 402 301 44 0 0 1024 746 </string>
|
||||
<string>232 309 349 44 0 0 1024 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>453.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>217</integer>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A294</string>
|
||||
<string>9A300</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -8,6 +8,8 @@
|
|||
|
||||
#import "VLPDFView.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
@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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user