Loading common/view/view.cpp +27 −12 Original line number Diff line number Diff line Loading @@ -498,14 +498,16 @@ struct VIEW::drawItem { group = gal->BeginGroup(); aItem->setGroup( currentLayer->id, group ); view->m_painter->Draw( aItem, currentLayer->id ); if(!view->m_painter->Draw( aItem, currentLayer->id )) aItem->ViewDraw(currentLayer->id, gal, BOX2I()); gal->EndGroup(); } } else { // Immediate mode view->m_painter->Draw( aItem, currentLayer->id ); if(!view->m_painter->Draw( aItem, currentLayer->id )) aItem->ViewDraw(currentLayer->id, gal, BOX2I()); } } Loading @@ -526,11 +528,20 @@ void VIEW::redrawRect( const BOX2I& aRect ) m_gal->SetTarget( l->target ); m_gal->SetLayerDepth( l->renderingOrder ); l->items->Query( aRect, drawFunc ); l->isDirty = false; } l->isDirty = false; } } bool VIEW::IsDirty() { BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers ) { if(l->isDirty) return true; } return false; } struct VIEW::unlinkItem { Loading Loading @@ -621,20 +632,24 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags ) aItem->ViewGetLayers( layer_indices, layer_count ); for( int i = 0; i < layer_count; i++ ) { if(m_layers.find(layer_indices[i]) != m_layers.end()) { VIEW_LAYER* l = &m_layers[layer_indices[i]]; l->dirtyExtents = l->isDirty ? aItem->ViewBBox() : l->dirtyExtents.Merge( aItem->ViewBBox() ); l->isDirty = true; if( aUpdateFlags & VIEW_ITEM::GEOMETRY ) { l->items->Remove( aItem ); l->items->Insert( aItem ); /* reinsert */ aItem->deleteGroups(); } } } if( aItem->storesGroups() ) { Loading common/view/view_item.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ void VIEW_ITEM::ViewGetRequiredLayers( int aLayers[], int& aCount ) const void VIEW_ITEM::ViewUpdate( int aUpdateFlags, bool aForceImmediateRedraw ) { if(!m_view) return; m_view->invalidateItem( this, aUpdateFlags ); if( aForceImmediateRedraw ) Loading Loading @@ -140,3 +143,9 @@ bool VIEW_ITEM::storesGroups() const { return ( m_groupsSize > 0 ); } void VIEW_ITEM::ViewSetHighlighted( bool aIsHighlighted ) { m_highlighted = aIsHighlighted; ViewUpdate(APPEARANCE | GEOMETRY); } include/view/view.h +3 −1 Original line number Diff line number Diff line Loading @@ -360,6 +360,8 @@ public: */ bool IsDynamic() const { return m_dynamic; } bool IsDirty(); static const int VIEW_MAX_LAYERS = 128; ///* maximum number of layers that may be shown private: Loading include/view/view_controls.h +7 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ public: JUMP = 2 }; VIEW_CONTROLS( VIEW* aView ) : m_view( aView ) {}; virtual ~VIEW_CONTROLS() {}; Loading @@ -74,7 +75,7 @@ public: virtual void SetGrabMouse( bool aEnabled ) {}; /** * Function SetGrabMouse * Function SetAutoPan * Turns on/off auto panning (this feature is used when there is a tool active (eg. drawing a * track) and user moves mouse to the VIEW edge - then the view can be translated or not). * @param aEnabled tells if the autopanning should be active. Loading Loading @@ -108,6 +109,11 @@ public: */ virtual void AnimatedZoom( const BOX2I& aExtents ) {}; virtual void WarpCursor (const VECTOR2D& aPosition ) {}; virtual void ShowCursor (bool aEnabled ) {}; protected: /// Pointer to controlled VIEW. VIEW* m_view; Loading include/view/wx_view_controls.h +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include <view/view_controls.h> class EDA_DRAW_PANEL_GAL; class TOOL_DISPATCHER; namespace KiGfx { Loading @@ -56,6 +57,8 @@ public: void onButton( wxMouseEvent& event ); void onEnter( wxMouseEvent& event ); void SetEventDispatcher( TOOL_DISPATCHER *aEventDispatcher ); private: /// Options for WX_VIEW_CONTROLS Loading @@ -80,6 +83,7 @@ private: /// Used for determining time intervals between events. wxLongLong m_timeStamp; TOOL_DISPATCHER* m_eventDispatcher; }; } // namespace KiGfx Loading Loading
common/view/view.cpp +27 −12 Original line number Diff line number Diff line Loading @@ -498,14 +498,16 @@ struct VIEW::drawItem { group = gal->BeginGroup(); aItem->setGroup( currentLayer->id, group ); view->m_painter->Draw( aItem, currentLayer->id ); if(!view->m_painter->Draw( aItem, currentLayer->id )) aItem->ViewDraw(currentLayer->id, gal, BOX2I()); gal->EndGroup(); } } else { // Immediate mode view->m_painter->Draw( aItem, currentLayer->id ); if(!view->m_painter->Draw( aItem, currentLayer->id )) aItem->ViewDraw(currentLayer->id, gal, BOX2I()); } } Loading @@ -526,11 +528,20 @@ void VIEW::redrawRect( const BOX2I& aRect ) m_gal->SetTarget( l->target ); m_gal->SetLayerDepth( l->renderingOrder ); l->items->Query( aRect, drawFunc ); l->isDirty = false; } l->isDirty = false; } } bool VIEW::IsDirty() { BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers ) { if(l->isDirty) return true; } return false; } struct VIEW::unlinkItem { Loading Loading @@ -621,20 +632,24 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags ) aItem->ViewGetLayers( layer_indices, layer_count ); for( int i = 0; i < layer_count; i++ ) { if(m_layers.find(layer_indices[i]) != m_layers.end()) { VIEW_LAYER* l = &m_layers[layer_indices[i]]; l->dirtyExtents = l->isDirty ? aItem->ViewBBox() : l->dirtyExtents.Merge( aItem->ViewBBox() ); l->isDirty = true; if( aUpdateFlags & VIEW_ITEM::GEOMETRY ) { l->items->Remove( aItem ); l->items->Insert( aItem ); /* reinsert */ aItem->deleteGroups(); } } } if( aItem->storesGroups() ) { Loading
common/view/view_item.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,9 @@ void VIEW_ITEM::ViewGetRequiredLayers( int aLayers[], int& aCount ) const void VIEW_ITEM::ViewUpdate( int aUpdateFlags, bool aForceImmediateRedraw ) { if(!m_view) return; m_view->invalidateItem( this, aUpdateFlags ); if( aForceImmediateRedraw ) Loading Loading @@ -140,3 +143,9 @@ bool VIEW_ITEM::storesGroups() const { return ( m_groupsSize > 0 ); } void VIEW_ITEM::ViewSetHighlighted( bool aIsHighlighted ) { m_highlighted = aIsHighlighted; ViewUpdate(APPEARANCE | GEOMETRY); }
include/view/view.h +3 −1 Original line number Diff line number Diff line Loading @@ -360,6 +360,8 @@ public: */ bool IsDynamic() const { return m_dynamic; } bool IsDirty(); static const int VIEW_MAX_LAYERS = 128; ///* maximum number of layers that may be shown private: Loading
include/view/view_controls.h +7 −1 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ public: JUMP = 2 }; VIEW_CONTROLS( VIEW* aView ) : m_view( aView ) {}; virtual ~VIEW_CONTROLS() {}; Loading @@ -74,7 +75,7 @@ public: virtual void SetGrabMouse( bool aEnabled ) {}; /** * Function SetGrabMouse * Function SetAutoPan * Turns on/off auto panning (this feature is used when there is a tool active (eg. drawing a * track) and user moves mouse to the VIEW edge - then the view can be translated or not). * @param aEnabled tells if the autopanning should be active. Loading Loading @@ -108,6 +109,11 @@ public: */ virtual void AnimatedZoom( const BOX2I& aExtents ) {}; virtual void WarpCursor (const VECTOR2D& aPosition ) {}; virtual void ShowCursor (bool aEnabled ) {}; protected: /// Pointer to controlled VIEW. VIEW* m_view; Loading
include/view/wx_view_controls.h +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include <view/view_controls.h> class EDA_DRAW_PANEL_GAL; class TOOL_DISPATCHER; namespace KiGfx { Loading @@ -56,6 +57,8 @@ public: void onButton( wxMouseEvent& event ); void onEnter( wxMouseEvent& event ); void SetEventDispatcher( TOOL_DISPATCHER *aEventDispatcher ); private: /// Options for WX_VIEW_CONTROLS Loading @@ -80,6 +83,7 @@ private: /// Used for determining time intervals between events. wxLongLong m_timeStamp; TOOL_DISPATCHER* m_eventDispatcher; }; } // namespace KiGfx Loading