Replace default gtk color picker
I'm not sure if this fully covers #761 because it does not act like an overlay like PDN's color picker does, but it at least provides a superior color picker alternative.
This replaces the default gtk color picker with a custom one. It allows editing both primary and secondary, HSV color circle and Sat / Val square, RGB and HSV color sliders with color previewing and manual input entries.
I may try slimming it down and getting it as a non-blocking dialog so you dont have to keep reopening it and can keep it open a la PDN, but that would conflict with the recent palettes (Currently the recent palettes only update on OK, but if i change it to overlay, when should the recent palettes update? on any color change? i reckon that'd update way too fast.)
Good
Decided why not, so I tried making a "live" color picker with a smaller version. Turning out well so far, I probably should have tried to give this a crack before opening PR.
Can't figure out opacity, but it might just be nvidia+wayland messery.
I think this now covers 761, because the color picker can now be left out as a separate window while editing.
Changing palette swatch still invokes blocking color picker.
Alright, I think i managed to get all the feedback implemented. Thanks for the feedback.
In the meantime, I was playing around more with the opacity and I managed to get it to work! Turns out it wasn't wayland+nvidia, it just wasn't signaling to wayland (i think) that the window could be transparent, but setting opacity at 99.5% on dialog startup seems to resolve it :)
Here's that opacity in action, at 85%. Switches back to 100% opaque when clicked over.
Sorry about the long delays. Got caught up with some things
Will save it for a later PR, but I was considering switching the Hue & Sat and Sat & Val with a dropdown to accommodate future color map styles. Oklab was one i was looking at. as it stands the two-button is probably better for the two options
Was also considering removing that "Add Alpha" checkbox and just force it on. i don't think its that important, but i just got caught up while implementing it.
Thanks for the updates!
Will save it for a later PR, but I was considering switching the Hue & Sat and Sat & Val with a dropdown to accommodate future color map styles. Oklab was one i was looking at. as it stands the two-button is probably better for the two options
Switching to a dropdown in the future sounds good if there are more options, but the current layout looks fine to me
Was also considering removing that "Add Alpha" checkbox and just force it on. i don't think its that important, but i just got caught up while implementing it.
Agreed, if that's only affecting the hex code output then I think it could just always be forced on
There are a number of nullable warnings still to be fixed (see below), but otherwise I think this is good to merge
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(31,17): warning CS8618: Non-nullable property 'Text' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(33,21): warning CS8618: Non-nullable property 'TopWindow' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'top_box' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'swatch_box' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'title_bar' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'color_display_box' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'color_displays' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'picker_surface_selector_box' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'picker_surface_box' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'picker_surface_overlay' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'picker_surface' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'picker_surface_cursor' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'picker_surface_option_draw_value' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'swatch_recent' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'swatch_palette' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'hex_entry' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'hex_entry_add_alpha' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'sliders_box' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'hue_cps' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'sat_cps' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'val_cps' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'r_cps' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'g_cps' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'b_cps' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
/Users/cameron/code/Pinta/Pinta.Gui.Widgets/Widgets/ColorPickerDialog.cs(792,9): warning CS8618: Non-nullable field 'a_cps' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
For fields that are initialized by the Setup() method, one option is to use attributes to tell the compiler about this (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/attributes/nullable-analysis#helper-methods-membernotnull-and-membernotnullwhen). Alternatively, the initialization can happen in the constructor while other helper methods do the work of creating the widgets, e.g. https://github.com/PintaProject/Pinta/blob/master/Pinta/Dialogs/NewImageDialog.cs#L80
I decided to just merge setup into the constructor, should clean up all the non-nullable issues. Removed the alpha as well.
Thank you! I'll merge this after fixing up a couple merge conflicts
Merged in 805c07d1d301fcd9661b2cc492f578988b66413c with some fixes for merge conflicts
Thanks for the great work on this!