mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Retire non-cairo printing.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19323
This commit is contained in:
parent
f9c41d70d1
commit
f2da0c791f
@ -103,8 +103,6 @@ static const wxChar EnableGenerators[] = wxT( "EnableGenerators" );
|
||||
static const wxChar EnableGit[] = wxT( "EnableGit" );
|
||||
static const wxChar EnableLibWithText[] = wxT( "EnableLibWithText" );
|
||||
static const wxChar EnableLibDir[] = wxT( "EnableLibDir" );
|
||||
static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
|
||||
static const wxChar EnableEeschemaExportClipboardCairo[] = wxT( "EnableEeschemaExportClipboardCairo" );
|
||||
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
|
||||
static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
|
||||
static const wxChar FontErrorSize[] = wxT( "FontErrorSize" );
|
||||
@ -262,9 +260,6 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
m_EnableLibWithText = false;
|
||||
m_EnableLibDir = false;
|
||||
|
||||
m_EnableEeschemaPrintCairo = true;
|
||||
m_EnableEeschemaExportClipboardCairo = true;
|
||||
|
||||
m_3DRT_BevelHeight_um = 30;
|
||||
m_3DRT_BevelExtentFactor = 1.0 / 16.0;
|
||||
|
||||
@ -508,14 +503,6 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableLibDir,
|
||||
&m_EnableLibDir, m_EnableLibDir ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaPrintCairo,
|
||||
&m_EnableEeschemaPrintCairo,
|
||||
m_EnableEeschemaPrintCairo ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableEeschemaExportClipboardCairo,
|
||||
&m_EnableEeschemaExportClipboardCairo,
|
||||
m_EnableEeschemaExportClipboardCairo ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::PcbSelectionVisibilityRatio,
|
||||
&m_PcbSelectionVisibilityRatio,
|
||||
m_PcbSelectionVisibilityRatio, 0.0, 1.0 ) );
|
||||
|
@ -438,12 +438,6 @@ void EDA_DRAW_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
DisplayErrorMessage( this, wxT( "EDA_DRAW_FRAME::PrintPage() error" ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
||||
{
|
||||
wxCHECK_RET( m_gridSelectBox, wxS( "m_gridSelectBox uninitialized" ) );
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "marker_base.h"
|
||||
#include <core/arraydim.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <render_settings.h>
|
||||
#include "dialogs/dialog_display_html_text_base.h"
|
||||
|
||||
|
||||
@ -85,11 +84,6 @@ MARKER_BASE::MARKER_BASE( int aScalingFactor, std::shared_ptr<RC_ITEM> aItem, MA
|
||||
}
|
||||
|
||||
|
||||
MARKER_BASE::~MARKER_BASE()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool MARKER_BASE::HitTestMarker( const VECTOR2I& aHitPosition, int aAccuracy ) const
|
||||
{
|
||||
const BOX2I bbox = GetBoundingBoxMarker().GetInflated( aAccuracy );
|
||||
@ -144,16 +138,3 @@ BOX2I MARKER_BASE::GetBoundingBoxMarker() const
|
||||
}
|
||||
|
||||
|
||||
void MARKER_BASE::PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
|
||||
// Build the marker shape polygon in internal units:
|
||||
std::vector<VECTOR2I> shape;
|
||||
shape.reserve( CORNERS_COUNT );
|
||||
|
||||
for( const VECTOR2I& corner : MarkerShapeCorners )
|
||||
shape.emplace_back( corner * MarkerScale() + m_Pos + aOffset );
|
||||
|
||||
GRClosedPoly( DC, CORNERS_COUNT, &shape[0], true, getColor() );
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <widgets/grid_icon_text_helpers.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <wx/hyperlink.h>
|
||||
#include <symbol_preview_widget.h>
|
||||
|
||||
class ALT_PIN_DATA_MODEL : public wxGridTableBase, public std::vector<SCH_PIN::ALT>
|
||||
{
|
||||
@ -137,22 +138,41 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN
|
||||
m_delayedFocusColumn( -1 ),
|
||||
m_initialized( false )
|
||||
{
|
||||
// Creates a dummy pin to show on a panel, inside this dialog:
|
||||
// Create a dummy symbol with a single pin for the preview widget:
|
||||
m_dummyParent = new LIB_SYMBOL( *static_cast<LIB_SYMBOL*>( m_pin->GetParentSymbol() ) );
|
||||
|
||||
// Move everything in the copied symbol to unit 1; we'll use unit 2 for the dummy pin:
|
||||
m_dummyParent->SetUnitCount( 2, false );
|
||||
m_dummyParent->RunOnChildren( [&]( SCH_ITEM* child )
|
||||
{
|
||||
child->SetUnit( 1 );
|
||||
} );
|
||||
|
||||
m_dummyPin = new SCH_PIN( *m_pin );
|
||||
m_dummyPin->SetParent( m_dummyParent );
|
||||
m_dummyPin->SetUnit( 2 );
|
||||
m_dummyParent->AddDrawItem( m_dummyPin, false );
|
||||
|
||||
m_dummyParent->SetShowPinNames( true );
|
||||
m_dummyParent->SetShowPinNumbers( true );
|
||||
|
||||
COLOR4D bgColor = parent->GetRenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
m_panelShowPin->SetBackgroundColour( bgColor.ToColour() );
|
||||
m_previewWidget = new SYMBOL_PREVIEW_WIDGET( m_panelShowPin, &m_frame->Kiway(), false,
|
||||
m_frame->GetCanvas()->GetBackend() );
|
||||
|
||||
const wxArrayString& orientationNames = PinOrientationNames();
|
||||
m_previewWidget->SetLayoutDirection( wxLayout_LeftToRight );
|
||||
m_previewWidget->DisplayPart( m_dummyParent, m_dummyPin->GetUnit(), 0 );
|
||||
|
||||
wxBoxSizer* previewSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
previewSizer->Add( m_previewWidget, 1, wxEXPAND, 5 );
|
||||
m_panelShowPin->SetSizer( previewSizer );
|
||||
|
||||
const wxArrayString& orientationNames = PinOrientationNames();
|
||||
const std::vector<BITMAPS>& orientationIcons = PinOrientationIcons();
|
||||
|
||||
for ( unsigned ii = 0; ii < orientationNames.GetCount(); ii++ )
|
||||
{
|
||||
m_choiceOrientation->Insert( orientationNames[ii], KiBitmapBundle( orientationIcons[ii] ),
|
||||
ii );
|
||||
}
|
||||
|
||||
// We can't set the tab order through wxWidgets due to shortcomings in their mnemonics
|
||||
// implementation on MSW
|
||||
@ -242,7 +262,6 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN
|
||||
|
||||
DIALOG_PIN_PROPERTIES::~DIALOG_PIN_PROPERTIES()
|
||||
{
|
||||
delete m_dummyPin;
|
||||
delete m_dummyParent;
|
||||
|
||||
// Prevents crash bug in wxGrid's d'tor
|
||||
@ -379,44 +398,6 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
|
||||
{
|
||||
wxPaintDC dc( m_panelShowPin );
|
||||
wxSize dc_size = dc.GetSize();
|
||||
dc.SetDeviceOrigin( dc_size.x / 2, dc_size.y / 2 );
|
||||
|
||||
// Give a parent to m_dummyPin for draw purposes.
|
||||
// In fact m_dummyPin should not have a parent, but draw functions need a parent
|
||||
// to know some options, about pin texts
|
||||
SYMBOL_EDIT_FRAME* symbolEditor = (SYMBOL_EDIT_FRAME*) GetParent();
|
||||
|
||||
// Calculate a suitable scale to fit the available draw area
|
||||
BOX2I bBox = m_dummyPin->GetBoundingBox( true, true, false );
|
||||
bBox.Inflate( schIUScale.MilsToIU( DANGLING_SYMBOL_SIZE ) );
|
||||
|
||||
double xscale = (double) dc_size.x / bBox.GetWidth();
|
||||
double yscale = (double) dc_size.y / bBox.GetHeight();
|
||||
double scale = std::min( xscale, yscale );
|
||||
|
||||
// Give a 7% margin (each side) and limit to no more than 100% zoom
|
||||
scale = std::min( scale * 0.85, 1.0 );
|
||||
dc.SetUserScale( scale, scale );
|
||||
GRResetPenAndBrush( &dc );
|
||||
|
||||
SCH_RENDER_SETTINGS renderSettings( *symbolEditor->GetRenderSettings() );
|
||||
renderSettings.m_ShowPinNumbers = true;
|
||||
renderSettings.m_ShowPinNames = true;
|
||||
renderSettings.m_ShowHiddenFields = true;
|
||||
renderSettings.m_ShowConnectionPoints = true;
|
||||
renderSettings.m_Transform = TRANSFORM();
|
||||
renderSettings.SetPrintDC( &dc );
|
||||
|
||||
m_dummyPin->Print( &renderSettings, 0, 0, -bBox.Centre(), false, false );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PIN_PROPERTIES::OnPropertiesChange( wxCommandEvent& event )
|
||||
{
|
||||
if( !IsShownOnScreen() ) // do nothing at init time
|
||||
@ -435,7 +416,7 @@ void DIALOG_PIN_PROPERTIES::OnPropertiesChange( wxCommandEvent& event )
|
||||
if( event.GetEventObject() == m_checkApplyToAllParts && m_frame->m_SyncPinEdit )
|
||||
m_infoBar->ShowMessage( getSyncPinsMessage() );
|
||||
|
||||
m_panelShowPin->Refresh();
|
||||
m_previewWidget->DisplayPart( m_dummyParent, m_dummyPin->GetUnit(), 0 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@ enum COL_ORDER
|
||||
|
||||
|
||||
class ALT_PIN_DATA_MODEL;
|
||||
class SYMBOL_PREVIEW_WIDGET;
|
||||
|
||||
|
||||
class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE
|
||||
@ -59,10 +60,6 @@ public:
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
/**
|
||||
* Draw (on m_panelShowPin) the pin according to current settings in dialog.
|
||||
*/
|
||||
void OnPaintShowPanel( wxPaintEvent& event ) override;
|
||||
void OnPropertiesChange( wxCommandEvent& event ) override;
|
||||
void OnAddAlternate( wxCommandEvent& event ) override;
|
||||
void OnDeleteAlternate( wxCommandEvent& event ) override;
|
||||
@ -75,29 +72,30 @@ protected:
|
||||
wxString getSyncPinsMessage();
|
||||
|
||||
private:
|
||||
SYMBOL_EDIT_FRAME* m_frame;
|
||||
SCH_PIN* m_pin;
|
||||
SYMBOL_EDIT_FRAME* m_frame;
|
||||
SCH_PIN* m_pin;
|
||||
|
||||
LIB_SYMBOL* m_dummyParent;
|
||||
SCH_PIN* m_dummyPin; // a working copy used to show changes
|
||||
LIB_SYMBOL* m_dummyParent;
|
||||
SCH_PIN* m_dummyPin; // a working copy used to show changes
|
||||
SYMBOL_PREVIEW_WIDGET* m_previewWidget;
|
||||
|
||||
UNIT_BINDER m_posX;
|
||||
UNIT_BINDER m_posY;
|
||||
UNIT_BINDER m_pinLength;
|
||||
UNIT_BINDER m_nameSize;
|
||||
UNIT_BINDER m_numberSize;
|
||||
UNIT_BINDER m_posX;
|
||||
UNIT_BINDER m_posY;
|
||||
UNIT_BINDER m_pinLength;
|
||||
UNIT_BINDER m_nameSize;
|
||||
UNIT_BINDER m_numberSize;
|
||||
|
||||
VECTOR2I m_origPos;
|
||||
VECTOR2I m_origPos;
|
||||
|
||||
ALT_PIN_DATA_MODEL* m_alternatesDataModel;
|
||||
ALT_PIN_DATA_MODEL* m_alternatesDataModel;
|
||||
|
||||
int m_delayedFocusRow;
|
||||
int m_delayedFocusColumn;
|
||||
int m_delayedFocusRow;
|
||||
int m_delayedFocusColumn;
|
||||
|
||||
std::map<int, int> m_originalColWidths; // map col-number : orig-col-width
|
||||
wxSize m_size;
|
||||
bool m_initialized;
|
||||
inline static bool s_alternatesTurndownOpen = false;
|
||||
std::map<int, int> m_originalColWidths; // map col-number : orig-col-width
|
||||
wxSize m_size;
|
||||
bool m_initialized;
|
||||
inline static bool s_alternatesTurndownOpen = false;
|
||||
};
|
||||
|
||||
#endif // DIALOG_PIN_PROPERTIES_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@ -285,7 +285,6 @@ DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWind
|
||||
m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllBodyStyles->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_panelShowPin->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||
m_alternatesTurndown->Connect( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnCollapsiblePaneChange ), NULL, this );
|
||||
m_addAlternate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnAddAlternate ), NULL, this );
|
||||
m_deleteAlternate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnDeleteAlternate ), NULL, this );
|
||||
@ -307,7 +306,6 @@ DIALOG_PIN_PROPERTIES_BASE::~DIALOG_PIN_PROPERTIES_BASE()
|
||||
m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkApplyToAllBodyStyles->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
|
||||
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
|
||||
m_alternatesTurndown->Disconnect( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnCollapsiblePaneChange ), NULL, this );
|
||||
m_addAlternate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnAddAlternate ), NULL, this );
|
||||
m_deleteAlternate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnDeleteAlternate ), NULL, this );
|
||||
|
@ -1,34 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="17"/>
|
||||
<FileVersion major="1" minor="18"/>
|
||||
<object class="Project" expanded="true">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="cpp_class_decoration"></property>
|
||||
<property name="cpp_disconnect_events">1</property>
|
||||
<property name="cpp_event_generation">connect</property>
|
||||
<property name="cpp_help_provider">none</property>
|
||||
<property name="cpp_namespace"></property>
|
||||
<property name="cpp_precompiled_header"></property>
|
||||
<property name="cpp_use_array_enum">0</property>
|
||||
<property name="cpp_use_enum">1</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_pin_properties_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="lua_skip_events">1</property>
|
||||
<property name="lua_ui_table">UI</property>
|
||||
<property name="name">dialog_pin_properties</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="php_disconnect_events">0</property>
|
||||
<property name="php_disconnect_mode">source_name</property>
|
||||
<property name="php_skip_events">1</property>
|
||||
<property name="python_disconnect_events">0</property>
|
||||
<property name="python_disconnect_mode">source_name</property>
|
||||
<property name="python_image_path_wrapper_function_name"></property>
|
||||
<property name="python_indent_with_spaces"></property>
|
||||
<property name="python_skip_events">1</property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<property name="use_native_eol">0</property>
|
||||
<object class="Dialog" expanded="true">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
@ -73,10 +75,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -170,10 +172,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -235,10 +237,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -304,10 +306,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -369,10 +371,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -438,10 +440,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -503,10 +505,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -571,10 +573,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -636,10 +638,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -704,10 +706,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -769,10 +771,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -838,10 +840,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -903,10 +905,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -972,10 +974,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1037,10 +1039,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1106,10 +1108,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1171,10 +1173,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1241,10 +1243,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1306,10 +1308,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1376,10 +1378,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1441,10 +1443,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1511,10 +1513,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1576,10 +1578,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1641,10 +1643,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1706,10 +1708,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1771,10 +1773,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1855,10 +1857,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1921,10 +1923,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -1997,10 +1999,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -2065,10 +2067,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -2127,10 +2129,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -2174,7 +2176,6 @@
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxBORDER_SIMPLE|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL</property>
|
||||
<event name="OnPaint">OnPaintShowPanel</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
@ -2199,10 +2200,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
@ -2277,10 +2278,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="autosize_cols">0</property>
|
||||
<property name="autosize_rows">0</property>
|
||||
<property name="best_size"></property>
|
||||
@ -2377,10 +2378,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
@ -2462,10 +2463,10 @@
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@ -93,7 +93,6 @@ class DIALOG_PIN_PROPERTIES_BASE : public DIALOG_SHIM
|
||||
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
|
||||
virtual void OnCollapsiblePaneChange( wxCollapsiblePaneEvent& event ) { event.Skip(); }
|
||||
virtual void OnAddAlternate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnDeleteAlternate( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
@ -598,100 +598,6 @@ bool LIB_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
|
||||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
for( SCH_ITEM& item : m_drawings )
|
||||
{
|
||||
// Do not print private items
|
||||
if( item.IsPrivate() )
|
||||
continue;
|
||||
|
||||
// Do not draw items not attached to the current part
|
||||
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
|
||||
continue;
|
||||
|
||||
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
|
||||
continue;
|
||||
|
||||
if( item.Type() == SCH_PIN_T )
|
||||
{
|
||||
item.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
}
|
||||
else if( item.Type() == SCH_FIELD_T )
|
||||
{
|
||||
SCH_FIELD& field = static_cast<SCH_FIELD&>( item );
|
||||
|
||||
if( ( field.IsVisible() && aSettings->m_ShowVisibleFields )
|
||||
|| ( !field.IsVisible() && aSettings->m_ShowHiddenFields ) )
|
||||
{
|
||||
item.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
}
|
||||
}
|
||||
else if( item.Type() == SCH_SHAPE_T )
|
||||
{
|
||||
SCH_SHAPE& shape = static_cast<SCH_SHAPE&>( item );
|
||||
|
||||
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
aForceNoFill = true;
|
||||
|
||||
// Ensure the color of shape is from LAYER_DEVICE if not specified.
|
||||
COLOR4D init_color = shape.GetStroke().GetColor();
|
||||
STROKE_PARAMS prms = shape.GetStroke();
|
||||
|
||||
if( init_color == COLOR4D::UNSPECIFIED )
|
||||
{
|
||||
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||
prms.SetColor( color );
|
||||
shape.SetStroke( prms );
|
||||
}
|
||||
|
||||
shape.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
prms.SetColor( init_color );
|
||||
shape.SetStroke( prms );
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed )
|
||||
{
|
||||
/* draw background for filled items using background option
|
||||
* Solid lines will be drawn after the background
|
||||
* Note also, background is not drawn when printing in black and white
|
||||
*/
|
||||
if( !GetGRForceBlackPenState() )
|
||||
{
|
||||
for( SCH_ITEM& item : m_drawings )
|
||||
{
|
||||
// Do not print private items
|
||||
if( item.IsPrivate() )
|
||||
continue;
|
||||
|
||||
if( item.Type() == SCH_SHAPE_T )
|
||||
{
|
||||
SCH_SHAPE& shape = static_cast<SCH_SHAPE&>( item );
|
||||
|
||||
// Do not draw items not attached to the current part
|
||||
if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
|
||||
continue;
|
||||
|
||||
if( aBodyStyle && shape.m_bodyStyle && ( shape.m_bodyStyle != aBodyStyle ) )
|
||||
continue;
|
||||
|
||||
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
shape.Print( aSettings, aUnit, aBodyStyle, aOffset, false, aDimmed );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_SYMBOL::Plot( PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed )
|
||||
{
|
||||
|
@ -391,12 +391,6 @@ public:
|
||||
*/
|
||||
bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -95,7 +95,6 @@ DIALOG_PRINT::DIALOG_PRINT( SCH_EDIT_FRAME* aParent ) :
|
||||
m_parent( aParent )
|
||||
{
|
||||
wxASSERT( aParent );
|
||||
m_useCairo = ADVANCED_CFG::GetCfg().m_EnableEeschemaPrintCairo;
|
||||
|
||||
// Show m_panelPrinters only if there are printers to list:
|
||||
m_panelPrinters->Show( m_panelPrinters->AsPrintersAvailable() );
|
||||
@ -111,8 +110,7 @@ DIALOG_PRINT::DIALOG_PRINT( SCH_EDIT_FRAME* aParent ) :
|
||||
#if defined(__WXGTK__)
|
||||
// Preview using Cairo does not work on GTK,
|
||||
// but this platform provide native print preview
|
||||
if( m_useCairo )
|
||||
m_sdbSizerApply->Hide();
|
||||
m_sdbSizerApply->Hide();
|
||||
#endif
|
||||
|
||||
m_sdbSizerOK->SetFocus();
|
||||
@ -258,9 +256,8 @@ void DIALOG_PRINT::OnPrintPreview( wxCommandEvent& event )
|
||||
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxString title = _( "Preview" );
|
||||
wxPrintPreview* preview = new wxPrintPreview( new SCH_PRINTOUT( m_parent, title, m_useCairo ),
|
||||
new SCH_PRINTOUT( m_parent, title, m_useCairo ),
|
||||
&prn_data );
|
||||
wxPrintPreview* preview = new wxPrintPreview( new SCH_PRINTOUT( m_parent, title ),
|
||||
new SCH_PRINTOUT( m_parent, title ), &prn_data );
|
||||
|
||||
preview->SetZoom( 100 );
|
||||
|
||||
@ -378,7 +375,7 @@ bool DIALOG_PRINT::TransferDataFromWindow()
|
||||
printDialogData.EnablePageNumbers( true );
|
||||
|
||||
wxPrinter printer( &printDialogData );
|
||||
SCH_PRINTOUT printout( m_parent, _( "Print Schematic" ), m_useCairo );
|
||||
SCH_PRINTOUT printout( m_parent, _( "Print Schematic" ) );
|
||||
|
||||
Pgm().m_Printing = true;
|
||||
{
|
||||
|
@ -47,7 +47,6 @@ private:
|
||||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
bool m_useCairo;
|
||||
};
|
||||
|
||||
|
||||
|
@ -41,12 +41,11 @@
|
||||
#include <wx/log.h>
|
||||
|
||||
|
||||
SCH_PRINTOUT::SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle, bool aUseCairo ) :
|
||||
SCH_PRINTOUT::SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle ) :
|
||||
wxPrintout( aTitle )
|
||||
{
|
||||
wxASSERT( aParent != nullptr );
|
||||
m_parent = aParent;
|
||||
m_useCairo = aUseCairo;
|
||||
m_view = nullptr;
|
||||
}
|
||||
|
||||
@ -126,325 +125,167 @@ int SCH_PRINTOUT::milsToIU( int aMils )
|
||||
bool SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting )
|
||||
{
|
||||
// Note: some data (like paper size) is available only when printing
|
||||
wxDC* dc = aDC;
|
||||
m_view = m_parent->GetCanvas()->GetView();
|
||||
KIGFX::GAL_DISPLAY_OPTIONS options;
|
||||
options.cairo_antialiasing_mode = KIGFX::CAIRO_ANTIALIASING_MODE::GOOD;
|
||||
std::unique_ptr<KIGFX::GAL_PRINT> galPrint = KIGFX::GAL_PRINT::Create( options, dc );
|
||||
KIGFX::GAL* gal = galPrint->GetGAL();
|
||||
KIGFX::PRINT_CONTEXT* printCtx = galPrint->GetPrintCtx();
|
||||
std::unique_ptr<KIGFX::SCH_PAINTER> painter = std::make_unique<KIGFX::SCH_PAINTER>( gal );
|
||||
std::unique_ptr<KIGFX::VIEW> view( m_view->DataReference() );
|
||||
|
||||
if( !m_useCairo )
|
||||
painter->SetSchematic( &m_parent->Schematic() );
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
|
||||
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
|
||||
EE_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
|
||||
|
||||
// Target paper size
|
||||
wxRect pageSizePix;
|
||||
wxSize dcPPI = dc->GetPPI();
|
||||
|
||||
if( aForPrinting )
|
||||
pageSizePix = GetLogicalPageRect();
|
||||
else
|
||||
{
|
||||
// Version using print to a wxDC
|
||||
// Warning:
|
||||
// When printing many pages, changes in the current wxDC will affect all next printings
|
||||
// because all prints are using the same wxPrinterDC after creation
|
||||
// So be careful and reinit parameters, especially when using offsets.
|
||||
dc->SetUserScale( 1, 1 );
|
||||
|
||||
VECTOR2I tmp_startvisu;
|
||||
wxSize pageSizeIU; // Page size in internal units
|
||||
VECTOR2I old_org;
|
||||
wxRect fitRect;
|
||||
wxDC* dc = aDC;
|
||||
|
||||
wxBusyCursor dummy;
|
||||
|
||||
// Save current offsets and clip box.
|
||||
tmp_startvisu = aScreen->m_StartVisu;
|
||||
old_org = aScreen->m_DrawOrg;
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
|
||||
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
|
||||
|
||||
// Change scale factor and offset to print the whole page.
|
||||
bool printDrawingSheet = cfg->m_Printing.title_block;
|
||||
|
||||
pageSizeIU = ToWxSize( aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS ) );
|
||||
FitThisSizeToPaper( pageSizeIU );
|
||||
|
||||
if( aForPrinting )
|
||||
fitRect = GetLogicalPaperRect();
|
||||
else
|
||||
if( wxMemoryDC* memdc = dynamic_cast<wxMemoryDC*>( dc ) )
|
||||
{
|
||||
fitRect = wxRect( 0, 0, 6000, 4000 );
|
||||
|
||||
if( wxMemoryDC* memdc = dynamic_cast<wxMemoryDC*>( dc ) )
|
||||
{
|
||||
wxBitmap& bm = memdc->GetSelectedBitmap();
|
||||
fitRect = wxRect( 0, 0, bm.GetWidth(), bm.GetHeight() );
|
||||
|
||||
// If the dc is a memory dc (should be the case when not printing on a printer,
|
||||
// i.e. when printing on the clipboard), calculate a suitable dc user scale
|
||||
double dc_scale;
|
||||
double ppi = 300; // Use 300 pixels per inch to create bitmap images on start
|
||||
double inch2Iu = 1000.0 * schIUScale.IU_PER_MILS;
|
||||
dc_scale = ppi / inch2Iu;
|
||||
dc->SetUserScale( dc_scale, dc_scale );
|
||||
}
|
||||
}
|
||||
|
||||
// When is the actual paper size does not match the schematic page size, the drawing will
|
||||
// not be centered on X or Y axis. Give a draw offset to center the schematic page on the
|
||||
// paper draw area.
|
||||
int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
|
||||
int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
|
||||
|
||||
// Using a wxAffineMatrix2D has a big advantage: it handles different pages orientations
|
||||
//(PORTRAIT/LANDSCAPE), but the affine matrix is not always supported
|
||||
if( dc->CanUseTransformMatrix() && aForPrinting )
|
||||
{
|
||||
wxAffineMatrix2D matrix; // starts from a unity matrix (the current wxDC default)
|
||||
|
||||
// Check for portrait/landscape mismatch:
|
||||
if( ( fitRect.width > fitRect.height ) != ( pageSizeIU.x > pageSizeIU.y ) )
|
||||
{
|
||||
// Rotate the coordinates, and keep the draw coordinates inside the page
|
||||
matrix.Rotate( M_PI_2 );
|
||||
matrix.Translate( 0, -pageSizeIU.y );
|
||||
|
||||
// Recalculate the offsets and page sizes according to the page rotation
|
||||
std::swap( pageSizeIU.x, pageSizeIU.y );
|
||||
FitThisSizeToPaper( pageSizeIU );
|
||||
fitRect = GetLogicalPaperRect();
|
||||
|
||||
xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
|
||||
yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
|
||||
|
||||
// All the coordinates will be rotated 90 deg when printing,
|
||||
// so the X,Y offset vector must be rotated -90 deg before printing
|
||||
std::swap( xoffset, yoffset );
|
||||
std::swap( fitRect.width, fitRect.height );
|
||||
yoffset = -yoffset;
|
||||
}
|
||||
|
||||
matrix.Translate( xoffset, yoffset );
|
||||
dc->SetTransformMatrix( matrix );
|
||||
|
||||
fitRect.x -= xoffset;
|
||||
fitRect.y -= yoffset;
|
||||
}
|
||||
else if( aForPrinting )
|
||||
{
|
||||
SetLogicalOrigin( 0, 0 ); // Reset all offset settings made previously.
|
||||
// When printing previous pages (all prints are using the same wxDC)
|
||||
OffsetLogicalOrigin( xoffset, yoffset );
|
||||
}
|
||||
|
||||
dc->SetLogicalFunction( wxCOPY );
|
||||
GRResetPenAndBrush( dc );
|
||||
|
||||
COLOR4D savedBgColor = m_parent->GetDrawBgColor();
|
||||
COLOR4D bgColor = m_parent->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
if( cfg->m_Printing.background )
|
||||
{
|
||||
if( cfg->m_Printing.use_theme && theme )
|
||||
bgColor = theme->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
wxBitmap& bm = memdc->GetSelectedBitmap();
|
||||
pageSizePix = wxRect( 0, 0, bm.GetWidth(), bm.GetHeight() );
|
||||
}
|
||||
else
|
||||
{
|
||||
bgColor = COLOR4D::WHITE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_parent->SetDrawBgColor( bgColor );
|
||||
const VECTOR2D pageSizeIn( (double) pageSizePix.width / dcPPI.x,
|
||||
(double) pageSizePix.height / dcPPI.y );
|
||||
const VECTOR2D pageSizeIU( milsToIU( pageSizeIn.x * 1000 ), milsToIU( pageSizeIn.y * 1000 ) );
|
||||
|
||||
GRSFilledRect( dc, fitRect.GetX(), fitRect.GetY(), fitRect.GetRight(), fitRect.GetBottom(), 0,
|
||||
bgColor, bgColor );
|
||||
galPrint->SetSheetSize( pageSizeIn );
|
||||
|
||||
if( cfg->m_Printing.monochrome )
|
||||
GRForceBlackPen( true );
|
||||
view->SetGAL( gal );
|
||||
view->SetPainter( painter.get() );
|
||||
view->SetScaleLimits( ZOOM_MAX_LIMIT_EESCHEMA, ZOOM_MIN_LIMIT_EESCHEMA );
|
||||
view->SetScale( 1.0 );
|
||||
gal->SetWorldUnitLength( SCH_WORLD_UNIT );
|
||||
|
||||
SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() );
|
||||
renderSettings.SetPrintDC( dc );
|
||||
// Init the SCH_RENDER_SETTINGS used by the painter used to print schematic
|
||||
SCH_RENDER_SETTINGS* dstSettings = painter->GetSettings();
|
||||
|
||||
dstSettings->m_ShowPinsElectricalType = false;
|
||||
|
||||
// Set the color scheme
|
||||
dstSettings->LoadColors( m_parent->GetColorSettings( false ) );
|
||||
|
||||
if( cfg->m_Printing.use_theme && theme )
|
||||
dstSettings->LoadColors( theme );
|
||||
|
||||
bool printDrawingSheet = cfg->m_Printing.title_block;
|
||||
|
||||
COLOR4D bgColor = m_parent->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
if( cfg->m_Printing.background )
|
||||
{
|
||||
if( cfg->m_Printing.use_theme && theme )
|
||||
renderSettings.LoadColors( theme );
|
||||
|
||||
renderSettings.SetBackgroundColor( bgColor );
|
||||
|
||||
// The drawing-sheet-item print code is shared between PCBNew and Eeschema, so it's easier
|
||||
// if they just use the PCB layer.
|
||||
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET,
|
||||
renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );
|
||||
|
||||
renderSettings.SetDefaultFont( cfg->m_Appearance.default_font );
|
||||
|
||||
if( printDrawingSheet )
|
||||
{
|
||||
m_parent->PrintDrawingSheet( &renderSettings, aScreen, aScreen->Schematic()->GetProperties(),
|
||||
schIUScale.IU_PER_MILS, aScreen->GetFileName(), wxEmptyString );
|
||||
}
|
||||
|
||||
renderSettings.SetIsPrinting( true );
|
||||
|
||||
aScreen->Print( &renderSettings );
|
||||
|
||||
m_parent->SetDrawBgColor( savedBgColor );
|
||||
|
||||
GRForceBlackPen( false );
|
||||
|
||||
aScreen->m_StartVisu = tmp_startvisu;
|
||||
aScreen->m_DrawOrg = old_org;
|
||||
bgColor = theme->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxDC* dc = aDC;
|
||||
m_view = m_parent->GetCanvas()->GetView();
|
||||
KIGFX::GAL_DISPLAY_OPTIONS options;
|
||||
options.cairo_antialiasing_mode = KIGFX::CAIRO_ANTIALIASING_MODE::GOOD;
|
||||
std::unique_ptr<KIGFX::GAL_PRINT> galPrint = KIGFX::GAL_PRINT::Create( options, dc );
|
||||
KIGFX::GAL* gal = galPrint->GetGAL();
|
||||
KIGFX::PRINT_CONTEXT* printCtx = galPrint->GetPrintCtx();
|
||||
std::unique_ptr<KIGFX::SCH_PAINTER> painter = std::make_unique<KIGFX::SCH_PAINTER>( gal );
|
||||
std::unique_ptr<KIGFX::VIEW> view( m_view->DataReference() );
|
||||
bgColor = COLOR4D::WHITE;
|
||||
}
|
||||
|
||||
painter->SetSchematic( &m_parent->Schematic() );
|
||||
dstSettings->SetBackgroundColor( bgColor );
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
|
||||
COLOR_SETTINGS* theme = mgr.GetColorSettings( cfg->m_Printing.color_theme );
|
||||
EE_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<EE_SELECTION_TOOL>();
|
||||
// The drawing-sheet-item print code is shared between PCBNew and Eeschema, so it's easier
|
||||
// if they just use the PCB layer.
|
||||
dstSettings->SetLayerColor( LAYER_DRAWINGSHEET,
|
||||
dstSettings->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );
|
||||
|
||||
// Target paper size
|
||||
wxRect pageSizePix;
|
||||
wxSize dcPPI = dc->GetPPI();
|
||||
dstSettings->SetDefaultFont( cfg->m_Appearance.default_font );
|
||||
|
||||
if( aForPrinting )
|
||||
pageSizePix = GetLogicalPageRect();
|
||||
else
|
||||
if( cfg->m_Printing.monochrome )
|
||||
{
|
||||
for( int i = 0; i < LAYER_ID_COUNT; ++i )
|
||||
dstSettings->SetLayerColor( i, COLOR4D::BLACK );
|
||||
|
||||
// In B&W mode, draw the background only in white, because any other color
|
||||
// will be replaced by a black background
|
||||
dstSettings->SetBackgroundColor( COLOR4D::WHITE );
|
||||
dstSettings->m_OverrideItemColors = true;
|
||||
|
||||
// Disable print some backgrounds
|
||||
dstSettings->SetPrintBlackAndWhite( true );
|
||||
}
|
||||
else // color enabled
|
||||
{
|
||||
for( int i = 0; i < LAYER_ID_COUNT; ++i )
|
||||
{
|
||||
dc->SetUserScale( 1, 1 );
|
||||
|
||||
if( wxMemoryDC* memdc = dynamic_cast<wxMemoryDC*>( dc ) )
|
||||
{
|
||||
wxBitmap& bm = memdc->GetSelectedBitmap();
|
||||
pageSizePix = wxRect( 0, 0, bm.GetWidth(), bm.GetHeight() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Cairo does not support translucent colors on PostScript surfaces
|
||||
// see 'Features support by the PostScript surface' on
|
||||
// https://www.cairographics.org/documentation/using_the_postscript_surface/
|
||||
dstSettings->SetLayerColor( i, dstSettings->GetLayerColor( i ).WithAlpha( 1.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
const VECTOR2D pageSizeIn( (double) pageSizePix.width / dcPPI.x,
|
||||
(double) pageSizePix.height / dcPPI.y );
|
||||
const VECTOR2D pageSizeIU( milsToIU( pageSizeIn.x * 1000 ), milsToIU( pageSizeIn.y * 1000 ) );
|
||||
dstSettings->SetIsPrinting( true );
|
||||
|
||||
galPrint->SetSheetSize( pageSizeIn );
|
||||
VECTOR2I sheetSizeIU = aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
|
||||
BOX2I drawingAreaBBox = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sheetSizeIU ) );
|
||||
|
||||
view->SetGAL( gal );
|
||||
view->SetPainter( painter.get() );
|
||||
view->SetScaleLimits( ZOOM_MAX_LIMIT_EESCHEMA, ZOOM_MIN_LIMIT_EESCHEMA );
|
||||
view->SetScale( 1.0 );
|
||||
gal->SetWorldUnitLength( SCH_WORLD_UNIT );
|
||||
// Enable all layers and use KIGFX::TARGET_NONCACHED to force update drawings
|
||||
// for printing with current GAL instance
|
||||
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; ++i )
|
||||
{
|
||||
view->SetLayerVisible( i, true );
|
||||
view->SetLayerTarget( i, KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
|
||||
// Init the SCH_RENDER_SETTINGS used by the painter used to print schematic
|
||||
SCH_RENDER_SETTINGS* dstSettings = painter->GetSettings();
|
||||
view->SetLayerVisible( LAYER_DRAWINGSHEET, printDrawingSheet );
|
||||
|
||||
dstSettings->m_ShowPinsElectricalType = false;
|
||||
|
||||
// Set the color scheme
|
||||
dstSettings->LoadColors( m_parent->GetColorSettings( false ) );
|
||||
|
||||
if( cfg->m_Printing.use_theme && theme )
|
||||
dstSettings->LoadColors( theme );
|
||||
|
||||
bool printDrawingSheet = cfg->m_Printing.title_block;
|
||||
|
||||
COLOR4D bgColor = m_parent->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
if( cfg->m_Printing.background )
|
||||
// Don't draw the selection if it's not from the current screen
|
||||
for( EDA_ITEM* item : selTool->GetSelection() )
|
||||
{
|
||||
if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item ) )
|
||||
{
|
||||
if( cfg->m_Printing.use_theme && theme )
|
||||
bgColor = theme->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
}
|
||||
else
|
||||
{
|
||||
bgColor = COLOR4D::WHITE;
|
||||
if( !m_parent->GetScreen()->CheckIfOnDrawList( schItem ) )
|
||||
view->SetLayerVisible( LAYER_SELECT_OVERLAY, false );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dstSettings->SetBackgroundColor( bgColor );
|
||||
// When is the actual paper size does not match the schematic page size,
|
||||
// we need to adjust the print scale to fit the selected paper size (pageSizeIU)
|
||||
double scaleX = (double) pageSizeIU.x / drawingAreaBBox.GetWidth();
|
||||
double scaleY = (double) pageSizeIU.y / drawingAreaBBox.GetHeight();
|
||||
|
||||
// The drawing-sheet-item print code is shared between PCBNew and Eeschema, so it's easier
|
||||
// if they just use the PCB layer.
|
||||
dstSettings->SetLayerColor( LAYER_DRAWINGSHEET,
|
||||
dstSettings->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );
|
||||
double print_scale = std::min( scaleX, scaleY );
|
||||
|
||||
dstSettings->SetDefaultFont( cfg->m_Appearance.default_font );
|
||||
galPrint->SetNativePaperSize( pageSizeIn, printCtx->HasNativeLandscapeRotation() );
|
||||
gal->SetLookAtPoint( drawingAreaBBox.Centre() );
|
||||
gal->SetZoomFactor( print_scale );
|
||||
gal->SetClearColor( dstSettings->GetBackgroundColor() );
|
||||
|
||||
if( cfg->m_Printing.monochrome )
|
||||
{
|
||||
for( int i = 0; i < LAYER_ID_COUNT; ++i )
|
||||
dstSettings->SetLayerColor( i, COLOR4D::BLACK );
|
||||
// Clearing the screen for the background color needs the screen set to the page size
|
||||
// in pixels. This can ?somehow? prevent some but not all foreground elements from being printed
|
||||
// TODO: figure out what's going on here and fix printing. See also board_printout
|
||||
VECTOR2I size = gal->GetScreenPixelSize();
|
||||
gal->ResizeScreen( pageSizePix.GetWidth(),pageSizePix.GetHeight() );
|
||||
gal->ClearScreen();
|
||||
gal->ResizeScreen( size.x, size.y );
|
||||
|
||||
// In B&W mode, draw the background only in white, because any other color
|
||||
// will be replaced by a black background
|
||||
dstSettings->SetBackgroundColor( COLOR4D::WHITE );
|
||||
dstSettings->m_OverrideItemColors = true;
|
||||
// Needed to use the same order for printing as for screen redraw
|
||||
view->UseDrawPriority( true );
|
||||
|
||||
// Disable print some backgrounds
|
||||
dstSettings->SetPrintBlackAndWhite( true );
|
||||
}
|
||||
else // color enabled
|
||||
{
|
||||
for( int i = 0; i < LAYER_ID_COUNT; ++i )
|
||||
{
|
||||
// Cairo does not support translucent colors on PostScript surfaces
|
||||
// see 'Features support by the PostScript surface' on
|
||||
// https://www.cairographics.org/documentation/using_the_postscript_surface/
|
||||
dstSettings->SetLayerColor( i, dstSettings->GetLayerColor( i ).WithAlpha( 1.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
dstSettings->SetIsPrinting( true );
|
||||
|
||||
VECTOR2I sheetSizeIU = aScreen->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
|
||||
BOX2I drawingAreaBBox = BOX2I( VECTOR2I( 0, 0 ), VECTOR2I( sheetSizeIU ) );
|
||||
|
||||
// Enable all layers and use KIGFX::TARGET_NONCACHED to force update drawings
|
||||
// for printing with current GAL instance
|
||||
for( int i = 0; i < KIGFX::VIEW::VIEW_MAX_LAYERS; ++i )
|
||||
{
|
||||
view->SetLayerVisible( i, true );
|
||||
view->SetLayerTarget( i, KIGFX::TARGET_NONCACHED );
|
||||
}
|
||||
|
||||
view->SetLayerVisible( LAYER_DRAWINGSHEET, printDrawingSheet );
|
||||
|
||||
// Don't draw the selection if it's not from the current screen
|
||||
for( EDA_ITEM* item : selTool->GetSelection() )
|
||||
{
|
||||
if( SCH_ITEM* schItem = dynamic_cast<SCH_ITEM*>( item ) )
|
||||
{
|
||||
if( !m_parent->GetScreen()->CheckIfOnDrawList( schItem ) )
|
||||
view->SetLayerVisible( LAYER_SELECT_OVERLAY, false );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// When is the actual paper size does not match the schematic page size,
|
||||
// we need to adjust the print scale to fit the selected paper size (pageSizeIU)
|
||||
double scaleX = (double) pageSizeIU.x / drawingAreaBBox.GetWidth();
|
||||
double scaleY = (double) pageSizeIU.y / drawingAreaBBox.GetHeight();
|
||||
|
||||
double print_scale = std::min( scaleX, scaleY );
|
||||
|
||||
galPrint->SetNativePaperSize( pageSizeIn, printCtx->HasNativeLandscapeRotation() );
|
||||
gal->SetLookAtPoint( drawingAreaBBox.Centre() );
|
||||
gal->SetZoomFactor( print_scale );
|
||||
gal->SetClearColor( dstSettings->GetBackgroundColor() );
|
||||
|
||||
// Clearing the screen for the background color needs the screen set to the page size
|
||||
// in pixels. This can ?somehow? prevent some but not all foreground elements from being printed
|
||||
// TODO: figure out what's going on here and fix printing. See also board_printout
|
||||
VECTOR2I size = gal->GetScreenPixelSize();
|
||||
gal->ResizeScreen( pageSizePix.GetWidth(),pageSizePix.GetHeight() );
|
||||
gal->ClearScreen();
|
||||
gal->ResizeScreen( size.x, size.y );
|
||||
|
||||
// Needed to use the same order for printing as for screen redraw
|
||||
view->UseDrawPriority( true );
|
||||
|
||||
{
|
||||
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
|
||||
view->Redraw();
|
||||
}
|
||||
{
|
||||
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
|
||||
view->Redraw();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -38,7 +38,7 @@ class PAINTER;
|
||||
class SCH_PRINTOUT : public wxPrintout
|
||||
{
|
||||
public:
|
||||
SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle, bool aUseCairo );
|
||||
SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle );
|
||||
|
||||
bool OnPrintPage( int page ) override;
|
||||
bool HasPage( int page ) override;
|
||||
@ -58,10 +58,9 @@ public:
|
||||
bool PrintPage( SCH_SCREEN* aScreen, wxDC* aDC, bool aForPrinting );
|
||||
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
SCH_EDIT_FRAME* m_parent;
|
||||
///< Source VIEW object (note that actual printing only refers to this object)
|
||||
const KIGFX::SCH_VIEW* m_view;
|
||||
bool m_useCairo;
|
||||
|
||||
int milsToIU( int aMils );
|
||||
};
|
||||
|
@ -102,16 +102,6 @@ const BOX2I SCH_BITMAP::GetBoundingBox() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_BITMAP::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
VECTOR2I pos = GetPosition() + aOffset;
|
||||
|
||||
m_referenceImage.GetImage().DrawBitmap( aSettings->GetPrintDC(), pos,
|
||||
aSettings->GetBackgroundColor() );
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I SCH_BITMAP::GetPosition() const
|
||||
{
|
||||
return m_referenceImage.GetPosition();
|
||||
@ -176,9 +166,11 @@ void SCH_BITMAP::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
|
||||
{
|
||||
if( aBackground )
|
||||
{
|
||||
m_referenceImage.GetImage().PlotImage(
|
||||
aPlotter, GetPosition(), aPlotter->RenderSettings()->GetLayerColor( GetLayer() ),
|
||||
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||
RENDER_SETTINGS* cfg = aPlotter->RenderSettings();
|
||||
|
||||
m_referenceImage.GetImage().PlotImage( aPlotter, GetPosition(),
|
||||
cfg->GetLayerColor( GetLayer() ),
|
||||
cfg->GetDefaultPenWidth() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,12 +103,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -263,34 +263,6 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = ( GetBusEntryColor() == COLOR4D::UNSPECIFIED )
|
||||
? aSettings->GetLayerColor( m_layer )
|
||||
: GetBusEntryColor();
|
||||
VECTOR2I start = m_pos + aOffset;
|
||||
VECTOR2I end = GetEnd() + aOffset;
|
||||
int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
|
||||
|
||||
if( GetEffectiveLineStyle() <= LINE_STYLE::FIRST_TYPE )
|
||||
{
|
||||
GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_SEGMENT segment( start, end );
|
||||
|
||||
STROKE_PARAMS::Stroke( &segment, GetEffectiveLineStyle(), penWidth, aSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::MirrorVertically( int aCenter )
|
||||
{
|
||||
MIRROR( m_pos.y, aCenter );
|
||||
|
@ -129,12 +129,6 @@ public:
|
||||
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -1515,22 +1515,6 @@ void SCH_EDIT_FRAME::OnExit( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
|
||||
const SCH_RENDER_SETTINGS* cfg = static_cast<const SCH_RENDER_SETTINGS*>( aSettings );
|
||||
COLOR4D bg = GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
cfg->GetPrintDC()->SetBackground( wxBrush( bg.ToColour() ) );
|
||||
cfg->GetPrintDC()->Clear();
|
||||
|
||||
cfg->GetPrintDC()->SetLogicalFunction( wxCOPY );
|
||||
GetScreen()->Print( cfg );
|
||||
PrintDrawingSheet( cfg, GetScreen(), Schematic().GetProperties(), schIUScale.IU_PER_MILS,
|
||||
fileName );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::RefreshOperatingPointDisplay()
|
||||
{
|
||||
SCHEMATIC_SETTINGS& settings = m_schematic->Settings();
|
||||
|
@ -812,11 +812,6 @@ public:
|
||||
|
||||
DESIGN_BLOCK_PANE* GetDesignBlockPane() const { return m_designBlocksPane; }
|
||||
|
||||
/**
|
||||
* Plot or print the current sheet to the clipboard.
|
||||
*/
|
||||
virtual void PrintPage( const RENDER_SETTINGS* aSettings ) override;
|
||||
|
||||
void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
|
||||
|
||||
/**
|
||||
|
@ -423,90 +423,6 @@ SCH_FIELD::GetRenderCache( const wxString& forResolvedText, const VECTOR2I& forP
|
||||
}
|
||||
|
||||
|
||||
void SCH_FIELD::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
wxString text;
|
||||
|
||||
if( Schematic() )
|
||||
text = GetShownText( &Schematic()->CurrentSheet(), true );
|
||||
else
|
||||
text = GetShownText( true );
|
||||
|
||||
if( ( !IsVisible() && !IsForceVisible() ) || text.IsEmpty() )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_layer );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
|
||||
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( IsForceVisible() )
|
||||
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
|
||||
|
||||
if( !blackAndWhiteMode && GetTextColor() != COLOR4D::UNSPECIFIED )
|
||||
color = GetTextColor();
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
// Calculate the text orientation according to the symbol orientation.
|
||||
EDA_ANGLE orient = GetTextAngle();
|
||||
VECTOR2I textpos = GetTextPos();
|
||||
GR_TEXT_H_ALIGN_T hjustify = GetHorizJustify();
|
||||
GR_TEXT_V_ALIGN_T vjustify = GetVertJustify();
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
if( m_parent && m_parent->Type() == LIB_SYMBOL_T )
|
||||
{
|
||||
textpos = aSettings->TransformCoordinate( GetTextPos() ) + aOffset;
|
||||
}
|
||||
else if( m_parent && m_parent->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
* - numerous cases (mirrored or not, rotation)
|
||||
* - the GRText function will also recalculate H and V justifications according to the
|
||||
* text orientation.
|
||||
* - when symbol is mirrored, the text is not mirrored and justifications are complicated
|
||||
* to calculate so the easier way is to use no justifications (centered text) and use
|
||||
* GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
hjustify = GR_TEXT_H_ALIGN_CENTER;
|
||||
vjustify = GR_TEXT_V_ALIGN_CENTER;
|
||||
textpos = GetBoundingBox().Centre() + aOffset;
|
||||
|
||||
if( aSettings->m_Transform.y1 ) // Rotate symbol 90 degrees.
|
||||
{
|
||||
if( orient == ANGLE_HORIZONTAL )
|
||||
orient = ANGLE_VERTICAL;
|
||||
else
|
||||
orient = ANGLE_HORIZONTAL;
|
||||
}
|
||||
}
|
||||
else if( m_parent && m_parent->Type() == SCH_GLOBAL_LABEL_T )
|
||||
{
|
||||
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( GetParent() );
|
||||
textpos += label->GetSchematicTextOffset( aSettings );
|
||||
}
|
||||
|
||||
GRPrintText( DC, textpos, color, text, orient, GetTextSize(), hjustify, vjustify, penWidth,
|
||||
IsItalic(), IsBold(), font, GetFontMetrics() );
|
||||
}
|
||||
|
||||
|
||||
void SCH_FIELD::ImportValues( const SCH_FIELD& aSource )
|
||||
{
|
||||
SetAttributes( aSource );
|
||||
|
@ -284,9 +284,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -577,30 +577,6 @@ public:
|
||||
|
||||
virtual void SetStroke( const STROKE_PARAMS& aStroke ) { wxCHECK( false, /* void */ ); }
|
||||
|
||||
/**
|
||||
* Print an item.
|
||||
*
|
||||
* @param aUnit - Which unit to print.
|
||||
* @param aBodyStyle - Which body style to print.
|
||||
* @param aOffset - Relative offset.
|
||||
* @param aForceNoFill - Disable printing of fills.
|
||||
* @param aDimmed - Reduce brightness of item.
|
||||
*/
|
||||
virtual void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
wxCHECK_MSG( false, /*void*/, wxT( "Print not implemented in " ) + GetClass() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Print just the background fills.
|
||||
*/
|
||||
virtual void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed )
|
||||
{
|
||||
wxCHECK_MSG( false, /*void*/, wxT( "PrintBackground not implemented in " ) + GetClass() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Plot the item to \a aPlotter.
|
||||
*
|
||||
|
@ -111,21 +111,6 @@ const BOX2I SCH_JUNCTION::GetBoundingBox() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = GetJunctionColor();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( GetLayer() );
|
||||
|
||||
SHAPE_CIRCLE circle = getEffectiveShape();
|
||||
|
||||
GRFilledCircle( DC, circle.GetCenter() + aOffset, circle.GetRadius(), 0, color, color );
|
||||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::MirrorVertically( int aCenter )
|
||||
{
|
||||
MIRROR( m_pos.y, aCenter );
|
||||
|
@ -122,12 +122,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -1361,52 +1361,6 @@ void SCH_LABEL_BASE::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_O
|
||||
}
|
||||
|
||||
|
||||
void SCH_LABEL_BASE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
static std::vector<VECTOR2I> s_poly;
|
||||
|
||||
SCH_CONNECTION* connection = Connection();
|
||||
int layer = ( connection && connection->IsBus() ) ? LAYER_BUS : m_layer;
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( layer );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
|
||||
COLOR4D labelColor = GetLabelColor();
|
||||
|
||||
if( !blackAndWhiteMode && labelColor != COLOR4D::UNSPECIFIED )
|
||||
color = labelColor;
|
||||
|
||||
EDA_TEXT::Print( aSettings, text_offset, color );
|
||||
|
||||
CreateGraphicShape( aSettings, s_poly, GetTextPos() + aOffset );
|
||||
|
||||
if( GetShape() == LABEL_FLAG_SHAPE::F_DOT )
|
||||
{
|
||||
GRLine( DC, s_poly[0], s_poly[1], penWidth, color );
|
||||
|
||||
int radius = ( s_poly[2] - s_poly[1] ).EuclideanNorm();
|
||||
GRFilledCircle( DC, s_poly[2], radius, penWidth, color, color );
|
||||
}
|
||||
else if( GetShape() == LABEL_FLAG_SHAPE::F_ROUND )
|
||||
{
|
||||
GRLine( DC, s_poly[0], s_poly[1], penWidth, color );
|
||||
|
||||
int radius = ( s_poly[2] - s_poly[1] ).EuclideanNorm();
|
||||
GRCircle( DC, s_poly[2], radius, penWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !s_poly.empty() )
|
||||
GRPoly( DC, s_poly.size(), &s_poly[0], false, penWidth, color, color );
|
||||
}
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
field.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_LABEL_BASE::AutoRotateOnPlacement() const
|
||||
{
|
||||
return m_autoRotateOnPlacement;
|
||||
|
@ -341,12 +341,6 @@ public:
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -347,37 +347,6 @@ int SCH_LINE::GetPenWidth() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& offset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = GetLineColor();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( GetLayer() );
|
||||
|
||||
VECTOR2I start = m_start;
|
||||
VECTOR2I end = m_end;
|
||||
LINE_STYLE lineStyle = GetEffectiveLineStyle();
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
|
||||
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
|
||||
{
|
||||
GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_SEGMENT segment( start, end );
|
||||
|
||||
STROKE_PARAMS::Stroke( &segment, lineStyle, penWidth, aSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
GRLine( DC, a.x, a.y, b.x, b.y, penWidth, color );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::MirrorVertically( int aCenter )
|
||||
{
|
||||
if( m_flags & STARTPOINT )
|
||||
|
@ -302,12 +302,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -340,13 +340,6 @@ SEVERITY SCH_MARKER::GetSeverity() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_MARKER::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
PrintMarker( aSettings, aOffset );
|
||||
}
|
||||
|
||||
|
||||
bool SCH_MARKER::Matches( const EDA_SEARCH_DATA& aSearchData, void* aAuxData ) const
|
||||
{
|
||||
return SCH_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData );
|
||||
|
@ -63,9 +63,6 @@ public:
|
||||
|
||||
SEVERITY GetSeverity() const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override
|
||||
{
|
||||
|
@ -101,21 +101,6 @@ int SCH_NO_CONNECT::GetPenWidth() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_NO_CONNECT::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
int half = GetSize() / 2;
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
int pX = m_pos.x + aOffset.x;
|
||||
int pY = m_pos.y + aOffset.y;
|
||||
COLOR4D color = aSettings->GetLayerColor( LAYER_NOCONNECT );
|
||||
|
||||
GRLine( DC, pX - half, pY - half, pX + half, pY + half, penWidth, color );
|
||||
GRLine( DC, pX + half, pY - half, pX - half, pY + half, penWidth, color );
|
||||
}
|
||||
|
||||
|
||||
void SCH_NO_CONNECT::MirrorVertically( int aCenter )
|
||||
{
|
||||
MIRROR( m_pos.y, aCenter );
|
||||
|
@ -106,12 +106,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -605,432 +605,6 @@ VECTOR2I SCH_PIN::GetPinRoot() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_PIN::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
LIB_SYMBOL* part = dynamic_cast<LIB_SYMBOL*>( GetParentSymbol() );
|
||||
|
||||
wxCHECK( part && aSettings, /* void */ );
|
||||
|
||||
/* Calculate pin orient taking in account the symbol orientation. */
|
||||
PIN_ORIENTATION orient = PinDrawOrient( aSettings->m_Transform );
|
||||
|
||||
/* Calculate the pin position */
|
||||
VECTOR2I pos1 = aSettings->TransformCoordinate( m_position ) + aOffset;
|
||||
|
||||
if( IsVisible() || aSettings->m_ShowHiddenFields )
|
||||
{
|
||||
printPinSymbol( aSettings, pos1, orient, aDimmed );
|
||||
|
||||
printPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(),
|
||||
aSettings->m_ShowPinNumbers || part->GetShowPinNumbers(),
|
||||
aSettings->m_ShowPinNames || part->GetShowPinNames(),
|
||||
aDimmed );
|
||||
|
||||
if( aSettings->m_ShowPinsElectricalType )
|
||||
printPinElectricalTypeName( aSettings, pos1, orient, aDimmed );
|
||||
|
||||
if( aSettings->m_ShowConnectionPoints
|
||||
&& m_type != ELECTRICAL_PINTYPE::PT_NC
|
||||
&& m_type != ELECTRICAL_PINTYPE::PT_NIC )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN );
|
||||
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
GRCircle( DC, pos1, TARGET_PIN_RADIUS, 0, color );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_PIN::printPinSymbol( const SCH_RENDER_SETTINGS* aSettings, const VECTOR2I& aPos,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
int MapX1, MapY1, x1, y1;
|
||||
int width = GetEffectivePenWidth( aSettings );
|
||||
int posX = aPos.x;
|
||||
int posY = aPos.y;
|
||||
int len = GetLength();
|
||||
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN );
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( !IsVisible() )
|
||||
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
MapX1 = MapY1 = 0;
|
||||
x1 = posX;
|
||||
y1 = posY;
|
||||
|
||||
switch( aOrientation )
|
||||
{
|
||||
case PIN_ORIENTATION::PIN_UP: y1 = posY - len; MapY1 = 1; break;
|
||||
case PIN_ORIENTATION::PIN_DOWN: y1 = posY + len; MapY1 = -1; break;
|
||||
case PIN_ORIENTATION::PIN_LEFT: x1 = posX - len; MapX1 = 1; break;
|
||||
case PIN_ORIENTATION::PIN_RIGHT: x1 = posX + len; MapX1 = -1; break;
|
||||
case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxS( "aOrientation must be resolved!" ) ); break;
|
||||
}
|
||||
|
||||
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
|
||||
{
|
||||
const int radius = externalPinDecoSize( aSettings, *this );
|
||||
GRCircle( DC, VECTOR2I( MapX1 * radius + x1, MapY1 * radius + y1 ), radius, width, color );
|
||||
|
||||
GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
|
||||
GRLineTo( DC, posX, posY, width, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRMoveTo( x1, y1 );
|
||||
GRLineTo( DC, posX, posY, width, color );
|
||||
}
|
||||
|
||||
// Draw the clock shape (>)inside the symbol
|
||||
if( m_shape == GRAPHIC_PINSHAPE::CLOCK
|
||||
|| m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK
|
||||
|| m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
|
||||
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
|
||||
{
|
||||
const int clock_size = internalPinDecoSize( aSettings, *this );
|
||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||
{
|
||||
GRMoveTo( x1, y1 + clock_size );
|
||||
GRLineTo( DC, x1 - MapX1 * clock_size * 2, y1, width, color );
|
||||
GRLineTo( DC, x1, y1 - clock_size, width, color );
|
||||
}
|
||||
else /* MapX1 = 0 */
|
||||
{
|
||||
GRMoveTo( x1 + clock_size, y1 );
|
||||
GRLineTo( DC, x1, y1 - MapY1 * clock_size * 2, width, color );
|
||||
GRLineTo( DC, x1 - clock_size, y1, width, color );
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the active low (or H to L active transition)
|
||||
if( m_shape == GRAPHIC_PINSHAPE::INPUT_LOW
|
||||
|| m_shape == GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK
|
||||
|| m_shape == GRAPHIC_PINSHAPE::CLOCK_LOW )
|
||||
{
|
||||
const int deco_size = externalPinDecoSize( aSettings, *this );
|
||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||
{
|
||||
GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
|
||||
GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
|
||||
GRLineTo( DC, x1, y1, width, color );
|
||||
}
|
||||
else /* MapX1 = 0 */
|
||||
{
|
||||
GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
|
||||
GRLineTo( DC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
|
||||
GRLineTo( DC, x1, y1, width, color );
|
||||
}
|
||||
}
|
||||
|
||||
if( m_shape == GRAPHIC_PINSHAPE::OUTPUT_LOW ) /* IEEE symbol "Active Low Output" */
|
||||
{
|
||||
const int deco_size = externalPinDecoSize( aSettings, *this );
|
||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||
{
|
||||
GRMoveTo( x1, y1 - deco_size * 2 );
|
||||
GRLineTo( DC, x1 + MapX1 * deco_size * 2, y1, width, color );
|
||||
}
|
||||
else /* MapX1 = 0 */
|
||||
{
|
||||
GRMoveTo( x1 - deco_size * 2, y1 );
|
||||
GRLineTo( DC, x1, y1 + MapY1 * deco_size * 2, width, color );
|
||||
}
|
||||
}
|
||||
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
|
||||
{
|
||||
const int deco_size = externalPinDecoSize( aSettings, *this );
|
||||
GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
|
||||
GRLineTo( DC, x1 + (MapX1 + MapY1) * deco_size, y1 + ( MapY1 - MapX1 ) * deco_size, width,
|
||||
color );
|
||||
GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
|
||||
GRLineTo( DC, x1 + (MapX1 - MapY1) * deco_size, y1 + ( MapY1 + MapX1 ) * deco_size, width,
|
||||
color );
|
||||
}
|
||||
|
||||
if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
|
||||
{
|
||||
const int deco_size = TARGET_PIN_RADIUS;
|
||||
GRLine( DC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width,
|
||||
color );
|
||||
GRLine( DC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width,
|
||||
color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_PIN::printPinTexts( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPinPos,
|
||||
PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum,
|
||||
bool aDrawPinName, bool aDimmed )
|
||||
{
|
||||
if( !aDrawPinName && !aDrawPinNum )
|
||||
return;
|
||||
|
||||
KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
|
||||
wxString name = GetShownName();
|
||||
wxString number = GetShownNumber();
|
||||
VECTOR2I nameSize( GetNameTextSize(), GetNameTextSize() );
|
||||
VECTOR2I numSize( GetNumberTextSize(), GetNumberTextSize() );
|
||||
int name_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN );
|
||||
int num_offset = schIUScale.MilsToIU( PIN_TEXT_MARGIN );
|
||||
|
||||
/* Get the num and name colors */
|
||||
COLOR4D nameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
|
||||
COLOR4D numColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNUM : LAYER_HIDDEN );
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( !IsVisible() )
|
||||
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
nameColor.Desaturate();
|
||||
numColor.Desaturate();
|
||||
nameColor = nameColor.Mix( bg, 0.5f );
|
||||
numColor = numColor.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
int x1 = aPinPos.x;
|
||||
int y1 = aPinPos.y;
|
||||
|
||||
switch( aPinOrient )
|
||||
{
|
||||
case PIN_ORIENTATION::PIN_UP: y1 -= GetLength(); break;
|
||||
case PIN_ORIENTATION::PIN_DOWN: y1 += GetLength(); break;
|
||||
case PIN_ORIENTATION::PIN_LEFT: x1 -= GetLength(); break;
|
||||
case PIN_ORIENTATION::PIN_RIGHT: x1 += GetLength(); break;
|
||||
case PIN_ORIENTATION::INHERIT: wxFAIL_MSG( wxT( "aPinOrient must be resolved!" ) ); break;
|
||||
}
|
||||
|
||||
if( name.IsEmpty() || m_nameTextSize == 0 )
|
||||
aDrawPinName = false;
|
||||
|
||||
if( number.IsEmpty() || m_numTextSize == 0 )
|
||||
aDrawPinNum = false;
|
||||
|
||||
auto printName =
|
||||
[&]( int x, int y, const EDA_ANGLE& angle, enum GR_TEXT_H_ALIGN_T hAlign,
|
||||
enum GR_TEXT_V_ALIGN_T vAlign )
|
||||
{
|
||||
GRPrintText( aSettings->GetPrintDC(), VECTOR2I( x, y ), nameColor, name, angle,
|
||||
nameSize, hAlign, vAlign, 0, false, false, font, GetFontMetrics() );
|
||||
};
|
||||
|
||||
auto printNum =
|
||||
[&]( int x, int y, const EDA_ANGLE& angle, enum GR_TEXT_H_ALIGN_T hAlign,
|
||||
enum GR_TEXT_V_ALIGN_T vAlign )
|
||||
{
|
||||
GRPrintText( aSettings->GetPrintDC(), VECTOR2I( x, y ), numColor, number, angle,
|
||||
numSize, hAlign, vAlign, 0, false, false, font, GetFontMetrics() );
|
||||
};
|
||||
|
||||
if( aTextInside ) // Draw the text inside, but the pin numbers outside.
|
||||
{
|
||||
if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
|
||||
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
|
||||
{
|
||||
// It is an horizontal line
|
||||
if( aDrawPinName )
|
||||
{
|
||||
if( aPinOrient == PIN_ORIENTATION::PIN_RIGHT )
|
||||
{
|
||||
printName( x1 + aTextInside, y1, ANGLE_HORIZONTAL,
|
||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER );
|
||||
}
|
||||
else // Orient == PIN_LEFT
|
||||
{
|
||||
printName( x1 - aTextInside, y1, ANGLE_HORIZONTAL,
|
||||
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER );
|
||||
}
|
||||
}
|
||||
|
||||
if( aDrawPinNum )
|
||||
{
|
||||
printNum( ( x1 + aPinPos.x ) / 2, y1 - num_offset, ANGLE_HORIZONTAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
}
|
||||
}
|
||||
else /* Its a vertical line. */
|
||||
{
|
||||
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
|
||||
if( aPinOrient == PIN_ORIENTATION::PIN_DOWN )
|
||||
{
|
||||
if( aDrawPinName )
|
||||
{
|
||||
printName( x1, y1 + aTextInside, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_RIGHT, GR_TEXT_V_ALIGN_CENTER );
|
||||
}
|
||||
|
||||
if( aDrawPinNum )
|
||||
{
|
||||
printNum( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
}
|
||||
}
|
||||
else /* PIN_UP */
|
||||
{
|
||||
if( aDrawPinName )
|
||||
{
|
||||
printName( x1, y1 - aTextInside, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_LEFT, GR_TEXT_V_ALIGN_CENTER );
|
||||
}
|
||||
|
||||
if( aDrawPinNum )
|
||||
{
|
||||
printNum( x1 - num_offset, ( y1 + aPinPos.y) / 2, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else /**** Draw num & text pin outside ****/
|
||||
{
|
||||
if( ( aPinOrient == PIN_ORIENTATION::PIN_LEFT )
|
||||
|| ( aPinOrient == PIN_ORIENTATION::PIN_RIGHT ) )
|
||||
{
|
||||
/* Its an horizontal line. */
|
||||
if( aDrawPinName && aDrawPinNum )
|
||||
{
|
||||
printName( ( x1 + aPinPos.x ) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
|
||||
printNum( ( x1 + aPinPos.x ) / 2, y1 + num_offset, ANGLE_HORIZONTAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP );
|
||||
}
|
||||
else if( aDrawPinName )
|
||||
{
|
||||
printName( ( x1 + aPinPos.x ) / 2, y1 - name_offset, ANGLE_HORIZONTAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
}
|
||||
else if( aDrawPinNum )
|
||||
{
|
||||
printNum( ( x1 + aPinPos.x ) / 2, y1 - num_offset, ANGLE_HORIZONTAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
}
|
||||
}
|
||||
else /* Its a vertical line. */
|
||||
{
|
||||
if( aDrawPinName && aDrawPinNum )
|
||||
{
|
||||
printName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
|
||||
printNum( x1 + num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_TOP );
|
||||
}
|
||||
else if( aDrawPinName )
|
||||
{
|
||||
printName( x1 - name_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
}
|
||||
else if( aDrawPinNum )
|
||||
{
|
||||
printNum( x1 - num_offset, ( y1 + aPinPos.y ) / 2, ANGLE_VERTICAL,
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_BOTTOM );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_PIN::printPinElectricalTypeName( const RENDER_SETTINGS* aSettings,
|
||||
const VECTOR2I& aPosition, PIN_ORIENTATION aOrientation,
|
||||
bool aDimmed )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
wxString typeName = GetElectricalTypeName();
|
||||
|
||||
// Use a reasonable (small) size to draw the text
|
||||
int textSize = ( GetNameTextSize() * 3 ) / 4;
|
||||
|
||||
#define ETXT_MAX_SIZE schIUScale.mmToIU( 0.7 )
|
||||
|
||||
if( textSize > ETXT_MAX_SIZE )
|
||||
textSize = ETXT_MAX_SIZE;
|
||||
|
||||
// Use a reasonable pen size to draw the text
|
||||
int pensize = textSize/6;
|
||||
|
||||
// Get a suitable color
|
||||
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PRIVATE_NOTES : LAYER_HIDDEN );
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( !IsVisible() )
|
||||
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
VECTOR2I txtpos = aPosition;
|
||||
int offset = schIUScale.mmToIU( 0.4 );
|
||||
GR_TEXT_H_ALIGN_T hjustify = GR_TEXT_H_ALIGN_LEFT;
|
||||
EDA_ANGLE orient = ANGLE_HORIZONTAL;
|
||||
KIFONT::FONT* font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), false, false );
|
||||
|
||||
switch( aOrientation )
|
||||
{
|
||||
case PIN_ORIENTATION::PIN_UP:
|
||||
txtpos.y += offset;
|
||||
orient = ANGLE_VERTICAL;
|
||||
hjustify = GR_TEXT_H_ALIGN_RIGHT;
|
||||
break;
|
||||
|
||||
case PIN_ORIENTATION::PIN_DOWN:
|
||||
txtpos.y -= offset;
|
||||
orient = ANGLE_VERTICAL;
|
||||
break;
|
||||
|
||||
case PIN_ORIENTATION::PIN_LEFT:
|
||||
txtpos.x += offset;
|
||||
break;
|
||||
|
||||
case PIN_ORIENTATION::PIN_RIGHT:
|
||||
txtpos.x -= offset;
|
||||
hjustify = GR_TEXT_H_ALIGN_RIGHT;
|
||||
break;
|
||||
|
||||
case PIN_ORIENTATION::INHERIT:
|
||||
wxFAIL_MSG( wxS( "aOrientation must be resolved!" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
GRPrintText( DC, txtpos, color, typeName, orient, VECTOR2I( textSize, textSize ), hjustify,
|
||||
GR_TEXT_V_ALIGN_CENTER, pensize, false, false, font, GetFontMetrics() );
|
||||
}
|
||||
|
||||
|
||||
void SCH_PIN::PlotPinType( PLOTTER *aPlotter, const VECTOR2I &aPosition,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed ) const
|
||||
{
|
||||
|
@ -152,9 +152,6 @@ public:
|
||||
wxString GetAlt() const { return m_alt; }
|
||||
void SetAlt( const wxString& aAlt ) { m_alt = aAlt; }
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
/**
|
||||
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
|
||||
* according to its orientation and the matrix transform (rot, mirror) \a aTransform.
|
||||
@ -317,32 +314,6 @@ protected:
|
||||
void validateExtentsCache( KIFONT::FONT* aFont, int aSize, const wxString& aText,
|
||||
EXTENTS_CACHE* aCache ) const;
|
||||
|
||||
/**
|
||||
* Print the pin symbol without text.
|
||||
*
|
||||
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
|
||||
*/
|
||||
void printPinSymbol( const SCH_RENDER_SETTINGS *aSettings, const VECTOR2I &aPos,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed );
|
||||
|
||||
/**
|
||||
* Put the pin number and pin text info, given the pin line coordinates.
|
||||
*
|
||||
* The line must be vertical or horizontal.
|
||||
* If aDrawPinName == false the pin name is not printed.
|
||||
* If aDrawPinNum = false the pin number is not printed.
|
||||
* If aTextInside then the text is been put inside,otherwise all is drawn outside.
|
||||
* Pin Name: substring between '~' is negated
|
||||
*/
|
||||
void printPinTexts( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPinPos,
|
||||
PIN_ORIENTATION aPinOrient, int aTextInside, bool aDrawPinNum,
|
||||
bool aDrawPinName, bool aDimmed );
|
||||
|
||||
/**
|
||||
* Draw the electrical type text of the pin (only for the footprint editor).
|
||||
*/
|
||||
void printPinElectricalTypeName( const RENDER_SETTINGS* aSettings, const VECTOR2I& aPosition,
|
||||
PIN_ORIENTATION aOrientation, bool aDimmed );
|
||||
std::ostream& operator<<( std::ostream& aStream );
|
||||
|
||||
private:
|
||||
|
@ -856,50 +856,6 @@ void SCH_SCREEN::SetConnectivityDirty()
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREEN::Print( const SCH_RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||
std::vector<SCH_ITEM*> junctions;
|
||||
std::vector<SCH_ITEM*> bitmaps;
|
||||
std::vector<SCH_ITEM*> other;
|
||||
|
||||
for( SCH_ITEM* item : Items() )
|
||||
{
|
||||
if( item->IsMoving() )
|
||||
continue;
|
||||
|
||||
if( item->Type() == SCH_JUNCTION_T )
|
||||
junctions.push_back( item );
|
||||
else if( item->Type() == SCH_BITMAP_T )
|
||||
bitmaps.push_back( item );
|
||||
else
|
||||
other.push_back( item );
|
||||
}
|
||||
|
||||
// Sort to ensure plot-order consistency with screen drawing.
|
||||
std::stable_sort( other.begin(), other.end(),
|
||||
[]( const SCH_ITEM* a, const SCH_ITEM* b )
|
||||
{
|
||||
if( a->Type() == b->Type() )
|
||||
return a->GetLayer() > b->GetLayer();
|
||||
|
||||
return a->Type() < b->Type();
|
||||
} );
|
||||
|
||||
for( SCH_ITEM* item : bitmaps )
|
||||
item->Print( aSettings, 0, 0, VECTOR2I( 0, 0 ), false, false );
|
||||
|
||||
for( SCH_ITEM* item : other )
|
||||
item->PrintBackground( aSettings, 0, 0, VECTOR2I( 0, 0 ), false );
|
||||
|
||||
for( SCH_ITEM* item : other )
|
||||
item->Print( aSettings, 0, 0, VECTOR2I( 0, 0 ), false, false );
|
||||
|
||||
for( SCH_ITEM* item : junctions )
|
||||
item->Print( aSettings, 0, 0, VECTOR2I( 0, 0 ), false, false );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SCREEN::Plot( PLOTTER* aPlotter, const SCH_PLOT_OPTS& aPlotOpts ) const
|
||||
{
|
||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||
|
@ -240,14 +240,6 @@ public:
|
||||
*/
|
||||
void UpdateLocalLibSymbolLinks();
|
||||
|
||||
/**
|
||||
* Print all the items in the screen to \a aDC.
|
||||
*
|
||||
* @note This function is useful only for schematic. The library editor and library viewer
|
||||
* do not use a draw list and therefore draws nothing.
|
||||
*/
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings );
|
||||
|
||||
/**
|
||||
* Plot all the schematic objects to \a aPlotter.
|
||||
*
|
||||
|
@ -279,234 +279,6 @@ const BOX2I SCH_SHAPE::GetBoundingBox() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHAPE::PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed )
|
||||
{
|
||||
if( IsPrivate() )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color;
|
||||
|
||||
static std::vector<VECTOR2I> ptList;
|
||||
|
||||
if( GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
ptList.clear();
|
||||
|
||||
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
|
||||
ptList.push_back( aSettings->TransformCoordinate( pt ) + aOffset );
|
||||
}
|
||||
else if( GetShape() == SHAPE_T::BEZIER )
|
||||
{
|
||||
ptList.clear();
|
||||
|
||||
for( const VECTOR2I& pt : m_bezierPoints )
|
||||
ptList.push_back( aSettings->TransformCoordinate( pt ) + aOffset );
|
||||
}
|
||||
|
||||
if( GetFillMode() == FILL_T::FILLED_WITH_COLOR )
|
||||
{
|
||||
if( GetFillColor() == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( LAYER_NOTES );
|
||||
else
|
||||
color = GetFillColor();
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
GRFilledArc( DC, GetEnd(), GetStart(), getCenter(), 0, color, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
GRFilledCircle( DC, GetStart(), GetRadius(), 0, color, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
GRFilledRect( DC, GetStart(), GetEnd(), 0, color, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
GRPoly( DC, (int) ptList.size(), ptList.data(), true, 0, color, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
GRPoly( DC, (int) ptList.size(), ptList.data(), true, 0, color, color );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHAPE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
if( IsPrivate() )
|
||||
return;
|
||||
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = GetStroke().GetColor();
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( LAYER_NOTES );
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
static std::vector<VECTOR2I> ptList;
|
||||
|
||||
if( GetShape() == SHAPE_T::POLY )
|
||||
{
|
||||
ptList.clear();
|
||||
|
||||
for( const VECTOR2I& pt : m_poly.Outline( 0 ).CPoints() )
|
||||
ptList.push_back( aSettings->TransformCoordinate( pt ) + aOffset );
|
||||
}
|
||||
else if( GetShape() == SHAPE_T::BEZIER )
|
||||
{
|
||||
ptList.clear();
|
||||
|
||||
for( const VECTOR2I& pt : m_bezierPoints )
|
||||
ptList.push_back( aSettings->TransformCoordinate( pt ) + aOffset );
|
||||
}
|
||||
|
||||
VECTOR2I start = GetStart();
|
||||
VECTOR2I end = GetEnd();
|
||||
VECTOR2I center = ( GetShape() == SHAPE_T::ARC ) ? getCenter() : VECTOR2I( 0, 0 );
|
||||
|
||||
if( aSettings->m_Transform != TRANSFORM() || aOffset != VECTOR2I() )
|
||||
{
|
||||
start = aSettings->TransformCoordinate( start ) + aOffset;
|
||||
end = aSettings->TransformCoordinate( end ) + aOffset;
|
||||
|
||||
if( GetShape() == SHAPE_T::ARC )
|
||||
{
|
||||
center = aSettings->TransformCoordinate( center ) + aOffset;
|
||||
|
||||
EDA_ANGLE t1, t2;
|
||||
|
||||
CalcArcAngles( t1, t2 );
|
||||
|
||||
// N.B. The order of evaluation is critical here as MapAngles will modify t1, t2
|
||||
// and the Normalize routine depends on these modifications for the correct output
|
||||
bool transformed = aSettings->m_Transform.MapAngles( &t1, &t2 );
|
||||
EDA_ANGLE arc_angle = ( t1 - t2 ).Normalize180();
|
||||
bool transformed2 = ( arc_angle > ANGLE_0 ) && ( arc_angle < ANGLE_180 );
|
||||
|
||||
if( transformed != transformed2 )
|
||||
std::swap( start, end );
|
||||
}
|
||||
}
|
||||
|
||||
COLOR4D fillColor = COLOR4D::UNSPECIFIED;
|
||||
|
||||
if( GetFillMode() == FILL_T::FILLED_SHAPE )
|
||||
fillColor = color;
|
||||
else if( GetFillMode() == FILL_T::FILLED_WITH_COLOR )
|
||||
fillColor = GetFillColor();
|
||||
else if( GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
|
||||
fillColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||
|
||||
if( fillColor != COLOR4D::UNSPECIFIED && !aForceNoFill )
|
||||
{
|
||||
if( aDimmed )
|
||||
{
|
||||
fillColor.Desaturate( );
|
||||
fillColor = fillColor.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
GRFilledArc( DC, end, start, center, 0, fillColor, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
GRFilledCircle( DC, start, GetRadius(), 0, fillColor, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
GRFilledRect( DC, start, end, 0, fillColor, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
GRPoly( DC, (int) ptList.size(), ptList.data(), true, 0, fillColor, fillColor );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
GRPoly( DC, (int) ptList.size(), ptList.data(), true, 0, fillColor, fillColor );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
|
||||
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
|
||||
|
||||
if( penWidth > 0 )
|
||||
{
|
||||
if( GetEffectiveLineStyle() == LINE_STYLE::SOLID )
|
||||
{
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
GRArc( DC, end, start, center, penWidth, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::CIRCLE:
|
||||
GRCircle( DC, start, GetRadius(), penWidth, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::RECTANGLE:
|
||||
GRRect( DC, start, end, penWidth, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::POLY:
|
||||
GRPoly( DC, (int) ptList.size(), ptList.data(), false, penWidth, color, color );
|
||||
break;
|
||||
|
||||
case SHAPE_T::BEZIER:
|
||||
GRPoly( DC, (int) ptList.size(), ptList.data(), false, penWidth, color, color );
|
||||
break;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, GetEffectiveLineStyle(), penWidth, aSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
VECTOR2I ptA = aSettings->TransformCoordinate( a ) + aOffset;
|
||||
VECTOR2I ptB = aSettings->TransformCoordinate( b ) + aOffset;
|
||||
GRLine( DC, ptA.x, ptA.y, ptB.x, ptB.y, penWidth, color );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
|
||||
{
|
||||
if( m_layer == LAYER_DEVICE )
|
||||
|
@ -102,12 +102,6 @@ public:
|
||||
return makeEffectiveShapes( aEdgeOnly, true );
|
||||
}
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -1295,60 +1295,6 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS&
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
VECTOR2I pos = m_pos + aOffset;
|
||||
int lineWidth = GetEffectivePenWidth( aSettings );
|
||||
COLOR4D border = GetBorderColor();
|
||||
COLOR4D background = GetBackgroundColor();
|
||||
|
||||
if( aSettings->m_OverrideItemColors || border == COLOR4D::UNSPECIFIED )
|
||||
border = aSettings->GetLayerColor( LAYER_SHEET );
|
||||
|
||||
if( aSettings->m_OverrideItemColors || background == COLOR4D::UNSPECIFIED )
|
||||
background = aSettings->GetLayerColor( LAYER_SHEET_BACKGROUND );
|
||||
|
||||
if( GetGRForceBlackPenState() ) // printing in black & white
|
||||
background = COLOR4D::UNSPECIFIED;
|
||||
|
||||
if( background.a > 0.0 )
|
||||
GRFilledRect( DC, pos, pos + m_size, 0, background, background );
|
||||
|
||||
GRRect( DC, pos, pos + m_size, lineWidth, border );
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
field.Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
|
||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||
sheetPin->Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
|
||||
if( GetDNP() )
|
||||
{
|
||||
BOX2I bbox = GetBodyBoundingBox();
|
||||
BOX2I pins = GetBoundingBox();
|
||||
COLOR4D dnp_color = aSettings->GetLayerColor( LAYER_DNP_MARKER );
|
||||
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
|
||||
std::max( bbox.GetY() - pins.GetY(),
|
||||
pins.GetEnd().y - bbox.GetEnd().y ) );
|
||||
|
||||
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
|
||||
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
|
||||
bbox.Inflate( KiROUND( margins.x ), KiROUND( margins.y ) );
|
||||
|
||||
GRFilledSegment( DC, bbox.GetOrigin(), bbox.GetEnd(),
|
||||
3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
|
||||
dnp_color );
|
||||
|
||||
GRFilledSegment( DC, bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
|
||||
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
|
||||
3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
|
||||
dnp_color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCH_SHEET& SCH_SHEET::operator=( const SCH_ITEM& aItem )
|
||||
{
|
||||
wxCHECK_MSG( Type() == aItem.Type(), *this,
|
||||
|
@ -407,12 +407,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -65,14 +65,6 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET_PIN::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
|
||||
SCH_HIERLABEL::Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SHEET_PIN::SwapData( SCH_ITEM* aItem )
|
||||
{
|
||||
SCH_HIERLABEL::SwapData( aItem );
|
||||
|
@ -105,9 +105,6 @@ public:
|
||||
*/
|
||||
bool IsMovableFromAnchorPoint() const override { return true; }
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
/**
|
||||
* Calculate the graphic shape (a polygon) associated to the text.
|
||||
*
|
||||
|
@ -456,100 +456,6 @@ bool SCH_SYMBOL::HasUnitDisplayName( int aUnit ) const
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed )
|
||||
{
|
||||
wxCHECK( m_part, /* void */ );
|
||||
|
||||
SCH_RENDER_SETTINGS localRenderSettings( *aSettings );
|
||||
localRenderSettings.m_Transform = m_transform;
|
||||
localRenderSettings.m_ShowVisibleFields = false;
|
||||
localRenderSettings.m_ShowHiddenFields = false;
|
||||
|
||||
if( GetDNP() )
|
||||
aDimmed = true;
|
||||
|
||||
m_part->PrintBackground( &localRenderSettings, m_unit, m_bodyStyle, m_pos + aOffset, aDimmed );
|
||||
}
|
||||
|
||||
|
||||
void SCH_SYMBOL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
SCH_RENDER_SETTINGS localRenderSettings( *aSettings );
|
||||
localRenderSettings.m_Transform = m_transform;
|
||||
localRenderSettings.m_ShowVisibleFields = false;
|
||||
localRenderSettings.m_ShowHiddenFields = false;
|
||||
|
||||
if( m_DNP )
|
||||
aDimmed = true;
|
||||
|
||||
if( m_part )
|
||||
{
|
||||
std::vector<SCH_PIN*> libPins = m_part->GetPins( m_unit, m_bodyStyle );
|
||||
LIB_SYMBOL tempSymbol( *m_part );
|
||||
std::vector<SCH_PIN*> tempPins = tempSymbol.GetPins( m_unit, m_bodyStyle );
|
||||
|
||||
// Copy the pin info from the symbol to the temp pins
|
||||
for( unsigned i = 0; i < tempPins.size(); ++ i )
|
||||
{
|
||||
SCH_PIN* symbolPin = GetPin( libPins[ i ] );
|
||||
SCH_PIN* tempPin = tempPins[ i ];
|
||||
|
||||
tempPin->SetName( symbolPin->GetShownName() );
|
||||
tempPin->SetType( symbolPin->GetType() );
|
||||
tempPin->SetShape( symbolPin->GetShape() );
|
||||
}
|
||||
|
||||
for( SCH_ITEM& item : tempSymbol.GetDrawItems() )
|
||||
{
|
||||
if( EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( &item ) )
|
||||
{
|
||||
// Use SCH_FIELD's text resolver
|
||||
SCH_FIELD dummy( this, -1 );
|
||||
dummy.SetText( text->GetText() );
|
||||
text->SetText( dummy.GetShownText( false ) );
|
||||
}
|
||||
}
|
||||
|
||||
tempSymbol.Print( &localRenderSettings, m_unit, m_bodyStyle, m_pos + aOffset, false,
|
||||
aDimmed );
|
||||
}
|
||||
else // Use a dummy part if the actual cannot be found.
|
||||
{
|
||||
LIB_SYMBOL::GetDummy()->Print( &localRenderSettings, 0, 0, m_pos + aOffset, aForceNoFill,
|
||||
aDimmed );
|
||||
}
|
||||
|
||||
for( SCH_FIELD& field : m_fields )
|
||||
field.Print( &localRenderSettings, m_unit, m_bodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
|
||||
if( m_DNP )
|
||||
{
|
||||
wxDC* DC = localRenderSettings.GetPrintDC();
|
||||
BOX2I bbox = GetBodyBoundingBox();
|
||||
BOX2I pins = GetBodyAndPinsBoundingBox();
|
||||
COLOR4D dnp_color = localRenderSettings.GetLayerColor( LAYER_DNP_MARKER );
|
||||
VECTOR2D margins( std::max( bbox.GetX() - pins.GetX(), pins.GetEnd().x - bbox.GetEnd().x ),
|
||||
std::max( bbox.GetY() - pins.GetY(),
|
||||
pins.GetEnd().y - bbox.GetEnd().y ) );
|
||||
|
||||
margins.x = std::max( margins.x * 0.6, margins.y * 0.3 );
|
||||
margins.y = std::max( margins.y * 0.6, margins.x * 0.3 );
|
||||
bbox.Inflate( KiROUND( margins.x ), KiROUND( margins.y ) );
|
||||
|
||||
GRFilledSegment( DC, bbox.GetOrigin(), bbox.GetEnd(),
|
||||
3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
|
||||
dnp_color );
|
||||
|
||||
GRFilledSegment( DC, bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ),
|
||||
bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ),
|
||||
3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ),
|
||||
dnp_color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool SCH_SYMBOL::GetInstance( SCH_SYMBOL_INSTANCE& aInstance,
|
||||
const KIID_PATH& aSheetPath, bool aTestFromEnd ) const
|
||||
{
|
||||
|
@ -807,26 +807,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
/**
|
||||
* Print a symbol.
|
||||
*
|
||||
* @param aSettings Render settings controlling output
|
||||
* @param aOffset is the drawing offset (usually VECTOR2I(0,0), but can be different when
|
||||
* moving an object)
|
||||
*/
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
/**
|
||||
* Print only the background parts of a symbol (if any)
|
||||
*
|
||||
* @param aSettings Render settings controlling output
|
||||
* @param aOffset is the drawing offset (usually VECTOR2I(0,0), but can be different when
|
||||
* moving an object)
|
||||
*/
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -252,137 +252,6 @@ void SCH_TABLE::RunOnChildren( const std::function<void( SCH_ITEM* )>& aFunction
|
||||
}
|
||||
|
||||
|
||||
void SCH_TABLE::PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed )
|
||||
{
|
||||
for( SCH_TABLECELL* cell : m_cells )
|
||||
cell->PrintBackground( aSettings, aUnit, aBodyStyle, aOffset, aDimmed );
|
||||
}
|
||||
|
||||
|
||||
void SCH_TABLE::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
for( SCH_TABLECELL* cell : m_cells )
|
||||
cell->Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
VECTOR2I pos = GetPosition();
|
||||
VECTOR2I end = GetEnd();
|
||||
int lineWidth;
|
||||
COLOR4D color;
|
||||
LINE_STYLE lineStyle;
|
||||
|
||||
auto setupStroke =
|
||||
[&]( const STROKE_PARAMS& stroke )
|
||||
{
|
||||
lineWidth = stroke.GetWidth();
|
||||
color = stroke.GetColor();
|
||||
lineStyle = stroke.GetLineStyle();
|
||||
|
||||
if( lineWidth == 0 )
|
||||
lineWidth = aSettings->GetDefaultPenWidth();
|
||||
|
||||
if( color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( LAYER_NOTES );
|
||||
|
||||
if( lineStyle == LINE_STYLE::DEFAULT )
|
||||
lineStyle = LINE_STYLE::SOLID;
|
||||
};
|
||||
|
||||
auto strokeShape =
|
||||
[&]( const SHAPE& shape )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( &shape, lineStyle, lineWidth, aSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
GRLine( DC, a.x, a.y, b.x, b.y, lineWidth, color );
|
||||
} );
|
||||
};
|
||||
|
||||
auto strokeLine =
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
|
||||
{
|
||||
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
|
||||
{
|
||||
GRLine( DC, ptA.x, ptA.y, ptB.x, ptB.y, lineWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_SEGMENT seg( ptA, ptB );
|
||||
strokeShape( seg );
|
||||
}
|
||||
};
|
||||
|
||||
auto strokeRect =
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
|
||||
{
|
||||
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
|
||||
{
|
||||
GRRect( DC, ptA, ptB, lineWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
SHAPE_RECT rect( BOX2I( ptA, ptB - ptA ) );
|
||||
strokeShape( rect );
|
||||
}
|
||||
};
|
||||
|
||||
if( GetSeparatorsStroke().GetWidth() >= 0 )
|
||||
{
|
||||
setupStroke( GetSeparatorsStroke() );
|
||||
|
||||
if( StrokeColumns() )
|
||||
{
|
||||
for( int col = 0; col < GetColCount() - 1; ++col )
|
||||
{
|
||||
for( int row = 0; row < GetRowCount(); ++row )
|
||||
{
|
||||
SCH_TABLECELL* cell = GetCell( row, col );
|
||||
|
||||
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
|
||||
{
|
||||
strokeLine( VECTOR2I( cell->GetEndX(), cell->GetStartY() ),
|
||||
VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( StrokeRows() )
|
||||
{
|
||||
for( int row = 0; row < GetRowCount() - 1; ++row )
|
||||
{
|
||||
for( int col = 0; col < GetColCount(); ++col )
|
||||
{
|
||||
SCH_TABLECELL* cell = GetCell( row, 0 );
|
||||
|
||||
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
|
||||
{
|
||||
strokeLine( VECTOR2I( cell->GetStartX(), cell->GetEndY() ),
|
||||
VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( GetBorderStroke().GetWidth() >= 0 )
|
||||
{
|
||||
setupStroke( GetBorderStroke() );
|
||||
|
||||
if( StrokeHeader() )
|
||||
{
|
||||
SCH_TABLECELL* cell = GetCell( 0, 0 );
|
||||
strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
|
||||
}
|
||||
|
||||
if( StrokeExternal() )
|
||||
strokeRect( pos, end );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const BOX2I SCH_TABLE::GetBoundingBox() const
|
||||
{
|
||||
// Note: a table with no cells is not allowed
|
||||
|
@ -218,12 +218,6 @@ public:
|
||||
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -95,14 +95,6 @@ wxString SCH_TABLECELL::GetAddr() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_TABLECELL::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
if( m_colSpan >= 1 && m_rowSpan >= 1 )
|
||||
SCH_TEXTBOX::Print( aSettings, aUnit, aBodyStyle, aOffset, aForceNoFill, aDimmed );
|
||||
}
|
||||
|
||||
|
||||
void SCH_TABLECELL::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
|
||||
{
|
||||
|
@ -64,9 +64,6 @@ public:
|
||||
int GetRowSpan() const { return m_rowSpan; }
|
||||
void SetRowSpan( int aSpan ) { m_rowSpan = aSpan; }
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -296,92 +296,6 @@ KIFONT::FONT* SCH_TEXT::getDrawFont() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXT::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
COLOR4D color = GetTextColor();
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
|
||||
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( m_layer );
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( !IsVisible() )
|
||||
bg = aSettings->GetLayerColor( LAYER_HIDDEN );
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
KIFONT::FONT* font = GetFont();
|
||||
|
||||
if( !font )
|
||||
font = KIFONT::FONT::GetFont( aSettings->GetDefaultFont(), IsBold(), IsItalic() );
|
||||
|
||||
if( m_layer == LAYER_DEVICE )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||
|
||||
// Calculate the text orientation, according to the symbol orientation/mirror (needed when
|
||||
// draw text in schematic)
|
||||
EDA_ANGLE orient = GetTextAngle();
|
||||
|
||||
if( aSettings->m_Transform.y1 ) // Rotate symbol 90 degrees.
|
||||
{
|
||||
if( orient == ANGLE_HORIZONTAL )
|
||||
orient = ANGLE_VERTICAL;
|
||||
else
|
||||
orient = ANGLE_HORIZONTAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the text justification, according to the symbol orientation/mirror.
|
||||
* This is a bit complicated due to cumulative calculations:
|
||||
* - numerous cases (mirrored or not, rotation)
|
||||
* - the GRText function will also recalculate H and V justifications according to the text
|
||||
* orientation.
|
||||
* - When a symbol is mirrored, the text is not mirrored and justifications are complicated
|
||||
* to calculate so the more easily way is to use no justifications (centered text) and
|
||||
* use GetBoundingBox to know the text coordinate considered as centered
|
||||
*/
|
||||
BOX2I bBox = GetBoundingBox();
|
||||
VECTOR2I txtpos = bBox.Centre();
|
||||
|
||||
// Calculate pos according to mirror/rotation.
|
||||
txtpos = aSettings->m_Transform.TransformCoordinate( txtpos ) + aOffset;
|
||||
|
||||
GRPrintText( DC, txtpos, color, GetShownText( true ), orient, GetTextSize(),
|
||||
GR_TEXT_H_ALIGN_CENTER, GR_TEXT_V_ALIGN_CENTER, penWidth, IsItalic(),
|
||||
IsBold(), font, GetFontMetrics() );
|
||||
}
|
||||
else
|
||||
{
|
||||
VECTOR2I text_offset = aOffset + GetSchematicTextOffset( aSettings );
|
||||
|
||||
// Adjust text drawn in an outline font to more closely mimic the positioning of
|
||||
// SCH_FIELD text.
|
||||
if( font->IsOutline() )
|
||||
{
|
||||
BOX2I firstLineBBox = GetTextBox( 0 );
|
||||
int sizeDiff = firstLineBBox.GetHeight() - GetTextSize().y;
|
||||
int adjust = KiROUND( sizeDiff * 0.4 );
|
||||
VECTOR2I adjust_offset( 0, - adjust );
|
||||
|
||||
RotatePoint( adjust_offset, GetDrawRotation() );
|
||||
text_offset += adjust_offset;
|
||||
}
|
||||
|
||||
EDA_TEXT::Print( aSettings, text_offset, color );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const BOX2I SCH_TEXT::GetBoundingBox() const
|
||||
{
|
||||
BOX2I bbox = GetTextBox();
|
||||
|
@ -147,12 +147,6 @@ public:
|
||||
bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
|
||||
bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void PrintBackground( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aDimmed ) override {}
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -265,82 +265,6 @@ KIFONT::FONT* SCH_TEXTBOX::getDrawFont() const
|
||||
}
|
||||
|
||||
|
||||
void SCH_TEXTBOX::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed )
|
||||
{
|
||||
if( IsPrivate() )
|
||||
return;
|
||||
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
int penWidth = GetEffectivePenWidth( aSettings );
|
||||
bool blackAndWhiteMode = GetGRForceBlackPenState();
|
||||
VECTOR2I pt1 = GetStart();
|
||||
VECTOR2I pt2 = GetEnd();
|
||||
COLOR4D color = GetStroke().GetColor();
|
||||
COLOR4D bg = aSettings->GetBackgroundColor();
|
||||
LINE_STYLE lineStyle = GetStroke().GetLineStyle();
|
||||
|
||||
if( bg == COLOR4D::UNSPECIFIED || GetGRForceBlackPenState() )
|
||||
bg = COLOR4D::WHITE;
|
||||
|
||||
if( GetFillMode() == FILL_T::FILLED_WITH_COLOR && !blackAndWhiteMode && !aForceNoFill )
|
||||
GRFilledRect( DC, pt1, pt2, 0, GetFillColor(), GetFillColor() );
|
||||
|
||||
if( penWidth > 0 )
|
||||
{
|
||||
penWidth = std::max( penWidth, aSettings->GetMinPenWidth() );
|
||||
|
||||
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( m_layer );
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
if( lineStyle == LINE_STYLE::DEFAULT )
|
||||
lineStyle = LINE_STYLE::SOLID;
|
||||
|
||||
if( lineStyle == LINE_STYLE::SOLID )
|
||||
{
|
||||
GRRect( DC, pt1, pt2, penWidth, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAPE*> shapes = MakeEffectiveShapes( true );
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
{
|
||||
STROKE_PARAMS::Stroke( shape, lineStyle, penWidth, aSettings,
|
||||
[&]( const VECTOR2I& a, const VECTOR2I& b )
|
||||
{
|
||||
VECTOR2I ptA = aSettings->TransformCoordinate( a ) + aOffset;
|
||||
VECTOR2I ptB = aSettings->TransformCoordinate( b ) + aOffset;
|
||||
GRLine( DC, ptA.x, ptA.y, ptB.x, ptB.y, penWidth, color );
|
||||
} );
|
||||
}
|
||||
|
||||
for( SHAPE* shape : shapes )
|
||||
delete shape;
|
||||
}
|
||||
}
|
||||
|
||||
color = GetTextColor();
|
||||
|
||||
if( blackAndWhiteMode || color == COLOR4D::UNSPECIFIED )
|
||||
color = aSettings->GetLayerColor( m_layer );
|
||||
|
||||
if( aDimmed )
|
||||
{
|
||||
color.Desaturate( );
|
||||
color = color.Mix( bg, 0.5f );
|
||||
}
|
||||
|
||||
EDA_TEXT::Print( aSettings, aOffset, color );
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_TEXTBOX::GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
int aDepth ) const
|
||||
{
|
||||
|
@ -125,9 +125,6 @@ public:
|
||||
|
||||
BITMAPS GetMenuImage() const override;
|
||||
|
||||
void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
|
||||
const VECTOR2I& offset, bool aForceNoFill, bool aDimmed ) override;
|
||||
|
||||
void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
|
||||
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
|
||||
|
||||
|
@ -623,7 +623,6 @@ bool SCH_EDIT_FRAME::EditSheetProperties( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHi
|
||||
|
||||
void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
|
||||
{
|
||||
bool useCairo = ADVANCED_CFG::GetCfg().m_EnableEeschemaExportClipboardCairo;;
|
||||
wxRect drawArea;
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
@ -677,30 +676,25 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
|
||||
|
||||
cfg->SetDefaultFont( eeconfig()->m_Appearance.default_font );
|
||||
|
||||
if( useCairo )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
dc.SetUserScale( 1.0, 1.0 );
|
||||
SCH_PRINTOUT printout( this, wxEmptyString, true );
|
||||
// Ensure title block will be when printed on clipboard, regardless
|
||||
// the current Cairo print option
|
||||
EESCHEMA_SETTINGS* eecfg = eeconfig();
|
||||
bool print_tb_opt = eecfg->m_Printing.title_block;
|
||||
eecfg->m_Printing.title_block = true;
|
||||
bool success = printout.PrintPage( GetScreen(), cfg->GetPrintDC(), false );
|
||||
eecfg->m_Printing.title_block = print_tb_opt;
|
||||
dc.SetUserScale( 1.0, 1.0 );
|
||||
SCH_PRINTOUT printout( this, wxEmptyString, true );
|
||||
// Ensure title block will be when printed on clipboard, regardless
|
||||
// the current Cairo print option
|
||||
EESCHEMA_SETTINGS* eecfg = eeconfig();
|
||||
bool print_tb_opt = eecfg->m_Printing.title_block;
|
||||
eecfg->m_Printing.title_block = true;
|
||||
bool success = printout.PrintPage( GetScreen(), cfg->GetPrintDC(), false );
|
||||
eecfg->m_Printing.title_block = print_tb_opt;
|
||||
|
||||
if( !success )
|
||||
wxLogMessage( _( "Cannot create the schematic image") );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogMessage( "printout internal error" );
|
||||
}
|
||||
if( !success )
|
||||
wxLogMessage( _( "Cannot create the schematic image") );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
wxLogMessage( "printout internal error" );
|
||||
}
|
||||
else
|
||||
PrintPage( cfg );
|
||||
|
||||
// Deselect Bitmap from DC before using the bitmap
|
||||
dc.SelectObject( wxNullBitmap );
|
||||
|
@ -316,11 +316,6 @@ public:
|
||||
*/
|
||||
bool LoadSymbol( const LIB_ID& aLibId, int aUnit, int aBodyStyle );
|
||||
|
||||
/**
|
||||
* Print a page.
|
||||
*/
|
||||
void PrintPage( const RENDER_SETTINGS* aSettings ) override;
|
||||
|
||||
/**
|
||||
* Create the SVG print file for the current edited symbol.
|
||||
* @param aFullFileName is the full filename
|
||||
|
@ -74,17 +74,3 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName, const VECT
|
||||
plotter->EndPlot();
|
||||
delete plotter;
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
if( !m_symbol )
|
||||
return;
|
||||
|
||||
const SCH_RENDER_SETTINGS* cfg = static_cast<const SCH_RENDER_SETTINGS*>( aSettings );
|
||||
VECTOR2I pagesize = GetScreen()->GetPageSettings().GetSizeIU( schIUScale.IU_PER_MILS );
|
||||
|
||||
// Print item centered to the page.
|
||||
m_symbol->PrintBackground( cfg, m_unit, m_bodyStyle, pagesize / 2, false );
|
||||
m_symbol->Print( cfg, m_unit, m_bodyStyle, pagesize / 2, false, false );
|
||||
}
|
||||
|
@ -524,24 +524,6 @@ public:
|
||||
*/
|
||||
bool m_EnableLibDir;
|
||||
|
||||
/**
|
||||
* Enable Eeschema printing using Cairo.
|
||||
*
|
||||
* Setting name: "EnableEeschemaPrintCairo"
|
||||
* Valid values: 0 or 1
|
||||
* Default value: 1
|
||||
*/
|
||||
bool m_EnableEeschemaPrintCairo;
|
||||
|
||||
/**
|
||||
* Enable Eeschema Export to clipboard using Cairo.
|
||||
*
|
||||
* Setting name: "EnableEeschemaExportClipboardCairo"
|
||||
* Valid values: 0 or 1
|
||||
* Default value: 1
|
||||
*/
|
||||
bool m_EnableEeschemaExportClipboardCairo;
|
||||
|
||||
/**
|
||||
* Board object selection visibility limit.
|
||||
*
|
||||
|
@ -428,13 +428,6 @@ public:
|
||||
*/
|
||||
virtual EDA_ITEM* GetItem( const KIID& aId ) const { return nullptr; }
|
||||
|
||||
/**
|
||||
* Print the page pointed by current screen, set by the calling print function.
|
||||
*
|
||||
* @param aDC wxDC given by the calling print function
|
||||
*/
|
||||
virtual void PrintPage( const RENDER_SETTINGS* aSettings );
|
||||
|
||||
/**
|
||||
* Use to start up the GAL drawing canvas.
|
||||
*/
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
MARKER_BASE( int aScalingFactor, std::shared_ptr<RC_ITEM> aItem,
|
||||
MARKER_T aType = MARKER_UNSPEC );
|
||||
virtual ~MARKER_BASE();
|
||||
virtual ~MARKER_BASE() {};
|
||||
|
||||
/**
|
||||
* The scaling factor to convert polygonal shape coordinates to internal units.
|
||||
@ -77,11 +77,6 @@ public:
|
||||
*/
|
||||
void ShapeToPolygon( SHAPE_LINE_CHAIN& aPolygon, int aScale = -1 ) const;
|
||||
|
||||
/**
|
||||
* Print the shape is the polygon defined in m_Corners (array of VECTOR2Is).
|
||||
*/
|
||||
void PrintMarker( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset );
|
||||
|
||||
/**
|
||||
* @return the position of this marker in internal units.
|
||||
*/
|
||||
|
@ -798,29 +798,6 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
|
||||
}
|
||||
|
||||
|
||||
void PL_EDITOR_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
||||
{
|
||||
GetScreen()->SetVirtualPageNumber( GetPageNumberOption() ? 1 : 2 );
|
||||
DS_DATA_MODEL& model = DS_DATA_MODEL::GetTheInstance();
|
||||
|
||||
for( DS_DATA_ITEM* dataItem : model.GetItems() )
|
||||
{
|
||||
// Ensure the scaling factor (used only in printing) of bitmaps is up to date
|
||||
if( dataItem->GetType() == DS_DATA_ITEM::DS_BITMAP )
|
||||
{
|
||||
BITMAP_BASE* bitmap = static_cast<DS_DATA_ITEM_BITMAP*>( dataItem )->m_ImageBitmap;
|
||||
bitmap->SetPixelSizeIu( drawSheetIUScale.IU_PER_MILS * 1000 / bitmap->GetPPI() );
|
||||
}
|
||||
}
|
||||
|
||||
PrintDrawingSheet( aSettings, GetScreen(), nullptr, drawSheetIUScale.IU_PER_MILS,
|
||||
wxEmptyString );
|
||||
|
||||
GetCanvas()->DisplayDrawingSheet();
|
||||
GetCanvas()->Refresh();
|
||||
}
|
||||
|
||||
|
||||
PL_DRAW_PANEL_GAL* PL_EDITOR_FRAME::GetCanvas() const
|
||||
{
|
||||
return static_cast<PL_DRAW_PANEL_GAL*>( EDA_DRAW_FRAME::GetCanvas() );
|
||||
|
@ -188,13 +188,6 @@ public:
|
||||
|
||||
void Files_io( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Print a page.
|
||||
*
|
||||
* @param aDC is the device context used by the print function.
|
||||
*/
|
||||
virtual void PrintPage( const RENDER_SETTINGS* aSettings ) override;
|
||||
|
||||
void OnFileHistory( wxCommandEvent& event );
|
||||
void OnClearFileHistory( wxCommandEvent& aEvent );
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user