diff --git a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp index 808712a977..c93fdb9b9c 100644 --- a/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp +++ b/eeschema/dialogs/dialog_global_edit_text_and_graphics.cpp @@ -422,7 +422,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe } } - if( aItem->Type() == SCH_SYMBOL_T ) + switch( aItem->Type() ) + { + case SCH_SYMBOL_T: { SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem; @@ -446,8 +448,11 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe } } } + + break; } - else if( aItem->Type() == SCH_SHEET_T ) + + case SCH_SHEET_T: { SCH_SHEET* sheet = static_cast( aItem ); @@ -488,19 +493,28 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe for( SCH_SHEET_PIN* pin : sheet->GetPins() ) processItem( aSheetPath, pin ); } + + break; } - else if( m_wires->GetValue() && aItem->IsType( { SCH_ITEM_LOCATE_WIRE_T, - SCH_LABEL_LOCATE_WIRE_T } ) ) + + case SCH_LINE_T: { - processItem( aSheetPath, aItem ); + SCH_LINE* line = static_cast( aItem ); + + if( m_schTextAndGraphics->GetValue() && line->GetLayer() == LAYER_NOTES ) + processItem( aSheetPath, aItem ); + else if( m_wires->GetValue() && line->GetLayer() == LAYER_WIRE ) + processItem( aSheetPath, aItem ); + else if( m_buses->GetValue() && line->GetLayer() == LAYER_BUS ) + processItem( aSheetPath, aItem ); + + break; } - else if( m_buses->GetValue() && aItem->IsType( { SCH_ITEM_LOCATE_BUS_T, - SCH_LABEL_LOCATE_BUS_T } ) ) - { - processItem( aSheetPath, aItem ); - } - else if( aItem->IsType( { SCH_LABEL_LOCATE_ANY_T } ) ) - { + + case SCH_LABEL_T: + case SCH_GLOBAL_LABEL_T: + case SCH_HIER_LABEL_T: + case SCH_DIRECTIVE_LABEL_T: if( m_globalLabels->GetValue() && aItem->Type() == SCH_GLOBAL_LABEL_T ) processItem( aSheetPath, aItem ); @@ -520,8 +534,10 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe } } } - } - else if( aItem->Type() == SCH_JUNCTION_T ) + + break; + + case SCH_JUNCTION_T: { SCH_JUNCTION* junction = static_cast( aItem ); @@ -538,12 +554,20 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe break; } } + + break; } - else if( m_schTextAndGraphics->GetValue() && aItem->IsType( { SCH_TEXT_T, SCH_TEXTBOX_T, - SCH_ITEM_LOCATE_GRAPHIC_LINE_T, - SCH_SHAPE_T } ) ) - { - processItem( aSheetPath, aItem ); + + case SCH_TEXT_T: + case SCH_TEXTBOX_T: + case SCH_SHAPE_T: + if( m_schTextAndGraphics->GetValue() ) + processItem( aSheetPath, aItem ); + + break; + + default: + break; } } @@ -578,6 +602,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow() // Reset the view to where we left the user m_parent->SetCurrentSheet( currentSheet ); + m_parent->Refresh(); return true; }