Commit d1effbf4 authored by CHARRAS's avatar CHARRAS

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

parent 2f3aeeaa
/* XPM */
static char * footprint_text_xpm[] = {
"16 16 4 1",
" c None",
". c #009B9B",
"+ c #007070",
"@ c #005050",
" .............. ",
" .............. ",
" .+ .... +. ",
" .@ .... . ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .....+ ",
" ........ ",
" "};
/* XPM */
#ifndef XPMMAIN
extern char *footprint_text_xpm[];
#else
char * footprint_text_xpm[] = {
"16 16 4 1",
" c None",
". c #009B9B",
"+ c #007070",
"@ c #005050",
" .............. ",
" .............. ",
" .+ .... +. ",
" .@ .... . ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .... ",
" .....+ ",
" ........ ",
" "};
#endif
......@@ -4,6 +4,17 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
......
......@@ -16,58 +16,6 @@
#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 {
ID_TEXTBOX_LIST = 8010
};
......@@ -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;
......@@ -152,7 +100,7 @@ void EDA_BaseStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
msg.Printf( wxT(
"EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ),
Type() );
msg += ReturnClassName() + wxT( ")\n" );
msg += GetClass() + wxT( ")\n" );
printf( CONV_TO_UTF8( msg ) );
}
......@@ -170,25 +118,6 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
#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
SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
INSPECTOR* inspector, const void* testData, const KICAD_T scanTypes[] )
......@@ -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 )
{
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; /* XY size of font */
......
......@@ -1350,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
{
wxString msg;
msg << wxT( "DuplicateStruct error: unexpected StructType " ) <<
DrawStruct->Type() << wxT( " " ) << DrawStruct->ReturnClassName();
DrawStruct->Type() << wxT( " " ) << DrawStruct->GetClass();
DisplayError( NULL, msg );
}
break;
......
......@@ -90,6 +90,11 @@ class SCH_SCREEN : public BASE_SCREEN
public:
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
~SCH_SCREEN();
virtual wxString GetClass() const
{
return wxT("SCH_SCREEN");
}
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
......@@ -120,6 +125,11 @@ public:
const wxString& text = wxEmptyString );
~DrawSheetLabelStruct() { }
virtual wxString GetClass() const
{
return wxT("DrawSheetLabelStruct");
}
DrawSheetLabelStruct* GenCopy();
DrawSheetLabelStruct* Next()
......@@ -148,6 +158,11 @@ public:
public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~DrawSheetStruct();
virtual wxString GetClass() const
{
return wxT("DrawSheetStruct");
}
void Place( WinEDA_DrawFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy();
void Display_Infos( WinEDA_DrawFrame* frame );
......
......@@ -41,7 +41,8 @@ DrawTextStruct* DrawTextStruct::GenCopy()
switch( Type() )
{
case DRAW_TEXT_STRUCT_TYPE:
default:
case DRAW_TEXT_STRUCT_TYPE:
newitem = new DrawTextStruct( m_Pos, m_Text );
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
......@@ -50,8 +51,6 @@ DrawTextStruct* DrawTextStruct::GenCopy()
case DRAW_LABEL_STRUCT_TYPE:
newitem = new DrawLabelStruct( m_Pos, m_Text );
break;
default:
newitem = 0; // will crash below
}
newitem->m_Layer = m_Layer;
......@@ -78,13 +77,6 @@ void DrawTextStruct::SwapData( DrawTextStruct* copyitem )
EXCHG( m_Shape, copyitem->m_Shape );
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_HJustify, copyitem->m_HJustify );
EXCHG( m_VJustify, copyitem->m_VJustify );
......@@ -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 )
/*******************************************************************************************/
/* Texts type Label or Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
/* Texts type Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
*/
{
int color;
......@@ -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 )
/***************************************************************/
/*********************************************************************************************/
{
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 )
/*****************************************************************************/
/******************************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/
{
int* Template;
int Poly[12];
int Poly[20];
int ii, jj, imax, color, HalfSize;
wxSize Size = m_Size;
int width = MAX( m_Width, g_DrawMinimunLineWidth );
......@@ -291,8 +257,7 @@ void DrawTextStruct::DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const
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 ); /* Polygne Non Rempli */
GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color );
if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
......
......@@ -47,6 +47,11 @@ public:
public:
PartTextStruct(const wxPoint & pos = wxPoint(0,0), const wxString & text = wxEmptyString);
~PartTextStruct(void);
virtual wxString GetClass() const
{
return wxT("PartTextStruct");
}
void PartTextCopy(PartTextStruct * target);
void Place(WinEDA_DrawFrame * frame, wxDC * DC);
......@@ -72,6 +77,11 @@ public:
public:
DrawPartStruct( KICAD_T struct_type, const wxPoint & pos);
~DrawPartStruct(void);
virtual wxString GetClass() const
{
return wxT("DrawPartStruct");
}
};
......@@ -89,6 +99,11 @@ public:
public:
EDA_SchComponentStruct(const wxPoint & pos = wxPoint(0,0));
~EDA_SchComponentStruct(void){}
virtual wxString GetClass() const
{
return wxT("EDA_SchComponentStruct");
}
EDA_SchComponentStruct * GenCopy(void);
void SetRotationMiroir( int type );
int GetRotationMiroir(void);
......
......@@ -49,7 +49,7 @@
/* Structures pour memo et liste des elements */
typedef struct ListLabel
{
int m_StructType;
int m_LabelType;
void * m_Label;
int m_SheetNumber;
} ListLabel;
......@@ -691,7 +691,7 @@ BASE_SCREEN * screen;
ItemCount++;
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_Label = DrawList;
List++;
......@@ -706,7 +706,7 @@ BASE_SCREEN * screen;
{
if ( List )
{
List->m_StructType = DRAW_SHEETLABEL_STRUCT_TYPE;
List->m_LabelType = DRAW_SHEETLABEL_STRUCT_TYPE;
List->m_SheetNumber = screen->m_SheetNumber;
List->m_Label = SheetLabel;
List++;
......@@ -814,12 +814,12 @@ static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2)
int ii;
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;
else
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;
else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text;
......@@ -850,12 +850,12 @@ const wxString * Text1, *Text2;
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;
else
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;
else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text;
......@@ -1092,7 +1092,7 @@ wxString msg;
{
LabelItem = & List[ii];
switch( LabelItem->m_StructType )
switch( LabelItem->m_LabelType )
{
case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label);
......
/**************************************************************************/
/* EESchema */
/* editexte.cpp: creation/ editions des textes (labels, textes sur schema) */
/**************************************************************************/
/*********************************************************************/
/* EESchema */
/* edit_label.cpp: label, global label and text creation or edition */
/*********************************************************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -103,6 +103,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
GetScreen()->SetModify();
DrawPanel->ManageCurseur = ShowWhileMoving;
DrawPanel->ForceCloseManageCurseur = ExitMoveTexte;
GetScreen()->SetCurItem( TextStruct );
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
DrawPanel->CursorOn( DC );
......@@ -158,8 +159,8 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_TEXT_STRUCT_TYPE:
( (DrawTextStruct*) TextStruct )->m_Orient++;
( (DrawTextStruct*) TextStruct )->m_Orient &= 3;
TextStruct->m_Orient++;
TextStruct->m_Orient &= 3;
break;
default:
......@@ -189,27 +190,25 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
{
case LAYER_NOTES:
NewText = new DrawTextStruct( m_CurrentScreen->m_Curseur );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
break;
case LAYER_LOCLABEL:
NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
break;
case LAYER_GLOBLABEL:
NewText = new DrawGlobalLabelStruct( m_CurrentScreen->m_Curseur );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
( (DrawGlobalLabelStruct*) NewText )->m_Shape = s_DefaultShapeGLabel;
( (DrawGlobalLabelStruct*) NewText )->m_Orient = s_DefaultOrientGLabel;
NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel;
break;
default:
DisplayError( this, wxT( "Editexte: Internal error" ) );
break;
DisplayError( this, wxT( "WinEDA_SchematicFrame::CreateNewText() Internal error" ) );
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 );
EditSchematicText( NewText, DC );
......@@ -222,8 +221,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
if( type == LAYER_GLOBLABEL )
{
s_DefaultShapeGLabel = ( (DrawGlobalLabelStruct*) NewText )->m_Shape;
s_DefaultOrientGLabel = ( (DrawGlobalLabelStruct*) NewText )->m_Orient;
s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->m_Orient;
}
RedrawOneStruct( DrawPanel, DC, NewText, GR_DEFAULT_DRAWMODE );
......@@ -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 )
{
EDA_BaseStruct* TextStruct = panel->GetScreen()->GetCurItem();
......@@ -322,41 +321,95 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
/*****************************************************************************/
/* 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 )
return;
/* save Text in undo list if not already in edit, or moving ... */
if( Text->m_Flags == 0 )
SaveCopyInUndoList( Text, IS_CHANGED );
DrawTextStruct* newtext;
DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, Text, g_XorMode );
// erase drawing
switch( newtype )
{
case DRAW_LABEL_STRUCT_TYPE:
Text->SetType( DRAW_LABEL_STRUCT_TYPE );
Text->m_Layer = LAYER_LOCLABEL;
newtext = new DrawLabelStruct( Text->m_Pos, Text->m_Text );
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
Text->SetType( DRAW_GLOBAL_LABEL_STRUCT_TYPE );
Text->m_Layer = LAYER_GLOBLABEL;
newtext = new DrawGlobalLabelStruct( Text->m_Pos, Text->m_Text );
break;
case DRAW_TEXT_STRUCT_TYPE:
Text->SetType( DRAW_TEXT_STRUCT_TYPE );
Text->m_Layer = LAYER_NOTES;
newtext = new DrawTextStruct( Text->m_Pos, Text->m_Text );
break;
default:
newtext = NULL;
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
}
This diff is collapsed.
......@@ -473,7 +473,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
{
wxString msg;
msg.Printf( wxT( "SnapPoint2() error: unexpected strct type %d (" ), DrawList->Type() );
msg << DrawList->ReturnClassName() << wxT( ")" );
msg << DrawList->GetClass() << wxT( ")" );
DisplayError( NULL, msg );
break;
}
......@@ -660,7 +660,7 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
msg.Printf(
wxT( "DrawStructInBox() Err: unexpected StructType %d (" ),
DrawStruct->Type() );
msg << DrawStruct->ReturnClassName() << wxT( ")" );
msg << DrawStruct->GetClass() << wxT( ")" );
DisplayError( NULL, msg );
break;
}
......
......@@ -73,8 +73,14 @@ public:
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
public:
EDA_DrawLineStruct( const wxPoint &pos, int layer );
EDA_DrawLineStruct( const wxPoint& pos, int layer );
~EDA_DrawLineStruct() { }
virtual wxString GetClass() const
{
return wxT( "EDA_DrawLineStruct" );
}
bool IsOneEndPointAt( const wxPoint& pos );
EDA_DrawLineStruct* GenCopy();
......@@ -83,6 +89,7 @@ public:
return m_Start == m_End;
}
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
};
......@@ -97,8 +104,14 @@ public:
wxString m_Comment; /* Texte (commentaireassocie eventuel */
public:
DrawMarkerStruct( const wxPoint &pos, const wxString &text );
DrawMarkerStruct( const wxPoint& pos, const wxString& text );
~DrawMarkerStruct();
virtual wxString GetClass() const
{
return wxT( "DrawMarkerStruct" );
}
DrawMarkerStruct* GenCopy();
wxString GetComment();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
......@@ -112,8 +125,14 @@ public:
wxPoint m_Pos; /* XY coordinates of NoConnect. */
public:
DrawNoConnectStruct( const wxPoint &pos );
DrawNoConnectStruct( const wxPoint& pos );
~DrawNoConnectStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawNoConnectStruct" );
}
DrawNoConnectStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
......@@ -122,7 +141,7 @@ public:
/**
* 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
{
......@@ -133,15 +152,21 @@ public:
wxSize m_Size;
public:
DrawBusEntryStruct( const wxPoint &pos, int shape, int id );
DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
~DrawBusEntryStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawBusEntryStruct" );
}
DrawBusEntryStruct* GenCopy();
wxPoint m_End(); // retourne la coord de fin du raccord
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
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:
int m_Layer;
......@@ -152,6 +177,12 @@ public:
public:
DrawPolylineStruct( int layer );
~DrawPolylineStruct();
virtual wxString GetClass() const
{
return wxT( "DrawPolylineStruct" );
}
DrawPolylineStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
......@@ -164,15 +195,22 @@ public:
wxPoint m_Pos; /* XY coordinates of connection. */
public:
DrawJunctionStruct( const wxPoint &pos );
DrawJunctionStruct( const wxPoint& pos );
~DrawJunctionStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawJunctionStruct" );
}
DrawJunctionStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 );
};
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
class DrawTextStruct : public EDA_BaseStruct
, public EDA_TextStruct
{
public:
int m_Layer;
......@@ -180,29 +218,23 @@ public:
bool m_IsDangling; // TRUE si non connect
public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
~DrawTextStruct() { }
virtual wxString GetClass() const
{
return wxT( "DrawTextStruct" );
}
DrawTextStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 );
void SwapData( DrawTextStruct* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
// selectively give public access to a very dangerous protected function:
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 );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
};
......@@ -211,15 +243,29 @@ class DrawLabelStruct : public DrawTextStruct
public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~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
{
public:
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString );
~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,
LibEDA_BaseStruct* DrawItem )
/**********************************************************/
/* Routine de Duplication d'une structure DrawLibItem d'une partlib
* Parametres d'entree:
* DrawEntry = pointeur sur la structure a dupliquer
* La structure nouvelle est creee, mais n'est pas inseree dans le
* chainage
* Retourne:
* Pointeur sur la structure creee
/* Duplicate a DrawLibItem
* the new item is only created, it is not put in the current component linked list
* @param DrawEntry = DrawLibItem * item to duplicate
* @return a pointer to the new item
* A better way to duplicate a DrawLibItem is to have a virtual GenCopy() in LibEDA_BaseStruct class (ToDo).
*/
{
LibEDA_BaseStruct* NewDrawItem = NULL;
......@@ -345,12 +343,9 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
LastItem = NewDrawings;
NewDrawings->Pnext = NULL;
}
else // Probleme rencontr: arret de copie
{
/* why this? m_StructType is not a flag, it is a type indicator!
OldDrawings->Type() = TYPE_NOT_INIT;
*/
else // Should nevers occurs, just in case...
{ // CopyDrawEntryStruct() was not able to duplicate the type of OldDrawings
// occurs when an unexpected type is encountered
DisplayError( frame, wxT( "CopyLibEntryStruct(): error: aborted" ) );
break;
}
......
......@@ -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;
......@@ -322,36 +322,35 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
/* Deplacement des Segments de piste */
TRACK* track;
track = m_Pcb->m_Track;
/* Move the Track segments in block */
TRACK* track = m_Pcb->m_Track;
while( track )
{
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ /* la piste est ici bonne a etre deplacee */
{
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_End.x += deltaX; track->m_End.y += 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 */
track = (TRACK*) m_Pcb->m_Zone;
while( track )
/* Move the Zone segments in block */
SEGZONE * zsegment= m_Pcb->m_Zone;
while( zsegment )
{
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{ /* la piste est ici bonne a etre deplacee */
track->Draw( DrawPanel, DC, GR_XOR ); // effacement
track->m_Start.x += deltaX; track->m_Start.y += deltaY;
track->m_End.x += deltaX; track->m_End.y += deltaY;
track->m_Param += deltaX; track->m_Sous_Netcode += deltaY;
track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
{
zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display
zsegment->m_Start.x += deltaX; track->m_Start.y += deltaY;
zsegment->m_End.x += deltaX; track->m_End.y += deltaY;
zsegment->m_Param += deltaX; track->m_Sous_Netcode += deltaY;
zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment
}
track = (TRACK*) track->Pnext;
zsegment = zsegment->Next();
}
DrawPanel->Refresh( TRUE );
......@@ -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;
oldpos = GetScreen()->m_Curseur;
......@@ -379,58 +378,45 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
/* calcul du vecteur de deplacement pour les deplacements suivants */
deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
delta = GetScreen()->BlockLocate.m_MoveVector;
/* Deplacement des Segments de piste */
TRACK* track, * next_track, * new_track;
track = m_Pcb->m_Track;
/* Copy selected track segments and move the new track its new location */
TRACK* track = m_Pcb->m_Track;
while( track )
{
next_track = track->Next();
TRACK* next_track = track->Next();
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;
new_track = track->Copy();
TRACK* new_track = track->Copy();
new_track->Insert( m_Pcb, NULL );
new_track->m_Start.x += deltaX;
new_track->m_Start.y += deltaY;
new_track->m_End.x += deltaX;
new_track->m_End.y += deltaY;
new_track->m_Start += delta;
new_track->m_End += delta;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
new_track->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment
}
track = next_track;
}
/* Deplacement des Segments de Zone */
track = (TRACK*) m_Pcb->m_Zone;
while( track )
/* Copy the Zone segments and move the new segment to its new location */
SEGZONE * zsegment= m_Pcb->m_Zone;
while( zsegment )
{
next_track = track->Next();
SEGZONE * next_zsegment = zsegment->Next();
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
{
/* la piste est ici bonne a etre deplacee */
// @todo: bug? memory leak at this point:
new_track = new TRACK( m_Pcb );
new_track = track->Copy();
/* this zone segment must be duplicated */
SEGZONE * new_zsegment = (SEGZONE*) zsegment->Copy();
new_zsegment->Insert( m_Pcb, NULL );
new_track->Insert( m_Pcb, NULL );
new_track->m_Start.x += deltaX;
new_track->m_Start.y += deltaY;
new_zsegment->m_Start += delta;
new_zsegment->m_End += delta;
new_track->m_End.x += deltaX;
new_track->m_End.y += deltaY;
new_track->Draw( DrawPanel, DC, GR_OR ); // reaffichage
new_zsegment->Draw( DrawPanel, DC, GR_OR ); // draw the new created segment
}
track = next_track;
zsegment = next_zsegment;
}
}
......
......@@ -168,20 +168,6 @@ private:
private:
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:
......@@ -211,8 +197,6 @@ public:
m_Status = new_status;
}
wxString ReturnClassName() const;
/* addition d'une nouvelle struct a la liste chain� */
void AddToChain( EDA_BaseStruct* laststruct );
......@@ -288,8 +272,6 @@ public:
const KICAD_T scanTypes[] );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -297,15 +279,12 @@ public:
*/
virtual wxString GetClass() const
{
// ReturnClassName() is too hard to maintain, coordinating the array
// 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();
return wxT("EDA_BaseStruct");
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......
......@@ -108,6 +108,7 @@
#include "../bitmaps/down.xpm"
#include "../bitmaps/File_FootPrint.xpm"
#include "../bitmaps/Footprint_Text.xpm"
#include "../bitmaps/Options_Pad.xpm"
#include "../bitmaps/Options_New_Pad.xpm"
......
......@@ -304,7 +304,6 @@ public:
}
#if defined (DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -314,7 +313,6 @@ public:
{
return wxT( "BASE_SCREEN" );
}
#endif
};
......
......@@ -216,7 +216,7 @@ public:
MODULE* m_Modules; // linked list of MODULEs
EQUIPOT* m_Equipots; // linked list of nets
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
int m_NbPads; // nombre total de pads
CHEVELU* m_Ratsnest; // pointeur liste des chevelus
......@@ -290,7 +290,6 @@ public:
EQUIPOT* FindNet( int aNetcode );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -301,6 +300,7 @@ public:
return wxT( "BOARD" );
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......@@ -398,7 +398,6 @@ public:
*/
bool HitTest( const wxPoint& ref_pos );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -406,10 +405,8 @@ public:
*/
wxString GetClass() const
{
return wxT("pgraphic");
return wxT("DRAWSEGMENT");
}
#endif
};
......
......@@ -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,
// 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 TYPETRACK:
result = IterateForward( m_Track, inspector, testData, p );
......
......@@ -60,7 +60,6 @@ public:
bool HitTest( const wxPoint& ref_pos );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -70,7 +69,6 @@ public:
{
return wxT( "DIMENSION" );
}
#endif
};
#endif // #define COTATION_H
......@@ -65,7 +65,6 @@ public:
*/
bool HitTest( const wxPoint& refPos );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -77,6 +76,7 @@ public:
// return wxT( "EDGE" ); ?
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......
......@@ -33,7 +33,6 @@ public:
int WriteEquipotDescr( FILE* File );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -45,6 +44,7 @@ public:
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......
......@@ -175,7 +175,6 @@ public:
const KICAD_T scanTypes[] );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -187,7 +186,8 @@ public:
}
/**
#if defined(DEBUG)
/**
* 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
......
......@@ -117,8 +117,6 @@ public:
*/
bool HitTest( const wxPoint& refPos );
#if defined (DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -129,7 +127,7 @@ public:
return wxT( "PAD" );
}
#if defined (DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......
......@@ -49,7 +49,6 @@ public:
}
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -60,6 +59,7 @@ public:
return wxT("PTEXT");
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......
......@@ -99,7 +99,6 @@ public:
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -110,6 +109,7 @@ public:
return wxT( "MTEXT" );
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......
......@@ -298,7 +298,7 @@ void TRACK::UnLink()
{
if( Type() == TYPEZONE )
{
( (BOARD*) Pback )->m_Zone = (TRACK*) Pnext;
( (BOARD*) Pback )->m_Zone = (SEGZONE*) Pnext;
}
else
{
......@@ -331,7 +331,7 @@ void TRACK::Insert( BOARD* Pcb, BOARD_ITEM* InsertPoint )
if( Type() == TYPEZONE ) // put SEGZONE on front of m_Zone list
{
NextS = Pcb->m_Zone;
Pcb->m_Zone = this;
Pcb->m_Zone = (SEGZONE*)this;
}
else // put TRACK or SEGVIA on front of m_Track list
......
......@@ -134,7 +134,6 @@ public:
*/
bool HitTest( const wxPoint& refPos );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -154,8 +153,6 @@ public:
*/
void Show( int nestLevel, std::ostream& os );
#endif
};
......@@ -164,7 +161,6 @@ class SEGZONE : public TRACK
public:
SEGZONE( BOARD_ITEM* StructFather );
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -174,8 +170,9 @@ public:
{
return wxT("ZONE");
}
#endif
SEGZONE* Next() const { return (SEGZONE*) Pnext; }
};
......@@ -203,7 +200,6 @@ public:
void SetLayerPair( int top_layer, int bottom_layer );
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
#if defined(DEBUG)
/**
* Function GetClass
* returns the class name.
......@@ -213,8 +209,6 @@ public:
{
return wxT("VIA");
}
#endif
};
......
......@@ -19,7 +19,6 @@
#include "collectors.h"
#include "bitmaps.h"
#include "Footprint_Text.xpm"
#include "add_cotation.xpm"
#include "Add_Mires.xpm"
#include "Add_Zone.xpm"
......@@ -206,7 +205,7 @@ wxString BOARD_ITEM::MenuText() const
break;
default:
text << item->ReturnClassName() << wxT(" BUG!!");
text << item->GetClass() << wxT(" Unexpected item type: BUG!!");
break;
}
......
/******************************************************/
/* Edition des contours d'un module: Routines */
/* d'effacement et d'edition de segments et contours */
/* appartenant aux modules */
/* Edition of footprint edges */
/******************************************************/
/* fichier edgemod.cpp */
/* Routines d'edition des contours d'un module.
* La correction des Arcs de cercle n'est pas traitee ( mais
* les menus en routines sont prevus
/* Functions to edit graphic items used to draw footprint edges.
* Function to Arcs are not made (TODO..) but menus are ready to use
*/
#include "fctsys.h"
......@@ -37,7 +34,7 @@ static wxPoint CursorInitialPosition; // Mouse cursor inital position for move
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 )
......@@ -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 )
......@@ -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 )
/************************************************************************/
/* 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();
EDGE_MODULE* Edge = (EDGE_MODULE*) screen->GetCurItem();
......@@ -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 )
/************************************************************************/
/* Affiche le segment Edge Module en cours de trace
/* Redraw the current edited (moved) graphic item
*/
{
BASE_SCREEN* screen = panel->GetScreen();
......@@ -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 )
/***************************************************************************/
/* 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;
......@@ -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 )
/***************************************************************************/
/* 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;
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 )
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 );
if( Edge == NULL )
......@@ -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 )
/*************************************************************************/
/*
* Entre la nouvelle valeur pour ModuleSegmentWidth.
* change la largeur du EDGE_MODULE Edge si Edge != NULL
/* Edition of the edge items width
* Ask for a new width and init ModuleSegmentWidth.
* 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;
......@@ -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 )
/****************************************************************************/
/* 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 )
return;
......@@ -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 )
/******************************************************************/
/* abort function in moving edge.
*/
{
EDGE_MODULE* Edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();
......@@ -304,10 +328,11 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
wxDC* DC, int type_edge )
/*************************************************************************/
/* Fonction de debut de trace d'un nouveau contour.
* - Cree la place en memoire du nouveau contour
* - Prepare les coord des differents points
* - Met a jour la variable type_edge (= S_SEGMENT,S_ARC ...)
/* Create a new edge item (line, arc ..).
* @param Edge = if NULL: create new edge else terminate edge and create a new edge
* @param DC = current Device Context
* @param type_edge = S_SEGMENT,S_ARC ..
* @return the new created edge.
*/
{
MODULE* Module = m_Pcb->m_Modules;
......@@ -316,13 +341,13 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
if( Module == NULL )
return NULL;
if( Edge == NULL ) /* debut reel du trace */
if( Edge == NULL ) /* Start a new edge item */
{
SaveCopyInUndoList( Module );
Edge = new EDGE_MODULE( Module );
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->Pnext = Module->m_Drawings;
if( Module->m_Drawings )
......@@ -341,12 +366,12 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge->SetLayer( SILKSCREEN_N_CMP );
if( Module->GetLayer() == CUIVRE_N )
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;
/* 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;
/* 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.y = Edge->m_Start.y - Module->m_Pos.y;
RotatePoint( (int*) &(Edge->m_Start0.x),
......@@ -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 )
/*************************************************************************/
/* Terminate a move or create edge function
*/
{
MODULE* Module = m_Pcb->m_Modules;
/* test du dernier segment: si null: suppression */
/* If last segment length is 0: deletion */
if( Edge )
{
if( (Edge->m_Start.x == Edge->m_End.x)
......
......@@ -51,7 +51,6 @@
#include "Width_Net.xpm"
#include "Width_Track_Via.xpm"
#include "Select_Layer_Pair.xpm"
#include "Footprint_Text.xpm"
#include "Flag.xpm"
......
......@@ -56,14 +56,15 @@ EVT_RADIOBOX( ID_LAYER_SELECT, WinEDA_SelLayerFrame::Sel_Layer )
END_EVENT_TABLE()
/***********************************************************************************/
/****************************************************************************************/
int WinEDA_BasePcbFrame::SelectLayer( int default_layer, int min_layer, int max_layer )
/***********************************************************************************/
/****************************************************************************************/
/* Install the dialog box for layer selection
* default_layer = Preselection
* min_layer = val min de layer selectionnable (-1 si pas de val mini)
* max_layer = val max de layer selectionnable (-1 si pas de val maxi)
* @param default_layer = Preselection
* @param min_layer = min layer value (-1 if no min value)
* @param max_layer = max layer value (-1 si no max value)
* @return new layer value, or <0 if aborted
*/
{
int layer;
......@@ -92,7 +93,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent,
m_Parent = parent;
SetFont( *g_DialogFont );
/* Construction de la liste des couches autoris�s */
/* Build the layer list */
LayerCount = 0;
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
Masque_Layer += ALL_NO_CU_LAYERS;
......
......@@ -2,13 +2,6 @@
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.
*** 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.
......
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