diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d7cd1b9a66..1a4101693a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,19 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2008-Dec-30 UPDATE Jean-Pierre Charras +================================================================================ +++Eeschema: + Note: this is a work in progress! + Change dialog to edit fields in libedit. + Most of code created by Dick to edit fields in shematic is reused (this was the goal). + Component dialog properties -in libedit) is not modified, and fields can be also edited with it. + New dialog box is similar to the component dialog box used in schematic. + But all features do not work (work in progress!) + TODO (by me): + use vector to handle fields in libraries, like schematic. + Finish work, and test it. + 2008-Dec-29 UPDATE Dick Hollenbeck ================================================================================ ++all diff --git a/common/about_kicad.cpp b/common/about_kicad.cpp index b43f6a7855..32f78ae48e 100644 --- a/common/about_kicad.cpp +++ b/common/about_kicad.cpp @@ -4,7 +4,6 @@ #include "wx/generic/aboutdlgg.h" #include "fctsys.h" -#include "gr_basic.h" #include "common.h" extern wxString g_Main_Title; // Import program title diff --git a/common/drawpanel.cpp b/common/drawpanel.cpp index bbc1e21340..bbb3756793 100644 --- a/common/drawpanel.cpp +++ b/common/drawpanel.cpp @@ -580,11 +580,21 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC ) } +//#define USE_GCDC_IN_KICAD +#ifdef USE_GCDC_IN_KICAD +#include +#endif /***************************************************/ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event ) /***************************************************/ { +#ifdef USE_GCDC_IN_KICAD + wxPaintDC pDC( this ); + wxGCDC paintDC(pDC); // Following line should be disabled on MSW and OS X + paintDC.GetGraphicsContext()->Translate(0.5, 0.5); // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187 +#else wxPaintDC paintDC( this ); +#endif EDA_Rect tmp; wxRect PaintClipBox; wxPoint org; diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 57e29ebca7..77e1b11fde 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -41,6 +41,8 @@ set(EESCHEMA_SRCS 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 dialog_eeschema_config.cpp dialog_erc.cpp # dialog_find.cpp diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index 54e94e88d9..834201ec85 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -410,8 +410,11 @@ LibDrawField* LibDrawField::GenCopy() } -// copie du field dans le field Target -void LibDrawField::Copy( LibDrawField* Target ) +/** Function Copy + * copy parameters of this to Target. Pointers are not copied + * @param Target = the LibDrawField to set with "this" values + */ +void LibDrawField::Copy( LibDrawField* Target ) const { Target->m_Pos = m_Pos; Target->m_Size = m_Size; diff --git a/eeschema/class_library.h b/eeschema/class_library.h index 70607b77ae..39db1c7df0 100644 --- a/eeschema/class_library.h +++ b/eeschema/class_library.h @@ -137,6 +137,12 @@ public: * @return bool - true if success writing else false. */ bool Save( FILE* aFile ); + + /** Function SetFields + * initialize fields from a vector of fields + * @param aFields a std::vector to import. + */ + void SetFields( const std::vector aFields ); }; diff --git a/eeschema/classes_body_items.h b/eeschema/classes_body_items.h index da20c65b10..7b0e8a22ab 100644 --- a/eeschema/classes_body_items.h +++ b/eeschema/classes_body_items.h @@ -497,7 +497,14 @@ public: LibDrawField* GenCopy(); - void Copy( LibDrawField* Target ); + + /** Function Copy + * copy parameters of this to Target. Pointers are not copied + * @param Target = the LibDrawField to set with "this" values + */ + void Copy( LibDrawField* Target ) const; + + void SetFields( const std::vector aFields ); void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, int aDrawMode, void* aData, int aTransformMatrix[2][2] ); diff --git a/eeschema/dialog_edit_component_in_schematic.cpp b/eeschema/dialog_edit_component_in_schematic.cpp index 21a956e9da..0bf40fdff2 100644 --- a/eeschema/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialog_edit_component_in_schematic.cpp @@ -445,7 +445,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() fieldNameTextCtrl->SetValue( field.m_Name ); // if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing - // fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 ); + fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 ); fieldNameTextCtrl->SetEditable( fieldNdx >= FIELD1 ); fieldValueTextCtrl->SetValue( field.m_Text ); diff --git a/eeschema/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialog_edit_libentry_fields_in_lib.cpp new file mode 100644 index 0000000000..37b662c7fa --- /dev/null +++ b/eeschema/dialog_edit_libentry_fields_in_lib.cpp @@ -0,0 +1,644 @@ +/*******************************************************************************/ +/* library editor: edition of fields of lib entries (components in libraries) */ +/*******************************************************************************/ + +#include "fctsys.h" + +#include + +#include "common.h" +#include "program.h" +#include "libcmp.h" +#include "general.h" + +#include "protos.h" + +#include "dialog_edit_libentry_fields_in_lib_base.h" + +// Local variables: +static int s_SelectedRow; + +/** @todo function to move in a file like class_libentry.cpp + */ + +/** Function SetFields + * initialize fields from a vector of fields + * @param aFields a std::vector to import. + */ +void EDA_LibComponentStruct::SetFields( const std::vector aFields ) +{ + // Init basic fields (Value = name in lib, and reference): + aFields[VALUE].Copy( &m_Name ); + aFields[REFERENCE].Copy( &m_Prefix ); + + // Init others fields: + for( unsigned ii = FOOTPRINT; ii < aFields.size(); ii++ ) + { + LibDrawField* Field = CurrentLibEntry->Fields; + LibDrawField* NextField, * previousField = NULL; + while( Field ) + { + NextField = Field->Next(); + if( Field->m_FieldId == (int) ii ) + { + aFields[ii].Copy( Field ); + + // An old field exists; delete it if void + if( Field->m_Text.IsEmpty() ) + { + if( ii < FIELD1 || Field->m_Name.IsEmpty() ) + { + SAFE_DELETE( Field ); + if( previousField ) + previousField->SetNext( NextField ); + else + Fields = NextField; + } + } + break; + } + + previousField = Field; + Field = NextField; + } + + if( Field == NULL ) // Do not exists: must be created if not void + { + bool create = FALSE; + if( !aFields[ii].m_Text.IsEmpty() ) + create = TRUE; + if( !aFields[ii].m_Name.IsEmpty() + && ( aFields[ii].m_Name != ReturnDefaultFieldName( ii ) ) ) + create = TRUE; + if( create ) + { + Field = new LibDrawField( ii ); + + *Field = aFields[ii]; + Field->SetNext( CurrentLibEntry->Fields ); + Fields = Field; + } + } + } + + /* for a user field (FieldId >= FIELD1), if a field value is void, + * fill it with "~" because for a library component a void field is not a very good idea + * (we do not see anything...) and in schematic this text is like a void text + * and for not editable names, remove the name (thar is the default name + */ + for( LibDrawField* Field = Fields; Field; Field = Field->Next() ) + { + if( Field->m_FieldId >= FIELD1 ) + { + if( Field->m_Text.IsEmpty() ) + Field->m_Text = wxT( "~" ); + } + else + Field->m_Name.Empty(); + } +} + + +/*****************************************************************************************/ +class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE +/*****************************************************************************************/ +{ +private: + WinEDA_LibeditFrame* m_Parent; + EDA_LibComponentStruct* m_LibEntry; + bool m_skipCopyFromPanel; + + /// a copy of the edited component's LibDrawFields + std::vector m_FieldsBuf; + +public: + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( WinEDA_LibeditFrame* aParent, + EDA_LibComponentStruct* aLibEntry ); + ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(); + +private: + + // Events handlers: + void OnInitDialog( wxInitDialogEvent& event ); + + void OnListItemDeselected( wxListEvent& event ); + void OnListItemSelected( wxListEvent& event ); + void addFieldButtonHandler( wxCommandEvent& event ); + void deleteFieldButtonHandler( wxCommandEvent& event ); + void moveUpButtonHandler( wxCommandEvent& event ); + void OnCancelButtonClick( wxCommandEvent& event ); + void OnOKButtonClick( wxCommandEvent& event ); + + // internal functions: + void setSelectedFieldNdx( int aFieldNdx ); + + int getSelectedFieldNdx(); + + /** + * Function InitBuffers + * sets up to edit the given component. + * @param aComponent The component to edit. + */ + void InitBuffers( void ); + + /** + * Function copySelectedFieldToPanel + * sets the values displayed on the panel according to + * the currently selected field row + */ + void copySelectedFieldToPanel(); + + + /** + * Function copyPanelToSelectedField + * copies the values displayed on the panel fields to the currently selected field + * @return bool - true if all fields are OK, else false if the user has put + * bad data into a field, and this value can be used to deny a row change. + */ + bool copyPanelToSelectedField(); + void setRowItem( int aFieldNdx, const LibDrawField& aField ); +}; + +/*****************************************************************/ +void WinEDA_LibeditFrame::InstallFieldsEditorDialog( void ) +/*****************************************************************/ +{ + if( CurrentLibEntry == NULL ) + return; + + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB* frame = + new DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( this, CurrentLibEntry ); + + int IsModified = frame->ShowModal(); frame->Destroy(); + + if( IsModified ) + Refresh(); +} + + +/***********************************************************************/ +DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( + WinEDA_LibeditFrame* aParent, + EDA_LibComponentStruct* aLibEntry ) : + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent ) +{ + m_Parent = aParent; + m_LibEntry = aLibEntry; +/***********************************************************************/ +} + + +/***********************************************************************/ +DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB() +/***********************************************************************/ +{ +} + + +/**********************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event ) +/**********************************************************************************/ +{ + SetFont( *g_DialogFont ); + m_skipCopyFromPanel = false; + wxListItem columnLabel; + + columnLabel.SetImage( -1 ); + + columnLabel.SetText( _( "Name" ) ); + fieldListCtrl->InsertColumn( 0, columnLabel ); + + columnLabel.SetText( _( "Value" ) ); + fieldListCtrl->InsertColumn( 1, columnLabel ); + + wxString label = _( "Size" ) + ReturnUnitSymbol( g_UnitMetric ); + textSizeLabel->SetLabel( label ); + + label = _( "Pos " ); + label += _( "X" ); + label += ReturnUnitSymbol( g_UnitMetric ); + posXLabel->SetLabel( label ); + + label = _( "Pos " ); + label += _( "Y" ); + label += ReturnUnitSymbol( g_UnitMetric ); + posYLabel->SetLabel( label ); + + InitBuffers(); + copySelectedFieldToPanel(); + + if( GetSizer() ) + { + GetSizer()->SetSizeHints( this ); + } +} + + +/**********************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnListItemDeselected( wxListEvent& event ) +/**********************************************************************************/ +{ + if( !m_skipCopyFromPanel ) + { + if( !copyPanelToSelectedField() ) + event.Skip(); // do not go to the next row + } +} + + +/**********************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnListItemSelected( wxListEvent& event ) +/**********************************************************************************/ +{ + // remember the selected row, statically + s_SelectedRow = event.GetIndex(); + + copySelectedFieldToPanel(); +} + + +/***********************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick( wxCommandEvent& event ) +/***********************************************************************************/ +{ + EndModal( 1 ); +} + + +/**********************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event ) +/**********************************************************************************/ +{ + if( !copyPanelToSelectedField() ) + return; + + /* A new name could be entered in VALUE field. + * Must not be an existing alias name in alias list box */ + wxString* newvalue = &m_FieldsBuf[VALUE].m_Text; + for( unsigned ii = 0; ii < m_LibEntry->m_AliasList.GetCount(); ii += ALIAS_NEXT ) + { + wxString* libname = &(m_LibEntry->m_AliasList[ii + ALIAS_NAME]); + if( newvalue->CmpNoCase( *libname ) == 0 ) + { + wxString msg; + msg.Printf( + _( + "A new name is entered for this component\nAn alias %s already exists!\nCannot update this component" ), + newvalue->GetData() ); + DisplayError( this, msg ); + return; + } + } + + /* save old cmp in undo list */ + m_Parent->SaveCopyInUndoList( m_LibEntry, IS_CHANGED ); + + // delete any fields with no name + for( unsigned i = FIELD1; iSetFields( m_FieldsBuf ); + + m_Parent->GetScreen()->SetModify(); + + m_Parent->DrawPanel->Refresh( TRUE ); + + EndModal( 0 ); +} + + +/**************************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent& event ) +/**************************************************************************************/ +{ + // in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab + // screen contents. + if( !copyPanelToSelectedField() ) + return; + + unsigned fieldNdx = m_FieldsBuf.size(); + + LibDrawField blank( fieldNdx ); + + blank.m_Orient = m_FieldsBuf[REFERENCE].m_Orient; + + m_FieldsBuf.push_back( blank ); + + setRowItem( fieldNdx, m_FieldsBuf[fieldNdx] ); + + m_skipCopyFromPanel = true; + setSelectedFieldNdx( fieldNdx ); + m_skipCopyFromPanel = false; +} + + +/*****************************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEvent& event ) +/*****************************************************************************************/ +{ + unsigned fieldNdx = getSelectedFieldNdx(); + + if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too + return; + + if( fieldNdx < FIELD1 ) + { + wxBell(); + return; + } + + m_FieldsBuf.erase( m_FieldsBuf.begin() + fieldNdx ); + fieldListCtrl->DeleteItem( fieldNdx ); + + if( fieldNdx >= m_FieldsBuf.size() ) + --fieldNdx; + + m_skipCopyFromPanel = true; + setSelectedFieldNdx( fieldNdx ); + m_skipCopyFromPanel = false; +} + + +/*************************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& event ) +/*************************************************************************************/ +{ + unsigned fieldNdx = getSelectedFieldNdx(); + + if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too + return; + + if( fieldNdx <= FIELD1 ) + { + wxBell(); + return; + } + + if( !copyPanelToSelectedField() ) + return; + + // swap the fieldNdx field with the one before it, in both the vector + // and in the fieldListCtrl + LibDrawField tmp = m_FieldsBuf[fieldNdx - 1]; + + m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx]; + setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] ); + + m_FieldsBuf[fieldNdx] = tmp; + setRowItem( fieldNdx, tmp ); + + m_skipCopyFromPanel = true; + setSelectedFieldNdx( fieldNdx - 1 ); + m_skipCopyFromPanel = false; +} + + +/****************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setSelectedFieldNdx( int aFieldNdx ) +/****************************************************************************/ +{ + /* deselect old selection, but I think this is done by single selection flag within fieldListCtrl + * fieldListCtrl->SetItemState( s_SelectedRow, 0, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED); + */ + + if( aFieldNdx >= (int) m_FieldsBuf.size() ) + aFieldNdx = m_FieldsBuf.size() - 1; + + if( aFieldNdx < 0 ) + aFieldNdx = 0; + + fieldListCtrl->SetItemState( aFieldNdx, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); + fieldListCtrl->EnsureVisible( aFieldNdx ); + + s_SelectedRow = aFieldNdx; +} + + +int DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::getSelectedFieldNdx() +{ + return s_SelectedRow; +} + + +bool SortFieldsById(const LibDrawField& item1, const LibDrawField& item2) +{ + return item1.m_FieldId < item2.m_FieldId; +} + +/***********************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void ) +/***********************************************************/ +{ + // copy all the fields to a work area + m_FieldsBuf.reserve(NUMBER_OF_FIELDS); + + m_FieldsBuf.push_back( m_LibEntry->m_Prefix ); + m_FieldsBuf.push_back( m_LibEntry->m_Name ); + + for( LibDrawField* field = m_LibEntry->Fields; field != NULL; field = field->Next() ) + m_FieldsBuf.push_back( *field ); + + // Display 12 fields (or more), and add missing fields + LibDrawField blank( 2 ); + unsigned fcount = m_FieldsBuf.size(); + for( unsigned ii = 2; ii < NUMBER_OF_FIELDS; ii++ ) + { + unsigned jj; + for ( jj = 2; jj < fcount; jj ++ ) + if ( m_FieldsBuf[jj].m_FieldId == (int)ii ) // Field id already exists, ok. + break; + if ( jj < fcount ) continue; + // Field id not found: add this field + blank.m_FieldId = ii; + m_FieldsBuf.push_back( blank ); + } + + m_FieldsBuf[VALUE].m_Name << wxT( "/" ) << _( "Chip Name" ); + + // Sort files by field id, because they are not entered by id + sort(m_FieldsBuf.begin(), m_FieldsBuf.end(), SortFieldsById); + + // Now, all fields with Id 0 to NUMBER_OF_FIELDS-1 exist + // init default fields names + for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) + { + if( m_FieldsBuf[ii].m_Name.IsEmpty() || ii < FIELD1 ) + m_FieldsBuf[ii].m_Name = ReturnDefaultFieldName( ii ); + } + + for( unsigned ii = 0; ii < m_FieldsBuf.size(); ++ii ) + { + setRowItem( ii, m_FieldsBuf[ii] ); + } + + // put focus on the list ctrl + fieldListCtrl->SetFocus(); + + // resume editing at the last row edited, last time dialog was up. + setSelectedFieldNdx( s_SelectedRow ); +} + + +/***********************************************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LibDrawField& aField ) +/***********************************************************************************************/ +{ + wxASSERT( aFieldNdx >= 0 ); + + // insert blanks if aFieldNdx is referencing a "yet to be defined" row + while( aFieldNdx >= fieldListCtrl->GetItemCount() ) + { + long ndx = fieldListCtrl->InsertItem( fieldListCtrl->GetItemCount(), wxEmptyString ); + + wxASSERT( ndx >= 0 ); + + fieldListCtrl->SetItem( ndx, 1, wxEmptyString ); + } + + fieldListCtrl->SetItem( aFieldNdx, 0, aField.m_Name ); + fieldListCtrl->SetItem( aFieldNdx, 1, aField.m_Text ); + + // recompute the column widths here, after setting texts + fieldListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE ); + fieldListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE ); +} + + +/****************************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() +/****************************************************************/ +{ + unsigned fieldNdx = getSelectedFieldNdx(); + + if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too + return; + + LibDrawField& field = m_FieldsBuf[fieldNdx]; + + showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) ); + + rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT ); + + int style = 0; + if( field.m_Italic ) + style = 1; + if( field.m_Width > 1 ) + style |= 2; + m_StyleRadioBox->SetSelection( style ); + + fieldNameTextCtrl->SetValue( field.m_Name ); + + // if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing + fieldNameTextCtrl->Enable( fieldNdx >= FIELD1 ); + fieldNameTextCtrl->SetEditable( fieldNdx >= FIELD1 ); + + fieldValueTextCtrl->SetValue( field.m_Text ); + + if( fieldNdx == VALUE && m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER ) + fieldValueTextCtrl->Enable( FALSE ); + + textSizeTextCtrl->SetValue( + WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) ); + + wxPoint coord = field.m_Pos; + wxPoint zero; + + // If the field value is empty and the position is at relative zero, we set the + // initial position as a small offset from the ref field, and orient + // it the same as the ref field. That is likely to put it at least + // close to the desired position. + if( coord == zero && field.m_Text.IsEmpty() ) + { + rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].m_Orient == TEXT_ORIENT_VERT ); + + coord.x = m_FieldsBuf[REFERENCE].m_Pos.x + (fieldNdx - FIELD1 + 1) * 100; + coord.y = m_FieldsBuf[REFERENCE].m_Pos.y + (fieldNdx - FIELD1 + 1) * 100; + + // coord can compute negative if field is < FIELD1, e.g. FOOTPRINT. + // That is ok, we basically don't want all the new empty fields on + // top of each other. + } + + wxString coordText = ReturnStringFromValue( g_UnitMetric, coord.x, EESCHEMA_INTERNAL_UNIT ); + posXTextCtrl->SetValue( coordText ); + + // Note: the Y axis for components in lib is from bottom to top + // and the screen axis is top to bottom: we must change the y coord sign for editing + NEGATE( coord.y ); + coordText = ReturnStringFromValue( g_UnitMetric, coord.y, EESCHEMA_INTERNAL_UNIT ); + posYTextCtrl->SetValue( coordText ); +} + + +/*****************************************************************/ +bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() +/*****************************************************************/ +{ + unsigned fieldNdx = getSelectedFieldNdx(); + + if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too + return true; + + LibDrawField& field = m_FieldsBuf[fieldNdx]; + + if( showCheckBox->GetValue() ) + field.m_Attributs &= ~TEXT_NO_VISIBLE; + else + field.m_Attributs |= TEXT_NO_VISIBLE; + + if( rotateCheckBox->GetValue() ) + field.m_Orient = TEXT_ORIENT_VERT; + else + field.m_Orient = TEXT_ORIENT_HORIZ; + + rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT ); + + /* Void fields for REFERENCE and VALUE are not allowed + * chnage therm only for a new non void value + */ + if( !fieldValueTextCtrl->GetValue().IsEmpty() ) + field.m_Text = fieldValueTextCtrl->GetValue(); + + if( !fieldNameTextCtrl->GetValue().IsEmpty() ) + field.m_Name = fieldNameTextCtrl->GetValue(); + + setRowItem( fieldNdx, field ); // update fieldListCtrl + + field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( + textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UnitMetric ); + field.m_Size.y = field.m_Size.x; + + int style = m_StyleRadioBox->GetSelection(); + if( (style & 1 ) != 0 ) + field.m_Italic = true; + else + field.m_Italic = false; + + if( (style & 2 ) != 0 ) + field.m_Width = field.m_Size.x / 4; + else + field.m_Width = 0; + + double value; + + posXTextCtrl->GetValue().ToDouble( &value ); + field.m_Pos.x = From_User_Unit( g_UnitMetric, value, EESCHEMA_INTERNAL_UNIT ); + + posYTextCtrl->GetValue().ToDouble( &value ); + field.m_Pos.y = From_User_Unit( g_UnitMetric, value, EESCHEMA_INTERNAL_UNIT ); + + // Note: the Y axis for components in lib is from bottom to top + // and the screen axis is top to bottom: we must change the y coord sign for editing + NEGATE( field.m_Pos.y ); + + return true; +} diff --git a/eeschema/dialog_edit_libentry_fields_in_lib_base.cpp b/eeschema/dialog_edit_libentry_fields_in_lib_base.cpp new file mode 100644 index 0000000000..0a0635d0bc --- /dev/null +++ b/eeschema/dialog_edit_libentry_fields_in_lib_base.cpp @@ -0,0 +1,217 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_edit_libentry_fields_in_lib_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* mainSizer; + mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* fieldsSizer; + fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL ); + + wxStaticBoxSizer* gridStaticBoxSizer; + gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); + gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 ); + + addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 ); + addFieldButton->SetToolTip( _("Add a new custom field") ); + + gridStaticBoxSizer->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); + + deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 ); + deleteFieldButton->SetToolTip( _("Delete one of the optional fields") ); + + gridStaticBoxSizer->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); + + moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + moveUpButton->SetToolTip( _("Move the selected optional fields up one position") ); + + gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 ); + + fieldsSizer->Add( gridStaticBoxSizer, 5, wxEXPAND|wxRIGHT, 8 ); + + wxBoxSizer* fieldEditBoxSizer; + fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* optionsSizer; + optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxHORIZONTAL ); + + wxBoxSizer* orientationSizer; + orientationSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxString m_FieldPositionCtrlChoices[] = { _("Align left"), _("Align center"), _("Align right") }; + int m_FieldPositionCtrlNChoices = sizeof( m_FieldPositionCtrlChoices ) / sizeof( wxString ); + m_FieldPositionCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldPositionCtrlNChoices, m_FieldPositionCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_FieldPositionCtrl->SetSelection( 1 ); + m_FieldPositionCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") ); + + orientationSizer->Add( m_FieldPositionCtrl, 1, wxALL, 8 ); + + optionsSizer->Add( orientationSizer, 1, wxLEFT|wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL, 0 ); + + wxBoxSizer* mirrorSizer; + mirrorSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxString m_FieldVJustifyCtrlChoices[] = { _("Align bottom"), _("Align center"), _("Align top") }; + int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); + m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_FieldVJustifyCtrl->SetSelection( 1 ); + m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); + + mirrorSizer->Add( m_FieldVJustifyCtrl, 1, wxALL, 8 ); + + optionsSizer->Add( mirrorSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL, 0 ); + + fieldEditBoxSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* visibilitySizer; + visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL ); + + wxBoxSizer* bShowRotateSizer; + bShowRotateSizer = new wxBoxSizer( wxVERTICAL ); + + showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); + + showCheckBox->SetToolTip( _("Check if you want this field visible") ); + + bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 ); + + rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 ); + + rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") ); + + bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 ); + + visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); + + wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; + int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString ); + m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); + m_StyleRadioBox->SetSelection( 0 ); + visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND, 5 ); + + wxBoxSizer* fieldNameBoxSizer; + fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); + + fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldNameLabel->Wrap( -1 ); + fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 ); + + fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldNameTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); + + fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 ); + + fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* fieldTextBoxSizer; + fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL ); + + fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldValueLabel->Wrap( -1 ); + fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 ); + + fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); + + fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 ); + + fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* textSizeBoxSizer; + textSizeBoxSizer = new wxBoxSizer( wxVERTICAL ); + + textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size(\")"), wxDefaultPosition, wxDefaultSize, 0 ); + textSizeLabel->Wrap( -1 ); + textSizeBoxSizer->Add( textSizeLabel, 0, 0, 5 ); + + textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") ); + + textSizeBoxSizer->Add( textSizeTextCtrl, 0, wxEXPAND, 5 ); + + fieldEditBoxSizer->Add( textSizeBoxSizer, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* positionBoxSizer; + positionBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* posXBoxSizer; + posXBoxSizer = new wxBoxSizer( wxVERTICAL ); + + posXLabel = new wxStaticText( this, wxID_ANY, _("PosX(\")"), wxDefaultPosition, wxDefaultSize, 0 ); + posXLabel->Wrap( -1 ); + posXBoxSizer->Add( posXLabel, 0, 0, 5 ); + + posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + posXBoxSizer->Add( posXTextCtrl, 0, wxEXPAND, 5 ); + + positionBoxSizer->Add( posXBoxSizer, 1, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* posYBoxSizer; + posYBoxSizer = new wxBoxSizer( wxVERTICAL ); + + posYLabel = new wxStaticText( this, wxID_ANY, _("PosY(\")"), wxDefaultPosition, wxDefaultSize, 0 ); + posYLabel->Wrap( -1 ); + posYBoxSizer->Add( posYLabel, 0, 0, 5 ); + + posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") ); + + posYBoxSizer->Add( posYTextCtrl, 0, wxEXPAND, 5 ); + + positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 ); + + fieldEditBoxSizer->Add( positionBoxSizer, 1, wxEXPAND, 5 ); + + fieldsSizer->Add( fieldEditBoxSizer, 3, wxEXPAND, 5 ); + + mainSizer->Add( fieldsSizer, 1, wxEXPAND|wxALL, 5 ); + + stdDialogButtonSizer = new wxStdDialogButtonSizer(); + stdDialogButtonSizerOK = new wxButton( this, wxID_OK ); + stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK ); + stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL ); + stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel ); + stdDialogButtonSizer->Realize(); + mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 ); + + this->SetSizer( mainSizer ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); + fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); + fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); + addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this ); + deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this ); + moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this ); + stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); + stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); +} + +DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); + fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); + fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); + addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this ); + deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this ); + moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this ); + stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); + stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); +} diff --git a/eeschema/dialog_edit_libentry_fields_in_lib_base.fbp b/eeschema/dialog_edit_libentry_fields_in_lib_base.fbp new file mode 100644 index 0000000000..700140dbb0 --- /dev/null +++ b/eeschema/dialog_edit_libentry_fields_in_lib_base.fbp @@ -0,0 +1,1294 @@ + + + + + ; + C++ + 1 + ANSI + connect + dialog_edit_libentry_fields_in_lib_base + 1000 + none + 1 + DialogEditLibentryFields_in_lib_base + + . + + 1 + 0 + 0 + + + + + 1 + + + + 0 + wxID_ANY + + + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE + + 773,550 + wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU + + Fields Properties + + + + + + + + + + + + + + OnInitDialog + + + + + + + + + + + + + + + + + + + + + + + mainSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Fields + + fieldsSizer + wxHORIZONTAL + none + + + 8 + wxEXPAND|wxRIGHT + 5 + + wxID_ANY + + + gridStaticBoxSizer + wxVERTICAL + none + + + 8 + wxALL|wxEXPAND + 1 + + + + 1 + + + 0 + wxID_ANY + + + fieldListCtrl + protected + + + wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnListItemDeselected + + + + OnListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Add Field + + + addFieldButton + protected + + + + + Add a new custom field + + + + addFieldButtonHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Delete Field + + + deleteFieldButton + protected + + + + + Delete one of the optional fields + + + + deleteFieldButtonHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_ANY + Move Up + + + moveUpButton + protected + + + + + Move the selected optional fields up one position + + + + moveUpButtonHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 3 + + + fieldEditBoxSizer + wxVERTICAL + none + + 5 + wxALIGN_TOP|wxALL|wxEXPAND + 0 + + wxID_ANY + Options + + optionsSizer + wxHORIZONTAL + none + + + 0 + wxLEFT|wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL + 1 + + + orientationSizer + wxHORIZONTAL + none + + 8 + wxALL + 1 + + + "Align left" "Align center" "Align right" + + 1 + + + 0 + wxID_ANY + Horiz. Justify + 1 + + + m_FieldPositionCtrl + protected + + 1 + + wxRA_SPECIFY_COLS + + Select if the component is to be rotated when drawn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + wxEXPAND|wxLEFT|wxRIGHT|wxTOP|wxALIGN_CENTER_VERTICAL + 1 + + + mirrorSizer + wxHORIZONTAL + none + + 8 + wxALL + 1 + + + "Align bottom" "Align center" "Align top" + + 1 + + + 0 + wxID_ANY + Vert Justify + 1 + + + m_FieldVJustifyCtrl + protected + + 1 + + wxRA_SPECIFY_COLS + + Pick the graphical transformation to be used when displaying the component, if any + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + wxID_ANY + Visibility + + visibilitySizer + wxHORIZONTAL + none + + + 5 + wxALIGN_CENTER_VERTICAL + 1 + + + bShowRotateSizer + wxVERTICAL + none + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Show + + + showCheckBox + protected + + + + + Check if you want this field visible + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + 0 + + 1 + + + 0 + wxID_ANY + Rotate + + + rotateCheckBox + protected + + + + + Check if you want this field's text rotated 90 degrees + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 1 + + + "Normal" "Italic" "Bold" "Bold Italic" + + 1 + + + 0 + wxID_ANY + Style: + 1 + + + m_StyleRadioBox + protected + + 0 + + wxRA_SPECIFY_COLS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + fieldNameBoxSizer + wxVERTICAL + none + + 5 + + 0 + + + + 1 + + + 0 + wxID_ANY + Field Name + + + fieldNameLabel + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + fieldNameTextCtrl + protected + + + + + The text (or value) of the currently selected field + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + fieldTextBoxSizer + wxVERTICAL + none + + 5 + + 0 + + + + 1 + + + 0 + wxID_ANY + Field Value + + + fieldValueLabel + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + fieldValueTextCtrl + protected + + + + + The text (or value) of the currently selected field + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + textSizeBoxSizer + wxVERTICAL + none + + 5 + + 0 + + + + 1 + + + 0 + wxID_ANY + Size(") + + + textSizeLabel + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + textSizeTextCtrl + protected + + + + + The vertical height of the currently selected field's text in the schematic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + positionBoxSizer + wxHORIZONTAL + none + + 5 + wxALL|wxEXPAND + 1 + + + posXBoxSizer + wxVERTICAL + none + + 5 + + 0 + + + + 1 + + + 0 + wxID_ANY + PosX(") + + + posXLabel + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + posXTextCtrl + protected + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + + posYBoxSizer + wxVERTICAL + none + + 5 + + 0 + + + + 1 + + + 0 + wxID_ANY + PosY(") + + + posYLabel + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + posYTextCtrl + protected + + + + + The Y coordinate of the text relative to the component + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + stdDialogButtonSizer + protected + + OnCancelButtonClick + + + + OnOKButtonClick + + + + + + + + diff --git a/eeschema/dialog_edit_libentry_fields_in_lib_base.h b/eeschema/dialog_edit_libentry_fields_in_lib_base.h new file mode 100644 index 0000000000..48b41a756e --- /dev/null +++ b/eeschema/dialog_edit_libentry_fields_in_lib_base.h @@ -0,0 +1,79 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_edit_libentry_fields_in_lib_base__ +#define __dialog_edit_libentry_fields_in_lib_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog +{ + private: + + protected: + wxListCtrl* fieldListCtrl; + wxButton* addFieldButton; + wxButton* deleteFieldButton; + wxButton* moveUpButton; + wxRadioBox* m_FieldPositionCtrl; + wxRadioBox* m_FieldVJustifyCtrl; + wxCheckBox* showCheckBox; + wxCheckBox* rotateCheckBox; + wxRadioBox* m_StyleRadioBox; + wxStaticText* fieldNameLabel; + wxTextCtrl* fieldNameTextCtrl; + wxStaticText* fieldValueLabel; + wxTextCtrl* fieldValueTextCtrl; + wxStaticText* textSizeLabel; + wxTextCtrl* textSizeTextCtrl; + wxStaticText* posXLabel; + wxTextCtrl* posXTextCtrl; + wxStaticText* posYLabel; + wxTextCtrl* posYTextCtrl; + wxStdDialogButtonSizer* stdDialogButtonSizer; + wxButton* stdDialogButtonSizerOK; + wxButton* stdDialogButtonSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnInitDialog( wxInitDialogEvent& event ){ event.Skip(); } + virtual void OnListItemDeselected( wxListEvent& event ){ event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ){ event.Skip(); } + virtual void addFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); } + virtual void deleteFieldButtonHandler( wxCommandEvent& event ){ event.Skip(); } + virtual void moveUpButtonHandler( wxCommandEvent& event ){ event.Skip(); } + virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOKButtonClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 773,550 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE(); + +}; + +#endif //__dialog_edit_libentry_fields_in_lib_base__ diff --git a/eeschema/libframe.cpp b/eeschema/libframe.cpp index 5f83a6b725..004f91cf07 100644 --- a/eeschema/libframe.cpp +++ b/eeschema/libframe.cpp @@ -63,8 +63,8 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style ) { m_FrameName = wxT( "LibeditFrame" ); - m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines - m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee + m_Draw_Axis = true; // true pour avoir les axes dessines + m_Draw_Grid = true; // true pour avoir la axes dessinee // Give an icon SetIcon( wxIcon( libedit_xpm ) ); @@ -73,12 +73,12 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, GetSettings(); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); if( DrawPanel ) - DrawPanel->m_Block_Enable = TRUE; + DrawPanel->m_Block_Enable = true; ReCreateHToolbar(); ReCreateVToolbar(); DisplayLibInfos(); BestZoom(); - Show( TRUE ); + Show( true ); } @@ -141,82 +141,84 @@ void WinEDA_LibeditFrame::SetToolbars() if( CurrentLib == NULL ) { if( m_HToolBar ) - m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, FALSE ); + m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, false ); } else { if( m_HToolBar ) - m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, TRUE ); + m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, true ); } if( CurrentLibEntry == NULL ) { if( m_HToolBar ) { - m_HToolBar->EnableTool( ID_LIBEDIT_IMPORT_PART, TRUE ); - m_HToolBar->EnableTool( ID_LIBEDIT_EXPORT_PART, FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, FALSE ); - m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, FALSE ); - m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, FALSE ); - m_SelpartBox->Enable( FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_UNDO, FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_REDO, FALSE ); + m_HToolBar->EnableTool( ID_LIBEDIT_IMPORT_PART, true ); + m_HToolBar->EnableTool( ID_LIBEDIT_EXPORT_PART, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, false ); + m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, false ); + m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, false ); + m_SelpartBox->Enable( false ); + m_HToolBar->EnableTool( ID_LIBEDIT_UNDO, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_REDO, false ); } - g_EditPinByPinIsOn = FALSE; + g_EditPinByPinIsOn = false; m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn ); if( m_VToolBar ) { - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, FALSE ); - m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, FALSE ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, false ); + m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, false ); } } - else + else // if we have a current entry to edit: { if( m_HToolBar ) { - m_HToolBar->EnableTool( ID_LIBEDIT_IMPORT_PART, TRUE ); - m_HToolBar->EnableTool( ID_LIBEDIT_EXPORT_PART, TRUE ); - m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, TRUE ); - m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, TRUE ); + m_HToolBar->EnableTool( ID_LIBEDIT_IMPORT_PART, true ); + m_HToolBar->EnableTool( ID_LIBEDIT_EXPORT_PART, true ); + m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, true ); + m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, true ); + m_HToolBar->EnableTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, true ); if( (CurrentLibEntry->m_UnitCount > 1) || g_AsDeMorgan ) - m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, TRUE ); + m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, true ); else - m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, FALSE ); + m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, false ); m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn ); m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, g_AsDeMorgan ); m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, g_AsDeMorgan ); /* Enable the "get doc" tool */ - bool enable_dtool = FALSE; + bool enable_dtool = false; if( !CurrentAliasName.IsEmpty() ) { int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName ); if( AliasLocation >= 0 ) if( !CurrentLibEntry->m_AliasList[AliasLocation + ALIAS_DOC_FILENAME].IsEmpty() ) - enable_dtool = TRUE; + enable_dtool = true; } else if( !CurrentLibEntry->m_DocFile.IsEmpty() ) - enable_dtool = TRUE; + enable_dtool = true; if( enable_dtool ) - m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, TRUE ); + m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, true ); else - m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE ); - m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, TRUE ); - m_SelpartBox->Enable( (CurrentLibEntry->m_UnitCount > 1 ) ? TRUE : FALSE ); + m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, false ); + m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, true ); + m_SelpartBox->Enable( (CurrentLibEntry->m_UnitCount > 1 ) ? true : false ); if( GetScreen() ) { @@ -227,15 +229,15 @@ void WinEDA_LibeditFrame::SetToolbars() if( m_VToolBar ) { - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, TRUE ); - m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, TRUE ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, true ); + m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, true ); } } @@ -294,7 +296,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) wxClientDC dc( DrawPanel ); - DrawPanel->m_IgnoreMouseEvents = TRUE; + DrawPanel->m_IgnoreMouseEvents = true; DrawPanel->PrepareGraphicContext( &dc ); @@ -347,7 +349,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_LIBEDIT_NEW_PART: { - g_EditPinByPinIsOn = FALSE; + g_EditPinByPinIsOn = false; LibItemToRepeat = NULL; CreateNewLibraryPart(); GetScreen()->ClearUndoRedoList(); @@ -364,7 +366,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) LibItemToRepeat = NULL; if( LoadOneLibraryPart() ) { - g_EditPinByPinIsOn = FALSE; + g_EditPinByPinIsOn = false; GetScreen()->ClearUndoRedoList(); SetToolbars(); } @@ -379,6 +381,10 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) InstallLibeditFrame( pos ); break; + case ID_LIBEDIT_GET_FRAME_EDIT_FIELDS: + InstallFieldsEditorDialog( ); + break; + case ID_LIBEDIT_DELETE_PART: LibItemToRepeat = NULL; DeleteOnePart(); @@ -392,30 +398,30 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_LIBEDIT_EXPORT_PART: - ExportOnePart( FALSE ); + ExportOnePart( false ); break; case ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART: - ExportOnePart( TRUE ); + ExportOnePart( true ); break; case ID_LIBEDIT_CHECK_PART: if( CurrentLibEntry ) - if( TestPins( CurrentLibEntry ) == FALSE ) + if( TestPins( CurrentLibEntry ) == false ) DisplayInfo( this, _( " Pins Test OK!" ) ); break; case ID_DE_MORGAN_NORMAL_BUTT: - m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, TRUE ); - m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, FALSE ); + m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, true ); + m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, false ); LibItemToRepeat = NULL; CurrentConvert = 1; DrawPanel->Refresh(); break; case ID_DE_MORGAN_CONVERT_BUTT: - m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, FALSE ); - m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, TRUE ); + m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, false ); + m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, true ); LibItemToRepeat = NULL; CurrentConvert = 2; DrawPanel->Refresh(); @@ -440,7 +446,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_LIBEDIT_EDIT_PIN_BY_PIN: - g_EditPinByPinIsOn = g_EditPinByPinIsOn ? FALSE : TRUE; + g_EditPinByPinIsOn = g_EditPinByPinIsOn ? false : true; m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn ); break; @@ -602,7 +608,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); else - DeleteOneLibraryDrawStruct( DrawPanel, &dc, CurrentLibEntry, CurrentDrawItem, TRUE ); + DeleteOneLibraryDrawStruct( DrawPanel, &dc, CurrentLibEntry, CurrentDrawItem, true ); } CurrentDrawItem = NULL; @@ -670,53 +676,53 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_ZOOM_BLOCK: - DrawPanel->m_AutoPAN_Request = FALSE; + DrawPanel->m_AutoPAN_Request = false; GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM; HandleBlockEnd( &dc ); break; case ID_POPUP_DELETE_BLOCK: - DrawPanel->m_AutoPAN_Request = FALSE; + DrawPanel->m_AutoPAN_Request = false; GetScreen()->BlockLocate.m_Command = BLOCK_DELETE; DrawPanel->MouseToCursorSchema(); HandleBlockEnd( &dc ); break; case ID_POPUP_COPY_BLOCK: - DrawPanel->m_AutoPAN_Request = FALSE; + DrawPanel->m_AutoPAN_Request = false; GetScreen()->BlockLocate.m_Command = BLOCK_COPY; DrawPanel->MouseToCursorSchema(); HandleBlockPlace( &dc ); break; case ID_POPUP_SELECT_ITEMS_BLOCK: - DrawPanel->m_AutoPAN_Request = FALSE; + DrawPanel->m_AutoPAN_Request = false; GetScreen()->BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY; DrawPanel->MouseToCursorSchema(); HandleBlockEnd( &dc ); break; case ID_POPUP_INVERT_BLOCK: - DrawPanel->m_AutoPAN_Request = FALSE; + DrawPanel->m_AutoPAN_Request = false; GetScreen()->BlockLocate.m_Command = BLOCK_INVERT; DrawPanel->MouseToCursorSchema(); HandleBlockPlace( &dc ); break; case ID_POPUP_PLACE_BLOCK: - DrawPanel->m_AutoPAN_Request = FALSE; + DrawPanel->m_AutoPAN_Request = false; DrawPanel->MouseToCursorSchema(); HandleBlockPlace( &dc ); break; case ID_LIBEDIT_UNDO: if( GetComponentFromUndoList() ) - DrawPanel->Refresh( TRUE ); + DrawPanel->Refresh( true ); break; case ID_LIBEDIT_REDO: if( GetComponentFromRedoList() ) - DrawPanel->Refresh( TRUE ); + DrawPanel->Refresh( true ); break; default: @@ -724,7 +730,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) break; } - DrawPanel->m_IgnoreMouseEvents = FALSE; + DrawPanel->m_IgnoreMouseEvents = false; if( m_ID_current_state == 0 ) LibItemToRepeat = NULL; diff --git a/eeschema/makefile.include b/eeschema/makefile.include index 24d2246bad..39a466d26c 100644 --- a/eeschema/makefile.include +++ b/eeschema/makefile.include @@ -29,6 +29,8 @@ OBJECTS = eeschema.o\ component_class.o\ class_library.o\ dialog_options.o\ + dialog_edit_libentry_fields_in_lib.o\ + dialog_edit_libentry_fields_in_lib_base.o\ tool_lib.o\ tool_sch.o\ tool_viewlib.o\ diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index f6f20dd3fa..aed5514543 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -156,6 +156,12 @@ void WinEDA_LibeditFrame::ReCreateHToolbar() -1, -1, (wxObject*) NULL, _( "Edit component properties" ) ); + m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, BITMAP( add_text_xpm ), + wxNullBitmap, + FALSE, + -1, -1, (wxObject*) NULL, + _( "Add, remove, edit fields properties" ) ); + m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, BITMAP( erc_xpm ), wxNullBitmap, diff --git a/include/build_version.h b/include/build_version.h index c70d872b0e..e9bd0d040d 100644 --- a/include/build_version.h +++ b/include/build_version.h @@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion # include "config.h" (wxT(KICAD_SVN_VERSION)) # else - (wxT("(20081221-unstable)")) /* main program version */ + (wxT("(20081229-unstable)")) /* main program version */ # endif #endif ; @@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion # include "config.h" (wxT(KICAD_ABOUT_VERSION)) # else - (wxT("(20081221-unstable)")) /* svn date & rev (normally overridden) */ + (wxT("(20081229-unstable)")) /* svn date & rev (normally overridden) */ # endif #endif ; diff --git a/include/id.h b/include/id.h index b7c6f4b641..1c31ce0186 100644 --- a/include/id.h +++ b/include/id.h @@ -429,6 +429,7 @@ enum main_id { ID_LIBEDIT_SAVE_CURRENT_PART, ID_LIBEDIT_NEW_PART, ID_LIBEDIT_GET_FRAME_EDIT_PART, + ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, ID_LIBEDIT_DELETE_PART, ID_LIBEDIT_IMPORT_PART, ID_LIBEDIT_EXPORT_PART, @@ -439,14 +440,14 @@ enum main_id { ID_DE_MORGAN_CONVERT_BUTT, ID_LIBEDIT_EDIT_PIN_BY_PIN, ID_LIBEDIT_VIEW_DOC, - ID_LIBEDIT_CHECK_PART, + ID_LIBEDIT_CHECK_PART, ID_LIBEDIT_END_H_TOOL, // End Id for HToolBar (Libedit) ID_LIBEDIT_SELECT_PART_NUMBER, // Id selection unit of part (HToolBar, combo box) ID_LIBEDIT_SELECT_ALIAS, // Id selection alias of part (HToolBar, combo box) ID_LIBEDIT_HTOOL_UNUSED1, ID_LIBEDIT_HTOOL_UNUSED2, - ID_LIBEDIT_HTOOL_UNUSED3, - ID_LIBEDIT_HTOOL_UNUSED4, + ID_LIBEDIT_HTOOL_UNUSED3, + ID_LIBEDIT_HTOOL_UNUSED4, /* Id pour VToolBar de Libedit */ ID_LIBEDIT_START_V_TOOL, diff --git a/include/macros.h b/include/macros.h index 8fa9a745f8..e7bf7948e4 100644 --- a/include/macros.h +++ b/include/macros.h @@ -25,6 +25,7 @@ #define ABS( y ) ( (y) >= 0 ? (y) : ( -(y) ) ) #endif +#define NEGATE(x) (x = -x) /// # of elements in an arrray #define DIM(x) (sizeof(x)/sizeof((x)[0])) diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 3f0a205350..93e337dd1c 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -408,6 +408,7 @@ private: // General editing public: void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); + void InstallFieldsEditorDialog( void ); private: bool GetComponentFromUndoList(); diff --git a/internat/fr/kicad.mo b/internat/fr/kicad.mo index b69928361a..1cc95f7114 100644 Binary files a/internat/fr/kicad.mo and b/internat/fr/kicad.mo differ diff --git a/internat/fr/kicad.po b/internat/fr/kicad.po index b1134ee449..99f3df0df3 100644 --- a/internat/fr/kicad.po +++ b/internat/fr/kicad.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: kicad\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-12-23 14:07+0100\n" -"PO-Revision-Date: 2008-12-23 14:11+0100\n" +"POT-Creation-Date: 2008-12-29 09:07+0100\n" +"PO-Revision-Date: 2008-12-29 16:04+0100\n" "Last-Translator: \n" "Language-Team: kicad team \n" "MIME-Version: 1.0\n" @@ -4989,6 +4989,8 @@ msgid "" "Activates the display of relative coordinates from relative origin (set by the space key)\n" "to the cursor, in polar coordinates (angle and distance)" msgstr "" +"Active l'affichage des coordonnées relatives à l'origine relative(positionnée par la touche espace)\n" +"au curseur, en coordonnées polaires (angle et distance)" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:32 msgid "Units" @@ -5000,7 +5002,7 @@ msgstr "Sélection des unités pour afficher les dimensions et positions des ite #: pcbnew/dialog_general_options_BoardEditor_base.cpp:38 msgid "Smass cross" -msgstr "Petite crois" +msgstr "Petite croix" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:38 msgid "Full screen cursor" @@ -5012,7 +5014,7 @@ msgstr "Curseur" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:42 msgid "Main cursor shape selection (small cross or large cursor)" -msgstr "" +msgstr "Sélection de l'aspect du curseur principal (petite croix ou grand curseur)" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:51 msgid "1" @@ -5060,7 +5062,7 @@ msgstr "Liens max:" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:64 msgid "Adjust the number of ratsnets shown from cursor to closest pads" -msgstr "" +msgstr "Adjust the number of ratsnets shown from cursor to closest pads" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:68 msgid "Auto Save (minuts):" @@ -5068,7 +5070,7 @@ msgstr "Sauveg. Auto (min)" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:73 msgid "Delay after the first change to create a backup file of the board on disk." -msgstr "" +msgstr "Délai après le premier changement pour créer un fichier de sauvegarde du circuit imprimé sur disque" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:82 msgid "Drc ON" @@ -5079,6 +5081,8 @@ msgid "" "Enable/disable the DRC control.\n" "When DRC is disable, all connections are allowed." msgstr "" +"Active/désactive le contrôle DRC (Design Rule Check).\n" +"Lorsque de DRC est désactivé, toutes les connexions sont autorisées." #: pcbnew/dialog_general_options_BoardEditor_base.cpp:89 msgid "Show Ratsnest" @@ -5097,6 +5101,8 @@ msgid "" "Shows (or not) the local ratsnest relative to a footprint, when moving it.\n" "This ratsnest is useful to place a footprint." msgstr "" +"Montre (ou non) le chevelu local relatif a un module, lorsque on le déplace.\n" +"Ce chevelu est utile pour placer un module." #: pcbnew/dialog_general_options_BoardEditor_base.cpp:101 msgid "Tracks Auto Del" @@ -5104,7 +5110,7 @@ msgstr "Auto Supp. Pistes" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:103 msgid "Enable/disable the automatic track deletion when recreating a track." -msgstr "" +msgstr "Active/désactive l'effacement de piste automatique lorsque l'on recrée une piste." #: pcbnew/dialog_general_options_BoardEditor_base.cpp:107 msgid "Track only 45 degrees" @@ -5128,7 +5134,7 @@ msgstr "Auto PAN" #: pcbnew/dialog_general_options_BoardEditor_base.cpp:121 msgid "Allows auto pan when creating a track, or moving an item." -msgstr "" +msgstr "Autorise l'autopan en création de piste, ou lorsque on déplace un élément." #: pcbnew/dialog_general_options_BoardEditor_base.cpp:125 msgid "Double Segm Track" @@ -5406,12 +5412,12 @@ msgid "PinType" msgstr "Type Pin" #: eeschema/affiche.cpp:89 -#: eeschema/affiche.cpp:177 +#: eeschema/affiche.cpp:184 msgid "no" msgstr "non" #: eeschema/affiche.cpp:91 -#: eeschema/affiche.cpp:179 +#: eeschema/affiche.cpp:186 msgid "yes" msgstr "oui" @@ -5439,20 +5445,20 @@ msgstr "Gauche" msgid "Right" msgstr "Droite" -#: eeschema/affiche.cpp:169 -#: eeschema/affiche.cpp:175 +#: eeschema/affiche.cpp:176 +#: eeschema/affiche.cpp:182 msgid "All" msgstr "Tout" -#: eeschema/affiche.cpp:172 +#: eeschema/affiche.cpp:179 msgid "Unit" msgstr "Unité" -#: eeschema/affiche.cpp:182 +#: eeschema/affiche.cpp:189 msgid "Convert" msgstr "Convert" -#: eeschema/affiche.cpp:187 +#: eeschema/affiche.cpp:194 msgid "default" msgstr "Défaut" @@ -6464,26 +6470,6 @@ msgstr "Pin de Feuille de Hiérarchie" msgid "No New Hierarchal Label found" msgstr "Pas de nouveau Label Hiérarchique trouvé" -#: eeschema/symbtext.cpp:133 -msgid " Text : " -msgstr " Texte : " - -#: eeschema/symbtext.cpp:143 -msgid "Component name:" -msgstr "Nom du Composant:" - -#: eeschema/symbtext.cpp:152 -msgid "Size:" -msgstr "Taille:" - -#: eeschema/symbtext.cpp:158 -msgid " Text Options : " -msgstr "Options du Texte: " - -#: eeschema/symbtext.cpp:170 -msgid "Vertical" -msgstr "Vertical" - #: eeschema/hotkeys.cpp:249 msgid "Add Component" msgstr "Ajout Composant" @@ -7017,7 +7003,7 @@ msgstr "Créer une nouvelle librairie et y sauver le composant" #: eeschema/tool_lib.cpp:157 msgid "Edit component properties" -msgstr "Editer ropriétés du composant" +msgstr "Editer propriétés du composant" #: eeschema/tool_lib.cpp:164 msgid "Test duplicate pins" @@ -7766,6 +7752,10 @@ msgstr "Champs" msgid "Show Text" msgstr "Texte visible" +#: eeschema/edit_component_in_lib.cpp:504 +msgid "Vertical" +msgstr "Vertical" + #: eeschema/edit_component_in_lib.cpp:510 msgid "Field Name:" msgstr "Nom Champ" @@ -8039,58 +8029,62 @@ msgstr "Déplacer le champ optionnel sélectionné de une position vers le haut" msgid "Visibility" msgstr "Visibilité" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:117 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:120 msgid "Show" msgstr "Visible" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:119 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:122 msgid "Check if you want this field visible" msgstr "Activer si vous voulez avoir ce champ visible" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:125 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:128 msgid "Check if you want this field's text rotated 90 degrees" -msgstr "Activer si vous voulez avoir le texte de ce champ turné à 90°" +msgstr "Activer si vous voulez avoir le texte de ce champ tourné à 90°" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:134 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:136 +msgid "Style:" +msgstr "Style:" + +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:145 msgid "Field Name" msgstr "Nom Champ" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:139 -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:153 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:150 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:164 msgid "The text (or value) of the currently selected field" msgstr "The texte (ou la valeur) du champ actuellement sélectionné" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:148 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:159 msgid "Field Value" msgstr "Texte Champ" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:162 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:173 msgid "Size(\")" msgstr "Taille(\")" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:167 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:178 msgid "The vertical height of the currently selected field's text in the schematic" msgstr "La taille du texte du champ actuellement sélectionné" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:179 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:190 msgid "PosX(\")" msgstr "PosX" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:191 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:202 msgid "PosY(\")" msgstr "PosY" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:196 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:207 msgid "The Y coordinate of the text relative to the component" msgstr "La position Y du texte relativement au composant" -#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:207 +#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:218 msgid "Reset to Library Defaults" msgstr "Remettre aux Valeurs par Défaut en Librairie" #: eeschema/dialog_edit_component_in_lib.cpp:139 msgid "General :" -msgstr " Général :" +msgstr "Général :" #: eeschema/dialog_edit_component_in_lib.cpp:147 msgid "Number of units:" @@ -8375,6 +8369,18 @@ msgstr " a été créé par une version plus ancienne de Eeschema. Il sera enreg msgid "Done Loading " msgstr "Chargement terminé" +#: eeschema/dialog_bodygraphictext_properties_base.cpp:32 +msgid " Text Options : " +msgstr "Options du Texte: " + +#: eeschema/dialog_bodygraphictext_properties_base.cpp:53 +msgid "Size:" +msgstr "Taille:" + +#: eeschema/dialog_bodygraphictext_properties_base.cpp:62 +msgid "Text Shape:" +msgstr "Aspect Texte:" + #: eeschema/eelibs_read_libraryfiles.cpp:117 msgid "Start loading schematic libs" msgstr "Demarre chargement des librairies schématiques" @@ -9034,6 +9040,7 @@ msgid "Create New Directory" msgstr "Créer un nouveau Répertoire" #: kicad/treeprj_frame.cpp:543 +#: kicad/kicad.cpp:381 msgid "noname" msgstr "noname" @@ -10721,11 +10728,7 @@ msgstr "EESchema Tracé HPGL" msgid "Sheet properties" msgstr "Propriétés de la feuille" -#: eeschema/symbtext.h:47 -msgid "Graphic text properties" -msgstr "Propriétés du texte" - -#: eeschema/dialog_edit_component_in_schematic_fbp.h:81 +#: eeschema/dialog_edit_component_in_schematic_fbp.h:82 msgid "Component Properties" msgstr "Propriétés du Composant" @@ -10737,6 +10740,10 @@ msgstr "Propriétés des Pins" msgid "EESchema Plot PS" msgstr "EESchema Tracé PS" +#: eeschema/dialog_bodygraphictext_properties_base.h:55 +msgid "Graphic text properties:" +msgstr "Propriétés du texte graphique:" + #: eeschema/component_wizard/dialog_component_setup.h:55 msgid "Component Builder" msgstr "Générateur de Composant" @@ -10905,6 +10912,10 @@ msgstr "Imprimer" msgid "Create SVG file" msgstr "Créer Fichier SVG" +#~ msgid " Text : " +#~ msgstr " Texte : " +#~ msgid "Component name:" +#~ msgstr "Nom du Composant:" #~ msgid "show" #~ msgstr "Visible" #~ msgid "no show"