Loading...
Searching...
No Matches
gx_portmap.h
Go to the documentation of this file.
/*
* Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
* Copyright (C) 2011 Pete Shorthose
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* --------------------------------------------------------------------------
*/
/* ------- This is the GUI namespace ------- */
#pragma once
#ifndef SRC_HEADERS_GX_PORTMAP_H_
#define SRC_HEADERS_GX_PORTMAP_H_
#include <gtk/gtk.h>
#include <gtkmm.h>
#include <jack/jack.h>
#include <list>
#include <string>
namespace gx_portmap {
/****************************************************************
** PortMapWindow
*/
struct PortAttr {
const int client_num;
const bool is_insert;
const char *port_name;
bool is_input;
const char *port_type;
};
struct PortSection {
Glib::RefPtr<Gtk::TreeStore> treestore;
Gtk::ScrolledWindow *scrolled_window;
Gtk::Expander *expander;
Gtk::Label *label;
PortAttr *port_attr;
};
class PortMapWindow: public sigc::trackable {
private:
enum {
number_of_ports = 7
};
struct ModelColumns : public Gtk::TreeModelColumnRecord {
Gtk::TreeModelColumn<Glib::ustring> port;
Gtk::TreeModelColumn<bool> connected;
Gtk::TreeModelColumn<bool> is_port;
ModelColumns() { add(port); add(connected); add(is_port); }
};
const ModelColumns columns;
PortSection portsection[number_of_ports];
list<string> excluded_clients;
gx_jack::GxJack& jack;
Gtk::Widget *monitored_expander_child;
void on_expander(Gtk::Expander& expander);
void on_check_resize();
void on_cell_toggle(Glib::ustring path, PortSection& p);
void update_summary(PortSection& p, string *port = 0, bool connect = false);
void redraw_expander(Gtk::Expander* expander);
list<string> walk(Glib::RefPtr<Gtk::TreeStore> ts, string *port, int connect);
bool walk_remove(Glib::RefPtr<Gtk::TreeStore> ts, bool (*compare)(const string&, const char*), string data);
void walk_insert(Glib::RefPtr<Gtk::TreeStore> ts, string data);
void load(int sect, jack_port_t*);
void load_all();
int sort_func(const Gtk::TreeIter& a, const Gtk::TreeIter& b);
explicit PortMapWindow(Glib::RefPtr<gx_gui::GxBuilder> bld, gx_jack::GxJack& jack, Glib::RefPtr<Gtk::AccelGroup> ag);
Gtk::Dialog *window;
void client_removed(string name);
void port_changed(string name, const char *tp, int flags, bool reg);
public:
~PortMapWindow();
static PortMapWindow* create(gx_engine::GxMachineBase& machine, Glib::RefPtr<Gtk::AccelGroup> ag);
void refresh();
void connection_changed(string port1, string port2, bool conn);
Glib::SignalProxy1<void,int> signal_response() { return window->signal_response(); }
};
} // end namespace gx_portmap
#endif // SRC_HEADERS_GX_PORTMAP_H_
gx_engine::GxMachineBase
Definition machine.h:59
gx_jack::GxJack
Definition gx_jack.h:168
gx_portmap::PortMapWindow::redraw_expander
void redraw_expander(Gtk::Expander *expander)
gx_portmap::PortMapWindow::window
Gtk::Dialog * window
Definition gx_portmap.h:86
gx_portmap::PortMapWindow::PortMapWindow
PortMapWindow(Glib::RefPtr< gx_gui::GxBuilder > bld, gx_jack::GxJack &jack, Glib::RefPtr< Gtk::AccelGroup > ag)
gx_portmap::PortMapWindow::walk_insert
void walk_insert(Glib::RefPtr< Gtk::TreeStore > ts, string data)
gx_portmap::PortMapWindow::update_summary
void update_summary(PortSection &p, string *port=0, bool connect=false)
gx_portmap::PortMapWindow::walk
list< string > walk(Glib::RefPtr< Gtk::TreeStore > ts, string *port, int connect)
gx_portmap::PortMapWindow::load_all
void load_all()
gx_portmap::PortMapWindow::excluded_clients
list< string > excluded_clients
Definition gx_portmap.h:71
gx_portmap::PortMapWindow::refresh
void refresh()
gx_portmap::PortMapWindow::jack
gx_jack::GxJack & jack
Definition gx_portmap.h:72
gx_portmap::PortMapWindow::signal_response
Glib::SignalProxy1< void, int > signal_response()
Definition gx_portmap.h:94
gx_portmap::PortMapWindow::columns
const ModelColumns columns
Definition gx_portmap.h:69
gx_portmap::PortMapWindow::portsection
PortSection portsection[number_of_ports]
Definition gx_portmap.h:70
gx_portmap::PortMapWindow::on_check_resize
void on_check_resize()
gx_portmap::PortMapWindow::monitored_expander_child
Gtk::Widget * monitored_expander_child
Definition gx_portmap.h:73
gx_portmap::PortMapWindow::sort_func
int sort_func(const Gtk::TreeIter &a, const Gtk::TreeIter &b)
gx_portmap::PortMapWindow::on_cell_toggle
void on_cell_toggle(Glib::ustring path, PortSection &p)
gx_portmap::PortMapWindow::~PortMapWindow
~PortMapWindow()
gx_portmap::PortMapWindow::client_removed
void client_removed(string name)
gx_portmap::PortMapWindow::port_changed
void port_changed(string name, const char *tp, int flags, bool reg)
gx_portmap::PortMapWindow::number_of_ports
@ number_of_ports
Definition gx_portmap.h:61
gx_portmap::PortMapWindow::connection_changed
void connection_changed(string port1, string port2, bool conn)
gx_portmap::PortMapWindow::create
static PortMapWindow * create(gx_engine::GxMachineBase &machine, Glib::RefPtr< Gtk::AccelGroup > ag)
gx_portmap::PortMapWindow::on_expander
void on_expander(Gtk::Expander &expander)
gx_portmap::PortMapWindow::load
void load(int sect, jack_port_t *)
gx_portmap::PortMapWindow::walk_remove
bool walk_remove(Glib::RefPtr< Gtk::TreeStore > ts, bool(*compare)(const string &, const char *), string data)
gx_portmap
Definition gx_portmap.h:36
gx_portmap::PortAttr
Definition gx_portmap.h:42
gx_portmap::PortAttr::is_insert
const bool is_insert
Definition gx_portmap.h:44
gx_portmap::PortAttr::port_type
const char * port_type
Definition gx_portmap.h:47
gx_portmap::PortAttr::client_num
const int client_num
Definition gx_portmap.h:43
gx_portmap::PortAttr::is_input
bool is_input
Definition gx_portmap.h:46
gx_portmap::PortAttr::port_name
const char * port_name
Definition gx_portmap.h:45
gx_portmap::PortMapWindow::ModelColumns
Definition gx_portmap.h:63
gx_portmap::PortMapWindow::ModelColumns::port
Gtk::TreeModelColumn< Glib::ustring > port
Definition gx_portmap.h:64
gx_portmap::PortMapWindow::ModelColumns::is_port
Gtk::TreeModelColumn< bool > is_port
Definition gx_portmap.h:66
gx_portmap::PortMapWindow::ModelColumns::ModelColumns
ModelColumns()
Definition gx_portmap.h:67
gx_portmap::PortMapWindow::ModelColumns::connected
Gtk::TreeModelColumn< bool > connected
Definition gx_portmap.h:65
gx_portmap::PortSection
Definition gx_portmap.h:50
gx_portmap::PortSection::port_attr
PortAttr * port_attr
Definition gx_portmap.h:55
gx_portmap::PortSection::label
Gtk::Label * label
Definition gx_portmap.h:54
gx_portmap::PortSection::treestore
Glib::RefPtr< Gtk::TreeStore > treestore
Definition gx_portmap.h:51
gx_portmap::PortSection::scrolled_window
Gtk::ScrolledWindow * scrolled_window
Definition gx_portmap.h:52
gx_portmap::PortSection::expander
Gtk::Expander * expander
Definition gx_portmap.h:53