mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 13:01:41 +00:00
Pass objects by reference instead of on the stack.
This commit is contained in:
parent
b00d01dcc4
commit
9ebabb222c
common
eeschema
lib_arc.cpplib_arc.hlib_circle.cpplib_circle.hlib_field.cpplib_field.hlib_item.hlib_polyline.cpplib_polyline.hlib_rectangle.cpplib_rectangle.hlib_text.cpplib_text.hsch_bitmap.cppsch_bitmap.hsch_bus_entry.cppsch_bus_entry.hsch_field.cppsch_field.hsch_item.hsch_junction.cppsch_junction.hsch_line.cppsch_line.hsch_marker.cppsch_marker.hsch_no_connect.cppsch_no_connect.hsch_pin.h
sch_plugins
sch_sheet.cppsch_sheet.hsch_sheet_path.cppsch_sheet_pin.cppsch_sheet_pin.hsch_symbol.cppsch_symbol.hsch_text.cppsch_text.hinclude
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
@ -161,10 +161,13 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect ) const
|
||||
|
||||
// calculate the left common area coordinate:
|
||||
int left = std::max( me.m_pos.x, rect.m_pos.x );
|
||||
|
||||
// calculate the right common area coordinate:
|
||||
int right = std::min( me.m_pos.x + me.m_size.x, rect.m_pos.x + rect.m_size.x );
|
||||
|
||||
// calculate the upper common area coordinate:
|
||||
int top = std::max( me.m_pos.y, aRect.m_pos.y );
|
||||
|
||||
// calculate the lower common area coordinate:
|
||||
int bottom = std::min( me.m_pos.y + me.m_size.y, rect.m_pos.y + rect.m_size.y );
|
||||
|
||||
@ -229,7 +232,6 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||
wxPoint corners[4];
|
||||
|
||||
/* Test A : Any corners exist in rotated rect? */
|
||||
|
||||
corners[0] = m_pos;
|
||||
corners[1] = m_pos + wxPoint( m_size.x, 0 );
|
||||
corners[2] = m_pos + wxPoint( m_size.x, m_size.y );
|
||||
@ -272,7 +274,6 @@ bool EDA_RECT::Intersects( const EDA_RECT& aRect, double aRot ) const
|
||||
}
|
||||
|
||||
/* Test C : Any sides of rotated rect intersect this */
|
||||
|
||||
if( Intersects( corners[0], corners[1] ) || Intersects( corners[1], corners[2] )
|
||||
|| Intersects( corners[2], corners[3] ) || Intersects( corners[3], corners[0] ) )
|
||||
{
|
||||
@ -327,8 +328,8 @@ bool EDA_RECT::IntersectsCircle( const wxPoint& aCenter, const int aRadius ) con
|
||||
}
|
||||
|
||||
|
||||
bool EDA_RECT::IntersectsCircleEdge(
|
||||
const wxPoint& aCenter, const int aRadius, const int aWidth ) const
|
||||
bool EDA_RECT::IntersectsCircleEdge( const wxPoint& aCenter, const int aRadius,
|
||||
const int aWidth ) const
|
||||
{
|
||||
if( !m_init )
|
||||
return false;
|
||||
@ -469,6 +470,7 @@ void EDA_RECT::Merge( const wxPoint& aPoint )
|
||||
Normalize(); // ensure width and height >= 0
|
||||
|
||||
wxPoint end = GetEnd();
|
||||
|
||||
// Change origin and size in order to contain the given rect
|
||||
m_pos.x = std::min( m_pos.x, aPoint.x );
|
||||
m_pos.y = std::min( m_pos.y, aPoint.y );
|
||||
@ -508,7 +510,7 @@ EDA_RECT EDA_RECT::Common( const EDA_RECT& aRect ) const
|
||||
}
|
||||
|
||||
|
||||
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngle ) const
|
||||
const EDA_RECT EDA_RECT::GetBoundingBoxRotated( const wxPoint& aRotCenter, double aAngle ) const
|
||||
{
|
||||
wxPoint corners[4];
|
||||
|
||||
@ -541,4 +543,4 @@ const EDA_RECT EDA_RECT::GetBoundingBoxRotated( wxPoint aRotCenter, double aAngl
|
||||
bbox.SetEnd( end );
|
||||
|
||||
return bbox;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see change_log.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
|
||||
@ -42,7 +42,7 @@
|
||||
#include <gal/stroke_font.h> // for STROKE_FONT
|
||||
#include <gr_text.h> // for GRText
|
||||
#include <kicad_string.h> // for UnescapeString
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <math/vector2d.h> // for VECTOR2D
|
||||
#include <richio.h>
|
||||
#include <render_settings.h>
|
||||
@ -459,7 +459,7 @@ void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCoun
|
||||
}
|
||||
|
||||
void EDA_TEXT::printOneLineOfText( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||
COLOR4D aColor, OUTLINE_MODE aFillMode,
|
||||
const COLOR4D& aColor, OUTLINE_MODE aFillMode,
|
||||
const wxString& aText, const wxPoint &aPos )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
@ -529,7 +529,8 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
|
||||
FormatInternalUnits( GetTextWidth() ).c_str() );
|
||||
|
||||
if( GetTextThickness() )
|
||||
aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextThickness() ).c_str() );
|
||||
aFormatter->Print( 0, " (thickness %s)",
|
||||
FormatInternalUnits( GetTextThickness() ).c_str() );
|
||||
|
||||
if( IsBold() )
|
||||
aFormatter->Print( 0, " bold" );
|
||||
@ -546,13 +547,15 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
|
||||
aFormatter->Print( 0, " (justify");
|
||||
|
||||
if( GetHorizJustify() != GR_TEXT_HJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
|
||||
aFormatter->Print( 0,
|
||||
( GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ) ? " left" : " right" );
|
||||
|
||||
if( GetVertJustify() != GR_TEXT_VJUSTIFY_CENTER )
|
||||
aFormatter->Print( 0, (GetVertJustify() == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
|
||||
|
||||
if( IsMirrored() )
|
||||
aFormatter->Print( 0, " mirror" );
|
||||
|
||||
aFormatter->Print( 0, ")" ); // (justify
|
||||
}
|
||||
|
||||
@ -654,7 +657,9 @@ static struct EDA_TEXT_DESC
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, wxString>( _HKI( "Text" ),
|
||||
&EDA_TEXT::SetText, &EDA_TEXT::GetText ) );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Thickness" ),
|
||||
&EDA_TEXT::SetTextThickness, &EDA_TEXT::GetTextThickness, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
&EDA_TEXT::SetTextThickness,
|
||||
&EDA_TEXT::GetTextThickness,
|
||||
PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Italic" ),
|
||||
&EDA_TEXT::SetItalic, &EDA_TEXT::IsItalic ) );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Bold" ),
|
||||
@ -664,13 +669,21 @@ static struct EDA_TEXT_DESC
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Visible" ),
|
||||
&EDA_TEXT::SetVisible, &EDA_TEXT::IsVisible ) );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Width" ),
|
||||
&EDA_TEXT::SetTextWidth, &EDA_TEXT::GetTextWidth, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
&EDA_TEXT::SetTextWidth,
|
||||
&EDA_TEXT::GetTextWidth,
|
||||
PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Height" ),
|
||||
&EDA_TEXT::SetTextHeight, &EDA_TEXT::GetTextHeight, PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT, EDA_TEXT_HJUSTIFY_T>( _HKI( "Horizontal Justification" ),
|
||||
&EDA_TEXT::SetHorizJustify, &EDA_TEXT::GetHorizJustify ) );
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT, EDA_TEXT_VJUSTIFY_T>( _HKI( "Vertical Justification" ),
|
||||
&EDA_TEXT::SetVertJustify, &EDA_TEXT::GetVertJustify ) );
|
||||
&EDA_TEXT::SetTextHeight,
|
||||
&EDA_TEXT::GetTextHeight,
|
||||
PROPERTY_DISPLAY::DISTANCE ) );
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
|
||||
EDA_TEXT_HJUSTIFY_T>( _HKI( "Horizontal Justification" ),
|
||||
&EDA_TEXT::SetHorizJustify,
|
||||
&EDA_TEXT::GetHorizJustify ) );
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_TEXT,
|
||||
EDA_TEXT_VJUSTIFY_T>( _HKI( "Vertical Justification" ),
|
||||
&EDA_TEXT::SetVertJustify,
|
||||
&EDA_TEXT::GetVertJustify ) );
|
||||
}
|
||||
} _EDA_TEXT_DESC;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -68,13 +68,6 @@ bool ConvertSmartQuotesAndDashes( wxString* aString )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* These Escape/Unescape routines use HTML-entity-reference-style encoding to handle
|
||||
* characters which are:
|
||||
* (a) not legal in filenames
|
||||
* (b) used as control characters in LIB_IDs
|
||||
* (c) used to delineate hierarchical paths
|
||||
*/
|
||||
wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
||||
{
|
||||
wxString converted;
|
||||
@ -326,11 +319,13 @@ int ReadDelimitedText( char* aDest, const char* aSource, int aDestSize )
|
||||
}
|
||||
|
||||
|
||||
std::string EscapedUTF8( wxString aString )
|
||||
std::string EscapedUTF8( const wxString& aString )
|
||||
{
|
||||
wxString str = aString;
|
||||
|
||||
// No new-lines allowed in quoted strings
|
||||
aString.Replace( "\r\n", "\r" );
|
||||
aString.Replace( "\n", "\r" );
|
||||
str.Replace( "\r\n", "\r" );
|
||||
str.Replace( "\n", "\r" );
|
||||
|
||||
std::string utf8 = TO_UTF8( aString );
|
||||
|
||||
@ -387,9 +382,11 @@ wxString EscapeHTML( const wxString& aString )
|
||||
}
|
||||
|
||||
|
||||
bool NoPrintableChars( wxString aString )
|
||||
bool NoPrintableChars( const wxString& aString )
|
||||
{
|
||||
return aString.Trim( true ).Trim( false ).IsEmpty();
|
||||
wxString tmp = aString;
|
||||
|
||||
return tmp.Trim( true ).Trim( false ).IsEmpty();
|
||||
}
|
||||
|
||||
|
||||
@ -673,7 +670,7 @@ int ValueStringCompare( wxString strFWord, wxString strSWord )
|
||||
}
|
||||
|
||||
|
||||
int SplitString( wxString strToSplit,
|
||||
int SplitString( const wxString& strToSplit,
|
||||
wxString* strBeginning,
|
||||
wxString* strDigits,
|
||||
wxString* strEnd )
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 CERN
|
||||
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.txt for contributors.
|
||||
* Copyright (C) 2019-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
|
||||
@ -53,7 +53,8 @@ wxBitmap MakeDisabledBitmap( const wxBitmap& aSource )
|
||||
}
|
||||
|
||||
|
||||
ACTION_GROUP::ACTION_GROUP( std::string aName, const std::vector<const TOOL_ACTION*>& aActions )
|
||||
ACTION_GROUP::ACTION_GROUP( const std::string& aName,
|
||||
const std::vector<const TOOL_ACTION*>& aActions )
|
||||
{
|
||||
wxASSERT_MSG( aActions.size() > 0, "Action groups must have at least one action" );
|
||||
|
||||
@ -112,7 +113,7 @@ ACTION_TOOLBAR_PALETTE::ACTION_TOOLBAR_PALETTE( wxWindow* aParent, bool aVertica
|
||||
m_panel->SetSizer( m_mainSizer );
|
||||
|
||||
Connect( wxEVT_CHAR_HOOK, wxCharEventHandler( ACTION_TOOLBAR_PALETTE::onCharHook ),
|
||||
NULL, this );
|
||||
nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
@ -195,17 +196,16 @@ ACTION_TOOLBAR::ACTION_TOOLBAR( EDA_BASE_FRAME* parent, wxWindowID id, const wxP
|
||||
#endif
|
||||
|
||||
Connect( wxEVT_COMMAND_TOOL_CLICKED, wxAuiToolBarEventHandler( ACTION_TOOLBAR::onToolEvent ),
|
||||
NULL, this );
|
||||
Connect( wxEVT_AUITOOLBAR_RIGHT_CLICK, wxAuiToolBarEventHandler( ACTION_TOOLBAR::onToolRightClick ),
|
||||
NULL, this );
|
||||
nullptr, this );
|
||||
Connect( wxEVT_AUITOOLBAR_RIGHT_CLICK,
|
||||
wxAuiToolBarEventHandler( ACTION_TOOLBAR::onToolRightClick ),
|
||||
nullptr, this );
|
||||
Connect( wxEVT_AUITOOLBAR_BEGIN_DRAG, wxAuiToolBarEventHandler( ACTION_TOOLBAR::onItemDrag ),
|
||||
NULL, this );
|
||||
Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( ACTION_TOOLBAR::onMouseClick ),
|
||||
NULL, this );
|
||||
Connect( wxEVT_LEFT_UP, wxMouseEventHandler( ACTION_TOOLBAR::onMouseClick ),
|
||||
NULL, this );
|
||||
Connect( m_paletteTimer->GetId(), wxEVT_TIMER, wxTimerEventHandler( ACTION_TOOLBAR::onTimerDone ),
|
||||
NULL, this );
|
||||
nullptr, this );
|
||||
Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( ACTION_TOOLBAR::onMouseClick ), nullptr, this );
|
||||
Connect( wxEVT_LEFT_UP, wxMouseEventHandler( ACTION_TOOLBAR::onMouseClick ), nullptr, this );
|
||||
Connect( m_paletteTimer->GetId(), wxEVT_TIMER,
|
||||
wxTimerEventHandler( ACTION_TOOLBAR::onTimerDone ), nullptr, this );
|
||||
}
|
||||
|
||||
|
||||
@ -371,10 +371,10 @@ void ACTION_TOOLBAR::UpdateControlWidth( int aID )
|
||||
if( wxSizerItem* szrItem = item->GetSizerItem() )
|
||||
szrItem->SetMinSize( bestSize );
|
||||
|
||||
// 2. The controls have a second sizer that allows for padding above/below the control with stretch
|
||||
// space, so we also need to update the sizer item for the control in that sizer with the new size.
|
||||
// We let wx do the search for us, since SetItemMinSize is recursive and will locate the control
|
||||
// on that sizer.
|
||||
// 2. The controls have a second sizer that allows for padding above/below the control with
|
||||
// stretch space, so we also need to update the sizer item for the control in that sizer with
|
||||
// the new size. We let wx do the search for us, since SetItemMinSize is recursive and will
|
||||
// locate the control on that sizer.
|
||||
if( m_sizer )
|
||||
{
|
||||
m_sizer->SetItemMinSize( control, bestSize );
|
||||
@ -404,8 +404,7 @@ void ACTION_TOOLBAR::SetToolBitmap( const TOOL_ACTION& aAction, const wxBitmap&
|
||||
int toolId = aAction.GetUIId();
|
||||
wxAuiToolBar::SetToolBitmap( toolId, aBitmap );
|
||||
|
||||
// Set the disabled bitmap: we use the disabled bitmap version
|
||||
// of aBitmap.
|
||||
// Set the disabled bitmap: we use the disabled bitmap version of aBitmap.
|
||||
wxAuiToolBarItem* tb_item = wxAuiToolBar::FindTool( toolId );
|
||||
|
||||
if( tb_item )
|
||||
@ -641,8 +640,8 @@ void ACTION_TOOLBAR::popupPalette( wxAuiToolBarItem* aItem )
|
||||
size_t numActions = group->m_actions.size();
|
||||
|
||||
// The size of the palette in the long dimension
|
||||
int paletteLongDim = ( 2 * PALETTE_BORDER ) // The border on all sides of the buttons
|
||||
+ ( BUTTON_BORDER ) // The border on the start of the buttons
|
||||
int paletteLongDim = ( 2 * PALETTE_BORDER ) // The border on all sides of the buttons
|
||||
+ ( BUTTON_BORDER ) // The border on the start of the buttons
|
||||
+ ( numActions * BUTTON_BORDER ) // The other button borders
|
||||
+ ( numActions * toolRect.GetHeight() ); // The size of the buttons
|
||||
|
||||
@ -651,33 +650,38 @@ void ACTION_TOOLBAR::popupPalette( wxAuiToolBarItem* aItem )
|
||||
{
|
||||
case wxAUI_DOCK_TOP:
|
||||
// Top toolbars need to shift the palette window down by the toolbar padding
|
||||
dir = true; // Buttons are vertical in the palette
|
||||
dir = true; // Buttons are vertical in the palette
|
||||
pos = ClientToScreen( toolRect.GetBottomLeft() );
|
||||
pos += wxPoint( -PALETTE_BORDER, // Shift left to align the button edges
|
||||
m_bottomPadding ); // Shift down to move away from the toolbar
|
||||
pos += wxPoint( -PALETTE_BORDER, // Shift left to align the button edges
|
||||
m_bottomPadding ); // Shift down to move away from the toolbar
|
||||
break;
|
||||
|
||||
case wxAUI_DOCK_BOTTOM:
|
||||
// Bottom toolbars need to shift the palette window up by its height (all buttons + border + toolbar padding)
|
||||
dir = true; // Buttons are vertical in the palette
|
||||
// Bottom toolbars need to shift the palette window up by its height (all buttons +
|
||||
// border + toolbar padding)
|
||||
dir = true; // Buttons are vertical in the palette
|
||||
pos = ClientToScreen( toolRect.GetTopLeft() );
|
||||
pos += wxPoint( -PALETTE_BORDER, // Shift left to align the button
|
||||
-( paletteLongDim + m_topPadding ) ); // Shift up by the entire length of the palette
|
||||
// Shift up by the entire length of the palette.
|
||||
-( paletteLongDim + m_topPadding ) );
|
||||
break;
|
||||
|
||||
case wxAUI_DOCK_LEFT:
|
||||
// Left toolbars need to shift the palette window up by the toolbar padding
|
||||
dir = false; // Buttons are horizontal in the palette
|
||||
dir = false; // Buttons are horizontal in the palette
|
||||
pos = ClientToScreen( toolRect.GetTopRight() );
|
||||
pos += wxPoint( m_rightPadding, // Shift right to move away from the toolbar
|
||||
-( PALETTE_BORDER ) ); // Shift up to align the button tops
|
||||
pos += wxPoint( m_rightPadding, // Shift right to move away from the toolbar
|
||||
-( PALETTE_BORDER ) ); // Shift up to align the button tops
|
||||
break;
|
||||
|
||||
case wxAUI_DOCK_RIGHT:
|
||||
// Right toolbars need to shift the palette window left by its width (all buttons + border + toolbar padding)
|
||||
dir = false; // Buttons are horizontal in the palette
|
||||
// Right toolbars need to shift the palette window left by its width (all buttons +
|
||||
// border + toolbar padding)
|
||||
dir = false; // Buttons are horizontal in the palette
|
||||
pos = ClientToScreen( toolRect.GetTopLeft() );
|
||||
pos += wxPoint( -( paletteLongDim + m_leftPadding ), // Shift left by the entire length of the palette
|
||||
|
||||
// Shift left by the entire length of the palette.
|
||||
pos += wxPoint( -( paletteLongDim + m_leftPadding ),
|
||||
-( PALETTE_BORDER ) ); // Shift up to align the button
|
||||
break;
|
||||
}
|
||||
@ -688,7 +692,7 @@ void ACTION_TOOLBAR::popupPalette( wxAuiToolBarItem* aItem )
|
||||
m_palette->SetGroup( group );
|
||||
m_palette->SetButtonSize( toolRect );
|
||||
m_palette->Connect( wxEVT_BUTTON, wxCommandEventHandler( ACTION_TOOLBAR::onPaletteEvent ),
|
||||
NULL, this );
|
||||
nullptr, this );
|
||||
|
||||
|
||||
// Add the actions in the group to the palette and update their enabled state
|
||||
@ -725,8 +729,7 @@ void ACTION_TOOLBAR::popupPalette( wxAuiToolBarItem* aItem )
|
||||
}
|
||||
|
||||
|
||||
void ACTION_TOOLBAR::OnCustomRender(wxDC& aDc, const wxAuiToolBarItem& aItem,
|
||||
const wxRect& aRect )
|
||||
void ACTION_TOOLBAR::OnCustomRender(wxDC& aDc, const wxAuiToolBarItem& aItem, const wxRect& aRect )
|
||||
{
|
||||
auto it = m_actionGroups.find( aItem.GetId() );
|
||||
|
||||
@ -766,14 +769,16 @@ void ACTION_TOOLBAR::OnCustomRender(wxDC& aDc, const wxAuiToolBarItem& aItem,
|
||||
bool ACTION_TOOLBAR::KiRealize()
|
||||
{
|
||||
wxClientDC dc( this );
|
||||
|
||||
if( !dc.IsOk() )
|
||||
return false;
|
||||
|
||||
// calculate hint sizes for both horizontal and vertical
|
||||
// in the order that leaves toolbar in correct final state
|
||||
|
||||
// however, skip calculating alternate orientations if we dont need them due to window style
|
||||
// however, skip calculating alternate orientations if we don't need them due to window style
|
||||
bool retval = true;
|
||||
|
||||
if( m_orientation == wxHORIZONTAL )
|
||||
{
|
||||
if( !( GetWindowStyle() & wxAUI_TB_HORIZONTAL ) )
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019 CERN
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@ -421,7 +421,7 @@ BITMAPS LIB_ARC::GetMenuImage() const
|
||||
}
|
||||
|
||||
|
||||
void LIB_ARC::BeginEdit( const wxPoint aPosition )
|
||||
void LIB_ARC::BeginEdit( const wxPoint& aPosition )
|
||||
{
|
||||
m_ArcStart = m_ArcEnd = aPosition;
|
||||
m_editState = 1;
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
|
||||
int GetPenWidth() const override;
|
||||
|
||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||
void BeginEdit( const wxPoint& aStartPoint ) override;
|
||||
void CalcEdit( const wxPoint& aPosition ) override;
|
||||
void SetEditState( int aState ) { m_editState = aState; }
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -284,7 +284,7 @@ BITMAPS LIB_CIRCLE::GetMenuImage() const
|
||||
}
|
||||
|
||||
|
||||
void LIB_CIRCLE::BeginEdit( const wxPoint aPosition )
|
||||
void LIB_CIRCLE::BeginEdit( const wxPoint& aPosition )
|
||||
{
|
||||
m_Pos = aPosition;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -26,13 +26,12 @@
|
||||
#define LIB_CIRCLE_H
|
||||
|
||||
#include <lib_item.h>
|
||||
#include <trigo.h> // for GetLineLength
|
||||
|
||||
|
||||
class LIB_CIRCLE : public LIB_ITEM
|
||||
{
|
||||
public:
|
||||
LIB_CIRCLE( LIB_PART * aParent );
|
||||
LIB_CIRCLE( LIB_PART* aParent );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
@ -57,7 +56,7 @@ public:
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||
void BeginEdit( const wxPoint& aStartPoint ) override;
|
||||
void CalcEdit( const wxPoint& aPosition ) override;
|
||||
|
||||
void Offset( const wxPoint& aOffset ) override;
|
||||
|
@ -409,7 +409,7 @@ wxString LIB_FIELD::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||
}
|
||||
|
||||
|
||||
void LIB_FIELD::BeginEdit( const wxPoint aPosition )
|
||||
void LIB_FIELD::BeginEdit( const wxPoint& aPosition )
|
||||
{
|
||||
SetTextPos( aPosition );
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -108,7 +108,7 @@ public:
|
||||
void Init( int idfield );
|
||||
|
||||
/**
|
||||
* Returns the field name.
|
||||
* Return the field name.
|
||||
*
|
||||
* The first four field IDs are reserved and therefore always return their respective
|
||||
* names.
|
||||
@ -171,7 +171,7 @@ public:
|
||||
|
||||
SCH_LAYER_ID GetDefaultLayer() const;
|
||||
|
||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||
void BeginEdit( const wxPoint& aStartPoint ) override;
|
||||
|
||||
void Offset( const wxPoint& aOffset ) override;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -63,7 +63,7 @@ class LIB_ITEM : public EDA_ITEM
|
||||
{
|
||||
public:
|
||||
LIB_ITEM( KICAD_T aType, LIB_PART* aComponent = NULL, int aUnit = 0, int aConvert = 0,
|
||||
FILL_TYPE aFillType = FILL_TYPE::NO_FILL );
|
||||
FILL_TYPE aFillType = FILL_TYPE::NO_FILL );
|
||||
|
||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||
|
||||
@ -96,7 +96,7 @@ public:
|
||||
* @param aPosition The position in drawing coordinates where the drawing was started.
|
||||
* May or may not be required depending on the item being drawn.
|
||||
*/
|
||||
virtual void BeginEdit( const wxPoint aPosition ) {}
|
||||
virtual void BeginEdit( const wxPoint& aPosition ) {}
|
||||
|
||||
/**
|
||||
* Continue an edit in progress at \a aPosition.
|
||||
@ -108,7 +108,7 @@ public:
|
||||
* @param aPosition The position of the mouse left click in drawing coordinates.
|
||||
* @return True if additional mouse clicks are required to complete the edit in progress.
|
||||
*/
|
||||
virtual bool ContinueEdit( const wxPoint aPosition ) { return false; }
|
||||
virtual bool ContinueEdit( const wxPoint& aPosition ) { return false; }
|
||||
|
||||
/**
|
||||
* End an object editing action.
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -359,14 +359,14 @@ BITMAPS LIB_POLYLINE::GetMenuImage() const
|
||||
}
|
||||
|
||||
|
||||
void LIB_POLYLINE::BeginEdit( const wxPoint aPosition )
|
||||
void LIB_POLYLINE::BeginEdit( const wxPoint& aPosition )
|
||||
{
|
||||
m_PolyPoints.push_back( aPosition ); // Start point of first segment.
|
||||
m_PolyPoints.push_back( aPosition ); // End point of first segment.
|
||||
}
|
||||
|
||||
|
||||
bool LIB_POLYLINE::ContinueEdit( const wxPoint aPosition )
|
||||
bool LIB_POLYLINE::ContinueEdit( const wxPoint& aPosition )
|
||||
{
|
||||
// do not add zero length segments
|
||||
if( m_PolyPoints[m_PolyPoints.size() - 2] != m_PolyPoints.back() )
|
||||
|
@ -75,9 +75,9 @@ public:
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||
void BeginEdit( const wxPoint& aStartPoint ) override;
|
||||
void CalcEdit( const wxPoint& aPosition ) override;
|
||||
bool ContinueEdit( const wxPoint aNextPoint ) override;
|
||||
bool ContinueEdit( const wxPoint& aNextPoint ) override;
|
||||
void EndEdit() override;
|
||||
|
||||
void Offset( const wxPoint& aOffset ) override;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -288,7 +288,7 @@ BITMAPS LIB_RECTANGLE::GetMenuImage() const
|
||||
}
|
||||
|
||||
|
||||
void LIB_RECTANGLE::BeginEdit( const wxPoint aPosition )
|
||||
void LIB_RECTANGLE::BeginEdit( const wxPoint& aPosition )
|
||||
{
|
||||
m_Pos = m_End = aPosition;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
|
||||
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||
|
||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||
void BeginEdit( const wxPoint& aStartPoint ) override;
|
||||
void CalcEdit( const wxPoint& aPosition ) override;
|
||||
|
||||
void Offset( const wxPoint& aOffset ) override;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -390,7 +390,7 @@ BITMAPS LIB_TEXT::GetMenuImage() const
|
||||
}
|
||||
|
||||
|
||||
void LIB_TEXT::BeginEdit( const wxPoint aPosition )
|
||||
void LIB_TEXT::BeginEdit( const wxPoint& aPosition )
|
||||
{
|
||||
SetTextPos( aPosition );
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
|
||||
const EDA_RECT GetBoundingBox() const override;
|
||||
|
||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||
void BeginEdit( const wxPoint& aStartPoint ) override;
|
||||
void CalcEdit( const wxPoint& aPosition ) override;
|
||||
|
||||
void Offset( const wxPoint& aOffset ) override;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2011 jean-pierre.charras
|
||||
* Copyright (C) 2011-2019 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2011-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
|
||||
@ -142,7 +142,7 @@ void SCH_BITMAP::MirrorHorizontally( int aCenter )
|
||||
}
|
||||
|
||||
|
||||
void SCH_BITMAP::Rotate( wxPoint aCenter )
|
||||
void SCH_BITMAP::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
RotatePoint( &m_pos, aCenter, 900 );
|
||||
m_image->Rotate( false );
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( wxPoint aCenter ) override;
|
||||
void Rotate( const wxPoint& aCenter ) override;
|
||||
|
||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-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
|
||||
@ -268,7 +268,7 @@ void SCH_BUS_ENTRY_BASE::MirrorHorizontally( int aCenter )
|
||||
}
|
||||
|
||||
|
||||
void SCH_BUS_ENTRY_BASE::Rotate( wxPoint aCenter )
|
||||
void SCH_BUS_ENTRY_BASE::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
RotatePoint( &m_pos, aCenter, 900 );
|
||||
RotatePoint( &m_size.x, &m_size.y, 900 );
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2020 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2021 KiCad Developers, see change_log.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
|
||||
@ -90,7 +90,7 @@ public:
|
||||
|
||||
void MirrorHorizontally( int aCenter ) override;
|
||||
void MirrorVertically( int aCenter ) override;
|
||||
void Rotate( wxPoint aCenter ) override;
|
||||
void Rotate( const wxPoint& aCenter ) override;
|
||||
|
||||
bool IsDangling() const override;
|
||||
|
||||
|
@ -53,6 +53,7 @@
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/ee_actions.h>
|
||||
|
||||
|
||||
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
|
||||
const wxString& aName ) :
|
||||
SCH_ITEM( aParent, SCH_FIELD_T ),
|
||||
@ -460,7 +461,7 @@ bool SCH_FIELD::Replace( const wxFindReplaceData& aSearchData, void* aAuxData )
|
||||
}
|
||||
|
||||
|
||||
void SCH_FIELD::Rotate( wxPoint aCenter )
|
||||
void SCH_FIELD::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
wxPoint pt = GetPosition();
|
||||
RotatePoint( &pt, aCenter, 900 );
|
||||
|
@ -150,7 +150,7 @@ public:
|
||||
Offset( aMoveVector );
|
||||
}
|
||||
|
||||
void Rotate( wxPoint aCenter ) override;
|
||||
void Rotate( const wxPoint& aCenter ) override;
|
||||
|
||||
/**
|
||||
* @copydoc SCH_ITEM::MirrorVertically()
|
||||
|
@ -233,7 +233,7 @@ public:
|
||||
virtual bool IsMovableFromAnchorPoint() const { return true; }
|
||||
|
||||
wxPoint& GetStoredPos() { return m_storedPos; }
|
||||
void SetStoredPos( wxPoint aPos ) { m_storedPos = aPos; }
|
||||
void SetStoredPos( const wxPoint& aPos ) { m_storedPos = aPos; }
|
||||
|
||||
/**
|
||||
* Searches the item hierarchy to find a SCHEMATIC.
|
||||
@ -316,7 +316,7 @@ public:
|
||||
/**
|
||||
* Rotate the item around \a aCenter 90 degrees in the clockwise direction.
|
||||
*/
|
||||
virtual void Rotate( wxPoint aCenter ) = 0;
|
||||
virtual void Rotate( const wxPoint& aCenter ) = 0;
|
||||
|
||||
/**
|
||||
* Add the schematic item end points to \a aItemList if the item has end points.
|
||||
|
@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-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
|
||||
@ -135,7 +135,7 @@ void SCH_JUNCTION::MirrorHorizontally( int aCenter )
|
||||
}
|
||||
|
||||
|
||||
void SCH_JUNCTION::Rotate( wxPoint aCenter )
|
||||
void SCH_JUNCTION::Rotate( const wxPoint& aCenter )
|
||||
{
|
||||
RotatePoint( &m_pos, aCenter, 900 );
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user