Browse Source

Add ParamWidget::appendContextMenu(). Fix helper.hpp member field setting.

tags/v2.0.0
Andrew Belt 5 years ago
parent
commit
ccb4fe41ec
4 changed files with 16 additions and 12 deletions
  1. +2
    -1
      include/app/ParamWidget.hpp
  2. +1
    -1
      include/app/PortWidget.hpp
  3. +11
    -10
      include/helpers.hpp
  4. +2
    -0
      src/app/ParamWidget.cpp

+ 2
- 1
include/app/ParamWidget.hpp View File

@@ -2,8 +2,8 @@
#include <app/common.hpp>
#include <widget/OpaqueWidget.hpp>
#include <ui/Tooltip.hpp>
#include <ui/Menu.hpp>
#include <engine/ParamQuantity.hpp>
#include <history.hpp>


namespace rack {
@@ -30,6 +30,7 @@ struct ParamWidget : widget::OpaqueWidget {
void onLeave(const event::Leave& e) override;

void createContextMenu();
virtual void appendContextMenu(ui::Menu* menu) {}
void resetAction();
};



+ 1
- 1
include/app/PortWidget.hpp View File

@@ -14,8 +14,8 @@ namespace app {
/** Manages an engine::Port on a ModuleWidget. */
struct PortWidget : widget::OpaqueWidget {
engine::Module* module = NULL;
int portId = 0;
engine::Port::Type type = engine::Port::INPUT;
int portId = 0;

ui::Tooltip* tooltip = NULL;
bool hovered = false;


+ 11
- 10
include/helpers.hpp View File

@@ -6,6 +6,7 @@
#include <ui/Menu.hpp>
#include <app/PortWidget.hpp>
#include <app/ParamWidget.hpp>
#include <app/ModuleLightWidget.hpp>
#include <app/Scene.hpp>
#include <engine/Module.hpp>
#include <engine/ParamQuantity.hpp>
@@ -59,8 +60,8 @@ template <class TParamWidget>
TParamWidget* createParam(math::Vec pos, engine::Module* module, int paramId) {
TParamWidget* o = new TParamWidget;
o->box.pos = pos;
o->module = module;
o->paramId = paramId;
o->app::ParamWidget::module = module;
o->app::ParamWidget::paramId = paramId;
o->init();
return o;
}
@@ -76,9 +77,9 @@ template <class TPortWidget>
TPortWidget* createInput(math::Vec pos, engine::Module* module, int inputId) {
TPortWidget* o = new TPortWidget;
o->box.pos = pos;
o->module = module;
o->type = engine::Port::INPUT;
o->portId = inputId;
o->app::PortWidget::module = module;
o->app::PortWidget::type = engine::Port::INPUT;
o->app::PortWidget::portId = inputId;
return o;
}

@@ -93,9 +94,9 @@ template <class TPortWidget>
TPortWidget* createOutput(math::Vec pos, engine::Module* module, int outputId) {
TPortWidget* o = new TPortWidget;
o->box.pos = pos;
o->module = module;
o->type = engine::Port::OUTPUT;
o->portId = outputId;
o->app::PortWidget::module = module;
o->app::PortWidget::type = engine::Port::OUTPUT;
o->app::PortWidget::portId = outputId;
return o;
}

@@ -110,8 +111,8 @@ template <class TModuleLightWidget>
TModuleLightWidget* createLight(math::Vec pos, engine::Module* module, int firstLightId) {
TModuleLightWidget* o = new TModuleLightWidget;
o->box.pos = pos;
o->module = module;
o->firstLightId = firstLightId;
o->app::ModuleLightWidget::module = module;
o->app::ModuleLightWidget::firstLightId = firstLightId;
return o;
}



+ 2
- 0
src/app/ParamWidget.cpp View File

@@ -228,6 +228,8 @@ void ParamWidget::createContextMenu() {
unmapItem->paramWidget = this;
menu->addChild(unmapItem);
}

appendContextMenu(menu);
}

void ParamWidget::resetAction() {


Loading…
Cancel
Save