KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_draw_panel_gal.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014-2017 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Maciej Suminski <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include "pcb_draw_panel_gal.h"
27#include <pcb_view.h>
29#include <pcb_painter.h>
32
33#include <board.h>
34#include <footprint.h>
35#include <pcb_track.h>
36#include <macros.h>
37#include <pcb_marker.h>
38#include <pcb_generator.h>
39#include <pcb_base_frame.h>
40#include <pcbnew_settings.h>
43
44#include <pgm_base.h>
46#include <confirm.h>
47#include <progress_reporter.h>
48
50#include <zoom_defines.h>
51
52#include <functional>
53#include <memory>
54#include <thread>
55
56using namespace std::placeholders;
57
58
59const int GAL_LAYER_ORDER[] =
60{
71
75
85
131
132
134
141
154
245
258
263
309
317
348
356
358};
359
360
361PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId,
362 const wxPoint& aPosition, const wxSize& aSize,
363 KIGFX::GAL_DISPLAY_OPTIONS& aOptions, GAL_TYPE aGalType ) :
364 EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalType )
365{
366 m_view = new KIGFX::PCB_VIEW();
367 m_view->SetGAL( m_gal );
368
370
371 if( EDA_BASE_FRAME* frame = dynamic_cast<EDA_BASE_FRAME*>( aParentWindow ) )
372 frameType = frame->GetFrameType();
373
374 m_painter = std::make_unique<KIGFX::PCB_PAINTER>( m_gal, frameType );
375 m_view->SetPainter( m_painter.get() );
376
377 // This fixes the zoom in and zoom out limits:
379
382
383 // View controls is the first in the event handler chain, so the Tool Framework operates
384 // on updated viewport data.
386
387 // Load display options (such as filled/outline display of items).
388 // Can be made only if the parent window is an EDA_DRAW_FRAME (or a derived class)
389 // which is not always the case (namely when it is used from a wxDialog like the pad editor)
390 if( !IsDialogPreview() )
391 {
392 KIGFX::PCB_VIEW* view = static_cast<KIGFX::PCB_VIEW*>( m_view );
393 PCB_BASE_FRAME* frame = dynamic_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() );
394
395 if( frame )
396 view->UpdateDisplayOptions( frame->GetDisplayOptions() );
397 }
398}
399
400
402{
403}
404
405
407{
408 m_view->Clear();
409
410 aBoard->CacheTriangulation( aReporter );
411
412 if( m_drawingSheet )
413 m_drawingSheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) );
414
415 // Load drawings
416 for( BOARD_ITEM* drawing : aBoard->Drawings() )
417 m_view->Add( drawing );
418
419 // Load tracks
420 for( PCB_TRACK* track : aBoard->Tracks() )
421 m_view->Add( track );
422
423 // Load footprints and its additional elements
424 for( FOOTPRINT* footprint : aBoard->Footprints() )
425 m_view->Add( footprint );
426
427 // DRC markers
428 for( PCB_MARKER* marker : aBoard->Markers() )
429 m_view->Add( marker );
430
431 // Load zones
432 for( ZONE* zone : aBoard->Zones() )
433 m_view->Add( zone );
434
435 for( PCB_GENERATOR* generator : aBoard->Generators() )
436 m_view->Add( generator );
437
438 // Ratsnest
439 if( !aBoard->IsFootprintHolder() )
440 {
441 m_ratsnest = std::make_unique<RATSNEST_VIEW_ITEM>( aBoard->GetConnectivity() );
442 m_view->Add( m_ratsnest.get() );
443 }
444}
445
446
448{
449 m_drawingSheet.reset( aDrawingSheet );
450 m_view->Add( m_drawingSheet.get() );
451}
452
453
455{
456 COLOR_SETTINGS* cs = nullptr;
457
458 PCB_BASE_FRAME* frame = dynamic_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() );
459
460 if( frame )
461 {
462 cs = frame->GetColorSettings();
463 }
464 else
465 {
466 auto* app = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>( "pcbnew" );
467
468 if( app )
469 cs = Pgm().GetSettingsManager().GetColorSettings( app->m_ColorTheme );
470 else
472 }
473
474 wxCHECK_RET( cs, wxT( "null COLOR_SETTINGS" ) );
475
476 auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() );
477 rs->LoadColors( cs );
478
482}
483
484
486{
487 // Set display settings for high contrast mode
489
490 SetTopLayer( aLayer );
491 rSettings->SetActiveLayer( aLayer );
492
493 rSettings->ClearHighContrastLayers();
494 rSettings->SetLayerIsHighContrast( aLayer );
495
496 if( IsCopperLayer( aLayer ) )
497 {
498 // Bring some other layers to the front in case of copper layers and make them colored
499 // fixme do not like the idea of storing the list of layers here,
500 // should be done in some other way I guess..
501 int layers[] = {
503 GetNetnameLayer( aLayer ),
506 PAD_COPPER_LAYER_FOR( aLayer ),
507 VIA_COPPER_LAYER_FOR( aLayer ),
508 ZONE_LAYER_FOR( aLayer ),
509 BITMAP_LAYER_FOR( aLayer ),
517 };
518
519 for( int i : layers )
520 rSettings->SetLayerIsHighContrast( i );
521
522 for( int i = LAYER_UI_START; i < LAYER_UI_END; ++i )
523 rSettings->SetLayerIsHighContrast( i );
524
525 // Pads should be shown too
526 if( aLayer == B_Cu )
527 {
529 }
530 else if( aLayer == F_Cu )
531 {
533 }
534 }
535
537}
538
539
541{
544 m_view->SetTopLayer( aLayer );
545
546 // Layers that should always have on-top attribute enabled
547 const std::vector<int> layers = {
557 };
558
559 for( auto layer : layers )
560 m_view->SetTopLayer( layer );
561
562 for( int i = LAYER_UI_START; i < LAYER_UI_END; i++ )
563 m_view->SetTopLayer( i );
564
565 // Extra layers that are brought to the top if a F.* or B.* is selected
566 const std::vector<int> frontLayers = {
569 };
570
571 const std::vector<int> backLayers = {
574 };
575
576 const std::vector<int>* extraLayers = nullptr;
577
578 // Bring a few more extra layers to the top depending on the selected board side
579 if( IsFrontLayer( aLayer ) )
580 extraLayers = &frontLayers;
581 else if( IsBackLayer( aLayer ) )
582 extraLayers = &backLayers;
583
584 if( extraLayers )
585 {
586 for( auto layer : *extraLayers )
587 {
588 m_view->SetTopLayer( layer );
589
590 if( layer < PCB_LAYER_ID_COUNT )
591 {
592 m_view->SetTopLayer( ZONE_LAYER_FOR( layer ) );
596 }
597 }
598
599 // Move the active layer to the top of the stack but below all the overlay layers
600 if( !IsCopperLayer( aLayer ) )
601 {
605
606 // Fix up pad and via netnames to be below. This is hacky, we need a rethink
607 // of layer ordering...
612 }
613 }
614
615 if( IsCopperLayer( aLayer ) )
616 {
617 m_view->SetTopLayer( ZONE_LAYER_FOR( aLayer ) );
621
622 // Display labels for copper layers on the top
623 m_view->SetTopLayer( GetNetnameLayer( aLayer ) );
624 }
625
626 m_view->SetTopLayer( BITMAP_LAYER_FOR( aLayer ) );
627 m_view->EnableTopLayer( true );
629}
630
631
633{
634 // Load layer & elements visibility settings
635 for( int i = 0; i < PCB_LAYER_ID_COUNT; ++i )
636 m_view->SetLayerVisible( i, aBoard->IsLayerVisible( PCB_LAYER_ID( i ) ) );
637
639 m_view->SetLayerVisible( i, aBoard->IsElementVisible( i ) );
640
641 // Via layers controlled by dependencies
645
646 // Always enable netname layers, as their visibility is controlled by layer dependencies
647 for( int i = NETNAMES_LAYER_ID_START; i < NETNAMES_LAYER_ID_END; ++i )
648 m_view->SetLayerVisible( i, true );
649
650 for( int i = LAYER_ZONE_START; i < LAYER_ZONE_END; i++ )
651 m_view->SetLayerVisible( i, true );
652
653 for( int i = LAYER_PAD_COPPER_START; i < LAYER_PAD_COPPER_END; i++ )
654 m_view->SetLayerVisible( i, true );
655
656 for( int i = LAYER_VIA_COPPER_START; i < LAYER_VIA_COPPER_END; i++ )
657 m_view->SetLayerVisible( i, true );
658
659 for( int i = LAYER_CLEARANCE_START; i < LAYER_CLEARANCE_END; i++ )
660 m_view->SetLayerVisible( i, false );
661
662 for( int i = LAYER_BITMAP_START; i < LAYER_BITMAP_END; i++ )
663 m_view->SetLayerVisible( i, true );
664
665 for( int i = LAYER_UI_START; i < LAYER_UI_END; i++ )
666 m_view->SetLayerVisible( i, true );
667
668 // Enable some layers that are GAL specific
680}
681
682
684 std::vector<MSG_PANEL_ITEM>& aList )
685{
686 BOARD* board = static_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() )->GetBoard();
687 int padCount = 0;
688 int viaCount = 0;
689 int trackSegmentCount = 0;
690 std::set<int> netCodes;
691 int unconnected = (int) board->GetConnectivity()->GetUnconnectedCount( true );
692
693 for( PCB_TRACK* item : board->Tracks() )
694 {
695 if( item->Type() == PCB_VIA_T )
696 viaCount++;
697 else
698 trackSegmentCount++;
699
700 if( item->GetNetCode() > 0 )
701 netCodes.insert( item->GetNetCode() );
702 }
703
704 for( FOOTPRINT* footprint : board->Footprints() )
705 {
706 for( PAD* pad : footprint->Pads() )
707 {
708 padCount++;
709
710 if( pad->GetNetCode() > 0 )
711 netCodes.insert( pad->GetNetCode() );
712 }
713 }
714
715 aList.emplace_back( _( "Pads" ), wxString::Format( wxT( "%d" ), padCount ) );
716 aList.emplace_back( _( "Vias" ), wxString::Format( wxT( "%d" ), viaCount ) );
717 aList.emplace_back( _( "Track Segments" ), wxString::Format( wxT( "%d" ), trackSegmentCount ) );
718 aList.emplace_back( _( "Nets" ), wxString::Format( wxT( "%d" ), (int) netCodes.size() ) );
719 aList.emplace_back( _( "Unrouted" ), wxString::Format( wxT( "%d" ), unconnected ) );
720}
721
722
724{
725 PCB_BASE_FRAME* frame = nullptr;
726
727 if( !IsDialogPreview() )
728 frame = dynamic_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() );
729
730 try
731 {
732 // Check if the current rendering back end can be properly initialized
734 }
735 catch( const std::runtime_error& e )
736 {
737 DisplayError( GetParent(), e.what() );
738
739 // Use the fallback if we have one
740 if( GAL_FALLBACK != m_backend )
741 {
743
744 if( frame )
745 frame->ActivateGalCanvas();
746 }
747 }
748
749 if( frame )
750 {
751 SetTopLayer( frame->GetActiveLayer() );
752
753 KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( m_view->GetPainter() );
754 KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
755
756 settings->LoadDisplayOptions( frame->GetDisplayOptions() );
758 }
759}
760
761
763{
764 for( int i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( int ); ++i )
765 {
766 int layer = GAL_LAYER_ORDER[i];
767 wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
768
769 // MW: Gross hack to make SetTopLayer bring the correct bitmap layer to
770 // the top of the other bitmaps, but still below all the other layers
771 if( layer >= LAYER_BITMAP_START && layer < LAYER_BITMAP_END )
773 else
774 m_view->SetLayerOrder( layer, i );
775 }
776}
777
778
780{
781 bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
783 m_gal->SetWorldUnitLength( 1e-9 /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
784 return rv;
785}
786
787
789{
790 if( m_ratsnest )
791 m_view->Update( m_ratsnest.get() );
792}
793
794
796{
798 return m_drawingSheet->ViewBBox();
799
800 return BOX2I();
801}
802
803
805{
806 // caching makes no sense for Cairo and other software renderers
808
809 for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
810 m_view->SetLayerTarget( i, target );
811
812 for( int i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( int ); ++i )
813 {
814 int layer = GAL_LAYER_ORDER[i];
815 wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
816
817 // Set layer display dependencies & targets
818 if( IsCopperLayer( layer ) )
819 {
820 m_view->SetRequired( ZONE_LAYER_FOR( layer ), layer );
821 m_view->SetRequired( PAD_COPPER_LAYER_FOR( layer ), layer );
822 m_view->SetRequired( VIA_COPPER_LAYER_FOR( layer ), layer );
823 m_view->SetRequired( CLEARANCE_LAYER_FOR( layer ), layer );
824
825 m_view->SetRequired( BITMAP_LAYER_FOR( layer ), layer );
827 m_view->SetRequired( GetNetnameLayer( layer ), layer );
828 }
829 else if( IsNonCopperLayer( layer ) )
830 {
831 m_view->SetRequired( ZONE_LAYER_FOR( layer ), layer );
833 m_view->SetRequired( BITMAP_LAYER_FOR( layer ), layer );
834 }
835 else if( IsNetnameLayer( layer ) )
836 {
837 m_view->SetLayerDisplayOnly( layer );
838 }
839 }
840
843
844 // Use TARGET_OVERLAY for LAYER_CONFLICTS_SHADOW, it is for items
845 // that may change while the view stays the same.
847
850
851 // Some more required layers settings
853
854 // Holes can be independent of their host objects (cf: printing drill marks)
860
861 // Via visibility
866
873
875 //m_view->SetLayerDisplayOnly( LAYER_DRC_ERROR );
877 //m_view->SetLayerDisplayOnly( LAYER_DRC_WARNING );
879 //m_view->SetLayerDisplayOnly( LAYER_DRC_EXCLUSION );
886
890
891 for( int i = LAYER_UI_START; i < LAYER_UI_END; ++i )
892 {
895 }
896}
897
898
900{
901 return static_cast<KIGFX::PCB_VIEW*>( m_view );
902}
BOX2< VECTOR2I > BOX2I
Definition: box2.h:922
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:295
bool IsFootprintHolder() const
Find out if the board is being used to hold a single footprint for editing/viewing.
Definition: board.h:325
const GENERATORS & Generators() const
Definition: board.h:342
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:897
const ZONES & Zones() const
Definition: board.h:340
const MARKERS & Markers() const
Definition: board.h:344
const FOOTPRINTS & Footprints() const
Definition: board.h:336
const TRACKS & Tracks() const
Definition: board.h:334
const wxString & GetFileName() const
Definition: board.h:332
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
Definition: board.cpp:837
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:489
void CacheTriangulation(PROGRESS_REPORTER *aReporter=nullptr, const std::vector< ZONE * > &aZones={})
Definition: board.cpp:986
const DRAWINGS & Drawings() const
Definition: board.h:338
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
The base frame for deriving all KiCad main window classes.
The base class for create windows for drawing purpose.
static constexpr GAL_TYPE GAL_FALLBACK
std::unique_ptr< KIGFX::PAINTER > m_painter
Contains information about how to draw items using GAL.
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
@ GAL_TYPE_OPENGL
OpenGL implementation.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
virtual bool SwitchBackend(GAL_TYPE aGalType)
Switch method of rendering graphics.
GAL_TYPE m_backend
Currently used GAL.
EDA_DRAW_FRAME * GetParentEDAFrame() const
Returns parent EDA_DRAW_FRAME, if available or NULL otherwise.
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
void SetCursorColor(const COLOR4D &aCursorColor)
Set the cursor color.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:181
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
Definition: pcb_painter.h:186
PCB specific render settings.
Definition: pcb_painter.h:79
void LoadColors(const COLOR_SETTINGS *aSettings) override
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tra...
void UpdateDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Definition: pcb_view.cpp:121
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void ClearHighContrastLayers()
Clear the list of active layers.
void SetActiveLayer(PCB_LAYER_ID aLayer)
void SetLayerIsHighContrast(int aLayerId, bool aEnabled=true)
Set the specified layer as high-contrast.
static constexpr int TOP_LAYER_MODIFIER
Rendering order modifier for layers that are marked as top layers.
Definition: view.h:744
void UpdateAllLayersOrder()
Do everything that is needed to apply the rendering order of layers.
Definition: view.cpp:896
void SetRequired(int aLayerId, int aRequiredId, bool aRequired=true)
Mark the aRequiredId layer as required for the aLayerId layer.
Definition: view.cpp:398
void SetLayerDisplayOnly(int aLayer, bool aDisplayOnly=true)
Set a layer display-only (ie: to be rendered but not returned by hit test queries).
Definition: view.h:477
int GetLayerOrder(int aLayer) const
Return rendering order of a particular layer.
Definition: view.cpp:654
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:297
virtual void EnableTopLayer(bool aEnable)
Enable or disable display of the top layer.
Definition: view.cpp:856
void SetPainter(PAINTER *aPainter)
Set the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:206
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:765
void SetGAL(GAL *aGal)
Assign a rendering device for the VIEW.
Definition: view.cpp:501
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Change the rendering target for a particular layer.
Definition: view.h:493
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1673
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:396
void Clear()
Remove all items from the view.
Definition: view.cpp:1131
void ClearTopLayers()
Remove all layers from the on-the-top set (they are no longer displayed over the rest of layers).
Definition: view.cpp:881
static constexpr int VIEW_MAX_LAYERS
Maximum number of layers that may be shown.
Definition: view.h:741
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1456
virtual void SetTopLayer(int aLayer, bool aEnabled=true)
Set given layer to be displayed on the top or sets back the default order of layers.
Definition: view.cpp:829
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:418
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:216
void SetScaleLimits(double aMaximum, double aMinimum)
Set minimum and maximum values for scale.
Definition: view.h:312
void SetLayerOrder(int aLayer, int aRenderingOrder)
Set rendering order of a particular layer.
Definition: view.cpp:646
An implementation of class VIEW_CONTROLS for wxWidgets library.
Definition: pad.h:54
DISPLAY_OPTIONS m_Display
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
virtual void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
virtual COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void UpdateColors()
Update the color settings in the painter and GAL.
PCB_DRAW_PANEL_GAL(wxWindow *aParentWindow, wxWindowID aWindowId, const wxPoint &aPosition, const wxSize &aSize, KIGFX::GAL_DISPLAY_OPTIONS &aOptions, GAL_TYPE aGalType=GAL_TYPE_OPENGL)
BOX2I GetDefaultViewBBox() const override
Return the bounding box of the view that should be used if model is not valid.
virtual void SetTopLayer(int aLayer) override
SetTopLayer(), with some extra smarts for PCB.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Called when the window is shown for the first time.
std::unique_ptr< RATSNEST_VIEW_ITEM > m_ratsnest
Ratsnest view item.
void SetDrawingSheet(DS_PROXY_VIEW_ITEM *aDrawingSheet)
Sets (or updates) drawing-sheet used by the draw panel.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void OnShow() override
Called when the window is shown for the first time.
void DisplayBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
void setDefaultLayerOrder()
< Reassign layer order to the initial settings.
virtual void SetHighContrastLayer(int aLayer) override
SetHighContrastLayer(), with some extra smarts for PCB.
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Currently used drawing-sheet.
bool SwitchBackend(GAL_TYPE aGalType) override
Force refresh of the ratsnest visual representation.
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:125
A progress reporter interface for use in multi-threaded environments.
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieve a color settings object that applications can read colors from.
T * GetAppSettings(const wxString &aFilename)
Return a handle to the a given settings by type.
Handle a list of polygons defining a copper zone.
Definition: zone.h:73
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:170
This file is part of the common library.
#define _(s)
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:33
@ FRAME_FOOTPRINT_PREVIEW
Definition: frame_type.h:48
@ LAYER_PAD_FR_NETNAMES
Additional netnames layers (not associated with a PCB layer).
Definition: layer_ids.h:200
@ LAYER_PAD_BK_NETNAMES
Definition: layer_ids.h:201
@ LAYER_PAD_NETNAMES
Definition: layer_ids.h:202
@ NETNAMES_LAYER_ID_START
Definition: layer_ids.h:194
@ NETNAMES_LAYER_ID_END
Definition: layer_ids.h:205
@ LAYER_VIA_NETNAMES
Definition: layer_ids.h:203
#define BITMAP_LAYER_FOR(boardLayer)
Macros for getting the extra layers for a given board layer.
Definition: layer_ids.h:357
#define NETNAMES_LAYER_INDEX(layer)
Macro for obtaining netname layer for a given PCB layer.
Definition: layer_ids.h:209
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
Definition: layer_ids.h:720
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:743
bool IsNonCopperLayer(int aLayerId)
Test whether a layer is a non copper layer.
Definition: layer_ids.h:651
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
Definition: layer_ids.h:794
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition: layer_ids.h:618
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:228
@ LAYER_GRID
Definition: layer_ids.h:253
@ GAL_LAYER_ID_START
Definition: layer_ids.h:229
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
Definition: layer_ids.h:306
@ LAYER_PAD_COPPER_START
Virtual layers for pad copper on a given copper layer.
Definition: layer_ids.h:331
@ LAYER_VIA_HOLEWALLS
Definition: layer_ids.h:297
@ LAYER_CLEARANCE_END
Definition: layer_ids.h:340
@ LAYER_GRID_AXES
Definition: layer_ids.h:254
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
Definition: layer_ids.h:309
@ LAYER_FOOTPRINTS_FR
Show footprints on front.
Definition: layer_ids.h:258
@ LAYER_DRC_SHAPE1
Custom shape for DRC marker.
Definition: layer_ids.h:314
@ LAYER_ZONE_END
Definition: layer_ids.h:328
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
Definition: layer_ids.h:238
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
Definition: layer_ids.h:277
@ LAYER_FP_REFERENCES
Show footprints references (when texts are visible).
Definition: layer_ids.h:265
@ LAYER_DRC_EXCLUSION
Layer for DRC markers which have been individually excluded.
Definition: layer_ids.h:303
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
Definition: layer_ids.h:291
@ LAYER_DRC_WARNING
Layer for DRC markers with #SEVERITY_WARNING.
Definition: layer_ids.h:300
@ LAYER_UI_START
Definition: layer_ids.h:347
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
Definition: layer_ids.h:270
@ GAL_LAYER_ID_END
Definition: layer_ids.h:350
@ LAYER_GP_OVERLAY
General purpose overlay.
Definition: layer_ids.h:278
@ LAYER_VIA_COPPER_START
Virtual layers for via copper on a given copper layer.
Definition: layer_ids.h:335
@ LAYER_CURSOR
PCB cursor.
Definition: layer_ids.h:281
@ LAYER_RATSNEST
Definition: layer_ids.h:252
@ LAYER_CLEARANCE_START
Virtual layers for pad/via/track clearance outlines for a given copper layer.
Definition: layer_ids.h:339
@ LAYER_DRC_SHAPE2
Custom shape for DRC marker.
Definition: layer_ids.h:315
@ LAYER_PAD_COPPER_END
Definition: layer_ids.h:332
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
Definition: layer_ids.h:327
@ LAYER_FP_TEXT
Definition: layer_ids.h:239
@ LAYER_FOOTPRINTS_BK
Show footprints on back.
Definition: layer_ids.h:259
@ LAYER_UI_END
Definition: layer_ids.h:348
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
Definition: layer_ids.h:247
@ LAYER_VIA_COPPER_END
Definition: layer_ids.h:336
@ LAYER_MARKER_SHADOWS
Shadows for DRC markers.
Definition: layer_ids.h:304
@ LAYER_VIA_HOLES
Draw via holes (pad holes do not use this layer).
Definition: layer_ids.h:273
@ LAYER_FP_VALUES
Show footprints values (when texts are visible).
Definition: layer_ids.h:262
@ LAYER_VIA_MICROVIA
Definition: layer_ids.h:233
@ LAYER_SELECT_OVERLAY
Selected items overlay.
Definition: layer_ids.h:279
@ LAYER_VIA_THROUGH
Draw blind/buried vias.
Definition: layer_ids.h:235
@ LAYER_BITMAP_END
Definition: layer_ids.h:344
@ LAYER_BITMAP_START
Virtual layers for background images per board layer.
Definition: layer_ids.h:343
@ LAYER_DRC_ERROR
Layer for DRC markers with #SEVERITY_ERROR.
Definition: layer_ids.h:276
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:232
@ LAYER_VIA_BBLIND
Draw micro vias.
Definition: layer_ids.h:234
@ LAYER_PAD_HOLEWALLS
Definition: layer_ids.h:296
#define CLEARANCE_LAYER_FOR(boardLayer)
Definition: layer_ids.h:361
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:809
#define VIA_COPPER_LAYER_FOR(boardLayer)
Definition: layer_ids.h:360
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ User_16
Definition: layer_ids.h:139
@ In22_Cu
Definition: layer_ids.h:87
@ In11_Cu
Definition: layer_ids.h:76
@ User_29
Definition: layer_ids.h:152
@ In29_Cu
Definition: layer_ids.h:94
@ In30_Cu
Definition: layer_ids.h:95
@ User_40
Definition: layer_ids.h:163
@ User_15
Definition: layer_ids.h:138
@ User_8
Definition: layer_ids.h:131
@ F_CrtYd
Definition: layer_ids.h:116
@ User_11
Definition: layer_ids.h:134
@ User_25
Definition: layer_ids.h:148
@ In17_Cu
Definition: layer_ids.h:82
@ User_34
Definition: layer_ids.h:157
@ User_45
Definition: layer_ids.h:168
@ B_Adhes
Definition: layer_ids.h:103
@ User_36
Definition: layer_ids.h:159
@ Edge_Cuts
Definition: layer_ids.h:112
@ Dwgs_User
Definition: layer_ids.h:107
@ F_Paste
Definition: layer_ids.h:104
@ In9_Cu
Definition: layer_ids.h:74
@ Cmts_User
Definition: layer_ids.h:108
@ User_6
Definition: layer_ids.h:129
@ User_7
Definition: layer_ids.h:130
@ In19_Cu
Definition: layer_ids.h:84
@ User_19
Definition: layer_ids.h:142
@ User_23
Definition: layer_ids.h:146
@ In7_Cu
Definition: layer_ids.h:72
@ In28_Cu
Definition: layer_ids.h:93
@ In26_Cu
Definition: layer_ids.h:91
@ F_Adhes
Definition: layer_ids.h:102
@ User_41
Definition: layer_ids.h:164
@ B_Mask
Definition: layer_ids.h:98
@ B_Cu
Definition: layer_ids.h:65
@ User_14
Definition: layer_ids.h:137
@ User_39
Definition: layer_ids.h:162
@ User_5
Definition: layer_ids.h:128
@ User_20
Definition: layer_ids.h:143
@ Eco1_User
Definition: layer_ids.h:109
@ F_Mask
Definition: layer_ids.h:97
@ In21_Cu
Definition: layer_ids.h:86
@ User_42
Definition: layer_ids.h:165
@ User_43
Definition: layer_ids.h:166
@ In23_Cu
Definition: layer_ids.h:88
@ B_Paste
Definition: layer_ids.h:105
@ In15_Cu
Definition: layer_ids.h:80
@ In2_Cu
Definition: layer_ids.h:67
@ User_10
Definition: layer_ids.h:133
@ User_9
Definition: layer_ids.h:132
@ User_27
Definition: layer_ids.h:150
@ User_28
Definition: layer_ids.h:151
@ F_Fab
Definition: layer_ids.h:119
@ In10_Cu
Definition: layer_ids.h:75
@ Margin
Definition: layer_ids.h:113
@ F_SilkS
Definition: layer_ids.h:100
@ In4_Cu
Definition: layer_ids.h:69
@ B_CrtYd
Definition: layer_ids.h:115
@ Eco2_User
Definition: layer_ids.h:110
@ In16_Cu
Definition: layer_ids.h:81
@ In24_Cu
Definition: layer_ids.h:89
@ In1_Cu
Definition: layer_ids.h:66
@ User_35
Definition: layer_ids.h:158
@ User_31
Definition: layer_ids.h:154
@ User_3
Definition: layer_ids.h:126
@ User_1
Definition: layer_ids.h:124
@ User_12
Definition: layer_ids.h:135
@ B_SilkS
Definition: layer_ids.h:101
@ User_30
Definition: layer_ids.h:153
@ User_37
Definition: layer_ids.h:160
@ User_22
Definition: layer_ids.h:145
@ User_38
Definition: layer_ids.h:161
@ In13_Cu
Definition: layer_ids.h:78
@ User_4
Definition: layer_ids.h:127
@ In8_Cu
Definition: layer_ids.h:73
@ User_21
Definition: layer_ids.h:144
@ In14_Cu
Definition: layer_ids.h:79
@ User_24
Definition: layer_ids.h:147
@ PCB_LAYER_ID_COUNT
Definition: layer_ids.h:171
@ User_13
Definition: layer_ids.h:136
@ User_2
Definition: layer_ids.h:125
@ In12_Cu
Definition: layer_ids.h:77
@ User_17
Definition: layer_ids.h:140
@ In27_Cu
Definition: layer_ids.h:92
@ In6_Cu
Definition: layer_ids.h:71
@ In5_Cu
Definition: layer_ids.h:70
@ User_33
Definition: layer_ids.h:156
@ User_26
Definition: layer_ids.h:149
@ In3_Cu
Definition: layer_ids.h:68
@ User_32
Definition: layer_ids.h:155
@ In20_Cu
Definition: layer_ids.h:85
@ User_18
Definition: layer_ids.h:141
@ User_44
Definition: layer_ids.h:167
@ F_Cu
Definition: layer_ids.h:64
@ In18_Cu
Definition: layer_ids.h:83
@ In25_Cu
Definition: layer_ids.h:90
@ B_Fab
Definition: layer_ids.h:118
#define ZONE_LAYER_FOR(boardLayer)
Definition: layer_ids.h:358
#define PAD_COPPER_LAYER_FOR(boardLayer)
Definition: layer_ids.h:359
This file contains miscellaneous commonly used macros and functions.
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
Definition: definitions.h:38
@ TARGET_CACHED
Main rendering target (cached)
Definition: definitions.h:37
@ TARGET_OVERLAY
Items that may change while the view stays the same (noncached)
Definition: definitions.h:39
const int GAL_LAYER_ORDER[]
BOARD * GetBoard()
PGM_BASE & Pgm()
The global program "get" accessor.
Definition: pgm_base.cpp:1073
see class PGM_BASE
Class that computes missing connections on a PCB.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: string_utils.h:403
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
WX_VIEW_CONTROLS class definition.
#define ZOOM_MAX_LIMIT_PCBNEW
Definition: zoom_defines.h:65
#define ZOOM_MIN_LIMIT_PCBNEW
Definition: zoom_defines.h:66