2013-12-08 22:44:43 +01:00
|
|
|
/*
|
|
|
|
* Author: Harry van Haaren 2013
|
|
|
|
* harryhaaren@gmail.com
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2013-10-18 14:49:46 +02:00
|
|
|
|
|
|
|
#ifndef LUPPP_OPTIONS_H
|
|
|
|
#define LUPPP_OPTIONS_H
|
|
|
|
|
2013-11-23 01:14:53 +01:00
|
|
|
#include "config.hxx"
|
|
|
|
|
2013-10-18 15:33:00 +02:00
|
|
|
#include <string>
|
|
|
|
|
2013-10-18 14:49:46 +02:00
|
|
|
#include <FL/Fl.H>
|
2013-10-18 16:06:27 +02:00
|
|
|
#include <FL/Fl_Box.H>
|
2013-10-18 15:12:34 +02:00
|
|
|
#include <FL/Fl_Tabs.H>
|
2013-11-19 20:44:25 +01:00
|
|
|
#include <FL/Fl_Pack.H>
|
2013-10-18 16:56:20 +02:00
|
|
|
#include <FL/Fl_Table.H>
|
2013-10-18 15:12:34 +02:00
|
|
|
#include <FL/Fl_Group.H>
|
2013-10-18 14:49:46 +02:00
|
|
|
#include <FL/Fl_Double_Window.H>
|
|
|
|
|
2013-11-14 20:45:43 +01:00
|
|
|
#include "controller/genericmidi.hxx"
|
2013-11-14 19:29:15 +01:00
|
|
|
|
2013-10-18 16:56:20 +02:00
|
|
|
#include "avtk/bindings.h"
|
2013-10-18 14:49:46 +02:00
|
|
|
#include "avtk/avtk_button.h"
|
|
|
|
#include "avtk/avtk_light_button.h"
|
|
|
|
|
2013-10-18 16:56:20 +02:00
|
|
|
class Binding;
|
2013-11-11 00:13:12 +01:00
|
|
|
class OptionsWindow;
|
2013-10-18 16:56:20 +02:00
|
|
|
|
2013-11-10 19:25:15 +01:00
|
|
|
/// contains UI elements to represent one controller
|
|
|
|
class ControllerUI
|
|
|
|
{
|
|
|
|
public:
|
2013-11-10 21:13:41 +01:00
|
|
|
ControllerUI( int x, int y, int w, int h, std::string name,int id);
|
2013-11-10 19:25:15 +01:00
|
|
|
~ControllerUI();
|
|
|
|
|
2013-11-16 18:19:36 +01:00
|
|
|
void setAuthor(std::string author);
|
2013-12-02 01:24:24 +01:00
|
|
|
void setLink (std::string link );
|
|
|
|
std::string getAuthor(){return author;}
|
|
|
|
std::string getLink(){return link;}
|
2013-11-10 19:38:41 +01:00
|
|
|
|
2013-11-16 18:19:36 +01:00
|
|
|
void setTarget(const char* n);
|
2013-11-10 19:38:41 +01:00
|
|
|
void setBindEnable( bool b );
|
2013-11-16 18:19:36 +01:00
|
|
|
|
|
|
|
void addBinding( Binding* b );
|
2013-11-14 20:45:43 +01:00
|
|
|
void addBindings( GenericMIDI* c );
|
2013-11-10 19:38:41 +01:00
|
|
|
|
2013-11-10 19:25:15 +01:00
|
|
|
// the ControllerID this UI class represents
|
|
|
|
int controllerID;
|
2013-11-10 21:13:41 +01:00
|
|
|
|
|
|
|
// for adding to GOptions tabs
|
|
|
|
Fl_Group* widget;
|
|
|
|
|
2013-11-21 15:43:22 +01:00
|
|
|
std::string name;
|
2013-11-11 00:13:12 +01:00
|
|
|
|
|
|
|
OptionsWindow* optionsWindow;
|
2013-11-19 22:55:52 +01:00
|
|
|
|
|
|
|
// public to redraw when removing from static
|
|
|
|
Fl_Scroll* scroll;
|
|
|
|
Fl_Pack* bindingsPack;
|
2013-11-10 19:25:15 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
// bindings
|
2013-11-21 15:43:22 +01:00
|
|
|
std::string target;
|
2013-11-16 18:19:36 +01:00
|
|
|
std::string author;
|
2013-12-02 01:24:24 +01:00
|
|
|
std::string link;
|
2013-11-21 15:43:22 +01:00
|
|
|
|
2013-12-02 01:24:24 +01:00
|
|
|
Avtk::Button* authorLabel;
|
|
|
|
Avtk::Button* linkLabel;
|
2013-11-16 18:19:36 +01:00
|
|
|
|
2013-11-19 22:37:34 +01:00
|
|
|
std::vector<int> bindingID;
|
2013-11-19 20:44:25 +01:00
|
|
|
|
2013-11-10 19:25:15 +01:00
|
|
|
Fl_Box* targetLabel;
|
|
|
|
Fl_Box* targetLabelStat;
|
2013-12-05 21:45:56 +01:00
|
|
|
//Avtk::Bindings* bindings;
|
2013-11-10 19:25:15 +01:00
|
|
|
Avtk::LightButton* bindEnable;
|
2013-11-10 21:13:41 +01:00
|
|
|
Avtk::Button* removeController;
|
2013-11-14 19:29:15 +01:00
|
|
|
Avtk::Button* writeControllerBtn;
|
2013-11-10 19:25:15 +01:00
|
|
|
};
|
|
|
|
|
2013-10-18 14:49:46 +02:00
|
|
|
class OptionsWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
OptionsWindow();
|
2013-11-11 17:48:34 +01:00
|
|
|
~OptionsWindow();
|
2013-10-18 14:49:46 +02:00
|
|
|
|
|
|
|
void show();
|
2013-11-09 22:50:21 +01:00
|
|
|
void hide();
|
|
|
|
|
2013-11-16 18:19:36 +01:00
|
|
|
void setTarget(const char* n);
|
2013-11-10 19:38:41 +01:00
|
|
|
ControllerUI* getControllerUI(int id);
|
2013-11-10 21:13:41 +01:00
|
|
|
|
|
|
|
// public for static methods only
|
|
|
|
Fl_Tabs* tabs;
|
2013-11-10 23:52:53 +01:00
|
|
|
std::vector<ControllerUI*> controllers;
|
2013-11-11 00:24:21 +01:00
|
|
|
Fl_Group* addGroup;
|
2013-11-12 13:18:43 +01:00
|
|
|
#ifdef BUILD_TESTS
|
|
|
|
int runTests();
|
|
|
|
#endif
|
2013-10-18 14:49:46 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Fl_Double_Window* window;
|
2013-11-02 18:54:42 +01:00
|
|
|
Avtk::Button* newButton;
|
2013-11-11 00:24:21 +01:00
|
|
|
Avtk::Button* loadButton;
|
2013-10-18 14:49:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LUPPP_OPTIONS_H
|