Commit 45445dd8 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor code improvements and coding policy fixes.

* BLOCK_SELECTOR class is not longer derived from EDA_ITEM.
* Encapsulate BLOCK_SELECTOR class member variables and add access methods.
* Move HandleBlockBegin() function from block_commande.cpp to drawframe.cpp.
* Remove virtual methods from top level derived objects per future
  coding policy change.
* Remove Doxygen copydoc statement from objects derived from EDA_ITEM
  since the comments are automatically copied to the derived object.
* Removed copy and pasted Doxygen comments from objects derived from
  EDA_ITEM.
parent 005a13fe
...@@ -668,7 +668,7 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text ) ...@@ -668,7 +668,7 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
for( unsigned i = 0; i<list->Count(); i++ ) for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color, DrawGraphicText( NULL, NULL, pos, (EDA_COLOR_T) color,
txt, text->GetOrientation(), size, txt, text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify, text->m_HJustify, text->m_VJustify,
text->GetThickness(), text->m_Italic, text->GetThickness(), text->m_Italic,
...@@ -680,7 +680,7 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text ) ...@@ -680,7 +680,7 @@ void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text )
} }
else else
{ {
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color, DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_COLOR_T) color,
text->m_Text, text->GetOrientation(), size, text->m_Text, text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify, text->m_HJustify, text->m_VJustify,
text->GetThickness(), text->m_Italic, text->GetThickness(), text->m_Italic,
......
...@@ -437,8 +437,8 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ...@@ -437,8 +437,8 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
EDA_Colors aColor, int aDrawMode, EDA_COLOR_T aColor, int aDrawMode,
EDA_DRAW_MODE_T aFillMode, EDA_Colors aAnchor_color ) EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color )
{ {
if( m_MultilineAllowed ) if( m_MultilineAllowed )
{ {
...@@ -459,7 +459,7 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, ...@@ -459,7 +459,7 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
aColor, aColor,
aDrawMode, aDrawMode,
aFillMode, aFillMode,
i ? UNSPECIFIED_COLOR : aAnchor_color, i ? UNSPECIFIED : aAnchor_color,
txt, txt,
pos ); pos );
pos += offset; pos += offset;
...@@ -481,9 +481,9 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, ...@@ -481,9 +481,9 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_COLOR_T aColor,
int aDrawMode, EDA_DRAW_MODE_T aFillMode, int aDrawMode, EDA_DRAW_MODE_T aFillMode,
EDA_Colors aAnchor_color, EDA_COLOR_T aAnchor_color,
wxString& aText, wxPoint aPos ) wxString& aText, wxPoint aPos )
{ {
int width = m_Thickness; int width = m_Thickness;
...@@ -495,12 +495,12 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -495,12 +495,12 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
/* Draw text anchor, if allowed */ /* Draw text anchor, if allowed */
if( aAnchor_color != UNSPECIFIED_COLOR ) if( aAnchor_color != UNSPECIFIED )
{ {
int anchor_size = aDC->DeviceToLogicalXRel( 2 ); int anchor_size = aDC->DeviceToLogicalXRel( 2 );
aAnchor_color = (EDA_Colors) ( aAnchor_color & MASKCOLOR ); aAnchor_color = (EDA_COLOR_T) ( aAnchor_color & MASKCOLOR );
int cX = aPos.x + aOffset.x; int cX = aPos.x + aOffset.x;
int cY = aPos.y + aOffset.y; int cY = aPos.y + aOffset.y;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -40,11 +39,12 @@ ...@@ -40,11 +39,12 @@
#include <block_commande.h> #include <block_commande.h>
BLOCK_SELECTOR::BLOCK_SELECTOR() : EDA_RECT() BLOCK_SELECTOR::BLOCK_SELECTOR() :
EDA_RECT()
{ {
m_State = STATE_NO_BLOCK; /* State (enum BlockState) of block. */ m_state = STATE_NO_BLOCK; /* State (enum BLOCK_STATE_T) of block. */
m_Command = BLOCK_IDLE; /* Type (enum CmdBlockType) of operation. */ m_command = BLOCK_IDLE; /* Type (enum BLOCK_COMMAND_T) of operation. */
m_Color = BROWN; m_color = BROWN;
} }
...@@ -53,14 +53,11 @@ BLOCK_SELECTOR::~BLOCK_SELECTOR() ...@@ -53,14 +53,11 @@ BLOCK_SELECTOR::~BLOCK_SELECTOR()
} }
/*
* Print block command message (Block move, Block copy ...) in status bar
*/
void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame ) void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
{ {
wxString msg; wxString msg;
switch( m_Command ) switch( m_command )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
...@@ -137,193 +134,92 @@ void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf ...@@ -137,193 +134,92 @@ void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
} }
/**
* Function InitData
* Init the initial values of a BLOCK_SELECTOR, before starting a block command
*/
void BLOCK_SELECTOR::InitData( EDA_DRAW_PANEL* aPanel, const wxPoint& startpos ) void BLOCK_SELECTOR::InitData( EDA_DRAW_PANEL* aPanel, const wxPoint& startpos )
{ {
m_State = STATE_BLOCK_INIT; m_state = STATE_BLOCK_INIT;
SetOrigin( startpos ); SetOrigin( startpos );
SetSize( wxSize( 0, 0 ) ); SetSize( wxSize( 0, 0 ) );
m_ItemsSelection.ClearItemsList(); m_items.ClearItemsList();
aPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); aPanel->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
} }
/**
* Function ClearItemsList
* delete only the list of EDA_ITEM * pointers, NOT the pointed data
* itself
*/
void BLOCK_SELECTOR::ClearItemsList() void BLOCK_SELECTOR::ClearItemsList()
{ {
m_ItemsSelection.ClearItemsList(); m_items.ClearItemsList();
} }
/**
* Function ClearListAndDeleteItems
* delete only the list of EDA_ITEM * pointers, AND the data pinted
* by m_Item
*/
void BLOCK_SELECTOR::ClearListAndDeleteItems() void BLOCK_SELECTOR::ClearListAndDeleteItems()
{ {
m_ItemsSelection.ClearListAndDeleteItems(); m_items.ClearListAndDeleteItems();
} }
/**
* Function PushItem
* Add aItem to the list of items
* @param aItem = an ITEM_PICKER to add to the list
*/
void BLOCK_SELECTOR::PushItem( ITEM_PICKER& aItem ) void BLOCK_SELECTOR::PushItem( ITEM_PICKER& aItem )
{ {
m_ItemsSelection.PushItem( aItem ); m_items.PushItem( aItem );
} }
void BLOCK_SELECTOR::Clear() void BLOCK_SELECTOR::Clear()
{ {
if( m_Command != BLOCK_IDLE ) if( m_command != BLOCK_IDLE )
{ {
m_Command = BLOCK_IDLE; m_command = BLOCK_IDLE;
m_State = STATE_NO_BLOCK; m_state = STATE_NO_BLOCK;
ClearItemsList(); ClearItemsList();
} }
} }
/* First command block function:
* Init the Block infos: command type, initial position, and other variables..
*/
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpos )
{
BLOCK_SELECTOR* Block = &GetScreen()->m_BlockLocate;
if( ( Block->m_Command != BLOCK_IDLE ) || ( Block->m_State != STATE_NO_BLOCK ) )
return false;
Block->m_Command = (CmdBlockType) ReturnBlockCommand( key );
if( Block->m_Command == 0 )
return false;
switch( Block->m_Command )
{
case BLOCK_IDLE:
break;
case BLOCK_MOVE: /* Move */
case BLOCK_DRAG: /* Drag */
case BLOCK_COPY: /* Copy */
case BLOCK_DELETE: /* Delete */
case BLOCK_SAVE: /* Save */
case BLOCK_ROTATE: /* Rotate 90 deg */
case BLOCK_FLIP: /* Flip */
case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
Block->InitData( m_canvas, startpos );
break;
case BLOCK_PASTE:
Block->InitData( m_canvas, startpos );
Block->m_BlockLastCursorPosition.x = 0;
Block->m_BlockLastCursorPosition.y = 0;
InitBlockPasteInfos();
if( Block->m_ItemsSelection.GetCount() == 0 ) /* No data to paste */
{
DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
m_canvas->SetMouseCaptureCallback( NULL );
return true;
}
if( !m_canvas->IsMouseCaptured() )
{
Block->m_ItemsSelection.ClearItemsList();
DisplayError( this,
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
return true;
}
Block->m_State = STATE_BLOCK_MOVE;
m_canvas->CallMouseCapture( DC, startpos, false );
break;
default:
{
wxString msg;
msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
Block->m_Command;
DisplayError( this, msg );
}
break;
}
Block->SetMessageBlock( this );
return true;
}
/* Redraw the outlines of the block which shows the search area for block
* commands
* The first point of the rectangle showing the area is initialised
* by Initm_BlockLocateDatas().
* The other point of the rectangle is the mouse cursor
*/
void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
BLOCK_SELECTOR* PtBlock; BLOCK_SELECTOR* block;
PtBlock = &aPanel->GetScreen()->m_BlockLocate; block = &aPanel->GetScreen()->m_BlockLocate;
PtBlock->m_MoveVector = wxPoint( 0, 0 ); block->SetMoveVector( wxPoint( 0, 0 ) );
if( aErase ) if( aErase )
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color ); block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
PtBlock->m_BlockLastCursorPosition = aPanel->GetScreen()->GetCrossHairPosition(); block->SetLastCursorPosition( aPanel->GetScreen()->GetCrossHairPosition() );
PtBlock->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() ); block->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
PtBlock->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, PtBlock->m_Color ); block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
if( PtBlock->m_State == STATE_BLOCK_INIT ) if( block->GetState() == STATE_BLOCK_INIT )
{ {
if( PtBlock->GetWidth() || PtBlock->GetHeight() ) if( block->GetWidth() || block->GetHeight() )
/* 2nd point exists: the rectangle is not surface anywhere */ /* 2nd point exists: the rectangle is not surface anywhere */
PtBlock->m_State = STATE_BLOCK_END; block->SetState( STATE_BLOCK_END );
} }
} }
/* void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
* Cancel Current block operation.
*/
void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
BASE_SCREEN* screen = Panel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
if( Panel->IsMouseCaptured() ) /* Erase current drawing on screen */ if( aPanel->IsMouseCaptured() ) /* Erase current drawing on screen */
{ {
/* Clear block outline. */ /* Clear block outline. */
Panel->CallMouseCapture( DC, wxDefaultPosition, false ); aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
Panel->SetMouseCapture( NULL, NULL ); aPanel->SetMouseCapture( NULL, NULL );
screen->SetCurItem( NULL ); screen->SetCurItem( NULL );
/* Delete the picked wrapper if this is a picked list. */ /* Delete the picked wrapper if this is a picked list. */
if( screen->m_BlockLocate.m_Command != BLOCK_PASTE ) if( screen->m_BlockLocate.GetCommand() != BLOCK_PASTE )
screen->m_BlockLocate.ClearItemsList(); screen->m_BlockLocate.ClearItemsList();
} }
screen->m_BlockLocate.m_State = STATE_NO_BLOCK; screen->m_BlockLocate.SetState( STATE_NO_BLOCK );
screen->m_BlockLocate.m_Command = BLOCK_ABORT; screen->m_BlockLocate.SetCommand( BLOCK_ABORT );
Panel->GetParent()->HandleBlockEnd( DC ); aPanel->GetParent()->HandleBlockEnd( aDC );
screen->m_BlockLocate.m_Command = BLOCK_IDLE; screen->m_BlockLocate.SetCommand( BLOCK_IDLE );
Panel->GetParent()->DisplayToolMsg( wxEmptyString ); aPanel->GetParent()->DisplayToolMsg( wxEmptyString );
Panel->SetCursor( (wxStockCursor) Panel->GetCurrentCursor() ); aPanel->SetCursor( (wxStockCursor) aPanel->GetCurrentCursor() );
} }
...@@ -28,7 +28,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen ) ...@@ -28,7 +28,7 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
int xg, yg; int xg, yg;
wxPoint pos, ref; wxPoint pos, ref;
EDA_Colors color; EDA_COLOR_T color;
// paper is sized in mils. Here is a conversion factor to // paper is sized in mils. Here is a conversion factor to
// scale mils to internal units. // scale mils to internal units.
......
...@@ -883,3 +883,74 @@ wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils ) ...@@ -883,3 +883,74 @@ wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils )
{ {
return ::CoordinateToString( aValue, m_internalUnits, aConvertToMils ); return ::CoordinateToString( aValue, m_internalUnits, aConvertToMils );
} }
bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition )
{
BLOCK_SELECTOR* Block = &GetScreen()->m_BlockLocate;
if( ( Block->GetCommand() != BLOCK_IDLE ) || ( Block->GetState() != STATE_NO_BLOCK ) )
return false;
Block->SetCommand( (BLOCK_COMMAND_T) ReturnBlockCommand( aKey ) );
if( Block->GetCommand() == 0 )
return false;
switch( Block->GetCommand() )
{
case BLOCK_IDLE:
break;
case BLOCK_MOVE: /* Move */
case BLOCK_DRAG: /* Drag */
case BLOCK_COPY: /* Copy */
case BLOCK_DELETE: /* Delete */
case BLOCK_SAVE: /* Save */
case BLOCK_ROTATE: /* Rotate 90 deg */
case BLOCK_FLIP: /* Flip */
case BLOCK_ZOOM: /* Window Zoom */
case BLOCK_MIRROR_X:
case BLOCK_MIRROR_Y: /* mirror */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
Block->InitData( m_canvas, aPosition );
break;
case BLOCK_PASTE:
Block->InitData( m_canvas, aPosition );
Block->SetLastCursorPosition( wxPoint( 0, 0 ) );
InitBlockPasteInfos();
if( Block->GetCount() == 0 ) /* No data to paste */
{
DisplayError( this, wxT( "No Block to paste" ), 20 );
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
m_canvas->SetMouseCaptureCallback( NULL );
return true;
}
if( !m_canvas->IsMouseCaptured() )
{
Block->ClearItemsList();
DisplayError( this,
wxT( "EDA_DRAW_FRAME::HandleBlockBegin() Err: m_mouseCaptureCallback NULL" ) );
return true;
}
Block->SetState( STATE_BLOCK_MOVE );
m_canvas->CallMouseCapture( aDC, aPosition, false );
break;
default:
{
wxString msg;
msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
Block->GetCommand();
DisplayError( this, msg );
}
break;
}
Block->SetMessageBlock( this );
return true;
}
...@@ -942,7 +942,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -942,7 +942,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
{ {
// A block command is in progress: a left up is the end of block // A block command is in progress: a left up is the end of block
// or this is the end of a double click, already seen // or this is the end of a double click, already seen
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease ) if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreNextLeftButtonRelease )
GetParent()->OnLeftClick( &DC, screen->RefPos( true ) ); GetParent()->OnLeftClick( &DC, screen->RefPos( true ) );
ignoreNextLeftButtonRelease = false; ignoreNextLeftButtonRelease = false;
...@@ -958,7 +958,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -958,7 +958,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
ignoreNextLeftButtonRelease = false; ignoreNextLeftButtonRelease = false;
} }
if( event.ButtonUp( wxMOUSE_BTN_MIDDLE ) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK) ) if( event.ButtonUp( wxMOUSE_BTN_MIDDLE )
&& (screen->m_BlockLocate.GetState() == STATE_NO_BLOCK) )
{ {
// The middle button has been released, with no block command: // The middle button has been released, with no block command:
// We use it for a zoom center at cursor position command // We use it for a zoom center at cursor position command
...@@ -1011,7 +1012,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1011,7 +1012,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
if( event.LeftDown() || event.MiddleDown() ) if( event.LeftDown() || event.MiddleDown() )
{ {
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
{ {
m_requestAutoPan = false; m_requestAutoPan = false;
GetParent()->HandleBlockPlace( &DC ); GetParent()->HandleBlockPlace( &DC );
...@@ -1023,7 +1024,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1023,7 +1024,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
&& !IsMouseCaptured() ) && !IsMouseCaptured() )
{ {
// Mouse is dragging: if no block in progress, start a block command. // Mouse is dragging: if no block in progress, start a block command.
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{ {
// Start a block command // Start a block command
int cmd_type = kbstat; int cmd_type = kbstat;
...@@ -1068,7 +1069,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1068,7 +1069,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
( ABS( screen->m_BlockLocate.GetWidth() ) < BLOCK_MINSIZE_LIMIT ) ( ABS( screen->m_BlockLocate.GetWidth() ) < BLOCK_MINSIZE_LIMIT )
&& ( ABS( screen->m_BlockLocate.GetHeight() ) < BLOCK_MINSIZE_LIMIT ); && ( ABS( screen->m_BlockLocate.GetHeight() ) < BLOCK_MINSIZE_LIMIT );
if( (screen->m_BlockLocate.m_State != STATE_NO_BLOCK) && BlockIsSmall ) if( (screen->m_BlockLocate.GetState() != STATE_NO_BLOCK) && BlockIsSmall )
{ {
if( m_endMouseCaptureCallback ) if( m_endMouseCaptureCallback )
{ {
...@@ -1078,12 +1079,12 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1078,12 +1079,12 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
SetCursor( (wxStockCursor) m_currentCursor ); SetCursor( (wxStockCursor) m_currentCursor );
} }
else if( screen->m_BlockLocate.m_State == STATE_BLOCK_END ) else if( screen->m_BlockLocate.GetState() == STATE_BLOCK_END )
{ {
m_requestAutoPan = false; m_requestAutoPan = false;
GetParent()->HandleBlockEnd( &DC ); GetParent()->HandleBlockEnd( &DC );
SetCursor( (wxStockCursor) m_currentCursor ); SetCursor( (wxStockCursor) m_currentCursor );
if( screen->m_BlockLocate.m_State == STATE_BLOCK_MOVE ) if( screen->m_BlockLocate.GetState() == STATE_BLOCK_MOVE )
{ {
m_requestAutoPan = true; m_requestAutoPan = true;
SetCursor( wxCURSOR_HAND ); SetCursor( wxCURSOR_HAND );
...@@ -1105,8 +1106,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event ) ...@@ -1105,8 +1106,8 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
#if 0 #if 0
wxString msg_debug; wxString msg_debug;
msg_debug.Printf( " block state %d, cmd %d", msg_debug.Printf( " block state %d, cmd %d",
screen->m_BlockLocate.m_State, screen->m_BlockLocate.GetState(),
screen->m_BlockLocate.m_Command ); screen->m_BlockLocate.GetCommand() );
GetParent()->PrintMsg( msg_debug ); GetParent()->PrintMsg( msg_debug );
#endif #endif
......
...@@ -155,7 +155,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo ...@@ -155,7 +155,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo
static void DrawGraphicTextPline( static void DrawGraphicTextPline(
EDA_RECT* aClipBox, EDA_RECT* aClipBox,
wxDC* aDC, wxDC* aDC,
EDA_Colors aColor, EDA_COLOR_T aColor,
int aWidth, int aWidth,
bool aSketchMode, bool aSketchMode,
int point_count, int point_count,
...@@ -207,7 +207,7 @@ static int overbar_position( int size_v, int thickness ) ...@@ -207,7 +207,7 @@ static int overbar_position( int size_v, int thickness )
* @param aPanel = the current m_canvas. NULL if draw within a 3D GL Canvas * @param aPanel = the current m_canvas. NULL if draw within a 3D GL Canvas
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas * @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify) * @param aPos = text position (according to h_justify, v_justify)
* @param aColor (enum EDA_Colors) = text color * @param aColor (enum EDA_COLOR_T) = text color
* @param aText = text to draw * @param aText = text to draw
* @param aOrient = angle in 0.1 degree * @param aOrient = angle in 0.1 degree
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts) * @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
...@@ -226,7 +226,7 @@ static int overbar_position( int size_v, int thickness ) ...@@ -226,7 +226,7 @@ static int overbar_position( int size_v, int thickness )
void DrawGraphicText( EDA_DRAW_PANEL* aPanel, void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aPos, const wxPoint& aPos,
EDA_Colors aColor, EDA_COLOR_T aColor,
const wxString& aText, const wxString& aText,
int aOrient, int aOrient,
const wxSize& aSize, const wxSize& aSize,
...@@ -504,7 +504,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -504,7 +504,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
* Function PlotGraphicText * Function PlotGraphicText
* same as DrawGraphicText, but plot graphic text insteed of draw it * same as DrawGraphicText, but plot graphic text insteed of draw it
* @param aPos = text position (according to aH_justify, aV_justify) * @param aPos = text position (according to aH_justify, aV_justify)
* @param aColor (enum EDA_Colors) = text color * @param aColor (enum EDA_COLOR_T) = text color
* @param aText = text to draw * @param aText = text to draw
* @param aOrient = angle in 0.1 degree * @param aOrient = angle in 0.1 degree
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts) * @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
...@@ -517,7 +517,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -517,7 +517,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
* @param aBold = true to use a bold font Useful only with default width value (aWidth = 0) * @param aBold = true to use a bold font Useful only with default width value (aWidth = 0)
*/ */
void PLOTTER::text( const wxPoint& aPos, void PLOTTER::text( const wxPoint& aPos,
enum EDA_Colors aColor, enum EDA_COLOR_T aColor,
const wxString& aText, const wxString& aText,
int aOrient, int aOrient,
const wxSize& aSize, const wxSize& aSize,
......
...@@ -596,7 +596,7 @@ void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, ...@@ -596,7 +596,7 @@ void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
* @param aLines = a list of pair of coordinate in user space: a pair for each line. * @param aLines = a list of pair of coordinate in user space: a pair for each line.
* @param aWidth = the width of each line. * @param aWidth = the width of each line.
* @param aColor = an index into our color table of RGB colors. * @param aColor = an index into our color table of RGB colors.
* @see EDA_Colors and colors.h * @see EDA_COLOR_T and colors.h
*/ */
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines, void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
int aWidth, int aColor ) int aWidth, int aColor )
......
...@@ -1036,8 +1036,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid ...@@ -1036,8 +1036,8 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB, void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb, wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_Colors aClr1, int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1,
EDA_Colors aClr2 ) EDA_COLOR_T aClr2 )
{ {
wxPoint pos; wxPoint pos;
int refx, refy; int refx, refy;
......
...@@ -104,7 +104,7 @@ void SCH_EDIT_FRAME::InitBlockPasteInfos() ...@@ -104,7 +104,7 @@ void SCH_EDIT_FRAME::InitBlockPasteInfos()
{ {
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
block->m_ItemsSelection.CopyList( m_blockItems.m_ItemsSelection ); block->GetItems().CopyList( m_blockItems.GetItems() );
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
} }
...@@ -122,13 +122,13 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -122,13 +122,13 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ), msg.Printf( wxT( "HandleBlockPLace() error : no items to place (cmd %d, state %d)" ),
block->m_Command, block->m_State ); block->GetCommand(), block->GetState() );
DisplayError( this, msg ); DisplayError( this, msg );
} }
block->m_State = STATE_BLOCK_STOP; block->SetState( STATE_BLOCK_STOP );
switch( block->m_Command ) switch( block->GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
...@@ -141,8 +141,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -141,8 +141,8 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MOVED, block->m_MoveVector ); SaveCopyInUndoList( block->GetItems(), UR_MOVED, block->GetMoveVector() );
MoveItemsInList( block->m_ItemsSelection, block->m_MoveVector ); MoveItemsInList( block->GetItems(), block->GetMoveVector() );
block->ClearItemsList(); block->ClearItemsList();
break; break;
...@@ -151,10 +151,10 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -151,10 +151,10 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
DuplicateItemsInList( GetScreen(), block->m_ItemsSelection, block->m_MoveVector ); DuplicateItemsInList( GetScreen(), block->GetItems(), block->GetMoveVector() );
SaveCopyInUndoList( block->m_ItemsSelection, SaveCopyInUndoList( block->GetItems(),
( block->m_Command == BLOCK_PRESELECT_MOVE ) ? UR_CHANGED : UR_NEW ); ( block->GetCommand() == BLOCK_PRESELECT_MOVE ) ? UR_CHANGED : UR_NEW );
block->ClearItemsList(); block->ClearItemsList();
break; break;
...@@ -203,23 +203,23 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -203,23 +203,23 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( block->GetCount() ) if( block->GetCount() )
{ {
BlockState state = block->m_State; BLOCK_STATE_T state = block->GetState();
CmdBlockType command = block->m_Command; BLOCK_COMMAND_T command = block->GetCommand();
m_canvas->CallEndMouseCapture( DC ); m_canvas->CallEndMouseCapture( DC );
block->m_State = state; block->SetState( state );
block->m_Command = command; block->SetCommand( command );
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( block->GetEnd() ); GetScreen()->SetCrossHairPosition( block->GetEnd() );
if( block->m_Command != BLOCK_ABORT ) if( block->GetCommand() != BLOCK_ABORT )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
} }
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
{ {
switch( block->m_Command ) switch( block->GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
DisplayError( this, wxT( "Error in HandleBlockPLace()" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace()" ) );
...@@ -245,7 +245,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -245,7 +245,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE; block->SetState( STATE_BLOCK_MOVE );
} }
else else
{ {
...@@ -260,7 +260,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -260,7 +260,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( block->GetCount() ) if( block->GetCount() )
{ {
DeleteItemsInList( m_canvas, block->m_ItemsSelection ); DeleteItemsInList( m_canvas, block->GetItems() );
OnModify(); OnModify();
} }
...@@ -275,32 +275,30 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -275,32 +275,30 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( block->GetCount() ) if( block->GetCount() )
{ {
wxPoint move_vector = -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition; wxPoint move_vector = -GetScreen()->m_BlockLocate.GetLastCursorPosition();
copyBlockItems( block->m_ItemsSelection ); copyBlockItems( block->GetItems() );
MoveItemsInList( m_blockItems.m_ItemsSelection, move_vector ); MoveItemsInList( m_blockItems.GetItems(), move_vector );
} }
block->ClearItemsList(); block->ClearItemsList();
break; break;
case BLOCK_PASTE: case BLOCK_PASTE:
block->m_State = STATE_BLOCK_MOVE; block->SetState( STATE_BLOCK_MOVE );
break;
case BLOCK_FLIP: /* Pcbnew only! */
break; break;
case BLOCK_ZOOM: /* Window Zoom */ case BLOCK_ZOOM: /* Window Zoom */
zoom_command = true; zoom_command = true;
break; break;
case BLOCK_FLIP: /* Pcbnew only! */
case BLOCK_SELECT_ITEMS_ONLY: /* Not used */ case BLOCK_SELECT_ITEMS_ONLY: /* Not used */
case BLOCK_ABORT: /* not executed here */ case BLOCK_ABORT: /* not executed here */
break; break;
} }
} }
if( block->m_Command == BLOCK_ABORT ) if( block->GetCommand() == BLOCK_ABORT )
{ {
GetScreen()->ClearDrawingState(); GetScreen()->ClearDrawingState();
m_canvas->Refresh(); m_canvas->Refresh();
...@@ -308,8 +306,8 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -308,8 +306,8 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ! nextcmd ) if( ! nextcmd )
{ {
block->m_State = STATE_NO_BLOCK; block->SetState( STATE_NO_BLOCK );
block->m_Command = BLOCK_IDLE; block->SetCommand( BLOCK_IDLE );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
false ); false );
...@@ -331,20 +329,20 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -331,20 +329,20 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate; BLOCK_SELECTOR* block = &GetScreen()->m_BlockLocate;
// can convert only a block move command to an other command // can convert only a block move command to an other command
if( block->m_Command != BLOCK_MOVE ) if( block->GetCommand() != BLOCK_MOVE )
return; return;
// Useless if the new command is block move because we are already in block move. // Useless if the new command is block move because we are already in block move.
if( Command == BLOCK_MOVE ) if( Command == BLOCK_MOVE )
return; return;
block->m_Command = (CmdBlockType) Command; block->SetCommand( (BLOCK_COMMAND_T) Command );
block->SetMessageBlock( this ); block->SetMessageBlock( this );
switch( block->m_Command ) switch( block->GetCommand() )
{ {
case BLOCK_COPY: /* move to copy */ case BLOCK_COPY: /* move to copy */
block->m_State = STATE_BLOCK_MOVE; block->SetState( STATE_BLOCK_MOVE );
blockCmdFinished = false; blockCmdFinished = false;
break; break;
...@@ -366,7 +364,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -366,7 +364,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
block->m_State = STATE_BLOCK_MOVE; block->SetState( STATE_BLOCK_MOVE );
} }
break; break;
...@@ -376,7 +374,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -376,7 +374,7 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
if( block->GetCount() ) if( block->GetCount() )
{ {
DeleteItemsInList( m_canvas, block->m_ItemsSelection ); DeleteItemsInList( m_canvas, block->GetItems() );
OnModify(); OnModify();
} }
...@@ -390,9 +388,9 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -390,9 +388,9 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
if( block->GetCount() ) if( block->GetCount() )
{ {
wxPoint move_vector = -GetScreen()->m_BlockLocate.m_BlockLastCursorPosition; wxPoint move_vector = -GetScreen()->m_BlockLocate.GetLastCursorPosition();
copyBlockItems( block->m_ItemsSelection ); copyBlockItems( block->GetItems() );
MoveItemsInList( m_blockItems.m_ItemsSelection, move_vector ); MoveItemsInList( m_blockItems.GetItems(), move_vector );
} }
break; break;
...@@ -413,8 +411,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -413,8 +411,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
wxPoint rotationPoint = block->Centre(); wxPoint rotationPoint = block->Centre();
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint ); rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint );
GetScreen()->SetCrossHairPosition( rotationPoint ); GetScreen()->SetCrossHairPosition( rotationPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_ROTATED, rotationPoint ); SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
RotateListOfItems( block->m_ItemsSelection, rotationPoint ); RotateListOfItems( block->GetItems(), rotationPoint );
OnModify(); OnModify();
} }
...@@ -432,10 +430,11 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -432,10 +430,11 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint ); GetScreen()->SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_X, mirrorPoint ); SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint );
MirrorX( block->m_ItemsSelection, mirrorPoint ); MirrorX( block->GetItems(), mirrorPoint );
OnModify(); OnModify();
} }
GetScreen()->TestDanglingEnds( m_canvas, DC ); GetScreen()->TestDanglingEnds( m_canvas, DC );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
...@@ -450,8 +449,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -450,8 +449,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
wxPoint mirrorPoint = block->Centre(); wxPoint mirrorPoint = block->Centre();
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint ); mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
GetScreen()->SetCrossHairPosition( mirrorPoint ); GetScreen()->SetCrossHairPosition( mirrorPoint );
SaveCopyInUndoList( block->m_ItemsSelection, UR_MIRRORED_Y, mirrorPoint ); SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint );
MirrorY( block->m_ItemsSelection, mirrorPoint ); MirrorY( block->GetItems(), mirrorPoint );
OnModify(); OnModify();
} }
...@@ -486,23 +485,23 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -486,23 +485,23 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
/* Erase old block contents. */ /* Erase old block contents. */
if( aErase ) if( aErase )
{ {
block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
for( unsigned ii = 0; ii < block->GetCount(); ii++ ) for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{ {
schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem = (SCH_ITEM*) block->GetItem( ii );
schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor ); schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
} }
} }
/* Repaint new view. */ /* Repaint new view. */
block->m_MoveVector = screen->GetCrossHairPosition() - block->m_BlockLastCursorPosition; block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
for( unsigned ii = 0; ii < block->GetCount(); ii++ ) for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{ {
schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem = (SCH_ITEM*) block->GetItem( ii );
schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor ); schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
} }
} }
...@@ -515,6 +514,7 @@ void SCH_EDIT_FRAME::copyBlockItems( PICKED_ITEMS_LIST& aItemsList ) ...@@ -515,6 +514,7 @@ void SCH_EDIT_FRAME::copyBlockItems( PICKED_ITEMS_LIST& aItemsList )
{ {
// Clear m_Flag member of selected items: // Clear m_Flag member of selected items:
aItemsList.GetPickedItem( ii )->ClearFlags(); aItemsList.GetPickedItem( ii )->ClearFlags();
/* Make a copy of the original picked item. */ /* Make a copy of the original picked item. */
SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) ); SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
copy->SetParent( NULL ); copy->SetParent( NULL );
...@@ -543,7 +543,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) ...@@ -543,7 +543,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
for( unsigned ii = 0; ii < m_blockItems.GetCount(); ii++ ) for( unsigned ii = 0; ii < m_blockItems.GetCount(); ii++ )
{ {
Struct = DuplicateStruct( (SCH_ITEM*) m_blockItems.m_ItemsSelection.GetPickedItem( ii ) ); Struct = DuplicateStruct( (SCH_ITEM*) m_blockItems.GetItem( ii ) );
// Creates data, and push it as new data in undo item list buffer // Creates data, and push it as new data in undo item list buffer
ITEM_PICKER picker( Struct, UR_NEW ); ITEM_PICKER picker( Struct, UR_NEW );
...@@ -563,7 +563,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC ) ...@@ -563,7 +563,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
SaveCopyInUndoList( picklist, UR_NEW ); SaveCopyInUndoList( picklist, UR_NEW );
MoveItemsInList( picklist, GetScreen()->m_BlockLocate.m_MoveVector ); MoveItemsInList( picklist, GetScreen()->m_BlockLocate.GetMoveVector() );
// Clear flags for all items. // Clear flags for all items.
GetScreen()->ClearDrawingState(); GetScreen()->ClearDrawingState();
......
...@@ -90,18 +90,18 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -90,18 +90,18 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( GetScreen()->m_BlockLocate.GetCount() ) if( GetScreen()->m_BlockLocate.GetCount() )
{ {
BlockState state = GetScreen()->m_BlockLocate.m_State; BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
m_canvas->CallEndMouseCapture( DC ); m_canvas->CallEndMouseCapture( DC );
GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.SetState( state );
GetScreen()->m_BlockLocate.m_Command = command; GetScreen()->m_BlockLocate.SetCommand( command );
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(), GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) ); GetScreen()->m_BlockLocate.GetBottom() ) );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
} }
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
...@@ -125,7 +125,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -125,7 +125,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
} }
break; break;
...@@ -133,7 +133,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -133,7 +133,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextCmd = true; nextCmd = true;
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
...@@ -173,7 +173,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -173,7 +173,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if ( m_component ) if ( m_component )
{ {
OnModify(); OnModify();
int block_cmd = GetScreen()->m_BlockLocate.m_Command; int block_cmd = GetScreen()->m_BlockLocate.GetCommand();
if( block_cmd == BLOCK_MIRROR_Y) if( block_cmd == BLOCK_MIRROR_Y)
m_component->MirrorSelectedItemsH( pt ); m_component->MirrorSelectedItemsH( pt );
...@@ -198,11 +198,11 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -198,11 +198,11 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ! nextCmd ) if( ! nextCmd )
{ {
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY && m_component ) if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_SELECT_ITEMS_ONLY && m_component )
m_component->ClearSelectedItems(); m_component->ClearSelectedItems();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
false ); false );
...@@ -222,9 +222,9 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -222,9 +222,9 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
...@@ -237,7 +237,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -237,7 +237,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
if ( m_component ) if ( m_component )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.m_MoveVector; pt = GetScreen()->m_BlockLocate.GetMoveVector();
pt.y *= -1; pt.y *= -1;
if ( m_component ) if ( m_component )
...@@ -252,7 +252,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -252,7 +252,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
if ( m_component ) if ( m_component )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
pt = GetScreen()->m_BlockLocate.m_MoveVector; pt = GetScreen()->m_BlockLocate.GetMoveVector();
pt.y *= -1; pt.y *= -1;
if ( m_component ) if ( m_component )
...@@ -275,7 +275,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -275,7 +275,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
if ( m_component ) if ( m_component )
{ {
int block_cmd = GetScreen()->m_BlockLocate.m_Command; int block_cmd = GetScreen()->m_BlockLocate.GetCommand();
if( block_cmd == BLOCK_MIRROR_Y) if( block_cmd == BLOCK_MIRROR_Y)
m_component->MirrorSelectedItemsH( pt ); m_component->MirrorSelectedItemsH( pt );
...@@ -297,8 +297,8 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -297,8 +297,8 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify(); OnModify();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
...@@ -312,10 +312,10 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -312,10 +312,10 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
BLOCK_SELECTOR* PtBlock; BLOCK_SELECTOR* block;
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
wxPoint move_offset; wxPoint move_offset;
PtBlock = &screen->m_BlockLocate; block = &screen->m_BlockLocate;
LIB_EDIT_FRAME* parent = ( LIB_EDIT_FRAME* ) aPanel->GetParent(); LIB_EDIT_FRAME* parent = ( LIB_EDIT_FRAME* ) aPanel->GetParent();
wxASSERT( parent != NULL ); wxASSERT( parent != NULL );
...@@ -330,18 +330,18 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -330,18 +330,18 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aErase ) if( aErase )
{ {
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
component->Draw( aPanel, aDC, PtBlock->m_MoveVector, unit, convert, component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert,
g_XorMode, -1, DefaultTransform, true, true, true ); g_XorMode, -1, DefaultTransform, true, true, true );
} }
/* Repaint new view */ /* Repaint new view */
PtBlock->m_MoveVector = screen->GetCrossHairPosition() - PtBlock->m_BlockLastCursorPosition; block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
GRSetDrawMode( aDC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
component->Draw( aPanel, aDC, PtBlock->m_MoveVector, unit, convert, component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert,
g_XorMode, -1, DefaultTransform, true, true, true ); g_XorMode, -1, DefaultTransform, true, true, true );
} }
...@@ -357,10 +357,10 @@ void SeedLayers() ...@@ -357,10 +357,10 @@ void SeedLayers()
} }
EDA_Colors ReturnLayerColor( int Layer ) EDA_COLOR_T ReturnLayerColor( int Layer )
{ {
if( g_LayerDescr.Flags == 0 ) if( g_LayerDescr.Flags == 0 )
return (EDA_Colors) g_LayerDescr.LayerColor[Layer]; return (EDA_COLOR_T) g_LayerDescr.LayerColor[Layer];
else else
return (EDA_Colors) g_LayerDescr.CommonColor; return (EDA_COLOR_T) g_LayerDescr.CommonColor;
} }
...@@ -316,7 +316,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -316,7 +316,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
// notBusy == true means no item currently edited and no other command in progress // notBusy == true means no item currently edited and no other command in progress
// We can change active tool and ask for editing a new item // We can change active tool and ask for editing a new item
bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.m_State == STATE_NO_BLOCK); bool notBusy = (!itemInEdit) && (screen->m_BlockLocate.GetState() == STATE_NO_BLOCK);
/* Convert lower to upper case (the usual toupper function has problem /* Convert lower to upper case (the usual toupper function has problem
* with non ascii codes like function keys */ * with non ascii codes like function keys */
......
...@@ -89,137 +89,71 @@ public: ...@@ -89,137 +89,71 @@ public:
~LIB_ARC() { } ~LIB_ARC() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_ARC" ); return wxT( "LIB_ARC" );
} }
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Save arc object to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* arc to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); bool Load( LINE_READER& aLineReader, wxString& aErrorMsg );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
* @param aPosition - a wxPoint to test
* @param aThreshold - max distance to this object (usually the half
* thickness of a line)
* @param aTransform - the transform matrix
* @return - True if the point \a aPosition is near this object
*/
virtual bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
virtual EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual void DisplayInfo( EDA_DRAW_FRAME* frame );
/** void DisplayInfo( EDA_DRAW_FRAME* frame );
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item int GetPenSize() const;
*/
virtual int GetPenSize( ) const;
/**
* See LIB_ITEM::BeginEdit().
*/
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
/**
* See LIB_ITEM::ContinueEdit().
*/
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
/**
* See LIB_ITEM::AbortEdit().
*/
void EndEdit( const wxPoint& aPosition, bool aAbort = false ); void EndEdit( const wxPoint& aPosition, bool aAbort = false );
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_Pos; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_Pos; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_Width; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_Width; }
/** void SetWidth( int aWidth ) { m_Width = aWidth; }
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_arc_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_arc_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the arc draw object specific comparison.
* *
* The sort order is as follows: * The arc specific sort order is as follows:
* - Arc horizontal (X) position. * - Arc horizontal (X) position.
* - Arc vertical (Y) position. * - Arc vertical (Y) position.
* - Arc start angle. * - Arc start angle.
* - Arc end angle. * - Arc end angle.
*
* @param aOther A reference to the other #LIB_ITEM to compare the arc against.
* @return An integer value less than 0 if the arc is less than \a aOther, zero
* if the arc is equal to \a aOther, or greater than 0 if the arc is
* greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
......
...@@ -42,9 +42,6 @@ class LIB_BEZIER : public LIB_ITEM ...@@ -42,9 +42,6 @@ class LIB_BEZIER : public LIB_ITEM
std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4) std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4)
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
/**
* Draw the bezier curve.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform );
...@@ -55,125 +52,66 @@ public: ...@@ -55,125 +52,66 @@ public:
~LIB_BEZIER() { } ~LIB_BEZIER() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_BEZIER" ); return wxT( "LIB_BEZIER" );
} }
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Write bezier curve object out to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* bezier curve to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); bool Load( LINE_READER& aLineReader, wxString& aErrorMsg );
void AddPoint( const wxPoint& aPoint ); void AddPoint( const wxPoint& aPoint );
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** /**
* @return the number of corners * @return the number of corners
*/ */
unsigned GetCornerCount() const { return m_PolyPoints.size(); } unsigned GetCornerCount() const { return m_PolyPoints.size(); }
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
* @param aPosRef = a wxPoint to test
* @param aThreshold = max distance to a segment
* @param aTransform = the transform matrix
* @return true if the point aPosRef is near a segment
*/
virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
/** EDA_RECT GetBoundingBox() const;
* Function GetBoundingBox
* @return the boundary box for this, in library coordinates
*/
virtual EDA_RECT GetBoundingBox() const;
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_PolyPoints[0]; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_PolyPoints[0]; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_Width; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_Width; }
/** void SetWidth( int aWidth ) { m_Width = aWidth; }
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** int GetPenSize( ) const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( ) const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); void DisplayInfo( EDA_DRAW_FRAME* aFrame );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the bezier curve draw object specific comparison.
*
* The sort order for each bezier curve segment point is as follows:
* - Bezier point horizontal (X) point position.
* - Bezier point vertical (Y) point position.
* *
* @param aOther A reference to the other #LIB_ITEM to compare the bezier curve against. * The bezier curve specific sort order for each curve segment point is as follows:
* @return An integer value less than 0 if the bezier curve is less than \a aOther, zero * - Bezier horizontal (X) point position.
* if the bezier curve is equal to \a aOther, or greater than 0 if the bezier * - Bezier vertical (Y) point position.
* curve is greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
......
...@@ -38,17 +38,9 @@ class LIB_CIRCLE : public LIB_ITEM ...@@ -38,17 +38,9 @@ class LIB_CIRCLE : public LIB_ITEM
wxPoint m_Pos; // Position or centre (Arc and Circle) or start point (segments). wxPoint m_Pos; // Position or centre (Arc and Circle) or start point (segments).
int m_Width; // Line width. int m_Width; // Line width.
/**
* Draws the arc.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform );
/**
* Calculate the new circle at \a aPosition when editing.
*
* @param aPosition - The position to edit the circle in drawing coordinates.
*/
void calcEdit( const wxPoint& aPosition ); void calcEdit( const wxPoint& aPosition );
public: public:
...@@ -58,137 +50,70 @@ public: ...@@ -58,137 +50,70 @@ public:
~LIB_CIRCLE() { } ~LIB_CIRCLE() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_CIRCLE" ); return wxT( "LIB_CIRCLE" );
} }
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Write circle object to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* circle to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); bool Load( LINE_READER& aLineReader, wxString& aErrorMsg );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
* @param aPosRef - a wxPoint to test
* @param aThreshold - max distance to this object (usually the half
* thickness of a line)
* @param aTransform - the transform matrix
* @return true if the point aPosRef is near this object
*/
virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
/** int GetPenSize( ) const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( ) const;
virtual EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); void DisplayInfo( EDA_DRAW_FRAME* aFrame );
/**
* See LIB_ITEM::BeginEdit().
*/
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
/**
* See LIB_ITEM::ContinueEdit().
*/
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
/**
* See LIB_ITEM::AbortEdit().
*/
void EndEdit( const wxPoint& aPosition, bool aAbort = false ); void EndEdit( const wxPoint& aPosition, bool aAbort = false );
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_Pos; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_Pos; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_Width; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_Width; }
/** void SetWidth( int aWidth ) { m_Width = aWidth; }
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_circle_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_circle_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the circle draw object specific comparison.
* *
* The sort order is as follows: * The circle specific sort order is as follows:
* - Circle horizontal (X) position. * - Circle horizontal (X) position.
* - Circle vertical (Y) position. * - Circle vertical (Y) position.
* - Circle radius. * - Circle radius.
*
* @param aOther A reference to the other #LIB_ITEM to compare the circle against.
* @return An integer value less than 0 if the circle is less than \a aOther, zero
* if the circle is equal to \a aOther, or greater than 0 if the circle is
* greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
......
...@@ -73,7 +73,19 @@ typedef std::vector< LIB_PIN* > LIB_PINS; ...@@ -73,7 +73,19 @@ typedef std::vector< LIB_PIN* > LIB_PINS;
class LIB_ITEM : public EDA_ITEM class LIB_ITEM : public EDA_ITEM
{ {
/** /**
* Draws the item. * Function drawGraphic
*
* draws the item on \a aPanel.
*
* @param aPanel A pointer to the panel to draw the object upon.
* @param aDC A pointer to the device context used to draw the object.
* @param aOffset A reference to a wxPoint object containing the offset where to draw
* from the object's current position.
* @param aColor An #EDA_COLOR_T to draw the object or -1 to draw the object in it's
* default color.
* @param aDrawMode The mode used to perform the draw (#GR_OR, #GR_COPY, etc.).
* @param aDate A pointer to any object specific data required to perform the draw.
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
*/ */
virtual void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, virtual void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, const wxPoint& aOffset, int aColor,
...@@ -82,9 +94,9 @@ class LIB_ITEM : public EDA_ITEM ...@@ -82,9 +94,9 @@ class LIB_ITEM : public EDA_ITEM
/** /**
* Draw any editing specific graphics when the item is being edited. * Draw any editing specific graphics when the item is being edited.
* *
* @param aClipBox - Clip box of the current device context. * @param aClipBox Clip box of the current device context.
* @param aDC - The device context to draw on. * @param aDC The device context to draw on.
* @param aColor - The index of the color to draw. * @param aColor The index of the color to draw.
*/ */
virtual void drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor ) {} virtual void drawEditGraphics( EDA_RECT* aClipBox, wxDC* aDC, int aColor ) {}
...@@ -95,7 +107,7 @@ class LIB_ITEM : public EDA_ITEM ...@@ -95,7 +107,7 @@ class LIB_ITEM : public EDA_ITEM
* probably should be a pure virtual method but bezier curves are not yet editable in * probably should be a pure virtual method but bezier curves are not yet editable in
* the component library editor. Therefore, the default method does nothing. * the component library editor. Therefore, the default method does nothing.
* *
* @param aPosition - The current mouse position in drawing coordinates. * @param aPosition The current mouse position in drawing coordinates.
*/ */
virtual void calcEdit( const wxPoint& aPosition ) {} virtual void calcEdit( const wxPoint& aPosition ) {}
...@@ -155,9 +167,9 @@ public: ...@@ -155,9 +167,9 @@ public:
* allows the draw item to maintain it's own internal state while it is being * allows the draw item to maintain it's own internal state while it is being
* edited. Call AbortEdit() to quit the editing mode. * edited. Call AbortEdit() to quit the editing mode.
* *
* @param aEditMode - The editing mode being performed. See base_struct.h for a list * @param aEditMode The editing mode being performed. See base_struct.h for a list
* of mode flags. * of mode flags.
* @param aPosition - The position in drawing coordinates where the editing mode was * @param aPosition The position in drawing coordinates where the editing mode was
* started. This may or may not be required depending on the item * started. This may or may not be required depending on the item
* being edited and the edit mode. * being edited and the edit mode.
*/ */
...@@ -170,7 +182,7 @@ public: ...@@ -170,7 +182,7 @@ public:
* called for each additional left click when the mouse is captured while the item * called for each additional left click when the mouse is captured while the item
* is being edited. * is being edited.
* *
* @param aPosition - The position of the mouse left click in drawing coordinates. * @param aPosition The position of the mouse left click in drawing coordinates.
* @return True if additional mouse clicks are required to complete the edit in progress. * @return True if additional mouse clicks are required to complete the edit in progress.
*/ */
virtual bool ContinueEdit( const wxPoint aPosition ) { return false; } virtual bool ContinueEdit( const wxPoint aPosition ) { return false; }
...@@ -180,32 +192,31 @@ public: ...@@ -180,32 +192,31 @@ public:
* *
* This is used to end or abort an edit action in progress initiated by BeginEdit(). * This is used to end or abort an edit action in progress initiated by BeginEdit().
* *
* @param aPosition - The position of the last edit event in drawing coordinates. * @param aPosition The position of the last edit event in drawing coordinates.
* @param aAbort - Set to true to abort the current edit in progress. * @param aAbort Set to true to abort the current edit in progress.
*/ */
virtual void EndEdit( const wxPoint& aPosition, bool aAbort = false ) { m_Flags = 0; } virtual void EndEdit( const wxPoint& aPosition, bool aAbort = false ) { m_Flags = 0; }
/** /**
* Draw an item * Draw an item
* *
* @param aPanel - DrawPanel to use (can be null) mainly used for clipping * @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* purposes * @param aDC Device Context (can be null)
* @param aDC - Device Context (can be null) * @param aOffset Offset to draw
* @param aOffset - offset to draw * @param aColor -1 to use the normal body item color, or use this color if >= 0
* @param aColor - -1 to use the normal body item color, or use this color * @param aDrawMode GR_OR, GR_XOR, ...
* if >= 0 * @param aData Value or pointer used to pass others parameters, depending on body items.
* @param aDrawMode - GR_OR, GR_XOR, ... * Used for some items to force to force no fill mode ( has meaning only for
* @param aData - value or pointer used to pass others parameters, * items what can be filled ). used in printing or moving objects mode or to
* depending on body items. used for some items to force * pass reference to the lib component for pins.
* to force no fill mode ( has meaning only for items what * @param aTransform Transform Matrix (rotation, mirror ..)
* can be filled ). used in printing or moving objects mode
* or to pass reference to the lib component for pins
* @param aTransform - Transform Matrix (rotation, mirror ..)
*/ */
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint &aOffset, int aColor, virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint &aOffset, int aColor,
int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aDrawMode, void* aData, const TRANSFORM& aTransform );
/** /**
* Function GetPenSize
*
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
virtual int GetPenSize() const = 0; virtual int GetPenSize() const = 0;
...@@ -227,21 +238,18 @@ public: ...@@ -227,21 +238,18 @@ public:
return (LIB_COMPONENT *)m_Parent; return (LIB_COMPONENT *)m_Parent;
} }
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */
virtual bool HitTest( const wxPoint& aPosition ) virtual bool HitTest( const wxPoint& aPosition )
{ {
return false; return EDA_ITEM::HitTest( aPosition );
} }
/** /**
* @param aPosition - a wxPoint to test * @param aPosition A wxPoint to test.
* @param aThreshold - max distance to this object (usually the half * @param aThreshold Maximum distance to this object (usually the half thickness of a line)
* thickness of a line) * if < 0, it will be automatically set to half pen size when locating
* if < 0, it will be automatically set to half * lines or arcs and set to 0 for other items.
* pen size when locating lines or arcs * @param aTransform The transform matrix.
* and set to 0 for other items * @return True if the point \a aPosition is near this object
* @param aTransform - the transform matrix
* @return - true if the point \a aPosition is near this object
*/ */
virtual bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform ) = 0; virtual bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform ) = 0;
...@@ -266,8 +274,8 @@ public: ...@@ -266,8 +274,8 @@ public:
/** /**
* Test LIB_ITEM objects for equivalence. * Test LIB_ITEM objects for equivalence.
* *
* @param aOther - Object to test against. * @param aOther Object to test against.
* @return - True if object is identical to this object. * @return True if object is identical to this object.
*/ */
bool operator==( const LIB_ITEM& aOther ) const; bool operator==( const LIB_ITEM& aOther ) const;
bool operator==( const LIB_ITEM* aOther ) const bool operator==( const LIB_ITEM* aOther ) const
...@@ -379,14 +387,14 @@ public: ...@@ -379,14 +387,14 @@ public:
* The default setting is false. If the derived object support filling, * The default setting is false. If the derived object support filling,
* set the m_isFillable member to true. * set the m_isFillable member to true.
* *
* @return - True if draw object can be fill. Default is false. * @return True if draw object can be filled. Default is false.
*/ */
bool IsFillable() const { return m_isFillable; } bool IsFillable() const { return m_isFillable; }
/** /**
* Return the draw item editing mode status. * Return the draw item editing mode status.
* *
* @return - True if the item is being edited. * @return True if the item is being edited.
*/ */
bool InEditMode() const { return ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0; } bool InEditMode() const { return ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0; }
...@@ -414,15 +422,19 @@ private: ...@@ -414,15 +422,19 @@ private:
/** /**
* Function compare * Function compare
* provides the draw object specific comparison. * provides the draw object specific comparison called by the == and < operators.
* *
* This is called by the == and < operators. * The base object sort order which always proceeds the derived object sort order
* * is as follows:
* The sort order is as follows:
* - Component alternate part (DeMorgan) number. * - Component alternate part (DeMorgan) number.
* - Component part number. * - Component part number.
* - KICAD_T enum value. * - KICAD_T enum value.
* - Result of derived classes comparison. * - Result of derived classes comparison.
*
* @param aOther A reference to the other #LIB_ITEM to compare the arc against.
* @return An integer value less than 0 if the object is less than \a aOther ojbect,
* zero if the object is equal to \a aOther object, or greater than 0 if the
* object is greater than \a aOther object.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const = 0; virtual int compare( const LIB_ITEM& aOther ) const = 0;
}; };
......
...@@ -296,7 +296,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a ...@@ -296,7 +296,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
text = m_Text; text = m_Text;
GRSetDrawMode( aDC, aDrawMode ); GRSetDrawMode( aDC, aDrawMode );
DrawGraphicText( aPanel, aDC, text_pos, (EDA_Colors) color, text, m_Orient, m_Size, DrawGraphicText( aPanel, aDC, text_pos, (EDA_COLOR_T) color, text, m_Orient, m_Size,
m_HJustify, m_VJustify, linewidth, m_Italic, m_Bold ); m_HJustify, m_VJustify, linewidth, m_Italic, m_Bold );
/* Set to one (1) to draw bounding box around field text to validate /* Set to one (1) to draw bounding box around field text to validate
......
...@@ -89,7 +89,7 @@ public: ...@@ -89,7 +89,7 @@ public:
~LIB_FIELD(); ~LIB_FIELD();
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_FIELD" ); return wxT( "LIB_FIELD" );
} }
...@@ -106,12 +106,12 @@ public: ...@@ -106,12 +106,12 @@ public:
* names. The user definable fields will return FieldN where N is the ID of the field * names. The user definable fields will return FieldN where N is the ID of the field
* when the m_name member is empty. * when the m_name member is empty.
* *
* @param aTranslate = true to return translated field name (default) * @param aTranslate True to return translated field name (default). False to return
* false to return the english name * the english name (useful when the name is used as keyword in
* (useful when the name is used as keyword in netlists ...) * netlists ...)
* @return Name of the field. * @return Name of the field.
*/ */
wxString GetName(bool aTranslate = true) const; wxString GetName( bool aTranslate = true ) const;
/** /**
* Function SetName * Function SetName
...@@ -130,27 +130,16 @@ public: ...@@ -130,27 +130,16 @@ public:
void SetId( int aId ) { m_id = aId; } void SetId( int aId ) { m_id = aId; }
/** int GetPenSize( ) const;
* Function GetPenSize virtual
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( ) const;
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Writes field object out to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* field to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& errorMsg ); bool Load( LINE_READER& aLineReader, wxString& errorMsg );
/** /**
* Copy parameters of this field to another field. Pointers are not copied. * Copy parameters of this field to another field. Pointers are not copied.
* *
* @param aTarget = Target field to copy values to. * @param aTarget Target field to copy values to.
*/ */
void Copy( LIB_FIELD* aTarget ) const; void Copy( LIB_FIELD* aTarget ) const;
...@@ -174,30 +163,13 @@ public: ...@@ -174,30 +163,13 @@ public:
return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false; return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false;
} }
/** EDA_RECT GetBoundingBox() const;
* Return the bounding rectangle of the field text.
* @return Bounding rectangle.
*/
virtual EDA_RECT GetBoundingBox() const;
/** void DisplayInfo( EDA_DRAW_FRAME* aFrame );
* Displays info (type, part convert filed name and value)
* in msg panel
* @param aFrame = main frame where the message panel info is.
*/
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
* @param aPosition = a wxPoint to test
* @param aThreshold = max distance to this object (usually the half
* thickness of a line)
* @param aTransform = the transform matrix
* @return True if the point \a aPosition is near this object
*/
virtual bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
void operator=( const LIB_FIELD& field ) void operator=( const LIB_FIELD& field )
{ {
...@@ -233,19 +205,10 @@ public: ...@@ -233,19 +205,10 @@ public:
int GetDefaultColor(); int GetDefaultColor();
/**
* See LIB_ITEM::BeginEdit().
*/
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
/**
* See LIB_ITEM::ContinueEdit().
*/
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
/**
* See LIB_ITEM::AbortEdit().
*/
void EndEdit( const wxPoint& aPosition, bool aAbort = false ); void EndEdit( const wxPoint& aPosition, bool aAbort = false );
void Rotate(); void Rotate();
...@@ -263,73 +226,39 @@ public: ...@@ -263,73 +226,39 @@ public:
*/ */
void SetText( const wxString& aText ); void SetText( const wxString& aText );
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_Pos; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_Pos; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_Thickness; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_Thickness; }
/** void SetWidth( int aWidth ) { m_Thickness = aWidth; }
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth ) { m_Thickness = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return move_field_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return move_field_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the field draw object specific comparison.
* *
* The sort order for field is as follows: * The field specific sort order is as follows:
* *
* - Field ID, REFERENCE, VALUE, etc. * - Field ID, REFERENCE, VALUE, etc.
* - Field string, case insensitive compare. * - Field string, case insensitive compare.
...@@ -337,13 +266,8 @@ private: ...@@ -337,13 +266,8 @@ private:
* - Field vertical (Y) position. * - Field vertical (Y) position.
* - Field width. * - Field width.
* - Field height. * - Field height.
*
* @param aOther A reference to the other #LIB_ITEM to compare the field against.
* @return An integer value less than 0 if the field is less than \a aOther, zero
* if the field is equal to \a aOther, or greater than 0 if the field is
* greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
typedef std::vector< LIB_FIELD > LIB_FIELDS; typedef std::vector< LIB_FIELD > LIB_FIELDS;
......
...@@ -1073,7 +1073,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1073,7 +1073,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
{ {
int x, y, x1, y1; int x, y, x1, y1;
wxString StringPinNum; wxString StringPinNum;
EDA_Colors NameColor, NumColor; EDA_COLOR_T NameColor, NumColor;
wxSize PinNameSize( m_nameTextSize, m_nameTextSize ); wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize( m_numTextSize, m_numTextSize ); wxSize PinNumSize( m_numTextSize, m_numTextSize );
...@@ -1090,8 +1090,8 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1090,8 +1090,8 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
if( (Color < 0) && IsSelected() ) if( (Color < 0) && IsSelected() )
Color = g_ItemSelectetColor; Color = g_ItemSelectetColor;
NameColor = (EDA_Colors) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color ); NameColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color );
NumColor = (EDA_Colors) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color ); NumColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color );
/* Create the pin num string */ /* Create the pin num string */
ReturnPinStringNum( StringPinNum ); ReturnPinStringNum( StringPinNum );
...@@ -1270,7 +1270,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, ...@@ -1270,7 +1270,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
{ {
int MapX1, MapY1, x1, y1; int MapX1, MapY1, x1, y1;
EDA_Colors color = UNSPECIFIED_COLOR; EDA_COLOR_T color = UNSPECIFIED;
color = ReturnLayerColor( LAYER_PIN ); color = ReturnLayerColor( LAYER_PIN );
...@@ -1381,7 +1381,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, ...@@ -1381,7 +1381,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
{ {
int x, y, x1, y1; int x, y, x1, y1;
wxString StringPinNum; wxString StringPinNum;
EDA_Colors NameColor, NumColor; EDA_COLOR_T NameColor, NumColor;
wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize ); wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize ); wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
......
...@@ -116,9 +116,6 @@ class LIB_PIN : public LIB_ITEM ...@@ -116,9 +116,6 @@ class LIB_PIN : public LIB_ITEM
int m_numTextSize; int m_numTextSize;
int m_nameTextSize; /* Pin num and Pin name sizes */ int m_nameTextSize; /* Pin num and Pin name sizes */
/**
* Draw the pin.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform );
...@@ -129,7 +126,7 @@ public: ...@@ -129,7 +126,7 @@ public:
~LIB_PIN() { } ~LIB_PIN() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_PIN" ); return wxT( "LIB_PIN" );
} }
...@@ -138,47 +135,19 @@ public: ...@@ -138,47 +135,19 @@ public:
void Show( int nestLevel, std::ostream& os ) const; // virtual override void Show( int nestLevel, std::ostream& os ) const; // virtual override
#endif #endif
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Write pin object to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* pin to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); bool Load( LINE_READER& aLineReader, wxString& aErrorMsg );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
* @param aPosRef - a wxPoint to test
* @param aThreshold - max distance to this object (usually the half
* thickness of a line)
* @param aTransform - the transform matrix
* @return - true if the point aPosRef is near this object
*/
virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
/** void DisplayInfo( EDA_DRAW_FRAME* aFrame );
* Function DisplayInfo
* displays the pin information in the message panel attached to \a aFrame.
*/
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame );
/** bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
/** EDA_RECT GetBoundingBox() const;
* Function GetBoundingBox
* @return the boundary box for the pin in schematic coordinates.
*
* Uses DefaultTransform as transform matrix
*/
virtual EDA_RECT GetBoundingBox() const;
/** /**
* Function ReturnPinEndPoint * Function ReturnPinEndPoint
...@@ -191,7 +160,8 @@ public: ...@@ -191,7 +160,8 @@ public:
* Function ReturnPinDrawOrient * Function ReturnPinDrawOrient
* returns the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), * returns the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
* according to its orientation and the matrix transform (rot, mirror) \a aTransform * according to its orientation and the matrix transform (rot, mirror) \a aTransform
* @param aTransform = transform matrix *
* @param aTransform Transform matrix
*/ */
int ReturnPinDrawOrient( const TRANSFORM& aTransform ) const; int ReturnPinDrawOrient( const TRANSFORM& aTransform ) const;
...@@ -231,7 +201,7 @@ public: ...@@ -231,7 +201,7 @@ public:
* *
* This will also all of the pin names marked by EnableEditMode(). * This will also all of the pin names marked by EnableEditMode().
* *
* @param aName - New pin name. * @param aName New pin name.
*/ */
void SetName( const wxString& aName ); void SetName( const wxString& aName );
...@@ -241,7 +211,7 @@ public: ...@@ -241,7 +211,7 @@ public:
* This will also update the text size of the name of the pins marked * This will also update the text size of the name of the pins marked
* by EnableEditMode(). * by EnableEditMode().
* *
* @param aSize - The text size of the pin name in schematic units ( mils ). * @param aSize The text size of the pin name in schematic units ( mils ).
*/ */
void SetNameTextSize( int aSize ); void SetNameTextSize( int aSize );
...@@ -252,7 +222,7 @@ public: ...@@ -252,7 +222,7 @@ public:
* *
* Others pin numbers marked by EnableEditMode() are not modified * Others pin numbers marked by EnableEditMode() are not modified
* because each pin has its own number * because each pin has its own number
* @param aNumber - New pin number. * @param aNumber New pin number.
*/ */
void SetNumber( const wxString& aNumber ); void SetNumber( const wxString& aNumber );
...@@ -262,8 +232,7 @@ public: ...@@ -262,8 +232,7 @@ public:
* This will also update the text size of the number of the pins marked * This will also update the text size of the number of the pins marked
* by EnableEditMode(). * by EnableEditMode().
* *
* @param aSize - The text size of the pin number in schematic * @param aSize The text size of the pin number in schematic units ( mils ).
* units ( mils ).
*/ */
void SetNumberTextSize( int aSize ); void SetNumberTextSize( int aSize );
...@@ -371,9 +340,9 @@ public: ...@@ -371,9 +340,9 @@ public:
* parts or body styles in the component. See SetCommonToAllParts() * parts or body styles in the component. See SetCommonToAllParts()
* and SetCommonToAllBodyStyles() for more information. * and SetCommonToAllBodyStyles() for more information.
* *
* @param aEnable - True marks all common pins for editing mode. False * @param aEnable True marks all common pins for editing mode. False
* clears the editing mode. * clears the editing mode.
* @param aEditPinByPin - Enables the edit pin by pin mode. * @param aEditPinByPin Enables the edit pin by pin mode.
*/ */
void EnableEditMode( bool aEnable, bool aEditPinByPin = false ); void EnableEditMode( bool aEnable, bool aEditPinByPin = false );
...@@ -384,11 +353,7 @@ public: ...@@ -384,11 +353,7 @@ public:
*/ */
bool IsVisible() { return ( m_attributes & PIN_INVISIBLE ) == 0; } bool IsVisible() { return ( m_attributes & PIN_INVISIBLE ) == 0; }
/** int GetPenSize() const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
/** /**
* Function DrawPinSymbol * Function DrawPinSymbol
...@@ -509,84 +474,45 @@ public: ...@@ -509,84 +474,45 @@ public:
*/ */
static const BITMAP_DEF* GetElectricalTypeSymbols(); static const BITMAP_DEF* GetElectricalTypeSymbols();
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_position; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_position; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_width; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_width; }
/** void SetWidth( int aWidth );
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth );
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const;
virtual BITMAP_DEF GetMenuImage() const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the pin draw object specific comparison.
* *
* The sort order is as follows: * The pin specific sort order is as follows:
* - Pin number. * - Pin number.
* - Pin name, case insensitive compare. * - Pin name, case insensitive compare.
* - Pin horizontal (X) position. * - Pin horizontal (X) position.
* - Pin vertical (Y) position. * - Pin vertical (Y) position.
*
* @param aOther A reference to the other #LIB_ITEM to compare the pin against.
* @return An integer value less than 0 if the pin is less than \a aOther, zero
* if the pin is equal to \a aOther, or greater than 0 if the pin is
* greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
......
...@@ -39,17 +39,9 @@ class LIB_POLYLINE : public LIB_ITEM ...@@ -39,17 +39,9 @@ class LIB_POLYLINE : public LIB_ITEM
int m_ModifyIndex; // Index of the polyline point to modify int m_ModifyIndex; // Index of the polyline point to modify
/**
* Draw the polyline.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform );
/**
* Calculate the polyline attributes relative to \a aPosition while editing.
*
* @param aPosition - Edit position in drawing units.
*/
void calcEdit( const wxPoint& aPosition ); void calcEdit( const wxPoint& aPosition );
public: public:
...@@ -59,22 +51,15 @@ public: ...@@ -59,22 +51,15 @@ public:
~LIB_POLYLINE() { } ~LIB_POLYLINE() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_POLYLINE" ); return wxT( "LIB_POLYLINE" );
} }
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Write polyline object out to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* polyline to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); bool Load( LINE_READER& aLineReader, wxString& aErrorMsg );
void AddPoint( const wxPoint& aPoint ); void AddPoint( const wxPoint& aPoint );
...@@ -88,122 +73,59 @@ public: ...@@ -88,122 +73,59 @@ public:
*/ */
unsigned GetCornerCount() const { return m_PolyPoints.size(); } unsigned GetCornerCount() const { return m_PolyPoints.size(); }
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
* @param aPosition = a wxPoint to test
* @param aThreshold = max distance to a segment
* @param aTransform = the transform matrix
* @return true if the point \a aPosition is near a segment
*/
virtual bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
/** EDA_RECT GetBoundingBox() const;
* Function GetBoundingBox
* @return the boundary box for this, in library coordinates
*/
virtual EDA_RECT GetBoundingBox() const;
/** int GetPenSize( ) const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( ) const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); void DisplayInfo( EDA_DRAW_FRAME* aFrame );
/**
* See LIB_ITEM::BeginEdit().
*/
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
/**
* See LIB_ITEM::ContinueEdit().
*/
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
/**
* See LIB_ITEM::AbortEdit().
*/
void EndEdit( const wxPoint& aPosition, bool aAbort = false ); void EndEdit( const wxPoint& aPosition, bool aAbort = false );
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_PolyPoints[0]; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_PolyPoints[0]; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_Width; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_Width; }
/** void SetWidth( int aWidth ) { m_Width = aWidth; }
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_polygon_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_polygon_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the polyline segment draw object specific comparison.
* *
* The sort order for each polyline segment point is as follows: * The sort order for specific to each polyline segment point is as follows:
* - Line segment point horizontal (X) position. * - Line segment point horizontal (X) position.
* - Line segment point vertical (Y) position. * - Line segment point vertical (Y) position.
*
* @param aOther A reference to the other #LIB_ITEM to compare the polyline against.
* @return An integer value less than 0 if the polyline is less than \a aOther, zero
* if the polyline is equal to \a aOther, or greater than 0 if the polyline
* is greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
......
...@@ -41,17 +41,9 @@ class LIB_RECTANGLE : public LIB_ITEM ...@@ -41,17 +41,9 @@ class LIB_RECTANGLE : public LIB_ITEM
bool m_isHeightLocked; // Flag: Keep height locked bool m_isHeightLocked; // Flag: Keep height locked
bool m_isStartPointSelected; // Flag: is the upper left edge selected? bool m_isStartPointSelected; // Flag: is the upper left edge selected?
/**
* Draw the rectangle.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform );
/**
* Calculate the rectangle attributes relative to \a aPosition while editing.
*
* @param aPosition - Edit position in drawing units.
*/
void calcEdit( const wxPoint& aPosition ); void calcEdit( const wxPoint& aPosition );
public: public:
...@@ -61,139 +53,72 @@ public: ...@@ -61,139 +53,72 @@ public:
~LIB_RECTANGLE() { } ~LIB_RECTANGLE() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_RECTANGLE" ); return wxT( "LIB_RECTANGLE" );
} }
void SetEndPosition( const wxPoint& aPosition ) { m_End = aPosition; } void SetEndPosition( const wxPoint& aPosition ) { m_End = aPosition; }
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Write rectangle object out to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* rectangle to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); bool Load( LINE_READER& aLineReader, wxString& aErrorMsg );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
* @param aPosRef - a wxPoint to test
* @param aThreshold - max distance to this object (usually the half
* thickness of a line)
* @param aTransform - the transform matrix
* @return true if the point aPosRef is near this object
*/
virtual bool HitTest( wxPoint aPosRef, int aThreshold, const TRANSFORM& aTransform );
/** int GetPenSize( ) const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( ) const;
virtual EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); void DisplayInfo( EDA_DRAW_FRAME* aFrame );
/**
* See LIB_ITEM::BeginEdit().
*/
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
/**
* See LIB_ITEM::ContinueEdit().
*/
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
/**
* See LIB_ITEM::AbortEdit().
*/
void EndEdit( const wxPoint& aPosition, bool aAbort = false ); void EndEdit( const wxPoint& aPosition, bool aAbort = false );
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_Pos; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_Pos; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_Width; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_Width; }
/** void SetWidth( int aWidth ) { m_Width = aWidth; }
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_rectangle_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_rectangle_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the rectangle draw object specific comparison.
* *
* The sort order is as follows: * The rectangle specific sort order is as follows:
* - Rectangle horizontal (X) start position. * - Rectangle horizontal (X) start position.
* - Rectangle vertical (Y) start position. * - Rectangle vertical (Y) start position.
* - Rectangle horizontal (X) end position. * - Rectangle horizontal (X) end position.
* - Rectangle vertical (Y) end position. * - Rectangle vertical (Y) end position.
*
* @param aOther A reference to the other #LIB_ITEM to compare the rectangle against.
* @return An integer value less than 0 if the rectangle is less than \a aOther, zero
* if the rectangle is equal to \a aOther, or greater than 0 if the rectangle
* is greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
......
...@@ -317,7 +317,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill, ...@@ -317,7 +317,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 ); int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 );
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + offset; wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + offset;
plotter->text( pos, UNSPECIFIED_COLOR, m_Text, plotter->text( pos, UNSPECIFIED, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GetPenSize(), m_Italic, m_Bold ); GetPenSize(), m_Italic, m_Bold );
...@@ -389,7 +389,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO ...@@ -389,7 +389,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
// Calculate pos accordint to mirror/rotation. // Calculate pos accordint to mirror/rotation.
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset; txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
DrawGraphicText( aPanel, aDC, txtpos, (EDA_Colors) color, m_Text, orient, m_Size, DrawGraphicText( aPanel, aDC, txtpos, (EDA_COLOR_T) color, m_Text, orient, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(),
m_Italic, m_Bold ); m_Italic, m_Bold );
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
* This is only a graphical text item. Field text like the reference designator, * This is only a graphical text item. Field text like the reference designator,
* component value, etc. are not LIB_TEXT items. See the #LIB_FIELD class for the * component value, etc. are not LIB_TEXT items. See the #LIB_FIELD class for the
* field item definition. * field item definition.
* </p>
*/ */
class LIB_TEXT : public LIB_ITEM, public EDA_TEXT class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
{ {
...@@ -46,17 +47,9 @@ class LIB_TEXT : public LIB_ITEM, public EDA_TEXT ...@@ -46,17 +47,9 @@ class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
bool m_rotate; ///< Flag to indicate a rotation occurred while editing. bool m_rotate; ///< Flag to indicate a rotation occurred while editing.
bool m_updateText; ///< Flag to indicate text change occurred while editing. bool m_updateText; ///< Flag to indicate text change occurred while editing.
/**
* Draw the polyline.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ); int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform );
/**
* Calculate the text attributes relative to \a aPosition while editing.
*
* @param aPosition - Edit position in drawing units.
*/
void calcEdit( const wxPoint& aPosition ); void calcEdit( const wxPoint& aPosition );
public: public:
...@@ -66,7 +59,7 @@ public: ...@@ -66,7 +59,7 @@ public:
~LIB_TEXT() { } ~LIB_TEXT() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "LIB_TEXT" ); return wxT( "LIB_TEXT" );
} }
...@@ -83,150 +76,74 @@ public: ...@@ -83,150 +76,74 @@ public:
*/ */
void SetText( const wxString& aText ); void SetText( const wxString& aText );
/** bool Save( OUTPUTFORMATTER& aFormatter );
* Write text object out to a FILE in "*.lib" format.
*
* @param aFormatter A reference to an OUTPUTFORMATTER to write the component library
* text to.
* @return True if success writing else false.
*/
virtual bool Save( OUTPUTFORMATTER& aFormatter );
virtual bool Load( LINE_READER& aLineReader, wxString& aErrorMsg ); bool Load( LINE_READER& aLineReader, wxString& aErrorMsg );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
* @param aPosition = a wxPoint to test, in Eeschema coordinates
* @param aThreshold = max distance to a segment
* @param aTransform = the transform matrix
* @return true if the point \a aPosition is near a segment
*/
virtual bool HitTest( wxPoint aPosition, int aThreshold, const TRANSFORM& aTransform );
/** bool HitTest( EDA_RECT& aRect )
* Test if the given rectangle intersects this object.
*
* For now, an ending point must be inside this rect.
*
* @param aRect - the given EDA_RECT
* @return - true if a hit, else false
*/
virtual bool HitTest( EDA_RECT& aRect )
{ {
return TextHitTest( aRect ); return TextHitTest( aRect );
} }
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize( ) const;
virtual void DisplayInfo( EDA_DRAW_FRAME* aFrame ); int GetPenSize( ) const;
/** void DisplayInfo( EDA_DRAW_FRAME* aFrame );
* @return the boundary box for this, in schematic coordinates
*/ EDA_RECT GetBoundingBox() const;
virtual EDA_RECT GetBoundingBox() const;
void Rotate(); void Rotate();
/**
* See LIB_ITEM::BeginEdit().
*/
void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) );
/**
* See LIB_ITEM::ContinueEdit().
*/
bool ContinueEdit( const wxPoint aNextPoint ); bool ContinueEdit( const wxPoint aNextPoint );
/**
* See LIB_ITEM::AbortEdit().
*/
void EndEdit( const wxPoint& aPosition, bool aAbort = false ); void EndEdit( const wxPoint& aPosition, bool aAbort = false );
/** void SetOffset( const wxPoint& aOffset );
* @copydoc LIB_ITEM::SetOffset(const wxPoint&)
*/
virtual void SetOffset( const wxPoint& aOffset );
/** bool Inside( EDA_RECT& aRect ) const;
* @copydoc LIB_ITEM::Inside()
*/
virtual bool Inside( EDA_RECT& aRect ) const;
/** void Move( const wxPoint& aPosition );
* @copydoc LIB_ITEM::Move()
*/
virtual void Move( const wxPoint& aPosition );
/** wxPoint GetPosition() const { return m_Pos; }
* @copydoc LIB_ITEM::GetPosition()
*/
virtual wxPoint GetPosition() const { return m_Pos; }
/** void MirrorHorizontal( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorHorizontal()
*/
virtual void MirrorHorizontal( const wxPoint& aCenter );
/** void MirrorVertical( const wxPoint& aCenter );
* @copydoc LIB_ITEM::MirrorVertical()
*/
virtual void MirrorVertical( const wxPoint& aCenter );
/** void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
* @copydoc LIB_ITEM::Rotate(const wxPoint&,bool)
*/
virtual void Rotate( const wxPoint& aCenter, bool aRotateCCW = true );
/** void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
* @copydoc LIB_ITEM::Plot()
*/
virtual void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ); const TRANSFORM& aTransform );
/** int GetWidth() const { return m_Thickness; }
* @copydoc LIB_ITEM::GetWidth()
*/
virtual int GetWidth() const { return m_Thickness; }
/** void SetWidth( int aWidth ) { m_Thickness = aWidth; }
* @copydoc LIB_ITEM::SetWidth()
*/
virtual void SetWidth( int aWidth ) { m_Thickness = aWidth; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_text_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** /**
* Function compare * @copydoc LIB_ITEM::compare()
* provides the text draw object specific comparison.
* *
* The sort order is as follows: * The text specific sort order is as follows:
* - Text string, case insensitive compare. * - Text string, case insensitive compare.
* - Text horizontal (X) position. * - Text horizontal (X) position.
* - Text vertical (Y) position. * - Text vertical (Y) position.
* - Text width. * - Text width.
* - Text height. * - Text height.
*
* @param aOther A reference to the other #LIB_ITEM to compare the text against.
* @return An integer value less than 0 if the text is less than \a aOther, zero
* if the text is equal to \a aOther, or greater than 0 if the text is
* greater than \a aOther.
*/ */
virtual int compare( const LIB_ITEM& aOther ) const; int compare( const LIB_ITEM& aOther ) const;
}; };
......
...@@ -43,7 +43,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -43,7 +43,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
// If Command in progress, put menu "cancel" // If Command in progress, put menu "cancel"
if( item && item->GetFlags() ) if( item && item->GetFlags() )
{ {
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ), KiBitmap( cancel_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
} }
else else
...@@ -85,7 +86,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -85,7 +86,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
msg = AddHotkeyName( _( "Move Arc" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Arc" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_arc_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
KiBitmap( move_arc_xpm ) );
msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Arc Size" ), s_Libedit_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_arc_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_arc_xpm ) );
} }
...@@ -105,22 +107,26 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -105,22 +107,26 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
msg = AddHotkeyName( _( "Move Circle" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Circle" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_circle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
KiBitmap( move_circle_xpm ) );
} }
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
{ {
msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Circle Outline" ), s_Libedit_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_rectangle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg,
KiBitmap( move_rectangle_xpm ) );
} }
msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); msg = AddHotkeyName( _( "Edit Circle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_circle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg,
KiBitmap( options_circle_xpm ) );
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
{ {
msg = AddHotkeyName( _( "Delete Circle" ), s_Libedit_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Circle" ), s_Libedit_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_circle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg,
KiBitmap( delete_circle_xpm ) );
} }
break; break;
...@@ -129,22 +135,26 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -129,22 +135,26 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
msg = AddHotkeyName( _( "Move Rectangle" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Rectangle" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_rectangle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
KiBitmap( move_rectangle_xpm ) );
} }
msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); msg = AddHotkeyName( _( "Edit Rectangle Options" ), s_Libedit_Hokeys_Descr, HK_EDIT );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_rectangle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg,
KiBitmap( options_rectangle_xpm ) );
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
{ {
msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Rectangle Edge" ), s_Libedit_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_rectangle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg,
KiBitmap( move_rectangle_xpm ) );
} }
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
{ {
msg = AddHotkeyName( _( "Delete Rectangle" ), s_Libedit_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Rectangle" ), s_Libedit_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_rectangle_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg,
KiBitmap( delete_rectangle_xpm ) );
} }
break; break;
...@@ -154,7 +164,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -154,7 +164,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
msg = AddHotkeyName( _( "Move Text" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Text" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
KiBitmap( move_text_xpm ) );
} }
msg = AddHotkeyName( _( "Edit Text" ), s_Libedit_Hokeys_Descr, HK_EDIT ); msg = AddHotkeyName( _( "Edit Text" ), s_Libedit_Hokeys_Descr, HK_EDIT );
...@@ -175,23 +186,27 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -175,23 +186,27 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
msg = AddHotkeyName( _( "Move Line" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Line" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_line_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
KiBitmap( move_line_xpm ) );
msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr, HK_DRAG ); msg = AddHotkeyName( _( "Drag Edge Point" ), s_Libedit_Hokeys_Descr, HK_DRAG );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_line_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MODIFY_ITEM, msg, KiBitmap( move_line_xpm ) );
} }
if( item->IsNew() ) if( item->IsNew() )
{ {
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, _( "Line End" ), KiBitmap( apply_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_END_CREATE_ITEM, _( "Line End" ),
KiBitmap( apply_xpm ) );
} }
msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr, HK_EDIT ); msg = AddHotkeyName( _( "Edit Line Options" ), s_Libedit_Hokeys_Descr, HK_EDIT );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg, KiBitmap( options_segment_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_BODY_EDIT_ITEM, msg,
KiBitmap( options_segment_xpm ) );
if( item->GetFlags() == 0 ) if( item->GetFlags() == 0 )
{ {
msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Line " ), s_Libedit_Hokeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg, KiBitmap( delete_segment_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_DELETE_ITEM, msg,
KiBitmap( delete_segment_xpm ) );
} }
else if( item->IsNew() ) else if( item->IsNew() )
{ {
...@@ -210,7 +225,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -210,7 +225,8 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
msg = AddHotkeyName( _( "Move Field" ), s_Libedit_Hokeys_Descr, msg = AddHotkeyName( _( "Move Field" ), s_Libedit_Hokeys_Descr,
HK_LIBEDIT_MOVE_GRAPHIC_ITEM ); HK_LIBEDIT_MOVE_GRAPHIC_ITEM );
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg, KiBitmap( move_field_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST, msg,
KiBitmap( move_field_xpm ) );
} }
msg = AddHotkeyName( _( "Field Rotate" ), s_Libedit_Hokeys_Descr, HK_ROTATE ); msg = AddHotkeyName( _( "Field Rotate" ), s_Libedit_Hokeys_Descr, HK_ROTATE );
...@@ -280,9 +296,10 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame ) ...@@ -280,9 +296,10 @@ void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame ) void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame )
{ {
AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ), KiBitmap( cancel_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_LIBEDIT_CANCEL_EDITING, _( "Cancel Block" ),
KiBitmap( cancel_xpm ) );
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK,
_( "Zoom Block (drag middle mouse)" ), _( "Zoom Block (drag middle mouse)" ),
KiBitmap( zoom_area_xpm ) ); KiBitmap( zoom_area_xpm ) );
...@@ -291,13 +308,17 @@ void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame ) ...@@ -291,13 +308,17 @@ void AddMenusForBlock( wxMenu* PopMenu, LIB_EDIT_FRAME* frame )
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( apply_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( apply_xpm ) );
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
{ {
AddMenuItem( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ), KiBitmap( green_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_SELECT_ITEMS_BLOCK, _( "Select Items" ),
KiBitmap( green_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), KiBitmap( copyblock_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ), KiBitmap( copyblock_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ), KiBitmap( mirror_h_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_MIRROR_Y_BLOCK, _( "Mirror Block ||" ),
AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ), KiBitmap( mirror_v_xpm ) ); KiBitmap( mirror_h_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ), KiBitmap( rotate_ccw_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK, _( "Mirror Block --" ),
KiBitmap( mirror_v_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK, _( "Rotate Block ccw" ),
KiBitmap( rotate_ccw_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK, _( "Delete Block" ), KiBitmap( delete_xpm ) );
} }
} }
...@@ -795,48 +795,48 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -795,48 +795,48 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.SetCommand( BLOCK_COPY );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_SELECT_ITEMS_BLOCK: case ID_POPUP_SELECT_ITEMS_BLOCK:
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
GetScreen()->m_BlockLocate.m_Command = BLOCK_SELECT_ITEMS_ONLY; GetScreen()->m_BlockLocate.SetCommand( BLOCK_SELECT_ITEMS_ONLY );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_MIRROR_Y_BLOCK: case ID_POPUP_MIRROR_Y_BLOCK:
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_Y; GetScreen()->m_BlockLocate.SetCommand( BLOCK_MIRROR_Y );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X; GetScreen()->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
......
...@@ -674,14 +674,14 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame ) ...@@ -674,14 +674,14 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame )
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK, _( "Window Zoom" ), KiBitmap( zoom_area_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( apply_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( apply_xpm ) );
// After a block move (that is also a block selection) one can reselect // After a block move (that is also a block selection) one can reselect
// a block function. // a block function.
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) if( frame->GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE )
{ {
msg = AddHotkeyName( _( "Save Block" ), s_Schematic_Hokeys_Descr, msg = AddHotkeyName( _( "Save Block" ), s_Schematic_Hokeys_Descr,
HK_SAVE_BLOCK ); HK_SAVE_BLOCK );
......
...@@ -55,7 +55,7 @@ void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, in ...@@ -55,7 +55,7 @@ void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, in
/***********************************/ /***********************************/
/* dialogs/dialog_color_config.cpp */ /* dialogs/dialog_color_config.cpp */
/***********************************/ /***********************************/
EDA_Colors ReturnLayerColor( int Layer ); EDA_COLOR_T ReturnLayerColor( int Layer );
/***************/ /***************/
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
} }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_BITMAP" ); return wxT( "SCH_BITMAP" );
} }
...@@ -90,19 +90,11 @@ public: ...@@ -90,19 +90,11 @@ public:
*/ */
wxSize GetSize() const; wxSize GetSize() const;
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display
* purposes. This box should be an enclosing perimeter for visible
* components of this object, and the units should be in the pcb or
* schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
/** /**
...@@ -114,67 +106,39 @@ public: ...@@ -114,67 +106,39 @@ public:
*/ */
bool ReadImageFile( const wxString& aFullFilename ); bool ReadImageFile( const wxString& aFullFilename );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic junction entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic junction from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic junction.
* @return True if the schematic junction loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
virtual bool IsSelectStateChanged( const wxRect& aRect ); bool IsSelectStateChanged( const wxRect& aRect );
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const { return wxString( _( "Image" ) ); }
virtual wxString GetSelectMenuText() const { return wxString( _( "Image" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return image_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return image_xpm; }
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_Pos; }
virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const;
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */ void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
......
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
~SCH_BUS_ENTRY() { } ~SCH_BUS_ENTRY() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_BUS_ENTRY" ); return wxT( "SCH_BUS_ENTRY" );
} }
...@@ -83,96 +83,54 @@ public: ...@@ -83,96 +83,54 @@ public:
void SetSize( const wxSize& aSize ) { m_size = aSize; } void SetSize( const wxSize& aSize ) { m_size = aSize; }
virtual void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic bus entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic bus entry from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic bus entry.
* @return True if the schematic bus entry loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display
* purposes. This box should be an enclosing perimeter for visible
* components of this object, and the units should be in the pcb or
* schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** int GetPenSize() const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorY( int aYaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void MirrorX( int aXaxis_position );
virtual void Rotate( wxPoint aPosition );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ); void Rotate( wxPoint aPosition );
virtual bool IsSelectStateChanged( const wxRect& aRect ); void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
/** bool IsSelectStateChanged( const wxRect& aRect );
* @copydoc SCH_ITEM::IsConnectable()
*/ bool IsConnectable() const { return true; }
virtual bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_entry_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_entry_xpm; }
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_pos; }
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const;
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */ void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
......
...@@ -111,7 +111,7 @@ public: ...@@ -111,7 +111,7 @@ public:
~SCH_COMPONENT() { } ~SCH_COMPONENT() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_COMPONENT" ); return wxT( "SCH_COMPONENT" );
} }
...@@ -142,22 +142,9 @@ public: ...@@ -142,22 +142,9 @@ public:
*/ */
int GetPartCount() const; int GetPartCount() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic component from \a aLine in a .sch file.
*
* @param aLine Essentially this is file to read the component from.
* @param aErrorMsg Description of the error if an error occurs while loading the component.
* @return True if the component loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** /**
* Function SetOrientation * Function SetOrientation
...@@ -210,14 +197,6 @@ public: ...@@ -210,14 +197,6 @@ public:
*/ */
void SetTimeStamp( long aNewTimeStamp ); void SetTimeStamp( long aNewTimeStamp );
/**
* Function GetBoundingBox
* returns the bounding box of this object for display purposes. This box should be an
* enclosing perimeter for visible components of this object, and the units should be
* in the pcb or schematic coordinate system. It is OK to overestimate the size by a
* few counts.
* @return The bounding rectangle of the component.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
//-----<Fields>----------------------------------------------------------- //-----<Fields>-----------------------------------------------------------
...@@ -267,7 +246,7 @@ public: ...@@ -267,7 +246,7 @@ public:
*/ */
LIB_PIN* GetPin( const wxString& number ); LIB_PIN* GetPin( const wxString& number );
virtual void Draw( EDA_DRAW_PANEL* panel, void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
...@@ -283,7 +262,7 @@ public: ...@@ -283,7 +262,7 @@ public:
int Color, int Color,
bool DrawPinText ); bool DrawPinText );
virtual void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
// returns a unique ID, in the form of a path. // returns a unique ID, in the form of a path.
wxString GetPath( const SCH_SHEET_PATH* sheet ) const; wxString GetPath( const SCH_SHEET_PATH* sheet ) const;
...@@ -329,8 +308,7 @@ public: ...@@ -329,8 +308,7 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
if( aMoveVector == wxPoint( 0, 0 ) ) if( aMoveVector == wxPoint( 0, 0 ) )
return; return;
...@@ -343,31 +321,25 @@ public: ...@@ -343,31 +321,25 @@ public:
SetModified(); SetModified();
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/** bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
* @copydoc EDA_ITEM::Matches()
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ); void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
wxPoint GetPinPhysicalPosition( LIB_PIN* Pin ); wxPoint GetPinPhysicalPosition( LIB_PIN* Pin );
virtual bool IsSelectStateChanged( const wxRect& aRect ); bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** /**
...@@ -380,53 +352,40 @@ public: ...@@ -380,53 +352,40 @@ public:
*/ */
LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT ); LIB_ITEM* GetDrawItem( const wxPoint& aPosition, KICAD_T aType = TYPE_NOT_INIT );
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_component_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_component_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ); SCH_SHEET_PATH* aSheetPath );
virtual bool operator <( const SCH_ITEM& aItem ) const; bool operator <( const SCH_ITEM& aItem ) const;
bool operator==( const SCH_COMPONENT& aComponent) const; bool operator==( const SCH_COMPONENT& aComponent) const;
bool operator!=( const SCH_COMPONENT& aComponent) const; bool operator!=( const SCH_COMPONENT& aComponent) const;
SCH_ITEM& operator=( const SCH_ITEM& aItem ); SCH_ITEM& operator=( const SCH_ITEM& aItem );
/** bool IsReplaceable() const { return true; }
* @copydoc EDA_ITEM::IsReplaceable()
*/
virtual bool IsReplaceable() const { return true; }
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_Pos; }
virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition ) { Move( aPosition - m_Pos ); }
virtual void SetPosition( const wxPoint& aPosition ) { Move( aPosition - m_Pos ); }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const;
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */ void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */ bool doIsConnected( const wxPoint& aPosition ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
}; };
......
...@@ -133,7 +133,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -133,7 +133,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& offset, int DrawMode, int Color ) const wxPoint& offset, int DrawMode, int Color )
{ {
int orient; int orient;
EDA_Colors color; EDA_COLOR_T color;
wxPoint textpos; wxPoint textpos;
SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent; SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
int LineWidth = m_Thickness; int LineWidth = m_Thickness;
...@@ -537,7 +537,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) ...@@ -537,7 +537,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T, wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T,
wxT( "Cannot plot field with invalid parent." ) ); wxT( "Cannot plot field with invalid parent." ) );
EDA_Colors color = UNSPECIFIED_COLOR; EDA_COLOR_T color = UNSPECIFIED;
color = ReturnLayerColor( GetLayer() ); color = ReturnLayerColor( GetLayer() );
......
...@@ -66,7 +66,7 @@ public: ...@@ -66,7 +66,7 @@ public:
~SCH_FIELD(); ~SCH_FIELD();
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_FIELD" ); return wxT( "SCH_FIELD" );
} }
...@@ -94,7 +94,7 @@ public: ...@@ -94,7 +94,7 @@ public:
* *
* @return a const wxString object containing the field's string. * @return a const wxString object containing the field's string.
*/ */
virtual const wxString GetText() const; const wxString GetText() const;
void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); void Place( SCH_EDIT_FRAME* frame, wxDC* DC );
...@@ -111,13 +111,7 @@ public: ...@@ -111,13 +111,7 @@ public:
return len == 0 || ( len == 1 && m_Text[0] == wxChar( '~' ) ); return len == 0 || ( len == 1 && m_Text[0] == wxChar( '~' ) );
} }
/** void SwapData( SCH_ITEM* aItem );
* Function SwapData
* exchanges the date between the field and \a aItem
*
* @param aItem The field to exchange data with.
*/
virtual void SwapData( SCH_ITEM* aItem );
/** /**
* Function ImportValues * Function ImportValues
...@@ -127,10 +121,6 @@ public: ...@@ -127,10 +121,6 @@ public:
*/ */
void ImportValues( const LIB_FIELD& aSource ); void ImportValues( const LIB_FIELD& aSource );
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int GetPenSize() const; int GetPenSize() const;
/** /**
...@@ -143,44 +133,32 @@ public: ...@@ -143,44 +133,32 @@ public:
} }
/**
* Function Draw
*/
void Draw( EDA_DRAW_PANEL* aPanel, void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aOffset, const wxPoint& aOffset,
int aDrawMode, int aDrawMode,
int aColor = -1 ); int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/** /**
* @copydoc SCH_ITEM::MirrorX() * @copydoc SCH_ITEM::MirrorX()
* *
* This overload does nothing. Fields are never mirrored alone. They are moved * This overload does nothing. Fields are never mirrored alone. They are moved
* when the parent component is mirrored. This function is only needed by the * when the parent component is mirrored. This function is only needed by the
* virtual pure function of the master class. * pure function of the master class.
*/ */
virtual void MirrorX( int aXaxis_position ) void MirrorX( int aXaxis_position )
{ {
} }
...@@ -189,52 +167,33 @@ public: ...@@ -189,52 +167,33 @@ public:
* *
* This overload does nothing. Fields are never mirrored alone. They are moved * This overload does nothing. Fields are never mirrored alone. They are moved
* when the parent component is mirrored. This function is only needed by the * when the parent component is mirrored. This function is only needed by the
* virtual pure function of the master class. * pure function of the master class.
*/ */
virtual void MirrorY( int aYaxis_position ) void MirrorY( int aYaxis_position )
{ {
} }
/** bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*/
virtual bool Matches( wxFindReplaceData& aSearchData,
void* aAuxData, wxPoint* aFindLocation );
/** bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL );
* @copydoc EDA_ITEM::Replace(wxFindReplaceData&,void*)
*/
virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL );
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const;
virtual BITMAP_DEF GetMenuImage() const;
/** bool IsReplaceable() const { return true; }
* @copydoc EDA_ITEM::IsReplaceable()
*/
virtual bool IsReplaceable() const { return true; }
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const;
virtual wxPoint GetPosition() const;
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition );
virtual void SetPosition( const wxPoint& aPosition );
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const;
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */ void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
......
...@@ -45,103 +45,65 @@ public: ...@@ -45,103 +45,65 @@ public:
~SCH_JUNCTION() { } ~SCH_JUNCTION() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_JUNCTION" ); return wxT( "SCH_JUNCTION" );
} }
virtual void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display
* purposes. This box should be an enclosing perimeter for visible
* components of this object, and the units should be in the pcb or
* schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic junction entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic junction from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic junction.
* @return True if the schematic junction loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ); void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
virtual bool IsSelectStateChanged( const wxRect& aRect ); bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); }
virtual wxString GetSelectMenuText() const { return wxString( _( "Junction" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_junction_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_junction_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, SCH_SHEET_PATH* aSheetPath );
SCH_SHEET_PATH* aSheetPath );
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_pos; }
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false,
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const; int aAccuracy = 0 ) const;
void Plot( PLOTTER* aPlotter );
/** @copydoc SCH_ITEM::Plot() */ EDA_ITEM* Clone() const;
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */ bool doIsConnected( const wxPoint& aPosition ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
}; };
......
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
SCH_LINE* Next() const { return (SCH_LINE*) Pnext; } SCH_LINE* Next() const { return (SCH_LINE*) Pnext; }
SCH_LINE* Back() const { return (SCH_LINE*) Pback; } SCH_LINE* Back() const { return (SCH_LINE*) Pback; }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_LINE" ); return wxT( "SCH_LINE" );
} }
...@@ -76,13 +76,6 @@ public: ...@@ -76,13 +76,6 @@ public:
void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; } void SetEndPoint( const wxPoint& aPosition ) { m_end = aPosition; }
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** /**
...@@ -91,44 +84,22 @@ public: ...@@ -91,44 +84,22 @@ public:
*/ */
double GetLength() const; double GetLength() const;
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic line from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic line from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic line.
* @return True if the schematic line loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** int GetPenSize() const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector );
virtual void Move( const wxPoint& aMoveVector );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/** /**
* Check line against \a aLine to see if it overlaps and merge if it does. * Check line against \a aLine to see if it overlaps and merge if it does.
...@@ -142,59 +113,44 @@ public: ...@@ -142,59 +113,44 @@ public:
*/ */
bool MergeOverlap( SCH_LINE* aLine ); bool MergeOverlap( SCH_LINE* aLine );
virtual void GetEndPoints( vector <DANGLING_END_ITEM>& aItemList ); void GetEndPoints( vector <DANGLING_END_ITEM>& aItemList );
virtual bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList ); bool IsDanglingStateChanged( vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsDangling() const { return m_startIsDangling || m_endIsDangling; } bool IsDangling() const { return m_startIsDangling || m_endIsDangling; }
virtual bool IsSelectStateChanged( const wxRect& aRect ); bool IsSelectStateChanged( const wxRect& aRect );
/** bool IsConnectable() const;
* Function IsConnectable
* returns true if the schematic item can connect to another schematic item.
*/
virtual bool IsConnectable() const;
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const;
virtual BITMAP_DEF GetMenuImage() const;
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, SCH_SHEET_PATH* aSheetPath );
SCH_SHEET_PATH* aSheetPath );
virtual bool operator <( const SCH_ITEM& aItem ) const; bool operator <( const SCH_ITEM& aItem ) const;
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_start; }
virtual wxPoint GetPosition() const { return m_start; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition );
virtual void SetPosition( const wxPoint& aPosition );
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const;
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */ void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */ bool doIsConnected( const wxPoint& aPosition ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
}; };
......
...@@ -105,20 +105,20 @@ bool SCH_MARKER::Save( FILE* aFile ) const ...@@ -105,20 +105,20 @@ bool SCH_MARKER::Save( FILE* aFile ) const
void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aDrawMode, int aColor ) const wxPoint& aOffset, int aDrawMode, int aColor )
{ {
EDA_Colors color = (EDA_Colors) m_Color; EDA_COLOR_T color = (EDA_COLOR_T) m_Color;
EDA_Colors tmp = color; EDA_COLOR_T tmp = color;
if( GetMarkerType() == MARK_ERC ) if( GetMarkerType() == MARK_ERC )
{ {
color = ( GetErrorLevel() == WAR ) ? color = ( GetErrorLevel() == WAR ) ?
(EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_WARN] : (EDA_COLOR_T) g_LayerDescr.LayerColor[LAYER_ERC_WARN] :
(EDA_Colors) g_LayerDescr.LayerColor[LAYER_ERC_ERR]; (EDA_COLOR_T) g_LayerDescr.LayerColor[LAYER_ERC_ERR];
} }
if( aColor < 0 ) if( aColor < 0 )
m_Color = color; m_Color = color;
else else
m_Color = (EDA_Colors) aColor; m_Color = (EDA_COLOR_T) aColor;
DrawMarker( aPanel, aDC, aDrawMode, aOffset ); DrawMarker( aPanel, aDC, aDrawMode, aOffset );
m_Color = tmp; m_Color = tmp;
......
...@@ -61,49 +61,31 @@ public: ...@@ -61,49 +61,31 @@ public:
~SCH_MARKER(); ~SCH_MARKER();
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_MARKER" ); return wxT( "SCH_MARKER" );
} }
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDraw_mode, int aColor = -1 ); int aDraw_mode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** EDA_RECT GetBoundingBox() const;
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
virtual EDA_RECT GetBoundingBox() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/** /**
* Compare DRC marker main and auxiliary text against search string. * Compare DRC marker main and auxiliary text against search string.
...@@ -112,34 +94,23 @@ public: ...@@ -112,34 +94,23 @@ public:
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
* @return True if the DRC main or auxiliary text matches the search criteria. * @return True if the DRC main or auxiliary text matches the search criteria.
*/ */
virtual bool Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocation ); bool Matches( wxFindReplaceData& aSearchData, wxPoint* aFindLocation );
/**
* Show the marker electronics rule check error on the message panel.
*
* @param aFrame - Top window that owns the message panel.
*/
void DisplayInfo( EDA_DRAW_FRAME* aFrame ); void DisplayInfo( EDA_DRAW_FRAME* aFrame );
virtual bool IsSelectStateChanged( const wxRect& aRect ); bool IsSelectStateChanged( const wxRect& aRect );
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const { return wxString( _( "ERC Marker" ) ); }
virtual wxString GetSelectMenuText() const { return wxString( _( "ERC Marker" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return erc_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return erc_xpm; }
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_Pos; }
virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
......
...@@ -45,109 +45,67 @@ public: ...@@ -45,109 +45,67 @@ public:
~SCH_NO_CONNECT() { } ~SCH_NO_CONNECT() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_NO_CONNECT" ); return wxT( "SCH_NO_CONNECT" );
} }
/** int GetPenSize() const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
virtual void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic no connect entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic no connect from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic no connect.
* @return True if the schematic no connect loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display
* purposes. This box should be an enclosing perimeter for visible
* components of this object, and the units should be in the pcb or
* schematic coordinate system. It is OK to overestimate the size
* by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
virtual bool IsSelectStateChanged( const wxRect& aRect ); bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const { return wxString( _( "No Connect" ) ); }
virtual wxString GetSelectMenuText() const { return wxString( _( "No Connect" ) ); }
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return noconn_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return noconn_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, SCH_SHEET_PATH* aSheetPath );
SCH_SHEET_PATH* aSheetPath );
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_pos; }
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const;
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */ void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */ bool doIsConnected( const wxPoint& aPosition ) const;
virtual bool doIsConnected( const wxPoint& aPosition ) const;
}; };
......
...@@ -46,32 +46,17 @@ public: ...@@ -46,32 +46,17 @@ public:
~SCH_POLYLINE(); ~SCH_POLYLINE();
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_POLYLINE" ); return wxT( "SCH_POLYLINE" );
} }
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
int aDrawMode, int aColor = -1 ); int aDrawMode, int aColor = -1 );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic poly line entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic poly line from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic poly line.
* @return True if the schematic poly line loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** /**
* Function AddPoint * Function AddPoint
...@@ -106,33 +91,23 @@ public: ...@@ -106,33 +91,23 @@ public:
*/ */
unsigned GetCornerCount() const { return m_points.size(); } unsigned GetCornerCount() const { return m_points.size(); }
/** int GetPenSize() const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
m_points[ii] += aMoveVector; m_points[ii] += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const;
virtual BITMAP_DEF GetMenuImage() const;
/** /**
* Function operator[] * Function operator[]
...@@ -149,21 +124,16 @@ public: ...@@ -149,21 +124,16 @@ public:
return m_points[ aIndex ]; return m_points[ aIndex ];
} }
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_points[0]; }
virtual wxPoint GetPosition() const { return m_points[0]; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition );
virtual void SetPosition( const wxPoint& aPosition );
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false,
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const; int aAccuracy = 0 ) const;
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
......
...@@ -732,7 +732,7 @@ void SCH_SCREEN::SelectBlockItems() ...@@ -732,7 +732,7 @@ void SCH_SCREEN::SelectBlockItems()
{ {
SCH_ITEM* item; SCH_ITEM* item;
PICKED_ITEMS_LIST* pickedlist = &m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* pickedlist = &m_BlockLocate.GetItems();
if( pickedlist->GetCount() == 0 ) if( pickedlist->GetCount() == 0 )
return; return;
...@@ -750,7 +750,7 @@ void SCH_SCREEN::SelectBlockItems() ...@@ -750,7 +750,7 @@ void SCH_SCREEN::SelectBlockItems()
// Select all the items in the screen connected to the items in the block. // Select all the items in the screen connected to the items in the block.
// be sure end lines that are on the block limits are seen inside this block // be sure end lines that are on the block limits are seen inside this block
m_BlockLocate.Inflate(1); m_BlockLocate.Inflate( 1 );
unsigned last_select_id = pickedlist->GetCount(); unsigned last_select_id = pickedlist->GetCount();
unsigned ii = 0; unsigned ii = 0;
...@@ -789,7 +789,7 @@ void SCH_SCREEN::SelectBlockItems() ...@@ -789,7 +789,7 @@ void SCH_SCREEN::SelectBlockItems()
} }
} }
m_BlockLocate.Inflate(-1); m_BlockLocate.Inflate( -1 );
} }
...@@ -831,7 +831,7 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position ) ...@@ -831,7 +831,7 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
if( addinlist ) if( addinlist )
{ {
picker.SetFlags( item->GetFlags() ); picker.SetFlags( item->GetFlags() );
m_BlockLocate.m_ItemsSelection.PushItem( picker ); m_BlockLocate.GetItems().PushItem( picker );
} }
} }
} }
...@@ -841,7 +841,7 @@ int SCH_SCREEN::UpdatePickList() ...@@ -841,7 +841,7 @@ int SCH_SCREEN::UpdatePickList()
{ {
ITEM_PICKER picker; ITEM_PICKER picker;
EDA_RECT area; EDA_RECT area;
area.SetOrigin( m_BlockLocate.GetOrigin()); area.SetOrigin( m_BlockLocate.GetOrigin() );
area.SetSize( m_BlockLocate.GetSize() ); area.SetSize( m_BlockLocate.GetSize() );
area.Normalize(); area.Normalize();
......
...@@ -602,7 +602,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -602,7 +602,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
Text = wxT( "Sheet: " ) + m_name; Text = wxT( "Sheet: " ) + m_name;
DrawGraphicText( aPanel, aDC, pos_sheetname, DrawGraphicText( aPanel, aDC, pos_sheetname,
(EDA_Colors) txtcolor, Text, name_orientation, (EDA_COLOR_T) txtcolor, Text, name_orientation,
wxSize( m_sheetNameSize, m_sheetNameSize ), wxSize( m_sheetNameSize, m_sheetNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth,
false, false ); false, false );
...@@ -615,7 +615,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -615,7 +615,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
Text = wxT( "File: " ) + m_fileName; Text = wxT( "File: " ) + m_fileName;
DrawGraphicText( aPanel, aDC, pos_filename, DrawGraphicText( aPanel, aDC, pos_filename,
(EDA_Colors) txtcolor, Text, name_orientation, (EDA_COLOR_T) txtcolor, Text, name_orientation,
wxSize( m_fileNameSize, m_fileNameSize ), wxSize( m_fileNameSize, m_fileNameSize ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth,
false, false ); false, false );
...@@ -1104,7 +1104,7 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, ...@@ -1104,7 +1104,7 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
void SCH_SHEET::Plot( PLOTTER* aPlotter ) void SCH_SHEET::Plot( PLOTTER* aPlotter )
{ {
EDA_Colors txtcolor = UNSPECIFIED_COLOR; EDA_COLOR_T txtcolor = UNSPECIFIED;
wxSize size; wxSize size;
wxString Text; wxString Text;
int name_orientation; int name_orientation;
......
...@@ -87,14 +87,14 @@ public: ...@@ -87,14 +87,14 @@ public:
~SCH_SHEET_PIN() { } ~SCH_SHEET_PIN() { }
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_SHEET_PIN" ); return wxT( "SCH_SHEET_PIN" );
} }
bool operator ==( const SCH_SHEET_PIN* aPin ) const; bool operator ==( const SCH_SHEET_PIN* aPin ) const;
virtual void Draw( EDA_DRAW_PANEL* aPanel, void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aOffset, const wxPoint& aOffset,
int aDraw_mode, int aDraw_mode,
...@@ -106,9 +106,11 @@ public: ...@@ -106,9 +106,11 @@ public:
* @param aPoints = a buffer to fill with polygon corners coordinates * @param aPoints = a buffer to fill with polygon corners coordinates
* @param aPos = Position of the shape * @param aPos = Position of the shape
*/ */
virtual void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos ); void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos );
void SwapData( SCH_ITEM* aItem );
virtual void SwapData( SCH_ITEM* aItem ); int GetPenSize() const;
/** /**
* Get the sheet label number. * Get the sheet label number.
...@@ -143,87 +145,49 @@ public: ...@@ -143,87 +145,49 @@ public:
*/ */
SCH_SHEET* GetParent() const { return (SCH_SHEET*) m_Parent; } SCH_SHEET* GetParent() const { return (SCH_SHEET*) m_Parent; }
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic sheet hierarchical label from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read the sheet hierarchical label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the sheet
* hierarchical label.
* @return True if the sheet hierarchical label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
#endif #endif
/**
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
/** bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL )
* @copydoc EDA_ITEM::Replace(wxFindReplaceData&,void*)
*/
virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL )
{ {
return EDA_ITEM::Replace( aSearchData, m_Text ); return EDA_ITEM::Replace( aSearchData, m_Text );
} }
/** bool IsReplaceable() const { return true; }
* @copydoc EDA_ITEM::IsReplaceable()
*/
virtual bool IsReplaceable() const { return true; }
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ); void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_hierar_pin_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_hierar_pin_xpm; }
virtual void SetPosition( const wxPoint& aPosition ) { ConstrainOnEdge( aPosition ); } void SetPosition( const wxPoint& aPosition ) { ConstrainOnEdge( aPosition ); }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
}; };
...@@ -277,7 +241,7 @@ public: ...@@ -277,7 +241,7 @@ public:
~SCH_SHEET(); ~SCH_SHEET();
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_SHEET" ); return wxT( "SCH_SHEET" );
} }
...@@ -322,23 +286,9 @@ public: ...@@ -322,23 +286,9 @@ public:
*/ */
int GetScreenCount() const; int GetScreenCount() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic sheet from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read the component from.
* @param aErrorMsg - Description of the error if an error occurs while loading the sheet.
* @return True if the sheet loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
...@@ -439,32 +389,14 @@ public: ...@@ -439,32 +389,14 @@ public:
*/ */
int GetMinHeight() const; int GetMinHeight() const;
/** int GetPenSize() const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
virtual int GetPenSize() const;
/**
* Function Draw
* Draw the hierarchical sheet shape
* @param aPanel = the current DrawPanel
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually wxPoint(0,0))
* @param aDrawMode = draw mode
* @param aColor = color used to draw sheet. Usually -1 to use the normal
* color for sheet items
*/
void Draw( EDA_DRAW_PANEL* aPanel, void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aOffset, const wxPoint& aOffset,
int aDrawMode, int aDrawMode,
int aColor = -1 ); int aColor = -1 );
/**
* Function GetBoundingBox
* @return an EDA_RECT giving the bounding box of the sheet
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** /**
...@@ -475,7 +407,7 @@ public: ...@@ -475,7 +407,7 @@ public:
*/ */
wxPoint GetResizePosition() const; wxPoint GetResizePosition() const;
virtual void SwapData( SCH_ITEM* aItem ); void SwapData( SCH_ITEM* aItem );
/** /**
* Function ComponentCount * Function ComponentCount
...@@ -547,8 +479,7 @@ public: ...@@ -547,8 +479,7 @@ public:
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** @copydoc SCH_ITEM::Move() */ void Move( const wxPoint& aMoveVector )
virtual void Move( const wxPoint& aMoveVector )
{ {
m_pos += aMoveVector; m_pos += aMoveVector;
...@@ -558,29 +489,17 @@ public: ...@@ -558,29 +489,17 @@ public:
} }
} }
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/** bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
/** bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL );
* @copydoc EDA_ITEM::Replace(wxFindReplaceData&,void*)
*/
virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL );
/** bool IsReplaceable() const { return true; }
* @copydoc EDA_ITEM::IsReplaceable()
*/
virtual bool IsReplaceable() const { return true; }
/** /**
* Resize this sheet to aSize and adjust all of the labels accordingly. * Resize this sheet to aSize and adjust all of the labels accordingly.
...@@ -601,50 +520,41 @@ public: ...@@ -601,50 +520,41 @@ public:
*/ */
wxPoint GetFileNamePosition(); wxPoint GetFileNamePosition();
virtual void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList ); void GetEndPoints( std::vector <DANGLING_END_ITEM>& aItemList );
virtual bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList ); bool IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemList );
virtual bool IsDangling() const; bool IsDangling() const;
virtual bool IsSelectStateChanged( const wxRect& aRect ); bool IsSelectStateChanged( const wxRect& aRect );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
virtual void GetConnectionPoints( vector< wxPoint >& aPoints ) const; void GetConnectionPoints( vector< wxPoint >& aPoints ) const;
virtual SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_hierarchical_subsheet_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_subsheet_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ); SCH_SHEET_PATH* aSheetPath );
SCH_ITEM& operator=( const SCH_ITEM& aSheet ); SCH_ITEM& operator=( const SCH_ITEM& aSheet );
/** @copydoc SCH_ITEM::GetPosition() */ wxPoint GetPosition() const { return m_pos; }
virtual wxPoint GetPosition() const { return m_pos; }
/** @copydoc SCH_ITEM::SetPosition() */ void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
virtual void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */ bool HitTest( const EDA_RECT& aRect, bool aContained = false, int aAccuracy = 0 ) const;
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */ void Plot( PLOTTER* aPlotter );
virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override void Show( int nestLevel, std::ostream& os ) const; // override
......
...@@ -372,13 +372,13 @@ int SCH_TEXT::GetPenSize() const ...@@ -372,13 +372,13 @@ int SCH_TEXT::GetPenSize() const
void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
int DrawMode, int Color ) int DrawMode, int Color )
{ {
EDA_Colors color; EDA_COLOR_T color;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( Color >= 0 ) if( Color >= 0 )
color = (EDA_Colors) Color; color = (EDA_COLOR_T) Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
...@@ -386,7 +386,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, ...@@ -386,7 +386,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
wxPoint text_offset = aOffset + GetSchematicTextOffset(); wxPoint text_offset = aOffset + GetSchematicTextOffset();
EXCHG( linewidth, m_Thickness ); // Set the minimum width EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED );
EXCHG( linewidth, m_Thickness ); // set initial value EXCHG( linewidth, m_Thickness ); // set initial value
if( m_isDangling ) if( m_isDangling )
...@@ -687,7 +687,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) ...@@ -687,7 +687,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
EDA_Colors color = ReturnLayerColor( GetLayer() ); EDA_COLOR_T color = ReturnLayerColor( GetLayer() );
wxPoint textpos = m_Pos + GetSchematicTextOffset(); wxPoint textpos = m_Pos + GetSchematicTextOffset();
int thickness = GetPenSize(); int thickness = GetPenSize();
...@@ -1195,11 +1195,11 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1195,11 +1195,11 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
int Color ) int Color )
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
EDA_Colors color; EDA_COLOR_T color;
wxPoint text_offset = aOffset + GetSchematicTextOffset(); wxPoint text_offset = aOffset + GetSchematicTextOffset();
if( Color >= 0 ) if( Color >= 0 )
color = (EDA_Colors) Color; color = (EDA_COLOR_T) Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
...@@ -1208,7 +1208,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1208,7 +1208,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
int linewidth = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = (m_Thickness == 0) ? g_DrawDefaultLineThickness : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
EXCHG( linewidth, m_Thickness ); // Set the minimum width EXCHG( linewidth, m_Thickness ); // Set the minimum width
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED );
EXCHG( linewidth, m_Thickness ); // set initial value EXCHG( linewidth, m_Thickness ); // set initial value
CreateGraphicShape( Poly, m_Pos + aOffset ); CreateGraphicShape( Poly, m_Pos + aOffset );
...@@ -1525,13 +1525,13 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1525,13 +1525,13 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
int Color ) int Color )
{ {
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
EDA_Colors color; EDA_COLOR_T color;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness; int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness;
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
if( Color >= 0 ) if( Color >= 0 )
color = (EDA_Colors) Color; color = (EDA_COLOR_T) Color;
else else
color = ReturnLayerColor( m_Layer ); color = ReturnLayerColor( m_Layer );
...@@ -1539,7 +1539,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, ...@@ -1539,7 +1539,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
EXCHG( linewidth, m_Thickness ); // Set the minimum width EXCHG( linewidth, m_Thickness ); // Set the minimum width
wxPoint text_offset = offset + GetSchematicTextOffset(); wxPoint text_offset = offset + GetSchematicTextOffset();
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED );
EXCHG( linewidth, m_Thickness ); // set initial value EXCHG( linewidth, m_Thickness ); // set initial value
CreateGraphicShape( Poly, m_Pos + offset ); CreateGraphicShape( Poly, m_Pos + offset );
......
...@@ -109,8 +109,7 @@ public: ...@@ -109,8 +109,7 @@ public:
* @param aSchematicOrientation = * @param aSchematicOrientation =
* 0 = normal (horizontal, left justified). * 0 = normal (horizontal, left justified).
* 1 = up (vertical) * 1 = up (vertical)
* 2 = (horizontal, right justified). This can be seen as the mirrored * 2 = (horizontal, right justified). This can be seen as the mirrored position of 0
* position of 0
* 3 = bottom . This can be seen as the mirrored position of up * 3 = bottom . This can be seen as the mirrored position of up
*/ */
virtual void SetOrientation( int aSchematicOrientation ); virtual void SetOrientation( int aSchematicOrientation );
...@@ -139,9 +138,8 @@ public: ...@@ -139,9 +138,8 @@ public:
/** /**
* Function CreateGraphicShape * Function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param aPoints = a buffer to fill with polygon corners coordinates * @param aPoints A buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape * @param Pos Position of the shape, for texts and labels: do nothing
* for texts and labels: do nothing
* Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels) * Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels)
*/ */
virtual void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos ) virtual void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos )
...@@ -151,73 +149,34 @@ public: ...@@ -151,73 +149,34 @@ public:
virtual void SwapData( SCH_ITEM* aItem ); virtual void SwapData( SCH_ITEM* aItem );
/** virtual EDA_RECT GetBoundingBox() const;
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_RECT GetBoundingBox() const;
/** virtual bool Save( FILE* aFile ) const;
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const;
/**
* Load schematic text entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic text from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic text.
* @return True if the schematic text loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ); virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/** virtual int GetPenSize() const;
* Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item
*/
int GetPenSize() const;
// Geometric transforms (used in block operations): // Geometric transforms (used in block operations):
/** @copydoc SCH_ITEM::Move() */
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** @copydoc SCH_ITEM::MirrorY() */
virtual void MirrorY( int aYaxis_position ); virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */
virtual void MirrorX( int aXaxis_position ); virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */
virtual void Rotate( wxPoint aPosition ); virtual void Rotate( wxPoint aPosition );
/**
* @copydoc EDA_ITEM::Matches(wxFindReplaceData&,void*,wxPoint*)
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
/**
* @copydoc EDA_ITEM::Replace(wxFindReplaceData&,void*)
*/
virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) virtual bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL )
{ {
return EDA_ITEM::Replace( aSearchData, m_Text ); return EDA_ITEM::Replace( aSearchData, m_Text );
} }
/**
* @copydoc EDA_ITEM::IsReplaceable()
*/
virtual bool IsReplaceable() const { return true; } virtual bool IsReplaceable() const { return true; }
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ); virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList );
...@@ -232,32 +191,24 @@ public: ...@@ -232,32 +191,24 @@ public:
virtual bool CanIncrementLabel() const { return true; } virtual bool CanIncrementLabel() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */
virtual wxString GetSelectMenuText() const; virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */
virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; }
virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems, virtual void GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
SCH_SHEET_PATH* aSheetPath ); SCH_SHEET_PATH* aSheetPath );
/** @copydoc SCH_ITEM::GetPosition() */
virtual wxPoint GetPosition() const { return m_Pos; } virtual wxPoint GetPosition() const { return m_Pos; }
/** @copydoc SCH_ITEM::SetPosition() */
virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; } virtual void SetPosition( const wxPoint& aPosition ) { m_Pos = aPosition; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc SCH_ITEM::HitTest(const EDA_RECT&,bool,int)const */
virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false, virtual bool HitTest( const EDA_RECT& aRect, bool aContained = false,
int aAccuracy = 0 ) const; int aAccuracy = 0 ) const;
/** @copydoc SCH_ITEM::Plot() */
virtual void Plot( PLOTTER* aPlotter ); virtual void Plot( PLOTTER* aPlotter );
/** @copydoc EDA_ITEM::Clone() */
virtual EDA_ITEM* Clone() const; virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
...@@ -275,98 +226,45 @@ public: ...@@ -275,98 +226,45 @@ public:
~SCH_LABEL() { } ~SCH_LABEL() { }
virtual void Draw( EDA_DRAW_PANEL* panel, void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_LABEL" ); return wxT( "SCH_LABEL" );
} }
/** void SetOrientation( int aSchematicOrientation );
* Function SetOrientation
* Set m_schematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_schematicOrientation (for a label)
* must be called after changing m_schematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, right justified). This can be seen as the mirrored
* position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
virtual void SetOrientation( int aSchematicOrientation );
/** wxPoint GetSchematicTextOffset() const;
* Function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself
* position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a
* wire)
*/
virtual wxPoint GetSchematicTextOffset() const;
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic label entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic label.
* @return True if the schematic label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_line_label_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_line_label_xpm; }
/** bool IsReplaceable() const { return true; }
* @copydoc EDA_ITEM::IsReplaceable()
*/
virtual bool IsReplaceable() const { return true; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */ bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
}; };
...@@ -379,104 +277,47 @@ public: ...@@ -379,104 +277,47 @@ public:
~SCH_GLOBALLABEL() { } ~SCH_GLOBALLABEL() { }
virtual void Draw( EDA_DRAW_PANEL* panel, void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_GLOBALLABEL" ); return wxT( "SCH_GLOBALLABEL" );
} }
/** void SetOrientation( int aSchematicOrientation );
* Function SetOrientation
* Set m_schematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_schematicOrientation
* must be called after changing m_schematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, right justified). This can be seen as the mirrored
* position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
virtual void SetOrientation( int aSchematicOrientation );
/** wxPoint GetSchematicTextOffset() const;
* Function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself
* position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a
* wire)
*/
virtual wxPoint GetSchematicTextOffset() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic global label entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic global label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic global label.
* @return True if the schematic global label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos );
* Function CreateGraphicShape (virual)
* Calculates the graphic shape (a polygon) associated to the text
* @param aPoints = a buffer to fill with polygon corners coordinates
* @param aPos = Position of the shape
*/
virtual void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos );
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_glabel_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_glabel_xpm; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */ bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
}; };
...@@ -491,104 +332,47 @@ public: ...@@ -491,104 +332,47 @@ public:
~SCH_HIERLABEL() { } ~SCH_HIERLABEL() { }
virtual void Draw( EDA_DRAW_PANEL* panel, void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC, wxDC* DC,
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
virtual wxString GetClass() const wxString GetClass() const
{ {
return wxT( "SCH_HIERLABEL" ); return wxT( "SCH_HIERLABEL" );
} }
/** void SetOrientation( int aSchematicOrientation );
* Function SetOrientation
* Set m_schematicOrientation, and initialize
* m_orient,m_HJustified and m_VJustified, according to the value of
* m_schematicOrientation
* must be called after changing m_schematicOrientation
* @param aSchematicOrientation =
* 0 = normal (horizontal, left justified).
* 1 = up (vertical)
* 2 = (horizontal, right justified). This can be seen as the mirrored
* position of 0
* 3 = bottom . This can be seen as the mirrored position of up
*/
virtual void SetOrientation( int aSchematicOrientation );
/** wxPoint GetSchematicTextOffset() const;
* Function GetSchematicTextOffset (virtual)
* @return the offset between the SCH_TEXT position and the text itself
* position
* This offset depend on orientation, and the type of text
* (room to draw an associated graphic symbol, or put the text above a
* wire)
*/
virtual wxPoint GetSchematicTextOffset() const;
/** void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos );
* Function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param aPoints = a buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape
*/
virtual void CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.sch"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** bool Load( LINE_READER& aLine, wxString& aErrorMsg );
* Load schematic hierarchical label entry from \a aLine in a .sch file.
*
* @param aLine - Essentially this is file to read schematic hierarchical label from.
* @param aErrorMsg - Description of the error if an error occurs while loading the
* schematic hierarchical label.
* @return True if the schematic hierarchical label loaded successfully.
*/
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** @copydoc SCH_ITEM::MirrorY() */ void MirrorY( int aYaxis_position );
virtual void MirrorY( int aYaxis_position );
/** @copydoc SCH_ITEM::MirrorX() */ void MirrorX( int aXaxis_position );
virtual void MirrorX( int aXaxis_position );
/** @copydoc SCH_ITEM::Rotate() */ void Rotate( wxPoint aPosition );
virtual void Rotate( wxPoint aPosition );
virtual bool IsConnectable() const { return true; } bool IsConnectable() const { return true; }
/** @copydoc EDA_ITEM::GetSelectMenuText() */ wxString GetSelectMenuText() const;
virtual wxString GetSelectMenuText() const;
/** @copydoc EDA_ITEM::GetMenuImage() */ BITMAP_DEF GetMenuImage() const { return add_hierarchical_label_xpm; }
virtual BITMAP_DEF GetMenuImage() const { return add_hierarchical_label_xpm; }
/** @copydoc SCH_ITEM::HitTest(const wxPoint&,int)const */ bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
virtual bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
private: private:
/** @copydoc SCH_ITEM::doIsConnected() */ bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
virtual bool doIsConnected( const wxPoint& aPosition ) const { return m_Pos == aPosition; }
}; };
#endif /* CLASS_TEXT_LABEL_H */ #endif /* CLASS_TEXT_LABEL_H */
...@@ -121,7 +121,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -121,7 +121,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case wxID_CUT: case wxID_CUT:
if( screen->m_BlockLocate.m_Command != BLOCK_MOVE ) if( screen->m_BlockLocate.GetCommand() != BLOCK_MOVE )
break; break;
HandleBlockEndByPopUp( BLOCK_DELETE, &dc ); HandleBlockEndByPopUp( BLOCK_DELETE, &dc );
...@@ -717,7 +717,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent ) ...@@ -717,7 +717,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
if( item == NULL ) if( item == NULL )
{ {
// Allows block rotate operation on hot key. // Allows block rotate operation on hot key.
if( screen->m_BlockLocate.m_State != STATE_NO_BLOCK ) if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{ {
HandleBlockEndByPopUp( BLOCK_ROTATE, &dc ); HandleBlockEndByPopUp( BLOCK_ROTATE, &dc );
return; return;
...@@ -909,7 +909,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent ) ...@@ -909,7 +909,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
// The easiest way to handle a drag component or sheet command // The easiest way to handle a drag component or sheet command
// is to simulate a block drag command // is to simulate a block drag command
if( screen->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{ {
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) ) if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) )
break; break;
...@@ -941,7 +941,7 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent ) ...@@ -941,7 +941,7 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
if( item == NULL ) if( item == NULL )
{ {
// Allows block rotate operation on hot key. // Allows block rotate operation on hot key.
if( screen->m_BlockLocate.m_State != STATE_NO_BLOCK ) if( screen->m_BlockLocate.GetState() != STATE_NO_BLOCK )
{ {
if( aEvent.GetId() == ID_SCH_MIRROR_X ) if( aEvent.GetId() == ID_SCH_MIRROR_X )
HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc ); HandleBlockEndByPopUp( BLOCK_MIRROR_X, &dc );
......
...@@ -572,7 +572,7 @@ void SCH_EDIT_FRAME::OnModify() ...@@ -572,7 +572,7 @@ void SCH_EDIT_FRAME::OnModify()
void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event ) void SCH_EDIT_FRAME::OnUpdateBlockSelected( wxUpdateUIEvent& event )
{ {
bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ); bool enable = ( GetScreen() && GetScreen()->m_BlockLocate.GetCommand() == BLOCK_MOVE );
event.Enable( enable ); event.Enable( enable );
} }
......
...@@ -79,9 +79,9 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -79,9 +79,9 @@ void GERBVIEW_FRAME::HandleBlockPlace( wxDC* DC )
{ {
wxASSERT( m_canvas->IsMouseCaptured() ); wxASSERT( m_canvas->IsMouseCaptured() );
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
...@@ -133,11 +133,11 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -133,11 +133,11 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
if( m_canvas->IsMouseCaptured() ) if( m_canvas->IsMouseCaptured() )
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
nextcmd = true; nextcmd = true;
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
...@@ -145,7 +145,7 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -145,7 +145,7 @@ bool GERBVIEW_FRAME::HandleBlockEnd( wxDC* DC )
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
Block_Delete( DC ); Block_Delete( DC );
break; break;
...@@ -197,31 +197,31 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -197,31 +197,31 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
{ {
screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color ); screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
if( screen->m_BlockLocate.m_MoveVector.x|| screen->m_BlockLocate.m_MoveVector.y ) if( screen->m_BlockLocate.GetMoveVector().x|| screen->m_BlockLocate.GetMoveVector().y )
{ {
screen->m_BlockLocate.Draw( aPanel, screen->m_BlockLocate.Draw( aPanel,
aDC, aDC,
screen->m_BlockLocate.m_MoveVector, screen->m_BlockLocate.GetMoveVector(),
g_XorMode, g_XorMode,
Color ); Color );
} }
} }
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP ) if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
{ {
screen->m_BlockLocate.m_MoveVector.x = screen->GetCrossHairPosition().x - screen->m_BlockLocate.SetMoveVector( wxPoint( screen->GetCrossHairPosition().x -
screen->m_BlockLocate.GetRight(); screen->m_BlockLocate.GetRight(),
screen->m_BlockLocate.m_MoveVector.y = screen->GetCrossHairPosition().y - screen->GetCrossHairPosition().y -
screen->m_BlockLocate.GetBottom(); screen->m_BlockLocate.GetBottom() ) );
} }
screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color ); screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) if( screen->m_BlockLocate.GetMoveVector().x || screen->m_BlockLocate.GetMoveVector().y )
{ {
screen->m_BlockLocate.Draw( aPanel, screen->m_BlockLocate.Draw( aPanel,
aDC, aDC,
screen->m_BlockLocate.m_MoveVector, screen->m_BlockLocate.GetMoveVector(),
g_XorMode, g_XorMode,
Color ); Color );
} }
...@@ -239,10 +239,12 @@ void GERBVIEW_FRAME::Block_Delete( wxDC* DC ) ...@@ -239,10 +239,12 @@ void GERBVIEW_FRAME::Block_Delete( wxDC* DC )
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
BOARD_ITEM* nextitem; BOARD_ITEM* nextitem;
for( ; item; item = nextitem ) for( ; item; item = nextitem )
{ {
nextitem = item->Next(); nextitem = item->Next();
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item; GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) ) if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
gerb_item->DeleteStructure(); gerb_item->DeleteStructure();
} }
...@@ -265,13 +267,15 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC ) ...@@ -265,13 +267,15 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
GetScreen()->m_BlockLocate.Normalize(); GetScreen()->m_BlockLocate.Normalize();
/* Calculate displacement vectors. */ /* Calculate displacement vectors. */
delta = GetScreen()->m_BlockLocate.m_MoveVector; delta = GetScreen()->m_BlockLocate.GetMoveVector();
/* Move items in block */ /* Move items in block */
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
for( ; item; item = item->Next() ) for( ; item; item = item->Next() )
{ {
GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item; GERBER_DRAW_ITEM* gerb_item = (GERBER_DRAW_ITEM*) item;
if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) ) if( gerb_item->HitTest( GetScreen()->m_BlockLocate ) )
gerb_item->MoveAB( delta ); gerb_item->MoveAB( delta );
} }
...@@ -293,7 +297,7 @@ void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC ) ...@@ -293,7 +297,7 @@ void GERBVIEW_FRAME::Block_Duplicate( wxDC* DC )
GetScreen()->SetModify(); GetScreen()->SetModify();
GetScreen()->m_BlockLocate.Normalize(); GetScreen()->m_BlockLocate.Normalize();
delta = GetScreen()->m_BlockLocate.m_MoveVector; delta = GetScreen()->m_BlockLocate.GetMoveVector();
/* Copy items in block */ /* Copy items in block */
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
......
...@@ -406,7 +406,7 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode ) ...@@ -406,7 +406,7 @@ void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, int aDrawMode )
int color = g_ColorsSettings.GetItemColor( DCODES_VISIBLE ); int color = g_ColorsSettings.GetItemColor( DCODES_VISIBLE );
DrawGraphicText( m_canvas, aDC, pos, (EDA_Colors) color, Line, DrawGraphicText( m_canvas, aDC, pos, (EDA_COLOR_T) color, Line,
orient, wxSize( width, width ), orient, wxSize( width, width ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
0, false, false ); 0, false, false );
......
...@@ -129,11 +129,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -129,11 +129,11 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_CANCEL_CURRENT_COMMAND: case ID_POPUP_CANCEL_CURRENT_COMMAND:
m_canvas->EndMouseCapture(); m_canvas->EndMouseCapture();
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
{ {
/* Should not be executed, except bug */ /* Should not be executed, except bug */
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
} }
...@@ -182,19 +182,19 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -182,19 +182,19 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
......
...@@ -17,7 +17,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) ...@@ -17,7 +17,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
{ {
BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem(); BOARD_ITEM* DrawStruct = GetScreen()->GetCurItem();
wxString msg; wxString msg;
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = !GetScreen()->m_BlockLocate.IsIdle();
bool busy = DrawStruct && DrawStruct->GetFlags(); bool busy = DrawStruct && DrawStruct->GetFlags();
// Do not initiate a start block validation on menu. // Do not initiate a start block validation on menu.
......
...@@ -95,7 +95,6 @@ enum KICAD_T { ...@@ -95,7 +95,6 @@ enum KICAD_T {
// General // General
SCH_SCREEN_T, SCH_SCREEN_T,
BLOCK_LOCATE_STRUCT_TYPE,
/* /*
* Draw items in library component. * Draw items in library component.
...@@ -881,12 +880,12 @@ public: ...@@ -881,12 +880,12 @@ public:
* @param aColor = text color * @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplay_mode = LINE, FILLED or SKETCH * @param aDisplay_mode = LINE, FILLED or SKETCH
* @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param aAnchor_color = anchor color ( UNSPECIFIED = do not draw anchor ).
*/ */
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_COLOR_T aColor,
int aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE, int aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = LINE,
EDA_Colors aAnchor_color = UNSPECIFIED_COLOR ); EDA_COLOR_T aAnchor_color = UNSPECIFIED );
private: private:
...@@ -900,14 +899,14 @@ private: ...@@ -900,14 +899,14 @@ private:
* @param aColor = text color * @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode. * @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aFillMode = LINE, FILLED or SKETCH * @param aFillMode = LINE, FILLED or SKETCH
* @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ). * @param aAnchor_color = anchor color ( UNSPECIFIED = do not draw anchor ).
* @param aText = the single line of text to draw. * @param aText = the single line of text to draw.
* @param aPos = the position of this line ). * @param aPos = the position of this line ).
*/ */
void DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aOffset, EDA_Colors aColor, const wxPoint& aOffset, EDA_COLOR_T aColor,
int aDrawMode, EDA_DRAW_MODE_T aFillMode, int aDrawMode, EDA_DRAW_MODE_T aFillMode,
EDA_Colors aAnchor_color, wxString& aText, EDA_COLOR_T aAnchor_color, wxString& aText,
wxPoint aPos ); wxPoint aPos );
public: public:
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/** /**
* This file is part of the common library. * This file is part of the common library.
* @file block_commande.h * @file block_commande.h
...@@ -5,24 +29,13 @@ ...@@ -5,24 +29,13 @@
*/ */
#ifndef __INCLUDE__BLOCK_COMMANDE_H__ #ifndef __INCLUDE__BLOCK_COMMANDE_H__
#define __INCLUDE__BLOCK_COMMANDE_H__ 1 #define __INCLUDE__BLOCK_COMMANDE_H__
#include <base_struct.h> #include <base_struct.h>
#include <class_undoredo_container.h> #include <class_undoredo_container.h>
// Forward declarations:
/**************************/
/* class BLOCK_SELECTOR */
/**************************/
/**
* class BLOCK_SELECTOR is used to handle block selection and commands
*/
/* Block state codes. */ /* Block state codes. */
typedef enum { typedef enum {
STATE_NO_BLOCK, STATE_NO_BLOCK,
...@@ -30,7 +43,7 @@ typedef enum { ...@@ -30,7 +43,7 @@ typedef enum {
STATE_BLOCK_END, STATE_BLOCK_END,
STATE_BLOCK_MOVE, STATE_BLOCK_MOVE,
STATE_BLOCK_STOP STATE_BLOCK_STOP
} BlockState; } BLOCK_STATE_T;
/* Block command codes. */ /* Block command codes. */
...@@ -50,32 +63,50 @@ typedef enum { ...@@ -50,32 +63,50 @@ typedef enum {
BLOCK_SELECT_ITEMS_ONLY, BLOCK_SELECT_ITEMS_ONLY,
BLOCK_MIRROR_X, BLOCK_MIRROR_X,
BLOCK_MIRROR_Y BLOCK_MIRROR_Y
} CmdBlockType; } BLOCK_COMMAND_T;
class BLOCK_SELECTOR : public EDA_RECT class BLOCK_SELECTOR : public EDA_RECT
{ {
public: BLOCK_STATE_T m_state; //< State (enum BLOCK_STATE_T) of the block.
BlockState m_State; /* State (enum BlockState) BLOCK_COMMAND_T m_command; //< Command (enum BLOCK_COMMAND_T) operation.
* of the block */ PICKED_ITEMS_LIST m_items; //< List of items selected in this block.
CmdBlockType m_Command; /* Type (enum CmdBlockType) EDA_COLOR_T m_color; //< Block Color (for drawings).
* operation */ wxPoint m_moveVector; //< Move distance to move the block.
PICKED_ITEMS_LIST m_ItemsSelection; /* list of items selected wxPoint m_lastCursorPosition; //< Last Mouse position in block command
* in this block */ //< last cursor position in move commands
int m_Color; /* Block Color (for //< 0,0 in paste command.
* drawings) */
wxPoint m_MoveVector; /* Move distance in move,
* drag, copy ... command */
wxPoint m_BlockLastCursorPosition; /* Last Mouse position in
* block command
* = last cursor position in
* move commands
* = 0,0 in block paste */
public: public:
BLOCK_SELECTOR(); BLOCK_SELECTOR();
~BLOCK_SELECTOR(); ~BLOCK_SELECTOR();
void SetState( BLOCK_STATE_T aState ) { m_state = aState; }
BLOCK_STATE_T GetState() const { return m_state; }
void SetCommand( BLOCK_COMMAND_T aCommand ) { m_command = aCommand; }
BLOCK_COMMAND_T GetCommand() const { return m_command; }
void SetColor( EDA_COLOR_T aColor ) { m_color = aColor; }
EDA_COLOR_T GetColor() const { return m_color; }
/**
* Function SetLastCursorPosition
* sets the last cursor position to \a aPosition.
*
* @param aPosition The current cursor position.
*/
void SetLastCursorPosition( const wxPoint& aPosition ) { m_lastCursorPosition = aPosition; }
wxPoint GetLastCursorPosition() const { return m_lastCursorPosition; }
void SetMoveVector( const wxPoint& aMoveVector ) { m_moveVector = aMoveVector; }
wxPoint GetMoveVector() const { return m_moveVector; }
/** /**
* Function InitData * Function InitData
* sets the initial values of a BLOCK_SELECTOR, before starting a block * sets the initial values of a BLOCK_SELECTOR, before starting a block
...@@ -90,13 +121,14 @@ public: ...@@ -90,13 +121,14 @@ public:
void SetMessageBlock( EDA_DRAW_FRAME* frame ); void SetMessageBlock( EDA_DRAW_FRAME* frame );
void Draw( EDA_DRAW_PANEL* aPanel, void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, const wxPoint& aOffset, wxDC* aDC,
const wxPoint& aOffset,
int aDrawMode, int aDrawMode,
int aColor ); int aColor );
/** /**
* Function PushItem * Function PushItem
* adds aItem to the list of items * adds \a aItem to the list of items.
* @param aItem = an ITEM_PICKER to add to the list * @param aItem = an ITEM_PICKER to add to the list
*/ */
void PushItem( ITEM_PICKER& aItem ); void PushItem( ITEM_PICKER& aItem );
...@@ -108,34 +140,39 @@ public: ...@@ -108,34 +140,39 @@ public:
*/ */
void ClearListAndDeleteItems(); void ClearListAndDeleteItems();
/**
* Function ClearItemsList
* clear only the list of #EDA_ITEM pointers, it does _NOT_ delete the #EDA_ITEM object
* itself
*/
void ClearItemsList(); void ClearItemsList();
unsigned GetCount() unsigned GetCount()
{ {
return m_ItemsSelection.GetCount(); return m_items.GetCount();
} }
/** PICKED_ITEMS_LIST& GetItems() { return m_items; }
* Function SetLastCursorPosition
* sets m_BlockLastCursorPosition EDA_ITEM* GetItem( unsigned aIndex )
* @param aPosition = new position
**/
void SetLastCursorPosition( wxPoint aPosition )
{ {
m_BlockLastCursorPosition = aPosition; if( aIndex < m_items.GetCount() )
return m_items.GetPickedItem( aIndex );
return NULL;
} }
/** /**
* Function IsDragging * Function IsDragging
* returns true if the current block command is a drag operation. * returns true if the current block command is a drag operation.
*/ */
bool IsDragging() const { return m_Command == BLOCK_DRAG; } bool IsDragging() const { return m_command == BLOCK_DRAG; }
/** /**
* Function IsIdle * Function IsIdle
* returns true if there is currently no block operation in progress. * returns true if there is currently no block operation in progress.
*/ */
inline bool IsIdle() const { return m_Command == BLOCK_IDLE; } inline bool IsIdle() const { return m_command == BLOCK_IDLE; }
/** /**
* Function Clear * Function Clear
...@@ -146,16 +183,19 @@ public: ...@@ -146,16 +183,19 @@ public:
}; };
/* Cancel Current block operation. /**
* Function AbortBlockCurrentCommand
* cancels the current block operation.
*/ */
void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC ); void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
/* Redraw the outlines of the block which shows the search area for block /**
* commands * Function DrawAndSizingBlockOutlines
* The first point of the rectangle showing the area is initialized * redraws the outlines of the block which shows the search area for block commands.
* by InitBlockLocateDatas(). *
* The other point of the rectangle is the mouse cursor * The first point of the rectangle showing the area is initialized by InitBlockLocateDatas().
* The other point of the rectangle is the mouse cursor position.
*/ */
void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ); bool aErase );
......
...@@ -14,7 +14,7 @@ public: ...@@ -14,7 +14,7 @@ public:
protected: protected:
std::vector <wxPoint> m_Corners; ///< Corner list for shape definition (a polygon) std::vector <wxPoint> m_Corners; ///< Corner list for shape definition (a polygon)
int m_MarkerType; ///< Can be used as a flag int m_MarkerType; ///< Can be used as a flag
EDA_Colors m_Color; ///< color EDA_COLOR_T m_Color; ///< color
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
///< to the position of the shape, used for Hit ///< to the position of the shape, used for Hit
///< Tests ///< Tests
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
* Function SetColor * Function SetColor
* Set the color of this marker * Set the color of this marker
*/ */
void SetColor( EDA_Colors aColor ) void SetColor( EDA_COLOR_T aColor )
{ {
m_Color = aColor; m_Color = aColor;
} }
......
...@@ -41,9 +41,9 @@ static inline int GetAlpha( int aColor ) ...@@ -41,9 +41,9 @@ static inline int GetAlpha( int aColor )
} }
enum EDA_Colors enum EDA_COLOR_T
{ {
UNSPECIFIED_COLOR = -1, UNSPECIFIED = -1,
BLACK = 0, BLACK = 0,
BLUE, BLUE,
GREEN, GREEN,
......
...@@ -52,7 +52,7 @@ int NegableTextLength( const wxString& aText ); ...@@ -52,7 +52,7 @@ int NegableTextLength( const wxString& aText );
* @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas * @param aPanel = the current DrawPanel. NULL if draw within a 3D GL Canvas
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas * @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify) * @param aPos = text position (according to h_justify, v_justify)
* @param aColor (enum EDA_Colors) = text color * @param aColor (enum EDA_COLOR_T) = text color
* @param aText = text to draw * @param aText = text to draw
* @param aOrient = angle in 0.1 degree * @param aOrient = angle in 0.1 degree
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts) * @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
...@@ -71,7 +71,7 @@ int NegableTextLength( const wxString& aText ); ...@@ -71,7 +71,7 @@ int NegableTextLength( const wxString& aText );
void DrawGraphicText( EDA_DRAW_PANEL * aPanel, void DrawGraphicText( EDA_DRAW_PANEL * aPanel,
wxDC * aDC, wxDC * aDC,
const wxPoint &aPos, const wxPoint &aPos,
enum EDA_Colors aColor, enum EDA_COLOR_T aColor,
const wxString &aText, const wxString &aText,
int aOrient, int aOrient,
const wxSize &aSize, const wxSize &aSize,
......
...@@ -166,7 +166,7 @@ void GRClosedPoly( EDA_RECT* ClipBox, ...@@ -166,7 +166,7 @@ void GRClosedPoly( EDA_RECT* ClipBox,
* @param y The y coordinate in user space of the center of the circle. * @param y The y coordinate in user space of the center of the circle.
* @param aRadius is the radius of the circle. * @param aRadius is the radius of the circle.
* @param aColor is an index into our color table of RGB colors. * @param aColor is an index into our color table of RGB colors.
* @see EDA_Colors and colors.h * @see EDA_COLOR_T and colors.h
*/ */
void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, int aColor ); void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, int aColor );
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, int Color ); void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, int Color );
...@@ -227,7 +227,7 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, ...@@ -227,7 +227,7 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
* @param aLines = a list of pair of coordinate in user space: a pair for each line. * @param aLines = a list of pair of coordinate in user space: a pair for each line.
* @param aWidth = the width of each line. * @param aWidth = the width of each line.
* @param aColor = an index into our color table of RGB colors. * @param aColor = an index into our color table of RGB colors.
* @see EDA_Colors and colors.h * @see EDA_COLOR_T and colors.h
*/ */
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector<wxPoint>& aLines, void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector<wxPoint>& aLines,
int aWidth, int aColor ); int aWidth, int aColor );
......
...@@ -179,7 +179,7 @@ public: ...@@ -179,7 +179,7 @@ public:
} }
void text( const wxPoint& aPos, void text( const wxPoint& aPos,
enum EDA_Colors aColor, enum EDA_COLOR_T aColor,
const wxString& aText, const wxString& aText,
int aOrient, int aOrient,
const wxSize& aSize, const wxSize& aSize,
......
...@@ -688,8 +688,8 @@ public: ...@@ -688,8 +688,8 @@ public:
*/ */
void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB, void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb, wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_Colors aClr1 = RED, int aNScr, int aScr, int aLnW, EDA_COLOR_T aClr1 = RED,
EDA_Colors aClr2 = RED ); EDA_COLOR_T aClr2 = RED );
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen ); void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen );
...@@ -741,13 +741,20 @@ public: ...@@ -741,13 +741,20 @@ public:
/* Handlers for block commands */ /* Handlers for block commands */
virtual void InitBlockPasteInfos(); virtual void InitBlockPasteInfos();
virtual bool HandleBlockBegin( wxDC* DC, int cmd_type,const wxPoint& startpos );
/**
* Function HandleBlockBegin
* initializes the block command including the command type, initial position,
* and other variables.
*/
virtual bool HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosition );
/** /**
* Function ReturnBlockCommand * Function ReturnBlockCommand
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...) * Returns the block command code (BLOCK_MOVE, BLOCK_COPY...) corresponding to the
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when * keys pressed (ALT, SHIFT, SHIFT ALT ..) when block command is started by dragging
* block command is started by dragging the mouse. * the mouse.
*
* @param aKey = the key modifiers (Alt, Shift ...) * @param aKey = the key modifiers (Alt, Shift ...)
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...) * @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
*/ */
......
...@@ -224,9 +224,9 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -224,9 +224,9 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
DisplayError( this, wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
...@@ -276,7 +276,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -276,7 +276,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
bool cancelCmd = false; bool cancelCmd = false;
// If coming here after cancel block, clean up and exit // If coming here after cancel block, clean up and exit
if( GetScreen()->m_BlockLocate.m_State == STATE_NO_BLOCK ) if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
{ {
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString,
false ); false );
...@@ -286,7 +286,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -286,7 +286,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
// Show dialog if there are no selected items and we're not zooming // Show dialog if there are no selected items and we're not zooming
if( !GetScreen()->m_BlockLocate.GetCount() if( !GetScreen()->m_BlockLocate.GetCount()
&& GetScreen()->m_BlockLocate.m_Command != BLOCK_ZOOM ) && GetScreen()->m_BlockLocate.GetCommand() != BLOCK_ZOOM )
{ {
if( InstallBlockCmdFrame( this, _( "Block Operation" ) ) == false ) if( InstallBlockCmdFrame( this, _( "Block Operation" ) ) == false )
{ {
...@@ -308,7 +308,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -308,7 +308,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( !cancelCmd && m_canvas->IsMouseCaptured() ) if( !cancelCmd && m_canvas->IsMouseCaptured() )
{ {
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
...@@ -318,7 +318,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -318,7 +318,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
nextcmd = true; nextcmd = true;
m_canvas->SetMouseCaptureCallback( drawMovingBlock ); m_canvas->SetMouseCaptureCallback( drawMovingBlock );
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
...@@ -326,24 +326,25 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -326,24 +326,25 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
m_canvas->SetMouseCaptureCallback( NULL ); m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Delete(); Block_Delete();
break; break;
case BLOCK_ROTATE: /* Rotation */ case BLOCK_ROTATE: /* Rotation */
m_canvas->SetMouseCaptureCallback( NULL ); m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Rotate(); Block_Rotate();
break; break;
case BLOCK_FLIP: /* Flip */ case BLOCK_FLIP: /* Flip */
m_canvas->SetMouseCaptureCallback( NULL ); m_canvas->SetMouseCaptureCallback( NULL );
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
Block_Flip(); Block_Flip();
break; break;
case BLOCK_SAVE: /* Save (not used, for future enhancements)*/ case BLOCK_SAVE: /* Save (not used, for future enhancements)*/
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
if( GetScreen()->m_BlockLocate.GetCount() ) if( GetScreen()->m_BlockLocate.GetCount() )
{ {
// @todo (if useful) Save_Block( ); // @todo (if useful) Save_Block( );
...@@ -383,7 +384,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -383,7 +384,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
GetScreen()->m_BlockLocate.Normalize(); GetScreen()->m_BlockLocate.Normalize();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
ITEM_PICKER picker( NULL, UR_UNSPECIFIED ); ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
// Add modules // Add modules
...@@ -435,7 +436,9 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -435,7 +436,9 @@ void PCB_EDIT_FRAME::Block_SelectItems()
{ {
if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers) if( !m_Pcb->IsLayerVisible( PtStruct->GetLayer() ) && ! blockIncludeItemsOnInvisibleLayers)
continue; continue;
bool select_me = false; bool select_me = false;
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
case PCB_LINE_T: case PCB_LINE_T:
...@@ -513,7 +516,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() ...@@ -513,7 +516,7 @@ void PCB_EDIT_FRAME::Block_SelectItems()
static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset ) static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset )
{ {
PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &aPanel->GetScreen()->m_BlockLocate.GetItems();
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent(); PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) aPanel->GetParent();
g_Offset_Module = -aOffset; g_Offset_Module = -aOffset;
...@@ -560,29 +563,30 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a ...@@ -560,29 +563,30 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( aErase ) if( aErase )
{ {
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) if( screen->m_BlockLocate.GetMoveVector().x || screen->m_BlockLocate.GetMoveVector().y )
{ {
screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.GetMoveVector(),
GR_XOR, BLOCK_OUTLINE_COLOR ); GR_XOR, BLOCK_OUTLINE_COLOR );
if( blockDrawItems ) if( blockDrawItems )
drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); drawPickedItems( aPanel, aDC, screen->m_BlockLocate.GetMoveVector() );
} }
} }
if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP )
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
{ {
screen->m_BlockLocate.m_MoveVector = screen->GetCrossHairPosition() - screen->m_BlockLocate.SetMoveVector( screen->GetCrossHairPosition() -
screen->m_BlockLocate.m_BlockLastCursorPosition; screen->m_BlockLocate.GetLastCursorPosition() );
} }
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) if( screen->m_BlockLocate.GetMoveVector().x || screen->m_BlockLocate.GetMoveVector().y )
{ {
screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.GetMoveVector(),
GR_XOR, BLOCK_OUTLINE_COLOR ); GR_XOR, BLOCK_OUTLINE_COLOR );
if( blockDrawItems ) if( blockDrawItems )
drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); drawPickedItems( aPanel, aDC, screen->m_BlockLocate.GetMoveVector() );
} }
} }
...@@ -592,7 +596,7 @@ void PCB_EDIT_FRAME::Block_Delete() ...@@ -592,7 +596,7 @@ void PCB_EDIT_FRAME::Block_Delete()
OnModify(); OnModify();
SetCurItem( NULL ); SetCurItem( NULL );
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_DELETED; itemsList->m_Status = UR_DELETED;
/* unlink items and clear flags */ /* unlink items and clear flags */
...@@ -658,7 +662,7 @@ void PCB_EDIT_FRAME::Block_Rotate() ...@@ -658,7 +662,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
OnModify(); OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_ROTATED; itemsList->m_Status = UR_ROTATED;
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ ) for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
...@@ -715,7 +719,7 @@ void PCB_EDIT_FRAME::Block_Flip() ...@@ -715,7 +719,7 @@ void PCB_EDIT_FRAME::Block_Flip()
OnModify(); OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_FLIPPED; itemsList->m_Status = UR_FLIPPED;
memo = GetScreen()->GetCrossHairPosition(); memo = GetScreen()->GetCrossHairPosition();
...@@ -772,9 +776,9 @@ void PCB_EDIT_FRAME::Block_Move() ...@@ -772,9 +776,9 @@ void PCB_EDIT_FRAME::Block_Move()
{ {
OnModify(); OnModify();
wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector; wxPoint MoveVector = GetScreen()->m_BlockLocate.GetMoveVector();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
itemsList->m_Status = UR_MOVED; itemsList->m_Status = UR_MOVED;
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ ) for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
...@@ -824,11 +828,11 @@ void PCB_EDIT_FRAME::Block_Move() ...@@ -824,11 +828,11 @@ void PCB_EDIT_FRAME::Block_Move()
void PCB_EDIT_FRAME::Block_Duplicate() void PCB_EDIT_FRAME::Block_Duplicate()
{ {
wxPoint MoveVector = GetScreen()->m_BlockLocate.m_MoveVector; wxPoint MoveVector = GetScreen()->m_BlockLocate.GetMoveVector();
OnModify(); OnModify();
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection; PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
PICKED_ITEMS_LIST newList; PICKED_ITEMS_LIST newList;
newList.m_Status = UR_NEW; newList.m_Status = UR_NEW;
......
...@@ -124,18 +124,18 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -124,18 +124,18 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( GetScreen()->m_BlockLocate.GetCount() ) if( GetScreen()->m_BlockLocate.GetCount() )
{ {
BlockState state = GetScreen()->m_BlockLocate.m_State; BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
CmdBlockType command = GetScreen()->m_BlockLocate.m_Command; BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
m_canvas->CallEndMouseCapture( DC ); m_canvas->CallEndMouseCapture( DC );
GetScreen()->m_BlockLocate.m_State = state; GetScreen()->m_BlockLocate.SetState( state );
GetScreen()->m_BlockLocate.m_Command = command; GetScreen()->m_BlockLocate.SetCommand( command );
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand ); m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(), GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
GetScreen()->m_BlockLocate.GetBottom() ) ); GetScreen()->m_BlockLocate.GetBottom() ) );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
} }
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
DisplayError( this, wxT( "Error in HandleBlockPLace" ) ); DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
...@@ -157,15 +157,16 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -157,15 +157,16 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false ); m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
} }
break; break;
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
nextcmd = true; nextcmd = true;
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines ); m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_MOVE; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
break; break;
case BLOCK_DELETE: /* Delete */ case BLOCK_DELETE: /* Delete */
...@@ -215,7 +216,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC ) ...@@ -215,7 +216,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( !nextcmd ) if( !nextcmd )
{ {
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY ) if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_SELECT_ITEMS_ONLY )
{ {
ClearMarkItems( currentModule ); ClearMarkItems( currentModule );
} }
...@@ -240,9 +241,9 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -240,9 +241,9 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) ); DisplayError( this, wxT( "HandleBlockPLace : m_mouseCaptureCallback = NULL" ) );
} }
GetScreen()->m_BlockLocate.m_State = STATE_BLOCK_STOP; GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
switch( GetScreen()->m_BlockLocate.m_Command ) switch( GetScreen()->m_BlockLocate.GetCommand() )
{ {
case BLOCK_IDLE: case BLOCK_IDLE:
break; break;
...@@ -252,14 +253,14 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -252,14 +253,14 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/ case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.m_MoveVector ); MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
break; break;
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
SaveCopyInUndoList( currentModule, UR_MODEDIT ); SaveCopyInUndoList( currentModule, UR_MODEDIT );
CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.m_MoveVector ); CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
break; break;
case BLOCK_PASTE: /* Paste */ case BLOCK_PASTE: /* Paste */
...@@ -288,8 +289,8 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -288,8 +289,8 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify(); OnModify();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
SetCurItem( NULL ); SetCurItem( NULL );
m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false ); m_canvas->EndMouseCapture( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString, false );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
...@@ -302,24 +303,24 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC ) ...@@ -302,24 +303,24 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
BLOCK_SELECTOR* PtBlock; BLOCK_SELECTOR* block;
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
BOARD_ITEM* item; BOARD_ITEM* item;
wxPoint move_offset; wxPoint move_offset;
MODULE* currentModule = MODULE* currentModule =
( (PCB_BASE_FRAME*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules; ( (PCB_BASE_FRAME*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules;
PtBlock = &screen->m_BlockLocate; block = &screen->m_BlockLocate;
GRSetDrawMode( aDC, g_XorMode ); GRSetDrawMode( aDC, g_XorMode );
if( aErase ) if( aErase )
{ {
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
if( currentModule ) if( currentModule )
{ {
move_offset.x = -PtBlock->m_MoveVector.x; move_offset.x = -block->GetMoveVector().x;
move_offset.y = -PtBlock->m_MoveVector.y; move_offset.y = -block->GetMoveVector().y;
item = currentModule->m_Drawings; item = currentModule->m_Drawings;
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
...@@ -352,14 +353,14 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx ...@@ -352,14 +353,14 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
} }
/* Repaint new view. */ /* Repaint new view. */
PtBlock->m_MoveVector = screen->GetCrossHairPosition() - PtBlock->m_BlockLastCursorPosition; block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
if( currentModule ) if( currentModule )
{ {
item = currentModule->m_Drawings; item = currentModule->m_Drawings;
move_offset = - PtBlock->m_MoveVector; move_offset = - block->GetMoveVector();
for( ; item != NULL; item = item->Next() ) for( ; item != NULL; item = item->Next() )
{ {
......
...@@ -73,11 +73,6 @@ public: ...@@ -73,11 +73,6 @@ public:
m_Text.SetSize( aTextSize ); m_Text.SetSize( aTextSize );
} }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ); void SetLayer( int aLayer );
void SetShape( int aShape ) { m_Shape = aShape; } void SetShape( int aShape ) { m_Shape = aShape; }
...@@ -95,12 +90,6 @@ public: ...@@ -95,12 +90,6 @@ public:
bool ReadDimensionDescr( LINE_READER* aReader ); bool ReadDimensionDescr( LINE_READER* aReader );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
void SetText( const wxString& NewText ); void SetText( const wxString& NewText );
...@@ -117,20 +106,9 @@ public: ...@@ -117,20 +106,9 @@ public:
*/ */
void Move( const wxPoint& offset ); void Move( const wxPoint& offset );
/** void Rotate( const wxPoint& aRotCentre, double aAngle );
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** void Flip( const wxPoint& aCentre );
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
virtual void Flip( const wxPoint& aCentre );
/** /**
* Function Mirror * Function Mirror
...@@ -141,26 +119,12 @@ public: ...@@ -141,26 +119,12 @@ public:
*/ */
void Mirror( const wxPoint& axis_pos ); void Mirror( const wxPoint& axis_pos );
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_ITEM.
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** @copydoc EDA_ITEM::HitTest(const EDA_RECT&)const */ bool HitTest( const EDA_RECT& aRect ) const;
virtual bool HitTest( const EDA_RECT& aRect ) const;
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const wxString GetClass() const
{ {
return wxT( "DIMENSION" ); return wxT( "DIMENSION" );
...@@ -168,12 +132,11 @@ public: ...@@ -168,12 +132,11 @@ public:
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return add_dimension_xpm; } BITMAP_DEF GetMenuImage() const { return add_dimension_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
......
...@@ -152,12 +152,6 @@ public: ...@@ -152,12 +152,6 @@ public:
m_PolyPoints = aPoints; m_PolyPoints = aPoints;
} }
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
bool ReadDrawSegmentDescr( LINE_READER* aReader ); bool ReadDrawSegmentDescr( LINE_READER* aReader );
...@@ -167,35 +161,14 @@ public: ...@@ -167,35 +161,14 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
int aDrawMode, const wxPoint& aOffset = ZeroOffset ); int aDrawMode, const wxPoint& aOffset = ZeroOffset );
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_ITEM.
* @param frame A PCB_BASE_FRAME in which to print status information.
*/
virtual void DisplayInfo( EDA_DRAW_FRAME* frame ); virtual void DisplayInfo( EDA_DRAW_FRAME* frame );
/**
* Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes.
* This box should be an enclosing perimeter for visible components of this
* object, and the units should be in the pcb or schematic coordinate system.
* It is OK to overestimate the size by a few counts.
*/
virtual EDA_RECT GetBoundingBox() const; virtual EDA_RECT GetBoundingBox() const;
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */
virtual bool HitTest( const wxPoint& aPosition ); virtual bool HitTest( const wxPoint& aPosition );
/** @copydoc EDA_ITEM::HitTest(const EDA_RECT&)const */
virtual bool HitTest( const EDA_RECT& aRect ) const; virtual bool HitTest( const EDA_RECT& aRect ) const;
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const wxString GetClass() const
{ {
return wxT( "DRAWSEGMENT" ); return wxT( "DRAWSEGMENT" );
...@@ -213,30 +186,14 @@ public: ...@@ -213,30 +186,14 @@ public:
return hypot( double( delta.x ), double( delta.y ) ); return hypot( double( delta.x ), double( delta.y ) );
} }
/**
* Function Move
* move this object.
* @param aMoveVector - the move vector for this object.
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Start += aMoveVector; m_Start += aMoveVector;
m_End += aMoveVector; m_End += aMoveVector;
} }
/**
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate( const wxPoint& aRotCentre, double aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
virtual void Flip( const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
/** /**
...@@ -260,7 +217,6 @@ public: ...@@ -260,7 +217,6 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return add_dashed_line_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_dashed_line_xpm; }
/** @copydoc EDA_ITEM::Clone() */
virtual EDA_ITEM* Clone() const; virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
......
...@@ -64,12 +64,6 @@ public: ...@@ -64,12 +64,6 @@ public:
void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; } void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; }
const wxPoint& GetEnd0() const { return m_End0; } const wxPoint& GetEnd0() const { return m_End0; }
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
int ReadDescr( LINE_READER* aReader ); int ReadDescr( LINE_READER* aReader );
...@@ -82,33 +76,20 @@ public: ...@@ -82,33 +76,20 @@ public:
void Draw3D( EDA_3D_CANVAS* glcanvas ); void Draw3D( EDA_3D_CANVAS* glcanvas );
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_ITEM.
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** wxString GetClass() const
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{ {
return wxT( "MGRAPHIC" ); return wxT( "MGRAPHIC" );
// return wxT( "EDGE" ); ? // return wxT( "EDGE" ); ?
} }
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return show_mod_edge_xpm; } BITMAP_DEF GetMenuImage() const { return show_mod_edge_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload void Show( int nestLevel, std::ostream& os ) const; // overload
......
...@@ -43,34 +43,15 @@ public: ...@@ -43,34 +43,15 @@ public:
~MARKER_PCB(); ~MARKER_PCB();
/** void Move(const wxPoint& aMoveVector)
* Function Move
* move this object.
* @param aMoveVector - the move vector for this object.
*/
virtual void Move(const wxPoint& aMoveVector)
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** void Rotate( const wxPoint& aRotCentre, double aAngle );
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** void Flip( const wxPoint& aCentre );
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
virtual void Flip( const wxPoint& aCentre );
/**
* Function Draw
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode,
const wxPoint& aOffset = ZeroOffset ) const wxPoint& aOffset = ZeroOffset )
{ {
...@@ -80,36 +61,15 @@ public: ...@@ -80,36 +61,15 @@ public:
const wxPoint& GetPosition() const { return m_Pos; } const wxPoint& GetPosition() const { return m_Pos; }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; }
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition )
virtual bool HitTest( const wxPoint& aPosition )
{ {
return HitTestMarker( aPosition ); return HitTestMarker( aPosition );
} }
/** bool IsOnLayer( int aLayer ) const;
* Function IsOnLayer
* tests to see if this object is on the given layer.
* DRC markers are not really on a copper layer, but
* IsOnCopperLayer return true if aLayer is a cooper layer
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
virtual bool IsOnLayer( int aLayer ) const;
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const bool Save( FILE* aFile ) const
{ {
// not implemented, this is here to satisfy BOARD_ITEM::Save() // not implemented, this is here to satisfy BOARD_ITEM::Save()
...@@ -117,9 +77,9 @@ public: ...@@ -117,9 +77,9 @@ public:
return true; return true;
} }
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return drc_xpm; } BITMAP_DEF GetMenuImage() const { return drc_xpm; }
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
......
...@@ -77,37 +77,15 @@ public: ...@@ -77,37 +77,15 @@ public:
*/ */
void Exchg( PCB_TARGET* aTarget ); void Exchg( PCB_TARGET* aTarget );
/** void Move( const wxPoint& aMoveVector )
* Function Move
* move this object.
* @param aMoveVector - the move vector for this object.
*/
virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** void Rotate( const wxPoint& aRotCentre, double aAngle );
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** void Flip( const wxPoint& aCentre );
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
virtual void Flip( const wxPoint& aCentre );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
bool ReadMirePcbDescr( LINE_READER* aReader ); bool ReadMirePcbDescr( LINE_READER* aReader );
...@@ -117,20 +95,17 @@ public: ...@@ -117,20 +95,17 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
const wxPoint& offset = ZeroOffset ); const wxPoint& offset = ZeroOffset );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** @copydoc EDA_ITEM::HitTest(const EDA_RECT&)const */ bool HitTest( const EDA_RECT& aRect ) const;
virtual bool HitTest( const EDA_RECT& aRect ) const;
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return add_mires_xpm; } BITMAP_DEF GetMenuImage() const { return add_mires_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
......
...@@ -156,13 +156,6 @@ public: ...@@ -156,13 +156,6 @@ public:
*/ */
EDA_RECT GetFootPrintRect() const; EDA_RECT GetFootPrintRect() const;
/**
* Function GetBoundingBox
* returns the bounding box of this
* footprint. Mainly used to redraw the screen area occupied by
* the footprint.
* @return EDA_RECT - The rectangle containing the footprint and texts.
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
void SetPosition( const wxPoint& aPos ); // was overload void SetPosition( const wxPoint& aPos ); // was overload
...@@ -207,33 +200,12 @@ public: ...@@ -207,33 +200,12 @@ public:
int GetAttributes() const { return m_Attributs; } int GetAttributes() const { return m_Attributs; }
void SetAttributes( int aAttributes ) { m_Attributs = aAttributes; } void SetAttributes( int aAttributes ) { m_Attributs = aAttributes; }
/** void Move( const wxPoint& aMoveVector );
* Function Move
* move this object.
* @param aMoveVector - the move vector for this object.
*/
virtual void Move( const wxPoint& aMoveVector );
/** void Rotate( const wxPoint& aRotCentre, double aAngle );
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** void Flip( const wxPoint& aCentre );
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
virtual void Flip( const wxPoint& aCentre );
/**
* Function IsLocked
* (virtual from BOARD_ITEM )
* @return bool - true if the MODULE is locked, else false
*/
bool IsLocked() const bool IsLocked() const
{ {
return (m_ModuleStatus & MODULE_is_LOCKED) != 0; return (m_ModuleStatus & MODULE_is_LOCKED) != 0;
...@@ -266,13 +238,6 @@ public: ...@@ -266,13 +238,6 @@ public:
/* Reading and writing data on files */ /* Reading and writing data on files */
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
int Write_3D_Descr( FILE* File ) const; int Write_3D_Descr( FILE* File ) const;
...@@ -292,14 +257,6 @@ public: ...@@ -292,14 +257,6 @@ public:
/* drawing functions */ /* drawing functions */
/**
* Function Draw
* Draw the text according to the footprint pos and orient
* @param aPanel = draw panel, Used to know the clip box
* @param aDC = Current Device Context
* @param aDrawMode = GR_OR, GR_XOR..
* @param aOffset = draw offset (usually wxPoint(0,0)
*/
void Draw( EDA_DRAW_PANEL* aPanel, void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
int aDrawMode, int aDrawMode,
...@@ -312,19 +269,11 @@ public: ...@@ -312,19 +269,11 @@ public:
void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, void DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& offset, int dim_ancre, int draw_mode ); const wxPoint& offset, int dim_ancre, int draw_mode );
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** @copydoc EDA_ITEM::HitTest(const EDA_RECT&)const */ bool HitTest( const EDA_RECT& aRect ) const;
virtual bool HitTest( const EDA_RECT& aRect ) const;
/** /**
* Function GetReference * Function GetReference
...@@ -383,38 +332,19 @@ public: ...@@ -383,38 +332,19 @@ public:
*/ */
D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS ); D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
/**
* Function Visit
* should be re-implemented for each derived class in order to handle
* all the types given by its member data. Implementations should call
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
* to do so on lists of such data.
* @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** wxString GetClass() const
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{ {
return wxT( "MODULE" ); return wxT( "MODULE" );
} }
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return module_xpm; } BITMAP_DEF GetMenuImage() const { return module_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload void Show( int nestLevel, std::ostream& os ) const; // overload
......
...@@ -164,14 +164,6 @@ public: ...@@ -164,14 +164,6 @@ public:
void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; } void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; }
const wxPoint& GetOffset() const { return m_Offset; } const wxPoint& GetOffset() const { return m_Offset; }
/**
* Function Flip
* flips this pad to the other outter most copper layer, back to front or
* vice versa, and does this vertically, so the x coordinate is not affected.
*
* @param aTranslationY is the contribution of my 'y' position provided by
* my parent module.
*/
void Flip( int aTranslationY ); void Flip( int aTranslationY );
/** /**
...@@ -239,7 +231,7 @@ public: ...@@ -239,7 +231,7 @@ public:
* @param aItem is another BOARD_CONNECTED_ITEM or NULL * @param aItem is another BOARD_CONNECTED_ITEM or NULL
* @return int - the clearance in internal units. * @return int - the clearance in internal units.
*/ */
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const; int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
// Mask margins handling: // Mask margins handling:
...@@ -278,23 +270,10 @@ public: ...@@ -278,23 +270,10 @@ public:
/* Reading and writing data on files */ /* Reading and writing data on files */
int ReadDescr( LINE_READER* aReader ); int ReadDescr( LINE_READER* aReader );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/* drawing functions */ /* drawing functions */
/**
* Draw a pad:
* @param aPanel = the EDA_DRAW_PANEL panel
* @param aDC = the current device context
* @param aDrawMode = mode: GR_OR, GR_XOR, GR_AND...
* @param aOffset = draw offset
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int aDrawMode, const wxPoint& aOffset = ZeroOffset ); int aDrawMode, const wxPoint& aOffset = ZeroOffset );
...@@ -367,43 +346,17 @@ public: ...@@ -367,43 +346,17 @@ public:
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; } void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_ITEM.
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so
* objects like D_PAD, which reside on multiple layers can do their own
* form of testing.
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
bool IsOnLayer( int aLayer ) const; bool IsOnLayer( int aLayer ) const;
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition );
virtual bool HitTest( const wxPoint& aPosition );
/** wxString GetClass() const
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{ {
return wxT( "PAD" ); return wxT( "PAD" );
} }
/**
* Function GetBoundingBox
* returns the bounding box of this pad
* Mainly used to redraw the screen area occupied by the pad
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/** /**
...@@ -413,20 +366,15 @@ public: ...@@ -413,20 +366,15 @@ public:
*/ */
static int Compare( const D_PAD* padref, const D_PAD* padcmp ); static int Compare( const D_PAD* padref, const D_PAD* padcmp );
/** void Move( const wxPoint& aMoveVector )
* Function Move
* move this object.
* @param aMoveVector - the move vector for this object.
*/
virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return pad_xpm; } BITMAP_DEF GetMenuImage() const { return pad_xpm; }
/** /**
* Function ShowPadShape * Function ShowPadShape
...@@ -448,8 +396,7 @@ public: ...@@ -448,8 +396,7 @@ public:
*/ */
void AppendConfigs( PARAM_CFG_ARRAY* aResult ); void AppendConfigs( PARAM_CFG_ARRAY* aResult );
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload void Show( int nestLevel, std::ostream& os ) const; // overload
......
...@@ -95,12 +95,13 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -95,12 +95,13 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
if( DisplayOpt.DisplayDrawItems == SKETCH ) if( DisplayOpt.DisplayDrawItems == SKETCH )
fillmode = SKETCH; fillmode = SKETCH;
int anchor_color = UNSPECIFIED_COLOR; int anchor_color = UNSPECIFIED;
if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
anchor_color = brd->GetVisibleElementColor( ANCHOR_VISIBLE ); anchor_color = brd->GetVisibleElementColor( ANCHOR_VISIBLE );
EDA_TEXT::Draw( panel, DC, offset, (EDA_Colors) color, EDA_TEXT::Draw( panel, DC, offset, (EDA_COLOR_T) color,
DrawMode, fillmode, (EDA_Colors) anchor_color ); DrawMode, fillmode, (EDA_COLOR_T) anchor_color );
} }
......
...@@ -57,30 +57,14 @@ public: ...@@ -57,30 +57,14 @@ public:
m_Pos = aPos; // within EDA_TEXT m_Pos = aPos; // within EDA_TEXT
} }
/** void Move( const wxPoint& aMoveVector )
* Function Move
* move this object.
* @param aMoveVector - the move vector for this object.
*/
virtual void Move( const wxPoint& aMoveVector )
{ {
m_Pos += aMoveVector; m_Pos += aMoveVector;
} }
/** void Rotate( const wxPoint& aRotCentre, double aAngle );
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** void Flip( const wxPoint& aCentre );
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
virtual void Flip( const wxPoint& aCentre );
/* duplicate structure */ /* duplicate structure */
void Copy( TEXTE_PCB* source ); void Copy( TEXTE_PCB* source );
...@@ -91,41 +75,21 @@ public: ...@@ -91,41 +75,21 @@ public:
// File Operations: // File Operations:
int ReadTextePcbDescr( LINE_READER* aReader ); int ReadTextePcbDescr( LINE_READER* aReader );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_ITEM.
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */ bool HitTest( const wxPoint& aPosition )
virtual bool HitTest( const wxPoint& aPosition )
{ {
return TextHitTest( aPosition ); return TextHitTest( aPosition );
} }
/** @copydoc EDA_ITEM::HitTest(const EDA_RECT&)const */ bool HitTest( const EDA_RECT& aRect ) const
virtual bool HitTest( const EDA_RECT& aRect ) const
{ {
return TextHitTest( aRect ); return TextHitTest( aRect );
} }
/** wxString GetClass() const
* Function GetClass
* returns the class name.
* @return wxString
*/
virtual wxString GetClass() const
{ {
return wxT("PTEXT"); return wxT("PTEXT");
} }
...@@ -147,14 +111,13 @@ public: ...@@ -147,14 +111,13 @@ public:
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return add_text_xpm; } BITMAP_DEF GetMenuImage() const { return add_text_xpm; }
virtual EDA_RECT GetBoundingBox() const { return GetTextBox(); }; EDA_RECT GetBoundingBox() const { return GetTextBox(); };
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; void Show( int nestLevel, std::ostream& os ) const;
......
...@@ -309,7 +309,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w ...@@ -309,7 +309,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w
if( m_Mirror ) if( m_Mirror )
size.x = -size.x; size.x = -size.x;
DrawGraphicText( panel, DC, pos, (enum EDA_Colors) color, m_Text, orient, DrawGraphicText( panel, DC, pos, (enum EDA_COLOR_T) color, m_Text, orient,
size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); size, m_HJustify, m_VJustify, width, m_Italic, m_Bold );
} }
......
...@@ -109,24 +109,12 @@ public: ...@@ -109,24 +109,12 @@ public:
*/ */
EDA_RECT GetTextRect( void ) const; EDA_RECT GetTextRect( void ) const;
/**
* Function GetBoundingBox
* returns the bounding box of this Text (according to text and footprint
* orientation)
*/
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
void SetDrawCoord(); // Set absolute coordinates. void SetDrawCoord(); // Set absolute coordinates.
void SetLocalCoord(); // Set relative coordinates. void SetLocalCoord(); // Set relative coordinates.
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd"
* format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** /**
...@@ -157,28 +145,10 @@ public: ...@@ -157,28 +145,10 @@ public:
int aDrawMode, int aDrawMode,
const wxPoint& aOffset = ZeroOffset ); const wxPoint& aOffset = ZeroOffset );
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status
* information about this object into the frame's message panel.
* Is virtual from EDA_ITEM.
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
bool HitTest( const wxPoint& aPosition );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */
virtual bool HitTest( const wxPoint& aPosition );
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so
* objects like D_PAD, which reside on multiple layers can do their own
* form of testing.
* virtual inheritance from BOARD_ITEM.
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
bool IsOnLayer( int aLayer ) const; bool IsOnLayer( int aLayer ) const;
/* /*
...@@ -193,23 +163,17 @@ public: ...@@ -193,23 +163,17 @@ public:
*/ */
/** wxString GetClass() const
* Function GetClass
* returns the class name.
* @return wxString = "MTEXT"
*/
virtual wxString GetClass() const
{ {
return wxT( "MTEXT" ); return wxT( "MTEXT" );
} }
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return footprint_text_xpm; } BITMAP_DEF GetMenuImage() const { return footprint_text_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload void Show( int nestLevel, std::ostream& os ) const; // overload
......
...@@ -99,30 +99,14 @@ public: ...@@ -99,30 +99,14 @@ public:
TRACK* Next() const { return (TRACK*) Pnext; } TRACK* Next() const { return (TRACK*) Pnext; }
TRACK* Back() const { return (TRACK*) Pback; } TRACK* Back() const { return (TRACK*) Pback; }
/**
* Function Move
* move this object.
* @param aMoveVector - the move vector for this object.
*/
virtual void Move( const wxPoint& aMoveVector ) virtual void Move( const wxPoint& aMoveVector )
{ {
m_Start += aMoveVector; m_Start += aMoveVector;
m_End += aMoveVector; m_End += aMoveVector;
} }
/**
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
virtual void Rotate( const wxPoint& aRotCentre, double aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
virtual void Flip( const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // was overload void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // was overload
...@@ -139,12 +123,6 @@ public: ...@@ -139,12 +123,6 @@ public:
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** /**
...@@ -261,14 +239,6 @@ public: ...@@ -261,14 +239,6 @@ public:
*/ */
bool IsNull(); bool IsNull();
/**
* Function DisplayInfo
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_ITEM.
* Display info about the track segment and the full track length
* @param frame A EDA_DRAW_FRAME in which to print status information.
*/
void DisplayInfo( EDA_DRAW_FRAME* frame ); void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /**
...@@ -286,27 +256,12 @@ public: ...@@ -286,27 +256,12 @@ public:
*/ */
wxString ShowWidth() const; wxString ShowWidth() const;
/**
* Function Visit
* is re-implemented here because TRACKs and SEGVIAs are in the same list
* within BOARD. If that were not true, then we could inherit the
* version from EDA_ITEM. This one does not iterate through scanTypes
* but only looks at the first item in the list.
* @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE, and determined by the inspector.
*/
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** @copydoc EDA_ITEM::HitTest(const wxPoint&) */
virtual bool HitTest( const wxPoint& aPosition ); virtual bool HitTest( const wxPoint& aPosition );
/** @copydoc EDA_ITEM::HitTest(const EDA_RECT&)const */
virtual bool HitTest( const EDA_RECT& aRect ) const; virtual bool HitTest( const EDA_RECT& aRect ) const;
/** /**
...@@ -356,11 +311,6 @@ public: ...@@ -356,11 +311,6 @@ public:
*/ */
int GetEndSegments( int NbSegm, TRACK** StartTrack, TRACK** EndTrack ); int GetEndSegments( int NbSegm, TRACK** StartTrack, TRACK** EndTrack );
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const wxString GetClass() const
{ {
return wxT( "TRACK" ); return wxT( "TRACK" );
...@@ -405,11 +355,6 @@ public: ...@@ -405,11 +355,6 @@ public:
// Do not create a copy constructor. The one generated by the compiler is adequate. // Do not create a copy constructor. The one generated by the compiler is adequate.
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const wxString GetClass() const
{ {
return wxT( "ZONE" ); return wxT( "ZONE" );
...@@ -418,11 +363,11 @@ public: ...@@ -418,11 +363,11 @@ public:
SEGZONE* Next() const { return (SEGZONE*) Pnext; } SEGZONE* Next() const { return (SEGZONE*) Pnext; }
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return add_zone_xpm; } BITMAP_DEF GetMenuImage() const { return add_zone_xpm; }
virtual EDA_ITEM* Clone() const; EDA_ITEM* Clone() const;
}; };
...@@ -436,13 +381,6 @@ public: ...@@ -436,13 +381,6 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
const wxPoint& aOffset = ZeroOffset ); const wxPoint& aOffset = ZeroOffset );
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual
* from BOARD_ITEM. Tests the starting and ending range of layers for the via.
* @param aLayer the layer to test for.
* @return bool - true if on given layer, else false.
*/
bool IsOnLayer( int aLayer ) const; bool IsOnLayer( int aLayer ) const;
/** /**
...@@ -469,22 +407,16 @@ public: ...@@ -469,22 +407,16 @@ public:
const wxPoint& GetPosition() const { return m_Start; } // was overload const wxPoint& GetPosition() const { return m_Start; } // was overload
void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; } // was overload void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; } // was overload
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const wxString GetClass() const
{ {
return wxT( "VIA" ); return wxT( "VIA" );
} }
virtual wxString GetSelectMenuText() const; wxString GetSelectMenuText() const;
virtual BITMAP_DEF GetMenuImage() const { return via_sketch_xpm; } BITMAP_DEF GetMenuImage() const { return via_sketch_xpm; }
/** @copydoc EDA_ITEM::Clone() */ EDA_ITEM* Clone() const;
virtual EDA_ITEM* Clone() const;
#if defined (DEBUG) #if defined (DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload void Show( int nestLevel, std::ostream& os ) const; // overload
......
...@@ -307,7 +307,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -307,7 +307,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
keep_on_grid = false; keep_on_grid = false;
/* Cursor is left off grid if no block in progress and no moving object */ /* Cursor is left off grid if no block in progress and no moving object */
if( GetScreen()->m_BlockLocate.m_State != STATE_NO_BLOCK ) if( GetScreen()->m_BlockLocate.GetState() != STATE_NO_BLOCK )
keep_on_grid = true; keep_on_grid = true;
EDA_ITEM* DrawStruct = GetScreen()->GetCurItem(); EDA_ITEM* DrawStruct = GetScreen()->GetCurItem();
......
...@@ -150,10 +150,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -150,10 +150,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
/* Should not be executed, just in case */ /* Should not be executed, just in case */
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE ) if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
{ {
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK; GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
} }
...@@ -235,39 +235,38 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -235,39 +235,38 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.SetCommand( BLOCK_COPY );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
GetScreen()->m_BlockLocate.SetMessageBlock( this );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_FLIP_BLOCK: case ID_POPUP_FLIP_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_FLIP; GetScreen()->m_BlockLocate.SetCommand( BLOCK_FLIP );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
......
...@@ -681,7 +681,7 @@ static void export_vrml_pcbtext( TEXTE_PCB* text ) ...@@ -681,7 +681,7 @@ static void export_vrml_pcbtext( TEXTE_PCB* text )
for( unsigned i = 0; i<list->Count(); i++ ) for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) 0, DrawGraphicText( NULL, NULL, pos, (EDA_COLOR_T) 0,
txt, text->GetOrientation(), size, txt, text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify, text->m_HJustify, text->m_VJustify,
text->m_Thickness, text->m_Italic, text->m_Thickness, text->m_Italic,
...@@ -694,7 +694,7 @@ static void export_vrml_pcbtext( TEXTE_PCB* text ) ...@@ -694,7 +694,7 @@ static void export_vrml_pcbtext( TEXTE_PCB* text )
} }
else else
{ {
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) 0, DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_COLOR_T) 0,
text->m_Text, text->GetOrientation(), size, text->m_Text, text->GetOrientation(), size,
text->m_HJustify, text->m_VJustify, text->m_HJustify, text->m_VJustify,
text->m_Thickness, text->m_Italic, text->m_Thickness, text->m_Italic,
...@@ -843,7 +843,7 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) //{{{ ...@@ -843,7 +843,7 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) //{{{
s_text_layer = module->GetLayer(); s_text_layer = module->GetLayer();
s_text_width = module->m_Thickness; s_text_width = module->m_Thickness;
DrawGraphicText( NULL, NULL, module->m_Pos, (EDA_Colors) 0, DrawGraphicText( NULL, NULL, module->m_Pos, (EDA_COLOR_T) 0,
module->m_Text, module->GetDrawRotation(), size, module->m_Text, module->GetDrawRotation(), size,
module->m_HJustify, module->m_VJustify, module->m_HJustify, module->m_VJustify,
module->m_Thickness, module->m_Italic, module->m_Thickness, module->m_Italic,
......
...@@ -25,7 +25,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos ...@@ -25,7 +25,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
if( aHotKey == 0 ) if( aHotKey == 0 )
return; return;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE; bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool ItemFree = (item == 0) || (item->GetFlags() == 0); bool ItemFree = (item == 0) || (item->GetFlags() == 0);
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
...@@ -122,7 +122,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand ) ...@@ -122,7 +122,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags(); bool itemCurrentlyEdited = item && item->GetFlags();
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE; bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
if( itemCurrentlyEdited || blockActive ) if( itemCurrentlyEdited || blockActive )
return false; return false;
...@@ -177,7 +177,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem( int aIdCommand ) ...@@ -177,7 +177,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyDeleteItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags(); bool itemCurrentlyEdited = item && item->GetFlags();
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE; bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
if( itemCurrentlyEdited || blockActive ) if( itemCurrentlyEdited || blockActive )
return false; return false;
...@@ -232,7 +232,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand ) ...@@ -232,7 +232,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags(); bool itemCurrentlyEdited = item && item->GetFlags();
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE; bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
if( itemCurrentlyEdited || blockActive ) if( itemCurrentlyEdited || blockActive )
return false; return false;
...@@ -288,7 +288,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) ...@@ -288,7 +288,7 @@ bool FOOTPRINT_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand )
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
bool itemCurrentlyEdited = item && item->GetFlags(); bool itemCurrentlyEdited = item && item->GetFlags();
int evt_type = 0; // Used to post a wxCommandEvent on demand int evt_type = 0; // Used to post a wxCommandEvent on demand
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE; bool blockActive = GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE;
if( blockActive ) if( blockActive )
return false; return false;
......
...@@ -682,38 +682,38 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -682,38 +682,38 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.SetCommand( BLOCK_COPY );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
m_canvas->SetAutoPanRequest( false ); m_canvas->SetAutoPanRequest( false );
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X; GetScreen()->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
break; break;
......
...@@ -187,7 +187,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen ...@@ -187,7 +187,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
wxString msg; wxString msg;
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE; bool blockActive = !GetScreen()->m_BlockLocate.IsIdle();
// Simple location of elements where possible. // Simple location of elements where possible.
if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
......
...@@ -53,7 +53,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -53,7 +53,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
wxString msg; wxString msg;
int flags = 0; int flags = 0;
bool locate_track = false; bool locate_track = false;
bool blockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); bool blockActive = !GetScreen()->m_BlockLocate.IsIdle();
wxClientDC dc( m_canvas ); wxClientDC dc( m_canvas );
......
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