Skip to content

Commit c7e6d71

Browse files
committed
Recall key & remove existing logic
This sets the key to the key at the point of selection in the score which isn't very useful
1 parent d701ae9 commit c7e6d71

File tree

2 files changed

+2
-35
lines changed

2 files changed

+2
-35
lines changed

src/notation/view/widgets/transposedialog.cpp

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ TransposeDialog::TransposeDialog(QWidget* parent)
5959
});
6060
setEnableTransposeChordNames(hasChordNames);
6161

62-
setKey(firstPitchedStaffKey());
6362
restorePreviousSettings();
6463

6564
connect(this, &TransposeDialog::accepted, this, &TransposeDialog::apply);
@@ -252,38 +251,6 @@ void TransposeDialog::apply()
252251
}
253252
}
254253

255-
Key TransposeDialog::firstPitchedStaffKey() const
256-
{
257-
mu::engraving::staff_idx_t startStaffIdx = 0;
258-
mu::engraving::staff_idx_t endStaffIdx = 0;
259-
Fraction startTick = Fraction(0, 1);
260-
INotationSelectionRangePtr range = selection()->range();
261-
262-
if (selection()->isRange()) {
263-
startStaffIdx = range->startStaffIndex();
264-
endStaffIdx = range->endStaffIndex();
265-
startTick = range->startTick();
266-
}
267-
268-
Key key = Key::C;
269-
270-
for (const Part* part : notation()->parts()->partList()) {
271-
for (const Staff* staff : part->staves()) {
272-
if (staff->idx() < startStaffIdx || staff->idx() > endStaffIdx) {
273-
continue;
274-
}
275-
276-
if (staff->isPitchedStaff(startTick)) {
277-
key = staff->concertKey(startTick);
278-
279-
break;
280-
}
281-
}
282-
}
283-
284-
return key;
285-
}
286-
287254
void TransposeDialog::setEnableTransposeKeys(bool val)
288255
{
289256
transposeKeys->setEnabled(val);
@@ -380,6 +347,7 @@ void TransposeDialog::restorePreviousSettings()
380347
setInterval(options.interval);
381348
setUseDoubleSharpsFlats(options.needTransposeDoubleSharpsFlats);
382349
setTransposeChordNames(options.needTransposeChordNames);
350+
setKey(options.key);
383351
}
384352

385353
TransposeOptions& TransposeDialog::lastUsedOptions()

src/notation/view/widgets/transposedialog.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ private slots:
5555
INotationSelectionPtr selection() const;
5656
INotationInteractionPtr interaction() const;
5757

58-
Key firstPitchedStaffKey() const;
5958
void setEnableTransposeKeys(bool val);
6059
void setEnableTransposeToKey(bool val);
6160
void setEnableTransposeChordNames(bool val);
@@ -71,9 +70,9 @@ private slots:
7170
void setKey(Key k);
7271
bool useDoubleSharpsFlats() const;
7372

73+
void restorePreviousSettings();
7474
void setDirection(TransposeDirection direction);
7575
void setInterval(int interval);
76-
void restorePreviousSettings();
7776
void setUseDoubleSharpsFlats(bool val);
7877
void setTransposeChordNames(bool val);
7978

0 commit comments

Comments
 (0)