Add GAL refresh for some more commands and remove unused DC params.
This commit is contained in:
parent
8e09aa554a
commit
ca3751fbbb
|
@ -121,17 +121,11 @@ static void RemoveBacktracks( DLIST<SCH_ITEM>& aWires )
|
||||||
/**
|
/**
|
||||||
* Mouse capture callback for drawing line segments.
|
* Mouse capture callback for drawing line segments.
|
||||||
*/
|
*/
|
||||||
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
|
||||||
bool aErase )
|
|
||||||
{
|
{
|
||||||
SCH_LINE* segment;
|
|
||||||
|
|
||||||
if( s_wires.GetCount() == 0 )
|
if( s_wires.GetCount() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
segment = (SCH_LINE*) s_wires.begin();
|
|
||||||
COLOR4D color = GetLayerColor( segment->GetLayer() );
|
|
||||||
|
|
||||||
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
|
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
|
||||||
|
|
||||||
wxPoint endpos = frame->GetCrossHairPosition();
|
wxPoint endpos = frame->GetCrossHairPosition();
|
||||||
|
@ -141,24 +135,19 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
|
||||||
else
|
else
|
||||||
( (SCH_LINE*) s_wires.GetLast() )->SetEndPoint( endpos );
|
( (SCH_LINE*) s_wires.GetLast() )->SetEndPoint( endpos );
|
||||||
|
|
||||||
segment = (SCH_LINE*) s_wires.begin();
|
|
||||||
|
|
||||||
auto view = static_cast<SCH_DRAW_PANEL*>( aPanel )->GetView();
|
auto view = static_cast<SCH_DRAW_PANEL*>( aPanel )->GetView();
|
||||||
|
|
||||||
view->ClearPreview();
|
view->ClearPreview();
|
||||||
|
|
||||||
while( segment )
|
for( SCH_LINE* segment = (SCH_LINE*) s_wires.begin(); segment; segment = segment->Next() )
|
||||||
{
|
{
|
||||||
if( !segment->IsNull() ) // Redraw if segment length != 0
|
if( !segment->IsNull() ) // Add to preview if segment length != 0
|
||||||
view->AddToPreview( segment->Clone() );
|
view->AddToPreview( segment->Clone() );
|
||||||
|
|
||||||
segment = segment->Next();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
|
void SCH_EDIT_FRAME::BeginSegment( int type )
|
||||||
{
|
{
|
||||||
SCH_LINE* segment;
|
SCH_LINE* segment;
|
||||||
SCH_LINE* nextSegment;
|
SCH_LINE* nextSegment;
|
||||||
|
@ -171,10 +160,8 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
|
||||||
if( !segment->GetFlags() || ( segment->Type() != SCH_LINE_T ) )
|
if( !segment->GetFlags() || ( segment->Type() != SCH_LINE_T ) )
|
||||||
{
|
{
|
||||||
if( segment->GetFlags() )
|
if( segment->GetFlags() )
|
||||||
{
|
wxLogDebug( wxT( "BeginSegment: item->GetFlags()== %X" ), segment->GetFlags() );
|
||||||
wxLogDebug( wxT( "BeginSegment: item->GetFlags()== %X" ),
|
|
||||||
segment->GetFlags() );
|
|
||||||
}
|
|
||||||
// no wire, bus or graphic line in progress
|
// no wire, bus or graphic line in progress
|
||||||
segment = NULL;
|
segment = NULL;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +227,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||||
|
|
||||||
// Terminate the command if the end point is on a pin, junction, or another wire or bus.
|
// Terminate the command if the end point is on a pin, junction, or another wire or bus.
|
||||||
if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) )
|
if( GetScreen()->IsTerminalPoint( cursorpos, segment->GetLayer() ) )
|
||||||
|
@ -259,7 +246,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
|
||||||
segment->SetFlags( SELECTED );
|
segment->SetFlags( SELECTED );
|
||||||
nextSegment->SetFlags( IS_NEW );
|
nextSegment->SetFlags( IS_NEW );
|
||||||
GetScreen()->SetCurItem( nextSegment );
|
GetScreen()->SetCurItem( nextSegment );
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +443,7 @@ static void ComputeBreakPoint( SCH_SCREEN* aScreen, SCH_LINE* aSegment, wxPoint&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
|
void SCH_EDIT_FRAME::DeleteCurrentSegment()
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
|
@ -465,8 +452,6 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
|
||||||
if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() )
|
if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawSegment( m_canvas, DC, wxDefaultPosition, false );
|
|
||||||
|
|
||||||
RemoveFromScreen( screen->GetCurItem() );
|
RemoveFromScreen( screen->GetCurItem() );
|
||||||
m_canvas->SetMouseCaptureCallback( NULL );
|
m_canvas->SetMouseCaptureCallback( NULL );
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
|
@ -853,7 +838,7 @@ static void AbortCreateNewLine( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
|
void SCH_EDIT_FRAME::RepeatDrawItem()
|
||||||
{
|
{
|
||||||
SCH_ITEM* repeater = GetRepeatItem();
|
SCH_ITEM* repeater = GetRepeatItem();
|
||||||
|
|
||||||
|
@ -870,13 +855,12 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
|
||||||
// If cloning a component then put into 'move' mode.
|
// If cloning a component then put into 'move' mode.
|
||||||
if( my_clone->Type() == SCH_COMPONENT_T )
|
if( my_clone->Type() == SCH_COMPONENT_T )
|
||||||
{
|
{
|
||||||
wxPoint pos = GetCrossHairPosition() -
|
wxPoint pos = GetCrossHairPosition() - ( (SCH_COMPONENT*) my_clone )->GetPosition();
|
||||||
( (SCH_COMPONENT*) my_clone )->GetPosition();
|
|
||||||
|
|
||||||
my_clone->SetFlags( IS_NEW );
|
my_clone->SetFlags( IS_NEW );
|
||||||
( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
|
( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
|
||||||
my_clone->Move( pos );
|
my_clone->Move( pos );
|
||||||
PrepareMoveItem( my_clone, DC );
|
PrepareMoveItem( my_clone );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
|
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( int aType )
|
||||||
{
|
{
|
||||||
SCH_TEXT* textItem = NULL;
|
SCH_TEXT* textItem = NULL;
|
||||||
|
|
||||||
|
@ -112,14 +112,11 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
|
||||||
lastTextItalic = textItem->IsItalic();
|
lastTextItalic = textItem->IsItalic();
|
||||||
lastTextOrientation = textItem->GetLabelSpinStyle();
|
lastTextOrientation = textItem->GetLabelSpinStyle();
|
||||||
|
|
||||||
if( ( textItem->Type() == SCH_GLOBAL_LABEL_T ) ||
|
if( textItem->Type() == SCH_GLOBAL_LABEL_T || textItem->Type() == SCH_HIERARCHICAL_LABEL_T )
|
||||||
( textItem->Type() == SCH_HIERARCHICAL_LABEL_T ) )
|
|
||||||
{
|
|
||||||
lastGlobalLabelShape = textItem->GetShape();
|
lastGlobalLabelShape = textItem->GetShape();
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare display to move the new item
|
// Prepare display to move the new item
|
||||||
PrepareMoveItem( (SCH_ITEM*) textItem, nullptr );
|
PrepareMoveItem( textItem );
|
||||||
|
|
||||||
return textItem;
|
return textItem;
|
||||||
}
|
}
|
||||||
|
@ -138,8 +135,7 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
SCH_TEXT* text = (SCH_TEXT*) screen->GetCurItem();
|
SCH_TEXT* text = (SCH_TEXT*) screen->GetCurItem();
|
||||||
|
|
||||||
wxCHECK_RET( (text != NULL) && text->CanIncrementLabel(),
|
wxCHECK_RET( (text != NULL) && text->CanIncrementLabel(), "Cannot convert text type." );
|
||||||
wxT( "Cannot convert text type." ) );
|
|
||||||
|
|
||||||
KICAD_T type;
|
KICAD_T type;
|
||||||
|
|
||||||
|
@ -162,15 +158,14 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( wxString::Format( wxT( "Invalid text type command ID %d." ),
|
wxFAIL_MSG( wxString::Format( "Invalid text type command ID %d.", aEvent.GetId() ) );
|
||||||
aEvent.GetId() ) );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( text->Type() == type )
|
if( text->Type() == type )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SCH_TEXT* newtext;
|
SCH_TEXT* newtext = nullptr;
|
||||||
const wxPoint &position = text->GetPosition();
|
const wxPoint &position = text->GetPosition();
|
||||||
const wxString &txt = text->GetText();
|
const wxString &txt = text->GetText();
|
||||||
|
|
||||||
|
@ -191,11 +186,6 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
|
||||||
case SCH_TEXT_T:
|
case SCH_TEXT_T:
|
||||||
newtext = new SCH_TEXT( position, txt );
|
newtext = new SCH_TEXT( position, txt );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
newtext = NULL;
|
|
||||||
wxFAIL_MSG( wxString::Format( wxT( "Cannot convert text type to %d" ), type ) );
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the old text item settings to the new one. Justifications are not copied because
|
/* Copy the old text item settings to the new one. Justifications are not copied because
|
||||||
|
|
|
@ -56,7 +56,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
|
||||||
newitem->ClearAnnotation( NULL );
|
newitem->ClearAnnotation( NULL );
|
||||||
newitem->SetFlags( IS_NEW );
|
newitem->SetFlags( IS_NEW );
|
||||||
// Draw the new part, MoveItem() expects it to be already on screen.
|
// Draw the new part, MoveItem() expects it to be already on screen.
|
||||||
PrepareMoveItem( newitem, nullptr );
|
PrepareMoveItem( newitem );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
|
||||||
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
|
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
|
||||||
newitem->SetFlags( IS_NEW );
|
newitem->SetFlags( IS_NEW );
|
||||||
// Draw the new item, MoveItem() expects it to be already on screen.
|
// Draw the new item, MoveItem() expects it to be already on screen.
|
||||||
PrepareMoveItem( newitem, nullptr );
|
PrepareMoveItem( newitem );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -211,8 +211,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibTree(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC,
|
SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( const SCHLIB_FILTER* aFilter,
|
||||||
const SCHLIB_FILTER* aFilter,
|
|
||||||
SCH_BASE_FRAME::HISTORY_LIST& aHistoryList,
|
SCH_BASE_FRAME::HISTORY_LIST& aHistoryList,
|
||||||
bool aAllowBrowser )
|
bool aAllowBrowser )
|
||||||
{
|
{
|
||||||
|
@ -291,7 +290,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aD
|
||||||
if( m_autoplaceFields )
|
if( m_autoplaceFields )
|
||||||
component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
|
||||||
|
|
||||||
PrepareMoveItem( (SCH_ITEM*) component, aDC );
|
PrepareMoveItem( component );
|
||||||
|
|
||||||
return component;
|
return component;
|
||||||
}
|
}
|
||||||
|
@ -299,15 +298,11 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aD
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
|
void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
SCH_ITEM* item = screen->GetCurItem();
|
SCH_ITEM* item = screen->GetCurItem();
|
||||||
|
|
||||||
wxCHECK_RET( item != NULL && item->Type() == SCH_COMPONENT_T,
|
|
||||||
wxT( "Cannot change orientation of invalid schematic item." ) );
|
|
||||||
|
|
||||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||||
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
GetCanvas()->MoveCursorToCrossHair();
|
||||||
|
|
||||||
if( item->GetFlags() == 0 )
|
if( item->GetFlags() == 0 )
|
||||||
SetUndoItem( item );
|
SetUndoItem( item );
|
||||||
|
@ -322,28 +317,21 @@ void SCH_EDIT_FRAME::OrientComponent( COMPONENT_ORIENTATION_T aOrientation )
|
||||||
SchematicCleanUp( true );
|
SchematicCleanUp( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GetScreen()->TestDanglingEnds() )
|
GetScreen()->TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
|
||||||
|
|
||||||
|
RefreshItem( item );
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
SCH_ITEM* item = screen->GetCurItem();
|
SCH_ITEM* item = screen->GetCurItem();
|
||||||
|
|
||||||
wxCHECK_RET( item != NULL && item->Type() == SCH_COMPONENT_T,
|
|
||||||
wxT( "Cannot select unit of invalid schematic item." ) );
|
|
||||||
|
|
||||||
//fixme-gal
|
|
||||||
//INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
|
||||||
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
|
||||||
|
|
||||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||||
|
|
||||||
|
GetCanvas()->MoveCursorToCrossHair();
|
||||||
|
|
||||||
int unit = aEvent.GetId() + 1 - ID_POPUP_SCH_SELECT_UNIT1;
|
int unit = aEvent.GetId() + 1 - ID_POPUP_SCH_SELECT_UNIT1;
|
||||||
|
|
||||||
LIB_PART* part = GetLibPart( component->GetLibId() );
|
LIB_PART* part = GetLibPart( component->GetLibId() );
|
||||||
|
@ -353,10 +341,6 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
int unitCount = part->GetUnitCount();
|
int unitCount = part->GetUnitCount();
|
||||||
|
|
||||||
wxCHECK_RET( (unit >= 1) && (unit <= unitCount),
|
|
||||||
wxString::Format( wxT( "Cannot select unit %d from component " ), unit ) +
|
|
||||||
part->GetName() );
|
|
||||||
|
|
||||||
if( unitCount <= 1 || component->GetUnit() == unit )
|
if( unitCount <= 1 || component->GetUnit() == unit )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -368,11 +352,6 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
||||||
if( !flags ) // No command in progress: save in undo list
|
if( !flags ) // No command in progress: save in undo list
|
||||||
SaveCopyInUndoList( component, UR_CHANGED );
|
SaveCopyInUndoList( component, UR_CHANGED );
|
||||||
|
|
||||||
//if( flags )
|
|
||||||
//component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
|
|
||||||
//else
|
|
||||||
//component->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
|
|
||||||
|
|
||||||
/* Update the unit number. */
|
/* Update the unit number. */
|
||||||
component->SetUnitSelection( m_CurrentSheet, unit );
|
component->SetUnitSelection( m_CurrentSheet, unit );
|
||||||
component->SetUnit( unit );
|
component->SetUnit( unit );
|
||||||
|
@ -382,14 +361,14 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent )
|
||||||
if( m_autoplaceFields )
|
if( m_autoplaceFields )
|
||||||
component->AutoAutoplaceFields( GetScreen() );
|
component->AutoAutoplaceFields( GetScreen() );
|
||||||
|
|
||||||
if( screen->TestDanglingEnds() )
|
screen->TestDanglingEnds();
|
||||||
m_canvas->Refresh();
|
|
||||||
|
|
||||||
|
RefreshItem( component );
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent, wxDC* DC )
|
void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent )
|
||||||
{
|
{
|
||||||
if( !aComponent )
|
if( !aComponent )
|
||||||
return;
|
return;
|
||||||
|
@ -411,11 +390,6 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent, wxDC* DC )
|
||||||
|
|
||||||
STATUS_FLAGS flags = aComponent->GetFlags();
|
STATUS_FLAGS flags = aComponent->GetFlags();
|
||||||
|
|
||||||
if( aComponent->GetFlags() )
|
|
||||||
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
|
|
||||||
else
|
|
||||||
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
|
|
||||||
|
|
||||||
aComponent->SetConvert( aComponent->GetConvert() + 1 );
|
aComponent->SetConvert( aComponent->GetConvert() + 1 );
|
||||||
|
|
||||||
// ensure m_Convert = 0, 1 or 2
|
// ensure m_Convert = 0, 1 or 2
|
||||||
|
@ -433,12 +407,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* aComponent, wxDC* DC )
|
||||||
aComponent->ClearFlags();
|
aComponent->ClearFlags();
|
||||||
aComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
|
aComponent->SetFlags( flags ); // Restore m_Flag (modified by SetConvert())
|
||||||
|
|
||||||
/* Redraw the component in the new position. */
|
RefreshItem( aComponent );
|
||||||
if( aComponent->IsMoving() )
|
|
||||||
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor );
|
|
||||||
else
|
|
||||||
aComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,12 +494,12 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
}
|
}
|
||||||
else if( notBusy )
|
else if( notBusy )
|
||||||
DeleteItemAtCrossHair( aDC );
|
DeleteItemAtCrossHair();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_REPEAT_LAST:
|
case HK_REPEAT_LAST:
|
||||||
if( notBusy )
|
if( notBusy )
|
||||||
RepeatDrawItem( aDC );
|
RepeatDrawItem();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_END_CURR_LINEWIREBUS:
|
case HK_END_CURR_LINEWIREBUS:
|
||||||
|
|
|
@ -179,28 +179,28 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
|
||||||
DeleteItemAtCrossHair( aDC );
|
DeleteItemAtCrossHair();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_WIRE_BUTT:
|
case ID_WIRE_BUTT:
|
||||||
BeginSegment( aDC, LAYER_WIRE );
|
BeginSegment( LAYER_WIRE );
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_BUS_BUTT:
|
case ID_BUS_BUTT:
|
||||||
BeginSegment( aDC, LAYER_BUS );
|
BeginSegment( LAYER_BUS );
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LINE_COMMENT_BUTT:
|
case ID_LINE_COMMENT_BUTT:
|
||||||
BeginSegment( aDC, LAYER_NOTES );
|
BeginSegment( LAYER_NOTES );
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TEXT_COMMENT_BUTT:
|
case ID_TEXT_COMMENT_BUTT:
|
||||||
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_NOTES ) );
|
GetScreen()->SetCurItem( CreateNewText( LAYER_NOTES ) );
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -224,7 +224,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case ID_LABEL_BUTT:
|
case ID_LABEL_BUTT:
|
||||||
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_LOCLABEL ) );
|
GetScreen()->SetCurItem( CreateNewText( LAYER_LOCLABEL ) );
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -238,10 +238,10 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
if( (item == NULL) || (item->GetFlags() == 0) )
|
if( (item == NULL) || (item->GetFlags() == 0) )
|
||||||
{
|
{
|
||||||
if( GetToolId() == ID_GLABEL_BUTT )
|
if( GetToolId() == ID_GLABEL_BUTT )
|
||||||
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_GLOBLABEL ) );
|
GetScreen()->SetCurItem( CreateNewText( LAYER_GLOBLABEL ) );
|
||||||
|
|
||||||
if( GetToolId() == ID_HIERLABEL_BUTT )
|
if( GetToolId() == ID_HIERLABEL_BUTT )
|
||||||
GetScreen()->SetCurItem( CreateNewText( aDC, LAYER_HIERLABEL ) );
|
GetScreen()->SetCurItem( CreateNewText( LAYER_HIERLABEL ) );
|
||||||
|
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
}
|
}
|
||||||
|
@ -279,9 +279,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
if( (item->Type() == SCH_SHEET_T) && (item->GetFlags() == 0) )
|
if( (item->Type() == SCH_SHEET_T) && (item->GetFlags() == 0) )
|
||||||
{
|
{
|
||||||
if( GetToolId() == ID_IMPORT_HLABEL_BUTT )
|
if( GetToolId() == ID_IMPORT_HLABEL_BUTT )
|
||||||
GetScreen()->SetCurItem( ImportSheetPin( (SCH_SHEET*) item, aDC ) );
|
GetScreen()->SetCurItem( ImportSheetPin( (SCH_SHEET*) item ) );
|
||||||
else
|
else
|
||||||
GetScreen()->SetCurItem( CreateSheetPin( (SCH_SHEET*) item, aDC ) );
|
GetScreen()->SetCurItem( CreateSheetPin( (SCH_SHEET*) item ) );
|
||||||
}
|
}
|
||||||
else if( (item->Type() == SCH_SHEET_PIN_T) && (item->GetFlags() != 0) )
|
else if( (item->Type() == SCH_SHEET_PIN_T) && (item->GetFlags() != 0) )
|
||||||
{
|
{
|
||||||
|
@ -294,8 +294,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
// ERC dialog interferes with moving items so we close it before starting
|
// ERC dialog interferes with moving items so we close it before starting
|
||||||
CloseErc();
|
CloseErc();
|
||||||
GetScreen()->SetCurItem( Load_Component( aDC, NULL,
|
GetScreen()->SetCurItem( Load_Component( NULL, s_CmpNameList, true ) );
|
||||||
s_CmpNameList, true ) );
|
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -309,8 +308,7 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
SCHLIB_FILTER filter;
|
SCHLIB_FILTER filter;
|
||||||
filter.FilterPowerParts( true );
|
filter.FilterPowerParts( true );
|
||||||
GetScreen()->SetCurItem( Load_Component( aDC, &filter,
|
GetScreen()->SetCurItem( Load_Component( &filter, s_PowerNameList, false ) );
|
||||||
s_PowerNameList, false ) );
|
|
||||||
m_canvas->SetAutoPanRequest( true );
|
m_canvas->SetAutoPanRequest( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -323,7 +321,9 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case ID_SIM_PROBE:
|
case ID_SIM_PROBE:
|
||||||
{
|
{
|
||||||
constexpr KICAD_T wiresAndComponents[] = { SCH_LINE_T,
|
constexpr KICAD_T wiresAndComponents[] = { SCH_LINE_T,
|
||||||
SCH_COMPONENT_T, SCH_SHEET_PIN_T, EOT };
|
SCH_COMPONENT_T,
|
||||||
|
SCH_SHEET_PIN_T,
|
||||||
|
EOT };
|
||||||
item = LocateAndShowItem( aPosition, wiresAndComponents );
|
item = LocateAndShowItem( aPosition, wiresAndComponents );
|
||||||
|
|
||||||
if( !item )
|
if( !item )
|
||||||
|
|
|
@ -1032,16 +1032,14 @@ void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
|
||||||
|
|
||||||
if( create_me.FileExists() )
|
if( create_me.FileExists() )
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _(
|
wxString msg;
|
||||||
"Schematic file \"%s\" already exists, use Open instead" ),
|
msg.Printf( _( "Schematic file \"%s\" already exists." ), create_me.GetFullName() );
|
||||||
GetChars( create_me.GetFullName() )
|
|
||||||
);
|
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenProjectFiles() requires absolute
|
// OpenProjectFiles() requires absolute
|
||||||
wxASSERT_MSG( create_me.IsAbsolute(), wxT( "wxFileDialog returned non-absolute" ) );
|
wxASSERT_MSG( create_me.IsAbsolute(), "wxFileDialog returned non-absolute path" );
|
||||||
|
|
||||||
OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
|
OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
|
||||||
m_mruPath = create_me.GetPath();
|
m_mruPath = create_me.GetPath();
|
||||||
|
@ -1051,7 +1049,6 @@ void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
|
||||||
wxString pro_dir = m_mruPath;
|
wxString pro_dir = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
|
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
|
||||||
|
|
|
@ -417,10 +417,9 @@ public:
|
||||||
* cross hair position, a context menu is displayed to clarify which item to delete.
|
* cross hair position, a context menu is displayed to clarify which item to delete.
|
||||||
* See LocateItem() for more information on locating multiple items.
|
* See LocateItem() for more information on locating multiple items.
|
||||||
*
|
*
|
||||||
* @param aDC The device context to update if and item is deleted.
|
|
||||||
* @return True if an item was deleted.
|
* @return True if an item was deleted.
|
||||||
*/
|
*/
|
||||||
bool DeleteItemAtCrossHair( wxDC* aDC );
|
bool DeleteItemAtCrossHair();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -960,10 +959,10 @@ private:
|
||||||
* @param aItem A pointer to an SCH_ITEM to move.
|
* @param aItem A pointer to an SCH_ITEM to move.
|
||||||
* @param aDC The device context to draw \a aItem.
|
* @param aDC The device context to draw \a aItem.
|
||||||
*/
|
*/
|
||||||
void PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC );
|
void PrepareMoveItem( SCH_ITEM* aItem );
|
||||||
|
|
||||||
// Text, label, glabel
|
// Text, label, glabel
|
||||||
SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
|
SCH_TEXT* CreateNewText( int aType );
|
||||||
void EditSchematicText( SCH_TEXT* TextStruct );
|
void EditSchematicText( SCH_TEXT* TextStruct );
|
||||||
void ChangeTextOrient( SCH_TEXT* aTextItem );
|
void ChangeTextOrient( SCH_TEXT* aTextItem );
|
||||||
|
|
||||||
|
@ -982,7 +981,7 @@ private:
|
||||||
* and terminates the command. If the end of the current segment is on a pin, terminate
|
* and terminates the command. If the end of the current segment is on a pin, terminate
|
||||||
* the command. In all other cases starts a new segment.
|
* the command. In all other cases starts a new segment.
|
||||||
*/
|
*/
|
||||||
void BeginSegment( wxDC* DC, int type );
|
void BeginSegment( int type );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate a bus, wire, or line creation.
|
* Terminate a bus, wire, or line creation.
|
||||||
|
@ -992,7 +991,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* Erase the last segment at the current mouse position.
|
* Erase the last segment at the current mouse position.
|
||||||
*/
|
*/
|
||||||
void DeleteCurrentSegment( wxDC* DC );
|
void DeleteCurrentSegment();
|
||||||
void DeleteConnection( bool DeleteFullConnection );
|
void DeleteConnection( bool DeleteFullConnection );
|
||||||
|
|
||||||
// Images:
|
// Images:
|
||||||
|
@ -1094,10 +1093,9 @@ private:
|
||||||
* Create a new SCH_SHEET_PIN object and add it to \a aSheet at the current cursor position.
|
* Create a new SCH_SHEET_PIN object and add it to \a aSheet at the current cursor position.
|
||||||
*
|
*
|
||||||
* @param aSheet The sheet to add the new sheet pin to.
|
* @param aSheet The sheet to add the new sheet pin to.
|
||||||
* @param aDC The device context to draw on.
|
|
||||||
* @return The new sheet pin object created or NULL if the task was aborted by the user.
|
* @return The new sheet pin object created or NULL if the task was aborted by the user.
|
||||||
*/
|
*/
|
||||||
SCH_SHEET_PIN* CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC );
|
SCH_SHEET_PIN* CreateSheetPin( SCH_SHEET* aSheet );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the dialog for editing the parameters of \a aSheetPin.
|
* Display the dialog for editing the parameters of \a aSheetPin.
|
||||||
|
@ -1113,10 +1111,9 @@ private:
|
||||||
* referenced by \a aSheet.
|
* referenced by \a aSheet.
|
||||||
*
|
*
|
||||||
* @param aSheet The sheet to import the new sheet pin to.
|
* @param aSheet The sheet to import the new sheet pin to.
|
||||||
* @param aDC The device context to draw on.
|
|
||||||
* @return The new sheet pin object imported or NULL if the task was aborted by the user.
|
* @return The new sheet pin object imported or NULL if the task was aborted by the user.
|
||||||
*/
|
*/
|
||||||
SCH_SHEET_PIN* ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC );
|
SCH_SHEET_PIN* ImportSheetPin( SCH_SHEET* aSheet );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1163,7 +1160,6 @@ private:
|
||||||
* if libname != "", search in lib "libname"
|
* if libname != "", search in lib "libname"
|
||||||
* else search in all loaded libs
|
* else search in all loaded libs
|
||||||
*
|
*
|
||||||
* @param aDC is the device context to draw upon.
|
|
||||||
* @param aFilter is a filter to pass the allowed lib names list, or library name
|
* @param aFilter is a filter to pass the allowed lib names list, or library name
|
||||||
* to load the component from and/or some other filters
|
* to load the component from and/or some other filters
|
||||||
* if NULL, no filtering.
|
* if NULL, no filtering.
|
||||||
|
@ -1173,8 +1169,7 @@ private:
|
||||||
* (TODO(hzeller): This really should be a class doing history, but didn't
|
* (TODO(hzeller): This really should be a class doing history, but didn't
|
||||||
* want to change too much while other refactoring is going on)
|
* want to change too much while other refactoring is going on)
|
||||||
*/
|
*/
|
||||||
SCH_COMPONENT* Load_Component( wxDC* aDC,
|
SCH_COMPONENT* Load_Component( const SCHLIB_FILTER* aFilter,
|
||||||
const SCHLIB_FILTER* aFilter,
|
|
||||||
SCH_BASE_FRAME::HISTORY_LIST& aHistoryList,
|
SCH_BASE_FRAME::HISTORY_LIST& aHistoryList,
|
||||||
bool aUseLibBrowser );
|
bool aUseLibBrowser );
|
||||||
|
|
||||||
|
@ -1194,8 +1189,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnSelectUnit( wxCommandEvent& aEvent );
|
void OnSelectUnit( wxCommandEvent& aEvent );
|
||||||
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
void ConvertPart( SCH_COMPONENT* DrawComponent );
|
||||||
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the edit field dialog to edit the parameters of \a aField.
|
* Display the edit field dialog to edit the parameters of \a aField.
|
||||||
|
@ -1351,7 +1345,7 @@ public:
|
||||||
*
|
*
|
||||||
* Labels that end with a number will be incremented.
|
* Labels that end with a number will be incremented.
|
||||||
*/
|
*/
|
||||||
void RepeatDrawItem( wxDC* DC );
|
void RepeatDrawItem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone \a aItem and owns that clone in this container.
|
* Clone \a aItem and owns that clone in this container.
|
||||||
|
|
|
@ -242,7 +242,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN:
|
case ID_POPUP_IMPORT_HLABEL_TO_SHEETPIN:
|
||||||
if( item != NULL && item->Type() == SCH_SHEET_T )
|
if( item != NULL && item->Type() == SCH_SHEET_T )
|
||||||
screen->SetCurItem( ImportSheetPin( (SCH_SHEET*) item, nullptr ) );
|
screen->SetCurItem( ImportSheetPin( (SCH_SHEET*) item ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_CLEANUP_SHEET:
|
case ID_POPUP_SCH_CLEANUP_SHEET:
|
||||||
|
@ -252,8 +252,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
if( !sheet->HasUndefinedPins() )
|
if( !sheet->HasUndefinedPins() )
|
||||||
{
|
{
|
||||||
DisplayInfoMessage( this,
|
DisplayInfoMessage( this, _( "There are no undefined labels in this sheet to clean up." ) );
|
||||||
_( "There are no undefined labels in this sheet to clean up." ) );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +276,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( item && item->Type() == SCH_COMPONENT_T )
|
if( item && item->Type() == SCH_COMPONENT_T )
|
||||||
{
|
{
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
ConvertPart( (SCH_COMPONENT*) item, nullptr );
|
ConvertPart( (SCH_COMPONENT*) item );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -356,8 +355,8 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_ADD_LABEL:
|
case ID_POPUP_SCH_ADD_LABEL:
|
||||||
case ID_POPUP_SCH_ADD_GLABEL:
|
case ID_POPUP_SCH_ADD_GLABEL:
|
||||||
screen->SetCurItem( CreateNewText( nullptr, id == ID_POPUP_SCH_ADD_LABEL ?
|
screen->SetCurItem( CreateNewText( id == ID_POPUP_SCH_ADD_LABEL ? LAYER_LOCLABEL
|
||||||
LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
|
: LAYER_GLOBLABEL ) );
|
||||||
item = screen->GetCurItem();
|
item = screen->GetCurItem();
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
|
@ -372,8 +371,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Log error:
|
default: // Log error:
|
||||||
wxFAIL_MSG( wxString::Format( wxT( "Cannot process command event ID %d" ),
|
wxFAIL_MSG( wxString::Format( "Cannot process command event ID %d", event.GetId() ) );
|
||||||
event.GetId() ) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +429,7 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
|
||||||
case SCH_FIELD_T:
|
case SCH_FIELD_T:
|
||||||
case SCH_SHEET_T:
|
case SCH_SHEET_T:
|
||||||
case SCH_BITMAP_T:
|
case SCH_BITMAP_T:
|
||||||
PrepareMoveItem( item, nullptr );
|
PrepareMoveItem( item );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* case SCH_BITMAP_T:
|
/* case SCH_BITMAP_T:
|
||||||
|
@ -448,8 +446,7 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Unknown items cannot be moved
|
// Unknown items cannot be moved
|
||||||
wxFAIL_MSG( wxString::Format(
|
wxFAIL_MSG( wxString::Format( "Cannot move item type %d", item->Type() ) );
|
||||||
wxT( "Cannot move item type %d" ), item->Type() ) );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +461,7 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
if( screen->IsBlockActive() )
|
if( screen->IsBlockActive() )
|
||||||
{
|
{
|
||||||
// m_canvas->SetCursor( (wxStockCursor) GetGalCanvas()->GetDefaultCursor() );
|
GetCanvas()->SetCursor( (wxStockCursor) GetGalCanvas()->GetDefaultCursor() );
|
||||||
screen->ClearBlockCommand();
|
screen->ClearBlockCommand();
|
||||||
|
|
||||||
// Stop the current command (if any) but keep the current tool
|
// Stop the current command (if any) but keep the current tool
|
||||||
|
@ -474,7 +471,7 @@ void SCH_EDIT_FRAME::OnCancelCurrentCommand( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( m_canvas->IsMouseCaptured() ) // Stop the current command but keep the current tool
|
if( m_canvas->IsMouseCaptured() ) // Stop the current command but keep the current tool
|
||||||
m_canvas->EndMouseCapture();
|
m_canvas->EndMouseCapture();
|
||||||
else // Deselect current tool
|
else // Deselect current tool
|
||||||
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, GetGalCanvas()->GetDefaultCursor() );
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, GetGalCanvas()->GetDefaultCursor() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,12 +601,12 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
#ifdef KICAD_SPICE
|
#ifdef KICAD_SPICE
|
||||||
case ID_SIM_PROBE:
|
case ID_SIM_PROBE:
|
||||||
SetToolID( id, -1, _( "Add a simulator probe" ) );
|
SetToolID( id, -1, _( "Add a simulator probe" ) );
|
||||||
//m_canvas->SetCurrentCursor( CURSOR_PROBE );
|
//GAL TODO: m_canvas->SetCurrentCursor( CURSOR_PROBE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SIM_TUNE:
|
case ID_SIM_TUNE:
|
||||||
SetToolID( id, -1, _( "Select a value to be tuned" ) );
|
SetToolID( id, -1, _( "Select a value to be tuned" ) );
|
||||||
//m_canvas->SetCurrentCursor( CURSOR_TUNE );
|
//GAL TODO: m_canvas->SetCurrentCursor( CURSOR_TUNE );
|
||||||
break;
|
break;
|
||||||
#endif /* KICAD_SPICE */
|
#endif /* KICAD_SPICE */
|
||||||
|
|
||||||
|
@ -622,10 +619,7 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
EDA_HOTKEY_CLIENT_DATA* data = (EDA_HOTKEY_CLIENT_DATA*) aEvent.GetClientObject();
|
||||||
|
|
||||||
wxPoint pos = data->GetPosition();
|
OnLeftClick( nullptr, data->GetPosition() );
|
||||||
|
|
||||||
// INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
|
||||||
OnLeftClick( nullptr, pos );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,7 +646,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
|
bool SCH_EDIT_FRAME::DeleteItemAtCrossHair()
|
||||||
{
|
{
|
||||||
SCH_ITEM* item;
|
SCH_ITEM* item;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
|
@ -667,8 +661,8 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
|
||||||
SetRepeatItem( NULL );
|
SetRepeatItem( NULL );
|
||||||
DeleteItem( item );
|
DeleteItem( item );
|
||||||
|
|
||||||
if( itemHasConnections && screen->TestDanglingEnds() )
|
if( itemHasConnections )
|
||||||
m_canvas->Refresh();
|
screen->TestDanglingEnds();
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
return true;
|
return true;
|
||||||
|
@ -677,8 +671,7 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is a callback function, called by the mouse cursor movin event
|
// This function is a callback function, called by the mouse cursor moving event
|
||||||
// when an item is currently moved
|
|
||||||
static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aPosition, bool aErase )
|
const wxPoint& aPosition, bool aErase )
|
||||||
{
|
{
|
||||||
|
@ -722,7 +715,6 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
if( item->IsNew() )
|
if( item->IsNew() )
|
||||||
{
|
{
|
||||||
delete item;
|
delete item;
|
||||||
item = NULL;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -733,13 +725,9 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
// Items that are children of other objects are undone by swapping the contents
|
// Items that are children of other objects are undone by swapping the contents
|
||||||
// of the parent items.
|
// of the parent items.
|
||||||
if( (item->Type() == SCH_SHEET_PIN_T) || (item->Type() == SCH_FIELD_T) )
|
if( (item->Type() == SCH_SHEET_PIN_T) || (item->Type() == SCH_FIELD_T) )
|
||||||
{
|
|
||||||
currentItem = (SCH_ITEM*) item->GetParent();
|
currentItem = (SCH_ITEM*) item->GetParent();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
}
|
|
||||||
|
|
||||||
wxCHECK_RET( oldItem != NULL && currentItem->Type() == oldItem->Type(),
|
wxCHECK_RET( oldItem != NULL && currentItem->Type() == oldItem->Type(),
|
||||||
wxT( "Cannot restore undefined or bad last schematic item." ) );
|
wxT( "Cannot restore undefined or bad last schematic item." ) );
|
||||||
|
@ -758,7 +746,7 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
|
void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aItem != NULL, wxT( "Cannot move invalid schematic item" ) );
|
wxCHECK_RET( aItem != NULL, wxT( "Cannot move invalid schematic item" ) );
|
||||||
|
|
||||||
|
@ -811,6 +799,7 @@ void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
|
||||||
|
|
||||||
GetScreen()->SetCurItem( aItem );
|
GetScreen()->SetCurItem( aItem );
|
||||||
m_canvas->SetMouseCapture( moveItemWithMouseCursor, abortMoveItem );
|
m_canvas->SetMouseCapture( moveItemWithMouseCursor, abortMoveItem );
|
||||||
|
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||||
|
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ const wxSize &SCH_EDIT_FRAME::GetLastSheetPinTextSize()
|
||||||
return m_lastSheetPinTextSize;
|
return m_lastSheetPinTextSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw )
|
int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw )
|
||||||
{
|
{
|
||||||
if( aSheetPin == NULL )
|
if( aSheetPin == NULL )
|
||||||
|
@ -67,13 +68,13 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, bool aRedraw )
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
|
|
||||||
if( aRedraw )
|
if( aRedraw )
|
||||||
m_canvas->Refresh();
|
RefreshItem( aSheetPin );
|
||||||
|
|
||||||
return wxID_OK;
|
return wxID_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
|
SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
wxString line;
|
wxString line;
|
||||||
SCH_SHEET_PIN* sheetPin;
|
SCH_SHEET_PIN* sheetPin;
|
||||||
|
@ -95,15 +96,14 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
|
||||||
m_lastSheetPinTextSize = sheetPin->GetTextSize();
|
m_lastSheetPinTextSize = sheetPin->GetTextSize();
|
||||||
|
|
||||||
sheetPin->SetPosition( GetCrossHairPosition() );
|
sheetPin->SetPosition( GetCrossHairPosition() );
|
||||||
sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
|
PrepareMoveItem( sheetPin );
|
||||||
PrepareMoveItem( (SCH_ITEM*) sheetPin, aDC );
|
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
return sheetPin;
|
return sheetPin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
|
SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
EDA_ITEM* item;
|
EDA_ITEM* item;
|
||||||
SCH_SHEET_PIN* sheetPin;
|
SCH_SHEET_PIN* sheetPin;
|
||||||
|
@ -141,8 +141,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
|
||||||
sheetPin->SetShape( label->GetShape() );
|
sheetPin->SetShape( label->GetShape() );
|
||||||
sheetPin->SetPosition( GetCrossHairPosition() );
|
sheetPin->SetPosition( GetCrossHairPosition() );
|
||||||
|
|
||||||
sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
|
PrepareMoveItem( sheetPin );
|
||||||
PrepareMoveItem( (SCH_ITEM*) sheetPin, aDC );
|
|
||||||
|
|
||||||
return sheetPin;
|
return sheetPin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ public:
|
||||||
void OnSelectSymbol( wxCommandEvent& aEvent );
|
void OnSelectSymbol( wxCommandEvent& aEvent );
|
||||||
void OnShowElectricalType( wxCommandEvent& event );
|
void OnShowElectricalType( wxCommandEvent& event );
|
||||||
|
|
||||||
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
|
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) override;
|
||||||
|
|
||||||
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
|
||||||
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
|
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
|
||||||
|
@ -104,8 +104,7 @@ public:
|
||||||
* case insensitive
|
* case insensitive
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem ) override;
|
||||||
EDA_ITEM* aItem = NULL ) override;
|
|
||||||
|
|
||||||
void LoadSettings( wxConfigBase* aCfg ) override;
|
void LoadSettings( wxConfigBase* aCfg ) override;
|
||||||
void SaveSettings( wxConfigBase* aCfg ) override;
|
void SaveSettings( wxConfigBase* aCfg ) override;
|
||||||
|
|
Loading…
Reference in New Issue