Cleanup and commenting.

This commit is contained in:
Jeff Young 2019-07-12 00:28:46 +01:00
parent fc2379ca8a
commit 2d17d2b91f
8 changed files with 26 additions and 51 deletions

View File

@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file eda_3d_viewer.cpp
* @brief Implements a 3d viewer windows GUI
*/
#include "eda_3d_viewer.h"
#include "../3d_viewer_id.h"
@ -42,7 +37,6 @@
#include <tool/common_control.h>
#include <hotkeys_basic.h>
#include <wx/colordlg.h>
#include <wx/colourdata.h>
#include <wx/toolbar.h>
@ -86,11 +80,8 @@ static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
static const wxChar keyMousewheelPanning[] = wxT( "MousewheelPAN3D" );
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
//static const wxChar keyRenderTextures[] = wxT( "Render_Textures" );
static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
static const wxChar keyRenderOGL_ShowCopperTck[]= wxT( "Render_OGL_ShowCopperThickness" );
@ -220,7 +211,7 @@ EDA_3D_VIEWER::~EDA_3D_VIEWER()
// m_canvas delete will be called by wxWidget manager
//delete m_canvas;
//m_canvas = 0;
//m_canvas = nullptr;
}
@ -260,7 +251,7 @@ void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
// m_canvas delete will be called by wxWidget manager
//delete m_canvas;
//m_canvas = 0;
//m_canvas = nullptr;
Destroy();
event.Skip( true );

View File

@ -30,8 +30,6 @@
/**
* Class CVPCB_SELECTION_TOOL
*
* Selection tool for GerbView, based on the one in PcbNew
*/
class CVPCB_SELECTION_TOOL : public TOOL_INTERACTIVE
{
@ -65,7 +63,6 @@ public:
void setTransitions() override;
private:
/// Pointer to the parent frame.
DISPLAY_FOOTPRINTS_FRAME* m_frame;
/// Current state of selection (not really used: no selection in display footprints frame).

View File

@ -110,8 +110,7 @@ GERBVIEW_SELECTION_TOOL::GERBVIEW_SELECTION_TOOL() :
m_frame( NULL ),
m_additive( false ),
m_subtractive( false ),
m_exclusive_or( false ),
m_multiple( false )
m_exclusive_or( false )
{
m_preliminary = true;
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -73,19 +73,12 @@ public:
*/
GERBVIEW_SELECTION& GetSelection();
///> Clear current selection event handler.
int ClearSelection( const TOOL_EVENT& aEvent );
///> Item selection event handler.
int SelectItem( const TOOL_EVENT& aEvent );
///> Multiple item selection event handler
int SelectItems( const TOOL_EVENT& aEvent );
///> Item unselection event handler.
int UnselectItem( const TOOL_EVENT& aEvent );
///> Multiple item unselection event handler
int UnselectItems( const TOOL_EVENT& aEvent );
///> Launches a tool to measure between points
@ -97,9 +90,8 @@ public:
private:
/**
* Function selectPoint()
* Selects an item pointed by the parameter aWhere. If there is more than
* one item at that place, there is a menu displayed that allows one to
* choose the item.
* Selects an item pointed by the parameter aWhere. If there is more than one item at that
* place, there is a menu displayed that allows one to choose the item.
*
* @param aWhere is the place where the item should be selected.
* @param aAllowDisambiguation decides what to do in case of disambiguation. If true, then
@ -110,8 +102,8 @@ private:
/**
* Function selectCursor()
* Selects an item under the cursor unless there is something already selected or aSelectAlways
* is true.
* Selects an item under the cursor unless there is something already selected or
* aSelectAlways is true.
* @param aSelectAlways forces to select an item even if there is an item already selected.
* @return true if eventually there is an item selected, false otherwise.
*/
@ -176,7 +168,6 @@ private:
bool m_additive; // Items should be added to selection (instead of replacing)
bool m_subtractive; // Items should be removed from selection
bool m_exclusive_or; // Items' selection state should be toggled
bool m_multiple; // Multiple selection mode is active
bool m_preliminary; // Determines if the selection is preliminary or final.
};

View File

@ -500,7 +500,6 @@ void PL_SELECTION_TOOL::UnbrightenItem( EDA_ITEM* aItem )
int PL_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
{
ClearSelection();
return 0;
}

View File

@ -105,9 +105,7 @@ public:
void BrightenItem( EDA_ITEM* aItem );
void UnbrightenItem( EDA_ITEM* aItem );
///> Clear current selection event handler.
int ClearSelection( const TOOL_EVENT& aEvent );
void ClearSelection();
/**

View File

@ -356,9 +356,8 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
bool isFirstPoint = true; // used to be sure oldCursorPos will be initialized at least once.
STATUS_TEXT_POPUP statusPopup( frame() );
statusPopup.SetText( wxString::Format(
_( "Click on pad %s%d\nPress Escape to cancel or double-click to commit" ),
padPrefix.c_str(), seqPadNum ) );
wxString msg = _( "Click on pad %s%d\nPress <esc> to cancel or double-click to commit" );
statusPopup.SetText( wxString::Format( msg, padPrefix, seqPadNum ) );
statusPopup.Popup();
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
@ -437,7 +436,7 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
else
newval = seqPadNum++;
wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix.c_str(), newval );
wxString newName = wxString::Format( wxT( "%s%d" ), padPrefix, newval );
oldNames[newName] = { newval, pad->GetName() };
pad->SetName( newName );
pad->SetSelected();
@ -449,14 +448,10 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
else
newval = seqPadNum;
statusPopup.SetText( wxString::Format( _( "Click on pad %s%d\n"
"Press Escape to cancel or "
"double-click to commit" ),
padPrefix.c_str(),
newval ) );
statusPopup.SetText( wxString::Format( msg, padPrefix, newval ) );
}
// ..or restore the old name if it was enumerated and clicked again
// ... or restore the old name if it was enumerated and clicked again
else if( pad->IsSelected() && evt->IsClick( BUT_LEFT ) )
{
auto it = oldNames.find( pad->GetName() );
@ -468,11 +463,9 @@ int PAD_TOOL::EnumeratePads( const TOOL_EVENT& aEvent )
pad->SetName( it->second.second );
oldNames.erase( it );
statusPopup.SetText( wxString::Format( _( "Click on pad %s%d\n"
"Press Escape to cancel or "
"double-click to commit" ),
padPrefix.c_str(),
storedPadNumbers.front() ) );
int newval = storedPadNumbers.front();
statusPopup.SetText( wxString::Format( msg, padPrefix, newval ) );
}
pad->ClearSelected();

View File

@ -695,27 +695,34 @@ void ZONE_FILLER::computeRawFilledArea( const ZONE_CONTAINER* aZone,
if( s_DumpZonesWhenFilling )
dumper->Write( &solidAreas, "clearance holes" );
buildThermalSpokes( aZone, thermalSpokes );
// Create a temporary zone that we can hit-test spoke-ends against. It's only temporary
// because the "real" subtract-clearance-holes has to be done after the spokes are added.
static const bool USE_BBOX_CACHES = true;
SHAPE_POLY_SET testAreas = solidAreas;
testAreas.BooleanSubtract( clearanceHoles, SHAPE_POLY_SET::PM_FAST );
// Remove areas that don't meet minimum-width criteria
testAreas.Inflate( -outline_half_thickness, numSegs, true );
testAreas.Inflate( outline_half_thickness, numSegs, true );
testAreas.BuildBBoxCaches();
static const bool USE_BBOX_CACHES = true;
buildThermalSpokes( aZone, thermalSpokes );
// Spoke-end-testing is hugely expensive so we generate cached bounding-boxes to speed
// things up a bit.
testAreas.BuildBBoxCaches();
for( const SHAPE_LINE_CHAIN& spoke : thermalSpokes )
{
const VECTOR2I& testPt = spoke.CPoint( 3 );
// Hit-test against zone body
if( testAreas.Contains( testPt, -1, false, true, USE_BBOX_CACHES ) )
{
solidAreas.AddOutline( spoke );
continue;
}
// Hit-test against other spokes
for( const SHAPE_LINE_CHAIN& other : thermalSpokes )
{
if( &other != &spoke && other.PointInside( testPt, 1, USE_BBOX_CACHES ) )