Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c20bda5856
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 149 lines (122 sloc) 5.081 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id: box.h 5500 2012-03-28 16:28:26Z wschweer $
//
// 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"

class BarLine;
class MuseScoreView;
class Text;
class QPainter;

//---------------------------------------------------------
// @@ Box
/// virtual base class for frames "boxes"
//---------------------------------------------------------

class Box : public MeasureBase {
      Q_OBJECT

      Spatium _boxWidth; // only valid for HBox
      Spatium _boxHeight; // only valid for VBox
      qreal _topGap; // distance from previous system (left border for hbox)
                           // initialized with ST_systemFrameDistance
      qreal _bottomGap; // distance to next system (right border for hbox)
                           // initialized with ST_frameSystemDistance
      qreal _leftMargin, _rightMargin; // inner margins in metric mm
      qreal _topMargin, _bottomMargin;
      bool editMode;
      qreal dragX; // used during drag of hbox

   public:
      Box(Score*);
      virtual void draw(QPainter*) const;
      virtual bool isEditable() const { return true; }
      virtual void startEdit(MuseScoreView*, const QPointF&);
      virtual bool edit(MuseScoreView*, int grip, int key, Qt::KeyboardModifiers, const QString& s);
      virtual void editDrag(const EditData&);
      virtual void endEdit();
      virtual void updateGrips(int* grips, QRectF*) const;
      virtual void layout();
      virtual void write(Xml&) const;
      virtual void write(Xml& xml, int, bool) const { write(xml); }
      virtual void read(const QDomElement&);
      virtual bool acceptDrop(MuseScoreView*, const QPointF&, Element*) const;
      virtual Element* drop(const DropData&);
      virtual void add(Element* e);

      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; }

      virtual QVariant getProperty(P_ID propertyId) const;
      virtual bool setProperty(P_ID propertyId, const QVariant&);
      virtual QVariant propertyDefault(P_ID) const;
      };

//---------------------------------------------------------
// @@ HBox
/// horizontal frame
//---------------------------------------------------------

class HBox : public Box {
      Q_OBJECT

   public:
      HBox(Score* score);
      ~HBox() {}
      virtual HBox* clone() const { return new HBox(*this); }
      virtual ElementType type() const { return HBOX; }

      virtual void layout();

      virtual QRectF drag(const EditData& s);
      virtual void endEditDrag();
      void layout2();
      virtual bool isMovable() const;
      };

//---------------------------------------------------------
// @@ VBox
/// vertical frame
//---------------------------------------------------------

class VBox : public Box {
      Q_OBJECT

   public:
      VBox(Score* score);
      ~VBox() {}
      virtual VBox* clone() const { return new VBox(*this); }
      virtual ElementType type() const { return VBOX; }

      virtual void layout();

      virtual QPointF getGrip(int) const;
      virtual void setGrip(int, const QPointF&);
      };

//---------------------------------------------------------
// @@ FBox
/// frame containing fret diagrams
//---------------------------------------------------------

class FBox : public VBox {
      Q_OBJECT

   public:
      FBox(Score* score) : VBox(score) {}
      ~FBox() {}
      virtual FBox* clone() const { return new FBox(*this); }
      virtual ElementType type() const { return FBOX; }

      virtual void layout();
      void add(Element*);
      };

#endif

Something went wrong with that request. Please try again.