30 std::vector<FIELD_CASE_CONFLICT> aConflicts ) :
39 _(
"%zu symbols have user fields whose names differ only in case. "
40 "Choose how to resolve each before opening the table." ),
46 { wxID_CANCEL,
_(
"Cancel" ) } } );
57 if( g->GetNumberRows() > 0 )
58 g->DeleteRows( 0, g->GetNumberRows() );
60 g->AppendRows(
static_cast<int>(
m_conflicts.size() ) );
69 wxString fieldsLabel = wxString::Format(
"%s\n%s",
73 wxString valuesLabel = wxString::Format(
"%s\n%s",
75 ? wxString(
_(
"(empty)" ) )
78 ? wxString(
_(
"(empty)" ) )
81 g->SetCellValue( i, 2, fieldsLabel );
82 g->SetCellValue( i, 3, valuesLabel );
84 wxArrayString choices;
85 choices.Add( wxString::Format(
_(
"Keep '%s'" ), c.
variants[0].first ) );
86 choices.Add( wxString::Format(
_(
"Keep '%s'" ), c.
variants[1].first ) );
87 choices.Add(
_(
"Join values" ) );
89 g->SetCellEditor( i, 4,
new wxGridCellChoiceEditor( choices,
false ) );
90 g->SetCellValue( i, 4, choices[0] );
101 std::vector<int> siblings;
103 if( aRow < 0 ||
static_cast<size_t>( aRow ) >=
m_conflicts.size() )
106 const wxString& key =
m_conflicts[aRow].caseFoldedKey;
110 if(
static_cast<int>( i ) != aRow
111 &&
m_conflicts[i].caseFoldedKey.IsSameAs( key,
false ) )
113 siblings.push_back(
static_cast<int>( i ) );
123 int row =
event.GetRow();
124 int col =
event.GetCol();
126 if( col != 4 || row < 0 ||
static_cast<size_t>( row ) >=
m_conflicts.size() )
135 if( choice.Contains(
m_conflicts[row].variants[1].first ) )
137 else if( choice ==
_(
"Join values" ) )
177 if( !a || !b || a == b )
180 const wxString& aValue = c.
variants[0].second;
181 const wxString& bValue = c.
variants[1].second;
187 wxString winning = aValue.IsEmpty() ? bValue : aValue;
194 wxString winning = bValue.IsEmpty() ? aValue : bValue;
203 if( !aValue.IsEmpty() && !bValue.IsEmpty() )
204 joined = aValue + sep + bValue;
206 joined = aValue.IsEmpty() ? bValue : aValue;
215 commit.
Push(
_(
"Resolve duplicate field names" ) );
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_headerLabel
DIALOG_RESOLVE_FIELD_CASE_CONFLICTS_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Resolve Field Name Conflicts"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE)
wxTextCtrl * m_separatorCtrl
wxCheckBox * m_bulkApplyCheckbox
DIALOG_RESOLVE_FIELD_CASE_CONFLICTS(wxWindow *aParent, SCH_EDIT_FRAME *aFrame, std::vector< FIELD_CASE_CONFLICT > aConflicts)
std::vector< ACTION > m_rowAction
void onActionCellChanged(wxGridEvent &event) override
std::vector< FIELD_CASE_CONFLICT > m_conflicts
void onApplyAndContinue(wxCommandEvent &event) override
std::vector< int > findSiblingRows(int aRow) const
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...
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
void SetText(const wxString &aText) override
SCH_SCREEN * LastScreen()
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
void RemoveField(const wxString &aFieldName)
Remove a user field from the symbol.
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this symbol.
std::vector< std::pair< wxString, wxString > > variants