2013-01-16 13:37:48 -05:00
|
|
|
/*
|
2015-10-04 14:51:05 -04:00
|
|
|
Copyright (C) 2012 Paul Davis
|
2013-01-16 13:37:48 -05:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-10-11 21:54:35 -04:00
|
|
|
#ifndef __ardour_gtk_key_editor_h__
|
|
|
|
#define __ardour_gtk_key_editor_h__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2008-01-10 17:22:29 -05:00
|
|
|
#include <gtkmm/buttonbox.h>
|
2015-08-04 13:59:32 -04:00
|
|
|
#include <gtkmm/notebook.h>
|
|
|
|
#include <gtkmm/scrolledwindow.h>
|
2007-10-11 21:54:35 -04:00
|
|
|
#include <gtkmm/treeview.h>
|
|
|
|
#include <gtkmm/treestore.h>
|
|
|
|
|
2011-11-18 19:56:35 -05:00
|
|
|
#include "ardour_window.h"
|
2007-10-11 21:54:35 -04:00
|
|
|
|
2015-08-04 13:59:32 -04:00
|
|
|
namespace Gtkmm2ext {
|
|
|
|
class Bindings;
|
|
|
|
}
|
|
|
|
|
2011-11-18 19:56:35 -05:00
|
|
|
class KeyEditor : public ArdourWindow
|
2007-10-11 21:54:35 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
KeyEditor ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-08-04 13:59:32 -04:00
|
|
|
void add_tab (std::string const &name, Gtkmm2ext::Bindings&);
|
|
|
|
|
2007-10-11 21:54:35 -04:00
|
|
|
protected:
|
2007-10-12 18:30:25 -04:00
|
|
|
bool on_key_press_event (GdkEventKey*);
|
2007-10-11 21:54:35 -04:00
|
|
|
bool on_key_release_event (GdkEventKey*);
|
|
|
|
|
|
|
|
private:
|
2015-08-04 13:59:32 -04:00
|
|
|
class Tab : public Gtk::VBox
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Tab (KeyEditor&, std::string const &name, Gtkmm2ext::Bindings*);
|
|
|
|
|
|
|
|
void populate ();
|
|
|
|
void unbind ();
|
|
|
|
void bind (GdkEventKey* release_event, guint pressed_key);
|
|
|
|
void action_selected ();
|
|
|
|
|
|
|
|
struct KeyEditorColumns : public Gtk::TreeModel::ColumnRecord {
|
|
|
|
KeyEditorColumns () {
|
2015-08-05 10:57:00 -04:00
|
|
|
add (name);
|
2015-08-04 13:59:32 -04:00
|
|
|
add (binding);
|
|
|
|
add (path);
|
|
|
|
add (bindable);
|
2015-08-05 10:57:00 -04:00
|
|
|
add (action);
|
2015-08-04 13:59:32 -04:00
|
|
|
}
|
2015-08-05 10:57:00 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
2015-08-04 13:59:32 -04:00
|
|
|
Gtk::TreeModelColumn<std::string> binding;
|
|
|
|
Gtk::TreeModelColumn<std::string> path;
|
|
|
|
Gtk::TreeModelColumn<bool> bindable;
|
2015-08-05 10:57:00 -04:00
|
|
|
Gtk::TreeModelColumn<Glib::RefPtr<Gtk::Action> > action;
|
2015-08-04 13:59:32 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Gtk::VBox vpacker;
|
|
|
|
/* give KeyEditor full access to these. This is just a helper
|
|
|
|
class with no special semantics
|
|
|
|
*/
|
|
|
|
|
|
|
|
KeyEditor& owner;
|
|
|
|
std::string name;
|
|
|
|
Gtkmm2ext::Bindings* bindings;
|
|
|
|
Gtk::ScrolledWindow scroller;
|
|
|
|
Gtk::TreeView view;
|
|
|
|
Glib::RefPtr<Gtk::TreeStore> model;
|
|
|
|
KeyEditorColumns columns;
|
2007-10-11 21:54:35 -04:00
|
|
|
};
|
|
|
|
|
2015-08-04 13:59:32 -04:00
|
|
|
friend class Tab;
|
|
|
|
|
|
|
|
Gtk::VBox vpacker;
|
|
|
|
Gtk::Notebook notebook;
|
2008-01-10 17:22:29 -05:00
|
|
|
Gtk::Button unbind_button;
|
|
|
|
Gtk::HButtonBox unbind_box;
|
2014-07-10 11:04:24 -04:00
|
|
|
Gtk::HBox reset_box;
|
|
|
|
Gtk::Button reset_button;
|
|
|
|
Gtk::Label reset_label;
|
2014-12-18 11:14:41 -05:00
|
|
|
guint last_keyval;
|
2007-10-12 18:30:25 -04:00
|
|
|
|
2015-08-04 13:59:32 -04:00
|
|
|
typedef std::vector<Tab*> Tabs;
|
2014-07-10 11:04:24 -04:00
|
|
|
|
2015-08-04 13:59:32 -04:00
|
|
|
Tabs tabs;
|
|
|
|
Tab* current_tab();
|
|
|
|
|
|
|
|
void unbind ();
|
2014-07-10 11:04:24 -04:00
|
|
|
void reset ();
|
2015-08-04 13:59:32 -04:00
|
|
|
void page_change (GtkNotebookPage*, guint);
|
2007-10-11 21:54:35 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk_key_editor_h__ */
|