mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Change status bar nest
This commit is contained in:
parent
abca6ee358
commit
7292e54657
@ -19,6 +19,7 @@ develop
|
||||
- Show / Hide Line Numbers
|
||||
- Show / Hide Status Bar
|
||||
- Display dialogs while changing file enocoding as a document-modal sheet.
|
||||
- Avoid expanding status bar into side inspector.
|
||||
- Better syntax highlighting while editing.
|
||||
- Enable activate “Show Invisibles” action even if all of invisible characters were set as not shown when the document was opened.
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
<outlet property="sidebar" destination="34" id="2IU-Vj-94v"/>
|
||||
<outlet property="sidebarPlaceholderView" destination="XSO-vY-vMP" id="9fk-c5-hjU"/>
|
||||
<outlet property="sidebarSplitView" destination="jhv-dr-CH4" id="CIg-jJ-bnp"/>
|
||||
<outlet property="statusBarController" destination="ZaC-Gi-qyq" id="JbQ-Wl-HQq"/>
|
||||
<outlet property="toolbarController" destination="71" id="Edj-p3-PkH"/>
|
||||
<outlet property="window" destination="5" id="31"/>
|
||||
</connections>
|
||||
@ -32,21 +31,90 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<splitView identifier="documentSidebar" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jhv-dr-CH4" userLabel="Sidebar Split View">
|
||||
<rect key="frame" x="0.0" y="20" width="600" height="530"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="550"/>
|
||||
<subviews>
|
||||
<splitView fixedFrame="YES" dividerStyle="paneSplitter" id="Ezm-P5-z5i" userLabel="Editor Split View" customClass="CESplitView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="369" height="530"/>
|
||||
<customView id="iXJ-7c-EQT" userLabel="Document View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="369" height="550"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="cfo-zY-w3h" id="ZBq-Sz-8et"/>
|
||||
</connections>
|
||||
</splitView>
|
||||
<subviews>
|
||||
<splitView dividerStyle="paneSplitter" translatesAutoresizingMaskIntoConstraints="NO" id="Ezm-P5-z5i" userLabel="Editor Split View" customClass="CESplitView">
|
||||
<rect key="frame" x="0.0" y="20" width="369" height="530"/>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="cfo-zY-w3h" id="ZBq-Sz-8et"/>
|
||||
</connections>
|
||||
</splitView>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Rjm-Sf-4Mf" customClass="CEBorderView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="369" height="20"/>
|
||||
<subviews>
|
||||
<imageView hidden="YES" toolTip="This document is read only." horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="EP1-My-tQo">
|
||||
<rect key="frame" x="8" y="2" width="16" height="16"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="LockedTemplate" id="2Vs-vL-w3p"/>
|
||||
<connections>
|
||||
<binding destination="ZaC-Gi-qyq" name="hidden" keyPath="showsReadOnly" id="1zI-EA-6Kx">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">NSNegateBoolean</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</imageView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="G7a-2k-nOK">
|
||||
<rect key="frame" x="34" y="3" width="33" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Label" id="b1b-Kr-R8m">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<binding destination="ZaC-Gi-qyq" name="value" keyPath="editorStatus" id="WLy-Pc-sLL"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QO1-yr-imY">
|
||||
<rect key="frame" x="328" y="3" width="33" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Label" id="W4S-dh-6hG">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<binding destination="ZaC-Gi-qyq" name="value" keyPath="documentStatus" id="K0i-Sk-yYU"/>
|
||||
</connections>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="EP1-My-tQo" firstAttribute="leading" secondItem="Rjm-Sf-4Mf" secondAttribute="leading" constant="8" id="4Pi-na-EuU"/>
|
||||
<constraint firstItem="QO1-yr-imY" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="G7a-2k-nOK" secondAttribute="trailing" constant="8" symbolic="YES" id="5h0-ME-eO2"/>
|
||||
<constraint firstAttribute="trailing" secondItem="QO1-yr-imY" secondAttribute="trailing" constant="10" id="8g0-6j-4iF"/>
|
||||
<constraint firstAttribute="centerY" secondItem="EP1-My-tQo" secondAttribute="centerY" id="McB-rh-aAx"/>
|
||||
<constraint firstItem="G7a-2k-nOK" firstAttribute="leading" secondItem="Rjm-Sf-4Mf" secondAttribute="leading" constant="36" id="T8V-uH-nUh"/>
|
||||
<constraint firstAttribute="height" constant="20" id="rVp-Pk-2Bh"/>
|
||||
<constraint firstAttribute="centerY" secondItem="QO1-yr-imY" secondAttribute="centerY" id="tYP-eB-pNq"/>
|
||||
<constraint firstAttribute="centerY" secondItem="G7a-2k-nOK" secondAttribute="centerY" id="wwt-6v-1Di"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="drawsTopBorder" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="drawsBottomBorder" value="NO"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="Rjm-Sf-4Mf" secondAttribute="bottom" id="2Vz-0i-Hdy"/>
|
||||
<constraint firstItem="Rjm-Sf-4Mf" firstAttribute="top" secondItem="Ezm-P5-z5i" secondAttribute="bottom" id="GGy-IJ-ybJ"/>
|
||||
<constraint firstItem="Ezm-P5-z5i" firstAttribute="top" secondItem="iXJ-7c-EQT" secondAttribute="top" id="H3r-sg-O5Y"/>
|
||||
<constraint firstItem="Rjm-Sf-4Mf" firstAttribute="leading" secondItem="iXJ-7c-EQT" secondAttribute="leading" id="SlR-qn-O6e"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Ezm-P5-z5i" secondAttribute="trailing" id="iYy-se-APm"/>
|
||||
<constraint firstItem="Ezm-P5-z5i" firstAttribute="leading" secondItem="iXJ-7c-EQT" secondAttribute="leading" id="oGp-eW-EpJ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Rjm-Sf-4Mf" secondAttribute="trailing" id="w1l-W3-u3j"/>
|
||||
</constraints>
|
||||
</customView>
|
||||
<customView wantsLayer="YES" id="34" userLabel="Sidebar View">
|
||||
<rect key="frame" x="370" y="0.0" width="230" height="530"/>
|
||||
<rect key="frame" x="370" y="0.0" width="230" height="550"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="0Gu-Ck-2Ro">
|
||||
<rect key="frame" x="0.0" y="502" width="230" height="28"/>
|
||||
<rect key="frame" x="0.0" y="522" width="230" height="28"/>
|
||||
<subviews>
|
||||
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="t7l-ac-OCh">
|
||||
<rect key="frame" x="82" y="1" width="65" height="25"/>
|
||||
@ -73,7 +141,7 @@
|
||||
</constraints>
|
||||
</customView>
|
||||
<box title="Horizontal Line" boxType="custom" borderType="none" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="m6c-JX-V3M">
|
||||
<rect key="frame" x="0.0" y="501" width="230" height="1"/>
|
||||
<rect key="frame" x="0.0" y="521" width="230" height="1"/>
|
||||
<view key="contentView" id="JLD-1e-nAg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="230" height="1"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@ -85,10 +153,10 @@
|
||||
<color key="fillColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
</box>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="XSO-vY-vMP" userLabel="Placeholder View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="230" height="501"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="230" height="521"/>
|
||||
<subviews>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="hnD-ep-tH0" userLabel="Dummy View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="230" height="501"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="230" height="521"/>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
@ -127,70 +195,12 @@
|
||||
<outlet property="delegate" destination="-2" id="30X-7D-JZT"/>
|
||||
</connections>
|
||||
</splitView>
|
||||
<customView translatesAutoresizingMaskIntoConstraints="NO" id="Rjm-Sf-4Mf" customClass="CEBorderView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="20"/>
|
||||
<subviews>
|
||||
<imageView hidden="YES" toolTip="This document is read only." horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="EP1-My-tQo">
|
||||
<rect key="frame" x="8" y="2" width="16" height="16"/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="LockedTemplate" id="2Vs-vL-w3p"/>
|
||||
<connections>
|
||||
<binding destination="ZaC-Gi-qyq" name="hidden" keyPath="showsReadOnly" id="1zI-EA-6Kx">
|
||||
<dictionary key="options">
|
||||
<string key="NSValueTransformerName">NSNegateBoolean</string>
|
||||
</dictionary>
|
||||
</binding>
|
||||
</connections>
|
||||
</imageView>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="G7a-2k-nOK">
|
||||
<rect key="frame" x="34" y="3" width="33" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Label" id="b1b-Kr-R8m">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<binding destination="ZaC-Gi-qyq" name="value" keyPath="editorStatus" id="WLy-Pc-sLL"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QO1-yr-imY">
|
||||
<rect key="frame" x="559" y="3" width="33" height="14"/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" allowsUndo="NO" sendsActionOnEndEditing="YES" title="Label" id="W4S-dh-6hG">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<binding destination="ZaC-Gi-qyq" name="value" keyPath="documentStatus" id="K0i-Sk-yYU"/>
|
||||
</connections>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="EP1-My-tQo" firstAttribute="leading" secondItem="Rjm-Sf-4Mf" secondAttribute="leading" constant="8" id="4Pi-na-EuU"/>
|
||||
<constraint firstItem="QO1-yr-imY" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="G7a-2k-nOK" secondAttribute="trailing" constant="8" symbolic="YES" id="5h0-ME-eO2"/>
|
||||
<constraint firstAttribute="trailing" secondItem="QO1-yr-imY" secondAttribute="trailing" constant="10" id="8g0-6j-4iF"/>
|
||||
<constraint firstAttribute="centerY" secondItem="EP1-My-tQo" secondAttribute="centerY" id="McB-rh-aAx"/>
|
||||
<constraint firstItem="G7a-2k-nOK" firstAttribute="leading" secondItem="Rjm-Sf-4Mf" secondAttribute="leading" constant="36" id="T8V-uH-nUh"/>
|
||||
<constraint firstAttribute="height" constant="20" id="rVp-Pk-2Bh"/>
|
||||
<constraint firstAttribute="centerY" secondItem="QO1-yr-imY" secondAttribute="centerY" id="tYP-eB-pNq"/>
|
||||
<constraint firstAttribute="centerY" secondItem="G7a-2k-nOK" secondAttribute="centerY" id="wwt-6v-1Di"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="drawsTopBorder" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="drawsBottomBorder" value="NO"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</customView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="jhv-dr-CH4" secondAttribute="bottom" id="1SA-8i-srX"/>
|
||||
<constraint firstItem="jhv-dr-CH4" firstAttribute="leading" secondItem="6" secondAttribute="leading" id="Ev5-RE-odI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Rjm-Sf-4Mf" secondAttribute="bottom" id="Mte-Of-4Jj"/>
|
||||
<constraint firstItem="Rjm-Sf-4Mf" firstAttribute="leading" secondItem="6" secondAttribute="leading" id="Sph-UK-4Zn"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jhv-dr-CH4" secondAttribute="trailing" id="UJ7-jN-zyi"/>
|
||||
<constraint firstItem="Rjm-Sf-4Mf" firstAttribute="top" secondItem="jhv-dr-CH4" secondAttribute="bottom" id="lGr-Gd-dC9"/>
|
||||
<constraint firstItem="jhv-dr-CH4" firstAttribute="top" secondItem="6" secondAttribute="top" id="ocL-uJ-ACf"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Rjm-Sf-4Mf" secondAttribute="trailing" id="vUa-vZ-EE4"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<toolbar key="toolbar" implicitIdentifier="CED05FB8-D6FA-4FDC-A1D9-8D33CCA40BE5" explicitIdentifier="docWindowToolbarID" displayMode="iconAndLabel" sizeMode="regular" id="olV-v9-4mJ">
|
||||
@ -386,6 +396,7 @@
|
||||
<customObject id="Asc-bK-hKW" customClass="CEEditorWrapper">
|
||||
<connections>
|
||||
<outlet property="splitViewController" destination="cfo-zY-w3h" id="ZU8-hM-dOd"/>
|
||||
<outlet property="statusBarController" destination="ZaC-Gi-qyq" id="0Se-J5-XY1"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<viewController id="ZaC-Gi-qyq" customClass="CEStatusBarController">
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
// readonly
|
||||
@property (readonly, nonatomic, nullable) CETextView *focusedTextView;
|
||||
@property (readonly, nonatomic) BOOL showsStatusBar;
|
||||
@property (readonly, nonatomic) BOOL showsNavigationBar;
|
||||
|
||||
|
||||
@ -54,6 +55,9 @@
|
||||
- (void)markupRanges:(nonnull NSArray<NSValue *> *)ranges;
|
||||
- (void)clearAllMarkup;
|
||||
|
||||
// status bar
|
||||
- (void)setShowsStatusBar:(BOOL)showsStatusBar animate:(BOOL)performAnimation;
|
||||
|
||||
// navigation bar
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar animate:(BOOL)performAnimation;
|
||||
|
||||
@ -66,6 +70,7 @@
|
||||
|
||||
#pragma mark Action Messages
|
||||
|
||||
- (IBAction)toggleStatusBar:(nullable id)sender;
|
||||
- (IBAction)toggleLineNumber:(nullable id)sender;
|
||||
- (IBAction)toggleNavigationBar:(nullable id)sender;
|
||||
- (IBAction)toggleLineWrap:(nullable id)sender;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#import "CEDocument.h"
|
||||
#import "CEDocumentAnalyzer.h"
|
||||
#import "CEIncompatibleCharacterScanner.h"
|
||||
#import "CEStatusBarController.h"
|
||||
#import "CEEditorViewController.h"
|
||||
#import "CESplitViewController.h"
|
||||
#import "CENavigationBarController.h"
|
||||
@ -52,6 +53,7 @@
|
||||
|
||||
@property (nonatomic, nullable) NSWindowController *currentSheetController;
|
||||
|
||||
@property (nonatomic, nullable) IBOutlet CEStatusBarController *statusBarController;
|
||||
@property (nonatomic, nullable) IBOutlet CESplitViewController *splitViewController;
|
||||
|
||||
@end
|
||||
@ -105,6 +107,9 @@
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
[[self window] setNextResponder:self];
|
||||
|
||||
// setup status bar
|
||||
[[self statusBarController] setShown:[[NSUserDefaults standardUserDefaults] boolForKey:CEDefaultShowStatusBarKey] animate:NO];
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +132,10 @@
|
||||
NSInteger state = NSOffState;
|
||||
NSString *title;
|
||||
|
||||
if ([menuItem action] == @selector(toggleLineNumber:)) {
|
||||
if ([menuItem action] == @selector(toggleStatusBar:)) {
|
||||
title = [[self statusBarController] isShown] ? @"Hide Status Bar" : @"Show Status Bar";
|
||||
|
||||
} else if ([menuItem action] == @selector(toggleLineNumber:)) {
|
||||
title = [self showsLineNum] ? @"Hide Line Numbers" : @"Show Line Numbers";
|
||||
|
||||
} else if ([menuItem action] == @selector(toggleNavigationBar:)) {
|
||||
@ -369,6 +377,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
[[self statusBarController] setDocumentAnalyzer:[document analyzer]];
|
||||
|
||||
[[document textStorage] setDelegate:self];
|
||||
[[document syntaxStyle] setDelegate:self];
|
||||
|
||||
@ -437,6 +447,15 @@
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// ナビゲーションバーを表示する/しないをセット
|
||||
- (void)setShowsStatusBar:(BOOL)showsStatusBar animate:(BOOL)performAnimation
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
[[self statusBarController] setShown:showsStatusBar animate:performAnimation];
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// ナビゲーションバーを表示する/しないをセット
|
||||
- (void)setShowsNavigationBar:(BOOL)showsNavigationBar animate:(BOOL)performAnimation
|
||||
@ -539,6 +558,15 @@
|
||||
|
||||
#pragma mark Action Messages
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// toggle visibility of status bar
|
||||
- (IBAction)toggleStatusBar:(nullable id)sender
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
[[self statusBarController] setShown:![[self statusBarController] isShown] animate:YES];
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// 行番号表示をトグルに切り替える
|
||||
- (IBAction)toggleLineNumber:(nullable id)sender
|
||||
|
@ -43,6 +43,5 @@
|
||||
// Action Messages
|
||||
- (IBAction)getInfo:(nullable id)sender;
|
||||
- (IBAction)toggleIncompatibleCharList:(nullable id)sender;
|
||||
- (IBAction)toggleStatusBar:(nullable id)sender;
|
||||
|
||||
@end
|
||||
|
@ -30,7 +30,6 @@
|
||||
#import "CEWindow.h"
|
||||
#import "CEDocument.h"
|
||||
#import "CEToolbarController.h"
|
||||
#import "CEStatusBarController.h"
|
||||
#import "CEIncompatibleCharsViewController.h"
|
||||
#import "CEEditorWrapper.h"
|
||||
#import "CEDocumentAnalyzer.h"
|
||||
@ -52,7 +51,6 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
|
||||
// IBOutlets
|
||||
@property (nonatomic, nullable) IBOutlet CEToolbarController *toolbarController;
|
||||
@property (nonatomic, nullable) IBOutlet CEStatusBarController *statusBarController;
|
||||
@property (nonatomic, nullable) IBOutlet NSViewController *documentInspectorViewController;
|
||||
@property (nonatomic, nullable) IBOutlet CEIncompatibleCharsViewController *incompatibleCharsViewController;
|
||||
@property (nonatomic, nullable, weak) IBOutlet NSSplitView *sidebarSplitView;
|
||||
@ -120,9 +118,6 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
[[[self sidebar] layer] setBackgroundColor:[[NSColor colorWithCalibratedWhite:0.94 alpha:1.0] CGColor]];
|
||||
[self setSidebarShown:[defaults boolForKey:CEDefaultShowDocumentInspectorKey]];
|
||||
|
||||
// setup status bar
|
||||
[[self statusBarController] setShown:[defaults boolForKey:CEDefaultShowStatusBarKey] animate:NO];
|
||||
|
||||
[self applyDocument:[self document]];
|
||||
|
||||
// apply document state to UI
|
||||
@ -136,27 +131,6 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark Protocol
|
||||
|
||||
//=======================================================
|
||||
// NSMenuValidation Protocol
|
||||
//=======================================================
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// validate menu items
|
||||
- (BOOL)validateMenuItem:(nonnull NSMenuItem *)menuItem
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
if ([menuItem action] == @selector(toggleStatusBar:)) {
|
||||
NSString *title = [[self statusBarController] isShown] ? @"Hide Status Bar" : @"Show Status Bar";
|
||||
[menuItem setTitle:NSLocalizedString(title, nil)];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================
|
||||
// NSKeyValueObserving Protocol
|
||||
//=======================================================
|
||||
@ -197,7 +171,7 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
- (void)window:(nonnull NSWindow *)window willEncodeRestorableState:(nonnull NSCoder *)state
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
[state encodeBool:[[self statusBarController] isShown] forKey:CEDefaultShowStatusBarKey];
|
||||
[state encodeBool:[[self editor] showsStatusBar] forKey:CEDefaultShowStatusBarKey];
|
||||
[state encodeBool:[[self editor] showsNavigationBar] forKey:CEDefaultShowNavigationBarKey];
|
||||
[state encodeBool:[[self editor] showsLineNum] forKey:CEDefaultShowLineNumbersKey];
|
||||
[state encodeBool:[[self editor] showsPageGuide] forKey:CEDefaultShowPageGuideKey];
|
||||
@ -214,7 +188,7 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
if ([state containsValueForKey:CEDefaultShowStatusBarKey]) {
|
||||
[[self statusBarController] setShown:[state decodeBoolForKey:CEDefaultShowStatusBarKey] animate:NO];
|
||||
[[self editor] setShowsStatusBar:[state decodeBoolForKey:CEDefaultShowStatusBarKey] animate:NO];
|
||||
}
|
||||
if ([state containsValueForKey:CEDefaultShowNavigationBarKey]) {
|
||||
[[self editor] setShowsNavigationBar:[state decodeBoolForKey:CEDefaultShowNavigationBarKey] animate:NO];
|
||||
@ -283,7 +257,7 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
- (IBAction)getInfo:(nullable id)sender
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
if ([self isDocumentInspectorShown]) {
|
||||
if ([self isSidebarShown] && [self selectedSidebarTag] == CEDocumentInspectorTag) {
|
||||
[self setSidebarShown:NO];
|
||||
} else {
|
||||
[self setSelectedSidebarTag:CEDocumentInspectorTag];
|
||||
@ -306,15 +280,6 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// toggle visibility of status bar
|
||||
- (IBAction)toggleStatusBar:(nullable id)sender
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
[[self statusBarController] setShown:![[self statusBarController] isShown] animate:YES];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark Private Methods
|
||||
|
||||
@ -331,8 +296,15 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
// set document instance to sidebar views
|
||||
[[self incompatibleCharsViewController] setScanner:[document incompatibleCharacterScanner]];
|
||||
[[self documentInspectorViewController] setRepresentedObject:[document analyzer]];
|
||||
|
||||
[[self statusBarController] setDocumentAnalyzer:[document analyzer]];
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// return whether sidebar is opened
|
||||
- (BOOL)isSidebarShown
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
return ![[self sidebarSplitView] isSubviewCollapsed:[self sidebar]];
|
||||
}
|
||||
|
||||
|
||||
@ -375,24 +347,6 @@ typedef NS_ENUM(NSUInteger, CESidebarTag) {
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// return whether sidebar is opened
|
||||
- (BOOL)isSidebarShown
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
return ![[self sidebarSplitView] isSubviewCollapsed:[self sidebar]];
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// return whether document inspector is shown
|
||||
- (BOOL)isDocumentInspectorShown
|
||||
// ------------------------------------------------------
|
||||
{
|
||||
return ([self selectedSidebarTag] == CEDocumentInspectorTag && [self isSidebarShown]);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
/// switch sidebar view
|
||||
- (void)setSelectedSidebarTag:(CESidebarTag)tag
|
||||
|
Loading…
Reference in New Issue
Block a user