see changelog

This commit is contained in:
charras 2008-04-21 06:34:56 +00:00
parent 9b082be01a
commit af7b6691d4
16 changed files with 11341 additions and 139 deletions

View File

@ -5,6 +5,16 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
+all

View File

@ -119,14 +119,10 @@ void ReAnnotatePowerSymbolsOnly( void )
CmpListStruct* AllocateCmpListStrct( int numcomponents )
{
int ii = numcomponents * sizeof(CmpListStruct);
//allocate memory and fill this memory with zeros.
CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii );
//fill this memory with zeros.
char* cptr = (char*) list;
for( int i = 0; i<ii; i++ )
*cptr++ = 0;
return list;
}
@ -192,24 +188,53 @@ int AnnotateByValue( const void* o1, const void* o2 )
}
/*****************************************************************************
* DeleteAnnotation:
*
* Clear the current annotation.
****************************************************************************/
void DeleteAnnotation( WinEDA_SchematicFrame* parent, bool annotateSchematic )
/**************************************************************************************/
void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw )
/**************************************************************************************/
/** 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
*/
{
DrawSheetStruct* sheet;
EDA_BaseStruct* strct;
SCH_SCREEN* screen;
EDA_ScreenList ScreenList;
if( annotateSchematic )
sheet = g_RootSheet;
screen = ScreenList.GetFirst();
if( aCurrentSheetOnly )
screen = GetScreen();
if( screen == NULL )
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
sheet = parent->GetSheet()->Last();
( (SCH_COMPONENT*) strct )->ClearAnnotation( NULL );
}
}
sheet->DeleteAnnotation( annotateSchematic );
screen->SetModify();
if( aCurrentSheetOnly )
break;
screen = ScreenList.GetNext();
}
g_RootSheet->m_AssociatedScreen->SetModify();
parent->DrawPanel->Refresh( true );
//update the References
m_CurrentSheet->UpdateAllScreenReferences();
if( aRedraw )
DrawPanel->Refresh( true );
}
@ -238,7 +263,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
/* If it is an annotation for all the components, reset previous
* annotation: */
if( resetAnnotation )
DeleteAnnotation( parent, annotateSchematic );
parent->DeleteAnnotation( !annotateSchematic, false );
/* Build the sheet list */
EDA_SheetList SheetList( g_RootSheet );
@ -439,7 +464,6 @@ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp )
break;
}
}
}
}

View File

@ -34,8 +34,6 @@
#include "program.h"
#include "annotate_dialog.h"
extern void DeleteAnnotation( WinEDA_SchematicFrame* parent,
bool annotateSchematic );
extern void AnnotateComponents( WinEDA_SchematicFrame* parent,
bool annotateSchematic,
bool sortByPosition,
@ -262,7 +260,7 @@ void WinEDA_AnnotateFrame::OnClearAnnotationCmpClick( wxCommandEvent& event )
wxICON_EXCLAMATION | wxOK | wxCANCEL );
if (response == wxCANCEL)
return;
DeleteAnnotation( m_Parent, GetLevel() );
m_Parent->DeleteAnnotation( GetLevel() ? false : true, true );
m_btnClear->Enable(false);
}

View File

@ -828,7 +828,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT:
{
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL);
}
break;
@ -893,7 +893,7 @@ static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* sc
case TYPE_SCH_COMPONENT:
( (SCH_COMPONENT*) NewDrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation();
( (SCH_COMPONENT*) NewDrawStruct )->ClearAnnotation(NULL);
break;
}
@ -1051,7 +1051,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( Struct->Type() == TYPE_SCH_COMPONENT )
{
( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) Struct )->ClearAnnotation();
( (SCH_COMPONENT*) Struct )->ClearAnnotation(NULL);
SetStructFather( Struct, GetScreen() );
}
PickedList = (DrawPickedStruct*) PickedList->Pnext;
@ -1075,7 +1075,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
if( DrawStruct->Type() == TYPE_SCH_COMPONENT )
{
( (SCH_COMPONENT*) DrawStruct )->m_TimeStamp = GetTimeStamp();
( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation();
( (SCH_COMPONENT*) DrawStruct )->ClearAnnotation(NULL);
}
SetStructFather( DrawStruct, GetScreen() );
RedrawOneStruct( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );

View File

@ -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()

View File

@ -62,16 +62,16 @@ WX_DEFINE_ARRAY( DrawSheetStruct *, SheetGrowArray );
class DrawSheetStruct : public SCH_ITEM /*public SCH_SCREEN*/ /* Gestion de la hierarchie */
{
public:
wxString m_SheetName; //this is equivalent to C101 for components:
// it is stored in F0 ... of the file.
wxString m_SheetName; /*this is equivalent to C101 for components:
* it is stored in F0 ... of the file. */
private:
wxString m_FileName; //also in SCH_SCREEN (redundant),
//but need it here for loading after
//reading the sheet description from file.
wxString m_FileName; /*also in SCH_SCREEN (redundant),
* but need it here for loading after
* reading the sheet description from file. */
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;
wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer;
@ -91,6 +91,7 @@ public:
return wxT( "DrawSheetStruct" );
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
@ -107,10 +108,9 @@ public:
int draw_mode, int Color = -1 );
EDA_Rect GetBoundingBox();
void SwapData( DrawSheetStruct* copyitem );
void DeleteAnnotation( bool recurse );
int ComponentCount();
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 );
int CountSheets();
wxString GetFileName( void );
@ -143,17 +143,20 @@ public:
EDA_BaseStruct* LastDrawList();
void Push( DrawSheetStruct* sheet );
DrawSheetStruct* Pop();
/** Function Path
* 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
*/
wxString Path();
/** Function PathHumanReadable
* Return the sheet path in a readable form, i.e.
* as a path made from sheet names.
* (the "normal" path uses the time stamps which do not changes even when editing sheet parameters)
*/
wxString PathHumanReadable();
/** Function UpdateAllScreenReferences
* Update the reference and the m_Multi parameter (part selection) for all components on a screen
* depending on the actual sheet path.

View File

@ -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;
bool KeepMulti = false;
EDA_LibComponentStruct* Entry;
wxString separators( wxT( " " ) );
wxArrayString reference_fields;
Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
@ -465,15 +470,27 @@ void SCH_COMPONENT::ClearAnnotation()
wxString multi = wxT( "1" );
wxString NewHref;
wxString path;
if( aSheet )
path = GetPath( aSheet );;
for( unsigned int ii = 0; ii< m_PathsAndReferences.GetCount(); ii++ )
{
// Break hierachical reference in path, ref and multi selection:
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
{
if( KeepMulti ) // Get and keep part selection
multi = m_PathsAndReferences[ii].AfterLast( wxChar( ' ' ) );
NewHref = m_PathsAndReferences[ii].BeforeFirst( wxChar( ' ' ) );
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.
if( !KeepMulti )

View File

@ -140,7 +140,13 @@ public:
int GetRotationMiroir();
wxPoint GetScreenCoord( const wxPoint& coord );
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 GetBoundingBox();

View File

@ -216,9 +216,264 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
}
/***********************************************************************/
/*************************************************************************************/
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;
SCH_SCREEN* screen = GetScreen();
@ -285,7 +540,6 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
case WXK_DOWN:
D(printf("DOWN\n");)
MousePositionInPixels.y += delta.y;
DrawPanel->MouseTo( MousePositionInPixels );
break;

View File

@ -549,7 +549,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break;
newitem = olditem->GenCopy();
newitem->m_TimeStamp = GetTimeStamp();
newitem->ClearAnnotation();
newitem->ClearAnnotation(NULL);
newitem->m_Flags = IS_NEW;
StartMovePart( newitem, &dc );

View File

@ -255,8 +255,9 @@ void WinEDA_SchematicFrame::CreateScreens()
}
/**************************************************************/
/*****************************************************************/
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/
{
DrawSheetPath* sheet;

View File

@ -101,6 +101,12 @@ public:
/* netlist generation */
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
void InstallPreviousSheet();
@ -307,6 +313,8 @@ public:
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
private:
// General:
@ -416,6 +424,8 @@ public:
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
private:
void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option );

View File

@ -1,4 +1,4 @@
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}
COMPONENT resources
PATTERN ".svn" EXCLUDE

BIN
internat/nl/kicad.mo Normal file

Binary file not shown.

10905
internat/nl/kicad.po Normal file

File diff suppressed because it is too large Load Diff