mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Fix navigation bar visibility on window creation (#269)
This commit is contained in:
parent
4d31c6a352
commit
ed8a79b491
@ -15,7 +15,7 @@ changelog
|
||||
- Fix an issue that new documents couldn't be saved with an extension that is automatically added from syntax definition.
|
||||
- Add a missig Japanese localized text in the status bar.
|
||||
- Fix an issue that current line highlight didn't update after font size change.
|
||||
- Fix an issue that status bar is shown for a moment on window creation even it is set as hidden.
|
||||
- Fix an issue that navigation/status bars are shown for a moment on window creation even they are set as hidden.
|
||||
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
- (NSString *)string;
|
||||
- (void)replaceTextStorage:(NSTextStorage *)textStorage;
|
||||
- (void)setShowsLineNum:(BOOL)showsLineNum;
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar;
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar animate:(BOOL)performAnimation;
|
||||
- (void)setWrapsLines:(BOOL)wrapsLines;
|
||||
- (void)setShowsInvisibles:(BOOL)showsInvisibles;
|
||||
- (void)setUsesAntialias:(BOOL)usesAntialias;
|
||||
|
@ -232,10 +232,10 @@
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// ナビゲーションバーを表示/非表示
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar animate:(BOOL)performAnimation;
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
[[self navigationBar] setShowsNavigationBar:showsNavigationBar];
|
||||
[[self navigationBar] setShown:showsNavigationBar animate:performAnimation];
|
||||
if (![self outlineMenuTimer]) {
|
||||
[self updateOutlineMenu];
|
||||
}
|
||||
|
@ -46,13 +46,13 @@
|
||||
@interface CEEditorWrapper : NSResponder
|
||||
|
||||
@property (nonatomic) BOOL showsLineNum;
|
||||
@property (nonatomic) BOOL showsNavigationBar;
|
||||
@property (nonatomic) BOOL wrapsLines;
|
||||
@property (nonatomic) BOOL showsPageGuide;
|
||||
@property (nonatomic) BOOL showsInvisibles;
|
||||
@property (nonatomic, getter=isVerticalLayoutOrientation) BOOL verticalLayoutOrientation;
|
||||
@property (nonatomic) CETextView *textView;
|
||||
|
||||
@property (readonly, nonatomic) BOOL showsNavigationBar;
|
||||
@property (readonly, nonatomic) BOOL canActivateShowInvisibles;
|
||||
|
||||
|
||||
|
@ -391,12 +391,12 @@ static NSTimeInterval secondColoringDelay;
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// ナビバーを表示する/しないをセット
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar animate:(BOOL)performAnimation
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
_showsNavigationBar = showsNavigationBar;
|
||||
|
||||
[[self splitViewController] setShowsNavigationBar:showsNavigationBar];
|
||||
[[self splitViewController] setShowsNavigationBar:showsNavigationBar animate:performAnimation];
|
||||
[[[self windowController] toolbarController] toggleItemWithTag:CEToolbarShowNavigationBarItemTag
|
||||
setOn:showsNavigationBar];
|
||||
}
|
||||
@ -674,7 +674,7 @@ static NSTimeInterval secondColoringDelay;
|
||||
- (IBAction)toggleNavigationBar:(id)sender
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
[self setShowsNavigationBar:![self showsNavigationBar]];
|
||||
[self setShowsNavigationBar:![self showsNavigationBar] animate:YES];
|
||||
}
|
||||
|
||||
|
||||
@ -798,7 +798,7 @@ static NSTimeInterval secondColoringDelay;
|
||||
[[self window] makeFirstResponder:[editorView textView]];
|
||||
[[editorView textView] setLineEndingString:[[self document] lineEndingString]];
|
||||
[[editorView textView] centerSelectionInVisibleArea:self];
|
||||
[editorView setShowsNavigationBar:[self showsNavigationBar]];
|
||||
[editorView setShowsNavigationBar:[self showsNavigationBar] animate:NO];
|
||||
[[self splitViewController] updateCloseSplitViewButton];
|
||||
}
|
||||
|
||||
@ -866,13 +866,13 @@ static NSTimeInterval secondColoringDelay;
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
[self setShowsLineNum:[defaults boolForKey:CEDefaultShowLineNumbersKey]];
|
||||
[self setShowsNavigationBar:[defaults boolForKey:CEDefaultShowNavigationBarKey]];
|
||||
[self setShowsNavigationBar:[defaults boolForKey:CEDefaultShowNavigationBarKey] animate:NO];
|
||||
[self setWrapsLines:[defaults boolForKey:CEDefaultWrapLinesKey]];
|
||||
[self setVerticalLayoutOrientation:[defaults boolForKey:CEDefaultLayoutTextVerticalKey]];
|
||||
[self setShowsPageGuide:[defaults boolForKey:CEDefaultShowPageGuideKey]];
|
||||
} else {
|
||||
[self setShowsLineNum:[self showsLineNum]];
|
||||
[self setShowsNavigationBar:[self showsNavigationBar]];
|
||||
[self setShowsNavigationBar:[self showsNavigationBar] animate:NO];
|
||||
[self setWrapsLines:[self wrapsLines]];
|
||||
[self setVerticalLayoutOrientation:[self isVerticalLayoutOrientation]];
|
||||
[self setShowsPageGuide:[self showsPageGuide]];
|
||||
|
@ -34,10 +34,13 @@
|
||||
@interface CENavigationBarController : NSViewController
|
||||
|
||||
@property (nonatomic, strong) NSTextView *textView; // NSTextView cannot be weak
|
||||
@property (nonatomic) BOOL showsNavigationBar;
|
||||
|
||||
@property (readonly, nonatomic, getter=isShown) BOOL shown;
|
||||
|
||||
|
||||
// Public method
|
||||
- (void)setShown:(BOOL)shown animate:(BOOL)performAnimation;
|
||||
|
||||
- (void)setOutlineMenuArray:(NSArray *)outlineItems;
|
||||
- (void)selectOutlineMenuItemWithRange:(NSRange)range;
|
||||
- (void)updatePrevNextButtonEnabled;
|
||||
|
@ -48,6 +48,9 @@ static const NSTimeInterval kDuration = 0.25;
|
||||
@property (nonatomic, weak) IBOutlet NSProgressIndicator *outlineIndicator;
|
||||
@property (nonatomic, weak) IBOutlet NSTextField *outlineLoadingMessage;
|
||||
|
||||
// readonly
|
||||
@property (readwrite, nonatomic, getter=isShown) BOOL shown;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -102,18 +105,24 @@ static const NSTimeInterval kDuration = 0.25;
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// set to show navigation bar.
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar
|
||||
- (void)setShown:(BOOL)isShown animate:(BOOL)performAnimation
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
_showsNavigationBar = showsNavigationBar;
|
||||
[self setShown:isShown];
|
||||
|
||||
CGFloat height = [self showsNavigationBar] ? kDefaultHeight : 0.0;
|
||||
CGFloat height = [self isShown] ? kDefaultHeight : 0.0;
|
||||
|
||||
// resize with animation
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
|
||||
[context setDuration:kDuration];
|
||||
[[[self heightConstraint] animator] setConstant:height];
|
||||
} completionHandler:nil];
|
||||
if (performAnimation) {
|
||||
// resize with animation
|
||||
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) {
|
||||
[context setDuration:kDuration];
|
||||
[[[self heightConstraint] animator] setConstant:height];
|
||||
} completionHandler:nil];
|
||||
|
||||
} else {
|
||||
// resize without animation
|
||||
[[self heightConstraint] setConstant:height];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
- (NSArray *)layoutManagers;
|
||||
|
||||
- (void)setShowsLineNum:(BOOL)showsLineNum;
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar;
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar animate:(BOOL)performAnimation;
|
||||
- (void)setWrapsLines:(BOOL)wrapsLines;
|
||||
- (void)setVerticalLayoutOrientation:(BOOL)isVerticalLayoutOrientation;
|
||||
- (void)setShowsInvisibles:(BOOL)showsInvisibles;
|
||||
|
@ -114,11 +114,11 @@
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// ナビゲーションバー描画の有無を設定
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar animate:(BOOL)performAnimation
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
for (CEEditorView *subview in [[self view] subviews]) {
|
||||
[subview setShowsNavigationBar:showsNavigationBar];
|
||||
[subview setShowsNavigationBar:showsNavigationBar animate:performAnimation];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user