123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- //
- // KMConvertWordSettingView.swift
- // PDF Master
- //
- // Created by tangchao on 2022/12/6.
- //
- class KMConvertWordSettingView: KMConvertSettingView {
- @IBOutlet weak var pageSettingTitleLabel: NSTextField!
-
- @IBOutlet weak var saveFlowTextRadio: KMImageTitleButton!
- @IBOutlet weak var savePageLayoutRadio: KMImageTitleButton!
-
- @IBOutlet weak var textOCRBox: NSBox!
- @IBOutlet weak var pageRangeBox: NSBox!
-
- private var flowTextVC: KMDesignButton?
- private var pageLayoutVC: KMDesignButton?
-
- // 流排 0 框排 1
- var pageSettingSelectedIndex: Int = 0
-
- override func awakeFromNib() {
- super.awakeFromNib()
-
- self._flowTextAction()
- }
-
- override func initSubViews() {
- super.initSubViews()
-
- self.flowTextVC = KMDesignButton.init(withType: .RadioButton)
- self.saveFlowTextRadio.addSubview(self.flowTextVC!.view)
- self.flowTextVC?.view.frame = self.saveFlowTextRadio.bounds
- self.flowTextVC?.view.autoresizingMask = [.width, .height]
- self.flowTextVC?.target = self
- self.flowTextVC?.action = #selector(saveFlowTextRadioAction)
- self.flowTextVC?.stringValue = NSLocalizedString("Retain Flowing Text", comment: "")
- self.flowTextVC?.checkbox_radio()
-
- self.pageLayoutVC = KMDesignButton.init(withType: .RadioButton)
- self.savePageLayoutRadio.addSubview(self.pageLayoutVC!.view)
- self.pageLayoutVC?.view.frame = self.savePageLayoutRadio.bounds
- self.pageLayoutVC?.view.autoresizingMask = [.width, .height]
- self.pageLayoutVC?.target = self
- self.pageLayoutVC?.action = #selector(savePageLayoutRadioAction)
- self.pageLayoutVC?.stringValue = NSLocalizedString("Retain Page Layout", comment: "")
- self.pageLayoutVC?.checkbox_radio()
-
- self.tipView?.km_add_left_constraint(constant: 8)
- self.tipView?.km_add_top_constraint(equalTo: self.pageRangeBox, attribute: .bottom, constant: -5)
- self.tipView?.km_add_right_constraint()
- // self.tipView?.km_add_width_constraint(constant: 300)
- self.tipView?.km_add_height_constraint(constant: 16+20+16)
- }
-
- override func initDefaultVlaue() {
- super.initDefaultVlaue()
-
- self.pageSettingTitleLabel.stringValue = NSLocalizedString("Layout Settings", comment: "")
- self.pageSettingTitleLabel.textColor = NSColor.km_init(hex: "#616469")
- self.pageSettingTitleLabel.font = .SFProTextRegularFont(12)
- }
-
- override func viewDidMoveToWindow() {
- super.viewDidMoveToWindow()
-
- if (self.ocrItemView == nil) {
- self.ocrItemView = KMConvertOCRSettingItemView.createFromNib()
- self.textOCRBox.contentView = self.ocrItemView
- }
- self.ocrItemView?.languageIndex = self.ocrLanuguageIndex
- if (self.pageRangeItemView == nil) {
- self.pageRangeItemView = KMConvertPageRangeSettingItemView.createFromNib()
- self.pageRangeBox.contentView = self.pageRangeItemView
- }
- }
-
- @objc func saveFlowTextRadioAction(sender: AnyObject) {
- self._flowTextAction()
- }
- @objc func savePageLayoutRadioAction(sender: AnyObject) {
- self._pageLayoutAction()
- }
-
- // MARK: - Private Methods
-
- private func _flowTextAction() {
- self.flowTextVC?.state = .Checked
- self.pageLayoutVC?.state = .Norm
- self.pageSettingSelectedIndex = 0
- }
-
- private func _pageLayoutAction() {
- self.pageLayoutVC?.state = .Checked
- self.flowTextVC?.state = .Norm
-
- self.pageSettingSelectedIndex = 1
- }
- }
|