7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 12:30:14 +00:00

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.
This commit is contained in:
Wayne Stambaugh 2013-01-12 12:32:24 -05:00
parent 5c2efcbf3e
commit f8a56d446f
110 changed files with 897 additions and 657 deletions
common
cvpcb
eeschema
gerbview
include
pcbnew

View File

@ -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,

View File

@ -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 );

View File

@ -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 );
}

View File

@ -34,6 +34,7 @@
#include <confirm.h>
#include <macros.h>
#include <bitmaps.h>
#include <msgpanel.h>
#include <class_board.h>

View File

@ -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 );
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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 );
}

View File

@ -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;

View File

@ -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 ) );
}

View File

@ -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;

View File

@ -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 ) );
}

View File

@ -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;

View File

@ -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 ) );
}

View File

@ -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 ) );

View File

@ -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 ) );
}

View File

@ -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.

View File

@ -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 ) );
}

View File

@ -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 );

View File

@ -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 ) );
}

View File

@ -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 );

View File

@ -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 ) );
}

View File

@ -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 ) );

View File

@ -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 ) );
}

View File

@ -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 ) );

Some files were not shown because too many files have changed in this diff Show More