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 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-2014 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 __INSTRWIDGET_H__
#define __INSTRWIDGET_H__
#include "ui_instrwidget.h"
#include "libmscore/clef.h"
namespace Ms {
class EditInstrument;
class InstrumentTemplate;
class Instrument;
class Part;
class Staff;
class StaffType;
class Score;
class InstrumentGenre;
enum class ListItemOp : char { KEEP, I_DELETE, ADD, UPDATE };
enum { PART_LIST_ITEM = QTreeWidgetItem::UserType, STAFF_LIST_ITEM };
//---------------------------------------------------------
// PartListItem
//---------------------------------------------------------
class PartListItem : public QTreeWidgetItem {
public:
ListItemOp op;
Part* part;
const InstrumentTemplate* it;
PartListItem(Part* p, QTreeWidget* lv);
PartListItem(const InstrumentTemplate* i, QTreeWidget* lv);
bool visible() const;
void setVisible(bool val);
void updateClefs();
};
//---------------------------------------------------------
// StaffListItem
//---------------------------------------------------------
class StaffListItem : public QObject, public QTreeWidgetItem {
Q_OBJECT
int _partIdx;
bool _linked;
ClefTypeList _defaultClefType; // clef for "normal" stafftype
ClefTypeList _clefType; // actual clef
QComboBox* _staffTypeCombo { nullptr };
Staff* _staff { 0 };
ListItemOp _op { ListItemOp::KEEP };
private slots:
void staffTypeChanged(int);
public:
StaffListItem();
StaffListItem(PartListItem* li);
int partIdx() const { return _partIdx; }
void setPartIdx(int val);
void setClefType(const ClefTypeList& val);
const ClefTypeList& clefType() const { return _clefType; }
void setDefaultClefType(const ClefTypeList& val) { _defaultClefType = val; }
const ClefTypeList& defaultClefType() const { return _defaultClefType; }
void setLinked(bool val);
bool linked() const { return _linked; }
void setStaffType(const StaffType*);
void setStaffType(int);
const StaffType* staffType() const;
int staffTypeIdx() const;
void initStaffTypeCombo(bool forceRecreate = false);
QComboBox* staffTypeCombo() { return _staffTypeCombo; }
Staff* staff() const { return _staff; }
void setStaff(Staff* s) { _staff = s; }
ListItemOp op() const { return _op; }
void setOp(ListItemOp v) { _op = v; }
};
//---------------------------------------------------------
// InstrumentTemplateListItem
//---------------------------------------------------------
class InstrumentTemplateListItem : public QTreeWidgetItem {
InstrumentTemplate* _instrumentTemplate;
QString _group;
public:
InstrumentTemplateListItem(QString group, QTreeWidget* parent);
InstrumentTemplateListItem(InstrumentTemplate* i, InstrumentTemplateListItem* parent);
InstrumentTemplateListItem(InstrumentTemplate* i, QTreeWidget* parent);
InstrumentTemplate* instrumentTemplate() const { return _instrumentTemplate; }
virtual QString text(int col) const;
};
//---------------------------------------------------------
// InstrumentsWidget
//---------------------------------------------------------
class InstrumentsWidget : public QWidget, public Ui::InstrumentsWidget {
Q_OBJECT
private slots:
void on_instrumentList_itemSelectionChanged();
void on_instrumentList_itemDoubleClicked(QTreeWidgetItem* item, int);
void on_partiturList_itemSelectionChanged();
void on_addButton_clicked();
void on_removeButton_clicked();
void on_upButton_clicked();
void on_downButton_clicked();
StaffListItem* on_belowButton_clicked();
void on_linkedButton_clicked();
void expandOrCollapse(const QModelIndex &);
void on_search_textChanged(const QString &searchPhrase);
void on_clearSearch_clicked();
void on_instrumentGenreFilter_currentIndexChanged(int);
void filterInstrumentsByGenre(QTreeWidget *, QString);
public slots:
void buildTemplateList();
signals:
void completeChanged(bool);
public:
InstrumentsWidget(QWidget* parent = 0);
void genPartList(Score*);
void writeSettings();
void init();
void createInstruments(Score*);
QTreeWidget* getPartiturList();
};
extern void populateInstrumentList(QTreeWidget* instrumentList);
extern void populateGenreCombo(QComboBox* combo);
} // namespace Ms
extern QList<Ms::InstrumentGenre *> instrumentGenres;
#endif
|