diff --git a/change_log.txt b/change_log.txt index 0150744342..6c7af8aab4 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,6 +4,11 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2007-June-14 UPDATE Igor Plyatov +================================================================================ ++ eeschema + Added sorting by value or position in to the annotation window (Thanks for patch to Andrey Fedorushkov). + 2007-June-13 RELEASE Jean-Pierre Charras ================================================================================ +All: diff --git a/eeschema/annotate.cpp b/eeschema/annotate.cpp index e6ae27d509..e1116bbee6 100644 --- a/eeschema/annotate.cpp +++ b/eeschema/annotate.cpp @@ -22,6 +22,7 @@ static int ExistUnit(CmpListStruct *Objet, int Unit, /* Variable locales */ static bool AnnotProject = TRUE; +static bool SortByPosition = TRUE; /**************************************/ @@ -88,6 +89,7 @@ CmpListStruct * BaseListeCmp; wxBusyCursor dummy; AnnotProject = (m_AnnotProjetCtrl->GetSelection() == 0) ? TRUE : FALSE; + SortByPosition = (m_AnnotSortCmpCtrl->GetSelection() == 0) ? TRUE : FALSE; /* If it is an annotation for all the components, reset previous annotation: */ if( m_AnnotNewCmpCtrl->GetSelection() == 0 ) DeleteAnnotation(event); @@ -245,6 +247,7 @@ EDA_LibComponentStruct *Entry; BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked; BaseListeCmp[NbrCmp].m_Sheet = NumSheet; BaseListeCmp[NbrCmp].m_IsNew = FALSE; + BaseListeCmp[NbrCmp].m_Pos = DrawLibItem->m_Pos; BaseListeCmp[NbrCmp].m_TimeStamp = DrawLibItem->m_TimeStamp; if( DrawLibItem->m_Field[REFERENCE].m_Text.IsEmpty() ) DrawLibItem->m_Field[REFERENCE].m_Text = wxT("DefRef?"); @@ -294,12 +297,19 @@ int AnnotTriComposant(CmpListStruct *Objet1, CmpListStruct *Objet2) int ii; ii = strnicmp( Objet1->m_TextRef, Objet2->m_TextRef, 32 ); + if ( SortByPosition == TRUE ) { + if ( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet; + if ( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit; + if ( ii == 0 ) ii = Objet1->m_Pos.x - Objet2->m_Pos.x; + if ( ii == 0 ) ii = Objet1->m_Pos.y - Objet2->m_Pos.y; + } else { + if ( ii == 0 ) ii = strnicmp( Objet1->m_TextValue, Objet2->m_TextValue, 32 ); + if ( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit; + if ( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet; + } - if ( ii == 0 ) ii = strnicmp( Objet1->m_TextValue, Objet2->m_TextValue, 32 ); - if ( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit; - if ( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet; if ( ii == 0 ) ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp; - + return(ii); } diff --git a/eeschema/annotate_dialog.cpp b/eeschema/annotate_dialog.cpp index 397c049918..2247b72892 100644 --- a/eeschema/annotate_dialog.cpp +++ b/eeschema/annotate_dialog.cpp @@ -129,6 +129,13 @@ void WinEDA_AnnotateFrame::CreateControls() m_AnnotNewCmpCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("select items:"), wxDefaultPosition, wxDefaultSize, 2, m_AnnotNewCmpCtrlStrings, 1, wxRA_SPECIFY_COLS ); itemBoxSizer3->Add(m_AnnotNewCmpCtrl, 0, wxALIGN_LEFT|wxALL, 5); + wxString m_AnnotSortCmpCtrlStrings[] = { + _("by position"), + _("by value") + }; + m_AnnotSortCmpCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("sorting:"), wxDefaultPosition, wxDefaultSize, 2, m_AnnotSortCmpCtrlStrings, 1, wxRA_SPECIFY_COLS ); + itemBoxSizer3->Add(m_AnnotSortCmpCtrl, 0, wxALIGN_LEFT|wxALL, 5); + wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); diff --git a/eeschema/annotate_dialog.h b/eeschema/annotate_dialog.h index a192293035..8b74719866 100644 --- a/eeschema/annotate_dialog.h +++ b/eeschema/annotate_dialog.h @@ -47,12 +47,13 @@ #define SYMBOL_WINEDA_ANNOTATEFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX #define SYMBOL_WINEDA_ANNOTATEFRAME_TITLE _("EESchema Annotation") #define SYMBOL_WINEDA_ANNOTATEFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_ANNOTATEFRAME_SIZE wxSize(400, 300) +#define SYMBOL_WINEDA_ANNOTATEFRAME_SIZE wxSize(400, 500) #define SYMBOL_WINEDA_ANNOTATEFRAME_POSITION wxDefaultPosition #define ID_RADIOBOX 10001 #define ID_RADIOBOX1 10002 -#define ID_ANNOTATE_CMP 10003 -#define ID_DEANNOTATE_CMP 10004 +#define ID_RADIOBOX2 10003 +#define ID_ANNOTATE_CMP 10004 +#define ID_DEANNOTATE_CMP 10005 ////@end control identifiers /*! @@ -111,6 +112,7 @@ public: ////@begin WinEDA_AnnotateFrame member variables wxRadioBox* m_AnnotProjetCtrl; wxRadioBox* m_AnnotNewCmpCtrl; + wxRadioBox* m_AnnotSortCmpCtrl; ////@end WinEDA_AnnotateFrame member variables WinEDA_SchematicFrame * m_Parent; diff --git a/eeschema/netlist.h b/eeschema/netlist.h index 45e129fc49..f553902b07 100644 --- a/eeschema/netlist.h +++ b/eeschema/netlist.h @@ -96,6 +96,7 @@ public: char m_TextRef[32]; /* Reference ( hors numero ) */ int m_NumRef; /* Numero de reference */ int m_Flag; /* flag pour calculs internes */ + wxPoint m_Pos; /* position components */ };