mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
many changes, read the diffs
git-svn-id: svn://localhost/trunk/ardour2@214 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
0faaa3ad7b
commit
d43cc4e7b5
21 changed files with 378 additions and 303 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include <cstdio>
|
||||
#include <iostream>
|
||||
|
||||
#include <gtkmm2ext/dndtreeview.h>
|
||||
|
||||
|
|
@ -13,13 +14,24 @@ DnDTreeView::DnDTreeView ()
|
|||
: TreeView ()
|
||||
{
|
||||
draggable.push_back (TargetEntry ("GTK_TREE_MODEL_ROW", TARGET_SAME_WIDGET));
|
||||
|
||||
data_column = -1;
|
||||
|
||||
enable_model_drag_source (draggable);
|
||||
enable_model_drag_dest (draggable);
|
||||
|
||||
suggested_action = Gdk::DragAction (0);
|
||||
|
||||
suggested_action = Gdk::DragAction (0);
|
||||
}
|
||||
|
||||
void
|
||||
DnDTreeView::add_drop_targets (list<TargetEntry>& targets)
|
||||
{
|
||||
for (list<TargetEntry>::iterator i = targets.begin(); i != targets.end(); ++i) {
|
||||
draggable.push_back (*i);
|
||||
}
|
||||
enable_model_drag_source (draggable);
|
||||
enable_model_drag_dest (draggable);
|
||||
}
|
||||
|
||||
void
|
||||
DnDTreeView::add_object_drag (int column, string type_name)
|
||||
{
|
||||
|
|
@ -57,11 +69,13 @@ DnDTreeView::serialize_pointers (RefPtr<TreeModel> model, TreeSelection::ListHan
|
|||
void
|
||||
DnDTreeView::on_drag_data_get(const RefPtr<DragContext>& context, SelectionData& selection_data, guint info, guint time)
|
||||
{
|
||||
cerr << "DnDTreeview::drag_data_get, target = " << selection_data.get_target() << endl;
|
||||
|
||||
if (selection_data.get_target() == "GTK_TREE_MODEL_ROW") {
|
||||
|
||||
TreeView::on_drag_data_get (context, selection_data, info, time);
|
||||
|
||||
} else {
|
||||
} else if (data_column >= 0) {
|
||||
|
||||
Gtk::TreeSelection::ListHandle_Path selection = get_selection()->get_selected_rows ();
|
||||
SerializedObjectPointers* sr = serialize_pointers (get_model(), &selection, selection_data.get_target());
|
||||
|
|
@ -73,20 +87,23 @@ DnDTreeView::on_drag_data_get(const RefPtr<DragContext>& context, SelectionData&
|
|||
void
|
||||
DnDTreeView::on_drag_data_received(const RefPtr<DragContext>& context, int x, int y, const SelectionData& selection_data, guint info, guint time)
|
||||
{
|
||||
if (suggested_action) {
|
||||
/* this is a drag motion callback. just update the status to
|
||||
say that we are still dragging, and that's it.
|
||||
*/
|
||||
suggested_action = Gdk::DragAction (0);
|
||||
TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
|
||||
return;
|
||||
}
|
||||
|
||||
cerr << "DnDTreeview::drag_data_received @ " << x << ',' << y << " target = " << selection_data.get_target() << endl;
|
||||
|
||||
if (suggested_action) {
|
||||
/* this is a drag motion callback. just update the status to
|
||||
say that we are still dragging, and that's it.
|
||||
*/
|
||||
suggested_action = Gdk::DragAction (0);
|
||||
TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
|
||||
return;
|
||||
}
|
||||
|
||||
if (selection_data.get_target() == "GTK_TREE_MODEL_ROW") {
|
||||
|
||||
TreeView::on_drag_data_received (context, x, y, selection_data, info, time);
|
||||
|
||||
} else {
|
||||
} else if (data_column >= 0) {
|
||||
|
||||
/* object D-n-D */
|
||||
|
||||
const SerializedObjectPointers* sr = reinterpret_cast<const SerializedObjectPointers *>(selection_data.get_data());
|
||||
|
|
@ -94,9 +111,9 @@ DnDTreeView::on_drag_data_received(const RefPtr<DragContext>& context, int x, in
|
|||
if (sr) {
|
||||
signal_object_drop (sr->type, sr->cnt, const_cast<void**>(sr->ptr));
|
||||
}
|
||||
|
||||
context->drag_finish (true, false, time);
|
||||
|
||||
|
||||
} else {
|
||||
/* some kind of target type added by the app, which will be handled by a signal handler */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ UI::UI (string name, int *argc, char ***argv, string rcfile)
|
|||
theMain = new Main (argc, argv);
|
||||
tips = new Tooltips;
|
||||
|
||||
// allow run-time rebinding of accels
|
||||
|
||||
Settings::get_default()->property_gtk_can_change_accels() = true;
|
||||
|
||||
if (pthread_key_create (&thread_request_buffer_key, 0)) {
|
||||
cerr << _("cannot create thread request buffer key") << endl;
|
||||
throw failed_constructor();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class DnDTreeView : public Gtk::TreeView
|
|||
DnDTreeView ();
|
||||
~DnDTreeView() {}
|
||||
|
||||
void add_drop_targets (std::list<Gtk::TargetEntry>&);
|
||||
void add_object_drag (int column, std::string type_name);
|
||||
sigc::signal<void,std::string,uint32_t,void**> signal_object_drop;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue