3D viewer: update icons from common settings

Use the icon scaling logic and call a toolbar rebuild when the
common settings change (echos the handling in Pcbnew and friends).

Remove an unused function.
This commit is contained in:
John Beard 2019-04-08 13:19:17 +01:00
parent 124dd5e59a
commit 8548e69382
3 changed files with 58 additions and 41 deletions

View File

@ -40,100 +40,111 @@ void EDA_3D_VIEWER::ReCreateMainToolbar()
{
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ReCreateMainToolbar" );
if( m_mainToolBar != NULL )
{
// Simple update to the list of old files.
SetToolbars();
return;
}
wxWindowUpdateLocker dummy( this );
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
if( m_mainToolBar )
{
m_mainToolBar->Clear();
}
else
{
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
}
// Set up toolbar
m_mainToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
KiBitmap( import3d_xpm ), _( "Reload board" ) );
KiScaledBitmap( import3d_xpm, this ), _( "Reload board" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
KiBitmap( copy_xpm ),
KiScaledBitmap( copy_xpm, this ),
_( "Copy 3D image to clipboard" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_TOOL_SET_VISIBLE_ITEMS, wxEmptyString,
KiBitmap( read_setup_xpm ),
KiScaledBitmap( read_setup_xpm, this ),
_( "Set display options, and some layers visibility" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString, KiBitmap( render_mode_xpm ),
m_mainToolBar->AddTool( ID_RENDER_CURRENT_VIEW, wxEmptyString,
KiScaledBitmap( render_mode_xpm, this ),
_( "Render current view using Raytracing" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiScaledBitmap( zoom_in_xpm, this ),
_( "Zoom in" ) );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiScaledBitmap( zoom_out_xpm, this ),
_( "Zoom out" ) );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiBitmap( zoom_redraw_xpm ),
KiScaledBitmap( zoom_redraw_xpm, this ),
_( "Redraw view" ) );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ),
_( "Zoom to fit 3D model" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
KiBitmap( rotate_neg_x_xpm ),
KiScaledBitmap( rotate_neg_x_xpm, this ),
_( "Rotate X Clockwise" ) );
m_mainToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
KiBitmap( rotate_pos_x_xpm ),
KiScaledBitmap( rotate_pos_x_xpm, this ),
_( "Rotate X Counterclockwise" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
KiBitmap( rotate_neg_y_xpm ),
KiScaledBitmap( rotate_neg_y_xpm, this ),
_( "Rotate Y Clockwise" ) );
m_mainToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
KiBitmap( rotate_pos_y_xpm ),
KiScaledBitmap( rotate_pos_y_xpm, this ),
_( "Rotate Y Counterclockwise" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
KiBitmap( rotate_neg_z_xpm ),
KiScaledBitmap( rotate_neg_z_xpm, this ),
_( "Rotate Z Clockwise" ) );
m_mainToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
KiBitmap( rotate_pos_z_xpm ),
KiScaledBitmap( rotate_pos_z_xpm, this ),
_( "Rotate Z Counterclockwise" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ),
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString,
KiScaledBitmap( left_xpm, this ),
_( "Move left" ) );
m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ),
m_mainToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString,
KiScaledBitmap( right_xpm, this ),
_( "Move right" ) );
m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ),
m_mainToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString,
KiScaledBitmap( up_xpm, this ),
_( "Move up" ) );
m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ),
m_mainToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString,
KiScaledBitmap( down_xpm, this ),
_( "Move down" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ),
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_ORTHO, wxEmptyString,
KiScaledBitmap( ortho_xpm, this ),
_( "Enable/Disable orthographic projection" ),
wxITEM_CHECK );
m_mainToolBar->Realize();
}
void EDA_3D_VIEWER::SetToolbars()
{
}
}

View File

@ -879,6 +879,9 @@ void EDA_3D_VIEWER::CommonSettingsChanged()
// Regen menu bars, etc
EDA_BASE_FRAME::CommonSettingsChanged();
// There is no base class that handles toolbars for this frame
ReCreateMainToolbar();
loadCommonSettings();
NewDisplay( true );

View File

@ -197,6 +197,9 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
DisplayHotkeyList( this, GetHotkeyConfig() );
}
/**
* Equivalent of EDA_DRAW_FRAME::ReCreateHToolbar
*/
void ReCreateMainToolbar();
void SetToolbars();