Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
1047e60e
Commit
1047e60e
authored
Dec 08, 2011
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulate SCH_POLYLINE, SCH_SHEET, and SCH_TEXT classes.
parent
eb52f4ba
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
573 additions
and
464 deletions
+573
-464
build_BOM.cpp
eeschema/build_BOM.cpp
+30
-6
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+5
-5
dialog_edit_label.cpp
eeschema/dialogs/dialog_edit_label.cpp
+40
-9
edit_label.cpp
eeschema/edit_label.cpp
+4
-4
erc.cpp
eeschema/erc.cpp
+4
-4
hierarch.cpp
eeschema/hierarch.cpp
+1
-1
sch_polyline.cpp
eeschema/sch_polyline.cpp
+51
-26
sch_polyline.h
eeschema/sch_polyline.h
+40
-9
sch_screen.cpp
eeschema/sch_screen.cpp
+1
-1
sch_sheet.cpp
eeschema/sch_sheet.cpp
+137
-132
sch_sheet.h
eeschema/sch_sheet.h
+82
-72
sch_sheet_path.cpp
eeschema/sch_sheet_path.cpp
+1
-1
sch_sheet_pin.cpp
eeschema/sch_sheet_pin.cpp
+40
-50
sch_text.cpp
eeschema/sch_text.cpp
+64
-67
sch_text.h
eeschema/sch_text.h
+39
-45
sheet.cpp
eeschema/sheet.cpp
+20
-19
sheetlab.cpp
eeschema/sheetlab.cpp
+6
-5
base_struct.h
include/base_struct.h
+8
-8
No files found.
eeschema/build_BOM.cpp
View file @
1047e60e
/////////////////////////////////////////////////////////////////////////////
/*
// Name: build_BOM.cpp
* This program source code file is part of KiCad, a free EDA CAD application.
// Author: jean-pierre Charras
*
// License: GPL license
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
/////////////////////////////////////////////////////////////////////////////
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file build_BOM.cpp
* @brief Code used to generate bill of materials.
*/
#include <algorithm> // to use sort vector
#include <algorithm> // to use sort vector
#include <vector>
#include <vector>
...
@@ -159,7 +183,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
...
@@ -159,7 +183,7 @@ int PrintListeGLabel( FILE* f, LABEL_OBJECT_LIST& aList )
case
SCH_SHEET_PIN_T
:
case
SCH_SHEET_PIN_T
:
{
{
pinsheet
=
(
SCH_SHEET_PIN
*
)
aList
[
ii
].
m_Label
;
pinsheet
=
(
SCH_SHEET_PIN
*
)
aList
[
ii
].
m_Label
;
int
jj
=
pinsheet
->
m_Shape
;
int
jj
=
pinsheet
->
GetShape
()
;
if
(
jj
<
0
)
if
(
jj
<
0
)
jj
=
NET_TMAX
;
jj
=
NET_TMAX
;
...
...
eeschema/bus-wire-junction.cpp
View file @
1047e60e
...
@@ -424,18 +424,18 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
...
@@ -424,18 +424,18 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
endpos
=
screen
->
GetCrossHairPosition
();
endpos
=
screen
->
GetCrossHairPosition
();
int
idx
=
polyLine
->
GetCornerCount
()
-
1
;
int
idx
=
polyLine
->
GetCornerCount
()
-
1
;
wxPoint
pt
=
(
*
polyLine
)[
idx
];
if
(
g_HVLines
)
if
(
g_HVLines
)
{
{
/* Coerce the line to vertical or horizontal one: */
/* Coerce the line to vertical or horizontal one: */
if
(
ABS
(
endpos
.
x
-
polyLine
->
m_PolyPoints
[
idx
].
x
)
<
if
(
ABS
(
endpos
.
x
-
pt
.
x
)
<
ABS
(
endpos
.
y
-
pt
.
y
)
)
ABS
(
endpos
.
y
-
polyLine
->
m_PolyPoints
[
idx
].
y
)
)
endpos
.
x
=
pt
.
x
;
endpos
.
x
=
polyLine
->
m_PolyPoints
[
idx
].
x
;
else
else
endpos
.
y
=
p
olyLine
->
m_PolyPoints
[
idx
]
.
y
;
endpos
.
y
=
p
t
.
y
;
}
}
polyLine
->
m_PolyPoints
[
idx
]
=
endpos
;
polyLine
->
SetPoint
(
idx
,
endpos
)
;
polyLine
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
polyLine
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
}
}
else
else
...
...
eeschema/dialogs/dialog_edit_label.cpp
View file @
1047e60e
/////////////////////////////////////////////////////////////////////////////
/*
// Name: dialog_edit_label.cpp
* This program source code file is part of KiCad, a free EDA CAD application.
// Author: jean-pierre Charras
*
// Modified by:
* Copyright (C) 2008 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
// Created: 18/12/2008 15:46:26
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
// Licence: GPL
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
/////////////////////////////////////////////////////////////////////////////
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_text.h
* @brief Implementation of the label properties dialog.
*/
#include "fctsys.h"
#include "fctsys.h"
#include "wx/valgen.h"
#include "wx/valgen.h"
...
@@ -98,6 +120,7 @@ void DialogLabelEditor::InitDialog()
...
@@ -98,6 +120,7 @@ void DialogLabelEditor::InitDialog()
int
MINTEXTWIDTH
=
40
;
// M's are big characters, a few establish a lot of width
int
MINTEXTWIDTH
=
40
;
// M's are big characters, a few establish a lot of width
int
max_len
=
0
;
int
max_len
=
0
;
if
(
!
multiLine
)
if
(
!
multiLine
)
{
{
max_len
=
m_CurrentText
->
m_Text
.
Length
();
max_len
=
m_CurrentText
->
m_Text
.
Length
();
...
@@ -108,6 +131,7 @@ void DialogLabelEditor::InitDialog()
...
@@ -108,6 +131,7 @@ void DialogLabelEditor::InitDialog()
// we cannot use the length of the entire text that has no meaning
// we cannot use the length of the entire text that has no meaning
int
curr_len
=
MINTEXTWIDTH
;
int
curr_len
=
MINTEXTWIDTH
;
int
imax
=
m_CurrentText
->
m_Text
.
Len
();
int
imax
=
m_CurrentText
->
m_Text
.
Len
();
for
(
int
count
=
0
;
count
<
imax
;
count
++
)
for
(
int
count
=
0
;
count
<
imax
;
count
++
)
{
{
if
(
m_CurrentText
->
m_Text
[
count
]
==
'\n'
||
if
(
m_CurrentText
->
m_Text
[
count
]
==
'\n'
||
...
@@ -118,11 +142,13 @@ void DialogLabelEditor::InitDialog()
...
@@ -118,11 +142,13 @@ void DialogLabelEditor::InitDialog()
else
else
{
{
curr_len
++
;
curr_len
++
;
if
(
max_len
<
curr_len
)
if
(
max_len
<
curr_len
)
max_len
=
curr_len
;
max_len
=
curr_len
;
}
}
}
}
}
}
if
(
max_len
<
MINTEXTWIDTH
)
if
(
max_len
<
MINTEXTWIDTH
)
max_len
=
MINTEXTWIDTH
;
max_len
=
MINTEXTWIDTH
;
...
@@ -132,11 +158,13 @@ void DialogLabelEditor::InitDialog()
...
@@ -132,11 +158,13 @@ void DialogLabelEditor::InitDialog()
// Set validators
// Set validators
m_TextOrient
->
SetSelection
(
m_CurrentText
->
GetOrientation
()
);
m_TextOrient
->
SetSelection
(
m_CurrentText
->
GetOrientation
()
);
m_TextShape
->
SetSelection
(
m_CurrentText
->
m_Shape
);
m_TextShape
->
SetSelection
(
m_CurrentText
->
GetShape
()
);
int
style
=
0
;
int
style
=
0
;
if
(
m_CurrentText
->
m_Italic
)
if
(
m_CurrentText
->
m_Italic
)
style
=
1
;
style
=
1
;
if
(
m_CurrentText
->
m_Bold
)
if
(
m_CurrentText
->
m_Bold
)
style
+=
2
;
style
+=
2
;
...
@@ -203,6 +231,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
...
@@ -203,6 +231,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
m_Parent
->
DrawPanel
->
RefreshDrawingRect
(
m_CurrentText
->
GetBoundingBox
()
);
m_Parent
->
DrawPanel
->
RefreshDrawingRect
(
m_CurrentText
->
GetBoundingBox
()
);
text
=
m_textLabel
->
GetValue
();
text
=
m_textLabel
->
GetValue
();
if
(
!
text
.
IsEmpty
()
)
if
(
!
text
.
IsEmpty
()
)
m_CurrentText
->
m_Text
=
text
;
m_CurrentText
->
m_Text
=
text
;
else
if
(
(
m_CurrentText
->
m_Flags
&
IS_NEW
)
==
0
)
else
if
(
(
m_CurrentText
->
m_Flags
&
IS_NEW
)
==
0
)
...
@@ -212,10 +241,12 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
...
@@ -212,10 +241,12 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
text
=
m_TextSize
->
GetValue
();
text
=
m_TextSize
->
GetValue
();
value
=
ReturnValueFromString
(
g_UserUnit
,
text
,
m_Parent
->
m_InternalUnits
);
value
=
ReturnValueFromString
(
g_UserUnit
,
text
,
m_Parent
->
m_InternalUnits
);
m_CurrentText
->
m_Size
.
x
=
m_CurrentText
->
m_Size
.
y
=
value
;
m_CurrentText
->
m_Size
.
x
=
m_CurrentText
->
m_Size
.
y
=
value
;
if
(
m_TextShape
)
if
(
m_TextShape
)
m_CurrentText
->
m_Shape
=
m_TextShape
->
GetSelection
(
);
m_CurrentText
->
SetShape
(
m_TextShape
->
GetSelection
()
);
int
style
=
m_TextStyle
->
GetSelection
();
int
style
=
m_TextStyle
->
GetSelection
();
if
(
(
style
&
1
)
)
if
(
(
style
&
1
)
)
m_CurrentText
->
m_Italic
=
1
;
m_CurrentText
->
m_Italic
=
1
;
else
else
...
...
eeschema/edit_label.cpp
View file @
1047e60e
...
@@ -87,12 +87,12 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
...
@@ -87,12 +87,12 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
case
LAYER_HIERLABEL
:
case
LAYER_HIERLABEL
:
textItem
=
new
SCH_HIERLABEL
(
GetScreen
()
->
GetCrossHairPosition
()
);
textItem
=
new
SCH_HIERLABEL
(
GetScreen
()
->
GetCrossHairPosition
()
);
textItem
->
m_Shape
=
lastGlobalLabelShape
;
textItem
->
SetShape
(
lastGlobalLabelShape
)
;
break
;
break
;
case
LAYER_GLOBLABEL
:
case
LAYER_GLOBLABEL
:
textItem
=
new
SCH_GLOBALLABEL
(
GetScreen
()
->
GetCrossHairPosition
()
);
textItem
=
new
SCH_GLOBALLABEL
(
GetScreen
()
->
GetCrossHairPosition
()
);
textItem
->
m_Shape
=
lastGlobalLabelShape
;
textItem
->
SetShape
(
lastGlobalLabelShape
)
;
break
;
break
;
default
:
default
:
...
@@ -121,7 +121,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
...
@@ -121,7 +121,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
if
(
(
aType
==
SCH_GLOBAL_LABEL_T
)
||
(
aType
==
SCH_HIERARCHICAL_LABEL_T
)
)
if
(
(
aType
==
SCH_GLOBAL_LABEL_T
)
||
(
aType
==
SCH_HIERARCHICAL_LABEL_T
)
)
{
{
lastGlobalLabelShape
=
textItem
->
m_Shape
;
lastGlobalLabelShape
=
textItem
->
GetShape
()
;
}
}
textItem
->
Draw
(
DrawPanel
,
aDC
,
wxPoint
(
0
,
0
),
GR_DEFAULT_DRAWMODE
);
textItem
->
Draw
(
DrawPanel
,
aDC
,
wxPoint
(
0
,
0
),
GR_DEFAULT_DRAWMODE
);
...
@@ -207,7 +207,7 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
...
@@ -207,7 +207,7 @@ void SCH_EDIT_FRAME::OnConvertTextType( wxCommandEvent& aEvent )
* text item type.
* text item type.
*/
*/
newtext
->
SetFlags
(
text
->
GetFlags
()
);
newtext
->
SetFlags
(
text
->
GetFlags
()
);
newtext
->
m_Shape
=
text
->
m_Shape
;
newtext
->
SetShape
(
text
->
GetShape
()
)
;
newtext
->
SetOrientation
(
text
->
GetOrientation
()
);
newtext
->
SetOrientation
(
text
->
GetOrientation
()
);
newtext
->
m_Size
=
text
->
m_Size
;
newtext
->
m_Size
=
text
->
m_Size
;
newtext
->
m_Thickness
=
text
->
m_Thickness
;
newtext
->
m_Thickness
=
text
->
m_Thickness
;
...
...
eeschema/erc.cpp
View file @
1047e60e
...
@@ -197,8 +197,8 @@ int TestDuplicateSheetNames( bool aCreateMarker )
...
@@ -197,8 +197,8 @@ int TestDuplicateSheetNames( bool aCreateMarker )
continue
;
continue
;
// We have found a second sheet: compare names
// We have found a second sheet: compare names
if
(
(
(
SCH_SHEET
*
)
item
)
->
m_SheetName
.
CmpNoCase
(
if
(
(
(
SCH_SHEET
*
)
item
)
->
GetName
()
.
CmpNoCase
(
(
(
SCH_SHEET
*
)
test_item
)
->
m_SheetName
)
==
0
)
(
(
SCH_SHEET
*
)
test_item
)
->
GetName
()
)
==
0
)
{
{
if
(
aCreateMarker
)
if
(
aCreateMarker
)
{
{
...
@@ -206,9 +206,9 @@ int TestDuplicateSheetNames( bool aCreateMarker )
...
@@ -206,9 +206,9 @@ int TestDuplicateSheetNames( bool aCreateMarker )
SCH_MARKER
*
marker
=
new
SCH_MARKER
();
SCH_MARKER
*
marker
=
new
SCH_MARKER
();
marker
->
m_TimeStamp
=
GetNewTimeStamp
();
marker
->
m_TimeStamp
=
GetNewTimeStamp
();
marker
->
SetData
(
ERCE_DUPLICATE_SHEET_NAME
,
marker
->
SetData
(
ERCE_DUPLICATE_SHEET_NAME
,
(
(
SCH_SHEET
*
)
test_item
)
->
m_Pos
,
(
(
SCH_SHEET
*
)
test_item
)
->
GetPosition
()
,
_
(
"Duplicate sheet name"
),
_
(
"Duplicate sheet name"
),
(
(
SCH_SHEET
*
)
test_item
)
->
m_Pos
);
(
(
SCH_SHEET
*
)
test_item
)
->
GetPosition
()
);
marker
->
SetMarkerType
(
MARK_ERC
);
marker
->
SetMarkerType
(
MARK_ERC
);
marker
->
SetErrorLevel
(
ERR
);
marker
->
SetErrorLevel
(
ERR
);
marker
->
SetNext
(
screen
->
GetDrawItems
()
);
marker
->
SetNext
(
screen
->
GetDrawItems
()
);
...
...
eeschema/hierarch.cpp
View file @
1047e60e
...
@@ -197,7 +197,7 @@ void HIERARCHY_NAVIG_DLG::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId*
...
@@ -197,7 +197,7 @@ void HIERARCHY_NAVIG_DLG::BuildSheetsTree( SCH_SHEET_PATH* list, wxTreeItemId*
{
{
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
schitem
;
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
schitem
;
m_nbsheets
++
;
m_nbsheets
++
;
menu
=
m_Tree
->
AppendItem
(
*
previousmenu
,
sheet
->
m_SheetName
,
0
,
1
);
menu
=
m_Tree
->
AppendItem
(
*
previousmenu
,
sheet
->
GetName
()
,
0
,
1
);
list
->
Push
(
sheet
);
list
->
Push
(
sheet
);
m_Tree
->
SetItemData
(
menu
,
new
TreeItemData
(
*
list
)
);
m_Tree
->
SetItemData
(
menu
,
new
TreeItemData
(
*
list
)
);
int
ll
=
m_Tree
->
GetItemText
(
menu
).
Len
();
int
ll
=
m_Tree
->
GetItemText
(
menu
).
Len
();
...
...
eeschema/sch_polyline.cpp
View file @
1047e60e
/**********************/
/*
/* Class SCH_POLYLINE */
* This program source code file is part of KiCad, a free EDA CAD application.
/**********************/
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_polyline.cpp
*/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -18,7 +43,7 @@
...
@@ -18,7 +43,7 @@
SCH_POLYLINE
::
SCH_POLYLINE
(
int
layer
)
:
SCH_POLYLINE
::
SCH_POLYLINE
(
int
layer
)
:
SCH_ITEM
(
NULL
,
SCH_POLYLINE_T
)
SCH_ITEM
(
NULL
,
SCH_POLYLINE_T
)
{
{
m_
W
idth
=
0
;
m_
w
idth
=
0
;
switch
(
layer
)
switch
(
layer
)
{
{
...
@@ -38,8 +63,8 @@ SCH_POLYLINE::SCH_POLYLINE( int layer ) :
...
@@ -38,8 +63,8 @@ SCH_POLYLINE::SCH_POLYLINE( int layer ) :
SCH_POLYLINE
::
SCH_POLYLINE
(
const
SCH_POLYLINE
&
aPolyLine
)
:
SCH_POLYLINE
::
SCH_POLYLINE
(
const
SCH_POLYLINE
&
aPolyLine
)
:
SCH_ITEM
(
aPolyLine
)
SCH_ITEM
(
aPolyLine
)
{
{
m_
Width
=
aPolyLine
.
m_W
idth
;
m_
width
=
aPolyLine
.
m_w
idth
;
m_
PolyPoints
=
aPolyLine
.
m_PolyP
oints
;
m_
points
=
aPolyLine
.
m_p
oints
;
}
}
...
@@ -74,7 +99,7 @@ bool SCH_POLYLINE::Save( FILE* aFile ) const
...
@@ -74,7 +99,7 @@ bool SCH_POLYLINE::Save( FILE* aFile ) const
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
{
if
(
fprintf
(
aFile
,
"
\t
%-4d %-4d
\n
"
,
m_
PolyPoints
[
ii
].
x
,
m_PolyP
oints
[
ii
].
y
)
==
EOF
)
if
(
fprintf
(
aFile
,
"
\t
%-4d %-4d
\n
"
,
m_
points
[
ii
].
x
,
m_p
oints
[
ii
].
y
)
==
EOF
)
{
{
success
=
false
;
success
=
false
;
break
;
break
;
...
@@ -133,7 +158,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -133,7 +158,7 @@ bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg )
int
SCH_POLYLINE
::
GetPenSize
()
const
int
SCH_POLYLINE
::
GetPenSize
()
const
{
{
int
pensize
=
(
m_
Width
==
0
)
?
g_DrawDefaultLineThickness
:
m_W
idth
;
int
pensize
=
(
m_
width
==
0
)
?
g_DrawDefaultLineThickness
:
m_w
idth
;
return
pensize
;
return
pensize
;
}
}
...
@@ -157,19 +182,19 @@ void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
...
@@ -157,19 +182,19 @@ void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs
width
*=
3
;
width
*=
3
;
}
}
GRMoveTo
(
m_
PolyPoints
[
0
].
x
,
m_PolyP
oints
[
0
].
y
);
GRMoveTo
(
m_
points
[
0
].
x
,
m_p
oints
[
0
].
y
);
if
(
m_Layer
==
LAYER_NOTES
)
if
(
m_Layer
==
LAYER_NOTES
)
{
{
for
(
unsigned
i
=
1
;
i
<
GetCornerCount
();
i
++
)
for
(
unsigned
i
=
1
;
i
<
GetCornerCount
();
i
++
)
GRDashedLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_
PolyP
oints
[
i
].
x
+
aOffset
.
x
,
GRDashedLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_
p
oints
[
i
].
x
+
aOffset
.
x
,
m_
PolyP
oints
[
i
].
y
+
aOffset
.
y
,
width
,
color
);
m_
p
oints
[
i
].
y
+
aOffset
.
y
,
width
,
color
);
}
}
else
else
{
{
for
(
unsigned
i
=
1
;
i
<
GetCornerCount
();
i
++
)
for
(
unsigned
i
=
1
;
i
<
GetCornerCount
();
i
++
)
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_
PolyP
oints
[
i
].
x
+
aOffset
.
x
,
GRLineTo
(
&
aPanel
->
m_ClipBox
,
aDC
,
m_
p
oints
[
i
].
x
+
aOffset
.
x
,
m_
PolyP
oints
[
i
].
y
+
aOffset
.
y
,
width
,
color
);
m_
p
oints
[
i
].
y
+
aOffset
.
y
,
width
,
color
);
}
}
}
}
...
@@ -178,9 +203,9 @@ void SCH_POLYLINE::Mirror_X( int aXaxis_position )
...
@@ -178,9 +203,9 @@ void SCH_POLYLINE::Mirror_X( int aXaxis_position )
{
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
{
m_
PolyP
oints
[
ii
].
y
-=
aXaxis_position
;
m_
p
oints
[
ii
].
y
-=
aXaxis_position
;
NEGATE
(
m_
PolyP
oints
[
ii
].
y
);
NEGATE
(
m_
p
oints
[
ii
].
y
);
m_
PolyP
oints
[
ii
].
y
=
aXaxis_position
;
m_
p
oints
[
ii
].
y
=
aXaxis_position
;
}
}
}
}
...
@@ -189,9 +214,9 @@ void SCH_POLYLINE::Mirror_Y( int aYaxis_position )
...
@@ -189,9 +214,9 @@ void SCH_POLYLINE::Mirror_Y( int aYaxis_position )
{
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
{
m_
PolyP
oints
[
ii
].
x
-=
aYaxis_position
;
m_
p
oints
[
ii
].
x
-=
aYaxis_position
;
NEGATE
(
m_
PolyP
oints
[
ii
].
x
);
NEGATE
(
m_
p
oints
[
ii
].
x
);
m_
PolyP
oints
[
ii
].
x
=
aYaxis_position
;
m_
p
oints
[
ii
].
x
=
aYaxis_position
;
}
}
}
}
...
@@ -200,7 +225,7 @@ void SCH_POLYLINE::Rotate( wxPoint rotationPoint )
...
@@ -200,7 +225,7 @@ void SCH_POLYLINE::Rotate( wxPoint rotationPoint )
{
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
{
RotatePoint
(
&
m_
PolyP
oints
[
ii
],
rotationPoint
,
900
);
RotatePoint
(
&
m_
p
oints
[
ii
],
rotationPoint
,
900
);
}
}
}
}
...
@@ -227,7 +252,7 @@ wxString SCH_POLYLINE::GetSelectMenuText() const
...
@@ -227,7 +252,7 @@ wxString SCH_POLYLINE::GetSelectMenuText() const
fmt
=
_
(
"Polyline on Unkown Layer with %d Points"
);
fmt
=
_
(
"Polyline on Unkown Layer with %d Points"
);
}
}
menuText
.
Printf
(
fmt
,
m_
PolyP
oints
.
size
()
);
menuText
.
Printf
(
fmt
,
m_
p
oints
.
size
()
);
return
menuText
;
return
menuText
;
}
}
...
@@ -246,9 +271,9 @@ BITMAP_DEF SCH_POLYLINE::GetMenuImage() const
...
@@ -246,9 +271,9 @@ BITMAP_DEF SCH_POLYLINE::GetMenuImage() const
bool
SCH_POLYLINE
::
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
)
const
bool
SCH_POLYLINE
::
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
)
const
{
{
for
(
size_t
i
=
0
;
i
<
m_
PolyP
oints
.
size
()
-
1
;
i
++
)
for
(
size_t
i
=
0
;
i
<
m_
p
oints
.
size
()
-
1
;
i
++
)
{
{
if
(
TestSegmentHit
(
aPoint
,
m_
PolyPoints
[
i
],
m_PolyP
oints
[
i
+
1
],
aAccuracy
)
)
if
(
TestSegmentHit
(
aPoint
,
m_
points
[
i
],
m_p
oints
[
i
+
1
],
aAccuracy
)
)
return
true
;
return
true
;
}
}
...
@@ -271,9 +296,9 @@ bool SCH_POLYLINE::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccur
...
@@ -271,9 +296,9 @@ bool SCH_POLYLINE::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccur
void
SCH_POLYLINE
::
doSetPosition
(
const
wxPoint
&
aPosition
)
void
SCH_POLYLINE
::
doSetPosition
(
const
wxPoint
&
aPosition
)
{
{
wxPoint
offset
=
m_
PolyP
oints
[
0
]
-
aPosition
;
wxPoint
offset
=
m_
p
oints
[
0
]
-
aPosition
;
for
(
size_t
i
=
0
;
i
<
m_
PolyP
oints
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
m_
p
oints
.
size
();
i
++
)
m_
PolyPoints
[
i
]
=
m_PolyP
oints
[
i
]
-
offset
;
m_
points
[
i
]
=
m_p
oints
[
i
]
-
offset
;
}
}
eeschema/sch_polyline.h
View file @
1047e60e
...
@@ -37,9 +37,8 @@
...
@@ -37,9 +37,8 @@
class
SCH_POLYLINE
:
public
SCH_ITEM
class
SCH_POLYLINE
:
public
SCH_ITEM
{
{
public
:
int
m_width
;
/* Thickness */
int
m_Width
;
/* Thickness */
std
::
vector
<
wxPoint
>
m_points
;
// list of points (>= 2)
std
::
vector
<
wxPoint
>
m_PolyPoints
;
// list of points (>= 2)
public
:
public
:
SCH_POLYLINE
(
int
layer
=
LAYER_NOTES
);
SCH_POLYLINE
(
int
layer
=
LAYER_NOTES
);
...
@@ -77,19 +76,36 @@ public:
...
@@ -77,19 +76,36 @@ public:
/**
/**
* Function AddPoint
* Function AddPoint
* add a corner to m_
PolyP
oints
* add a corner to m_
p
oints
*/
*/
void
AddPoint
(
const
wxPoint
&
point
)
void
AddPoint
(
const
wxPoint
&
point
)
{
{
m_
PolyP
oints
.
push_back
(
point
);
m_
p
oints
.
push_back
(
point
);
}
}
/**
* Function SetPoint
* sets the point at \a aIndex in the list to \a aPoint.
*
* @param aIndex The index in the point list.
* @param aPoint The new point value.
*/
void
SetPoint
(
int
aIndex
,
const
wxPoint
&
aPoint
)
{
// (unsigned) excludes aIndex<0 also
wxCHECK_RET
(
(
unsigned
)
aIndex
<
m_points
.
size
(),
wxT
(
"Invalid SCH_POLYLINE point list index."
)
);
m_points
[
aIndex
]
=
aPoint
;
}
/**
/**
* Function GetCornerCount
* Function GetCornerCount
* @return the number of corners
* @return the number of corners
*/
*/
unsigned
GetCornerCount
()
const
{
return
m_points
.
size
();
}
unsigned
GetCornerCount
()
const
{
return
m_PolyPoints
.
size
();
}
/**
/**
* Function GetPenSize
* Function GetPenSize
...
@@ -105,7 +121,7 @@ public:
...
@@ -105,7 +121,7 @@ public:
virtual
void
Move
(
const
wxPoint
&
aMoveVector
)
virtual
void
Move
(
const
wxPoint
&
aMoveVector
)
{
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
m_
PolyP
oints
[
ii
]
+=
aMoveVector
;
m_
p
oints
[
ii
]
+=
aMoveVector
;
}
}
/**
/**
...
@@ -123,11 +139,26 @@ public:
...
@@ -123,11 +139,26 @@ public:
virtual
BITMAP_DEF
GetMenuImage
()
const
;
virtual
BITMAP_DEF
GetMenuImage
()
const
;
/**
* Function operator[]
* is used for read only access and returns the point at \a aIndex.
* @param aIndex The index of the list of points to return.
* @return A wxPoint object containing the point at \a aIndex.
*/
wxPoint
operator
[](
int
aIndex
)
const
{
// (unsigned) excludes aIndex<0 also
wxCHECK_MSG
(
(
unsigned
)
aIndex
<
m_points
.
size
(),
wxDefaultPosition
,
wxT
(
"Invalid SCH_POLYLINE point list index."
)
);
return
m_points
[
aIndex
];
}
private
:
private
:
virtual
bool
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
)
const
;
virtual
bool
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
)
const
;
virtual
bool
doHitTest
(
const
EDA_RECT
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
;
virtual
bool
doHitTest
(
const
EDA_RECT
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
wxPoint
doGetPosition
()
const
{
return
m_
PolyP
oints
[
0
];
}
virtual
wxPoint
doGetPosition
()
const
{
return
m_
p
oints
[
0
];
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
);
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
);
};
};
...
...
eeschema/sch_screen.cpp
View file @
1047e60e
...
@@ -720,7 +720,7 @@ SCH_SHEET* SCH_SCREEN::GetSheet( const wxString& aName )
...
@@ -720,7 +720,7 @@ SCH_SHEET* SCH_SCREEN::GetSheet( const wxString& aName )
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
item
;
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
item
;
if
(
aName
.
CmpNoCase
(
sheet
->
m_SheetName
)
==
0
)
if
(
aName
.
CmpNoCase
(
sheet
->
GetName
()
)
==
0
)
return
sheet
;
return
sheet
;
}
}
...
...
eeschema/sch_sheet.cpp
View file @
1047e60e
...
@@ -51,50 +51,50 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
...
@@ -51,50 +51,50 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
SCH_ITEM
(
NULL
,
SCH_SHEET_T
)
SCH_ITEM
(
NULL
,
SCH_SHEET_T
)
{
{
m_Layer
=
LAYER_SHEET
;
m_Layer
=
LAYER_SHEET
;
m_
P
os
=
pos
;
m_
p
os
=
pos
;
m_
S
ize
=
wxSize
(
MIN_SHEET_WIDTH
,
MIN_SHEET_HEIGHT
);
m_
s
ize
=
wxSize
(
MIN_SHEET_WIDTH
,
MIN_SHEET_HEIGHT
);
m_TimeStamp
=
GetNewTimeStamp
();
m_TimeStamp
=
GetNewTimeStamp
();
m_
SheetNameSize
=
m_F
ileNameSize
=
60
;
m_
sheetNameSize
=
m_f
ileNameSize
=
60
;
m_
AssociatedS
creen
=
NULL
;
m_
s
creen
=
NULL
;
m_
SheetN
ame
.
Printf
(
wxT
(
"Sheet%8.8lX"
),
m_TimeStamp
);
m_
n
ame
.
Printf
(
wxT
(
"Sheet%8.8lX"
),
m_TimeStamp
);
m_
F
ileName
.
Printf
(
wxT
(
"file%8.8lX.sch"
),
m_TimeStamp
);
m_
f
ileName
.
Printf
(
wxT
(
"file%8.8lX.sch"
),
m_TimeStamp
);
}
}
SCH_SHEET
::
SCH_SHEET
(
const
SCH_SHEET
&
aSheet
)
:
SCH_SHEET
::
SCH_SHEET
(
const
SCH_SHEET
&
aSheet
)
:
SCH_ITEM
(
aSheet
)
SCH_ITEM
(
aSheet
)
{
{
m_
Pos
=
aSheet
.
m_P
os
;
m_
pos
=
aSheet
.
m_p
os
;
m_
Size
=
aSheet
.
m_S
ize
;
m_
size
=
aSheet
.
m_s
ize
;
m_Layer
=
aSheet
.
m_Layer
;
m_Layer
=
aSheet
.
m_Layer
;
m_TimeStamp
=
aSheet
.
m_TimeStamp
;
m_TimeStamp
=
aSheet
.
m_TimeStamp
;
m_
SheetNameSize
=
aSheet
.
m_S
heetNameSize
;
m_
sheetNameSize
=
aSheet
.
m_s
heetNameSize
;
m_
FileNameSize
=
aSheet
.
m_F
ileNameSize
;
m_
fileNameSize
=
aSheet
.
m_f
ileNameSize
;
m_
AssociatedScreen
=
aSheet
.
m_AssociatedS
creen
;
m_
screen
=
aSheet
.
m_s
creen
;
m_
SheetName
=
aSheet
.
m_SheetN
ame
;
m_
name
=
aSheet
.
m_n
ame
;
m_
FileName
=
aSheet
.
m_F
ileName
;
m_
fileName
=
aSheet
.
m_f
ileName
;
m_pins
=
aSheet
.
m_pins
;
m_pins
=
aSheet
.
m_pins
;
for
(
size_t
i
=
0
;
i
<
m_pins
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
m_pins
.
size
();
i
++
)
m_pins
[
i
].
SetParent
(
this
);
m_pins
[
i
].
SetParent
(
this
);
if
(
m_
AssociatedS
creen
)
if
(
m_
s
creen
)
m_
AssociatedS
creen
->
IncRefCount
();
m_
s
creen
->
IncRefCount
();
}
}
SCH_SHEET
::~
SCH_SHEET
()
SCH_SHEET
::~
SCH_SHEET
()
{
{
wxLogDebug
(
wxT
(
"Destroying sheet "
)
+
m_
SheetN
ame
);
wxLogDebug
(
wxT
(
"Destroying sheet "
)
+
m_
n
ame
);
// also, look at the associated sheet & its reference count
// also, look at the associated sheet & its reference count
// perhaps it should be deleted also.
// perhaps it should be deleted also.
if
(
m_
AssociatedS
creen
)
if
(
m_
s
creen
)
{
{
m_
AssociatedS
creen
->
DecRefCount
();
m_
s
creen
->
DecRefCount
();
if
(
m_
AssociatedS
creen
->
GetRefCount
()
==
0
)
if
(
m_
s
creen
->
GetRefCount
()
==
0
)
delete
m_
AssociatedS
creen
;
delete
m_
s
creen
;
}
}
}
}
...
@@ -107,33 +107,33 @@ EDA_ITEM* SCH_SHEET::doClone() const
...
@@ -107,33 +107,33 @@ EDA_ITEM* SCH_SHEET::doClone() const
void
SCH_SHEET
::
SetScreen
(
SCH_SCREEN
*
aScreen
)
void
SCH_SHEET
::
SetScreen
(
SCH_SCREEN
*
aScreen
)
{
{
if
(
aScreen
==
m_
AssociatedS
creen
)
if
(
aScreen
==
m_
s
creen
)
return
;
return
;
if
(
m_
AssociatedS
creen
!=
NULL
)
if
(
m_
s
creen
!=
NULL
)
{
{
m_
AssociatedS
creen
->
DecRefCount
();
m_
s
creen
->
DecRefCount
();
if
(
m_
AssociatedS
creen
->
GetRefCount
()
==
0
)
if
(
m_
s
creen
->
GetRefCount
()
==
0
)
{
{
delete
m_
AssociatedS
creen
;
delete
m_
s
creen
;
m_
AssociatedS
creen
=
NULL
;
m_
s
creen
=
NULL
;
}
}
}
}
m_
AssociatedS
creen
=
aScreen
;
m_
s
creen
=
aScreen
;
if
(
m_
AssociatedS
creen
)
if
(
m_
s
creen
)
m_
AssociatedS
creen
->
IncRefCount
();
m_
s
creen
->
IncRefCount
();
}
}
int
SCH_SHEET
::
GetScreenCount
()
const
int
SCH_SHEET
::
GetScreenCount
()
const
{
{
if
(
m_
AssociatedS
creen
==
NULL
)
if
(
m_
s
creen
==
NULL
)
return
0
;
return
0
;
return
m_
AssociatedS
creen
->
GetRefCount
();
return
m_
s
creen
->
GetRefCount
();
}
}
...
@@ -141,7 +141,7 @@ bool SCH_SHEET::Save( FILE* aFile ) const
...
@@ -141,7 +141,7 @@ bool SCH_SHEET::Save( FILE* aFile ) const
{
{
if
(
fprintf
(
aFile
,
"$Sheet
\n
"
)
==
EOF
if
(
fprintf
(
aFile
,
"$Sheet
\n
"
)
==
EOF
||
fprintf
(
aFile
,
"S %-4d %-4d %-4d %-4d
\n
"
,
||
fprintf
(
aFile
,
"S %-4d %-4d %-4d %-4d
\n
"
,
m_
Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
,
m_S
ize
.
y
)
==
EOF
)
m_
pos
.
x
,
m_pos
.
y
,
m_size
.
x
,
m_s
ize
.
y
)
==
EOF
)
return
false
;
return
false
;
//save the unique timestamp, like other schematic parts.
//save the unique timestamp, like other schematic parts.
...
@@ -149,17 +149,17 @@ bool SCH_SHEET::Save( FILE* aFile ) const
...
@@ -149,17 +149,17 @@ bool SCH_SHEET::Save( FILE* aFile ) const
return
false
;
return
false
;
/* Save schematic sheetname and filename. */
/* Save schematic sheetname and filename. */
if
(
!
m_
SheetN
ame
.
IsEmpty
()
)
if
(
!
m_
n
ame
.
IsEmpty
()
)
{
{
if
(
fprintf
(
aFile
,
"F0 %s %d
\n
"
,
EscapedUTF8
(
m_
SheetN
ame
).
c_str
(),
if
(
fprintf
(
aFile
,
"F0 %s %d
\n
"
,
EscapedUTF8
(
m_
n
ame
).
c_str
(),
m_
S
heetNameSize
)
==
EOF
)
m_
s
heetNameSize
)
==
EOF
)
return
false
;
return
false
;
}
}
if
(
!
m_
F
ileName
.
IsEmpty
()
)
if
(
!
m_
f
ileName
.
IsEmpty
()
)
{
{
if
(
fprintf
(
aFile
,
"F1 %s %d
\n
"
,
EscapedUTF8
(
m_
F
ileName
).
c_str
(),
if
(
fprintf
(
aFile
,
"F1 %s %d
\n
"
,
EscapedUTF8
(
m_
f
ileName
).
c_str
(),
m_
F
ileNameSize
)
==
EOF
)
m_
f
ileNameSize
)
==
EOF
)
return
false
;
return
false
;
}
}
...
@@ -204,7 +204,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -204,7 +204,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
/* Next line: must be "S xx yy nn mm" with xx, yy = sheet position
/* Next line: must be "S xx yy nn mm" with xx, yy = sheet position
* ( upper left corner ) et nn,mm = sheet size */
* ( upper left corner ) et nn,mm = sheet size */
if
(
(
sscanf
(
&
((
char
*
)
aLine
)[
1
],
"%d %d %d %d"
,
if
(
(
sscanf
(
&
((
char
*
)
aLine
)[
1
],
"%d %d %d %d"
,
&
m_
Pos
.
x
,
&
m_Pos
.
y
,
&
m_Size
.
x
,
&
m_S
ize
.
y
)
!=
4
)
&
m_
pos
.
x
,
&
m_pos
.
y
,
&
m_size
.
x
,
&
m_s
ize
.
y
)
!=
4
)
||
(
((
char
*
)
aLine
)[
0
]
!=
'S'
)
)
||
(
((
char
*
)
aLine
)[
0
]
!=
'S'
)
)
{
{
aErrorMsg
.
Printf
(
wxT
(
" ** Eeschema file sheet struct error at line %d, aborted
\n
"
),
aErrorMsg
.
Printf
(
wxT
(
" ** Eeschema file sheet struct error at line %d, aborted
\n
"
),
...
@@ -239,6 +239,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -239,6 +239,7 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
* F1 and "text" for filename
* F1 and "text" for filename
*/
*/
ptcar
=
((
char
*
)
aLine
);
ptcar
=
((
char
*
)
aLine
);
while
(
*
ptcar
&&
(
*
ptcar
!=
'"'
)
)
while
(
*
ptcar
&&
(
*
ptcar
!=
'"'
)
)
ptcar
++
;
ptcar
++
;
...
@@ -270,18 +271,19 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -270,18 +271,19 @@ bool SCH_SHEET::Load( LINE_READER& aLine, wxString& aErrorMsg )
aErrorMsg
<<
FROM_UTF8
(
(
char
*
)
aLine
);
aErrorMsg
<<
FROM_UTF8
(
(
char
*
)
aLine
);
}
}
if
(
size
==
0
)
if
(
size
==
0
)
size
=
DEFAULT_SIZE_TEXT
;
size
=
DEFAULT_SIZE_TEXT
;
if
(
fieldNdx
==
0
)
if
(
fieldNdx
==
0
)
{
{
m_
SheetN
ame
=
sheetName
;
m_
n
ame
=
sheetName
;
m_
S
heetNameSize
=
size
;
m_
s
heetNameSize
=
size
;
}
}
else
else
{
{
SetFileName
(
sheetName
);
SetFileName
(
sheetName
);
m_
F
ileNameSize
=
size
;
m_
f
ileNameSize
=
size
;
}
}
}
}
...
@@ -320,11 +322,11 @@ void SCH_SHEET::SwapData( SCH_ITEM* aItem )
...
@@ -320,11 +322,11 @@ void SCH_SHEET::SwapData( SCH_ITEM* aItem )
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
aItem
;
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
aItem
;
EXCHG
(
m_
Pos
,
sheet
->
m_P
os
);
EXCHG
(
m_
pos
,
sheet
->
m_p
os
);
EXCHG
(
m_
Size
,
sheet
->
m_S
ize
);
EXCHG
(
m_
size
,
sheet
->
m_s
ize
);
EXCHG
(
m_
SheetName
,
sheet
->
m_SheetN
ame
);
EXCHG
(
m_
name
,
sheet
->
m_n
ame
);
EXCHG
(
m_
SheetNameSize
,
sheet
->
m_S
heetNameSize
);
EXCHG
(
m_
sheetNameSize
,
sheet
->
m_s
heetNameSize
);
EXCHG
(
m_
FileNameSize
,
sheet
->
m_F
ileNameSize
);
EXCHG
(
m_
fileNameSize
,
sheet
->
m_f
ileNameSize
);
m_pins
.
swap
(
sheet
->
m_pins
);
m_pins
.
swap
(
sheet
->
m_pins
);
// Ensure sheet labels have their .m_Parent member pointing really on their
// Ensure sheet labels have their .m_Parent member pointing really on their
...
@@ -369,7 +371,7 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
...
@@ -369,7 +371,7 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
}
}
wxLogDebug
(
wxT
(
"Fix me: attempt to remove label %s which is not in sheet %s."
),
wxLogDebug
(
wxT
(
"Fix me: attempt to remove label %s which is not in sheet %s."
),
GetChars
(
aSheetPin
->
m_Text
),
GetChars
(
m_
SheetN
ame
)
);
GetChars
(
aSheetPin
->
m_Text
),
GetChars
(
m_
n
ame
)
);
}
}
...
@@ -401,7 +403,7 @@ bool SCH_SHEET::HasUndefinedPins()
...
@@ -401,7 +403,7 @@ bool SCH_SHEET::HasUndefinedPins()
BOOST_FOREACH
(
SCH_SHEET_PIN
pin
,
m_pins
)
BOOST_FOREACH
(
SCH_SHEET_PIN
pin
,
m_pins
)
{
{
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_ITEM
*
DrawStruct
=
m_
AssociatedS
creen
->
GetDrawItems
();
EDA_ITEM
*
DrawStruct
=
m_
s
creen
->
GetDrawItems
();
SCH_HIERLABEL
*
HLabel
=
NULL
;
SCH_HIERLABEL
*
HLabel
=
NULL
;
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Next
()
)
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Next
()
)
...
@@ -465,7 +467,7 @@ int SCH_SHEET::GetMinHeight() const
...
@@ -465,7 +467,7 @@ int SCH_SHEET::GetMinHeight() const
for
(
size_t
i
=
0
;
i
<
m_pins
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
m_pins
.
size
();
i
++
)
{
{
int
pinY
=
m_pins
[
i
].
m_Pos
.
y
-
m_
P
os
.
y
;
int
pinY
=
m_pins
[
i
].
m_Pos
.
y
-
m_
p
os
.
y
;
if
(
pinY
>
height
)
if
(
pinY
>
height
)
height
=
pinY
;
height
=
pinY
;
...
@@ -509,7 +511,7 @@ void SCH_SHEET::CleanupSheet()
...
@@ -509,7 +511,7 @@ void SCH_SHEET::CleanupSheet()
while
(
i
!=
m_pins
.
end
()
)
while
(
i
!=
m_pins
.
end
()
)
{
{
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_ITEM
*
DrawStruct
=
m_
AssociatedS
creen
->
GetDrawItems
();
EDA_ITEM
*
DrawStruct
=
m_
s
creen
->
GetDrawItems
();
SCH_HIERLABEL
*
HLabel
=
NULL
;
SCH_HIERLABEL
*
HLabel
=
NULL
;
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Next
()
)
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Next
()
)
...
@@ -553,11 +555,12 @@ int SCH_SHEET::GetPenSize() const
...
@@ -553,11 +555,12 @@ int SCH_SHEET::GetPenSize() const
wxPoint
SCH_SHEET
::
GetSheetNamePosition
()
wxPoint
SCH_SHEET
::
GetSheetNamePosition
()
{
{
wxPoint
pos
=
m_Pos
;
wxPoint
pos
=
m_pos
;
if
(
IsVerticalOrientation
()
)
if
(
IsVerticalOrientation
()
)
{
{
pos
.
x
-=
8
;
pos
.
x
-=
8
;
pos
.
y
+=
m_
S
ize
.
y
;
pos
.
y
+=
m_
s
ize
.
y
;
}
}
else
else
{
{
...
@@ -570,17 +573,17 @@ wxPoint SCH_SHEET::GetSheetNamePosition()
...
@@ -570,17 +573,17 @@ wxPoint SCH_SHEET::GetSheetNamePosition()
wxPoint
SCH_SHEET
::
GetFileNamePosition
()
wxPoint
SCH_SHEET
::
GetFileNamePosition
()
{
{
wxPoint
pos
=
m_
P
os
;
wxPoint
pos
=
m_
p
os
;
int
margin
=
GetPenSize
()
+
4
;
int
margin
=
GetPenSize
()
+
4
;
if
(
IsVerticalOrientation
()
)
if
(
IsVerticalOrientation
()
)
{
{
pos
.
x
+=
m_
S
ize
.
x
+
margin
;
pos
.
x
+=
m_
s
ize
.
x
+
margin
;
pos
.
y
+=
m_
S
ize
.
y
;
pos
.
y
+=
m_
s
ize
.
y
;
}
}
else
else
{
{
pos
.
y
+=
m_
S
ize
.
y
+
margin
;
pos
.
y
+=
m_
s
ize
.
y
+
margin
;
}
}
return
pos
;
return
pos
;
...
@@ -595,7 +598,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
...
@@ -595,7 +598,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int
color
;
int
color
;
int
name_orientation
;
int
name_orientation
;
wxPoint
pos_sheetname
,
pos_filename
;
wxPoint
pos_sheetname
,
pos_filename
;
wxPoint
pos
=
m_
P
os
+
aOffset
;
wxPoint
pos
=
m_
p
os
+
aOffset
;
int
lineWidth
=
GetPenSize
();
int
lineWidth
=
GetPenSize
();
if
(
aColor
>=
0
)
if
(
aColor
>=
0
)
...
@@ -606,7 +609,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
...
@@ -606,7 +609,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode
(
aDC
,
aDrawMode
);
GRSetDrawMode
(
aDC
,
aDrawMode
);
GRRect
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos
.
x
,
pos
.
y
,
GRRect
(
&
aPanel
->
m_ClipBox
,
aDC
,
pos
.
x
,
pos
.
y
,
pos
.
x
+
m_
Size
.
x
,
pos
.
y
+
m_S
ize
.
y
,
lineWidth
,
color
);
pos
.
x
+
m_
size
.
x
,
pos
.
y
+
m_s
ize
.
y
,
lineWidth
,
color
);
pos_sheetname
=
GetSheetNamePosition
()
+
aOffset
;
pos_sheetname
=
GetSheetNamePosition
()
+
aOffset
;
pos_filename
=
GetFileNamePosition
()
+
aOffset
;
pos_filename
=
GetFileNamePosition
()
+
aOffset
;
...
@@ -622,10 +625,10 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
...
@@ -622,10 +625,10 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
else
else
txtcolor
=
ReturnLayerColor
(
LAYER_SHEETNAME
);
txtcolor
=
ReturnLayerColor
(
LAYER_SHEETNAME
);
Text
=
wxT
(
"Sheet: "
)
+
m_
SheetN
ame
;
Text
=
wxT
(
"Sheet: "
)
+
m_
n
ame
;
DrawGraphicText
(
aPanel
,
aDC
,
pos_sheetname
,
DrawGraphicText
(
aPanel
,
aDC
,
pos_sheetname
,
(
EDA_Colors
)
txtcolor
,
Text
,
name_orientation
,
(
EDA_Colors
)
txtcolor
,
Text
,
name_orientation
,
wxSize
(
m_
SheetNameSize
,
m_S
heetNameSize
),
wxSize
(
m_
sheetNameSize
,
m_s
heetNameSize
),
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_BOTTOM
,
lineWidth
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_BOTTOM
,
lineWidth
,
false
,
false
);
false
,
false
);
...
@@ -635,10 +638,10 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
...
@@ -635,10 +638,10 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
else
else
txtcolor
=
ReturnLayerColor
(
LAYER_SHEETFILENAME
);
txtcolor
=
ReturnLayerColor
(
LAYER_SHEETFILENAME
);
Text
=
wxT
(
"File: "
)
+
m_
F
ileName
;
Text
=
wxT
(
"File: "
)
+
m_
f
ileName
;
DrawGraphicText
(
aPanel
,
aDC
,
pos_filename
,
DrawGraphicText
(
aPanel
,
aDC
,
pos_filename
,
(
EDA_Colors
)
txtcolor
,
Text
,
name_orientation
,
(
EDA_Colors
)
txtcolor
,
Text
,
name_orientation
,
wxSize
(
m_
FileNameSize
,
m_F
ileNameSize
),
wxSize
(
m_
fileNameSize
,
m_f
ileNameSize
),
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_TOP
,
lineWidth
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_TOP
,
lineWidth
,
false
,
false
);
false
,
false
);
...
@@ -655,26 +658,26 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
...
@@ -655,26 +658,26 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
EDA_RECT
SCH_SHEET
::
GetBoundingBox
()
const
EDA_RECT
SCH_SHEET
::
GetBoundingBox
()
const
{
{
wxPoint
end
;
wxPoint
end
;
EDA_RECT
box
(
m_
Pos
,
m_S
ize
);
EDA_RECT
box
(
m_
pos
,
m_s
ize
);
int
lineWidth
=
GetPenSize
();
int
lineWidth
=
GetPenSize
();
// Determine length of texts
// Determine length of texts
wxString
text
=
wxT
(
"Sheet: "
)
+
m_
SheetN
ame
;
wxString
text
=
wxT
(
"Sheet: "
)
+
m_
n
ame
;
int
textlen
=
ReturnGraphicTextWidth
(
text
,
m_
S
heetNameSize
,
false
,
lineWidth
);
int
textlen
=
ReturnGraphicTextWidth
(
text
,
m_
s
heetNameSize
,
false
,
lineWidth
);
text
=
wxT
(
"File: "
)
+
m_
F
ileName
;
text
=
wxT
(
"File: "
)
+
m_
f
ileName
;
int
textlen2
=
ReturnGraphicTextWidth
(
text
,
m_
F
ileNameSize
,
false
,
lineWidth
);
int
textlen2
=
ReturnGraphicTextWidth
(
text
,
m_
f
ileNameSize
,
false
,
lineWidth
);
// Calculate bounding box X size:
// Calculate bounding box X size:
textlen
=
MAX
(
textlen
,
textlen2
);
textlen
=
MAX
(
textlen
,
textlen2
);
end
.
x
=
MAX
(
m_
S
ize
.
x
,
textlen
);
end
.
x
=
MAX
(
m_
s
ize
.
x
,
textlen
);
// Calculate bounding box pos:
// Calculate bounding box pos:
end
.
y
=
m_
S
ize
.
y
;
end
.
y
=
m_
s
ize
.
y
;
end
+=
m_
P
os
;
end
+=
m_
p
os
;
// Move upper and lower limits to include texts:
// Move upper and lower limits to include texts:
box
.
m_Pos
.
y
-=
wxRound
(
m_
S
heetNameSize
*
1.3
)
+
8
;
box
.
m_Pos
.
y
-=
wxRound
(
m_
s
heetNameSize
*
1.3
)
+
8
;
end
.
y
+=
wxRound
(
m_
F
ileNameSize
*
1.3
)
+
8
;
end
.
y
+=
wxRound
(
m_
f
ileNameSize
*
1.3
)
+
8
;
box
.
SetEnd
(
end
);
box
.
SetEnd
(
end
);
box
.
Inflate
(
lineWidth
/
2
);
box
.
Inflate
(
lineWidth
/
2
);
...
@@ -687,11 +690,11 @@ int SCH_SHEET::ComponentCount()
...
@@ -687,11 +690,11 @@ int SCH_SHEET::ComponentCount()
{
{
int
n
=
0
;
int
n
=
0
;
if
(
m_
AssociatedS
creen
)
if
(
m_
s
creen
)
{
{
EDA_ITEM
*
bs
;
EDA_ITEM
*
bs
;
for
(
bs
=
m_
AssociatedS
creen
->
GetDrawItems
();
bs
!=
NULL
;
bs
=
bs
->
Next
()
)
for
(
bs
=
m_
s
creen
->
GetDrawItems
();
bs
!=
NULL
;
bs
=
bs
->
Next
()
)
{
{
if
(
bs
->
Type
()
==
SCH_COMPONENT_T
)
if
(
bs
->
Type
()
==
SCH_COMPONENT_T
)
{
{
...
@@ -715,9 +718,9 @@ int SCH_SHEET::ComponentCount()
...
@@ -715,9 +718,9 @@ int SCH_SHEET::ComponentCount()
bool
SCH_SHEET
::
SearchHierarchy
(
const
wxString
&
aFilename
,
SCH_SCREEN
**
aScreen
)
bool
SCH_SHEET
::
SearchHierarchy
(
const
wxString
&
aFilename
,
SCH_SCREEN
**
aScreen
)
{
{
if
(
m_
AssociatedS
creen
)
if
(
m_
s
creen
)
{
{
EDA_ITEM
*
item
=
m_
AssociatedS
creen
->
GetDrawItems
();
EDA_ITEM
*
item
=
m_
s
creen
->
GetDrawItems
();
while
(
item
)
while
(
item
)
{
{
...
@@ -725,10 +728,10 @@ bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen
...
@@ -725,10 +728,10 @@ bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen
{
{
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
item
;
SCH_SHEET
*
sheet
=
(
SCH_SHEET
*
)
item
;
if
(
sheet
->
m_
AssociatedS
creen
if
(
sheet
->
m_
s
creen
&&
sheet
->
m_
AssociatedS
creen
->
GetFileName
().
CmpNoCase
(
aFilename
)
==
0
)
&&
sheet
->
m_
s
creen
->
GetFileName
().
CmpNoCase
(
aFilename
)
==
0
)
{
{
*
aScreen
=
sheet
->
m_
AssociatedS
creen
;
*
aScreen
=
sheet
->
m_
s
creen
;
return
true
;
return
true
;
}
}
...
@@ -746,14 +749,14 @@ bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen
...
@@ -746,14 +749,14 @@ bool SCH_SHEET::SearchHierarchy( const wxString& aFilename, SCH_SCREEN** aScreen
bool
SCH_SHEET
::
LocatePathOfScreen
(
SCH_SCREEN
*
aScreen
,
SCH_SHEET_PATH
*
aList
)
bool
SCH_SHEET
::
LocatePathOfScreen
(
SCH_SCREEN
*
aScreen
,
SCH_SHEET_PATH
*
aList
)
{
{
if
(
m_
AssociatedS
creen
)
if
(
m_
s
creen
)
{
{
aList
->
Push
(
this
);
aList
->
Push
(
this
);
if
(
m_
AssociatedS
creen
==
aScreen
)
if
(
m_
s
creen
==
aScreen
)
return
true
;
return
true
;
EDA_ITEM
*
strct
=
m_
AssociatedS
creen
->
GetDrawItems
();
EDA_ITEM
*
strct
=
m_
s
creen
->
GetDrawItems
();
while
(
strct
)
while
(
strct
)
{
{
...
@@ -778,10 +781,10 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
...
@@ -778,10 +781,10 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
{
{
bool
success
=
true
;
bool
success
=
true
;
if
(
!
m_
AssociatedS
creen
)
if
(
!
m_
s
creen
)
{
{
SCH_SCREEN
*
screen
=
NULL
;
SCH_SCREEN
*
screen
=
NULL
;
g_RootSheet
->
SearchHierarchy
(
m_
F
ileName
,
&
screen
);
g_RootSheet
->
SearchHierarchy
(
m_
f
ileName
,
&
screen
);
if
(
screen
)
if
(
screen
)
{
{
...
@@ -792,11 +795,11 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
...
@@ -792,11 +795,11 @@ bool SCH_SHEET::Load( SCH_EDIT_FRAME* aFrame )
else
else
{
{
SetScreen
(
new
SCH_SCREEN
()
);
SetScreen
(
new
SCH_SCREEN
()
);
success
=
aFrame
->
LoadOneEEFile
(
m_
AssociatedScreen
,
m_F
ileName
);
success
=
aFrame
->
LoadOneEEFile
(
m_
screen
,
m_f
ileName
);
if
(
success
)
if
(
success
)
{
{
EDA_ITEM
*
bs
=
m_
AssociatedS
creen
->
GetDrawItems
();
EDA_ITEM
*
bs
=
m_
s
creen
->
GetDrawItems
();
while
(
bs
)
while
(
bs
)
{
{
...
@@ -822,9 +825,9 @@ int SCH_SHEET::CountSheets()
...
@@ -822,9 +825,9 @@ int SCH_SHEET::CountSheets()
{
{
int
count
=
1
;
//1 = this!!
int
count
=
1
;
//1 = this!!
if
(
m_
AssociatedS
creen
)
if
(
m_
s
creen
)
{
{
EDA_ITEM
*
strct
=
m_
AssociatedS
creen
->
GetDrawItems
();
EDA_ITEM
*
strct
=
m_
s
creen
->
GetDrawItems
();
for
(
;
strct
;
strct
=
strct
->
Next
()
)
for
(
;
strct
;
strct
=
strct
->
Next
()
)
{
{
...
@@ -841,18 +844,19 @@ int SCH_SHEET::CountSheets()
...
@@ -841,18 +844,19 @@ int SCH_SHEET::CountSheets()
wxString
SCH_SHEET
::
GetFileName
(
void
)
const
wxString
SCH_SHEET
::
GetFileName
(
void
)
const
{
{
return
m_
F
ileName
;
return
m_
f
ileName
;
}
}
void
SCH_SHEET
::
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
)
void
SCH_SHEET
::
DisplayInfo
(
EDA_DRAW_FRAME
*
frame
)
{
{
frame
->
ClearMsgPanel
();
frame
->
ClearMsgPanel
();
frame
->
AppendMsgPanel
(
_
(
"Sheet name"
),
m_SheetName
,
CYAN
);
frame
->
AppendMsgPanel
(
_
(
"Sheet name"
),
m_name
,
CYAN
);
frame
->
AppendMsgPanel
(
_
(
"File name"
),
m_FileName
,
BROWN
);
frame
->
AppendMsgPanel
(
_
(
"File name"
),
m_fileName
,
BROWN
);
#if 0 // Set to 1 to display the sheet time stamp (mainly for test)
#if 0 // Set to 1 to display the sheet time stamp (mainly for test)
wxString msg;
wxString msg;
msg.Printf(
wxT("%.8X"
), m_TimeStamp );
msg.Printf(
wxT( "%.8X"
), m_TimeStamp );
frame->AppendMsgPanel( _( "Time Stamp" ), msg, BLUE );
frame->AppendMsgPanel( _( "Time Stamp" ), msg, BLUE );
#endif
#endif
}
}
...
@@ -860,19 +864,19 @@ void SCH_SHEET::DisplayInfo( EDA_DRAW_FRAME* frame )
...
@@ -860,19 +864,19 @@ void SCH_SHEET::DisplayInfo( EDA_DRAW_FRAME* frame )
void
SCH_SHEET
::
Rotate
(
wxPoint
rotationPoint
)
void
SCH_SHEET
::
Rotate
(
wxPoint
rotationPoint
)
{
{
RotatePoint
(
&
m_
P
os
,
rotationPoint
,
900
);
RotatePoint
(
&
m_
p
os
,
rotationPoint
,
900
);
RotatePoint
(
&
m_
Size
.
x
,
&
m_S
ize
.
y
,
900
);
RotatePoint
(
&
m_
size
.
x
,
&
m_s
ize
.
y
,
900
);
if
(
m_
S
ize
.
x
<
0
)
if
(
m_
s
ize
.
x
<
0
)
{
{
m_
Pos
.
x
+=
m_S
ize
.
x
;
m_
pos
.
x
+=
m_s
ize
.
x
;
NEGATE
(
m_
S
ize
.
x
);
NEGATE
(
m_
s
ize
.
x
);
}
}
if
(
m_
S
ize
.
y
<
0
)
if
(
m_
s
ize
.
y
<
0
)
{
{
m_
Pos
.
y
+=
m_S
ize
.
y
;
m_
pos
.
y
+=
m_s
ize
.
y
;
NEGATE
(
m_
S
ize
.
y
);
NEGATE
(
m_
s
ize
.
y
);
}
}
BOOST_FOREACH
(
SCH_SHEET_PIN
&
sheetPin
,
m_pins
)
BOOST_FOREACH
(
SCH_SHEET_PIN
&
sheetPin
,
m_pins
)
...
@@ -884,10 +888,10 @@ void SCH_SHEET::Rotate(wxPoint rotationPoint)
...
@@ -884,10 +888,10 @@ void SCH_SHEET::Rotate(wxPoint rotationPoint)
void
SCH_SHEET
::
Mirror_X
(
int
aXaxis_position
)
void
SCH_SHEET
::
Mirror_X
(
int
aXaxis_position
)
{
{
m_
P
os
.
y
-=
aXaxis_position
;
m_
p
os
.
y
-=
aXaxis_position
;
NEGATE
(
m_
P
os
.
y
);
NEGATE
(
m_
p
os
.
y
);
m_
P
os
.
y
+=
aXaxis_position
;
m_
p
os
.
y
+=
aXaxis_position
;
m_
Pos
.
y
-=
m_S
ize
.
y
;
m_
pos
.
y
-=
m_s
ize
.
y
;
BOOST_FOREACH
(
SCH_SHEET_PIN
&
sheetPin
,
m_pins
)
BOOST_FOREACH
(
SCH_SHEET_PIN
&
sheetPin
,
m_pins
)
{
{
...
@@ -898,10 +902,10 @@ void SCH_SHEET::Mirror_X( int aXaxis_position )
...
@@ -898,10 +902,10 @@ void SCH_SHEET::Mirror_X( int aXaxis_position )
void
SCH_SHEET
::
Mirror_Y
(
int
aYaxis_position
)
void
SCH_SHEET
::
Mirror_Y
(
int
aYaxis_position
)
{
{
m_
P
os
.
x
-=
aYaxis_position
;
m_
p
os
.
x
-=
aYaxis_position
;
NEGATE
(
m_
P
os
.
x
);
NEGATE
(
m_
p
os
.
x
);
m_
P
os
.
x
+=
aYaxis_position
;
m_
p
os
.
x
+=
aYaxis_position
;
m_
Pos
.
x
-=
m_S
ize
.
x
;
m_
pos
.
x
-=
m_s
ize
.
x
;
BOOST_FOREACH
(
SCH_SHEET_PIN
&
label
,
m_pins
)
BOOST_FOREACH
(
SCH_SHEET_PIN
&
label
,
m_pins
)
{
{
...
@@ -912,10 +916,10 @@ void SCH_SHEET::Mirror_Y( int aYaxis_position )
...
@@ -912,10 +916,10 @@ void SCH_SHEET::Mirror_Y( int aYaxis_position )
void
SCH_SHEET
::
Resize
(
const
wxSize
&
aSize
)
void
SCH_SHEET
::
Resize
(
const
wxSize
&
aSize
)
{
{
if
(
aSize
==
m_
S
ize
)
if
(
aSize
==
m_
s
ize
)
return
;
return
;
m_
S
ize
=
aSize
;
m_
s
ize
=
aSize
;
/* Move the sheet labels according to the new sheet size. */
/* Move the sheet labels according to the new sheet size. */
BOOST_FOREACH
(
SCH_SHEET_PIN
&
label
,
m_pins
)
BOOST_FOREACH
(
SCH_SHEET_PIN
&
label
,
m_pins
)
...
@@ -929,7 +933,7 @@ bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
...
@@ -929,7 +933,7 @@ bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
{
{
wxLogTrace
(
traceFindReplace
,
wxT
(
" item "
)
+
GetSelectMenuText
()
);
wxLogTrace
(
traceFindReplace
,
wxT
(
" item "
)
+
GetSelectMenuText
()
);
if
(
SCH_ITEM
::
Matches
(
m_
F
ileName
,
aSearchData
)
)
if
(
SCH_ITEM
::
Matches
(
m_
f
ileName
,
aSearchData
)
)
{
{
if
(
aFindLocation
)
if
(
aFindLocation
)
*
aFindLocation
=
GetFileNamePosition
();
*
aFindLocation
=
GetFileNamePosition
();
...
@@ -937,7 +941,7 @@ bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
...
@@ -937,7 +941,7 @@ bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
return
true
;
return
true
;
}
}
if
(
SCH_ITEM
::
Matches
(
m_
SheetN
ame
,
aSearchData
)
)
if
(
SCH_ITEM
::
Matches
(
m_
n
ame
,
aSearchData
)
)
{
{
if
(
aFindLocation
)
if
(
aFindLocation
)
*
aFindLocation
=
GetSheetNamePosition
();
*
aFindLocation
=
GetSheetNamePosition
();
...
@@ -1056,7 +1060,7 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR* aInspector, const void* aTestData,
...
@@ -1056,7 +1060,7 @@ SEARCH_RESULT SCH_SHEET::Visit( INSPECTOR* aInspector, const void* aTestData,
wxString
SCH_SHEET
::
GetSelectMenuText
()
const
wxString
SCH_SHEET
::
GetSelectMenuText
()
const
{
{
wxString
tmp
;
wxString
tmp
;
tmp
.
Printf
(
_
(
"Hierarchical Sheet %s"
),
GetChars
(
m_
SheetN
ame
)
);
tmp
.
Printf
(
_
(
"Hierarchical Sheet %s"
),
GetChars
(
m_
n
ame
)
);
return
tmp
;
return
tmp
;
}
}
...
@@ -1086,7 +1090,7 @@ bool SCH_SHEET::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
...
@@ -1086,7 +1090,7 @@ bool SCH_SHEET::doHitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
wxPoint
SCH_SHEET
::
GetResizePosition
()
const
wxPoint
SCH_SHEET
::
GetResizePosition
()
const
{
{
return
wxPoint
(
m_
Pos
.
x
+
m_Size
.
GetWidth
(),
m_Pos
.
y
+
m_S
ize
.
GetHeight
()
);
return
wxPoint
(
m_
pos
.
x
+
m_size
.
GetWidth
(),
m_pos
.
y
+
m_s
ize
.
GetHeight
()
);
}
}
...
@@ -1104,7 +1108,7 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
...
@@ -1104,7 +1108,7 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
item
->
m_Comp
=
&
m_pins
[
i
];
item
->
m_Comp
=
&
m_pins
[
i
];
item
->
m_Link
=
this
;
item
->
m_Link
=
this
;
item
->
m_Type
=
NET_SHEETLABEL
;
item
->
m_Type
=
NET_SHEETLABEL
;
item
->
m_ElectricalType
=
m_pins
[
i
].
m_Shape
;
item
->
m_ElectricalType
=
m_pins
[
i
].
GetShape
()
;
item
->
m_Label
=
m_pins
[
i
].
m_Text
;
item
->
m_Label
=
m_pins
[
i
].
m_Text
;
item
->
m_Start
=
item
->
m_End
=
m_pins
[
i
].
m_Pos
;
item
->
m_Start
=
item
->
m_End
=
m_pins
[
i
].
m_Pos
;
aNetListItems
.
push_back
(
item
);
aNetListItems
.
push_back
(
item
);
...
@@ -1129,37 +1133,38 @@ void SCH_SHEET::doPlot( PLOTTER* aPlotter )
...
@@ -1129,37 +1133,38 @@ void SCH_SHEET::doPlot( PLOTTER* aPlotter )
int
thickness
=
GetPenSize
();
int
thickness
=
GetPenSize
();
aPlotter
->
set_current_line_width
(
thickness
);
aPlotter
->
set_current_line_width
(
thickness
);
aPlotter
->
move_to
(
m_
P
os
);
aPlotter
->
move_to
(
m_
p
os
);
pos
=
m_
P
os
;
pos
=
m_
p
os
;
pos
.
x
+=
m_
S
ize
.
x
;
pos
.
x
+=
m_
s
ize
.
x
;
aPlotter
->
line_to
(
pos
);
aPlotter
->
line_to
(
pos
);
pos
.
y
+=
m_
S
ize
.
y
;
pos
.
y
+=
m_
s
ize
.
y
;
aPlotter
->
line_to
(
pos
);
aPlotter
->
line_to
(
pos
);
pos
=
m_
P
os
;
pos
=
m_
p
os
;
pos
.
y
+=
m_
S
ize
.
y
;
pos
.
y
+=
m_
s
ize
.
y
;
aPlotter
->
line_to
(
pos
);
aPlotter
->
line_to
(
pos
);
aPlotter
->
finish_to
(
m_
P
os
);
aPlotter
->
finish_to
(
m_
p
os
);
if
(
IsVerticalOrientation
()
)
if
(
IsVerticalOrientation
()
)
{
{
pos_sheetname
=
wxPoint
(
m_
Pos
.
x
-
8
,
m_Pos
.
y
+
m_S
ize
.
y
);
pos_sheetname
=
wxPoint
(
m_
pos
.
x
-
8
,
m_pos
.
y
+
m_s
ize
.
y
);
pos_filename
=
wxPoint
(
m_
Pos
.
x
+
m_Size
.
x
+
4
,
m_Pos
.
y
+
m_S
ize
.
y
);
pos_filename
=
wxPoint
(
m_
pos
.
x
+
m_size
.
x
+
4
,
m_pos
.
y
+
m_s
ize
.
y
);
name_orientation
=
TEXT_ORIENT_VERT
;
name_orientation
=
TEXT_ORIENT_VERT
;
}
}
else
else
{
{
pos_sheetname
=
wxPoint
(
m_
Pos
.
x
,
m_P
os
.
y
-
4
);
pos_sheetname
=
wxPoint
(
m_
pos
.
x
,
m_p
os
.
y
-
4
);
pos_filename
=
wxPoint
(
m_
Pos
.
x
,
m_Pos
.
y
+
m_S
ize
.
y
+
4
);
pos_filename
=
wxPoint
(
m_
pos
.
x
,
m_pos
.
y
+
m_s
ize
.
y
+
4
);
name_orientation
=
TEXT_ORIENT_HORIZ
;
name_orientation
=
TEXT_ORIENT_HORIZ
;
}
}
/* Draw texts: SheetName */
/* Draw texts: SheetName */
Text
=
m_
SheetN
ame
;
Text
=
m_
n
ame
;
size
=
wxSize
(
m_
SheetNameSize
,
m_S
heetNameSize
);
size
=
wxSize
(
m_
sheetNameSize
,
m_s
heetNameSize
);
//pos = m_
P
os; pos.y -= 4;
//pos = m_
p
os; pos.y -= 4;
thickness
=
g_DrawDefaultLineThickness
;
thickness
=
g_DrawDefaultLineThickness
;
thickness
=
Clamp_Text_PenSize
(
thickness
,
size
,
false
);
thickness
=
Clamp_Text_PenSize
(
thickness
,
size
,
false
);
...
@@ -1172,7 +1177,7 @@ void SCH_SHEET::doPlot( PLOTTER* aPlotter )
...
@@ -1172,7 +1177,7 @@ void SCH_SHEET::doPlot( PLOTTER* aPlotter )
/*Draw texts : FileName */
/*Draw texts : FileName */
Text
=
GetFileName
();
Text
=
GetFileName
();
size
=
wxSize
(
m_
FileNameSize
,
m_F
ileNameSize
);
size
=
wxSize
(
m_
fileNameSize
,
m_f
ileNameSize
);
thickness
=
g_DrawDefaultLineThickness
;
thickness
=
g_DrawDefaultLineThickness
;
thickness
=
Clamp_Text_PenSize
(
thickness
,
size
,
false
);
thickness
=
Clamp_Text_PenSize
(
thickness
,
size
,
false
);
...
@@ -1200,7 +1205,7 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os )
...
@@ -1200,7 +1205,7 @@ void SCH_SHEET::Show( int nestLevel, std::ostream& os )
wxString
s
=
GetClass
();
wxString
s
=
GetClass
();
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
s
.
Lower
().
mb_str
()
<<
">"
<<
" sheet_name=
\"
"
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
s
.
Lower
().
mb_str
()
<<
">"
<<
" sheet_name=
\"
"
<<
TO_UTF8
(
m_
SheetN
ame
)
<<
'"'
<<
">
\n
"
;
<<
TO_UTF8
(
m_
n
ame
)
<<
'"'
<<
">
\n
"
;
// show all the pins, and check the linked list integrity
// show all the pins, and check the linked list integrity
BOOST_FOREACH
(
SCH_SHEET_PIN
&
label
,
m_pins
)
BOOST_FOREACH
(
SCH_SHEET_PIN
&
label
,
m_pins
)
...
...
eeschema/sch_sheet.h
View file @
1047e60e
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
* @brief Definition of the SCH_SHEET class for Eeschema.
* @brief Definition of the SCH_SHEET class for Eeschema.
*/
*/
#ifndef
CLASS_DRAWSH
EET_H
#ifndef
SCH_SHE
EET_H
#define
CLASS_DRAWSH
EET_H
#define
SCH_SHE
EET_H
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
...
@@ -50,7 +50,8 @@ class SCH_EDIT_FRAME;
...
@@ -50,7 +50,8 @@ class SCH_EDIT_FRAME;
/**
/**
* Pin (label) used in sheets to create hierarchical schematics.
* Class SCH_SHEET_PIN
* defines a sheet pin (label) used in sheets to create hierarchical schematics.
*
*
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
* pin is used in a component. It connects the objects in the sheet object
* pin is used in a component. It connects the objects in the sheet object
...
@@ -59,23 +60,24 @@ class SCH_EDIT_FRAME;
...
@@ -59,23 +60,24 @@ class SCH_EDIT_FRAME;
* connected to a wire, bus, or label. In the schematic page represented by
* connected to a wire, bus, or label. In the schematic page represented by
* the sheet, it corresponds to a hierarchical label.
* the sheet, it corresponds to a hierarchical label.
*/
*/
class
SCH_SHEET_PIN
:
public
SCH_HIERLABEL
class
SCH_SHEET_PIN
:
public
SCH_HIERLABEL
{
{
private
:
private
:
int
m_
N
umber
;
///< Label number use for saving sheet label to file.
int
m_
n
umber
;
///< Label number use for saving sheet label to file.
///< Sheet label numbering begins at 2.
///< Sheet label numbering begins at 2.
///< 0 is reserved for the sheet name.
///< 0 is reserved for the sheet name.
///< 1 is reserve for the sheet file name.
///< 1 is reserve for the sheet file name.
int
m_Edge
;
/* For pin labels only: sheet edge (0 to 3) of the pin
* m_Edge define on which edge the pin is positioned:
/**
* Defines the edge of the sheet that the sheet pin is positioned
* 0: pin on left side
* 0: pin on left side
* 1: pin on right side
* 1: pin on right side
* 2: pin on top side
* 2: pin on top side
* 3: pin on bottom side
* 3: pin on bottom side
* for compatibility reasons, this does not follow same values as text
*
*
orientation.
* For compatibility reasons, this does not follow same values as text
orientation.
*/
*/
int
m_edge
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
...
@@ -118,7 +120,7 @@ public:
...
@@ -118,7 +120,7 @@ public:
*
*
* @return Number of the sheet label.
* @return Number of the sheet label.
*/
*/
int
GetNumber
()
const
{
return
m_
N
umber
;
}
int
GetNumber
()
const
{
return
m_
n
umber
;
}
/**
/**
* Set the sheet label number.
* Set the sheet label number.
...
@@ -202,15 +204,7 @@ public:
...
@@ -202,15 +204,7 @@ public:
virtual
void
Mirror_X
(
int
aXaxis_position
);
virtual
void
Mirror_X
(
int
aXaxis_position
);
/**
/**
* Function Matches
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
* Compare hierarchical pin name against search string.
*
* @param aSearchData - Criteria to search against.
* @param aAuxData - a pointer on auxiliary data, if needed.
* When searching string in REFERENCE field we must know the sheet path
* This param is used in this case
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
* @return True if this item matches the search criteria.
*/
*/
virtual
bool
Matches
(
wxFindReplaceData
&
aSearchData
,
void
*
aAuxData
,
wxPoint
*
aFindLocation
);
virtual
bool
Matches
(
wxFindReplaceData
&
aSearchData
,
void
*
aAuxData
,
wxPoint
*
aFindLocation
);
...
@@ -233,33 +227,40 @@ private:
...
@@ -233,33 +227,40 @@ private:
typedef
boost
::
ptr_vector
<
SCH_SHEET_PIN
>
SCH_SHEET_PINS
;
typedef
boost
::
ptr_vector
<
SCH_SHEET_PIN
>
SCH_SHEET_PINS
;
/*
class SCH_SHEET
/*
*
*
This class is the sheet symbol placed in a schematic, and is the entry point
*
Class SCH_SHEET
*
for a sub schematic
*
is the sheet symbol placed in a schematic, and is the entry point for a sub schematic.
*/
*/
class
SCH_SHEET
:
public
SCH_ITEM
class
SCH_SHEET
:
public
SCH_ITEM
{
{
SCH_SCREEN
*
m_AssociatedScreen
;
///< Screen that contains the physical data for
/// Screen that contains the physical data for the sheet. In complex hierarchies
///< the sheet. In complex hierarchies multiple
/// multiple sheets can share a common screen.
///< sheets can share a common screen.
SCH_SCREEN
*
m_screen
;
SCH_SHEET_PINS
m_pins
;
///< List of sheet connection points.
wxString
m_FileName
;
/* also in SCH_SCREEN (redundant),
* but need it here for loading after
* reading the sheet description from
* file. */
public
:
/// The list of sheet connection points.
wxString
m_SheetName
;
/* this is equivalent to C101 for
SCH_SHEET_PINS
m_pins
;
* components: it is stored in F0 ...
* of the file. */
/// The file name is also in the #SCH_SCREEN object associated with the sheet. It is
public
:
/// also needed here for loading after reading the sheet description from file.
int
m_SheetNameSize
;
/* Size (height) of the text, used to
wxString
m_fileName
;
* draw the sheet name */
int
m_FileNameSize
;
/* Size (height) of the text, used to
/// This is equivalent to the reference designator for components and is stored in F0
* draw the file name */
/// sheet pin in the schematic file.
wxPoint
m_Pos
;
wxString
m_name
;
wxSize
m_Size
;
/* Position and Size of *sheet symbol */
/// The height of the text used to draw the sheet name.
int
m_sheetNameSize
;
/// The height of the text used to draw the file name.
int
m_fileNameSize
;
/// The position of the sheet.
wxPoint
m_pos
;
/// The size of the sheet.
wxSize
m_size
;
friend
class
SCH_SHEET_PIN
;
public
:
public
:
SCH_SHEET
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
);
SCH_SHEET
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
);
...
@@ -273,7 +274,24 @@ public:
...
@@ -273,7 +274,24 @@ public:
return
wxT
(
"SCH_SHEET"
);
return
wxT
(
"SCH_SHEET"
);
}
}
SCH_SCREEN
*
GetScreen
()
{
return
m_AssociatedScreen
;
}
wxString
GetName
()
const
{
return
m_name
;
}
void
SetName
(
const
wxString
&
aName
)
{
m_name
=
aName
;
}
int
GetSheetNameSize
()
const
{
return
m_sheetNameSize
;
}
void
SetSheetNameSize
(
int
aSize
)
{
m_sheetNameSize
=
aSize
;
}
int
GetFileNameSize
()
const
{
return
m_fileNameSize
;
}
void
SetFileNameSize
(
int
aSize
)
{
m_fileNameSize
=
aSize
;
}
SCH_SCREEN
*
GetScreen
()
{
return
m_screen
;
}
wxSize
GetSize
()
{
return
m_size
;
}
void
SetSize
(
const
wxSize
&
aSize
)
{
m_size
=
aSize
;
}
/**
/**
* Function SetScreen
* Function SetScreen
...
@@ -462,9 +480,9 @@ public:
...
@@ -462,9 +480,9 @@ public:
/**
/**
* Function Load.
* Function Load.
* for the sheet: load the file m_
F
ileName
* for the sheet: load the file m_
f
ileName
* if a screen already exists, the file is already read.
* if a screen already exists, the file is already read.
* m_
AssociatedS
creen point on the screen, and its m_RefCount is
* m_
s
creen point on the screen, and its m_RefCount is
* incremented
* incremented
* else creates a new associated screen and load the data file.
* else creates a new associated screen and load the data file.
* @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic frame
* @param aFrame = a SCH_EDIT_FRAME pointer to the maim schematic frame
...
@@ -485,9 +503,9 @@ public:
...
@@ -485,9 +503,9 @@ public:
* Function LocatePathOfScreen
* Function LocatePathOfScreen
* search the existing hierarchy for an instance of screen "FileName".
* search the existing hierarchy for an instance of screen "FileName".
* don't bother looking at the root sheet - it must be unique,
* don't bother looking at the root sheet - it must be unique,
*
no other references to its m_AssociatedS
creen otherwise there would be
*
no other references to its m_s
creen otherwise there would be
*
loops
*
loops in the hierarchy.
*
in the hierarchy.
*
* @param aScreen = the SCH_SCREEN* screen that we search for
* @param aScreen = the SCH_SCREEN* screen that we search for
* @param aList = the SCH_SHEET_PATH* that must be used
* @param aList = the SCH_SHEET_PATH* that must be used
* @return true if found
* @return true if found
...
@@ -512,7 +530,7 @@ public:
...
@@ -512,7 +530,7 @@ public:
// Set a new filename without changing anything else
// Set a new filename without changing anything else
void
SetFileName
(
const
wxString
&
aFilename
)
void
SetFileName
(
const
wxString
&
aFilename
)
{
{
m_
F
ileName
=
aFilename
;
m_
f
ileName
=
aFilename
;
}
}
bool
ChangeFileName
(
SCH_EDIT_FRAME
*
aFrame
,
const
wxString
&
aFileName
);
bool
ChangeFileName
(
SCH_EDIT_FRAME
*
aFrame
,
const
wxString
&
aFileName
);
...
@@ -529,7 +547,7 @@ public:
...
@@ -529,7 +547,7 @@ public:
*/
*/
virtual
void
Move
(
const
wxPoint
&
aMoveVector
)
virtual
void
Move
(
const
wxPoint
&
aMoveVector
)
{
{
m_
P
os
+=
aMoveVector
;
m_
p
os
+=
aMoveVector
;
BOOST_FOREACH
(
SCH_SHEET_PIN
&
pin
,
m_pins
)
BOOST_FOREACH
(
SCH_SHEET_PIN
&
pin
,
m_pins
)
{
{
...
@@ -546,15 +564,7 @@ public:
...
@@ -546,15 +564,7 @@ public:
virtual
void
Rotate
(
wxPoint
rotationPoint
);
virtual
void
Rotate
(
wxPoint
rotationPoint
);
/**
/**
* Compare schematic sheet file and sheet name against search string.
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*
* @param aSearchData - Criteria to search against.
* @param aAuxData - a pointer on auxiliary data, if needed.
* When searching string in REFERENCE field we must know the sheet path
* This param is used in this case
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
*
* @return True if this item matches the search criteria.
*/
*/
virtual
bool
Matches
(
wxFindReplaceData
&
aSearchData
,
void
*
aAuxData
,
wxPoint
*
aFindLocation
);
virtual
bool
Matches
(
wxFindReplaceData
&
aSearchData
,
void
*
aAuxData
,
wxPoint
*
aFindLocation
);
...
@@ -627,11 +637,11 @@ private:
...
@@ -627,11 +637,11 @@ private:
virtual
bool
doHitTest
(
const
EDA_RECT
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
;
virtual
bool
doHitTest
(
const
EDA_RECT
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
void
doPlot
(
PLOTTER
*
aPlotter
);
virtual
void
doPlot
(
PLOTTER
*
aPlotter
);
virtual
wxPoint
doGetPosition
()
const
{
return
m_
P
os
;
}
virtual
wxPoint
doGetPosition
()
const
{
return
m_
p
os
;
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
)
{
m_
P
os
=
aPosition
;
}
virtual
void
doSetPosition
(
const
wxPoint
&
aPosition
)
{
m_
p
os
=
aPosition
;
}
};
};
typedef
std
::
vector
<
SCH_SHEET
*
>
SCH_SHEETS
;
typedef
std
::
vector
<
SCH_SHEET
*
>
SCH_SHEETS
;
#endif
/*
CLASS_DRAWSH
EET_H */
#endif
/*
SCH_SHE
EET_H */
eeschema/sch_sheet_path.cpp
View file @
1047e60e
...
@@ -217,7 +217,7 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const
...
@@ -217,7 +217,7 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const
// start at 1 to avoid the root sheet, as above.
// start at 1 to avoid the root sheet, as above.
for
(
unsigned
i
=
1
;
i
<
m_numSheets
;
i
++
)
for
(
unsigned
i
=
1
;
i
<
m_numSheets
;
i
++
)
{
{
s
=
s
+
m_sheets
[
i
]
->
m_SheetName
+
wxT
(
"/"
);
s
=
s
+
m_sheets
[
i
]
->
GetName
()
+
wxT
(
"/"
);
}
}
return
s
;
return
s
;
...
...
eeschema/sch_sheet_pin.cpp
View file @
1047e60e
...
@@ -43,16 +43,6 @@
...
@@ -43,16 +43,6 @@
#include "kicad_string.h"
#include "kicad_string.h"
/* m_Edge define on which edge the pin is positioned:
*
* 0: pin on left side
* 1: pin on right side
* 2: pin on top side
* 3: pin on bottom side
* for compatibility reasons, this does not follow same values as text
* orientation.
*/
SCH_SHEET_PIN
::
SCH_SHEET_PIN
(
SCH_SHEET
*
parent
,
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
SCH_SHEET_PIN
::
SCH_SHEET_PIN
(
SCH_SHEET
*
parent
,
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
SCH_HIERLABEL
(
pos
,
text
,
SCH_SHEET_PIN_T
)
SCH_HIERLABEL
(
pos
,
text
,
SCH_SHEET_PIN_T
)
{
{
...
@@ -66,17 +56,17 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr
...
@@ -66,17 +56,17 @@ SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent, const wxPoint& pos, const wxStr
else
else
SetEdge
(
0
);
SetEdge
(
0
);
m_
S
hape
=
NET_INPUT
;
m_
s
hape
=
NET_INPUT
;
m_
I
sDangling
=
true
;
m_
i
sDangling
=
true
;
m_
N
umber
=
2
;
m_
n
umber
=
2
;
}
}
SCH_SHEET_PIN
::
SCH_SHEET_PIN
(
const
SCH_SHEET_PIN
&
aSheetLabel
)
:
SCH_SHEET_PIN
::
SCH_SHEET_PIN
(
const
SCH_SHEET_PIN
&
aSheetLabel
)
:
SCH_HIERLABEL
(
aSheetLabel
)
SCH_HIERLABEL
(
aSheetLabel
)
{
{
m_
Number
=
aSheetLabel
.
m_N
umber
;
m_
number
=
aSheetLabel
.
m_n
umber
;
m_
Edge
=
aSheetLabel
.
m_E
dge
;
m_
edge
=
aSheetLabel
.
m_e
dge
;
}
}
...
@@ -132,7 +122,7 @@ void SCH_SHEET_PIN::SetNumber( int aNumber )
...
@@ -132,7 +122,7 @@ void SCH_SHEET_PIN::SetNumber( int aNumber )
{
{
wxASSERT
(
aNumber
>=
2
);
wxASSERT
(
aNumber
>=
2
);
m_
N
umber
=
aNumber
;
m_
n
umber
=
aNumber
;
}
}
...
@@ -168,27 +158,27 @@ void SCH_SHEET_PIN::SetEdge( int aEdge )
...
@@ -168,27 +158,27 @@ void SCH_SHEET_PIN::SetEdge( int aEdge )
/* use -1 to adjust text orientation without changing edge*/
/* use -1 to adjust text orientation without changing edge*/
if
(
aEdge
>
-
1
)
if
(
aEdge
>
-
1
)
m_
E
dge
=
aEdge
;
m_
e
dge
=
aEdge
;
switch
(
m_
E
dge
)
switch
(
m_
e
dge
)
{
{
case
0
:
/* pin on left side*/
case
0
:
/* pin on left side*/
m_Pos
.
x
=
Sheet
->
m_
P
os
.
x
;
m_Pos
.
x
=
Sheet
->
m_
p
os
.
x
;
SetOrientation
(
2
);
/* Orientation horiz inverse */
SetOrientation
(
2
);
/* Orientation horiz inverse */
break
;
break
;
case
1
:
/* pin on right side*/
case
1
:
/* pin on right side*/
m_Pos
.
x
=
Sheet
->
m_
Pos
.
x
+
Sheet
->
m_S
ize
.
x
;
m_Pos
.
x
=
Sheet
->
m_
pos
.
x
+
Sheet
->
m_s
ize
.
x
;
SetOrientation
(
0
);
/* Orientation horiz normal */
SetOrientation
(
0
);
/* Orientation horiz normal */
break
;
break
;
case
2
:
/* pin on top side*/
case
2
:
/* pin on top side*/
m_Pos
.
y
=
Sheet
->
m_
P
os
.
y
;
m_Pos
.
y
=
Sheet
->
m_
p
os
.
y
;
SetOrientation
(
3
);
/* Orientation vert BOTTOM */
SetOrientation
(
3
);
/* Orientation vert BOTTOM */
break
;
break
;
case
3
:
/* pin on bottom side*/
case
3
:
/* pin on bottom side*/
m_Pos
.
y
=
Sheet
->
m_
Pos
.
y
+
Sheet
->
m_S
ize
.
y
;
m_Pos
.
y
=
Sheet
->
m_
pos
.
y
+
Sheet
->
m_s
ize
.
y
;
SetOrientation
(
1
);
/* Orientation vert UP */
SetOrientation
(
1
);
/* Orientation vert UP */
break
;
break
;
}
}
...
@@ -197,7 +187,7 @@ void SCH_SHEET_PIN::SetEdge( int aEdge )
...
@@ -197,7 +187,7 @@ void SCH_SHEET_PIN::SetEdge( int aEdge )
int
SCH_SHEET_PIN
::
GetEdge
()
const
int
SCH_SHEET_PIN
::
GetEdge
()
const
{
{
return
m_
E
dge
;
return
m_
e
dge
;
}
}
...
@@ -208,9 +198,9 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
...
@@ -208,9 +198,9 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
if
(
Sheet
==
NULL
)
if
(
Sheet
==
NULL
)
return
;
return
;
if
(
m_
E
dge
<
2
)
/*horizontal sheetpin*/
if
(
m_
e
dge
<
2
)
/*horizontal sheetpin*/
{
{
if
(
Pos
.
x
>
(
Sheet
->
m_
Pos
.
x
+
(
Sheet
->
m_S
ize
.
x
/
2
)
)
)
if
(
Pos
.
x
>
(
Sheet
->
m_
pos
.
x
+
(
Sheet
->
m_s
ize
.
x
/
2
)
)
)
{
{
SetEdge
(
1
);
SetEdge
(
1
);
}
}
...
@@ -221,15 +211,15 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
...
@@ -221,15 +211,15 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
m_Pos
.
y
=
Pos
.
y
;
m_Pos
.
y
=
Pos
.
y
;
if
(
m_Pos
.
y
<
Sheet
->
m_
P
os
.
y
)
if
(
m_Pos
.
y
<
Sheet
->
m_
p
os
.
y
)
m_Pos
.
y
=
Sheet
->
m_
P
os
.
y
;
m_Pos
.
y
=
Sheet
->
m_
p
os
.
y
;
if
(
m_Pos
.
y
>
(
Sheet
->
m_
Pos
.
y
+
Sheet
->
m_S
ize
.
y
)
)
if
(
m_Pos
.
y
>
(
Sheet
->
m_
pos
.
y
+
Sheet
->
m_s
ize
.
y
)
)
m_Pos
.
y
=
Sheet
->
m_
Pos
.
y
+
Sheet
->
m_S
ize
.
y
;
m_Pos
.
y
=
Sheet
->
m_
pos
.
y
+
Sheet
->
m_s
ize
.
y
;
}
}
else
/* vertical sheetpin*/
else
/* vertical sheetpin*/
{
{
if
(
Pos
.
y
>
(
Sheet
->
m_
Pos
.
y
+
(
Sheet
->
m_S
ize
.
y
/
2
)
)
)
if
(
Pos
.
y
>
(
Sheet
->
m_
pos
.
y
+
(
Sheet
->
m_s
ize
.
y
/
2
)
)
)
{
{
SetEdge
(
3
);
//bottom
SetEdge
(
3
);
//bottom
}
}
...
@@ -240,11 +230,11 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
...
@@ -240,11 +230,11 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
m_Pos
.
x
=
Pos
.
x
;
m_Pos
.
x
=
Pos
.
x
;
if
(
m_Pos
.
x
<
Sheet
->
m_
P
os
.
x
)
if
(
m_Pos
.
x
<
Sheet
->
m_
p
os
.
x
)
m_Pos
.
x
=
Sheet
->
m_
P
os
.
x
;
m_Pos
.
x
=
Sheet
->
m_
p
os
.
x
;
if
(
m_Pos
.
x
>
(
Sheet
->
m_
Pos
.
x
+
Sheet
->
m_S
ize
.
x
)
)
if
(
m_Pos
.
x
>
(
Sheet
->
m_
pos
.
x
+
Sheet
->
m_s
ize
.
x
)
)
m_Pos
.
x
=
Sheet
->
m_
Pos
.
x
+
Sheet
->
m_S
ize
.
x
;
m_Pos
.
x
=
Sheet
->
m_
pos
.
x
+
Sheet
->
m_s
ize
.
x
;
}
}
}
}
...
@@ -256,7 +246,7 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
...
@@ -256,7 +246,7 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
if
(
m_Text
.
IsEmpty
()
)
if
(
m_Text
.
IsEmpty
()
)
return
true
;
return
true
;
switch
(
m_
E
dge
)
switch
(
m_
e
dge
)
{
{
case
0
:
//pin on left side
case
0
:
//pin on left side
side
=
'L'
;
side
=
'L'
;
...
@@ -275,7 +265,7 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
...
@@ -275,7 +265,7 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
break
;
break
;
}
}
switch
(
m_
S
hape
)
switch
(
m_
s
hape
)
{
{
case
NET_INPUT
:
case
NET_INPUT
:
type
=
'I'
;
break
;
type
=
'I'
;
break
;
...
@@ -293,7 +283,7 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
...
@@ -293,7 +283,7 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
type
=
'U'
;
break
;
type
=
'U'
;
break
;
}
}
if
(
fprintf
(
aFile
,
"F%d %s %c %c %-3d %-3d %-3d
\n
"
,
m_
N
umber
,
if
(
fprintf
(
aFile
,
"F%d %s %c %c %-3d %-3d %-3d
\n
"
,
m_
n
umber
,
EscapedUTF8
(
m_Text
).
c_str
(),
// supplies wrapping quotes
EscapedUTF8
(
m_Text
).
c_str
(),
// supplies wrapping quotes
type
,
side
,
m_Pos
.
x
,
m_Pos
.
y
,
type
,
side
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Size
.
x
)
==
EOF
)
m_Size
.
x
)
==
EOF
)
...
@@ -359,23 +349,23 @@ bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -359,23 +349,23 @@ bool SCH_SHEET_PIN::Load( LINE_READER& aLine, wxString& aErrorMsg )
switch
(
connectType
[
0
]
)
switch
(
connectType
[
0
]
)
{
{
case
'I'
:
case
'I'
:
m_
S
hape
=
NET_INPUT
;
m_
s
hape
=
NET_INPUT
;
break
;
break
;
case
'O'
:
case
'O'
:
m_
S
hape
=
NET_OUTPUT
;
m_
s
hape
=
NET_OUTPUT
;
break
;
break
;
case
'B'
:
case
'B'
:
m_
S
hape
=
NET_BIDI
;
m_
s
hape
=
NET_BIDI
;
break
;
break
;
case
'T'
:
case
'T'
:
m_
S
hape
=
NET_TRISTATE
;
m_
s
hape
=
NET_TRISTATE
;
break
;
break
;
case
'U'
:
case
'U'
:
m_
S
hape
=
NET_UNSPECIFIED
;
m_
s
hape
=
NET_UNSPECIFIED
;
break
;
break
;
}
}
...
@@ -429,7 +419,7 @@ void SCH_SHEET_PIN::Mirror_X( int aXaxis_position )
...
@@ -429,7 +419,7 @@ void SCH_SHEET_PIN::Mirror_X( int aXaxis_position )
m_Pos
.
y
=
aXaxis_position
-
p
;
m_Pos
.
y
=
aXaxis_position
-
p
;
switch
(
m_
E
dge
)
switch
(
m_
e
dge
)
{
{
case
2
:
case
2
:
SetEdge
(
3
);
SetEdge
(
3
);
...
@@ -448,7 +438,7 @@ void SCH_SHEET_PIN::Mirror_Y( int aYaxis_position )
...
@@ -448,7 +438,7 @@ void SCH_SHEET_PIN::Mirror_Y( int aYaxis_position )
m_Pos
.
x
=
aYaxis_position
-
p
;
m_Pos
.
x
=
aYaxis_position
-
p
;
switch
(
m_
E
dge
)
switch
(
m_
e
dge
)
{
{
case
0
:
case
0
:
SetEdge
(
1
);
SetEdge
(
1
);
...
@@ -465,7 +455,7 @@ void SCH_SHEET_PIN::Rotate( wxPoint rotationPoint )
...
@@ -465,7 +455,7 @@ void SCH_SHEET_PIN::Rotate( wxPoint rotationPoint )
{
{
RotatePoint
(
&
m_Pos
,
rotationPoint
,
900
);
RotatePoint
(
&
m_Pos
,
rotationPoint
,
900
);
switch
(
m_
E
dge
)
switch
(
m_
e
dge
)
{
{
case
0
:
//pin on left side
case
0
:
//pin on left side
SetEdge
(
3
);
SetEdge
(
3
);
...
@@ -493,16 +483,16 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
...
@@ -493,16 +483,16 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
* for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
* for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
* for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
* for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
*/
*/
int
tmp
=
m_
S
hape
;
int
tmp
=
m_
s
hape
;
switch
(
m_
S
hape
)
switch
(
m_
s
hape
)
{
{
case
NET_INPUT
:
case
NET_INPUT
:
m_
S
hape
=
NET_OUTPUT
;
m_
s
hape
=
NET_OUTPUT
;
break
;
break
;
case
NET_OUTPUT
:
case
NET_OUTPUT
:
m_
S
hape
=
NET_INPUT
;
m_
s
hape
=
NET_INPUT
;
break
;
break
;
default
:
default
:
...
@@ -510,7 +500,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
...
@@ -510,7 +500,7 @@ void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
}
}
SCH_HIERLABEL
::
CreateGraphicShape
(
aPoints
,
aPos
);
SCH_HIERLABEL
::
CreateGraphicShape
(
aPoints
,
aPos
);
m_
S
hape
=
tmp
;
m_
s
hape
=
tmp
;
}
}
...
...
eeschema/sch_text.cpp
View file @
1047e60e
...
@@ -104,10 +104,10 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
...
@@ -104,10 +104,10 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
{
{
m_Layer
=
LAYER_NOTES
;
m_Layer
=
LAYER_NOTES
;
m_Pos
=
pos
;
m_Pos
=
pos
;
m_
S
hape
=
0
;
m_
s
hape
=
0
;
m_
I
sDangling
=
false
;
m_
i
sDangling
=
false
;
m_MultilineAllowed
=
true
;
m_MultilineAllowed
=
true
;
m_
S
chematicOrientation
=
0
;
m_
s
chematicOrientation
=
0
;
}
}
...
@@ -116,10 +116,10 @@ SCH_TEXT::SCH_TEXT( const SCH_TEXT& aText ) :
...
@@ -116,10 +116,10 @@ SCH_TEXT::SCH_TEXT( const SCH_TEXT& aText ) :
EDA_TEXT
(
aText
)
EDA_TEXT
(
aText
)
{
{
m_Pos
=
aText
.
m_Pos
;
m_Pos
=
aText
.
m_Pos
;
m_
Shape
=
aText
.
m_S
hape
;
m_
shape
=
aText
.
m_s
hape
;
m_MultilineAllowed
=
aText
.
m_MultilineAllowed
;
m_MultilineAllowed
=
aText
.
m_MultilineAllowed
;
m_
SchematicOrientation
=
aText
.
m_S
chematicOrientation
;
m_
schematicOrientation
=
aText
.
m_s
chematicOrientation
;
m_
I
sDangling
=
false
;
m_
i
sDangling
=
false
;
}
}
...
@@ -141,7 +141,7 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() const
...
@@ -141,7 +141,7 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() const
// add a small offset (TXTMARGE) to x ( or y) position to allow a text to
// add a small offset (TXTMARGE) to x ( or y) position to allow a text to
// be on a wire or a line and be readable
// be on a wire or a line and be readable
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
default
:
default
:
case
0
:
/* Horiz Normal Orientation (left justified) */
case
0
:
/* Horiz Normal Orientation (left justified) */
...
@@ -301,9 +301,9 @@ void SCH_TEXT::Rotate( wxPoint rotationPoint )
...
@@ -301,9 +301,9 @@ void SCH_TEXT::Rotate( wxPoint rotationPoint )
void
SCH_TEXT
::
SetOrientation
(
int
aOrientation
)
void
SCH_TEXT
::
SetOrientation
(
int
aOrientation
)
{
{
m_
S
chematicOrientation
=
aOrientation
;
m_
s
chematicOrientation
=
aOrientation
;
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
default
:
default
:
case
0
:
/* Horiz Normal Orientation (left justified) */
case
0
:
/* Horiz Normal Orientation (left justified) */
...
@@ -341,14 +341,14 @@ void SCH_TEXT::SwapData( SCH_ITEM* aItem )
...
@@ -341,14 +341,14 @@ void SCH_TEXT::SwapData( SCH_ITEM* aItem )
EXCHG
(
m_Pos
,
item
->
m_Pos
);
EXCHG
(
m_Pos
,
item
->
m_Pos
);
EXCHG
(
m_Size
,
item
->
m_Size
);
EXCHG
(
m_Size
,
item
->
m_Size
);
EXCHG
(
m_Thickness
,
item
->
m_Thickness
);
EXCHG
(
m_Thickness
,
item
->
m_Thickness
);
EXCHG
(
m_
Shape
,
item
->
m_S
hape
);
EXCHG
(
m_
shape
,
item
->
m_s
hape
);
EXCHG
(
m_Orient
,
item
->
m_Orient
);
EXCHG
(
m_Orient
,
item
->
m_Orient
);
EXCHG
(
m_Layer
,
item
->
m_Layer
);
EXCHG
(
m_Layer
,
item
->
m_Layer
);
EXCHG
(
m_HJustify
,
item
->
m_HJustify
);
EXCHG
(
m_HJustify
,
item
->
m_HJustify
);
EXCHG
(
m_VJustify
,
item
->
m_VJustify
);
EXCHG
(
m_VJustify
,
item
->
m_VJustify
);
EXCHG
(
m_
IsDangling
,
item
->
m_I
sDangling
);
EXCHG
(
m_
isDangling
,
item
->
m_i
sDangling
);
EXCHG
(
m_
SchematicOrientation
,
item
->
m_S
chematicOrientation
);
EXCHG
(
m_
schematicOrientation
,
item
->
m_s
chematicOrientation
);
}
}
...
@@ -390,7 +390,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
...
@@ -390,7 +390,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
EDA_TEXT
::
Draw
(
panel
,
DC
,
text_offset
,
color
,
DrawMode
,
FILLED
,
UNSPECIFIED_COLOR
);
EDA_TEXT
::
Draw
(
panel
,
DC
,
text_offset
,
color
,
DrawMode
,
FILLED
,
UNSPECIFIED_COLOR
);
EXCHG
(
linewidth
,
m_Thickness
);
// set initial value
EXCHG
(
linewidth
,
m_Thickness
);
// set initial value
if
(
m_
I
sDangling
)
if
(
m_
i
sDangling
)
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
aOffset
,
color
);
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
aOffset
,
color
);
// Enable these line to draw the bounding box (debug tests purposes only)
// Enable these line to draw the bounding box (debug tests purposes only)
...
@@ -403,12 +403,6 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
...
@@ -403,12 +403,6 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
}
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
SCH_TEXT
::
Save
(
FILE
*
aFile
)
const
bool
SCH_TEXT
::
Save
(
FILE
*
aFile
)
const
{
{
bool
success
=
true
;
bool
success
=
true
;
...
@@ -439,7 +433,7 @@ bool SCH_TEXT::Save( FILE* aFile ) const
...
@@ -439,7 +433,7 @@ bool SCH_TEXT::Save( FILE* aFile ) const
if
(
fprintf
(
aFile
,
"Text Notes %-4d %-4d %-4d %-4d %s %d
\n
%s
\n
"
,
if
(
fprintf
(
aFile
,
"Text Notes %-4d %-4d %-4d %-4d %s %d
\n
%s
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
S
chematicOrientation
,
m_Size
.
x
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
s
chematicOrientation
,
m_Size
.
x
,
shape
,
m_Thickness
,
TO_UTF8
(
text
)
)
==
EOF
)
shape
,
m_Thickness
,
TO_UTF8
(
text
)
)
==
EOF
)
{
{
success
=
false
;
success
=
false
;
...
@@ -494,6 +488,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -494,6 +488,7 @@ bool SCH_TEXT::Load( LINE_READER& aLine, wxString& aErrorMsg )
}
}
wxString
val
=
FROM_UTF8
(
text
);
wxString
val
=
FROM_UTF8
(
text
);
for
(
;
;
)
for
(
;
;
)
{
{
int
i
=
val
.
find
(
wxT
(
"
\\
n"
)
);
int
i
=
val
.
find
(
wxT
(
"
\\
n"
)
);
...
@@ -540,8 +535,8 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
...
@@ -540,8 +535,8 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
if
(
Type
()
==
SCH_TEXT_T
)
if
(
Type
()
==
SCH_TEXT_T
)
return
false
;
return
false
;
bool
previousState
=
m_
I
sDangling
;
bool
previousState
=
m_
i
sDangling
;
m_
I
sDangling
=
true
;
m_
i
sDangling
=
true
;
for
(
unsigned
ii
=
0
;
ii
<
aItemList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aItemList
.
size
();
ii
++
)
{
{
...
@@ -556,7 +551,7 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
...
@@ -556,7 +551,7 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
case
LABEL_END
:
case
LABEL_END
:
case
SHEET_LABEL_END
:
case
SHEET_LABEL_END
:
if
(
m_Pos
==
item
.
GetPosition
()
)
if
(
m_Pos
==
item
.
GetPosition
()
)
m_
I
sDangling
=
false
;
m_
i
sDangling
=
false
;
break
;
break
;
...
@@ -567,11 +562,11 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
...
@@ -567,11 +562,11 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
// a paranoid programmer, I'll check just in case.
// a paranoid programmer, I'll check just in case.
ii
++
;
ii
++
;
wxCHECK_MSG
(
ii
<
aItemList
.
size
(),
previousState
!=
m_
I
sDangling
,
wxCHECK_MSG
(
ii
<
aItemList
.
size
(),
previousState
!=
m_
i
sDangling
,
wxT
(
"Dangling end type list overflow. Bad programmer!"
)
);
wxT
(
"Dangling end type list overflow. Bad programmer!"
)
);
DANGLING_END_ITEM
&
nextItem
=
aItemList
[
ii
];
DANGLING_END_ITEM
&
nextItem
=
aItemList
[
ii
];
m_
I
sDangling
=
!
SegmentIntersect
(
item
.
GetPosition
(),
nextItem
.
GetPosition
(),
m_Pos
);
m_
i
sDangling
=
!
SegmentIntersect
(
item
.
GetPosition
(),
nextItem
.
GetPosition
(),
m_Pos
);
}
}
break
;
break
;
...
@@ -579,11 +574,11 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
...
@@ -579,11 +574,11 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi
break
;
break
;
}
}
if
(
m_
I
sDangling
==
false
)
if
(
m_
i
sDangling
==
false
)
break
;
break
;
}
}
return
previousState
!=
m_
I
sDangling
;
return
previousState
!=
m_
i
sDangling
;
}
}
...
@@ -744,8 +739,8 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os )
...
@@ -744,8 +739,8 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os )
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
s
.
Lower
().
mb_str
()
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
s
.
Lower
().
mb_str
()
<<
" layer=
\"
"
<<
m_Layer
<<
'"'
<<
" layer=
\"
"
<<
m_Layer
<<
'"'
<<
" shape=
\"
"
<<
m_
S
hape
<<
'"'
<<
" shape=
\"
"
<<
m_
s
hape
<<
'"'
<<
" dangling=
\"
"
<<
m_
I
sDangling
<<
'"'
<<
" dangling=
\"
"
<<
m_
i
sDangling
<<
'"'
<<
'>'
<<
'>'
<<
TO_UTF8
(
m_Text
)
<<
TO_UTF8
(
m_Text
)
<<
"</"
<<
s
.
Lower
().
mb_str
()
<<
">
\n
"
;
<<
"</"
<<
s
.
Lower
().
mb_str
()
<<
">
\n
"
;
...
@@ -758,8 +753,8 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
...
@@ -758,8 +753,8 @@ SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT
(
pos
,
text
,
SCH_LABEL_T
)
SCH_TEXT
(
pos
,
text
,
SCH_LABEL_T
)
{
{
m_Layer
=
LAYER_LOCLABEL
;
m_Layer
=
LAYER_LOCLABEL
;
m_
S
hape
=
NET_INPUT
;
m_
s
hape
=
NET_INPUT
;
m_
I
sDangling
=
true
;
m_
i
sDangling
=
true
;
m_MultilineAllowed
=
false
;
m_MultilineAllowed
=
false
;
}
}
...
@@ -819,7 +814,7 @@ bool SCH_LABEL::Save( FILE* aFile ) const
...
@@ -819,7 +814,7 @@ bool SCH_LABEL::Save( FILE* aFile ) const
shape
=
"Italic"
;
shape
=
"Italic"
;
if
(
fprintf
(
aFile
,
"Text Label %-4d %-4d %-4d %-4d %s %d
\n
%s
\n
"
,
if
(
fprintf
(
aFile
,
"Text Label %-4d %-4d %-4d %-4d %s %d
\n
%s
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
S
chematicOrientation
,
m_Size
.
x
,
shape
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
s
chematicOrientation
,
m_Size
.
x
,
shape
,
m_Thickness
,
TO_UTF8
(
m_Text
)
)
==
EOF
)
m_Thickness
,
TO_UTF8
(
m_Text
)
)
==
EOF
)
{
{
success
=
false
;
success
=
false
;
...
@@ -909,7 +904,7 @@ EDA_RECT SCH_LABEL::GetBoundingBox() const
...
@@ -909,7 +904,7 @@ EDA_RECT SCH_LABEL::GetBoundingBox() const
height
=
m_Size
.
y
+
width
;
height
=
m_Size
.
y
+
width
;
dx
=
dy
=
0
;
dx
=
dy
=
0
;
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
case
0
:
/* Horiz Normal Orientation (left justified) */
case
0
:
/* Horiz Normal Orientation (left justified) */
dx
=
2
*
DANGLING_SYMBOL_SIZE
+
length
;
dx
=
2
*
DANGLING_SYMBOL_SIZE
+
length
;
...
@@ -966,8 +961,8 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
...
@@ -966,8 +961,8 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) :
SCH_TEXT
(
pos
,
text
,
SCH_GLOBAL_LABEL_T
)
SCH_TEXT
(
pos
,
text
,
SCH_GLOBAL_LABEL_T
)
{
{
m_Layer
=
LAYER_GLOBLABEL
;
m_Layer
=
LAYER_GLOBLABEL
;
m_
S
hape
=
NET_BIDI
;
m_
s
hape
=
NET_BIDI
;
m_
I
sDangling
=
true
;
m_
i
sDangling
=
true
;
m_MultilineAllowed
=
false
;
m_MultilineAllowed
=
false
;
}
}
...
@@ -993,8 +988,8 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
...
@@ -993,8 +988,8 @@ bool SCH_GLOBALLABEL::Save( FILE* aFile ) const
shape
=
"Italic"
;
shape
=
"Italic"
;
if
(
fprintf
(
aFile
,
"Text GLabel %-4d %-4d %-4d %-4d %s %s %d
\n
%s
\n
"
,
if
(
fprintf
(
aFile
,
"Text GLabel %-4d %-4d %-4d %-4d %s %s %d
\n
%s
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
S
chematicOrientation
,
m_Size
.
x
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
s
chematicOrientation
,
m_Size
.
x
,
SheetLabelType
[
m_
S
hape
],
shape
,
m_Thickness
,
TO_UTF8
(
m_Text
)
)
==
EOF
)
SheetLabelType
[
m_
s
hape
],
shape
,
m_Thickness
,
TO_UTF8
(
m_Text
)
)
==
EOF
)
{
{
success
=
false
;
success
=
false
;
}
}
...
@@ -1013,6 +1008,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -1013,6 +1008,7 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
Name1
[
0
]
=
0
;
Name2
[
0
]
=
0
;
Name3
[
0
]
=
0
;
Name1
[
0
]
=
0
;
Name2
[
0
]
=
0
;
Name3
[
0
]
=
0
;
char
*
sline
=
(
char
*
)
aLine
;
char
*
sline
=
(
char
*
)
aLine
;
while
(
(
*
sline
!=
' '
)
&&
*
sline
)
while
(
(
*
sline
!=
' '
)
&&
*
sline
)
sline
++
;
sline
++
;
...
@@ -1049,21 +1045,21 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -1049,21 +1045,21 @@ bool SCH_GLOBALLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_Text
=
FROM_UTF8
(
text
);
m_Text
=
FROM_UTF8
(
text
);
m_Size
.
x
=
m_Size
.
y
=
size
;
m_Size
.
x
=
m_Size
.
y
=
size
;
SetOrientation
(
orient
);
SetOrientation
(
orient
);
m_
S
hape
=
NET_INPUT
;
m_
s
hape
=
NET_INPUT
;
m_Bold
=
(
thickness
!=
0
);
m_Bold
=
(
thickness
!=
0
);
m_Thickness
=
m_Bold
?
GetPenSizeForBold
(
size
)
:
0
;
m_Thickness
=
m_Bold
?
GetPenSizeForBold
(
size
)
:
0
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_OUTPUT
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_OUTPUT
]
)
==
0
)
m_
S
hape
=
NET_OUTPUT
;
m_
s
hape
=
NET_OUTPUT
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_BIDI
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_BIDI
]
)
==
0
)
m_
S
hape
=
NET_BIDI
;
m_
s
hape
=
NET_BIDI
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_TRISTATE
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_TRISTATE
]
)
==
0
)
m_
S
hape
=
NET_TRISTATE
;
m_
s
hape
=
NET_TRISTATE
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_UNSPECIFIED
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_UNSPECIFIED
]
)
==
0
)
m_
S
hape
=
NET_UNSPECIFIED
;
m_
s
hape
=
NET_UNSPECIFIED
;
if
(
stricmp
(
Name3
,
"Italic"
)
==
0
)
if
(
stricmp
(
Name3
,
"Italic"
)
==
0
)
m_Italic
=
1
;
m_Italic
=
1
;
...
@@ -1131,7 +1127,7 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
...
@@ -1131,7 +1127,7 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
int
HalfSize
=
m_Size
.
x
/
2
;
int
HalfSize
=
m_Size
.
x
/
2
;
int
offset
=
width
;
int
offset
=
width
;
switch
(
m_
S
hape
)
switch
(
m_
s
hape
)
{
{
case
NET_INPUT
:
case
NET_INPUT
:
case
NET_BIDI
:
case
NET_BIDI
:
...
@@ -1148,7 +1144,7 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
...
@@ -1148,7 +1144,7 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
break
;
break
;
}
}
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
case
0
:
/* Orientation horiz normal */
case
0
:
/* Orientation horiz normal */
text_offset
.
x
-=
offset
;
text_offset
.
x
-=
offset
;
...
@@ -1173,9 +1169,9 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
...
@@ -1173,9 +1169,9 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
void
SCH_GLOBALLABEL
::
SetOrientation
(
int
aOrientation
)
void
SCH_GLOBALLABEL
::
SetOrientation
(
int
aOrientation
)
{
{
m_
S
chematicOrientation
=
aOrientation
;
m_
s
chematicOrientation
=
aOrientation
;
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
default
:
default
:
case
0
:
/* Horiz Normal Orientation */
case
0
:
/* Horiz Normal Orientation */
...
@@ -1231,7 +1227,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
...
@@ -1231,7 +1227,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
CreateGraphicShape
(
Poly
,
m_Pos
+
aOffset
);
CreateGraphicShape
(
Poly
,
m_Pos
+
aOffset
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
.
size
(),
&
Poly
[
0
],
0
,
linewidth
,
color
,
color
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
.
size
(),
&
Poly
[
0
],
0
,
linewidth
,
color
,
color
);
if
(
m_
I
sDangling
)
if
(
m_
i
sDangling
)
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
aOffset
,
color
);
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
aOffset
,
color
);
// Enable these line to draw the bounding box (debug tests purposes only)
// Enable these line to draw the bounding box (debug tests purposes only)
...
@@ -1271,7 +1267,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
...
@@ -1271,7 +1267,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
int
x_offset
=
0
;
int
x_offset
=
0
;
switch
(
m_
S
hape
)
switch
(
m_
s
hape
)
{
{
case
NET_INPUT
:
case
NET_INPUT
:
x_offset
=
-
HalfSize
;
x_offset
=
-
HalfSize
;
...
@@ -1296,7 +1292,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
...
@@ -1296,7 +1292,7 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
int
angle
=
0
;
int
angle
=
0
;
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
case
0
:
/* Orientation horiz normal */
case
0
:
/* Orientation horiz normal */
break
;
break
;
...
@@ -1318,8 +1314,10 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
...
@@ -1318,8 +1314,10 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
for
(
unsigned
ii
=
0
;
ii
<
aPoints
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aPoints
.
size
();
ii
++
)
{
{
aPoints
[
ii
].
x
+=
x_offset
;
aPoints
[
ii
].
x
+=
x_offset
;
if
(
angle
)
if
(
angle
)
RotatePoint
(
&
aPoints
[
ii
],
angle
);
RotatePoint
(
&
aPoints
[
ii
],
angle
);
aPoints
[
ii
]
+=
Pos
;
aPoints
[
ii
]
+=
Pos
;
}
}
...
@@ -1341,7 +1339,7 @@ EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
...
@@ -1341,7 +1339,7 @@ EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
// text X size add height for triangular shapes(bidirectional)
// text X size add height for triangular shapes(bidirectional)
length
=
LenSize
(
m_Text
)
+
height
+
DANGLING_SYMBOL_SIZE
;
length
=
LenSize
(
m_Text
)
+
height
+
DANGLING_SYMBOL_SIZE
;
switch
(
m_
S
chematicOrientation
)
// respect orientation
switch
(
m_
s
chematicOrientation
)
// respect orientation
{
{
case
0
:
/* Horiz Normal Orientation (left justified) */
case
0
:
/* Horiz Normal Orientation (left justified) */
dx
=
-
length
;
dx
=
-
length
;
...
@@ -1398,8 +1396,8 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T
...
@@ -1398,8 +1396,8 @@ SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T
SCH_TEXT
(
pos
,
text
,
aType
)
SCH_TEXT
(
pos
,
text
,
aType
)
{
{
m_Layer
=
LAYER_HIERLABEL
;
m_Layer
=
LAYER_HIERLABEL
;
m_
S
hape
=
NET_INPUT
;
m_
s
hape
=
NET_INPUT
;
m_
I
sDangling
=
true
;
m_
i
sDangling
=
true
;
m_MultilineAllowed
=
false
;
m_MultilineAllowed
=
false
;
}
}
...
@@ -1425,8 +1423,8 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
...
@@ -1425,8 +1423,8 @@ bool SCH_HIERLABEL::Save( FILE* aFile ) const
shape
=
"Italic"
;
shape
=
"Italic"
;
if
(
fprintf
(
aFile
,
"Text HLabel %-4d %-4d %-4d %-4d %s %s %d
\n
%s
\n
"
,
if
(
fprintf
(
aFile
,
"Text HLabel %-4d %-4d %-4d %-4d %s %s %d
\n
%s
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
S
chematicOrientation
,
m_Size
.
x
,
m_Pos
.
x
,
m_Pos
.
y
,
m_
s
chematicOrientation
,
m_Size
.
x
,
SheetLabelType
[
m_
S
hape
],
shape
,
m_Thickness
,
TO_UTF8
(
m_Text
)
)
==
EOF
)
SheetLabelType
[
m_
s
hape
],
shape
,
m_Thickness
,
TO_UTF8
(
m_Text
)
)
==
EOF
)
{
{
success
=
false
;
success
=
false
;
}
}
...
@@ -1482,21 +1480,21 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -1482,21 +1480,21 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
m_Text
=
FROM_UTF8
(
text
);
m_Text
=
FROM_UTF8
(
text
);
m_Size
.
x
=
m_Size
.
y
=
size
;
m_Size
.
x
=
m_Size
.
y
=
size
;
SetOrientation
(
orient
);
SetOrientation
(
orient
);
m_
S
hape
=
NET_INPUT
;
m_
s
hape
=
NET_INPUT
;
m_Bold
=
(
thickness
!=
0
);
m_Bold
=
(
thickness
!=
0
);
m_Thickness
=
m_Bold
?
GetPenSizeForBold
(
size
)
:
0
;
m_Thickness
=
m_Bold
?
GetPenSizeForBold
(
size
)
:
0
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_OUTPUT
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_OUTPUT
]
)
==
0
)
m_
S
hape
=
NET_OUTPUT
;
m_
s
hape
=
NET_OUTPUT
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_BIDI
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_BIDI
]
)
==
0
)
m_
S
hape
=
NET_BIDI
;
m_
s
hape
=
NET_BIDI
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_TRISTATE
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_TRISTATE
]
)
==
0
)
m_
S
hape
=
NET_TRISTATE
;
m_
s
hape
=
NET_TRISTATE
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_UNSPECIFIED
]
)
==
0
)
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_UNSPECIFIED
]
)
==
0
)
m_
S
hape
=
NET_UNSPECIFIED
;
m_
s
hape
=
NET_UNSPECIFIED
;
if
(
stricmp
(
Name3
,
"Italic"
)
==
0
)
if
(
stricmp
(
Name3
,
"Italic"
)
==
0
)
m_Italic
=
1
;
m_Italic
=
1
;
...
@@ -1507,9 +1505,9 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
...
@@ -1507,9 +1505,9 @@ bool SCH_HIERLABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
void
SCH_HIERLABEL
::
SetOrientation
(
int
aOrientation
)
void
SCH_HIERLABEL
::
SetOrientation
(
int
aOrientation
)
{
{
m_
S
chematicOrientation
=
aOrientation
;
m_
s
chematicOrientation
=
aOrientation
;
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
default
:
default
:
case
0
:
/* Horiz Normal Orientation */
case
0
:
/* Horiz Normal Orientation */
...
@@ -1566,7 +1564,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
...
@@ -1566,7 +1564,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
CreateGraphicShape
(
Poly
,
m_Pos
+
offset
);
CreateGraphicShape
(
Poly
,
m_Pos
+
offset
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
.
size
(),
&
Poly
[
0
],
0
,
linewidth
,
color
,
color
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
Poly
.
size
(),
&
Poly
[
0
],
0
,
linewidth
,
color
,
color
);
if
(
m_
I
sDangling
)
if
(
m_
i
sDangling
)
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
offset
,
color
);
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
offset
,
color
);
// Enable these line to draw the bounding box (debug tests purposes only)
// Enable these line to draw the bounding box (debug tests purposes only)
...
@@ -1581,7 +1579,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
...
@@ -1581,7 +1579,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
void
SCH_HIERLABEL
::
CreateGraphicShape
(
std
::
vector
<
wxPoint
>&
aPoints
,
const
wxPoint
&
Pos
)
void
SCH_HIERLABEL
::
CreateGraphicShape
(
std
::
vector
<
wxPoint
>&
aPoints
,
const
wxPoint
&
Pos
)
{
{
int
*
Template
=
TemplateShape
[
m_
Shape
][
m_S
chematicOrientation
];
int
*
Template
=
TemplateShape
[
m_
shape
][
m_s
chematicOrientation
];
int
HalfSize
=
m_Size
.
x
/
2
;
int
HalfSize
=
m_Size
.
x
/
2
;
int
imax
=
*
Template
;
Template
++
;
int
imax
=
*
Template
;
Template
++
;
...
@@ -1616,10 +1614,9 @@ EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
...
@@ -1616,10 +1614,9 @@ EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
+
height
// add height for triangular shapes
+
height
// add height for triangular shapes
+
2
*
DANGLING_SYMBOL_SIZE
;
+
2
*
DANGLING_SYMBOL_SIZE
;
switch
(
m_
S
chematicOrientation
)
// respect orientation
switch
(
m_
s
chematicOrientation
)
// respect orientation
{
{
case
0
:
/* Horiz Normal Orientation (left
case
0
:
/* Horiz Normal Orientation (left justified) */
*justified) */
dx
=
-
length
;
dx
=
-
length
;
dy
=
height
;
dy
=
height
;
x
+=
DANGLING_SYMBOL_SIZE
;
x
+=
DANGLING_SYMBOL_SIZE
;
...
@@ -1662,7 +1659,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
...
@@ -1662,7 +1659,7 @@ wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
int
ii
=
m_Size
.
x
+
TXTMARGE
+
width
;
int
ii
=
m_Size
.
x
+
TXTMARGE
+
width
;
switch
(
m_
S
chematicOrientation
)
switch
(
m_
s
chematicOrientation
)
{
{
case
0
:
/* Orientation horiz normale */
case
0
:
/* Orientation horiz normale */
text_offset
.
x
=
-
ii
;
text_offset
.
x
=
-
ii
;
...
...
eeschema/sch_text.h
View file @
1047e60e
...
@@ -56,27 +56,23 @@ extern const char* SheetLabelType[]; /* names of types of labels */
...
@@ -56,27 +56,23 @@ extern const char* SheetLabelType[]; /* names of types of labels */
class
SCH_TEXT
:
public
SCH_ITEM
,
public
EDA_TEXT
class
SCH_TEXT
:
public
SCH_ITEM
,
public
EDA_TEXT
{
{
public
:
int
m_Shape
;
bool
m_IsDangling
;
// true if not connected (used to draw the "not
// connected" symbol
protected
:
protected
:
int
m_SchematicOrientation
;
/* orientation of texts (comments) and
int
m_shape
;
* labels in schematic
* 0 = normal (horizontal, left
/// True if not connected to another object if the object derive from SCH_TEXT
* justified).
/// supports connections.
* 1 = up (vertical)
bool
m_isDangling
;
* 2 = (horizontal, right justified).
* This can be seen as the mirrored
/**
* position of 0
* The orientation of text and any associated drawing elements of derived objects.
* 3 = bottom . This can be seen as the
* 0 is the horizontal and left justified.
* mirrored position of up
* 1 is vertical and top justified.
* this is perhaps a duplicate of m_Orient
* 2 is horizontal and right justified. It is the equivalent of the mirrored 0 orentation.
* and m_HJustified or m_VJustified,
* 3 is veritcal and bottom justifiend. It is the equivalent of the mirrored 1 orentation.
* but is more easy to handle that 3
* This is a duplicattion of m_Orient, m_HJustified, and m_VJustified in #EDA_TEXT but is
* parameters in editions, Reading and
* easier to handle that 3 parameters when editing and reading and saving files.
* Saving file
*/
*/
int
m_schematicOrientation
;
public
:
public
:
SCH_TEXT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
SCH_TEXT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
...
@@ -100,10 +96,10 @@ public:
...
@@ -100,10 +96,10 @@ public:
/**
/**
* Function SetOrientation
* Function SetOrientation
* Set m_
S
chematicOrientation, and initialize
* Set m_
s
chematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_
S
chematicOrientation (for a text )
* m_
s
chematicOrientation (for a text )
* must be called after changing m_
S
chematicOrientation
* must be called after changing m_
s
chematicOrientation
* @param aSchematicOrientation =
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 1 = up (vertical)
...
@@ -113,15 +109,18 @@ public:
...
@@ -113,15 +109,18 @@ public:
*/
*/
virtual
void
SetOrientation
(
int
aSchematicOrientation
);
virtual
void
SetOrientation
(
int
aSchematicOrientation
);
int
GetOrientation
()
{
return
m_SchematicOrientation
;
}
int
GetOrientation
()
{
return
m_schematicOrientation
;
}
int
GetShape
()
const
{
return
m_shape
;
}
void
SetShape
(
int
aShape
)
{
m_shape
=
aShape
;
}
/**
/**
* Function GetSchematicTextOffset (virtual)
* Function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself
* @return the offset between the SCH_TEXT position and the text itself position
* position
*
* This offset depend on orientation, and the type of text
* This offset depends on the orientation, the type of text, and the area required to
* (room to draw an associated graphic symbol, or put the text above a
* draw the associated graphic symbol or to put the text above a wire.
* wire)
*/
*/
virtual
wxPoint
GetSchematicTextOffset
()
const
;
virtual
wxPoint
GetSchematicTextOffset
()
const
;
...
@@ -203,12 +202,7 @@ public:
...
@@ -203,12 +202,7 @@ public:
virtual
void
Mirror_X
(
int
aXaxis_position
);
virtual
void
Mirror_X
(
int
aXaxis_position
);
/**
/**
* Compare schematic text entry against search string.
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*
* @param aSearchData - Criterial to search against.
* @param aAuxData - a pointer on auxiliary data, if needed. Can be null
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
* @return True if this schematic text item matches the search criteria.
*/
*/
virtual
bool
Matches
(
wxFindReplaceData
&
aSearchData
,
void
*
aAuxData
,
wxPoint
*
aFindLocation
);
virtual
bool
Matches
(
wxFindReplaceData
&
aSearchData
,
void
*
aAuxData
,
wxPoint
*
aFindLocation
);
...
@@ -216,7 +210,7 @@ public:
...
@@ -216,7 +210,7 @@ public:
virtual
bool
IsDanglingStateChanged
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
);
virtual
bool
IsDanglingStateChanged
(
std
::
vector
<
DANGLING_END_ITEM
>&
aItemList
);
virtual
bool
IsDangling
()
const
{
return
m_
I
sDangling
;
}
virtual
bool
IsDangling
()
const
{
return
m_
i
sDangling
;
}
virtual
bool
IsSelectStateChanged
(
const
wxRect
&
aRect
);
virtual
bool
IsSelectStateChanged
(
const
wxRect
&
aRect
);
...
@@ -267,10 +261,10 @@ public:
...
@@ -267,10 +261,10 @@ public:
/**
/**
* Function SetOrientation
* Function SetOrientation
* Set m_
S
chematicOrientation, and initialize
* Set m_
s
chematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_
S
chematicOrientation (for a label)
* m_
s
chematicOrientation (for a label)
* must be called after changing m_
S
chematicOrientation
* must be called after changing m_
s
chematicOrientation
* @param aSchematicOrientation =
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 1 = up (vertical)
...
@@ -362,10 +356,10 @@ public:
...
@@ -362,10 +356,10 @@ public:
/**
/**
* Function SetOrientation
* Function SetOrientation
* Set m_
S
chematicOrientation, and initialize
* Set m_
s
chematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_
S
chematicOrientation
* m_
s
chematicOrientation
* must be called after changing m_
S
chematicOrientation
* must be called after changing m_
s
chematicOrientation
* @param aSchematicOrientation =
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 1 = up (vertical)
...
@@ -468,10 +462,10 @@ public:
...
@@ -468,10 +462,10 @@ public:
/**
/**
* Function SetOrientation
* Function SetOrientation
* Set m_
S
chematicOrientation, and initialize
* Set m_
s
chematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_
S
chematicOrientation
* m_
s
chematicOrientation
* must be called after changing m_
S
chematicOrientation
* must be called after changing m_
s
chematicOrientation
* @param aSchematicOrientation =
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 1 = up (vertical)
...
...
eeschema/sheet.cpp
View file @
1047e60e
...
@@ -50,12 +50,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
...
@@ -50,12 +50,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
wxString
units
=
GetUnitsLabel
(
g_UserUnit
);
wxString
units
=
GetUnitsLabel
(
g_UserUnit
);
dlg
.
SetFileName
(
aSheet
->
GetFileName
()
);
dlg
.
SetFileName
(
aSheet
->
GetFileName
()
);
dlg
.
SetFileNameTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
dlg
.
SetFileNameTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
aSheet
->
m_FileNameSize
,
aSheet
->
GetFileNameSize
()
,
m_InternalUnits
)
);
m_InternalUnits
)
);
dlg
.
SetFileNameTextSizeUnits
(
units
);
dlg
.
SetFileNameTextSizeUnits
(
units
);
dlg
.
SetSheetName
(
aSheet
->
m_SheetName
);
dlg
.
SetSheetName
(
aSheet
->
GetName
()
);
dlg
.
SetSheetNameTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
dlg
.
SetSheetNameTextSize
(
ReturnStringFromValue
(
g_UserUnit
,
aSheet
->
m_SheetNameSize
,
aSheet
->
GetSheetNameSize
()
,
m_InternalUnits
)
);
m_InternalUnits
)
);
dlg
.
SetSheetNameTextSizeUnits
(
units
);
dlg
.
SetSheetNameTextSizeUnits
(
units
);
...
@@ -192,16 +192,16 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
...
@@ -192,16 +192,16 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
else
if
(
loadFromFile
)
else
if
(
loadFromFile
)
aSheet
->
Load
(
this
);
aSheet
->
Load
(
this
);
aSheet
->
m_FileNameSize
=
ReturnValueFromString
(
g_UserUnit
,
aSheet
->
SetFileNameSize
(
ReturnValueFromString
(
g_UserUnit
,
dlg
.
GetFileNameTextSize
(),
dlg
.
GetFileNameTextSize
(),
m_InternalUnits
);
m_InternalUnits
)
)
;
aSheet
->
m_SheetName
=
dlg
.
GetSheetName
(
);
aSheet
->
SetName
(
dlg
.
GetSheetName
()
);
aSheet
->
m_SheetNameSize
=
ReturnValueFromString
(
g_UserUnit
,
aSheet
->
SetSheetNameSize
(
ReturnValueFromString
(
g_UserUnit
,
dlg
.
GetSheetNameTextSize
(),
dlg
.
GetSheetNameTextSize
(),
m_InternalUnits
);
m_InternalUnits
)
)
;
if
(
aSheet
->
m_SheetName
.
IsEmpty
()
)
if
(
aSheet
->
GetName
()
.
IsEmpty
()
)
aSheet
->
m_SheetName
.
Printf
(
wxT
(
"Sheet%8.8lX"
),
aSheet
->
GetTimeStamp
(
)
);
aSheet
->
SetName
(
wxString
::
Format
(
wxT
(
"Sheet%8.8lX"
),
aSheet
->
GetTimeStamp
()
)
);
DrawPanel
->
MoveCursorToCrossHair
();
DrawPanel
->
MoveCursorToCrossHair
();
DrawPanel
->
m_IgnoreMouseEvents
=
false
;
DrawPanel
->
m_IgnoreMouseEvents
=
false
;
...
@@ -225,10 +225,12 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
...
@@ -225,10 +225,12 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if
(
aErase
)
if
(
aErase
)
sheet
->
Draw
(
aPanel
,
aDC
,
wxPoint
(
0
,
0
),
g_XorMode
);
sheet
->
Draw
(
aPanel
,
aDC
,
wxPoint
(
0
,
0
),
g_XorMode
);
wxPoint
pos
=
sheet
->
GetPosition
();
if
(
sheet
->
IsResized
()
)
if
(
sheet
->
IsResized
()
)
{
{
int
width
=
screen
->
GetCrossHairPosition
().
x
-
sheet
->
m_Pos
.
x
;
int
width
=
screen
->
GetCrossHairPosition
().
x
-
sheet
->
GetPosition
()
.
x
;
int
height
=
screen
->
GetCrossHairPosition
().
y
-
sheet
->
m_Pos
.
y
;
int
height
=
screen
->
GetCrossHairPosition
().
y
-
sheet
->
GetPosition
()
.
y
;
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
width
=
(
width
<
MIN_SHEET_WIDTH
)
?
MIN_SHEET_WIDTH
:
width
;
width
=
(
width
<
MIN_SHEET_WIDTH
)
?
MIN_SHEET_WIDTH
:
width
;
...
@@ -246,13 +248,12 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
...
@@ -246,13 +248,12 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
sheet
->
GetMinWidth
()
+
gridSizeX
:
width
;
sheet
->
GetMinWidth
()
+
gridSizeX
:
width
;
}
}
wxPoint
grid
=
screen
->
GetNearestGridPosition
(
wxPoint
(
sheet
->
m_Pos
.
x
+
width
,
wxPoint
grid
=
screen
->
GetNearestGridPosition
(
wxPoint
(
pos
.
x
+
width
,
pos
.
y
+
height
)
);
sheet
->
m_Pos
.
y
+
height
)
);
sheet
->
Resize
(
wxSize
(
grid
.
x
-
pos
.
x
,
grid
.
y
-
pos
.
y
)
);
sheet
->
Resize
(
wxSize
(
grid
.
x
-
sheet
->
m_Pos
.
x
,
grid
.
y
-
sheet
->
m_Pos
.
y
)
);
}
}
else
if
(
sheet
->
IsMoving
()
)
else
if
(
sheet
->
IsMoving
()
)
{
{
moveVector
=
screen
->
GetCrossHairPosition
()
-
sheet
->
m_P
os
;
moveVector
=
screen
->
GetCrossHairPosition
()
-
p
os
;
sheet
->
Move
(
moveVector
);
sheet
->
Move
(
moveVector
);
}
}
...
@@ -361,7 +362,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
...
@@ -361,7 +362,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
return
;
return
;
DrawPanel
->
CrossHairOff
(
aDC
);
DrawPanel
->
CrossHairOff
(
aDC
);
GetScreen
()
->
SetCrossHairPosition
(
aSheet
->
m_Pos
);
GetScreen
()
->
SetCrossHairPosition
(
aSheet
->
GetPosition
()
);
DrawPanel
->
MoveCursorToCrossHair
();
DrawPanel
->
MoveCursorToCrossHair
();
if
(
!
aSheet
->
IsNew
()
)
if
(
!
aSheet
->
IsNew
()
)
...
...
eeschema/sheetlab.cpp
View file @
1047e60e
...
@@ -60,7 +60,7 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
...
@@ -60,7 +60,7 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
dlg
.
SetTextHeightUnits
(
GetUnitsLabel
(
g_UserUnit
)
);
dlg
.
SetTextHeightUnits
(
GetUnitsLabel
(
g_UserUnit
)
);
dlg
.
SetTextWidth
(
ReturnStringFromValue
(
g_UserUnit
,
aSheetPin
->
m_Size
.
x
,
m_InternalUnits
)
);
dlg
.
SetTextWidth
(
ReturnStringFromValue
(
g_UserUnit
,
aSheetPin
->
m_Size
.
x
,
m_InternalUnits
)
);
dlg
.
SetTextWidthUnits
(
GetUnitsLabel
(
g_UserUnit
)
);
dlg
.
SetTextWidthUnits
(
GetUnitsLabel
(
g_UserUnit
)
);
dlg
.
SetConnectionType
(
aSheetPin
->
m_Shape
);
dlg
.
SetConnectionType
(
aSheetPin
->
GetShape
()
);
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier versions for
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier versions for
* the flex grid sizer in wxGTK that prevents the last column from being sized
* the flex grid sizer in wxGTK that prevents the last column from being sized
...
@@ -86,7 +86,7 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
...
@@ -86,7 +86,7 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
aSheetPin
->
m_Text
=
dlg
.
GetLabelName
();
aSheetPin
->
m_Text
=
dlg
.
GetLabelName
();
aSheetPin
->
m_Size
.
y
=
ReturnValueFromString
(
g_UserUnit
,
dlg
.
GetTextHeight
(),
m_InternalUnits
);
aSheetPin
->
m_Size
.
y
=
ReturnValueFromString
(
g_UserUnit
,
dlg
.
GetTextHeight
(),
m_InternalUnits
);
aSheetPin
->
m_Size
.
x
=
ReturnValueFromString
(
g_UserUnit
,
dlg
.
GetTextWidth
(),
m_InternalUnits
);
aSheetPin
->
m_Size
.
x
=
ReturnValueFromString
(
g_UserUnit
,
dlg
.
GetTextWidth
(),
m_InternalUnits
);
aSheetPin
->
m_Shape
=
dlg
.
GetConnectionType
(
);
aSheetPin
->
SetShape
(
dlg
.
GetConnectionType
()
);
if
(
aDC
)
if
(
aDC
)
aSheetPin
->
Draw
(
DrawPanel
,
aDC
,
wxPoint
(
0
,
0
),
GR_DEFAULT_DRAWMODE
);
aSheetPin
->
Draw
(
DrawPanel
,
aDC
,
wxPoint
(
0
,
0
),
GR_DEFAULT_DRAWMODE
);
...
@@ -103,7 +103,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
...
@@ -103,7 +103,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
sheetPin
=
new
SCH_SHEET_PIN
(
aSheet
,
wxPoint
(
0
,
0
),
line
);
sheetPin
=
new
SCH_SHEET_PIN
(
aSheet
,
wxPoint
(
0
,
0
),
line
);
sheetPin
->
SetFlags
(
IS_NEW
);
sheetPin
->
SetFlags
(
IS_NEW
);
sheetPin
->
m_Size
=
m_lastSheetPinTextSize
;
sheetPin
->
m_Size
=
m_lastSheetPinTextSize
;
sheetPin
->
m_Shape
=
m_lastSheetPinType
;
sheetPin
->
SetShape
(
m_lastSheetPinType
)
;
int
response
=
EditSheetPin
(
sheetPin
,
NULL
);
int
response
=
EditSheetPin
(
sheetPin
,
NULL
);
...
@@ -113,7 +113,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
...
@@ -113,7 +113,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
return
NULL
;
return
NULL
;
}
}
m_lastSheetPinType
=
sheetPin
->
m_Shape
;
m_lastSheetPinType
=
sheetPin
->
GetShape
()
;
m_lastSheetPinTextSize
=
sheetPin
->
m_Size
;
m_lastSheetPinTextSize
=
sheetPin
->
m_Size
;
MoveItem
(
(
SCH_ITEM
*
)
sheetPin
,
aDC
);
MoveItem
(
(
SCH_ITEM
*
)
sheetPin
,
aDC
);
...
@@ -157,7 +157,8 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
...
@@ -157,7 +157,8 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
sheetPin
=
new
SCH_SHEET_PIN
(
aSheet
,
wxPoint
(
0
,
0
),
label
->
m_Text
);
sheetPin
=
new
SCH_SHEET_PIN
(
aSheet
,
wxPoint
(
0
,
0
),
label
->
m_Text
);
sheetPin
->
SetFlags
(
IS_NEW
);
sheetPin
->
SetFlags
(
IS_NEW
);
sheetPin
->
m_Size
=
m_lastSheetPinTextSize
;
sheetPin
->
m_Size
=
m_lastSheetPinTextSize
;
m_lastSheetPinType
=
sheetPin
->
m_Shape
=
label
->
m_Shape
;
m_lastSheetPinType
=
label
->
GetShape
();
sheetPin
->
SetShape
(
label
->
GetShape
()
);
MoveItem
(
(
SCH_ITEM
*
)
sheetPin
,
aDC
);
MoveItem
(
(
SCH_ITEM
*
)
sheetPin
,
aDC
);
...
...
include/base_struct.h
View file @
1047e60e
...
@@ -162,16 +162,16 @@ public:
...
@@ -162,16 +162,16 @@ public:
/**
/**
* Function Inspect
* Function Inspect
* is the examining function within the INSPECTOR which is passed to the
* is the examining function within the INSPECTOR which is passed to the
*
Iterate function. It is used primarily for searching, but not limited
*
EDA_ITEM::Iterate() function. It is used primarily for searching, but
* to that. It can also collect or modify the scanned objects.
*
not limited
to that. It can also collect or modify the scanned objects.
*
*
* @param
test
Item An EDA_ITEM to examine.
* @param
a
Item An EDA_ITEM to examine.
* @param
t
estData is arbitrary data needed by the inspector to determine
* @param
aT
estData is arbitrary data needed by the inspector to determine
* if the EDA_ITEM under test meets its match criteria.
* if the EDA_ITEM under test meets its match criteria.
* @return
SEARCH_RESULT SEARCH_QUIT if the Iterator is to stop the scan,
* @return
A #SEARCH_RESULT type #SEARCH_QUIT if the iterator function is to
*
else SCAN
_CONTINUE;
*
stop the scan, else #SEARCH
_CONTINUE;
*/
*/
SEARCH_RESULT
virtual
Inspect
(
EDA_ITEM
*
testItem
,
const
void
*
t
estData
)
=
0
;
SEARCH_RESULT
virtual
Inspect
(
EDA_ITEM
*
aItem
,
const
void
*
aT
estData
)
=
0
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment