mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +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 = (
|
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; };
|
ACTIONS = {playNewPitch = id; selectLilypondPath = id; };
|
||||||
CLASS = VLAppController;
|
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>
|
<key>IBEditorPositions</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>29</key>
|
<key>29</key>
|
||||||
<string>214 402 301 44 0 0 1024 746 </string>
|
<string>232 309 349 44 0 0 1024 746 </string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>IBFramework Version</key>
|
<key>IBFramework Version</key>
|
||||||
<string>453.0</string>
|
<string>453.0</string>
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>29</integer>
|
|
||||||
<integer>217</integer>
|
<integer>217</integer>
|
||||||
|
<integer>29</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>9A294</string>
|
<string>9A300</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</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"
|
#import "VLPDFView.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
@implementation VLPDFView
|
@implementation VLPDFView
|
||||||
|
|
||||||
- (BOOL)tryOpenURL:(NSURL *)url
|
- (BOOL)tryOpenURL:(NSURL *)url
|
||||||
|
@ -35,4 +37,41 @@
|
||||||
return YES;
|
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
|
@end
|
||||||
|
|
|
@ -254,8 +254,8 @@ VLMusicElement sSemi2Accidental[12][12] = {
|
||||||
NSScrollView * scroll = [self enclosingScrollView];
|
NSScrollView * scroll = [self enclosingScrollView];
|
||||||
|
|
||||||
NSSize sz = [scroll contentSize];
|
NSSize sz = [scroll contentSize];
|
||||||
sz.width /= fDisplayScale;
|
sz.width *= fDisplayScale;
|
||||||
sz.height /= fDisplayScale;
|
sz.height *= fDisplayScale;
|
||||||
|
|
||||||
const VLSong * song = [self song];
|
const VLSong * song = [self song];
|
||||||
const VLProperties & prop = song->fProperties.front();
|
const VLProperties & prop = song->fProperties.front();
|
||||||
|
@ -269,10 +269,10 @@ VLMusicElement sSemi2Accidental[12][12] = {
|
||||||
fNumSystems = (song->CountMeasures()+fMeasPerSystem-1)/fMeasPerSystem;
|
fNumSystems = (song->CountMeasures()+fMeasPerSystem-1)/fMeasPerSystem;
|
||||||
sz.height = fNumSystems*kSystemH;
|
sz.height = fNumSystems*kSystemH;
|
||||||
|
|
||||||
NSSize frameSz = {sz.width * fDisplayScale, sz.height * fDisplayScale};
|
NSSize boundsSz = {sz.width / fDisplayScale, sz.height / fDisplayScale};
|
||||||
|
|
||||||
[self setFrameSize:frameSz];
|
[self setFrameSize:sz];
|
||||||
[self setBoundsSize:sz];
|
[self setBoundsSize:boundsSz];
|
||||||
[self setNeedsDisplay:YES];
|
[self setNeedsDisplay:YES];
|
||||||
|
|
||||||
if (fNeedsRecalc == kFirstRecalc) {
|
if (fNeedsRecalc == kFirstRecalc) {
|
||||||
|
@ -710,4 +710,23 @@ static int8_t sSharpAcc[] = {
|
||||||
[self setNeedsDisplay: YES];
|
[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
|
@end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user