diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-12 02:51:51 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-02-12 02:51:51 +0000 |
commit | a1955a82e81816161f5b7dbf460a694e902237b0 (patch) | |
tree | 3c576a733aed52ff02a8fdc9786838bdea7758d2 /gtk2_ardour/editor_ops.cc | |
parent | 7999372faccab884b4e652da83702d7ec252e14b (diff) |
AU GUIs basically working, though unfinished; push up dialog for massive split operations (still in progress); fix problem where peakfile is slightly older than audio data even though it is ready to use (debugging output still present); move sync-menu code to libs/gtkmm2ext for linkage reasons; prevent flush_pending() calls from "top menu" items on OS X from locking the GUI; try to make adding lots of regions (e.g. from split-at-points) scale a bit better; SAE version has no timecode mode for audio clocks
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3038 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 5c3a1590be..92bb403166 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5198,7 +5198,7 @@ Editor::split_region_at_transients () boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> ((*i)->region()); if (ar && (ar->get_transients (positions) == 0)) { - split_region_at_points ((*i)->region(), positions); + split_region_at_points ((*i)->region(), positions, true); positions.clear (); } @@ -5210,10 +5210,11 @@ Editor::split_region_at_transients () } void -Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList& positions) +Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList& positions, bool can_ferret) { boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r); - + bool use_rhythmic_rodent = false; + if (!ar) { return; } @@ -5227,7 +5228,41 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList if (positions.empty()) { return; } + + + if (positions.size() > 20) { + Glib::ustring msgstr = string_compose (_("You are about to split\n%1\ninto %2 pieces.\nThis could take a long time."), ar->name(), positions.size() + 1); + MessageDialog msg (msgstr, + false, + Gtk::MESSAGE_INFO, + Gtk::BUTTONS_OK_CANCEL); + + if (can_ferret) { + msg.add_button (_("Call for the Ferret!"), RESPONSE_APPLY); + } + + msg.set_title (_("Excessive split?")); + msg.set_secondary_text (_("Press OK to continue with this split operation\nor ask the Ferret dialog to tune the analysis")); + msg.present (); + + int response = msg.run(); + msg.hide (); + switch (response) { + case RESPONSE_OK: + break; + case RESPONSE_APPLY: + use_rhythmic_rodent = true; + break; + default: + return; + } + } + if (use_rhythmic_rodent) { + show_rhythm_ferret (); + return; + } + AnalysisFeatureList::const_iterator x; nframes64_t pos = ar->position(); @@ -5249,7 +5284,10 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList pl->freeze (); pl->remove_region (ar); + vector<boost::shared_ptr<Region> > new_regions; + cerr << "about to split using " << positions.size() << " positions" << endl; + while (x != positions.end()) { /* file start = original start + how far we from the initial position ? @@ -5276,8 +5314,14 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList continue; } - pl->add_region (RegionFactory::create (ar->get_sources(), file_start, len, new_name), pos); - + /* do NOT announce new regions 1 by one, just wait till they are all done */ + + boost::shared_ptr<Region> r = RegionFactory::create (ar->get_sources(), file_start, len, new_name, 0, Region::DefaultFlags, false); + pl->add_region (r, pos); + new_regions.push_back (r); + + cerr << "done at " << pos << endl; + pos += len; ++x; @@ -5287,7 +5331,8 @@ Editor::split_region_at_points (boost::shared_ptr<Region> r, AnalysisFeatureList } pl->thaw (); - + session->add_regions (new_regions); + XMLNode& after (pl->get_state()); session->add_command (new MementoCommand<Playlist>(*pl, &before, &after)); |