ardour/gtk2_ardour/mergeable_line.h
Paul Davis 18819a48a9 region gain and MIDI CC freehand line drawing
This involved a significant change in event handling for automation region views,
but it brings it into line with how it works for other things. On button press
we initiate a drag, then if no motion occurs, the Drag returns false during
finalization, and only then do we continue through Editor::button_release_handler()
to eventually end up in ::add_automation_event().

Although it is a substantial change, the fact that it now works the same
way for audio regions, automation regions and automation tracks seems
like a definite plus.
2023-09-30 11:09:58 -06:00

64 lines
2.0 KiB
C++

/*
* Copyright (C) 2023 Paul Davis <paul@linuxaudiosystems.com>
*
* 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.
*/
#ifndef __gtk2_ardour_mergeable_line__
#define __gtk2_ardour_mergeable_line__
#include <functional>
#include <memory>
#include "evoral/ControlList.h"
#include "ardour/types.h"
class AutomationLine;
class RouteTimeAxisView;
class Editor;
namespace ARDOUR {
class Session;
class AutomationControl;
}
class MergeableLine
{
public:
MergeableLine (std::shared_ptr<AutomationLine> l, std::shared_ptr<ARDOUR::AutomationControl> c,
std::function<Temporal::timepos_t(Temporal::timepos_t const &)> tf,
std::function<void(ARDOUR::AutoState)> asc,
std::function<void()> ctc)
: _line (l)
, _control (c)
, time_filter (tf)
, automation_state_callback (asc)
, control_touched_callback (ctc) {}
virtual ~MergeableLine() {}
void merge_drawn_line (Editor& e, ARDOUR::Session& s, Evoral::ControlList::OrderedPoints& points, bool thin);
private:
std::shared_ptr<AutomationLine> _line;
std::shared_ptr<ARDOUR::AutomationControl> _control;
std::function<Temporal::timepos_t(Temporal::timepos_t const &)> time_filter;
std::function<void(ARDOUR::AutoState)> automation_state_callback;
std::function<void()> control_touched_callback;
};
#endif /* __gtk2_ardour_mergeable_line__ */