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 __BOX_H__
|
|
|
|
#define __BOX_H__
|
|
|
|
|
|
|
|
/**
|
|
|
|
\file
|
|
|
|
Definition of HBox and VBox classes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "measurebase.h"
|
2013-05-13 18:49:17 +02:00
|
|
|
class QPainter;
|
|
|
|
|
|
|
|
namespace Ms {
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
class MuseScoreView;
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ Box
|
2012-08-06 08:45:08 +02:00
|
|
|
/// virtual base class for frames "boxes"
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class Box : public MeasureBase {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2016-09-27 13:38:28 +02:00
|
|
|
Spatium _boxWidth { Spatium(0) }; // only valid for HBox
|
|
|
|
Spatium _boxHeight { Spatium(0) }; // only valid for VBox
|
|
|
|
qreal _topGap { 0.0 }; // distance from previous system (left border for hbox)
|
|
|
|
// initialized with StyleIdx::systemFrameDistance
|
|
|
|
qreal _bottomGap { 0.0 }; // distance to next system (right border for hbox)
|
|
|
|
// initialized with StyleIdx::frameSystemDistance
|
|
|
|
qreal _leftMargin { 0.0 };
|
|
|
|
qreal _rightMargin { 0.0 }; // inner margins in metric mm
|
|
|
|
qreal _topMargin { 0.0 };
|
|
|
|
qreal _bottomMargin { 0.0 };
|
|
|
|
bool editMode { false };
|
|
|
|
PropertyStyle topGapStyle { PropertyStyle::STYLED };
|
|
|
|
PropertyStyle bottomGapStyle { PropertyStyle::STYLED };
|
2016-01-04 14:48:58 +01:00
|
|
|
qreal dragX; // used during drag of hbox
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
Box(Score*);
|
2013-09-19 15:08:54 +02:00
|
|
|
virtual void draw(QPainter*) const override;
|
|
|
|
virtual bool isEditable() const override { return true; }
|
|
|
|
virtual void startEdit(MuseScoreView*, const QPointF&) override;
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual bool edit(MuseScoreView*, Grip grip, int key, Qt::KeyboardModifiers, const QString& s) override;
|
2013-09-19 15:08:54 +02:00
|
|
|
virtual void editDrag(const EditData&) override;
|
|
|
|
virtual void endEdit() override;
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void updateGrips(Grip*, QVector<QRectF>&) const override;
|
|
|
|
virtual int grips() const override { return 1; }
|
2013-09-19 15:08:54 +02:00
|
|
|
virtual void layout() override;
|
|
|
|
virtual void write(Xml&) const override;
|
|
|
|
virtual void write(Xml& xml, int, bool) const override { write(xml); }
|
2014-10-16 11:56:06 +02:00
|
|
|
virtual void writeProperties(Xml&) const override;
|
|
|
|
virtual bool readProperties(XmlReader&) override;
|
2013-09-19 15:08:54 +02:00
|
|
|
virtual void read(XmlReader&) override;
|
2014-08-13 21:01:21 +02:00
|
|
|
virtual bool acceptDrop(const DropData&) const override;
|
2013-09-19 15:08:54 +02:00
|
|
|
virtual Element* drop(const DropData&) override;
|
|
|
|
virtual void add(Element* e) override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
|
|
|
Spatium boxWidth() const { return _boxWidth; }
|
|
|
|
void setBoxWidth(Spatium val) { _boxWidth = val; }
|
|
|
|
Spatium boxHeight() const { return _boxHeight; }
|
|
|
|
void setBoxHeight(Spatium val) { _boxHeight = val; }
|
|
|
|
qreal leftMargin() const { return _leftMargin; }
|
|
|
|
qreal rightMargin() const { return _rightMargin; }
|
|
|
|
qreal topMargin() const { return _topMargin; }
|
|
|
|
qreal bottomMargin() const { return _bottomMargin; }
|
|
|
|
void setLeftMargin(qreal val) { _leftMargin = val; }
|
|
|
|
void setRightMargin(qreal val) { _rightMargin = val; }
|
|
|
|
void setTopMargin(qreal val) { _topMargin = val; }
|
|
|
|
void setBottomMargin(qreal val) { _bottomMargin = val; }
|
|
|
|
qreal topGap() const { return _topGap; }
|
|
|
|
void setTopGap(qreal val) { _topGap = val; }
|
|
|
|
qreal bottomGap() const { return _bottomGap; }
|
|
|
|
void setBottomGap(qreal val) { _bottomGap = val; }
|
2014-08-27 13:10:20 +02:00
|
|
|
void copyValues(Box* origin);
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-09-19 15:08:54 +02:00
|
|
|
virtual QVariant getProperty(P_ID propertyId) const override;
|
|
|
|
virtual bool setProperty(P_ID propertyId, const QVariant&) override;
|
|
|
|
virtual QVariant propertyDefault(P_ID) const override;
|
2016-09-27 13:38:28 +02:00
|
|
|
virtual PropertyStyle propertyStyle(P_ID id) const override;
|
|
|
|
virtual void resetProperty(P_ID id) override;
|
|
|
|
virtual void styleChanged() override;
|
|
|
|
virtual StyleIdx getPropertyStyle(P_ID id) const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ HBox
|
2014-05-16 13:44:32 +02:00
|
|
|
/// horizontal frame
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class HBox : public Box {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
HBox(Score* score);
|
2016-03-30 22:33:04 +02:00
|
|
|
virtual ~HBox() {}
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual HBox* clone() const override { return new HBox(*this); }
|
|
|
|
virtual Element::Type type() const override { return Element::Type::HBOX; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void layout() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2013-10-22 12:05:31 +02:00
|
|
|
virtual QRectF drag(EditData*) override;
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void endEditDrag() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
void layout2();
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual bool isMovable() const override;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ VBox
|
2014-05-16 13:44:32 +02:00
|
|
|
/// vertical frame
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class VBox : public Box {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
VBox(Score* score);
|
2016-03-30 22:33:04 +02:00
|
|
|
virtual ~VBox() {}
|
2016-05-18 15:43:47 +02:00
|
|
|
virtual VBox* clone() const override { return new VBox(*this); }
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual Element::Type type() const override { return Element::Type::VBOX; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void layout() override;
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual QPointF getGrip(Grip) const override;
|
|
|
|
virtual void setGrip(Grip, const QPointF&) override;
|
2012-05-26 14:26:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
2012-07-25 11:49:34 +02:00
|
|
|
// @@ FBox
|
|
|
|
/// frame containing fret diagrams
|
2012-05-26 14:26:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class FBox : public VBox {
|
2012-05-28 11:29:21 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2012-05-26 14:26:10 +02:00
|
|
|
public:
|
|
|
|
FBox(Score* score) : VBox(score) {}
|
2016-03-30 22:33:04 +02:00
|
|
|
virtual ~FBox() {}
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual FBox* clone() const override { return new FBox(*this); }
|
|
|
|
virtual Element::Type type() const override { return Element::Type::FBOX; }
|
2012-05-26 14:26:10 +02:00
|
|
|
|
2015-01-19 12:37:17 +01:00
|
|
|
virtual void layout() override;
|
2015-02-23 10:10:18 +01:00
|
|
|
virtual void add(Element*) override;
|
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
|
|
|
|
|