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
1fc0113b
Commit
1fc0113b
authored
Jun 18, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unnecessary casting from VIEW_ITEM to EDA_ITEM. Added Type() function to VIEW_ITEM.
parent
cd517f67
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
100 deletions
+104
-100
view.cpp
common/view/view.cpp
+4
-4
base_struct.h
include/base_struct.h
+0
-93
painter.h
include/painter.h
+2
-1
view_item.h
include/view/view_item.h
+96
-0
pcb_painter.cpp
pcbnew/pcb_painter.cpp
+1
-1
pcb_painter.h
pcbnew/pcb_painter.h
+1
-1
No files found.
common/view/view.cpp
View file @
1fc0113b
...
@@ -199,7 +199,7 @@ double VIEW::ToScreen( double aCoord, bool aAbsolute ) const
...
@@ -199,7 +199,7 @@ double VIEW::ToScreen( double aCoord, bool aAbsolute ) const
void
VIEW
::
CopySettings
(
const
VIEW
*
aOtherView
)
void
VIEW
::
CopySettings
(
const
VIEW
*
aOtherView
)
{
{
// FIXME
wxASSERT_MSG
(
false
,
wxT
(
"This is not implemented"
)
);
}
}
...
@@ -249,7 +249,7 @@ void VIEW::SetViewport( const BOX2D& aViewport, bool aKeepAspect )
...
@@ -249,7 +249,7 @@ void VIEW::SetViewport( const BOX2D& aViewport, bool aKeepAspect )
void
VIEW
::
SetMirror
(
bool
aMirrorX
,
bool
aMirrorY
)
void
VIEW
::
SetMirror
(
bool
aMirrorX
,
bool
aMirrorY
)
{
{
// FIXME
wxASSERT_MSG
(
false
,
wxT
(
"This is not implemented"
)
);
}
}
...
@@ -381,13 +381,13 @@ struct VIEW::drawItem
...
@@ -381,13 +381,13 @@ struct VIEW::drawItem
{
{
group
=
gal
->
BeginGroup
();
group
=
gal
->
BeginGroup
();
aItem
->
setGroup
(
currentLayer
,
group
);
aItem
->
setGroup
(
currentLayer
,
group
);
view
->
m_painter
->
Draw
(
static_cast
<
EDA_ITEM
*>
(
aItem
)
,
currentLayer
);
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
);
gal
->
EndGroup
();
gal
->
EndGroup
();
}
}
}
}
else
if
(
aItem
->
ViewIsVisible
()
)
else
if
(
aItem
->
ViewIsVisible
()
)
{
{
view
->
m_painter
->
Draw
(
static_cast
<
EDA_ITEM
*>
(
aItem
)
,
currentLayer
);
view
->
m_painter
->
Draw
(
aItem
,
currentLayer
);
}
}
}
}
...
...
include/base_struct.h
View file @
1fc0113b
...
@@ -47,99 +47,6 @@ extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
...
@@ -47,99 +47,6 @@ extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
#endif
#endif
/**
* Enum KICAD_T
* is the set of class identification values, stored in EDA_ITEM::m_StructType
*/
enum
KICAD_T
{
NOT_USED
=
-
1
,
///< the 3d code uses this value
EOT
=
0
,
///< search types array terminator (End Of Types)
TYPE_NOT_INIT
=
0
,
PCB_T
,
SCREEN_T
,
///< not really an item, used to identify a screen
// Items in pcb
PCB_MODULE_T
,
///< class MODULE, a footprint
PCB_PAD_T
,
///< class D_PAD, a pad in a footprint
PCB_LINE_T
,
///< class DRAWSEGMENT, a segment not on copper layers
PCB_TEXT_T
,
///< class TEXTE_PCB, text on a layer
PCB_MODULE_TEXT_T
,
///< class TEXTE_MODULE, text in a footprint
PCB_MODULE_EDGE_T
,
///< class EDGE_MODULE, a footprint edge
PCB_TRACE_T
,
///< class TRACKE, a track segment (segment on a copper layer)
PCB_VIA_T
,
///< class SEGVIA, a via (like a track segment on a copper layer)
PCB_ZONE_T
,
///< class SEGZONE, a segment used to fill a zone area (segment on a
///< copper layer)
PCB_MARKER_T
,
///< class MARKER_PCB, a marker used to show something
PCB_DIMENSION_T
,
///< class DIMENSION, a dimension (graphic item)
PCB_TARGET_T
,
///< class PCB_TARGET, a target (graphic item)
PCB_ZONE_AREA_T
,
///< class ZONE_CONTAINER, a zone area
PCB_ITEM_LIST_T
,
///< class BOARD_ITEM_LIST, a list of board items
// Schematic draw Items. The order of these items effects the sort order.
// It is currently ordered to mimic the old Eeschema locate behavior where
// the smallest item is the selected item.
SCH_MARKER_T
,
SCH_JUNCTION_T
,
SCH_NO_CONNECT_T
,
SCH_BUS_WIRE_ENTRY_T
,
SCH_BUS_BUS_ENTRY_T
,
SCH_LINE_T
,
SCH_BITMAP_T
,
SCH_TEXT_T
,
SCH_LABEL_T
,
SCH_GLOBAL_LABEL_T
,
SCH_HIERARCHICAL_LABEL_T
,
SCH_FIELD_T
,
SCH_COMPONENT_T
,
SCH_SHEET_PIN_T
,
SCH_SHEET_T
,
// Be prudent with these 3 types:
// they should be used only to locate a specific field type
// among SCH_FIELD_T items types
SCH_FIELD_LOCATE_REFERENCE_T
,
SCH_FIELD_LOCATE_VALUE_T
,
SCH_FIELD_LOCATE_FOOTPRINT_T
,
// General
SCH_SCREEN_T
,
/*
* Draw items in library component.
*
* The order of these items effects the sort order for items inside the
* "DRAW/ENDDRAW" section of the component definition in a library file.
* If you add a new draw item, type, please make sure you add it so the
* sort order is logical.
*/
LIB_COMPONENT_T
,
LIB_ALIAS_T
,
LIB_ARC_T
,
LIB_CIRCLE_T
,
LIB_TEXT_T
,
LIB_RECTANGLE_T
,
LIB_POLYLINE_T
,
LIB_BEZIER_T
,
LIB_PIN_T
,
/*
* Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
* types before this line.
*/
LIB_FIELD_T
,
/*
* For GerbView: items type:
*/
TYPE_GERBER_DRAW_ITEM
,
// End value
MAX_STRUCT_TYPE_ID
};
/**
/**
* Enum FILL_T
* Enum FILL_T
* is the set of fill types used in plotting or drawing enclosed areas.
* is the set of fill types used in plotting or drawing enclosed areas.
...
...
include/painter.h
View file @
1fc0113b
...
@@ -41,6 +41,7 @@ namespace KiGfx
...
@@ -41,6 +41,7 @@ namespace KiGfx
{
{
class
GAL
;
class
GAL
;
class
STROKE_FONT
;
class
STROKE_FONT
;
class
VIEW_ITEM
;
/**
/**
* Class RENDER_SETTINGS
* Class RENDER_SETTINGS
...
@@ -205,7 +206,7 @@ public:
...
@@ -205,7 +206,7 @@ public:
* may know what to draw (eg. for pads there are separate layers for holes, because they
* may know what to draw (eg. for pads there are separate layers for holes, because they
* have other dimensions then the pad itself.
* have other dimensions then the pad itself.
*/
*/
virtual
bool
Draw
(
const
EDA
_ITEM
*
aItem
,
int
aLayer
)
=
0
;
virtual
bool
Draw
(
const
VIEW
_ITEM
*
aItem
,
int
aLayer
)
=
0
;
protected
:
protected
:
...
...
include/view/view_item.h
View file @
1fc0113b
...
@@ -34,6 +34,98 @@
...
@@ -34,6 +34,98 @@
#include <math/box2.h>
#include <math/box2.h>
/**
* Enum KICAD_T
* is the set of class identification values, stored in VIEW_ITEM::m_StructType
*/
enum
KICAD_T
{
NOT_USED
=
-
1
,
///< the 3d code uses this value
EOT
=
0
,
///< search types array terminator (End Of Types)
TYPE_NOT_INIT
=
0
,
PCB_T
,
SCREEN_T
,
///< not really an item, used to identify a screen
// Items in pcb
PCB_MODULE_T
,
///< class MODULE, a footprint
PCB_PAD_T
,
///< class D_PAD, a pad in a footprint
PCB_LINE_T
,
///< class DRAWSEGMENT, a segment not on copper layers
PCB_TEXT_T
,
///< class TEXTE_PCB, text on a layer
PCB_MODULE_TEXT_T
,
///< class TEXTE_MODULE, text in a footprint
PCB_MODULE_EDGE_T
,
///< class EDGE_MODULE, a footprint edge
PCB_TRACE_T
,
///< class TRACKE, a track segment (segment on a copper layer)
PCB_VIA_T
,
///< class SEGVIA, a via (like a track segment on a copper layer)
PCB_ZONE_T
,
///< class SEGZONE, a segment used to fill a zone area (segment on a
///< copper layer)
PCB_MARKER_T
,
///< class MARKER_PCB, a marker used to show something
PCB_DIMENSION_T
,
///< class DIMENSION, a dimension (graphic item)
PCB_TARGET_T
,
///< class PCB_TARGET, a target (graphic item)
PCB_ZONE_AREA_T
,
///< class ZONE_CONTAINER, a zone area
PCB_ITEM_LIST_T
,
///< class BOARD_ITEM_LIST, a list of board items
// Schematic draw Items. The order of these items effects the sort order.
// It is currently ordered to mimic the old Eeschema locate behavior where
// the smallest item is the selected item.
SCH_MARKER_T
,
SCH_JUNCTION_T
,
SCH_NO_CONNECT_T
,
SCH_BUS_WIRE_ENTRY_T
,
SCH_BUS_BUS_ENTRY_T
,
SCH_LINE_T
,
SCH_BITMAP_T
,
SCH_TEXT_T
,
SCH_LABEL_T
,
SCH_GLOBAL_LABEL_T
,
SCH_HIERARCHICAL_LABEL_T
,
SCH_FIELD_T
,
SCH_COMPONENT_T
,
SCH_SHEET_PIN_T
,
SCH_SHEET_T
,
// Be prudent with these 3 types:
// they should be used only to locate a specific field type
// among SCH_FIELD_T items types
SCH_FIELD_LOCATE_REFERENCE_T
,
SCH_FIELD_LOCATE_VALUE_T
,
SCH_FIELD_LOCATE_FOOTPRINT_T
,
// General
SCH_SCREEN_T
,
/*
* Draw items in library component.
*
* The order of these items effects the sort order for items inside the
* "DRAW/ENDDRAW" section of the component definition in a library file.
* If you add a new draw item, type, please make sure you add it so the
* sort order is logical.
*/
LIB_COMPONENT_T
,
LIB_ALIAS_T
,
LIB_ARC_T
,
LIB_CIRCLE_T
,
LIB_TEXT_T
,
LIB_RECTANGLE_T
,
LIB_POLYLINE_T
,
LIB_BEZIER_T
,
LIB_PIN_T
,
/*
* Fields are not saved inside the "DRAW/ENDDRAW". Add new draw item
* types before this line.
*/
LIB_FIELD_T
,
/*
* For GerbView: items type:
*/
TYPE_GERBER_DRAW_ITEM
,
// End value
MAX_STRUCT_TYPE_ID
};
namespace
KiGfx
namespace
KiGfx
{
{
// Forward declarations
// Forward declarations
...
@@ -154,6 +246,9 @@ public:
...
@@ -154,6 +246,9 @@ public:
*/
*/
void
ViewRelease
();
void
ViewRelease
();
/// @copydoc EDA_ITEM::Type()
virtual
KICAD_T
Type
()
const
=
0
;
protected
:
protected
:
friend
class
VIEW
;
friend
class
VIEW
;
...
@@ -174,6 +269,7 @@ protected:
...
@@ -174,6 +269,7 @@ protected:
VIEW
*
m_view
;
///* Current dynamic view the item is assigned to.
VIEW
*
m_view
;
///* Current dynamic view the item is assigned to.
bool
m_viewVisible
;
///* Are we visible in the current dynamic VIEW.
bool
m_viewVisible
;
///* Are we visible in the current dynamic VIEW.
private
:
private
:
///* Helper for storing cached items group ids
///* Helper for storing cached items group ids
typedef
std
::
pair
<
int
,
int
>
GroupPair
;
typedef
std
::
pair
<
int
,
int
>
GroupPair
;
...
...
pcbnew/pcb_painter.cpp
View file @
1fc0113b
...
@@ -167,7 +167,7 @@ const COLOR4D& PCB_PAINTER::getItemColor( int aItemType, int aNetCode ) const
...
@@ -167,7 +167,7 @@ const COLOR4D& PCB_PAINTER::getItemColor( int aItemType, int aNetCode ) const
}
}
bool
PCB_PAINTER
::
Draw
(
const
EDA
_ITEM
*
aItem
,
int
aLayer
)
bool
PCB_PAINTER
::
Draw
(
const
VIEW
_ITEM
*
aItem
,
int
aLayer
)
{
{
// the "cast" applied in here clarifies which overloaded draw() is called
// the "cast" applied in here clarifies which overloaded draw() is called
switch
(
aItem
->
Type
()
)
switch
(
aItem
->
Type
()
)
...
...
pcbnew/pcb_painter.h
View file @
1fc0113b
...
@@ -115,7 +115,7 @@ public:
...
@@ -115,7 +115,7 @@ public:
PCB_PAINTER
(
GAL
*
aGal
);
PCB_PAINTER
(
GAL
*
aGal
);
/// @copydoc PAINTER::Draw()
/// @copydoc PAINTER::Draw()
virtual
bool
Draw
(
const
EDA
_ITEM
*
,
int
);
virtual
bool
Draw
(
const
VIEW
_ITEM
*
,
int
);
/// @copydoc PAINTER::ApplySettings()
/// @copydoc PAINTER::ApplySettings()
virtual
void
ApplySettings
(
RENDER_SETTINGS
*
aSettings
)
virtual
void
ApplySettings
(
RENDER_SETTINGS
*
aSettings
)
...
...
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