Commit 408cf4d8 authored by Wayne Stambaugh's avatar Wayne Stambaugh

More EESchema dialog file housekeeping.

parent 2cdce05d
......@@ -39,14 +39,14 @@ set(EESCHEMA_SRCS
dialogs/dialog_lib_edit_text_base.cpp
dialogs/dialog_build_BOM.cpp
dialogs/dialog_build_BOM_base.cpp
dialog_edit_component_in_lib.cpp
dialog_edit_component_in_lib_base.cpp
dialog_edit_component_in_schematic_fbp.cpp
dialog_edit_component_in_schematic.cpp
dialog_edit_label.cpp
dialog_edit_label_base.cpp
dialog_edit_libentry_fields_in_lib.cpp
dialog_edit_libentry_fields_in_lib_base.cpp
dialogs/dialog_edit_component_in_lib.cpp
dialogs/dialog_edit_component_in_lib_base.cpp
dialogs/dialog_edit_component_in_schematic_fbp.cpp
dialogs/dialog_edit_component_in_schematic.cpp
dialogs/dialog_edit_label.cpp
dialogs/dialog_edit_label_base.cpp
dialogs/dialog_edit_libentry_fields_in_lib.cpp
dialogs/dialog_edit_libentry_fields_in_lib_base.cpp
dialog_eeschema_config.cpp
dialog_eeschema_config_fbp.cpp
dialog_eeschema_options_base.cpp
......@@ -69,7 +69,6 @@ set(EESCHEMA_SRCS
dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_SVG_print.cpp
dialogs/dialog_SVG_print_base.cpp
edit_component_in_lib.cpp
edit_component_in_schematic.cpp
edit_label.cpp
eelayer.cpp
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_component_in_lib.cpp
// Author: jean-pierre Charras
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
#include "gestfich.h"
#include "general.h"
#include "protos.h"
#include "libeditframe.h"
#include "class_library.h"
#include "dialog_edit_component_in_lib.h"
DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( WinEDA_LibeditFrame* aParent):
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE(aParent)
{
m_Parent = aParent;
m_RecreateToolbar = false;
Init();
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
}
DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
{
}
/* Initialize state of check boxes and texts
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init()
{
SetFocus();
m_AliasLocation = -1;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
{
SetTitle( _( "Library Component Properties" ) );
return;
}
wxString title = _( "Properties for " );
bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0;
if( !isRoot )
{
title += m_Parent->GetAliasName() + _( " (alias of " ) +
component->GetName() + wxT( ")" );
}
else
{
title += component->GetName();
}
SetTitle( title );
InitPanelDoc();
InitBasicPanel();
if( isRoot && component->GetAliasCount() == 1 )
m_ButtonDeleteAllAlias->Enable( false );
/* Place list of alias names in listbox */
m_PartAliasListCtrl->Append( component->GetAliasNames( false ) );
if( component->GetAliasCount() <= 1 )
{
m_ButtonDeleteAllAlias->Enable( false );
m_ButtonDeleteOneAlias->Enable( false );
}
/* Read the Footprint Filter list */
m_FootprintFilterListBox->Append( component->GetFootPrints() );
if( component->GetFootPrints().GetCount() == 0 )
{
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
}
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
{
LIB_ALIAS* alias;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
return;
wxString aliasname = m_Parent->GetAliasName();
if( aliasname.IsEmpty() )
return;
alias = component->GetAlias( aliasname );
if( alias != NULL )
{
m_DocCtrl->SetValue( alias->GetDescription() );
m_KeywordsCtrl->SetValue( alias->GetKeyWords() );
m_DocfileCtrl->SetValue( alias->GetDocFileName() );
}
}
/*
* create the basic panel for component properties editing
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
{
LIB_COMPONENT* component = m_Parent->GetComponent();
if( m_Parent->GetShowDeMorgan() )
m_AsConvertButt->SetValue( true );
/* Default values for a new component. */
if( component == NULL )
{
m_ShowPinNumButt->SetValue( true );
m_ShowPinNameButt->SetValue( true );
m_PinsNameInsideButt->SetValue( true );
m_SelNumberOfUnits->SetValue( 1 );
m_SetSkew->SetValue( 40 );
m_OptionPower->SetValue( false );
m_OptionPartsLocked->SetValue( false );
return;
}
m_ShowPinNumButt->SetValue( component->ShowPinNumbers() );
m_ShowPinNameButt->SetValue( component->ShowPinNames() );
m_PinsNameInsideButt->SetValue( component->GetPinNameOffset() != 0 );
m_SelNumberOfUnits->SetValue( component->GetPartCount() );
m_SetSkew->SetValue( component->GetPinNameOffset() );
m_OptionPower->SetValue( component->IsPower() );
m_OptionPartsLocked->SetValue( component->UnitsLocked() && component->GetPartCount() > 1 );
}
/**************************************************************/
/* librairy editor: edition of component general properties */
/**************************************************************/
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_component_in_lib.cpp
// Author: jean-pierre Charras
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "gestfich.h"
#include "wxEeschemaStruct.h"
#include "appl_wxstruct.h"
#include "general.h"
#include "protos.h"
#include "libeditframe.h"
#include "class_library.h"
#include "eeschema_id.h"
#include "dialog_edit_component_in_lib.h"
/* Dialog box to edit a libentry (a component in library) properties */
/* Creates a NoteBook dialog
* Edition:
* Doc and keys words
* Parts per package
* General properties
* Fields are NOT edited here. There is a specific dialog box to do that
*/
DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( WinEDA_LibeditFrame* aParent ):
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( aParent )
{
m_Parent = aParent;
m_RecreateToolbar = false;
#include "dialog_edit_component_in_lib.h"
Init();
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
}
DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
{
}
/* Initialize state of check boxes and texts
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init()
{
SetFocus();
m_AliasLocation = -1;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
{
SetTitle( _( "Library Component Properties" ) );
return;
}
wxString title = _( "Properties for " );
bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0;
if( !isRoot )
{
title += m_Parent->GetAliasName() + _( " (alias of " ) + component->GetName() + wxT( ")" );
}
else
{
title += component->GetName();
}
SetTitle( title );
InitPanelDoc();
InitBasicPanel();
if( isRoot && component->GetAliasCount() == 1 )
m_ButtonDeleteAllAlias->Enable( false );
/* Place list of alias names in listbox */
m_PartAliasListCtrl->Append( component->GetAliasNames( false ) );
if( component->GetAliasCount() <= 1 )
{
m_ButtonDeleteAllAlias->Enable( false );
m_ButtonDeleteOneAlias->Enable( false );
}
/* Read the Footprint Filter list */
m_FootprintFilterListBox->Append( component->GetFootPrints() );
if( component->GetFootPrints().GetCount() == 0 )
{
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
}
m_sdbSizer2OK->SetDefault();
}
void WinEDA_LibeditFrame::OnEditComponentProperties( wxCommandEvent& event )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelClick( wxCommandEvent& event )
{
bool partLocked = GetComponent()->UnitsLocked();
EndModal( wxID_CANCEL );
}
DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this );
if( dlg.ShowModal() == wxID_CANCEL )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
{
LIB_ALIAS* alias;
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL )
return;
wxString aliasname = m_Parent->GetAliasName();
if( aliasname.IsEmpty() )
return;
if( partLocked != GetComponent()->UnitsLocked() )
alias = component->GetAlias( aliasname );
if( alias != NULL )
{
m_DocCtrl->SetValue( alias->GetDescription() );
m_KeywordsCtrl->SetValue( alias->GetKeyWords() );
m_DocfileCtrl->SetValue( alias->GetDocFileName() );
}
}
/*
* create the basic panel for component properties editing
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
{
LIB_COMPONENT* component = m_Parent->GetComponent();
if( m_Parent->GetShowDeMorgan() )
m_AsConvertButt->SetValue( true );
/* Default values for a new component. */
if( component == NULL )
{
// g_EditPinByPinIsOn is set to the better value, if m_UnitSelectionLocked has changed
g_EditPinByPinIsOn = GetComponent()->UnitsLocked() ? true : false;
m_ShowPinNumButt->SetValue( true );
m_ShowPinNameButt->SetValue( true );
m_PinsNameInsideButt->SetValue( true );
m_SelNumberOfUnits->SetValue( 1 );
m_SetSkew->SetValue( 40 );
m_OptionPower->SetValue( false );
m_OptionPartsLocked->SetValue( false );
return;
}
UpdateAliasSelectList();
UpdatePartSelectList();
DisplayLibInfos();
DisplayCmpDoc();
OnModify();
DrawPanel->Refresh();
m_ShowPinNumButt->SetValue( component->ShowPinNumbers() );
m_ShowPinNameButt->SetValue( component->ShowPinNames() );
m_PinsNameInsideButt->SetValue( component->GetPinNameOffset() != 0 );
m_SelNumberOfUnits->SetValue( component->GetPartCount() );
m_SetSkew->SetValue( component->GetPinNameOffset() );
m_OptionPower->SetValue( component->IsPower() );
m_OptionPartsLocked->SetValue( component->UnitsLocked() && component->GetPartCount() > 1 );
}
......@@ -124,6 +227,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
/* Set the option "Units locked".
* Obviously, cannot be true if there is only one part */
component->LockUnits( m_OptionPartsLocked->GetValue() );
if( component->GetPartCount() <= 1 )
component->LockUnits( false );
......@@ -190,6 +294,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
return;
wxTextEntryDialog dlg( this, _( "New alias:" ), _( "Component Alias" ), aliasname );
if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user
......@@ -211,8 +316,10 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
}
m_PartAliasListCtrl->Append( aliasname );
if( m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0 )
m_ButtonDeleteAllAlias->Enable( true );
m_ButtonDeleteOneAlias->Enable( true );
}
......@@ -223,6 +330,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& WXUNUS
if( aliasname.IsEmpty() )
return;
if( aliasname.CmpNoCase( m_Parent->GetAliasName() ) == 0 )
{
wxString msg;
......@@ -234,6 +342,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& WXUNUS
m_PartAliasListCtrl->Delete( m_PartAliasListCtrl->GetSelection() );
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component )
component->RemoveAlias( aliasname );
......@@ -271,8 +380,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert()
{
LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL
|| ( m_Parent->GetShowDeMorgan() == component->HasConversion() ) )
if( component == NULL || ( m_Parent->GetShowDeMorgan() == component->HasConversion() ) )
return false;
if( m_Parent->GetShowDeMorgan() )
......@@ -386,14 +494,14 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& WXUNUSED( event ) )
{
LIB_COMPONENT* component = m_Parent->GetComponent();
int ii = m_FootprintFilterListBox->GetSelection();
m_FootprintFilterListBox->Delete( ii );
if( !component || (m_FootprintFilterListBox->GetCount() == 0) )
if( !component || ( m_FootprintFilterListBox->GetCount() == 0 ) )
{
m_ButtonDeleteAllFootprintFilter->Enable( false );
m_ButtonDeleteOneFootprintFilter->Enable( false );
......
......@@ -47,10 +47,8 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
wxSize sizeNow = dialog->GetSize();
// this relies on wxDefaultSize being -1,-1, be careful here.
if( sizeNow.GetWidth()
< DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|| sizeNow.GetHeight()
< DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
{
dialog->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
}
......@@ -254,8 +252,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
++i;
}
LIB_COMPONENT* entry =
CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName );
if( entry && entry->IsPower() )
m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName;
......@@ -268,7 +265,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
// reference.
m_Cmp->SetRef( m_Parent->GetSheet(), m_FieldsBuf[REFERENCE].m_Text );
m_Parent->OnModify( );
m_Parent->OnModify();
m_Parent->TestDanglingEnds( m_Parent->GetScreen()->EEDrawList, NULL );
......@@ -292,7 +289,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler( wxCommandEvent&
blank.m_Orient = m_FieldsBuf[REFERENCE].m_Orient;
m_FieldsBuf.push_back( blank );
m_FieldsBuf[fieldNdx].m_Name = TEMPLATE_FIELDNAME::GetDefaultFieldName(fieldNdx);
m_FieldsBuf[fieldNdx].m_Name = TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldNdx );
m_skipCopyFromPanel = true;
setRowItem( fieldNdx, m_FieldsBuf[fieldNdx] );
......@@ -437,6 +434,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
// Please do not break the field constructors.
m_FieldsBuf.clear();
for( int i=0; i<MANDATORY_FIELDS; ++i )
{
m_FieldsBuf.push_back( aComponent->m_Fields[i] );
......@@ -715,6 +713,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
// For components with multiple parts per package, set the unit selection
choiceCount = unitChoice->GetCount();
if( m_Cmp->m_Multi <= choiceCount )
unitChoice->SetSelection( m_Cmp->m_Multi - 1 );
......
......@@ -155,6 +155,8 @@ void DialogLabelEditor::InitDialog()
{
m_TextShape->Show( false );
}
m_sdbSizer1OK->SetDefault();
}
......
......@@ -179,6 +179,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event
{
GetSizer()->SetSizeHints( this );
}
stdDialogButtonSizerOK->SetDefault();
}
......
......@@ -159,7 +159,7 @@ extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
int len, int orient, int Shape );
LIB_PIN::LIB_PIN(LIB_COMPONENT * aParent) :
LIB_PIN::LIB_PIN( LIB_COMPONENT * aParent ) :
LIB_DRAW_ITEM( COMPONENT_PIN_DRAW_TYPE, aParent )
{
m_PinLen = 300; /* default Pin len */
......@@ -541,6 +541,7 @@ bool LIB_PIN::HitTest( const wxPoint& aRefPos )
return HitTest( aRefPos, mindist, DefaultTransform );
}
/**
* Function HitTest
* @return true if the point aPosRef is near a pin
......@@ -611,6 +612,7 @@ bool LIB_PIN::Save( FILE* ExportFile )
}
ReturnPinStringNum( StringPinNum );
if( StringPinNum.IsEmpty() )
StringPinNum = wxT( "~" );
......@@ -781,8 +783,7 @@ bool LIB_PIN::Load( char* line, wxString& errorMsg )
break;
default:
errorMsg.Printf( wxT( "unknown pin attribute [%c]" ),
pinAttrs[j] );
errorMsg.Printf( wxT( "unknown pin attribute [%c]" ), pinAttrs[j] );
return false;
}
}
......@@ -873,8 +874,8 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
int posX = aPinPos.x, posY = aPinPos.y, len = m_PinLen;
BASE_SCREEN* screen = aPanel->GetScreen();
color = ReturnLayerColor( LAYER_PIN );
if( aColor < 0 ) // Used normal color or selected color
{
if( (m_Selected & IS_SELECTED) )
......@@ -885,24 +886,30 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
GRSetDrawMode( aDC, aDrawMode );
MapX1 = MapY1 = 0; x1 = posX; y1 = posY;
MapX1 = MapY1 = 0;
x1 = posX;
y1 = posY;
switch( aOrient )
{
case PIN_UP:
y1 = posY - len; MapY1 = 1;
y1 = posY - len;
MapY1 = 1;
break;
case PIN_DOWN:
y1 = posY + len; MapY1 = -1;
y1 = posY + len;
MapY1 = -1;
break;
case PIN_LEFT:
x1 = posX - len, MapX1 = 1;
x1 = posX - len;
MapX1 = 1;
break;
case PIN_RIGHT:
x1 = posX + len; MapX1 = -1;
x1 = posX + len;
MapX1 = -1;
break;
}
......@@ -1024,7 +1031,6 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
color );
}
}
else if( m_PinShape & NONLOGIC ) /* NonLogic pin symbol */
{
GRMoveTo( x1 - (MapX1 + MapY1) * NONLOGIC_PIN_DIM,
......@@ -1305,21 +1311,26 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
/* Create the pin num string */
ReturnPinStringNum( StringPinNum );
x1 = pin_pos.x; y1 = pin_pos.y;
x1 = pin_pos.x;
y1 = pin_pos.y;
switch( orient )
{
case PIN_UP:
y1 -= m_PinLen; break;
y1 -= m_PinLen;
break;
case PIN_DOWN:
y1 += m_PinLen; break;
y1 += m_PinLen;
break;
case PIN_LEFT:
x1 -= m_PinLen; break;
x1 -= m_PinLen;
break;
case PIN_RIGHT:
x1 += m_PinLen; break;
x1 += m_PinLen;
break;
}
if( m_PinName.IsEmpty() )
......@@ -1346,6 +1357,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
else // orient == PIN_LEFT
{
x = x1 - TextInside;
if( DrawPinName )
plotter->text( wxPoint( x, y1 ),
NameColor, m_PinName, TEXT_ORIENT_HORIZ,
......@@ -1381,8 +1393,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
aWidth, false, false );
if( DrawPinNum )
{
plotter->text( wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ),
plotter->text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
......@@ -1403,8 +1414,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
aWidth, false, false );
if( DrawPinNum )
{
plotter->text( wxPoint( x1 - TXTMARGE,
(y1 + pin_pos.y) / 2 ),
plotter->text( wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
......@@ -1431,7 +1441,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
}
if( DrawPinNum )
{
x = (x1 + pin_pos.x) / 2;
x = ( x1 + pin_pos.x ) / 2;
plotter->text( wxPoint( x, y1 + TXTMARGE ),
NumColor, StringPinNum,
TEXT_ORIENT_HORIZ, PinNumSize,
......@@ -1444,7 +1454,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
{
if( DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
y = ( y1 + pin_pos.y ) / 2;
plotter->text( wxPoint( x1 - TXTMARGE, y ),
NameColor, m_PinName,
TEXT_ORIENT_VERT, PinNameSize,
......@@ -1455,7 +1465,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
if( DrawPinNum )
{
plotter->text( wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
plotter->text( wxPoint( x1 + TXTMARGE, ( y1 + pin_pos.y ) / 2 ),
NumColor, StringPinNum,
TEXT_ORIENT_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER,
......@@ -1467,7 +1477,6 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
}
/* return the pin end position, for a component in normal orient */
wxPoint LIB_PIN::ReturnPinEndPoint() const
{
......@@ -1476,16 +1485,20 @@ wxPoint LIB_PIN::ReturnPinEndPoint() const
switch( m_Orient )
{
case PIN_UP:
pos.y += m_PinLen; break;
pos.y += m_PinLen;
break;
case PIN_DOWN:
pos.y -= m_PinLen; break;
pos.y -= m_PinLen;
break;
case PIN_LEFT:
pos.x -= m_PinLen; break;
pos.x -= m_PinLen;
break;
case PIN_RIGHT:
pos.x += m_PinLen; break;
pos.x += m_PinLen;
break;
}
return pos;
......@@ -1506,21 +1519,26 @@ int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform )
switch( m_Orient )
{
case PIN_UP:
end.y = 1; break;
end.y = 1;
break;
case PIN_DOWN:
end.y = -1; break;
end.y = -1;
break;
case PIN_LEFT:
end.x = -1; break;
end.x = -1;
break;
case PIN_RIGHT:
end.x = 1; break;
end.x = 1;
break;
}
// = pos of end point, according to the component orientation
end = aTransform.TransformCoordinate( end );
orient = PIN_UP;
if( end.x == 0 )
{
if( end.y > 0 )
......@@ -1529,6 +1547,7 @@ int LIB_PIN::ReturnPinDrawOrient( const TRANSFORM& aTransform )
else
{
orient = PIN_RIGHT;
if( end.x < 0 )
orient = PIN_LEFT;
}
......@@ -1581,8 +1600,10 @@ void LIB_PIN::SetPinNumFromString( wxString& buffer )
unsigned ii, len = buffer.Len();
ascii_buf[0] = ascii_buf[1] = ascii_buf[2] = ascii_buf[3] = 0;
if( len > 4 )
len = 4;
for( ii = 0; ii < len; ii++ )
{
ascii_buf[ii] = buffer.GetChar( ii );
......@@ -1716,7 +1737,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
frame->AppendMsgPanel( _( "Number" ), Text, DARKCYAN );
frame->AppendMsgPanel( _( "Type" ),
wxGetTranslation(pin_electrical_type_names[ m_PinType ]),
wxGetTranslation( pin_electrical_type_names[ m_PinType ] ),
RED );
Text = wxGetTranslation(pin_style_names[ GetStyleCodeIndex( m_PinShape ) ]);
frame->AppendMsgPanel( _( "Style" ), Text, BLUE );
......@@ -1727,8 +1748,7 @@ void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
frame->AppendMsgPanel( _( "Visible" ), Text, DARKGREEN );
/* Display pin length */
Text = ReturnStringFromValue( g_UserUnit, m_PinLen,
EESCHEMA_INTERNAL_UNIT, true );
Text = ReturnStringFromValue( g_UserUnit, m_PinLen, EESCHEMA_INTERNAL_UNIT, true );
frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA );
Text = wxGetTranslation(pin_orientation_names[ GetOrientationCodeIndex( m_Orient ) ]);
......@@ -1753,8 +1773,10 @@ EDA_Rect LIB_PIN::GetBoundingBox()
wxArrayString LIB_PIN::GetOrientationNames( void )
{
wxArrayString tmp;
for( unsigned ii = 0; ii < PIN_ORIENTATION_CNT; ii++ )
tmp.Add(wxGetTranslation(pin_orientation_names[ii]));
tmp.Add( wxGetTranslation( pin_orientation_names[ii] ) );
return tmp;
}
......@@ -1785,8 +1807,10 @@ int LIB_PIN::GetOrientationCodeIndex( int code )
wxArrayString LIB_PIN::GetStyleNames( void )
{
wxArrayString tmp;
for( unsigned ii = 0; ii < PIN_STYLE_CNT; ii++ )
tmp.Add(wxGetTranslation(pin_style_names[ii]));
tmp.Add( wxGetTranslation( pin_style_names[ii] ) );
return tmp;
}
......@@ -1817,11 +1841,14 @@ int LIB_PIN::GetStyleCodeIndex( int code )
wxArrayString LIB_PIN::GetElectricalTypeNames( void )
{
wxArrayString tmp;
for( unsigned ii = 0; ii < PIN_ELECTRICAL_TYPE_CNT; ii++ )
tmp.Add(wxGetTranslation(pin_electrical_type_names[ii]));
tmp.Add( wxGetTranslation( pin_electrical_type_names[ii] ) );
return tmp;
}
/**
* Get a list of pin electrical type names.
* @return List of valid pin electrical type bitmaps symbols in .xpm format
......@@ -1832,6 +1859,7 @@ const char*** LIB_PIN::GetElectricalTypeSymbols( void )
return s_icons_Pins_Electrical_Type;
}
/**
* Get a list of pin electrical type names.
*
......@@ -1843,6 +1871,7 @@ const char*** LIB_PIN::GetOrientationSymbols()
return s_icons_Pins_Orientations;
}
/**
* Get a list of pin styles bitmaps for menus and dialogs.
*
......@@ -1853,6 +1882,7 @@ const char*** LIB_PIN::GetStyleSymbols()
return s_icons_Pins_Shapes;
}
#if defined(DEBUG)
void LIB_PIN::Show( int nestLevel, std::ostream& os )
......
......@@ -28,6 +28,7 @@
#include "dialogs/dialog_lib_edit_text.h"
#include "dialogs/dialog_SVG_print.h"
#include "dialogs/dialog_edit_component_in_lib.h"
#include <boost/foreach.hpp>
......@@ -1023,3 +1024,27 @@ void WinEDA_LibeditFrame::EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem )
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, NULL,
DefaultTransform );
}
void WinEDA_LibeditFrame::OnEditComponentProperties( wxCommandEvent& event )
{
bool partLocked = GetComponent()->UnitsLocked();
DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this );
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( partLocked != GetComponent()->UnitsLocked() )
{
// g_EditPinByPinIsOn is set to the better value, if m_UnitSelectionLocked has changed
g_EditPinByPinIsOn = GetComponent()->UnitsLocked() ? true : false;
}
UpdateAliasSelectList();
UpdatePartSelectList();
DisplayLibInfos();
DisplayCmpDoc();
OnModify();
DrawPanel->Refresh();
}
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