Formatting.

This commit is contained in:
Jeff Young 2020-12-25 23:37:17 +00:00
parent 8a720ef305
commit fd77982496
4 changed files with 27 additions and 24 deletions

View File

@ -111,12 +111,11 @@ int GERBVIEW_CONTROL::ExportToPcbnew( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
wxString fileDialogName( wxT( "noname." ) + KiCadPcbFileExtension ); wxString fileDialogName( wxT( "noname." ) + KiCadPcbFileExtension );
wxString path = m_frame->GetMruPath(); wxString path = m_frame->GetMruPath();
wxFileDialog filedlg( m_frame, _( "Board File Name" ), wxFileDialog filedlg( m_frame, _( "Board File Name" ), path, fileDialogName, PcbFileWildcard(),
path, fileDialogName, PcbFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( filedlg.ShowModal() == wxID_CANCEL ) if( filedlg.ShowModal() == wxID_CANCEL )
return 0; return 0;
@ -183,6 +182,7 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent )
else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightAttribute ) ) else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightAttribute ) )
{ {
D_CODE* apertDescr = item->GetDcodeDescr(); D_CODE* apertDescr = item->GetDcodeDescr();
if( apertDescr ) if( apertDescr )
{ {
auto string = apertDescr->m_AperFunction; 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 ) int GERBVIEW_CONTROL::ReloadAllLayers( const TOOL_EVENT& aEvent )
{ {
// Store filenames // Store filenames
wxArrayString listOfGerberFiles; wxArrayString listOfGerberFiles;
std::vector<int> fileType; std::vector<int> fileType;
GERBER_FILE_IMAGE_LIST* list = m_frame->GetImagesList(); GERBER_FILE_IMAGE_LIST* list = m_frame->GetImagesList();
for( unsigned i = 0; i < list->ImagesMaxCount(); i++ ) 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 ) if( !list->GetGbrImage( i )->m_InUse )
continue; continue;
auto* drill_file = dynamic_cast<EXCELLON_IMAGE*>( list->GetGbrImage( i ) ); EXCELLON_IMAGE* drill_file = dynamic_cast<EXCELLON_IMAGE*>( list->GetGbrImage( i ) );
if( drill_file ) if( drill_file )
fileType.push_back( 1 ); fileType.push_back( 1 );

View File

@ -173,10 +173,14 @@ int GERBVIEW_INSPECTION_TOOL::ShowSource( const TOOL_EVENT& aEvent )
wxMessageBox( msg ); wxMessageBox( msg );
} }
else else
{
ExecuteFile( m_frame, editorname, QuoteFullPath( fn ) ); ExecuteFile( m_frame, editorname, QuoteFullPath( fn ) );
}
} }
else else
{
wxMessageBox( _( "No editor defined. Please select one" ) ); wxMessageBox( _( "No editor defined. Please select one" ) );
}
} }
else else
{ {

View File

@ -71,8 +71,8 @@ private:
( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) ) ( net_attr.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
{ {
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightComponent ); auto menuEntry = Add( GERBVIEW_ACTIONS::highlightComponent );
menuEntry->SetItemLabel( wxString::Format( menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Component \"%s\"" ),
_( "Highlight Items of Component \"%s\"" ), net_attr.m_Cmpref ) ); net_attr.m_Cmpref ) );
addSeparator = true; addSeparator = true;
} }
@ -80,7 +80,7 @@ private:
{ {
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet ); auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet );
menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ), menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ),
UnescapeString( net_attr.m_Netname ) ) ); UnescapeString( net_attr.m_Netname ) ) );
addSeparator = true; addSeparator = true;
} }
@ -89,8 +89,8 @@ private:
if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() ) if( apertDescr && !apertDescr->m_AperFunction.IsEmpty() )
{ {
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightAttribute ); auto menuEntry = Add( GERBVIEW_ACTIONS::highlightAttribute );
menuEntry->SetItemLabel( wxString::Format( menuEntry->SetItemLabel( wxString::Format( _( "Highlight Aperture Type \"%s\"" ),
_( "Highlight Aperture Type \"%s\"" ), apertDescr->m_AperFunction ) ); apertDescr->m_AperFunction ) );
addSeparator = true; addSeparator = true;
} }
} }
@ -202,7 +202,6 @@ int GERBVIEW_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
selectPoint( evt->Position() ); selectPoint( evt->Position() );
} }
// right click? if there is any object - show the context menu // right click? if there is any object - show the context menu
else if( evt->IsClick( BUT_RIGHT ) ) else if( evt->IsClick( BUT_RIGHT ) )
{ {
@ -214,20 +213,19 @@ int GERBVIEW_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
m_menu.ShowContextMenu( m_selection ); m_menu.ShowContextMenu( m_selection );
} }
// Middle double click? Do zoom to fit // Middle double click? Do zoom to fit
else if( evt->IsDblClick( BUT_MIDDLE ) ) else if( evt->IsDblClick( BUT_MIDDLE ) )
{ {
m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true ); m_toolMgr->RunAction( ACTIONS::zoomFitScreen, true );
} }
else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE ) else if( evt->IsCancel() || evt->Action() == TA_UNDO_REDO_PRE )
{ {
clearSelection(); clearSelection();
} }
else else
{
evt->SetPassEvent(); evt->SetPassEvent();
}
} }
return 0; return 0;
@ -331,7 +329,7 @@ int GERBVIEW_SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent )
if( items ) if( items )
{ {
// Perform individual selection of each item before processing the event. // Perform individual selection of each item before processing the event.
for( auto item : *items ) for( EDA_ITEM* item : *items )
select( item ); select( item );
m_toolMgr->ProcessEvent( EVENTS::SelectedEvent ); m_toolMgr->ProcessEvent( EVENTS::SelectedEvent );
@ -365,7 +363,7 @@ int GERBVIEW_SELECTION_TOOL::UnselectItems( const TOOL_EVENT& aEvent )
if( items ) if( items )
{ {
// Perform individual unselection of each item before processing the event // Perform individual unselection of each item before processing the event
for( auto item : *items ) for( EDA_ITEM* item : *items )
unselect( item ); unselect( item );
m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent ); m_toolMgr->ProcessEvent( EVENTS::UnselectedEvent );
@ -397,8 +395,8 @@ void GERBVIEW_SELECTION_TOOL::clearSelection()
if( m_selection.Empty() ) if( m_selection.Empty() )
return; return;
for( auto item : m_selection ) for( EDA_ITEM* item : m_selection )
unselectVisually( static_cast<EDA_ITEM*>( item ) ); unselectVisually( item );
m_selection.Clear(); m_selection.Clear();

View File

@ -36,12 +36,14 @@
class SELECTION : public KIGFX::VIEW_GROUP class SELECTION : public KIGFX::VIEW_GROUP
{ {
public: public:
SELECTION() : KIGFX::VIEW_GROUP::VIEW_GROUP() SELECTION() :
KIGFX::VIEW_GROUP::VIEW_GROUP()
{ {
m_isHover = false; 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_items = aOther.m_items;
m_isHover = aOther.m_isHover; m_isHover = aOther.m_isHover;