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 = '\\';
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
SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC );
addCurrentItemToList();
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
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( GetCrossHairPosition(), s_LastShape );
busEntry->SetFlags( IS_NEW );
GetScreen()->SetCurItem( busEntry );
addCurrentItemToList( aDC );
addCurrentItemToList();
return busEntry;
}

View File

@ -83,7 +83,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_FIELD_T:
case SCH_BITMAP_T:
case SCH_NO_CONNECT_T:
addCurrentItemToList( aDC );
addCurrentItemToList();
return;
case SCH_LINE_T: // May already be drawing segment.
@ -138,7 +138,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -155,31 +155,31 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
case ID_WIRETOBUS_ENTRY_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
CreateBusWireEntry( aDC );
CreateBusWireEntry();
m_canvas->SetAutoPanRequest( true );
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
case ID_BUSTOBUS_ENTRY_BUTT:
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
{
CreateBusBusEntry( aDC );
CreateBusBusEntry();
m_canvas->SetAutoPanRequest( true );
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -210,7 +210,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -222,7 +222,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -234,7 +234,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -252,7 +252,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -269,7 +269,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
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) )
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -303,7 +303,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -318,7 +318,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
}
else
{
addCurrentItemToList( aDC );
addCurrentItemToList();
}
break;
@ -363,7 +363,12 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_COMPONENT_T:
EditComponent( (SCH_COMPONENT*) item );
m_canvas->MoveCursorToCrossHair();
GetCanvas()->MoveCursorToCrossHair();
if( item->GetFlags() == 0 )
GetScreen()->SetCurItem( NULL );
GetCanvas()->Refresh();
break;
case SCH_TEXT_T:
@ -379,7 +384,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
case SCH_FIELD_T:
EditComponentFieldText( (SCH_FIELD*) item );
m_canvas->MoveCursorToCrossHair();
GetCanvas()->MoveCursorToCrossHair();
break;
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:
m_canvas->MoveCursorToCrossHair();
addCurrentItemToList( &dc );
addCurrentItemToList();
break;
case ID_POPUP_SCH_RESIZE_SHEET:
@ -377,7 +377,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
item = screen->GetCurItem();
if( item )
addCurrentItemToList( &dc );
addCurrentItemToList();
break;
@ -876,8 +876,6 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent )
SCH_SCREEN* screen = GetScreen();
SCH_ITEM* item = screen->GetCurItem();
INSTALL_UNBUFFERED_DC( dc, m_canvas );
if( item == NULL )
{
// 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:
EditSheet( (SCH_SHEET*) item, m_CurrentSheet, &dc );
if( EditSheet( (SCH_SHEET*) item, m_CurrentSheet ) )
m_canvas->Refresh();
break;
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_ITEM* item = screen->GetCurItem();
@ -1235,11 +1235,14 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
// the m_mouseCaptureCallback function.
m_canvas->SetMouseCapture( NULL, NULL );
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet, aDC ) )
if( !EditSheet( (SCH_SHEET*)item, m_CurrentSheet ) )
{
screen->SetCurItem( NULL );
item->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
delete item;
if( aRedraw )
GetCanvas()->Refresh();
return;
}
@ -1276,10 +1279,6 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
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();
screen->SetModify();
screen->SetCurItem( NULL );
@ -1289,13 +1288,8 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
if( item->IsConnectable() )
screen->TestDanglingEnds();
if( aDC )
{
EDA_CROSS_HAIR_MANAGER( m_canvas, aDC ); // Erase schematic cursor
undoItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
}
m_canvas->Refresh();
if( aRedraw )
GetCanvas()->Refresh();
}

View File

@ -200,9 +200,9 @@ protected:
* adds the item currently being edited to the schematic and adds the changes to
* 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 );
@ -868,8 +868,8 @@ private:
void UpdateTitle();
// Bus Entry
SCH_BUS_WIRE_ENTRY* CreateBusWireEntry( wxDC* DC );
SCH_BUS_BUS_ENTRY* CreateBusBusEntry( wxDC* DC );
SCH_BUS_WIRE_ENTRY* CreateBusWireEntry();
SCH_BUS_BUS_ENTRY* CreateBusBusEntry();
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,
* the current associated screen file name is changed and saved to disk.</li>
* </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; }

View File

@ -41,7 +41,7 @@
#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 )
return false;
@ -82,10 +82,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
if( !fileName.IsOk() )
{
DisplayError( this, _( "File name is not valid!" ) );
if( m_canvas )
m_canvas->Refresh();
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." ),
GetChars( dlg.GetSheetName() ) ) );
if( m_canvas )
m_canvas->Refresh();
return false;
}
@ -143,9 +135,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
if( !IsOK( this, msg ) )
{
if( m_canvas )
m_canvas->Refresh();
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 );
if( isUndoable )
@ -267,7 +255,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy, w
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
aSheet->Draw( m_canvas, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
OnModify();
return true;