3D-Viewer: add color to "Clear Color" action in the color picker

This commit is contained in:
Mario Luzeiro 2020-08-27 22:49:53 +01:00 committed by Jon Evans
parent 40d5746df6
commit 7c9bb9ab07
2 changed files with 10 additions and 8 deletions

View File

@ -840,12 +840,13 @@ void EDA_3D_VIEWER::RenderEngineChanged()
bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC4F &aColor, const wxString& aTitle, bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC4F &aColor, const wxString& aTitle,
CUSTOM_COLORS_LIST* aPredefinedColors, CUSTOM_COLORS_LIST* aPredefinedColors,
bool aAllowOpacityControl ) bool aAllowOpacityControl,
KIGFX::COLOR4D aDefaultColor )
{ {
KIGFX::COLOR4D newcolor; KIGFX::COLOR4D newcolor;
KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 - aColor.a ); KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 - aColor.a );
DIALOG_COLOR_PICKER picker( this, oldcolor, aAllowOpacityControl, aPredefinedColors ); DIALOG_COLOR_PICKER picker( this, oldcolor, aAllowOpacityControl, aPredefinedColors, aDefaultColor );
if( picker.ShowModal() != wxID_OK ) if( picker.ShowModal() != wxID_OK )
return false; return false;
@ -871,7 +872,7 @@ bool EDA_3D_VIEWER::Set3DSilkScreenColorFromUser()
colors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
colors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
if( Set3DColorFromUser( m_boardAdapter.m_SilkScreenColorTop, _( "Silkscreen Color" ), &colors ) ) if( Set3DColorFromUser( m_boardAdapter.m_SilkScreenColorTop, _( "Silkscreen Color" ), &colors, false, colors[0].m_Color ) )
{ {
m_boardAdapter.m_SilkScreenColorBot = m_boardAdapter.m_SilkScreenColorTop; m_boardAdapter.m_SilkScreenColorBot = m_boardAdapter.m_SilkScreenColorTop;
NewDisplay( true ); NewDisplay( true );
@ -901,7 +902,7 @@ bool EDA_3D_VIEWER::Set3DSolderMaskColorFromUser()
colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, 1.0 - 0.17, "Purple" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, 1.0 - 0.17, "Purple" ) );
colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, 1.0 - 0.17, "Purple Dark" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, 1.0 - 0.17, "Purple Dark" ) );
if( Set3DColorFromUser( m_boardAdapter.m_SolderMaskColorTop, _( "Solder Mask Color" ), &colors, true ) ) if( Set3DColorFromUser( m_boardAdapter.m_SolderMaskColorTop, _( "Solder Mask Color" ), &colors, true, colors[0].m_Color ) )
{ {
m_boardAdapter.m_SolderMaskColorBot = m_boardAdapter.m_SolderMaskColorTop; m_boardAdapter.m_SolderMaskColorBot = m_boardAdapter.m_SolderMaskColorTop;
@ -926,7 +927,7 @@ bool EDA_3D_VIEWER::Set3DCopperColorFromUser()
colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
if( Set3DColorFromUser( m_boardAdapter.m_CopperColor, _( "Copper Color" ), &colors ) ) if( Set3DColorFromUser( m_boardAdapter.m_CopperColor, _( "Copper Color" ), &colors, false, colors[0].m_Color ) )
{ {
NewDisplay( true ); NewDisplay( true );
return true; return true;
@ -949,7 +950,7 @@ bool EDA_3D_VIEWER::Set3DBoardBodyColorFromUser()
colors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, 1.0 - 0.1, "green 1" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, 1.0 - 0.1, "green 1" ) );
colors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, 1.0 - 0.1, "green 2" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, 1.0 - 0.1, "green 2" ) );
if( Set3DColorFromUser( m_boardAdapter.m_BoardBodyColor, _( "Board Body Color" ), &colors, true ) ) if( Set3DColorFromUser( m_boardAdapter.m_BoardBodyColor, _( "Board Body Color" ), &colors, true, colors[0].m_Color ) )
{ {
if( m_boardAdapter.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY ) if( m_boardAdapter.RenderEngineGet() == RENDER_ENGINE::OPENGL_LEGACY )
m_canvas->Request_refresh(); m_canvas->Request_refresh();
@ -971,7 +972,7 @@ bool EDA_3D_VIEWER::Set3DSolderPasteColorFromUser()
colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
colors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) ); colors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
if( Set3DColorFromUser( m_boardAdapter.m_SolderPasteColor, _( "Solder Paste Color" ), &colors ) ) if( Set3DColorFromUser( m_boardAdapter.m_SolderPasteColor, _( "Solder Paste Color" ), &colors, false, colors[0].m_Color ) )
{ {
NewDisplay( true ); NewDisplay( true );
return true; return true;

View File

@ -115,7 +115,8 @@ class EDA_3D_VIEWER : public EDA_3D_BOARD_HOLDER, public KIWAY_PLAYER
*/ */
bool Set3DColorFromUser( SFVEC4F &aColor, const wxString& aTitle, bool Set3DColorFromUser( SFVEC4F &aColor, const wxString& aTitle,
CUSTOM_COLORS_LIST* aPredefinedColors, CUSTOM_COLORS_LIST* aPredefinedColors,
bool aAllowOpacityControl = false ); bool aAllowOpacityControl = false,
KIGFX::COLOR4D aDefaultColor = KIGFX::COLOR4D( 1.0, 1.0, 1.0, 1.0 ) );
/** /**
* Set the solder mask color from a set of colors * Set the solder mask color from a set of colors