diff options
author | David Robillard <d@drobilla.net> | 2008-09-19 06:30:49 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-09-19 06:30:49 +0000 |
commit | 60f588f21d6ad62335d72e8dc682abf8859107ea (patch) | |
tree | b096b25cd757f6086c90f35b4358080747dc0c0a /gtk2_ardour | |
parent | 2539b8fc184380957ba0effa1db947ced748ab31 (diff) |
Fix parameter range stuff and automation time axis height (somewhat...).
Create a new AutomationLine when an AutomationRegionView without a line is clicked.
git-svn-id: svn://localhost/ardour2/branches/3.0@3757 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_line.h | 4 | ||||
-rw-r--r-- | gtk2_ardour/automation_region_view.cc | 43 | ||||
-rw-r--r-- | gtk2_ardour/automation_region_view.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/automation_streamview.cc | 7 | ||||
-rw-r--r-- | gtk2_ardour/crossfade_edit.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/curvetest.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_route_list.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/region_view.h | 1 |
9 files changed, 54 insertions, 20 deletions
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 568bfb54ed..e40b7ea30f 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -115,7 +115,7 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuff } else if (strcmp (prefix, _("[INFO]: ")) == 0) { text = "<span color=\"green\" weight=\"bold\">"; } else { - text = "<span color=\"blue\" weight=\"bold\">???"; + text = "<span color=\"white\" weight=\"bold\">???"; } text += prefix; diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index bc9c75e8f7..5a1b63740b 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -143,8 +143,8 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulThingWithGoin ArdourCanvas::Group& _parent_group; ArdourCanvas::Group* group; - ArdourCanvas::Line* line; /* line */ - ArdourCanvas::Points line_points; /* coordinates for canvas line */ + ArdourCanvas::Line* line; /* line */ + ArdourCanvas::Points line_points; /* coordinates for canvas line */ vector<ControlPoint*> control_points; /* visible control points */ struct ALPoint { diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 00cb8be5c4..7b43f2f0af 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -26,17 +26,16 @@ AutomationRegionView::AutomationRegionView(ArdourCanvas::Group* parent, AutomationTimeAxisView& time_axis, boost::shared_ptr<ARDOUR::Region> region, + const ARDOUR::Parameter& param, boost::shared_ptr<ARDOUR::AutomationList> list, double spu, Gdk::Color& basic_color) : RegionView(parent, time_axis, region, spu, basic_color) + , _parameter(param) { if (list) { - _line = boost::shared_ptr<AutomationLine>(new AutomationLine( - list->parameter().symbol(), time_axis, *group, list)); - _line->set_colors(); - _line->show(); - _line->show_all_control_points(); + assert(list->parameter() == param); + create_line(list); } group->signal_event().connect (mem_fun (this, &AutomationRegionView::canvas_event), false); @@ -62,6 +61,18 @@ AutomationRegionView::init (Gdk::Color& basic_color, bool wfd) _enable_display = true; } +void +AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> list) +{ + _line = boost::shared_ptr<AutomationLine>(new AutomationLine( + list->parameter().symbol(), trackview, *get_canvas_group(), list)); + _line->set_colors(); + _line->show(); + _line->show_all_control_points(); + _line->set_y_position_and_height (trackview.y_position, + (uint32_t)rint(trackview.current_height() - NAME_HIGHLIGHT_SIZE)); +} + bool AutomationRegionView::canvas_event(GdkEvent* ev) { @@ -79,9 +90,13 @@ void AutomationRegionView::add_automation_event (GdkEvent* event, nframes_t when, double y) { if (!_line) { - cerr << "ERROR: AutomationRegionView::add_automation_event called without line" << endl; - return; + boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true); + boost::shared_ptr<ARDOUR::AutomationControl> ac + = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(c); + assert(ac); + create_line(ac->alist()); } + assert(_line); double x = 0; AutomationTimeAxisView* const view = automation_view(); @@ -109,14 +124,24 @@ AutomationRegionView::add_automation_event (GdkEvent* event, nframes_t when, dou view->session().set_dirty (); } - void AutomationRegionView::set_y_position_and_height (double y, double h) { + cout << "ARV SET Y POSITION AND HEIGHT: " << y << ", " << h << endl; RegionView::set_y_position_and_height(y, h - 1); if (_line) - _line->set_y_position_and_height ((uint32_t)y, (uint32_t) rint (h - NAME_HIGHLIGHT_SIZE)); + _line->set_y_position_and_height (y, h - NAME_HIGHLIGHT_SIZE); +} + +void +AutomationRegionView::set_height (double h) +{ + cout << "ARV SET HEIGHT: " << h << endl; + RegionView::set_height(h); + if (_line) + _line->set_y_position_and_height (trackview.y_position - h, + (uint32_t)rint(h - NAME_HIGHLIGHT_SIZE)); } bool diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h index e69845461c..90fa9f3e44 100644 --- a/gtk2_ardour/automation_region_view.h +++ b/gtk2_ardour/automation_region_view.h @@ -31,6 +31,7 @@ namespace ARDOUR { class AutomationList; + class Parameter; }; class TimeAxisView; @@ -41,6 +42,7 @@ public: AutomationRegionView(ArdourCanvas::Group*, AutomationTimeAxisView&, boost::shared_ptr<ARDOUR::Region>, + const ARDOUR::Parameter& parameter, boost::shared_ptr<ARDOUR::AutomationList>, double initial_samples_per_unit, Gdk::Color& basic_color); @@ -57,9 +59,11 @@ public: // We are a ghost. Meta ghosts? Crazy talk. virtual GhostRegion* add_ghost(TimeAxisView&) { return NULL; } + void set_height (double); void reset_width_dependent_items(double pixel_width); protected: + void create_line(boost::shared_ptr<ARDOUR::AutomationList> list); bool set_position(nframes_t pos, void* src, double* ignored); void set_y_position_and_height(double y, double h); void region_resized(ARDOUR::Change what_changed); @@ -69,6 +73,7 @@ protected: void exited(); private: + ARDOUR::Parameter _parameter; boost::shared_ptr<AutomationLine> _line; }; diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index 68da972ba0..206dc3753b 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -88,8 +88,10 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region region->control(_controller->controllable()->parameter())); boost::shared_ptr<AutomationList> list; - if (control) + if (control) { list = boost::dynamic_pointer_cast<AutomationList>(control->list()); + assert(!control->list() || list); + } AutomationRegionView *region_view; std::list<RegionView *>::iterator i; @@ -107,7 +109,8 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region } } - region_view = new AutomationRegionView (canvas_group, _automation_view, region, list, + region_view = new AutomationRegionView (canvas_group, _automation_view, region, + _controller->controllable()->parameter(), list, _samples_per_unit, region_color); region_view->init (region_color, false); diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index 3e85bd22db..6e4cbb3457 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -65,7 +65,8 @@ CrossfadeEditor::Presets* CrossfadeEditor::fade_out_presets = 0; CrossfadeEditor::Half::Half () : line (0), - normative_curve (Parameter(GainAutomation, 0.0, 1.0, 1.0)), // FIXME: GainAutomation? + //normative_curve (Parameter(GainAutomation, 0.0, 1.0, 1.0)), // FIXME: GainAutomation? + normative_curve (Parameter(GainAutomation)), gain_curve (Parameter(GainAutomation)) { } diff --git a/gtk2_ardour/curvetest.cc b/gtk2_ardour/curvetest.cc index 88c7b8e116..9235fb9ba9 100644 --- a/gtk2_ardour/curvetest.cc +++ b/gtk2_ardour/curvetest.cc @@ -34,7 +34,8 @@ curvetest (string filename) { ifstream in (filename.c_str()); stringstream line; - Parameter param(GainAutomation, -1.0, +1.0, 0.0); + //Parameter param(GainAutomation, -1.0, +1.0, 0.0); + Parameter param(GainAutomation); AutomationList al (param); double minx = DBL_MAX; double maxx = DBL_MIN; diff --git a/gtk2_ardour/editor_route_list.cc b/gtk2_ardour/editor_route_list.cc index f2b8456fd9..1dd9a44e80 100644 --- a/gtk2_ardour/editor_route_list.cc +++ b/gtk2_ardour/editor_route_list.cc @@ -414,7 +414,7 @@ Editor::hide_all_tracks (bool with_select) void Editor::build_route_list_menu () { - using namespace Menu_Helpers; + using namespace Menu_Helpers; using namespace Gtk; route_list_menu = new Menu; @@ -434,7 +434,7 @@ Editor::build_route_list_menu () void Editor::set_all_tracks_visibility (bool yn) { - TreeModel::Children rows = route_display_model->children(); + TreeModel::Children rows = route_display_model->children(); TreeModel::Children::iterator i; no_route_list_redisplay = true; @@ -458,7 +458,7 @@ Editor::set_all_tracks_visibility (bool yn) void Editor::set_all_audio_visibility (int tracks, bool yn) { - TreeModel::Children rows = route_display_model->children(); + TreeModel::Children rows = route_display_model->children(); TreeModel::Children::iterator i; no_route_list_redisplay = true; diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h index 579b6e5594..a001e241f1 100644 --- a/gtk2_ardour/region_view.h +++ b/gtk2_ardour/region_view.h @@ -58,7 +58,6 @@ class RegionView : public TimeAxisViewItem bool is_valid() const { return valid; } - void set_valid (bool yn) { valid = yn; } virtual void set_height (double); |