107 case SCH_LABEL_T: SetTitle(
_(
"Label Properties" ) );
break;
109 case SCH_SHEET_PIN_T: SetTitle(
_(
"Hierarchical Sheet Pin Properties" ) );
break;
115 [&]( wxCommandEvent& aEvent )
119 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
120 m_grid->ShowHideColumns(
"0 1 2 3 4 5 6 7" );
131 m_bold->SetIsCheckButton();
198 wxSizer* parentSizer =
m_autoRotate->GetContainingSizer();
200 parentSizer->Layout();
225 m_grid->PopEventHandler(
true );
234 if( !wxDialog::TransferDataToWindow() )
238 wxCommandEvent
dummy;
255 std::set<wxString> existingLabels;
302 for(
const std::shared_ptr<BUS_ALIAS>& busAlias :
m_Parent->Schematic().GetAllBusAliases() )
303 existingLabels.insert( wxT(
"{" ) + busAlias->GetName() + wxT(
"}" ) );
305 for(
const wxString& label : existingLabels )
328 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, (
int)
m_fields->size() );
329 m_grid->ProcessTableMessage( msg );
375 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
384 if(( aEvent.GetKeyCode() == WXK_RETURN ) || (aEvent.GetKeyCode() == WXK_NUMPAD_ENTER))
386 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
388 else if( aEvent.GetKeyCode() == WXK_SPACE )
405 if( aEvent.GetKeyCode() == WXK_TAB )
407 if( aEvent.ShiftDown() )
413 m_grid->SetFocusFromKbd();
414 m_grid->MakeCellVisible( 0, 0 );
415 m_grid->SetGridCursor( 0, 0 );
440 for(
size_t i = 0; i < a->size() && i < b.size(); ++i )
452 if( !
m_grid->CommitPendingChanges() )
455 if( !wxDialog::TransferDataFromWindow() )
481 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
498 if( field.GetCanonicalName() == wxT(
"Netclass" ) )
504 if( field.IsVisible() !=
m_Parent->Schematic().Settings().m_IntersheetRefsShow )
506 DisplayInfoMessage(
this,
_(
"Intersheet reference visibility is controlled globally from "
507 "Schematic Setup > General > Formatting" ) );
521 for(
int ii =
m_fields->GetNumberRows() - 1; ii >= 0; ii-- )
525 const wxString& fieldText = field.
GetText();
527 if( fieldName.IsEmpty() && fieldText.IsEmpty() )
532 else if( fieldName == wxT(
"Netclass" ) && fieldText.IsEmpty() )
535 int netclassFieldCount = 0;
537 for(
int jj = 0; jj <
m_fields->GetNumberRows(); ++jj )
539 if(
m_fields->at( jj ).GetCanonicalName() == wxT(
"Netclass" ) )
540 netclassFieldCount++;
543 if( netclassFieldCount > 1 )
546 else if( fieldName.IsEmpty() )
557 if( !field.IsMandatory() )
558 field.SetOrdinal( ordinal++ );
616 if( !commit.
Empty() )
618 commit.
Push(
_(
"Edit Label Properties" ) );
624 text.Replace( wxS(
"\r" ), wxS(
"\n" ) );
625 wxArrayString lines = wxSplit(
text,
'\n' );
627 for(
const wxString& line : lines )
630 text.Trim(
false ).Trim(
true );
644 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
651 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
658 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
669 m_labelList->push_back( std::unique_ptr<SCH_LABEL_BASE>( label ) );
680 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
695 [&]() -> std::pair<int, int>
697 wxString fieldName = wxT(
"Netclass" );
703 fieldName = wxEmptyString;
727 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
728 m_grid->ProcessTableMessage( msg );
739 if( row < m_currentLabel->GetMandatoryFieldCount() )
752 wxGridTableMessage msg(
m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
753 m_grid->ProcessTableMessage( msg );
767 std::swap( *(
m_fields->begin() + row ), *(
m_fields->begin() + row - 1 ) );
782 std::swap( *(
m_fields->begin() + row ), *(
m_fields->begin() + row + 1 ) );
790 std::bitset<64> shownColumns =
m_grid->GetShownColumns();
796 if( !
m_grid->IsCellEditControlShown() )
797 m_grid->SetGridWidthsDirty();
833 m_valueCombo->SetValue( multiText.BeforeFirst(
'\n' ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
wxStaticText * m_textSizeLabel
wxRadioButton * m_triState
COLOR_SWATCH * m_textColorSwatch
STD_BITMAP_BUTTON * m_bpMoveUp
wxFlexGridSizer * m_textEntrySizer
wxStaticText * m_labelMultiLine
wxStaticBoxSizer * m_shapeSizer
wxRadioButton * m_diamond
BITMAP_BUTTON * m_separator3
wxTextCtrl * m_valueMultiLine
STD_BITMAP_BUTTON * m_bpAdd
wxHyperlinkCtrl * m_syntaxHelp
wxRadioButton * m_rectangle
wxStaticText * m_labelCombo
wxStaticText * m_labelSingleLine
wxRadioButton * m_passive
wxCheckBox * m_cbMultiLine
DIALOG_LABEL_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Label Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
STD_BITMAP_BUTTON * m_bpMoveDown
STD_BITMAP_BUTTON * m_bpDelete
BITMAP_BUTTON * m_separator1
wxTextCtrl * m_textSizeCtrl
wxCheckBox * m_autoRotate
wxGridBagSizer * m_formattingGB
FILTER_COMBOBOX * m_valueCombo
wxRadioButton * m_bidirectional
BITMAP_BUTTON * m_separator2
wxStaticText * m_fontLabel
wxTextCtrl * m_valueSingleLine
wxStaticText * m_textSizeUnits
HTML_MESSAGE_BOX * m_helpWindow
std::list< std::unique_ptr< SCH_LABEL_BASE > > * m_labelList
~DIALOG_LABEL_PROPERTIES()
wxTextEntry * m_activeTextEntry
SCH_LABEL_BASE * m_currentLabel
void OnMoveUp(wxCommandEvent &event) override
void OnMoveDown(wxCommandEvent &event) override
DIALOG_LABEL_PROPERTIES(SCH_EDIT_FRAME *parent, SCH_LABEL_BASE *aLabel, bool aNew)
void OnEnterKey(wxCommandEvent &aEvent) override
wxEVT_COMMAND_ENTER event handler for single-line control.
std::bitset< 64 > m_shownColumns
void OnAddField(wxCommandEvent &event) override
SCH_NETNAME_VALIDATOR m_netNameValidator
void OnFormattingHelp(wxHyperlinkEvent &aEvent) override
bool TransferDataFromWindow() override
void OnCBValueCharHook(wxKeyEvent &aEvent) override
wxArrayString m_existingLabelArray
void OnUpdateUI(wxUpdateUIEvent &event) override
void onSpinButton(wxCommandEvent &aEvent)
void onMultiLabelCheck(wxCommandEvent &aEvent) override
FIELDS_GRID_TABLE * m_fields
void OnDeleteField(wxCommandEvent &event) override
void OnValueCharHook(wxKeyEvent &aEvent) override
bool TransferDataToWindow() override
SCH_EDIT_FRAME * m_Parent
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
EDA_BASE_FRAME * m_parentFrame
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
void SetAttributes(const EDA_TEXT &aSrc, bool aSetPosition=true)
Set the text attributes from another instance.
void Offset(const VECTOR2I &aOffset)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual void SetVisible(bool aVisible)
GR_TEXT_V_ALIGN_T GetVertJustify() const
virtual void SetText(const wxString &aText)
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
A color representation with 4 components: red, green, blue, alpha.
virtual void Push(const wxString &aMessage=wxT("A commit"), int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
void AutoRotateItem(SCH_SCREEN *aScreen, SCH_ITEM *aItem)
Automatically set the rotation of an item (if the item supports it).
VECTOR2I GetPosition() const override
wxString GetCanonicalName() const
Get a non-language-specific name for a field which can be used for storage, variable look-up,...
void SetName(const wxString &aName)
Base class for any item which can be embedded within the SCHEMATIC container class,...
static const wxString GetDefaultFieldName(const wxString &aName, bool aUseDefaultName)
Container class that holds multiple SCH_SCREEN objects in a hierarchy.
bool IsSymbolLikePowerGlobalLabel() const
bool IsSymbolLikePowerLocalLabel() const
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
static HTML_MESSAGE_BOX * ShowSyntaxHelp(wxWindow *aParentWindow)
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
static bool positioningChanged(const SCH_FIELD &a, const SCH_FIELD &b)
@ LAYER_SCHEMATIC_BACKGROUND
#define UNIMPLEMENTED_FOR(type)
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
@ USER
The field ID hasn't been set yet; field is invalid.
@ INTERSHEET_REFS
Global label cross-reference page numbers.
@ VALUE
Field Value of part, i.e. "3.3K".
@ SCH_SYMBOL_LOCATE_POWER_T
VECTOR2< int32_t > VECTOR2I