1 /* 2 * Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org> 3 * 4 * This file is part of Zrythm 5 * 6 * Zrythm is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Zrythm is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 #include "audio/automation_region.h" 21 #include "audio/chord_track.h" 22 #include "audio/engine.h" 23 #include "audio/position.h" 24 #include "audio/track.h" 25 #include "audio/transport.h" 26 #include "gui/backend/event_manager.h" 27 #include "gui/backend/automation_selections.h" 28 #include "gui/widgets/midi_region.h" 29 #include "project.h" 30 #include "utils/arrays.h" 31 #include "utils/audio.h" 32 #include "utils/flags.h" 33 #include "utils/objects.h" 34 #include "utils/yaml.h" 35 36 #include <gtk/gtk.h> 37 38 /** 39 * Returns if the selections can be pasted. 40 * 41 * @param pos Position to paste to. 42 * @param region ZRegion to paste to. 43 */ 44 bool automation_selections_can_be_pasted(AutomationSelections * ts,Position * pos,ZRegion * r)45automation_selections_can_be_pasted ( 46 AutomationSelections * ts, 47 Position * pos, 48 ZRegion * r) 49 { 50 if (!r || r->id.type != REGION_TYPE_AUTOMATION) 51 return false; 52 53 ArrangerObject * r_obj = 54 (ArrangerObject *) r; 55 if (r_obj->pos.frames + pos->frames < 0) 56 return false; 57 58 return true; 59 } 60