kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #09808
patch: pcbnew, don't show anchors of hidden invisible text
Displaying anchors of *hidden* text seems strange. The problem is that
anchors are drawn in TEXTE_MODULE::Draw() before all conditions which
decides, will text be displayed or no. Attached path fixes this behavior
by moving anchor drawing code after conditions. Now anchors disappears
with text.
TEXTE_MODULE::Draw() has some more code which is executed, but result is
not used if text hidden (position, size and width calculation). I think
pcbnew performance can be increased a little by moving all those
calculation after conditions too.
Regards, Sergey
=== modified file 'pcbnew/class_text_mod.cpp'
--- pcbnew/class_text_mod.cpp 2013-03-26 17:05:47 +0000
+++ pcbnew/class_text_mod.cpp 2013-03-30 00:35:04 +0000
@@ -272,19 +272,6 @@
BOARD * brd = GetBoard( );
EDA_COLOR_T color;
- if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
- {
- color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
-
- int anchor_size = DC->DeviceToLogicalXRel( 2 );
-
- GRLine( panel->GetClipBox(), DC,
- pos.x - anchor_size, pos.y,
- pos.x + anchor_size, pos.y, 0, color );
- GRLine( panel->GetClipBox(), DC,
- pos.x, pos.y - anchor_size,
- pos.x, pos.y + anchor_size, 0, color );
- }
color = brd->GetLayerColor(module->GetLayer());
@@ -309,6 +296,20 @@
color = brd->GetVisibleElementColor(MOD_TEXT_INVISIBLE);
}
+ if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
+ {
+ EDA_COLOR_T anchorColor = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
+
+ int anchor_size = DC->DeviceToLogicalXRel( 2 );
+
+ GRLine( panel->GetClipBox(), DC,
+ pos.x - anchor_size, pos.y,
+ pos.x + anchor_size, pos.y, 0, anchorColor );
+ GRLine( panel->GetClipBox(), DC,
+ pos.x, pos.y - anchor_size,
+ pos.x, pos.y + anchor_size, 0, anchorColor );
+ }
+
/* If the text is mirrored : negate size.x (mirror / Y axis) */
if( m_Mirror )
size.x = -size.x;
Follow ups