Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #298126: added the ability to rotate and offset instrument names #5868

Closed

Conversation

SKefalidis
Copy link
Contributor

Resolves: https://musescore.org/en/node/298126

Added the ability to rotate and offset in the TextBase class and added the relevant UI in the EditStaff menu.

  • I signed CLA
  • I made sure the code in the PR follows the coding rules
  • I made sure the code compiles on my machine
  • I made sure there are no unnecessary changes in the code
  • I made sure the title of the PR reflects the core meaning of the issue you are solving
  • I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
  • I made sure the commit message title starts with "fix #424242:" if there is a related issue
  • [] I created the test (mtest, vtest, script test) to verify the changes I made

@SKefalidis SKefalidis force-pushed the textbase_rotate_offset branch 5 times, most recently from e846a59 to d2daf3e Compare March 25, 2020 12:10
libmscore/part.h Outdated
@@ -55,6 +55,9 @@ enum class PreferSharpFlat : char {
class Part final : public ScoreElement {
QString _partName; ///< used in tracklist (mixer)
InstrumentList _instruments;
int _instrumentNameRotation { 0 };
int _instrumentNameOffsetX { 0 };
int _instrumentNameOffsetY { 0 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offsets are best replaced with a single variable of type QPoint

@@ -243,11 +243,17 @@ class TextBase : public Element {
int hexState { -1 };
bool _primed { 0 };

QRectF _basebbox; // used to rotate and offset the text
int _offsetX { 0 }, _offsetY { 0 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offsets are best replaced with a single variable of type QPoint

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great, I'll take care of it later today :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@igorkorsukov I used QPointF instead of QPoint because e.readPoint() returns a QPointF.

I would like to hear your opinion on the following matter. Should I change the arguments of setOffsets/setInstrumentNameOffset from 2 ints(x and y) to a QPointF? I like how it is very simple to just pass 2 numbers and be done with it, but I can't help but think that passing a QPointF is cleaner.

<number>-90</number>
</property>
<property name="maximum">
<number>90</number>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't +/-180 make sense too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and a tooltip about what turns clockwise and what counter clock wise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jojo-Schmitz

wouldn't +/-180 make sense too?

The letters would be upside down, wouldn't they?

and a tooltip about what turns clockwise and what counterclockwise

Sounds good. I should probably add tooltips for the offsets too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, 180° is upside down. Not sure it is of much use, but why restrict.

<item row="2" column="0">
<widget class="QLabel" name="rotationLabel">
<property name="toolTip">
<string>Negative values rotate counterclowise, positive values clockwise (-180...180).</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo "counterclowise". Also not sure whether we want to show the limits, but if, then with a "°" sign

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that displaying the limits will help. And you are right about the sign, I'll add units in all of them.

<item row="2" column="1">
<widget class="QSpinBox" name="rotationInput">
<property name="toolTip">
<string>Negative values rotate counterclowise, positive values clockwise (-180...180).</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito

<item row="3" column="1">
<widget class="QSpinBox" name="spinBoxOffsetX">
<property name="toolTip">
<string>Negative values move left, positive values move right (-200, 200).</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about whether to show the limits, but if, then with the unit ("sp"?)

<item row="4" column="1">
<widget class="QSpinBox" name="spinBoxOffsetY">
<property name="toolTip">
<string>Negative values move upwards, positive values move downwards (-200, 200).</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito

<item row="3" column="0">
<widget class="QLabel" name="labelOffsetX">
<property name="toolTip">
<string>Negative values move left, positive values move right (-200, 200).</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about whether to show the limits, but if, then with the unit ("sp"?)

<item row="4" column="0">
<widget class="QLabel" name="labelOffsetY">
<property name="toolTip">
<string>Negative values move upwards, positive values move downwards (-200, 200).</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about whether to show the limits, but if, then with the unit ("sp"?)

<width>760</width>
<height>600</height>
<width>797</width>
<height>757</height>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we avoid this change? Just not commit this chunk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jojo-Schmitz
I was forced to increase the height (not sure when the width changed) because there wasn't enough space for the spinboxes. The thing is that as I've said in the Telegram chat, I have 2 conflicting pull requests with UI changes. No matter which one gets merged first I'll be forced to make changes in the UI.

<x>248</x>
<y>254</y>
<x>650</x>
<y>677</y>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

<x>316</x>
<y>260</y>
<x>718</x>
<y>677</y>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dito

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.

<item row="3" column="1">
<widget class="QSpinBox" name="spinBoxOffsetX">
<property name="toolTip">
<string>Negative values move left, positive values move right (-200sp, 200sp).</string>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be great to have offsets, thanks for creating this PR.
Will these limits be enough for cutaway scores? Sometimes a huge horizontal indent is needed:
image

@Jojo-Schmitz
Copy link
Contributor

rebase needed

@RobFog
Copy link

RobFog commented Sep 14, 2020

Rebase still necessary.

@vpereverzev vpereverzev added the archived PRs that have gone stale but could potentially be revived in the future label Dec 31, 2020
@vpereverzev
Copy link
Member

Archived due to long inactivity. Could be re-opened later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archived PRs that have gone stale but could potentially be revived in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants