Code formatting
This commit is contained in:
parent
daf103d7e4
commit
89055c4425
|
@ -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 );
|
||||
|
||||
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();
|
||||
|
||||
0, 0, 0, 0, 0, 0, screenSize.x, screenSize.y );
|
||||
|
||||
// Free allocated memory
|
||||
pixman_image_unref( srcImg );
|
||||
pixman_image_unref( dstImg );
|
||||
|
||||
wxImage img( wxBufferWidth, screenSize.y, (unsigned char*) wxOutput, true );
|
||||
wxBitmap bmp( img );
|
||||
wxMemoryDC mdc( bmp );
|
||||
wxClientDC clientDC( this );
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -226,7 +167,7 @@ void CAIRO_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPo
|
|||
|
||||
cairo_move_to( currentContext, (double) aStartPoint.x, (double) aStartPoint.y );
|
||||
cairo_line_to( currentContext, (double) aEndPoint.x, (double) aEndPoint.y );
|
||||
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 );
|
||||
cairo_stroke( currentContext );
|
||||
}
|
||||
else
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -650,7 +585,7 @@ void CAIRO_GAL::DrawGroup( int aGroupNumber )
|
|||
case CMD_STROKE_PATH:
|
||||
cairo_set_source_rgb( currentContext, strokeColor.r, strokeColor.g, strokeColor.b );
|
||||
cairo_append_path( currentContext, it->cairoPath );
|
||||
cairo_stroke( currentContext );
|
||||
cairo_stroke( currentContext );
|
||||
break;
|
||||
|
||||
case CMD_FILL_PATH:
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -982,8 +913,8 @@ void CAIRO_GAL::blitCursor( wxMemoryDC& clientDC )
|
|||
auto p = ToScreen( cursorPosition );
|
||||
|
||||
clientDC.SetPen( *wxWHITE_PEN );
|
||||
clientDC.DrawLine ( p.x - cursorSize / 2, p.y, p.x + cursorSize / 2, p.y );
|
||||
clientDC.DrawLine ( p.x, p.y - cursorSize / 2, p.x, p.y + cursorSize / 2 );
|
||||
clientDC.DrawLine( p.x - cursorSize / 2, p.y, p.x + cursorSize / 2, p.y );
|
||||
clientDC.DrawLine( p.x, p.y - cursorSize / 2, p.x, p.y + cursorSize / 2 );
|
||||
|
||||
}
|
||||
|
||||
|
@ -991,7 +922,7 @@ void CAIRO_GAL::blitCursor( wxMemoryDC& clientDC )
|
|||
void CAIRO_GAL::allocateBitmaps()
|
||||
{
|
||||
wxBufferWidth = screenSize.x;
|
||||
while( ((wxBufferWidth * 3) % 4) != 0 ) wxBufferWidth++;
|
||||
while( ( ( wxBufferWidth * 3 ) % 4 ) != 0 ) wxBufferWidth++;
|
||||
|
||||
// Create buffer, use the system independent Cairo context backend
|
||||
stride = cairo_format_stride_for_width( GAL_FORMAT, wxBufferWidth );
|
||||
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -122,6 +122,7 @@ void GAL::ComputeWorldScreenMatrix()
|
|||
screenWorldMatrix = worldScreenMatrix.Inverse();
|
||||
}
|
||||
|
||||
|
||||
void GAL::DrawGrid()
|
||||
{
|
||||
if( !gridVisibility )
|
||||
|
@ -160,11 +161,13 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
int dirX = gridEndX >= gridStartX ? 1 : -1;
|
||||
int dirY = gridEndY >= gridStartY ? 1 : -1;
|
||||
|
||||
|
|
|
@ -767,8 +767,8 @@ void OPENGL_GAL::BitmapText( const wxString& aText, const VECTOR2D& aPosition,
|
|||
currentManager->Translate( aPosition.x, aPosition.y, layerDepth );
|
||||
currentManager->Rotate( aRotationAngle, 0.0f, 0.0f, -1.0f );
|
||||
|
||||
double sx = SCALE * (globalFlipX ? -1.0 : 1.0);
|
||||
double sy = SCALE * (globalFlipY ? -1.0 : 1.0);
|
||||
double sx = SCALE * ( globalFlipX ? -1.0 : 1.0 );
|
||||
double sy = SCALE * ( globalFlipY ? -1.0 : 1.0 );
|
||||
|
||||
currentManager->Scale( sx, sy, 0 );
|
||||
currentManager->Translate( 0, -commonOffset, 0 );
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ void main()
|
|||
if( shaderParams[0] == SHADER_LINE )
|
||||
{
|
||||
float lineWidth = shaderParams[3];
|
||||
float worldScale = abs ( gl_ModelViewMatrix[0][0] );
|
||||
float worldScale = abs( gl_ModelViewMatrix[0][0] );
|
||||
|
||||
// Make lines appear to be at least 1 pixel wide
|
||||
if( worldScale * lineWidth < MIN_WIDTH )
|
||||
|
|
|
@ -104,16 +104,16 @@ private:
|
|||
* @param aLayer is the layer number for which group id is queried.
|
||||
* @return group id or -1 in case there is no group id (ie. item is not cached).
|
||||
*/
|
||||
int getGroup( int aLayer ) const
|
||||
{
|
||||
for( int i = 0; i < m_groupsSize; ++i )
|
||||
{
|
||||
if( m_groups[i].first == aLayer )
|
||||
return m_groups[i].second;
|
||||
}
|
||||
int getGroup( int aLayer ) const
|
||||
{
|
||||
for( int i = 0; i < m_groupsSize; ++i )
|
||||
{
|
||||
if( m_groups[i].first == aLayer )
|
||||
return m_groups[i].second;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getAllGroups()
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -243,7 +240,7 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
void VIEW::OnDestroy ( VIEW_ITEM* aItem )
|
||||
void VIEW::OnDestroy( VIEW_ITEM* aItem )
|
||||
{
|
||||
auto data = aItem->viewPrivData();
|
||||
|
||||
|
@ -319,19 +316,19 @@ void VIEW::Add( VIEW_ITEM* aItem )
|
|||
MarkTargetDirty( l.target );
|
||||
}
|
||||
|
||||
SetVisible ( aItem, true );
|
||||
SetVisible( aItem, true );
|
||||
Update( aItem, KIGFX::ALL );
|
||||
}
|
||||
|
||||
|
||||
void VIEW::Remove( VIEW_ITEM* aItem )
|
||||
{
|
||||
if ( !aItem )
|
||||
if( !aItem )
|
||||
return;
|
||||
|
||||
auto viewData = aItem->viewPrivData();
|
||||
|
||||
if ( !viewData )
|
||||
if( !viewData )
|
||||
return;
|
||||
|
||||
auto item = std::find( m_allItems.begin(), m_allItems.end(), aItem );
|
||||
|
@ -359,7 +356,6 @@ void VIEW::Remove( VIEW_ITEM* aItem )
|
|||
}
|
||||
|
||||
viewData->deleteGroups();
|
||||
|
||||
aItem->m_viewPrivData = nullptr;
|
||||
}
|
||||
|
||||
|
@ -813,7 +809,7 @@ struct VIEW::drawItem
|
|||
bool operator()( VIEW_ITEM* aItem )
|
||||
{
|
||||
|
||||
assert ( aItem->viewPrivData() );
|
||||
assert( aItem->viewPrivData() );
|
||||
// Conditions that have te be fulfilled for an item to be drawn
|
||||
bool drawCondition = aItem->viewPrivData()->isRenderable() &&
|
||||
aItem->ViewGetLOD( layer, view ) < view->m_scale;
|
||||
|
@ -897,7 +893,7 @@ void VIEW::draw( VIEW_ITEM* aItem, bool aImmediate )
|
|||
|
||||
void VIEW::draw( VIEW_GROUP* aGroup, bool aImmediate )
|
||||
{
|
||||
for ( unsigned int i = 0; i < aGroup->GetSize(); i++)
|
||||
for( unsigned int i = 0; i < aGroup->GetSize(); i++)
|
||||
draw( aGroup->GetItem(i), aImmediate );
|
||||
}
|
||||
|
||||
|
@ -906,7 +902,7 @@ struct VIEW::unlinkItem
|
|||
bool operator()( VIEW_ITEM* aItem )
|
||||
{
|
||||
delete aItem->m_viewPrivData;
|
||||
aItem->m_viewPrivData = nullptr;
|
||||
aItem->m_viewPrivData = nullptr;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -1058,7 +1054,7 @@ void VIEW::invalidateItem( VIEW_ITEM* aItem, int aUpdateFlags )
|
|||
int layers[VIEW_MAX_LAYERS], layers_count;
|
||||
aItem->ViewGetLayers( layers, layers_count );
|
||||
|
||||
// Iterate through layers used by the item and recache it immediately
|
||||
// Iterate through layers used by the item and recache it immediately
|
||||
for( int i = 0; i < layers_count; ++i )
|
||||
{
|
||||
int layerId = layers[i];
|
||||
|
@ -1238,8 +1234,9 @@ void VIEW::UpdateItems()
|
|||
{
|
||||
auto viewData = item->viewPrivData();
|
||||
|
||||
if ( viewData->m_requiredUpdate != NONE )
|
||||
if( viewData->m_requiredUpdate != NONE )
|
||||
invalidateItem( item, viewData->m_requiredUpdate );
|
||||
|
||||
viewData->m_requiredUpdate = NONE;
|
||||
}
|
||||
|
||||
|
@ -1262,7 +1259,8 @@ struct VIEW::extentsVisitor
|
|||
if( first )
|
||||
extents = aItem->ViewBBox();
|
||||
else
|
||||
extents.Merge ( aItem->ViewBBox() );
|
||||
extents.Merge( aItem->ViewBBox() );
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
@ -1283,7 +1281,7 @@ const BOX2I VIEW::CalculateExtents()
|
|||
}
|
||||
|
||||
|
||||
void VIEW::SetVisible( VIEW_ITEM *aItem, bool aIsVisible )
|
||||
void VIEW::SetVisible( VIEW_ITEM* aItem, bool aIsVisible )
|
||||
{
|
||||
auto viewData = aItem->viewPrivData();
|
||||
|
||||
|
@ -1302,7 +1300,8 @@ void VIEW::SetVisible( VIEW_ITEM *aItem, bool aIsVisible )
|
|||
}
|
||||
}
|
||||
|
||||
void VIEW::Hide( VIEW_ITEM *aItem, bool aHide )
|
||||
|
||||
void VIEW::Hide( VIEW_ITEM* aItem, bool aHide )
|
||||
{
|
||||
auto viewData = aItem->viewPrivData();
|
||||
|
||||
|
@ -1317,23 +1316,26 @@ void VIEW::Hide( VIEW_ITEM *aItem, bool aHide )
|
|||
Update( aItem, APPEARANCE );
|
||||
}
|
||||
|
||||
bool VIEW::IsVisible( const VIEW_ITEM *aItem ) const
|
||||
|
||||
bool VIEW::IsVisible( const VIEW_ITEM* aItem ) const
|
||||
{
|
||||
const auto viewData = aItem->viewPrivData();
|
||||
|
||||
return viewData->m_flags & VISIBLE;
|
||||
}
|
||||
|
||||
|
||||
void VIEW::Update( VIEW_ITEM *aItem )
|
||||
{
|
||||
Update( aItem, ALL );
|
||||
}
|
||||
|
||||
void VIEW::Update( VIEW_ITEM *aItem, int aUpdateFlags )
|
||||
|
||||
void VIEW::Update( VIEW_ITEM* aItem, int aUpdateFlags )
|
||||
{
|
||||
auto viewData = aItem->viewPrivData();
|
||||
|
||||
if ( !viewData )
|
||||
if( !viewData )
|
||||
return;
|
||||
|
||||
assert( aUpdateFlags != NONE );
|
||||
|
|
|
@ -42,7 +42,7 @@ using namespace KIGFX;
|
|||
|
||||
VIEW_GROUP::VIEW_GROUP( VIEW* aView ) :
|
||||
m_layer( ITEM_GAL_LAYER( GP_OVERLAY ) ),
|
||||
m_view ( aView )
|
||||
m_view( aView )
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -50,9 +50,8 @@ VIEW_GROUP::VIEW_GROUP( VIEW* aView ) :
|
|||
|
||||
VIEW_GROUP::~VIEW_GROUP()
|
||||
{
|
||||
if (m_view && viewPrivData() )
|
||||
m_view->Remove ( this );
|
||||
|
||||
if( m_view && viewPrivData() )
|
||||
m_view->Remove( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,9 +63,9 @@ void VIEW_GROUP::Add( VIEW_ITEM* aItem )
|
|||
|
||||
void VIEW_GROUP::Remove( VIEW_ITEM* aItem )
|
||||
{
|
||||
for ( auto iter = m_groupItems.begin(); iter != m_groupItems.end(); ++iter)
|
||||
for( auto iter = m_groupItems.begin(); iter != m_groupItems.end(); ++iter)
|
||||
{
|
||||
if ( aItem == *iter )
|
||||
if( aItem == *iter )
|
||||
{
|
||||
m_groupItems.erase( iter);
|
||||
break;
|
||||
|
@ -108,7 +107,7 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
|
|||
const auto drawList = updateDrawList();
|
||||
|
||||
// Draw all items immediately (without caching)
|
||||
for ( auto item : drawList )
|
||||
for( auto item : drawList )
|
||||
{
|
||||
gal->PushDepth();
|
||||
|
||||
|
@ -142,30 +141,32 @@ void VIEW_GROUP::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
|
||||
void VIEW_GROUP::FreeItems()
|
||||
{
|
||||
for (unsigned int i = 0 ; i < GetSize(); i++)
|
||||
for(unsigned int i = 0 ; i < GetSize(); i++)
|
||||
{
|
||||
VIEW_ITEM *item = GetItem(i);
|
||||
VIEW_ITEM* item = GetItem(i);
|
||||
delete item;
|
||||
}
|
||||
|
||||
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++)
|
||||
for(unsigned int i = 0 ; i < GetSize(); i++)
|
||||
GetItem(i)->ViewSetVisible( aVisible );
|
||||
}
|
||||
|
||||
|
||||
void VIEW_GROUP::ItemsViewUpdate( VIEW_ITEM::VIEW_UPDATE_FLAGS aFlags )
|
||||
{
|
||||
for (unsigned int i = 0 ; i < GetSize(); i++)
|
||||
for(unsigned int i = 0 ; i < GetSize(); i++)
|
||||
GetItem(i)->ViewUpdate( aFlags );
|
||||
}*/
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -112,8 +112,9 @@ public:
|
|||
template<class Range>
|
||||
COMMIT& StageItems( const Range& aRange, CHANGE_TYPE aChangeType )
|
||||
{
|
||||
for ( const auto& item : aRange )
|
||||
Stage ( item, aChangeType );
|
||||
for( const auto& item : aRange )
|
||||
Stage( item, aChangeType );
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -126,7 +127,7 @@ public:
|
|||
COMMIT& Stage( const PICKED_ITEMS_LIST& aItems, UNDO_REDO_T aModFlag = UR_UNSPECIFIED );
|
||||
|
||||
///> Executes the changes.
|
||||
virtual void Push( const wxString& aMessage = wxT("A commit"), bool aCreateUndoEntry = true) = 0;
|
||||
virtual void Push( const wxString& aMessage = wxT( "A commit" ), bool aCreateUndoEntry = true ) = 0;
|
||||
|
||||
///> Revertes the commit by restoring the modifed items state.
|
||||
virtual void Revert() = 0;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -93,43 +93,46 @@ static inline void prof_end( prof_counter* aCnt )
|
|||
class PROF_COUNTER
|
||||
{
|
||||
public:
|
||||
PROF_COUNTER(const std::string& name, bool autostart = true)
|
||||
{
|
||||
m_name = name;
|
||||
m_running= false;
|
||||
if(autostart)
|
||||
start();
|
||||
}
|
||||
PROF_COUNTER( const std::string& name, bool autostart = true )
|
||||
{
|
||||
m_name = name;
|
||||
m_running = false;
|
||||
|
||||
void start()
|
||||
{
|
||||
m_running = true;
|
||||
prof_start(&m_cnt);
|
||||
}
|
||||
if( autostart )
|
||||
start();
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
if(!m_running)
|
||||
return;
|
||||
m_running=false;
|
||||
prof_end(&m_cnt);
|
||||
}
|
||||
void start()
|
||||
{
|
||||
m_running = true;
|
||||
prof_start( &m_cnt );
|
||||
}
|
||||
|
||||
void show()
|
||||
{
|
||||
stop();
|
||||
fprintf(stderr,"%s took %.1f milliseconds.\n", m_name.c_str(), (double)m_cnt.msecs());
|
||||
start();
|
||||
}
|
||||
|
||||
double msecs() const {
|
||||
return m_cnt.msecs();
|
||||
}
|
||||
void stop()
|
||||
{
|
||||
if( !m_running )
|
||||
return;
|
||||
|
||||
m_running = false;
|
||||
prof_end( &m_cnt );
|
||||
}
|
||||
|
||||
void show()
|
||||
{
|
||||
stop();
|
||||
fprintf( stderr, "%s took %.1f milliseconds.\n", m_name.c_str(), (double)m_cnt.msecs() );
|
||||
start();
|
||||
}
|
||||
|
||||
double msecs() const
|
||||
{
|
||||
return m_cnt.msecs();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_name;
|
||||
prof_counter m_cnt;
|
||||
bool m_running;
|
||||
std::string m_name;
|
||||
prof_counter m_cnt;
|
||||
bool m_running;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -74,8 +74,7 @@ public:
|
|||
// from the owning VIEW if there is any. Kicad relies too much on this mechanism.
|
||||
// this is the only linking dependency now between EDA_ITEM and VIEW class. In near future
|
||||
// I'll replace it with observers.
|
||||
static void OnDestroy ( VIEW_ITEM* aItem );
|
||||
|
||||
static void OnDestroy( VIEW_ITEM* aItem );
|
||||
|
||||
/**
|
||||
* Function Add()
|
||||
|
@ -109,7 +108,7 @@ public:
|
|||
*
|
||||
* @param aIsVisible: whether the item is visible (on all layers), or not.
|
||||
*/
|
||||
void SetVisible( VIEW_ITEM *aItem, bool aIsVisible = true );
|
||||
void SetVisible( VIEW_ITEM* aItem, bool aIsVisible = true );
|
||||
|
||||
/**
|
||||
* Function Hide()
|
||||
|
@ -117,7 +116,7 @@ public:
|
|||
*
|
||||
* @param aHide: whether the item is hidden (on all layers), or not.
|
||||
*/
|
||||
void Hide( VIEW_ITEM *aItem, bool aHide = true );
|
||||
void Hide( VIEW_ITEM* aItem, bool aHide = true );
|
||||
|
||||
/**
|
||||
* Function IsVisible()
|
||||
|
@ -126,7 +125,7 @@ public:
|
|||
* @return when true, the item is visible (i.e. to be displayed, not visible in the
|
||||
* *current* viewport)
|
||||
*/
|
||||
bool IsVisible( const VIEW_ITEM *aItem ) const;
|
||||
bool IsVisible( const VIEW_ITEM* aItem ) const;
|
||||
|
||||
/**
|
||||
* Function ViewUpdate()
|
||||
|
@ -135,8 +134,8 @@ public:
|
|||
*
|
||||
* @param aUpdateFlags: how much the object has changed.
|
||||
*/
|
||||
void Update( VIEW_ITEM *aItem );
|
||||
void Update( VIEW_ITEM *aItem, int aUpdateFlags );
|
||||
void Update( VIEW_ITEM* aItem );
|
||||
void Update( VIEW_ITEM* aItem, int aUpdateFlags );
|
||||
|
||||
/**
|
||||
* Function SetRequired()
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace KIGFX
|
|||
class VIEW_GROUP : public VIEW_ITEM
|
||||
{
|
||||
protected:
|
||||
typedef std::vector<VIEW_ITEM *> ITEMS;
|
||||
typedef std::vector<VIEW_ITEM*> ITEMS;
|
||||
|
||||
public:
|
||||
VIEW_GROUP( VIEW* aView = NULL );
|
||||
|
@ -56,7 +56,7 @@ public:
|
|||
*/
|
||||
virtual unsigned int GetSize() const;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Function Add()
|
||||
* Adds an item to the group.
|
||||
*
|
||||
|
@ -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()
|
||||
|
@ -138,8 +137,7 @@ protected:
|
|||
private:
|
||||
void updateBbox();
|
||||
|
||||
VIEW *m_view;
|
||||
|
||||
VIEW* m_view;
|
||||
};
|
||||
|
||||
} // namespace KIGFX
|
||||
|
|
|
@ -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
|
||||
|
@ -146,7 +144,7 @@ public:
|
|||
private:
|
||||
friend class VIEW;
|
||||
|
||||
VIEW_ITEM_DATA *m_viewPrivData;
|
||||
VIEW_ITEM_DATA* m_viewPrivData;
|
||||
};
|
||||
|
||||
} // namespace KIGFX
|
||||
|
|
|
@ -117,7 +117,7 @@ public:
|
|||
void ViewDraw( int aLayer, VIEW* aView ) const override;
|
||||
|
||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
#if defined(DEBUG)
|
||||
/// @copydoc EDA_ITEM::Show()
|
||||
|
|
|
@ -53,7 +53,7 @@ BOARD_COMMIT::~BOARD_COMMIT()
|
|||
}
|
||||
|
||||
|
||||
void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry)
|
||||
void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry )
|
||||
{
|
||||
// Objects potentially interested in changes:
|
||||
PICKED_ITEMS_LIST undoList;
|
||||
|
@ -90,13 +90,14 @@ 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 );
|
||||
itemWrapper.SetLink( ent.m_copy );
|
||||
undoList.PushItem( itemWrapper );
|
||||
frame->SaveCopyInUndoList( undoList, UR_CHANGED );
|
||||
}
|
||||
ITEM_PICKER itemWrapper( ent.m_item, UR_CHANGED );
|
||||
itemWrapper.SetLink( ent.m_copy );
|
||||
undoList.PushItem( itemWrapper );
|
||||
frame->SaveCopyInUndoList( undoList, UR_CHANGED );
|
||||
}
|
||||
|
||||
savedModules.insert( ent.m_item );
|
||||
static_cast<MODULE*>( ent.m_item )->SetLastEditTime();
|
||||
|
@ -109,8 +110,8 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry)
|
|||
{
|
||||
if( !m_editModules )
|
||||
{
|
||||
if ( aCreateUndoEntry )
|
||||
undoList.PushItem( ITEM_PICKER( boardItem, UR_NEW ) );
|
||||
if( aCreateUndoEntry )
|
||||
undoList.PushItem( ITEM_PICKER( boardItem, UR_NEW ) );
|
||||
|
||||
if( !( changeFlags & CHT_DONE ) )
|
||||
board->Add( boardItem );
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
BOARD_COMMIT( PCB_BASE_FRAME* aFrame );
|
||||
virtual ~BOARD_COMMIT();
|
||||
|
||||
virtual void Push( const wxString& aMessage = wxT("A commit"), bool aCreateUndoEntry = true) override;
|
||||
virtual void Push( const wxString& aMessage = wxT( "A commit" ), bool aCreateUndoEntry = true ) override;
|
||||
virtual void Revert() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -848,7 +848,7 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
unsigned int MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW *aView ) const
|
||||
unsigned int MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
int layer = ( m_Layer == F_Cu ) ? MOD_FR_VISIBLE :
|
||||
( m_Layer == B_Cu ) ? MOD_BK_VISIBLE : ANCHOR_VISIBLE;
|
||||
|
|
|
@ -959,7 +959,7 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW *aView ) const
|
||||
unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
// Netnames will be shown only if zoom is appropriate
|
||||
if( IsNetnameLayer( aLayer ) )
|
||||
|
|
|
@ -421,7 +421,7 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW *aView ) const
|
||||
unsigned int TEXTE_MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
const int MAX = std::numeric_limits<unsigned int>::max();
|
||||
|
||||
|
|
|
@ -757,7 +757,7 @@ void TRACK::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
}
|
||||
|
||||
|
||||
unsigned int TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW *aView ) const
|
||||
unsigned int TRACK::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
|
||||
{
|
||||
// Netnames will be shown only if zoom is appropriate
|
||||
if( IsNetnameLayer( aLayer ) )
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -943,7 +943,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
|
|||
}
|
||||
}
|
||||
|
||||
if ( IsGalCanvasActive() )
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
/// @todo LEGACY tracks might have changed their nets, so we need to refresh labels in GAL
|
||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
||||
|
|
|
@ -261,7 +261,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
|
|||
if( m_parent->IsGalCanvasActive() )
|
||||
{
|
||||
for( TRACK* track = m_parent->GetBoard()->m_Track; track != NULL; track = track->Next() )
|
||||
m_parent->GetGalCanvas()->GetView()->Update(track, KIGFX::GEOMETRY );
|
||||
m_parent->GetGalCanvas()->GetView()->Update( track, KIGFX::GEOMETRY );
|
||||
}
|
||||
else
|
||||
m_parent->GetCanvas()->Refresh();
|
||||
|
|
|
@ -52,9 +52,8 @@ 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 )
|
||||
for( auto& item : m_items )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -210,7 +209,7 @@ bool DIALOG_TRACK_VIA_PROPERTIES::Apply( COMMIT& aCommit )
|
|||
bool changeLock = m_lockedCbox->Get3StateValue() != wxCHK_UNDETERMINED;
|
||||
bool setLock = m_lockedCbox->Get3StateValue() == wxCHK_CHECKED;
|
||||
|
||||
for ( auto item : m_items )
|
||||
for( auto item : m_items )
|
||||
{
|
||||
aCommit.Modify( item );
|
||||
|
||||
|
|
|
@ -390,8 +390,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
KiBitmap( tools_xpm ) );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
AddMenuItem( viewMenu, ID_MENU_PCB_FLIP_VIEW, _("&Flip View"), _( "Flips (mirrors) the board view." ),
|
||||
KiBitmap( three_d_xpm ), wxITEM_CHECK );
|
||||
AddMenuItem( viewMenu, ID_MENU_PCB_FLIP_VIEW,
|
||||
_( "&Flip View" ), _( "Flips (mirrors) the board view." ),
|
||||
KiBitmap( three_d_xpm ), wxITEM_CHECK );
|
||||
|
||||
|
||||
//----- Place Menu ----------------------------------------------------------
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -379,13 +379,15 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerOrder()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool PCB_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
|
||||
{
|
||||
bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend ( aGalType );
|
||||
bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
|
||||
setDefaultLayerDeps();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
|
||||
{
|
||||
for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
|
||||
|
@ -406,11 +408,11 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
|
|||
}
|
||||
}
|
||||
|
||||
// caching makes no sense for Cairo and other software renderers
|
||||
// caching makes no sense for Cairo and other software renderers
|
||||
if ( m_backend != GAL_TYPE_OPENGL )
|
||||
{
|
||||
for (int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++)
|
||||
m_view->SetLayerTarget(i, KIGFX::TARGET_NONCACHED);
|
||||
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
|
||||
m_view->SetLayerTarget( i, KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
|
||||
m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );
|
||||
|
@ -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 ) );
|
||||
|
||||
}
|
||||
|
|
|
@ -1133,6 +1133,7 @@ void PCB_EDIT_FRAME::OnUpdatePCBFromSch( wxCommandEvent& event )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::OnFlipPcbView(wxCommandEvent& evt)
|
||||
{
|
||||
auto view = GetGalCanvas()->GetView();
|
||||
|
|
|
@ -326,7 +326,7 @@ public:
|
|||
~PNS_PCBNEW_DEBUG_DECORATOR()
|
||||
{
|
||||
Clear();
|
||||
m_view->Remove ( m_items );
|
||||
m_view->Remove( m_items );
|
||||
delete m_items;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ public:
|
|||
|
||||
pitem->Line( aLine, aWidth, aType );
|
||||
m_items->Add( pitem ); // Should not be needed, as m_items has been passed as a parent group in alloc;
|
||||
m_view->Update ( m_items );
|
||||
m_view->Update( m_items );
|
||||
}
|
||||
|
||||
void Clear() override
|
||||
|
@ -416,7 +416,7 @@ public:
|
|||
if( m_view && m_items )
|
||||
{
|
||||
m_items->FreeItems();
|
||||
m_view->Update ( m_items );
|
||||
m_view->Update( m_items );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,7 @@ std::unique_ptr< PNS::SOLID > PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
|
|||
RotatePoint( &offset, aPad->GetOrientation() );
|
||||
|
||||
solid->SetPos( VECTOR2I( c.x - offset.x, c.y - offset.y ) );
|
||||
solid->SetOffset ( VECTOR2I ( offset.x, offset.y ) );
|
||||
solid->SetOffset( VECTOR2I( offset.x, offset.y ) );
|
||||
|
||||
double orient = aPad->GetOrientation() / 10.0;
|
||||
|
||||
|
@ -823,7 +823,7 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClea
|
|||
|
||||
m_previewItems->Add( pitem );
|
||||
|
||||
m_view->Update ( m_previewItems );
|
||||
m_view->Update( m_previewItems );
|
||||
}
|
||||
|
||||
|
||||
|
@ -833,11 +833,11 @@ void PNS_KICAD_IFACE::HideItem( PNS::ITEM* aItem )
|
|||
|
||||
if( parent )
|
||||
{
|
||||
if( m_view->IsVisible ( parent ) )
|
||||
if( m_view->IsVisible( parent ) )
|
||||
m_hiddenItems.insert( parent );
|
||||
|
||||
m_view->SetVisible( parent, false );
|
||||
m_view->Update ( parent, KIGFX::APPEARANCE );
|
||||
m_view->Update( parent, KIGFX::APPEARANCE );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -906,7 +906,7 @@ void PNS_KICAD_IFACE::Commit()
|
|||
{
|
||||
EraseView();
|
||||
m_commit->Push( wxT( "Added a track" ) );
|
||||
m_commit.reset( new BOARD_COMMIT ( m_frame ) );
|
||||
m_commit.reset( new BOARD_COMMIT( m_frame ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -951,5 +953,5 @@ void PNS_KICAD_IFACE::SetHostFrame( PCB_EDIT_FRAME* aFrame )
|
|||
{
|
||||
m_frame = aFrame;
|
||||
|
||||
m_commit.reset( new BOARD_COMMIT ( m_frame ) );
|
||||
m_commit.reset( new BOARD_COMMIT( m_frame ) );
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ using namespace KIGFX;
|
|||
const double BRIGHT_BOX::LINE_WIDTH = 100000.0;
|
||||
const COLOR4D BRIGHT_BOX::BOX_COLOR = KIGFX::COLOR4D( 0.0, 1.0, 0.0, 1.0 );
|
||||
|
||||
BRIGHT_BOX::BRIGHT_BOX () :
|
||||
BRIGHT_BOX::BRIGHT_BOX() :
|
||||
EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type
|
||||
m_item ( nullptr )
|
||||
m_item( nullptr )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,8 @@ void BRIGHT_BOX::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
|||
}
|
||||
}
|
||||
|
||||
void BRIGHT_BOX::SetItem( BOARD_ITEM *aItem )
|
||||
|
||||
void BRIGHT_BOX::SetItem( BOARD_ITEM* aItem )
|
||||
{
|
||||
m_item = aItem;
|
||||
}
|
||||
|
|
|
@ -40,18 +40,17 @@ class BRIGHT_BOX : public EDA_ITEM
|
|||
{
|
||||
public:
|
||||
BRIGHT_BOX();
|
||||
~BRIGHT_BOX() {};
|
||||
~BRIGHT_BOX() {}
|
||||
|
||||
virtual const BOX2I ViewBBox() const override
|
||||
{
|
||||
BOX2I bb; bb.SetMaximum();
|
||||
return bb;
|
||||
|
||||
if ( !m_item )
|
||||
|
||||
if( !m_item )
|
||||
return BOX2I();
|
||||
|
||||
return m_item->ViewBBox();
|
||||
|
||||
}
|
||||
|
||||
void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
|
||||
|
@ -76,7 +75,7 @@ public:
|
|||
return wxT( "BRIGHT_BOX" );
|
||||
}
|
||||
|
||||
void SetItem( BOARD_ITEM *aItem );
|
||||
void SetItem( BOARD_ITEM* aItem );
|
||||
|
||||
private:
|
||||
static const KIGFX::COLOR4D BOX_COLOR;
|
||||
|
|
|
@ -537,7 +537,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
|
|||
BOARD_COMMIT commit( m_frame );
|
||||
|
||||
// Build the undo list & add items to the current view
|
||||
for ( auto item : list )
|
||||
for( auto item : list )
|
||||
{
|
||||
KICAD_T type = item->Type();
|
||||
assert( type == PCB_LINE_T || type == PCB_TEXT_T );
|
||||
|
@ -563,7 +563,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
delta = cursorPos - firstItem->GetPosition();
|
||||
|
||||
for ( auto item : preview )
|
||||
for( auto item : preview )
|
||||
item->Move( wxPoint( delta.x, delta.y ) );
|
||||
|
||||
m_view->Update( &preview );
|
||||
|
@ -574,7 +574,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
|
|||
// TODO it should be handled by EDIT_TOOL, so add items and select?
|
||||
if( evt->IsAction( &COMMON_ACTIONS::rotate ) )
|
||||
{
|
||||
for ( auto item : preview )
|
||||
for( auto item : preview )
|
||||
item->Rotate( wxPoint( cursorPos.x, cursorPos.y ),
|
||||
m_frame->GetRotationAngle() );
|
||||
|
||||
|
@ -582,7 +582,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
else if( evt->IsAction( &COMMON_ACTIONS::flip ) )
|
||||
{
|
||||
for ( auto item : preview )
|
||||
for( auto item : preview )
|
||||
item->Flip( wxPoint( cursorPos.x, cursorPos.y ) );
|
||||
|
||||
m_view->Update( &preview );
|
||||
|
@ -599,7 +599,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
|
|||
// Place the drawing
|
||||
BOARD_ITEM_CONTAINER* parent = m_frame->GetModel();
|
||||
|
||||
for ( auto item : preview )
|
||||
for( auto item : preview )
|
||||
{
|
||||
if( m_editModules )
|
||||
{
|
||||
|
@ -927,7 +927,7 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
|
|||
helperLine.SetWidth( 1 );
|
||||
|
||||
// Add a VIEW_GROUP that serves as a preview for the new item
|
||||
SELECTION preview( m_view );
|
||||
SELECTION preview( m_view );
|
||||
m_view->Add( &preview );
|
||||
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
|
||||
|
|
|
@ -190,7 +190,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
totalMovement += movement;
|
||||
|
||||
// Drag items to the current cursor position
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
item->Move( movement + m_offset );
|
||||
|
||||
updateRatsnest( true );
|
||||
|
@ -213,7 +213,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
lockOverride = true;
|
||||
|
||||
// Save items, so changes can be undone
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
m_commit->Modify( item );
|
||||
|
||||
m_cursor = controls->GetCursorPosition();
|
||||
|
@ -242,7 +242,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
getView()->Update( &selection );
|
||||
getView()->Update( &selection );
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::editModifiedSelection, true );
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
// Update dragging offset (distance between cursor and the first dragged item)
|
||||
m_offset = selection.Front()->GetPosition() - modPoint;
|
||||
getView()->Update( &selection );
|
||||
getView()->Update( &selection );
|
||||
updateRatsnest( true );
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
|
|||
|
||||
wxPoint rotatePoint = getModificationPoint( selection );
|
||||
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
m_commit->Modify( item );
|
||||
item->Rotate( rotatePoint, editFrame->GetRotationAngle() );
|
||||
|
@ -530,7 +530,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
|
|||
|
||||
std::vector<BOARD_ITEM*> old_items;
|
||||
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
if( item )
|
||||
old_items.push_back( item );
|
||||
|
@ -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
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ private:
|
|||
const SELECTION& selection = m_selectionTool->GetSelection();
|
||||
|
||||
if( selection.Size() != 1 )
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
|
||||
auto item = selection[0];
|
||||
return dyn_cast<T*>( item );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -370,9 +370,9 @@ int MODULE_TOOLS::CopyItems( const TOOL_EVENT& aEvent )
|
|||
// Create a temporary module that contains selected items to ease serialization
|
||||
MODULE module( m_board );
|
||||
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
auto clone = static_cast<BOARD_ITEM *> ( item->Clone() );
|
||||
auto clone = static_cast<BOARD_ITEM*>( item->Clone() );
|
||||
|
||||
// Do not add reference/value - convert them to the common type
|
||||
if( TEXTE_MODULE* text = dyn_cast<TEXTE_MODULE*>( clone ) )
|
||||
|
|
|
@ -368,7 +368,7 @@ int PCB_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode )
|
|||
|
||||
bool modified = false;
|
||||
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
bool prevState = item->IsLocked();
|
||||
|
||||
|
@ -490,7 +490,7 @@ int PCB_EDITOR_CONTROL::ZoneFill( const TOOL_EVENT& aEvent )
|
|||
const auto& selection = selTool->GetSelection();
|
||||
RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
|
||||
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
assert( item->Type() == PCB_ZONE_AREA_T );
|
||||
|
||||
|
@ -533,12 +533,11 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
|
|||
const auto& selection = selTool->GetSelection();
|
||||
RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
|
||||
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
assert( item->Type() == PCB_ZONE_AREA_T );
|
||||
|
||||
ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*> ( item );
|
||||
|
||||
ZONE_CONTAINER* zone = static_cast<ZONE_CONTAINER*>( item );
|
||||
zone->SetIsFilled( false );
|
||||
zone->ClearFilledPolysList();
|
||||
ratsnest->Update( zone );
|
||||
|
@ -570,11 +569,13 @@ 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 );
|
||||
|
||||
for ( unsigned int i = 1; i < aOriginZones.size(); i++ )
|
||||
for( unsigned int i = 1; i < aOriginZones.size(); i++ )
|
||||
{
|
||||
SHAPE_POLY_SET areaToMergePoly = ConvertPolyListToPolySet( aOriginZones[i]->Outline()->m_CornersList );
|
||||
|
||||
|
@ -589,16 +590,16 @@ static bool mergeZones ( BOARD_COMMIT& aCommit, std::vector<ZONE_CONTAINER *>& a
|
|||
// but we should never have more than 2 polys
|
||||
if( mergedOutlines.OutlineCount() > 1 )
|
||||
{
|
||||
wxLogMessage(wxT("BOARD::CombineAreas error: more than 2 polys after merging") );
|
||||
wxLogMessage( wxT( "BOARD::CombineAreas error: more than 2 polys after merging" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
for ( unsigned int i = 1; i < aOriginZones.size(); i++ )
|
||||
for( unsigned int i = 1; i < aOriginZones.size(); i++ )
|
||||
{
|
||||
aCommit.Remove( aOriginZones[i] );
|
||||
}
|
||||
|
||||
aCommit.Modify ( aOriginZones[0] );
|
||||
aCommit.Modify( aOriginZones[0] );
|
||||
aMergedZones.push_back( aOriginZones[0] );
|
||||
|
||||
aOriginZones[0]->Outline()->m_CornersList = ConvertPolySetToPolyList( mergedOutlines );
|
||||
|
@ -619,11 +620,10 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
|
|||
|
||||
int netcode = -1;
|
||||
|
||||
ZONE_CONTAINER *firstZone = nullptr;
|
||||
std::vector<ZONE_CONTAINER *> toMerge, merged;
|
||||
ZONE_CONTAINER* firstZone = nullptr;
|
||||
std::vector<ZONE_CONTAINER*> toMerge, merged;
|
||||
|
||||
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
auto curr_area = dynamic_cast<ZONE_CONTAINER*>( item );
|
||||
|
||||
|
@ -635,7 +635,7 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
|
|||
|
||||
netcode = curr_area->GetNetCode();
|
||||
|
||||
if ( firstZone )
|
||||
if( firstZone )
|
||||
{
|
||||
if( firstZone->GetNetCode() != netcode )
|
||||
continue;
|
||||
|
@ -649,23 +649,24 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
|
|||
if( curr_area->GetLayer() != firstZone->GetLayer() )
|
||||
continue;
|
||||
|
||||
if (! board->TestAreaIntersection( curr_area, firstZone ) )
|
||||
if( !board->TestAreaIntersection( curr_area, firstZone ) )
|
||||
continue;
|
||||
|
||||
toMerge.push_back(curr_area);
|
||||
toMerge.push_back( curr_area );
|
||||
}
|
||||
else
|
||||
{
|
||||
toMerge.push_back(curr_area);
|
||||
toMerge.push_back( curr_area );
|
||||
}
|
||||
}
|
||||
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
|
||||
|
||||
if ( mergeZones( commit, toMerge, merged ) )
|
||||
if( mergeZones( commit, toMerge, merged ) )
|
||||
{
|
||||
commit.Push( _( "Merge zones" ) );
|
||||
for ( auto item : merged )
|
||||
|
||||
for( auto item : merged )
|
||||
m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item );
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ int PLACEMENT_TOOL::AlignTop( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Move the selected items
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
int difference = top - item->GetBoundingBox().GetY();
|
||||
|
||||
|
@ -129,7 +129,7 @@ int PLACEMENT_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Move the selected items
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
int difference = bottom - item->GetBoundingBox().GetBottom();
|
||||
|
||||
|
@ -164,7 +164,7 @@ int PLACEMENT_TOOL::AlignLeft( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Move the selected items
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
int difference = left - item->GetBoundingBox().GetX();
|
||||
|
||||
|
@ -199,7 +199,7 @@ int PLACEMENT_TOOL::AlignRight( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// Move the selected items
|
||||
for ( auto item : selection )
|
||||
for( auto item : selection )
|
||||
{
|
||||
int difference = right - item->GetBoundingBox().GetRight();
|
||||
|
||||
|
@ -236,7 +236,8 @@ 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 )
|
||||
|
||||
for( auto item : selection )
|
||||
itemsList.push_back( item );
|
||||
|
||||
// Sort items by X coordinate
|
||||
|
@ -278,11 +279,12 @@ 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 )
|
||||
|
||||
for( auto item : selection )
|
||||
itemsList.push_back( item );
|
||||
|
||||
// Sort items by Y coordinate
|
||||
std::sort(itemsList.begin(), itemsList.end(), compareY );
|
||||
std::sort( itemsList.begin(), itemsList.end(), compareY );
|
||||
|
||||
// Expected Y coordinate for the next item (=minY)
|
||||
int position = (*itemsList.begin())->GetBoundingBox().Centre().y;
|
||||
|
|
|
@ -41,7 +41,7 @@ bool SELECTION_CONDITIONS::OnlyConnectedItems( const SELECTION& aSelection )
|
|||
if( aSelection.Empty() )
|
||||
return false;
|
||||
|
||||
for ( const auto &item : aSelection )
|
||||
for( const auto &item : aSelection )
|
||||
{
|
||||
auto type = item->Type();
|
||||
|
||||
|
@ -114,7 +114,7 @@ bool SELECTION_CONDITIONS::sameNetFunc( const SELECTION& aSelection, bool aAllow
|
|||
|
||||
int netcode = -1; // -1 stands for 'net code is not yet determined'
|
||||
|
||||
for ( const auto& aitem : aSelection )
|
||||
for( const auto& aitem : aSelection )
|
||||
{
|
||||
int current_netcode = -1;
|
||||
|
||||
|
@ -161,7 +161,7 @@ bool SELECTION_CONDITIONS::sameLayerFunc( const SELECTION& aSelection )
|
|||
LSET layerSet;
|
||||
layerSet.set();
|
||||
|
||||
for ( const auto& item : aSelection )
|
||||
for( const auto& item : aSelection )
|
||||
{
|
||||
layerSet &= item->GetLayerSet();
|
||||
|
||||
|
@ -175,7 +175,7 @@ bool SELECTION_CONDITIONS::sameLayerFunc( const SELECTION& aSelection )
|
|||
|
||||
bool SELECTION_CONDITIONS::hasTypeFunc( const SELECTION& aSelection, KICAD_T aType )
|
||||
{
|
||||
for ( const auto& item : aSelection )
|
||||
for( const auto& item : aSelection )
|
||||
{
|
||||
if( item->Type() == aType )
|
||||
return true;
|
||||
|
@ -190,7 +190,7 @@ bool SELECTION_CONDITIONS::onlyTypeFunc( const SELECTION& aSelection, KICAD_T aT
|
|||
if( aSelection.Empty() )
|
||||
return false;
|
||||
|
||||
for ( const auto& item : aSelection )
|
||||
for( const auto& item : aSelection )
|
||||
{
|
||||
if( item->Type() != aType )
|
||||
return false;
|
||||
|
@ -205,7 +205,7 @@ bool SELECTION_CONDITIONS::onlyTypesFunc( const SELECTION& aSelection, const std
|
|||
if( aSelection.Empty() )
|
||||
return false;
|
||||
|
||||
for ( const auto& item : aSelection )
|
||||
for( const auto& item : aSelection )
|
||||
{
|
||||
bool valid = false;
|
||||
|
||||
|
@ -231,7 +231,7 @@ bool SELECTION_CONDITIONS::onlyTypesFuncArr( const SELECTION& aSelection, const
|
|||
if( aSelection.Empty() )
|
||||
return false;
|
||||
|
||||
for ( const auto& item : aSelection )
|
||||
for( const auto& item : aSelection )
|
||||
{
|
||||
bool valid = false;
|
||||
const KICAD_T* type = aTypes;
|
||||
|
|
|
@ -308,7 +308,7 @@ SELECTION& SELECTION_TOOL::GetSelection()
|
|||
auto items = m_selection.GetItems();
|
||||
|
||||
// Filter out not modifiable items
|
||||
for ( auto item : items )
|
||||
for( auto item : items )
|
||||
{
|
||||
if( !modifiable( item ) )
|
||||
{
|
||||
|
@ -523,7 +523,7 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
|
|||
bool containsLocked = false;
|
||||
|
||||
// Check if the selection contains locked items
|
||||
for ( const auto& item : m_selection )
|
||||
for( const auto& item : m_selection )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
|
@ -746,7 +746,7 @@ void SELECTION_TOOL::clearSelection()
|
|||
if( m_selection.Empty() )
|
||||
return;
|
||||
|
||||
for ( auto item : m_selection )
|
||||
for( auto item : m_selection )
|
||||
unselectVisually( item );
|
||||
|
||||
m_selection.Clear();
|
||||
|
@ -816,7 +816,7 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
|
|||
// Draw a mark to show which item is available to be selected
|
||||
if( current && current->IsBrightened() )
|
||||
{
|
||||
brightBox.SetItem ( current );
|
||||
brightBox.SetItem( current );
|
||||
getView()->SetVisible( &brightBox, true );
|
||||
// getView()->Hide( &brightBox, false );
|
||||
getView()->Update( &brightBox, KIGFX::GEOMETRY );
|
||||
|
@ -978,7 +978,7 @@ void SELECTION_TOOL::select( BOARD_ITEM* aItem )
|
|||
}
|
||||
|
||||
selectVisually( aItem );
|
||||
m_selection.Add ( aItem );
|
||||
m_selection.Add( aItem );
|
||||
|
||||
if( m_selection.Size() == 1 )
|
||||
{
|
||||
|
@ -1021,11 +1021,12 @@ 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 );
|
||||
});
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1041,16 +1042,14 @@ void SELECTION_TOOL::unselectVisually( BOARD_ITEM* aItem ) const
|
|||
// unselect all the parts that make the module, not the module itself
|
||||
|
||||
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();
|
||||
item->ClearSelected();
|
||||
view()->Hide( item, false );
|
||||
view()->Update( item, KIGFX::ALL );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1421,6 +1420,11 @@ bool SELECTION_TOOL::SanitizeSelection()
|
|||
}
|
||||
|
||||
|
||||
SELECTION::SELECTION( KIGFX::VIEW* aView ) :
|
||||
KIGFX::VIEW_GROUP( aView )
|
||||
{}
|
||||
|
||||
|
||||
void SELECTION::clear()
|
||||
{
|
||||
m_items.clear();
|
||||
|
@ -1437,7 +1441,7 @@ VECTOR2I SELECTION::GetCenter() const
|
|||
}
|
||||
else
|
||||
{
|
||||
EDA_RECT bbox = Front()->GetBoundingBox();
|
||||
EDA_RECT bbox = Front()->GetBoundingBox();
|
||||
auto i = m_items.begin();
|
||||
++i;
|
||||
|
||||
|
@ -1453,28 +1457,25 @@ 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;
|
||||
std::vector<VIEW_ITEM*> items;
|
||||
|
||||
items.clear();
|
||||
for ( auto item : m_items )
|
||||
for( auto item : m_items )
|
||||
{
|
||||
items.push_back( item );
|
||||
|
||||
if( item->Type() == PCB_MODULE_T )
|
||||
{
|
||||
MODULE* module = static_cast<MODULE*>( item );
|
||||
module->RunOnChildren( [&] ( BOARD_ITEM *bitem ) { items.push_back(bitem); });
|
||||
module->RunOnChildren( [&] ( BOARD_ITEM* bitem ) { items.push_back( bitem ); } );
|
||||
}
|
||||
}
|
||||
|
||||
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" );
|
||||
|
|
|
@ -52,27 +52,27 @@ struct SELECTION : public KIGFX::VIEW_GROUP
|
|||
{
|
||||
private:
|
||||
/// Set of selected items
|
||||
std::set<BOARD_ITEM *> m_items;
|
||||
std::set<BOARD_ITEM*> m_items;
|
||||
|
||||
public:
|
||||
using ITER = std::set<BOARD_ITEM *>::iterator;
|
||||
using CITER = std::set<BOARD_ITEM *>::const_iterator;
|
||||
using ITER = std::set<BOARD_ITEM*>::iterator;
|
||||
using CITER = std::set<BOARD_ITEM*>::const_iterator;
|
||||
|
||||
SELECTION( KIGFX::VIEW *aView = nullptr );
|
||||
SELECTION( KIGFX::VIEW* aView = nullptr );
|
||||
|
||||
ITER begin() { return m_items.begin(); }
|
||||
ITER end() { return m_items.end(); }
|
||||
CITER begin() const { return m_items.cbegin(); }
|
||||
CITER end() const { return m_items.cend(); }
|
||||
|
||||
virtual void Add( BOARD_ITEM *aItem )
|
||||
virtual void Add( BOARD_ITEM* aItem )
|
||||
{
|
||||
m_items.insert (aItem);
|
||||
m_items.insert( aItem );
|
||||
}
|
||||
|
||||
virtual void Remove( BOARD_ITEM *aItem )
|
||||
{
|
||||
m_items.erase (aItem);
|
||||
m_items.erase( aItem );
|
||||
}
|
||||
|
||||
virtual void Clear() override
|
||||
|
@ -85,18 +85,19 @@ public:
|
|||
return m_items.size();
|
||||
}
|
||||
|
||||
virtual KIGFX::VIEW_ITEM *GetItem( unsigned int idx ) const override
|
||||
virtual KIGFX::VIEW_ITEM* GetItem( unsigned int idx ) const override
|
||||
{
|
||||
auto iter = m_items.begin();
|
||||
while(idx--)
|
||||
|
||||
while( idx-- )
|
||||
++iter;
|
||||
|
||||
return *iter;
|
||||
}
|
||||
|
||||
bool Contains( BOARD_ITEM *aItem ) const
|
||||
bool Contains( BOARD_ITEM* aItem ) const
|
||||
{
|
||||
return m_items.find (aItem) != m_items.end();
|
||||
return m_items.find( aItem ) != m_items.end();
|
||||
}
|
||||
|
||||
/// Checks if there is anything selected
|
||||
|
@ -111,7 +112,7 @@ public:
|
|||
return m_items.size();
|
||||
}
|
||||
|
||||
const std::set<BOARD_ITEM *> GetItems() const
|
||||
const std::set<BOARD_ITEM*> GetItems() const
|
||||
{
|
||||
return m_items;
|
||||
}
|
||||
|
@ -127,7 +128,7 @@ public:
|
|||
return (* m_items.begin() + index );
|
||||
}
|
||||
|
||||
BOARD_ITEM *Front() const
|
||||
BOARD_ITEM* Front() const
|
||||
{
|
||||
if ( !m_items.size() )
|
||||
return nullptr;
|
||||
|
@ -135,7 +136,7 @@ public:
|
|||
return *m_items.begin();
|
||||
}
|
||||
|
||||
std::set<BOARD_ITEM *>& Items()
|
||||
std::set<BOARD_ITEM*>& Items()
|
||||
{
|
||||
return m_items;
|
||||
}
|
||||
|
|
|
@ -517,27 +517,27 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
|
|||
|
||||
case UR_MOVED:
|
||||
item->Move( aRedoCommand ? aList->m_TransformPoint : -aList->m_TransformPoint );
|
||||
view->Update ( item, KIGFX::GEOMETRY );
|
||||
view->Update( item, KIGFX::GEOMETRY );
|
||||
ratsnest->Update( item );
|
||||
break;
|
||||
|
||||
case UR_ROTATED:
|
||||
item->Rotate( aList->m_TransformPoint,
|
||||
aRedoCommand ? m_rotationAngle : -m_rotationAngle );
|
||||
view->Update ( item, KIGFX::GEOMETRY );
|
||||
view->Update( item, KIGFX::GEOMETRY );
|
||||
ratsnest->Update( item );
|
||||
break;
|
||||
|
||||
case UR_ROTATED_CLOCKWISE:
|
||||
item->Rotate( aList->m_TransformPoint,
|
||||
aRedoCommand ? -m_rotationAngle : m_rotationAngle );
|
||||
view->Update ( item, KIGFX::GEOMETRY );
|
||||
view->Update( item, KIGFX::GEOMETRY );
|
||||
ratsnest->Update( item );
|
||||
break;
|
||||
|
||||
case UR_FLIPPED:
|
||||
item->Flip( aList->m_TransformPoint );
|
||||
view->Update ( item, KIGFX::LAYERS );
|
||||
view->Update( item, KIGFX::LAYERS );
|
||||
ratsnest->Update( item );
|
||||
break;
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
|
|||
if( g_DumpZonesWhenFilling )
|
||||
dumper->Write ( &th_fractured, "th_fractured" );
|
||||
|
||||
m_FilledPolysList = th_fractured;
|
||||
m_FilledPolysList = th_fractured;
|
||||
|
||||
if( GetNetCode() > 0 )
|
||||
TestForCopperIslandAndRemoveInsulatedIslands( aPcb );
|
||||
|
|
Loading…
Reference in New Issue