MuseScore/mscore/inspector/inspector.h
Maurizio M. Gavioli d24c1fecf0 Fix clef change and courtesy clef display.
Clef changes and courtesy clef on/off display have several issues: changed clef is not always shown, courtesy clefs on/off is unreliable and so on.

In this fix:

- A clef change at measure boundary is always placed at the end of the previous measure (unless for the very first measure).
- This measure-final clef is never destroyed or re-created (the clef at the beginning of the next staff is managed by Score::layoutSystemRow() as before): this ensures a consistent context.
- Showing / hiding of a courtesy clef is managed by Clef::layout() rather than by Score::layoutSystemRow() as before.
- The clef change on measure boundary (always at the end of the previous measure and always present) is shown if:
-- there is not another clef at the beginning of the next measure (not a courtesy clef at all);
-- the score is set to show courtesy clefs
-- the previous measure is not the last of a repeat or of a section
-- the individual clef is set to show courtesy clef.
- In all other cases, the clef is hidden (i.e. laid out to a element without any symbol).
- The Clef Inspector is changed so that, if there is a pair of matching courtesy and main clef, their Show Courtesy flags are kept in sync (modifying either modifies both)
2013-12-24 20:17:57 +01:00

311 lines
7.8 KiB
C++

//=============================================================================
// MuseScore
// Music Composition & Notation
// $Id:$
//
// Copyright (C) 2011 Werner Schweer and others
//
// 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 LICENSE.GPL
//=============================================================================
#ifndef __INSPECTOR_H__
#define __INSPECTOR_H__
#include "inspectorBase.h"
#include "ui_inspector_element.h"
#include "ui_inspector_vbox.h"
#include "ui_inspector_hbox.h"
#include "ui_inspector_articulation.h"
#include "ui_inspector_spacer.h"
#include "ui_inspector_segment.h"
#include "ui_inspector_note.h"
#include "ui_inspector_chord.h"
#include "ui_inspector_rest.h"
#include "ui_inspector_clef.h"
#include "ui_inspector_timesig.h"
#include "ui_inspector_keysig.h"
#include "ui_inspector_volta.h"
#include "ui_inspector_barline.h"
#include "ui_inspector_tuplet.h"
#include "ui_inspector_accidental.h"
#include "ui_inspector_tempotext.h"
#include "ui_inspector_dynamic.h"
#include "ui_inspector_slur.h"
#include "ui_inspector_text.h"
namespace Ms {
class Element;
class Note;
class Inspector;
class Segment;
class Chord;
class UiInspectorElement: public Ui::InspectorElement {
public:
void setupUi(QWidget *InspectorElement);
};
//---------------------------------------------------------
// InspectorElement
//---------------------------------------------------------
class InspectorElement : public InspectorBase {
Q_OBJECT
UiInspectorElement b;
public:
InspectorElement(QWidget* parent);
};
//---------------------------------------------------------
// InspectorVBox
//---------------------------------------------------------
class InspectorVBox : public InspectorBase {
Q_OBJECT
Ui::InspectorVBox vb;
public:
InspectorVBox(QWidget* parent);
};
//---------------------------------------------------------
// InspectorHBox
//---------------------------------------------------------
class InspectorHBox : public InspectorBase {
Q_OBJECT
Ui::InspectorHBox hb;
public:
InspectorHBox(QWidget* parent);
};
//---------------------------------------------------------
// InspectorArticulation
//---------------------------------------------------------
class InspectorArticulation : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorArticulation ar;
public:
InspectorArticulation(QWidget* parent);
};
//---------------------------------------------------------
// InspectorSpacer
//---------------------------------------------------------
class InspectorSpacer : public InspectorBase {
Q_OBJECT
Ui::InspectorSpacer sp;
public:
InspectorSpacer(QWidget* parent);
};
//---------------------------------------------------------
// InspectorRest
//---------------------------------------------------------
class InspectorRest : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorSegment s;
Ui::InspectorRest r;
public:
InspectorRest(QWidget* parent);
};
//---------------------------------------------------------
// InspectorClef
//---------------------------------------------------------
class Clef;
class InspectorClef : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorSegment s;
Ui::InspectorClef c;
Clef* otherClef; // the courtesy clef for a main clef or viceversa
// used to keep in sync ShowCourtesy setting of both clefs
protected slots:
virtual void valueChanged(int idx);
public:
InspectorClef(QWidget* parent);
virtual void setElement();
};
//---------------------------------------------------------
// InspectorTimeSig
//---------------------------------------------------------
class InspectorTimeSig : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorSegment s;
Ui::InspectorTimeSig t;
public:
InspectorTimeSig(QWidget* parent);
};
//---------------------------------------------------------
// InspectorKeySig
//---------------------------------------------------------
class InspectorKeySig : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorSegment s;
Ui::InspectorKeySig k;
public:
InspectorKeySig(QWidget* parent);
};
//---------------------------------------------------------
// InspectorTuplet
//---------------------------------------------------------
class InspectorTuplet : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorTuplet t;
public:
InspectorTuplet(QWidget* parent);
};
//---------------------------------------------------------
// InspectorAccidental
//---------------------------------------------------------
class InspectorAccidental : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorAccidental a;
public:
InspectorAccidental(QWidget* parent);
};
//---------------------------------------------------------
// InspectorTempoText
//---------------------------------------------------------
class InspectorTempoText : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorTempoText t;
public:
InspectorTempoText(QWidget* parent);
virtual void postInit();
};
//---------------------------------------------------------
// InspectorDynamic
//---------------------------------------------------------
class InspectorDynamic : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorText t;
Ui::InspectorDynamic d;
public:
InspectorDynamic(QWidget* parent);
virtual void setElement();
};
//---------------------------------------------------------
// InspectorBarLine
//---------------------------------------------------------
#define BARLINE_BUILTIN_SPANS 5
class InspectorBarLine : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorBarLine b;
static QString builtinSpanNames[BARLINE_BUILTIN_SPANS];
static int builtinSpans[BARLINE_BUILTIN_SPANS][3];
public:
InspectorBarLine(QWidget* parent);
};
//---------------------------------------------------------
// Inspector
//---------------------------------------------------------
class Inspector : public QDockWidget {
Q_OBJECT
QScrollArea* sa;
InspectorBase* ie;
QList<Element*> _el;
Element* _element; // currently displayed element
bool _inspectorEdit; // set to true when an edit originates from
// within the inspector itself
public slots:
void reset();
public:
Inspector(QWidget* parent = 0);
void setElement(Element*);
void setElements(const QList<Element*>&);
Element* element() const { return _element; }
const QList<Element*>& el() const { return _el; }
void setInspectorEdit(bool val) { _inspectorEdit = val; }
};
//---------------------------------------------------------
// InspectorSlur
//---------------------------------------------------------
class InspectorSlur : public InspectorBase {
Q_OBJECT
UiInspectorElement e;
Ui::InspectorSlur s;
public:
InspectorSlur(QWidget* parent);
};
//---------------------------------------------------------
// InspectorEmpty
//---------------------------------------------------------
class InspectorEmpty : public InspectorBase {
Q_OBJECT
public:
InspectorEmpty(QWidget* parent);
};
} // namespace Ms
#endif