Commit cf986476 authored by jean-pierre charras's avatar jean-pierre charras

class EDA_RECT: is no more derived from EDA_ITEM, just from EDA_RECT (reason:...

class EDA_RECT: is no more derived from EDA_ITEM, just from EDA_RECT (reason: does not use anything in EDA_ITEM)
issue in cast to wxRect fixed (EDA_RECT accepts negative size, but not wxRect, so the wxRectcast  is normalized now).
This fixes some bugs.
A minor other bug fix in Pcbnew.
parent b01bcda0
......@@ -40,9 +40,7 @@
#include <block_commande.h>
BLOCK_SELECTOR::BLOCK_SELECTOR() :
EDA_ITEM( BLOCK_LOCATE_STRUCT_TYPE ),
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. */
......@@ -188,7 +186,6 @@ void BLOCK_SELECTOR::Clear()
{
if( m_Command != BLOCK_IDLE )
{
m_Flags = 0;
m_Command = BLOCK_IDLE;
m_State = STATE_NO_BLOCK;
ClearItemsList();
......@@ -206,7 +203,6 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* DC, int key, const wxPoint& startpo
if( ( Block->m_Command != BLOCK_IDLE ) || ( Block->m_State != STATE_NO_BLOCK ) )
return false;
Block->ClearFlags();
Block->m_Command = (CmdBlockType) ReturnBlockCommand( key );
if( Block->m_Command == 0 )
......@@ -323,7 +319,6 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* Panel, wxDC* DC )
screen->m_BlockLocate.ClearItemsList();
}
screen->m_BlockLocate.ClearFlags();
screen->m_BlockLocate.m_State = STATE_NO_BLOCK;
screen->m_BlockLocate.m_Command = BLOCK_ABORT;
Panel->GetParent()->HandleBlockEnd( DC );
......
......@@ -178,7 +178,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify();
// clear struct.m_Flags.
// clear dome flags and pointers
GetScreen()->ClearDrawingState();
GetScreen()->ClearBlockCommand();
GetScreen()->SetCurItem( NULL );
......@@ -308,7 +308,6 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( ! nextcmd )
{
block->ClearFlags();
block->m_State = STATE_NO_BLOCK;
block->m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL );
......
......@@ -201,7 +201,6 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
if( GetScreen()->m_BlockLocate.m_Command != BLOCK_SELECT_ITEMS_ONLY && m_component )
m_component->ClearSelectedItems();
GetScreen()->m_BlockLocate.ClearFlags();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL );
......@@ -298,7 +297,6 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify();
GetScreen()->m_BlockLocate.ClearFlags();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
GetScreen()->SetCurItem( NULL );
......
......@@ -279,8 +279,15 @@ public:
/**
* Function operator(wxRect)
* overloads the cast operator to return a wxRect
* wxRect does not accept negative values for size, so ensure the
* wxRect size is always >= 0
*/
operator wxRect() const { return wxRect( m_Pos, m_Size ); }
operator wxRect() const
{
EDA_RECT rect( m_Pos, m_Size );
rect.Normalize();
return wxRect( rect.m_Pos, rect.m_Size );
}
/**
* Function Inflate
......
......@@ -53,7 +53,7 @@ typedef enum {
} CmdBlockType;
class BLOCK_SELECTOR : public EDA_ITEM, public EDA_RECT
class BLOCK_SELECTOR : public EDA_RECT
{
public:
BlockState m_State; /* State (enum BlockState)
......@@ -143,10 +143,6 @@ public:
* and clears the selected item list.
*/
void Clear();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const {} // override
#endif
};
......
......@@ -288,7 +288,6 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
OnModify();
GetScreen()->m_BlockLocate.ClearFlags();
GetScreen()->m_BlockLocate.m_State = STATE_NO_BLOCK;
GetScreen()->m_BlockLocate.m_Command = BLOCK_IDLE;
SetCurItem( NULL );
......
......@@ -690,8 +690,8 @@ if you do not want this pad plotted in gerber files");
max_size.y = ABS( m_dummyPad->GetOffset().y );
max_size.x += m_dummyPad->GetDrillSize().x / 2;
max_size.y += m_dummyPad->GetDrillSize().y / 2;
if( ( m_dummyPad->GetSize().x / 2 <= max_size.x ) ||
( m_dummyPad->GetSize().y / 2 <= max_size.y ) )
if( ( m_dummyPad->GetSize().x / 2 < max_size.x ) ||
( m_dummyPad->GetSize().y / 2 < max_size.y ) )
{
error_msgs.Add( _( "Incorrect value for pad offset" ) );
}
......
......@@ -747,8 +747,8 @@ void PCB_BASE_FRAME::Plot_Layer( PLOTTER* plotter, int Layer, EDA_DRAW_MODE_T tr
}
/* Plot a copper layer or mask in HPGL format.
* HPGL unit = 0.98 mils (1 mil = 1.02041 unit HPGL).
/* Plot a copper layer or mask.
* Silk screen layers are not plotted here.
*/
void PCB_BASE_FRAME::Plot_Standard_Layer( PLOTTER* aPlotter,
int aLayerMask,
......
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