Code formatting

This commit is contained in:
Maciej Suminski 2016-12-09 12:04:32 +01:00
parent daf103d7e4
commit 89055c4425
44 changed files with 290 additions and 349 deletions

View File

@ -109,96 +109,40 @@ void CAIRO_GAL::BeginDrawing()
compositor->SetMainContext( context );
compositor->SetBuffer( mainBuffer );
// Cairo grouping prevents display of overlapping items on the same layer in the lighter color
//cairo_push_group( currentContext );
}
#include <profile.h>
void CAIRO_GAL::EndDrawing()
{
printf("EndDRAW!\n\n\n");
// Force remaining objects to be drawn
Flush();
// Cairo grouping prevents display of overlapping items on the same layer in the lighter color
//cairo_pop_group_to_source( currentContext );
//cairo_paint_with_alpha( currentContext, LAYER_ALPHA );
// Merge buffers on the screen
PROF_COUNTER comp("cairo-comp");
compositor->DrawBuffer( mainBuffer );
compositor->DrawBuffer( overlayBuffer );
comp.show();
// This code was taken from the wxCairo example - it's not the most efficient one
// Here is a good place for optimizations
// Now translate the raw context data from the format stored
// by cairo into a format understood by wxImage.
PROF_COUNTER draw("cairo-draw");
unsigned char* wxOutputPtr = wxOutput;
printf("W %d sw %d\n", wxBufferWidth, screenSize.x);
pixman_image_t *dstImg = pixman_image_create_bits (PIXMAN_r8g8b8, screenSize.x, screenSize.y, (uint32_t*)wxOutput, wxBufferWidth * 3);
pixman_image_t *srcImg = pixman_image_create_bits (PIXMAN_a8b8g8r8, screenSize.x, screenSize.y, (uint32_t*)bitmapBuffer, wxBufferWidth * 4);
pixman_image_t* dstImg = pixman_image_create_bits(PIXMAN_r8g8b8,
screenSize.x, screenSize.y, (uint32_t*)wxOutput, wxBufferWidth * 3 );
pixman_image_t* srcImg = pixman_image_create_bits(PIXMAN_a8b8g8r8,
screenSize.x, screenSize.y, (uint32_t*)bitmapBuffer, wxBufferWidth * 4 );
pixman_image_composite (PIXMAN_OP_SRC, srcImg, NULL, dstImg,
0, 0, 0, 0, 0, 0, screenSize.x, screenSize.y );
// Free allocated memory
pixman_image_unref( srcImg );
// free (srcImg);
pixman_image_unref( dstImg );
//free (dstImg);
/*for( size_t count = 0; count < bufferSize; count++ )
{
unsigned int value = bitmapBuffer[count];
*wxOutputPtr++ = ( value >> 16 ) & 0xff; // Red pixel
*wxOutputPtr++ = ( value >> 8 ) & 0xff; // Green pixel
*wxOutputPtr++ = value & 0xff; // Blue pixel
}*/
draw.show();
PROF_COUNTER wxd1("wx-draw");
wxImage img( wxBufferWidth, screenSize.y, (unsigned char*) wxOutput, true );
wxd1.show();
PROF_COUNTER wxd2("wx-draw2");
wxBitmap bmp( img );
wxd2.show();
PROF_COUNTER wxd3("wx-draw2");
wxMemoryDC mdc( bmp );
wxd3.show();
PROF_COUNTER wxd("wx-drawf");
wxClientDC clientDC( this );
//wxBufferedDC dc;
//dc.Init( &client_dc, bmp );
wxd.show();
PROF_COUNTER wxb("wx-blt");
blitCursor( mdc );
clientDC.Blit( 0, 0, screenSize.x, screenSize.y, &mdc, 0, 0, wxCOPY );
wxb.show();
// Now it is the time to blit the mouse cursor
blitCursor( mdc );
clientDC.Blit( 0, 0, screenSize.x, screenSize.y, &mdc, 0, 0, wxCOPY );
deinitSurface();
}
@ -206,12 +150,9 @@ void CAIRO_GAL::EndDrawing()
void CAIRO_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{
cairo_move_to( currentContext, aStartPoint.x, aStartPoint.y );
cairo_line_to( currentContext, aEndPoint.x, aEndPoint.y );
flushPath();
// cairo_set_source_rgb( currentContext, gridColor.r, gridColor.g, gridColor.b );
//cairo_stroke( currentContext );
isElementAdded = true;
}
@ -287,6 +228,7 @@ void CAIRO_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, double aS
cairo_line_to( currentContext, endPoint.x, endPoint.y );
cairo_close_path( currentContext );
}
flushPath();
isElementAdded = true;
@ -462,14 +404,7 @@ void CAIRO_GAL::SetLayerDepth( double aLayerDepth )
super::SetLayerDepth( aLayerDepth );
if( isInitialized )
{
storePath();
//cairo_pop_group_to_source( currentContext );
//cairo_paint_with_alpha( currentContext, LAYER_ALPHA );
//cairo_push_group( currentContext );
}
}
@ -788,13 +723,8 @@ void CAIRO_GAL::SetTarget( RENDER_TARGET aTarget )
// Cairo grouping prevents display of overlapping items on the same layer in the lighter color
if( isInitialized )
{
storePath();
//cairo_pop_group_to_source( currentContext );
//cairo_paint_with_alpha( currentContext, LAYER_ALPHA );
}
switch( aTarget )
{
default:
@ -808,9 +738,6 @@ void CAIRO_GAL::SetTarget( RENDER_TARGET aTarget )
break;
}
//if( isInitialized )
//cairo_push_group( currentContext );
currentTarget = aTarget;
}
@ -859,6 +786,7 @@ void CAIRO_GAL::DrawCursor( const VECTOR2D& aCursorPosition )
cursorPosition = aCursorPosition;
}
void CAIRO_GAL::drawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
{
cairo_move_to( currentContext, aStartPoint.x, aStartPoint.y );
@ -867,11 +795,14 @@ void CAIRO_GAL::drawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP
cairo_stroke( currentContext );
}
void CAIRO_GAL::flushPath()
{
if( isFillEnabled )
{
cairo_set_source_rgba( currentContext, fillColor.r, fillColor.g, fillColor.b, fillColor.a );
cairo_set_source_rgba( currentContext,
fillColor.r, fillColor.g, fillColor.b, fillColor.a );
if( isStrokeEnabled )
cairo_fill_preserve( currentContext );
else
@ -880,8 +811,8 @@ void CAIRO_GAL::flushPath()
if( isStrokeEnabled )
{
cairo_set_source_rgba( currentContext, strokeColor.r, strokeColor.g,
strokeColor.b, strokeColor.a );
cairo_set_source_rgba( currentContext,
strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
cairo_stroke( currentContext );
}
}
@ -1095,8 +1026,6 @@ void CAIRO_GAL::drawPoly( const std::deque<VECTOR2D>& aPointList )
}
flushPath();
//cairo_fill( currentContext );
isElementAdded = true;
}
@ -1115,7 +1044,6 @@ void CAIRO_GAL::drawPoly( const VECTOR2D aPointList[], int aListSize )
}
flushPath();
isElementAdded = true;
}
@ -1126,9 +1054,7 @@ unsigned int CAIRO_GAL::getNewGroupNumber()
wxT( "There are no free slots to store a group" ) );
while( groups.find( groupCounter ) != groups.end() )
{
groupCounter++;
}
return groupCounter++;
}

View File

@ -122,6 +122,7 @@ void GAL::ComputeWorldScreenMatrix()
screenWorldMatrix = worldScreenMatrix.Inverse();
}
void GAL::DrawGrid()
{
if( !gridVisibility )
@ -160,7 +161,9 @@ void GAL::DrawGrid()
{
gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
} else {
}
else
{
gridStartX += std::abs( gridOrigin.x / gridSize.x ) + 1;
gridEndX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
}

View File

@ -887,7 +887,9 @@ void OPENGL_GAL::DrawGrid()
{
gridStartX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
gridEndX += std::abs( gridOrigin.x / gridSize.x ) + 1;
} else {
}
else
{
gridStartX += std::abs( gridOrigin.x / gridSize.x ) + 1;
gridEndX -= std::abs( gridOrigin.x / gridSize.x ) + 1;
}

View File

@ -142,7 +142,6 @@ private:
*/
void setGroup( int aLayer, int aGroup )
{
//printf("sgGrpSize %d l %d g %d\n", m_groupsSize, aLayer, aGroup);
// Look if there is already an entry for the layer
for( int i = 0; i < m_groupsSize; ++i )
{
@ -164,8 +163,6 @@ private:
m_groups = newGroups;
newGroups[m_groupsSize++] = GroupPair( aLayer, aGroup );
//printf("sgGrpSizeaTexit %d\n", m_groupsSize);
}
@ -359,7 +356,6 @@ void VIEW::Remove( VIEW_ITEM* aItem )
}
viewData->deleteGroups();
aItem->m_viewPrivData = nullptr;
}
@ -1240,6 +1236,7 @@ void VIEW::UpdateItems()
if( viewData->m_requiredUpdate != NONE )
invalidateItem( item, viewData->m_requiredUpdate );
viewData->m_requiredUpdate = NONE;
}
@ -1263,6 +1260,7 @@ struct VIEW::extentsVisitor
extents = aItem->ViewBBox();
else
extents.Merge( aItem->ViewBBox() );
return false;
}
};
@ -1302,6 +1300,7 @@ void VIEW::SetVisible( VIEW_ITEM *aItem, bool aIsVisible )
}
}
void VIEW::Hide( VIEW_ITEM* aItem, bool aHide )
{
auto viewData = aItem->viewPrivData();
@ -1317,6 +1316,7 @@ void VIEW::Hide( VIEW_ITEM *aItem, bool aHide )
Update( aItem, APPEARANCE );
}
bool VIEW::IsVisible( const VIEW_ITEM* aItem ) const
{
const auto viewData = aItem->viewPrivData();
@ -1324,11 +1324,13 @@ bool VIEW::IsVisible( const VIEW_ITEM *aItem ) const
return viewData->m_flags & VISIBLE;
}
void VIEW::Update( VIEW_ITEM *aItem )
{
Update( aItem, ALL );
}
void VIEW::Update( VIEW_ITEM* aItem, int aUpdateFlags )
{
auto viewData = aItem->viewPrivData();

View File

@ -52,7 +52,6 @@ VIEW_GROUP::~VIEW_GROUP()
{
if( m_view && viewPrivData() )
m_view->Remove( this );
}
@ -151,11 +150,13 @@ void VIEW_GROUP::FreeItems()
Clear();
}
const VIEW_GROUP::ITEMS VIEW_GROUP::updateDrawList() const
{
return m_groupItems;
}
/*void VIEW_GROUP::ItemsSetVisibility( bool aVisible )
{
for(unsigned int i = 0 ; i < GetSize(); i++)

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013-2016 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or

View File

@ -114,6 +114,7 @@ public:
{
for( const auto& item : aRange )
Stage( item, aChangeType );
return *this;
}

View File

@ -974,8 +974,8 @@ protected:
MATRIX3x3D screenWorldMatrix; ///< Screen transformation
double worldScale; ///< The scale factor world->screen
bool globalFlipX;
bool globalFlipY;
bool globalFlipX; ///< Flag for X axis flipping
bool globalFlipY; ///< Flag for Y axis flipping
double lineWidth; ///< The line width

View File

@ -97,6 +97,7 @@ public:
{
m_name = name;
m_running = false;
if( autostart )
start();
}
@ -111,6 +112,7 @@ public:
{
if( !m_running )
return;
m_running = false;
prof_end( &m_cnt );
}
@ -122,7 +124,8 @@ public:
start();
}
double msecs() const {
double msecs() const
{
return m_cnt.msecs();
}

View File

@ -76,7 +76,6 @@ public:
// I'll replace it with observers.
static void OnDestroy( VIEW_ITEM* aItem );
/**
* Function Add()
* Adds a VIEW_ITEM to the view.

View File

@ -78,8 +78,7 @@ public:
*/
virtual void Clear();
virtual VIEW_ITEM *GetItem(unsigned int idx) const;
virtual VIEW_ITEM* GetItem( unsigned int aIdx ) const;
/**
* Function ViewBBox()
@ -139,7 +138,6 @@ private:
void updateBbox();
VIEW* m_view;
};
} // namespace KIGFX

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013-2016 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software; you can redistribute it and/or
@ -134,8 +134,6 @@ public:
return 0;
}
public:
VIEW_ITEM_DATA* viewPrivData() const

View File

@ -90,6 +90,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry)
assert( ent.m_item->Type() == PCB_MODULE_T );
assert( ent.m_copy->Type() == PCB_MODULE_T );
if ( aCreateUndoEntry )
{
ITEM_PICKER itemWrapper( ent.m_item, UR_CHANGED );

View File

@ -742,8 +742,6 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
aTrackRef->SetStart( aCandidate->GetEnd() );
aTrackRef->start = aCandidate->end;
aTrackRef->SetState( START_ON_PAD, aCandidate->GetState( END_ON_PAD ) );
// fixme: should be updated by the commit
// aTrackRef->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
return aCandidate;
}
else
@ -751,7 +749,6 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
aTrackRef->SetStart( aCandidate->GetStart() );
aTrackRef->start = aCandidate->start;
aTrackRef->SetState( START_ON_PAD, aCandidate->GetState( START_ON_PAD ) );
// aTrackRef->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
return aCandidate;
}
}
@ -768,7 +765,6 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
aTrackRef->SetEnd( aCandidate->GetEnd() );
aTrackRef->end = aCandidate->end;
aTrackRef->SetState( END_ON_PAD, aCandidate->GetState( END_ON_PAD ) );
// aTrackRef->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
return aCandidate;
}
else
@ -776,7 +772,6 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
aTrackRef->SetEnd( aCandidate->GetStart() );
aTrackRef->end = aCandidate->start;
aTrackRef->SetState( END_ON_PAD, aCandidate->GetState( START_ON_PAD ) );
// aTrackRef->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
return aCandidate;
}
}

View File

@ -52,7 +52,6 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
bool hasLocked = false;
bool hasUnlocked = false;
// Look for values that are common for every item that is selected
for( auto& item : m_items )
{

View File

@ -390,7 +390,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( tools_xpm ) );
viewMenu->AppendSeparator();
AddMenuItem( viewMenu, ID_MENU_PCB_FLIP_VIEW, _("&Flip View"), _( "Flips (mirrors) the board view." ),
AddMenuItem( viewMenu, ID_MENU_PCB_FLIP_VIEW,
_( "&Flip View" ), _( "Flips (mirrors) the board view." ),
KiBitmap( three_d_xpm ), wxITEM_CHECK );

View File

@ -582,7 +582,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->ClearFlags();
//GetBoard()->m_Modules.GetFirst()->ViewUpdate();
if( ret > 0 )
m_canvas->Refresh();

View File

@ -379,6 +379,7 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerOrder()
}
}
bool PCB_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
{
bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
@ -386,6 +387,7 @@ bool PCB_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
return rv;
}
void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
{
for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
@ -451,5 +453,4 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( WORKSHEET ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GRID_VISIBLE ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( DRC_VISIBLE ) );
}

View File

@ -1133,6 +1133,7 @@ void PCB_EDIT_FRAME::OnUpdatePCBFromSch( wxCommandEvent& event )
}
}
void PCB_EDIT_FRAME::OnFlipPcbView(wxCommandEvent& evt)
{
auto view = GetGalCanvas()->GetView();

View File

@ -936,11 +936,13 @@ void PNS_KICAD_IFACE::UpdateNet( int aNetCode )
wxLogTrace( "PNS", "Update-net %d", aNetCode );
}
PNS::RULE_RESOLVER* PNS_KICAD_IFACE::GetRuleResolver()
{
return m_ruleResolver;
}
void PNS_KICAD_IFACE::SetRouter( PNS::ROUTER* aRouter )
{
m_router = aRouter;

View File

@ -65,6 +65,7 @@ void BRIGHT_BOX::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
}
}
void BRIGHT_BOX::SetItem( BOARD_ITEM* aItem )
{
m_item = aItem;

View File

@ -40,7 +40,7 @@ class BRIGHT_BOX : public EDA_ITEM
{
public:
BRIGHT_BOX();
~BRIGHT_BOX() {};
~BRIGHT_BOX() {}
virtual const BOX2I ViewBBox() const override
{
@ -51,7 +51,6 @@ public:
return BOX2I();
return m_item->ViewBBox();
}
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;

View File

@ -548,7 +548,9 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
BOARD_ITEM* new_item = NULL;
if( m_editModules )
{
new_item = editFrame->GetBoard()->m_Modules->Duplicate( item, increment );
}
else
{
#if 0
@ -633,11 +635,11 @@ private:
true, new_item );
}
void postPushAction( BOARD_ITEM* new_item ) //override
void postPushAction( BOARD_ITEM* new_item ) override
{
}
void finalise() // override
void finalise() override
{
}

View File

@ -203,6 +203,7 @@ std::set<BOARD_ITEM*> GRID_HELPER::queryVisible( const BOX2I& aArea ) const
for( it = selectedItems.begin(), it_end = selectedItems.end(); it != it_end; ++it )
{
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( it->first );
if( view->IsVisible( item ) )
items.insert ( item );
}

View File

@ -538,7 +538,6 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
assert( item->Type() == PCB_ZONE_AREA_T );
ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
zone->SetIsFilled( false );
zone->ClearFilledPolysList();
ratsnest->Update( zone );
@ -570,7 +569,9 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
return 0;
}
static bool mergeZones ( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& aOriginZones, std::vector<ZONE_CONTAINER *>& aMergedZones )
static bool mergeZones( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& aOriginZones,
std::vector<ZONE_CONTAINER *>& aMergedZones )
{
SHAPE_POLY_SET mergedOutlines = ConvertPolyListToPolySet( aOriginZones[0]->Outline()->m_CornersList );
@ -622,7 +623,6 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
ZONE_CONTAINER* firstZone = nullptr;
std::vector<ZONE_CONTAINER*> toMerge, merged;
for( auto item : selection )
{
auto curr_area = dynamic_cast<ZONE_CONTAINER*>( item );
@ -665,6 +665,7 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
if( mergeZones( commit, toMerge, merged ) )
{
commit.Push( _( "Merge zones" ) );
for( auto item : merged )
m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item );
}

View File

@ -780,6 +780,7 @@ int PCBNEW_CONTROL::AppendBoard( const TOOL_EVENT& aEvent )
// (for undo command for instance)
// Tracks are inserted, not appended, so mark the existing tracks to know what are the new tracks
// TODO legacy
for( TRACK* track = board->m_Track; track; track = track->Next() )
track->SetFlags( FLAG0 );

View File

@ -236,6 +236,7 @@ int PLACEMENT_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
// Prepare a list, so the items can be sorted by their X coordinate
std::vector<BOARD_ITEM*> itemsList;
for( auto item : selection )
itemsList.push_back( item );
@ -278,6 +279,7 @@ int PLACEMENT_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
// Prepare a list, so the items can be sorted by their Y coordinate
std::vector<BOARD_ITEM*> itemsList;
for( auto item : selection )
itemsList.push_back( item );

View File

@ -1021,7 +1021,8 @@ void SELECTION_TOOL::selectVisually( BOARD_ITEM* aItem ) const
if( aItem->Type() == PCB_MODULE_T )
{
static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM *item ) {
static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM* item )
{
item->SetSelected();
view()->Hide( item, true );
view()->Update( item, KIGFX::GEOMETRY );
@ -1042,15 +1043,13 @@ void SELECTION_TOOL::unselectVisually( BOARD_ITEM* aItem ) const
if( aItem->Type() == PCB_MODULE_T )
{
static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM *item ) {
static_cast<MODULE*>( aItem )->RunOnChildren( [&] ( BOARD_ITEM* item )
{
item->ClearSelected();
view()->Hide( item, false );
view()->Update( item, KIGFX::ALL );
});
}
//view()->RecacheAllItems();
}
@ -1421,6 +1420,11 @@ bool SELECTION_TOOL::SanitizeSelection()
}
SELECTION::SELECTION( KIGFX::VIEW* aView ) :
KIGFX::VIEW_GROUP( aView )
{}
void SELECTION::clear()
{
m_items.clear();
@ -1453,22 +1457,14 @@ VECTOR2I SELECTION::GetCenter() const
}
const TOOL_EVENT SELECTION_TOOL::SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" );
const TOOL_EVENT SELECTION_TOOL::UnselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.unselected" );
const TOOL_EVENT SELECTION_TOOL::ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" );
SELECTION::SELECTION( KIGFX::VIEW *aView ) :
KIGFX::VIEW_GROUP ( aView )
{}
const KIGFX::VIEW_GROUP::ITEMS SELECTION::updateDrawList() const
{
std::vector<VIEW_ITEM*> items;
items.clear();
for( auto item : m_items )
{
items.push_back( item );
if( item->Type() == PCB_MODULE_T )
{
MODULE* module = static_cast<MODULE*>( item );
@ -1478,3 +1474,8 @@ const KIGFX::VIEW_GROUP::ITEMS SELECTION::updateDrawList() const
return items;
}
const TOOL_EVENT SELECTION_TOOL::SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" );
const TOOL_EVENT SELECTION_TOOL::UnselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.unselected" );
const TOOL_EVENT SELECTION_TOOL::ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" );

View File

@ -88,6 +88,7 @@ public:
virtual KIGFX::VIEW_ITEM* GetItem( unsigned int idx ) const override
{
auto iter = m_items.begin();
while( idx-- )
++iter;