fix: correctly display right-to-left languages
This commit is contained in:
1 parent
37d8c98503
commit
89f2df4fe5
5 files changed
+9
-11
No files matched your search
@@ -28,20 +28,18 @@ class FeedbackWindow: NSWindow {
|
||||
private func setupView() {
|
||||
let appIcon = NSImageView(image: NSImage(named: "app-icon")!.resizedCopy(80, 80))
|
||||
appIcon.imageScaling = .scaleNone
|
||||
let appText = NSStackView(views: [
|
||||
let appText = StackView([
|
||||
BoldLabel(NSLocalizedString("Share improvement ideas, or report bugs", comment: "")),
|
||||
HyperlinkLabel(NSLocalizedString("View existing discussions", comment: ""), App.repository + "/issues"),
|
||||
])
|
||||
appText.orientation = .vertical
|
||||
appText.alignment = .left
|
||||
], .vertical)
|
||||
appText.spacing = GridView.interPadding / 2
|
||||
let header = NSStackView(views: [appIcon, appText])
|
||||
header.spacing = GridView.interPadding
|
||||
sendButton = NSButton(title: NSLocalizedString("Send", comment: ""), target: nil, action: #selector(sendCallback))
|
||||
sendButton.keyEquivalent = "\r"
|
||||
sendButton.isEnabled = false
|
||||
let buttons = NSStackView(views: [
|
||||
NSButton(title: NSLocalizedString("Cancel", comment: ""), target: nil, action: #selector(cancelCallback)),
|
||||
let buttons = StackView([
|
||||
NSButton(title: NSLocalizedString("Cancel", comment: ""), target: nil, action: #selector(cancel)),
|
||||
sendButton,
|
||||
])
|
||||
buttons.spacing = GridView.interPadding
|
||||
|
||||
@@ -6,7 +6,7 @@ class StackView: NSStackView {
|
||||
convenience init(_ views: [NSView], _ orientation: NSUserInterfaceLayoutOrientation = .horizontal, top: CGFloat = 0, right: CGFloat = 0, bottom: CGFloat = 0, left: CGFloat = 0) {
|
||||
self.init(views: views)
|
||||
alignmentRectInsets_ = NSEdgeInsets(top: top, left: left, bottom: bottom, right: right)
|
||||
alignment = orientation == .horizontal ? .firstBaseline : .left
|
||||
alignment = orientation == .horizontal ? .firstBaseline : .leading
|
||||
// workaround: for some reason, horizontal stackviews with a RecorderControl have extra fittingSize.height
|
||||
if orientation == .horizontal && views.first(where: { $0 is CustomRecorderControl }) != nil {
|
||||
fit(fittingSize.width, fittingSize.height - 7)
|
||||
|
||||
@@ -37,8 +37,10 @@ class TextFieldCell: NSTextFieldCell {
|
||||
stringValue = ""
|
||||
placeholderString = placeholder
|
||||
self.usesSingleLineMode = usesSingleLineMode
|
||||
alignment = .natural // appkit bug: the docs say default is .natural but it's .left
|
||||
}
|
||||
|
||||
// add padding all around
|
||||
override func drawingRect(forBounds rect: NSRect) -> NSRect {
|
||||
return super.drawingRect(forBounds: NSMakeRect(
|
||||
rect.origin.x + TextArea.padding,
|
||||
|
||||
@@ -35,7 +35,7 @@ class LabelAndControl: NSObject {
|
||||
|
||||
static func makeLabelWithSlider(_ labelText: String, _ rawName: String, _ minValue: Double, _ maxValue: Double, _ numberOfTickMarks: Int, _ allowsTickMarkValuesOnly: Bool, _ unitText: String = "") -> [NSView] {
|
||||
let value = Preferences.getString(rawName)!
|
||||
let suffixText = value + " " + unitText
|
||||
let suffixText = MeasurementFormatter().string(from: Measurement(value: Double(value)!, unit: Unit(symbol: unitText)))
|
||||
let slider = NSSlider()
|
||||
slider.minValue = minValue
|
||||
slider.maxValue = maxValue
|
||||
|
||||
@@ -22,9 +22,7 @@ class UpdatesTab: NSViewController, PreferencePane {
|
||||
periodicallyInstall.fit()
|
||||
let policyLabel = NSTextField(wrappingLabelWithString: NSLocalizedString("Updates policy:", comment: ""))
|
||||
policyLabel.isSelectable = false
|
||||
let policies = NSStackView(views: [dontPeriodicallyCheck, periodicallyCheck, periodicallyInstall])
|
||||
policies.alignment = .left
|
||||
policies.orientation = .vertical
|
||||
let policies = StackView([dontPeriodicallyCheck, periodicallyCheck, periodicallyInstall], .vertical)
|
||||
policies.spacing = GridView.interPadding / 2
|
||||
let grid = GridView([
|
||||
[policyLabel, policies],
|
||||
|
||||
Reference in new issue
Block a user