2016-09-22 16:07:47 +02:00
|
|
|
//=============================================================================
|
|
|
|
// MuseScore
|
|
|
|
// Linux Music Score Editor
|
|
|
|
//
|
|
|
|
// Copyright (C) 2002-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.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
/**
|
|
|
|
\file
|
|
|
|
Implementation of class Selection plus other selection related functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libmscore/select.h"
|
|
|
|
#include "selectnotedialog.h"
|
|
|
|
#include "libmscore/element.h"
|
|
|
|
#include "libmscore/system.h"
|
|
|
|
#include "libmscore/score.h"
|
|
|
|
#include "libmscore/chord.h"
|
|
|
|
#include "libmscore/sym.h"
|
2017-03-08 13:12:26 +01:00
|
|
|
#include "libmscore/segment.h"
|
2016-09-26 20:44:20 +02:00
|
|
|
#include "musescore.h"
|
2016-09-22 16:07:47 +02:00
|
|
|
|
|
|
|
namespace Ms {
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// SelectDialog
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
2020-05-29 18:47:27 +02:00
|
|
|
SelectNoteDialog::SelectNoteDialog(const Note* _n, QWidget* parent)
|
|
|
|
: QDialog(parent)
|
2016-09-22 16:07:47 +02:00
|
|
|
{
|
2016-09-26 20:44:20 +02:00
|
|
|
setObjectName("SelectNoteDialog");
|
2016-09-22 16:07:47 +02:00
|
|
|
setupUi(this);
|
|
|
|
setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
n = _n;
|
2016-10-18 09:21:54 +02:00
|
|
|
notehead->setText(NoteHead::group2userName(n->headGroup()));
|
2016-09-22 16:07:47 +02:00
|
|
|
pitch->setText(n->tpcUserName());
|
2017-10-13 14:51:44 +02:00
|
|
|
string->setText(QString::number(n->string() + 1));
|
2016-09-22 16:07:47 +02:00
|
|
|
type->setText(n->noteTypeUserName());
|
2019-11-24 19:39:40 +01:00
|
|
|
durationType->setText(tr("%1 Note").arg(n->chord()->durationType().durationTypeUserName()));
|
|
|
|
durationTicks->setText(n->chord()->durationUserName());
|
2016-09-22 16:07:47 +02:00
|
|
|
name->setText(tpc2name(n->tpc(), NoteSpellingType::STANDARD, NoteCaseType::AUTO, false));
|
|
|
|
inSelection->setEnabled(n->score()->selection().isRange());
|
2016-09-26 20:44:20 +02:00
|
|
|
MuseScore::restoreGeometry(this);
|
2016-09-22 16:07:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// setPattern
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void SelectNoteDialog::setPattern(NotePattern* p)
|
|
|
|
{
|
|
|
|
if (sameNotehead->isChecked()) {
|
|
|
|
p->notehead = n->headGroup();
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2016-09-22 16:07:47 +02:00
|
|
|
if (samePitch->isChecked()) {
|
|
|
|
p->pitch = n->pitch();
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2017-10-13 14:51:44 +02:00
|
|
|
if (sameString->isChecked()) {
|
|
|
|
p->string = n->string();
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2016-09-22 16:07:47 +02:00
|
|
|
if (sameName->isChecked()) {
|
|
|
|
p->tpc = n->tpc();
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2016-09-22 16:07:47 +02:00
|
|
|
if (sameType->isChecked()) {
|
|
|
|
p->type = n->noteType();
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2019-11-24 19:39:40 +01:00
|
|
|
if (sameDurationType->isChecked()) {
|
|
|
|
p->durationType = n->chord()->actualDurationType();
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2019-11-24 19:39:40 +01:00
|
|
|
|
|
|
|
if (sameDurationTicks->isChecked()) {
|
|
|
|
p->durationTicks = n->chord()->actualTicks();
|
|
|
|
} else {
|
|
|
|
p->durationTicks = Fraction(-1,1);
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2016-09-22 16:07:47 +02:00
|
|
|
|
|
|
|
if (sameStaff->isChecked()) {
|
|
|
|
p->staffStart = n->staffIdx();
|
|
|
|
p->staffEnd = n->staffIdx() + 1;
|
|
|
|
} else if (inSelection->isChecked()) {
|
|
|
|
p->staffStart = n->score()->selection().staffStart();
|
|
|
|
p->staffEnd = n->score()->selection().staffEnd();
|
|
|
|
} else {
|
|
|
|
p->staffStart = -1;
|
|
|
|
p->staffEnd = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->voice = sameVoice->isChecked() ? n->voice() : -1;
|
|
|
|
p->system = 0;
|
|
|
|
if (sameSystem->isChecked()) {
|
|
|
|
p->system = n->chord()->segment()->system();
|
2020-05-26 15:54:26 +02:00
|
|
|
}
|
2016-09-22 16:07:47 +02:00
|
|
|
}
|
2016-09-26 20:44:20 +02:00
|
|
|
|
|
|
|
//---------------------------------------------------------
|
|
|
|
// hideEvent
|
|
|
|
//---------------------------------------------------------
|
|
|
|
|
|
|
|
void SelectNoteDialog::hideEvent(QHideEvent* event)
|
|
|
|
{
|
|
|
|
MuseScore::saveGeometry(this);
|
|
|
|
QWidget::hideEvent(event);
|
|
|
|
}
|
2016-09-22 16:07:47 +02:00
|
|
|
}
|