IDEA-272894: code cleanup

remove Popover.m

GitOrigin-RevId: 0a56fdc61d7078da8da7ec0d4cb37d3a467f774b
This commit is contained in:
Artem Bochkarev
2021-07-05 07:00:36 +00:00
committed by intellij-monorepo-bot
parent ce06ff91ee
commit 29e29f2649
5 changed files with 1 additions and 44 deletions

Binary file not shown.

View File

@@ -11,7 +11,7 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12.2)
add_compile_options("-fmodules" "-flto=full" "-Wall" "-Wextra" "-Wpedantic" "-Wno-newline-eof")
add_library(nst64 SHARED
src/JTypes.h src/Button.m src/Popover.m src/Scrubber.m
src/JTypes.h src/Button.m src/Scrubber.m
src/ScrubberItemView.h src/ScrubberItemView.m
src/TouchBar.h src/TouchBar.m
src/Utils.h src/Utils.m

View File

@@ -1,28 +0,0 @@
#import <Foundation/Foundation.h>
#import "TouchBar.h"
#import "Utils.h"
static void _setPopoverData(NSPopoverTouchBarItem * popoverItem, int itemWidth, NSString * nstext, NSImage * img, id tbObjExpand, id tbObjTapAndHold) {
popoverItem.collapsedRepresentationImage = img;
popoverItem.collapsedRepresentationLabel = nstext;
if (itemWidth > 0) // Otherwise: create 'flexible' view
[popoverItem.collapsedRepresentation.widthAnchor constraintEqualToConstant:itemWidth].active = YES;
popoverItem.showsCloseButton = YES;
popoverItem.popoverTouchBar = ((TouchBar*)tbObjExpand).touchBar;
popoverItem.pressAndHoldTouchBar = ((TouchBar*)tbObjTapAndHold).touchBar;
}
// NOTE: called from AppKit-thread (creation when TB becomes visible), uses default autorelease-pool (create before event processing)
__used
NS_RETURNS_RETAINED
id createPopover(const char * uid, int itemWidth, const char * text, const char * raster4ByteRGBA, int w, int h, id tbObjExpand, id tbObjTapAndHold) {
NSString * nsUid = createStringFromUTF8(uid);
nstrace(@"create popover [%@] (thread: %@)", nsUid, [NSThread currentThread]);
NSPopoverTouchBarItem * popoverItem = [[NSPopoverTouchBarItem alloc] initWithIdentifier:nsUid]; // create non-autorelease object to be owned by java-wrapper
NSImage * img = createImgFrom4ByteRGBA((const unsigned char *)raster4ByteRGBA, w, h);
NSString * nstext = createStringFromUTF8(text);
_setPopoverData(popoverItem, itemWidth, nstext, img, tbObjExpand, tbObjTapAndHold);
return popoverItem;
}

View File

@@ -181,19 +181,6 @@ final class NST {
action); // called from AppKit, uses per-event autorelease-pool
}
static ID createPopover(String uid,
int itemWidth,
String text,
Icon icon,
ID tbObjExpand,
ID tbObjTapAndHold) {
final BufferedImage img = _getImg4ByteRGBA(icon);
final Pointer raster4ByteRGBA = _getRaster(img);
final int w = _getImgW(img);
final int h = _getImgH(img);
return ourNSTLibrary.createPopover(uid, itemWidth, text, raster4ByteRGBA, w, h, tbObjExpand, tbObjTapAndHold); // called from AppKit, uses per-event autorelease-pool
}
// NOTE: due to optimization scrubber is created without icons
// icons must be updated async via updateScrubberItems
@SuppressWarnings("unused")

View File

@@ -34,8 +34,6 @@ interface NSTLibrary extends Library {
// creator returns non-autorelease obj to be owned by java-wrapper
ID createButton(String uid, int buttWidth, int buttonFlags,
String text, String hint, int isHintDisabled, Pointer raster4ByteRGBA, int w, int h, Action action);
ID createPopover(String uid, int itemWidth, String text, Pointer raster4ByteRGBA, int w, int h, ID tbObjExpand, ID tbObjTapAndHold);
ID createScrubber(String uid, int itemWidth, ScrubberDelegate delegate, ScrubberCacheUpdater updater, Pointer packedItems, int byteCount);
ID createGroupItem(String uid, ID[] items, int count);