13
0

experiment with making MIDI region boxes vanish when in note/internal edit mode ... to be continued

git-svn-id: svn://localhost/ardour2/branches/3.0@9054 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-03-03 14:51:02 +00:00
parent 9498b3bfe4
commit 2c72f58aa1
11 changed files with 122 additions and 13 deletions

View File

@ -2635,12 +2635,20 @@ Editor::set_internal_edit (bool yn)
ARDOUR_UI::instance()->set_tip (mouse_select_button, _("Draw/Edit MIDI Notes"));
mouse_mode_toggled (mouse_mode);
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->enter_internal_edit_mode ();
}
} else {
mouse_select_button.set_image (*(manage (new Image (::get_icon("tool_range")))));
mouse_select_button.get_image ()->show ();
ARDOUR_UI::instance()->set_tip (mouse_select_button, _("Select/Move Ranges"));
mouse_mode_toggled (mouse_mode); // sets cursor
for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
(*i)->leave_internal_edit_mode ();
}
}
}

View File

@ -2856,17 +2856,33 @@ MidiRegionView::note_mouse_position (float x_fraction, float /*y_fraction*/, boo
void
MidiRegionView::set_frame_color()
{
uint32_t f;
if (!frame) {
return;
}
if (_selected) {
frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
f = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
} else if (high_enough_for_name) {
frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_MidiFrameBase.get();
f= ARDOUR_UI::config()->canvasvar_MidiFrameBase.get();
} else {
frame->property_fill_color_rgba() = fill_color;
f = fill_color;
}
if (!rect_visible) {
f = UINT_RGBA_CHANGE_A (f, 0);
}
frame->property_fill_color_rgba() = f;
f = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
if (!rect_visible) {
f = UINT_RGBA_CHANGE_A (f, 0);
}
frame->property_outline_color_rgba() = f;
}
void

View File

@ -206,6 +206,22 @@ MidiStreamView::display_region(MidiRegionView* region_view, bool load_model)
region_view->display_model(source->model());
}
void
MidiStreamView::enter_internal_edit_mode ()
{
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
(*i)->hide_rect ();
}
}
void
MidiStreamView::leave_internal_edit_mode ()
{
for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
(*i)->show_rect ();
}
}
void
MidiStreamView::display_track (boost::shared_ptr<Track> tr)
{

View File

@ -56,6 +56,9 @@ class MidiStreamView : public StreamView
MidiStreamView (MidiTimeAxisView&);
~MidiStreamView ();
void enter_internal_edit_mode ();
void leave_internal_edit_mode ();
void set_selected_regionviews (RegionSelection&);
void get_inverted_selectables (Selection&, std::list<Selectable* >& results);

View File

@ -244,6 +244,22 @@ MidiTimeAxisView::~MidiTimeAxisView ()
delete _step_editor;
}
void
MidiTimeAxisView::enter_internal_edit_mode ()
{
if (midi_view()) {
midi_view()->enter_internal_edit_mode ();
}
}
void
MidiTimeAxisView::leave_internal_edit_mode ()
{
if (midi_view()) {
midi_view()->leave_internal_edit_mode ();
}
}
void
MidiTimeAxisView::check_step_edit ()
{

View File

@ -69,6 +69,9 @@ class MidiTimeAxisView : public RouteTimeAxisView
void set_height (uint32_t);
void hide ();
void enter_internal_edit_mode ();
void leave_internal_edit_mode ();
boost::shared_ptr<ARDOUR::MidiRegion> add_region (ARDOUR::framepos_t, ARDOUR::framecnt_t, bool);
void show_all_automation ();

View File

@ -941,3 +941,4 @@ RegionView::trim_contents (framepos_t frame_delta, bool left_direction, bool swa
_region->trim_start ((framepos_t) (new_bound * speed), this);
region_changed (PropertyChange (ARDOUR::Properties::start));
}

View File

@ -74,6 +74,9 @@ public:
gdouble get_samples_per_unit () { return _samples_per_unit; }
virtual void horizontal_position_changed () {}
virtual void enter_internal_edit_mode () {}
virtual void leave_internal_edit_mode () {}
void set_layer_display (LayerDisplay);
LayerDisplay layer_display () const { return _layer_display; }

View File

@ -98,6 +98,9 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
/** @return maximum allowable value of order */
static int max_order () { return _max_order; }
virtual void enter_internal_edit_mode () {}
virtual void leave_internal_edit_mode () {}
ArdourCanvas::Group* canvas_display () { return _canvas_display; }
ArdourCanvas::Group* canvas_background () { return _canvas_background; }
ArdourCanvas::Group* ghost_group () { return _ghost_group; }

View File

@ -156,6 +156,7 @@ TimeAxisViewItem::init (
last_item_width = 0;
wide_enough_for_name = wide;
high_enough_for_name = high;
rect_visible = true;
if (duration == 0) {
warning << "Time Axis Item Duration == 0" << endl;
@ -234,6 +235,28 @@ TimeAxisViewItem::~TimeAxisViewItem()
delete group;
}
void
TimeAxisViewItem::hide_rect ()
{
rect_visible = false;
set_frame_color ();
if (name_highlight) {
name_highlight->property_outline_what() = 0x0;
}
}
void
TimeAxisViewItem::show_rect ()
{
rect_visible = true;
set_frame_color ();
if (name_highlight) {
name_highlight->property_outline_what() = 0x4;
}
}
/**
* Set the position of this item on the timeline.
@ -682,21 +705,30 @@ TimeAxisViewItem::set_colors()
void
TimeAxisViewItem::set_frame_color()
{
uint32_t f = 0;
if (!frame) {
return;
}
if (_selected) {
f = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
if (fill_opacity) {
frame->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get(), fill_opacity);
} else {
frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
f = UINT_RGBA_CHANGE_A (f, fill_opacity);
}
if (!rect_visible) {
f = UINT_RGBA_CHANGE_A (f, 0);
}
} else {
if (_recregion) {
frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
f = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
} else {
uint32_t f = 0;
if (high_enough_for_name && !Config->get_color_regions_using_track_color()) {
f = ARDOUR_UI::config()->canvasvar_FrameBase.get();
} else {
@ -707,10 +739,14 @@ TimeAxisViewItem::set_frame_color()
f = UINT_RGBA_CHANGE_A (f, fill_opacity);
}
if (!rect_visible) {
f = UINT_RGBA_CHANGE_A (f, 0);
}
}
}
frame->property_fill_color_rgba() = f;
}
}
}
/**
* Set the colors of the start and end trim handle depending on object state

View File

@ -83,6 +83,9 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
virtual void lower () { return; }
virtual void lower_to_bottom () { return; }
virtual void hide_rect ();
virtual void show_rect ();
/** @return true if the name area should respond to events */
bool name_active() const { return name_connected; }
@ -220,6 +223,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
int name_pixbuf_width;
bool wide_enough_for_name;
bool high_enough_for_name;
bool rect_visible;
ArdourCanvas::Group* group;
ArdourCanvas::SimpleRect* vestigial_frame;