diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-09 22:08:18 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-09 22:08:18 +0000 |
commit | 1082218dfadd636865c1b84fce1ca1d6c3dd23de (patch) | |
tree | 85a459a46a5753a8eb32ddc7c6035c85733c4893 /gtk2_ardour | |
parent | 6a67738db993971e62360e4d058b146957dafb1c (diff) |
fix for handling DnD path data, plus lots of d-n-d drop debugging (to be cleaned up)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4129 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/editor.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/editor_audio_import.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_region_list.cc | 6 |
4 files changed, 33 insertions, 11 deletions
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 49aa9010f5..e4514dd879 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -3048,12 +3048,19 @@ Editor::convert_drop_to_paths (vector<ustring>& paths, } /* Parse the "uri-list" format that Nautilus provides, - where each pathname is delimited by \r\n + where each pathname is delimited by \r\n. + + THERE MAY BE NO NULL TERMINATING CHAR!!! */ - - const char* p = data.get_text().c_str(); + + ustring txt = data.get_text(); + const char* p; const char* q; + p = (const char *) malloc (txt.length() + 1); + txt.copy ((char *) p, txt.length(), 0); + ((char*)p)[txt.length()] = '\0'; + while (p) { if (*p != '#') @@ -3062,8 +3069,9 @@ Editor::convert_drop_to_paths (vector<ustring>& paths, p++; q = p; - while (*q && (*q != '\n') && (*q != '\r')) + while (*q && (*q != '\n') && (*q != '\r')) { q++; + } if (q > p) { @@ -3082,6 +3090,8 @@ Editor::convert_drop_to_paths (vector<ustring>& paths, p++; } + free ((void*)p); + if (uris.empty()) { return -1; } diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index b290a54f4c..d8be18300f 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -310,6 +310,8 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo build_interthread_progress_window (); } + cerr << "Here we go .. disp = " << chns << " mode = " << mode << " @ " << pos << endl; + if (chns == Editing::ImportMergeFiles) { /* create 1 region from all paths, add to 1 track, ignore "track" @@ -324,6 +326,7 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo } if (!cancel) { + cerr << "Here we REALLY go ..\n"; if (import_sndfiles (paths, mode, quality, pos, 1, 1, track, false)) { ok = false; } @@ -362,6 +365,7 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo track = get_nth_selected_audio_track (nth++); } + cerr << "Here we REALLY go 2 ..\n"; if (import_sndfiles (to_import, mode, quality, pos, 1, -1, track, replace)) { ok = false; } @@ -373,6 +377,7 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo to_import.clear (); to_import.push_back (*a); + cerr << "Here we REALLY go 3 ..\n"; if (import_sndfiles (to_import, mode, quality, pos, -1, -1, track, replace)) { ok = false; } @@ -388,6 +393,7 @@ Editor::_do_import (vector<ustring> paths, ImportDisposition chns, ImportMode mo reuse "track" across paths */ + cerr << "Here we REALLY go 4 ..\n"; if (import_sndfiles (to_import, mode, quality, pos, 1, 1, track, replace)) { ok = false; } @@ -501,7 +507,7 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual interthread_progress_window->set_position (Gtk::WIN_POS_MOUSE); interthread_progress_bar.set_fraction (0.0f); interthread_cancel_label.set_text (_("Cancel Import")); - current_interthread_info = &import_status; + current_interthread_info = &import_status; import_status.paths = paths; import_status.done = false; @@ -521,13 +527,20 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual and if successful will add the file(s) as a region to the session region list. */ + cerr << "Creating import thread\n"; + pthread_create_and_store ("import", &import_status.thread, 0, _import_thread, this); pthread_detach (import_status.thread); + cerr << "into rec loop while thread runs\n"; + while (!(import_status.done || import_status.cancel)) { gtk_main_iteration (); } + cerr << "back from rec loop while thread run, status.cancel = " << import_status.cancel + << " done = " << import_status.done << " progress = " << import_status.progress << endl; + interthread_progress_window->hide (); import_status.done = true; @@ -538,6 +551,7 @@ Editor::import_sndfiles (vector<ustring> paths, ImportMode mode, SrcQuality qual boost::shared_ptr<AudioRegion> r; if (import_status.cancel || import_status.sources.empty()) { + cerr << "Cancelled ? " << import_status.cancel << " or no files\n"; goto out; } diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index 7aed067010..fbfd4770e7 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -474,6 +474,10 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context, goto out; } + for (vector<ustring>::iterator xx = paths.begin(); xx != paths.end(); ++xx) { + cerr << "Drop path = " << *xx << endl; + } + /* D-n-D coordinates are window-relative, so convert to "world" coordinates */ diff --git a/gtk2_ardour/editor_region_list.cc b/gtk2_ardour/editor_region_list.cc index 666fadb790..b3bfbcc95f 100644 --- a/gtk2_ardour/editor_region_list.cc +++ b/gtk2_ardour/editor_region_list.cc @@ -386,8 +386,6 @@ Editor::region_list_display_button_press (GdkEventButton *ev) int cellx; int celly; - // cerr << "Button press release, button = " << ev->button << endl; - if (region_list_display.get_path_at_pos ((int)ev->x, (int)ev->y, path, column, cellx, celly)) { if ((iter = region_list_model->get_iter (path))) { region = (*iter)[region_list_columns.region]; @@ -396,12 +394,10 @@ Editor::region_list_display_button_press (GdkEventButton *ev) if (Keyboard::is_context_menu_event (ev)) { show_region_list_display_context_menu (ev->button, ev->time); - cerr << "\tcontext menu event, event handled\n"; return true; } if (region == 0) { - cerr << "\tno region, event not handled\n"; return false; } @@ -414,7 +410,6 @@ Editor::region_list_display_button_press (GdkEventButton *ev) if (!Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { consider_auditioning (region); } - cerr << "\taudition, event handled\n"; return true; break; @@ -422,7 +417,6 @@ Editor::region_list_display_button_press (GdkEventButton *ev) break; } - cerr << "\tnot handled\n"; return false; } |