KiCad PCB EDA Suite
PANEL_PREVIEW_3D_MODEL Class Reference

#include <panel_preview_3d_model.h>

Inheritance diagram for PANEL_PREVIEW_3D_MODEL:
EDA_3D_BOARD_HOLDER TOOLS_HOLDER PANEL_PREVIEW_3D_MODEL_BASE

Public Member Functions

 PANEL_PREVIEW_3D_MODEL (wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
 
 ~PANEL_PREVIEW_3D_MODEL ()
 
void OnMenuEvent (wxMenuEvent &aEvent)
 The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't captured by the menus themselves. More...
 
wxWindow * GetToolCanvas () const override
 Canvas access. More...
 
BOARD_ADAPTERGetAdapter () override
 
CAMERAGetCurrentCamera () override
 
void SetSelectedModel (int idx)
 Set the currently selected index in the model list so that the scale/rotation/offset controls can be updated. More...
 
void UpdateDummyFootprint (bool aRelaodRequired=true)
 Copy shapes from the current shape list which are flagged for preview to the copy of footprint that is on the preview dummy board. More...
 
TOOL_MANAGERGetToolManager () const
 Return the MVC controller. More...
 
virtual void RegisterUIUpdateHandler (const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
 Register an action's update conditions with the UI layer to allow the UI to appropriately display the state of its controls. More...
 
virtual void RegisterUIUpdateHandler (int aID, const ACTION_CONDITIONS &aConditions)
 Register a UI update handler for the control with ID aID. More...
 
virtual void UnregisterUIUpdateHandler (const TOOL_ACTION &aAction)
 Unregister a UI handler for an action that was registered using RegisterUIUpdateHandler. More...
 
virtual void UnregisterUIUpdateHandler (int aID)
 Unregister a UI handler for a given ID that was registered using RegisterUIUpdateHandler. More...
 
virtual SELECTIONGetCurrentSelection ()
 Get the current selection from the canvas area. More...
 
virtual void PushTool (const TOOL_EVENT &aEvent)
 NB: the definition of "tool" is different at the user level. More...
 
virtual void PopTool (const TOOL_EVENT &aEvent)
 Pops a tool from the stack. More...
 
bool ToolStackIsEmpty ()
 
std::string CurrentToolName () const
 
bool IsCurrentTool (const TOOL_ACTION &aAction) const
 
virtual void DisplayToolMsg (const wxString &msg)
 
virtual void ShowChangedLanguage ()
 
bool GetDoImmediateActions () const
 Indicate that hotkeys should perform an immediate action even if another tool is currently active. More...
 
MOUSE_DRAG_ACTION GetDragAction () const
 Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects. More...
 
bool GetMoveWarpsCursor () const
 Indicate that a move operation should warp the mouse pointer to the origin of the move object. More...
 
virtual void CommonSettingsChanged (bool aEnvVarsChanged, bool aTextVarsChanged)
 Notification event that some of the common (suite-wide) settings have changed. More...
 
virtual void RefreshCanvas ()
 
virtual wxString ConfigBaseName ()
 

Public Attributes

wxTextCtrl * yoff
 

Protected Member Functions

virtual void onMouseWheelBoardThickness (wxMouseEvent &event)
 

Protected Attributes

TOOL_MANAGERm_toolManager
 
ACTIONSm_actions
 
TOOL_DISPATCHERm_toolDispatcher
 
SELECTION m_dummySelection
 
std::vector< std::string > m_toolStack
 
bool m_immediateActions
 
MOUSE_DRAG_ACTION m_dragAction
 
bool m_moveWarpsCursor
 
wxStaticText * m_staticText1
 
wxTextCtrl * xscale
 
wxSpinButton * m_spinXscale
 
wxStaticText * m_staticText2
 
wxTextCtrl * yscale
 
wxSpinButton * m_spinYscale
 
wxStaticText * m_staticText3
 
wxTextCtrl * zscale
 
wxSpinButton * m_spinZscale
 
wxStaticText * m_staticText11
 
wxTextCtrl * xrot
 
wxSpinButton * m_spinXrot
 
wxStaticText * m_staticText21
 
wxTextCtrl * yrot
 
wxSpinButton * m_spinYrot
 
wxStaticText * m_staticText31
 
wxTextCtrl * zrot
 
wxSpinButton * m_spinZrot
 
wxStaticText * m_staticText12
 
wxTextCtrl * xoff
 
wxSpinButton * m_spinXoffset
 
wxStaticText * m_staticText22
 
wxSpinButton * m_spinYoffset
 
wxStaticText * m_staticText32
 
wxTextCtrl * zoff
 
wxSpinButton * m_spinZoffset
 
wxSlider * m_opacity
 
wxTextCtrl * m_boardThicknessCtrl
 
wxStaticText * m_boardThicknessUnits
 
wxBoxSizer * m_SizerPanelView
 
wxBitmapButton * m_bpvISO
 
wxBitmapButton * m_bpvLeft
 
wxBitmapButton * m_bpvRight
 
wxBitmapButton * m_bpvFront
 
wxBitmapButton * m_bpvBack
 
wxBitmapButton * m_bpvTop
 
wxBitmapButton * m_bpvBottom
 
wxBitmapButton * m_bpUpdate
 

Private Member Functions

void loadSettings ()
 Load 3D relevant settings from the user configuration. More...
 
void updateOrientation (wxCommandEvent &event) override
 It will receive the events from editing the fields. More...
 
void onMouseWheelScale (wxMouseEvent &event) override
 
void onMouseWheelRot (wxMouseEvent &event) override
 
void onMouseWheelOffset (wxMouseEvent &event) override
 
void onIncrementRot (wxSpinEvent &event) override
 
void onDecrementRot (wxSpinEvent &event) override
 
void onIncrementScale (wxSpinEvent &event) override
 
void onDecrementScale (wxSpinEvent &event) override
 
void onIncrementOffset (wxSpinEvent &event) override
 
void onDecrementOffset (wxSpinEvent &event) override
 
void onOpacitySlider (wxCommandEvent &event) override
 
void updateBoardThickness (wxCommandEvent &event) override
 
void doIncrementScale (wxSpinEvent &aEvent, double aSign)
 
void doIncrementRotation (wxSpinEvent &aEvent, double aSign)
 
void doIncrementOffset (wxSpinEvent &aEvent, double aSign)
 
wxString formatScaleValue (double aValue)
 
wxString formatRotationValue (double aValue)
 
wxString formatOffsetValue (double aValue)
 
void View3DISO (wxCommandEvent &event) override
 
void View3DLeft (wxCommandEvent &event) override
 
void View3DFront (wxCommandEvent &event) override
 
void View3DTop (wxCommandEvent &event) override
 
void View3DUpdate (wxCommandEvent &event) override
 
void View3DRight (wxCommandEvent &event) override
 
void View3DBack (wxCommandEvent &event) override
 
void View3DBottom (wxCommandEvent &event) override
 

Private Attributes

EDA_3D_CANVASm_previewPane
 
WX_INFOBARm_infobar
 
BOARD_ADAPTER m_boardAdapter
 
CAMERAm_currentCamera
 
TRACK_BALL m_trackBallCamera
 
BOARDm_dummyBoard
 
FOOTPRINTm_dummyFootprint
 
std::vector< FP_3DMODEL > * m_parentModelList
 
int m_selected
 
UNIT_BINDER m_boardThickness
 Index into m_parentInfoList. More...
 
EDA_UNITS m_userUnits
 

Detailed Description

Definition at line 65 of file panel_preview_3d_model.h.

Constructor & Destructor Documentation

◆ PANEL_PREVIEW_3D_MODEL()

PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL ( wxWindow *  aParent,
PCB_BASE_FRAME aFrame,
FOOTPRINT aFootprint,
std::vector< FP_3DMODEL > *  aParentModelList 
)

Definition at line 45 of file panel_preview_3d_model.cpp.

47 :
48 PANEL_PREVIEW_3D_MODEL_BASE( aParent, wxID_ANY ),
49 m_previewPane( nullptr ),
50 m_infobar( nullptr ),
55{
56 m_userUnits = aFrame->GetUserUnits();
57
58 m_dummyBoard = new BOARD();
59 m_dummyBoard->SetProject( &aFrame->Prj(), true );
60
61 // This board will only be used to hold a footprint for viewing
63
64 BOARD_DESIGN_SETTINGS parent_bds = aFrame->GetDesignSettings();
66 dummy_bds.SetBoardThickness( parent_bds.GetBoardThickness() );
68 dummy_board_stackup.RemoveAll();
69 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
70
71 m_selected = -1;
72
73 // Set the bitmap of 3D view buttons:
74 m_bpvTop->SetBitmap( KiBitmap( BITMAPS::axis3d_top ) );
80 m_bpvISO->SetBitmap( KiBitmap( BITMAPS::ortho ) );
81 m_bpUpdate->SetBitmap( KiBitmap( BITMAPS::reload ) );
82
83 // Set the min and max values of spin buttons (mandatory on Linux)
84 // They are not used, so they are set to min and max 32 bits int values
85 // (the min and max values supported by a wxSpinButton)
86 // It avoids blocking the up or down arrows when reaching this limit after
87 // a few clicks.
88 wxSpinButton* spinButtonList[] =
89 {
93 };
94
95 for( wxSpinButton* button : spinButtonList )
96 button->SetRange(INT_MIN, INT_MAX );
97
98 m_parentModelList = aParentModelList;
99
100 m_dummyFootprint = new FOOTPRINT( *aFootprint );
102
103 // Create the 3D canvas
104 m_previewPane = new EDA_3D_CANVAS( this,
107 aFrame->Prj().Get3DCacheManager() );
108
111 m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options
112
113 loadSettings();
114
115 // Create the manager
117 m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
118
122
123 // Register tools
126
127 // Run the viewer control tool, it is supposed to be always active
128 m_toolManager->InvokeTool( "3DViewer.Control" );
129
130 m_infobar = new WX_INFOBAR( this );
132
133 m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 );
134 m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
135
136 for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
137 {
138 Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
139 this );
140 }
141
142#ifdef __WXOSX__
143 // Call layout once to get the proper button sizes after the bitmaps have been set
144 Layout();
145
146 // The rounded-button style used has a small border on the left/right sides.
147 // This is automatically fixed in wx for buttons with a bitmap < 20, but not
148 // when the bitmap is set to be 26x26.
149 wxSize borderFix = wxSize( 4, 4 );
150
151 m_bpvTop->SetMinSize( m_bpvTop->GetSize() + borderFix );
152 m_bpvFront->SetMinSize( m_bpvFront->GetSize() + borderFix );
153 m_bpvBack->SetMinSize( m_bpvBack->GetSize() + borderFix );
154 m_bpvLeft->SetMinSize( m_bpvLeft->GetSize() + borderFix );
155 m_bpvRight->SetMinSize( m_bpvRight->GetSize() + borderFix );
156 m_bpvBottom->SetMinSize( m_bpvBottom->GetSize() + borderFix );
157 m_bpvISO->SetMinSize( m_bpvISO->GetSize() + borderFix );
158 m_bpUpdate->SetMinSize( m_bpUpdate->GetSize() + borderFix );
159#endif
160}
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
@ axis3d_bottom
@ axis3d_front
@ axis3d_right
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:62
bool m_IsPreviewer
true if the board adaptater is living in a 3D preview panel, false for the standard 3D viewer
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
Container for design settings for a BOARD object.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
void SetBoardThickness(int aThickness)
Manage layers needed to make a physical board.
void RemoveAll()
Delete all items in list and clear the list.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:265
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:696
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:277
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:169
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:628
EDA_3D_ACTIONS.
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
void SetInfoBar(WX_INFOBAR *aInfoBar)
Definition: eda_3d_canvas.h:79
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
EDA_3D_CONTROLLER.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static const int * GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode)
Get a list of attributes to pass to wxGLCanvas.
PANEL_PREVIEW_3D_MODEL_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
UNIT_BINDER m_boardThickness
Index into m_parentInfoList.
void loadSettings()
Load 3D relevant settings from the user configuration.
void OnMenuEvent(wxMenuEvent &aEvent)
The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't ...
std::vector< FP_3DMODEL > * m_parentModelList
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:172
ACTIONS * m_actions
Definition: tools_holder.h:171
Master controller class:
Definition: tool_manager.h:55
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void InitTools()
Initializes all registered tools.
const EDA_IU_SCALE & GetIuScale() const
EDA_UNITS GetUserUnits() const
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:75

References AA_8X, BOARD::Add(), axis3d_back, axis3d_bottom, axis3d_front, axis3d_left, axis3d_right, axis3d_top, BOARD_STACKUP::BuildDefaultStackupList(), FPHOLDER, OGL_ATT_LIST::GetAttributesList(), BOARD_DESIGN_SETTINGS::GetBoardThickness(), PCB_BASE_FRAME::GetDesignSettings(), BOARD::GetDesignSettings(), BOARD_DESIGN_SETTINGS::GetStackupDescriptor(), UNITS_PROVIDER::GetUserUnits(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::InvokeTool(), KiBitmap(), loadSettings(), TOOLS_HOLDER::m_actions, m_boardAdapter, PANEL_PREVIEW_3D_MODEL_BASE::m_bpUpdate, PANEL_PREVIEW_3D_MODEL_BASE::m_bpvBack, PANEL_PREVIEW_3D_MODEL_BASE::m_bpvBottom, PANEL_PREVIEW_3D_MODEL_BASE::m_bpvFront, PANEL_PREVIEW_3D_MODEL_BASE::m_bpvISO, PANEL_PREVIEW_3D_MODEL_BASE::m_bpvLeft, PANEL_PREVIEW_3D_MODEL_BASE::m_bpvRight, PANEL_PREVIEW_3D_MODEL_BASE::m_bpvTop, m_currentCamera, m_dummyBoard, m_dummyFootprint, m_infobar, BOARD_ADAPTER::m_IsBoardView, BOARD_ADAPTER::m_IsPreviewer, m_parentModelList, m_previewPane, m_selected, PANEL_PREVIEW_3D_MODEL_BASE::m_SizerPanelView, PANEL_PREVIEW_3D_MODEL_BASE::m_spinXoffset, PANEL_PREVIEW_3D_MODEL_BASE::m_spinXrot, PANEL_PREVIEW_3D_MODEL_BASE::m_spinXscale, PANEL_PREVIEW_3D_MODEL_BASE::m_spinYoffset, PANEL_PREVIEW_3D_MODEL_BASE::m_spinYrot, PANEL_PREVIEW_3D_MODEL_BASE::m_spinYscale, PANEL_PREVIEW_3D_MODEL_BASE::m_spinZoffset, PANEL_PREVIEW_3D_MODEL_BASE::m_spinZrot, PANEL_PREVIEW_3D_MODEL_BASE::m_spinZscale, TOOLS_HOLDER::m_toolDispatcher, TOOLS_HOLDER::m_toolManager, m_userUnits, OnMenuEvent(), ortho, KIWAY_HOLDER::Prj(), TOOL_MANAGER::RegisterTool(), reload, BOARD_STACKUP::RemoveAll(), BOARD_ADAPTER::SetBoard(), BOARD_DESIGN_SETTINGS::SetBoardThickness(), BOARD::SetBoardUse(), TOOL_MANAGER::SetEnvironment(), EDA_3D_CANVAS::SetEventDispatcher(), EDA_3D_CANVAS::SetInfoBar(), and BOARD::SetProject().

◆ ~PANEL_PREVIEW_3D_MODEL()

PANEL_PREVIEW_3D_MODEL::~PANEL_PREVIEW_3D_MODEL ( )

Definition at line 163 of file panel_preview_3d_model.cpp.

164{
165 delete m_dummyBoard;
166 delete m_previewPane;
167}

References m_dummyBoard, and m_previewPane.

Member Function Documentation

◆ CommonSettingsChanged()

void TOOLS_HOLDER::CommonSettingsChanged ( bool  aEnvVarsChanged,
bool  aTextVarsChanged 
)
virtualinherited

Notification event that some of the common (suite-wide) settings have changed.

Update hotkeys, preferences, etc.

Reimplemented in EDA_3D_VIEWER_FRAME, SCH_BASE_FRAME, SCH_EDIT_FRAME, SYMBOL_EDIT_FRAME, SYMBOL_VIEWER_FRAME, GERBVIEW_FRAME, EDA_BASE_FRAME, EDA_DRAW_FRAME, PCB_BASE_FRAME, KICAD_MANAGER_FRAME, PL_EDITOR_FRAME, FOOTPRINT_EDIT_FRAME, FOOTPRINT_VIEWER_FRAME, and PCB_EDIT_FRAME.

Definition at line 138 of file tools_holder.cpp.

139{
140 if( GetToolManager() )
142
143 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
144
146 m_dragAction = settings->m_Input.drag_left;
148}
void UpdateHotKeys(bool aFullUpdate)
Optionally read the hotkey config files and then rebuilds the internal hotkey maps.
bool m_immediateActions
Definition: tools_holder.h:183
bool m_moveWarpsCursor
Definition: tools_holder.h:189
MOUSE_DRAG_ACTION m_dragAction
Definition: tools_holder.h:187
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:54
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:196
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
MOUSE_DRAG_ACTION drag_left

References COMMON_SETTINGS::INPUT::drag_left, TOOL_MANAGER::GetActionManager(), TOOLS_HOLDER::GetToolManager(), COMMON_SETTINGS::INPUT::immediate_actions, TOOLS_HOLDER::m_dragAction, TOOLS_HOLDER::m_immediateActions, COMMON_SETTINGS::m_Input, TOOLS_HOLDER::m_moveWarpsCursor, Pgm(), ACTION_MANAGER::UpdateHotKeys(), and COMMON_SETTINGS::INPUT::warp_mouse_on_move.

Referenced by EDA_BASE_FRAME::CommonSettingsChanged(), and EDA_BASE_FRAME::LoadWindowSettings().

◆ ConfigBaseName()

virtual wxString TOOLS_HOLDER::ConfigBaseName ( )
inlinevirtualinherited

Reimplemented in EDA_BASE_FRAME.

Definition at line 167 of file tools_holder.h.

167{ return wxEmptyString; }

Referenced by ACTION_MANAGER::UpdateHotKeys().

◆ CurrentToolName()

std::string TOOLS_HOLDER::CurrentToolName ( ) const
inherited

Definition at line 110 of file tools_holder.cpp.

111{
112 if( m_toolStack.empty() )
114 else
115 return m_toolStack.back();
116}
static TOOL_ACTION selectionTool
Definition: actions.h:156
std::vector< std::string > m_toolStack
Definition: tools_holder.h:176
const std::string & GetName() const
Return name of the action.
Definition: tool_action.h:101

References TOOL_ACTION::GetName(), TOOLS_HOLDER::m_toolStack, and ACTIONS::selectionTool.

Referenced by TOOLS_HOLDER::ShowChangedLanguage().

◆ DisplayToolMsg()

virtual void TOOLS_HOLDER::DisplayToolMsg ( const wxString &  msg)
inlinevirtualinherited

Reimplemented in EDA_DRAW_FRAME.

Definition at line 133 of file tools_holder.h.

133{};

Referenced by TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), and TOOLS_HOLDER::ShowChangedLanguage().

◆ doIncrementOffset()

void PANEL_PREVIEW_3D_MODEL::doIncrementOffset ( wxSpinEvent &  aEvent,
double  aSign 
)
private

Definition at line 433 of file panel_preview_3d_model.cpp.

434{
435 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
436
437 wxTextCtrl * textCtrl = xoff;
438
439 if( spinCtrl == m_spinYoffset )
440 textCtrl = yoff;
441 else if( spinCtrl == m_spinZoffset )
442 textCtrl = zoff;
443
444 double step_mm = OFFSET_INCREMENT_MM;
445 double curr_value_mm =
448
450 {
451 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
452 }
453
454 curr_value_mm += ( step_mm * aSign );
455 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
456 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
457
458 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
459}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:109
wxString formatOffsetValue(double aValue)
double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Function DoubleValueFromString converts aTextValue to a double.
Definition: eda_units.cpp:449
#define MAX_OFFSET
#define OFFSET_INCREMENT_MIL
#define OFFSET_INCREMENT_MM
const double IU_PER_MM
Definition: base_units.h:77

References EDA_UNIT_UTILS::UI::DoubleValueFromString(), formatOffsetValue(), INCHES, EDA_IU_SCALE::IU_PER_MM, PANEL_PREVIEW_3D_MODEL_BASE::m_spinYoffset, PANEL_PREVIEW_3D_MODEL_BASE::m_spinZoffset, m_userUnits, MAX_OFFSET, MILS, OFFSET_INCREMENT_MIL, OFFSET_INCREMENT_MM, pcbIUScale, PANEL_PREVIEW_3D_MODEL_BASE::xoff, PANEL_PREVIEW_3D_MODEL_BASE::yoff, and PANEL_PREVIEW_3D_MODEL_BASE::zoff.

Referenced by onDecrementOffset(), and onIncrementOffset().

◆ doIncrementRotation()

void PANEL_PREVIEW_3D_MODEL::doIncrementRotation ( wxSpinEvent &  aEvent,
double  aSign 
)
private

Definition at line 412 of file panel_preview_3d_model.cpp.

413{
414 wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
415 wxTextCtrl* textCtrl = xrot;
416
417 if( spinCtrl == m_spinYrot )
418 textCtrl = yrot;
419 else if( spinCtrl == m_spinZrot )
420 textCtrl = zrot;
421
423 textCtrl->GetValue() );
424
425 curr_value += ( ROTATION_INCREMENT * aSign );
426 curr_value = std::max( -MAX_ROTATION, curr_value );
427 curr_value = std::min( curr_value, MAX_ROTATION );
428
429 textCtrl->SetValue( formatRotationValue( curr_value ) );
430}
constexpr EDA_IU_SCALE unityScale
Definition: base_units.h:112
wxString formatRotationValue(double aValue)
#define MAX_ROTATION
#define ROTATION_INCREMENT

References DEGREES, EDA_UNIT_UTILS::UI::DoubleValueFromString(), formatRotationValue(), PANEL_PREVIEW_3D_MODEL_BASE::m_spinYrot, PANEL_PREVIEW_3D_MODEL_BASE::m_spinZrot, MAX_ROTATION, ROTATION_INCREMENT, unityScale, PANEL_PREVIEW_3D_MODEL_BASE::xrot, PANEL_PREVIEW_3D_MODEL_BASE::yrot, and PANEL_PREVIEW_3D_MODEL_BASE::zrot.

Referenced by onDecrementRot(), and onIncrementRot().

◆ doIncrementScale()

void PANEL_PREVIEW_3D_MODEL::doIncrementScale ( wxSpinEvent &  aEvent,
double  aSign 
)
private

Definition at line 390 of file panel_preview_3d_model.cpp.

391{
392 wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
393
394 wxTextCtrl * textCtrl = xscale;
395
396 if( spinCtrl == m_spinYscale )
397 textCtrl = yscale;
398 else if( spinCtrl == m_spinZscale )
399 textCtrl = zscale;
400
402 textCtrl->GetValue() );
403
404 curr_value += ( SCALE_INCREMENT * aSign );
405 curr_value = std::max( 1/MAX_SCALE, curr_value );
406 curr_value = std::min( curr_value, MAX_SCALE );
407
408 textCtrl->SetValue( formatScaleValue( curr_value ) );
409}
wxString formatScaleValue(double aValue)
#define MAX_SCALE
#define SCALE_INCREMENT

References EDA_UNIT_UTILS::UI::DoubleValueFromString(), formatScaleValue(), PANEL_PREVIEW_3D_MODEL_BASE::m_spinYscale, PANEL_PREVIEW_3D_MODEL_BASE::m_spinZscale, MAX_SCALE, pcbIUScale, SCALE_INCREMENT, UNSCALED, PANEL_PREVIEW_3D_MODEL_BASE::xscale, PANEL_PREVIEW_3D_MODEL_BASE::yscale, and PANEL_PREVIEW_3D_MODEL_BASE::zscale.

Referenced by onDecrementScale(), and onIncrementScale().

◆ formatOffsetValue()

wxString PANEL_PREVIEW_3D_MODEL::formatOffsetValue ( double  aValue)
private

Definition at line 267 of file panel_preview_3d_model.cpp.

268{
269 // Convert from internal units (mm) to user units
271 aValue /= 25.4;
272 else if( m_userUnits == EDA_UNITS::MILS )
273 aValue /= 25.4 / 1e3;
274
275 return wxString::Format( wxT( "%.6f%s" ),
276 aValue,
278}
wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:98
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format(), EDA_UNIT_UTILS::GetText(), INCHES, m_userUnits, and MILS.

Referenced by doIncrementOffset(), onMouseWheelOffset(), and SetSelectedModel().

◆ formatRotationValue()

wxString PANEL_PREVIEW_3D_MODEL::formatRotationValue ( double  aValue)
private

Definition at line 259 of file panel_preview_3d_model.cpp.

260{
261 return wxString::Format( wxT( "%.2f%s" ),
262 aValue,
264}

References DEGREES, Format(), and EDA_UNIT_UTILS::GetText().

Referenced by doIncrementRotation(), onMouseWheelRot(), and SetSelectedModel().

◆ formatScaleValue()

wxString PANEL_PREVIEW_3D_MODEL::formatScaleValue ( double  aValue)
private

Definition at line 252 of file panel_preview_3d_model.cpp.

253{
254 return wxString::Format( wxT( "%.4f" ),
255 aValue );
256}

References Format().

Referenced by doIncrementScale(), onMouseWheelScale(), and SetSelectedModel().

◆ GetAdapter()

BOARD_ADAPTER & PANEL_PREVIEW_3D_MODEL::GetAdapter ( )
inlineoverridevirtual

Implements EDA_3D_BOARD_HOLDER.

Definition at line 81 of file panel_preview_3d_model.h.

81{ return m_boardAdapter; }

References m_boardAdapter.

◆ GetCurrentCamera()

CAMERA & PANEL_PREVIEW_3D_MODEL::GetCurrentCamera ( )
inlineoverridevirtual

Implements EDA_3D_BOARD_HOLDER.

Definition at line 82 of file panel_preview_3d_model.h.

82{ return m_currentCamera; }

References m_currentCamera.

◆ GetCurrentSelection()

virtual SELECTION & TOOLS_HOLDER::GetCurrentSelection ( )
inlinevirtualinherited

◆ GetDoImmediateActions()

bool TOOLS_HOLDER::GetDoImmediateActions ( ) const
inlineinherited

Indicate that hotkeys should perform an immediate action even if another tool is currently active.

If false, the first hotkey should select the relevant tool.

Definition at line 141 of file tools_holder.h.

141{ return m_immediateActions; }

References TOOLS_HOLDER::m_immediateActions.

◆ GetDragAction()

MOUSE_DRAG_ACTION TOOLS_HOLDER::GetDragAction ( ) const
inlineinherited

Indicates whether a drag should draw a selection rectangle or drag selected (or unselected) objects.

Definition at line 147 of file tools_holder.h.

147{ return m_dragAction; }

References TOOLS_HOLDER::m_dragAction.

Referenced by EE_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), and PCB_SELECTION_TOOL::Main().

◆ GetMoveWarpsCursor()

bool TOOLS_HOLDER::GetMoveWarpsCursor ( ) const
inlineinherited

Indicate that a move operation should warp the mouse pointer to the origin of the move object.

This improves snapping, but some users are allergic to mouse warping.

Definition at line 153 of file tools_holder.h.

153{ return m_moveWarpsCursor; }

References TOOLS_HOLDER::m_moveWarpsCursor.

Referenced by EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::InlineDrag(), SCH_MOVE_TOOL::Main(), and SYMBOL_EDITOR_MOVE_TOOL::Main().

◆ GetToolCanvas()

wxWindow * PANEL_PREVIEW_3D_MODEL::GetToolCanvas ( ) const
inlineoverridevirtual

Canvas access.

Implements TOOLS_HOLDER.

Definition at line 79 of file panel_preview_3d_model.h.

79{ return m_previewPane; }

References m_previewPane.

◆ GetToolManager()

TOOL_MANAGER * TOOLS_HOLDER::GetToolManager ( ) const
inlineinherited

Return the MVC controller.

Definition at line 54 of file tools_holder.h.

54{ return m_toolManager; }

References TOOLS_HOLDER::m_toolManager.

Referenced by PROJECT_TREE_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), SCH_NAVIGATE_TOOL::Back(), BOARD_COMMIT::BOARD_COMMIT(), SCH_NAVIGATE_TOOL::changeSheet(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), TOOLS_HOLDER::CommonSettingsChanged(), DIALOG_FOOTPRINT_CHECKER::deleteAllMarkers(), DIALOG_ERC::deleteAllMarkers(), DIALOG_DRC::deleteAllMarkers(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_MIGRATE_BUSES::DIALOG_MIGRATE_BUSES(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), SIM_PLOT_FRAME::doCloseWindow(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), SCH_FIELD::DoHypertextAction(), SCH_TEXT::DoHypertextAction(), SCH_TEXTBOX::DoHypertextAction(), DRAWING_TOOL::DrawVia(), TRACK_WIDTH_MENU::eventHandler(), DIFF_PAIR_MENU::eventHandler(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_NAVIGATE_TOOL::Forward(), GERBVIEW_FRAME::GERBVIEW_FRAME(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), FP_TREE_SYNCHRONIZING_ADAPTER::GetContextMenuTool(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), DIALOG_PAD_PROPERTIES::initValues(), ROUTER_TOOL::InlineBreakTrack(), SCH_EDIT_FRAME::KiwayMailIn(), PCB_EDIT_FRAME::KiwayMailIn(), PCB_EDIT_FRAME::LoadProjectSettings(), FOOTPRINT_EDIT_FRAME::LoadSettings(), SYMBOL_EDIT_FRAME::LoadSymbol(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_DRC::OnActivateDlg(), DIALOG_DRC::OnCancelClick(), DIALOG_FOOTPRINT_CHECKER::OnCancelClick(), DIALOG_INSPECTOR::onCellClicked(), DIALOG_ERC::OnCloseErcDialog(), DIALOG_DRC::OnDeleteOneClick(), DIALOG_ERC::OnDeleteOneClick(), DIALOG_FOOTPRINT_CHECKER::OnDeleteOneClick(), DIALOG_DRC::OnDRCItemRClick(), DIALOG_DRC::OnDRCItemSelected(), DIALOG_ERC::OnERCItemSelected(), DIALOG_CONSTRAINTS_REPORTER::OnErrorLinkClicked(), KICAD_MANAGER_FRAME::OnIdle(), FOOTPRINTS_LISTBOX::OnLeftDClick(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onNetContextMenu(), PCB_EDIT_FRAME::OnNetlistChanged(), GERBER_LAYER_WIDGET::onPopupSelection(), SIM_PLOT_FRAME::onProbe(), DIALOG_PLOT::onRunDRC(), DIALOG_DRC::OnRunDRCClick(), HIERARCHY_NAVIG_PANEL::onSelectSheetPath(), SCH_EDIT_FRAME::onSize(), PCB_EDIT_FRAME::onSize(), SYMBOL_TREE_PANE::onSymbolSelected(), DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick(), SIM_PLOT_FRAME::onTune(), PANEL_KICAD_LAUNCHER::PANEL_KICAD_LAUNCHER(), PANEL_SELECTION_FILTER::PANEL_SELECTION_FILTER(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_PLOT::Plot(), TOOLS_HOLDER::PopTool(), SCH_EDIT_FRAME::PutDataInPreviousState(), FOOTPRINT_WIZARD_FRAME::PythonPluginsReload(), Refresh(), PL_EDITOR_FRAME::RollbackFromUndo(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), PCB_EDIT_FRAME::SaveProjectSettings(), EDA_3D_VIEWER_FRAME::SaveSettings(), FOOTPRINT_EDIT_FRAME::SaveSettings(), DIALOG_FIND::search(), FOOTPRINT_SEARCH_HANDLER::SelectItems(), ZONE_SEARCH_HANDLER::SelectItems(), TEXT_SEARCH_HANDLER::SelectItems(), CVPCB_MAINFRAME::setupEventHandlers(), APPEARANCE_CONTROLS::showNetclass(), SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow(), DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow(), DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow(), DIALOG_SYMBOL_FIELDS_TABLE::TransferDataToWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow(), PCB_PROPERTIES_PANEL::UpdateData(), DIALOG_DRC::updateDisplayedCounts(), CVPCB_MAINFRAME::updateFootprintViewerOnIdle(), EDA_DRAW_FRAME::UpdateMsgPanel(), NET_GRID_TABLE::updateNetVisibility(), PCB_PROPERTIES_PANEL::valueChanged(), DIALOG_NETLIST_IMPORT::~DIALOG_NETLIST_IMPORT(), and DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB().

◆ IsCurrentTool()

bool TOOLS_HOLDER::IsCurrentTool ( const TOOL_ACTION aAction) const
inherited

Definition at line 119 of file tools_holder.cpp.

120{
121 if( m_toolStack.empty() )
122 return &aAction == &ACTIONS::selectionTool;
123 else
124 return m_toolStack.back() == aAction.GetName();
125}

References TOOL_ACTION::GetName(), TOOLS_HOLDER::m_toolStack, and ACTIONS::selectionTool.

Referenced by SCH_EDIT_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), BOARD_EDITOR_CONTROL::Init(), EDIT_TOOL::Init(), and EDITOR_CONDITIONS::toolFunc().

◆ loadSettings()

void PANEL_PREVIEW_3D_MODEL::loadSettings ( )
private

Load 3D relevant settings from the user configuration.

Definition at line 179 of file panel_preview_3d_model.cpp.

180{
181 wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
182
183 COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
184
185 const DPI_SCALING dpi{ settings, this };
186 m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
187
188 // TODO(JE) use all control options
190
191 COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
192
193 if( colors )
194 {
195 auto set =
196 [] ( const COLOR4D& aColor, SFVEC4F& aTarget )
197 {
198 aTarget.r = aColor.r;
199 aTarget.g = aColor.g;
200 aTarget.b = aColor.b;
201 aTarget.a = aColor.a;
202 };
203
213 }
214
215 EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
216
217 if( cfg )
218 {
219 m_boardAdapter.m_Cfg = cfg;
220
224 }
225}
SFVEC4F m_BgColorTop
background top color
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
SFVEC4F m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
SFVEC4F m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
SFVEC4F m_CopperColor
in realistic mode: copper color
EDA_3D_VIEWER_SETTINGS * m_Cfg
SFVEC4F m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
SFVEC4F m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
SFVEC4F m_BoardBodyColor
in realistic mode: FR4 board color
bool m_MousewheelPanning
SFVEC4F m_BgColorBot
background bottom color
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:37
void SetProjectionMode(int aMode)
void SetAnimationEnabled(bool aEnable)
Enable or disable camera animation when switching to a pre-defined view.
void SetMovingSpeedMultiplier(int aMultiplier)
Set the camera animation moving speed multiplier option.
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
double r
Red component.
Definition: color4d.h:384
double g
Green component.
Definition: color4d.h:385
double a
Alpha component.
Definition: color4d.h:387
double b
Blue component.
Definition: color4d.h:386
@ LAYER_3D_SOLDERMASK_TOP
Definition: layer_ids.h:442
@ LAYER_3D_COPPER
Definition: layer_ids.h:438
@ LAYER_3D_BACKGROUND_TOP
Definition: layer_ids.h:436
@ LAYER_3D_SOLDERMASK_BOTTOM
Definition: layer_ids.h:441
@ LAYER_3D_BOARD
Definition: layer_ids.h:437
@ LAYER_3D_SILKSCREEN_TOP
Definition: layer_ids.h:440
@ LAYER_3D_SOLDERPASTE
Definition: layer_ids.h:443
@ LAYER_3D_BACKGROUND_BOTTOM
Definition: layer_ids.h:435
@ LAYER_3D_SILKSCREEN_BOTTOM
Definition: layer_ids.h:439
glm::vec4 SFVEC4F
Definition: xv3d_types.h:46

References KIGFX::COLOR4D::a, EDA_3D_VIEWER_SETTINGS::CAMERA_SETTINGS::animation_enabled, KIGFX::COLOR4D::b, KIGFX::COLOR4D::g, COLOR_SETTINGS::GetColor(), LAYER_3D_BACKGROUND_BOTTOM, LAYER_3D_BACKGROUND_TOP, LAYER_3D_BOARD, LAYER_3D_COPPER, LAYER_3D_SILKSCREEN_BOTTOM, LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SOLDERMASK_BOTTOM, LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERPASTE, BOARD_ADAPTER::m_BgColorBot, BOARD_ADAPTER::m_BgColorTop, m_boardAdapter, BOARD_ADAPTER::m_BoardBodyColor, EDA_3D_VIEWER_SETTINGS::m_Camera, BOARD_ADAPTER::m_Cfg, BOARD_ADAPTER::m_CopperColor, COMMON_SETTINGS::m_Input, BOARD_ADAPTER::m_MousewheelPanning, m_previewPane, BOARD_ADAPTER::m_SilkScreenColorBot, BOARD_ADAPTER::m_SilkScreenColorTop, BOARD_ADAPTER::m_SolderMaskColorBot, BOARD_ADAPTER::m_SolderMaskColorTop, BOARD_ADAPTER::m_SolderPasteColor, EDA_3D_VIEWER_SETTINGS::CAMERA_SETTINGS::moving_speed_multiplier, Pgm(), EDA_3D_VIEWER_SETTINGS::CAMERA_SETTINGS::projection_mode, KIGFX::COLOR4D::r, COMMON_SETTINGS::INPUT::scroll_modifier_zoom, EDA_3D_CANVAS::SetAnimationEnabled(), EDA_3D_CANVAS::SetMovingSpeedMultiplier(), EDA_3D_CANVAS::SetProjectionMode(), and HIDPI_GL_CANVAS::SetScaleFactor().

Referenced by PANEL_PREVIEW_3D_MODEL().

◆ onDecrementOffset()

void PANEL_PREVIEW_3D_MODEL::onDecrementOffset ( wxSpinEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 131 of file panel_preview_3d_model.h.

132 {
133 doIncrementOffset( event, -1.0 );
134 }
void doIncrementOffset(wxSpinEvent &aEvent, double aSign)

References doIncrementOffset().

◆ onDecrementRot()

void PANEL_PREVIEW_3D_MODEL::onDecrementRot ( wxSpinEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 115 of file panel_preview_3d_model.h.

116 {
117 doIncrementRotation( event, -1.0 );
118 }
void doIncrementRotation(wxSpinEvent &aEvent, double aSign)

References doIncrementRotation().

◆ onDecrementScale()

void PANEL_PREVIEW_3D_MODEL::onDecrementScale ( wxSpinEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 123 of file panel_preview_3d_model.h.

124 {
125 doIncrementScale( event, -1.0 );
126 }
void doIncrementScale(wxSpinEvent &aEvent, double aSign)

References doIncrementScale().

◆ onIncrementOffset()

void PANEL_PREVIEW_3D_MODEL::onIncrementOffset ( wxSpinEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 127 of file panel_preview_3d_model.h.

128 {
129 doIncrementOffset( event, 1.0 );
130 }

References doIncrementOffset().

◆ onIncrementRot()

void PANEL_PREVIEW_3D_MODEL::onIncrementRot ( wxSpinEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 111 of file panel_preview_3d_model.h.

112 {
113 doIncrementRotation( event, 1.0 );
114 }

References doIncrementRotation().

◆ onIncrementScale()

void PANEL_PREVIEW_3D_MODEL::onIncrementScale ( wxSpinEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 119 of file panel_preview_3d_model.h.

120 {
121 doIncrementScale( event, 1.0 );
122 }

References doIncrementScale().

◆ OnMenuEvent()

void PANEL_PREVIEW_3D_MODEL::OnMenuEvent ( wxMenuEvent &  aEvent)

The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't captured by the menus themselves.

Definition at line 170 of file panel_preview_3d_model.cpp.

171{
172 if( !m_toolDispatcher )
173 aEvent.Skip();
174 else
176}
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.

References TOOL_DISPATCHER::DispatchWxEvent(), and TOOLS_HOLDER::m_toolDispatcher.

Referenced by PANEL_PREVIEW_3D_MODEL().

◆ onMouseWheelBoardThickness()

virtual void PANEL_PREVIEW_3D_MODEL_BASE::onMouseWheelBoardThickness ( wxMouseEvent &  event)
inlineprotectedvirtualinherited

◆ onMouseWheelOffset()

void PANEL_PREVIEW_3D_MODEL::onMouseWheelOffset ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 508 of file panel_preview_3d_model.cpp.

509{
510 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
511
512 double step_mm = OFFSET_INCREMENT_MM;
513
514 if( event.ShiftDown( ) )
515 step_mm = OFFSET_INCREMENT_MM_FINE;
516
518 {
519 step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
520
521 if( event.ShiftDown( ) )
522 step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
523 }
524
525 if( event.GetWheelRotation() >= 0 )
526 step_mm = -step_mm;
527
529 textCtrl->GetValue() )
531
532 curr_value_mm += step_mm;
533 curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
534 curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
535
536 textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
537}
#define OFFSET_INCREMENT_MM_FINE
#define OFFSET_INCREMENT_MIL_FINE

References EDA_UNIT_UTILS::UI::DoubleValueFromString(), formatOffsetValue(), INCHES, EDA_IU_SCALE::IU_PER_MM, m_userUnits, MAX_OFFSET, MILS, OFFSET_INCREMENT_MIL, OFFSET_INCREMENT_MIL_FINE, OFFSET_INCREMENT_MM, OFFSET_INCREMENT_MM_FINE, and pcbIUScale.

◆ onMouseWheelRot()

void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 485 of file panel_preview_3d_model.cpp.

486{
487 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
488
489 double step = ROTATION_INCREMENT_WHEEL;
490
491 if( event.ShiftDown( ) )
493
494 if( event.GetWheelRotation() >= 0 )
495 step = -step;
496
498 textCtrl->GetValue() );
499
500 curr_value += step;
501 curr_value = std::max( -MAX_ROTATION, curr_value );
502 curr_value = std::min( curr_value, MAX_ROTATION );
503
504 textCtrl->SetValue( formatRotationValue( curr_value ) );
505}
#define ROTATION_INCREMENT_WHEEL_FINE
#define ROTATION_INCREMENT_WHEEL

References DEGREES, EDA_UNIT_UTILS::UI::DoubleValueFromString(), formatRotationValue(), MAX_ROTATION, ROTATION_INCREMENT_WHEEL, ROTATION_INCREMENT_WHEEL_FINE, and unityScale.

◆ onMouseWheelScale()

void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 462 of file panel_preview_3d_model.cpp.

463{
464 wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
465
466 double step = SCALE_INCREMENT;
467
468 if( event.ShiftDown( ) )
470
471 if( event.GetWheelRotation() >= 0 )
472 step = -step;
473
475 textCtrl->GetValue() );
476
477 curr_value += step;
478 curr_value = std::max( 1/MAX_SCALE, curr_value );
479 curr_value = std::min( curr_value, MAX_SCALE );
480
481 textCtrl->SetValue( formatScaleValue( curr_value ) );
482}
#define SCALE_INCREMENT_FINE

References EDA_UNIT_UTILS::UI::DoubleValueFromString(), formatScaleValue(), MAX_SCALE, pcbIUScale, SCALE_INCREMENT, SCALE_INCREMENT_FINE, and UNSCALED.

◆ onOpacitySlider()

void PANEL_PREVIEW_3D_MODEL::onOpacitySlider ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 362 of file panel_preview_3d_model.cpp.

363{
364 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
365 {
366 // Write settings back to the parent
367 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
368
369 modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
370
371 // Update the dummy footprint for the preview
372 UpdateDummyFootprint( false );
373 }
374}
double m_Opacity
Definition: footprint.h:94
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...

References PANEL_PREVIEW_3D_MODEL_BASE::m_opacity, FP_3DMODEL::m_Opacity, m_parentModelList, m_selected, and UpdateDummyFootprint().

◆ PopTool()

void TOOLS_HOLDER::PopTool ( const TOOL_EVENT aEvent)
virtualinherited

Pops a tool from the stack.

Parameters
aEventThe event that started the tool that was pushed to the stack.

Definition at line 65 of file tools_holder.cpp.

66{
67 const std::string& actionName = aEvent.getCommandStr();
68
69 wxASSERT_MSG( !aEvent.getCommandStr().empty(), "Popped Empty Tool Name!" );
70
71 // Push/pop events can get out of order (such as when they're generated by the Simulator
72 // frame but not processed until the mouse is back in the Schematic frame), so make sure
73 // we're popping the right stack frame.
74
75 for( int i = (int) m_toolStack.size() - 1; i >= 0; --i )
76 {
77 if( m_toolStack[ i ] == actionName )
78 {
79 m_toolStack.erase( m_toolStack.begin() + i );
80
81 // If there's something underneath us, and it's now the top of the stack, then
82 // re-activate it
83 if( ( --i ) >= 0 && i == (int)m_toolStack.size() - 1 )
84 {
85 std::string back = m_toolStack[ i ];
87
88 if( action )
89 {
90 // Pop the action as running it will push it back onto the stack
91 m_toolStack.pop_back();
92
93 TOOL_EVENT evt = action->MakeEvent();
94 evt.SetHasPosition( false );
95 evt.SetReactivate( true );
96 GetToolManager()->PostEvent( evt );
97 }
98 }
99 else
101
102 return;
103 }
104 }
105
106 wxASSERT_MSG( false, "Popped a Tool Not on the Tool Stack!" );
107}
TOOL_ACTION * FindAction(const std::string &aActionName) const
Find an action with a given name (if there is one available).
virtual void DisplayToolMsg(const wxString &msg)
Definition: tools_holder.h:133
Represent a single user action.
Definition: tool_action.h:68
TOOL_EVENT MakeEvent() const
Return the event associated with the action (i.e.
Definition: tool_action.cpp:72
Generic, UI-independent tool event.
Definition: tool_event.h:156
void SetReactivate(bool aReactivate=true)
Returns information about difference between current mouse cursor position and the place where draggi...
Definition: tool_event.h:256
void SetHasPosition(bool aHasPosition)
Returns if the action associated with this event should be treated as immediate regardless of the cur...
Definition: tool_event.h:244
const std::string & getCommandStr() const
Definition: tool_event.h:482
void PostEvent(const TOOL_EVENT &aEvent)
Put an event to the event queue to be processed at the end of event processing cycle.
wxString GetLabel(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:125

References TOOLS_HOLDER::DisplayToolMsg(), ACTION_MANAGER::FindAction(), TOOL_MANAGER::GetActionManager(), TOOL_EVENT::getCommandStr(), EDA_UNIT_UTILS::GetLabel(), TOOLS_HOLDER::GetToolManager(), TOOLS_HOLDER::m_toolManager, TOOLS_HOLDER::m_toolStack, TOOL_ACTION::MakeEvent(), TOOL_MANAGER::PostEvent(), ACTIONS::selectionTool, TOOL_EVENT::SetHasPosition(), and TOOL_EVENT::SetReactivate().

Referenced by EDIT_TOOL::copyToClipboard(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::drawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), DRAWING_TOOL::InteractivePlaceWithPreview(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ PushTool()

void TOOLS_HOLDER::PushTool ( const TOOL_EVENT aEvent)
virtualinherited

NB: the definition of "tool" is different at the user level.

The implementation uses a single TOOL_BASE derived class to implement several user "tools", such as rectangle and circle, or wire and bus. So each user-level tool is actually a TOOL_ACTION.

Pushes a tool to the stack.

Parameters
aEventThe event that is starting the tool to be pushed to the stack.

Definition at line 44 of file tools_holder.cpp.

45{
46 const std::string& actionName = aEvent.getCommandStr();
47
48 wxASSERT_MSG( !actionName.empty(), "Pushed Empty Tool Name!" );
49
50 m_toolStack.push_back( actionName );
51
52 // Human cognitive stacking is very shallow; deeper tool stacks just get annoying
53 if( m_toolStack.size() > 3 )
54 m_toolStack.erase( m_toolStack.begin() );
55
56 TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
57
58 if( action )
59 DisplayToolMsg( action->GetLabel() );
60 else
61 DisplayToolMsg( actionName );
62}
wxString GetLabel() const
Definition: tool_action.cpp:83

References TOOLS_HOLDER::DisplayToolMsg(), ACTION_MANAGER::FindAction(), TOOL_MANAGER::GetActionManager(), TOOL_EVENT::getCommandStr(), TOOL_ACTION::GetLabel(), TOOLS_HOLDER::m_toolManager, and TOOLS_HOLDER::m_toolStack.

Referenced by EDIT_TOOL::copyToClipboard(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SCH_DRAWING_TOOLS::DrawShape(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), DRAWING_TOOL::InteractivePlaceWithPreview(), SCH_MOVE_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), PCB_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), ROUTER_TOOL::RouteSelected(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ RefreshCanvas()

virtual void TOOLS_HOLDER::RefreshCanvas ( )
inlinevirtualinherited

Reimplemented in EDA_DRAW_FRAME.

Definition at line 165 of file tools_holder.h.

165{ }

Referenced by ACTION_TOOLBAR::onPaletteEvent(), ACTION_TOOLBAR::onToolEvent(), and TOOL_MANAGER::ProcessEvent().

◆ RegisterUIUpdateHandler() [1/2]

virtual void TOOLS_HOLDER::RegisterUIUpdateHandler ( const TOOL_ACTION aAction,
const ACTION_CONDITIONS aConditions 
)
inlinevirtualinherited

Register an action's update conditions with the UI layer to allow the UI to appropriately display the state of its controls.

Parameters
aActionis the action to register.
aConditionsare the UI conditions to use for the control states.

Definition at line 63 of file tools_holder.h.

65 {
66 RegisterUIUpdateHandler( aAction.GetUIId(), aConditions );
67 }
virtual void RegisterUIUpdateHandler(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Register an action's update conditions with the UI layer to allow the UI to appropriately display the...
Definition: tools_holder.h:63
int GetUIId() const
Definition: tool_action.h:130

References TOOL_ACTION::GetUIId(), and TOOLS_HOLDER::RegisterUIUpdateHandler().

Referenced by ACTION_TOOLBAR::doSelectAction(), TOOLS_HOLDER::RegisterUIUpdateHandler(), and ACTION_MANAGER::SetConditions().

◆ RegisterUIUpdateHandler() [2/2]

virtual void TOOLS_HOLDER::RegisterUIUpdateHandler ( int  aID,
const ACTION_CONDITIONS aConditions 
)
inlinevirtualinherited

Register a UI update handler for the control with ID aID.

Parameters
aIDis the control ID to register the handler for.
aConditionsare the UI conditions to use for the control states.

Reimplemented in EDA_BASE_FRAME.

Definition at line 75 of file tools_holder.h.

76 {}

◆ SetSelectedModel()

void PANEL_PREVIEW_3D_MODEL::SetSelectedModel ( int  idx)

Set the currently selected index in the model list so that the scale/rotation/offset controls can be updated.

Definition at line 281 of file panel_preview_3d_model.cpp.

282{
283 if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
284 {
285 m_selected = idx;
286 const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
287
288 // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
289 // don't want to generate wxEVT_GRID_CELL_CHANGED events.
290 xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
291 yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
292 zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
293
294 xrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.x ) );
295 yrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.y ) );
296 zrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.z ) );
297
298 xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
299 yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
300 zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
301
302 m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
303 }
304 else
305 {
306 m_selected = -1;
307
308 xscale->ChangeValue( wxEmptyString );
309 yscale->ChangeValue( wxEmptyString );
310 zscale->ChangeValue( wxEmptyString );
311
312 xrot->ChangeValue( wxEmptyString );
313 yrot->ChangeValue( wxEmptyString );
314 zrot->ChangeValue( wxEmptyString );
315
316 xoff->ChangeValue( wxEmptyString );
317 yoff->ChangeValue( wxEmptyString );
318 zoff->ChangeValue( wxEmptyString );
319
320 m_opacity->SetValue( 100 );
321 }
322
325}
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:93
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:92
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:91
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
T y
Definition: vector3.h:62
T z
Definition: vector3.h:63
T x
Definition: vector3.h:61

References UNIT_BINDER::ChangeValue(), formatOffsetValue(), formatRotationValue(), formatScaleValue(), BOARD_DESIGN_SETTINGS::GetBoardThickness(), BOARD::GetDesignSettings(), m_boardThickness, m_dummyBoard, FP_3DMODEL::m_Offset, PANEL_PREVIEW_3D_MODEL_BASE::m_opacity, FP_3DMODEL::m_Opacity, m_parentModelList, FP_3DMODEL::m_Rotation, FP_3DMODEL::m_Scale, m_selected, VECTOR3< T >::x, PANEL_PREVIEW_3D_MODEL_BASE::xoff, PANEL_PREVIEW_3D_MODEL_BASE::xrot, PANEL_PREVIEW_3D_MODEL_BASE::xscale, VECTOR3< T >::y, PANEL_PREVIEW_3D_MODEL_BASE::yoff, PANEL_PREVIEW_3D_MODEL_BASE::yrot, PANEL_PREVIEW_3D_MODEL_BASE::yscale, VECTOR3< T >::z, PANEL_PREVIEW_3D_MODEL_BASE::zoff, PANEL_PREVIEW_3D_MODEL_BASE::zrot, and PANEL_PREVIEW_3D_MODEL_BASE::zscale.

Referenced by PANEL_FP_PROPERTIES_3D_MODEL::select3DModel().

◆ ShowChangedLanguage()

◆ ToolStackIsEmpty()

◆ UnregisterUIUpdateHandler() [1/2]

virtual void TOOLS_HOLDER::UnregisterUIUpdateHandler ( const TOOL_ACTION aAction)
inlinevirtualinherited

Unregister a UI handler for an action that was registered using RegisterUIUpdateHandler.

Parameters
aActionis the action to unregister the handler for.

Definition at line 83 of file tools_holder.h.

84 {
86 }
virtual void UnregisterUIUpdateHandler(const TOOL_ACTION &aAction)
Unregister a UI handler for an action that was registered using RegisterUIUpdateHandler.
Definition: tools_holder.h:83

References TOOL_ACTION::GetUIId(), and TOOLS_HOLDER::UnregisterUIUpdateHandler().

Referenced by ACTION_TOOLBAR::doSelectAction(), ACTION_MANAGER::SetConditions(), and TOOLS_HOLDER::UnregisterUIUpdateHandler().

◆ UnregisterUIUpdateHandler() [2/2]

virtual void TOOLS_HOLDER::UnregisterUIUpdateHandler ( int  aID)
inlinevirtualinherited

Unregister a UI handler for a given ID that was registered using RegisterUIUpdateHandler.

Parameters
aIDis the control ID to unregister the handler for.

Reimplemented in EDA_BASE_FRAME.

Definition at line 93 of file tools_holder.h.

94 {}

◆ updateBoardThickness()

void PANEL_PREVIEW_3D_MODEL::updateBoardThickness ( wxCommandEvent &  event)
overrideprivatevirtual

◆ UpdateDummyFootprint()

void PANEL_PREVIEW_3D_MODEL::UpdateDummyFootprint ( bool  aRelaodRequired = true)

Copy shapes from the current shape list which are flagged for preview to the copy of footprint that is on the preview dummy board.

Definition at line 540 of file panel_preview_3d_model.cpp.

541{
542 m_dummyFootprint->Models().clear();
543
544 for( FP_3DMODEL& model : *m_parentModelList )
545 {
546 if( model.m_Show )
547 m_dummyFootprint->Models().push_back( model );
548 }
549
550 if( aReloadRequired )
552
554}
void ReloadRequest(BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
std::vector< FP_3DMODEL > & Models()
Definition: footprint.h:184

References m_dummyFootprint, m_parentModelList, m_previewPane, FOOTPRINT::Models(), EDA_3D_CANVAS::ReloadRequest(), and EDA_3D_CANVAS::Request_refresh().

Referenced by PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath(), PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged(), PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel(), onOpacitySlider(), PANEL_FP_PROPERTIES_3D_MODEL::OnRemove3DModel(), PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint(), updateBoardThickness(), and updateOrientation().

◆ updateOrientation()

void PANEL_PREVIEW_3D_MODEL::updateOrientation ( wxCommandEvent &  event)
overrideprivatevirtual

It will receive the events from editing the fields.

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 328 of file panel_preview_3d_model.cpp.

329{
330 if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
331 {
332 // Write settings back to the parent
333 FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
334
336 pcbIUScale, EDA_UNITS::UNSCALED, xscale->GetValue() );
338 pcbIUScale, EDA_UNITS::UNSCALED, yscale->GetValue() );
340 pcbIUScale, EDA_UNITS::UNSCALED, zscale->GetValue() );
341
342 modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
343 modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
344 modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
345
347 xoff->GetValue() )
350 yoff->GetValue() )
353 zoff->GetValue() )
355
356 // Update the dummy footprint for the preview
357 UpdateDummyFootprint( false );
358 }
359}
static double rotationFromString(const wxString &aValue)
Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.

References EDA_UNIT_UTILS::UI::DoubleValueFromString(), EDA_IU_SCALE::IU_PER_MM, FP_3DMODEL::m_Offset, m_parentModelList, FP_3DMODEL::m_Rotation, FP_3DMODEL::m_Scale, m_selected, m_userUnits, pcbIUScale, rotationFromString(), UNSCALED, UpdateDummyFootprint(), VECTOR3< T >::x, PANEL_PREVIEW_3D_MODEL_BASE::xoff, PANEL_PREVIEW_3D_MODEL_BASE::xrot, PANEL_PREVIEW_3D_MODEL_BASE::xscale, VECTOR3< T >::y, PANEL_PREVIEW_3D_MODEL_BASE::yoff, PANEL_PREVIEW_3D_MODEL_BASE::yrot, PANEL_PREVIEW_3D_MODEL_BASE::yscale, VECTOR3< T >::z, PANEL_PREVIEW_3D_MODEL_BASE::zoff, PANEL_PREVIEW_3D_MODEL_BASE::zrot, and PANEL_PREVIEW_3D_MODEL_BASE::zscale.

◆ View3DBack()

void PANEL_PREVIEW_3D_MODEL::View3DBack ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 180 of file panel_preview_3d_model.h.

181 {
183 }
@ ID_VIEW3D_BACK
Definition: 3d_viewer_id.h:26
bool SetView3D(int aKeycode)
Helper function to call view commands.

References ID_VIEW3D_BACK, m_previewPane, and EDA_3D_CANVAS::SetView3D().

◆ View3DBottom()

void PANEL_PREVIEW_3D_MODEL::View3DBottom ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 185 of file panel_preview_3d_model.h.

186 {
188 }
@ ID_VIEW3D_BOTTOM
Definition: 3d_viewer_id.h:22

References ID_VIEW3D_BOTTOM, m_previewPane, and EDA_3D_CANVAS::SetView3D().

◆ View3DFront()

void PANEL_PREVIEW_3D_MODEL::View3DFront ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 159 of file panel_preview_3d_model.h.

160 {
162 }
@ ID_VIEW3D_FRONT
Definition: 3d_viewer_id.h:25

References ID_VIEW3D_FRONT, m_previewPane, and EDA_3D_CANVAS::SetView3D().

◆ View3DISO()

void PANEL_PREVIEW_3D_MODEL::View3DISO ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 148 of file panel_preview_3d_model.h.

149 {
151 m_previewPane->Refresh();
152 }
void ToggleProjection()
Definition: camera.cpp:501

References m_currentCamera, m_previewPane, and CAMERA::ToggleProjection().

◆ View3DLeft()

void PANEL_PREVIEW_3D_MODEL::View3DLeft ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 154 of file panel_preview_3d_model.h.

155 {
157 }
@ ID_VIEW3D_LEFT
Definition: 3d_viewer_id.h:23

References ID_VIEW3D_LEFT, m_previewPane, and EDA_3D_CANVAS::SetView3D().

◆ View3DRight()

void PANEL_PREVIEW_3D_MODEL::View3DRight ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 175 of file panel_preview_3d_model.h.

176 {
178 }
@ ID_VIEW3D_RIGHT
Definition: 3d_viewer_id.h:24

References ID_VIEW3D_RIGHT, m_previewPane, and EDA_3D_CANVAS::SetView3D().

◆ View3DTop()

void PANEL_PREVIEW_3D_MODEL::View3DTop ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 164 of file panel_preview_3d_model.h.

165 {
167 }
@ ID_VIEW3D_TOP
Definition: 3d_viewer_id.h:21

References ID_VIEW3D_TOP, m_previewPane, and EDA_3D_CANVAS::SetView3D().

◆ View3DUpdate()

void PANEL_PREVIEW_3D_MODEL::View3DUpdate ( wxCommandEvent &  event)
inlineoverrideprivatevirtual

Reimplemented from PANEL_PREVIEW_3D_MODEL_BASE.

Definition at line 169 of file panel_preview_3d_model.h.

170 {
172 m_previewPane->Refresh();
173 }

References m_previewPane, and EDA_3D_CANVAS::ReloadRequest().

Member Data Documentation

◆ m_actions

◆ m_boardAdapter

BOARD_ADAPTER PANEL_PREVIEW_3D_MODEL::m_boardAdapter
private

Definition at line 193 of file panel_preview_3d_model.h.

Referenced by GetAdapter(), loadSettings(), and PANEL_PREVIEW_3D_MODEL().

◆ m_boardThickness

UNIT_BINDER PANEL_PREVIEW_3D_MODEL::m_boardThickness
private

Index into m_parentInfoList.

Definition at line 203 of file panel_preview_3d_model.h.

Referenced by SetSelectedModel(), and updateBoardThickness().

◆ m_boardThicknessCtrl

wxTextCtrl* PANEL_PREVIEW_3D_MODEL_BASE::m_boardThicknessCtrl
protectedinherited

◆ m_boardThicknessUnits

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_boardThicknessUnits
protectedinherited

◆ m_bpUpdate

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpUpdate
protectedinherited

◆ m_bpvBack

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpvBack
protectedinherited

◆ m_bpvBottom

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpvBottom
protectedinherited

◆ m_bpvFront

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpvFront
protectedinherited

◆ m_bpvISO

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpvISO
protectedinherited

◆ m_bpvLeft

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpvLeft
protectedinherited

◆ m_bpvRight

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpvRight
protectedinherited

◆ m_bpvTop

wxBitmapButton* PANEL_PREVIEW_3D_MODEL_BASE::m_bpvTop
protectedinherited

◆ m_currentCamera

CAMERA& PANEL_PREVIEW_3D_MODEL::m_currentCamera
private

Definition at line 194 of file panel_preview_3d_model.h.

Referenced by GetCurrentCamera(), PANEL_PREVIEW_3D_MODEL(), and View3DISO().

◆ m_dragAction

MOUSE_DRAG_ACTION TOOLS_HOLDER::m_dragAction
protectedinherited

◆ m_dummyBoard

BOARD* PANEL_PREVIEW_3D_MODEL::m_dummyBoard
private

◆ m_dummyFootprint

FOOTPRINT* PANEL_PREVIEW_3D_MODEL::m_dummyFootprint
private

Definition at line 198 of file panel_preview_3d_model.h.

Referenced by PANEL_PREVIEW_3D_MODEL(), and UpdateDummyFootprint().

◆ m_dummySelection

SELECTION TOOLS_HOLDER::m_dummySelection
protectedinherited

Definition at line 174 of file tools_holder.h.

Referenced by TOOLS_HOLDER::GetCurrentSelection().

◆ m_immediateActions

bool TOOLS_HOLDER::m_immediateActions
protectedinherited

◆ m_infobar

WX_INFOBAR* PANEL_PREVIEW_3D_MODEL::m_infobar
private

Definition at line 192 of file panel_preview_3d_model.h.

Referenced by PANEL_PREVIEW_3D_MODEL().

◆ m_moveWarpsCursor

bool TOOLS_HOLDER::m_moveWarpsCursor
protectedinherited

◆ m_opacity

wxSlider* PANEL_PREVIEW_3D_MODEL_BASE::m_opacity
protectedinherited

◆ m_parentModelList

std::vector<FP_3DMODEL>* PANEL_PREVIEW_3D_MODEL::m_parentModelList
private

◆ m_previewPane

◆ m_selected

int PANEL_PREVIEW_3D_MODEL::m_selected
private

◆ m_SizerPanelView

wxBoxSizer* PANEL_PREVIEW_3D_MODEL_BASE::m_SizerPanelView
protectedinherited

◆ m_spinXoffset

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinXoffset
protectedinherited

◆ m_spinXrot

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinXrot
protectedinherited

◆ m_spinXscale

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinXscale
protectedinherited

◆ m_spinYoffset

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinYoffset
protectedinherited

◆ m_spinYrot

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinYrot
protectedinherited

◆ m_spinYscale

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinYscale
protectedinherited

◆ m_spinZoffset

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinZoffset
protectedinherited

◆ m_spinZrot

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinZrot
protectedinherited

◆ m_spinZscale

wxSpinButton* PANEL_PREVIEW_3D_MODEL_BASE::m_spinZscale
protectedinherited

◆ m_staticText1

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText1
protectedinherited

◆ m_staticText11

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText11
protectedinherited

◆ m_staticText12

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText12
protectedinherited

◆ m_staticText2

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText2
protectedinherited

◆ m_staticText21

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText21
protectedinherited

◆ m_staticText22

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText22
protectedinherited

◆ m_staticText3

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText3
protectedinherited

◆ m_staticText31

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText31
protectedinherited

◆ m_staticText32

wxStaticText* PANEL_PREVIEW_3D_MODEL_BASE::m_staticText32
protectedinherited

◆ m_toolDispatcher

◆ m_toolManager

TOOL_MANAGER* TOOLS_HOLDER::m_toolManager
protectedinherited

Definition at line 170 of file tools_holder.h.

Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::ActivateGalCanvas(), SCH_EDIT_FRAME::AddJunction(), EDA_BASE_FRAME::AddStandardHelpMenu(), EDA_DRAW_FRAME::AddStandardSubMenus(), SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDIT_FRAME::canCloseWindow(), SCH_EDIT_FRAME::CheckAnnotate(), GERBVIEW_FRAME::Clear_DrawLayers(), EDA_DRAW_FRAME::CommonSettingsChanged(), PCB_EDIT_FRAME::CommonSettingsChanged(), SCH_EDIT_FRAME::ConvertPart(), EDA_3D_VIEWER_FRAME::CreateMenuBar(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), SYMBOL_VIEWER_FRAME::DClickOnSymbolList(), SCH_EDIT_FRAME::DeleteAnnotation(), SCH_EDIT_FRAME::DeleteJunction(), SCH_EDIT_FRAME::DisplayCurrentSheet(), SCH_EDIT_FRAME::doCloseWindow(), GERBVIEW_FRAME::doCloseWindow(), EDA_BASE_FRAME::DoWithAcceptedFiles(), GERBVIEW_FRAME::DoWithAcceptedFiles(), KICAD_MANAGER_FRAME::DoWithAcceptedFiles(), SYMBOL_EDIT_FRAME::emptyScreen(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), SCH_EDIT_FRAME::ExecuteRemoteCommand(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), SCH_EDIT_FRAME::FixupJunctions(), DISPLAY_FOOTPRINTS_FRAME::GetCurrentSelection(), SCH_EDIT_FRAME::GetCurrentSelection(), SYMBOL_EDIT_FRAME::GetCurrentSelection(), SYMBOL_VIEWER_FRAME::GetCurrentSelection(), GERBVIEW_FRAME::GetCurrentSelection(), PL_EDITOR_FRAME::GetCurrentSelection(), FOOTPRINT_EDIT_FRAME::GetCurrentSelection(), FOOTPRINT_VIEWER_FRAME::GetCurrentSelection(), PCB_EDIT_FRAME::GetCurrentSelection(), SYMBOL_EDIT_FRAME::GetSymbolFromRedoList(), SYMBOL_EDIT_FRAME::GetSymbolFromUndoList(), TOOLS_HOLDER::GetToolManager(), EDA_DRAW_FRAME::GetUnitPair(), SYMBOL_EDIT_FRAME::HardRedraw(), PL_EDITOR_FRAME::HardRedraw(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::initScreenZoom(), SCH_EDIT_FRAME::KiwayMailIn(), PCB_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), PCB_EDIT_FRAME::onBoardLoaded(), FOOTPRINT_EDIT_FRAME::OnEditItemRequest(), PCB_EDIT_FRAME::OnEditItemRequest(), SCH_EDIT_FRAME::OnFindDialogClose(), SCH_EDIT_FRAME::OnImportProject(), PL_EDITOR_FRAME::OnNewDrawingSheet(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), EDA_DRAW_FRAME::OnSelectGrid(), SYMBOL_EDIT_FRAME::OnSelectUnit(), EDA_DRAW_FRAME::OnSelectZoom(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREVIEW_3D_MODEL(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), TOOLS_HOLDER::PopTool(), TOOLS_HOLDER::PushTool(), PCB_BASE_EDIT_FRAME::PutDataInPreviousState(), CVPCB_MAINFRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateMenuBar(), SYMBOL_EDIT_FRAME::ReCreateMenuBar(), SYMBOL_VIEWER_FRAME::ReCreateMenuBar(), GERBVIEW_FRAME::ReCreateMenuBar(), KICAD_MANAGER_FRAME::ReCreateMenuBar(), PL_EDITOR_FRAME::ReCreateMenuBar(), FOOTPRINT_EDIT_FRAME::ReCreateMenuBar(), FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar(), PCB_EDIT_FRAME::ReCreateMenuBar(), SCH_EDIT_FRAME::ReCreateOptToolbar(), SYMBOL_EDIT_FRAME::ReCreateOptToolbar(), FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar(), PCB_EDIT_FRAME::ReCreateOptToolbar(), PCB_EDIT_FRAME::ReCreateVToolbar(), SCH_BASE_FRAME::RefreshZoomDependentItems(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList(), PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList(), SCH_EDIT_FRAME::RollbackSchematicFromUndo(), SYMBOL_EDIT_FRAME::RollbackSymbolFromUndo(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SYMBOL_EDIT_FRAME::saveLibrary(), EDA_DRAW_FRAME::SaveSettings(), SCH_BASE_FRAME::SCH_BASE_FRAME(), SCH_EDIT_FRAME::SchematicCleanUp(), GERBVIEW_FRAME::SetActiveLayer(), FOOTPRINT_EDIT_FRAME::SetActiveLayer(), PCB_EDIT_FRAME::SetActiveLayer(), PCB_BASE_EDIT_FRAME::SetBoard(), SYMBOL_EDIT_FRAME::SetCurSymbol(), SCH_EDIT_FRAME::SetScreen(), CVPCB_MAINFRAME::setupTools(), SCH_EDIT_FRAME::setupTools(), SYMBOL_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), GERBVIEW_FRAME::setupTools(), KICAD_MANAGER_FRAME::setupTools(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), PCB_EDIT_FRAME::setupTools(), EDA_3D_VIEWER_FRAME::setupUIConditions(), CVPCB_MAINFRAME::setupUIConditions(), DISPLAY_FOOTPRINTS_FRAME::setupUIConditions(), SCH_EDIT_FRAME::setupUIConditions(), SYMBOL_EDIT_FRAME::setupUIConditions(), SYMBOL_VIEWER_FRAME::setupUIConditions(), GERBVIEW_FRAME::setupUIConditions(), KICAD_MANAGER_FRAME::setupUIConditions(), PL_EDITOR_FRAME::setupUIConditions(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), FOOTPRINT_VIEWER_FRAME::setupUIConditions(), PCB_EDIT_FRAME::setupUIConditions(), EDA_DRAW_FRAME::setupUnits(), PCB_BASE_EDIT_FRAME::ShowBitmapPropertiesDialog(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), TOOLS_HOLDER::ShowChangedLanguage(), PCB_EDIT_FRAME::ShowFindDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), EDA_DRAW_FRAME::ToggleUserUnits(), PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event(), EDA_DRAW_FRAME::unitsChangeRefresh(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), SCH_EDIT_FRAME::UpdateHierarchyNavigator(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), PCB_EDIT_FRAME::UpdateViaSizeSelectBox(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_EDIT_FRAME::UpdateView(), FOOTPRINT_VIEWER_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), EDA_DRAW_FRAME::Zoom_Automatique(), CVPCB_MAINFRAME::~CVPCB_MAINFRAME(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), EDA_DRAW_FRAME::~EDA_DRAW_FRAME(), FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME(), GERBVIEW_FRAME::~GERBVIEW_FRAME(), KICAD_MANAGER_FRAME::~KICAD_MANAGER_FRAME(), PCB_EDIT_FRAME::~PCB_EDIT_FRAME(), PL_EDITOR_FRAME::~PL_EDITOR_FRAME(), SCH_EDIT_FRAME::~SCH_EDIT_FRAME(), SYMBOL_EDIT_FRAME::~SYMBOL_EDIT_FRAME(), and SYMBOL_VIEWER_FRAME::~SYMBOL_VIEWER_FRAME().

◆ m_toolStack

std::vector<std::string> TOOLS_HOLDER::m_toolStack
protectedinherited

◆ m_trackBallCamera

TRACK_BALL PANEL_PREVIEW_3D_MODEL::m_trackBallCamera
private

Definition at line 195 of file panel_preview_3d_model.h.

◆ m_userUnits

EDA_UNITS PANEL_PREVIEW_3D_MODEL::m_userUnits
private

◆ xoff

◆ xrot

◆ xscale

◆ yoff

◆ yrot

◆ yscale

◆ zoff

◆ zrot

◆ zscale


The documentation for this class was generated from the following files: