d6201c59b4
Desktop: - Replace Remote checkbox with T: dest_spin (0=Off, 1-9=tablet) on all widgets - dest_id persisted in get_state/set_state, broadcast in tablet snapshot - dest_spin.valueChanged triggers save + broadcast to iPad - _on_widget_visibility_from_tablet updates dest_spin from iPad hide event - _broadcast_preset_update shared helper; ws_server.has_clients guard - label editingFinished triggers live label sync to iPad iOS: - VC-Arrange/VC-Logging/Widgets-Reusable-UI file reorganisation - ArrangeObjects/ArrangeView rename, 7-bucket Arrange-Functions split - myTabletId (UserDefaults) + tabletIdField next to port in toolbar - Preset filter: destId == myTabletId instead of visible bool - BaseWidget activity ring: long press gesture (touch) + final update() flash - Context menu long press (arrange mode): hide widget, save layout, send dest_id:0 - Same-UUID preset check skips Preset Switched alert on visibility/label updates - autoSwitchEnabled, toolbarStatusLabel, presetLabel, statusToken Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
import UIKit
|
|
|
|
class TitleWidget: BaseWidget {
|
|
|
|
static func defaultFrame(idx: Int) -> CGRect {
|
|
let col = idx % 3
|
|
let row = idx / 3
|
|
return CGRect(x: 16 + CGFloat(col) * 220, y: 16 + CGFloat(row) * 60, width: 200, height: 44)
|
|
}
|
|
|
|
// MARK: - Subviews
|
|
lazy var titleLabel: UILabel = {
|
|
let lbl = UILabel()
|
|
lbl.translatesAutoresizingMaskIntoConstraints = false
|
|
lbl.textColor = UIColor(white: 0.85, alpha: 1)
|
|
lbl.font = .systemFont(ofSize: 22, weight: .semibold)
|
|
lbl.textAlignment = .left
|
|
return lbl
|
|
}()
|
|
|
|
// MARK: - Init
|
|
init(uid: String, text: String, frame: CGRect) {
|
|
super.init(uid: uid, frame: frame)
|
|
self.backgroundColor = .clear
|
|
self.layer.borderColor = UIColor.clear.cgColor
|
|
self.titleLabel.text = text
|
|
setupUI()
|
|
}
|
|
|
|
required init?(coder: NSCoder) { fatalError() }
|
|
|
|
// MARK: - Layout
|
|
func setupUI() {
|
|
self.addSubview(self.titleLabel)
|
|
self.titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 4).isActive = true
|
|
self.titleLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor, constant: -4).isActive = true
|
|
self.titleLabel.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
|
|
}
|
|
|
|
}
|