7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 10:20:11 +00:00

Add copy constructors and cloning to schematic objects and other minor fixes.

This commit is contained in:
Wayne Stambaugh 2010-12-21 10:13:09 -05:00
parent c699c726b6
commit b98538ec35
66 changed files with 2259 additions and 2515 deletions

View File

@ -4,6 +4,20 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.
2010-dec-21 UPDATE Wayne Stambaugh <stambaughw@verizon.net>
================================================================================
++all
* Doxygen comment warning fixes.
* Coding policy fixes.
++common
* Add clone method to EDA_ITEM object.
++EESchema
* Replace GenCopy() method with Clone() in all items derived from SCH_ITEM.
* Simplify repeat last schematic item with new Clone() method.
* Simplify duplicate schematic item method with new Clone() method.
* Separate objects in sch_items.h/cpp into separate files per object.
2010-dec-20, UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
common:

View File

@ -37,6 +37,7 @@ EDA_ITEM::EDA_ITEM( KICAD_T idType )
EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
{
InitVars();
m_StructType = base.m_StructType;
m_Parent = base.m_Parent;
m_Son = base.m_Son;
@ -73,6 +74,13 @@ void EDA_ITEM::SetModified()
}
EDA_ITEM* EDA_ITEM::doClone() const
{
wxCHECK_MSG( false, NULL, wxT( "doClone not implemented in derived class " ) + GetClass() +
wxT( ". Bad programmer." ) );
}
// see base_struct.h
SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
INSPECTOR* inspector,
@ -117,9 +125,9 @@ SEARCH_RESULT EDA_ITEM::Visit( INSPECTOR* inspector, const void* testData,
return SEARCH_CONTINUE;
}
#if defined(DEBUG)
// A function that should have been in wxWidgets
std::ostream& operator<<( std::ostream& out, const wxSize& size )
{
@ -136,13 +144,6 @@ std::ostream& operator<<( std::ostream& out, const wxPoint& pt )
}
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void EDA_ITEM::Show( int nestLevel, std::ostream& os ) const
{
// XML output:
@ -154,13 +155,6 @@ void EDA_ITEM::Show( int nestLevel, std::ostream& os ) const
}
/**
* Function NestedSpace
* outputs nested space for pretty indenting.
* @param nestLevel The nest count
* @param os The ostream&, where to output
* @return std::ostream& - for continuation.
**/
std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os )
{
for( int i = 0; i<nestLevel; ++i )
@ -180,31 +174,42 @@ std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os )
/**************************************************/
EDA_TextStruct::EDA_TextStruct( const wxString& text )
{
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
m_Orient = 0; /* Orient in 0.1 degrees */
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; // Width and height of font.
m_Orient = 0; // Rotation angle in 0.1 degrees.
m_Attributs = 0;
m_Mirror = false; // display mirror if true
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; /* Justifications Horiz et Vert du texte */
m_Thickness = 0; /* thickness */
m_Italic = false; /* true = italic shape */
m_Mirror = false; // display mirror if true
m_HJustify = GR_TEXT_HJUSTIFY_CENTER; // Defualt horizontal justification is centered.
m_VJustify = GR_TEXT_VJUSTIFY_CENTER; // Defualt vertical justification is centered.
m_Thickness = 0; // thickness
m_Italic = false; // true = italic shape.
m_Bold = false;
m_MultilineAllowed = false; // Set to true only for texts that can use multiline.
m_MultilineAllowed = false; // Set to true for multiline text.
m_Text = text;
}
EDA_TextStruct::EDA_TextStruct( const EDA_TextStruct& aText )
{
m_Pos = aText.m_Pos;
m_Size = aText.m_Size;
m_Orient = aText.m_Orient;
m_Attributs = aText.m_Attributs;
m_Mirror = aText.m_Mirror;
m_HJustify = aText.m_HJustify;
m_VJustify = aText.m_VJustify;
m_Thickness = aText.m_Thickness;
m_Italic = aText.m_Italic;
m_Bold = aText.m_Bold;
m_MultilineAllowed = aText.m_MultilineAllowed;
m_Text = aText.m_Text;
}
EDA_TextStruct::~EDA_TextStruct()
{
}
/**
* Function LenSize
* @return the text lenght in internal units
* @param aLine : the line of text to consider.
* For single line text, this parameter is always m_Text
*/
int EDA_TextStruct::LenSize( const wxString& aLine ) const
{
return ReturnGraphicTextWidth(aLine, m_Size.x, m_Italic, m_Bold ) + m_Thickness;
@ -332,25 +337,9 @@ bool EDA_TextStruct::TextHitTest( const EDA_Rect& aRect, bool aContains, int aAc
}
/***************************************************************/
void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode,
void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset,
EDA_Colors aColor, int aDrawMode,
GRTraceMode aFillMode, EDA_Colors aAnchor_color )
/***************************************************************/
/**
* Function Draw
* Draws this, that can be a multiline text
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aFillMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
*/
{
if( m_MultilineAllowed )
{
@ -361,6 +350,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
offset.y = GetInterline();
RotatePoint( &offset, m_Orient );
for( unsigned i = 0; i<list->Count(); i++ )
{
wxString txt = list->Item( i );
@ -391,24 +381,10 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
}
/**
* Function DrawOneLineOfText
* Draw a single text line.
* Used to draw each line of this EDA_TextStruct, that can be multiline
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param EDA_Colors aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aFillMode = FILAIRE, FILLED or SKETCH
* @param EDA_Colors aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
* @param EDA_Colors aText = the single line of text to draw.
* @param EDA_Colors aPos = the position of this line ).
*/
void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor,
int aDrawMode,
GRTraceMode aFillMode, EDA_Colors aAnchor_color,
int aDrawMode, GRTraceMode aFillMode,
EDA_Colors aAnchor_color,
wxString& aText, wxPoint aPos )
{
int width = m_Thickness;
@ -449,23 +425,20 @@ void EDA_TextStruct::DrawOneLineOfText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
if( m_Mirror )
size.x = -size.x;
DrawGraphicText( aPanel, aDC,
aOffset + aPos, aColor, aText,
m_Orient, size,
DrawGraphicText( aPanel, aDC, aOffset + aPos, aColor, aText, m_Orient, size,
m_HJustify, m_VJustify, width, m_Italic, m_Bold );
}
/**
* Function GetStyleName
* @return a wwString withe the style name( Normal, Italic, Bold, Bold+Italic)
*/
wxString EDA_TextStruct::GetTextStyleName()
{
int style = 0;
if( m_Italic )
style = 1;
if( m_Bold )
style += 2;
wxString stylemsg[4] = {
_("Normal"),
_("Italic"),
@ -481,17 +454,14 @@ wxString EDA_TextStruct::GetTextStyleName()
/* Class EDA_Rect */
/******************/
/******************************/
void EDA_Rect::Normalize()
/******************************/
// Ensure the height ant width are >= 0
{
if( m_Size.y < 0 )
{
m_Size.y = -m_Size.y;
m_Pos.y -= m_Size.y;
}
if( m_Size.x < 0 )
{
m_Size.x = -m_Size.x;
@ -500,21 +470,12 @@ void EDA_Rect::Normalize()
}
/**
* Function Move
* Move this rectangle by the aMoveVector value (this is a relative move)
* @param aMoveVector = a wxPoint that is the value to move this rectangle
*/
void EDA_Rect::Move( const wxPoint& aMoveVector )
{
m_Pos += aMoveVector;
}
/* Return TRUE if point is in Rect
* Accept rect size < 0
*/
bool EDA_Rect::Contains( const wxPoint& aPoint ) const
{
wxPoint rel_pos = aPoint - m_Pos;
@ -540,7 +501,7 @@ bool EDA_Rect::Contains( const wxPoint& aPoint ) const
*/
bool EDA_Rect::Contains( const EDA_Rect& aRect ) const
{
return Contains(aRect.GetOrigin() ) && Contains(aRect.GetEnd() );
return Contains( aRect.GetOrigin() ) && Contains( aRect.GetEnd() );
}
@ -576,35 +537,14 @@ bool EDA_Rect::Intersects( const EDA_Rect& aRect ) const
}
/**************************************************/
EDA_Rect& EDA_Rect::Inflate( int aDelta )
/**************************************************/
/**
* Function Inflate
* Inflate "this": move each horizontal edgeand each vertical edge by aDelta
* toward rect outside
* if aDelta is negative, move toward rect inside (deflate)
* Works for positive and negative rect size
*
*/
{
Inflate( aDelta, aDelta );
return *this;
}
/**************************************************/
EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
/**************************************************/
/**
* Function Inflate
* Inflate "this": move each horizontal edge by dx and each vertical edge by dy
* toward rect outside
* if dx and/or dy is negative, move toward rect inside (deflate)
* Works for positive and negative rect size
*
*/
EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
{
if( m_Size.x >= 0 )
{
@ -637,7 +577,6 @@ EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
}
}
if( m_Size.y >= 0 )
{
if( m_Size.y < -2 * dy )
@ -673,12 +612,6 @@ EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
}
/**
* Function Merge
* modifies Position and Size of this in order to contain the given rect
* mainly used to calculate bounding boxes
* @param aRect = given rect to merge with this
*/
void EDA_Rect::Merge( const EDA_Rect& aRect )
{
Normalize(); // ensure width and height >= 0
@ -695,12 +628,7 @@ void EDA_Rect::Merge( const EDA_Rect& aRect )
SetEnd( end );
}
/**
* Function Merge
* modifies Position and Size of this in order to contain the given point
* mainly used to calculate bounding boxes
* @param aPoint = given point to merge with this
*/
void EDA_Rect::Merge( const wxPoint& aPoint )
{
Normalize(); // ensure width and height >= 0

View File

@ -282,7 +282,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/*
*
*/
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& event )
{
bool ShowAboutDialog(wxWindow * parent);
ShowAboutDialog(this);
@ -364,7 +364,7 @@ static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE()
#endif
void WinEDA_BasicFrame::CopyVersionInfoToClipboard( wxCommandEvent& WXUNUSED( event ) )
void WinEDA_BasicFrame::CopyVersionInfoToClipboard( wxCommandEvent& event )
{
if( !wxTheClipboard->Open() )
{

View File

@ -59,6 +59,17 @@ void MARKER_BASE::init()
}
MARKER_BASE::MARKER_BASE( const MARKER_BASE& aMarker )
{
m_Pos = aMarker.m_Pos;
m_Corners = aMarker.m_Corners;
m_MarkerType = aMarker.m_MarkerType;
m_Color = aMarker.m_Color;
m_ShapeBoundingBox = aMarker.m_ShapeBoundingBox;
m_ScalingFactor = aMarker.m_ScalingFactor;
}
MARKER_BASE::MARKER_BASE()
{
m_ScalingFactor = M_SHAPE_SCALE;
@ -122,13 +133,6 @@ bool MARKER_BASE::HitTestMarker( const wxPoint& refPos ) const
}
/**
* Function GetBoundingBoxMarker
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_Rect MARKER_BASE::GetBoundingBoxMarker() const
{
wxSize realsize = m_ShapeBoundingBox.GetSize();
@ -141,15 +145,8 @@ EDA_Rect MARKER_BASE::GetBoundingBoxMarker() const
return EDA_Rect( m_Pos, realsize );
}
/**********************************************************************/
void MARKER_BASE::DrawMarker( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode,
const wxPoint& aOffset )
/**********************************************************************/
/**
* Function DrawMarker
* The shape is the polygon defined in m_Corners (array of wxPoints)
*/
{
wxPoint corners[CORNERS_COUNT];
@ -172,16 +169,11 @@ void MARKER_BASE::DrawMarker( WinEDA_DrawPanel* aPanel, wxDC* aDC, int aDrawMode
}
/**
* Function DisplayMarkerInfo
* Displays the full info of this marker, within an HTML window
*/
void MARKER_BASE::DisplayMarkerInfo( WinEDA_DrawFrame* aFrame )
{
wxString msg = m_drc.ShowHtml();
DIALOG_DISPLAY_HTML_TEXT_BASE
infodisplay( (wxWindow*)aFrame, wxID_ANY, _("Marker Info"),
wxGetMousePosition(), wxSize( 550, 140 ) );
DIALOG_DISPLAY_HTML_TEXT_BASE infodisplay( (wxWindow*)aFrame, wxID_ANY, _( "Marker Info" ),
wxGetMousePosition(), wxSize( 550, 140 ) );
infodisplay.m_htmlWindow->SetPage( msg );
infodisplay.ShowModal();

View File

@ -879,7 +879,7 @@ void wxSVGFileDC::DoDrawIcon( const class wxIcon& myIcon, wxCoord x, wxCoord y )
void wxSVGFileDC::DoDrawBitmap( const class wxBitmap& bmp,
wxCoord x,
wxCoord y,
bool WXUNUSED ( bTransparent) /*=0*/ )
bool bTransparent /*=0*/ )
{
if( m_graphics_changed )
NewGraphics();

View File

@ -29,6 +29,13 @@ SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) :
}
SCH_ITEM::SCH_ITEM( const SCH_ITEM& aItem ) :
EDA_ITEM( aItem )
{
m_Layer = aItem.m_Layer;
}
SCH_ITEM::~SCH_ITEM()
{
// Do not let the connections container go out of scope with any ojbects or they
@ -101,5 +108,5 @@ bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
return false;
return DoIsConnected( aPosition );
return doIsConnected( aPosition );
}

View File

@ -115,10 +115,14 @@ set(EESCHEMA_SRCS
operations_on_items_lists.cpp
pinedit.cpp
plot.cpp
sch_bus_entry.cpp
sch_component.cpp
sch_field.cpp
sch_items.cpp
sch_line.cpp
sch_marker.cpp
sch_no_connect.cpp
sch_polyline.cpp
sch_screen.cpp
sch_sheet.cpp
sch_sheet_path.cpp

View File

@ -16,8 +16,11 @@
#include "class_library.h"
#include "lib_pin.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_text.h"
#include "sch_component.h"
#include "sch_sheet.h"

View File

@ -14,16 +14,18 @@
#include "lib_pin.h"
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_items.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"
/* Routines Locales */
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC );
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
static bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos );
@ -172,7 +174,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
if( g_HVLines ) // We need 2 segments to go from a given start pin to an end point
{
nextsegment = newsegment->GenCopy();
nextsegment = new SCH_LINE( *newsegment );
nextsegment->m_Flags = IS_NEW;
newsegment->SetNext( nextsegment );
nextsegment->SetBack( newsegment );
@ -220,7 +222,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
/* Create a new segment, and chain it after the current new segment */
if( nextsegment )
{
newsegment = nextsegment->GenCopy();
newsegment = new SCH_LINE( *nextsegment );
nextsegment->m_Start = newsegment->m_End;
nextsegment->SetNext( NULL );
nextsegment->SetBack( newsegment );
@ -229,7 +231,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
}
else
{
newsegment = oldsegment->GenCopy();
newsegment = new SCH_LINE( *oldsegment );
newsegment->m_Start = oldsegment->m_End;
}
@ -332,6 +334,7 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
if( !g_ItemToRepeat )
g_ItemToRepeat = segment;
}
segment->m_Flags = 0;
segment = segment->Next();
}
@ -372,7 +375,6 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )
item = item->Next();
}
DrawPanel->CursorOn( DC ); // Display schematic cursor
SaveCopyInUndoList( s_OldWiresList, UR_WIRE_IMAGE );
@ -442,6 +444,7 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
GRSetDrawMode( DC, g_XorMode );
int idx = NewPoly->GetCornerCount() - 1;
if( g_HVLines )
{
/* Coerce the line to vertical or horizontal one: */
@ -571,111 +574,30 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
*/
void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
{
wxPoint new_pos;
if( g_ItemToRepeat == NULL )
return;
switch( g_ItemToRepeat->Type() )
g_ItemToRepeat = g_ItemToRepeat->Clone();
if( g_ItemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
{
case SCH_JUNCTION_T:
#undef STRUCT
#define STRUCT ( (SCH_JUNCTION*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
break;
case SCH_NO_CONNECT_T:
#undef STRUCT
#define STRUCT ( (SCH_NO_CONNECT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
break;
case SCH_TEXT_T:
#undef STRUCT
#define STRUCT ( (SCH_TEXT*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_LABEL_T:
#undef STRUCT
#define STRUCT ( (SCH_LABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_HIERARCHICAL_LABEL_T:
#undef STRUCT
#define STRUCT ( (SCH_HIERLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_GLOBAL_LABEL_T:
#undef STRUCT
#define STRUCT ( (SCH_GLOBALLABEL*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
IncrementLabelMember( STRUCT->m_Text );
break;
case SCH_LINE_T:
#undef STRUCT
#define STRUCT ( (SCH_LINE*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Start += g_RepeatStep;
new_pos = STRUCT->m_Start;
STRUCT->m_End += g_RepeatStep;
break;
case SCH_BUS_ENTRY_T:
#undef STRUCT
#define STRUCT ( (SCH_BUS_ENTRY*) g_ItemToRepeat )
g_ItemToRepeat = STRUCT->GenCopy();
STRUCT->m_Pos += g_RepeatStep;
new_pos = STRUCT->m_Pos;
break;
case SCH_COMPONENT_T: // In repeat command the new component is put
// in move mode
#undef STRUCT
#define STRUCT ( (SCH_COMPONENT*) g_ItemToRepeat )
// Create the duplicate component, position = mouse cursor
g_ItemToRepeat = STRUCT->GenCopy();
new_pos.x = GetScreen()->m_Curseur.x - STRUCT->m_Pos.x;
new_pos.y = GetScreen()->m_Curseur.y - STRUCT->m_Pos.y;
STRUCT->m_Pos = GetScreen()->m_Curseur;
STRUCT->m_Flags = IS_NEW;
STRUCT->m_TimeStamp = GetTimeStamp();
for( int ii = 0; ii < STRUCT->GetFieldCount(); ii++ )
{
STRUCT->GetField( ii )->m_Pos += new_pos;
}
RedrawOneStruct( DrawPanel, DC, STRUCT, g_XorMode );
StartMovePart( STRUCT, DC );
wxPoint pos = GetScreen()->m_Curseur - ( (SCH_COMPONENT*) g_ItemToRepeat )->m_Pos;
g_ItemToRepeat->m_Flags = IS_NEW;
( (SCH_COMPONENT*) g_ItemToRepeat )->m_TimeStamp = GetTimeStamp();
g_ItemToRepeat->Move( pos );
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, g_XorMode );
StartMovePart( (SCH_COMPONENT*) g_ItemToRepeat, DC );
return;
break;
}
default:
g_ItemToRepeat = NULL;
DisplayError( this, wxT( "Repeat Type Error" ), 10 );
break;
g_ItemToRepeat->Move( wxPoint( g_RepeatStep.GetWidth(), g_RepeatStep.GetHeight() ) );
if( g_ItemToRepeat->Type() == SCH_TEXT_T
|| g_ItemToRepeat->Type() == SCH_LABEL_T
|| g_ItemToRepeat->Type() == SCH_HIERARCHICAL_LABEL_T
|| g_ItemToRepeat->Type() == SCH_GLOBAL_LABEL_T )
{
( (SCH_TEXT*) g_ItemToRepeat )->IncrementLabel();
}
if( g_ItemToRepeat )
@ -686,9 +608,6 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE );
SaveCopyInUndoList( g_ItemToRepeat, UR_NEW );
g_ItemToRepeat->m_Flags = 0;
// GetScreen()->Curseur = new_pos;
// DrawPanel->MouseTo( DrawPanel->CursorScreenPosition() );
}
}
@ -702,6 +621,7 @@ void IncrementLabelMember( wxString& name )
long number = 0;
ii = name.Len() - 1; nn = 0;
if( !isdigit( name.GetChar( ii ) ) )
return;
@ -712,6 +632,7 @@ void IncrementLabelMember( wxString& name )
ii++; /* digits are starting at ii position */
wxString litt_number = name.Right( nn );
if( litt_number.ToLong( &number ) )
{
number += g_RepeatDeltaLabel;
@ -778,11 +699,13 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
itempos = LibItem->GetScreenCoord( pin->GetPosition() );
itempos.x += LibItem->m_Pos.x;
itempos.y += LibItem->m_Pos.y;
if( ( itempos.x == pos.x ) && ( itempos.y == pos.y ) )
return TRUE;
}
item = PickStruct( pos, screen, WIREITEM );
if( item )
return TRUE;

View File

@ -13,7 +13,7 @@
#include "general.h"
#include "protos.h"
#include "sch_items.h"
#include "sch_bus_entry.h"
static int s_LastShape = '\\';
@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::StartMoveBusEntry( SCH_BUS_ENTRY* BusEntry, wxDC* DC )
if( (BusEntry->m_Flags & IS_NEW) == 0 ) // not already in edit, save shape
{
delete g_ItemToUndoCopy;
g_ItemToUndoCopy = BusEntry->GenCopy();
g_ItemToUndoCopy = BusEntry->Clone();
}
BusEntry->m_Flags |= IS_MOVED;

View File

@ -12,7 +12,9 @@
#include "general.h"
#include "protos.h"
#include "netlist.h"
#include "sch_bus_entry.h"
#include "sch_items.h"
#include "sch_line.h"
/* Routine to start/end segment (BUS or wires) on junctions.
@ -91,11 +93,11 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
* Segment connecte: doit etre coupe en 2 si px,py
* n'est
* pas une extremite */
if( ( segment->m_Start == aBreakpoint )
|| ( segment->m_End == aBreakpoint ) )
if( ( segment->m_Start == aBreakpoint ) || ( segment->m_End == aBreakpoint ) )
continue;
/* Here we must cut the segment into 2. */
NewSegment = segment->GenCopy();
NewSegment = new SCH_LINE( *segment );
NewSegment->m_Start = aBreakpoint;
segment->m_End = NewSegment->m_Start;
NewSegment->SetNext( segment->Next() );

View File

@ -12,6 +12,7 @@
#include "protos.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_sheet.h"
#include "sch_text.h"

View File

@ -297,7 +297,7 @@ void DIALOG_COLOR_CONFIG::UpdateLayerSettings()
}
void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& event )
{
UpdateLayerSettings();
m_Parent->DrawPanel->Refresh();
@ -305,13 +305,13 @@ void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& WXUNUSED( event ) )
}
void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& event )
{
UpdateLayerSettings();
m_Parent->DrawPanel->Refresh();

View File

@ -239,7 +239,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& event )
{
if( m_Parent == NULL )
return;
@ -261,7 +261,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& WXUNUSED
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& event )
{
if( m_PartAliasListCtrl->FindString( m_Parent->GetAliasName() ) != wxNOT_FOUND )
{
@ -284,7 +284,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart( wxCommandEvent& WXU
/* Add a new name to the alias list box
* New name cannot be the root name, and must not exists
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& event )
{
wxString aliasname;
LIB_COMPONENT* component = m_Parent->GetComponent();
@ -324,7 +324,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart( wxCommandEvent& event )
{
wxString aliasname = m_PartAliasListCtrl->GetStringSelection();
@ -444,7 +444,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& event )
{
if( IsOK( this, _( "Ok to Delete FootprintFilter LIST" ) ) )
{
@ -458,7 +458,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent&
/* Add a new name to the footprint filter list box
* Obvioulsy, cannot be void
*/
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNUSED (event) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& event )
{
wxString Line;
LIB_COMPONENT* component = m_Parent->GetComponent();
@ -494,7 +494,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
}
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& WXUNUSED( event ) )
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteOneFootprintFilter( wxCommandEvent& event )
{
LIB_COMPONENT* component = m_Parent->GetComponent();
int ii = m_FootprintFilterListBox->GetSelection();

View File

@ -42,7 +42,7 @@ void SCH_EDIT_FRAME::StartMoveCmpField( SCH_FIELD* aField, wxDC* DC )
SCH_COMPONENT* comp = (SCH_COMPONENT*) aField->GetParent();
SAFE_DELETE( g_ItemToUndoCopy );
g_ItemToUndoCopy = comp->GenCopy();
g_ItemToUndoCopy = new SCH_COMPONENT( *comp );
pos = comp->m_Pos;

View File

@ -41,7 +41,7 @@ void SCH_EDIT_FRAME::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
if( (TextStruct->m_Flags & IS_NEW) == 0 )
{
delete g_ItemToUndoCopy;
g_ItemToUndoCopy = TextStruct->GenCopy();
g_ItemToUndoCopy = TextStruct->Clone();
}
TextStruct->m_Flags |= IS_MOVED;

View File

@ -14,10 +14,14 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "sch_bus_entry.h"
#include "sch_component.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"
#include "build_version.h"
@ -185,8 +189,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
case SCH_POLYLINE_T:
{
SCH_POLYLINE* Struct = (SCH_POLYLINE*) aItem;
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x,
Struct->m_PolyPoints[0].y + aOffset.y );
GRMoveTo( Struct->m_PolyPoints[0].x + aOffset.x, Struct->m_PolyPoints[0].y + aOffset.y );
for( unsigned ii = 1; ii < Struct->GetCornerCount(); ii++ )
GRLineTo( &aPanel->m_ClipBox,
aDC,
@ -202,15 +206,16 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
{
SCH_LINE* Struct;
Struct = (SCH_LINE*) aItem;
if( (Struct->m_Flags & STARTPOINT) == 0 )
{
GRMoveTo( Struct->m_Start.x + aOffset.x,
Struct->m_Start.y + aOffset.y );
GRMoveTo( Struct->m_Start.x + aOffset.x, Struct->m_Start.y + aOffset.y );
}
else
{
GRMoveTo( Struct->m_Start.x, Struct->m_Start.y );
}
if( (Struct->m_Flags & ENDPOINT) == 0 )
{
GRLineTo( &aPanel->m_ClipBox, aDC, Struct->m_End.x + aOffset.x,

View File

@ -34,7 +34,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
case SCH_COMPONENT_T:
{
SCH_COMPONENT* newitem;
newitem = ((SCH_COMPONENT*) curr_item)->GenCopy();
newitem = new SCH_COMPONENT( *( (SCH_COMPONENT*) curr_item ) );
newitem->m_TimeStamp = GetTimeStamp();
newitem->ClearAnnotation( NULL );
newitem->m_Flags = IS_NEW;
@ -51,7 +51,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
case SCH_GLOBAL_LABEL_T:
case SCH_HIERARCHICAL_LABEL_T:
{
SCH_TEXT* newitem = ((SCH_TEXT*) curr_item)->GenCopy();
SCH_TEXT* newitem = (SCH_TEXT*) curr_item->Clone();
newitem->m_Flags = IS_NEW;
StartMoveTexte( newitem, &dc );
/* Redraw the original part in XOR mode */

View File

@ -420,7 +420,8 @@ void SCH_EDIT_FRAME::StartMovePart( SCH_COMPONENT* Component, wxDC* DC )
{
SAFE_DELETE( g_ItemToUndoCopy );
}
g_ItemToUndoCopy = Component->GenCopy();
g_ItemToUndoCopy = Component->Clone();
}
DrawPanel->CursorOff( DC );

View File

@ -13,6 +13,7 @@
#include "libeditframe.h"
#include "class_libentry.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_component.h"
#include "sch_sheet.h"
@ -510,8 +511,10 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( DrawStruct->Type() == SCH_LINE_T )
{
SCH_LINE* segment = (SCH_LINE*) DrawStruct;
if( segment->GetLayer() != LAYER_BUS )
break;
// Bus in progress:
OnLeftClick( DC, MousePos );
}

View File

@ -11,9 +11,13 @@
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#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"

View File

@ -11,9 +11,13 @@
#include "general.h"
#include "protos.h"
#include "class_library.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_polyline.h"
#include "sch_sheet.h"
#include "lib_pin.h"
#include "template_fieldnames.h"

View File

@ -14,6 +14,8 @@
#include "lib_pin.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_text.h"
#include "sch_sheet.h"

View File

@ -12,9 +12,12 @@
#include "general.h"
#include "protos.h"
#include "sch_bus_entry.h"
#include "sch_text.h"
#include "sch_marker.h"
#include "sch_items.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_component.h"
#include "sch_sheet.h"

View File

@ -15,10 +15,13 @@
#include "protos.h"
#include "hotkeys.h"
#include "class_library.h"
#include "sch_bus_entry.h"
#include "sch_marker.h"
#include "sch_text.h"
#include "sch_items.h"
#include "sch_component.h"
#include "sch_line.h"
#include "sch_no_connect.h"
#include "sch_sheet.h"
#include "sch_sheet_path.h"

Some files were not shown because too many files have changed in this diff Show More