Do not try to restore Route solo state after clearing all solo state
[ardour.git] / gtk2_ardour / midi_tracer.h
1 /*
2     Copyright (C) 2012 Paul Davis
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #ifndef __ardour_gtk_midi_tracer_h__
21 #define __ardour_gtk_midi_tracer_h__
22
23 #include <gtkmm/textview.h>
24 #include <gtkmm/scrolledwindow.h>
25 #include <gtkmm/togglebutton.h>
26 #include <gtkmm/adjustment.h>
27 #include <gtkmm/spinbutton.h>
28 #include <gtkmm/label.h>
29 #include <gtkmm/comboboxtext.h>
30 #include <gtkmm/box.h>
31
32 #include "pbd/signals.h"
33 #include "pbd/ringbuffer.h"
34 #include "pbd/pool.h"
35 #include "midi++/types.h"
36 #include "ardour_window.h"
37
38 namespace MIDI {
39         class Parser;
40 }
41
42 namespace ARDOUR {
43         class MidiPort;
44 }
45
46 class MidiTracer : public ArdourWindow
47 {
48   public:
49         MidiTracer ();
50         ~MidiTracer();
51
52   private:
53         Gtk::TextView text;
54         Gtk::ScrolledWindow scroller;
55         Gtk::Adjustment line_count_adjustment;
56         Gtk::SpinButton line_count_spinner;
57         Gtk::Label line_count_label;
58         Gtk::HBox line_count_box;
59         struct timeval _last_receipt;
60
61         bool autoscroll;
62         bool show_hex;
63         bool show_delta_time;
64
65         /** Incremented when an update is requested, decremented when one is handled; hence
66          *  equal to 0 when an update is not queued.  May temporarily be negative if a
67          *  update is handled before it was noted that it had just been queued.
68          */
69         volatile gint _update_queued;
70
71         RingBuffer<char *> fifo;
72         Pool buffer_pool;
73         static const size_t buffer_size = 256;
74
75         void tracer (MIDI::Parser&, MIDI::byte*, size_t);
76         void update ();
77
78         Gtk::CheckButton autoscroll_button;
79         Gtk::CheckButton base_button;
80         Gtk::CheckButton collect_button;
81         Gtk::CheckButton delta_time_button;
82         Gtk::ComboBoxText _port_combo;
83
84         void base_toggle ();
85         void autoscroll_toggle ();
86         void collect_toggle ();
87         void delta_toggle ();
88
89         void port_changed ();
90         void ports_changed ();
91         void disconnect ();
92         PBD::ScopedConnection _parser_connection;
93         PBD::ScopedConnection _manager_connection;
94
95         boost::shared_ptr<ARDOUR::MidiPort> traced_port;
96 };
97
98 #endif /* __ardour_gtk_midi_tracer_h__ */