49 m_ercDialog( nullptr )
168 if( selection.GetSize() == 1 && selection.Front()->Type() ==
SCH_MARKER_T )
170 SCH_MARKER* marker = static_cast<SCH_MARKER*>( selection.Front() );
203 LIB_PART* part = static_cast<SYMBOL_EDIT_FRAME*>(
m_frame )->GetCurPart();
209 std::unique_ptr<LIB_PART> flattenedPart = part->
Flatten();
211 flattenedPart->GetPins( pinList );
219 wxDefaultPosition, wxSize( 750, 600 ) );
221 const int min_grid_size = 25;
222 const int grid_size =
KiROUND(
getView()->GetGAL()->GetGridSize().x );
223 const int clamped_grid_size = ( grid_size < min_grid_size ) ? min_grid_size : grid_size;
225 std::vector<wxString> messages;
228 for(
unsigned ii = 1; ii < pinList.size(); ii++ )
230 LIB_PIN* pin = pinList[ii - 1];
240 pinName =
" '" + pin->
GetName() +
"'";
242 if(
next->GetName() !=
"~" && !
next->GetName().IsEmpty() )
243 nextName =
" '" +
next->GetName() +
"'";
249 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 250 " conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>" 254 next->GetPosition().x / 1000.0, -
next->GetPosition().y / 1000.0,
261 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 262 " conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>" 263 " in units %c and %c of converted." ),
266 next->GetPosition().x / 1000.0, -
next->GetPosition().y / 1000.0,
270 'A' +
next->GetUnit() - 1,
278 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 279 " conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>." ),
282 next->GetPosition().x / 1000.0, -
next->GetPosition().y / 1000.0,
289 msg.Printf(
_(
"<b>Duplicate pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 290 " conflicts with pin %s%s at location <b>(%.3f, %.3f)</b>" 291 " in units %c and %c." ),
294 next->GetPosition().x / 1000.0, -
next->GetPosition().y / 1000.0,
298 'A' +
next->GetUnit() - 1,
303 msg += wxT(
"<br><br>" );
304 messages.push_back( msg );
309 wxString pinName = pin->GetName();
311 if( pinName.IsEmpty() || pinName ==
"~" )
314 pinName =
"'" + pinName +
"'";
318 && !pin->IsVisible() )
325 msg.Printf(
_(
"<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 329 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
333 msg.Printf(
_(
"<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 334 " in unit %c of converted." ),
337 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
338 'A' + pin->GetUnit() - 1 );
345 msg.Printf(
_(
"<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>." ),
348 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
352 msg.Printf(
_(
"<b>Hidden power pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 356 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
357 'A' + pin->GetUnit() - 1 );
361 msg += wxT(
"<br>" );
362 msg +=
_(
"(Hidden power pins will drive their pin names on to any connected nets.)" );
363 msg += wxT(
"<br><br>" );
364 messages.push_back( msg );
367 if( ( (pin->GetPosition().x % clamped_grid_size) != 0 )
368 || ( (pin->GetPosition().y % clamped_grid_size) != 0 ) )
375 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 379 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
383 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 384 " in unit %c of converted." ),
387 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
388 'A' + pin->GetUnit() - 1 );
395 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>." ),
398 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
402 msg.Printf(
_(
"<b>Off grid pin %s</b> %s at location <b>(%.3f, %.3f)</b>" 406 pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0,
407 'A' + pin->GetUnit() - 1 );
411 msg += wxT(
"<br><br>" );
412 messages.push_back( msg );
416 if( messages.empty() )
422 wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
423 wxColour fgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
425 bgcolor.GetAsString( wxC2S_HTML_SYNTAX ),
426 fgcolor.GetAsString( wxC2S_HTML_SYNTAX ) );
428 for(
auto& msgPart : messages )
431 outmsg +=
"</body></html>";
433 error_display.m_htmlWindow->SetPage( outmsg );
434 error_display.ShowModal();
445 simFrame->Show(
true );
448 if( simFrame->IsIconized() )
449 simFrame->Iconize(
false );
463 LIB_PART* part = static_cast<SYMBOL_EDIT_FRAME*>(
m_frame )->GetCurPart();
472 LIB_PART* entry = static_cast<SYMBOL_VIEWER_FRAME*>(
m_frame )->GetSelectedSymbol();
483 if( selection.
Empty() )
491 if( !datasheet.IsEmpty() && datasheet != wxT(
"~" ) )
503 if( selection.GetSize() == 1 )
517 editFrame->UpdateNetHighlightStatus();
power input (GND, VCC for ICs). Must be connected to a power output.
KIGFX::SCH_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
static TOOL_ACTION showDatasheet
Inspection and Editing.
bool GetAssociatedDocument(wxWindow *aParent, const wxString &aDocName, PROJECT *aProject)
Open a document (file) with the suitable browser.
static const TOOL_EVENT SelectedEvent
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
LIB_FIELD & GetDatasheetField()
Return reference to the datasheet field.
static SELECTION_CONDITION SingleSymbol
static TOOL_ACTION runERC
static const TOOL_EVENT UnselectedEvent
This file is part of the common library.
bool HasConversion() const
Test if part has more than one body conversion type (DeMorgan).
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
This file is part of the common library.
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
static TOOL_ACTION nextMarker
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Schematic editor (Eeschema) main window.
static const KICAD_T ComponentsOnly[]
static TOOL_ACTION excludeMarker
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 TOOL_ACTION checkSymbol
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static TOOL_ACTION runSimulation
Class DIALOG_DISPLAY_HTML_TEXT_BASE.
void SetExcluded(bool aExcluded)
int GetUnitCount() const override
For items with units, return the number of units.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void OnModify()
Must be called after a model change in order to set the "modify" flag and do other frame-specific pro...
const wxString & GetName() const
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
virtual void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList)
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
SCH_DRAW_PANEL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
Define a library symbol object.
Subclass of SIM_PLOT_FRAME_BASE, which is generated by wxFormBuilder.
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
std::unique_ptr< LIB_PART > Flatten() const
Return a flattened symbol inheritance to the caller.
virtual void ClearMsgPanel()
Clear all messages from the message panel.
bool Show(bool show) override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
bool Empty() const
Checks if there is anything selected.
Implementing SIM_PLOT_FRAME_BASE.
static TOOL_ACTION prevMarker
wxPoint GetPosition() const override
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
SCH_FIELD * GetField(int aFieldNdx)
Returns a field in this symbol.
const wxString & GetNumber() const
bool IsType(FRAME_T aType) const
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
A base class for most all the KiCad significant classes used in schematics and boards.
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...