Browse Source

Fixed duplicate name drop-down bug. Duplicated names now numbered.

master
waxfrenzy 22 years ago
parent
commit
a3b9923261
2 changed files with 21 additions and 1 deletions
  1. +19
    -0
      SpiralSound/Plugins/LADSPAPlugin/LADSPAInfo.C
  2. +2
    -1
      SpiralSound/Plugins/LADSPAPlugin/LADSPAInfo.h

+ 19
- 0
SpiralSound/Plugins/LADSPAPlugin/LADSPAInfo.C View File

@@ -21,6 +21,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <iostream> #include <iostream>
#include <sstream>
#include <map> #include <map>
#include <algorithm> #include <algorithm>


@@ -102,6 +103,23 @@ LADSPAInfo::RescanPlugins(void)


// Sort list by name // Sort list by name
sort(m_OrderedPluginList.begin(), m_OrderedPluginList.end(), PluginEntrySortAsc()); sort(m_OrderedPluginList.begin(), m_OrderedPluginList.end(), PluginEntrySortAsc());

// Deal with duplicates by numbering them
for (vector<PluginEntry>::iterator i = m_OrderedPluginList.begin();
i != m_OrderedPluginList.end(); ) {
string name = i->Name;

i++;
unsigned long n = 2;
while ((i != m_OrderedPluginList.end()) && (i->Name == name)) {
stringstream s;
s << n;
i->Name = name + " (" + s.str() + ")";
cerr << " " << n << endl;
n++;
i++;
}
}
} }


void void
@@ -260,6 +278,7 @@ LADSPAInfo::ExaminePath(const char *path)
bool path_added = false; bool path_added = false;
bool library_added; bool library_added;
string fullpath; string fullpath;
vector<string> temp_names;


dp = opendir(path); dp = opendir(path);
if (!dp) { if (!dp) {


+ 2
- 1
SpiralSound/Plugins/LADSPAPlugin/LADSPAInfo.h View File

@@ -62,7 +62,8 @@ public:
std::string Name; std::string Name;
}; };


// Get a list of plugins ordered by name
// Get a list of plugins ordered by name (duplicate names are
// appended with a (number)
const std::vector<PluginEntry> GetPluginList(void); const std::vector<PluginEntry> GetPluginList(void);


// Get the index in the above list for given Unique ID // Get the index in the above list for given Unique ID


Loading…
Cancel
Save