Skip to content

Commit

Permalink
cocoaui: rename MedialibItemDragDropHolder -> DdbPlayItemPasteboardSe…
Browse files Browse the repository at this point in the history
…rializer
  • Loading branch information
Oleksiy-Yakovenko committed Feb 8, 2024
1 parent 8697615 commit 22a4994
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
16 changes: 8 additions & 8 deletions osx/deadbeef.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,8 @@
2D1E1DCB27B90051004DEF1D /* libavcodec.58.dylib in Copy Plugins */ = {isa = PBXBuildFile; fileRef = 2DD376FC2739B854007AD315 /* libavcodec.58.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
2D1E1DCC27B90051004DEF1D /* libavformat.58.dylib in Copy Plugins */ = {isa = PBXBuildFile; fileRef = 2DD376FE2739B854007AD315 /* libavformat.58.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
2D1E1DCD27B90051004DEF1D /* libavutil.56.dylib in Copy Plugins */ = {isa = PBXBuildFile; fileRef = 2DD376FD2739B854007AD315 /* libavutil.56.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
2D1E215724F9826C00E2895D /* MedialibItemDragDropHolder.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D1E215524F9826C00E2895D /* MedialibItemDragDropHolder.h */; };
2D1E215824F9826C00E2895D /* MedialibItemDragDropHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D1E215624F9826C00E2895D /* MedialibItemDragDropHolder.m */; };
2D1E215724F9826C00E2895D /* DdbPlayItemPasteboardSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D1E215524F9826C00E2895D /* DdbPlayItemPasteboardSerializer.h */; };
2D1E215824F9826C00E2895D /* DdbPlayItemPasteboardSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D1E215624F9826C00E2895D /* DdbPlayItemPasteboardSerializer.m */; };
2D2092502A9A82E600CDBB2B /* libjansson.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2DA84F7B24F58894003507A2 /* libjansson.dylib */; };
2D20D12423F099F4008ACBE6 /* NSImage+Additions.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D20D12223F099F4008ACBE6 /* NSImage+Additions.h */; };
2D20D12523F099F4008ACBE6 /* NSImage+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D20D12323F099F4008ACBE6 /* NSImage+Additions.m */; };
Expand Down Expand Up @@ -5414,8 +5414,8 @@
2D1DC09E1DCB3B7500441A08 /* alac_plugin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = alac_plugin.c; sourceTree = "<group>"; };
2D1E1D8427AD9B25004DEF1D /* buffered_file_writer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = buffered_file_writer.h; sourceTree = "<group>"; };
2D1E1D8527AD9B25004DEF1D /* buffered_file_writer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = buffered_file_writer.c; sourceTree = "<group>"; };
2D1E215524F9826C00E2895D /* MedialibItemDragDropHolder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MedialibItemDragDropHolder.h; sourceTree = "<group>"; };
2D1E215624F9826C00E2895D /* MedialibItemDragDropHolder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MedialibItemDragDropHolder.m; sourceTree = "<group>"; };
2D1E215524F9826C00E2895D /* DdbPlayItemPasteboardSerializer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DdbPlayItemPasteboardSerializer.h; sourceTree = "<group>"; };
2D1E215624F9826C00E2895D /* DdbPlayItemPasteboardSerializer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DdbPlayItemPasteboardSerializer.m; sourceTree = "<group>"; };
2D20924C2A9A077800CDBB2B /* scriptable_tfquery.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scriptable_tfquery.h; sourceTree = "<group>"; };
2D20924D2A9A077800CDBB2B /* scriptable_tfquery.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scriptable_tfquery.c; sourceTree = "<group>"; };
2D20D12223F099F4008ACBE6 /* NSImage+Additions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSImage+Additions.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -12163,8 +12163,8 @@
isa = PBXGroup;
children = (
2D3CD9462409A1B7005875A9 /* DdbListviewDelegate.h */,
2D1E215524F9826C00E2895D /* MedialibItemDragDropHolder.h */,
2D1E215624F9826C00E2895D /* MedialibItemDragDropHolder.m */,
2D1E215524F9826C00E2895D /* DdbPlayItemPasteboardSerializer.h */,
2D1E215624F9826C00E2895D /* DdbPlayItemPasteboardSerializer.m */,
2D3CD9352409A091005875A9 /* PinnedGroupTitleView.h */,
2D3CD9362409A091005875A9 /* PinnedGroupTitleView.m */,
2DDBA24B23E5E66D00051320 /* PlaylistContentView.h */,
Expand Down Expand Up @@ -14711,7 +14711,7 @@
files = (
4DC96E701E4CC9670093CFD3 /* dsp.h in Headers */,
2DDD76C825E152BF00FA6FE5 /* DesignModeDefs.h in Headers */,
2D1E215724F9826C00E2895D /* MedialibItemDragDropHolder.h in Headers */,
2D1E215724F9826C00E2895D /* DdbPlayItemPasteboardSerializer.h in Headers */,
2D78C55D27568D9600F96F9D /* medialibtree.h in Headers */,
2DA3721B2370B854005E64A3 /* NowPlayable.h in Headers */,
2DF55C3F2270FCB9002C44DC /* ScriptableNodeEditorViewController.h in Headers */,
Expand Down Expand Up @@ -18417,7 +18417,7 @@
2D9EF3102B6FAF5C0042F6D8 /* keyboard_shortcuts.c in Sources */,
2D20D12523F099F4008ACBE6 /* NSImage+Additions.m in Sources */,
4DA72BED1838EAAB00A98C62 /* main.m in Sources */,
2D1E215824F9826C00E2895D /* MedialibItemDragDropHolder.m in Sources */,
2D1E215824F9826C00E2895D /* DdbPlayItemPasteboardSerializer.m in Sources */,
2D651D18227227C300375AE2 /* ScriptableNodeEditorWindowController.m in Sources */,
2DEE302829BC8D1900A293AD /* coreaudio.c in Sources */,
2D8EE27524D03601005C5B4B /* MediaLibraryOutlineViewController.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#import "MediaLibraryOutlineView.h"
#import "MediaLibraryItem.h"
#import "MediaLibraryOutlineViewController.h"
#import "MedialibItemDragDropHolder.h"
#import "DdbPlayItemPasteboardSerializer.h"
#import "TrackContextMenu.h"
#import "TrackPropertiesWindowController.h"
#import "UndoIntegration.h"
Expand Down Expand Up @@ -95,7 +95,7 @@ - (instancetype)initWithOutlineView:(NSOutlineView *)outlineView searchField:(NS
self.outlineView = outlineView;
self.outlineView.dataSource = self;
self.outlineView.delegate = self;
[self.outlineView registerForDraggedTypes:@[ddbMedialibItemUTIType]];
[self.outlineView registerForDraggedTypes:@[ddbPlaylistDataUTIType]];

self.searchField = searchField;
self.searchField.target = self;
Expand Down Expand Up @@ -506,7 +506,7 @@ - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id
playItems[count++] = playableItem.playItem;
}

return [[MedialibItemDragDropHolder alloc] initWithItems:playItems count:count];
return [[DdbPlayItemPasteboardSerializer alloc] initWithItems:playItems count:count];
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// MedialibItemDragDropHolder.h
// DdbPlayItemPasteboardSerializer.h
// DeaDBeeF
//
// Created by Oleksiy Yakovenko on 8/28/20.
Expand All @@ -9,7 +9,7 @@
#import <Foundation/Foundation.h>
#include <deadbeef/deadbeef.h>

@interface MedialibItemDragDropHolder : NSObject<NSPasteboardReading, NSPasteboardWriting, NSSecureCoding>
@interface DdbPlayItemPasteboardSerializer : NSObject<NSPasteboardReading, NSPasteboardWriting, NSSecureCoding>

@property (nonnull,nonatomic,readonly) ddb_playlist_t *plt;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
//
// MedialibItemDragDropHolder.m
// DdbPlayItemPasteboardSerializer.m
// DeaDBeeF
//
// Created by Oleksiy Yakovenko on 8/28/20.
// Copyright © 2020 Oleksiy Yakovenko. All rights reserved.
//

#import "MedialibItemDragDropHolder.h"
#import "DdbPlayItemPasteboardSerializer.h"
#import "DdbShared.h"

extern DB_functions_t *deadbeef;

@interface MedialibItemDragDropHolder()
@interface DdbPlayItemPasteboardSerializer()

@property (nonatomic,readwrite) ddb_playlist_t *plt;
@end

@implementation MedialibItemDragDropHolder
@implementation DdbPlayItemPasteboardSerializer

// NSSecureCoding
@dynamic supportsSecureCoding;
Expand Down Expand Up @@ -110,7 +110,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder {

// NSPasteboardReading
+ (nonnull NSArray<NSPasteboardType> *)readableTypesForPasteboard:(nonnull NSPasteboard *)pasteboard {
return @[ddbMedialibItemUTIType];
return @[ddbPlaylistDataUTIType];
}

+ (NSPasteboardReadingOptions)readingOptionsForType:(NSPasteboardType)type pasteboard:(NSPasteboard *)pasteboard {
Expand All @@ -119,11 +119,11 @@ + (NSPasteboardReadingOptions)readingOptionsForType:(NSPasteboardType)type paste

// NSPasteboardWriting
- (NSArray<NSString *> *)writableTypesForPasteboard:(NSPasteboard *)pasteboard {
return @[ddbMedialibItemUTIType];
return @[ddbPlaylistDataUTIType];
}

- (id)pasteboardPropertyListForType:(NSString *)type {
if( [type isEqualToString:ddbMedialibItemUTIType] ) {
if( [type isEqualToString:ddbPlaylistDataUTIType] ) {
#ifdef MAC_OS_X_VERSION_10_14
if (@available(macOS 10.13, *)) {
return [NSKeyedArchiver archivedDataWithRootObject:self requiringSecureCoding:NO error:nil];
Expand Down
12 changes: 6 additions & 6 deletions plugins/cocoaui/Playlist/PlaylistContentView.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#import "PlaylistGroup.h"
#import "PlaylistView.h"
#import "DdbShared.h"
#import "MedialibItemDragDropHolder.h"
#import "DdbPlayItemPasteboardSerializer.h"
#import "PlaylistLocalDragDropHolder.h"
#include <deadbeef/deadbeef.h>
#import "UndoIntegration.h"
Expand Down Expand Up @@ -62,7 +62,7 @@ - (instancetype)initWithFrame:(NSRect)rect {

self.groups_build_idx = -1;

[self registerForDraggedTypes:@[ddbPlaylistItemsUTIType, ddbMedialibItemUTIType, NSFilenamesPboardType]];
[self registerForDraggedTypes:@[ddbPlaylistItemsUTIType, ddbPlaylistDataUTIType, NSFilenamesPboardType]];

_pinnedGroupTitleView = [PinnedGroupTitleView new];
_pinnedGroupTitleView.hidden = YES;
Expand Down Expand Up @@ -187,12 +187,12 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
free(indices);
}
}
if ([pboard.types containsObject:ddbMedialibItemUTIType]) {
NSArray *classes = @[[MedialibItemDragDropHolder class]];
if ([pboard.types containsObject:ddbPlaylistDataUTIType]) {
NSArray *classes = @[[DdbPlayItemPasteboardSerializer class]];
NSDictionary *options = @{};
NSArray<MedialibItemDragDropHolder *> *draggedItems = [pboard readObjectsForClasses:classes options:options];
NSArray<DdbPlayItemPasteboardSerializer *> *draggedItems = [pboard readObjectsForClasses:classes options:options];

for (MedialibItemDragDropHolder *holder in draggedItems) {
for (DdbPlayItemPasteboardSerializer *holder in draggedItems) {
if (holder.plt == NULL) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/cocoaui/Playlist/PlaylistViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#import "TrackContextMenu.h"
#import "TrackPropertiesManager.h"
#import "tftintutil.h"
#import "MedialibItemDragDropHolder.h"
#import "DdbPlayItemPasteboardSerializer.h"

#include <deadbeef/deadbeef.h>
#include "utf8.h"
Expand Down Expand Up @@ -1557,7 +1557,7 @@ - (void)copyAndDeleteSelected:(BOOL)deleteSelected {
return;
}

MedialibItemDragDropHolder *holder = [[MedialibItemDragDropHolder alloc] initWithItems:items count:count];
DdbPlayItemPasteboardSerializer *holder = [[DdbPlayItemPasteboardSerializer alloc] initWithItems:items count:count];

for (ssize_t index = 0; index < count; index++) {
deadbeef->pl_item_unref (items[index]);
Expand Down Expand Up @@ -1589,9 +1589,9 @@ - (void)copy:(id)sender {

- (void)paste:(id)sender {
NSPasteboard *pasteboard = NSPasteboard.generalPasteboard;
NSArray *copiedItems = [pasteboard readObjectsForClasses:@[MedialibItemDragDropHolder.class] options:@{}];
NSArray *copiedItems = [pasteboard readObjectsForClasses:@[DdbPlayItemPasteboardSerializer.class] options:@{}];
if (copiedItems != nil) {
MedialibItemDragDropHolder *holder = copiedItems.firstObject;
DdbPlayItemPasteboardSerializer *holder = copiedItems.firstObject;
ddb_playlist_t *plt = deadbeef->plt_get_curr ();
int cursor = deadbeef->plt_get_cursor (plt, PL_MAIN);
if (cursor == -1) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/cocoaui/Utility/DdbShared.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#import <Foundation/Foundation.h>

extern NSString * const ddbPlaylistItemsUTIType;
extern NSString * const ddbMedialibItemUTIType;
extern NSString * const ddbPlaylistDataUTIType;

int
cocoaui_add_new_playlist (void);
Expand Down
2 changes: 1 addition & 1 deletion plugins/cocoaui/Utility/DdbShared.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <deadbeef/deadbeef.h>

NSString * const ddbPlaylistItemsUTIType = @"org.deadbeef.playlistItems";
NSString * const ddbMedialibItemUTIType = @"org.deadbeef.medialibItem";
NSString * const ddbPlaylistDataUTIType = @"org.deadbeef.playlistData";

extern DB_functions_t *deadbeef;

Expand Down

0 comments on commit 22a4994

Please sign in to comment.