diff 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
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Main.kt	Wed Jan 29 21:56:12 2020 -0800
+++ b/src/name/blackcap/clipman/Main.kt	Thu Jan 30 16:01:51 2020 -0800
@@ -72,7 +72,7 @@
                         is PasteboardItem.RTF -> Pair(contents.plain, contents.html)
                     }
                     val piv = if (html == null) {
-                        PasteboardItemView("Plain text", ClipText().apply {
+                        PasteboardItemView("Plain text", ClipText(contents).apply {
                             contentType = "text/plain"
                             text = plain
                             font = Font(Font.MONOSPACED, Font.PLAIN, MONO_SIZE)
@@ -84,7 +84,7 @@
                             style.addStyleSheet(defaultStyleSheet)
                             styleSheet = style
                         }
-                        PasteboardItemView("Styled text", ClipText().apply {
+                        PasteboardItemView("Styled text", ClipText(contents).apply {
                             editorKit = hek
                             text = dhtml
                             resize()
@@ -134,7 +134,12 @@
         queue.v.deselectAll()
         source.selected = true
         source.validate()
-        SelectionRequired.enable()
+        anyRequired.enable()
+        source.basedOn.let {
+            if (it is PasteboardItem.HTML || it is PasteboardItem.RTF) {
+                styledRequired.enable()
+            }
+        }
     }
 
  	override fun mousePressed(e: MouseEvent) {