-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
KnobComposed masked ring #645
KnobComposed masked ring #645
Conversation
…tically masked. A new "Ring" pixmap is added to WKnobComposed. It is automatically masked between MinAngle and MaxAngle as the knob is turned. The new "Centered" tag makes the ring totally masked at 12 o'clock position and makes it "sweep-in" as the knob is turned from there. The new "RingMaskXOffset" and "RingMaskYOffset" should be used in case the Ring pixmap is not exactly centered in the middle of the canvas. They are relative to the center of the canvas.
I have tested this patch and it just works. Please move the test skin changes to https://github.com/mixxxdj/developer_skins. This way we can merge this without destroying anything.
I am afraid this will be hard to explain. "The background is not the bottom layer" |
QPainterPath path; | ||
int w = width(); | ||
int h = height(); | ||
path.moveTo(w/2.0 + m_iMaskXOffset, h/2.0 + m_iMaskYOffset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These calculations are hard to understand. Please use intermediate variables with explaining names and add more comments.
"Centered" is hard to understand and somehow too common. |
RingMaskXOffset is hard to understand. |
Thank you for reviewing this @daschuer later I'll try to address what you've commented.
You're right, this totally needs to be done. I'll see if I can achieve that.
We can't get rid of the offset tags. As you can see in the picture, if the ring is not centered in the picture but the mask is draw centered, it just doesn't work.
Thats a good idea and might work well with plain designs. But if designers want to give the skin some 3D sense, they'll probably have the knob offset from the center. |
Thank you for the drawings. They clarify much. IMHO the ring center point should be match the knob center by default. Could "RingMaskXOffset" become "RingCenterXOffset"? |
Well, you almost guess what's really going on :) The mask is a pie like in the drawing, but the radius is actually the minimum that makes the rectangle containing the pixmaps to be inscribed inside the pie. What this means is that the whole knob area is masked, the picture I sent is not correct in this aspect. Actually, the code you said is not clear (which I'm going to rewrite and comment) does the calculations needed for this..
That's actually very reasonable, I'll fix this too.
Well, I'm the demand :) Additionally, this PR doesn't break neither modify any preexisting functionality, so it is safe in that aspect. |
Sure! And I like this feature as well. I was only worrying about the ring offset feature. |
Automated Message from BuildBot: Mixxx Admins, is this safe to test? Respond with: "ok to test", "add to whitelist", "skip ci", or "test this please" (to retest). |
add to whitelist |
Ok, go ahead and thank you again for the good explanations. |
Oh, how shall I commit changes to developer skins? Shall I issue a PR with a copy of LateNight with the changes applied to it? |
Now ring appears on top of background.
Yes. You may also maintain it as you own testing skin there. |
and "RingMaskYOffset" to "RingCenterYOffset".
Ok it turns out that this is a bit trickier than I thought. For CO we have defaultValue(). But defaultValue is not necessarily the reference value from which the ring mask should start expanding. Furthermore, in the future we might offer the user the possibility to customize the controls default values, like Traktor does with the FX parameters. Clearly, we can't tie this with the CO defaultValue. How can we handle this? Shall I add a new double member to CO that tells where the ring should start expanding, maybe something like "neutralValue" or "noEffectValue"? |
"neutralValue" as a general ControlPotmeter addition sounds reasonable. I think if this defaults to zero it will fit for almost all COs. |
How do I get to the corresponding ControlPotmeter from WKnobComposed? From its m_connections inherited from WBaseWidget? |
Right. You may do it like this: |
Ok, so I've just realised I don't really understand how this should work, sorry. Right now, in WKnobComposed, I have the ConfigKey of the corresponding CO. But, if I create a ControlPotmeter from it, the neutralValue is created arbitrarily on that ControlPotmeter, like m_stepCount for example. I don't know how each CO could have a specific neutralValue. Shouldn't neutralValue be in ControlDoublePrivate like defaultValue in order to achieve that? On the other hand, I understand neutralValue doesn't make sense for a binary CO, so it seems to me that the correct place would indeed be ControlPotmeter. So I'm a bit confused :( |
ah, I see. You cannot create a ControlPotmeter from an existing key. You can only create a ControObjectSlave to access the atomic value of the control Object. You can also not access the ControlPotmeter via ControlParameterWidgetConnection -> ControlObjectSlave -> ControDoublePrivate A possible solution would be to add getNeutralParameter() to the ControDoublePrivate and fill it by the ControlPotmeterBehavior class. I wonder if this will fit to the target that we are able to change the NeutralParameter / NeutralValue on the effect knobs. By the way: Parameter = normalized Value |
Thank you Daniel. I'm definitely going to finish this, but It's just a cosmetic feature, so I'm going to see if I can fix other skin issues first. |
@daschuer can you give me some more details about this? I don't really understand what you mean. |
@@ -122,6 +131,8 @@ class EffectManifest { | |||
bool m_isMasterEQ; | |||
// This helps us at DlgPrefEQ's basic selection of Filter knob effects | |||
bool m_isForFilterKnob; | |||
// This helps the skin draw knob rings correctly. | |||
double m_dSuperKnobScaleStart; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove m_dSuperKnobScaleStart from the manifest.
It is a property of each effect parameter, but that is can be postponed to an later PR.
Your developer skins are working real nice, Thank you. |
Fixed comment in ControlAudioTaperPot. Tabs -> Spaces.
I addressed the issues. |
@@ -25,7 +25,6 @@ class EffectManifest { | |||
: m_isMixingEQ(false), | |||
m_isMasterEQ(false), | |||
m_isForFilterKnob(false), | |||
m_dSuperKnobScaleStart(0.0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this removes this initializer only ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow sorry. Solved.
Travis has detected an issue:
|
Sorry, I'll fix that. Should I completely remove knob rings from effect super knob or leave it with a default value like 0? |
Yes. |
What's the status on this PR? |
I plan to give it some love soon. |
This pull request has not been updated in years so I am closing it to reduce the clutter of open PRs. If you solve the merge conflicts and would like to have this merged in the future, please reopen it. |
We have the commitment that this will be revived soon. |
My commitment for this is for 2.3 release. I'll rework it in a new branch anyway, so I'm closing this branch. I've filed a bug in launchpad to track this: https://bugs.launchpad.net/mixxx/+bug/1765399 |
Added support for a new "Ring" pixmap in WKnobComposed that is automatically masked.
A new "Ring" pixmap is added to WKnobComposed. It is automatically masked between MinAngle and MaxAngle as the knob is turned.
The BackPath pixmap is drawn on top of the new "Ring" pixmap. This allows the background to cast shadows to the ring.
The new "Centered" tag makes the ring totally masked at 12 o'clock position and makes it "sweep-in" as the knob is turned from there.
The new "RingMaskXOffset" and "RingMaskYOffset" should be used in case the Ring pixmap is not exactly centered in the middle of the canvas. They are relative to the center of the canvas.
The last commit is just to show the changes in action, it should be reverted before merging this PR. The new knobs are a bit ugly, I made them quickly. Don't judge this PR for their looks :)
LateNight probably needs a new set of knobs that integrate the ring well, if this PR is accepted, I'll make a new one with better knobs for LateNight.