Add view refresh calls for edit operations.
Note that the bug referenced in the "fixes" section is only one of many addressed by this commit. Fixes: lp:1798449 * https://bugs.launchpad.net/kicad/+bug/1798449
This commit is contained in:
parent
38c5b025c8
commit
8a54b1b3b7
|
@ -72,6 +72,8 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly )
|
|||
|
||||
// Update the references for the sheet that is currently being displayed.
|
||||
m_CurrentSheet->UpdateAllScreenReferences();
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
@ -230,13 +232,13 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
|
|||
if( !CheckAnnotate( aReporter, !aAnnotateSchematic ) )
|
||||
aReporter.ReportTail( _( "Annotation complete." ), REPORTER::RPT_ACTION );
|
||||
|
||||
OnModify();
|
||||
|
||||
// Update on screen references, that can be modified by previous calculations:
|
||||
m_CurrentSheet->UpdateAllScreenReferences();
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -709,8 +709,7 @@ void SCH_EDIT_FRAME::OnAutoplaceFields( wxCommandEvent& aEvent )
|
|||
|
||||
component->AutoplaceFields( screen, /* aManual */ true );
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
RefreshItem( component );
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,11 @@ void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfRef
|
|||
}
|
||||
|
||||
if( isChanged )
|
||||
{
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -252,6 +256,8 @@ bool SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile()
|
|||
return false;
|
||||
}
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -176,12 +176,6 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
GetScreen()->ClearBlockCommand();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
|
||||
if( block->GetCount() )
|
||||
{
|
||||
DisplayError( this, wxT( "HandleBlockPLace() error: some items left in buffer" ) );
|
||||
block->ClearItemsList();
|
||||
}
|
||||
|
||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
|
||||
|
||||
GetCanvas()->GetView()->ClearPreview();
|
||||
|
|
|
@ -76,6 +76,7 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, c
|
|||
|
||||
BusEntry->SetBusEntryShape( s_LastShape );
|
||||
TestDanglingEnds();
|
||||
|
||||
|
||||
RefreshItem( BusEntry );
|
||||
OnModify( );
|
||||
}
|
||||
|
|
|
@ -336,6 +336,7 @@ bool DIALOG_EDIT_COMPONENT_IN_LIBRARY::TransferDataFromWindow()
|
|||
m_libEntry->GetFootprints().Clear();
|
||||
m_libEntry->GetFootprints() = m_FootprintFilterListBox->GetStrings();
|
||||
|
||||
m_Parent->RebuildView();
|
||||
m_Parent->OnModify();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -533,8 +533,9 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow()
|
|||
|
||||
m_cmp->UpdatePinCache();
|
||||
|
||||
GetParent()->OnModify();
|
||||
GetParent()->TestDanglingEnds();
|
||||
GetParent()->RefreshItem( m_cmp );
|
||||
GetParent()->OnModify();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -334,13 +334,14 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
|||
m_CurrentText->SetThickness( 0 );
|
||||
}
|
||||
|
||||
m_Parent->RefreshItem( m_CurrentText );
|
||||
m_Parent->GetCanvas()->Refresh();
|
||||
m_Parent->OnModify();
|
||||
|
||||
// Make the text size the new default size ( if it is a new text ):
|
||||
if( m_CurrentText->IsNew() )
|
||||
SetDefaultTextSize( m_CurrentText->GetTextWidth() );
|
||||
|
||||
m_Parent->GetCanvas()->RefreshDrawingRect( m_CurrentText->GetBoundingBox() );
|
||||
m_Parent->GetCanvas()->MoveCursorToCrossHair();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -123,6 +123,8 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow()
|
|||
m_line->SetLineStyle( m_lineStyle->GetSelection() );
|
||||
m_line->SetLineColor( m_selectedColor );
|
||||
|
||||
m_frame->RefreshItem( m_line );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -784,6 +784,7 @@ bool DIALOG_FIELDS_EDITOR_GLOBAL::TransferDataFromWindow()
|
|||
SCH_SHEET_PATH currentSheet = m_parent->GetCurrentSheet();
|
||||
|
||||
m_dataModel->ApplyData();
|
||||
m_parent->SyncView();
|
||||
m_parent->OnModify();
|
||||
|
||||
// Reset the view to where we left the user
|
||||
|
|
|
@ -98,6 +98,8 @@ bool DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow()
|
|||
auto shape = static_cast<PINSHEETLABEL_SHAPE>( m_choiceConnectionType->GetCurrentSelection() );
|
||||
m_sheetPin->SetShape( shape );
|
||||
|
||||
m_frame->RefreshItem( m_sheetPin );
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -82,6 +82,8 @@ bool DIALOG_UPDATE_FIELDS::TransferDataFromWindow()
|
|||
for( auto component : m_components )
|
||||
updateFields( component );
|
||||
|
||||
m_frame->SyncView();
|
||||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -140,47 +140,15 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC )
|
|||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
|
||||
{
|
||||
// 5.1 TODO: MoveImage(), moveBitmap() and abortMoveBitmap() are obsolete....
|
||||
|
||||
aImageItem->SetFlags( IS_MOVED );
|
||||
|
||||
m_canvas->SetMouseCapture( moveBitmap, abortMoveBitmap );
|
||||
GetScreen()->SetCurItem( aImageItem );
|
||||
SetRepeatItem( NULL );
|
||||
|
||||
SetUndoItem( aImageItem );
|
||||
|
||||
if( aImageItem->IsMovableFromAnchorPoint() )
|
||||
{
|
||||
SetCrossHairPosition( aImageItem->GetPosition() );
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
aImageItem->SetStoredPos( wxPoint( 0,0 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Round the point under the cursor to a multiple of the grid
|
||||
wxPoint cursorpos = GetCrossHairPosition() - aImageItem->GetPosition();
|
||||
wxPoint gridsize = GetScreen()->GetGridSize();
|
||||
cursorpos.x = ( cursorpos.x / gridsize.x ) * gridsize.x;
|
||||
cursorpos.y = ( cursorpos.y / gridsize.y ) * gridsize.y;
|
||||
|
||||
aImageItem->SetStoredPos( cursorpos );
|
||||
}
|
||||
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::RotateImage( SCH_BITMAP* aItem )
|
||||
{
|
||||
if( aItem->GetFlags( ) == 0 )
|
||||
SaveCopyInUndoList( aItem, UR_ROTATED, false, aItem->GetPosition() );
|
||||
|
||||
aItem->Rotate( aItem->GetPosition() );
|
||||
|
||||
RefreshItem( aItem );
|
||||
OnModify();
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,8 +162,8 @@ void SCH_EDIT_FRAME::MirrorImage( SCH_BITMAP* aItem, bool Is_X_axis )
|
|||
else
|
||||
aItem->MirrorY( aItem->GetPosition().x );
|
||||
|
||||
RefreshItem( aItem );
|
||||
OnModify();
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -217,6 +185,7 @@ void SCH_EDIT_FRAME::EditImage( SCH_BITMAP* aItem )
|
|||
}
|
||||
|
||||
dlg.TransfertToImage( aItem->GetImage() );
|
||||
|
||||
RefreshItem( aItem );
|
||||
OnModify();
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
|
|
|
@ -79,12 +79,12 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
|
|||
dlg.UpdateField( aField, m_CurrentSheet );
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
m_canvas->SetIgnoreMouseEvents( false );
|
||||
OnModify();
|
||||
|
||||
if( m_autoplaceFields )
|
||||
component->AutoAutoplaceFields( GetScreen() );
|
||||
|
||||
m_canvas->Refresh();
|
||||
RefreshItem( aField );
|
||||
OnModify();
|
||||
|
||||
MSG_PANEL_ITEMS items;
|
||||
component->SetCurrentSheetPath( &GetCurrentSheet() );
|
||||
|
@ -110,5 +110,6 @@ void SCH_EDIT_FRAME::RotateField( SCH_FIELD* aField )
|
|||
else
|
||||
aField->SetTextAngle( TEXT_ANGLE_HORIZ );
|
||||
|
||||
RefreshItem( aField );
|
||||
OnModify();
|
||||
}
|
||||
|
|
|
@ -59,6 +59,8 @@ void SCH_EDIT_FRAME::ChangeTextOrient( SCH_TEXT* aTextItem )
|
|||
SaveCopyInUndoList( aTextItem, UR_CHANGED );
|
||||
|
||||
aTextItem->SetLabelSpinStyle( orient );
|
||||
|
||||
RefreshItem( aTextItem );
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
|
|
@ -619,8 +619,6 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
|||
SCH_SCREENS allScreens;
|
||||
allScreens.ReplaceDuplicateTimeStamps();
|
||||
|
||||
OnModify();
|
||||
|
||||
SCH_SCREENS screens( GetCurrentSheet().Last() );
|
||||
screens.UpdateSymbolLinks( true );
|
||||
|
||||
|
@ -631,7 +629,10 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
|||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
Zoom_Automatique( false );
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <base_units.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <sch_view.h>
|
||||
#include <general.h>
|
||||
#include <class_library.h>
|
||||
#include <lib_pin.h>
|
||||
|
@ -333,6 +333,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
|
|||
|
||||
if( m_foundItems.ReplaceItem( sheet ) )
|
||||
{
|
||||
GetCanvas()->GetView()->Update( undoItem, KIGFX::ALL );
|
||||
OnModify();
|
||||
SaveUndoItemInUndoList( undoItem );
|
||||
updateFindReplaceView( aEvent );
|
||||
|
@ -363,6 +364,7 @@ void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
|
|||
|
||||
if( m_foundItems.ReplaceItem( sheet ) )
|
||||
{
|
||||
GetCanvas()->GetView()->Update( undoItem, KIGFX::ALL );
|
||||
OnModify();
|
||||
SaveUndoItemInUndoList( undoItem );
|
||||
updateFindReplaceView( aEvent );
|
||||
|
|
|
@ -346,6 +346,8 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
|||
}
|
||||
|
||||
BlockDeleteSelectedItems( GetCurPart(), block );
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
}
|
||||
|
@ -366,6 +368,8 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
|||
if( GetCurPart() )
|
||||
{
|
||||
BlockDeleteSelectedItems( GetCurPart(), block );
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
break;
|
||||
|
@ -449,7 +453,6 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
BlockMoveSelectedItems( pt, GetCurPart(), block );
|
||||
|
||||
block->ClearItemsList();
|
||||
m_canvas->Refresh( true );
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE: // Paste (recopy the last block saved)
|
||||
|
@ -461,7 +464,6 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
pasteClipboard( pt );
|
||||
|
||||
block->ClearItemsList();
|
||||
m_canvas->Refresh( true );
|
||||
break;
|
||||
|
||||
case BLOCK_ZOOM: // Handled by HandleBlockEnd
|
||||
|
@ -472,6 +474,8 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
break;
|
||||
}
|
||||
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
||||
block->SetState( STATE_NO_BLOCK );
|
||||
|
@ -481,8 +485,6 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
|
||||
GetCanvas()->GetView()->ClearPreview();
|
||||
GetCanvas()->GetView()->ClearHiddenFlags();
|
||||
|
||||
m_canvas->Refresh( true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -547,6 +549,8 @@ void LIB_EDIT_FRAME::pasteClipboard( const wxPoint& aOffset )
|
|||
}
|
||||
|
||||
BlockMoveSelectedItems( aOffset, GetCurPart(), &GetScreen()->m_BlockLocate );
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
|
|
@ -1003,6 +1003,8 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
|
|||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
GetCanvas()->GetView()->Update( DrawItem );
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
||||
// Display new text
|
||||
|
@ -1051,6 +1053,9 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event )
|
|||
UpdatePartSelectList();
|
||||
updateTitle();
|
||||
DisplayCmpDoc();
|
||||
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
@ -1186,7 +1191,7 @@ void LIB_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
GetCanvas()->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||
GetGalCanvas()->Refresh();
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
else if( item )
|
||||
{
|
||||
|
@ -1196,6 +1201,12 @@ void LIB_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
|||
SaveCopyInUndoList( part, UR_LIBEDIT );
|
||||
|
||||
item->Rotate( rotationPoint );
|
||||
|
||||
if( item->InEditMode() )
|
||||
GetCanvas()->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||
else
|
||||
GetCanvas()->GetView()->Update( item );
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
||||
if( !item->InEditMode() )
|
||||
|
@ -1243,7 +1254,7 @@ void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||
GetGalCanvas()->Refresh();
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
else if( item )
|
||||
{
|
||||
|
@ -1258,6 +1269,11 @@ void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
|||
else
|
||||
item->MirrorVertical( mirrorPoint );
|
||||
|
||||
if( item->InEditMode() )
|
||||
m_canvas->CallMouseCapture( nullptr, wxDefaultPosition, false );
|
||||
else
|
||||
GetCanvas()->GetView()->Update( item );
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
||||
if( !item->InEditMode() )
|
||||
|
@ -1418,11 +1434,6 @@ void LIB_EDIT_FRAME::OnModify()
|
|||
GetScreen()->SetModify();
|
||||
storeCurrentPart();
|
||||
|
||||
// Parts have a small number of view items (compared to a full schematic), and changes
|
||||
// in shared pins, graphic items, etc. can add/remove items from the view. All things
|
||||
// considered, it's safer to just use a big hammer.
|
||||
RebuildView();
|
||||
|
||||
m_treePane->GetLibTree()->Refresh();
|
||||
}
|
||||
|
||||
|
@ -1452,6 +1463,8 @@ void LIB_EDIT_FRAME::OnOpenPinTable( wxCommandEvent& aEvent )
|
|||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
|
|
@ -94,6 +94,9 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
|
|||
SetShowDeMorgan( part->HasConversion() );
|
||||
updateTitle();
|
||||
DisplayCmpDoc();
|
||||
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
@ -140,5 +143,8 @@ void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
|
|||
SetShowDeMorgan( part->HasConversion() );
|
||||
updateTitle();
|
||||
DisplayCmpDoc();
|
||||
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
|
|
@ -98,5 +98,7 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
|||
|
||||
dlg.UpdateField( aField );
|
||||
|
||||
GetCanvas()->GetView()->Update( aField );
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
|
|
@ -115,6 +115,8 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
|
|||
|
||||
if( pin->IsModified() || pin->IsNew() )
|
||||
{
|
||||
GetCanvas()->GetView()->Update( pin );
|
||||
GetCanvas()->Refresh();
|
||||
OnModify( );
|
||||
|
||||
MSG_PANEL_ITEMS items;
|
||||
|
@ -267,6 +269,8 @@ void LIB_EDIT_FRAME::PlacePin()
|
|||
|
||||
SetDrawItem( NULL );
|
||||
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
@ -274,7 +278,6 @@ void LIB_EDIT_FRAME::PlacePin()
|
|||
void LIB_EDIT_FRAME::StartMovePin( LIB_ITEM* aItem )
|
||||
{
|
||||
LIB_PIN* cur_pin = (LIB_PIN*) aItem;
|
||||
wxPoint startPos;
|
||||
|
||||
TempCopyComponent();
|
||||
|
||||
|
@ -294,8 +297,7 @@ void LIB_EDIT_FRAME::StartMovePin( LIB_ITEM* aItem )
|
|||
|
||||
if( pin->GetPosition() == cur_pin->GetPosition() &&
|
||||
pin->GetOrientation() == cur_pin->GetOrientation() &&
|
||||
pin->GetConvert() == cur_pin->GetConvert()
|
||||
)
|
||||
pin->GetConvert() == cur_pin->GetConvert() )
|
||||
{
|
||||
pin->SetFlags( IS_LINKED | IS_MOVED );
|
||||
}
|
||||
|
@ -303,13 +305,11 @@ void LIB_EDIT_FRAME::StartMovePin( LIB_ITEM* aItem )
|
|||
|
||||
cur_pin->SetFlags( IS_LINKED | IS_MOVED );
|
||||
|
||||
startPos.x = OldPos.x;
|
||||
startPos.y = -OldPos.y;
|
||||
|
||||
MSG_PANEL_ITEMS items;
|
||||
|
||||
cur_pin->GetMsgPanelInfo( m_UserUnits, items );
|
||||
SetMsgPanel( items );
|
||||
|
||||
m_canvas->SetMouseCapture( DrawMovePin, AbortPinMove );
|
||||
}
|
||||
|
||||
|
@ -329,9 +329,6 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
|
|||
if( cur_pin == NULL || cur_pin->Type() != LIB_PIN_T )
|
||||
return;
|
||||
|
||||
|
||||
DBG(printf("DrawMovePin\n");)
|
||||
|
||||
auto p = aPanel->GetParent()->GetCrossHairPosition( true );
|
||||
|
||||
// Redraw pin in new position
|
||||
|
@ -339,11 +336,8 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
|
|||
|
||||
auto view = parent->GetCanvas()->GetView();
|
||||
|
||||
auto copy_pin = static_cast<LIB_PIN*>( cur_pin->Clone() );
|
||||
|
||||
view->Hide( cur_pin );
|
||||
view->ClearPreview();
|
||||
view->AddToPreview( copy_pin );
|
||||
view->AddToPreview( cur_pin, false );
|
||||
}
|
||||
|
||||
|
||||
|
@ -494,6 +488,8 @@ void LIB_EDIT_FRAME::GlobalSetPins( LIB_PIN* aMasterPin, int aId )
|
|||
|
||||
// Now changes are made, call OnModify() to validate thes changes and set
|
||||
// the global change for UI
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
@ -564,7 +560,10 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
|
|||
MSG_PANEL_ITEMS items;
|
||||
pin->GetMsgPanelInfo( m_UserUnits, items );
|
||||
SetMsgPanel( items );
|
||||
OnModify( );
|
||||
|
||||
RebuildView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,6 +97,8 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
|
|||
|
||||
DrawItem->SetWidth( m_drawLineWidth );
|
||||
|
||||
GetCanvas()->GetView()->Update( DrawItem );
|
||||
GetCanvas()->Refresh();
|
||||
OnModify( );
|
||||
|
||||
MSG_PANEL_ITEMS items;
|
||||
|
@ -117,9 +119,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* aPanel, wxDC* DC )
|
|||
item->EndEdit( parent->GetCrossHairPosition( true ), true );
|
||||
|
||||
if( newItem )
|
||||
{
|
||||
delete item;
|
||||
}
|
||||
else
|
||||
parent->RestoreComponent();
|
||||
|
||||
|
@ -129,7 +129,6 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* aPanel, wxDC* DC )
|
|||
view->ClearPreview();
|
||||
view->ShowPreview( false );
|
||||
view->ClearHiddenFlags();
|
||||
DBG(printf("abort\n");)
|
||||
parent->RebuildView();
|
||||
}
|
||||
|
||||
|
@ -253,28 +252,18 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
|
|||
static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||
bool aErase )
|
||||
{
|
||||
LIB_ITEM* item;
|
||||
|
||||
item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
|
||||
LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
|
||||
|
||||
if( item == NULL )
|
||||
return;
|
||||
|
||||
DBG(printf("CalcDraw!\n");)
|
||||
|
||||
auto view = static_cast<SCH_DRAW_PANEL*>(aPanel)->GetView();
|
||||
|
||||
auto p = aPanel->GetParent()->GetCrossHairPosition( true );
|
||||
|
||||
item->CalcEdit( p );
|
||||
|
||||
DBG(printf("cp: %d %d %d %d\n", item->GetPosition().x, item->GetPosition().y, p.x, p.y );)
|
||||
|
||||
view->ClearPreview();
|
||||
|
||||
auto copy = static_cast<LIB_ITEM*>( item->Clone() );
|
||||
DBG(printf("cp: %d %d\n", copy->GetPosition().x, copy->GetPosition().y );)
|
||||
view->AddToPreview( copy );
|
||||
view->AddToPreview( item, false );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -185,30 +185,26 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
|
|||
prj.SetRString( PROJECT::SCH_LIB_PATH, fn.GetPath() );
|
||||
|
||||
if( fn.FileExists() )
|
||||
{
|
||||
wxRemove( fn.GetFullPath() );
|
||||
}
|
||||
|
||||
wxString msg;
|
||||
msg.Printf( _( "Saving symbol in \"%s\"" ), fn.GetPath() );
|
||||
SetStatusText( msg );
|
||||
SetStatusText( wxString::Format( _( "Saving symbol in \"%s\"" ), fn.GetPath() ) );
|
||||
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER plugin( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
||||
|
||||
try
|
||||
{
|
||||
PROPERTIES nodoc_props; // Doc file is useless for a .sym file
|
||||
nodoc_props[ SCH_LEGACY_PLUGIN::PropNoDocFile ] = "";
|
||||
pi->CreateSymbolLib( fn.GetFullPath(), &nodoc_props );
|
||||
plugin->CreateSymbolLib( fn.GetFullPath(), &nodoc_props );
|
||||
|
||||
LIB_PART* saved_part = new LIB_PART( *part );
|
||||
saved_part->RemoveAllAliases(); // useless in a .sym file
|
||||
pi->SaveSymbol( fn.GetFullPath(), saved_part, &nodoc_props );
|
||||
plugin->SaveSymbol( fn.GetFullPath(), saved_part, &nodoc_props );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
msg.Printf( _( "An error occurred attempting to save symbol file \"%s\"" ),
|
||||
fn.GetFullPath() );
|
||||
wxString msg = wxString::Format( _( "An error occurred saving symbol file \"%s\"" ),
|
||||
fn.GetFullPath() );
|
||||
DisplayErrorMessage( this, msg, ioe.What() );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -574,7 +574,8 @@ bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
|
|||
viewer->ReCreateListLib();
|
||||
|
||||
GetScreen()->ClearUndoORRedoList( GetScreen()->m_UndoList, 1 );
|
||||
m_canvas->Refresh( true );
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1438,13 +1438,13 @@ void SCH_EDIT_FRAME::addCurrentItemToScreen()
|
|||
|
||||
item->ClearFlags();
|
||||
|
||||
GetCanvas()->GetView()->Update( item );
|
||||
|
||||
screen->SetModify();
|
||||
screen->SetCurItem( NULL );
|
||||
m_canvas->SetMouseCapture( NULL, NULL );
|
||||
m_canvas->EndMouseCapture();
|
||||
|
||||
RefreshItem( item );
|
||||
|
||||
if( item->IsConnectable() )
|
||||
{
|
||||
std::vector< wxPoint > pts;
|
||||
|
|
|
@ -1000,7 +1000,6 @@ private:
|
|||
|
||||
// Images:
|
||||
SCH_BITMAP* CreateNewImage( wxDC* aDC );
|
||||
void MoveImage( SCH_BITMAP* aItem, wxDC* aDC );
|
||||
void RotateImage( SCH_BITMAP* aItem );
|
||||
|
||||
/**
|
||||
|
|
|
@ -131,20 +131,21 @@ void SCH_VIEW::ClearPreview()
|
|||
{
|
||||
m_preview->Clear();
|
||||
|
||||
for( auto item : m_previewItems )
|
||||
for( auto item : m_ownedItems )
|
||||
delete item;
|
||||
|
||||
m_previewItems.clear();
|
||||
Update(m_preview.get());
|
||||
m_ownedItems.clear();
|
||||
Update( m_preview.get() );
|
||||
}
|
||||
|
||||
|
||||
void SCH_VIEW::AddToPreview( EDA_ITEM *aItem, bool owned )
|
||||
void SCH_VIEW::AddToPreview( EDA_ITEM *aItem, bool takeOwnership )
|
||||
{
|
||||
Hide( aItem, false );
|
||||
m_preview->Add( aItem );
|
||||
|
||||
if( owned )
|
||||
m_previewItems.push_back( aItem );
|
||||
if( takeOwnership )
|
||||
m_ownedItems.push_back( aItem );
|
||||
|
||||
SetVisible( m_preview.get(), true );
|
||||
Hide( m_preview.get(), false );
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
KIGFX::VIEW_GROUP* GetPreview() const { return m_preview.get(); }
|
||||
|
||||
void ClearPreview();
|
||||
void AddToPreview( EDA_ITEM *aItem, bool makeCopy = true );
|
||||
void AddToPreview( EDA_ITEM *aItem, bool takeOwnership = true );
|
||||
|
||||
void ShowSelectionArea( bool aShow = true );
|
||||
void ShowPreview( bool aShow = true );
|
||||
|
@ -55,7 +55,7 @@ private:
|
|||
std::unique_ptr<WORKSHEET_VIEWITEM> m_worksheet;
|
||||
std::unique_ptr<KIGFX::PREVIEW::SELECTION_AREA> m_selectionArea;
|
||||
std::unique_ptr<KIGFX::VIEW_GROUP> m_preview;
|
||||
std::vector<EDA_ITEM *> m_previewItems;
|
||||
std::vector<EDA_ITEM *> m_ownedItems;
|
||||
std::unordered_map<VIEW_ITEM*, BOX2I> m_cachedBBoxes;
|
||||
};
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
SetRepeatItem( NULL );
|
||||
TestDanglingEnds();
|
||||
SetSheetNumberAndCount();
|
||||
m_canvas->Refresh();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
break;
|
||||
|
||||
|
@ -262,8 +262,9 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
/* Save sheet in undo list before cleaning up unreferenced hierarchical labels. */
|
||||
SaveCopyInUndoList( sheet, UR_CHANGED );
|
||||
sheet->CleanupSheet();
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
m_canvas->RefreshDrawingRect( sheet->GetBoundingBox() );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -691,7 +692,6 @@ static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|||
// Draw the item item at it's new position.
|
||||
item->SetWireImage(); // While moving, the item may choose to render differently
|
||||
|
||||
view->Hide( item );
|
||||
view->ClearPreview();
|
||||
view->AddToPreview( item, false );
|
||||
}
|
||||
|
|
|
@ -404,11 +404,13 @@ void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
|
|||
List->ReversePickersListOrder();
|
||||
GetScreen()->PushCommandToRedoList( List );
|
||||
|
||||
OnModify();
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
TestDanglingEnds();
|
||||
m_canvas->Refresh();
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
||||
|
||||
|
@ -427,9 +429,11 @@ void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
|
|||
List->ReversePickersListOrder();
|
||||
GetScreen()->PushCommandToUndoList( List );
|
||||
|
||||
OnModify();
|
||||
SetSheetNumberAndCount();
|
||||
|
||||
TestDanglingEnds();
|
||||
m_canvas->Refresh();
|
||||
|
||||
SyncView();
|
||||
GetCanvas()->Refresh();
|
||||
OnModify();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue