Guitarix
gx_portmap.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3 * Copyright (C) 2011 Pete Shorthose
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * --------------------------------------------------------------------------
19 */
20
21/* ------- This is the GUI namespace ------- */
22
23
24#pragma once
25
26#ifndef SRC_HEADERS_GX_PORTMAP_H_
27#define SRC_HEADERS_GX_PORTMAP_H_
28
29#include <gtk/gtk.h>
30#include <gtkmm.h>
31#include <jack/jack.h>
32
33#include <list>
34#include <string>
35
36namespace gx_portmap {
37
38/****************************************************************
39 ** PortMapWindow
40 */
41
42struct PortAttr {
43 const int client_num;
44 const bool is_insert;
45 const char *port_name;
47 const char *port_type;
48};
49
51 Glib::RefPtr<Gtk::TreeStore> treestore;
52 Gtk::ScrolledWindow *scrolled_window;
53 Gtk::Expander *expander;
54 Gtk::Label *label;
56};
57
58class PortMapWindow: public sigc::trackable {
59private:
60 enum {
62 };
63 struct ModelColumns : public Gtk::TreeModelColumnRecord {
64 Gtk::TreeModelColumn<Glib::ustring> port;
65 Gtk::TreeModelColumn<bool> connected;
66 Gtk::TreeModelColumn<bool> is_port;
67 ModelColumns() { add(port); add(connected); add(is_port); }
68 };
71 list<string> excluded_clients;
74 void on_expander(Gtk::Expander& expander);
76 void on_cell_toggle(Glib::ustring path, PortSection& p);
77 void update_summary(PortSection& p, string *port = 0, bool connect = false);
78 void redraw_expander(Gtk::Expander* expander);
79 list<string> walk(Glib::RefPtr<Gtk::TreeStore> ts, string *port, int connect);
80 bool walk_remove(Glib::RefPtr<Gtk::TreeStore> ts, bool (*compare)(const string&, const char*), string data);
81 void walk_insert(Glib::RefPtr<Gtk::TreeStore> ts, string data);
82 void load(int sect, jack_port_t*);
83 void load_all();
84 int sort_func(const Gtk::TreeIter& a, const Gtk::TreeIter& b);
85 explicit PortMapWindow(Glib::RefPtr<gx_gui::GxBuilder> bld, gx_jack::GxJack& jack, Glib::RefPtr<Gtk::AccelGroup> ag);
86 Gtk::Dialog *window;
87 void client_removed(string name);
88 void port_changed(string name, const char *tp, int flags, bool reg);
89public:
91 static PortMapWindow* create(gx_engine::GxMachineBase& machine, Glib::RefPtr<Gtk::AccelGroup> ag);
92 void refresh();
93 void connection_changed(string port1, string port2, bool conn);
94 Glib::SignalProxy1<void,int> signal_response() { return window->signal_response(); }
95};
96
97} // end namespace gx_portmap
98#endif // SRC_HEADERS_GX_PORTMAP_H_
void redraw_expander(Gtk::Expander *expander)
Gtk::Dialog * window
Definition: gx_portmap.h:86
PortMapWindow(Glib::RefPtr< gx_gui::GxBuilder > bld, gx_jack::GxJack &jack, Glib::RefPtr< Gtk::AccelGroup > ag)
void walk_insert(Glib::RefPtr< Gtk::TreeStore > ts, string data)
void update_summary(PortSection &p, string *port=0, bool connect=false)
list< string > walk(Glib::RefPtr< Gtk::TreeStore > ts, string *port, int connect)
list< string > excluded_clients
Definition: gx_portmap.h:71
gx_jack::GxJack & jack
Definition: gx_portmap.h:72
Glib::SignalProxy1< void, int > signal_response()
Definition: gx_portmap.h:94
const ModelColumns columns
Definition: gx_portmap.h:69
PortSection portsection[number_of_ports]
Definition: gx_portmap.h:70
Gtk::Widget * monitored_expander_child
Definition: gx_portmap.h:73
int sort_func(const Gtk::TreeIter &a, const Gtk::TreeIter &b)
void on_cell_toggle(Glib::ustring path, PortSection &p)
void client_removed(string name)
void port_changed(string name, const char *tp, int flags, bool reg)
void connection_changed(string port1, string port2, bool conn)
static PortMapWindow * create(gx_engine::GxMachineBase &machine, Glib::RefPtr< Gtk::AccelGroup > ag)
void on_expander(Gtk::Expander &expander)
void load(int sect, jack_port_t *)
bool walk_remove(Glib::RefPtr< Gtk::TreeStore > ts, bool(*compare)(const string &, const char *), string data)
const bool is_insert
Definition: gx_portmap.h:44
const char * port_type
Definition: gx_portmap.h:47
const int client_num
Definition: gx_portmap.h:43
const char * port_name
Definition: gx_portmap.h:45
Gtk::TreeModelColumn< Glib::ustring > port
Definition: gx_portmap.h:64
Gtk::TreeModelColumn< bool > is_port
Definition: gx_portmap.h:66
Gtk::TreeModelColumn< bool > connected
Definition: gx_portmap.h:65
Gtk::Label * label
Definition: gx_portmap.h:54
Glib::RefPtr< Gtk::TreeStore > treestore
Definition: gx_portmap.h:51
Gtk::ScrolledWindow * scrolled_window
Definition: gx_portmap.h:52
Gtk::Expander * expander
Definition: gx_portmap.h:53