2012-05-26 14:49:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MusE Score
|
|
|
|
// Linux Music Score Editor
|
|
|
|
// $Id: instrdialog.h 5377 2012-02-25 10:24:05Z wschweer $
|
|
|
|
//
|
|
|
|
// Copyright (C) 2002-2009 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.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#ifndef __INSTRDIALOG_H__
|
|
|
|
#define __INSTRDIALOG_H__
|
|
|
|
|
|
|
|
#include "ui_instrdialog.h"
|
|
|
|
#include "globals.h"
|
|
|
|
#include "libmscore/mscore.h"
|
2013-03-08 19:33:30 +01:00
|
|
|
#include "libmscore/clef.h"
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2013-03-25 20:39:24 +01:00
|
|
|
class EditInstrument;
|
2012-08-12 16:08:58 +02:00
|
|
|
class InstrumentTemplate;
|
2012-05-26 14:49:10 +02:00
|
|
|
class Instrument;
|
|
|
|
class Part;
|
|
|
|
class Staff;
|
2013-03-25 20:39:24 +01:00
|
|
|
class StaffType;
|
2012-05-26 14:49:10 +02:00
|
|
|
class Score;
|
2013-09-09 23:48:18 +02:00
|
|
|
class InstrumentGenre;
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2013-03-26 11:56:22 +01:00
|
|
|
enum { ITEM_KEEP, ITEM_DELETE, ITEM_ADD, ITEM_UPDATE };
|
2012-05-26 14:49:10 +02:00
|
|
|
enum { PART_LIST_ITEM = QTreeWidgetItem::UserType, STAFF_LIST_ITEM };
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// PartListItem
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class PartListItem : public QTreeWidgetItem {
|
|
|
|
|
|
|
|
public:
|
|
|
|
int op;
|
|
|
|
Part* part;
|
|
|
|
const InstrumentTemplate* it;
|
|
|
|
|
|
|
|
PartListItem(Part* p, QTreeWidget* lv);
|
|
|
|
PartListItem(const InstrumentTemplate* i, QTreeWidget* lv);
|
2012-08-01 22:15:58 +02:00
|
|
|
bool visible() const;
|
|
|
|
void setVisible(bool val);
|
2012-05-26 14:49:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// StaffListItem
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-03-26 01:26:52 +01:00
|
|
|
class StaffListItem : public QObject, public QTreeWidgetItem {
|
|
|
|
Q_OBJECT
|
2013-03-08 19:33:30 +01:00
|
|
|
ClefTypeList _clef;
|
2012-05-26 14:49:10 +02:00
|
|
|
int _partIdx;
|
|
|
|
bool _linked;
|
2013-03-25 20:39:24 +01:00
|
|
|
QComboBox* _staffTypeCombo;
|
|
|
|
|
|
|
|
struct STAFF_LIST_STAFF_TYPE {
|
|
|
|
int idx; // idx identifying the staff type
|
|
|
|
QString displayName;
|
|
|
|
const StaffType* staffType;
|
|
|
|
};
|
|
|
|
|
|
|
|
// static members to mamage staff type / preset list
|
|
|
|
static Score* _score;
|
|
|
|
static std::vector<STAFF_LIST_STAFF_TYPE> staffTypeList;
|
|
|
|
static const StaffType* getListedStaffType(int idx);
|
2012-05-26 14:49:10 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
StaffListItem();
|
|
|
|
StaffListItem(PartListItem* li);
|
|
|
|
|
|
|
|
int op;
|
|
|
|
Staff* staff;
|
|
|
|
int partIdx() const { return _partIdx; }
|
|
|
|
void setPartIdx(int val);
|
|
|
|
int staffIdx;
|
|
|
|
|
2013-03-08 19:33:30 +01:00
|
|
|
void setClef(const ClefTypeList& val);
|
|
|
|
const ClefTypeList& clef() const { return _clef; }
|
2012-05-26 14:49:10 +02:00
|
|
|
void setLinked(bool val);
|
2013-03-08 19:33:30 +01:00
|
|
|
bool linked() const { return _linked; }
|
2013-03-25 20:39:24 +01:00
|
|
|
void setStaffType(int staffTypeIdx);
|
|
|
|
const StaffType* staffType() const;
|
2013-03-26 01:26:52 +01:00
|
|
|
int staffTypeIdx() const;
|
2013-03-30 01:51:11 +01:00
|
|
|
void initStaffTypeCombo(bool forceRecreate = false);
|
2013-03-25 20:39:24 +01:00
|
|
|
|
|
|
|
static void populateStaffTypes(Score * score);
|
2013-03-26 01:26:52 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void staffTypeChanged(int);
|
2012-05-26 14:49:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// InstrumentsDialog
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
class InstrumentsDialog : public QDialog, public Ui::InstrumentDialogBase {
|
|
|
|
Q_OBJECT
|
|
|
|
Score* cs;
|
|
|
|
EditInstrument* editInstrument;
|
|
|
|
|
|
|
|
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();
|
|
|
|
void on_belowButton_clicked();
|
|
|
|
void on_linkedButton_clicked();
|
|
|
|
void on_saveButton_clicked();
|
|
|
|
void on_loadButton_clicked();
|
|
|
|
void buildTemplateList();
|
2013-06-18 17:44:32 +02:00
|
|
|
void expandOrCollapse(const QModelIndex &);
|
2012-05-26 14:49:10 +02:00
|
|
|
virtual void accept();
|
|
|
|
|
2013-01-15 10:52:54 +01:00
|
|
|
void on_search_textChanged(const QString &searchPhrase);
|
|
|
|
void on_clearSearch_clicked();
|
2013-09-09 23:48:18 +02:00
|
|
|
|
2013-09-12 21:34:47 +02:00
|
|
|
void on_instrumentGenreFilter_currentIndexChanged(int);
|
|
|
|
void filterInstrumentsByGenre(QTreeWidget *, QString);
|
2013-01-15 10:52:54 +01:00
|
|
|
|
2012-05-26 14:49:10 +02:00
|
|
|
public:
|
|
|
|
InstrumentsDialog(QWidget* parent = 0);
|
|
|
|
void setScore(Score* s) { cs = s; }
|
|
|
|
void genPartList();
|
2013-10-01 16:22:06 +02:00
|
|
|
void writeSettings();
|
2012-05-26 14:49:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// 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;
|
|
|
|
};
|
|
|
|
|
2013-09-12 21:34:47 +02:00
|
|
|
extern void populateInstrumentList(QTreeWidget* instrumentList);
|
|
|
|
extern void populateGenreCombo(QComboBox* combo);
|
2013-05-13 18:49:17 +02:00
|
|
|
|
|
|
|
} // namespace Ms
|
2013-09-09 23:48:18 +02:00
|
|
|
|
|
|
|
extern QList<Ms::InstrumentGenre *> instrumentGenres;
|
|
|
|
|
2012-05-26 14:49:10 +02:00
|
|
|
#endif
|
|
|
|
|