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"
......@@ -7,6 +7,7 @@
#include "common.h"
#include "macros.h"
#include "wxstruct.h"
#include "get_component_dialog.h"
/****************************************************************************/
......@@ -15,46 +16,7 @@
/****************************************************************************/
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 )
EVT_BUTTON( ID_ACCEPT_NAME, WinEDA_SelectCmp::Accept )
......@@ -66,28 +28,22 @@ BEGIN_EVENT_TABLE( WinEDA_SelectCmp, wxDialog )
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,
const wxPoint& framepos,
wxArrayString& HistoryList,
const wxString& Title,
bool show_extra_tool ) :
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;
wxStaticText* Text;
m_Parent = parent;
m_AuxTool = show_extra_tool;
m_GetExtraFunction = FALSE;
s_ItemName.Empty();
m_Text = &s_ItemName;
m_GetExtraFunction = false;
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
SetSizer( MainBoxSizer );
......@@ -127,7 +83,7 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM,
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 );
Button = new wxButton( this, ID_CANCEL, _( "Cancel" ) );
......@@ -139,7 +95,7 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
#ifndef __WXMAC__
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 );
}
#endif
......@@ -149,98 +105,98 @@ WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
}
/*********************************************************/
void WinEDA_SelectCmp::Accept( wxCommandEvent& event )
/*********************************************************/
{
int id = wxID_OK;
switch( event.GetId() )
{
case ID_SEL_BY_LISTBOX:
*m_Text = m_List->GetStringSelection();
m_Text = m_List->GetStringSelection();
break;
case ID_ACCEPT_NAME:
*m_Text = m_TextCtrl->GetValue();
m_Text = m_TextCtrl->GetValue();
break;
case ID_ACCEPT_KEYWORD:
*m_Text = wxT( "= " ) + m_TextCtrl->GetValue();
m_Text = wxT( "= " ) + m_TextCtrl->GetValue();
break;
case ID_CANCEL:
*m_Text = wxEmptyString;
m_Text = wxEmptyString;
id = wxID_CANCEL;
break;
case ID_LIST_ALL:
*m_Text = wxT( "*" );
m_Text = wxT( "*" );
break;
}
m_Text->Trim( FALSE ); // Remove blanks at beginning
m_Text->Trim( TRUE ); // Remove blanks at end
Close( TRUE );
m_Text.Trim( false ); // Remove blanks at beginning
m_Text.Trim( true ); // Remove blanks at end
if( IsModal() )
EndModal( id );
else
Close( id );
}
/**************************************************************/
/* Get the component name by the extra function */
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;
Close( TRUE );
return m_Text;
}
/******************************************************************************/
wxString GetComponentName( WinEDA_DrawFrame* frame,
wxArrayString& HistoryList, const wxString& Title,
wxString (*AuxTool)( WinEDA_DrawFrame* parent ) )
/*******************************************************************************/
void WinEDA_SelectCmp::SetComponentName( const wxString& name )
{
if( m_TextCtrl )
m_TextCtrl->SetValue( name );
}
/* Dialog frame to choose a component name
*/
wxPoint GetComponentDialogPosition( void )
{
wxPoint framepos;
wxPoint pos;
int x, y, w, h;
bool GetExtraFunction;
framepos = wxGetMousePosition();
pos = wxGetMousePosition();
wxClientDisplayRect( &x, &y, &w, &h );
framepos.x -= 100;
framepos.y -= 50;
if( framepos.x < x )
framepos.x = x;
if( framepos.y < y )
framepos.y = y;
if( framepos.x < x )
framepos.x = x;
pos.x -= 100;
pos.y -= 50;
if( pos.x < x )
pos.x = x;
if( pos.y < y )
pos.y = y;
if( pos.x < x )
pos.x = x;
x += w - 350;
if( framepos.x > x )
framepos.x = x;
if( framepos.y < y )
framepos.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;
}
if( pos.x > x )
pos.x = x;
if( pos.y < y )
pos.y = y;
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;
......
......@@ -671,7 +671,7 @@ bool LIB_COMPONENT::Load( FILE* file, char* line, int* lineNum,
errorMsg.Printf( wxT( "error occurred at line %d " ), *lineNum );
else
errorMsg.Printf( wxT( "error <%s> occurred at line %d " ),
( const wxChar* ) Msg, *lineNum );
GetChars( Msg ), *lineNum );
return false;
}
}
......@@ -739,7 +739,7 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* f, char* line,
if( !newEntry->Load( line, errorMsg ) )
{
errorMsg.Printf( wxT( "error <%s> in DRAW command %c" ),
( const wxChar* ) errorMsg, line[0] );
GetChars( errorMsg ), line[0] );
SAFE_DELETE( newEntry );
/* Flush till end of draw section */
......
......@@ -199,8 +199,8 @@ bool CMP_LIBRARY::AddAlias( LIB_ALIAS* alias )
wxString msg;
msg.Printf( _( "Cannot add duplicate alias <%s> to library <%s>." ),
(const wxChar*) alias->GetName(),
(const wxChar*) m_fileName.GetName() );
GetChars( alias->GetName() ),
GetChars( m_fileName.GetName() ) );
return false;
}
......@@ -239,9 +239,9 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* cmp )
{
wxLogError( _( "Conflict in library <%s>: alias <%s> already \
has root name <%s> and will not be assigned to root name <%s>." ),
(const wxChar*) m_fileName.GetName(),
(const wxChar*) alias->GetComponent()->GetName(),
(const wxChar*) newCmp->GetName() );
GetChars( m_fileName.GetName() ),
GetChars( alias->GetComponent()->GetName() ),
GetChars( newCmp->GetName() ) );
}
}
}
......@@ -287,8 +287,8 @@ void CMP_LIBRARY::RemoveEntry( CMP_LIB_ENTRY* entry )
{
wxLogWarning( wxT( "No root component found for alias <%s> in \
library <%s>." ),
( const wxChar* ) entry->GetName(),
( const wxChar* ) m_fileName.GetName() );
GetChars( entry->GetName() ),
GetChars( m_fileName.GetName() ) );
}
else
{
......@@ -297,9 +297,9 @@ library <%s>." ),
if( index == wxNOT_FOUND )
wxLogWarning( wxT( "Alias <%s> not found in component <%s> \
alias list in library <%s>" ),
( const wxChar* ) entry->GetName(),
( const wxChar* ) Root->GetName(),
( const wxChar* ) m_fileName.GetName() );
GetChars( entry->GetName() ),
GetChars( Root->GetName() ),
GetChars( m_fileName.GetName() ) );
else
Root->m_AliasList.RemoveAt( index );
}
......@@ -329,9 +329,9 @@ alias list in library <%s>" ),
{
wxLogWarning( wxT( "Alias <%s> for component <%s> not found in \
library <%s>" ),
( const wxChar* ) AliasName,
( const wxChar* ) Root->GetName(),
( const wxChar* ) m_fileName.GetName() );
GetChars( AliasName ),
GetChars( Root->GetName() ),
GetChars( m_fileName.GetName() ) );
return;
}
......@@ -373,9 +373,9 @@ LIB_COMPONENT* CMP_LIBRARY::ReplaceComponent( LIB_COMPONENT* oldComponent,
wxLogDebug( wxT( "Removing extra alias <%s> from component <%s> \
in library <%s>." ),
(const wxChar*) oldComponent->m_AliasList[ i ],
(const wxChar*) oldComponent->GetName(),
(const wxChar*) m_fileName.GetName() );
GetChars( oldComponent->m_AliasList[ i ] ),
GetChars( oldComponent->GetName() ),
GetChars( m_fileName.GetName() ) );
RemoveEntry( oldComponent->m_AliasList[ i ] );
}
......@@ -392,9 +392,9 @@ in library <%s>." ),
wxLogDebug( wxT( "Adding extra alias <%s> from component <%s> \
in library <%s>." ),
(const wxChar*) newComponent->m_AliasList[ i ],
(const wxChar*) newComponent->GetName(),
(const wxChar*) m_fileName.GetName() );
GetChars( newComponent->m_AliasList[ i ] ),
GetChars( newComponent->GetName() ),
GetChars( m_fileName.GetName() ) );
alias = new LIB_ALIAS( newComponent->m_AliasList[ i ],
newComponent );
......@@ -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 \
editor and save it. If this library is the project cache library, save \
the current schematic." ),
(const wxChar*) GetName() );
GetChars( GetName() ) );
}
else
{
......@@ -542,7 +542,7 @@ the current schematic." ),
m_verMinor = (int) minor;
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." ),
if( FindEntry( LibEntry->GetName() ) != NULL )
{
wxLogWarning( duplicate_name_msg,
(const wxChar*) m_fileName.GetName(),
(const wxChar*) LibEntry->GetName() );
GetChars( m_fileName.GetName() ),
GetChars( LibEntry->GetName() ) );
}
/* If we are here, this part is O.k. - put it in: */
......@@ -584,8 +584,8 @@ the current schematic." ),
else
{
wxLogWarning( _( "Library <%s> component load error %s." ),
(const wxChar*) m_fileName.GetName(),
(const wxChar*) msg );
GetChars( m_fileName.GetName() ),
GetChars( msg ) );
msg.Clear();
delete LibEntry;
}
......@@ -610,8 +610,8 @@ void CMP_LIBRARY::LoadAliases( LIB_COMPONENT* component )
if( FindEntry( component->m_AliasList[ii] ) != NULL )
{
wxLogError( duplicate_name_msg,
(const wxChar*) m_fileName.GetName(),
(const wxChar*) component->m_AliasList[ii] );
GetChars( m_fileName.GetName() ),
GetChars( component->m_AliasList[ii] ) );
}
alias = new LIB_ALIAS( component->m_AliasList[ii], component, this );
......@@ -654,14 +654,14 @@ bool CMP_LIBRARY::LoadDocs( wxString& errMsg )
if( f == NULL )
{
errMsg.Printf( _( "Could not open component document libray file <%s>." ),
(const wxChar*) fn.GetFullPath() );
GetChars( fn.GetFullPath() ) );
return false;
}
if( GetLine( f, Line, &LineNum, sizeof(Line) ) == NULL )
{
errMsg.Printf( _( "Component document libray file <%s> is empty." ),
(const wxChar*) fn.GetFullPath() );
GetChars( fn.GetFullPath() ) );
fclose( f );
return false;
}
......@@ -670,7 +670,7 @@ bool CMP_LIBRARY::LoadDocs( wxString& errMsg )
{
errMsg.Printf( _( "File <%s> is not a valid component library \
document file." ),
(const wxChar*) fn.GetFullPath() );
GetChars( fn.GetFullPath() ) );
fclose( f );
return false;
}
......
......@@ -50,89 +50,78 @@ void CreateDummyCmp()
}
/*****************************************************************************
* Routine to draw the given part at given position, transformed/mirror as
* specified, and in the given drawing mode.
* 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 )
/*******************************************************************/
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_ITEM( aParent, TYPE_SCH_COMPONENT )
{
Entry->Draw( panel, DC, Pos, Multi, convert, DrawMode, Color, TransMat,
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
Init( aPos );
}
/*******************************************************************/
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
SCH_ITEM( aParent, TYPE_SCH_COMPONENT )
SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, DrawSheetPath* sheet,
int unit, int convert, const wxPoint& pos,
bool setNewItemFlag ) :
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 */
m_Transform[0][0] = 1;
m_Transform[0][1] = 0;
m_Transform[1][0] = 0;
m_Transform[1][1] = -1;
GetField( VALUE )->m_Pos = libComponent.m_Name.m_Pos + m_Pos;
GetField( VALUE )->ImportValues( libComponent.m_Name );
GetField( VALUE )->m_Text = m_ChipName;
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 )
field.SetLayer( LAYER_REFERENCEPART );
else if( i==VALUE )
field.SetLayer( LAYER_VALUEPART );
ii = EntryField->m_FieldId;
if( ii < 2 ) // Reference or value, already done
continue;
// 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
AddField( field );
}
SCH_CMP_FIELD* curr_field = GetField( ii );
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 ) :
}
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 *
* specified, and in the given drawing mode. Only this one is visible... *
*****************************************************************************/
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;
int ii;
......@@ -172,19 +195,16 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
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;
if( DummyCmp == NULL )
CreateDummyCmp();
Entry = DummyCmp;
}
DrawLibPartAux( panel, DC, this, Entry, m_Pos + offset, m_Transform,
dummy ? 0 : m_Multi, dummy ? 0 : m_Convert, DrawMode );
/* Trace des champs, avec placement et orientation selon orient. du
* composant
*/
Entry->Draw( panel, DC, m_Pos + offset, dummy ? 0 : m_Multi,
dummy ? 0 : m_Convert, DrawMode, Color, m_Transform,
DrawPinText );
SCH_CMP_FIELD* field = GetField( REFERENCE );
......@@ -212,6 +232,32 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
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 @@
#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 );
......@@ -114,10 +107,30 @@ private:
*/
wxArrayString m_PathsAndReferences;
void Init( const wxPoint& pos = wxPoint( 0, 0 ) );
public:
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ),
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
* clones \a aTemplate into this object. All fields are copied as is except
......@@ -240,7 +253,17 @@ public:
wxDC* DC,
const wxPoint& offset,
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 );
......
......@@ -85,8 +85,8 @@ void DisplayCmpDoc( wxString& Name )
return;
wxLogDebug( wxT( "Selected component <%s>, m_Doc: <%s>, m_KeyWord: <%s>." ),
(const wxChar*) Name, (const wxChar*) CmpEntry->m_Doc,
(const wxChar*) CmpEntry->m_KeyWord );
GetChars( Name ), GetChars( CmpEntry->m_Doc ),
GetChars( CmpEntry->m_KeyWord ) );
Name = wxT( "Description: " ) + CmpEntry->m_Doc;
Name += wxT( "\nKey Words: " ) + CmpEntry->m_KeyWord;
......
......@@ -144,9 +144,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
wxString msg;
msg.Printf( _( "Alias <%s> not found for component <%s> in library \
<%s>." ),
(const wxChar*) m_Parent->GetAliasName(),
(const wxChar*) component->GetName(),
(const wxChar*) library->GetName() );
GetChars( m_Parent->GetAliasName() ),
GetChars( component->GetName() ),
GetChars( library->GetName() ) );
wxMessageBox( msg, _( "Component Library Error" ),
wxID_OK | wxICON_ERROR, this );
}
......@@ -274,7 +274,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(
wxString msg;
msg.Printf( _( "Alias <%s> cannot be removed while it is being \
edited!" ),
(const wxChar*) m_Parent->GetAliasName() );
GetChars( m_Parent->GetAliasName() ) );
DisplayError( this, msg );
return;
}
......@@ -319,8 +319,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
wxString msg;
msg.Printf( _( "Alias or component name <%s> already exists in \
library <%s>." ),
(const wxChar*) aliasname,
(const wxChar*) library->GetName() );
GetChars( aliasname ),
GetChars( library->GetName() ) );
DisplayError( this, msg );
return;
}
......@@ -344,7 +344,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(
wxString msg;
msg.Printf( _( "Alias <%s> cannot be removed while it is being \
edited!" ),
(const wxChar*) aliasname );
GetChars( aliasname ) );
DisplayError( this, msg );
return;
}
......@@ -491,7 +491,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
wxString msg;
msg.Printf( _( "Foot print filter <%s> is already defined." ),
(const wxChar*) Line );
GetChars( Line ) );
DisplayError( this, msg );
return;
}
......
......@@ -105,20 +105,3 @@ bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] )
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 )
prompt.Printf( _( "Component library <%s> failed to load.\n\n\
Error: %s" ),
( const wxChar* ) fn.GetFullPath(),
( const wxChar* ) errMsg );
GetChars( fn.GetFullPath() ),
GetChars( errMsg ) );
DisplayError( this, prompt );
msg += _( " error!" );
}
......
/*****************************************************************************
* Program to draw EE diagrams. *
* This module redraw/draw all structs. *
* Program to draw EE diagrams. *
* This module redraw/draw all structs. *
*****************************************************************************/
#include "fctsys.h"
......@@ -123,8 +123,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref,
/*****************************************************************************
* Routine to redraw list of structs. *
* If the list is of DrawPickStruct types then the picked item are drawn. *
* Routine to redraw list of structs. *
* If the list is of DrawPickStruct types then the picked item are drawn. *
*****************************************************************************/
void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
SCH_ITEM* Structlist, int DrawMode, int Color )
......@@ -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,
SCH_ITEM* Struct, int DrawMode, int Color )
......@@ -257,17 +257,12 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem
case TYPE_SCH_COMPONENT:
{
LIB_COMPONENT* LibEntry;
SCH_COMPONENT* Struct;
Struct = (SCH_COMPONENT*) aItem;
LibEntry = CMP_LIBRARY::FindLibraryComponent( Struct->m_ChipName );
SCH_COMPONENT* Component = (SCH_COMPONENT*) aItem;
if( LibEntry == NULL )
if( Component == NULL )
break;
DrawingLibInGhost( aPanel, aDC, LibEntry, Struct,
Struct->m_Pos.x + aOffset.x,
Struct->m_Pos.y + aOffset.y, Struct->m_Multi,
Struct->m_Convert, g_GhostColor, FALSE );
Component->Draw( aPanel, aDC, aOffset, g_XorMode, g_GhostColor, false );
break;
}
......@@ -288,4 +283,3 @@ void DrawStructsInGhost( WinEDA_DrawPanel * aPanel, wxDC * aDC, SCH_ITEM * aItem
break;
}
}
......@@ -189,7 +189,8 @@ enum id_eeschema_frm
ID_LIBVIEW_CMP_LIST,
ID_LIBVIEW_LIBWINDOW,
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,
prompt.Printf( _( "Component library <%s> failed to load.\n\n\
Error: %s" ),
( const wxChar* ) fn.GetFullPath(),
( const wxChar* ) errMsg );
GetChars( fn.GetFullPath() ),
GetChars( errMsg ) );
DisplayError( this, prompt );
msg += wxT( " ->Error" );
}
......
......@@ -29,23 +29,20 @@ static int OldTransMat[2][2];
static wxPoint OldPos;
wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void )
{
WinEDA_ViewlibFrame* Viewer;
wxSemaphore semaphore( 0, 1 );
WinEDA_SchematicFrame* frame;
wxSemaphore semaphore( 0, 1 );
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
Viewer = frame->m_ViewlibFrame;
/* Close the current Lib browser, if open, and open a new one, in
* "modal" mode */
if( Viewer )
Viewer->Destroy();
if( m_ViewlibFrame )
{
m_ViewlibFrame->Destroy();
m_ViewlibFrame = NULL;
}
Viewer = frame->m_ViewlibFrame = new WinEDA_ViewlibFrame( frame, NULL,
&semaphore );
Viewer->AdjustScrollBars();
m_ViewlibFrame = new WinEDA_ViewlibFrame( this, NULL, &semaphore );
m_ViewlibFrame->AdjustScrollBars();
// Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
......@@ -54,7 +51,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
wxMilliSleep( 50 );
}
return Viewer->GetEntryName();
return m_ViewlibFrame->GetEntryName();
}
......@@ -69,12 +66,15 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
wxArrayString& HistoryList,
bool UseLibBrowser )
{
int ii, CmpCount = 0;
LIB_COMPONENT* Entry = NULL;
SCH_COMPONENT* Component = NULL;
CMP_LIBRARY* Library = NULL;
wxString Name, keys, msg;
bool AllowWildSeach = TRUE;
int CmpCount = 0;
int unit = 1;
int convert = 1;
LIB_COMPONENT* Entry = NULL;
SCH_COMPONENT* Component = NULL;
CMP_LIBRARY* Library = NULL;
wxString Name, keys, msg;
bool AllowWildSeach = TRUE;
static wxString lastCommponentName;
g_ItemToRepeat = NULL;
DrawPanel->m_IgnoreMouseEvents = TRUE;
......@@ -97,16 +97,33 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
/* Ask for a component name or key words */
msg.Printf( _( "component selection (%d items loaded):" ), CmpCount );
Name = GetComponentName( this, HistoryList, msg,
UseLibBrowser ? SelectFromLibBrowser : NULL );
Name.MakeUpper();
WinEDA_SelectCmp dlg( this, GetComponentDialogPosition(), HistoryList,
msg, UseLibBrowser );
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() )
{
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
return NULL; /* annulation de commande */
return NULL;
}
Name.MakeUpper();
if( Name.GetChar( 0 ) == '=' )
{
AllowWildSeach = FALSE;
......@@ -143,7 +160,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Entry = CMP_LIBRARY::FindLibraryComponent( Name, libname );
if( (Entry == NULL) && AllowWildSeach ) /* Attemp to search with wildcard */
if( ( Entry == NULL ) && AllowWildSeach ) /* Search with wildcard */
{
AllowWildSeach = FALSE;
wxString wildname = wxChar( '*' ) + Name + wxChar( '*' );
......@@ -161,81 +178,26 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
}
}
DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawPanel->MouseToCursorSchema();
if( Entry == NULL )
{
msg = _( "Failed to find part " ) + Name + _( " in library" );
DisplayError( this, msg, 10 );
DisplayError( this, msg );
return NULL;
}
lastCommponentName = Name;
AddHistoryComponentName( HistoryList, Name );
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitPlaceCmp;
Component = new SCH_COMPONENT( GetScreen()->m_Curseur );
Component->m_Multi = 1; /* Selection de l'unite 1 dans le boitier */
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 );
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
GetScreen()->m_Curseur, true );
curr_field->m_Pos = Component->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;
}
DrawStructsInGhost( DrawPanel, DC, Component, wxPoint(0,0) );
DrawStructsInGhost( DrawPanel, DC, Component, wxPoint( 0, 0 ) );
ClearMsgPanel();
Component->DisplayInfo( this );
return Component;
......
......@@ -64,7 +64,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
wxString msg;
msg.Printf( _( "Component library file <%s> is empty." ),
(const wxChar*) fn.GetFullPath() );
GetChars( fn.GetFullPath() ) );
DisplayError( this, msg );
return;
}
......
......@@ -53,7 +53,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
if( !libCache->Save( ArchFullFileName ) )
{
msg.Printf( _( "An error occurrred attempting to save component \
library <%s>." ), (const wxChar*) ArchFullFileName );
library <%s>." ), GetChars( ArchFullFileName ) );
DisplayError( frame, msg );
return false;
}
......
......@@ -100,8 +100,8 @@ saved.\n\nDiscard current changes?" ) ) )
{
msg.Printf( _( "Component or alias name \"%s\" not found in \
library \"%s\"." ),
(const wxChar*) CmpName,
(const wxChar*) m_library->GetName() );
GetChars( CmpName ),
GetChars( m_library->GetName() ) );
DisplayError( this, msg );
return;
}
......@@ -136,7 +136,7 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
if( LibEntry->GetName().IsEmpty() )
{
wxLogWarning( wxT( "Entry in library <%s> has empty name field." ),
(const wxChar*) LibEntry );
GetChars( Library->GetName() ) );
return false;
}
......@@ -151,8 +151,8 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
wxASSERT( component != NULL && component->Type == ROOT );
wxLogDebug( wxT( "\"<%s>\" is alias of \"<%s>\"" ),
(const wxChar*) cmpName,
(const wxChar*) component->GetName() );
GetChars( cmpName ),
GetChars( component->GetName() ) );
m_aliasName = cmpName;
}
......@@ -169,8 +169,8 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
if( m_component == NULL )
{
msg.Printf( _( "Could not create copy of part <%s> in library <%s>." ),
(const wxChar*) LibEntry->GetName(),
(const wxChar*) Library->GetName() );
GetChars( LibEntry->GetName() ),
GetChars( Library->GetName() ) );
DisplayError( this, msg );
return false;
}
......@@ -393,7 +393,7 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
if( ListNames.IsEmpty() )
{
msg.Printf( _( "Component library <%s> is empty." ),
( const wxChar* ) m_library->GetName() );
GetChars( m_library->GetName() ) );
wxMessageBox( msg, _( "Delete Entry Error" ),
wxID_OK | wxICON_EXCLAMATION, this );
return;
......@@ -401,7 +401,7 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
msg.Printf( _( "Select 1 of %d components to delete\nfrom library <%s>." ),
ListNames.GetCount(),
( const wxChar* ) m_library->GetName() );
GetChars( m_library->GetName() ) );
wxSingleChoiceDialog dlg( this, msg, _( "Delete Component" ), ListNames );
......@@ -413,15 +413,15 @@ void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
if( LibEntry == NULL )
{
msg.Printf( _( "Entry <%s> not found in library <%s>." ),
( const wxChar* ) dlg.GetStringSelection(),
( const wxChar* ) m_library->GetName() );
GetChars( dlg.GetStringSelection() ),
GetChars( m_library->GetName() ) );
DisplayError( this, msg );
return;
}
msg.Printf( _( "Delete component \"%s\" from library \"%s\"?" ),
(const wxChar*) LibEntry->GetName(),
(const wxChar*) m_library->GetName() );
GetChars( LibEntry->GetName() ),
GetChars( m_library->GetName() ) );
if( !IsOK( this, msg ) )
return;
......@@ -520,8 +520,8 @@ lost!\n\nClear the current component from the screen?" ) ) )
{
wxString msg;
msg.Printf( _( "Component \"%s\" already exists in library \"%s\"." ),
(const wxChar*) name,
(const wxChar*) m_library->GetName() );
GetChars( name ),
GetChars( m_library->GetName() ) );
DisplayError( this, msg );
return;
}
......@@ -604,7 +604,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
if( oldComponent != NULL )
{
msg.Printf( _( "Component \"%s\" exists. Change it?" ),
(const wxChar*) oldComponent->GetName() );
GetChars( oldComponent->GetName() ) );
if( !IsOK( this, msg ) )
return;
}
......@@ -622,7 +622,7 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
return;
msg.Printf( _( "Component %s saved in library %s" ),
( const wxChar* ) Component->GetName(),
( const wxChar* ) m_library->GetName() );
GetChars( Component->GetName() ),
GetChars( m_library->GetName() ) );
Affiche_Message( msg );
}
......@@ -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 \
component <%s>.\nPlease choose another name that does not conflict with any \
names in the alias list." ),
(const wxChar*) Text,
(const wxChar*) Field->GetParent()->GetName() );
GetChars( Text ),
GetChars( Field->GetParent()->GetName() ) );
DisplayError( this, msg );
return;
}
......@@ -189,8 +189,8 @@ names in the alias list." ),
msg.Printf( _( "The field name <%s> conflicts with an existing \
entry in the component library <%s>.\nPlease choose another name that does \
not conflict with any library entries." ),
(const wxChar*) Text,
(const wxChar*) m_library->GetName() );
GetChars( Text ),
GetChars( m_library->GetName() ) );
DisplayError( this, msg );
return;
}
......
......@@ -256,7 +256,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
{
wxString msg;
msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ),
(const wxChar*) lib.GetName() );
GetChars( lib.GetName() ) );
if( !IsOK( this, msg ) )
{
Event.Veto();
......
......@@ -50,6 +50,7 @@ public:
int BestZoom(); // Retourne le meilleur zoom
void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
......@@ -60,6 +61,9 @@ public:
wxString& GetEntryName( void ) const { return m_entryName; }
int GetUnit( void ) { return m_unit; }
int GetConvert( void ) { return m_convert; }
private:
void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option );
......
......@@ -966,10 +966,10 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
curr_pin->ReturnPinStringNum( StringPinNum );
msg.Printf( _( "Duplicate pin %s at location (%d, %d) conflicts \
with pin %s at location (%d, %d)" ),
(const wxChar*) StringPinNum,
(const wxChar*) curr_pin->m_PinName,
GetChars( StringPinNum ),
GetChars( curr_pin->m_PinName ),
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 );
if( m_component->GetPartCount() > 1 )
......
......@@ -48,20 +48,6 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
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,
int* Angle2,
const int TransMat[2][2] );
......
......@@ -66,7 +66,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( ImportFile == NULL )
{
msg.Printf( _( "Failed to open Symbol File <%s>" ),
(const wxChar*) fn.GetFullPath() );
GetChars( fn.GetFullPath() ) );
DisplayError( this, msg );
return;
}
......@@ -76,7 +76,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( !Lib->Load( err ) )
{
msg.Printf( _( "Error <%s> occurred loading symbol library <%s>." ),
(const wxChar*) err, (const wxChar*) fn.GetName() );
GetChars( err ), GetChars( fn.GetName() ) );
DisplayError( this, msg );
fclose( ImportFile );
delete Lib;
......@@ -88,7 +88,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
if( Lib->IsEmpty() )
{
msg.Printf( _( "No components found in symbol library <%s>." ),
(const wxChar*) fn.GetName() );
GetChars( fn.GetName() ) );
delete Lib;
return;
}
......@@ -166,12 +166,12 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
if( ExportFile == NULL )
{
msg.Printf( _( "Unable to create <%s>" ),
(const wxChar*) fn.GetFullPath() );
GetChars( fn.GetFullPath() ) );
DisplayError( this, msg );
return;
}
msg.Printf( _( "Save Symbol in [%s]" ), (const wxChar*) fn.GetPath() );
msg.Printf( _( "Save Symbol in [%s]" ), GetChars( fn.GetPath() ) );
Affiche_Message( msg );
/* Creation de l'entete de la librairie */
......
......@@ -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_CMPWINDOW, WinEDA_ViewlibFrame::OnSashDrag )
/* Toolbar events */
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
WinEDA_ViewlibFrame::Process_Special_Functions )
......@@ -53,6 +52,9 @@ BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame )
/* listbox events */
EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
EVT_MENU( ID_SET_RELATIVE_OFFSET,
WinEDA_ViewlibFrame::OnSetRelativeOffset )
END_EVENT_TABLE()
......@@ -67,7 +69,8 @@ static wxAcceleratorEntry accels[] =
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
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 ) )
......@@ -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 bestzoom, ii, jj;
......@@ -443,8 +453,8 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
{
m_entryName = name;
DisplayLibInfos();
m_unit = 1;
m_convert = 1;
m_unit = 0;
m_convert = 0;
Zoom_Automatique( false );
ReCreateHToolbar();
DrawPanel->Refresh();
......
......@@ -8,15 +8,51 @@
#define __INCLUDE__GET_COMPONENT_DIALOG_H__ 1
wxString GetComponentName( WinEDA_DrawFrame * frame,
wxArrayString & HistoryList, const wxString &Title,
wxString (*AuxTool)( WinEDA_DrawFrame * parent ) );
wxPoint GetComponentDialogPosition( void );
/* Dialog frame to choose a component name */
void AddHistoryComponentName( wxArrayString& HistoryList, const wxString& Name );
void AddHistoryComponentName( wxArrayString& HistoryList,
const wxString& Name );
/* 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:
DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
/**
* Use the component viewer to select component to import into schematic.
*/
wxString SelectFromLibBrowser( void );
public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
......
......@@ -577,8 +577,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
wxString txt;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
int viasCount = 0;
for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
......@@ -588,16 +587,16 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
}
txt.Printf( wxT( "%d" ), GetPadsCount() );
msgpanel->AppendMessage( _( "Pads" ), txt, DARKGREEN );
frame->AppendMsgPanel( _( "Pads" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), viasCount );
msgpanel->AppendMessage( _( "Vias" ), txt, DARKGREEN );
frame->AppendMsgPanel( _( "Vias" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetNodesCount() );
msgpanel->AppendMessage( _( "Nodes" ), txt, DARKCYAN );
frame->AppendMsgPanel( _( "Nodes" ), txt, DARKCYAN );
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,
* so, display them only if this is the case
......@@ -605,13 +604,13 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
if( (m_Status_Pcb & NET_CODES_OK) )
{
txt.Printf( wxT( "%d" ), GetRatsnestsCount() );
msgpanel->AppendMessage( _( "Links" ), txt, DARKGREEN );
frame->AppendMsgPanel( _( "Links" ), txt, DARKGREEN );
txt.Printf( wxT( "%d" ), GetRatsnestsCount() - GetNoconnectCount() );
msgpanel->AppendMessage( _( "Connect" ), txt, DARKGREEN );
frame->AppendMsgPanel( _( "Connect" ), txt, DARKGREEN );
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 )
BOARD* board = (BOARD*) m_Parent;
wxASSERT( board );
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
itype = m_Type & 0x0F;
msg = wxT( "DRAWING" );
msgpanel->AppendMessage( _( "Type" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
wxString shape = _( "Shape" );
switch( m_Shape ) {
case S_CIRCLE:
msgpanel->AppendMessage( shape, _( "Circle" ), RED );
frame->AppendMsgPanel( shape, _( "Circle" ), RED );
break;
case S_ARC:
msgpanel->AppendMessage( shape, _( "Arc" ), RED );
frame->AppendMsgPanel( shape, _( "Arc" ), RED );
msg.Printf( wxT( "%1." ), (float)m_Angle/10 );
msgpanel->AppendMessage( _("Angle"), msg, RED );
frame->AppendMsgPanel( _("Angle"), msg, RED );
break;
case S_CURVE:
msgpanel->AppendMessage( shape, _( "Curve" ), RED );
frame->AppendMsgPanel( shape, _( "Curve" ), RED );
break;
default:
msgpanel->AppendMessage( shape, _( "Segment" ), RED );
frame->AppendMsgPanel( shape, _( "Segment" ), RED );
}
wxString start;
start << GetStart();
......@@ -397,13 +396,13 @@ void DRAWSEGMENT::DisplayInfo( WinEDA_DrawFrame* frame )
wxString end;
end << GetEnd();
msgpanel->AppendMessage( start, end, DARKGREEN );
frame->AppendMsgPanel( start, end, DARKGREEN );
msgpanel->AppendMessage( _( "Layer" ),
frame->AppendMsgPanel( _( "Layer" ),
board->GetLayerName( m_Layer ), DARKBROWN );
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 )
if( !board )
return;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
msgpanel->AppendMessage( _( "Graphic Item" ), wxEmptyString, DARKCYAN );
frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN );
msgpanel->AppendMessage( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
msgpanel->AppendMessage( _( "Value" ), module->m_Value->m_Text, BLUE );
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
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 );
msgpanel->AppendMessage( _( "Width" ), msg, BLUE );
frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
}
......
......@@ -57,18 +57,17 @@ MARKER_PCB::~MARKER_PCB()
void MARKER_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
{
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
const DRC_ITEM& rpt = m_drc;
msgpanel->AppendMessage( _( "Type" ), _("Marker"), DARKCYAN );
frame->AppendMsgPanel( _( "Type" ), _("Marker"), DARKCYAN );
wxString errorTxt;
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
msgpanel->AppendMessage( errorTxt, wxEmptyString, RED );
frame->AppendMsgPanel( errorTxt, wxEmptyString, RED );
wxString txtA;
txtA << DRC_ITEM::ShowCoord( rpt.GetPointA() ) << wxT(": ") << rpt.GetTextA();
......@@ -77,7 +76,7 @@ void MARKER_PCB::DisplayInfo( WinEDA_DrawFrame* frame )
if ( rpt.HasSecondItem() )
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 )
bool flag = FALSE;
wxString msg;
BOARD* board = (BOARD*) m_Parent;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->EraseMsgBox();
if( frame->m_Ident != PCB_FRAME )
flag = TRUE;
msgpanel->AppendMessage( m_Reference->m_Text, m_Value->m_Text,
DARKCYAN );
frame->AppendMsgPanel( m_Reference->m_Text, m_Value->m_Text,
DARKCYAN );
if( flag ) // Display last date the component was edited( useful in Module Editor)
{
......@@ -819,15 +818,15 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
strtok( NULL, " \n\r" );
strcat( bufcar, strtok( NULL, " \n\r" ) );
msg = CONV_FROM_UTF8( bufcar );
msgpanel->AppendMessage( _( "Last Change" ), msg, BROWN );
frame->AppendMsgPanel( _( "Last Change" ), msg, BROWN );
}
else // displa time stamp in schematic
{
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;
nbpad = 0;
......@@ -838,29 +837,29 @@ void MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
}
msg.Printf( wxT( "%d" ), nbpad );
msgpanel->AppendMessage( _( "Pads" ), msg, BLUE );
frame->AppendMsgPanel( _( "Pads" ), msg, BLUE );
msg = wxT( ".." );
if( IsLocked() )
msg[0] = 'L';
if( m_ModuleStatus & MODULE_is_PLACED )
msg[1] = 'P';
msgpanel->AppendMessage( _( "Stat" ), msg, MAGENTA );
frame->AppendMsgPanel( _( "Stat" ), msg, MAGENTA );
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 )
msg = m_3D_Drawings->m_Shape3DName;
else
msg = _("No 3D shape");
msgpanel->AppendMessage( _( "3D-Shape" ), msg, RED );
frame->AppendMsgPanel( _( "3D-Shape" ), msg, RED );
wxString doc = _( "Doc: " ) + m_Doc;
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 )
D_PAD* pad;
double lengthnet = 0;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
msgpanel->AppendMessage( _( "Net Name" ), GetNetname(), RED );
frame->AppendMsgPanel( _( "Net Name" ), GetNetname(), RED );
txt.Printf( wxT( "%d" ), GetNet() );
msgpanel->AppendMessage( _( "Net Code" ), txt, RED );
frame->AppendMsgPanel( _( "Net Code" ), txt, RED );
count = 0;
module = ( (WinEDA_BasePcbFrame*) frame )->GetBoard()->m_Modules;
......@@ -148,7 +147,7 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
}
txt.Printf( wxT( "%d" ), count );
msgpanel->AppendMessage( _( "Pads" ), txt, DARKGREEN );
frame->AppendMsgPanel( _( "Pads" ), txt, DARKGREEN );
count = 0;
Struct = ( (WinEDA_BasePcbFrame*) frame )->GetBoard()->m_Track;
......@@ -163,10 +162,10 @@ void NETINFO_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
}
txt.Printf( wxT( "%d" ), count );
msgpanel->AppendMessage( _( "Vias" ), txt, BLUE );
frame->AppendMsgPanel( _( "Vias" ), txt, BLUE );
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 )
{ wxT( "norm" ), wxT( "smd " ), wxT( "conn" ), wxT( "????" ) };
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->EraseMsgBox();
/* Recherche du module correspondant */
module = (MODULE*) m_Parent;
if( module )
{
wxString msg = module->GetReference();
msgpanel->AppendMessage( _( "Module" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Module" ), msg, DARKCYAN );
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 */
#if 1 // Used only to debug connectivity calculations
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
wxString LayerInfo;
......@@ -546,24 +545,24 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
break;
}
}
msgpanel->AppendMessage( _( "Layer" ), LayerInfo, DARKGREEN );
frame->AppendMsgPanel( _( "Layer" ), LayerInfo, DARKGREEN );
int attribut = m_Attribut & 15;
if( attribut > 3 )
attribut = 3;
msgpanel->AppendMessage( Msg_Pad_Shape[m_PadShape],
frame->AppendMsgPanel( Msg_Pad_Shape[m_PadShape],
Msg_Pad_Attribut[attribut], DARKGREEN );
valeur_param( m_Size.x, Line );
msgpanel->AppendMessage( _( "H Size" ), Line, RED );
frame->AppendMsgPanel( _( "H Size" ), Line, RED );
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 );
if( m_DrillShape == PAD_CIRCLE )
{
msgpanel->AppendMessage( _( "Drill" ), Line, RED );
frame->AppendMsgPanel( _( "Drill" ), Line, RED );
}
else
{
......@@ -571,7 +570,7 @@ void D_PAD::DisplayInfo( WinEDA_DrawFrame* frame )
wxString msg;
valeur_param( (unsigned) m_Drill.y, 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 )
(float) ( m_Orient - module_orient ) / 10, (float) module_orient / 10 );
else
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 );
msgpanel->AppendMessage( _( "X Pos" ), Line, BLUE );
frame->AppendMsgPanel( _( "X Pos" ), Line, BLUE );
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 )
board = (BOARD*) parent;
wxASSERT( board );
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
if( m_Parent && m_Parent->Type() == TYPE_COTATION )
msgpanel->AppendMessage( _( "COTATION" ), m_Text, DARKGREEN );
frame->AppendMsgPanel( _( "COTATION" ), m_Text, DARKGREEN );
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 );
if( !m_Mirror )
msgpanel->AppendMessage( _( "Mirror" ), _( "No" ), DARKGREEN );
frame->AppendMsgPanel( _( "Mirror" ), _( "No" ), DARKGREEN );
else
msgpanel->AppendMessage( _( "Mirror" ), _( "Yes" ), DARKGREEN );
frame->AppendMsgPanel( _( "Mirror" ), _( "Yes" ), DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
msgpanel->AppendMessage( _( "Orient" ), msg, DARKGREEN );
frame->AppendMsgPanel( _( "Orient" ), msg, DARKGREEN );
valeur_param( m_Width, msg );
msgpanel->AppendMessage( _( "Width" ), msg, MAGENTA );
frame->AppendMsgPanel( _( "Width" ), msg, MAGENTA );
valeur_param( m_Size.x, msg );
msgpanel->AppendMessage( _( "H Size" ), msg, RED );
frame->AppendMsgPanel( _( "H Size" ), msg, RED );
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 )
_( "Ref." ), _( "Value" ), _( "Text" )
};
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
Line = module->m_Reference->m_Text;
msgpanel->AppendMessage( _( "Module" ), Line, DARKCYAN );
frame->AppendMsgPanel( _( "Module" ), Line, DARKCYAN );
Line = m_Text;
msgpanel->AppendMessage( _( "Text" ), Line, BROWN );
frame->AppendMsgPanel( _( "Text" ), Line, BROWN );
ii = m_Type;
if( ii > 2 )
ii = 2;
msgpanel->AppendMessage( _( "Type" ), text_type_msg[ii], DARKGREEN );
frame->AppendMsgPanel( _( "Type" ), text_type_msg[ii], DARKGREEN );
if( m_NoShow )
msg = _( "No" );
else
msg = _( "Yes" );
msgpanel->AppendMessage( _( "Display" ), msg, DARKGREEN );
frame->AppendMsgPanel( _( "Display" ), msg, DARKGREEN );
// Display text layer (use layer name if possible)
BOARD* board = NULL;
......@@ -494,24 +493,24 @@ void TEXTE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
msg = board->GetLayerName( m_Layer );
else
msg.Printf( wxT( "%d" ), m_Layer );
msgpanel->AppendMessage( _( "Layer" ), msg, DARKGREEN );
frame->AppendMsgPanel( _( "Layer" ), msg, DARKGREEN );
msg = _( " No" );
if( m_Mirror )
msg = _( " Yes" );
msgpanel->AppendMessage( _( "Mirror" ), msg, DARKGREEN );
frame->AppendMsgPanel( _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
msgpanel->AppendMessage( _( "Orient" ), msg, DARKGREEN );
frame->AppendMsgPanel( _( "Orient" ), msg, DARKGREEN );
valeur_param( m_Width, msg );
msgpanel->AppendMessage( _( "Width" ), msg, DARKGREEN );
frame->AppendMsgPanel( _( "Width" ), msg, DARKGREEN );
valeur_param( m_Size.x, msg );
msgpanel->AppendMessage( _( "H Size" ), msg, RED );
frame->AppendMsgPanel( _( "H Size" ), msg, RED );
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 )
{
wxString msg;
BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard();
// Display basic infos
DisplayInfoBase( frame );
DisplayInfoBase( frame );
// Display full track length (in pcbnew)
if( frame->m_Ident == PCB_FRAME )
......@@ -915,7 +915,7 @@ void TRACK::DisplayInfo( WinEDA_DrawFrame* frame )
int trackLen = 0;
Marque_Une_Piste( board, this, NULL, &trackLen, false );
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 )
wxString msg;
BOARD* board = ( (WinEDA_BasePcbFrame*) frame )->GetBoard();
frame->MsgPanel->EraseMsgBox();
frame->ClearMsgPanel();
switch( Type() )
{
......@@ -950,7 +950,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
msg = wxT( "????" ); break;
}
frame->MsgPanel->AppendMessage( _( "Type" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
// Display Net Name (in pcbnew)
if( frame->m_Ident == PCB_FRAME )
......@@ -962,18 +962,18 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
else
msg = wxT( "<noname>" );
frame->MsgPanel->AppendMessage( _( "NetName" ), msg, RED );
frame->AppendMsgPanel( _( "NetName" ), msg, RED );
/* Display net code : (usefull in test or debug) */
msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() );
frame->MsgPanel->AppendMessage( _( "NetCode" ), msg, RED );
frame->AppendMsgPanel( _( "NetCode" ), msg, RED );
}
#if defined(DEBUG)
/* Display the flags */
msg.Printf( wxT( "0x%08X" ), m_Flags );
frame->MsgPanel->AppendMessage( _( "Flags" ), msg, BLUE );
frame->AppendMsgPanel( _( "Flags" ), msg, BLUE );
#endif
......@@ -985,7 +985,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
if( GetState( SEGM_AR ) )
msg[2] = 'A';
frame->MsgPanel->AppendMessage( _( "Stat" ), msg, MAGENTA );
frame->AppendMsgPanel( _( "Status" ), msg, MAGENTA );
/* Display layer or layer pair) */
if( Type() == TYPE_VIA )
......@@ -1000,7 +1000,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
else
msg = board->GetLayerName( m_Layer );
frame->MsgPanel->AppendMessage( _( "Layer" ), msg, BROWN );
frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );
/* Display width */
valeur_param( (unsigned) m_Width, msg );
......@@ -1008,7 +1008,7 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
if( Type() == TYPE_VIA ) // Display Diam and Drill values
{
// Display diameter value:
frame->MsgPanel->AppendMessage( _( "Diam" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Diam" ), msg, DARKCYAN );
// Display drill value
int drill_value = GetDrillValue();
......@@ -1023,25 +1023,25 @@ void TRACK::DisplayInfoBase( WinEDA_DrawFrame* frame )
else
title += _( "(Default)" );
frame->MsgPanel->AppendMessage( title, msg, RED );
frame->AppendMsgPanel( title, msg, RED );
}
else
{
frame->MsgPanel->AppendMessage( _( "Width" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Width" ), msg, DARKCYAN );
}
NETCLASS* netclass = GetNetClass();
if( netclass )
{
msg = netclass->GetName();
frame->MsgPanel->AppendMessage( _( "Net Class" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Net Class" ), msg, DARKCYAN );
}
// Display segment length
if( Type() != TYPE_VIA ) // Display Diam and Drill values
{
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 )
wxString msg;
BOARD* board = (BOARD*) m_Parent;
WinEDA_MsgPanel *msgpanel = frame->MsgPanel;
wxASSERT( board );
msgpanel->EraseMsgBox();
frame->ClearMsgPanel();
msg = _( "Zone Outline" );
......@@ -918,7 +917,7 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
if( ncont )
msg << wxT( " " ) << _( "(Cutout)" );
msgpanel->AppendMessage( _( "Type" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
if( IsOnCopperLayer() )
{
......@@ -938,35 +937,35 @@ void ZONE_CONTAINER::DisplayInfo( WinEDA_DrawFrame* frame )
msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
msgpanel->AppendMessage( _( "NetName" ), msg, RED );
frame->AppendMsgPanel( _( "NetName" ), msg, RED );
}
else
msgpanel->AppendMessage( _( "Non Copper Zone" ), wxEmptyString, RED );
frame->AppendMsgPanel( _( "Non Copper Zone" ), wxEmptyString, RED );
/* Display net code : (usefull in test or debug) */
msg.Printf( wxT( "%d" ), GetNet() );
msgpanel->AppendMessage( _( "NetCode" ), msg, RED );
frame->AppendMsgPanel( _( "NetCode" ), msg, RED );
msg = board->GetLayerName( m_Layer );
msgpanel->AppendMessage( _( "Layer" ), msg, BROWN );
frame->AppendMsgPanel( _( "Layer" ), msg, BROWN );
msg.Printf( wxT( "%d" ), m_Poly->corner.size() );
msgpanel->AppendMessage( _( "Corners" ), msg, BLUE );
frame->AppendMsgPanel( _( "Corners" ), msg, BLUE );
if( m_FillMode )
msg.Printf( _( "Segments" ), m_FillMode );
else
msg = _( "Polygons" );
msgpanel->AppendMessage( _( "Fill mode" ), msg, BROWN );
frame->AppendMsgPanel( _( "Fill mode" ), msg, BROWN );
// Useful for statistics :
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() )
{
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
trackLen += track->GetLength();
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):
msg.Printf( wxT( "%d" ), g_CurrentTrackList.GetCount() );
frame->MsgPanel->AppendMessage( _( "Segs Count" ), msg, DARKCYAN );
frame->AppendMsgPanel( _( "Segs Count" ), msg, DARKCYAN );
DisplayOpt.ShowTrackClearanceMode = showTrackClearanceMode;
DisplayOpt.DisplayPcbTrackFill = Track_fill_copy;
......
......@@ -100,33 +100,45 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
wxPoint curspos = GetScreen()->m_Curseur;
wxString ModuleName, keys;
static wxArrayString HistoryList;
static wxString lastCommponentName;
bool AllowWildSeach = TRUE;
/* Ask for a component name or key words */
ModuleName = GetComponentName( this, HistoryList, _( "Place module" ), NULL );
ModuleName.MakeUpper();
WinEDA_SelectCmp dlg( this, GetComponentDialogPosition(), HistoryList,
_( "Place Module" ), false );
dlg.SetComponentName( lastCommponentName );
if ( dlg.ShowModal() == wxID_CANCEL )
return NULL;
ModuleName = dlg.GetComponentName();
if( ModuleName.IsEmpty() ) /* Cancel command */
{
DrawPanel->MouseToCursorSchema();
return NULL;
}
ModuleName.MakeUpper();
if( ModuleName[0] == '=' ) // Selection by keywords
{
AllowWildSeach = FALSE;
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 */
{
DrawPanel->MouseToCursorSchema();
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;
ModuleName = Select_1_Module_From_List( this, library, ModuleName, wxEmptyString );
ModuleName = Select_1_Module_From_List( this, library, ModuleName,
wxEmptyString );
if( ModuleName.IsEmpty() )
{
DrawPanel->MouseToCursorSchema();
......@@ -136,12 +148,13 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
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;
wxString wildname = wxChar( '*' ) + ModuleName + wxChar( '*' );
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() )
{
DrawPanel->MouseToCursorSchema();
......@@ -156,6 +169,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library,
if( module )
{
lastCommponentName = ModuleName;
AddHistoryComponentName( HistoryList, ModuleName );
module->m_Flags = IS_NEW;
......
......@@ -19,7 +19,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
{
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
MsgPanel->EraseMsgBox();
ClearMsgPanel();
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL )
......@@ -30,7 +30,7 @@ void WinEDA_BasePcbFrame::Genere_DXF( const wxString& FullFileName, int Layer,
}
SetLocaleTo_C_standard();
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN );
AppendMsgPanel( _( "File" ), FullFileName, CYAN );
DXF_PLOTTER* plotter = new DXF_PLOTTER();
plotter->set_paper_size( currentsheet );
......
......@@ -35,7 +35,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
{
wxPoint offset;
MsgPanel->EraseMsgBox();
ClearMsgPanel();
/* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
double scale = g_pcb_plot_options.Scale;
......@@ -64,7 +64,7 @@ void WinEDA_BasePcbFrame::Genere_GERBER( const wxString& FullFileName, int Layer
plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename( FullFileName );
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN );
AppendMsgPanel( _( "File" ), FullFileName, CYAN );
plotter->start_plot( output_file );
......
......@@ -25,7 +25,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
double scale;
wxPoint offset;
MsgPanel->EraseMsgBox();
ClearMsgPanel();
// 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
......@@ -50,7 +50,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer,
}
SetLocaleTo_C_standard();
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN );
AppendMsgPanel( _( "File" ), FullFileName, CYAN );
if( g_pcb_plot_options.PlotScaleOpt != 1 )
Center = TRUE; // Echelle != 1 donc trace centree du PCB
......
......@@ -31,7 +31,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
Ki_PageDescr* SheetPS;
wxPoint offset;
MsgPanel->EraseMsgBox();
ClearMsgPanel();
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) );
if( output_file == NULL )
......@@ -42,7 +42,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer,
}
SetLocaleTo_C_standard();
MsgPanel->AppendMessage( _( "File" ), FullFileName, CYAN );
AppendMsgPanel( _( "File" ), FullFileName, CYAN );
if( g_pcb_plot_options.PlotScaleOpt != 1 )
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