7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 06:26:55 +00:00

Shapes for schematic.

ADDED arc, circle and rectangle shapes for schematic.  Shapes support
line styles and fill colors.

CHANGED sheet background color in Edit Text & Graphics Properties to
fill color (and it now affects shapes).

Pushed STROKE_PARAMS down into common and moved all shapes to using it
for stroke descriptions.
This commit is contained in:
Jeff Young 2021-07-17 20:56:18 +01:00
parent 4b6bf3095a
commit 2bc86fa0a8
110 changed files with 4100 additions and 909 deletions
bitmaps_png/png
common
eeschema
include
libs/kimath/include/geometry
pcbnew
qa/pcbnew_utils

Binary file not shown.

Before

(image error) Size: 1.1 KiB

After

(image error) Size: 657 B

Binary file not shown.

Before

(image error) Size: 1.1 KiB

After

(image error) Size: 666 B

View File

@ -385,6 +385,7 @@ set( COMMON_SRCS
search_stack.cpp
searchhelpfilefullpath.cpp
status_popup.cpp
stroke_params.cpp
systemdirsappend.cpp
template_fieldnames.cpp
textentry_tricks.cpp
@ -613,6 +614,14 @@ generate_lemon_grammar(
libeval_compiler/grammar.lemon
)
# auto-generate stroke_params_lexer.h and stroke_params_keywords.cpp
make_lexer(
common
stroke_params.keywords
stroke_params_lexer.h
stroke_params_keywords.cpp
STROKEPARAMS_T
)
# auto-generate netlist_lexer.h and netlist_keywords.cpp
make_lexer(

View File

@ -35,11 +35,10 @@
*/
#include <base_units.h>
#include <common.h>
#include <string_utils.h>
#include <math/util.h> // for KiROUND
#include <macros.h>
#include <title_block.h>
#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR )
#define IU_TO_MM( x ) ( x / IU_PER_MM )

View File

@ -40,8 +40,9 @@
EDA_SHAPE::EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill, bool eeWinding ) :
m_endsSwapped( false ),
m_shape( aType ),
m_width( aLineWidth ),
m_stroke( aLineWidth, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ),
m_fill( aFill ),
m_fillColor( COLOR4D::UNSPECIFIED ),
m_editState( 0 ),
m_eeWinding( eeWinding )
{
@ -352,7 +353,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
{
std::vector<wxPoint> ctrlPoints = { m_start, m_bezierC1, m_bezierC2, m_end };
BEZIER_POLY converter( ctrlPoints );
converter.GetPoly( m_bezierPoints, m_width );
converter.GetPoly( m_bezierPoints, m_stroke.GetWidth() );
}
break;
@ -605,7 +606,7 @@ void EDA_SHAPE::ShapeGetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PA
break;
}
aList.emplace_back( _( "Line width" ), MessageTextFromValue( units, m_width ) );
aList.emplace_back( _( "Line width" ), MessageTextFromValue( units, GetWidth() ) );
}
@ -663,7 +664,7 @@ const EDA_RECT EDA_SHAPE::getBoundingBox() const
break;
}
bbox.Inflate( std::max( 0, m_width / 2 ) );
bbox.Inflate( std::max( 0, GetWidth() ) / 2 );
bbox.Normalize();
return bbox;
@ -674,8 +675,8 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const
{
int maxdist = aAccuracy;
if( m_width > 0 )
maxdist += m_width / 2;
if( GetWidth() > 0 )
maxdist += GetWidth() / 2;
switch( m_shape )
{
@ -727,7 +728,7 @@ bool EDA_SHAPE::hitTest( const wxPoint& aPosition, int aAccuracy ) const
}
case SHAPE_T::BEZIER:
const_cast<EDA_SHAPE*>( this )->RebuildBezierToSegmentsPointsList( m_width );
const_cast<EDA_SHAPE*>( this )->RebuildBezierToSegmentsPointsList( GetWidth() );
for( unsigned int i= 1; i < m_bezierPoints.size(); i++)
{
@ -1070,7 +1071,7 @@ void EDA_SHAPE::SetPolyPoints( const std::vector<wxPoint>& aPoints )
}
std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes() const
std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes( bool aEdgeOnly ) const
{
std::vector<SHAPE*> effectiveShapes;
@ -1078,60 +1079,50 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes() const
{
case SHAPE_T::ARC:
effectiveShapes.emplace_back( new SHAPE_ARC( m_arcCenter, m_start, GetArcAngle() / 10.0,
m_width ) );
GetWidth() ) );
break;
case SHAPE_T::SEGMENT:
effectiveShapes.emplace_back( new SHAPE_SEGMENT( m_start, m_end, m_width ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( m_start, m_end, GetWidth() ) );
break;
case SHAPE_T::RECT:
{
std::vector<wxPoint> pts = GetRectCorners();
if( IsFilled() )
if( IsFilled() && !aEdgeOnly )
effectiveShapes.emplace_back( new SHAPE_SIMPLE( pts ) );
if( m_width > 0 || !IsFilled() )
if( GetWidth() > 0 || !IsFilled() || aEdgeOnly )
{
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[0], pts[1], m_width ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[1], pts[2], m_width ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[2], pts[3], m_width ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[3], pts[0], m_width ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[0], pts[1], GetWidth() ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[1], pts[2], GetWidth() ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[2], pts[3], GetWidth() ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( pts[3], pts[0], GetWidth() ) );
}
}
break;
case SHAPE_T::CIRCLE:
{
if( IsFilled() )
if( IsFilled() && !aEdgeOnly )
effectiveShapes.emplace_back( new SHAPE_CIRCLE( getCenter(), GetRadius() ) );
if( m_width > 0 || !IsFilled() )
{
// SHAPE_CIRCLE has no ConvertToPolyline() method, so use a 360.0 SHAPE_ARC
SHAPE_ARC circle( getCenter(), GetEnd(), 360.0 );
SHAPE_LINE_CHAIN l = circle.ConvertToPolyline();
for( int i = 0; i < l.SegmentCount(); i++ )
{
effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ).A, l.Segment( i ).B,
m_width ) );
}
}
if( GetWidth() > 0 || !IsFilled() || aEdgeOnly )
effectiveShapes.emplace_back( new SHAPE_ARC( getCenter(), GetEnd(), 360.0 ) );
break;
}
case SHAPE_T::BEZIER:
{
auto bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
std::vector<wxPoint> bezierPoints = buildBezierToSegmentsPointsList( GetWidth() );
wxPoint start_pt = bezierPoints[0];
for( unsigned int jj = 1; jj < bezierPoints.size(); jj++ )
{
wxPoint end_pt = bezierPoints[jj];
effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, m_width ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( start_pt, end_pt, GetWidth() ) );
start_pt = end_pt;
}
@ -1145,13 +1136,13 @@ std::vector<SHAPE*> EDA_SHAPE::MakeEffectiveShapes() const
l.Rotate( -DECIDEG2RAD( getParentOrientation() ) );
l.Move( getParentPosition() );
if( IsFilled() )
if( IsFilled() && !aEdgeOnly )
effectiveShapes.emplace_back( new SHAPE_SIMPLE( l ) );
if( m_width > 0 || !IsFilled() )
if( GetWidth() > 0 || !IsFilled() || aEdgeOnly )
{
for( int i = 0; i < l.SegmentCount(); i++ )
effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ), m_width ) );
effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.Segment( i ), GetWidth() ) );
}
}
break;
@ -1322,9 +1313,9 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
case 4:
{
double chordA = GetLineLength( m_start, aPosition );
double chordB = GetLineLength( m_end, aPosition );
radius = int( ( chordA + chordB ) / 2.0 ) + 1;
double radialA = GetLineLength( m_start, aPosition );
double radialB = GetLineLength( m_end, aPosition );
radius = int( ( radialA + radialB ) / 2.0 ) + 1;
}
break;
@ -1373,6 +1364,10 @@ void EDA_SHAPE::calcEdit( const wxPoint& aPosition )
case 4:
// Pick the one closer to the mouse position
m_arcCenter = GetLineLength( c1, aPosition ) < GetLineLength( c2, aPosition ) ? c1 : c2;
if( GetArcAngle() > 1800 )
std::swap( m_start, m_end );
break;
}
}
@ -1425,7 +1420,7 @@ void EDA_SHAPE::SwapShape( EDA_SHAPE* aImage )
EDA_SHAPE* image = dynamic_cast<EDA_SHAPE*>( aImage );
assert( image );
std::swap( m_width, image->m_width );
std::swap( m_stroke, image->m_stroke );
std::swap( m_start, image->m_start );
std::swap( m_end, image->m_end );
std::swap( m_arcCenter, image->m_arcCenter );
@ -1462,12 +1457,16 @@ int EDA_SHAPE::Compare( const EDA_SHAPE* aOther ) const
else if( m_shape == SHAPE_T::POLY )
{
TEST( m_poly.TotalVertices(), aOther->m_poly.TotalVertices() );
for( int ii = 0; ii < m_poly.TotalVertices(); ++ii )
TEST_PT( m_poly.CVertex( ii ), aOther->m_poly.CVertex( ii ) );
}
TEST_E( m_width, aOther->m_width );
for( size_t ii = 0; ii < m_bezierPoints.size(); ++ii )
TEST_PT( m_bezierPoints[ii], aOther->m_bezierPoints[ii] );
for( int ii = 0; ii < m_poly.TotalVertices(); ++ii )
TEST_PT( m_poly.CVertex( ii ), aOther->m_poly.CVertex( ii ) );
TEST_E( m_stroke.GetWidth(), aOther->m_stroke.GetWidth() );
TEST( (int) m_stroke.GetPlotStyle(), (int) aOther->m_stroke.GetPlotStyle() );
TEST( (int) m_fill, (int) aOther->m_fill );
return 0;
@ -1479,7 +1478,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
int aError, ERROR_LOC aErrorLoc,
bool ignoreLineWidth ) const
{
int width = ignoreLineWidth ? 0 : m_width;
int width = ignoreLineWidth ? 0 : GetWidth();
width += 2 * aClearanceValue;
@ -1580,7 +1579,7 @@ void EDA_SHAPE::TransformShapeWithClearanceToPolygon( SHAPE_POLY_SET& aCornerBuf
std::vector<wxPoint> ctrlPts = { GetStart(), GetBezierC1(), GetBezierC2(), GetEnd() };
BEZIER_POLY converter( ctrlPts );
std::vector< wxPoint> poly;
converter.GetPoly( poly, m_width );
converter.GetPoly( poly, GetWidth() );
for( unsigned ii = 1; ii < poly.size(); ii++ )
{

View File

@ -117,6 +117,7 @@ wxString LayerName( int aLayer )
case LAYER_DEVICE: return _( "Symbol body outlines" );
case LAYER_DEVICE_BACKGROUND: return _( "Symbol body fills" );
case LAYER_NOTES: return _( "Schematic text && graphics" );
case LAYER_NOTES_BACKGROUND: return _( "Schematic text && graphics backgrounds" );
case LAYER_PIN: return _( "Pins" );
case LAYER_SHEET: return _( "Sheet borders" );
case LAYER_SHEET_BACKGROUND: return _( "Sheet backgrounds" );

View File

@ -41,7 +41,6 @@
#include <eda_item.h>
#include <plotters/plotter.h>
#include <geometry/shape_line_chain.h>
#include <geometry/geometry_utils.h>
#include <bezier_curves.h>
#include <math/util.h> // for KiROUND
@ -138,19 +137,19 @@ double PLOTTER::userToDeviceSize( double size ) const
double PLOTTER::GetDotMarkLenIU() const
{
return userToDeviceSize( dot_mark_len( GetCurrentLineWidth() ) );
return userToDeviceSize( m_renderSettings->GetDotLength( GetCurrentLineWidth() ) );
}
double PLOTTER::GetDashMarkLenIU() const
{
return userToDeviceSize( dash_mark_len( GetCurrentLineWidth() ) );
return userToDeviceSize( m_renderSettings->GetDashLength( GetCurrentLineWidth() ) );
}
double PLOTTER::GetDashGapLenIU() const
{
return userToDeviceSize( dash_gap_len( GetCurrentLineWidth() ) );
return userToDeviceSize( m_renderSettings->GetGapLength( GetCurrentLineWidth() ) );
}

View File

@ -51,6 +51,27 @@ RENDER_SETTINGS::~RENDER_SETTINGS()
}
constexpr double visualCorrection = 0.8;
double RENDER_SETTINGS::GetDashLength( int aLineWidth ) const
{
return std::max( m_dashLengthRatio - visualCorrection, 1.0 ) * aLineWidth;
}
double RENDER_SETTINGS::GetDotLength( int aLineWidth ) const
{
return ( 1.0 - visualCorrection ) * aLineWidth;
}
double RENDER_SETTINGS::GetGapLength( int aLineWidth ) const
{
return std::max( m_gapLengthRatio + visualCorrection, 1.0 ) * aLineWidth;
}
void RENDER_SETTINGS::update()
{
// Calculate darkened/highlighted variants of layer colors

View File

@ -48,6 +48,7 @@ static const std::map<int, COLOR4D> s_defaultTheme =
{ LAYER_LOCLABEL, CSS_COLOR( 15, 15, 15, 1 ) },
{ LAYER_NOCONNECT, CSS_COLOR( 0, 0, 132, 1 ) },
{ LAYER_NOTES, CSS_COLOR( 0, 0, 194, 1 ) },
{ LAYER_NOTES_BACKGROUND, CSS_COLOR( 0, 0, 0, 0 ) },
{ LAYER_PIN, CSS_COLOR( 132, 0, 0, 1 ) },
{ LAYER_PINNAM, CSS_COLOR( 0, 100, 100, 1 ) },
{ LAYER_PINNUM, CSS_COLOR( 169, 0, 0, 1 ) },
@ -193,6 +194,7 @@ static const std::map<int, COLOR4D> s_classicTheme =
{ LAYER_LOCLABEL, COLOR4D( BLACK ) },
{ LAYER_NOCONNECT, COLOR4D( BLUE ) },
{ LAYER_NOTES, COLOR4D( LIGHTBLUE ) },
{ LAYER_NOTES_BACKGROUND, COLOR4D( UNSPECIFIED_COLOR ) },
{ LAYER_PIN, COLOR4D( RED ) },
{ LAYER_PINNAM, COLOR4D( CYAN ) },
{ LAYER_PINNUM, COLOR4D( RED ) },

View File

@ -94,6 +94,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
CLR( "schematic.label_local", LAYER_LOCLABEL );
CLR( "schematic.no_connect", LAYER_NOCONNECT );
CLR( "schematic.note", LAYER_NOTES );
CLR( "schematic.note_background", LAYER_NOTES_BACKGROUND );
CLR( "schematic.pin", LAYER_PIN );
CLR( "schematic.pin_name", LAYER_PINNAM );
CLR( "schematic.pin_number", LAYER_PINNUM );

276
common/stroke_params.cpp Normal file
View File

@ -0,0 +1,276 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <macros.h>
#include <base_units.h>
#include <string_utils.h>
#include <eda_rect.h>
#include <render_settings.h>
#include <geometry/shape.h>
#include <geometry/shape_segment.h>
#include <geometry/shape_simple.h>
#include <geometry/geometry_utils.h>
#include <stroke_params.h>
#include <trigo.h>
using namespace STROKEPARAMS_T;
void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
const KIGFX::RENDER_SETTINGS* aRenderSettings,
std::function<void( const wxPoint& a, const wxPoint& b )> aStroker )
{
double strokes[6];
int wrapAround;
switch( aLineStyle )
{
case PLOT_DASH_TYPE::DASH:
strokes[0] = aRenderSettings->GetDashLength( aWidth );
strokes[1] = aRenderSettings->GetGapLength( aWidth );
wrapAround = 2;
break;
case PLOT_DASH_TYPE::DOT:
strokes[0] = aRenderSettings->GetDotLength( aWidth );
strokes[1] = aRenderSettings->GetGapLength( aWidth );
wrapAround = 2;
break;
case PLOT_DASH_TYPE::DASHDOT:
strokes[0] = aRenderSettings->GetDashLength( aWidth );
strokes[1] = aRenderSettings->GetGapLength( aWidth );
strokes[2] = aRenderSettings->GetDotLength( aWidth );
strokes[3] = aRenderSettings->GetGapLength( aWidth );
wrapAround = 4;
break;
default:
UNIMPLEMENTED_FOR( lineTypeNames.at( aLineStyle ).name );
}
switch( aShape->Type() )
{
case SH_SIMPLE:
{
const SHAPE_SIMPLE* poly = static_cast<const SHAPE_SIMPLE*>( aShape );
for( size_t ii = 0; ii < poly->GetSegmentCount(); ++ii )
{
SEG seg = poly->GetSegment( ii );
SHAPE_SEGMENT line( seg.A, seg.B );
STROKE_PARAMS::Stroke( &line, aLineStyle, aWidth, aRenderSettings, aStroker );
}
}
break;
case SH_SEGMENT:
{
const SHAPE_SEGMENT* line = static_cast<const SHAPE_SEGMENT*>( aShape );
VECTOR2D start = line->GetSeg().A;
VECTOR2D end = line->GetSeg().B;
EDA_RECT clip( (wxPoint)start, wxSize( end.x - start.x, end.y - start.y ) );
clip.Normalize();
double theta = atan2( end.y - start.y, end.x - start.x );
for( size_t i = 0; i < 10000; ++i )
{
// Calculations MUST be done in doubles to keep from accumulating rounding
// errors as we go.
VECTOR2D next( start.x + strokes[ i % wrapAround ] * cos( theta ),
start.y + strokes[ i % wrapAround ] * sin( theta ) );
// Drawing each segment can be done rounded to ints.
wxPoint a( KiROUND( start.x ), KiROUND( start.y ) );
wxPoint b( KiROUND( next.x ), KiROUND( next.y ) );
if( ClipLine( &clip, a.x, a.y, b.x, b.y ) )
break;
else if( i % 2 == 0 )
aStroker( a, b );
start = next;
}
}
break;
case SH_ARC:
{
const SHAPE_ARC* arc = static_cast<const SHAPE_ARC*>( aShape );
double r = arc->GetRadius();
double C = 2.0 * M_PI * r;
VECTOR2I center = arc->GetCenter();
VECTOR2D startRadial( arc->GetP0() - center );
double startAngle = 180.0 / M_PI * atan2( startRadial.y, startRadial.x );
VECTOR2D endRadial( arc->GetP1() - center );
double arcEndAngle = 180.0 / M_PI * atan2( endRadial.y, endRadial.x );
if( arcEndAngle == startAngle )
arcEndAngle = startAngle + 360.0; // ring, not null
if( startAngle > arcEndAngle )
{
if( arcEndAngle < 0 )
arcEndAngle = NormalizeAngleDegrees( arcEndAngle, 0.0, 360.0 );
else
startAngle = NormalizeAngleDegrees( startAngle, -360.0, 0.0 );
}
wxASSERT( startAngle < arcEndAngle );
for( size_t i = 0; i < 10000 && startAngle < arcEndAngle; ++i )
{
double theta = 360.0 * strokes[ i % wrapAround ] / C;
double endAngle = std::min( startAngle + theta, arcEndAngle );
if( i % 2 == 0 )
{
wxPoint a( center.x + r * cos( startAngle * M_PI / 180.0 ),
center.y + r * sin( startAngle * M_PI / 180.0 ) );
wxPoint b( center.x + r * cos( endAngle * M_PI / 180.0 ),
center.y + r * sin( endAngle * M_PI / 180.0 ) );
aStroker( a, b );
}
startAngle = endAngle;
}
}
break;
case SH_CIRCLE:
// A circle is always filled; a ring is represented by a 360° arc.
KI_FALLTHROUGH;
default:
UNIMPLEMENTED_FOR( SHAPE_TYPE_asString( aShape->Type() ) );
}
}
static wxString getLineStyleToken( PLOT_DASH_TYPE aStyle )
{
wxString token;
switch( aStyle )
{
case PLOT_DASH_TYPE::DASH: token = "dash"; break;
case PLOT_DASH_TYPE::DOT: token = "dot"; break;
case PLOT_DASH_TYPE::DASHDOT: token = "dash_dot"; break;
case PLOT_DASH_TYPE::SOLID: token = "solid"; break;
case PLOT_DASH_TYPE::DEFAULT: token = "default"; break;
}
return token;
}
void STROKE_PARAMS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel ) const
{
wxASSERT( aFormatter != nullptr );
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s) (color %d %d %d %s))",
FormatInternalUnits(GetWidth() ).c_str(),
TO_UTF8( getLineStyleToken( GetPlotStyle() ) ),
KiROUND( GetColor().r * 255.0 ),
KiROUND( GetColor().g * 255.0 ),
KiROUND( GetColor().b * 255.0 ),
Double2Str( GetColor().a ).c_str() );
}
void STROKE_PARAMS_PARSER::ParseStroke( STROKE_PARAMS& aStroke )
{
for( T token = NextTok(); token != T_RIGHT; token = NextTok() )
{
if( token != T_LEFT )
Expecting( T_LEFT );
token = NextTok();
switch( token )
{
case T_width:
aStroke.SetWidth( parseDouble( "stroke width" ) * m_iuPerMM );
NeedRIGHT();
break;
case T_type:
{
token = NextTok();
switch( token )
{
case T_dash: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DASH ); break;
case T_dot: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DOT ); break;
case T_dash_dot: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DASHDOT ); break;
case T_solid: aStroke.SetPlotStyle( PLOT_DASH_TYPE::SOLID ); break;
case T_default: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT ); break;
default:
Expecting( "solid, dash, dash_dot, dot or default" );
}
NeedRIGHT();
break;
}
case T_color:
{
KIGFX::COLOR4D color;
color.r = parseInt( "red" ) / 255.0;
color.g = parseInt( "green" ) / 255.0;
color.b = parseInt( "blue" ) / 255.0;
color.a = Clamp( parseDouble( "alpha" ), 0.0, 1.0 );
aStroke.SetColor( color );
NeedRIGHT();
break;
}
default:
Expecting( "width, type, or color" );
}
}
}
int STROKE_PARAMS_PARSER::parseInt( const char* aText )
{
T token = NextTok();
if( token != T_NUMBER )
Expecting( aText );
return atoi( CurText() );
}
double STROKE_PARAMS_PARSER::parseDouble( const char* aText )
{
T token = NextTok();
if( token != T_NUMBER )
Expecting( aText );
double val = strtod( CurText(), NULL );
return val;
}

View File

@ -0,0 +1,10 @@
color
dash
dash_dot
dash_dot_dot
default
dot
solid
stroke
type
width

View File

@ -91,6 +91,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_rescue_each_base.cpp
dialogs/dialog_sch_import_settings.cpp
dialogs/dialog_sch_import_settings_base.cpp
dialogs/dialog_shape_properties.cpp
dialogs/dialog_shape_properties_base.cpp
dialogs/dialog_sheet_pin_properties.cpp
dialogs/dialog_sheet_pin_properties_base.cpp
dialogs/dialog_sheet_properties.cpp
@ -183,7 +185,6 @@ set( EESCHEMA_SRCS
lib_pin.cpp
lib_symbol.cpp
lib_text.cpp
symbol_viewer_frame.cpp
libarch.cpp
menubar.cpp
pin_numbers.cpp
@ -210,6 +211,7 @@ set( EESCHEMA_SRCS
sch_screen.cpp
sch_plugins/kicad/sch_sexpr_parser.cpp
sch_plugins/kicad/sch_sexpr_plugin.cpp
sch_shape.cpp
sch_sheet.cpp
sch_sheet_path.cpp
sch_sheet_pin.cpp
@ -226,6 +228,7 @@ set( EESCHEMA_SRCS
symbol_library.cpp
symbol_tree_model_adapter.cpp
symbol_tree_synchronizing_adapter.cpp
symbol_viewer_frame.cpp
toolbars_symbol_viewer.cpp
toolbars_sch_editor.cpp
transform.cpp

View File

@ -319,7 +319,7 @@ bool SCH_EDIT_FRAME::BreakSegment( SCH_LINE* aSegment, const wxPoint& aPoint,
bool SCH_EDIT_FRAME::BreakSegments( const wxPoint& aPoint, SCH_SCREEN* aScreen )
{
static const KICAD_T wiresAndBuses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
static const KICAD_T wiresAndBuses[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, EOT };
if( aScreen == nullptr )
aScreen = GetScreen();
@ -380,7 +380,7 @@ void SCH_EDIT_FRAME::DeleteJunction( SCH_ITEM* aJunction, bool aAppend )
SCH_SCREEN* screen = GetScreen();
PICKED_ITEMS_LIST undoList;
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
KICAD_T wiresAndBuses[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LINE_LOCATE_BUS_T, EOT };
KICAD_T wiresAndBuses[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T, EOT };
auto remove_item = [ & ]( SCH_ITEM* aItem ) -> void
{

View File

@ -27,6 +27,7 @@
#include <sch_symbol.h>
#include <sch_connection.h>
#include <sch_edit_frame.h>
#include <sch_shape.h>
#include <sch_line.h>
#include <sch_junction.h>
#include <sch_sheet.h>
@ -117,8 +118,8 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_
m_colorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_colorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_bgColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_bgColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_fillColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_dotColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
m_dotColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
@ -217,7 +218,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
m_lineStyle->SetStringSelection( INDETERMINATE_ACTION );
m_junctionSize.SetValue( INDETERMINATE_ACTION );
m_setColor->SetValue( false );
m_setBgColor->SetValue( false );
m_setFillColor->SetValue( false );
m_setDotColor->SetValue( false );
return true;
@ -240,7 +241,6 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
EDA_TEXT* eda_text = dynamic_cast<EDA_TEXT*>( aItem );
SCH_TEXT* sch_text = dynamic_cast<SCH_TEXT*>( aItem );
SCH_LINE* lineItem = dynamic_cast<SCH_LINE*>( aItem );
SCH_JUNCTION* junction = dynamic_cast<SCH_JUNCTION*>( aItem );
m_parent->SaveCopyInUndoList( aSheetPath.LastScreen(), aItem, UNDO_REDO::CHANGED, m_appendUndo );
@ -274,21 +274,40 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( const SCH_SHEET_PATH& aS
sch_text->SetLabelSpinStyle( (LABEL_SPIN_STYLE::SPIN) m_orientation->GetSelection() );
}
if( lineItem )
if( aItem->HasLineStroke() )
{
STROKE_PARAMS stroke = aItem->GetStroke();
if( !m_lineWidth.IsIndeterminate() )
lineItem->SetLineWidth( m_lineWidth.GetValue() );
stroke.SetWidth( m_lineWidth.GetValue() );
if( m_lineStyle->GetStringSelection() != INDETERMINATE_ACTION )
{
if( m_lineStyle->GetStringSelection() == DEFAULT_STYLE )
lineItem->SetLineStyle( PLOT_DASH_TYPE::DEFAULT );
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
else
lineItem->SetLineStyle( m_lineStyle->GetSelection() );
stroke.SetPlotStyle( (PLOT_DASH_TYPE) m_lineStyle->GetSelection() );
}
if( m_setColor->GetValue() )
lineItem->SetLineColor( m_colorSwatch->GetSwatchColor() );
stroke.SetColor( m_colorSwatch->GetSwatchColor() );
aItem->SetStroke( stroke );
}
if( aItem->Type() == SCH_SHAPE_T )
{
SCH_SHAPE* shape = static_cast<SCH_SHAPE*>( aItem );
if( m_setFillColor->GetValue() )
{
shape->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
if( m_fillColorSwatch->GetSwatchColor() == COLOR4D::UNSPECIFIED )
shape->SetFillMode( FILL_T::NO_FILL );
else
shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
}
}
if( junction )
@ -348,9 +367,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
}
}
static KICAD_T wireTypes[] = { SCH_LINE_LOCATE_WIRE_T, SCH_LABEL_LOCATE_WIRE_T, EOT };
static KICAD_T busTypes[] = { SCH_LINE_LOCATE_BUS_T, SCH_LABEL_LOCATE_BUS_T, EOT };
static KICAD_T schTextAndGraphics[] = { SCH_TEXT_T, SCH_LINE_LOCATE_GRAPHIC_LINE_T, EOT };
static KICAD_T wireTypes[] = { SCH_ITEM_LOCATE_WIRE_T, SCH_LABEL_LOCATE_WIRE_T, EOT };
static KICAD_T busTypes[] = { SCH_ITEM_LOCATE_BUS_T, SCH_LABEL_LOCATE_BUS_T, EOT };
static KICAD_T schTextAndGraphics[] = { SCH_TEXT_T, SCH_ITEM_LOCATE_GRAPHIC_LINE_T, EOT };
if( aItem->Type() == SCH_SYMBOL_T )
{
@ -409,8 +428,8 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
if( m_setColor->GetValue() )
sheet->SetBorderColor( m_colorSwatch->GetSwatchColor() );
if( m_setBgColor->GetValue() )
sheet->SetBackgroundColor( m_bgColorSwatch->GetSwatchColor() );
if( m_setFillColor->GetValue() )
sheet->SetBackgroundColor( m_fillColorSwatch->GetSwatchColor() );
}
}
else if( aItem->Type() == SCH_JUNCTION_T )

View File

@ -327,14 +327,14 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_setBgColor = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Sheet background color:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_setBgColor, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_setFillColor = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_setFillColor, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_bgColorSwatch = new COLOR_SWATCH( m_specifiedValues, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_bgColorSwatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_bgColorSwatch->SetMinSize( wxSize( 48,24 ) );
m_fillColorSwatch = new COLOR_SWATCH( m_specifiedValues, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_fillColorSwatch->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_fillColorSwatch->SetMinSize( wxSize( 48,24 ) );
fgSizer1->Add( m_bgColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer1->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_dotSizeLabel = new wxStaticText( m_specifiedValues, wxID_ANY, _("Junction size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_dotSizeLabel->Wrap( -1 );

View File

@ -3570,7 +3570,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Sheet background color:</property>
<property name="label">Fill color:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -3578,7 +3578,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_setBgColor</property>
<property name="name">m_setFillColor</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -3644,7 +3644,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size">48,24</property>
<property name="moveable">1</property>
<property name="name">m_bgColorSwatch</property>
<property name="name">m_fillColorSwatch</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -88,8 +88,8 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
COLOR_SWATCH* m_colorSwatch;
wxStaticText* lineStyleLabel;
wxChoice* m_lineStyle;
wxCheckBox* m_setBgColor;
COLOR_SWATCH* m_bgColorSwatch;
wxCheckBox* m_setFillColor;
COLOR_SWATCH* m_fillColorSwatch;
wxStaticText* m_dotSizeLabel;
wxTextCtrl* m_dotSizeCtrl;
wxStaticText* m_dotSizeUnits;

View File

@ -25,7 +25,7 @@
#include <dialog_lib_shape_properties.h>
#include <symbol_edit_frame.h>
#include <confirm.h>
#include <lib_shape.h>
DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_ITEM* aItem ) :
@ -85,7 +85,7 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
m_checkApplyToAllConversions->Enable( enblConvOptStyle );
if( shape )
m_fillCtrl->SetSelection( static_cast<int>( shape->GetFillType() ) - 1 );
m_fillCtrl->SetSelection( static_cast<int>( shape->GetFillMode() ) - 1 );
m_fillCtrl->Enable( shape != nullptr );
@ -98,13 +98,16 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
if( !wxDialog::TransferDataFromWindow() )
return false;
EDA_SHAPE* shape = dynamic_cast<EDA_SHAPE*>( m_item );
LIB_SHAPE* shape = dynamic_cast<LIB_SHAPE*>( m_item );
if( shape )
{
shape->SetFillMode( static_cast<FILL_T>( std::max( m_fillCtrl->GetSelection() + 1, 1 ) ) );
if( shape )
shape->SetWidth( m_lineWidth.GetValue() );
STROKE_PARAMS stroke = shape->GetStroke();
stroke.SetWidth( m_lineWidth.GetValue() );
shape->SetStroke( stroke );
}
if( GetApplyToAllConversions() )
m_item->SetConvert( 0 );

View File

@ -22,37 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <bitmaps.h>
#include <sch_line.h>
#include <dialog_line_wire_bus_properties.h>
#include <dialogs/dialog_color_picker.h>
#include <settings/settings_manager.h>
#include <sch_edit_frame.h>
#include <stroke_params.h>
#include <widgets/color_swatch.h>
struct lineTypeStruct
{
wxString name;
const BITMAPS bitmap;
};
/*
* Conversion map between PLOT_DASH_TYPE values and style names displayed
*/
const std::map<PLOT_DASH_TYPE, struct lineTypeStruct> lineTypeNames = {
{ PLOT_DASH_TYPE::SOLID, { _( "Solid" ), BITMAPS::stroke_solid } },
{ PLOT_DASH_TYPE::DASH, { _( "Dashed" ), BITMAPS::stroke_dash } },
{ PLOT_DASH_TYPE::DOT, { _( "Dotted" ), BITMAPS::stroke_dot } },
{ PLOT_DASH_TYPE::DASHDOT, { _( "Dash-Dot" ), BITMAPS::stroke_dashdot } },
};
#define DEFAULT_STYLE _( "Default" )
#define INDETERMINATE_STYLE _( "Leave unchanged" )
DIALOG_LINE_WIRE_BUS_PROPERTIES::DIALOG_LINE_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME* aParent,
std::deque<SCH_ITEM*>& aItems ) :
DIALOG_LINE_WIRE_BUS_PROPERTIES_BASE( aParent ),

View File

@ -0,0 +1,113 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 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 <widgets/color_swatch.h>
#include <stroke_params.h>
#include <sch_edit_frame.h>
#include <sch_shape.h>
#include <dialog_shape_properties.h>
DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHAPE* aShape ) :
DIALOG_SHAPE_PROPERTIES_BASE( aParent ),
m_shape( aShape ),
m_lineWidth( aParent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits, true )
{
SetTitle( wxString::Format( GetTitle(), aShape->ShowShape() ) );
m_helpLabel1->SetFont( KIUI::GetInfoFont( this ) );
m_helpLabel2->SetFont( KIUI::GetInfoFont( this ) );
SetInitialFocus( m_lineWidthCtrl );
m_lineColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_lineStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
m_lineStyleCombo->Append( DEFAULT_STYLE );
m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
// Required under wxGTK if we want to dismiss the dialog with the ESC key
SetFocus();
m_sdbSizerOK->SetDefault();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
m_lineWidth.SetValue( m_shape->GetWidth() );
m_lineColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false );
int style = static_cast<int>( m_shape->GetStroke().GetPlotStyle() );
if( style == -1 )
m_lineStyleCombo->SetStringSelection( DEFAULT_STYLE );
else if( style < (int) lineTypeNames.size() )
m_lineStyleCombo->SetSelection( style );
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 );
return true;
}
bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() )
return false;
STROKE_PARAMS stroke = m_shape->GetStroke();
if( !m_lineWidth.IsIndeterminate() )
stroke.SetWidth( m_lineWidth.GetValue() );
auto it = lineTypeNames.begin();
std::advance( it, m_lineStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
else
stroke.SetPlotStyle( it->first );
stroke.SetColor( m_lineColorSwatch->GetSwatchColor() );
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() );
return true;
}

View File

@ -0,0 +1,49 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 KiCad Developers, see CHANGELOG.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_SHAPE_PROPERTIES_H
#define DIALOG_SHAPE_PROPERTIES_H
class SCH_SHAPE;
class SCH_EDIT_FRAME;
#include <dialog_shape_properties_base.h>
#include <widgets/unit_binder.h>
class DIALOG_SHAPE_PROPERTIES : public DIALOG_SHAPE_PROPERTIES_BASE
{
public:
DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_SHAPE* aShape );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private:
SCH_SHAPE* m_shape;
UNIT_BINDER m_lineWidth;
};
#endif // DIALOG_SHAPE_PROPERTIES_H

View File

@ -0,0 +1,146 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/color_swatch.h"
#include "dialog_shape_properties_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_SHAPE_PROPERTIES_BASE, DIALOG_SHIM )
EVT_BUTTON( wxID_APPLY, DIALOG_SHAPE_PROPERTIES_BASE::_wxFB_resetDefaults )
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 )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizerGeneral;
fgSizerGeneral = new wxFlexGridSizer( 0, 3, 7, 0 );
fgSizerGeneral->AddGrowableCol( 1 );
fgSizerGeneral->SetFlexibleDirection( wxBOTH );
fgSizerGeneral->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lineWidthLabel = new wxStaticText( this, wxID_ANY, _("Line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthLabel->Wrap( -1 );
fgSizerGeneral->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
m_lineWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), 0 );
fgSizerGeneral->Add( m_lineWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 );
m_lineWidthUnits = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineWidthUnits->Wrap( -1 );
m_lineWidthUnits->SetMinSize( wxSize( 40,-1 ) );
fgSizerGeneral->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 3 );
m_lineColorLabel = new wxStaticText( this, wxID_ANY, _("Line color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineColorLabel->Wrap( -1 );
fgSizerGeneral->Add( m_lineColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_panel1 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxVERTICAL );
m_lineColorSwatch = new COLOR_SWATCH( m_panel1, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer2->Add( m_lineColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panel1->SetSizer( bSizer2 );
m_panel1->Layout();
bSizer2->Fit( m_panel1 );
fgSizerGeneral->Add( m_panel1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 2 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
m_lineStyleLabel = new wxStaticText( this, wxID_ANY, _("Line style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lineStyleLabel->Wrap( -1 );
fgSizerGeneral->Add( m_lineStyleLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_lineStyleCombo = new wxBitmapComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
m_lineStyleCombo->SetMinSize( wxSize( 240,-1 ) );
fgSizerGeneral->Add( m_lineStyleCombo, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 3 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
m_filledCtrl = new wxCheckBox( this, wxID_ANY, _("Filled shape"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGeneral->Add( m_filledCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizerGeneral->Add( 0, 0, 1, wxEXPAND, 5 );
m_fillColorLabel = new wxStaticText( this, wxID_ANY, _("Fill color:"), wxDefaultPosition, wxDefaultSize, 0 );
m_fillColorLabel->Wrap( -1 );
fgSizerGeneral->Add( m_fillColorLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_panel11 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE|wxTAB_TRAVERSAL );
wxBoxSizer* bSizer21;
bSizer21 = new wxBoxSizer( wxVERTICAL );
m_fillColorSwatch = new COLOR_SWATCH( m_panel11, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer21->Add( m_fillColorSwatch, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_panel11->SetSizer( bSizer21 );
m_panel11->Layout();
bSizer21->Fit( m_panel11 );
fgSizerGeneral->Add( m_panel11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( fgSizerGeneral, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 10 );
m_helpLabel1 = new wxStaticText( this, wxID_ANY, _("Set line width to 0 to use Schematic Editor line widths."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel1->Wrap( 333 );
mainSizer->Add( m_helpLabel1, 0, wxTOP|wxRIGHT|wxLEFT, 10 );
m_helpLabel2 = new wxStaticText( this, wxID_ANY, _("Set line color to transparent to use Schematic Editor colors."), wxDefaultPosition, wxDefaultSize, 0 );
m_helpLabel2->Wrap( -1 );
mainSizer->Add( m_helpLabel2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 10 );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerApply = new wxButton( this, wxID_APPLY );
m_sdbSizer->AddButton( m_sdbSizerApply );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
mainSizer->Add( m_sdbSizer, 0, wxALL|wxALIGN_RIGHT, 5 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_SHAPE_PROPERTIES_BASE::~DIALOG_SHAPE_PROPERTIES_BASE()
{
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,76 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// 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;
#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/textctrl.h>
#include <wx/sizer.h>
#include <wx/panel.h>
#include <wx/bmpcbox.h>
#include <wx/checkbox.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SHAPE_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_resetDefaults( wxCommandEvent& event ){ resetDefaults( event ); }
protected:
wxStaticText* m_lineWidthLabel;
wxTextCtrl* m_lineWidthCtrl;
wxStaticText* m_lineWidthUnits;
wxStaticText* m_lineColorLabel;
wxPanel* m_panel1;
COLOR_SWATCH* m_lineColorSwatch;
wxStaticText* m_lineStyleLabel;
wxBitmapComboBox* m_lineStyleCombo;
wxCheckBox* m_filledCtrl;
wxStaticText* m_fillColorLabel;
wxPanel* m_panel11;
COLOR_SWATCH* m_fillColorSwatch;
wxStaticText* m_helpLabel1;
wxStaticText* m_helpLabel2;
wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerApply;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void resetDefaults( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_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_SHAPE_PROPERTIES_BASE();
};

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