Commit d1effbf4 authored by CHARRAS's avatar CHARRAS

EDA_BaseStruct.SetType() and EDA_BaseStruct.ReturnClassName() removed.

parent 2f3aeeaa
/* XPM */ /* XPM */
static char * footprint_text_xpm[] = { #ifndef XPMMAIN
"16 16 4 1", extern char *footprint_text_xpm[];
" c None",
". c #009B9B", #else
"+ c #007070", char * footprint_text_xpm[] = {
"@ c #005050", "16 16 4 1",
" .............. ", " c None",
" .............. ", ". c #009B9B",
" .+ .... +. ", "+ c #007070",
" .@ .... . ", "@ c #005050",
" .... ", " .............. ",
" .... ", " .............. ",
" .... ", " .+ .... +. ",
" .... ", " .@ .... . ",
" .... ", " .... ",
" .... ", " .... ",
" .... ", " .... ",
" .... ", " .... ",
" .... ", " .... ",
" .....+ ", " .... ",
" ........ ", " .... ",
" "}; " .... ",
" .... ",
" .....+ ",
" ........ ",
" "};
#endif
...@@ -4,6 +4,17 @@ Started 2007-June-11 ...@@ -4,6 +4,17 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-sept-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ all
* EDA_BaseStruct.SetType() removed.
The m_StructType member of class EDA_BaseStruct is no more modified in kicad.
Now Virtual functions can be widely used.
* The old EDA_BaseStruct.ReturnClassName() was removed.
the virtual EDA_BaseStruct.GetClass() is used instead.
+ gerbview: hotkeys Ok.
2007-Sep-13 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Sep-13 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================
......
...@@ -16,58 +16,6 @@ ...@@ -16,58 +16,6 @@
#include "macros.h" #include "macros.h"
// KICAD_T names for error messages only:
static wxString KICAD_TName[MAX_STRUCT_TYPE_ID + 1] = {
wxT( "Not init" ),
wxT( "Pcb" ),
wxT( "Equipot" ),
wxT( "Module" ),
wxT( "Pad" ),
wxT( "DrawSegment" ),
wxT( "Text (pcb)" ),
wxT( "Text module" ),
wxT( "edge module" ),
wxT( "track" ),
wxT( "zone" ),
wxT( "via" ),
wxT( "marker" ),
wxT( "cotation" ),
wxT( "mire" ),
wxT( "screen" ),
wxT( "block" ),
wxT( "edge zone" ),
wxT( "Polyline" ),
wxT( "Junction" ),
wxT( "Text" ),
wxT( "Label" ),
wxT( "Glob label" ),
wxT( "Lib item" ),
wxT( "Pick struct" ),
wxT( "Segment" ),
wxT( "Raccord" ),
wxT( "Sheet" ),
wxT( "Sheet label" ),
wxT( "Marker" ),
wxT( "No connect" ),
wxT( "Text (lib item)" ),
wxT( "Screen" ),
wxT( "Block locate" ),
wxT( "Library component" ),
wxT( "lib cmp draw circle" ),
wxT( "lib cmp draw graphic text" ),
wxT( "lib cmp draw rect" ),
wxT( "lib cmp draw poly line" ),
wxT( "lib cmp draw line" ),
wxT( "lib cmp pin" ),
wxT( "lib cmp field" ),
wxT( "unknown" ),
wxT( "unknown" )
};
enum textbox { enum textbox {
ID_TEXTBOX_LIST = 8010 ID_TEXTBOX_LIST = 8010
}; };
...@@ -130,7 +78,7 @@ void EDA_BaseStruct::AddToChain( EDA_BaseStruct* laststruct ) ...@@ -130,7 +78,7 @@ void EDA_BaseStruct::AddToChain( EDA_BaseStruct* laststruct )
/*********************************************************/ /*********************************************************/
/* /*
* addition d'une nouvelle struct a la liste chain�, apres la structure laststruct * Add "this" to the linked list, after laststruct
*/ */
{ {
Pnext = laststruct->Pnext; Pnext = laststruct->Pnext;
...@@ -152,7 +100,7 @@ void EDA_BaseStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off ...@@ -152,7 +100,7 @@ void EDA_BaseStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
msg.Printf( wxT( msg.Printf( wxT(
"EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ), "EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ),
Type() ); Type() );
msg += ReturnClassName() + wxT( ")\n" ); msg += GetClass() + wxT( ")\n" );
printf( CONV_TO_UTF8( msg ) ); printf( CONV_TO_UTF8( msg ) );
} }
...@@ -170,25 +118,6 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -170,25 +118,6 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
#endif #endif
/*********************************************/
wxString EDA_BaseStruct::ReturnClassName() const
/*********************************************/
/* Used at run time for diags: return the class name of the item,
* from its .Type() value.
*/
{
int ii = Type();
wxString classname;
if( (ii < 0) || (ii > MAX_STRUCT_TYPE_ID) )
ii = MAX_STRUCT_TYPE_ID;
classname = KICAD_TName[ii];
return classname;
}
// see base_struct.h // see base_struct.h
SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart, SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] ) INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] )
...@@ -287,9 +216,9 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os ) ...@@ -287,9 +216,9 @@ std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
/*********************************************************/ /**************************************************/
/* EDA_TextStruct (classe de base, non utilis� seule */ /* EDA_TextStruct (basic class, not directly used */
/*********************************************************/ /**************************************************/
EDA_TextStruct::EDA_TextStruct( const wxString& text ) EDA_TextStruct::EDA_TextStruct( const wxString& text )
{ {
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */ m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
......
...@@ -1350,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct ) ...@@ -1350,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
{ {
wxString msg; wxString msg;
msg << wxT( "DuplicateStruct error: unexpected StructType " ) << msg << wxT( "DuplicateStruct error: unexpected StructType " ) <<
DrawStruct->Type() << wxT( " " ) << DrawStruct->ReturnClassName(); DrawStruct->Type() << wxT( " " ) << DrawStruct->GetClass();
DisplayError( NULL, msg ); DisplayError( NULL, msg );
} }
break; break;
......
...@@ -90,6 +90,11 @@ class SCH_SCREEN : public BASE_SCREEN ...@@ -90,6 +90,11 @@ class SCH_SCREEN : public BASE_SCREEN
public: public:
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE ); SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
~SCH_SCREEN(); ~SCH_SCREEN();
virtual wxString GetClass() const
{
return wxT("SCH_SCREEN");
}
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
...@@ -120,6 +125,11 @@ public: ...@@ -120,6 +125,11 @@ public:
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~DrawSheetLabelStruct() { } ~DrawSheetLabelStruct() { }
virtual wxString GetClass() const
{
return wxT("DrawSheetLabelStruct");
}
DrawSheetLabelStruct* GenCopy(); DrawSheetLabelStruct* GenCopy();
DrawSheetLabelStruct* Next() DrawSheetLabelStruct* Next()
...@@ -148,6 +158,11 @@ public: ...@@ -148,6 +158,11 @@ public:
public: public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~DrawSheetStruct(); ~DrawSheetStruct();
virtual wxString GetClass() const
{
return wxT("DrawSheetStruct");
}
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_DrawFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy(); DrawSheetStruct* GenCopy();
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
......
...@@ -41,7 +41,8 @@ DrawTextStruct* DrawTextStruct::GenCopy() ...@@ -41,7 +41,8 @@ DrawTextStruct* DrawTextStruct::GenCopy()
switch( Type() ) switch( Type() )
{ {
case DRAW_TEXT_STRUCT_TYPE: default:
case DRAW_TEXT_STRUCT_TYPE:
newitem = new DrawTextStruct( m_Pos, m_Text ); newitem = new DrawTextStruct( m_Pos, m_Text );
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
...@@ -50,8 +51,6 @@ DrawTextStruct* DrawTextStruct::GenCopy() ...@@ -50,8 +51,6 @@ DrawTextStruct* DrawTextStruct::GenCopy()
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
newitem = new DrawLabelStruct( m_Pos, m_Text ); newitem = new DrawLabelStruct( m_Pos, m_Text );
break; break;
default:
newitem = 0; // will crash below
} }
newitem->m_Layer = m_Layer; newitem->m_Layer = m_Layer;
...@@ -78,13 +77,6 @@ void DrawTextStruct::SwapData( DrawTextStruct* copyitem ) ...@@ -78,13 +77,6 @@ void DrawTextStruct::SwapData( DrawTextStruct* copyitem )
EXCHG( m_Shape, copyitem->m_Shape ); EXCHG( m_Shape, copyitem->m_Shape );
EXCHG( m_Orient, copyitem->m_Orient ); EXCHG( m_Orient, copyitem->m_Orient );
// EXCHG( m_StructType, copyitem->m_StructType );
// how can you swap a type, it is what it was created as!
// this is a very bad usage of m_StructType.
KICAD_T aType = copyitem->Type();
copyitem->SetType( Type() );
SetType( aType );
EXCHG( m_Layer, copyitem->m_Layer ); EXCHG( m_Layer, copyitem->m_Layer );
EXCHG( m_HJustify, copyitem->m_HJustify ); EXCHG( m_HJustify, copyitem->m_HJustify );
EXCHG( m_VJustify, copyitem->m_VJustify ); EXCHG( m_VJustify, copyitem->m_VJustify );
...@@ -137,37 +129,11 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString ...@@ -137,37 +129,11 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString
} }
/***************************************************************/
void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color )
/***************************************************************/
/* Les textes type label ou notes peuvent avoir 4 directions, mais
* sont tj cadres par rapport a la 1ere lettre du texte
*/
{
switch( Type() )
{
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
DrawAsGlobalLabel( panel, DC, offset, DrawMode, Color );
break;
case DRAW_LABEL_STRUCT_TYPE:
DrawAsLabel( panel, DC, offset, DrawMode, Color );
break;
default:
DrawAsText( panel, DC, offset, DrawMode, Color );
}
}
/*******************************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/*******************************************************************************************/ /*******************************************************************************************/
/* Texts type Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
/* Texts type Label or Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
*/ */
{ {
int color; int color;
...@@ -216,25 +182,25 @@ void DrawTextStruct::DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoin ...@@ -216,25 +182,25 @@ void DrawTextStruct::DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoin
} }
/***************************************************************/ /*********************************************************************************************/
void DrawTextStruct::DrawAsLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/***************************************************************/ /*********************************************************************************************/
{ {
DrawAsText( panel, DC, offset, DrawMode, Color ); DrawTextStruct::Draw( panel, DC, offset, DrawMode, Color );
} }
/*****************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
/*****************************************************************************/ /******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
{ {
int* Template; int* Template;
int Poly[12]; int Poly[20];
int ii, jj, imax, color, HalfSize; int ii, jj, imax, color, HalfSize;
wxSize Size = m_Size; wxSize Size = m_Size;
int width = MAX( m_Width, g_DrawMinimunLineWidth ); int width = MAX( m_Width, g_DrawMinimunLineWidth );
...@@ -291,8 +257,7 @@ void DrawTextStruct::DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const ...@@ -291,8 +257,7 @@ void DrawTextStruct::DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const
jj++; Template++; jj++; Template++;
} }
// GRPoly(&panel->m_ClipBox, DC, imax,Poly,1, width, color, color ); /* Polygne Rempli */ GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color );
GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color ); /* Polygne Non Rempli */
if( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color ); DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
......
...@@ -47,6 +47,11 @@ public: ...@@ -47,6 +47,11 @@ public:
public: public:
PartTextStruct(const wxPoint & pos = wxPoint(0,0), const wxString & text = wxEmptyString); PartTextStruct(const wxPoint & pos = wxPoint(0,0), const wxString & text = wxEmptyString);
~PartTextStruct(void); ~PartTextStruct(void);
virtual wxString GetClass() const
{
return wxT("PartTextStruct");
}
void PartTextCopy(PartTextStruct * target); void PartTextCopy(PartTextStruct * target);
void Place(WinEDA_DrawFrame * frame, wxDC * DC); void Place(WinEDA_DrawFrame * frame, wxDC * DC);
...@@ -72,6 +77,11 @@ public: ...@@ -72,6 +77,11 @@ public:
public: public:
DrawPartStruct( KICAD_T struct_type, const wxPoint & pos); DrawPartStruct( KICAD_T struct_type, const wxPoint & pos);
~DrawPartStruct(void); ~DrawPartStruct(void);
virtual wxString GetClass() const
{
return wxT("DrawPartStruct");
}
}; };
...@@ -89,6 +99,11 @@ public: ...@@ -89,6 +99,11 @@ public:
public: public:
EDA_SchComponentStruct(const wxPoint & pos = wxPoint(0,0)); EDA_SchComponentStruct(const wxPoint & pos = wxPoint(0,0));
~EDA_SchComponentStruct(void){} ~EDA_SchComponentStruct(void){}
virtual wxString GetClass() const
{
return wxT("EDA_SchComponentStruct");
}
EDA_SchComponentStruct * GenCopy(void); EDA_SchComponentStruct * GenCopy(void);
void SetRotationMiroir( int type ); void SetRotationMiroir( int type );
int GetRotationMiroir(void); int GetRotationMiroir(void);
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
/* Structures pour memo et liste des elements */ /* Structures pour memo et liste des elements */
typedef struct ListLabel typedef struct ListLabel
{ {
int m_StructType; int m_LabelType;
void * m_Label; void * m_Label;
int m_SheetNumber; int m_SheetNumber;
} ListLabel; } ListLabel;
...@@ -691,7 +691,7 @@ BASE_SCREEN * screen; ...@@ -691,7 +691,7 @@ BASE_SCREEN * screen;
ItemCount++; ItemCount++;
if( List ) if( List )
{ {
List->m_StructType = DRAW_GLOBAL_LABEL_STRUCT_TYPE; List->m_LabelType = DRAW_GLOBAL_LABEL_STRUCT_TYPE;
List->m_SheetNumber = screen->m_SheetNumber; List->m_SheetNumber = screen->m_SheetNumber;
List->m_Label = DrawList; List->m_Label = DrawList;
List++; List++;
...@@ -706,7 +706,7 @@ BASE_SCREEN * screen; ...@@ -706,7 +706,7 @@ BASE_SCREEN * screen;
{ {
if ( List ) if ( List )
{ {
List->m_StructType = DRAW_SHEETLABEL_STRUCT_TYPE; List->m_LabelType = DRAW_SHEETLABEL_STRUCT_TYPE;
List->m_SheetNumber = screen->m_SheetNumber; List->m_SheetNumber = screen->m_SheetNumber;
List->m_Label = SheetLabel; List->m_Label = SheetLabel;
List++; List++;
...@@ -814,12 +814,12 @@ static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2) ...@@ -814,12 +814,12 @@ static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2)
int ii; int ii;
const wxString * Text1, *Text2; const wxString * Text1, *Text2;
if( Objet1->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text;
else else
Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text;
if( Objet2->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text;
else else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text;
...@@ -850,12 +850,12 @@ const wxString * Text1, *Text2; ...@@ -850,12 +850,12 @@ const wxString * Text1, *Text2;
if ( ii == 0 ) if ( ii == 0 )
{ {
if( Objet1->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text;
else else
Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text;
if( Objet2->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->m_LabelType == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text;
else else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text;
...@@ -1092,7 +1092,7 @@ wxString msg; ...@@ -1092,7 +1092,7 @@ wxString msg;
{ {
LabelItem = & List[ii]; LabelItem = & List[ii];
switch( LabelItem->m_StructType ) switch( LabelItem->m_LabelType )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label); DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label);
......
/**************************************************************************/ /*********************************************************************/
/* EESchema */ /* EESchema */
/* editexte.cpp: creation/ editions des textes (labels, textes sur schema) */ /* edit_label.cpp: label, global label and text creation or edition */
/**************************************************************************/ /*********************************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -103,6 +103,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC ...@@ -103,6 +103,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = ShowWhileMoving; DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte; DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( TextStruct );
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
...@@ -158,8 +159,8 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC* ...@@ -158,8 +159,8 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
( (DrawTextStruct*) TextStruct )->m_Orient++; TextStruct->m_Orient++;
( (DrawTextStruct*) TextStruct )->m_Orient &= 3; TextStruct->m_Orient &= 3;
break; break;
default: default:
...@@ -189,27 +190,25 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -189,27 +190,25 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
{ {
case LAYER_NOTES: case LAYER_NOTES:
NewText = new DrawTextStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawTextStruct( m_CurrentScreen->m_Curseur );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new DrawGlobalLabelStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawGlobalLabelStruct( m_CurrentScreen->m_Curseur );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; NewText->m_Shape = s_DefaultShapeGLabel;
( (DrawGlobalLabelStruct*) NewText )->m_Shape = s_DefaultShapeGLabel; NewText->m_Orient = s_DefaultOrientGLabel;
( (DrawGlobalLabelStruct*) NewText )->m_Orient = s_DefaultOrientGLabel;
break; break;
default: default:
DisplayError( this, wxT( "Editexte: Internal error" ) ); DisplayError( this, wxT( "WinEDA_SchematicFrame::CreateNewText() Internal error" ) );
break; return NULL;
} }
NewText->m_Flags = IS_NEW | IS_MOVED; NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
NewText->m_Flags = IS_NEW | IS_MOVED;
RedrawOneStruct( DrawPanel, DC, NewText, g_XorMode ); RedrawOneStruct( DrawPanel, DC, NewText, g_XorMode );
EditSchematicText( NewText, DC ); EditSchematicText( NewText, DC );
...@@ -222,8 +221,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -222,8 +221,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
if( type == LAYER_GLOBLABEL ) if( type == LAYER_GLOBLABEL )
{ {
s_DefaultShapeGLabel = ( (DrawGlobalLabelStruct*) NewText )->m_Shape; s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = ( (DrawGlobalLabelStruct*) NewText )->m_Orient; s_DefaultOrientGLabel = NewText->m_Orient;
} }
RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE );
...@@ -236,9 +235,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -236,9 +235,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
} }
/****************************************/ /************************************/
/* Dessin du Texte en deplacement */ /* Redraw a Texte while moving */
/****************************************/ /************************************/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
EDA_BaseStruct* TextStruct = panel->GetScreen()->GetCurItem(); EDA_BaseStruct* TextStruct = panel->GetScreen()->GetCurItem();
...@@ -322,41 +321,95 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text, ...@@ -322,41 +321,95 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
/*****************************************************************************/ /*****************************************************************************/
/* Routine to change a text type to an other one (GraphicText, label or Glabel). /* Routine to change a text type to an other one (GraphicText, label or Glabel).
* A new test, label or global label is created from the old text.
* the old text is deleted
*/ */
{ {
if( Text == NULL ) if( Text == NULL )
return; return;
/* save Text in undo list if not already in edit, or moving ... */ DrawTextStruct* newtext;
if( Text->m_Flags == 0 )
SaveCopyInUndoList( Text, IS_CHANGED );
DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, Text, g_XorMode );
// erase drawing
switch( newtype ) switch( newtype )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
Text->SetType( DRAW_LABEL_STRUCT_TYPE ); newtext = new DrawLabelStruct( Text->m_Pos, Text->m_Text );
Text->m_Layer = LAYER_LOCLABEL;
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
Text->SetType( DRAW_GLOBAL_LABEL_STRUCT_TYPE ); newtext = new DrawGlobalLabelStruct( Text->m_Pos, Text->m_Text );
Text->m_Layer = LAYER_GLOBLABEL;
break; break;
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
Text->SetType( DRAW_TEXT_STRUCT_TYPE ); newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text );
Text->m_Layer = LAYER_NOTES;
break; break;
default: default:
newtext = NULL;
DisplayError( this, wxT( "ConvertTextType: Internal error" ) ); DisplayError( this, wxT( "ConvertTextType: Internal error" ) );
break; return;
}
/* copy the old text settings */
newtext->m_Shape = Text->m_Shape;
newtext->m_Orient = Text->m_Orient;
newtext->m_Size = Text->m_Size;
newtext->m_Width = Text->m_Width;
newtext->m_HJustify = Text->m_HJustify;
newtext->m_VJustify = Text->m_VJustify;
newtext->m_IsDangling = Text->m_IsDangling;
// save current text flag:
int flags = Text->m_Flags;
/* add the new text in linked list if old text is in list */
if( (flags & IS_NEW) == 0 )
{
newtext->Pnext = GetScreen()->EEDrawList;
GetScreen()->EEDrawList = newtext;
GetScreen()->SetModify();
}
/* now delete the old text
* If it is a text flagged IS_NEW it will be deleted by ForceCloseManageCurseur()
* If not, we must delete it.
*/
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, DC );
}
if( (flags & IS_NEW) == 0 ) // Delete old text and save it in undo list
{
Text->m_Flags = 0;
DeleteStruct( DrawPanel, DC, Text );
m_CurrentScreen->SetCurItem( NULL );
g_ItemToRepeat = NULL;
}
GetScreen()->SetCurItem( newtext );
delete g_ItemToUndoCopy;
g_ItemToUndoCopy = NULL;
DrawPanel->CursorOff( DC ); // Erase schematic cursor
/* Save the new text in undo list if the old text was not itself a "new created text"
* In this case, the old text is already in undo list as a deleted item
* Of course if the old text was a "new created text" the new text will be put in undo list
* later, at the end of the current command (if not aborted)
*/
if( (flags & IS_NEW) == 0 )
{
SaveCopyInUndoList( newtext, IS_NEW );
}
else
newtext->m_Flags = IS_NEW;
if( (flags & IS_MOVED) != 0 )
{
StartMoveTexte( newtext, DC );
} }
RedrawOneStruct( DrawPanel, DC, Text, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, newtext, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // redraw schematic cursor DrawPanel->CursorOn( DC ); // redraw schematic cursor
} }
This diff is collapsed.
...@@ -473,7 +473,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask, ...@@ -473,7 +473,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "SnapPoint2() error: unexpected strct type %d (" ), DrawList->Type() ); msg.Printf( wxT( "SnapPoint2() error: unexpected strct type %d (" ), DrawList->Type() );
msg << DrawList->ReturnClassName() << wxT( ")" ); msg << DrawList->GetClass() << wxT( ")" );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
break; break;
} }
...@@ -660,7 +660,7 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, ...@@ -660,7 +660,7 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
msg.Printf( msg.Printf(
wxT( "DrawStructInBox() Err: unexpected StructType %d (" ), wxT( "DrawStructInBox() Err: unexpected StructType %d (" ),
DrawStruct->Type() ); DrawStruct->Type() );
msg << DrawStruct->ReturnClassName() << wxT( ")" ); msg << DrawStruct->GetClass() << wxT( ")" );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
break; break;
} }
......
...@@ -73,8 +73,14 @@ public: ...@@ -73,8 +73,14 @@ public:
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...) bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
public: public:
EDA_DrawLineStruct( const wxPoint &pos, int layer ); EDA_DrawLineStruct( const wxPoint& pos, int layer );
~EDA_DrawLineStruct() { } ~EDA_DrawLineStruct() { }
virtual wxString GetClass() const
{
return wxT( "EDA_DrawLineStruct" );
}
bool IsOneEndPointAt( const wxPoint& pos ); bool IsOneEndPointAt( const wxPoint& pos );
EDA_DrawLineStruct* GenCopy(); EDA_DrawLineStruct* GenCopy();
...@@ -83,6 +89,7 @@ public: ...@@ -83,6 +89,7 @@ public:
return m_Start == m_End; return m_Start == m_End;
} }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
}; };
...@@ -97,8 +104,14 @@ public: ...@@ -97,8 +104,14 @@ public:
wxString m_Comment; /* Texte (commentaireassocie eventuel */ wxString m_Comment; /* Texte (commentaireassocie eventuel */
public: public:
DrawMarkerStruct( const wxPoint &pos, const wxString &text ); DrawMarkerStruct( const wxPoint& pos, const wxString& text );
~DrawMarkerStruct(); ~DrawMarkerStruct();
virtual wxString GetClass() const
{
return wxT( "DrawMarkerStruct" );
}
DrawMarkerStruct* GenCopy(); DrawMarkerStruct* GenCopy();
wxString GetComment(); wxString GetComment();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
...@@ -112,8 +125,14 @@ public: ...@@ -112,8 +125,14 @@ public:
wxPoint m_Pos; /* XY coordinates of NoConnect. */ wxPoint m_Pos; /* XY coordinates of NoConnect. */
public: public:
DrawNoConnectStruct( const wxPoint &pos ); DrawNoConnectStruct( const wxPoint& pos );
~DrawNoConnectStruct() { } ~DrawNoConnectStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawNoConnectStruct" );
}
DrawNoConnectStruct* GenCopy(); DrawNoConnectStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
...@@ -122,7 +141,7 @@ public: ...@@ -122,7 +141,7 @@ public:
/** /**
* Class DrawBusEntryStruct * Class DrawBusEntryStruct
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE * Struct de descr 1 raccord a 45 degres de BUS ou WIRE
*/ */
class DrawBusEntryStruct : public EDA_BaseStruct class DrawBusEntryStruct : public EDA_BaseStruct
{ {
...@@ -133,15 +152,21 @@ public: ...@@ -133,15 +152,21 @@ public:
wxSize m_Size; wxSize m_Size;
public: public:
DrawBusEntryStruct( const wxPoint &pos, int shape, int id ); DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
~DrawBusEntryStruct() { } ~DrawBusEntryStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawBusEntryStruct" );
}
DrawBusEntryStruct* GenCopy(); DrawBusEntryStruct* GenCopy();
wxPoint m_End(); // retourne la coord de fin du raccord wxPoint m_End(); // retourne la coord de fin du raccord
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
class DrawPolylineStruct : public EDA_BaseStruct/* Polyligne (serie de segments) */ class DrawPolylineStruct : public EDA_BaseStruct /* Polyligne (serie de segments) */
{ {
public: public:
int m_Layer; int m_Layer;
...@@ -152,6 +177,12 @@ public: ...@@ -152,6 +177,12 @@ public:
public: public:
DrawPolylineStruct( int layer ); DrawPolylineStruct( int layer );
~DrawPolylineStruct(); ~DrawPolylineStruct();
virtual wxString GetClass() const
{
return wxT( "DrawPolylineStruct" );
}
DrawPolylineStruct* GenCopy(); DrawPolylineStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
...@@ -164,15 +195,22 @@ public: ...@@ -164,15 +195,22 @@ public:
wxPoint m_Pos; /* XY coordinates of connection. */ wxPoint m_Pos; /* XY coordinates of connection. */
public: public:
DrawJunctionStruct( const wxPoint &pos ); DrawJunctionStruct( const wxPoint& pos );
~DrawJunctionStruct() { } ~DrawJunctionStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawJunctionStruct" );
}
DrawJunctionStruct* GenCopy(); DrawJunctionStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct class DrawTextStruct : public EDA_BaseStruct
, public EDA_TextStruct
{ {
public: public:
int m_Layer; int m_Layer;
...@@ -180,29 +218,23 @@ public: ...@@ -180,29 +218,23 @@ public:
bool m_IsDangling; // TRUE si non connect bool m_IsDangling; // TRUE si non connect
public: public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString, DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE ); KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
~DrawTextStruct() { } ~DrawTextStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawTextStruct" );
}
DrawTextStruct* GenCopy(); DrawTextStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
void SwapData( DrawTextStruct* copyitem ); void SwapData( DrawTextStruct* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
// selectively give public access to a very dangerous protected function: virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
void SetType( KICAD_T aType ) { EDA_BaseStruct::SetType( aType ); }
private:
void DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color );
void DrawAsLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color );
void DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color );
}; };
...@@ -211,15 +243,29 @@ class DrawLabelStruct : public DrawTextStruct ...@@ -211,15 +243,29 @@ class DrawLabelStruct : public DrawTextStruct
public: public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~DrawLabelStruct() { } ~DrawLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawLabelStruct" );
}
}; };
class DrawGlobalLabelStruct : public DrawTextStruct class DrawGlobalLabelStruct : public DrawTextStruct
{ {
public: public:
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~DrawGlobalLabelStruct() { } ~DrawGlobalLabelStruct() { }
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
virtual wxString GetClass() const
{
return wxT( "DrawGlobalLabelStruct" );
}
}; };
......
...@@ -230,13 +230,11 @@ LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame, ...@@ -230,13 +230,11 @@ LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
LibEDA_BaseStruct* DrawItem ) LibEDA_BaseStruct* DrawItem )
/**********************************************************/ /**********************************************************/
/* Routine de Duplication d'une structure DrawLibItem d'une partlib /* Duplicate a DrawLibItem
* Parametres d'entree: * the new item is only created, it is not put in the current component linked list
* DrawEntry = pointeur sur la structure a dupliquer * @param DrawEntry = DrawLibItem * item to duplicate
* La structure nouvelle est creee, mais n'est pas inseree dans le * @return a pointer to the new item
* chainage * A better way to duplicate a DrawLibItem is to have a virtual GenCopy() in LibEDA_BaseStruct class (ToDo).
* Retourne:
* Pointeur sur la structure creee
*/ */
{ {
LibEDA_BaseStruct* NewDrawItem = NULL; LibEDA_BaseStruct* NewDrawItem = NULL;
...@@ -345,12 +343,9 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr ...@@ -345,12 +343,9 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
LastItem = NewDrawings; LastItem = NewDrawings;
NewDrawings->Pnext = NULL; NewDrawings->Pnext = NULL;
} }
else // Probleme rencontr: arret de copie else // Should nevers occurs, just in case...
{ { // CopyDrawEntryStruct() was not able to duplicate the type of OldDrawings
/* why this? m_StructType is not a flag, it is a type indicator! // occurs when an unexpected type is encountered
OldDrawings->Type() = TYPE_NOT_INIT;
*/
DisplayError( frame, wxT( "CopyLibEntryStruct(): error: aborted" ) ); DisplayError( frame, wxT( "CopyLibEntryStruct(): error: aborted" ) );
break; break;
} }
......
...@@ -304,7 +304,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC ) ...@@ -304,7 +304,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
/************************************************/ /************************************************/
/* /*
* routine de deplacement des elements du block deja selectionne * Function to move items in the current selected block
*/ */
{ {
int deltaX, deltaY; int deltaX, deltaY;
...@@ -322,36 +322,35 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC ) ...@@ -322,36 +322,35 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
deltaX = GetScreen()->BlockLocate.m_MoveVector.x; deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
deltaY = GetScreen()->BlockLocate.m_MoveVector.y; deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
/* Deplacement des Segments de piste */ /* Move the Track segments in block */
TRACK* track; TRACK* track = m_Pcb->m_Track;
track = m_Pcb->m_Track;
while( track ) while( track )
{ {
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ /* la piste est ici bonne a etre deplacee */ {
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
track->Draw( DrawPanel, DC, GR_XOR ); // effacement track->Draw( DrawPanel, DC, GR_XOR ); // erase the display
track->m_Start.x += deltaX; track->m_Start.y += deltaY; track->m_Start.x += deltaX; track->m_Start.y += deltaY;
track->m_End.x += deltaX; track->m_End.y += deltaY; track->m_End.x += deltaX; track->m_End.y += deltaY;
track->m_Param += deltaX; track->m_Sous_Netcode += deltaY; track->m_Param += deltaX; track->m_Sous_Netcode += deltaY;
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage track->Draw( DrawPanel, DC, GR_OR ); // redraw the moved track
} }
track = (TRACK*) track->Pnext; track = track->Next();
} }
/* Deplacement des Segments de Zone */ /* Move the Zone segments in block */
track = (TRACK*) m_Pcb->m_Zone; SEGZONE * zsegment= m_Pcb->m_Zone;
while( track ) while( zsegment )
{ {
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ /* la piste est ici bonne a etre deplacee */ {
track->Draw( DrawPanel, DC, GR_XOR ); // effacement zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display
track->m_Start.x += deltaX; track->m_Start.y += deltaY; zsegment->m_Start.x += deltaX; track->m_Start.y += deltaY;
track->m_End.x += deltaX; track->m_End.y += deltaY; zsegment->m_End.x += deltaX; track->m_End.y += deltaY;
track->m_Param += deltaX; track->m_Sous_Netcode += deltaY; zsegment->m_Param += deltaX; track->m_Sous_Netcode += deltaY;
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment
} }
track = (TRACK*) track->Pnext; zsegment = zsegment->Next();
} }
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
...@@ -363,10 +362,10 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC ) ...@@ -363,10 +362,10 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
/**************************************************/ /**************************************************/
/* /*
* routine de duplication des elements du block deja selectionne * Function to duplicate items in the current selected block
*/ */
{ {
int deltaX, deltaY; wxPoint delta;
wxPoint oldpos; wxPoint oldpos;
oldpos = GetScreen()->m_Curseur; oldpos = GetScreen()->m_Curseur;
...@@ -379,58 +378,45 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC ) ...@@ -379,58 +378,45 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
/* calcul du vecteur de deplacement pour les deplacements suivants */ /* calcul du vecteur de deplacement pour les deplacements suivants */
deltaX = GetScreen()->BlockLocate.m_MoveVector.x; delta = GetScreen()->BlockLocate.m_MoveVector;
deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
/* Deplacement des Segments de piste */ /* Copy selected track segments and move the new track its new location */
TRACK* track, * next_track, * new_track; TRACK* track = m_Pcb->m_Track;
track = m_Pcb->m_Track;
while( track ) while( track )
{ {
next_track = track->Next(); TRACK* next_track = track->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ {
/* la piste est ici bonne a etre deplacee */ /* this track segment must be duplicated */
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
new_track = track->Copy(); TRACK* new_track = track->Copy();
new_track->Insert( m_Pcb, NULL ); new_track->Insert( m_Pcb, NULL );
new_track->m_Start.x += deltaX; new_track->m_Start += delta;
new_track->m_Start.y += deltaY; new_track->m_End += delta;
new_track->m_End.x += deltaX;
new_track->m_End.y += deltaY;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage new_track->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment
} }
track = next_track; track = next_track;
} }
/* Deplacement des Segments de Zone */ /* Copy the Zone segments and move the new segment to its new location */
track = (TRACK*) m_Pcb->m_Zone; SEGZONE * zsegment= m_Pcb->m_Zone;
while( track ) while( zsegment )
{ {
next_track = track->Next(); SEGZONE * next_zsegment = zsegment->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) ) if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ {
/* la piste est ici bonne a etre deplacee */ /* this zone segment must be duplicated */
// @todo: bug? memory leak at this point: SEGZONE * new_zsegment = (SEGZONE*) zsegment->Copy();
new_track = new TRACK( m_Pcb ); new_zsegment->Insert( m_Pcb, NULL );
new_track = track->Copy();
new_track->Insert( m_Pcb, NULL ); new_zsegment->m_Start += delta;
new_zsegment->m_End += delta;
new_track->m_Start.x += deltaX;
new_track->m_Start.y += deltaY;
new_track->m_End.x += deltaX; new_zsegment->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment
new_track->m_End.y += deltaY;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
} }
track = next_track; zsegment = next_zsegment;
} }
} }
......
...@@ -168,20 +168,6 @@ private: ...@@ -168,20 +168,6 @@ private:
private: private:
void InitVars(); void InitVars();
protected:
/**
* Function SetType
* is dangerous and should not be used. It is here to work around a design
* issue in the DrawTextStruct -> DrawLabelStruct and
* DrawTextStruct -> DrawGlobalLabelStruct class hierarchy of eeschema.
* Only constructors should set m_StructType and once set, there should be
* no reason to change an object's type. For if you do, you risk mis-matching
* the virtual functions of the object with its Type() function, because the
* virtual function table is set in the call to a constructor and cannot be
* changed later without doing an "in place constructor" call (ugly and dangerous).
*/
void SetType( KICAD_T aType ) { m_StructType = aType; }
public: public:
...@@ -211,8 +197,6 @@ public: ...@@ -211,8 +197,6 @@ public:
m_Status = new_status; m_Status = new_status;
} }
wxString ReturnClassName() const;
/* addition d'une nouvelle struct a la liste chain� */ /* addition d'une nouvelle struct a la liste chain� */
void AddToChain( EDA_BaseStruct* laststruct ); void AddToChain( EDA_BaseStruct* laststruct );
...@@ -288,8 +272,6 @@ public: ...@@ -288,8 +272,6 @@ public:
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -297,15 +279,12 @@ public: ...@@ -297,15 +279,12 @@ public:
*/ */
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
// ReturnClassName() is too hard to maintain, coordinating the array return wxT("EDA_BaseStruct");
// with the enum. It would be nice to migrate to virtual GetClass()
// away from ReturnClassName(). Over time, derived classes should
// simply return a wxString from their virtual GetClass() function.
// Some classes do that now.
return ReturnClassName();
} }
#if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
#include "../bitmaps/down.xpm" #include "../bitmaps/down.xpm"
#include "../bitmaps/File_FootPrint.xpm" #include "../bitmaps/File_FootPrint.xpm"
#include "../bitmaps/Footprint_Text.xpm"
#include "../bitmaps/Options_Pad.xpm" #include "../bitmaps/Options_Pad.xpm"
#include "../bitmaps/Options_New_Pad.xpm" #include "../bitmaps/Options_New_Pad.xpm"
......
...@@ -304,7 +304,6 @@ public: ...@@ -304,7 +304,6 @@ public:
} }
#if defined (DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -314,7 +313,6 @@ public: ...@@ -314,7 +313,6 @@ public:
{ {
return wxT( "BASE_SCREEN" ); return wxT( "BASE_SCREEN" );
} }
#endif
}; };
......
...@@ -216,7 +216,7 @@ public: ...@@ -216,7 +216,7 @@ public:
MODULE* m_Modules; // linked list of MODULEs MODULE* m_Modules; // linked list of MODULEs
EQUIPOT* m_Equipots; // linked list of nets EQUIPOT* m_Equipots; // linked list of nets
TRACK* m_Track; // linked list of TRACKs and SEGVIAs TRACK* m_Track; // linked list of TRACKs and SEGVIAs
TRACK* m_Zone; // linked list of SEGZONEs SEGZONE* m_Zone; // linked list of SEGZONEs
D_PAD** m_Pads; // pointeur liste d'acces aux pads D_PAD** m_Pads; // pointeur liste d'acces aux pads
int m_NbPads; // nombre total de pads int m_NbPads; // nombre total de pads
CHEVELU* m_Ratsnest; // pointeur liste des chevelus CHEVELU* m_Ratsnest; // pointeur liste des chevelus
...@@ -290,7 +290,6 @@ public: ...@@ -290,7 +290,6 @@ public:
EQUIPOT* FindNet( int aNetcode ); EQUIPOT* FindNet( int aNetcode );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -301,6 +300,7 @@ public: ...@@ -301,6 +300,7 @@ public:
return wxT( "BOARD" ); return wxT( "BOARD" );
} }
#if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
...@@ -398,7 +398,6 @@ public: ...@@ -398,7 +398,6 @@ public:
*/ */
bool HitTest( const wxPoint& ref_pos ); bool HitTest( const wxPoint& ref_pos );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -406,10 +405,8 @@ public: ...@@ -406,10 +405,8 @@ public:
*/ */
wxString GetClass() const wxString GetClass() const
{ {
return wxT("pgraphic"); return wxT("DRAWSEGMENT");
} }
#endif
}; };
......
...@@ -383,7 +383,17 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, ...@@ -383,7 +383,17 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
#if 0 // both these are on same list, so we must scan it twice in order to get VIA priority, #if 0 // both these are on same list, so we must scan it twice in order to get VIA priority,
// using new #else code below. // using new #else code below.
// @todo: consider why we are not using separte lists for TRACKs and SEGVIAs. // But we are not using separte lists for TRACKs and SEGVIAs, because items are ordered (sortered) in the linked
// list by netcode AND by physical distance:
// when created, if a track or via is connected to an existing track or via, it is put in linked list
// after this existing track or via
// So usually, connected tracks or vias are grouped in this list
// So the algorithm (used in rastnest computations) which computes the track connectivity is faster (more than 100 time regarding to
// a non ordered list) because when it searchs for a connexion, first it tests the near (near in term of linked list) 50 items
// from the current item (track or via) in test.
// Usually, because of this sort, a connected item (if exists) is found.
// If not found (and only in this case) an exhaustive (and time consumming) search is made,
// but this case is statistically rare.
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
result = IterateForward( m_Track, inspector, testData, p ); result = IterateForward( m_Track, inspector, testData, p );
......
...@@ -60,7 +60,6 @@ public: ...@@ -60,7 +60,6 @@ public:
bool HitTest( const wxPoint& ref_pos ); bool HitTest( const wxPoint& ref_pos );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -70,7 +69,6 @@ public: ...@@ -70,7 +69,6 @@ public:
{ {
return wxT( "DIMENSION" ); return wxT( "DIMENSION" );
} }
#endif
}; };
#endif // #define COTATION_H #endif // #define COTATION_H
...@@ -65,7 +65,6 @@ public: ...@@ -65,7 +65,6 @@ public:
*/ */
bool HitTest( const wxPoint& refPos ); bool HitTest( const wxPoint& refPos );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -77,6 +76,7 @@ public: ...@@ -77,6 +76,7 @@ public:
// return wxT( "EDGE" ); ? // return wxT( "EDGE" ); ?
} }
#if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
...@@ -33,7 +33,6 @@ public: ...@@ -33,7 +33,6 @@ public:
int WriteEquipotDescr( FILE* File ); int WriteEquipotDescr( FILE* File );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -45,6 +44,7 @@ public: ...@@ -45,6 +44,7 @@ public:
} }
#if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
...@@ -175,7 +175,6 @@ public: ...@@ -175,7 +175,6 @@ public:
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -187,7 +186,8 @@ public: ...@@ -187,7 +186,8 @@ public:
} }
/** #if defined(DEBUG)
/**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
......
...@@ -117,8 +117,6 @@ public: ...@@ -117,8 +117,6 @@ public:
*/ */
bool HitTest( const wxPoint& refPos ); bool HitTest( const wxPoint& refPos );
#if defined (DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -129,7 +127,7 @@ public: ...@@ -129,7 +127,7 @@ public:
return wxT( "PAD" ); return wxT( "PAD" );
} }
#if defined (DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
...@@ -49,7 +49,6 @@ public: ...@@ -49,7 +49,6 @@ public:
} }
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -60,6 +59,7 @@ public: ...@@ -60,6 +59,7 @@ public:
return wxT("PTEXT"); return wxT("PTEXT");
} }
#if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
...@@ -99,7 +99,6 @@ public: ...@@ -99,7 +99,6 @@ public:
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -110,6 +109,7 @@ public: ...@@ -110,6 +109,7 @@ public:
return wxT( "MTEXT" ); return wxT( "MTEXT" );
} }
#if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
...@@ -298,7 +298,7 @@ void TRACK::UnLink() ...@@ -298,7 +298,7 @@ void TRACK::UnLink()
{ {
if( Type() == TYPEZONE ) if( Type() == TYPEZONE )
{ {
( (BOARD*) Pback )->m_Zone = (TRACK*) Pnext; ( (BOARD*) Pback )->m_Zone = (SEGZONE*) Pnext;
} }
else else
{ {
...@@ -331,7 +331,7 @@ void TRACK::Insert( BOARD* Pcb, BOARD_ITEM* InsertPoint ) ...@@ -331,7 +331,7 @@ void TRACK::Insert( BOARD* Pcb, BOARD_ITEM* InsertPoint )
if( Type() == TYPEZONE ) // put SEGZONE on front of m_Zone list if( Type() == TYPEZONE ) // put SEGZONE on front of m_Zone list
{ {
NextS = Pcb->m_Zone; NextS = Pcb->m_Zone;
Pcb->m_Zone = this; Pcb->m_Zone = (SEGZONE*)this;
} }
else // put TRACK or SEGVIA on front of m_Track list else // put TRACK or SEGVIA on front of m_Track list
......
...@@ -134,7 +134,6 @@ public: ...@@ -134,7 +134,6 @@ public:
*/ */
bool HitTest( const wxPoint& refPos ); bool HitTest( const wxPoint& refPos );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -154,8 +153,6 @@ public: ...@@ -154,8 +153,6 @@ public:
*/ */
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif
}; };
...@@ -164,7 +161,6 @@ class SEGZONE : public TRACK ...@@ -164,7 +161,6 @@ class SEGZONE : public TRACK
public: public:
SEGZONE( BOARD_ITEM* StructFather ); SEGZONE( BOARD_ITEM* StructFather );
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -174,8 +170,9 @@ public: ...@@ -174,8 +170,9 @@ public:
{ {
return wxT("ZONE"); return wxT("ZONE");
} }
#endif
SEGZONE* Next() const { return (SEGZONE*) Pnext; }
}; };
...@@ -203,7 +200,6 @@ public: ...@@ -203,7 +200,6 @@ public:
void SetLayerPair( int top_layer, int bottom_layer ); void SetLayerPair( int top_layer, int bottom_layer );
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const; void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
#if defined(DEBUG)
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
...@@ -213,8 +209,6 @@ public: ...@@ -213,8 +209,6 @@ public:
{ {
return wxT("VIA"); return wxT("VIA");
} }
#endif
}; };
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "collectors.h" #include "collectors.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "Footprint_Text.xpm"
#include "add_cotation.xpm" #include "add_cotation.xpm"
#include "Add_Mires.xpm" #include "Add_Mires.xpm"
#include "Add_Zone.xpm" #include "Add_Zone.xpm"
...@@ -206,7 +205,7 @@ wxString BOARD_ITEM::MenuText() const ...@@ -206,7 +205,7 @@ wxString BOARD_ITEM::MenuText() const
break; break;
default: default:
text << item->ReturnClassName() << wxT(" BUG!!"); text << item->GetClass() << wxT(" Unexpected item type: BUG!!");
break; break;
} }
......
/******************************************************/ /******************************************************/
/* Edition des contours d'un module: Routines */ /* Edition of footprint edges */
/* d'effacement et d'edition de segments et contours */
/* appartenant aux modules */
/******************************************************/ /******************************************************/
/* fichier edgemod.cpp */ /* fichier edgemod.cpp */
/* Routines d'edition des contours d'un module. /* Functions to edit graphic items used to draw footprint edges.
* La correction des Arcs de cercle n'est pas traitee ( mais * Function to Arcs are not made (TODO..) but menus are ready to use
* les menus en routines sont prevus
*/ */
#include "fctsys.h" #include "fctsys.h"
...@@ -37,7 +34,7 @@ static wxPoint CursorInitialPosition; // Mouse cursor inital position for move ...@@ -37,7 +34,7 @@ static wxPoint CursorInitialPosition; // Mouse cursor inital position for move
void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
/****************************************************************************/ /****************************************************************************/
/* Routine de preparation du deplacement d'un element graphique type DRAWSEGMENT /* Function to initialise the move function params of a graphic item type DRAWSEGMENT
*/ */
{ {
if( Edge == NULL ) if( Edge == NULL )
...@@ -58,7 +55,7 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -58,7 +55,7 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
/*********************************************************************/ /*********************************************************************/
/* /*
* Routine de placement de l'element graphique type EDGE_MODULE en cours de deplacement * Function to place a graphic item type EDGE_MODULE currently moved
*/ */
{ {
if( Edge == NULL ) if( Edge == NULL )
...@@ -87,7 +84,7 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -87,7 +84,7 @@ void WinEDA_ModuleEditFrame::Place_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
/************************************************************************/ /************************************************************************/
static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/************************************************************************/ /************************************************************************/
/* redessin du contour du Segment Edge lors des deplacements de la souris */ /* Move and redraw the current edited graphic item when mouse is moving */
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem(); EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
...@@ -115,7 +112,7 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -115,7 +112,7 @@ static void Move_Segment( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/************************************************************************/ /************************************************************************/
/* Affiche le segment Edge Module en cours de trace /* Redraw the current edited (moved) graphic item
*/ */
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
...@@ -149,8 +146,12 @@ static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -149,8 +146,12 @@ static void ShowEdgeModule( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC )
/***************************************************************************/ /***************************************************************************/
/* change la largeur du EDGE_MODULE Edge, ou de tous si Edge == NULL /* Change the EDGE_MODULE Edge width,
*/ * if Edge == NULL change the width of the entire footprint edges
* @param ModuleSegmentWidth (global) = new width
* @param Edge = edge to edit, or NULL
* @param DC = current Device Context
*/
{ {
MODULE* Module = m_Pcb->m_Modules; MODULE* Module = m_Pcb->m_Modules;
...@@ -180,17 +181,30 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -180,17 +181,30 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC )
void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
/***************************************************************************/ /***************************************************************************/
/* change la couche du EDGE_MODULE Edge, ou de tous si Edge == NULL /* Change the EDGE_MODULE Edge layer, (The new layer will be asked)
*/ * if Edge == NULL change the layer of the entire footprint edges
* @param Edge = edge to edit, or NULL
* @param DC = current Device Context
*/
{ {
MODULE* Module = m_Pcb->m_Modules; MODULE* Module = m_Pcb->m_Modules;
int new_layer = SILKSCREEN_N_CMP; int new_layer = SILKSCREEN_N_CMP;
if( Edge != NULL )
new_layer = Edge->GetLayer();
new_layer = SelectLayer( SILKSCREEN_N_CMP, LAYER_CUIVRE_N, LAST_NO_COPPER_LAYER ); /* Ask for the new layer */
new_layer = SelectLayer( new_layer, LAYER_CUIVRE_N, LAST_NO_COPPER_LAYER );
if( new_layer < 0 ) if( new_layer < 0 )
return; return;
if ( new_layer >= LAYER_CUIVRE_N && new_layer <= LAYER_CMP_N )
/* an edge is put on a copper layer, and it is very dangerous. a confirmation is requested */
{
if ( ! IsOK(this, _("The graphic item will be on a copper layer.It is very dangerous. Are you sure") ) )
return;
}
SaveCopyInUndoList( Module ); SaveCopyInUndoList( Module );
if( Edge == NULL ) if( Edge == NULL )
...@@ -217,9 +231,12 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -217,9 +231,12 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC )
/*************************************************************************/ /*************************************************************************/
/* /* Edition of the edge items width
* Entre la nouvelle valeur pour ModuleSegmentWidth. * Ask for a new width and init ModuleSegmentWidth.
* change la largeur du EDGE_MODULE Edge si Edge != NULL * Change the width of EDGE_MODULE Edge if Edge != NULL
* @param Edge = edge to edit, or NULL
* @param DC = current Device Context
* @output ModuleSegmentWidth (global) = new width
*/ */
{ {
wxString buffer; wxString buffer;
...@@ -251,6 +268,11 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -251,6 +268,11 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC )
/****************************************************************************/ /****************************************************************************/
void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
/****************************************************************************/ /****************************************************************************/
/* Edition of the edge items width
* delete EDGE_MODULE Edge if Edge != NULL
* @param Edge = edge to edit, or NULL
* @param DC = current Device Context
*/
{ {
if( Edge == NULL ) if( Edge == NULL )
return; return;
...@@ -274,6 +296,8 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -274,6 +296,8 @@ void WinEDA_ModuleEditFrame::Delete_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
/******************************************************************/ /******************************************************************/
static void Exit_EditEdge_Module( WinEDA_DrawPanel* Panel, wxDC* DC ) static void Exit_EditEdge_Module( WinEDA_DrawPanel* Panel, wxDC* DC )
/******************************************************************/ /******************************************************************/
/* abort function in moving edge.
*/
{ {
EDGE_MODULE* Edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem(); EDGE_MODULE* Edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
...@@ -304,10 +328,11 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -304,10 +328,11 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
wxDC* DC, int type_edge ) wxDC* DC, int type_edge )
/*************************************************************************/ /*************************************************************************/
/* Fonction de debut de trace d'un nouveau contour. /* Create a new edge item (line, arc ..).
* - Cree la place en memoire du nouveau contour * @param Edge = if NULL: create new edge else terminate edge and create a new edge
* - Prepare les coord des differents points * @param DC = current Device Context
* - Met a jour la variable type_edge (= S_SEGMENT,S_ARC ...) * @param type_edge = S_SEGMENT,S_ARC ..
* @return the new created edge.
*/ */
{ {
MODULE* Module = m_Pcb->m_Modules; MODULE* Module = m_Pcb->m_Modules;
...@@ -316,13 +341,13 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -316,13 +341,13 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
if( Module == NULL ) if( Module == NULL )
return NULL; return NULL;
if( Edge == NULL ) /* debut reel du trace */ if( Edge == NULL ) /* Start a new edge item */
{ {
SaveCopyInUndoList( Module ); SaveCopyInUndoList( Module );
Edge = new EDGE_MODULE( Module ); Edge = new EDGE_MODULE( Module );
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
/* Chainage du nouvel element, en tete de liste Drawings */ /* Add the new item to the Drawings list head*/
Edge->Pback = Module; Edge->Pback = Module;
Edge->Pnext = Module->m_Drawings; Edge->Pnext = Module->m_Drawings;
if( Module->m_Drawings ) if( Module->m_Drawings )
...@@ -341,12 +366,12 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -341,12 +366,12 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->SetLayer( SILKSCREEN_N_CMP ); Edge->SetLayer( SILKSCREEN_N_CMP );
if( Module->GetLayer() == CUIVRE_N ) if( Module->GetLayer() == CUIVRE_N )
Edge->SetLayer( SILKSCREEN_N_CU ); Edge->SetLayer( SILKSCREEN_N_CU );
/* Mise a jour du point de depart du segment ou de l'arc */ /* Initialise the starting point of the new segment or arc */
Edge->m_Start = GetScreen()->m_Curseur; Edge->m_Start = GetScreen()->m_Curseur;
/* Mise a jour de la fin du segment , rectangle ou de l'arc*/ /* Initialise the ending point of the new segment or arc */
Edge->m_End = Edge->m_Start; Edge->m_End = Edge->m_Start;
/* Mise a jour des coord relatives */ /* Initialise the relative coordinates */
Edge->m_Start0.x = Edge->m_Start.x - Module->m_Pos.x; Edge->m_Start0.x = Edge->m_Start.x - Module->m_Pos.x;
Edge->m_Start0.y = Edge->m_Start.y - Module->m_Pos.y; Edge->m_Start0.y = Edge->m_Start.y - Module->m_Pos.y;
RotatePoint( (int*) &(Edge->m_Start0.x), RotatePoint( (int*) &(Edge->m_Start0.x),
...@@ -399,10 +424,12 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -399,10 +424,12 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
/*************************************************************************/ /*************************************************************************/
void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ) void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC )
/*************************************************************************/ /*************************************************************************/
/* Terminate a move or create edge function
*/
{ {
MODULE* Module = m_Pcb->m_Modules; MODULE* Module = m_Pcb->m_Modules;
/* test du dernier segment: si null: suppression */ /* If last segment length is 0: deletion */
if( Edge ) if( Edge )
{ {
if( (Edge->m_Start.x == Edge->m_End.x) if( (Edge->m_Start.x == Edge->m_End.x)
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#include "Width_Net.xpm" #include "Width_Net.xpm"
#include "Width_Track_Via.xpm" #include "Width_Track_Via.xpm"
#include "Select_Layer_Pair.xpm" #include "Select_Layer_Pair.xpm"
#include "Footprint_Text.xpm"
#include "Flag.xpm" #include "Flag.xpm"
......
...@@ -56,14 +56,15 @@ EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer ) ...@@ -56,14 +56,15 @@ EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer )
END_EVENT_TABLE() END_EVENT_TABLE()
/***********************************************************************************/ /****************************************************************************************/
int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_layer ) int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_layer )
/***********************************************************************************/ /****************************************************************************************/
/* Install the dialog box for layer selection /* Install the dialog box for layer selection
* default_layer = Preselection * @param default_layer = Preselection
* min_layer = val min de layer selectionnable (-1 si pas de val mini) * @param min_layer = min layer value (-1 if no min value)
* max_layer = val max de layer selectionnable (-1 si pas de val maxi) * @param max_layer = max layer value (-1 si no max value)
* @return new layer value, or <0 if aborted
*/ */
{ {
int layer; int layer;
...@@ -92,7 +93,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, ...@@ -92,7 +93,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
m_Parent = parent; m_Parent = parent;
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
/* Construction de la liste des couches autoris�s */ /* Build the layer list */
LayerCount = 0; LayerCount = 0;
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1]; int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
Masque_Layer += ALL_NO_CU_LAYERS; Masque_Layer += ALL_NO_CU_LAYERS;
......
...@@ -2,13 +2,6 @@ ...@@ -2,13 +2,6 @@
Here are some source code maintenance tasks that need to be done, and maybe some Here are some source code maintenance tasks that need to be done, and maybe some
folks will see these items and volunteer to do them. folks will see these items and volunteer to do them.
*** Look at gerbview/block.cpp for text:
// @todo: bug? memory leak at this point: about line 418
this definitely looks like a memory leak.
*** footprint_text_xpm is included more than once into the link image of pcbnew.
*** @todo: grep for @todo and finish off those tasks. *** @todo: grep for @todo and finish off those tasks.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment