Uses 911K of libraries. Click here for Pure Java version (15678L/87K).
!7 cmodule MarkedImages > DynSCP { File dir; transient DynamicHStack buttons; transient ButtonImageLoader imageLoader; O[] menuItems() { ret litobjarray("Select directory...", r select); } start { if (dir == null) dir = picturesDir(); ownResource(vmBus_onDirChange(dir, r updateButtons)); } JComponent visualize2() { if (dir == null) ret jHandleFileDrop(jcenteredbutton("Select directory...", rThread select), voidfunc(File f) { setDir(f) }); setDir(dir); ret getComponent(); } void select enter { selectDir(voidfunc(File dir) { setDir(dir) }); } void setDir(File dir) enter { setField(+dir); buttons = makeNiceButtons(); imageLoader = new ButtonImageLoader(buttons) { void setAButtonsImage(JButton b, File f) { BufferedImage img = loadBufferedImage(f); BufferedImage preview = scaleBufferedImageToHeight(imageHeight, img); LPairS pairs = fileInfoFileAsPairs(f); fOr (PairS p : pairs) { O o = unstruct(p.b); // Note: unsafe if (o instanceof Scored) o = o/Scored!; Rect r = optCast Rect(o); if (r != null) drawRect(preview, rescaleRect_imageToImage(r, img, preview), Color.white); } setButtonImage(b, preview); } }; updateButtons(); setComponent(jHigherScrollPane(jfullcenter(buttons))); } void updateButtons { if (dir == null || buttons == null) ret; temp enter(); L<File> imageFiles = sortFilesByName(listImageFiles(dir)); L<TextImageAction> l = filesForNiceButtons(latestFilesFirst(imageFiles), f showImage); for (final TextImageAction tia : l) tia.popupMenuMaker = imageFilesPopupMenuFunction(tia); replaceNiceButtons(buttons, l); setModuleName(nImages(l) + " - " + f2s(dir)); if (imageLoader != null) imageLoader.update(); } }
Began life as a copy of #1019188
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1027224 |
Snippet name: | Marked Images Album [supports multiple objects per image] |
Eternal ID of this version: | #1027224/11 |
Text MD5: | f7710c980033773cd4f7eda9fd2d1a69 |
Transpilation MD5: | 3c3fb5b0c06808a3937bb8aadc31f7e5 |
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-02-26 17:38:27 |
Source code size: | 1949 bytes / 63 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 236 / 449 |
Version history: | 10 change(s) |
Referenced in: | -