2012-05-26 14:49:10 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Music Composition & Notation
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
#include "musescore.h"
|
|
|
|
#include "masterpalette.h"
|
|
|
|
#include "symboldialog.h"
|
|
|
|
#include "palette.h"
|
2013-02-06 16:22:03 +01:00
|
|
|
#include "keyedit.h"
|
2012-05-26 14:49:10 +02:00
|
|
|
#include "libmscore/score.h"
|
|
|
|
#include "libmscore/clef.h"
|
|
|
|
#include "libmscore/fingering.h"
|
|
|
|
#include "libmscore/spacer.h"
|
|
|
|
#include "libmscore/layoutbreak.h"
|
|
|
|
#include "libmscore/dynamic.h"
|
|
|
|
#include "libmscore/bracket.h"
|
|
|
|
#include "libmscore/arpeggio.h"
|
|
|
|
#include "libmscore/glissando.h"
|
|
|
|
#include "libmscore/repeat.h"
|
|
|
|
#include "libmscore/breath.h"
|
|
|
|
#include "libmscore/harmony.h"
|
|
|
|
#include "libmscore/text.h"
|
|
|
|
#include "libmscore/tempotext.h"
|
|
|
|
#include "libmscore/instrchange.h"
|
|
|
|
#include "libmscore/rehearsalmark.h"
|
|
|
|
#include "libmscore/stafftext.h"
|
|
|
|
#include "libmscore/note.h"
|
|
|
|
#include "libmscore/tremolo.h"
|
|
|
|
#include "libmscore/chordline.h"
|
|
|
|
|
2013-07-16 14:44:20 +02:00
|
|
|
#include "timedialog.h"
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
namespace Ms {
|
|
|
|
|
2012-05-26 14:49:10 +02:00
|
|
|
extern void populateIconPalette(Palette* p, const IconAction* a);
|
|
|
|
extern Palette* newKeySigPalette();
|
2014-11-19 19:16:18 +01:00
|
|
|
extern Palette* newBarLinePalette(bool);
|
|
|
|
extern Palette* newLinesPalette(bool);
|
2012-05-26 14:49:10 +02:00
|
|
|
extern Palette* newAccidentalsPalette();
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// showMasterPalette
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2013-02-07 17:34:44 +01:00
|
|
|
void MuseScore::showMasterPalette(const QString& s)
|
2012-05-26 14:49:10 +02:00
|
|
|
{
|
|
|
|
QAction* a = getAction("masterpalette");
|
|
|
|
|
|
|
|
if (masterPalette == 0) {
|
2014-10-30 17:37:08 +01:00
|
|
|
masterPalette = new MasterPalette(this);
|
2012-05-26 14:49:10 +02:00
|
|
|
connect(masterPalette, SIGNAL(closed(bool)), a, SLOT(setChecked(bool)));
|
2015-01-07 15:33:24 +01:00
|
|
|
mscore->stackUnder(masterPalette);
|
2012-05-26 14:49:10 +02:00
|
|
|
}
|
2015-01-25 03:33:59 +01:00
|
|
|
// when invoked via other actions, the main "masterpalette" action is not toggled automatically
|
|
|
|
if (!s.isEmpty()) {
|
|
|
|
// display if not already
|
|
|
|
if (!a->isChecked())
|
|
|
|
a->setChecked(true);
|
|
|
|
else {
|
|
|
|
// master palette is open; close only if command match current item
|
|
|
|
if (s == masterPalette->selectedItem())
|
|
|
|
a->setChecked(false);
|
|
|
|
// otherwise switch tabs
|
|
|
|
}
|
|
|
|
}
|
2012-05-31 16:24:35 +02:00
|
|
|
masterPalette->setVisible(a->isChecked());
|
2013-02-07 17:34:44 +01:00
|
|
|
if (!s.isEmpty())
|
|
|
|
masterPalette->selectItem(s);
|
2012-05-26 14:49:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// createPalette
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
Palette* MasterPalette::createPalette(int w, int h, bool grid, double mag)
|
|
|
|
{
|
|
|
|
Palette* sp = new Palette;
|
|
|
|
PaletteScrollArea* psa = new PaletteScrollArea(sp);
|
|
|
|
psa->setRestrictHeight(false);
|
|
|
|
sp->setMag(mag);
|
|
|
|
sp->setGrid(w, h);
|
|
|
|
sp->setDrawGrid(grid);
|
|
|
|
sp->setReadOnly(true);
|
|
|
|
stack->addWidget(psa);
|
|
|
|
return sp;
|
|
|
|
}
|
|
|
|
|
2013-02-07 17:34:44 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// selectItem
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MasterPalette::selectItem(const QString& s)
|
|
|
|
{
|
|
|
|
for (int idx = 0; idx < listWidget->count(); ++idx) {
|
|
|
|
if (listWidget->item(idx)->text() == s) {
|
|
|
|
listWidget->setCurrentItem(listWidget->item(idx));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-25 03:33:59 +01:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// selectedItem
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
QString MasterPalette::selectedItem()
|
|
|
|
{
|
|
|
|
return listWidget->currentItem()->text();
|
|
|
|
}
|
|
|
|
|
2012-05-26 14:49:10 +02:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// addPalette
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MasterPalette::addPalette(Palette* sp)
|
|
|
|
{
|
|
|
|
sp->setReadOnly(true);
|
|
|
|
PaletteScrollArea* psa = new PaletteScrollArea(sp);
|
|
|
|
psa->setRestrictHeight(false);
|
|
|
|
stack->addWidget(psa);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// MasterPalette
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
MasterPalette::MasterPalette(QWidget* parent)
|
2014-10-30 17:37:08 +01:00
|
|
|
: QWidget(parent, Qt::Dialog)
|
2012-05-26 14:49:10 +02:00
|
|
|
{
|
|
|
|
setupUi(this);
|
2014-10-30 17:37:08 +01:00
|
|
|
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2014-11-19 19:16:18 +01:00
|
|
|
addPalette(MuseScore::newGraceNotePalette(false));
|
2014-10-14 14:37:38 +02:00
|
|
|
addPalette(MuseScore::newClefsPalette(false));
|
2014-12-04 14:40:26 +01:00
|
|
|
keyEditor = new KeyEditor;
|
|
|
|
stack->addWidget(keyEditor);
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2013-07-16 14:44:20 +02:00
|
|
|
timeDialog = new TimeDialog;
|
|
|
|
stack->addWidget(timeDialog);
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2014-11-19 19:16:18 +01:00
|
|
|
addPalette(MuseScore::newBarLinePalette(false));
|
|
|
|
addPalette(MuseScore::newLinesPalette(false));
|
2012-05-26 14:49:10 +02:00
|
|
|
addPalette(MuseScore::newArpeggioPalette());
|
|
|
|
addPalette(MuseScore::newBreathPalette());
|
|
|
|
addPalette(MuseScore::newBracketsPalette());
|
2014-10-14 14:37:38 +02:00
|
|
|
addPalette(MuseScore::newArticulationsPalette(false));
|
2013-02-06 16:22:03 +01:00
|
|
|
|
2014-10-14 14:37:38 +02:00
|
|
|
addPalette(MuseScore::newAccidentalsPalette(false));
|
2013-02-06 16:22:03 +01:00
|
|
|
|
2014-11-19 19:16:18 +01:00
|
|
|
addPalette(MuseScore::newDynamicsPalette(false, true));
|
2012-05-26 14:49:10 +02:00
|
|
|
addPalette(MuseScore::newFingeringPalette());
|
|
|
|
addPalette(MuseScore::newNoteHeadsPalette());
|
|
|
|
addPalette(MuseScore::newTremoloPalette());
|
|
|
|
addPalette(MuseScore::newRepeatsPalette());
|
2013-09-25 14:36:11 +02:00
|
|
|
addPalette(MuseScore::newTempoPalette());
|
2012-05-26 14:49:10 +02:00
|
|
|
addPalette(MuseScore::newTextPalette());
|
|
|
|
addPalette(MuseScore::newBreaksPalette());
|
2013-08-08 11:38:32 +02:00
|
|
|
addPalette(MuseScore::newBagpipeEmbellishmentPalette());
|
2014-11-19 19:16:18 +01:00
|
|
|
addPalette(MuseScore::newBeamPalette(false));
|
2012-05-26 14:49:10 +02:00
|
|
|
addPalette(MuseScore::newFramePalette());
|
|
|
|
|
|
|
|
stack->addWidget(new SymbolDialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// closeEvent
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void MasterPalette::closeEvent(QCloseEvent* ev)
|
|
|
|
{
|
2013-07-16 14:44:20 +02:00
|
|
|
if (timeDialog->dirty())
|
|
|
|
timeDialog->save();
|
2014-12-04 14:40:26 +01:00
|
|
|
if (keyEditor->dirty())
|
|
|
|
keyEditor->save();
|
2012-05-26 14:49:10 +02:00
|
|
|
emit closed(false);
|
|
|
|
QWidget::closeEvent(ev);
|
|
|
|
}
|
|
|
|
|
2013-05-13 18:49:17 +02:00
|
|
|
}
|
2012-05-26 14:49:10 +02:00
|
|
|
|