Skip to content

Commit

Permalink
Merge pull request #23360 from alexpavlov96/gp_ghost_notes_tabs
Browse files Browse the repository at this point in the history
adding ghost note to standard staff in experimental mode
  • Loading branch information
alexpavlov96 authored Jun 28, 2024
2 parents 8f843b8 + b039c8c commit c342668
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/engraving/iengravingconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ class IEngravingConfiguration : MODULE_EXPORT_INTERFACE

/// these configurations will be removed after solving https://github.com/musescore/MuseScore/issues/14294
virtual bool guitarProImportExperimental() const = 0;
virtual bool useStretchedBends() const = 0;
virtual bool shouldAddParenthesisOnStandardStaff() const = 0;
virtual bool negativeFretsAllowed() const = 0;
virtual bool crossNoteHeadAlwaysBlack() const = 0;
virtual bool enableExperimentalFretCircle() const = 0;
Expand Down
10 changes: 10 additions & 0 deletions src/engraving/internal/engravingconfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,16 @@ bool EngravingConfiguration::guitarProImportExperimental() const
return guitarProConfiguration() ? guitarProConfiguration()->experimental() : false;
}

bool EngravingConfiguration::useStretchedBends() const
{
return guitarProImportExperimental();
}

bool EngravingConfiguration::shouldAddParenthesisOnStandardStaff() const
{
return guitarProImportExperimental();
}

bool EngravingConfiguration::negativeFretsAllowed() const
{
return guitarProImportExperimental();
Expand Down
2 changes: 2 additions & 0 deletions src/engraving/internal/engravingconfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class EngravingConfiguration : public IEngravingConfiguration, public muse::Inje
bool isAccessibleEnabled() const override;

bool guitarProImportExperimental() const override;
bool useStretchedBends() const override;
bool shouldAddParenthesisOnStandardStaff() const override;
bool negativeFretsAllowed() const override;
bool crossNoteHeadAlwaysBlack() const override;
bool enableExperimentalFretCircle() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/dev/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3042,7 +3042,7 @@ void ChordLayout::layoutChordBaseFingering(Chord* chord, System* system, LayoutC

void ChordLayout::layoutStretchedBends(Chord* chord, LayoutContext& ctx)
{
if (!chord->configuration()->guitarProImportExperimental()) {
if (!chord->configuration()->useStretchedBends()) {
return;
}

Expand Down
9 changes: 9 additions & 0 deletions src/engraving/rendering/dev/tlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4246,6 +4246,15 @@ void TLayout::layoutNote(const Note* item, Note::LayoutData* ldata)
} else if (item->harmonic()) {
const_cast<Note*>(item)->setHeadGroup(NoteHeadGroup::HEAD_DIAMOND);
}

if (item->configuration()->shouldAddParenthesisOnStandardStaff()) {
if (item->ghost()) {
const_cast<Note*>(item)->setHeadHasParentheses(true, /* addToLinked= */ false, /* generated= */ true);
} else {
const_cast<Note*>(item)->setHeadHasParentheses(false, /* addToLinked= */ false);
}
}

SymId nh = item->noteHead();
if (item->configuration()->crossNoteHeadAlwaysBlack() && ((nh == SymId::noteheadXHalf) || (nh == SymId::noteheadXWhole))) {
nh = SymId::noteheadXBlack;
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/rendering/stable/chordlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,7 @@ void ChordLayout::layoutChordBaseFingering(Chord* chord, System* system, LayoutC

void ChordLayout::layoutStretchedBends(Chord* chord, LayoutContext& ctx)
{
if (!chord->configuration()->guitarProImportExperimental()) {
if (!chord->configuration()->useStretchedBends()) {
return;
}

Expand Down
2 changes: 2 additions & 0 deletions src/engraving/tests/mocks/engravingconfigurationmock.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class EngravingConfigurationMock : public IEngravingConfiguration
MOCK_METHOD(bool, isAccessibleEnabled, (), (const, override));

MOCK_METHOD(bool, guitarProImportExperimental, (), (const, override));
MOCK_METHOD(bool, useStretchedBends, (), (const, override));
MOCK_METHOD(bool, shouldAddParenthesisOnStandardStaff, (), (const, override));
MOCK_METHOD(bool, negativeFretsAllowed, (), (const, override));
MOCK_METHOD(bool, crossNoteHeadAlwaysBlack, (), (const, override));
MOCK_METHOD(bool, enableExperimentalFretCircle, (), (const, override));
Expand Down
4 changes: 0 additions & 4 deletions src/importexport/guitarpro/internal/gtp/gpconverter.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "gpconverter.h"

#include <chrono>

#include "translation.h"

#include "../importgtp.h"
Expand All @@ -25,7 +23,6 @@
#include "engraving/dom/fretcircle.h"
#include "engraving/dom/glissando.h"
#include "engraving/dom/gradualtempochange.h"
#include "engraving/dom/hairpin.h"
#include "engraving/dom/instrchange.h"
#include "engraving/dom/jump.h"
#include "engraving/dom/keysig.h"
Expand All @@ -49,7 +46,6 @@
#include "engraving/dom/tie.h"
#include "engraving/dom/timesig.h"
#include "engraving/dom/tremolosinglechord.h"
#include "engraving/dom/trill.h"
#include "engraving/dom/tripletfeel.h"
#include "engraving/dom/tuplet.h"
#include "engraving/dom/volta.h"
Expand Down
3 changes: 0 additions & 3 deletions src/importexport/guitarpro/internal/gtp/gpconverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
#include "../continiouselementsbuilder.h"
#include "types/fraction.h"

#include "engraving/dom/vibrato.h"
#include "engraving/dom/ottava.h"

#include "iengravingconfiguration.h"

namespace mu::iex::guitarpro {
Expand Down
9 changes: 1 addition & 8 deletions src/importexport/guitarpro/internal/importgtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "importptb.h"

#include "realfn.h"
#include "translation.h"

#include "engraving/types/typesconv.h"
#include "engraving/types/symid.h"
Expand All @@ -48,20 +47,16 @@
#include "engraving/dom/factory.h"
#include "engraving/dom/fret.h"
#include "engraving/dom/glissando.h"
#include "engraving/dom/hairpin.h"
#include "engraving/dom/harmony.h"
#include "engraving/dom/instrchange.h"
#include "engraving/dom/instrtemplate.h"
#include "engraving/dom/keysig.h"
#include "engraving/dom/letring.h"
#include "engraving/dom/lyrics.h"
#include "engraving/dom/masterscore.h"
#include "engraving/dom/measure.h"
#include "engraving/dom/measurebase.h"
#include "engraving/dom/note.h"
#include "engraving/dom/notedot.h"
#include "engraving/dom/ottava.h"
#include "engraving/dom/palmmute.h"
#include "engraving/dom/part.h"
#include "engraving/dom/rehearsalmark.h"
#include "engraving/dom/rest.h"
Expand All @@ -78,9 +73,7 @@
#include "engraving/dom/tie.h"
#include "engraving/dom/timesig.h"
#include "engraving/dom/tuplet.h"
#include "engraving/dom/tremolobar.h"
#include "engraving/dom/volta.h"
#include "engraving/dom/vibrato.h"

#include "log.h"

Expand Down Expand Up @@ -959,7 +952,7 @@ void GuitarPro::createBend(Note* note, std::vector<PitchValue>& bendData)
return;
}

bool useStretchedBends = engravingConfiguration()->guitarProImportExperimental();
bool useStretchedBends = engravingConfiguration()->useStretchedBends();

if (useStretchedBends) {
Chord* chord = toChord(note->parent());
Expand Down

0 comments on commit c342668

Please sign in to comment.