Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions MacDown/Code/Document/MPDocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
@property (nonatomic, readwrite) NSString *markdown;
@property (nonatomic, readonly) NSString *html;

- (IBAction)zoomIn:(id)sender;
- (IBAction)zoomOut:(id)sender;

@end
22 changes: 19 additions & 3 deletions MacDown/Code/Document/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -1690,9 +1690,6 @@ - (void)redrawDivider

- (void)scaleWebview
{
if (!self.preferences.previewZoomRelativeToBaseFontSize)
return;

CGFloat fontSize = self.preferences.editorBaseFontSize;
if (fontSize <= 0.0)
return;
Expand All @@ -1714,6 +1711,25 @@ - (void)scaleWebview
#endif
}


- (IBAction)zoomIn:(id)sender
{
NSFont *currentFont = self.preferences.editorBaseFont;
CGFloat newSize = currentFont.pointSize + 1.0;
NSFont *newFont = [NSFont fontWithName:currentFont.fontName size:newSize];
self.preferences.editorBaseFont = newFont;
[self scaleWebview];
}

- (IBAction)zoomOut:(id)sender
{
NSFont *currentFont = self.preferences.editorBaseFont;
CGFloat newSize = MAX(currentFont.pointSize - 1.0, 8.0);
NSFont *newFont = [NSFont fontWithName:currentFont.fontName size:newSize];
self.preferences.editorBaseFont = newFont;
[self scaleWebview];
}

-(void) updateHeaderLocations
{
CGFloat offset = NSMinY(self.preview.enclosingScrollView.contentView.bounds);
Expand Down
11 changes: 11 additions & 0 deletions MacDown/Localization/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,17 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="QMZ-Ld-Nza"/>
<menuItem title="Zoom In" keyEquivalent="+" id="zIn-01-ABC">
<connections>
<action selector="zoomIn:" target="-1" id="zIn-02-DEF"/>
</connections>
</menuItem>
<menuItem title="Zoom Out" keyEquivalent="-" id="zOt-01-GHI">
<connections>
<action selector="zoomOut:" target="-1" id="zOt-02-JKL"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="zSp-01-MNO"/>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="1gz-YB-DZE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
Expand Down