mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 13:50:13 +00:00
Code formatting
This commit is contained in:
parent
daf103d7e4
commit
89055c4425
common
gal
view
include
pcbnew
board_commit.cppboard_commit.hclass_module.cppclass_pad.cppclass_text_mod.cppclass_track.cppclean.cppconnect.cpp
dialogs
menubar_pcbframe.cppmodedit.cpppcb_draw_panel_gal.cpppcbframe.cpprouter
tools
bright_box.cppbright_box.hdrawing_tool.cppedit_tool.cppedit_tool.hgrid_helper.cppmodule_tools.cpppcb_editor_control.cpppcbnew_control.cppplacement_tool.cppselection_conditions.cppselection_tool.cppselection_tool.h
undo_redo.cppzones_convert_brd_items_to_polygons_with_Boost.cpp@ -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 ----------------------------------------------------------
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user