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 435a34cd60
commit 7481dcf520
110 changed files with 897 additions and 657 deletions
+26 -1
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 );