Remove Legacy options for overlay/context
These options were used to support the legacy canvas when drawing on MacOS and GTK3. With the move to 100% GAL, they are extraneous. This moves all DC over to "COPY" as we only use this for printing support in Eeschema at the moment, so there is a single draw command (no erasing) for the canvas.
This commit is contained in:
parent
36f09cb29b
commit
e52afd93a3
|
@ -63,9 +63,6 @@ option( BUILD_SMALL_DEBUG_FILES "In debug build: create smaller binaries." OFF )
|
||||||
option( USE_WX_GRAPHICS_CONTEXT
|
option( USE_WX_GRAPHICS_CONTEXT
|
||||||
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" )
|
"Use wxGraphicsContext for rendering (default OFF). Warning, this is experimental" )
|
||||||
|
|
||||||
option( USE_WX_OVERLAY
|
|
||||||
"Use wxOverlay: Always ON for MAC and GTK3 (default OFF)." )
|
|
||||||
|
|
||||||
option( KICAD_SCRIPTING
|
option( KICAD_SCRIPTING
|
||||||
"Build the Python scripting support inside KiCad binaries (default ON)."
|
"Build the Python scripting support inside KiCad binaries (default ON)."
|
||||||
ON )
|
ON )
|
||||||
|
@ -352,10 +349,6 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
|
||||||
endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
|
||||||
if( USE_WX_OVERLAY OR APPLE )
|
|
||||||
add_definitions( -DUSE_WX_OVERLAY )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if( KICAD_SCRIPTING )
|
if( KICAD_SCRIPTING )
|
||||||
add_definitions( -DKICAD_SCRIPTING )
|
add_definitions( -DKICAD_SCRIPTING )
|
||||||
endif()
|
endif()
|
||||||
|
@ -757,11 +750,6 @@ find_package( wxWidgets ${wxWidgets_REQ_VERSION} COMPONENTS gl aui adv html core
|
||||||
# Include wxWidgets macros.
|
# Include wxWidgets macros.
|
||||||
include( ${wxWidgets_USE_FILE} )
|
include( ${wxWidgets_USE_FILE} )
|
||||||
|
|
||||||
# Check for GTK3 libraries - These do not have XOR, so we need overlay (Page layout editor)
|
|
||||||
if( wxWidgets_LIBRARIES MATCHES "gtk3" )
|
|
||||||
add_definitions( -DUSE_WX_OVERLAY )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if( KICAD_SCRIPTING_WXPYTHON AND NOT KICAD_SCRIPTING_WXPYTHON_PHOENIX )
|
if( KICAD_SCRIPTING_WXPYTHON AND NOT KICAD_SCRIPTING_WXPYTHON_PHOENIX )
|
||||||
# wxPython appears to be installed and valid so make sure the headers are available.
|
# wxPython appears to be installed and valid so make sure the headers are available.
|
||||||
foreach( path ${wxWidgets_INCLUDE_DIRS} )
|
foreach( path ${wxWidgets_INCLUDE_DIRS} )
|
||||||
|
|
|
@ -135,17 +135,6 @@ KiCad has many build options that can be configured to build different options d
|
||||||
the availability of support for each option on a given platform. This section documents
|
the availability of support for each option on a given platform. This section documents
|
||||||
these options and their default values.
|
these options and their default values.
|
||||||
|
|
||||||
## Advanced Graphics Context ## {#graphics_context_opt}
|
|
||||||
|
|
||||||
The USE_WX_GRAPHICS_CONTEXT option replaces wxDC with wxGraphicsContext for graphics rendering.
|
|
||||||
This option is disabled by default. Warning: the is experimental and has not been maintained
|
|
||||||
so use at your own risk.
|
|
||||||
|
|
||||||
## Graphics Context Overlay ## {#overlay_opt}
|
|
||||||
|
|
||||||
The USE_WX_OVERLAY option is used to enable the optional wxOverlay class for graphics rendering
|
|
||||||
on macOS. This is enabled on macOS and GTK3 by default and disabled on all other platforms.
|
|
||||||
|
|
||||||
## Scripting Support ## {#scripting_opt}
|
## Scripting Support ## {#scripting_opt}
|
||||||
|
|
||||||
The KICAD_SCRIPTING option is used to enable building the Python scripting support into Pcbnew.
|
The KICAD_SCRIPTING option is used to enable building the Python scripting support into Pcbnew.
|
||||||
|
|
|
@ -520,13 +520,6 @@ void DIALOG_ABOUT::buildVersionInfoData( wxString& aMsg, bool aFormatHtml )
|
||||||
// Add build settings config (build options):
|
// Add build settings config (build options):
|
||||||
aMsg << "Build settings:" << eol;
|
aMsg << "Build settings:" << eol;
|
||||||
|
|
||||||
aMsg << indent4 << "USE_WX_GRAPHICS_CONTEXT=";
|
|
||||||
#ifdef USE_WX_GRAPHICS_CONTEXT
|
|
||||||
aMsg << ON;
|
|
||||||
#else
|
|
||||||
aMsg << OFF;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
aMsg << indent4 << "KICAD_SCRIPTING=";
|
aMsg << indent4 << "KICAD_SCRIPTING=";
|
||||||
#ifdef KICAD_SCRIPTING
|
#ifdef KICAD_SCRIPTING
|
||||||
aMsg << ON;
|
aMsg << ON;
|
||||||
|
|
|
@ -36,9 +36,6 @@
|
||||||
#include <wx/graphics.h>
|
#include <wx/graphics.h>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
#include <geometry/geometry_utils.h>
|
#include <geometry/geometry_utils.h>
|
||||||
#if defined(__WXMAC__) && defined(USE_WX_GRAPHICS_CONTEXT)
|
|
||||||
#include <wx/dcgraph.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const bool FILLED = true;
|
static const bool FILLED = true;
|
||||||
static const bool NOT_FILLED = false;
|
static const bool NOT_FILLED = false;
|
||||||
|
@ -217,54 +214,6 @@ bool GetGRForceBlackPenState( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************/
|
|
||||||
/* Set the device context draw mode. */
|
|
||||||
/*************************************/
|
|
||||||
void GRSetDrawMode( wxDC* DC, GR_DRAWMODE draw_mode )
|
|
||||||
{
|
|
||||||
if( draw_mode & GR_OR )
|
|
||||||
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxCOPY );
|
|
||||||
#elif defined( USE_WX_GRAPHICS_CONTEXT )
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxCOPY );
|
|
||||||
#else
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxOR );
|
|
||||||
#endif
|
|
||||||
else if( draw_mode & GR_XOR )
|
|
||||||
#if defined( USE_WX_GRAPHICS_CONTEXT )
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxCOPY );
|
|
||||||
#else
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxXOR );
|
|
||||||
#endif
|
|
||||||
else if( draw_mode & GR_NXOR )
|
|
||||||
#if defined(__WXMAC__) && (wxMAC_USE_CORE_GRAPHICS || wxCHECK_VERSION( 2, 9, 0 ) )
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxXOR );
|
|
||||||
#elif defined( USE_WX_GRAPHICS_CONTEXT )
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxCOPY );
|
|
||||||
#else
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxEQUIV );
|
|
||||||
#endif
|
|
||||||
else if( draw_mode & GR_INVERT )
|
|
||||||
#if defined( USE_WX_GRAPHICS_CONTEXT )
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxCOPY );
|
|
||||||
#else
|
|
||||||
|
|
||||||
DC->SetLogicalFunction( wxINVERT );
|
|
||||||
#endif
|
|
||||||
else if( draw_mode & GR_COPY )
|
|
||||||
DC->SetLogicalFunction( wxCOPY );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, COLOR4D Color )
|
void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, COLOR4D Color )
|
||||||
{
|
{
|
||||||
if( ClipBox && !ClipBox->Contains( x, y ) )
|
if( ClipBox && !ClipBox->Contains( x, y ) )
|
||||||
|
@ -343,42 +292,16 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
||||||
if( aClipBox )
|
if( aClipBox )
|
||||||
aClipBox->Inflate( aWidth / 2 );
|
aClipBox->Inflate( aWidth / 2 );
|
||||||
|
|
||||||
#if defined( __WXMAC__ ) && defined( USE_WX_GRAPHICS_CONTEXT )
|
|
||||||
wxGCDC *gcdc = wxDynamicCast( aDC, wxGCDC );
|
|
||||||
if( gcdc )
|
|
||||||
{
|
|
||||||
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
|
|
||||||
|
|
||||||
// create path
|
|
||||||
wxGraphicsPath path = gc->CreatePath();
|
|
||||||
for( unsigned i = 0; i < aLines.size(); i += 2 )
|
for( unsigned i = 0; i < aLines.size(); i += 2 )
|
||||||
{
|
{
|
||||||
int x1 = aLines[i].x;
|
int x1 = aLines[i].x;
|
||||||
int y1 = aLines[i].y;
|
int y1 = aLines[i].y;
|
||||||
int x2 = aLines[i+1].x;
|
int x2 = aLines[i + 1].x;
|
||||||
int y2 = aLines[i+1].y;
|
int y2 = aLines[i + 1].y;
|
||||||
if( ( aClipBox == NULL ) || !ClipLine( aClipBox, x1, y1, x2, y2 ) )
|
|
||||||
{
|
|
||||||
path.MoveToPoint( x1, y1 );
|
|
||||||
path.AddLineToPoint( x2, y2 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// draw path
|
|
||||||
gc->StrokePath( path );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
for( unsigned i = 0; i < aLines.size(); i += 2 )
|
|
||||||
{
|
|
||||||
int x1 = aLines[i].x;
|
|
||||||
int y1 = aLines[i].y;
|
|
||||||
int x2 = aLines[i+1].x;
|
|
||||||
int y2 = aLines[i+1].y;
|
|
||||||
if( ( aClipBox == NULL ) || !ClipLine( aClipBox, x1, y1, x2, y2 ) )
|
if( ( aClipBox == NULL ) || !ClipLine( aClipBox, x1, y1, x2, y2 ) )
|
||||||
aDC->DrawLine( x1, y1, x2, y2 );
|
aDC->DrawLine( x1, y1, x2, y2 );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
GRMoveTo( aLines[aLines.size() - 1].x, aLines[aLines.size() - 1].y );
|
GRMoveTo( aLines[aLines.size() - 1].x, aLines[aLines.size() - 1].y );
|
||||||
|
|
||||||
if( aClipBox )
|
if( aClipBox )
|
||||||
|
@ -567,38 +490,13 @@ static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, wxPoint Points[],
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( __WXMAC__ ) && defined( USE_WX_GRAPHICS_CONTEXT )
|
|
||||||
wxGCDC *gcdc = wxDynamicCast( DC, wxGCDC );
|
|
||||||
if( gcdc )
|
|
||||||
{
|
|
||||||
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
|
|
||||||
|
|
||||||
// set pen
|
|
||||||
GRSetColorPen( DC, Color, width );
|
|
||||||
|
|
||||||
// create path
|
|
||||||
wxGraphicsPath path = gc->CreatePath();
|
|
||||||
path.MoveToPoint( Points[0].x, Points[0].y );
|
|
||||||
for( int i = 1; i < n; ++i )
|
|
||||||
{
|
|
||||||
path.AddLineToPoint( Points[i].x, Points[i].y );
|
|
||||||
}
|
|
||||||
// draw path
|
|
||||||
gc->StrokePath( path );
|
|
||||||
|
|
||||||
// correctly update last position
|
|
||||||
GRMoveTo( Points[n - 1].x, Points[n - 1].y );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GRMoveTo( Points[0].x, Points[0].y );
|
GRMoveTo( Points[0].x, Points[0].y );
|
||||||
for( int i = 1; i < n; ++i )
|
for( int i = 1; i < n; ++i )
|
||||||
{
|
{
|
||||||
GRLineTo( ClipBox, DC, Points[i].x, Points[i].y, width, Color );
|
GRLineTo( ClipBox, DC, Points[i].x, Points[i].y, width, Color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -624,33 +522,7 @@ static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined( __WXMAC__ ) && defined( USE_WX_GRAPHICS_CONTEXT )
|
|
||||||
wxGCDC *gcdc = wxDynamicCast( aDC, wxGCDC );
|
|
||||||
if( gcdc )
|
|
||||||
{
|
|
||||||
wxGraphicsContext *gc = gcdc->GetGraphicsContext();
|
|
||||||
|
|
||||||
// set pen
|
|
||||||
GRSetColorPen( aDC, aColor, aWidth );
|
|
||||||
|
|
||||||
// create path
|
|
||||||
wxGraphicsPath path = gc->CreatePath();
|
|
||||||
path.MoveToPoint( aPoints[0].x, aPoints[0].y );
|
|
||||||
for( int i = 1; i < aPointCount; ++i )
|
|
||||||
{
|
|
||||||
path.AddLineToPoint( aPoints[i].x, aPoints[i].y );
|
|
||||||
}
|
|
||||||
if( aPoints[aPointCount - 1] != aPoints[0] )
|
|
||||||
path.AddLineToPoint( aPoints[0].x, aPoints[0].y );
|
|
||||||
// draw path
|
|
||||||
gc->StrokePath( path );
|
|
||||||
|
|
||||||
// correctly update last position
|
|
||||||
GRMoveTo( aPoints[aPointCount - 1].x, aPoints[aPointCount - 1].y );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GRMoveTo( aPoints[0].x, aPoints[0].y );
|
GRMoveTo( aPoints[0].x, aPoints[0].y );
|
||||||
for( int i = 1; i < aPointCount; ++i )
|
for( int i = 1; i < aPointCount; ++i )
|
||||||
{
|
{
|
||||||
|
@ -665,7 +537,6 @@ static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC,
|
||||||
GRLineTo( aClipBox, aDC, aPoints[0].x, aPoints[0].y, aWidth, aColor );
|
GRLineTo( aClipBox, aDC, aPoints[0].x, aPoints[0].y, aWidth, aColor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
|
||||||
#endif
|
#endif
|
||||||
OffsetLogicalOrigin( xoffset, yoffset );
|
OffsetLogicalOrigin( xoffset, yoffset );
|
||||||
|
|
||||||
GRSetDrawMode( dc, GR_DEFAULT_DRAWMODE );
|
dc->SetLogicalFunction( wxCOPY );
|
||||||
GRResetPenAndBrush( dc );
|
GRResetPenAndBrush( dc );
|
||||||
|
|
||||||
aScreen->m_IsPrinting = true;
|
aScreen->m_IsPrinting = true;
|
||||||
|
@ -427,7 +427,6 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
|
||||||
COLOR4D bgColor = m_parent->GetDrawBgColor();
|
COLOR4D bgColor = m_parent->GetDrawBgColor();
|
||||||
m_parent->SetDrawBgColor( COLOR4D::WHITE );
|
m_parent->SetDrawBgColor( COLOR4D::WHITE );
|
||||||
|
|
||||||
GRSetDrawMode( dc, GR_COPY );
|
|
||||||
GRSFilledRect( nullptr, dc, fitRect.GetX(), fitRect.GetY(), fitRect.GetRight(),
|
GRSFilledRect( nullptr, dc, fitRect.GetX(), fitRect.GetY(), fitRect.GetRight(),
|
||||||
fitRect.GetBottom(), 0, COLOR4D::WHITE, COLOR4D::WHITE );
|
fitRect.GetBottom(), 0, COLOR4D::WHITE, COLOR4D::WHITE );
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,6 @@ class SCH_SHEET_PATH;
|
||||||
///< The default library pane width
|
///< The default library pane width
|
||||||
#define DEFAULTLIBWIDTH 250
|
#define DEFAULTLIBWIDTH 250
|
||||||
|
|
||||||
#define GR_DEFAULT_DRAWMODE GR_COPY
|
|
||||||
|
|
||||||
/* Rotation, mirror of graphic items in components bodies are handled by a
|
/* Rotation, mirror of graphic items in components bodies are handled by a
|
||||||
* transform matrix. The default matrix is useful to draw lib entries with
|
* transform matrix. The default matrix is useful to draw lib entries with
|
||||||
* using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and
|
* using this default matrix ( no rotation, no mirror but Y axis is bottom to top, and
|
||||||
|
|
|
@ -932,7 +932,7 @@ void SCH_EDIT_FRAME::PrintPage( wxDC* aDC )
|
||||||
{
|
{
|
||||||
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
|
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
|
||||||
|
|
||||||
GRSetDrawMode( aDC, GR_DEFAULT_DRAWMODE );
|
aDC->SetLogicalFunction( wxCOPY );
|
||||||
GetScreen()->Print( aDC );
|
GetScreen()->Print( aDC );
|
||||||
PrintWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
|
PrintWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,6 @@ typedef enum {
|
||||||
} GRLineStypeType;
|
} GRLineStypeType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void GRSetDrawMode( wxDC* DC, GR_DRAWMODE mode );
|
|
||||||
GR_DRAWMODE GRGetDrawMode( wxDC* DC );
|
|
||||||
void GRResetPenAndBrush( wxDC* DC );
|
void GRResetPenAndBrush( wxDC* DC );
|
||||||
void GRSetColorPen( wxDC* DC, COLOR4D Color, int width = 1, wxPenStyle stype = wxPENSTYLE_SOLID );
|
void GRSetColorPen( wxDC* DC, COLOR4D Color, int width = 1, wxPenStyle stype = wxPENSTYLE_SOLID );
|
||||||
void GRSetBrush( wxDC* DC, COLOR4D Color, bool fill = false );
|
void GRSetBrush( wxDC* DC, COLOR4D Color, bool fill = false );
|
||||||
|
|
Loading…
Reference in New Issue