CvPcb and Eeschema part 1 housekeeping.

This commit is contained in:
Wayne Stambaugh 2025-01-18 10:32:42 -05:00
parent 975fe32fa7
commit d53ed205f2
68 changed files with 443 additions and 267 deletions

View File

@ -109,7 +109,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
fn.GetFullName() );
if( ! aErrorMessages->IsEmpty() )
*aErrorMessages << wxT("\n\n");
*aErrorMessages << wxT( "\n\n" );
*aErrorMessages += error_msg;
}
@ -128,7 +128,7 @@ int CVPCB_MAINFRAME::buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
error_msg.Printf( _( "Error opening equivalence file '%s'." ), tmp );
if( ! aErrorMessages->IsEmpty() )
*aErrorMessages << wxT("\n\n");
*aErrorMessages << wxT( "\n\n" );
*aErrorMessages += error_msg;
}
@ -214,7 +214,8 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
continue;
const FOOTPRINT_INFO *fp = m_FootprintsList->GetFootprintInfo( equivItem.m_FootprintFPID );
const FOOTPRINT_INFO* fp =
m_FootprintsList->GetFootprintInfo( equivItem.m_FootprintFPID );
bool equ_is_unique = true;
unsigned next = idx+1;

View File

@ -285,10 +285,11 @@ void CVPCB_MAINFRAME::setupUIConditions()
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
mgr->SetConditions( CVPCB_ACTIONS::saveAssociationsToSchematic, ENABLE( cond.ContentModified() ) );
mgr->SetConditions( CVPCB_ACTIONS::saveAssociationsToFile, ENABLE( cond.ContentModified() ) );
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
mgr->SetConditions( CVPCB_ACTIONS::saveAssociationsToSchematic,
ENABLE( cond.ContentModified() ) );
mgr->SetConditions( CVPCB_ACTIONS::saveAssociationsToFile, ENABLE( cond.ContentModified() ) );
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
auto compFilter =
[this] ( const SELECTION& )
@ -348,6 +349,7 @@ void CVPCB_MAINFRAME::setupEventHandlers()
GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociationsToSchematic );
Close( true );
}, wxID_OK );
Bind( wxEVT_BUTTON,
[this]( wxCommandEvent& )
{
@ -503,7 +505,7 @@ void CVPCB_MAINFRAME::updateFootprintViewerOnIdle( wxIdleEvent& aEvent )
Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
m_viewerPendingUpdate = false;
// On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
// On some platforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
// are opened and refreshed when a new footprint is selected.
// If the listbox has the focus before selecting a new footprint, it will be forced
// after selection.
@ -1205,10 +1207,12 @@ void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
m_cannotClose = true;
readNetListAndFpFiles( payload );
m_cannotClose = false;
/* @todo
Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
*/
break;
case MAIL_RELOAD_LIB:
m_cannotClose = true;
LoadFootprintFiles();
@ -1216,6 +1220,7 @@ void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
BuildLibrariesList();
m_cannotClose = false;
break;
default:
; // ignore most
}

View File

@ -248,7 +248,7 @@ void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
else
{
DisplayErrorMessage( this, wxString::Format( _( "File '%s' already exists in list." ),
filepath.GetData() ) );
filepath.GetData() ) );
}
}
}

View File

@ -44,19 +44,21 @@ DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR(
m_lineCount = 0;
}
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add( const wxString& aRef, const wxString& aFpSchName,
const wxString& aFpCmpName )
const wxString& aFpCmpName )
{
long idx = m_listFp->InsertItem(m_lineCount, aRef );
m_listFp->SetItem(idx, COL_FPSCH, aFpSchName );
m_listFp->SetItem(idx, COL_SELSCH, wxT("") );
m_listFp->SetItem(idx, COL_SELCMP, wxT("X") );
m_listFp->SetItem(idx, COL_FPCMP, aFpCmpName );
m_listFp->SetItem( idx, COL_FPSCH, aFpSchName );
m_listFp->SetItem( idx, COL_SELSCH, wxT( "" ) );
m_listFp->SetItem( idx, COL_SELCMP, wxT( "X" ) );
m_listFp->SetItem( idx, COL_FPCMP, aFpCmpName );
m_lineCount ++;
}
int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aReference )
{
// Find Reference
@ -64,7 +66,7 @@ int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aRefer
{
if( m_listFp->GetItemText( ii, COL_REF ) == aReference )
{
if( m_listFp->GetItemText( ii, COL_SELSCH ) != wxT("X") )
if( m_listFp->GetItemText( ii, COL_SELSCH ) != wxT( "X" ) )
return 1;
return 0;
@ -74,6 +76,7 @@ int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aRefer
return -1;
}
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event )
{
// When clicking on the column title:
@ -101,11 +104,12 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event )
for( int i = 0; i < m_listFp->GetItemCount(); i++ )
{
m_listFp->SetItem( i, colclr, wxT("") );
m_listFp->SetItem( i, colset, wxT("X") );
m_listFp->SetItem( i, colclr, wxT( "" ) );
m_listFp->SetItem( i, colset, wxT( "X" ) );
}
}
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event )
{
wxPoint pos = event.GetPosition();
@ -140,8 +144,8 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event
// Move selection to schematic or cmp file choice
// according to the column position (COL_SELCMP or COL_SELSCH)
m_listFp->SetItem( idx, colclr, wxT("") );
m_listFp->SetItem( idx, colset, wxT("X") );
m_listFp->SetItem( idx, colclr, wxT( "" ) );
m_listFp->SetItem( idx, colset, wxT( "X" ) );
event.Skip();
}
@ -180,7 +184,7 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::recalculateColumns()
maxRefLength += margin;
totalLength = maxRefLength + sel_length + sel_length;
int cwidth = (GetClientSize().x - totalLength) / 2;
int cwidth = ( GetClientSize().x - totalLength ) / 2;
m_listFp->SetColumnWidth( COL_REF, maxRefLength );
m_listFp->SetColumnWidth( COL_FPSCH, cwidth - 2 );

View File

@ -45,10 +45,9 @@ public:
/**
* @param aReference is the component schematic reference.
* @return the selection option:
* 0 for fpid text from the netlist
* 1 for fpid text from the cmp file
* -1 on error
* @retval 0 for fpid text from the netlist.
* @retval 1 for fpid text from the cmp file.
* @retval -1 on error.
*/
int GetSelection( const wxString& aReference );

View File

@ -312,7 +312,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox );
// Option to run Zoom automatique on footprint selection changge
// Option to run Zoom automatique on footprint selection change
m_mainToolBar->AddTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL, wxEmptyString,
KiScaledBitmap( BITMAPS::zoom_auto_fit_in_page, this ),
_( "Automatic Zoom on footprint change" ),
@ -418,7 +418,8 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
// See if the library requested is in the library table
if( !fpTable->HasLibrary( libNickname ) )
{
aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library table." ),
aReporter.Report( wxString::Format( _( "Library '%s' is not in the footprint library "
"table." ),
libNickname ),
RPT_SEVERITY_ERROR );
return nullptr;

View File

@ -53,9 +53,10 @@ public:
void UpdateToolbarControlSizes() override;
/**
* Refresh the full display for this frame:
* Set the title, the status line and redraw the canvas
* Must be called after the footprint to display is modified
* Refresh the full display for this frame.
*
* Set the title, the status line and redraw the canvas.
* Must be called after the footprint to display is modified.
*/
void InitDisplay();
@ -76,7 +77,7 @@ public:
MAGNETIC_SETTINGS* GetMagneticItemsSettings() override;
///< @copydoc EDA_DRAW_FRAME::UpdateMsgPanel()
/// @copydoc EDA_DRAW_FRAME::UpdateMsgPanel()
void UpdateMsgPanel() override;
COLOR_SETTINGS* GetColorSettings( bool aForceRefresh = false ) const override;

View File

@ -172,7 +172,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
{
SetItemCount( m_footprintList.GetCount() );
SetSelection( selection, true );
RefreshItems( 0L, m_footprintList.GetCount()-1 );
RefreshItems( 0L, m_footprintList.GetCount() - 1 );
UpdateWidth();
}
}

View File

@ -114,7 +114,7 @@ void LIBRARY_LISTBOX::Finish()
{
if( m_libraryList.Count() )
{
RefreshItems( 0L, m_libraryList.Count()-1 );
RefreshItems( 0L, m_libraryList.Count() - 1 );
UpdateWidth();
}
}

View File

@ -55,12 +55,12 @@ void ITEMS_LISTBOX_BASE::UpdateWidth( int aLine )
if( aLine < 0 )
{
columnWidth = 0;
for( int ii = 0; ii < itemCount; ii++ )
{
UpdateLineWidth( (unsigned)ii, dc );
}
}
// Zero or above: update from a single line.
else
{
@ -103,7 +103,7 @@ int ITEMS_LISTBOX_BASE::GetSelection()
void ITEMS_LISTBOX_BASE::DeselectAll()
{
for( int i = GetFirstSelected(); i >= 0; i = GetNextSelected(i))
for( int i = GetFirstSelected(); i >= 0; i = GetNextSelected( i ) )
{
Select( i, false );
}

View File

@ -36,6 +36,7 @@
void CVPCB_MAINFRAME::doReCreateMenuBar()
{
COMMON_CONTROL* tool = m_toolManager->GetTool<COMMON_CONTROL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();

View File

@ -54,13 +54,13 @@ static int guessNickname( FP_LIB_TABLE* aTbl, LIB_ID* aFootprintId )
std::vector<wxString> nicks = aTbl->GetLogicalLibs();
// Search each library going through libraries alphabetically.
for( unsigned libNdx = 0; libNdx<nicks.size(); ++libNdx )
for( unsigned libNdx = 0; libNdx < nicks.size(); ++libNdx )
{
wxArrayString fpnames;
aTbl->FootprintEnumerate( fpnames, nicks[libNdx], true );
for( unsigned nameNdx = 0; nameNdx<fpnames.size(); ++nameNdx )
for( unsigned nameNdx = 0; nameNdx < fpnames.size(); ++nameNdx )
{
if( fpname == fpnames[nameNdx] )
{
@ -103,7 +103,7 @@ bool CVPCB_MAINFRAME::readNetListAndFpFiles( const std::string& aNetlist )
if( m_netlist.AnyFootprintsLinked() )
{
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
COMPONENT* component = m_netlist.GetComponent( i );
@ -129,7 +129,7 @@ bool CVPCB_MAINFRAME::readNetListAndFpFiles( const std::string& aNetlist )
try
{
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
COMPONENT* component = m_netlist.GetComponent( i );
@ -263,7 +263,7 @@ bool CVPCB_MAINFRAME::readNetListAndFpFiles( const std::string& aNetlist )
int firstUnassigned = wxNOT_FOUND;
// Populates the component list box:
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
{
COMPONENT* component = m_netlist.GetComponent( i );

View File

@ -70,9 +70,11 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
wxString msg_bold = _( "Footprint Filters:" );
wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold );
text->SetFont( m_mainToolBar->GetFont().Bold() );
#ifdef __WXGTK3__
text->SetLabelMarkup( "<b>" + msg_bold + "</b>" );
#endif
m_mainToolBar->AddControl( text );
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyFPFilters, ACTION_TOOLBAR::TOGGLE );

View File

@ -79,7 +79,8 @@ TOOL_ACTION CVPCB_ACTIONS::saveAssociationsToFile( TOOL_ACTION_ARGS()
.DefaultHotkey( MD_CTRL + 'S' )
.LegacyHotkeyName( "Save" )
.FriendlyName( _( "Save to Schematic and File" ) )
.Tooltip( _( "Save footprint assignments in 'footprint' fields of schematic symbols and then save schematic files" ) )
.Tooltip( _( "Save footprint assignments in 'footprint' fields of schematic symbols and "
"then save schematic files" ) )
.Icon( BITMAPS::save ) );
// Actions to navigate the display
@ -145,7 +146,6 @@ TOOL_ACTION CVPCB_ACTIONS::deleteAll( TOOL_ACTION_ARGS()
.FriendlyName( _( "Delete All Footprint Assignments" ) )
.Icon( BITMAPS::delete_association ) );
// Actions to filter the footprint list
TOOL_ACTION CVPCB_ACTIONS::FilterFPbyFPFilters( TOOL_ACTION_ARGS()
.Name( "cvpcb.Control.FilterFPbyFPFilters" )

View File

@ -27,9 +27,7 @@
/**
* CVPCB_CONTROL
*
* Handles actions in main cvpcb window.
* Handles action in main CvPcb window.
*/
class CVPCB_ASSOCIATION_TOOL : public TOOL_INTERACTIVE
@ -44,68 +42,68 @@ public:
/**
* Undo the footprint associations most recently done.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int Undo( const TOOL_EVENT& aEvent );
/**
* Redo the footprint associations most recently done.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int Redo( const TOOL_EVENT& aEvent );
/**
* Associate the selected footprint with the currently selected components.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int Associate( const TOOL_EVENT& aEvent );
/**
* Perform automatic footprint association.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int AutoAssociate( const TOOL_EVENT& aEvent );
/**
* Delete all associations.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int DeleteAll( const TOOL_EVENT& aEvent );
/**
* Delete the selected associations.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int DeleteAssoc( const TOOL_EVENT& aEvent );
/**
* Copy the selected associations to the clipboard.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int CopyAssoc( const TOOL_EVENT& aEvent );
/**
* Cut the selected associations to the clipboard.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int CutAssoc( const TOOL_EVENT& aEvent );
/**
* Paste the clipboard onto the current selection.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int PasteAssoc( const TOOL_EVENT& aEvent );
/*
* Sets up handlers for various events.
/**
* Set up handlers for various events.
*/
void setTransitions() override;

View File

@ -178,7 +178,7 @@ int CVPCB_CONTROL::ShowFootprintViewer( const TOOL_EVENT& aEvent )
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player( FRAME_CVPCB_DISPLAY, true,
m_frame );
// If Kiway() cannot create the eeschema frame, it shows a error message, and
// If Kiway() cannot create the Eeschema frame, it shows a error message, and
// frame is null
if( !fpframe )
return 0;
@ -249,8 +249,10 @@ int CVPCB_CONTROL::ToNA( const TOOL_EVENT& aEvent )
{
CVPCB_MAINFRAME::ITEM_DIR dir = aEvent.Parameter<CVPCB_MAINFRAME::ITEM_DIR>();
std::vector<unsigned int> naComp = m_frame->GetComponentIndices( CVPCB_MAINFRAME::NA_COMPONENTS );
std::vector<unsigned int> tempSel = m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS );
std::vector<unsigned int> naComp =
m_frame->GetComponentIndices( CVPCB_MAINFRAME::NA_COMPONENTS );
std::vector<unsigned int> tempSel =
m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS );
// No unassociated components
if( naComp.empty() )
@ -341,7 +343,8 @@ void CVPCB_CONTROL::setTransitions()
// Management actions
Go( &CVPCB_CONTROL::ShowEquFileTable, CVPCB_ACTIONS::showEquFileTable.MakeEvent() );
Go( &CVPCB_CONTROL::SaveAssociationsToSchematic, CVPCB_ACTIONS::saveAssociationsToSchematic.MakeEvent() );
Go( &CVPCB_CONTROL::SaveAssociationsToSchematic,
CVPCB_ACTIONS::saveAssociationsToSchematic.MakeEvent() );
Go( &CVPCB_CONTROL::SaveAssociationsToFile,CVPCB_ACTIONS::saveAssociationsToFile.MakeEvent() );
// Navigation actions

View File

@ -27,9 +27,7 @@
/**
* CVPCB_CONTROL
*
* Handles actions in main cvpcb window.
* Handles actions in main CvPcb window.
*/
class CVPCB_CONTROL : public TOOL_INTERACTIVE
@ -42,45 +40,45 @@ public:
void Reset( RESET_REASON aReason ) override;
/**
* Main processing loop for the CVPCB window. This function will constantly loop and
* Main processing loop for the CvPcb window. This function will constantly loop and
* to process various actions taken in the window.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int Main( const TOOL_EVENT& aEvent );
/**
* Rotate focus in the CVPCB window
* Rotate focus in the CVPCB window.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int ChangeFocus( const TOOL_EVENT& aEvent );
/**
* Move the selected component to the not associated one in the specified direction.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int ToNA( const TOOL_EVENT& aEvent );
/**
* Show the dialog to modify the included footprint association files (.equ)
* Show the dialog to modify the included footprint association files (.equ).
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int ShowEquFileTable( const TOOL_EVENT& aEvent );
/**
* Save the associations to the schematic.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int SaveAssociationsToSchematic( const TOOL_EVENT& aEvent );
/**
* Save the associations to the schematic and save schematic to file.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int SaveAssociationsToFile( const TOOL_EVENT& aEvent );
@ -88,28 +86,29 @@ public:
* Create or Update the frame showing the current highlighted footprint
* and (if showed) the 3D display frame.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int ShowFootprintViewer( const TOOL_EVENT& aEvent );
/**
* Filter the footprint list by toggling the given filter type.
*
* The event parameter corresponds to the filter type (using the FP_FILTER_T from the
* FOOTPRINTS_LISTBOX class)
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int ToggleFootprintFilter( const TOOL_EVENT& aEvent );
/**
* Update the menu to reflect the current tool states.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int UpdateMenu( const TOOL_EVENT& aEvent );
/*
* Sets up handlers for various events.
/**
* Set up handlers for various events.
*/
void setTransitions() override;

View File

@ -99,5 +99,5 @@ void CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions()
{
Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main,
CVPCB_ACTIONS::selectionActivate.MakeEvent() );
CVPCB_ACTIONS::selectionActivate.MakeEvent() );
}

View File

@ -29,7 +29,7 @@
/**
* Selection tool for the footprint viewer in cvpcb.
* Selection tool for the footprint viewer in CvPcb.
*/
class CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL : public TOOL_INTERACTIVE
{
@ -61,11 +61,11 @@ public:
/**
* Update the menu to reflect the current tool states.
*
* @param aEvent is the event generated by the tool framework
* @param aEvent is the event generated by the tool framework.
*/
int UpdateMenu( const TOOL_EVENT& aEvent );
///< Sets up handlers for various events.
/// Set up handlers for various events.
void setTransitions() override;
private:

View File

@ -56,6 +56,7 @@ bool API_HANDLER_SCH::validateDocumentInternal( const DocumentSpecifier& aDocume
// TODO(JE) need serdes for SCH_SHEET_PATH <> SheetPath
return true;
//wxString currentPath = m_frame->GetCurrentSheet().PathAsString();
//return 0 == aDocument.sheet_path().compare( currentPath.ToStdString() );
}
@ -67,6 +68,7 @@ HANDLER_RESULT<GetOpenDocumentsResponse> API_HANDLER_SCH::handleGetOpenDocuments
if( aCtx.Request.type() != DocumentType::DOCTYPE_SCHEMATIC )
{
ApiResponseStatus e;
// No message needed for AS_UNHANDLED; this is an internal flag for the API server
e.set_status( ApiStatusCode::AS_UNHANDLED );
return tl::unexpected( e );
@ -108,7 +110,8 @@ HANDLER_RESULT<std::unique_ptr<EDA_ITEM>> API_HANDLER_SCH::createItemForType( KI
{
ApiResponseStatus e;
e.set_status( ApiStatusCode::AS_BAD_REQUEST );
e.set_error_message( fmt::format( "Tried to create a symbol in {}, which is not a schematic",
e.set_error_message( fmt::format( "Tried to create a symbol in {}, which is not a "
"schematic",
aContainer->GetFriendlyName().ToStdString() ) );
return tl::unexpected( e );
}

View File

@ -296,7 +296,8 @@ int DIALOG_ANNOTATE::GetStartNumber()
void SCH_EDIT_FRAME::OnAnnotate()
{
DIALOG_ANNOTATE* dlg = static_cast<DIALOG_ANNOTATE*>( wxWindow::FindWindowByName( DLG_WINDOW_NAME ) );
DIALOG_ANNOTATE* dlg =
static_cast<DIALOG_ANNOTATE*>( wxWindow::FindWindowByName( DLG_WINDOW_NAME ) );
if( !dlg )
{

View File

@ -294,7 +294,8 @@ void DIALOG_BOM::OnRunGenerator( wxCommandEvent& event )
bool status = false;
if( m_parent->ReadyToNetlist( _( "Generating BOM requires a fully annotated schematic." ) ) )
status = m_parent->WriteNetListFile( NET_TYPE_BOM, fullfilename, GNL_OPT_BOM|GNL_ALL, &reporter );
status = m_parent->WriteNetListFile( NET_TYPE_BOM, fullfilename,
GNL_OPT_BOM | GNL_ALL, &reporter );
if( !status )
DisplayErrorMessage( this, _( "Failed to create file." ) );
@ -489,4 +490,4 @@ BOM_GENERATOR_HANDLER* DIALOG_BOM::selectedGenerator()
return nullptr;
return m_generators[idx].get();
}
}

View File

@ -79,7 +79,8 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
m_newId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
m_specifiedReference->ChangeValue( m_symbol->GetRef( currentSheet ) );
m_specifiedValue->ChangeValue( UnescapeString( m_symbol->GetField( VALUE_FIELD )->GetText() ) );
m_specifiedValue->ChangeValue(
UnescapeString( m_symbol->GetField( VALUE_FIELD )->GetText() ) );
m_specifiedId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
}
else
@ -568,7 +569,7 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO>::iterator it = symbols.begin();
// Remove all symbols that don't have a valid library symbol link or enough units to
// satify the library symbol update.
// satisfy the library symbol update.
while( it != symbols.end() )
{
SCH_SYMBOL* symbol = it->first;
@ -619,8 +620,8 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
// When we replace the lib symbol below, we free the associated pins if the new symbol has
// fewer than the original. This will cause the connection graph to be out of date unless
// we replace references in the graph to the old symbol/pins with references to the ones stored
// in the undo stack.
// we replace references in the graph to the old symbol/pins with references to the ones
// stored in the undo stack.
if( connectionGraph )
connectionGraph->ExchangeItem( symbol, symbol_copy );
}

View File

@ -77,7 +77,7 @@ protected:
checkAll( false );
}
///< Select or deselect all fields in the listbox widget
/// Select or deselect all fields in the listbox widget.
void checkAll( bool aCheck );
private:
@ -93,7 +93,7 @@ private:
SCH_SYMBOL* m_symbol;
MODE m_mode;
///< Set of field names that should have values updated
/// Set of field names that should have values updated.
std::set<wxString> m_updateFields;
};

View File

@ -74,6 +74,7 @@ bool DIALOG_DESIGN_BLOCK_PROPERTIES::TransferDataToWindow()
// Typical assignment operator does not work here because of the ordered_map
auto source = m_designBlock->GetFields();
m_fields.clear();
for( const auto& field : source )
{
m_fields[field.first] = field.second;

View File

@ -61,7 +61,9 @@ public:
int GetHeight( wxDC& aDC, wxGrid* aGrid, int aRow, int aCol );
wxGridCellRenderer *Clone() const override
{ return new GRIDCELL_AUTOWRAP_STRINGRENDERER; }
{
return new GRIDCELL_AUTOWRAP_STRINGRENDERER;
}
private:
// HELPER ROUTINES UNCHANGED FROM wxWidgets IMPLEMENTATION

View File

@ -26,7 +26,8 @@
#include <schematic.h>
#include <eeschema_settings.h>
DIALOG_EESCHEMA_PAGE_SETTINGS::DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, EMBEDDED_FILES* aEmbeddedFiles,
DIALOG_EESCHEMA_PAGE_SETTINGS::DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent,
EMBEDDED_FILES* aEmbeddedFiles,
VECTOR2I aMaxUserSizeMils ) :
DIALOG_PAGES_SETTINGS( aParent, aEmbeddedFiles, schIUScale.IU_PER_MILS, aMaxUserSizeMils )
{
@ -39,19 +40,45 @@ DIALOG_EESCHEMA_PAGE_SETTINGS::~DIALOG_EESCHEMA_PAGE_SETTINGS()
wxCHECK( cfg, /* void */ );
cfg->m_PageSettings.export_paper = m_PaperExport->GetValue();
if ( !m_TextRevision->GetValue().IsEmpty() ) cfg->m_PageSettings.export_revision = m_RevisionExport->GetValue();
if ( !m_TextDate->GetValue().IsEmpty() ) cfg->m_PageSettings.export_date = m_DateExport->GetValue();
if ( !m_TextTitle->GetValue().IsEmpty() ) cfg->m_PageSettings.export_title = m_TitleExport->GetValue();
if ( !m_TextCompany->GetValue().IsEmpty() ) cfg->m_PageSettings.export_company = m_CompanyExport->GetValue();
if ( !m_TextComment1->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment1 = m_Comment1Export->GetValue();
if ( !m_TextComment2->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment2 = m_Comment2Export->GetValue();
if ( !m_TextComment3->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment3 = m_Comment3Export->GetValue();
if ( !m_TextComment4->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment4 = m_Comment4Export->GetValue();
if ( !m_TextComment5->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment5 = m_Comment5Export->GetValue();
if ( !m_TextComment6->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment6 = m_Comment6Export->GetValue();
if ( !m_TextComment7->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment7 = m_Comment7Export->GetValue();
if ( !m_TextComment8->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment8 = m_Comment8Export->GetValue();
if ( !m_TextComment9->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment9 = m_Comment9Export->GetValue();
if( !m_TextRevision->GetValue().IsEmpty() )
cfg->m_PageSettings.export_revision = m_RevisionExport->GetValue();
if( !m_TextDate->GetValue().IsEmpty() )
cfg->m_PageSettings.export_date = m_DateExport->GetValue();
if( !m_TextTitle->GetValue().IsEmpty() )
cfg->m_PageSettings.export_title = m_TitleExport->GetValue();
if( !m_TextCompany->GetValue().IsEmpty() )
cfg->m_PageSettings.export_company = m_CompanyExport->GetValue();
if( !m_TextComment1->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment1 = m_Comment1Export->GetValue();
if( !m_TextComment2->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment2 = m_Comment2Export->GetValue();
if( !m_TextComment3->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment3 = m_Comment3Export->GetValue();
if( !m_TextComment4->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment4 = m_Comment4Export->GetValue();
if( !m_TextComment5->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment5 = m_Comment5Export->GetValue();
if( !m_TextComment6->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment6 = m_Comment6Export->GetValue();
if( !m_TextComment7->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment7 = m_Comment7Export->GetValue();
if( !m_TextComment8->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment8 = m_Comment8Export->GetValue();
if( !m_TextComment9->GetValue().IsEmpty() )
cfg->m_PageSettings.export_comment9 = m_Comment9Export->GetValue();
}
@ -89,19 +116,32 @@ void DIALOG_EESCHEMA_PAGE_SETTINGS::onTransferDataToWindow()
wxCHECK( cfg, /* void */ );
m_PaperExport->SetValue( cfg->m_PageSettings.export_paper );
m_RevisionExport->SetValue( m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision );
m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_date );
m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_title );
m_CompanyExport->SetValue( m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company );
m_Comment1Export->SetValue( m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 );
m_Comment2Export->SetValue( m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 );
m_Comment3Export->SetValue( m_TextComment3->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment3 );
m_Comment4Export->SetValue( m_TextComment4->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment4 );
m_Comment5Export->SetValue( m_TextComment5->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment5 );
m_Comment6Export->SetValue( m_TextComment6->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment6 );
m_Comment7Export->SetValue( m_TextComment7->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment7 );
m_Comment8Export->SetValue( m_TextComment8->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment8 );
m_Comment9Export->SetValue( m_TextComment9->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment9 );
m_RevisionExport->SetValue(
m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision );
m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false
: cfg->m_PageSettings.export_date );
m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false
: cfg->m_PageSettings.export_title );
m_CompanyExport->SetValue(
m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company );
m_Comment1Export->SetValue(
m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 );
m_Comment2Export->SetValue(
m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 );
m_Comment3Export->SetValue(
m_TextComment3->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment3 );
m_Comment4Export->SetValue(
m_TextComment4->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment4 );
m_Comment5Export->SetValue(
m_TextComment5->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment5 );
m_Comment6Export->SetValue(
m_TextComment6->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment6 );
m_Comment7Export->SetValue(
m_TextComment7->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment7 );
m_Comment8Export->SetValue(
m_TextComment8->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment8 );
m_Comment9Export->SetValue(
m_TextComment9->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment9 );
}

View File

@ -28,7 +28,8 @@ class EMBEDDED_FILES;
class DIALOG_EESCHEMA_PAGE_SETTINGS : public DIALOG_PAGES_SETTINGS
{
public:
DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, EMBEDDED_FILES* aEmbeddedFiles, VECTOR2I aMaxUserSizeMils );
DIALOG_EESCHEMA_PAGE_SETTINGS( EDA_DRAW_FRAME* aParent, EMBEDDED_FILES* aEmbeddedFiles,
VECTOR2I aMaxUserSizeMils );
virtual ~DIALOG_EESCHEMA_PAGE_SETTINGS();
private:

View File

@ -58,7 +58,7 @@
wxDEFINE_EVENT( EDA_EVT_CLOSE_ERC_DIALOG, wxCommandEvent );
// wxWidgets spends *far* too long calcuating column widths (most of it, believe it or
// wxWidgets spends *far* too long calculating column widths (most of it, believe it or
// not, in repeatedly creating/destroying a wxDC to do the measurement in).
// Use default column widths instead.
static int DEFAULT_SINGLE_COL_WIDTH = 660;
@ -451,6 +451,7 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
itemsNotAnnotated ), RPT_SEVERITY_INFO );
if( m_cancelled )
// @spellingerror
m_messages->Report( _( "-------- ERC cancelled by user.<br><br>" ), RPT_SEVERITY_INFO );
else
m_messages->Report( _( "Done.<br><br>" ), RPT_SEVERITY_INFO );
@ -468,6 +469,7 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
if( !m_cancelled )
{
m_sdbSizer1Cancel->SetDefault();
// wxWidgets has a tendency to keep both buttons highlighted without the following:
m_sdbSizer1OK->Enable( false );
@ -683,7 +685,8 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
menu.Append( ID_SET_SEVERITY_TO_WARNING,
wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
rcItem->GetErrorText() ),
_( "Violation severities can also be edited in the Schematic Setup... dialog" ) );
_( "Violation severities can also be edited in the Schematic Setup... "
"dialog" ) );
}
menu.Append( ID_SET_SEVERITY_TO_IGNORE,

View File

@ -105,6 +105,7 @@ public:
const wxString GetPageNetFmtName() { return m_pageNetFmtName; }
NETLIST_TYPE_ID m_IdNetType;
// opt to reformat passive component values (e.g. 1M -> 1Meg):
wxCheckBox* m_CurSheetAsRoot;
wxCheckBox* m_SaveAllVoltages;
@ -139,8 +140,8 @@ public:
bool TransferDataFromWindow() override;
private:
/*
* Browse plugin files, and set m_CommandStringCtrl field
/**
* Browse plugin files, and set m_CommandStringCtrl field.
*/
void OnBrowseGenerators( wxCommandEvent& event ) override;

View File

@ -237,7 +237,8 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
m_isSheetFilename = true;
m_fieldId = SHEETFILENAME_V;
m_note->SetLabel( wxString::Format( m_note->GetLabel(),
_( "Sheet filename can only be modified in Sheet Properties dialog." ) ) );
_( "Sheet filename can only be modified in Sheet Properties "
"dialog." ) ) );
m_note->Show( true );
break;
@ -699,7 +700,7 @@ void DIALOG_FIELD_PROPERTIES::UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aFiel
if( positioningModified && parent )
parent->SetFieldsAutoplaced( AUTOPLACE_NONE );
//Update the hierarchy navigator labels if needed
// Update the hierarchy navigator labels if needed.
if( needUpdateHierNav )
editFrame->UpdateLabelsHierarchyNavigator();
}

View File

@ -60,6 +60,7 @@ bool DIALOG_IMAGE_PROPERTIES::TransferDataToWindow()
bool DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow()
{
REFERENCE_IMAGE& refImage = m_bitmap.GetReferenceImage();
if( m_imageEditor->TransferDataFromWindow() )
{
SCH_COMMIT commit( m_frame );

View File

@ -41,7 +41,8 @@
#include <sch_commit.h>
DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_LABEL_BASE* aLabel ) :
DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent,
SCH_LABEL_BASE* aLabel ) :
DIALOG_LABEL_PROPERTIES_BASE( aParent ),
m_Parent( aParent ),
m_currentLabel( aLabel ),
@ -182,7 +183,8 @@ DIALOG_LABEL_PROPERTIES::DIALOG_LABEL_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_L
m_formattingGB->Detach( m_fontCtrl );
m_formattingGB->Detach( m_iconBar );
m_formattingGB->Add( m_iconBar, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxRIGHT, 5 );
m_formattingGB->Add( m_iconBar, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ),
wxEXPAND | wxRIGHT, 5 );
}
else
{
@ -285,7 +287,8 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
// Ensure the symbol has the Power (i.e. equivalent to a global label
// before adding its value in list
if( power->IsSymbolLikePowerGlobalLabel() )
existingLabels.insert( UnescapeString( power->GetField( VALUE_FIELD )->GetText() ) );
existingLabels.insert(
UnescapeString( power->GetField( VALUE_FIELD )->GetText() ) );
}
}
@ -363,9 +366,6 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
}
/*!
* wxEVT_COMMAND_ENTER event handler for single-line control
*/
void DIALOG_LABEL_PROPERTIES::OnEnterKey( wxCommandEvent& aEvent )
{
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
@ -527,15 +527,24 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
if( m_shapeSizer->AreAnyItemsShown() )
{
if( m_bidirectional->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_BIDI );
else if( m_input->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_INPUT );
else if( m_output->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
else if( m_triState->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_TRISTATE );
else if( m_passive->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
else if( m_dot->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_DOT );
else if( m_circle->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_ROUND );
else if( m_diamond->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_DIAMOND );
else if( m_rectangle->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_RECTANGLE );
if( m_bidirectional->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_BIDI );
else if( m_input->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_INPUT );
else if( m_output->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
else if( m_triState->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_TRISTATE );
else if( m_passive->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED );
else if( m_dot->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_DOT );
else if( m_circle->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_ROUND );
else if( m_diamond->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_DIAMOND );
else if( m_rectangle->GetValue() )
m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_RECTANGLE );
}
if( m_fontCtrl->HaveFontSelection() )
@ -547,7 +556,8 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
static_cast<SCH_DIRECTIVE_LABEL*>( m_currentLabel )->SetPinLength( m_textSize.GetIntValue() );
else if( m_currentLabel->GetTextWidth() != m_textSize.GetIntValue() )
m_currentLabel->SetTextSize( VECTOR2I( m_textSize.GetIntValue(), m_textSize.GetIntValue() ) );
m_currentLabel->SetTextSize( VECTOR2I( m_textSize.GetIntValue(),
m_textSize.GetIntValue() ) );
// Must come after SetTextSize()
m_currentLabel->SetBold( m_bold->IsChecked() );

View File

@ -41,6 +41,9 @@ public:
~DIALOG_LABEL_PROPERTIES();
private:
/**
* wxEVT_COMMAND_ENTER event handler for single-line control.
*/
void OnEnterKey( wxCommandEvent& aEvent ) override;
void OnValueCharHook( wxKeyEvent& aEvent ) override;
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;

View File

@ -224,6 +224,7 @@ public:
val = LIB_SYMBOL::LetterSubReference( pin->GetUnit(), 'A' );
else
val = UNITS_ALL;
break;
case COL_DEMORGAN:
@ -250,6 +251,7 @@ public:
{
if( fieldValue.length() )
fieldValue += wxT( ", " );
fieldValue += val;
}
else
@ -329,7 +331,8 @@ public:
VECTOR2I pos = last->GetPosition();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
SYMBOL_EDITOR_SETTINGS* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
SYMBOL_EDITOR_SETTINGS* cfg =
mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>( "symbol_editor" );
if( last->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
|| last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
@ -390,7 +393,8 @@ public:
case COL_ORIENTATION:
if( PinOrientationNames().Index( value ) != wxNOT_FOUND )
pin->SetOrientation( PinOrientationCode( PinOrientationNames().Index( value ) ) );
pin->SetOrientation(
PinOrientationCode( PinOrientationNames().Index( value ) ) );
break;
case COL_NUMBER_SIZE:
@ -435,6 +439,7 @@ public:
}
}
}
break;
case COL_DEMORGAN:
@ -1011,7 +1016,8 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnDeleteRow( wxCommandEvent& event )
if( curRow < 0 )
return;
// move the selection first because wx internally will try to reselect the row we deleted in out of order events
// move the selection first because wx internally will try to reselect the row we deleted in
// out of order events
int nextSelRow = std::max( curRow-1, 0 );
m_grid->GoToCell( nextSelRow, m_grid->GetGridCursorCol() );
m_grid->SetGridCursor( nextSelRow, m_grid->GetGridCursorCol() );
@ -1137,7 +1143,6 @@ void DIALOG_LIB_EDIT_PIN_TABLE::adjustGridColumns()
// The Number and Name columns must be at least wide enough to hold their contents, but
// no less wide than their original widths.
m_grid->AutoSizeColumn( COL_NUMBER );
if( m_grid->GetColSize( COL_NUMBER ) < m_originalColWidths[ COL_NUMBER ] )
@ -1150,7 +1155,6 @@ void DIALOG_LIB_EDIT_PIN_TABLE::adjustGridColumns()
// If the grid is still wider than the columns, then stretch the Number and Name columns
// to fit.
for( int i = 0; i < COL_COUNT; ++i )
width -= m_grid->GetColSize( i );

View File

@ -88,7 +88,8 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
m_grid->ShowHideColumns( cfg->m_EditSymbolVisibleColumns );
wxGridCellAttr* attr = new wxGridCellAttr;
attr->SetEditor( new GRID_CELL_URL_EDITOR( this, PROJECT_SCH::SchSearchS( &Prj() ), aLibEntry ) );
attr->SetEditor( new GRID_CELL_URL_EDITOR( this, PROJECT_SCH::SchSearchS( &Prj() ),
aLibEntry ) );
m_grid->SetAttr( DATASHEET_FIELD, FDC_VALUE, attr );
m_SymbolNameCtrl->SetValidator( FIELD_VALIDATOR( VALUE_FIELD ) );
@ -124,7 +125,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
m_fpFilterTricks->ProcessEvent( cmdEvent );
} );
// When the filter tricks modifies something, update outselves
// When the filter tricks modifies something, update ourselves
m_FootprintFilterListBox->Bind( EDA_EVT_LISTBOX_CHANGED,
[&]( wxCommandEvent& aEvent )
{
@ -802,7 +803,6 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddFootprintFilter( wxCommandEvent& event )
filterLine.Replace( wxT( " " ), wxT( "_" ) );
// duplicate filters do no harm, so don't be a nanny.
m_FootprintFilterListBox->Append( filterLine );
m_FootprintFilterListBox->SetSelection( (int) m_FootprintFilterListBox->GetCount() - 1 );

View File

@ -123,7 +123,8 @@ public:
};
DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin, bool aFocusPinNumber ) :
DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin,
bool aFocusPinNumber ) :
DIALOG_PIN_PROPERTIES_BASE( parent ),
m_frame( parent ),
m_pin( aPin ),
@ -173,8 +174,10 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN
m_sdbSizerButtonsCancel
};
// Default alternates turndown to whether or not alternates exist, or if we've had it open before
m_alternatesTurndown->Collapse( m_pin->GetAlternates().size() == 0 && !s_alternatesTurndownOpen);
// Default alternates turndown to whether or not alternates exist, or if we've had it open
// before
m_alternatesTurndown->Collapse( m_pin->GetAlternates().size() == 0
&& !s_alternatesTurndownOpen );
// wxwidgets doesn't call the OnCollapseChange even at init, so we update this value if
// the alternates pane defaults to open
@ -268,7 +271,8 @@ bool DIALOG_PIN_PROPERTIES::TransferDataToWindow()
m_numberSize.SetValue( m_pin->GetNumberTextSize() );
m_pinLength.SetValue( m_pin->GetLength() );
m_checkApplyToAllParts->Enable( m_pin->GetParentSymbol()->IsMulti() );
m_checkApplyToAllParts->SetValue( m_pin->GetParentSymbol()->IsMulti() && m_pin->GetUnit() == 0 );
m_checkApplyToAllParts->SetValue( m_pin->GetParentSymbol()->IsMulti()
&& m_pin->GetUnit() == 0 );
m_checkApplyToAllBodyStyles->SetValue( m_pin->GetBodyStyle() == 0 );
m_checkShow->SetValue( m_pin->IsVisible() );
@ -342,7 +346,7 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
// Only show the warning if the position has been changed
if( ( m_origPos != newPos )
&& (( m_posX.GetValue() % standard_grid ) || ( m_posY.GetValue() % standard_grid ) ) )
&& ( ( m_posX.GetValue() % standard_grid ) || ( m_posY.GetValue() % standard_grid ) ) )
{
wxString msg = wxString::Format( _( "This pin is not on a %d mils grid which will make it "
"difficult to connect to in the schematic.\n"
@ -375,9 +379,6 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
}
/*
* Draw (on m_panelShowPin) the pin according to current settings in dialog
*/
void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
{
wxPaintDC dc( m_panelShowPin );
@ -437,6 +438,7 @@ void DIALOG_PIN_PROPERTIES::OnPropertiesChange( wxCommandEvent& event )
m_panelShowPin->Refresh();
}
wxString DIALOG_PIN_PROPERTIES::getSyncPinsMessage()
{
if( m_checkApplyToAllParts->GetValue() )
@ -538,6 +540,8 @@ void DIALOG_PIN_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
m_delayedFocusColumn = -1;
}
}
void DIALOG_PIN_PROPERTIES::OnCollapsiblePaneChange( wxCollapsiblePaneEvent& event )
{
if( !event.GetCollapsed() )

View File

@ -59,6 +59,9 @@ public:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
/**
* Draw (on m_panelShowPin) the pin according to current settings in dialog.
*/
void OnPaintShowPanel( wxPaintEvent& event ) override;
void OnPropertiesChange( wxCommandEvent& event ) override;
void OnAddAlternate( wxCommandEvent& event ) override;

View File

@ -169,7 +169,8 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
// Set the default line width (pen width which should be used for
// items that do not have a pen size defined (like frame ref)
// the default line width is stored in mils in config
m_defaultLineWidth.SetValue( schIUScale.MilsToIU( cfg->m_Drawing.default_line_thickness ) );
m_defaultLineWidth.SetValue(
schIUScale.MilsToIU( cfg->m_Drawing.default_line_thickness ) );
}
// Initialize HPGL specific widgets
@ -445,7 +446,8 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
m_job->m_blackAndWhite = !getModeColor();
m_job->m_useBackgroundColor = m_plotBackgroundColor->GetValue();
m_job->m_HPGLPenSize = m_penWidth.GetDoubleValue();
// m_job->m_HPGLPaperSizeSelect = m_HPGLPaperSizeSelect;
// m_job->m_HPGLPaperSizeSelect = m_HPGLPaperSizeSelect;
m_job->m_pageSizeSelect = static_cast<JOB_PAGE_SIZE>( m_pageSizeSelect );
m_job->m_PDFPropertyPopups = m_plotPDFPropertyPopups->GetValue();
m_job->m_PDFHierarchicalLinks = m_plotPDFHierarchicalLinks->GetValue();

View File

@ -35,7 +35,8 @@
wxString DIALOG_SCH_IMPORT_SETTINGS::m_filePath; // remember for session
DIALOG_SCH_IMPORT_SETTINGS::DIALOG_SCH_IMPORT_SETTINGS( wxWindow* aParent, SCH_EDIT_FRAME* aFrame ) :
DIALOG_SCH_IMPORT_SETTINGS::DIALOG_SCH_IMPORT_SETTINGS( wxWindow* aParent,
SCH_EDIT_FRAME* aFrame ) :
DIALOG_SCH_IMPORT_SETTINGS_BASE( aParent ),
m_frame( aFrame )
{

View File

@ -108,7 +108,8 @@ DIALOG_SHAPE_PROPERTIES::~DIALOG_SHAPE_PROPERTIES()
{
m_borderColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch,
this );
m_customColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch,
m_customColorSwatch->Unbind( COLOR_SWATCH_CHANGED,
&DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch,
this );
}

View File

@ -441,6 +441,7 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
wxString msg;
wxFileName sheetFileName( EnsureFileExtension( aNewFilename,
FILEEXT::KiCadSchematicFileExtension ) );
// Sheet file names are relative to the path of the current sheet. This allows for
// nesting of schematic files in subfolders. Screen file names are always absolute.
SCHEMATIC& schematic = m_frame->Schematic();
@ -492,7 +493,8 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
if( m_sheet->GetScreen() == nullptr ) // New just created sheet.
{
if( !m_frame->AllowCaseSensitiveFileNameClashes( m_sheet->GetFileName(), newAbsoluteFilename ) )
if( !m_frame->AllowCaseSensitiveFileNameClashes( m_sheet->GetFileName(),
newAbsoluteFilename ) )
return false;
if( useScreen || loadFromFile ) // Load from existing file.
@ -508,7 +510,8 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
return false;
}
}
// If we are drawing a sheet from a design block/sheet import, we need to copy the sheet to the current directory.
// If we are drawing a sheet from a design block/sheet import, we need to copy the
// sheet to the current directory.
else if( m_sourceSheetFilename && !m_sourceSheetFilename->IsEmpty() )
{
loadFromFile = true;
@ -532,7 +535,8 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
{
isExistingSheet = true;
if( !m_frame->AllowCaseSensitiveFileNameClashes( m_sheet->GetFileName(), newAbsoluteFilename ) )
if( !m_frame->AllowCaseSensitiveFileNameClashes( m_sheet->GetFileName(),
newAbsoluteFilename ) )
return false;
// We are always using here a case insensitive comparison to avoid issues

View File

@ -143,6 +143,7 @@ DIALOG_SIM_COMMAND::DIALOG_SIM_COMMAND( SIMULATOR_FRAME* aParent,
SetupStandardButtons();
}
bool DIALOG_SIM_COMMAND::TransferDataToWindow()
{
/// @todo one day it could interpret the sim command and fill out appropriate fields.
@ -1008,7 +1009,8 @@ void DIALOG_SIM_COMMAND::OnFilterMouseMoved( wxMouseEvent& aEvent )
if( m_inputSignalsFilter->IsSearchButtonVisible() && pos.x < buttonWidth )
SetCursor( wxCURSOR_ARROW );
else if( m_inputSignalsFilter->IsCancelButtonVisible() && pos.x > ctrlRect.GetWidth() - buttonWidth )
else if( m_inputSignalsFilter->IsCancelButtonVisible()
&& pos.x > ctrlRect.GetWidth() - buttonWidth )
SetCursor( wxCURSOR_ARROW );
else
SetCursor( wxCURSOR_IBEAM );

View File

@ -60,10 +60,12 @@ public:
void SetSimOptions( int aOptions )
{
m_fixIncludePaths->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_ADJUST_INCLUDE_PATHS );
m_fixIncludePaths->SetValue( aOptions &
NETLIST_EXPORTER_SPICE::OPTION_ADJUST_INCLUDE_PATHS );
m_saveAllVoltages->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_VOLTAGES );
m_saveAllCurrents->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_CURRENTS );
m_saveAllDissipations->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS );
m_saveAllDissipations->SetValue( aOptions &
NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_DISSIPATIONS );
m_saveAllEvents->SetValue( aOptions & NETLIST_EXPORTER_SPICE::OPTION_SAVE_ALL_EVENTS );
}
@ -91,7 +93,7 @@ private:
LINEAR
};
///< Generate events to update UI state.
/// Generate events to update UI state.
void refreshUIControls()
{
wxQueueEvent( m_dcEnable2, new wxCommandEvent( wxEVT_CHECKBOX ) );

View File

@ -259,7 +259,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) )
idx = m_modelListBoxEntryToLibraryIdx.at( sel );
auto ibismodel = dynamic_cast<SIM_MODEL_IBIS*>( &m_libraryModelsMgr.GetModels()[idx].get() );
auto ibismodel =
dynamic_cast<SIM_MODEL_IBIS*>( &m_libraryModelsMgr.GetModels()[idx].get() );
if( ibismodel )
{
@ -269,7 +270,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
for( const std::pair<std::string, std::string>& strs : ibismodel->GetIbisPins() )
{
if( strs.first == SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_IBIS::PIN_FIELD ) )
if( strs.first
== SIM_MODEL::GetFieldValue( &m_fields, SIM_LIBRARY_IBIS::PIN_FIELD ) )
{
auto ibisLibrary = static_cast<const SIM_LIBRARY_IBIS*>( library() );
@ -386,7 +388,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) )
idx = m_modelListBoxEntryToLibraryIdx.at( sel );
auto* ibismodel = static_cast<SIM_MODEL_IBIS*>( &m_libraryModelsMgr.GetModels().at( idx ).get() );
auto* ibismodel =
static_cast<SIM_MODEL_IBIS*>( &m_libraryModelsMgr.GetModels().at( idx ).get() );
if( ibismodel )
{
@ -510,7 +513,7 @@ void DIALOG_SIM_MODEL<T>::updateIbisWidgets( SIM_MODEL* aModel )
SIM_MODEL::TYPE::KIBIS_DRIVER_PRBS } )
{
SIM_MODEL::DEVICE_T deviceType = SIM_MODEL::TypeInfo( type ).deviceType;
const std::string& deviceTypeDesc = SIM_MODEL::DeviceInfo( deviceType ).description;
const std::string& deviceTypeDesc = SIM_MODEL::DeviceInfo( deviceType ).description;
if( deviceType == aModel->GetDeviceType()
|| deviceTypeDesc == aModel->GetDeviceInfo().description )
@ -562,7 +565,7 @@ void DIALOG_SIM_MODEL<T>::updateBuiltinModelWidgets( SIM_MODEL* aModel )
}
SIM_MODEL::DEVICE_T deviceType = SIM_MODEL::TypeInfo( type ).deviceType;
const std::string& deviceTypeDesc = SIM_MODEL::DeviceInfo( deviceType ).description;
const std::string& deviceTypeDesc = SIM_MODEL::DeviceInfo( deviceType ).description;
if( deviceType == aModel->GetDeviceType()
|| deviceTypeDesc == aModel->GetDeviceInfo().description )
@ -570,7 +573,8 @@ void DIALOG_SIM_MODEL<T>::updateBuiltinModelWidgets( SIM_MODEL* aModel )
m_deviceSubtypeChoice->Append( SIM_MODEL::TypeInfo( type ).description );
if( type == aModel->GetType() )
m_deviceSubtypeChoice->SetSelection( m_deviceSubtypeChoice->GetCount() - 1 );
m_deviceSubtypeChoice->SetSelection( m_deviceSubtypeChoice->GetCount()
- 1 );
}
}
}
@ -1111,11 +1115,14 @@ SIM_MODEL& DIALOG_SIM_MODEL<T>::curModel() const
wxString sel = m_modelListBox->GetStringSelection();
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) )
return m_libraryModelsMgr.GetModels().at( m_modelListBoxEntryToLibraryIdx.at( sel ) ).get();
return m_libraryModelsMgr.GetModels()
.at( m_modelListBoxEntryToLibraryIdx.at( sel ) )
.get();
}
else
{
if( static_cast<int>( m_curModelType ) < static_cast<int>( m_builtinModelsMgr.GetModels().size() ) )
if( static_cast<int>( m_curModelType )
< static_cast<int>( m_builtinModelsMgr.GetModels().size() ) )
return m_builtinModelsMgr.GetModels().at( static_cast<int>( m_curModelType ) );
}
@ -1352,7 +1359,8 @@ void DIALOG_SIM_MODEL<T>::onModelNameChoice( wxCommandEvent& aEvent )
m_rbLibraryModel->SetValue( true );
if( SIM_MODEL_SPICE_FALLBACK* fallback = dynamic_cast<SIM_MODEL_SPICE_FALLBACK*>( &curModel() ) )
if( SIM_MODEL_SPICE_FALLBACK* fallback =
dynamic_cast<SIM_MODEL_SPICE_FALLBACK*>( &curModel() ) )
{
wxArrayString lines = wxSplit( fallback->GetSpiceCode(), '\n' );
wxString code;
@ -1431,9 +1439,11 @@ void DIALOG_SIM_MODEL<T>::onPinModelCombobox( wxCommandEvent& aEvent )
template <typename T>
void DIALOG_SIM_MODEL<T>::onPinModelComboboxTextEnter( wxCommandEvent& aEvent )
{
m_pinModelCombobox->SetSelection( m_pinModelCombobox->FindString( m_pinModelCombobox->GetValue() ) );
m_pinModelCombobox->SetSelection(
m_pinModelCombobox->FindString( m_pinModelCombobox->GetValue() ) );
}
template <typename T>
void DIALOG_SIM_MODEL<T>::onDifferentialCheckbox( wxCommandEvent& aEvent )
{
@ -1454,7 +1464,8 @@ void DIALOG_SIM_MODEL<T>::onDeviceTypeChoice( wxCommandEvent& aEvent )
for( SIM_MODEL::DEVICE_T deviceType : SIM_MODEL::DEVICE_T_ITERATOR() )
{
if( SIM_MODEL::DeviceInfo( deviceType ).description == m_deviceChoice->GetStringSelection() )
if( SIM_MODEL::DeviceInfo( deviceType ).description
== m_deviceChoice->GetStringSelection() )
{
m_curModelType = m_curModelTypeOfDeviceType.at( deviceType );
break;
@ -1485,13 +1496,15 @@ void DIALOG_SIM_MODEL<T>::onWaveformChoice( wxCommandEvent& aEvent )
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) )
idx = m_modelListBoxEntryToLibraryIdx.at( sel );
auto& baseModel = static_cast<SIM_MODEL_IBIS&>( m_libraryModelsMgr.GetModels()[idx].get() );
auto& baseModel =
static_cast<SIM_MODEL_IBIS&>( m_libraryModelsMgr.GetModels()[idx].get() );
m_libraryModelsMgr.SetModel( idx, std::make_unique<SIM_MODEL_IBIS>( type, baseModel ) );
try
{
m_libraryModelsMgr.GetModels()[idx].get().ReadDataFields( &m_fields, m_sortedPartPins );
m_libraryModelsMgr.GetModels()[idx].get().ReadDataFields( &m_fields,
m_sortedPartPins );
}
catch( IO_ERROR& err )
{
@ -1708,7 +1721,8 @@ void DIALOG_SIM_MODEL<T>::adjustParamGridColumns( int aWidth, bool aForce )
if( ii == PARAM_COLUMN::DESCRIPTION )
colWidths.push_back( grid->GetState()->GetColumnWidth( ii ) + margin + indent );
else if( ii == PARAM_COLUMN::VALUE )
colWidths.push_back( std::max( 72, grid->GetState()->GetColumnWidth( ii ) ) + margin );
colWidths.push_back( std::max( 72,
grid->GetState()->GetColumnWidth( ii ) ) + margin );
else
colWidths.push_back( 60 + margin );
@ -1733,6 +1747,5 @@ void DIALOG_SIM_MODEL<T>::onSizeParamGrid( wxSizeEvent& event )
}
template class DIALOG_SIM_MODEL<SCH_SYMBOL>;
template class DIALOG_SIM_MODEL<LIB_SYMBOL>;

View File

@ -135,7 +135,7 @@ private:
std::map<wxString, int> m_modelListBoxEntryToLibraryIdx;
std::vector<SCH_PIN*> m_sortedPartPins; //< Pins of the current part.
std::vector<SCH_PIN*> m_sortedPartPins; ///< Pins of the current part.
std::map<SIM_MODEL::DEVICE_T, SIM_MODEL::TYPE> m_curModelTypeOfDeviceType;
SIM_MODEL::TYPE m_curModelType;

View File

@ -113,7 +113,8 @@ protected:
// pick a footprint using the footprint picker.
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD );
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true, m_dlg ) )
if( KIWAY_PLAYER* frame = m_dlg->Kiway().Player( FRAME_FOOTPRINT_CHOOSER, true,
m_dlg ) )
{
if( frame->ShowModal( &fpid, m_dlg ) )
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD, fpid );
@ -382,7 +383,8 @@ DIALOG_SYMBOL_FIELDS_TABLE::DIALOG_SYMBOL_FIELDS_TABLE( SCH_EDIT_FRAME* parent,
m_grid->Connect( wxEVT_GRID_COL_MOVE,
wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColMove ), nullptr, this );
m_cbBomPresets->Bind( wxEVT_CHOICE, &DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged, this );
m_cbBomFmtPresets->Bind( wxEVT_CHOICE, &DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged, this );
m_cbBomFmtPresets->Bind( wxEVT_CHOICE, &DIALOG_SYMBOL_FIELDS_TABLE::onBomFmtPresetChanged,
this );
m_fieldsCtrl->Bind( wxEVT_DATAVIEW_ITEM_VALUE_CHANGED,
&DIALOG_SYMBOL_FIELDS_TABLE::OnColLabelChange, this );
@ -476,7 +478,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::SetupAllColumnProperties()
// sync m_grid's column visibilities to Show checkboxes in m_fieldsCtrl
for( int i = 0; i < m_fieldsCtrl->GetItemCount(); ++i )
{
int col = m_dataModel->GetFieldNameCol( m_fieldsCtrl->GetTextValue( i, FIELD_NAME_COLUMN ) );
int col = m_dataModel->GetFieldNameCol( m_fieldsCtrl->GetTextValue( i,
FIELD_NAME_COLUMN ) );
if( col == -1 )
continue;
@ -617,7 +620,7 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataFromWindow()
if( m_job )
{
// and exit, dont even dream of saving changes from the data model
// and exit, don't even dream of saving changes from the data model
return true;
}
@ -797,8 +800,9 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRemoveField( wxCommandEvent& event )
m_fieldsCtrl->DeleteItem( row );
m_dataModel->RemoveColumn( col );
// Make selection and update the state of "Remove field..." button via OnFieldsCtrlSelectionChanged()
// Safe to decrement row index because we always have mandatory fields
// Make selection and update the state of "Remove field..." button via
// OnFieldsCtrlSelectionChanged().
// Safe to decrement row index because we always have mandatory fields.
m_fieldsCtrl->SelectRow( --row );
if( row < MANDATORY_FIELDS )
@ -902,6 +906,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnFieldsCtrlSelectionChanged( wxDataViewEvent&
}
}
void DIALOG_SYMBOL_FIELDS_TABLE::OnColumnItemToggled( wxDataViewEvent& event )
{
wxDataViewItem item = event.GetItem();
@ -1085,6 +1090,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColLabelChange( wxDataViewEvent& aEvent )
m_grid->ForceRefresh();
}
void DIALOG_SYMBOL_FIELDS_TABLE::OnTableValueChanged( wxGridEvent& aEvent )
{
m_grid->ForceRefresh();
@ -1109,11 +1115,13 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRegroupSymbols( wxCommandEvent& aEvent )
m_grid->ForceRefresh();
}
void DIALOG_SYMBOL_FIELDS_TABLE::OnScopeChanged( wxCommandEvent& aEvent )
{
UpdateScope();
}
void DIALOG_SYMBOL_FIELDS_TABLE::UpdateScope()
{
m_dataModel->SetPath( m_parent->GetCurrentSheet() );
@ -1128,6 +1136,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::UpdateScope()
m_dataModel->RebuildRows();
}
void DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick( wxGridEvent& event )
{
if( m_dataModel->ColIsReference( event.GetCol() ) )
@ -1143,6 +1152,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick( wxGridEvent& event )
}
}
void DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected( wxGridRangeSelectEvent& aEvent )
{
// Cross-probing should only work in Edit page
@ -1401,7 +1411,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnExport( wxCommandEvent& aEvent )
return;
}
out.Close(); // close the file before we tell the user it's done with the info modal :workflow meme:
// close the file before we tell the user it's done with the info modal :workflow meme:
out.Close();
msg.Printf( _( "Wrote BOM output to '%s'" ), outputFile.GetFullPath() );
DisplayInfoMessage( this, msg );
}
@ -1675,10 +1686,12 @@ void DIALOG_SYMBOL_FIELDS_TABLE::syncBomPresetSelection()
// We should compare preset.name and current.name.
// unfortunately current.name is empty because
// m_dataModel->GetBomSettings() does not store the .name member
// So use sortField member as a (not very efficient) auxiliary filter.
// So use sortField member as a (not very efficient) auxiliary
// filter.
// sortField can be translated in m_bomPresets list,
// so current.sortField needs to be translated
// Probably this not efficient and error prone test should be removed (JPC).
// Probably this not efficient and error prone test should be
// removed (JPC).
if( preset.sortField != wxGetTranslation( current.sortField ) )
return false;
@ -1947,7 +1960,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset( const BOM_PRESET& aPreset )
if( cfg->m_FieldEditorPanel.field_widths.count( fieldNameStr ) )
m_grid->SetColSize( col, cfg->m_FieldEditorPanel.field_widths.at( fieldNameStr ) );
// Set shown colums
// Set shown columns
bool show = m_dataModel->GetShowColumn( col );
m_fieldsCtrl->SetToggleValue( show, i, SHOW_FIELD_COLUMN );
@ -2336,7 +2349,6 @@ void DIALOG_SYMBOL_FIELDS_TABLE::savePresetsToSchematic()
m_schSettings.m_BomSettings = m_dataModel->GetBomSettings();
}
// Save our BOM Format presets
std::vector<BOM_FMT_PRESET> fmts;

View File

@ -334,7 +334,8 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
m_pinGrid->SetDefaultRowSize( m_pinGrid->GetDefaultRowSize() + 4 );
m_fieldsGrid->SetTable( m_fields );
m_fieldsGrid->PushEventHandler( new FIELDS_GRID_TRICKS( m_fieldsGrid, this, &aParent->Schematic(),
m_fieldsGrid->PushEventHandler( new FIELDS_GRID_TRICKS( m_fieldsGrid, this,
&aParent->Schematic(),
[&]( wxCommandEvent& aEvent )
{
OnAddField( aEvent );

View File

@ -313,7 +313,8 @@ bool DIALOG_SYMBOL_REMAP::remapSymbolToLibTable( SCH_SYMBOL* aSymbol )
// Find the same library in the symbol library table using the full path and file name.
wxString libFileName = lib.GetFullFileName();
const LIB_TABLE_ROW* row = PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRowByURI( libFileName );
const LIB_TABLE_ROW* row =
PROJECT_SCH::SchSymbolLibTable( &Prj() )->FindRowByURI( libFileName );
if( row )
{
@ -416,7 +417,8 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
destFileName.GetFullPath() ),
RPT_SEVERITY_INFO );
if( !destFileName.DirExists() && !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
if( !destFileName.DirExists()
&& !destFileName.Mkdir( wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL ) )
{
errorMsg += wxString::Format( _( "Failed to create backup folder '%s'.\n" ),
destFileName.GetPath() );

View File

@ -41,7 +41,8 @@ DIALOG_TABLE_PROPERTIES::DIALOG_TABLE_PROPERTIES( SCH_EDIT_FRAME* aFrame, SCH_TA
m_frame( aFrame ),
m_table( aTable ),
m_borderWidth( aFrame, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ),
m_separatorsWidth( aFrame, m_separatorsWidthLabel, m_separatorsWidthCtrl, m_separatorsWidthUnits )
m_separatorsWidth( aFrame, m_separatorsWidthLabel, m_separatorsWidthCtrl,
m_separatorsWidthUnits )
{
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -131,7 +131,8 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
}
else
{
if( cell->GetFont() != m_fontCtrl->GetFontSelection( cell->IsBold(), cell->IsItalic() ) )
if( cell->GetFont() != m_fontCtrl->GetFontSelection( cell->IsBold(),
cell->IsItalic() ) )
m_fontCtrl->SetSelection( -1 );
if( cell->GetTextWidth() != m_textSize.GetValue() )

View File

@ -72,7 +72,8 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_BASE_FRAME* aParent, SCH_ITE
m_fillColorSwatch->SetSwatchBackground( schematicBackground );
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
m_infoBar->ShowMessage( _( "Note: individual item colors overridden in "
"Preferences." ) );
}
else
{
@ -350,7 +351,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_privateCheckbox->SetValue( m_currentItem->IsPrivate() );
m_commonToAllUnits->SetValue( symbol->IsMulti() && m_currentItem->GetUnit() == 0 );
m_commonToAllUnits->Enable( symbol->IsMulti() );
m_commonToAllBodyStyles->SetValue( symbol->HasAlternateBodyStyle() && m_currentItem->GetBodyStyle() == 0 );
m_commonToAllBodyStyles->SetValue( symbol->HasAlternateBodyStyle()
&& m_currentItem->GetBodyStyle() == 0 );
m_commonToAllBodyStyles->Enable( symbol->HasAlternateBodyStyle() );
}
@ -472,7 +474,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
// On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
text.Replace( "\r", "\n" );
#elif defined( __WINDOWS__ )
// On Windows, a new line is coded as \r\n. We use only \n in kicad files and in
// On Windows, a new line is coded as \r\n. We use only \n in KiCad files and in
// drawing routines so strip the \r char.
text.Replace( "\r", "" );
#endif
@ -523,7 +525,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
}
if( m_currentText->GetTextWidth() != m_textSize.GetValue() )
m_currentText->SetTextSize( VECTOR2I( m_textSize.GetIntValue(), m_textSize.GetIntValue() ) );
m_currentText->SetTextSize( VECTOR2I( m_textSize.GetIntValue(),
m_textSize.GetIntValue() ) );
if( m_fontCtrl->HaveFontSelection() )
{

View File

@ -50,7 +50,7 @@ protected:
checkAll( false );
}
///< Select or deselect all fields in the listbox widget
/// Select or deselect all fields in the listbox widget.
void checkAll( bool aCheck );
private:
@ -59,7 +59,7 @@ private:
SYMBOL_EDIT_FRAME* m_editFrame;
LIB_SYMBOL* m_symbol;
///< Set of field names that should have values updated
/// Set of field names that should have values updated.
std::set<wxString> m_updateFields;
};

View File

@ -145,7 +145,9 @@ bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataToWindow()
} ) )
{
if( dotSize >=0 )
{
m_junctionSize.SetValue( dotSize );
}
else
{
// No junction found in selected items: disable m_junctionSize

View File

@ -100,6 +100,7 @@ void PANEL_BOM_PRESETS::OnDeleteBomFmtPreset( wxCommandEvent& event )
return;
m_bomFmtPresetsGrid->DeleteRows( curRow, 1 );
// Erase the bom preset from the bom presets list.
m_bomFmtPresets.erase( m_bomFmtPresets.begin() + curRow );
}

View File

@ -112,7 +112,8 @@ bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow()
if( schFrame )
{
SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings();
projSettings.m_AnnotateStartNum = EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() );
projSettings.m_AnnotateStartNum =
EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() );
}
return true;

View File

@ -518,7 +518,8 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview()
view->SetScale( 1.0 );
VECTOR2D screenSize = view->ToWorld( ToVECTOR2D( m_preview->GetClientSize() ), false );
VECTOR2I psize( m_page->GetWidthIU( schIUScale.IU_PER_MILS ), m_page->GetHeightIU( schIUScale.IU_PER_MILS ) );
VECTOR2I psize( m_page->GetWidthIU( schIUScale.IU_PER_MILS ),
m_page->GetHeightIU( schIUScale.IU_PER_MILS ) );
double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),
fabs( psize.y / screenSize.y ) );

View File

@ -97,8 +97,9 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>( "eeschema" );
cfg->m_Appearance.default_font = m_defaultFontCtrl->GetSelection() <= 0
? wxString( KICAD_FONT_NAME ) // This is a keyword. Do not translate
: m_defaultFontCtrl->GetStringSelection();
// This is a keyword. Do not translate.
? wxString( KICAD_FONT_NAME )
: m_defaultFontCtrl->GetStringSelection();
cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue();
cfg->m_Appearance.show_hidden_fields = m_checkShowHiddenFields->GetValue();
cfg->m_Appearance.show_erc_warnings = m_checkShowERCWarnings->GetValue();

View File

@ -73,7 +73,8 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
m_backgroundColorSwatch->SetDefaultColor( settings->GetDefaultColor( LAYER_SHEET_BACKGROUND ) );
m_backgroundColorSwatch->SetSwatchColor( aCfg->m_Drawing.default_sheet_background_color, false );
m_backgroundColorSwatch->SetSwatchColor( aCfg->m_Drawing.default_sheet_background_color,
false );
m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
m_footprintPreview->SetValue( aCfg->m_Appearance.footprint_preview );

View File

@ -84,11 +84,11 @@ PANEL_SETUP_BUSES::~PANEL_SETUP_BUSES()
m_membersGrid->PopEventHandler( true );
m_aliasesGrid->Disconnect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( PANEL_SETUP_BUSES::OnAliasesGridCellChanging ),
nullptr, this );
wxGridEventHandler( PANEL_SETUP_BUSES::OnAliasesGridCellChanging ),
nullptr, this );
m_membersGrid->Disconnect( wxEVT_GRID_CELL_CHANGING,
wxGridEventHandler( PANEL_SETUP_BUSES::OnMemberGridCellChanging ),
nullptr, this );
wxGridEventHandler( PANEL_SETUP_BUSES::OnMemberGridCellChanging ),
nullptr, this );
}
@ -181,8 +181,8 @@ void PANEL_SETUP_BUSES::OnAddAlias( wxCommandEvent& aEvent )
int row = m_aliasesGrid->GetNumberRows();
// Associate the respective members with the previous alias. This ensures that the association starts
// correctly when adding more than one row
// Associate the respective members with the previous alias. This ensures that the association
// starts correctly when adding more than one row.
if( row > 0 )
updateAliasMembers( row - 1 );
@ -237,9 +237,10 @@ void PANEL_SETUP_BUSES::OnAddMember( wxCommandEvent& aEvent )
/*
* Check if the clipboard contains text data.
*
* - If `clipboardHasText` is true, select the specified row in the members grid to allow our custom
* conext menu to paste the clipbaord .
* - Otherwise, enable and display the cell edit control, allowing the user to manually edit the cell.
* - If `clipboardHasText` is true, select the specified row in the members grid to allow
* our custom context menu to paste the clipboard .
* - Otherwise, enable and display the cell edit control, allowing the user to manually edit
* the cell.
*/
bool clipboardHasText = false;

View File

@ -58,13 +58,13 @@ protected:
void doReloadMembersGrid();
/*
/**
* When rows are created programmatically by pasting values from the clipboard,
* the cell change event may not be triggered. This can prevent members from
* being automatically added to the corresponding alias.
* the cell change event may not be triggered.
*
* To ensure that members are correctly associated with the alias,
* we manually update the members for the needed alias.
* This can prevent members from being automatically added to the corresponding alias. To
* ensure that members are correctly associated with the alias, manually update the members
* for the needed alias.
*/
void updateAliasMembers( int aAliasIndex );

View File

@ -38,7 +38,8 @@ PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAM
m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
m_pinSymbolSize( aFrame, m_pinSymbolSizeLabel, m_pinSymbolSizeCtrl, m_pinSymbolSizeUnits ),
m_connectionGridSize( aFrame, m_connectionGridLabel, m_connectionGridCtrl, m_connectionGridUnits )
m_connectionGridSize( aFrame, m_connectionGridLabel, m_connectionGridCtrl,
m_connectionGridUnits )
{
wxSize minSize = m_dashLengthCtrl->GetMinSize();
int minWidth = m_dashLengthCtrl->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth();
@ -116,7 +117,8 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
ctrl->SetValue( EDA_UNIT_UTILS::UI::StringFromValue( unityScale, units, value ) )
SET_VALUE( m_textOffsetRatioCtrl, EDA_UNITS::PERCENT, settings.m_TextOffsetRatio * 100.0 );
SET_VALUE( m_overbarHeightCtrl, EDA_UNITS::PERCENT, settings.m_FontMetrics.m_OverbarHeight * 100.0 );
SET_VALUE( m_overbarHeightCtrl, EDA_UNITS::PERCENT,
settings.m_FontMetrics.m_OverbarHeight * 100.0 );
SET_VALUE( m_dashLengthCtrl, EDA_UNITS::UNSCALED, settings.m_DashedLineDashRatio );
SET_VALUE( m_gapLengthCtrl, EDA_UNITS::UNSCALED, settings.m_DashedLineGapRatio );
SET_VALUE( m_labelSizeRatioCtrl, EDA_UNITS::PERCENT, settings.m_LabelSizeRatio * 100.0 );
@ -168,11 +170,14 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
#define GET_VALUE( units, str ) EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, units, str )
settings.m_TextOffsetRatio = GET_VALUE( EDA_UNITS::PERCENT, m_textOffsetRatioCtrl->GetValue() ) / 100.0;
settings.m_FontMetrics.m_OverbarHeight = GET_VALUE( EDA_UNITS::PERCENT, m_overbarHeightCtrl->GetValue() ) / 100.0;
settings.m_TextOffsetRatio = GET_VALUE( EDA_UNITS::PERCENT,
m_textOffsetRatioCtrl->GetValue() ) / 100.0;
settings.m_FontMetrics.m_OverbarHeight = GET_VALUE( EDA_UNITS::PERCENT,
m_overbarHeightCtrl->GetValue() ) / 100.0;
settings.m_DashedLineDashRatio = GET_VALUE( EDA_UNITS::UNSCALED, m_dashLengthCtrl->GetValue() );
settings.m_DashedLineGapRatio = GET_VALUE( EDA_UNITS::UNSCALED, m_gapLengthCtrl->GetValue() );
settings.m_LabelSizeRatio = GET_VALUE( EDA_UNITS::PERCENT, m_labelSizeRatioCtrl->GetValue() ) / 100.0;
settings.m_LabelSizeRatio = GET_VALUE( EDA_UNITS::PERCENT,
m_labelSizeRatioCtrl->GetValue() ) / 100.0;
#undef GET_VALUE

View File

@ -64,6 +64,7 @@ PANEL_SETUP_PINMAP::PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* paren
reBuildMatrixPanel();
}
PANEL_SETUP_PINMAP::~PANEL_SETUP_PINMAP()
{
#ifndef __WXMAC__
@ -96,7 +97,8 @@ void PANEL_SETUP_PINMAP::OnMouseEnter( wxMouseEvent& aEvent )
wxBitmapButton* btn = static_cast<wxBitmapButton*>( aEvent.GetEventObject() );
m_btnBackground = btn->GetBackgroundColour();
btn->SetBackgroundColour( wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
btn->SetBackgroundColour(
wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
}
@ -112,7 +114,7 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
// Try to know the size of bitmap button used in drc matrix
wxBitmapButton* dummy =
new wxBitmapButton( m_matrixPanel, wxID_ANY, KiBitmapBundle( BITMAPS::ercerr ),
wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
wxDefaultPosition, wxDefaultSize, wxBORDER_NONE );
wxSize bitmapSize = dummy->GetSize();
delete dummy;
@ -191,13 +193,15 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
#else
if( m_initialized )
{
m_buttonList[ii][jj]->Unbind(wxEVT_ENTER_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this );
m_buttonList[ii][jj]->Unbind(wxEVT_LEAVE_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this );
m_buttonList[ii][jj]->Unbind( wxEVT_ENTER_WINDOW,
&PANEL_SETUP_PINMAP::OnMouseLeave, this );
m_buttonList[ii][jj]->Unbind( wxEVT_LEAVE_WINDOW,
&PANEL_SETUP_PINMAP::OnMouseLeave, this );
}
wxBitmapButton* btn =
new wxBitmapButton( m_matrixPanel, id, KiBitmapBundle( bitmap_butt ),
wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
wxPoint( x, y ), wxDefaultSize, wxBORDER_NONE );
btn->Bind( wxEVT_LEAVE_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this );
btn->Bind( wxEVT_ENTER_WINDOW, &PANEL_SETUP_PINMAP::OnMouseEnter, this );
#endif

View File

@ -38,13 +38,13 @@ PANEL_SIMULATOR_PREFERENCES::PANEL_SIMULATOR_PREFERENCES( wxWindow* aParent ) :
static const wxString verticalChoiceItems[] =
{
_("No action"),
_("Pan left/right"),
_("Pan right/left"),
_("Pan up/down"),
_("Zoom"),
_("Zoom horizontally"),
_("Zoom vertically")
_( "No action" ),
_( "Pan left/right" ),
_( "Pan right/left" ),
_( "Pan up/down" ),
_( "Zoom" ),
_( "Zoom horizontally" ),
_( "Zoom vertically" )
};
static constexpr auto ACTION_COUNT = static_cast<unsigned>( SIM_MOUSE_WHEEL_ACTION::COUNT );
@ -59,9 +59,9 @@ PANEL_SIMULATOR_PREFERENCES::PANEL_SIMULATOR_PREFERENCES( wxWindow* aParent ) :
static const wxString horizontalChoiceItems[] =
{
_("No action"),
_("Pan left/right"),
_("Zoom horizontally")
_( "No action" ),
_( "Pan left/right" ),
_( "Zoom horizontally" )
};
m_choiceHScroll->Set( std::extent<decltype(horizontalChoiceItems)>::value,
@ -137,6 +137,7 @@ PANEL_SIMULATOR_PREFERENCES::horizontalScrollSelectionToAction( int aSelection )
return SIM_MOUSE_WHEEL_ACTION::NONE;
}
int PANEL_SIMULATOR_PREFERENCES::actionToHorizontalScrollSelection( SIM_MOUSE_WHEEL_ACTION a )
{
switch( a )

View File

@ -35,11 +35,16 @@ PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( wxWindow* aWindow,
UNITS_PROVIDER* aUnitsProvider,
wxWindow* aEventSource ) :
PANEL_SYM_EDITING_OPTIONS_BASE( aWindow ),
m_lineWidth( aUnitsProvider, aEventSource, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
m_textSize( aUnitsProvider, aEventSource, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
m_pinLength( aUnitsProvider, aEventSource, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ),
m_pinNameSize( aUnitsProvider, aEventSource ,m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ),
m_pinNumberSize( aUnitsProvider, aEventSource, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits ),
m_lineWidth( aUnitsProvider, aEventSource, m_lineWidthLabel, m_lineWidthCtrl,
m_lineWidthUnits ),
m_textSize( aUnitsProvider, aEventSource, m_textSizeLabel, m_textSizeCtrl,
m_textSizeUnits ),
m_pinLength( aUnitsProvider, aEventSource, m_pinLengthLabel, m_pinLengthCtrl,
m_pinLengthUnits ),
m_pinNameSize( aUnitsProvider, aEventSource ,m_pinNameSizeLabel, m_pinNameSizeCtrl,
m_pinNameSizeUnits ),
m_pinNumberSize( aUnitsProvider, aEventSource, m_pinNumSizeLabel, m_pinNumSizeCtrl,
m_pinNumSizeUnits ),
m_pinPitch( aUnitsProvider, aEventSource, m_pinPitchLabel, m_pinPitchCtrl, m_pinPitchUnits )
{
m_widthHelpText->SetFont( KIUI::GetInfoFont( this ).Italic() );

View File

@ -63,10 +63,12 @@
*/
struct SUPPORTED_FILE_TYPE
{
wxString m_Description; ///< Description shown in the file picker dialog
wxString m_FileFilter; ///< Filter used for file pickers if m_IsFile is true
wxString m_FolderSearchExtension; ///< In case of folders it stands for extensions of files stored inside
bool m_IsFile; ///< Whether the library is a folder or a file
wxString m_Description; ///< Description shown in the file picker dialog.
wxString m_FileFilter; ///< Filter used for file pickers if m_IsFile is true.
/// In case of folders it stands for extensions of files stored inside.
wxString m_FolderSearchExtension;
bool m_IsFile; ///< Whether the library is a folder or a file.
SCH_IO_MGR::SCH_FILE_T m_Plugin;
};
@ -353,13 +355,15 @@ PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE( DIALOG_EDIT_LIBRARY_TABLES* aParent, P
setupGrid( m_global_grid );
m_global_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
m_global_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK,
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
if( m_projectTable )
{
m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_projectTable ), true );
setupGrid( m_project_grid );
m_project_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
m_project_grid->Bind( wxEVT_GRID_CELL_LEFT_CLICK,
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
}
else
{
@ -397,12 +401,14 @@ PANEL_SYM_LIB_TABLE::~PANEL_SYM_LIB_TABLE()
// Delete the GRID_TRICKS.
// Any additional event handlers should be popped before the window is deleted.
m_global_grid->PopEventHandler( true );
m_global_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
m_global_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK,
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
if( m_project_grid )
{
m_project_grid->PopEventHandler( true );
m_project_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK, &PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
m_project_grid->Unbind( wxEVT_GRID_CELL_LEFT_CLICK,
&PANEL_SYM_LIB_TABLE::onGridCellLeftClickHandler, this );
}
m_path_subs_grid->PopEventHandler( true );
@ -412,7 +418,7 @@ PANEL_SYM_LIB_TABLE::~PANEL_SYM_LIB_TABLE()
bool PANEL_SYM_LIB_TABLE::allowAutomaticPluginTypeSelection( wxString& aLibraryPath )
{
// When the plugin type depends only of the file extension, return true.
// if it needs to read the actual file (taht can be not available), return false
// if it needs to read the actual file (that can be not available), return false
wxFileName fn( aLibraryPath );
wxString ext = fn.GetExt().Lower();
@ -458,8 +464,9 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
wxYES_NO | wxCENTER | wxICON_QUESTION | wxYES_DEFAULT );
badCellDlg.SetExtendedMessage( _( "Empty cells will result in all rows that are "
"invalid to be removed from the table." ) );
badCellDlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Remove Invalid Cells" ) ),
wxMessageDialog::ButtonLabel( _( "Cancel Table Update" ) ) );
badCellDlg.SetYesNoLabels(
wxMessageDialog::ButtonLabel( _( "Remove Invalid Cells" ) ),
wxMessageDialog::ButtonLabel( _( "Cancel Table Update" ) ) );
wait.reset();
@ -501,7 +508,9 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
model->SetValue( r, COL_NICKNAME, nick );
if( allowAutomaticPluginTypeSelection( uri ) )
{
model->SetValue( r, COL_URI, uri );
}
else
{
wxString ltype = model->GetValue( r, COL_TYPE );
@ -520,11 +529,11 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
if( !model )
continue;
for( int r1 = 0; r1 < model->GetNumberRows() - 1; ++r1 )
for( int r1 = 0; r1 < model->GetNumberRows() - 1; ++r1 )
{
wxString nick1 = model->GetValue( r1, COL_NICKNAME );
for( int r2=r1+1; r2 < model->GetNumberRows(); ++r2 )
for( int r2 = r1 + 1; r2 < model->GetNumberRows(); ++r2 )
{
wxString nick2 = model->GetValue( r2, COL_NICKNAME );
@ -987,9 +996,11 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
}
wxString options = m_cur_grid->GetCellValue( row, COL_OPTIONS );
std::unique_ptr<std::map<std::string, UTF8>> props( LIB_TABLE::ParseOptions( options.ToStdString() ) );
std::unique_ptr<std::map<std::string, UTF8>> props(
LIB_TABLE::ParseOptions( options.ToStdString() ) );
if( SCH_IO_MGR::ConvertLibrary( props.get(), legacyLib.GetFullPath(), newLib.GetFullPath() ) )
if( SCH_IO_MGR::ConvertLibrary( props.get(),
legacyLib.GetFullPath(), newLib.GetFullPath() ) )
{
relPath = NormalizePath( newLib.GetFullPath(), &Pgm().GetLocalEnvVariables(),
m_project );
@ -1258,4 +1269,4 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent )
aKiway->ExpressMail( FRAME_SCH, MAIL_RELOAD_LIB, payload );
aKiway->ExpressMail( FRAME_SCH_SYMBOL_EDITOR, MAIL_RELOAD_LIB, payload );
aKiway->ExpressMail( FRAME_SCH_VIEWER, MAIL_RELOAD_LIB, payload );
}
}

View File

@ -96,7 +96,9 @@ private:
WX_GRID* m_cur_grid; ///< changed based on tab choice
static size_t m_pageNdx; ///< Remember the last notebook page selected
wxString m_lastProjectLibDir; //< Transient (unsaved) last browsed folder when adding a project level library
/// Transient (unsaved) last browsed folder when adding a project level library.
wxString m_lastProjectLibDir;
};

View File

@ -145,6 +145,7 @@ bool PANEL_TEMPLATE_FIELDNAMES::TransferDataToGrid()
for( int row = 0; row < m_grid->GetNumberRows(); ++row )
{
m_grid->SetCellValue( row, 0, m_fields[row].m_Name );
// columns 1 and 2 show a boolean value (in a check box):
m_grid->SetCellValue( row, 1, m_fields[row].m_Visible ? wxS( "1" ) : wxS( "0" ) );
m_grid->SetCellValue( row, 2, m_fields[row].m_URL ? wxS( "1" ) : wxS( "0" ) );