Commit 4125ea77 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Gerbview: remove dependencies from Pcbnew.

Should allow Pcbnew code easier to change and Gerbview code more understandable and easier to maintain.
Code cleaning (remove dead code, add comments).
Minor other enhancements.
parent 2fe9a99b
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -412,6 +412,7 @@ set( BMAPS_MID
    pin_to
    pin_to
    pin
    pin
    plot_hpg
    plot_hpg
    plot_pdf
    plot_ps
    plot_ps
    plot
    plot
    polar_coord
    polar_coord
+1 −1
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ set(COMMON_SRCS
    build_version.cpp
    build_version.cpp
    class_bitmap_base.cpp
    class_bitmap_base.cpp
    class_colors_design_settings.cpp
    class_colors_design_settings.cpp
    class_layer_box_selector.cpp
    class_marker_base.cpp
    class_marker_base.cpp
    class_plotter.cpp
    class_plotter.cpp
    class_undoredo_container.cpp
    class_undoredo_container.cpp
@@ -89,7 +90,6 @@ set(PCB_COMMON_SRCS
    class_page_info.cpp
    class_page_info.cpp
    pcbcommon.cpp
    pcbcommon.cpp
    footprint_info.cpp
    footprint_info.cpp
    class_layer_box_selector.cpp
    ../pcbnew/basepcbframe.cpp
    ../pcbnew/basepcbframe.cpp
    ../pcbnew/class_board.cpp
    ../pcbnew/class_board.cpp
    ../pcbnew/class_board_connected_item.cpp
    ../pcbnew/class_board_connected_item.cpp
+1 −1
Original line number Original line Diff line number Diff line
@@ -40,7 +40,7 @@
#include <base_units.h>
#include <base_units.h>




#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA )
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW )
#define IU_TO_MM( x )       ( x / IU_PER_MM )
#define IU_TO_MM( x )       ( x / IU_PER_MM )
#define IU_TO_IN( x )       ( x / IU_PER_MILS / 1000 )
#define IU_TO_IN( x )       ( x / IU_PER_MILS / 1000 )
#define MM_TO_IU( x )       ( x * IU_PER_MM )
#define MM_TO_IU( x )       ( x * IU_PER_MM )
+23 −78
Original line number Original line Diff line number Diff line
#include <common.h>
#include <common.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <colors_selection.h>
#include <colors_selection.h>
#include <layers_id_colors_and_visibility.h>
#include <layers_id_colors_and_visibility.h>
#include <bitmaps.h>
#include <bitmaps.h>
#include <hotkeys.h>
#include <colors.h>
#include <help_common_strings.h>

#include <class_board.h>


#include <wx/wx.h>
#include <wx/ownerdrw.h>
#include <wx/ownerdrw.h>
#include <wx/menuitem.h>
#include <wx/menuitem.h>
#include <wx/bmpcbox.h>
#include <wx/aui/aui.h>
#include <wx/wx.h>


#include <class_layer_box_selector.h>
#include <class_layer_box_selector.h>


@@ -101,79 +95,30 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer )
    return -1;
    return -1;
}
}



void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
// Reload the Layers
void LAYER_BOX_SELECTOR::Resync()
{
{
    PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
    int elements = GetCount();
    BOARD* board = pcbFrame->GetBoard();
    for( int i = 0; i < elements; i++ )

    wxASSERT( board != NULL );

    Clear();

    static DECLARE_LAYERS_ORDER_LIST( layertranscode );
    static DECLARE_LAYERS_HOTKEY( layerhk );

    for( int i = 0; i < LAYER_COUNT; i++ )
    {
    {
        wxBitmap layerbmp( 14, 14 );
        wxBitmap layerbmp( 14, 14 );
        wxMemoryDC bmpDC;
        SetBitmapLayer( layerbmp, i );
        wxBrush    brush;
        wxString   layername;
        int        layerid = i;

        if( m_layerorder )
            layerid = layertranscode[i];

        if( !board->IsLayerEnabled( layerid ) )
            continue;

        // Prepare Bitmap
        bmpDC.SelectObject( layerbmp );
        brush.SetColour( MakeColour( board->GetLayerColor( layerid ) ) );
        brush.SetStyle( wxSOLID );

        bmpDC.SetBrush( brush );
        bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
        bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
        bmpDC.SetPen( *wxBLACK_PEN );
        bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );

        layername = board->GetLayerName( layerid );

        if( m_layerhotkeys && m_hotkeys != NULL )
            layername = AddHotkeyName( layername, m_hotkeys, layerhk[layerid], IS_COMMENT );

        Append( layername, layerbmp, (void*) layerid );
    }
    }
}
}


void LAYER_BOX_SELECTOR::ResyncBitmapOnly()
{
    PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent();
    BOARD* board = pcbFrame->GetBoard();


    int elements = GetCount();
void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex )
    for( int i = 0; i < elements; i++ )
{
{
        wxBitmap   layerbmp( 14, 14 );
    wxMemoryDC bmpDC;
    wxMemoryDC bmpDC;
    wxBrush    brush;
    wxBrush    brush;
        wxString   layername;
        int        layerid = i;


    // Prepare Bitmap
    // Prepare Bitmap
        bmpDC.SelectObject( layerbmp );
    bmpDC.SelectObject( aLayerbmp );
        brush.SetColour( MakeColour( board->GetLayerColor( layerid ) ) );
    brush.SetColour( MakeColour( GetLayerColor( aLayerIndex ) ) );
    brush.SetStyle( wxSOLID );
    brush.SetStyle( wxSOLID );


    bmpDC.SetBrush( brush );
    bmpDC.SetBrush( brush );
        bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
    bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
    bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
    bmpDC.SetBrush( *wxTRANSPARENT_BRUSH );
    bmpDC.SetPen( *wxBLACK_PEN );
    bmpDC.SetPen( *wxBLACK_PEN );
        bmpDC.DrawRectangle( 0, 0, layerbmp.GetWidth(), layerbmp.GetHeight() );
    bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );

        SetItemBitmap(i, layerbmp);
    }
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -151,7 +151,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
    AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PDF,
    AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PDF,
                 _( "Plot PDF" ),
                 _( "Plot PDF" ),
                 _( "Plot schematic sheet in PDF format" ),
                 _( "Plot schematic sheet in PDF format" ),
                 KiBitmap( plot_ps_xpm ) );
                 KiBitmap( plot_pdf_xpm ) );


    // Plot HPGL
    // Plot HPGL
    AddMenuItem( choice_plot_fmt,
    AddMenuItem( choice_plot_fmt,
Loading