47f173824345ed9cb791b7cfed5ffa018e2fd77b
[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
11 #include "pbd/signals.h"
12 #include "pbd/ringbuffer.h"
13 #include "pbd/pool.h"
14 #include "midi++/types.h"
15 #include "ardour_dialog.h"
16
17 namespace MIDI {
18         class Parser;
19 }
20
21 class MidiTracer : public ArdourDialog
22 {
23   public:
24         MidiTracer (const std::string&, MIDI::Parser&);
25         ~MidiTracer();
26
27   private:
28         MIDI::Parser& parser;
29         Gtk::TextView text;
30         Gtk::ScrolledWindow scroller;
31         Gtk::Adjustment line_count_adjustment;
32         Gtk::SpinButton line_count_spinner;
33         Gtk::Label line_count_label;
34         Gtk::HBox line_count_box;
35
36         bool autoscroll;
37         bool show_hex;
38         bool collect;
39         volatile bool update_queued;
40         RingBuffer<char *> fifo;
41         Pool buffer_pool;
42         static const size_t buffer_size = 256;
43
44         void tracer (MIDI::Parser&, MIDI::byte*, size_t);
45         void update ();
46         
47         Gtk::CheckButton autoscroll_button;
48         Gtk::CheckButton base_button;
49         Gtk::CheckButton collect_button;
50
51         void base_toggle ();
52         void autoscroll_toggle ();
53         void collect_toggle ();
54
55         void connect ();
56         void disconnect ();
57         PBD::ScopedConnection connection;
58 };
59
60 #endif /* __ardour_gtk_midi_tracer_h__ */