26#include <wx/clipbrd.h>
45 auto activeToolCondition =
79 bool do_reload_board =
true;
83 if(
frame()->Get3DViewerFrame() ==
nullptr )
84 do_reload_board =
false;
103template<
class T>
void Flip(
T& aValue )
158 for(
PAD*
pad : fp->Pads() )
175 for(
PAD*
pad : fp->Pads() )
192 for(
BOARD_ITEM* item : fp->GraphicalItems() )
222 for(
PCB_FIELD* field : fp->GetFields() )
227 for(
BOARD_ITEM* item : fp->GraphicalItems() )
275 bool originSet =
false;
280 view.SetVisible( &ruler,
false );
291 view.SetVisible( &ruler,
false );
292 controls.SetAutoPan(
false );
293 controls.CaptureCursor(
false );
294 controls.ForceCursorPosition(
false );
300 controls.ShowCursor(
true );
301 controls.SetAutoPan(
false );
302 controls.CaptureCursor(
false );
303 controls.ForceCursorPosition(
false );
312 grid.SetUseGrid(
view.GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
313 VECTOR2I cursorPos = evt->HasPosition() ? evt->Position() : controls.GetMousePosition();
314 cursorPos =
grid.BestSnapAnchor( cursorPos,
nullptr );
315 controls.ForceCursorPosition(
true, cursorPos );
317 if( evt->IsCancelInteractive() )
325 view.SetVisible( &ruler,
false );
333 else if( evt->IsActivate() )
338 if( evt->IsMoveTool() )
350 else if( !originSet && ( evt->IsDrag(
BUT_LEFT ) || evt->IsClick(
BUT_LEFT ) ) )
353 twoPtMgr.
SetEnd( cursorPos );
355 controls.CaptureCursor(
true );
356 controls.SetAutoPan(
true );
361 else if( originSet && ( evt->IsClick(
BUT_LEFT ) || evt->IsMouseUp(
BUT_LEFT ) ) )
365 controls.SetAutoPan(
false );
366 controls.CaptureCursor(
false );
369 else if( originSet && ( evt->IsMotion() || evt->IsDrag(
BUT_LEFT ) ) )
387 twoPtMgr.
SetEnd( cursorPos );
389 view.SetVisible( &ruler,
true );
415 ruler.
UpdateDir( invertXAxis, invertYAxis );
426 wxString
text = wxJoin( cursorStrings,
'\n' );
428 if( wxTheClipboard->Open() )
430 wxTheClipboard->SetData(
new wxTextDataObject(
text ) );
431 wxTheClipboard->Close();
437 m_menu->ShowContextMenu();
445 view.SetVisible( &ruler,
false );
446 view.Remove( &ruler );
449 controls.SetAutoPan(
false );
450 controls.CaptureCursor(
false );
451 controls.ForceCursorPosition(
false );
constexpr EDA_IU_SCALE pcbIUScale
static TOOL_ACTION cancelInteractive
static TOOL_ACTION show3DViewer
static TOOL_ACTION updatePreferences
static TOOL_ACTION updateUnits
static TOOL_ACTION measureTool
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
virtual APP_SETTINGS_BASE * config() const
Return the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
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.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
A drawn ruler item for showing the distance between two points.
wxArrayString GetDimensionStrings() const
Get the strings for the dimensions of the ruler.
void SwitchUnits(EDA_UNITS aUnits)
Switch the ruler units.
void UpdateDir(bool aFlipX, bool aFlipY)
Represent a very simple geometry manager for items that have a start and end point.
void SetOrigin(const VECTOR2I &aOrigin)
< Set the origin of the ruler (the fixed end)
void SetAngleSnap(LEADER_MODE aSnap)
void SetEnd(const VECTOR2I &aEnd)
Set the current end of the rectangle (the end that moves with the cursor.
LEADER_MODE m_AngleSnapMode
static TOOL_ACTION toggleHV45Mode
static TOOL_ACTION padDisplayMode
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
static TOOL_ACTION fpAutoZoom
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION showPadNumbers
virtual PCB_VIEWERS_SETTINGS_BASE * GetViewerSettingsBase() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
EDA_3D_VIEWER_FRAME * CreateAndShow3D_Frame()
Show the 3D view frame.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
virtual void UpdateStatusBar() override
Update the status bar information.
bool m_FootprintViewerAutoZoomOnSelect
true to use automatic zoom on fp selection
VIEWERS_DISPLAY_OPTIONS m_ViewersDisplay
EDA_UNITS GetUserUnits() const
Declaration of the eda_3d_viewer class.
LEADER_MODE
The kind of the leader line.
@ DIRECT
Unconstrained point-to-point.
@ REPAINT
Item needs to be redrawn.
@ GEOMETRY
Position or shape has changed.
int GetUserUnits()
Return the currently selected user unit value for the interface.
T * GetAppSettings(const char *aFilename)
bool m_DisplayInvertYAxis
bool m_DisplayInvertXAxis
bool m_DisplayGraphicsFill
LEADER_MODE m_AngleSnapMode
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
VECTOR2< int32_t > VECTOR2I