Eeschema: Fix issue in Search/ReplaceAll

Pcbnew: fix a very minor issue.
This commit is contained in:
jean-pierre charras 2011-12-30 20:04:40 +01:00
parent e420623fde
commit 3f15b9c057
7 changed files with 686 additions and 17 deletions

View File

@ -756,7 +756,7 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'P' )
m_options = ENTRY_POWER;
/* Read next lines */
// Read next lines, until "ENDDEF" is found
while( aLineReader.ReadLine() )
{
line = aLineReader.Line();
@ -766,11 +766,14 @@ bool LIB_COMPONENT::Load( LINE_READER& aLineReader, wxString& aErrorMsg )
/* This is the error flag ( if an error occurs, Res = FALSE) */
Res = true;
if( *line == '#' ) // a comment
continue;
if( (*line == 'T') && (*(line + 1) == 'i') )
Res = LoadDateAndTime( aLineReader );
else if( *line == 'F' )
Res = LoadField( aLineReader, Msg );
else if( strcmp( p, "ENDDEF" ) == 0 )
else if( strcmp( p, "ENDDEF" ) == 0 ) // End of component description
break;
else if( strcmp( p, "DRAW" ) == 0 )
Res = LoadDrawEntries( aLineReader, Msg );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -117,14 +117,13 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
rightSizer->Add( m_buttonReplaceAll, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
rightSizer->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 6 );
mainSizer->Add( rightSizer, 0, wxALL|wxEXPAND, 6 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );

View File

@ -1,15 +1,16 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_schematic_find_base__
#define __dialog_schematic_find_base__
#ifndef __DIALOG_SCHEMATIC_FIND_BASE_H__
#define __DIALOG_SCHEMATIC_FIND_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
@ -69,9 +70,9 @@ class DIALOG_SCH_FIND_BASE : public wxDialog
public:
DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 334,225 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SCH_FIND_BASE();
};
#endif //__dialog_schematic_find_base__
#endif //__DIALOG_SCHEMATIC_FIND_BASE_H__

View File

@ -403,6 +403,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
if( m_foundItems.ReplaceItem() )
{
OnModify();
SaveUndoItemInUndoList( undoItem );
RedrawScreen( data.GetPosition(), warpCursor );
}
@ -411,9 +412,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL )
{
item = (SCH_ITEM*) m_foundItems.GetItem( data );
while( item != NULL )
while( ( item = (SCH_ITEM*) m_foundItems.GetItem( data ) ) != NULL )
{
wxLogTrace( traceFindReplace, wxT( "Replacing %s with %s in item %s" ),
GetChars( aEvent.GetFindString() ), GetChars( aEvent.GetReplaceString() ),
@ -429,6 +428,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
if( m_foundItems.ReplaceItem() )
{
OnModify();
SaveUndoItemInUndoList( undoItem );
RedrawScreen( data.GetPosition(), warpCursor );
}

View File

@ -300,7 +300,6 @@ this file again." ) );
}
catch( IO_ERROR ioe )
{
wxMessageBox( _( "catch" ) );
wxString msg = wxString::Format( _( "Error loading board.\n%s" ),
ioe.errorText.GetData() );
wxMessageBox( msg, _( "Open Board File" ), wxOK | wxICON_ERROR );

View File

@ -37,9 +37,17 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
// Clear undo and redo lists because we want a full deletion
GetScreen()->ClearUndoRedoList();
/* Items visibility flags will be set becuse a new board will be created.
* Grid and ratsnest can be left to their previous state
*/
bool showGrid = IsElementVisible( GRID_VISIBLE );
bool showRats = IsElementVisible( RATSNEST_VISIBLE );
// delete the old BOARD and create a new BOARD so that the default
// layer names are put into the BOARD.
SetBoard( new BOARD() );
SetElementVisibility( GRID_VISIBLE, showGrid );
SetElementVisibility( RATSNEST_VISIBLE, showRats );
SetCurItem( NULL );
/* clear filename, to avoid overwriting an old file */