From 7e6b2211e0b8785758409185c46f3a45c235cf07 Mon Sep 17 00:00:00 2001 From: Stefan Date: Fri, 22 May 2020 20:40:53 +0000 Subject: [PATCH] Add Assembly pcbview to pcb_layer_widget --- bitmaps_png/CMakeLists.txt | 2 +- bitmaps_png/cpp_26/shape_3d_back.cpp | 36 +++ .../include/bitmaps_png/bitmaps_list.h | 1 + bitmaps_png/sources/shape_3d_back.svg | 265 ++++++++++++++++++ common/lset.cpp | 24 ++ include/layers_id_colors_and_visibility.h | 14 + pcbnew/pcb_layer_widget.cpp | 20 ++ pcbnew/pcb_layer_widget.h | 4 +- 8 files changed, 364 insertions(+), 2 deletions(-) create mode 100644 bitmaps_png/cpp_26/shape_3d_back.cpp create mode 100644 bitmaps_png/sources/shape_3d_back.svg diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index 9311a9b552..4673c1dc11 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -1,4 +1,3 @@ - # This program source code file is part of KICAD, a free EDA CAD application. # # Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck @@ -449,6 +448,7 @@ set( BMAPS_MID select_w_layer select_same_sheet shape_3d + shape_3d_back sheetset simulator sim_run diff --git a/bitmaps_png/cpp_26/shape_3d_back.cpp b/bitmaps_png/cpp_26/shape_3d_back.cpp new file mode 100644 index 0000000000..5943ace706 --- /dev/null +++ b/bitmaps_png/cpp_26/shape_3d_back.cpp @@ -0,0 +1,36 @@ + +/* 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, 0x01, 0x35, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xed, 0x95, 0x4b, 0x6a, 0x84, + 0x40, 0x10, 0x86, 0xbb, 0xf1, 0xd5, 0x6a, 0xe6, 0x02, 0x9e, 0x22, 0xe0, 0x05, 0x66, 0x93, 0x85, + 0xa0, 0x73, 0x0c, 0xcf, 0x30, 0xbb, 0xcc, 0x36, 0x47, 0xf0, 0x04, 0xd9, 0x47, 0x21, 0x8b, 0x6c, + 0x72, 0x80, 0x11, 0x72, 0x0a, 0x2f, 0x90, 0xa8, 0xed, 0x2b, 0xa6, 0xaa, 0xc1, 0x20, 0x3a, 0x84, + 0x9e, 0xc5, 0x98, 0x49, 0xf0, 0x87, 0x9f, 0xbf, 0xc0, 0xc7, 0xd7, 0x65, 0x4b, 0x17, 0x25, 0x0b, + 0x89, 0x4a, 0xde, 0xd7, 0xff, 0x70, 0x6f, 0x2f, 0xf3, 0x9e, 0xeb, 0x01, 0x45, 0x51, 0x74, 0x80, + 0xb8, 0xa7, 0x94, 0x3e, 0x84, 0x61, 0xb8, 0x97, 0xbd, 0x36, 0x07, 0x1d, 0xc4, 0x8a, 0x2e, 0xbf, + 0x47, 0xde, 0xa3, 0xf7, 0xcf, 0x40, 0x8b, 0x7d, 0xba, 0x5f, 0xfd, 0xeb, 0x82, 0x20, 0x78, 0x57, + 0x14, 0xe5, 0x46, 0x55, 0x55, 0x02, 0x49, 0x86, 0xd4, 0x34, 0x4d, 0x24, 0xaa, 0xeb, 0x3a, 0xd2, + 0x34, 0x8d, 0xc8, 0xb6, 0x6d, 0xc7, 0xf9, 0x11, 0xc7, 0xf1, 0x46, 0x16, 0xd4, 0x33, 0xc6, 0x88, + 0x61, 0x18, 0x04, 0x73, 0x5a, 0xa3, 0x38, 0xe7, 0xc2, 0x55, 0x55, 0xcd, 0x6a, 0x00, 0x51, 0x29, + 0x90, 0xeb, 0xba, 0x47, 0x58, 0xf9, 0x2d, 0x74, 0xa2, 0x98, 0xa6, 0x49, 0xd0, 0x96, 0x65, 0x91, + 0xa1, 0x46, 0x95, 0x65, 0x29, 0x5c, 0x14, 0xc5, 0x77, 0x0d, 0x1d, 0x7e, 0x82, 0xde, 0xd2, 0x34, + 0x75, 0xa5, 0x40, 0x8e, 0xe3, 0xdc, 0xc1, 0x67, 0x7a, 0x82, 0x87, 0x99, 0x6d, 0xdb, 0x64, 0x6a, + 0x54, 0x9e, 0xe7, 0x33, 0xc3, 0x22, 0x38, 0xc0, 0x76, 0x59, 0x96, 0xbd, 0x9c, 0xd5, 0x11, 0x78, + 0xd6, 0x11, 0x26, 0x6a, 0xe8, 0x64, 0xdc, 0x11, 0xec, 0xd1, 0x79, 0x1d, 0x2d, 0xb6, 0x47, 0x2b, + 0x68, 0x05, 0xad, 0xa0, 0xbf, 0x05, 0x2a, 0xe1, 0xb8, 0x61, 0xa7, 0x20, 0x58, 0xa3, 0x4e, 0x01, + 0xd0, 0x70, 0x14, 0x71, 0x00, 0x99, 0x52, 0x20, 0xdf, 0xf7, 0xb7, 0xba, 0xae, 0x3f, 0xc3, 0x51, + 0xc7, 0x70, 0x16, 0x8d, 0x8d, 0x33, 0x09, 0x85, 0xb3, 0x08, 0xe7, 0xcf, 0xd8, 0x30, 0x8b, 0x78, + 0x5d, 0xd7, 0x5e, 0x92, 0x24, 0xaf, 0xd3, 0x77, 0x7e, 0x01, 0xdf, 0x92, 0xca, 0x98, 0x1d, 0x78, + 0x3f, 0xec, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE shape_3d_back_xpm[1] = {{ png, sizeof( png ), "shape_3d_back_xpm" }}; + +//EOF diff --git a/bitmaps_png/include/bitmaps_png/bitmaps_list.h b/bitmaps_png/include/bitmaps_png/bitmaps_list.h index 4db62f9e7e..9d233f2488 100644 --- a/bitmaps_png/include/bitmaps_png/bitmaps_list.h +++ b/bitmaps_png/include/bitmaps_png/bitmaps_list.h @@ -424,6 +424,7 @@ EXTERN_BITMAP( setcolor_solderpaste_xpm ) EXTERN_BITMAP( setcolor_copper_xpm ) EXTERN_BITMAP( setcolor_board_body_xpm ) EXTERN_BITMAP( shape_3d_xpm ) +EXTERN_BITMAP( shape_3d_back_xpm ) EXTERN_BITMAP( show_dcodenumber_xpm ) EXTERN_BITMAP( show_footprint_xpm ) EXTERN_BITMAP( show_graphics_mode_xpm ) diff --git a/bitmaps_png/sources/shape_3d_back.svg b/bitmaps_png/sources/shape_3d_back.svg new file mode 100644 index 0000000000..956fc8f5ae --- /dev/null +++ b/bitmaps_png/sources/shape_3d_back.svg @@ -0,0 +1,265 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/lset.cpp b/common/lset.cpp index 61a66022a2..d3ec2daa93 100644 --- a/common/lset.cpp +++ b/common/lset.cpp @@ -643,6 +643,30 @@ PCB_LAYER_ID LSET::ExtractLayer() const } +LSET LSET::FrontAssembly() +{ + static const PCB_LAYER_ID front_assembly[] = { + F_SilkS, + F_Mask, + }; + + static const LSET saved( front_assembly, arrayDim( front_assembly ) ); + return saved; +} + + +LSET LSET::BackAssembly() +{ + static const PCB_LAYER_ID back_assembly[] = { + B_SilkS, + B_Mask, + }; + + static const LSET saved( back_assembly, arrayDim( back_assembly ) ); + return saved; +} + + LSET LSET::InternalCuMask() { static const PCB_LAYER_ID cu_internals[] = { diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 348a40267e..39847161bc 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -506,6 +506,20 @@ public: */ static LSET InternalCuMask(); + /** + * Function FrontAssembly() + * returns a complete set of all top assembly layers, which is all F_SilkS + * and F_Mask + */ + static LSET FrontAssembly(); + + /** + * Function BackAssembly() + * returns a complete set of all bottom assembly layers, which is all B_SilkS + * and B_Mask + */ + static LSET BackAssembly(); + /** * Function AllCuMask * returns a mask holding the requested number of Cu PCB_LAYER_IDs. diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp index ab00d7cef7..fd0daef53f 100644 --- a/pcbnew/pcb_layer_widget.cpp +++ b/pcbnew/pcb_layer_widget.cpp @@ -180,6 +180,9 @@ void PCB_LAYER_WIDGET::AddRightClickMenuItems( wxMenu& menu ) menu.AppendSeparator(); + AddMenuItem( &menu, ID_SHOW_ONLY_FRONT_ASSEMBLY, _( "Show Only Front Assembly Layers" ), + KiBitmap( shape_3d_xpm ) ); + AddMenuItem( &menu, ID_SHOW_ONLY_FRONT, _( "Show Only Front Layers" ), KiBitmap( show_all_front_layers_xpm ) ); @@ -192,6 +195,9 @@ void PCB_LAYER_WIDGET::AddRightClickMenuItems( wxMenu& menu ) AddMenuItem( &menu, ID_SHOW_ONLY_BACK, _( "Show Only Back Layers" ), KiBitmap( show_all_back_layers_xpm ) ); + + AddMenuItem( &menu, ID_SHOW_ONLY_BACK_ASSEMBLY, _( "Show Only Back Assembly Layers" ), + KiBitmap( shape_3d_back_xpm ) ); } @@ -254,6 +260,13 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) layersToShow = LSET::AllNonCuMask(); break; + case ID_SHOW_ONLY_FRONT_ASSEMBLY: + // Include the edgecuts layer as well as the front assembly layers and hide the other layers + layersToShow = LSET::FrontAssembly().set( Edge_Cuts ); + layersToHide = ~layersToShow; + myframe->SetActiveLayer( F_SilkS ); + break; + case ID_SHOW_ONLY_FRONT: // Include the edgecuts layer as well as the front layers and hide the other layers layersToShow = LSET::FrontMask().set( Edge_Cuts ); @@ -271,6 +284,13 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) layersToShow = LSET::BackMask().set( Edge_Cuts ); layersToHide = ~layersToShow; break; + + case ID_SHOW_ONLY_BACK_ASSEMBLY: + // Include the edgecuts layer as well as the back assembly layers and hide the other layers + layersToShow = LSET::BackAssembly().set( Edge_Cuts ); + layersToHide = ~layersToShow; + myframe->SetActiveLayer( B_SilkS ); + break; } int rowCount = GetLayerRowCount(); diff --git a/pcbnew/pcb_layer_widget.h b/pcbnew/pcb_layer_widget.h index ad74c21092..19f98ed09c 100644 --- a/pcbnew/pcb_layer_widget.h +++ b/pcbnew/pcb_layer_widget.h @@ -124,7 +124,7 @@ protected: // popup menu ids. enum POPUP_ID { - ID_SHOW_ALL_COPPER_LAYERS = LAYER_WIDGET::ID_LAST_VALUE, + ID_SHOW_ALL_COPPER_LAYERS = LAYER_WIDGET::ID_LAST_VALUE, ID_HIDE_ALL_COPPER_LAYERS, ID_HIDE_ALL_COPPER_LAYERS_BUT_ACTIVE, ID_ALWAYS_HIDE_ALL_COPPER_LAYERS_BUT_ACTIVE, @@ -133,6 +133,8 @@ protected: ID_SHOW_ONLY_FRONT, ID_SHOW_ONLY_INNER, ID_SHOW_ONLY_BACK, + ID_SHOW_ONLY_FRONT_ASSEMBLY, + ID_SHOW_ONLY_BACK_ASSEMBLY, ID_HIDE_ALL_NON_COPPER, ID_SHOW_ALL_NON_COPPER, ID_LAST_VALUE