27#include <fmt/format.h>
68 wxASSERT_MSG(
m_selectionTool,
"plEditor.InteractiveSelection tool is not available" );
114 bool unselect = selection.
IsHover();
119 std::set<DS_DATA_ITEM*> unique_peers;
124 unique_peers.insert( drawItem->
GetPeer() );
134 bool restore_state =
false;
135 bool chain_commands =
false;
146 catch(
const fmt::format_error& exc )
148 wxLogWarning( wxS(
"Exception \"%s\" serializing string ocurred." ),
186 else if( selection.
Size() == 1 )
226 m_frame->GetInfoBar()->Dismiss();
235 m_frame->ShowInfoBarMsg(
_(
"Press <ESC> to cancel move." ) );
242 restore_state =
true;
271 restore_state =
true;
273 chain_commands =
true;
297 }
while( ( evt =
Wait() ) );
303 if( !chain_commands )
309 item->ClearEditFlags();
345 if( aSelection.
Size() == 1 )
375 if( selection.
Size() == 0 )
388 while( selection.
Front() )
398 if( item->IsSelected() )
413#define HITTEST_THRESHOLD_PIXELS 5
427 [
this] (
const VECTOR2D& aPosition ) ->
bool
451 if( drawItem->HitTest( aPos, threshold ) )
474 [
this] (
const int& aFinalState )
491 m_frame->GetLayoutFromUndoList();
498 m_frame->GetLayoutFromRedoList();
505 int retVal =
Copy( aEvent );
517 std::vector<DS_DATA_ITEM*> items;
533 wxMessageBox( ioe.
What(),
_(
"Error writing objects to clipboard" ) );
550 auto image = std::make_unique<BITMAP_BASE>();
551 image->SetImage( *clipImg );
552 auto dataItem = std::make_unique<DS_DATA_ITEM_BITMAP>(
image.release() );
553 model.
Append( dataItem.release() );
560 model.
SetPageLayout( clipText.c_str(),
true, wxT(
"clipboard" ) );
566 if( dataItem->GetDrawItems().empty() )
568 dataItem->SyncDrawItems(
nullptr,
getView() );
569 dataItem->GetDrawItems().front()->SetSelected();
575 if( !selection.
Empty() )
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION cancelInteractive
static TOOL_ACTION pickerTool
static TOOL_ACTION selectionActivate
Activation of the selection tool.
static TOOL_ACTION duplicate
static TOOL_ACTION doDelete
static TOOL_ACTION deleteTool
static TOOL_ACTION selectionClear
Clear the current selection.
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()
Return the instance of DS_DATA_MODEL used in the application.
void Append(DS_DATA_ITEM *aItem)
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
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 appendImportedDrawingSheet
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
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
std::string GetClipboardUTF8()
Return the information currently stored in the system clipboard.
std::unique_ptr< wxImage > GetImageFromClipboard()
Get image data from the clipboard, if there is any.
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 HITTEST_THRESHOLD_PIXELS
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D