SELECTION_TOOL got a new mode to edit MODULEs.
This commit is contained in:
parent
d98a5c4efe
commit
7ade7db078
|
@ -916,7 +916,7 @@ EDA_COLOR_T FOOTPRINT_EDIT_FRAME::GetGridColor() const
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_NUM aLayer )
|
||||
void FOOTPRINT_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
|
||||
{
|
||||
PCB_BASE_FRAME::SetActiveLayer( aLayer );
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ public:
|
|||
virtual EDA_COLOR_T GetGridColor() const;
|
||||
|
||||
///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
|
||||
void SetActiveLayer( LAYER_NUM aLayer );
|
||||
void SetActiveLayer( LAYER_ID aLayer );
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
|
|
|
@ -271,6 +271,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
drawPanel->SetEventDispatcher( m_toolDispatcher );
|
||||
|
||||
m_toolManager->RegisterTool( new SELECTION_TOOL );
|
||||
m_toolManager->GetTool<SELECTION_TOOL>()->EditModules( true );
|
||||
m_toolManager->RegisterTool( new EDIT_TOOL );
|
||||
m_toolManager->RegisterTool( new DRAWING_TOOL );
|
||||
m_toolManager->RegisterTool( new POINT_EDITOR );
|
||||
|
|
|
@ -54,7 +54,7 @@ SELECTION_TOOL::SELECTION_TOOL() :
|
|||
SelectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.selected" ),
|
||||
DeselectedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.deselected" ),
|
||||
ClearedEvent( TC_MESSAGE, TA_ACTION, "pcbnew.InteractiveSelection.cleared" ),
|
||||
m_additive( false ), m_multiple( false )
|
||||
m_additive( false ), m_multiple( false ), m_editModules( false )
|
||||
{
|
||||
m_selArea = new SELECTION_AREA;
|
||||
m_selection.group = new KIGFX::VIEW_GROUP;
|
||||
|
@ -189,8 +189,12 @@ bool SELECTION_TOOL::SelectSingle( const VECTOR2I& aWhere, bool aAllowDisambigua
|
|||
GENERAL_COLLECTOR collector;
|
||||
const KICAD_T types[] = { PCB_TRACE_T, PCB_VIA_T, PCB_LINE_T, EOT }; // preferred types
|
||||
|
||||
collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::AllBoardItems,
|
||||
wxPoint( aWhere.x, aWhere.y ), guide );
|
||||
if( m_editModules )
|
||||
collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::ModulesAndTheirItems,
|
||||
wxPoint( aWhere.x, aWhere.y ), guide );
|
||||
else
|
||||
collector.Collect( getModel<BOARD>(), GENERAL_COLLECTOR::AllBoardItems,
|
||||
wxPoint( aWhere.x, aWhere.y ), guide );
|
||||
|
||||
switch( collector.GetCount() )
|
||||
{
|
||||
|
@ -532,23 +536,25 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const
|
|||
|
||||
case PCB_MODULE_T:
|
||||
if( aItem->IsOnLayer( F_Cu ) && board->IsElementVisible( MOD_FR_VISIBLE ) )
|
||||
return true;
|
||||
return !m_editModules;
|
||||
|
||||
if( aItem->IsOnLayer( B_Cu ) && board->IsElementVisible( MOD_BK_VISIBLE ) )
|
||||
return true;
|
||||
return !m_editModules;
|
||||
|
||||
return false;
|
||||
|
||||
break;
|
||||
|
||||
case PCB_MODULE_TEXT_T:
|
||||
if( m_multiple )
|
||||
if( m_multiple && !m_editModules )
|
||||
return false;
|
||||
break;
|
||||
|
||||
// These are not selectable
|
||||
case PCB_MODULE_EDGE_T:
|
||||
case PCB_PAD_T:
|
||||
return m_editModules;
|
||||
|
||||
case NOT_USED:
|
||||
case TYPE_NOT_INIT:
|
||||
return false;
|
||||
|
|
|
@ -139,6 +139,17 @@ public:
|
|||
*/
|
||||
void AddMenuItem( const TOOL_ACTION& aAction );
|
||||
|
||||
/**
|
||||
* Function EditModules()
|
||||
* Toggles edit module mode. When enabled, one may select parts of modules individually
|
||||
* (graphics, pads, etc.), so they can be modified.
|
||||
* @param aEnabled decides if the mode should be enabled.
|
||||
*/
|
||||
void EditModules( bool aEnabled )
|
||||
{
|
||||
m_editModules = aEnabled;
|
||||
}
|
||||
|
||||
///> Event sent after an item is selected.
|
||||
const TOOL_EVENT SelectedEvent;
|
||||
|
||||
|
@ -260,6 +271,9 @@ private:
|
|||
|
||||
/// Right click popup menu
|
||||
CONTEXT_MENU m_menu;
|
||||
|
||||
/// Edit module mode flag
|
||||
bool m_editModules;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue