From 36d88c8e494c1997c05d122fa03c00d0e8b6e401 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 19 Mar 2007 14:45:34 +0000 Subject: [PATCH] make rec-regions insensitive to events; fix up diskrate dialog text git-svn-id: svn://localhost/ardour2/trunk@1626 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 2 +- gtk2_ardour/audio_streamview.cc | 9 +++++ gtk2_ardour/editor_canvas_events.cc | 30 +++++++++++++- gtk2_ardour/region_view.h | 62 +++++++++++++++-------------- gtk2_ardour/time_axis_view_item.cc | 1 + gtk2_ardour/time_axis_view_item.h | 6 +++ 6 files changed, 78 insertions(+), 32 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 7e24cb4cc4..2fbe987a94 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2379,7 +2379,7 @@ ARDOUR_UI::disk_overrun_handler () if (!have_disk_speed_dialog_displayed) { have_disk_speed_dialog_displayed = true; - MessageDialog* msg = new MessageDialog (*editor, X_("diskrate dialog"), _("\ + MessageDialog* msg = new MessageDialog (*editor, _("\ The disk system on your computer\n\ was not able to keep up with Ardour.\n\ \n\ diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc index aa54af86fb..14036bc569 100644 --- a/gtk2_ardour/audio_streamview.cc +++ b/gtk2_ardour/audio_streamview.cc @@ -179,6 +179,15 @@ AudioStreamView::add_region_view_internal (boost::shared_ptr r, bool wai region_view->set_amplitude_above_axis(_amplitude_above_axis); region_views.push_front (region_view); + + /* if its the special single-sample length that we use for rec-regions, make it + insensitive to events + */ + + if (region->length() == 1) { + region_view->set_sensitive (false); + } + /* if this was the first one, then lets query the waveform scale and shape. otherwise, we set it to the current value */ diff --git a/gtk2_ardour/editor_canvas_events.cc b/gtk2_ardour/editor_canvas_events.cc index b7b0288ed8..dd190c7132 100644 --- a/gtk2_ardour/editor_canvas_events.cc +++ b/gtk2_ardour/editor_canvas_events.cc @@ -214,7 +214,11 @@ Editor::typed_event (ArdourCanvas::Item* item, GdkEvent *event, ItemType type) bool Editor::canvas_region_view_event (GdkEvent *event, ArdourCanvas::Item* item, RegionView *rv) { - gint ret = FALSE; + bool ret = false; + + if (!rv->sensitive ()) { + return false; + } switch (event->type) { case GDK_BUTTON_PRESS: @@ -330,6 +334,10 @@ Editor::canvas_fade_in_event (GdkEvent *event, ArdourCanvas::Item* item, AudioRe { /* we handle only button 3 press/release events */ + if (!rv->sensitive()) { + return false; + } + switch (event->type) { case GDK_BUTTON_PRESS: clicked_regionview = rv; @@ -362,6 +370,10 @@ Editor::canvas_fade_in_handle_event (GdkEvent *event, ArdourCanvas::Item* item, { bool ret = false; + if (!rv->sensitive()) { + return false; + } + switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: @@ -401,6 +413,10 @@ Editor::canvas_fade_out_event (GdkEvent *event, ArdourCanvas::Item* item, AudioR { /* we handle only button 3 press/release events */ + if (!rv->sensitive()) { + return false; + } + switch (event->type) { case GDK_BUTTON_PRESS: clicked_regionview = rv; @@ -433,6 +449,10 @@ Editor::canvas_fade_out_handle_event (GdkEvent *event, ArdourCanvas::Item* item, { bool ret = false; + if (!rv->sensitive()) { + return false; + } + switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: @@ -703,6 +723,10 @@ Editor::canvas_region_view_name_highlight_event (GdkEvent* event, ArdourCanvas:: { bool ret = false; + if (!rv->sensitive()) { + return false; + } + switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: @@ -739,6 +763,10 @@ Editor::canvas_region_view_name_event (GdkEvent *event, ArdourCanvas::Item* item { bool ret = false; + if (!rv->sensitive()) { + return false; + } + switch (event->type) { case GDK_BUTTON_PRESS: case GDK_2BUTTON_PRESS: diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h index 64ab256f89..5f114bfcbf 100644 --- a/gtk2_ardour/region_view.h +++ b/gtk2_ardour/region_view.h @@ -56,41 +56,43 @@ class RegionView : public TimeAxisViewItem boost::shared_ptr region() const { return _region; } bool is_valid() const { return valid; } - void set_valid (bool yn) { valid = yn; } - virtual void set_height (double) = 0; - virtual void set_samples_per_unit (double); - virtual bool set_duration (nframes_t, void*); - void move (double xdelta, double ydelta); + void set_valid (bool yn) { valid = yn; } + + virtual void set_height (double) = 0; + virtual void set_samples_per_unit (double); + virtual bool set_duration (nframes_t, void*); + + void move (double xdelta, double ydelta); + + void raise (); + void raise_to_top (); + void lower (); + void lower_to_bottom (); - void raise (); - void raise_to_top (); - void lower (); - void lower_to_bottom (); - - bool set_position(nframes_t pos, void* src, double* delta = 0); - void fake_set_opaque (bool yn); - - virtual void show_region_editor () = 0; - virtual void hide_region_editor(); - - virtual void region_changed (ARDOUR::Change); - - virtual GhostRegion* add_ghost (AutomationTimeAxisView&) = 0; - void remove_ghost (GhostRegion*); - - uint32_t get_fill_color (); - - virtual void entered () {} - virtual void exited () {} - - static sigc::signal RegionViewGoingAway; - sigc::signal GoingAway; + bool set_position(nframes_t pos, void* src, double* delta = 0); + void fake_set_opaque (bool yn); + + virtual void show_region_editor () = 0; + virtual void hide_region_editor(); + + virtual void region_changed (ARDOUR::Change); + + virtual GhostRegion* add_ghost (AutomationTimeAxisView&) = 0; + void remove_ghost (GhostRegion*); + + uint32_t get_fill_color (); + virtual void entered () {} + virtual void exited () {} + + static sigc::signal RegionViewGoingAway; + sigc::signal GoingAway; + protected: - - /** Allows derived types to specify their visibility requirements + + /** Allows derived types to specify their visibility requirements * to the TimeAxisViewItem parent class */ RegionView (ArdourCanvas::Group *, diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 87eac74ccf..fb45655256 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -136,6 +136,7 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo min_item_duration = 0 ; show_vestigial = true; visibility = vis; + _sensitive = true; if (duration == 0) { warning << "Time Axis Item Duration == 0" << endl ; diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index d41ad5a327..e0331a2de2 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -176,6 +176,9 @@ class TimeAxisViewItem : public Selectable * @param yn true if this item should show its selected status */ virtual void set_should_show_selection (bool yn) ; + + void set_sensitive (bool yn) { _sensitive = yn; } + bool sensitive () const { return _sensitive; } //---------------------------------------------------------------------------------------// // Parent Component Methods @@ -412,6 +415,9 @@ class TimeAxisViewItem : public Selectable /** should the item show its selected status */ bool should_show_selection; + + /** should the item respond to events */ + bool _sensitive; /** * The unique item name of this Item