Skip to content

Commit

Permalink
add NoteDot to inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Aug 9, 2018
1 parent e02af02 commit d5b8938
Show file tree
Hide file tree
Showing 10 changed files with 305 additions and 159 deletions.
88 changes: 44 additions & 44 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2637,6 +2637,50 @@ bool Note::setProperty(Pid propertyId, const QVariant& v)
return true;
}

//---------------------------------------------------------
// propertyDefault
//---------------------------------------------------------

QVariant Note::propertyDefault(Pid propertyId) const
{
switch(propertyId) {
case Pid::GHOST:
case Pid::SMALL:
return false;
case Pid::MIRROR_HEAD:
return int(MScore::DirectionH::AUTO);
case Pid::DOT_POSITION:
return QVariant::fromValue<Direction>(Direction::AUTO);
case Pid::HEAD_GROUP:
return int(NoteHead::Group::HEAD_NORMAL);
case Pid::VELO_OFFSET:
return 0;
case Pid::TUNING:
return 0.0;
case Pid::FRET:
case Pid::STRING:
return -1;
case Pid::HEAD_TYPE:
return int(NoteHead::Type::HEAD_AUTO);
case Pid::VELO_TYPE:
return int (ValueType::OFFSET_VAL);
case Pid::PLAY:
return true;
case Pid::FIXED:
return false;
case Pid::FIXED_LINE:
return 0;
case Pid::TPC2:
return getProperty(Pid::TPC1);
case Pid::PITCH:
case Pid::TPC1:
return QVariant();
default:
break;
}
return Element::propertyDefault(propertyId);
}

//---------------------------------------------------------
// undoSetFret
//---------------------------------------------------------
Expand Down Expand Up @@ -2754,50 +2798,6 @@ void Note::undoSetHeadType(NoteHead::Type val)
undoChangeProperty(Pid::HEAD_TYPE, int(val));
}

//---------------------------------------------------------
// propertyDefault
//---------------------------------------------------------

QVariant Note::propertyDefault(Pid propertyId) const
{
switch(propertyId) {
case Pid::GHOST:
case Pid::SMALL:
return false;
case Pid::MIRROR_HEAD:
return int(MScore::DirectionH::AUTO);
case Pid::DOT_POSITION:
return QVariant::fromValue<Direction>(Direction::AUTO);
case Pid::HEAD_GROUP:
return int(NoteHead::Group::HEAD_NORMAL);
case Pid::VELO_OFFSET:
return 0;
case Pid::TUNING:
return 0.0;
case Pid::FRET:
case Pid::STRING:
return -1;
case Pid::HEAD_TYPE:
return int(NoteHead::Type::HEAD_AUTO);
case Pid::VELO_TYPE:
return int (ValueType::OFFSET_VAL);
case Pid::PLAY:
return true;
case Pid::FIXED:
return false;
case Pid::FIXED_LINE:
return 0;
case Pid::TPC2:
return getProperty(Pid::TPC1);
case Pid::PITCH:
case Pid::TPC1:
return QVariant();
default:
break;
}
return Element::propertyDefault(propertyId);
}

//---------------------------------------------------------
// setOnTimeOffset
//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions mscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ QT5_WRAP_UI (ui_headers
inspector/inspector_segment.ui
inspector/inspector_beam.ui
inspector/inspector_note.ui
inspector/inspector_notedot.ui
inspector/inspector_rest.ui
inspector/inspector_chord.ui
inspector/inspector_group_element.ui
Expand Down Expand Up @@ -349,6 +350,7 @@ add_executable ( ${ExecutableName}
inspector/inspectorMarker.cpp
inspector/inspectorGlissando.cpp
inspector/inspectorNote.cpp
inspector/inspectorNoteDot.cpp
inspector/inspectorAmbitus.cpp
inspector/inspectorArpeggio.cpp
inspector/inspectorFingering.cpp
Expand Down
4 changes: 4 additions & 0 deletions mscore/inspector/inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "inspectorPedal.h"
#include "inspectorPalmMute.h"
#include "inspectorVibrato.h"
#include "inspectorNoteDot.h"
#include "musescore.h"
#include "scoreview.h"
#include "bendproperties.h"
Expand Down Expand Up @@ -341,6 +342,9 @@ void Inspector::update(Score* s)
case ElementType::VIBRATO_SEGMENT:
ie = new InspectorVibrato(this);
break;
case ElementType::NOTEDOT:
ie = new InspectorNoteDot(this);
break;
default:
if (element()->isText())
ie = new InspectorText(this);
Expand Down
12 changes: 8 additions & 4 deletions mscore/inspector/inspectorNote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ InspectorNote::InspectorNote(QWidget* parent)
{ Pid::HEAD_GROUP, 0, n.noteHeadGroup, n.resetNoteHeadGroup },
{ Pid::HEAD_TYPE, 0, n.noteHeadType, n.resetNoteHeadType },
{ Pid::MIRROR_HEAD, 0, n.mirrorHead, n.resetMirrorHead },
{ Pid::DOT_POSITION, 0, n.dotPosition, n.resetDotPosition },
{ Pid::PLAY, 0, n.play, n.resetPlay },
{ Pid::TUNING, 0, n.tuning, n.resetTuning },
{ Pid::VELO_TYPE, 0, n.velocityType, n.resetVelocityType },
Expand Down Expand Up @@ -129,12 +128,17 @@ void InspectorNote::setElement()
n.hook->setEnabled(note->chord()->hook());
n.beam->setEnabled(note->chord()->beam());
n.tuplet->setEnabled(note->chord()->tuplet());
bool isNHGroupEnabled = note->chord()->staff()->isPitchedStaff(note->tick()) &&
note->chord()->staff()->staffType(note->tick())->noteHeadScheme() == NoteHeadScheme::HEAD_NORMAL;

bool isNHGroupEnabled = note->chord()->staff()->isPitchedStaff(note->tick())
&& note->chord()->staff()->staffType(note->tick())->noteHeadScheme() == NoteHeadScheme::HEAD_NORMAL;
n.noteHeadGroup->setEnabled(isNHGroupEnabled);

InspectorElementBase::setElement();

//must be placed after InspectorBase::setElement() cause the last one sets resetButton enability
n.resetNoteHeadGroup->setEnabled(isNHGroupEnabled);
if (!isNHGroupEnabled)
n.resetNoteHeadGroup->setEnabled(false);

bool nograce = !note->chord()->isGrace();
s.leadingSpace->setEnabled(nograce);
s.resetLeadingSpace->setEnabled(nograce && s.leadingSpace->value());
Expand Down
36 changes: 36 additions & 0 deletions mscore/inspector/inspectorNoteDot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 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 LICENSE.GPL
//=============================================================================

#include "libmscore/notedot.h"
#include "inspectorNoteDot.h"

namespace Ms {

//---------------------------------------------------------
// InspectorNoteDot
//---------------------------------------------------------

InspectorNoteDot::InspectorNoteDot(QWidget* parent)
: InspectorElementBase(parent)
{
d.setupUi(addWidget());

const std::vector<InspectorItem> iiList = {
{ Pid::DOT_POSITION, 1, d.dotPosition, d.resetDotPosition },
};
const std::vector<InspectorPanel> ppList = {
{ d.title, d.panel },
};
mapSignals(iiList, ppList);
}
}

38 changes: 38 additions & 0 deletions mscore/inspector/inspectorNoteDot.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2018 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_NOTEDOT_H__
#define __INSPECTOR_NOTEDOT_H__

#include "inspector.h"
#include "inspectorBase.h"
#include "ui_inspector_notedot.h"

namespace Ms {

//---------------------------------------------------------
// InspectorNoteDot
//---------------------------------------------------------

class InspectorNoteDot : public InspectorElementBase {
Q_OBJECT

Ui::InspectorNoteDot d;

public:
InspectorNoteDot(QWidget* parent);
};


} // namespace Ms
#endif

3 changes: 2 additions & 1 deletion mscore/inspector/inspectorText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ InspectorText::InspectorText(QWidget* parent)
f.setupUi(addWidget());

const std::vector<InspectorItem> iiList = {
{ Pid::SUB_STYLE, 0, f.style, f.resetStyle },
// { Pid::SUB_STYLE, 0, f.style, f.resetStyle },
{ Pid::SUB_STYLE, 0, f.style, 0 },
};

const std::vector<InspectorPanel> ppList = {
Expand Down
19 changes: 1 addition & 18 deletions mscore/inspector/inspector_frametext.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>193</width>
<width>218</width>
<height>89</height>
</rect>
</property>
Expand Down Expand Up @@ -99,23 +99,6 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="resetStyle">
<property name="toolTip">
<string>Reset to default</string>
</property>
<property name="accessibleName">
<string>Reset 'Style' value</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="icon">
<iconset resource="../musescore.qrc">
<normaloff>:/data/icons/edit-reset.svg</normaloff>:/data/icons/edit-reset.svg</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down
Loading

0 comments on commit d5b8938

Please sign in to comment.