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.

83 lines
3.1 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #include <pgm_base.h>
  24. #include <kiface_base.h>
  25. #include <advanced_config.h>
  26. #include <settings/settings_manager.h>
  27. #include <eeschema_settings.h>
  28. #include <default_values.h>
  29. #include <sch_render_settings.h>
  30. SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
  31. m_IsSymbolEditor( false ),
  32. m_ShowUnit( 0 ),
  33. m_ShowBodyStyle( 0 ),
  34. m_ShowPinsElectricalType( true ),
  35. m_ShowHiddenPins( true ),
  36. m_ShowHiddenFields( true ),
  37. m_ShowVisibleFields( true ),
  38. m_ShowPinNumbers( false ),
  39. m_ShowPinNames( false ),
  40. m_ShowPinAltIcons( false ),
  41. m_ShowDisabled( false ),
  42. m_ShowGraphicsDisabled( false ),
  43. m_ShowConnectionPoints( false ),
  44. m_OverrideItemColors( false ),
  45. m_LabelSizeRatio( DEFAULT_LABEL_SIZE_RATIO ),
  46. m_TextOffsetRatio( DEFAULT_TEXT_OFFSET_RATIO ),
  47. m_PinSymbolSize( DEFAULT_TEXT_SIZE * schIUScale.IU_PER_MILS / 2 ),
  48. m_SymbolLineWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS ),
  49. m_Transform()
  50. {
  51. SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS );
  52. SetDashLengthRatio( 12 ); // From ISO 128-2
  53. SetGapLengthRatio( 3 ); // From ISO 128-2
  54. m_minPenWidth = KiROUND( ADVANCED_CFG::GetCfg().m_MinPlotPenWidth * schIUScale.IU_PER_MM );
  55. }
  56. void SCH_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
  57. {
  58. for( int layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; layer ++)
  59. m_layerColors[ layer ] = aSettings->GetColor( layer );
  60. for( int layer = GAL_LAYER_ID_START; layer < GAL_LAYER_ID_END; layer ++)
  61. m_layerColors[ layer ] = aSettings->GetColor( layer );
  62. m_backgroundColor = aSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
  63. m_layerColors[LAYER_AUX_ITEMS] = m_layerColors[LAYER_SCHEMATIC_AUX_ITEMS];
  64. m_OverrideItemColors = aSettings->GetOverrideSchItemColors();
  65. }
  66. bool SCH_RENDER_SETTINGS::GetShowPageLimits() const
  67. {
  68. EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
  69. return cfg && cfg->m_Appearance.show_page_limits && !IsPrinting();
  70. }