KiCad PCB EDA Suite
panel_preview_3d_model.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 2015 Cirilo Bernardo <cirilo.bernardo@gmail.com>
6  * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
7  * Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #include "panel_preview_3d_model.h"
29 #include <tool/tool_manager.h>
30 #include <tool/tool_dispatcher.h>
31 #include <tools/eda_3d_actions.h>
33 #include <base_units.h>
34 #include <bitmaps.h>
35 #include <board.h>
37 #include <gal/dpi_scaling.h>
38 #include <pgm_base.h>
41 #include <widgets/infobar.h>
42 #include <eda_3d_viewer_settings.h>
43 
45  FOOTPRINT* aFootprint,
46  std::vector<FP_3DMODEL>* aParentModelList ) :
47  PANEL_PREVIEW_3D_MODEL_BASE( aParent, wxID_ANY ),
48  m_previewPane( nullptr ),
49  m_infobar( nullptr ),
50  m_boardAdapter(),
51  m_currentCamera( m_trackBallCamera ),
52  m_trackBallCamera( RANGE_SCALE_3D, 0.85f )
53 {
54  m_userUnits = aFrame->GetUserUnits();
55 
56  m_dummyBoard = new BOARD();
57 
58  // This board will only be used to hold a footprint for viewing
60 
61  m_selected = -1;
62 
63  // Set the bitmap of 3D view buttons:
64  m_bpvTop->SetBitmap( KiBitmap( BITMAPS::axis3d_top ) );
65  m_bpvFront->SetBitmap( KiBitmap( BITMAPS::axis3d_front ) );
66  m_bpvBack->SetBitmap( KiBitmap( BITMAPS::axis3d_back ) );
67  m_bpvLeft->SetBitmap( KiBitmap( BITMAPS::axis3d_left ) );
68  m_bpvRight->SetBitmap( KiBitmap( BITMAPS::axis3d_right ) );
70  m_bpvISO->SetBitmap( KiBitmap( BITMAPS::ortho ) );
71  m_bpUpdate->SetBitmap( KiBitmap( BITMAPS::reload ) );
72 
73  // Set the min and max values of spin buttons (mandatory on Linux)
74  // They are not used, so they are set to min and max 32 bits int values
75  // (the min and max values supported by a wxSpinButton)
76  // It avoids blocking the up or down arrows when reaching this limit after
77  // a few clicks.
78  wxSpinButton* spinButtonList[] =
79  {
83  };
84 
85  for( wxSpinButton* button : spinButtonList )
86  button->SetRange(INT_MIN, INT_MAX );
87 
88  m_parentModelList = aParentModelList;
89 
90  m_dummyFootprint = new FOOTPRINT( *aFootprint );
92 
93  // Create the 3D canvas
94  m_previewPane = new EDA_3D_CANVAS( this,
97  aFrame->Prj().Get3DCacheManager() );
98 
100  loadSettings();
101 
104 
105  // Create the manager
107  m_toolManager->SetEnvironment( m_dummyBoard, nullptr, nullptr, nullptr, this );
108 
109  m_actions = new EDA_3D_ACTIONS();
112 
113  // Register tools
116 
117  // Run the viewer control tool, it is supposed to be always active
118  m_toolManager->InvokeTool( "3DViewer.Control" );
119 
120  m_infobar = new WX_INFOBAR( this );
122 
123  m_SizerPanelView->Add( m_infobar, 0, wxEXPAND, 0 );
124  m_SizerPanelView->Add( m_previewPane, 1, wxEXPAND, 5 );
125 
126  for( wxEventType eventType : { wxEVT_MENU_OPEN, wxEVT_MENU_CLOSE, wxEVT_MENU_HIGHLIGHT } )
127  Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
128  this );
129 
130 #ifdef __WXOSX__
131  // Call layout once to get the proper button sizes after the bitmaps have been set
132  Layout();
133 
134  // The rounded-button style used has a small border on the left/right sides.
135  // This is automatically fixed in wx for buttons with a bitmap < 20, but not
136  // when the bitmap is set to be 26x26.
137  wxSize borderFix = wxSize( 4, 4 );
138 
139  m_bpvTop->SetMinSize( m_bpvTop->GetSize() + borderFix );
140  m_bpvFront->SetMinSize( m_bpvFront->GetSize() + borderFix );
141  m_bpvBack->SetMinSize( m_bpvBack->GetSize() + borderFix );
142  m_bpvLeft->SetMinSize( m_bpvLeft->GetSize() + borderFix );
143  m_bpvRight->SetMinSize( m_bpvRight->GetSize() + borderFix );
144  m_bpvBottom->SetMinSize( m_bpvBottom->GetSize() + borderFix );
145  m_bpvISO->SetMinSize( m_bpvISO->GetSize() + borderFix );
146  m_bpUpdate->SetMinSize( m_bpUpdate->GetSize() + borderFix );
147 #endif
148 }
149 
150 
152 {
153  delete m_dummyBoard;
154  delete m_previewPane;
155 }
156 
157 
158 void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
159 {
160  if( !m_toolDispatcher )
161  aEvent.Skip();
162  else
164 }
165 
166 
168 {
169  wxCHECK_RET( m_previewPane, "Cannot load settings to null canvas" );
170 
171  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
172 
173  const DPI_SCALING dpi{ settings, this };
174  m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
175 
176  // TODO(JE) use all control options
178 
179  COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
180 
181  if( colors )
182  {
183  auto set =
184  [] ( const COLOR4D& aColor, SFVEC4F& aTarget )
185  {
186  aTarget.r = aColor.r;
187  aTarget.g = aColor.g;
188  aTarget.b = aColor.b;
189  aTarget.a = aColor.a;
190  };
191 
201  }
202 
203  EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
204 
205  if( cfg )
206  {
209  m_boardAdapter.SetMaterialMode( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );
210 
214  }
215 }
216 
217 
223 static double rotationFromString( const wxString& aValue )
224 {
225  double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) / 10.0;
226 
227  if( rotation > MAX_ROTATION )
228  {
229  int n = KiROUND( rotation / MAX_ROTATION );
230  rotation -= MAX_ROTATION * n;
231  }
232  else if( rotation < -MAX_ROTATION )
233  {
234  int n = KiROUND( -rotation / MAX_ROTATION );
235  rotation += MAX_ROTATION * n;
236  }
237 
238  return rotation;
239 }
240 
241 
243 {
244  return wxString::Format( "%.4f", aValue );
245 }
246 
247 
249 {
250  return wxString::Format( "%.2f %s", aValue, GetAbbreviatedUnitsLabel( EDA_UNITS::DEGREES ) );
251 }
252 
253 
255 {
256  // Convert from internal units (mm) to user units
258  aValue /= 25.4f;
259 
260  return wxString::Format( "%.4f %s", aValue, GetAbbreviatedUnitsLabel( m_userUnits ) );
261 }
262 
263 
265 {
266  if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
267  {
268  m_selected = idx;
269  const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
270 
271  // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
272  // don't want to generate wxEVT_GRID_CELL_CHANGED events.
273  xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
274  yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
275  zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
276 
277  xrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.x ) );
278  yrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.y ) );
279  zrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.z ) );
280 
281  xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
282  yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
283  zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
284 
285  m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
286  }
287  else
288  {
289  m_selected = -1;
290 
291  xscale->ChangeValue( wxEmptyString );
292  yscale->ChangeValue( wxEmptyString );
293  zscale->ChangeValue( wxEmptyString );
294 
295  xrot->ChangeValue( wxEmptyString );
296  yrot->ChangeValue( wxEmptyString );
297  zrot->ChangeValue( wxEmptyString );
298 
299  xoff->ChangeValue( wxEmptyString );
300  yoff->ChangeValue( wxEmptyString );
301  zoff->ChangeValue( wxEmptyString );
302 
303  m_opacity->SetValue( 100 );
304  }
305 }
306 
307 
308 void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
309 {
310  if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
311  {
312  // Write settings back to the parent
313  FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
314 
315  modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() );
316  modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() );
317  modelInfo->m_Scale.z = DoubleValueFromString( EDA_UNITS::UNSCALED, zscale->GetValue() );
318 
319  modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
320  modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
321  modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
322 
323  modelInfo->m_Offset.x = DoubleValueFromString( m_userUnits, xoff->GetValue() ) / IU_PER_MM;
324  modelInfo->m_Offset.y = DoubleValueFromString( m_userUnits, yoff->GetValue() ) / IU_PER_MM;
325  modelInfo->m_Offset.z = DoubleValueFromString( m_userUnits, zoff->GetValue() ) / IU_PER_MM;
326 
327  // Update the dummy footprint for the preview
328  UpdateDummyFootprint( false );
329  }
330 }
331 
332 
333 void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
334 {
335  if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
336  {
337  // Write settings back to the parent
338  FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
339 
340  modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
341 
342  // Update the dummy footprint for the preview
343  UpdateDummyFootprint( false );
344  }
345 }
346 
347 
348 void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
349 {
350  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
351 
352  wxTextCtrl * textCtrl = xscale;
353 
354  if( spinCtrl == m_spinYscale )
355  textCtrl = yscale;
356  else if( spinCtrl == m_spinZscale )
357  textCtrl = zscale;
358 
359  double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
360 
361  curr_value += ( SCALE_INCREMENT * aSign );
362  curr_value = std::max( 1/MAX_SCALE, curr_value );
363  curr_value = std::min( curr_value, MAX_SCALE );
364 
365  textCtrl->SetValue( formatScaleValue( curr_value ) );
366 }
367 
368 
369 void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
370 {
371  wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
372  wxTextCtrl* textCtrl = xrot;
373 
374  if( spinCtrl == m_spinYrot )
375  textCtrl = yrot;
376  else if( spinCtrl == m_spinZrot )
377  textCtrl = zrot;
378 
379  double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
380 
381  curr_value += ( ROTATION_INCREMENT * aSign );
382  curr_value = std::max( -MAX_ROTATION, curr_value );
383  curr_value = std::min( curr_value, MAX_ROTATION );
384 
385  textCtrl->SetValue( formatRotationValue( curr_value ) );
386 }
387 
388 
389 void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
390 {
391  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
392 
393  wxTextCtrl * textCtrl = xoff;
394 
395  if( spinCtrl == m_spinYoffset )
396  textCtrl = yoff;
397  else if( spinCtrl == m_spinZoffset )
398  textCtrl = zoff;
399 
400  double step = OFFSET_INCREMENT_MM;
401 
403  step = OFFSET_INCREMENT_MIL/1000.0;
404 
405  double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
406 
407  curr_value += ( step * aSign );
408  curr_value = std::max( -MAX_OFFSET, curr_value );
409  curr_value = std::min( curr_value, MAX_OFFSET );
410 
411  textCtrl->SetValue( formatOffsetValue( curr_value ) );
412 }
413 
414 
415 void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale( wxMouseEvent& event )
416 {
417  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
418 
419  double step = SCALE_INCREMENT;
420 
421  if( event.ShiftDown( ) )
422  step = SCALE_INCREMENT_FINE;
423 
424  if( event.GetWheelRotation() >= 0 )
425  step = -step;
426 
427  double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
428 
429  curr_value += step;
430  curr_value = std::max( 1/MAX_SCALE, curr_value );
431  curr_value = std::min( curr_value, MAX_SCALE );
432 
433  textCtrl->SetValue( formatScaleValue( curr_value ) );
434 }
435 
436 
437 void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
438 {
439  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
440 
441  double step = ROTATION_INCREMENT_WHEEL;
442 
443  if( event.ShiftDown( ) )
445 
446  if( event.GetWheelRotation() >= 0 )
447  step = -step;
448 
449  double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
450 
451  curr_value += step;
452  curr_value = std::max( -MAX_ROTATION, curr_value );
453  curr_value = std::min( curr_value, MAX_ROTATION );
454 
455  textCtrl->SetValue( formatRotationValue( curr_value ) );
456 }
457 
458 
460 {
461  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
462 
463  double step = OFFSET_INCREMENT_MM;
464 
465  if( event.ShiftDown( ) )
467 
469  {
470  step = OFFSET_INCREMENT_MIL/1000.0;
471 
472  if( event.ShiftDown( ) )
473  step = OFFSET_INCREMENT_MIL_FINE/1000.0;
474  }
475 
476  if( event.GetWheelRotation() >= 0 )
477  step = -step;
478 
479  double curr_value = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
480 
481  curr_value += step;
482  curr_value = std::max( -MAX_OFFSET, curr_value );
483  curr_value = std::min( curr_value, MAX_OFFSET );
484 
485  textCtrl->SetValue( formatOffsetValue( curr_value ) );
486 }
487 
488 
490 {
491  m_dummyFootprint->Models().clear();
492 
493  for( FP_3DMODEL& model : *m_parentModelList )
494  {
495  if( model.m_Show )
496  m_dummyFootprint->Models().push_back( model );
497  }
498 
499  if( aReloadRequired )
501 
503 }
void SetSelectedModel(int idx)
Set the currently selected index in the model list so that the scale/rotation/offset controls can be ...
EDA_UNITS m_userUnits
Index into m_parentInfoList.
#define OFFSET_INCREMENT_MM_FINE
SFVEC4F m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
std::list< FP_3DMODEL > & Models()
Definition: footprint.h:182
void UpdateDummyFootprint(bool aRelaodRequired=true)
Copy shapes from the current shape list which are flagged for preview to the copy of footprint that i...
Implementation of conversion functions that require both schematic and board internal units.
#define OFFSET_INCREMENT_MIL_FINE
void doIncrementRotation(wxSpinEvent &aEvent, double aSign)
#define ROTATION_INCREMENT_WHEEL_FINE
static constexpr double IU_PER_MM
Mock up a conversion function.
wxString formatOffsetValue(double aValue)
glm::vec4 SFVEC4F
Definition: xv3d_types.h:46
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
Set the status of a flag.
SFVEC4F m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
EDA_3D_ACTIONS.
void SetProjectionMode(int aMode)
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:48
SFVEC4F m_BoardBodyColor
in realistic mode: FR4 board color
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
double g
Green component.
Definition: color4d.h:378
SFVEC4F m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
wxString GetAbbreviatedUnitsLabel(EDA_UNITS aUnit, EDA_DATA_TYPE aType)
Get the units string for a given units type.
Definition: base_units.cpp:424
std::vector< FP_3DMODEL > * m_parentModelList
Declaration of the cogl_att_list class.
#define ROTATION_INCREMENT
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
void SetAnimationEnabled(bool aEnable)
Enable or disable camera animation when switching to a pre-defined view.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
static const int * GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode)
Get a list of attributes to pass to wxGLCanvas.
VECTOR3D m_Offset
3D model offset (mm)
Definition: footprint.h:95
bool InvokeTool(TOOL_ID aToolId)
Call a tool by sending a tool activation event to tool of given ID.
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:36
double b
Blue component.
Definition: color4d.h:379
void updateOrientation(wxCommandEvent &event) override
It will receive the events from editing the fields.
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
void onOpacitySlider(wxCommandEvent &event) override
Master controller class:
Definition: tool_manager.h:54
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:608
void onMouseWheelScale(wxMouseEvent &event) override
double a
Alpha component.
Definition: color4d.h:380
void SetInfoBar(WX_INFOBAR *aInfoBar)
Definition: eda_3d_canvas.h:79
SFVEC4F m_BgColorTop
background top color
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void onMouseWheelRot(wxMouseEvent &event) override
#define OFFSET_INCREMENT_MM
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
EDA_3D_CONTROLLER.
#define OFFSET_INCREMENT_MIL
VECTOR3D m_Scale
3D model scaling factor (dimensionless)
Definition: footprint.h:93
wxString formatRotationValue(double aValue)
#define MAX_ROTATION
ACTIONS * m_actions
Definition: tools_holder.h:159
void SetMaterialMode(MATERIAL_MODE aMaterialMode) noexcept
SFVEC4F m_BgColorBot
background bottom color
double m_Opacity
Definition: footprint.h:96
wxString formatScaleValue(double aValue)
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
void SetMovingSpeedMultiplier(int aMultiplier)
Set the camera animation moving speed multiplier option.
#define MAX_SCALE
void SetRenderEngine(RENDER_ENGINE aRenderEngine) noexcept
TOOL_DISPATCHER * m_toolDispatcher
Definition: tools_holder.h:160
#define MAX_OFFSET
static double rotationFromString(const wxString &aValue)
Ensure -MAX_ROTATION <= rotation <= MAX_ROTATION.
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
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:73
COLOR4D GetColor(int aLayer) const
PANEL_PREVIEW_3D_MODEL(wxWindow *aParent, PCB_BASE_FRAME *aFrame, FOOTPRINT *aFootprint, std::vector< FP_3DMODEL > *aParentModelList)
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:158
see class PGM_BASE
VECTOR3D m_Rotation
3D model rotation (degrees)
Definition: footprint.h:94
void loadSettings()
Load 3D relevant settings from the user configuration.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
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).
SFVEC4F m_CopperColor
in realistic mode: copper color
void doIncrementScale(wxSpinEvent &aEvent, double aSign)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
void OnMenuEvent(wxMenuEvent &aEvent)
The TOOL_DISPATCHER needs these to work around some issues in wxWidgets where the menu events aren't ...
void onMouseWheelOffset(wxMouseEvent &event) override
void ReloadRequest(BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
Color settings are a bit different than most of the settings objects in that there can be more than o...
SFVEC4F m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
void InitTools()
Initializes all registered tools.
double r
Red component.
Definition: color4d.h:377
double DoubleValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function DoubleValueFromString converts aTextValue to a double.
Definition: base_units.cpp:307
#define SCALE_INCREMENT_FINE
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:62
Class PANEL_PREVIEW_3D_MODEL_BASE.
#define ROTATION_INCREMENT_WHEEL
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void doIncrementOffset(wxSpinEvent &aEvent, double aSign)
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:203
void RegisterTool(TOOL_BASE *aTool)
Add a tool to the manager set and sets it up.
#define SCALE_INCREMENT
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103