Use a C++ bool constant
[ardour.git] / gtk2_ardour / midi_list_editor.h
index 20ffd39fee5905c0b36572d782e1660ecb609e8c..283a0da8bc26b12af97dfbaf0861c5b814e04739 100644 (file)
 #define __ardour_gtk2_midi_list_editor_h_
 
 #include <gtkmm/treeview.h>
+#include <gtkmm/table.h>
+#include <gtkmm/box.h>
 #include <gtkmm/liststore.h>
 #include <gtkmm/scrolledwindow.h>
 
-#include "evoral/types.hpp"
-
 #include "ardour/session_handle.h"
 
 #include "ardour_window.h"
 
 namespace Evoral {
        template<typename Time> class Note;
+       class                         Beats;
 };
 
 namespace ARDOUR {
        class MidiRegion;
        class MidiModel;
+       class MidiTrack;
        class Session;
 };
 
 class MidiListEditor : public ArdourWindow
 {
   public:
-       typedef Evoral::Note<Evoral::MusicalTime> NoteType;
+       typedef Evoral::Note<Evoral::Beats> NoteType;
 
-       MidiListEditor(ARDOUR::Session*, boost::shared_ptr<ARDOUR::MidiRegion>);
+       MidiListEditor(ARDOUR::Session*, boost::shared_ptr<ARDOUR::MidiRegion>,
+                      boost::shared_ptr<ARDOUR::MidiTrack>);
        ~MidiListEditor();
 
   private:
@@ -56,26 +59,42 @@ class MidiListEditor : public ArdourWindow
                        add (velocity);
                        add (start);
                        add (length);
-                       add (end);
                        add (_note);
                };
-               Gtk::TreeModelColumn<uint8_t> channel;
-               Gtk::TreeModelColumn<uint8_t> note;
+               Gtk::TreeModelColumn<uint8_t>     channel;
+               Gtk::TreeModelColumn<uint8_t>     note;
                Gtk::TreeModelColumn<std::string> note_name;
-               Gtk::TreeModelColumn<uint8_t> velocity;
+               Gtk::TreeModelColumn<uint8_t>     velocity;
                Gtk::TreeModelColumn<std::string> start;
                Gtk::TreeModelColumn<std::string> length;
-               Gtk::TreeModelColumn<std::string> end;
                Gtk::TreeModelColumn<boost::shared_ptr<NoteType> > _note;
        };
 
+       struct NoteLengthColumns : public Gtk::TreeModel::ColumnRecord {
+               NoteLengthColumns() {
+                       add (ticks);
+                       add (name);
+               }
+               Gtk::TreeModelColumn<int>         ticks;
+               Gtk::TreeModelColumn<std::string> name;
+       };
+
        MidiListModelColumns         columns;
        Glib::RefPtr<Gtk::ListStore> model;
+       NoteLengthColumns            note_length_columns;
+       Glib::RefPtr<Gtk::ListStore> note_length_model;
        Gtk::TreeView                view;
        Gtk::ScrolledWindow          scroller;
-       std::string               _current_edit;
+       Gtk::TreeModel::Path         edit_path;
+       int                          edit_column;
+       Gtk::CellRendererText*       editing_renderer;
+       Gtk::CellEditable*           editing_editable;
+       Gtk::Table                   buttons;
+       Gtk::VBox                    vbox;
+       Gtk::ToggleButton            sound_notes_button;
 
        boost::shared_ptr<ARDOUR::MidiRegion> region;
+       boost::shared_ptr<ARDOUR::MidiTrack>  track;
 
        /** connection used to connect to model's ContentChanged signal */
        PBD::ScopedConnection content_connection;
@@ -83,13 +102,16 @@ class MidiListEditor : public ArdourWindow
        void edited (const std::string&, const std::string&);
        void editing_started (Gtk::CellEditable*, const std::string& path, int);
        void editing_canceled ();
+       void stop_editing (bool cancelled = false);
 
        void redisplay_model ();
 
        bool key_press (GdkEventKey* ev);
        bool key_release (GdkEventKey* ev);
+       bool scroll_event (GdkEventScroll*);
 
        void delete_selected_note ();
+       void selection_changed ();
 };
 
 #endif /* __ardour_gtk2_midi_list_editor_h_ */