Eeschema: remove an unused argument in a few functions.

Fix also the  minor Bug #1469504.
This commit is contained in:
jean-pierre charras 2015-06-28 18:45:05 +02:00
parent 3076876ef2
commit 66aa22c1db
6 changed files with 46 additions and 59 deletions

View File

@ -42,25 +42,25 @@
static int s_LastShape = '\\'; static int s_LastShape = '\\';
SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC ) SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry()
{ {
// Create and place a new bus entry at cursor position // Create and place a new bus entry at cursor position
SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( GetCrossHairPosition(), s_LastShape ); SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry ); GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC ); addCurrentItemToList();
return busEntry; return busEntry;
} }
SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry( wxDC* aDC ) SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry()
{ {
// Create and place a new bus entry at cursor position // Create and place a new bus entry at cursor position
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( GetCrossHairPosition(), s_LastShape ); SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW ); busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry ); GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC ); addCurrentItemToList();
return busEntry; return busEntry;
} }

View File

@ -83,7 +83,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_FIELD_T: case SCH_FIELD_T:
case SCH_BITMAP_T: case SCH_BITMAP_T:
case SCH_NO_CONNECT_T: case SCH_NO_CONNECT_T:
addCurrentItemToList( aDC ); addCurrentItemToList();
return; return;
case SCH_LINE_T: // May already be drawing segment. case SCH_LINE_T: // May already be drawing segment.
@ -138,7 +138,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -155,31 +155,31 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
case ID_WIRETOBUS_ENTRY_BUTT: case ID_WIRETOBUS_ENTRY_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{ {
CreateBusWireEntry( aDC ); CreateBusWireEntry();
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
case ID_BUSTOBUS_ENTRY_BUTT: case ID_BUSTOBUS_ENTRY_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{ {
CreateBusBusEntry( aDC ); CreateBusBusEntry();
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -210,7 +210,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -222,7 +222,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -234,7 +234,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -252,7 +252,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -269,7 +269,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -290,7 +290,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else if( (item->Type() == SCH_SHEET_PIN_T) && (item->GetFlags() != 0) ) else if( (item->Type() == SCH_SHEET_PIN_T) && (item->GetFlags() != 0) )
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -303,7 +303,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -318,7 +318,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
addCurrentItemToList( aDC ); addCurrentItemToList();
} }
break; break;
@ -363,7 +363,12 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
EditComponent( (SCH_COMPONENT*) item ); EditComponent( (SCH_COMPONENT*) item );
m_canvas->MoveCursorToCrossHair(); GetCanvas()->MoveCursorToCrossHair();
if( item->GetFlags() == 0 )
GetScreen()->SetCurItem( NULL );
GetCanvas()->Refresh();
break; break;
case SCH_TEXT_T: case SCH_TEXT_T:
@ -379,7 +384,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_FIELD_T: case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item ); EditComponentFieldText( (SCH_FIELD*) item );
m_canvas->MoveCursorToCrossHair(); GetCanvas()->MoveCursorToCrossHair();
break; break;
case SCH_MARKER_T: case SCH_MARKER_T:

View File

@ -234,7 +234,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_END_SHEET: case ID_POPUP_SCH_END_SHEET:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
addCurrentItemToList( &dc ); addCurrentItemToList();
break; break;
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
@ -377,7 +377,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
item = screen->GetCurItem(); item = screen->GetCurItem();
if( item ) if( item )
addCurrentItemToList( &dc ); addCurrentItemToList();
break; break;
@ -876,8 +876,6 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem(); SCH_ITEM* item = screen->GetCurItem();
INSTALL_UNBUFFERED_DC( dc, m_canvas );
if( item == NULL ) if( item == NULL )
{ {
// If we didn't get here by a hot key, then something has gone wrong. // If we didn't get here by a hot key, then something has gone wrong.
@ -955,7 +953,8 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
} }
case SCH_SHEET_T: case SCH_SHEET_T:
EditSheet( (SCH_SHEET*) item, m_CurrentSheet, &dc ); if( EditSheet( (SCH_SHEET*) item, m_CurrentSheet ) )
m_canvas->Refresh();
break; break;
case SCH_SHEET_PIN_T: case SCH_SHEET_PIN_T:

View File

@ -1196,7 +1196,7 @@ bool SCH_EDIT_FRAME::isAutoSaveRequired() const
} }
void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC ) void SCH_EDIT_FRAME::addCurrentItemToList( bool aRedraw )
{ {
SCH_SCREEN* screen = GetScreen(); SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem(); SCH_ITEM* item = screen->GetCurItem();
@ -1235,11 +1235,14 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
// the m_mouseCaptureCallback function. // the m_mouseCaptureCallback function.
m_canvas->SetMouseCapture( NULL, NULL ); m_canvas->SetMouseCapture( NULL, NULL );
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet, aDC ) ) if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
{ {
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
item->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
delete item; delete item;
if( aRedraw )
GetCanvas()->Refresh();
return; return;
} }
@ -1276,10 +1279,6 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
SaveUndoItemInUndoList( undoItem ); SaveUndoItemInUndoList( undoItem );
} }
// Erase the wire representation before the 'normal' view is drawn.
if ( item->IsWireImage() )
item->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
item->ClearFlags(); item->ClearFlags();
screen->SetModify(); screen->SetModify();
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
@ -1289,13 +1288,8 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
if( item->IsConnectable() ) if( item->IsConnectable() )
screen->TestDanglingEnds(); screen->TestDanglingEnds();
if( aDC ) if( aRedraw )
{ GetCanvas()->Refresh();
EDA_CROSS_HAIR_MANAGER( m_canvas, aDC ); // Erase schematic cursor
undoItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
m_canvas->Refresh();
} }

View File

@ -200,9 +200,9 @@ protected:
* adds the item currently being edited to the schematic and adds the changes to * adds the item currently being edited to the schematic and adds the changes to
* the undo/redo container. * the undo/redo container.
* *
* @param aDC A pointer the device context to draw on when not NULL. * @param aRedraw = true (default) to redrw -the screen after adding the item.
*/ */
void addCurrentItemToList( wxDC* aDC ); void addCurrentItemToList( bool aRedraw = true );
void updateFindReplaceView( wxFindDialogEvent& aEvent ); void updateFindReplaceView( wxFindDialogEvent& aEvent );
@ -868,8 +868,8 @@ private:
void UpdateTitle(); void UpdateTitle();
// Bus Entry // Bus Entry
SCH_BUS_WIRE_ENTRY* CreateBusWireEntry( wxDC* DC ); SCH_BUS_WIRE_ENTRY* CreateBusWireEntry();
SCH_BUS_BUS_ENTRY* CreateBusBusEntry( wxDC* DC ); SCH_BUS_BUS_ENTRY* CreateBusBusEntry();
void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, char entry_shape ); void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, char entry_shape );
/** /**
@ -1002,8 +1002,10 @@ public:
* <li>and the file name does not exist in the schematic hierarchy or on the file system, * <li>and the file name does not exist in the schematic hierarchy or on the file system,
* the current associated screen file name is changed and saved to disk.</li> * the current associated screen file name is changed and saved to disk.</li>
* </ul> </p> * </ul> </p>
*
* Note: the screen is not refresh. The caller is responsible to do that
*/ */
bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, wxDC* aDC ); bool EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy );
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; } wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }

View File

@ -41,7 +41,7 @@
#include <project.h> #include <project.h>
bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, wxDC* aDC ) bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy )
{ {
if( aSheet == NULL || aHierarchy == NULL ) if( aSheet == NULL || aHierarchy == NULL )
return false; return false;
@ -82,10 +82,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
if( !fileName.IsOk() ) if( !fileName.IsOk() )
{ {
DisplayError( this, _( "File name is not valid!" ) ); DisplayError( this, _( "File name is not valid!" ) );
if( m_canvas )
m_canvas->Refresh();
return false; return false;
} }
@ -96,10 +92,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
{ {
DisplayError( this, wxString::Format( _( "A sheet named \"%s\" already exists." ), DisplayError( this, wxString::Format( _( "A sheet named \"%s\" already exists." ),
GetChars( dlg.GetSheetName() ) ) ); GetChars( dlg.GetSheetName() ) ) );
if( m_canvas )
m_canvas->Refresh();
return false; return false;
} }
@ -143,9 +135,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
if( !IsOK( this, msg ) ) if( !IsOK( this, msg ) )
{ {
if( m_canvas )
m_canvas->Refresh();
return false; return false;
} }
} }
@ -209,7 +198,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
} }
} }
aSheet->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
m_canvas->SetIgnoreMouseEvents( true ); m_canvas->SetIgnoreMouseEvents( true );
if( isUndoable ) if( isUndoable )
@ -267,7 +255,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false ); m_canvas->SetIgnoreMouseEvents( false );
aSheet->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
OnModify(); OnModify();
return true; return true;