new design for region dragging; make add route dialog float over the correct window...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 5 Mar 2007 15:34:56 +0000 (15:34 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 5 Mar 2007 15:34:56 +0000 (15:34 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1555 d708f5d6-7413-0410-9779-e7cbd77b26cf

20 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/audio_region_view.cc
gtk2_ardour/audio_region_view.h
gtk2_ardour/editor.cc
gtk2_ardour/editor_keys.cc
gtk2_ardour/editor_mouse.cc
gtk2_ardour/export_dialog.cc
gtk2_ardour/export_dialog.h
gtk2_ardour/export_range_markers_dialog.cc
gtk2_ardour/export_range_markers_dialog.h
gtk2_ardour/export_region_dialog.cc
gtk2_ardour/export_session_dialog.cc
gtk2_ardour/mixer_ui.cc
gtk2_ardour/region_view.cc
gtk2_ardour/region_view.h
gtk2_ardour/route_params_ui.cc
gtk2_ardour/time_axis_view_item.cc
gtk2_ardour/time_axis_view_item.h

index ab06f4952b25ef253e81cece52a1458c32de14af..d27a0505f29cd383b61fbfbf5293824028756e30 100644 (file)
@@ -997,7 +997,8 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t
                                if (how_many == 1) {
                                        error << _("could not create a new audio track") << endmsg;
                                } else {
-                                       error << string_compose (_("could not create %1 new audio tracks"), how_many) << endmsg;
+                                       error << string_compose (_("could only create %1 of %2 new audio %3"), 
+                                                                tracks.size(), how_many, (track ? _("tracks") : _("busses"))) << endmsg;
                                }
                        }
 
@@ -1028,6 +1029,7 @@ ARDOUR_UI::session_add_audio_route (bool track, int32_t input_channels, int32_t
        }
 
        catch (...) {
+               cerr << "About to complain about JACK\n";
                MessageDialog msg (*editor, 
                                   _("There are insufficient JACK ports available\n\
 to create a new track or bus.\n\
@@ -2259,7 +2261,7 @@ releasing %4 %5bytes of disk space"));
 }
 
 void
-ARDOUR_UI::add_route ()
+ARDOUR_UI::add_route (Gtk::Window* float_window)
 {
        int count;
 
@@ -2269,7 +2271,9 @@ ARDOUR_UI::add_route ()
 
        if (add_route_dialog == 0) {
                add_route_dialog = new AddRouteDialog;
-               editor->ensure_float (*add_route_dialog);
+               if (float_window) {
+                       add_route_dialog->set_transient_for (*float_window);
+               }
        }
 
        if (add_route_dialog->is_visible()) {
index 6f9cc8dfcef5fc519b35d41e98366ad9d69ac19a..599debaf1eaf64ca40cdbba52b5d6e03c1c30bba 100644 (file)
@@ -188,7 +188,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void store_clock_modes ();
        void restore_clock_modes ();
 
-       void add_route ();
+       void add_route (Gtk::Window* float_window);
        
        void session_add_audio_track (int input_channels, int32_t output_channels, ARDOUR::TrackMode mode, uint32_t how_many) {
                session_add_audio_route (true, input_channels, output_channels, mode, how_many);
index f80e71a410f66d6e9c8d93e34e07b7cbb81bc97c..f79564bb4348159f2ae73692bf64f90314679407 100644 (file)
@@ -99,7 +99,8 @@ ARDOUR_UI::install_actions ()
        act = ActionManager::register_action (main_actions, X_("Close"), _("Close"),  mem_fun(*this, &ARDOUR_UI::close_session));
        ActionManager::session_sensitive_actions.push_back (act);
 
-       act = ActionManager::register_action (main_actions, X_("AddTrackBus"), _("Add Track/Bus"),  mem_fun(*this, &ARDOUR_UI::add_route));
+       act = ActionManager::register_action (main_actions, X_("AddTrackBus"), _("Add Track/Bus"),  
+                                             bind (mem_fun(*this, &ARDOUR_UI::add_route), (Gtk::Window*) 0));
        ActionManager::session_sensitive_actions.push_back (act);
 
        
index 6e6fc39ba83a2761424370602ec1041cc1128f24..04324a7d60b172dbc131611fc122bc9abdf5c71c 100644 (file)
@@ -89,14 +89,37 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView
 {
 }
 
+
+AudioRegionView::AudioRegionView (const AudioRegionView& other)
+       : RegionView (other)
+       , zero_line(0)
+       , fade_in_shape(0)
+       , fade_out_shape(0)
+       , fade_in_handle(0)
+       , fade_out_handle(0)
+       , gain_line(0)
+       , _amplitude_above_axis(1.0)
+       , _flags(0)
+       , fade_color(0)
+
+{
+       Gdk::Color c;
+       int r,g,b,a;
+
+       UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
+       c.set_rgb_p (r/255.0, g/255.0, b/255.0);
+       
+       init (c, false);
+}
+
 void
 AudioRegionView::init (Gdk::Color& basic_color, bool wfd)
 {
        // FIXME: Some redundancy here with RegionView::init.  Need to figure out
        // where order is important and where it isn't...
        
-       RegionView::init(basic_color, wfd);
-
+       RegionView::init(basic_color, false);
+       
        XMLNode *node;
 
        _amplitude_above_axis = 1.0;
index 193cd80e96ea2dbeef0314438e800e9a44af4ca5..761c0eafd82c68f08ec03302f9baf04c98e25e8a 100644 (file)
@@ -55,6 +55,8 @@ class AudioRegionView : public RegionView
                         double initial_samples_per_unit,
                         Gdk::Color& basic_color);
 
+        AudioRegionView (const AudioRegionView& other);
+
        ~AudioRegionView ();
        
        virtual void init (Gdk::Color& base_color, bool wait_for_data = false);
@@ -143,7 +145,7 @@ class AudioRegionView : public RegionView
     void reset_width_dependent_items (double pixel_width);
     void set_waveview_data_src();
     
-       void color_handler (ColorID, uint32_t);
+    void color_handler (ColorID, uint32_t);
 
     vector<GnomeCanvasWaveViewCache*> wave_caches;
     vector<ArdourCanvas::WaveView *>  waves;
index 9ad78634b941db28a2c5852ea3115fde1e5e7d4d..2bd6c04f9d33b538dd7a1c03cb4a4865c024876e 100644 (file)
@@ -3031,7 +3031,7 @@ gint
 Editor::edit_controls_button_release (GdkEventButton* ev)
 {
        if (Keyboard::is_context_menu_event (ev)) {
-               ARDOUR_UI::instance()->add_route ();
+               ARDOUR_UI::instance()->add_route (this);
        }
        return TRUE;
 }
index e38fe9e2e75b2532d414760b29256d54d8a87192..b3081e8c8add34b17ca5d1720c45965c1db540b0 100644 (file)
@@ -69,7 +69,7 @@ Editor::keyboard_duplicate_region ()
                return;
        }
 
-       float prefix;
+       float prefix = 0;
        bool was_floating;
 
        if (get_prefix (prefix, was_floating) == 0) {
@@ -82,7 +82,7 @@ Editor::keyboard_duplicate_region ()
 void
 Editor::keyboard_duplicate_selection ()
 {
-       float prefix;
+       float prefix = 0;
        bool was_floating;
 
        if (get_prefix (prefix, was_floating) == 0) {
@@ -95,7 +95,7 @@ Editor::keyboard_duplicate_selection ()
 void
 Editor::keyboard_paste ()
 {
-       float prefix;
+       float prefix = 0;
        bool was_floating;
 
        if (get_prefix (prefix, was_floating) == 0) {
@@ -108,7 +108,7 @@ Editor::keyboard_paste ()
 void
 Editor::keyboard_insert_region_list_selection ()
 {
-       float prefix;
+       float prefix = 0;
        bool was_floating;
 
        if (get_prefix (prefix, was_floating) == 0) {
index 88b43338784ed71878e437e3050785cbab1109a2..f8c9b0124aec4c4a6769a930fbfdc608926cc77c 100644 (file)
@@ -1520,12 +1520,11 @@ Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item
                */
                if (!drag_info.move_threshold_passed) {
 
-                       drag_info.move_threshold_passed = (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
-
-                       if (drag_info.copy && !drag_info.move_threshold_passed) {
-                               drag_info.move_threshold_passed = (abs ((int) (drag_info.current_pointer_y - drag_info.grab_y)) > 4);
-                       }
+                       bool x_threshold_passed =  (abs ((int) (drag_info.current_pointer_x - drag_info.grab_x)) > 4);
+                       bool y_threshold_passed =  (abs ((int) (drag_info.current_pointer_y - drag_info.grab_y)) > 4);
 
+                       drag_info.move_threshold_passed = (x_threshold_passed || y_threshold_passed);
+                       
                        // and change the initial grab loc/frame if this drag info wants us to
 
                        if (drag_info.want_move_threshold && drag_info.move_threshold_passed) {
@@ -2830,67 +2829,31 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
        vector<int32_t>  height_list(512) ;
        vector<int32_t>::iterator j;
 
-       /* don't copy regions if we're doing x-constrained and we're in the same track, or
-          if we haven't passed the move threshold yet
-       */
-
-       if ((!drag_info.x_constrained || (drag_info.last_trackview != &rv->get_time_axis_view())) &&
-            drag_info.copy && drag_info.move_threshold_passed && drag_info.want_move_threshold) {
-
-               cerr << "COPY, xcons = " << drag_info.x_constrained << " last = " << drag_info.last_trackview->name() << " rv = " << rv->get_time_axis_view().name() << endl;
+       if (drag_info.copy && drag_info.move_threshold_passed && drag_info.want_move_threshold) {
 
                drag_info.want_move_threshold = false; // don't copy again
 
-               /* this is committed in the grab finished callback. */
-               
-               begin_reversible_command (_("Drag region copy"));
-               
                /* duplicate the region(s) */
                
                vector<RegionView*> new_regionviews;
                
-               set<boost::shared_ptr<Playlist> > affected_playlists;
-               pair<set<boost::shared_ptr<Playlist> >::iterator,bool> insert_result;
-
                for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
                        RegionView* rv;
-                       
+                       RegionView* nrv;
+                       AudioRegionView* arv;
+
                        rv = (*i);
-                       
-                       boost::shared_ptr<Playlist> to_playlist = rv->region()->playlist();
-                       RouteTimeAxisView* atv = dynamic_cast<RouteTimeAxisView*>(&rv->get_time_axis_view());
 
-                       insert_result = affected_playlists.insert (to_playlist);
-                       if (insert_result.second) {
-                               session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
-                       }
                        
-                       latest_regionview = 0;
-                       
-                       /* create a new region with the same name. */
-                       
-                       // FIXME: ew.  need a (virtual) Region::duplicate() or something?
-
-                       boost::shared_ptr<Region> newregion;
-                       boost::shared_ptr<Region> ar;
-
-                       if ((ar = boost::dynamic_pointer_cast<AudioRegion>(rv->region())) != 0) {
-                               newregion = RegionFactory::create (ar);
+                       if ((arv = dynamic_cast<AudioRegionView*>(rv)) == 0) {
+                               /* XXX handle MIDI here */
+                               continue;
                        }
-                       assert(newregion != 0);
 
-                       /* if the original region was locked, we don't care */
-                       
-                       newregion->set_locked (false);
-                       
-                       sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
-                       to_playlist->add_region (newregion, (nframes_t) (rv->region()->position() * atv->get_diskstream()->speed()));
+                       nrv = new AudioRegionView (*arv);
+                       nrv->get_canvas_group()->show ();
 
-                       c.disconnect ();
-                       
-                       if (latest_regionview) {
-                               new_regionviews.push_back (latest_regionview);
-                       }
+                       new_regionviews.push_back (nrv);
                }
 
                if (new_regionviews.empty()) {
@@ -2904,6 +2867,7 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
                /* reset drag_info data to reflect the fact that we are dragging the copies */
                
                drag_info.data = new_regionviews.front();
+               
                swap_grab (new_regionviews.front()->get_canvas_group (), 0, event->motion.time);
        }
 
@@ -3301,26 +3265,8 @@ Editor::region_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
                                rv->get_canvas_group()->raise_to_top();
                                rv->get_time_axis_view().canvas_display->raise_to_top();
                                cursor_group->raise_to_top();
-                       
-                               /* freeze the playlists from notifying till
-                                  the motion is done.
-                               */
-                       
-                               AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (&rv->get_time_axis_view());
-                               if (atv && atv->is_audio_track()) {
-                                       boost::shared_ptr<AudioPlaylist> pl = boost::dynamic_pointer_cast<AudioPlaylist>(atv->get_diskstream()->playlist());
-                                       if (pl) {
-                                               /* only freeze and capture state once */
-                                       
-                                               insert_result = motion_frozen_playlists.insert (pl);
-                                               if (insert_result.second) {
-                                                       pl->freeze();
-                                                       session->add_command(new MementoCommand<Playlist>(*pl, &pl->get_state(), 0));
-                                               }
-                                       }
-                               }
-                       
-                               rv->fake_set_opaque (false);
+
+                               rv->fake_set_opaque (true);
                        }
                        
                        if (drag_info.brushing) {
@@ -3391,106 +3337,94 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
        //printf ("last_frame: %s position is %lu  %g\n", rv->get_time_axis_view().name().c_str(), drag_info.last_frame_position, speed); 
        //printf ("last_rackview: %s \n", drag_info.last_trackview->name().c_str()); 
        
+       char* op_string;
+
+       if (drag_info.copy) {
+               if (drag_info.x_constrained) {
+                       op_string = _("fixed time region copy");
+               } else {
+                       op_string = _("region copy");
+               } 
+       } else {
+               if (drag_info.x_constrained) {
+                       op_string = _("fixed time region drag");
+               } else {
+                       op_string = _("region drag");
+               }
+       }
+
+       begin_reversible_command (op_string);
+
        if (regionview_y_movement) {
 
-               /* motion between tracks */
+               /* moved to a different audio track. */
 
                list<RegionView*> new_selection;
-       
-               /* moved to a different audio track. */
+               new_selection = selection->regions.by_layer();
+               selection->clear_regions ();
 
-               for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ) {
+               for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end(); ++i) {
            
-                       RegionView* rv2 = (*i);             
-           
-                       /* the region that used to be in the old playlist is not
-                          moved to the new one - we make a copy of it. as a result,
-                          any existing editor for the region should no longer be
-                          visible.
-                       */ 
-           
-                       if (!drag_info.copy) {
-                               rv2->hide_region_editor();
-                       }           
-                       new_selection.push_back (rv2);      
-                       i++;
-               }
+                       RegionView* rv = (*i);              
 
-               /* first, freeze the target tracks */
-
-               for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end();i++ ) {
-
-                       boost::shared_ptr<Playlist> from_playlist;
-                       boost::shared_ptr<Playlist> to_playlist;
-                               
                        double ix1, ix2, iy1, iy2;
-           
-                       (*i)->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
-                       (*i)->get_canvas_group()->i2w (ix1, iy1);
+                       
+                       rv->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
+                       rv->get_canvas_group()->i2w (ix1, iy1);
                        TimeAxisView* tvp2 = trackview_by_y_position (iy1);
                        AudioTimeAxisView* atv2 = dynamic_cast<AudioTimeAxisView*>(tvp2);
 
-                       (*i)->fake_set_opaque (true);
+                       boost::shared_ptr<Playlist> from_playlist = rv->region()->playlist();
+                       boost::shared_ptr<Playlist> to_playlist = atv2->playlist();
            
-                       from_playlist = (*i)->region()->playlist();
-                       to_playlist = atv2->playlist();
-
-                       /* the from_playlist was frozen in the "first_move" case 
-                          of the motion handler. the insert can fail, 
-                          but that doesn't matter. it just means
-                          we already have the playlist in the list.
-                       */
-                       
-                       motion_frozen_playlists.insert (from_playlist);
-
-                       /* only freeze the to_playlist once */
-
-                       insert_result = motion_frozen_playlists.insert(to_playlist);
-                       if (insert_result.second) {
-                               to_playlist->freeze();
-                                session->add_command(new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));
-                       }
-
-               }
-
-               /* now do it again with the actual operations */
-
-               for (list<RegionView*>::const_iterator i = new_selection.begin(); i != new_selection.end();i++ ) {
+                       where = (nframes_t) (unit_to_frame (ix1) * speed);
+                       boost::shared_ptr<Region> new_region (RegionFactory::create (rv->region()));
 
-                       boost::shared_ptr<Playlist> from_playlist;
-                       boost::shared_ptr<Playlist> to_playlist;
+                       if (!drag_info.copy) {
                                
-                       double ix1, ix2, iy1, iy2;
+                               /* the region that used to be in the old playlist is not
+                                  moved to the new one - we make a copy of it. as a result,
+                                  any existing editor for the region should no longer be
+                                  visible.
+                               */ 
            
-                       (*i)->get_canvas_frame()->get_bounds (ix1, iy1, ix2, iy2);
-                       (*i)->get_canvas_group()->i2w (ix1, iy1);
-                       TimeAxisView* tvp2 = trackview_by_y_position (iy1);
-                       AudioTimeAxisView* atv2 = dynamic_cast<AudioTimeAxisView*>(tvp2);
-           
-                       from_playlist = (*i)->region()->playlist();
-                       to_playlist = atv2->playlist();
+                               rv->hide_region_editor();
+                               rv->fake_set_opaque (false);
 
-                       latest_regionview = 0;
-           
-                       where = (nframes_t) (unit_to_frame (ix1) * speed);
-                       boost::shared_ptr<Region> new_region (RegionFactory::create ((*i)->region()));
+                               session->add_command (new MementoCommand<Playlist>(*from_playlist, &from_playlist->get_state(), 0));    
+                               from_playlist->remove_region ((rv->region()));
+                               session->add_command (new MementoCommand<Playlist>(*from_playlist, 0, &from_playlist->get_state()));    
+                       }
 
-                       from_playlist->remove_region (((*i)->region()));
+                       latest_regionview = 0;
                        
                        sigc::connection c = atv2->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
+                       session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));        
                        to_playlist->add_region (new_region, where);
+                       session->add_command (new MementoCommand<Playlist>(*to_playlist, 0, &to_playlist->get_state()));        
                        c.disconnect ();
                                                              
                        if (latest_regionview) {
                                selection->add (latest_regionview);
                        }
+
+                       if (drag_info.copy) {
+                               // get rid of the copy
+                               delete rv;
+                       } 
                } 
 
        } else {
 
                /* motion within a single track */
+
+               list<RegionView*> regions = selection->regions.by_layer();
+
+               if (drag_info.copy) {
+                       selection->clear_regions();
+               }
                
-               for (list<RegionView*>::const_iterator i = selection->regions.by_layer().begin(); i != selection->regions.by_layer().end(); ++i) {
+               for (list<RegionView*>::iterator i = regions.begin(); i != regions.end(); ++i) {
 
                        rv = (*i);
 
@@ -3498,9 +3432,10 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
                                continue;
                        }
                        
+
                        if (regionview_x_movement) {
                                double ownspeed = 1.0;
-                               AudioTimeAxisView* atv = dynamic_cast<AudioTimeAxisView*> (&(rv->get_time_axis_view()));
+                               atv = dynamic_cast<AudioTimeAxisView*> (&(rv->get_time_axis_view()));
 
                                if (atv && atv->get_diskstream()) {
                                        ownspeed = atv->get_diskstream()->speed();
@@ -3519,23 +3454,62 @@ Editor::region_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
                                where = rv->region()->position();
                        }
 
-                       rv->get_time_axis_view().reveal_dependent_views (*rv);
+                       boost::shared_ptr<Playlist> to_playlist = rv->region()->playlist();
+
+                       /* add the undo */
+
+                       session->add_command (new MementoCommand<Playlist>(*to_playlist, &to_playlist->get_state(), 0));        
+
+                       if (drag_info.copy) {
+
+                               boost::shared_ptr<Region> newregion;
+                               boost::shared_ptr<Region> ar;
+
+                               if ((ar = boost::dynamic_pointer_cast<AudioRegion>(rv->region())) != 0) {
+                                       newregion = RegionFactory::create (ar);
+                               } else {
+                                       /* XXX MIDI HERE drobilla */
+                                       continue;
+                               }
+
+                               /* add it */
+                               
+                               latest_regionview = 0;
+                               sigc::connection c = atv->view()->RegionViewAdded.connect (mem_fun(*this, &Editor::collect_new_region_view));
+                               to_playlist->add_region (newregion, (nframes_t) (where * atv->get_diskstream()->speed()));
+                               c.disconnect ();
+                               
+                               if (latest_regionview) {
+                                       atv->reveal_dependent_views (*latest_regionview);
+                                       selection->add (latest_regionview);
+                               }
+                               
+                               /* if the original region was locked, we don't care for the new one */
+                               
+                               newregion->set_locked (false);                  
+
+                       } else {
+
+                               /* just change the model */
+
+                               rv->region()->set_position (where, (void*) this);
+
+                       }
+
+                       /* add the redo */
 
-                       /* no need to add an undo here, we did that when we added this playlist to motion_frozen playlists */
-                       
-                       rv->region()->set_position (where, (void *) this);
-                       rv->fake_set_opaque (true);
+                       session->add_command (new MementoCommand<Playlist>(*to_playlist, 0, &to_playlist->get_state()));
+
+                       /* get rid of the copy */
+
+                       if (drag_info.copy) {
+                               delete rv;
+                       }
                }
        }
 
   out:
-       for (set<boost::shared_ptr<Playlist> >::iterator p = motion_frozen_playlists.begin(); p != motion_frozen_playlists.end(); ++p) {
-               (*p)->thaw ();
-               session->add_command (new MementoCommand<Playlist>(*((*p).get()), 0, & (*p)->get_state()));
-       }
-
-       motion_frozen_playlists.clear ();
-
+       
        if (!nocommit) {
                commit_reversible_command ();
        }
@@ -4010,8 +3984,6 @@ Editor::start_trim (ArdourCanvas::Item* item, GdkEvent* event)
        nframes_t region_end = (nframes_t) (clicked_regionview->region()->last_frame() / speed);
        nframes_t region_length = (nframes_t) (clicked_regionview->region()->length() / speed);
 
-       motion_frozen_playlists.clear();
-       
        //drag_info.item = clicked_regionview->get_name_highlight();
        drag_info.item = item;
        drag_info.motion_callback = &Editor::trim_motion_callback;
index 538f0ed74c198a069ac26bf23857c9552ab1ca63..8902391b0b1f2b0b5c210520b23e53ee69ebd72d 100644 (file)
@@ -106,7 +106,6 @@ ExportDialog::ExportDialog(PublicEditor& e)
          src_quality_label (_("Conversion Quality"), 1.0, 0.5),
          dither_type_label (_("Dither Type"), 1.0, 0.5),
          cuefile_only_checkbox (_("Export CD Marker File Only")),
-         file_frame (_("Export to File")),
          file_browse_button (_("Browse")),
          track_selector_button (_("Specific tracks ..."))
 {
@@ -1305,7 +1304,7 @@ ExportDialog::window_closed (GdkEventAny *ignored)
 void
 ExportDialog::browse ()
 {
-       FileChooserDialog dialog("Export to file", FILE_CHOOSER_ACTION_SAVE);
+       FileChooserDialog dialog("Export to file", browse_action());
        dialog.set_transient_for(*this);
        dialog.set_filename (file_entry.get_text());
 
index 632d855163893645b64df865cf3739be93c2ac98..2831384cd3680fd05de3bc179dcc3f2f75a9796d 100644 (file)
@@ -29,6 +29,7 @@
 #include <gtkmm/progressbar.h>
 #include <gtkmm/scrolledwindow.h>
 #include <gtkmm/fileselection.h>
+#include <gtkmm/filechooser.h>
 #include <gtkmm/comboboxtext.h>
 #include <gtkmm/treeview.h>
 #include <gtkmm/liststore.h>
@@ -56,8 +57,11 @@ class ExportDialog : public ArdourDialog
        virtual void set_range (nframes_t start, nframes_t end);
        void start_export ();
 
+       virtual Gtk::FileChooserAction browse_action() const { return Gtk::FILE_CHOOSER_ACTION_SAVE; }
+
   protected:
        ARDOUR::AudioExportSpecification spec;
+       Gtk::Frame  file_frame;
 
     struct ExportModelColumns : public Gtk::TreeModel::ColumnRecord
        {
@@ -140,7 +144,6 @@ class ExportDialog : public ArdourDialog
 
        Gtk::CheckButton cuefile_only_checkbox;
 
-       Gtk::Frame  file_frame;
        Gtk::Entry  file_entry;
        Gtk::HBox   file_hbox;
        Gtk::Button file_browse_button;
index 2a1e2a9af4e7d99441332bac6196b9b451d8aa84..b6bd25a60d2993152041964e0a1137dcba1a43b4 100644 (file)
@@ -38,12 +38,20 @@ using namespace std;
 ExportRangeMarkersDialog::ExportRangeMarkersDialog (PublicEditor& editor) 
        : ExportDialog(editor)
 { 
+       set_title (_("ardour: export ranges"));
+       file_frame.set_label (_("Export to Directory"));
+
        do_not_allow_export_cd_markers();
        
        total_duration = 0;
        current_range_marker_index = 0;
 }
-       
+
+Gtk::FileChooserAction
+ExportRangeMarkersDialog::browse_action () const
+{
+       return Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER;
+}
        
 void 
 ExportRangeMarkersDialog::export_audio_data ()
index 1087f4c4c69073956e3f12aafc91818505d33882..7d231c62d5f84bd39d749e057404541f5f2e3f98 100644 (file)
@@ -30,6 +30,8 @@ class ExportRangeMarkersDialog : public ExportDialog
   public:
        ExportRangeMarkersDialog (PublicEditor&);
   
+       Gtk::FileChooserAction browse_action() const;
+
   protected:
        virtual bool is_filepath_valid(string &filepath);
 
index 30ff05dc5ccfc0897e4fd3364009aa6c2432e0b5..cb3804c11b224f3694c4d6264cd3a22f3ada6b11 100644 (file)
@@ -31,6 +31,9 @@
 ExportRegionDialog::ExportRegionDialog (PublicEditor& editor, boost::shared_ptr<ARDOUR::Region> region) 
        : ExportDialog(editor)
 {
+       set_title (_("ardour: export region"));
+       file_frame.set_label (_("Export to File")),
+
        audio_region = boost::dynamic_pointer_cast<ARDOUR::AudioRegion>(region);
        assert(audio_region);
 
index 7cd7fdc06f64bdca7e72215130c3efdf87110413..006f9675b3c8640787873920cda5fd32d0fce555 100644 (file)
 #include "ardour_ui.h"
 #include "export_session_dialog.h"
 
+#include "i18n.h"
 
 ExportSessionDialog::ExportSessionDialog (PublicEditor& editor) 
        : ExportDialog(editor)
 {
+       file_frame.set_label (_("Export to File"));
 }
        
-       
 void 
 ExportSessionDialog::export_audio_data ()
 {
index 39d753bf616b4afcd930758037adaf0f9d766a71..192d4d13018c09aedc024676f77f5c3c3133ab1d 100644 (file)
@@ -1017,7 +1017,7 @@ Mixer_UI::strip_scroller_button_release (GdkEventButton* ev)
        using namespace Menu_Helpers;
 
        if (Keyboard::is_context_menu_event (ev)) {
-               ARDOUR_UI::instance()->add_route();
+               ARDOUR_UI::instance()->add_route (this);
                return true;
        }
 
index 5e3a6126546f1afca788dd7c51499700b29fb6b8..3e6921aab9efe87da53bd891cad9586dbb5f21f3 100644 (file)
@@ -67,7 +67,6 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
                                                          TimeAxisViewItem::ShowFrame))
          , _region (r)
          , sync_mark(0)
-         , no_wave_msg(0)
          , editor(0)
          , current_visible_sync_position(0.0)
          , valid(false)
@@ -78,6 +77,19 @@ RegionView::RegionView (ArdourCanvas::Group* parent,
 {
 }
 
+RegionView::RegionView (const RegionView& other)
+       : TimeAxisViewItem (other)
+{
+       /* derived concrete type will call init () */
+
+       _region = other._region;
+       editor = other.editor;
+       current_visible_sync_position = other.current_visible_sync_position;
+       valid = false;
+       _pixel_width = other._pixel_width;
+       _height = other._height;
+}
+
 RegionView::RegionView (ArdourCanvas::Group*         parent, 
                         TimeAxisView&                tv,
                         boost::shared_ptr<ARDOUR::Region> r,
@@ -87,7 +99,6 @@ RegionView::RegionView (ArdourCanvas::Group*         parent,
        : TimeAxisViewItem (r->name(), *parent, tv, spu, basic_color, r->position(), r->length(), visibility)
        , _region (r)
        , sync_mark(0)
-       , no_wave_msg(0)
        , editor(0)
        , current_visible_sync_position(0.0)
        , valid(false)
@@ -101,7 +112,6 @@ RegionView::RegionView (ArdourCanvas::Group*         parent,
 void
 RegionView::init (Gdk::Color& basic_color, bool wfd)
 {
-       editor        = 0;
        valid         = true;
        in_destructor = false;
        _height       = 0;
index b89011e38d67f0992edff8466e4aa44d3c6965b3..64ab256f89bd531b53424122d229fa6b83a01921 100644 (file)
@@ -47,6 +47,8 @@ class RegionView : public TimeAxisViewItem
                    double               samples_per_unit,
                    Gdk::Color&          basic_color);
 
+       RegionView (const RegionView& other);
+
        ~RegionView ();
        
        virtual void init (Gdk::Color& base_color, bool wait_for_data);
@@ -90,7 +92,7 @@ class RegionView : public TimeAxisViewItem
 
     /** Allows derived types to specify their visibility requirements
      * to the TimeAxisViewItem parent class
-        */
+     */
     RegionView (ArdourCanvas::Group *, 
                TimeAxisView&,
                boost::shared_ptr<ARDOUR::Region>,
@@ -120,7 +122,6 @@ class RegionView : public TimeAxisViewItem
     boost::shared_ptr<ARDOUR::Region> _region;
     
     ArdourCanvas::Polygon* sync_mark; ///< polgyon for sync position 
-    ArdourCanvas::Text*    no_wave_msg;
 
     RegionEditor* editor;
 
index 93496920c11a03993517490d2c269a267c2c8669..895cb2a7856baa2542a02fc7e7b80ef60e4866f7 100644 (file)
@@ -507,7 +507,7 @@ RouteParams_UI::show_track_menu()
                track_menu->set_name ("ArdourContextMenu");
                track_menu->items().push_back 
                                (MenuElem (_("Add Track/Bus"), 
-                                          mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::add_route)));
+                                          bind (mem_fun (*(ARDOUR_UI::instance()), &ARDOUR_UI::add_route), (Gtk::Window*) 0)));
        }
        track_menu->popup (1, gtk_get_current_event_time());
 }
index 18ea3c255ebd601a713f47c0084a04d5a972e57a..87eac74ccfeb2a30ace0219e225bfa0e1a27f516 100644 (file)
@@ -95,6 +95,35 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
                have_name_font = true;
        }
 
+       group = new ArdourCanvas::Group (parent);
+       
+       init (it_name, spu, base_color, start, duration, vis);
+
+}
+
+TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
+       : trackview (other.trackview)
+{
+
+       Gdk::Color c;
+       int r,g,b,a;
+
+       UINT_TO_RGBA (other.fill_color, &r, &g, &b, &a);
+       c.set_rgb_p (r/255.0, g/255.0, b/255.0);
+
+       /* share the other's parent, but still create a new group */
+
+       Gnome::Canvas::Group* parent = other.group->property_parent();
+       
+       group = new ArdourCanvas::Group (*parent);
+
+       init (other.item_name, other.samples_per_unit, c, other.frame_position, other.item_duration, other.visibility);
+}
+
+
+void
+TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_color, nframes_t start, nframes_t duration, Visibility vis)
+{
        item_name = it_name ;
        samples_per_unit = spu ;
        should_show_selection = true;
@@ -112,8 +141,6 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
                warning << "Time Axis Item Duration == 0" << endl ;
        }
 
-       group = new ArdourCanvas::Group (parent);
-
        vestigial_frame = new ArdourCanvas::SimpleRect (*group);
        vestigial_frame->property_x1() = (double) 0.0;
        vestigial_frame->property_y1() = (double) 1.0;
@@ -220,7 +247,6 @@ TimeAxisViewItem::TimeAxisViewItem(const string & it_name, ArdourCanvas::Group&
        set_position (start, this) ;
 }
 
-
 /**
  * Destructor
  */
index bae0a27506ae7c27858b3b178142c4a6f20e4dcb..d41ad5a327894c187367bd4890f219d5a0cb0a60 100644 (file)
@@ -339,6 +339,10 @@ class TimeAxisViewItem : public Selectable
      */
     TimeAxisViewItem(const std::string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, Gdk::Color& base_color, 
                     nframes_t start, nframes_t duration, Visibility v = Visibility (0));
+
+    TimeAxisViewItem (const TimeAxisViewItem& other);
+
+    void init (const std::string& it_name, double spu, Gdk::Color& base_color, nframes_t start, nframes_t duration, Visibility vis);
     
     /**
      * Calculates some contrasting color for displaying various parts of this item, based upon the base color