27#include <fmt/format.h>
53 m_selectionTool( nullptr ),
54 m_moveInProgress( false ),
57 m_pickerItem( nullptr )
64 m_frame = getEditFrame<PL_EDITOR_FRAME>();
67 wxASSERT_MSG(
m_selectionTool,
"plEditor.InteractiveSelection tool is not available" );
100 m_frame = getEditFrame<PL_EDITOR_FRAME>();
113 bool unselect = selection.
IsHover();
118 std::set<DS_DATA_ITEM*> unique_peers;
123 unique_peers.insert( drawItem->
GetPeer() );
133 bool restore_state =
false;
134 bool chain_commands =
false;
145 catch(
const fmt::v10::format_error& exc )
147 wxLogWarning( wxS(
"Exception \"%s\" serializing string ocurred." ),
185 else if( selection.
Size() == 1 )
241 restore_state =
true;
270 restore_state =
true;
272 chain_commands =
true;
296 }
while( ( evt =
Wait() ) );
302 if( !chain_commands )
308 item->ClearEditFlags();
344 if( aSelection.
Size() == 1 )
374 if( selection.
Size() == 0 )
387 while( selection.
Front() )
397 if( item->IsSelected() )
412#define HITTEST_THRESHOLD_PIXELS 5
426 [
this] (
const VECTOR2D& aPosition ) ->
bool
450 if( drawItem->HitTest( aPos, threshold ) )
473 [
this] (
const int& aFinalState )
504 int retVal =
Copy( aEvent );
516 std::vector<DS_DATA_ITEM*> items;
532 wxMessageBox( ioe.
What(),
_(
"Error writing objects to clipboard" ) );
550 model.
SetPageLayout( sexpr.c_str(),
true, wxT(
"clipboard" ) );
555 if( dataItem->GetDrawItems().empty() )
557 dataItem->SyncDrawItems(
nullptr,
getView() );
558 dataItem->GetDrawItems().front()->SetSelected();
564 if( !selection.
Empty() )
static TOOL_ACTION cancelInteractive
static TOOL_ACTION pickerTool
static TOOL_ACTION duplicate
static TOOL_ACTION doDelete
static TOOL_ACTION deleteTool
static TOOL_ACTION refreshPreview
Drawing sheet structure type definitions.
void MoveToIU(const VECTOR2I &aPosition)
Move item to a new position.
const VECTOR2I GetStartPosIU(int ii=0) const
const std::vector< DS_DRAW_ITEM_BASE * > & GetDrawItems() const
Handle the graphic items list to draw/plot the frame and title block.
static DS_DATA_MODEL & GetTheInstance()
static function: returns the instance of DS_DATA_MODEL used in the application
void SaveInString(wxString *aOutputString)
Save the description in a buffer.
void Remove(DS_DATA_ITEM *aItem)
std::vector< DS_DATA_ITEM * > & GetItems()
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.
Base class to handle basic graphic items.
DS_DATA_ITEM * GetPeer() const
void ShowInfoBarMsg(const wxString &aMsg, bool aShowCloseButton=false)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an info icon on the left of...
WX_INFOBAR * GetInfoBar()
void AddStandardSubMenus(TOOL_MENU &aMenu)
Construct a "basic" menu for a tool, containing only items that apply to all tools (e....
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
EDA_ITEM_FLAGS GetFlags() const
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
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 void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
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...
static TOOL_ACTION clearSelection
Clear the current selection.
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION appendImportedDrawingSheet
void OnModify() override
Must be called after a change in order to set the "modify" flag.
void Files_io(wxCommandEvent &event)
void GetLayoutFromRedoList()
Redo the last edit:
void GetLayoutFromUndoList()
Undo the last edit:
void RollbackFromUndo()
Apply the last command in Undo List without stacking a Redo.
void SaveCopyInUndoList()
Save a copy of the description (in a S expr string) for Undo/redo commands.
PL_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
EDA_ITEM * GetTopLeftItem(bool onlyModules=false) const override
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
const std::deque< EDA_ITEM * > GetItems() const
VECTOR2I GetReferencePoint() const
virtual unsigned int GetSize() const override
Return the number of stored items.
int Size() const
Returns the number of selected parts.
void ClearReferencePoint()
void SetReferencePoint(const VECTOR2I &aP)
bool Empty() const
Checks if there is anything selected.
bool HasReferencePoint() const
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
This file is part of the common library.
#define IS_NEW
New item, just created.
#define IS_MOVING
Item being moved.
This file contains miscellaneous commonly used macros and functions.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
constexpr ret_type KiROUND(fp_type v, bool aQuiet=false)
Round a floating point number to an integer using "round halfway cases away from zero".