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 __SYMBOL_H__
|
|
|
|
#define __SYMBOL_H__
|
|
|
|
|
|
|
|
#include "bsymbol.h"
|
|
|
|
|
|
|
|
class QPainter;
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
|
|
|
class Segment;
|
2013-11-25 15:02:23 +01:00
|
|
|
class ScoreFont;
|
2014-06-24 17:16:22 +02:00
|
|
|
enum class SymId;
|
2013-05-13 18:49:17 +02:00
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Symbol
|
2014-05-16 13:44:32 +02:00
|
|
|
/// Symbol constructed from builtin symbol.
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Symbol : public BSymbol {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
protected:
|
2012-09-08 11:33:46 +02:00
|
|
|
SymId _sym;
|
2013-11-25 15:02:23 +01:00
|
|
|
const ScoreFont* _scoreFont = nullptr;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Symbol(Score* s);
|
|
|
|
Symbol(const Symbol&);
|
|
|
|
|
|
|
|
Symbol &operator=(const Symbol&);
|
|
|
|
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual Symbol* clone() const { return new Symbol(*this); }
|
|
|
|
virtual Element::Type type() const { return Element::Type::SYMBOL; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-11-25 15:02:23 +01:00
|
|
|
void setSym(SymId s, const ScoreFont* sf = nullptr) { _sym = s; _scoreFont = sf; }
|
2014-06-24 18:36:02 +02:00
|
|
|
SymId sym() const { return _sym; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-11-25 15:02:23 +01:00
|
|
|
virtual void draw(QPainter*) const override;
|
|
|
|
virtual void write(Xml& xml) const override;
|
|
|
|
virtual void read(XmlReader&) override;
|
|
|
|
virtual void layout() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
void setAbove(bool);
|
|
|
|
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual qreal baseLine() const { return 0.0; }
|
|
|
|
Segment* segment() const { return (Segment*)parent(); }
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ FSymbol
|
2014-05-16 13:44:32 +02:00
|
|
|
/// Symbol constructed from a font glyph.
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-01-23 14:14:09 +01:00
|
|
|
class FSymbol : public BSymbol {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
QFont _font;
|
|
|
|
int _code;
|
|
|
|
|
|
|
|
public:
|
|
|
|
FSymbol(Score* s);
|
|
|
|
FSymbol(const FSymbol&);
|
|
|
|
|
|
|
|
virtual FSymbol* clone() const { return new FSymbol(*this); }
|
2014-06-24 18:36:02 +02:00
|
|
|
virtual Element::Type type() const { return Element::Type::FSYMBOL; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
virtual void draw(QPainter*) const;
|
|
|
|
virtual void write(Xml& xml) const;
|
2013-01-11 18:10:18 +01:00
|
|
|
virtual void read(XmlReader&);
|
2012-05-26 14:26:10 +02:00
|
|
|
virtual void layout();
|
|
|
|
|
|
|
|
virtual qreal baseLine() const { return 0.0; }
|
|
|
|
Segment* segment() const { return (Segment*)parent(); }
|
2012-12-10 17:44:57 +01:00
|
|
|
QFont font() const { return _font; }
|
|
|
|
int code() const { return _code; }
|
2012-05-26 14:26:10 +02:00
|
|
|
void setFont(const QFont& f);
|
2012-12-10 17:44:57 +01:00
|
|
|
void setCode(int val) { _code = val; }
|
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
|
|
|
|
|