2013-04-04 00:32:52 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2013-2018 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2013 John Emmas <john@creativepost.co.uk>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2013-04-04 00:32:52 -04:00
|
|
|
|
2019-10-25 15:13:51 -04:00
|
|
|
#include "evoral/Note.h"
|
2014-03-06 13:26:55 -05:00
|
|
|
|
2018-07-03 11:21:53 -04:00
|
|
|
#include "canvas/note.h"
|
2014-03-06 13:26:55 -05:00
|
|
|
#include "canvas/debug.h"
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
#include "note.h"
|
|
|
|
#include "public_editor.h"
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
2018-07-03 11:21:53 -04:00
|
|
|
using ArdourCanvas::Coord;
|
|
|
|
using ArdourCanvas::Duple;
|
2013-04-04 00:32:52 -04:00
|
|
|
|
|
|
|
Note::Note (
|
2023-02-16 18:33:28 -05:00
|
|
|
MidiRegionView& region, ArdourCanvas::Item* parent, const std::shared_ptr<NoteType> note, bool with_events)
|
2013-04-04 00:32:52 -04:00
|
|
|
: NoteBase (region, with_events, note)
|
2018-07-03 11:21:53 -04:00
|
|
|
, _note (new ArdourCanvas::Note (parent))
|
2013-04-04 00:32:52 -04:00
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
CANVAS_DEBUG_NAME (_note, "note");
|
|
|
|
set_item (_note);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Note::~Note ()
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
delete _note;
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::move_event (double dx, double dy)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set (_note->get().translate (Duple (dx, dy)));
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Coord
|
|
|
|
Note::x0 () const
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
return _note->x0 ();
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Coord
|
|
|
|
Note::x1 () const
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
return _note->x1 ();
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Coord
|
|
|
|
Note::y0 () const
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
return _note->y0 ();
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
Coord
|
|
|
|
Note::y1 () const
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
return _note->y1 ();
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::set_outline_color (uint32_t color)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_outline_color (color);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::set_fill_color (uint32_t color)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_fill_color (color);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::show ()
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->show ();
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::hide ()
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->hide ();
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
2016-06-24 10:04:04 -04:00
|
|
|
void
|
2016-07-11 07:42:42 -04:00
|
|
|
Note::set (ArdourCanvas::Rect rect)
|
2016-06-24 10:04:04 -04:00
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set (rect);
|
2016-06-24 10:04:04 -04:00
|
|
|
}
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
void
|
|
|
|
Note::set_x0 (Coord x0)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_x0 (x0);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::set_y0 (Coord y0)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_y0 (y0);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::set_x1 (Coord x1)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_x1 (x1);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Note::set_y1 (Coord y1)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_y1 (y1);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-03-11 07:38:02 -04:00
|
|
|
Note::set_outline_what (ArdourCanvas::Rectangle::What what)
|
2013-04-04 00:32:52 -04:00
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_outline_what (what);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
|
|
|
|
2014-03-11 07:38:02 -04:00
|
|
|
void
|
|
|
|
Note::set_outline_all ()
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_outline_all ();
|
2014-03-11 07:38:02 -04:00
|
|
|
}
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
void
|
|
|
|
Note::set_ignore_events (bool ignore)
|
|
|
|
{
|
2018-07-03 11:21:53 -04:00
|
|
|
_note->set_ignore_events (ignore);
|
2013-04-04 00:32:52 -04:00
|
|
|
}
|
2018-07-03 11:28:01 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
Note::set_velocity (double fract)
|
|
|
|
{
|
|
|
|
_note->set_velocity (fract);
|
|
|
|
}
|
|
|
|
|