Skip silent sources on session-archive -- fixes #7699
[ardour.git] / gtk2_ardour / step_editor.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 #ifndef __gtk2_ardour_step_editor_h__
20 #define __gtk2_ardour_step_editor_h__
21
22 #include <string>
23
24 #include <gdk/gdk.h>
25 #include <sigc++/trackable.h>
26
27 #include "pbd/signals.h"
28
29 #include "temporal/beats.h"
30
31 namespace ARDOUR {
32 class MidiTrack;
33 class MidiRegion;
34 }
35
36 class MidiRegionView;
37 class MidiTimeAxisView;
38 class PublicEditor;
39 class StepEntry;
40
41 class StepEditor : public PBD::ScopedConnectionList, public sigc::trackable
42 {
43 public:
44         StepEditor (PublicEditor&, boost::shared_ptr<ARDOUR::MidiTrack>, MidiTimeAxisView&);
45         virtual ~StepEditor ();
46
47         void check_step_edit ();
48         void step_edit_rest (Temporal::Beats beats);
49         void step_edit_beat_sync ();
50         void step_edit_bar_sync ();
51         int  step_add_bank_change (uint8_t channel, uint8_t bank);
52         int  step_add_program_change (uint8_t channel, uint8_t program);
53         int  step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity,
54                             Temporal::Beats beat_duration);
55         void step_edit_sustain (Temporal::Beats beats);
56         bool step_edit_within_triplet () const;
57         void step_edit_toggle_triplet ();
58         bool step_edit_within_chord () const;
59         void step_edit_toggle_chord ();
60         void reset_step_edit_beat_pos ();
61         void resync_step_edit_to_edit_point ();
62         void move_step_edit_beat_pos (Temporal::Beats beats);
63         void set_step_edit_cursor_width (Temporal::Beats beats);
64
65         std::string name() const;
66
67         void start_step_editing ();
68         void stop_step_editing ();
69
70 private:
71         ARDOUR::samplepos_t                    step_edit_insert_position;
72         Temporal::Beats                       step_edit_beat_pos;
73         boost::shared_ptr<ARDOUR::MidiRegion> step_edit_region;
74         MidiRegionView*                       step_edit_region_view;
75         uint8_t                               _step_edit_triplet_countdown;
76         bool                                  _step_edit_within_chord;
77         Temporal::Beats                       _step_edit_chord_duration;
78         PBD::ScopedConnection                 step_edit_region_connection;
79         PublicEditor&                         _editor;
80         boost::shared_ptr<ARDOUR::MidiTrack>  _track;
81         StepEntry*                            step_editor;
82         MidiTimeAxisView&                     _mtv;
83         int8_t                                last_added_pitch;
84         Temporal::Beats                       last_added_end;
85
86         void region_removed (boost::weak_ptr<ARDOUR::Region>);
87         void playlist_changed ();
88         bool step_editor_hidden (GdkEventAny*);
89         void step_editor_hide ();
90         void resync_step_edit_position ();
91         void prepare_step_edit_region ();
92 };
93
94 #endif /* __gtk2_ardour_step_editor_h__ */