Created a specialization of EDA_DRAW_PANEL_GAL: PCB_DRAW_PANEL_GAL.
Moved View related routines & fields from PCB_{BASE,EDIT}_FRAME & BOARD to PCB_DRAW_PANEL_GAL.
This commit is contained in:
parent
2f6c5f3156
commit
9a47f4c645
|
@ -199,6 +199,28 @@ void EDA_DRAW_PANEL_GAL::StopDrawing()
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::RENDER_SETTINGS* rSettings = m_view->GetPainter()->GetSettings();
|
||||
|
||||
SetTopLayer( aLayer );
|
||||
|
||||
rSettings->ClearActiveLayers();
|
||||
rSettings->SetActiveLayer( aLayer );
|
||||
|
||||
m_view->UpdateAllLayersColor();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SetTopLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
m_view->ClearTopLayers();
|
||||
m_view->SetTopLayer( aLayer );
|
||||
m_view->UpdateAllLayersOrder();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
|
||||
{
|
||||
// Do not do anything if the currently used GAL is correct
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
#ifndef PANELGAL_WXSTRUCT_H
|
||||
#define PANELGAL_WXSTRUCT_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/window.h>
|
||||
|
||||
#include <wx/timer.h>
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class BOARD;
|
||||
|
@ -133,6 +133,18 @@ public:
|
|||
*/
|
||||
void StopDrawing();
|
||||
|
||||
/**
|
||||
* Function SetHighContrastLayer
|
||||
* Takes care of display settings for the given layer to be displayed in high contrast mode.
|
||||
*/
|
||||
virtual void SetHighContrastLayer( LAYER_NUM aLayer );
|
||||
|
||||
/**
|
||||
* Function SetTopLayer
|
||||
* Moves the selected layer to the top, so it is displayed above all others.
|
||||
*/
|
||||
virtual void SetTopLayer( LAYER_NUM aLayer );
|
||||
|
||||
protected:
|
||||
void onPaint( wxPaintEvent& WXUNUSED( aEvent ) );
|
||||
void onSize( wxSizeEvent& aEvent );
|
||||
|
|
|
@ -110,10 +110,6 @@ protected:
|
|||
MODULE* loadFootprint( const FPID& aFootprintId )
|
||||
throw( IO_ERROR, PARSE_ERROR );
|
||||
|
||||
///> Rendering order of layers on GAL-based canvas (lower index in the array
|
||||
///> means that layer is displayed closer to the user, ie. on the top).
|
||||
static const LAYER_NUM GAL_LAYER_ORDER[];
|
||||
|
||||
public:
|
||||
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
|
|
|
@ -531,18 +531,6 @@ public:
|
|||
*/
|
||||
virtual void OnModify();
|
||||
|
||||
/**
|
||||
* Function SetHighContrastLayer
|
||||
* takes care of display settings for the given layer to be displayed in high contrast mode.
|
||||
*/
|
||||
void SetHighContrastLayer( LAYER_ID aLayer );
|
||||
|
||||
/**
|
||||
* Function SetTopLayer
|
||||
* moves the selected layer to the top, so it is displayed above all others.
|
||||
*/
|
||||
void SetTopLayer( LAYER_ID aLayer );
|
||||
|
||||
/**
|
||||
* Function SetActiveLayer
|
||||
* will change the currently active layer to \a aLayer and also
|
||||
|
@ -890,12 +878,6 @@ public:
|
|||
/// @copydoc PCB_BASE_FRAME::SetBoard()
|
||||
void SetBoard( BOARD* aBoard );
|
||||
|
||||
/**
|
||||
* Function ViewReloadBoard
|
||||
* adds all items from the current board to the VIEW, so they can be displayed by GAL.
|
||||
*/
|
||||
void ViewReloadBoard( const BOARD* aBoard ) const;
|
||||
|
||||
// Drc control
|
||||
|
||||
/* function GetDrcController
|
||||
|
|
|
@ -221,6 +221,7 @@ set( PCBNEW_CLASS_SRCS
|
|||
pad_edition_functions.cpp
|
||||
pcbnew_config.cpp
|
||||
pcbplot.cpp
|
||||
pcb_draw_panel_gal.cpp
|
||||
plot_board_layers.cpp
|
||||
plot_brditems_plotter.cpp
|
||||
print_board_functions.cpp
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
#include <collectors.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <view/view.h>
|
||||
#include <math/vector2d.h>
|
||||
#include <trigo.h>
|
||||
|
@ -75,82 +75,6 @@ static const wxChar DisplayModuleTextEntry[] = wxT( "DiModTx" );
|
|||
static const wxChar FastGrid1Entry[] = wxT( "FastGrid1" );
|
||||
static const wxChar FastGrid2Entry[] = wxT( "FastGrid2" );
|
||||
|
||||
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
|
||||
{
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ),
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE ),
|
||||
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
|
||||
|
||||
// UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
|
||||
|
||||
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
|
||||
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
|
||||
|
||||
ITEM_GAL_LAYER( RATSNEST_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
|
||||
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), F_Mask,
|
||||
NETNAMES_GAL_LAYER( F_Cu ), F_Cu,
|
||||
F_SilkS, F_Paste, F_Adhes,
|
||||
|
||||
#if 0 // was:
|
||||
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
|
||||
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
|
||||
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
|
||||
NETNAMES_GAL_LAYER( LAYER_12_NETNAMES_VISIBLE ), LAYER_N_12,
|
||||
NETNAMES_GAL_LAYER( LAYER_11_NETNAMES_VISIBLE ), LAYER_N_11,
|
||||
NETNAMES_GAL_LAYER( LAYER_10_NETNAMES_VISIBLE ), LAYER_N_10,
|
||||
NETNAMES_GAL_LAYER( LAYER_9_NETNAMES_VISIBLE ), LAYER_N_9,
|
||||
NETNAMES_GAL_LAYER( LAYER_8_NETNAMES_VISIBLE ), LAYER_N_8,
|
||||
NETNAMES_GAL_LAYER( LAYER_7_NETNAMES_VISIBLE ), LAYER_N_7,
|
||||
NETNAMES_GAL_LAYER( LAYER_6_NETNAMES_VISIBLE ), LAYER_N_6,
|
||||
NETNAMES_GAL_LAYER( LAYER_5_NETNAMES_VISIBLE ), LAYER_N_5,
|
||||
NETNAMES_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
|
||||
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
|
||||
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
|
||||
#else
|
||||
|
||||
NETNAMES_GAL_LAYER( In1_Cu ), In1_Cu,
|
||||
NETNAMES_GAL_LAYER( In2_Cu ), In2_Cu,
|
||||
NETNAMES_GAL_LAYER( In3_Cu ), In3_Cu,
|
||||
NETNAMES_GAL_LAYER( In4_Cu ), In4_Cu,
|
||||
NETNAMES_GAL_LAYER( In5_Cu ), In5_Cu,
|
||||
NETNAMES_GAL_LAYER( In6_Cu ), In6_Cu,
|
||||
NETNAMES_GAL_LAYER( In7_Cu ), In7_Cu,
|
||||
NETNAMES_GAL_LAYER( In8_Cu ), In8_Cu,
|
||||
NETNAMES_GAL_LAYER( In9_Cu ), In9_Cu,
|
||||
NETNAMES_GAL_LAYER( In10_Cu ), In10_Cu,
|
||||
NETNAMES_GAL_LAYER( In11_Cu ), In11_Cu,
|
||||
NETNAMES_GAL_LAYER( In12_Cu ), In12_Cu,
|
||||
NETNAMES_GAL_LAYER( In13_Cu ), In13_Cu,
|
||||
NETNAMES_GAL_LAYER( In14_Cu ), In14_Cu,
|
||||
NETNAMES_GAL_LAYER( In15_Cu ), In15_Cu,
|
||||
NETNAMES_GAL_LAYER( In16_Cu ), In16_Cu,
|
||||
NETNAMES_GAL_LAYER( In17_Cu ), In17_Cu,
|
||||
NETNAMES_GAL_LAYER( In18_Cu ), In18_Cu,
|
||||
NETNAMES_GAL_LAYER( In19_Cu ), In19_Cu,
|
||||
NETNAMES_GAL_LAYER( In20_Cu ), In20_Cu,
|
||||
NETNAMES_GAL_LAYER( In21_Cu ), In21_Cu,
|
||||
NETNAMES_GAL_LAYER( In22_Cu ), In22_Cu,
|
||||
NETNAMES_GAL_LAYER( In23_Cu ), In23_Cu,
|
||||
NETNAMES_GAL_LAYER( In24_Cu ), In24_Cu,
|
||||
NETNAMES_GAL_LAYER( In25_Cu ), In25_Cu,
|
||||
NETNAMES_GAL_LAYER( In26_Cu ), In26_Cu,
|
||||
NETNAMES_GAL_LAYER( In27_Cu ), In27_Cu,
|
||||
NETNAMES_GAL_LAYER( In28_Cu ), In28_Cu,
|
||||
NETNAMES_GAL_LAYER( In29_Cu ), In29_Cu,
|
||||
NETNAMES_GAL_LAYER( In30_Cu ), In30_Cu,
|
||||
#endif
|
||||
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), B_Mask,
|
||||
NETNAMES_GAL_LAYER( B_Cu ), B_Cu,
|
||||
|
||||
B_Adhes, B_Paste, B_SilkS,
|
||||
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
|
||||
ITEM_GAL_LAYER( WORKSHEET )
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
|
@ -193,16 +117,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
m_FastGrid1 = 0;
|
||||
m_FastGrid2 = 0;
|
||||
|
||||
SetGalCanvas( new EDA_DRAW_PANEL_GAL(
|
||||
this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) );
|
||||
|
||||
// GAL should not be active yet
|
||||
GetGalCanvas()->StopDrawing();
|
||||
|
||||
// Hide by default, it has to be explicitly shown
|
||||
GetGalCanvas()->Hide();
|
||||
|
||||
m_auxiliaryToolBar = NULL;
|
||||
}
|
||||
|
||||
|
@ -253,8 +167,11 @@ FP_LIB_TABLE* PROJECT::PcbFootprintLibs()
|
|||
|
||||
void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
||||
{
|
||||
delete m_Pcb;
|
||||
m_Pcb = aBoard;
|
||||
if( m_Pcb != aBoard )
|
||||
{
|
||||
delete m_Pcb;
|
||||
m_Pcb = aBoard;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -847,52 +764,6 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
if( m_DisplayModText < LINE || m_DisplayModText > SKETCH )
|
||||
m_DisplayModText = FILLED;
|
||||
|
||||
// Apply display settings for GAL
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
|
||||
// Set rendering order and properties of layers
|
||||
for( LAYER_NUM i = 0; i < (int) DIM(GAL_LAYER_ORDER); ++i )
|
||||
{
|
||||
LAYER_NUM layer = GAL_LAYER_ORDER[i];
|
||||
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
|
||||
|
||||
view->SetLayerOrder( layer, i );
|
||||
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// Copper layers are required for netname layers
|
||||
view->SetRequired( GetNetnameLayer( layer ), layer );
|
||||
view->SetLayerTarget( layer, KIGFX::TARGET_CACHED );
|
||||
}
|
||||
else if( IsNetnameLayer( layer ) )
|
||||
{
|
||||
// Netnames are drawn only when scale is sufficient (level of details)
|
||||
// so there is no point in caching them
|
||||
view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
}
|
||||
|
||||
// Some more required layers settings
|
||||
view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
|
||||
view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
|
||||
view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
|
||||
view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
|
||||
|
||||
view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
|
||||
view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
|
||||
|
||||
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
|
||||
// when reading doubles in config,
|
||||
// but forget to back to current locale. So we call SetLocaleTo_Default
|
||||
|
|
|
@ -106,11 +106,6 @@ BOARD::BOARD() :
|
|||
|
||||
// Initialize ratsnest
|
||||
m_ratsnest = new RN_DATA( this );
|
||||
m_ratsnestViewItem = new KIGFX::RATSNEST_VIEWITEM( m_ratsnest );
|
||||
|
||||
// Initialize view item for displaying worksheet frame
|
||||
m_worksheetViewItem = new KIGFX::WORKSHEET_VIEWITEM( &m_paper, &m_titles );
|
||||
m_worksheetViewItem->SetFileName( std::string( m_fileName.mb_str() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,8 +117,6 @@ BOARD::~BOARD()
|
|||
Delete( area_to_remove );
|
||||
}
|
||||
|
||||
delete m_worksheetViewItem;
|
||||
delete m_ratsnestViewItem;
|
||||
delete m_ratsnest;
|
||||
|
||||
m_FullRatsnest.clear();
|
||||
|
|
|
@ -198,8 +198,6 @@ private:
|
|||
EDA_RECT m_BoundingBox;
|
||||
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
|
||||
RN_DATA* m_ratsnest;
|
||||
KIGFX::RATSNEST_VIEWITEM* m_ratsnestViewItem; ///< VIEW_ITEM that draws ratsnest
|
||||
KIGFX::WORKSHEET_VIEWITEM* m_worksheetViewItem; ///< VIEW_ITEM that draws worksheet frame
|
||||
|
||||
BOARD_DESIGN_SETTINGS m_designSettings;
|
||||
ZONE_SETTINGS m_zoneSettings;
|
||||
|
@ -313,24 +311,6 @@ public:
|
|||
return m_ratsnest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetRatsnestViewItem()
|
||||
* returns VIEW_ITEM responsible for drawing the ratsnest for the board.
|
||||
*/
|
||||
KIGFX::RATSNEST_VIEWITEM* GetRatsnestViewItem() const
|
||||
{
|
||||
return m_ratsnestViewItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetWorksheetViewItem()
|
||||
* returns VIEW_ITEM responsible for drawing the worksheet frame.
|
||||
*/
|
||||
KIGFX::WORKSHEET_VIEWITEM* GetWorksheetViewItem() const
|
||||
{
|
||||
return m_worksheetViewItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function DeleteMARKERs
|
||||
* deletes ALL MARKERS from the board.
|
||||
|
|
|
@ -228,7 +228,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
// Apply new display options to the GAL canvas (this is faster than recaching)
|
||||
settings->LoadDisplayOptions( DisplayOpt );
|
||||
|
||||
SetHighContrastLayer( GetActiveLayer() );
|
||||
GetGalCanvas()->SetHighContrastLayer( GetActiveLayer() );
|
||||
m_canvas->Refresh();
|
||||
|
||||
break;
|
||||
|
|
|
@ -61,9 +61,6 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
|
|||
// Update display
|
||||
GetBoard()->SetVisibleLayers( LSET().set() );
|
||||
|
||||
// Set currently selected layer to be shown in high contrast mode, when enabled`
|
||||
SetHighContrastLayer( GetScreen()->m_Active_Layer );
|
||||
|
||||
ReFillLayerWidget();
|
||||
|
||||
Zoom_Automatique( false );
|
||||
|
|
|
@ -0,0 +1,315 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#include "pcb_draw_panel_gal.h"
|
||||
#include <view/view.h>
|
||||
#include <view/wx_view_controls.h>
|
||||
#include <pcb_painter.h>
|
||||
#include <worksheet_viewitem.h>
|
||||
#include <ratsnest_viewitem.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_track.h>
|
||||
#include <pcbcommon.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
const LAYER_NUM GAL_LAYER_ORDER[] =
|
||||
{
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ),
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE ),
|
||||
NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
|
||||
|
||||
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
|
||||
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
|
||||
|
||||
ITEM_GAL_LAYER( RATSNEST_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
|
||||
NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ), F_Mask,
|
||||
NETNAMES_GAL_LAYER( F_Cu ), F_Cu,
|
||||
F_SilkS, F_Paste, F_Adhes,
|
||||
|
||||
#if 0 // was:
|
||||
NETNAMES_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
|
||||
NETNAMES_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
|
||||
NETNAMES_GAL_LAYER( LAYER_13_NETNAMES_VISIBLE ), LAYER_N_13,
|
||||
NETNAMES_GAL_LAYER( LAYER_12_NETNAMES_VISIBLE ), LAYER_N_12,
|
||||
NETNAMES_GAL_LAYER( LAYER_11_NETNAMES_VISIBLE ), LAYER_N_11,
|
||||
NETNAMES_GAL_LAYER( LAYER_10_NETNAMES_VISIBLE ), LAYER_N_10,
|
||||
NETNAMES_GAL_LAYER( LAYER_9_NETNAMES_VISIBLE ), LAYER_N_9,
|
||||
NETNAMES_GAL_LAYER( LAYER_8_NETNAMES_VISIBLE ), LAYER_N_8,
|
||||
NETNAMES_GAL_LAYER( LAYER_7_NETNAMES_VISIBLE ), LAYER_N_7,
|
||||
NETNAMES_GAL_LAYER( LAYER_6_NETNAMES_VISIBLE ), LAYER_N_6,
|
||||
NETNAMES_GAL_LAYER( LAYER_5_NETNAMES_VISIBLE ), LAYER_N_5,
|
||||
NETNAMES_GAL_LAYER( LAYER_4_NETNAMES_VISIBLE ), LAYER_N_4,
|
||||
NETNAMES_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
|
||||
NETNAMES_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
|
||||
#else
|
||||
NETNAMES_GAL_LAYER( In1_Cu ), In1_Cu,
|
||||
NETNAMES_GAL_LAYER( In2_Cu ), In2_Cu,
|
||||
NETNAMES_GAL_LAYER( In3_Cu ), In3_Cu,
|
||||
NETNAMES_GAL_LAYER( In4_Cu ), In4_Cu,
|
||||
NETNAMES_GAL_LAYER( In5_Cu ), In5_Cu,
|
||||
NETNAMES_GAL_LAYER( In6_Cu ), In6_Cu,
|
||||
NETNAMES_GAL_LAYER( In7_Cu ), In7_Cu,
|
||||
NETNAMES_GAL_LAYER( In8_Cu ), In8_Cu,
|
||||
NETNAMES_GAL_LAYER( In9_Cu ), In9_Cu,
|
||||
NETNAMES_GAL_LAYER( In10_Cu ), In10_Cu,
|
||||
NETNAMES_GAL_LAYER( In11_Cu ), In11_Cu,
|
||||
NETNAMES_GAL_LAYER( In12_Cu ), In12_Cu,
|
||||
NETNAMES_GAL_LAYER( In13_Cu ), In13_Cu,
|
||||
NETNAMES_GAL_LAYER( In14_Cu ), In14_Cu,
|
||||
NETNAMES_GAL_LAYER( In15_Cu ), In15_Cu,
|
||||
NETNAMES_GAL_LAYER( In16_Cu ), In16_Cu,
|
||||
NETNAMES_GAL_LAYER( In17_Cu ), In17_Cu,
|
||||
NETNAMES_GAL_LAYER( In18_Cu ), In18_Cu,
|
||||
NETNAMES_GAL_LAYER( In19_Cu ), In19_Cu,
|
||||
NETNAMES_GAL_LAYER( In20_Cu ), In20_Cu,
|
||||
NETNAMES_GAL_LAYER( In21_Cu ), In21_Cu,
|
||||
NETNAMES_GAL_LAYER( In22_Cu ), In22_Cu,
|
||||
NETNAMES_GAL_LAYER( In23_Cu ), In23_Cu,
|
||||
NETNAMES_GAL_LAYER( In24_Cu ), In24_Cu,
|
||||
NETNAMES_GAL_LAYER( In25_Cu ), In25_Cu,
|
||||
NETNAMES_GAL_LAYER( In26_Cu ), In26_Cu,
|
||||
NETNAMES_GAL_LAYER( In27_Cu ), In27_Cu,
|
||||
NETNAMES_GAL_LAYER( In28_Cu ), In28_Cu,
|
||||
NETNAMES_GAL_LAYER( In29_Cu ), In29_Cu,
|
||||
NETNAMES_GAL_LAYER( In30_Cu ), In30_Cu,
|
||||
#endif
|
||||
NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ), B_Mask,
|
||||
NETNAMES_GAL_LAYER( B_Cu ), B_Cu,
|
||||
|
||||
B_Adhes, B_Paste, B_SilkS,
|
||||
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ),
|
||||
ITEM_GAL_LAYER( WORKSHEET )
|
||||
};
|
||||
|
||||
|
||||
PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId,
|
||||
const wxPoint& aPosition, const wxSize& aSize,
|
||||
GalType aGalType ) :
|
||||
EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
|
||||
{
|
||||
m_worksheet = NULL;
|
||||
m_ratsnest = NULL;
|
||||
|
||||
// Set rendering order and properties of layers
|
||||
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
|
||||
{
|
||||
LAYER_NUM layer = GAL_LAYER_ORDER[i];
|
||||
wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
|
||||
|
||||
m_view->SetLayerOrder( layer, i );
|
||||
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
// Copper layers are required for netname layers
|
||||
m_view->SetRequired( GetNetnameLayer( layer ), layer );
|
||||
m_view->SetLayerTarget( layer, KIGFX::TARGET_CACHED );
|
||||
}
|
||||
else if( IsNetnameLayer( layer ) )
|
||||
{
|
||||
// Netnames are drawn only when scale is sufficient (level of details)
|
||||
// so there is no point in caching them
|
||||
m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
}
|
||||
|
||||
// Some more required layers settings
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
m_view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
|
||||
m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( F_Adhes, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( F_Paste, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( F_Mask, ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
|
||||
m_view->SetRequired( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetRequired( B_Adhes, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetRequired( B_Paste, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetRequired( B_Mask, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( PAD_FR_VISIBLE ), ITEM_GAL_LAYER( MOD_FR_VISIBLE ) );
|
||||
m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
|
||||
|
||||
m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
|
||||
m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
|
||||
|
||||
// Load display options (such as filled/outline display of items)
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->LoadDisplayOptions( DisplayOpt );
|
||||
}
|
||||
|
||||
|
||||
PCB_DRAW_PANEL_GAL::~PCB_DRAW_PANEL_GAL()
|
||||
{
|
||||
delete m_worksheet;
|
||||
delete m_ratsnest;
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::DisplayBoard( const BOARD* aBoard )
|
||||
{
|
||||
m_view->Clear();
|
||||
|
||||
// Load zones
|
||||
for( int i = 0; i < aBoard->GetAreaCount(); ++i )
|
||||
m_view->Add( (KIGFX::VIEW_ITEM*) ( aBoard->GetArea( i ) ) );
|
||||
|
||||
// Load drawings
|
||||
for( BOARD_ITEM* drawing = aBoard->m_Drawings; drawing; drawing = drawing->Next() )
|
||||
m_view->Add( drawing );
|
||||
|
||||
// Load tracks
|
||||
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
|
||||
m_view->Add( track );
|
||||
|
||||
// Load modules and its additional elements
|
||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, m_view, _1 ) );
|
||||
m_view->Add( module );
|
||||
}
|
||||
|
||||
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
|
||||
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() )
|
||||
m_view->Add( zone );
|
||||
|
||||
// Ratsnest
|
||||
if( m_ratsnest )
|
||||
{
|
||||
m_view->Remove( m_ratsnest );
|
||||
delete m_ratsnest;
|
||||
}
|
||||
|
||||
m_ratsnest = new KIGFX::RATSNEST_VIEWITEM( aBoard->GetRatsnest() );
|
||||
m_view->Add( m_ratsnest );
|
||||
|
||||
// Load layer color setup from PCB data
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() )->ImportLegacyColors( aBoard->GetColorsSettings() );
|
||||
|
||||
m_view->RecacheAllItems( true );
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet )
|
||||
{
|
||||
if( m_worksheet )
|
||||
{
|
||||
m_view->Remove( m_worksheet );
|
||||
delete m_worksheet;
|
||||
}
|
||||
|
||||
m_worksheet = aWorksheet;
|
||||
m_view->Add( m_worksheet );
|
||||
|
||||
// Limit panning to the size of worksheet frame
|
||||
m_viewControls->SetPanBoundary( aWorksheet->ViewBBox() );
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( LAYER_ID aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::RENDER_SETTINGS* rSettings = m_view->GetPainter()->GetSettings();
|
||||
|
||||
SetTopLayer( aLayer );
|
||||
|
||||
rSettings->ClearActiveLayers();
|
||||
rSettings->SetActiveLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
|
||||
rSettings->SetActiveLayer( layers[i] );
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
m_view->UpdateAllLayersColor();
|
||||
}
|
||||
|
||||
|
||||
void PCB_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
|
||||
{
|
||||
m_view->ClearTopLayers();
|
||||
m_view->SetTopLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ), Dwgs_User,
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
|
||||
{
|
||||
m_view->SetTopLayer( layers[i] );
|
||||
}
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
m_view->SetTopLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
m_view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
m_view->SetTopLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
m_view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
m_view->UpdateAllLayersOrder();
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef PCB_DRAW_PANEL_GAL_H_
|
||||
#define PCB_DRAW_PANEL_GAL_H_
|
||||
|
||||
#include <class_draw_panel_gal.h>
|
||||
|
||||
namespace KIGFX
|
||||
{
|
||||
class WORKSHEET_VIEWITEM;
|
||||
class RATSNEST_VIEWITEM;
|
||||
}
|
||||
|
||||
class PCB_DRAW_PANEL_GAL : public EDA_DRAW_PANEL_GAL
|
||||
{
|
||||
public:
|
||||
PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition,
|
||||
const wxSize& aSize, GalType aGalType = GAL_TYPE_OPENGL );
|
||||
|
||||
virtual ~PCB_DRAW_PANEL_GAL();
|
||||
|
||||
/**
|
||||
* Function DisplayBoard
|
||||
* adds all items from the current board to the VIEW, so they can be displayed by GAL.
|
||||
* @param aBoard is the PCB to be loaded.
|
||||
*/
|
||||
void DisplayBoard( const BOARD* aBoard );
|
||||
|
||||
/**
|
||||
* Function SetWorksheet
|
||||
* Sets (or updates) worksheet used by the draw panel.
|
||||
* @param aWorksheet is the worksheet to be used.
|
||||
* The object is then owned by PCB_DRAW_PANEL_GAL.
|
||||
*/
|
||||
void SetWorksheet( KIGFX::WORKSHEET_VIEWITEM* aWorksheet );
|
||||
|
||||
///> @copydoc EDA_DRAW_PANEL_GAL::SetHighContrastLayer()
|
||||
virtual void SetHighContrastLayer( LAYER_ID aLayer );
|
||||
|
||||
///> @copydoc EDA_DRAW_PANEL_GAL::SetTopLayer()
|
||||
virtual void SetTopLayer( LAYER_ID aLayer );
|
||||
|
||||
protected:
|
||||
///> Currently used worksheet
|
||||
KIGFX::WORKSHEET_VIEWITEM* m_worksheet;
|
||||
|
||||
///> Ratsnest view item
|
||||
KIGFX::RATSNEST_VIEWITEM* m_ratsnest;
|
||||
};
|
||||
|
||||
#endif /* PCB_DRAW_PANEL_GAL_H_ */
|
|
@ -76,7 +76,7 @@
|
|||
#define PYTHONCONSOLE_STRID wxT( "PythonPanel" )
|
||||
#endif
|
||||
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <pcb_draw_panel_gal.h>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
// Keys used in read/write config
|
||||
|
@ -174,9 +174,9 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, PCB_EDIT_FRAME::Show3D_Frame )
|
||||
|
||||
// Switching canvases
|
||||
EVT_MENU( ID_MENU_CANVAS_DEFAULT, PCB_EDIT_FRAME::SwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_EDIT_FRAME::SwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_EDIT_FRAME::SwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_DEFAULT, PCB_EDIT_FRAME::SwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_EDIT_FRAME::SwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_EDIT_FRAME::SwitchCanvas )
|
||||
|
||||
// Menu Get Design Rules Editor
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, PCB_EDIT_FRAME::ShowDesignRulesEditor )
|
||||
|
@ -330,6 +330,16 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
for ( int i = 0; i < 10; i++ )
|
||||
m_Macros[i].m_Record.clear();
|
||||
|
||||
// Create GAL canvas
|
||||
SetGalCanvas( new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
PCB_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) );
|
||||
|
||||
// GAL should not be active yet
|
||||
GetGalCanvas()->StopDrawing();
|
||||
|
||||
// Hide by default, it has to be explicitly shown
|
||||
GetGalCanvas()->Hide();
|
||||
|
||||
SetBoard( new BOARD() );
|
||||
|
||||
// Create the PCB_LAYER_WIDGET *after* SetBoard():
|
||||
|
@ -404,7 +414,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
lyrs.BestSize( m_Layers->GetBestSize() );
|
||||
lyrs.Caption( _( "Visibles" ) );
|
||||
|
||||
|
||||
if( m_mainToolBar ) // The main horizontal toolbar
|
||||
{
|
||||
m_auimgr.AddPane( m_mainToolBar,
|
||||
|
@ -480,84 +489,36 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
if( IsGalCanvasActive() )
|
||||
{
|
||||
ViewReloadBoard( aBoard );
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( aBoard );
|
||||
aBoard->GetRatsnest()->Recalculate();
|
||||
|
||||
// Prepare worksheet template
|
||||
KIGFX::WORKSHEET_VIEWITEM* worksheet = new KIGFX::WORKSHEET_VIEWITEM( &aBoard->GetPageSettings(),
|
||||
&aBoard->GetTitleBlock() );
|
||||
worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
|
||||
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
if( screen != NULL )
|
||||
{
|
||||
worksheet->SetSheetNumber( screen->m_ScreenNumber );
|
||||
worksheet->SetSheetCount( screen->m_NumberOfScreens );
|
||||
}
|
||||
|
||||
// PCB_DRAW_PANEL_GAL takes ownership of the worksheet
|
||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SetWorksheet( worksheet );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
if( m_toolManager )
|
||||
{
|
||||
m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
|
||||
{
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
view->Clear();
|
||||
|
||||
// All of PCB drawing elements should be added to the VIEW
|
||||
// in order to be displayed
|
||||
|
||||
// Load zones
|
||||
for( int i = 0; i < aBoard->GetAreaCount(); ++i )
|
||||
view->Add( (KIGFX::VIEW_ITEM*) ( aBoard->GetArea( i ) ) );
|
||||
|
||||
// Load drawings
|
||||
for( BOARD_ITEM* drawing = aBoard->m_Drawings; drawing; drawing = drawing->Next() )
|
||||
view->Add( drawing );
|
||||
|
||||
// Load tracks
|
||||
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
|
||||
view->Add( track );
|
||||
|
||||
// Load modules and its additional elements
|
||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
|
||||
view->Add( module );
|
||||
}
|
||||
|
||||
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
|
||||
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() )
|
||||
view->Add( zone );
|
||||
|
||||
KIGFX::WORKSHEET_VIEWITEM* worksheet = aBoard->GetWorksheetViewItem();
|
||||
worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
|
||||
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
if( screen != NULL )
|
||||
{
|
||||
worksheet->SetSheetNumber( screen->m_ScreenNumber );
|
||||
worksheet->SetSheetCount( screen->m_NumberOfScreens );
|
||||
}
|
||||
|
||||
view->Add( worksheet );
|
||||
view->Add( aBoard->GetRatsnestViewItem() );
|
||||
aBoard->GetRatsnest()->Recalculate();
|
||||
|
||||
// Apply layer coloring scheme & display options
|
||||
if( view->GetPainter() )
|
||||
{
|
||||
KIGFX::PCB_RENDER_SETTINGS* settings =
|
||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
|
||||
|
||||
// Load layers' colors from PCB data
|
||||
settings->ImportLegacyColors( m_Pcb->GetColorsSettings() );
|
||||
|
||||
// Load display options (such as filled/outline display of items)
|
||||
settings->LoadDisplayOptions( DisplayOpt );
|
||||
}
|
||||
|
||||
// Limit panning to the size of worksheet frame
|
||||
GetGalCanvas()->GetViewControls()->SetPanBoundary( aBoard->GetWorksheetViewItem()->ViewBBox() );
|
||||
view->RecacheAllItems( true );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
GetGalCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
bool PCB_EDIT_FRAME::isAutoSaveRequired() const
|
||||
{
|
||||
return GetScreen()->IsSave();
|
||||
|
@ -676,12 +637,7 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
|||
|
||||
if( aEnable )
|
||||
{
|
||||
ViewReloadBoard( m_Pcb );
|
||||
GetGalCanvas()->GetView()->RecacheAllItems();
|
||||
|
||||
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
SetBoard( m_Pcb );
|
||||
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
|
@ -824,97 +780,11 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetHighContrastLayer( LAYER_ID aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
KIGFX::RENDER_SETTINGS* rSettings = view->GetPainter()->GetSettings();
|
||||
|
||||
SetTopLayer( aLayer );
|
||||
|
||||
rSettings->ClearActiveLayers();
|
||||
rSettings->SetActiveLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned i = 0; i < DIM( layers ); ++i )
|
||||
rSettings->SetActiveLayer( layers[i] );
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
view->UpdateAllLayersColor();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetTopLayer( LAYER_ID aLayer )
|
||||
{
|
||||
// Set display settings for high contrast mode
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
|
||||
view->ClearTopLayers();
|
||||
view->SetTopLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
// fixme do not like the idea of storing the list of layers here,
|
||||
// should be done in some other way I guess..
|
||||
LAYER_NUM layers[] = {
|
||||
GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( RATSNEST_VISIBLE ), Dwgs_User,
|
||||
ITEM_GAL_LAYER( DRC_VISIBLE )
|
||||
};
|
||||
|
||||
for( unsigned i = 0; i < DIM( layers ); ++i )
|
||||
{
|
||||
view->SetTopLayer( layers[i] );
|
||||
}
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == B_Cu )
|
||||
{
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == F_Cu )
|
||||
{
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetTopLayer( NETNAMES_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
|
||||
view->UpdateAllLayersOrder();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer, bool doLayerWidgetUpdate )
|
||||
{
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
||||
|
||||
SetHighContrastLayer( aLayer );
|
||||
GetGalCanvas()->SetHighContrastLayer( aLayer );
|
||||
|
||||
if( doLayerWidgetUpdate )
|
||||
syncLayerWidgetLayer();
|
||||
|
|
|
@ -578,7 +578,7 @@ void ROUTER_TOOL::performRouting()
|
|||
else if( evt->IsAction( &ACT_PlaceThroughVia ) )
|
||||
{
|
||||
m_router->ToggleViaPlacement();
|
||||
frame->SetTopLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
|
||||
frame->GetGalCanvas()->SetTopLayer( ToLAYER_ID( m_router->GetCurrentLayer() ) );
|
||||
m_router->Move( m_endSnapPoint, m_endItem );
|
||||
}
|
||||
else if( evt->IsAction( &ACT_SwitchPosture ) )
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "common_actions.h"
|
||||
|
||||
#include <wxPcbStruct.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <project.h>
|
||||
#include <id.h>
|
||||
#include <pcbnew_id.h>
|
||||
|
@ -1085,7 +1086,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
|
|||
// Apply the selected settings
|
||||
zone = new ZONE_CONTAINER( m_board );
|
||||
zoneInfo.ExportSetting( *zone );
|
||||
m_frame->SetTopLayer( zoneInfo.m_CurrentZone_Layer );
|
||||
m_frame->GetGalCanvas()->SetTopLayer( zoneInfo.m_CurrentZone_Layer );
|
||||
|
||||
// Add the first point
|
||||
zone->Outline()->Start( zoneInfo.m_CurrentZone_Layer,
|
||||
|
|
|
@ -190,7 +190,7 @@ int PCBNEW_CONTROL::HighContrastMode( TOOL_EVENT& aEvent )
|
|||
|
||||
DisplayOpt.ContrastModeDisplay = !DisplayOpt.ContrastModeDisplay;
|
||||
settings->LoadDisplayOptions( DisplayOpt );
|
||||
m_frame->SetHighContrastLayer( m_frame->GetActiveLayer() );
|
||||
m_frame->GetGalCanvas()->SetHighContrastLayer( m_frame->GetActiveLayer() );
|
||||
|
||||
setTransitions();
|
||||
|
||||
|
|
Loading…
Reference in New Issue