remove unused MarkerDrag code that was #ifdef'd out, originally from Ardour
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 2 Nov 2014 13:47:04 +0000 (08:47 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 2 Nov 2014 13:47:04 +0000 (08:47 -0500)
gtk2_ardour/editor_drag.cc

index eb53ed36e444bbced2cf44251be2d36e1576356a..fe861ca2bcbc7c86fe65b759c295e7e30d8f79ea 100644 (file)
@@ -3475,390 +3475,6 @@ MarkerDrag::aborted (bool)
        /* XXX: TODO */
 }
 
-#if 0
-
-MarkerDrag::MarkerDrag (Editor* e, ArdourCanvas::Item* i)
-       : Drag (e, i)
-{
-       DEBUG_TRACE (DEBUG::Drags, "New MarkerDrag\n");
-
-       _marker = reinterpret_cast<Marker*> (_item->get_data ("marker"));
-       assert (_marker);
-
-       _points.push_back (ArdourCanvas::Duple (0, 0));
-       _points.push_back (ArdourCanvas::Duple (0, physical_screen_height (_editor->get_window())));
-}
-
-MarkerDrag::~MarkerDrag ()
-{
-       for (CopiedLocationInfo::iterator i = _copied_locations.begin(); i != _copied_locations.end(); ++i) {
-               delete i->location;
-       }
-}
-
-MarkerDrag::CopiedLocationMarkerInfo::CopiedLocationMarkerInfo (Location* l, Marker* m)
-{
-       location = new Location (*l);
-       markers.push_back (m);
-       move_both = false;
-}
-
-void
-MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
-{
-       Drag::start_grab (event, cursor);
-
-       bool is_start;
-
-       Location *location = _editor->find_location_from_marker (_marker, is_start);
-       _editor->_dragging_edit_point = true;
-
-       update_item (location);
-
-       // _drag_line->show();
-       // _line->raise_to_top();
-
-       if (is_start) {
-               show_verbose_cursor_time (location->start());
-       } else {
-               show_verbose_cursor_time (location->end());
-       }
-
-       Selection::Operation op = ArdourKeyboard::selection_type (event->button.state);
-
-       switch (op) {
-       case Selection::Toggle:
-               /* we toggle on the button release */
-               break;
-       case Selection::Set:
-               if (!_editor->selection->selected (_marker)) {
-                       _editor->selection->set (_marker);
-               }
-               break;
-       case Selection::Extend:
-       {
-               Locations::LocationList ll;
-               list<Marker*> to_add;
-               framepos_t s, e;
-               _editor->selection->markers.range (s, e);
-               s = min (_marker->position(), s);
-               e = max (_marker->position(), e);
-               s = min (s, e);
-               e = max (s, e);
-               if (e < max_framepos) {
-                       ++e;
-               }
-               _editor->session()->locations()->find_all_between (s, e, ll, Location::Flags (0));
-               for (Locations::LocationList::iterator i = ll.begin(); i != ll.end(); ++i) {
-                       Editor::LocationMarkers* lm = _editor->find_location_markers (*i);
-                       if (lm) {
-                               if (lm->start) {
-                                       to_add.push_back (lm->start);
-                               }
-                               if (lm->end) {
-                                       to_add.push_back (lm->end);
-                               }
-                       }
-               }
-               if (!to_add.empty()) {
-                       _editor->selection->add (to_add);
-               }
-               break;
-       }
-       case Selection::Add:
-               _editor->selection->add (_marker);
-               break;
-       }
-
-       /* Set up copies for us to manipulate during the drag 
-        */
-
-       for (MarkerSelection::iterator i = _editor->selection->markers.begin(); i != _editor->selection->markers.end(); ++i) {
-
-               Location* l = _editor->find_location_from_marker (*i, is_start);
-
-               if (!l) {
-                       continue;
-               }
-
-               if (l->is_mark()) {
-                       _copied_locations.push_back (CopiedLocationMarkerInfo (l, *i));
-               } else {
-                       /* range: check that the other end of the range isn't
-                          already there.
-                       */
-                       CopiedLocationInfo::iterator x;
-                       for (x = _copied_locations.begin(); x != _copied_locations.end(); ++x) {
-                               if (*(*x).location == *l) {
-                                       break;
-                               }
-                       }
-                       if (x == _copied_locations.end()) {
-                               _copied_locations.push_back (CopiedLocationMarkerInfo (l, *i));
-                       } else {
-                               (*x).markers.push_back (*i);
-                               (*x).move_both = true;
-                       }
-               }
-                       
-       }
-}
-
-void
-MarkerDrag::setup_pointer_frame_offset ()
-{
-       bool is_start;
-       Location *location = _editor->find_location_from_marker (_marker, is_start);
-       _pointer_frame_offset = raw_grab_frame() - (is_start ? location->start() : location->end());
-}
-
-void
-MarkerDrag::motion (GdkEvent* event, bool)
-{
-       framecnt_t f_delta = 0;
-       bool is_start;
-       bool move_both = false;
-       Location *real_location;
-       Location *copy_location = 0;
-
-       framepos_t const newframe = adjusted_current_frame (event);
-       framepos_t next = newframe;
-
-       if (Keyboard::modifier_state_equals (event->button.state, Keyboard::PrimaryModifier)) {
-               move_both = true;
-       }
-
-       CopiedLocationInfo::iterator x;
-
-       /* find the marker we're dragging, and compute the delta */
-
-       for (x = _copied_locations.begin(); x != _copied_locations.end(); ++x) {
-
-               copy_location = (*x).location;
-
-               if (find (x->markers.begin(), x->markers.end(), _marker) != x->markers.end()) {
-
-                       /* this marker is represented by this
-                        * CopiedLocationMarkerInfo 
-                        */
-
-                       if ((real_location = _editor->find_location_from_marker (_marker, is_start)) == 0) {
-                               /* que pasa ?? */
-                               return;
-                       }
-
-                        if (real_location->is_skip() || 
-                            real_location->is_auto_loop()) {
-                                move_both = true;
-                        }
-
-                       if (real_location->is_mark()) {
-                               f_delta = newframe - copy_location->start();
-                       } else {
-
-
-                               switch (_marker->type()) {
-                               case Marker::SessionStart:
-                               case Marker::RangeStart:
-                               case Marker::LoopStart:
-                               case Marker::PunchIn:
-                                case Marker::Range:
-                                       f_delta = newframe - copy_location->start();
-                                       break;
-
-                               case Marker::SessionEnd:
-                               case Marker::RangeEnd:
-                               case Marker::LoopEnd:
-                               case Marker::PunchOut:
-                                       f_delta = newframe - copy_location->end();
-                                       break;
-                               default:
-                                       /* what kind of marker is this ? */
-                                       return;
-                               }
-                       }
-
-                       break;
-               }
-       }
-
-       if (x == _copied_locations.end()) {
-               /* hmm, impossible - we didn't find the dragged marker */
-               return;
-       }
-
-       /* now move them all */
-        
-       for (x = _copied_locations.begin(); x != _copied_locations.end(); ++x) {
-
-               copy_location = x->location;
-
-               /* call this to find out if its the start or end */
-
-               if ((real_location = _editor->find_location_from_marker (x->markers.front(), is_start)) == 0) {
-                       continue;
-               }
-
-               if (real_location->locked()) {
-                       continue;
-               }
-
-               if (copy_location->is_mark()) {
-
-                       /* now move it */
-
-                       copy_location->set_start (copy_location->start() + f_delta);
-
-               } else {
-                       
-                       framepos_t new_start = copy_location->start() + f_delta;
-                       framepos_t new_end = copy_location->end() + f_delta;
-                       
-                       if (is_start) { // start-of-range marker
-
-                               if (move_both || (*x).move_both) {
-                                       copy_location->set_start (new_start);
-                                       copy_location->set_end (new_end);
-                               } else  if (new_start < copy_location->end()) {
-                                       copy_location->set_start (new_start);
-                               } else if (newframe > 0) {
-                                       _editor->snap_to (next, 1, true);
-                                       copy_location->set_end (next);
-                                       copy_location->set_start (newframe);
-                               }
-
-                       } else { // end marker
-
-                               if (move_both || (*x).move_both) {
-                                       copy_location->set_end (new_end);
-                                       copy_location->set_start (new_start);
-                               } else if (new_end > copy_location->start()) {
-                                       copy_location->set_end (new_end);
-                               } else if (newframe > 0) {
-                                       _editor->snap_to (next, -1, true);
-                                       copy_location->set_start (next);
-                                       copy_location->set_end (newframe);
-                               }
-                       }
-               }
-
-               update_item (copy_location);
-               
-               /* now lookup the actual GUI items used to display this
-                * location and move them to wherever the copy of the location
-                * is now. This means that the logic in ARDOUR::Location is
-                * still enforced, even though we are not (yet) modifying 
-                * the real Location itself.
-                */
-               
-               Editor::LocationMarkers* lm = _editor->find_location_markers (real_location);
-
-               if (lm) {
-                       lm->set_position (copy_location->start(), copy_location->end());
-               }
-
-       }
-
-       assert (!_copied_locations.empty());
-
-       show_verbose_cursor_time (newframe);
-}
-
-void
-MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
-{
-       if (!movement_occurred) {
-                
-               if (was_double_click()) {
-                       _editor->rename_marker (_marker);
-                       return;
-               }
-
-               /* just a single click */
-
-                Location* loc = _marker->location ();
-                if (loc) {
-                        if (loc->is_skip()) {
-                                /* skip range - click toggles active skip status */
-                                loc->set_skipping (!loc->is_skipping());
-                                return;
-                        }
-                }
-
-                /* other markers: do nothing but finish
-                  off the selection process
-               */
-
-               Selection::Operation op = ArdourKeyboard::selection_type (event->button.state);
-
-               switch (op) {
-               case Selection::Set:
-                       if (_editor->selection->selected (_marker) && _editor->selection->markers.size() > 1) {
-                               _editor->selection->set (_marker);
-                       }
-                       break;
-
-               case Selection::Toggle:
-                       /* we toggle on the button release, click only */
-                       _editor->selection->toggle (_marker);
-                       break;
-
-               case Selection::Extend:
-               case Selection::Add:
-                       break;
-               }
-
-               return;
-       }
-
-       _editor->_dragging_edit_point = false;
-
-       _editor->begin_reversible_command ( _("move marker") );
-       XMLNode &before = _editor->session()->locations()->get_state();
-
-       MarkerSelection::iterator i;
-       CopiedLocationInfo::iterator x;
-       bool is_start;
-
-       for (i = _editor->selection->markers.begin(), x = _copied_locations.begin();
-            x != _copied_locations.end() && i != _editor->selection->markers.end();
-            ++i, ++x) {
-
-               Location * location = _editor->find_location_from_marker (*i, is_start);
-
-               if (location) {
-
-                       if (location->locked()) {
-                               return;
-                       }
-
-                       if (location->is_mark()) {
-                               location->set_start (((*x).location)->start());
-                       } else {
-                               location->set (((*x).location)->start(), ((*x).location)->end());
-                       }
-               }
-       }
-
-       XMLNode &after = _editor->session()->locations()->get_state();
-       _editor->session()->add_command(new MementoCommand<Locations>(*(_editor->session()->locations()), &before, &after));
-       _editor->commit_reversible_command ();
-}
-
-void
-MarkerDrag::aborted (bool)
-{
-       /* XXX: TODO */
-}
-
-void
-MarkerDrag::update_item (Location*)
-{
-        /* noop */
-}
-
-#endif
-
 ControlPointDrag::ControlPointDrag (Editor* e, ArdourCanvas::Item* i)
        : Drag (e, i),
          _cumulative_x_drag (0),