Component library object improvements.
* Library component objects can now draw themselves without external drawing code. * Fix all the library drawing and field objects to support component drawing code. * Provide proper file dialog wild card for symbol libraries and us wxFileDialog. * Update component library editing code to reflect component drawing changes.
This commit is contained in:
parent
d4a5e5acb7
commit
7c7d675cbf
|
@ -1,5 +1,5 @@
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* block_libedt.cpp */
|
/* block_libedit.cpp */
|
||||||
/* Gestion des Operations sur Blocks et Effacements */
|
/* Gestion des Operations sur Blocks et Effacements */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
|
@ -15,24 +15,21 @@
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
/* Variables Locales */
|
|
||||||
|
|
||||||
/* Fonctions exportees */
|
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
bool erase );
|
||||||
/* Fonctions Locales */
|
|
||||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
|
||||||
static int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
static int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
||||||
EDA_Rect& Rect );
|
EDA_Rect& Rect );
|
||||||
|
|
||||||
static void ClearMarkItems( EDA_LibComponentStruct* LibComponent );
|
static void ClearMarkItems( EDA_LibComponentStruct* LibComponent );
|
||||||
static void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset );
|
static void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset );
|
||||||
static void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset );
|
static void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset );
|
||||||
static void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset );
|
static void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry,
|
||||||
|
wxPoint offset );
|
||||||
static void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry );
|
static void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry );
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
void ClearMarkItems( EDA_LibComponentStruct* LibComponent )
|
void ClearMarkItems( EDA_LibComponentStruct* LibComponent )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* item;
|
LibEDA_BaseStruct* item;
|
||||||
|
|
||||||
|
@ -45,27 +42,27 @@ void ClearMarkItems( EDA_LibComponentStruct* LibComponent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/*
|
||||||
|
* Mark items inside rect.
|
||||||
|
* Items are inside rect when an end point is inside rect
|
||||||
|
*
|
||||||
|
* Rules for convert drawings and other parts ( for multi part per package):
|
||||||
|
* - Commons are always marked
|
||||||
|
* - Specific graphic shapes must agree with the current displayed part and
|
||||||
|
* convert
|
||||||
|
* - Because most of pins are specific to current part and current convert:
|
||||||
|
* - if g_EditPinByPinIsOn == TRUE, or flag .m_UnitSelectionLocked == TRUE,
|
||||||
|
* only the pins specific to current part and current convert are marked
|
||||||
|
* - all specific to current convert pins are marked;
|
||||||
|
*/
|
||||||
int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
||||||
EDA_Rect& Rect )
|
EDA_Rect& Rect )
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/* Mark items inside rect.
|
|
||||||
* Items are inside rect when an end point is inside rect
|
|
||||||
*
|
|
||||||
* Rules for convert drawings and other parts ( for multi part per package):
|
|
||||||
* - Commons are always marked
|
|
||||||
* - Specific graphic shapes must agree with the current displayed part and convert
|
|
||||||
* - Because most of pins are specific to current part and current convert:
|
|
||||||
* - if g_EditPinByPinIsOn == TRUE, or flag .m_UnitSelectionLocked == TRUE,
|
|
||||||
* only the pins specific to current part and current convert are marked
|
|
||||||
* - all specific to current convert pins are marked;
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* item;
|
LibEDA_BaseStruct* item;
|
||||||
int ItemsCount = 0;
|
int ItemsCount = 0;
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
bool ItemIsInOtherPart, ItemIsInOtherConvert;
|
bool ItemIsInOtherPart;
|
||||||
|
bool ItemIsInOtherConvert;
|
||||||
|
|
||||||
if( LibComponent == NULL )
|
if( LibComponent == NULL )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -188,7 +185,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
||||||
case COMPONENT_FIELD_DRAW_TYPE:
|
case COMPONENT_FIELD_DRAW_TYPE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
defualt:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,13 +194,11 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*
|
||||||
int WinEDA_LibeditFrame::ReturnBlockCommand( int key )
|
* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
|
|
||||||
* the key (ALT, SHIFT ALT ..)
|
* the key (ALT, SHIFT ALT ..)
|
||||||
*/
|
*/
|
||||||
|
int WinEDA_LibeditFrame::ReturnBlockCommand( int key )
|
||||||
{
|
{
|
||||||
int cmd;
|
int cmd;
|
||||||
|
|
||||||
|
@ -243,17 +238,17 @@ int WinEDA_LibeditFrame::ReturnBlockCommand( int key )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
/*
|
||||||
int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
* Command BLOCK END (end of block sizing)
|
||||||
/****************************************************/
|
|
||||||
|
|
||||||
/* Command BLOCK END (end of block sizing)
|
|
||||||
* return :
|
* return :
|
||||||
* 0 if command finished (zoom, delete ...)
|
* 0 if command finished (zoom, delete ...)
|
||||||
* 1 if HandleBlockPlace must follow (items found, and a block place command must follow)
|
* 1 if HandleBlockPlace must follow (items found, and a block place
|
||||||
|
* command must follow)
|
||||||
*/
|
*/
|
||||||
|
int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
{
|
{
|
||||||
int ItemsCount = 0, MustDoPlace = 0;
|
int ItemsCount = 0;
|
||||||
|
int MustDoPlace = 0;
|
||||||
|
|
||||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
{
|
{
|
||||||
|
@ -278,7 +273,8 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: /* Drag */
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: /* Move */
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
ItemsCount = MarkItemsInBloc( CurrentLibEntry,
|
||||||
|
GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
{
|
{
|
||||||
MustDoPlace = 1;
|
MustDoPlace = 1;
|
||||||
|
@ -300,7 +296,8 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DELETE: /* Delete */
|
case BLOCK_DELETE: /* Delete */
|
||||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
ItemsCount = MarkItemsInBloc( CurrentLibEntry,
|
||||||
|
GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
DeleteMarkedItems( CurrentLibEntry );
|
DeleteMarkedItems( CurrentLibEntry );
|
||||||
|
@ -315,10 +312,12 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
case BLOCK_MIRROR_Y:
|
case BLOCK_MIRROR_Y:
|
||||||
ItemsCount = MarkItemsInBloc( CurrentLibEntry, GetScreen()->m_BlockLocate );
|
ItemsCount = MarkItemsInBloc( CurrentLibEntry,
|
||||||
|
GetScreen()->m_BlockLocate );
|
||||||
if( ItemsCount )
|
if( ItemsCount )
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
|
MirrorMarkedItems( CurrentLibEntry,
|
||||||
|
GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: /* Window Zoom */
|
case BLOCK_ZOOM: /* Window Zoom */
|
||||||
|
@ -344,7 +343,8 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
|
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor,
|
||||||
|
wxEmptyString );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,15 +353,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
/*
|
||||||
void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
* Routine to handle the BLOCK PLACE commande
|
||||||
/******************************************************/
|
|
||||||
|
|
||||||
/* Routine to handle the BLOCK PLACE commande
|
|
||||||
* Last routine for block operation for:
|
* Last routine for block operation for:
|
||||||
* - block move & drag
|
* - block move & drag
|
||||||
* - block copie & paste
|
* - block copie & paste
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
{
|
{
|
||||||
bool err = FALSE;
|
bool err = FALSE;
|
||||||
|
|
||||||
|
@ -384,14 +382,16 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
MoveMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
|
MoveMarkedItems( CurrentLibEntry,
|
||||||
|
GetScreen()->m_BlockLocate.m_MoveVector );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: /* Copy */
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
CopyMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.m_MoveVector );
|
CopyMarkedItems( CurrentLibEntry,
|
||||||
|
GetScreen()->m_BlockLocate.m_MoveVector );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||||
|
@ -400,7 +400,8 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
|
|
||||||
case BLOCK_MIRROR_Y: /* Invert by popup menu, from block move */
|
case BLOCK_MIRROR_Y: /* Invert by popup menu, from block move */
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
MirrorMarkedItems( CurrentLibEntry, GetScreen()->m_BlockLocate.Centre() );
|
MirrorMarkedItems( CurrentLibEntry,
|
||||||
|
GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
||||||
|
@ -414,31 +415,28 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
||||||
GetScreen()->m_BlockLocate.m_Flags = 0;
|
GetScreen()->m_BlockLocate.m_Flags = 0;
|
||||||
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
|
||||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
|
|
||||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
|
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor,
|
||||||
|
wxEmptyString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/*
|
||||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
* Retrace le contour du block de recherche de structures
|
||||||
bool erase )
|
|
||||||
/************************************************************************/
|
|
||||||
|
|
||||||
/* Retrace le contour du block de recherche de structures
|
|
||||||
* L'ensemble du block suit le curseur
|
* L'ensemble du block suit le curseur
|
||||||
*/
|
*/
|
||||||
|
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
bool erase )
|
||||||
{
|
{
|
||||||
BLOCK_SELECTOR* PtBlock;
|
BLOCK_SELECTOR* PtBlock;
|
||||||
BASE_SCREEN* screen = panel->GetScreen();
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
LibEDA_BaseStruct* item;
|
|
||||||
wxPoint move_offset;
|
wxPoint move_offset;
|
||||||
|
|
||||||
PtBlock = &screen->m_BlockLocate;
|
PtBlock = &screen->m_BlockLocate;
|
||||||
|
@ -446,60 +444,42 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
/* Effacement ancien cadre */
|
/* Effacement ancien cadre */
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode,
|
||||||
|
PtBlock->m_Color );
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
{
|
{
|
||||||
item = CurrentLibEntry->m_Drawings;
|
CurrentLibEntry->Draw( panel, DC, PtBlock->m_MoveVector,
|
||||||
for( ; item != NULL; item = item->Next() )
|
CurrentUnit, CurrentConvert, g_XorMode,
|
||||||
{
|
-1, DefaultTransformMatrix, true, false,
|
||||||
if( item->m_Selected == 0 )
|
true );
|
||||||
continue;
|
|
||||||
/* Do not draw items for other units */
|
|
||||||
if( CurrentUnit && item->m_Unit && (item->m_Unit != CurrentUnit) )
|
|
||||||
continue;
|
|
||||||
if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) )
|
|
||||||
continue;
|
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry,
|
|
||||||
PtBlock->m_MoveVector, item, g_XorMode );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redessin nouvel affichage */
|
/* Redessin nouvel affichage */
|
||||||
PtBlock->m_MoveVector.x = screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x;
|
PtBlock->m_MoveVector.x =
|
||||||
PtBlock->m_MoveVector.y = screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
|
screen->m_Curseur.x - PtBlock->m_BlockLastCursorPosition.x;
|
||||||
|
PtBlock->m_MoveVector.y =
|
||||||
|
screen->m_Curseur.y - PtBlock->m_BlockLastCursorPosition.y;
|
||||||
|
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
GRSetDrawMode( DC, g_XorMode );
|
||||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode,
|
||||||
|
PtBlock->m_Color );
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
{
|
{
|
||||||
item = CurrentLibEntry->m_Drawings;
|
CurrentLibEntry->Draw( panel, DC, PtBlock->m_MoveVector,
|
||||||
for( ; item != NULL; item = item->Next() )
|
CurrentUnit, CurrentConvert, g_XorMode,
|
||||||
{
|
-1, DefaultTransformMatrix, true, false,
|
||||||
if( item->m_Selected == 0 )
|
true );
|
||||||
continue;
|
|
||||||
/* Do not draw items for other units */
|
|
||||||
if( CurrentUnit && item->m_Unit && (item->m_Unit != CurrentUnit) )
|
|
||||||
continue;
|
|
||||||
if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) )
|
|
||||||
continue;
|
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry,
|
|
||||||
PtBlock->m_MoveVector,
|
|
||||||
item, g_XorMode );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/*
|
||||||
void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
* Copy marked items, at new position = old position + offset
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
/* Copy marked items, at new position = old position + offset
|
|
||||||
*/
|
*/
|
||||||
|
void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* item;
|
LibEDA_BaseStruct* item;
|
||||||
|
|
||||||
|
@ -522,12 +502,10 @@ void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/*
|
||||||
void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
* Move marked items, at new position = old position + offset
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
/* Move marked items, at new position = old position + offset
|
|
||||||
*/
|
*/
|
||||||
|
void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* item;
|
LibEDA_BaseStruct* item;
|
||||||
|
|
||||||
|
@ -549,7 +527,7 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
case COMPONENT_ARC_DRAW_TYPE:
|
||||||
{
|
{
|
||||||
( (LibDrawArc*) item )->m_Pos += offset;
|
( (LibDrawArc*) item )->m_Pos += offset;
|
||||||
( (LibDrawArc*) item )->m_ArcStart += offset;
|
( (LibDrawArc*) item )->m_ArcStart += offset;
|
||||||
( (LibDrawArc*) item )->m_ArcEnd += offset;
|
( (LibDrawArc*) item )->m_ArcEnd += offset;
|
||||||
break;
|
break;
|
||||||
|
@ -580,7 +558,7 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->m_Flags = item->m_Selected = 0;
|
item->m_Flags = item->m_Selected = 0;
|
||||||
|
@ -588,12 +566,10 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
/*
|
||||||
void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry )
|
* Delete marked items
|
||||||
/******************************************************/
|
|
||||||
|
|
||||||
/* Delete marked items
|
|
||||||
*/
|
*/
|
||||||
|
void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry )
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* item, * next_item;
|
LibEDA_BaseStruct* item, * next_item;
|
||||||
|
|
||||||
|
@ -606,17 +582,15 @@ void DeleteMarkedItems( EDA_LibComponentStruct* LibEntry )
|
||||||
next_item = item->Next();
|
next_item = item->Next();
|
||||||
if( item->m_Selected == 0 )
|
if( item->m_Selected == 0 )
|
||||||
continue;
|
continue;
|
||||||
DeleteOneLibraryDrawStruct( NULL, NULL, LibEntry, item, 0 );
|
LibEntry->RemoveDrawItem( item );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/*
|
||||||
void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
* Mirror marked items, refer to a Vertical axis at position offset
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
/* Mirror marked items, refer to a Vertical axis at position offset
|
|
||||||
*/
|
*/
|
||||||
|
void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
{
|
{
|
||||||
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
|
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
|
||||||
LibEDA_BaseStruct* item;
|
LibEDA_BaseStruct* item;
|
||||||
|
@ -658,7 +632,8 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
SETMIRROR( ( (LibDrawArc*) item )->m_Pos.x );
|
SETMIRROR( ( (LibDrawArc*) item )->m_Pos.x );
|
||||||
SETMIRROR( ( (LibDrawArc*) item )->m_ArcStart.x );
|
SETMIRROR( ( (LibDrawArc*) item )->m_ArcStart.x );
|
||||||
SETMIRROR( ( (LibDrawArc*) item )->m_ArcEnd.x );
|
SETMIRROR( ( (LibDrawArc*) item )->m_ArcEnd.x );
|
||||||
EXCHG( ( (LibDrawArc*) item )->m_ArcStart, ( (LibDrawArc*) item )->m_ArcEnd );
|
EXCHG( ( (LibDrawArc*) item )->m_ArcStart,
|
||||||
|
( (LibDrawArc*) item )->m_ArcEnd );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,7 +664,7 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
item->m_Flags = item->m_Selected = 0;
|
item->m_Flags = item->m_Selected = 0;
|
||||||
|
|
|
@ -42,7 +42,8 @@ bool LibDrawText::Save( FILE* ExportFile ) const
|
||||||
fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ", m_Orient,
|
fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ", m_Orient,
|
||||||
m_Pos.x, m_Pos.y, m_Size.x, m_Attributs, m_Unit, m_Convert,
|
m_Pos.x, m_Pos.y, m_Size.x, m_Attributs, m_Unit, m_Convert,
|
||||||
CONV_TO_UTF8( text ) );
|
CONV_TO_UTF8( text ) );
|
||||||
fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal", (m_Bold>0) ? 1 : 0 );
|
fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal",
|
||||||
|
( m_Bold>0 ) ? 1 : 0 );
|
||||||
|
|
||||||
char hjustify = 'C';
|
char hjustify = 'C';
|
||||||
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
||||||
|
@ -76,7 +77,8 @@ bool LibDrawText::Load( char* line, wxString& errorMsg )
|
||||||
|
|
||||||
cnt = sscanf( &line[2], "%d %d %d %d %d %d %d %s %s %d %c %c",
|
cnt = sscanf( &line[2], "%d %d %d %d %d %d %d %s %s %d %c %c",
|
||||||
&m_Orient, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Attributs,
|
&m_Orient, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Attributs,
|
||||||
&m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify, &vjustify );
|
&m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify,
|
||||||
|
&vjustify );
|
||||||
|
|
||||||
if( cnt < 8 )
|
if( cnt < 8 )
|
||||||
{
|
{
|
||||||
|
@ -149,7 +151,8 @@ bool LibDrawText::HitTest( const wxPoint& refPos )
|
||||||
* @param aThreshold = unused here (TextHitTest calculates its threshold )
|
* @param aThreshold = unused here (TextHitTest calculates its threshold )
|
||||||
* @param aTransMat = the transform matrix
|
* @param aTransMat = the transform matrix
|
||||||
*/
|
*/
|
||||||
bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] )
|
bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold,
|
||||||
|
const int aTransMat[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint physicalpos = TransformCoordinate( aTransMat, m_Pos );
|
wxPoint physicalpos = TransformCoordinate( aTransMat, m_Pos );
|
||||||
wxPoint tmp = m_Pos;
|
wxPoint tmp = m_Pos;
|
||||||
|
@ -229,6 +232,8 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
* transformation matrix causes xy axes to be flipped. */
|
* transformation matrix causes xy axes to be flipped. */
|
||||||
int t1 = ( aTransformMatrix[0][0] != 0 ) ^ ( m_Orient != 0 );
|
int t1 = ( aTransformMatrix[0][0] != 0 ) ^ ( m_Orient != 0 );
|
||||||
|
|
||||||
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text,
|
DrawGraphicText( aPanel, aDC, pos1, (EDA_Colors) color, m_Text,
|
||||||
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
|
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
|
||||||
m_Size, m_HJustify, m_VJustify,
|
m_Size, m_HJustify, m_VJustify,
|
||||||
|
|
|
@ -6,15 +6,14 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
|
#include "class_drawpanel.h"
|
||||||
|
#include "gr_basic.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#include <wx/tokenzr.h>
|
|
||||||
#include <wx/txtstrm.h>
|
|
||||||
|
|
||||||
|
|
||||||
int SortItemsFct(const void* ref, const void* item)
|
int SortItemsFct(const void* ref, const void* item)
|
||||||
{
|
{
|
||||||
|
@ -260,6 +259,136 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_LibComponentStruct::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
|
||||||
|
const wxPoint& offset, int multi,
|
||||||
|
int convert, int drawMode, int color,
|
||||||
|
const int transformMatrix[2][2],
|
||||||
|
bool showPinText, bool drawFields,
|
||||||
|
bool onlySelected )
|
||||||
|
{
|
||||||
|
wxString fieldText;
|
||||||
|
LibDrawField* Field;
|
||||||
|
LibEDA_BaseStruct* drawItem;
|
||||||
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
|
|
||||||
|
GRSetDrawMode( dc, drawMode );
|
||||||
|
|
||||||
|
for( drawItem = m_Drawings; drawItem != NULL; drawItem = drawItem->Next() )
|
||||||
|
{
|
||||||
|
if( onlySelected && drawItem->m_Selected == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Do not draw an item while moving (the cursor handler does that)
|
||||||
|
if( drawItem->m_Flags & IS_MOVED )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Do not draw items not attached to the current part */
|
||||||
|
if( multi && drawItem->m_Unit && ( drawItem->m_Unit != multi ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( convert && drawItem->m_Convert && ( drawItem->m_Convert != convert ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
|
||||||
|
if( drawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
|
||||||
|
{
|
||||||
|
drawItem->Draw( panel, dc, offset, color, drawMode, &showPinText,
|
||||||
|
transformMatrix );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool force_nofill =
|
||||||
|
( screen->m_IsPrinting
|
||||||
|
&& drawItem->m_Fill == FILLED_WITH_BG_BODYCOLOR
|
||||||
|
&& GetGRForceBlackPenState() );
|
||||||
|
|
||||||
|
drawItem->Draw( panel, dc, offset, color, drawMode,
|
||||||
|
(void*) force_nofill, transformMatrix );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( drawFields )
|
||||||
|
{
|
||||||
|
/* The reference designator field is a special case for naming
|
||||||
|
* convention.
|
||||||
|
*
|
||||||
|
* FIXME: This should be handled by the LibDrawField class.
|
||||||
|
*/
|
||||||
|
if( m_UnitCount > 1 )
|
||||||
|
{
|
||||||
|
#if defined(KICAD_GOST)
|
||||||
|
fieldText.Printf( wxT( "%s?.%c" ), (const wxChar*) m_Prefix.m_Text,
|
||||||
|
multi + '1' - 1 );
|
||||||
|
#else
|
||||||
|
fieldText.Printf( wxT( "%s?%c" ), (const wxChar*) m_Prefix.m_Text,
|
||||||
|
multi + 'A' - 1 );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fieldText = m_Prefix.m_Text + wxT( "?" );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Prefix.Draw( panel, dc, offset, color, drawMode, &fieldText,
|
||||||
|
transformMatrix );
|
||||||
|
m_Name.Draw( panel, dc, offset, color, drawMode, NULL, transformMatrix );
|
||||||
|
|
||||||
|
for( Field = m_Fields; Field != NULL; Field = Field->Next() )
|
||||||
|
{
|
||||||
|
Field->Draw( panel, dc, offset, color, drawMode, NULL,
|
||||||
|
transformMatrix );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int len = panel->GetScreen()->Unscale( 3 );
|
||||||
|
GRLine( &panel->m_ClipBox, dc, offset.x, offset.y - len, offset.x,
|
||||||
|
offset.y + len, 0, color );
|
||||||
|
GRLine( &panel->m_ClipBox, dc, offset.x - len, offset.y, offset.x + len,
|
||||||
|
offset.y, 0, color );
|
||||||
|
|
||||||
|
/* Enable this to draw the bounding box around the component to validate
|
||||||
|
* the bounding box calculations. */
|
||||||
|
#if 0
|
||||||
|
EDA_Rect bBox = LibEntry->GetBoundaryBox( Multi, convert );
|
||||||
|
GRRect( &panel->m_ClipBox, dc, bBox.GetOrigin().x, bBox.GetOrigin().y,
|
||||||
|
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_LibComponentStruct::RemoveDrawItem( LibEDA_BaseStruct* item,
|
||||||
|
WinEDA_DrawPanel* panel,
|
||||||
|
wxDC* dc )
|
||||||
|
{
|
||||||
|
wxASSERT( item != NULL );
|
||||||
|
|
||||||
|
LibEDA_BaseStruct* prevItem = m_Drawings;
|
||||||
|
|
||||||
|
if( dc != NULL )
|
||||||
|
item->Draw( panel, dc, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
|
||||||
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
|
if( m_Drawings == item )
|
||||||
|
{
|
||||||
|
m_Drawings = item->Next();
|
||||||
|
SAFE_DELETE( item );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( prevItem )
|
||||||
|
{
|
||||||
|
if( prevItem->Next() == item )
|
||||||
|
{
|
||||||
|
prevItem->SetNext( item->Next() );
|
||||||
|
SAFE_DELETE( item );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
prevItem = prevItem->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
|
|
@ -165,6 +165,40 @@ public:
|
||||||
* @param aFields - a std::vector <LibDrawField> to import.
|
* @param aFields - a std::vector <LibDrawField> to import.
|
||||||
*/
|
*/
|
||||||
void SetFields( const std::vector <LibDrawField> aFields );
|
void SetFields( const std::vector <LibDrawField> aFields );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw component.
|
||||||
|
*
|
||||||
|
* @param panel - Window to draw on.
|
||||||
|
* @param dc - Device context to draw on.
|
||||||
|
* @param offset - Position to component.
|
||||||
|
* @param multi - Component unit if multiple parts per component.
|
||||||
|
* @param convert - Component conversion (DeMorgan) if available.
|
||||||
|
* @param drawMode - Device context drawing mode, see wxDC.
|
||||||
|
* @param color - Color to draw component.
|
||||||
|
* @param transformMatrix - Cooridinate adjustment settings.
|
||||||
|
* @param showPinText - Show pin text if true.
|
||||||
|
* @param drawFields - Draw field text if true otherwise just draw
|
||||||
|
* body items.
|
||||||
|
* @param onlySelected - Draws only the body items that are selected.
|
||||||
|
* Used for block move redraws.
|
||||||
|
*/
|
||||||
|
void Draw( WinEDA_DrawPanel* panel, wxDC* dc, const wxPoint& offset,
|
||||||
|
int multi, int convert, int drawMode, int color = -1,
|
||||||
|
const int transformMatrix[2][2] = DefaultTransformMatrix,
|
||||||
|
bool showPinText = true, bool drawFields = true,
|
||||||
|
bool onlySelected = false );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove draw item from list.
|
||||||
|
*
|
||||||
|
* @param item - Draw item to remove from list.
|
||||||
|
* @param panel - Panel to remove part from.
|
||||||
|
* @param dc - Device context to remove part from.
|
||||||
|
*/
|
||||||
|
void RemoveDrawItem( LibEDA_BaseStruct* item,
|
||||||
|
WinEDA_DrawPanel* panel = NULL,
|
||||||
|
wxDC* dc = NULL );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -234,10 +234,9 @@ parameter <%c> is not valid" ),
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawField::GetPenSize( )
|
int LibDrawField::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,20 +248,24 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aOffset, int aColor, int aDrawMode,
|
const wxPoint& aOffset, int aColor, int aDrawMode,
|
||||||
void* aData, const int aTransformMatrix[2][2] )
|
void* aData, const int aTransformMatrix[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint text_pos;
|
wxPoint text_pos;
|
||||||
|
int color;
|
||||||
|
int linewidth = GetPenSize();
|
||||||
|
|
||||||
int color = aColor;
|
|
||||||
int linewidth = GetPenSize( );
|
|
||||||
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
||||||
|
|
||||||
|
if( ( m_Attributs & TEXT_NO_VISIBLE ) && ( aColor < 0 ) )
|
||||||
if( aColor < 0 ) // Used normal color or selected color
|
|
||||||
{
|
{
|
||||||
if( (m_Selected & IS_SELECTED) )
|
color = g_InvisibleItemColor;
|
||||||
color = g_ItemSelectetColor;
|
}
|
||||||
|
else if( ( m_Selected & IS_SELECTED ) && ( aColor < 0 ) )
|
||||||
|
{
|
||||||
|
color = g_ItemSelectetColor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
color = aColor;
|
color = aColor;
|
||||||
|
}
|
||||||
|
|
||||||
if( color < 0 )
|
if( color < 0 )
|
||||||
{
|
{
|
||||||
|
@ -281,13 +284,14 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text_pos = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
|
||||||
|
|
||||||
wxString* text = aData ? (wxString*) aData : &m_Text;
|
text_pos = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
||||||
|
wxString* text = aData ? (wxString*)aData : &m_Text;
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
DrawGraphicText( aPanel, aDC, text_pos, (EDA_Colors) color, text->GetData(),
|
DrawGraphicText( aPanel, aDC, text_pos, (EDA_Colors) color, *text,
|
||||||
m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
||||||
m_Size, m_HJustify, m_VJustify, linewidth, m_Italic, m_Bold );
|
m_Size, m_HJustify, m_VJustify, linewidth, m_Italic,
|
||||||
|
m_Bold );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -189,8 +189,8 @@ void LibraryStruct::RemoveEntry( LibCmpEntry* entry )
|
||||||
/* Remove alias name from the root component alias list */
|
/* Remove alias name from the root component alias list */
|
||||||
if( Root == NULL )
|
if( Root == NULL )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxT( "No root component found for alias <%s> in " \
|
wxLogWarning( wxT( "No root component found for alias <%s> in \
|
||||||
"library <%s>." ),
|
library <%s>." ),
|
||||||
( const wxChar* ) entry->m_Name.m_Text,
|
( const wxChar* ) entry->m_Name.m_Text,
|
||||||
( const wxChar* ) m_Name );
|
( const wxChar* ) m_Name );
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ LibDrawPin::LibDrawPin(EDA_LibComponentStruct * aParent) :
|
||||||
m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */
|
m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */
|
||||||
m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */
|
m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */
|
||||||
m_Attributs = 0; /* bit 0 != 0: pin invisible */
|
m_Attributs = 0; /* bit 0 != 0: pin invisible */
|
||||||
m_PinNum = 0; /*pin number ( i.e. 4 codes Ascii ) */
|
m_PinNum = 0; /*pin number ( i.e. 4 codes ASCII ) */
|
||||||
m_PinNumSize = 50;
|
m_PinNumSize = 50;
|
||||||
m_PinNameSize = 50; /* Default size for pin name and num */
|
m_PinNameSize = 50; /* Default size for pin name and num */
|
||||||
m_Width = 0;
|
m_Width = 0;
|
||||||
|
@ -236,7 +236,7 @@ bool LibDrawPin::Load( char* line, wxString& errorMsg )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( i == 12 ) /* Special Symbole defined */
|
if( i == 12 ) /* Special Symbol defined */
|
||||||
{
|
{
|
||||||
for( j = strlen( pinAttrs ); j > 0; )
|
for( j = strlen( pinAttrs ); j > 0; )
|
||||||
{
|
{
|
||||||
|
@ -280,10 +280,9 @@ bool LibDrawPin::Load( char* line, wxString& errorMsg )
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawPin::GetPenSize( )
|
int LibDrawPin::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,11 +307,14 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_LibComponentStruct* Entry = ( (DrawPinPrms*) aData )->m_Entry;
|
EDA_LibComponentStruct* Entry = GetParent();
|
||||||
bool DrawPinText = ( (DrawPinPrms*) aData )->m_DrawPinText;
|
bool DrawPinText = true;
|
||||||
|
|
||||||
|
if( ( aData != NULL ) && ( (bool*) aData == false ) )
|
||||||
|
DrawPinText = false;
|
||||||
|
|
||||||
/* Calculate pin orient taking in account the component orientation. */
|
/* Calculate pin orient taking in account the component orientation. */
|
||||||
int orient = ReturnPinDrawOrient( aTransformMatrix );
|
int orient = ReturnPinDrawOrient( aTransformMatrix );
|
||||||
|
|
||||||
/* Calculate the pin position */
|
/* Calculate the pin position */
|
||||||
wxPoint pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
wxPoint pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
||||||
|
@ -322,8 +324,7 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
|
||||||
|
|
||||||
if( DrawPinText )
|
if( DrawPinText )
|
||||||
{
|
{
|
||||||
DrawPinTexts( aPanel, aDC, pos1, orient,
|
DrawPinTexts( aPanel, aDC, pos1, orient, Entry->m_TextInside,
|
||||||
Entry->m_TextInside,
|
|
||||||
Entry->m_DrawPinNum, Entry->m_DrawPinName,
|
Entry->m_DrawPinNum, Entry->m_DrawPinName,
|
||||||
aColor, aDrawMode );
|
aColor, aDrawMode );
|
||||||
}
|
}
|
||||||
|
@ -943,7 +944,7 @@ int LibDrawPin::ReturnPinDrawOrient( const int TransMat[2][2] )
|
||||||
end.x = 1; break;
|
end.x = 1; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
end = TransformCoordinate( TransMat, end ); // = pos of end point, accordint to the component orientation
|
end = TransformCoordinate( TransMat, end ); // = pos of end point, according to the component orientation
|
||||||
orient = PIN_UP;
|
orient = PIN_UP;
|
||||||
if( end.x == 0 )
|
if( end.x == 0 )
|
||||||
{
|
{
|
||||||
|
@ -1044,7 +1045,7 @@ LibEDA_BaseStruct* LibDrawPin::DoGenCopy()
|
||||||
|
|
||||||
|
|
||||||
/** Function LibDrawPin::DisplayInfo
|
/** Function LibDrawPin::DisplayInfo
|
||||||
* Displays info (pin num and name, otientation ...
|
* Displays info (pin num and name, orientation ...
|
||||||
* on the Info window
|
* on the Info window
|
||||||
*/
|
*/
|
||||||
void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame )
|
void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
|
|
|
@ -64,54 +64,8 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int Multi, int convert, int DrawMode,
|
int Multi, int convert, int DrawMode,
|
||||||
int Color, bool DrawPinText )
|
int Color, bool DrawPinText )
|
||||||
{
|
{
|
||||||
wxPoint pos1, pos2;
|
Entry->Draw( panel, DC, Pos, Multi, convert, DrawMode, Color, TransMat,
|
||||||
bool force_nofill;
|
DrawPinText, false );
|
||||||
LibEDA_BaseStruct* DEntry;
|
|
||||||
BASE_SCREEN* screen = panel->GetScreen();
|
|
||||||
|
|
||||||
if( Entry->m_Drawings == NULL )
|
|
||||||
return;
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
for( DEntry = Entry->m_Drawings; DEntry != NULL; DEntry = DEntry->Next() )
|
|
||||||
{
|
|
||||||
/* Do not draw items not attached to the current part */
|
|
||||||
if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Do not draw an item while moving (the cursor handler does that)
|
|
||||||
if( DEntry->m_Flags & IS_MOVED )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
force_nofill = false;
|
|
||||||
|
|
||||||
switch( DEntry->Type() )
|
|
||||||
{
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
DrawPinPrms prms( Entry, DrawPinText );
|
|
||||||
DEntry->Draw( panel, DC, Pos, Color, DrawMode, &prms, TransMat );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
default:
|
|
||||||
if( screen->m_IsPrinting
|
|
||||||
&& DEntry->m_Fill == FILLED_WITH_BG_BODYCOLOR
|
|
||||||
&& GetGRForceBlackPenState() )
|
|
||||||
force_nofill = true;
|
|
||||||
DEntry->Draw( panel, DC, Pos, Color, DrawMode, (void*) force_nofill,
|
|
||||||
TransMat );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( g_DebugLevel > 4 ) /* Draw the component boundary box */
|
if( g_DebugLevel > 4 ) /* Draw the component boundary box */
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,19 +18,19 @@
|
||||||
|
|
||||||
static int fill_tab[3] = { 'N', 'F', 'f' };
|
static int fill_tab[3] = { 'N', 'F', 'f' };
|
||||||
|
|
||||||
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
|
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
|
||||||
|
|
||||||
|
|
||||||
/* Base class (abstract) for components bodies items */
|
/* Base class (abstract) for components bodies items */
|
||||||
LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type, EDA_LibComponentStruct* aParent ) :
|
LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type,
|
||||||
|
EDA_LibComponentStruct* aParent ) :
|
||||||
EDA_BaseStruct( struct_type )
|
EDA_BaseStruct( struct_type )
|
||||||
{
|
{
|
||||||
m_Unit = 0; /* Unit identification (for multi part per package)
|
m_Unit = 0; /* Unit identification (for multi part per package)
|
||||||
* 0 if the item is common to all units */
|
* 0 if the item is common to all units */
|
||||||
m_Convert = 0; /* Shape identification (for parts which have a convert
|
m_Convert = 0; /* Shape identification (for parts which have a convert
|
||||||
* shape) 0 if the item is common to all shapes */
|
* shape) 0 if the item is common to all shapes */
|
||||||
m_Fill = NO_FILL;
|
m_Fill = NO_FILL;
|
||||||
|
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
m_typeName = _( "Undefined" );
|
m_typeName = _( "Undefined" );
|
||||||
}
|
}
|
||||||
|
@ -183,10 +183,12 @@ bool LibDrawArc::HitTest( const wxPoint& aRefPoint )
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
* @return true if the point aPosRef is near this object
|
* @return true if the point aPosRef is near this object
|
||||||
* @param aRefPoint = a wxPoint to test
|
* @param aRefPoint = a wxPoint to test
|
||||||
* @param aThreshold = max distance to this object (usually the half thickness of a line)
|
* @param aThreshold = max distance to this object (usually the half thickness
|
||||||
|
* of a line)
|
||||||
* @param aTransMat = the transform matrix
|
* @param aTransMat = the transform matrix
|
||||||
*/
|
*/
|
||||||
bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat[2][2] )
|
bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold,
|
||||||
|
const int aTransMat[2][2] )
|
||||||
{
|
{
|
||||||
// TODO: use aTransMat to calculmates parameters
|
// TODO: use aTransMat to calculmates parameters
|
||||||
wxPoint relpos = aRefPoint;
|
wxPoint relpos = aRefPoint;
|
||||||
|
@ -200,10 +202,12 @@ bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat
|
||||||
if( abs( dist - m_Rayon ) > aThreshold )
|
if( abs( dist - m_Rayon ) > aThreshold )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// We are on the circle, ensure we are only on the arc, i.e. between m_ArcStart and m_ArcEnd
|
// We are on the circle, ensure we are only on the arc, i.e. between
|
||||||
|
// m_ArcStart and m_ArcEnd
|
||||||
int astart = t1; // arc starting point ( in 0.1 degree)
|
int astart = t1; // arc starting point ( in 0.1 degree)
|
||||||
int aend = t2; // arc ending point ( in 0.1 degree)
|
int aend = t2; // arc ending point ( in 0.1 degree)
|
||||||
int atest = wxRound( atan2( (double) relpos.y, (double) relpos.x ) * 1800.0 / M_PI );
|
int atest = wxRound( atan2( (double) relpos.y,
|
||||||
|
(double) relpos.x ) * 1800.0 / M_PI );
|
||||||
NORMALIZE_ANGLE_180( atest );
|
NORMALIZE_ANGLE_180( atest );
|
||||||
NORMALIZE_ANGLE_180( astart );
|
NORMALIZE_ANGLE_180( astart );
|
||||||
NORMALIZE_ANGLE_180( aend );
|
NORMALIZE_ANGLE_180( aend );
|
||||||
|
@ -226,13 +230,14 @@ LibEDA_BaseStruct* LibDrawArc::DoGenCopy()
|
||||||
newitem->m_ArcStart = m_ArcStart;
|
newitem->m_ArcStart = m_ArcStart;
|
||||||
newitem->m_ArcEnd = m_ArcEnd;
|
newitem->m_ArcEnd = m_ArcEnd;
|
||||||
newitem->m_Rayon = m_Rayon;
|
newitem->m_Rayon = m_Rayon;
|
||||||
newitem->t1 = t1;
|
newitem->t1 = t1;
|
||||||
newitem->t2 = t2;
|
newitem->t2 = t2;
|
||||||
newitem->m_Width = m_Width;
|
newitem->m_Width = m_Width;
|
||||||
newitem->m_Unit = m_Unit;
|
newitem->m_Unit = m_Unit;
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
newitem->m_Flags = m_Flags;
|
newitem->m_Flags = m_Flags;
|
||||||
newitem->m_Fill = m_Fill;
|
newitem->m_Fill = m_Fill;
|
||||||
|
|
||||||
return (LibEDA_BaseStruct*) newitem;
|
return (LibEDA_BaseStruct*) newitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,10 +245,9 @@ LibEDA_BaseStruct* LibDrawArc::DoGenCopy()
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawArc::GetPenSize( )
|
int LibDrawArc::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -254,11 +258,11 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
{
|
{
|
||||||
wxPoint pos1, pos2, posc;
|
wxPoint pos1, pos2, posc;
|
||||||
|
|
||||||
int color = ReturnLayerColor( LAYER_DEVICE );
|
int color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
|
|
||||||
if( aColor < 0 ) // Used normal color or selected color
|
if( aColor < 0 ) // Used normal color or selected color
|
||||||
{
|
{
|
||||||
if( (m_Selected & IS_SELECTED) )
|
if( ( m_Selected & IS_SELECTED ) )
|
||||||
color = g_ItemSelectetColor;
|
color = g_ItemSelectetColor;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -284,8 +288,8 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
||||||
m_Rayon, GetPenSize( ), color,
|
m_Rayon, GetPenSize( ), color,
|
||||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
else if( fill == FILLED_SHAPE && !aData )
|
else if( fill == FILLED_SHAPE && !aData )
|
||||||
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
||||||
m_Rayon, color, color );
|
m_Rayon, color, color );
|
||||||
|
@ -295,12 +299,10 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
||||||
m_Rayon, GetPenSize( ), color );
|
m_Rayon, GetPenSize( ), color );
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
||||||
posc.x, posc.y, GetPenSize( ), color );
|
posc.x, posc.y, GetPenSize( ), color );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,9 +327,8 @@ EDA_Rect LibDrawArc::GetBoundingBox()
|
||||||
if( ( normStart == nullPoint ) || ( normEnd == nullPoint )
|
if( ( normStart == nullPoint ) || ( normEnd == nullPoint )
|
||||||
|| ( m_Rayon == 0 ) )
|
|| ( m_Rayon == 0 ) )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT(
|
wxLogDebug( wxT("Invalid arc drawing definition, center(%d, %d) \
|
||||||
"Invalid arc drawing definition, center(%d, %d) \
|
start(%d, %d), end(%d, %d), radius %d" ),
|
||||||
start(%d, %d), end(%d, %d), radius %d" ),
|
|
||||||
m_Pos.x, m_Pos.y, m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
|
m_Pos.x, m_Pos.y, m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
|
||||||
m_ArcEnd.y, m_Rayon );
|
m_ArcEnd.y, m_Rayon );
|
||||||
return rect;
|
return rect;
|
||||||
|
@ -469,7 +470,8 @@ bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMa
|
||||||
wxPoint relpos = aPosRef - TransformCoordinate( aTransMat, m_Pos );
|
wxPoint relpos = aPosRef - TransformCoordinate( aTransMat, m_Pos );
|
||||||
|
|
||||||
int dist =
|
int dist =
|
||||||
wxRound( sqrt( ( (double) relpos.x * relpos.x ) + ( (double) relpos.y * relpos.y ) ) );
|
wxRound( sqrt( ( (double) relpos.x * relpos.x ) +
|
||||||
|
( (double) relpos.y * relpos.y ) ) );
|
||||||
|
|
||||||
if( abs( dist - m_Rayon ) <= aThreshold )
|
if( abs( dist - m_Rayon ) <= aThreshold )
|
||||||
return true;
|
return true;
|
||||||
|
@ -488,6 +490,7 @@ LibEDA_BaseStruct* LibDrawCircle::DoGenCopy()
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
newitem->m_Flags = m_Flags;
|
newitem->m_Flags = m_Flags;
|
||||||
newitem->m_Fill = m_Fill;
|
newitem->m_Fill = m_Fill;
|
||||||
|
|
||||||
return (LibEDA_BaseStruct*) newitem;
|
return (LibEDA_BaseStruct*) newitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,10 +498,9 @@ LibEDA_BaseStruct* LibDrawCircle::DoGenCopy()
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawCircle::GetPenSize( )
|
int LibDrawCircle::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -508,7 +510,7 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
{
|
{
|
||||||
wxPoint pos1;
|
wxPoint pos1;
|
||||||
|
|
||||||
int color = ReturnLayerColor( LAYER_DEVICE );
|
int color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
|
|
||||||
if( aColor < 0 ) // Used normal color or selected color
|
if( aColor < 0 ) // Used normal color or selected color
|
||||||
{
|
{
|
||||||
|
@ -527,8 +529,8 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
||||||
m_Rayon, GetPenSize( ), color,
|
m_Rayon, GetPenSize( ), color,
|
||||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
else if( fill == FILLED_SHAPE )
|
else if( fill == FILLED_SHAPE )
|
||||||
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
||||||
m_Rayon, 0, color, color );
|
m_Rayon, 0, color, color );
|
||||||
|
@ -630,6 +632,7 @@ LibEDA_BaseStruct* LibDrawSquare::DoGenCopy()
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
newitem->m_Flags = m_Flags;
|
newitem->m_Flags = m_Flags;
|
||||||
newitem->m_Fill = m_Fill;
|
newitem->m_Fill = m_Fill;
|
||||||
|
|
||||||
return (LibEDA_BaseStruct*) newitem;
|
return (LibEDA_BaseStruct*) newitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,10 +640,9 @@ LibEDA_BaseStruct* LibDrawSquare::DoGenCopy()
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawSquare::GetPenSize( )
|
int LibDrawSquare::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
@ -649,7 +651,7 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
{
|
{
|
||||||
wxPoint pos1, pos2;
|
wxPoint pos1, pos2;
|
||||||
|
|
||||||
int color = ReturnLayerColor( LAYER_DEVICE );
|
int color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
|
|
||||||
if( aColor < 0 ) // Used normal color or selected color
|
if( aColor < 0 ) // Used normal color or selected color
|
||||||
{
|
{
|
||||||
|
@ -666,10 +668,12 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
if( aColor >= 0 )
|
if( aColor >= 0 )
|
||||||
fill = NO_FILL;
|
fill = NO_FILL;
|
||||||
|
|
||||||
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
|
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
|
||||||
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
||||||
GetPenSize( ), color,
|
GetPenSize( ), color,
|
||||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
else if( m_Fill == FILLED_SHAPE && !aData )
|
else if( m_Fill == FILLED_SHAPE && !aData )
|
||||||
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
||||||
GetPenSize( ), color, color );
|
GetPenSize( ), color, color );
|
||||||
|
@ -724,10 +728,12 @@ bool LibDrawSquare::HitTest( const wxPoint& aRefPoint )
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
* @return true if the point aPosRef is near this object
|
* @return true if the point aPosRef is near this object
|
||||||
* @param aRefPoint = a wxPoint to test
|
* @param aRefPoint = a wxPoint to test
|
||||||
* @param aThreshold = max distance to this object (usually the half thickness of a line)
|
* @param aThreshold = max distance to this object (usually the half thickness
|
||||||
|
* of a line)
|
||||||
* @param aTransMat = the transform matrix
|
* @param aTransMat = the transform matrix
|
||||||
*/
|
*/
|
||||||
bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold, const int aTransMat[2][2] )
|
bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold,
|
||||||
|
const int aTransMat[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint actualStart = TransformCoordinate( aTransMat, m_Pos );
|
wxPoint actualStart = TransformCoordinate( aTransMat, m_Pos );
|
||||||
wxPoint actualEnd = TransformCoordinate( aTransMat, m_End );
|
wxPoint actualEnd = TransformCoordinate( aTransMat, m_End );
|
||||||
|
@ -798,6 +804,7 @@ LibEDA_BaseStruct* LibDrawSegment::DoGenCopy()
|
||||||
newitem->m_Unit = m_Unit;
|
newitem->m_Unit = m_Unit;
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
newitem->m_Flags = m_Flags;
|
newitem->m_Flags = m_Flags;
|
||||||
|
|
||||||
return (LibEDA_BaseStruct*) newitem;
|
return (LibEDA_BaseStruct*) newitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,10 +812,9 @@ LibEDA_BaseStruct* LibDrawSegment::DoGenCopy()
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawSegment::GetPenSize( )
|
int LibDrawSegment::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
@ -817,7 +823,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
{
|
{
|
||||||
wxPoint pos1, pos2;
|
wxPoint pos1, pos2;
|
||||||
|
|
||||||
int color = ReturnLayerColor( LAYER_DEVICE );
|
int color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
|
|
||||||
if( aColor < 0 ) // Used normal color or selected color
|
if( aColor < 0 ) // Used normal color or selected color
|
||||||
{
|
{
|
||||||
|
@ -830,6 +836,8 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
||||||
pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset;
|
pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset;
|
||||||
|
|
||||||
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
||||||
GetPenSize( ), color );
|
GetPenSize( ), color );
|
||||||
}
|
}
|
||||||
|
@ -875,10 +883,12 @@ bool LibDrawSegment::HitTest( const wxPoint& aPosRef )
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
* @return true if the point aPosRef is near this object
|
* @return true if the point aPosRef is near this object
|
||||||
* @param aPosRef = a wxPoint to test
|
* @param aPosRef = a wxPoint to test
|
||||||
* @param aThreshold = max distance to this object (usually the half thickness of a line)
|
* @param aThreshold = max distance to this object (usually the half
|
||||||
|
* thickness of a line)
|
||||||
* @param aTransMat = the transform matrix
|
* @param aTransMat = the transform matrix
|
||||||
*/
|
*/
|
||||||
bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] )
|
bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold,
|
||||||
|
const int aTransMat[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint start = TransformCoordinate( aTransMat, m_Pos );
|
wxPoint start = TransformCoordinate( aTransMat, m_Pos );
|
||||||
wxPoint end = TransformCoordinate( aTransMat, m_End );
|
wxPoint end = TransformCoordinate( aTransMat, m_End );
|
||||||
|
@ -981,11 +991,12 @@ LibEDA_BaseStruct* LibDrawPolyline::DoGenCopy()
|
||||||
LibDrawPolyline* newitem = new LibDrawPolyline( GetParent() );
|
LibDrawPolyline* newitem = new LibDrawPolyline( GetParent() );
|
||||||
|
|
||||||
newitem->m_PolyPoints = m_PolyPoints; // Vector copy
|
newitem->m_PolyPoints = m_PolyPoints; // Vector copy
|
||||||
newitem->m_Width = m_Width;
|
newitem->m_Width = m_Width;
|
||||||
newitem->m_Unit = m_Unit;
|
newitem->m_Unit = m_Unit;
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
newitem->m_Flags = m_Flags;
|
newitem->m_Flags = m_Flags;
|
||||||
newitem->m_Fill = m_Fill;
|
newitem->m_Fill = m_Fill;
|
||||||
|
|
||||||
return (LibEDA_BaseStruct*) newitem;
|
return (LibEDA_BaseStruct*) newitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,10 +1010,9 @@ void LibDrawPolyline::AddPoint( const wxPoint& point )
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawPolyline::GetPenSize( )
|
int LibDrawPolyline::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
@ -1010,8 +1020,7 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
void* aData, const int aTransformMatrix[2][2] )
|
void* aData, const int aTransformMatrix[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint pos1;
|
wxPoint pos1;
|
||||||
|
int color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
int color = ReturnLayerColor( LAYER_DEVICE );
|
|
||||||
|
|
||||||
// Buffer used to store current corners coordinates for drawings
|
// Buffer used to store current corners coordinates for drawings
|
||||||
static wxPoint* Buf_Poly_Drawings = NULL;
|
static wxPoint* Buf_Poly_Drawings = NULL;
|
||||||
|
@ -1050,10 +1059,12 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
if( aColor >= 0 )
|
if( aColor >= 0 )
|
||||||
fill = NO_FILL;
|
fill = NO_FILL;
|
||||||
|
|
||||||
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
||||||
Buf_Poly_Drawings, 1, GetPenSize( ), color,
|
Buf_Poly_Drawings, 1, GetPenSize( ), color,
|
||||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
else if( fill == FILLED_SHAPE )
|
else if( fill == FILLED_SHAPE )
|
||||||
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
||||||
Buf_Poly_Drawings, 1, GetPenSize( ), color, color );
|
Buf_Poly_Drawings, 1, GetPenSize( ), color, color );
|
||||||
|
@ -1169,7 +1180,8 @@ bool LibDrawBezier::Save( FILE* ExportFile ) const
|
||||||
|
|
||||||
for( unsigned i = 0; i < GetCornerCount(); i++ )
|
for( unsigned i = 0; i < GetCornerCount(); i++ )
|
||||||
{
|
{
|
||||||
fprintf( ExportFile, " %d %d", m_BezierPoints[i].x, m_BezierPoints[i].y );
|
fprintf( ExportFile, " %d %d", m_BezierPoints[i].x,
|
||||||
|
m_BezierPoints[i].y );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( ExportFile, " %c\n", fill_tab[m_Fill] );
|
fprintf( ExportFile, " %c\n", fill_tab[m_Fill] );
|
||||||
|
@ -1185,17 +1197,18 @@ bool LibDrawBezier::Load( char* line, wxString& errorMsg )
|
||||||
wxPoint pt;
|
wxPoint pt;
|
||||||
|
|
||||||
i = sscanf( &line[2], "%d %d %d %d", &ccount, &m_Unit, &m_Convert,
|
i = sscanf( &line[2], "%d %d %d %d", &ccount, &m_Unit, &m_Convert,
|
||||||
&m_Width );
|
&m_Width );
|
||||||
|
|
||||||
if( i !=4 )
|
if( i !=4 )
|
||||||
{
|
{
|
||||||
errorMsg.Printf( _( "Bezier only had %d parameters of the required 4" ), i );
|
errorMsg.Printf( _( "Bezier only had %d parameters of the required 4" ),
|
||||||
|
i );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if( ccount <= 0 )
|
if( ccount <= 0 )
|
||||||
{
|
{
|
||||||
errorMsg.Printf( _( "Bezier count parameter %d is invalid" ),
|
errorMsg.Printf( _( "Bezier count parameter %d is invalid" ),
|
||||||
ccount );
|
ccount );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1210,15 +1223,13 @@ bool LibDrawBezier::Load( char* line, wxString& errorMsg )
|
||||||
p = strtok( NULL, " \t\n" );
|
p = strtok( NULL, " \t\n" );
|
||||||
if( sscanf( p, "%d", &pt.x ) != 1 )
|
if( sscanf( p, "%d", &pt.x ) != 1 )
|
||||||
{
|
{
|
||||||
errorMsg.Printf( _( "Bezier point %d X position not defined" ),
|
errorMsg.Printf( _( "Bezier point %d X position not defined" ), i );
|
||||||
i );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
p = strtok( NULL, " \t\n" );
|
p = strtok( NULL, " \t\n" );
|
||||||
if( sscanf( p, "%d", &pt.y ) != 1 )
|
if( sscanf( p, "%d", &pt.y ) != 1 )
|
||||||
{
|
{
|
||||||
errorMsg.Printf( _( "Bezier point %d Y position not defined" ),
|
errorMsg.Printf( _( "Bezier point %d Y position not defined" ), i );
|
||||||
i );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_BezierPoints.push_back( pt );
|
m_BezierPoints.push_back( pt );
|
||||||
|
@ -1254,29 +1265,30 @@ LibEDA_BaseStruct* LibDrawBezier::DoGenCopy()
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int LibDrawBezier::GetPenSize( )
|
int LibDrawBezier::GetPenSize()
|
||||||
{
|
{
|
||||||
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width;
|
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
|
||||||
return pensize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aOffset, int aColor, int aDrawMode,
|
const wxPoint& aOffset, int aColor, int aDrawMode,
|
||||||
void* aData, const int aTransformMatrix[2][2] )
|
void* aData, const int aTransformMatrix[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint pos1;
|
wxPoint pos1;
|
||||||
std::vector<wxPoint> PolyPointsTraslated;
|
std::vector<wxPoint> PolyPointsTraslated;
|
||||||
|
|
||||||
int color = ReturnLayerColor( LAYER_DEVICE );
|
int color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
|
|
||||||
m_PolyPoints = Bezier2Poly( m_BezierPoints[0] ,
|
m_PolyPoints = Bezier2Poly( m_BezierPoints[0],
|
||||||
m_BezierPoints[1] ,
|
m_BezierPoints[1],
|
||||||
m_BezierPoints[2] ,
|
m_BezierPoints[2],
|
||||||
m_BezierPoints[3]);
|
m_BezierPoints[3] );
|
||||||
|
|
||||||
PolyPointsTraslated.clear();
|
PolyPointsTraslated.clear();
|
||||||
for( unsigned int i = 0; i < m_PolyPoints.size() ; i++)
|
|
||||||
PolyPointsTraslated.push_back( TransformCoordinate( aTransformMatrix, m_PolyPoints[i] ) + aOffset);
|
for( unsigned int i = 0; i < m_PolyPoints.size() ; i++ )
|
||||||
|
PolyPointsTraslated.push_back(
|
||||||
|
TransformCoordinate( aTransformMatrix, m_PolyPoints[i] ) + aOffset );
|
||||||
|
|
||||||
if( aColor < 0 ) // Used normal color or selected color
|
if( aColor < 0 ) // Used normal color or selected color
|
||||||
{
|
{
|
||||||
|
@ -1290,16 +1302,18 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
if( aColor >= 0 )
|
if( aColor >= 0 )
|
||||||
fill = NO_FILL;
|
fill = NO_FILL;
|
||||||
|
|
||||||
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
||||||
&PolyPointsTraslated[0], 1, GetPenSize( ), color,
|
&PolyPointsTraslated[0], 1, GetPenSize(), color,
|
||||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
else if( fill == FILLED_SHAPE )
|
else if( fill == FILLED_SHAPE )
|
||||||
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
||||||
&PolyPointsTraslated[0], 1, GetPenSize( ), color, color );
|
&PolyPointsTraslated[0], 1, GetPenSize(), color, color );
|
||||||
else
|
else
|
||||||
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
GRPoly( &aPanel->m_ClipBox, aDC, m_PolyPoints.size(),
|
||||||
&PolyPointsTraslated[0], 0, GetPenSize( ), color, color );
|
&PolyPointsTraslated[0], 0, GetPenSize(), color, color );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1326,7 +1340,7 @@ bool LibDrawBezier::HitTest( const wxPoint& aRefPos )
|
||||||
* @param aTransMat = the transform matrix
|
* @param aTransMat = the transform matrix
|
||||||
*/
|
*/
|
||||||
bool LibDrawBezier::HitTest( wxPoint aPosRef, int aThreshold,
|
bool LibDrawBezier::HitTest( wxPoint aPosRef, int aThreshold,
|
||||||
const int aTransMat[2][2] )
|
const int aTransMat[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint ref, start, end;
|
wxPoint ref, start, end;
|
||||||
|
|
||||||
|
@ -1334,6 +1348,7 @@ bool LibDrawBezier::HitTest( wxPoint aPosRef, int aThreshold,
|
||||||
{
|
{
|
||||||
start = TransformCoordinate( aTransMat, m_PolyPoints[ii - 1] );
|
start = TransformCoordinate( aTransMat, m_PolyPoints[ii - 1] );
|
||||||
end = TransformCoordinate( aTransMat, m_PolyPoints[ii] );
|
end = TransformCoordinate( aTransMat, m_PolyPoints[ii] );
|
||||||
|
|
||||||
if ( TestSegmentHit( aPosRef, start, end, aThreshold ) )
|
if ( TestSegmentHit( aPosRef, start, end, aThreshold ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1349,8 +1364,10 @@ EDA_Rect LibDrawBezier::GetBoundingBox()
|
||||||
{
|
{
|
||||||
EDA_Rect rect;
|
EDA_Rect rect;
|
||||||
int xmin, xmax, ymin, ymax;
|
int xmin, xmax, ymin, ymax;
|
||||||
if(!GetCornerCount())
|
|
||||||
return rect;
|
if( !GetCornerCount() )
|
||||||
|
return rect;
|
||||||
|
|
||||||
xmin = xmax = m_PolyPoints[0].x;
|
xmin = xmax = m_PolyPoints[0].x;
|
||||||
ymin = ymax = m_PolyPoints[0].y;
|
ymin = ymax = m_PolyPoints[0].y;
|
||||||
|
|
||||||
|
@ -1378,12 +1395,12 @@ void LibDrawBezier::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
LibEDA_BaseStruct::DisplayInfo( frame );
|
LibEDA_BaseStruct::DisplayInfo( frame );
|
||||||
|
|
||||||
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
|
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
|
||||||
EESCHEMA_INTERNAL_UNIT, true );
|
EESCHEMA_INTERNAL_UNIT, true );
|
||||||
|
|
||||||
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE );
|
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE );
|
||||||
|
|
||||||
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
|
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
|
||||||
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
|
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
|
||||||
|
|
||||||
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Bounding box" ), msg, BROWN );
|
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Bounding box" ), msg, BROWN );
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,19 +77,6 @@ enum DrawPinOrient {
|
||||||
PIN_DOWN = 'D',
|
PIN_DOWN = 'D',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Struct to pass parameters for drawing pins, in function Draw
|
|
||||||
class DrawPinPrms
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EDA_LibComponentStruct* m_Entry; // Pointer to the component in lib
|
|
||||||
bool m_DrawPinText; // Are pin texts drawn ?
|
|
||||||
|
|
||||||
DrawPinPrms( EDA_LibComponentStruct* entry, bool drawpintext = true )
|
|
||||||
{
|
|
||||||
m_Entry = entry;
|
|
||||||
m_DrawPinText = drawpintext;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* Classes for handle the body items of a component: pins add graphic items */
|
/* Classes for handle the body items of a component: pins add graphic items */
|
||||||
|
@ -103,11 +90,11 @@ public:
|
||||||
class LibEDA_BaseStruct : public EDA_BaseStruct
|
class LibEDA_BaseStruct : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Unit; /* Unit identification (for multi part per package)
|
int m_Unit; /* Unit identification (for multi part per package)
|
||||||
* 0 if the item is common to all units */
|
* 0 if the item is common to all units */
|
||||||
int m_Convert; /* Shape identification (for parts which have a convert
|
int m_Convert; /* Shape identification (for parts which have a convert
|
||||||
* shape) 0 if the item is common to all shapes */
|
* shape) 0 if the item is common to all shapes */
|
||||||
FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR.
|
FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR.
|
||||||
* has meaning only for some items */
|
* has meaning only for some items */
|
||||||
wxString m_typeName; /* Name of object displayed in the message panel. */
|
wxString m_typeName; /* Name of object displayed in the message panel. */
|
||||||
|
|
||||||
|
@ -227,11 +214,11 @@ public:
|
||||||
|
|
||||||
/* (Currently Unused) Pin num and Pin name text options: italic/normal
|
/* (Currently Unused) Pin num and Pin name text options: italic/normal
|
||||||
* /bold, 0 = default */
|
* /bold, 0 = default */
|
||||||
char m_PinNumShapeOpt;
|
char m_PinNumShapeOpt;
|
||||||
char m_PinNameShapeOpt;
|
char m_PinNameShapeOpt;
|
||||||
// (Currently Unused) Pin num and Pin name text opt position, 0 = default:
|
// (Currently Unused) Pin num and Pin name text opt position, 0 = default:
|
||||||
char m_PinNumPositionOpt;
|
char m_PinNumPositionOpt;
|
||||||
char m_PinNamePositionOpt;
|
char m_PinNamePositionOpt;
|
||||||
|
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
|
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
|
||||||
* point (segments) */
|
* point (segments) */
|
||||||
|
|
|
@ -13,21 +13,20 @@
|
||||||
#include "class_marker_sch.h"
|
#include "class_marker_sch.h"
|
||||||
|
|
||||||
// Imported function:
|
// Imported function:
|
||||||
void DeleteItemsInList( WinEDA_DrawPanel* panel,
|
void DeleteItemsInList( WinEDA_DrawPanel* panel,
|
||||||
PICKED_ITEMS_LIST& aItemsList );
|
PICKED_ITEMS_LIST& aItemsList );
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
/*
|
||||||
static int CountConnectedItems( WinEDA_SchematicFrame* frame,
|
* Count number of items connected to point pos :
|
||||||
SCH_ITEM* ListStruct, wxPoint pos, bool TstJunction )
|
* pins, end wire or bus, and junctions if TstJunction == TRUE
|
||||||
/********************************************************************************/
|
* Return this count
|
||||||
|
|
||||||
/* Count number of items connected to point pos :
|
|
||||||
* pins, end wire or bus, and junctions if TstJunction == TRUE
|
|
||||||
* Return this count
|
|
||||||
*
|
*
|
||||||
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
||||||
*/
|
*/
|
||||||
|
static int CountConnectedItems( WinEDA_SchematicFrame* frame,
|
||||||
|
SCH_ITEM* ListStruct, wxPoint pos,
|
||||||
|
bool TstJunction )
|
||||||
{
|
{
|
||||||
SCH_ITEM* Struct;
|
SCH_ITEM* Struct;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -64,16 +63,16 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************/
|
|
||||||
|
/*
|
||||||
|
* Mark to "CANDIDATE" all wires or junction connected to "segment" in list
|
||||||
|
* "ListStruct"
|
||||||
|
* Search wire stop at an any pin
|
||||||
|
*
|
||||||
|
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
||||||
|
*/
|
||||||
static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
|
static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
|
||||||
EDA_DrawLineStruct* segment )
|
EDA_DrawLineStruct* segment )
|
||||||
/************************************************************************************/
|
|
||||||
|
|
||||||
/* Mark to "CANDIDATE" all wires or junction connected to "segment" in list "ListStruct"
|
|
||||||
* Search wire stop at an any pin
|
|
||||||
*
|
|
||||||
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* Struct;
|
EDA_BaseStruct* Struct;
|
||||||
|
|
||||||
|
@ -117,34 +116,34 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
/*
|
||||||
void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
* Delete a connection, i.e wires or bus connected
|
||||||
/********************************************************************************/
|
* stop on a node (more than 2 wires (bus) connected)
|
||||||
|
|
||||||
/* Delete a connection, i.e wires or bus connected
|
|
||||||
* stop on a node (more than 2 wires (bus) connected)
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
{
|
{
|
||||||
wxPoint refpos = GetScreen()->m_Curseur;
|
wxPoint refpos = GetScreen()->m_Curseur;
|
||||||
SCH_ITEM* DelStruct;
|
SCH_ITEM* DelStruct;
|
||||||
PICKED_ITEMS_LIST pickList;
|
PICKED_ITEMS_LIST pickList;
|
||||||
|
|
||||||
/* Clear .m_Flags member for all items */
|
/* Clear .m_Flags member for all items */
|
||||||
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
|
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL;
|
||||||
|
DelStruct = DelStruct->Next() )
|
||||||
DelStruct->m_Flags = 0;
|
DelStruct->m_Flags = 0;
|
||||||
|
|
||||||
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
|
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
|
||||||
|
|
||||||
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
|
/* Locate all the wires, bus or junction under the mouse cursor, and put
|
||||||
* of items to delete
|
* them in a list of items to delete
|
||||||
*/
|
*/
|
||||||
ITEM_PICKER picker(NULL, UR_DELETED);
|
ITEM_PICKER picker(NULL, UR_DELETED);
|
||||||
SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen();
|
SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen();
|
||||||
SCH_ITEM* savedEEDrawList = screen->EEDrawList; // Save the list entry point of this screen
|
// Save the list entry point of this screen
|
||||||
|
SCH_ITEM* savedEEDrawList = screen->EEDrawList;
|
||||||
DelStruct = GetScreen()->EEDrawList;
|
DelStruct = GetScreen()->EEDrawList;
|
||||||
while( DelStruct
|
while( DelStruct
|
||||||
&& ( DelStruct = PickStruct( screen->m_Curseur,
|
&& ( DelStruct = PickStruct( screen->m_Curseur, screen,
|
||||||
screen, JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL )
|
JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL )
|
||||||
{
|
{
|
||||||
DelStruct->m_Flags = SELECTEDNODE | STRUCT_DELETED;
|
DelStruct->m_Flags = SELECTEDNODE | STRUCT_DELETED;
|
||||||
|
|
||||||
|
@ -163,7 +162,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
*/
|
*/
|
||||||
if( DeleteFullConnection )
|
if( DeleteFullConnection )
|
||||||
{
|
{
|
||||||
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
|
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL;
|
||||||
|
DelStruct = DelStruct->Next() )
|
||||||
{
|
{
|
||||||
if( !(DelStruct->m_Flags & SELECTEDNODE) )
|
if( !(DelStruct->m_Flags & SELECTEDNODE) )
|
||||||
continue;
|
continue;
|
||||||
|
@ -177,15 +177,16 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Search all removable wires (i.e wire with one new dangling end )
|
// Search all removable wires (i.e wire with one new dangling end )
|
||||||
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
|
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL;
|
||||||
|
DelStruct = DelStruct->Next() )
|
||||||
{
|
{
|
||||||
bool noconnect = FALSE;
|
bool noconnect = FALSE;
|
||||||
|
|
||||||
if( DelStruct->m_Flags & STRUCT_DELETED )
|
if( DelStruct->m_Flags & STRUCT_DELETED )
|
||||||
continue; // Already seen
|
continue; // Already seen
|
||||||
|
|
||||||
if( !(DelStruct->m_Flags & CANDIDATE) )
|
if( !(DelStruct->m_Flags & CANDIDATE) )
|
||||||
continue; // Already seen
|
continue; // Already seen
|
||||||
|
|
||||||
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
continue;
|
continue;
|
||||||
|
@ -193,8 +194,9 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
DelStruct->m_Flags |= SKIP_STRUCT;
|
DelStruct->m_Flags |= SKIP_STRUCT;
|
||||||
#define SEGM ( (EDA_DrawLineStruct*) DelStruct )
|
#define SEGM ( (EDA_DrawLineStruct*) DelStruct )
|
||||||
|
|
||||||
/* Test the SEGM->m_Start point: if this point was connected to an STRUCT_DELETED wire,
|
/* Test the SEGM->m_Start point: if this point was connected to
|
||||||
* and now is not connected, the wire can be deleted */
|
* an STRUCT_DELETED wire, and now is not connected, the wire can
|
||||||
|
* be deleted */
|
||||||
EDA_BaseStruct* removed_struct;
|
EDA_BaseStruct* removed_struct;
|
||||||
for( removed_struct = GetScreen()->EEDrawList;
|
for( removed_struct = GetScreen()->EEDrawList;
|
||||||
removed_struct != NULL;
|
removed_struct != NULL;
|
||||||
|
@ -211,11 +213,13 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WIRE && !CountConnectedItems( this, GetScreen()->EEDrawList, SEGM->m_Start, TRUE ) )
|
if( WIRE && !CountConnectedItems( this, GetScreen()->EEDrawList,
|
||||||
|
SEGM->m_Start, TRUE ) )
|
||||||
noconnect = TRUE;
|
noconnect = TRUE;
|
||||||
|
|
||||||
/* Test the SEGM->m_End point: if this point was connected to an STRUCT_DELETED wire,
|
/* Test the SEGM->m_End point: if this point was connected to
|
||||||
* and now is not connected, the wire can be deleted */
|
* an STRUCT_DELETED wire, and now is not connected, the wire
|
||||||
|
* can be deleted */
|
||||||
for( removed_struct = GetScreen()->EEDrawList;
|
for( removed_struct = GetScreen()->EEDrawList;
|
||||||
removed_struct != NULL;
|
removed_struct != NULL;
|
||||||
removed_struct = removed_struct->Next() )
|
removed_struct = removed_struct->Next() )
|
||||||
|
@ -229,7 +233,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( removed_struct &&
|
if( removed_struct &&
|
||||||
!CountConnectedItems( this, GetScreen()->EEDrawList, SEGM->m_End, TRUE ) )
|
!CountConnectedItems( this, GetScreen()->EEDrawList,
|
||||||
|
SEGM->m_End, TRUE ) )
|
||||||
noconnect = TRUE;
|
noconnect = TRUE;
|
||||||
|
|
||||||
DelStruct->m_Flags &= ~SKIP_STRUCT;
|
DelStruct->m_Flags &= ~SKIP_STRUCT;
|
||||||
|
@ -247,8 +252,10 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
#undef SEGM
|
#undef SEGM
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete redundant junctions (junctions which connect < 3 end wires and no pin are removed)
|
// Delete redundant junctions (junctions which connect < 3 end wires
|
||||||
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
|
// and no pin are removed)
|
||||||
|
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL;
|
||||||
|
DelStruct = DelStruct->Next() )
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
if( DelStruct->m_Flags & STRUCT_DELETED )
|
if( DelStruct->m_Flags & STRUCT_DELETED )
|
||||||
|
@ -260,7 +267,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
#define JUNCTION ( (DrawJunctionStruct*) DelStruct )
|
#define JUNCTION ( (DrawJunctionStruct*) DelStruct )
|
||||||
count = CountConnectedItems( this, GetScreen()->EEDrawList, JUNCTION->m_Pos, FALSE );
|
count = CountConnectedItems( this, GetScreen()->EEDrawList,
|
||||||
|
JUNCTION->m_Pos, FALSE );
|
||||||
if( count <= 2 )
|
if( count <= 2 )
|
||||||
{
|
{
|
||||||
DelStruct->m_Flags |= STRUCT_DELETED;
|
DelStruct->m_Flags |= STRUCT_DELETED;
|
||||||
|
@ -276,7 +284,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
|
|
||||||
// Delete labels attached to wires
|
// Delete labels attached to wires
|
||||||
wxPoint pos = GetScreen()->m_Curseur;
|
wxPoint pos = GetScreen()->m_Curseur;
|
||||||
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
|
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL;
|
||||||
|
DelStruct = DelStruct->Next() )
|
||||||
{
|
{
|
||||||
if( DelStruct->m_Flags & STRUCT_DELETED )
|
if( DelStruct->m_Flags & STRUCT_DELETED )
|
||||||
continue;
|
continue;
|
||||||
|
@ -286,7 +295,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
|
|
||||||
GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos;
|
GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos;
|
||||||
EDA_BaseStruct* TstStruct =
|
EDA_BaseStruct* TstStruct =
|
||||||
PickStruct( GetScreen()->m_Curseur, GetScreen(), WIREITEM | BUSITEM );
|
PickStruct( GetScreen()->m_Curseur, GetScreen(),
|
||||||
|
WIREITEM | BUSITEM );
|
||||||
|
|
||||||
if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED )
|
if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED )
|
||||||
{
|
{
|
||||||
|
@ -302,7 +312,8 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
GetScreen()->m_Curseur = pos;
|
GetScreen()->m_Curseur = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
|
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL;
|
||||||
|
DelStruct = DelStruct->Next() )
|
||||||
DelStruct->m_Flags = 0;
|
DelStruct->m_Flags = 0;
|
||||||
|
|
||||||
if( pickList.GetCount() )
|
if( pickList.GetCount() )
|
||||||
|
@ -313,23 +324,21 @@ void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*
|
||||||
bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
|
* Locate and delete the item found under the mouse cousor
|
||||||
/*****************************************************************/
|
* If more than one item found: the priority order is:
|
||||||
|
* 1 : MARKER
|
||||||
/* Locate and delete the item found under the mouse cousor
|
* 2 : JUNCTION
|
||||||
* If more than one item found: the priority order is:
|
* 2 : NOCONNECT
|
||||||
* 1 : MARKER
|
* 3 : WIRE ou BUS
|
||||||
* 2 : JUNCTION
|
* 4 : DRAWITEM
|
||||||
* 2 : NOCONNECT
|
* 5 : TEXT
|
||||||
* 3 : WIRE ou BUS
|
* 6 : COMPOSANT
|
||||||
* 4 : DRAWITEM
|
* 7 : SHEET
|
||||||
* 5 : TEXT
|
|
||||||
* 6 : COMPOSANT
|
|
||||||
* 7 : SHEET
|
|
||||||
*
|
*
|
||||||
* return TRUE if an item was deleted
|
* return TRUE if an item was deleted
|
||||||
*/
|
*/
|
||||||
|
bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
SCH_ITEM* DelStruct;
|
SCH_ITEM* DelStruct;
|
||||||
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() );
|
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() );
|
||||||
|
@ -347,7 +356,8 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
if( DelStruct == NULL )
|
if( DelStruct == NULL )
|
||||||
DelStruct = PickStruct( screen->m_Curseur, screen, DRAWITEM );
|
DelStruct = PickStruct( screen->m_Curseur, screen, DRAWITEM );
|
||||||
if( DelStruct == NULL )
|
if( DelStruct == NULL )
|
||||||
DelStruct = PickStruct( screen->m_Curseur, screen, TEXTITEM | LABELITEM );
|
DelStruct = PickStruct( screen->m_Curseur, screen,
|
||||||
|
TEXTITEM | LABELITEM );
|
||||||
if( DelStruct == NULL )
|
if( DelStruct == NULL )
|
||||||
DelStruct = PickStruct( screen->m_Curseur, screen, LIBITEM );
|
DelStruct = PickStruct( screen->m_Curseur, screen, LIBITEM );
|
||||||
if( DelStruct == NULL )
|
if( DelStruct == NULL )
|
||||||
|
@ -366,21 +376,19 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/*
|
||||||
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
* Suppression definitive d'une structure dans une liste chainee
|
||||||
/***************************************************************/
|
* d'elements de dessin
|
||||||
|
* DrawStruct = pointeur sur la structure
|
||||||
/* Suppression definitive d'une structure dans une liste chainee
|
* Screen = pointeur sur l'ecran d'appartenance
|
||||||
* d'elements de dessin
|
* Le chainage de la liste est modifie.
|
||||||
* DrawStruct = pointeur sur la structure
|
|
||||||
* Screen = pointeur sur l'ecran d'appartenance
|
|
||||||
* Le chainage de la liste est modifie.
|
|
||||||
*
|
*
|
||||||
* Remarque:
|
* Remarque:
|
||||||
* pour les structures DRAW_SHEET_STRUCT_TYPE, l'ecran et les structures
|
* pour les structures DRAW_SHEET_STRUCT_TYPE, l'ecran et les structures
|
||||||
* correspondantes ne sont pas touches.
|
* correspondantes ne sont pas touches.
|
||||||
* Ils doivent etre traites separement
|
* Ils doivent etre traites separement
|
||||||
*/
|
*/
|
||||||
|
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel, * NextLabel;
|
Hierarchical_PIN_Sheet_Struct* SheetLabel, * NextLabel;
|
||||||
|
@ -419,20 +427,23 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||||
{
|
{
|
||||||
while( SheetLabel->Next() ) /* Examen de la liste dependante */
|
while( SheetLabel->Next() ) /* Examen de la liste dependante */
|
||||||
{
|
{
|
||||||
NextLabel = (Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
|
NextLabel =
|
||||||
|
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
|
||||||
|
|
||||||
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
|
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
|
||||||
{
|
{
|
||||||
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
|
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
|
||||||
SAFE_DELETE( DrawStruct );
|
SAFE_DELETE( DrawStruct );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
SheetLabel = NextLabel;
|
SheetLabel = NextLabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else // structure usuelle */
|
else // structure usuelle */
|
||||||
{
|
{
|
||||||
if( DrawStruct == Screen->EEDrawList )
|
if( DrawStruct == Screen->EEDrawList )
|
||||||
|
@ -458,10 +469,10 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
/*
|
||||||
|
* Effacement des marqueurs du type "type"
|
||||||
|
*/
|
||||||
void DeleteAllMarkers( int type )
|
void DeleteAllMarkers( int type )
|
||||||
/********************************/
|
|
||||||
/* Effacement des marqueurs du type "type" */
|
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
SCH_ITEM * DrawStruct, * NextStruct;
|
SCH_ITEM * DrawStruct, * NextStruct;
|
||||||
|
@ -469,9 +480,11 @@ void DeleteAllMarkers( int type )
|
||||||
|
|
||||||
EDA_ScreenList ScreenList;
|
EDA_ScreenList ScreenList;
|
||||||
|
|
||||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
for( screen = ScreenList.GetFirst(); screen != NULL;
|
||||||
|
screen = ScreenList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct )
|
for( DrawStruct = screen->EEDrawList; DrawStruct != NULL;
|
||||||
|
DrawStruct = NextStruct )
|
||||||
{
|
{
|
||||||
NextStruct = DrawStruct->Next();
|
NextStruct = DrawStruct->Next();
|
||||||
if( DrawStruct->Type() != TYPE_MARKER_SCH )
|
if( DrawStruct->Type() != TYPE_MARKER_SCH )
|
||||||
|
@ -487,60 +500,3 @@ void DeleteAllMarkers( int type )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
||||||
EDA_LibComponentStruct* LibEntry,
|
|
||||||
LibEDA_BaseStruct* DrawItem, int Affiche )
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/* Routine d'effacement d'un "LibraryDrawStruct"
|
|
||||||
* (d'un element de dessin d'un composant )
|
|
||||||
*
|
|
||||||
* Parametres d'entree
|
|
||||||
* Pointeur sur le composant comportant la structure
|
|
||||||
* (Si NULL la structure a effacer est supposee non rattachee
|
|
||||||
* a un composant)
|
|
||||||
* Pointeur sur la structure a effacer
|
|
||||||
*
|
|
||||||
* Efface egalement le graphique correspondant de l'ecran
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
LibEDA_BaseStruct* PreviousDrawItem;
|
|
||||||
|
|
||||||
/* Effacement du graphique */
|
|
||||||
if( Affiche && DC )
|
|
||||||
DrawLibraryDrawStruct( panel, DC, LibEntry, wxPoint(0, 0), DrawItem, g_XorMode );
|
|
||||||
|
|
||||||
/* Effacement de la structure en memoire */
|
|
||||||
if( LibEntry ) /* Recherche du predecesseur */
|
|
||||||
{
|
|
||||||
PreviousDrawItem = LibEntry->m_Drawings;
|
|
||||||
|
|
||||||
/* Cas du 1er symbole graphique = struct a supprimer */
|
|
||||||
if( LibEntry->m_Drawings == DrawItem )
|
|
||||||
{
|
|
||||||
LibEntry->m_Drawings = DrawItem->Next();
|
|
||||||
SAFE_DELETE( DrawItem );
|
|
||||||
}
|
|
||||||
else /* Cas des autres items */
|
|
||||||
{
|
|
||||||
while( PreviousDrawItem )
|
|
||||||
{
|
|
||||||
if( PreviousDrawItem->Next() == DrawItem )
|
|
||||||
{
|
|
||||||
PreviousDrawItem->SetNext( DrawItem->Next() );
|
|
||||||
SAFE_DELETE( DrawItem );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
PreviousDrawItem = PreviousDrawItem->Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else /* Structure non reliee a un composant */
|
|
||||||
{
|
|
||||||
SAFE_DELETE( DrawItem );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/* librairy editor: edition of component general properties */
|
/* librairy editor: edition of component general properties */
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -434,8 +434,8 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::ChangeNbUnitsPerPackage( int MaxUnit )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL, CurrentLibEntry,
|
|
||||||
DrawItem, 0 );
|
CurrentLibEntry->RemoveDrawItem( DrawItem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,12 +529,9 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::SetUnsetConvert()
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Parent->GetScreen()->SetModify();
|
m_Parent->GetScreen()->SetModify();
|
||||||
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel,
|
CurrentLibEntry->RemoveDrawItem( DrawItem );
|
||||||
NULL,
|
|
||||||
CurrentLibEntry,
|
|
||||||
DrawItem,
|
|
||||||
0 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
/* EESchema - symbtext.cpp for Library Editor */
|
/* EESchema - symbtext.cpp for Library Editor */
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
|
|
||||||
/* Menu et routines de creation, modification, suppression de textes
|
/* Menu et routines de creation, modification, suppression de textes
|
||||||
du type symbole
|
du type symbole
|
||||||
(textes autres que Fields)
|
(textes autres que Fields)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -24,25 +24,25 @@
|
||||||
class Dialog_BodyGraphicText_Properties : public Dialog_BodyGraphicText_Properties_base
|
class Dialog_BodyGraphicText_Properties : public Dialog_BodyGraphicText_Properties_base
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
WinEDA_LibeditFrame * m_Parent;
|
WinEDA_LibeditFrame * m_Parent;
|
||||||
LibDrawText * m_GraphicText;
|
LibDrawText * m_GraphicText;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText);
|
Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText);
|
||||||
~Dialog_BodyGraphicText_Properties() {};
|
~Dialog_BodyGraphicText_Properties() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitDialog( );
|
void InitDialog( );
|
||||||
void OnOkClick( wxCommandEvent& event );
|
void OnOkClick( wxCommandEvent& event );
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText) :
|
Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText) :
|
||||||
Dialog_BodyGraphicText_Properties_base(aParent)
|
Dialog_BodyGraphicText_Properties_base(aParent)
|
||||||
{
|
{
|
||||||
m_Parent = aParent;
|
m_Parent = aParent;
|
||||||
m_GraphicText = aGraphicText;
|
m_GraphicText = aGraphicText;
|
||||||
InitDialog( );
|
InitDialog( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,26 +51,32 @@ Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_Li
|
||||||
void Dialog_BodyGraphicText_Properties::InitDialog( )
|
void Dialog_BodyGraphicText_Properties::InitDialog( )
|
||||||
/*****************************************************/
|
/*****************************************************/
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
if ( m_GraphicText )
|
if ( m_GraphicText )
|
||||||
{
|
{
|
||||||
msg = ReturnStringFromValue(g_UnitMetric, m_GraphicText->m_Size.x, m_Parent->m_InternalUnits);
|
msg = ReturnStringFromValue(g_UnitMetric, m_GraphicText->m_Size.x,
|
||||||
m_TextSize->SetValue(msg);
|
m_Parent->m_InternalUnits);
|
||||||
m_TextValue->SetValue(m_GraphicText->m_Text);
|
m_TextSize->SetValue( msg );
|
||||||
if ( m_GraphicText->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE);
|
m_TextValue->SetValue( m_GraphicText->m_Text );
|
||||||
if ( m_GraphicText->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE);
|
|
||||||
if ( m_GraphicText->m_Orient == TEXT_ORIENT_VERT ) m_Orient->SetValue(TRUE);
|
if ( m_GraphicText->m_Unit == 0 )
|
||||||
int shape = 0;
|
m_CommonUnit->SetValue( TRUE );
|
||||||
if ( m_GraphicText->m_Italic)
|
if ( m_GraphicText->m_Convert == 0 )
|
||||||
shape = 1;
|
m_CommonConvert->SetValue( TRUE );
|
||||||
if ( m_GraphicText->m_Bold)
|
if ( m_GraphicText->m_Orient == TEXT_ORIENT_VERT )
|
||||||
shape |= 2;
|
m_Orient->SetValue( TRUE );
|
||||||
|
|
||||||
|
int shape = 0;
|
||||||
|
if ( m_GraphicText->m_Italic )
|
||||||
|
shape = 1;
|
||||||
|
if ( m_GraphicText->m_Bold )
|
||||||
|
shape |= 2;
|
||||||
|
|
||||||
|
m_TextShapeOpt->SetSelection( shape );
|
||||||
|
|
||||||
m_TextShapeOpt->SetSelection(shape);
|
|
||||||
|
|
||||||
switch ( m_GraphicText->m_HJustify )
|
switch ( m_GraphicText->m_HJustify )
|
||||||
{
|
{
|
||||||
case GR_TEXT_HJUSTIFY_LEFT:
|
case GR_TEXT_HJUSTIFY_LEFT:
|
||||||
|
@ -89,31 +95,36 @@ wxString msg;
|
||||||
|
|
||||||
switch ( m_GraphicText->m_VJustify )
|
switch ( m_GraphicText->m_VJustify )
|
||||||
{
|
{
|
||||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||||
m_TextVJustificationOpt->SetSelection(0);
|
m_TextVJustificationOpt->SetSelection(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_VJUSTIFY_CENTER:
|
case GR_TEXT_VJUSTIFY_CENTER:
|
||||||
m_TextVJustificationOpt->SetSelection(1);
|
m_TextVJustificationOpt->SetSelection(1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GR_TEXT_VJUSTIFY_TOP:
|
|
||||||
m_TextVJustificationOpt->SetSelection(2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
case GR_TEXT_VJUSTIFY_TOP:
|
||||||
|
m_TextVJustificationOpt->SetSelection(2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = ReturnStringFromValue(g_UnitMetric, g_LastTextSize, m_Parent->m_InternalUnits);
|
msg = ReturnStringFromValue( g_UnitMetric, g_LastTextSize,
|
||||||
m_TextSize->SetValue(msg);
|
m_Parent->m_InternalUnits );
|
||||||
if ( ! g_FlDrawSpecificUnit ) m_CommonUnit->SetValue(TRUE);
|
m_TextSize->SetValue( msg );
|
||||||
if ( ! g_FlDrawSpecificConvert ) m_CommonConvert->SetValue(TRUE);
|
|
||||||
if ( g_LastTextOrient == TEXT_ORIENT_VERT ) m_Orient->SetValue(TRUE);
|
if ( ! g_FlDrawSpecificUnit )
|
||||||
}
|
m_CommonUnit->SetValue( TRUE );
|
||||||
|
if ( ! g_FlDrawSpecificConvert )
|
||||||
|
m_CommonConvert->SetValue( TRUE );
|
||||||
|
if ( g_LastTextOrient == TEXT_ORIENT_VERT )
|
||||||
|
m_Orient->SetValue( TRUE );
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol();
|
||||||
|
m_TextSizeText->SetLabel( msg );
|
||||||
|
|
||||||
msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol();
|
|
||||||
m_TextSizeText->SetLabel(msg);
|
|
||||||
if (GetSizer())
|
if (GetSizer())
|
||||||
{
|
{
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints(this);
|
||||||
|
@ -135,71 +146,79 @@ void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
|
||||||
Line = m_TextValue->GetValue();
|
Line = m_TextValue->GetValue();
|
||||||
g_LastTextOrient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
|
g_LastTextOrient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
|
||||||
wxString msg = m_TextSize->GetValue();
|
wxString msg = m_TextSize->GetValue();
|
||||||
g_LastTextSize = ReturnValueFromString(g_UnitMetric, msg, m_Parent->m_InternalUnits);
|
g_LastTextSize = ReturnValueFromString(g_UnitMetric, msg,
|
||||||
g_FlDrawSpecificConvert = m_CommonConvert->GetValue() ? FALSE : TRUE;
|
m_Parent->m_InternalUnits);
|
||||||
g_FlDrawSpecificUnit = m_CommonUnit->GetValue() ? FALSE : TRUE;
|
g_FlDrawSpecificConvert = m_CommonConvert->GetValue() ? FALSE : TRUE;
|
||||||
|
g_FlDrawSpecificUnit = m_CommonUnit->GetValue() ? FALSE : TRUE;
|
||||||
|
|
||||||
if ( m_GraphicText )
|
if ( m_GraphicText )
|
||||||
{
|
{
|
||||||
if ( ! Line.IsEmpty() ) m_GraphicText->m_Text = Line;
|
if ( ! Line.IsEmpty() )
|
||||||
else m_GraphicText->m_Text = wxT("[null]");
|
m_GraphicText->m_Text = Line;
|
||||||
m_GraphicText->m_Size.x = m_GraphicText->m_Size.y = g_LastTextSize;
|
else
|
||||||
m_GraphicText->m_Orient = g_LastTextOrient;
|
m_GraphicText->m_Text = wxT("[null]");
|
||||||
if( g_FlDrawSpecificUnit ) m_GraphicText->m_Unit = CurrentUnit;
|
|
||||||
else m_GraphicText->m_Unit = 0;
|
|
||||||
if( g_FlDrawSpecificConvert ) m_GraphicText->m_Convert = CurrentConvert;
|
|
||||||
else m_GraphicText->m_Convert = 0;
|
|
||||||
|
|
||||||
if ( (m_TextShapeOpt->GetSelection() & 1 ) != 0 )
|
m_GraphicText->m_Size.x = m_GraphicText->m_Size.y = g_LastTextSize;
|
||||||
m_GraphicText->m_Italic = true;
|
m_GraphicText->m_Orient = g_LastTextOrient;
|
||||||
else
|
|
||||||
m_GraphicText->m_Italic = false;
|
|
||||||
|
|
||||||
if ( (m_TextShapeOpt->GetSelection() & 2 ) != 0 )
|
if( g_FlDrawSpecificUnit )
|
||||||
m_GraphicText->m_Bold = true;
|
m_GraphicText->m_Unit = CurrentUnit;
|
||||||
else
|
else
|
||||||
m_GraphicText->m_Bold = false;
|
m_GraphicText->m_Unit = 0;
|
||||||
|
|
||||||
|
if( g_FlDrawSpecificConvert )
|
||||||
|
m_GraphicText->m_Convert = CurrentConvert;
|
||||||
|
else
|
||||||
|
m_GraphicText->m_Convert = 0;
|
||||||
|
|
||||||
|
if ( (m_TextShapeOpt->GetSelection() & 1 ) != 0 )
|
||||||
|
m_GraphicText->m_Italic = true;
|
||||||
|
else
|
||||||
|
m_GraphicText->m_Italic = false;
|
||||||
|
|
||||||
|
if ( (m_TextShapeOpt->GetSelection() & 2 ) != 0 )
|
||||||
|
m_GraphicText->m_Bold = true;
|
||||||
|
else
|
||||||
|
m_GraphicText->m_Bold = false;
|
||||||
|
|
||||||
switch ( m_TextHJustificationOpt->GetSelection() )
|
switch ( m_TextHJustificationOpt->GetSelection() )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
|
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
|
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
|
||||||
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ( m_TextVJustificationOpt->GetSelection() )
|
switch ( m_TextVJustificationOpt->GetSelection() )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
|
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
|
||||||
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_TOP;
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_TOP;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
if ( CurrentDrawItem )
|
if ( CurrentDrawItem )
|
||||||
CurrentDrawItem->DisplayInfo( m_Parent );
|
CurrentDrawItem->DisplayInfo( m_Parent );
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,26 +231,28 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, LibEDA_BaseStruct * DrawItem
|
||||||
|| ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) )
|
|| ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Effacement ancien texte */
|
/* Effacement ancien texte */
|
||||||
if( DC)
|
if( DC)
|
||||||
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
|
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, DrawMode, NULL,
|
||||||
DrawItem, DrawMode);
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
|
|
||||||
Dialog_BodyGraphicText_Properties * frame =
|
Dialog_BodyGraphicText_Properties * frame =
|
||||||
new Dialog_BodyGraphicText_Properties(this, (LibDrawText *) DrawItem);
|
new Dialog_BodyGraphicText_Properties( this,
|
||||||
frame->ShowModal(); frame->Destroy();
|
(LibDrawText *) DrawItem );
|
||||||
|
frame->ShowModal();
|
||||||
|
frame->Destroy();
|
||||||
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
/* Affichage nouveau texte */
|
||||||
|
if( DC )
|
||||||
|
{
|
||||||
|
if ( ( DrawItem->m_Flags & IS_MOVED ) == 0 )
|
||||||
|
DrawMode = GR_DEFAULT_DRAWMODE;
|
||||||
|
|
||||||
/* Affichage nouveau texte */
|
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, DrawMode, NULL,
|
||||||
if( DC )
|
DefaultTransformMatrix );
|
||||||
{
|
}
|
||||||
if ( (DrawItem->m_Flags & IS_MOVED) == 0 )
|
|
||||||
DrawMode = GR_DEFAULT_DRAWMODE;
|
|
||||||
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
|
|
||||||
DrawItem, DrawMode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,31 +260,32 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, LibEDA_BaseStruct * DrawItem
|
||||||
void WinEDA_LibeditFrame::RotateSymbolText(wxDC * DC)
|
void WinEDA_LibeditFrame::RotateSymbolText(wxDC * DC)
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/*
|
/*
|
||||||
90 deg Graphic text Rotation .
|
90 deg Graphic text Rotation .
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
|
LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
|
||||||
|
|
||||||
if(DrawItem == NULL) return;
|
if( DrawItem == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
/* Erase drawing (can be within a move command) */
|
/* Erase drawing (can be within a move command) */
|
||||||
if ( DrawPanel->ManageCurseur == NULL)
|
if ( DrawPanel->ManageCurseur == NULL)
|
||||||
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
|
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
|
||||||
DrawItem, g_XorMode);
|
DefaultTransformMatrix );
|
||||||
else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
|
else
|
||||||
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
|
|
||||||
if( DrawItem->m_Orient == TEXT_ORIENT_HORIZ)
|
if( DrawItem->m_Orient == TEXT_ORIENT_HORIZ )
|
||||||
DrawItem->m_Orient = TEXT_ORIENT_VERT;
|
DrawItem->m_Orient = TEXT_ORIENT_VERT;
|
||||||
else DrawItem->m_Orient = TEXT_ORIENT_HORIZ;
|
else
|
||||||
|
DrawItem->m_Orient = TEXT_ORIENT_HORIZ;
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
/* Redraw item with new orient */
|
|
||||||
if ( DrawPanel->ManageCurseur == NULL)
|
|
||||||
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
|
|
||||||
DrawItem, GR_DEFAULT_DRAWMODE);
|
|
||||||
else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
|
|
||||||
|
|
||||||
|
/* Redraw item with new orient */
|
||||||
|
if ( DrawPanel->ManageCurseur == NULL )
|
||||||
|
DrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
|
||||||
|
NULL, DefaultTransformMatrix );
|
||||||
|
else
|
||||||
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,9 @@
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
#include "drawtxt.h"
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "trigo.h"
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
//#define DRAW_ARC_WITH_ANGLE // Used to select function to draw arcs
|
//#define DRAW_ARC_WITH_ANGLE // Used to select function to draw arcs
|
||||||
|
@ -42,117 +40,6 @@ wxPoint TransformCoordinate( const int aTransformMatrix[2][2],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
/* Routine de dessin d'un composant d'une librairie
|
|
||||||
* LibEntry = pointeur sur la description en librairie
|
|
||||||
* posX, posY = position du composant
|
|
||||||
* DrawMode = GrOR ..
|
|
||||||
* Color = 0 : dessin en vraies couleurs, sinon couleur = Color
|
|
||||||
*
|
|
||||||
* Une croix symbolise le point d'accrochage (ref position) du composant
|
|
||||||
*
|
|
||||||
* Le composant est toujours trace avec orientation 0
|
|
||||||
*/
|
|
||||||
/*************************************************************/
|
|
||||||
void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
||||||
EDA_LibComponentStruct* LibEntry,
|
|
||||||
const wxPoint& aOffset,
|
|
||||||
int Multi, int convert,
|
|
||||||
int DrawMode, int Color )
|
|
||||||
{
|
|
||||||
int color;
|
|
||||||
wxString Prefix;
|
|
||||||
LibDrawField* Field;
|
|
||||||
wxPoint text_pos;
|
|
||||||
|
|
||||||
|
|
||||||
DrawLibPartAux( panel, DC, NULL, LibEntry, aOffset,
|
|
||||||
DefaultTransformMatrix, Multi,
|
|
||||||
convert, DrawMode, Color );
|
|
||||||
|
|
||||||
/* Trace des 2 champs ref et value (Attention aux coord: la matrice
|
|
||||||
* de transformation change de signe les coord Y */
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
if( LibEntry->m_Prefix.m_Attributs & TEXT_NO_VISIBLE )
|
|
||||||
{
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = g_InvisibleItemColor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
color = Color;
|
|
||||||
|
|
||||||
if( LibEntry->m_UnitCount > 1 )
|
|
||||||
#if defined(KICAD_GOST)
|
|
||||||
|
|
||||||
Prefix.Printf( wxT( "%s?.%c" ),
|
|
||||||
LibEntry->m_Prefix.m_Text.GetData(), Multi + '1' - 1 );
|
|
||||||
#else
|
|
||||||
|
|
||||||
Prefix.Printf( wxT( "%s?%c" ),
|
|
||||||
LibEntry->m_Prefix.m_Text.GetData(), Multi + 'A' - 1 );
|
|
||||||
#endif
|
|
||||||
else
|
|
||||||
Prefix = LibEntry->m_Prefix.m_Text + wxT( "?" );
|
|
||||||
|
|
||||||
if( (LibEntry->m_Prefix.m_Flags & IS_MOVED) == 0 )
|
|
||||||
LibEntry->m_Prefix.Draw( panel, DC, aOffset, color, DrawMode,
|
|
||||||
&Prefix, DefaultTransformMatrix );
|
|
||||||
|
|
||||||
if( LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE )
|
|
||||||
{
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = g_InvisibleItemColor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
color = Color;
|
|
||||||
|
|
||||||
if( (LibEntry->m_Name.m_Flags & IS_MOVED) == 0 )
|
|
||||||
LibEntry->m_Name.Draw( panel, DC, aOffset, color, DrawMode, NULL,
|
|
||||||
DefaultTransformMatrix );
|
|
||||||
|
|
||||||
for( Field = LibEntry->m_Fields; Field != NULL; Field = Field->Next() )
|
|
||||||
{
|
|
||||||
if( Field->m_Text.IsEmpty() )
|
|
||||||
return;
|
|
||||||
if( (Field->m_Flags & IS_MOVED) != 0 )
|
|
||||||
continue;
|
|
||||||
if( Field->m_Attributs & TEXT_NO_VISIBLE )
|
|
||||||
{
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = g_InvisibleItemColor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
color = Color;
|
|
||||||
Field->Draw( panel, DC, aOffset, color, DrawMode, NULL,
|
|
||||||
DefaultTransformMatrix );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trace de l'ancre
|
|
||||||
int len = panel->GetScreen()->Unscale( 3 );
|
|
||||||
GRLine( &panel->m_ClipBox, DC, aOffset.x, aOffset.y - len, aOffset.x,
|
|
||||||
aOffset.y + len, 0, color );
|
|
||||||
GRLine( &panel->m_ClipBox, DC, aOffset.x - len, aOffset.y, aOffset.x + len,
|
|
||||||
aOffset.y, 0, color );
|
|
||||||
|
|
||||||
/* Enable this to draw the bounding box around the component to validate
|
|
||||||
* the bounding box calculations. */
|
|
||||||
#if 0
|
|
||||||
EDA_Rect bBox = LibEntry->GetBoundaryBox( Multi, convert );
|
|
||||||
GRRect( &panel->m_ClipBox, DC, bBox.GetOrigin().x, bBox.GetOrigin().y,
|
|
||||||
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* Routine to find a part in one of the libraries given its name.
|
* Routine to find a part in one of the libraries given its name.
|
||||||
|
@ -282,53 +169,3 @@ void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
DrawLibItem->m_Transform, multi, convert, DrawMode, Color,
|
DrawLibItem->m_Transform, multi, convert, DrawMode, Color,
|
||||||
DrawPinText );
|
DrawPinText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
/* Routine to draw One LibraryDrawStruct at given position, */
|
|
||||||
/* matrice de transformation 1 0 0 -1 (normale) */
|
|
||||||
/* DrawMode = GrXOR, GrOR .. */
|
|
||||||
/************************************************************/
|
|
||||||
/* Utilise en LibEdit et Lib Browse */
|
|
||||||
void DrawLibraryDrawStruct( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
|
||||||
EDA_LibComponentStruct* aLibEntry,
|
|
||||||
wxPoint aPosition, LibEDA_BaseStruct* aDrawItem,
|
|
||||||
int aDrawMode, int aColor )
|
|
||||||
{
|
|
||||||
int TransMat[2][2];
|
|
||||||
bool no_fill;
|
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
|
||||||
|
|
||||||
TransMat[0][0] = 1;
|
|
||||||
TransMat[0][1] = TransMat[1][0] = 0;
|
|
||||||
TransMat[1][1] = -1;
|
|
||||||
|
|
||||||
no_fill = false;
|
|
||||||
|
|
||||||
switch( aDrawItem->Type() )
|
|
||||||
{
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
|
|
||||||
{
|
|
||||||
DrawPinPrms prms( aLibEntry, true );
|
|
||||||
aDrawItem->Draw( aPanel, aDC, aPosition, aColor, aDrawMode, &prms,
|
|
||||||
TransMat );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
default:
|
|
||||||
if( screen->m_IsPrinting
|
|
||||||
&& aDrawItem->m_Fill == FILLED_WITH_BG_BODYCOLOR
|
|
||||||
&& GetGRForceBlackPenState() )
|
|
||||||
no_fill = true;
|
|
||||||
aDrawItem->Draw( aPanel, aDC, aPosition, aColor, aDrawMode,
|
|
||||||
(void*) no_fill, TransMat );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -70,10 +70,11 @@ DrawSheetStruct* g_RootSheet = NULL;
|
||||||
SCH_SCREEN* g_ScreenLib = NULL;
|
SCH_SCREEN* g_ScreenLib = NULL;
|
||||||
|
|
||||||
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
|
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
|
||||||
wxString g_SymbolExtBuffer( wxT( "sym" ) );
|
|
||||||
|
|
||||||
|
const wxString SymbolFileExtension( wxT( "sym" ) );
|
||||||
const wxString CompLibFileExtension( wxT( "lib" ) );
|
const wxString CompLibFileExtension( wxT( "lib" ) );
|
||||||
|
|
||||||
|
const wxString SymbolFileWildcard( wxT( "Kicad drawing symbol file (*.sym)|*.sym" ) );
|
||||||
const wxString CompLibFileWildcard( wxT( "Kicad component library file (*.lib)|*.lib" ) );
|
const wxString CompLibFileWildcard( wxT( "Kicad component library file (*.lib)|*.lib" ) );
|
||||||
|
|
||||||
wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
||||||
|
|
|
@ -173,7 +173,9 @@ extern SCH_SCREEN* g_ScreenLib;
|
||||||
|
|
||||||
/* Gestion des librairies schematiques */
|
/* Gestion des librairies schematiques */
|
||||||
extern wxString g_NetCmpExtBuffer;
|
extern wxString g_NetCmpExtBuffer;
|
||||||
extern wxString g_SymbolExtBuffer;
|
|
||||||
|
extern const wxString SymbolFileExtension;
|
||||||
|
extern const wxString SymbolFileWildcard;
|
||||||
|
|
||||||
extern const wxString CompLibFileExtension;
|
extern const wxString CompLibFileExtension;
|
||||||
extern const wxString CompLibFileWildcard;
|
extern const wxString CompLibFileWildcard;
|
||||||
|
|
|
@ -237,8 +237,8 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
CurrentLibEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), CurrentUnit,
|
||||||
CurrentUnit, CurrentConvert, GR_DEFAULT_DRAWMODE );
|
CurrentConvert, GR_DEFAULT_DRAWMODE );
|
||||||
|
|
||||||
DrawPanel->CursorOn( DC ); // redraw cursor
|
DrawPanel->CursorOn( DC ); // redraw cursor
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
/* EESchema - libedit_onleftclick.cpp */
|
/* EESchema - libedit_onleftclick.cpp */
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
|
|
||||||
/* Library editor commands created by a mouse left button simple or double click
|
/* Library editor commands created by a mouse left button simple or double click
|
||||||
|
@ -15,15 +15,12 @@
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
#include "bitmaps.h"
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
/************************************************************************/
|
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
|
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
|
||||||
|
|
||||||
|
@ -54,23 +51,27 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
||||||
CurrentUnit, CurrentConvert );
|
CurrentUnit, CurrentConvert );
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), GetScreen()->m_MousePosition,
|
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
||||||
|
GetScreen()->m_MousePosition,
|
||||||
CurrentLibEntry, CurrentUnit,
|
CurrentLibEntry, CurrentUnit,
|
||||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
CurrentConvert,
|
||||||
|
LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
||||||
CurrentUnit, CurrentConvert );
|
CurrentUnit, CurrentConvert );
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), GetScreen()->m_Curseur,
|
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
||||||
|
GetScreen()->m_Curseur,
|
||||||
CurrentLibEntry, CurrentUnit,
|
CurrentLibEntry, CurrentUnit,
|
||||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
CurrentConvert,
|
||||||
|
LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawEntry )
|
if( DrawEntry )
|
||||||
|
@ -80,7 +81,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
EraseMsgBox();
|
EraseMsgBox();
|
||||||
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
|
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
|
||||||
CurrentLibEntry->m_KeyWord.GetData() );
|
CurrentLibEntry->m_KeyWord.GetData() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,39 +127,41 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
case ID_LIBEDIT_DELETE_ITEM_BUTT:
|
||||||
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
||||||
CurrentUnit, CurrentConvert );
|
CurrentUnit, CurrentConvert );
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
||||||
GetScreen()->m_MousePosition,
|
GetScreen()->m_MousePosition,
|
||||||
CurrentLibEntry, CurrentUnit,
|
CurrentLibEntry, CurrentUnit,
|
||||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
CurrentConvert,
|
||||||
|
LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
||||||
CurrentUnit, CurrentConvert );
|
CurrentUnit, CurrentConvert );
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
|
||||||
GetScreen()->m_Curseur,
|
GetScreen()->m_Curseur,
|
||||||
CurrentLibEntry, CurrentUnit,
|
CurrentLibEntry, CurrentUnit,
|
||||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
CurrentConvert,
|
||||||
|
LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
|
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
|
||||||
CurrentLibEntry->m_KeyWord.GetData() );
|
CurrentLibEntry->m_KeyWord.GetData() );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
|
if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
|
||||||
DeletePin( DC, CurrentLibEntry, (LibDrawPin*) DrawEntry );
|
DeletePin( DC, CurrentLibEntry, (LibDrawPin*) DrawEntry );
|
||||||
else
|
else
|
||||||
DeleteOneLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, DrawEntry, TRUE );
|
CurrentLibEntry->RemoveDrawItem( DrawEntry, DrawPanel, DC );
|
||||||
DrawEntry = NULL;
|
DrawEntry = NULL;
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
|
||||||
|
@ -169,7 +172,8 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( this, wxT( "WinEDA_LibeditFrame::OnLeftClick error" ) );
|
DisplayError( this,
|
||||||
|
wxT( "WinEDA_LibeditFrame::OnLeftClick error" ) );
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -177,14 +181,12 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*
|
||||||
void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
* Called on a double click:
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/* Called on a double click:
|
|
||||||
* If an editable item (field, pin, graphic):
|
* If an editable item (field, pin, graphic):
|
||||||
* Call the suitable dialog editor.
|
* Call the suitable dialog editor.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
|
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
|
||||||
|
@ -192,33 +194,33 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
|
if( ( DrawEntry == NULL ) || ( DrawEntry->m_Flags == 0 ) )
|
||||||
{ // We can locate an item
|
{ // We can locate an item
|
||||||
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
DrawEntry = LocatePin( GetScreen()->m_MousePosition, CurrentLibEntry,
|
||||||
CurrentUnit, CurrentConvert );
|
CurrentUnit, CurrentConvert );
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
||||||
CurrentUnit, CurrentConvert );
|
CurrentUnit, CurrentConvert );
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
DrawEntry = CurrentDrawItem =
|
||||||
GetScreen()->m_MousePosition,
|
LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
||||||
CurrentLibEntry, CurrentUnit,
|
GetScreen()->m_MousePosition,
|
||||||
CurrentConvert,
|
CurrentLibEntry, CurrentUnit,
|
||||||
LOCATE_ALL_DRAW_ITEM );
|
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
DrawEntry = CurrentDrawItem =
|
||||||
GetScreen()->m_Curseur,
|
LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
||||||
CurrentLibEntry, CurrentUnit,
|
GetScreen()->m_Curseur,
|
||||||
CurrentConvert,
|
CurrentLibEntry, CurrentUnit,
|
||||||
LOCATE_ALL_DRAW_ITEM );
|
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
|
DrawEntry = CurrentDrawItem =
|
||||||
LocateField( CurrentLibEntry );
|
(LibEDA_BaseStruct*) LocateField( CurrentLibEntry );
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
|
@ -226,14 +228,6 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si Commande en cours: affichage commande d'annulation
|
|
||||||
if( m_ID_current_state )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if( DrawEntry )
|
if( DrawEntry )
|
||||||
DrawEntry->DisplayInfo( this );
|
DrawEntry->DisplayInfo( this );
|
||||||
else
|
else
|
||||||
|
@ -246,7 +240,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
switch( DrawEntry->Type() )
|
switch( DrawEntry->Type() )
|
||||||
{
|
{
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
case COMPONENT_PIN_DRAW_TYPE:
|
||||||
if( DrawEntry->m_Flags == 0 ) // Item localis<69> et non en edition: placement commande move
|
if( DrawEntry->m_Flags == 0 )
|
||||||
{
|
{
|
||||||
InstallPineditFrame( this, DC, pos );
|
InstallPineditFrame( this, DC, pos );
|
||||||
}
|
}
|
||||||
|
@ -290,9 +284,9 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(
|
msg.Printf( wxT( "WinEDA_LibeditFrame::OnLeftDClick Error: unknown \
|
||||||
wxT( "WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d" ),
|
StructType %d" ),
|
||||||
DrawEntry->Type() );
|
DrawEntry->Type() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* EESchema - edition des librairies: Edition des champs ( Fields ) */
|
/* EESchema - edition des librairies: Edition des champs ( Fields ) */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
/* Fichier libfield.cpp */
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
#include "drawtxt.h"
|
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
|
@ -17,33 +14,31 @@
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#include "wx/spinctrl.h"
|
|
||||||
|
|
||||||
/* Routines locales */
|
/* Routines locales */
|
||||||
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
/* if the field is the reference, return reference like schematic, i.e U -> U? or U?A
|
/*
|
||||||
* or the field text for others
|
* if the field is the reference, return reference like schematic,
|
||||||
|
* i.e U -> U? or U?A or the field text for others
|
||||||
*/
|
*/
|
||||||
static wxString ReturnFieldFullText( LibDrawField* aField );
|
static wxString ReturnFieldFullText( LibDrawField* aField );
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
|
|
||||||
|
/* Variables locales */
|
||||||
extern int CurrentUnit;
|
extern int CurrentUnit;
|
||||||
static wxPoint StartCursor, LastTextPosition;
|
static wxPoint StartCursor, LastTextPosition;
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
Panel->ManageCurseur = NULL;
|
Panel->ManageCurseur = NULL;
|
||||||
Panel->ForceCloseManageCurseur = NULL;
|
Panel->ForceCloseManageCurseur = NULL;
|
||||||
if( CurrentDrawItem == NULL )
|
if( CurrentDrawItem == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPoint curpos;
|
wxPoint curpos = Panel->GetScreen()->m_Curseur;
|
||||||
curpos = Panel->GetScreen()->m_Curseur;
|
|
||||||
Panel->GetScreen()->m_Curseur = StartCursor;
|
Panel->GetScreen()->m_Curseur = StartCursor;
|
||||||
ShowMoveField( Panel, DC, TRUE );
|
ShowMoveField( Panel, DC, TRUE );
|
||||||
Panel->GetScreen()->m_Curseur = curpos;
|
Panel->GetScreen()->m_Curseur = curpos;
|
||||||
|
@ -53,15 +48,16 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/*
|
||||||
|
* Initialise le deplacement d'un champ ( ref ou Name )
|
||||||
|
*/
|
||||||
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
|
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
|
||||||
/****************************************************************************/
|
|
||||||
/* Initialise le deplacement d'un champ ( ref ou Name) */
|
|
||||||
{
|
{
|
||||||
wxPoint startPos;
|
wxPoint startPos;
|
||||||
|
|
||||||
if( (CurrentLibEntry == NULL) || ( field == NULL ) )
|
if( ( CurrentLibEntry == NULL ) || ( field == NULL ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CurrentDrawItem = field;
|
CurrentDrawItem = field;
|
||||||
LastTextPosition = field->m_Pos;
|
LastTextPosition = field->m_Pos;
|
||||||
CurrentDrawItem->m_Flags |= IS_MOVED;
|
CurrentDrawItem->m_Flags |= IS_MOVED;
|
||||||
|
@ -81,8 +77,11 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* if the field is the reference, return reference like schematic, i.e U -> U? or U?A
|
/*
|
||||||
* or the field text for others
|
* If the field is the reference, return reference like schematic,
|
||||||
|
* i.e U -> U? or U?A or the field text for others
|
||||||
|
*
|
||||||
|
* @fixme This should be handled by the field object.
|
||||||
*/
|
*/
|
||||||
static wxString ReturnFieldFullText( LibDrawField* aField )
|
static wxString ReturnFieldFullText( LibDrawField* aField )
|
||||||
{
|
{
|
||||||
|
@ -111,101 +110,46 @@ static wxString ReturnFieldFullText( LibDrawField* aField )
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
/* Routine d'affichage du texte 'Field' en cours de deplacement. */
|
/* Routine d'affichage du texte 'Field' en cours de deplacement. */
|
||||||
/* Routine normalement attachee au curseur */
|
/* Routine normalement attachee au curseur */
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
int color;
|
|
||||||
LibDrawField* Field = (LibDrawField*) CurrentDrawItem;
|
LibDrawField* Field = (LibDrawField*) CurrentDrawItem;
|
||||||
|
|
||||||
if( (CurrentLibEntry == NULL) || (Field == NULL) )
|
if( ( CurrentLibEntry == NULL ) || ( Field == NULL ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( Field->m_FieldId )
|
|
||||||
{
|
|
||||||
case VALUE:
|
|
||||||
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case REFERENCE:
|
|
||||||
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
color = ReturnLayerColor( LAYER_FIELDS );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString text = ReturnFieldFullText( Field );
|
wxString text = ReturnFieldFullText( Field );
|
||||||
|
|
||||||
int TransMat[2][2];
|
|
||||||
TransMat[0][0] = 1; TransMat[1][1] = -1;
|
|
||||||
TransMat[1][0] = TransMat[0][1] = 0;
|
|
||||||
|
|
||||||
if( Field->m_Attributs & TEXT_NO_VISIBLE )
|
|
||||||
color = DARKGRAY;
|
|
||||||
if( erase )
|
if( erase )
|
||||||
Field->Draw( panel, DC, wxPoint( 0, 0 ),
|
Field->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &text,
|
||||||
color,
|
DefaultTransformMatrix );
|
||||||
g_XorMode, &text, TransMat );
|
|
||||||
|
|
||||||
|
|
||||||
LastTextPosition.x = panel->GetScreen()->m_Curseur.x;
|
LastTextPosition.x = panel->GetScreen()->m_Curseur.x;
|
||||||
LastTextPosition.y = -panel->GetScreen()->m_Curseur.y;
|
LastTextPosition.y = -panel->GetScreen()->m_Curseur.y;
|
||||||
|
|
||||||
Field->m_Pos = LastTextPosition;
|
Field->m_Pos = LastTextPosition;
|
||||||
|
Field->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &text,
|
||||||
Field->Draw( panel, DC, wxPoint( 0, 0 ),
|
DefaultTransformMatrix );
|
||||||
color,
|
|
||||||
g_XorMode, &text, TransMat );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
|
void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
EDA_Colors color;
|
|
||||||
|
|
||||||
if( Field == NULL )
|
if( Field == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( Field->m_FieldId )
|
|
||||||
{
|
|
||||||
case REFERENCE:
|
|
||||||
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VALUE:
|
|
||||||
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
color = ReturnLayerColor( LAYER_FIELDS );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Field->m_Flags = 0;
|
Field->m_Flags = 0;
|
||||||
|
|
||||||
|
|
||||||
if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 )
|
|
||||||
color = DARKGRAY;
|
|
||||||
Field->m_Pos.x = GetScreen()->m_Curseur.x;
|
Field->m_Pos.x = GetScreen()->m_Curseur.x;
|
||||||
Field->m_Pos.y = -GetScreen()->m_Curseur.y;
|
Field->m_Pos.y = -GetScreen()->m_Curseur.y;
|
||||||
int linewidth = (Field->m_Width == 0) ? g_DrawDefaultLineThickness : Field->m_Width;
|
|
||||||
linewidth = Clamp_Text_PenSize( linewidth, Field->m_Size, Field->m_Bold );
|
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
|
wxString fieldText = ReturnFieldFullText( Field );
|
||||||
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
||||||
color, ReturnFieldFullText( Field ),
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
|
||||||
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
&fieldText, DefaultTransformMatrix );
|
||||||
Field->m_Size,
|
|
||||||
Field->m_HJustify, Field->m_VJustify, linewidth,
|
|
||||||
Field->m_Italic, Field->m_Bold);
|
|
||||||
|
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( DC );
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
DrawPanel->ManageCurseur = NULL;
|
DrawPanel->ManageCurseur = NULL;
|
||||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
|
@ -213,15 +157,10 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
|
void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
|
||||||
/******************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString Text;
|
wxString Text;
|
||||||
wxString title;
|
wxString title;
|
||||||
EDA_Colors color;
|
|
||||||
int linewidth = (Field->m_Width == 0) ? g_DrawDefaultLineThickness : Field->m_Width;
|
|
||||||
linewidth = Clamp_Text_PenSize( linewidth, Field->m_Size, Field->m_Bold );
|
|
||||||
|
|
||||||
if( Field == NULL )
|
if( Field == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -230,53 +169,49 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
|
||||||
{
|
{
|
||||||
case REFERENCE:
|
case REFERENCE:
|
||||||
title = wxT( "Reference:" );
|
title = wxT( "Reference:" );
|
||||||
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VALUE:
|
case VALUE:
|
||||||
title = wxT( "Component Name / Value:" );
|
title = wxT( "Component Name / Value:" );
|
||||||
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
color = ReturnLayerColor( LAYER_FIELDS );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Field->m_Attributs & TEXT_NO_VISIBLE )
|
|
||||||
color = DARKGRAY;
|
|
||||||
|
|
||||||
Text = Field->m_Text;
|
Text = Field->m_Text;
|
||||||
|
|
||||||
|
/* FIXME: Use wxTextEntry dialog here and check for cancel button. */
|
||||||
Get_Message( title, _( "Edit field" ), Text, this );
|
Get_Message( title, _( "Edit field" ), Text, this );
|
||||||
Text.Replace( wxT( " " ), wxT( "_" ) );
|
Text.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
|
||||||
/* If the value is changed, this is equivalent to create a new component from the old one
|
/* If the value is changed, this is equivalent to create a new component
|
||||||
|
* from the old one.
|
||||||
* So we must check for an existing alias of this "new" component
|
* So we must check for an existing alias of this "new" component
|
||||||
* and change the value only if there is no existing alias with the same name
|
* and change the value only if there is no existing alias with the same
|
||||||
* for this component
|
* name for this component
|
||||||
*/
|
*/
|
||||||
if( Field->m_FieldId == VALUE )
|
if( Field->m_FieldId == VALUE )
|
||||||
{
|
{
|
||||||
/* test for an existing name in alias list: */
|
/* test for an existing name in alias list: */
|
||||||
for( unsigned ii = 0; ii < CurrentLibEntry->m_AliasList.GetCount(); ii += ALIAS_NEXT )
|
for( unsigned ii = 0; ii < CurrentLibEntry->m_AliasList.GetCount();
|
||||||
|
ii += ALIAS_NEXT )
|
||||||
{
|
{
|
||||||
wxString aliasname = CurrentLibEntry->m_AliasList[ii + ALIAS_NAME];
|
wxString aliasname = CurrentLibEntry->m_AliasList[ii + ALIAS_NAME];
|
||||||
|
|
||||||
if( Text.CmpNoCase( aliasname ) == 0 )
|
if( Text.CmpNoCase( aliasname ) == 0 )
|
||||||
{
|
{
|
||||||
DisplayError( this,
|
DisplayError( this, _( "This name is an existing alias of \
|
||||||
_( "This name is an existing alias of the component\nAborting" ), 10 );
|
the component\nAborting" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
wxString fieldText = ReturnFieldFullText( Field );
|
||||||
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
||||||
color, ReturnFieldFullText( Field ),
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText,
|
||||||
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
DefaultTransformMatrix );
|
||||||
Field->m_Size,
|
|
||||||
Field->m_HJustify, Field->m_VJustify, linewidth,
|
|
||||||
Field->m_Italic, Field->m_Bold);
|
|
||||||
|
|
||||||
if( !Text.IsEmpty() )
|
if( !Text.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -284,17 +219,18 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
|
||||||
Field->m_Text = Text;
|
Field->m_Text = Text;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
DisplayError( this, _( "No new text: no change" ) );
|
DisplayError( this, _( "No new text: no change" ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldText = ReturnFieldFullText( Field );
|
||||||
|
int drawMode = g_XorMode;
|
||||||
|
|
||||||
if( Field->m_Flags == 0 )
|
if( Field->m_Flags == 0 )
|
||||||
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
|
drawMode = GR_DEFAULT_DRAWMODE;
|
||||||
|
|
||||||
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, drawMode, &fieldText,
|
||||||
color, ReturnFieldFullText( Field ),
|
DefaultTransformMatrix );
|
||||||
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
||||||
Field->m_Size,
|
|
||||||
Field->m_HJustify, Field->m_VJustify, linewidth,
|
|
||||||
Field->m_Italic, Field->m_Bold);
|
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
|
@ -303,78 +239,50 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/*
|
||||||
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
|
* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ.
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ.
|
|
||||||
* si un champ est en cours d'edition, modif de celui ci.
|
* si un champ est en cours d'edition, modif de celui ci.
|
||||||
* sinon Modif du champ pointe par la souris
|
* sinon Modif du champ pointe par la souris
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
|
||||||
{
|
{
|
||||||
EDA_Colors color;
|
|
||||||
|
|
||||||
if( Field == NULL )
|
if( Field == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
switch( Field->m_FieldId )
|
|
||||||
{
|
|
||||||
case REFERENCE:
|
|
||||||
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VALUE:
|
|
||||||
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
color = ReturnLayerColor( LAYER_FIELDS );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 )
|
|
||||||
color = DARKGRAY;
|
|
||||||
|
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
|
|
||||||
GRSetDrawMode( DC, g_XorMode );
|
GRSetDrawMode( DC, g_XorMode );
|
||||||
int linewidth = (Field->m_Width == 0) ? g_DrawDefaultLineThickness : Field->m_Width;
|
|
||||||
linewidth = Clamp_Text_PenSize( linewidth, Field->m_Size, Field->m_Bold );
|
wxString fieldText = ReturnFieldFullText( Field );
|
||||||
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
||||||
color, ReturnFieldFullText( Field ),
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText,
|
||||||
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
DefaultTransformMatrix );
|
||||||
Field->m_Size,
|
|
||||||
Field->m_HJustify, Field->m_VJustify, linewidth,
|
|
||||||
Field->m_Italic, Field->m_Bold);
|
|
||||||
|
|
||||||
if( Field->m_Orient )
|
if( Field->m_Orient )
|
||||||
Field->m_Orient = 0;
|
Field->m_Orient = 0;
|
||||||
else
|
else
|
||||||
Field->m_Orient = 1;
|
Field->m_Orient = 1;
|
||||||
|
|
||||||
if( Field->m_Flags == 0 )
|
int drawMode = g_XorMode;
|
||||||
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
|
|
||||||
|
if( Field->m_Flags == 0 )
|
||||||
|
drawMode = GR_DEFAULT_DRAWMODE;
|
||||||
|
|
||||||
|
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, drawMode, &fieldText,
|
||||||
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
||||||
color, ReturnFieldFullText( Field ),
|
|
||||||
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
||||||
Field->m_Size,
|
|
||||||
Field->m_HJustify, Field->m_VJustify, linewidth,
|
|
||||||
Field->m_Italic, Field->m_Bold);
|
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( DC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/*
|
||||||
LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry )
|
* Locate the component fiels (ref, name or auxiliary fields) under the
|
||||||
/****************************************************************************/
|
* mouse cursor
|
||||||
|
|
||||||
/* Locate the component fiels (ref, name or auxiliary fields) under the mouse cursor
|
|
||||||
* return:
|
* return:
|
||||||
* pointer on the field (or NULL )
|
* pointer on the field (or NULL )
|
||||||
*/
|
*/
|
||||||
|
LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry )
|
||||||
{
|
{
|
||||||
wxPoint refpos = GetScreen()->m_Curseur;
|
wxPoint refpos = GetScreen()->m_Curseur;
|
||||||
/* Test reference */
|
/* Test reference */
|
||||||
|
@ -386,7 +294,8 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
|
||||||
return &LibEntry->m_Prefix;
|
return &LibEntry->m_Prefix;
|
||||||
|
|
||||||
/* Test others fields */
|
/* Test others fields */
|
||||||
for( LibDrawField* field = LibEntry->m_Fields; field; field = field->Next() )
|
for( LibDrawField* field = LibEntry->m_Fields; field != NULL;
|
||||||
|
field = field->Next() )
|
||||||
{
|
{
|
||||||
if( field->m_Text.IsEmpty() )
|
if( field->m_Text.IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -399,38 +308,39 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
|
||||||
LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
|
LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
|
||||||
/********************************************************************************/
|
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
|
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) // Simple localisation des elements
|
if( ( DrawEntry == NULL ) || ( DrawEntry->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
DrawEntry = LocatePin(
|
DrawEntry = LocatePin( GetScreen()->m_Curseur, CurrentLibEntry,
|
||||||
GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert );
|
CurrentUnit, CurrentConvert );
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
DrawEntry = CurrentDrawItem =
|
||||||
GetScreen()->m_MousePosition,
|
LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
||||||
CurrentLibEntry, CurrentUnit,
|
GetScreen()->m_MousePosition,
|
||||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
CurrentLibEntry, CurrentUnit,
|
||||||
|
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
DrawEntry = CurrentDrawItem =
|
||||||
GetScreen()->m_Curseur, CurrentLibEntry,
|
LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
||||||
CurrentUnit,
|
GetScreen()->m_Curseur, CurrentLibEntry,
|
||||||
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
CurrentUnit, CurrentConvert,
|
||||||
|
LOCATE_ALL_DRAW_ITEM );
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
|
DrawEntry = CurrentDrawItem =
|
||||||
LocateField( CurrentLibEntry );
|
(LibEDA_BaseStruct*) LocateField( CurrentLibEntry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DrawEntry;
|
return DrawEntry;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
|
||||||
// Give an icon
|
// Give an icon
|
||||||
SetIcon( wxIcon( libedit_xpm ) );
|
SetIcon( wxIcon( libedit_xpm ) );
|
||||||
SetBaseScreen( g_ScreenLib );
|
SetBaseScreen( g_ScreenLib );
|
||||||
GetScreen()->m_Center = true; // set to true to have the coordinates origine -0,0) centered on screen
|
GetScreen()->m_Center = true;
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
if( DrawPanel )
|
if( DrawPanel )
|
||||||
|
@ -181,9 +181,7 @@ void WinEDA_LibeditFrame::SaveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
|
void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
LibraryStruct* Lib;
|
LibraryStruct* Lib;
|
||||||
|
|
||||||
|
@ -218,13 +216,14 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/*
|
||||||
void WinEDA_LibeditFrame::SetToolbars()
|
* Enable or disable tools of the differents toolbars, according to the
|
||||||
/******************************************/
|
* current conditions or options.
|
||||||
|
*
|
||||||
/* Enable or disable tools of the differents toolbars,
|
* FIXME: Get rid of this function and use WX_UPDATE_UI to handle enabling of
|
||||||
* according to the current conditions or options
|
* menu and toolbar items.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_LibeditFrame::SetToolbars()
|
||||||
{
|
{
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -282,7 +281,8 @@ void WinEDA_LibeditFrame::SetToolbars()
|
||||||
else
|
else
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, false );
|
m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, false );
|
||||||
|
|
||||||
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
|
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN,
|
||||||
|
g_EditPinByPinIsOn );
|
||||||
|
|
||||||
m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, g_AsDeMorgan );
|
m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, g_AsDeMorgan );
|
||||||
m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, g_AsDeMorgan );
|
m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, g_AsDeMorgan );
|
||||||
|
@ -290,7 +290,8 @@ void WinEDA_LibeditFrame::SetToolbars()
|
||||||
bool enable_dtool = false;
|
bool enable_dtool = false;
|
||||||
if( !CurrentAliasName.IsEmpty() )
|
if( !CurrentAliasName.IsEmpty() )
|
||||||
{
|
{
|
||||||
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName );
|
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList,
|
||||||
|
CurrentAliasName );
|
||||||
if( AliasLocation >= 0 )
|
if( AliasLocation >= 0 )
|
||||||
if( !CurrentLibEntry->m_AliasList[AliasLocation +
|
if( !CurrentLibEntry->m_AliasList[AliasLocation +
|
||||||
ALIAS_DOC_FILENAME].IsEmpty() )
|
ALIAS_DOC_FILENAME].IsEmpty() )
|
||||||
|
@ -307,8 +308,10 @@ void WinEDA_LibeditFrame::SetToolbars()
|
||||||
|
|
||||||
if( GetScreen() )
|
if( GetScreen() )
|
||||||
{
|
{
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_UNDO, GetScreen()->GetUndoCommandCount() );
|
m_HToolBar->EnableTool( ID_LIBEDIT_UNDO,
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_REDO, GetScreen()->GetRedoCommandCount() );
|
GetScreen()->GetUndoCommandCount() );
|
||||||
|
m_HToolBar->EnableTool( ID_LIBEDIT_REDO,
|
||||||
|
GetScreen()->GetRedoCommandCount() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,9 +333,7 @@ void WinEDA_LibeditFrame::SetToolbars()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
|
||||||
int WinEDA_LibeditFrame::BestZoom()
|
int WinEDA_LibeditFrame::BestZoom()
|
||||||
/**************************************/
|
|
||||||
{
|
{
|
||||||
int dx, dy, ii, jj;
|
int dx, dy, ii, jj;
|
||||||
int bestzoom;
|
int bestzoom;
|
||||||
|
@ -341,7 +342,8 @@ int WinEDA_LibeditFrame::BestZoom()
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
{
|
{
|
||||||
BoundaryBox = CurrentLibEntry->GetBoundaryBox( CurrentUnit, CurrentConvert );
|
BoundaryBox = CurrentLibEntry->GetBoundaryBox( CurrentUnit,
|
||||||
|
CurrentConvert );
|
||||||
dx = BoundaryBox.GetWidth();
|
dx = BoundaryBox.GetWidth();
|
||||||
dy = BoundaryBox.GetHeight();
|
dy = BoundaryBox.GetHeight();
|
||||||
}
|
}
|
||||||
|
@ -383,9 +385,7 @@ void WinEDA_LibeditFrame::OnUpdateNotEditingPart( wxUpdateUIEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
/*************************************************************************/
|
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
@ -514,15 +514,18 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxString docfilename;
|
wxString docfilename;
|
||||||
if( !CurrentAliasName.IsEmpty() )
|
if( !CurrentAliasName.IsEmpty() )
|
||||||
{
|
{
|
||||||
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName );
|
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList,
|
||||||
|
CurrentAliasName );
|
||||||
if( AliasLocation >= 0 )
|
if( AliasLocation >= 0 )
|
||||||
docfilename = CurrentLibEntry->m_AliasList[AliasLocation + ALIAS_DOC_FILENAME];
|
docfilename =
|
||||||
|
CurrentLibEntry->m_AliasList[AliasLocation + ALIAS_DOC_FILENAME];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
docfilename = CurrentLibEntry->m_DocFile;
|
docfilename = CurrentLibEntry->m_DocFile;
|
||||||
|
|
||||||
if( !docfilename.IsEmpty() )
|
if( !docfilename.IsEmpty() )
|
||||||
GetAssociatedDocument( this, docfilename, & wxGetApp().GetLibraryPathList() );
|
GetAssociatedDocument( this, docfilename,
|
||||||
|
&wxGetApp().GetLibraryPathList() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -667,7 +670,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
|
|
||||||
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
|
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
|
||||||
|
|
||||||
// Delete the last created segment, while creating a polyline draw item
|
// Delete the last created segment, while creating a polyline draw item
|
||||||
if( CurrentDrawItem == NULL )
|
if( CurrentDrawItem == NULL )
|
||||||
break;
|
break;
|
||||||
|
@ -690,7 +692,8 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
else
|
else
|
||||||
DeleteOneLibraryDrawStruct( DrawPanel, &dc, CurrentLibEntry, CurrentDrawItem, true );
|
CurrentLibEntry->RemoveDrawItem( CurrentDrawItem, DrawPanel,
|
||||||
|
&dc );
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentDrawItem = NULL;
|
CurrentDrawItem = NULL;
|
||||||
|
@ -798,7 +801,8 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( this, wxT( "WinEDA_LibeditFrame::Process_Special_Functions error" ) );
|
DisplayError( this,
|
||||||
|
wxT( "WinEDA_LibeditFrame::Process_Special_Functions error" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,24 +20,29 @@
|
||||||
////@begin XPM images
|
////@begin XPM images
|
||||||
////@end XPM images
|
////@end XPM images
|
||||||
|
|
||||||
/*****************************************************************************************/
|
void InstallPineditFrame( WinEDA_LibeditFrame* parent, wxDC* DC,
|
||||||
void InstallPineditFrame(WinEDA_LibeditFrame * parent, wxDC * DC, const wxPoint & pos)
|
const wxPoint & pos )
|
||||||
/*****************************************************************************************/
|
|
||||||
{
|
{
|
||||||
wxPoint MousePos = parent->GetScreen()->m_Curseur;
|
wxPoint MousePos = parent->GetScreen()->m_Curseur;
|
||||||
int accept = TRUE;
|
int accept = TRUE;
|
||||||
if ( (CurrentDrawItem == NULL) || (CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) )
|
|
||||||
|
if ( ( CurrentDrawItem == NULL )
|
||||||
|
|| ( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) )
|
||||||
{
|
{
|
||||||
LibDrawPin * Pin = (LibDrawPin *) CurrentDrawItem;
|
LibDrawPin * Pin = (LibDrawPin *) CurrentDrawItem;
|
||||||
WinEDA_PinPropertiesFrame * frame = new WinEDA_PinPropertiesFrame(parent);
|
WinEDA_PinPropertiesFrame dlg( parent );
|
||||||
accept = frame->ShowModal(); frame->Destroy();
|
accept = dlg.ShowModal();
|
||||||
if ( !accept && Pin && ( Pin->m_Flags & IS_NEW ) ) // Abord create new pin
|
|
||||||
|
if ( !accept && Pin && ( Pin->m_Flags & IS_NEW ) )
|
||||||
{
|
{
|
||||||
if ( parent->DrawPanel->ForceCloseManageCurseur && DC)
|
if ( parent->DrawPanel->ForceCloseManageCurseur && DC )
|
||||||
parent->DrawPanel->ForceCloseManageCurseur(parent->DrawPanel, DC);
|
parent->DrawPanel->ForceCloseManageCurseur( parent->DrawPanel,
|
||||||
|
DC );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else DisplayError(parent, wxT("Error: Not a Pin!") );
|
else
|
||||||
|
DisplayError( parent, wxT( "Error: Not a Pin!" ) );
|
||||||
|
|
||||||
parent->GetScreen()->m_Curseur = MousePos;
|
parent->GetScreen()->m_Curseur = MousePos;
|
||||||
parent->DrawPanel->MouseToCursorSchema();
|
parent->DrawPanel->MouseToCursorSchema();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ static wxString shape_list[NBSHAPES] =
|
||||||
|
|
||||||
int CodeShape[NBSHAPES] =
|
int CodeShape[NBSHAPES] =
|
||||||
{
|
{
|
||||||
NONE, INVERT, CLOCK, CLOCK | INVERT, LOWLEVEL_IN, LOWLEVEL_IN | CLOCK, LOWLEVEL_OUT
|
NONE, INVERT, CLOCK, CLOCK | INVERT, LOWLEVEL_IN, LOWLEVEL_IN | CLOCK,
|
||||||
|
LOWLEVEL_OUT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,9 +39,9 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
/* Variables locales */
|
/* Variables locales */
|
||||||
static wxPoint OldPos, PinPreviousPos;
|
static wxPoint OldPos, PinPreviousPos;
|
||||||
static int LastPinType = PIN_INPUT,
|
static int LastPinType = PIN_INPUT,
|
||||||
LastPinOrient = PIN_RIGHT,
|
LastPinOrient = PIN_RIGHT,
|
||||||
LastPinShape = NONE,
|
LastPinShape = NONE,
|
||||||
LastPinSize = 300,
|
LastPinSize = 300,
|
||||||
LastPinNameSize = 50,
|
LastPinNameSize = 50,
|
||||||
LastPinNumSize = 50,
|
LastPinNumSize = 50,
|
||||||
|
@ -97,7 +98,6 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
|
||||||
CurrentDrawItem->DisplayInfo( m_Parent );
|
CurrentDrawItem->DisplayInfo( m_Parent );
|
||||||
}
|
}
|
||||||
|
|
||||||
Close();
|
|
||||||
m_Parent->DrawPanel->Refresh();
|
m_Parent->DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +154,7 @@ static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
|
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
|
||||||
|
|
||||||
if( CurrentPin && ( CurrentPin->m_Flags & IS_NEW ) )
|
if( CurrentPin && ( CurrentPin->m_Flags & IS_NEW ) )
|
||||||
DeleteOneLibraryDrawStruct( Panel, DC, CurrentLibEntry,
|
CurrentLibEntry->RemoveDrawItem( CurrentPin, Panel, DC );
|
||||||
CurrentPin, true );
|
|
||||||
|
|
||||||
/* clear edit flags */
|
/* clear edit flags */
|
||||||
LibEDA_BaseStruct* item = CurrentLibEntry->m_Drawings;
|
LibEDA_BaseStruct* item = CurrentLibEntry->m_Drawings;
|
||||||
|
@ -240,8 +239,9 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
bool showPinText = true;
|
||||||
CurrentPin, GR_DEFAULT_DRAWMODE );
|
CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
|
||||||
|
&showPinText, DefaultTransformMatrix );
|
||||||
DrawPanel->CursorOn( DC );
|
DrawPanel->CursorOn( DC );
|
||||||
|
|
||||||
CurrentDrawItem = NULL;
|
CurrentDrawItem = NULL;
|
||||||
|
@ -330,20 +330,21 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
|
LibDrawPin* CurrentPin = (LibDrawPin*) CurrentDrawItem;
|
||||||
wxPoint pinpos = CurrentPin->m_Pos;
|
wxPoint pinpos = CurrentPin->m_Pos;
|
||||||
|
bool showPinText = true;
|
||||||
|
|
||||||
/* Erase pin in old position */
|
/* Erase pin in old position */
|
||||||
if( erase || ( CurrentPin->m_Flags & IS_NEW ) )
|
if( erase || ( CurrentPin->m_Flags & IS_NEW ) )
|
||||||
{
|
{
|
||||||
CurrentPin->m_Pos = PinPreviousPos;
|
CurrentPin->m_Pos = PinPreviousPos;
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0),
|
CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
||||||
CurrentPin, g_XorMode );
|
&showPinText, DefaultTransformMatrix );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw pin in new position */
|
/* Redraw pin in new position */
|
||||||
CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x;
|
CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x;
|
||||||
CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y;
|
CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y;
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
CurrentPin->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
||||||
CurrentPin, g_XorMode );
|
&showPinText, DefaultTransformMatrix );
|
||||||
|
|
||||||
PinPreviousPos = CurrentPin->m_Pos;
|
PinPreviousPos = CurrentPin->m_Pos;
|
||||||
|
|
||||||
|
@ -514,13 +515,11 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
|
||||||
LibEDA_BaseStruct* DrawItem;
|
LibEDA_BaseStruct* DrawItem;
|
||||||
wxPoint PinPos;
|
wxPoint PinPos;
|
||||||
|
|
||||||
if( LibEntry == NULL )
|
if( LibEntry == NULL || Pin == NULL )
|
||||||
return;
|
|
||||||
if( Pin == NULL )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PinPos = Pin->m_Pos;
|
PinPos = Pin->m_Pos;
|
||||||
DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, true );
|
LibEntry->RemoveDrawItem( (LibEDA_BaseStruct*) Pin, DrawPanel, DC );
|
||||||
|
|
||||||
/* Effacement des autres pins de meme coordonnees */
|
/* Effacement des autres pins de meme coordonnees */
|
||||||
if( g_EditPinByPinIsOn == false )
|
if( g_EditPinByPinIsOn == false )
|
||||||
|
@ -537,7 +536,7 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
|
||||||
DrawItem = DrawItem->Next();
|
DrawItem = DrawItem->Next();
|
||||||
if( Pin->m_Pos != PinPos )
|
if( Pin->m_Pos != PinPos )
|
||||||
continue;
|
continue;
|
||||||
DeleteOneLibraryDrawStruct( DrawPanel, DC, LibEntry, Pin, 0 );
|
LibEntry->RemoveDrawItem( (LibEDA_BaseStruct*) Pin );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
@ -551,6 +550,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* DrawItem;
|
LibEDA_BaseStruct* DrawItem;
|
||||||
LibDrawPin* CurrentPin;
|
LibDrawPin* CurrentPin;
|
||||||
|
bool showPinText = true;
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -599,8 +599,8 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
|
||||||
CurrentLibEntry->SortDrawItems();
|
CurrentLibEntry->SortDrawItems();
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry,
|
CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
||||||
wxPoint(0, 0), CurrentPin, g_XorMode );
|
&showPinText, DefaultTransformMatrix );
|
||||||
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = true;
|
DrawPanel->m_IgnoreMouseEvents = true;
|
||||||
InstallPineditFrame( this, DC, wxPoint( -1, -1 ) );
|
InstallPineditFrame( this, DC, wxPoint( -1, -1 ) );
|
||||||
|
@ -673,8 +673,8 @@ void WinEDA_PinPropertiesFrame::SetAttributsPin( bool draw,
|
||||||
continue;
|
continue;
|
||||||
if( Pin->m_Orient != CurrentPin->m_Orient )
|
if( Pin->m_Orient != CurrentPin->m_Orient )
|
||||||
continue;
|
continue;
|
||||||
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL,
|
|
||||||
CurrentLibEntry, Pin, 0 );
|
CurrentLibEntry->RemoveDrawItem( (LibEDA_BaseStruct*) Pin );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end if unit
|
} // end if unit
|
||||||
|
@ -705,8 +705,8 @@ void WinEDA_PinPropertiesFrame::SetAttributsPin( bool draw,
|
||||||
continue;
|
continue;
|
||||||
if( Pin->m_Orient != CurrentPin->m_Orient )
|
if( Pin->m_Orient != CurrentPin->m_Orient )
|
||||||
continue;
|
continue;
|
||||||
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL,
|
|
||||||
CurrentLibEntry, Pin, 0 );
|
CurrentLibEntry->RemoveDrawItem( (LibEDA_BaseStruct*) Pin );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end if convert
|
} // end if convert
|
||||||
|
@ -848,8 +848,9 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
|
||||||
{
|
{
|
||||||
LibDrawPin* Pin;
|
LibDrawPin* Pin;
|
||||||
bool selected = ( MasterPin->m_Selected & IS_SELECTED ) != 0;
|
bool selected = ( MasterPin->m_Selected & IS_SELECTED ) != 0;
|
||||||
|
bool showPinText = true;
|
||||||
|
|
||||||
if( (CurrentLibEntry == NULL) || (MasterPin == NULL) )
|
if( ( CurrentLibEntry == NULL ) || ( MasterPin == NULL ) )
|
||||||
return;
|
return;
|
||||||
if( MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE )
|
if( MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE )
|
||||||
return;
|
return;
|
||||||
|
@ -868,8 +869,8 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
|
||||||
if( selected && (Pin->m_Selected & IS_SELECTED) == 0 )
|
if( selected && (Pin->m_Selected & IS_SELECTED) == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry,
|
Pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
||||||
wxPoint( 0, 0 ), Pin, g_XorMode );
|
&showPinText, DefaultTransformMatrix );
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
@ -886,7 +887,8 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), Pin, GR_DEFAULT_DRAWMODE );
|
Pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
|
||||||
|
&showPinText, DefaultTransformMatrix );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1006,9 +1008,9 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry )
|
||||||
error++;
|
error++;
|
||||||
curr_pin->ReturnPinStringNum( StringPinNum );
|
curr_pin->ReturnPinStringNum( StringPinNum );
|
||||||
msg.Printf( _( "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)" ),
|
msg.Printf( _( "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)" ),
|
||||||
StringPinNum.GetData(),
|
StringPinNum.GetData(), curr_pin->m_PinName.GetData(),
|
||||||
curr_pin->m_PinName.GetData(), curr_pin->m_Pos.x, -curr_pin->m_Pos.y,
|
curr_pin->m_Pos.x, -curr_pin->m_Pos.y,
|
||||||
Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y );
|
Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y );
|
||||||
|
|
||||||
if( CurrentLibEntry->m_UnitCount > 1 )
|
if( CurrentLibEntry->m_UnitCount > 1 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,23 +57,6 @@ void DrawingLibInGhost( WinEDA_DrawPanel* panel,
|
||||||
int Color,
|
int Color,
|
||||||
bool DrawPinText );
|
bool DrawPinText );
|
||||||
|
|
||||||
void DrawLibEntry( WinEDA_DrawPanel* panel,
|
|
||||||
wxDC* DC,
|
|
||||||
EDA_LibComponentStruct* LibEntry,
|
|
||||||
const wxPoint& aOffset,
|
|
||||||
int Multi,
|
|
||||||
int convert,
|
|
||||||
int DrawMode,
|
|
||||||
int Color = -1 );
|
|
||||||
|
|
||||||
void DrawLibraryDrawStruct( WinEDA_DrawPanel* aPanel,
|
|
||||||
wxDC* aDC,
|
|
||||||
EDA_LibComponentStruct* aLibEntry,
|
|
||||||
wxPoint aPosition,
|
|
||||||
LibEDA_BaseStruct* aDrawItem,
|
|
||||||
int aDrawMode,
|
|
||||||
int aColor = -1 );
|
|
||||||
|
|
||||||
bool MapAngles( int* Angle1,
|
bool MapAngles( int* Angle1,
|
||||||
int* Angle2,
|
int* Angle2,
|
||||||
const int TransMat[2][2] );
|
const int TransMat[2][2] );
|
||||||
|
@ -283,21 +266,6 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||||
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Window );
|
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Window );
|
||||||
void DeleteAllMarkers( int type );
|
void DeleteAllMarkers( int type );
|
||||||
|
|
||||||
/* Effacement des marqueurs du type "type" */
|
|
||||||
|
|
||||||
void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel,
|
|
||||||
wxDC* DC, EDA_LibComponentStruct* LibEntry,
|
|
||||||
LibEDA_BaseStruct* DrawItem, int Affiche );
|
|
||||||
|
|
||||||
/* Routine d'effacement d'un "LibraryDrawStruct"
|
|
||||||
* (d'un element de dessin d'un composant )
|
|
||||||
* Parametres d'entree
|
|
||||||
* Pointeur sur le composant comportant la structure
|
|
||||||
* (Si NULL la structure a effacer est supposee non rattachee
|
|
||||||
* a un composant)
|
|
||||||
* Pointeur sur la structure a effacer
|
|
||||||
* Affiche (si != 0 Efface le graphique correspondant de l'ecran) */
|
|
||||||
|
|
||||||
|
|
||||||
/**************/
|
/**************/
|
||||||
/* GETPART.CPP */
|
/* GETPART.CPP */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* EESchema - symbdraw.cpp */
|
/* EESchema - symbdraw.cpp */
|
||||||
/* Create, move .. graphic shapes used to build and draw a component */
|
/* Create, move .. graphic shapes used to build and draw a component */
|
||||||
/* (lines, arcs .. */
|
/* (lines, arcs .. */
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -60,12 +60,8 @@ void WinEDA_bodygraphics_PropertiesFrame::bodygraphics_PropertiesAccept( wxComma
|
||||||
|
|
||||||
m_Parent->DrawPanel->PrepareGraphicContext( &dc );
|
m_Parent->DrawPanel->PrepareGraphicContext( &dc );
|
||||||
|
|
||||||
DrawLibraryDrawStruct( m_Parent->DrawPanel,
|
CurrentDrawItem->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ), -1,
|
||||||
&dc,
|
g_XorMode, NULL, DefaultTransformMatrix );
|
||||||
CurrentLibEntry,
|
|
||||||
wxPoint( 0, 0 ),
|
|
||||||
CurrentDrawItem,
|
|
||||||
g_XorMode );
|
|
||||||
|
|
||||||
if( g_FlDrawSpecificUnit )
|
if( g_FlDrawSpecificUnit )
|
||||||
CurrentDrawItem->m_Unit = CurrentUnit;
|
CurrentDrawItem->m_Unit = CurrentUnit;
|
||||||
|
@ -113,12 +109,8 @@ void WinEDA_bodygraphics_PropertiesFrame::bodygraphics_PropertiesAccept( wxComma
|
||||||
|
|
||||||
m_Parent->GetScreen()->SetModify();
|
m_Parent->GetScreen()->SetModify();
|
||||||
|
|
||||||
DrawLibraryDrawStruct( m_Parent->DrawPanel,
|
CurrentDrawItem->Draw( m_Parent->DrawPanel, &dc, wxPoint( 0, 0 ),
|
||||||
&dc,
|
-1, g_XorMode, NULL, DefaultTransformMatrix );
|
||||||
CurrentLibEntry,
|
|
||||||
wxPoint( 0, 0 ),
|
|
||||||
CurrentDrawItem,
|
|
||||||
g_XorMode );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
|
@ -164,8 +156,11 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
Panel->m_Parent->RedrawActiveWindow( DC, TRUE );
|
Panel->m_Parent->RedrawActiveWindow( DC, TRUE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
{
|
||||||
CurrentDrawItem, g_XorMode );
|
CurrentDrawItem->Draw( Panel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
||||||
|
NULL, DefaultTransformMatrix );
|
||||||
|
}
|
||||||
|
|
||||||
SAFE_DELETE( CurrentDrawItem );
|
SAFE_DELETE( CurrentDrawItem );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -175,9 +170,9 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
Panel->GetScreen()->m_Curseur = StartCursor;
|
Panel->GetScreen()->m_Curseur = StartCursor;
|
||||||
RedrawWhileMovingCursor( Panel, DC, TRUE );
|
RedrawWhileMovingCursor( Panel, DC, TRUE );
|
||||||
Panel->GetScreen()->m_Curseur = curpos;
|
Panel->GetScreen()->m_Curseur = curpos;
|
||||||
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
CurrentDrawItem->Draw( Panel, DC, wxPoint( 0, 0 ), -1,
|
||||||
CurrentDrawItem, GR_DEFAULT_DRAWMODE );
|
GR_DEFAULT_DRAWMODE, NULL,
|
||||||
|
DefaultTransformMatrix );
|
||||||
CurrentDrawItem->m_Flags = 0;
|
CurrentDrawItem->m_Flags = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,9 +306,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( EDA_LibComponentStruc
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StartMoveDrawSymbol( DC );
|
StartMoveDrawSymbol( DC );
|
||||||
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry,
|
Text->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
|
||||||
wxPoint( 0, 0 ),
|
DefaultTransformMatrix );
|
||||||
Text, g_XorMode );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -400,15 +394,15 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
||||||
/* Erase shape in the old positon*/
|
/* Erase shape in the old positon*/
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
pos = ItemPreviousPos - StartCursor,
|
pos = ItemPreviousPos - StartCursor;
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, pos,
|
CurrentDrawItem->Draw( panel, DC, pos, -1, g_XorMode, NULL,
|
||||||
CurrentDrawItem, g_XorMode );
|
DefaultTransformMatrix );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw moved shape */
|
/* Redraw moved shape */
|
||||||
pos = Screen->m_Curseur - StartCursor,
|
pos = Screen->m_Curseur - StartCursor;
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, pos,
|
CurrentDrawItem->Draw( panel, DC, pos, -1, g_XorMode, NULL,
|
||||||
CurrentDrawItem, g_XorMode );
|
DefaultTransformMatrix );
|
||||||
ItemPreviousPos = Screen->m_Curseur;
|
ItemPreviousPos = Screen->m_Curseur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,7 +508,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
/* Routine de Gestion des evenements souris lors de la creation */
|
/* Routine de Gestion des evenements souris lors de la creation */
|
||||||
/* d'un nouvel element type LibraryDrawStruct */
|
/* d'un nouvel element type LibraryDrawStruct */
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
|
@ -543,8 +537,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
CurrentDrawItem->Draw( panel, DC, wxPoint( 0, 0 ), -1, DrawMode,
|
||||||
CurrentDrawItem, DrawMode );
|
NULL, DefaultTransformMatrix );
|
||||||
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
|
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
|
||||||
{
|
{
|
||||||
int Color = ReturnLayerColor( LAYER_DEVICE );
|
int Color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
|
@ -621,8 +615,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
CurrentDrawItem->Draw( panel, DC, wxPoint( 0, 0 ), -1, DrawMode,
|
||||||
CurrentDrawItem, DrawMode );
|
NULL, DefaultTransformMatrix );
|
||||||
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
|
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
|
||||||
{
|
{
|
||||||
int Color = ReturnLayerColor( LAYER_DEVICE );
|
int Color = ReturnLayerColor( LAYER_DEVICE );
|
||||||
|
@ -719,8 +713,8 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
|
||||||
MoveLibDrawItemAt( CurrentDrawItem, pos );
|
MoveLibDrawItemAt( CurrentDrawItem, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawLibEntry( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ), CurrentUnit,
|
CurrentLibEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), CurrentUnit,
|
||||||
CurrentConvert, GR_DEFAULT_DRAWMODE );
|
CurrentConvert, GR_DEFAULT_DRAWMODE );
|
||||||
|
|
||||||
CurrentDrawItem->m_Flags = 0;
|
CurrentDrawItem->m_Flags = 0;
|
||||||
CurrentDrawItem = NULL;
|
CurrentDrawItem = NULL;
|
||||||
|
@ -824,15 +818,14 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
|
||||||
/* Used for deleting last entered segment while creating a Polyline
|
/* Used for deleting last entered segment while creating a Polyline
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( CurrentDrawItem == NULL )
|
if( CurrentDrawItem == NULL
|
||||||
return;
|
|| CurrentDrawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE )
|
||||||
if( CurrentDrawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LibDrawPolyline* Poly = (LibDrawPolyline*) CurrentDrawItem;
|
LibDrawPolyline* Poly = (LibDrawPolyline*) CurrentDrawItem;
|
||||||
|
|
||||||
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
CurrentDrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
||||||
CurrentDrawItem, g_XorMode );
|
NULL, DefaultTransformMatrix );
|
||||||
|
|
||||||
while( Poly->GetCornerCount() > 2 ) // First segment is kept, only its end point is changed
|
while( Poly->GetCornerCount() > 2 ) // First segment is kept, only its end point is changed
|
||||||
{
|
{
|
||||||
|
@ -847,6 +840,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint( 0, 0 ),
|
CurrentDrawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode,
|
||||||
CurrentDrawItem, g_XorMode );
|
NULL, DefaultTransformMatrix );
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
/* fichier symbedit.cpp */
|
/* fichier symbedit.cpp */
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
|
@ -22,12 +21,9 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/* Routines locales */
|
|
||||||
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
||||||
LibEDA_BaseStruct* DEntryCompare );
|
LibEDA_BaseStruct* DEntryCompare );
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a component shape file (a symbol file *.sym )and add data (graphic
|
* Read a component shape file (a symbol file *.sym )and add data (graphic
|
||||||
|
@ -40,10 +36,9 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* Component;
|
EDA_LibComponentStruct* Component;
|
||||||
LibEDA_BaseStruct* DrawEntry;
|
LibEDA_BaseStruct* DrawEntry;
|
||||||
wxString FullFileName, mask;
|
FILE* ImportFile;
|
||||||
FILE* ImportFile;
|
wxString msg, err;
|
||||||
wxString msg, err;
|
LibraryStruct* Lib;
|
||||||
LibraryStruct* Lib;
|
|
||||||
|
|
||||||
/* Exit if no library entry is selected or a command is in progress. */
|
/* Exit if no library entry is selected or a command is in progress. */
|
||||||
if( CurrentLibEntry == NULL
|
if( CurrentLibEntry == NULL
|
||||||
|
@ -52,36 +47,29 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
|
||||||
|
|
||||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||||
|
|
||||||
mask = wxT( "*" ) + g_SymbolExtBuffer;
|
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
|
||||||
wxString default_lib_path = wxGetApp().ReturnLastVisitedLibraryPath();
|
|
||||||
|
|
||||||
FullFileName = EDA_FileSelector( _( "Import symbol drawings:" ),
|
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
|
||||||
default_lib_path, /* Chemin par defaut */
|
wxEmptyString, SymbolFileWildcard,
|
||||||
wxEmptyString, /* nom fichier par defaut */
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
g_SymbolExtBuffer, /* extension par defaut */
|
|
||||||
mask, /* Masque d'affichage */
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
this,
|
return;
|
||||||
0,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
|
|
||||||
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||||
|
|
||||||
if( FullFileName.IsEmpty() )
|
wxFileName fn = dlg.GetPath();
|
||||||
return;
|
|
||||||
|
|
||||||
wxFileName fn = FullFileName;
|
|
||||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||||
|
|
||||||
/* Load data */
|
/* Load data */
|
||||||
ImportFile = wxFopen( FullFileName, wxT( "rt" ) );
|
ImportFile = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
|
||||||
|
|
||||||
if( ImportFile == NULL )
|
if( ImportFile == NULL )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Failed to open Symbol File <%s>" ),
|
msg.Printf( _( "Failed to open Symbol File <%s>" ),
|
||||||
(const wxChar*) FullFileName );
|
(const wxChar*) fn.GetFullPath() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -164,43 +152,43 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::SaveOneSymbol()
|
void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* LibEntry = CurrentLibEntry;
|
LibEDA_BaseStruct* DrawEntry;
|
||||||
int Unit = CurrentUnit, convert = CurrentConvert;
|
wxString msg;
|
||||||
LibEDA_BaseStruct* DrawEntry;
|
FILE* ExportFile;
|
||||||
wxString FullFileName, mask;
|
|
||||||
wxString msg;
|
|
||||||
FILE* ExportFile;
|
|
||||||
|
|
||||||
if( LibEntry->m_Drawings == NULL )
|
if( CurrentLibEntry->m_Drawings == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Creation du fichier symbole */
|
/* Creation du fichier symbole */
|
||||||
wxString default_lib_path = wxGetApp().ReturnLastVisitedLibraryPath();
|
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
|
||||||
mask = wxT( "*" ) + g_SymbolExtBuffer;
|
|
||||||
FullFileName = EDA_FileSelector( _( "Export symbol drawings:" ),
|
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
|
||||||
default_lib_path, /* Chemin par defaut */
|
CurrentLibEntry->m_Name.m_Text, SymbolFileWildcard,
|
||||||
wxEmptyString, /* nom fichier par defaut */
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
g_SymbolExtBuffer, /* extension par defaut */
|
|
||||||
mask, /* Masque d'affichage */
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
this,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxFileName fn = FullFileName;
|
wxFileName fn = dlg.GetPath();
|
||||||
|
|
||||||
|
/* The GTK file chooser doesn't return the file extension added to
|
||||||
|
* file name so add it here. */
|
||||||
|
if( fn.GetExt().IsEmpty() )
|
||||||
|
fn.SetExt( SymbolFileExtension );
|
||||||
|
|
||||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||||
|
|
||||||
ExportFile = wxFopen( FullFileName, wxT( "wt" ) );
|
ExportFile = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
||||||
|
|
||||||
if( ExportFile == NULL )
|
if( ExportFile == NULL )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Unable to create <%s>" ), FullFileName.GetData() );
|
msg.Printf( _( "Unable to create <%s>" ),
|
||||||
|
(const wxChar*) fn.GetFullPath() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Printf( _( "Save Symbol in [%s]" ), FullFileName.GetData() );
|
msg.Printf( _( "Save Symbol in [%s]" ), (const wxChar*) fn.GetPath() );
|
||||||
Affiche_Message( msg );
|
Affiche_Message( msg );
|
||||||
|
|
||||||
/* Creation de l'entete de la librairie */
|
/* Creation de l'entete de la librairie */
|
||||||
|
@ -211,39 +199,40 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
|
|
||||||
/* Creation du commentaire donnant le nom du composant */
|
/* Creation du commentaire donnant le nom du composant */
|
||||||
fprintf( ExportFile, "# SYMBOL %s\n#\n",
|
fprintf( ExportFile, "# SYMBOL %s\n#\n",
|
||||||
(const char*) LibEntry->m_Name.m_Text.GetData() );
|
CONV_TO_UTF8( CurrentLibEntry->m_Name.m_Text ) );
|
||||||
|
|
||||||
/* Generation des lignes utiles */
|
/* Generation des lignes utiles */
|
||||||
fprintf( ExportFile, "DEF %s",
|
fprintf( ExportFile, "DEF %s",
|
||||||
(const char*) LibEntry->m_Name.m_Text.GetData() );
|
CONV_TO_UTF8( CurrentLibEntry->m_Name.m_Text ) );
|
||||||
if( !LibEntry->m_Prefix.m_Text.IsEmpty() )
|
if( !CurrentLibEntry->m_Prefix.m_Text.IsEmpty() )
|
||||||
fprintf( ExportFile, " %s",
|
fprintf( ExportFile, " %s",
|
||||||
(const char*) LibEntry->m_Prefix.m_Text.GetData() );
|
CONV_TO_UTF8( CurrentLibEntry->m_Prefix.m_Text ) );
|
||||||
else
|
else
|
||||||
fprintf( ExportFile, " ~" );
|
fprintf( ExportFile, " ~" );
|
||||||
|
|
||||||
fprintf( ExportFile, " %d %d %c %c %d %d %c\n",
|
fprintf( ExportFile, " %d %d %c %c %d %d %c\n",
|
||||||
0, /* unused */
|
0, /* unused */
|
||||||
LibEntry->m_TextInside,
|
CurrentLibEntry->m_TextInside,
|
||||||
LibEntry->m_DrawPinNum ? 'Y' : 'N',
|
CurrentLibEntry->m_DrawPinNum ? 'Y' : 'N',
|
||||||
LibEntry->m_DrawPinName ? 'Y' : 'N',
|
CurrentLibEntry->m_DrawPinName ? 'Y' : 'N',
|
||||||
1, 0 /* unused */, 'N' );
|
1, 0 /* unused */, 'N' );
|
||||||
|
|
||||||
/* Position / orientation / visibilite des champs */
|
/* Position / orientation / visibilite des champs */
|
||||||
LibEntry->m_Prefix.Save( ExportFile );
|
CurrentLibEntry->m_Prefix.Save( ExportFile );
|
||||||
LibEntry->m_Name.Save( ExportFile );
|
CurrentLibEntry->m_Name.Save( ExportFile );
|
||||||
|
DrawEntry = CurrentLibEntry->m_Drawings;
|
||||||
|
|
||||||
DrawEntry = LibEntry->m_Drawings;
|
|
||||||
if( DrawEntry )
|
if( DrawEntry )
|
||||||
{
|
{
|
||||||
fprintf( ExportFile, "DRAW\n" );
|
fprintf( ExportFile, "DRAW\n" );
|
||||||
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
|
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
|
||||||
{
|
{
|
||||||
/* Elimination des elements non relatifs a l'unite */
|
/* Elimination des elements non relatifs a l'unite */
|
||||||
if( Unit && DrawEntry->m_Unit && ( DrawEntry->m_Unit != Unit ) )
|
if( CurrentUnit && DrawEntry->m_Unit
|
||||||
|
&& ( DrawEntry->m_Unit != CurrentUnit ) )
|
||||||
continue;
|
continue;
|
||||||
if( convert && DrawEntry->m_Convert
|
if( CurrentConvert && DrawEntry->m_Convert
|
||||||
&& ( DrawEntry->m_Convert != convert ) )
|
&& ( DrawEntry->m_Convert != CurrentConvert ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DrawEntry->Save( ExportFile );
|
DrawEntry->Save( ExportFile );
|
||||||
|
@ -251,6 +240,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
|
|
||||||
fprintf( ExportFile, "ENDDRAW\n" );
|
fprintf( ExportFile, "ENDDRAW\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( ExportFile, "ENDDEF\n" );
|
fprintf( ExportFile, "ENDDEF\n" );
|
||||||
fclose( ExportFile );
|
fclose( ExportFile );
|
||||||
}
|
}
|
||||||
|
@ -281,7 +271,7 @@ void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry )
|
||||||
{
|
{
|
||||||
if( CompareSymbols( DEntryRef, DEntryCompare ) == TRUE )
|
if( CompareSymbols( DEntryRef, DEntryCompare ) == TRUE )
|
||||||
{
|
{
|
||||||
DeleteOneLibraryDrawStruct( NULL, DC, LibEntry, DEntryRef, 1 );
|
LibEntry->RemoveDrawItem( DEntryRef, NULL, DC );
|
||||||
deleted = TRUE;
|
deleted = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +464,7 @@ void WinEDA_LibeditFrame::PlaceAncre()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
;
|
break;
|
||||||
}
|
}
|
||||||
DrawEntry = DrawEntry->Next();
|
DrawEntry = DrawEntry->Next();
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,8 +310,8 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
g_ViewUnit = 1;
|
g_ViewUnit = 1;
|
||||||
if( g_ViewConvert < 1 )
|
if( g_ViewConvert < 1 )
|
||||||
g_ViewConvert = 1;
|
g_ViewConvert = 1;
|
||||||
DrawLibEntry( DrawPanel, DC, LibEntry, wxPoint( 0, 0 ),
|
LibEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_ViewUnit,
|
||||||
g_ViewUnit, g_ViewConvert, GR_DEFAULT_DRAWMODE );
|
g_ViewConvert, GR_DEFAULT_DRAWMODE );
|
||||||
LibEntry->m_Name.m_Text = RealName;
|
LibEntry->m_Name.m_Text = RealName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,8 +319,8 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
{
|
{
|
||||||
Msg.Printf( _( "Current Part: <%s>" ),
|
Msg.Printf( _( "Current Part: <%s>" ),
|
||||||
ViewCmpEntry->m_Name.m_Text.GetData() );
|
ViewCmpEntry->m_Name.m_Text.GetData() );
|
||||||
DrawLibEntry( DrawPanel, DC, LibEntry, wxPoint( 0, 0 ),
|
LibEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_ViewUnit,
|
||||||
g_ViewUnit, g_ViewConvert, GR_DEFAULT_DRAWMODE );
|
g_ViewConvert, GR_DEFAULT_DRAWMODE );
|
||||||
}
|
}
|
||||||
AfficheDoc( this, ViewCmpEntry->m_Doc, ViewCmpEntry->m_KeyWord );
|
AfficheDoc( this, ViewCmpEntry->m_Doc, ViewCmpEntry->m_KeyWord );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue