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 <[email protected]>
5  * Copyright (C) 2015 Cirilo Bernardo <[email protected]>
6  * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
7  * Copyright (C) 2015-2022 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( 2 * RANGE_SCALE_3D )
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  {
128  Connect( eventType, wxMenuEventHandler( PANEL_PREVIEW_3D_MODEL::OnMenuEvent ), nullptr,
129  this );
130  }
131 
132 #ifdef __WXOSX__
133  // Call layout once to get the proper button sizes after the bitmaps have been set
134  Layout();
135 
136  // The rounded-button style used has a small border on the left/right sides.
137  // This is automatically fixed in wx for buttons with a bitmap < 20, but not
138  // when the bitmap is set to be 26x26.
139  wxSize borderFix = wxSize( 4, 4 );
140 
141  m_bpvTop->SetMinSize( m_bpvTop->GetSize() + borderFix );
142  m_bpvFront->SetMinSize( m_bpvFront->GetSize() + borderFix );
143  m_bpvBack->SetMinSize( m_bpvBack->GetSize() + borderFix );
144  m_bpvLeft->SetMinSize( m_bpvLeft->GetSize() + borderFix );
145  m_bpvRight->SetMinSize( m_bpvRight->GetSize() + borderFix );
146  m_bpvBottom->SetMinSize( m_bpvBottom->GetSize() + borderFix );
147  m_bpvISO->SetMinSize( m_bpvISO->GetSize() + borderFix );
148  m_bpUpdate->SetMinSize( m_bpUpdate->GetSize() + borderFix );
149 #endif
150 }
151 
152 
154 {
155  delete m_dummyBoard;
156  delete m_previewPane;
157 }
158 
159 
160 void PANEL_PREVIEW_3D_MODEL::OnMenuEvent( wxMenuEvent& aEvent )
161 {
162  if( !m_toolDispatcher )
163  aEvent.Skip();
164  else
166 }
167 
168 
170 {
171  wxCHECK_RET( m_previewPane, wxT( "Cannot load settings to null canvas" ) );
172 
173  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
174 
175  const DPI_SCALING dpi{ settings, this };
176  m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
177 
178  // TODO(JE) use all control options
180 
181  COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
182 
183  if( colors )
184  {
185  auto set =
186  [] ( const COLOR4D& aColor, SFVEC4F& aTarget )
187  {
188  aTarget.r = aColor.r;
189  aTarget.g = aColor.g;
190  aTarget.b = aColor.b;
191  aTarget.a = aColor.a;
192  };
193 
203  }
204 
205  EDA_3D_VIEWER_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
206 
207  if( cfg )
208  {
211  m_boardAdapter.SetMaterialMode( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );
212 
216  }
217 }
218 
219 
225 static double rotationFromString( const wxString& aValue )
226 {
227  double rotation = DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) / 10.0;
228 
229  if( rotation > MAX_ROTATION )
230  {
231  int n = KiROUND( rotation / MAX_ROTATION );
232  rotation -= MAX_ROTATION * n;
233  }
234  else if( rotation < -MAX_ROTATION )
235  {
236  int n = KiROUND( -rotation / MAX_ROTATION );
237  rotation += MAX_ROTATION * n;
238  }
239 
240  return rotation;
241 }
242 
243 
245 {
246  return wxString::Format( wxT( "%.4f" ),
247  aValue );
248 }
249 
250 
252 {
253  return wxString::Format( wxT( "%.2f %s" ),
254  aValue,
256 }
257 
258 
260 {
261  // Convert from internal units (mm) to user units
263  aValue /= 25.4;
264  else if( m_userUnits == EDA_UNITS::MILS )
265  aValue /= 25.4 / 1e3;
266 
267  return wxString::Format( wxT( "%.6f %s" ),
268  aValue,
270 }
271 
272 
274 {
275  if( m_parentModelList && idx >= 0 && idx < (int) m_parentModelList->size() )
276  {
277  m_selected = idx;
278  const FP_3DMODEL& modelInfo = m_parentModelList->at( (unsigned) m_selected );
279 
280  // Use ChangeValue() instead of SetValue(). It's not the user making the change, so we
281  // don't want to generate wxEVT_GRID_CELL_CHANGED events.
282  xscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.x ) );
283  yscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.y ) );
284  zscale->ChangeValue( formatScaleValue( modelInfo.m_Scale.z ) );
285 
286  xrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.x ) );
287  yrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.y ) );
288  zrot->ChangeValue( formatRotationValue( modelInfo.m_Rotation.z ) );
289 
290  xoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.x ) );
291  yoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.y ) );
292  zoff->ChangeValue( formatOffsetValue( modelInfo.m_Offset.z ) );
293 
294  m_opacity->SetValue( modelInfo.m_Opacity * 100.0 );
295  }
296  else
297  {
298  m_selected = -1;
299 
300  xscale->ChangeValue( wxEmptyString );
301  yscale->ChangeValue( wxEmptyString );
302  zscale->ChangeValue( wxEmptyString );
303 
304  xrot->ChangeValue( wxEmptyString );
305  yrot->ChangeValue( wxEmptyString );
306  zrot->ChangeValue( wxEmptyString );
307 
308  xoff->ChangeValue( wxEmptyString );
309  yoff->ChangeValue( wxEmptyString );
310  zoff->ChangeValue( wxEmptyString );
311 
312  m_opacity->SetValue( 100 );
313  }
314 }
315 
316 
317 void PANEL_PREVIEW_3D_MODEL::updateOrientation( wxCommandEvent &event )
318 {
319  if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
320  {
321  // Write settings back to the parent
322  FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
323 
324  modelInfo->m_Scale.x = DoubleValueFromString( EDA_UNITS::UNSCALED, xscale->GetValue() );
325  modelInfo->m_Scale.y = DoubleValueFromString( EDA_UNITS::UNSCALED, yscale->GetValue() );
326  modelInfo->m_Scale.z = DoubleValueFromString( EDA_UNITS::UNSCALED, zscale->GetValue() );
327 
328  modelInfo->m_Rotation.x = rotationFromString( xrot->GetValue() );
329  modelInfo->m_Rotation.y = rotationFromString( yrot->GetValue() );
330  modelInfo->m_Rotation.z = rotationFromString( zrot->GetValue() );
331 
332  modelInfo->m_Offset.x = DoubleValueFromString( m_userUnits, xoff->GetValue() ) / IU_PER_MM;
333  modelInfo->m_Offset.y = DoubleValueFromString( m_userUnits, yoff->GetValue() ) / IU_PER_MM;
334  modelInfo->m_Offset.z = DoubleValueFromString( m_userUnits, zoff->GetValue() ) / IU_PER_MM;
335 
336  // Update the dummy footprint for the preview
337  UpdateDummyFootprint( false );
338  }
339 }
340 
341 
342 void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
343 {
344  if( m_parentModelList && m_selected >= 0 && m_selected < (int) m_parentModelList->size() )
345  {
346  // Write settings back to the parent
347  FP_3DMODEL* modelInfo = &m_parentModelList->at( (unsigned) m_selected );
348 
349  modelInfo->m_Opacity = m_opacity->GetValue() / 100.0;
350 
351  // Update the dummy footprint for the preview
352  UpdateDummyFootprint( false );
353  }
354 }
355 
356 
357 void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign )
358 {
359  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
360 
361  wxTextCtrl * textCtrl = xscale;
362 
363  if( spinCtrl == m_spinYscale )
364  textCtrl = yscale;
365  else if( spinCtrl == m_spinZscale )
366  textCtrl = zscale;
367 
368  double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
369 
370  curr_value += ( SCALE_INCREMENT * aSign );
371  curr_value = std::max( 1/MAX_SCALE, curr_value );
372  curr_value = std::min( curr_value, MAX_SCALE );
373 
374  textCtrl->SetValue( formatScaleValue( curr_value ) );
375 }
376 
377 
378 void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aSign )
379 {
380  wxSpinButton* spinCtrl = (wxSpinButton*) aEvent.GetEventObject();
381  wxTextCtrl* textCtrl = xrot;
382 
383  if( spinCtrl == m_spinYrot )
384  textCtrl = yrot;
385  else if( spinCtrl == m_spinZrot )
386  textCtrl = zrot;
387 
388  double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
389 
390  curr_value += ( ROTATION_INCREMENT * aSign );
391  curr_value = std::max( -MAX_ROTATION, curr_value );
392  curr_value = std::min( curr_value, MAX_ROTATION );
393 
394  textCtrl->SetValue( formatRotationValue( curr_value ) );
395 }
396 
397 
398 void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign )
399 {
400  wxSpinButton* spinCtrl = (wxSpinButton*) event.GetEventObject();
401 
402  wxTextCtrl * textCtrl = xoff;
403 
404  if( spinCtrl == m_spinYoffset )
405  textCtrl = yoff;
406  else if( spinCtrl == m_spinZoffset )
407  textCtrl = zoff;
408 
409  double step_mm = OFFSET_INCREMENT_MM;
410  double curr_value_mm = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
411 
413  {
414  step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
415  }
416 
417  curr_value_mm += ( step_mm * aSign );
418  curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
419  curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
420 
421  textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
422 }
423 
424 
425 void PANEL_PREVIEW_3D_MODEL::onMouseWheelScale( wxMouseEvent& event )
426 {
427  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
428 
429  double step = SCALE_INCREMENT;
430 
431  if( event.ShiftDown( ) )
432  step = SCALE_INCREMENT_FINE;
433 
434  if( event.GetWheelRotation() >= 0 )
435  step = -step;
436 
437  double curr_value = DoubleValueFromString( EDA_UNITS::UNSCALED, textCtrl->GetValue() );
438 
439  curr_value += step;
440  curr_value = std::max( 1/MAX_SCALE, curr_value );
441  curr_value = std::min( curr_value, MAX_SCALE );
442 
443  textCtrl->SetValue( formatScaleValue( curr_value ) );
444 }
445 
446 
447 void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
448 {
449  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
450 
451  double step = ROTATION_INCREMENT_WHEEL;
452 
453  if( event.ShiftDown( ) )
455 
456  if( event.GetWheelRotation() >= 0 )
457  step = -step;
458 
459  double curr_value = DoubleValueFromString( EDA_UNITS::DEGREES, textCtrl->GetValue() ) / 10.0;
460 
461  curr_value += step;
462  curr_value = std::max( -MAX_ROTATION, curr_value );
463  curr_value = std::min( curr_value, MAX_ROTATION );
464 
465  textCtrl->SetValue( formatRotationValue( curr_value ) );
466 }
467 
468 
470 {
471  wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
472 
473  double step_mm = OFFSET_INCREMENT_MM;
474 
475  if( event.ShiftDown( ) )
476  step_mm = OFFSET_INCREMENT_MM_FINE;
477 
479  {
480  step_mm = 25.4*OFFSET_INCREMENT_MIL/1000.0;
481 
482  if( event.ShiftDown( ) )
483  step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000.0;
484  }
485 
486  if( event.GetWheelRotation() >= 0 )
487  step_mm = -step_mm;
488 
489  double curr_value_mm = DoubleValueFromString( m_userUnits, textCtrl->GetValue() ) / IU_PER_MM;
490 
491  curr_value_mm += step_mm;
492  curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
493  curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
494 
495  textCtrl->SetValue( formatOffsetValue( curr_value_mm ) );
496 }
497 
498 
500 {
501  m_dummyFootprint->Models().clear();
502 
503  for( FP_3DMODEL& model : *m_parentModelList )
504  {
505  if( model.m_Show )
506  m_dummyFootprint->Models().push_back( model );
507  }
508 
509  if( aReloadRequired )
511 
513 }
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:183
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:385
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:96
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:386
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:387
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:94
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:97
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:95
void loadSettings()
Load 3D relevant settings from the user configuration.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
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:384
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:204
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