MuseScore/libmscore/input.h

111 lines
3.6 KiB
C
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __INPUT_H__
#define __INPUT_H__
#include "mscore.h"
#include "durationtype.h"
2013-05-13 18:49:17 +02:00
namespace Ms {
2013-10-24 12:09:00 +02:00
class Element;
2012-05-26 14:26:10 +02:00
class Slur;
class ChordRest;
class Drumset;
class Segment;
2013-10-24 12:09:00 +02:00
class Score;
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
// InputState
//---------------------------------------------------------
class InputState {
2013-10-24 12:09:00 +02:00
Score* _score;
TDuration _duration = TDuration::DurationType::V_INVALID; // currently duration
2013-10-24 12:09:00 +02:00
int _drumNote = -1;
Drumset* _drumset = 0;
int _track = 0;
Segment* _lastSegment = 0;
Segment* _segment = 0; // current segment
int _string = VISUAL_STRING_NONE; // visual string selected for input (TAB staves only)
bool _repitchMode = false;
bool _rest = false; // rest mode
NoteType _noteType = NOTE_NORMAL;
BeamMode _beamMode = BeamMode::AUTO;
bool _noteEntryMode = false;
Slur* _slur = 0;
Segment* nextInputPos() const;
2012-05-26 14:26:10 +02:00
public:
2013-10-24 12:09:00 +02:00
InputState(Score* s) : _score(s) {}
2012-05-26 14:26:10 +02:00
ChordRest* cr() const;
int tick() const;
2013-10-24 12:09:00 +02:00
2012-05-26 14:26:10 +02:00
void setDuration(const TDuration& d) { _duration = d; }
TDuration duration() const { return _duration; }
void setDots(int n) { _duration.setDots(n); }
2013-10-24 12:09:00 +02:00
int ticks() const { return _duration.ticks(); }
2012-05-26 14:26:10 +02:00
Segment* segment() const { return _segment; }
2013-10-31 08:12:53 +01:00
void setSegment(Segment* s);
2012-05-26 14:26:10 +02:00
2013-10-24 12:09:00 +02:00
Segment* lastSegment() const { return _lastSegment; }
void setLastSegment(Segment* s) { _lastSegment = s; }
2012-05-26 14:26:10 +02:00
Drumset* drumset() const;
int drumNote() const { return _drumNote; }
void setDrumNote(int v) { _drumNote = v; }
int voice() const { return _track % VOICES; }
int track() const { return _track; }
2013-10-31 08:12:53 +01:00
void setTrack(int v) { _track = v; }
2012-05-26 14:26:10 +02:00
int string() const { return _string; }
void setString(int val) { _string = val; }
2012-05-26 14:26:10 +02:00
bool repitchMode() const { return _repitchMode; }
void setRepitchMode(bool val) { _repitchMode = val; }
StaffGroup staffGroup() const;
2013-10-24 12:09:00 +02:00
bool rest() const { return _rest; }
void setRest(bool v) { _rest = v; }
NoteType noteType() const { return _noteType; }
void setNoteType(NoteType t) { _noteType = t; }
BeamMode beamMode() const { return _beamMode; }
void setBeamMode(BeamMode m) { _beamMode = m; }
bool noteEntryMode() const { return _noteEntryMode; }
void setNoteEntryMode(bool v) { _noteEntryMode = v; }
Slur* slur() const { return _slur; }
void setSlur(Slur* s) { _slur = s; }
void update(Element* e);
void moveInputPos(Element* e);
void moveToNextInputPos();
bool endOfScore() const;
2012-05-26 14:26:10 +02:00
};
2013-05-13 18:49:17 +02:00
} // namespace Ms
2012-05-26 14:26:10 +02:00
#endif