Commit f8a56d44 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Base object decoupling improvements.

* Improve MSG_PANEL_ITEM to handle message panel information.
* Create containers for passing message panel items between objects and
  the message panel.
* Rename EDA_ITEM::DisplayInfo to EDA_ITEM::GetMsgPanelInfo.
* Remove all direct manipulation of EDA_DRAW_FRAME from all objects derived
  from EDA_ITEM.
parent 5c2efcbf
......@@ -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,
......
......@@ -36,6 +36,7 @@
#include <id.h>
#include <class_drawpanel.h>
#include <class_base_screen.h>
#include <msgpanel.h>
#include <wxstruct.h>
#include <confirm.h>
#include <kicad_device_context.h>
......@@ -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 );
......
......@@ -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 <fctsys.h>
#include <wxstruct.h>
#include <common.h>
#include <colors.h>
#include <msgpanel.h>
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<m_Items.size(); ++i )
showItem( dc, m_Items[i] );
event.Skip();
aEvent.Skip();
}
void EDA_MSG_PANEL::AppendMessage( const wxString& textUpper,
const wxString& textLower,
EDA_COLOR_T color, int pad )
void EDA_MSG_PANEL::AppendMessage( const wxString& aUpperText,
const wxString& aLowerText,
EDA_COLOR_T aColor, int aPad )
{
wxString text;
wxSize drawSize = GetClientSize();
text = ( textUpper.Len() > 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 );
}
......@@ -34,6 +34,7 @@
#include <confirm.h>
#include <macros.h>
#include <bitmaps.h>
#include <msgpanel.h>
#include <class_board.h>
......
......@@ -7,6 +7,7 @@
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <bitmaps.h>
#include <msgpanel.h>
#include <class_board.h>
#include <class_module.h>
......@@ -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 );
}
......
......@@ -33,6 +33,7 @@
#include <eda_dde.h>
#include <wxEeschemaStruct.h>
#include <menus_helpers.h>
#include <msgpanel.h>
#include <eeschema_id.h>
#include <general.h>
......@@ -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;
}
......
......@@ -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);
}
......@@ -33,6 +33,7 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <wxEeschemaStruct.h>
#include <msgpanel.h>
#include <general.h>
#include <class_library.h>
......@@ -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 );
}
......
......@@ -35,6 +35,7 @@
#include <confirm.h>
#include <wxEeschemaStruct.h>
#include <kicad_device_context.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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;
......
......@@ -35,6 +35,7 @@
#include <wxstruct.h>
#include <richio.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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 ) );
}
......
......@@ -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;
......
......@@ -35,6 +35,7 @@
#include <bezier_curves.h>
#include <richio.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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 ) );
}
......@@ -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;
......
......@@ -36,6 +36,7 @@
#include <wxstruct.h>
#include <richio.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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 ) );
}
......
......@@ -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 ) );
......
......@@ -30,6 +30,7 @@
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <wxstruct.h>
#include <msgpanel.h>
#include <protos.h>
#include <general.h>
......@@ -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 ) );
}
......
......@@ -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.
* <p>
......@@ -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.
* </p>
* @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.
......
......@@ -37,6 +37,7 @@
#include <plot_common.h>
#include <trigo.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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 ) );
}
......@@ -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 );
......
......@@ -37,6 +37,7 @@
#include <wxEeschemaStruct.h>
#include <richio.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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 ) );
}
......
......@@ -31,6 +31,7 @@
#include <lib_draw_item.h>
#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 );
......
......@@ -35,6 +35,7 @@
#include <wxstruct.h>
#include <richio.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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 ) );
}
......
......@@ -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 ) );
......
......@@ -35,6 +35,7 @@
#include <wxstruct.h>
#include <richio.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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 ) );
}
......
......@@ -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 ) );
......
......@@ -35,6 +35,7 @@
#include <wxstruct.h>
#include <richio.h>
#include <base_units.h>
#include <msgpanel.h>
#include <lib_draw_item.h>
#include <general.h>
......@@ -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 ) );
}
......
......@@ -32,6 +32,7 @@
#include <eda_text.h>
#include <lib_draw_item.h>
/**
* 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;
......
......@@ -31,6 +31,7 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <eeschema_id.h>
#include <msgpanel.h>
#include <general.h>
#include <libeditframe.h>
......@@ -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;
......
......@@ -32,6 +32,7 @@
#include <hotkeys.h>
#include <class_drawpanel.h>
#include <class_sch_screen.h>
#include <msgpanel.h>
#include <general.h>
#include <libeditframe.h>
......@@ -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();
......
......@@ -35,6 +35,7 @@
#include <eda_doc.h>
#include <gr_basic.h>
#include <wxEeschemaStruct.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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;
}
......
......@@ -34,6 +34,7 @@
#include <confirm.h>
#include <class_sch_screen.h>
#include <base_units.h>
#include <msgpanel.h>
#include <libeditframe.h>
#include <eeschema_id.h>
......@@ -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( );
}
......
......@@ -36,6 +36,7 @@
#include <richio.h>
#include <wxEeschemaStruct.h>
#include <plot_common.h>
#include <msgpanel.h>
#include <general.h>
#include <class_library.h>
......@@ -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 ) );
}
......
......@@ -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.
......
......@@ -31,6 +31,7 @@
#include <wxstruct.h>
#include <class_drawpanel.h>
#include <trigo.h>
#include <msgpanel.h>
#include <general.h>
#include <sch_marker.h>
......@@ -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 ) );
}
......
......@@ -33,6 +33,7 @@
#include <sch_item_struct.h>
#include <class_marker_base.h>
/* 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 );
......
......@@ -35,6 +35,7 @@
#include <wxEeschemaStruct.h>
#include <plot_common.h>
#include <kicad_string.h>
#include <msgpanel.h>
#include <general.h>
#include <sch_sheet.h>
......@@ -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
}
......
......@@ -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
......
......@@ -37,6 +37,7 @@
#include <wxEeschemaStruct.h>
#include <plot_common.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <protos.h>
......@@ -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)
......
......@@ -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
......
......@@ -33,6 +33,7 @@
#include <gestfich.h>
#include <confirm.h>
#include <base_units.h>
#include <msgpanel.h>
#include <general.h>
#include <eeschema_id.h>
......
......@@ -34,6 +34,7 @@
#include <confirm.h>
#include <class_sch_screen.h>
#include <base_units.h>
#include <msgpanel.h>
#include <eeschema_id.h>
#include <general.h>
......@@ -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();
}
......
......@@ -32,6 +32,7 @@
#include <eeschema_id.h>
#include <class_drawpanel.h>
#include <wxEeschemaStruct.h>
#include <msgpanel.h>
#include <general.h>
#include <viewlib_frame.h>
......
......@@ -33,6 +33,7 @@
#include <trigo.h>
#include <class_drawpanel.h>
#include <macros.h>
#include <msgpanel.h>
#include <gerbview.h>
#include <class_gerber_draw_item.h>
......@@ -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 ) );
}
......
......@@ -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();
......
......@@ -35,6 +35,7 @@
#include <base_units.h>
#include <colors_selection.h>
#include <class_gbr_layer_box_selector.h>
#include <msgpanel.h>
#include <gerbview.h>
#include <class_gerber_draw_item.h>
......@@ -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.
......
......@@ -28,9 +28,12 @@
#include <fctsys.h>
#include <common.h>
#include <msgpanel.h>
#include <gerbview.h>
#include <class_gerber_draw_item.h>
/* 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;
}
......
......@@ -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
}
/**
......
......@@ -35,7 +35,7 @@
#include <base_struct.h>
#include <gr_basic.h>
class EDA_DRAW_FRAME;
class BASE_SCREEN;
class PCB_SCREEN;
......
/*
* 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 <stambaughw@verizon.net>
* 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 <colors.h>
#include <wx/window.h>
#include <vector>
#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_ITEM> 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_
......@@ -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<EDA_MSG_ITEM> 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.
*
......
......@@ -33,6 +33,7 @@
#include <class_drawpanel.h>
#include <gr_basic.h>
#include <wxPcbStruct.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <protos.h>
......@@ -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 );
}
......
......@@ -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
......
......@@ -38,6 +38,7 @@
#include <gr_basic.h>
#include <macros.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <protos.h>
#include <autorout.h>
......@@ -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. */
......
......@@ -34,6 +34,7 @@
#include <class_drawpanel.h>
#include <wxPcbStruct.h>
#include <gr_basic.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <cell.h>
......
......@@ -37,6 +37,7 @@
#include <kicad_device_context.h>
#include <wxBasePcbFrame.h>
#include <base_units.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
......@@ -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";
......
......@@ -38,6 +38,7 @@
#include <kicad_string.h>
#include <pcbcommon.h>
#include <wxBasePcbFrame.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <colors_selection.h>
......@@ -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 ) );
}
}
......
......@@ -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.
......
......@@ -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 );
}
......
......@@ -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 );
......
......@@ -41,6 +41,7 @@
#include <trigo.h>
#include <richio.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <protos.h>
......@@ -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 ) );
}
......
......@@ -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;
......
......@@ -42,6 +42,8 @@
#include <macros.h>
#include <wxBasePcbFrame.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <base_units.h>
#include <class_board.h>
#include <class_module.h>
......@@ -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 ) );
}
......
......@@ -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
{
......
......@@ -33,6 +33,7 @@
#include <class_drawpanel.h>
#include <wxstruct.h>
#include <trigo.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <class_marker_pcb.h>
......@@ -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 ) );
}
......
......@@ -11,6 +11,9 @@
#include <class_marker_base.h>
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;
......
......@@ -44,6 +44,7 @@
#include <filter_reader.h>
#include <macros.h>
#include <3d_struct.h>
#include <msgpanel.h>
#include <drag.h>
#include <class_board.h>
......@@ -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 ) );
}
......
......@@ -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 );
......
......@@ -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 );
};
......
......@@ -37,6 +37,8 @@
#include <colors_selection.h>
#include <richio.h>
#include <macros.h>
#include <msgpanel.h>
#include <base_units.h>
#include <class_board.h>
#include <class_module.h>
......@@ -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 ) );
}
......
......@@ -38,6 +38,8 @@
#include <richio.h>
#include <wxstruct.h>
#include <macros.h>
#include <msgpanel.h>
#include <base_units.h>
#include <pcbnew.h>
#include <pcbnew_id.h> // 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 ) );
}
}
......
......@@ -38,11 +38,13 @@
#include <param_config.h> // 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;
......
......@@ -40,6 +40,8 @@
#include <richio.h>
#include <class_drawpanel.h>
#include <macros.h>
#include <msgpanel.h>
#include <base_units.h>
#include <class_board.h>
#include <class_pcb_text.h>
......@@ -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();
wxASSERT( board );
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 ) );
}
......
......@@ -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 )
{
......
......@@ -40,6 +40,8 @@
#include <richio.h>
#include <macros.h>
#include <wxBasePcbFrame.h>
#include <msgpanel.h>
#include <base_units.h>
#include <class_board.h>
#include <class_module.h>
......@@ -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 ) );
}
......
......@@ -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 );
......
......@@ -44,6 +44,8 @@
#include <class_track.h>
#include <pcbnew.h>
#include <base_units.h>
#include <msgpanel.h>
/**
* 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( "<noname>" );
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 ) );
}
}
......
......@@ -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
......
......@@ -39,6 +39,7 @@
#include <richio.h>
#include <macros.h>
#include <wxBasePcbFrame.h>
#include <msgpanel.h>
#include <protos.h>
#include <class_board.h>
......@@ -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 ) );
}
}
......
......@@ -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
......
......@@ -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() );
}
......
......@@ -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 );
......
......@@ -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 );
}
......@@ -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() );
......
......@@ -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();
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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() );
......
......@@ -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 );
......
......@@ -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() )
......
......@@ -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)
......
......@@ -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 );
......
......@@ -40,6 +40,7 @@
#include <richio.h>
#include <filter_reader.h>
#include <appl_wxstruct.h>
#include <msgpanel.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
......@@ -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 )
......
......@@ -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 );
}
......@@ -34,6 +34,7 @@
#include <wxPcbStruct.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <class_board.h>
#include <class_module.h>
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -133,7 +133,7 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
if( item )
{
item->DisplayInfo( this );
SetMsgPanel( item );
}
return item;
......
......@@ -37,6 +37,7 @@
#include <dialog_helpers.h>
#include <3d_viewer.h>
#include <pcbcommon.h>
#include <msgpanel.h>
#include <class_board.h>
#include <class_module.h>
......
......@@ -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 )
{
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment