1 2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 3 4 /* 5 Rosegarden 6 A MIDI and audio sequencer and musical notation editor. 7 Copyright 2000-2021 the Rosegarden development team. 8 9 Other copyrights also apply to some parts of this work. Please 10 see the AUTHORS file and individual file headers for details. 11 12 This program is free software; you can redistribute it and/or 13 modify it under the terms of the GNU General Public License as 14 published by the Free Software Foundation; either version 2 of the 15 License, or (at your option) any later version. See the file 16 COPYING included with this distribution for more information. 17 */ 18 19 #ifndef RG_RESCALECOMMAND_H 20 #define RG_RESCALECOMMAND_H 21 22 #include "document/BasicCommand.h" 23 #include <QString> 24 #include "base/Event.h" 25 #include <QCoreApplication> 26 27 28 29 30 namespace Rosegarden 31 { 32 33 class EventSelection; 34 35 36 class RescaleCommand : public BasicCommand 37 { 38 Q_DECLARE_TR_FUNCTIONS(Rosegarden::RescaleCommand) 39 40 public: 41 RescaleCommand(EventSelection &selection, getNumberOfLinkedSegments()42 timeT newDuration, 43 bool closeGap); 44 45 static QString getGlobalName() { return tr("Stretch or S&quash..."); } 46 47 protected: getSegmentLinkerId()48 void modifySegment() override; 49 50 private: 51 timeT rescale(timeT); 52 timeT getAffectedEndTime(EventSelection &selection, 53 timeT newDuration, 54 bool closeGap); 55 56 EventSelection *m_selection;// only used on 1st execute (cf bruteForceRedo) setReference(Segment * s)57 timeT m_oldDuration; 58 timeT m_newDuration; 59 bool m_closeGap; 60 }; 61 62 getReference()63 64 } 65 66 #endif 67