Commit 7e24e438 authored by stambaughw's avatar stambaughw

wxWidgets 2.9 string fixes and other minor updates.

* Replace all known instances of (const wxChar*) casts to GetChars() for
  wxWidgets 2.9 compatibility.
* Cleaned up get component dialog so last part gets saved on wild card
  selections.
* Remove redundant schematic component drawing code.
* Added SCH_COMPONENT constructor to create new component from library
  component object.
* Add message panel helpers to WinEDA_DrawFrame and update old message
  panel access code.
* Using library viewer to add component to schematic now respects unit
  and body style selection.
parent 64032f34
/*********************************/ /*********************************/
/* get_component_dialog.cpp */ /* get_component_dialog.cpp */
/*********************************/ /*********************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "common.h" #include "common.h"
#include "macros.h" #include "macros.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "get_component_dialog.h"
/****************************************************************************/ /****************************************************************************/
...@@ -15,46 +16,7 @@ ...@@ -15,46 +16,7 @@
/****************************************************************************/ /****************************************************************************/
static unsigned s_HistoryMaxCount = 8; // Max number of items displayed in history list static unsigned s_HistoryMaxCount = 8; // Max number of items displayed in history list
static wxString s_ItemName;
enum selcmp_id {
ID_ACCEPT_NAME = 3900,
ID_ACCEPT_KEYWORD,
ID_ENTER_NAME,
ID_CANCEL,
ID_LIST_ALL,
ID_EXTRA_TOOL,
ID_SEL_BY_LISTBOX
};
/***************************************/
class WinEDA_SelectCmp : public wxDialog
/***************************************/
{
private:
WinEDA_DrawFrame* m_Parent;
bool m_AuxTool;
wxString* m_Text;
wxTextCtrl* m_TextCtrl;
wxListBox* m_List;
public:
bool m_GetExtraFunction;
public:
// Constructor and destructor
WinEDA_SelectCmp( WinEDA_DrawFrame* parent, const wxPoint& framepos,
wxArrayString& HistoryList, const wxString& Title,
bool show_extra_tool );
~WinEDA_SelectCmp() {};
private:
void Accept( wxCommandEvent& event );
void GetExtraSelection( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE( WinEDA_SelectCmp, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SelectCmp, wxDialog )
EVT_BUTTON( ID_ACCEPT_NAME, WinEDA_SelectCmp::Accept ) EVT_BUTTON( ID_ACCEPT_NAME, WinEDA_SelectCmp::Accept )
...@@ -66,28 +28,22 @@ BEGIN_EVENT_TABLE( WinEDA_SelectCmp, wxDialog ) ...@@ -66,28 +28,22 @@ BEGIN_EVENT_TABLE( WinEDA_SelectCmp, wxDialog )
END_EVENT_TABLE() END_EVENT_TABLE()
/****************************************************************************/ /*
* Dialog frame to choose a component or a footprint
* This dialog shows an history of last selected items
*/
WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent, WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
const wxPoint& framepos, const wxPoint& framepos,
wxArrayString& HistoryList, wxArrayString& HistoryList,
const wxString& Title, const wxString& Title,
bool show_extra_tool ) : bool show_extra_tool ) :
wxDialog( parent, -1, Title, framepos, wxDefaultSize, DIALOG_STYLE ) wxDialog( parent, -1, Title, framepos, wxDefaultSize, DIALOG_STYLE )
/****************************************************************************/
/* Dialog frame to choose a component or a footprint
* This dialog shows an history of last selected items
*/
{ {
wxButton* Button; wxButton* Button;
wxStaticText* Text; wxStaticText* Text;
m_Parent = parent;
m_AuxTool = show_extra_tool; m_AuxTool = show_extra_tool;
m_GetExtraFunction = FALSE; m_GetExtraFunction = false;
s_ItemName.Empty();
m_Text = &s_ItemName;
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( MainBoxSizer ); SetSizer( MainBoxSizer );
...@@ -127,7 +83,7 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent, ...@@ -127,7 +83,7 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM,
5 ); 5 );
Button = new wxButton( this, ID_ACCEPT_KEYWORD, _( "Search KeyWord" ) ); Button = new wxButton( this, ID_ACCEPT_KEYWORD, _( "Search by Keyword" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
Button = new wxButton( this, ID_CANCEL, _( "Cancel" ) ); Button = new wxButton( this, ID_CANCEL, _( "Cancel" ) );
...@@ -139,7 +95,7 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent, ...@@ -139,7 +95,7 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
#ifndef __WXMAC__ #ifndef __WXMAC__
if( m_AuxTool ) /* The selection can be done by an extra function */ if( m_AuxTool ) /* The selection can be done by an extra function */
{ {
Button = new wxButton( this, ID_EXTRA_TOOL, _( "By Lib Browser" ) ); Button = new wxButton( this, ID_EXTRA_TOOL, _( "Select by Browser" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
} }
#endif #endif
...@@ -149,98 +105,98 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent, ...@@ -149,98 +105,98 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
} }
/*********************************************************/
void WinEDA_SelectCmp::Accept( wxCommandEvent& event ) void WinEDA_SelectCmp::Accept( wxCommandEvent& event )
/*********************************************************/
{ {
int id = wxID_OK;
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_SEL_BY_LISTBOX: case ID_SEL_BY_LISTBOX:
*m_Text = m_List->GetStringSelection(); m_Text = m_List->GetStringSelection();
break; break;
case ID_ACCEPT_NAME: case ID_ACCEPT_NAME:
*m_Text = m_TextCtrl->GetValue(); m_Text = m_TextCtrl->GetValue();
break; break;
case ID_ACCEPT_KEYWORD: case ID_ACCEPT_KEYWORD:
*m_Text = wxT( "= " ) + m_TextCtrl->GetValue(); m_Text = wxT( "= " ) + m_TextCtrl->GetValue();
break; break;
case ID_CANCEL: case ID_CANCEL:
*m_Text = wxEmptyString; m_Text = wxEmptyString;
id = wxID_CANCEL;
break; break;
case ID_LIST_ALL: case ID_LIST_ALL:
*m_Text = wxT( "*" ); m_Text = wxT( "*" );
break; break;
} }
m_Text->Trim( FALSE ); // Remove blanks at beginning m_Text.Trim( false ); // Remove blanks at beginning
m_Text->Trim( TRUE ); // Remove blanks at end m_Text.Trim( true ); // Remove blanks at end
Close( TRUE );
if( IsModal() )
EndModal( id );
else
Close( id );
} }
/**************************************************************/ /* Get the component name by the extra function */
void WinEDA_SelectCmp::GetExtraSelection( wxCommandEvent& event ) void WinEDA_SelectCmp::GetExtraSelection( wxCommandEvent& event )
/**************************************************************/ {
m_GetExtraFunction = true;
/* Get the component name by the extra function if( IsModal() )
*/ EndModal( wxID_OK );
else
Close( wxID_OK );
}
wxString WinEDA_SelectCmp::GetComponentName( void )
{ {
m_GetExtraFunction = TRUE; return m_Text;
Close( TRUE );
} }
/******************************************************************************/ void WinEDA_SelectCmp::SetComponentName( const wxString& name )
wxString GetComponentName( WinEDA_DrawFrame* frame, {
wxArrayString& HistoryList, const wxString& Title, if( m_TextCtrl )
wxString (*AuxTool)( WinEDA_DrawFrame* parent ) ) m_TextCtrl->SetValue( name );
/*******************************************************************************/ }
/* Dialog frame to choose a component name
*/ wxPoint GetComponentDialogPosition( void )
{ {
wxPoint framepos; wxPoint pos;
int x, y, w, h; int x, y, w, h;
bool GetExtraFunction;
framepos = wxGetMousePosition(); pos = wxGetMousePosition();
wxClientDisplayRect( &x, &y, &w, &h ); wxClientDisplayRect( &x, &y, &w, &h );
framepos.x -= 100; pos.x -= 100;
framepos.y -= 50; pos.y -= 50;
if( framepos.x < x ) if( pos.x < x )
framepos.x = x; pos.x = x;
if( framepos.y < y ) if( pos.y < y )
framepos.y = y; pos.y = y;
if( framepos.x < x ) if( pos.x < x )
framepos.x = x; pos.x = x;
x += w - 350; x += w - 350;
if( framepos.x > x ) if( pos.x > x )
framepos.x = x; pos.x = x;
if( framepos.y < y ) if( pos.y < y )
framepos.y = y; pos.y = y;
WinEDA_SelectCmp* selframe =
new WinEDA_SelectCmp( frame, framepos, HistoryList, Title,
AuxTool ? TRUE : FALSE );
selframe->ShowModal();
GetExtraFunction = selframe->m_GetExtraFunction;
selframe->Destroy();
if( GetExtraFunction )
s_ItemName = AuxTool( frame );
return s_ItemName;
}
return pos;
}
/*******************************************************************************/
void AddHistoryComponentName( wxArrayString& HistoryList, const wxString& Name )
/*******************************************************************************/
/* Add the string "Name" to the history list HistoryList /*
* Add the string "Name" to the history list HistoryList
*/ */
void AddHistoryComponentName( wxArrayString& HistoryList, const wxString& Name )
{ {
int ii, c_max; int ii, c_max;
......
...@@ -671,7 +671,7 @@ bool LIB_COMPONENT::Load( FILE* file, char* line, int* lineNum, ...@@ -671,7 +671,7 @@ bool LIB_COMPONENT::Load( FILE* file, char* line, int* lineNum,
errorMsg.Printf( wxT( "error occurred at line %d " ), *lineNum ); errorMsg.Printf( wxT( "error occurred at line %d " ), *lineNum );
else else
errorMsg.Printf( wxT( "error <%s> occurred at line %d " ), errorMsg.Printf( wxT( "error <%s> occurred at line %d " ),
( const wxChar* ) Msg, *lineNum ); GetChars( Msg ), *lineNum );
return false; return false;
} }
} }
...@@ -739,7 +739,7 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* f, char* line, ...@@ -739,7 +739,7 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* f, char* line,
if( !newEntry->Load( line, errorMsg ) ) if( !newEntry->Load( line, errorMsg ) )
{ {
errorMsg.Printf( wxT( "error <%s> in DRAW command %c" ), errorMsg.Printf( wxT( "error <%s> in DRAW command %c" ),
( const wxChar* ) errorMsg, line[0] ); GetChars( errorMsg ), line[0] );
SAFE_DELETE( newEntry ); SAFE_DELETE( newEntry );
/* Flush till end of draw section */ /* Flush till end of draw section */
......
...@@ -199,8 +199,8 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* alias ) ...@@ -199,8 +199,8 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* alias )
wxString msg; wxString msg;
msg.Printf( _( "Cannot add duplicate alias <%s> to library <%s>." ), msg.Printf( _( "Cannot add duplicate alias <%s> to library <%s>." ),
(const wxChar*) alias->GetName(), GetChars( alias->GetName() ),
(const wxChar*) m_fileName.GetName() ); GetChars( m_fileName.GetName() ) );
return false; return false;
} }
...@@ -239,9 +239,9 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* cmp ) ...@@ -239,9 +239,9 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* cmp )
{ {
wxLogError( _( "Conflict in library <%s>: alias <%s> already \ wxLogError( _( "Conflict in library <%s>: alias <%s> already \
has root name <%s> and will not be assigned to root name <%s>." ), has root name <%s> and will not be assigned to root name <%s>." ),
(const wxChar*) m_fileName.GetName(), GetChars( m_fileName.GetName() ),
(const wxChar*) alias->GetComponent()->GetName(), GetChars( alias->GetComponent()->GetName() ),
(const wxChar*) newCmp->GetName() ); GetChars( newCmp->GetName() ) );
} }
} }
} }
...@@ -287,8 +287,8 @@ void CMP_LIBRARY::RemoveEntry( CMP_LIB_ENTRY* entry ) ...@@ -287,8 +287,8 @@ void CMP_LIBRARY::RemoveEntry( CMP_LIB_ENTRY* entry )
{ {
wxLogWarning( wxT( "No root component found for alias <%s> in \ wxLogWarning( wxT( "No root component found for alias <%s> in \
library <%s>." ), library <%s>." ),
( const wxChar* ) entry->GetName(), GetChars( entry->GetName() ),
( const wxChar* ) m_fileName.GetName() ); GetChars( m_fileName.GetName() ) );
} }
else else
{ {
...@@ -297,9 +297,9 @@ library <%s>." ), ...@@ -297,9 +297,9 @@ library <%s>." ),
if( index == wxNOT_FOUND ) if( index == wxNOT_FOUND )
wxLogWarning( wxT( "Alias <%s> not found in component <%s> \ wxLogWarning( wxT( "Alias <%s> not found in component <%s> \
alias list in library <%s>" ), alias list in library <%s>" ),
( const wxChar* ) entry->GetName(), GetChars( entry->GetName() ),
( const wxChar* ) Root->GetName(), GetChars( Root->GetName() ),
( const wxChar* ) m_fileName.GetName() ); GetChars( m_fileName.GetName() ) );
else else
Root->m_AliasList.RemoveAt( index ); Root->m_AliasList.RemoveAt( index );
} }
...@@ -329,9 +329,9 @@ alias list in library <%s>" ), ...@@ -329,9 +329,9 @@ alias list in library <%s>" ),
{ {
wxLogWarning( wxT( "Alias <%s> for component <%s> not found in \ wxLogWarning( wxT( "Alias <%s> for component <%s> not found in \
library <%s>" ), library <%s>" ),
( const wxChar* ) AliasName, GetChars( AliasName ),
( const wxChar* ) Root->GetName(), GetChars( Root->GetName() ),
( const wxChar* ) m_fileName.GetName() ); GetChars( m_fileName.GetName() ) );
return; return;
} }
...@@ -373,9 +373,9 @@ LIB_COMPONENT* CMP_LIBRARY::ReplaceComponent( LIB_COMPONENT* oldComponent, ...@@ -373,9 +373,9 @@ LIB_COMPONENT* CMP_LIBRARY::ReplaceComponent( LIB_COMPONENT* oldComponent,
wxLogDebug( wxT( "Removing extra alias <%s> from component <%s> \ wxLogDebug( wxT( "Removing extra alias <%s> from component <%s> \
in library <%s>." ), in library <%s>." ),
(const wxChar*) oldComponent->m_AliasList[ i ], GetChars( oldComponent->m_AliasList[ i ] ),
(const wxChar*) oldComponent->GetName(), GetChars( oldComponent->GetName() ),
(const wxChar*) m_fileName.GetName() ); GetChars( m_fileName.GetName() ) );
RemoveEntry( oldComponent->m_AliasList[ i ] ); RemoveEntry( oldComponent->m_AliasList[ i ] );
} }
...@@ -392,9 +392,9 @@ in library <%s>." ), ...@@ -392,9 +392,9 @@ in library <%s>." ),
wxLogDebug( wxT( "Adding extra alias <%s> from component <%s> \ wxLogDebug( wxT( "Adding extra alias <%s> from component <%s> \
in library <%s>." ), in library <%s>." ),
(const wxChar*) newComponent->m_AliasList[ i ], GetChars( newComponent->m_AliasList[ i ] ),
(const wxChar*) newComponent->GetName(), GetChars( newComponent->GetName() ),
(const wxChar*) m_fileName.GetName() ); GetChars( m_fileName.GetName() ) );
alias = new LIB_ALIAS( newComponent->m_AliasList[ i ], alias = new LIB_ALIAS( newComponent->m_AliasList[ i ],
newComponent ); newComponent );
...@@ -534,7 +534,7 @@ number is invalid.\n\nIn future versions of EESchema this library may not \ ...@@ -534,7 +534,7 @@ number is invalid.\n\nIn future versions of EESchema this library may not \
load correctly. To resolve this problem open the library in the library \ load correctly. To resolve this problem open the library in the library \
editor and save it. If this library is the project cache library, save \ editor and save it. If this library is the project cache library, save \
the current schematic." ), the current schematic." ),
(const wxChar*) GetName() ); GetChars( GetName() ) );
} }
else else
{ {
...@@ -542,7 +542,7 @@ the current schematic." ), ...@@ -542,7 +542,7 @@ the current schematic." ),
m_verMinor = (int) minor; m_verMinor = (int) minor;
wxLogDebug( wxT( "Component library <%s> is version %d.%d." ), wxLogDebug( wxT( "Component library <%s> is version %d.%d." ),
(const wxChar*) GetName(), m_verMajor, m_verMinor ); GetChars( GetName() ), m_verMajor, m_verMinor );
} }
} }
...@@ -573,8 +573,8 @@ the current schematic." ), ...@@ -573,8 +573,8 @@ the current schematic." ),
if( FindEntry( LibEntry->GetName() ) != NULL ) if( FindEntry( LibEntry->GetName() ) != NULL )
{ {
wxLogWarning( duplicate_name_msg, wxLogWarning( duplicate_name_msg,
(const wxChar*) m_fileName.GetName(), GetChars( m_fileName.GetName() ),
(const wxChar*) LibEntry->GetName() ); GetChars( LibEntry->GetName() ) );
} }
/* If we are here, this part is O.k. - put it in: */ /* If we are here, this part is O.k. - put it in: */
...@@ -584,8 +584,8 @@ the current schematic." ), ...@@ -584,8 +584,8 @@ the current schematic." ),
else else
{ {
wxLogWarning( _( "Library <%s> component load error %s." ), wxLogWarning( _( "Library <%s> component load error %s." ),
(const wxChar*) m_fileName.GetName(), GetChars( m_fileName.GetName() ),
(const wxChar*) msg ); GetChars( msg ) );
msg.Clear(); msg.Clear();
delete LibEntry; delete LibEntry;
} }
...@@ -610,8 +610,8 @@ void CMP_LIBRARY::LoadAliases( LIB_COMPONENT* component ) ...@@ -610,8 +610,8 @@ void CMP_LIBRARY::LoadAliases( LIB_COMPONENT* component )
if( FindEntry( component->m_AliasList[ii] ) != NULL ) if( FindEntry( component->m_AliasList[ii] ) != NULL )
{ {
wxLogError( duplicate_name_msg, wxLogError( duplicate_name_msg,
(const wxChar*) m_fileName.GetName(), GetChars( m_fileName.GetName() ),
(const wxChar*) component->m_AliasList[ii] ); GetChars( component->m_AliasList[ii] ) );
} }
alias = new LIB_ALIAS( component->m_AliasList[ii], component, this ); alias = new LIB_ALIAS( component->m_AliasList[ii], component, this );
...@@ -654,14 +654,14 @@ bool CMP_LIBRARY::LoadDocs( wxString& errMsg ) ...@@ -654,14 +654,14 @@ bool CMP_LIBRARY::LoadDocs( wxString& errMsg )
if( f == NULL ) if( f == NULL )
{ {
errMsg.Printf( _( "Could not open component document libray file <%s>." ), errMsg.Printf( _( "Could not open component document libray file <%s>." ),
(const wxChar*) fn.GetFullPath() ); GetChars( fn.GetFullPath() ) );
return false; return false;
} }
if( GetLine( f, Line, &LineNum, sizeof(Line) ) == NULL ) if( GetLine( f, Line, &LineNum, sizeof(Line) ) == NULL )
{ {
errMsg.Printf( _( "Component document libray file <%s> is empty." ), errMsg.Printf( _( "Component document libray file <%s> is empty." ),
(const wxChar*) fn.GetFullPath() ); GetChars( fn.GetFullPath() ) );
fclose( f ); fclose( f );
return false; return false;
} }
...@@ -670,7 +670,7 @@ bool CMP_LIBRARY::LoadDocs( wxString& errMsg ) ...@@ -670,7 +670,7 @@ bool CMP_LIBRARY::LoadDocs( wxString& errMsg )
{ {
errMsg.Printf( _( "File <%s> is not a valid component library \ errMsg.Printf( _( "File <%s> is not a valid component library \
document file." ), document file." ),
(const wxChar*) fn.GetFullPath() ); GetChars( fn.GetFullPath() ) );
fclose( f ); fclose( f );
return false; return false;
} }
......
...@@ -50,89 +50,78 @@ void CreateDummyCmp() ...@@ -50,89 +50,78 @@ void CreateDummyCmp()
} }
/***************************************************************************** /*******************************************************************/
* Routine to draw the given part at given position, transformed/mirror as SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
* specified, and in the given drawing mode. SCH_ITEM( aParent, TYPE_SCH_COMPONENT )
* if Color < 0: Draw in normal color
* else draw in color = Color
*****************************************************************************/
/* DrawMode = GrXOR, GrOR ..*/
void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT* Component, LIB_COMPONENT* Entry,
const wxPoint& Pos, const int TransMat[2][2],
int Multi, int convert, int DrawMode,
int Color, bool DrawPinText )
{ {
Entry->Draw( panel, DC, Pos, Multi, convert, DrawMode, Color, TransMat, Init( aPos );
DrawPinText, false );
/* Enable this to draw the bounding box around the component to validate
* the bounding box calculations. */
#if 0
/* Draw the component boundary box */
{
EDA_Rect BoundaryBox;
if( Component )
BoundaryBox = Component->GetBoundaryBox();
else
BoundaryBox = Entry->GetBoundaryBox( Multi, convert );
int x1 = BoundaryBox.GetX();
int y1 = BoundaryBox.GetY();
int x2 = BoundaryBox.GetRight();
int y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
BoundaryBox = Component->GetField( REFERENCE )->GetBoundaryBox();
x1 = BoundaryBox.GetX();
y1 = BoundaryBox.GetY();
x2 = BoundaryBox.GetRight();
y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
BoundaryBox = Component->GetField( VALUE )->GetBoundaryBox();
x1 = BoundaryBox.GetX();
y1 = BoundaryBox.GetY();
x2 = BoundaryBox.GetRight();
y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
}
#endif
} }
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet,
/*******************************************************************/ int unit, int convert, const wxPoint& pos,
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) : bool setNewItemFlag ) :
SCH_ITEM( aParent, TYPE_SCH_COMPONENT ) SCH_ITEM( NULL, TYPE_SCH_COMPONENT )
{ {
m_Multi = 0; /* In multi unit chip - which unit to draw. */ Init( pos );
m_Pos = aPos; m_Multi = unit;
m_Convert = convert;
m_ChipName = libComponent.GetName();
m_TimeStamp = GetTimeStamp();
m_Convert = 0; /* De Morgan Handling */ if( setNewItemFlag )
m_Flags = IS_NEW | IS_MOVED;
/* The rotation/mirror transformation matrix. pos normal */ GetField( VALUE )->m_Pos = libComponent.m_Name.m_Pos + m_Pos;
m_Transform[0][0] = 1; GetField( VALUE )->ImportValues( libComponent.m_Name );
m_Transform[0][1] = 0; GetField( VALUE )->m_Text = m_ChipName;
m_Transform[1][0] = 0;
m_Transform[1][1] = -1;
m_Fields.reserve( NUMBER_OF_FIELDS ); wxString msg = libComponent.m_Prefix.m_Text;
if( msg.IsEmpty() )
msg = wxT( "U" );
msg += wxT( "?" );
for( int i = 0; i < NUMBER_OF_FIELDS; ++i ) // update the reference -- just the prefix for now.
SetRef( sheet, msg );
GetField( REFERENCE )->m_Pos = libComponent.m_Prefix.m_Pos + m_Pos;
GetField( REFERENCE )->ImportValues( libComponent.m_Prefix );
m_PrefixString = libComponent.m_Prefix.m_Text;
/* Init des autres champs si predefinis dans la librairie */
LIB_FIELD* EntryField;
int ii;
for( EntryField = libComponent.m_Fields; EntryField != NULL;
EntryField = EntryField->Next() )
{ {
SCH_CMP_FIELD field( aPos, i, this, ReturnDefaultFieldName( i ) ); if( EntryField->m_Text.IsEmpty() && EntryField->m_Name.IsEmpty() )
continue;
if( i==REFERENCE ) ii = EntryField->m_FieldId;
field.SetLayer( LAYER_REFERENCEPART ); if( ii < 2 ) // Reference or value, already done
else if( i==VALUE ) continue;
field.SetLayer( LAYER_VALUEPART );
// else keep LAYER_FIELDS from SCH_CMP_FIELD constructor if( ii >= GetFieldCount() )
{ // This entry has more than the default count: add extra fields
while( ii >= GetFieldCount() )
{
int field_id = GetFieldCount();
SCH_CMP_FIELD field( wxPoint( 0, 0 ), field_id, this,
ReturnDefaultFieldName( ii ) );
AddField( field );
}
}
// SCH_CMP_FIELD's implicitly created copy constructor is called in here SCH_CMP_FIELD* curr_field = GetField( ii );
AddField( field );
}
m_PrefixString = wxString( _( "U" ) ); curr_field->m_Pos = m_Pos + EntryField->m_Pos;
curr_field->ImportValues( *EntryField );
curr_field->m_Text = EntryField->m_Text;
curr_field->m_Name =
( ii < FIELD1 ) ? ReturnDefaultFieldName( ii ) : EntryField->m_Name;
}
} }
...@@ -157,12 +146,46 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) : ...@@ -157,12 +146,46 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) :
} }
void SCH_COMPONENT::Init( const wxPoint& pos )
{
m_Pos = pos;
m_Multi = 0; /* In multi unit chip - which unit to draw. */
m_Convert = 0; /* De Morgan Handling */
/* The rotation/mirror transformation matrix. pos normal */
m_Transform[0][0] = 1;
m_Transform[0][1] = 0;
m_Transform[1][0] = 0;
m_Transform[1][1] = -1;
m_Fields.reserve( NUMBER_OF_FIELDS );
for( int i = 0; i < NUMBER_OF_FIELDS; ++i )
{
SCH_CMP_FIELD field( pos, i, this, ReturnDefaultFieldName( i ) );
if( i==REFERENCE )
field.SetLayer( LAYER_REFERENCEPART );
else if( i==VALUE )
field.SetLayer( LAYER_VALUEPART );
// else keep LAYER_FIELDS from SCH_CMP_FIELD constructor
// SCH_CMP_FIELD's implicitly created copy constructor is called in here
AddField( field );
}
m_PrefixString = wxString( _( "U" ) );
}
/***************************************************************************** /*****************************************************************************
* Routine to draw the given part at given position, transformed/mirror as * * Routine to draw the given part at given position, transformed/mirror as *
* specified, and in the given drawing mode. Only this one is visible... * * specified, and in the given drawing mode. Only this one is visible... *
*****************************************************************************/ *****************************************************************************/
void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color ) const wxPoint& offset, int DrawMode, int Color,
bool DrawPinText )
{ {
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
int ii; int ii;
...@@ -172,19 +195,16 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -172,19 +195,16 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( Entry == NULL ) if( Entry == NULL )
{ {
/* composant non trouve, on affiche un composant "dummy" */ /* Create a dummy component if the actual component can not be found. */
dummy = TRUE; dummy = TRUE;
if( DummyCmp == NULL ) if( DummyCmp == NULL )
CreateDummyCmp(); CreateDummyCmp();
Entry = DummyCmp; Entry = DummyCmp;
} }
DrawLibPartAux( panel, DC, this, Entry, m_Pos + offset, m_Transform, Entry->Draw( panel, DC, m_Pos + offset, dummy ? 0 : m_Multi,
dummy ? 0 : m_Multi, dummy ? 0 : m_Convert, DrawMode ); dummy ? 0 : m_Convert, DrawMode, Color, m_Transform,
DrawPinText );
/* Trace des champs, avec placement et orientation selon orient. du
* composant
*/
SCH_CMP_FIELD* field = GetField( REFERENCE ); SCH_CMP_FIELD* field = GetField( REFERENCE );
...@@ -212,6 +232,32 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -212,6 +232,32 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
field->Draw( panel, DC, offset, DrawMode ); field->Draw( panel, DC, offset, DrawMode );
} }
#if 0
/* Draw the component boundary box */
{
EDA_Rect BoundaryBox;
BoundaryBox = GetBoundaryBox();
int x1 = BoundaryBox.GetX();
int y1 = BoundaryBox.GetY();
int x2 = BoundaryBox.GetRight();
int y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
BoundaryBox = GetField( REFERENCE )->GetBoundaryBox();
x1 = BoundaryBox.GetX();
y1 = BoundaryBox.GetY();
x2 = BoundaryBox.GetRight();
y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
BoundaryBox = GetField( VALUE )->GetBoundaryBox();
x1 = BoundaryBox.GetX();
y1 = BoundaryBox.GetY();
x2 = BoundaryBox.GetRight();
y2 = BoundaryBox.GetBottom();
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
}
#endif
} }
......
...@@ -13,13 +13,6 @@ ...@@ -13,13 +13,6 @@
#include "class_sch_cmp_field.h" #include "class_sch_cmp_field.h"
extern void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_COMPONENT* Component, LIB_COMPONENT* Entry,
const wxPoint& Pos, const int TransMat[2][2],
int Multi, int convert, int DrawMode,
int Color = -1, bool DrawPinText = TRUE );
WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists ); WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists );
...@@ -114,10 +107,30 @@ private: ...@@ -114,10 +107,30 @@ private:
*/ */
wxArrayString m_PathsAndReferences; wxArrayString m_PathsAndReferences;
void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
public: public:
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ),
SCH_ITEM* aParent = NULL ); SCH_ITEM* aParent = NULL );
/**
* Create schematic component from library component object.
*
* @param libComponent - Component library object to create schematic
* component from.
* @param sheet - Schemitic sheet the component is place into.
* @param unit - Part for components that have multiple parts per
* package.
* @param convert - Use the alternate body style for the schematic
* component.
* @param pos - Position to place new component.
* @param setNewItemFlag - Set the component IS_NEW and IS_MOVED flags.
*/
SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet,
int unit = 0, int convert = 0,
const wxPoint& pos = wxPoint( 0, 0 ),
bool setNewItemFlag = false );
/** /**
* Copy Constructor * Copy Constructor
* clones \a aTemplate into this object. All fields are copied as is except * clones \a aTemplate into this object. All fields are copied as is except
...@@ -240,7 +253,17 @@ public: ...@@ -240,7 +253,17 @@ public:
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 )
{
Draw( panel, DC, offset, draw_mode, Color, true );
}
void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color,
bool DrawPinText );
void SwapData( SCH_COMPONENT* copyitem ); void SwapData( SCH_COMPONENT* copyitem );
......
...@@ -85,8 +85,8 @@ void DisplayCmpDoc( wxString& Name ) ...@@ -85,8 +85,8 @@ void DisplayCmpDoc( wxString& Name )
return; return;
wxLogDebug( wxT( "Selected component <%s>, m_Doc: <%s>, m_KeyWord: <%s>." ), wxLogDebug( wxT( "Selected component <%s>, m_Doc: <%s>, m_KeyWord: <%s>." ),
(const wxChar*) Name, (const wxChar*) CmpEntry->m_Doc, GetChars( Name ), GetChars( CmpEntry->m_Doc ),
(const wxChar*) CmpEntry->m_KeyWord ); GetChars( CmpEntry->m_KeyWord ) );
Name = wxT( "Description: " ) + CmpEntry->m_Doc; Name = wxT( "Description: " ) + CmpEntry->m_Doc;
Name += wxT( "\nKey Words: " ) + CmpEntry->m_KeyWord; Name += wxT( "\nKey Words: " ) + CmpEntry->m_KeyWord;
......
...@@ -144,9 +144,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event ) ...@@ -144,9 +144,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
wxString msg; wxString msg;
msg.Printf( _( "Alias <%s> not found for component <%s> in library \ msg.Printf( _( "Alias <%s> not found for component <%s> in library \
<%s>." ), <%s>." ),
(const wxChar*) m_Parent->GetAliasName(), GetChars( m_Parent->GetAliasName() ),
(const wxChar*) component->GetName(), GetChars( component->GetName() ),
(const wxChar*) library->GetName() ); GetChars( library->GetName() ) );
wxMessageBox( msg, _( "Component Library Error" ), wxMessageBox( msg, _( "Component Library Error" ),
wxID_OK | wxICON_ERROR, this ); wxID_OK | wxICON_ERROR, this );
} }
...@@ -274,7 +274,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( ...@@ -274,7 +274,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(
wxString msg; wxString msg;
msg.Printf( _( "Alias <%s> cannot be removed while it is being \ msg.Printf( _( "Alias <%s> cannot be removed while it is being \
edited!" ), edited!" ),
(const wxChar*) m_Parent->GetAliasName() ); GetChars( m_Parent->GetAliasName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -319,8 +319,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED ...@@ -319,8 +319,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
wxString msg; wxString msg;
msg.Printf( _( "Alias or component name <%s> already exists in \ msg.Printf( _( "Alias or component name <%s> already exists in \
library <%s>." ), library <%s>." ),
(const wxChar*) aliasname, GetChars( aliasname ),
(const wxChar*) library->GetName() ); GetChars( library->GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -344,7 +344,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( ...@@ -344,7 +344,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(
wxString msg; wxString msg;
msg.Printf( _( "Alias <%s> cannot be removed while it is being \ msg.Printf( _( "Alias <%s> cannot be removed while it is being \
edited!" ), edited!" ),
(const wxChar*) aliasname ); GetChars( aliasname ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -491,7 +491,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU ...@@ -491,7 +491,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
wxString msg; wxString msg;
msg.Printf( _( "Foot print filter <%s> is already defined." ), msg.Printf( _( "Foot print filter <%s> is already defined." ),
(const wxChar*) Line ); GetChars( Line ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
......
...@@ -105,20 +105,3 @@ bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] ) ...@@ -105,20 +105,3 @@ bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] )
return swap; return swap;
} }
/*****************************************************************************
* Routine to display an outline version of given library entry. *
* This routine is applied by the PlaceLibItem routine above. *
*****************************************************************************/
void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
LIB_COMPONENT* LibEntry, SCH_COMPONENT* DrawLibItem,
int PartX, int PartY, int multi, int convert,
int Color, bool DrawPinText )
{
int DrawMode = g_XorMode;
DrawLibPartAux( panel, DC, DrawLibItem, LibEntry, wxPoint( PartX, PartY ),
DrawLibItem->m_Transform, multi, convert, DrawMode, Color,
DrawPinText );
}
...@@ -82,8 +82,8 @@ void WinEDA_SchematicFrame::LoadLibraries( void ) ...@@ -82,8 +82,8 @@ void WinEDA_SchematicFrame::LoadLibraries( void )
prompt.Printf( _( "Component library <%s> failed to load.\n\n\ prompt.Printf( _( "Component library <%s> failed to load.\n\n\
Error: %s" ), Error: %s" ),
( const wxChar* ) fn.GetFullPath(), GetChars( fn.GetFullPath() ),
( const wxChar* ) errMsg ); GetChars( errMsg ) );
DisplayError( this, prompt ); DisplayError( this, prompt );
msg += _( " error!" ); msg += _( " error!" );
} }
......
/***************************************************************************** /*****************************************************************************
* Program to draw EE diagrams. * * Program to draw EE diagrams. *
* This module redraw/draw all structs. * * This module redraw/draw all structs. *
*****************************************************************************/ *****************************************************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -123,8 +123,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, ...@@ -123,8 +123,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref,
/***************************************************************************** /*****************************************************************************
* Routine to redraw list of structs. * * Routine to redraw list of structs. *
* If the list is of DrawPickStruct types then the picked item are drawn. * * If the list is of DrawPickStruct types then the picked item are drawn. *
*****************************************************************************/ *****************************************************************************/
void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC, void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM* Structlist, int DrawMode, int Color ) SCH_ITEM* Structlist, int DrawMode, int Color )
...@@ -144,7 +144,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -144,7 +144,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
/***************************************************************************** /*****************************************************************************
* Routine to redraw list of structs. * * Routine to redraw list of structs. *
*****************************************************************************/ *****************************************************************************/
void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC, void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM* Struct, int DrawMode, int Color ) SCH_ITEM* Struct, int DrawMode, int Color )
...@@ -257,17 +257,12 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem ...@@ -257,17 +257,12 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
{ {
LIB_COMPONENT* LibEntry; SCH_COMPONENT* Component = (SCH_COMPONENT*) aItem;
SCH_COMPONENT* Struct;
Struct = (SCH_COMPONENT*) aItem;
LibEntry = CMP_LIBRARY::FindLibraryComponent( Struct->m_ChipName );
if( LibEntry == NULL ) if( Component == NULL )
break; break;
DrawingLibInGhost( aPanel, aDC, LibEntry, Struct,
Struct->m_Pos.x + aOffset.x, Component->Draw( aPanel, aDC, aOffset, g_XorMode, g_GhostColor, false );
Struct->m_Pos.y + aOffset.y, Struct->m_Multi,
Struct->m_Convert, g_GhostColor, FALSE );
break; break;
} }
...@@ -288,4 +283,3 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem ...@@ -288,4 +283,3 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem
break; break;
} }
} }
...@@ -189,7 +189,8 @@ enum id_eeschema_frm ...@@ -189,7 +189,8 @@ enum id_eeschema_frm
ID_LIBVIEW_CMP_LIST, ID_LIBVIEW_CMP_LIST,
ID_LIBVIEW_LIBWINDOW, ID_LIBVIEW_LIBWINDOW,
ID_LIBVIEW_CMPWINDOW, ID_LIBVIEW_CMPWINDOW,
ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
ID_SET_RELATIVE_OFFSET
}; };
......
...@@ -189,8 +189,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, ...@@ -189,8 +189,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
prompt.Printf( _( "Component library <%s> failed to load.\n\n\ prompt.Printf( _( "Component library <%s> failed to load.\n\n\
Error: %s" ), Error: %s" ),
( const wxChar* ) fn.GetFullPath(), GetChars( fn.GetFullPath() ),
( const wxChar* ) errMsg ); GetChars( errMsg ) );
DisplayError( this, prompt ); DisplayError( this, prompt );
msg += wxT( " ->Error" ); msg += wxT( " ->Error" );
} }
......
...@@ -29,23 +29,20 @@ static int OldTransMat[2][2]; ...@@ -29,23 +29,20 @@ static int OldTransMat[2][2];
static wxPoint OldPos; static wxPoint OldPos;
wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent ) wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void )
{ {
WinEDA_ViewlibFrame* Viewer; wxSemaphore semaphore( 0, 1 );
wxSemaphore semaphore( 0, 1 );
WinEDA_SchematicFrame* frame;
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
Viewer = frame->m_ViewlibFrame;
/* Close the current Lib browser, if open, and open a new one, in /* Close the current Lib browser, if open, and open a new one, in
* "modal" mode */ * "modal" mode */
if( Viewer ) if( m_ViewlibFrame )
Viewer->Destroy(); {
m_ViewlibFrame->Destroy();
m_ViewlibFrame = NULL;
}
Viewer = frame->m_ViewlibFrame = new WinEDA_ViewlibFrame( frame, NULL, m_ViewlibFrame = new WinEDA_ViewlibFrame( this, NULL, &semaphore );
&semaphore ); m_ViewlibFrame->AdjustScrollBars();
Viewer->AdjustScrollBars();
// Show the library viewer frame until it is closed // Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
...@@ -54,7 +51,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent ) ...@@ -54,7 +51,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
wxMilliSleep( 50 ); wxMilliSleep( 50 );
} }
return Viewer->GetEntryName(); return m_ViewlibFrame->GetEntryName();
} }
...@@ -69,12 +66,15 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -69,12 +66,15 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
wxArrayString& HistoryList, wxArrayString& HistoryList,
bool UseLibBrowser ) bool UseLibBrowser )
{ {
int ii, CmpCount = 0; int CmpCount = 0;
LIB_COMPONENT* Entry = NULL; int unit = 1;
SCH_COMPONENT* Component = NULL; int convert = 1;
CMP_LIBRARY* Library = NULL; LIB_COMPONENT* Entry = NULL;
wxString Name, keys, msg; SCH_COMPONENT* Component = NULL;
bool AllowWildSeach = TRUE; CMP_LIBRARY* Library = NULL;
wxString Name, keys, msg;
bool AllowWildSeach = TRUE;
static wxString lastCommponentName;
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
...@@ -97,16 +97,33 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -97,16 +97,33 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
/* Ask for a component name or key words */ /* Ask for a component name or key words */
msg.Printf( _( "component selection (%d items loaded):" ), CmpCount ); msg.Printf( _( "component selection (%d items loaded):" ), CmpCount );
Name = GetComponentName( this, HistoryList, msg, WinEDA_SelectCmp dlg( this, GetComponentDialogPosition(), HistoryList,
UseLibBrowser ? SelectFromLibBrowser : NULL ); msg, UseLibBrowser );
Name.MakeUpper(); dlg.SetComponentName( lastCommponentName );
if ( dlg.ShowModal() == wxID_CANCEL )
return NULL;
if( dlg.m_GetExtraFunction )
{
Name = SelectFromLibBrowser();
unit = m_ViewlibFrame->GetUnit();
convert = m_ViewlibFrame->GetConvert();
}
else
{
Name = dlg.GetComponentName();
}
if( Name.IsEmpty() ) if( Name.IsEmpty() )
{ {
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
return NULL; /* annulation de commande */ return NULL;
} }
Name.MakeUpper();
if( Name.GetChar( 0 ) == '=' ) if( Name.GetChar( 0 ) == '=' )
{ {
AllowWildSeach = FALSE; AllowWildSeach = FALSE;
...@@ -143,7 +160,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -143,7 +160,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Entry = CMP_LIBRARY::FindLibraryComponent( Name, libname ); Entry = CMP_LIBRARY::FindLibraryComponent( Name, libname );
if( (Entry == NULL) && AllowWildSeach ) /* Attemp to search with wildcard */ if( ( Entry == NULL ) && AllowWildSeach ) /* Search with wildcard */
{ {
AllowWildSeach = FALSE; AllowWildSeach = FALSE;
wxString wildname = wxChar( '*' ) + Name + wxChar( '*' ); wxString wildname = wxChar( '*' ) + Name + wxChar( '*' );
...@@ -161,81 +178,26 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -161,81 +178,26 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
} }
} }
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( Entry == NULL ) if( Entry == NULL )
{ {
msg = _( "Failed to find part " ) + Name + _( " in library" ); msg = _( "Failed to find part " ) + Name + _( " in library" );
DisplayError( this, msg, 10 ); DisplayError( this, msg );
return NULL; return NULL;
} }
lastCommponentName = Name;
AddHistoryComponentName( HistoryList, Name ); AddHistoryComponentName( HistoryList, Name );
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp; DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
Component = new SCH_COMPONENT( GetScreen()->m_Curseur ); Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
Component->m_Multi = 1; /* Selection de l'unite 1 dans le boitier */ GetScreen()->m_Curseur, true );
Component->m_Convert = 1;
Component->m_ChipName = Name;
Component->m_TimeStamp = GetTimeStamp();
Component->m_Flags = IS_NEW | IS_MOVED;
/* Init champ Valeur */
Component->GetField( VALUE )->m_Pos = Entry->m_Name.m_Pos + Component->m_Pos;
Component->GetField( VALUE )->ImportValues( Entry->m_Name );
Component->GetField( VALUE )->m_Text = Component->m_ChipName;
msg = Entry->m_Prefix.m_Text;
if( msg.IsEmpty() )
msg = wxT( "U" );
msg += wxT( "?" );
// update the reference -- just the prefix for now.
Component->SetRef( GetSheet(), msg );
/* Init champ Reference */
Component->GetField( REFERENCE )->m_Pos =
Entry->m_Prefix.m_Pos + Component->m_Pos;
Component->GetField( REFERENCE )->ImportValues( Entry->m_Prefix );
Component->m_PrefixString = Entry->m_Prefix.m_Text;
/* Init des autres champs si predefinis dans la librairie */
LIB_FIELD* EntryField;
for( EntryField = Entry->m_Fields; EntryField != NULL;
EntryField = EntryField->Next() )
{
if( EntryField->m_Text.IsEmpty() && EntryField->m_Name.IsEmpty() )
continue;
ii = EntryField->m_FieldId;
if( ii < 2 ) // Reference or value, already done
continue;
if( ii >= Component->GetFieldCount() )
{ // This entry has more than the default count: add extra fields
while( ii >= Component->GetFieldCount() )
{
int field_id = Component->GetFieldCount();
SCH_CMP_FIELD field( wxPoint( 0, 0 ), field_id, Component,
ReturnDefaultFieldName( ii ) );
Component->AddField( field );
}
}
SCH_CMP_FIELD* curr_field = Component->GetField( ii );
curr_field->m_Pos = Component->m_Pos + EntryField->m_Pos; DrawStructsInGhost( DrawPanel, DC, Component, wxPoint( 0, 0 ) );
curr_field->ImportValues( *EntryField );
curr_field->m_Text = EntryField->m_Text;
curr_field->m_Name = ( ii < FIELD1 ) ? ReturnDefaultFieldName( ii ) : EntryField->m_Name;
}
DrawStructsInGhost( DrawPanel, DC, Component, wxPoint(0,0) );
ClearMsgPanel();
Component->DisplayInfo( this ); Component->DisplayInfo( this );
return Component; return Component;
......
...@@ -64,7 +64,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) ...@@ -64,7 +64,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
wxString msg; wxString msg;
msg.Printf( _( "Component library file <%s> is empty." ), msg.Printf( _( "Component library file <%s> is empty." ),
(const wxChar*) fn.GetFullPath() ); GetChars( fn.GetFullPath() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
......
...@@ -53,7 +53,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName ) ...@@ -53,7 +53,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
if( !libCache->Save( ArchFullFileName ) ) if( !libCache->Save( ArchFullFileName ) )
{ {
msg.Printf( _( "An error occurrred attempting to save component \ msg.Printf( _( "An error occurrred attempting to save component \
library <%s>." ), (const wxChar*) ArchFullFileName ); library <%s>." ), GetChars( ArchFullFileName ) );
DisplayError( frame, msg ); DisplayError( frame, msg );
return false; return false;
} }
......
...@@ -100,8 +100,8 @@ saved.\n\nDiscard current changes?" ) ) ) ...@@ -100,8 +100,8 @@ saved.\n\nDiscard current changes?" ) ) )
{ {
msg.Printf( _( "Component or alias name \"%s\" not found in \ msg.Printf( _( "Component or alias name \"%s\" not found in \
library \"%s\"." ), library \"%s\"." ),
(const wxChar*) CmpName, GetChars( CmpName ),
(const wxChar*) m_library->GetName() ); GetChars( m_library->GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -136,7 +136,7 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry, ...@@ -136,7 +136,7 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
if( LibEntry->GetName().IsEmpty() ) if( LibEntry->GetName().IsEmpty() )
{ {
wxLogWarning( wxT( "Entry in library <%s> has empty name field." ), wxLogWarning( wxT( "Entry in library <%s> has empty name field." ),
(const wxChar*) LibEntry ); GetChars( Library->GetName() ) );
return false; return false;
} }
...@@ -151,8 +151,8 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry, ...@@ -151,8 +151,8 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
wxASSERT( component != NULL && component->Type == ROOT ); wxASSERT( component != NULL && component->Type == ROOT );
wxLogDebug( wxT( "\"<%s>\" is alias of \"<%s>\"" ), wxLogDebug( wxT( "\"<%s>\" is alias of \"<%s>\"" ),
(const wxChar*) cmpName, GetChars( cmpName ),
(const wxChar*) component->GetName() ); GetChars( component->GetName() ) );
m_aliasName = cmpName; m_aliasName = cmpName;
} }
...@@ -169,8 +169,8 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry, ...@@ -169,8 +169,8 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
if( m_component == NULL ) if( m_component == NULL )
{ {
msg.Printf( _( "Could not create copy of part <%s> in library <%s>." ), msg.Printf( _( "Could not create copy of part <%s> in library <%s>." ),
(const wxChar*) LibEntry->GetName(), GetChars( LibEntry->GetName() ),
(const wxChar*) Library->GetName() ); GetChars( Library->GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return false; return false;
} }
...@@ -393,7 +393,7 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event ) ...@@ -393,7 +393,7 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
if( ListNames.IsEmpty() ) if( ListNames.IsEmpty() )
{ {
msg.Printf( _( "Component library <%s> is empty." ), msg.Printf( _( "Component library <%s> is empty." ),
( const wxChar* ) m_library->GetName() ); GetChars( m_library->GetName() ) );
wxMessageBox( msg, _( "Delete Entry Error" ), wxMessageBox( msg, _( "Delete Entry Error" ),
wxID_OK | wxICON_EXCLAMATION, this ); wxID_OK | wxICON_EXCLAMATION, this );
return; return;
...@@ -401,7 +401,7 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event ) ...@@ -401,7 +401,7 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
msg.Printf( _( "Select 1 of %d components to delete\nfrom library <%s>." ), msg.Printf( _( "Select 1 of %d components to delete\nfrom library <%s>." ),
ListNames.GetCount(), ListNames.GetCount(),
( const wxChar* ) m_library->GetName() ); GetChars( m_library->GetName() ) );
wxSingleChoiceDialog dlg( this, msg, _( "Delete Component" ), ListNames ); wxSingleChoiceDialog dlg( this, msg, _( "Delete Component" ), ListNames );
...@@ -413,15 +413,15 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event ) ...@@ -413,15 +413,15 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
if( LibEntry == NULL ) if( LibEntry == NULL )
{ {
msg.Printf( _( "Entry <%s> not found in library <%s>." ), msg.Printf( _( "Entry <%s> not found in library <%s>." ),
( const wxChar* ) dlg.GetStringSelection(), GetChars( dlg.GetStringSelection() ),
( const wxChar* ) m_library->GetName() ); GetChars( m_library->GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
msg.Printf( _( "Delete component \"%s\" from library \"%s\"?" ), msg.Printf( _( "Delete component \"%s\" from library \"%s\"?" ),
(const wxChar*) LibEntry->GetName(), GetChars( LibEntry->GetName() ),
(const wxChar*) m_library->GetName() ); GetChars( m_library->GetName() ) );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
return; return;
...@@ -520,8 +520,8 @@ lost!\n\nClear the current component from the screen?" ) ) ) ...@@ -520,8 +520,8 @@ lost!\n\nClear the current component from the screen?" ) ) )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Component \"%s\" already exists in library \"%s\"." ), msg.Printf( _( "Component \"%s\" already exists in library \"%s\"." ),
(const wxChar*) name, GetChars( name ),
(const wxChar*) m_library->GetName() ); GetChars( m_library->GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -604,7 +604,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory() ...@@ -604,7 +604,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
if( oldComponent != NULL ) if( oldComponent != NULL )
{ {
msg.Printf( _( "Component \"%s\" exists. Change it?" ), msg.Printf( _( "Component \"%s\" exists. Change it?" ),
(const wxChar*) oldComponent->GetName() ); GetChars( oldComponent->GetName() ) );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
return; return;
} }
...@@ -622,7 +622,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory() ...@@ -622,7 +622,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
return; return;
msg.Printf( _( "Component %s saved in library %s" ), msg.Printf( _( "Component %s saved in library %s" ),
( const wxChar* ) Component->GetName(), GetChars( Component->GetName() ),
( const wxChar* ) m_library->GetName() ); GetChars( m_library->GetName() ) );
Affiche_Message( msg ); Affiche_Message( msg );
} }
...@@ -175,8 +175,8 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field ) ...@@ -175,8 +175,8 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
msg.Printf( _( "The field name <%s> is an existing alias of the \ msg.Printf( _( "The field name <%s> is an existing alias of the \
component <%s>.\nPlease choose another name that does not conflict with any \ component <%s>.\nPlease choose another name that does not conflict with any \
names in the alias list." ), names in the alias list." ),
(const wxChar*) Text, GetChars( Text ),
(const wxChar*) Field->GetParent()->GetName() ); GetChars( Field->GetParent()->GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -189,8 +189,8 @@ names in the alias list." ), ...@@ -189,8 +189,8 @@ names in the alias list." ),
msg.Printf( _( "The field name <%s> conflicts with an existing \ msg.Printf( _( "The field name <%s> conflicts with an existing \
entry in the component library <%s>.\nPlease choose another name that does \ entry in the component library <%s>.\nPlease choose another name that does \
not conflict with any library entries." ), not conflict with any library entries." ),
(const wxChar*) Text, GetChars( Text ),
(const wxChar*) m_library->GetName() ); GetChars( m_library->GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
......
...@@ -256,7 +256,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -256,7 +256,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ), msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ),
(const wxChar*) lib.GetName() ); GetChars( lib.GetName() ) );
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
{ {
Event.Veto(); Event.Veto();
......
...@@ -50,6 +50,7 @@ public: ...@@ -50,6 +50,7 @@ public:
int BestZoom(); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void ClickOnLibList( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
...@@ -60,6 +61,9 @@ public: ...@@ -60,6 +61,9 @@ public:
wxString& GetEntryName( void ) const { return m_entryName; } wxString& GetEntryName( void ) const { return m_entryName; }
int GetUnit( void ) { return m_unit; }
int GetConvert( void ) { return m_convert; }
private: private:
void SelectCurrentLibrary(); void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option ); void SelectAndViewLibraryPart( int option );
......
...@@ -966,10 +966,10 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event ) ...@@ -966,10 +966,10 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
curr_pin->ReturnPinStringNum( StringPinNum ); curr_pin->ReturnPinStringNum( StringPinNum );
msg.Printf( _( "Duplicate pin %s at location (%d, %d) conflicts \ msg.Printf( _( "Duplicate pin %s at location (%d, %d) conflicts \
with pin %s at location (%d, %d)" ), with pin %s at location (%d, %d)" ),
(const wxChar*) StringPinNum, GetChars( StringPinNum ),
(const wxChar*) curr_pin->m_PinName, GetChars( curr_pin->m_PinName ),
curr_pin->m_Pos.x, -curr_pin->m_Pos.y, curr_pin->m_Pos.x, -curr_pin->m_Pos.y,
(const wxChar*) Pin->m_PinName, GetChars( Pin->m_PinName ),
Pin->m_Pos.x, -Pin->m_Pos.y ); Pin->m_Pos.x, -Pin->m_Pos.y );
if( m_component->GetPartCount() > 1 ) if( m_component->GetPartCount() > 1 )
......
...@@ -48,20 +48,6 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, ...@@ -48,20 +48,6 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
SCH_COMPONENT* m_Cmp ); SCH_COMPONENT* m_Cmp );
/******************************/
/* EELIBS_DRAW_COMPONENTS.CPP */
/******************************/
void DrawingLibInGhost( WinEDA_DrawPanel* panel,
wxDC* DC,
LIB_COMPONENT* LibEntry,
SCH_COMPONENT* DrawLibItem,
int PartX,
int PartY,
int Multi,
int convert,
int Color,
bool DrawPinText );
bool MapAngles( int* Angle1, bool MapAngles( int* Angle1,
int* Angle2, int* Angle2,
const int TransMat[2][2] ); const int TransMat[2][2] );
......
...@@ -66,7 +66,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -66,7 +66,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( ImportFile == NULL ) if( ImportFile == NULL )
{ {
msg.Printf( _( "Failed to open Symbol File <%s>" ), msg.Printf( _( "Failed to open Symbol File <%s>" ),
(const wxChar*) fn.GetFullPath() ); GetChars( fn.GetFullPath() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -76,7 +76,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -76,7 +76,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( !Lib->Load( err ) ) if( !Lib->Load( err ) )
{ {
msg.Printf( _( "Error <%s> occurred loading symbol library <%s>." ), msg.Printf( _( "Error <%s> occurred loading symbol library <%s>." ),
(const wxChar*) err, (const wxChar*) fn.GetName() ); GetChars( err ), GetChars( fn.GetName() ) );
DisplayError( this, msg ); DisplayError( this, msg );
fclose( ImportFile ); fclose( ImportFile );
delete Lib; delete Lib;
...@@ -88,7 +88,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void ) ...@@ -88,7 +88,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( Lib->IsEmpty() ) if( Lib->IsEmpty() )
{ {
msg.Printf( _( "No components found in symbol library <%s>." ), msg.Printf( _( "No components found in symbol library <%s>." ),
(const wxChar*) fn.GetName() ); GetChars( fn.GetName() ) );
delete Lib; delete Lib;
return; return;
} }
...@@ -166,12 +166,12 @@ void WinEDA_LibeditFrame::SaveOneSymbol() ...@@ -166,12 +166,12 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
if( ExportFile == NULL ) if( ExportFile == NULL )
{ {
msg.Printf( _( "Unable to create <%s>" ), msg.Printf( _( "Unable to create <%s>" ),
(const wxChar*) fn.GetFullPath() ); GetChars( fn.GetFullPath() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
msg.Printf( _( "Save Symbol in [%s]" ), (const wxChar*) fn.GetPath() ); msg.Printf( _( "Save Symbol in [%s]" ), GetChars( fn.GetPath() ) );
Affiche_Message( msg ); Affiche_Message( msg );
/* Creation de l'entete de la librairie */ /* Creation de l'entete de la librairie */
......
...@@ -39,7 +39,6 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame ) ...@@ -39,7 +39,6 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
EVT_SASH_DRAGGED( ID_LIBVIEW_LIBWINDOW, WinEDA_ViewlibFrame::OnSashDrag ) EVT_SASH_DRAGGED( ID_LIBVIEW_LIBWINDOW, WinEDA_ViewlibFrame::OnSashDrag )
EVT_SASH_DRAGGED( ID_LIBVIEW_CMPWINDOW, WinEDA_ViewlibFrame::OnSashDrag ) EVT_SASH_DRAGGED( ID_LIBVIEW_CMPWINDOW, WinEDA_ViewlibFrame::OnSashDrag )
/* Toolbar events */ /* Toolbar events */
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
WinEDA_ViewlibFrame::Process_Special_Functions ) WinEDA_ViewlibFrame::Process_Special_Functions )
...@@ -53,6 +52,9 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame ) ...@@ -53,6 +52,9 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
/* listbox events */ /* listbox events */
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList ) EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList ) EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
EVT_MENU( ID_SET_RELATIVE_OFFSET,
WinEDA_ViewlibFrame::OnSetRelativeOffset )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -67,7 +69,8 @@ static wxAcceleratorEntry accels[] = ...@@ -67,7 +69,8 @@ static wxAcceleratorEntry accels[] =
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ), wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ) wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_SPACE, ID_SET_RELATIVE_OFFSET )
}; };
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) ) #define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
...@@ -278,6 +281,13 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv ) ...@@ -278,6 +281,13 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
} }
void WinEDA_ViewlibFrame::OnSetRelativeOffset( wxCommandEvent& event )
{
GetScreen()->m_O_Curseur = GetScreen()->m_Curseur;
UpdateStatusBar();
}
int WinEDA_ViewlibFrame::BestZoom() int WinEDA_ViewlibFrame::BestZoom()
{ {
int bestzoom, ii, jj; int bestzoom, ii, jj;
...@@ -443,8 +453,8 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event ) ...@@ -443,8 +453,8 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
{ {
m_entryName = name; m_entryName = name;
DisplayLibInfos(); DisplayLibInfos();
m_unit = 1; m_unit = 0;
m_convert = 1; m_convert = 0;
Zoom_Automatique( false ); Zoom_Automatique( false );
ReCreateHToolbar(); ReCreateHToolbar();
DrawPanel->Refresh(); DrawPanel->Refresh();
......
...@@ -8,15 +8,51 @@ ...@@ -8,15 +8,51 @@
#define __INCLUDE__GET_COMPONENT_DIALOG_H__ 1 #define __INCLUDE__GET_COMPONENT_DIALOG_H__ 1
wxString GetComponentName( WinEDA_DrawFrame * frame, wxPoint GetComponentDialogPosition( void );
wxArrayString & HistoryList, const wxString &Title,
wxString (*AuxTool)( WinEDA_DrawFrame * parent ) );
/* Dialog frame to choose a component name */ void AddHistoryComponentName( wxArrayString& HistoryList,
void AddHistoryComponentName( wxArrayString& HistoryList, const wxString& Name ); const wxString& Name );
/* Add the string "Name" to the history list */ /* Add the string "Name" to the history list */
enum selcmp_id {
ID_ACCEPT_NAME = 3900,
ID_ACCEPT_KEYWORD,
ID_ENTER_NAME,
ID_CANCEL,
ID_LIST_ALL,
ID_EXTRA_TOOL,
ID_SEL_BY_LISTBOX
};
#endif /* __INCLUDE__GET_COMPONENT_DIALOG_H__ */ /* Dialog frame to choose a component name */
class WinEDA_SelectCmp : public wxDialog
{
private:
bool m_AuxTool;
wxString m_Text;
wxTextCtrl* m_TextCtrl;
wxListBox* m_List;
public:
bool m_GetExtraFunction;
public:
// Constructor and destructor
WinEDA_SelectCmp( WinEDA_DrawFrame* parent, const wxPoint& framepos,
wxArrayString& HistoryList, const wxString& Title,
bool show_extra_tool );
~WinEDA_SelectCmp() {};
wxString GetComponentName( void );
void SetComponentName( const wxString& name );
private:
void Accept( wxCommandEvent& event );
void GetExtraSelection( wxCommandEvent& event );
DECLARE_EVENT_TABLE()
};
#endif /* __INCLUDE__GET_COMPONENT_DIALOG_H__ */
...@@ -319,6 +319,11 @@ private: ...@@ -319,6 +319,11 @@ private:
DrawSheetStruct* CreateSheet( wxDC* DC ); DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ); void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
/**
* Use the component viewer to select component to import into schematic.
*/
wxString SelectFromLibBrowser( void );
public: public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC ); bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
......
...@@ -577,8 +577,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -577,8 +577,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
wxString txt; wxString txt;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->ClearMsgPanel();
msgpanel->EraseMsgBox();
int viasCount = 0; int viasCount = 0;
for( BOARD_ITEM* item = m_Track; item; item = item->Next() ) for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
...@@ -588,16 +587,16 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -588,16 +587,16 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
} }
txt.Printf( wxT( "%d" ), GetPadsCount() ); txt.Printf( wxT( "%d" ), GetPadsCount() );
msgpanel->AppendMessage( _( "Pads" ), txt, DARKGREEN ); frame->AppendMsgPanel( _( "Pads" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), viasCount ); txt.Printf( wxT( "%d" ), viasCount );
msgpanel->AppendMessage( _( "Vias" ), txt, DARKGREEN ); frame->AppendMsgPanel( _( "Vias" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetNodesCount() ); txt.Printf( wxT( "%d" ), GetNodesCount() );
msgpanel->AppendMessage( _( "Nodes" ), txt, DARKCYAN ); frame->AppendMsgPanel( _( "Nodes" ), txt, DARKCYAN );
txt.Printf( wxT( "%d" ), m_NetInfo->GetCount() ); txt.Printf( wxT( "%d" ), m_NetInfo->GetCount() );
msgpanel->AppendMessage( _( "Nets" ), txt, RED ); frame->AppendMsgPanel( _( "Nets" ), txt, RED );
/* These parameters are known only if the full ratsnest is available, /* These parameters are known only if the full ratsnest is available,
* so, display them only if this is the case * so, display them only if this is the case
...@@ -605,13 +604,13 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -605,13 +604,13 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
if( (m_Status_Pcb & NET_CODES_OK) ) if( (m_Status_Pcb & NET_CODES_OK) )
{ {
txt.Printf( wxT( "%d" ), GetRatsnestsCount() ); txt.Printf( wxT( "%d" ), GetRatsnestsCount() );
msgpanel->AppendMessage( _( "Links" ), txt, DARKGREEN ); frame->AppendMsgPanel( _( "Links" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetNoconnectCount() ); txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetNoconnectCount() );
msgpanel->AppendMessage( _( "Connect" ), txt, DARKGREEN ); frame->AppendMsgPanel( _( "Connect" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetNoconnectCount() ); txt.Printf( wxT( "%d" ), GetNoconnectCount() );
msgpanel->AppendMessage( _( "NoConn" ), txt, BLUE ); frame->AppendMsgPanel( _( "NoConn" ), txt, BLUE );
} }
} }
......
...@@ -362,34 +362,33 @@ void DRAWSEGMENT::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -362,34 +362,33 @@ void DRAWSEGMENT::DisplayInfo( WinEDA_DrawFrame* frame )
BOARD* board = (BOARD*) m_Parent; BOARD* board = (BOARD*) m_Parent;
wxASSERT( board ); wxASSERT( board );
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->ClearMsgPanel();
msgpanel->EraseMsgBox();
itype = m_Type & 0x0F; itype = m_Type & 0x0F;
msg = wxT( "DRAWING" ); msg = wxT( "DRAWING" );
msgpanel->AppendMessage( _( "Type" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
wxString shape = _( "Shape" ); wxString shape = _( "Shape" );
switch( m_Shape ) { switch( m_Shape ) {
case S_CIRCLE: case S_CIRCLE:
msgpanel->AppendMessage( shape, _( "Circle" ), RED ); frame->AppendMsgPanel( shape, _( "Circle" ), RED );
break; break;
case S_ARC: case S_ARC:
msgpanel->AppendMessage( shape, _( "Arc" ), RED ); frame->AppendMsgPanel( shape, _( "Arc" ), RED );
msg.Printf( wxT( "%1." ), (float)m_Angle/10 ); msg.Printf( wxT( "%1." ), (float)m_Angle/10 );
msgpanel->AppendMessage( _("Angle"), msg, RED ); frame->AppendMsgPanel( _("Angle"), msg, RED );
break; break;
case S_CURVE: case S_CURVE:
msgpanel->AppendMessage( shape, _( "Curve" ), RED ); frame->AppendMsgPanel( shape, _( "Curve" ), RED );
break; break;
default: default:
msgpanel->AppendMessage( shape, _( "Segment" ), RED ); frame->AppendMsgPanel( shape, _( "Segment" ), RED );
} }
wxString start; wxString start;
start << GetStart(); start << GetStart();
...@@ -397,13 +396,13 @@ void DRAWSEGMENT::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -397,13 +396,13 @@ void DRAWSEGMENT::DisplayInfo( WinEDA_DrawFrame* frame )
wxString end; wxString end;
end << GetEnd(); end << GetEnd();
msgpanel->AppendMessage( start, end, DARKGREEN ); frame->AppendMsgPanel( start, end, DARKGREEN );
msgpanel->AppendMessage( _( "Layer" ), frame->AppendMsgPanel( _( "Layer" ),
board->GetLayerName( m_Layer ), DARKBROWN ); board->GetLayerName( m_Layer ), DARKBROWN );
valeur_param( (unsigned) m_Width, msg ); valeur_param( (unsigned) m_Width, msg );
msgpanel->AppendMessage( _( "Width" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
} }
......
...@@ -231,23 +231,22 @@ void EDGE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -231,23 +231,22 @@ void EDGE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
if( !board ) if( !board )
return; return;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->ClearMsgPanel();
msgpanel->EraseMsgBox();
msgpanel->AppendMessage( _( "Graphic Item" ), wxEmptyString, DARKCYAN ); frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN );
msgpanel->AppendMessage( _( "Module" ), module->m_Reference->m_Text, DARKCYAN ); frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
msgpanel->AppendMessage( _( "Value" ), module->m_Value->m_Text, BLUE ); frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp ); msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
msgpanel->AppendMessage( _( "TimeStamp" ), msg, BROWN ); frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN );
msgpanel->AppendMessage( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED ); frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
msgpanel->AppendMessage( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED ); frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );
valeur_param( m_Width, msg ); valeur_param( m_Width, msg );
msgpanel->AppendMessage( _( "Width" ), msg, BLUE ); frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
} }
......
...@@ -57,18 +57,17 @@ MARKER_PCB::~MARKER_PCB() ...@@ -57,18 +57,17 @@ MARKER_PCB::~MARKER_PCB()
void MARKER_PCB::DisplayInfo( WinEDA_DrawFrame* frame ) void MARKER_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->ClearMsgPanel();
msgpanel->EraseMsgBox();
const DRC_ITEM& rpt = m_drc; const DRC_ITEM& rpt = m_drc;
msgpanel->AppendMessage( _( "Type" ), _("Marker"), DARKCYAN ); frame->AppendMsgPanel( _( "Type" ), _("Marker"), DARKCYAN );
wxString errorTxt; wxString errorTxt;
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":"); errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
msgpanel->AppendMessage( errorTxt, wxEmptyString, RED ); frame->AppendMsgPanel( errorTxt, wxEmptyString, RED );
wxString txtA; wxString txtA;
txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT(": ") << rpt.GetTextA(); txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT(": ") << rpt.GetTextA();
...@@ -77,7 +76,7 @@ void MARKER_PCB::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -77,7 +76,7 @@ void MARKER_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
if ( rpt.HasSecondItem() ) if ( rpt.HasSecondItem() )
txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB(); txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB();
msgpanel->AppendMessage( txtA, txtB, DARKBROWN ); frame->AppendMsgPanel( txtA, txtB, DARKBROWN );
} }
/** /**
......
...@@ -800,14 +800,13 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -800,14 +800,13 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
bool flag = FALSE; bool flag = FALSE;
wxString msg; wxString msg;
BOARD* board = (BOARD*) m_Parent; BOARD* board = (BOARD*) m_Parent;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox(); frame->EraseMsgBox();
if( frame->m_Ident != PCB_FRAME ) if( frame->m_Ident != PCB_FRAME )
flag = TRUE; flag = TRUE;
msgpanel->AppendMessage( m_Reference->m_Text, m_Value->m_Text, frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text,
DARKCYAN ); DARKCYAN );
if( flag ) // Display last date the component was edited( useful in Module Editor) if( flag ) // Display last date the component was edited( useful in Module Editor)
{ {
...@@ -819,15 +818,15 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -819,15 +818,15 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
strtok( NULL, " \n\r" ); strtok( NULL, " \n\r" );
strcat( bufcar, strtok( NULL, " \n\r" ) ); strcat( bufcar, strtok( NULL, " \n\r" ) );
msg = CONV_FROM_UTF8( bufcar ); msg = CONV_FROM_UTF8( bufcar );
msgpanel->AppendMessage( _( "Last Change" ), msg, BROWN ); frame->AppendMsgPanel( _( "Last Change" ), msg, BROWN );
} }
else // displa time stamp in schematic else // displa time stamp in schematic
{ {
msg.Printf( wxT( "%8.8lX" ), m_TimeStamp ); msg.Printf( wxT( "%8.8lX" ), m_TimeStamp );
msgpanel->AppendMessage( _( "Netlist path" ), m_Path, BROWN ); frame->AppendMsgPanel( _( "Netlist path" ), m_Path, BROWN );
} }
msgpanel->AppendMessage( _( "Layer" ), board->GetLayerName( m_Layer ), RED ); frame->AppendMsgPanel( _( "Layer" ), board->GetLayerName( m_Layer ), RED );
EDA_BaseStruct* PtStruct = m_Pads; EDA_BaseStruct* PtStruct = m_Pads;
nbpad = 0; nbpad = 0;
...@@ -838,29 +837,29 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -838,29 +837,29 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
} }
msg.Printf( wxT( "%d" ), nbpad ); msg.Printf( wxT( "%d" ), nbpad );
msgpanel->AppendMessage( _( "Pads" ), msg, BLUE ); frame->AppendMsgPanel( _( "Pads" ), msg, BLUE );
msg = wxT( ".." ); msg = wxT( ".." );
if( IsLocked() ) if( IsLocked() )
msg[0] = 'L'; msg[0] = 'L';
if( m_ModuleStatus & MODULE_is_PLACED ) if( m_ModuleStatus & MODULE_is_PLACED )
msg[1] = 'P'; msg[1] = 'P';
msgpanel->AppendMessage( _( "Stat" ), msg, MAGENTA ); frame->AppendMsgPanel( _( "Stat" ), msg, MAGENTA );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
msgpanel->AppendMessage( _( "Orient" ), msg, BROWN ); frame->AppendMsgPanel( _( "Orient" ), msg, BROWN );
msgpanel->AppendMessage( _( "Module" ), m_LibRef, BLUE ); frame->AppendMsgPanel( _( "Module" ), m_LibRef, BLUE );
if( m_3D_Drawings != NULL ) if( m_3D_Drawings != NULL )
msg = m_3D_Drawings->m_Shape3DName; msg = m_3D_Drawings->m_Shape3DName;
else else
msg = _("No 3D shape"); msg = _("No 3D shape");
msgpanel->AppendMessage( _( "3D-Shape" ), msg, RED ); frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED );
wxString doc = _( "Doc: " ) + m_Doc; wxString doc = _( "Doc: " ) + m_Doc;
wxString keyword = _( "KeyW: " ) + m_KeyWord; wxString keyword = _( "KeyW: " ) + m_KeyWord;
msgpanel->AppendMessage( doc, keyword, BLACK ); frame->AppendMsgPanel( doc, keyword, BLACK );
} }
......
...@@ -128,13 +128,12 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -128,13 +128,12 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
D_PAD* pad; D_PAD* pad;
double lengthnet = 0; double lengthnet = 0;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->ClearMsgPanel();
msgpanel->EraseMsgBox();
msgpanel->AppendMessage( _( "Net Name" ), GetNetname(), RED ); frame->AppendMsgPanel( _( "Net Name" ), GetNetname(), RED );
txt.Printf( wxT( "%d" ), GetNet() ); txt.Printf( wxT( "%d" ), GetNet() );
msgpanel->AppendMessage( _( "Net Code" ), txt, RED ); frame->AppendMsgPanel( _( "Net Code" ), txt, RED );
count = 0; count = 0;
module = ( (WinEDA_BasePcbFrame*) frame )->GetBoard()->m_Modules; module = ( (WinEDA_BasePcbFrame*) frame )->GetBoard()->m_Modules;
...@@ -148,7 +147,7 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -148,7 +147,7 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
} }
txt.Printf( wxT( "%d" ), count ); txt.Printf( wxT( "%d" ), count );
msgpanel->AppendMessage( _( "Pads" ), txt, DARKGREEN ); frame->AppendMsgPanel( _( "Pads" ), txt, DARKGREEN );
count = 0; count = 0;
Struct = ( (WinEDA_BasePcbFrame*) frame )->GetBoard()->m_Track; Struct = ( (WinEDA_BasePcbFrame*) frame )->GetBoard()->m_Track;
...@@ -163,10 +162,10 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -163,10 +162,10 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
} }
txt.Printf( wxT( "%d" ), count ); txt.Printf( wxT( "%d" ), count );
msgpanel->AppendMessage( _( "Vias" ), txt, BLUE ); frame->AppendMsgPanel( _( "Vias" ), txt, BLUE );
valeur_param( (int) lengthnet, txt ); valeur_param( (int) lengthnet, txt );
msgpanel->AppendMessage( _( "Net Length" ), txt, RED ); frame->AppendMsgPanel( _( "Net Length" ), txt, RED );
} }
......
...@@ -452,24 +452,23 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -452,24 +452,23 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
{ wxT( "norm" ), wxT( "smd " ), wxT( "conn" ), wxT( "????" ) }; { wxT( "norm" ), wxT( "smd " ), wxT( "conn" ), wxT( "????" ) };
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->EraseMsgBox();
msgpanel->EraseMsgBox();
/* Recherche du module correspondant */ /* Recherche du module correspondant */
module = (MODULE*) m_Parent; module = (MODULE*) m_Parent;
if( module ) if( module )
{ {
wxString msg = module->GetReference(); wxString msg = module->GetReference();
msgpanel->AppendMessage( _( "Module" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Module" ), msg, DARKCYAN );
ReturnStringPadName( Line ); ReturnStringPadName( Line );
msgpanel->AppendMessage( _( "RefP" ), Line, BROWN ); frame->AppendMsgPanel( _( "RefP" ), Line, BROWN );
} }
msgpanel->AppendMessage( _( "Net" ), m_Netname, DARKCYAN ); frame->AppendMsgPanel( _( "Net" ), m_Netname, DARKCYAN );
/* For test and debug only: display m_physical_connexion and m_logical_connexion */ /* For test and debug only: display m_physical_connexion and m_logical_connexion */
#if 1 // Used only to debug connectivity calculations #if 1 // Used only to debug connectivity calculations
Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(), GetSubNet(), m_ZoneSubnet ); Line.Printf( wxT( "%d-%d-%d " ), GetSubRatsnest(), GetSubNet(), m_ZoneSubnet );
msgpanel->AppendMessage( wxT( "L-P-Z" ), Line, DARKGREEN ); frame->AppendMsgPanel( wxT( "L-P-Z" ), Line, DARKGREEN );
#endif #endif
wxString LayerInfo; wxString LayerInfo;
...@@ -546,24 +545,24 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -546,24 +545,24 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
break; break;
} }
} }
msgpanel->AppendMessage( _( "Layer" ), LayerInfo, DARKGREEN ); frame->AppendMsgPanel( _( "Layer" ), LayerInfo, DARKGREEN );
int attribut = m_Attribut & 15; int attribut = m_Attribut & 15;
if( attribut > 3 ) if( attribut > 3 )
attribut = 3; attribut = 3;
msgpanel->AppendMessage( Msg_Pad_Shape[m_PadShape], frame->AppendMsgPanel( Msg_Pad_Shape[m_PadShape],
Msg_Pad_Attribut[attribut], DARKGREEN ); Msg_Pad_Attribut[attribut], DARKGREEN );
valeur_param( m_Size.x, Line ); valeur_param( m_Size.x, Line );
msgpanel->AppendMessage( _( "H Size" ), Line, RED ); frame->AppendMsgPanel( _( "H Size" ), Line, RED );
valeur_param( m_Size.y, Line ); valeur_param( m_Size.y, Line );
msgpanel->AppendMessage( _( "V Size" ), Line, RED ); frame->AppendMsgPanel( _( "V Size" ), Line, RED );
valeur_param( (unsigned) m_Drill.x, Line ); valeur_param( (unsigned) m_Drill.x, Line );
if( m_DrillShape == PAD_CIRCLE ) if( m_DrillShape == PAD_CIRCLE )
{ {
msgpanel->AppendMessage( _( "Drill" ), Line, RED ); frame->AppendMsgPanel( _( "Drill" ), Line, RED );
} }
else else
{ {
...@@ -571,7 +570,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -571,7 +570,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
wxString msg; wxString msg;
valeur_param( (unsigned) m_Drill.y, msg ); valeur_param( (unsigned) m_Drill.y, msg );
Line += wxT( " / " ) + msg; Line += wxT( " / " ) + msg;
msgpanel->AppendMessage( _( "Drill X / Y" ), Line, RED ); frame->AppendMsgPanel( _( "Drill X / Y" ), Line, RED );
} }
...@@ -581,13 +580,13 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -581,13 +580,13 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
(float) ( m_Orient - module_orient ) / 10, (float) module_orient / 10 ); (float) ( m_Orient - module_orient ) / 10, (float) module_orient / 10 );
else else
Line.Printf( wxT( "%3.1f" ), (float) m_Orient / 10 ); Line.Printf( wxT( "%3.1f" ), (float) m_Orient / 10 );
msgpanel->AppendMessage( _( "Orient" ), Line, BLUE ); frame->AppendMsgPanel( _( "Orient" ), Line, BLUE );
valeur_param( m_Pos.x, Line ); valeur_param( m_Pos.x, Line );
msgpanel->AppendMessage( _( "X Pos" ), Line, BLUE ); frame->AppendMsgPanel( _( "X Pos" ), Line, BLUE );
valeur_param( m_Pos.y, Line ); valeur_param( m_Pos.y, Line );
msgpanel->AppendMessage( _( "Y pos" ), Line, BLUE ); frame->AppendMsgPanel( _( "Y pos" ), Line, BLUE );
} }
......
...@@ -231,33 +231,32 @@ void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -231,33 +231,32 @@ void TEXTE_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
board = (BOARD*) parent; board = (BOARD*) parent;
wxASSERT( board ); wxASSERT( board );
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->ClearMsgPanel();
msgpanel->EraseMsgBox();
if( m_Parent && m_Parent->Type() == TYPE_COTATION ) if( m_Parent && m_Parent->Type() == TYPE_COTATION )
msgpanel->AppendMessage( _( "COTATION" ), m_Text, DARKGREEN ); frame->AppendMsgPanel( _( "COTATION" ), m_Text, DARKGREEN );
else else
msgpanel->AppendMessage( _( "PCB Text" ), m_Text, DARKGREEN ); frame->AppendMsgPanel( _( "PCB Text" ), m_Text, DARKGREEN );
msgpanel->AppendMessage( _( "Layer" ), frame->AppendMsgPanel( _( "Layer" ),
board->GetLayerName( m_Layer ), BLUE ); board->GetLayerName( m_Layer ), BLUE );
if( !m_Mirror ) if( !m_Mirror )
msgpanel->AppendMessage( _( "Mirror" ), _( "No" ), DARKGREEN ); frame->AppendMsgPanel( _( "Mirror" ), _( "No" ), DARKGREEN );
else else
msgpanel->AppendMessage( _( "Mirror" ), _( "Yes" ), DARKGREEN ); frame->AppendMsgPanel( _( "Mirror" ), _( "Yes" ), DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
msgpanel->AppendMessage( _( "Orient" ), msg, DARKGREEN ); frame->AppendMsgPanel( _( "Orient" ), msg, DARKGREEN );
valeur_param( m_Width, msg ); valeur_param( m_Width, msg );
msgpanel->AppendMessage( _( "Width" ), msg, MAGENTA ); frame->AppendMsgPanel( _( "Width" ), msg, MAGENTA );
valeur_param( m_Size.x, msg ); valeur_param( m_Size.x, msg );
msgpanel->AppendMessage( _( "H Size" ), msg, RED ); frame->AppendMsgPanel( _( "H Size" ), msg, RED );
valeur_param( m_Size.y, msg ); valeur_param( m_Size.y, msg );
msgpanel->AppendMessage( _( "V Size" ), msg, RED ); frame->AppendMsgPanel( _( "V Size" ), msg, RED );
} }
/** /**
......
...@@ -467,25 +467,24 @@ void TEXTE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -467,25 +467,24 @@ void TEXTE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
_( "Ref." ), _( "Value" ), _( "Text" ) _( "Ref." ), _( "Value" ), _( "Text" )
}; };
WinEDA_MsgPanel *msgpanel = frame->MsgPanel; frame->ClearMsgPanel();
msgpanel->EraseMsgBox();
Line = module->m_Reference->m_Text; Line = module->m_Reference->m_Text;
msgpanel->AppendMessage( _( "Module" ), Line, DARKCYAN ); frame->AppendMsgPanel( _( "Module" ), Line, DARKCYAN );
Line = m_Text; Line = m_Text;
msgpanel->AppendMessage( _( "Text" ), Line, BROWN ); frame->AppendMsgPanel( _( "Text" ), Line, BROWN );
ii = m_Type; ii = m_Type;
if( ii > 2 ) if( ii > 2 )
ii = 2; ii = 2;
msgpanel->AppendMessage( _( "Type" ), text_type_msg[ii], DARKGREEN ); frame->AppendMsgPanel( _( "Type" ), text_type_msg[ii], DARKGREEN );
if( m_NoShow ) if( m_NoShow )
msg = _( "No" ); msg = _( "No" );
else else
msg = _( "Yes" ); msg = _( "Yes" );
msgpanel->AppendMessage( _( "Display" ), msg, DARKGREEN ); frame->AppendMsgPanel( _( "Display" ), msg, DARKGREEN );
// Display text layer (use layer name if possible) // Display text layer (use layer name if possible)
BOARD* board = NULL; BOARD* board = NULL;
...@@ -494,24 +493,24 @@ void TEXTE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -494,24 +493,24 @@ void TEXTE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
msg = board->GetLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
else else
msg.Printf( wxT( "%d" ), m_Layer ); msg.Printf( wxT( "%d" ), m_Layer );
msgpanel->AppendMessage( _( "Layer" ), msg, DARKGREEN ); frame->AppendMsgPanel( _( "Layer" ), msg, DARKGREEN );
msg = _( " No" ); msg = _( " No" );
if( m_Mirror ) if( m_Mirror )
msg = _( " Yes" ); msg = _( " Yes" );
msgpanel->AppendMessage( _( "Mirror" ), msg, DARKGREEN ); frame->AppendMsgPanel( _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
msgpanel->AppendMessage( _( "Orient" ), msg, DARKGREEN ); frame->AppendMsgPanel( _( "Orient" ), msg, DARKGREEN );
valeur_param( m_Width, msg ); valeur_param( m_Width, msg );
msgpanel->AppendMessage( _( "Width" ), msg, DARKGREEN ); frame->AppendMsgPanel( _( "Width" ), msg, DARKGREEN );
valeur_param( m_Size.x, msg ); valeur_param( m_Size.x, msg );
msgpanel->AppendMessage( _( "H Size" ), msg, RED ); frame->AppendMsgPanel( _( "H Size" ), msg, RED );
valeur_param( m_Size.y, msg ); valeur_param( m_Size.y, msg );
msgpanel->AppendMessage( _( "V Size" ), msg, RED ); frame->AppendMsgPanel( _( "V Size" ), msg, RED );
} }
......
...@@ -905,9 +905,9 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -905,9 +905,9 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard(); BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard();
// Display basic infos // Display basic infos
DisplayInfoBase( frame ); DisplayInfoBase( frame );
// Display full track length (in pcbnew) // Display full track length (in pcbnew)
if( frame->m_Ident == PCB_FRAME ) if( frame->m_Ident == PCB_FRAME )
...@@ -915,7 +915,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -915,7 +915,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
int trackLen = 0; int trackLen = 0;
Marque_Une_Piste( board, this, NULL, &trackLen, false ); Marque_Une_Piste( board, this, NULL, &trackLen, false );
valeur_param( trackLen, msg ); valeur_param( trackLen, msg );
frame->MsgPanel->AppendMessage( _( "Track Len" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Track Length" ), msg, DARKCYAN );
} }
} }
...@@ -931,7 +931,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame ) ...@@ -931,7 +931,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
wxString msg; wxString msg;
BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard(); BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard();
frame->MsgPanel->EraseMsgBox(); frame->ClearMsgPanel();
switch( Type() ) switch( Type() )
{ {
...@@ -950,7 +950,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame ) ...@@ -950,7 +950,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
msg = wxT( "????" ); break; msg = wxT( "????" ); break;
} }
frame->MsgPanel->AppendMessage( _( "Type" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
// Display Net Name (in pcbnew) // Display Net Name (in pcbnew)
if( frame->m_Ident == PCB_FRAME ) if( frame->m_Ident == PCB_FRAME )
...@@ -962,18 +962,18 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame ) ...@@ -962,18 +962,18 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
else else
msg = wxT( "<noname>" ); msg = wxT( "<noname>" );
frame->MsgPanel->AppendMessage( _( "NetName" ), msg, RED ); frame->AppendMsgPanel( _( "NetName" ), msg, RED );
/* Display net code : (usefull in test or debug) */ /* Display net code : (usefull in test or debug) */
msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() ); msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() );
frame->MsgPanel->AppendMessage( _( "NetCode" ), msg, RED ); frame->AppendMsgPanel( _( "NetCode" ), msg, RED );
} }
#if defined(DEBUG) #if defined(DEBUG)
/* Display the flags */ /* Display the flags */
msg.Printf( wxT( "0x%08X" ), m_Flags ); msg.Printf( wxT( "0x%08X" ), m_Flags );
frame->MsgPanel->AppendMessage( _( "Flags" ), msg, BLUE ); frame->AppendMsgPanel( _( "Flags" ), msg, BLUE );
#endif #endif
...@@ -985,7 +985,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame ) ...@@ -985,7 +985,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
if( GetState( SEGM_AR ) ) if( GetState( SEGM_AR ) )
msg[2] = 'A'; msg[2] = 'A';
frame->MsgPanel->AppendMessage( _( "Stat" ), msg, MAGENTA ); frame->AppendMsgPanel( _( "Status" ), msg, MAGENTA );
/* Display layer or layer pair) */ /* Display layer or layer pair) */
if( Type() == TYPE_VIA ) if( Type() == TYPE_VIA )
...@@ -1000,7 +1000,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame ) ...@@ -1000,7 +1000,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
else else
msg = board->GetLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
frame->MsgPanel->AppendMessage( _( "Layer" ), msg, BROWN ); frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );
/* Display width */ /* Display width */
valeur_param( (unsigned) m_Width, msg ); valeur_param( (unsigned) m_Width, msg );
...@@ -1008,7 +1008,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame ) ...@@ -1008,7 +1008,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
if( Type() == TYPE_VIA ) // Display Diam and Drill values if( Type() == TYPE_VIA ) // Display Diam and Drill values
{ {
// Display diameter value: // Display diameter value:
frame->MsgPanel->AppendMessage( _( "Diam" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Diam" ), msg, DARKCYAN );
// Display drill value // Display drill value
int drill_value = GetDrillValue(); int drill_value = GetDrillValue();
...@@ -1023,25 +1023,25 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame ) ...@@ -1023,25 +1023,25 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
else else
title += _( "(Default)" ); title += _( "(Default)" );
frame->MsgPanel->AppendMessage( title, msg, RED ); frame->AppendMsgPanel( title, msg, RED );
} }
else else
{ {
frame->MsgPanel->AppendMessage( _( "Width" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
} }
NETCLASS* netclass = GetNetClass(); NETCLASS* netclass = GetNetClass();
if( netclass ) if( netclass )
{ {
msg = netclass->GetName(); msg = netclass->GetName();
frame->MsgPanel->AppendMessage( _( "Net Class" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Net Class" ), msg, DARKCYAN );
} }
// Display segment length // Display segment length
if( Type() != TYPE_VIA ) // Display Diam and Drill values if( Type() != TYPE_VIA ) // Display Diam and Drill values
{ {
valeur_param( wxRound( GetLength() ), msg ); valeur_param( wxRound( GetLength() ), msg );
frame->MsgPanel->AppendMessage( _( "Seg Len" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Segment Length" ), msg, DARKCYAN );
} }
} }
......
...@@ -906,11 +906,10 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -906,11 +906,10 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
wxString msg; wxString msg;
BOARD* board = (BOARD*) m_Parent; BOARD* board = (BOARD*) m_Parent;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
wxASSERT( board ); wxASSERT( board );
msgpanel->EraseMsgBox(); frame->ClearMsgPanel();
msg = _( "Zone Outline" ); msg = _( "Zone Outline" );
...@@ -918,7 +917,7 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -918,7 +917,7 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
if( ncont ) if( ncont )
msg << wxT( " " ) << _( "(Cutout)" ); msg << wxT( " " ) << _( "(Cutout)" );
msgpanel->AppendMessage( _( "Type" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
if( IsOnCopperLayer() ) if( IsOnCopperLayer() )
{ {
...@@ -938,35 +937,35 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -938,35 +937,35 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" ); msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
} }
msgpanel->AppendMessage( _( "NetName" ), msg, RED ); frame->AppendMsgPanel( _( "NetName" ), msg, RED );
} }
else else
msgpanel->AppendMessage( _( "Non Copper Zone" ), wxEmptyString, RED ); frame->AppendMsgPanel( _( "Non Copper Zone" ), wxEmptyString, RED );
/* Display net code : (usefull in test or debug) */ /* Display net code : (usefull in test or debug) */
msg.Printf( wxT( "%d" ), GetNet() ); msg.Printf( wxT( "%d" ), GetNet() );
msgpanel->AppendMessage( _( "NetCode" ), msg, RED ); frame->AppendMsgPanel( _( "NetCode" ), msg, RED );
msg = board->GetLayerName( m_Layer ); msg = board->GetLayerName( m_Layer );
msgpanel->AppendMessage( _( "Layer" ), msg, BROWN ); frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );
msg.Printf( wxT( "%d" ), m_Poly->corner.size() ); msg.Printf( wxT( "%d" ), m_Poly->corner.size() );
msgpanel->AppendMessage( _( "Corners" ), msg, BLUE ); frame->AppendMsgPanel( _( "Corners" ), msg, BLUE );
if( m_FillMode ) if( m_FillMode )
msg.Printf( _( "Segments" ), m_FillMode ); msg.Printf( _( "Segments" ), m_FillMode );
else else
msg = _( "Polygons" ); msg = _( "Polygons" );
msgpanel->AppendMessage( _( "Fill mode" ), msg, BROWN ); frame->AppendMsgPanel( _( "Fill mode" ), msg, BROWN );
// Useful for statistics : // Useful for statistics :
msg.Printf( wxT( "%d" ), m_Poly->m_HatchLines.size() ); msg.Printf( wxT( "%d" ), m_Poly->m_HatchLines.size() );
msgpanel->AppendMessage( _( "Hatch lines" ), msg, BLUE ); frame->AppendMsgPanel( _( "Hatch lines" ), msg, BLUE );
if( m_FilledPolysList.size() ) if( m_FilledPolysList.size() )
{ {
msg.Printf( wxT( "%d" ), m_FilledPolysList.size() ); msg.Printf( wxT( "%d" ), m_FilledPolysList.size() );
msgpanel->AppendMessage( _( "Corners in DrawList" ), msg, BLUE ); frame->AppendMsgPanel( _( "Corners in DrawList" ), msg, BLUE );
} }
} }
......
...@@ -779,11 +779,11 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ...@@ -779,11 +779,11 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
trackLen += track->GetLength(); trackLen += track->GetLength();
valeur_param( trackLen, msg ); valeur_param( trackLen, msg );
frame->MsgPanel->AppendMessage( _( "Track Len" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
// Add current segments count (number of segments in this new track): // Add current segments count (number of segments in this new track):
msg.Printf( wxT( "%d" ), g_CurrentTrackList.GetCount() ); msg.Printf( wxT( "%d" ), g_CurrentTrackList.GetCount() );
frame->MsgPanel->AppendMessage( _( "Segs Count" ), msg, DARKCYAN ); frame->AppendMsgPanel( _( "Segs Count" ), msg, DARKCYAN );
DisplayOpt.ShowTrackClearanceMode = showTrackClearanceMode; DisplayOpt.ShowTrackClearanceMode = showTrackClearanceMode;
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy; DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
......
...@@ -100,33 +100,45 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library, ...@@ -100,33 +100,45 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
wxPoint curspos = GetScreen()->m_Curseur; wxPoint curspos = GetScreen()->m_Curseur;
wxString ModuleName, keys; wxString ModuleName, keys;
static wxArrayString HistoryList; static wxArrayString HistoryList;
static wxString lastCommponentName;
bool AllowWildSeach = TRUE; bool AllowWildSeach = TRUE;
/* Ask for a component name or key words */ /* Ask for a component name or key words */
ModuleName = GetComponentName( this, HistoryList, _( "Place module" ), NULL ); WinEDA_SelectCmp dlg( this, GetComponentDialogPosition(), HistoryList,
ModuleName.MakeUpper(); _( "Place Module" ), false );
dlg.SetComponentName( lastCommponentName );
if ( dlg.ShowModal() == wxID_CANCEL )
return NULL;
ModuleName = dlg.GetComponentName();
if( ModuleName.IsEmpty() ) /* Cancel command */ if( ModuleName.IsEmpty() ) /* Cancel command */
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
return NULL; return NULL;
} }
ModuleName.MakeUpper();
if( ModuleName[0] == '=' ) // Selection by keywords if( ModuleName[0] == '=' ) // Selection by keywords
{ {
AllowWildSeach = FALSE; AllowWildSeach = FALSE;
keys = ModuleName.AfterFirst( '=' ); keys = ModuleName.AfterFirst( '=' );
ModuleName = Select_1_Module_From_List( this, library, wxEmptyString, keys ); ModuleName = Select_1_Module_From_List( this, library, wxEmptyString,
keys );
if( ModuleName.IsEmpty() ) /* Cancel command */ if( ModuleName.IsEmpty() ) /* Cancel command */
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
return NULL; return NULL;
} }
} }
else if( ( ModuleName.Contains( wxT( "?" ) ) ) || ( ModuleName.Contains( wxT( "*" ) ) ) ) // Selection wild card else if( ( ModuleName.Contains( wxT( "?" ) ) )
|| ( ModuleName.Contains( wxT( "*" ) ) ) ) // Selection wild card
{ {
AllowWildSeach = FALSE; AllowWildSeach = FALSE;
ModuleName = Select_1_Module_From_List( this, library, ModuleName, wxEmptyString ); ModuleName = Select_1_Module_From_List( this, library, ModuleName,
wxEmptyString );
if( ModuleName.IsEmpty() ) if( ModuleName.IsEmpty() )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
...@@ -136,12 +148,13 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library, ...@@ -136,12 +148,13 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
module = Get_Librairie_Module( library, ModuleName, FALSE ); module = Get_Librairie_Module( library, ModuleName, FALSE );
if( (module == NULL) && AllowWildSeach ) /* Attemp to search with wildcard */ if( ( module == NULL ) && AllowWildSeach ) /* Sarch with wildcard */
{ {
AllowWildSeach = FALSE; AllowWildSeach = FALSE;
wxString wildname = wxChar( '*' ) + ModuleName + wxChar( '*' ); wxString wildname = wxChar( '*' ) + ModuleName + wxChar( '*' );
ModuleName = wildname; ModuleName = wildname;
ModuleName = Select_1_Module_From_List( this, library, ModuleName, wxEmptyString ); ModuleName = Select_1_Module_From_List( this, library, ModuleName,
wxEmptyString );
if( ModuleName.IsEmpty() ) if( ModuleName.IsEmpty() )
{ {
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
...@@ -156,6 +169,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library, ...@@ -156,6 +169,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
if( module ) if( module )
{ {
lastCommponentName = ModuleName;
AddHistoryComponentName( HistoryList, ModuleName ); AddHistoryComponentName( HistoryList, ModuleName );
module->m_Flags = IS_NEW; module->m_Flags = IS_NEW;
......
...@@ -19,7 +19,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer, ...@@ -19,7 +19,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
{ {
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
MsgPanel->EraseMsgBox(); ClearMsgPanel();
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
...@@ -30,7 +30,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer, ...@@ -30,7 +30,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
} }
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN ); AppendMsgPanel( _( "File" ), FullFileName, CYAN );
DXF_PLOTTER* plotter = new DXF_PLOTTER(); DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( currentsheet ); plotter->set_paper_size( currentsheet );
......
...@@ -35,7 +35,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer ...@@ -35,7 +35,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
{ {
wxPoint offset; wxPoint offset;
MsgPanel->EraseMsgBox(); ClearMsgPanel();
/* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */ /* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
double scale = g_pcb_plot_options.Scale; double scale = g_pcb_plot_options.Scale;
...@@ -64,7 +64,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer ...@@ -64,7 +64,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
plotter->set_creator( wxT( "PCBNEW-RS274X" ) ); plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( FullFileName );
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN ); AppendMsgPanel( _( "File" ), FullFileName, CYAN );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
......
...@@ -25,7 +25,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer, ...@@ -25,7 +25,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
double scale; double scale;
wxPoint offset; wxPoint offset;
MsgPanel->EraseMsgBox(); ClearMsgPanel();
// Compute pen_dim (from g_HPGL_Pen_Diam in mils) in pcb units, // Compute pen_dim (from g_HPGL_Pen_Diam in mils) in pcb units,
// with plot scale (if Scale is 2, pen diametre is always g_HPGL_Pen_Diam // with plot scale (if Scale is 2, pen diametre is always g_HPGL_Pen_Diam
...@@ -50,7 +50,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer, ...@@ -50,7 +50,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
} }
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN ); AppendMsgPanel( _( "File" ), FullFileName, CYAN );
if( g_pcb_plot_options.PlotScaleOpt != 1 ) if( g_pcb_plot_options.PlotScaleOpt != 1 )
Center = TRUE; // Echelle != 1 donc trace centree du PCB Center = TRUE; // Echelle != 1 donc trace centree du PCB
......
...@@ -31,7 +31,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -31,7 +31,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
Ki_PageDescr* SheetPS; Ki_PageDescr* SheetPS;
wxPoint offset; wxPoint offset;
MsgPanel->EraseMsgBox(); ClearMsgPanel();
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
...@@ -42,7 +42,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -42,7 +42,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
} }
SetLocaleTo_C_standard(); SetLocaleTo_C_standard();
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN ); AppendMsgPanel( _( "File" ), FullFileName, CYAN );
if( g_pcb_plot_options.PlotScaleOpt != 1 ) if( g_pcb_plot_options.PlotScaleOpt != 1 )
Center = TRUE; // Echelle != 1 donc trace centree du PCB Center = TRUE; // Echelle != 1 donc trace centree du PCB
......
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