comparison src/name/blackcap/clipman/Main.kt @ 31:0c6c18a733b7

Compiles, new menu still a mess.
author David Barts <n5jrn@me.com>
date Thu, 30 Jan 2020 16:01:51 -0800
parents c4f53bc01732
children 5f8475b37e23
comparison
equal deleted inserted replaced
30:0e88c6bed11e 31:0c6c18a733b7
70 is PasteboardItem.Plain -> Pair(contents.plain, null) 70 is PasteboardItem.Plain -> Pair(contents.plain, null)
71 is PasteboardItem.HTML -> Pair(null, contents.html) 71 is PasteboardItem.HTML -> Pair(null, contents.html)
72 is PasteboardItem.RTF -> Pair(contents.plain, contents.html) 72 is PasteboardItem.RTF -> Pair(contents.plain, contents.html)
73 } 73 }
74 val piv = if (html == null) { 74 val piv = if (html == null) {
75 PasteboardItemView("Plain text", ClipText().apply { 75 PasteboardItemView("Plain text", ClipText(contents).apply {
76 contentType = "text/plain" 76 contentType = "text/plain"
77 text = plain 77 text = plain
78 font = Font(Font.MONOSPACED, Font.PLAIN, MONO_SIZE) 78 font = Font(Font.MONOSPACED, Font.PLAIN, MONO_SIZE)
79 resize() 79 resize()
80 }) 80 })
82 val (dhtml, style) = preproc(html) 82 val (dhtml, style) = preproc(html)
83 val hek = MyEditorKit().apply { 83 val hek = MyEditorKit().apply {
84 style.addStyleSheet(defaultStyleSheet) 84 style.addStyleSheet(defaultStyleSheet)
85 styleSheet = style 85 styleSheet = style
86 } 86 }
87 PasteboardItemView("Styled text", ClipText().apply { 87 PasteboardItemView("Styled text", ClipText(contents).apply {
88 editorKit = hek 88 editorKit = hek
89 text = dhtml 89 text = dhtml
90 resize() 90 resize()
91 }) 91 })
92 } 92 }
132 return 132 return
133 } 133 }
134 queue.v.deselectAll() 134 queue.v.deselectAll()
135 source.selected = true 135 source.selected = true
136 source.validate() 136 source.validate()
137 SelectionRequired.enable() 137 anyRequired.enable()
138 source.basedOn.let {
139 if (it is PasteboardItem.HTML || it is PasteboardItem.RTF) {
140 styledRequired.enable()
141 }
142 }
138 } 143 }
139 144
140 override fun mousePressed(e: MouseEvent) { 145 override fun mousePressed(e: MouseEvent) {
141 maybeShowPopup(e) 146 maybeShowPopup(e)
142 } 147 }