7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 21:23:25 +00:00

RIP LIB_TEXTBOX and LIB_SHAPE.

This commit is contained in:
Jeff Young 2024-04-15 21:18:54 +01:00
parent 3efe504dcc
commit d761b4f22f
78 changed files with 3429 additions and 10132 deletions
common
eeschema
CMakeLists.txt
api
dialogs
gfx_import_utils.cpp
import_gfx
lib_pin.cpplib_pin.hlib_shape.cpplib_shape.hlib_symbol.cpplib_symbol.hlib_textbox.cpplib_textbox.hsch_field.h
sch_io
sch_painter.cppsch_painter.hsch_shape.cppsch_shape.hsch_symbol.cppsch_tablecell.cppsch_text.cppsch_textbox.cppsch_textbox.hsymbol_checker.cpp
tools
include
pcbnew
qa

View File

@ -75,8 +75,6 @@ KICAD_T FromProtoEnum( types::KiCadObjectType aValue )
case types::KiCadObjectType::KOT_SCH_SHEET: return SCH_SHEET_T;
case types::KiCadObjectType::KOT_SCH_PIN: return SCH_PIN_T;
case types::KiCadObjectType::KOT_LIB_SYMBOL: return LIB_SYMBOL_T;
// case types::KiCadObjectType::KOT_LIB_SHAPE: return LIB_SHAPE_T;
// case types::KiCadObjectType::KOT_LIB_TEXTBOX: return LIB_TEXTBOX_T;
// case types::KiCadObjectType::KOT_LIB_PIN: return LIB_PIN_T;
case types::KiCadObjectType::KOT_WSG_LINE: return WSG_LINE_T;
case types::KiCadObjectType::KOT_WSG_RECT: return WSG_RECT_T;
@ -137,8 +135,6 @@ types::KiCadObjectType ToProtoEnum( KICAD_T aValue )
case SCH_SHEET_T: return types::KiCadObjectType::KOT_SCH_SHEET;
case SCH_PIN_T: return types::KiCadObjectType::KOT_SCH_PIN;
case LIB_SYMBOL_T: return types::KiCadObjectType::KOT_LIB_SYMBOL;
// case LIB_SHAPE_T: return types::KiCadObjectType::KOT_LIB_SHAPE;
// case LIB_TEXTBOX_T: return types::KiCadObjectType::KOT_LIB_TEXTBOX;
// case LIB_PIN_T: return types::KiCadObjectType::KOT_LIB_PIN;
case WSG_LINE_T: return types::KiCadObjectType::KOT_WSG_LINE;
case WSG_RECT_T: return types::KiCadObjectType::KOT_WSG_RECT;

View File

@ -396,8 +396,6 @@ static struct EDA_ITEM_DESC
.Map( SCH_SCREEN_T, _HKI( "SCH Screen" ) )
.Map( LIB_SYMBOL_T, _HKI( "Symbol" ) )
.Map( LIB_SHAPE_T, _HKI( "Graphic" ) )
.Map( LIB_TEXTBOX_T, _HKI( "Text Box" ) )
.Map( LIB_PIN_T, _HKI( "Pin" ) )
.Map( GERBER_LAYOUT_T, _HKI( "Gerber Layout" ) )

View File

@ -5,7 +5,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2023 CERN
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -701,7 +701,7 @@ void EDA_SHAPE::SetArcAngleAndEnd( const EDA_ANGLE& aAngle, bool aCheckNegativeA
}
wxString EDA_SHAPE::GetFriendlyName() const
wxString EDA_SHAPE::getFriendlyName() const
{
if( IsProxyItem() )
{
@ -733,7 +733,7 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
wxString msg;
wxString shape = _( "Shape" );
aList.emplace_back( shape, GetFriendlyName() );
aList.emplace_back( shape, getFriendlyName() );
switch( m_shape )
{
@ -1322,12 +1322,7 @@ void EDA_SHAPE::DupPolyPointsList( std::vector<VECTOR2I>& aBuffer ) const
bool EDA_SHAPE::IsPolyShapeValid() const
{
// return true if the polygonal shape is valid (has more than 2 points)
if( GetPolyShape().OutlineCount() == 0 )
return false;
const SHAPE_LINE_CHAIN& outline = static_cast<const SHAPE_POLY_SET&>( GetPolyShape() ).Outline( 0 );
return outline.PointCount() > 2;
return GetPolyShape().OutlineCount() > 0 && GetPolyShape().Outline( 0 ).PointCount() > 2;
}
@ -1335,10 +1330,7 @@ int EDA_SHAPE::GetPointCount() const
{
// return the number of corners of the polygonal shape
// this shape is expected to be only one polygon without hole
if( GetPolyShape().OutlineCount() )
return GetPolyShape().VertexCount( 0 );
return 0;
return GetPolyShape().OutlineCount() ? GetPolyShape().VertexCount( 0 ) : 0;
}

View File

@ -123,12 +123,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_lib_edit_pin_table_base.cpp
dialogs/dialog_lib_new_symbol.cpp
dialogs/dialog_lib_new_symbol_base.cpp
dialogs/dialog_lib_shape_properties.cpp
dialogs/dialog_lib_shape_properties_base.cpp
dialogs/dialog_lib_symbol_properties.cpp
dialogs/dialog_lib_symbol_properties_base.cpp
dialogs/dialog_lib_textbox_properties.cpp
dialogs/dialog_lib_textbox_properties_base.cpp
dialogs/dialog_line_properties.cpp
dialogs/dialog_line_properties_base.cpp
dialogs/dialog_migrate_buses.cpp
@ -360,9 +356,7 @@ set( EESCHEMA_SRCS
gfx_import_utils.cpp
picksymbol.cpp
lib_pin.cpp
lib_shape.cpp
lib_symbol.cpp
lib_textbox.cpp
libarch.cpp
menubar.cpp
net_navigator.cpp

View File

@ -19,9 +19,7 @@
*/
#include <lib_pin.h>
#include <lib_shape.h>
#include <lib_symbol.h>
#include <lib_textbox.h>
#include <sch_bitmap.h>
#include <sch_bus_entry.h>
#include <sch_field.h>
@ -91,8 +89,6 @@ std::unique_ptr<EDA_ITEM> CreateItemForType( KICAD_T aType, EDA_ITEM* aContainer
}
case LIB_SYMBOL_T: return nullptr; // TODO: ctor currently requires non-null name
case LIB_SHAPE_T: return std::make_unique<LIB_SHAPE>( parentLibSymbol );
case LIB_TEXTBOX_T: return std::make_unique<LIB_TEXTBOX>( parentLibSymbol );
case LIB_PIN_T: return std::make_unique<LIB_PIN>( parentLibSymbol );
default:

View File

@ -1,307 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dialog_lib_shape_properties.h>
#include <symbol_edit_frame.h>
#include <symbol_editor_settings.h>
#include <confirm.h>
#include <lib_shape.h>
#include <widgets/color_swatch.h>
#include <settings/color_settings.h>
#include <sch_painter.h>
DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_SHAPE* aShape ) :
DIALOG_LIB_SHAPE_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_shape( aShape ),
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true )
{
wxASSERT( aShape );
SetTitle( wxString::Format( GetTitle(), aShape->EDA_SHAPE::GetFriendlyName() ) );
m_helpLabel->SetFont( KIUI::GetInfoFont( this ).Italic() );
COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
m_borderStyleCombo->Append( DEFAULT_STYLE );
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_fillColorSwatch->SetSwatchBackground( schematicBackground );
m_helpLabel->SetFont( KIUI::GetInfoFont( this ).Italic() );
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
SetInitialFocus( m_borderWidthCtrl );
// Required under wxGTK if we want to dismiss the dialog with the ESC key
SetFocus();
SetupStandardButtons();
if( !aParent->IsSymbolEditable() || aParent->IsSymbolAlias() )
{
m_sdbSizerCancel->SetDefault();
m_sdbSizerOK->SetLabel( _( "Read Only" ) );
m_sdbSizerOK->Enable( false );
}
m_borderColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onBorderSwatch, this );
m_fillColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onFillSwatch, this );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
DIALOG_LIB_SHAPE_PROPERTIES::~DIALOG_LIB_SHAPE_PROPERTIES()
{
m_borderColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onBorderSwatch, this );
m_fillColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_LIB_SHAPE_PROPERTIES::onFillSwatch, this );
}
bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
const SYMBOL* symbol = m_shape->GetParentSymbol();
m_checkBorder->SetValue( m_shape->GetWidth() >= 0 );
if( m_shape->GetWidth() >= 0 )
m_borderWidth.SetValue( m_shape->GetWidth() );
m_borderWidth.Enable( m_shape->GetWidth() >= 0 );
m_helpLabel->Enable( m_shape->GetWidth() >= 0 );
m_borderColorLabel->Enable( m_shape->GetWidth() >= 0 );
m_borderColorSwatch->Enable( m_shape->GetWidth() >= 0 );
m_borderStyleLabel->Enable( m_shape->GetWidth() >= 0 );
m_borderStyleCombo->Enable( m_shape->GetWidth() >= 0 );
m_borderColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false );
int style = static_cast<int>( m_shape->GetStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_borderStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_privateCheckbox->SetValue( m_shape->IsPrivate() );
m_checkApplyToAllUnits->SetValue(
symbol && symbol->GetUnitCount() > 1 && m_shape->GetUnit() == 0 );
m_checkApplyToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 );
m_checkApplyToAllBodyStyles->SetValue( m_shape->GetBodyStyle() == 0 );
bool enableAlternateBodyStyle = symbol && symbol->HasAlternateBodyStyle();
// If a symbol contains no body-style-specific pins or graphic items,
// symbol->HasAlternateBodyStyle() will return false.
// But when creating a new symbol, with DeMorgan option set, the m_checkApplyToAllBodyStyles
// must be enabled in order to be able to create graphic items shared by all body styles.
if( m_frame->GetShowDeMorgan() )
enableAlternateBodyStyle = true;
m_checkApplyToAllBodyStyles->Enable( enableAlternateBodyStyle );
m_rbFillNone->Enable( true );
m_rbFillOutline->Enable( true );
m_rbFillBackground->Enable( true );
m_rbFillCustom->Enable( true );
m_fillColorSwatch->Enable( true );
if( m_shape->GetFillMode() == FILL_T::FILLED_SHAPE )
{
m_rbFillOutline->SetValue( true );
COLOR4D color = m_shape->GetStroke().GetColor();
if( color == COLOR4D::UNSPECIFIED )
color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
m_fillColorSwatch->SetSwatchColor( color, false );
}
else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
{
m_rbFillBackground->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
m_fillColorSwatch->SetSwatchColor( color, false );
}
else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
{
m_rbFillCustom->SetValue( true );
m_fillColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
}
else
{
m_rbFillNone->SetValue( true );
m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
return true;
}
void DIALOG_LIB_SHAPE_PROPERTIES::onFill( wxCommandEvent& event )
{
if( event.GetId() == NO_FILL )
{
m_rbFillNone->SetValue( true );
m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
else if( event.GetId() == FILLED_SHAPE )
{
m_rbFillOutline->SetValue( true );
COLOR4D color = m_shape->GetStroke().GetColor();
if( color == COLOR4D::UNSPECIFIED )
color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
m_fillColorSwatch->SetSwatchColor( color, false );
}
else if( event.GetId() == FILLED_WITH_BG_BODYCOLOR )
{
m_rbFillBackground->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
m_fillColorSwatch->SetSwatchColor( color, false );
}
else if( event.GetId() == FILLED_WITH_COLOR )
{
m_rbFillCustom->SetValue( true );
m_fillColorSwatch->GetNewSwatchColor();
}
}
void DIALOG_LIB_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
{
bool border = m_checkBorder->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( schIUScale.MilsToIU( m_frame->libeditconfig()->m_Defaults.line_width ) );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );
m_borderColorSwatch->Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
}
void DIALOG_LIB_SHAPE_PROPERTIES::onBorderSwatch( wxCommandEvent& aEvent )
{
if( m_rbFillOutline->GetValue() )
m_fillColorSwatch->SetSwatchColor( m_borderColorSwatch->GetSwatchColor(), false );
}
void DIALOG_LIB_SHAPE_PROPERTIES::onFillSwatch( wxCommandEvent& aEvent )
{
m_rbFillCustom->SetValue( true );
}
bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() )
return false;
STROKE_PARAMS stroke = m_shape->GetStroke();
if( m_checkBorder->GetValue() )
{
if( !m_borderWidth.IsIndeterminate() )
stroke.SetWidth( m_borderWidth.GetValue() );
}
else
{
stroke.SetWidth( -1 );
}
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
m_shape->SetStroke( stroke );
if( m_rbFillOutline->GetValue() )
m_shape->SetFillMode( FILL_T::FILLED_SHAPE );
else if( m_rbFillBackground->GetValue() )
m_shape->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
else if( m_rbFillCustom->GetValue() )
m_shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
else
m_shape->SetFillMode( FILL_T::NO_FILL );
m_shape->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
m_shape->SetPrivate( m_privateCheckbox->GetValue() );
if( GetApplyToAllConversions() )
m_shape->SetBodyStyle( 0 );
else
m_shape->SetBodyStyle( m_frame->GetBodyStyle() );
if( GetApplyToAllUnits() )
m_shape->SetUnit( 0 );
else
m_shape->SetUnit( m_frame->GetUnit() );
return true;
}
bool DIALOG_LIB_SHAPE_PROPERTIES::GetApplyToAllConversions()
{
return m_checkApplyToAllBodyStyles->IsChecked();
}
bool DIALOG_LIB_SHAPE_PROPERTIES::GetApplyToAllUnits()
{
return m_checkApplyToAllUnits->IsChecked();
}

View File

@ -1,64 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2014-2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_LIB_SHAPE_PROPERTIES_H
#define DIALOG_LIB_SHAPE_PROPERTIES_H
class LIB_SHAPE;
class SYMBOL_EDIT_FRAME;
#include <dialog_lib_shape_properties_base.h>
#include <widgets/unit_binder.h>
/**
* Dialog to edit library component graphic items.
*/
class DIALOG_LIB_SHAPE_PROPERTIES : public DIALOG_LIB_SHAPE_PROPERTIES_BASE
{
public:
/** Constructor */
DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_SHAPE* aShape );
~DIALOG_LIB_SHAPE_PROPERTIES();
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
bool GetApplyToAllConversions();
bool GetApplyToAllUnits();
private:
void onBorderChecked( wxCommandEvent& aEvent ) override;
void onBorderSwatch( wxCommandEvent& aEvent );
void onFill(wxCommandEvent &aEvent) override;
void onFillSwatch( wxCommandEvent& aEvent );
private:
SYMBOL_EDIT_FRAME* m_frame;
LIB_SHAPE* m_shape;
UNIT_BINDER m_borderWidth;
};
#endif // DIALOG_LIB_SHAPE_PROPERTIES_H

View File

@ -1,182 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/color_swatch.h"
#include "widgets/wx_infobar.h"
#include "dialog_lib_shape_properties_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_LIB_SHAPE_PROPERTIES_BASE, DIALOG_SHIM )
EVT_CHECKBOX( wxID_ANY, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onBorderChecked )
EVT_RADIOBUTTON( NO_FILL, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_SHAPE, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_WITH_BG_BODYCOLOR, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_WITH_COLOR, DIALOG_LIB_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
END_EVENT_TABLE()
DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
m_infoBar = new WX_INFOBAR( this );
m_infoBar->SetShowHideEffects( wxSHOW_EFFECT_NONE, wxSHOW_EFFECT_NONE );
m_infoBar->SetEffectDuration( 500 );
m_infoBar->Hide();
mainSizer->Add( m_infoBar, 0, wxEXPAND, 5 );
wxBoxSizer* bTop;
bTop = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftCol;
bLeftCol = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* gbSizer2;
gbSizer2 = new wxGridBagSizer( 3, 0 );
gbSizer2->SetFlexibleDirection( wxBOTH );
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_checkBorder = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkBorder, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT, 5 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
gbSizer2->Add( m_borderWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer7->Add( m_borderWidthCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
bSizer7->Add( m_borderWidthUnits, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 3 );
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
bSizer7->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer7->Add( 5, 0, 0, 0, 5 );
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxVERTICAL );
m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer22->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelBorderColor->SetSizer( bSizer22 );
m_panelBorderColor->Layout();
bSizer22->Fit( m_panelBorderColor );
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
gbSizer2->Add( bSizer7, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
gbSizer2->Add( m_borderStyleLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) );
gbSizer2->Add( m_borderStyleCombo, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_helpLabel = new wxStaticText( this, wxID_ANY, _("Set border width to 0 to use schematic's default symbol line width."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel->Wrap( 320 );
gbSizer2->Add( m_helpLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT|wxLEFT, 5 );
bLeftCol->Add( gbSizer2, 1, wxEXPAND, 5 );
bTop->Add( bLeftCol, 1, wxEXPAND|wxRIGHT, 30 );
wxBoxSizer* bRightCol;
bRightCol = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* bSizerFill;
bSizerFill = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fill Style") ), wxVERTICAL );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 3, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_rbFillNone = new wxRadioButton( bSizerFill->GetStaticBox(), NO_FILL, _("Do not fill"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
gbSizer1->Add( m_rbFillNone, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillOutline = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_SHAPE, _("Fill with body outline color"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillOutline, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillBackground = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_WITH_BG_BODYCOLOR, _("Fill with body background color"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillBackground, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillCustom = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, _("Fill with:"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillCustom, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_fillColorSwatch = new COLOR_SWATCH( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_fillColorSwatch, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bSizerFill->Add( gbSizer1, 1, wxEXPAND|wxBOTTOM, 5 );
bRightCol->Add( bSizerFill, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bTop->Add( bRightCol, 1, wxEXPAND|wxLEFT, 30 );
mainSizer->Add( bTop, 1, wxALL|wxEXPAND, 10 );
wxGridSizer* bBottom;
bBottom = new wxGridSizer( 0, 2, 0, 60 );
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to Symbol Editor"), wxDefaultPosition, wxDefaultSize, 0 );
bBottom->Add( m_privateCheckbox, 0, wxALL, 5 );
m_checkApplyToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
bBottom->Add( m_checkApplyToAllUnits, 0, wxALL, 5 );
bBottom->Add( 0, 0, 1, wxEXPAND, 5 );
m_checkApplyToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
bBottom->Add( m_checkApplyToAllBodyStyles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( bBottom, 0, wxEXPAND|wxALL, 10 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
mainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_LIB_SHAPE_PROPERTIES_BASE::~DIALOG_LIB_SHAPE_PROPERTIES_BASE()
{
}

File diff suppressed because it is too large Load Diff

View File

@ -1,94 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class COLOR_SWATCH;
class WX_INFOBAR;
#include "dialog_shim.h"
#include <wx/infobar.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bmpcbox.h>
#include <wx/gbsizer.h>
#include <wx/radiobut.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LIB_SHAPE_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_onBorderChecked( wxCommandEvent& event ){ onBorderChecked( event ); }
void _wxFB_onFill( wxCommandEvent& event ){ onFill( event ); }
protected:
enum
{
NO_FILL = 1000,
FILLED_SHAPE,
FILLED_WITH_BG_BODYCOLOR,
FILLED_WITH_COLOR
};
WX_INFOBAR* m_infoBar;
wxCheckBox* m_checkBorder;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
wxStaticText* m_borderColorLabel;
wxPanel* m_panelBorderColor;
COLOR_SWATCH* m_borderColorSwatch;
wxStaticText* m_borderStyleLabel;
wxBitmapComboBox* m_borderStyleCombo;
wxStaticText* m_helpLabel;
wxRadioButton* m_rbFillNone;
wxRadioButton* m_rbFillOutline;
wxRadioButton* m_rbFillBackground;
wxRadioButton* m_rbFillCustom;
COLOR_SWATCH* m_fillColorSwatch;
wxCheckBox* m_privateCheckbox;
wxCheckBox* m_checkApplyToAllUnits;
wxCheckBox* m_checkApplyToAllBodyStyles;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, override them in your derived class
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFill( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("%s Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_SHAPE_PROPERTIES_BASE();
};

View File

@ -1,395 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <symbol_edit_frame.h>
#include <symbol_editor_settings.h>
#include <widgets/bitmap_button.h>
#include <widgets/font_choice.h>
#include <widgets/color_swatch.h>
#include <base_units.h>
#include <general.h>
#include <settings/color_settings.h>
#include <lib_textbox.h>
#include <confirm.h>
#include <dialogs/html_message_box.h>
#include <string_utils.h>
#include <scintilla_tricks.h>
#include <dialog_lib_textbox_properties.h>
#include "symbol_editor_drawing_tools.h"
#include <gr_text.h>
DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_TEXTBOX* aTextBox ) :
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_currentText( aTextBox ),
m_textSize( aParent, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
m_scintillaTricks( nullptr ),
m_helpWindow( nullptr )
{
COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
m_borderStyleCombo->Append( DEFAULT_STYLE );
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_fillColorSwatch->SetSwatchBackground( schematicBackground );
m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
#ifdef _WIN32
// Without this setting, on Windows, some esoteric unicode chars create display issue
// in a wxStyledTextCtrl.
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
#endif
m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
// onAcceptFn
[this]( wxKeyEvent& aEvent )
{
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
} );
m_textEntrySizer->AddGrowableRow( 0 );
m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_textColorSwatch->SetSwatchBackground( schematicBackground );
SetInitialFocus( m_textCtrl );
m_separator1->SetIsSeparator();
m_bold->SetIsCheckButton();
m_bold->SetBitmap( KiBitmapBundle( BITMAPS::text_bold ) );
m_italic->SetIsCheckButton();
m_italic->SetBitmap( KiBitmapBundle( BITMAPS::text_italic ) );
m_separator2->SetIsSeparator();
m_hAlignLeft->SetIsRadioButton();
m_hAlignLeft->SetBitmap( KiBitmapBundle( BITMAPS::text_align_left ) );
m_hAlignCenter->SetIsRadioButton();
m_hAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_align_center ) );
m_hAlignRight->SetIsRadioButton();
m_hAlignRight->SetBitmap( KiBitmapBundle( BITMAPS::text_align_right ) );
m_separator3->SetIsSeparator();
m_vAlignTop->SetIsRadioButton();
m_vAlignTop->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_top ) );
m_vAlignCenter->SetIsRadioButton();
m_vAlignCenter->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_center ) );
m_vAlignBottom->SetIsRadioButton();
m_vAlignBottom->SetBitmap( KiBitmapBundle( BITMAPS::text_valign_bottom ) );
m_separator4->SetIsSeparator();
m_horizontal->SetIsRadioButton();
m_horizontal->SetBitmap( KiBitmapBundle( BITMAPS::text_horizontal ) );
m_vertical->SetIsRadioButton();
m_vertical->SetBitmap( KiBitmapBundle( BITMAPS::text_vertical ) );
m_separator5->SetIsSeparator();
SetupStandardButtons();
Layout();
m_hAlignLeft->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton, this );
m_hAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton, this );
m_hAlignRight->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton, this );
m_vAlignTop->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton, this );
m_vAlignCenter->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton, this );
m_vAlignBottom->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton, this );
m_horizontal->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onTextAngleButton, this );
m_vertical->Bind( wxEVT_BUTTON, &DIALOG_LIB_TEXTBOX_PROPERTIES::onTextAngleButton, this );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
DIALOG_LIB_TEXTBOX_PROPERTIES::~DIALOG_LIB_TEXTBOX_PROPERTIES()
{
delete m_scintillaTricks;
if( m_helpWindow )
m_helpWindow->Destroy();
}
bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
const SYMBOL* symbol = m_currentText->GetParentSymbol();
m_textCtrl->SetValue( m_currentText->GetText() );
m_textCtrl->EmptyUndoBuffer();
m_fontCtrl->SetFontSelection( m_currentText->GetFont() );
m_textSize.SetValue( m_currentText->GetTextWidth() );
m_textColorSwatch->SetSwatchColor( m_currentText->GetTextColor(), false );
m_bold->Check( m_currentText->IsBold() );
m_italic->Check( m_currentText->IsItalic() );
switch( m_currentText->GetHorizJustify() )
{
case GR_TEXT_H_ALIGN_LEFT: m_hAlignLeft->Check(); break;
case GR_TEXT_H_ALIGN_CENTER: m_hAlignCenter->Check(); break;
case GR_TEXT_H_ALIGN_RIGHT: m_hAlignRight->Check(); break;
case GR_TEXT_H_ALIGN_INDETERMINATE: break;
}
switch( m_currentText->GetVertJustify() )
{
case GR_TEXT_V_ALIGN_TOP: m_vAlignTop->Check(); break;
case GR_TEXT_V_ALIGN_CENTER: m_vAlignCenter->Check(); break;
case GR_TEXT_V_ALIGN_BOTTOM: m_vAlignBottom->Check(); break;
case GR_TEXT_V_ALIGN_INDETERMINATE: break;
}
if( m_currentText->GetTextAngle() == ANGLE_VERTICAL )
m_vertical->Check();
else
m_horizontal->Check();
if( m_currentText->GetWidth() >= 0 )
{
m_borderCheckbox->SetValue( true );
m_borderWidth.SetValue( m_currentText->GetWidth() );
}
else
{
m_borderCheckbox->SetValue( false );
m_borderWidth.Enable( false );
m_borderColorLabel->Enable( false );
m_borderColorSwatch->Enable( false );
m_borderStyleLabel->Enable( false );
m_borderStyleCombo->Enable( false );
}
m_borderColorSwatch->SetSwatchColor( m_currentText->GetStroke().GetColor(), false );
int style = static_cast<int>( m_currentText->GetStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_borderStyleCombo->SetSelection( style );
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_filledCtrl->SetValue( m_currentText->IsFilled() );
m_fillColorSwatch->SetSwatchColor( m_currentText->GetFillColor(), false );
m_fillColorLabel->Enable( m_currentText->IsFilled() );
m_fillColorSwatch->Enable( m_currentText->IsFilled() );
m_privateCheckbox->SetValue( m_currentText->IsPrivate() );
m_commonToAllUnits->SetValue(
symbol && symbol->GetUnitCount() > 1 && m_currentText->GetUnit() == 0 );
m_commonToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 );
m_commonToAllBodyStyles->SetValue( m_currentText->GetBodyStyle() == 0 );
return true;
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onHAlignButton( wxCommandEvent& aEvent )
{
for( BITMAP_BUTTON* btn : { m_hAlignLeft, m_hAlignCenter, m_hAlignRight } )
{
if( btn->IsChecked() && btn != aEvent.GetEventObject() )
btn->Check( false );
}
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onVAlignButton( wxCommandEvent& aEvent )
{
for( BITMAP_BUTTON* btn : { m_vAlignTop, m_vAlignCenter, m_vAlignBottom } )
{
if( btn->IsChecked() && btn != aEvent.GetEventObject() )
btn->Check( false );
}
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onTextAngleButton( wxCommandEvent& aEvent )
{
for( BITMAP_BUTTON* btn : { m_horizontal, m_vertical } )
{
if( btn->IsChecked() && btn != aEvent.GetEventObject() )
btn->Check( false );
}
}
bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() )
return false;
wxString text = m_textCtrl->GetValue();
#ifdef __WXMAC__
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
text.Replace( wxS( "\r" ), wxS( "\n" ) );
#elif defined( __WINDOWS__ )
// On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
// drawing routines so strip the \r char.
text.Replace( wxS( "\r" ), wxS( "" ) );
#endif
m_currentText->SetText( text );
if( m_currentText->GetTextWidth() != m_textSize.GetValue() )
m_currentText->SetTextSize( VECTOR2I( m_textSize.GetValue(), m_textSize.GetValue() ) );
if( m_fontCtrl->HaveFontSelection() )
{
m_currentText->SetFont( m_fontCtrl->GetFontSelection( m_bold->IsChecked(),
m_italic->IsChecked() ) );
}
// Must come after SetTextSize()
m_currentText->SetBold( m_italic->IsChecked() );
m_currentText->SetItalic( m_italic->IsChecked() );
m_currentText->SetTextColor( m_textColorSwatch->GetSwatchColor() );
if( m_hAlignRight->IsChecked() )
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT );
else if( m_hAlignCenter->IsChecked() )
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER );
else
m_currentText->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT );
if( m_vAlignBottom->IsChecked() )
m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM );
else if( m_vAlignCenter->IsChecked() )
m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
else
m_currentText->SetVertJustify( GR_TEXT_V_ALIGN_TOP );
if( m_vertical->IsChecked() )
m_currentText->SetTextAngle( ANGLE_VERTICAL );
else
m_currentText->SetTextAngle( ANGLE_HORIZONTAL );
STROKE_PARAMS stroke = m_currentText->GetStroke();
if( m_borderCheckbox->GetValue() )
stroke.SetWidth( std::max( (long long int) 0, m_borderWidth.GetValue() ) );
else
stroke.SetWidth( -1 );
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetLineStyle( it->first );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
m_currentText->SetStroke( stroke );
m_currentText->SetFillMode( m_filledCtrl->GetValue() ? FILL_T::FILLED_WITH_COLOR
: FILL_T::NO_FILL );
m_currentText->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
m_currentText->SetPrivate( m_privateCheckbox->GetValue() );
if( !m_commonToAllUnits->GetValue() )
m_currentText->SetUnit( m_frame->GetUnit() );
else
m_currentText->SetUnit( 0 );
if( !m_commonToAllBodyStyles->GetValue() )
m_currentText->SetBodyStyle( m_frame->GetBodyStyle() );
else
m_currentText->SetBodyStyle( 0 );
// Record settings used for next time:
auto* tools = m_frame->GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
tools->SetLastTextAngle( m_currentText->GetTextAngle() );
tools->SetDrawSpecificBodyStyle( !m_commonToAllBodyStyles->GetValue() );
tools->SetDrawSpecificUnit( !m_commonToAllUnits->GetValue() );
m_frame->SetMsgPanel( m_currentText );
return true;
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::OnFormattingHelp( wxHyperlinkEvent& aEvent )
{
m_helpWindow = SCH_TEXT::ShowSyntaxHelp( this );
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onMultiLineTCLostFocus( wxFocusEvent& event )
{
if( m_scintillaTricks )
m_scintillaTricks->CancelAutocomplete();
event.Skip();
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onBorderChecked( wxCommandEvent& event )
{
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( schIUScale.MilsToIU( m_frame->libeditconfig()->m_Defaults.line_width ) );
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );
m_borderColorSwatch->Enable( border );
m_borderStyleLabel->Enable( border );
m_borderStyleCombo->Enable( border );
}
void DIALOG_LIB_TEXTBOX_PROPERTIES::onFillChecked( wxCommandEvent& event )
{
bool fill = m_filledCtrl->GetValue();
m_fillColorLabel->Enable( fill );
m_fillColorSwatch->Enable( fill );
}

View File

@ -1,68 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef DIALOG_LIB_TEXTBOX_PROPERTIES_H
#define DIALOG_LIB_TEXTBOX_PROPERTIES_H
#include <widgets/unit_binder.h>
#include <sch_text.h>
#include "dialog_lib_textbox_properties_base.h"
class SYMBOL_EDIT_FRAME;
class LIB_TEXTBOX;
class SCINTILLA_TRICKS;
class HTML_MESSAGE_BOX;
class DIALOG_LIB_TEXTBOX_PROPERTIES : public DIALOG_LIB_TEXTBOX_PROPERTIES_BASE
{
public:
DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_TEXTBOX* aTextBox );
~DIALOG_LIB_TEXTBOX_PROPERTIES();
private:
void onHAlignButton( wxCommandEvent &aEvent );
void onVAlignButton( wxCommandEvent &aEvent );
void onTextAngleButton( wxCommandEvent &aEvent );
void onBorderChecked( wxCommandEvent& event ) override;
void onFillChecked( wxCommandEvent& event ) override;
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
void onMultiLineTCLostFocus( wxFocusEvent& event ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
SYMBOL_EDIT_FRAME* m_frame;
LIB_TEXTBOX* m_currentText;
UNIT_BINDER m_textSize;
UNIT_BINDER m_borderWidth;
SCINTILLA_TRICKS* m_scintillaTricks;
HTML_MESSAGE_BOX* m_helpWindow;
};
#endif // DIALOG_LIB_TEXTBOX_PROPERTIES_H

View File

@ -1,328 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/bitmap_button.h"
#include "widgets/color_swatch.h"
#include "widgets/font_choice.h"
#include "dialog_lib_textbox_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_textEntrySizer = new wxGridBagSizer( 3, 3 );
m_textEntrySizer->SetFlexibleDirection( wxBOTH );
m_textEntrySizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_textLabel = new wxStaticText( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textLabel->Wrap( -1 );
m_textEntrySizer->Add( m_textLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), 0, 5 );
m_textCtrl = new wxStyledTextCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN, wxEmptyString );
m_textCtrl->SetUseTabs( true );
m_textCtrl->SetTabWidth( 4 );
m_textCtrl->SetIndent( 4 );
m_textCtrl->SetTabIndents( false );
m_textCtrl->SetBackSpaceUnIndents( false );
m_textCtrl->SetViewEOL( false );
m_textCtrl->SetViewWhiteSpace( false );
m_textCtrl->SetMarginWidth( 2, 0 );
m_textCtrl->SetIndentationGuides( false );
m_textCtrl->SetReadOnly( false );
m_textCtrl->SetMarginWidth( 1, 0 );
m_textCtrl->SetMarginWidth( 0, 0 );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDER, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPEN, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEREND, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUS );
m_textCtrl->MarkerSetBackground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("BLACK") ) );
m_textCtrl->MarkerSetForeground( wxSTC_MARKNUM_FOLDEROPENMID, wxColour( wxT("WHITE") ) );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY );
m_textCtrl->MarkerDefine( wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY );
m_textCtrl->SetSelBackground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
m_textCtrl->SetSelForeground( true, wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
m_textCtrl->SetMinSize( wxSize( 500,140 ) );
m_textEntrySizer->Add( m_textCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 5 ), wxEXPAND, 5 );
m_fontLabel = new wxStaticText( this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fontLabel->Wrap( -1 );
m_textEntrySizer->Add( m_fontLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP, 5 );
wxString m_fontCtrlChoices[] = { _("Default Font"), _("KiCad Font") };
int m_fontCtrlNChoices = sizeof( m_fontCtrlChoices ) / sizeof( wxString );
m_fontCtrl = new FONT_CHOICE( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_fontCtrlNChoices, m_fontCtrlChoices, 0 );
m_fontCtrl->SetSelection( 0 );
m_textEntrySizer->Add( m_fontCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 );
wxBoxSizer* bSizeCtrlSizer;
bSizeCtrlSizer = new wxBoxSizer( wxHORIZONTAL );
m_separator1 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator1->Enable( false );
bSizeCtrlSizer->Add( m_separator1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_bold = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_bold->SetToolTip( _("Bold") );
bSizeCtrlSizer->Add( m_bold, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_italic = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_italic->SetToolTip( _("Italic") );
bSizeCtrlSizer->Add( m_italic, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator2 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator2->Enable( false );
bSizeCtrlSizer->Add( m_separator2, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignLeft = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignLeft->SetToolTip( _("Align left") );
bSizeCtrlSizer->Add( m_hAlignLeft, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignCenter->SetToolTip( _("Align horizontal center") );
bSizeCtrlSizer->Add( m_hAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_hAlignRight = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_hAlignRight->SetToolTip( _("Align right") );
bSizeCtrlSizer->Add( m_hAlignRight, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator3 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator3->Enable( false );
bSizeCtrlSizer->Add( m_separator3, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignTop = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignTop->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_vAlignTop, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignCenter = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignCenter->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_vAlignCenter, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vAlignBottom = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vAlignBottom->SetToolTip( _("Align top") );
bSizeCtrlSizer->Add( m_vAlignBottom, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator4 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator4->Enable( false );
bSizeCtrlSizer->Add( m_separator4, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_horizontal = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_horizontal->SetToolTip( _("Align bottom") );
bSizeCtrlSizer->Add( m_horizontal, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_vertical = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_vertical->SetToolTip( _("Align vertical center") );
bSizeCtrlSizer->Add( m_vertical, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_separator5 = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 21,21 ), wxBU_AUTODRAW|wxBORDER_NONE );
m_separator5->Enable( false );
bSizeCtrlSizer->Add( m_separator5, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizeCtrlSizer, wxGBPosition( 2, 3 ), wxGBSpan( 1, 3 ), wxEXPAND|wxTOP, 5 );
wxBoxSizer* bSizer41;
bSizer41 = new wxBoxSizer( wxVERTICAL );
m_syntaxHelp = new wxHyperlinkCtrl( this, wxID_ANY, _("Syntax help"), wxEmptyString, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE );
m_syntaxHelp->SetToolTip( _("Show syntax help window") );
bSizer41->Add( m_syntaxHelp, 0, wxRIGHT|wxLEFT, 5 );
m_textEntrySizer->Add( bSizer41, wxGBPosition( 1, 5 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALIGN_RIGHT|wxBOTTOM|wxLEFT, 5 );
m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeLabel->Wrap( -1 );
m_textEntrySizer->Add( m_textSizeLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer71;
bSizer71 = new wxBoxSizer( wxHORIZONTAL );
m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer71->Add( m_textSizeCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_textSizeUnits->Wrap( -1 );
bSizer71->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_textColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_textColorLabel->Wrap( -1 );
bSizer71->Add( m_textColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer71->Add( 5, 0, 0, 0, 5 );
m_panelBorderColor1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer221;
bSizer221 = new wxBoxSizer( wxVERTICAL );
m_textColorSwatch = new COLOR_SWATCH( m_panelBorderColor1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer221->Add( m_textColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelBorderColor1->SetSizer( bSizer221 );
m_panelBorderColor1->Layout();
bSizer221->Fit( m_panelBorderColor1 );
bSizer71->Add( m_panelBorderColor1, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer71, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_textEntrySizer->Add( 0, 15, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 5, 0 ), wxGBSpan( 1, 1 ), 0, 5 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
m_borderWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
bSizer7->Add( m_borderWidthCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_borderWidthUnits = new wxStaticText( this, wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthUnits->Wrap( -1 );
bSizer7->Add( m_borderWidthUnits, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 3 );
m_borderColorLabel = new wxStaticText( this, wxID_ANY, _("Color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderColorLabel->Wrap( -1 );
bSizer7->Add( m_borderColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 15 );
bSizer7->Add( 5, 0, 0, 0, 5 );
m_panelBorderColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer22;
bSizer22 = new wxBoxSizer( wxVERTICAL );
m_borderColorSwatch = new COLOR_SWATCH( m_panelBorderColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer22->Add( m_borderColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelBorderColor->SetSizer( bSizer22 );
m_panelBorderColor->Layout();
bSizer22->Fit( m_panelBorderColor );
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 6, 1 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 7, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) );
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_textEntrySizer->Add( 0, 15, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Background fill"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 5, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 140 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
m_fillColorLabel = new wxStaticText( this, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fillColorLabel->Wrap( -1 );
bSizer8->Add( m_fillColorLabel, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_panelFillColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer211;
bSizer211 = new wxBoxSizer( wxVERTICAL );
m_fillColorSwatch = new COLOR_SWATCH( m_panelFillColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer211->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelFillColor->SetSizer( bSizer211 );
m_panelFillColor->Layout();
bSizer211->Fit( m_panelFillColor );
bSizer8->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer8, wxGBPosition( 6, 4 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 );
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to symbol editor"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_privateCheckbox, wxGBPosition( 9, 0 ), wxGBSpan( 1, 2 ), 0, 5 );
m_commonToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_commonToAllUnits, wxGBPosition( 9, 4 ), wxGBSpan( 1, 2 ), 0, 5 );
m_commonToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_commonToAllBodyStyles, wxGBPosition( 10, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 90 );
m_textEntrySizer->AddGrowableCol( 3 );
bMainSizer->Add( m_textEntrySizer, 1, wxALL|wxEXPAND, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_textCtrl->Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_syntaxHelp->Connect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
m_borderCheckbox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onFillChecked ), NULL, this );
}
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::~DIALOG_LIB_TEXTBOX_PROPERTIES_BASE()
{
// Disconnect Events
m_textCtrl->Disconnect( wxEVT_KILL_FOCUS, wxFocusEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onMultiLineTCLostFocus ), NULL, this );
m_syntaxHelp->Disconnect( wxEVT_COMMAND_HYPERLINK, wxHyperlinkEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::OnFormattingHelp ), NULL, this );
m_borderCheckbox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onBorderChecked ), NULL, this );
m_filledCtrl->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::onFillChecked ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,111 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class BITMAP_BUTTON;
class COLOR_SWATCH;
class FONT_CHOICE;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/stc/stc.h>
#include <wx/choice.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/hyperlink.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/checkbox.h>
#include <wx/bmpcbox.h>
#include <wx/gbsizer.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM
{
private:
protected:
wxGridBagSizer* m_textEntrySizer;
wxStaticText* m_textLabel;
wxStyledTextCtrl* m_textCtrl;
wxStaticText* m_fontLabel;
FONT_CHOICE* m_fontCtrl;
BITMAP_BUTTON* m_separator1;
BITMAP_BUTTON* m_bold;
BITMAP_BUTTON* m_italic;
BITMAP_BUTTON* m_separator2;
BITMAP_BUTTON* m_hAlignLeft;
BITMAP_BUTTON* m_hAlignCenter;
BITMAP_BUTTON* m_hAlignRight;
BITMAP_BUTTON* m_separator3;
BITMAP_BUTTON* m_vAlignTop;
BITMAP_BUTTON* m_vAlignCenter;
BITMAP_BUTTON* m_vAlignBottom;
BITMAP_BUTTON* m_separator4;
BITMAP_BUTTON* m_horizontal;
BITMAP_BUTTON* m_vertical;
BITMAP_BUTTON* m_separator5;
wxHyperlinkCtrl* m_syntaxHelp;
wxStaticText* m_textSizeLabel;
wxTextCtrl* m_textSizeCtrl;
wxStaticText* m_textSizeUnits;
wxStaticText* m_textColorLabel;
wxPanel* m_panelBorderColor1;
COLOR_SWATCH* m_textColorSwatch;
wxCheckBox* m_borderCheckbox;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
wxStaticText* m_borderWidthUnits;
wxStaticText* m_borderColorLabel;
wxPanel* m_panelBorderColor;
COLOR_SWATCH* m_borderColorSwatch;
wxStaticText* m_borderStyleLabel;
wxBitmapComboBox* m_borderStyleCombo;
wxCheckBox* m_filledCtrl;
wxStaticText* m_fillColorLabel;
wxPanel* m_panelFillColor;
COLOR_SWATCH* m_fillColorSwatch;
wxCheckBox* m_privateCheckbox;
wxCheckBox* m_commonToAllUnits;
wxCheckBox* m_commonToAllBodyStyles;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, override them in your derived class
virtual void onMultiLineTCLostFocus( wxFocusEvent& event ) { event.Skip(); }
virtual void OnFormattingHelp( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillChecked( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Box Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_TEXTBOX_PROPERTIES_BASE();
};

View File

@ -24,26 +24,36 @@
#include <widgets/color_swatch.h>
#include <stroke_params.h>
#include <sch_edit_frame.h>
#include <symbol_edit_frame.h>
#include <sch_shape.h>
#include <dialog_shape_properties.h>
#include <settings/color_settings.h>
#include <symbol_editor_settings.h>
#include <sch_commit.h>
#include <string_utils.h>
DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHAPE* aShape ) :
DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_SHAPE* aShape ) :
DIALOG_SHAPE_PROPERTIES_BASE( aParent ),
m_frame( aParent ),
m_shape( aShape ),
m_borderWidth( aParent, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits, true )
{
SetTitle( wxString::Format( GetTitle(), aShape->EDA_SHAPE::GetFriendlyName() ) );
SetTitle( wxString::Format( GetTitle(), aShape->GetFriendlyName() ) );
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
// different shapes (and even whether or not we're within the symbol editor) cause different
// dialog layouts).
m_hash_key = TO_UTF8( GetTitle() + aParent->GetName() );
m_helpLabel1->SetFont( KIUI::GetInfoFont( this ).Italic() );
m_helpLabel2->SetFont( KIUI::GetInfoFont( this ).Italic() );
SetInitialFocus( m_borderWidthCtrl );
COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
@ -51,6 +61,7 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
m_borderStyleCombo->Append( DEFAULT_STYLE );
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_fillColorSwatch->SetSwatchBackground( schematicBackground );
KIGFX::COLOR4D canvas = m_frame->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetSwatchBackground( canvas.ToColour() );
@ -59,16 +70,49 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
SetInitialFocus( m_borderWidthCtrl );
// Required under wxGTK if we want to dismiss the dialog with the ESC key
SetFocus();
SetupStandardButtons();
if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
{
m_fillBook->SetSelection( 1 );
if( !symbolEditor->IsSymbolEditable() || symbolEditor->IsSymbolAlias() )
{
m_sdbSizerCancel->SetDefault();
m_sdbSizerOK->SetLabel( _( "Read Only" ) );
m_sdbSizerOK->Enable( false );
}
}
else
{
m_fillBook->SetSelection( 0 );
m_symbolEditorSizer->Show( false );
}
m_borderColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch,
this );
m_customColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch,
this );
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
DIALOG_SHAPE_PROPERTIES::~DIALOG_SHAPE_PROPERTIES()
{
m_borderColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch,
this );
m_customColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch,
this );
}
bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
@ -101,8 +145,66 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow()
else
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_filledCtrl->SetValue( m_shape->IsFilled() );
m_fillColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
{
m_rbFillNone->Enable( true );
m_rbFillOutline->Enable( true );
m_rbFillBackground->Enable( true );
m_rbFillCustom->Enable( true );
m_customColorSwatch->Enable( true );
if( m_shape->GetFillMode() == FILL_T::FILLED_SHAPE )
{
m_rbFillOutline->SetValue( true );
COLOR4D color = m_shape->GetStroke().GetColor();
if( color == COLOR4D::UNSPECIFIED )
color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
m_customColorSwatch->SetSwatchColor( color, false );
}
else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
{
m_rbFillBackground->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
m_customColorSwatch->SetSwatchColor( color, false );
}
else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
{
m_rbFillCustom->SetValue( true );
m_customColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
}
else
{
m_rbFillNone->SetValue( true );
m_customColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
const SYMBOL* symbol = m_shape->GetParentSymbol();
m_privateCheckbox->SetValue( m_shape->IsPrivate() );
m_checkApplyToAllUnits->SetValue( symbol->GetUnitCount() > 1 && m_shape->GetUnit() == 0 );
m_checkApplyToAllUnits->Enable( symbol->GetUnitCount() > 1 );
m_checkApplyToAllBodyStyles->SetValue( m_shape->GetBodyStyle() == 0 );
bool enableAlternateBodyStyle = symbol->HasAlternateBodyStyle();
// If a symbol contains no body-style-specific pins or graphic items,
// symbol->HasAlternateBodyStyle() will return false.
// But when creating a new symbol, with DeMorgan option set, the m_checkApplyToAllBodyStyles
// must be enabled in order to be able to create graphic items shared by all body styles.
if( symbolEditor->GetShowDeMorgan() )
enableAlternateBodyStyle = true;
m_checkApplyToAllBodyStyles->Enable( enableAlternateBodyStyle );
}
else
{
m_filledCtrl->SetValue( m_shape->IsFilled() );
m_fillColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
}
return true;
}
@ -113,7 +215,16 @@ void DIALOG_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
bool border = m_borderCheckbox->GetValue();
if( border && m_borderWidth.GetValue() < 0 )
m_borderWidth.SetValue( schIUScale.MilsToIU( m_frame->eeconfig()->m_Drawing.default_line_thickness ) );
{
int defaultInMils;
if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
defaultInMils = symbolEditor->libeditconfig()->m_Defaults.line_width;
else
defaultInMils = m_frame->eeconfig()->m_Drawing.default_line_thickness;
m_borderWidth.SetValue( schIUScale.MilsToIU( defaultInMils ) );
}
m_borderWidth.Enable( border );
m_borderColorLabel->Enable( border );
@ -132,6 +243,52 @@ void DIALOG_SHAPE_PROPERTIES::onFillChecked( wxCommandEvent& aEvent )
}
void DIALOG_SHAPE_PROPERTIES::onFillRadioButton( wxCommandEvent& event )
{
if( event.GetId() == NO_FILL )
{
m_rbFillNone->SetValue( true );
m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
}
else if( event.GetId() == FILLED_SHAPE )
{
m_rbFillOutline->SetValue( true );
COLOR4D color = m_shape->GetStroke().GetColor();
if( color == COLOR4D::UNSPECIFIED )
color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
m_fillColorSwatch->SetSwatchColor( color, false );
}
else if( event.GetId() == FILLED_WITH_BG_BODYCOLOR )
{
m_rbFillBackground->SetValue( true );
COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
m_fillColorSwatch->SetSwatchColor( color, false );
}
else if( event.GetId() == FILLED_WITH_COLOR )
{
m_rbFillCustom->SetValue( true );
m_fillColorSwatch->GetNewSwatchColor();
}
}
void DIALOG_SHAPE_PROPERTIES::onBorderSwatch( wxCommandEvent& aEvent )
{
if( m_rbFillOutline->GetValue() )
m_fillColorSwatch->SetSwatchColor( m_borderColorSwatch->GetSwatchColor(), false );
}
void DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch( wxCommandEvent& aEvent )
{
m_rbFillCustom->SetValue( true );
}
bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() )
@ -145,9 +302,14 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
STROKE_PARAMS stroke = m_shape->GetStroke();
if( m_borderCheckbox->GetValue() )
stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
{
if( !m_borderWidth.IsIndeterminate() )
stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
}
else
{
stroke.SetWidth( -1 );
}
auto it = lineTypeNames.begin();
std::advance( it, m_borderStyleCombo->GetSelection() );
@ -161,13 +323,43 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
m_shape->SetStroke( stroke );
m_shape->SetFillMode( m_filledCtrl->GetValue() ? FILL_T::FILLED_WITH_COLOR : FILL_T::NO_FILL );
m_shape->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
{
if( m_rbFillOutline->GetValue() )
m_shape->SetFillMode( FILL_T::FILLED_SHAPE );
else if( m_rbFillBackground->GetValue() )
m_shape->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
else if( m_rbFillCustom->GetValue() )
m_shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
else
m_shape->SetFillMode( FILL_T::NO_FILL );
m_shape->SetFillColor( m_customColorSwatch->GetSwatchColor() );
m_shape->SetPrivate( m_privateCheckbox->GetValue() );
if( m_checkApplyToAllBodyStyles->IsChecked() )
m_shape->SetBodyStyle( 0 );
else
m_shape->SetBodyStyle( symbolEditor->GetBodyStyle() );
if( m_checkApplyToAllUnits->IsChecked() )
m_shape->SetUnit( 0 );
else
m_shape->SetUnit( symbolEditor->GetUnit() );
}
else
{
if( m_filledCtrl->GetValue() )
m_shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
else
m_shape->SetFillMode( FILL_T::NO_FILL );
m_shape->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
}
if( !commit.Empty() )
{
commit.Push( wxString::Format( _( "Edit %s" ), m_shape->EDA_SHAPE::GetFriendlyName() ) );
}
commit.Push( wxString::Format( _( "Edit %s" ), m_shape->GetFriendlyName() ) );
return true;
}

View File

@ -26,7 +26,7 @@
class SCH_SHAPE;
class SCH_EDIT_FRAME;
class SCH_BASE_FRAME;
#include <dialog_shape_properties_base.h>
@ -36,17 +36,24 @@ class SCH_EDIT_FRAME;
class DIALOG_SHAPE_PROPERTIES : public DIALOG_SHAPE_PROPERTIES_BASE
{
public:
DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHAPE* aShape );
DIALOG_SHAPE_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_SHAPE* aShape );
~DIALOG_SHAPE_PROPERTIES() override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private:
void onBorderChecked( wxCommandEvent& aEvent) override;
void onFillChecked( wxCommandEvent& aEvent ) override;
bool GetApplyToAllConversions() { return m_checkApplyToAllBodyStyles->IsChecked(); }
bool GetApplyToAllUnits() { return m_checkApplyToAllUnits->IsChecked(); }
private:
SCH_EDIT_FRAME* m_frame;
void onBorderChecked( wxCommandEvent& aEvent) override;
void onBorderSwatch( wxCommandEvent& aEvent );
void onFillChecked( wxCommandEvent& aEvent ) override;
void onFillRadioButton(wxCommandEvent &aEvent) override;
void onCustomColorSwatch( wxCommandEvent& aEvent );
private:
SCH_BASE_FRAME* m_frame;
SCH_SHAPE* m_shape;
UNIT_BINDER m_borderWidth;
};

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -15,6 +15,10 @@
BEGIN_EVENT_TABLE( DIALOG_SHAPE_PROPERTIES_BASE, DIALOG_SHIM )
EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onBorderChecked )
EVT_CHECKBOX( wxID_ANY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillChecked )
EVT_RADIOBUTTON( NO_FILL, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFillRadioButton )
EVT_RADIOBUTTON( FILLED_SHAPE, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_WITH_BG_BODYCOLOR, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
EVT_RADIOBUTTON( FILLED_WITH_COLOR, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_onFill )
END_EVENT_TABLE()
DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
@ -31,17 +35,20 @@ DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wx
mainSizer->Add( m_infoBar, 0, wxBOTTOM|wxEXPAND, 5 );
m_textEntrySizer = new wxGridBagSizer( 3, 3 );
m_textEntrySizer->SetFlexibleDirection( wxBOTH );
m_textEntrySizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_textEntrySizer->SetEmptyCellSize( wxSize( 36,-1 ) );
wxBoxSizer* bColumns;
bColumns = new wxBoxSizer( wxHORIZONTAL );
m_borderSizer = new wxGridBagSizer( 3, 3 );
m_borderSizer->SetFlexibleDirection( wxBOTH );
m_borderSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_borderSizer->SetEmptyCellSize( wxSize( 36,-1 ) );
m_borderCheckbox = new wxCheckBox( this, wxID_ANY, _("Border"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_borderCheckbox, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_borderSizer->Add( m_borderCheckbox, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
m_borderWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderWidthLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderSizer->Add( m_borderWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
@ -74,61 +81,156 @@ DIALOG_SHAPE_PROPERTIES_BASE::DIALOG_SHAPE_PROPERTIES_BASE( wxWindow* parent, wx
bSizer7->Add( m_panelBorderColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer7, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderSizer->Add( bSizer7, wxGBPosition( 1, 1 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_borderStyleLabel = new wxStaticText( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_borderStyleLabel->Wrap( -1 );
m_textEntrySizer->Add( m_borderStyleLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderSizer->Add( m_borderStyleLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_borderStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_borderStyleCombo->SetMinSize( wxSize( 240,-1 ) );
m_textEntrySizer->Add( m_borderStyleCombo, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Filled shape"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_filledCtrl, wxGBPosition( 0, 5 ), wxGBSpan( 1, 2 ), wxRIGHT, 80 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
m_fillColorLabel = new wxStaticText( this, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fillColorLabel->Wrap( -1 );
bSizer8->Add( m_fillColorLabel, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_panelFillColor = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer211;
bSizer211 = new wxBoxSizer( wxVERTICAL );
m_fillColorSwatch = new COLOR_SWATCH( m_panelFillColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer211->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelFillColor->SetSizer( bSizer211 );
m_panelFillColor->Layout();
bSizer211->Fit( m_panelFillColor );
bSizer8->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_textEntrySizer->Add( bSizer8, wxGBPosition( 1, 5 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_textEntrySizer->AddGrowableCol( 3 );
mainSizer->Add( m_textEntrySizer, 0, wxEXPAND|wxALL, 10 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxVERTICAL );
m_borderSizer->Add( m_borderStyleCombo, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set border width to 0 to use schematic's default line width."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel1->Wrap( -1 );
bSizer12->Add( m_helpLabel1, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 10 );
m_helpLabel1->Wrap( 320 );
m_borderSizer->Add( m_helpLabel1, wxGBPosition( 3, 0 ), wxGBSpan( 1, 2 ), wxTOP, 8 );
m_helpLabel2 = new wxStaticText( this, wxID_ANY, _("Clear colors to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 );
bColumns->Add( m_borderSizer, 9, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
bColumns->Add( 15, 0, 0, wxEXPAND, 5 );
m_fillBook = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_schematicPage = new wxPanel( m_fillBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL );
m_fillSizer = new wxGridBagSizer( 3, 3 );
m_fillSizer->SetFlexibleDirection( wxBOTH );
m_fillSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_fillSizer->SetEmptyCellSize( wxSize( 36,12 ) );
m_filledCtrl = new wxCheckBox( m_schematicPage, wxID_ANY, _("Filled shape"), wxDefaultPosition, wxDefaultSize, 0 );
m_fillSizer->Add( m_filledCtrl, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM, 2 );
wxBoxSizer* bSizer81;
bSizer81 = new wxBoxSizer( wxHORIZONTAL );
m_fillColorLabel = new wxStaticText( m_schematicPage, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fillColorLabel->Wrap( -1 );
bSizer81->Add( m_fillColorLabel, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_panelFillColor = new wxPanel( m_schematicPage, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
m_fillColorSwatch = new COLOR_SWATCH( m_panelFillColor, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer21->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panelFillColor->SetSizer( bSizer21 );
m_panelFillColor->Layout();
bSizer21->Fit( m_panelFillColor );
bSizer81->Add( m_panelFillColor, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_fillSizer->Add( bSizer81, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 );
m_helpLabel2 = new wxStaticText( m_schematicPage, wxID_ANY, _("Clear colors to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel2->Wrap( -1 );
bSizer12->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 );
m_fillSizer->Add( m_helpLabel2, wxGBPosition( 4, 0 ), wxGBSpan( 1, 2 ), wxTOP|wxRIGHT, 8 );
mainSizer->Add( bSizer12, 0, wxBOTTOM|wxEXPAND, 5 );
bSizer8->Add( m_fillSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
m_schematicPage->SetSizer( bSizer8 );
m_schematicPage->Layout();
bSizer8->Fit( m_schematicPage );
m_fillBook->AddPage( m_schematicPage, _("a page"), false );
m_symbolEditorPage = new wxPanel( m_fillBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* bSizerFill;
bSizerFill = new wxStaticBoxSizer( new wxStaticBox( m_symbolEditorPage, wxID_ANY, _("Fill Style") ), wxVERTICAL );
wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 3, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_rbFillNone = new wxRadioButton( bSizerFill->GetStaticBox(), NO_FILL, _("Do not fill"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
gbSizer1->Add( m_rbFillNone, wxGBPosition( 0, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillOutline = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_SHAPE, _("Fill with body outline color"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillOutline, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillBackground = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_WITH_BG_BODYCOLOR, _("Fill with body background color"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillBackground, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL, 5 );
m_rbFillCustom = new wxRadioButton( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, _("Fill with:"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_rbFillCustom, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 );
m_customColorSwatch = new COLOR_SWATCH( bSizerFill->GetStaticBox(), FILLED_WITH_COLOR, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_customColorSwatch, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bSizerFill->Add( gbSizer1, 1, wxEXPAND|wxBOTTOM, 5 );
bSizer9->Add( bSizerFill, 1, wxEXPAND, 5 );
m_symbolEditorPage->SetSizer( bSizer9 );
m_symbolEditorPage->Layout();
bSizer9->Fit( m_symbolEditorPage );
m_fillBook->AddPage( m_symbolEditorPage, _("a page"), false );
bColumns->Add( m_fillBook, 8, wxEXPAND | wxALL, 10 );
mainSizer->Add( bColumns, 0, wxEXPAND, 5 );
m_symbolEditorSizer = new wxBoxSizer( wxVERTICAL );
m_symbolEditorSizer->Add( 0, 10, 0, wxEXPAND, 5 );
wxBoxSizer* bColumns2;
bColumns2 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeft2;
bLeft2 = new wxBoxSizer( wxVERTICAL );
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to Symbol Editor"), wxDefaultPosition, wxDefaultSize, 0 );
bLeft2->Add( m_privateCheckbox, 0, wxTOP, 5 );
bColumns2->Add( bLeft2, 9, wxEXPAND|wxRIGHT|wxLEFT, 10 );
bColumns2->Add( 15, 0, 0, wxEXPAND, 5 );
wxBoxSizer* bRight2;
bRight2 = new wxBoxSizer( wxVERTICAL );
m_checkApplyToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
bRight2->Add( m_checkApplyToAllUnits, 0, wxTOP|wxRIGHT, 5 );
m_checkApplyToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
bRight2->Add( m_checkApplyToAllBodyStyles, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
bColumns2->Add( bRight2, 8, wxEXPAND|wxRIGHT|wxLEFT, 10 );
m_symbolEditorSizer->Add( bColumns2, 1, wxEXPAND, 5 );
mainSizer->Add( m_symbolEditorSizer, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -27,6 +27,9 @@ class WX_INFOBAR;
#include <wx/panel.h>
#include <wx/bmpcbox.h>
#include <wx/gbsizer.h>
#include <wx/radiobut.h>
#include <wx/statbox.h>
#include <wx/simplebook.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -43,11 +46,21 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
// Private event handlers
void _wxFB_onBorderChecked( wxCommandEvent& event ){ onBorderChecked( event ); }
void _wxFB_onFillChecked( wxCommandEvent& event ){ onFillChecked( event ); }
void _wxFB_onFillRadioButton( wxCommandEvent& event ){ onFillRadioButton( event ); }
void _wxFB_onFill( wxCommandEvent& event ){ onFill( event ); }
protected:
enum
{
NO_FILL = 1000,
FILLED_SHAPE,
FILLED_WITH_BG_BODYCOLOR,
FILLED_WITH_COLOR
};
WX_INFOBAR* m_infoBar;
wxGridBagSizer* m_textEntrySizer;
wxGridBagSizer* m_borderSizer;
wxCheckBox* m_borderCheckbox;
wxStaticText* m_borderWidthLabel;
wxTextCtrl* m_borderWidthCtrl;
@ -57,12 +70,25 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
COLOR_SWATCH* m_borderColorSwatch;
wxStaticText* m_borderStyleLabel;
wxBitmapComboBox* m_borderStyleCombo;
wxStaticText* m_helpLabel1;
wxSimplebook* m_fillBook;
wxPanel* m_schematicPage;
wxGridBagSizer* m_fillSizer;
wxCheckBox* m_filledCtrl;
wxStaticText* m_fillColorLabel;
wxPanel* m_panelFillColor;
COLOR_SWATCH* m_fillColorSwatch;
wxStaticText* m_helpLabel1;
wxStaticText* m_helpLabel2;
wxPanel* m_symbolEditorPage;
wxRadioButton* m_rbFillNone;
wxRadioButton* m_rbFillOutline;
wxRadioButton* m_rbFillBackground;
wxRadioButton* m_rbFillCustom;
COLOR_SWATCH* m_customColorSwatch;
wxBoxSizer* m_symbolEditorSizer;
wxCheckBox* m_privateCheckbox;
wxCheckBox* m_checkApplyToAllUnits;
wxCheckBox* m_checkApplyToAllBodyStyles;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
@ -70,6 +96,8 @@ class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, override them in your derived class
virtual void onBorderChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillChecked( wxCommandEvent& event ) { event.Skip(); }
virtual void onFillRadioButton( wxCommandEvent& event ) { event.Skip(); }
virtual void onFill( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -37,7 +37,7 @@
#include <dialogs/html_message_box.h>
#include <scintilla_tricks.h>
#include <dialog_text_properties.h>
#include <gr_text.h>
#include <string_utils.h>
DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_ITEM* aTextItem ) :
@ -87,6 +87,11 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_ITE
m_filledCtrl->Show( false );
}
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
// different text item types (and even whether or not we're within the symbol editor) cause
// different dialog layouts).
m_hash_key = TO_UTF8( GetTitle() + aParent->GetName() );
m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
#ifdef _WIN32
@ -493,10 +498,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
m_currentItem->SetExcludedFromSim( m_excludeFromSim->GetValue() );
if( m_isSymbolEditor )
if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
{
SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame );
m_currentItem->SetPrivate( m_privateCheckbox->GetValue() );
if( !m_commonToAllUnits->GetValue() )

View File

@ -24,7 +24,7 @@
#include <gal/gal_display_options.h>
#include <gal/graphics_abstraction_layer.h>
#include <layer_ids.h>
#include <lib_shape.h>
#include <sch_shape.h>
#include <math/vector2wx.h>
#include <page_info.h>
#include <panel_eeschema_color_settings.h>
@ -375,8 +375,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
symbol->SetShowPinNumbers( true );
symbol->SetPinNameOffset( 0 );
LIB_SHAPE* comp_body = new LIB_SHAPE( symbol, SHAPE_T::POLY );
SCH_SHAPE* comp_body = new SCH_SHAPE( SHAPE_T::POLY, LAYER_DEVICE );
comp_body->SetParent( symbol );
comp_body->SetUnit( 0 );
comp_body->SetBodyStyle( 0 );
comp_body->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );

View File

@ -26,7 +26,7 @@
#include <stdint.h>
#include <lib_symbol.h>
#include <lib_shape.h>
#include <sch_shape.h>
#include <import_gfx/graphics_importer_lib_symbol.h>
#include <import_gfx/svg_import_plugin.h>
@ -118,8 +118,7 @@ void ConvertImageToLibShapes( LIB_SYMBOL* aSymbol, int unit, wxImage img, VECTOR
for( const SHAPE_POLY_SET::POLYGON& poly : polySet.CPolygons() )
{
std::unique_ptr<LIB_SHAPE> shape =
std::make_unique<LIB_SHAPE>( aSymbol, SHAPE_T::POLY );
auto shape = std::make_unique<SCH_SHAPE>( SHAPE_T::POLY, LAYER_DEVICE );
shape->SetPolyShape( poly );

View File

@ -26,7 +26,7 @@
#include "graphics_importer_lib_symbol.h"
#include <lib_symbol.h>
#include <lib_shape.h>
#include <sch_shape.h>
#include <sch_text.h>
#include <memory>
@ -81,7 +81,8 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddLine( const VECTOR2D& aStart, const VECTOR
if( pt0 == pt1 )
return;
std::unique_ptr<LIB_SHAPE> line = std::make_unique<LIB_SHAPE>( m_symbol, SHAPE_T::POLY );
std::unique_ptr<SCH_SHAPE> line = std::make_unique<SCH_SHAPE>( SHAPE_T::POLY, LAYER_DEVICE );
line->SetParent( m_symbol );
line->SetUnit( m_unit );
line->SetStroke( MapStrokeParams( aStroke ) );
@ -96,7 +97,8 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddCircle( const VECTOR2D& aCenter, double aR
const IMPORTED_STROKE& aStroke, bool aFilled,
const COLOR4D& aFillColor )
{
std::unique_ptr<LIB_SHAPE> circle = std::make_unique<LIB_SHAPE>( m_symbol, SHAPE_T::CIRCLE );
std::unique_ptr<SCH_SHAPE> circle = std::make_unique<SCH_SHAPE>( SHAPE_T::CIRCLE, LAYER_DEVICE );
circle->SetParent( m_symbol );
circle->SetUnit( m_unit );
circle->SetFillColor( aFillColor );
circle->SetFilled( aFilled );
@ -111,7 +113,8 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddCircle( const VECTOR2D& aCenter, double aR
void GRAPHICS_IMPORTER_LIB_SYMBOL::AddArc( const VECTOR2D& aCenter, const VECTOR2D& aStart,
const EDA_ANGLE& aAngle, const IMPORTED_STROKE& aStroke )
{
std::unique_ptr<LIB_SHAPE> arc = std::make_unique<LIB_SHAPE>( m_symbol, SHAPE_T::ARC );
std::unique_ptr<SCH_SHAPE> arc = std::make_unique<SCH_SHAPE>( SHAPE_T::ARC, LAYER_DEVICE );
arc->SetParent( m_symbol );
arc->SetUnit( m_unit );
/**
@ -160,7 +163,8 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddPolygon( const std::vector<VECTOR2D>& aVer
if( convertedPoints.empty() )
return;
std::unique_ptr<LIB_SHAPE> polygon = std::make_unique<LIB_SHAPE>( m_symbol, SHAPE_T::POLY );
std::unique_ptr<SCH_SHAPE> polygon = std::make_unique<SCH_SHAPE>( SHAPE_T::POLY, LAYER_DEVICE );
polygon->SetParent( m_symbol );
polygon->SetUnit( m_unit );
if( aFilled )
@ -205,7 +209,8 @@ void GRAPHICS_IMPORTER_LIB_SYMBOL::AddSpline( const VECTOR2D& aStart,
const VECTOR2D& aBezierControl2, const VECTOR2D& aEnd,
const IMPORTED_STROKE& aStroke )
{
std::unique_ptr<LIB_SHAPE> spline = std::make_unique<LIB_SHAPE>( m_symbol, SHAPE_T::BEZIER );
std::unique_ptr<SCH_SHAPE> spline = std::make_unique<SCH_SHAPE>( SHAPE_T::BEZIER, LAYER_DEVICE );
spline->SetParent( m_symbol );
spline->SetUnit( m_unit );
spline->SetStroke( MapStrokeParams( aStroke ) );
spline->SetStart( MapCoordinate( aStart ) );

View File

@ -29,11 +29,8 @@
#include <import_gfx/graphics_importer.h>
#include <layer_ids.h>
class LIB_SYMBOL;
class LIB_SHAPE;
class LIB_TEXT;
class GRAPHICS_IMPORTER_LIB_SYMBOL : public GRAPHICS_IMPORTER
{

Some files were not shown because too many files have changed in this diff Show More