Commit b0f3e79e authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Created a common interface for edit frames.

parent eee2779f
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
#define  WXPCB_STRUCT_H_


#include <wxBasePcbFrame.h>
#include <pcb_base_edit_frame.h>
#include <config_params.h>
#include <class_macros_record.h>
#include <class_undoredo_container.h>
@@ -73,7 +73,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
 *
 * See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
 */
class PCB_EDIT_FRAME : public PCB_BASE_FRAME
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
{
    friend class PCB::IFACE;
    friend class PCB_LAYER_WIDGET;
@@ -659,22 +659,22 @@ public:
                                 bool               aRebuildRatsnet = true );

    /**
     * Function GetBoardFromRedoList
     * Function RestoreCopyFromRedoList
     *  Redo the last edition:
     *  - Save the current board in Undo list
     *  - Get an old version of the board from Redo list
     *  @return none
     */
    void GetBoardFromRedoList( wxCommandEvent& aEvent );
    void RestoreCopyFromRedoList( wxCommandEvent& aEvent );

    /**
     * Function GetBoardFromUndoList
     * Function RestoreCopyFromUndoList
     *  Undo the last edition:
     *  - Save the current board in Redo list
     *  - Get an old version of the board from Undo list
     *  @return none
     */
    void GetBoardFromUndoList( wxCommandEvent& aEvent );
    void RestoreCopyFromUndoList( wxCommandEvent& aEvent );

    /* Block operations: */

+2 −2
Original line number Diff line number Diff line
@@ -630,7 +630,7 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
}


void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
void PCB_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
{
    if( GetScreen()->GetUndoCommandCount() <= 0 )
        return;
@@ -653,7 +653,7 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
}


void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& aEvent )
void PCB_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
{
    if( GetScreen()->GetRedoCommandCount() == 0 )
        return;
+39 −35
Original line number Diff line number Diff line
@@ -418,17 +418,39 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )

        // Item found
        SetCurItem( item );
        OnEditItemRequest( DC, item );
        break;      // end case 0

        switch( item->Type() )
    case ID_PCB_ADD_LINE_BUTT:
    {
        if( item && item->IsNew() )
        {
            End_Edge_Module( (EDGE_MODULE*) item );
            SetCurItem( NULL );
            m_canvas->Refresh();
        }

        break;
    }

    default:
        break;
    }
}


void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
{
    switch( aItem->Type() )
    {
    case PCB_PAD_T:
            InstallPadOptionsFrame( (D_PAD*) item );
        InstallPadOptionsFrame( (D_PAD*) aItem );
        m_canvas->MoveCursorToCrossHair();
        break;

    case PCB_MODULE_T:
        {
            DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
        DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) aItem );
        int ret = dialog.ShowModal();
        GetScreen()->GetCurItem()->ClearFlags();
        m_canvas->MoveCursorToCrossHair();
@@ -439,35 +461,17 @@ void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
        break;

    case PCB_MODULE_TEXT_T:
            InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
        InstallTextModOptionsFrame( (TEXTE_MODULE*) aItem, aDC );
        m_canvas->MoveCursorToCrossHair();
        break;

    case PCB_MODULE_EDGE_T :
        m_canvas->MoveCursorToCrossHair();
            InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) item );
        InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) aItem );
        m_canvas->Refresh();
        break;

    default:
        break;
    }

        break;      // end case 0

    case ID_PCB_ADD_LINE_BUTT:
    {
        if( item && item->IsNew() )
        {
            End_Edge_Module( (EDGE_MODULE*) item );
            SetCurItem( NULL );
            m_canvas->Refresh();
        }

        break;
    }

    default:
        break;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ void FOOTPRINT_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLi
}


void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& aEvent )
void FOOTPRINT_EDIT_FRAME::RestoreCopyFromRedoList( wxCommandEvent& aEvent )
{
    if( GetScreen()->GetRedoCommandCount() <= 0 )
        return;
@@ -107,7 +107,7 @@ void FOOTPRINT_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& aEvent )
}


void FOOTPRINT_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& aEvent )
void FOOTPRINT_EDIT_FRAME::RestoreCopyFromUndoList( wxCommandEvent& aEvent )
{
    if( GetScreen()->GetUndoCommandCount() <= 0 )
        return;
+21 −17
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#define MODULE_EDITOR_FRAME_H_

#include <wxBasePcbFrame.h>
#include <pcb_base_edit_frame.h>
#include <io_mgr.h>


@@ -38,7 +39,7 @@ class FP_LIB_TABLE;
namespace PCB { struct IFACE; }     // A KIFACE_I coded in pcbnew.c


class FOOTPRINT_EDIT_FRAME : public PCB_BASE_FRAME
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
{
    friend struct PCB::IFACE;

@@ -148,6 +149,9 @@ public:
    void OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent );
    void OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent );

    ///> @copydoc PCB_BASE_EDIT_FRAME::OnEditItemRequest()
    void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );

    /**
     * Function LoadModuleFromBoard
     * called from the main toolbar to load a footprint from board mainly to edit it.
@@ -244,6 +248,22 @@ public:
                                     UNDO_REDO_T aTypeCommand,
                                     const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );

    /**
     * Function RestoreCopyFromUndoList
     * performs an undo operation on the last edition:
     *  - Place the current edited library component in Redo list
     *  - Get old version of the current edited library component
     */
    void RestoreCopyFromUndoList( wxCommandEvent& aEvent );

    /**
     * Function RestoreCopyFromRedoList
     * performs a redo operation on the the last edition:
     *  - Place the current edited library component in undo list
     *  - Get old version of the current edited library component
     */
    void RestoreCopyFromRedoList( wxCommandEvent& aEvent );

    /// Return the current library nickname.
    const wxString GetCurrentLib() const;

@@ -413,22 +433,6 @@ protected:

    PCB_LAYER_WIDGET* m_Layers;

    /**
     * Function GetComponentFromUndoList
     * performs an undo operation on the last edition:
     *  - Place the current edited library component in Redo list
     *  - Get old version of the current edited library component
     */
    void GetComponentFromUndoList( wxCommandEvent& aEvent );

    /**
     * Function GetComponentFromRedoList
     * performs a redo operation on the the last edition:
     *  - Place the current edited library component in undo list
     *  - Get old version of the current edited library component
     */
    void GetComponentFromRedoList( wxCommandEvent& aEvent );

    /**
     * Function UpdateTitle
     * updates window title according to getLibNickName().
Loading