You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
4.2 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #include "panel_3D_opengl_options.h"
  25. #include <widgets/color_swatch.h>
  26. #include <3d_canvas/board_adapter.h>
  27. #include <3d_viewer/eda_3d_viewer.h>
  28. #include <3d_viewer/tools/3d_controller.h>
  29. PANEL_3D_OPENGL_OPTIONS::PANEL_3D_OPENGL_OPTIONS( EDA_3D_VIEWER* aFrame, wxWindow* aParent ) :
  30. PANEL_3D_OPENGL_OPTIONS_BASE( aParent ),
  31. m_settings( aFrame->GetAdapter() ),
  32. m_canvas( aFrame->GetCanvas() )
  33. {
  34. m_selectionColorSwatch->SetDefaultColor( COLOR4D( 0.0, 1.0, 0.0, 1.0 ) );
  35. m_selectionColorSwatch->SetSupportsOpacity( false );
  36. }
  37. bool PANEL_3D_OPENGL_OPTIONS::TransferDataToWindow()
  38. {
  39. m_checkBoxCuThickness->SetValue( m_settings.GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) );
  40. m_checkBoxBoundingBoxes->SetValue( m_settings.GetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX ) );
  41. m_checkBoxHighlightOnRollOver->SetValue( m_settings.GetFlag( FL_HIGHLIGHT_ROLLOVER_ITEM ) );
  42. m_choiceAntiAliasing->SetSelection( static_cast<int>( m_settings.GetAntiAliasingMode() ) );
  43. m_selectionColorSwatch->SetSwatchColor( COLOR4D( m_settings.m_OpenGlSelectionColor.r,
  44. m_settings.m_OpenGlSelectionColor.g,
  45. m_settings.m_OpenGlSelectionColor.b,
  46. 1.0 ),
  47. false );
  48. m_checkBoxDisableAAMove->SetValue(
  49. m_settings.GetFlag( FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE ) );
  50. m_checkBoxDisableMoveThickness->SetValue(
  51. m_settings.GetFlag( FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE ) );
  52. m_checkBoxDisableMoveVias->SetValue(
  53. m_settings.GetFlag( FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE ) );
  54. m_checkBoxDisableMoveHoles->SetValue(
  55. m_settings.GetFlag( FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE ) );
  56. return true;
  57. }
  58. bool PANEL_3D_OPENGL_OPTIONS::TransferDataFromWindow()
  59. {
  60. m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, m_checkBoxCuThickness->GetValue() );
  61. m_settings.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, m_checkBoxBoundingBoxes->GetValue() );
  62. m_settings.SetFlag( FL_HIGHLIGHT_ROLLOVER_ITEM, m_checkBoxHighlightOnRollOver->GetValue() );
  63. m_settings.SetAntiAliasingMode(
  64. static_cast<ANTIALIASING_MODE>( m_choiceAntiAliasing->GetSelection() ) );
  65. m_settings.m_OpenGlSelectionColor = SFVEC3F( m_selectionColorSwatch->GetSwatchColor().r,
  66. m_selectionColorSwatch->GetSwatchColor().g,
  67. m_selectionColorSwatch->GetSwatchColor().b );
  68. m_settings.SetFlag( FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE,
  69. m_checkBoxDisableAAMove->GetValue() );
  70. m_settings.SetFlag( FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE,
  71. m_checkBoxDisableMoveThickness->GetValue() );
  72. m_settings.SetFlag( FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE,
  73. m_checkBoxDisableMoveVias->GetValue() );
  74. m_settings.SetFlag( FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE,
  75. m_checkBoxDisableMoveHoles->GetValue() );
  76. return true;
  77. }