From c04619bb50f060013b1ea91a878940c364533e0c Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Tue, 19 Feb 2008 07:06:58 +0000 Subject: [PATCH] bug fixes --- change_log.txt | 11 +++++- eeschema/cross-probing.cpp | 14 +++---- eeschema/find.cpp | 78 +++++++++++++++++++------------------- pcbnew/cross-probing.cpp | 23 ++++++----- 4 files changed, 69 insertions(+), 57 deletions(-) diff --git a/change_log.txt b/change_log.txt index 7d7427596b..38ae1a3980 100644 --- a/change_log.txt +++ b/change_log.txt @@ -8,9 +8,16 @@ email address. 2008-Feb-18 UPDATE Dick Hollenbeck ================================================================================ +pcbnew - Start to use BOARD::GetLayerName() in anticipation of configurable layer - names per board. Comment out a printf() which will lock up pcbnew when + * Start to use BOARD::GetLayerName() in anticipation of configurable layer + names per board. + * Comment out a printf() which will lock up pcbnew when it is run under kicad project manager and the interprocess fifo gets filled. + * Cross probe was not showing the not found message properly. wxString was + being used for two purposes, input and Printf() destination. ++gerbview + Now loads all gerber files given on the command line, not just one. The + first file is loaded into layer 1 (index 0), the second one is loaded + into layer 2 (index 1) etc. 2008-Feb-18 UPDATE Jean-Pierre Charras diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index 9396e846d4..00c2391825 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -106,13 +106,12 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT { case DRAW_PART_TEXT_STRUCT_TYPE: case COMPONENT_FIELD_DRAW_TYPE: - { -// PartTextStruct* Field = (PartTextStruct*) objectToSync; - if( LibItem == NULL ) - break; - sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); - SendCommand( MSG_TO_PCB, Line ); - } + { + if( LibItem == NULL ) + break; + sprintf( Line, "$PART: %s", CONV_TO_UTF8( LibItem->m_Field[REFERENCE].m_Text ) ); + SendCommand( MSG_TO_PCB, Line ); + } break; case DRAW_LIB_ITEM_STRUCT_TYPE: @@ -124,6 +123,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT case COMPONENT_PIN_DRAW_TYPE: if( LibItem == NULL ) break; + Pin = (LibDrawPin*) objectToSync; if( Pin->m_PinNum ) { diff --git a/eeschema/find.cpp b/eeschema/find.cpp index 8b084e4281..eee30927f0 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -93,7 +93,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( sheet = SheetList.GetFirst(); if( !Find_in_hierarchy ) - sheet = m_CurrentSheet; + sheet = m_CurrentSheet; for( ; sheet != NULL; sheet = SheetList.GetNext() ) { @@ -115,7 +115,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( case 0: // Find component only NotFound = FALSE; pos = pSch->m_Pos; - break; + break; case 1: // find a pin pos = pSch->m_Pos; // temporary: will be changed if the pin is found @@ -154,8 +154,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( { sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); *m_CurrentSheet = *sheet; - ActiveScreen = m_CurrentSheet->LastScreen(); - m_CurrentSheet->UpdateAllScreenReferences(); + ActiveScreen = m_CurrentSheet->LastScreen(); + m_CurrentSheet->UpdateAllScreenReferences(); DoCenterAndRedraw = TRUE; } wxPoint delta; @@ -180,13 +180,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( curpos.y -= GetScreen()->m_StartVisu.y; /* Il y a peut-etre necessite de recadrer le dessin: */ - #define MARGIN 30 + #define MARGIN 30 if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN) || (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) ) { DoCenterAndRedraw = true;; } - #undef MARGIN + #undef MARGIN if ( DoCenterAndRedraw ) Recadre_Trace( mouseWarp ); @@ -242,11 +242,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( { if( !msg_item.IsEmpty() ) msg += wxT( " " ) + msg_item; - msg += _( " Found" ); + msg += _( " found" ); } else { - msg += _( " Found" ); + msg += _( " found" ); if( !msg_item.IsEmpty() ) { msg += wxT( " but " ) + msg_item + _( " not found" ); @@ -341,8 +341,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) { sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); *m_CurrentSheet = *sheet; - ActiveScreen = m_CurrentSheet->LastScreen(); - m_CurrentSheet->UpdateAllScreenReferences(); + ActiveScreen = m_CurrentSheet->LastScreen(); + m_CurrentSheet->UpdateAllScreenReferences(); DoCenterAndRedraw = TRUE; } @@ -352,18 +352,18 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) // calcul des coord curseur avec origine = screen DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x, - &m_CurrentSheet->LastScreen()->m_StartVisu.y ); - curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x; - curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y; + &m_CurrentSheet->LastScreen()->m_StartVisu.y ); + curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x; + curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y; // reposition the window if the chosen marker is off screen. - #define MARGIN 30 + #define MARGIN 30 if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN) || (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) ) { DoCenterAndRedraw = true;; } - #undef MARGIN + #undef MARGIN if( DoCenterAndRedraw ) Recadre_Trace( TRUE ); @@ -372,13 +372,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) wxClientDC dc( DrawPanel ); DrawPanel->PrepareGraphicContext( &dc ); - EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); + EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); DrawPanel->CursorOff( &dc ); GRMouseWarp( DrawPanel, curpos ); - EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); + EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur ); DrawPanel->CursorOn( &dc ); } - wxString path = sheet->Path(); + wxString path = sheet->Path(); msg.Printf( _( "Marker %d found in %s" ), s_MarkerCount, path.GetData() ); Affiche_Message( msg ); } @@ -465,11 +465,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( Sheet = SheetList.GetFirst(); if( !Find_in_hierarchy ) - Sheet = m_CurrentSheet; + Sheet = m_CurrentSheet; - for( ; Sheet != NULL; Sheet = SheetList.GetNext() ) + for( ; Sheet != NULL; Sheet = SheetList.GetNext() ) { - DrawList = Sheet->LastDrawList(); + DrawList = Sheet->LastDrawList(); while( DrawList ) { switch( DrawList->Type() ) @@ -492,7 +492,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( case DRAW_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE: - case DRAW_HIER_LABEL_STRUCT_TYPE: + case DRAW_HIER_LABEL_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE: DrawTextStruct * pDraw; pDraw = (DrawTextStruct*) DrawList; @@ -509,9 +509,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( if( NotFound == FALSE ) /* Item found ! */ { - if( FirstSheet == NULL ) /* First Item found */ + if( FirstSheet == NULL ) /* First Item found */ { - FirstSheet = Sheet; + FirstSheet = Sheet; firstpos = pos; FirstStruct = DrawList; } @@ -540,10 +540,10 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( break; } - if( NotFound && FirstSheet ) + if( NotFound && FirstSheet ) { NotFound = FALSE; - Sheet = FirstSheet; + Sheet = FirstSheet; Struct = FirstStruct; pos = firstpos; s_ItemsCount = 1; @@ -551,12 +551,12 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( if( NotFound == FALSE ) { - if( Sheet != GetSheet() ) + if( Sheet != GetSheet() ) { Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() ); - *m_CurrentSheet = *Sheet; - ActiveScreen = m_CurrentSheet->LastScreen(); - m_CurrentSheet->UpdateAllScreenReferences(); + *m_CurrentSheet = *Sheet; + ActiveScreen = m_CurrentSheet->LastScreen(); + m_CurrentSheet->UpdateAllScreenReferences(); DoCenterAndRedraw = TRUE; } @@ -577,21 +577,21 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( pos.y = jj + pSch->m_Pos.y; } - old_cursor_position = Sheet->LastScreen()->m_Curseur; - Sheet->LastScreen()->m_Curseur = pos; + old_cursor_position = Sheet->LastScreen()->m_Curseur; + Sheet->LastScreen()->m_Curseur = pos; curpos = DrawPanel->CursorScreenPosition(); DrawPanel->GetViewStart( - &( GetScreen()->m_StartVisu.x ), - &( GetScreen()->m_StartVisu.y )); + &( GetScreen()->m_StartVisu.x ), + &( GetScreen()->m_StartVisu.y )); // calcul des coord curseur avec origine = screen - curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x; - curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y; + curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x; + curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y; /* Il y a peut-etre necessite de recadrer le dessin: */ - #define MARGIN 30 + #define MARGIN 30 if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN) || (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) ) { @@ -606,7 +606,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( DrawPanel->PrepareGraphicContext( &dc ); - EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur ); + EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur ); DrawPanel->CursorOff( &dc ); if( mouseWarp ) @@ -617,7 +617,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( DrawPanel->CursorOn( &dc ); } - msg = WildText + _( " Found in " ) + Sheet->Last()->m_SheetName; + msg = WildText + _( " Found in " ) + Sheet->Last()->m_SheetName; Affiche_Message( msg ); } else diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index b3dccd8271..539ca29efb 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -30,6 +30,7 @@ void RemoteCommand( const char* cmdline ) { char line[1024]; wxString msg; + wxString modName; char* idcmd; char* text; MODULE* module = 0; @@ -39,17 +40,20 @@ void RemoteCommand( const char* cmdline ) idcmd = strtok( line, " \n\r" ); text = strtok( NULL, " \n\r" ); - if( (idcmd == NULL) || (text == NULL) ) + + if( !idcmd || !text ) return; if( strcmp( idcmd, "$PART:" ) == 0 ) { - msg = CONV_FROM_UTF8( text ); + modName = CONV_FROM_UTF8( text ); - module = ReturnModule( frame->m_Pcb, msg ); + module = ReturnModule( frame->m_Pcb, modName ); - msg.Printf( _( "Locate module %s %s" ), msg.GetData(), - module ? wxT( "Ok" ) : wxT( "not found" ) ); + if( module ) + msg.Printf( _( "Module %s found" ), modName.GetData() ); + else + msg.Printf( _( "Module %s not found"), modName.GetData() ); frame->Affiche_Message( msg ); if( module ) @@ -63,9 +67,9 @@ void RemoteCommand( const char* cmdline ) } } - if( idcmd && strcmp( idcmd, "$PIN:" ) == 0 ) + else if( strcmp( idcmd, "$PIN:" ) == 0 ) { - wxString pinName, modName; + wxString pinName; D_PAD* pad = NULL; int netcode = -1; @@ -80,6 +84,7 @@ void RemoteCommand( const char* cmdline ) frame->DrawPanel->PrepareGraphicContext( &dc ); modName = CONV_FROM_UTF8( text ); + module = ReturnModule( frame->m_Pcb, modName ); if( module ) pad = ReturnPad( module, pinName ); @@ -101,11 +106,11 @@ void RemoteCommand( const char* cmdline ) } if( module == NULL ) - msg.Printf( _( "module %s not found" ), text ); + msg.Printf( _( "Module %s not found" ), modName.GetData() ); else if( pad == NULL ) msg.Printf( _( "Pin %s (module %s) not found" ), pinName.GetData(), modName.GetData() ); else - msg.Printf( _( "Locate Pin %s (module %s)" ), pinName.GetData(), modName.GetData() ); + msg.Printf( _( "%s pin %s found" ), modName.GetData(), pinName.GetData() ); frame->Affiche_Message( msg ); }