diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 9ae205e19d..8611ae2a3b 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -74,10 +74,8 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, m_autoSaveInterval = -1; m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER ); - m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); - minsize.x = 470; - minsize.y = 350 + m_MsgFrameHeight; + minsize.y = 350; SetSizeHints( minsize.x, minsize.y, -1, -1, -1, -1 ); @@ -90,7 +88,6 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, GetClientSize( &m_FrameSize.x, &m_FrameSize.y ); m_FramePos.x = m_FramePos.y = 0; - m_FrameSize.y -= m_MsgFrameHeight; Connect( ID_HELP_COPY_VERSION_STRING, wxEVT_COMMAND_MENU_SELECTED, diff --git a/common/drawframe.cpp b/common/drawframe.cpp index 487fcccb63..03d6fad7ea 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -110,6 +111,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent, m_DrawGrid = true; // hide/Show grid. default = show m_GridColor = DARKGRAY; // Grid color m_snapToGrid = true; + m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight(); + //#define ZOOM_DISPLAY_SIZE 60 //#define COORD_DISPLAY_SIZE 165 @@ -179,7 +182,7 @@ void EDA_DRAW_FRAME::unitsChangeRefresh() EDA_ITEM* item = GetScreen()->GetCurItem(); if( item ) - item->DisplayInfo( this ); + SetMsgPanel( item ); } @@ -610,6 +613,28 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void ) } +void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList ) +{ + if( m_messagePanel == NULL && !aList.empty() ) + return; + + ClearMsgPanel(); + + for( unsigned i = 0; i < aList.size(); i++ ) + m_messagePanel->AppendMessage( aList[i] ); +} + + +void EDA_DRAW_FRAME::SetMsgPanel( EDA_ITEM* aItem ) +{ + wxCHECK_RET( aItem != NULL, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) ); + + MSG_PANEL_ITEMS items; + aItem->GetMsgPanelInfo( items ); + SetMsgPanel( items ); +} + + wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils ) const { return ::CoordinateToString( aValue, aConvertToMils ); diff --git a/common/msgpanel.cpp b/common/msgpanel.cpp index 69d46cd3b1..7aeebbbb52 100644 --- a/common/msgpanel.cpp +++ b/common/msgpanel.cpp @@ -23,14 +23,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +/** + * @file msgpanel.cpp + * @brief Message panel implementation file. + */ + #ifdef __GNUG__ #pragma implementation #endif -#include -#include -#include -#include + +#include BEGIN_EVENT_TABLE( EDA_MSG_PANEL, wxPanel ) @@ -38,9 +41,9 @@ BEGIN_EVENT_TABLE( EDA_MSG_PANEL, wxPanel ) END_EVENT_TABLE() -EDA_MSG_PANEL::EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id, - const wxPoint& pos, const wxSize& size ) : - wxPanel( parent, id, pos, size ) +EDA_MSG_PANEL::EDA_MSG_PANEL( wxWindow* aParent, int aId, + const wxPoint& aPosition, const wxSize& aSize ) : + wxPanel( aParent, aId, aPosition, aSize ) { SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) ); SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); @@ -58,7 +61,7 @@ EDA_MSG_PANEL::~EDA_MSG_PANEL() wxSize EDA_MSG_PANEL::computeFontSize() { // Get size of the wxSYS_DEFAULT_GUI_FONT - wxSize fontSizeInPixels; + wxSize fontSizeInPixels; wxScreenDC dc; @@ -76,21 +79,21 @@ int EDA_MSG_PANEL::GetRequiredHeight() } -wxSize EDA_MSG_PANEL::computeTextSize( const wxString& text ) const +wxSize EDA_MSG_PANEL::computeTextSize( const wxString& aText ) const { // Get size of the wxSYS_DEFAULT_GUI_FONT - wxSize textSizeInPixels; + wxSize textSizeInPixels; wxScreenDC dc; dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) ); - dc.GetTextExtent( text, &textSizeInPixels.x, &textSizeInPixels.y ); + dc.GetTextExtent( aText, &textSizeInPixels.x, &textSizeInPixels.y ); return textSizeInPixels; } -void EDA_MSG_PANEL::OnPaint( wxPaintEvent& event ) +void EDA_MSG_PANEL::OnPaint( wxPaintEvent& aEvent ) { wxPaintDC dc( this ); @@ -104,20 +107,21 @@ void EDA_MSG_PANEL::OnPaint( wxPaintEvent& event ) for( unsigned i=0; i textLower.Len() ) ? textUpper : textLower; - text.Append( ' ', pad ); + text = ( aUpperText.Len() > aLowerText.Len() ) ? aUpperText : aLowerText; + text.Append( ' ', aPad ); - EDA_MSG_ITEM item; + MSG_PANEL_ITEM item; /* Don't put the first message a window client position 0. Offset by * one 'W' character width. */ @@ -129,9 +133,9 @@ void EDA_MSG_PANEL::AppendMessage( const wxString& textUpper, item.m_UpperY = ( drawSize.y / 2 ) - m_fontSize.y; item.m_LowerY = drawSize.y - m_fontSize.y; - item.m_UpperText = textUpper; - item.m_LowerText = textLower; - item.m_Color = color; + item.m_UpperText = aUpperText; + item.m_LowerText = aLowerText; + item.m_Color = aColor; m_Items.push_back( item ); m_last_x += computeTextSize( text ).x; @@ -153,7 +157,7 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText, else pos.x = m_last_x; - EDA_MSG_ITEM item; + MSG_PANEL_ITEM item; item.m_X = pos.x; @@ -194,26 +198,26 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText, } -void EDA_MSG_PANEL::showItem( wxDC& dc, const EDA_MSG_ITEM& aItem ) +void EDA_MSG_PANEL::showItem( wxDC& aDC, const MSG_PANEL_ITEM& aItem ) { EDA_COLOR_T color = aItem.m_Color; if( color >= 0 ) { color = ColorGetBase( color ); - dc.SetTextForeground( wxColour( ColorRefs[color].m_Red, - ColorRefs[color].m_Green, - ColorRefs[color].m_Blue ) ); + aDC.SetTextForeground( wxColour( ColorRefs[color].m_Red, + ColorRefs[color].m_Green, + ColorRefs[color].m_Blue ) ); } if( !aItem.m_UpperText.IsEmpty() ) { - dc.DrawText( aItem.m_UpperText, aItem.m_X, aItem.m_UpperY ); + aDC.DrawText( aItem.m_UpperText, aItem.m_X, aItem.m_UpperY ); } if( !aItem.m_LowerText.IsEmpty() ) { - dc.DrawText( aItem.m_LowerText, aItem.m_X, aItem.m_LowerY ); + aDC.DrawText( aItem.m_LowerText, aItem.m_X, aItem.m_LowerY ); } } @@ -226,7 +230,7 @@ void EDA_MSG_PANEL::EraseMsgBox() } -void EDA_MSG_PANEL::erase( wxDC* DC ) +void EDA_MSG_PANEL::erase( wxDC* aDC ) { wxPen pen; wxBrush brush; @@ -239,8 +243,7 @@ void EDA_MSG_PANEL::erase( wxDC* DC ) brush.SetColour( color ); brush.SetStyle( wxSOLID ); - DC->SetPen( pen ); - DC->SetBrush( brush ); - - DC->DrawRectangle( 0, 0, size.x, size.y ); + aDC->SetPen( pen ); + aDC->SetBrush( brush ); + aDC->DrawRectangle( 0, 0, size.x, size.y ); } diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 54133044f4..4de1f1bb08 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index d16dad48b4..02ef50df1a 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -33,9 +34,9 @@ void CVPCB_MAINFRAME::CreateScreenCmp() if( m_DisplayFootprintFrame == NULL ) { m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ), - wxPoint( 0, 0 ), - wxSize( 600, 400 ), - KICAD_DEFAULT_DRAWFRAME_STYLE ); + wxPoint( 0, 0 ), + wxSize( 600, 400 ), + KICAD_DEFAULT_DRAWFRAME_STYLE ); m_DisplayFootprintFrame->Show( true ); } else @@ -118,7 +119,11 @@ void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) MODULE* Module = GetBoard()->m_Modules; if ( Module ) - Module->DisplayInfo( this ); + { + MSG_PANEL_ITEMS items; + Module->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } m_canvas->DrawCrossHair( DC ); } diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 9a5dc23343..b3f2c9280c 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -104,11 +105,14 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC if( Pin ) { // Force display pin information (the previous display could be a component info) - Pin->DisplayInfo( this ); + MSG_PANEL_ITEMS items; + Pin->GetMsgPanelInfo( items ); if( LibItem ) - AppendMsgPanel( LibItem->GetRef( m_CurrentSheet ), - LibItem->GetField( VALUE )->m_Text, DARKCYAN ); + items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet ), + LibItem->GetField( VALUE )->m_Text, DARKCYAN ) ); + + SetMsgPanel( items ); // Cross probing:2 - pin found, and send a locate pin command to Pcbnew (highlight net) SendMessageToPCBNEW( Pin, LibItem ); @@ -182,9 +186,18 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, const KICAD_T aF GetScreen()->SetCurItem( item ); if( item ) - item->DisplayInfo( this ); + { + if( item->Type() == SCH_COMPONENT_T ) + ( (SCH_COMPONENT*) item )->SetCurrentSheetPath( &GetCurrentSheet() ); + + MSG_PANEL_ITEMS items; + item->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } else + { ClearMsgPanel(); + } return item; } diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp index 17ad1d42fe..8942d3d138 100644 --- a/eeschema/dialogs/dialog_lib_edit_text.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text.cpp @@ -214,7 +214,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event ) } if( m_parent->GetDrawItem() ) - m_parent->GetDrawItem()->DisplayInfo( m_parent ); + m_parent->SetMsgPanel( m_parent->GetDrawItem() ); EndModal(wxID_OK); } diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index c56ce78a47..0131676011 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -139,7 +140,10 @@ create a new power component with the new value." ), GetChars( entry->GetName() m_canvas->Refresh(); } - component->DisplayInfo( this ); + MSG_PANEL_ITEMS items; + component->SetCurrentSheetPath( &GetCurrentSheet() ); + component->GetMsgPanelInfo( items ); + SetMsgPanel( items ); } diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index dd4368b1b2..7c0feb3932 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -257,10 +258,13 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, // Set the component value that can differ from component name in lib, for aliases component->GetField( VALUE )->m_Text = Name; - component->DisplayInfo( this ); + + MSG_PANEL_ITEMS items; + component->SetCurrentSheetPath( &GetCurrentSheet() ); + component->GetMsgPanelInfo( items ); + SetMsgPanel( items ); component->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); component->SetFlags( IS_NEW ); - MoveItem( (SCH_ITEM*) component, aDC ); return component; diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index b536f0a8d7..ce2752a30a 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -508,21 +509,21 @@ start(%d, %d), end(%d, %d), radius %d" ), } -void LIB_ARC::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_ARC::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); - LIB_ITEM::DisplayInfo( aFrame ); + LIB_ITEM::GetMsgPanelInfo( aList ); msg = ReturnStringFromValue( g_UserUnit, m_Width, true ); - aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); - aFrame->AppendMsgPanel( _( "Bounding box" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); } diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h index 4bf41aba49..49b66cb782 100644 --- a/eeschema/lib_arc.h +++ b/eeschema/lib_arc.h @@ -106,7 +106,7 @@ public: EDA_RECT GetBoundingBox() const; - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); int GetPenSize() const; diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index a6a2528b02..9ef49e9a78 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -404,19 +405,19 @@ EDA_RECT LIB_BEZIER::GetBoundingBox() const } -void LIB_BEZIER::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_BEZIER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); - LIB_ITEM::DisplayInfo( aFrame ); + LIB_ITEM::GetMsgPanelInfo( aList ); msg = ReturnStringFromValue( g_UserUnit, m_Width, true ); - aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); - aFrame->AppendMsgPanel( _( "Bounding box" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); } diff --git a/eeschema/lib_bezier.h b/eeschema/lib_bezier.h index b900a17bd5..04b0bcd7a4 100644 --- a/eeschema/lib_bezier.h +++ b/eeschema/lib_bezier.h @@ -99,7 +99,7 @@ public: int GetPenSize( ) const; - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); EDA_ITEM* Clone() const; diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index 2af086fc60..c6357b1f1d 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -265,24 +266,24 @@ EDA_RECT LIB_CIRCLE::GetBoundingBox() const } -void LIB_CIRCLE::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_CIRCLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); - LIB_ITEM::DisplayInfo( aFrame ); + LIB_ITEM::GetMsgPanelInfo( aList ); msg = ReturnStringFromValue( g_UserUnit, m_Width, true ); - aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); msg = ReturnStringFromValue( g_UserUnit, m_Radius, true ); - aFrame->AppendMsgPanel( _( "Radius" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Radius" ), msg, RED ) ); msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); - aFrame->AppendMsgPanel( _( "Bounding box" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); } diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index ce42932d7d..3d5bb6c877 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -69,7 +69,7 @@ public: EDA_RECT GetBoundingBox() const; - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); diff --git a/eeschema/lib_draw_item.cpp b/eeschema/lib_draw_item.cpp index 8475f179e1..b29d080668 100644 --- a/eeschema/lib_draw_item.cpp +++ b/eeschema/lib_draw_item.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -57,19 +58,18 @@ LIB_ITEM::LIB_ITEM( KICAD_T aType, } -void LIB_ITEM::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_ITEM::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString msg; - aFrame->ClearMsgPanel(); - aFrame->AppendMsgPanel( _( "Type" ), m_typeName, CYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), m_typeName, CYAN ) ); if( m_Unit == 0 ) msg = _( "All" ); else msg.Printf( wxT( "%d" ), m_Unit ); - aFrame->AppendMsgPanel( _( "Unit" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Unit" ), msg, BROWN ) ); if( m_Convert == 0 ) msg = _( "All" ); @@ -80,7 +80,7 @@ void LIB_ITEM::DisplayInfo( EDA_DRAW_FRAME* aFrame ) else msg = wxT( "?" ); - aFrame->AppendMsgPanel( _( "Convert" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Convert" ), msg, BROWN ) ); } diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h index bc73233c36..26993b2b55 100644 --- a/eeschema/lib_draw_item.h +++ b/eeschema/lib_draw_item.h @@ -42,6 +42,7 @@ class LIB_COMPONENT; class PLOTTER; class LIB_ITEM; class LIB_PIN; +class MSG_PANEL_ITEM; extern const int fill_tab[]; @@ -261,7 +262,7 @@ public: virtual EDA_RECT GetBoundingBox() const { return EDA_ITEM::GetBoundingBox(); } /** - * Function DisplayInfo + * Function GetMsgPanelInfo * displays basic info (type, part and convert) about the current item * in message panel. *

@@ -269,9 +270,9 @@ public: * all library items. Call the base class from the derived class or the * common information will not be updated in the message panel. *

- * @param aFrame A pointer to EDA_DRAW_FRAME window where the message panel resides. + * @param aList is the list to populate. */ - virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + virtual void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); /** * Test LIB_ITEM objects for equivalence. diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 91fc0f6188..5eb3dbdebf 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -723,26 +724,26 @@ void LIB_FIELD::calcEdit( const wxPoint& aPosition ) } } -void LIB_FIELD::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_FIELD::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString msg; - LIB_ITEM::DisplayInfo( aFrame ); + LIB_ITEM::GetMsgPanelInfo( aList ); // Display style: msg = GetTextStyleName(); - aFrame->AppendMsgPanel( _( "Style" ), msg, MAGENTA ); + aList.push_back( MSG_PANEL_ITEM( _( "Style" ), msg, MAGENTA ) ); msg = ReturnStringFromValue( g_UserUnit, m_Size.x, true ); - aFrame->AppendMsgPanel( _( "Size X" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Size X" ), msg, BLUE ) ); msg = ReturnStringFromValue( g_UserUnit, m_Size.y, true ); - aFrame->AppendMsgPanel( _( "Size Y" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Size Y" ), msg, BLUE ) ); // Display field name (ref, value ...) msg = GetName(); - aFrame->AppendMsgPanel( _( "Field" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Field" ), msg, BROWN ) ); // Display field text: - aFrame->AppendMsgPanel( _( "Value" ), m_Text, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Value" ), m_Text, BROWN ) ); } diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index fef1c85fb2..8d4deb810a 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -167,7 +167,7 @@ public: EDA_RECT GetBoundingBox() const; - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool HitTest( const wxPoint& aPosition ); diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 083e4d76a9..ef4f277c29 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -1823,40 +1824,40 @@ void LIB_PIN::SetWidth( int aWidth ) } -void LIB_PIN::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString Text; - LIB_ITEM::DisplayInfo( aFrame ); + LIB_ITEM::GetMsgPanelInfo( aList ); - aFrame->AppendMsgPanel( _( "Name" ), m_name, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) ); if( m_number == 0 ) Text = wxT( "?" ); else ReturnPinStringNum( Text ); - aFrame->AppendMsgPanel( _( "Number" ), Text, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Number" ), Text, DARKCYAN ) ); - aFrame->AppendMsgPanel( _( "Type" ), - wxGetTranslation( pin_electrical_type_names[ m_type ] ), - RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), + wxGetTranslation( pin_electrical_type_names[ m_type ] ), + RED ) ); Text = wxGetTranslation( pin_style_names[ GetStyleCodeIndex( m_shape ) ] ); - aFrame->AppendMsgPanel( _( "Style" ), Text, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Style" ), Text, BLUE ) ); if( IsVisible() ) Text = _( "Yes" ); else Text = _( "No" ); - aFrame->AppendMsgPanel( _( "Visible" ), Text, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), Text, DARKGREEN ) ); /* Display pin length */ Text = ReturnStringFromValue( g_UserUnit, m_length, true ); - aFrame->AppendMsgPanel( _( "Length" ), Text, MAGENTA ); + aList.push_back( MSG_PANEL_ITEM( _( "Length" ), Text, MAGENTA ) ); Text = wxGetTranslation( pin_orientation_names[ GetOrientationCodeIndex( m_orientation ) ] ); - aFrame->AppendMsgPanel( _( "Orientation" ), Text, DARKMAGENTA ); + aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), Text, DARKMAGENTA ) ); } diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index 79c7caddf4..6d234903bf 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -31,6 +31,7 @@ #include + #define TARGET_PIN_RADIUS 12 /* Circle diameter drawn at the active end of pins */ #define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */ @@ -138,7 +139,7 @@ public: bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform ); - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 4c957b8d29..6b3519b844 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -392,21 +393,21 @@ void LIB_POLYLINE::DeleteSegment( const wxPoint aPosition ) } -void LIB_POLYLINE::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_POLYLINE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString msg; EDA_RECT bBox = GetBoundingBox(); - LIB_ITEM::DisplayInfo( aFrame ); + LIB_ITEM::GetMsgPanelInfo( aList ); msg = ReturnStringFromValue( g_UserUnit, m_Width, true ); - aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); - aFrame->AppendMsgPanel( _( "Bounding box" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Bounding box" ), msg, BROWN ) ); } diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h index cd8be707a0..0d803bfe6c 100644 --- a/eeschema/lib_polyline.h +++ b/eeschema/lib_polyline.h @@ -82,7 +82,7 @@ public: int GetPenSize( ) const; - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 8a3a08a759..8a93e05e53 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -243,15 +244,15 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, } -void LIB_RECTANGLE::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void LIB_RECTANGLE::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString msg; - LIB_ITEM::DisplayInfo( aFrame ); + LIB_ITEM::GetMsgPanelInfo( aList ); msg = ReturnStringFromValue( g_UserUnit, m_Width, true ); - aFrame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); } diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h index 70e300297a..11645a9478 100644 --- a/eeschema/lib_rectangle.h +++ b/eeschema/lib_rectangle.h @@ -73,7 +73,7 @@ public: EDA_RECT GetBoundingBox() const; - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index e8f24432f7..46865e97d4 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -408,15 +409,15 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO } -void LIB_TEXT::DisplayInfo( EDA_DRAW_FRAME* frame ) +void LIB_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString msg; - LIB_ITEM::DisplayInfo( frame ); + LIB_ITEM::GetMsgPanelInfo( aList ); msg = ReturnStringFromValue( g_UserUnit, m_Thickness, true ); - frame->AppendMsgPanel( _( "Line width" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Line width" ), msg, BLUE ) ); } diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index 50c19a16fa..6da3c3b086 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -32,6 +32,7 @@ #include #include + /** * Class LIB_TEXT * defines a component library graphical text item. @@ -93,7 +94,7 @@ public: int GetPenSize( ) const; - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); EDA_RECT GetBoundingBox() const; diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index b0ce20923e..a572957f5e 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -51,7 +52,11 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition ) item = LocateItemUsingCursor( aPosition ); if( item ) - item->DisplayInfo( this ); + { + MSG_PANEL_ITEMS items; + item->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } else { DisplayCmpDoc(); @@ -150,7 +155,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition ) } if( m_drawItem ) - m_drawItem->DisplayInfo( this ); + SetMsgPanel( m_drawItem ); else return; diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index a6d63d1804..d9d247ed5a 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -89,9 +90,15 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) } if( item ) - item->DisplayInfo( this ); + { + MSG_PANEL_ITEMS items; + item->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } else + { return true; + } m_drawItem = item; bool not_edited = !item->InEditMode(); diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 48b976cf09..41a8a0c033 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -1185,9 +1186,15 @@ LIB_ITEM* LIB_EDIT_FRAME::locateItem( const wxPoint& aPosition, const KICAD_T aF } if( item ) - item->DisplayInfo( this ); + { + MSG_PANEL_ITEMS items; + item->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } else + { ClearMsgPanel(); + } return item; } diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index cfd2136ae4..fd31892c07 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -148,7 +149,10 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) SaveCopyInUndoList( pin->GetParent() ); OnModify( ); - pin->DisplayInfo( this ); + + MSG_PANEL_ITEMS items; + pin->GetMsgPanelInfo( items ); + SetMsgPanel( items ); m_canvas->Refresh(); } @@ -313,7 +317,9 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC ) GetScreen()->SetCrossHairPosition( startPos ); m_canvas->MoveCursorToCrossHair(); - CurrentPin->DisplayInfo( this ); + MSG_PANEL_ITEMS items; + CurrentPin->GetMsgPanelInfo( items ); + SetMsgPanel( items ); m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove ); m_canvas->CrossHairOn( DC ); } @@ -563,7 +569,9 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) GetScreen()->SetCrossHairPosition( savepos ); m_canvas->CrossHairOn( DC ); - Pin->DisplayInfo( this ); + MSG_PANEL_ITEMS items; + Pin->GetMsgPanelInfo( items ); + SetMsgPanel( items ); OnModify( ); } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index ab18e90097..0cd24896b3 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -1464,7 +1465,7 @@ EDA_RECT SCH_COMPONENT::GetBoundingBox() const } -void SCH_COMPONENT::DisplayInfo( EDA_DRAW_FRAME* frame ) +void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { // search for the component in lib // Entry and root_component can differ if Entry is an alias @@ -1476,30 +1477,29 @@ void SCH_COMPONENT::DisplayInfo( EDA_DRAW_FRAME* frame ) wxString msg; - frame->ClearMsgPanel(); - - frame->AppendMsgPanel( _( "Reference" ), - GetRef( &( ( (SCH_EDIT_FRAME*) frame )->GetCurrentSheet() ) ), - DARKCYAN ); + if( m_currentSheetPath ) + aList.push_back( MSG_PANEL_ITEM( _( "Reference" ), + GetRef( m_currentSheetPath ), + DARKCYAN ) ); if( root_component->IsPower() ) msg = _( "Power symbol" ); else msg = _( "Name" ); - frame->AppendMsgPanel( msg, GetField( VALUE )->m_Text, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( msg, GetField( VALUE )->m_Text, DARKCYAN ) ); // Display component reference in library and library - frame->AppendMsgPanel( _( "Component" ), m_ChipName, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Component" ), m_ChipName, BROWN ) ); if( alias->GetName() != root_component->GetName() ) - frame->AppendMsgPanel( _( "Alias of" ), root_component->GetName(), BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Alias of" ), root_component->GetName(), BROWN ) ); - frame->AppendMsgPanel( _( "Library" ), alias->GetLibraryName(), BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Library" ), alias->GetLibraryName(), BROWN ) ); // Display description of the component, and keywords found in lib - frame->AppendMsgPanel( _( "Description" ), alias->GetDescription(), DARKCYAN ); - frame->AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Description" ), alias->GetDescription(), DARKCYAN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Key words" ), alias->GetKeyWords(), DARKCYAN ) ); } diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h index 833d3f8fe0..adaae8a4fb 100644 --- a/eeschema/sch_component.h +++ b/eeschema/sch_component.h @@ -67,6 +67,14 @@ class SCH_COMPONENT : public SCH_ITEM TRANSFORM m_transform; ///< The rotation/mirror transformation matrix. SCH_FIELDS m_Fields; ///< Variable length list of fields. + /** + * A temporary sheet path is required to generate the correct reference designator string + * in complex heirarchies. Hopefully this is only a temporary hack to decouple schematic + * objects from the drawing window until a better design for handling complex heirarchies + * can be implemented. + */ + const SCH_SHEET_PATH* m_currentSheetPath; + /** * Defines the hierarchical path and reference of the component. This allows support * for hierarchical sheets that reference the same schematic. The format for the path @@ -179,7 +187,7 @@ public: */ wxPoint GetScreenCoord( const wxPoint& aPoint ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); /** * Function ClearAnnotation @@ -277,6 +285,11 @@ public: */ static bool IsReferenceStringValid( const wxString& aReferenceString ); + void SetCurrentSheetPath( const SCH_SHEET_PATH* aSheetPath ) + { + m_currentSheetPath = aSheetPath; + } + /** * Function GetRef * returns the reference, for the given sheet path. diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index e8c9b375c2..c6a6354edb 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -156,16 +157,12 @@ EDA_RECT SCH_MARKER::GetBoundingBox() const } -void SCH_MARKER::DisplayInfo( EDA_DRAW_FRAME* aFrame ) +void SCH_MARKER::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { - if( aFrame == NULL ) - return; - wxString msg; - aFrame->ClearMsgPanel(); - aFrame->AppendMsgPanel( _( "Electronics rule check error" ), - GetReporter().GetErrorText(), DARKRED ); + aList.push_back( MSG_PANEL_ITEM( _( "Electronics rule check error" ), + GetReporter().GetErrorText(), DARKRED ) ); } diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 748ac82591..1a3a4fb6d2 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -33,6 +33,7 @@ #include #include + /* Marker are mainly used to show an ERC error */ @@ -96,7 +97,7 @@ public: */ bool Matches( wxFindReplaceData& aSearchData, wxPoint* aFindLocation ); - void DisplayInfo( EDA_DRAW_FRAME* aFrame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool IsSelectStateChanged( const wxRect& aRect ); diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index d43c4f6f2e..76b280e96c 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -820,16 +821,15 @@ wxString SCH_SHEET::GetFileName( void ) const } -void SCH_SHEET::DisplayInfo( EDA_DRAW_FRAME* frame ) +void SCH_SHEET::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { - frame->ClearMsgPanel(); - frame->AppendMsgPanel( _( "Sheet name" ), m_name, CYAN ); - frame->AppendMsgPanel( _( "File name" ), m_fileName, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Sheet name" ), m_name, CYAN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "File name" ), m_fileName, BROWN ) ); #if 0 // Set to 1 to display the sheet time stamp (mainly for test) wxString msg; msg.Printf( wxT( "%.8X" ), m_TimeStamp ); - frame->AppendMsgPanel( _( "Time Stamp" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Time Stamp" ), msg, BLUE ) ); #endif } diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index 947dc81c7e..fd170da5e0 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -290,7 +290,7 @@ public: bool Load( LINE_READER& aLine, wxString& aErrorMsg ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); /* there is no member for orientation in sch_sheet, to preserve file * format, we detect orientation based on pin edges diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 4602642516..b8eb938686 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -730,69 +731,68 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) aPlotter->PlotPoly( Poly, NO_FILL ); } + /* * Display the type, shape, size and some other props to the Message panel */ -void SCH_TEXT::DisplayInfo( EDA_DRAW_FRAME* frame ) +void SCH_TEXT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) { wxString msg; - frame->ClearMsgPanel(); - switch( Type() ) { - case SCH_TEXT_T: - msg = _("Graphic text"); - break; + case SCH_TEXT_T: + msg = _( "Graphic text" ); + break; - case SCH_LABEL_T: - msg = _("Label"); - break; + case SCH_LABEL_T: + msg = _( "Label" ); + break; - case SCH_GLOBAL_LABEL_T: - msg = _("Global label"); - break; + case SCH_GLOBAL_LABEL_T: + msg = _( "Global label" ); + break; - case SCH_HIERARCHICAL_LABEL_T: - msg = _("Hierarchical label"); - break; + case SCH_HIERARCHICAL_LABEL_T: + msg = _( "Hierarchical label" ); + break; case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break; - default: - return; + default: + return; } - frame->AppendMsgPanel( msg, wxEmptyString, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( msg, GetText(), DARKCYAN ) ); switch( GetOrientation() ) { - case 0: // horizontal text - msg = _("Horizontal"); - break; + case 0: // horizontal text + msg = _( "Horizontal" ); + break; - case 1: // Vert Orientation UP - msg = _("Vertical up"); - break; + case 1: // Vert Orientation UP + msg = _( "Vertical up" ); + break; - case 2: // invert horizontal text - msg = _("Horizontal invert"); - break; + case 2: // invert horizontal text + msg = _( "Horizontal invert" ); + break; - case 3: // Vert Orientation Down - msg = _("Vertical down");; - break; + case 3: // Vert Orientation Down + msg = _( "Vertical down" ); + break; - default: - msg = wxT("???"); - break; + default: + msg = wxT( "???" ); + break; } - frame->AppendMsgPanel( _("Orientation"), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, BROWN ) ); - wxString textStyle[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; + wxString textStyle[] = { _( "Normal" ), _( "Italic" ), _( "Bold" ), _( "Bold Italic" ) }; int style = 0; if( m_Italic ) @@ -801,7 +801,7 @@ void SCH_TEXT::DisplayInfo( EDA_DRAW_FRAME* frame ) if( m_Bold ) style += 2; - frame->AppendMsgPanel( _("Style"), textStyle[style], BROWN ); + aList.push_back( MSG_PANEL_ITEM( _("Style"), textStyle[style], BROWN ) ); // Display electricat type if it is relevant @@ -811,19 +811,20 @@ void SCH_TEXT::DisplayInfo( EDA_DRAW_FRAME* frame ) { switch( GetShape() ) { - case NET_INPUT: msg = _("Input"); break; - case NET_OUTPUT: msg = _("Output"); break; - case NET_BIDI: msg = _("Bidirectional"); break; - case NET_TRISTATE: msg = _("Tri-State"); break; - case NET_UNSPECIFIED: msg = _("Passive"); break; - default: msg = wxT("???"); break; + case NET_INPUT: msg = _( "Input" ); break; + case NET_OUTPUT: msg = _( "Output" ); break; + case NET_BIDI: msg = _( "Bidirectional" ); break; + case NET_TRISTATE: msg = _( "Tri-State" ); break; + case NET_UNSPECIFIED: msg = _( "Passive" ); break; + default: msg = wxT( "???" ); break; } - frame->AppendMsgPanel( _("Type"), msg, BLUE ); + + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, BLUE ) ); } // Display text size (X or Y value, with are the same value in Eeschema) msg = ReturnStringFromValue( g_UserUnit, m_Size.x, true ); - frame->AppendMsgPanel( _("Size"), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg, RED ) ); } #if defined(DEBUG) diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 4e2fe96190..2d2bc481f6 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -212,7 +212,7 @@ public: virtual EDA_ITEM* Clone() const; - void DisplayInfo( EDA_DRAW_FRAME* frame ); // Virtual function + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // override diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 029f6ef705..0b67607223 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index b66099bf57..338be1d3ae 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -119,7 +120,9 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem ) component->GetDrawItemList().sort(); OnModify( ); - DrawItem->DisplayInfo( this ); + MSG_PANEL_ITEMS items; + DrawItem->GetMsgPanelInfo( items ); + SetMsgPanel( items ); m_canvas->Refresh(); } diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 9a5eb3a441..14051141d0 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index 134c097791..1e80c9ebb2 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -540,42 +541,41 @@ void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_RECT* aClipBox, } -void GERBER_DRAW_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) +void GERBER_DRAW_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; - frame->ClearMsgPanel(); msg = ShowGBRShape(); - frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); // Display D_Code value: msg.Printf( wxT( "%d" ), m_DCode ); - frame->AppendMsgPanel( _( "D Code" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "D Code" ), msg, RED ) ); // Display graphic layer number msg.Printf( wxT( "%d" ), GetLayer() + 1 ); - frame->AppendMsgPanel( _( "Graphic layer" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Graphic layer" ), msg, BROWN ) ); // Display item rotation // The full rotation is Image rotation + m_lyrRotation // but m_lyrRotation is specific to this object // so we display only this parameter msg.Printf( wxT( "%f" ), m_lyrRotation ); - frame->AppendMsgPanel( _( "Rotation" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BLUE ) ); // Display item polarity (item specific) msg = m_LayerNegative ? _("Clear") : _("Dark"); - frame->AppendMsgPanel( _( "Polarity" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Polarity" ), msg, BLUE ) ); // Display mirroring (item specific) msg.Printf( wxT( "A:%s B:%s" ), m_mirrorA ? _("Yes") : _("No"), m_mirrorB ? _("Yes") : _("No")); - frame->AppendMsgPanel( _( "Mirror" ), msg, DARKRED ); + aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKRED ) ); // Display AB axis swap (item specific) msg = m_swapAxis ? wxT( "A=Y B=X" ) : wxT( "A=X B=Y" ); - frame->AppendMsgPanel( _( "AB axis" ), msg, DARKRED ); + aList.push_back( MSG_PANEL_ITEM( _( "AB axis" ), msg, DARKRED ) ); } diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index d0d4a33518..08723f54b4 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -36,6 +36,7 @@ class GERBER_IMAGE; class GBR_LAYOUT; class D_CODE; +class MSG_PANEL_ITEM; /* Shapes id for basic shapes ( .m_Shape member ) */ @@ -243,15 +244,7 @@ public: /* divers */ int Shape() const { return m_Shape; } - /** - * Function DisplayInfo - * has knowledge about the frame and how and where to put status information - * about this object into the frame's message panel. - * Is virtual from EDA_ITEM. - * Display info about this GERBER item - * @param frame A EDA_DRAW_FRAME in which to print status information. - */ - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); wxString ShowGBRShape(); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 253e3498ef..63da5c600d 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -744,6 +745,7 @@ void GERBVIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition ) m_Layout->SetOriginAxisPosition( aPosition ); } + void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo ) { GetScreen()->SetCurItem( aItem ); @@ -751,12 +753,19 @@ void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo ) if( aItem ) { if( aDisplayInfo ) - aItem->DisplayInfo( this ); + { + MSG_PANEL_ITEMS items; + aItem->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } } else + { EraseMsgBox(); + } } + /* * Function GetLayoutBoundingBox * returns the bounding box containing all gerber items. diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index 258c506537..38261076a4 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -28,9 +28,12 @@ #include #include +#include + #include #include + /* localize a gerber item and return a pointer to it. * Display info about this item */ @@ -74,7 +77,9 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc if( found ) { - gerb_item->DisplayInfo( this ); + MSG_PANEL_ITEMS items; + gerb_item->GetMsgPanelInfo( items ); + SetMsgPanel( items ); return gerb_item; } diff --git a/include/base_struct.h b/include/base_struct.h index 68f983ccba..c258b17d47 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -165,8 +165,8 @@ class wxFindReplaceData; class EDA_ITEM; class EDA_DRAW_FRAME; class EDA_RECT; -class EDA_DRAW_PANEL; class DHEAD; +class MSG_PANEL_ITEM; /** @@ -495,14 +495,17 @@ public: void SetForceVisible( bool aEnable ) { m_forceVisible = aEnable; } /** - * Function DisplayInfo - * has knowledge about the frame and how and where to put status - * information about this object into the frame's message panel. - * @param frame A EDA_DRAW_FRAME in which to print status information. + * Function GetMsgPanelInfo + * populates \a aList of #MSG_PANEL_ITEM objects with it's internal state for display + * purposes. + * + * @note This method replaces DisplayInfo() so that KiCad objects no longer have any + * knowledge of wxWidgets UI objects. + * + * @param aList is the list to populate. */ - virtual void DisplayInfo( EDA_DRAW_FRAME* frame ) + virtual void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { - // derived classes may implement this } /** diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h index 7dbd5449d1..2faa11e934 100644 --- a/include/class_drawpanel.h +++ b/include/class_drawpanel.h @@ -35,7 +35,7 @@ #include #include -class EDA_DRAW_FRAME; + class BASE_SCREEN; class PCB_SCREEN; diff --git a/include/msgpanel.h b/include/msgpanel.h new file mode 100644 index 0000000000..003e3acbdc --- /dev/null +++ b/include/msgpanel.h @@ -0,0 +1,184 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011-2012 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file msgpanel.h + * @brief Message panel definition file. + */ + +#ifndef _MSGPANEL_H_ +#define _MSGPANEL_H_ + + +#include + +#include + +#include + + +#define MSG_PANEL_DEFAULT_PAD 6 ///< The default number of spaces between each text string. + + +class EDA_MSG_PANEL; + + +/** + * Class EDA_MSG_ITEM + * is used EDA_MSG_PANEL as the item type for displaying messages. + */ +class MSG_PANEL_ITEM +{ + int m_X; + int m_UpperY; + int m_LowerY; + wxString m_UpperText; + wxString m_LowerText; + EDA_COLOR_T m_Color; + int m_Pad; + + friend class EDA_MSG_PANEL; + +public: + MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText, EDA_COLOR_T aColor, + int aPad = MSG_PANEL_DEFAULT_PAD ) : + m_UpperText( aUpperText ), + m_LowerText( aLowerText ), + m_Color( aColor ), + m_Pad( aPad ) + { + } + + MSG_PANEL_ITEM() + { + } + + void SetUpperText( const wxString& aUpperText ) { m_UpperText = aUpperText; } + const wxString& GetUpperText() const { return m_UpperText; } + + void SetLowerText( const wxString& aLowerText ) { m_LowerText = aLowerText; } + const wxString& GetLowerText() const { return m_LowerText; } + + void SetColor( EDA_COLOR_T aColor ) { m_Color = aColor; } + EDA_COLOR_T GetColor() const { return m_Color; } + + void SetPadding( int aPad ) { m_Pad = aPad; } + int GetPadding() const { return m_Pad; } +}; + + +typedef std::vector MSG_PANEL_ITEMS; +typedef MSG_PANEL_ITEMS::iterator MSG_PANEL_ITEMS_ITER; +typedef MSG_PANEL_ITEMS::const_iterator MSG_PANEL_ITEMS_CITER; + + +/** + * class EDA_MSG_PANEL + * is a panel to display various information messages. + */ +class EDA_MSG_PANEL : public wxPanel +{ +protected: + MSG_PANEL_ITEMS m_Items; + int m_last_x; ///< the last used x coordinate + wxSize m_fontSize; + + void showItem( wxDC& dc, const MSG_PANEL_ITEM& aItem ); + + void erase( wxDC* DC ); + + /** + * Function getFontSize + * computes the height and width of a 'W' in the system font. + */ + static wxSize computeFontSize(); + + /** + * Calculate the width and height of a text string using the system UI font. + */ + wxSize computeTextSize( const wxString& text ) const; + +public: + EDA_MSG_PANEL( wxWindow* aParent, int aId, const wxPoint& aPosition, const wxSize& aSize ); + ~EDA_MSG_PANEL(); + + /** + * Function GetRequiredHeight + * returns the required height (in pixels) of a EDA_MSG_PANEL. This takes + * into consideration the system gui font, wxSYS_DEFAULT_GUI_FONT. + */ + static int GetRequiredHeight(); + + void OnPaint( wxPaintEvent& aEvent ); + void EraseMsgBox(); + + /** + * Function SetMessage + * sets a message at \a aXPosition to \a aUpperText and \a aLowerText in the message panel. + * + * @param aXPosition The horizontal position to display the message or less than zero + * to set the message using the last message position. + * @param aUpperText The text to be displayed in top line. + * @param aLowerText The text to be displayed in bottom line. + * @param aColor Color of the text to display. + */ + void SetMessage( int aXPosition, const wxString& aUpperText, + const wxString& aLowerText, EDA_COLOR_T aColor ); + + /** + * Function AppendMessage + * appends a message to the message panel. + * + * This method automatically adjusts for the width of the text string. + * Making consecutive calls to AppendMessage will append each message + * to the right of the last message. This message is not compatible + * with Affiche_1_Parametre. + * + * @param aUpperText The message upper text. + * @param aLowerText The message lower text. + * @param aColor A color ID from the KiCad color list (see colors.h). + * @param aPad Number of spaces to pad between messages (default = 4). + */ + void AppendMessage( const wxString& aUpperText, const wxString& aLowerText, + EDA_COLOR_T aColor, int aPad = 6 ); + + /** + * Function AppendMessage + * appends \a aMessageItem to the message panel. + * + * @param aMessageItem is a reference to an #MSG_PANEL_ITEM containing the message to + * append to the panel. + */ + void AppendMessage( const MSG_PANEL_ITEM& aMessageItem ) + { + AppendMessage( aMessageItem.GetUpperText(), aMessageItem.GetLowerText(), + aMessageItem.GetColor(), aMessageItem.GetPadding() ); + } + + DECLARE_EVENT_TABLE() +}; + + +#endif // _MSGPANEL_H_ diff --git a/include/wxstruct.h b/include/wxstruct.h index 119fdbe006..6ad3791bc2 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -74,6 +74,8 @@ class PARAM_CFG_BASE; class PAGE_INFO; class PLOTTER; class TITLE_BLOCK; +class MSG_PANEL_ITEM; + enum id_librarytype { LIBRARY_TYPE_EESCHEMA, @@ -116,7 +118,6 @@ protected: ID_DRAWFRAME_TYPE m_Ident; // Id Type (pcb, schematic, library..) wxPoint m_FramePos; wxSize m_FrameSize; - int m_MsgFrameHeight; wxAuiToolBar* m_mainToolBar; // Standard horizontal Toolbar bool m_FrameIsActive; @@ -432,6 +433,8 @@ protected: /// Panel used to display information at the bottom of the main window. EDA_MSG_PANEL* m_messagePanel; + int m_MsgFrameHeight; + #ifdef USE_WX_OVERLAY // MAC Uses overlay to workaround the wxINVERT and wxXOR miss wxOverlay m_overlay; @@ -851,6 +854,16 @@ public: */ void ClearMsgPanel( void ); + /** + * Function SetMsgPanel + * clears the message panel and populates it with the contents of \a aList. + * + * @param aList is the list of #MSG_PANEL_ITEM objects to fill the message panel. + */ + void SetMsgPanel( const std::vector< MSG_PANEL_ITEM >& aList ); + + void SetMsgPanel( EDA_ITEM* aItem ); + /** * Function PrintPage * used to print a page @@ -888,95 +901,6 @@ public: }; -/** - * Struct EDA_MSG_ITEM - * is used privately by EDA_MSG_PANEL as the item type for displaying messages. - */ -struct EDA_MSG_ITEM -{ - int m_X; - int m_UpperY; - int m_LowerY; - wxString m_UpperText; - wxString m_LowerText; - EDA_COLOR_T m_Color; -}; - - -/** - * class EDA_MSG_PANEL - * is a panel to display various information messages. - */ -class EDA_MSG_PANEL : public wxPanel -{ -protected: - std::vector m_Items; - int m_last_x; ///< the last used x coordinate - wxSize m_fontSize; - - void showItem( wxDC& dc, const EDA_MSG_ITEM& aItem ); - - void erase( wxDC* DC ); - - /** - * Function getFontSize - * computes the height and width of a 'W' in the system font. - */ - static wxSize computeFontSize(); - - /** - * Calculate the width and height of a text string using the system UI font. - */ - wxSize computeTextSize( const wxString& text ) const; - -public: - EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size ); - ~EDA_MSG_PANEL(); - - /** - * Function GetRequiredHeight - * returns the required height (in pixels) of a EDA_MSG_PANEL. This takes - * into consideration the system gui font, wxSYS_DEFAULT_GUI_FONT. - */ - static int GetRequiredHeight(); - - void OnPaint( wxPaintEvent& event ); - void EraseMsgBox(); - - /** - * Function SetMessage - * sets a message at \a aXPosition to \a aUpperText and \a aLowerText in the message panel. - * - * @param aXPosition The horizontal position to display the message or less than zero - * to set the message using the last message position. - * @param aUpperText The text to be displayed in top line. - * @param aLowerText The text to be displayed in bottom line. - * @param aColor Color of the text to display. - */ - void SetMessage( int aXPosition, const wxString& aUpperText, - const wxString& aLowerText, EDA_COLOR_T aColor ); - - /** - * Append a message to the message panel. - * - * This method automatically adjusts for the width of the text string. - * Making consecutive calls to AppendMessage will append each message - * to the right of the last message. This message is not compatible - * with Affiche_1_Parametre. - * - * @param textUpper - The message upper text. - * @param textLower - The message lower text. - * @param color - A color ID from the KiCad color list (see colors.h). - * @param pad - Number of spaces to pad between messages (default = 4). - */ - void AppendMessage( const wxString& textUpper, const wxString& textLower, - EDA_COLOR_T color, int pad = 6 ); - - DECLARE_EVENT_TABLE() -}; - - - /** * Specialization of the wxAuiPaneInfo class for KiCad panels. * diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index fdac1a24b9..6d8eba2471 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -56,7 +57,10 @@ void PCB_EDIT_FRAME::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On ) track->SetState( TRACK_LOCKED, Flag_On ); track->Draw( m_canvas, DC, GR_OR | GR_HIGHLIGHT ); m_canvas->CrossHairOn( DC ); // Display cursor shape - track->DisplayInfo( this ); + + MSG_PANEL_ITEMS items; + track->GetMsgPanelInfo( items ); + SetMsgPanel( items ); } diff --git a/pcbnew/autorouter/automove.cpp b/pcbnew/autorouter/automove.cpp index f7db5f5b7f..9156091856 100644 --- a/pcbnew/autorouter/automove.cpp +++ b/pcbnew/autorouter/automove.cpp @@ -304,8 +304,7 @@ void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked ) if( aModule ) { aModule->SetLocked( aLocked ); - - aModule->DisplayInfo( this ); + SetMsgPanel( aModule ); OnModify(); } else diff --git a/pcbnew/autorouter/autoplac.cpp b/pcbnew/autorouter/autoplac.cpp index e1461b7e6a..81a959b26f 100644 --- a/pcbnew/autorouter/autoplac.cpp +++ b/pcbnew/autorouter/autoplac.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -591,7 +592,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) g_Show_Module_Ratsnest = false; - aModule->DisplayInfo( this ); + SetMsgPanel( aModule ); LastPosOK.x = RoutingMatrix.m_BrdBox.GetX(); LastPosOK.y = RoutingMatrix.m_BrdBox.GetY(); @@ -1106,7 +1107,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) continue; pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK; - Module->DisplayInfo( pcbframe ); + pcbframe->SetMsgPanel( Module ); pcbframe->build_ratsnest_module( Module ); /* Calculate external ratsnest. */ diff --git a/pcbnew/autorouter/autorout.cpp b/pcbnew/autorouter/autorout.cpp index 76e33038c0..160eaf835c 100644 --- a/pcbnew/autorouter/autorout.cpp +++ b/pcbnew/autorouter/autorout.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index aeda8c7396..bff454d9eb 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -460,7 +461,11 @@ void PCB_BASE_FRAME::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo ) if( aItem ) { if( aDisplayInfo ) - aItem->DisplayInfo( this ); + { + MSG_PANEL_ITEMS items; + aItem->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } #if 0 && defined(DEBUG) aItem->Show( 0, std::cout ); @@ -471,8 +476,9 @@ void PCB_BASE_FRAME::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo ) { // we can use either of these two: - //MsgPanel->EraseMsgBox(); - m_Pcb->DisplayInfo( this ); // show the BOARD stuff + MSG_PANEL_ITEMS items; + m_Pcb->GetMsgPanelInfo( items ); // show the BOARD stuff + SetMsgPanel( items ); #if 0 && defined(DEBUG) std::cout << "SetCurItem(NULL)\n"; diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index c060af3642..401b30e579 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -1007,14 +1008,11 @@ EDA_RECT BOARD::ComputeBoundingBox( bool aBoardEdgesOnly ) // virtual, see pcbstruct.h -void BOARD::DisplayInfo( EDA_DRAW_FRAME* frame ) +void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString txt; - - frame->ClearMsgPanel(); - - int viasCount = 0; - int trackSegmentsCount = 0; + int viasCount = 0; + int trackSegmentsCount = 0; for( BOARD_ITEM* item = m_Track; item; item = item->Next() ) { @@ -1025,19 +1023,19 @@ void BOARD::DisplayInfo( EDA_DRAW_FRAME* frame ) } txt.Printf( wxT( "%d" ), GetPadCount() ); - frame->AppendMsgPanel( _( "Pads" ), txt, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) ); txt.Printf( wxT( "%d" ), viasCount ); - frame->AppendMsgPanel( _( "Vias" ), txt, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, DARKGREEN ) ); txt.Printf( wxT( "%d" ), trackSegmentsCount ); - frame->AppendMsgPanel( _( "trackSegm" ), txt, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "trackSegm" ), txt, DARKGREEN ) ); txt.Printf( wxT( "%d" ), GetNodesCount() ); - frame->AppendMsgPanel( _( "Nodes" ), txt, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Nodes" ), txt, DARKCYAN ) ); txt.Printf( wxT( "%d" ), m_NetInfo.GetNetCount() ); - frame->AppendMsgPanel( _( "Nets" ), txt, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Nets" ), txt, RED ) ); /* These parameters are known only if the full ratsnest is available, * so, display them only if this is the case @@ -1045,13 +1043,13 @@ void BOARD::DisplayInfo( EDA_DRAW_FRAME* frame ) if( (m_Status_Pcb & NET_CODES_OK) ) { txt.Printf( wxT( "%d" ), GetRatsnestsCount() ); - frame->AppendMsgPanel( _( "Links" ), txt, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Links" ), txt, DARKGREEN ) ); txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetUnconnectedNetCount() ); - frame->AppendMsgPanel( _( "Connect" ), txt, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Connect" ), txt, DARKGREEN ) ); txt.Printf( wxT( "%d" ), GetUnconnectedNetCount() ); - frame->AppendMsgPanel( _( "Unconnected" ), txt, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Unconnected" ), txt, BLUE ) ); } } diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 0e4d69eaac..1004ad699f 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -29,6 +29,7 @@ class SEGZONE; class TRACK; class D_PAD; class MARKER_PCB; +class MSG_PANEL_ITEM; // non-owning container of item candidates when searching for items on the same track. @@ -807,14 +808,7 @@ public: void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; } - /** - * Function DisplayInfo - * has knowledge about the frame and how and where to put status information - * about this object into the frame's message panel. - * Is virtual from EDA_ITEM. - * @param frame A EDA_DRAW_FRAME in which to print status information. - */ - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); /** * Function Draw. diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index a8441912e3..00220f4893 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -389,10 +389,10 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, // see class_cotation.h -void DIMENSION::DisplayInfo( EDA_DRAW_FRAME* frame ) +void DIMENSION::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { // for now, display only the text within the DIMENSION using class TEXTE_PCB. - m_Text.DisplayInfo( frame ); + m_Text.GetMsgPanelInfo( aList ); } diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 4026bfe3a0..6959f74277 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -38,6 +38,7 @@ class LINE_READER; class EDA_DRAW_PANEL; class TEXTE_PCB; +class MSG_PANEL_ITEM; class DIMENSION : public BOARD_ITEM @@ -116,7 +117,7 @@ public: */ void Mirror( const wxPoint& axis_pos ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool HitTest( const wxPoint& aPosition ); diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index da06ceee47..e6b8f323bd 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -313,7 +314,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // see pcbstruct.h -void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame ) +void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; wxString coords; @@ -321,31 +322,30 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame ) BOARD* board = (BOARD*) m_Parent; wxASSERT( board ); - frame->ClearMsgPanel(); - msg = wxT( "DRAWING" ); - frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); wxString shape = _( "Shape" ); - switch( m_Shape ) { - case S_CIRCLE: - frame->AppendMsgPanel( shape, _( "Circle" ), RED ); - break; + switch( m_Shape ) + { + case S_CIRCLE: + aList.push_back( MSG_PANEL_ITEM( shape, _( "Circle" ), RED ) ); + break; - case S_ARC: - frame->AppendMsgPanel( shape, _( "Arc" ), RED ); + case S_ARC: + aList.push_back( MSG_PANEL_ITEM( shape, _( "Arc" ), RED ) ); + msg.Printf( wxT( "%.1f" ), (double)m_Angle/10 ); + aList.push_back( MSG_PANEL_ITEM( _("Angle"), msg, RED ) ); + break; - msg.Printf( wxT( "%.1f" ), (double)m_Angle/10 ); - frame->AppendMsgPanel( _("Angle"), msg, RED ); - break; - case S_CURVE: - frame->AppendMsgPanel( shape, _( "Curve" ), RED ); - break; + case S_CURVE: + aList.push_back( MSG_PANEL_ITEM( shape, _( "Curve" ), RED ) ); + break; - default: - frame->AppendMsgPanel( shape, _( "Segment" ), RED ); + default: + aList.push_back( MSG_PANEL_ITEM( shape, _( "Segment" ), RED ) ); } wxString start; @@ -354,12 +354,10 @@ void DRAWSEGMENT::DisplayInfo( EDA_DRAW_FRAME* frame ) wxString end; end << GetEnd(); - frame->AppendMsgPanel( start, end, DARKGREEN ); - - frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN ); - - msg = frame->CoordinateToString( m_Width ); - frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( start, end, DARKGREEN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN ) ); + msg = ::CoordinateToString( m_Width ); + aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) ); } diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index c36b5b9806..6e43250a0b 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -38,6 +38,7 @@ class LINE_READER; class EDA_DRAW_FRAME; class MODULE; +class MSG_PANEL_ITEM; class DRAWSEGMENT : public BOARD_ITEM @@ -163,7 +164,7 @@ public: void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ); - virtual void DisplayInfo( EDA_DRAW_FRAME* frame ); + virtual void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); virtual EDA_RECT GetBoundingBox() const; diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 23ad4714e2..d23d55d6a0 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include @@ -229,7 +231,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // see class_edge_mod.h -void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) +void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; @@ -243,19 +245,16 @@ void EDGE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) if( !board ) return; - frame->ClearMsgPanel(); - - frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN ); - frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN ); - frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE ); - + aList.push_back( MSG_PANEL_ITEM( _( "Graphic Item" ), wxEmptyString, DARKCYAN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Module" ), module->m_Reference->m_Text, DARKCYAN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->m_Value->m_Text, BLUE ) ); msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() ); - frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN ); - frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED ); - frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED ); - - msg = frame->CoordinateToString( m_Width ); - frame->AppendMsgPanel( _( "Width" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), + RED ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED ) ); + msg = ::CoordinateToString( m_Width ); + aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) ); } diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index 67fb247697..ff2a82bde2 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -37,7 +37,7 @@ class LINE_READER; class EDA_3D_CANVAS; -class EDA_DRAW_FRAME; +class MSG_PANEL_ITEM; class EDGE_MODULE : public DRAWSEGMENT @@ -69,7 +69,7 @@ public: void Draw3D( EDA_3D_CANVAS* glcanvas ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); wxString GetClass() const { diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index 5c115e1aa4..d16c973855 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -90,20 +91,18 @@ bool MARKER_PCB::IsOnLayer( int aLayer ) const return IsValidCopperLayerIndex( aLayer ); } -void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) +void MARKER_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { - frame->ClearMsgPanel(); - const DRC_ITEM& rpt = m_drc; - frame->AppendMsgPanel( _( "Type" ), _( "Marker" ), DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), _( "Marker" ), DARKCYAN ) ); wxString errorTxt; errorTxt << _( "ErrType" ) << wxT( "(" ) << rpt.GetErrorCode() << wxT( ")- " ) << rpt.GetErrorText() << wxT( ":" ); - frame->AppendMsgPanel( errorTxt, wxEmptyString, RED ); + aList.push_back( MSG_PANEL_ITEM( errorTxt, wxEmptyString, RED ) ); wxString txtA; txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT( ": " ) << rpt.GetTextA(); @@ -113,7 +112,7 @@ void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) if ( rpt.HasSecondItem() ) txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT( ": " ) << rpt.GetTextB(); - frame->AppendMsgPanel( txtA, txtB, DARKBROWN ); + aList.push_back( MSG_PANEL_ITEM( txtA, txtB, DARKBROWN ) ); } diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index 6c27f9b448..d1fc47ec7a 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -11,6 +11,9 @@ #include +class MSG_PANEL_ITEM; + + class MARKER_PCB : public BOARD_ITEM, public MARKER_BASE { @@ -68,7 +71,7 @@ public: bool IsOnLayer( int aLayer ) const; - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); wxString GetSelectMenuText() const; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 2891451aaf..010ad26c8f 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -44,6 +44,7 @@ #include #include #include <3d_struct.h> +#include #include #include @@ -436,40 +437,30 @@ EDA_RECT MODULE::GetBoundingBox() const /* Virtual function, from EDA_ITEM. * display module info on MsgPanel */ -void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) +void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { int nbpad; char bufcar[512], Line[512]; - bool flag = false; wxString msg; BOARD* board = GetBoard(); - frame->EraseMsgBox(); + aList.push_back( MSG_PANEL_ITEM( m_Reference->m_Text, m_Value->m_Text, DARKCYAN ) ); - if( frame->IsType( PCB_FRAME_TYPE ) ) - flag = true; + // Display last date the component was edited (useful in Module Editor). + time_t edit_time = m_LastEdit_Time; + strcpy( Line, ctime( &edit_time ) ); + strtok( Line, " \n\r" ); + strcpy( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, " " ); + strcat( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, ", " ); + strtok( NULL, " \n\r" ); + strcat( bufcar, strtok( NULL, " \n\r" ) ); + msg = FROM_UTF8( bufcar ); + aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) ); - frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text, DARKCYAN ); - - if( flag ) // Display last date the component was edited( useful in Module Editor) - { - time_t edit_time = m_LastEdit_Time; - strcpy( Line, ctime( &edit_time ) ); - strtok( Line, " \n\r" ); - strcpy( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, " " ); - strcat( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, ", " ); - strtok( NULL, " \n\r" ); - strcat( bufcar, strtok( NULL, " \n\r" ) ); - msg = FROM_UTF8( bufcar ); - frame->AppendMsgPanel( _( "Last Change" ), msg, BROWN ); - } - else // display time stamp in schematic - { - msg.Printf( wxT( "%8.8lX" ), m_TimeStamp ); - frame->AppendMsgPanel( _( "Netlist path" ), m_Path, BROWN ); - } - - frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), RED ); + // display time stamp in schematic + msg.Printf( wxT( "%8.8lX" ), m_TimeStamp ); + aList.push_back( MSG_PANEL_ITEM( _( "Netlist path" ), m_Path, BROWN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), board->GetLayerName( m_Layer ), RED ) ); EDA_ITEM* PtStruct = m_Pads; nbpad = 0; @@ -481,7 +472,7 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) } msg.Printf( wxT( "%d" ), nbpad ); - frame->AppendMsgPanel( _( "Pads" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) ); msg = wxT( ".." ); @@ -491,10 +482,10 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) if( m_ModuleStatus & MODULE_is_PLACED ) msg[1] = 'P'; - frame->AppendMsgPanel( _( "Stat" ), msg, MAGENTA ); + aList.push_back( MSG_PANEL_ITEM( _( "Stat" ), msg, MAGENTA ) ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); - frame->AppendMsgPanel( _( "Orient" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, BROWN ) ); /* Controls on right side of the dialog */ switch( m_Attributs & 255 ) @@ -515,20 +506,20 @@ void MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) msg = wxT("???"); break; } - frame->AppendMsgPanel( _( "Attrib" ), msg, BROWN ); - frame->AppendMsgPanel( _( "Module" ), m_LibRef, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Attrib" ), msg, BROWN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Module" ), m_LibRef, BLUE ) ); if( m_3D_Drawings != NULL ) msg = m_3D_Drawings->m_Shape3DName; else msg = _( "No 3D shape" ); - frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "3D-Shape" ), msg, RED ) ); wxString doc = _( "Doc: " ) + m_Doc; wxString keyword = _( "KeyW: " ) + m_KeyWord; - frame->AppendMsgPanel( doc, keyword, BLACK ); + aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) ); } diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 65685af6a9..0d160fbef0 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -45,6 +45,7 @@ class S3D_MASTER; class EDA_DRAW_PANEL; class D_PAD; class BOARD; +class MSG_PANEL_ITEM; /** @@ -248,7 +249,7 @@ public: void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool HitTest( const wxPoint& aPosition ); diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index d1b6e6e5da..05e0be9c2d 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -24,7 +24,7 @@ class NETINFO_ITEM; class D_PAD; class BOARD; class BOARD_ITEM; - +class MSG_PANEL_ITEM; /*****************************/ @@ -215,6 +215,7 @@ private: NETCLASS* m_NetClass; + BOARD_ITEM* m_parent; ///< The parent board item object the net belongs to. public: int m_NbNodes; // Pads count for this net @@ -379,14 +380,7 @@ public: */ void SetNetname( const wxString& aNetname ); - /** - * Function DisplayInfo - * has knowledge about the frame and how and where to put status information - * about this object into the frame's message panel. - * Is virtual from EDA_ITEM. - * @param frame A EDA_DRAW_FRAME in which to print status information. - */ - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); }; diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index 812a500701..5c35b95a38 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include #include @@ -54,6 +56,7 @@ NETINFO_ITEM::NETINFO_ITEM( BOARD_ITEM* aParent, const wxString& aNetName, int a if( aNetName.size() ) SetNetname( aNetName ); + m_parent = aParent; m_NbNodes = 0; m_NbLink = 0; m_NbNoconn = 0; @@ -103,7 +106,7 @@ void NETINFO_ITEM::Draw( EDA_DRAW_PANEL* panel, * Is virtual from EDA_ITEM. * @param frame A EDA_DRAW_FRAME in which to print status information. */ -void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) +void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { int count; EDA_ITEM* Struct; @@ -111,17 +114,16 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) MODULE* module; D_PAD* pad; double lengthnet = 0; // This is the lenght of tracks on pcb - double lengthPadToDie = 0; // this is the lenght of internal ICs connections + double lengthPadToDie = 0; // this is the lenght of internal ICs connections - frame->ClearMsgPanel(); - - frame->AppendMsgPanel( _( "Net Name" ), GetNetname(), RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Net Name" ), GetNetname(), RED ) ); txt.Printf( wxT( "%d" ), GetNet() ); - frame->AppendMsgPanel( _( "Net Code" ), txt, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), txt, RED ) ); count = 0; - module = ( (PCB_BASE_FRAME*) frame )->GetBoard()->m_Modules; + module = m_parent->GetBoard()->m_Modules; + for( ; module != 0; module = module->Next() ) { for( pad = module->m_Pads; pad != 0; pad = pad->Next() ) @@ -135,10 +137,10 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) } txt.Printf( wxT( "%d" ), count ); - frame->AppendMsgPanel( _( "Pads" ), txt, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), txt, DARKGREEN ) ); count = 0; - Struct = ( (PCB_BASE_FRAME*) frame )->GetBoard()->m_Track; + Struct = m_parent->GetBoard()->m_Track; for( ; Struct != NULL; Struct = Struct->Next() ) { @@ -156,19 +158,19 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) } txt.Printf( wxT( "%d" ), count ); - frame->AppendMsgPanel( _( "Vias" ), txt, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Vias" ), txt, BLUE ) ); - // Displays the full net lenght (tracks on pcb + internal ICs connections ): - txt = frame->CoordinateToString( lengthnet + lengthPadToDie ); - frame->AppendMsgPanel( _( "Net Length:" ), txt, RED ); + // Displays the full net length (tracks on pcb + internal ICs connections ): + txt = ::CoordinateToString( lengthnet + lengthPadToDie ); + aList.push_back( MSG_PANEL_ITEM( _( "Net Length:" ), txt, RED ) ); - // Displays the net lenght of tracks only: - txt = frame->CoordinateToString( lengthnet ); - frame->AppendMsgPanel( _( "On Board" ), txt, RED ); + // Displays the net length of tracks only: + txt = ::CoordinateToString( lengthnet ); + aList.push_back( MSG_PANEL_ITEM( _( "On Board" ), txt, RED ) ); - // Displays the net lenght of internal ICs connections (wires inside ICs): - txt = frame->CoordinateToString( lengthPadToDie ); - frame->AppendMsgPanel( _( "In Package" ), txt, RED ); + // Displays the net length of internal ICs connections (wires inside ICs): + txt = ::CoordinateToString( lengthPadToDie ); + aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), txt, RED ) ); } diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index c1ea8728d9..23206feec3 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include // ID_TRACK_BUTT @@ -492,31 +494,29 @@ int D_PAD::GetThermalGap() const } -void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame ) +void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) { MODULE* module; wxString Line; BOARD* board; - frame->EraseMsgBox(); - module = (MODULE*) m_Parent; if( module ) { wxString msg = module->GetReference(); - frame->AppendMsgPanel( _( "Module" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Module" ), msg, DARKCYAN ) ); ReturnStringPadName( Line ); - frame->AppendMsgPanel( _( "RefP" ), Line, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "RefP" ), Line, BROWN ) ); } - frame->AppendMsgPanel( _( "Net" ), m_Netname, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Net" ), m_Netname, DARKCYAN ) ); /* For test and debug only: display m_physical_connexion and * m_logical_connexion */ #if 1 // Used only to debug connectivity calculations Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(), GetSubNet(), GetZoneSubNet() ); - frame->AppendMsgPanel( wxT( "L-P-Z" ), Line, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( wxT( "L-P-Z" ), Line, DARKGREEN ) ); #endif board = GetBoard(); @@ -620,29 +620,29 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame ) } } - frame->AppendMsgPanel( _( "Layer" ), layerInfo, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), layerInfo, DARKGREEN ) ); - frame->AppendMsgPanel( ShowPadShape(), ShowPadAttr(), DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) ); - Line = frame->CoordinateToString( m_Size.x ); - frame->AppendMsgPanel( _( "H Size" ), Line, RED ); + Line = ::CoordinateToString( m_Size.x ); + aList.push_back( MSG_PANEL_ITEM( _( "H Size" ), Line, RED ) ); - Line = frame->CoordinateToString( m_Size.y ); - frame->AppendMsgPanel( _( "V Size" ), Line, RED ); + Line = ::CoordinateToString( m_Size.y ); + aList.push_back( MSG_PANEL_ITEM( _( "V Size" ), Line, RED ) ); - Line = frame->CoordinateToString( (unsigned) m_Drill.x ); + Line = ::CoordinateToString( (unsigned) m_Drill.x ); if( m_DrillShape == PAD_CIRCLE ) { - frame->AppendMsgPanel( _( "Drill" ), Line, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Drill" ), Line, RED ) ); } else { - Line = frame->CoordinateToString( (unsigned) m_Drill.x ); + Line = ::CoordinateToString( (unsigned) m_Drill.x ); wxString msg; - msg = frame->CoordinateToString( (unsigned) m_Drill.y ); + msg = ::CoordinateToString( (unsigned) m_Drill.y ); Line += wxT( "/" ) + msg; - frame->AppendMsgPanel( _( "Drill X / Y" ), Line, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), Line, RED ) ); } int module_orient = module ? module->GetOrientation() : 0; @@ -654,18 +654,18 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame ) else Line.Printf( wxT( "%3.1f" ), (double) m_Orient / 10 ); - frame->AppendMsgPanel( _( "Orient" ), Line, LIGHTBLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), Line, LIGHTBLUE ) ); - Line = frame->CoordinateToString( m_Pos.x ); - frame->AppendMsgPanel( _( "X Pos" ), Line, LIGHTBLUE ); + Line = ::CoordinateToString( m_Pos.x ); + aList.push_back( MSG_PANEL_ITEM( _( "X Pos" ), Line, LIGHTBLUE ) ); - Line = frame->CoordinateToString( m_Pos.y ); - frame->AppendMsgPanel( _( "Y pos" ), Line, LIGHTBLUE ); + Line = ::CoordinateToString( m_Pos.y ); + aList.push_back( MSG_PANEL_ITEM( _( "Y pos" ), Line, LIGHTBLUE ) ); if( GetPadToDieLength() ) { - Line = frame->CoordinateToString( GetPadToDieLength() ); - frame->AppendMsgPanel( _( "Length in package" ), Line, CYAN ); + Line = ::CoordinateToString( GetPadToDieLength() ); + aList.push_back( MSG_PANEL_ITEM( _( "Length in package" ), Line, CYAN ) ); } } diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 644a48abba..3055efb836 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -38,11 +38,13 @@ #include // PARAM_CFG_ARRAY #include "zones.h" + class LINE_READER; class EDA_3D_CANVAS; class EDA_DRAW_PANEL; class MODULE; class TRACK; +class MSG_PANEL_INFO; /* Default layers used for pads, according to the pad type. @@ -341,7 +343,7 @@ public: void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; } - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool IsOnLayer( int aLayer ) const; diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index d4164ddd72..a92b898a7c 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include @@ -106,10 +108,9 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, } -void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) +void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; - BOARD* board; BOARD_ITEM* parent = (BOARD_ITEM*) m_Parent; @@ -119,34 +120,33 @@ void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) board = (BOARD*) parent->GetParent(); else board = (BOARD*) parent; + wxASSERT( board ); - frame->ClearMsgPanel(); - if( m_Parent && m_Parent->Type() == PCB_DIMENSION_T ) - frame->AppendMsgPanel( _( "DIMENSION" ), m_Text, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "DIMENSION" ), m_Text, DARKGREEN ) ); else - frame->AppendMsgPanel( _( "PCB Text" ), m_Text, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), m_Text, DARKGREEN ) ); - frame->AppendMsgPanel( _( "Layer" ), - board->GetLayerName( m_Layer ), BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), + board->GetLayerName( m_Layer ), BLUE ) ); if( !m_Mirror ) - frame->AppendMsgPanel( _( "Mirror" ), _( "No" ), DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "No" ), DARKGREEN ) ); else - frame->AppendMsgPanel( _( "Mirror" ), _( "Yes" ), DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "Yes" ), DARKGREEN ) ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); - frame->AppendMsgPanel( _( "Orientation" ), msg, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), msg, DARKGREEN ) ); - msg = frame->CoordinateToString( m_Thickness ); - frame->AppendMsgPanel( _( "Thickness" ), msg, MAGENTA ); + msg = ::CoordinateToString( m_Thickness ); + aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, MAGENTA ) ); - msg = frame->CoordinateToString( m_Size.x ); - frame->AppendMsgPanel( _( "Size X" ), msg, RED ); + msg = ::CoordinateToString( m_Size.x ); + aList.push_back( MSG_PANEL_ITEM( _( "Size X" ), msg, RED ) ); - msg = frame->CoordinateToString( m_Size.y ); - frame->AppendMsgPanel( _( "Size Y" ), msg, RED ); + msg = ::CoordinateToString( m_Size.y ); + aList.push_back( MSG_PANEL_ITEM( _( "Size Y" ), msg, RED ) ); } diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index 0fd8d1d988..b8ed08806b 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -37,6 +37,7 @@ class LINE_READER; class EDA_DRAW_PANEL; +class MSG_PANEL_ITEM; class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT @@ -73,7 +74,7 @@ public: void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool HitTest( const wxPoint& aPosition ) { diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 325660ce70..2c279fd6a5 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include @@ -355,7 +357,7 @@ int TEXTE_MODULE::GetDrawRotation() const // see class_text_mod.h -void TEXTE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) +void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { MODULE* module = (MODULE*) m_Parent; @@ -370,50 +372,55 @@ void TEXTE_MODULE::DisplayInfo( EDA_DRAW_FRAME* frame ) _( "Ref." ), _( "Value" ), _( "Text" ) }; - frame->ClearMsgPanel(); - Line = module->m_Reference->m_Text; - frame->AppendMsgPanel( _( "Module" ), Line, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Module" ), Line, DARKCYAN ) ); Line = m_Text; - frame->AppendMsgPanel( _( "Text" ), Line, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) ); ii = m_Type; + if( ii > 2 ) ii = 2; - frame->AppendMsgPanel( _( "Type" ), text_type_msg[ii], DARKGREEN ); + + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[ii], DARKGREEN ) ); if( m_NoShow ) msg = _( "No" ); else msg = _( "Yes" ); - frame->AppendMsgPanel( _( "Display" ), msg, DARKGREEN ); + + aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) ); // Display text layer (use layer name if possible) BOARD* board = NULL; board = (BOARD*) module->GetParent(); + if( m_Layer < NB_LAYERS && board ) msg = board->GetLayerName( m_Layer ); else msg.Printf( wxT( "%d" ), m_Layer ); - frame->AppendMsgPanel( _( "Layer" ), msg, DARKGREEN ); + + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, DARKGREEN ) ); msg = _( " No" ); + if( m_Mirror ) msg = _( " Yes" ); - frame->AppendMsgPanel( _( "Mirror" ), msg, DARKGREEN ); + + aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); - frame->AppendMsgPanel( _( "Orient" ), msg, DARKGREEN ); + aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, DARKGREEN ) ); - msg = frame->CoordinateToString( m_Thickness ); - frame->AppendMsgPanel( _( "Thickness" ), msg, DARKGREEN ); + msg = ::CoordinateToString( m_Thickness ); + aList.push_back( MSG_PANEL_ITEM( _( "Thickness" ), msg, DARKGREEN ) ); - msg = frame->CoordinateToString( m_Size.x ); - frame->AppendMsgPanel( _( "H Size" ), msg, RED ); + msg = ::CoordinateToString( m_Size.x ); + aList.push_back( MSG_PANEL_ITEM( _( "H Size" ), msg, RED ) ); - msg = frame->CoordinateToString( m_Size.y ); - frame->AppendMsgPanel( _( "V Size" ), msg, RED ); + msg = ::CoordinateToString( m_Size.y ); + aList.push_back( MSG_PANEL_ITEM( _( "V Size" ), msg, RED ) ); } diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 590a0a965b..ca28460ea0 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -39,8 +39,8 @@ class LINE_READER; class EDA_RECT; class EDA_DRAW_PANEL; -class EDA_DRAW_FRAME; class MODULE; +class MSG_PANEL_ITEM; #define TEXT_is_REFERENCE 0 @@ -136,7 +136,7 @@ public: GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); bool HitTest( const wxPoint& aPosition ); diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index f1cbb8f2ff..d40babc2b7 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -44,6 +44,8 @@ #include #include #include +#include + /** * Function ShowClearance @@ -957,30 +959,30 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // see class_track.h -void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame ) +void TRACK::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; - BOARD* board = ( (PCB_BASE_FRAME*) frame )->GetBoard(); + BOARD* board = GetBoard(); // Display basic infos - DisplayInfoBase( frame ); + GetMsgPanelInfoBase( aList ); // Display full track length (in Pcbnew) - if( frame->IsType( PCB_FRAME_TYPE ) ) + if( board ) { double trackLen = 0; double lenPadToDie = 0; board->MarkTrace( this, NULL, &trackLen, &lenPadToDie, false ); - msg = frame->CoordinateToString( trackLen ); - frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN ); + msg = ::CoordinateToString( trackLen ); + aList.push_back( MSG_PANEL_ITEM( _( "Track Len" ), msg, DARKCYAN ) ); if( lenPadToDie != 0 ) { - msg = frame->LengthDoubleToString( trackLen + lenPadToDie ); - frame->AppendMsgPanel( _( "Full Len" ), msg, DARKCYAN ); + msg = ::LengthDoubleToString( trackLen + lenPadToDie ); + aList.push_back( MSG_PANEL_ITEM( _( "Full Len" ), msg, DARKCYAN ) ); - msg = frame->LengthDoubleToString( lenPadToDie ); - frame->AppendMsgPanel( _( "In Package" ), msg, DARKCYAN ); + msg = ::LengthDoubleToString( lenPadToDie ); + aList.push_back( MSG_PANEL_ITEM( _( "In Package" ), msg, DARKCYAN ) ); } } @@ -988,54 +990,53 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame ) if( netclass ) { - frame->AppendMsgPanel( _( "NC Name" ), netclass->GetName(), DARKMAGENTA ); - frame->AppendMsgPanel( _( "NC Clearance" ), - frame->CoordinateToString( netclass->GetClearance(), true ), - DARKMAGENTA ); - frame->AppendMsgPanel( _( "NC Width" ), - frame->CoordinateToString( netclass->GetTrackWidth(), true ), - DARKMAGENTA ); - frame->AppendMsgPanel( _( "NC Via Size"), - frame->CoordinateToString( netclass->GetViaDiameter(), true ), - DARKMAGENTA ); - frame->AppendMsgPanel( _( "NC Via Drill"), - frame->CoordinateToString( netclass->GetViaDrill(), true ), - DARKMAGENTA ); + aList.push_back( MSG_PANEL_ITEM( _( "NC Name" ), netclass->GetName(), DARKMAGENTA ) ); + aList.push_back( MSG_PANEL_ITEM( _( "NC Clearance" ), + ::CoordinateToString( netclass->GetClearance(), true ), + DARKMAGENTA ) ); + aList.push_back( MSG_PANEL_ITEM( _( "NC Width" ), + ::CoordinateToString( netclass->GetTrackWidth(), true ), + DARKMAGENTA ) ); + aList.push_back( MSG_PANEL_ITEM( _( "NC Via Size" ), + ::CoordinateToString( netclass->GetViaDiameter(), true ), + DARKMAGENTA ) ); + aList.push_back( MSG_PANEL_ITEM( _( "NC Via Drill"), + ::CoordinateToString( netclass->GetViaDrill(), true ), + DARKMAGENTA ) ); } } -void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) +void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; - BOARD* board = ( (PCB_BASE_FRAME*) frame )->GetBoard(); - - frame->ClearMsgPanel(); + BOARD* board = GetBoard(); switch( Type() ) { case PCB_VIA_T: switch( GetShape() ) { - default: - case 0: - msg = _( "??? Via" ); // Not used yet, does not exist currently - break; + default: + case 0: + msg = _( "??? Via" ); // Not used yet, does not exist currently + break; - case 1: - msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from - // the near neighbor inner layer only - break; + case 1: + msg = _( "Micro Via" ); // from external layer (TOP or BOTTOM) from + // the near neighbor inner layer only + break; - case 2: - msg = _( "Blind/Buried Via" ); // from inner or external to inner - // or external layer (no restriction) - break; + case 2: + msg = _( "Blind/Buried Via" ); // from inner or external to inner + // or external layer (no restriction) + break; - case 3: - msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only ) - break; + case 3: + msg = _( "Through Via" ); // Usual via (from TOP to BOTTOM layer only ) + break; } + break; case PCB_TRACE_T: @@ -1051,10 +1052,10 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) break; } - frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); // Display Net Name (in Pcbnew) - if( frame->IsType( PCB_FRAME_TYPE ) ) + if( board ) { NETINFO_ITEM* net = board->FindNet( GetNet() ); @@ -1063,36 +1064,36 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) else msg = wxT( "" ); - frame->AppendMsgPanel( _( "NetName" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) ); /* Display net code : (useful in test or debug) */ msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() ); - frame->AppendMsgPanel( _( "NetCode" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); } #if defined(DEBUG) // Display the flags msg.Printf( wxT( "0x%08X" ), m_Flags ); - frame->AppendMsgPanel( wxT( "Flags" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( wxT( "Flags" ), msg, BLUE ) ); #if 0 // Display start and end pointers: msg.Printf( wxT( "%p" ), start ); - frame->AppendMsgPanel( wxT( "start ptr" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( wxT( "start ptr" ), msg, BLUE ) ); msg.Printf( wxT( "%p" ), end ); - frame->AppendMsgPanel( wxT( "end ptr" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( wxT( "end ptr" ), msg, BLUE ) ); // Display this ptr msg.Printf( wxT( "%p" ), this ); - frame->AppendMsgPanel( wxT( "this" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( wxT( "this" ), msg, BLUE ) ); #endif #if 0 // Display start and end positions: msg.Printf( wxT( "%d %d" ), m_Start.x, m_Start.y ); - frame->AppendMsgPanel( wxT( "Start pos" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( wxT( "Start pos" ), msg, BLUE ) ); msg.Printf( wxT( "%d %d" ), m_End.x, m_End.y ); - frame->AppendMsgPanel( wxT( "End pos" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( wxT( "End pos" ), msg, BLUE ) ); #endif #endif // defined(DEBUG) @@ -1106,7 +1107,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) if( GetState( TRACK_AR ) ) msg[2] = 'A'; - frame->AppendMsgPanel( _( "Status" ), msg, MAGENTA ); + aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) ); /* Display layer or layer pair) */ if( Type() == PCB_VIA_T ) @@ -1122,20 +1123,20 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) msg = board->GetLayerName( m_Layer ); } - frame->AppendMsgPanel( _( "Layer" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) ); /* Display width */ - msg = frame->CoordinateToString( (unsigned) m_Width ); + msg = ::CoordinateToString( (unsigned) m_Width ); if( Type() == PCB_VIA_T ) // Display Diam and Drill values { // Display diameter value: - frame->AppendMsgPanel( _( "Diam" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Diam" ), msg, DARKCYAN ) ); // Display drill value int drill_value = GetDrillValue(); - msg = frame->CoordinateToString( (unsigned) drill_value ); + msg = ::CoordinateToString( (unsigned) drill_value ); wxString title = _( "Drill" ); title += wxT( " " ); @@ -1145,18 +1146,18 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) else title += _( "(Default)" ); - frame->AppendMsgPanel( title, msg, RED ); + aList.push_back( MSG_PANEL_ITEM( title, msg, RED ) ); } else { - frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) ); } // Display segment length if( Type() != PCB_VIA_T ) // Display Diam and Drill values { - msg = frame->LengthDoubleToString( GetLength() ); - frame->AppendMsgPanel( _( "Segment Length" ), msg, DARKCYAN ); + msg = ::LengthDoubleToString( GetLength() ); + aList.push_back( MSG_PANEL_ITEM( _( "Segment Length" ), msg, DARKCYAN ) ); } } diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 211573e5b6..631a9479a3 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -38,6 +38,8 @@ class TRACK; class D_PAD; +class MSG_PANEL_ITEM; + // Via attributes (m_Shape parameter) #define VIA_THROUGH 3 /* Always a through hole via */ @@ -239,16 +241,14 @@ public: */ bool IsNull(); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); /** - * Function DisplayInfoBase - * has knowledge about the frame and how and where to put status information - * about this object into the frame's message panel. + * Function GetMsgPanelInfoBase * Display info about the track segment only, and does not calculate the full track length - * @param frame A EDA_DRAW_FRAME in which to print status information. + * @param aList A list of #MSG_PANEL_ITEM objects to add status information. */ - void DisplayInfoBase( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ); /** * Function ShowWidth diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 332154b6ae..5f08b747d2 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -629,7 +630,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) const } -void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame ) +void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) { wxString msg; @@ -637,8 +638,6 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame ) wxASSERT( board ); - frame->ClearMsgPanel(); - msg = _( "Zone Outline" ); // Display Cutout instead of Outline for holes inside a zone @@ -648,33 +647,38 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame ) if( ncont ) msg << wxT( " " ) << _( "(Cutout)" ); - frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), msg, DARKCYAN ) ); if( GetIsKeepout() ) { msg.Empty(); + if( GetDoNotAllowVias() ) msg = _("No via"); + if( GetDoNotAllowTracks() ) { if( !msg.IsEmpty() ) msg += wxT(", "); + msg += _("No track"); } + if( GetDoNotAllowCopperPour() ) { if( !msg.IsEmpty() ) msg += wxT(", "); + msg += _("No copper pour"); } - frame->AppendMsgPanel( _( "Keepout" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) ); } else if( IsOnCopperLayer() ) { if( GetNet() >= 0 ) { - NETINFO_ITEM* equipot = ( (PCB_BASE_FRAME*) frame )->GetBoard()->FindNet( GetNet() ); + NETINFO_ITEM* equipot = board->FindNet( GetNet() ); if( equipot ) msg = equipot->GetNetname(); @@ -688,43 +692,44 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame ) msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" ); } - frame->AppendMsgPanel( _( "NetName" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) ); + #if 1 // Display net code : (useful in test or debug) msg.Printf( wxT( "%d" ), GetNet() ); - frame->AppendMsgPanel( _( "NetCode" ), msg, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); #endif // Display priority level msg.Printf( wxT( "%d" ), GetPriority() ); - frame->AppendMsgPanel( _( "Priority" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Priority" ), msg, BLUE ) ); } else { - frame->AppendMsgPanel( _( "Non Copper Zone" ), wxEmptyString, RED ); + aList.push_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) ); } msg = board->GetLayerName( m_Layer ); - frame->AppendMsgPanel( _( "Layer" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) ); msg.Printf( wxT( "%d" ), (int) m_Poly->m_CornersList.size() ); - frame->AppendMsgPanel( _( "Corners" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) ); if( m_FillMode ) msg = _( "Segments" ); else msg = _( "Polygons" ); - frame->AppendMsgPanel( _( "Fill mode" ), msg, BROWN ); + aList.push_back( MSG_PANEL_ITEM( _( "Fill mode" ), msg, BROWN ) ); // Useful for statistics : msg.Printf( wxT( "%d" ), (int) m_Poly->m_HatchLines.size() ); - frame->AppendMsgPanel( _( "Hatch lines" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Hatch lines" ), msg, BLUE ) ); if( m_FilledPolysList.size() ) { msg.Printf( wxT( "%d" ), (int) m_FilledPolysList.size() ); - frame->AppendMsgPanel( _( "Corners in DrawList" ), msg, BLUE ); + aList.push_back( MSG_PANEL_ITEM( _( "Corners in DrawList" ), msg, BLUE ) ); } } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 40597b1c96..3a697bc205 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -42,11 +42,12 @@ class EDA_RECT; class LINE_READER; -class EDA_DRAW_FRAME; class EDA_DRAW_PANEL; class PCB_EDIT_FRAME; class BOARD; class ZONE_CONTAINER; +class MSG_PANEL_ITEM; + /** * Struct SEGMENT @@ -109,7 +110,7 @@ public: */ void Copy( ZONE_CONTAINER* src ); - void DisplayInfo( EDA_DRAW_FRAME* frame ); + void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); /** * Function Draw diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 8fbea30913..a9a4bb78a5 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -131,9 +131,9 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) SaveCopyInUndoList( aTrack, UR_DELETED ); OnModify(); - TestNetConnection( DC, current_net_code ); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); + return NULL; } @@ -185,7 +185,7 @@ void PCB_EDIT_FRAME::Delete_net( wxDC* DC, TRACK* aTrack ) SaveCopyInUndoList( itemsList, UR_DELETED ); OnModify(); TestNetConnection( DC, net_code_delete ); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); } diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index acb3c3925f..6dddab0eee 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -236,7 +236,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) if( m_DC ) m_Item->Draw( m_parent->GetCanvas(), m_DC, GR_OR ); - m_Item->DisplayInfo( m_parent ); + m_parent->SetMsgPanel( m_Item ); m_parent->SetDesignSettings( m_brdSettings ); diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index f97a9ed2e9..677a3ff7cc 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -245,7 +245,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) } m_parent->OnModify(); - m_item->DisplayInfo( m_parent ); + m_parent->SetMsgPanel( m_item ); Close( true ); } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 6ad3813afa..03394f051a 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -832,7 +832,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) m_CurrentPad->SetThermalGap( m_Pad_Master.GetThermalGap() ); module->CalculateBoundingBox(); - m_CurrentPad->DisplayInfo( m_Parent ); + m_Parent->SetMsgPanel( m_CurrentPad ); // redraw the area where the pad was m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentPad->GetBoundingBox() ); diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index 145b481bc8..701411e2e4 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -381,7 +381,7 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC ) aItem->Draw( m_canvas, DC, GR_XOR ); aItem->SetFlags( IS_MOVED ); - aItem->DisplayInfo( this ); + SetMsgPanel( aItem ); GetScreen()->SetCrossHairPosition( aItem->m_Text.m_Pos ); m_canvas->MoveCursorToCrossHair(); diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index c690c2c70e..f9b14794d3 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -132,7 +132,7 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) { wxASSERT( m_currentMarker ); - m_currentMarker->DisplayInfo( m_mainWindow ); + m_mainWindow->SetMsgPanel( m_currentMarker ); return BAD_DRC; } @@ -140,7 +140,7 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) { wxASSERT( m_currentMarker ); - m_currentMarker->DisplayInfo( m_mainWindow ); + m_mainWindow->SetMsgPanel( m_currentMarker ); return BAD_DRC; } @@ -165,7 +165,7 @@ int DRC::Drc( ZONE_CONTAINER* aArea, int aCornerIndex ) if( !doEdgeZoneDrc( aArea, aCornerIndex ) ) { wxASSERT( m_currentMarker ); - m_currentMarker->DisplayInfo( m_mainWindow ); + m_mainWindow->SetMsgPanel( m_currentMarker ); return BAD_DRC; } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index e9299160d1..1c22f54867 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -467,7 +467,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) SetCurItem( NULL ); TestNetConnection( NULL, netcode ); OnModify(); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); } break; @@ -503,7 +503,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() ); SetCurItem( NULL ); TestNetConnection( NULL, netcode ); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); } break; @@ -572,7 +572,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->MoveCursorToCrossHair(); Fill_All_Zones( this ); m_canvas->Refresh(); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); break; case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE: @@ -582,7 +582,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) zone_container->UnFill(); TestNetConnection( NULL, zone_container->GetNet() ); OnModify(); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); m_canvas->Refresh(); } SetCurItem( NULL ); @@ -602,7 +602,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) TestConnections(); TestForActiveLinksInRatsnest( 0 ); // Recalculate the active ratsnest, i.e. the unconnected links OnModify(); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); m_canvas->Refresh(); break; @@ -610,7 +610,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->MoveCursorToCrossHair(); Fill_Zone( (ZONE_CONTAINER*) GetCurItem() ); TestNetConnection( NULL, ( (ZONE_CONTAINER*) GetCurItem() )->GetNet() ); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); m_canvas->Refresh(); break; @@ -1177,7 +1177,7 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) int netcode = ( (ZONE_CONTAINER*) Item )->GetNet(); Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item ); TestNetConnection( NULL, netcode ); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); } break; diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index 0e88051fb6..3663160c7a 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -140,7 +140,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE s_TextCopy.Copy( aTextePcb ); aTextePcb->SetFlags( IS_MOVED ); - aTextePcb->DisplayInfo( this ); + SetMsgPanel( aTextePcb ); #ifdef USE_WX_OVERLAY m_canvas->Refresh(); @@ -248,7 +248,7 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) /* Redraw text in new position. */ TextePcb->Draw( m_canvas, DC, GR_XOR ); - TextePcb->DisplayInfo( this ); + SetMsgPanel( TextePcb ); if( TextePcb->GetFlags() == 0 ) // i.e. not edited, or moved SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetPosition() ); @@ -272,7 +272,7 @@ void PCB_EDIT_FRAME::FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC ) aTextePcb->Flip( aTextePcb->GetPosition() ); aTextePcb->Draw( m_canvas, aDC, GR_XOR ); - aTextePcb->DisplayInfo( this ); + SetMsgPanel( aTextePcb ); if( aTextePcb->GetFlags() == 0 ) // i.e. not edited, or moved SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetPosition() ); diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 9969e83e2d..acfba3530a 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -61,7 +61,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) drawitem->Draw( m_canvas, DC, GR_XOR ); drawitem->SetFlags( IS_MOVED ); s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition(); - drawitem->DisplayInfo( this ); + SetMsgPanel( drawitem ); m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge ); SetCurItem( drawitem ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 467cb6b999..69cc6e047f 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -166,7 +166,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) // Refresh DRC diag, erased by previous calls if( m_drc->GetCurrentMarker() ) - m_drc->GetCurrentMarker()->DisplayInfo( this ); + SetMsgPanel( m_drc->GetCurrentMarker() ); return false; } @@ -209,8 +209,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) } m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); - via->DisplayInfo( this ); - + SetMsgPanel( via ); UpdateStatusBar(); return true; @@ -238,7 +237,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) if( pt_pad ) // Displaying the ratsnest of the corresponding net. { - pt_pad->DisplayInfo( this ); + SetMsgPanel( pt_pad ); for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ ) { @@ -272,7 +271,7 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) if( Module ) { - Module->DisplayInfo( this ); + SetMsgPanel( Module ); pt_pad = Module->m_Pads; for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() ) diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index df7d6192b2..5ef5a2d99c 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -201,7 +201,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) D( g_CurrentTrackList.VerifyListIntegrity(); ); - g_CurrentTrackSegment->DisplayInfoBase( this ); + SetMsgPanel( g_CurrentTrackSegment ); SetCurItem( g_CurrentTrackSegment, false ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false ); @@ -510,7 +510,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) // compute the new ratsnest TestNetConnection( aDC, netcode ); OnModify(); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); // Redraw the entire new track. DrawTraces( m_canvas, aDC, firstTrack, newCount, GR_OR ); @@ -785,7 +785,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo isegm = g_CurrentTrackSegment->Back(); // display interesting segment info only: - isegm->DisplayInfoBase( frame ); + frame->SetMsgPanel( isegm ); // Display current track length (on board) and the the actual track len // if there is an extra len due to the len die on the starting pad (if any) diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 16851abab6..f408a4841f 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -91,7 +91,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC ) if( DC ) Text->Draw( m_canvas, DC, GR_OR ); - Text->DisplayInfo( this ); + SetMsgPanel( Text ); return Text; } @@ -121,7 +121,7 @@ void PCB_BASE_FRAME::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) Text->m_Orient -= 1800; Text->Draw( m_canvas, DC, GR_XOR, MoveVector ); - Text->DisplayInfo( this ); + SetMsgPanel( Text ); if( module ) module->SetLastEditTime(); @@ -214,8 +214,7 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) GetScreen()->SetCrossHairPosition( TextInitialPosition ); m_canvas->MoveCursorToCrossHair(); - Text->DisplayInfo( this ); - + SetMsgPanel( Text ); SetCurItem( Text ); m_canvas->SetMouseCapture( Show_MoveTexte_Module, AbortMoveTextModule ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, true ); diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index ee5122bf10..12635a60b1 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -403,7 +404,7 @@ the changes?" ) ) ) // Compile ratsnest and displays net info wxBusyCursor dummy; // Displays an Hourglass while building connectivity Compile_Ratsnest( NULL, true ); - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); // Refresh the 3D view, if any if( m_Draw3DFrame ) diff --git a/pcbnew/footprint_wizard.cpp b/pcbnew/footprint_wizard.cpp index 76d590529d..2e24701091 100644 --- a/pcbnew/footprint_wizard.cpp +++ b/pcbnew/footprint_wizard.cpp @@ -215,11 +215,12 @@ void FOOTPRINT_WIZARD_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) MODULE* module = GetBoard()->m_Modules; if ( module ) - module->DisplayInfo( this ); + SetMsgPanel( module ); m_canvas->DrawCrossHair( DC ); ClearMsgPanel(); + if( module ) - module->DisplayInfo( this ); + SetMsgPanel( module ); } diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index 8216f65ea4..2d2c91e0c3 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -34,6 +34,7 @@ #include #include <3d_viewer.h> #include +#include #include #include diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index bf5cd22726..1fc54d3806 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -128,7 +128,7 @@ void PCB_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw ) return; } - module->DisplayInfo( this ); + SetMsgPanel( module ); { DIALOG_GLOBAL_PADS_EDITION dlg( this, aPad ); @@ -172,7 +172,7 @@ void FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad ) return; } - module->DisplayInfo( this ); + SetMsgPanel( module ); { DIALOG_GLOBAL_PADS_EDITION dlg( this, aPad ); diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 2a95277d1c..658aa8ea06 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -509,7 +509,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit SetCurItem( module ); module->SetLocked( !module->IsLocked() ); OnModify(); - module->DisplayInfo( this ); + SetMsgPanel( module ); } break; diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 65d060fd3b..74a1155345 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -267,7 +267,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module() GetBoard()->Add( module ); // Display info : - module->DisplayInfo( this ); + SetMsgPanel( module ); PlaceModule( module, NULL ); GetBoard()->m_Status_Pcb = 0; GetBoard()->BuildListOfNets(); @@ -595,7 +595,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibPath, if( aModule == NULL ) return false; - aModule->DisplayInfo( this ); + SetMsgPanel( aModule ); // Ask what to use as the footprint name in the library wxString footprintName = aModule->GetLibRef(); @@ -739,10 +739,9 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) module->m_Value->m_Text = wxT( "VAL**" ); module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth ); module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize ); - module->SetPosition( wxPoint( 0, 0 ) ); - module->DisplayInfo( this ); + SetMsgPanel( module ); return module; } diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index 74d8a3487e..dbd902054a 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -133,7 +133,7 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode ) if( item ) { - item->DisplayInfo( this ); + SetMsgPanel( item ); } return item; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index bb676a423d..1d3c68581b 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -37,6 +37,7 @@ #include #include <3d_viewer.h> #include +#include #include #include diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 5e1fefc61b..1c3726a502 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -257,7 +257,7 @@ bool PCB_EDIT_FRAME::Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeD if( aModule == NULL ) return false; - aModule->DisplayInfo( this ); + SetMsgPanel( aModule ); /* Confirm module delete. */ if( aAskBeforeDeleting ) @@ -331,7 +331,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) /* Flip the module */ Module->Flip( Module->m_Pos ); - Module->DisplayInfo( this ); + SetMsgPanel( Module ); if( !Module->IsMoving() ) /* Inversion simple */ { @@ -421,7 +421,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat if( aDC ) m_canvas->Refresh(); - aModule->DisplayInfo( this ); + SetMsgPanel( aModule ); } @@ -468,7 +468,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool in else module->SetOrientation( angle ); - module->DisplayInfo( this ); + SetMsgPanel( module ); if( DC ) { diff --git a/pcbnew/modview.cpp b/pcbnew/modview.cpp index b29bef96e3..d2c3498da0 100644 --- a/pcbnew/modview.cpp +++ b/pcbnew/modview.cpp @@ -186,12 +186,10 @@ void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) MODULE* module = GetBoard()->m_Modules; - if ( module ) - module->DisplayInfo( this ); - m_canvas->DrawCrossHair( DC ); ClearMsgPanel(); + if( module ) - module->DisplayInfo( this ); + SetMsgPanel( module ); } diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp index 5b6c2cce39..8deaff7104 100644 --- a/pcbnew/modview_frame.cpp +++ b/pcbnew/modview_frame.cpp @@ -33,6 +33,7 @@ #include #include <3d_viewer.h> #include +#include #include #include diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index 87c2aa685b..31d398c989 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -98,7 +98,7 @@ void PCB_BASE_FRAME::StartMovePad( D_PAD* aPad, wxDC* aDC, bool aDragConnectedTr Pad_OldPos = aPad->GetPosition(); - aPad->DisplayInfo( this ); + SetMsgPanel( aPad ); m_canvas->SetMouseCapture( Show_Pad_Move, Abort_Move_Pad ); // Draw the pad, in SKETCH mode diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index b9e6afb293..b8e71556a1 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -151,7 +151,7 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo if( track ) { PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); - track->DisplayInfo( frame ); + frame->SetMsgPanel( track ); } } @@ -425,7 +425,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC // Display track length PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); - Track->DisplayInfo( frame ); + frame->SetMsgPanel( Track ); } diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index da2d7477fb..1e755a28c8 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -280,7 +280,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) pad->SetPos0( pad->GetPosition() - module->GetPosition() ); // Modify text positions. - module->DisplayInfo( this ); + SetMsgPanel( module ); module->m_Value->m_Pos.x = module->m_Reference->m_Pos.x = ( Mself.m_Start.x + Mself.m_End.x ) / 2; module->m_Value->m_Pos.y = module->m_Reference->m_Pos.y = diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 78e3d610d7..6cb08b2fba 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -190,7 +190,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, Compile_Ratsnest( NULL, true ); } - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); m_canvas->Refresh(); return true; diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index 65cce81f0a..d1c780643a 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -189,13 +190,17 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) int netcode = SelectHighLight( aDC ); if( netcode < 0 ) - GetBoard()->DisplayInfo( this ); + SetMsgPanel( GetBoard() ); else { NETINFO_ITEM* net = GetBoard()->FindNet( netcode ); if( net ) - net->DisplayInfo( this ); + { + MSG_PANEL_ITEMS items; + net->GetMsgPanelInfo( items ); + SetMsgPanel( items ); + } } } break; diff --git a/pcbnew/pad_edition_functions.cpp b/pcbnew/pad_edition_functions.cpp index e319ea9da8..7c728607f8 100644 --- a/pcbnew/pad_edition_functions.cpp +++ b/pcbnew/pad_edition_functions.cpp @@ -47,7 +47,7 @@ void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* aPad ) if( aPad == NULL ) return; - aPad->DisplayInfo( this ); + SetMsgPanel( aPad ); D_PAD& mp = GetDesignSettings().m_Pad_Master; @@ -169,7 +169,7 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw ) GetDesignSettings().m_Pad_Master.SetPadName(lastPadName); aModule->CalculateBoundingBox(); - pad->DisplayInfo( this ); + SetMsgPanel( pad ); if( draw ) m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() ); @@ -249,7 +249,7 @@ void PCB_BASE_FRAME::RotatePad( D_PAD* aPad, wxDC* DC ) aPad->SetDelta( sz ); module->CalculateBoundingBox(); - aPad->DisplayInfo( this ); + SetMsgPanel( aPad ); if( DC ) module->Draw( m_canvas, DC, GR_OR ); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 0afdcad828..dae82a9ad2 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -39,6 +39,7 @@ #include #include #include <3d_viewer.h> +#include #include #include diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp index c85b56b191..607fbf10aa 100644 --- a/pcbnew/ratsnest.cpp +++ b/pcbnew/ratsnest.cpp @@ -169,7 +169,7 @@ void PCB_BASE_FRAME::Compile_Ratsnest( wxDC* aDC, bool aDisplayStatus ) DrawGeneralRatsnest( aDC, 0 ); if( aDisplayStatus ) - m_Pcb->DisplayInfo( this ); + SetMsgPanel( m_Pcb ); }