Commit af7b6691 authored by charras's avatar charras

see changelog

parent 9b082be0
...@@ -5,6 +5,16 @@ Started 2007-June-11 ...@@ -5,6 +5,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Apr-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
* Added WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint Mouse );
* Added WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint Mouse );
Needed: Move redundant code to WinEDA_DrawFrame::GeneralControle
** Current sheet only Annotation and clear annotation now works for complex hierarchies
2008-Apr-17 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Apr-17 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+all +all
......
...@@ -16,8 +16,8 @@ static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ); ...@@ -16,8 +16,8 @@ static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp );
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp );
static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ); static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp );
int GetLastReferenceNumber( CmpListStruct* Objet, int GetLastReferenceNumber( CmpListStruct* Objet,
CmpListStruct* BaseListeCmp, CmpListStruct* BaseListeCmp,
int NbOfCmp ); int NbOfCmp );
static int ExistUnit( CmpListStruct* Objet, int Unit, static int ExistUnit( CmpListStruct* Objet, int Unit,
CmpListStruct* BaseListeCmp, int NbOfCmp ); CmpListStruct* BaseListeCmp, int NbOfCmp );
...@@ -90,7 +90,7 @@ void ReAnnotatePowerSymbolsOnly( void ) ...@@ -90,7 +90,7 @@ void ReAnnotatePowerSymbolsOnly( void )
{ {
if( DrawList->Type() != TYPE_SCH_COMPONENT ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
SCH_COMPONENT* DrawLibItem = SCH_COMPONENT* DrawLibItem =
(SCH_COMPONENT*) DrawList; (SCH_COMPONENT*) DrawList;
EDA_LibComponentStruct* Entry = EDA_LibComponentStruct* Entry =
FindLibPart( FindLibPart(
...@@ -118,27 +118,23 @@ void ReAnnotatePowerSymbolsOnly( void ) ...@@ -118,27 +118,23 @@ void ReAnnotatePowerSymbolsOnly( void )
CmpListStruct* AllocateCmpListStrct( int numcomponents ) CmpListStruct* AllocateCmpListStrct( int numcomponents )
{ {
int ii = numcomponents * sizeof(CmpListStruct); int ii = numcomponents * sizeof(CmpListStruct);
CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii );
//fill this memory with zeros.
char* cptr = (char*) list;
for( int i = 0; i<ii; i++ ) //allocate memory and fill this memory with zeros.
*cptr++ = 0; CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii );
return list; return list;
} }
/* qsort function to annotate items by their position. /* qsort function to annotate items by their position.
* Components are sorted * Components are sorted
* by reference * by reference
* if same reference: by sheet * if same reference: by sheet
* if same sheet, by X pos * if same sheet, by X pos
* if same X pos, by Y pos * if same X pos, by Y pos
* if same Y pos, by time stamp * if same Y pos, by time stamp
*/ */
int AnnotateByPosition( const void* o1, const void* o2 ) int AnnotateByPosition( const void* o1, const void* o2 )
{ {
CmpListStruct* item1 = (CmpListStruct*) o1; CmpListStruct* item1 = (CmpListStruct*) o1;
...@@ -192,24 +188,53 @@ int AnnotateByValue( const void* o1, const void* o2 ) ...@@ -192,24 +188,53 @@ int AnnotateByValue( const void* o1, const void* o2 )
} }
/***************************************************************************** /**************************************************************************************/
* DeleteAnnotation: void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw )
* /**************************************************************************************/
* Clear the current annotation.
****************************************************************************/ /** Function DeleteAnnotation
void DeleteAnnotation( WinEDA_SchematicFrame* parent, bool annotateSchematic ) * Remove current component annotations
* @param aCurrentSheetOnly : if false: remove all annotations, else remove annotation relative to the current sheet only
* @param aRedraw : true to refresh display
*/
{ {
DrawSheetStruct* sheet; EDA_BaseStruct* strct;
SCH_SCREEN* screen;
EDA_ScreenList ScreenList;
if( annotateSchematic ) screen = ScreenList.GetFirst();
sheet = g_RootSheet;
else
sheet = parent->GetSheet()->Last();
sheet->DeleteAnnotation( annotateSchematic ); if( aCurrentSheetOnly )
screen = GetScreen();
g_RootSheet->m_AssociatedScreen->SetModify(); if( screen == NULL )
parent->DrawPanel->Refresh( true ); return;
while( screen )
{
strct = screen->EEDrawList;
for( ; strct; strct = strct->Pnext )
{
if( strct->Type() == TYPE_SCH_COMPONENT )
{
if( aCurrentSheetOnly )
( (SCH_COMPONENT*) strct )->ClearAnnotation( m_CurrentSheet );
else
( (SCH_COMPONENT*) strct )->ClearAnnotation( NULL );
}
}
screen->SetModify();
if( aCurrentSheetOnly )
break;
screen = ScreenList.GetNext();
}
//update the References
m_CurrentSheet->UpdateAllScreenReferences();
if( aRedraw )
DrawPanel->Refresh( true );
} }
...@@ -236,9 +261,9 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, ...@@ -236,9 +261,9 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
wxBusyCursor dummy; wxBusyCursor dummy;
/* If it is an annotation for all the components, reset previous /* If it is an annotation for all the components, reset previous
* annotation: */ * annotation: */
if( resetAnnotation ) if( resetAnnotation )
DeleteAnnotation( parent, annotateSchematic ); parent->DeleteAnnotation( !annotateSchematic, false );
/* Build the sheet list */ /* Build the sheet list */
EDA_SheetList SheetList( g_RootSheet ); EDA_SheetList SheetList( g_RootSheet );
...@@ -281,7 +306,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, ...@@ -281,7 +306,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) ); DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) );
/* Break full components reference in name (prefix) and number: /* Break full components reference in name (prefix) and number:
* example: IC1 become IC, and 1 */ * example: IC1 become IC, and 1 */
BreakReference( BaseListeCmp, NbOfCmp ); BreakReference( BaseListeCmp, NbOfCmp );
if( sortByPosition ) if( sortByPosition )
...@@ -289,7 +314,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent, ...@@ -289,7 +314,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
( int( * ) ( const void*, const void* ) )AnnotateByPosition ); ( int( * ) ( const void*, const void* ) )AnnotateByPosition );
else else
qsort( BaseListeCmp, NbOfCmp, sizeof(CmpListStruct), qsort( BaseListeCmp, NbOfCmp, sizeof(CmpListStruct),
( int( * ) ( const void*, const void* ) ) AnnotateByValue); ( int( * ) ( const void*, const void* ) )AnnotateByValue );
/* Recalculate reference numbers */ /* Recalculate reference numbers */
ComputeReferenceNumber( BaseListeCmp, NbOfCmp ); ComputeReferenceNumber( BaseListeCmp, NbOfCmp );
...@@ -312,7 +337,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) ...@@ -312,7 +337,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
{ {
int NbrCmp = 0; int NbrCmp = 0;
EDA_BaseStruct* DrawList = sheet->LastDrawList(); EDA_BaseStruct* DrawList = sheet->LastDrawList();
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
for( ; DrawList; DrawList = DrawList->Pnext ) for( ; DrawList; DrawList = DrawList->Pnext )
...@@ -334,7 +359,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) ...@@ -334,7 +359,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem; BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem;
BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount; BaseListeCmp[NbrCmp].m_NbParts = Entry->m_UnitCount;
BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->GetUnitSelection( sheet );// DrawLibItem->m_Multi; BaseListeCmp[NbrCmp].m_Unit = DrawLibItem->GetUnitSelection( sheet ); // DrawLibItem->m_Multi;
BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked; BaseListeCmp[NbrCmp].m_PartsLocked = Entry->m_UnitSelectionLocked;
BaseListeCmp[NbrCmp].m_SheetList = *sheet; BaseListeCmp[NbrCmp].m_SheetList = *sheet;
BaseListeCmp[NbrCmp].m_IsNew = FALSE; BaseListeCmp[NbrCmp].m_IsNew = FALSE;
...@@ -368,8 +393,8 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) ...@@ -368,8 +393,8 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
*****************************************************************************/ *****************************************************************************/
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp ) static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp )
{ {
int ii; int ii;
char* Text; char* Text;
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
/* Reattribution des numeros */ /* Reattribution des numeros */
...@@ -439,7 +464,6 @@ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp ) ...@@ -439,7 +464,6 @@ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp )
break; break;
} }
} }
} }
} }
...@@ -497,7 +521,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) ...@@ -497,7 +521,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp )
} }
/* Annotation of multi-part components ( n parts per package ) /* Annotation of multi-part components ( n parts per package )
* (complex case) */ * (complex case) */
ValText = BaseListeCmp[ii].m_TextValue; ValText = BaseListeCmp[ii].m_TextValue;
NumberOfUnits = BaseListeCmp[ii].m_NbParts; NumberOfUnits = BaseListeCmp[ii].m_NbParts;
...@@ -537,7 +561,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp ) ...@@ -537,7 +561,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp )
} }
/* Component without reference number found, annotate it if /* Component without reference number found, annotate it if
* possible */ * possible */
if( !BaseListeCmp[jj].m_PartsLocked if( !BaseListeCmp[jj].m_PartsLocked
|| (BaseListeCmp[jj].m_Unit == Unit) ) || (BaseListeCmp[jj].m_Unit == Unit) )
{ {
...@@ -609,15 +633,15 @@ static int ExistUnit( CmpListStruct* Objet, int Unit, ...@@ -609,15 +633,15 @@ static int ExistUnit( CmpListStruct* Objet, int Unit,
ItemToTest < EndList; ItemToTest < EndList;
ItemToTest++, ii++ ) ItemToTest++, ii++ )
{ {
if( Objet == ItemToTest ) // Do not compare with itself ! if( Objet == ItemToTest ) // Do not compare with itself !
continue; continue;
if( ItemToTest->m_IsNew ) // Not already with an updated reference if( ItemToTest->m_IsNew ) // Not already with an updated reference
continue; continue;
if( ItemToTest->m_NumRef != NumRef ) // Not the same reference number (like 35 in R35) if( ItemToTest->m_NumRef != NumRef ) // Not the same reference number (like 35 in R35)
continue; continue;
if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) // Not the same reference prefix if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) // Not the same reference prefix
continue; continue;
if( ItemToTest->m_Unit == Unit ) // A part with the same reference and the given unit is found if( ItemToTest->m_Unit == Unit ) // A part with the same reference and the given unit is found
{ {
return ii; return ii;
} }
...@@ -685,7 +709,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly ) ...@@ -685,7 +709,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue ); qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue );
/* Break full components reference in name (prefix) and number: example: /* Break full components reference in name (prefix) and number: example:
* IC1 become IC, and 1 */ * IC1 become IC, and 1 */
BreakReference( ListeCmp, NbOfCmp ); BreakReference( ListeCmp, NbOfCmp );
/* count not yet annotated items */ /* count not yet annotated items */
......
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
#include "program.h" #include "program.h"
#include "annotate_dialog.h" #include "annotate_dialog.h"
extern void DeleteAnnotation( WinEDA_SchematicFrame* parent,
bool annotateSchematic );
extern void AnnotateComponents( WinEDA_SchematicFrame* parent, extern void AnnotateComponents( WinEDA_SchematicFrame* parent,
bool annotateSchematic, bool annotateSchematic,
bool sortByPosition, bool sortByPosition,
...@@ -262,7 +260,7 @@ void WinEDA_AnnotateFrame::OnClearAnnotationCmpClick( wxCommandEvent& event ) ...@@ -262,7 +260,7 @@ void WinEDA_AnnotateFrame::OnClearAnnotationCmpClick( wxCommandEvent& event )
wxICON_EXCLAMATION | wxOK | wxCANCEL ); wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL) if (response == wxCANCEL)
return; return;
DeleteAnnotation( m_Parent, GetLevel() ); m_Parent->DeleteAnnotation( GetLevel() ? false : true, true );
m_btnClear->Enable(false); m_btnClear->Enable(false);
} }
......
...@@ -828,7 +828,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc ...@@ -828,7 +828,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
{ {
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(); ( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL);
} }
break; break;
...@@ -893,7 +893,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc ...@@ -893,7 +893,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
( (SCH_COMPONENT*) NewDrawStruct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) NewDrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation(); ( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation(NULL);
break; break;
} }
...@@ -1051,7 +1051,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1051,7 +1051,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(); ( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL);
SetStructFather( Struct, GetScreen() ); SetStructFather( Struct, GetScreen() );
} }
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Pnext;
...@@ -1075,7 +1075,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1075,7 +1075,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( DrawStruct->Type() == TYPE_SCH_COMPONENT ) if( DrawStruct->Type() == TYPE_SCH_COMPONENT )
{ {
( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp(); ( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation(); ( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation(NULL);
} }
SetStructFather( DrawStruct, GetScreen() ); SetStructFather( DrawStruct, GetScreen() );
RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
......
...@@ -359,32 +359,6 @@ EDA_Rect DrawSheetStruct::GetBoundingBox() ...@@ -359,32 +359,6 @@ EDA_Rect DrawSheetStruct::GetBoundingBox()
} }
/**************************************************************************************/
void DrawSheetStruct::DeleteAnnotation( bool recurse )
/**************************************************************************************/
{
if( recurse && m_AssociatedScreen )
{
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
for( ; strct; strct = strct->Pnext )
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) strct;
sheet->DeleteAnnotation( recurse );
}
}
}
EDA_BaseStruct* comp = m_AssociatedScreen->EEDrawList;
for( ; comp; comp = comp->Pnext )
{
if( comp->Type() == TYPE_SCH_COMPONENT )
{
( (SCH_COMPONENT*) comp )->ClearAnnotation();
}
}
}
/*******************************************************************/ /*******************************************************************/
int DrawSheetStruct::ComponentCount() int DrawSheetStruct::ComponentCount()
......
...@@ -20,13 +20,13 @@ class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM, ...@@ -20,13 +20,13 @@ class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM,
public: public:
int m_Edge, m_Shape; int m_Edge, m_Shape;
bool m_IsDangling; // TRUE non connected bool m_IsDangling; // TRUE non connected
int m_Number; // used to numbered labels when writing data on file . m_Number >= 2 int m_Number; // used to numbered labels when writing data on file . m_Number >= 2
// value 0 is for sheet name and 1 for sheet filename // value 0 is for sheet name and 1 for sheet filename
public: public:
Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent, Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
const wxPoint& pos = wxPoint( 0, 0 ), const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~Hierarchical_PIN_Sheet_Struct() { } ~Hierarchical_PIN_Sheet_Struct() { }
virtual wxString GetClass() const virtual wxString GetClass() const
...@@ -35,14 +35,14 @@ public: ...@@ -35,14 +35,14 @@ public:
} }
Hierarchical_PIN_Sheet_Struct* GenCopy(); Hierarchical_PIN_Sheet_Struct* GenCopy();
Hierarchical_PIN_Sheet_Struct* Next() Hierarchical_PIN_Sheet_Struct* Next()
{ return (Hierarchical_PIN_Sheet_Struct*) Pnext; } { return (Hierarchical_PIN_Sheet_Struct*) Pnext; }
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
/** /**
* Function Save * Function Save
...@@ -50,38 +50,38 @@ public: ...@@ -50,38 +50,38 @@ public:
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
}; };
/* class DrawSheetStruct /* class DrawSheetStruct
* This class is the sheet symbol placed in a schematic, and is the entry point for a sub schematic * This class is the sheet symbol placed in a schematic, and is the entry point for a sub schematic
*/ */
WX_DEFINE_ARRAY( DrawSheetStruct *, SheetGrowArray ); WX_DEFINE_ARRAY( DrawSheetStruct *, SheetGrowArray );
class DrawSheetStruct : public SCH_ITEM /*public SCH_SCREEN*/ /* Gestion de la hierarchie */ class DrawSheetStruct : public SCH_ITEM /*public SCH_SCREEN*/ /* Gestion de la hierarchie */
{ {
public: public:
wxString m_SheetName; //this is equivalent to C101 for components: wxString m_SheetName; /*this is equivalent to C101 for components:
// it is stored in F0 ... of the file. * it is stored in F0 ... of the file. */
private: private:
wxString m_FileName; //also in SCH_SCREEN (redundant), wxString m_FileName; /*also in SCH_SCREEN (redundant),
//but need it here for loading after * but need it here for loading after
//reading the sheet description from file. * reading the sheet description from file. */
public: public:
int m_SheetNameSize; // Size (height) of the text, used to draw the name int m_SheetNameSize; /* Size (height) of the text, used to draw the name */
int m_FileNameSize; // Size (height) of the text, used to draw the name int m_FileNameSize; /* Size (height) of the text, used to draw the name */
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */ wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer; int m_Layer;
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points de connection, linked list.*/ Hierarchical_PIN_Sheet_Struct* m_Label; /* Points de connection, linked list.*/
int m_NbLabel; /* Nombre de points de connexion */ int m_NbLabel; /* Nombre de points de connexion */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which handle the physical data SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which handle the physical data
* In complex hierarchies we can have many DrawSheetStruct using the same data * In complex hierarchies we can have many DrawSheetStruct using the same data
*/ */
int m_SheetNumber; // sheet number (used for info) int m_SheetNumber; // sheet number (used for info)
int m_NumberOfSheets; // Sheets count in the whole schematic (used for info) int m_NumberOfSheets; // Sheets count in the whole schematic (used for info)
public: public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
...@@ -91,13 +91,14 @@ public: ...@@ -91,13 +91,14 @@ public:
return wxT( "DrawSheetStruct" ); return wxT( "DrawSheetStruct" );
} }
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy(); DrawSheetStruct* GenCopy();
...@@ -107,15 +108,14 @@ public: ...@@ -107,15 +108,14 @@ public:
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
void SwapData( DrawSheetStruct* copyitem ); void SwapData( DrawSheetStruct* copyitem );
void DeleteAnnotation( bool recurse );
int ComponentCount(); int ComponentCount();
bool Load( WinEDA_SchematicFrame* frame ); bool Load( WinEDA_SchematicFrame* frame );
bool SearchHierarchy( wxString filename, SCH_SCREEN** screen ); bool SearchHierarchy( wxString filename, SCH_SCREEN** screen ); //search the existing hierarchy for an instance of screen "FileName".
bool LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* list ); bool LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* list );
int CountSheets(); int CountSheets();
wxString GetFileName(void); wxString GetFileName( void );
void SetFileName(const wxString & aFilename); // Set a new filename without changing anything else void SetFileName( const wxString& aFilename ); // Set a new filename without changing anything else
bool ChangeFileName(WinEDA_SchematicFrame * aFrame, const wxString & aFileName); // Set a new filename and manage data and associated screen bool ChangeFileName( WinEDA_SchematicFrame* aFrame, const wxString& aFileName ); // Set a new filename and manage data and associated screen
//void RemoveSheet(DrawSheetStruct* sheet); //void RemoveSheet(DrawSheetStruct* sheet);
//to remove a sheet, just delete it //to remove a sheet, just delete it
...@@ -143,23 +143,26 @@ public: ...@@ -143,23 +143,26 @@ public:
EDA_BaseStruct* LastDrawList(); EDA_BaseStruct* LastDrawList();
void Push( DrawSheetStruct* sheet ); void Push( DrawSheetStruct* sheet );
DrawSheetStruct* Pop(); DrawSheetStruct* Pop();
/** Function Path /** Function Path
* the path uses the time stamps which do not changes even when editing sheet parameters * the path uses the time stamps which do not changes even when editing sheet parameters
* a path is something like / (root) or /34005677 or /34005677/00AE4523 * a path is something like / (root) or /34005677 or /34005677/00AE4523
*/ */
wxString Path(); wxString Path();
/** Function PathHumanReadable /** Function PathHumanReadable
* Return the sheet path in a readable form, i.e. * Return the sheet path in a readable form, i.e.
* as a path made from sheet names. * as a path made from sheet names.
* (the "normal" path uses the time stamps which do not changes even when editing sheet parameters) * (the "normal" path uses the time stamps which do not changes even when editing sheet parameters)
*/ */
wxString PathHumanReadable(); wxString PathHumanReadable();
/** Function UpdateAllScreenReferences /** Function UpdateAllScreenReferences
* Update the reference and the m_Multi parameter (part selection) for all components on a screen * Update the reference and the m_Multi parameter (part selection) for all components on a screen
* depending on the actual sheet path. * depending on the actual sheet path.
* Mandatory in complex hierarchies because sheets use the same screen (basic schematic) * Mandatory in complex hierarchies because sheets use the same screen (basic schematic)
* but with different references and part selection according to the displayed sheet * but with different references and part selection according to the displayed sheet
*/ */
void UpdateAllScreenReferences(); void UpdateAllScreenReferences();
bool operator =( const DrawSheetPath& d1 ); bool operator =( const DrawSheetPath& d1 );
...@@ -181,7 +184,7 @@ class EDA_SheetList ...@@ -181,7 +184,7 @@ class EDA_SheetList
private: private:
DrawSheetPath* m_List; DrawSheetPath* m_List;
int m_count; /* Number of sheets included in hierarchy, int m_count; /* Number of sheets included in hierarchy,
* starting at the given sheet in constructor . the given sheet is counted * starting at the given sheet in constructor . the given sheet is counted
*/ */
int m_index; int m_index;
DrawSheetPath m_currList; DrawSheetPath m_currList;
......
...@@ -442,16 +442,21 @@ void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -442,16 +442,21 @@ void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
} }
/***************************************************/ /**********************************************************/
void SCH_COMPONENT::ClearAnnotation() void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
/***************************************************/ /**********************************************************/
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1) /**
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
* @param aSheet: DrawSheetPath value: if NULL remove all annotations,
* else remove annotation relative to this sheetpath
*/ */
{ {
wxString defRef = m_PrefixString; wxString defRef = m_PrefixString;
bool KeepMulti = false; bool KeepMulti = false;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
wxString separators( wxT( " " ) );
wxArrayString reference_fields;
Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
...@@ -465,15 +470,27 @@ void SCH_COMPONENT::ClearAnnotation() ...@@ -465,15 +470,27 @@ void SCH_COMPONENT::ClearAnnotation()
wxString multi = wxT( "1" ); wxString multi = wxT( "1" );
wxString NewHref; wxString NewHref;
wxString path;
if( aSheet )
path = GetPath( aSheet );;
for( unsigned int ii = 0; ii< m_PathsAndReferences.GetCount(); ii++ ) for( unsigned int ii = 0; ii< m_PathsAndReferences.GetCount(); ii++ )
{ {
if( KeepMulti ) // Get and keep part selection // Break hierachical reference in path, ref and multi selection:
multi = m_PathsAndReferences[ii].AfterLast( wxChar( ' ' ) ); reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
NewHref = m_PathsAndReferences[ii].BeforeFirst( wxChar( ' ' ) ); if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
NewHref << wxT( " " ) << defRef << wxT( " " ) << multi; {
m_PathsAndReferences[ii] = NewHref; if( KeepMulti ) // Get and keep part selection
multi = reference_fields[2];
NewHref = reference_fields[0];
NewHref << wxT( " " ) << defRef << wxT( " " ) << multi;
m_PathsAndReferences[ii] = NewHref;
}
} }
// These 2 changes do not work in complex hierarchy.
// When a clear annotation is made, the calling function must call a
// UpdateAllScreenReferences for the active sheet.
// But this call does not made here.
m_Field[REFERENCE].m_Text = defRef; //for drawing. m_Field[REFERENCE].m_Text = defRef; //for drawing.
if( !KeepMulti ) if( !KeepMulti )
......
...@@ -140,7 +140,13 @@ public: ...@@ -140,7 +140,13 @@ public:
int GetRotationMiroir(); int GetRotationMiroir();
wxPoint GetScreenCoord( const wxPoint& coord ); wxPoint GetScreenCoord( const wxPoint& coord );
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
void ClearAnnotation(); /**
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
* @param aSheet: DrawSheetPath value: if NULL remove all annotations,
* else remove annotation relative to this sheetpath
*/
void ClearAnnotation( DrawSheetPath* aSheet );
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundaryBox() const;
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
......
...@@ -216,9 +216,264 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin ...@@ -216,9 +216,264 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
} }
/***********************************************************************/ /*************************************************************************************/
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
/***********************************************************************/ /*************************************************************************************/
{
wxSize delta;
SCH_SCREEN* screen = GetScreen();
int zoom = screen->GetZoom();
wxPoint curpos, oldpos;
int hotkey = 0;
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 )
delta.x = 1;
if( delta.y <= 0 )
delta.y = 1;
switch( g_KeyPressed )
{
case 0:
break;
case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
MousePositionInPixels.y -= delta.y;
DrawPanel->MouseTo( MousePositionInPixels );
break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN:
MousePositionInPixels.y += delta.y;
DrawPanel->MouseTo( MousePositionInPixels );
break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT:
MousePositionInPixels.x -= delta.x;
DrawPanel->MouseTo( MousePositionInPixels );
break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT:
MousePositionInPixels.x += delta.x;
DrawPanel->MouseTo( MousePositionInPixels );
break;
default:
hotkey = g_KeyPressed;
break;
}
/* Recalcul de la position du curseur schema */
screen->m_Curseur = curpos;
/* Placement sur la grille generale */
PutOnGrid( &(screen->m_Curseur) );
if( screen->IsRefreshReq() )
{
RedrawActiveWindow( DC, TRUE );
}
if( oldpos != screen->m_Curseur )
{
curpos = screen->m_Curseur;
screen->m_Curseur = oldpos;
DrawPanel->CursorOff( DC );
screen->m_Curseur = curpos;
DrawPanel->CursorOn( DC );
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
}
}
if( hotkey )
{
if( screen->GetCurItem()
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() );
else
OnHotKey( DC, hotkey, NULL );
}
Affiche_Status_Box(); /* Affichage des coord curseur */
}
/*************************************************************************************/
void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
/*************************************************************************************/
{
wxSize delta;
SCH_SCREEN* screen = GetScreen();
int zoom = screen->GetZoom();
wxPoint curpos, oldpos;
int hotkey = 0;
curpos = screen->m_MousePosition;
oldpos = screen->m_Curseur;
delta.x = screen->GetGrid().x / zoom;
delta.y = screen->GetGrid().y / zoom;
if( delta.x <= 0 )
delta.x = 1;
if( delta.y <= 0 )
delta.y = 1;
switch( g_KeyPressed )
{
case 0:
break;
case EDA_PANNING_UP_KEY:
OnZoom( ID_ZOOM_PANNING_UP );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_DOWN_KEY:
OnZoom( ID_ZOOM_PANNING_DOWN );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_LEFT_KEY:
OnZoom( ID_ZOOM_PANNING_LEFT );
curpos = screen->m_Curseur;
break;
case EDA_PANNING_RIGHT_KEY:
OnZoom( ID_ZOOM_PANNING_RIGHT );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_IN_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_OUT_KEY );
curpos = screen->m_Curseur;
break;
case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY );
curpos = screen->m_Curseur;
break;
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
case WXK_UP:
MousePositionInPixels.y -= delta.y;
DrawPanel->MouseTo( MousePositionInPixels );
break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN:
MousePositionInPixels.y += delta.y;
DrawPanel->MouseTo( MousePositionInPixels );
break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
case WXK_LEFT:
MousePositionInPixels.x -= delta.x;
DrawPanel->MouseTo( MousePositionInPixels );
break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
case WXK_RIGHT:
MousePositionInPixels.x += delta.x;
DrawPanel->MouseTo( MousePositionInPixels );
break;
default:
hotkey = g_KeyPressed;
break;
}
/* Recalcul de la position du curseur schema */
screen->m_Curseur = curpos;
/* Placement sur la grille generale */
PutOnGrid( &(screen->m_Curseur) );
if( screen->IsRefreshReq() )
{
RedrawActiveWindow( DC, TRUE );
}
if( oldpos != screen->m_Curseur )
{
curpos = screen->m_Curseur;
screen->m_Curseur = oldpos;
DrawPanel->CursorOff( DC );
screen->m_Curseur = curpos;
DrawPanel->CursorOn( DC );
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
}
}
if( hotkey )
{
if( screen->GetCurItem()
&& screen->GetCurItem()->m_Flags )
OnHotKey( DC, hotkey, screen->GetCurItem() );
else
OnHotKey( DC, hotkey, NULL );
}
Affiche_Status_Box(); /* Affichage des coord curseur */
}
/*************************************************************************************/
void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
/*************************************************************************************/
{ {
wxSize delta; wxSize delta;
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
...@@ -285,7 +540,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi ...@@ -285,7 +540,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN: case WXK_DOWN:
D(printf("DOWN\n");)
MousePositionInPixels.y += delta.y; MousePositionInPixels.y += delta.y;
DrawPanel->MouseTo( MousePositionInPixels ); DrawPanel->MouseTo( MousePositionInPixels );
break; break;
......
...@@ -314,7 +314,7 @@ static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame) ...@@ -314,7 +314,7 @@ static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
NewScreen->m_ScrollbarPos.x, NewScreen->m_ScrollbarPos.x,
NewScreen->m_ScrollbarPos.y,TRUE); NewScreen->m_ScrollbarPos.y,TRUE);
//update the References //update the References
frame->m_CurrentSheet->UpdateAllScreenReferences(); frame->m_CurrentSheet->UpdateAllScreenReferences();
frame->DrawPanel->m_CanStartBlock = -1; frame->DrawPanel->m_CanStartBlock = -1;
ActiveScreen = frame->m_CurrentSheet->LastScreen(); ActiveScreen = frame->m_CurrentSheet->LastScreen();
......
...@@ -549,7 +549,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -549,7 +549,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
newitem = olditem->GenCopy(); newitem = olditem->GenCopy();
newitem->m_TimeStamp = GetTimeStamp(); newitem->m_TimeStamp = GetTimeStamp();
newitem->ClearAnnotation(); newitem->ClearAnnotation(NULL);
newitem->m_Flags = IS_NEW; newitem->m_Flags = IS_NEW;
StartMovePart( newitem, &dc ); StartMovePart( newitem, &dc );
......
...@@ -255,8 +255,9 @@ void WinEDA_SchematicFrame::CreateScreens() ...@@ -255,8 +255,9 @@ void WinEDA_SchematicFrame::CreateScreens()
} }
/**************************************************************/ /*****************************************************************/
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/
{ {
DrawSheetPath* sheet; DrawSheetPath* sheet;
......
...@@ -101,6 +101,12 @@ public: ...@@ -101,6 +101,12 @@ public:
/* netlist generation */ /* netlist generation */
void* BuildNetListBase(); void* BuildNetListBase();
/** Function DeleteAnnotation
* Remove current component annotations
* @param aCurrentSheetOnly : if false: remove all annotations, else remove annotation relative to the current sheet only
* @param aRedraw : true to refresh display
*/
void DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw );
// FUnctions used for hierarchy handling // FUnctions used for hierarchy handling
void InstallPreviousSheet(); void InstallPreviousSheet();
...@@ -307,6 +313,8 @@ public: ...@@ -307,6 +313,8 @@ public:
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
private: private:
// General: // General:
...@@ -416,6 +424,8 @@ public: ...@@ -416,6 +424,8 @@ public:
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
private: private:
void SelectCurrentLibrary(); void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option ); void SelectAndViewLibraryPart( int option );
......
install(DIRECTORY ca cs de es fr hu it ko pl pt ru sl sv zh_CN install(DIRECTORY ca cs de es fr hu it ko nl pl pt ru sl sv zh_CN
DESTINATION ${KICAD_INTERNAT} DESTINATION ${KICAD_INTERNAT}
COMPONENT resources COMPONENT resources
PATTERN ".svn" EXCLUDE PATTERN ".svn" EXCLUDE
......
This diff is collapsed.
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