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;
......
This diff is collapsed.
......@@ -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,
const TRANSFORM& aTransform );
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,
const TRANSFORM& aTransform );
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,
const TRANSFORM& aTransform );
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,20 +94,20 @@ 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 ) {}
/**
* Calculates the attributes of an item at \a aPosition when it is being edited.
* Calculates the attributes of an item at \a aPosition when it is being edited.
*
* This method gets called by the Draw() method when the item is being edited. This
* 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,11 +167,11 @@ 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
* of mode flags.
* @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.
* @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
* started. This may or may not be required depending on the item
* being edited and the edit mode.
*/
virtual void BeginEdit( int aEditMode, const wxPoint aPosition = wxPoint( 0, 0 ) ) {}
......@@ -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,
const TRANSFORM& aTransform );
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;
......
......@@ -1071,14 +1071,14 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
int Color,
int DrawMode )
{
int x, y, x1, y1;
wxString StringPinNum;
EDA_Colors NameColor, NumColor;
int x, y, x1, y1;
wxString StringPinNum;
EDA_COLOR_T NameColor, NumColor;
wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize( m_numTextSize, m_numTextSize );
wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize( m_numTextSize, m_numTextSize );
int nameLineWidth = GetPenSize();
int nameLineWidth = GetPenSize();
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
int numLineWidth = GetPenSize();
......@@ -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 );
......@@ -1269,8 +1269,8 @@ 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;
int MapX1, MapY1, x1, y1;
EDA_COLOR_T color = UNSPECIFIED;
color = ReturnLayerColor( LAYER_PIN );
......@@ -1379,11 +1379,11 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter,
bool DrawPinName,
int aWidth )
{
int x, y, x1, y1;
wxString StringPinNum;
EDA_Colors NameColor, NumColor;
wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
int x, y, x1, y1;
wxString StringPinNum;
EDA_COLOR_T NameColor, NumColor;
wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
/* Get the num and name colors */
NameColor = ReturnLayerColor( LAYER_PINNAM );
......
......@@ -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
* clears the editing mode.
* @param aEditPinByPin - Enables the edit pin by pin mode.
* @param aEnable True marks all common pins for editing mode. False
* clears the editing 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,
const TRANSFORM& aTransform );
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,
const TRANSFORM& aTransform );
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,
const TRANSFORM& aTransform );
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,
const TRANSFORM& aTransform );
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,
int aDrawMode, int aColor = -1 );
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,11 +246,11 @@ public:
*/
LIB_PIN* GetPin( const wxString& number );
virtual void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color = -1 )
void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color = -1 )
{
Draw( panel, DC, offset, draw_mode, Color, true );
}
......@@ -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,
int aDrawMode, int aColor = -1 );
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 );
/** @copydoc SCH_ITEM::Move() */
virtual void Move( const wxPoint& aMoveVector )
bool Load( LINE_READER& aLine, wxString& aErrorMsg );
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,
int aDrawMode, int aColor = -1 );
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,
int aDraw_mode, int aColor = -1 );
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,
int aDrawMode, int aColor = -1 );
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,
int aDrawMode, int aColor = -1 );
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,12 +1104,12 @@ void SCH_SHEET::GetNetListItem( vector<NETLIST_OBJECT*>& aNetListItems,
void SCH_SHEET::Plot( PLOTTER* aPlotter )
{
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
wxSize size;
wxString Text;
int name_orientation;
wxPoint pos_sheetname, pos_filename;
wxPoint pos;
EDA_COLOR_T txtcolor = UNSPECIFIED;
wxSize size;
wxString Text;
int name_orientation;
wxPoint pos_sheetname, pos_filename;
wxPoint pos;
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
......
This diff is collapsed.
......@@ -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;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness;
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,9 +687,9 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
{
static std::vector <wxPoint> Poly;
EDA_Colors color = ReturnLayerColor( GetLayer() );
wxPoint textpos = m_Pos + GetSchematicTextOffset();
int thickness = GetPenSize();
EDA_COLOR_T color = ReturnLayerColor( GetLayer() );
wxPoint textpos = m_Pos + GetSchematicTextOffset();
int thickness = GetPenSize();
aPlotter->set_current_line_width( thickness );
......@@ -1195,11 +1195,11 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
int Color )
{
static std::vector <wxPoint> Poly;
EDA_Colors color;
wxPoint text_offset = aOffset + GetSchematicTextOffset();
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;
int linewidth = ( m_Thickness == 0 ) ? g_DrawDefaultLineThickness : m_Thickness;
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 );
......
This diff is collapsed.
......@@ -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.
......@@ -330,13 +329,13 @@ public:
// These define are used for the .m_Flags and .m_UndoRedoStatus member of the
// class EDA_ITEM
#define IS_CHANGED (1 << 0) ///< Item was edited, and modified
#define IS_LINKED (1 << 1) ///< Used in calculation to mark linked items (temporary use)
#define IN_EDIT (1 << 2) ///< Item currently edited
#define IS_MOVED (1 << 3) ///< Item being moved
#define IS_NEW (1 << 4) ///< New item, just created
#define IS_RESIZED (1 << 5) ///< Item being resized
#define IS_DRAGGED (1 << 6) ///< Item being dragged
#define IS_CHANGED (1 << 0) ///< Item was edited, and modified
#define IS_LINKED (1 << 1) ///< Used in calculation to mark linked items (temporary use)
#define IN_EDIT (1 << 2) ///< Item currently edited
#define IS_MOVED (1 << 3) ///< Item being moved
#define IS_NEW (1 << 4) ///< New item, just created
#define IS_RESIZED (1 << 5) ///< Item being resized
#define IS_DRAGGED (1 << 6) ///< Item being dragged
#define IS_DELETED (1 << 7)
#define IS_WIRE_IMAGE (1 << 8)
#define STARTPOINT (1 << 9)
......@@ -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 diff is collapsed.
......@@ -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;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment