diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index aead9860ba..dd55702920 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -170,7 +170,7 @@ void EDA_DRAW_PANEL_GAL::DoRePaint() // Update current zoom settings if the canvas is managed by a EDA frame // (i.e. not by a preview panel in a dialog) - if( GetParentEDAFrame() && GetParentEDAFrame()->GetScreen() ) + if( !IsDialogPreview() && GetParentEDAFrame() && GetParentEDAFrame()->GetScreen() ) GetParentEDAFrame()->GetScreen()->m_ScrollCenter = GetView()->GetCenter(); m_viewControls->UpdateScrollbars(); diff --git a/include/class_draw_panel_gal.h b/include/class_draw_panel_gal.h index 725080aa4b..ea15696072 100644 --- a/include/class_draw_panel_gal.h +++ b/include/class_draw_panel_gal.h @@ -177,6 +177,8 @@ public: */ EDA_DRAW_FRAME* GetParentEDAFrame() const { return m_edaFrame; } + bool IsDialogPreview() const { return m_parent != (wxWindow*) m_edaFrame; } + /** * Function OnShow() * Called when the window is shown for the first time. diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 3a7a6ba8e5..5ecbdf2e9c 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -291,6 +291,7 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas() settings->SetSketchModeGraphicItems( sketchMode ); settings->SetHighContrast( false ); + settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL ); // gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid: double gridsize = 0.001 * IU_PER_MM; @@ -786,6 +787,7 @@ void DIALOG_PAD_PROPERTIES::onChangePadMode( wxCommandEvent& event ) settings->SetSketchModeGraphicItems( m_sketchPreview ); settings->SetHighContrast( false ); + settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL ); m_previewNotebook->ChangeSelection( 0 ); redraw(); diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 06e70eaf7f..39e76e6cd8 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -130,11 +130,14 @@ PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin // Load display options (such as filled/outline display of items). // Can be made only if the parent window is an EDA_DRAW_FRAME (or a derived class) // which is not always the case (namely when it is used from a wxDialog like the pad editor) - PCB_BASE_FRAME* frame = dynamic_cast( GetParentEDAFrame() ); + if( !IsDialogPreview() ) + { + KIGFX::PCB_VIEW* view = static_cast( m_view ); + PCB_BASE_FRAME* frame = dynamic_cast( GetParentEDAFrame() ); - if( frame ) - static_cast( m_view )->UpdateDisplayOptions( - frame->GetDisplayOptions() ); + if( frame ) + view->UpdateDisplayOptions( frame->GetDisplayOptions() ); + } } @@ -210,7 +213,7 @@ void PCB_DRAW_PANEL_GAL::UpdateColors() { COLOR_SETTINGS* cs = nullptr; - auto frame = dynamic_cast( GetParentEDAFrame() ); + PCB_BASE_FRAME* frame = dynamic_cast( GetParentEDAFrame() ); if( frame ) { @@ -385,7 +388,7 @@ void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, int viasCount = 0; int trackSegmentsCount = 0; - for( auto item : board->Tracks() ) + for( TRACK* item : board->Tracks() ) { if( item->Type() == PCB_VIA_T ) viasCount++; @@ -415,7 +418,10 @@ void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, void PCB_DRAW_PANEL_GAL::OnShow() { - PCB_BASE_FRAME* frame = dynamic_cast( GetParentEDAFrame() ); + PCB_BASE_FRAME* frame = nullptr; + + if( !IsDialogPreview() ) + frame = dynamic_cast( GetParentEDAFrame() ); try {