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
14 changes: 6 additions & 8 deletions MacDown.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1191,12 +1191,10 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-MacDown/Pods-MacDown-frameworks.sh",
"${PODS_ROOT}/Sparkle/Sparkle.framework",
"${PODS_ROOT}/Sparkle/Sparkle.framework.dSYM",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Sparkle.framework",
"${DWARF_DSYM_FOLDER_PATH}/Sparkle.framework.dSYM",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down Expand Up @@ -1699,7 +1697,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
Expand Down Expand Up @@ -1744,7 +1742,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
SDKROOT = macosx;
};
name = Release;
Expand All @@ -1759,7 +1757,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MacDown/Code/MacDown-Prefix.pch";
INFOPLIST_FILE = "MacDown/MacDown-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}-debug";
PRODUCT_NAME = MacDown;
SDKROOT = macosx;
Expand All @@ -1777,7 +1775,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "MacDown/Code/MacDown-Prefix.pch";
INFOPLIST_FILE = "MacDown/MacDown-Info.plist";
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}";
PRODUCT_NAME = MacDown;
SDKROOT = macosx;
Expand Down Expand Up @@ -1807,7 +1805,7 @@
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/MacDown-ggdtxvuybojeqbhjydkhilziizrv/Build/Products/Debug",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}";
PRODUCT_NAME = MacDownTests;
TEST_HOST = "$(BUNDLE_LOADER)";
Expand All @@ -1833,7 +1831,7 @@
"$(inherited)",
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/MacDown-ggdtxvuybojeqbhjydkhilziizrv/Build/Products/Debug",
);
MACOSX_DEPLOYMENT_TARGET = 10.8;
MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.uranusjr.${PRODUCT_NAME:rfc1034identifier:lower}";
PRODUCT_NAME = MacDownTests;
TEST_HOST = "$(BUNDLE_LOADER)";
Expand Down
12 changes: 7 additions & 5 deletions MacDown/Code/Application/MPToolbarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,12 @@ - (void)selectedToolbarItemGroupItem:(NSSegmentedControl *)sender

// Add space after the specified toolbar item indices
int spaceAfterIndices[] = {}; // No space in the default set
NSUInteger spaceAfterIndicesCount = 0;
int flexibleSpaceAfterIndices[] = {2, 3, 5, 7, 11};
int i = 0;
int j = 0;
int k = 0;
NSUInteger flexibleSpaceAfterIndicesCount = sizeof(flexibleSpaceAfterIndices) / sizeof(flexibleSpaceAfterIndices[0]);
NSUInteger i = 0;
NSUInteger j = 0;
NSUInteger k = 0;

for (NSString *itemIdentifier in orderedToolbarItemIdentifiers)
{
Expand All @@ -150,13 +152,13 @@ - (void)selectedToolbarItemGroupItem:(NSSegmentedControl *)sender
[defaultItemIdentifiers addObject:itemIdentifier];
}

if (i == spaceAfterIndices[j])
if (j < spaceAfterIndicesCount && i == spaceAfterIndices[j])
{
[defaultItemIdentifiers addObject:NSToolbarSpaceItemIdentifier];
j++;
}

if (i == flexibleSpaceAfterIndices[k])
if (k < flexibleSpaceAfterIndicesCount && i == flexibleSpaceAfterIndices[k])
{
[defaultItemIdentifiers addObject:NSToolbarFlexibleSpaceItemIdentifier];
k++;
Expand Down
10 changes: 5 additions & 5 deletions MacDown/Code/Document/MPDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ - (NSPrintInfo *)printInfo
NSPrintInfo *info = [super printInfo];
if (!info)
info = [[NSPrintInfo sharedPrintInfo] copy];
info.horizontalPagination = NSAutoPagination;
info.verticalPagination = NSAutoPagination;
info.horizontalPagination = NSPrintingPaginationModeAutomatic;
info.verticalPagination = NSPrintingPaginationModeAutomatic;
info.verticallyCentered = NO;
info.topMargin = 50.0;
info.leftMargin = 0.0;
Expand Down Expand Up @@ -1260,7 +1260,7 @@ - (IBAction)exportHtml:(id)sender

NSWindow *w = self.windowForSheet;
[panel beginSheetModalForWindow:w completionHandler:^(NSInteger result) {
if (result != NSFileHandlingPanelOKButton)
if (result != NSModalResponseOK)
return;
BOOL styles = controller.stylesIncluded;
BOOL highlighting = controller.highlightingIncluded;
Expand All @@ -1284,7 +1284,7 @@ - (IBAction)exportPdf:(id)sender
w = [windowControllers[0] window];

[panel beginSheetModalForWindow:w completionHandler:^(NSInteger result) {
if (result != NSFileHandlingPanelOKButton)
if (result != NSModalResponseOK)
return;

NSDictionary *settings = @{
Expand Down Expand Up @@ -1450,7 +1450,7 @@ - (IBAction)insertNewParagraph:(id)sender
if (location == newlineBefore + 1 && location == newlineAfter)
[self.editor insertNewline:self];
else
[self.editor insertText:@"\n\n"];
[self.editor insertText:@"\n\n" replacementRange:self.editor.selectedRange];
}

- (IBAction)setEditorOneQuarter:(id)sender
Expand Down
11 changes: 6 additions & 5 deletions MacDown/Code/Extension/NSTextView+Autocomplete.m
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ - (void)insertSpacesForTab
NSUInteger offset = (currentLocation - p - 1) % 4;
if (offset)
spaces = [spaces substringFromIndex:offset];
[self insertText:spaces];
[self insertText:spaces replacementRange:self.selectedRange];
}

- (BOOL)completeMatchingCharactersForTextInRange:(NSRange)range
Expand Down Expand Up @@ -583,7 +583,7 @@ - (BOOL)completeNextListItem:(BOOL)autoIncrement
if (contentLength > location + t.length
&& [[content substringWithRange:r] isEqualToString:t])
{
[self insertText:indent];
[self insertText:indent replacementRange:self.selectedRange];
return YES;
}

Expand All @@ -598,7 +598,7 @@ - (BOOL)completeNextListItem:(BOOL)autoIncrement
// Insert completion for normal cases.
if (t.length)
it = [NSString stringWithFormat:@"%@ ", it];
[self insertText:it];
[self insertText:it replacementRange:self.selectedRange];
return YES;
}

Expand Down Expand Up @@ -639,7 +639,7 @@ - (BOOL)completeNextBlockquoteLine
}

// Insert completion.
[self insertText:markers];
[self insertText:markers replacementRange:self.selectedRange];
return YES;
}

Expand All @@ -658,7 +658,8 @@ - (BOOL)completeNextIndentedLine

[self insertNewline:self];
NSRange indentRange = NSMakeRange(start, end - start);
[self insertText:[content substringWithRange:indentRange]];
[self insertText:[content substringWithRange:indentRange]
replacementRange:self.selectedRange];
return YES;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ - (IBAction)updateWordCounterVisibility:(id)sender
{
if (sender == self.autoRenderingToggle)
{
if (self.autoRenderingToggle.state != NSOnState)
if (self.autoRenderingToggle.state != NSControlStateValueOn)
self.preferences.editorShowWordCount = NO;
}
}
Expand Down
12 changes: 10 additions & 2 deletions MacDown/Code/Utility/MPUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,16 @@ BOOL MPStringIsNewline(NSString *str)
NSBundle *bundle = [NSBundle mainBundle];
NSString *filePath = [bundle pathForResource:name ofType:@"map"
inDirectory:@"Data"];
return [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
NSData *data = [NSData dataWithContentsOfFile:filePath];
if (!data)
return nil;

NSSet *classes = [NSSet setWithObjects:
[NSDictionary class], [NSMutableDictionary class],
[NSString class], [NSMutableString class],
[NSData class], [NSMutableData class], nil];
return [NSKeyedUnarchiver unarchivedObjectOfClasses:classes
fromData:data error:NULL];
}

id MPGetObjectFromJavaScript(NSString *code, NSString *variableName)
Expand Down Expand Up @@ -211,4 +220,3 @@ id MPGetObjectFromJavaScript(NSString *code, NSString *variableName)
JSStringRelease(js);
return object;
}

5 changes: 3 additions & 2 deletions MacDown/Code/View/MPDocumentSplitView.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ @implementation NSColor (Equality)

- (BOOL)isEqualToColor:(NSColor *)color
{
NSColor *rgb1 = [self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
NSColor *rgb2 = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
NSColorSpace *colorSpace = [NSColorSpace genericRGBColorSpace];
NSColor *rgb1 = [self colorUsingColorSpace:colorSpace];
NSColor *rgb2 = [color colorUsingColorSpace:colorSpace];
return rgb1 && rgb2 && [rgb1 isEqual:rgb2];
}

Expand Down
25 changes: 15 additions & 10 deletions MacDown/Code/View/MPEditorView.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ - (BOOL)scrollsPastEnd
}

- (void)awakeFromNib {
[self registerForDraggedTypes:[NSArray arrayWithObjects: NSDragPboard, nil]];
[self registerForDraggedTypes:@[NSPasteboardTypeFileURL]];
[super awakeFromNib];
}

Expand All @@ -65,21 +65,26 @@ - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard;
NSDragOperation sourceDragMask;

sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard];

if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];


NSDictionary *options = @{
NSPasteboardURLReadingFileURLsOnlyKey: @YES,
NSPasteboardURLReadingContentsConformToTypesKey: @[@"public.jpeg"],
};
NSArray *urls = [pboard readObjectsForClasses:@[[NSURL class]]
options:options];
NSURL *fileURL = urls.firstObject;
if (fileURL) {
/* Load data of file. */
NSError *error;
NSData *fileData = [NSData dataWithContentsOfFile: files[0]
options: NSMappedRead
error: &error];
NSData *fileData = [NSData dataWithContentsOfURL:fileURL
options:NSDataReadingMappedIfSafe
error:&error];
if (!error) {
// convert to base64 representation
NSString *dataString = [fileData base64Encoding];
NSString *dataString = [fileData base64EncodedStringWithOptions:0];

// insert into text.
NSInteger insertionPoint = [[[self selectedRanges] objectAtIndex:0] rangeValue].location;
Expand Down
7 changes: 7 additions & 0 deletions MacDown/MacDown.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>com.apple.security.cs.allow-jit</key><true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
<key>com.apple.security.cs.disable-library-validation</key><true/>
</dict></plist>
10 changes: 9 additions & 1 deletion Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :osx, "10.8"
platform :osx, "11.0"

source 'https://github.com/MacDownApp/cocoapods-specs.git' # Patched libraries.
source 'https://cdn.cocoapods.org/'
Expand Down Expand Up @@ -27,3 +27,11 @@ end
target "macdown-cmd" do
pod 'GBCli', '~> 1.1'
end

post_install do |installer|
installer.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '11.0'
end
end
end
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ SPEC CHECKSUMS:
PAPreferences: 9f0ffb1e67174a0df001af9d3320166ceb9ee6f5
Sparkle: 06ea33170007c5937ee54da481b4481af98fac79

PODFILE CHECKSUM: e9356b9a2ceafda7889ba385de6e9f2d8b06cba0
PODFILE CHECKSUM: 11d06d0c907d0d1cff079d96568b1ab059b50878

COCOAPODS: 1.8.4
COCOAPODS: 1.16.2