Uses 911K of libraries. Click here for Pure Java version (13915L/77K).
1 | !7 |
2 | |
3 | cmodule MarkedFaces extends DynSCP { |
4 | File dir; |
5 | |
6 | transient DynamicHStack buttons; |
7 | transient ButtonImageLoader imageLoader; |
8 | |
9 | start { |
10 | dir = ai_markedFacesDir(); |
11 | ownResource(vmBus_onDirChange(dir, r updateButtons)); |
12 | } |
13 | |
14 | JComponent visualize2() { |
15 | setDir(dir); |
16 | ret getComponent(); |
17 | } |
18 | |
19 | void setDir(File dir) { |
20 | temp enter(); |
21 | setField(+dir); |
22 | |
23 | buttons = makeNiceButtons(); |
24 | imageLoader = new ButtonImageLoader(buttons) { |
25 | void setAButtonsImage(JButton b, File f) { |
26 | BufferedImage img = loadBufferedImage(f); |
27 | BufferedImage preview = scaleBufferedImageToHeight(imageHeight, img); |
28 | Rect face = cast unstruct(getFileInfoField(f, "Face position")); |
29 | if (face != null) |
30 | drawRect(preview, rescaleRect_imageToImage(face, img, preview), Color.white); |
31 | setButtonImage(b, preview); |
32 | } |
33 | }; |
34 | updateButtons(); |
35 | setComponent(jHigherScrollPane(jfullcenter(buttons))); |
36 | } |
37 | |
38 | void updateButtons { |
39 | if (dir == null || buttons == null) ret; |
40 | temp enter(); |
41 | L<File> imageFiles = listImageFiles(dir); |
42 | L<TextImageAction> l = filesForNiceButtons(latestFilesFirst(imageFiles), f showImage); |
43 | for (final TextImageAction tia : l) |
44 | tia.popupMenuMaker = imageFilesPopupMenuFunction(tia); |
45 | replaceNiceButtons(buttons, l); |
46 | setModuleName(n2(l, "Marked Face")); |
47 | if (imageLoader != null) imageLoader.update(); |
48 | } |
49 | } |
Began life as a copy of #1019109
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1019188 |
Snippet name: | Marked Faces Album [Dyn Module] |
Eternal ID of this version: | #1019188/5 |
Text MD5: | 90b5e7f6f356249ec467342eecdc3658 |
Transpilation MD5: | 564281116470102aa769c4beb5bc6191 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-01-20 13:44:27 |
Source code size: | 1471 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 408 / 4042 |
Version history: | 4 change(s) |
Referenced in: | [show references] |