class_DisplayFootprintsFrame.h 4.54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2007-2011 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

25 26 27
/**
 * @file class_DisplayFootprintsFrame.h
 */
charras's avatar
charras committed
28 29


30
#include <wxBasePcbFrame.h>
charras's avatar
charras committed
31

32 33
// The name (for wxWidgets) of the footprint viewer frame
#define FOOTPRINTVIEWER_FRAME_NAME wxT( "FootprintViewerFrame" )
34 35 36 37 38 39 40 41

class CVPCB_MAINFRAME;


/**
 * Class DISPLAY_FOOTPRINTS_FRAME
 * is used to display footprints.
 */
42
class DISPLAY_FOOTPRINTS_FRAME : public PCB_BASE_FRAME
charras's avatar
charras committed
43 44
{
public:
45
    DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent );
charras's avatar
charras committed
46 47 48
    ~DISPLAY_FOOTPRINTS_FRAME();

    void    OnCloseWindow( wxCloseEvent& Event );
49 50 51 52

    /*
     * Draws the current highlighted footprint.
     */
charras's avatar
charras committed
53
    void    RedrawActiveWindow( wxDC* DC, bool EraseBg );
54

charras's avatar
charras committed
55 56
    void    ReCreateHToolbar();
    void    ReCreateVToolbar();
57
    void    ReCreateOptToolbar();
charras's avatar
charras committed
58 59
    void    RecreateMenuBar();

60 61
    void OnSelectOptionToolbar( wxCommandEvent& event );

62 63 64
    void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent );
    void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent );

65 66 67 68 69 70 71 72
    /**
     * Function InitDisplay
     * Refresh the full display for this frame:
     * Set the title, the status line and redraw the canvas
     * Must be called after the footprint to display is modifed
     */
    void InitDisplay();

73 74
    /**
     * Function IsGridVisible() , virtual
charras's avatar
charras committed
75 76
     * @return true if the grid must be shown
     */
77
    virtual bool IsGridVisible() const;
charras's avatar
charras committed
78

79 80
    /**
     * Function SetGridVisibility() , virtual
charras's avatar
charras committed
81
     * It may be overloaded by derived classes
82
     * if you want to store/retrieve the grid visibility in configuration.
charras's avatar
charras committed
83 84
     * @param aVisible = true if the grid must be shown
     */
85
    virtual void SetGridVisibility( bool aVisible );
86 87
    /**
     * Function GetGridColor() , virtual
charras's avatar
charras committed
88 89
     * @return the color of the grid
     */
90
    virtual EDA_COLOR_T GetGridColor() const;
charras's avatar
charras committed
91 92 93 94

    void    OnLeftClick( wxDC* DC, const wxPoint& MousePos );
    void    OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
    bool    OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
95
    bool    GeneralControl( wxDC* DC, const wxPoint& aPosition, int aHotKey = 0 );
charras's avatar
charras committed
96 97 98 99
    void    InstallOptionsDisplay( wxCommandEvent& event );
    MODULE* Get_Module( const wxString& CmpName );

    void    Process_Settings( wxCommandEvent& event );
100 101 102 103

    /**
     * Display 3D frame of current footprint selection.
     */
charras's avatar
charras committed
104 105 106
    void    Show3D_Frame( wxCommandEvent& event );

    /* SaveCopyInUndoList() virtual
107
     * currently: do nothing in CvPcb.
108
     * but but be defined because it is a pure virtual in PCB_BASE_FRAME
charras's avatar
charras committed
109 110
     */
    virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
111
                                     UNDO_REDO_T aTypeCommand = UR_UNSPECIFIED,
charras's avatar
charras committed
112 113 114 115 116
                                     const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
    {
    }


117 118
    /**
     * Function SaveCopyInUndoList (overloaded).
charras's avatar
charras committed
119 120 121
     * Creates a new entry in undo list of commands.
     * add a list of pickers to handle a list of items
     * @param aItemsList = the list of items modified by the command to undo
122
     * @param aTypeCommand = command type (see enum UNDO_REDO_T)
charras's avatar
charras committed
123 124 125
     * @param aTransformPoint = the reference point of the transformation,
     *                          for commands like move
     */
126
    virtual void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList,
127
                                     UNDO_REDO_T aTypeCommand,
charras's avatar
charras committed
128 129
                                     const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
    {
130
        // currently: do nothing in CvPcb.
charras's avatar
charras committed
131 132 133 134 135
    }


    DECLARE_EVENT_TABLE()
};