diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-11-18 12:33:53 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-11-18 12:33:53 +0000 |
| commit | f1a9fc07d9f4cfa94da390247c25ce4ba693a34e (patch) | |
| tree | e2086e2b37c097ab210558c879c16c3a59e9ec67 /src/ui | |
| parent | Fix for 177931 : Layer dialog toggle solo mode with Shift/Alt click (diff) | |
| download | inkscape-f1a9fc07d9f4cfa94da390247c25ce4ba693a34e.tar.gz inkscape-f1a9fc07d9f4cfa94da390247c25ce4ba693a34e.zip | |
Fix for 1079971 : Symbol dialog : Drag & Drop to the canvas
(bzr r11880)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/symbols.cpp | 27 | ||||
| -rw-r--r-- | src/ui/dialog/symbols.h | 1 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 4e1b82ebe..8cf48f827 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -123,6 +123,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : iconView->set_tooltip_column( 1 ); iconView->set_pixbuf_column( columns->symbol_image ); + std::vector< Gtk::TargetEntry > targets; + targets.push_back(Gtk::TargetEntry( "application/x-inkscape-paste")); + + iconView->enable_model_drag_source (targets, Gdk::BUTTON1_MASK, Gdk::ACTION_COPY); + iconView->signal_drag_data_get().connect(sigc::mem_fun(*this, &SymbolsDialog::iconDragDataGet)); + sigc::connection connIconChanged; connIconChanged = iconView->signal_selection_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::iconChanged)); @@ -228,6 +234,27 @@ void SymbolsDialog::rebuild() { draw_symbols( symbolDocument ); } +void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& data, guint info, guint time) { + +#if WITH_GTKMM_3_0 + std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); +#else + Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); +#endif + + if( iconArray.empty() ) { + //std::cout << " iconArray empty: huh? " << std::endl; + } else { + Gtk::TreeModel::Path const & path = *iconArray.begin(); + Gtk::ListStore::iterator row = store->get_iter(path); + Glib::ustring symbol_id = (*row)[getColumns()->symbol_id]; + + GdkAtom dataAtom = gdk_atom_intern( "application/x-inkscape-paste", FALSE ); + gtk_selection_data_set( data.gobj(), dataAtom, 9, (guchar*)symbol_id.c_str(), symbol_id.length() ); + } + +} + void SymbolsDialog::iconChanged() { #if WITH_GTKMM_3_0 std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h index c2bb4448e..5486ff546 100644 --- a/src/ui/dialog/symbols.h +++ b/src/ui/dialog/symbols.h @@ -54,6 +54,7 @@ private: void rebuild(); void iconChanged(); + void iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time); void get_symbols(); void draw_symbols( SPDocument* symbol_document ); |
