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

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
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -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 );
+1 −2
Original line number Diff line number Diff line
@@ -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 );
+0 −2
Original line number Diff line number Diff line
@@ -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 );
+8 −1
Original line number Diff line number Diff line
@@ -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
+1 −5
Original line number Diff line number Diff line
@@ -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
};


Loading