KiCad PCB EDA Suite
pcad2kicad_common.h
Go to the documentation of this file.
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 
30 #ifndef PCAD2KICAD_COMMON_H_
31 #define PCAD2KICAD_COMMON_H_
32 
33 #include <wx/wx.h>
34 #include <wx/xml/xml.h>
35 #include <xnode.h>
36 
37 #include <eda_text.h>
38 
39 namespace PCAD2KICAD
40 {
41 
42 #define PCAD2KICAD_SCALE_SCH_TO_INCH_GRID
43 
45 {
55 };
56 
57 typedef struct _TTEXTVALUE
58 {
59  wxString text;
65  bool isBold;
66  bool isItalic;
67  bool isTrueType;
68 } TTEXTVALUE;
69 
70 extern wxString GetWord( wxString* aStr );
71 extern XNODE* FindPinMap( XNODE* aNode );
72 extern int StrToIntUnits( const wxString& aStr, char aAxe, const wxString& aActualConversion );
73 extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
74  const wxString& aDefaultMeasurementUnit );
75 extern int StrToInt1Units( const wxString& aStr );
76 extern wxString ValidateName( wxString aName );
77 extern wxString ValidateReference( wxString aRef );
78 extern void SetWidth( wxString aStr,
79  const wxString& aDefaultMeasurementUnit,
80  int* aWidth,
81  const wxString& aActualConversion );
82 extern void SetPosition( wxString aStr,
83  const wxString& aDefaultMeasurementUnit,
84  int* aX,
85  int* aY,
86  const wxString& aActualConversion );
87 extern void SetDoublePrecisionPosition( wxString aStr,
88  const wxString& aDefaultMeasurementUnit,
89  double* aX,
90  double* aY,
91  const wxString& aActualConversion );
92 extern TTEXT_JUSTIFY GetJustifyIdentificator( const wxString& aJustify );
93 extern void SetTextParameters( XNODE* aNode,
94  TTEXTVALUE* aTextValue,
95  const wxString& aDefaultMeasurementUnit,
96  const wxString& aActualConversion );
97 extern void SetFontProperty( XNODE* aNode,
98  TTEXTVALUE* aTextValue,
99  const wxString& aDefaultMeasurementUnit,
100  const wxString& aActualConversion );
101 extern void SetTextJustify( EDA_TEXT* aText, TTEXT_JUSTIFY aJustify );
102 extern int CalculateTextLengthSize( TTEXTVALUE* aText );
103 extern void CorrectTextPosition( TTEXTVALUE* aValue );
104 extern void SetTextSizeFromStrokeFontHeight( EDA_TEXT* aText, int aTextHeight );
105 extern void SetTextSizeFromTrueTypeFontHeight( EDA_TEXT* aText, int aTextHeight );
106 extern XNODE* FindNode( XNODE* aChild, const wxString& aTag );
107 extern wxString FindNodeGetContent( XNODE* aChild, const wxString& aTag );
108 extern void InitTTextValue( TTEXTVALUE* aTextValue );
109 
110 } // namespace PCAD2KICAD
111 
112 #endif // PCAD2KICAD_COMMON_H_
wxString GetWord(wxString *aStr)
void SetFontProperty(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
wxString GetAndCutWordWithMeasureUnits(wxString *aStr, const wxString &aDefaultMeasurementUnit)
void SetWidth(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aWidth, const wxString &aActualConversion)
Definition of base KiCad text object.
void SetTextSizeFromTrueTypeFontHeight(EDA_TEXT *aText, int aTextHeight)
struct PCAD2KICAD::_TTEXTVALUE TTEXTVALUE
Class EDA_TEXT is a mix-in class (via multiple inheritance) that handles texts such as labels...
Definition: eda_text.h:112
wxString ValidateName(wxString aName)
int CalculateTextLengthSize(TTEXTVALUE *aText)
wxString FindNodeGetContent(XNODE *aChild, const wxString &aTag)
void SetTextParameters(XNODE *aNode, TTEXTVALUE *aTextValue, const wxString &aDefaultMeasurementUnit, const wxString &aActualConversion)
wxString ValidateReference(wxString aRef)
void SetDoublePrecisionPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, double *aX, double *aY, const wxString &aActualConversion)
int StrToIntUnits(const wxString &aStr, char aAxe, const wxString &aActualConversion)
Class XNODE holds an XML or S-expression element.
Definition: xnode.h:43
void SetTextJustify(EDA_TEXT *aText, TTEXT_JUSTIFY aJustify)
void CorrectTextPosition(TTEXTVALUE *aValue)
TTEXT_JUSTIFY GetJustifyIdentificator(const wxString &aJustify)
XNODE * FindNode(XNODE *aChild, const wxString &aTag)
void InitTTextValue(TTEXTVALUE *aTextValue)
void SetTextSizeFromStrokeFontHeight(EDA_TEXT *aText, int aTextHeight)
XNODE * FindPinMap(XNODE *aNode)
int StrToInt1Units(const wxString &aStr)