Hi all, Attached are three patches to fix a few issues noted by JP and Clemens. These need to be applied after my patches from yesterday which are not yet merged.
Best, Jon
From 0d0a6cb24f14e3da98d7d941a7a4cf96dcab8e12 Mon Sep 17 00:00:00 2001 From: Jon Evans <[email protected]> Date: Tue, 27 Feb 2018 21:33:41 -0500 Subject: [PATCH 3/3] GerbView: Fix DCode reordering; ensure loaded layers are visible --- gerbview/files.cpp | 5 +++++ gerbview/gerbview_frame.cpp | 21 +++++++++++++++++++++ gerbview/gerbview_frame.h | 2 ++ gerbview/gerbview_layer_widget.cpp | 15 +-------------- gerbview/job_file_reader.cpp | 14 +------------- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/gerbview/files.cpp b/gerbview/files.cpp index d19c18f25..2ed1945db 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -231,6 +231,7 @@ bool GERBVIEW_FRAME::loadListOfGerberFiles( const wxString& aPath, // Read gerber files: each file is loaded on a new GerbView layer bool success = true; int layer = GetActiveLayer(); + int visibility = GetVisibleLayers(); // Manage errors when loading files wxString msg; @@ -265,6 +266,8 @@ bool GERBVIEW_FRAME::loadListOfGerberFiles( const wxString& aPath, SetActiveLayer( layer, false ); + visibility |= ( 1 << layer ); + if( Read_GERBER_File( filename.GetFullPath() ) ) { UpdateFileHistory( m_lastFileName ); @@ -305,6 +308,8 @@ bool GERBVIEW_FRAME::loadListOfGerberFiles( const wxString& aPath, mbox.ShowModal(); } + SetVisibleLayers( visibility ); + Zoom_Automatique( false ); // Synchronize layers tools with actual active layer: diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index f73e2afd2..26babda31 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -668,6 +668,27 @@ void GERBVIEW_FRAME::Liste_D_Codes() } +void GERBVIEW_FRAME::SortLayersByX2Attributes() +{ + auto remapping = GetImagesList()->SortImagesByZOrder(); + + ReFillLayerWidget(); + syncLayerBox( true ); + + std::unordered_map<int, int> view_remapping; + + for( auto it : remapping ) + { + view_remapping[ GERBER_DRAW_LAYER( it.first) ] = GERBER_DRAW_LAYER( it.second ); + view_remapping[ GERBER_DCODE_LAYER( GERBER_DRAW_LAYER( it.first) ) ] = + GERBER_DCODE_LAYER( GERBER_DRAW_LAYER( it.second ) ); + } + + GetGalCanvas()->GetView()->ReorderLayerData( view_remapping ); + GetCanvas()->Refresh(); +} + + void GERBVIEW_FRAME::UpdateTitleAndInfo() { GERBER_FILE_IMAGE* gerber = GetGbrImage( GetActiveLayer() ); diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index ca7e35d12..244f76464 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -701,6 +701,8 @@ public: bool Clear_DrawLayers( bool query ); void Erase_Current_DrawLayer( bool query ); + void SortLayersByX2Attributes(); + // Conversion function void ExportDataInPcbnewFormat( wxCommandEvent& event ); diff --git a/gerbview/gerbview_layer_widget.cpp b/gerbview/gerbview_layer_widget.cpp index 4b7407a86..20e2cd2d1 100644 --- a/gerbview/gerbview_layer_widget.cpp +++ b/gerbview/gerbview_layer_widget.cpp @@ -209,20 +209,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) break; case ID_SORT_GBR_LAYERS: - auto remapping = GetImagesList()->SortImagesByZOrder(); - myframe->ReFillLayerWidget(); - myframe->syncLayerBox( true ); - - std::unordered_map<int, int> view_remapping; - - for( auto it : remapping ) - { - view_remapping[ GERBER_DRAW_LAYER( it.first) ] = GERBER_DRAW_LAYER( it.second ); - } - - myframe->GetGalCanvas()->GetView()->ReorderLayerData( view_remapping ); - - myframe->GetCanvas()->Refresh(); + myframe->SortLayersByX2Attributes(); break; } } diff --git a/gerbview/job_file_reader.cpp b/gerbview/job_file_reader.cpp index f6a4b470f..93a1eb226 100644 --- a/gerbview/job_file_reader.cpp +++ b/gerbview/job_file_reader.cpp @@ -197,19 +197,7 @@ bool GERBVIEW_FRAME::LoadGerberJobFile( const wxString& aFullFileName ) Zoom_Automatique( false ); - auto remapping = GetImagesList()->SortImagesByZOrder(); - - ReFillLayerWidget(); - syncLayerBox( true ); - - std::unordered_map<int, int> view_remapping; - - for( auto it : remapping ) - { - view_remapping[ GERBER_DRAW_LAYER( it.first) ] = GERBER_DRAW_LAYER( it.second ); - } - - GetGalCanvas()->GetView()->ReorderLayerData( view_remapping ); + SortLayersByX2Attributes(); if( !msg.IsEmpty() ) { -- 2.14.1
From 4f01cfacd1699daf5c4627cd48632966af5d6262 Mon Sep 17 00:00:00 2001 From: Jon Evans <[email protected]> Date: Tue, 27 Feb 2018 20:59:47 -0500 Subject: [PATCH 2/3] GerbView: only erase current layer if a new file is chosen --- gerbview/files.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 381ade3f5..d19c18f25 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -110,7 +110,6 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event ) switch( id ) { case wxID_FILE: - Erase_Current_DrawLayer( false ); LoadGerberFiles( wxEmptyString ); break; @@ -215,6 +214,8 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName ) m_mruPath = currentPath = filename.GetPath(); } + Erase_Current_DrawLayer( false ); + // Set the busy cursor wxBusyCursor wait; -- 2.14.1
From 2c5c23e2904c3b77579163bb3f300bb6feb9b2c7 Mon Sep 17 00:00:00 2001 From: Jon Evans <[email protected]> Date: Tue, 27 Feb 2018 20:53:27 -0500 Subject: [PATCH 1/3] Properly update view when GerbView display settings changed --- .../gerbview_dialog_display_options_frame.cpp | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp index 4754c9c6e..bd032e8a1 100644 --- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp +++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp @@ -147,28 +147,32 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event ) TransferDataFromWindow(); auto displayOptions = (GBR_DISPLAY_OPTIONS*) m_Parent->GetDisplayOptions(); + bool needs_repaint = false, option; + m_Parent->m_DisplayOptions.m_DisplayPolarCood = (m_PolarDisplay->GetSelection() == 0) ? false : true; g_UserUnit = (m_BoxUnits->GetSelection() == 0) ? INCHES : MILLIMETRES; - if( m_OptDisplayLines->GetSelection() == 1 ) - m_Parent->m_DisplayOptions.m_DisplayLinesFill = true; - else - m_Parent->m_DisplayOptions.m_DisplayLinesFill = false; + option = ( m_OptDisplayLines->GetSelection() == 1 ); - if( m_OptDisplayFlashedItems->GetSelection() == 1 ) - { - m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = true; - } - else - { - m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = false; - } + if( option != m_Parent->m_DisplayOptions.m_DisplayLinesFill ) + needs_repaint = true; - if( m_OptDisplayPolygons->GetSelection() == 0 ) - m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = false; - else - m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = true; + m_Parent->m_DisplayOptions.m_DisplayLinesFill = option; + + option = ( m_OptDisplayFlashedItems->GetSelection() == 1 ); + + if( option != m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill ) + needs_repaint = true; + + m_Parent->m_DisplayOptions.m_DisplayFlashedItemsFill = option; + + option = ( m_OptDisplayPolygons->GetSelection() == 1 ); + + if( option != m_Parent->m_DisplayOptions.m_DisplayPolygonsFill ) + needs_repaint = true; + + m_Parent->m_DisplayOptions.m_DisplayPolygonsFill = option; m_Parent->SetElementVisibility( LAYER_DCODES, m_OptDisplayDCodes->GetValue() ); @@ -192,6 +196,9 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event ) settings->LoadDisplayOptions( displayOptions ); view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); + if( needs_repaint ) + view->UpdateAllItems( KIGFX::REPAINT ); + m_Parent->GetCanvas()->Refresh(); EndModal( 1 ); -- 2.14.1
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

