2021-05-26 19:02:11 -04:00
/*
* Copyright ( C ) 2021 Robin Gareus < robin @ gareus . org >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation ; either version 2 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License along
* with this program ; if not , write to the Free Software Foundation , Inc . ,
* 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
*/
# ifdef WAF_BUILD
# include "gtk2ardour-config.h"
# endif
2021-06-18 15:21:46 -04:00
# include <cassert>
# include <gtkmm/frame.h>
2021-07-15 23:52:16 -04:00
# include <gtkmm/stock.h>
2021-06-18 15:21:46 -04:00
2021-07-13 15:00:23 -04:00
# include "pbd/openuri.h"
2021-06-18 15:21:46 -04:00
# include "pbd/unwind.h"
2021-05-26 19:02:11 -04:00
# include "ardour/types_convert.h"
# include "gtkmm2ext/gui_thread.h"
2021-07-07 12:07:52 -04:00
# include "widgets/paths_dialog.h"
2021-07-12 18:47:18 -04:00
# include "widgets/tooltips.h"
2021-05-26 19:02:11 -04:00
2021-06-18 15:21:46 -04:00
# include "ardour_message.h"
2021-07-06 20:11:06 -04:00
# include "ardour_ui.h"
2021-07-16 01:34:43 -04:00
# include "plugin_manager_ui.h"
2021-06-18 15:21:46 -04:00
# include "plugin_scan_dialog.h"
2021-07-15 23:52:16 -04:00
# include "plugin_utils.h"
2021-07-16 01:34:43 -04:00
# include "rc_option_editor.h"
2021-05-26 19:02:11 -04:00
# include "pbd/i18n.h"
using namespace ARDOUR ;
2021-07-16 01:21:01 -04:00
using namespace Gtk ;
2021-07-15 23:52:16 -04:00
using namespace ArdourWidgets ;
using namespace ARDOUR_PLUGIN_UTILS ;
2021-05-26 19:02:11 -04:00
PluginManagerUI : : PluginManagerUI ( )
: ArdourWindow ( _ ( " Plugin Manager " ) )
2021-07-16 19:10:29 -04:00
, _btn_reindex ( _ ( " Update Index Only " ) )
Fix typos in gtk2_ardour/ directory
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sur,te,trough,ue`
2022-01-26 12:35:38 -05:00
, _btn_discover ( _ ( " Discover New/Updated " ) )
2021-06-18 15:21:46 -04:00
, _btn_rescan_all ( _ ( " Re-scan All " ) )
, _btn_rescan_err ( _ ( " Re-scan Faulty " ) )
2021-05-26 19:02:11 -04:00
, _btn_rescan_sel ( _ ( " Re-scan Selected " ) )
, _btn_clear ( _ ( " Clear Stale Scan Log " ) )
2021-07-06 20:11:06 -04:00
, _btn_prefs ( _ ( " Show Plugin Prefs " ) )
2021-07-15 23:52:16 -04:00
, _cb_search_name ( _ ( " Name " ) , ArdourButton : : led_default_elements , true )
, _cb_search_type ( _ ( " Type " ) , ArdourButton : : led_default_elements , true )
2021-07-16 12:40:51 -04:00
, _cb_search_tags ( _ ( " Tags " ) , ArdourButton : : led_default_elements , true )
2021-07-15 23:52:16 -04:00
, _cb_search_creator ( _ ( " Maker " ) , ArdourButton : : led_default_elements , true )
2021-07-16 12:40:51 -04:00
, _cb_search_base_name ( _ ( " File " ) , ArdourButton : : led_default_elements , true )
, _cb_search_full_path ( _ ( " Path " ) , ArdourButton : : led_default_elements , true )
2021-06-18 15:21:46 -04:00
, _in_row_change ( false )
2021-07-16 12:40:51 -04:00
, _in_search_change ( false )
2021-05-26 19:02:11 -04:00
{
2021-07-16 01:21:01 -04:00
plugin_model = ListStore : : create ( plugin_columns ) ;
2021-05-26 19:02:11 -04:00
2021-07-16 01:34:43 -04:00
CellRendererToggle * cell_blacklist = manage ( new CellRendererToggle ( ) ) ;
TreeViewColumn * column_blacklist = manage ( new TreeViewColumn ( " " , * cell_blacklist ) ) ;
2021-06-18 15:21:46 -04:00
2021-07-16 01:34:43 -04:00
cell_blacklist - > property_activatable ( ) = true ;
cell_blacklist - > property_radio ( ) = false ;
2021-06-18 15:21:46 -04:00
column_blacklist - > add_attribute ( cell_blacklist - > property_active ( ) , plugin_columns . blacklisted ) ;
column_blacklist - > add_attribute ( cell_blacklist - > property_activatable ( ) , plugin_columns . can_blacklist ) ;
2021-07-16 01:34:43 -04:00
CellRendererToggle * cell_fav = manage ( new CellRendererToggle ( ) ) ;
TreeViewColumn * column_fav = manage ( new TreeViewColumn ( " " , * cell_fav ) ) ;
2021-06-18 15:21:46 -04:00
2021-07-16 01:34:43 -04:00
cell_fav - > property_activatable ( ) = true ;
cell_fav - > property_radio ( ) = true ;
2021-06-18 15:21:46 -04:00
column_fav - > add_attribute ( cell_fav - > property_active ( ) , plugin_columns . favorite ) ;
column_fav - > add_attribute ( cell_fav - > property_activatable ( ) , plugin_columns . can_fav_hide ) ;
2021-07-16 01:34:43 -04:00
CellRendererToggle * cell_hidden = manage ( new CellRendererToggle ( ) ) ;
TreeViewColumn * column_hidden = manage ( new TreeViewColumn ( " " , * cell_hidden ) ) ;
2021-06-18 15:21:46 -04:00
2021-07-16 01:34:43 -04:00
cell_hidden - > property_activatable ( ) = true ;
cell_hidden - > property_radio ( ) = true ;
2021-06-18 15:21:46 -04:00
column_hidden - > add_attribute ( cell_hidden - > property_active ( ) , plugin_columns . hidden ) ;
column_hidden - > add_attribute ( cell_hidden - > property_activatable ( ) , plugin_columns . can_fav_hide ) ;
2021-07-12 18:47:18 -04:00
plugin_display . append_column ( " " , plugin_columns . status ) ;
2021-06-18 15:21:46 -04:00
plugin_display . append_column ( * column_blacklist ) ;
plugin_display . append_column ( * column_fav ) ;
plugin_display . append_column ( * column_hidden ) ;
2021-07-12 18:47:18 -04:00
plugin_display . append_column ( " " , plugin_columns . type ) ;
plugin_display . append_column ( " " , plugin_columns . path ) ;
2021-07-16 12:40:51 -04:00
plugin_display . append_column ( " " , plugin_columns . name ) ;
plugin_display . append_column ( " " , plugin_columns . creator ) ;
plugin_display . append_column ( " " , plugin_columns . tags ) ;
2021-07-12 18:47:18 -04:00
struct ColumnInfo {
2021-07-16 01:21:01 -04:00
AlignmentEnum al ;
bool resizable ;
const char * label ;
const char * tooltip ;
2021-07-12 18:47:18 -04:00
} ci [ ] = {
/* clang-format off */
2022-01-26 16:19:32 -05:00
{ ALIGN_START , false , _ ( " Status " ) , _ ( " Plugin Scan Result " ) } ,
2021-07-22 10:50:20 -04:00
{ ALIGN_CENTER , false , S_ ( " Ignore|Ign " ) , _ ( " Ignore this plugin (and others that are loaded in the same file) " ) } ,
2021-08-12 07:46:41 -04:00
{ ALIGN_CENTER , false , S_ ( " Favorite|Fav " ) , _ ( " Add this plugin to the favorite list " ) } ,
2021-07-16 12:40:51 -04:00
{ ALIGN_CENTER , false , _ ( " Hide " ) , _ ( " Hide this plugin in the plugin-selector " ) } ,
{ ALIGN_CENTER , false , _ ( " Type " ) , _ ( " Plugin standard " ) } ,
2022-01-26 16:19:32 -05:00
{ ALIGN_START , true , _ ( " File/ID " ) , _ ( " The plugin file (VST) or unique ID (AU, LV2) " ) } ,
2021-07-16 12:40:51 -04:00
{ ALIGN_CENTER , true , _ ( " Name " ) , _ ( " Name of the plugin " ) } ,
{ ALIGN_CENTER , true , _ ( " Creator " ) , _ ( " The plugin's vendor " ) } ,
{ ALIGN_CENTER , true , _ ( " Tags " ) , _ ( " Meta data: category and tags " ) } ,
2021-07-12 18:47:18 -04:00
} ;
/* clang-format on */
2021-07-16 12:40:51 -04:00
for ( unsigned int i = 0 ; i < sizeof ( ci ) / sizeof ( ColumnInfo ) ; + + i ) {
2021-07-16 01:21:01 -04:00
Label * l = manage ( new Label ( ci [ i ] . label ) ) ;
2021-07-12 18:47:18 -04:00
l - > set_alignment ( ci [ i ] . al ) ;
l - > show ( ) ;
2021-07-16 12:40:51 -04:00
TreeViewColumn * col = plugin_display . get_column ( i ) ;
2021-07-12 18:47:18 -04:00
col - > set_widget ( * l ) ;
col - > set_alignment ( ci [ i ] . al ) ;
col - > set_expand ( false ) ;
2021-07-16 12:40:51 -04:00
col - > set_sort_column ( i ) ;
2021-07-12 18:47:18 -04:00
col - > set_resizable ( ci [ i ] . resizable ) ;
ArdourWidgets : : set_tooltip ( * l , ci [ i ] . tooltip ) ;
}
2021-05-26 19:02:11 -04:00
2021-07-16 12:40:51 -04:00
plugin_display . set_tooltip_column ( 5 ) ; // plugin_columns.tip
2021-05-26 19:02:11 -04:00
plugin_display . set_model ( plugin_model ) ;
plugin_display . set_headers_visible ( true ) ;
plugin_display . set_headers_clickable ( true ) ;
plugin_display . set_reorderable ( false ) ;
plugin_display . set_rules_hint ( true ) ;
2021-07-16 01:34:43 -04:00
plugin_display . set_enable_search ( true ) ;
plugin_display . set_name ( " PluginSelectorDisplay " ) ;
2021-05-26 19:02:11 -04:00
2021-07-16 01:34:43 -04:00
plugin_model - > set_sort_column ( plugin_columns . name . index ( ) , SORT_ASCENDING ) ;
2021-05-26 19:02:11 -04:00
2021-07-16 01:34:43 -04:00
plugin_display . get_selection ( ) - > set_mode ( SELECTION_SINGLE ) ;
plugin_display . get_selection ( ) - > signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : selection_changed ) ) ;
plugin_display . signal_row_activated ( ) . connect_notify ( sigc : : mem_fun ( * this , & PluginManagerUI : : row_activated ) ) ;
2021-05-26 19:02:11 -04:00
_scroller . add ( plugin_display ) ;
2021-07-16 01:21:01 -04:00
_scroller . set_policy ( POLICY_AUTOMATIC , POLICY_AUTOMATIC ) ;
2021-05-26 19:02:11 -04:00
_log . set_editable ( false ) ;
2021-07-16 01:21:01 -04:00
_log . set_wrap_mode ( WRAP_WORD ) ;
2021-05-26 19:02:11 -04:00
2021-07-16 01:34:43 -04:00
_log_scroller . set_shadow_type ( SHADOW_NONE ) ;
_log_scroller . set_border_width ( 0 ) ;
2021-05-26 19:02:11 -04:00
_log_scroller . add ( _log ) ;
2021-07-16 01:21:01 -04:00
_log_scroller . set_policy ( POLICY_NEVER , POLICY_AUTOMATIC ) ;
2021-05-26 19:02:11 -04:00
_pane . add ( _scroller ) ;
_pane . add ( _log_scroller ) ;
_pane . set_divider ( 0 , .85 ) ;
2021-07-16 01:21:01 -04:00
Label * lbl = manage ( new Label ( " " ) ) ; // spacer
2023-01-22 19:34:25 -05:00
Gtk : : Frame * f_info = manage ( new Gtk : : Frame ( _ ( " Plugin Count " ) ) ) ;
Gtk : : Frame * f_paths = manage ( new Gtk : : Frame ( _ ( " Preferences " ) ) ) ;
Gtk : : Frame * f_search = manage ( new Gtk : : Frame ( _ ( " Search " ) ) ) ;
Gtk : : Frame * f_actions = manage ( new Gtk : : Frame ( _ ( " Scan Actions " ) ) ) ;
2021-07-16 01:21:01 -04:00
VBox * b_paths = manage ( new VBox ( ) ) ;
VBox * b_actions = manage ( new VBox ( ) ) ;
2021-06-18 15:21:46 -04:00
f_info - > add ( _tbl_nfo ) ;
f_actions - > add ( * b_actions ) ;
2021-07-06 20:11:06 -04:00
f_paths - > add ( * b_paths ) ;
2021-07-15 23:52:16 -04:00
f_search - > add ( _tbl_search ) ;
2021-06-18 15:21:46 -04:00
_tbl_nfo . set_border_width ( 4 ) ;
2021-07-16 12:40:51 -04:00
_tbl_nfo . set_row_spacings ( 0 ) ;
_tbl_nfo . set_col_spacings ( 3 ) ;
_tbl_nfo . set_row_spacing ( 0 , 3 ) ;
2021-06-18 15:21:46 -04:00
2021-09-09 09:29:25 -04:00
b_actions - > pack_start ( _btn_discover ) ;
b_actions - > pack_start ( _btn_reindex ) ;
2021-06-18 15:21:46 -04:00
b_actions - > pack_start ( _btn_rescan_sel ) ;
b_actions - > pack_start ( _btn_rescan_err ) ;
b_actions - > pack_start ( _btn_rescan_all ) ;
2021-09-09 09:29:25 -04:00
b_actions - > pack_start ( _btn_clear ) ;
2021-06-18 15:21:46 -04:00
b_actions - > set_spacing ( 4 ) ;
b_actions - > set_border_width ( 4 ) ;
2021-05-26 19:02:11 -04:00
2021-07-16 12:40:51 -04:00
/* search table */
_tbl_search . set_border_width ( 4 ) ;
2021-07-16 01:34:43 -04:00
_cb_search_name . set_active ( true ) ;
_cb_search_type . set_active ( false ) ;
2021-07-16 12:40:51 -04:00
_cb_search_tags . set_active ( false ) ;
2021-07-16 01:34:43 -04:00
_cb_search_creator . set_active ( true ) ;
2021-07-16 12:40:51 -04:00
_cb_search_base_name . set_active ( true ) ;
2021-07-16 01:34:43 -04:00
_cb_search_full_path . set_active ( false ) ;
2021-07-16 12:40:51 -04:00
_cb_search_name . set_led_left ( true ) ;
_cb_search_type . set_led_left ( true ) ;
_cb_search_tags . set_led_left ( true ) ;
_cb_search_creator . set_led_left ( true ) ;
_cb_search_base_name . set_led_left ( true ) ;
_cb_search_full_path . set_led_left ( true ) ;
2021-07-15 23:52:16 -04:00
_cb_search_name . set_name ( " pluginlist filter button " ) ;
_cb_search_type . set_name ( " pluginlist filter button " ) ;
2021-07-16 12:40:51 -04:00
_cb_search_tags . set_name ( " pluginlist filter button " ) ;
2021-07-15 23:52:16 -04:00
_cb_search_creator . set_name ( " pluginlist filter button " ) ;
2021-07-16 12:46:51 -04:00
_cb_search_base_name . set_name ( " pluginlist radio button " ) ;
_cb_search_full_path . set_name ( " pluginlist radio button " ) ;
2021-07-15 23:52:16 -04:00
2021-07-16 01:21:01 -04:00
Widget * w = manage ( new Image ( Stock : : CLEAR , ICON_SIZE_MENU ) ) ;
2021-07-16 01:34:43 -04:00
w - > show ( ) ;
_btn_search_clear . add ( * w ) ;
2021-07-15 23:52:16 -04:00
2021-07-16 01:34:43 -04:00
/* clang-format off */
2021-07-16 01:21:01 -04:00
_tbl_search . attach ( _entry_search , 0 , 2 , 0 , 1 , FILL | EXPAND , FILL ) ;
2021-07-16 12:40:51 -04:00
_tbl_search . attach ( _btn_search_clear , 2 , 3 , 0 , 1 , FILL , FILL , 1 , 0 ) ;
_tbl_search . attach ( _cb_search_name , 0 , 1 , 1 , 2 , FILL , FILL , 0 , 2 ) ;
2021-07-16 01:21:01 -04:00
_tbl_search . attach ( _cb_search_type , 1 , 2 , 1 , 2 , FILL , FILL , 2 , 2 ) ;
2021-07-16 12:40:51 -04:00
_tbl_search . attach ( _cb_search_creator , 0 , 1 , 2 , 3 , FILL , FILL , 0 , 2 ) ;
_tbl_search . attach ( _cb_search_tags , 1 , 2 , 2 , 3 , FILL , FILL , 2 , 2 ) ;
_tbl_search . attach ( _cb_search_base_name , 0 , 1 , 3 , 4 , FILL , FILL , 0 , 2 ) ;
_tbl_search . attach ( _cb_search_full_path , 1 , 2 , 3 , 4 , FILL , FILL , 2 , 2 ) ;
2021-07-16 01:34:43 -04:00
/* clang-format on */
2021-07-15 23:52:16 -04:00
/* prefs / plugin-paths buttons */
2021-07-06 20:11:06 -04:00
# if defined LXVST_SUPPORT
2021-07-16 01:21:01 -04:00
ArdourWidgets : : ArdourButton * btn_lxvst = manage ( new ArdourWidgets : : ArdourButton ( _ ( " Linux VST2 Path " ) ) ) ;
2021-07-12 18:47:18 -04:00
ArdourWidgets : : set_tooltip ( * btn_lxvst , _ ( " Configure where to look for VST2 plugins. " ) ) ;
2021-07-07 12:07:52 -04:00
btn_lxvst - > signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : vst_path_cb ) , LXVST ) ) ;
2021-07-06 20:11:06 -04:00
b_paths - > pack_start ( * btn_lxvst ) ;
# endif
# ifdef WINDOWS_VST_SUPPORT
2021-07-16 01:21:01 -04:00
ArdourWidgets : : ArdourButton * btn_winvst = manage ( new ArdourWidgets : : ArdourButton ( _ ( " Windows VST2 Path " ) ) ) ;
2021-07-12 18:47:18 -04:00
ArdourWidgets : : set_tooltip ( * btn_winvst , _ ( " Configure where to look for VST2 plugins. " ) ) ;
2021-07-07 12:07:52 -04:00
btn_winvst - > signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : vst_path_cb ) , Windows_VST ) ) ;
2021-07-06 20:11:06 -04:00
b_paths - > pack_start ( * btn_winvst ) ;
# endif
# ifdef VST3_SUPPORT
2021-07-16 01:21:01 -04:00
ArdourWidgets : : ArdourButton * btn_vst3 = manage ( new ArdourWidgets : : ArdourButton ( _ ( " VST3 Path " ) ) ) ;
2021-07-12 18:47:18 -04:00
ArdourWidgets : : set_tooltip ( * btn_vst3 , _ ( " Configure where to look for VST3 plugins in addition to the default VST3 locations. " ) ) ;
2021-07-07 12:07:52 -04:00
btn_vst3 - > signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : vst_path_cb ) , VST3 ) ) ;
2021-07-06 20:11:06 -04:00
b_paths - > pack_start ( * btn_vst3 ) ;
# endif
b_paths - > pack_start ( _btn_prefs ) ;
b_paths - > set_spacing ( 4 ) ;
b_paths - > set_border_width ( 4 ) ;
2021-07-12 18:47:18 -04:00
/* tooltips */
2021-07-16 01:34:43 -04:00
/* clang-format off */
2021-07-16 19:10:29 -04:00
ArdourWidgets : : set_tooltip ( _btn_reindex , _ ( " Only update plugin index, do not discover new plugins. " ) ) ;
2021-09-09 09:29:25 -04:00
ArdourWidgets : : set_tooltip ( _btn_discover , _ ( " Update Index and scan newly installed or updated plugins. " ) ) ;
2021-07-22 14:08:14 -04:00
ArdourWidgets : : set_tooltip ( _btn_rescan_all , _ ( " Scans all plugins, regardless if they have already been successfully scanned. \n Depending on the number of plugins installed this can take a long time. " ) ) ;
2021-07-12 20:28:20 -04:00
ArdourWidgets : : set_tooltip ( _btn_rescan_err , _ ( " Scans plugins that have not yet been successfully scanned. " ) ) ;
2021-07-12 18:47:18 -04:00
ArdourWidgets : : set_tooltip ( _btn_rescan_sel , _ ( " Scans the selected plugin. " ) ) ;
ArdourWidgets : : set_tooltip ( _btn_clear , _ ( " Forget about plugins that have been removed from the system. " ) ) ;
ArdourWidgets : : set_tooltip ( _btn_prefs , _ ( " Open preference window " ) ) ;
2021-07-16 12:40:51 -04:00
ArdourWidgets : : set_tooltip ( _cb_search_name , _ ( " Match plugin name " ) ) ;
ArdourWidgets : : set_tooltip ( _cb_search_type , _ ( " Match plugin type " ) ) ;
ArdourWidgets : : set_tooltip ( _cb_search_tags , _ ( " Match any tag " ) ) ;
ArdourWidgets : : set_tooltip ( _cb_search_creator , _ ( " Match plugin vendor " ) ) ;
ArdourWidgets : : set_tooltip ( _cb_search_base_name , _ ( " Match File/ID " ) ) ;
ArdourWidgets : : set_tooltip ( _cb_search_full_path , _ ( " Match complete file install path on disk " ) ) ;
2021-07-16 01:34:43 -04:00
/* clang-format on */
2021-07-12 18:47:18 -04:00
2021-05-26 19:02:11 -04:00
/* top level packing */
2021-07-16 01:34:43 -04:00
/* clang-format off */
2021-07-16 01:21:01 -04:00
_top . attach ( * f_search , 0 , 1 , 0 , 1 , FILL | SHRINK , SHRINK , 4 , 0 ) ;
_top . attach ( * lbl , 0 , 1 , 1 , 2 , SHRINK , EXPAND | FILL , 4 , 0 ) ;
_top . attach ( * f_info , 0 , 1 , 2 , 3 , FILL | SHRINK , SHRINK , 4 , 4 ) ;
_top . attach ( * f_actions , 0 , 1 , 3 , 4 , FILL | SHRINK , SHRINK , 4 , 4 ) ;
_top . attach ( * f_paths , 0 , 1 , 4 , 5 , FILL | SHRINK , SHRINK , 4 , 4 ) ;
_top . attach ( _pane , 1 , 2 , 0 , 5 , EXPAND | FILL , EXPAND | FILL , 4 , 0 ) ;
2021-07-16 01:34:43 -04:00
/* clang-format on */
2021-05-26 19:02:11 -04:00
add ( _top ) ;
2021-06-18 15:21:46 -04:00
_top . show_all ( ) ;
2021-05-26 19:02:11 -04:00
_log . set_size_request ( 400 , - 1 ) ;
set_size_request ( - 1 , 600 ) ;
/* connect to signals */
2024-10-18 19:51:44 -04:00
PluginManager : : instance ( ) . PluginListChanged . connect ( _manager_connections , invalidator ( * this ) , std : : bind ( & PluginManagerUI : : refill , this ) , gui_context ( ) ) ;
PluginManager : : instance ( ) . PluginScanLogChanged . connect ( _manager_connections , invalidator ( * this ) , std : : bind ( & PluginManagerUI : : refill , this ) , gui_context ( ) ) ;
PluginManager : : instance ( ) . PluginStatusChanged . connect ( _manager_connections , invalidator ( * this ) , std : : bind ( & PluginManagerUI : : plugin_status_changed , this , _1 , _2 , _3 ) , gui_context ( ) ) ;
2021-06-18 15:21:46 -04:00
2021-07-16 19:10:29 -04:00
_btn_reindex . signal_clicked . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : reindex ) ) ;
2021-09-09 09:29:25 -04:00
_btn_discover . signal_clicked . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : discover ) ) ;
2021-05-26 19:02:11 -04:00
_btn_rescan_all . signal_clicked . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : rescan_all ) ) ;
2021-06-18 15:21:46 -04:00
_btn_rescan_err . signal_clicked . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : rescan_faulty ) ) ;
2021-05-26 19:02:11 -04:00
_btn_rescan_sel . signal_clicked . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : rescan_selected ) ) ;
_btn_clear . signal_clicked . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : clear_log ) ) ;
2021-07-06 20:11:06 -04:00
_btn_prefs . signal_clicked . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : show_plugin_prefs ) ) ;
2021-06-18 15:21:46 -04:00
2021-07-16 01:34:43 -04:00
cell_fav - > signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : favorite_changed ) ) ;
cell_hidden - > signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : hidden_changed ) ) ;
cell_blacklist - > signal_toggled ( ) . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : blacklist_changed ) ) ;
_entry_search . signal_changed ( ) . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : search_entry_changed ) ) ;
_btn_search_clear . signal_clicked ( ) . connect ( sigc : : mem_fun ( * this , & PluginManagerUI : : search_clear_button_clicked ) ) ;
2021-07-15 23:52:16 -04:00
2021-07-16 12:40:51 -04:00
_cb_search_name . signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : maybe_refill ) , ( ArdourButton * ) 0 ) ) ;
_cb_search_tags . signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : maybe_refill ) , ( ArdourButton * ) 0 ) ) ;
_cb_search_type . signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : maybe_refill ) , ( ArdourButton * ) 0 ) ) ;
_cb_search_creator . signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : maybe_refill ) , ( ArdourButton * ) 0 ) ) ;
_cb_search_base_name . signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : maybe_refill ) , & _cb_search_base_name ) ) ;
_cb_search_full_path . signal_clicked . connect ( sigc : : bind ( sigc : : mem_fun ( * this , & PluginManagerUI : : maybe_refill ) , & _cb_search_full_path ) ) ;
2021-06-18 15:21:46 -04:00
/* populate */
refill ( ) ;
2021-05-26 19:02:11 -04:00
}
PluginManagerUI : : ~ PluginManagerUI ( )
{
}
void
2021-07-15 10:18:20 -04:00
PluginManagerUI : : PluginCount : : set ( PluginScanLogEntry const & psle )
2021-05-26 19:02:11 -04:00
{
2021-07-15 10:18:20 -04:00
+ + total ;
if ( ! psle . recent ( ) ) {
+ + stale ;
return ;
}
PluginScanLogEntry : : PluginScanResult sr = psle . result ( ) ;
if ( ( int ) sr & ( PluginScanLogEntry : : TimeOut | PluginScanLogEntry : : Updated | PluginScanLogEntry : : New ) ) {
+ + ndscn ;
} else if ( sr ! = PluginScanLogEntry : : OK ) {
+ + error ;
}
2021-05-26 19:02:11 -04:00
}
static std : : string
2021-06-18 15:21:46 -04:00
status_text ( PluginScanLogEntry const & psle , PluginManager : : PluginStatusType status )
2021-05-26 19:02:11 -04:00
{
if ( ! psle . recent ( ) ) {
return " Stale " ;
}
PluginScanLogEntry : : PluginScanResult sr = psle . result ( ) ;
2021-06-18 15:21:46 -04:00
if ( sr = = PluginScanLogEntry : : OK | | sr = = PluginScanLogEntry : : Blacklisted ) {
if ( status = = PluginManager : : Concealed ) {
return _ ( " Concealed " ) ;
} else {
return _ ( " OK " ) ;
}
}
if ( ( int ) sr & PluginScanLogEntry : : TimeOut ) {
return _ ( " New " ) ;
2021-05-26 19:02:11 -04:00
}
if ( ( int ) sr & PluginScanLogEntry : : New ) {
2021-06-18 15:21:46 -04:00
return _ ( " New " ) ;
2021-05-26 19:02:11 -04:00
}
if ( ( int ) sr & PluginScanLogEntry : : Updated ) {
2021-06-18 15:21:46 -04:00
return _ ( " Updated " ) ;
2021-05-26 19:02:11 -04:00
}
if ( ( int ) sr & PluginScanLogEntry : : Error ) {
2021-06-18 15:21:46 -04:00
return _ ( " Error " ) ;
2021-05-26 19:02:11 -04:00
}
if ( ( int ) sr & PluginScanLogEntry : : Incompatible ) {
2021-06-18 15:21:46 -04:00
return _ ( " Incompatible " ) ;
2021-05-26 19:02:11 -04:00
}
2021-06-18 15:21:46 -04:00
assert ( 0 ) ;
return " ? " ;
2021-05-26 19:02:11 -04:00
}
static bool
is_blacklisted ( PluginScanLogEntry const & psle )
{
2021-07-16 01:34:43 -04:00
return ( int ) psle . result ( ) & PluginScanLogEntry : : Blacklisted ;
2021-05-26 19:02:11 -04:00
}
2021-06-18 15:21:46 -04:00
static bool
can_blacklist ( PluginScanLogEntry const & psle )
{
if ( psle . type ( ) = = LV2 | | psle . type ( ) = = LADSPA ) {
return false ;
}
2021-07-16 01:34:43 -04:00
return ( ( int ) psle . result ( ) & ~ PluginScanLogEntry : : Blacklisted ) = = PluginScanLogEntry : : OK ;
2021-06-18 15:21:46 -04:00
}
2021-05-26 19:02:11 -04:00
static std : : string
plugin_type ( const PluginType t )
{
/* see also PluginManager::to_generic_vst */
switch ( t ) {
case Windows_VST :
case LXVST :
case MacVST :
return " VST2.x " ;
default :
return enum_2_string ( t ) ;
}
}
2021-07-15 23:52:16 -04:00
bool
2023-02-16 18:33:28 -05:00
PluginManagerUI : : show_this_plugin ( std : : shared_ptr < PluginScanLogEntry > psle , PluginInfoPtr pip , const std : : string & searchstr )
2021-07-15 23:52:16 -04:00
{
2023-01-22 19:33:43 -05:00
using PBD : : match_search_strings ;
2021-07-16 01:34:43 -04:00
if ( searchstr . empty ( ) ) {
2021-07-15 23:52:16 -04:00
return true ;
}
std : : string compstr ( _cb_search_full_path . get_active ( ) ? psle - > path ( ) : Glib : : path_get_basename ( psle - > path ( ) ) ) ;
setup_search_string ( compstr ) ;
if ( match_search_strings ( compstr , searchstr ) ) {
return true ;
}
if ( _cb_search_type . get_active ( ) ) {
2021-07-16 01:34:43 -04:00
compstr = plugin_type ( ( psle ) - > type ( ) ) ;
2021-07-15 23:52:16 -04:00
setup_search_string ( compstr ) ;
if ( match_search_strings ( compstr , searchstr ) ) {
return true ;
}
}
2021-07-16 12:40:51 -04:00
if ( pip & & _cb_search_name . get_active ( ) ) {
2021-07-15 23:52:16 -04:00
compstr = pip - > name ;
setup_search_string ( compstr ) ;
2021-07-16 12:40:51 -04:00
if ( compstr ! = " - " & & match_search_strings ( compstr , searchstr ) ) {
2021-07-15 23:52:16 -04:00
return true ;
}
2021-07-16 12:40:51 -04:00
}
if ( pip & & _cb_search_creator . get_active ( ) ) {
2021-07-15 23:52:16 -04:00
compstr = pip - > creator ;
setup_search_string ( compstr ) ;
2021-07-16 12:40:51 -04:00
if ( compstr ! = " - " & & match_search_strings ( compstr , searchstr ) ) {
return true ;
}
}
if ( pip & & _cb_search_tags . get_active ( ) ) {
compstr = PluginManager : : instance ( ) . get_tags_as_string ( pip ) ;
setup_search_string ( compstr ) ;
if ( compstr ! = " - " & & match_search_strings ( compstr , searchstr ) ) {
2021-07-15 23:52:16 -04:00
return true ;
}
}
return false ;
}
void
2021-07-16 12:40:51 -04:00
PluginManagerUI : : maybe_refill ( ArdourButton * src )
2021-07-15 23:52:16 -04:00
{
2021-07-16 12:40:51 -04:00
if ( _in_search_change ) {
return ;
}
PBD : : Unwinder < bool > uw ( _in_search_change , true ) ;
if ( src = = & _cb_search_base_name ) {
_cb_search_full_path . set_active ( ! _cb_search_base_name . get_active ( ) ) ;
} else if ( src = = & _cb_search_full_path ) {
_cb_search_base_name . set_active ( ! _cb_search_full_path . get_active ( ) ) ;
}
2021-07-16 01:34:43 -04:00
if ( ! _entry_search . get_text ( ) . empty ( ) ) {
2021-07-15 23:52:16 -04:00
refill ( ) ;
}
}
2021-05-26 19:02:11 -04:00
void
PluginManagerUI : : refill ( )
{
2021-06-18 15:21:46 -04:00
/* save selection and sort-column, clear model to speed-up refill */
2021-07-16 01:34:43 -04:00
TreeIter iter = plugin_display . get_selection ( ) - > get_selected ( ) ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < PluginScanLogEntry > sel ;
2021-06-18 15:21:46 -04:00
if ( iter ) {
sel = ( * iter ) [ plugin_columns . psle ] ;
}
2021-05-26 19:02:11 -04:00
2021-07-16 01:34:43 -04:00
plugin_display . set_model ( Glib : : RefPtr < TreeStore > ( 0 ) ) ;
2021-05-26 19:02:11 -04:00
2021-07-16 01:34:43 -04:00
int sort_col ;
2021-07-16 01:21:01 -04:00
SortType sort_type ;
2021-07-16 01:34:43 -04:00
bool sorted = plugin_model - > get_sort_column_id ( sort_col , sort_type ) ;
2021-07-16 01:21:01 -04:00
plugin_model - > set_sort_column ( - 2 , SORT_ASCENDING ) ;
2021-06-18 15:21:46 -04:00
plugin_model - > clear ( ) ;
2021-05-26 19:02:11 -04:00
2021-06-18 15:21:46 -04:00
bool rescan_err = false ;
2021-05-26 19:02:11 -04:00
bool have_stale = false ;
2021-07-16 01:34:43 -04:00
2021-07-14 16:30:55 -04:00
std : : map < PluginType , PluginCount > plugin_count ;
2021-06-18 15:21:46 -04:00
2023-02-16 18:33:28 -05:00
std : : vector < std : : shared_ptr < PluginScanLogEntry > > psl ;
2021-06-18 15:21:46 -04:00
PluginManager & manager ( PluginManager : : instance ( ) ) ;
manager . scan_log ( psl ) ;
2021-05-26 19:02:11 -04:00
2021-07-15 23:52:16 -04:00
std : : string searchstr = _entry_search . get_text ( ) ;
setup_search_string ( searchstr ) ;
2023-02-16 18:33:28 -05:00
for ( std : : vector < std : : shared_ptr < PluginScanLogEntry > > : : const_iterator i = psl . begin ( ) ; i ! = psl . end ( ) ; + + i ) {
2021-05-26 19:02:11 -04:00
PluginInfoList const & plugs = ( * i ) - > nfo ( ) ;
if ( ! ( * i ) - > recent ( ) ) {
have_stale = true ;
} else if ( ( * i ) - > result ( ) = = PluginScanLogEntry : : Blacklisted ) {
2021-06-18 15:21:46 -04:00
/* OK, but manually blacklisted */
2021-05-26 19:02:11 -04:00
} else if ( ( * i ) - > result ( ) ! = PluginScanLogEntry : : OK ) {
2021-06-18 15:21:46 -04:00
if ( ( * i ) - > type ( ) ! = LV2 ) {
rescan_err = true ;
}
2021-05-26 19:02:11 -04:00
}
if ( plugs . size ( ) = = 0 ) {
2021-07-15 23:52:16 -04:00
plugin_count [ ( * i ) - > type ( ) ] . set ( * * i ) ;
2021-07-16 01:34:43 -04:00
if ( ! show_this_plugin ( * i , ARDOUR : : PluginInfoPtr ( ) , searchstr ) ) {
2021-07-15 23:52:16 -04:00
continue ;
}
2021-07-16 01:34:43 -04:00
TreeModel : : Row newrow = * ( plugin_model - > append ( ) ) ;
newrow [ plugin_columns . path ] = Glib : : path_get_basename ( ( * i ) - > path ( ) ) ;
newrow [ plugin_columns . type ] = plugin_type ( ( * i ) - > type ( ) ) ;
newrow [ plugin_columns . name ] = " - " ;
newrow [ plugin_columns . creator ] = " - " ;
2021-07-16 12:40:51 -04:00
newrow [ plugin_columns . tags ] = " - " ;
2021-07-16 01:34:43 -04:00
newrow [ plugin_columns . status ] = status_text ( * * i , PluginManager : : Normal ) ; // XXX
newrow [ plugin_columns . blacklisted ] = is_blacklisted ( * * i ) ;
newrow [ plugin_columns . psle ] = * i ;
newrow [ plugin_columns . plugin ] = ARDOUR : : PluginInfoPtr ( ) ;
newrow [ plugin_columns . favorite ] = false ;
newrow [ plugin_columns . hidden ] = false ;
2021-06-18 15:21:46 -04:00
newrow [ plugin_columns . can_blacklist ] = can_blacklist ( * * i ) ;
2021-07-16 01:34:43 -04:00
newrow [ plugin_columns . can_fav_hide ] = false ;
2021-05-26 19:02:11 -04:00
} else {
2021-07-16 01:34:43 -04:00
for ( PluginInfoList : : const_iterator j = plugs . begin ( ) ; j ! = plugs . end ( ) ; + + j ) {
2021-07-15 23:52:16 -04:00
plugin_count [ ( * i ) - > type ( ) ] . set ( * * i ) ;
if ( ! show_this_plugin ( * i , * j , searchstr ) ) {
continue ;
}
2021-06-18 15:21:46 -04:00
PluginManager : : PluginStatusType status = manager . get_status ( * j ) ;
2021-07-16 12:40:51 -04:00
std : : string tags = manager . get_tags_as_string ( * j ) ;
if ( tags . length ( ) > 32 ) {
tags = tags . substr ( 0 , 32 ) ;
tags . append ( " ... " ) ;
}
2021-07-16 01:34:43 -04:00
TreeModel : : Row newrow = * ( plugin_model - > append ( ) ) ;
newrow [ plugin_columns . favorite ] = status = = PluginManager : : Favorite ;
newrow [ plugin_columns . hidden ] = status = = PluginManager : : Hidden ;
newrow [ plugin_columns . path ] = Glib : : path_get_basename ( ( * i ) - > path ( ) ) ;
newrow [ plugin_columns . type ] = plugin_type ( ( * i ) - > type ( ) ) ;
newrow [ plugin_columns . name ] = ( * j ) - > name ;
newrow [ plugin_columns . creator ] = ( * j ) - > creator ;
2021-07-16 12:40:51 -04:00
newrow [ plugin_columns . tags ] = tags ;
2021-07-16 01:34:43 -04:00
newrow [ plugin_columns . status ] = status_text ( * * i , status ) ;
newrow [ plugin_columns . blacklisted ] = is_blacklisted ( * * i ) ;
newrow [ plugin_columns . psle ] = * i ;
newrow [ plugin_columns . plugin ] = * j ;
2021-06-18 15:21:46 -04:00
newrow [ plugin_columns . can_blacklist ] = can_blacklist ( * * i ) ;
2021-07-16 01:34:43 -04:00
newrow [ plugin_columns . can_fav_hide ] = status ! = PluginManager : : Concealed ;
2021-05-26 19:02:11 -04:00
}
}
}
2021-06-18 15:21:46 -04:00
2021-05-26 19:02:11 -04:00
plugin_display . set_model ( plugin_model ) ;
if ( sorted ) {
plugin_model - > set_sort_column ( sort_col , sort_type ) ;
}
2021-06-18 15:21:46 -04:00
if ( sel ) {
2021-07-16 01:21:01 -04:00
TreeModel : : Children rows = plugin_model - > children ( ) ;
for ( TreeModel : : Children : : iterator i = rows . begin ( ) ; i ! = rows . end ( ) ; + + i ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < PluginScanLogEntry > const & srow ( ( * i ) [ plugin_columns . psle ] ) ;
2021-06-18 15:21:46 -04:00
if ( * sel = = * srow ) {
plugin_display . get_selection ( ) - > select ( * i ) ;
2021-07-16 01:34:43 -04:00
TreeIter iter = plugin_display . get_selection ( ) - > get_selected ( ) ;
2021-07-12 18:47:18 -04:00
assert ( iter ) ;
plugin_display . scroll_to_row ( plugin_model - > get_path ( iter ) , 0.5 ) ;
2021-06-18 15:21:46 -04:00
break ;
}
}
}
2021-07-16 12:40:51 -04:00
plugin_display . set_search_column ( 6 ) ; // Name
2021-06-18 15:21:46 -04:00
2021-07-12 18:47:18 -04:00
/* refill "Plugin Count" */
2021-06-18 15:21:46 -04:00
int row = 0 ;
2021-07-16 01:34:43 -04:00
std : : list < Widget * > children = _tbl_nfo . get_children ( ) ;
for ( std : : list < Widget * > : : iterator child = children . begin ( ) ; child ! = children . end ( ) ; + + child ) {
2021-06-18 15:21:46 -04:00
_tbl_nfo . remove ( * * child ) ;
delete * child ;
}
2021-07-14 16:30:55 -04:00
PluginCount pc_max ;
for ( std : : map < PluginType , PluginCount > : : const_iterator i = plugin_count . begin ( ) ; i ! = plugin_count . end ( ) ; + + i ) {
2021-07-16 01:34:43 -04:00
pc_max . total = std : : max ( pc_max . total , i - > second . total ) ;
pc_max . error = std : : max ( pc_max . error , i - > second . error ) ;
pc_max . stale = std : : max ( pc_max . stale , i - > second . stale ) ;
pc_max . ndscn = std : : max ( pc_max . ndscn , i - > second . ndscn ) ;
2021-07-14 16:30:55 -04:00
}
2022-01-26 16:19:32 -05:00
Label * head_type = new Label ( _ ( " Type " ) , ALIGN_START , ALIGN_CENTER ) ;
2022-01-26 16:20:26 -05:00
Label * head_count = new Label ( _ ( " Total " ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * head_type , 0 , 1 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
_tbl_nfo . attach ( * head_count , 1 , 2 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
if ( pc_max . error > 0 ) {
2022-01-26 16:20:26 -05:00
Label * hd = new Label ( _ ( " Err " ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * hd , 2 , 3 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
}
if ( pc_max . stale > 0 ) {
2022-01-26 16:20:26 -05:00
Label * hd = new Label ( _ ( " Mis " ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * hd , 3 , 4 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
}
if ( pc_max . ndscn > 0 ) {
2022-01-26 16:20:26 -05:00
Label * hd = new Label ( _ ( " New " ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * hd , 4 , 5 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
}
+ + row ;
for ( std : : map < PluginType , PluginCount > : : const_iterator i = plugin_count . begin ( ) ; i ! = plugin_count . end ( ) ; + + i , + + row ) {
2022-01-26 16:19:32 -05:00
Label * lbl_type = new Label ( plugin_type ( i - > first ) , ALIGN_START , ALIGN_CENTER ) ;
2022-01-26 16:20:26 -05:00
Label * lbl_count = new Label ( string_compose ( " %1 " , i - > second . total ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:34:43 -04:00
_tbl_nfo . attach ( * lbl_type , 0 , 1 , row , row + 1 , EXPAND | FILL , SHRINK , 2 , 2 ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * lbl_count , 1 , 2 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
if ( pc_max . error > 0 ) {
2022-01-26 16:20:26 -05:00
Label * lbl = new Label ( string_compose ( " %1 " , i - > second . error ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * lbl , 2 , 3 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
}
if ( pc_max . stale > 0 ) {
2022-01-26 16:20:26 -05:00
Label * lbl = new Label ( string_compose ( " %1 " , i - > second . stale ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * lbl , 3 , 4 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
}
if ( pc_max . ndscn > 0 ) {
2022-01-26 16:20:26 -05:00
Label * lbl = new Label ( string_compose ( " %1 " , i - > second . ndscn ) , ALIGN_END , ALIGN_CENTER ) ;
2021-07-16 01:21:01 -04:00
_tbl_nfo . attach ( * lbl , 4 , 5 , row , row + 1 , SHRINK | FILL , SHRINK , 2 , 2 ) ;
2021-07-14 16:30:55 -04:00
}
2021-06-18 15:21:46 -04:00
}
_tbl_nfo . show_all ( ) ;
2021-07-12 18:47:18 -04:00
/* update sensitivity */
2021-05-26 19:02:11 -04:00
_btn_clear . set_sensitive ( have_stale ) ;
2021-06-18 15:21:46 -04:00
_btn_rescan_err . set_sensitive ( rescan_err ) ;
2021-05-26 19:02:11 -04:00
}
void
PluginManagerUI : : selection_changed ( )
{
2021-07-16 01:34:43 -04:00
if ( plugin_display . get_selection ( ) - > count_selected_rows ( ) ! = 1 ) {
_log . get_buffer ( ) - > set_text ( " " ) ;
2021-07-16 01:12:24 -04:00
_btn_rescan_sel . set_sensitive ( false ) ;
2021-05-26 19:02:11 -04:00
return ;
}
2021-06-18 15:21:46 -04:00
2021-07-16 01:34:43 -04:00
TreeIter iter = plugin_display . get_selection ( ) - > get_selected ( ) ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < PluginScanLogEntry > const & psle ( ( * iter ) [ plugin_columns . psle ] ) ;
2021-06-18 15:21:46 -04:00
2021-07-16 01:34:43 -04:00
_log . get_buffer ( ) - > set_text ( psle - > log ( ) ) ;
2021-05-26 19:02:11 -04:00
PluginScanLogEntry : : PluginScanResult sr = psle - > result ( ) ;
2021-06-18 15:21:46 -04:00
if ( sr = = PluginScanLogEntry : : OK | | psle - > type ( ) = = LV2 ) {
2021-05-26 19:02:11 -04:00
_btn_rescan_sel . set_sensitive ( false ) ;
} else {
_btn_rescan_sel . set_sensitive ( true ) ;
}
}
2021-07-13 15:00:23 -04:00
void
2021-07-16 01:21:01 -04:00
PluginManagerUI : : row_activated ( TreeModel : : Path const & p , TreeViewColumn * )
2021-07-13 15:00:23 -04:00
{
# ifndef NDEBUG
2021-07-16 01:21:01 -04:00
TreeModel : : iterator iter = plugin_model - > get_iter ( p ) ;
2021-07-13 15:00:23 -04:00
if ( ! iter ) {
return ;
}
2023-02-16 18:33:28 -05:00
std : : shared_ptr < PluginScanLogEntry > const & psle ( ( * iter ) [ plugin_columns . psle ] ) ;
2021-07-13 15:00:23 -04:00
switch ( psle - > type ( ) ) {
case Windows_VST :
case LXVST :
case MacVST :
case LADSPA :
PBD : : open_folder ( Glib : : path_get_dirname ( psle - > path ( ) ) ) ;
break ;
case VST3 :
PBD : : open_folder ( psle - > path ( ) ) ;
break ;
case AudioUnit :
case LV2 :
default :
2021-07-16 01:34:43 -04:00
printf ( " %s \n " , psle - > path ( ) . c_str ( ) ) ;
2021-07-13 15:00:23 -04:00
break ;
}
# endif
}
2021-06-18 15:21:46 -04:00
void
PluginManagerUI : : blacklist_changed ( std : : string const & path )
{
2021-07-16 01:21:01 -04:00
TreeIter iter ;
2021-06-18 15:21:46 -04:00
if ( ( iter = plugin_model - > get_iter ( path ) ) ) {
2023-02-16 18:33:28 -05:00
std : : shared_ptr < PluginScanLogEntry > const & psle ( ( * iter ) [ plugin_columns . psle ] ) ;
2021-07-12 18:47:18 -04:00
if ( ( * iter ) [ plugin_columns . blacklisted ] ) {
2021-06-18 15:21:46 -04:00
PluginScanDialog psd ( false , true , this ) ;
PluginManager : : instance ( ) . rescan_plugin ( psle - > type ( ) , psle - > path ( ) ) ;
} else {
PluginManager : : instance ( ) . blacklist ( psle - > type ( ) , psle - > path ( ) ) ;
}
}
}
2021-07-06 20:11:06 -04:00
void
PluginManagerUI : : show_plugin_prefs ( )
{
2021-07-16 01:34:43 -04:00
ARDOUR_UI : : instance ( ) - > show_plugin_prefs ( ) ;
2021-07-06 20:11:06 -04:00
}
void
2021-07-07 12:07:52 -04:00
PluginManagerUI : : edit_vst_path ( std : : string const & title , std : : string const & dflt , sigc : : slot < std : : string > get , sigc : : slot < bool , std : : string > set )
2021-07-06 20:11:06 -04:00
{
2021-07-07 12:07:52 -04:00
/* see also RCOptionEditor::edit_vst_path */
ArdourWidgets : : PathsDialog pd ( * this , title , get ( ) , dflt ) ;
2021-07-16 01:21:01 -04:00
if ( pd . run ( ) ! = RESPONSE_ACCEPT ) {
2021-07-07 12:07:52 -04:00
return ;
}
2021-07-16 01:34:43 -04:00
pd . hide ( ) ;
2021-07-07 12:07:52 -04:00
set ( pd . get_serialized_paths ( ) ) ;
2021-07-16 01:21:01 -04:00
ArdourMessageDialog msg ( _ ( " Re-scan Plugins now? " ) , false , MESSAGE_QUESTION , BUTTONS_YES_NO , true ) ;
msg . set_default_response ( RESPONSE_YES ) ;
2021-07-16 01:34:43 -04:00
if ( msg . run ( ) ! = RESPONSE_YES ) {
2021-07-07 12:07:52 -04:00
return ;
}
msg . hide ( ) ;
PluginScanDialog psd ( false , true , this ) ;
psd . start ( ) ;
}
void
PluginManagerUI : : vst_path_cb ( ARDOUR : : PluginType t )
{
switch ( t ) {
2021-07-06 20:11:06 -04:00
# ifdef WINDOWS_VST_SUPPORT
2021-07-07 12:07:52 -04:00
case Windows_VST :
edit_vst_path (
2021-07-16 01:34:43 -04:00
_ ( " Set Windows VST2 Search Path " ) ,
PluginManager : : instance ( ) . get_default_windows_vst_path ( ) ,
sigc : : mem_fun ( * Config , & RCConfiguration : : get_plugin_path_vst ) ,
sigc : : mem_fun ( * Config , & RCConfiguration : : set_plugin_path_vst ) ) ;
2021-07-07 12:07:52 -04:00
break ;
2021-07-06 20:11:06 -04:00
# endif
# ifdef LXVST_SUPPORT
2021-07-07 12:07:52 -04:00
case LXVST :
edit_vst_path (
2021-07-16 01:34:43 -04:00
_ ( " Set Linux VST2 Search Path " ) ,
PluginManager : : instance ( ) . get_default_lxvst_path ( ) ,
sigc : : mem_fun ( * Config , & RCConfiguration : : get_plugin_path_lxvst ) ,
sigc : : mem_fun ( * Config , & RCConfiguration : : set_plugin_path_lxvst ) ) ;
2021-07-07 12:07:52 -04:00
break ;
2021-07-06 20:11:06 -04:00
# endif
# ifdef VST3_SUPPORT
2021-07-07 12:07:52 -04:00
case VST3 :
edit_vst_path (
2021-07-16 01:34:43 -04:00
_ ( " Set Additional VST3 Search Path " ) ,
" " , /* default is blank */
sigc : : mem_fun ( * Config , & RCConfiguration : : get_plugin_path_vst3 ) ,
sigc : : mem_fun ( * Config , & RCConfiguration : : set_plugin_path_vst3 ) ) ;
2021-07-07 12:07:52 -04:00
break ;
2021-07-06 20:11:06 -04:00
# endif
2021-07-07 12:07:52 -04:00
default :
break ;
2021-07-06 20:11:06 -04:00
}
}
2021-05-26 19:02:11 -04:00
void
PluginManagerUI : : rescan_all ( )
{
2021-07-16 01:21:01 -04:00
ArdourMessageDialog msg ( _ ( " Are you sure you want to rescan all plugins? " ) , false , MESSAGE_QUESTION , BUTTONS_YES_NO , true ) ;
2021-06-18 15:21:46 -04:00
msg . set_title ( _ ( " Rescan Plugins " ) ) ;
2023-11-20 12:47:12 -05:00
msg . set_secondary_text ( _ ( " This starts a fresh scan, dropping all cached plugin data and ignorelist. Depending on the number of plugins installed this can take a long time. " ) ) ;
2021-06-18 15:21:46 -04:00
2021-07-16 01:34:43 -04:00
if ( msg . run ( ) ! = RESPONSE_YES ) {
2021-06-18 15:21:46 -04:00
return ;
}
2021-07-16 01:34:43 -04:00
msg . hide ( ) ;
2021-06-18 15:21:46 -04:00
ARDOUR : : PluginManager & manager ( PluginManager : : instance ( ) ) ;
if ( true ) {
manager . clear_au_blacklist ( ) ;
manager . clear_vst_blacklist ( ) ;
manager . clear_vst3_blacklist ( ) ;
}
manager . clear_au_cache ( ) ;
manager . clear_vst_cache ( ) ;
manager . clear_vst3_cache ( ) ;
PluginScanDialog psd ( false , true , this ) ;
psd . start ( ) ;
}
void
PluginManagerUI : : rescan_faulty ( )
{
PluginScanDialog psd ( false , true , this ) ;
PluginManager : : instance ( ) . rescan_faulty ( ) ;
2021-07-16 12:40:51 -04:00
_entry_search . set_text ( " " ) ;
2021-05-26 19:02:11 -04:00
}
2021-07-16 19:10:29 -04:00
void
PluginManagerUI : : reindex ( )
{
PluginScanDialog psd ( true , true , this ) ;
psd . start ( ) ;
}
2021-09-09 09:29:25 -04:00
void
PluginManagerUI : : discover ( )
{
PluginScanDialog psd ( false , true , this ) ;
psd . start ( ) ;
}
2021-05-26 19:02:11 -04:00
void
PluginManagerUI : : rescan_selected ( )
{
2021-07-16 01:34:43 -04:00
if ( plugin_display . get_selection ( ) - > count_selected_rows ( ) ! = 1 ) {
2021-06-18 15:21:46 -04:00
return ;
}
2021-07-16 01:34:43 -04:00
TreeIter iter = plugin_display . get_selection ( ) - > get_selected ( ) ;
2023-02-16 18:33:28 -05:00
std : : shared_ptr < PluginScanLogEntry > const & psle ( ( * iter ) [ plugin_columns . psle ] ) ;
2021-06-18 15:21:46 -04:00
PluginScanDialog psd ( false , true , this ) ;
PluginManager : : instance ( ) . rescan_plugin ( psle - > type ( ) , psle - > path ( ) ) ;
2021-05-26 19:02:11 -04:00
}
void
PluginManagerUI : : clear_log ( )
{
2021-06-18 15:21:46 -04:00
PluginManager : : instance ( ) . clear_stale_log ( ) ;
}
void
PluginManagerUI : : plugin_status_changed ( ARDOUR : : PluginType t , std : : string uid , ARDOUR : : PluginManager : : PluginStatusType stat )
{
2021-07-16 01:21:01 -04:00
TreeModel : : Children rows = plugin_model - > children ( ) ;
for ( TreeModel : : Children : : iterator i = rows . begin ( ) ; i ! = rows . end ( ) ; + + i ) {
2021-06-18 15:21:46 -04:00
PluginInfoPtr pp = ( * i ) [ plugin_columns . plugin ] ;
if ( ! pp | | pp - > type ! = t | | pp - > unique_id ! = uid ) {
continue ;
}
( * i ) [ plugin_columns . favorite ] = ( stat = = PluginManager : : Favorite ) ? true : false ;
2021-07-16 01:34:43 -04:00
( * i ) [ plugin_columns . hidden ] = ( stat = = PluginManager : : Hidden ) ? true : false ;
2021-06-18 15:21:46 -04:00
break ;
}
}
void
PluginManagerUI : : favorite_changed ( const std : : string & path )
{
2021-07-12 18:47:18 -04:00
if ( _in_row_change ) {
return ;
}
2021-06-18 15:21:46 -04:00
PBD : : Unwinder < bool > uw ( _in_row_change , true ) ;
2021-07-16 01:21:01 -04:00
TreeIter iter ;
2021-06-18 15:21:46 -04:00
if ( ( iter = plugin_model - > get_iter ( path ) ) ) {
2021-07-12 18:47:18 -04:00
bool favorite = ! ( * iter ) [ plugin_columns . favorite ] ;
2021-06-18 15:21:46 -04:00
2021-07-12 18:47:18 -04:00
PluginManager : : PluginStatusType status = ( favorite ? PluginManager : : Favorite : PluginManager : : Normal ) ;
2021-07-16 01:34:43 -04:00
PluginInfoPtr pi = ( * iter ) [ plugin_columns . plugin ] ;
2021-06-18 15:21:46 -04:00
ARDOUR : : PluginManager & manager ( PluginManager : : instance ( ) ) ;
manager . set_status ( pi - > type , pi - > unique_id , status ) ;
2021-07-16 12:40:51 -04:00
manager . save_statuses ( ) ; // TODO postpone
2021-07-12 18:47:18 -04:00
}
2021-06-18 15:21:46 -04:00
}
void
PluginManagerUI : : hidden_changed ( const std : : string & path )
{
2021-07-12 18:47:18 -04:00
if ( _in_row_change ) {
return ;
}
2021-06-18 15:21:46 -04:00
PBD : : Unwinder < bool > uw ( _in_row_change , true ) ;
2021-07-16 01:21:01 -04:00
TreeIter iter ;
2021-06-18 15:21:46 -04:00
if ( ( iter = plugin_model - > get_iter ( path ) ) ) {
bool hidden = ! ( * iter ) [ plugin_columns . hidden ] ;
PluginManager : : PluginStatusType status = ( hidden ? PluginManager : : Hidden : PluginManager : : Normal ) ;
2021-07-16 01:34:43 -04:00
PluginInfoPtr pi = ( * iter ) [ plugin_columns . plugin ] ;
2021-06-18 15:21:46 -04:00
ARDOUR : : PluginManager & manager ( PluginManager : : instance ( ) ) ;
manager . set_status ( pi - > type , pi - > unique_id , status ) ;
2021-07-16 12:40:51 -04:00
manager . save_statuses ( ) ; // TODO postpone
2021-07-12 18:47:18 -04:00
}
2021-05-26 19:02:11 -04:00
}
2021-07-15 23:52:16 -04:00
void
PluginManagerUI : : search_entry_changed ( )
{
refill ( ) ;
}
void
PluginManagerUI : : search_clear_button_clicked ( )
{
_entry_search . set_text ( " " ) ;
}