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
4ee84122
Commit
4ee84122
authored
May 31, 2012
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: Convert & Save dialog: finished drag & drop support in the input box
parent
dbd8e30b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1756 additions
and
1627 deletions
+1756
-1627
extras/package/macosx/Resources/English.lproj/ConvertAndSave.xib
...package/macosx/Resources/English.lproj/ConvertAndSave.xib
+1634
-1605
modules/gui/macosx/ConvertAndSave.h
modules/gui/macosx/ConvertAndSave.h
+10
-1
modules/gui/macosx/ConvertAndSave.m
modules/gui/macosx/ConvertAndSave.m
+112
-21
No files found.
extras/package/macosx/Resources/English.lproj/ConvertAndSave.xib
View file @
4ee84122
This source diff could not be displayed because it is too large. You can
view the blob
instead.
modules/gui/macosx/ConvertAndSave.h
View file @
4ee84122
...
...
@@ -32,6 +32,7 @@
IBOutlet
id
o_drop_lbl
;
IBOutlet
id
o_drop_image_view
;
IBOutlet
id
o_drop_btn
;
IBOutlet
id
o_drop_box
;
IBOutlet
id
o_profile_lbl
;
IBOutlet
id
o_profile_pop
;
...
...
@@ -47,7 +48,7 @@
IBOutlet
id
o_dropin_icon_view
;
IBOutlet
id
o_dropin_media_lbl
;
NSString
*
MRL
;
NSString
*
_
MRL
;
}
@property
(
readwrite
,
nonatomic
,
retain
)
NSString
*
MRL
;
...
...
@@ -68,3 +69,11 @@
@interface
VLCDropEnabledBox
:
NSBox
@end
@interface
VLCDropEnabledImageView
:
NSImageView
@end
@interface
VLCDropEnabledButton
:
NSButton
@end
modules/gui/macosx/ConvertAndSave.m
View file @
4ee84122
...
...
@@ -27,7 +27,7 @@
@implementation
VLCConvertAndSave
@synthesize
MRL
;
@synthesize
MRL
=
_MRL
;
static
VLCConvertAndSave
*
_o_sharedInstance
=
nil
;
...
...
@@ -79,9 +79,56 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
-
(
void
)
updateDropView
{
if
([
_MRL
length
]
>
0
)
{
NSString
*
path
=
[[
NSURL
URLWithString
:
_MRL
]
path
];
[
o_dropin_media_lbl
setStringValue
:
[[
NSFileManager
defaultManager
]
displayNameAtPath
:
path
]];
NSImage
*
image
=
[[
NSWorkspace
sharedWorkspace
]
iconForFile
:
path
];
[
image
setSize
:
NSMakeSize
(
64
,
64
)];
[
o_dropin_icon_view
setImage
:
image
];
if
(
!
[
o_dropin_view
superview
])
{
NSRect
boxFrame
=
[
o_drop_box
frame
];
NSRect
subViewFrame
=
[
o_dropin_view
frame
];
subViewFrame
.
origin
.
x
=
(
boxFrame
.
size
.
width
-
subViewFrame
.
size
.
width
)
/
2
;
subViewFrame
.
origin
.
y
=
(
boxFrame
.
size
.
height
-
subViewFrame
.
size
.
height
)
/
2
;
[
o_dropin_view
setFrame
:
subViewFrame
];
[[
o_drop_image_view
animator
]
setHidden
:
YES
];
[
o_drop_box
performSelector
:
@selector
(
addSubview
:)
withObject
:
o_dropin_view
afterDelay
:
0
.
4
];
}
}
else
{
[
o_dropin_view
removeFromSuperview
];
[[
o_drop_image_view
animator
]
setHidden
:
NO
];
}
}
-
(
BOOL
)
performDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
NSPasteboard
*
o_paste
=
[
sender
draggingPasteboard
];
NSArray
*
o_types
=
[
NSArray
arrayWithObject
:
NSFilenamesPboardType
];
NSString
*
o_desired_type
=
[
o_paste
availableTypeFromArray
:
o_types
];
NSData
*
o_carried_data
=
[
o_paste
dataForType
:
o_desired_type
];
if
(
o_carried_data
)
{
if
(
[
o_desired_type
isEqualToString
:
NSFilenamesPboardType
]
)
{
NSArray
*
o_values
=
[[
o_paste
propertyListForType
:
NSFilenamesPboardType
]
sortedArrayUsingSelector
:
@selector
(
caseInsensitiveCompare
:)];
if
([
o_values
count
]
>
0
)
{
[
self
setMRL
:
[
NSString
stringWithUTF8String
:
make_URI
([[
o_values
objectAtIndex
:
0
]
UTF8String
],
NULL
)]];
[
self
updateDropView
];
return
YES
;
}
}
}
return
NO
;
}
@end
...
...
@@ -107,27 +154,39 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
-
(
BOOL
)
performDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
NSPasteboard
*
o_paste
=
[
sender
draggingPasteboard
];
NSArray
*
o_types
=
[
NSArray
arrayWithObject
:
NSFilenamesPboardType
];
NSString
*
o_desired_type
=
[
o_paste
availableTypeFromArray
:
o_types
];
NSData
*
o_carried_data
=
[
o_paste
dataForType
:
o_desired_type
];
return
[[
VLCConvertAndSave
sharedInstance
]
performDragOperation
:
sender
];
}
if
(
o_carried_data
)
{
if
(
[
o_desired_type
isEqualToString
:
NSFilenamesPboardType
]
)
{
NSArray
*
o_values
=
[[
o_paste
propertyListForType
:
NSFilenamesPboardType
]
sortedArrayUsingSelector
:
@selector
(
caseInsensitiveCompare
:)];
-
(
void
)
concludeDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
[
self
setNeedsDisplay
:
YES
];
}
if
([
o_values
count
]
>
0
)
{
id
VLCCAS
=
[
VLCConvertAndSave
sharedInstance
];
[
VLCCAS
setMRL
:
[
NSString
stringWithUTF8String
:
make_URI
([[
o_values
objectAtIndex
:
0
]
UTF8String
],
NULL
)]];
[
VLCCAS
updateDropView
];
return
YES
;
}
}
}
return
NO
;
@end
@implementation
VLCDropEnabledImageView
-
(
void
)
awakeFromNib
{
[
self
registerForDraggedTypes
:[
NSArray
arrayWithObject
:
NSFilenamesPboardType
]];
}
-
(
NSDragOperation
)
draggingEntered
:(
id
<
NSDraggingInfo
>
)
sender
{
if
((
NSDragOperationGeneric
&
[
sender
draggingSourceOperationMask
])
==
NSDragOperationGeneric
)
return
NSDragOperationGeneric
;
return
NSDragOperationNone
;
}
-
(
BOOL
)
prepareForDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
return
YES
;
}
-
(
BOOL
)
performDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
return
[[
VLCConvertAndSave
sharedInstance
]
performDragOperation
:
sender
];
}
-
(
void
)
concludeDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
...
...
@@ -135,4 +194,36 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
[
self
setNeedsDisplay
:
YES
];
}
@end
\ No newline at end of file
@end
@implementation
VLCDropEnabledButton
-
(
void
)
awakeFromNib
{
[
self
registerForDraggedTypes
:[
NSArray
arrayWithObject
:
NSFilenamesPboardType
]];
}
-
(
NSDragOperation
)
draggingEntered
:(
id
<
NSDraggingInfo
>
)
sender
{
if
((
NSDragOperationGeneric
&
[
sender
draggingSourceOperationMask
])
==
NSDragOperationGeneric
)
return
NSDragOperationGeneric
;
return
NSDragOperationNone
;
}
-
(
BOOL
)
prepareForDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
return
YES
;
}
-
(
BOOL
)
performDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
return
[[
VLCConvertAndSave
sharedInstance
]
performDragOperation
:
sender
];
}
-
(
void
)
concludeDragOperation
:(
id
<
NSDraggingInfo
>
)
sender
{
[
self
setNeedsDisplay
:
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