Uses 911K of libraries. Click here for Pure Java version (3022L/15K).
!7 // function: func(S) -> bool (true = handled) // guiComponent may be null srecord VoiceTarget(S moduleID, JComponent guiComponent, O function) {} cmodule VoiceTargets > DynObjectTable<VoiceTarget> { start { dontPersist(); dm_onTopInput_q(voidfunc(S s) { for (VoiceTarget vt : getVoiceTargets()) { if (!dm_moduleExists(vt.moduleID)) continue with remove(vt); temp dm_enter(vt.moduleID); if (isTrue(callF(vt.function, s))) ret; } }); } // hold targets during reload O _getReloadData() { ret data; } void _setReloadData(L data) { main addAll(this.data, map(data, func(O o) -> VoiceTarget { shallowCloneToClass(VoiceTarget, o) })); } // API void addVoiceTarget(S moduleID, JComponent guiComponent, O function) enter { assertNotNull(+guiComponent); assertNempty(+moduleID); final VoiceTarget vt = new(moduleID, guiComponent, function); bindToComponent(guiComponent, r { add(vt) }, r { remove(vt) }); } L<VoiceTarget> getVoiceTargets() enter { ret cloneList(data); } }
download show line numbers debug dex old transpilations
Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1020309 |
Snippet name: | Voice Targets - where does voice input go? |
Eternal ID of this version: | #1020309/14 |
Text MD5: | 7f6c4989cd65ff33a2c35b7d2625437d |
Transpilation MD5: | d4f6b6f501aaf926494adad5fa694053 |
Author: | stefan |
Category: | javax / stefan's os |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-23 13:25:37 |
Source code size: | 1119 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 290 / 817 |
Version history: | 13 change(s) |
Referenced in: | #1020310 - dm_voiceTargetsModule |