diff --git a/TextChatTranslator/AppDelegate.swift b/TextChatTranslator/AppDelegate.swift index 1006cf7..f3955dd 100644 --- a/TextChatTranslator/AppDelegate.swift +++ b/TextChatTranslator/AppDelegate.swift @@ -134,7 +134,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation { private func openSettings() { let openSettings = OpenSettings() openSettings.openSettings() - NSApp.activate() + NSApp.activate(ignoringOtherApps: true) } #endif diff --git a/TextChatTranslator/Localizable.xcstrings b/TextChatTranslator/Localizable.xcstrings index ab9fbda..10b5ed0 100644 --- a/TextChatTranslator/Localizable.xcstrings +++ b/TextChatTranslator/Localizable.xcstrings @@ -1,6 +1,18 @@ { "sourceLanguage" : "en", "strings" : { + "%lld pt" : { + + }, + "Background Color:" : { + + }, + "Font Size:" : { + + }, + "Install Translation" : { + + }, "Quit Text Chat Translator" : { "localizations" : { "ja" : { @@ -13,6 +25,9 @@ }, "Settingsā€¦" : { + }, + "Source Language:" : { + }, "Start Translation" : { "localizations" : { @@ -33,6 +48,12 @@ } } } + }, + "Target Language:" : { + + }, + "Text Color:" : { + } }, "version" : "1.0" diff --git a/TextChatTranslator/OverlayWindow.swift b/TextChatTranslator/OverlayWindow.swift index f5fdd01..c6ab47a 100644 --- a/TextChatTranslator/OverlayWindow.swift +++ b/TextChatTranslator/OverlayWindow.swift @@ -85,15 +85,18 @@ fileprivate class OverlayContentView: NSView { @AppStorage("backgroundColor") private var backgroundColor = Color.white @AppStorage("textColor") private var textColor = Color.black + @AppStorage("fontSize" )private var fontSize = 16 private let textLabel = NSTextField(wrappingLabelWithString: "") - private let defaultFont: NSFont = .systemFont(ofSize: 16) var leadingMargin: CGFloat = 0 { didSet { leadingConstraint?.constant = leadingMargin } } private var leadingConstraint: NSLayoutConstraint? + private var preferredFont: NSFont { + NSFont.systemFont(ofSize: CGFloat(fontSize)) + } override init(frame frameRect: NSRect) { super.init(frame: frameRect) @@ -117,7 +120,7 @@ fileprivate class OverlayContentView: NSView { textLabel.translatesAutoresizingMaskIntoConstraints = true containerView.addSubview(textLabel) - textLabel.font = defaultFont + textLabel.font = preferredFont textLabel.textColor = NSColor(textColor) textLabel.backgroundColor = .clear textLabel.drawsBackground = false @@ -137,7 +140,7 @@ fileprivate class OverlayContentView: NSView { containerSize.width -= leadingMargin containerSize.height = .greatestFiniteMagnitude - var font = defaultFont + var font = preferredFont var fontSize = font.pointSize var boundingRect: CGRect = .infinite diff --git a/TextChatTranslator/SettingsView.swift b/TextChatTranslator/SettingsView.swift index f8b26b9..cfcb13e 100644 --- a/TextChatTranslator/SettingsView.swift +++ b/TextChatTranslator/SettingsView.swift @@ -13,6 +13,7 @@ struct SettingsView: View { struct TranslationSettingsView: View { @AppStorage("backgroundColor") private var backgroundColor = Color.white @AppStorage("textColor" )private var textColor = Color.black + @AppStorage("fontSize" )private var fontSize = 16 @AppStorage("sourceLanguage") private var sourceLanguage = "en-Latn-US" @AppStorage("targetLanguage") private var targetLanguage = "ja-Jpan-JP" @@ -27,6 +28,12 @@ struct TranslationSettingsView: View { Form { ColorPicker("Background Color:", selection: $backgroundColor) ColorPicker("Text Color:", selection: $textColor) + Picker("Font Size:", selection: $fontSize) { + ForEach([4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26, 28, 30, 32, 34, 36, 40, 44], id: \.self) { (size) in + Text("\(size) pt") + .tag(size) + } + } Divider() .padding(.vertical)