Commit d535a0fc authored by charras's avatar charras
Browse files

pcbnew: Starting work on undo/redo in pcbnew. Only some delete item commands...

pcbnew: Starting work on undo/redo in pcbnew. Only some delete item commands are stored in undo/redo stack
parent 2a7ac9d3
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,13 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2009-july-29 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
    Starting work on undo/redo in pcbnew.
    Currently, undo redo commands are only delete one item (and only for some items)


2009-july-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
2009-july-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
================================================================================
++all
++all
+1 −1
Original line number Original line Diff line number Diff line
@@ -8,7 +8,7 @@
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"




#define BUILD_VERSION "(20090723-unstable)"
#define BUILD_VERSION "(20090729-unstable)"




#ifdef HAVE_SVN_VERSION
#ifdef HAVE_SVN_VERSION
+14 −18
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ BASE_SCREEN* ActiveScreen = NULL;
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
{
{
    EEDrawList         = NULL;   /* Schematic items list */
    EEDrawList         = NULL;   /* Schematic items list */
    m_UndoRedoCountMax = 1;     /* undo/Redo command Max depth */
    m_UndoRedoCountMax = 10;     /* undo/Redo command Max depth, 10 is a reasonnable value */
    m_FirstRedraw      = TRUE;
    m_FirstRedraw      = TRUE;
    m_ScreenNumber     = 1;
    m_ScreenNumber     = 1;
    m_NumberOfScreen   = 1;  /* Hierarchy: Root: ScreenNumber = 1 */
    m_NumberOfScreen   = 1;  /* Hierarchy: Root: ScreenNumber = 1 */
@@ -48,7 +48,6 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
BASE_SCREEN::~BASE_SCREEN()
BASE_SCREEN::~BASE_SCREEN()
/******************************/
/******************************/
{
{
    ClearUndoRedoList();
}
}




@@ -484,8 +483,8 @@ void BASE_SCREEN::ClearUndoRedoList()
/* free the undo and the redo lists
/* free the undo and the redo lists
 */
 */
{
{
    m_UndoList.ClearCommandList();
    ClearUndoORRedoList( m_UndoList );
    m_RedoList.ClearCommandList();
    ClearUndoORRedoList( m_RedoList );
}
}




@@ -498,13 +497,11 @@ void BASE_SCREEN::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
 */
 */
{
{
    m_UndoList.PushCommand( aNewitem );
    m_UndoList.PushCommand( aNewitem );
    while( m_UndoList.m_CommandsList.size() > 0 &&
            m_UndoList.m_CommandsList.size() >= m_UndoRedoCountMax )
    {
        delete m_UndoList.m_CommandsList[0];
        m_UndoList.m_CommandsList.erase( m_UndoList.m_CommandsList.begin() );
    }


    /* Delete the extra items, if count max reached */
    int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax;
    if( extraitems > 0 ) // Delete the extra items
        ClearUndoORRedoList( m_UndoList, extraitems );
}
}




@@ -513,12 +510,11 @@ void BASE_SCREEN::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
/***********************************************************/
/***********************************************************/
{
{
    m_RedoList.PushCommand( aNewitem );
    m_RedoList.PushCommand( aNewitem );
    while( m_RedoList.m_CommandsList.size() > 0 &&

            m_RedoList.m_CommandsList.size() >= m_UndoRedoCountMax )
    /* Delete the extra items, if count max reached */
    {
    int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax;
        delete m_RedoList.m_CommandsList[0];
    if( extraitems > 0 ) // Delete the extra items
        m_RedoList.m_CommandsList.erase( m_RedoList.m_CommandsList.begin() );
        ClearUndoORRedoList( m_RedoList, extraitems );
    }
}
}




+0 −3
Original line number Original line Diff line number Diff line
@@ -67,9 +67,6 @@ wxString g_ViaType_Name[4] = {


wxArrayString g_LibName_List;    // library list to load
wxArrayString g_LibName_List;    // library list to load


BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items
int         g_UnDeleteStackPtr;

DISPLAY_OPTIONS DisplayOpt;      /* Display options for board items */
DISPLAY_OPTIONS DisplayOpt;      /* Display options for board items */


/* PCB file name extension definitions. */
/* PCB file name extension definitions. */
+10 −0
Original line number Original line Diff line number Diff line
@@ -219,6 +219,16 @@ public:
    void    Process_Settings( wxCommandEvent& event );
    void    Process_Settings( wxCommandEvent& event );
    void    Show3D_Frame( wxCommandEvent& event );
    void    Show3D_Frame( wxCommandEvent& event );


    /* SaveCopyInUndoList() virtual
     * currently: do nothing in cvpcb.
     * but but be defined because it is a pure virtual in WinEDA_BasePcbFrame
     */
    virtual void        SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
                        UndoRedoOpType aTypeCommand = UR_UNSPECIFIED,
                        const wxPoint& aTransformPoint = wxPoint(0,0) )
                        {
                        }

    DECLARE_EVENT_TABLE()
    DECLARE_EVENT_TABLE()
};
};


Loading