More work on module texts, and especially on the collector
The members SetIgnoreMTextsOnCopper, SetIgnoreMTextsOnCmp, SetIgnoreModulesOnCu, SetIgnoreModulesOnCmp in the collector guide are renamed to the clearer SetIgnoreMTextsOnBack, SetIgnoreMTextsOnFront, SetIgnoreModulesOnBack, SetIgnoreModulesOnFront Modified the collector and drawing behaviour for text in modules as discussed in the mailing list. * Now module text on layers different than Silk should work! * Still need UI support for setting the layer in the module editor.
This commit is contained in:
parent
424aac6cf2
commit
0da38e5b62
|
@ -585,10 +585,10 @@ GENERAL_COLLECTORS_GUIDE PCB_BASE_FRAME::GetCollectorsGuide()
|
|||
|
||||
// account for the globals
|
||||
guide.SetIgnoreMTextsMarkedNoShow( ! m_Pcb->IsElementVisible( MOD_TEXT_INVISIBLE ));
|
||||
guide.SetIgnoreMTextsOnCopper( ! m_Pcb->IsElementVisible( MOD_TEXT_BK_VISIBLE ));
|
||||
guide.SetIgnoreMTextsOnCmp( ! m_Pcb->IsElementVisible( MOD_TEXT_FR_VISIBLE ));
|
||||
guide.SetIgnoreModulesOnCu( ! m_Pcb->IsElementVisible( MOD_BK_VISIBLE ) );
|
||||
guide.SetIgnoreModulesOnCmp( ! m_Pcb->IsElementVisible( MOD_FR_VISIBLE ) );
|
||||
guide.SetIgnoreMTextsOnBack( ! m_Pcb->IsElementVisible( MOD_TEXT_BK_VISIBLE ));
|
||||
guide.SetIgnoreMTextsOnFront( ! m_Pcb->IsElementVisible( MOD_TEXT_FR_VISIBLE ));
|
||||
guide.SetIgnoreModulesOnBack( ! m_Pcb->IsElementVisible( MOD_BK_VISIBLE ) );
|
||||
guide.SetIgnoreModulesOnFront( ! m_Pcb->IsElementVisible( MOD_FR_VISIBLE ) );
|
||||
guide.SetIgnorePadsOnBack( ! m_Pcb->IsElementVisible( PAD_BK_VISIBLE ) );
|
||||
guide.SetIgnorePadsOnFront( ! m_Pcb->IsElementVisible( PAD_FR_VISIBLE ) );
|
||||
guide.SetIgnoreModulesVals( ! m_Pcb->IsElementVisible( MOD_VALUES_VISIBLE ) );
|
||||
|
|
|
@ -52,7 +52,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
|
|||
BOARD_ITEM( parent, PCB_MODULE_TEXT_T ),
|
||||
EDA_TEXT()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
MODULE* module = static_cast<MODULE*>( m_Parent );
|
||||
|
||||
m_Type = text_type;
|
||||
|
||||
|
@ -63,6 +63,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) :
|
|||
|
||||
SetLayer( F_SilkS );
|
||||
|
||||
// Set position and layer if there is already a parent module
|
||||
if( module && ( module->Type() == PCB_MODULE_T ) )
|
||||
{
|
||||
m_Pos = module->GetPosition();
|
||||
|
@ -161,33 +162,34 @@ int TEXTE_MODULE::GetLength() const
|
|||
|
||||
void TEXTE_MODULE::SetDrawCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
const MODULE* module = static_cast<const MODULE*>( m_Parent );
|
||||
|
||||
m_Pos = m_Pos0;
|
||||
|
||||
if( module == NULL )
|
||||
return;
|
||||
if( module )
|
||||
{
|
||||
double angle = module->GetOrientation();
|
||||
|
||||
double angle = module->GetOrientation();
|
||||
|
||||
RotatePoint( &m_Pos.x, &m_Pos.y, angle );
|
||||
m_Pos += module->GetPosition();
|
||||
RotatePoint( &m_Pos.x, &m_Pos.y, angle );
|
||||
m_Pos += module->GetPosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TEXTE_MODULE::SetLocalCoord()
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
const MODULE* module = static_cast<const MODULE*>( m_Parent );
|
||||
|
||||
if( module == NULL )
|
||||
if( module )
|
||||
{
|
||||
m_Pos0 = m_Pos - module->GetPosition();
|
||||
double angle = module->GetOrientation();
|
||||
RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Pos0 = m_Pos;
|
||||
return;
|
||||
}
|
||||
|
||||
m_Pos0 = m_Pos - module->GetPosition();
|
||||
double angle = module->GetOrientation();
|
||||
RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,9 +198,8 @@ bool TEXTE_MODULE::HitTest( const wxPoint& aPosition ) const
|
|||
wxPoint rel_pos;
|
||||
EDA_RECT area = GetTextBox( -1, -1 );
|
||||
|
||||
/* Rotate refPos to - angle
|
||||
* to test if refPos is within area (which is relative to an horizontal
|
||||
* text)
|
||||
/* Rotate refPos to - angle to test if refPos is within area (which
|
||||
* is relative to an horizontal text)
|
||||
*/
|
||||
rel_pos = aPosition;
|
||||
RotatePoint( &rel_pos, m_Pos, -GetDrawRotation() );
|
||||
|
@ -238,28 +239,30 @@ const EDA_RECT TEXTE_MODULE::GetBoundingBox() const
|
|||
void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
|
||||
const wxPoint& offset )
|
||||
{
|
||||
MODULE* module = (MODULE*) m_Parent;
|
||||
if( panel == NULL )
|
||||
return;
|
||||
|
||||
MODULE* module = static_cast<MODULE*>( m_Parent );
|
||||
|
||||
/* parent must *not* be NULL (a module text without a footprint
|
||||
parent has no sense) */
|
||||
wxASSERT( module );
|
||||
|
||||
if( panel == NULL )
|
||||
return;
|
||||
|
||||
BOARD* brd = GetBoard( );
|
||||
|
||||
// Suppress the element if the layer it is on is on a disabled side
|
||||
LAYER_ID text_layer = GetLayer();
|
||||
|
||||
if( (IsFrontLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE )) ||
|
||||
(IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) )
|
||||
return;
|
||||
|
||||
/* Reference and values takes the color from the corresponding Visibles
|
||||
other texts take the color of the layer they are on */
|
||||
EDA_COLOR_T color;
|
||||
|
||||
/* For reference and value suppress the element if the layer it is
|
||||
* on is on a disabled side, user text also has standard layer
|
||||
* hiding.
|
||||
* If the whole module side is disabled this isn't even called */
|
||||
LAYER_ID text_layer = GetLayer();
|
||||
if( (IsFrontLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE )) ||
|
||||
(IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) )
|
||||
return;
|
||||
|
||||
switch( GetType() )
|
||||
{
|
||||
case TEXT_is_REFERENCE:
|
||||
|
@ -270,9 +273,12 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
|
|||
color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE );
|
||||
break;
|
||||
|
||||
default: // Otherwise the compiler is not sure about initializing color
|
||||
case TEXT_is_DIVERS:
|
||||
default: // This is to persuade the compiler that color is always initialized
|
||||
color = brd->GetLayerColor( GetLayer() );
|
||||
if( brd->IsLayerVisible( m_Layer ) )
|
||||
color = brd->GetLayerColor( GetLayer() );
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
// 'Ghost' the element if forced show
|
||||
|
|
|
@ -255,13 +255,13 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
}
|
||||
else // smd, so use pads test after module test
|
||||
{
|
||||
module = (MODULE*) item->GetParent();
|
||||
module = static_cast<MODULE*>( item->GetParent() );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PCB_VIA_T: // vias are on many layers, so layer test is specific
|
||||
via = (VIA*) item;
|
||||
via = static_cast<VIA*>( item );
|
||||
break;
|
||||
|
||||
case PCB_TRACE_T:
|
||||
|
@ -286,34 +286,53 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
module = static_cast<MODULE*>( item->GetParent() );
|
||||
|
||||
if( m_Guide->IgnoreMTextsMarkedNoShow() &&
|
||||
!static_cast<TEXTE_MODULE*>( item )->IsVisible() )
|
||||
goto exit;
|
||||
|
||||
if( module )
|
||||
{
|
||||
if( m_Guide->IgnoreMTextsOnCopper() && module->GetLayer()==B_Cu )
|
||||
TEXTE_MODULE *text = static_cast<TEXTE_MODULE*>( item );
|
||||
if( m_Guide->IgnoreMTextsMarkedNoShow() && !text->IsVisible() )
|
||||
goto exit;
|
||||
|
||||
if( m_Guide->IgnoreMTextsOnCmp() && module->GetLayer()==F_Cu )
|
||||
if( m_Guide->IgnoreMTextsOnBack() && IsBackLayer( text->GetLayer() ) )
|
||||
goto exit;
|
||||
|
||||
if( m_Guide->IgnoreModulesVals() && item == &module->Value() )
|
||||
if( m_Guide->IgnoreMTextsOnFront() && IsFrontLayer( text->GetLayer() ) )
|
||||
goto exit;
|
||||
|
||||
if( m_Guide->IgnoreModulesRefs() && item == &module->Reference() )
|
||||
goto exit;
|
||||
/* The three text types have different criteria: reference
|
||||
* and value have their own ignore flags; user text instead
|
||||
* follows their layer visibility. Checking this here is
|
||||
* simpler than later (when layer visibility is checked for
|
||||
* other entities) */
|
||||
|
||||
switch( text->GetType() )
|
||||
{
|
||||
case TEXTE_MODULE::TEXT_is_REFERENCE:
|
||||
if( m_Guide->IgnoreModulesRefs() )
|
||||
goto exit;
|
||||
break;
|
||||
|
||||
case TEXTE_MODULE::TEXT_is_VALUE:
|
||||
if( m_Guide->IgnoreModulesVals() )
|
||||
goto exit;
|
||||
break;
|
||||
|
||||
case TEXTE_MODULE::TEXT_is_DIVERS:
|
||||
if( !m_Guide->IsLayerVisible( text->GetLayer() )
|
||||
&& m_Guide->IgnoreNonVisibleLayers() )
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
|
||||
// Extract the module since it could be hidden
|
||||
module = static_cast<MODULE*>( item->GetParent() );
|
||||
}
|
||||
break;
|
||||
|
||||
case PCB_MODULE_T:
|
||||
module = (MODULE*) item;
|
||||
module = static_cast<MODULE*>( item );
|
||||
break;
|
||||
|
||||
case PCB_MARKER_T:
|
||||
marker = (MARKER_PCB*) item;
|
||||
marker = static_cast<MARKER_PCB*>( item );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -324,10 +343,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
|
||||
if( module ) // true from case PCB_PAD_T, PCB_MODULE_TEXT_T, or PCB_MODULE_T
|
||||
{
|
||||
if( m_Guide->IgnoreModulesOnCu() && module->GetLayer()==B_Cu )
|
||||
if( m_Guide->IgnoreModulesOnBack() && (module->GetLayer() == B_Cu) )
|
||||
goto exit;
|
||||
|
||||
if( m_Guide->IgnoreModulesOnCmp() && module->GetLayer()==F_Cu )
|
||||
if( m_Guide->IgnoreModulesOnFront() && (module->GetLayer() == F_Cu) )
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -358,14 +377,20 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() )
|
||||
if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) ||
|
||||
m_Guide->IgnorePreferredLayer() )
|
||||
{
|
||||
LAYER_ID layer = item->GetLayer();
|
||||
|
||||
// Modules and their subcomponents: text and pads are not sensitive to the layer
|
||||
// visibility controls. They all have their own separate visibility controls
|
||||
// for vias, GetLayer() has no meaning, but IsOnLayer() works fine
|
||||
if( via || module || pad || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
|
||||
/* Modules and their subcomponents: reference, value and pads
|
||||
* are not sensitive to the layer visibility controls. They all
|
||||
* have their own separate visibility controls for vias,
|
||||
* GetLayer() has no meaning, but IsOnLayer() works fine. User
|
||||
* text in module *is* sensitive to layer visibility but that
|
||||
* was already handled */
|
||||
|
||||
if( via || module || pad || m_Guide->IsLayerVisible( layer )
|
||||
|| !m_Guide->IgnoreNonVisibleLayers() )
|
||||
{
|
||||
if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
|
||||
{
|
||||
|
@ -390,9 +415,14 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
|
|||
|
||||
LAYER_ID layer = item->GetLayer();
|
||||
|
||||
// Modules and their subcomponents: text and pads are not sensitive to the layer
|
||||
// visibility controls. They all have their own separate visibility controls
|
||||
if( via || module || pad || m_Guide->IsLayerVisible( layer ) || !m_Guide->IgnoreNonVisibleLayers() )
|
||||
/* Modules and their subcomponents: reference, value and pads
|
||||
* are not sensitive to the layer visibility controls. They all
|
||||
* have their own separate visibility controls. User texts
|
||||
* follows layer visibility controls (but that was already
|
||||
* checked) */
|
||||
|
||||
if( via || module || pad || m_Guide->IsLayerVisible( layer )
|
||||
|| !m_Guide->IgnoreNonVisibleLayers() )
|
||||
{
|
||||
if( !m_Guide->IsLayerLocked( layer ) || !m_Guide->IgnoreLockedLayers() )
|
||||
{
|
||||
|
|
|
@ -131,28 +131,28 @@ public:
|
|||
can simply omit from scanTypes[] PCB_ZONE_T */
|
||||
|
||||
/**
|
||||
* Function IgnoreMTextsOnCu
|
||||
* @return bool - true if should ignore MTexts on copper layer.
|
||||
* Function IgnoreMTextsOnBack
|
||||
* @return bool - true if should ignore MTexts on back layers
|
||||
*/
|
||||
virtual bool IgnoreMTextsOnCopper() const = 0;
|
||||
virtual bool IgnoreMTextsOnBack() const = 0;
|
||||
|
||||
/**
|
||||
* Function IgnoreMTextsOnCmp
|
||||
* @return bool - true if should ignore MTexts on component layer.
|
||||
* Function IgnoreMTextsOnFront
|
||||
* @return bool - true if should ignore MTexts on front layers.
|
||||
*/
|
||||
virtual bool IgnoreMTextsOnCmp() const = 0;
|
||||
virtual bool IgnoreMTextsOnFront() const = 0;
|
||||
|
||||
/**
|
||||
* Function IgnoreModulesOnCu
|
||||
* Function IgnoreModulesOnBack
|
||||
* @return bool - true if should ignore MODULEs on Back Side.
|
||||
*/
|
||||
virtual bool IgnoreModulesOnCu() const = 0;
|
||||
virtual bool IgnoreModulesOnBack() const = 0;
|
||||
|
||||
/**
|
||||
* Function IgnoreModulesOnCmp
|
||||
* Function IgnoreModulesOnFront
|
||||
* @return bool - ture if should ignore MODULEs on Front Side.
|
||||
*/
|
||||
virtual bool IgnoreModulesOnCmp() const = 0;
|
||||
virtual bool IgnoreModulesOnFront() const = 0;
|
||||
|
||||
/**
|
||||
* Function IgnorePadsOnBack
|
||||
|
@ -395,10 +395,10 @@ private:
|
|||
bool m_IncludeSecondary;
|
||||
|
||||
bool m_IgnoreMTextsMarkedNoShow;
|
||||
bool m_IgnoreMTextsOnCopper;
|
||||
bool m_IgnoreMTextsOnCmp;
|
||||
bool m_IgnoreModulesOnCu;
|
||||
bool m_IgnoreModulesOnCmp;
|
||||
bool m_IgnoreMTextsOnBack;
|
||||
bool m_IgnoreMTextsOnFront;
|
||||
bool m_IgnoreModulesOnBack;
|
||||
bool m_IgnoreModulesOnFront;
|
||||
bool m_IgnorePadsOnFront;
|
||||
bool m_IgnorePadsOnBack;
|
||||
bool m_IgnoreModulesVals;
|
||||
|
@ -429,10 +429,10 @@ public:
|
|||
#endif
|
||||
|
||||
m_IgnoreMTextsMarkedNoShow = true; // g_ModuleTextNOVColor;
|
||||
m_IgnoreMTextsOnCopper = true;
|
||||
m_IgnoreMTextsOnCmp = false;
|
||||
m_IgnoreModulesOnCu = true; // !Show_Modules_Cmp;
|
||||
m_IgnoreModulesOnCmp = false;
|
||||
m_IgnoreMTextsOnBack = true;
|
||||
m_IgnoreMTextsOnFront = false;
|
||||
m_IgnoreModulesOnBack = true; // !Show_Modules_Cmp;
|
||||
m_IgnoreModulesOnFront = false;
|
||||
|
||||
m_IgnorePadsOnFront = false;
|
||||
m_IgnorePadsOnBack = false;
|
||||
|
@ -530,31 +530,31 @@ public:
|
|||
|
||||
/**
|
||||
* Function IgnoreMTextsOnCu
|
||||
* @return bool - true if should ignore MTexts on copper layer.
|
||||
* @return bool - true if should ignore MTexts on back layers
|
||||
*/
|
||||
bool IgnoreMTextsOnCopper() const { return m_IgnoreMTextsOnCopper; }
|
||||
void SetIgnoreMTextsOnCopper( bool ignore ) { m_IgnoreMTextsOnCopper = ignore; }
|
||||
bool IgnoreMTextsOnBack() const { return m_IgnoreMTextsOnBack; }
|
||||
void SetIgnoreMTextsOnBack( bool ignore ) { m_IgnoreMTextsOnBack = ignore; }
|
||||
|
||||
/**
|
||||
* Function IgnoreMTextsOnCmp
|
||||
* @return bool - true if should ignore MTexts on component layer.
|
||||
* Function IgnoreMTextsOnFront
|
||||
* @return bool - true if should ignore MTexts on front layers
|
||||
*/
|
||||
bool IgnoreMTextsOnCmp() const { return m_IgnoreMTextsOnCmp; }
|
||||
void SetIgnoreMTextsOnCmp( bool ignore ) { m_IgnoreMTextsOnCmp = ignore; }
|
||||
bool IgnoreMTextsOnFront() const { return m_IgnoreMTextsOnFront; }
|
||||
void SetIgnoreMTextsOnFront( bool ignore ) { m_IgnoreMTextsOnFront = ignore; }
|
||||
|
||||
/**
|
||||
* Function IgnoreModulesOnCu
|
||||
* @return bool - true if should ignore MODULEs on copper layer.
|
||||
* Function IgnoreModulesOnBack
|
||||
* @return bool - true if should ignore MODULEs on the back side
|
||||
*/
|
||||
bool IgnoreModulesOnCu() const { return m_IgnoreModulesOnCu; }
|
||||
void SetIgnoreModulesOnCu( bool ignore ) { m_IgnoreModulesOnCu = ignore; }
|
||||
bool IgnoreModulesOnBack() const { return m_IgnoreModulesOnBack; }
|
||||
void SetIgnoreModulesOnBack( bool ignore ) { m_IgnoreModulesOnBack = ignore; }
|
||||
|
||||
/**
|
||||
* Function IgnoreModulesOnCmp
|
||||
* Function IgnoreModulesOnFront
|
||||
* @return bool - true if should ignore MODULEs on component layer.
|
||||
*/
|
||||
bool IgnoreModulesOnCmp() const { return m_IgnoreModulesOnCmp; }
|
||||
void SetIgnoreModulesOnCmp( bool ignore ) { m_IgnoreModulesOnCmp = ignore; }
|
||||
bool IgnoreModulesOnFront() const { return m_IgnoreModulesOnFront; }
|
||||
void SetIgnoreModulesOnFront( bool ignore ) { m_IgnoreModulesOnFront = ignore; }
|
||||
|
||||
/**
|
||||
* Function IgnorePadsOnBack
|
||||
|
|
|
@ -233,8 +233,8 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
|
|||
|
||||
GENERAL_COLLECTORS_GUIDE guide = m_frame->GetCollectorsGuide();
|
||||
guide.SetIgnoreMTextsMarkedNoShow( true );
|
||||
guide.SetIgnoreMTextsOnCopper( true );
|
||||
guide.SetIgnoreMTextsOnCmp( true );
|
||||
guide.SetIgnoreMTextsOnBack( true );
|
||||
guide.SetIgnoreMTextsOnFront( true );
|
||||
guide.SetIgnoreModulesVals( true );
|
||||
guide.SetIgnoreModulesRefs( true );
|
||||
|
||||
|
|
Loading…
Reference in New Issue