2006-07-23 08:03:19 -04:00
|
|
|
/*
|
2009-10-14 12:10:01 -04:00
|
|
|
Copyright (C) 2001, 2006 Paul Davis
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_midi_streamview_h__
|
|
|
|
#define __ardour_midi_streamview_h__
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
#include <cmath>
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/location.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
#include "enums.h"
|
|
|
|
#include "streamview.h"
|
2007-08-04 00:18:34 -04:00
|
|
|
#include "time_axis_view_item.h"
|
|
|
|
#include "route_time_axis.h"
|
2008-01-13 12:45:17 -05:00
|
|
|
#include "canvas.h"
|
2006-07-23 08:03:19 -04:00
|
|
|
|
|
|
|
namespace Gdk {
|
|
|
|
class Color;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class Route;
|
|
|
|
class Crossfade;
|
|
|
|
class PeakData;
|
|
|
|
class MidiRegion;
|
|
|
|
class Source;
|
2007-08-15 21:25:58 -04:00
|
|
|
class MidiModel;
|
2006-07-23 08:03:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
class PublicEditor;
|
|
|
|
class Selectable;
|
|
|
|
class MidiTimeAxisView;
|
|
|
|
class MidiRegionView;
|
|
|
|
class RegionSelection;
|
|
|
|
class CrossfadeView;
|
|
|
|
class Selection;
|
|
|
|
|
|
|
|
class MidiStreamView : public StreamView
|
|
|
|
{
|
|
|
|
public:
|
2009-07-09 13:58:13 -04:00
|
|
|
MidiStreamView (MidiTimeAxisView&);
|
2006-07-23 08:03:19 -04:00
|
|
|
~MidiStreamView ();
|
|
|
|
|
|
|
|
void set_selected_regionviews (RegionSelection&);
|
2009-05-12 13:03:42 -04:00
|
|
|
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2007-07-14 21:56:11 -04:00
|
|
|
enum VisibleNoteRange {
|
|
|
|
FullRange,
|
|
|
|
ContentsRange
|
|
|
|
};
|
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
Gtk::Adjustment note_range_adjustment;
|
2008-02-10 13:16:25 -05:00
|
|
|
ArdourCanvas::Group* midi_underlay_group;
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2007-08-06 02:09:41 -04:00
|
|
|
void set_note_range(VisibleNoteRange r);
|
2007-07-14 21:56:11 -04:00
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
inline uint8_t lowest_note() const { return _lowest_note; }
|
|
|
|
inline uint8_t highest_note() const { return _highest_note; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
void update_note_range(uint8_t note_num);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2010-04-21 16:42:22 -04:00
|
|
|
void redisplay_track ();
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-08-04 00:18:34 -04:00
|
|
|
inline double contents_height() const
|
2010-11-14 10:01:53 -05:00
|
|
|
{ return (child_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-08-04 00:18:34 -04:00
|
|
|
inline double note_to_y(uint8_t note) const
|
|
|
|
{ return contents_height()
|
2008-09-22 22:40:29 -04:00
|
|
|
- (note + 1 - lowest_note()) * note_height() + 1; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2011-03-07 12:17:11 -05:00
|
|
|
uint8_t y_to_note(double y) const;
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-08-04 00:18:34 -04:00
|
|
|
inline double note_height() const
|
|
|
|
{ return contents_height() / (double)contents_note_range(); }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2007-08-04 00:18:34 -04:00
|
|
|
inline uint8_t contents_note_range() const
|
2008-09-22 22:40:29 -04:00
|
|
|
{ return highest_note() - lowest_note() + 1; }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
sigc::signal<void> NoteRangeChanged;
|
2007-07-05 03:02:24 -04:00
|
|
|
|
2009-06-08 15:28:51 -04:00
|
|
|
RegionView* create_region_view (boost::shared_ptr<ARDOUR::Region>, bool, bool);
|
|
|
|
|
2010-10-08 10:54:16 -04:00
|
|
|
void apply_note_range(uint8_t lowest, uint8_t highest, bool to_region_views);
|
|
|
|
|
2011-04-16 09:31:27 -04:00
|
|
|
void suspend_updates ();
|
|
|
|
void resume_updates ();
|
|
|
|
|
2006-07-23 08:03:19 -04:00
|
|
|
private:
|
|
|
|
void setup_rec_box ();
|
2010-10-08 10:54:16 -04:00
|
|
|
void update_rec_box ();
|
2008-09-22 22:40:29 -04:00
|
|
|
|
|
|
|
RegionView* add_region_view_internal (
|
2010-10-04 20:27:26 -04:00
|
|
|
boost::shared_ptr<ARDOUR::Region>,
|
|
|
|
bool wait_for_waves,
|
|
|
|
bool recording = false);
|
2008-09-22 22:40:29 -04:00
|
|
|
|
|
|
|
void display_region(MidiRegionView* region_view, bool load_model);
|
2010-04-21 16:42:22 -04:00
|
|
|
void display_track (boost::shared_ptr<ARDOUR::Track> tr);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-19 15:32:10 -04:00
|
|
|
void update_contents_height ();
|
2010-06-24 15:46:28 -04:00
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
void draw_note_lines();
|
2008-09-22 22:40:29 -04:00
|
|
|
bool update_data_note_range(uint8_t min, uint8_t max);
|
2009-02-15 14:44:27 -05:00
|
|
|
void update_contents_metrics(boost::shared_ptr<ARDOUR::Region> r);
|
2006-07-23 08:03:19 -04:00
|
|
|
|
2007-06-15 18:08:27 -04:00
|
|
|
void color_handler ();
|
2007-07-05 03:02:24 -04:00
|
|
|
|
2008-01-13 12:45:17 -05:00
|
|
|
void note_range_adjustment_changed();
|
2011-04-16 09:31:27 -04:00
|
|
|
void apply_note_range_to_regions ();
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2008-09-22 22:40:29 -04:00
|
|
|
bool _range_dirty;
|
2008-01-13 12:45:17 -05:00
|
|
|
double _range_sum_cache;
|
2008-09-22 22:40:29 -04:00
|
|
|
uint8_t _lowest_note; ///< currently visible
|
|
|
|
uint8_t _highest_note; ///< currently visible
|
|
|
|
uint8_t _data_note_min; ///< in data
|
|
|
|
uint8_t _data_note_max; ///< in data
|
2008-09-24 15:39:01 -04:00
|
|
|
ArdourCanvas::LineSet* _note_lines;
|
2011-04-16 09:31:27 -04:00
|
|
|
/** true if updates to the note lines and regions are currently suspended */
|
|
|
|
bool _updates_suspended;
|
2006-07-23 08:03:19 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_midi_streamview_h__ */
|