Setup fixed ports for MIDI control data; hence remove configuration of those ports...
[ardour.git] / gtk2_ardour / midi_tracer.h
1 #ifndef __ardour_gtk_midi_tracer_h__
2 #define __ardour_gtk_midi_tracer_h__
3
4 #include <gtkmm/textview.h>
5 #include <gtkmm/scrolledwindow.h>
6 #include <gtkmm/togglebutton.h>
7 #include <gtkmm/adjustment.h>
8 #include <gtkmm/spinbutton.h>
9 #include <gtkmm/label.h>
10 #include <gtkmm/comboboxtext.h>
11
12 #include "pbd/signals.h"
13 #include "pbd/ringbuffer.h"
14 #include "pbd/pool.h"
15 #include "midi++/types.h"
16 #include "ardour_dialog.h"
17
18 namespace MIDI {
19         class Parser;
20 }
21
22 class MidiTracer : public ArdourDialog
23 {
24   public:
25         MidiTracer ();
26         ~MidiTracer();
27
28   private:
29         MIDI::Parser* parser;
30         Gtk::TextView text;
31         Gtk::ScrolledWindow scroller;
32         Gtk::Adjustment line_count_adjustment;
33         Gtk::SpinButton line_count_spinner;
34         Gtk::Label line_count_label;
35         Gtk::HBox line_count_box;
36
37         bool autoscroll;
38         bool show_hex;
39         bool collect;
40         
41         /** Incremented when an update is requested, decremented when one is handled; hence
42          *  equal to 0 when an update is not queued.  May temporarily be negative if a
43          *  update is handled before it was noted that it had just been queued.
44          */
45         volatile gint _update_queued;
46          
47         RingBuffer<char *> fifo;
48         Pool buffer_pool;
49         static const size_t buffer_size = 256;
50
51         void tracer (MIDI::Parser&, MIDI::byte*, size_t);
52         void update ();
53         
54         Gtk::CheckButton autoscroll_button;
55         Gtk::CheckButton base_button;
56         Gtk::CheckButton collect_button;
57         Gtk::ComboBoxText _port_combo;
58
59         void base_toggle ();
60         void autoscroll_toggle ();
61         void collect_toggle ();
62
63         void port_changed ();
64         void ports_changed ();
65         void disconnect ();
66         PBD::ScopedConnection _parser_connection;
67         PBD::ScopedConnection _manager_connection;
68 };
69
70 #endif /* __ardour_gtk_midi_tracer_h__ */