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