diff src/name/blackcap/clipman/Menus.kt @ 56:22725d4d7849

An attempt to get it to troff-ize styled text.
author David Barts <n5jrn@me.com>
date Sat, 19 Mar 2022 23:04:40 -0700
parents bb80148e2cb3
children c6cccbe2f393
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Menus.kt	Tue Apr 13 10:34:51 2021 -0700
+++ b/src/name/blackcap/clipman/Menus.kt	Sat Mar 19 23:04:40 2022 -0700
@@ -28,6 +28,7 @@
             "Edit.Coerce" -> onlyIfSelected { Application.coerceDialog.setVisible(true) }
             "Edit.Find" -> Application.searchDialog.setVisible(true)
             "Edit.FindAgain" -> Application.searchDialog.find()
+            "Edit.Troff" -> onlyIfSelected { if (suitedForCoercing(it)) { troffize(it.contents) } }
             "Help.About" -> showAboutDialog()
             else -> throw RuntimeException("unexpected actionCommand!")
         }
@@ -102,6 +103,12 @@
                 addActionListener(Application.menuItemListener)
                 makeShortcut(KeyEvent.VK_K)
             }))
+            add(Application.styledRequired.add(JMenuItem("Convert to Troff").apply {
+                setEnabled(false)
+                actionCommand = "Edit.Troff"
+                addActionListener(Application.menuItemListener)
+                makeShortcut(KeyEvent.VK_T)
+            }))
             add(JMenuItem("Find…").apply {
                 actionCommand = "Edit.Find"
                 addActionListener(Application.menuItemListener)