From e28832e15803ac8ea8af1d605f3ae9f599f08146 Mon Sep 17 00:00:00 2001 From: muyexi Date: Mon, 20 Feb 2023 18:34:22 +0900 Subject: [PATCH] feat(MPPreferences): previewMode --- MacDown/Code/Document/MPDocument.m | 4 ++ MacDown/Code/Preferences/MPPreferences.h | 1 + MacDown/Code/Preferences/MPPreferences.m | 1 + .../MPGeneralPreferencesViewController.xib | 53 +++++++++++-------- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/MacDown/Code/Document/MPDocument.m b/MacDown/Code/Document/MPDocument.m index acbc77ff..af4c9020 100644 --- a/MacDown/Code/Document/MPDocument.m +++ b/MacDown/Code/Document/MPDocument.m @@ -456,6 +456,10 @@ - (void)windowControllerDidLoadNib:(NSWindowController *)controller [self setupEditor:nil]; [self redrawDivider]; [self reloadFromLoadedString]; + + if (self.preferences.previewMode) { + [self setSplitViewDividerLocation:0]; + } }]; } diff --git a/MacDown/Code/Preferences/MPPreferences.h b/MacDown/Code/Preferences/MPPreferences.h index e14d2621..97f47f60 100644 --- a/MacDown/Code/Preferences/MPPreferences.h +++ b/MacDown/Code/Preferences/MPPreferences.h @@ -18,6 +18,7 @@ extern NSString * const MPDidDetectFreshInstallationNotification; @property (assign) NSString *latestVersionInstalled; @property (assign) BOOL updateIncludesPreReleases; @property (assign) BOOL supressesUntitledDocumentOnLaunch; +@property (assign) BOOL previewMode; @property (assign) BOOL createFileForLinkTarget; // Extension flags. diff --git a/MacDown/Code/Preferences/MPPreferences.m b/MacDown/Code/Preferences/MPPreferences.m index 4f54f8e9..60f6bd17 100644 --- a/MacDown/Code/Preferences/MPPreferences.m +++ b/MacDown/Code/Preferences/MPPreferences.m @@ -74,6 +74,7 @@ - (instancetype)init @dynamic latestVersionInstalled; @dynamic updateIncludesPreReleases; @dynamic supressesUntitledDocumentOnLaunch; +@dynamic previewMode; @dynamic createFileForLinkTarget; @dynamic extensionIntraEmphasis; diff --git a/MacDown/Localization/Base.lproj/MPGeneralPreferencesViewController.xib b/MacDown/Localization/Base.lproj/MPGeneralPreferencesViewController.xib index 454499c4..45041cb1 100644 --- a/MacDown/Localization/Base.lproj/MPGeneralPreferencesViewController.xib +++ b/MacDown/Localization/Base.lproj/MPGeneralPreferencesViewController.xib @@ -1,9 +1,9 @@ - - + + - - + + @@ -15,17 +15,17 @@ - + - + - + + + + + + + @@ -166,8 +179,6 @@ - -