Commit af7b6691 authored by charras's avatar charras

see changelog

parent 9b082be0
......@@ -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
......
......@@ -16,8 +16,8 @@ static void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp );
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp );
static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp );
int GetLastReferenceNumber( CmpListStruct* Objet,
CmpListStruct* BaseListeCmp,
int NbOfCmp );
CmpListStruct* BaseListeCmp,
int NbOfCmp );
static int ExistUnit( CmpListStruct* Objet, int Unit,
CmpListStruct* BaseListeCmp, int NbOfCmp );
......@@ -90,7 +90,7 @@ void ReAnnotatePowerSymbolsOnly( void )
{
if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue;
SCH_COMPONENT* DrawLibItem =
SCH_COMPONENT* DrawLibItem =
(SCH_COMPONENT*) DrawList;
EDA_LibComponentStruct* Entry =
FindLibPart(
......@@ -118,27 +118,23 @@ void ReAnnotatePowerSymbolsOnly( void )
CmpListStruct* AllocateCmpListStrct( int numcomponents )
{
int ii = numcomponents * sizeof(CmpListStruct);
CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii );
//fill this memory with zeros.
char* cptr = (char*) list;
int ii = numcomponents * sizeof(CmpListStruct);
for( int i = 0; i<ii; i++ )
*cptr++ = 0;
//allocate memory and fill this memory with zeros.
CmpListStruct* list = (CmpListStruct*) MyZMalloc( ii );
return list;
}
/* qsort function to annotate items by their position.
* Components are sorted
* by reference
* if same reference: by sheet
* if same sheet, by X pos
* if same X pos, by Y pos
* if same Y pos, by time stamp
*/
* Components are sorted
* by reference
* if same reference: by sheet
* if same sheet, by X pos
* if same X pos, by Y pos
* if same Y pos, by time stamp
*/
int AnnotateByPosition( const void* o1, const void* o2 )
{
CmpListStruct* item1 = (CmpListStruct*) o1;
......@@ -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;
else
sheet = parent->GetSheet()->Last();
screen = ScreenList.GetFirst();
sheet->DeleteAnnotation( annotateSchematic );
if( aCurrentSheetOnly )
screen = GetScreen();
g_RootSheet->m_AssociatedScreen->SetModify();
parent->DrawPanel->Refresh( true );
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
( (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,
wxBusyCursor dummy;
/* If it is an annotation for all the components, reset previous
* annotation: */
* annotation: */
if( resetAnnotation )
DeleteAnnotation( parent, annotateSchematic );
parent->DeleteAnnotation( !annotateSchematic, false );
/* Build the sheet list */
EDA_SheetList SheetList( g_RootSheet );
......@@ -281,7 +306,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
DisplayError( parent, wxT( "Internal error in AnnotateComponents()" ) );
/* Break full components reference in name (prefix) and number:
* example: IC1 become IC, and 1 */
* example: IC1 become IC, and 1 */
BreakReference( BaseListeCmp, NbOfCmp );
if( sortByPosition )
......@@ -289,7 +314,7 @@ void AnnotateComponents( WinEDA_SchematicFrame* parent,
( int( * ) ( const void*, const void* ) )AnnotateByPosition );
else
qsort( BaseListeCmp, NbOfCmp, sizeof(CmpListStruct),
( int( * ) ( const void*, const void* ) ) AnnotateByValue);
( int( * ) ( const void*, const void* ) )AnnotateByValue );
/* Recalculate reference numbers */
ComputeReferenceNumber( BaseListeCmp, NbOfCmp );
......@@ -312,7 +337,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
{
int NbrCmp = 0;
EDA_BaseStruct* DrawList = sheet->LastDrawList();
SCH_COMPONENT* DrawLibItem;
SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry;
for( ; DrawList; DrawList = DrawList->Pnext )
......@@ -334,7 +359,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
BaseListeCmp[NbrCmp].m_Cmp = DrawLibItem;
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_SheetList = *sheet;
BaseListeCmp[NbrCmp].m_IsNew = FALSE;
......@@ -368,8 +393,8 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
*****************************************************************************/
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp )
{
int ii;
char* Text;
int ii;
char* Text;
SCH_COMPONENT* DrawLibItem;
/* Reattribution des numeros */
......@@ -439,7 +464,6 @@ void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp )
break;
}
}
}
}
......@@ -497,7 +521,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp )
}
/* Annotation of multi-part components ( n parts per package )
* (complex case) */
* (complex case) */
ValText = BaseListeCmp[ii].m_TextValue;
NumberOfUnits = BaseListeCmp[ii].m_NbParts;
......@@ -537,7 +561,7 @@ static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp )
}
/* Component without reference number found, annotate it if
* possible */
* possible */
if( !BaseListeCmp[jj].m_PartsLocked
|| (BaseListeCmp[jj].m_Unit == Unit) )
{
......@@ -609,15 +633,15 @@ static int ExistUnit( CmpListStruct* Objet, int Unit,
ItemToTest < EndList;
ItemToTest++, ii++ )
{
if( Objet == ItemToTest ) // Do not compare with itself !
if( Objet == ItemToTest ) // Do not compare with itself !
continue;
if( ItemToTest->m_IsNew ) // Not already with an updated reference
if( ItemToTest->m_IsNew ) // Not already with an updated reference
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;
if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) // Not the same reference prefix
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;
}
......@@ -685,7 +709,7 @@ int CheckAnnotate( WinEDA_SchematicFrame* frame, bool oneSheetOnly )
qsort( ListeCmp, NbOfCmp, sizeof(CmpListStruct), AnnotateByValue );
/* Break full components reference in name (prefix) and number: example:
* IC1 become IC, and 1 */
* IC1 become IC, and 1 */
BreakReference( ListeCmp, NbOfCmp );
/* count not yet annotated items */
......
......@@ -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);
}
......
......@@ -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 );
......
......@@ -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()
......
......@@ -20,13 +20,13 @@ class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM,
public:
int m_Edge, m_Shape;
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
public:
Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~Hierarchical_PIN_Sheet_Struct() { }
virtual wxString GetClass() const
......@@ -35,14 +35,14 @@ public:
}
Hierarchical_PIN_Sheet_Struct* GenCopy();
Hierarchical_PIN_Sheet_Struct* GenCopy();
Hierarchical_PIN_Sheet_Struct* Next()
{ return (Hierarchical_PIN_Sheet_Struct*) Pnext; }
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
/**
* Function Save
......@@ -50,38 +50,38 @@ public:
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
bool Save( FILE* aFile ) const;
};
/* 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 );
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_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;
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points de connection, linked list.*/
int m_NbLabel; /* Nombre de points de connexion */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which handle the physical data
* In complex hierarchies we can have many DrawSheetStruct using the same data
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 */
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of sheet symbol */
int m_Layer;
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points de connection, linked list.*/
int m_NbLabel; /* Nombre de points de connexion */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which handle the physical data
* In complex hierarchies we can have many DrawSheetStruct using the same data
*/
int m_SheetNumber; // sheet number (used for info)
int m_NumberOfSheets; // Sheets count in the whole schematic (used for info)
int m_SheetNumber; // sheet number (used for info)
int m_NumberOfSheets; // Sheets count in the whole schematic (used for info)
public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
......@@ -91,13 +91,14 @@ public:
return wxT( "DrawSheetStruct" );
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @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 );
DrawSheetStruct* GenCopy();
......@@ -107,15 +108,14 @@ 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);
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
wxString GetFileName( void );
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
//void RemoveSheet(DrawSheetStruct* sheet);
//to remove a sheet, just delete it
......@@ -143,23 +143,26 @@ 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
*/
* 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)
*/
* 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.
* Mandatory in complex hierarchies because sheets use the same screen (basic schematic)
* but with different references and part selection according to the displayed sheet
*/
*/
void UpdateAllScreenReferences();
bool operator =( const DrawSheetPath& d1 );
......@@ -181,7 +184,7 @@ class EDA_SheetList
private:
DrawSheetPath* m_List;
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;
DrawSheetPath m_currList;
......
......@@ -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;
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++ )
{
if( KeepMulti ) // Get and keep part selection
multi = m_PathsAndReferences[ii].AfterLast( wxChar( ' ' ) );
NewHref = m_PathsAndReferences[ii].BeforeFirst( wxChar( ' ' ) );
NewHref << wxT( " " ) << defRef << wxT( " " ) << multi;
m_PathsAndReferences[ii] = NewHref;
// 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 = 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 )
......
......@@ -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();
......
......@@ -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;
......
......@@ -314,7 +314,7 @@ static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
NewScreen->m_ScrollbarPos.x,
NewScreen->m_ScrollbarPos.y,TRUE);
//update the References
//update the References
frame->m_CurrentSheet->UpdateAllScreenReferences();
frame->DrawPanel->m_CanStartBlock = -1;
ActiveScreen = frame->m_CurrentSheet->LastScreen();
......
......@@ -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 );
......
......@@ -255,8 +255,9 @@ void WinEDA_SchematicFrame::CreateScreens()
}
/**************************************************************/
/*****************************************************************/
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/
{
DrawSheetPath* sheet;
......
......@@ -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 );
......
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
......
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