26#include <fmt/format.h>
51 m_selectionTool( nullptr ),
52 m_moveInProgress( false ),
55 m_pickerItem( nullptr )
62 m_frame = getEditFrame<PL_EDITOR_FRAME>();
65 wxASSERT_MSG(
m_selectionTool,
"plEditor.InteractiveSelection tool is not available" );
98 m_frame = getEditFrame<PL_EDITOR_FRAME>();
111 bool unselect = selection.
IsHover();
116 std::set<DS_DATA_ITEM*> unique_peers;
121 unique_peers.insert( drawItem->
GetPeer() );
131 bool restore_state =
false;
132 bool chain_commands =
false;
143 catch(
const fmt::v10::format_error& exc )
145 wxLogWarning( wxS(
"Exception \"%s\" serializing string ocurred." ),
183 else if( selection.
Size() == 1 )
239 restore_state =
true;
268 restore_state =
true;
270 chain_commands =
true;
294 }
while( ( evt =
Wait() ) );
300 if( !chain_commands )
306 item->ClearEditFlags();
342 if( aSelection.
Size() == 1 )
372 if( selection.
Size() == 0 )
385 while( selection.
Front() )
395 if( item->IsSelected() )
410#define HITTEST_THRESHOLD_PIXELS 5
424 [
this] (
const VECTOR2D& aPosition ) ->
bool
448 if( drawItem->HitTest( aPos, threshold ) )
471 [
this] (
const int& aFinalState )
502 int retVal =
Copy( aEvent );
514 std::vector<DS_DATA_ITEM*> items;
530 wxMessageBox( ioe.
What(),
_(
"Error writing objects to clipboard" ) );
548 model.
SetPageLayout( sexpr.c_str(),
true, wxT(
"clipboard" ) );
553 if( dataItem->GetDrawItems().empty() )
555 dataItem->SyncDrawItems(
nullptr,
getView() );
556 dataItem->GetDrawItems().front()->SetSelected();
562 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 MoveToUi(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)
Round a floating point number to an integer using "round halfway cases away from zero".