Properly revert FormatSpec changes on "cancel"
[ardour.git] / gtk2_ardour / patch_change_dialog.h
index 02eb311d484f529304d2afd97e25b1fed259a2af..8e322a736fef32d23188372faf9fd074dbe46bc7 100644 (file)
 */
 
 #include <gtkmm/spinbutton.h>
+#include <gtkmm/comboboxtext.h>
+
 #include "evoral/PatchChange.hpp"
 #include "ardour_dialog.h"
 #include "audio_clock.h"
 
 namespace ARDOUR {
-       class BeatsFramesConverter;
+       class BeatsSamplesConverter;
        class Session;
+       class InstrumentInfo;
+}
+
+namespace MIDI {
+       namespace Name {
+               class PatchBank;
+       }
 }
 
 class PatchChangeDialog : public ArdourDialog
 {
 public:
        PatchChangeDialog (
-               const ARDOUR::BeatsFramesConverter *,
+               const ARDOUR::BeatsSamplesConverter *,
                ARDOUR::Session *,
-               Evoral::PatchChange<Evoral::MusicalTime> const &,
-               const Gtk::BuiltinStockID &
+               Evoral::PatchChange<Temporal::Beats> const &,
+               ARDOUR::InstrumentInfo&,
+               const Gtk::BuiltinStockID &,
+               bool allow_delete = false,
+               bool modal = true
                );
 
-       Evoral::PatchChange<Evoral::MusicalTime> patch () const;
+       Evoral::PatchChange<Temporal::Beats> patch () const;
+
+protected:
+       void on_response (int);
 
 private:
-       const ARDOUR::BeatsFramesConverter* _time_converter;
+       void fill_bank_combo ();
+       void set_active_bank_combo ();
+       void fill_patch_combo ();
+       void set_active_patch_combo ();
+       void bank_combo_changed ();
+       void patch_combo_changed ();
+       void channel_changed ();
+       void bank_changed ();
+       void program_changed ();
+
+       int get_14bit_bank () const;
+
+       const ARDOUR::BeatsSamplesConverter* _time_converter;
+       ARDOUR::InstrumentInfo& _info;
        AudioClock _time;
        Gtk::SpinButton _channel;
        Gtk::SpinButton _program;
-       Gtk::SpinButton _bank;
+       Gtk::SpinButton _bank_msb;
+       Gtk::SpinButton _bank_lsb;
+       Gtk::ComboBoxText _bank_combo;
+       Gtk::ComboBoxText _patch_combo;
+
+       boost::shared_ptr<MIDI::Name::PatchBank> _current_patch_bank;
+       bool _ignore_signals;
+       bool _keep_open;
+
+       void instrument_info_changed ();
+       PBD::ScopedConnection _info_changed_connection;
 };