2009-02-16 21:19:16 -05:00
|
|
|
/*
|
|
|
|
Copyright (C) 2009 Paul Davis
|
|
|
|
Author: Hans Baier
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
2009-02-13 03:29:12 -05:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "ardour_ui.h"
|
|
|
|
|
2012-10-10 23:22:17 -04:00
|
|
|
#include "midi_region_view.h"
|
2009-02-13 03:29:12 -05:00
|
|
|
#include "canvas-sysex.h"
|
|
|
|
|
|
|
|
using namespace Gnome::Canvas;
|
|
|
|
using namespace std;
|
|
|
|
|
2009-02-16 21:19:16 -05:00
|
|
|
CanvasSysEx::CanvasSysEx(
|
|
|
|
MidiRegionView& region,
|
|
|
|
Group& parent,
|
|
|
|
string& text,
|
|
|
|
double height,
|
|
|
|
double x,
|
2012-10-10 23:22:17 -04:00
|
|
|
double y,
|
|
|
|
const ARDOUR::MidiModel::SysExPtr sysex)
|
2009-02-13 03:29:12 -05:00
|
|
|
: CanvasFlag(
|
2009-10-14 12:10:01 -04:00
|
|
|
region,
|
|
|
|
parent,
|
|
|
|
height,
|
|
|
|
ARDOUR_UI::config()->canvasvar_MidiSysExOutline.get(),
|
2009-02-13 03:29:12 -05:00
|
|
|
ARDOUR_UI::config()->canvasvar_MidiSysExFill.get(),
|
|
|
|
x,
|
2012-10-10 23:22:17 -04:00
|
|
|
y),
|
|
|
|
_sysex(sysex)
|
2009-02-13 03:29:12 -05:00
|
|
|
{
|
2012-10-11 00:05:22 -04:00
|
|
|
_text = text;
|
2009-02-13 03:29:12 -05:00
|
|
|
set_text(text);
|
|
|
|
}
|
|
|
|
|
2009-02-16 21:19:16 -05:00
|
|
|
CanvasSysEx::~CanvasSysEx()
|
2009-02-13 03:29:12 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2009-02-16 21:19:16 -05:00
|
|
|
CanvasSysEx::on_event(GdkEvent* ev)
|
2009-02-13 03:29:12 -05:00
|
|
|
{
|
|
|
|
switch (ev->type) {
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
if (ev->button.button == 3) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
break;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-13 03:29:12 -05:00
|
|
|
case GDK_SCROLL:
|
|
|
|
if (ev->scroll.direction == GDK_SCROLL_UP) {
|
|
|
|
return true;
|
|
|
|
} else if (ev->scroll.direction == GDK_SCROLL_DOWN) {
|
|
|
|
return true;
|
2009-10-14 12:10:01 -04:00
|
|
|
}
|
2009-02-13 03:29:12 -05:00
|
|
|
break;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2012-10-10 23:22:17 -04:00
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
switch (ev->key.keyval) {
|
|
|
|
|
|
|
|
case GDK_Delete:
|
|
|
|
case GDK_BackSpace:
|
|
|
|
_region.delete_sysex (this);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
2012-10-11 00:05:22 -04:00
|
|
|
_region.sysex_entered (this);
|
2012-10-10 23:22:17 -04:00
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
2012-10-11 00:05:22 -04:00
|
|
|
_region.sysex_left (this);
|
|
|
|
return true;
|
2012-10-10 23:22:17 -04:00
|
|
|
break;
|
|
|
|
|
2009-02-13 03:29:12 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2009-02-13 03:29:12 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|