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.

108 lines
3.5 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. #ifndef SCH_RENDER_SETTINGS_H
  24. #define SCH_RENDER_SETTINGS_H
  25. #include <gal/color4d.h>
  26. #include <render_settings.h>
  27. #include <transform.h>
  28. using KIGFX::COLOR4D;
  29. class SCH_RENDER_SETTINGS : public KIGFX::RENDER_SETTINGS
  30. {
  31. public:
  32. SCH_RENDER_SETTINGS();
  33. void LoadColors( const COLOR_SETTINGS* aSettings ) override;
  34. virtual COLOR4D GetColor( const KIGFX::VIEW_ITEM* aItem, int aLayer ) const override
  35. {
  36. auto it = m_layerColors.find( aLayer );
  37. return it == m_layerColors.end() ? COLOR4D::WHITE : it->second;
  38. }
  39. bool IsBackgroundDark() const override
  40. {
  41. auto it = m_layerColors.find( LAYER_SCHEMATIC_BACKGROUND );
  42. return it != m_layerColors.end() && it->second.GetBrightness() < 0.5;
  43. }
  44. const KIGFX::COLOR4D& GetBackgroundColor() const override
  45. {
  46. auto it = m_layerColors.find( LAYER_SCHEMATIC_BACKGROUND );
  47. return it == m_layerColors.end() ? COLOR4D::BLACK : it->second;
  48. }
  49. void SetBackgroundColor( const COLOR4D& aColor ) override
  50. {
  51. m_layerColors[ LAYER_SCHEMATIC_BACKGROUND ] = aColor;
  52. }
  53. float GetDanglingIndicatorThickness() const
  54. {
  55. return (float) m_defaultPenWidth / 3.0F;
  56. }
  57. const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_SCHEMATIC_GRID ]; }
  58. const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_SCHEMATIC_CURSOR ]; }
  59. bool GetShowPageLimits() const override;
  60. VECTOR2I TransformCoordinate( const VECTOR2I& aPoint ) const
  61. {
  62. return m_Transform.TransformCoordinate( aPoint );
  63. }
  64. public:
  65. bool m_IsSymbolEditor;
  66. int m_ShowUnit; // Show all units if 0
  67. int m_ShowBodyStyle; // Show all body styles if 0
  68. bool m_ShowPinsElectricalType;
  69. bool m_ShowHiddenPins;
  70. bool m_ShowHiddenFields;
  71. bool m_ShowVisibleFields;
  72. bool m_ShowPinNumbers; // Force showing of pin numbers (normally symbol-specific)
  73. bool m_ShowPinNames; // Force showing of pin names (normally symbol-specific)
  74. bool m_ShowPinAltIcons;
  75. bool m_ShowDisabled;
  76. bool m_ShowGraphicsDisabled;
  77. bool m_ShowConnectionPoints;
  78. bool m_OverrideItemColors;
  79. double m_LabelSizeRatio; // Proportion of font size to label box
  80. double m_TextOffsetRatio; // Proportion of font size to offset text above/below
  81. // wires, buses, etc.
  82. int m_PinSymbolSize;
  83. TRANSFORM m_Transform;
  84. };
  85. #endif /* SCH_RENDER_SETTINGS_H */