Mixer: Allow searching by category in plugin chooser.
This commit is contained in:
parent
07e40513c6
commit
171975b26b
|
@ -383,7 +383,9 @@ LADSPAInfo::DescendGroup(string prefix,
|
||||||
|
|
||||||
pe.Depth = depth;
|
pe.Depth = depth;
|
||||||
pe.UniqueID = pi->UniqueID;
|
pe.UniqueID = pi->UniqueID;
|
||||||
pe.Name = prefix + name;
|
pe.Name = name;
|
||||||
|
pe.Category = prefix;
|
||||||
|
pe.Category = pe.Category.substr(0, pe.Category.size()-1);
|
||||||
|
|
||||||
plugins.push_back(pe);
|
plugins.push_back(pe);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ public:
|
||||||
unsigned int Depth;
|
unsigned int Depth;
|
||||||
unsigned long UniqueID;
|
unsigned long UniqueID;
|
||||||
std::string Name;
|
std::string Name;
|
||||||
|
std::string Category;
|
||||||
|
|
||||||
bool operator<(const PluginEntry& pe)
|
bool operator<(const PluginEntry& pe)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +108,7 @@ public:
|
||||||
std::string Label; // Plugin label
|
std::string Label; // Plugin label
|
||||||
std::string Name; // Plugin Name
|
std::string Name; // Plugin Name
|
||||||
std::string Maker;
|
std::string Maker;
|
||||||
unsigned int AudioInputs;
|
unsigned int AudioInputs;
|
||||||
unsigned int AudioOutputs;
|
unsigned int AudioOutputs;
|
||||||
const LADSPA_Descriptor *Descriptor; // Descriptor, NULL
|
const LADSPA_Descriptor *Descriptor; // Descriptor, NULL
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ Plugin_Chooser::plugin_chooser ( int ninputs )
|
||||||
|
|
||||||
o->ui->inputs_input->value( ninputs );
|
o->ui->inputs_input->value( ninputs );
|
||||||
|
|
||||||
o->search( "", "", ninputs, 0, o->ui->favorites_button->value() );
|
o->search( "", "", "Any", ninputs, 0, o->ui->favorites_button->value() );
|
||||||
|
|
||||||
o->show();
|
o->show();
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ Plugin_Chooser::plugin_chooser ( int ninputs )
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Plugin_Chooser::search ( const char *name, const char *author, int ninputs, int noutputs, bool favorites )
|
Plugin_Chooser::search ( const char *name, const char *author, const char *category, int ninputs, int noutputs, bool favorites )
|
||||||
{
|
{
|
||||||
_plugin_rows.clear();
|
_plugin_rows.clear();
|
||||||
|
|
||||||
|
@ -77,6 +77,15 @@ Plugin_Chooser::search ( const char *name, const char *author, int ninputs, int
|
||||||
|
|
||||||
if ( favorites > 0 && ! p->favorite )
|
if ( favorites > 0 && ! p->favorite )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if ( strcmp( category, "Any" ) )
|
||||||
|
{
|
||||||
|
if ( !p->category && strcmp( category, "Unclassified" ))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strncmp( p->category, category, strlen( category )))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
_plugin_rows.push_back( p );
|
_plugin_rows.push_back( p );
|
||||||
}
|
}
|
||||||
|
@ -99,8 +108,16 @@ Plugin_Chooser::cb_handle ( Fl_Widget *w )
|
||||||
ui->favorites_button->value( !ui->all_button->value() );
|
ui->favorites_button->value( !ui->all_button->value() );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
search( ui->name_input->value(), ui->author_input->value(), ui->inputs_input->value(), ui->outputs_input->value(), ui->favorites_button->value() );
|
char picked[512];
|
||||||
|
ui->category_choice->item_pathname( picked, sizeof( picked ) );
|
||||||
|
|
||||||
|
search( ui->name_input->value(),
|
||||||
|
ui->author_input->value(),
|
||||||
|
picked[0] == '/' ? &picked[1] : picked,
|
||||||
|
ui->inputs_input->value(),
|
||||||
|
ui->outputs_input->value(),
|
||||||
|
ui->favorites_button->value() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +327,37 @@ Plugin_Chooser::save_favorites ( void )
|
||||||
|
|
||||||
fclose( fp );
|
fclose( fp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Plugin_Chooser::load_categories ( void )
|
||||||
|
{
|
||||||
|
ui->category_choice->add( "Any" );
|
||||||
|
|
||||||
|
std::list<std::string> categories;
|
||||||
|
|
||||||
|
for ( std::list<Plugin_Module::Plugin_Info>::iterator i = _plugins.begin();
|
||||||
|
i != _plugins.end();
|
||||||
|
i++ )
|
||||||
|
{
|
||||||
|
if ( i->category )
|
||||||
|
{
|
||||||
|
categories.push_back(i->category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
categories.sort();
|
||||||
|
|
||||||
|
|
||||||
|
for ( std::list<std::string>::const_iterator i = categories.begin();
|
||||||
|
i != categories.end();
|
||||||
|
i++ )
|
||||||
|
{
|
||||||
|
ui->category_choice->add( i->c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->category_choice->value( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
Plugin_Chooser::Plugin_Chooser ( int X,int Y,int W,int H, const char *L )
|
Plugin_Chooser::Plugin_Chooser ( int X,int Y,int W,int H, const char *L )
|
||||||
: Fl_Double_Window ( X,Y,W,H,L )
|
: Fl_Double_Window ( X,Y,W,H,L )
|
||||||
{
|
{
|
||||||
|
@ -343,6 +390,10 @@ Plugin_Chooser::Plugin_Chooser ( int X,int Y,int W,int H, const char *L )
|
||||||
o->all_button->callback( &Plugin_Chooser::cb_handle, this );
|
o->all_button->callback( &Plugin_Chooser::cb_handle, this );
|
||||||
o->all_button->when( FL_WHEN_CHANGED );
|
o->all_button->when( FL_WHEN_CHANGED );
|
||||||
|
|
||||||
|
|
||||||
|
o->category_choice->callback( &Plugin_Chooser::cb_handle, this );
|
||||||
|
o->category_choice->when( FL_WHEN_CHANGED );
|
||||||
|
|
||||||
{
|
{
|
||||||
Plugin_Table *o = new Plugin_Table(ui->table->x(),ui->table->y(),ui->table->w(),ui->table->h() );
|
Plugin_Table *o = new Plugin_Table(ui->table->x(),ui->table->y(),ui->table->w(),ui->table->h() );
|
||||||
ui->table_group->add(o);
|
ui->table_group->add(o);
|
||||||
|
@ -375,6 +426,8 @@ Plugin_Chooser::Plugin_Chooser ( int X,int Y,int W,int H, const char *L )
|
||||||
|
|
||||||
end();
|
end();
|
||||||
|
|
||||||
|
load_categories();
|
||||||
|
|
||||||
if ( load_favorites() )
|
if ( load_favorites() )
|
||||||
{
|
{
|
||||||
ui->all_button->value(0);
|
ui->all_button->value(0);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Plugin_Chooser : public Fl_Double_Window
|
||||||
static void cb_table ( Fl_Widget *w, void *v );
|
static void cb_table ( Fl_Widget *w, void *v );
|
||||||
void cb_table ( Fl_Widget *w );
|
void cb_table ( Fl_Widget *w );
|
||||||
|
|
||||||
void search ( const char *name, const char *author, int ninputs, int noutputs, bool favorites );
|
void search ( const char *name, const char *author, const char *category, int ninputs, int noutputs, bool favorites );
|
||||||
|
|
||||||
unsigned long _value;
|
unsigned long _value;
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ class Plugin_Chooser : public Fl_Double_Window
|
||||||
|
|
||||||
void save_favorites ( void );
|
void save_favorites ( void );
|
||||||
|
|
||||||
|
void load_categories ( void );
|
||||||
public:
|
public:
|
||||||
|
|
||||||
unsigned long value ( void ) const { return _value; }
|
unsigned long value ( void ) const { return _value; }
|
||||||
|
|
|
@ -9,8 +9,8 @@ decl {\#include <FL/Fl_Table_Row.H>} {public global
|
||||||
}
|
}
|
||||||
|
|
||||||
widget_class Plugin_Chooser_UI {
|
widget_class Plugin_Chooser_UI {
|
||||||
label {Plugin Selector} open selected
|
label {Plugin Selector} open
|
||||||
xywh {821 343 735 500} type Double resizable size_range {740 0 740 0} visible
|
xywh {823 366 735 500} type Double resizable size_range {740 0 740 0} visible
|
||||||
} {
|
} {
|
||||||
Fl_Group {} {open
|
Fl_Group {} {open
|
||||||
xywh {10 5 155 20}
|
xywh {10 5 155 20}
|
||||||
|
@ -24,26 +24,30 @@ widget_class Plugin_Chooser_UI {
|
||||||
xywh {65 5 100 20} type Radio down_box ROUND_DOWN_BOX
|
xywh {65 5 100 20} type Radio down_box ROUND_DOWN_BOX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Fl_Group {} {open
|
Fl_Group {} {open selected
|
||||||
xywh {5 29 725 77} box UP_FRAME
|
xywh {5 29 725 77} box UP_FRAME
|
||||||
code0 {o->resizable(0);}
|
code0 {o->resizable(0);}
|
||||||
} {
|
} {
|
||||||
Fl_Input name_input {
|
Fl_Input name_input {
|
||||||
label {Name:}
|
label {Name:}
|
||||||
xywh {65 38 555 24} labelsize 12 textsize 13
|
xywh {75 38 300 24} labelsize 12 textsize 13
|
||||||
}
|
}
|
||||||
Fl_Input author_input {
|
Fl_Input author_input {
|
||||||
label {Author:}
|
label {Author:}
|
||||||
xywh {65 72 415 24} labelsize 12 textsize 13
|
xywh {435 39 210 22} labelsize 12 textsize 13
|
||||||
}
|
}
|
||||||
Fl_Value_Input outputs_input {
|
Fl_Value_Input outputs_input {
|
||||||
label {Outputs:}
|
label {Outputs:}
|
||||||
xywh {693 70 30 26} labelsize 12
|
xywh {693 70 30 24} labelsize 12
|
||||||
}
|
}
|
||||||
Fl_Value_Input inputs_input {
|
Fl_Value_Input inputs_input {
|
||||||
label {Inputs:}
|
label {Inputs:}
|
||||||
xywh {693 39 30 24} labelsize 12
|
xywh {693 39 30 24} labelsize 12
|
||||||
}
|
}
|
||||||
|
Fl_Choice category_choice {
|
||||||
|
label {Category:} open
|
||||||
|
xywh {75 70 405 24} down_box BORDER_BOX labelsize 12 textsize 12
|
||||||
|
} {}
|
||||||
}
|
}
|
||||||
Fl_Group table_group {open
|
Fl_Group table_group {open
|
||||||
xywh {5 115 725 380} resizable
|
xywh {5 115 725 380} resizable
|
||||||
|
@ -54,7 +58,7 @@ widget_class Plugin_Chooser_UI {
|
||||||
}
|
}
|
||||||
Fl_Choice type_choice {
|
Fl_Choice type_choice {
|
||||||
label {Type:} open
|
label {Type:} open
|
||||||
xywh {520 135 100 28} down_box BORDER_BOX labelsize 12 hide
|
xywh {530 70 95 24} down_box BORDER_BOX labelsize 12 textsize 12
|
||||||
} {
|
} {
|
||||||
MenuItem {} {
|
MenuItem {} {
|
||||||
label LADSPA
|
label LADSPA
|
||||||
|
|
|
@ -291,12 +291,26 @@ Plugin_Module::get_all_plugins ( void )
|
||||||
pi.name = i->Name.c_str();
|
pi.name = i->Name.c_str();
|
||||||
pi.audio_inputs = i->AudioInputs;
|
pi.audio_inputs = i->AudioInputs;
|
||||||
pi.audio_outputs = i->AudioOutputs;
|
pi.audio_outputs = i->AudioOutputs;
|
||||||
|
pi.category = "Unclassified";
|
||||||
pr.push_back( pi );
|
pr.push_back( pi );
|
||||||
}
|
}
|
||||||
|
|
||||||
pr.sort();
|
pr.sort();
|
||||||
|
|
||||||
|
const std::vector<LADSPAInfo::PluginEntry> pe = ladspainfo->GetMenuList();
|
||||||
|
|
||||||
|
for (std::vector<LADSPAInfo::PluginEntry>::const_iterator i= pe.begin();
|
||||||
|
i !=pe.end(); i++ )
|
||||||
|
{
|
||||||
|
for ( std::list<Plugin_Info>::iterator j = pr.begin(); j != pr.end(); j++ )
|
||||||
|
{
|
||||||
|
if ( j->id == i->UniqueID )
|
||||||
|
{
|
||||||
|
j->category = i->Category.c_str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue