mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 09:01:39 -05:00
-Refactoring Bindings in UI
This commit is contained in:
parent
0a6d8941cd
commit
aed8b2125d
3 changed files with 15 additions and 6 deletions
|
@ -119,9 +119,11 @@ void Bindings::add( Binding* b )
|
||||||
|
|
||||||
binds.push_back( tmp );
|
binds.push_back( tmp );
|
||||||
|
|
||||||
|
/*
|
||||||
int height = binds.size() * bindYPx;
|
int height = binds.size() * bindYPx;
|
||||||
printf("resize to %i, %i, %i, %i\n", x, y, w, height );
|
printf("resize to %i, %i, %i, %i\n", x, y, w, height );
|
||||||
resize( x, y, w, height );
|
resize( x, y, w, height );
|
||||||
|
*/
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "gui.hxx"
|
#include "gui.hxx"
|
||||||
extern Gui* gui;
|
extern Gui* gui;
|
||||||
|
|
||||||
static void addControllerUiDsp(OptionsWindow* self, Controller* c)
|
static void addControllerUiDsp(OptionsWindow* self, GenericMIDI* c)
|
||||||
{
|
{
|
||||||
// add the controller to the UI
|
// add the controller to the UI
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
|
@ -26,6 +26,7 @@ static void addControllerUiDsp(OptionsWindow* self, Controller* c)
|
||||||
// add widget before "add" button
|
// add widget before "add" button
|
||||||
self->tabs->insert( *self->controllers.back()->widget, self->addGroup );
|
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->controllers.back()->addBindings( c );
|
||||||
|
|
||||||
self->tabs->redraw();
|
self->tabs->redraw();
|
||||||
|
@ -122,7 +123,7 @@ static void selectLoadController(Fl_Widget* w, void* data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LUPPP_NOTE("%s","ADD Controller cb");
|
LUPPP_NOTE("%s","ADD Controller cb");
|
||||||
Controller* c = new GenericMIDI( path );
|
GenericMIDI* c = new GenericMIDI( path );
|
||||||
|
|
||||||
if ( c->status() == Controller::CONTROLLER_OK )
|
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");
|
removeController = new Avtk::Button(x + 110, y + h - 27, 100, 25, "Remove");
|
||||||
|
|
||||||
Fl_Scroll* s = new Fl_Scroll( x + 5, y + 35, 400, 180 );
|
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 );
|
bindings = new Avtk::Bindings( x + 5, y + 35, 398, 10 );
|
||||||
s->end();
|
s->end();
|
||||||
}
|
}
|
||||||
|
@ -194,10 +196,15 @@ void ControllerUI::setBindEnable( bool b )
|
||||||
{
|
{
|
||||||
bindEnable->value( b );
|
bindEnable->value( b );
|
||||||
}
|
}
|
||||||
void ControllerUI::addBindings( Controller* c )
|
void ControllerUI::addBindings( GenericMIDI* c )
|
||||||
{
|
{
|
||||||
// FIXME: add binding to Avtk::Binding here
|
// FIXME: add binding to Avtk::Binding here
|
||||||
//bindings->add( b );
|
std::vector<Binding*> bindingVector= c->getMidiToAction();
|
||||||
|
|
||||||
|
for( int i = 0; i < bindingVector.size() && i < 5; i++ )
|
||||||
|
{
|
||||||
|
bindings->add( bindingVector.at(i) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerUI::~ControllerUI()
|
ControllerUI::~ControllerUI()
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <FL/Fl_Group.H>
|
#include <FL/Fl_Group.H>
|
||||||
#include <FL/Fl_Double_Window.H>
|
#include <FL/Fl_Double_Window.H>
|
||||||
|
|
||||||
#include "controller/controller.hxx"
|
#include "controller/genericmidi.hxx"
|
||||||
|
|
||||||
#include "avtk/bindings.h"
|
#include "avtk/bindings.h"
|
||||||
#include "avtk/avtk_button.h"
|
#include "avtk/avtk_button.h"
|
||||||
|
@ -30,7 +30,7 @@ class ControllerUI
|
||||||
void setTarget(const char* n);
|
void setTarget(const char* n);
|
||||||
|
|
||||||
void setBindEnable( bool b );
|
void setBindEnable( bool b );
|
||||||
void addBindings( Controller* c );
|
void addBindings( GenericMIDI* c );
|
||||||
|
|
||||||
// the ControllerID this UI class represents
|
// the ControllerID this UI class represents
|
||||||
int controllerID;
|
int controllerID;
|
||||||
|
|
Loading…
Add table
Reference in a new issue