diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 4673c1dc11..d596603f03 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -379,6 +379,7 @@ set( BMAPS_MID pad_sketch pad pad_enumerate + pad_number pads_mask_layers path pagelayout_load @@ -517,6 +518,7 @@ set( BMAPS_MID zone_unfill zoom zoom_area + zoom_auto_fit_in_page zoom_fit_in_page zoom_center_on_screen zoom_in diff --git a/bitmaps_png/cpp_26/pad_number.cpp b/bitmaps_png/cpp_26/pad_number.cpp new file mode 100644 index 0000000000..ac570d9cb9 --- /dev/null +++ b/bitmaps_png/cpp_26/pad_number.cpp @@ -0,0 +1,53 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c, + 0xce, 0x00, 0x00, 0x02, 0x38, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xed, 0x95, 0xbf, 0x4f, 0xdb, + 0x50, 0x10, 0xc7, 0xdf, 0x88, 0x94, 0x99, 0x9f, 0x5b, 0x16, 0xfe, 0x00, 0x60, 0x25, 0x52, 0xc4, + 0x14, 0xe5, 0x2f, 0x68, 0xbb, 0x44, 0x85, 0x88, 0xc1, 0xff, 0x42, 0xa5, 0x60, 0x44, 0x80, 0x74, + 0xa9, 0xd4, 0x39, 0x52, 0xa7, 0x6c, 0x4c, 0xb8, 0x64, 0x28, 0x0a, 0xc5, 0x84, 0xc5, 0x55, 0x33, + 0x90, 0x08, 0x04, 0xb1, 0x20, 0x94, 0x0c, 0x49, 0xab, 0x4a, 0xad, 0xd2, 0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, 0x20, 0x58, 0xf1, 0xa8, 0xd8, 0x97, 0x20, + 0x9c, 0xfb, 0x40, 0x64, 0x79, 0xaf, 0x05, 0x01, 0x8d, 0xd0, 0xa1, 0x73, 0x1c, 0x58, 0xa9, 0x7d, + 0x73, 0xff, 0xb3, 0x04, 0xe1, 0xdc, 0x03, 0xd1, 0xb8, 0x15, 0x7d, 0x13, 0xab, 0x62, 0x38, 0x68, + 0x0b, 0x4a, 0x73, 0x92, 0x1b, 0x4e, 0xd8, 0xc6, 0xc1, 0x46, 0x53, 0x51, 0x14, 0x0b, 0x85, 0x73, + 0x0f, 0x44, 0xb6, 0xa0, 0xf9, 0xdb, 0x36, 0xd5, 0x75, 0x6f, 0x53, 0x8d, 0xbe, 0x88, 0xbe, 0x41, + 0x00, 0x0a, 0xe7, 0x03, 0xbb, 0x32, 0x83, 0xa6, 0xba, 0x1a, 0xb6, 0x83, 0x2f, 0x70, 0xef, 0xea, + 0x51, 0x92, 0xed, 0x8a, 0x32, 0x58, 0x35, 0x4e, 0x7c, 0x8f, 0xec, 0x5a, 0x12, 0x4f, 0xef, 0xf6, + 0x4f, 0x42, 0xbf, 0xed, 0xdd, 0x9d, 0xf9, 0xfc, 0xf8, 0x4e, 0x29, 0xf1, 0x81, 0x73, 0x12, 0x7c, + 0x87, 0x63, 0x7c, 0xa8, 0xa7, 0x6e, 0x3e, 0x27, 0x0f, 0xe3, 0x9e, 0xc6, 0x1f, 0x80, 0xd2, 0xc3, + 0x58, 0x34, 0x45, 0x77, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, + 0x82, +}; + +const BITMAP_OPAQUE pad_number_xpm[1] = {{ png, sizeof( png ), "pad_number_xpm" }}; + +//EOF diff --git a/bitmaps_png/cpp_26/zoom_auto_fit_in_page.cpp b/bitmaps_png/cpp_26/zoom_auto_fit_in_page.cpp new file mode 100644 index 0000000000..1ac89355d8 --- /dev/null +++ b/bitmaps_png/cpp_26/zoom_auto_fit_in_page.cpp @@ -0,0 +1,63 @@ + +/* Do not modify this file, it was automatically generated by the + * PNG2cpp CMake script, using a *.png file as input. + */ + +#include + +static const unsigned char png[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x04, 0x00, 0x00, 0x00, 0x03, 0x43, 0x84, + 0x45, 0x00, 0x00, 0x02, 0xe2, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0xb5, 0x94, 0x7b, 0x48, 0x53, + 0x71, 0x14, 0xc7, 0xcf, 0xdd, 0xbd, 0x7b, 0xf8, 0x58, 0x9a, 0x62, 0x3e, 0x33, 0x65, 0xe9, 0x7c, + 0x64, 0xfa, 0x47, 0x81, 0x39, 0xaa, 0xa5, 0x21, 0x51, 0x94, 0x28, 0x15, 0x14, 0x98, 0x14, 0xce, + 0x4d, 0xc3, 0x0a, 0x94, 0xec, 0x61, 0x91, 0x29, 0xb2, 0x72, 0x86, 0x94, 0x96, 0x6d, 0x4d, 0xac, + 0x20, 0x14, 0x6b, 0xa8, 0xcb, 0x99, 0x58, 0x9a, 0x69, 0x12, 0x81, 0x86, 0x0f, 0x6a, 0x19, 0xcb, + 0x9c, 0x0f, 0x9a, 0x19, 0xa6, 0x29, 0x98, 0x61, 0xa7, 0xcb, 0x2d, 0x9b, 0xd3, 0xdb, 0xe3, 0x9f, + 0xce, 0xf7, 0x9f, 0xfb, 0xfb, 0x71, 0x3e, 0xf7, 0xfc, 0xce, 0xe3, 0xf7, 0x03, 0x58, 0x62, 0x48, + 0x20, 0x0f, 0x05, 0xc8, 0x45, 0x02, 0xfe, 0xcd, 0xd0, 0x01, 0xbd, 0x31, 0x00, 0x03, 0x19, 0xad, + 0x46, 0x4f, 0x14, 0xfc, 0x0d, 0x20, 0xd1, 0x67, 0x32, 0x48, 0x94, 0xc9, 0x6b, 0x20, 0x5e, 0x13, + 0x83, 0xc4, 0x4b, 0x7e, 0x75, 0x84, 0x8c, 0x46, 0x3d, 0xfe, 0x10, 0x11, 0x29, 0xf4, 0x3f, 0x14, + 0xcb, 0xe9, 0x84, 0xf7, 0x30, 0x00, 0x26, 0xc2, 0x08, 0x26, 0x30, 0x83, 0x85, 0x6a, 0x2e, 0x8c, + 0x42, 0x5f, 0xe4, 0xb0, 0x23, 0x04, 0xfa, 0x26, 0xee, 0x24, 0x4c, 0xd0, 0xe7, 0x7b, 0xb7, 0x28, + 0xeb, 0x83, 0x02, 0xe5, 0xe6, 0xb4, 0x73, 0xd9, 0xae, 0x0f, 0x68, 0xbc, 0x37, 0x5f, 0x82, 0x9e, + 0xec, 0x90, 0x53, 0x7b, 0x18, 0xe7, 0x05, 0x74, 0xed, 0xb8, 0x34, 0x78, 0x64, 0x60, 0xef, 0x2b, + 0x69, 0x4f, 0x94, 0x31, 0xda, 0xbc, 0xcf, 0x74, 0x2c, 0x42, 0x0d, 0x3d, 0x54, 0xd3, 0x8c, 0x18, + 0xed, 0xd9, 0x20, 0x3f, 0xf7, 0x3c, 0xe8, 0x5c, 0xa3, 0xa9, 0x54, 0x9d, 0x9a, 0x50, 0x59, 0x0a, + 0x46, 0x2e, 0x0e, 0x17, 0x8c, 0xa8, 0x2c, 0x19, 0x13, 0x4f, 0xb3, 0x56, 0x54, 0x41, 0x77, 0x58, + 0x0a, 0x7a, 0x2f, 0x45, 0x78, 0x18, 0x48, 0xea, 0xa1, 0xe5, 0x7e, 0x8a, 0xea, 0xa8, 0x61, 0x76, + 0x12, 0xe7, 0xa5, 0x19, 0xd3, 0x25, 0x28, 0x33, 0xa1, 0x45, 0x70, 0x93, 0xae, 0xe8, 0xe2, 0x72, + 0xa0, 0xe3, 0x9b, 0x10, 0x68, 0x73, 0xbc, 0x87, 0x92, 0x3c, 0x45, 0xdd, 0x17, 0x2b, 0xa4, 0x1e, + 0x2d, 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, 0x3e, 0x49, 0x16, 0x9e, 0x70, 0x39, 0x53, 0xb3, 0x09, 0x9d, 0xe7, 0x77, 0x15, 0x36, 0x6e, + 0x3f, 0x7e, 0x91, 0x6e, 0xd3, 0x12, 0x2e, 0x6e, 0x9e, 0x94, 0x4d, 0xcb, 0x30, 0xd8, 0x7a, 0xf9, + 0xab, 0x68, 0xa7, 0x46, 0xeb, 0x81, 0x40, 0x4f, 0xaf, 0x6b, 0x17, 0x75, 0x92, 0x83, 0xab, 0xd0, + 0xe7, 0x37, 0xef, 0xc5, 0x7f, 0xb2, 0xef, 0x59, 0xf3, 0x82, 0x79, 0x52, 0x11, 0xe0, 0xf4, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE zoom_auto_fit_in_page_xpm[1] = {{ png, sizeof( png ), "zoom_auto_fit_in_page_xpm" }}; + +//EOF diff --git a/bitmaps_png/include/bitmaps_png/bitmaps_list.h b/bitmaps_png/include/bitmaps_png/bitmaps_list.h index 9d233f2488..449b3de8fe 100644 --- a/bitmaps_png/include/bitmaps_png/bitmaps_list.h +++ b/bitmaps_png/include/bitmaps_png/bitmaps_list.h @@ -319,6 +319,7 @@ EXTERN_BITMAP( opt_show_polygon_xpm ) EXTERN_BITMAP( pad_sketch_xpm ) EXTERN_BITMAP( pad_xpm ) EXTERN_BITMAP( pad_enumerate_xpm ) +EXTERN_BITMAP( pad_number_xpm ) EXTERN_BITMAP( pads_mask_layers_xpm ) EXTERN_BITMAP( pagelayout_load_xpm ) EXTERN_BITMAP( pagelayout_normal_view_mode_xpm ) @@ -492,6 +493,7 @@ EXTERN_BITMAP( zip_xpm ) EXTERN_BITMAP( zone_duplicate_xpm ) EXTERN_BITMAP( zone_unfill_xpm ) EXTERN_BITMAP( zoom_area_xpm ) +EXTERN_BITMAP( zoom_auto_fit_in_page_xpm ) EXTERN_BITMAP( zoom_center_on_screen_xpm ) EXTERN_BITMAP( zoom_redraw_xpm ) EXTERN_BITMAP( zoom_fit_in_page_xpm ) diff --git a/bitmaps_png/sources/pad_number.svg b/bitmaps_png/sources/pad_number.svg new file mode 100644 index 0000000000..0c65e0936d --- /dev/null +++ b/bitmaps_png/sources/pad_number.svg @@ -0,0 +1,106 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/bitmaps_png/sources/zoom_auto_fit_in_page.svg b/bitmaps_png/sources/zoom_auto_fit_in_page.svg new file mode 100644 index 0000000000..60101fb088 --- /dev/null +++ b/bitmaps_png/sources/zoom_auto_fit_in_page.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 355c85629c..9421837c4b 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -221,9 +221,6 @@ bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::stri ret &= fromLegacy( aCfg, aFrame + gd + "GridStyle", aJsonPath + ".grid.style" ); ret &= fromLegacyColor( aCfg, aFrame + gd + "GridColor", aJsonPath + ".grid.color" ); - ret &= fromLegacy( aCfg, aFrame + "AutoZoom", aJsonPath + ".auto_zoom" ); - ret &= fromLegacy( aCfg, aFrame + "Zoom", aJsonPath + ".zoom" ); - return ret; } diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index b4142f255b..902cd04748 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -20,8 +20,6 @@ include_directories( set( CVPCB_DIALOGS dialogs/fp_conflict_assignment_selector_base.cpp dialogs/fp_conflict_assignment_selector.cpp - dialogs/dialog_display_options.cpp - dialogs/dialog_display_options_base.cpp dialogs/dialog_config_equfiles_base.cpp dialogs/dialog_config_equfiles.cpp ) diff --git a/cvpcb/cvpcb_settings.cpp b/cvpcb/cvpcb_settings.cpp index 5dfa4f6f93..ddc6c863fc 100644 --- a/cvpcb/cvpcb_settings.cpp +++ b/cvpcb/cvpcb_settings.cpp @@ -29,15 +29,16 @@ ///! Update the schema version whenever a migration is required const int cvpcbSchemaVersion = 0; -CVPCB_SETTINGS::CVPCB_SETTINGS() : - APP_SETTINGS_BASE( "cvpcb", cvpcbSchemaVersion ) +CVPCB_SETTINGS::CVPCB_SETTINGS() + : APP_SETTINGS_BASE( "cvpcb", cvpcbSchemaVersion ), + m_FootprintViewerAutoZoom( false ), + m_FootprintViewerZoom( 1.0 ), + m_FilterFootprint( 0 ) { - // Make Coverity happy: - m_FilterFootprint = 0; - - m_FootprintViewerMagneticSettings.pads = MAGNETIC_OPTIONS::NO_EFFECT; - m_FootprintViewerMagneticSettings.tracks = MAGNETIC_OPTIONS::NO_EFFECT; - m_FootprintViewerMagneticSettings.graphics = false; + // We always snap and don't let the user configure it + m_FootprintViewerMagneticSettings.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS; + m_FootprintViewerMagneticSettings.tracks = MAGNETIC_OPTIONS::CAPTURE_ALWAYS; + m_FootprintViewerMagneticSettings.graphics = true; // Init settings: m_params.emplace_back( new PARAM( "filter_footprint", &m_FilterFootprint, 0 ) ); @@ -57,12 +58,12 @@ CVPCB_SETTINGS::CVPCB_SETTINGS() : m_params.emplace_back( new PARAM( "footprint_viewer.graphic_items_fill", &m_FootprintViewerDisplayOptions.m_DisplayDrawItemsFill, true ) ); - m_params.emplace_back( new PARAM( "footprint_viewer.magnetic_graphics", - &m_FootprintViewerMagneticSettings.graphics, false ) ); + m_params.emplace_back( new PARAM( "footprint_viewer.auto_zoom", + &m_FootprintViewerAutoZoom, false ) ); + + m_params.emplace_back( new PARAM( "footprint_viewer.zoom", + &m_FootprintViewerZoom, 1.0 ) ); - m_params.emplace_back( new PARAM( "footprint_viewer.magnetic_pads", - reinterpret_cast( &m_FootprintViewerMagneticSettings.pads ), - static_cast( MAGNETIC_OPTIONS::NO_EFFECT ) ) ); } @@ -79,5 +80,8 @@ bool CVPCB_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) ret &= fromLegacy( aCfg, "FootprintViewerFrameDiModTx", "footprint_viewer.footprint_text_fill" ); + ret &= fromLegacy( aCfg, "FootprintViewerFrameAutoZoom", "footprint_viewer.auto_zoom" ); + ret &= fromLegacy( aCfg, "FootprintViewerFrameZoom", "footprint_viewer.zoom" ); + return ret; } diff --git a/cvpcb/cvpcb_settings.h b/cvpcb/cvpcb_settings.h index fb689f2967..5cfe182215 100644 --- a/cvpcb/cvpcb_settings.h +++ b/cvpcb/cvpcb_settings.h @@ -43,6 +43,10 @@ public: MAGNETIC_SETTINGS m_FootprintViewerMagneticSettings; + bool m_FootprintViewerAutoZoom; + + double m_FootprintViewerZoom; + int m_FilterFootprint; protected: diff --git a/cvpcb/display_footprints_frame.cpp b/cvpcb/display_footprints_frame.cpp index c45711456f..13859e3d8f 100644 --- a/cvpcb/display_footprints_frame.cpp +++ b/cvpcb/display_footprints_frame.cpp @@ -55,7 +55,6 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME ) EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow ) - EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay ) EVT_CHOICE( ID_ON_ZOOM_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectZoom ) EVT_CHOICE( ID_ON_GRID_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectGrid ) END_EVENT_TABLE() @@ -145,7 +144,9 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa ActivateGalCanvas(); // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.) - GetCanvas()->GetView()->SetScale( m_lastZoom ); + CVPCB_SETTINGS* cfg = dynamic_cast( config() ); + wxASSERT( cfg ); + GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom ); updateView(); @@ -192,9 +193,6 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar() m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); - // TODO: these can be moved to the 'proper' right vertical toolbar if and when there are - // actual tools to put there. That, or I'll get around to implementing configurable - // toolbars. m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE ); @@ -206,6 +204,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar() m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->AddSeparator(); + m_optionsToolBar->Add( PCB_ACTIONS::showPadNumbers, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::moduleTextOutlines, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE ); @@ -222,15 +221,13 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); - m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiScaledBitmap( config_xpm, this ), - _( "Display options" ) ); - m_mainToolBar->AddSeparator(); m_mainToolBar->Add( ACTIONS::zoomRedraw ); m_mainToolBar->Add( ACTIONS::zoomInCenter ); m_mainToolBar->Add( ACTIONS::zoomOutCenter ); m_mainToolBar->Add( ACTIONS::zoomFitScreen ); - m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE ); + m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE ); + m_mainToolBar->Add( PCB_ACTIONS::zoomFootprintAutomatically, ACTION_TOOLBAR::TOGGLE ); m_mainToolBar->AddSeparator(); m_mainToolBar->Add( ACTIONS::show3DViewer ); @@ -265,9 +262,6 @@ void DISPLAY_FOOTPRINTS_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) EDA_DRAW_FRAME::LoadSettings( cfg ); SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions ); - - m_autoZoom = cfg->m_FootprintViewer.auto_zoom; - m_lastZoom = cfg->m_FootprintViewer.zoom; } @@ -280,8 +274,7 @@ void DISPLAY_FOOTPRINTS_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) cfg->m_FootprintViewerDisplayOptions = GetDisplayOptions(); - cfg->m_FootprintViewer.auto_zoom = m_autoZoom; - cfg->m_FootprintViewer.zoom = GetCanvas()->GetView()->GetScale(); + cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale(); } @@ -425,7 +418,7 @@ void DISPLAY_FOOTPRINTS_FRAME::updateView() m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); - if( m_autoZoom ) + if( GetAutoZoom() ) m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); else m_toolManager->RunAction( ACTIONS::centerContents, true ); @@ -449,6 +442,7 @@ void DISPLAY_FOOTPRINTS_FRAME::UpdateMsgPanel() void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars() { m_mainToolBar->Toggle( ACTIONS::zoomTool, IsCurrentTool( ACTIONS::zoomTool ) ); + m_mainToolBar->Toggle( PCB_ACTIONS::zoomFootprintAutomatically, GetAutoZoom() ); m_mainToolBar->Refresh(); m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); @@ -456,6 +450,14 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncToolbars() m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) ); m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); + + const PCB_DISPLAY_OPTIONS& opts = GetDisplayOptions(); + + m_optionsToolBar->Toggle( PCB_ACTIONS::showPadNumbers, opts.m_DisplayPadNum ); + m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts.m_DisplayPadFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::moduleTextOutlines, !opts.m_DisplayModTextFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts.m_DisplayModEdgeFill ); + m_optionsToolBar->Refresh(); } @@ -475,3 +477,19 @@ BOARD_ITEM_CONTAINER* DISPLAY_FOOTPRINTS_FRAME::GetModel() const { return GetBoard()->GetFirstModule(); } + + +void DISPLAY_FOOTPRINTS_FRAME::SetAutoZoom( bool aAutoZoom ) +{ + CVPCB_SETTINGS* cfg = dynamic_cast( config() ); + wxASSERT( cfg ); + cfg->m_FootprintViewerAutoZoom = aAutoZoom; +} + + +bool DISPLAY_FOOTPRINTS_FRAME::GetAutoZoom() +{ + CVPCB_SETTINGS* cfg = dynamic_cast( config() ); + wxASSERT( cfg ); + return cfg->m_FootprintViewerAutoZoom; +} diff --git a/cvpcb/display_footprints_frame.h b/cvpcb/display_footprints_frame.h index 009e57c559..39f1f9e696 100644 --- a/cvpcb/display_footprints_frame.h +++ b/cvpcb/display_footprints_frame.h @@ -41,9 +41,6 @@ */ class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME { - bool m_autoZoom; - double m_lastZoom; - public: DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aParent ); ~DISPLAY_FOOTPRINTS_FRAME() override; @@ -83,9 +80,6 @@ public: ///> @copydoc EDA_DRAW_FRAME::UpdateMsgPanel() void UpdateMsgPanel() override; - bool GetAutoZoom() const { return m_autoZoom; } - void SetAutoZoom( bool aEnable ) { m_autoZoom = aEnable; } - COLOR_SETTINGS* GetColorSettings() override; /** @@ -94,7 +88,6 @@ public: */ COLOR4D GetGridColor() override; - void InstallOptionsDisplay( wxCommandEvent& event ); MODULE* Get_Module( const wxString& CmpName ); /* SaveCopyInUndoList() virtual @@ -124,6 +117,20 @@ public: void SyncToolbars() override; + /** + * Set if the canvas should automatically zoom to the footprint on load. + * + * @param aAutoZoom is true if it should automatically zoom + */ + void SetAutoZoom( bool aAutoZoom ) override; + + /** + * Get if the canvas should automatically zoom to the footprint on load. + * + * @return true if it should automatically zoom + */ + bool GetAutoZoom() override; + DECLARE_EVENT_TABLE() }; diff --git a/include/id.h b/include/id.h index 7fd4e28993..f583acaa2d 100644 --- a/include/id.h +++ b/include/id.h @@ -105,8 +105,6 @@ enum main_id ID_GEN_EXPORT_FILE, ID_GEN_IMPORT_FILE, - ID_OPTIONS_SETUP, - // id for toolbars ID_H_TOOLBAR, ID_V_TOOLBAR, diff --git a/include/pcb_base_frame.h b/include/pcb_base_frame.h index fa965b6bed..98334dd33c 100644 --- a/include/pcb_base_frame.h +++ b/include/pcb_base_frame.h @@ -473,6 +473,18 @@ public: ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas virtual void ActivateGalCanvas() override; + /** + * Doesn't do anything. Should be overrided in child classes if they + * support an auto zoom setting. + */ + virtual void SetAutoZoom( bool aAutoZoom ) {} + + /** + * Always returns false. Should be overriden in child classes if they + * support an autozoom setting. + */ + virtual bool GetAutoZoom() { return false; } + DECLARE_EVENT_TABLE() }; diff --git a/include/settings/app_settings.h b/include/settings/app_settings.h index 428f88ae01..885b4a902d 100644 --- a/include/settings/app_settings.h +++ b/include/settings/app_settings.h @@ -61,8 +61,6 @@ struct WINDOW_SETTINGS CURSOR_SETTINGS cursor; GRID_SETTINGS grid; - bool auto_zoom; - double zoom; }; /** diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index f3ad5a8c0f..1c4aaab5f8 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -83,8 +83,6 @@ set( PCBNEW_DIALOGS dialogs/dialog_find_base.cpp dialogs/dialog_footprint_wizard_list.cpp dialogs/dialog_footprint_wizard_list_base.cpp - dialogs/dialog_fp_browser_display_options.cpp - dialogs/dialog_fp_browser_display_options_base.cpp dialogs/dialog_fp_plugin_options.cpp dialogs/dialog_fp_plugin_options_base.cpp dialogs/dialog_gen_footprint_position_file_base.cpp diff --git a/pcbnew/dialogs/dialog_fp_browser_display_options.cpp b/pcbnew/dialogs/dialog_fp_browser_display_options.cpp deleted file mode 100644 index 9722d0779e..0000000000 --- a/pcbnew/dialogs/dialog_fp_browser_display_options.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include -#include -#include - - -void FOOTPRINT_VIEWER_FRAME::InstallDisplayOptions( wxCommandEvent& event ) -{ - DIALOG_FP_BROWSER_DISPLAY_OPTIONS dlg( this ); - - dlg.ShowModal(); -} - - -DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_OPTIONS( FOOTPRINT_VIEWER_FRAME* aParent ) - : DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE( aParent ), - m_frame( aParent ) -{ - initDialog(); - m_sdbSizerOK->SetDefault(); - - FinishDialogSettings();; -} - - -DIALOG_FP_BROWSER_DISPLAY_OPTIONS::~DIALOG_FP_BROWSER_DISPLAY_OPTIONS( ) -{ -} - - -void DIALOG_FP_BROWSER_DISPLAY_OPTIONS::initDialog() -{ - SetFocus(); // mandatory to use escape key as cancel under wxGTK. - - const PCB_DISPLAY_OPTIONS& displ_opts = m_frame->GetDisplayOptions(); - - m_EdgesDisplayOption->SetValue( not displ_opts.m_DisplayModEdgeFill ); - m_TextDisplayOption->SetValue( not displ_opts.m_DisplayModTextFill ); - m_ShowPadSketch->SetValue( not displ_opts.m_DisplayPadFill ); - m_ShowPadNum->SetValue( displ_opts.m_DisplayPadNum ); - - m_autoZoomOption->SetValue( m_frame->GetAutoZoom() ); -} - - -void DIALOG_FP_BROWSER_DISPLAY_OPTIONS::UpdateObjectSettings() -{ - PCB_DISPLAY_OPTIONS displ_opts = m_frame->GetDisplayOptions(); - - displ_opts.m_DisplayModEdgeFill = not m_EdgesDisplayOption->GetValue(); - displ_opts.m_DisplayModTextFill = not m_TextDisplayOption->GetValue(); - displ_opts.m_DisplayPadNum = m_ShowPadNum->GetValue(); - displ_opts.m_DisplayPadFill = not m_ShowPadSketch->GetValue(); - m_frame->SetDisplayOptions( displ_opts ); - m_frame->ApplyDisplaySettingsToGAL(); - - m_frame->SetAutoZoom( m_autoZoomOption->GetValue() ); -} - - -bool DIALOG_FP_BROWSER_DISPLAY_OPTIONS::TransferDataFromWindow() -{ - UpdateObjectSettings(); - return true; -} - - -void DIALOG_FP_BROWSER_DISPLAY_OPTIONS::OnApplyClick( wxCommandEvent& event ) -{ - UpdateObjectSettings(); -} diff --git a/pcbnew/dialogs/dialog_fp_browser_display_options.h b/pcbnew/dialogs/dialog_fp_browser_display_options.h deleted file mode 100644 index 31d721c06c..0000000000 --- a/pcbnew/dialogs/dialog_fp_browser_display_options.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef DIALOG_FP_BROWSER_DISPLAY_OPTIONS_H -#define DIALOG_FP_BROWSER_DISPLAY_OPTIONS_H - -#include - - -class FOOTPRINT_VIEWER_FRAME; - - -class DIALOG_FP_BROWSER_DISPLAY_OPTIONS : public DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE -{ -private: - FOOTPRINT_VIEWER_FRAME* m_frame; - -public: - DIALOG_FP_BROWSER_DISPLAY_OPTIONS( FOOTPRINT_VIEWER_FRAME* aParent ); - ~DIALOG_FP_BROWSER_DISPLAY_OPTIONS(); - -private: - void initDialog(); - void UpdateObjectSettings(); - void OnApplyClick( wxCommandEvent& event ) override; - bool TransferDataFromWindow() override; -}; - -#endif // DIALOG_FP_BROWSER_DISPLAY_OPTIONS_H diff --git a/pcbnew/dialogs/dialog_fp_browser_display_options_base.cpp b/pcbnew/dialogs/dialog_fp_browser_display_options_base.cpp deleted file mode 100644 index 723ad73c9c..0000000000 --- a/pcbnew/dialogs/dialog_fp_browser_display_options_base.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_fp_browser_display_options_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE::DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bSizerMain; - bSizerMain = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bUpperSizer; - bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbSizerDrawMode; - sbSizerDrawMode = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drawing Options") ), wxVERTICAL ); - - m_EdgesDisplayOption = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), wxID_ANY, _("Graphic items sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerDrawMode->Add( m_EdgesDisplayOption, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_TextDisplayOption = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), wxID_ANY, _("Texts sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerDrawMode->Add( m_TextDisplayOption, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - - m_ShowPadSketch = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), ID_PADFILL_OPT, _("Pad sketch mode"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerDrawMode->Add( m_ShowPadSketch, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - - sbSizerDrawMode->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - - m_ShowPadNum = new wxCheckBox( sbSizerDrawMode->GetStaticBox(), wxID_ANY, _("Show pad &numbers"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerDrawMode->Add( m_ShowPadNum, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - bUpperSizer->Add( sbSizerDrawMode, 1, wxEXPAND|wxALL, 5 ); - - wxStaticBoxSizer* sbSizerViewOpt; - sbSizerViewOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Auto-zoom") ), wxVERTICAL ); - - m_autoZoomOption = new wxCheckBox( sbSizerViewOpt->GetStaticBox(), wxID_ANY, _("Zoom to fit when changing footprint"), wxDefaultPosition, wxDefaultSize, 0 ); - m_autoZoomOption->SetValue(true); - sbSizerViewOpt->Add( m_autoZoomOption, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - bUpperSizer->Add( sbSizerViewOpt, 1, wxALL|wxEXPAND, 5 ); - - - bSizerMain->Add( bUpperSizer, 1, wxEXPAND|wxALL, 5 ); - - m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizerMain->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_sdbSizer = new wxStdDialogButtonSizer(); - m_sdbSizerOK = new wxButton( this, wxID_OK ); - m_sdbSizer->AddButton( m_sdbSizerOK ); - m_sdbSizerApply = new wxButton( this, wxID_APPLY ); - m_sdbSizer->AddButton( m_sdbSizerApply ); - m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer->AddButton( m_sdbSizerCancel ); - m_sdbSizer->Realize(); - - bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); - - - this->SetSizer( bSizerMain ); - this->Layout(); - bSizerMain->Fit( this ); - - // Connect Events - m_sdbSizerApply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); -} - -DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE::~DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE() -{ - // Disconnect Events - m_sdbSizerApply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE::OnApplyClick ), NULL, this ); - -} diff --git a/pcbnew/dialogs/dialog_fp_browser_display_options_base.fbp b/pcbnew/dialogs/dialog_fp_browser_display_options_base.fbp deleted file mode 100644 index 7b3fa5bbfd..0000000000 --- a/pcbnew/dialogs/dialog_fp_browser_display_options_base.fbp +++ /dev/null @@ -1,697 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_fp_browser_display_options_base - 1000 - none - 1 - dialog_fp_browser_display_options_base - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE - - -1,-1 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - Display Options - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain - wxVERTICAL - none - - 5 - wxEXPAND|wxALL - 1 - - - bUpperSizer - wxHORIZONTAL - none - - 5 - wxEXPAND|wxALL - 1 - - wxID_ANY - Drawing Options - - sbSizerDrawMode - wxVERTICAL - 1 - none - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Graphic items sketch mode - - 0 - - - 0 - - 1 - m_EdgesDisplayOption - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Texts sketch mode - - 0 - - - 0 - - 1 - m_TextDisplayOption - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_PADFILL_OPT - Pad sketch mode - - 0 - - - 0 - - 1 - m_ShowPadSketch - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM - 1 - - 0 - protected - 0 - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show pad &numbers - - 0 - - - 0 - - 1 - m_ShowPadNum - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - wxID_ANY - Auto-zoom - - sbSizerViewOpt - wxVERTICAL - 1 - none - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Zoom to fit when changing footprint - - 0 - - - 0 - - 1 - m_autoZoomOption - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline1 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 0 - - 1 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer - protected - OnApplyClick - - - - - - - - - - - - - diff --git a/pcbnew/dialogs/dialog_fp_browser_display_options_base.h b/pcbnew/dialogs/dialog_fp_browser_display_options_base.h deleted file mode 100644 index c0414cf9fb..0000000000 --- a/pcbnew/dialogs/dialog_fp_browser_display_options_base.h +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE_H__ -#define __DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE_H__ - -#include -#include -#include -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -#define ID_PADFILL_OPT 1000 - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM -{ - private: - - protected: - wxCheckBox* m_EdgesDisplayOption; - wxCheckBox* m_TextDisplayOption; - wxCheckBox* m_ShowPadSketch; - wxCheckBox* m_ShowPadNum; - wxCheckBox* m_autoZoomOption; - wxStaticLine* m_staticline1; - wxStdDialogButtonSizer* m_sdbSizer; - wxButton* m_sdbSizerOK; - wxButton* m_sdbSizerApply; - wxButton* m_sdbSizerCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnApplyClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE(); - -}; - -#endif //__DIALOG_FP_BROWSER_DISPLAY_OPTIONS_BASE_H__ diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 2bb69520de..439d724e1e 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -52,6 +52,8 @@ #include #include #include +#include +#include #include #include #include @@ -77,7 +79,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME ) EVT_MENU( wxID_CLOSE, FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer ) // Toolbar events - EVT_TOOL( ID_MODVIEW_OPTIONS, FOOTPRINT_VIEWER_FRAME::InstallDisplayOptions ) EVT_TOOL( ID_MODVIEW_NEXT, FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList ) EVT_TOOL( ID_MODVIEW_PREVIOUS, FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList ) EVT_TOOL( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB ) @@ -127,6 +128,11 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent m_AboutTitle = "Footprint Library Viewer"; + // Force the items to always snap + m_magneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS; + m_magneticItems.tracks = MAGNETIC_OPTIONS::CAPTURE_ALWAYS; + m_magneticItems.graphics = true; + // Force the frame name used in config. the footprint viewer frame has a name // depending on aFrameType (needed to identify the frame by wxWidgets), // but only one configuration is preferable. @@ -210,12 +216,18 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent m_toolManager->RegisterTool( new COMMON_TOOLS ); // for std context menus (zoom & grid) m_toolManager->RegisterTool( new COMMON_CONTROL ); m_toolManager->RegisterTool( new PCBNEW_PICKER_TOOL ); // for setting grid origin + m_toolManager->RegisterTool( new ZOOM_TOOL ); + m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS ); + + m_toolManager->GetTool()->SetFootprintFrame( true ); + m_toolManager->InitTools(); m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" ); ReCreateMenuBar(); ReCreateHToolbar(); ReCreateVToolbar(); + ReCreateOptToolbar(); ReCreateLibraryList(); UpdateTitle(); @@ -236,6 +248,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent // Horizontal items; layers 4 - 6 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().VToolbar().Name( "MainToolbar" ).Top().Layer(6) ); + m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) ); m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) ); // Vertical items; layers 1 - 3 @@ -256,7 +269,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent ActivateGalCanvas(); // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.) - GetCanvas()->GetView()->SetScale( m_lastZoom ); + PCBNEW_SETTINGS* cfg = GetPcbNewSettings(); + wxASSERT( cfg ); + GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom ); updateView(); InitExitKey(); @@ -715,9 +730,6 @@ void FOOTPRINT_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) SetGridVisibility( fpedit->m_Window.grid.show ); GetGalDisplayOptions().ReadWindowSettings( fpedit->m_Window ); - - m_autoZoom = cfg->m_FootprintViewer.auto_zoom; - m_lastZoom = cfg->m_FootprintViewer.zoom; } @@ -729,8 +741,7 @@ void FOOTPRINT_VIEWER_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg ) // We don't want to store anything other than the window settings EDA_BASE_FRAME::SaveSettings( cfg ); - cfg->m_FootprintViewer.auto_zoom = m_autoZoom; - cfg->m_FootprintViewer.zoom = GetCanvas()->GetView()->GetScale(); + cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale(); } @@ -754,6 +765,24 @@ COLOR_SETTINGS* FOOTPRINT_VIEWER_FRAME::GetColorSettings() } +bool FOOTPRINT_VIEWER_FRAME::GetAutoZoom() +{ + // It is stored in pcbnew's settings + PCBNEW_SETTINGS* cfg = GetPcbNewSettings(); + wxCHECK( cfg, false ); + return cfg->m_FootprintViewerAutoZoom; +} + + +void FOOTPRINT_VIEWER_FRAME::SetAutoZoom( bool aAutoZoom ) +{ + // It is stored in pcbnew's settings + PCBNEW_SETTINGS* cfg = GetPcbNewSettings(); + wxASSERT( cfg ); + cfg->m_FootprintViewerAutoZoom = aAutoZoom; +} + + void FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged ) { PCB_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged ); @@ -995,7 +1024,7 @@ void FOOTPRINT_VIEWER_FRAME::updateView() m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); - if( m_autoZoom ) + if( GetAutoZoom() ) m_toolManager->RunAction( ACTIONS::zoomFitScreen, true ); else m_toolManager->RunAction( ACTIONS::centerContents, true ); @@ -1020,3 +1049,4 @@ BOARD_ITEM_CONTAINER* FOOTPRINT_VIEWER_FRAME::GetModel() const { return GetBoard()->GetFirstModule(); } + diff --git a/pcbnew/footprint_viewer_frame.h b/pcbnew/footprint_viewer_frame.h index 76c6ba6cd3..99df0a6cd0 100644 --- a/pcbnew/footprint_viewer_frame.h +++ b/pcbnew/footprint_viewer_frame.h @@ -28,6 +28,7 @@ #include #include +#include class wxSashLayoutWindow; class wxListBox; @@ -46,6 +47,8 @@ class FOOTPRINT_VIEWER_FRAME : public PCB_BASE_FRAME protected: FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ); + MAGNETIC_SETTINGS m_magneticItems; + public: ~FOOTPRINT_VIEWER_FRAME(); @@ -58,8 +61,13 @@ public: virtual COLOR4D GetGridColor() override; - bool GetAutoZoom() const { return m_autoZoom; } - void SetAutoZoom( bool aEnable ) { m_autoZoom = aEnable; } + bool GetAutoZoom() override; + void SetAutoZoom( bool aAutoZoom ) override; + + MAGNETIC_SETTINGS* GetMagneticItemsSettings() override + { + return &m_magneticItems; + } /** * Function ReCreateLibraryList @@ -117,7 +125,9 @@ private: void ReCreateHToolbar() override; void ReCreateVToolbar() override; + void ReCreateOptToolbar() override; void ReCreateMenuBar() override; + void SyncToolbars() override; void OnLibFilter( wxCommandEvent& aEvent ); void OnFPFilter( wxCommandEvent& aEvent ); @@ -129,8 +139,6 @@ private: void ClickOnFootprintList( wxCommandEvent& aEvent ); void DClickOnFootprintList( wxCommandEvent& aEvent ); - void InstallDisplayOptions( wxCommandEvent& aEvent ); - void LoadSettings( APP_SETTINGS_BASE* aCfg ) override; void SaveSettings( APP_SETTINGS_BASE* aCfg ) override; diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 8fbda367d6..d753200b15 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -112,7 +112,6 @@ enum pcbnew_ids ID_MODVIEW_LIB_LIST, ID_MODVIEW_FOOTPRINT_FILTER, ID_MODVIEW_FOOTPRINT_LIST, - ID_MODVIEW_OPTIONS, ID_MODVIEW_PREVIOUS, ID_MODVIEW_NEXT, diff --git a/pcbnew/pcbnew_settings.cpp b/pcbnew/pcbnew_settings.cpp index 39cddab644..71ed475eba 100644 --- a/pcbnew/pcbnew_settings.cpp +++ b/pcbnew/pcbnew_settings.cpp @@ -43,11 +43,14 @@ const int pcbnewSchemaVersion = 0; -PCBNEW_SETTINGS::PCBNEW_SETTINGS() : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVersion ), - m_Use45DegreeGraphicSegments( false ), - m_FlipLeftRight( false ), - m_ShowPageLimits( true ), - m_PnsSettings( nullptr ) +PCBNEW_SETTINGS::PCBNEW_SETTINGS() + : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVersion ), + m_Use45DegreeGraphicSegments( false ), + m_FlipLeftRight( false ), + m_ShowPageLimits( true ), + m_PnsSettings( nullptr ), + m_FootprintViewerAutoZoom( false ), + m_FootprintViewerZoom( 1.0 ) { m_MagneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL; m_MagneticItems.tracks = MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL; @@ -75,10 +78,6 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVe m_params.emplace_back( new PARAM( "grid.fast_grid_2", &m_FastGrid2, 0 ) ); - m_params.emplace_back( new PARAM( "window.auto_zoom", &m_Window.auto_zoom, true ) ); - - m_params.emplace_back( new PARAM( "window.zoom", &m_Window.zoom, 10.0 ) ); - m_params.emplace_back( new PARAM( "editing.flip_left_right", &m_FlipLeftRight, true ) ); m_params.emplace_back( @@ -396,6 +395,12 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS() : APP_SETTINGS_BASE( "pcbnew", pcbnewSchemaVe addParamsForWindow( &m_FootprintViewer, "footprint_viewer" ); + m_params.emplace_back( new PARAM( "footprint_viewer.auto_zoom", + &m_FootprintViewerAutoZoom, false ) ); + + m_params.emplace_back( new PARAM( "footprint_viewer.zoom", + &m_FootprintViewerZoom, 1.0 ) ); + addParamsForWindow( &m_FootprintWizard, "footprint_wizard" ); } @@ -596,6 +601,9 @@ bool PCBNEW_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) migrateWindowConfig( aCfg, "ModViewFrame", "footprint_viewer" ); + ret &= fromLegacy( aCfg, "ModViewFrameAutoZoom", "footprint_viewer.auto_zoom" ); + ret &= fromLegacy( aCfg, "ModViewFrameZoom", "footprint_viewer.zoom" ); + migrateWindowConfig( aCfg, "FootprintWizard", "footprint_wizard" ); ret &= fromLegacyString( aCfg, "Fpwizard_auiPerspective", "footprint_wizard.perspective" ); diff --git a/pcbnew/pcbnew_settings.h b/pcbnew/pcbnew_settings.h index ca3b61dcde..a10315e407 100644 --- a/pcbnew/pcbnew_settings.h +++ b/pcbnew/pcbnew_settings.h @@ -272,6 +272,10 @@ public: std::unique_ptr m_PnsSettings; + bool m_FootprintViewerAutoZoom; ///< Should the footprint viewer auto zoom on select + + double m_FootprintViewerZoom; ///< The last zoom level in the footprint viewer + #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU) ACTION_PLUGIN_SETTINGS_LIST m_VisibleActionPlugins; #endif diff --git a/pcbnew/toolbars_footprint_viewer.cpp b/pcbnew/toolbars_footprint_viewer.cpp index da9afab1fb..d935fbf66e 100644 --- a/pcbnew/toolbars_footprint_viewer.cpp +++ b/pcbnew/toolbars_footprint_viewer.cpp @@ -50,11 +50,6 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar - m_mainToolBar->AddTool( ID_MODVIEW_OPTIONS, wxEmptyString, - KiScaledBitmap( config_xpm, this ), - _( "Display options" ) ); - - m_mainToolBar->AddSeparator(); m_mainToolBar->AddTool( ID_MODVIEW_PREVIOUS, wxEmptyString, KiScaledBitmap( lib_previous_xpm, this ), _( "Display previous footprint" ) ); @@ -67,6 +62,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() m_mainToolBar->Add( ACTIONS::zoomInCenter ); m_mainToolBar->Add( ACTIONS::zoomOutCenter ); m_mainToolBar->Add( ACTIONS::zoomFitScreen ); + m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE ); + m_mainToolBar->Add( PCB_ACTIONS::zoomFootprintAutomatically, ACTION_TOOLBAR::TOGGLE ); KiScaledSeparator( m_mainToolBar, this ); m_mainToolBar->Add( ACTIONS::show3DViewer ); @@ -101,11 +98,63 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar() } +void FOOTPRINT_VIEWER_FRAME::ReCreateOptToolbar() +{ + if( m_optionsToolBar ) + return; + + // Create options tool bar. + m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); + + m_optionsToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE ); + + m_optionsToolBar->AddSeparator(); + m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE ); + + m_optionsToolBar->AddSeparator(); + m_optionsToolBar->Add( PCB_ACTIONS::showPadNumbers, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::moduleTextOutlines, ACTION_TOOLBAR::TOGGLE ); + m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE ); + + m_optionsToolBar->Realize(); +} + + void FOOTPRINT_VIEWER_FRAME::ReCreateVToolbar() { } +void FOOTPRINT_VIEWER_FRAME::SyncToolbars() +{ + m_mainToolBar->Toggle( ACTIONS::zoomTool, IsCurrentTool( ACTIONS::zoomTool ) ); + m_mainToolBar->Toggle( PCB_ACTIONS::zoomFootprintAutomatically, GetAutoZoom() ); + m_mainToolBar->Refresh(); + + m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() ); + m_optionsToolBar->Toggle( ACTIONS::selectionTool, IsCurrentTool( ACTIONS::selectionTool ) ); + m_optionsToolBar->Toggle( ACTIONS::measureTool, IsCurrentTool( ACTIONS::measureTool ) ); + m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES ); + m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES ); + + const PCB_DISPLAY_OPTIONS& opts = GetDisplayOptions(); + + m_optionsToolBar->Toggle( PCB_ACTIONS::showPadNumbers, opts.m_DisplayPadNum ); + m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts.m_DisplayPadFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::moduleTextOutlines, !opts.m_DisplayModTextFill ); + m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts.m_DisplayModEdgeFill ); + + m_optionsToolBar->Refresh(); +} + + void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar() { SELECTION_TOOL* selTool = m_toolManager->GetTool(); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index c5fbb1fa87..bd623d9259 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -698,6 +698,16 @@ TOOL_ACTION PCB_ACTIONS::moduleTextOutlines( "pcbnew.Control.fpTextOutlines", _( "Line Mode Footprint Text Items" ), _( "Show footprint texts in line mode" ), text_sketch_xpm ); +TOOL_ACTION PCB_ACTIONS::showPadNumbers( "pcbnew.Control.showPadNumbers", + AS_GLOBAL, 0, "", + _( "Show pad numbers" ), _( "Show pad numbers" ), + pad_number_xpm ); + +TOOL_ACTION PCB_ACTIONS::zoomFootprintAutomatically( "pcbnew.Control.zoomFootprintAutomatically", + AS_GLOBAL, 0, "", + _( "Automatically zoom to fit" ), _( "Zoom to fit when changing footprint" ), + zoom_auto_fit_in_page_xpm ); + TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable", AS_GLOBAL, 0, "", _( "Fill Zones" ), _( "Show filled areas of zones" ), diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 08447e7e29..7fa5c97a0a 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -227,6 +227,8 @@ public: static TOOL_ACTION zoneDisplayDisable; static TOOL_ACTION zoneDisplayOutlines; static TOOL_ACTION zoneDisplayToggle; + static TOOL_ACTION showPadNumbers; + static TOOL_ACTION zoomFootprintAutomatically; // Layer control static TOOL_ACTION layerTop; diff --git a/pcbnew/tools/pcb_viewer_tools.cpp b/pcbnew/tools/pcb_viewer_tools.cpp index dc0025a66c..6c2984a0b3 100644 --- a/pcbnew/tools/pcb_viewer_tools.cpp +++ b/pcbnew/tools/pcb_viewer_tools.cpp @@ -86,6 +86,34 @@ template void Flip( T& aValue ) } +int PCB_VIEWER_TOOLS::ZoomAutomatically( const TOOL_EVENT& aEvent ) +{ + frame()->SetAutoZoom( !frame()->GetAutoZoom() ); + + return 0; +} + + +int PCB_VIEWER_TOOLS::ShowPadNumbers( const TOOL_EVENT& aEvent ) +{ + auto opts = displayOptions(); + + Flip( opts.m_DisplayPadNum ); + frame()->SetDisplayOptions( opts ); + view()->UpdateDisplayOptions( opts ); + + for( auto module : board()->Modules() ) + { + for( auto pad : module->Pads() ) + view()->Update( pad, KIGFX::GEOMETRY ); + } + + canvas()->Refresh(); + + return 0; +} + + int PCB_VIEWER_TOOLS::PadDisplayMode( const TOOL_EVENT& aEvent ) { auto opts = displayOptions(); @@ -292,9 +320,12 @@ void PCB_VIEWER_TOOLS::setTransitions() Go( &PCB_VIEWER_TOOLS::Show3DViewer, ACTIONS::show3DViewer.MakeEvent() ); // Display modes + Go( &PCB_VIEWER_TOOLS::ShowPadNumbers, PCB_ACTIONS::showPadNumbers.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::ModuleEdgeOutlines, PCB_ACTIONS::moduleEdgeOutlines.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::ModuleTextOutlines, PCB_ACTIONS::moduleTextOutlines.MakeEvent() ); + Go( &PCB_VIEWER_TOOLS::ZoomAutomatically, + PCB_ACTIONS::zoomFootprintAutomatically.MakeEvent() ); Go( &PCB_VIEWER_TOOLS::MeasureTool, ACTIONS::measureTool.MakeEvent() ); } diff --git a/pcbnew/tools/pcb_viewer_tools.h b/pcbnew/tools/pcb_viewer_tools.h index 7c74aab4fb..6d4adca3b6 100644 --- a/pcbnew/tools/pcb_viewer_tools.h +++ b/pcbnew/tools/pcb_viewer_tools.h @@ -55,9 +55,11 @@ public: int MeasureTool( const TOOL_EVENT& aEvent ); // Display modes + int ShowPadNumbers( const TOOL_EVENT& aEvent ); int PadDisplayMode( const TOOL_EVENT& aEvent ); int ModuleEdgeOutlines( const TOOL_EVENT& aEvent ); int ModuleTextOutlines( const TOOL_EVENT& aEvent ); + int ZoomAutomatically( const TOOL_EVENT& aEvent ); /// Show the 3D viewer int Show3DViewer( const TOOL_EVENT& aEvent );