46 m_selectionTool( nullptr ),
47 m_moveInProgress( false ),
50 m_pickerItem( nullptr )
57 m_frame = getEditFrame<PL_EDITOR_FRAME>();
60 wxASSERT_MSG(
m_selectionTool,
"plEditor.InteractiveSelection tool is not available" );
93 m_frame = getEditFrame<PL_EDITOR_FRAME>();
106 bool unselect = selection.
IsHover();
111 std::set<DS_DATA_ITEM*> unique_peers;
116 unique_peers.insert( drawItem->
GetPeer() );
126 bool restore_state =
false;
127 bool chain_commands =
false;
128 TOOL_EVENT* evt = const_cast<TOOL_EVENT*>( &aEvent );
131 if( !selection.Front()->IsNew() )
156 if( selection.HasReferencePoint() )
164 selection.SetReferencePoint(
m_cursor );
166 else if( selection.Size() == 1 )
190 selection.SetReferencePoint(
m_cursor );
208 restore_state =
true;
246 }
while( ( evt =
Wait() ) );
252 if( !chain_commands )
255 selection.ClearReferencePoint();
257 for(
auto item : selection )
258 item->ClearEditFlags();
292 if( aSelection.
Size() == 1 )
322 if( selection.
Size() == 0 )
327 while( selection.
Front() )
337 if( item->IsSelected() )
352 #define HITTEST_THRESHOLD_PIXELS 5 367 [
this] (
const VECTOR2D& aPosition ) ->
bool 391 if( drawItem->HitTest( (wxPoint) aPos, threshold ) )
414 [
this] (
const int& aFinalState )
445 int retVal =
Copy( aEvent );
457 std::vector<DS_DATA_ITEM*> items;
465 items.push_back( static_cast<DS_DRAW_ITEM_BASE*>( item )->GetPeer() );
473 wxMessageBox( ioe.
What(),
_(
"Error writing objects to clipboard" ) );
491 model.
SetPageLayout( sexpr.c_str(),
true, wxT(
"clipboard" ) );
496 if( dataItem->GetDrawItems().empty() )
498 dataItem->SyncDrawItems(
nullptr,
getView() );
499 dataItem->GetDrawItems().front()->SetSelected();
505 if( !selection.
Empty() )
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
Handle the graphic items list to draw/plot the frame and title block.
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
This file is part of the common library.
static TOOL_ACTION doDelete
static TOOL_ACTION cancelInteractive
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
void GetLayoutFromRedoList()
Redo the last edit:
std::vector< DS_DATA_ITEM * > & GetItems()
virtual void SetCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true, bool aTriggeredByArrows=false, long aArrowCommand=0)=0
Move cursor to the requested position expressed in world coordinates.
virtual wxPoint GetPosition() const
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
void SetCurrentCursor(KICURSOR cursor)
Set the current cursor shape for this panel.
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static TOOL_ACTION pickerTool
void OnModify()
Must be called after a change in order to set the "modify" flag.
Base class to handle basic graphic items.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
void SetReferencePoint(const VECTOR2I &aP)
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
virtual const wxString What() const
A composite of Problem() and Where()
const std::deque< EDA_ITEM * > GetItems() const
An interface for classes handling user events controlling the view behavior such as zooming,...
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems() const
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
#define IS_MOVED
Item being moved.
void SaveInString(wxString &aOutputString)
Save the description in a buffer.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
bool Empty() const
Checks if there is anything selected.
static TOOL_ACTION clearSelection
Clear the current selection.
virtual unsigned int GetSize() const override
Return the number of stored items.
void SetPageLayout(const char *aPageLayout, bool aAppend=false, const wxString &aSource=wxT("Sexpr_string"))
Populate the list from a S expr description stored in a string.
DS_DATA_ITEM * GetPeer() const
bool HasReferencePoint() const
Drawing sheet structure type definitions.
int Size() const
Returns the number of selected parts.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
A base class for most all the KiCad significant classes used in schematics and boards.
static TOOL_ACTION appendImportedWorksheet
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
void MoveToUi(wxPoint aPosition)
Move item to a new position.
static TOOL_ACTION deleteTool
void Remove(DS_DATA_ITEM *aItem)
void RollbackFromUndo()
Apply the last command in Undo List without stacking a Redo.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
void GetLayoutFromUndoList()
Undo the last edit:
static TOOL_ACTION refreshPreview
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
const wxPoint GetStartPosUi(int ii=0) const
void Files_io(wxCommandEvent &event)