KiCad PCB EDA Suite
FOOTPRINT_PREVIEW_PANEL Class Reference

Panel that renders a single footprint via Cairo GAL, meant to be exported through Kiface. More...

#include <footprint_preview_panel.h>

Inheritance diagram for FOOTPRINT_PREVIEW_PANEL:
PCB_DRAW_PANEL_GAL KIWAY_HOLDER FOOTPRINT_PREVIEW_PANEL_BASE EDA_DRAW_PANEL_GAL

Public Types

enum  GAL_TYPE {
  GAL_TYPE_UNKNOWN = -1, GAL_TYPE_NONE = 0, GAL_TYPE_OPENGL, GAL_TYPE_CAIRO,
  GAL_TYPE_LAST
}
 
enum  HOLDER_TYPE { DIALOG, FRAME, PANEL }
 

Public Member Functions

virtual ~FOOTPRINT_PREVIEW_PANEL ()
 
virtual bool DisplayFootprint (const LIB_ID &aFPID) override
 Set the currently displayed footprint. More...
 
virtual const KIGFX::COLOR4DGetBackgroundColor () override
 Get the colors to use in a preview widget to match the preview panel. More...
 
virtual const KIGFX::COLOR4DGetForegroundColor () override
 
virtual wxWindow * GetWindow () override
 Get the underlying wxWindow. More...
 
BOARDGetBoard ()
 
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. More...
 
void SetDrawingSheet (DS_PROXY_VIEW_ITEM *aDrawingSheet)
 Sets (or updates) drawing-sheet used by the draw panel. More...
 
DS_PROXY_VIEW_ITEMGetDrawingSheet () const
 
void UpdateColors ()
 Update the color settings in the painter and GAL. More...
 
virtual void SetHighContrastLayer (int aLayer) override
 SetHighContrastLayer(), with some extra smarts for PCB. More...
 
void SetHighContrastLayer (PCB_LAYER_ID aLayer)
 Move the selected layer to the top, so it is displayed above all others. More...
 
virtual void SetTopLayer (int aLayer) override
 SetTopLayer(), with some extra smarts for PCB. More...
 
void SetTopLayer (PCB_LAYER_ID aLayer)
 
void SyncLayersVisibility (const BOARD *aBoard)
 Update "visibility" property of each layer of a given BOARD. More...
 
void GetMsgPanelInfo (EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
 Called when the window is shown for the first time. More...
 
void OnShow () override
 Called when the window is shown for the first time. More...
 
bool SwitchBackend (GAL_TYPE aGalType) override
 Force refresh of the ratsnest visual representation. More...
 
void RedrawRatsnest ()
 Return the bounding box of the view that should be used if model is not valid. More...
 
BOX2I GetDefaultViewBBox () const override
 Return the bounding box of the view that should be used if model is not valid. More...
 
virtual KIGFX::PCB_VIEWGetView () const override
 Return a pointer to the #VIEW instance used in the panel. More...
 
virtual void SetFocus () override
 
GAL_TYPE GetBackend () const
 Return the type of backend currently used by GAL canvas. More...
 
KIGFX::GALGetGAL () const
 Return a pointer to the GAL instance used in the panel. More...
 
KIGFX::VIEW_CONTROLSGetViewControls () const
 Return a pointer to the #VIEW_CONTROLS instance used in the panel. More...
 
virtual void Refresh (bool aEraseBackground=true, const wxRect *aRect=nullptr) override
 Update the board display after modifying it by a python script (note: it is automatically called by action plugins, after running the plugin, so call this function is usually not needed inside action plugins. More...
 
void ForceRefresh ()
 Force a redraw. More...
 
void SetEventDispatcher (TOOL_DISPATCHER *aEventDispatcher)
 Set a dispatcher that processes events and forwards them to tools. More...
 
void StartDrawing ()
 Begin drawing if it was stopped previously. More...
 
void StopDrawing ()
 Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called. More...
 
EDA_DRAW_FRAMEGetParentEDAFrame () const
 Returns parent EDA_DRAW_FRAME, if available or NULL otherwise. More...
 
bool IsDialogPreview () const
 
void SetStealsFocus (bool aStealsFocus)
 Set whether focus is taken on certain events (mouseover, keys, etc). More...
 
void SetCurrentCursor (KICURSOR aCursor)
 Set the current cursor shape for this panel. More...
 
void OnEvent (wxEvent &aEvent)
 Used to forward events to the canvas from popups, etc. More...
 
void DoRePaint ()
 Repaint the canvas, and fix scrollbar cursors. More...
 
std::shared_ptr< KIGFX::VIEW_OVERLAYDebugOverlay ()
 Create an overlay for rendering debug graphics. More...
 
void ClearDebugOverlay ()
 Clear the contents of the debug overlay and removes it from the VIEW. More...
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 

Static Public Member Functions

static FOOTPRINT_PREVIEW_PANELNew (KIWAY *aKiway, wxWindow *aParent)
 
static FOOTPRINT_PREVIEW_PANEL_BASECreate (wxWindow *aParent, KIWAY &aKiway)
 Return a footprint preview panel instance via Kiface. More...
 

Public Attributes

bool m_MouseCapturedLost
 used on wxMSW: true after a wxEVT_MOUSE_CAPTURE_LOST was received false after the mouse is recaptured. More...
 
std::unique_ptr< PROF_COUNTERm_PaintEventCounter
 

Static Public Attributes

static constexpr GAL_TYPE GAL_FALLBACK = GAL_TYPE_CAIRO
 

Protected Member Functions

void setDefaultLayerOrder ()
 < Reassign layer order to the initial settings. More...
 
void setDefaultLayerDeps ()
 Currently used drawing-sheet. More...
 
virtual void onPaint (wxPaintEvent &WXUNUSED(aEvent))
 
void onSize (wxSizeEvent &aEvent)
 
void onEnter (wxMouseEvent &aEvent)
 
void onLostFocus (wxFocusEvent &aEvent)
 
void onRefreshTimer (wxTimerEvent &aEvent)
 
void onShowTimer (wxTimerEvent &aEvent)
 

Protected Attributes

std::unique_ptr< DS_PROXY_VIEW_ITEMm_drawingSheet
 Ratsnest view item. More...
 
std::unique_ptr< RATSNEST_VIEW_ITEMm_ratsnest
 
wxWindow * m_parent
 Pointer to the parent window. More...
 
EDA_DRAW_FRAMEm_edaFrame
 Parent EDA_DRAW_FRAME (if available) More...
 
wxLongLong m_lastRefresh
 Last timestamp when the panel was refreshed. More...
 
bool m_pendingRefresh
 Is there a redraw event requested? More...
 
wxTimer m_refreshTimer
 Timer to prevent too-frequent refreshing. More...
 
bool m_drawing
 True if GAL is currently redrawing the view. More...
 
bool m_drawingEnabled
 Flag that determines if VIEW may use GAL for redrawing the screen. More...
 
wxTimer m_onShowTimer
 Timer used to execute OnShow() when the window finally appears on the screen. More...
 
KIGFX::GALm_gal
 Interface for drawing objects on a 2D-surface. More...
 
KIGFX::VIEWm_view
 Stores view settings (scale, center, etc.) and items to be drawn. More...
 
std::unique_ptr< KIGFX::PAINTERm_painter
 Contains information about how to draw items using GAL. More...
 
KIGFX::WX_VIEW_CONTROLSm_viewControls
 Control for VIEW (moving, zooming, etc.) More...
 
GAL_TYPE m_backend
 Currently used GAL. More...
 
KIGFX::GAL_DISPLAY_OPTIONSm_options
 
TOOL_DISPATCHERm_eventDispatcher
 Processes and forwards events to tools. More...
 
bool m_lostFocus
 Flag to indicate that focus should be regained on the next mouse event. More...
 
bool m_stealsFocus
 Flag to indicate whether the panel should take focus at certain times (when moused over, and on various mouse/key events) More...
 
std::shared_ptr< KIGFX::VIEW_OVERLAYm_debugOverlay
 Optional overlay for drawing transient debug objects. More...
 

Static Protected Attributes

static const int MinRefreshPeriod = 17
 60 FPS. More...
 

Private Member Functions

 FOOTPRINT_PREVIEW_PANEL (KIWAY *aKiway, wxWindow *aParent, std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > aOpts, GAL_TYPE aGalType)
 Create a new panel. More...
 
void renderFootprint (std::shared_ptr< FOOTPRINT > aFootprint)
 

Private Attributes

std::unique_ptr< BOARDm_dummyBoard
 
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONSm_displayOptions
 
std::shared_ptr< FOOTPRINTm_currentFootprint
 

Detailed Description

Panel that renders a single footprint via Cairo GAL, meant to be exported through Kiface.

Definition at line 48 of file footprint_preview_panel.h.

Member Enumeration Documentation

◆ GAL_TYPE

Enumerator
GAL_TYPE_UNKNOWN 

not specified: a GAL engine must be set by the client

GAL_TYPE_NONE 

GAL not used (the legacy wxDC engine is used)

GAL_TYPE_OPENGL 

OpenGL implementation.

GAL_TYPE_CAIRO 

Cairo implementation.

GAL_TYPE_LAST 

Sentinel, do not use as a parameter.

Definition at line 61 of file class_draw_panel_gal.h.

61  {
62  GAL_TYPE_UNKNOWN = -1,
63  GAL_TYPE_NONE = 0,
67  };
Sentinel, do not use as a parameter.
not specified: a GAL engine must be set by the client
GAL not used (the legacy wxDC engine is used)

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

Definition at line 39 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ ~FOOTPRINT_PREVIEW_PANEL()

FOOTPRINT_PREVIEW_PANEL::~FOOTPRINT_PREVIEW_PANEL ( )
virtual

Definition at line 64 of file footprint_preview_panel.cpp.

65 {
66  if( m_currentFootprint )
67  {
68  GetView()->Remove( m_currentFootprint.get() );
69  GetView()->Clear();
70  m_currentFootprint->SetParent( nullptr );
71  }
72 }
std::shared_ptr< FOOTPRINT > m_currentFootprint
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
void Clear()
Remove all items from the view.
Definition: view.cpp:1100
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.

References KIGFX::VIEW::Clear(), PCB_DRAW_PANEL_GAL::GetView(), m_currentFootprint, and KIGFX::PCB_VIEW::Remove().

◆ FOOTPRINT_PREVIEW_PANEL()

FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL ( KIWAY aKiway,
wxWindow *  aParent,
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS aOpts,
GAL_TYPE  aGalType 
)
private

Create a new panel.

Parameters
aKiwaythe connected KIWAY
aParentthe owning WX window
aOptsthe GAL options (ownership is assumed)
aGalTypethe displayed GAL type

Definition at line 42 of file footprint_preview_panel.cpp.

44  :
45  PCB_DRAW_PANEL_GAL( aParent, -1, wxPoint( 0, 0 ), wxSize( 200, 200 ), *aOpts, aGalType ),
47  m_displayOptions( std::move( aOpts ) ),
48  m_currentFootprint( nullptr )
49 {
50  SetStealsFocus( false );
51  ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
52  EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
53 
54  m_dummyBoard = std::make_unique<BOARD>();
55  UpdateColors();
57 
58  Raise();
59  Show( true );
60  StartDrawing();
61 }
std::shared_ptr< FOOTPRINT > m_currentFootprint
std::unique_ptr< BOARD > m_dummyBoard
void SetStealsFocus(bool aStealsFocus)
Set whether focus is taken on certain events (mouseover, keys, etc).
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)
KIWAY_HOLDER(KIWAY *aKiway, HOLDER_TYPE aType)
Definition: kiway_holder.h:41
void SyncLayersVisibility(const BOARD *aBoard)
Update "visibility" property of each layer of a given BOARD.
void StartDrawing()
Begin drawing if it was stopped previously.
void UpdateColors()
Update the color settings in the painter and GAL.
std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > m_displayOptions

References m_dummyBoard, move, EDA_DRAW_PANEL_GAL::SetStealsFocus(), EDA_DRAW_PANEL_GAL::StartDrawing(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), and PCB_DRAW_PANEL_GAL::UpdateColors().

Referenced by New().

Member Function Documentation

◆ ClearDebugOverlay()

void EDA_DRAW_PANEL_GAL::ClearDebugOverlay ( )
inherited

Clear the contents of the debug overlay and removes it from the VIEW.

Definition at line 622 of file draw_panel_gal.cpp.

623 {
624  if( m_debugOverlay )
625  {
626  m_view->Remove( m_debugOverlay.get() );
627  m_debugOverlay = nullptr;
628  }
629 }
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:350
std::shared_ptr< KIGFX::VIEW_OVERLAY > m_debugOverlay
Optional overlay for drawing transient debug objects.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.

References EDA_DRAW_PANEL_GAL::m_debugOverlay, EDA_DRAW_PANEL_GAL::m_view, and KIGFX::VIEW::Remove().

◆ Create()

FOOTPRINT_PREVIEW_PANEL_BASE * FOOTPRINT_PREVIEW_PANEL_BASE::Create ( wxWindow *  aParent,
KIWAY aKiway 
)
staticinherited

Return a footprint preview panel instance via Kiface.

May return null if Kiway is not available or there is any error on load.

Definition at line 109 of file footprint_preview_widget.cpp.

111 {
112  FOOTPRINT_PREVIEW_PANEL_BASE* panel = nullptr;
113 
114  try
115  {
116  KIFACE* kiface = aKiway.KiFACE( KIWAY::FACE_PCB );
117  wxWindow* window = kiface->CreateWindow( aParent, FRAME_FOOTPRINT_PREVIEW, &aKiway );
118 
119  panel = dynamic_cast<FOOTPRINT_PREVIEW_PANEL_BASE*>( window );
120 
121  if( window && !panel )
122  delete window;
123  }
124  catch( ... )
125  {
126  }
127 
128  return panel;
129 }
BITMAP2CMP_SETTINGS kiface
pcbnew DSO
Definition: kiway.h:269
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition: kiway.cpp:197
Base class for the actual viewer panel.
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:148

References KIWAY::FACE_PCB, FRAME_FOOTPRINT_PREVIEW, kiface, and KIWAY::KiFACE().

Referenced by FOOTPRINT_PREVIEW_WIDGET::FOOTPRINT_PREVIEW_WIDGET().

◆ DebugOverlay()

std::shared_ptr< KIGFX::VIEW_OVERLAY > EDA_DRAW_PANEL_GAL::DebugOverlay ( )
inherited

Create an overlay for rendering debug graphics.

Definition at line 610 of file draw_panel_gal.cpp.

611 {
612  if( !m_debugOverlay )
613  {
614  m_debugOverlay.reset( new KIGFX::VIEW_OVERLAY() );
615  m_view->Add( m_debugOverlay.get() );
616  }
617 
618  return m_debugOverlay;
619 }
std::shared_ptr< KIGFX::VIEW_OVERLAY > m_debugOverlay
Optional overlay for drawing transient debug objects.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320

References KIGFX::VIEW::Add(), EDA_DRAW_PANEL_GAL::m_debugOverlay, and EDA_DRAW_PANEL_GAL::m_view.

◆ DisplayBoard()

void PCB_DRAW_PANEL_GAL::DisplayBoard ( BOARD aBoard,
PROGRESS_REPORTER aReporter = nullptr 
)
inherited

Add all items from the current board to the VIEW, so they can be displayed by GAL.

Parameters
aBoardis the PCB to be loaded.

Definition at line 181 of file pcb_draw_panel_gal.cpp.

182 {
183  m_view->Clear();
184 
185  auto zones = aBoard->Zones();
186  std::atomic<size_t> next( 0 );
187  std::atomic<size_t> count_done( 0 );
188  size_t parallelThreadCount = std::max<size_t>( std::thread::hardware_concurrency(), 2 );
189 
190  for( size_t ii = 0; ii < parallelThreadCount; ++ii )
191  {
192  std::thread t = std::thread( [ &count_done, &next, &zones ]( )
193  {
194  for( size_t i = next.fetch_add( 1 ); i < zones.size(); i = next.fetch_add( 1 ) )
195  zones[i]->CacheTriangulation();
196 
197  count_done++;
198  } );
199 
200  t.detach();
201  }
202 
203  if( m_drawingSheet )
204  m_drawingSheet->SetFileName( TO_UTF8( aBoard->GetFileName() ) );
205 
206  // Load drawings
207  for( BOARD_ITEM* drawing : aBoard->Drawings() )
208  m_view->Add( drawing );
209 
210  // Load tracks
211  for( PCB_TRACK* track : aBoard->Tracks() )
212  m_view->Add( track );
213 
214  // Load footprints and its additional elements
215  for( FOOTPRINT* footprint : aBoard->Footprints() )
216  m_view->Add( footprint );
217 
218  // DRC markers
219  for( PCB_MARKER* marker : aBoard->Markers() )
220  m_view->Add( marker );
221 
222  // Finalize the triangulation threads
223  while( count_done < parallelThreadCount )
224  {
225  if( aReporter )
226  aReporter->KeepRefreshing();
227 
228  std::this_thread::sleep_for( std::chrono::milliseconds( 30 ) );
229  }
230 
231  // Load zones
232  for( ZONE* zone : aBoard->Zones() )
233  m_view->Add( zone );
234 
235  // Ratsnest
236  m_ratsnest = std::make_unique<RATSNEST_VIEW_ITEM>( aBoard->GetConnectivity() );
237  m_view->Add( m_ratsnest.get() );
238 }
CITER next(CITER it)
Definition: ptree.cpp:126
ZONES & Zones()
Definition: board.h:240
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:49
MARKERS & Markers()
Definition: board.h:243
const wxString & GetFileName() const
Definition: board.h:229
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:96
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Ratsnest view item.
void Clear()
Remove all items from the view.
Definition: view.cpp:1100
FOOTPRINTS & Footprints()
Definition: board.h:234
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:345
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
virtual bool KeepRefreshing(bool aWait=false)=0
Update the UI (if any).
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320
std::unique_ptr< RATSNEST_VIEW_ITEM > m_ratsnest
DRAWINGS & Drawings()
Definition: board.h:237
TRACKS & Tracks()
Definition: board.h:231

References KIGFX::VIEW::Add(), KIGFX::VIEW::Clear(), BOARD::Drawings(), BOARD::Footprints(), BOARD::GetConnectivity(), BOARD::GetFileName(), PROGRESS_REPORTER::KeepRefreshing(), PCB_DRAW_PANEL_GAL::m_drawingSheet, PCB_DRAW_PANEL_GAL::m_ratsnest, EDA_DRAW_PANEL_GAL::m_view, BOARD::Markers(), next(), TO_UTF8, BOARD::Tracks(), and BOARD::Zones().

Referenced by PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), Refresh(), PCB_BASE_EDIT_FRAME::SetBoard(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), and FOOTPRINT_EDIT_FRAME::UpdateView().

◆ DisplayFootprint()

bool FOOTPRINT_PREVIEW_PANEL::DisplayFootprint ( const LIB_ID aFPID)
overridevirtual

Set the currently displayed footprint.

Any footprint passed in here must have been passed to CacheFootprint before.

Implements FOOTPRINT_PREVIEW_PANEL_BASE.

Definition at line 135 of file footprint_preview_panel.cpp.

136 {
137  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
138 
139  try
140  {
141  const FOOTPRINT* fp = fptbl->GetEnumeratedFootprint( aFPID.GetLibNickname(), aFPID.GetLibItemName() );
142 
143  if( fp )
144  m_currentFootprint.reset( static_cast<FOOTPRINT*>( fp->Duplicate() ) );
145  else
146  m_currentFootprint.reset();
147  }
148  catch( ... )
149  {
150  m_currentFootprint.reset();
151  }
152 
154  Refresh();
155 
156  return m_currentFootprint != nullptr;
157 }
const UTF8 & GetLibItemName() const
Definition: lib_id.h:104
std::shared_ptr< FOOTPRINT > m_currentFootprint
void renderFootprint(std::shared_ptr< FOOTPRINT > aFootprint)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:90
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:1725
const FOOTPRINT * GetEnumeratedFootprint(const wxString &aNickname, const wxString &aFootprintName)
A version of FootprintLoad() for use after FootprintEnumerate() for more efficient cache management.
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:283
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...

References FOOTPRINT::Duplicate(), FP_LIB_TABLE::GetEnumeratedFootprint(), LIB_ID::GetLibItemName(), LIB_ID::GetLibNickname(), m_currentFootprint, PROJECT::PcbFootprintLibs(), KIWAY_HOLDER::Prj(), EDA_DRAW_PANEL_GAL::Refresh(), and renderFootprint().

◆ DoRePaint()

void EDA_DRAW_PANEL_GAL::DoRePaint ( )
inherited

Repaint the canvas, and fix scrollbar cursors.

Usually called by a OnPaint event.

Because it does not use a wxPaintDC, it can be called outside a wxPaintEvent.

Definition at line 175 of file draw_panel_gal.cpp.

176 {
177  // Repaint the canvas, and fix scrollbar cursors
178  // Usually called by a OnPaint event, but because it does not use a wxPaintDC,
179  // it can be called outside a wxPaintEvent.
180 
181  // Update current zoom settings if the canvas is managed by a EDA frame
182  // (i.e. not by a preview panel in a dialog)
183  if( !IsDialogPreview() && GetParentEDAFrame() && GetParentEDAFrame()->GetScreen() )
185 
187 
188  if( !m_gal->IsVisible() )
189  return;
190 
191  m_pendingRefresh = false;
192 
193  if( m_drawing )
194  return;
195 
196  ( *m_PaintEventCounter )++;
197 
198  wxASSERT( m_painter );
199 
200  m_drawing = true;
201  KIGFX::RENDER_SETTINGS* settings =
202  static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
203 
204  PROF_TIMER cntUpd("view-upd-items");
205  PROF_TIMER cntTotal("view-total");
206  PROF_TIMER cntCtx("view-context-create");
207  PROF_TIMER cntCtxDestroy("view-context-destroy");
208  PROF_TIMER cntRedraw("view-redraw-rects");
209 
210  bool isDirty = false;
211 
212  cntTotal.Start();
213  try
214  {
215  cntUpd.Start();
216 
217  try
218  {
219  m_view->UpdateItems();
220  }
221  catch( std::out_of_range& err )
222  {
223  // Don't do anything here but don't fail
224  // This can happen when we don't catch `at()` calls
225  wxString msg;
226  msg.Printf( wxT( "Out of Range error: %s" ), err.what() );
227  wxLogDebug( msg );
228  }
229 
230  cntUpd.Stop();
231 
232  cntCtx.Start();
234  cntCtx.Stop();
235 
238  {
239  m_view->MarkDirty();
240  }
241 
242  m_gal->SetClearColor( settings->GetBackgroundColor() );
243  m_gal->SetGridColor( settings->GetGridColor() );
244  m_gal->SetCursorColor( settings->GetCursorColor() );
245 
246  // TODO: find why ClearScreen() must be called here in opengl mode
247  // and only if m_view->IsDirty() in Cairo mode to avoid display artifacts
248  // when moving the mouse cursor
249  if( m_backend == GAL_TYPE_OPENGL )
250  m_gal->ClearScreen();
251 
252  if( m_view->IsDirty() )
253  {
254  if( m_backend != GAL_TYPE_OPENGL // Already called in opengl
256  {
257  m_gal->ClearScreen();
258  }
259 
260  m_view->ClearTargets();
261 
262  // Grid has to be redrawn only when the NONCACHED target is redrawn
264  m_gal->DrawGrid();
265 
266  cntRedraw.Start();
267  m_view->Redraw();
268  cntRedraw.Stop();
269  isDirty = true;
270  }
271 
273 
274  cntCtxDestroy.Start();
275  }
276  catch( std::exception& err )
277  {
278  if( GAL_FALLBACK != m_backend )
279  {
281 
283  _( "Could not use OpenGL, falling back to software rendering" ),
284  wxString( err.what() ) );
285  }
286  else
287  {
288  // We're well and truly banjaxed if we get here without a fallback.
289  DisplayInfoMessage( m_parent, _( "Could not use OpenGL" ), wxString( err.what() ) );
290  }
291  }
292 
293  // ctx goes out of scope here so destructor would be called
294  cntCtxDestroy.Stop();
295 
296 
297  if( isDirty )
298  {
299  KI_TRACE( traceGalProfile, "View timing: %s %s %s %s %s\n",
300  cntTotal.to_string(),
301  cntUpd.to_string(),
302  cntRedraw.to_string(),
303  cntCtx.to_string(),
304  cntCtxDestroy.to_string()
305  );
306  }
307 
308  m_lastRefresh = wxGetLocalTimeMillis();
309  m_drawing = false;
310 }
bool m_pendingRefresh
Is there a redraw event requested?
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
void SetClearColor(const COLOR4D &aColor)
virtual const COLOR4D & GetGridColor()=0
Return current grid color settings.
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
GAL_TYPE m_backend
Currently used GAL.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
virtual const COLOR4D & GetCursorColor()=0
Return current cursor color settings.
virtual const COLOR4D & GetBackgroundColor()=0
Return current background color settings.
const VECTOR2D & GetCenter() const
Return the center point of this VIEW (in world space coordinates).
Definition: view.h:334
virtual bool SwitchBackend(GAL_TYPE aGalType)
Switch method of rendering graphics.
static constexpr GAL_TYPE GAL_FALLBACK
virtual bool HasTarget(RENDER_TARGET aTarget)
Return true if the target exists.
const wxChar *const traceGalProfile
Flag to enable debug output of GAL performance profiling.
Auxiliary rendering target (noncached)
Definition: definitions.h:49
void UpdateScrollbars()
End any mouse drag action still in progress.
bool m_drawing
True if GAL is currently redrawing the view.
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
wxWindow * m_parent
Pointer to the parent window.
virtual void Redraw()
Immediately redraws the whole view.
Definition: view.cpp:1134
bool IsTargetDirty(int aTarget) const
Return true if any of layers belonging to the target or the target itself should be redrawn.
Definition: view.h:598
std::unique_ptr< KIGFX::PAINTER > m_painter
Contains information about how to draw items using GAL.
virtual void DrawGrid()
virtual void DrawCursor(const VECTOR2D &aCursorPosition)
Draw the cursor.
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
#define _(s)
virtual KIGFX::VIEW * GetView() const
Return a pointer to the #VIEW instance used in the panel.
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1402
void SetCursorColor(const COLOR4D &aCursorColor)
Set the cursor color.
A small class to help profiling.
Definition: profile.h:46
virtual void ClearScreen()
Clear the screen.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
EDA_DRAW_FRAME * GetParentEDAFrame() const
Returns parent EDA_DRAW_FRAME, if available or NULL otherwise.
VECTOR2D GetCursorPosition(bool aSnappingEnabled) const override
<
#define KI_TRACE(...)
virtual bool IsVisible() const
Return true if the GAL canvas is visible on the screen.
void ClearTargets()
Clear targets that are marked as dirty.
Definition: view.cpp:1115
wxLongLong m_lastRefresh
Last timestamp when the panel was refreshed.
VECTOR2D m_ScrollCenter
Current scroll center point in logical units.
Definition: base_screen.h:100
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:307
virtual BASE_SCREEN * GetScreen() const
Return a pointer to a BASE_SCREEN or one of its derivatives.
void MarkDirty()
Force redraw of view on the next rendering.
Definition: view.h:633
bool IsDirty() const
Return true if any of the VIEW layers needs to be refreshened.
Definition: view.h:581

References _, KIGFX::GAL::ClearScreen(), KIGFX::VIEW::ClearTargets(), DisplayInfoMessage(), KIGFX::GAL::DrawCursor(), KIGFX::GAL::DrawGrid(), EDA_DRAW_PANEL_GAL::GAL_FALLBACK, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), KIGFX::VIEW::GetCenter(), KIGFX::RENDER_SETTINGS::GetCursorColor(), KIGFX::WX_VIEW_CONTROLS::GetCursorPosition(), KIGFX::RENDER_SETTINGS::GetGridColor(), EDA_DRAW_PANEL_GAL::GetParentEDAFrame(), EDA_DRAW_FRAME::GetScreen(), EDA_DRAW_PANEL_GAL::GetView(), KIGFX::GAL::HasTarget(), EDA_DRAW_PANEL_GAL::IsDialogPreview(), KIGFX::VIEW::IsDirty(), KIGFX::VIEW::IsTargetDirty(), KIGFX::GAL::IsVisible(), KI_TRACE, EDA_DRAW_PANEL_GAL::m_backend, EDA_DRAW_PANEL_GAL::m_drawing, EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_lastRefresh, EDA_DRAW_PANEL_GAL::m_painter, EDA_DRAW_PANEL_GAL::m_parent, EDA_DRAW_PANEL_GAL::m_pendingRefresh, BASE_SCREEN::m_ScrollCenter, EDA_DRAW_PANEL_GAL::m_view, EDA_DRAW_PANEL_GAL::m_viewControls, KIGFX::VIEW::MarkDirty(), KIGFX::VIEW::Redraw(), KIGFX::GAL::SetClearColor(), KIGFX::GAL::SetCursorColor(), KIGFX::GAL::SetGridColor(), PROF_TIMER::Start(), PROF_TIMER::Stop(), EDA_DRAW_PANEL_GAL::SwitchBackend(), KIGFX::TARGET_NONCACHED, KIGFX::TARGET_OVERLAY, PROF_TIMER::to_string(), traceGalProfile, KIGFX::VIEW::UpdateItems(), and KIGFX::WX_VIEW_CONTROLS::UpdateScrollbars().

Referenced by EDA_DRAW_PANEL_GAL::ForceRefresh(), EDA_DRAW_PANEL_GAL::onPaint(), and EDA_DRAW_PANEL_GAL::onRefreshTimer().

◆ ForceRefresh()

◆ GetBackend()

◆ GetBackgroundColor()

const COLOR4D & FOOTPRINT_PREVIEW_PANEL::GetBackgroundColor ( )
overridevirtual

Get the colors to use in a preview widget to match the preview panel.

Implements FOOTPRINT_PREVIEW_PANEL_BASE.

Definition at line 75 of file footprint_preview_panel.cpp.

76 {
77  KIGFX::PAINTER* painter = GetView()->GetPainter();
78  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
79 
80  return settings->GetBackgroundColor();
81 }
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.

References KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), and PCB_DRAW_PANEL_GAL::GetView().

◆ GetBoard()

BOARD* FOOTPRINT_PREVIEW_PANEL::GetBoard ( )
inline

◆ GetDefaultViewBBox()

BOX2I PCB_DRAW_PANEL_GAL::GetDefaultViewBBox ( ) const
overridevirtualinherited

Return the bounding box of the view that should be used if model is not valid.

For example, the drawing sheet bounding box for an empty PCB

Returns
the default bounding box for the panel.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 549 of file pcb_draw_panel_gal.cpp.

550 {
552  return m_drawingSheet->ViewBBox();
553 
554  return BOX2I();
555 }
BOX2< VECTOR2I > BOX2I
Definition: box2.h:506
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Ratsnest view item.
drawingsheet frame and titleblock
Definition: layer_ids.h:224
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
Definition: view.h:405

References KIGFX::VIEW::IsLayerVisible(), LAYER_DRAWINGSHEET, PCB_DRAW_PANEL_GAL::m_drawingSheet, and EDA_DRAW_PANEL_GAL::m_view.

Referenced by PANEL_PCBNEW_COLOR_SETTINGS::zoomFitPreview().

◆ GetDrawingSheet()

DS_PROXY_VIEW_ITEM* PCB_DRAW_PANEL_GAL::GetDrawingSheet ( ) const
inlineinherited

Definition at line 62 of file pcb_draw_panel_gal.h.

62 { return m_drawingSheet.get(); }
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Ratsnest view item.

References PCB_DRAW_PANEL_GAL::m_drawingSheet.

Referenced by EDIT_TOOL::Init(), EDIT_TOOL::Properties(), and DRC_TOOL::RunTests().

◆ GetForegroundColor()

const COLOR4D & FOOTPRINT_PREVIEW_PANEL::GetForegroundColor ( )
overridevirtual

Implements FOOTPRINT_PREVIEW_PANEL_BASE.

Definition at line 84 of file footprint_preview_panel.cpp.

85 {
86  KIGFX::PAINTER* painter = GetView()->GetPainter();
87  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
88 
89  return settings->GetCursorColor();
90 }
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.

References KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), and PCB_DRAW_PANEL_GAL::GetView().

◆ GetGAL()

KIGFX::GAL* EDA_DRAW_PANEL_GAL::GetGAL ( ) const
inlineinherited

Return a pointer to the GAL instance used in the panel.

Returns
The instance of GAL.

Definition at line 109 of file class_draw_panel_gal.h.

109 { return m_gal; }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.

References EDA_DRAW_PANEL_GAL::m_gal.

Referenced by FOOTPRINT_EDIT_FRAME::ActivateGalCanvas(), GERBVIEW_FRAME::ActivateGalCanvas(), SYMBOL_VIEWER_FRAME::CommonSettingsChanged(), SYMBOL_EDIT_FRAME::CommonSettingsChanged(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), GERBVIEW_FRAME::DisplayGridMsg(), PCB_BASE_FRAME::DisplayGridMsg(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), EDA_DRAW_FRAME::GetNearestGridPosition(), EDA_DRAW_FRAME::GetNearestHalfGridPosition(), EDA_DRAW_FRAME::GetZoomLevelIndicator(), EDA_DRAW_FRAME::OnMove(), GERBER_LAYER_WIDGET::OnRenderEnable(), PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), Refresh(), PCB_BASE_EDIT_FRAME::SetBoard(), GERBVIEW_FRAME::SetGridColor(), EDA_DRAW_FRAME::SetGridVisibility(), PL_DRAW_PANEL_GAL::SwitchBackend(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), SYMBOL_EDIT_FRAME::SwitchCanvas(), FOOTPRINT_EDIT_FRAME::SwitchCanvas(), SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET(), SYMBOL_VIEWER_FRAME::SYMBOL_VIEWER_FRAME(), ZOOM_MENU::update(), PANEL_PCBNEW_COLOR_SETTINGS::updatePreview(), PANEL_EESCHEMA_COLOR_SETTINGS::updatePreview(), and EDA_DRAW_FRAME::UpdateZoomSelectBox().

◆ GetMsgPanelInfo()

void PCB_DRAW_PANEL_GAL::GetMsgPanelInfo ( EDA_DRAW_FRAME aFrame,
std::vector< MSG_PANEL_ITEM > &  aList 
)
overridevirtualinherited

Called when the window is shown for the first time.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 445 of file pcb_draw_panel_gal.cpp.

447 {
448  BOARD* board = static_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() )->GetBoard();
449  int padCount = 0;
450  int viaCount = 0;
451  int trackSegmentCount = 0;
452  std::set<int> netCodes;
453  int unconnected = board->GetConnectivity()->GetUnconnectedCount();
454 
455  for( PCB_TRACK* item : board->Tracks() )
456  {
457  if( item->Type() == PCB_VIA_T )
458  viaCount++;
459  else
460  trackSegmentCount++;
461 
462  if( item->GetNetCode() > 0 )
463  netCodes.insert( item->GetNetCode() );
464  }
465 
466  for( FOOTPRINT* footprint : board->Footprints() )
467  {
468  for( PAD* pad : footprint->Pads() )
469  {
470  padCount++;
471 
472  if( pad->GetNetCode() > 0 )
473  netCodes.insert( pad->GetNetCode() );
474  }
475  }
476 
477  aList.emplace_back( _( "Pads" ), wxString::Format( wxT( "%d" ), padCount ) );
478  aList.emplace_back( _( "Vias" ), wxString::Format( wxT( "%d" ), viaCount ) );
479  aList.emplace_back( _( "Track Segments" ), wxString::Format( wxT( "%d" ), trackSegmentCount ) );
480  aList.emplace_back( _( "Nets" ), wxString::Format( wxT( "%d" ), (int) netCodes.size() ) );
481  aList.emplace_back( _( "Unrouted" ), wxString::Format( wxT( "%d" ), unconnected ) );
482 }
FOOTPRINTS & Footprints()
Definition: board.h:234
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:345
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:191
EDA_DRAW_FRAME * GetParentEDAFrame() const
Returns parent EDA_DRAW_FRAME, if available or NULL otherwise.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: pad.h:57
TRACKS & Tracks()
Definition: board.h:231

References _, BOARD::Footprints(), Format(), BOARD_ITEM::GetBoard(), BOARD::GetConnectivity(), EDA_DRAW_PANEL_GAL::GetParentEDAFrame(), pad, PCB_VIA_T, and BOARD::Tracks().

◆ GetParentEDAFrame()

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( ) const
inlineinherited

Definition at line 46 of file kiway_holder.h.

46 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:76

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetView()

KIGFX::PCB_VIEW * PCB_DRAW_PANEL_GAL::GetView ( ) const
overridevirtualinherited

Return a pointer to the #VIEW instance used in the panel.

Returns
The instance of #VIEW.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 641 of file pcb_draw_panel_gal.cpp.

642 {
643  return static_cast<KIGFX::PCB_VIEW*>( m_view );
644 }
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.

References EDA_DRAW_PANEL_GAL::m_view.

Referenced by APPEARANCE_CONTROLS::APPEARANCE_CONTROLS(), DIALOG_NET_INSPECTOR::buildNetsList(), FOOTPRINT_EDIT_FRAME::CommonSettingsChanged(), PCB_BASE_FRAME::CommonSettingsChanged(), DIALOG_PRINT_PCBNEW::createPrintout(), DRAWING_TOOL::DrawVia(), PCB_EDIT_FRAME::Edit_Zone_Params(), EVT_GRID_CMD_CELL_CHANGED(), DIALOG_DRC::ExcludeMarker(), PCB_BASE_FRAME::FocusOnItems(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), GetBackgroundColor(), PCB_BASE_FRAME::GetCollectorsGuide(), GetForegroundColor(), APPEARANCE_CONTROLS::getVisibleLayers(), APPEARANCE_CONTROLS::getVisibleObjects(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), PCB_CONTROL::LayerAlphaDec(), PCB_CONTROL::LayerAlphaInc(), PCB_BASE_FRAME::LoadSettings(), DIALOG_PAD_PROPERTIES::onChangePadMode(), APPEARANCE_CONTROLS::OnColorSwatchChanged(), DIALOG_NET_INSPECTOR::onDeleteNet(), DIALOG_DRC::OnDRCItemRClick(), APPEARANCE_CONTROLS::OnLayerAlphaChanged(), APPEARANCE_CONTROLS::onLayerVisibilityToggled(), APPEARANCE_CONTROLS::onNetclassColorChanged(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onNetColorMode(), APPEARANCE_CONTROLS::onObjectVisibilityChanged(), DIALOG_NET_INSPECTOR::onRenameNet(), DIALOG_NET_INSPECTOR::onSelChanged(), DIALOG_NET_INSPECTOR::onSortingChanged(), BOARD_EDITOR_CONTROL::PageSettings(), DIALOG_PAD_PROPERTIES::prepareCanvas(), DIALOG_BOARD_REANNOTATE::ReannotateBoard(), NET_GRID_TABLE::Rebuild(), APPEARANCE_CONTROLS::rebuildNets(), DIALOG_PAD_PROPERTIES::redraw(), Refresh(), refreshCallback(), renderFootprint(), DIALOG_FOOTPRINT_CHECKER::runChecks(), DISPLAY_FOOTPRINTS_FRAME::SaveSettings(), FOOTPRINT_VIEWER_FRAME::SaveSettings(), PCB_BASE_EDIT_FRAME::SetBoard(), PCB_BASE_FRAME::SetDisplayOptions(), APPEARANCE_CONTROLS::SetLayerVisible(), APPEARANCE_CONTROLS::SetObjectVisible(), FOOTPRINT_EDIT_FRAME::setupUIConditions(), APPEARANCE_CONTROLS::setVisibleLayers(), APPEARANCE_CONTROLS::setVisibleObjects(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), PANEL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EDIT_OPTIONS::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), PCB_BASE_EDIT_FRAME::unitsChangeRefresh(), APPEARANCE_CONTROLS::UpdateDisplayOptions(), NET_GRID_TABLE::updateNetColor(), PANEL_PCBNEW_COLOR_SETTINGS::updatePreview(), PANEL_PCBNEW_COLOR_SETTINGS::zoomFitPreview(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), ~FOOTPRINT_PREVIEW_PANEL(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ GetViewControls()

◆ GetWindow()

wxWindow * FOOTPRINT_PREVIEW_PANEL::GetWindow ( )
overridevirtual

Get the underlying wxWindow.

Implements FOOTPRINT_PREVIEW_PANEL_BASE.

Definition at line 160 of file footprint_preview_panel.cpp.

161 {
162  return static_cast<wxWindow*>( this );
163 }

◆ IsDialogPreview()

bool EDA_DRAW_PANEL_GAL::IsDialogPreview ( ) const
inlineinherited

Definition at line 177 of file class_draw_panel_gal.h.

177 { return m_parent != (wxWindow*) m_edaFrame; }
wxWindow * m_parent
Pointer to the parent window.
EDA_DRAW_FRAME * m_edaFrame
Parent EDA_DRAW_FRAME (if available)

References EDA_DRAW_PANEL_GAL::m_edaFrame, and EDA_DRAW_PANEL_GAL::m_parent.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), PCB_DRAW_PANEL_GAL::OnShow(), and PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL().

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Return a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 53 of file kiway_holder.h.

54  {
55  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
56  return *m_kiway;
57  }
KIWAY * m_kiway
Definition: kiway_holder.h:75

References KIWAY_HOLDER::m_kiway.

Referenced by PROJECT_TREE_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::AddLibraryFile(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AskToSaveChanges(), SYMBOL_EDIT_FRAME::CanCloseSymbolFromSchematic(), SCH_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_SYMBOL::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), BACK_ANNOTATE::FetchNetlistFromPCB(), KICAD_MANAGER_FRAME::ImportNonKiCadProject(), SCRIPTING_TOOL::Init(), EDA_DRAW_FRAME::IsScriptingConsoleVisible(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), SYMBOL_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_FIELD_PROPERTIES::OnTextValueSelectButtonClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), SCH_BASE_FRAME::PickSymbolFromLibBrowser(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), FOOTPRINT_WIZARD_FRAME::PythonPluginsReload(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SCH_EDITOR_CONTROL::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SYMBOL_EDIT_FRAME::Save(), SYMBOL_EDIT_FRAME::saveCurrentSymbol(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), EDA_DRAW_FRAME::ScriptingConsoleEnableDisable(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SYMBOL_EDIT_FRAME::SetCurSymbol(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ New()

FOOTPRINT_PREVIEW_PANEL * FOOTPRINT_PREVIEW_PANEL::New ( KIWAY aKiway,
wxWindow *  aParent 
)
static

Definition at line 166 of file footprint_preview_panel.cpp.

167 {
168  PCBNEW_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
169 
170  if( cfg->m_Window.grid.sizes.empty() )
171  cfg->m_Window.grid.sizes = cfg->DefaultGridSizeList();
172 
173  // Currently values read from config file are not used because the user cannot
174  // change this config
175  //if( cfg->m_Window.zoom_factors.empty() )
176  {
178  }
179 
180  std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> gal_opts;
181 
182  gal_opts = std::make_unique<KIGFX::GAL_DISPLAY_OPTIONS>();
183  gal_opts->ReadConfig( *Pgm().GetCommonSettings(), cfg->m_Window, aParent );
184 
185  auto canvasType = static_cast<EDA_DRAW_PANEL_GAL::GAL_TYPE>( cfg->m_Graphics.canvas_type );
186  auto panel = new FOOTPRINT_PREVIEW_PANEL( aKiway, aParent, std::move( gal_opts ), canvasType );
187 
188  panel->UpdateColors();
189 
190  const GRID_SETTINGS& gridCfg = cfg->m_Window.grid;
191 
192  panel->GetGAL()->SetGridVisibility( gridCfg.show );
193 
194  //Bounds checking cannot include number of elements as an index!
195  int gridIdx = std::max( 0, std::min( gridCfg.last_size_idx, (int) gridCfg.sizes.size() - 1 ) );
196  int gridSize = (int) ValueFromString( EDA_UNITS::MILS, gridCfg.sizes[ gridIdx ] );
197  panel->GetGAL()->SetGridSize( VECTOR2D( gridSize, gridSize ) );
198 
199  return panel;
200 }
#define ZOOM_LIST_PCBNEW
Definition: zoom_defines.h:32
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
std::vector< double > zoom_factors
Definition: app_settings.h:86
std::vector< wxString > sizes
Definition: app_settings.h:52
VECTOR2< double > VECTOR2D
Definition: vector2d.h:621
long long int ValueFromString(EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType)
Function ValueFromString converts aTextValue in aUnits to internal units used by the application.
Definition: base_units.cpp:411
GRID_SETTINGS grid
Definition: app_settings.h:89
FOOTPRINT_PREVIEW_PANEL(KIWAY *aKiway, wxWindow *aParent, std::unique_ptr< KIGFX::GAL_DISPLAY_OPTIONS > aOpts, GAL_TYPE aGalType)
Create a new panel.
WINDOW_SETTINGS m_Window
Definition: app_settings.h:181
virtual const std::vector< wxString > DefaultGridSizeList() const
By default, this returns the list of grids available in PcbNew-based applications.
Common grid settings, available to every frame.
Definition: app_settings.h:49

References APP_SETTINGS_BASE::GRAPHICS::canvas_type, APP_SETTINGS_BASE::DefaultGridSizeList(), FOOTPRINT_PREVIEW_PANEL(), WINDOW_SETTINGS::grid, GRID_SETTINGS::last_size_idx, APP_SETTINGS_BASE::m_Graphics, APP_SETTINGS_BASE::m_Window, MILS, Pgm(), GRID_SETTINGS::show, GRID_SETTINGS::sizes, ValueFromString(), WINDOW_SETTINGS::zoom_factors, and ZOOM_LIST_PCBNEW.

Referenced by PCB::IFACE::CreateWindow(), and PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS().

◆ onEnter()

void EDA_DRAW_PANEL_GAL::onEnter ( wxMouseEvent &  aEvent)
protectedinherited

Definition at line 544 of file draw_panel_gal.cpp.

545 {
546  bool shouldSetFocus = m_stealsFocus
547  && !KIUI::IsInputControlFocused() // Don't steal from input controls
548  && !KIUI::IsModalDialogFocused() // Don't steal from dialogs
549  && KIPLATFORM::UI::IsWindowActive( m_edaFrame ); // Don't steal from other windows
550 
551  // Getting focus is necessary in order to receive key events properly
552  if( shouldSetFocus )
553  SetFocus();
554 
555  aEvent.Skip();
556 }
bool IsModalDialogFocused()
Definition: ui_common.cpp:270
bool IsInputControlFocused(wxWindow *aFocus=nullptr)
Check if a input control has focus.
Definition: ui_common.cpp:220
bool IsWindowActive(wxWindow *aWindow)
Check to see if the given window is the currently active window (e.g.
Definition: gtk/ui.cpp:50
virtual void SetFocus() override
EDA_DRAW_FRAME * m_edaFrame
Parent EDA_DRAW_FRAME (if available)
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over,...

References KIUI::IsInputControlFocused(), KIUI::IsModalDialogFocused(), KIPLATFORM::UI::IsWindowActive(), EDA_DRAW_PANEL_GAL::m_edaFrame, EDA_DRAW_PANEL_GAL::m_stealsFocus, and EDA_DRAW_PANEL_GAL::SetFocus().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ OnEvent()

void EDA_DRAW_PANEL_GAL::OnEvent ( wxEvent &  aEvent)
inherited

Used to forward events to the canvas from popups, etc.

Definition at line 525 of file draw_panel_gal.cpp.

526 {
527  bool shouldSetFocus = m_lostFocus && m_stealsFocus
528  && !KIUI::IsInputControlFocused() // Don't steal from input controls
529  && !KIUI::IsModalDialogFocused() // Don't steal from dialogs
530  && KIPLATFORM::UI::IsWindowActive( m_edaFrame ); // Don't steal from other windows
531 
532  if( shouldSetFocus )
533  SetFocus();
534 
535  if( !m_eventDispatcher )
536  aEvent.Skip();
537  else
539 
540  Refresh();
541 }
bool IsModalDialogFocused()
Definition: ui_common.cpp:270
bool IsInputControlFocused(wxWindow *aFocus=nullptr)
Check if a input control has focus.
Definition: ui_common.cpp:220
bool IsWindowActive(wxWindow *aWindow)
Check to see if the given window is the currently active window (e.g.
Definition: gtk/ui.cpp:50
virtual void DispatchWxEvent(wxEvent &aEvent)
Process wxEvents (mostly UI events), translate them to TOOL_EVENTs, and make tools handle those.
bool m_lostFocus
Flag to indicate that focus should be regained on the next mouse event.
virtual void SetFocus() override
EDA_DRAW_FRAME * m_edaFrame
Parent EDA_DRAW_FRAME (if available)
TOOL_DISPATCHER * m_eventDispatcher
Processes and forwards events to tools.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over,...

References TOOL_DISPATCHER::DispatchWxEvent(), KIUI::IsInputControlFocused(), KIUI::IsModalDialogFocused(), KIPLATFORM::UI::IsWindowActive(), EDA_DRAW_PANEL_GAL::m_edaFrame, EDA_DRAW_PANEL_GAL::m_eventDispatcher, EDA_DRAW_PANEL_GAL::m_lostFocus, EDA_DRAW_PANEL_GAL::m_stealsFocus, EDA_DRAW_PANEL_GAL::Refresh(), and EDA_DRAW_PANEL_GAL::SetFocus().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and STATUS_POPUP::onCharHook().

◆ onLostFocus()

void EDA_DRAW_PANEL_GAL::onLostFocus ( wxFocusEvent &  aEvent)
protectedinherited

Definition at line 559 of file draw_panel_gal.cpp.

560 {
561  m_lostFocus = true;
562 
564 
565  aEvent.Skip();
566 }
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
bool m_lostFocus
Flag to indicate that focus should be regained on the next mouse event.

References KIGFX::WX_VIEW_CONTROLS::CancelDrag(), EDA_DRAW_PANEL_GAL::m_lostFocus, and EDA_DRAW_PANEL_GAL::m_viewControls.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ onPaint()

void EDA_DRAW_PANEL_GAL::onPaint ( wxPaintEvent &  WXUNUSEDaEvent)
protectedvirtualinherited

Reimplemented in SCH_PREVIEW_PANEL, and SCH_DRAW_PANEL.

Definition at line 169 of file draw_panel_gal.cpp.

170 {
171  DoRePaint();
172 }
void DoRePaint()
Repaint the canvas, and fix scrollbar cursors.

References EDA_DRAW_PANEL_GAL::DoRePaint().

Referenced by SCH_DRAW_PANEL::onPaint(), SCH_PREVIEW_PANEL::onPaint(), EDA_DRAW_PANEL_GAL::onRefreshTimer(), and EDA_DRAW_PANEL_GAL::StopDrawing().

◆ onRefreshTimer()

void EDA_DRAW_PANEL_GAL::onRefreshTimer ( wxTimerEvent &  aEvent)
protectedinherited

Definition at line 569 of file draw_panel_gal.cpp.

570 {
571  if( !m_drawingEnabled )
572  {
573  if( m_gal && m_gal->IsInitialized() )
574  {
575  m_drawing = false;
576  m_pendingRefresh = true;
577  Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), nullptr,
578  this );
579  m_drawingEnabled = true;
580  }
581  else
582  {
583  // Try again soon
584  m_refreshTimer.StartOnce( 100 );
585  return;
586  }
587  }
588 
589  DoRePaint();
590 }
bool m_pendingRefresh
Is there a redraw event requested?
wxTimer m_refreshTimer
Timer to prevent too-frequent refreshing.
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
void DoRePaint()
Repaint the canvas, and fix scrollbar cursors.
bool m_drawing
True if GAL is currently redrawing the view.
virtual void onPaint(wxPaintEvent &WXUNUSED(aEvent))
bool m_drawingEnabled
Flag that determines if VIEW may use GAL for redrawing the screen.
virtual bool IsInitialized() const
Return the initialization status for the canvas.

References EDA_DRAW_PANEL_GAL::DoRePaint(), KIGFX::GAL::IsInitialized(), EDA_DRAW_PANEL_GAL::m_drawing, EDA_DRAW_PANEL_GAL::m_drawingEnabled, EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_pendingRefresh, EDA_DRAW_PANEL_GAL::m_refreshTimer, and EDA_DRAW_PANEL_GAL::onPaint().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ OnShow()

void PCB_DRAW_PANEL_GAL::OnShow ( )
overridevirtualinherited

Called when the window is shown for the first time.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 485 of file pcb_draw_panel_gal.cpp.

486 {
487  PCB_BASE_FRAME* frame = nullptr;
488 
489  if( !IsDialogPreview() )
490  frame = dynamic_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() );
491 
492  try
493  {
494  // Check if the current rendering back end can be properly initialized
495  m_view->UpdateItems();
496  }
497  catch( const std::runtime_error& e )
498  {
499  DisplayError( GetParent(), e.what() );
500 
501  // Use the fallback if we have one
502  if( GAL_FALLBACK != m_backend )
503  {
505 
506  if( frame )
507  frame->ActivateGalCanvas();
508  }
509  }
510 
511  if( frame )
512  {
513  SetTopLayer( frame->GetActiveLayer() );
514  KIGFX::PAINTER* painter = m_view->GetPainter();
515  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
516  settings->LoadDisplayOptions( frame->GetDisplayOptions(), frame->ShowPageLimits() );
517  }
518 }
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:279
GAL_TYPE m_backend
Currently used GAL.
static constexpr GAL_TYPE GAL_FALLBACK
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
bool ShowPageLimits() const
virtual PCB_LAYER_ID GetActiveLayer() const
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57
virtual void ActivateGalCanvas() override
Use to start up the GAL drawing canvas.
void UpdateItems()
Iterate through the list of items that asked for updating and updates them.
Definition: view.cpp:1402
bool SwitchBackend(GAL_TYPE aGalType) override
Force refresh of the ratsnest visual representation.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
EDA_DRAW_FRAME * GetParentEDAFrame() const
Returns parent EDA_DRAW_FRAME, if available or NULL otherwise.
virtual void SetTopLayer(int aLayer) override
SetTopLayer(), with some extra smarts for PCB.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.

References PCB_BASE_FRAME::ActivateGalCanvas(), DisplayError(), EDA_DRAW_PANEL_GAL::GAL_FALLBACK, PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetDisplayOptions(), KIGFX::VIEW::GetPainter(), EDA_DRAW_PANEL_GAL::GetParentEDAFrame(), EDA_DRAW_PANEL_GAL::IsDialogPreview(), EDA_DRAW_PANEL_GAL::m_backend, EDA_DRAW_PANEL_GAL::m_view, PCB_DRAW_PANEL_GAL::SetTopLayer(), EDA_DRAW_FRAME::ShowPageLimits(), PCB_DRAW_PANEL_GAL::SwitchBackend(), and KIGFX::VIEW::UpdateItems().

◆ onShowTimer()

void EDA_DRAW_PANEL_GAL::onShowTimer ( wxTimerEvent &  aEvent)
protectedinherited

Definition at line 593 of file draw_panel_gal.cpp.

594 {
595  if( m_gal && m_gal->IsVisible() )
596  {
597  m_onShowTimer.Stop();
598  OnShow();
599  }
600 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
virtual void OnShow()
Called when the window is shown for the first time.
wxTimer m_onShowTimer
Timer used to execute OnShow() when the window finally appears on the screen.
virtual bool IsVisible() const
Return true if the GAL canvas is visible on the screen.

References KIGFX::GAL::IsVisible(), EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_onShowTimer, and EDA_DRAW_PANEL_GAL::OnShow().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ onSize()

void EDA_DRAW_PANEL_GAL::onSize ( wxSizeEvent &  aEvent)
protectedinherited

Definition at line 313 of file draw_panel_gal.cpp.

314 {
315  // If we get a second wx update call before the first finishes, don't crash
316  if( m_gal->IsContextLocked() )
317  return;
318 
320  wxSize clientSize = GetClientSize();
321  WX_INFOBAR* infobar = GetParentEDAFrame() ? GetParentEDAFrame()->GetInfoBar() : nullptr;
322 
323  if( VECTOR2I( clientSize ) == m_gal->GetScreenPixelSize() )
324  return;
325 
326  clientSize.x = std::max( 10, clientSize.x );
327  clientSize.y = std::max( 10, clientSize.y );
328 
329  VECTOR2D bottom( 0, 0 );
330 
331  if( m_view )
332  bottom = m_view->ToWorld( m_gal->GetScreenPixelSize(), true );
333 
334  m_gal->ResizeScreen( clientSize.GetX(), clientSize.GetY() );
335 
336  if( m_view )
337  {
338  if( infobar && infobar->IsLocked() )
339  m_view->SetCenter( bottom - m_view->ToWorld( clientSize, false ) / 2.0 );
340 
343  }
344 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition: view.cpp:449
VECTOR2< int > VECTOR2I
Definition: vector2d.h:622
Auxiliary rendering target (noncached)
Definition: definitions.h:49
const VECTOR2I & GetScreenPixelSize() const
Return GAL canvas size in pixels.
bool IsLocked()
Returns true if the infobar is being updated.
Definition: infobar.h:211
void SetCenter(const VECTOR2D &aCenter)
Set the center point of the VIEW (i.e.
Definition: view.cpp:578
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:609
virtual void ResizeScreen(int aWidth, int aHeight)
Resize the canvas.
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:73
Main rendering target (cached)
Definition: definitions.h:48
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
EDA_DRAW_FRAME * GetParentEDAFrame() const
Returns parent EDA_DRAW_FRAME, if available or NULL otherwise.
WX_INFOBAR * GetInfoBar()
virtual bool IsContextLocked()
Checks the state of the context lock.

References EDA_BASE_FRAME::GetInfoBar(), EDA_DRAW_PANEL_GAL::GetParentEDAFrame(), KIGFX::GAL::GetScreenPixelSize(), KIGFX::GAL::IsContextLocked(), WX_INFOBAR::IsLocked(), EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_view, KIGFX::VIEW::MarkTargetDirty(), KIGFX::GAL::ResizeScreen(), KIGFX::VIEW::SetCenter(), KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, and KIGFX::VIEW::ToWorld().

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Return a reference to the PROJECT associated with this KIWAY.

Definition at line 36 of file kiway_holder.cpp.

37 {
38  return Kiway().Prj();
39 }
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:53
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:191

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_LIBRARY_MANAGER::addLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), SCH_EDIT_FRAME::AppendSchematic(), AskSaveBoardFileName(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLibrariesListBox(), SIM_PLOT_FRAME::canCloseWindow(), PANEL_FP_PROPERTIES_3D_MODEL::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), PCB_BASE_EDIT_FRAME::createNewLibrary(), PCB_BASE_EDIT_FRAME::CreateNewProjectLibrary(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), DisplayFootprint(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doAutoSave(), PCB_BASE_EDIT_FRAME::doCloseWindow(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), BOARD_EDITOR_CONTROL::ExportNetlist(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), SYMBOL_EDITOR_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), SYMBOL_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SIM_PLOT_FRAME::getDefaultFilename(), SIM_PLOT_FRAME::getDefaultPath(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), SCH_BASE_FRAME::GetLibSymbol(), DIALOG_PLOT_SCHEMATIC::getOutputPath(), KICAD_MANAGER_FRAME::GetProjectFileName(), SCH_EDIT_FRAME::GetSchematicJunctionSize(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SIM_PLOT_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), EDA_BASE_FRAME::LoadWindowState(), SIM_PLOT_FRAME::loadWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbook(), SIM_PLOT_FRAME::menuSaveWorkbookAs(), PANEL_FP_PROPERTIES_3D_MODEL::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), PANEL_FP_PROPERTIES_3D_MODEL::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_NETLIST_IMPORT::onBrowseNetlistFiles(), WX_HTML_REPORT_PANEL::onBtnSaveToFile(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_SYMBOLS_LIBID::onClickOrphansButton(), DIALOG_EXPORT_STEP::onExportButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), DIALOG_SCHEMATIC_SETUP::OnPageChange(), DIALOG_BOARD_SETUP::OnPageChange(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_TEXT_AND_LABEL_PROPERTIES::onScintillaCharAdded(), PROPERTIES_FRAME::onScintillaCharAdded(), DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded(), DIALOG_SPICE_MODEL::onSelectLibrary(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), PANEL_FP_PROPERTIES_3D_MODEL::PANEL_FP_PROPERTIES_3D_MODEL(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_CONTROL::PasteFootprint(), SCH_BASE_FRAME::PickSymbolFromLibTree(), DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), EDA_DRAW_FRAME::PrintDrawingSheet(), SCH_EDIT_FRAME::PrintPage(), KICAD_MANAGER_FRAME::PrintPrjInfo(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), PANEL_FP_PROPERTIES_3D_MODEL::ReloadModelsFromFootprint(), EDA_3D_VIEWER_FRAME::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), SYMBOL_EDIT_FRAME::saveLibrary(), PCB_EDIT_FRAME::SavePcbFile(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_EDIT_FRAME::saveSchematicFile(), SIM_PLOT_FRAME::SaveSettings(), EDA_BASE_FRAME::SaveSettings(), SYMBOL_EDIT_FRAME::saveSymbolAs(), SCH_BASE_FRAME::saveSymbolLibTables(), SIM_PLOT_FRAME::saveWorkbook(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectLibrary(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), PCB_BASE_EDIT_FRAME::selectLibTable(), SYMBOL_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), SYMBOL_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), SYMBOL_EDIT_FRAME::SetCurSymbol(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_SYMBOL::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), SYMBOL_VIEWER_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SYMBOL_LIBRARY_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER_FRAME::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), DIALOG_SHEET_PROPERTIES::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_SYMBOLS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), SCH_EDIT_FRAME::updateAutoSaveFile(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), SIM_PLOT_FRAME::updateTitle(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::UpdateTitle(), PANEL_FP_PROPERTIES_3D_MODEL::validateModelExists(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), PANEL_FP_PROPERTIES_3D_MODEL::~PANEL_FP_PROPERTIES_3D_MODEL(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ RedrawRatsnest()

void PCB_DRAW_PANEL_GAL::RedrawRatsnest ( )
inherited

Return the bounding box of the view that should be used if model is not valid.

For example, the drawing sheet bounding box for an empty PCB

Returns
the default bounding box for the panel.

Definition at line 542 of file pcb_draw_panel_gal.cpp.

543 {
544  if( m_ratsnest )
545  m_view->Update( m_ratsnest.get() );
546 }
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
std::unique_ptr< RATSNEST_VIEW_ITEM > m_ratsnest
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:1570

References PCB_DRAW_PANEL_GAL::m_ratsnest, EDA_DRAW_PANEL_GAL::m_view, and KIGFX::VIEW::Update().

Referenced by BOARD_INSPECTION_TOOL::doHideNet(), APPEARANCE_CONTROLS::onNetclassColorChanged(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onObjectVisibilityChanged(), APPEARANCE_CONTROLS::onRatsnestMode(), BOARD_COMMIT::Push(), PCB_CONTROL::ToggleRatsnest(), and NET_GRID_TABLE::updateNetColor().

◆ Refresh()

void EDA_DRAW_PANEL_GAL::Refresh ( bool  aEraseBackground = true,
const wxRect *  aRect = nullptr 
)
overridevirtualinherited

Update the board display after modifying it by a python script (note: it is automatically called by action plugins, after running the plugin, so call this function is usually not needed inside action plugins.

Could be deprecated because modifying a board (especially deleting items) outside a action plugin can crash Pcbnew.

Reimplemented in SCH_PREVIEW_PANEL.

Definition at line 347 of file draw_panel_gal.cpp.

348 {
349  wxLongLong t = wxGetLocalTimeMillis();
350  wxLongLong delta = t - m_lastRefresh;
351 
352  // If it has been too long since the last frame (possible depending on platform timer latency),
353  // just do a refresh. Otherwise, start the refresh timer if it hasn't already been started.
354  // This ensures that we will render often enough but not too often.
355  if( delta >= MinRefreshPeriod )
356  {
357  if( !m_pendingRefresh )
358  ForceRefresh();
359 
360  m_refreshTimer.Start( MinRefreshPeriod, true );
361  }
362  else if( !m_refreshTimer.IsRunning() )
363  {
364  m_refreshTimer.Start( ( MinRefreshPeriod - delta ).ToLong(), true );
365  }
366 }
bool m_pendingRefresh
Is there a redraw event requested?
wxTimer m_refreshTimer
Timer to prevent too-frequent refreshing.
void ForceRefresh()
Force a redraw.
static const int MinRefreshPeriod
60 FPS.
wxLongLong m_lastRefresh
Last timestamp when the panel was refreshed.
constexpr int delta

References delta, EDA_DRAW_PANEL_GAL::ForceRefresh(), EDA_DRAW_PANEL_GAL::m_lastRefresh, EDA_DRAW_PANEL_GAL::m_pendingRefresh, EDA_DRAW_PANEL_GAL::m_refreshTimer, and EDA_DRAW_PANEL_GAL::MinRefreshPeriod.

Referenced by SCH_EDIT_FRAME::AddItemToScreenAndUndoList(), SCH_EDIT_FRAME::AnnotateSymbols(), SCH_EDITOR_CONTROL::AssignFootprints(), SCH_EDIT_TOOL::BreakWire(), DIALOG_NET_INSPECTOR::buildNetsList(), SCH_BASE_FRAME::CenterScreen(), ZONE_FILLER_TOOL::CheckAllZones(), GERBVIEW_CONTROL::ClearAllLayers(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_WIZARD_FRAME::ClickOnPageList(), PL_EDITOR_FRAME::CommonSettingsChanged(), SCH_BASE_FRAME::CommonSettingsChanged(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), SCH_EDIT_FRAME::DeleteAnnotation(), PCB_CONTROL::DeleteItemCursor(), DisplayFootprint(), APPEARANCE_CONTROLS::doApplyLayerPreset(), DIALOG_CLEANUP_GRAPHICS::doCleanup(), DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup(), SCH_EDIT_TOOL::DoDelete(), DIALOG_GLOBAL_DELETION::DoGlobalDeletions(), BOARD_INSPECTION_TOOL::doHideNet(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties(), SYMBOL_EDITOR_EDIT_TOOL::editTextProperties(), GERBVIEW_FRAME::Erase_Current_DrawLayer(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_EDIT_FRAME::ExecuteRemoteCommand(), ZONE_FILLER_TOOL::FillAllZones(), SCH_EDITOR_CONTROL::FindNext(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), PCB_BASE_FRAME::FocusOnItems(), PL_EDITOR_FRAME::GetLayoutFromRedoList(), PL_EDITOR_FRAME::GetLayoutFromUndoList(), PCB_VIEWER_TOOLS::GraphicOutlines(), PL_EDITOR_FRAME::HardRedraw(), GERBVIEW_CONTROL::HighlightControl(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DISPLAY_FOOTPRINTS_FRAME::InitDisplay(), SCH_EDIT_FRAME::KiwayMailIn(), GERBVIEW_FRAME::LoadListOfGerberAndDrillFiles(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), DIALOG_MIGRATE_BUSES::onAcceptClicked(), PROPERTIES_FRAME::OnAcceptPrms(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_BOARD_REANNOTATE::OnApplyClick(), DIALOG_INSPECTOR::onCellClicked(), APPEARANCE_CONTROLS::OnColorSwatchChanged(), DIALOG_ERC::OnEraseDrcMarkersClick(), EDA_DRAW_PANEL_GAL::OnEvent(), EDA_DRAW_FRAME::OnGridSettings(), GERBER_LAYER_WIDGET::OnLayerColorChange(), APPEARANCE_CONTROLS::OnLayerContextMenu(), GERBER_LAYER_WIDGET::OnLayerSelect(), APPEARANCE_CONTROLS::onLayerVisibilityToggled(), GERBER_LAYER_WIDGET::OnLayerVisible(), DIALOG_GROUP_PROPERTIES::OnMemberSelected(), SCH_EDIT_FRAME::OnModify(), APPEARANCE_CONTROLS::onNetclassColorChanged(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::onNetContextMenu(), APPEARANCE_CONTROLS::onObjectVisibilityChanged(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), GERBER_LAYER_WIDGET::onPopupSelection(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_GROUP_PROPERTIES::OnRemoveMember(), DIALOG_NET_INSPECTOR::onRenameNet(), GERBER_LAYER_WIDGET::OnRenderColorChange(), GERBER_LAYER_WIDGET::OnRenderEnable(), KIGFX::WX_VIEW_CONTROLS::onScroll(), DIALOG_NET_INSPECTOR::onSelChanged(), GERBVIEW_FRAME::OnSelectActiveDCode(), GERBVIEW_FRAME::OnSelectActiveLayer(), PL_EDITOR_FRAME::OnSelectCoordOriginCorner(), GERBVIEW_FRAME::OnSelectDisplayMode(), EDA_DRAW_FRAME::OnSelectGrid(), DIALOG_CLEANUP_GRAPHICS::OnSelectItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnSelectItem(), DIALOG_FOOTPRINT_CHECKER::OnSelectItem(), PL_EDITOR_FRAME::OnSelectPage(), EDA_DRAW_FRAME::OnSelectZoom(), PROPERTIES_FRAME::OnSetDefaultValues(), DIALOG_NET_INSPECTOR::onSortingChanged(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), KIGFX::WX_VIEW_CONTROLS::onWheel(), GERBVIEW_CONTROL::OpenDrillFile(), GERBVIEW_CONTROL::OpenJobFile(), GERBVIEW_CONTROL::OpenZipFile(), PCB_VIEWER_TOOLS::PadDisplayMode(), SCH_EDITOR_CONTROL::PageSetup(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PL_EDITOR_FRAME::PrintPage(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_TOOL::Properties(), FOOTPRINT_EDITOR_CONTROL::Properties(), SYMBOL_EDIT_FRAME::RebuildView(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), SCH_EDITOR_CONTROL::Redo(), DIALOG_PAD_PROPERTIES::redraw(), DIALOG_ERC::redrawDrawPanel(), SCH_BASE_FRAME::RedrawScreen(), SCH_PREVIEW_PANEL::Refresh(), Refresh(), refreshCallback(), EDA_DRAW_FRAME::RefreshCanvas(), DIALOG_FOOTPRINT_CHECKER::refreshEditor(), DIALOG_DRC::refreshEditor(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), FOOTPRINT_WIZARD_FRAME::ReloadFootprint(), SCH_EDITOR_CONTROL::RemapSymbols(), EDIT_TOOL::Remove(), renderFootprint(), SCH_EDIT_TOOL::RepeatDrawItem(), SCH_EDITOR_CONTROL::rescueProject(), FOOTPRINT_EDIT_FRAME::RevertFootprint(), PL_EDITOR_FRAME::RollbackFromUndo(), SCH_EDIT_FRAME::RollbackSchematicFromUndo(), SCH_EDIT_FRAME::SaveSymbolToSchematic(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), GERBVIEW_FRAME::SetActiveLayer(), SYMBOL_EDIT_FRAME::SetCurSymbol(), PCB_BASE_FRAME::SetDisplayOptions(), EDA_DRAW_FRAME::SetGridVisibility(), APPEARANCE_CONTROLS::SetObjectVisible(), SYMBOL_VIEWER_FRAME::SetSelectedLibrary(), SYMBOL_EDIT_FRAME::ShowChangedLanguage(), SYMBOL_EDITOR_CONTROL::ShowElectricalTypes(), PCB_VIEWER_TOOLS::ShowPadNumbers(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), GERBVIEW_FRAME::SortLayersByX2Attributes(), GLOBAL_EDIT_TOOL::SwapLayers(), SCH_DRAW_PANEL::SwitchBackend(), PCB_BASE_FRAME::SwitchLayer(), PCB_EDIT_FRAME::SwitchLayer(), DIALOG_ERC::testErc(), PCB_VIEWER_TOOLS::TextOutlines(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PCB_CONTROL::ToggleRatsnest(), PCB_CONTROL::TrackDisplayMode(), PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow(), PANEL_GAL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_JUNCTION_PROPS::TransferDataFromWindow(), PANEL_EDIT_OPTIONS::TransferDataFromWindow(), PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow(), DIALOG_LINE_WIRE_BUS_PROPERTIES::TransferDataFromWindow(), DIALOG_SHEET_PIN_PROPERTIES::TransferDataFromWindow(), DIALOG_TEXT_AND_LABEL_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PROPERTIES::TransferDataFromWindow(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_FRAME::UpdateDisplayOptions(), SCH_EDITOR_CONTROL::UpdateFind(), NET_GRID_TABLE::updateNetColor(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), PANEL_PCBNEW_COLOR_SETTINGS::updatePreview(), SYMBOL_VIEWER_FRAME::updatePreviewSymbol(), PCB_CONTROL::ViaDisplayMode(), PCB_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneUnfill(), ZONE_FILLER_TOOL::ZoneUnfillAll(), and DIALOG_GROUP_PROPERTIES::~DIALOG_GROUP_PROPERTIES().

◆ renderFootprint()

void FOOTPRINT_PREVIEW_PANEL::renderFootprint ( std::shared_ptr< FOOTPRINT aFootprint)
private

Definition at line 93 of file footprint_preview_panel.cpp.

94 {
95  if( m_currentFootprint )
96  {
97  GetView()->Remove( m_currentFootprint.get() );
98  GetView()->Clear();
99  m_currentFootprint->SetParent( nullptr );
100  }
101 
102  m_currentFootprint = aFootprint;
103 
104  if( !m_currentFootprint )
105  return;
106 
107  m_currentFootprint->SetParent( m_dummyBoard.get() );
108 
109  // Ensure we are not using the high contrast mode to display the selected footprint
110  KIGFX::PAINTER* painter = GetView()->GetPainter();
111  auto settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );
112  settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL );
113 
114  GetView()->Add( m_currentFootprint.get() );
115  GetView()->SetVisible( m_currentFootprint.get(), true );
117 
118  BOX2I bbox = m_currentFootprint->ViewBBox();
119  bbox.Merge( m_currentFootprint->Value().ViewBBox() );
120  bbox.Merge( m_currentFootprint->Reference().ViewBBox() );
121 
122  if( bbox.GetSize().x > 0 && bbox.GetSize().y > 0 )
123  {
124  // Autozoom
125  GetView()->SetViewport( BOX2D( bbox.GetOrigin(), bbox.GetSize() ) );
126 
127  // Add a margin
128  GetView()->SetScale( GetView()->GetScale() * 0.7 );
129 
130  Refresh();
131  }
132 }
void SetViewport(const BOX2D &aViewport)
Set the visible area of the VIEW.
Definition: view.cpp:524
BOX2< VECTOR2D > BOX2D
Definition: box2.h:507
All except INITIAL_ADD.
Definition: view_item.h:53
std::shared_ptr< FOOTPRINT > m_currentFootprint
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
std::unique_ptr< BOARD > m_dummyBoard
void Clear()
Remove all items from the view.
Definition: view.cpp:1100
Inactive layers are shown normally (no high-contrast mode)
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition: box2.h:363
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
virtual void SetScale(double aScale, VECTOR2D aAnchor={ 0, 0 })
Set the scaling factor, zooming around a given anchor point.
Definition: view.cpp:552
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1516
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
const Vec & GetSize() const
Definition: box2.h:172
const Vec & GetOrigin() const
Definition: box2.h:176

References KIGFX::PCB_VIEW::Add(), KIGFX::ALL, KIGFX::VIEW::Clear(), BOX2< Vec >::GetOrigin(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), BOX2< Vec >::GetSize(), PCB_DRAW_PANEL_GAL::GetView(), m_currentFootprint, m_dummyBoard, BOX2< Vec >::Merge(), NORMAL, EDA_DRAW_PANEL_GAL::Refresh(), KIGFX::PCB_VIEW::Remove(), KIGFX::VIEW::SetScale(), KIGFX::VIEW::SetViewport(), KIGFX::VIEW::SetVisible(), KIGFX::PCB_VIEW::Update(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by DisplayFootprint().

◆ SetCurrentCursor()

void EDA_DRAW_PANEL_GAL::SetCurrentCursor ( KICURSOR  aCursor)
inherited

Set the current cursor shape for this panel.

Definition at line 603 of file draw_panel_gal.cpp.

604 {
605  if( m_gal )
606  m_gal->SetNativeCursorStyle( aCursor );
607 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
virtual bool SetNativeCursorStyle(KICURSOR aCursor)
Set the cursor in the native panel.

References EDA_DRAW_PANEL_GAL::m_gal, and KIGFX::GAL::SetNativeCursorStyle().

Referenced by PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::finishInteractive(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), EE_SELECTION_TOOL::OnIdle(), PCB_SELECTION_TOOL::OnIdle(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), DRAWING_TOOL::SetAnchor(), PL_POINT_EDITOR::setEditedPoint(), EE_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_DRAW_PANEL_GAL::SwitchBackend(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ setDefaultLayerDeps()

void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps ( )
protectedinherited

Currently used drawing-sheet.

Definition at line 558 of file pcb_draw_panel_gal.cpp.

559 {
560  // caching makes no sense for Cairo and other software renderers
562 
563  for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; i++ )
564  m_view->SetLayerTarget( i, target );
565 
566  for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
567  {
568  LAYER_NUM layer = GAL_LAYER_ORDER[i];
569  wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
570 
571  // Set layer display dependencies & targets
572  if( IsCopperLayer( layer ) )
573  {
574  m_view->SetRequired( ZONE_LAYER_FOR( layer ), layer );
575  m_view->SetRequired( GetNetnameLayer( layer ), layer );
576  }
577  else if( IsNonCopperLayer( layer ) )
578  {
579  m_view->SetRequired( ZONE_LAYER_FOR( layer ), layer );
580  }
581  else if( IsNetnameLayer( layer ) )
582  {
583  m_view->SetLayerDisplayOnly( layer );
584  }
585  }
586 
589 
590  // Some more required layers settings
593 
594  // Holes can be independent of their host objects (cf: printing drill marks)
600 
601  // Via visibility
605 
606  // Pad visibility
610 
611  // Front footprints
614 
615  // Back footprints
618 
625 
634 
638 }
currently selected items overlay
Definition: layer_ids.h:226
smd pads, front layer
Definition: layer_ids.h:209
to draw micro vias
Definition: layer_ids.h:201
layer for drc markers with SEVERITY_ERROR
Definition: layer_ids.h:223
void SetRequired(int aLayerId, int aRequiredId, bool aRequired=true)
Mark the aRequiredId layer as required for the aLayerId layer.
Definition: view.cpp:390
GAL_TYPE m_backend
Currently used GAL.
Meta control for all pads opacity/visibility (color ignored)
Definition: layer_ids.h:237
smd pads, back layer
Definition: layer_ids.h:210
Additional netnames layers (not associated with a PCB layer)
Definition: layer_ids.h:172
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:208
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
#define ZONE_LAYER_FOR(copperLayer)
Macro for getting the zone layer for a given copper layer.
Definition: layer_ids.h:263
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:222
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:711
const LAYER_NUM GAL_LAYER_ORDER[]
Auxiliary rendering target (noncached)
Definition: definitions.h:49
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:953
to draw usual through hole vias
Definition: layer_ids.h:203
void SetLayerTarget(int aLayer, RENDER_TARGET aTarget)
Change the rendering target for a particular layer.
Definition: view.h:461
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:204
Meta control for all vias opacity/visibility.
Definition: layer_ids.h:200
shadows for drc markers
Definition: layer_ids.h:244
void SetLayerDisplayOnly(int aLayer, bool aDisplayOnly=true)
Definition: view.h:449
bool IsNonCopperLayer(LAYER_NUM aLayerId)
Test whether a layer is a non copper layer.
Definition: layer_ids.h:819
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
drawingsheet frame and titleblock
Definition: layer_ids.h:224
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
multilayer pads, usually with holes
Definition: layer_ids.h:220
Main rendering target (cached)
Definition: definitions.h:48
to draw blind/buried vias
Definition: layer_ids.h:202
layer for drc markers which have been individually excluded
Definition: layer_ids.h:243
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
general purpose overlay
Definition: layer_ids.h:225
bool IsNetnameLayer(LAYER_NUM aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:976
Definition: layer_ids.h:71
layer for drc markers with SEVERITY_WARNING
Definition: layer_ids.h:242
to draw pad holes (plated)
Definition: layer_ids.h:221

References B_Cu, F_Cu, GAL_LAYER_ORDER, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, GetNetnameLayer(), IsCopperLayer(), IsNetnameLayer(), IsNonCopperLayer(), LAYER_ANCHOR, LAYER_DRAWINGSHEET, LAYER_DRC_ERROR, LAYER_DRC_EXCLUSION, LAYER_DRC_WARNING, LAYER_GP_OVERLAY, LAYER_GRID, LAYER_MARKER_SHADOWS, LAYER_NON_PLATEDHOLES, LAYER_PAD_BK, LAYER_PAD_BK_NETNAMES, LAYER_PAD_FR, LAYER_PAD_FR_NETNAMES, LAYER_PAD_HOLEWALLS, LAYER_PAD_NETNAMES, LAYER_PAD_PLATEDHOLES, LAYER_PADS, LAYER_PADS_TH, LAYER_RATSNEST, LAYER_SELECT_OVERLAY, LAYER_VIA_BBLIND, LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_VIA_MICROVIA, LAYER_VIA_NETNAMES, LAYER_VIA_THROUGH, LAYER_VIAS, EDA_DRAW_PANEL_GAL::m_backend, EDA_DRAW_PANEL_GAL::m_view, KIGFX::VIEW::SetLayerDisplayOnly(), KIGFX::VIEW::SetLayerTarget(), KIGFX::VIEW::SetRequired(), KIGFX::TARGET_CACHED, KIGFX::TARGET_NONCACHED, KIGFX::TARGET_OVERLAY, KIGFX::VIEW::VIEW_MAX_LAYERS, and ZONE_LAYER_FOR.

Referenced by PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), and PCB_DRAW_PANEL_GAL::SwitchBackend().

◆ setDefaultLayerOrder()

void PCB_DRAW_PANEL_GAL::setDefaultLayerOrder ( )
protectedinherited

< Reassign layer order to the initial settings.

Set rendering targets & dependencies for layers.

Definition at line 521 of file pcb_draw_panel_gal.cpp.

522 {
523  for( LAYER_NUM i = 0; (unsigned) i < sizeof( GAL_LAYER_ORDER ) / sizeof( LAYER_NUM ); ++i )
524  {
525  LAYER_NUM layer = GAL_LAYER_ORDER[i];
526  wxASSERT( layer < KIGFX::VIEW::VIEW_MAX_LAYERS );
527 
528  m_view->SetLayerOrder( layer, i );
529  }
530 }
void SetLayerOrder(int aLayer, int aRenderingOrder)
Set rendering order of a particular layer.
Definition: view.cpp:635
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
static constexpr int VIEW_MAX_LAYERS
maximum number of layers that may be shown
Definition: view.h:711
const LAYER_NUM GAL_LAYER_ORDER[]
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.

References GAL_LAYER_ORDER, EDA_DRAW_PANEL_GAL::m_view, KIGFX::VIEW::SetLayerOrder(), and KIGFX::VIEW::VIEW_MAX_LAYERS.

Referenced by PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), and PCB_DRAW_PANEL_GAL::SetTopLayer().

◆ SetDrawingSheet()

void PCB_DRAW_PANEL_GAL::SetDrawingSheet ( DS_PROXY_VIEW_ITEM aDrawingSheet)
inherited

Sets (or updates) drawing-sheet used by the draw panel.

Parameters
aDrawingSheetis the drawing-sheet to be used. The object is then owned by PCB_DRAW_PANEL_GAL.

Definition at line 241 of file pcb_draw_panel_gal.cpp.

242 {
243  m_drawingSheet.reset( aDrawingSheet );
244  m_view->Add( m_drawingSheet.get() );
245 }
std::unique_ptr< DS_PROXY_VIEW_ITEM > m_drawingSheet
Ratsnest view item.
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:320

References KIGFX::VIEW::Add(), PCB_DRAW_PANEL_GAL::m_drawingSheet, and EDA_DRAW_PANEL_GAL::m_view.

Referenced by PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems().

◆ SetEventDispatcher()

void EDA_DRAW_PANEL_GAL::SetEventDispatcher ( TOOL_DISPATCHER aEventDispatcher)
inherited

Set a dispatcher that processes events and forwards them to tools.

#DRAW_PANEL_GAL does not take over the ownership. Passing NULL disconnects all event handlers from the #DRAW_PANEL_GAL and parent frame.

Parameters
aEventDispatcheris the object that will be used for dispatching events.

Definition at line 376 of file draw_panel_gal.cpp.

377 {
378  m_eventDispatcher = aEventDispatcher;
379 }
TOOL_DISPATCHER * m_eventDispatcher
Processes and forwards events to tools.

References EDA_DRAW_PANEL_GAL::m_eventDispatcher.

Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::ActivateGalCanvas(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), EVT_GRID_CMD_CELL_CHANGED(), FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME(), PL_EDITOR_FRAME::setupTools(), FOOTPRINT_EDIT_FRAME::setupTools(), SYMBOL_VIEWER_FRAME::setupTools(), SYMBOL_EDIT_FRAME::setupTools(), and SCH_EDIT_FRAME::setupTools().

◆ SetFocus()

◆ SetHighContrastLayer() [1/2]

virtual void PCB_DRAW_PANEL_GAL::SetHighContrastLayer ( int  aLayer)
inlineoverridevirtualinherited

SetHighContrastLayer(), with some extra smarts for PCB.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 71 of file pcb_draw_panel_gal.h.

◆ SetHighContrastLayer() [2/2]

void PCB_DRAW_PANEL_GAL::SetHighContrastLayer ( PCB_LAYER_ID  aLayer)
inherited

Move the selected layer to the top, so it is displayed above all others.

Definition at line 279 of file pcb_draw_panel_gal.cpp.

280 {
281  // Set display settings for high contrast mode
283 
284  SetTopLayer( aLayer );
285  rSettings->SetActiveLayer( aLayer );
286 
287  rSettings->ClearHighContrastLayers();
288  rSettings->SetLayerIsHighContrast( aLayer );
289 
290  if( IsCopperLayer( aLayer ) )
291  {
292  // Bring some other layers to the front in case of copper layers and make them colored
293  // fixme do not like the idea of storing the list of layers here,
294  // should be done in some other way I guess..
295  LAYER_NUM layers[] = {
298  ZONE_LAYER_FOR( aLayer ),
305  };
306 
307  for( unsigned int i : layers )
308  rSettings->SetLayerIsHighContrast( i );
309 
310  // Pads should be shown too
311  if( aLayer == B_Cu )
312  {
313  rSettings->SetLayerIsHighContrast( LAYER_PAD_BK );
314  rSettings->SetLayerIsHighContrast( LAYER_MOD_BK );
315  }
316  else if( aLayer == F_Cu )
317  {
318  rSettings->SetLayerIsHighContrast( LAYER_PAD_FR );
319  rSettings->SetLayerIsHighContrast( LAYER_MOD_FR );
320  }
321  }
322 
324 }
currently selected items overlay
Definition: layer_ids.h:226
smd pads, front layer
Definition: layer_ids.h:209
to draw micro vias
Definition: layer_ids.h:201
layer for drc markers with SEVERITY_ERROR
Definition: layer_ids.h:223
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
PCB cursor.
Definition: layer_ids.h:228
smd pads, back layer
Definition: layer_ids.h:210
Additional netnames layers (not associated with a PCB layer)
Definition: layer_ids.h:172
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:208
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
show footprints on back
Definition: layer_ids.h:216
#define ZONE_LAYER_FOR(copperLayer)
Macro for getting the zone layer for a given copper layer.
Definition: layer_ids.h:263
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:222
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:953
to draw usual through hole vias
Definition: layer_ids.h:203
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:204
shadows for drc markers
Definition: layer_ids.h:244
show footprints on front
Definition: layer_ids.h:215
void SetLayerIsHighContrast(int aLayerId, bool aEnabled=true)
Set the specified layer as high-contrast.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
multilayer pads, usually with holes
Definition: layer_ids.h:220
to draw blind/buried vias
Definition: layer_ids.h:202
layer for drc markers which have been individually excluded
Definition: layer_ids.h:243
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
general purpose overlay
Definition: layer_ids.h:225
Definition: layer_ids.h:71
layer for drc markers with SEVERITY_WARNING
Definition: layer_ids.h:242
void ClearHighContrastLayers()
Clear the list of active layers.
to draw pad holes (plated)
Definition: layer_ids.h:221
virtual void SetTopLayer(int aLayer) override
SetTopLayer(), with some extra smarts for PCB.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:762
void SetActiveLayer(PCB_LAYER_ID aLayer)

References B_Cu, KIGFX::RENDER_SETTINGS::ClearHighContrastLayers(), F_Cu, GetNetnameLayer(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), IsCopperLayer(), LAYER_ANCHOR, LAYER_CURSOR, LAYER_DRC_ERROR, LAYER_DRC_EXCLUSION, LAYER_DRC_WARNING, LAYER_GP_OVERLAY, LAYER_MARKER_SHADOWS, LAYER_MOD_BK, LAYER_MOD_FR, LAYER_NON_PLATEDHOLES, LAYER_PAD_BK, LAYER_PAD_BK_NETNAMES, LAYER_PAD_FR, LAYER_PAD_FR_NETNAMES, LAYER_PAD_HOLEWALLS, LAYER_PAD_NETNAMES, LAYER_PAD_PLATEDHOLES, LAYER_PADS_TH, LAYER_RATSNEST, LAYER_SELECT_OVERLAY, LAYER_VIA_BBLIND, LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_VIA_MICROVIA, LAYER_VIA_NETNAMES, LAYER_VIA_THROUGH, EDA_DRAW_PANEL_GAL::m_view, KIGFX::RENDER_SETTINGS::SetActiveLayer(), KIGFX::RENDER_SETTINGS::SetLayerIsHighContrast(), PCB_DRAW_PANEL_GAL::SetTopLayer(), KIGFX::VIEW::UpdateAllLayersColor(), and ZONE_LAYER_FOR.

◆ SetKiway()

void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

It is only used for debugging, since "this" is not a wxWindow*.

"this" is a KIWAY_HOLDER mix-in.

Parameters
aDestis the recipient of aKiway pointer.
aKiwayis often from a parent window or from KIFACE::CreateWindow().

Definition at line 43 of file kiway_holder.cpp.

44 {
45 #if defined(DEBUG)
46  // offer a trap point for debugging most any window
47  wxASSERT( aDest );
48  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
49  {
50  int breakhere=1;
51  ignore_unused( breakhere );
52  }
53 #endif
54 
55  ignore_unused( aDest );
56 
57  m_kiway = aKiway;
58 }
KIWAY * m_kiway
Definition: kiway_holder.h:75
const char * name
Definition: DXF_plotter.cpp:56
void ignore_unused(const T &)
Definition: ignore.h:24

References ignore_unused(), KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), PCB::IFACE::CreateWindow(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ SetStealsFocus()

void EDA_DRAW_PANEL_GAL::SetStealsFocus ( bool  aStealsFocus)
inlineinherited

Set whether focus is taken on certain events (mouseover, keys, etc).

This should be true (and is by default) for any primary canvas, but can be false to make well behaved preview panes and the like.

Definition at line 190 of file class_draw_panel_gal.h.

190 { m_stealsFocus = aStealsFocus; }
bool m_stealsFocus
Flag to indicate whether the panel should take focus at certain times (when moused over,...

References EDA_DRAW_PANEL_GAL::m_stealsFocus.

Referenced by SYMBOL_VIEWER_FRAME::ClickOnCmpList(), FOOTPRINT_PREVIEW_PANEL(), PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS(), DIALOG_PAD_PROPERTIES::prepareCanvas(), SYMBOL_VIEWER_FRAME::SetSelectedLibrary(), and SYMBOL_PREVIEW_WIDGET::SYMBOL_PREVIEW_WIDGET().

◆ SetTopLayer() [1/2]

virtual void PCB_DRAW_PANEL_GAL::SetTopLayer ( int  aLayer)
inlineoverridevirtualinherited

SetTopLayer(), with some extra smarts for PCB.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 80 of file pcb_draw_panel_gal.h.

Referenced by PCB_DRAW_PANEL_GAL::OnShow(), and PCB_DRAW_PANEL_GAL::SetHighContrastLayer().

◆ SetTopLayer() [2/2]

void PCB_DRAW_PANEL_GAL::SetTopLayer ( PCB_LAYER_ID  aLayer)
inherited

Definition at line 327 of file pcb_draw_panel_gal.cpp.

328 {
331  m_view->SetTopLayer( aLayer );
332 
333  // Layers that should always have on-top attribute enabled
334  const std::vector<LAYER_NUM> layers = {
343  };
344 
345  for( auto layer : layers )
346  m_view->SetTopLayer( layer );
347 
348  // Extra layers that are brought to the top if a F.* or B.* is selected
349  const std::vector<LAYER_NUM> frontLayers = {
352  };
353 
354  const std::vector<LAYER_NUM> backLayers = {
357  };
358 
359  const std::vector<LAYER_NUM>* extraLayers = nullptr;
360 
361  // Bring a few more extra layers to the top depending on the selected board side
362  if( IsFrontLayer( aLayer ) )
363  extraLayers = &frontLayers;
364  else if( IsBackLayer( aLayer ) )
365  extraLayers = &backLayers;
366 
367  if( extraLayers )
368  {
369  for( auto layer : *extraLayers )
370  {
371  m_view->SetTopLayer( layer );
372 
373  if( layer < PCB_LAYER_ID_COUNT )
374  m_view->SetTopLayer( ZONE_LAYER_FOR( layer ) );
375  }
376 
377  // Move the active layer to the top of the stack but below all the overlay layers
378  if( !IsCopperLayer( aLayer ) )
379  {
381  m_view->SetLayerOrder( ZONE_LAYER_FOR( aLayer ),
383 
384  // Fix up pad and via netnames to be below. This is hacky, we need a rethink
385  // of layer ordering...
390  }
391  }
392  else if( IsCopperLayer( aLayer ) )
393  {
394  // Display labels for copper layers on the top
395  m_view->SetTopLayer( GetNetnameLayer( aLayer ) );
396  m_view->SetTopLayer( ZONE_LAYER_FOR( aLayer ) );
397  }
398  else
399  {
400  m_view->SetTopLayer( ZONE_LAYER_FOR( aLayer ) );
401  }
402 
403  m_view->EnableTopLayer( true );
405 }
currently selected items overlay
Definition: layer_ids.h:226
smd pads, front layer
Definition: layer_ids.h:209
to draw micro vias
Definition: layer_ids.h:201
layer for drc markers with SEVERITY_ERROR
Definition: layer_ids.h:223
void SetLayerOrder(int aLayer, int aRenderingOrder)
Set rendering order of a particular layer.
Definition: view.cpp:635
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:826
void setDefaultLayerOrder()
< Reassign layer order to the initial settings.
smd pads, back layer
Definition: layer_ids.h:210
Additional netnames layers (not associated with a PCB layer)
Definition: layer_ids.h:172
void UpdateAllLayersOrder()
Do everything that is needed to apply the rendering order of layers.
Definition: view.cpp:893
#define ZONE_LAYER_FOR(copperLayer)
Macro for getting the zone layer for a given copper layer.
Definition: layer_ids.h:263
virtual void EnableTopLayer(bool aEnable)
Enable or disable display of the top layer.
Definition: view.cpp:853
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:222
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
Definition: layer_ids.h:953
to draw usual through hole vias
Definition: layer_ids.h:203
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:204
bool IsBackLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a back layer.
Definition: layer_ids.h:907
shadows for drc markers
Definition: layer_ids.h:244
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
Definition: layer_ids.h:884
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:808
void ClearTopLayers()
Remove all layers from the on-the-top set (they are no longer displayed over the rest of layers).
Definition: view.cpp:878
multilayer pads, usually with holes
Definition: layer_ids.h:220
to draw blind/buried vias
Definition: layer_ids.h:202
layer for drc markers which have been individually excluded
Definition: layer_ids.h:243
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
general purpose overlay
Definition: layer_ids.h:225
Definition: layer_ids.h:71
int GetLayerOrder(int aLayer) const
Return rendering order of a particular layer.
Definition: view.cpp:643
layer for drc markers with SEVERITY_WARNING
Definition: layer_ids.h:242
to draw pad holes (plated)
Definition: layer_ids.h:221
#define NETNAMES_LAYER_INDEX(layer)
Macro for obtaining netname layer for a given PCB layer.
Definition: layer_ids.h:181

References B_Adhes, B_CrtYd, B_Cu, B_Fab, B_Mask, B_Paste, B_SilkS, KIGFX::VIEW::ClearTopLayers(), KIGFX::VIEW::EnableTopLayer(), F_Adhes, F_CrtYd, F_Cu, F_Fab, F_Mask, F_Paste, F_SilkS, KIGFX::VIEW::GetLayerOrder(), GetNetnameLayer(), IsBackLayer(), IsCopperLayer(), IsFrontLayer(), LAYER_DRC_ERROR, LAYER_DRC_EXCLUSION, LAYER_DRC_WARNING, LAYER_GP_OVERLAY, LAYER_MARKER_SHADOWS, LAYER_NON_PLATEDHOLES, LAYER_PAD_BK, LAYER_PAD_BK_NETNAMES, LAYER_PAD_FR, LAYER_PAD_FR_NETNAMES, LAYER_PAD_HOLEWALLS, LAYER_PAD_NETNAMES, LAYER_PAD_PLATEDHOLES, LAYER_PADS_TH, LAYER_RATSNEST, LAYER_SELECT_OVERLAY, LAYER_VIA_BBLIND, LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_VIA_MICROVIA, LAYER_VIA_NETNAMES, LAYER_VIA_THROUGH, EDA_DRAW_PANEL_GAL::m_view, NETNAMES_LAYER_INDEX, PCB_LAYER_ID_COUNT, PCB_DRAW_PANEL_GAL::setDefaultLayerOrder(), KIGFX::VIEW::SetLayerOrder(), KIGFX::VIEW::SetTopLayer(), KIGFX::VIEW::UpdateAllLayersOrder(), and ZONE_LAYER_FOR.

◆ StartDrawing()

void EDA_DRAW_PANEL_GAL::StartDrawing ( )
inherited

Begin drawing if it was stopped previously.

Definition at line 382 of file draw_panel_gal.cpp.

383 {
384  // Start querying GAL if it is ready
385  m_refreshTimer.StartOnce( 100 );
386 }
wxTimer m_refreshTimer
Timer to prevent too-frequent refreshing.

References EDA_DRAW_PANEL_GAL::m_refreshTimer.

Referenced by GERBVIEW_FRAME::ActivateGalCanvas(), PCB_BASE_FRAME::ActivateGalCanvas(), EDA_DRAW_FRAME::ActivateGalCanvas(), FOOTPRINT_PREVIEW_PANEL(), DIALOG_PAD_PROPERTIES::prepareCanvas(), DIALOG_PAD_PROPERTIES::redraw(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), and SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL().

◆ StopDrawing()

void EDA_DRAW_PANEL_GAL::StopDrawing ( )
inherited

Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.

Definition at line 389 of file draw_panel_gal.cpp.

390 {
391  m_drawingEnabled = false;
392  Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), nullptr, this );
393  m_pendingRefresh = false;
394  m_refreshTimer.Stop();
395 }
bool m_pendingRefresh
Is there a redraw event requested?
wxTimer m_refreshTimer
Timer to prevent too-frequent refreshing.
virtual void onPaint(wxPaintEvent &WXUNUSED(aEvent))
bool m_drawingEnabled
Flag that determines if VIEW may use GAL for redrawing the screen.

References EDA_DRAW_PANEL_GAL::m_drawingEnabled, EDA_DRAW_PANEL_GAL::m_pendingRefresh, EDA_DRAW_PANEL_GAL::m_refreshTimer, and EDA_DRAW_PANEL_GAL::onPaint().

Referenced by GERBVIEW_FRAME::doCloseWindow(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), SYMBOL_VIEWER_FRAME::doCloseWindow(), FOOTPRINT_VIEWER_FRAME::doCloseWindow(), DIALOG_PAD_PROPERTIES::OnCancel(), DIALOG_PAD_PROPERTIES::redraw(), EDA_DRAW_PANEL_GAL::SwitchBackend(), DISPLAY_FOOTPRINTS_FRAME::~DISPLAY_FOOTPRINTS_FRAME(), EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL(), FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME(), and FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME().

◆ SwitchBackend()

bool PCB_DRAW_PANEL_GAL::SwitchBackend ( GAL_TYPE  aGalType)
overridevirtualinherited

Force refresh of the ratsnest visual representation.

Reimplemented from EDA_DRAW_PANEL_GAL.

Definition at line 533 of file pcb_draw_panel_gal.cpp.

534 {
535  bool rv = EDA_DRAW_PANEL_GAL::SwitchBackend( aGalType );
537  m_gal->SetWorldUnitLength( 1e-9 /* 1 nm */ / 0.0254 /* 1 inch in meters */ );
538  return rv;
539 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
void setDefaultLayerDeps()
Currently used drawing-sheet.
virtual bool SwitchBackend(GAL_TYPE aGalType)
Switch method of rendering graphics.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.

References EDA_DRAW_PANEL_GAL::m_gal, PCB_DRAW_PANEL_GAL::setDefaultLayerDeps(), KIGFX::GAL::SetWorldUnitLength(), and EDA_DRAW_PANEL_GAL::SwitchBackend().

Referenced by PCB_DRAW_PANEL_GAL::OnShow().

◆ SyncLayersVisibility()

void PCB_DRAW_PANEL_GAL::SyncLayersVisibility ( const BOARD aBoard)
inherited

Update "visibility" property of each layer of a given BOARD.

Parameters
aBoardcontains layers visibility settings to be applied.

Definition at line 408 of file pcb_draw_panel_gal.cpp.

409 {
410  // Load layer & elements visibility settings
411  for( LAYER_NUM i = 0; i < PCB_LAYER_ID_COUNT; ++i )
412  m_view->SetLayerVisible( i, aBoard->IsLayerVisible( PCB_LAYER_ID( i ) ) );
413 
415  m_view->SetLayerVisible( i, aBoard->IsElementVisible( i ) );
416 
417  // Via layers controlled by dependencies
421 
422  // Pad layers controlled by dependencies
425 
426  // Always enable netname layers, as their visibility is controlled by layer dependencies
428  m_view->SetLayerVisible( i, true );
429 
430  for( LAYER_NUM i = LAYER_ZONE_START; i < LAYER_ZONE_END; i++ )
431  m_view->SetLayerVisible( i, true );
432 
433  // Enable some layers that are GAL specific
442 }
currently selected items overlay
Definition: layer_ids.h:226
smd pads, front layer
Definition: layer_ids.h:209
to draw micro vias
Definition: layer_ids.h:201
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
Definition: layer_ids.h:196
smd pads, back layer
Definition: layer_ids.h:210
int LAYER_NUM
This can be replaced with int and removed.
Definition: layer_ids.h:41
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:222
to draw usual through hole vias
Definition: layer_ids.h:203
shadows for drc markers
Definition: layer_ids.h:244
Virtual layers for stacking zones and tracks on a given copper layer.
Definition: layer_ids.h:253
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
Definition: view.h:388
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:533
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:473
to draw blind/buried vias
Definition: layer_ids.h:202
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
general purpose overlay
Definition: layer_ids.h:225
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:65
to draw pad holes (plated)
Definition: layer_ids.h:221

References GAL_LAYER_ID_END, GAL_LAYER_ID_START, BOARD::IsElementVisible(), BOARD::IsLayerVisible(), LAYER_GP_OVERLAY, LAYER_MARKER_SHADOWS, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PAD_HOLEWALLS, LAYER_PAD_PLATEDHOLES, LAYER_RATSNEST, LAYER_SELECT_OVERLAY, LAYER_VIA_BBLIND, LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_VIA_MICROVIA, LAYER_VIA_THROUGH, LAYER_ZONE_END, LAYER_ZONE_START, EDA_DRAW_PANEL_GAL::m_view, NETNAMES_LAYER_ID_END, NETNAMES_LAYER_ID_START, PCB_LAYER_ID_COUNT, and KIGFX::VIEW::SetLayerVisible().

Referenced by PCB_BASE_EDIT_FRAME::ActivateGalCanvas(), APPEARANCE_CONTROLS::doApplyLayerPreset(), FOOTPRINT_PREVIEW_PANEL(), APPEARANCE_CONTROLS::OnLayerContextMenu(), and Refresh().

◆ UpdateColors()

void PCB_DRAW_PANEL_GAL::UpdateColors ( )
inherited

Update the color settings in the painter and GAL.

Take care of display settings for the given layer to be displayed in high contrast mode.

Definition at line 248 of file pcb_draw_panel_gal.cpp.

249 {
250  COLOR_SETTINGS* cs = nullptr;
251 
252  PCB_BASE_FRAME* frame = dynamic_cast<PCB_BASE_FRAME*>( GetParentEDAFrame() );
253 
254  if( frame )
255  {
256  cs = frame->GetColorSettings();
257  }
258  else
259  {
260  PCBNEW_SETTINGS* app = Pgm().GetSettingsManager().GetAppSettings<PCBNEW_SETTINGS>();
261 
262  if( app )
263  cs = Pgm().GetSettingsManager().GetColorSettings( app->m_ColorTheme );
264  else
265  cs = Pgm().GetSettingsManager().GetColorSettings();
266  }
267 
268  wxCHECK_RET( cs, wxT( "null COLOR_SETTINGS" ) );
269 
270  auto rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() );
271  rs->LoadColors( cs );
272 
276 }
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
PCB cursor.
Definition: layer_ids.h:228
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
virtual COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
void SetGridColor(const COLOR4D &aGridColor)
Set the grid color.
void SetAxesColor(const COLOR4D &aAxesColor)
Set the axes color.
void SetCursorColor(const COLOR4D &aCursorColor)
Set the cursor color.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
COLOR4D GetColor(int aLayer) const
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
EDA_DRAW_FRAME * GetParentEDAFrame() const
Returns parent EDA_DRAW_FRAME, if available or NULL otherwise.
Color settings are a bit different than most of the settings objects in that there can be more than o...
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
wxString m_ColorTheme
Active color theme name.
Definition: app_settings.h:184

References COLOR_SETTINGS::GetColor(), PCB_BASE_FRAME::GetColorSettings(), KIGFX::VIEW::GetPainter(), EDA_DRAW_PANEL_GAL::GetParentEDAFrame(), KIGFX::PAINTER::GetSettings(), LAYER_CURSOR, LAYER_GRID, LAYER_GRID_AXES, APP_SETTINGS_BASE::m_ColorTheme, EDA_DRAW_PANEL_GAL::m_gal, EDA_DRAW_PANEL_GAL::m_view, Pgm(), KIGFX::GAL::SetAxesColor(), KIGFX::GAL::SetCursorColor(), and KIGFX::GAL::SetGridColor().

Referenced by PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems(), FOOTPRINT_PREVIEW_PANEL(), PCB_CONTROL::LayerAlphaDec(), PCB_CONTROL::LayerAlphaInc(), APPEARANCE_CONTROLS::OnColorSwatchChanged(), DIALOG_PAD_PROPERTIES::prepareCanvas(), PCB_BASE_EDIT_FRAME::SetBoard(), DISPLAY_FOOTPRINTS_FRAME::updateView(), FOOTPRINT_WIZARD_FRAME::updateView(), FOOTPRINT_VIEWER_FRAME::updateView(), and FOOTPRINT_EDIT_FRAME::UpdateView().

Member Data Documentation

◆ GAL_FALLBACK

◆ m_backend

◆ m_currentFootprint

std::shared_ptr<FOOTPRINT> FOOTPRINT_PREVIEW_PANEL::m_currentFootprint
private

◆ m_debugOverlay

std::shared_ptr<KIGFX::VIEW_OVERLAY> EDA_DRAW_PANEL_GAL::m_debugOverlay
protectedinherited

Optional overlay for drawing transient debug objects.

Definition at line 293 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::ClearDebugOverlay(), and EDA_DRAW_PANEL_GAL::DebugOverlay().

◆ m_displayOptions

std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> FOOTPRINT_PREVIEW_PANEL::m_displayOptions
private

Definition at line 83 of file footprint_preview_panel.h.

◆ m_drawing

bool EDA_DRAW_PANEL_GAL::m_drawing
protectedinherited

◆ m_drawingEnabled

bool EDA_DRAW_PANEL_GAL::m_drawingEnabled
protectedinherited

Flag that determines if VIEW may use GAL for redrawing the screen.

Definition at line 260 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), EDA_DRAW_PANEL_GAL::onRefreshTimer(), and EDA_DRAW_PANEL_GAL::StopDrawing().

◆ m_drawingSheet

std::unique_ptr<DS_PROXY_VIEW_ITEM> PCB_DRAW_PANEL_GAL::m_drawingSheet
protectedinherited

◆ m_dummyBoard

std::unique_ptr<BOARD> FOOTPRINT_PREVIEW_PANEL::m_dummyBoard
private

Definition at line 82 of file footprint_preview_panel.h.

Referenced by FOOTPRINT_PREVIEW_PANEL(), GetBoard(), and renderFootprint().

◆ m_edaFrame

◆ m_eventDispatcher

TOOL_DISPATCHER* EDA_DRAW_PANEL_GAL::m_eventDispatcher
protectedinherited

Processes and forwards events to tools.

Definition at line 282 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), EDA_DRAW_PANEL_GAL::OnEvent(), and EDA_DRAW_PANEL_GAL::SetEventDispatcher().

◆ m_gal

◆ m_lastRefresh

wxLongLong EDA_DRAW_PANEL_GAL::m_lastRefresh
protectedinherited

Last timestamp when the panel was refreshed.

Definition at line 252 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::DoRePaint(), and EDA_DRAW_PANEL_GAL::Refresh().

◆ m_lostFocus

bool EDA_DRAW_PANEL_GAL::m_lostFocus
protectedinherited

Flag to indicate that focus should be regained on the next mouse event.

It is a workaround for cases when the panel loses keyboard focus, so it does not react to hotkeys anymore.

Definition at line 286 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::OnEvent(), EDA_DRAW_PANEL_GAL::onLostFocus(), and EDA_DRAW_PANEL_GAL::SetFocus().

◆ m_MouseCapturedLost

bool EDA_DRAW_PANEL_GAL::m_MouseCapturedLost
inherited

used on wxMSW: true after a wxEVT_MOUSE_CAPTURE_LOST was received false after the mouse is recaptured.

Used to avoid calling twice a CaptureMouse(), not accepted by wxMSW

Definition at line 235 of file class_draw_panel_gal.h.

Referenced by KIGFX::WX_VIEW_CONTROLS::CaptureCursor(), EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and KIGFX::WX_VIEW_CONTROLS::onCaptureLost().

◆ m_onShowTimer

wxTimer EDA_DRAW_PANEL_GAL::m_onShowTimer
protectedinherited

Timer used to execute OnShow() when the window finally appears on the screen.

Definition at line 263 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL(), and EDA_DRAW_PANEL_GAL::onShowTimer().

◆ m_options

KIGFX::GAL_DISPLAY_OPTIONS& EDA_DRAW_PANEL_GAL::m_options
protectedinherited

Definition at line 279 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::SwitchBackend().

◆ m_painter

◆ m_PaintEventCounter

std::unique_ptr<PROF_COUNTER> EDA_DRAW_PANEL_GAL::m_PaintEventCounter
inherited

Definition at line 237 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL().

◆ m_parent

wxWindow* EDA_DRAW_PANEL_GAL::m_parent
protectedinherited

◆ m_pendingRefresh

bool EDA_DRAW_PANEL_GAL::m_pendingRefresh
protectedinherited

◆ m_ratsnest

std::unique_ptr<RATSNEST_VIEW_ITEM> PCB_DRAW_PANEL_GAL::m_ratsnest
protectedinherited

◆ m_refreshTimer

wxTimer EDA_DRAW_PANEL_GAL::m_refreshTimer
protectedinherited

◆ m_stealsFocus

bool EDA_DRAW_PANEL_GAL::m_stealsFocus
protectedinherited

Flag to indicate whether the panel should take focus at certain times (when moused over, and on various mouse/key events)

Definition at line 290 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::onEnter(), EDA_DRAW_PANEL_GAL::OnEvent(), and EDA_DRAW_PANEL_GAL::SetStealsFocus().

◆ m_view

KIGFX::VIEW* EDA_DRAW_PANEL_GAL::m_view
protectedinherited

Stores view settings (scale, center, etc.) and items to be drawn.

Definition at line 269 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::ClearDebugOverlay(), EDA_DRAW_PANEL_GAL::DebugOverlay(), PCB_DRAW_PANEL_GAL::DisplayBoard(), PL_DRAW_PANEL_GAL::DisplayDrawingSheet(), EDA_DRAW_PANEL_GAL::DoRePaint(), GERBVIEW_DRAW_PANEL_GAL::GERBVIEW_DRAW_PANEL_GAL(), GERBVIEW_DRAW_PANEL_GAL::GetDefaultViewBBox(), PCB_DRAW_PANEL_GAL::GetDefaultViewBBox(), SCH_DRAW_PANEL::GetView(), PCB_DRAW_PANEL_GAL::GetView(), EDA_DRAW_PANEL_GAL::GetView(), GERBVIEW_DRAW_PANEL_GAL::OnShow(), SCH_DRAW_PANEL::OnShow(), PCB_DRAW_PANEL_GAL::OnShow(), EDA_DRAW_PANEL_GAL::onSize(), PCB_DRAW_PANEL_GAL::PCB_DRAW_PANEL_GAL(), PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL(), PCB_DRAW_PANEL_GAL::RedrawRatsnest(), SCH_DRAW_PANEL::SCH_DRAW_PANEL(), SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL(), PL_DRAW_PANEL_GAL::setDefaultLayerDeps(), SCH_DRAW_PANEL::setDefaultLayerDeps(), SCH_PREVIEW_PANEL::setDefaultLayerDeps(), GERBVIEW_DRAW_PANEL_GAL::setDefaultLayerDeps(), PCB_DRAW_PANEL_GAL::setDefaultLayerDeps(), SCH_DRAW_PANEL::setDefaultLayerOrder(), SCH_PREVIEW_PANEL::setDefaultLayerOrder(), PCB_DRAW_PANEL_GAL::setDefaultLayerOrder(), PCB_DRAW_PANEL_GAL::SetDrawingSheet(), GERBVIEW_DRAW_PANEL_GAL::SetDrawingSheet(), GERBVIEW_DRAW_PANEL_GAL::SetHighContrastLayer(), PCB_DRAW_PANEL_GAL::SetHighContrastLayer(), EDA_DRAW_PANEL_GAL::SetHighContrastLayer(), PL_DRAW_PANEL_GAL::SetTopLayer(), GERBVIEW_DRAW_PANEL_GAL::SetTopLayer(), PCB_DRAW_PANEL_GAL::SetTopLayer(), EDA_DRAW_PANEL_GAL::SetTopLayer(), GERBVIEW_DRAW_PANEL_GAL::SwitchBackend(), EDA_DRAW_PANEL_GAL::SwitchBackend(), PCB_DRAW_PANEL_GAL::SyncLayersVisibility(), PCB_DRAW_PANEL_GAL::UpdateColors(), SCH_PREVIEW_PANEL::view(), and EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL().

◆ m_viewControls

◆ MinRefreshPeriod

const int EDA_DRAW_PANEL_GAL::MinRefreshPeriod = 17
staticprotectedinherited

60 FPS.

Definition at line 247 of file class_draw_panel_gal.h.

Referenced by EDA_DRAW_PANEL_GAL::Refresh().


The documentation for this class was generated from the following files: