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
c32f56ff
Commit
c32f56ff
authored
Mar 31, 2013
by
Lorenzo Marcantonio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the long time dead SCH_POLYLINE class (schematic level polyline)
parent
86851d39
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1 addition
and
484 deletions
+1
-484
CMakeLists.txt
eeschema/CMakeLists.txt
+0
-1
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+0
-27
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+0
-5
operations_on_items_lists.cpp
eeschema/operations_on_items_lists.cpp
+0
-3
sch_collectors.cpp
eeschema/sch_collectors.cpp
+0
-5
sch_polyline.cpp
eeschema/sch_polyline.cpp
+0
-295
sch_polyline.h
eeschema/sch_polyline.h
+0
-144
schematic_undo_redo.cpp
eeschema/schematic_undo_redo.cpp
+0
-1
base_struct.h
include/base_struct.h
+0
-1
class_colors_design_settings.h
include/class_colors_design_settings.h
+1
-2
No files found.
eeschema/CMakeLists.txt
View file @
c32f56ff
...
...
@@ -132,7 +132,6 @@ set(EESCHEMA_SRCS
sch_line.cpp
sch_marker.cpp
sch_no_connect.cpp
sch_polyline.cpp
sch_screen.cpp
sch_sheet.cpp
sch_sheet_path.cpp
...
...
eeschema/bus-wire-junction.cpp
View file @
c32f56ff
...
...
@@ -41,7 +41,6 @@
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_polyline.h>
#include <sch_text.h>
#include <sch_component.h>
#include <sch_sheet.h>
...
...
@@ -346,33 +345,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC )
if
(
(
screen
->
GetCurItem
()
==
NULL
)
||
!
screen
->
GetCurItem
()
->
IsNew
()
)
return
;
/* Cancel trace in progress */
if
(
screen
->
GetCurItem
()
->
Type
()
==
SCH_POLYLINE_T
)
{
SCH_POLYLINE
*
polyLine
=
(
SCH_POLYLINE
*
)
screen
->
GetCurItem
();
wxPoint
endpos
;
endpos
=
screen
->
GetCrossHairPosition
();
int
idx
=
polyLine
->
GetCornerCount
()
-
1
;
wxPoint
pt
=
(
*
polyLine
)[
idx
];
if
(
GetForceHVLines
()
)
{
/* Coerce the line to vertical or horizontal one: */
if
(
std
::
abs
(
endpos
.
x
-
pt
.
x
)
<
std
::
abs
(
endpos
.
y
-
pt
.
y
)
)
endpos
.
x
=
pt
.
x
;
else
endpos
.
y
=
pt
.
y
;
}
polyLine
->
SetPoint
(
idx
,
endpos
);
polyLine
->
Draw
(
m_canvas
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
}
else
{
DrawSegment
(
m_canvas
,
DC
,
wxDefaultPosition
,
false
);
}
screen
->
Remove
(
screen
->
GetCurItem
()
);
m_canvas
->
SetMouseCaptureCallback
(
NULL
);
...
...
eeschema/load_one_schematic_file.cpp
View file @
c32f56ff
...
...
@@ -41,7 +41,6 @@
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_component.h>
#include <sch_polyline.h>
#include <sch_text.h>
#include <sch_sheet.h>
#include <sch_bitmap.h>
...
...
@@ -182,10 +181,6 @@ again." );
item
=
new
SCH_BUS_ENTRY
();
break
;
case
'P'
:
// Its a polyline item.
item
=
new
SCH_POLYLINE
();
break
;
case
'C'
:
// It is a connection item.
item
=
new
SCH_JUNCTION
();
break
;
...
...
eeschema/operations_on_items_lists.cpp
View file @
c32f56ff
...
...
@@ -15,7 +15,6 @@
#include <sch_marker.h>
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_polyline.h>
#include <sch_sheet.h>
#include <sch_component.h>
#include <sch_junction.h>
...
...
@@ -25,7 +24,6 @@ void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen )
{
switch
(
Struct
->
Type
()
)
{
case
SCH_POLYLINE_T
:
case
SCH_JUNCTION_T
:
case
SCH_TEXT_T
:
case
SCH_LABEL_T
:
...
...
@@ -185,7 +183,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
{
switch
(
newitem
->
Type
()
)
{
case
SCH_POLYLINE_T
:
case
SCH_JUNCTION_T
:
case
SCH_LINE_T
:
case
SCH_BUS_ENTRY_T
:
...
...
eeschema/sch_collectors.cpp
View file @
c32f56ff
...
...
@@ -41,7 +41,6 @@ const KICAD_T SCH_COLLECTOR::AllItems[] = {
SCH_NO_CONNECT_T
,
SCH_BUS_ENTRY_T
,
SCH_LINE_T
,
SCH_POLYLINE_T
,
SCH_BITMAP_T
,
SCH_TEXT_T
,
SCH_LABEL_T
,
...
...
@@ -62,7 +61,6 @@ const KICAD_T SCH_COLLECTOR::AllItemsButPins[] = {
SCH_NO_CONNECT_T
,
SCH_BUS_ENTRY_T
,
SCH_LINE_T
,
SCH_POLYLINE_T
,
SCH_BITMAP_T
,
SCH_TEXT_T
,
SCH_LABEL_T
,
...
...
@@ -111,7 +109,6 @@ const KICAD_T SCH_COLLECTOR::MovableItems[] = {
SCH_NO_CONNECT_T
,
SCH_BUS_ENTRY_T
,
// SCH_LINE_T,
SCH_POLYLINE_T
,
SCH_BITMAP_T
,
SCH_TEXT_T
,
SCH_LABEL_T
,
...
...
@@ -129,7 +126,6 @@ const KICAD_T SCH_COLLECTOR::DraggableItems[] = {
SCH_JUNCTION_T
,
SCH_BUS_ENTRY_T
,
SCH_LINE_T
,
SCH_POLYLINE_T
,
SCH_LABEL_T
,
SCH_GLOBAL_LABEL_T
,
SCH_HIERARCHICAL_LABEL_T
,
...
...
@@ -158,7 +154,6 @@ const KICAD_T SCH_COLLECTOR::ParentItems[] = {
SCH_NO_CONNECT_T
,
SCH_BUS_ENTRY_T
,
SCH_LINE_T
,
SCH_POLYLINE_T
,
SCH_TEXT_T
,
SCH_LABEL_T
,
SCH_GLOBAL_LABEL_T
,
...
...
eeschema/sch_polyline.cpp
deleted
100644 → 0
View file @
86851d39
/*
* 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) 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 <gr_basic.h>
#include <macros.h>
#include <class_drawpanel.h>
#include <trigo.h>
#include <common.h>
#include <richio.h>
#include <general.h>
#include <protos.h>
#include <sch_polyline.h>
SCH_POLYLINE
::
SCH_POLYLINE
(
int
layer
)
:
SCH_ITEM
(
NULL
,
SCH_POLYLINE_T
)
{
m_width
=
0
;
switch
(
layer
)
{
default
:
m_Layer
=
LAYER_NOTES
;
break
;
case
LAYER_WIRE
:
case
LAYER_NOTES
:
case
LAYER_BUS
:
m_Layer
=
layer
;
break
;
}
}
SCH_POLYLINE
::~
SCH_POLYLINE
()
{
}
EDA_ITEM
*
SCH_POLYLINE
::
Clone
()
const
{
return
new
SCH_POLYLINE
(
*
this
);
}
bool
SCH_POLYLINE
::
Save
(
FILE
*
aFile
)
const
{
bool
success
=
true
;
const
char
*
layer
=
"Notes"
;
const
char
*
width
=
"Line"
;
if
(
GetLayer
()
==
LAYER_WIRE
)
layer
=
"Wire"
;
if
(
GetLayer
()
==
LAYER_BUS
)
layer
=
"Bus"
;
if
(
fprintf
(
aFile
,
"Poly %s %s %d
\n
"
,
width
,
layer
,
GetCornerCount
()
)
==
EOF
)
{
return
false
;
}
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
if
(
fprintf
(
aFile
,
"
\t
%-4d %-4d
\n
"
,
m_points
[
ii
].
x
,
m_points
[
ii
].
y
)
==
EOF
)
{
success
=
false
;
break
;
}
}
return
success
;
}
bool
SCH_POLYLINE
::
Load
(
LINE_READER
&
aLine
,
wxString
&
aErrorMsg
)
{
char
Name1
[
256
];
char
Name2
[
256
];
wxPoint
pt
;
int
ii
;
char
*
line
=
(
char
*
)
aLine
;
while
(
(
*
line
!=
' '
)
&&
*
line
)
line
++
;
if
(
sscanf
(
line
,
"%s %s %d"
,
Name1
,
Name2
,
&
ii
)
!=
3
)
{
aErrorMsg
.
Printf
(
wxT
(
"Eeschema file polyline struct error at line %d, aborted"
),
aLine
.
LineNumber
()
);
aErrorMsg
<<
wxT
(
"
\n
"
)
<<
FROM_UTF8
(
(
char
*
)
aLine
);
return
false
;
}
m_Layer
=
LAYER_NOTES
;
if
(
Name2
[
0
]
==
'W'
)
m_Layer
=
LAYER_WIRE
;
if
(
Name2
[
0
]
==
'B'
)
m_Layer
=
LAYER_BUS
;
for
(
unsigned
jj
=
0
;
jj
<
(
unsigned
)
ii
;
jj
++
)
{
wxPoint
point
;
if
(
!
aLine
.
ReadLine
()
||
sscanf
(
((
char
*
)
aLine
),
"%d %d"
,
&
pt
.
x
,
&
pt
.
y
)
!=
2
)
{
aErrorMsg
.
Printf
(
wxT
(
"Eeschema file polyline struct error at line %d, aborted"
),
aLine
.
LineNumber
()
);
aErrorMsg
<<
wxT
(
"
\n
"
)
<<
FROM_UTF8
(
(
char
*
)
aLine
);
return
false
;
}
AddPoint
(
pt
);
}
return
true
;
}
int
SCH_POLYLINE
::
GetPenSize
()
const
{
int
pensize
=
(
m_width
==
0
)
?
GetDefaultLineThickness
()
:
m_width
;
return
pensize
;
}
void
SCH_POLYLINE
::
Draw
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
GR_DRAWMODE
aDrawMode
,
EDA_COLOR_T
aColor
)
{
EDA_COLOR_T
color
;
int
width
=
GetPenSize
();
if
(
aColor
>=
0
)
color
=
aColor
;
else
color
=
ReturnLayerColor
(
m_Layer
);
GRSetDrawMode
(
aDC
,
aDrawMode
);
if
(
m_Layer
==
LAYER_BUS
)
{
width
*=
3
;
}
GRMoveTo
(
m_points
[
0
].
x
,
m_points
[
0
].
y
);
if
(
m_Layer
==
LAYER_NOTES
)
{
for
(
unsigned
i
=
1
;
i
<
GetCornerCount
();
i
++
)
GRDashedLineTo
(
aPanel
->
GetClipBox
(),
aDC
,
m_points
[
i
].
x
+
aOffset
.
x
,
m_points
[
i
].
y
+
aOffset
.
y
,
width
,
color
);
}
else
{
for
(
unsigned
i
=
1
;
i
<
GetCornerCount
();
i
++
)
GRLineTo
(
aPanel
->
GetClipBox
(),
aDC
,
m_points
[
i
].
x
+
aOffset
.
x
,
m_points
[
i
].
y
+
aOffset
.
y
,
width
,
color
);
}
}
void
SCH_POLYLINE
::
MirrorX
(
int
aXaxis_position
)
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
m_points
[
ii
].
y
-=
aXaxis_position
;
NEGATE
(
m_points
[
ii
].
y
);
m_points
[
ii
].
y
=
aXaxis_position
;
}
}
void
SCH_POLYLINE
::
MirrorY
(
int
aYaxis_position
)
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
m_points
[
ii
].
x
-=
aYaxis_position
;
NEGATE
(
m_points
[
ii
].
x
);
m_points
[
ii
].
x
=
aYaxis_position
;
}
}
void
SCH_POLYLINE
::
Rotate
(
wxPoint
aPosition
)
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
{
RotatePoint
(
&
m_points
[
ii
],
aPosition
,
900
);
}
}
wxString
SCH_POLYLINE
::
GetSelectMenuText
()
const
{
wxString
menuText
,
fmt
;
switch
(
m_Layer
)
{
case
LAYER_NOTES
:
fmt
=
_
(
"Graphic Polyline with %d Points"
);
break
;
case
LAYER_WIRE
:
fmt
=
_
(
"Polyline Wire with %d Points"
);
break
;
case
LAYER_BUS
:
fmt
=
_
(
"Polyline Bus with %d Points"
);
break
;
default
:
fmt
=
_
(
"Polyline on Unkown Layer with %d Points"
);
}
menuText
.
Printf
(
fmt
,
m_points
.
size
()
);
return
menuText
;
}
BITMAP_DEF
SCH_POLYLINE
::
GetMenuImage
()
const
{
if
(
m_Layer
==
LAYER_NOTES
)
return
add_dashed_line_xpm
;
else
if
(
m_Layer
==
LAYER_WIRE
)
return
add_line_xpm
;
return
add_bus_xpm
;
}
bool
SCH_POLYLINE
::
HitTest
(
const
wxPoint
&
aPosition
,
int
aAccuracy
)
const
{
for
(
size_t
i
=
0
;
i
<
m_points
.
size
()
-
1
;
i
++
)
{
if
(
TestSegmentHit
(
aPosition
,
m_points
[
i
],
m_points
[
i
+
1
],
aAccuracy
)
)
return
true
;
}
return
false
;
}
bool
SCH_POLYLINE
::
HitTest
(
const
EDA_RECT
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
{
EDA_RECT
rect
=
aRect
;
rect
.
Inflate
(
aAccuracy
);
if
(
aContained
)
return
rect
.
Contains
(
GetBoundingBox
()
);
return
rect
.
Intersects
(
GetBoundingBox
()
);
}
void
SCH_POLYLINE
::
SetPosition
(
const
wxPoint
&
aPosition
)
{
wxPoint
offset
=
m_points
[
0
]
-
aPosition
;
for
(
size_t
i
=
0
;
i
<
m_points
.
size
();
i
++
)
m_points
[
i
]
=
m_points
[
i
]
-
offset
;
}
eeschema/sch_polyline.h
deleted
100644 → 0
View file @
86851d39
/*
* 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) 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.h
*
*/
#ifndef _SCH_POLYLINE_H_
#define _SCH_POLYLINE_H_
#include <sch_item_struct.h>
class
SCH_POLYLINE
:
public
SCH_ITEM
{
int
m_width
;
// Thickness
std
::
vector
<
wxPoint
>
m_points
;
// list of points (>= 2)
public
:
SCH_POLYLINE
(
int
layer
=
LAYER_NOTES
);
// Do not create a copy constructor. The one generated by the compiler is adequate.
~
SCH_POLYLINE
();
wxString
GetClass
()
const
{
return
wxT
(
"SCH_POLYLINE"
);
}
void
Draw
(
EDA_DRAW_PANEL
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
GR_DRAWMODE
aDrawMode
,
EDA_COLOR_T
aColor
=
UNSPECIFIED_COLOR
);
bool
Save
(
FILE
*
aFile
)
const
;
bool
Load
(
LINE_READER
&
aLine
,
wxString
&
aErrorMsg
);
/**
* Function AddPoint
* add a corner to m_points
*/
void
AddPoint
(
const
wxPoint
&
point
)
{
m_points
.
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
* @return the number of corners
*/
unsigned
GetCornerCount
()
const
{
return
m_points
.
size
();
}
int
GetPenSize
()
const
;
void
Move
(
const
wxPoint
&
aMoveVector
)
{
for
(
unsigned
ii
=
0
;
ii
<
GetCornerCount
();
ii
++
)
m_points
[
ii
]
+=
aMoveVector
;
}
void
MirrorY
(
int
aYaxis_position
);
void
MirrorX
(
int
aXaxis_position
);
void
Rotate
(
wxPoint
aPosition
);
wxString
GetSelectMenuText
()
const
;
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
];
}
wxPoint
GetPosition
()
const
{
return
m_points
[
0
];
}
void
SetPosition
(
const
wxPoint
&
aPosition
);
bool
HitTest
(
const
wxPoint
&
aPosition
,
int
aAccuracy
)
const
;
bool
HitTest
(
const
EDA_RECT
&
aRect
,
bool
aContained
=
false
,
int
aAccuracy
=
0
)
const
;
EDA_ITEM
*
Clone
()
const
;
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
const
{
ShowDummy
(
os
);
}
// override
#endif
};
#endif // _SCH_POLYLINE_H_
eeschema/schematic_undo_redo.cpp
View file @
c32f56ff
...
...
@@ -39,7 +39,6 @@
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_component.h>
#include <sch_polyline.h>
#include <sch_sheet.h>
#include <sch_bitmap.h>
...
...
include/base_struct.h
View file @
c32f56ff
...
...
@@ -84,7 +84,6 @@ enum KICAD_T {
SCH_NO_CONNECT_T
,
SCH_BUS_ENTRY_T
,
SCH_LINE_T
,
SCH_POLYLINE_T
,
SCH_BITMAP_T
,
SCH_TEXT_T
,
SCH_LABEL_T
,
...
...
include/class_colors_design_settings.h
View file @
c32f56ff
...
...
@@ -7,8 +7,7 @@
#define _COLORS_DESIGN_SETTING_H
#include <layers_id_colors_and_visibility.h>
// XXX shouldn't these come from somewhere else?
#define LAYERSCOLORSBUFFERSIZE 32
#define LAYERSCOLORSBUFFERSIZE NB_LAYERS
#define ITEMSCOLORSBUFFERSIZE 32
/**
...
...
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