2007-06-05 12:10:51 +00:00
|
|
|
/*********************************************************************/
|
|
|
|
/* EESchema - edition des librairies: Edition des champs ( Fields ) */
|
|
|
|
/*********************************************************************/
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/* Fichier libfield.cpp */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
#include "wx/spinctrl.h"
|
|
|
|
|
|
|
|
/* Routines locales */
|
2008-11-24 06:53:43 +00:00
|
|
|
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Variables locales */
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
extern int CurrentUnit;
|
2007-06-05 12:10:51 +00:00
|
|
|
static wxPoint StartCursor, LastTextPosition;
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************************************/
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
Panel->ManageCurseur = NULL;
|
|
|
|
Panel->ForceCloseManageCurseur = NULL;
|
2008-11-24 06:53:43 +00:00
|
|
|
if( CurrentDrawItem == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
wxPoint curpos;
|
2008-04-17 16:25:29 +00:00
|
|
|
curpos = Panel->GetScreen()->m_Curseur;
|
|
|
|
Panel->GetScreen()->m_Curseur = StartCursor;
|
2008-11-24 06:53:43 +00:00
|
|
|
ShowMoveField( Panel, DC, TRUE );
|
2008-04-17 16:25:29 +00:00
|
|
|
Panel->GetScreen()->m_Curseur = curpos;
|
|
|
|
CurrentDrawItem->m_Flags = 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
CurrentDrawItem = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Initialise le deplacement d'un champ ( ref ou Name) */
|
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
wxPoint startPos;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( (CurrentLibEntry == NULL) || ( field == NULL ) )
|
|
|
|
return;
|
|
|
|
CurrentDrawItem = field;
|
2008-04-17 16:25:29 +00:00
|
|
|
LastTextPosition = field->m_Pos;
|
|
|
|
CurrentDrawItem->m_Flags |= IS_MOVED;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
startPos.x = LastTextPosition.x;
|
|
|
|
startPos.y = -LastTextPosition.y;
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawPanel->CursorOff( DC );
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->m_Curseur = startPos;
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
DrawPanel->ManageCurseur = ShowMoveField;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = ExitMoveField;
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
2008-04-17 16:25:29 +00:00
|
|
|
StartCursor = GetScreen()->m_Curseur;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawPanel->CursorOn( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************/
|
|
|
|
/* Routine d'affichage du texte 'Field' en cours de deplacement. */
|
|
|
|
/* Routine normalement attachee au curseur */
|
|
|
|
/*****************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
int color;
|
|
|
|
LibDrawField* Field = (LibDrawField*) CurrentDrawItem;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( (CurrentLibEntry == NULL) || (Field == NULL) )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
switch( Field->m_FieldId )
|
|
|
|
{
|
|
|
|
case VALUE:
|
|
|
|
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
case REFERENCE:
|
|
|
|
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
default:
|
|
|
|
color = ReturnLayerColor( LAYER_FIELDS );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-12 17:27:32 +00:00
|
|
|
wxString text = Field->m_Text;
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field->m_FieldId == REFERENCE )
|
|
|
|
text << wxT( "?" );
|
2008-11-12 17:27:32 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
int TransMat[2][2];
|
2008-11-12 17:27:32 +00:00
|
|
|
TransMat[0][0] = 1; TransMat[1][1] = -1;
|
|
|
|
TransMat[1][0] = TransMat[0][1] = 0;
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field->m_Attributs & TEXT_NO_VISIBLE )
|
|
|
|
color = DARKGRAY;
|
2008-04-17 16:25:29 +00:00
|
|
|
if( erase )
|
2008-11-24 06:53:43 +00:00
|
|
|
Field->Draw( panel, DC, wxPoint( 0, 0 ),
|
|
|
|
color,
|
|
|
|
g_XorMode, &text, TransMat );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
LastTextPosition.x = panel->GetScreen()->m_Curseur.x;
|
2008-11-24 06:53:43 +00:00
|
|
|
LastTextPosition.y = -panel->GetScreen()->m_Curseur.y;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
Field->m_Pos = LastTextPosition;
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
Field->Draw( panel, DC, wxPoint( 0, 0 ),
|
|
|
|
color,
|
|
|
|
g_XorMode, &text, TransMat );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*******************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*******************************************************************/
|
|
|
|
{
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors color;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
switch( Field->m_FieldId )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
case REFERENCE:
|
|
|
|
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
case VALUE:
|
|
|
|
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
default:
|
|
|
|
color = ReturnLayerColor( LAYER_FIELDS );
|
|
|
|
break;
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
Field->m_Flags = 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 )
|
|
|
|
color = DARKGRAY;
|
2008-04-17 16:25:29 +00:00
|
|
|
Field->m_Pos.x = GetScreen()->m_Curseur.x;
|
2008-11-24 06:53:43 +00:00
|
|
|
Field->m_Pos.y = -GetScreen()->m_Curseur.y;
|
|
|
|
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
|
|
|
|
DrawPanel->CursorOff( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
|
|
|
|
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
|
|
color, Field->m_Text,
|
|
|
|
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
|
|
Field->m_Size,
|
|
|
|
Field->m_HJustify, Field->m_VJustify, LineWidth );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawPanel->CursorOn( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
CurrentDrawItem = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
|
2007-06-05 12:10:51 +00:00
|
|
|
/******************************************************************/
|
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
wxString Text;
|
|
|
|
wxString title;
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors color;
|
2008-11-24 06:53:43 +00:00
|
|
|
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
switch( Field->m_FieldId )
|
|
|
|
{
|
|
|
|
case REFERENCE:
|
|
|
|
title = wxT( "Reference:" );
|
|
|
|
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case VALUE:
|
|
|
|
title = wxT( "Value:" );
|
|
|
|
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
color = ReturnLayerColor( LAYER_FIELDS );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field->m_Attributs & TEXT_NO_VISIBLE )
|
|
|
|
color = DARKGRAY;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
Text = Field->m_Text;
|
2008-11-24 06:53:43 +00:00
|
|
|
Get_Message( title, _( "Edit field" ), Text, this );
|
|
|
|
Text.Replace( wxT( " " ), wxT( "_" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
GRSetDrawMode( DC, g_XorMode );
|
|
|
|
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
|
|
color, Field->m_Text,
|
|
|
|
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
|
|
Field->m_Size,
|
|
|
|
Field->m_HJustify, Field->m_VJustify, LineWidth );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( !Text.IsEmpty() )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
SaveCopyInUndoList( CurrentLibEntry );
|
2008-04-17 16:25:29 +00:00
|
|
|
Field->m_Text = Text;
|
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
else
|
|
|
|
DisplayError( this, _( "No new text: no change" ) );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field->m_Flags == 0 )
|
|
|
|
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
|
|
color, Field->m_Text,
|
|
|
|
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
|
|
Field->m_Size,
|
|
|
|
Field->m_HJustify, Field->m_VJustify, LineWidth );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field->m_FieldId == VALUE )
|
|
|
|
ReCreateHToolbar();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/********************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
|
2007-06-05 12:10:51 +00:00
|
|
|
/********************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ.
|
2008-11-24 06:53:43 +00:00
|
|
|
* si un champ est en cours d'edition, modif de celui ci.
|
|
|
|
* sinon Modif du champ pointe par la souris
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-14 19:45:05 +00:00
|
|
|
EDA_Colors color;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( Field == NULL )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->SetModify();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
switch( Field->m_FieldId )
|
|
|
|
{
|
|
|
|
case REFERENCE:
|
|
|
|
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
|
|
break;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
case VALUE:
|
|
|
|
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
|
|
break;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
default:
|
|
|
|
color = ReturnLayerColor( LAYER_FIELDS );
|
|
|
|
break;
|
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( (Field->m_Attributs & TEXT_NO_VISIBLE) != 0 )
|
|
|
|
color = DARKGRAY;
|
|
|
|
|
|
|
|
DrawPanel->CursorOff( DC );
|
|
|
|
|
|
|
|
GRSetDrawMode( DC, g_XorMode );
|
|
|
|
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
|
|
|
|
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
|
|
color, Field->m_Text,
|
|
|
|
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
|
|
Field->m_Size,
|
|
|
|
Field->m_HJustify, Field->m_VJustify, LineWidth );
|
|
|
|
|
|
|
|
if( Field->m_Orient )
|
|
|
|
Field->m_Orient = 0;
|
|
|
|
else
|
|
|
|
Field->m_Orient = 1;
|
|
|
|
|
|
|
|
if( Field->m_Flags == 0 )
|
|
|
|
GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE );
|
|
|
|
|
|
|
|
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
|
|
|
|
color, Field->m_Text,
|
|
|
|
Field->m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
|
|
Field->m_Size,
|
|
|
|
Field->m_HJustify, Field->m_VJustify, LineWidth );
|
|
|
|
DrawPanel->CursorOn( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry )
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************************************************************/
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-11-12 17:27:32 +00:00
|
|
|
/* Locate the component fiels (ref, name or auxiliary fields) under the mouse cursor
|
2008-11-24 06:53:43 +00:00
|
|
|
* return:
|
|
|
|
* pointer on the field (or NULL )
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-12 17:27:32 +00:00
|
|
|
wxPoint refpos;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-11-12 17:27:32 +00:00
|
|
|
refpos.x = GetScreen()->m_Curseur.x;
|
2008-11-24 06:53:43 +00:00
|
|
|
refpos.y = -GetScreen()->m_Curseur.y; // Y axis is from bottom to top in library
|
2008-11-12 17:27:32 +00:00
|
|
|
/* Test reference */
|
2008-11-24 06:53:43 +00:00
|
|
|
if( LibEntry->m_Name.HitTest( refpos ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
return &LibEntry->m_Name;
|
|
|
|
|
2008-11-12 17:27:32 +00:00
|
|
|
/* Test Prefix */
|
2008-11-24 06:53:43 +00:00
|
|
|
if( LibEntry->m_Prefix.HitTest( refpos ) )
|
2008-04-17 16:25:29 +00:00
|
|
|
return &LibEntry->m_Prefix;
|
|
|
|
|
|
|
|
/* Localisation des autres fields */
|
2008-12-31 15:01:29 +00:00
|
|
|
for( LibDrawField* field = LibEntry->m_Fields; field; field = field->Next() )
|
2008-11-24 06:53:43 +00:00
|
|
|
{
|
|
|
|
if( field->m_Text.IsEmpty() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( field->HitTest( refpos ) )
|
|
|
|
return field;
|
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
return NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-12-11 16:41:43 +00:00
|
|
|
/********************************************************************************/
|
|
|
|
LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
|
|
|
|
/********************************************************************************/
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( CurrentLibEntry == NULL )
|
|
|
|
return NULL;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) )
|
|
|
|
{ // Simple localisation des elements
|
|
|
|
DrawEntry = LocatePin(
|
|
|
|
GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert );
|
|
|
|
if( DrawEntry == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
|
|
|
GetScreen()->m_MousePosition, CurrentLibEntry, CurrentUnit,
|
|
|
|
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
if( DrawEntry == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
|
|
|
|
GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit,
|
|
|
|
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
if( DrawEntry == NULL )
|
2008-04-17 16:25:29 +00:00
|
|
|
{
|
|
|
|
DrawEntry = CurrentDrawItem = (LibEDA_BaseStruct*)
|
2008-11-24 06:53:43 +00:00
|
|
|
LocateField( CurrentLibEntry );
|
2008-04-17 16:25:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return DrawEntry;
|
2007-12-11 16:41:43 +00:00
|
|
|
}
|