Don't reset alpha when specified in hex value.

Also fixes a bug with colour picker cursor drawing on Mac.

Fixes https://gitlab.com/kicad/code/kicad/issues/14646
This commit is contained in:
Jeff Young 2023-04-29 17:50:29 +01:00
parent f4b43617e7
commit a817b4c1ff
2 changed files with 13 additions and 11 deletions

View File

@ -396,7 +396,7 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
#if wxCHECK_VERSION( 3, 1, 7 ) && !defined( __WXMAC__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
@ -466,7 +466,7 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
#if wxCHECK_VERSION( 3, 1, 7 ) && !defined( __WXMAC__)
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
@ -701,12 +701,14 @@ void DIALOG_COLOR_PICKER::onHSVMouseDrag( wxMouseEvent& event )
void DIALOG_COLOR_PICKER::OnColorValueText( wxCommandEvent& event )
{
m_newColor4D.SetFromHexString( m_colorValue->GetValue() );
if( m_newColor4D.SetFromHexString( m_colorValue->GetValue() ) )
{
m_newColor4D.ToHSV( m_hue, m_sat, m_val, true );
SetEditVals( HEX_CHANGED, true );
SetEditVals( HEX_CHANGED, false );
drawAll();
}
}
bool DIALOG_COLOR_PICKER::setHSvaluesFromCursor( const wxPoint& aMouseCursor )

View File

@ -179,7 +179,7 @@ bool COLOR4D::SetFromHexString( const wxString& aColorString )
str.Trim( true );
str.Trim( false );
if( str.length() < 7 || str.GetChar( 0 ) != '#' )
if( str.length() < 7 || !str.StartsWith( '#' ) )
return false;
unsigned long tmp;