Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
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 @@
...
@@ -31,7 +31,7 @@
/******************************************************************************
/******************************************************************************
* VLCMainWindow (MasterViewDataSource)
* VLCMainWindow (MasterViewDataSource)
*/
*/
@implementation
VLCMainWindow
(
MasterViewD
ataSourc
e
)
@implementation
VLCMainWindow
(
MasterViewD
elegat
e
)
-
(
BOOL
)
outlineView
:(
NSOutlineView
*
)
outlineView
isGroupItem
:(
id
)
item
-
(
BOOL
)
outlineView
:(
NSOutlineView
*
)
outlineView
isGroupItem
:(
id
)
item
{
{
return
[[
item
representedObject
]
isKindOfClass
:[
NSDictionary
class
]];
return
[[
item
representedObject
]
isKindOfClass
:[
NSDictionary
class
]];
...
@@ -46,6 +46,55 @@
...
@@ -46,6 +46,55 @@
}
}
@end
@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
* VLCMainWindow
*/
*/
...
@@ -54,9 +103,6 @@
...
@@ -54,9 +103,6 @@
{
{
NSTableColumn
*
tableColumn
;
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 */
/* Check ib outlets */
NSAssert
(
mainSplitView
,
@"No split view or wrong split view"
);
NSAssert
(
mainSplitView
,
@"No split view or wrong split view"
);
NSAssert
(
fullScreenButton
,
@"No fullscreen button"
);
NSAssert
(
fullScreenButton
,
@"No fullscreen button"
);
...
@@ -94,6 +140,8 @@
...
@@ -94,6 +140,8 @@
[
categoryList
setSelectionHighlightStyle
:
NSTableViewSelectionHighlightStyleSourceList
];
[
categoryList
setSelectionHighlightStyle
:
NSTableViewSelectionHighlightStyleSourceList
];
[
categoryList
setDelegate
:
self
];
[
categoryList
setDelegate
:
self
];
[
categoryList
registerForDraggedTypes
:[
NSArray
arrayWithObjects
:
NSFilenamesPboardType
,
NSURLPboardType
,
@"VLCMediaURLType"
,
nil
]];
[
categoryList
setDataSource
:
self
];
/***********************************
/***********************************
* detailList setup
* detailList setup
...
...
extras/MacOSX/VLC_app/Sources/VLCMediaArrayController.m
View file @
ca3fcd38
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
-
(
NSDragOperation
)
tableView
:(
NSTableView
*
)
tv
validateDrop
:(
id
<
NSDraggingInfo
>
)
info
-
(
NSDragOperation
)
tableView
:(
NSTableView
*
)
tv
validateDrop
:(
id
<
NSDraggingInfo
>
)
info
proposedRow
:(
int
)
row
proposedDropOperation
:(
NSTableViewDropOperation
)
op
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
-
(
BOOL
)
tableView
:(
NSTableView
*
)
aTableView
acceptDrop
:(
id
<
NSDraggingInfo
>
)
info
...
@@ -60,15 +60,29 @@
...
@@ -60,15 +60,29 @@
int
i
;
int
i
;
row
=
0
;
row
=
0
;
NSArray
*
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSFilenamesPboardType
];
NSArray
*
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSFilenamesPboardType
];
if
(
!
droppedItems
)
droppedItems
=
[[
info
draggingPasteboard
]
propertyListForType
:
NSURLPboardType
];
for
(
i
=
0
;
i
<
[
droppedItems
count
];
i
++
)
for
(
i
=
0
;
i
<
[
droppedItems
count
];
i
++
)
{
{
NSString
*
filename
=
[
droppedItems
objectAtIndex
:
i
];
NSString
*
filename
=
[
droppedItems
objectAtIndex
:
i
];
VLCMedia
*
media
=
[
VLCMedia
mediaWithPath
:
filename
];
VLCMedia
*
media
=
[
VLCMedia
mediaWithPath
:
filename
];
[
contentMediaList
lock
];
[
contentMediaList
lock
];
[
contentMediaList
insertMedia
:
media
atIndex
:
[
contentMediaList
count
]
>
0
?
[
contentMediaList
count
]
-
1
:
0
];
[
contentMediaList
insertMedia
:
media
atIndex
:
row
];
[
contentMediaList
unlock
];
[
contentMediaList
unlock
];
}
}
return
YES
;
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
@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