49#include <wx/textdlg.h>
61#include <wx/mstream.h>
62#include <wx/dcmemory.h>
67constexpr int clipboardMaxBitmapSize = 4096;
68constexpr double clipboardBboxInflation = 0.02;
71void appendMimeData( std::vector<CLIPBOARD_MIME_DATA>& aMimeData,
const wxString& aMimeType,
72 const wxMemoryBuffer& aBuffer )
74 if( aBuffer.GetDataLen() == 0 )
80 aMimeData.push_back( entry );
84void appendMimeData( std::vector<CLIPBOARD_MIME_DATA>& aMimeData,
const wxString& aMimeType,
92 entry.
m_image = std::move( aImage );
93 aMimeData.push_back( std::move( entry ) );
97bool loadFileToBuffer(
const wxString& aFileName, wxMemoryBuffer& aBuffer )
99 wxFFile file( aFileName, wxS(
"rb" ) );
101 if( !file.IsOpened() )
104 wxFileOffset size = file.Length();
109 void* data = aBuffer.GetWriteBuf( size );
111 if( file.Read( data, size ) !=
static_cast<size_t>( size ) )
113 aBuffer.UngetWriteBuf( 0 );
117 aBuffer.UngetWriteBuf( size );
123 int aUnit,
int aBodyStyle, wxMemoryBuffer& aBuffer )
132 std::unique_ptr<SVG_PLOTTER> plotter = std::make_unique<SVG_PLOTTER>();
133 plotter->SetRenderSettings( &renderSettings );
139 plotter->SetPageSettings( pageInfo );
140 plotter->SetColorMode(
true );
143 plotter->SetViewport( plot_offset,
schIUScale.IU_PER_MILS / 10, 1.0,
false );
144 plotter->SetCreator( wxT(
"Eeschema-SVG" ) );
146 wxFileName tempFile( wxFileName::CreateTempFileName( wxS(
"kicad_symbol_svg" ) ) );
148 if( !plotter->OpenFile( tempFile.GetFullPath() ) )
150 wxRemoveFile( tempFile.GetFullPath() );
157 plotter->StartPlot( wxT(
"1" ) );
159 constexpr bool background =
true;
160 aSymbol->
Plot( plotter.get(), background, plotOpts, aUnit, aBodyStyle,
VECTOR2I( 0, 0 ),
false );
161 aSymbol->
Plot( plotter.get(), !background, plotOpts, aUnit, aBodyStyle,
VECTOR2I( 0, 0 ),
false );
162 aSymbol->
PlotFields( plotter.get(), !background, plotOpts, aUnit, aBodyStyle,
VECTOR2I( 0, 0 ),
false );
167 bool ok = loadFileToBuffer( tempFile.GetFullPath(), aBuffer );
168 wxRemoveFile( tempFile.GetFullPath() );
174 int aUnit,
int aBodyStyle,
int aWidth,
int aHeight,
175 double aViewScale,
const wxColour& aBgColor )
180 wxBitmap bitmap( aWidth, aHeight, 24 );
182 dc.SelectObject( bitmap );
183 dc.SetBackground( wxBrush( aBgColor ) );
195 std::unique_ptr<KIGFX::SCH_PAINTER> painter = std::make_unique<KIGFX::SCH_PAINTER>( gal );
196 std::unique_ptr<KIGFX::VIEW> view = std::make_unique<KIGFX::VIEW>();
201 view->SetPainter( painter.get() );
203 view->SetScale( 1.0 );
207 std::vector<std::unique_ptr<SCH_ITEM>> clonedItems;
211 if( aUnit && item.GetUnit() && item.GetUnit() != aUnit )
214 if( aBodyStyle && item.GetBodyStyle() && item.GetBodyStyle() != aBodyStyle )
218 clonedItems.emplace_back( clone );
227 COLOR4D bgColor4D( aBgColor.Red() / 255.0, aBgColor.Green() / 255.0,
228 aBgColor.Blue() / 255.0, 1.0 );
233 view->SetLayerVisible( i,
true );
247 double inch2Iu = 1000.0 *
schIUScale.IU_PER_MILS;
248 VECTOR2D pageSizeIn( (
double) aWidth / ppi, (
double) aHeight / ppi );
250 galPrint->SetSheetSize( pageSizeIn );
255 double zoomFactor = 2.0 * aViewScale * inch2Iu / ppi;
258 view->SetCenter( aBBox.
Centre() );
259 view->SetScale( aViewScale * zoomFactor );
266 view->UseDrawPriority(
true );
273 dc.SelectObject( wxNullBitmap );
274 return bitmap.ConvertToImage();
279 const BOX2I& aBBox,
int aUnit,
int aBodyStyle )
286 if( size.
x <= 0 || size.
y <= 0 )
291 int bitmapWidth =
KiROUND( size.
x * viewScale );
292 int bitmapHeight =
KiROUND( size.
y * viewScale );
295 if( bitmapWidth > clipboardMaxBitmapSize || bitmapHeight > clipboardMaxBitmapSize )
297 double scaleDown = (double) clipboardMaxBitmapSize / std::max( bitmapWidth, bitmapHeight );
298 bitmapWidth =
KiROUND( bitmapWidth * scaleDown );
299 bitmapHeight =
KiROUND( bitmapHeight * scaleDown );
300 viewScale *= scaleDown;
303 if( bitmapWidth <= 0 || bitmapHeight <= 0 )
307 wxImage imageOnWhite = renderSymbolToBitmap( aFrame, aSymbol, aBBox, aUnit, aBodyStyle,
308 bitmapWidth, bitmapHeight, viewScale, *wxWHITE );
309 wxImage imageOnBlack = renderSymbolToBitmap( aFrame, aSymbol, aBBox, aUnit, aBodyStyle,
310 bitmapWidth, bitmapHeight, viewScale, *wxBLACK );
312 if( !imageOnWhite.IsOk() || !imageOnBlack.IsOk() )
316 wxImage
result( bitmapWidth, bitmapHeight );
319 unsigned char* rgbWhite = imageOnWhite.GetData();
320 unsigned char* rgbBlack = imageOnBlack.GetData();
321 unsigned char* rgbResult =
result.GetData();
322 unsigned char* alphaResult =
result.GetAlpha();
324 int pixelCount = bitmapWidth * bitmapHeight;
326 for(
int i = 0; i < pixelCount; ++i )
330 int rW = rgbWhite[idx], gW = rgbWhite[idx + 1], bW = rgbWhite[idx + 2];
331 int rB = rgbBlack[idx], gB = rgbBlack[idx + 1], bB = rgbBlack[idx + 2];
337 int avgDiff = ( diffR + diffG + diffB ) / 3;
339 int alpha = 255 - avgDiff;
340 alpha = std::max( 0, std::min( 255, alpha ) );
341 alphaResult[i] =
static_cast<unsigned char>( alpha );
345 rgbResult[idx] =
static_cast<unsigned char>( std::min( 255, rB * 255 / alpha ) );
346 rgbResult[idx + 1] =
static_cast<unsigned char>( std::min( 255, gB * 255 / alpha ) );
347 rgbResult[idx + 2] =
static_cast<unsigned char>( std::min( 255, bB * 255 / alpha ) );
352 rgbResult[idx + 1] = 0;
353 rgbResult[idx + 2] = 0;
386 wxASSERT_MSG( drawingTools,
"eeschema.SymbolDrawing tool is not available" );
388 auto haveSymbolCondition =
397 if( !
m_frame->IsSymbolEditable() )
412 auto swapSelectionCondition =
424 const auto canConvertStackedPins =
428 if( sel.Size() >= 2 )
430 std::vector<SCH_PIN*> pins;
435 pins.push_back(
static_cast<SCH_PIN*
>( item ) );
439 VECTOR2I pos = pins[0]->GetPosition();
440 for(
size_t i = 1; i < pins.size(); ++i )
442 if( pins[i]->GetPosition() != pos )
449 if( sel.Size() == 1 && sel.Front()->Type() ==
SCH_PIN_T )
459 int coLocatedCount = 0;
463 if(
pin->GetPosition() == pos )
467 if( coLocatedCount >= 2 )
476 const auto canExplodeStackedPin =
479 if( sel.Size() != 1 || sel.Front()->Type() !=
SCH_PIN_T )
484 std::vector<wxString> stackedNumbers =
pin->GetStackedPinNumbers( &isValid );
485 return isValid && stackedNumbers.size() > 1;
572 commit = &localCommit;
582 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
585 item->
Rotate( rotPoint, ccw );
586 m_frame->UpdateItem( item,
false,
true );
598 if( !localCommit.
Empty() )
599 localCommit.
Push(
_(
"Rotate" ) );
624 switch( item->
Type() )
648 m_frame->UpdateItem( item,
false,
true );
654 for(
unsigned ii = 0; ii < selection.
GetSize(); ii++ )
663 m_frame->UpdateItem( item,
false,
true );
686 if( selection.
Size() < 2 )
696 for(
size_t i = 0; i < sorted.size() - 1; i++ )
702 std::swap( aPos, bPos );
729 m_frame->UpdateItem( a,
false,
true );
730 m_frame->UpdateItem( b,
false,
true );
734 for(
EDA_ITEM* selected : selection )
766 std::deque<EDA_ITEM*> items =
m_selectionTool->RequestSelection().GetItems();
777 std::set<SCH_ITEM*> toDelete;
778 int fieldsHidden = 0;
779 int fieldsAlreadyHidden = 0;
788 toDelete.insert( curr_pin );
792 if(
m_frame->SynchronizePins() )
794 std::vector<bool> got_unit( symbol->
GetUnitCount() + 1 );
796 got_unit[curr_pin->
GetUnit()] =
true;
800 if( got_unit[
pin->GetUnit()] )
803 if(
pin->GetPosition() != pos )
815 toDelete.insert(
pin );
816 got_unit[
pin->GetUnit()] =
true;
832 fieldsAlreadyHidden++;
837 toDelete.insert( schItem );
844 if( toDelete.size() == 0 )
846 if( fieldsHidden == 1 )
847 commit.
Push(
_(
"Hide Field" ) );
848 else if( fieldsHidden > 1 )
849 commit.
Push(
_(
"Hide Fields" ) );
850 else if( fieldsAlreadyHidden > 0 )
851 m_frame->ShowInfoBarError(
_(
"Use the Symbol Properties dialog to remove fields." ) );
855 commit.
Push(
_(
"Delete" ) );
876 ( !
m_frame->GetCurSymbol() ||
m_frame->GetCurSymbol()->GetLibId() != treeLibId ) )
887 else if( selection.
Size() == 1 )
895 switch( item->
Type() )
905 bool mouseOverNumber =
false;
908 mouseOverNumber = numberBox->Contains( mousePos );
912 pinTool->EditPinProperties( &
pin, mouseOverNumber );
933 wxFAIL_MSG( wxT(
"Unhandled item <" ) + item->
GetClass() + wxT(
">" ) );
953 m_frame->GetCanvas()->Refresh();
959 std::vector<MSG_PANEL_ITEM> items;
976 m_frame->GetCanvas()->Refresh();
992 m_frame->GetCanvas()->Refresh();
999 if( aField ==
nullptr )
1007 caption.Printf(
_(
"Edit '%s' Field" ), aField->
GetName() );
1021 commit.
Push( caption );
1023 m_frame->GetCanvas()->Refresh();
1024 m_frame->UpdateSymbolMsgPanelInfo();
1037 if( !bufferedSymbol )
1055 wxString newName = tempSymbol.
GetName();
1060 if( newName != symbolName )
1069 LIB_ID newLibId( libName, newName );
1070 wxDataViewItem treeItem = libMgr.
GetAdapter()->FindItem( newLibId );
1071 m_frame->UpdateLibraryTree( treeItem, &tempSymbol );
1072 m_frame->GetLibTree()->SelectLibId( newLibId );
1093 m_frame->RebuildSymbolUnitAndBodyStyleLists();
1100 m_frame->UpdateLibraryTree( treeItem, symbol );
1138 m_frame->RebuildSymbolUnitAndBodyStyleLists();
1156 wxCHECK( selTool, -1 );
1158 std::vector<SCH_PIN*> selectedPins;
1167 selectedPins.push_back( pinItem );
1180 commit.
Push(
_(
"Edit Pins" ) );
1196 wxCHECK( selTool, -1 );
1201 std::vector<SCH_PIN*> pinsToConvert;
1211 if(
pin->GetPosition() == pos )
1212 pinsToConvert.push_back(
pin );
1221 pinsToConvert.push_back(
static_cast<SCH_PIN*
>( item ) );
1225 if( pinsToConvert.size() < 2 )
1227 m_frame->ShowInfoBarError(
_(
"At least two pins are needed to convert to stacked pins" ) );
1232 VECTOR2I pos = pinsToConvert[0]->GetPosition();
1233 for(
size_t i = 1; i < pinsToConvert.size(); ++i )
1235 if( pinsToConvert[i]->GetPosition() != pos )
1237 m_frame->ShowInfoBarError(
_(
"All pins must be at the same location" ) );
1248 std::sort( pinsToConvert.begin(), pinsToConvert.end(),
1251 wxString numA = a->GetNumber();
1252 wxString numB = b->GetNumber();
1256 bool aIsNumeric = numA.ToLong( &longA );
1257 bool bIsNumeric = numB.ToLong( &longB );
1260 if( aIsNumeric && bIsNumeric )
1261 return longA < longB;
1264 if( aIsNumeric && !bIsNumeric )
1266 if( !aIsNumeric && bIsNumeric )
1274 wxString stackedNotation = wxT(
"[");
1277 auto collapseRanges = [&]() -> wxString
1279 if( pinsToConvert.empty() )
1285 std::map<wxString, std::vector<long>> prefixGroups;
1286 std::vector<wxString> nonNumericPins;
1291 wxString pinNumber =
pin->GetNumber();
1294 if( pinNumber.IsEmpty() )
1296 nonNumericPins.push_back( wxT(
"(empty)") );
1301 wxString numericPart;
1304 size_t numStart = pinNumber.length();
1305 for(
int i = pinNumber.length() - 1; i >= 0; i-- )
1307 if( !wxIsdigit( pinNumber[i] ) )
1316 if( numStart < pinNumber.length() )
1318 prefix = pinNumber.Left( numStart );
1319 numericPart = pinNumber.Mid( numStart );
1322 if( numericPart.ToLong( &numValue ) && numValue >= 0 )
1324 prefixGroups[prefix].push_back( numValue );
1329 nonNumericPins.push_back( pinNumber );
1334 nonNumericPins.push_back( pinNumber );
1339 for(
auto& [prefix, numbers] : prefixGroups )
1349 std::sort( numbers.begin(), numbers.end() );
1353 while( i < numbers.size() )
1358 long start = numbers[i];
1362 while( i + 1 < numbers.size() && numbers[i + 1] == numbers[i] + 1 )
1369 if(
end > start + 1 )
1370 result += wxString::Format( wxT(
"%s%ld-%s%ld"), escPrefix, start, escPrefix,
end );
1371 else if(
end == start + 1 )
1372 result += wxString::Format( wxT(
"%s%ld,%s%ld"), escPrefix, start, escPrefix,
end );
1374 result += wxString::Format( wxT(
"%s%ld"), escPrefix, start );
1381 for(
const wxString& nonNum : nonNumericPins )
1391 stackedNotation += collapseRanges();
1392 stackedNotation += wxT(
"]");
1395 SCH_PIN* masterPin = pinsToConvert[0];
1396 masterPin->
SetNumber( stackedNotation );
1400 wxString::Format(
"Converting %zu pins to stacked notation '%s'",
1401 pinsToConvert.size(), stackedNotation ) );
1405 std::vector<SCH_PIN*> pinsToRemove;
1406 for(
size_t i = 1; i < pinsToConvert.size(); ++i )
1408 SCH_PIN* pinToRemove = pinsToConvert[i];
1412 wxString::Format(
"Will remove pin '%s' at position (%d, %d)",
1417 pinsToRemove.push_back( pinToRemove );
1426 commit.
Push( wxString::Format(
_(
"Convert %zu Stacked Pins to '%s'" ),
1427 pinsToConvert.size(), stackedNotation ) );
1442 wxCHECK( selTool, -1 );
1448 m_frame->ShowInfoBarError(
_(
"Select a single pin with stacked notation to explode" ) );
1456 std::vector<wxString> stackedNumbers =
pin->GetStackedPinNumbers( &isValid );
1458 if( !isValid || stackedNumbers.size() <= 1 )
1460 m_frame->ShowInfoBarError(
_(
"Selected pin does not have valid stacked notation" ) );
1470 std::sort( stackedNumbers.begin(), stackedNumbers.end(),
1471 [](
const wxString& a,
const wxString& b )
1475 if( a.ToLong( &numA ) && b.ToLong( &numB ) )
1483 pin->SetNumber( stackedNumbers[0] );
1484 pin->SetVisible(
true );
1487 for(
size_t i = 1; i < stackedNumbers.size(); ++i )
1514 commit.
Push(
_(
"Explode Stacked Pin" ) );
1529 m_frame->ShowInfoBarError(
_(
"Symbol is not derived from another symbol." ) );
1551 m_frame->GetSymbolFromUndoList();
1567 m_frame->GetSymbolFromRedoList();
1577 int retVal =
Copy( aEvent );
1591 if( !symbol || !selection.
GetSize() )
1601 if( !item.IsSelected() )
1615 std::string prettyData = formatter.
GetString();
1619 std::vector<CLIPBOARD_MIME_DATA> mimeData;
1636 bbox.
GetHeight() * clipboardBboxInflation );
1650 for(
EDA_ITEM* selItem : selection )
1654 if( selSchItem->
Type() == item.Type()
1655 && selSchItem->
GetPosition() == item.GetPosition() )
1670 int unit =
m_frame->GetUnit();
1671 int bodyStyle =
m_frame->GetBodyStyle();
1673 wxMemoryBuffer svgBuffer;
1675 if( plotSymbolToSvg(
m_frame, cleanSymbol, bbox, unit, bodyStyle, svgBuffer ) )
1676 appendMimeData( mimeData, wxS(
"image/svg+xml" ), svgBuffer );
1678 wxImage pngImage = renderSymbolToImageWithAlpha(
m_frame, cleanSymbol, bbox, unit, bodyStyle );
1680 if( pngImage.IsOk() )
1681 appendMimeData( mimeData, wxS(
"image/png" ), std::move( pngImage ) );
1698 if( selection.Empty() )
1703 if( selection.IsHover() )
1724 if( newParts.empty() || !newParts[0] )
1727 newPart = newParts[0];
1734 wxString pasteText( clipboardData );
1738 if( pasteText.Length() > 5000 )
1739 pasteText = pasteText.Left( 5000 ) + wxT(
"..." );
1775 if( !selection.
Empty() )
1780 commit.
Push(
_(
"Paste" ) );
1795 if( selection.
GetSize() == 0 )
1800 std::vector<EDA_ITEM*> oldItems;
1801 std::vector<EDA_ITEM*> newItems;
1803 std::copy( selection.
begin(), selection.
end(), std::back_inserter( oldItems ) );
1804 std::sort( oldItems.begin(), oldItems.end(), [](
EDA_ITEM* a,
EDA_ITEM* b )
1808 if( a->Type() != b->Type() )
1809 return a->Type() < b->Type();
1812 if( a->Type() == SCH_PIN_T )
1814 const wxString& aNum = static_cast<SCH_PIN*>( a )->GetNumber();
1815 const wxString& bNum = static_cast<SCH_PIN*>( b )->GetNumber();
1817 cmp = StrNumCmp( aNum, bNum );
1821 if( aNum.IsNumber() && bNum.IsNumber() && cmp != 0 )
1843 newPin->
SetNumber( wxString::Format( wxT(
"%i" ), symbol->GetMaxPinNumber() + 1 ) );
1849 newItems.push_back( newItem );
1851 symbol->AddDrawItem( newItem );
1852 getView()->Add( newItem );
1858 selection.SetReferencePoint( getViewControls()->GetCursorPosition(
true ) );
1861 commit.Push(
_(
"Duplicate" ) );
constexpr EDA_IU_SCALE schIUScale
std::optional< BOX2I > OPT_BOX2I
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static TOOL_ACTION decrementPrimary
static TOOL_ACTION cancelInteractive
static TOOL_ACTION unselectAll
static TOOL_ACTION decrementSecondary
static TOOL_ACTION incrementSecondary
static TOOL_ACTION duplicate
static TOOL_ACTION incrementPrimary
static TOOL_ACTION doDelete
static TOOL_ACTION deleteTool
static TOOL_ACTION increment
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION copyAsText
static TOOL_ACTION refreshPreview
static TOOL_ACTION selectAll
static TOOL_ACTION selectItems
Select a list of items (specified as the event parameter)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr size_type GetHeight() const
constexpr const Vec & GetOrigin() const
constexpr const SizeVec & GetSize() const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
This class is setup in expectation of its children possibly using Kiway player so DIALOG_SHIM::ShowQu...
void UpdateField(SCH_FIELD *aField)
void SelectPinMapPage()
Switch the notebook to the Pin Map page (issue #2282).
bool GetApplyToAllConversions()
bool GetApplyToAllUnits()
Dialog to update or change schematic library symbols.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() const
virtual void SetPosition(const VECTOR2I &aPos)
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM * GetParent() const
virtual void SetParent(EDA_ITEM *aParent)
virtual bool IsVisible() const
void SetVertJustify(GR_TEXT_V_ALIGN_T aType)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetVisible(bool aVisible)
GR_TEXT_V_ALIGN_T GetVertJustify() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
A color representation with 4 components: red, green, blue, alpha.
GAL_ANTIALIASING_MODE antialiasing_mode
The grid style to draw the grid in.
static std::unique_ptr< GAL_PRINT > Create(GAL_DISPLAY_OPTIONS &aOptions, wxDC *aDC)
Abstract interface for drawing on a 2D-surface.
void SetZoomFactor(double aZoomFactor)
void SetLookAtPoint(const VECTOR2D &aPoint)
Get/set the Point in world space to look at.
virtual void ClearScreen()
Clear the screen.
void SetWorldUnitLength(double aWorldUnitLength)
Set the unit length.
void SetClearColor(const COLOR4D &aColor)
virtual double GetNativeDPI() const =0
virtual bool HasNativeLandscapeRotation() const =0
int GetDefaultPenWidth() const
void SetDefaultPenWidth(int aWidth)
void SetIsPrinting(bool isPrinting)
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
static constexpr int VIEW_MAX_LAYERS
Maximum number of layers that may be shown.
A logical library item identifier and consists of various portions much like a URI.
bool IsValid() const
Check if this LID_ID is valid.
const UTF8 & GetLibItemName() const
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Symbol library management helper that is specific to the symbol library editor frame.
wxObjectDataPtr< LIB_TREE_MODEL_ADAPTER > & GetAdapter()
Return the adapter object that provides the stored data.
Define a library symbol object.
const LIB_ID & GetLibId() const override
bool UnitsLocked() const
Check whether symbol units are interchangeable.
bool CanUpdateFieldsFromParent() const
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
void PlotFields(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed)
Plot symbol fields.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
wxString GetName() const override
void RemoveDrawItem(SCH_ITEM *aItem)
Remove draw aItem from list.
std::vector< SCH_PIN * > GetPins() const override
int GetUnitCount() const override
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Describe the page size and margins of a paper page on which to eventually print or plot.
void SetHeightMils(double aHeightInMils)
void SetWidthMils(double aWidthInMils)
A pin layout helper is a class that manages the layout of the parts of a pin on a schematic symbol:
OPT_BOX2I GetPinNumberBBox()
Get the bounding box of the pin number, if there is one.
static TOOL_ACTION rotateCCW
static TOOL_ACTION editSymbolPinMaps
static TOOL_ACTION mirrorV
static TOOL_ACTION convertStackedPins
static TOOL_ACTION pinTable
static TOOL_ACTION properties
static TOOL_ACTION rotateCW
static TOOL_ACTION mirrorH
static TOOL_ACTION symbolProperties
static TOOL_ACTION explodeStackedPin
static TOOL_ACTION updateSymbolFields
SCH_RENDER_SETTINGS * GetRenderSettings()
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
virtual void Revert() override
Revert the commit by restoring the modified items state.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
static void FormatLibSymbol(LIB_SYMBOL *aPart, OUTPUTFORMATTER &aFormatter)
static std::vector< LIB_SYMBOL * > ParseLibSymbols(std::string &aSymbolText, std::string aSource, int aFileVersion=SEXPR_SCHEMATIC_FILE_VERSION)
Base class for any item which can be embedded within the SCHEMATIC container class,...
SCH_ITEM * Duplicate(bool addToParentGroup, SCH_COMMIT *aCommit=nullptr, bool doClone=false) const
Routine to create a new copy of given item.
virtual void SetBodyStyle(int aBodyStyle)
virtual void MirrorHorizontally(int aCenter)
Mirror item horizontally about aCenter.
virtual void Rotate(const VECTOR2I &aCenter, bool aRotateCCW)
Rotate the item around aCenter 90 degrees in the clockwise direction.
virtual void SetUnit(int aUnit)
wxString GetClass() const override
Return the class name.
virtual void MirrorVertically(int aCenter)
Mirror item vertically about aCenter.
void SetNumber(const wxString &aNumber)
void SetVisible(bool aVisible)
void SetOrientation(PIN_ORIENTATION aOrientation)
void SetName(const wxString &aName)
void SetPosition(const VECTOR2I &aPos) override
const wxString & GetName() const
void SetLength(int aLength)
PIN_ORIENTATION GetOrientation() const
void SetNumberTextSize(int aSize)
void SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
void SetType(ELECTRICAL_PINTYPE aType)
const wxString & GetNumber() const
ELECTRICAL_PINTYPE GetType() const
void SetNameTextSize(int aSize)
void SetBackgroundColor(const COLOR4D &aColor) override
Set the background color.
void LoadColors(const COLOR_SETTINGS *aSettings) override
const PAGE_INFO & GetPageSettings() const
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
static bool NotEmpty(const SELECTION &aSelection)
Test if there are any items selected.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static bool IdleSelection(const SELECTION &aSelection)
Test if all selected items are not being edited.
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
static SELECTION_CONDITION OnlyTypes(std::vector< KICAD_T > aTypes)
Create a functor that tests if the selected items are only of given types.
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
virtual VECTOR2I GetCenter() const
Returns the center point of the selection area bounding box.
virtual unsigned int GetSize() const override
Return the number of stored items.
virtual void Clear() override
Remove all the stored items from the group.
int Size() const
Returns the number of selected parts.
std::vector< EDA_ITEM * > GetItemsSortedBySelectionOrder() const
void SetReferencePoint(const VECTOR2I &aP)
bool Empty() const
Checks if there is anything selected.
The symbol library editor main window.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Returns a pointer to the active color theme settings.
LIB_SYMBOL * GetBufferedSymbol(const wxString &aSymbolName, const wxString &aLibrary)
Return the symbol copy from the buffer.
bool UpdateSymbolAfterRename(LIB_SYMBOL *aSymbol, const wxString &aOldSymbolName, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol when the name has changed.
void SetSymbolModified(const wxString &aSymbolName, const wxString &aLibrary)
bool UpdateSymbol(LIB_SYMBOL *aSymbol, const wxString &aLibrary)
Update the symbol buffer with a new version of the symbol.
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
std::string GetClipboardUTF8()
Return the information currently stored in the system clipboard.
#define IS_PASTED
Modifier on IS_NEW which indicates it came from clipboard.
#define IS_NEW
New item, just created.
#define SELECTED
Item was manually selected by the user.
#define STRUCT_DELETED
flag indication structures to be erased
const wxChar *const traceStackedPins
Flag to enable debug output for stacked pins handling in symbol/pin code.
@ LAYER_DRAWINGSHEET
Sheet frame and title block.
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
@ PT_POWER_IN
power input (GND, VCC for ICs). Must be connected to a power output.
@ PT_PASSIVE
pin for passive symbols: must be connected, and can be connected to any pin.
PIN_ORIENTATION
The symbol library pin object orientations.
Plotting engines similar to ps (PostScript, Gerber, svg)
std::vector< EDA_ITEM * > EDA_ITEMS
constexpr double SCH_WORLD_UNIT(1e-7/0.0254)
wxString TitleCaps(const wxString &aString)
Capitalize the first letter in each word.
wxString EscapeStackedPinItem(const wxString &aPinNumber)
Escape the characters that carry structural meaning inside stacked pin notation ('[',...
std::optional< wxBitmap > m_image
Optional bitmap image to add to clipboard via wxBitmapDataObject.
wxString result
Test unit parsing edge cases and error handling.
constexpr GR_TEXT_H_ALIGN_T GetFlippedAlignment(GR_TEXT_H_ALIGN_T aAlign)
Get the reverse alignment: left-right are swapped, others are unchanged.
wxLogTrace helper definitions.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
constexpr int LexicographicalCompare(const VECTOR2< T > &aA, const VECTOR2< T > &aB)
#define ZOOM_MIN_LIMIT_EESCHEMA
#define ZOOM_MAX_LIMIT_EESCHEMA