Commit 6518139b authored by dickelbeck's avatar dickelbeck
Browse files

more layer widget work

parent 84d82cf2
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -4,6 +4,26 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with
email address.

2010-Jan-23 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew's PCB_LAYER_WIDGET
    Removed wxformbuilder dependency from LAYER_WIDGET, thus killing off
    layer_widget_base.* and panel_layer_select.fbp.
    Added aPointSize to LAYER_WIDGET constructor so it uses that font size.
    Removed layer_widget.h from wxPcbStruct.h for faster compiles with less
    dependencies, and this meant moving the class LYRS out of
    class WinEDA_PcbFrame.  While doing that I renamed it to PCB_LAYER_WIDGET.
    Integration of PCB_LAYER_WIDGET into WinEDA_PcbFrame to fully support
    the layer change logic. Added syncLayerWidget(),
  * WinEDA_PcbFrame:
    Added syncLayerWidget(), syncLayerBox() (via a rename), setActiveLayer(),
    and getActiveLayer().
    Use a font size in PCB_LAYER_WIDGET 80% of the system font size for systems
    with screen resolution height <= 900, or 100% if not.  See WinEDA_PcbFrame
    constructor.
  * See TODO.txt for more things that need to be done.


2010-Jan-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++ Pcbnew:
+12 −7
Original line number Diff line number Diff line
@@ -72,19 +72,24 @@ PCBNew
* Need to add polygon aperture type.
  Then example 2 in RS274xrevd_e.pdf will draw properly.

Dick:
* Get the nested quote support for DSNLEXER fixed up and committed.


LAYER_WIDGET for PCBNEW
-----------------------
L2) Hook in bool WinEDA_PcbFrame::LYRS::OnLayerSelect( int aLayer )

L4) Move popup menu code from class LAYER_WIDGET into WinEDA_PcbFrame::LYRS so as
    to keep LAYER_WIDGET fully usage agnostic.  Remove #include "pcbstruct.h"      // IsValidCopperLayerIndex()
    from layer_widget.cpp.

L5) Add to moved popu menu code the ability to save the current layer widget
    color and enable settings with an additional menu item.

L6) Test, and fix up any remaining issues with the PCB_VISIBLE support, several
    items which are stored on globals could and should be stored in
    EDA_Settings.m_VisibleElements using enum PCB_VISIBLE.
    EDA_Settings.m_VisibleElements using enum PCB_VISIBLE.  Initial Render
    checkbox settings are probably not correct, for example grid.

L7) make the bitmapbutton a staticbitmap, and make its size dependent on
    the point size.

L8) LAYER_WIDGET::GetBestSize() needs platform independence.

Dick:
L9) still thinking about background colors, easier now without wxformbuilder.
+54 −52
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@

#include "wxstruct.h"
#include "base_struct.h"
#include "layer_widget.h"

#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
@@ -36,6 +35,7 @@ class ZONE_CONTAINER;
class DRAWSEGMENT;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
class PCB_LAYER_WIDGET;


/**
@@ -49,34 +49,64 @@ class GENERAL_COLLECTORS_GUIDE;
/*****************************************************/
class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{
    friend class PCB_LAYER_WIDGET;

protected:

    PCB_LAYER_WIDGET* m_Layers;

    DRC* m_drc;                     ///< the DRC controller, see drc.cpp

    // we'll use lower case function names for private member functions.
    void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
    void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
    void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
    void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
    void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
    void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
    void createPopUpBlockMenu( wxMenu* menu );
    void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu );

    /**
     * Class LYRS
     * is here to implement the abtract functions of LAYER_WIDGET so they
     * may be tied into this frame's data.
     * Function setActiveLayer
     * will change the currently active layer to \a aLayer and also
     * update the PCB_LAYER_WIDGET.
     */
    class LYRS : public LAYER_WIDGET
    void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true )
    {
        WinEDA_PcbFrame*    myframe;
        ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;

    public:
        LYRS( WinEDA_PcbFrame* aParent, wxWindow* aFocusOwner ) :
            LAYER_WIDGET( aParent, aFocusOwner ),
            myframe( aParent )
        if( doLayerWidgetUpdate )
            syncLayerWidget();
    }

    /**
     * Function getActiveLayer
     * returns the active layer
     */
    int getActiveLayer()
    {
        return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
    }

        //-----<implement LAYER_WIDGET abstract callback functions>-----------
        void OnLayerColorChange( int aLayer, int aColor );
        bool OnLayerSelect( int aLayer );
        void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
        void OnRenderColorChange( int aId, int aColor );
        void OnRenderEnable( int aId, bool isEnabled );
        //-----</implement LAYER_WIDGET abstract callback functions>----------
    };
    /**
     * Function syncLayerWidget
     * updates the currently "selected" layer within the PCB_LAYER_WIDGET.
     * The currently active layer is defined by the return value of getActiveLayer().
     * <p>
     * This function cannot be inline without including layer_widget.h in
     * here and we do not want to do that.
     */
    void syncLayerWidget();

    /**
     * Function syncLayerBox
     * updates the currently "selected" layer within m_SelLayerBox
     * The currently active layer, as defined by the return value of
     * getActiveLayer().  And updates the colored icon in the toolbar.
     */
    void syncLayerBox();

    LYRS*            m_Layers;              // established in constructor

public:
    WinEDAChoiceBox* m_SelLayerBox;         // a combo box to display and
@@ -95,19 +125,6 @@ public:
    bool             m_show_microwave_tools;
    bool             m_show_layer_manager_tools;

private:

    DRC* m_drc;                     ///< the DRC controller, see drc.cpp

    // we'll use lower case function names for private member functions.
    void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
    void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
    void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
    void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
    void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
    void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
    void createPopUpBlockMenu( wxMenu* menu );
    void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu );

public:
    WinEDA_PcbFrame( wxWindow* father, const wxString& title,
@@ -183,13 +200,6 @@ public:

    /* toolbars update UI functions: */

    /**
     * Function UpdateToolbarLayerInfo
     * updates the currently selected layer in the layer listbox and
     * the colored icon in the toolbar.
     */
    void             UpdateToolbarLayerInfo();

    void             PrepareLayerIndicator();

    /**
@@ -206,14 +216,6 @@ public:
     */
    void             AuxiliaryToolBar_DesignRules_Update_UI();

    /** Function SynchronizeLayersManager( )
     * Must be called when info displayed in the layer manager Toolbar
     * as been changed in the main window ( by hotkey or a tool option.
     * Mainly when the active layer as changed.
     * @param aFlag = flag giving the type of data (layers, checkboxes...)
     */
    void             SynchronizeLayersManager( int aFlag );

    /* mouse functions events: */
    void             OnLeftClick( wxDC* DC, const wxPoint& MousePos );
    void             OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
+0 −2
Original line number Diff line number Diff line
@@ -111,7 +111,6 @@ set(PCBNEW_SRCS
    ioascii.cpp
    print_board_functions.cpp
    printout_controler.cpp
    layer_panel_base.cpp
    layer_widget.cpp
    librairi.cpp
    loadcmp.cpp
@@ -243,7 +242,6 @@ endif(NOT MSVC)

# This one gets made only when testing.
add_executable(layer_widget_test WIN32 EXCLUDE_FROM_ALL
    layer_panel_base.cpp
    layer_widget.cpp
    )
target_link_libraries(layer_widget_test common ${wxWidgets_LIBRARIES})
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )
    {
        if( g_CurrentTrackList.GetCount() > 0 )
        {
            int previous_layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
            int previous_layer = getActiveLayer();

            D( g_CurrentTrackList.VerifyListIntegrity(); )

@@ -71,7 +71,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack )

            // Correct active layer which could change if a via
            // has been erased
            ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = previous_layer;
            setActiveLayer( previous_layer );

            UpdateStatusBar();
            if( g_TwoSegmentTrackBuild )   // We must have 2 segments or more,
Loading