Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
ca3fcd38
Commit
ca3fcd38
authored
Jan 02, 2008
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MacOSX/VLC_app: Support drag and drop to the category view.
parent
fb3f9b25
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
7 deletions
+69
-7
extras/MacOSX/VLC_app/Sources/VLCMainWindow.m
extras/MacOSX/VLC_app/Sources/VLCMainWindow.m
+52
-4
extras/MacOSX/VLC_app/Sources/VLCMediaArrayController.m
extras/MacOSX/VLC_app/Sources/VLCMediaArrayController.m
+17
-3
No files found.
extras/MacOSX/VLC_app/Sources/VLCMainWindow.m
View file @
ca3fcd38
...
...
@@ -31,7 +31,7 @@
/******************************************************************************
* VLCMainWindow (MasterViewDataSource)
*/
@implementation
VLCMainWindow
(
MasterViewD
ataSourc
e
)
@implementation
VLCMainWindow
(
MasterViewD
elegat
e
)
-
(
BOOL
)
outlineView
:(
NSOutlineView
*
)
outlineView
isGroupItem
:(
id
)
item
{
return
[[
item
representedObject
]
isKindOfClass
:[
NSDictionary
class
]];
...
...
@@ -46,6 +46,55 @@
}
@end
@implementation
VLCMainWindow
(
MasterViewDataSource
)
/* Drag and drop */
-
(
BOOL
)
outlineView
:(
NSOutlineView
*
)
outlineView
acceptDrop
:(
id
<
NSDraggingInfo
>
)
info
item
:(
id
)
item
childIndex
:(
NSInteger
)
index
{
int
i
;
if
(
!
[
item
respondsToSelector
:
@selector
(
representedObject
)])
return
NO
;
NSArray
*
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
@"VLCMediaURLType"
];
if
(
!
droppedItems
)
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSFilenamesPboardType
];
if
(
!
droppedItems
)
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSURLPboardType
];
NSAssert
(
droppedItems
,
@"Dropped an unsupported object type on the outline View"
);
VLCMediaList
*
mediaList
=
[(
VLCMedia
*
)[
item
representedObject
]
subitems
];
for
(
i
=
0
;
i
<
[
droppedItems
count
];
i
++
)
{
NSString
*
filename
=
[
droppedItems
objectAtIndex
:
i
];
VLCMedia
*
media
=
[
VLCMedia
mediaWithPath
:
filename
];
[
mediaList
lock
];
[
mediaList
insertMedia
:
media
atIndex
:
index
+
1
];
[
mediaList
unlock
];
}
return
YES
;
}
-
(
NSDragOperation
)
outlineView
:(
NSOutlineView
*
)
outlineView
validateDrop
:(
id
<
NSDraggingInfo
>
)
info
proposedItem
:(
id
)
item
proposedChildIndex
:(
NSInteger
)
index
{
NSArray
*
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
@"VLCMediaURLType"
];
if
(
!
droppedItems
)
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSFilenamesPboardType
];
if
(
!
droppedItems
)
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSURLPboardType
];
if
(
!
droppedItems
||
!
[
item
respondsToSelector
:
@selector
(
representedObject
)]
||
!
[[
item
representedObject
]
isKindOfClass
:[
VLCMedia
class
]]
)
{
return
NSDragOperationNone
;
}
return
NSDragOperationMove
;
}
@end
/******************************************************************************
* VLCMainWindow
*/
...
...
@@ -54,9 +103,6 @@
{
NSTableColumn
*
tableColumn
;
/* This one will be removable, so we keep a reference of it so we can safely call removeFromSuperview */
[
navigatorView
retain
];
/* Check ib outlets */
NSAssert
(
mainSplitView
,
@"No split view or wrong split view"
);
NSAssert
(
fullScreenButton
,
@"No fullscreen button"
);
...
...
@@ -94,6 +140,8 @@
[
categoryList
setSelectionHighlightStyle
:
NSTableViewSelectionHighlightStyleSourceList
];
[
categoryList
setDelegate
:
self
];
[
categoryList
registerForDraggedTypes
:[
NSArray
arrayWithObjects
:
NSFilenamesPboardType
,
NSURLPboardType
,
@"VLCMediaURLType"
,
nil
]];
[
categoryList
setDataSource
:
self
];
/***********************************
* detailList setup
...
...
extras/MacOSX/VLC_app/Sources/VLCMediaArrayController.m
View file @
ca3fcd38
...
...
@@ -51,7 +51,7 @@
-
(
NSDragOperation
)
tableView
:(
NSTableView
*
)
tv
validateDrop
:(
id
<
NSDraggingInfo
>
)
info
proposedRow
:(
int
)
row
proposedDropOperation
:(
NSTableViewDropOperation
)
op
{
return
[
contentMediaList
isReadOnly
]
?
NSDragOperationNone
:
NSDragOperationGeneric
;
return
[
contentMediaList
isReadOnly
]
||
op
==
NSTableViewDropOn
?
NSDragOperationNone
:
NSDragOperationGeneric
;
}
-
(
BOOL
)
tableView
:(
NSTableView
*
)
aTableView
acceptDrop
:(
id
<
NSDraggingInfo
>
)
info
...
...
@@ -60,15 +60,29 @@
int
i
;
row
=
0
;
NSArray
*
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSFilenamesPboardType
];
if
(
!
droppedItems
)
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSURLPboardType
];
for
(
i
=
0
;
i
<
[
droppedItems
count
];
i
++
)
{
NSString
*
filename
=
[
droppedItems
objectAtIndex
:
i
];
VLCMedia
*
media
=
[
VLCMedia
mediaWithPath
:
filename
];
[
contentMediaList
lock
];
[
contentMediaList
insertMedia
:
media
atIndex
:
[
contentMediaList
count
]
>
0
?
[
contentMediaList
count
]
-
1
:
0
];
[
contentMediaList
insertMedia
:
media
atIndex
:
row
];
[
contentMediaList
unlock
];
}
return
YES
;
}
-
(
BOOL
)
tableView
:(
NSTableView
*
)
aTableView
writeRowsWithIndexes
:(
NSIndexSet
*
)
rowIndexes
toPasteboard
:(
NSPasteboard
*
)
pboard
{
NSMutableArray
*
array
=
[
NSMutableArray
arrayWithCapacity
:[
rowIndexes
count
]];
int
i
=
[
rowIndexes
firstIndex
];
do
{
[
array
addObject
:[[
contentMediaList
mediaAtIndex
:
i
]
url
]];
}
while
((
i
=
[
rowIndexes
indexGreaterThanIndex
:
i
])
!=
NSNotFound
);
[
pboard
declareTypes
:[
NSArray
arrayWithObject
:
@"VLCMediaURLType"
]
owner
:
self
];
[
pboard
setPropertyList
:
array
forType
:
@"VLCMediaURLType"
];
return
YES
;
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment