Commit 58fc9d8f authored by dickelbeck's avatar dickelbeck
Browse files

layer widget incorporation into pcbnew

parent c4bc7bb4
Loading
Loading
Loading
Loading
+32 −2
Original line number Original line Diff line number Diff line
@@ -5,6 +5,8 @@
#ifndef _BOARD_DESIGN_SETTING_H
#ifndef _BOARD_DESIGN_SETTING_H
#define _BOARD_DESIGN_SETTING_H
#define _BOARD_DESIGN_SETTING_H


#include "pcbstruct.h"      // NB_COLORS

// Class for handle current printed board design settings
// Class for handle current printed board design settings
class EDA_BoardDesignSettings
class EDA_BoardDesignSettings
{
{
@@ -38,7 +40,7 @@ protected:
public:
public:


    // Color options for screen display of the Printed Board:
    // Color options for screen display of the Printed Board:
    int m_LayerColor[32];                           // Layer colors (tracks and graphic items)
    int m_LayerColor[NB_LAYERS];                    ///< Layer colors (tracks and graphic items)


    int m_ViaColor[4];                              // Via color (depending on is type)
    int m_ViaColor[4];                              // Via color (depending on is type)


@@ -120,7 +122,7 @@ public:
    {
    {
        if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE )
        if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE )
            return false;
            return false;
        return (bool) ( m_VisibleElements & 1 << aCategoryIndex );
        return (bool) ( m_VisibleElements & (1 << aCategoryIndex) );
    }
    }




@@ -179,6 +181,34 @@ public:
     * @param aNewLayerCount = The new number of enabled copper layers
     * @param aNewLayerCount = The new number of enabled copper layers
     */
     */
    void SetCopperLayerCount( int aNewLayerCount );
    void SetCopperLayerCount( int aNewLayerCount );

    /**
     * Function GetLayerColor
     * returns the color for aLayer which is one of the layer indices given
     * in pcbstruct.h
     */
    int GetLayerColor( int aLayer )
    {
        if( (unsigned) aLayer < (unsigned) NB_LAYERS )
        {
            return m_LayerColor[aLayer];
        }
        return -1;
    }

    /**
     * Function SetLayerColor
     * sets the color for aLayer which is one of the layer indices given
     * in pcbstruct.h
     */
    void SetLayerColor( int aLayer, int aColor )
    {
        if( (unsigned) aLayer < (unsigned) NB_LAYERS )
        {
            m_LayerColor[aLayer] = aColor;
        }
    }

};
};




+28 −1
Original line number Original line Diff line number Diff line
@@ -56,7 +56,8 @@ struct KEYWORD
 * to the parser if it wants also to support them.
 * to the parser if it wants also to support them.
 */
 */
enum DSN_SYNTAX_T {
enum DSN_SYNTAX_T {
    DSN_NONE = -10,
    DSN_NONE = -11,
    DSN_COMMENT = -10,
    DSN_STRING_QUOTE = -9,
    DSN_STRING_QUOTE = -9,
    DSN_QUOTE_DEF = -8,
    DSN_QUOTE_DEF = -8,
    DSN_DASH = -7,
    DSN_DASH = -7,
@@ -84,6 +85,7 @@ class DSNLEXER
    LINE_READER         reader;
    LINE_READER         reader;
    int                 stringDelimiter;
    int                 stringDelimiter;
    bool                space_in_quoted_tokens; ///< blank spaces within quoted strings
    bool                space_in_quoted_tokens; ///< blank spaces within quoted strings
    bool                comments_are_tokens;    ///< true if should return comments as tokens


    wxString            filename;
    wxString            filename;
    int                 prevTok;        ///< curTok from previous NextTok() call.
    int                 prevTok;        ///< curTok from previous NextTok() call.
@@ -108,6 +110,18 @@ class DSNLEXER
    }
    }




    /**
     * Function readLineOrCmt
     * reads a line from the LINE_READER and returns either:
     * <ol>
     * <li> a positive line length (a +1 if empty line)
     * <li> zero of end of file.
     * <li> DSN_COMMENT if the line is a comment
     * </ol>
     */
    int readLineOrCmt();


    /**
    /**
     * Function findToken
     * Function findToken
     * takes a string and looks up the string in the list of expected
     * takes a string and looks up the string in the list of expected
@@ -172,6 +186,19 @@ public:
        return old;
        return old;
    }
    }


    /**
     * Function SetCommentsAreTokens
     * changes the handling of comments.  If set true, comments are returns
     * as single line strings with a terminating newline, else they are
     * consumed by the lexer and not returned.
     */
    bool SetCommentsAreTokens( bool val )
    {
        bool old = comments_are_tokens;
        comments_are_tokens = val;
        return old;
    }



    /**
    /**
     * Function NextTok
     * Function NextTok
+51 −2
Original line number Original line Diff line number Diff line
@@ -6,10 +6,9 @@
#define  WXPCB_STRUCT_H
#define  WXPCB_STRUCT_H




#include <vector>

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


#ifndef PCB_INTERNAL_UNIT
#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
#define PCB_INTERNAL_UNIT 10000
@@ -50,6 +49,46 @@ class GENERAL_COLLECTORS_GUIDE;
/*****************************************************/
/*****************************************************/
class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
class WinEDA_PcbFrame : public WinEDA_BasePcbFrame
{
{
protected:

    /**
     * Class LYRS
     * is here to implement the abtract functions of LAYER_WIDGET so they
     * may be tied into this frame's data.
     */
    class LYRS : public LAYER_WIDGET
    {
        WinEDA_PcbFrame*    myframe;

    public:
        LYRS( WinEDA_PcbFrame* aParent ) :
            LAYER_WIDGET( aParent ),
            myframe( aParent )
        {
        }

        //-----<implement LAYER_WIDGET abstract 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 functions>---------------
    };

    /// render rows are fixed, layer rows are dynamically determined.
    static LAYER_WIDGET::ROW renderRows[];

    LYRS*            m_Layers;              // established in constructor

    /**
     * Function ReFillLayerWidget
     * changes out all the layers in m_Layers and may be called upon
     * loading a new BOARD.
     */
    void ReFillLayerWidget();


public:
public:
    WinEDAChoiceBox* m_SelLayerBox;         // a combo box to display and
    WinEDAChoiceBox* m_SelLayerBox;         // a combo box to display and
                                            // select active layer
                                            // select active layer
@@ -323,7 +362,17 @@ public:
    void OnFileHistory( wxCommandEvent& event );
    void OnFileHistory( wxCommandEvent& event );
    void Files_io( wxCommandEvent& event );
    void Files_io( wxCommandEvent& event );
    bool LoadOnePcbFile( const wxString& FileName, bool Append );
    bool LoadOnePcbFile( const wxString& FileName, bool Append );


    /**
     * Function ReadPcbFile
     * reads a board file  <file>.brd
     * @param Append if 0: a previously loaded board is deleted before loading
     *               the file else all items of the board file are added to the
     *               existing board
     */
    int  ReadPcbFile( FILE* File, bool Append );
    int  ReadPcbFile( FILE* File, bool Append );

    bool SavePcbFile( const wxString& FileName );
    bool SavePcbFile( const wxString& FileName );
    int  SavePcbFormatAscii( FILE* File );
    int  SavePcbFormatAscii( FILE* File );
    bool WriteGeneralDescrPcb( FILE* File );
    bool WriteGeneralDescrPcb( FILE* File );
+4 −2
Original line number Original line Diff line number Diff line
@@ -111,6 +111,8 @@ set(PCBNEW_SRCS
    ioascii.cpp
    ioascii.cpp
    print_board_functions.cpp
    print_board_functions.cpp
    printout_controler.cpp
    printout_controler.cpp
    layer_panel_base.cpp
    layer_widget.cpp
    librairi.cpp
    librairi.cpp
    loadcmp.cpp
    loadcmp.cpp
    locate.cpp
    locate.cpp
+44 −31
Original line number Original line Diff line number Diff line
@@ -351,11 +351,14 @@ LAYER_T LAYER::ParseType( const char* aType )
        return LAYER_T( -1 );
        return LAYER_T( -1 );
}
}



int BOARD::GetCopperLayerCount() const
int BOARD::GetCopperLayerCount() const
{
{
    return m_BoardSettings->GetCopperLayerCount();
    return m_BoardSettings->GetCopperLayerCount();
}
}
void BOARD::SetCopperLayerCount( int aCount )
{
    m_BoardSettings->SetCopperLayerCount( aCount );
}




int BOARD::GetEnabledLayers() const
int BOARD::GetEnabledLayers() const
@@ -393,6 +396,16 @@ int BOARD::GetVisibleElements() const
    return m_BoardSettings->GetVisibleElements();
    return m_BoardSettings->GetVisibleElements();
}
}


void BOARD::SetLayerColor( int aLayer, int aColor )
{
    m_BoardSettings->SetLayerColor( aLayer, aColor );
}

int BOARD::GetLayerColor( int aLayer )
{
    return m_BoardSettings->GetLayerColor( aLayer );
}



wxPoint& BOARD::GetPosition()
wxPoint& BOARD::GetPosition()
{
{
Loading