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.

112 lines
4.6 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
  5. * Copyright (C) 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
  6. * Copyright (C) 2012 KiCad Developers, see CHANGELOG.TXT for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file pcad2kicad_common.h
  27. */
  28. #ifndef PCAD2KICAD_COMMON_H_
  29. #define PCAD2KICAD_COMMON_H_
  30. #include <wx/wx.h>
  31. #include <wx/xml/xml.h>
  32. #include <xnode.h>
  33. #include <eda_text.h>
  34. namespace PCAD2KICAD
  35. {
  36. #define PCAD2KICAD_SCALE_SCH_TO_INCH_GRID
  37. enum TTEXT_JUSTIFY
  38. {
  39. LowerLeft,
  40. LowerCenter,
  41. LowerRight,
  42. UpperLeft,
  43. UpperCenter,
  44. UpperRight,
  45. Left,
  46. Center,
  47. Right
  48. };
  49. typedef struct _TTEXTVALUE
  50. {
  51. wxString text;
  52. int textPositionX, textPositionY,
  53. textRotation, textHeight, textstrokeWidth;
  54. int textIsVisible, mirror, textUnit;
  55. int correctedPositionX, correctedPositionY;
  56. TTEXT_JUSTIFY justify;
  57. bool isBold;
  58. bool isItalic;
  59. bool isTrueType;
  60. } TTEXTVALUE;
  61. extern wxString GetWord( wxString* aStr );
  62. extern XNODE* FindPinMap( XNODE* aNode );
  63. extern int StrToIntUnits( const wxString& aStr, char aAxe, const wxString& aActualConversion );
  64. extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
  65. const wxString& aDefaultMeasurementUnit );
  66. extern int StrToInt1Units( const wxString& aStr );
  67. extern wxString ValidateName( wxString aName );
  68. extern wxString ValidateReference( wxString aRef );
  69. extern void SetWidth( wxString aStr,
  70. const wxString& aDefaultMeasurementUnit,
  71. int* aWidth,
  72. const wxString& aActualConversion );
  73. extern void SetPosition( wxString aStr,
  74. const wxString& aDefaultMeasurementUnit,
  75. int* aX,
  76. int* aY,
  77. const wxString& aActualConversion );
  78. extern void SetDoublePrecisionPosition( wxString aStr,
  79. const wxString& aDefaultMeasurementUnit,
  80. double* aX,
  81. double* aY,
  82. const wxString& aActualConversion );
  83. extern TTEXT_JUSTIFY GetJustifyIdentificator( const wxString& aJustify );
  84. extern void SetTextParameters( XNODE* aNode,
  85. TTEXTVALUE* aTextValue,
  86. const wxString& aDefaultMeasurementUnit,
  87. const wxString& aActualConversion );
  88. extern void SetFontProperty( XNODE* aNode,
  89. TTEXTVALUE* aTextValue,
  90. const wxString& aDefaultMeasurementUnit,
  91. const wxString& aActualConversion );
  92. extern void SetTextJustify( EDA_TEXT* aText, TTEXT_JUSTIFY aJustify );
  93. extern int CalculateTextLengthSize( TTEXTVALUE* aText );
  94. extern void CorrectTextPosition( TTEXTVALUE* aValue );
  95. extern void SetTextSizeFromStrokeFontHeight( EDA_TEXT* aText, int aTextHeight );
  96. extern void SetTextSizeFromTrueTypeFontHeight( EDA_TEXT* aText, int aTextHeight );
  97. extern XNODE* FindNode( XNODE* aChild, const wxString& aTag );
  98. extern wxString FindNodeGetContent( XNODE* aChild, const wxString& aTag );
  99. extern void InitTTextValue( TTEXTVALUE* aTextValue );
  100. } // namespace PCAD2KICAD
  101. #endif // PCAD2KICAD_COMMON_H_