Skip to content

Commit e84347b

Browse files
committed
Design pass #5: More finessing
1 parent 22441b4 commit e84347b

File tree

14 files changed

+321
-434
lines changed

14 files changed

+321
-434
lines changed

src/engraving/libmscore/textbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ void TextBlock::layout(TextBase* t)
980980

981981
double rx = 0;
982982
AlignH alignH = t->align().horizontal;
983-
bool dynamicAlwaysCentered = t->isDynamic() && !t->getProperty(Pid::CENTER_ON_NOTEHEAD).toBool();
983+
bool dynamicAlwaysCentered = t->isDynamic() && t->getProperty(Pid::CENTER_ON_NOTEHEAD).toBool();
984984

985985
if (alignH == AlignH::HCENTER || dynamicAlwaysCentered) {
986986
rx = (layoutWidth - (_bbox.left() + _bbox.right())) * .5;

src/inspector/models/text/textsettingsmodel.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "types/commontypes.h"
2727
#include "types/texttypes.h"
2828

29+
#include "engraving/libmscore/dynamic.h"
2930
#include "engraving/libmscore/textbase.h"
3031
#include "engraving/types/typesconv.h"
3132

@@ -150,6 +151,7 @@ void TextSettingsModel::loadProperties()
150151
updateFramePropertiesAvailability();
151152
updateStaffPropertiesAvailability();
152153
updateIsDynamicSpecificSettings();
154+
updateIsHorizontalAlignmentAvailable();
153155
}
154156

155157
void TextSettingsModel::resetProperties()
@@ -194,6 +196,7 @@ void TextSettingsModel::onNotationChanged(const PropertyIdSet&, const StyleIdSet
194196
return;
195197
}
196198
}
199+
updateIsHorizontalAlignmentAvailable();
197200
}
198201

199202
void TextSettingsModel::insertSpecialCharacters()
@@ -323,6 +326,11 @@ bool TextSettingsModel::isDynamicSpecificSettings() const
323326
return m_isDynamicSpecificSettings;
324327
}
325328

329+
bool TextSettingsModel::isHorizontalAlignmentAvailable() const
330+
{
331+
return m_isHorizontalAlignmentAvailable;
332+
}
333+
326334
void TextSettingsModel::setAreStaffTextPropertiesAvailable(bool areStaffTextPropertiesAvailable)
327335
{
328336
if (m_areStaffTextPropertiesAvailable == areStaffTextPropertiesAvailable) {
@@ -353,6 +361,16 @@ void TextSettingsModel::setIsDynamicSpecificSettings(bool isOnlyDynamics)
353361
emit isDynamicSpecificSettingsChanged(m_isDynamicSpecificSettings);
354362
}
355363

364+
void TextSettingsModel::setIsHorizontalAlignmentAvailable(bool isHorizontalAlignmentAvailable)
365+
{
366+
if (isHorizontalAlignmentAvailable == m_isHorizontalAlignmentAvailable) {
367+
return;
368+
}
369+
370+
m_isHorizontalAlignmentAvailable = isHorizontalAlignmentAvailable;
371+
emit isHorizontalAlignmentAvailableChanged(m_isHorizontalAlignmentAvailable);
372+
}
373+
356374
void TextSettingsModel::updateFramePropertiesAvailability()
357375
{
358376
bool isFrameVisible = static_cast<TextTypes::FrameType>(m_frameType->value().toInt())
@@ -386,6 +404,19 @@ void TextSettingsModel::updateIsDynamicSpecificSettings()
386404
setIsDynamicSpecificSettings(isOnlyDynamic);
387405
}
388406

407+
void TextSettingsModel::updateIsHorizontalAlignmentAvailable()
408+
{
409+
bool available = false;
410+
for (EngravingItem* item : m_elementList) {
411+
bool isPureAlignedDynamic = item->isDynamic() && toDynamic(item)->centerOnNotehead();
412+
if (!isPureAlignedDynamic) {
413+
available = true;
414+
break;
415+
}
416+
}
417+
setIsHorizontalAlignmentAvailable(available);
418+
}
419+
389420
bool TextSettingsModel::isTextEditingStarted() const
390421
{
391422
IF_ASSERT_FAILED(context() && context()->currentNotation()) {

src/inspector/models/text/textsettingsmodel.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class TextSettingsModel : public AbstractInspectorModel
6060
Q_PROPERTY(
6161
bool isSpecialCharactersInsertionAvailable READ isSpecialCharactersInsertionAvailable NOTIFY isSpecialCharactersInsertionAvailableChanged)
6262
Q_PROPERTY(bool isDynamicSpecificSettings READ isDynamicSpecificSettings NOTIFY isDynamicSpecificSettingsChanged)
63+
Q_PROPERTY(bool isHorizontalAlignmentAvailable READ isHorizontalAlignmentAvailable NOTIFY isHorizontalAlignmentAvailableChanged)
6364

6465
public:
6566
explicit TextSettingsModel(QObject* parent, IElementRepositoryService* repository);
@@ -99,18 +100,21 @@ class TextSettingsModel : public AbstractInspectorModel
99100
bool areStaffTextPropertiesAvailable() const;
100101
bool isSpecialCharactersInsertionAvailable() const;
101102
bool isDynamicSpecificSettings() const;
103+
bool isHorizontalAlignmentAvailable() const;
102104

103105
public slots:
104106
void setAreStaffTextPropertiesAvailable(bool areStaffTextPropertiesAvailable);
105107
void setIsSpecialCharactersInsertionAvailable(bool isSpecialCharactersInsertionAvailable);
106108
void setIsDynamicSpecificSettings(bool isOnlyDynamics);
109+
void setIsHorizontalAlignmentAvailable(bool isHorizontalAlignmentAvailable);
107110

108111
signals:
109112
void textStylesChanged();
110113

111114
void areStaffTextPropertiesAvailableChanged(bool areStaffTextPropertiesAvailable);
112115
void isSpecialCharactersInsertionAvailableChanged(bool isSpecialCharactersInsertionAvailable);
113116
void isDynamicSpecificSettingsChanged(bool isDynamicSpecificSettings);
117+
void isHorizontalAlignmentAvailableChanged(bool isHorizontalAlignmentAvailable);
114118

115119
private:
116120
bool isTextEditingStarted() const;
@@ -119,6 +123,7 @@ public slots:
119123
void updateFramePropertiesAvailability();
120124
void updateStaffPropertiesAvailability();
121125
void updateIsDynamicSpecificSettings();
126+
void updateIsHorizontalAlignmentAvailable();
122127

123128
PropertyItem* m_fontFamily = nullptr;
124129
PropertyItem* m_fontStyle = nullptr;
@@ -144,6 +149,7 @@ public slots:
144149
bool m_areStaffTextPropertiesAvailable = false;
145150
bool m_isSpecialCharactersInsertionAvailable = false;
146151
bool m_isDynamicSpecificSettings = false;
152+
bool m_isHorizontalAlignmentAvailable = true;
147153
};
148154
}
149155

src/inspector/view/qml/MuseScore/Inspector/notation/dynamics/DynamicsSettings.qml

Lines changed: 30 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -98,39 +98,6 @@ Column {
9898
}
9999
}
100100

101-
InspectorPropertyView {
102-
id: centerOnNoteheadSection
103-
titleText: ""
104-
propertyItem: root.model ? root.model.centerOnNotehead : null
105-
106-
isModified: root.model ? root.model.centerOnNotehead.isModified: false
107-
108-
onRequestResetToDefault: {
109-
if (root.model) {
110-
root.model.centerOnNotehead.resetToDefault()
111-
}
112-
}
113-
114-
onRequestApplyToStyle: {
115-
if (root.model) {
116-
root.model.centerOnNotehead.applyToStyle()
117-
}
118-
}
119-
120-
Item {
121-
CheckBoxPropertyView {
122-
id: centerOnNotehead
123-
124-
navigation.name: "Center on notehead"
125-
navigation.panel: root.navigationPanel
126-
navigation.row: dynamicSize.navigationRowEnd + 1
127-
128-
text: qsTrc("inspector", "Center on notehead")
129-
propertyItem: root.model ? root.model.centerOnNotehead : null
130-
height: implicitHeight
131-
}
132-
}
133-
}
134101

135102
PlacementSection {
136103
id: dynamicsPlacementSection
@@ -150,18 +117,38 @@ Column {
150117
navigation.panel: root.navigationPanel
151118
navigation.row: dynamicsPlacementSection.navigationRowEnd + 1
152119

153-
contentItemComponent: FrameSettings {
154-
id: frameSettings
120+
contentItemComponent: Column {
121+
width: parent.width
122+
spacing: root.spacing
155123

156-
navigationPanel: root.navigationPanel
157-
navigationRowStart: parent.navigationRowEnd + 1
124+
FlatRadioButtonGroupPropertyView {
125+
id: dyanmicsAlignment
158126

159-
frameTypePropertyItem: root.model ? root.model.frameType : null
160-
frameBorderColorPropertyItem: root.model ? root.model.frameBorderColor : null
161-
frameFillColorPropertyItem: root.model ? root.model.frameFillColor : null
162-
frameThicknessPropertyItem: root.model ? root.model.frameThickness : null
163-
frameMarginPropertyItem: root.model ? root.model.frameMargin : null
164-
frameCornerRadiusPropertyItem: root.model ? root.model.frameCornerRadius : null
127+
titleText: qsTrc("inspector", "Dynamics alignment")
128+
propertyItem: root.model ? root.model.centerOnNotehead : null
129+
130+
navigationPanel: root.navigationPanel
131+
navigationRowStart: showitem.navigationRowStart + 1
132+
133+
model: [
134+
{ iconCode: IconCode.NONE, text: qsTrc("inspector", "Center on dynamics"), value: true },
135+
{ iconCode: IconCode.NONE, text: qsTrc("inspector", "Use text centering"), value: false }
136+
]
137+
}
138+
139+
FrameSettings {
140+
id: frameSettings
141+
142+
navigationPanel: root.navigationPanel
143+
navigationRowStart: parent.navigationRowEnd + 1
144+
145+
frameTypePropertyItem: root.model ? root.model.frameType : null
146+
frameBorderColorPropertyItem: root.model ? root.model.frameBorderColor : null
147+
frameFillColorPropertyItem: root.model ? root.model.frameFillColor : null
148+
frameThicknessPropertyItem: root.model ? root.model.frameThickness : null
149+
frameMarginPropertyItem: root.model ? root.model.frameMargin : null
150+
frameCornerRadiusPropertyItem: root.model ? root.model.frameCornerRadius : null
151+
}
165152
}
166153
}
167154
}

src/inspector/view/qml/MuseScore/Inspector/text/TextInspectorView.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ InspectorSectionView {
187187
width: parent.width
188188

189189
RadioButtonGroup {
190+
enabled: root.model ? root.model.isHorizontalAlignmentAvailable : false
190191
id: horizontalAlignmentButtonList
191192

192193
property int navigationRowStart: alignmentSection.navigationRowStart + 1

src/notation/notationmodule.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
#include "view/styledialog/styleitem.h"
7575
#include "view/styledialog/notespagemodel.h"
7676
#include "view/styledialog/restspagemodel.h"
77-
#include "view/styledialog/dynamicspagemodel.h"
7877
#include "view/styledialog/beamspagemodel.h"
7978

8079
#include "diagnostics/idiagnosticspathsregister.h"
@@ -197,7 +196,6 @@ void NotationModule::registerUiTypes()
197196
qmlRegisterUncreatableType<StyleItem>("MuseScore.NotationScene", 1, 0, "StyleItem", "Cannot create StyleItem from QML");
198197
qmlRegisterType<NotesPageModel>("MuseScore.NotationScene", 1, 0, "NotesPageModel");
199198
qmlRegisterType<RestsPageModel>("MuseScore.NotationScene", 1, 0, "RestsPageModel");
200-
qmlRegisterType<DynamicsPageModel>("MuseScore.NotationScene", 1, 0, "DynamicsPageModel");
201199
qmlRegisterType<BeamsPageModel>("MuseScore.NotationScene", 1, 0, "BeamsPageModel");
202200

203201
qRegisterMetaType<EditStyle>("EditStyle");

src/notation/notationscene.qrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,5 @@
3636
<file>qml/MuseScore/NotationScene/internal/NotationScrollBar.qml</file>
3737
<file>qml/MuseScore/NotationScene/PianoKeyboardPanel.qml</file>
3838
<file>qml/MuseScore/NotationScene/internal/EditStyle/RestOffsetSelector.qml</file>
39-
<file>qml/MuseScore/NotationScene/internal/EditStyle/DynamicsAlignmentSelector.qml</file>
4039
</qresource>
4140
</RCC>

src/notation/qml/MuseScore/NotationScene/internal/EditStyle/DynamicsAlignmentSelector.qml

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/notation/view/styledialog/dynamicspagemodel.cpp

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/notation/view/styledialog/dynamicspagemodel.h

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/notation/view/styledialog/styledialog.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,4 @@ set(STYLEDIALOG_SRC
1010
${CMAKE_CURRENT_LIST_DIR}/restspagemodel.h
1111
${CMAKE_CURRENT_LIST_DIR}/beamspagemodel.cpp
1212
${CMAKE_CURRENT_LIST_DIR}/beamspagemodel.h
13-
${CMAKE_CURRENT_LIST_DIR}/dynamicspagemodel.cpp
14-
${CMAKE_CURRENT_LIST_DIR}/dynamicspagemodel.h
1513
)

src/notation/view/widgets/editstyle.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -757,20 +757,6 @@ EditStyle::EditStyle(QWidget* parent)
757757
beamsPage->setResizeMode(QQuickWidget::SizeRootObjectToView);
758758
groupBox_beams->layout()->addWidget(beamsPage);
759759

760-
// ====================================================
761-
// Rests (QML)
762-
// ====================================================
763-
764-
QQuickWidget* dynamicsAlignmentSelector = new QQuickWidget(/*QmlEngine*/ uiEngine()->qmlEngine(),
765-
/*parent*/ groupBox_DynamicsAlignment);
766-
dynamicsAlignmentSelector->setObjectName("dynamicsAlignmentSelector_QQuickWidget");
767-
dynamicsAlignmentSelector->setSource(
768-
QUrl(QString::fromUtf8("qrc:/qml/MuseScore/NotationScene/internal/EditStyle/DynamicsAlignmentSelector.qml")));
769-
dynamicsAlignmentSelector->setMinimumSize(childrenRect().size());
770-
dynamicsAlignmentSelector->setMinimumWidth(240);
771-
dynamicsAlignmentSelector->setResizeMode(QQuickWidget::SizeRootObjectToView);
772-
groupBox_DynamicsAlignment->layout()->addWidget(dynamicsAlignmentSelector);
773-
774760
// ====================================================
775761
// Figured Bass
776762
// ====================================================

0 commit comments

Comments
 (0)