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.

151 lines
7.4 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  6. * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
  7. * Copyright (C) 1992-2015 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. * @file modeditoptions.cpp
  28. * @brief Pcbnew footprint (module) editor options.
  29. */
  30. #include <fctsys.h>
  31. #include <class_drawpanel.h>
  32. #include <pcbnew.h>
  33. #include <wxPcbStruct.h>
  34. #include <module_editor_frame.h>
  35. #include <class_board_design_settings.h>
  36. #include <layers_id_colors_and_visibility.h>
  37. #include <pcbnew_id.h>
  38. void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
  39. {
  40. int id = event.GetId();
  41. DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
  42. bool state = m_optionsToolBar->GetToolToggled( id );
  43. switch( id )
  44. {
  45. case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
  46. displ_opts->m_DisplayPadFill = !state;
  47. m_canvas->Refresh( );
  48. break;
  49. case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
  50. displ_opts->m_DisplayViaFill = !state;
  51. m_canvas->Refresh( );
  52. break;
  53. case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
  54. displ_opts->m_DisplayModTextFill = state ? SKETCH : FILLED;
  55. m_canvas->Refresh( );
  56. break;
  57. case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
  58. displ_opts->m_DisplayModEdgeFill = state ? SKETCH : FILLED;
  59. m_canvas->Refresh( );
  60. break;
  61. case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
  62. displ_opts->m_ContrastModeDisplay = state;
  63. m_canvas->Refresh( );
  64. break;
  65. default:
  66. wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar error" ) );
  67. break;
  68. }
  69. }
  70. PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
  71. {
  72. DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*) GetDisplayOptions();
  73. BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
  74. // Update everything
  75. m_configSettings.clear(); // boost::ptr_vector destroys the pointers inside
  76. // Display options:
  77. m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ),
  78. (int*)&g_UserUnit, MILLIMETRES ) );
  79. m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
  80. &displ_opts->m_DisplayPolarCood, false ) );
  81. m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
  82. &displ_opts->m_DisplayPadFill, true ) );
  83. m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
  84. &displ_opts->m_DisplayModEdgeFill, FILLED ) );
  85. m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
  86. &displ_opts->m_DisplayModTextFill, FILLED ) );
  87. m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorTextsDisplayMode" ),
  88. &displ_opts->m_DisplayModTextFill, FILLED ) );
  89. m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
  90. &settings.m_RefDefaultText, wxT( "REF**" ) ) );
  91. // design settings
  92. m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ),
  93. &settings.m_ModuleSegmentWidth,
  94. Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
  95. Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
  96. NULL, 1/IU_PER_MM ) );
  97. m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ),
  98. &settings.m_ModuleTextSize.x,
  99. Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
  100. Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
  101. NULL, 1/IU_PER_MM ) );
  102. m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ),
  103. &settings.m_ModuleTextSize.y,
  104. Millimeter2iu( DEFAULT_TEXT_MODULE_SIZE ),
  105. Millimeter2iu(0.01), Millimeter2iu( 100.0 ),
  106. NULL, 1/IU_PER_MM ) );
  107. m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ),
  108. &settings.m_ModuleTextWidth,
  109. Millimeter2iu( DEFAULT_GR_MODULE_THICKNESS ),
  110. Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ),
  111. NULL, 1/IU_PER_MM ) );
  112. m_configSettings.push_back( new PARAM_CFG_WXSTRING( true,
  113. wxT( "FpEditorRefDefaultText" ),
  114. &settings.m_RefDefaultText, wxT( "REF**" ) ) );
  115. m_configSettings.push_back( new PARAM_CFG_BOOL( true,
  116. wxT( "FpEditorRefDefaultVisibility" ),
  117. &settings.m_RefDefaultVisibility, true ) );
  118. m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
  119. &settings.m_RefDefaultlayer,
  120. int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
  121. m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
  122. &settings.m_ValueDefaultText, wxT( "" ) ) );
  123. m_configSettings.push_back( new PARAM_CFG_BOOL( true,
  124. wxT( "FpEditorValueDefaultVisibility" ),
  125. &settings.m_ValueDefaultVisibility, true ) );
  126. m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
  127. &settings.m_ValueDefaultlayer,
  128. int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
  129. return m_configSettings;
  130. }