Browse Source

Change "manufacturer" to "author"

tags/v0.6.0
Andrew Belt 6 years ago
parent
commit
0439fc405a
5 changed files with 50 additions and 48 deletions
  1. +9
    -7
      include/plugin.hpp
  2. +2
    -2
      include/rack.hpp
  3. +35
    -35
      src/app/ModuleBrowser.cpp
  4. +1
    -1
      src/app/ModuleWidget.cpp
  5. +3
    -3
      src/plugin.cpp

+ 9
- 7
include/plugin.hpp View File

@@ -43,15 +43,17 @@ struct Plugin {

struct Model {
Plugin *plugin = NULL;
/** An identifier for the model, e.g. "VCO". Used for saving patches. The slug, manufacturerSlug pair must be unique. */
/** An identifier for the model, e.g. "VCO". Used for saving patches.
The model slug must be unique in your plugin, but it doesn't need to be unique among different plugins.
*/
std::string slug;
/** Human readable name for your model, e.g. "Voltage Controlled Oscillator" */
std::string name;
/** The name of the manufacturer group of the module.
This might be different than the plugin slug. For example, if you create multiple plugins but want them to be branded similarly, you may use the same manufacturer name in multiple plugins.
You may even have multiple manufacturers in one plugin, although this would be unusual.
/** The author name of the module.
This might be different than the plugin slug. For example, if you create multiple plugins but want them to be branded similarly, you may use the same author in multiple plugins.
You may even have multiple authors in one plugin, although this property will be moved to Plugin for Rack 1.0.
*/
std::string manufacturer;
std::string author;
/** List of tags representing the function(s) of the module (optional) */
std::list<ModelTag> tags;

@@ -65,7 +67,7 @@ struct Model {

/** Create Model subclass which constructs a specific Module and ModuleWidget subclass */
template <typename TModule, typename TModuleWidget, typename... Tags>
static Model *create(std::string manufacturer, std::string slug, std::string name, Tags... tags) {
static Model *create(std::string author, std::string slug, std::string name, Tags... tags) {
struct TModel : Model {
Module *createModule() override {
TModule *module = new TModule();
@@ -84,7 +86,7 @@ struct Model {
}
};
TModel *o = new TModel();
o->manufacturer = manufacturer;
o->author = author;
o->slug = slug;
o->name = name;
o->tags = {tags...};


+ 2
- 2
include/rack.hpp View File

@@ -20,7 +20,7 @@ namespace rack {

/** Deprecated, use Model::create<TModule, TModuleWidget>(...) instead */
template <class TModuleWidget, typename... Tags>
DEPRECATED Model *createModel(std::string manufacturer, std::string slug, std::string name, Tags... tags) {
DEPRECATED Model *createModel(std::string author, std::string slug, std::string name, Tags... tags) {
struct TModel : Model {
ModuleWidget *createModuleWidget() override {
ModuleWidget *moduleWidget = new TModuleWidget();
@@ -29,7 +29,7 @@ DEPRECATED Model *createModel(std::string manufacturer, std::string slug, std::s
}
};
Model *model = new TModel();
model->manufacturer = manufacturer;
model->author = author;
model->slug = slug;
model->name = name;
model->tags = {tags...};


+ 35
- 35
src/app/ModuleBrowser.cpp View File

@@ -12,7 +12,7 @@ namespace rack {


static std::set<Model*> sFavoriteModels;
static std::string sManufacturerFilter;
static std::string sAuthorFilter;
static ModelTag sTagFilter = NO_TAG;


@@ -29,7 +29,7 @@ static bool isModelMatch(Model *model, std::string search) {
std::string s;
s += model->plugin->slug;
s += " ";
s += model->manufacturer;
s += model->author;
s += " ";
s += model->name;
s += " ";
@@ -98,7 +98,7 @@ struct BrowserListItem : OpaqueWidget {

struct ModelItem : BrowserListItem {
Model *model;
Label *manufacturerLabel;
Label *authorLabel;

void setModel(Model *model) {
clearChildren();
@@ -109,10 +109,10 @@ struct ModelItem : BrowserListItem {
nameLabel->text = model->name;
addChild(nameLabel);

manufacturerLabel = Widget::create<Label>(Vec(0, 0));
manufacturerLabel->alignment = Label::RIGHT_ALIGNMENT;
manufacturerLabel->text = model->manufacturer;
addChild(manufacturerLabel);
authorLabel = Widget::create<Label>(Vec(0, 0));
authorLabel->alignment = Label::RIGHT_ALIGNMENT;
authorLabel->text = model->author;
addChild(authorLabel);

SequentialLayout *layout2 = Widget::create<SequentialLayout>(Vec(7, BND_WIDGET_HEIGHT));
layout2->spacing = 0;
@@ -147,7 +147,7 @@ struct ModelItem : BrowserListItem {

void step() override {
BrowserListItem::step();
manufacturerLabel->box.size.x = box.size.x - BND_SCROLLBAR_WIDTH;
authorLabel->box.size.x = box.size.x - BND_SCROLLBAR_WIDTH;
}

void onAction(EventAction &e) override {
@@ -160,18 +160,18 @@ struct ModelItem : BrowserListItem {
};


struct ManufacturerItem : BrowserListItem {
std::string manufacturer;
struct AuthorItem : BrowserListItem {
std::string author;

void setManufacturer(std::string manufacturer) {
void setAuthor(std::string author) {
clearChildren();
this->manufacturer = manufacturer;
Label *manufacturerLabel = Widget::create<Label>(Vec(0, 0));
if (manufacturer.empty())
manufacturerLabel->text = "Show all modules";
this->author = author;
Label *authorLabel = Widget::create<Label>(Vec(0, 0));
if (author.empty())
authorLabel->text = "Show all modules";
else
manufacturerLabel->text = manufacturer;
addChild(manufacturerLabel);
authorLabel->text = author;
addChild(authorLabel);
}

void onAction(EventAction &e) override;
@@ -292,7 +292,7 @@ struct ModuleBrowser : VirtualWidget {
SearchModuleField *searchField;
ScrollWidget *moduleScroll;
BrowserList *moduleList;
std::set<std::string> availableManufacturers;
std::set<std::string> availableAuthors;
std::set<ModelTag> availableTags;

ModuleBrowser() {
@@ -314,12 +314,12 @@ struct ModuleBrowser : VirtualWidget {
moduleScroll->container->addChild(moduleList);
addChild(moduleScroll);

// Collect manufacturers
// Collect authors
for (Plugin *plugin : gPlugins) {
for (Model *model : plugin->models) {
// Insert manufacturer
if (!model->manufacturer.empty())
availableManufacturers.insert(model->manufacturer);
// Insert author
if (!model->author.empty())
availableAuthors.insert(model->author);
// Insert tag
for (ModelTag tag : model->tags) {
if (tag != NO_TAG)
@@ -337,7 +337,7 @@ struct ModuleBrowser : VirtualWidget {
}

bool isModelFiltered(Model *model) {
if (!sManufacturerFilter.empty() && model->manufacturer != sManufacturerFilter)
if (!sAuthorFilter.empty() && model->author != sAuthorFilter)
return false;
if (sTagFilter != NO_TAG) {
auto it = std::find(model->tags.begin(), model->tags.end(), sTagFilter);
@@ -366,18 +366,18 @@ struct ModuleBrowser : VirtualWidget {
}
}

// Manufacturers
if (sManufacturerFilter.empty() && sTagFilter == NO_TAG) {
// Manufacturer items
// Authors
if (sAuthorFilter.empty() && sTagFilter == NO_TAG) {
// Author items
{
SeparatorItem *item = new SeparatorItem();
item->setText("Manufacturers");
item->setText("Authors");
moduleList->addChild(item);
}
for (std::string manufacturer : availableManufacturers) {
if (isMatch(manufacturer, search)) {
ManufacturerItem *item = new ManufacturerItem();
item->setManufacturer(manufacturer);
for (std::string author : availableAuthors) {
if (isMatch(author, search)) {
AuthorItem *item = new AuthorItem();
item->setAuthor(author);
moduleList->addChild(item);
}
}
@@ -401,7 +401,7 @@ struct ModuleBrowser : VirtualWidget {
}

// Models
if (!sManufacturerFilter.empty() || sTagFilter != NO_TAG || !search.empty()) {
if (!sAuthorFilter.empty() || sTagFilter != NO_TAG || !search.empty()) {
{
SeparatorItem *item = new SeparatorItem();
item->setText("Modules");
@@ -433,9 +433,9 @@ struct ModuleBrowser : VirtualWidget {

// Implementations of inline methods above

void ManufacturerItem::onAction(EventAction &e) {
void AuthorItem::onAction(EventAction &e) {
ModuleBrowser *moduleBrowser = getAncestorOfType<ModuleBrowser>();
sManufacturerFilter = manufacturer;
sAuthorFilter = author;
moduleBrowser->clearSearch();
moduleBrowser->refreshSearch();
e.consumed = false;
@@ -451,7 +451,7 @@ void TagItem::onAction(EventAction &e) {

void ClearFilterItem::onAction(EventAction &e) {
ModuleBrowser *moduleBrowser = getAncestorOfType<ModuleBrowser>();
sManufacturerFilter = "";
sAuthorFilter = "";
sTagFilter = NO_TAG;
moduleBrowser->clearSearch();
moduleBrowser->refreshSearch();


+ 1
- 1
src/app/ModuleWidget.cpp View File

@@ -321,7 +321,7 @@ Menu *ModuleWidget::createContextMenu() {
Menu *menu = gScene->createMenu();

MenuLabel *menuLabel = new MenuLabel();
menuLabel->text = model->manufacturer + " " + model->name;
menuLabel->text = model->author + " " + model->name;
menu->addChild(menuLabel);

ResetMenuItem *resetItem = new ResetMenuItem();


+ 3
- 3
src/plugin.cpp View File

@@ -394,9 +394,9 @@ void pluginInit() {

// Load core
// This function is defined in core.cpp
Plugin *coreManufacturer = new Plugin();
init(coreManufacturer);
gPlugins.push_back(coreManufacturer);
Plugin *corePlugin = new Plugin();
init(corePlugin);
gPlugins.push_back(corePlugin);

// Load plugins from local directory
std::string localPlugins = assetLocal("plugins");


Loading…
Cancel
Save