void SCH_EDIT_FRAME::DisplayCurrentSheet() { SetRepeatItem( NULL ); ClearMsgPanel(); SCH_SCREEN* screen = m_CurrentSheet->LastScreen(); // Switch to current sheet, // and update the grid size, because it can be modified in latest screen SetScreen( screen ); GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ); // update the References m_CurrentSheet->UpdateAllScreenReferences(); SetSheetNumberAndCount(); m_canvas->SetCanStartBlock( -1 ); if( screen->m_FirstRedraw ) { Zoom_Automatique( false ); screen->m_FirstRedraw = false; SetCrossHairPosition( GetScrollCenterPosition() ); m_canvas->MoveCursorToCrossHair(); // Ensure the schematic is fully segmented on first display BreakSegmentsOnJunctions(); SchematicCleanUp( true ); screen->ClearUndoORRedoList( screen->m_UndoList, 1 ); screen->TestDanglingEnds(); } else { RedrawScreen( GetScrollCenterPosition(), true ); } // Some items (wires, labels) can be highlighted. So prepare the highlight flag: SetCurrentSheetHighlightFlags(); // Now refresh m_canvas. Should be not necessary, but because screen has changed // the previous refresh has set all new draw parameters (scroll position ..) // but most of time there were some inconsitencies about cursor parameters // ( previous position of cursor ...) and artefacts can happen // mainly when sheet size has changed // This second refresh clears artefacts because at this point, // all parameters are now updated m_canvas->Refresh(); }