comparison 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
comparison
equal deleted inserted replaced
55:7ad2b29a7f60 56:22725d4d7849
26 "File.Preferences" -> Application.settingsDialog.setVisible(true) 26 "File.Preferences" -> Application.settingsDialog.setVisible(true)
27 "Edit.Clone" -> onlyIfSelected { PasteboardItem.write(it.contents) } 27 "Edit.Clone" -> onlyIfSelected { PasteboardItem.write(it.contents) }
28 "Edit.Coerce" -> onlyIfSelected { Application.coerceDialog.setVisible(true) } 28 "Edit.Coerce" -> onlyIfSelected { Application.coerceDialog.setVisible(true) }
29 "Edit.Find" -> Application.searchDialog.setVisible(true) 29 "Edit.Find" -> Application.searchDialog.setVisible(true)
30 "Edit.FindAgain" -> Application.searchDialog.find() 30 "Edit.FindAgain" -> Application.searchDialog.find()
31 "Edit.Troff" -> onlyIfSelected { if (suitedForCoercing(it)) { troffize(it.contents) } }
31 "Help.About" -> showAboutDialog() 32 "Help.About" -> showAboutDialog()
32 else -> throw RuntimeException("unexpected actionCommand!") 33 else -> throw RuntimeException("unexpected actionCommand!")
33 } 34 }
34 } 35 }
35 36
100 setEnabled(false) 101 setEnabled(false)
101 actionCommand = "Edit.Coerce" 102 actionCommand = "Edit.Coerce"
102 addActionListener(Application.menuItemListener) 103 addActionListener(Application.menuItemListener)
103 makeShortcut(KeyEvent.VK_K) 104 makeShortcut(KeyEvent.VK_K)
104 })) 105 }))
106 add(Application.styledRequired.add(JMenuItem("Convert to Troff").apply {
107 setEnabled(false)
108 actionCommand = "Edit.Troff"
109 addActionListener(Application.menuItemListener)
110 makeShortcut(KeyEvent.VK_T)
111 }))
105 add(JMenuItem("Find…").apply { 112 add(JMenuItem("Find…").apply {
106 actionCommand = "Edit.Find" 113 actionCommand = "Edit.Find"
107 addActionListener(Application.menuItemListener) 114 addActionListener(Application.menuItemListener)
108 makeShortcut(KeyEvent.VK_F) 115 makeShortcut(KeyEvent.VK_F)
109 }) 116 })