implementation of color association with keyboard digits#566
Conversation
|
Hi Lulu! Thanks for the draft. It is a good base for implementation. It's apparent that a lot of consideration went into addressing various use-case scenarios, which is commendable. Let's dive into the details of it. The In a similar fashion, I suggest to rename Forwarding keys to the main form is a wise move. It would be beneficial to also relay the key press events (using the The '6' key conflict is a natural outcome considering the French keyboard layouts. Other layouts will have similar conflicts. I'm inclined towards leaving this as it is for now. The user can hold Shift or not using this digit to work around this. About the effect of pressing digits changing the alpha slider, I've found the reason and fixed it on dev. It was because the opacity updown in the pen color interface was inadvertently active. I disabled it until it is visible so it won't change the alpha value. I invite you to retrieve last version. You can proceed with re-enabling the numpad check. You say that when the user recall a color with alpha different than 255, the right alpha is set only if the palette is in mode includes alpha channel. This is intriguing indeed. If we keep the idea of following the palette option, which will make sense if we add an option to save the palette with the key bindings, I propose the following. If the palette is not in alpha mode:
Some additional observations on my end:
Don't hesitate to come back to me to do more testing. Warm regards |
|
Hi, I've done the changes you've suggested. About ignore alpha channel when looking up for a color to see its association (palette not in alpha mode), it introduce a new issue: at startup, the black color in the palette is displayed with the About the digit doesn't seem to display in the palette: do you added the color to the palette ?
Assigning a color to a digit don't add it automatically to the palette: this behavior is ok ? Edit: there is another keyboard conflict (at least on Windows): to reproduce, assign a color to a digit, choose the pen tool, change the pen width with the up/down arrow or with the slider or enter its value with the keyboard. Now press the digit to recall the registered color -> the pen width change. This is because the pen width TBCTrackBarUpDown still have the focus. Clicking to another part of the main window or press |
|
Hi Lulu! Firstly, thank you for the rapid iterations and your detailed observations. This allows me to have a clear view of the intricacies. I understand the problem with transparent color being like black and the refactoring you applied. There are some cases that are not handled yet:
To solve all these issues, I propose the following:
We could utilize the capabilities of uses fgl;
type
TBGRAPixelBinding = specialize TFPGMap<integer, TBGRAPixel>; This type to hold the colors, needs to be created/freed as a regular object. To set a new binding you can still do Building on the notion of managing color bindings, perhaps introducing an option to unbind a color by employing a combo like Ctrl-Alt and a digit (0-9) could enhance user flexibility.
It seems reasonable at the moment. We can observe user feedback and make adjustments if needed. As for the visibility issue, with latest version, I can see a digit in the palette, but it is very small. I suggest to set the height of the font explicitely, for example via Regarding the keyboard conflict, this is a tricky one. You're right, there are certain controls like the At the end of the It would make sense as well to release the focus when one clicks on the The aim here is of course to make the experience seamless for the user. I'm confident that with these tweaks and constant communication between us, we can get there. So please keep the feedback coming! |
|
Hi!
What do you think if Ctrl+digit toggle the bindind ? Only one key to keep in memory, good for lazy user like me! |
|
Hi !
Yes, maps/dictionaries are a fantastic structure.
That's a good point! I like the simplicity. Let's go with that approach. |
|
Hi, I was busy yesterday.
Would you suggest using a key based on UTF8String to be ready for a possible future extension using keys other than digits? If the answer is yes, I suggest to keep the key detection in |
|
Hello Lulu, That's completely alright. Everyone has those busy days.
You're thinking ahead, which is great. I was rather mentioning it because when you define a map you can choose the key type. For now it is integer, so that's the type to provide to the map.
Indeed, using the virtual key codes ( Your remarks are spot on. I suggest to focus for now on a simple version handling only digits, but it is always great to have some idea of where the code might be going. Warm regards |
|
Hi Circular, I move forward cautiously and in small steps.
If I understand correctly, the function Currently the |
|
Hi Lulu! It's great your considering all details and possible side effects. About the addition to |
|
Hi Circular,
Don't hesitate if you see any possible bug, better code construction or better name for procedure! Regards |
|
Hi Lulu! Thanks for the thorough job. We did it. I have merged the changes! One new feature for LazPaint :) I've made a minor adjustment on the Warm regards |
|
Cool ! Thank you for giving me the opportunity to participate in your project! 👍 |
|
Hi Lulu! I acknowledge the complexity of the codebase, it's been a journey spanning decades to write it all. Given this, I am considering ways to make it more modular, hoping it will simplify modifications and further improvements in the future. It's a pleasure having you on board! Contributions like yours are what make open source projects thrive. Thank you for your kind words. Warm regards |
Hi Circular,
here's the first draft to associates key digit with user colors. I followed your explanations with a few additions:
one have to redraw the
TChooseColorInterfaceinstance when the user associates a color to a digit to show the number immediately. It is done throughTLazPaintInstance(added procedureFChooseColorSimpleRedraw).TChooseColorInterfaceinstance must retrieve the digit associated with its current color, so a 'bridge' to theTPaletteToolbarinstance is necessary. It is done throughTLazPaintInstance(added a functionGetDigitFromColorsBindToKey).if the user associates a color to a digit while
FChooseColorwindow is focused, the main window don't receive keyboard input, so no association is done. The solution I've found is to propagate the key down/up event from theFChooseColorwindow to the main window throughTLazPaintInstance(added methodSendKeyDownEventToMainFormandSendKeyUpEventToMainForm).My English is not very good, a better name can probably be given to the new procedures. You have an overall view of the code maybe some of them can be avoided?
It seems to work, but a few issues have appeared:
6key: it is already assigned to zoom out.UChooseColor/UChooseColorInterface: the numeric keypad keys 0 to 9 modify the position of the opacity slider when it is lower than the maximum. I don't know if this is normal behavior. This behavior appears also on LazPaint 7.2.2 (github release). This cause a confusion when user use the numpad to associate color to digit. Solution: use only the keyboard digit, not those on the numpad (I've commented the code that check the numpad key in unitUPaletteToolbarprocedureTPaletteToolbar.CatchToolKeyDown).includes alpha channel. This can be confusing.Regards