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;
......
This diff is collapsed.
...@@ -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;
......
This diff is collapsed.
...@@ -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 );
......
This diff is collapsed.
...@@ -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 diff is collapsed.
...@@ -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...)
*/ */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -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 );
} }
......
This diff is collapsed.
...@@ -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 );
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -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();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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