Commit 06c9f9c8 authored by CHARRAS's avatar CHARRAS

enhancements in pcbnew to eeschema cross-probing. removed change in drc.cpp

parent 6245ac52
...@@ -4,6 +4,19 @@ Started 2007-June-11 ...@@ -4,6 +4,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Oct-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew/eeschema
Cross-probing pcbnew to eeschema:
A left click on a pad in pcbnew moves the eeschema cursor on the corresponding component pin
A left click on a footprint ref or value in pcbnew moves the eeschema cursor on the corresponding component ref or value
A left ckick on a footprint moves the eeschema cursor on the corresponding component anchor
+ pcbnew
removed drc.cpp change line 584, and translate comments in english.
nothing broken:
-> a pad with its netcode = 0 means the pad ** must be left unconnected ** (not attached to * a net).
-> a track with its netcode = 0 means the track is not attached to a net (cannot be connected to any pad).
2007-Sep-30 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Sep-30 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
...@@ -22,6 +35,7 @@ email address. ...@@ -22,6 +35,7 @@ email address.
* beautification, house keeping. * beautification, house keeping.
2007-Sep-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Sep-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+ pcbnew + pcbnew
......
...@@ -62,9 +62,9 @@ WinEDA_App::WinEDA_App() ...@@ -62,9 +62,9 @@ WinEDA_App::WinEDA_App()
m_MainFrame = NULL; m_MainFrame = NULL;
m_PcbFrame = NULL; m_PcbFrame = NULL;
m_ModuleEditFrame = NULL; // Edition des modules m_ModuleEditFrame = NULL; // Edition des modules
SchematicFrame = NULL; // Edition des Schemas m_SchematicFrame = NULL; // Edition des Schemas
LibeditFrame = NULL; // Edition des composants m_LibeditFrame = NULL; // Edition des composants
ViewlibFrame = NULL; // Visualisation des composants m_ViewlibFrame = NULL; // Visualisation des composants
m_CvpcbFrame = NULL; m_CvpcbFrame = NULL;
m_GerberFrame = NULL; // ecran de visualisation GERBER m_GerberFrame = NULL; // ecran de visualisation GERBER
......
...@@ -681,7 +681,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) ...@@ -681,7 +681,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
MirrorYPoint( px, Center ); MirrorYPoint( px, Center );
px.x -= dx; px.x -= dx;
EDA_Appl->SchematicFrame->PutOnGrid( &px ); EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
...@@ -696,14 +696,14 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) ...@@ -696,14 +696,14 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
px = DrawText->m_Pos; px = DrawText->m_Pos;
MirrorYPoint( px, Center ); MirrorYPoint( px, Center );
EDA_Appl->SchematicFrame->PutOnGrid( &px ); EDA_Appl->m_SchematicFrame->PutOnGrid( &px );
DrawText->m_Pos.x = px.x; DrawText->m_Pos.x = px.x;
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
DrawLibItem = (EDA_SchComponentStruct*) DrawStruct; DrawLibItem = (EDA_SchComponentStruct*) DrawStruct;
dx = DrawLibItem->m_Pos.x; dx = DrawLibItem->m_Pos.x;
EDA_Appl->SchematicFrame->CmpRotationMiroir( DrawLibItem, EDA_Appl->m_SchematicFrame->CmpRotationMiroir( DrawLibItem,
NULL, CMP_MIROIR_Y ); NULL, CMP_MIROIR_Y );
MirrorYPoint( DrawLibItem->m_Pos, Center ); MirrorYPoint( DrawLibItem->m_Pos, Center );
dx -= DrawLibItem->m_Pos.x; dx -= DrawLibItem->m_Pos.x;
......
...@@ -63,7 +63,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -63,7 +63,7 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
} }
} }
EDA_Appl->SchematicFrame->TestDanglingEnds( EEDrawList, DC ); EDA_Appl->m_SchematicFrame->TestDanglingEnds( EEDrawList, DC );
return Modify; return Modify;
} }
......
...@@ -22,33 +22,71 @@ ...@@ -22,33 +22,71 @@
/* variables externes */ /* variables externes */
/***************************************************************/
/**********************************/
void RemoteCommand( const char* cmdline ) void RemoteCommand( const char* cmdline )
/**********************************/ /***************************************************************/
/* Read a remote command sent from pcbnew, so when user selects a module /** Read a remote command sent by pcbnew (via a socket connection) , so when user selects a module
* or pin in pcbnew, eeschema shows that same component or pin. * or pin in pcbnew, eeschema shows that same component or pin.
* The cursor is put on the item
* @param cmdline = received command from pcbnew
* commands are:
* $PART: "reference" put cursor on component
* $PART: "reference" $REF: "ref" put cursor on reference component
* $PART: "reference" $VAL: "value" put cursor on value component
* $PART: "reference" $PAD: "pin name" put cursor on the component pin
*/ */
{ {
char line[1024]; char line[1024];
char* idcmd; char* idcmd;
char* text; char* text;
WinEDA_SchematicFrame* frame = EDA_Appl->m_SchematicFrame;
wxString part_ref, msg;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
idcmd = strtok( line, " \n\r" ); idcmd = strtok( line, " \n\r" );
text = strtok( NULL, " \n\r" ); text = strtok( NULL, "\"\n\r" );
if( (idcmd == NULL) || (text == NULL) ) if( (idcmd == NULL) || (text == NULL) )
return; return;
if( strcmp( idcmd, "$PART:" ) == 0 ) if( strcmp( idcmd, "$PART:" ) != 0 )
return;
part_ref = CONV_FROM_UTF8( text );
/* look for a complement */
idcmd = strtok( NULL, " \n\r" );
if( idcmd == NULL ) // component only
{
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
return;
}
text = strtok( NULL, "\"\n\r" );
if( text == NULL )
return;
msg = CONV_FROM_UTF8( text );
if( strcmp( idcmd, "$REF:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 2, msg, false );
}
else if( strcmp( idcmd, "$VAL:" ) == 0 )
{ {
WinEDA_SchematicFrame* frame = EDA_Appl->SchematicFrame; frame->FindComponentAndItem( part_ref, true, 3, msg, false );
wxString msg = CONV_FROM_UTF8( text );
frame->FindSchematicItem( msg, 1, false );
} }
else if( strcmp( idcmd, "$PAD:" ) == 0 )
{
frame->FindComponentAndItem( part_ref, true, 1, msg, false );
}
else
frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
} }
...@@ -76,7 +114,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -76,7 +114,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
wxPoint mouse_position = GetScreen()->m_MousePosition; wxPoint mouse_position = GetScreen()->m_MousePosition;
LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL;
EDA_SchComponentStruct* LibItem = NULL; EDA_SchComponentStruct* LibItem = NULL;
char Line[1024]; char Line[1024];
DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin ); DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin );
if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) ) if( !DrawStruct && ( mouse_position != GetScreen()->m_Curseur) )
...@@ -101,7 +139,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -101,7 +139,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem ); Pin = LocateAnyPin( m_CurrentScreen->EEDrawList, GetScreen()->m_Curseur, &LibItem );
if( Pin ) if( Pin )
break; // Priority is probing a pin first break; // Priority is probing a pin first
LibItem = (EDA_SchComponentStruct*) DrawStruct; LibItem = (EDA_SchComponentStruct*) DrawStruct;
sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) );
SendCommand( MSG_TO_PCB, Line ); SendCommand( MSG_TO_PCB, Line );
...@@ -157,16 +195,16 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -157,16 +195,16 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
* return: * return:
* an EDA_BaseStruct pointer on the item * an EDA_BaseStruct pointer on the item
* a Null pointer if no item found * a Null pointer if no item found
* *
* For some items, caracteristics are displayed on the screen. * For some items, caracteristics are displayed on the screen.
*/ */
{ {
EDA_BaseStruct* DrawStruct; EDA_BaseStruct* DrawStruct;
LibDrawPin* Pin; LibDrawPin* Pin;
EDA_SchComponentStruct* LibItem; EDA_SchComponentStruct* LibItem;
wxString Text; wxString Text;
wxString msg; wxString msg;
int ii; int ii;
DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, MARKERITEM ); DrawStruct = PickStruct( refpoint, GetScreen()->EEDrawList, MARKERITEM );
if( DrawStruct ) if( DrawStruct )
...@@ -317,17 +355,17 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -317,17 +355,17 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case EDA_ZOOM_IN_FROM_MOUSE: case EDA_ZOOM_IN_FROM_MOUSE:
OnZoom( ID_ZOOM_PLUS_KEY ); OnZoom( ID_ZOOM_PLUS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case EDA_ZOOM_OUT_FROM_MOUSE: case EDA_ZOOM_OUT_FROM_MOUSE:
OnZoom( ID_ZOOM_MOINS_KEY ); OnZoom( ID_ZOOM_MOINS_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
case EDA_ZOOM_CENTER_FROM_MOUSE: case EDA_ZOOM_CENTER_FROM_MOUSE:
OnZoom( ID_ZOOM_CENTER_KEY ); OnZoom( ID_ZOOM_CENTER_KEY );
curpos = m_CurrentScreen->m_Curseur; curpos = m_CurrentScreen->m_Curseur;
break; break;
...@@ -396,5 +434,4 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ...@@ -396,5 +434,4 @@ void WinEDA_DrawFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels
} }
Affiche_Status_Box(); /* Affichage des coord curseur */ Affiche_Status_Box(); /* Affichage des coord curseur */
} }
...@@ -24,7 +24,7 @@ void DeleteSubHierarchy(DrawSheetStruct * FirstSheet, bool confirm_deletion) ...@@ -24,7 +24,7 @@ void DeleteSubHierarchy(DrawSheetStruct * FirstSheet, bool confirm_deletion)
{ {
EDA_BaseStruct *DrawStruct; EDA_BaseStruct *DrawStruct;
EDA_BaseStruct *EEDrawList; EDA_BaseStruct *EEDrawList;
WinEDA_SchematicFrame * frame = EDA_Appl->SchematicFrame; WinEDA_SchematicFrame * frame = EDA_Appl->m_SchematicFrame;
wxString msg; wxString msg;
if( FirstSheet == NULL ) return; if( FirstSheet == NULL ) return;
......
...@@ -295,8 +295,8 @@ void KiConfigEeschemaFrame::OnCloseWindow(wxCloseEvent & event) ...@@ -295,8 +295,8 @@ void KiConfigEeschemaFrame::OnCloseWindow(wxCloseEvent & event)
if ( m_LibListChanged ) if ( m_LibListChanged )
{ {
LoadLibraries(m_Parent); LoadLibraries(m_Parent);
if ( m_Parent->m_Parent->ViewlibFrame ) if ( m_Parent->m_Parent->m_ViewlibFrame )
m_Parent->m_Parent->ViewlibFrame->ReCreateListLib(); m_Parent->m_Parent->m_ViewlibFrame->ReCreateListLib();
} }
EndModal(0); EndModal(0);
} }
......
...@@ -159,13 +159,13 @@ wxArrayString liblist_tmp = g_LibName_List; ...@@ -159,13 +159,13 @@ wxArrayString liblist_tmp = g_LibName_List;
g_LibName_List.Add( wxT("device") ); g_LibName_List.Add( wxT("device") );
} }
if ( EDA_Appl->SchematicFrame ) if ( EDA_Appl->m_SchematicFrame )
{ {
EDA_Appl->SchematicFrame->SetDrawBgColor(g_DrawBgColor); EDA_Appl->m_SchematicFrame->SetDrawBgColor(g_DrawBgColor);
EDA_Appl->SchematicFrame->m_Draw_Grid = g_ShowGrid; EDA_Appl->m_SchematicFrame->m_Draw_Grid = g_ShowGrid;
} }
LoadLibraries(EDA_Appl->SchematicFrame); LoadLibraries(EDA_Appl->m_SchematicFrame);
return IsRead; return IsRead;
} }
......
...@@ -66,41 +66,41 @@ bool WinEDA_App::OnInit() ...@@ -66,41 +66,41 @@ bool WinEDA_App::OnInit()
/* init EESCHEMA */ /* init EESCHEMA */
GetSettings(); // read current setup GetSettings(); // read current setup
SeedLayers(); SeedLayers();
Read_Hotkey_Config( SchematicFrame, false ); /* Must be called before creating the main frame Read_Hotkey_Config( m_SchematicFrame, false ); /* Must be called before creating the main frame
* in order to display the real hotkeys in menus * in order to display the real hotkeys in menus
* or tool tips */ * or tool tips */
// Create main frame (schematic frame) : // Create main frame (schematic frame) :
SchematicFrame = new WinEDA_SchematicFrame( NULL, this, m_SchematicFrame = new WinEDA_SchematicFrame( NULL, this,
wxT( "EESchema" ), wxT( "EESchema" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) ); wxPoint( 0, 0 ), wxSize( 600, 400 ) );
SetTopWindow( SchematicFrame ); SetTopWindow( m_SchematicFrame );
SchematicFrame->Show( TRUE ); m_SchematicFrame->Show( TRUE );
if( CreateServer( SchematicFrame, KICAD_SCH_PORT_SERVICE_NUMBER ) ) if( CreateServer( m_SchematicFrame, KICAD_SCH_PORT_SERVICE_NUMBER ) )
{ {
// RemoteCommand is in controle.cpp and is called when PCBNEW // RemoteCommand is in controle.cpp and is called when PCBNEW
// sends EESCHEMA a command // sends EESCHEMA a command
SetupServerFunction( RemoteCommand ); SetupServerFunction( RemoteCommand );
} }
SchematicFrame->Zoom_Automatique( TRUE ); m_SchematicFrame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */ /* Load file specified in the command line. */
if( !FFileName.IsEmpty() ) if( !FFileName.IsEmpty() )
{ {
ChangeFileNameExt( FFileName, g_SchExtBuffer ); ChangeFileNameExt( FFileName, g_SchExtBuffer );
wxSetWorkingDirectory( wxPathOnly( FFileName ) ); wxSetWorkingDirectory( wxPathOnly( FFileName ) );
if( SchematicFrame->DrawPanel ) if( m_SchematicFrame->DrawPanel )
if( SchematicFrame->LoadOneEEProject( FFileName, FALSE ) <= 0 ) if( m_SchematicFrame->LoadOneEEProject( FFileName, FALSE ) <= 0 )
SchematicFrame->DrawPanel->Refresh( TRUE ); // File not found or error m_SchematicFrame->DrawPanel->Refresh( TRUE ); // File not found or error
} }
else else
{ {
Read_Config( wxEmptyString, TRUE ); // Read config file ici si pas de fichier a charger Read_Config( wxEmptyString, TRUE ); // Read config file ici si pas de fichier a charger
if( SchematicFrame->DrawPanel ) if( m_SchematicFrame->DrawPanel )
SchematicFrame->DrawPanel->Refresh( TRUE ); m_SchematicFrame->DrawPanel->Refresh( TRUE );
} }
return TRUE; return TRUE;
......
...@@ -56,6 +56,213 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event ) ...@@ -56,6 +56,213 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
} }
/************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
const wxString& component_reference, bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp )
/************************************************************************/
/**
* Function FindComponentAndItem
* finds a Component in the schematic, and an item in this component.
* @param pattern The text to search for, either in value, reference or elsewhere.
* @param Find_in_hierarchy: false => Search is made in current sheet
* true => the whole hierarchy
* @param SearchType: 0 => find component
* 1 => find pin
* 2 => find ref
* 3 => find value
* >= 4 => unused (same as 0)
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
{
SCH_SCREEN* Screen, * ScreenWithComponentFound = NULL;
EDA_BaseStruct* DrawList = NULL;
EDA_SchComponentStruct* Component = NULL;
wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint pos, curpos;
bool DoCenterAndRedraw = FALSE;
bool NotFound = true;
wxString msg;
LibDrawPin* pin;
EDA_ScreenList ScreenList( NULL );
Screen = ScreenList.GetFirst();
if( !Find_in_hierarchy )
Screen = (SCH_SCREEN*) m_CurrentScreen;
for( ; Screen != NULL; Screen = ScreenList.GetNext() )
{
DrawList = Screen->EEDrawList;
for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Pnext )
{
if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{
EDA_SchComponentStruct* pSch;
pSch = (EDA_SchComponentStruct*) DrawList;
if( component_reference.CmpNoCase( pSch->m_Field[REFERENCE].m_Text ) == 0 )
{
Component = pSch;
ScreenWithComponentFound = Screen;
switch( SearchType )
{
default:
case 0: // Find component only
NotFound = FALSE;
pos = pSch->m_Pos;
break;
case 1: // find a pin
pos = pSch->m_Pos; // temporary: will be changed if the pin is found
pin = LocatePinByNumber( text_to_find, pSch );
if( pin == NULL )
break;
NotFound = FALSE;
pos += pin->m_Pos;
break;
case 2: // find reference
NotFound = FALSE;
pos = pSch->m_Field[REFERENCE].m_Pos;
break;
case 3: // find value
pos = pSch->m_Pos;
if( text_to_find.CmpNoCase( pSch->m_Field[VALUE].m_Text ) != 0 )
break;
NotFound = FALSE;
pos = pSch->m_Field[VALUE].m_Pos;
break;
}
}
}
}
if( (Find_in_hierarchy == FALSE) || (NotFound == FALSE) )
break;
}
if( Component )
{
Screen = ScreenWithComponentFound;
if( Screen != GetScreen() )
{
Screen->SetZoom( GetScreen()->GetZoom() );
m_CurrentScreen = ActiveScreen = Screen;
DoCenterAndRedraw = TRUE;
}
wxPoint delta;
pos -= Component->m_Pos;
delta.x = Component->m_Transform[0][0] * pos.x + Component->m_Transform[0][1] * pos.y;
delta.y = Component->m_Transform[1][0] * pos.x + Component->m_Transform[1][1] * pos.y;
pos = delta + Component->m_Pos;
wxPoint old_cursor_position = Screen->m_Curseur;
Screen->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart(
&m_CurrentScreen->m_StartVisu.x,
&m_CurrentScreen->m_StartVisu.y );
// calcul des coord curseur avec origine = screen
curpos.x -= m_CurrentScreen->m_StartVisu.x;
curpos.y -= m_CurrentScreen->m_StartVisu.y;
/* Il y a peut-etre necessite de recadrer le dessin: */
#define MARGIN 30
if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
{
DoCenterAndRedraw = true;;
}
#undef MARGIN
if ( DoCenterAndRedraw )
Recadre_Trace( mouseWarp );
else
{
wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, Screen->m_Curseur );
DrawPanel->CursorOff( &dc );
if( mouseWarp )
GRMouseWarp( DrawPanel, curpos );
EXCHG( old_cursor_position, Screen->m_Curseur );
DrawPanel->CursorOn( &dc );
}
}
/* Print diaq */
wxString msg_item;
msg = component_reference;
switch( SearchType )
{
default:
case 0:
break; // Find component only
case 1: // find a pin
msg_item = _( "Pin " ) + text_to_find;
break;
case 2: // find reference
msg_item = _( "Ref " ) + text_to_find;
break;
case 3: // find value
msg_item = _( "Value " ) + text_to_find;
break;
case 4: // find field. todo
msg_item = _( "Field " ) + text_to_find;
break;
}
if( Component )
{
if( !NotFound )
{
if( !msg_item.IsEmpty() )
msg += wxT( " " ) + msg_item;
msg += _( " Found" );
}
else
{
msg += _( " Found" );
if( !msg_item.IsEmpty() )
{
msg += wxT( " but " ) + msg_item + _( " not found" );
}
}
}
else
{
if( !msg_item.IsEmpty() )
msg += wxT( " " ) + msg_item;
msg += _( " not found" );
}
Affiche_Message( msg );
return DrawList;
}
/*****************************************************************/ /*****************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
/*****************************************************************/ /*****************************************************************/
...@@ -71,9 +278,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -71,9 +278,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
int StartCount; int StartCount;
bool NotFound; bool NotFound;
wxPoint firstpos, pos; wxPoint firstpos, pos;
wxSize size = DrawPanel->GetClientSize(); wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint curpos, old_cursor_position; wxPoint curpos, old_cursor_position;
bool force_recadre = FALSE; bool DoCenterAndRedraw = FALSE;
wxString msg, WildText; wxString msg, WildText;
g_LastSearchIsMarker = TRUE; g_LastSearchIsMarker = TRUE;
...@@ -95,7 +302,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -95,7 +302,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
Marker = (DrawMarkerStruct*) DrawList; Marker = (DrawMarkerStruct*) DrawList;
NotFound = FALSE; NotFound = FALSE;
pos = Marker->m_Pos; pos = Marker->m_Pos;
if( FirstScreen == NULL ) /* First item found */ if( FirstScreen == NULL ) /* First item found */
{ {
FirstScreen = Screen; firstpos = pos; FirstScreen = Screen; firstpos = pos;
FirstStruct = DrawList; FirstStruct = DrawList;
...@@ -104,9 +311,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -104,9 +311,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
StartCount++; StartCount++;
if( s_MarkerCount >= StartCount ) if( s_MarkerCount >= StartCount )
{ {
NotFound = TRUE; /* Search for other markers */ NotFound = TRUE; /* Search for other markers */
} }
else /* We have found s_MarkerCount markers -> Ok */ else /* We have found s_MarkerCount markers -> Ok */
{ {
Struct = DrawList; s_MarkerCount++; break; Struct = DrawList; s_MarkerCount++; break;
} }
...@@ -118,8 +325,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -118,8 +325,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
break; break;
} }
if( NotFound && FirstScreen ) // markers are found, but we have reach the last marker */ if( NotFound && FirstScreen ) // markers are found, but we have reach the last marker */
{ // After the last marker, the first marker is used */ { // After the last marker, the first marker is used */
NotFound = FALSE; Screen = FirstScreen; NotFound = FALSE; Screen = FirstScreen;
Struct = FirstStruct; Struct = FirstStruct;
pos = firstpos; s_MarkerCount = 1; pos = firstpos; s_MarkerCount = 1;
...@@ -131,7 +338,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -131,7 +338,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
{ {
Screen->SetZoom( GetScreen()->GetZoom() ); Screen->SetZoom( GetScreen()->GetZoom() );
m_CurrentScreen = ActiveScreen = Screen; m_CurrentScreen = ActiveScreen = Screen;
force_recadre = TRUE; DoCenterAndRedraw = TRUE;
} }
old_cursor_position = Screen->m_Curseur; old_cursor_position = Screen->m_Curseur;
...@@ -144,12 +351,17 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -144,12 +351,17 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
curpos.x -= m_CurrentScreen->m_StartVisu.x; curpos.x -= m_CurrentScreen->m_StartVisu.x;
curpos.y -= m_CurrentScreen->m_StartVisu.y; curpos.y -= m_CurrentScreen->m_StartVisu.y;
// reposition the window if the chosen marker is off screen. // reposition the window if the chosen marker is off screen.
if( (curpos.x <= 0) || (curpos.x >= size.x - 1) #define MARGIN 30
|| (curpos.y <= 0) || (curpos.y >= size.y) || force_recadre ) if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
{ {
Recadre_Trace( TRUE ); DoCenterAndRedraw = true;;
} }
#undef MARGIN
if( DoCenterAndRedraw )
Recadre_Trace( TRUE );
else else
{ {
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
...@@ -218,9 +430,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -218,9 +430,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
bool NotFound; bool NotFound;
wxPoint firstpos, pos, old_cursor_position; wxPoint firstpos, pos, old_cursor_position;
static int Find_in_hierarchy; static int Find_in_hierarchy;
wxSize size = DrawPanel->GetClientSize(); wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint curpos; wxPoint curpos;
bool force_recadre = FALSE; bool DoCenterAndRedraw = FALSE;
wxString msg, WildText; wxString msg, WildText;
g_LastSearchIsMarker = FALSE; g_LastSearchIsMarker = FALSE;
...@@ -240,8 +452,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -240,8 +452,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
if( SearchType != 2 ) if( SearchType != 2 )
s_ItemsCount = 0; s_ItemsCount = 0;
WildText = s_OldStringFound; WildText = s_OldStringFound;
NotFound = TRUE; NotFound = TRUE;
StartCount = 0; StartCount = 0;
EDA_ScreenList ScreenList( NULL ); EDA_ScreenList ScreenList( NULL );
...@@ -258,8 +470,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -258,8 +470,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
EDA_SchComponentStruct* pSch; EDA_SchComponentStruct * pSch;
pSch = (EDA_SchComponentStruct*) DrawList; pSch = (EDA_SchComponentStruct*) DrawList;
if( WildCompareString( WildText, pSch->m_Field[REFERENCE].m_Text, FALSE ) ) if( WildCompareString( WildText, pSch->m_Field[REFERENCE].m_Text, FALSE ) )
{ {
NotFound = FALSE; NotFound = FALSE;
...@@ -276,8 +488,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -276,8 +488,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
DrawTextStruct* pDraw; DrawTextStruct * pDraw;
pDraw = (DrawTextStruct*) DrawList; pDraw = (DrawTextStruct*) DrawList;
if( WildCompareString( WildText, pDraw->m_Text, FALSE ) ) if( WildCompareString( WildText, pDraw->m_Text, FALSE ) )
{ {
NotFound = FALSE; NotFound = FALSE;
...@@ -289,11 +501,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -289,11 +501,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
break; break;
} }
if( NotFound == FALSE ) /* Item found ! */ if( NotFound == FALSE ) /* Item found ! */
{ {
if( FirstScreen == NULL ) /* First Item found */ if( FirstScreen == NULL ) /* First Item found */
{ {
FirstScreen = Screen; FirstScreen = Screen;
firstpos = pos; firstpos = pos;
FirstStruct = DrawList; FirstStruct = DrawList;
} }
...@@ -305,8 +517,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -305,8 +517,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
} }
else else
{ {
Struct = DrawList; Struct = DrawList;
s_ItemsCount++; s_ItemsCount++;
break; break;
} }
} }
...@@ -314,20 +526,20 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -314,20 +526,20 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
break; break;
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
} }
if( NotFound == FALSE ) if( NotFound == FALSE )
break; break;
if( Find_in_hierarchy == FALSE ) if( Find_in_hierarchy == FALSE )
break; break;
} }
if( NotFound && FirstScreen ) if( NotFound && FirstScreen )
{ {
NotFound = FALSE; NotFound = FALSE;
Screen = FirstScreen; Screen = FirstScreen;
Struct = FirstStruct; Struct = FirstStruct;
pos = firstpos; pos = firstpos;
s_ItemsCount = 1; s_ItemsCount = 1;
} }
...@@ -337,33 +549,33 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -337,33 +549,33 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
{ {
Screen->SetZoom( GetScreen()->GetZoom() ); Screen->SetZoom( GetScreen()->GetZoom() );
m_CurrentScreen = ActiveScreen = Screen; m_CurrentScreen = ActiveScreen = Screen;
force_recadre = TRUE; DoCenterAndRedraw = TRUE;
} }
/* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type, /* the struct is a DRAW_LIB_ITEM_STRUCT_TYPE type,
* coordinates must be computed according to its orientation matrix * coordinates must be computed according to its orientation matrix
*/ */
if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct; EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct;
pos.x -= pSch->m_Pos.x; pos.x -= pSch->m_Pos.x;
pos.y -= pSch->m_Pos.y; pos.y -= pSch->m_Pos.y;
ii = pSch->m_Transform[0][0] * pos.x + pSch->m_Transform[0][1] * pos.y; ii = pSch->m_Transform[0][0] * pos.x + pSch->m_Transform[0][1] * pos.y;
jj = pSch->m_Transform[1][0] * pos.x + pSch->m_Transform[1][1] * pos.y; jj = pSch->m_Transform[1][0] * pos.x + pSch->m_Transform[1][1] * pos.y;
pos.x = ii + pSch->m_Pos.x; pos.x = ii + pSch->m_Pos.x;
pos.y = jj + pSch->m_Pos.y; pos.y = jj + pSch->m_Pos.y;
} }
old_cursor_position = Screen->m_Curseur; old_cursor_position = Screen->m_Curseur;
Screen->m_Curseur = pos; Screen->m_Curseur = pos;
curpos = DrawPanel->CursorScreenPosition(); curpos = DrawPanel->CursorScreenPosition();
DrawPanel->GetViewStart( DrawPanel->GetViewStart(
&m_CurrentScreen->m_StartVisu.x, &m_CurrentScreen->m_StartVisu.x,
&m_CurrentScreen->m_StartVisu.y ); &m_CurrentScreen->m_StartVisu.y );
// calcul des coord curseur avec origine = screen // calcul des coord curseur avec origine = screen
...@@ -371,25 +583,29 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -371,25 +583,29 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
curpos.y -= m_CurrentScreen->m_StartVisu.y; curpos.y -= m_CurrentScreen->m_StartVisu.y;
/* Il y a peut-etre necessite de recadrer le dessin: */ /* Il y a peut-etre necessite de recadrer le dessin: */
if( (curpos.x <= 0) || (curpos.x >= size.x - 1) #define MARGIN 30
|| (curpos.y <= 0) || (curpos.y >= size.y) || force_recadre ) if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
{ {
Recadre_Trace( mouseWarp ); DoCenterAndRedraw = true;
} }
if ( DoCenterAndRedraw )
Recadre_Trace( mouseWarp );
else else
{ {
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, Screen->m_Curseur );
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( mouseWarp ) if( mouseWarp )
GRMouseWarp( DrawPanel, curpos ); GRMouseWarp( DrawPanel, curpos );
EXCHG( old_cursor_position, Screen->m_Curseur ); EXCHG( old_cursor_position, Screen->m_Curseur );
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
} }
...@@ -399,10 +615,10 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -399,10 +615,10 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
else else
{ {
Affiche_Message( wxEmptyString ); Affiche_Message( wxEmptyString );
if( !mouseWarp ) if( !mouseWarp )
{ {
// if called from RemoteCommand() don't popup the dialog which // if called from RemoteCommand() don't popup the dialog which
// needs to be dismissed, user is in PCBNEW, and does'nt want to // needs to be dismissed, user is in PCBNEW, and does'nt want to
// bother with dismissing the dialog in EESCHEMA. // bother with dismissing the dialog in EESCHEMA.
msg = WildText + _( " Not Found" ); msg = WildText + _( " Not Found" );
...@@ -421,11 +637,11 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) ...@@ -421,11 +637,11 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
/* Recherche exhaustive d'un composant en librairies, meme non chargees /* Recherche exhaustive d'un composant en librairies, meme non chargees
*/ */
{ {
wxString Text, FindList; wxString Text, FindList;
const wxChar** ListNames; const wxChar** ListNames;
LibraryStruct* Lib = NULL; LibraryStruct* Lib = NULL;
EDA_LibComponentStruct* LibEntry; EDA_LibComponentStruct* LibEntry;
bool FoundInLib = FALSE; // True si reference trouvee ailleurs qu'en cache bool FoundInLib = FALSE; // True si reference trouvee ailleurs qu'en cache
Text = m_NewTextCtrl->GetValue(); Text = m_NewTextCtrl->GetValue();
if( Text.IsEmpty() ) if( Text.IsEmpty() )
...@@ -444,7 +660,7 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event ) ...@@ -444,7 +660,7 @@ void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
ListNames = GetLibNames(); ListNames = GetLibNames();
nbitems = 0; nbitems = 0;
for( ii = 0; ii < NumOfLibs; ii++ ) /* Recherche de la librairie */ for( ii = 0; ii < NumOfLibs; ii++ ) /* Recherche de la librairie */
{ {
bool IsLibCache; bool IsLibCache;
Lib = FindLibrary( ListNames[ii] ); Lib = FindLibrary( ListNames[ii] );
...@@ -503,9 +719,9 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F ...@@ -503,9 +719,9 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
/***************************************************************************************/ /***************************************************************************************/
{ {
wxString FullFileName; wxString FullFileName;
FILE* file; FILE* file;
int nbitems = 0, LineNum = 0; int nbitems = 0, LineNum = 0;
char Line[2048], * name; char Line[2048], * name;
FullFileName = MakeFileName( g_RealLibDirBuffer, wxT( "*" ), g_LibExtBuffer ); FullFileName = MakeFileName( g_RealLibDirBuffer, wxT( "*" ), g_LibExtBuffer );
...@@ -519,7 +735,7 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F ...@@ -519,7 +735,7 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
while( GetLine( file, Line, &LineNum, sizeof(Line) ) ) while( GetLine( file, Line, &LineNum, sizeof(Line) ) )
{ {
if( strnicmp( Line, "DEF", 3 ) == 0 ) if( strnicmp( Line, "DEF", 3 ) == 0 )
{ {
/* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */ /* Read one DEF part from library: DEF 74LS00 U 0 30 Y Y 4 0 N */
strtok( Line, " \t\r\n" ); strtok( Line, " \t\r\n" );
name = strtok( NULL, " \t\r\n" ); name = strtok( NULL, " \t\r\n" );
...@@ -534,7 +750,7 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F ...@@ -534,7 +750,7 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
} }
} }
else if( strnicmp( Line, "ALIAS", 5 ) == 0 ) else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
{ {
/* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */ /* Read one ALIAS part from library: ALIAS 74HC00 74HCT00 7400 74LS37 */
strtok( Line, " \t\r\n" ); strtok( Line, " \t\r\n" );
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL ) while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
......
...@@ -31,14 +31,14 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent ) ...@@ -31,14 +31,14 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
WinEDA_ViewlibFrame* Viewer; WinEDA_ViewlibFrame* Viewer;
wxSemaphore semaphore( 0, 1 ); wxSemaphore semaphore( 0, 1 );
Viewer = parent->m_Parent->ViewlibFrame; Viewer = parent->m_Parent->m_ViewlibFrame;
/* Close the current Lib browser, if open, and open a new one, in "modal" mode */ /* Close the current Lib browser, if open, and open a new one, in "modal" mode */
if( Viewer ) if( Viewer )
Viewer->Destroy(); Viewer->Destroy();
Viewer = parent->m_Parent->ViewlibFrame = new Viewer = parent->m_Parent->m_ViewlibFrame = new
WinEDA_ViewlibFrame( WinEDA_ViewlibFrame(
parent->m_Parent->SchematicFrame, parent->m_Parent->m_SchematicFrame,
parent->m_Parent, parent->m_Parent,
NULL, NULL,
&semaphore ); &semaphore );
......
...@@ -88,7 +88,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, ...@@ -88,7 +88,7 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
WinEDA_LibeditFrame::~WinEDA_LibeditFrame() WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
/**********************************************/ /**********************************************/
{ {
m_Parent->LibeditFrame = NULL; m_Parent->m_LibeditFrame = NULL;
m_CurrentScreen = ScreenSch; m_CurrentScreen = ScreenSch;
} }
......
...@@ -1036,6 +1036,57 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil ) ...@@ -1036,6 +1036,57 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
return 0; return 0;
} }
/*******************************************************************/
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
EDA_SchComponentStruct* eComponent )
/*******************************************************************/
/** Find a PIN in a component
* @param pin_number = pin number (string)
* @param pin_number = pin number (string)
* @return a pointer on the pin, or NULL if not found
*/
{
LibEDA_BaseStruct* DrawItem;
EDA_LibComponentStruct* Entry;
LibDrawPin* Pin;
int Unit, Convert;
Entry = FindLibPart(eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL )
return NULL;
if( Entry->Type != ROOT )
{
DisplayError( NULL, wxT( "LocatePinByNumber() error: Entry is ALIAS" ) );
return NULL;
}
Unit = eComponent->m_Multi;
Convert = eComponent->m_Convert;
DrawItem = Entry->m_Drawings;
for( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
{
if( DrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) /* Pin Trouvee */
{
Pin = (LibDrawPin*) DrawItem;
if( Unit && DrawItem->m_Unit && (DrawItem->m_Unit != Unit) )
continue;
if( Convert && DrawItem->m_Convert && (DrawItem->m_Convert != Convert) )
continue;
wxString pNumber;
Pin->ReturnPinStringNum( pNumber );
if ( ePin_Number == pNumber )
return Pin;
}
}
return NULL;
}
/*******************************************************************/ /*******************************************************************/
LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos,
...@@ -1047,12 +1098,6 @@ LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, ...@@ -1047,12 +1098,6 @@ LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos,
* retourne un pointeur sur la pin, ou NULL si pas trouve * retourne un pointeur sur la pin, ou NULL si pas trouve
* Si Unit = 0, le numero d'unite n'est pas teste * Si Unit = 0, le numero d'unite n'est pas teste
* Si convert = 0, le numero convert n'est pas teste * Si convert = 0, le numero convert n'est pas teste
*
* m_Transform = matrice de transformation.
* Si NULL: matrice de transformation " normale" [1 , 0 , 0 , -1]
* (la matrice de transformation " normale" etant [1 , 0 , 0 , -1]
* la coord dy doit etre inversee).
* PartX, PartY: coordonnees de positionnement du composant
*/ */
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
......
...@@ -118,6 +118,8 @@ bool DrawStructInBox(int x1, int y1, int x2, int y2, ...@@ -118,6 +118,8 @@ bool DrawStructInBox(int x1, int y1, int x2, int y2,
/*************/ /*************/
/* LOCATE.CPP */ /* LOCATE.CPP */
/*************/ /*************/
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
EDA_SchComponentStruct* eComponent );
EDA_SchComponentStruct * LocateSmallestComponent( SCH_SCREEN * Screen ); EDA_SchComponentStruct * LocateSmallestComponent( SCH_SCREEN * Screen );
/* Recherche du plus petit (en surface) composant pointe par la souris */ /* Recherche du plus petit (en surface) composant pointe par la souris */
......
...@@ -182,19 +182,19 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -182,19 +182,19 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_TO_LIBRARY: case ID_TO_LIBRARY:
if( m_Parent->LibeditFrame ) if( m_Parent->m_LibeditFrame )
{ {
m_Parent->LibeditFrame->Show( TRUE ); m_Parent->m_LibeditFrame->Show( TRUE );
} }
else else
{ {
m_Parent->LibeditFrame = new m_Parent->m_LibeditFrame = new
WinEDA_LibeditFrame( m_Parent->SchematicFrame, WinEDA_LibeditFrame( m_Parent->m_SchematicFrame,
m_Parent, m_Parent,
wxT( "Library Editor" ), wxT( "Library Editor" ),
wxPoint( -1, -1 ), wxSize( 600, 400 ) ); wxPoint( -1, -1 ), wxSize( 600, 400 ) );
ActiveScreen = ScreenLib; ActiveScreen = ScreenLib;
m_Parent->LibeditFrame->AdjustScrollBars(); m_Parent->m_LibeditFrame->AdjustScrollBars();
} }
break; break;
...@@ -229,15 +229,15 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -229,15 +229,15 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
} }
case ID_TO_LIBVIEW: case ID_TO_LIBVIEW:
if( m_Parent->ViewlibFrame ) if( m_Parent->m_ViewlibFrame )
{ {
m_Parent->ViewlibFrame->Show( TRUE ); m_Parent->m_ViewlibFrame->Show( TRUE );
} }
else else
{ {
m_Parent->ViewlibFrame = new m_Parent->m_ViewlibFrame = new
WinEDA_ViewlibFrame( m_Parent->SchematicFrame, m_Parent ); WinEDA_ViewlibFrame( m_Parent->m_SchematicFrame, m_Parent );
m_Parent->ViewlibFrame->AdjustScrollBars(); m_Parent->m_ViewlibFrame->AdjustScrollBars();
} }
break; break;
......
...@@ -154,7 +154,7 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par ...@@ -154,7 +154,7 @@ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *par
WinEDA_SchematicFrame::~WinEDA_SchematicFrame() WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
{ {
m_Parent->SchematicFrame = NULL; m_Parent->m_SchematicFrame = NULL;
m_CurrentScreen = ScreenSch; m_CurrentScreen = ScreenSch;
} }
...@@ -164,9 +164,9 @@ void WinEDA_SchematicFrame::OnCloseWindow(wxCloseEvent & Event) ...@@ -164,9 +164,9 @@ void WinEDA_SchematicFrame::OnCloseWindow(wxCloseEvent & Event)
{ {
SCH_SCREEN * screen; SCH_SCREEN * screen;
if ( m_Parent->LibeditFrame ) // Can close component editor ? if ( m_Parent->m_LibeditFrame ) // Can close component editor ?
{ {
if ( ! m_Parent->LibeditFrame->Close() ) return; if ( ! m_Parent->m_LibeditFrame->Close() ) return;
} }
screen = ScreenSch ; screen = ScreenSch ;
......
...@@ -793,7 +793,7 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ) ...@@ -793,7 +793,7 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
wxString msg; wxString msg;
angle = DrawItem->t2 - DrawItem->t1; angle = DrawItem->t2 - DrawItem->t1;
msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 ); msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 );
EDA_Appl->LibeditFrame->PrintMsg( msg ); EDA_Appl->m_LibeditFrame->PrintMsg( msg );
while( (DrawItem->t2 - DrawItem->t1) >= 1800 ) while( (DrawItem->t2 - DrawItem->t1) >= 1800 )
{ {
......
...@@ -109,7 +109,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent, ...@@ -109,7 +109,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent,
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
{ {
delete m_CurrentScreen; delete m_CurrentScreen;
m_Parent->ViewlibFrame = NULL; m_Parent->m_ViewlibFrame = NULL;
} }
/*****************************************************************/ /*****************************************************************/
......
...@@ -30,9 +30,9 @@ public: ...@@ -30,9 +30,9 @@ public:
WinEDA_PcbFrame* m_PcbFrame; WinEDA_PcbFrame* m_PcbFrame;
WinEDA_ModuleEditFrame* m_ModuleEditFrame; WinEDA_ModuleEditFrame* m_ModuleEditFrame;
WinEDA_GerberFrame* m_GerberFrame; WinEDA_GerberFrame* m_GerberFrame;
WinEDA_SchematicFrame* SchematicFrame; // Edition des Schemas WinEDA_SchematicFrame* m_SchematicFrame; // Edition des Schemas
WinEDA_LibeditFrame* LibeditFrame; // Edition des composants WinEDA_LibeditFrame* m_LibeditFrame; // Edition des composants
WinEDA_ViewlibFrame* ViewlibFrame; // Visualisation des composants WinEDA_ViewlibFrame* m_ViewlibFrame; // Visualisation des composants
WinEDA_CvpcbFrame* m_CvpcbFrame; WinEDA_CvpcbFrame* m_CvpcbFrame;
wxPoint m_HelpPos; wxPoint m_HelpPos;
......
...@@ -171,15 +171,19 @@ public: ...@@ -171,15 +171,19 @@ public:
WinEDA_BasicFrame() { } // Should throw!! WinEDA_BasicFrame() { } // Should throw!!
#endif #endif
~WinEDA_BasicFrame(); ~WinEDA_BasicFrame();
void GetKicadHelp( wxCommandEvent& event ); void GetKicadHelp( wxCommandEvent& event );
void GetKicadAbout( wxCommandEvent& event ); void GetKicadAbout( wxCommandEvent& event );
void PrintMsg( const wxString& text ); void PrintMsg( const wxString& text );
void GetSettings(); void GetSettings();
void SaveSettings(); void SaveSettings();
int WriteHotkeyConfigFile(const wxString & Filename, struct Ki_HotkeyInfoSectionDescriptor * DescList, bool verbose); int WriteHotkeyConfigFile( const wxString& Filename,
int ReadHotkeyConfigFile(const wxString & Filename, struct Ki_HotkeyInfoSectionDescriptor * DescList, bool verbose); struct Ki_HotkeyInfoSectionDescriptor* DescList,
void SetLanguage( wxCommandEvent& event ); bool verbose );
int ReadHotkeyConfigFile( const wxString& Filename,
struct Ki_HotkeyInfoSectionDescriptor* DescList,
bool verbose );
void SetLanguage( wxCommandEvent& event );
void ProcessFontPreferences( int id ); void ProcessFontPreferences( int id );
wxString GetLastProject( int rang ); wxString GetLastProject( int rang );
...@@ -215,7 +219,7 @@ public: ...@@ -215,7 +219,7 @@ public:
int m_InternalUnits; // nombre d'unites internes pour 1 pouce int m_InternalUnits; // nombre d'unites internes pour 1 pouce
// = 1000 pour schema, = 10000 pour PCB // = 1000 pour schema, = 10000 pour PCB
int m_UnitType; // Internal Unit type (0 = inch) int m_UnitType; // Internal Unit type (0 = inch)
bool m_Draw_Axis; // TRUE pour avoir les axes dessines bool m_Draw_Axis; // TRUE pour avoir les axes dessines
bool m_Draw_Grid; // TRUE pour avoir la grille dessinee bool m_Draw_Grid; // TRUE pour avoir la grille dessinee
...@@ -235,8 +239,8 @@ public: ...@@ -235,8 +239,8 @@ public:
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_DrawFrame(); ~WinEDA_DrawFrame();
BASE_SCREEN* GetScreen() { return m_CurrentScreen; } BASE_SCREEN* GetScreen() { return m_CurrentScreen; }
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
...@@ -244,6 +248,7 @@ public: ...@@ -244,6 +248,7 @@ public:
void AddFontSelectionMenu( wxMenu* main_menu ); void AddFontSelectionMenu( wxMenu* main_menu );
void ProcessFontPreferences( wxCommandEvent& event ); void ProcessFontPreferences( wxCommandEvent& event );
void Affiche_Message( const wxString& message ); void Affiche_Message( const wxString& message );
void EraseMsgBox(); void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event ); void Process_PageSettings( wxCommandEvent& event );
...@@ -339,10 +344,10 @@ public: ...@@ -339,10 +344,10 @@ public:
bool m_DisplayPcbTrackFill; /* FALSE = sketch , TRUE = rempli */ bool m_DisplayPcbTrackFill; /* FALSE = sketch , TRUE = rempli */
WinEDA3D_DrawFrame* m_Draw3DFrame; WinEDA3D_DrawFrame* m_Draw3DFrame;
protected: protected:
GENERAL_COLLECTOR* m_Collector; GENERAL_COLLECTOR* m_Collector;
public: public:
WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype, WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype,
const wxString& title, const wxString& title,
...@@ -361,7 +366,7 @@ public: ...@@ -361,7 +366,7 @@ public:
virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar(); virtual void ReCreateMenuBar();
PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; } PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; }
int BestZoom(); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
...@@ -377,39 +382,40 @@ private: ...@@ -377,39 +382,40 @@ private:
virtual void GetComponentFromUndoList(); virtual void GetComponentFromUndoList();
virtual void GetComponentFromRedoList(); virtual void GetComponentFromRedoList();
public: public:
// Read/write fonctions: // Read/write fonctions:
EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum ); EDA_BaseStruct* ReadDrawSegmentDescr( FILE* File, int* LineNum );
int ReadListeSegmentDescr( wxDC* DC, FILE* File, int ReadListeSegmentDescr( wxDC* DC, FILE* File,
TRACK* PtSegm, int StructType, TRACK* PtSegm, int StructType,
int* LineNum, int NumSegm ); int* LineNum, int NumSegm );
int ReadSetup( FILE* File, int* LineNum ); int ReadSetup( FILE* File, int* LineNum );
int ReadGeneralDescrPcb( wxDC* DC, FILE* File, int* LineNum ); int ReadGeneralDescrPcb( wxDC* DC, FILE* File, int* LineNum );
// Gestion du PCB // Gestion du PCB
bool Clear_Pcb( wxDC* DC, bool query ); bool Clear_Pcb( wxDC* DC, bool query );
/** /**
* Function PcbGeneralLocateAndDisplay * Function PcbGeneralLocateAndDisplay
* searches for an item under the mouse cursor. * searches for an item under the mouse cursor.
* Items are searched first on the current working layer. * Items are searched first on the current working layer.
* If nothing found, an item will be searched without layer restriction. If * If nothing found, an item will be searched without layer restriction. If
* more than one item is found meeting the current working layer criterion, then * more than one item is found meeting the current working layer criterion, then
* a popup menu is shown which allows the user to pick which item he/she is * a popup menu is shown which allows the user to pick which item he/she is
* interested in. Once an item is chosen, then it is make the "current item" * interested in. Once an item is chosen, then it is make the "current item"
* and the status window is updated to reflect this. * and the status window is updated to reflect this.
* *
* @param aHotKeyCode The hotkey which relates to the caller and determines the * @param aHotKeyCode The hotkey which relates to the caller and determines the
* type of search to be performed. If zero, then the mouse tools will be * type of search to be performed. If zero, then the mouse tools will be
* tested instead. * tested instead.
*/ */
BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 ); BOARD_ITEM* PcbGeneralLocateAndDisplay( int aHotKeyCode = 0 );
BOARD_ITEM* Locate( int typeloc, int LayerSearch ); BOARD_ITEM* Locate( int typeloc, int LayerSearch );
void ProcessItemSelection( wxCommandEvent& event ); void ProcessItemSelection( wxCommandEvent& event );
/** /**
* Function SetCurItem * Function SetCurItem
* sets the currently selected item and displays it in the MsgPanel. * sets the currently selected item and displays it in the MsgPanel.
...@@ -419,18 +425,18 @@ public: ...@@ -419,18 +425,18 @@ public:
* of selecting an item to displaying it using BOARD_ITEM::Display_Infos(). * of selecting an item to displaying it using BOARD_ITEM::Display_Infos().
* @param aItem The BOARD_ITEM to make the selected item or NULL if none. * @param aItem The BOARD_ITEM to make the selected item or NULL if none.
*/ */
void SetCurItem( BOARD_ITEM* aItem ); void SetCurItem( BOARD_ITEM* aItem );
BOARD_ITEM* GetCurItem(); BOARD_ITEM* GetCurItem();
/** /**
* Function GetCollectorsGuide * Function GetCollectorsGuide
* @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options. * @return GENERAL_COLLECTORS_GUIDE - that considers the global configuration options.
*/ */
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide(); GENERAL_COLLECTORS_GUIDE GetCollectorsGuide();
// Gestion du curseur // Gestion du curseur
void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap, void place_marqueur( wxDC* DC, const wxPoint& pos, char* pt_bitmap,
int DrawMode, int color, int type ); int DrawMode, int color, int type );
/* Place un repere sur l'ecran au point de coordonnees PCB pos */ /* Place un repere sur l'ecran au point de coordonnees PCB pos */
...@@ -480,11 +486,11 @@ public: ...@@ -480,11 +486,11 @@ public:
// Chargement de modules // Chargement de modules
MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library, MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library,
const wxString& ModuleName, bool show_msg_err ); const wxString& ModuleName, bool show_msg_err );
wxString Select_1_Module_From_List( wxString Select_1_Module_From_List(
WinEDA_DrawFrame* active_window, const wxString& Library, WinEDA_DrawFrame* active_window, const wxString& Library,
const wxString& Mask, const wxString& KeyWord ); const wxString& Mask, const wxString& KeyWord );
MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC ); MODULE* Load_Module_From_Library( const wxString& library, wxDC* DC );
// Gestion des chevelus (ratsnest) // Gestion des chevelus (ratsnest)
...@@ -497,7 +503,7 @@ public: ...@@ -497,7 +503,7 @@ public:
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 ); void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
void trace_ratsnest_pad( wxDC* DC ); void trace_ratsnest_pad( wxDC* DC );
void recalcule_pad_net_code();/* Routine de void recalcule_pad_net_code();/* Routine de
* calcul et de mise a jour des net_codes des PADS */ * calcul et de mise a jour des net_codes des PADS */
void build_liste_pads(); void build_liste_pads();
int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init ); int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init );
...@@ -540,7 +546,7 @@ public: ...@@ -540,7 +546,7 @@ public:
// divers // divers
void AddHistory( int value, KICAD_T type ); // Add value in data list history void AddHistory( int value, KICAD_T type ); // Add value in data list history
void InstallGridFrame( const wxPoint& pos ); void InstallGridFrame( const wxPoint& pos );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
...@@ -550,7 +556,6 @@ public: ...@@ -550,7 +556,6 @@ public:
/*****************************************************/ /*****************************************************/
class WinEDA_PcbFrame : public WinEDA_BasePcbFrame class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{ {
public: public:
WinEDAChoiceBox* m_SelLayerBox; WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelTrackWidthBox; WinEDAChoiceBox* m_SelTrackWidthBox;
...@@ -561,13 +566,13 @@ private: ...@@ -561,13 +566,13 @@ private:
bool m_SelViaSizeBox_Changed; bool m_SelViaSizeBox_Changed;
wxMenu* m_FilesMenu; wxMenu* m_FilesMenu;
// we'll use lower case function names for private member functions. // we'll use lower case function names for private member functions.
void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu ); void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu ); void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu ); void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu ); void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ); void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
void createPopUpBlockMenu( wxMenu* menu ); void createPopUpBlockMenu( wxMenu* menu );
public: public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
...@@ -584,7 +589,7 @@ public: ...@@ -584,7 +589,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void ProcessMuWaveFunctions( wxCommandEvent& event ); void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
...@@ -599,7 +604,7 @@ public: ...@@ -599,7 +604,7 @@ public:
void PrepareLayerIndicator(); void PrepareLayerIndicator();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
/** /**
* Function OnRightClick * Function OnRightClick
* populates a popup menu with the choices appropriate for the current context. * populates a popup menu with the choices appropriate for the current context.
...@@ -608,7 +613,7 @@ public: ...@@ -608,7 +613,7 @@ public:
* @param aPopMenu The menu to add to. * @param aPopMenu The menu to add to.
*/ */
void OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ); void OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
...@@ -822,8 +827,7 @@ public: ...@@ -822,8 +827,7 @@ public:
EDA_BaseStruct* GerberGeneralLocateAndDisplay(); EDA_BaseStruct* GerberGeneralLocateAndDisplay();
EDA_BaseStruct* Locate( int typeloc ); EDA_BaseStruct* Locate( int typeloc );
void SetToolbars(); void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
...@@ -989,7 +993,6 @@ enum fl_rot_cmp { ...@@ -989,7 +993,6 @@ enum fl_rot_cmp {
CMP_ORIENT_270, // orientation -90, pas de miroir CMP_ORIENT_270, // orientation -90, pas de miroir
CMP_MIROIR_X = 0x100, // miroir selon axe X CMP_MIROIR_X = 0x100, // miroir selon axe X
CMP_MIROIR_Y = 0x200 // miroir selon axe Y CMP_MIROIR_Y = 0x200 // miroir selon axe Y
}; };
class WinEDA_SchematicFrame : public WinEDA_DrawFrame class WinEDA_SchematicFrame : public WinEDA_DrawFrame
...@@ -1006,34 +1009,43 @@ public: ...@@ -1006,34 +1009,43 @@ public:
~WinEDA_SchematicFrame(); ~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void Save_Config( wxWindow* displayframe ); void Save_Config( wxWindow* displayframe );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void ReCreateOptToolbar(); void ReCreateOptToolbar();
void ReCreateMenuBar(); void ReCreateMenuBar();
void SetToolbars(); void SetToolbars();
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC,
int hotkey,
EDA_BaseStruct* DrawStruct );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE ); EDA_BaseStruct* SchematicGeneralLocateAndDisplay(
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin = TRUE );
bool IncludePin ); EDA_BaseStruct* SchematicGeneralLocateAndDisplay(
const wxPoint& refpoint,
bool IncludePin );
EDA_BaseStruct* WinEDA_SchematicFrame:: FindComponentAndItem(
const wxString& component_reference, bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
/* netlist generation */ /* netlist generation */
void* BuildNetListBase(); void* BuildNetListBase();
...@@ -1053,6 +1065,7 @@ public: ...@@ -1053,6 +1065,7 @@ public:
bool LoadOneSheet( SCH_SCREEN* screen, const wxString& FullFileName ); bool LoadOneSheet( SCH_SCREEN* screen, const wxString& FullFileName );
// General search: // General search:
/** /**
* Function FindSchematicItem * Function FindSchematicItem
* finds a string in the schematic. * finds a string in the schematic.
...@@ -1062,8 +1075,10 @@ public: ...@@ -1062,8 +1075,10 @@ public:
* 2 => or for the next item * 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
EDA_BaseStruct* FindSchematicItem( const wxString& pattern, int SearchType, bool mouseWarp=true ); EDA_BaseStruct* FindSchematicItem( const wxString& pattern,
int SearchType,
bool mouseWarp = true );
EDA_BaseStruct* FindMarker( int SearchType ); EDA_BaseStruct* FindMarker( int SearchType );
private: private:
...@@ -1198,19 +1213,20 @@ public: ...@@ -1198,19 +1213,20 @@ public:
~WinEDA_LibeditFrame(); ~WinEDA_LibeditFrame();
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos(); void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void SetToolbars(); void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
private: private:
...@@ -1584,13 +1600,13 @@ public: ...@@ -1584,13 +1600,13 @@ public:
const wxChar** m_ItemList; const wxChar** m_ItemList;
private: private:
void (*m_MoveFct)(wxString & Text); void (*m_MoveFct)( wxString & Text );
public: public:
WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title, WinEDAListBox( WinEDA_DrawFrame* parent, const wxString& title,
const wxChar** ItemList, const wxChar** ItemList,
const wxString& RefText, const wxString& RefText,
void (* movefct)(wxString& Text) = NULL, void(* movefct)(wxString& Text) = NULL,
const wxColour& colour = wxNullColour, const wxColour& colour = wxNullColour,
wxPoint dialog_position = wxDefaultPosition ); wxPoint dialog_position = wxDefaultPosition );
~WinEDAListBox(); ~WinEDAListBox();
......
...@@ -17,23 +17,26 @@ ...@@ -17,23 +17,26 @@
#include "bitmaps.h" #include "bitmaps.h"
/****************************************/ /*******************************************/
void RemoteCommand( const char* cmdline ) void RemoteCommand( const char* cmdline )
/****************************************/ /*******************************************/
/* Read a remote command send by eeschema via a socket, /** Read a remote command send by eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242) * port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
* @param cmdline = received command from eeschema
* Commands are
* $PART: "reference" put cursor on component
* $PIN: "pin name" $PART: "reference" put cursor on the footprint pin
*/ */
{ {
char line[1024]; char line[1024];
wxString msg; wxString msg;
char* idcmd; char* idcmd;
char* text; char* text;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
MODULE* module = 0; MODULE* module = 0;
WinEDA_PcbFrame* frame = EDA_Appl->m_PcbFrame;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
msg = CONV_FROM_UTF8( line );
idcmd = strtok( line, " \n\r" ); idcmd = strtok( line, " \n\r" );
text = strtok( NULL, " \n\r" ); text = strtok( NULL, " \n\r" );
...@@ -104,6 +107,7 @@ void RemoteCommand( const char* cmdline ) ...@@ -104,6 +107,7 @@ void RemoteCommand( const char* cmdline )
msg.Printf( _( "Pin %s (module %s) not found" ), pinName.GetData(), modName.GetData() ); msg.Printf( _( "Pin %s (module %s) not found" ), pinName.GetData(), modName.GetData() );
else else
msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() ); msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() );
frame->Affiche_Message( msg ); frame->Affiche_Message( msg );
} }
...@@ -180,9 +184,9 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -180,9 +184,9 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
break; break;
default: default:
scanList = DisplayOpt.DisplayZones ? scanList = DisplayOpt.DisplayZones ?
GENERAL_COLLECTOR::AllBoardItems : GENERAL_COLLECTOR::AllBoardItems :
GENERAL_COLLECTOR::AllButZones; GENERAL_COLLECTOR::AllButZones;
break; break;
} }
} }
...@@ -203,31 +207,33 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -203,31 +207,33 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
break; break;
default: default:
scanList = DisplayOpt.DisplayZones ? scanList = DisplayOpt.DisplayZones ?
GENERAL_COLLECTOR::AllBoardItems : GENERAL_COLLECTOR::AllBoardItems :
GENERAL_COLLECTOR::AllButZones; GENERAL_COLLECTOR::AllButZones;
} }
} }
m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide ); m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide );
#if 0 #if 0
// debugging: print out the collected items, showing their priority order too. // debugging: print out the collected items, showing their priority order too.
for( int i=0; i<m_Collector->GetCount(); ++i ) for( int i = 0; i<m_Collector->GetCount(); ++i )
(*m_Collector)[i]->Show( 0, std::cout ); (*m_Collector)[i]->Show( 0, std::cout );
#endif
#endif
/* Remove redundancies: most of time, zones are found twice, /* Remove redundancies: most of time, zones are found twice,
* because zones are filled twice ( once by by horizontal and once by vertical segments ) * because zones are filled twice ( once by by horizontal and once by vertical segments )
*/ */
unsigned long timestampzone = 0; unsigned long timestampzone = 0;
for( int ii = 0; ii < m_Collector->GetCount(); ii++ ) for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
{ {
item = (*m_Collector)[ii]; item = (*m_Collector)[ii];
if( item->Type() != TYPEZONE ) if( item->Type() != TYPEZONE )
continue; continue;
/* Found a TYPE ZONE */ /* Found a TYPE ZONE */
if( item->m_TimeStamp == timestampzone ) // Remove it, redundant, zone already found if( item->m_TimeStamp == timestampzone ) // Remove it, redundant, zone already found
{ {
...@@ -243,22 +249,21 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -243,22 +249,21 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
item = (*m_Collector)[0]; item = (*m_Collector)[0];
SetCurItem( item ); SetCurItem( item );
} }
// If the count is 2, and first item is a pad or moduletext, and the 2nd item is its parent module: // If the count is 2, and first item is a pad or moduletext, and the 2nd item is its parent module:
else if( m_Collector->GetCount() == 2 else if( m_Collector->GetCount() == 2
&& ( (*m_Collector)[0]->Type() == TYPEPAD || (*m_Collector)[0]->Type() == TYPETEXTEMODULE ) && ( (*m_Collector)[0]->Type() == TYPEPAD || (*m_Collector)[0]->Type() ==
&& (*m_Collector)[1]->Type() == TYPEMODULE && (*m_Collector)[0]->GetParent()== (*m_Collector)[1] ) TYPETEXTEMODULE )
&& (*m_Collector)[1]->Type() == TYPEMODULE && (*m_Collector)[0]->GetParent()==
(*m_Collector)[1] )
{ {
item = (*m_Collector)[0]; item = (*m_Collector)[0];
SetCurItem( item ); SetCurItem( item );
} }
// if all are modules, find the smallest one amoung the primary choices // if all are modules, find the smallest one amoung the primary choices
else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL ) else if( ( item = AllAreModulesAndReturnSmallestIfSo( m_Collector ) ) != NULL )
{ {
SetCurItem( item ); SetCurItem( item );
} }
else // we can't figure out which item user wants, do popup menu so user can choose else // we can't figure out which item user wants, do popup menu so user can choose
{ {
wxMenu itemMenu; wxMenu itemMenu;
...@@ -281,12 +286,12 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -281,12 +286,12 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
} }
/* @todo: rather than assignment to TRUE, these should be increment and decrement operators throughout _everywhere_. /* @todo: rather than assignment to TRUE, these should be increment and decrement operators throughout _everywhere_.
That way we can handle nesting. * That way we can handle nesting.
But I tried that and found there cases where the assignment to TRUE (converted to a m_IgnoreMouseEvents++ ) * But I tried that and found there cases where the assignment to TRUE (converted to a m_IgnoreMouseEvents++ )
was not balanced with the -- (now m_IgnoreMouseEvents=FALSE), so I had to revert. * was not balanced with the -- (now m_IgnoreMouseEvents=FALSE), so I had to revert.
Somebody should track down these and make them balanced. * Somebody should track down these and make them balanced.
DrawPanel->m_IgnoreMouseEvents = TRUE; * DrawPanel->m_IgnoreMouseEvents = TRUE;
*/ */
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection() // this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
// and it calls SetCurItem() which in turn calls Display_Infos() on the item. // and it calls SetCurItem() which in turn calls Display_Infos() on the item.
......
...@@ -53,7 +53,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -53,7 +53,7 @@ static void Affiche_Erreur_DRC( WinEDA_DrawPanel* panel, wxDC* DC,
/*******************************************/ /*******************************************/
/* Frame d'option et execution DRC general */ /* function relatives to the DRC control */
/*******************************************/ /*******************************************/
#include "dialog_drc.cpp" #include "dialog_drc.cpp"
...@@ -206,10 +206,7 @@ void WinEDA_DrcFrame::DelDRCMarkers( wxCommandEvent& event ) ...@@ -206,10 +206,7 @@ void WinEDA_DrcFrame::DelDRCMarkers( wxCommandEvent& event )
void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC ) void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC )
/******************************************************/ /******************************************************/
/* Test des isolements : teste les isolements des pistes et place un /* install a dialog box to handle the general DRC control
* marqueur sur les divers segments en defaut
* Principe:
* Appelle la routine drc() pour chaque segment de piste existant
*/ */
{ {
AbortDrc = FALSE; AbortDrc = FALSE;
...@@ -223,10 +220,9 @@ void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC ) ...@@ -223,10 +220,9 @@ void WinEDA_PcbFrame::Install_Test_DRC_Frame( wxDC* DC )
int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
/************************************************************************/ /************************************************************************/
/* Test des isolements : teste les isolements des pistes et place un /* Test DRC :
* marqueur sur les divers segments en defaut * Run a drc control for each pad and track segment
* Principe: * Put a marker on pad or track end which have a drc problem
* Appelle la routine drc() pour chaque segment de piste existant
*/ */
{ {
int ii, jj, old_net; int ii, jj, old_net;
...@@ -253,10 +249,10 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) ...@@ -253,10 +249,10 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
m_CurrentScreen->SetRefreshReq(); m_CurrentScreen->SetRefreshReq();
/* Effacement des anciens marqueurs */ /* Delete previous markers */
Erase_Marqueurs(); Erase_Marqueurs();
if( TestPad2Pad ) /* Test DRC des pads entre eux */ if( TestPad2Pad ) /* First test: Test DRC between pads (no track)*/
{ {
Line.Printf( wxT( "%d" ), m_Pcb->m_NbPads ); Line.Printf( wxT( "%d" ), m_Pcb->m_NbPads );
Affiche_1_Parametre( this, PRINT_NB_PAD_POS, wxT( "NbPad" ), Line, RED ); Affiche_1_Parametre( this, PRINT_NB_PAD_POS, wxT( "NbPad" ), Line, RED );
...@@ -373,7 +369,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ) ...@@ -373,7 +369,7 @@ int WinEDA_PcbFrame::Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone )
} }
} }
/* Test zone segments segments */ /* Test zone segments */
if( TestZone ) if( TestZone )
{ {
m_Pcb->m_NbSegmZone = 0; m_Pcb->m_NbSegmZone = 0;
...@@ -494,15 +490,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -494,15 +490,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
TRACK* pt_segment, TRACK* StartBuffer, int show_err ) TRACK* pt_segment, TRACK* StartBuffer, int show_err )
/***********************************************************************/ /***********************************************************************/
/* /**
* Teste le segment en cours de trace: * Test the current segment:
* pt_segment = pointeur sur segment a controler * @param pt_segment = current segment to test
* StartBuffer = adresse de la zone des pistes a controler * @param StartBuffer = track buffer to test (usually m_Pcb->m_Track)
* (typiquement m_Pcb->m_Track) * @param show_err (flag) si 0 pas d'affichage d'erreur sur ecran
* show_err (flag) si 0 pas d'affichage d'erreur sur ecran * @return : BAD_DRC (1) if DRC error or OK_DRC (0) if OK
* retourne :
* BAD_DRC (1) si Violation DRC
* OK_DRC (0) si OK
*/ */
{ {
int ii; int ii;
...@@ -526,31 +519,34 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -526,31 +519,34 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
net_code_ref = pt_segment->m_NetCode; net_code_ref = pt_segment->m_NetCode;
segm_angle = 0; segm_angle = 0;
/* for a non horizontal or vertical segment Compute the segment angle
in 0,1 degrees and its lenght */
if( dx || dy ) if( dx || dy )
{ {
/* calcul de l'angle d'inclinaison en 0,1 degre */ /* Compute the segment angle in 0,1 degrees */
segm_angle = ArcTangente( dy, dx ); segm_angle = ArcTangente( dy, dx );
/* Calcul de la longueur du segment en segm_long : dx = longueur */ /* Compute the segment lenght: we build an equivalent rotated segment,
RotatePoint( &dx, &dy, segm_angle ); /* segm_long = longueur, yf = 0 */ this segment is horizontal, therefore dx = lenght */
RotatePoint( &dx, &dy, segm_angle ); /* dx = lenght, dy = 0 */
} }
/* Ici le segment a ete tourne de segm_angle, et est horizontal, dx > 0 */
segm_long = dx; segm_long = dx;
/******************************************/ /******************************************/
/* Phase 1 : test DRC track to pads :*/ /* Phase 1 : test DRC track to pads :*/
/******************************************/ /******************************************/
/* calcul de la distance min aux pads : */ /* Compute the min distance to pads : */
w_dist = (unsigned) (pt_segment->m_Width >> 1 ); w_dist = (unsigned) (pt_segment->m_Width >> 1 );
for( ii = 0; ii < frame->m_Pcb->m_NbPads; ii++ ) for( ii = 0; ii < frame->m_Pcb->m_NbPads; ii++ )
{ {
D_PAD* pt_pad = frame->m_Pcb->m_Pads[ii]; D_PAD* pt_pad = frame->m_Pcb->m_Pads[ii];
/* Pas de probleme si les pads sont en surface autre que la couche, /* No problem if pads are on an other layer,
* sauf si le trou de percage gene (cas des pastilles perc�s simple * But if a drill hole exists (a pad on a single layer can have a hole!)
* face sur CI double face */ * we must test the hole
*/
if( (pt_pad->m_Masque_Layer & MaskLayer ) == 0 ) if( (pt_pad->m_Masque_Layer & MaskLayer ) == 0 )
{ {
/* We must test the pad hole. In order to use the function "TestClearanceSegmToPad", /* We must test the pad hole. In order to use the function "TestClearanceSegmToPad",
...@@ -579,9 +575,10 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -579,9 +575,10 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
continue; continue;
} }
/* Le pad doit faire partie d'un net mais pas de probleme /* The pad must be in a net (i.e pt_pad->m_NetCode != 0 )
* si le pad est du meme net */ * but no problem if the pad netcode is the current netcode (same net) */
if( /*pt_pad->m_NetCode &&*/ net_code_ref == pt_pad->m_NetCode ) if( pt_pad->m_NetCode && // the pad must be connected
net_code_ref == pt_pad->m_NetCode ) // the pad net is the same as current net -> Ok
continue; continue;
/* Test DRC pour les pads */ /* Test DRC pour les pads */
...@@ -591,7 +588,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -591,7 +588,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
if( TestClearanceSegmToPad( pt_pad, w_dist, g_DesignSettings.m_TrackClearence ) == OK_DRC ) if( TestClearanceSegmToPad( pt_pad, w_dist, g_DesignSettings.m_TrackClearence ) == OK_DRC )
continue; continue;
/* extremite sur pad ou defaut d'isolation trouve */ /* Drc error found! */
else else
{ {
ErrorsDRC_Count++; ErrorsDRC_Count++;
...@@ -603,20 +600,20 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -603,20 +600,20 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
} }
/**********************************************/ /**********************************************/
/* Phase 2 : test DRC avec les autres pistes :*/ /* Phase 2: test DRC with other track segments */
/**********************************************/ /**********************************************/
/* Ici le segment de reference est sur l'axe X */ /* At this point the reference segment is the X axis */
/* Comparaison du segment de reference aux autres segments de piste */ /* Test the reference segment with other track segments */
pttrack = StartBuffer; pttrack = StartBuffer;
for( ; pttrack != NULL; pttrack = (TRACK*) pttrack->Pnext ) for( ; pttrack != NULL; pttrack = (TRACK*) pttrack->Pnext )
{ {
//pas de probleme si le segment a tester est du meme net: //No problem if segments have the meme net code:
if( net_code_ref == pttrack->m_NetCode ) if( net_code_ref == pttrack->m_NetCode )
continue; continue;
//pas de probleme si le segment a tester est sur une autre couche : // No problem if segment are on different layers :
if( ( MaskLayer & pttrack->ReturnMaskLayer() ) == 0 ) if( ( MaskLayer & pttrack->ReturnMaskLayer() ) == 0 )
continue; continue;
...@@ -626,7 +623,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -626,7 +623,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
w_dist += pttrack->m_Width >> 1; w_dist += pttrack->m_Width >> 1;
w_dist += g_DesignSettings.m_TrackClearence; w_dist += g_DesignSettings.m_TrackClearence;
/* si le segment de reference est une via, le traitement est ici */ /* If the reference segment is a via, we test it here */
if( pt_segment->Type() == TYPEVIA ) if( pt_segment->Type() == TYPEVIA )
{ {
int orgx, orgy; // origine du repere d'axe X = segment a comparer int orgx, orgy; // origine du repere d'axe X = segment a comparer
...@@ -650,12 +647,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -650,12 +647,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
return BAD_DRC; return BAD_DRC;
} }
} }
else /* Tst distance de via a segment */ else /* Tst drc via / segment */
{ {
/* calcul de l'angle */ /* Compute l'angle */
angle = ArcTangente( dy, dx ); angle = ArcTangente( dy, dx );
/* Calcul des coord dans le nouveau repere */ /* Compute new coordinates ( the segment become horizontal) */
RotatePoint( &dx, &dy, angle ); RotatePoint( &dx, &dy, angle );
RotatePoint( &x0, &y0, angle ); RotatePoint( &x0, &y0, angle );
...@@ -675,8 +672,10 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -675,8 +672,10 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
continue; continue;
} }
/* calcule x0,y0, xf,yf = coord de debut et fin du segment de piste /* We compute x0,y0, xf,yf = starting and ending point coordinates for the segment to test
* a tester, dans le repere axe X = segment de reference */ * in the new axis : the new X axis is the reference segment
* We must translate and rotate the segment to test
*/
x0 = pttrack->m_Start.x - org_X; x0 = pttrack->m_Start.x - org_X;
y0 = pttrack->m_Start.y - org_Y; y0 = pttrack->m_Start.y - org_Y;
...@@ -697,20 +696,20 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -697,20 +696,20 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
} }
/* /* We have changed axis:
* le segment de reference est Horizontal, par suite des modifs d'axe. * the reference segment is Horizontal.
* 3 cas : segment a comparer parallele, perp ou incline * 3 cases : the segment to test can be parallel, perpendicular or have an other direction
*/ */
if( y0 == yf ) // segments paralleles if( y0 == yf ) // parallel segments
{ {
if( abs( y0 ) >= w_dist ) if( abs( y0 ) >= w_dist )
continue; continue;
if( x0 > xf ) if( x0 > xf )
EXCHG( x0, xf ); /* pour que x0 <= xf */ EXCHG( x0, xf ); /* pour que x0 <= xf */
if( x0 > (-w_dist) && x0 < (segm_long + w_dist) ) /* Risque de defaut */ if( x0 > (-w_dist) && x0 < (segm_long + w_dist) ) /* possible error drc */
{ {
/* test fin tenant compte des formes arrondies des extremites */ /* Fine test : we consider the rounded shape of the ends */
if( x0 >= 0 && x0 <= segm_long ) if( x0 >= 0 && x0 <= segm_long )
{ {
ErrorsDRC_Count++; ErrorsDRC_Count++;
...@@ -738,7 +737,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -738,7 +737,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
} }
if( xf > (-w_dist) && xf < (segm_long + w_dist) ) if( xf > (-w_dist) && xf < (segm_long + w_dist) )
{ {
/* test fin tenant compte des formes arrondies des extremites */ /* Fine test : we consider the rounded shape of the ends */
if( xf >= 0 && xf <= segm_long ) if( xf >= 0 && xf <= segm_long )
{ {
ErrorsDRC_Count++; ErrorsDRC_Count++;
...@@ -773,12 +772,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -773,12 +772,12 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
return BAD_DRC; return BAD_DRC;
} }
} }
else if( x0 == xf ) // segments perpendiculaires else if( x0 == xf ) // perpendicular segments
{ {
if( ( x0 <= (-w_dist) ) || ( x0 >= (segm_long + w_dist) ) ) if( ( x0 <= (-w_dist) ) || ( x0 >= (segm_long + w_dist) ) )
continue; continue;
/* test si les segments se croisent */ /* Test is segments are crossing */
if( y0 > yf ) if( y0 > yf )
EXCHG( y0, yf ); EXCHG( y0, yf );
if( (y0 < 0) && (yf > 0) ) if( (y0 < 0) && (yf > 0) )
...@@ -789,8 +788,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -789,8 +788,7 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
return BAD_DRC; return BAD_DRC;
} }
/* ici l'erreur est due a une extremite pres d'une extremite du segm /* At this point the drc error is due to an end near a reference segm end */
* de reference */
if( TestMarginToCircle( x0, y0, w_dist, segm_long ) == BAD_DRC ) if( TestMarginToCircle( x0, y0, w_dist, segm_long ) == BAD_DRC )
{ {
ErrorsDRC_Count++; ErrorsDRC_Count++;
...@@ -810,17 +808,17 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -810,17 +808,17 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
{ {
int bflag = OK_DRC; int bflag = OK_DRC;
/* calcul de la "surface de securite du segment de reference */ /* calcul de la "surface de securite du segment de reference */
/* premiere passe : la piste est assimilee a un rectangle */ /* First rought 'and fast) test : the track segment is like a rectangle */
xcliplo = ycliplo = -w_dist; xcliplo = ycliplo = -w_dist;
xcliphi = segm_long + w_dist; ycliphi = w_dist; xcliphi = segm_long + w_dist; ycliphi = w_dist;
bflag = Tst_Ligne( x0, y0, xf, yf ); bflag = Tst_Ligne( x0, y0, xf, yf );
if( bflag == BAD_DRC ) if( bflag == BAD_DRC ) /* A fine test is needed because a serment is not exactly a rectangle
it has rounded ends */
{ {
/* 2eme passe : la piste a des extremites arrondies. /* 2eme passe : the track has rounded ends.
* Si le defaut de drc est du a une extremite : le calcul * we must a fine test for each rounded end and the rectangular zone */
* est affine pour tenir compte de cet arrondi */
xcliplo = 0; xcliphi = segm_long; xcliplo = 0; xcliphi = segm_long;
bflag = Tst_Ligne( x0, y0, xf, yf ); bflag = Tst_Ligne( x0, y0, xf, yf );
...@@ -837,9 +835,9 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -837,9 +835,9 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
9 ); 9 );
return BAD_DRC; return BAD_DRC;
} }
else // L'erreur est due a une extremite du segment de reference: else // The drc error is due to the starting or the ending point of the reference segment
{ {
// il faut tester les extremites de ce segment // Test the starting and the ending point
int angle, rx0, ry0, rxf, ryf; int angle, rx0, ry0, rxf, ryf;
x0 = pttrack->m_Start.x; x0 = pttrack->m_Start.x;
y0 = pttrack->m_Start.y; y0 = pttrack->m_Start.y;
...@@ -850,14 +848,14 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC, ...@@ -850,14 +848,14 @@ int Drc( WinEDA_BasePcbFrame* frame, wxDC* DC,
dx = xf - x0; dx = xf - x0;
dy = yf - y0; dy = yf - y0;
/* calcul de l'angle d'inclinaison en 0,1 degre */ /* Compute the segment orientation (angle) en 0,1 degre */
angle = ArcTangente( dy, dx ); angle = ArcTangente( dy, dx );
/* Calcul de la longueur du segment: dx = longueur */ /* Compute the segment lenght: dx = longueur */
RotatePoint( &dx, &dy, angle ); RotatePoint( &dx, &dy, angle );
/* calcul des coord du segment de reference ds le repere /* Comute the reference segment coordinates relatives to a
* d'axe X = segment courant en tst */ * X axis = current tested segment */
rx0 = pt_segment->m_Start.x - x0; rx0 = pt_segment->m_Start.x - x0;
ry0 = pt_segment->m_Start.y - y0; ry0 = pt_segment->m_Start.y - y0;
rxf = pt_segment->m_End.x - x0; rxf = pt_segment->m_End.x - x0;
...@@ -908,9 +906,14 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame, ...@@ -908,9 +906,14 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame,
bool show_err ) bool show_err )
/*****************************************************************************/ /*****************************************************************************/
/* Teste l'isolation de pad_ref avec les autres pads. /** Test the drc between pad_ref and other pads.
* end_buffer = upper limit of the pad list. * the pad list must be sorted by x coordinate
* max_size = size of the biggest pad (used to stop the test when the X distance is > max_size) * @param frame = current active frame
* @param DC = current DC
* @param pad_ref = pad to test
* @param end_buffer = upper limit of the pad list.
* @param max_size = size of the biggest pad (used to stop the test when the X distance is > max_size)
* @param show_err if true, display a marker and amessage.
*/ */
{ {
int MaskLayer; int MaskLayer;
...@@ -931,24 +934,24 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame, ...@@ -931,24 +934,24 @@ static bool Test_Pad_to_Pads_Drc( WinEDA_BasePcbFrame* frame,
if( pad->m_Pos.x > x_limite ) if( pad->m_Pos.x > x_limite )
break; break;
/* Pas de probleme si les pads ne sont pas sur les memes couches cuivre*/ /* No probleme if pads are on different copper layers */
if( (pad->m_Masque_Layer & MaskLayer ) == 0 ) if( (pad->m_Masque_Layer & MaskLayer ) == 0 )
continue; continue;
/* Le pad doit faire partie d'un net, /* The pad must be in a net (i.e pt_pad->m_NetCode != 0 ),
* mais pas de probleme si les pads sont du meme net */ * But noe probleme if pads have the same netcode (same net)*/
if( pad->m_NetCode && (pad_ref->m_NetCode == pad->m_NetCode) ) if( pad->m_NetCode && (pad_ref->m_NetCode == pad->m_NetCode) )
continue; continue;
/* pas de pb si les pads sont du meme module et /* No proble if pads are from the same footprint
* de la meme reference ( pads multiples ) */ * and have the same pad number ( equivalent pads ) */
if( (pad->m_Parent == pad_ref->m_Parent) && (pad->m_NumPadName == pad_ref->m_NumPadName) ) if( (pad->m_Parent == pad_ref->m_Parent) && (pad->m_NumPadName == pad_ref->m_NumPadName) )
continue; continue;
if( Pad_to_Pad_Isol( pad_ref, pad, g_DesignSettings.m_TrackClearence ) == OK_DRC ) if( Pad_to_Pad_Isol( pad_ref, pad, g_DesignSettings.m_TrackClearence ) == OK_DRC )
continue; continue;
else /* defaut d'isolation trouve */ else /* here we have a drc error! */
{ {
ErrorsDRC_Count++; ErrorsDRC_Count++;
if( show_err ) if( show_err )
......
...@@ -15,36 +15,78 @@ ...@@ -15,36 +15,78 @@
#include "eda_dde.h" #include "eda_dde.h"
static void Process_Move_Item( WinEDA_PcbFrame* frame, static void Process_Move_Item( WinEDA_PcbFrame* frame,
EDA_BaseStruct* DrawStruct, wxDC* DC ); EDA_BaseStruct* DrawStruct, wxDC* DC );
// see wxstruct.h // see wxstruct.h
/**************************************************************************/
void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) void WinEDA_PcbFrame::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
/**************************************************************************/
/** Send a remote command to eeschema via a socket,
* @param objectToSync = item to be located on schematic (module, pin or text)
* Commands are
* $PART: "reference" put cursor on component anchor
* $PART: "reference" $PAD: "pad number" put cursor on the component pin
* $PART: "reference" $REF: "reference" put cursor on the component ref
* $PART: "reference" $VAL: "value" put cursor on the component value
*/
{ {
char cmd[1024]; char cmd[1024];
MODULE* module = NULL; const char* text_key;
MODULE* module = NULL;
if ( objectToSync == NULL ) D_PAD* pad;
TEXTE_MODULE* text_mod;
wxString msg;
if( objectToSync == NULL )
return; return;
if( objectToSync->Type() == TYPEMODULE ) switch( objectToSync->Type() )
{
case TYPEMODULE:
module = (MODULE*) objectToSync; module = (MODULE*) objectToSync;
else if( objectToSync->Type() == TYPEPAD ) sprintf( cmd, "$PART: \"%s\"",
module = (MODULE*) objectToSync->GetParent(); CONV_TO_UTF8( module->m_Reference->m_Text ) );
else if( objectToSync->Type() == TYPETEXTEMODULE ) break;
module = (MODULE*) objectToSync->GetParent();
case TYPEPAD:
module = (MODULE*) objectToSync->m_Parent;
pad = (D_PAD*) objectToSync;
msg = pad->ReturnStringPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
CONV_TO_UTF8( msg ) );
break;
case TYPETEXTEMODULE:
#define REFERENCE 0
#define VALUE 1
module = (MODULE*) objectToSync->m_Parent;
text_mod = (TEXTE_MODULE*) objectToSync;
if( text_mod->m_Type == REFERENCE )
text_key = "$REF:";
else if( text_mod->m_Type == VALUE )
text_key = "$VAL:";
else
break;
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
CONV_TO_UTF8( module->m_Reference->m_Text ),
text_key,
CONV_TO_UTF8( text_mod->m_Text ) );
break;
default:
break;
}
// ask only for the reference for now, maybe pins later.
if( module ) if( module )
{ {
sprintf( cmd, "$PART: %s", CONV_TO_UTF8(module->m_Reference->m_Text) );
SendCommand( MSG_TO_SCH, cmd ); SendCommand( MSG_TO_SCH, cmd );
} }
} }
/*********************************************************************/ /*********************************************************************/
void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
/*********************************************************************/ /*********************************************************************/
...@@ -59,7 +101,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -59,7 +101,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
wxGetMousePosition( &pos.x, &pos.y ); wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20; pos.y += 20;
...@@ -189,12 +231,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -189,12 +231,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_OPEN_MODULE_EDITOR: case ID_OPEN_MODULE_EDITOR:
if( m_Parent->m_ModuleEditFrame == NULL ) if( m_Parent->m_ModuleEditFrame == NULL )
{ {
m_Parent->m_ModuleEditFrame = m_Parent->m_ModuleEditFrame =
new WinEDA_ModuleEditFrame( this, new WinEDA_ModuleEditFrame( this,
m_Parent, _( "Module Editor" ), m_Parent, _( "Module Editor" ),
wxPoint( -1, wxPoint( -1,
-1 ), -1 ),
wxSize( 600, 400 ) ); wxSize( 600, 400 ) );
m_Parent->m_ModuleEditFrame->Show( TRUE ); m_Parent->m_ModuleEditFrame->Show( TRUE );
m_Parent->m_ModuleEditFrame->Zoom_Automatique( TRUE ); m_Parent->m_ModuleEditFrame->Zoom_Automatique( TRUE );
} }
...@@ -262,6 +304,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -262,6 +304,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_GET_TOOLS: case ID_GET_TOOLS:
// InstalloolsFrame(this, wxPoint(-1,-1) ); // InstalloolsFrame(this, wxPoint(-1,-1) );
break; break;
...@@ -336,6 +379,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -336,6 +379,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_END_LINE: case ID_POPUP_END_LINE:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
// EndSegment(&dc); // EndSegment(&dc);
break; break;
...@@ -519,7 +563,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -519,7 +563,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
// If the current Item is a pad, text module ...: Get the parent // If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE ) if( GetCurItem()->Type() != TYPEMODULE )
SetCurItem( GetCurItem()->GetParent() ); SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
break; break;
if( Delete_Module( (MODULE*) GetCurItem(), &dc ) ) if( Delete_Module( (MODULE*) GetCurItem(), &dc ) )
...@@ -534,7 +578,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -534,7 +578,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
// If the current Item is a pad, text module ...: Get the parent // If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE ) if( GetCurItem()->Type() != TYPEMODULE )
SetCurItem( GetCurItem()->GetParent() ); SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
break; break;
Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, TRUE ); Rotate_Module( &dc, (MODULE*) GetCurItem(), -900, TRUE );
...@@ -564,6 +608,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -564,6 +608,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_MODULE: case ID_POPUP_PCB_EDIT_MODULE:
// If the current Item is a pad, text module ...: Get the parent // If the current Item is a pad, text module ...: Get the parent
if( GetCurItem()->Type() != TYPEMODULE ) if( GetCurItem()->Type() != TYPEMODULE )
SetCurItem( GetCurItem()->GetParent() ); SetCurItem( GetCurItem()->GetParent() );
...@@ -624,7 +669,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -624,7 +669,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_DELETE_TEXTMODULE: case ID_POPUP_PCB_DELETE_TEXTMODULE:
DeleteTextModule( (TEXTE_MODULE*) GetCurItem(), &dc ); DeleteTextModule( (TEXTE_MODULE*) GetCurItem(), &dc );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
...@@ -752,7 +797,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -752,7 +797,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
{ {
SetCurItem( Del_SegmEdgeZone( &dc, SetCurItem( Del_SegmEdgeZone( &dc,
(EDGE_ZONE*) GetCurItem() ) ); (EDGE_ZONE*) GetCurItem() ) );
} }
break; break;
...@@ -931,6 +976,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame, ...@@ -931,6 +976,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
} }
} }
/***************************************************************/ /***************************************************************/
void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
/***************************************************************/ /***************************************************************/
...@@ -987,7 +1033,7 @@ void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ) ...@@ -987,7 +1033,7 @@ void WinEDA_PcbFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
{ {
wxString Line; wxString Line;
Line.Printf( wxT( "Remove: StructType %d Inattendu" ), Line.Printf( wxT( "Remove: StructType %d Inattendu" ),
Item->Type() ); Item->Type() );
DisplayError( this, Line ); DisplayError( this, Line );
} }
break; break;
......
...@@ -56,7 +56,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -56,7 +56,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
DrawPanel = NULL; DrawPanel = NULL;
MsgPanel = NULL; MsgPanel = NULL;
m_CurrentScreen = NULL; m_CurrentScreen = NULL;
m_MenuBar = NULL; // menu du haut d'ecran m_MenuBar = NULL; // main meun frame
m_ID_current_state = 0; m_ID_current_state = 0;
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
...@@ -66,8 +66,8 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -66,8 +66,8 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
// nombre d'unites internes pour 1 pouce // Internal units per inch
// = 1000 pour schema, = 10000 pour PCB // = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME) if( (m_Ident == PCB_FRAME) || (m_Ident == GERBER_FRAME)
|| (m_Ident == CVPCB_DISPLAY_FRAME) || (m_Ident == CVPCB_DISPLAY_FRAME)
...@@ -111,7 +111,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -111,7 +111,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
WinEDA_DrawFrame::~WinEDA_DrawFrame() WinEDA_DrawFrame::~WinEDA_DrawFrame()
/****************************************/ /****************************************/
{ {
if( DrawPanel ) // for WinEDA3D_DrawFrame DrawPanel == NULL ! if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
m_Parent->m_EDA_Config->Write( wxT( "AutoPAN" ), DrawPanel->m_AutoPAN_Enable ); m_Parent->m_EDA_Config->Write( wxT( "AutoPAN" ), DrawPanel->m_AutoPAN_Enable );
} }
...@@ -177,7 +177,7 @@ void WinEDA_DrawFrame::Affiche_Message( const wxString& message ) ...@@ -177,7 +177,7 @@ void WinEDA_DrawFrame::Affiche_Message( const wxString& message )
/**************************************************************/ /**************************************************************/
/* /*
* Affiche un message en bas de l'ecran * Dispaly the meesage on yhe bottomon the frame
*/ */
{ {
SetStatusText( message ); SetStatusText( message );
...@@ -216,40 +216,45 @@ void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event ) ...@@ -216,40 +216,45 @@ void WinEDA_DrawFrame::OnMenuOpen( wxMenuEvent& event )
/*******************************************************/ /*******************************************************/
void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar() // fonction virtuelle void WinEDA_DrawFrame::ReCreateAuxiliaryToolbar()
/*******************************************************/ /*******************************************************/
// Virtual function
{ {
} }
/********************************************/ /********************************************/
void WinEDA_DrawFrame::ReCreateMenuBar() // fonction virtuelle void WinEDA_DrawFrame::ReCreateMenuBar()
/********************************************/ /********************************************/
// Virtual function
{ {
} }
/****************************************************/ /****************************************************/
void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey, void WinEDA_DrawFrame::OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct ) // fonction virtuelle EDA_BaseStruct* DrawStruct )
/****************************************************/ /****************************************************/
// Virtual function
{ {
} }
/**************************************************************/ /**************************************************************/
void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::ToolOnRightClick( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
// Virtual function
{ {
} }
/********************************************************/ /********************************************************/
void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event ) // fonction virtuelle void WinEDA_DrawFrame::OnSelectGrid( wxCommandEvent& event )
/********************************************************/ /********************************************************/
// Virtual function
{ {
if( m_SelGridBox == NULL ) if( m_SelGridBox == NULL )
return; //Ne devrait pas se produire! return; // Should not occurs
int id = m_SelGridBox->GetChoice(); int id = m_SelGridBox->GetChoice();
if( id < 0 ) if( id < 0 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment