From 0bc7bbbadbf356e451f86564263dbcb0df11c48d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 6 Oct 2020 13:20:29 +0100 Subject: [PATCH] Report silk/edge collisions. Fixes https://gitlab.com/kicad/code/kicad/issues/5854 Fixes https://gitlab.com/kicad/code/kicad/issues/4892 --- common/page_layout/ws_painter.cpp | 5 ++++- gerbview/gerbview.cpp | 6 ++++++ kicad/kicad.cpp | 6 ++++++ pagelayout_editor/pl_editor.cpp | 6 ++++++ pcb_calculator/pcb_calculator.cpp | 6 ++++++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/common/page_layout/ws_painter.cpp b/common/page_layout/ws_painter.cpp index 4bffb83c23..16f6c15f9e 100644 --- a/common/page_layout/ws_painter.cpp +++ b/common/page_layout/ws_painter.cpp @@ -118,8 +118,11 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase ) { bool tokenUpdated = false; - if( token->IsSameAs( wxT( "KICAD_VERSION" ) ) ) + if( token->IsSameAs( wxT( "KICAD_VERSION" ) ) && PgmOrNull() ) { + // TODO: it'd be nice to get the Python script name/version here for when + // PgmOrNull() is null... + *token = wxString::Format( wxT( "%s%s %s" ), productName, Pgm().App().GetAppName(), diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index cee553f480..4275059876 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -121,6 +121,12 @@ PGM_BASE& Pgm() } +// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script. +PGM_BASE* PgmOrNull() +{ + return process; +} + bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) { InitSettings( new GERBVIEW_SETTINGS ); diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index e64641b640..2e1186e491 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -69,6 +69,12 @@ PGM_BASE& Pgm() } +// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script. +PGM_BASE* PgmOrNull() +{ + return &program; +} + PGM_KICAD& PgmTop() { return program; diff --git a/pagelayout_editor/pl_editor.cpp b/pagelayout_editor/pl_editor.cpp index e07196936f..95ebe92890 100644 --- a/pagelayout_editor/pl_editor.cpp +++ b/pagelayout_editor/pl_editor.cpp @@ -124,6 +124,12 @@ PGM_BASE& Pgm() } +// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script. +PGM_BASE* PgmOrNull() +{ + return process; +} + bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) { InitSettings( new PL_EDITOR_SETTINGS ); diff --git a/pcb_calculator/pcb_calculator.cpp b/pcb_calculator/pcb_calculator.cpp index 6fb403db84..e2d2cb2be9 100644 --- a/pcb_calculator/pcb_calculator.cpp +++ b/pcb_calculator/pcb_calculator.cpp @@ -95,6 +95,12 @@ PGM_BASE& Pgm() } +// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script. +PGM_BASE* PgmOrNull() +{ + return process; +} + bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) { InitSettings( new PCB_CALCULATOR_SETTINGS );