diff --git a/src/avtk/bindings.cxx b/src/avtk/bindings.cxx index 84db6e7..e32ca4a 100644 --- a/src/avtk/bindings.cxx +++ b/src/avtk/bindings.cxx @@ -119,9 +119,11 @@ void Bindings::add( Binding* b ) binds.push_back( tmp ); + /* int height = binds.size() * bindYPx; printf("resize to %i, %i, %i, %i\n", x, y, w, height ); resize( x, y, w, height ); + */ redraw(); } diff --git a/src/goptions.cxx b/src/goptions.cxx index 65a603c..824f30a 100644 --- a/src/goptions.cxx +++ b/src/goptions.cxx @@ -11,7 +11,7 @@ #include "gui.hxx" extern Gui* gui; -static void addControllerUiDsp(OptionsWindow* self, Controller* c) +static void addControllerUiDsp(OptionsWindow* self, GenericMIDI* c) { // add the controller to the UI int x, y, w, h; @@ -26,6 +26,7 @@ static void addControllerUiDsp(OptionsWindow* self, Controller* c) // add widget before "add" button self->tabs->insert( *self->controllers.back()->widget, self->addGroup ); + // tell the ControllerUI to add the bindings from this Controller* self->controllers.back()->addBindings( c ); self->tabs->redraw(); @@ -122,7 +123,7 @@ static void selectLoadController(Fl_Widget* w, void* data) return; LUPPP_NOTE("%s","ADD Controller cb"); - Controller* c = new GenericMIDI( path ); + GenericMIDI* c = new GenericMIDI( path ); if ( c->status() == Controller::CONTROLLER_OK ) { @@ -165,6 +166,7 @@ ControllerUI::ControllerUI(int x, int y, int w, int h, std::string n, int ID) removeController = new Avtk::Button(x + 110, y + h - 27, 100, 25, "Remove"); Fl_Scroll* s = new Fl_Scroll( x + 5, y + 35, 400, 180 ); + s->box( FL_UP_BOX ); bindings = new Avtk::Bindings( x + 5, y + 35, 398, 10 ); s->end(); } @@ -194,10 +196,15 @@ void ControllerUI::setBindEnable( bool b ) { bindEnable->value( b ); } -void ControllerUI::addBindings( Controller* c ) +void ControllerUI::addBindings( GenericMIDI* c ) { // FIXME: add binding to Avtk::Binding here - //bindings->add( b ); + std::vector bindingVector= c->getMidiToAction(); + + for( int i = 0; i < bindingVector.size() && i < 5; i++ ) + { + bindings->add( bindingVector.at(i) ); + } } ControllerUI::~ControllerUI() diff --git a/src/goptions.hxx b/src/goptions.hxx index ac56582..29085cb 100644 --- a/src/goptions.hxx +++ b/src/goptions.hxx @@ -11,7 +11,7 @@ #include #include -#include "controller/controller.hxx" +#include "controller/genericmidi.hxx" #include "avtk/bindings.h" #include "avtk/avtk_button.h" @@ -30,7 +30,7 @@ class ControllerUI void setTarget(const char* n); void setBindEnable( bool b ); - void addBindings( Controller* c ); + void addBindings( GenericMIDI* c ); // the ControllerID this UI class represents int controllerID;