From 92831ee7d46b98f1d8d8efc2b5a2d5a0861531d2 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 6 Jan 2013 14:31:49 +0100 Subject: [PATCH] Gerbview: add option to show negative objects. --- bitmaps_png/CMakeLists.txt | 1 + .../cpp_26/gerbview_show_negative_objects.cpp | 98 ++++++++ .../gerbview_show_negative_objects.svg | 209 ++++++++++++++++++ gerbview/class_gerber_draw_item.cpp | 8 +- gerbview/class_gerbview_layer_widget.cpp | 4 +- gerbview/events_called_functions.cpp | 7 + gerbview/gerbview.h | 7 +- gerbview/gerbview_config.cpp | 6 +- gerbview/gerbview_frame.cpp | 50 ++++- gerbview/gerbview_frame.h | 55 ++++- gerbview/gerbview_id.h | 1 + gerbview/menubar.cpp | 6 +- gerbview/toolbars_gerber.cpp | 11 + include/bitmaps.h | 1 + 14 files changed, 436 insertions(+), 28 deletions(-) create mode 100644 bitmaps_png/cpp_26/gerbview_show_negative_objects.cpp create mode 100644 bitmaps_png/sources/gerbview_show_negative_objects.svg diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt index eb69a56293..6fc5037fc3 100644 --- a/bitmaps_png/CMakeLists.txt +++ b/bitmaps_png/CMakeLists.txt @@ -268,6 +268,7 @@ set( BMAPS_MID gerber_file gerber_recent_files gerber_open_dcode_file + gerbview_show_negative_objects gerbview_drill_file gerbview_clear_layers gerber_open_dcode_file diff --git a/bitmaps_png/cpp_26/gerbview_show_negative_objects.cpp b/bitmaps_png/cpp_26/gerbview_show_negative_objects.cpp new file mode 100644 index 0000000000..5d4c72fda5 --- /dev/null +++ b/bitmaps_png/cpp_26/gerbview_show_negative_objects.cpp @@ -0,0 +1,98 @@ + +/* 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, 0x05, 0x12, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0x95, 0x56, 0x0b, 0x48, 0x5b, + 0x67, 0x14, 0x8e, 0x26, 0xe2, 0x2b, 0xc4, 0x44, 0x13, 0x93, 0x68, 0x8c, 0x6e, 0xda, 0x18, 0x75, + 0x2a, 0xc3, 0x32, 0xa7, 0x42, 0x51, 0x4b, 0x55, 0xe6, 0x13, 0x99, 0xb3, 0x8e, 0xcd, 0x31, 0xcb, + 0x40, 0x70, 0xb8, 0x09, 0xa2, 0x65, 0xb4, 0xeb, 0x5a, 0x51, 0xab, 0x58, 0xdc, 0xd8, 0x46, 0xb5, + 0x6b, 0xa7, 0xb4, 0x9d, 0xce, 0x47, 0x8b, 0x1a, 0x70, 0x2e, 0x2a, 0x55, 0xeb, 0x13, 0xac, 0x9b, + 0xf5, 0x89, 0xb6, 0x53, 0x26, 0x3e, 0xf0, 0x5d, 0x1f, 0x15, 0xb3, 0x34, 0x67, 0xe7, 0xbf, 0xf6, + 0x86, 0x6b, 0x8c, 0x56, 0x0f, 0x7c, 0xdc, 0xfb, 0xdf, 0x7b, 0xce, 0xf7, 0xdd, 0xff, 0xff, 0xcf, + 0x7f, 0xce, 0x65, 0x01, 0x00, 0x8b, 0x09, 0x34, 0x6b, 0x44, 0x22, 0xa2, 0x06, 0x31, 0x80, 0xf8, + 0x13, 0x51, 0x86, 0xf0, 0x36, 0xe2, 0xcb, 0x46, 0x7c, 0x21, 0x10, 0x08, 0xfe, 0x12, 0x89, 0x44, + 0xd3, 0x7c, 0x3e, 0xbf, 0x1b, 0xc7, 0x67, 0x0d, 0xfd, 0x28, 0x5f, 0x83, 0xc0, 0x77, 0x10, 0xcf, + 0x11, 0x64, 0x00, 0x12, 0x89, 0x1c, 0xe8, 0x7b, 0x84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2, 0xda, 0xda, 0xfe, 0x0c, + 0x27, 0x30, 0x92, 0x8d, 0x5e, 0x5e, 0x5e, 0xf7, 0x99, 0x95, 0x41, 0x50, 0x27, 0x93, 0x8d, 0xd3, + 0x42, 0x17, 0x85, 0x42, 0x28, 0xc1, 0x0c, 0xbc, 0x2a, 0x12, 0x41, 0x93, 0x5c, 0x3e, 0x46, 0x96, + 0x8d, 0xf8, 0x79, 0x7b, 0x7b, 0x97, 0xc3, 0x09, 0x2d, 0x30, 0x30, 0xb0, 0x4e, 0x2f, 0x24, 0x61, + 0xb3, 0x3f, 0xc0, 0xaf, 0x7f, 0x45, 0x0b, 0x3d, 0xc3, 0x19, 0xfd, 0x7b, 0xea, 0x14, 0x75, 0xbf, + 0xae, 0x54, 0xee, 0x70, 0x58, 0xac, 0x70, 0xe2, 0x17, 0x12, 0x12, 0x52, 0xc7, 0x24, 0x59, 0x5c, + 0x5c, 0xd4, 0x67, 0xd8, 0x61, 0x16, 0x16, 0x16, 0xd6, 0xaa, 0x17, 0x0a, 0xb1, 0xb6, 0xce, 0x30, + 0xdc, 0x1b, 0x26, 0x82, 0x2c, 0x2d, 0xbf, 0x24, 0x7e, 0x58, 0x2c, 0x1f, 0xd3, 0x04, 0x59, 0x59, + 0x59, 0x30, 0x3a, 0x3a, 0x0a, 0xe5, 0xe5, 0x47, 0x4f, 0x12, 0x53, 0xbe, 0x57, 0x2f, 0x74, 0x41, + 0x20, 0xb8, 0x7e, 0x94, 0x50, 0x32, 0x9f, 0x7f, 0x8d, 0xf8, 0xa5, 0xa4, 0xa4, 0x0c, 0xd2, 0x04, + 0x79, 0x79, 0x79, 0x50, 0x55, 0x55, 0x05, 0xf5, 0xf5, 0xf5, 0x47, 0x0a, 0x25, 0x27, 0x27, 0x93, + 0xa5, 0x37, 0xa1, 0x13, 0xa1, 0x8c, 0x10, 0xee, 0x60, 0xd6, 0x0d, 0x61, 0x3b, 0x30, 0x14, 0xfa, + 0xda, 0xce, 0xee, 0x27, 0x74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0x19, 0xf9, 0x51, 0x0c, 0xc3, 0xa0, 0x7e, 0x17, 0x17, 0x97, 0x21, 0xb1, 0x58, 0x3c, + 0x60, 0x6a, 0x6a, 0x5a, 0x8f, 0xcf, 0xdc, 0x18, 0xef, 0x4d, 0x10, 0x9f, 0x22, 0x1e, 0x20, 0x32, + 0x11, 0x56, 0xcc, 0x77, 0xe4, 0xfa, 0x3f, 0x3f, 0xec, 0xf2, 0x15, 0x79, 0x42, 0xd0, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +}; + +const BITMAP_OPAQUE gerbview_show_negative_objects_xpm[1] = {{ png, sizeof( png ), "gerbview_show_negative_objects_xpm" }}; + +//EOF diff --git a/bitmaps_png/sources/gerbview_show_negative_objects.svg b/bitmaps_png/sources/gerbview_show_negative_objects.svg new file mode 100644 index 0000000000..1169add744 --- /dev/null +++ b/bitmaps_png/sources/gerbview_show_negative_objects.svg @@ -0,0 +1,209 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index 7a3b37d6e2..134c097791 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -330,7 +330,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra if( color & HIGHLIGHT_FLAG ) color = ColorRefs[color & MASKCOLOR].m_LightColor; - alt_color = g_DrawBgColor; + alt_color = gerbFrame->GetNegativeItemsColor(); /* isDark is true if flash is positive and should use a drawing * color other than the background color, else use the background color @@ -346,12 +346,12 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra GRSetDrawMode( aDC, aDrawMode ); - isFilled = gerbFrame->m_DisplayOptions.m_DisplayLinesFill; + isFilled = gerbFrame->DisplayLinesSolidMode(); switch( m_Shape ) { case GBR_POLYGON: - isFilled = gerbFrame->m_DisplayOptions.m_DisplayPolygonsFill; + isFilled = gerbFrame->DisplayPolygonsSolidMode(); if( !isDark ) isFilled = true; @@ -411,7 +411,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra case GBR_SPOT_OVAL: case GBR_SPOT_POLY: case GBR_SPOT_MACRO: - isFilled = gerbFrame->m_DisplayOptions.m_DisplayFlashedItemsFill; + isFilled = gerbFrame->DisplayFlashedItemsSolidMode(); d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color, alt_color, m_Start, isFilled ); break; diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index c3883214e4..64228206f4 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -97,13 +97,15 @@ void GERBER_LAYER_WIDGET::ReFillRender() // is changed before appending to the LAYER_WIDGET. This is an automatic variable // not a static variable, change the color & state after copying from code to renderRows // on the stack. - LAYER_WIDGET::ROW renderRows[2] = { + LAYER_WIDGET::ROW renderRows[3] = { #define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width // text id color tooltip checked RR( _( "Grid" ), GERBER_GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ), RR( _( "DCodes" ), DCODES_VISIBLE, WHITE, _( "Show DCodes identification" ) ), + RR( _( "Neg. Obj." ), NEGATIVE_OBJECTS_VISIBLE, DARKGRAY, + _( "Show negative objects in this color" ) ), }; for( unsigned row=0; rowRefresh( true ); break; + case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS: + SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, state ); + m_canvas->Refresh( true ); + break; + case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR: // show/hide auxiliary Vertical layers and visibility manager toolbar m_show_layer_manager_tools = state; diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index a59d017ee1..48fd793af5 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -41,9 +41,12 @@ extern const wxChar* g_GerberPageSizeList[8]; */ enum GERBER_VISIBLE_ID { - DCODES_VISIBLE = 1, // visible item id cannot be 0 because this id is used as wxWidget id + DCODES_VISIBLE = 1, // visible item id cannot be 0 + // because this id is used as wxWidget id GERBER_GRID_VISIBLE, - END_GERBER_VISIBLE_LIST // sentinel + NEGATIVE_OBJECTS_VISIBLE, // use the selected color to draw negative objects + // instaed of background color, to make them visible + END_GERBER_VISIBLE_LIST // sentinel }; extern const wxString GerbviewProjectFileExt; diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index a690359d9c..4c258eea3d 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -95,7 +95,11 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings() &g_ColorsSettings.m_ItemsColors[ DCODES_VISIBLE], WHITE ) ); - + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, + wxT( "NegativeObjectsColor" ), + &g_ColorsSettings.m_ItemsColors[ + NEGATIVE_OBJECTS_VISIBLE], + DARKGRAY ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoordinates" ), &m_DisplayOptions.m_DisplayPolarCood, diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 04afde15f0..253e3498ef 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1994 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 1992-2013 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 @@ -51,6 +51,7 @@ // Config keywords static const wxString cfgShowPageSizeOption( wxT( "ShowPageSizeOpt" ) ); static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) ); +static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) ); static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) ); @@ -228,9 +229,11 @@ void GERBVIEW_FRAME::LoadSettings() GetScreen()->InitDataPoints( pageInfo.GetSizeIU() ); - long tmp; - config->Read( cfgShowDCodes, &tmp, 1 ); + bool tmp; + config->Read( cfgShowDCodes, &tmp, true ); SetElementVisibility( DCODES_VISIBLE, tmp ); + config->Read( cfgShowNegativeObjects, &tmp, false ); + SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, tmp ); // because we have 2 file historues, we must read this one // using a specific path @@ -259,6 +262,8 @@ void GERBVIEW_FRAME::SaveSettings() config->Write( cfgShowPageSizeOption, GetPageSettings().GetType() ); config->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock ); config->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) ); + config->Write( cfgShowNegativeObjects, + IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); // Save the drill file history list. // Because we have 2 file histories, we must save this one @@ -304,6 +309,10 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible, m_DisplayOptions.m_DisplayDCodes = aNewState; break; + case NEGATIVE_OBJECTS_VISIBLE: + m_DisplayOptions.m_DisplayNegativeObjects = aNewState; + break; + case GERBER_GRID_VISIBLE: SetGridVisibility( aNewState ); break; @@ -483,14 +492,13 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo() m_TextInfo->SetValue( text ); } - /* * Function IsElementVisible * tests whether a given element category is visible * aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID * return true if the element is visible. */ -bool GERBVIEW_FRAME::IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) +bool GERBVIEW_FRAME::IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const { switch( aItemIdVisible ) { @@ -498,6 +506,10 @@ bool GERBVIEW_FRAME::IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) return m_DisplayOptions.m_DisplayDCodes; break; + case NEGATIVE_OBJECTS_VISIBLE: + return m_DisplayOptions.m_DisplayNegativeObjects; + break; + case GERBER_GRID_VISIBLE: return IsGridVisible(); break; @@ -562,12 +574,13 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayerIndex ) const * returns the color of a pcb visible element. * @see enum PCB_VISIBLE */ -EDA_COLOR_T GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) +EDA_COLOR_T GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const { EDA_COLOR_T color = UNSPECIFIED_COLOR; switch( aItemIdVisible ) { + case NEGATIVE_OBJECTS_VISIBLE: case DCODES_VISIBLE: color = m_colorsSettings->GetItemColor( aItemIdVisible ); break; @@ -599,6 +612,7 @@ void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, { switch( aItemIdVisible ) { + case NEGATIVE_OBJECTS_VISIBLE: case DCODES_VISIBLE: m_colorsSettings->SetItemColor( aItemIdVisible, aColor ); break; @@ -614,10 +628,26 @@ void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, } } +/* + * Function GetNegativeItemsColor + * returns the color of negative items. + * This is usually the background color, but can be an other color + * in order to see negative objects + * therefore returns the background color if negative items not visible + * and the color selection of negative items if they are visible + */ +EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const +{ + if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ) + return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE ); + else + return g_DrawBgColor; +} -/** + +/* * Function GetLayerColor - * gets a layer color for any valid layer, including non-copper ones. + * gets a layer color for any valid layer. */ EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const { @@ -627,7 +657,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const /** * Function SetLayerColor - * changes a layer color for any valid layer, including non-copper ones. + * changes a layer color for any valid layer. */ void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) { diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 6a6fd29077..6a325020cb 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2007 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2013 Wayne Stambaugh + * Copyright (C) 1992-2013 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 @@ -58,7 +58,9 @@ public: bool m_DisplayPolygonsFill; bool m_DisplayPolarCood; bool m_DisplayDCodes; + bool m_DisplayNegativeObjects; bool m_IsPrinting; + public: GBR_DISPLAY_OPTIONS() { @@ -267,7 +269,7 @@ public: * @param aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID * @return bool - true if the element is visible. */ - bool IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ); + bool IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const; /** * Function SetElementVisibility @@ -319,22 +321,60 @@ public: * Function GetVisibleElementColor * returns the color of a gerber visible element. */ - EDA_COLOR_T GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ); + EDA_COLOR_T GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const; void SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, EDA_COLOR_T aColor ); /** * Function GetLayerColor - * gets a layer color for any valid layer, including non-copper ones. + * gets a layer color for any valid layer. */ EDA_COLOR_T GetLayerColor( int aLayer ) const; /** * Function SetLayerColor - * changes a layer color for any valid layer, including non-copper ones. + * changes a layer color for any valid layer. */ void SetLayerColor( int aLayer, EDA_COLOR_T aColor ); + /** + * Function GetNegativeItemsColor + * @return the color of negative items. + * This is usually the background color, but can be an other color + * in order to see negative objects + */ + EDA_COLOR_T GetNegativeItemsColor() const; + + /** + * Function DisplayLinesSolidMode + * @return true to draw gerber lines in solid (filled) mode, + * false to draw gerber lines in sketch mode + */ + bool DisplayLinesSolidMode() + { + return m_DisplayOptions.m_DisplayLinesFill; + } + + /** + * Function DisplayPolygonsSolidMode + * @return true to draw polygon in solid (filled) mode, + * false to draw polygon outlines only + */ + bool DisplayPolygonsSolidMode() + { + return m_DisplayOptions.m_DisplayPolygonsFill; + } + + /** + * Function DisplayFlashedItemsSolidMode + * @return true to draw flashed items in solid (filled) mode, + * false to draw draw flashed in sketch mode + */ + bool DisplayFlashedItemsSolidMode() + { + return m_DisplayOptions.m_DisplayFlashedItemsFill; + } + /** * Function ReFillLayerWidget * changes out all the layers in m_Layers and may be called upon @@ -500,6 +540,7 @@ public: void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent ); + void OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent ); void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ); void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ); void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); diff --git a/gerbview/gerbview_id.h b/gerbview/gerbview_id.h index 3d83291b2a..3adc44b6ed 100644 --- a/gerbview/gerbview_id.h +++ b/gerbview/gerbview_id.h @@ -47,6 +47,7 @@ enum gerbview_ids ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, ID_TB_OPTIONS_SHOW_LINES_SKETCH, ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, + ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_1, ID_TB_OPTIONS_SHOW_GBR_MODE_2, diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 9aeca9ba95..982de72de6 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2009-2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2009-2013 Wayne Stambaugh + * Copyright (C) 1992-2013 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 diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index 0cbe384edc..820980ee1c 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -178,6 +178,11 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void ) _( "Show polygons in sketch mode" ), wxITEM_CHECK ); + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString, + KiBitmap( gerbview_show_negative_objects_xpm ), + _( "Show negatives objects in ghost color" ), + wxITEM_CHECK ); + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, wxEmptyString, KiBitmap( show_dcodenumber_xpm ), _( "Show dcode number" ), wxITEM_CHECK ); @@ -264,6 +269,12 @@ void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent ) } +void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent ) +{ + aEvent.Check( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) ); +} + + void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ) { aEvent.Check( m_show_layer_manager_tools ); diff --git a/include/bitmaps.h b/include/bitmaps.h index 3d77faee4b..6bf1d5d181 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -185,6 +185,7 @@ EXTERN_BITMAP( gerber_recent_files_xpm ) EXTERN_BITMAP( gerbview_clear_layers_xpm ) EXTERN_BITMAP( gerber_open_dcode_file_xpm ) EXTERN_BITMAP( gerbview_open_recent_drill_files_xpm ) +EXTERN_BITMAP( gerbview_show_negative_objects_xpm ); EXTERN_BITMAP( general_deletions_xpm ) EXTERN_BITMAP( general_ratsnest_xpm ) EXTERN_BITMAP( glabel2label_xpm )