From 08fd9d8cbdd3e8586f567e0bf4d8113312b96d4f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 2 Dec 2013 14:35:05 +0100 Subject: [PATCH] Overridden ViewUpdate() for MODULE class, so it handles its pads, drawings and texts. --- common/view/view.cpp | 2 +- common/view/view_item.cpp | 2 +- include/view/view.h | 13 ++++++++----- pcbnew/class_module.cpp | 22 ++++++++++++++++++++++ pcbnew/class_module.h | 3 +++ 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/common/view/view.cpp b/common/view/view.cpp index 078fa0b907..ebc0b1c1b9 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -819,7 +819,7 @@ void VIEW::clearGroupCache() } -void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags ) +void VIEW::InvalidateItem( VIEW_ITEM* aItem, int aUpdateFlags ) { // updateLayers updates geometry too, so we do not have to update both of them at the same time if( aUpdateFlags & VIEW_ITEM::LAYERS ) diff --git a/common/view/view_item.cpp b/common/view/view_item.cpp index 1521c88a9e..e2ddd6a01d 100644 --- a/common/view/view_item.cpp +++ b/common/view/view_item.cpp @@ -53,7 +53,7 @@ void VIEW_ITEM::ViewUpdate( int aUpdateFlags ) if( !m_view ) return; - m_view->invalidateItem( this, aUpdateFlags ); + m_view->InvalidateItem( this, aUpdateFlags ); } diff --git a/include/view/view.h b/include/view/view.h index a5e0756219..f7a7e90984 100644 --- a/include/view/view.h +++ b/include/view/view.h @@ -493,6 +493,14 @@ public: m_scaleLimits = VECTOR2D( aMaximum, aMinimum ); } + /** + * Function InvalidateItem() + * Manages dirty flags & redraw queueing when updating an item. + * @param aItem is the item to be updated. + * @param aUpdateFlags determines the way an item is refreshed. + */ + void InvalidateItem( VIEW_ITEM* aItem, int aUpdateFlags ); + static const int VIEW_MAX_LAYERS = 128; ///* maximum number of layers that may be shown private: @@ -563,11 +571,6 @@ private: */ void draw( VIEW_GROUP* aGroup, bool aImmediate = false ) const; - - ///* Manages dirty flags & redraw queueing when updating an item. Called internally - /// via VIEW_ITEM::ViewUpdate() - void invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags ); - ///* Sorts m_orderedLayers when layer rendering order has changed void sortLayers(); diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index dd1aca96e5..9694607a39 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -728,6 +728,28 @@ EDA_ITEM* MODULE::Clone() const } +void MODULE::ViewUpdate( int aUpdateFlags ) +{ + if( !m_view ) + return; + + // Update pads + for( D_PAD* pad = m_Pads.GetFirst(); pad; pad = pad->Next() ) + m_view->InvalidateItem( pad, aUpdateFlags ); + + // Update module's drawing (mostly silkscreen) + for( BOARD_ITEM* drawing = m_Drawings.GetFirst(); drawing; drawing = drawing->Next() ) + m_view->InvalidateItem( drawing, aUpdateFlags ); + + // Update module's texts + m_view->InvalidateItem( m_Reference, aUpdateFlags ); + m_view->InvalidateItem( m_Value, aUpdateFlags ); + + // Update the module itself + m_view->InvalidateItem( this, aUpdateFlags ); +} + + /* Test for validity of the name in a library of the footprint * ( no spaces, dir separators ... ) * return true if the given name is valid diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 184e9e7288..a1564db05e 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -447,6 +447,9 @@ public: EDA_ITEM* Clone() const; + /// @copydoc VIEW_ITEM::ViewUpdate() + void ViewUpdate( int aUpdateFlags ); + /** * Function CopyNetlistSettings * copies the netlist settings to \a aModule.