From 5e26c9c2771035df108db3d55e1a47083dd2a988 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 13 Sep 2022 21:22:39 -0600 Subject: [PATCH] library manager: display description in textview not tooltip --- gtk2_ardour/library_download_dialog.cc | 23 ++++++++++++++++++++++- gtk2_ardour/library_download_dialog.h | 4 ++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/library_download_dialog.cc b/gtk2_ardour/library_download_dialog.cc index 45c0bbaa33..918a8fe915 100644 --- a/gtk2_ardour/library_download_dialog.cc +++ b/gtk2_ardour/library_download_dialog.cc @@ -32,6 +32,7 @@ #include "gui_thread.h" #include "library_download_dialog.h" +#include "ui_config.h" using namespace PBD; using namespace ARDOUR; @@ -53,7 +54,7 @@ LibraryDownloadDialog::LibraryDownloadDialog () append_progress_column (); _display.set_headers_visible (true); - _display.set_tooltip_column (5); /* path */ + _display.set_hover_selection (true); _display.signal_button_press_event().connect (sigc::mem_fun (*this, &LibraryDownloadDialog::display_button_press), false); @@ -63,8 +64,15 @@ LibraryDownloadDialog::LibraryDownloadDialog () h->pack_start (_display); get_vbox()->set_spacing (8); + get_vbox()->set_border_width (12); get_vbox()->pack_start (*Gtk::manage (h)); + _display.get_selection()->set_mode (Gtk::SELECTION_SINGLE); + _display.get_selection()->signal_changed().connect (sigc::mem_fun (*this, &LibraryDownloadDialog::library_selected)); + + description_view.set_size_request (-1, 80); + description_view.set_wrap_mode (Gtk::WRAP_WORD); + get_vbox()->pack_start (description_view); ARDOUR::LibraryFetcher lf; lf.get_descriptions (); @@ -76,6 +84,19 @@ LibraryDownloadDialog::~LibraryDownloadDialog () delete inflater; } +void +LibraryDownloadDialog::library_selected () +{ + if (_display.get_selection()->count_selected_rows() == 0) { + description_view.get_buffer()->set_text (string()); + return; + } + + Gtk::TreeModel::iterator row = _display.get_selection()->get_selected(); + string txt = (*row)[_columns.description]; + description_view.get_buffer()->set_text (txt); +} + void LibraryDownloadDialog::append_progress_column () { diff --git a/gtk2_ardour/library_download_dialog.h b/gtk2_ardour/library_download_dialog.h index 926c53dc3c..a9298ac192 100644 --- a/gtk2_ardour/library_download_dialog.h +++ b/gtk2_ardour/library_download_dialog.h @@ -26,6 +26,7 @@ #include #include #include +#include #include "ardour_dialog.h" @@ -111,6 +112,9 @@ class LibraryDownloadDialog : public ArdourDialog void install_progress (size_t, size_t, std::string, Gtk::TreePath); void install_finished (Gtk::TreeModel::iterator row, std::string path, int status); PBD::ScopedConnection install_connection; + + Gtk::TextView description_view; + void library_selected (); };