mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-22 14:46:34 +01:00
support DnD in native/gtk-quartz implementation (note: multifile DnD requires a patch to GTK that is not in distribution yet, so for now, this works only with 1 file at a time, or it requires my patch/library).
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2319 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
f433b4e735
commit
327275f4c9
6 changed files with 105 additions and 11 deletions
|
|
@ -2695,8 +2695,10 @@ Editor::convert_drop_to_paths (vector<ustring>& paths,
|
|||
|
||||
vector<ustring> uris = data.get_uris();
|
||||
|
||||
cerr << "there were " << uris.size() << " in that drag data\n";
|
||||
|
||||
if (uris.empty()) {
|
||||
|
||||
|
||||
/* This is seriously fucked up. Nautilus doesn't say that its URI lists
|
||||
are actually URI lists. So do it by hand.
|
||||
*/
|
||||
|
|
@ -2746,10 +2748,35 @@ Editor::convert_drop_to_paths (vector<ustring>& paths,
|
|||
}
|
||||
|
||||
for (vector<ustring>::iterator i = uris.begin(); i != uris.end(); ++i) {
|
||||
|
||||
if ((*i).substr (0,7) == "file://") {
|
||||
string p = *i;
|
||||
|
||||
|
||||
ustring p = *i;
|
||||
PBD::url_decode (p);
|
||||
paths.push_back (p.substr (7));
|
||||
|
||||
// scan forward past three slashes
|
||||
|
||||
ustring::size_type slashcnt = 0;
|
||||
ustring::size_type n = 0;
|
||||
ustring::iterator x = p.begin();
|
||||
|
||||
while (slashcnt < 3 && x != p.end()) {
|
||||
if ((*x) == '/') {
|
||||
slashcnt++;
|
||||
} else if (slashcnt == 3) {
|
||||
break;
|
||||
}
|
||||
++n;
|
||||
++x;
|
||||
}
|
||||
|
||||
if (slashcnt != 3 || x == p.end()) {
|
||||
error << _("malformed URL passed to drag-n-drop code") << endmsg;
|
||||
continue;
|
||||
}
|
||||
|
||||
paths.push_back (p.substr (n - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue