Another attempt to get DRC and status bar to share message content.

This commit is contained in:
Jeff Young 2020-05-22 11:31:14 +01:00
parent 4cfff6b35d
commit 69f121d907
6 changed files with 56 additions and 77 deletions

View File

@ -32,8 +32,6 @@
#include <kicad_string.h>
#include <pcbnew.h>
#include <refdes_utils.h>
#include <richio.h>
#include <filter_reader.h>
#include <macros.h>
#include <msgpanel.h>
#include <bitmaps.h>
@ -43,7 +41,6 @@
#include <class_edge_mod.h>
#include <class_module.h>
#include <convert_basic_shapes_to_polygon.h>
#include <validators.h>
#include <view/view.h>
MODULE::MODULE( BOARD* parent ) :
@ -545,27 +542,29 @@ SHAPE_POLY_SET MODULE::GetBoundingPoly() const
void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
{
wxString msg;
wxString msg, msg2;
aList.emplace_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
aList.emplace_back( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN );
// Display last date the component was edited (useful in Module Editor).
if( aFrame->IsType( FRAME_FOOTPRINT_VIEWER )
|| aFrame->IsType( FRAME_FOOTPRINT_VIEWER_MODAL )
|| aFrame->IsType( FRAME_FOOTPRINT_EDITOR ) )
{
wxDateTime date( static_cast<time_t>( m_LastEditTime ) );
if( m_LastEditTime && date.IsValid() )
// Date format: see http://www.cplusplus.com/reference/ctime/strftime
if( m_LastEditTime && date.IsValid() )
msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
else
msg = _( "Unknown" );
aList.emplace_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
// display the board side placement
aList.emplace_back( MSG_PANEL_ITEM( _( "Board Side" ),
IsFlipped()? _( "Back (Flipped)" ) : _( "Front" ), RED ) );
msg.Printf( wxT( "%zu" ), m_pads.size() );
aList.emplace_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
aList.emplace_back( _( "Last Change" ), msg, BROWN );
}
else if( aFrame->IsType( FRAME_PCB_EDITOR ) )
{
aList.emplace_back( _( "Board Side" ), IsFlipped() ? _( "Back (Flipped)" )
: _( "Front" ), RED );
}
msg = wxT( ". ." );
@ -573,49 +572,30 @@ void MODULE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM
msg[0] = 'L';
if( m_ModuleStatus & MODULE_is_PLACED )
msg[1] = 'P';
msg[2] = 'P';
aList.emplace_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
msg.Printf( wxT( "%.1f" ), GetOrientationDegrees() );
aList.emplace_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BROWN ) );
aList.emplace_back( _( "Status" ), msg, MAGENTA );
// Controls on right side of the dialog
switch( m_Attributs & 255 )
{
case 0:
msg = _( "Normal" );
break;
case MOD_CMS:
msg = _( "Insert" );
break;
case MOD_VIRTUAL:
msg = _( "Virtual" );
break;
default:
msg = wxT( "???" );
break;
case 0: msg = _( "Normal" ); break;
case MOD_CMS: msg = _( "Insert" ); break;
case MOD_VIRTUAL: msg = _( "Virtual" ); break;
default: msg = wxT( "???" ); break;
}
aList.emplace_back( MSG_PANEL_ITEM( _( "Attributes" ), msg, BROWN ) );
aList.emplace_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );
aList.emplace_back( _( "Attributes" ), msg, BROWN );
if( m_3D_Drawings.empty() )
msg = _( "No 3D shape" );
else
msg = m_3D_Drawings.front().m_Filename;
msg.Printf( _( "Footprint: %s" ),
GetChars( m_fpid.Format().c_str() ) );
msg2.Printf( _( "3D-Shape: %s" ),
m_3D_Drawings.empty() ? _( "none" ) : m_3D_Drawings.front().m_Filename );
aList.emplace_back( msg, msg2, BLUE );
// Search the first active 3D shape in list
aList.emplace_back( MSG_PANEL_ITEM( _( "3D-Shape" ), msg, RED ) );
wxString doc, keyword;
doc.Printf( _( "Doc: %s" ), m_Doc );
keyword.Printf( _( "Key Words: %s" ), m_KeyWord );
aList.emplace_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
msg.Printf( _( "Doc: %s" ), m_Doc );
msg2.Printf( _( "Keywords: %s" ), m_KeyWord );
aList.emplace_back( msg, msg2, BLACK );
}
@ -707,8 +687,7 @@ D_PAD* MODULE::GetTopLeftPad()
wxPoint pnt = p->GetPosition(); // GetPosition() returns the center of the pad
if( ( pnt.x < topLeftPad->GetPosition().x ) ||
( ( topLeftPad->GetPosition().x == pnt.x ) &&
( pnt.y < topLeftPad->GetPosition().y ) ) )
( topLeftPad->GetPosition().x == pnt.x && pnt.y < topLeftPad->GetPosition().y ) )
{
topLeftPad = p;
}

View File

@ -1008,7 +1008,7 @@ void D_PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
int clearance = GetClearance( nullptr, &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
msg2.Printf( _( "Source: %s" ), source );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
}

View File

@ -143,7 +143,7 @@ int TRACK::GetMinWidth( wxString* aSource ) const
int minWidth = bds.m_TrackMinWidth;
if( aSource )
*aSource = _( "board" );
*aSource = _( "board minumum" );
for( DRC_SELECTOR* selector : matched )
{
@ -178,7 +178,7 @@ int VIA::GetMinAnnulus( wxString* aSource ) const
int minAnnulus = bds.m_ViasMinAnnulus;
if( aSource )
*aSource = _( "board" );
*aSource = _( "board minumum" );
MatchSelectors( bds.m_DRCRuleSelectors, this, netclass, nullptr, nullptr, &matched );
@ -631,13 +631,13 @@ void TRACK::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>
int clearance = GetClearance( nullptr, &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
msg2.Printf( _( "Source: %s" ), source );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
int minWidth = GetMinWidth( &source );
msg.Printf( _( "Min Width: %s" ), MessageTextFromValue( units, minWidth, true ) );
msg2.Printf( _( "Source: %s" ), source );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
}
@ -703,13 +703,13 @@ void VIA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
int clearance = GetClearance( nullptr, &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
msg2.Printf( _( "Source: %s" ), source );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
int minAnnulus = GetMinAnnulus( &source );
msg.Printf( _( "Min Annulus: %s" ), MessageTextFromValue( units, minAnnulus, true ) );
msg2.Printf( _( "Source: %s" ), source );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
}

View File

@ -526,7 +526,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
if( m_CornerSelection != nullptr && m_CornerSelection->m_contour > 0 )
msg << wxT( " " ) << _( "Cutout" );
aList.emplace_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) );
aList.emplace_back( _( "Type" ), msg, DARKCYAN );
if( GetIsKeepout() )
{
@ -578,7 +578,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
// Display priority level
msg.Printf( wxT( "%d" ), GetPriority() );
aList.emplace_back( MSG_PANEL_ITEM( _( "Priority" ), msg, BLUE ) );
aList.emplace_back( _( "Priority" ), msg, BLUE );
}
aList.emplace_back( _( "Layer" ), LayerMaskDescribe( GetBoard(), m_layerSet ), DARKGREEN );
@ -599,7 +599,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
int clearance = GetClearance( nullptr, &source );
msg.Printf( _( "Min Clearance: %s" ), MessageTextFromValue( units, clearance, true ) );
msg2.Printf( _( "Source: %s" ), source );
msg2.Printf( _( "(from %s)" ), source );
aList.emplace_back( msg, msg2, BLACK );
}

View File

@ -167,7 +167,7 @@ void DRC::doTrackDrc( BOARD_COMMIT& aCommit, TRACK* aRefSeg, TRACKS::iterator aS
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TOO_SMALL_VIA_ANNULUS );
m_msg.Printf( drcItem->GetErrorText() + _( " (%s minimum %s; actual %s)" ),
m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
m_clearanceSource,
MessageTextFromValue( userUnits(), minAnnulus, true ),
MessageTextFromValue( userUnits(), viaAnnulus, true ) );
@ -199,14 +199,14 @@ void DRC::doTrackDrc( BOARD_COMMIT& aCommit, TRACK* aRefSeg, TRACKS::iterator aS
if( bds.m_ViasMinAnnulus > minAnnulus )
{
minAnnulus = bds.m_ViasMinAnnulus;
m_clearanceSource = _( "board" );
m_clearanceSource = _( "board minimum" );
}
if( viaAnnulus < minAnnulus )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TOO_SMALL_VIA_ANNULUS );
m_msg.Printf( drcItem->GetErrorText() + _( " (%s minimum %s; actual %s)" ),
m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
m_clearanceSource,
MessageTextFromValue( userUnits(), minAnnulus, true ),
MessageTextFromValue( userUnits(), viaAnnulus, true ) );
@ -323,7 +323,7 @@ void DRC::doTrackDrc( BOARD_COMMIT& aCommit, TRACK* aRefSeg, TRACKS::iterator aS
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TOO_SMALL_TRACK_WIDTH );
m_msg.Printf( drcItem->GetErrorText() + _( " (%s minimum %s; actual %s)" ),
m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
m_clearanceSource,
MessageTextFromValue( userUnits(), minWidth, true ),
MessageTextFromValue( userUnits(), refSegWidth, true ) );

View File

@ -94,7 +94,7 @@ bool DRC_DRILLED_HOLE_TESTER::checkPad( D_PAD* aPad )
NETCLASS* netclass = aPad->GetNet()->GetNet() == 0 ? bds.GetDefault()
: aPad->GetNetClass();
int minHole = bds.m_MinThroughDrill;
wxString minHoleSource = _( "board" );
wxString minHoleSource = _( "board minimum" );
std::vector<DRC_SELECTOR*> matched;
MatchSelectors( bds.m_DRCRuleSelectors, aPad, netclass, nullptr, nullptr, &matched );
@ -112,7 +112,7 @@ bool DRC_DRILLED_HOLE_TESTER::checkPad( D_PAD* aPad )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TOO_SMALL_PAD_DRILL );
m_msg.Printf( drcItem->GetErrorText() + _( " (%s min hole %s; actual %s)" ),
m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
minHoleSource,
MessageTextFromValue( m_units, minHole, true ),
MessageTextFromValue( m_units, holeSize, true ) );
@ -144,7 +144,7 @@ bool DRC_DRILLED_HOLE_TESTER::checkVia( VIA* via )
NETCLASS* netclass = via->GetNet()->GetNet() == 0 ? bds.GetDefault()
: via->GetNetClass();
int minHole = bds.m_MinThroughDrill;
wxString minHoleSource = _( "board" );
wxString minHoleSource = _( "board minimum" );
std::vector<DRC_SELECTOR*> matched;
MatchSelectors( bds.m_DRCRuleSelectors, via, netclass, nullptr, nullptr, &matched );
@ -162,7 +162,7 @@ bool DRC_DRILLED_HOLE_TESTER::checkVia( VIA* via )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TOO_SMALL_VIA_DRILL );
m_msg.Printf( drcItem->GetErrorText() + _( " (%s min hole %s; actual %s)" ),
m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
minHoleSource,
MessageTextFromValue( m_units, minHole, true ),
MessageTextFromValue( m_units, via->GetDrillValue(), true ) );
@ -194,7 +194,7 @@ bool DRC_DRILLED_HOLE_TESTER::checkMicroVia( VIA* via )
NETCLASS* netclass = via->GetNet()->GetNet() == 0 ? bds.GetDefault()
: via->GetNetClass();
int minHole = bds.m_MicroViasMinDrill;
wxString minHoleSource = _( "board" );
wxString minHoleSource = _( "board minimum" );
std::vector<DRC_SELECTOR*> matched;
MatchSelectors( bds.m_DRCRuleSelectors, via, netclass, nullptr, nullptr, &matched );
@ -212,7 +212,7 @@ bool DRC_DRILLED_HOLE_TESTER::checkMicroVia( VIA* via )
{
DRC_ITEM* drcItem = new DRC_ITEM( DRCE_TOO_SMALL_MICROVIA_DRILL );
m_msg.Printf( drcItem->GetErrorText() + _( " (%s minimum %s; actual %s)" ),
m_msg.Printf( drcItem->GetErrorText() + _( " (%s %s; actual %s)" ),
minHoleSource,
MessageTextFromValue( m_units, minHole, true ),
MessageTextFromValue( m_units, via->GetDrillValue(), true ) );