RemoveStaff::RemoveStaff(const ScoreLocation &location) : QUndoCommand(QObject::tr("Remove Staff")), myLocation(location), myOriginalStaff(location.getStaff()), myIndex(location.getStaffIndex()) { }
RemoveAlternateEnding::RemoveAlternateEnding(const ScoreLocation &location) : QUndoCommand(QObject::tr("Remove Repeat Ending")), myLocation(location), myOriginalEnding(*ScoreUtils::findByPosition( location.getSystem().getAlternateEndings(), location.getPositionIndex())) { }
RemoveDynamic::RemoveDynamic(const ScoreLocation &location) : QUndoCommand(QObject::tr("Remove Dynamic")), myLocation(location), myOriginalDynamic(*ScoreUtils::findByPosition( location.getStaff().getDynamics(), location.getPositionIndex())) { setText(QObject::tr("Remove Dynamic")); }
void Caret::handleSelectionChanged(const ScoreLocation &location) { // Ignore mouse clicks while in playback mode. if (myInPlaybackMode) return; myLocation.setSystemIndex(location.getSystemIndex()); myLocation.setStaffIndex(location.getStaffIndex()); myLocation.setPositionIndex(location.getPositionIndex()); myLocation.setSelectionStart(location.getSelectionStart()); myLocation.setString(location.getString()); onLocationChanged(); }
EditKeySignature::EditKeySignature(const ScoreLocation &location, const KeySignature &newKey) : QUndoCommand(QObject::tr("Edit Key Signature")), myLocation(location), myNewKey(newKey), myOldKey(location.getBarline()->getKeySignature()) { }
MidiPlayer::MidiPlayer(SettingsManager &settings_manager, const ScoreLocation &start_location, int speed) : mySettingsManager(settings_manager), myScore(start_location.getScore()), myStartLocation(start_location), myIsPlaying(false), myPlaybackSpeed(speed) { }
AddMultiBarRest::AddMultiBarRest(const ScoreLocation &location, int count) : QUndoCommand(QObject::tr("Add Multi-Bar Rest")), myLocation(location) { myPosition.setPosition(location.getPositionIndex()); myPosition.setDurationType(Position::WholeNote); myPosition.setRest(true); myPosition.setMultiBarRest(count); }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/addalternateending.h> #include <score/score.h> TEST_CASE("Actions/AddAlternateEnding", "") { Score score; score.insertSystem(System()); AlternateEnding ending(6); ending.addNumber(3); ending.setDaCapo(true); ScoreLocation location(score, 0, 0, 6); AddAlternateEnding action(location, ending); action.redo(); REQUIRE(location.getSystem().getAlternateEndings().size() == 1); REQUIRE(location.getSystem().getAlternateEndings()[0] == ending); action.undo(); REQUIRE(location.getSystem().getAlternateEndings().size() == 0); }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/addtempomarker.h> #include <score/score.h> TEST_CASE("Actions/AddTempoMarker", "") { Score score; score.insertSystem(System()); TempoMarker marker(6); marker.setBeatsPerMinute(160); ScoreLocation location(score, 0, 0, 6); AddTempoMarker action(location, marker); action.redo(); REQUIRE(location.getSystem().getTempoMarkers().size() == 1); REQUIRE(location.getSystem().getTempoMarkers()[0] == marker); action.undo(); REQUIRE(location.getSystem().getTempoMarkers().size() == 0); }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/removestaff.h> #include <app/caret.h> #include <score/score.h> TEST_CASE("Actions/RemoveStaff", "") { Score score; System system; system.insertStaff(Staff(6)); system.insertStaff(Staff(7)); score.insertSystem(system); ScoreLocation location(score, 0, 1); RemoveStaff action(location); action.redo(); REQUIRE(location.getSystem().getStaves().size() == 1); action.undo(); REQUIRE(location.getSystem().getStaves().size() == 2); }
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/adddirection.h> #include <score/score.h> TEST_CASE("Actions/AddDirection", "") { Score score; score.insertSystem(System()); Direction direction(6); direction.insertSymbol(DirectionSymbol::Segno); ScoreLocation location(score, 0, 0, 6); AddDirection action(location, direction); action.redo(); REQUIRE(location.getSystem().getDirections().size() == 1); REQUIRE(location.getSystem().getDirections()[0] == direction); action.undo(); REQUIRE(location.getSystem().getDirections().size() == 0); }
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <catch.hpp> #include <actions/removetextitem.h> #include <score/score.h> TEST_CASE("Actions/RemoveTextItem", "") { Score score; System system; TextItem text(7, "foo"); system.insertTextItem(text); score.insertSystem(system); ScoreLocation location(score, 0, 0, 7); RemoveTextItem action(location); action.redo(); REQUIRE(location.getSystem().getTextItems().empty()); action.undo(); REQUIRE(location.getSystem().getTextItems().size() == 1); REQUIRE(location.getSystem().getTextItems().front() == text); }