13
0

manually reimplement 3766b22e06 from master (sysex deletion)

Things have changed
This commit is contained in:
Paul Davis 2024-09-16 08:30:36 -06:00
parent 15258b9aa4
commit 739d58840f
3 changed files with 30 additions and 27 deletions

View File

@ -1380,7 +1380,7 @@ MidiView::display_sysexes()
std::shared_ptr<SysEx> sysex = find_canvas_sys_ex (sysex_ptr); std::shared_ptr<SysEx> sysex = find_canvas_sys_ex (sysex_ptr);
if (!sysex) { if (!sysex) {
sysex = std::shared_ptr<SysEx>(new SysEx (_note_group, text, height, x, 1.0, sysex_ptr)); sysex = std::shared_ptr<SysEx>(new SysEx (*this, _note_group, text, height, x, 1.0, sysex_ptr));
_sys_exes.insert (make_pair (sysex_ptr, sysex)); _sys_exes.insert (make_pair (sysex_ptr, sysex));
} else { } else {
sysex->set_height (height); sysex->set_height (height);
@ -4300,16 +4300,13 @@ MidiView::edit_patch_change (PatchChange* pc)
} }
void void
MidiView::delete_sysex (SysEx* /*sysex*/) MidiView::delete_sysex (SysEx* sysex)
{ {
// CAIROCANVAS MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex"));
// sysyex object doesn't have a pointer to a sysex event c->remove (sysex->sysex ());
// MidiModel::SysExDiffCommand* c = _model->new_sysex_diff_command (_("delete sysex")); _model->apply_diff_command_as_commit (_editing_context.history(), c);
// c->remove (sysex->sysex());
// _model->apply_command (*trackview.session(), c);
//_sys_exes.clear (); display_sysexes();
// display_sysexes();
} }
std::string std::string

View File

@ -23,13 +23,14 @@
#include "gtkmm2ext/keyboard.h" #include "gtkmm2ext/keyboard.h"
#include "editor.h" #include "editor.h"
#include "midi_region_view.h" #include "midi_view.h"
#include "sys_ex.h" #include "sys_ex.h"
#include "ui_config.h" #include "ui_config.h"
using namespace std; using namespace std;
SysEx::SysEx ( SysEx::SysEx (
MidiView& view,
ArdourCanvas::Container* parent, ArdourCanvas::Container* parent,
string& text, string& text,
double height, double height,
@ -37,7 +38,7 @@ SysEx::SysEx (
double y, double y,
ARDOUR::MidiModel::SysExPtr sysex) ARDOUR::MidiModel::SysExPtr sysex)
: _sysex (sysex) : _sysex (sysex)
, _region (region) , _view (view)
{ {
_flag = new ArdourCanvas::Flag ( _flag = new ArdourCanvas::Flag (
parent, parent,
@ -60,21 +61,24 @@ SysEx::~SysEx()
bool bool
SysEx::event_handler (GdkEvent* ev) SysEx::event_handler (GdkEvent* ev)
{ {
/* XXX: icky dcast */
Editor* e = dynamic_cast<Editor*> (&_region.get_time_axis_view ().editor ());
if (!e->internal_editing ()) {
return false;
}
switch (ev->type) { switch (ev->type) {
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
if (Gtkmm2ext::Keyboard::is_delete_event (&ev->button)) { if (Gtkmm2ext::Keyboard::is_delete_event (&ev->button)) {
_region.delete_sysex (this); _view.delete_sysex (this);
return true; return true;
} }
default: break;
break;
case GDK_SCROLL:
if (ev->scroll.direction == GDK_SCROLL_UP) {
return true;
} else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
return true;
}
break;
default:
break;
} }
return false; return false;

View File

@ -21,12 +21,14 @@
#define __SYSEX_H__ #define __SYSEX_H__
#include "canvas/flag.h" #include "canvas/flag.h"
#include "midi_region_view.h"
class MidiView;
class SysEx class SysEx
{ {
public: public:
SysEx ( SysEx (
MidiView& view,
ArdourCanvas::Container* parent, ArdourCanvas::Container* parent,
std::string& text, std::string& text,
double height, double height,
@ -50,7 +52,7 @@ private:
bool event_handler (GdkEvent* ev); bool event_handler (GdkEvent* ev);
ArdourCanvas::Flag* _flag; ArdourCanvas::Flag* _flag;
ARDOUR::MidiModel::SysExPtr _sysex; ARDOUR::MidiModel::SysExPtr _sysex;
MidiRegionView& _region; MidiView& _view;
}; };
#endif /* __SYSEX_H__ */ #endif /* __SYSEX_H__ */