2013-04-05 17:16:33 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2013-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2014-2015 David Robillard <d@drobilla.net>
|
|
|
|
*
|
|
|
|
* 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-05 17:16:33 -04:00
|
|
|
|
2024-09-25 20:38:59 -04:00
|
|
|
#pragma once
|
2013-04-05 17:16:33 -04:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include "note_base.h"
|
|
|
|
|
|
|
|
namespace ArdourCanvas {
|
|
|
|
class Polygon;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Hit : public NoteBase
|
|
|
|
{
|
|
|
|
public:
|
2017-09-24 12:03:54 -04:00
|
|
|
typedef Evoral::Note<Temporal::Beats> NoteType;
|
2013-04-05 17:16:33 -04:00
|
|
|
|
2024-01-04 21:07:52 -05:00
|
|
|
Hit (MidiView& region,
|
2014-06-21 11:44:22 -04:00
|
|
|
ArdourCanvas::Item* parent,
|
2014-03-06 23:17:04 -05:00
|
|
|
double size,
|
2023-02-16 18:33:28 -05:00
|
|
|
const std::shared_ptr<NoteType> note = std::shared_ptr<NoteType>(),
|
2014-12-28 21:31:33 -05:00
|
|
|
bool with_events = true);
|
2014-03-06 23:17:04 -05:00
|
|
|
|
2014-12-28 21:31:33 -05:00
|
|
|
~Hit();
|
|
|
|
|
|
|
|
void show ();
|
2013-04-05 17:16:33 -04:00
|
|
|
void hide ();
|
|
|
|
|
|
|
|
ArdourCanvas::Coord x0 () const;
|
|
|
|
ArdourCanvas::Coord y0 () const;
|
|
|
|
ArdourCanvas::Coord x1 () const;
|
|
|
|
ArdourCanvas::Coord y1 () const;
|
|
|
|
|
2014-12-28 21:31:33 -05:00
|
|
|
ArdourCanvas::Duple position ();
|
|
|
|
|
2013-04-05 17:16:33 -04:00
|
|
|
void set_position (ArdourCanvas::Duple);
|
|
|
|
|
|
|
|
void set_height (ArdourCanvas::Coord);
|
|
|
|
|
|
|
|
void set_outline_color (uint32_t);
|
|
|
|
void set_fill_color (uint32_t);
|
|
|
|
|
2014-12-28 20:23:52 -05:00
|
|
|
void set_ignore_events (bool);
|
|
|
|
|
2013-04-05 17:16:33 -04:00
|
|
|
void move_event (double, double);
|
|
|
|
|
2014-12-28 21:31:33 -05:00
|
|
|
/* no trimming of percussive hits */
|
|
|
|
bool big_enough_to_trim() const { return false; }
|
|
|
|
|
|
|
|
static ArdourCanvas::Points points(ArdourCanvas::Distance height);
|
2014-03-07 11:24:06 -05:00
|
|
|
|
2023-06-20 16:42:43 -04:00
|
|
|
double visual_velocity() const;
|
|
|
|
|
2013-04-05 17:16:33 -04:00
|
|
|
private:
|
|
|
|
ArdourCanvas::Polygon* _polygon;
|
|
|
|
};
|
|
|
|
|