diff --git a/gerbview/tools/gerbview_control.cpp b/gerbview/tools/gerbview_control.cpp index 392dae56e7..e0977f58cb 100644 --- a/gerbview/tools/gerbview_control.cpp +++ b/gerbview/tools/gerbview_control.cpp @@ -111,12 +111,11 @@ int GERBVIEW_CONTROL::ExportToPcbnew( const TOOL_EVENT& aEvent ) return 0; } - wxString fileDialogName( wxT( "noname." ) + KiCadPcbFileExtension ); - wxString path = m_frame->GetMruPath(); + wxString fileDialogName( wxT( "noname." ) + KiCadPcbFileExtension ); + wxString path = m_frame->GetMruPath(); - wxFileDialog filedlg( m_frame, _( "Board File Name" ), - path, fileDialogName, PcbFileWildcard(), - wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); + wxFileDialog filedlg( m_frame, _( "Board File Name" ), path, fileDialogName, PcbFileWildcard(), + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( filedlg.ShowModal() == wxID_CANCEL ) return 0; @@ -183,6 +182,7 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent ) else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightAttribute ) ) { D_CODE* apertDescr = item->GetDcodeDescr(); + if( apertDescr ) { auto string = apertDescr->m_AperFunction; @@ -300,9 +300,8 @@ int GERBVIEW_CONTROL::ClearAllLayers( const TOOL_EVENT& aEvent ) int GERBVIEW_CONTROL::ReloadAllLayers( const TOOL_EVENT& aEvent ) { // Store filenames - wxArrayString listOfGerberFiles; - std::vector fileType; - + wxArrayString listOfGerberFiles; + std::vector fileType; GERBER_FILE_IMAGE_LIST* list = m_frame->GetImagesList(); for( unsigned i = 0; i < list->ImagesMaxCount(); i++ ) @@ -313,7 +312,7 @@ int GERBVIEW_CONTROL::ReloadAllLayers( const TOOL_EVENT& aEvent ) if( !list->GetGbrImage( i )->m_InUse ) continue; - auto* drill_file = dynamic_cast( list->GetGbrImage( i ) ); + EXCELLON_IMAGE* drill_file = dynamic_cast( list->GetGbrImage( i ) ); if( drill_file ) fileType.push_back( 1 ); diff --git a/gerbview/tools/gerbview_inspection_tool.cpp b/gerbview/tools/gerbview_inspection_tool.cpp index 420960af42..66848bf653 100644 --- a/gerbview/tools/gerbview_inspection_tool.cpp +++ b/gerbview/tools/gerbview_inspection_tool.cpp @@ -173,10 +173,14 @@ int GERBVIEW_INSPECTION_TOOL::ShowSource( const TOOL_EVENT& aEvent ) wxMessageBox( msg ); } else + { ExecuteFile( m_frame, editorname, QuoteFullPath( fn ) ); + } } else + { wxMessageBox( _( "No editor defined. Please select one" ) ); + } } else { diff --git a/gerbview/tools/gerbview_selection_tool.cpp b/gerbview/tools/gerbview_selection_tool.cpp index dc725470fd..d03ab40b64 100644 --- a/gerbview/tools/gerbview_selection_tool.cpp +++ b/gerbview/tools/gerbview_selection_tool.cpp @@ -71,8 +71,8 @@ private: ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) ) { auto menuEntry = Add( GERBVIEW_ACTIONS::highlightComponent ); - menuEntry->SetItemLabel( wxString::Format( - _( "Highlight Items of Component \"%s\"" ), net_attr.m_Cmpref ) ); + menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Component \"%s\"" ), + net_attr.m_Cmpref ) ); addSeparator = true; } @@ -80,7 +80,7 @@ private: { auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet ); menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ), - UnescapeString( net_attr.m_Netname ) ) ); + UnescapeString( net_attr.m_Netname ) ) ); addSeparator = true; } @@ -89,8 +89,8 @@ private: if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() ) { auto menuEntry = Add( GERBVIEW_ACTIONS::highlightAttribute ); - menuEntry->SetItemLabel( wxString::Format( - _( "Highlight Aperture Type \"%s\"" ), apertDescr->m_AperFunction ) ); + menuEntry->SetItemLabel( wxString::Format( _( "Highlight Aperture Type \"%s\"" ), + apertDescr->m_AperFunction ) ); addSeparator = true; } } @@ -202,7 +202,6 @@ int GERBVIEW_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) { selectPoint( evt->Position() ); } - // right click? if there is any object - show the context menu else if( evt->IsClick( BUT_RIGHT ) ) { @@ -214,20 +213,19 @@ int GERBVIEW_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) m_menu.ShowContextMenu( m_selection ); } - // Middle double click? Do zoom to fit else if( evt->IsDblClick( BUT_MIDDLE ) ) { m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); } - else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE ) { clearSelection(); } - else + { evt->SetPassEvent(); + } } return 0; @@ -331,7 +329,7 @@ int GERBVIEW_SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent ) if( items ) { // Perform individual selection of each item before processing the event. - for( auto item : *items ) + for( EDA_ITEM* item : *items ) select( item ); m_toolMgr->ProcessEvent( EVENTS::SelectedEvent ); @@ -365,7 +363,7 @@ int GERBVIEW_SELECTION_TOOL::UnselectItems( const TOOL_EVENT& aEvent ) if( items ) { // Perform individual unselection of each item before processing the event - for( auto item : *items ) + for( EDA_ITEM* item : *items ) unselect( item ); m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent ); @@ -397,8 +395,8 @@ void GERBVIEW_SELECTION_TOOL::clearSelection() if( m_selection.Empty() ) return; - for( auto item : m_selection ) - unselectVisually( static_cast( item ) ); + for( EDA_ITEM* item : m_selection ) + unselectVisually( item ); m_selection.Clear(); diff --git a/include/tool/selection.h b/include/tool/selection.h index d06260304e..25950975e3 100644 --- a/include/tool/selection.h +++ b/include/tool/selection.h @@ -36,12 +36,14 @@ class SELECTION : public KIGFX::VIEW_GROUP { public: - SELECTION() : KIGFX::VIEW_GROUP::VIEW_GROUP() + SELECTION() : + KIGFX::VIEW_GROUP::VIEW_GROUP() { m_isHover = false; } - SELECTION( const SELECTION& aOther ) : KIGFX::VIEW_GROUP::VIEW_GROUP() + SELECTION( const SELECTION& aOther ) : + KIGFX::VIEW_GROUP::VIEW_GROUP() { m_items = aOther.m_items; m_isHover = aOther.m_isHover;