2015-11-24 15:17:25 -05:00
|
|
|
/*
|
|
|
|
Copyright (C) 2009-2012 Paul Davis
|
|
|
|
|
|
|
|
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 2 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, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <list>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <gtkmm/comboboxtext.h>
|
|
|
|
#include <gtkmm/label.h>
|
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/adjustment.h>
|
|
|
|
#include <gtkmm/spinbutton.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
|
|
|
|
#include "gtkmm2ext/gtk_ui.h"
|
|
|
|
#include "gtkmm2ext/utils.h"
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
#include "faderport.h"
|
2015-11-24 15:17:25 -05:00
|
|
|
|
|
|
|
#include "i18n.h"
|
|
|
|
|
2015-11-24 20:12:01 -05:00
|
|
|
namespace ArdourSurface {
|
|
|
|
|
2015-11-24 15:17:25 -05:00
|
|
|
class GMCPGUI : public Gtk::VBox
|
|
|
|
{
|
|
|
|
public:
|
2015-11-24 18:00:11 -05:00
|
|
|
GMCPGUI (FaderPort&);
|
2015-11-24 15:17:25 -05:00
|
|
|
~GMCPGUI ();
|
|
|
|
|
|
|
|
private:
|
2015-11-24 18:00:11 -05:00
|
|
|
FaderPort& cp;
|
2015-11-24 15:17:25 -05:00
|
|
|
Gtk::ComboBoxText map_combo;
|
|
|
|
Gtk::Adjustment bank_adjustment;
|
|
|
|
Gtk::SpinButton bank_spinner;
|
|
|
|
Gtk::CheckButton motorised_button;
|
|
|
|
Gtk::Adjustment threshold_adjustment;
|
|
|
|
Gtk::SpinButton threshold_spinner;
|
|
|
|
|
|
|
|
void binding_changed ();
|
|
|
|
void bank_changed ();
|
|
|
|
void motorised_changed ();
|
|
|
|
void threshold_changed ();
|
|
|
|
};
|
|
|
|
|
2015-11-24 20:12:01 -05:00
|
|
|
}
|
|
|
|
|
2015-11-24 15:17:25 -05:00
|
|
|
using namespace PBD;
|
|
|
|
using namespace ARDOUR;
|
2015-11-24 20:12:01 -05:00
|
|
|
using namespace ArdourSurface;
|
2015-11-24 15:17:25 -05:00
|
|
|
using namespace std;
|
|
|
|
using namespace Gtk;
|
|
|
|
using namespace Gtkmm2ext;
|
|
|
|
|
|
|
|
void*
|
2015-11-24 18:00:11 -05:00
|
|
|
FaderPort::get_gui () const
|
2015-11-24 15:17:25 -05:00
|
|
|
{
|
|
|
|
if (!gui) {
|
2015-11-24 18:00:11 -05:00
|
|
|
const_cast<FaderPort*>(this)->build_gui ();
|
2015-11-24 15:17:25 -05:00
|
|
|
}
|
|
|
|
static_cast<Gtk::VBox*>(gui)->show_all();
|
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-11-24 18:00:11 -05:00
|
|
|
FaderPort::tear_down_gui ()
|
2015-11-24 15:17:25 -05:00
|
|
|
{
|
|
|
|
if (gui) {
|
|
|
|
Gtk::Widget *w = static_cast<Gtk::VBox*>(gui)->get_parent();
|
|
|
|
if (w) {
|
|
|
|
w->hide();
|
|
|
|
delete w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete (GMCPGUI*) gui;
|
|
|
|
gui = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-11-24 18:00:11 -05:00
|
|
|
FaderPort::build_gui ()
|
2015-11-24 15:17:25 -05:00
|
|
|
{
|
|
|
|
gui = (void*) new GMCPGUI (*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------*/
|
|
|
|
|
2015-11-24 18:00:11 -05:00
|
|
|
GMCPGUI::GMCPGUI (FaderPort& p)
|
2015-11-24 15:17:25 -05:00
|
|
|
: cp (p)
|
|
|
|
, bank_adjustment (1, 1, 100, 1, 10)
|
|
|
|
, bank_spinner (bank_adjustment)
|
|
|
|
, motorised_button ("Motorised")
|
|
|
|
, threshold_adjustment (p.threshold(), 1, 127, 1, 10)
|
|
|
|
, threshold_spinner (threshold_adjustment)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
GMCPGUI::~GMCPGUI ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GMCPGUI::bank_changed ()
|
|
|
|
{
|
|
|
|
// int new_bank = bank_adjustment.get_value() - 1;
|
|
|
|
// cp.set_current_bank (new_bank);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GMCPGUI::binding_changed ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GMCPGUI::motorised_changed ()
|
|
|
|
{
|
|
|
|
// cp.set_motorised (motorised_button.get_active ());
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GMCPGUI::threshold_changed ()
|
|
|
|
{
|
|
|
|
// cp.set_threshold (threshold_adjustment.get_value());
|
|
|
|
}
|