1 |
/**************************************************************************** |
2 |
GLASHCtl - a simple tray applet for controlling lashd |
3 |
|
4 |
Copyright (C) 2006 Lars Luthman <lars.luthman@gmail.com> |
5 |
|
6 |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 3 of the License, or |
9 |
(at your option) any later version. |
10 |
|
11 |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
15 |
|
16 |
You should have received a copy of the GNU General Public License |
17 |
along with this program; if not, write to the Free Software Foundation, |
18 |
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 |
****************************************************************************/ |
20 |
|
21 |
#ifndef POPUPMENU_HPP |
22 |
#define POPUPMENU_HPP |
23 |
|
24 |
#include <map> |
25 |
#include <set> |
26 |
#include <string> |
27 |
#include <vector> |
28 |
|
29 |
#include <gtkmm.h> |
30 |
|
31 |
#include "sessionchooserdialog.hpp" |
32 |
|
33 |
|
34 |
class PopupMenu : public Gtk::Menu { |
35 |
public: |
36 |
|
37 |
PopupMenu(); |
38 |
|
39 |
/** Called when the LASH daemon has been started. */ |
40 |
void lashd_started(); |
41 |
|
42 |
/** Called when the LASH daemon has been stopped. */ |
43 |
void lashd_stopped(); |
44 |
|
45 |
/** Called when the active LASH session's name has changed. */ |
46 |
void session_changed(const std::string& name); |
47 |
|
48 |
/** Called when the active LASH session has been saved. */ |
49 |
void session_saved(const std::string& name, const std::string& dir); |
50 |
|
51 |
/** Called when a new JACK input port has appeared. */ |
52 |
void add_input(const std::string& name, const std::string& type); |
53 |
|
54 |
/** Called when a new JACK output port has appeared. */ |
55 |
void add_output(const std::string& name, const std::string& type); |
56 |
|
57 |
/** Called when a JACK input port has disappeared. */ |
58 |
void remove_input(const std::string& name); |
59 |
|
60 |
/** Called when a JACK output port has disappeared. */ |
61 |
void remove_output(const std::string& name); |
62 |
|
63 |
/** Called when two JACK ports have been connected. */ |
64 |
void connect(const std::string& output, const std::string& input); |
65 |
|
66 |
/** Called when two JACK ports have been disconnected. */ |
67 |
void disconnect(const std::string& output, const std::string& input); |
68 |
|
69 |
/** Emitted when the TrayIcon wants to start lashd. */ |
70 |
sigc::signal<void> signal_start_lashd; |
71 |
|
72 |
/** Emitted when the TrayIcon wants to stop lashd. */ |
73 |
sigc::signal<void> signal_stop_lashd; |
74 |
|
75 |
/** Emitted when the TrayIcon wants to save the active LASH session. */ |
76 |
sigc::signal<void> signal_save_session; |
77 |
|
78 |
/** Emitted when the TrayIcon wants to move the active LASH session. */ |
79 |
sigc::signal<void, const std::string&> signal_set_session_dir; |
80 |
|
81 |
/** Emitted when the TrayIcon wants to rename the active LASH session. */ |
82 |
sigc::signal<void, const std::string&> signal_set_session_name; |
83 |
|
84 |
/** Emitted when the TrayIcon wants to close the active LASH session. */ |
85 |
sigc::signal<void> signal_close_session; |
86 |
|
87 |
/** Emitted when the TrayIcon wants to restore a LASH session. */ |
88 |
sigc::signal<void, const std::string&> signal_restore_session; |
89 |
|
90 |
/** Emitted when the TrayIcon wants to connect two JACK ports. */ |
91 |
sigc::signal<void, const std::string&, const std::string&> signal_connect; |
92 |
|
93 |
/** Emitted when the TrayIcon wants to disconnect two JACK ports. */ |
94 |
sigc::signal<void, const std::string&, const std::string&> signal_disconnect; |
95 |
|
96 |
protected: |
97 |
|
98 |
void do_restore(); |
99 |
void do_quit(); |
100 |
void do_set_session_name(); |
101 |
void do_set_session_dir(); |
102 |
|
103 |
void toggle_connection(const std::string& output, const std::string& input); |
104 |
|
105 |
void dump_recent(); |
106 |
|
107 |
std::string m_session_name; |
108 |
|
109 |
Glib::RefPtr<Gdk::Pixbuf> m_midi_pixbuf; |
110 |
Glib::RefPtr<Gdk::Pixbuf> m_audio_pixbuf; |
111 |
|
112 |
Gtk::Menu m_restorerecentmenu; |
113 |
Gtk::Menu m_connect_menu; |
114 |
|
115 |
Gtk::MenuItem m_connectitem; |
116 |
Gtk::MenuItem m_startitem; |
117 |
Gtk::MenuItem m_stopitem; |
118 |
Gtk::MenuItem m_restoreitem; |
119 |
Gtk::MenuItem m_restorerecentitem; |
120 |
Gtk::MenuItem m_saveitem; |
121 |
Gtk::MenuItem m_closeitem; |
122 |
Gtk::MenuItem m_setsessiondiritem; |
123 |
Gtk::MenuItem m_setsessionnameitem; |
124 |
|
125 |
SessionChooserDialog m_session_dialog; |
126 |
Gtk::FileChooserDialog m_session_save_dialog; |
127 |
|
128 |
bool m_lashd_running; |
129 |
sigc::signal<void> internal_signal_lashd_stopped; |
130 |
|
131 |
std::map<std::string, Gtk::MenuItem*> m_outputs; |
132 |
std::set<std::string> m_inputs; |
133 |
std::map<Gtk::MenuItem*, std::map<std::string, Gtk::CheckMenuItem*> > |
134 |
m_inputitems; |
135 |
std::map<std::string, std::string> m_porttype; |
136 |
std::vector<std::pair<std::string, std::string> > m_recent_sessions; |
137 |
|
138 |
}; |
139 |
|
140 |
|
141 |
#endif |