2026-02-06 18:59:53 +00:00
|
|
|
|
import SwiftUI
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#if os(macOS)
|
2026-02-06 18:59:53 +00:00
|
|
|
|
import AppKit
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#elseif os(iOS)
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
#endif
|
2026-02-06 18:59:53 +00:00
|
|
|
|
|
|
|
|
|
|
extension ContentView {
|
2026-02-12 09:15:40 +00:00
|
|
|
|
private var compactActiveProviderName: String {
|
|
|
|
|
|
activeProviderName.components(separatedBy: " (").first ?? activeProviderName
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#if os(iOS)
|
|
|
|
|
|
private var isIPadToolbarLayout: Bool {
|
|
|
|
|
|
UIDevice.current.userInterfaceIdiom == .pad && horizontalSizeClass == .regular
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private var iPadToolbarMaxWidth: CGFloat {
|
|
|
|
|
|
let screenWidth = UIApplication.shared.connectedScenes
|
|
|
|
|
|
.compactMap { $0 as? UIWindowScene }
|
|
|
|
|
|
.first(where: { $0.activationState == .foregroundActive })?
|
|
|
|
|
|
.screen.bounds.width ?? 1024
|
|
|
|
|
|
let target = screenWidth * 0.72
|
|
|
|
|
|
return min(max(target, 560), 980)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private var iPadPromotedActionsCount: Int {
|
|
|
|
|
|
switch iPadToolbarMaxWidth {
|
|
|
|
|
|
case 920...: return 7
|
|
|
|
|
|
case 840...: return 6
|
|
|
|
|
|
case 760...: return 5
|
|
|
|
|
|
case 680...: return 4
|
|
|
|
|
|
case 620...: return 3
|
|
|
|
|
|
default: return 2
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-07 18:46:08 +00:00
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var newTabControl: some View {
|
|
|
|
|
|
Button(action: { viewModel.addNewTab() }) {
|
|
|
|
|
|
Image(systemName: "plus.square.on.square")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("New Tab (Cmd+T)")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var settingsControl: some View {
|
|
|
|
|
|
Button(action: { showSettingsSheet = true }) {
|
|
|
|
|
|
Image(systemName: "gearshape")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Settings (Cmd+,)")
|
2026-02-07 18:46:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-07 10:51:52 +00:00
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var languagePickerControl: some View {
|
2026-02-09 10:21:50 +00:00
|
|
|
|
Picker("Language", selection: currentLanguagePickerBinding) {
|
|
|
|
|
|
ForEach(["swift", "python", "javascript", "typescript", "php", "java", "kotlin", "go", "ruby", "rust", "cobol", "dotenv", "proto", "graphql", "rst", "nginx", "sql", "html", "css", "c", "cpp", "csharp", "objective-c", "json", "xml", "yaml", "toml", "csv", "ini", "vim", "log", "ipynb", "markdown", "bash", "zsh", "powershell", "standard", "plain"], id: \.self) { lang in
|
2026-02-07 10:51:52 +00:00
|
|
|
|
let label: String = {
|
|
|
|
|
|
switch lang {
|
2026-02-07 23:20:47 +00:00
|
|
|
|
case "php": return "PHP"
|
2026-02-08 22:41:39 +00:00
|
|
|
|
case "cobol": return "COBOL"
|
|
|
|
|
|
case "dotenv": return "Dotenv"
|
|
|
|
|
|
case "proto": return "Proto"
|
|
|
|
|
|
case "graphql": return "GraphQL"
|
|
|
|
|
|
case "rst": return "reStructuredText"
|
|
|
|
|
|
case "nginx": return "Nginx"
|
2026-02-07 10:51:52 +00:00
|
|
|
|
case "objective-c": return "Objective-C"
|
|
|
|
|
|
case "csharp": return "C#"
|
2026-02-09 10:21:50 +00:00
|
|
|
|
case "c": return "C"
|
2026-02-07 10:51:52 +00:00
|
|
|
|
case "cpp": return "C++"
|
|
|
|
|
|
case "json": return "JSON"
|
|
|
|
|
|
case "xml": return "XML"
|
|
|
|
|
|
case "yaml": return "YAML"
|
|
|
|
|
|
case "toml": return "TOML"
|
2026-02-07 23:20:47 +00:00
|
|
|
|
case "csv": return "CSV"
|
2026-02-07 10:51:52 +00:00
|
|
|
|
case "ini": return "INI"
|
|
|
|
|
|
case "sql": return "SQL"
|
2026-02-08 11:14:49 +00:00
|
|
|
|
case "vim": return "Vim"
|
|
|
|
|
|
case "log": return "Log"
|
|
|
|
|
|
case "ipynb": return "Jupyter Notebook"
|
2026-02-07 10:51:52 +00:00
|
|
|
|
case "html": return "HTML"
|
|
|
|
|
|
case "css": return "CSS"
|
|
|
|
|
|
case "standard": return "Standard"
|
|
|
|
|
|
default: return lang.capitalized
|
|
|
|
|
|
}
|
|
|
|
|
|
}()
|
|
|
|
|
|
Text(label).tag(lang)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.labelsHidden()
|
|
|
|
|
|
.help("Language")
|
|
|
|
|
|
.frame(width: isIPadToolbarLayout ? 160 : 120)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var activeProviderBadgeControl: some View {
|
2026-02-12 09:15:40 +00:00
|
|
|
|
Text(compactActiveProviderName)
|
2026-02-07 10:51:52 +00:00
|
|
|
|
.font(.caption)
|
|
|
|
|
|
.foregroundColor(.secondary)
|
2026-02-12 09:15:40 +00:00
|
|
|
|
.lineLimit(1)
|
|
|
|
|
|
.truncationMode(.tail)
|
|
|
|
|
|
.minimumScaleFactor(0.9)
|
|
|
|
|
|
.fixedSize(horizontal: true, vertical: false)
|
2026-02-07 10:51:52 +00:00
|
|
|
|
.padding(.horizontal, 6)
|
|
|
|
|
|
.padding(.vertical, 2)
|
|
|
|
|
|
.background(Color.secondary.opacity(0.12), in: Capsule())
|
|
|
|
|
|
.help("Active provider")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var clearEditorControl: some View {
|
|
|
|
|
|
Button(action: {
|
2026-02-12 22:20:39 +00:00
|
|
|
|
requestClearEditorContent()
|
2026-02-07 10:51:52 +00:00
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "trash")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Clear Editor")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-09 10:21:50 +00:00
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var insertTemplateControl: some View {
|
|
|
|
|
|
Button(action: { insertTemplateForCurrentLanguage() }) {
|
|
|
|
|
|
Image(systemName: "doc.badge.plus")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Insert Template for Current Language")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-07 10:51:52 +00:00
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var openFileControl: some View {
|
|
|
|
|
|
Button(action: { openFileFromToolbar() }) {
|
|
|
|
|
|
Image(systemName: "folder")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Open File… (Cmd+O)")
|
2026-02-07 10:51:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var saveFileControl: some View {
|
|
|
|
|
|
Button(action: { saveCurrentTabFromToolbar() }) {
|
|
|
|
|
|
Image(systemName: "square.and.arrow.down")
|
|
|
|
|
|
}
|
|
|
|
|
|
.disabled(viewModel.selectedTab == nil)
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Save File (Cmd+S)")
|
2026-02-07 10:51:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var toggleSidebarControl: some View {
|
|
|
|
|
|
Button(action: { toggleSidebarFromToolbar() }) {
|
|
|
|
|
|
Image(systemName: "sidebar.left")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Toggle Sidebar (Cmd+Opt+S)")
|
2026-02-07 10:51:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var toggleProjectSidebarControl: some View {
|
|
|
|
|
|
Button(action: { showProjectStructureSidebar.toggle() }) {
|
|
|
|
|
|
Image(systemName: "sidebar.right")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Toggle Project Structure Sidebar")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var findReplaceControl: some View {
|
|
|
|
|
|
Button(action: { showFindReplace = true }) {
|
|
|
|
|
|
Image(systemName: "magnifyingglass")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Find & Replace (Cmd+F)")
|
2026-02-07 10:51:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var iPadPromotedActions: some View {
|
|
|
|
|
|
if iPadPromotedActionsCount >= 1 { openFileControl }
|
|
|
|
|
|
if iPadPromotedActionsCount >= 2 { saveFileControl }
|
|
|
|
|
|
if iPadPromotedActionsCount >= 3 { toggleSidebarControl }
|
|
|
|
|
|
if iPadPromotedActionsCount >= 4 { toggleProjectSidebarControl }
|
|
|
|
|
|
if iPadPromotedActionsCount >= 5 { findReplaceControl }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var moreActionsControl: some View {
|
|
|
|
|
|
Menu {
|
2026-02-09 10:21:50 +00:00
|
|
|
|
Button(action: { insertTemplateForCurrentLanguage() }) {
|
|
|
|
|
|
Label("Insert Template", systemImage: "doc.badge.plus")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-07 10:51:52 +00:00
|
|
|
|
Button(action: { openFileFromToolbar() }) {
|
|
|
|
|
|
Label("Open File…", systemImage: "folder")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: { saveCurrentTabFromToolbar() }) {
|
|
|
|
|
|
Label("Save File", systemImage: "square.and.arrow.down")
|
|
|
|
|
|
}
|
|
|
|
|
|
.disabled(viewModel.selectedTab == nil)
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: { toggleSidebarFromToolbar() }) {
|
|
|
|
|
|
Label("Toggle Sidebar", systemImage: "sidebar.left")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: { showProjectStructureSidebar.toggle() }) {
|
|
|
|
|
|
Label("Toggle Project Structure Sidebar", systemImage: "sidebar.right")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: { showFindReplace = true }) {
|
|
|
|
|
|
Label("Find & Replace", systemImage: "magnifyingglass")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
|
|
viewModel.isBrainDumpMode.toggle()
|
|
|
|
|
|
UserDefaults.standard.set(viewModel.isBrainDumpMode, forKey: "BrainDumpModeEnabled")
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Label("Brain Dump Mode", systemImage: "note.text")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
|
|
enableTranslucentWindow.toggle()
|
|
|
|
|
|
UserDefaults.standard.set(enableTranslucentWindow, forKey: "EnableTranslucentWindow")
|
|
|
|
|
|
NotificationCenter.default.post(name: .toggleTranslucencyRequested, object: enableTranslucentWindow)
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Label("Translucent Window Background", systemImage: enableTranslucentWindow ? "rectangle.fill" : "rectangle")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} label: {
|
|
|
|
|
|
Image(systemName: "ellipsis.circle")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("More Actions")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var iOSToolbarControls: some View {
|
|
|
|
|
|
languagePickerControl
|
2026-02-07 18:46:08 +00:00
|
|
|
|
newTabControl
|
2026-02-07 10:51:52 +00:00
|
|
|
|
activeProviderBadgeControl
|
|
|
|
|
|
clearEditorControl
|
2026-02-11 10:20:17 +00:00
|
|
|
|
settingsControl
|
2026-02-07 10:51:52 +00:00
|
|
|
|
moreActionsControl
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
|
|
private var iPadDistributedToolbarControls: some View {
|
2026-02-09 19:49:55 +00:00
|
|
|
|
activeProviderBadgeControl
|
2026-02-07 10:51:52 +00:00
|
|
|
|
languagePickerControl
|
2026-02-07 18:46:08 +00:00
|
|
|
|
newTabControl
|
2026-02-07 10:51:52 +00:00
|
|
|
|
Spacer(minLength: 18)
|
|
|
|
|
|
iPadPromotedActions
|
|
|
|
|
|
Spacer(minLength: 18)
|
|
|
|
|
|
clearEditorControl
|
2026-02-11 10:20:17 +00:00
|
|
|
|
settingsControl
|
2026-02-07 10:51:52 +00:00
|
|
|
|
moreActionsControl
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
#if os(macOS)
|
|
|
|
|
|
private func openSettingsWindow() {
|
|
|
|
|
|
if !NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil) {
|
|
|
|
|
|
_ = NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
2026-02-06 18:59:53 +00:00
|
|
|
|
@ToolbarContentBuilder
|
|
|
|
|
|
var editorToolbarContent: some ToolbarContent {
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#if os(iOS)
|
|
|
|
|
|
ToolbarItemGroup(placement: .topBarTrailing) {
|
|
|
|
|
|
HStack(spacing: 14) {
|
|
|
|
|
|
if isIPadToolbarLayout {
|
|
|
|
|
|
iPadDistributedToolbarControls
|
|
|
|
|
|
} else {
|
|
|
|
|
|
iOSToolbarControls
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.frame(maxWidth: isIPadToolbarLayout ? iPadToolbarMaxWidth : .infinity, alignment: .trailing)
|
|
|
|
|
|
}
|
|
|
|
|
|
#else
|
2026-02-06 18:59:53 +00:00
|
|
|
|
ToolbarItemGroup(placement: .automatic) {
|
2026-02-09 10:21:50 +00:00
|
|
|
|
Picker("Language", selection: currentLanguagePickerBinding) {
|
|
|
|
|
|
ForEach(["swift", "python", "javascript", "typescript", "php", "java", "kotlin", "go", "ruby", "rust", "cobol", "dotenv", "proto", "graphql", "rst", "nginx", "sql", "html", "css", "c", "cpp", "csharp", "objective-c", "json", "xml", "yaml", "toml", "csv", "ini", "vim", "log", "ipynb", "markdown", "bash", "zsh", "powershell", "standard", "plain"], id: \.self) { lang in
|
2026-02-06 18:59:53 +00:00
|
|
|
|
let label: String = {
|
|
|
|
|
|
switch lang {
|
2026-02-07 23:20:47 +00:00
|
|
|
|
case "php": return "PHP"
|
2026-02-08 22:41:39 +00:00
|
|
|
|
case "cobol": return "COBOL"
|
|
|
|
|
|
case "dotenv": return "Dotenv"
|
|
|
|
|
|
case "proto": return "Proto"
|
|
|
|
|
|
case "graphql": return "GraphQL"
|
|
|
|
|
|
case "rst": return "reStructuredText"
|
|
|
|
|
|
case "nginx": return "Nginx"
|
2026-02-06 18:59:53 +00:00
|
|
|
|
case "objective-c": return "Objective‑C"
|
|
|
|
|
|
case "csharp": return "C#"
|
2026-02-09 10:21:50 +00:00
|
|
|
|
case "c": return "C"
|
2026-02-06 18:59:53 +00:00
|
|
|
|
case "cpp": return "C++"
|
|
|
|
|
|
case "json": return "JSON"
|
|
|
|
|
|
case "xml": return "XML"
|
|
|
|
|
|
case "yaml": return "YAML"
|
|
|
|
|
|
case "toml": return "TOML"
|
2026-02-07 23:20:47 +00:00
|
|
|
|
case "csv": return "CSV"
|
2026-02-06 18:59:53 +00:00
|
|
|
|
case "ini": return "INI"
|
|
|
|
|
|
case "sql": return "SQL"
|
2026-02-08 11:14:49 +00:00
|
|
|
|
case "vim": return "Vim"
|
|
|
|
|
|
case "log": return "Log"
|
|
|
|
|
|
case "ipynb": return "Jupyter Notebook"
|
2026-02-06 18:59:53 +00:00
|
|
|
|
case "html": return "HTML"
|
|
|
|
|
|
case "css": return "CSS"
|
|
|
|
|
|
case "standard": return "Standard"
|
|
|
|
|
|
default: return lang.capitalized
|
|
|
|
|
|
}
|
|
|
|
|
|
}()
|
|
|
|
|
|
Text(label).tag(lang)
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
.labelsHidden()
|
|
|
|
|
|
.help("Language")
|
|
|
|
|
|
.controlSize(.large)
|
|
|
|
|
|
.frame(width: 140)
|
|
|
|
|
|
.padding(.vertical, 2)
|
|
|
|
|
|
|
2026-02-12 09:15:40 +00:00
|
|
|
|
Text(compactActiveProviderName)
|
2026-02-06 18:59:53 +00:00
|
|
|
|
.font(.caption)
|
|
|
|
|
|
.foregroundColor(.secondary)
|
2026-02-12 09:15:40 +00:00
|
|
|
|
.lineLimit(1)
|
|
|
|
|
|
.truncationMode(.tail)
|
|
|
|
|
|
.minimumScaleFactor(0.9)
|
|
|
|
|
|
.fixedSize(horizontal: true, vertical: false)
|
2026-02-06 18:59:53 +00:00
|
|
|
|
.padding(.horizontal, 6)
|
|
|
|
|
|
.padding(.vertical, 2)
|
|
|
|
|
|
.background(Color.secondary.opacity(0.12), in: Capsule())
|
|
|
|
|
|
.help("Active provider")
|
|
|
|
|
|
|
2026-02-11 10:20:17 +00:00
|
|
|
|
Button(action: {
|
|
|
|
|
|
openSettings()
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "gearshape")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Settings")
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: { adjustEditorFontSize(-1) }) {
|
|
|
|
|
|
Image(systemName: "textformat.size.smaller")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Decrease Font Size")
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: { adjustEditorFontSize(1) }) {
|
|
|
|
|
|
Image(systemName: "textformat.size.larger")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Increase Font Size")
|
|
|
|
|
|
|
2026-02-06 18:59:53 +00:00
|
|
|
|
Button(action: {
|
2026-02-12 22:20:39 +00:00
|
|
|
|
requestClearEditorContent()
|
2026-02-06 18:59:53 +00:00
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "trash")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Clear Editor")
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
2026-02-09 10:21:50 +00:00
|
|
|
|
insertTemplateForCurrentLanguage()
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "doc.badge.plus")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Insert Template for Current Language")
|
|
|
|
|
|
|
2026-02-07 10:51:52 +00:00
|
|
|
|
Button(action: { openFileFromToolbar() }) {
|
2026-02-06 18:59:53 +00:00
|
|
|
|
Image(systemName: "folder")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Open File… (Cmd+O)")
|
2026-02-06 18:59:53 +00:00
|
|
|
|
|
2026-02-07 18:46:08 +00:00
|
|
|
|
Button(action: { viewModel.addNewTab() }) {
|
|
|
|
|
|
Image(systemName: "plus.square.on.square")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("New Tab (Cmd+T)")
|
2026-02-07 18:46:08 +00:00
|
|
|
|
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#if os(macOS)
|
2026-02-06 18:59:53 +00:00
|
|
|
|
Button(action: {
|
|
|
|
|
|
openWindow(id: "blank-window")
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "macwindow.badge.plus")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("New Window (Cmd+N)")
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#endif
|
2026-02-06 18:59:53 +00:00
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
2026-02-07 10:51:52 +00:00
|
|
|
|
saveCurrentTabFromToolbar()
|
2026-02-06 18:59:53 +00:00
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "square.and.arrow.down")
|
|
|
|
|
|
}
|
|
|
|
|
|
.disabled(viewModel.selectedTab == nil)
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Save File (Cmd+S)")
|
2026-02-06 18:59:53 +00:00
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
2026-02-07 10:51:52 +00:00
|
|
|
|
toggleSidebarFromToolbar()
|
2026-02-06 18:59:53 +00:00
|
|
|
|
}) {
|
2026-02-06 19:20:03 +00:00
|
|
|
|
Image(systemName: "sidebar.left")
|
|
|
|
|
|
.symbolVariant(viewModel.showSidebar ? .fill : .none)
|
2026-02-06 18:59:53 +00:00
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Toggle Sidebar (Cmd+Opt+S)")
|
2026-02-06 18:59:53 +00:00
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
|
|
showProjectStructureSidebar.toggle()
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "sidebar.right")
|
|
|
|
|
|
.symbolVariant(showProjectStructureSidebar ? .fill : .none)
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Toggle Project Structure Sidebar")
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
|
|
showFindReplace = true
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: "magnifyingglass")
|
|
|
|
|
|
}
|
2026-02-11 10:20:17 +00:00
|
|
|
|
.help("Find & Replace (Cmd+F)")
|
2026-02-06 18:59:53 +00:00
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
|
|
viewModel.isBrainDumpMode.toggle()
|
|
|
|
|
|
UserDefaults.standard.set(viewModel.isBrainDumpMode, forKey: "BrainDumpModeEnabled")
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: viewModel.isBrainDumpMode ? "note.text" : "note.text")
|
|
|
|
|
|
.symbolVariant(viewModel.isBrainDumpMode ? .fill : .none)
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Brain Dump Mode")
|
|
|
|
|
|
.accessibilityLabel("Brain Dump Mode")
|
|
|
|
|
|
|
|
|
|
|
|
Button(action: {
|
|
|
|
|
|
enableTranslucentWindow.toggle()
|
|
|
|
|
|
UserDefaults.standard.set(enableTranslucentWindow, forKey: "EnableTranslucentWindow")
|
|
|
|
|
|
NotificationCenter.default.post(name: .toggleTranslucencyRequested, object: enableTranslucentWindow)
|
|
|
|
|
|
}) {
|
|
|
|
|
|
Image(systemName: enableTranslucentWindow ? "rectangle.fill" : "rectangle")
|
|
|
|
|
|
}
|
|
|
|
|
|
.help("Toggle Translucent Window Background")
|
|
|
|
|
|
.accessibilityLabel("Translucent Window Background")
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2026-02-07 10:51:52 +00:00
|
|
|
|
#endif
|
2026-02-06 18:59:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|