Moved highlighted flag from VIEW_ITEM to EDA_ITEM. Added brightened and selected flag to EDA_ITEM.

This commit is contained in:
Maciej Suminski 2013-08-06 09:31:08 +02:00
parent 8753bef2fa
commit f193e389ec
7 changed files with 212 additions and 226 deletions

View File

@ -136,10 +136,3 @@ bool VIEW_ITEM::storesGroups() const
{
return ( m_groupsSize > 0 );
}
void VIEW_ITEM::ViewSetHighlighted( bool aIsHighlighted )
{
m_highlighted = aIsHighlighted;
ViewUpdate( APPEARANCE | GEOMETRY );
}

View File

@ -387,6 +387,9 @@ public:
#define END_ONPAD (1 << 23) ///< Pcbnew: flag set for track segment ending on a pad
#define BUSY (1 << 24) ///< Pcbnew: flag indicating that the structure has
///< already been edited, in some functions
#define HIGHLIGHTED (1 << 25) ///< item is drawn in normal colors, when the rest is darkened
#define BRIGHTENED (1 << 26) ///< item is drawn with a bright contour
#define EDA_ITEM_ALL_FLAGS -1
typedef unsigned STATUS_FLAGS;
@ -466,6 +469,16 @@ public:
inline bool IsDragging() const { return m_Flags & IS_DRAGGED; }
inline bool IsSelected() const { return m_Flags & SELECTED; }
inline bool IsResized() const { return m_Flags & IS_RESIZED; }
inline bool IsHighlighted() const { return m_Flags & HIGHLIGHTED; }
inline bool IsBrightened() const { return m_Flags & BRIGHTENED; }
inline void SetBrightened() { SetFlags( BRIGHTENED ); ViewUpdate( APPEARANCE ); }
inline void SetSelected() { SetFlags( SELECTED ); ViewUpdate( APPEARANCE ); }
inline void SetHighlighted() { SetFlags( HIGHLIGHTED ); ViewUpdate( APPEARANCE | GEOMETRY ); }
inline void ClearSelected() { ClearFlags( SELECTED ); ViewUpdate( APPEARANCE ); }
inline void ClearHighlighted() { ClearFlags( HIGHLIGHTED ); ViewUpdate( APPEARANCE ); }
inline void ClearBrightened() { ClearFlags( BRIGHTENED ); ViewUpdate( APPEARANCE | GEOMETRY ); }
void SetModified();

View File

@ -75,12 +75,12 @@ public:
#endif /* WX_COMPATIBLITY */
/**
* Function Highlight
* Function Brighten
* Makes the color brighter by a given factor.
* @param aFactor Specifies how bright the color should become (valid values: 0.0 .. 1.0).
* @return COLOR4D& Brightened color.
*/
COLOR4D& Highlight( double aFactor )
COLOR4D& Brighten( double aFactor )
{
r = r * ( 1.0 - aFactor ) + aFactor;
g = g * ( 1.0 - aFactor ) + aFactor;
@ -119,12 +119,12 @@ public:
}
/**
* Function Highlighted
* Function Brightened
* Returns a color that is brighter by a given factor, without modifying object.
* @param aFactor Specifies how bright the color should become (valid values: 0.0 .. 1.0).
* @return COLOR4D Highlightedd color.
*/
COLOR4D Highlighted( double aFactor ) const
COLOR4D Brightened( double aFactor ) const
{
return COLOR4D( r * ( 1.0 - aFactor ) + aFactor,
g * ( 1.0 - aFactor ) + aFactor,

View File

@ -67,8 +67,7 @@ public:
ALL = 0xff
};
VIEW_ITEM() : m_view( NULL ), m_visible( true ), m_highlighted( false ),
m_groups( NULL ), m_groupsSize( 0 ) {}
VIEW_ITEM() : m_view( NULL ), m_visible( true ), m_groups( NULL ), m_groupsSize( 0 ) {}
/**
* Destructor. For dynamic views, removes the item from the view.
@ -135,25 +134,6 @@ public:
return m_visible;
}
/**
* Function ViewSetHighlighted()
* Sets the item highlight.
*
* @param aIsHighlighted: whether the item is highlighted (on all layers), or not.
*/
void ViewSetHighlighted( bool aIsHighlighted = true );
/**
* Function ViewIsHighlighted()
* Returns if the item is highlighted (or not).
*
* @return when true, the item should be displayed as highlighted.
*/
bool ViewIsHighlighted() const
{
return m_highlighted;
}
/**
* Function ViewGetLOD()
* Returns the level of detail of the item. A level of detail is the minimal VIEW scale that
@ -191,7 +171,6 @@ protected:
*
* @param aView[]: dynamic VIEW instance the item is being added to.
*/
void viewAssign( VIEW* aView )
{
// release the item from a previously assigned dynamic view (if there is any)
@ -202,7 +181,6 @@ protected:
VIEW* m_view; ///* Current dynamic view the item is assigned to.
bool m_visible; ///* Are we visible in the current dynamic VIEW.
bool m_highlighted; ///* Should item be drawn as highlighted
private:
///* Helper for storing cached items group ids

View File

@ -143,17 +143,17 @@ void PCB_RENDER_SETTINGS::Update()
for( int i = 0; i < NB_LAYERS; i++ )
{
m_layerColors[i].a = m_layerOpacity;
m_layerColorsHi[i] = m_layerColors[i].Highlighted( m_highlightFactor );
m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );
m_layerColorsSel[i] = m_layerColors[i].Highlighted( m_selectFactor );
m_layerColorsSel[i] = m_layerColors[i].Brightened( m_selectFactor );
}
for( int i = 0; i < END_PCB_VISIBLE_LIST; i++ )
{
m_itemColors[i].a = m_layerOpacity;
m_itemColorsHi[i] = m_itemColors[i].Highlighted( m_highlightFactor );
m_itemColorsHi[i] = m_itemColors[i].Brightened( m_highlightFactor );
m_itemColorsDark[i] = m_itemColors[i].Darkened( 1.0 - m_highlightFactor );
m_itemColorsSel[i] = m_itemColors[i].Highlighted( m_selectFactor );
m_itemColorsSel[i] = m_itemColors[i].Brightened( m_selectFactor );
}
m_hiContrastColor = COLOR4D( m_hiContrastFactor, m_hiContrastFactor, m_hiContrastFactor,
@ -176,22 +176,23 @@ const COLOR4D& PCB_PAINTER::GetColor( const VIEW_ITEM* aItem, int aLayer )
if( item )
netCode = item->GetNet();
return getLayerColor( aLayer, netCode, aItem->ViewIsHighlighted() );
return getLayerColor( aLayer, netCode,
static_cast<const BOARD_ITEM*>( aItem )->IsSelected() );
}
const COLOR4D& PCB_PAINTER::getLayerColor( int aLayer, int aNetCode, bool aHighlighted ) const
const COLOR4D& PCB_PAINTER::getLayerColor( int aLayer, int aNetCode, bool aSelected ) const
{
// Return grayish color for non-highlightezd layers in the high contrast mode
// Return grayish color for non-highlighted layers in the high contrast mode
if( m_pcbSettings->m_hiContrastEnabled && m_pcbSettings->m_activeLayers.count( aLayer ) == 0 )
return m_pcbSettings->m_hiContrastColor;
// For item layers (vias, texts, and so on)
if( aLayer >= NB_LAYERS )
return getItemColor( aLayer - NB_LAYERS, aNetCode, aHighlighted );
return getItemColor( aLayer - NB_LAYERS, aNetCode, aSelected );
// Highlight per item basis
if( aHighlighted )
if( aSelected )
return m_pcbSettings->m_layerColorsHi[aLayer];
// Single net highlight mode
@ -208,10 +209,10 @@ const COLOR4D& PCB_PAINTER::getLayerColor( int aLayer, int aNetCode, bool aHighl
}
const COLOR4D& PCB_PAINTER::getItemColor( int aItemType, int aNetCode, bool aHighlighted ) const
const COLOR4D& PCB_PAINTER::getItemColor( int aItemType, int aNetCode, bool aSelected ) const
{
// Highlight per item basis
if( aHighlighted )
if( aSelected )
return m_pcbSettings->m_itemColorsHi[aItemType];
if( m_pcbSettings->m_highlightEnabled )
@ -308,8 +309,8 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
// Set a proper color for the label
color = getLayerColor( aTrack->GetLayer(), aTrack->GetNet(),
aTrack->ViewIsHighlighted() );
COLOR4D labelColor = getLayerColor( aLayer, 0, aTrack->ViewIsHighlighted() );
aTrack->IsSelected() );
COLOR4D labelColor = getLayerColor( aLayer, 0, aTrack->IsSelected() );
if( color.GetBrightness() > 0.5 )
m_gal->SetStrokeColor( labelColor.Inverted() );
@ -329,7 +330,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
else if( IsCopperLayer( aLayer ))
{
// Draw a regular track
color = getLayerColor( aLayer, netNumber, aTrack->ViewIsHighlighted() );
color = getLayerColor( aLayer, netNumber, aTrack->IsSelected() );
m_gal->SetStrokeColor( color );
m_gal->SetIsStroke( true );
@ -368,7 +369,7 @@ void PCB_PAINTER::draw( const SEGVIA* aVia, int aLayer )
else
return;
color = getLayerColor( aLayer, aVia->GetNet(), aVia->ViewIsHighlighted() );
color = getLayerColor( aLayer, aVia->GetNet(), aVia->IsSelected() );
if( m_pcbSettings->m_sketchModeSelect[VIAS_VISIBLE] )
{
@ -448,8 +449,8 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// Set a proper color for the label
color = getLayerColor( aPad->GetParent()->GetLayer(), aPad->GetNet(),
aPad->ViewIsHighlighted() );
COLOR4D labelColor = getLayerColor( aLayer, 0, aPad->ViewIsHighlighted() );
aPad->IsSelected() );
COLOR4D labelColor = getLayerColor( aLayer, 0, aPad->IsSelected() );
if( color.GetBrightness() > 0.5 )
m_gal->SetStrokeColor( labelColor.Inverted() );
@ -494,7 +495,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
return;
}
color = getLayerColor( aLayer, aPad->GetNet(), aPad->ViewIsHighlighted() );
color = getLayerColor( aLayer, aPad->GetNet(), aPad->IsSelected() );
if( m_pcbSettings->m_sketchModeSelect[PADS_VISIBLE] )
{
// Outline mode
@ -617,7 +618,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment )
{
COLOR4D color = getLayerColor( aSegment->GetLayer(), 0, aSegment->ViewIsHighlighted() );
COLOR4D color = getLayerColor( aSegment->GetLayer(), 0, aSegment->IsSelected() );
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
@ -691,7 +692,7 @@ void PCB_PAINTER::draw( const TEXTE_PCB* aText )
if( aText->GetText().Length() == 0 )
return;
COLOR4D strokeColor = getLayerColor( aText->GetLayer(), 0, aText->ViewIsHighlighted() );
COLOR4D strokeColor = getLayerColor( aText->GetLayer(), 0, aText->IsSelected() );
VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y );
double orientation = aText->GetOrientation() * M_PI / 1800.0;
@ -707,13 +708,13 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
if( aText->GetLength() == 0 )
return;
COLOR4D strokeColor = getLayerColor( aLayer, 0, aText->ViewIsHighlighted() );
COLOR4D strokeColor = getLayerColor( aLayer, 0, aText->IsSelected() );
VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y);
double orientation = aText->GetDrawRotation() * M_PI / 1800.0;
m_gal->PushDepth();
if(aText->ViewIsHighlighted())
if(aText->IsSelected())
{
EDA_RECT bb (aText->GetBoundingBox());
VECTOR2D s (bb.GetOrigin());
@ -741,7 +742,7 @@ void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer )
void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
{
COLOR4D color = getLayerColor( aZone->GetLayer(), aZone->GetNet(),
aZone->ViewIsHighlighted() );
aZone->IsSelected() );
std::deque<VECTOR2D> corners;
PCB_RENDER_SETTINGS::DisplayZonesMode displayMode = m_pcbSettings->m_displayZoneMode;
@ -811,7 +812,7 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone )
void PCB_PAINTER::draw( const DIMENSION* aDimension )
{
COLOR4D strokeColor = getLayerColor( aDimension->GetLayer(), 0,
aDimension->ViewIsHighlighted() );
aDimension->IsSelected() );
m_gal->SetStrokeColor( strokeColor );
m_gal->SetIsFill( false );
@ -834,7 +835,7 @@ void PCB_PAINTER::draw( const DIMENSION* aDimension )
void PCB_PAINTER::draw( const PCB_TARGET* aTarget )
{
COLOR4D strokeColor = getLayerColor( aTarget->GetLayer(), 0, aTarget->ViewIsHighlighted() );
COLOR4D strokeColor = getLayerColor( aTarget->GetLayer(), 0, aTarget->IsSelected() );
VECTOR2D position( aTarget->GetPosition() );
double size, radius;

View File

@ -41,99 +41,104 @@
using namespace KiGfx;
using boost::optional;
SELECTION_TOOL::SELECTION_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" )
{
m_selArea = new SELECTION_AREA;
}
TOOL_INTERACTIVE( "pcbnew.InteractiveSelection" )
{
m_selArea = new SELECTION_AREA;
}
SELECTION_TOOL::~SELECTION_TOOL()
{
if(m_selArea)
delete m_selArea;
if( m_selArea )
delete m_selArea;
}
void SELECTION_TOOL::Reset()
{
// the tool launches upon reception of activate ("pcbnew.InteractiveSelection")
Go(&SELECTION_TOOL::Main, TOOL_EVENT(TC_Command, TA_ActivateTool, GetName())); //"pcbnew.InteractiveSelection"));
// the tool launches upon reception of activate ("pcbnew.InteractiveSelection")
Go( &SELECTION_TOOL::Main, TOOL_EVENT( TC_Command, TA_ActivateTool, GetName() ) ); //"pcbnew.InteractiveSelection"));
}
int SELECTION_TOOL::Main(TOOL_EVENT& aEvent)
int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
{
// Main loop: keep receiving events
while(OPT_TOOL_EVENT evt = Wait ())
{
if(evt->IsCancel ())
return 0;
// single click? Select single object
if( evt->IsClick (MB_Left) )
selectSingle(evt->Position(), evt->Modifier( MB_ModShift ));
// drag with LMB? Select multiple objects (or at least draw a selection box)
if (evt->IsDrag ( MB_Left ))
selectMultiple();
}
return 0;
}
void SELECTION_TOOL::toggleSelection ( BOARD_ITEM * aItem, bool aAdditive )
{
if(m_selectedItems.find(aItem) != m_selectedItems.end())
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
aItem->ViewSetHighlighted(false);
m_selectedItems.erase(aItem);
} else {
if(!aAdditive)
clearSelection();
aItem->ViewSetHighlighted(true);
m_selectedItems.insert(aItem);
if( evt->IsCancel() )
return 0;
// single click? Select single object
if( evt->IsClick( MB_Left ) )
selectSingle( evt->Position(), evt->Modifier( MB_ModShift ) );
// drag with LMB? Select multiple objects (or at least draw a selection box)
if( evt->IsDrag( MB_Left ) )
selectMultiple();
}
return 0;
}
void SELECTION_TOOL::toggleSelection( BOARD_ITEM* aItem, bool aAdditive )
{
if( m_selectedItems.find( aItem ) != m_selectedItems.end() )
{
aItem->ClearSelected();
m_selectedItems.erase( aItem );
} else
{
if( !aAdditive )
clearSelection();
aItem->SetSelected();
m_selectedItems.insert( aItem );
}
}
void SELECTION_TOOL::clearSelection ()
{
BOOST_FOREACH(BOARD_ITEM *item, m_selectedItems)
{
item->ViewSetHighlighted(false);
}
m_selectedItems.clear();
void SELECTION_TOOL::clearSelection()
{
BOOST_FOREACH(BOARD_ITEM* item, m_selectedItems)
{
item->ClearSelected();
}
m_selectedItems.clear();
}
void SELECTION_TOOL::selectSingle( const VECTOR2I &aWhere, bool aAdditive )
{
BOARD *pcb = getModel<BOARD> (PCB_T);
BOARD_ITEM *item;
BOARD *pcb = getModel<BOARD>( PCB_T );
BOARD_ITEM *item;
GENERAL_COLLECTORS_GUIDE guide = getEditFrame<PCB_EDIT_FRAME>()->GetCollectorsGuide();
GENERAL_COLLECTOR collector;
collector.Collect(pcb, GENERAL_COLLECTOR::AllBoardItems , wxPoint(aWhere.x, aWhere.y), guide);
collector.Collect( pcb, GENERAL_COLLECTOR::AllBoardItems, wxPoint( aWhere.x, aWhere.y ),
guide );
switch (collector.GetCount())
{
case 0:
if(!aAdditive)
clearSelection();
break;
case 1:
toggleSelection( collector[0], aAdditive );
break;
default:
item = disambiguationMenu(&collector);
if(item)
toggleSelection(item, aAdditive );
break;
case 0:
if( !aAdditive )
clearSelection();
break;
case 1:
toggleSelection( collector[0], aAdditive );
break;
default:
item = disambiguationMenu( &collector );
if( item )
toggleSelection( item, aAdditive );
break;
}
}
@ -141,27 +146,27 @@ void SELECTION_TOOL::selectSingle( const VECTOR2I &aWhere, bool aAdditive )
BOARD_ITEM* SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector )
{
int count = aCollector->GetPrimaryCount(); // try to use preferred layer
if( 0 == count ) count = aCollector->GetCount();
if( 0 == count )
count = aCollector->GetCount();
for( int i = 0; i<count; ++i )
for( int i = 0; i < count; ++i )
{
if( (*aCollector)[i]->Type() != PCB_MODULE_T )
if( ( *aCollector )[i]->Type() != PCB_MODULE_T )
return NULL;
}
// all are modules, now find smallest MODULE
// All are modules, now find smallest MODULE
int minDim = 0x7FFFFFFF;
int minNdx = 0;
for( int i = 0; i<count; ++i )
for( int i = 0; i < count; ++i )
{
MODULE* module = (MODULE*) (*aCollector)[i];
MODULE* module = (MODULE*) ( *aCollector )[i];
int lx = module->GetBoundingBox().GetWidth();
int ly = module->GetBoundingBox().GetHeight();
int lx = module->GetBoundingBox().GetWidth();
int ly = module->GetBoundingBox().GetHeight();
int lmin = std::min( lx, ly );
int lmin = std::min( lx, ly );
if( lmin < minDim )
{
@ -170,107 +175,103 @@ BOARD_ITEM* SELECTION_TOOL::pickSmallestComponent( GENERAL_COLLECTOR* aCollector
}
}
return (*aCollector)[minNdx];
return ( *aCollector )[minNdx];
}
void SELECTION_TOOL::handleHighlight( const VECTOR2D& aP )
{
}
void SELECTION_TOOL::selectMultiple()
{
OPT_TOOL_EVENT evt;
VIEW *v = getView();
OPT_TOOL_EVENT evt;
VIEW *v = getView();
v->Add(m_selArea);
v->Add( m_selArea );
while (evt = Wait())
{
if(evt->IsCancel())
break;
while( evt = Wait() )
{
if( evt->IsCancel() )
break;
if(evt->IsDrag( MB_Left ))
{
m_selArea->SetOrigin( evt->DragOrigin() );
m_selArea->SetEnd( evt->Position() );
m_selArea->ViewSetVisible(true);
m_selArea->ViewUpdate(VIEW_ITEM::APPEARANCE | VIEW_ITEM::GEOMETRY);
v->SetLayerVisible( SELECTION_AREA::SelectionLayer );
v->SetLayerOrder( SELECTION_AREA::SelectionLayer, 1000);
v->SetLayerTarget( SELECTION_AREA::SelectionLayer, TARGET_OVERLAY );
}
if( evt->IsDrag( MB_Left ) )
{
m_selArea->SetOrigin( evt->DragOrigin() );
m_selArea->SetEnd( evt->Position() );
m_selArea->ViewSetVisible( true );
m_selArea->ViewUpdate( VIEW_ITEM::APPEARANCE | VIEW_ITEM::GEOMETRY );
if(evt->IsMouseUp( MB_Left ))
{
m_selArea->ViewSetVisible(false);
break;
}
}
v->SetLayerVisible( SELECTION_AREA::SelectionLayer );
v->SetLayerOrder( SELECTION_AREA::SelectionLayer, 1000 );
v->SetLayerTarget( SELECTION_AREA::SelectionLayer, TARGET_OVERLAY );
}
if( evt->IsMouseUp( MB_Left ) )
{
m_selArea->ViewSetVisible( false );
break;
}
}
v->Remove(m_selArea);
v->Remove( m_selArea );
}
BOARD_ITEM *SELECTION_TOOL::disambiguationMenu ( GENERAL_COLLECTOR *aCollector )
BOARD_ITEM *SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR *aCollector )
{
CONTEXT_MENU cmenu;
OPT_TOOL_EVENT evt ;
BOARD_ITEM *current = NULL;
CONTEXT_MENU cmenu;
OPT_TOOL_EVENT evt;
BOARD_ITEM *current = NULL;
cmenu.SetTitle( _("Clarify selection"));
cmenu.SetTitle( _( "Clarify selection" ) );
int limit = std::min( 10, aCollector->GetCount() );
int limit = std::min( 10, aCollector->GetCount() );
for( int i = 0; i<limit; ++i )
{
wxString text;
BOARD_ITEM *item = (*aCollector) [i];
text = item->GetSelectMenuText();
cmenu.Add(text, i);
}
SetContextMenu(&cmenu, CMENU_NOW);
for( int i = 0; i < limit; ++i )
{
wxString text;
BOARD_ITEM *item = ( *aCollector )[i];
text = item->GetSelectMenuText();
cmenu.Add( text, i );
}
while (evt = Wait())
{
if(evt->Action() == TA_ContextMenuUpdate )
{
if(current)
current->ViewSetHighlighted(false);
int id = *evt->GetCommandId();
if(id >= 0)
{
current = (*aCollector) [id];
current->ViewSetHighlighted(true);
} else
current = NULL;
SetContextMenu( &cmenu, CMENU_NOW );
} else if(evt->Action() == TA_ContextMenuChoice ) {
while( evt = Wait() )
{
if( evt->Action() == TA_ContextMenuUpdate )
{
if( current )
current->ClearSelected();
optional<int> id = evt->GetCommandId();
int id = *evt->GetCommandId();
if( id >= 0 )
{
current = ( *aCollector )[id];
current->SetSelected();
} else
current = NULL;
if(current)
current->ViewSetHighlighted(false);
} else if( evt->Action() == TA_ContextMenuChoice )
{
if(id && (*id >= 0))
{
current = (*aCollector) [*id];
current->ViewSetHighlighted(true);
return current;
}
return NULL;
}
optional<int> id = evt->GetCommandId();
}
if( current )
current->ClearSelected();
return NULL;
}
if( id && ( *id >= 0 ) )
{
current = ( *aCollector )[*id];
current->SetSelected();
return current;
}
return NULL;
}
}
return NULL;
}

View File

@ -36,7 +36,7 @@ class GENERAL_COLLECTOR;
/**
* Class SELECTION_AREA
* Class SELECTION_TOOL
*
* Our sample selection tool: currently supports:
* - pick single objects (click LMB)
@ -48,24 +48,24 @@ class GENERAL_COLLECTOR;
class SELECTION_TOOL : public TOOL_INTERACTIVE
{
public:
SELECTION_TOOL ();
~SELECTION_TOOL ();
public:
SELECTION_TOOL ();
~SELECTION_TOOL ();
void Reset();
int Main(TOOL_EVENT& aEvent);
void Reset();
int Main(TOOL_EVENT& aEvent);
private:
void selectSingle( const VECTOR2I &aWhere, bool aAdditive );
void selectMultiple ();
void handleHighlight( const VECTOR2D& aP );
BOARD_ITEM* disambiguationMenu ( GENERAL_COLLECTOR* aItems );
BOARD_ITEM* pickSmallestComponent( GENERAL_COLLECTOR* aCollector );
void toggleSelection ( BOARD_ITEM * aItem, bool aAdditive );
void clearSelection ();
std::set<BOARD_ITEM *> m_selectedItems;
SELECTION_AREA *m_selArea;
private:
void selectSingle( const VECTOR2I &aWhere, bool aAdditive );
void selectMultiple ();
void handleHighlight( const VECTOR2D& aP );
BOARD_ITEM* disambiguationMenu ( GENERAL_COLLECTOR* aItems );
BOARD_ITEM* pickSmallestComponent( GENERAL_COLLECTOR* aCollector );
void toggleSelection ( BOARD_ITEM * aItem, bool aAdditive );
void clearSelection ();
std::set<BOARD_ITEM*> m_selectedItems;
SELECTION_AREA* m_selArea;
};
#endif