From accc73a8c15ce9b86db269a52a132a88e9f17da2 Mon Sep 17 00:00:00 2001 From: Hans Baier Date: Thu, 17 Apr 2008 21:27:33 +0000 Subject: [PATCH] * fixed missing get coordinate functions in CanvasHit * Fixed crash bug when NoteMode = Percussive on MidiRegionView * Fixed possible MemoryLeaks and added Signal in MidiMultipleChannelSelector git-svn-id: svn://localhost/ardour2/branches/3.0@3263 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/canvas-hit.h | 9 ++++----- gtk2_ardour/midi_channel_selector.cc | 11 +++++++---- gtk2_ardour/midi_channel_selector.h | 2 ++ gtk2_ardour/midi_region_view.cc | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/canvas-hit.h b/gtk2_ardour/canvas-hit.h index 9a65f8067a..e9be381ef2 100644 --- a/gtk2_ardour/canvas-hit.h +++ b/gtk2_ardour/canvas-hit.h @@ -39,11 +39,10 @@ public: { } - // FIXME - double x1() { return 0.0; } - double y1() { return 0.0; } - double x2() { return 0.0; } - double y2() { return 0.0; } + double x1() { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return x1; } + double y1() { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y1; } + double x2() { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return x2; } + double y2() { double x1, y1, x2, y2; get_bounds(x1,y1,x2,y2); return y2; } void set_outline_color(uint32_t c) { property_outline_color_rgba() = c; } void set_fill_color(uint32_t c) { property_fill_color_rgba() = c; } diff --git a/gtk2_ardour/midi_channel_selector.cc b/gtk2_ardour/midi_channel_selector.cc index 6fba415389..6bed5d1f95 100644 --- a/gtk2_ardour/midi_channel_selector.cc +++ b/gtk2_ardour/midi_channel_selector.cc @@ -67,20 +67,20 @@ SingleMidiChannelSelector::button_toggled(Gtk::ToggleButton *button, uint8_t cha MidiMultipleChannelSelector::MidiMultipleChannelSelector(uint16_t initial_selection) : MidiChannelSelector(6, 4, 0, 0) { - _select_all.add(*new Gtk::Label(_("All"))); + _select_all.add(*Gtk::manage(new Gtk::Label(_("All")))); _select_all.signal_clicked().connect( sigc::bind(sigc::mem_fun(this, &MidiMultipleChannelSelector::select_all), true)); - _select_none.add(*new Gtk::Label(_("None"))); + _select_none.add(*Gtk::manage(new Gtk::Label(_("None")))); _select_none.signal_clicked().connect( sigc::bind(sigc::mem_fun(this, &MidiMultipleChannelSelector::select_all), false)); - _invert_selection.add(*new Gtk::Label(_("Invert"))); + _invert_selection.add(*Gtk::manage(new Gtk::Label(_("Invert")))); _invert_selection.signal_clicked().connect( sigc::mem_fun(this, &MidiMultipleChannelSelector::invert_selection)); set_homogeneous(false); - attach(*new Gtk::HSeparator(), 0, 4, 4, 5, Gtk::FILL, Gtk::SHRINK, 0, 0); + attach(*Gtk::manage(new Gtk::HSeparator()), 0, 4, 4, 5, Gtk::FILL, Gtk::SHRINK, 0, 0); set_col_spacing(4, -5); attach(_select_all, 0, 2, 5, 6); attach(_select_none, 2, 4, 5, 6); @@ -101,6 +101,7 @@ void MidiMultipleChannelSelector::button_toggled(Gtk::ToggleButton *button, uint8_t channel) { _selected_channels = _selected_channels ^ (1L << channel); + selection_changed.emit(_selected_channels); } void @@ -110,6 +111,7 @@ MidiMultipleChannelSelector::select_all(bool on) Gtk::ToggleButton *button = &_buttons[i / 4][i % 4]; button->set_active(on); } + selection_changed.emit(_selected_channels); } void @@ -123,5 +125,6 @@ MidiMultipleChannelSelector::invert_selection(void) button->set_active(true); } } + selection_changed.emit(_selected_channels); } diff --git a/gtk2_ardour/midi_channel_selector.h b/gtk2_ardour/midi_channel_selector.h index 5b3e20e859..57683c64b2 100644 --- a/gtk2_ardour/midi_channel_selector.h +++ b/gtk2_ardour/midi_channel_selector.h @@ -43,6 +43,8 @@ public: MidiMultipleChannelSelector(uint16_t initial_selection = 1); const uint16_t get_selected_channels() const { return _selected_channels; } + + sigc::signal selection_changed; protected: virtual void button_toggled(Gtk::ToggleButton *button, uint8_t button_nr); diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index cdee66ea9b..446f275618 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -753,7 +753,7 @@ MidiRegionView::add_note(const boost::shared_ptr note) const double diamond_size = midi_stream_view()->note_height() / 2.0; const double y = midi_stream_view()->note_to_y(note->note()) + ((diamond_size-2) / 4.0); - CanvasHit* ev_diamond = new CanvasHit(*this, *group, diamond_size); + CanvasHit* ev_diamond = new CanvasHit(*this, *group, diamond_size, note); ev_diamond->move(x, y); ev_diamond->show(); ev_diamond->property_fill_color_rgba() = note_fill_color(note->velocity());