mirror of
https://github.com/coteditor/CotEditor.git
synced 2024-09-11 11:25:57 +03:00
Remove .copy(_:) mode in syntax edit view
This commit is contained in:
parent
1d382fe584
commit
22984b748e
@ -24,6 +24,7 @@ Change Log
|
||||
- [trivial] Migrate the Opacity toolbar item to popover in macOS 14.
|
||||
- [trivial] Disable the contextual menu for shortcut fields.
|
||||
- [trivial] Reduce the maximum number to split editor.
|
||||
- [trivial] Change the behavior of the duplication command for syntax definitions to just create a duplicated syntax instead of opening the syntax editor dialog.
|
||||
- [trivial] Rename “syntax style” with just “syntax.”
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="22146" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="Lgm-sL-YIF">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="22152" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="Lgm-sL-YIF">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22146"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22152"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@ -280,7 +280,7 @@
|
||||
<menu key="menu" id="AYn-mG-LBH">
|
||||
<items>
|
||||
<menuItem title="Syntax Action" state="on" image="NSActionTemplate" hidden="YES" id="sRJ-x0-fo7"/>
|
||||
<menuItem title="Duplicate…" id="A7t-Ca-nZi">
|
||||
<menuItem title="Duplicate" id="A7t-Ca-nZi">
|
||||
<connections>
|
||||
<action selector="duplicateSyntax:" target="Lgm-sL-YIF" id="IEZ-CW-Pf6"/>
|
||||
</connections>
|
||||
@ -469,7 +469,7 @@
|
||||
<action selector="editSyntax:" target="Lgm-sL-YIF" id="rA0-nQ-INP"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Duplicate…" id="5oN-VC-ot9">
|
||||
<menuItem title="Duplicate" id="5oN-VC-ot9">
|
||||
<connections>
|
||||
<action selector="duplicateSyntax:" target="Lgm-sL-YIF" id="G55-lb-Aef"/>
|
||||
</connections>
|
||||
@ -507,6 +507,11 @@
|
||||
<point key="canvasLocation" x="0.0" y="0.0"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<designables>
|
||||
<designable name="cbJ-XK-bnG">
|
||||
<size key="intrinsicContentSize" width="16" height="16"/>
|
||||
</designable>
|
||||
</designables>
|
||||
<resources>
|
||||
<image name="NSActionTemplate" width="20" height="20"/>
|
||||
<image name="NSAddTemplate" width="18" height="17"/>
|
||||
|
@ -116,7 +116,7 @@ final class FormatPaneController: NSViewController, NSMenuItemValidation, NSTabl
|
||||
|
||||
case #selector(duplicateSyntax(_:)):
|
||||
if let name = representedSettingName, !isContextualMenu {
|
||||
menuItem.title = String(localized: "Duplicate “\(name)”…")
|
||||
menuItem.title = String(localized: "Duplicate “\(name)”")
|
||||
}
|
||||
menuItem.isHidden = !itemSelected
|
||||
|
||||
@ -347,13 +347,19 @@ final class FormatPaneController: NSViewController, NSMenuItemValidation, NSTabl
|
||||
}
|
||||
|
||||
|
||||
/// show syntax edit sheet in copy mode
|
||||
/// duplicate selected syntax.
|
||||
@IBAction func duplicateSyntax(_ sender: Any?) {
|
||||
|
||||
let syntaxName = self.targetSyntaxName(for: sender)
|
||||
let state = SyntaxManager.shared.state(of: syntaxName)!
|
||||
let baseName = self.targetSyntaxName(for: sender)
|
||||
let settingName: String
|
||||
do {
|
||||
settingName = try SyntaxManager.shared.duplicateSetting(name: baseName)
|
||||
} catch {
|
||||
self.presentError(error)
|
||||
return
|
||||
}
|
||||
|
||||
self.presentSyntaxEditor(mode: .copy(state))
|
||||
self.updateSyntaxList(bySelecting: settingName)
|
||||
}
|
||||
|
||||
|
||||
@ -596,7 +602,7 @@ final class FormatPaneController: NSViewController, NSMenuItemValidation, NSTabl
|
||||
}
|
||||
|
||||
|
||||
/// Present the sytnax edit sheet.
|
||||
/// Present the syntax edit sheet.
|
||||
///
|
||||
/// - Parameter mode: The edit mode.
|
||||
private func presentSyntaxEditor(mode: SyntaxEditViewController.Mode) {
|
||||
@ -607,4 +613,22 @@ final class FormatPaneController: NSViewController, NSMenuItemValidation, NSTabl
|
||||
|
||||
self.presentAsSheet(viewController)
|
||||
}
|
||||
|
||||
|
||||
/// Update the syntax table and select the desired item.
|
||||
///
|
||||
/// - Parameter selectingName: The syntax name to select.
|
||||
private func updateSyntaxList(bySelecting selectingName: String) {
|
||||
|
||||
self.syntaxNames = SyntaxManager.shared.settingNames
|
||||
|
||||
guard
|
||||
let tableView = self.syntaxTableView,
|
||||
let row = self.syntaxNames.firstIndex(of: selectingName)
|
||||
else { return assertionFailure() }
|
||||
|
||||
tableView.reloadData()
|
||||
tableView.selectRowIndexes([row], byExtendingSelection: false)
|
||||
tableView.scrollRowToVisible(row)
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ final class SyntaxEditViewController: NSViewController, NSTextFieldDelegate, NST
|
||||
enum Mode {
|
||||
|
||||
case edit(_ state: SettingState)
|
||||
case copy(_ state: SettingState)
|
||||
case new
|
||||
}
|
||||
|
||||
@ -71,7 +70,7 @@ final class SyntaxEditViewController: NSViewController, NSTextFieldDelegate, NST
|
||||
let manager = SyntaxManager.shared
|
||||
|
||||
let syntax: SyntaxManager.SyntaxDictionary = switch mode {
|
||||
case .edit(let state), .copy(let state):
|
||||
case .edit(let state):
|
||||
manager.settingDictionary(name: state.name) ?? manager.blankSettingDictionary
|
||||
case .new:
|
||||
manager.blankSettingDictionary
|
||||
@ -82,7 +81,7 @@ final class SyntaxEditViewController: NSViewController, NSTextFieldDelegate, NST
|
||||
case .edit(let state):
|
||||
self.isBundledSyntax = state.isBundled
|
||||
self.isRestorable = state.isRestorable
|
||||
case .copy, .new:
|
||||
case .new:
|
||||
self.isBundledSyntax = false
|
||||
self.isRestorable = false
|
||||
}
|
||||
@ -128,7 +127,6 @@ final class SyntaxEditViewController: NSViewController, NSTextFieldDelegate, NST
|
||||
// setup syntax name field
|
||||
syntaxNameField.stringValue = switch self.mode {
|
||||
case .edit(let state): state.name
|
||||
case .copy(let state): SyntaxManager.shared.savableSettingName(for: state.name, appendingCopySuffix: true)
|
||||
case .new: ""
|
||||
}
|
||||
if self.isBundledSyntax {
|
||||
|
@ -77,8 +77,8 @@
|
||||
/* contextual menu */
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "Bearbeiten …";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplizieren …";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplizieren";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "Zurücksetzen";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "„%@“ duplizieren …";
|
||||
"Duplicate “%@”" = "„%@“ duplizieren";
|
||||
"Export “%@”…" = "„%@“ exportieren …";
|
||||
"Reveal “%@” in Finder" = "„%@“ im Finder anzeigen";
|
||||
|
||||
|
@ -77,8 +77,8 @@
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "Edit…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplicate…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplicate";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "Restore";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "Duplicate “%@”…";
|
||||
"Duplicate “%@”" = "Duplicate “%@”";
|
||||
"Export “%@”…" = "Export “%@”…";
|
||||
"Reveal “%@” in Finder" = "Reveal “%@” in Finder";
|
||||
|
||||
|
@ -79,8 +79,8 @@
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "Editar…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplicar…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplicar";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "3aD-Fv-G8H"; */
|
||||
"3aD-Fv-G8H.title" = "Restaurar";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "Duplicar “%@”…";
|
||||
"Duplicate “%@”" = "Duplicar “%@”";
|
||||
"Export “%@”…" = "Exportar “%@”…";
|
||||
"Reveal “%@” in Finder" = "Mostrar “%@” en el Finder";
|
||||
|
||||
|
@ -76,8 +76,8 @@
|
||||
/* contextual menu */
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "Editer…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Dupliquer…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Dupliquer";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "Restaurer…";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "Duplication de « %@ »…";
|
||||
"Duplicate “%@”" = "Duplication de « %@ »";
|
||||
"Export “%@”…" = "Export de « %@ »…";
|
||||
"Reveal “%@” in Finder" = "Afficher « %@ » dans le Finder";
|
||||
|
||||
|
@ -77,8 +77,8 @@
|
||||
/* contextual menu */
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "Modifica…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplica…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplica";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "Ripristina";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "Duplica “%@”…";
|
||||
"Duplicate “%@”" = "Duplica “%@”";
|
||||
"Export “%@”…" = "Esporta “%@”…";
|
||||
"Reveal “%@” in Finder" = "Mostra “%@” nel Finder";
|
||||
|
||||
|
@ -77,8 +77,8 @@
|
||||
/* contextual menu */
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "編集…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "複製…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "複製";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "元に戻す";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "“%@”を複製…";
|
||||
"Duplicate “%@”" = "“%@”を複製";
|
||||
"Export “%@”…" = "“%@”を書き出す…";
|
||||
"Reveal “%@” in Finder" = "“%@”をFinderに表示";
|
||||
|
||||
|
@ -76,8 +76,8 @@
|
||||
/* contextual menu */
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "Editar…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplicar…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Duplicar";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "Restaurar";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "Duplicar “%@”…";
|
||||
"Duplicate “%@”" = "Duplicar “%@”";
|
||||
"Export “%@”…" = "Exportar “%@”…";
|
||||
"Reveal “%@” in Finder" = "Mostrar “%@” no Finder";
|
||||
|
||||
|
@ -77,8 +77,8 @@
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "Düzenle…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Çoğalt…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "Çoğalt";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "Geri Yükle";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "“%@” Ögesini Çoğalt";
|
||||
"Duplicate “%@”" = "“%@” Ögesini Çoğalt";
|
||||
"Export “%@”…" = "“%@” Ögesini Dışa Aktar";
|
||||
"Reveal “%@” in Finder" = "“%@” Ögesini Finder’da Göster";
|
||||
|
||||
|
@ -76,8 +76,8 @@
|
||||
/* contextual menu */
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "编辑…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "拷贝…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "拷贝";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "还原";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "拷贝“%@”…";
|
||||
"Duplicate “%@”" = "拷贝“%@”";
|
||||
"Export “%@”…" = "导出“%@”…";
|
||||
"Reveal “%@” in Finder" = "在访达中显示“%@”";
|
||||
|
||||
|
@ -76,8 +76,8 @@
|
||||
/* contextual menu */
|
||||
/* Class = "NSMenuItem"; title = "Edit…"; ObjectID = "371-P0-KPK"; */
|
||||
"371-P0-KPK.title" = "編輯…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate…"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "複製…";
|
||||
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "5oN-VC-ot9"; */
|
||||
"5oN-VC-ot9.title" = "複製";
|
||||
/* Class = "NSMenuItem"; title = "Restore"; ObjectID = "Zox-Ve-mru"; */
|
||||
"Zox-Ve-mru.title" = "還原";
|
||||
/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "NDE-r5-xAF"; */
|
||||
|
@ -652,7 +652,7 @@
|
||||
|
||||
// Format pane
|
||||
// Installed syntaxes action menu items
|
||||
"Duplicate “%@”…" = "拷貝「%@」…";
|
||||
"Duplicate “%@”" = "拷貝「%@」";
|
||||
"Export “%@”…" = "導出「%@」…";
|
||||
"Reveal “%@” in Finder" = "在訪達中顯示「%@」";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user