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

@ -214,7 +214,8 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching()
if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 ) if( equivItem.m_ComponentValue.CmpNoCase( component->GetValue() ) != 0 )
continue; 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; bool equ_is_unique = true;
unsigned next = idx+1; unsigned next = idx+1;

View File

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

View File

@ -44,6 +44,7 @@ DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR(
m_lineCount = 0; m_lineCount = 0;
} }
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add( const wxString& aRef, const wxString& aFpSchName, void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add( const wxString& aRef, const wxString& aFpSchName,
const wxString& aFpCmpName ) const wxString& aFpCmpName )
{ {
@ -57,6 +58,7 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::Add( const wxString& aRef, const wx
m_lineCount ++; m_lineCount ++;
} }
int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aReference ) int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aReference )
{ {
// Find Reference // Find Reference
@ -74,6 +76,7 @@ int DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::GetSelection( const wxString& aRefer
return -1; return -1;
} }
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event ) void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event )
{ {
// When clicking on the column title: // When clicking on the column title:
@ -106,6 +109,7 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event )
} }
} }
void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event ) void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnItemClicked( wxMouseEvent& event )
{ {
wxPoint pos = event.GetPosition(); wxPoint pos = event.GetPosition();

View File

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

View File

@ -312,7 +312,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
UpdateZoomSelectBox(); UpdateZoomSelectBox();
m_mainToolBar->AddControl( m_zoomSelectBox ); 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, m_mainToolBar->AddTool( ID_CVPCB_FPVIEWER_AUTOZOOM_TOOL, wxEmptyString,
KiScaledBitmap( BITMAPS::zoom_auto_fit_in_page, this ), KiScaledBitmap( BITMAPS::zoom_auto_fit_in_page, this ),
_( "Automatic Zoom on footprint change" ), _( "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 // See if the library requested is in the library table
if( !fpTable->HasLibrary( libNickname ) ) 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 ), libNickname ),
RPT_SEVERITY_ERROR ); RPT_SEVERITY_ERROR );
return nullptr; return nullptr;

View File

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

View File

@ -55,12 +55,12 @@ void ITEMS_LISTBOX_BASE::UpdateWidth( int aLine )
if( aLine < 0 ) if( aLine < 0 )
{ {
columnWidth = 0; columnWidth = 0;
for( int ii = 0; ii < itemCount; ii++ ) for( int ii = 0; ii < itemCount; ii++ )
{ {
UpdateLineWidth( (unsigned)ii, dc ); UpdateLineWidth( (unsigned)ii, dc );
} }
} }
// Zero or above: update from a single line. // Zero or above: update from a single line.
else else
{ {

View File

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

View File

@ -70,9 +70,11 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
wxString msg_bold = _( "Footprint Filters:" ); wxString msg_bold = _( "Footprint Filters:" );
wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold ); wxStaticText* text = new wxStaticText( m_mainToolBar, wxID_ANY, msg_bold );
text->SetFont( m_mainToolBar->GetFont().Bold() ); text->SetFont( m_mainToolBar->GetFont().Bold() );
#ifdef __WXGTK3__ #ifdef __WXGTK3__
text->SetLabelMarkup( "<b>" + msg_bold + "</b>" ); text->SetLabelMarkup( "<b>" + msg_bold + "</b>" );
#endif #endif
m_mainToolBar->AddControl( text ); m_mainToolBar->AddControl( text );
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyFPFilters, ACTION_TOOLBAR::TOGGLE ); 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' ) .DefaultHotkey( MD_CTRL + 'S' )
.LegacyHotkeyName( "Save" ) .LegacyHotkeyName( "Save" )
.FriendlyName( _( "Save to Schematic and File" ) ) .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 ) ); .Icon( BITMAPS::save ) );
// Actions to navigate the display // Actions to navigate the display
@ -145,7 +146,6 @@ TOOL_ACTION CVPCB_ACTIONS::deleteAll( TOOL_ACTION_ARGS()
.FriendlyName( _( "Delete All Footprint Assignments" ) ) .FriendlyName( _( "Delete All Footprint Assignments" ) )
.Icon( BITMAPS::delete_association ) ); .Icon( BITMAPS::delete_association ) );
// Actions to filter the footprint list // Actions to filter the footprint list
TOOL_ACTION CVPCB_ACTIONS::FilterFPbyFPFilters( TOOL_ACTION_ARGS() TOOL_ACTION CVPCB_ACTIONS::FilterFPbyFPFilters( TOOL_ACTION_ARGS()
.Name( "cvpcb.Control.FilterFPbyFPFilters" ) .Name( "cvpcb.Control.FilterFPbyFPFilters" )

View File

@ -27,9 +27,7 @@
/** /**
* CVPCB_CONTROL * Handles action in main CvPcb window.
*
* Handles actions in main cvpcb window.
*/ */
class CVPCB_ASSOCIATION_TOOL : public TOOL_INTERACTIVE class CVPCB_ASSOCIATION_TOOL : public TOOL_INTERACTIVE
@ -44,68 +42,68 @@ public:
/** /**
* Undo the footprint associations most recently done. * 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 ); int Undo( const TOOL_EVENT& aEvent );
/** /**
* Redo the footprint associations most recently done. * 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 ); int Redo( const TOOL_EVENT& aEvent );
/** /**
* Associate the selected footprint with the currently selected components. * 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 ); int Associate( const TOOL_EVENT& aEvent );
/** /**
* Perform automatic footprint association. * 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 ); int AutoAssociate( const TOOL_EVENT& aEvent );
/** /**
* Delete all associations. * 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 ); int DeleteAll( const TOOL_EVENT& aEvent );
/** /**
* Delete the selected associations. * 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 ); int DeleteAssoc( const TOOL_EVENT& aEvent );
/** /**
* Copy the selected associations to the clipboard. * 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 ); int CopyAssoc( const TOOL_EVENT& aEvent );
/** /**
* Cut the selected associations to the clipboard. * 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 ); int CutAssoc( const TOOL_EVENT& aEvent );
/** /**
* Paste the clipboard onto the current selection. * 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 ); int PasteAssoc( const TOOL_EVENT& aEvent );
/* /**
* Sets up handlers for various events. * Set up handlers for various events.
*/ */
void setTransitions() override; 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, fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player( FRAME_CVPCB_DISPLAY, true,
m_frame ); 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 // frame is null
if( !fpframe ) if( !fpframe )
return 0; 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>(); 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> naComp =
std::vector<unsigned int> tempSel = m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS ); m_frame->GetComponentIndices( CVPCB_MAINFRAME::NA_COMPONENTS );
std::vector<unsigned int> tempSel =
m_frame->GetComponentIndices( CVPCB_MAINFRAME::SEL_COMPONENTS );
// No unassociated components // No unassociated components
if( naComp.empty() ) if( naComp.empty() )
@ -341,7 +343,8 @@ void CVPCB_CONTROL::setTransitions()
// Management actions // Management actions
Go( &CVPCB_CONTROL::ShowEquFileTable, CVPCB_ACTIONS::showEquFileTable.MakeEvent() ); 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() ); Go( &CVPCB_CONTROL::SaveAssociationsToFile,CVPCB_ACTIONS::saveAssociationsToFile.MakeEvent() );
// Navigation actions // 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 class CVPCB_CONTROL : public TOOL_INTERACTIVE
@ -42,45 +40,45 @@ public:
void Reset( RESET_REASON aReason ) override; 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. * 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 ); 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 ); int ChangeFocus( const TOOL_EVENT& aEvent );
/** /**
* Move the selected component to the not associated one in the specified direction. * 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 ); 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 ); int ShowEquFileTable( const TOOL_EVENT& aEvent );
/** /**
* Save the associations to the schematic. * 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 ); int SaveAssociationsToSchematic( const TOOL_EVENT& aEvent );
/** /**
* Save the associations to the schematic and save schematic to file. * 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 ); int SaveAssociationsToFile( const TOOL_EVENT& aEvent );
@ -88,28 +86,29 @@ public:
* Create or Update the frame showing the current highlighted footprint * Create or Update the frame showing the current highlighted footprint
* and (if showed) the 3D display frame. * 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 ); int ShowFootprintViewer( const TOOL_EVENT& aEvent );
/** /**
* Filter the footprint list by toggling the given filter type. * 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 * The event parameter corresponds to the filter type (using the FP_FILTER_T from the
* FOOTPRINTS_LISTBOX class) * 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 ); int ToggleFootprintFilter( const TOOL_EVENT& aEvent );
/** /**
* Update the menu to reflect the current tool states. * 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 ); int UpdateMenu( const TOOL_EVENT& aEvent );
/* /**
* Sets up handlers for various events. * Set up handlers for various events.
*/ */
void setTransitions() override; void setTransitions() override;

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 class CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL : public TOOL_INTERACTIVE
{ {
@ -61,11 +61,11 @@ public:
/** /**
* Update the menu to reflect the current tool states. * 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 ); int UpdateMenu( const TOOL_EVENT& aEvent );
///< Sets up handlers for various events. /// Set up handlers for various events.
void setTransitions() override; void setTransitions() override;
private: private:

View File

@ -56,6 +56,7 @@ bool API_HANDLER_SCH::validateDocumentInternal( const DocumentSpecifier& aDocume
// TODO(JE) need serdes for SCH_SHEET_PATH <> SheetPath // TODO(JE) need serdes for SCH_SHEET_PATH <> SheetPath
return true; return true;
//wxString currentPath = m_frame->GetCurrentSheet().PathAsString(); //wxString currentPath = m_frame->GetCurrentSheet().PathAsString();
//return 0 == aDocument.sheet_path().compare( currentPath.ToStdString() ); //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 ) if( aCtx.Request.type() != DocumentType::DOCTYPE_SCHEMATIC )
{ {
ApiResponseStatus e; ApiResponseStatus e;
// No message needed for AS_UNHANDLED; this is an internal flag for the API server // No message needed for AS_UNHANDLED; this is an internal flag for the API server
e.set_status( ApiStatusCode::AS_UNHANDLED ); e.set_status( ApiStatusCode::AS_UNHANDLED );
return tl::unexpected( e ); return tl::unexpected( e );
@ -108,7 +110,8 @@ HANDLER_RESULT<std::unique_ptr<EDA_ITEM>> API_HANDLER_SCH::createItemForType( KI
{ {
ApiResponseStatus e; ApiResponseStatus e;
e.set_status( ApiStatusCode::AS_BAD_REQUEST ); 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() ) ); aContainer->GetFriendlyName().ToStdString() ) );
return tl::unexpected( e ); return tl::unexpected( e );
} }

View File

@ -296,7 +296,8 @@ int DIALOG_ANNOTATE::GetStartNumber()
void SCH_EDIT_FRAME::OnAnnotate() 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 ) if( !dlg )
{ {

View File

@ -294,7 +294,8 @@ void DIALOG_BOM::OnRunGenerator( wxCommandEvent& event )
bool status = false; bool status = false;
if( m_parent->ReadyToNetlist( _( "Generating BOM requires a fully annotated schematic." ) ) ) 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 ) if( !status )
DisplayErrorMessage( this, _( "Failed to create file." ) ); DisplayErrorMessage( this, _( "Failed to create file." ) );

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_newId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
m_specifiedReference->ChangeValue( m_symbol->GetRef( currentSheet ) ); 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() ) ); m_specifiedId->ChangeValue( UnescapeString( m_symbol->GetLibId().Format() ) );
} }
else else
@ -568,7 +569,7 @@ int DIALOG_CHANGE_SYMBOLS::processSymbols( SCH_COMMIT* aCommit,
std::map<SCH_SYMBOL*, SYMBOL_CHANGE_INFO>::iterator it = symbols.begin(); 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 // 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() ) while( it != symbols.end() )
{ {
SCH_SYMBOL* symbol = it->first; 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 // 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 // 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 // we replace references in the graph to the old symbol/pins with references to the ones
// in the undo stack. // stored in the undo stack.
if( connectionGraph ) if( connectionGraph )
connectionGraph->ExchangeItem( symbol, symbol_copy ); connectionGraph->ExchangeItem( symbol, symbol_copy );
} }

View File

@ -77,7 +77,7 @@ protected:
checkAll( false ); checkAll( false );
} }
///< Select or deselect all fields in the listbox widget /// Select or deselect all fields in the listbox widget.
void checkAll( bool aCheck ); void checkAll( bool aCheck );
private: private:
@ -93,7 +93,7 @@ private:
SCH_SYMBOL* m_symbol; SCH_SYMBOL* m_symbol;
MODE m_mode; 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; 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 // Typical assignment operator does not work here because of the ordered_map
auto source = m_designBlock->GetFields(); auto source = m_designBlock->GetFields();
m_fields.clear(); m_fields.clear();
for( const auto& field : source ) for( const auto& field : source )
{ {
m_fields[field.first] = field.second; m_fields[field.first] = field.second;

View File

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

View File

@ -26,7 +26,8 @@
#include <schematic.h> #include <schematic.h>
#include <eeschema_settings.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 ) : VECTOR2I aMaxUserSizeMils ) :
DIALOG_PAGES_SETTINGS( aParent, aEmbeddedFiles, schIUScale.IU_PER_MILS, 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 */ ); wxCHECK( cfg, /* void */ );
cfg->m_PageSettings.export_paper = m_PaperExport->GetValue(); 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_TextRevision->GetValue().IsEmpty() )
if ( !m_TextTitle->GetValue().IsEmpty() ) cfg->m_PageSettings.export_title = m_TitleExport->GetValue(); cfg->m_PageSettings.export_revision = m_RevisionExport->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_TextDate->GetValue().IsEmpty() )
if ( !m_TextComment2->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment2 = m_Comment2Export->GetValue(); cfg->m_PageSettings.export_date = m_DateExport->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_TextTitle->GetValue().IsEmpty() )
if ( !m_TextComment5->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment5 = m_Comment5Export->GetValue(); cfg->m_PageSettings.export_title = m_TitleExport->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_TextCompany->GetValue().IsEmpty() )
if ( !m_TextComment8->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment8 = m_Comment8Export->GetValue(); cfg->m_PageSettings.export_company = m_CompanyExport->GetValue();
if ( !m_TextComment9->GetValue().IsEmpty() ) cfg->m_PageSettings.export_comment9 = m_Comment9Export->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 */ ); wxCHECK( cfg, /* void */ );
m_PaperExport->SetValue( cfg->m_PageSettings.export_paper ); m_PaperExport->SetValue( cfg->m_PageSettings.export_paper );
m_RevisionExport->SetValue( m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision ); m_RevisionExport->SetValue(
m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_date ); m_TextRevision->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_revision );
m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_title ); m_DateExport->SetValue( m_TextDate->GetValue().IsEmpty() ? false
m_CompanyExport->SetValue( m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company ); : cfg->m_PageSettings.export_date );
m_Comment1Export->SetValue( m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 ); m_TitleExport->SetValue( m_TextTitle->GetValue().IsEmpty() ? false
m_Comment2Export->SetValue( m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 ); : cfg->m_PageSettings.export_title );
m_Comment3Export->SetValue( m_TextComment3->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment3 ); m_CompanyExport->SetValue(
m_Comment4Export->SetValue( m_TextComment4->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment4 ); m_TextCompany->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_company );
m_Comment5Export->SetValue( m_TextComment5->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment5 ); m_Comment1Export->SetValue(
m_Comment6Export->SetValue( m_TextComment6->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment6 ); m_TextComment1->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment1 );
m_Comment7Export->SetValue( m_TextComment7->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment7 ); m_Comment2Export->SetValue(
m_Comment8Export->SetValue( m_TextComment8->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment8 ); m_TextComment2->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment2 );
m_Comment9Export->SetValue( m_TextComment9->GetValue().IsEmpty() ? false : cfg->m_PageSettings.export_comment9 ); 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 class DIALOG_EESCHEMA_PAGE_SETTINGS : public DIALOG_PAGES_SETTINGS
{ {
public: 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(); virtual ~DIALOG_EESCHEMA_PAGE_SETTINGS();
private: private:

View File

@ -58,7 +58,7 @@
wxDEFINE_EVENT( EDA_EVT_CLOSE_ERC_DIALOG, wxCommandEvent ); 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). // not, in repeatedly creating/destroying a wxDC to do the measurement in).
// Use default column widths instead. // Use default column widths instead.
static int DEFAULT_SINGLE_COL_WIDTH = 660; static int DEFAULT_SINGLE_COL_WIDTH = 660;
@ -451,6 +451,7 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
itemsNotAnnotated ), RPT_SEVERITY_INFO ); itemsNotAnnotated ), RPT_SEVERITY_INFO );
if( m_cancelled ) if( m_cancelled )
// @spellingerror
m_messages->Report( _( "-------- ERC cancelled by user.<br><br>" ), RPT_SEVERITY_INFO ); m_messages->Report( _( "-------- ERC cancelled by user.<br><br>" ), RPT_SEVERITY_INFO );
else else
m_messages->Report( _( "Done.<br><br>" ), RPT_SEVERITY_INFO ); m_messages->Report( _( "Done.<br><br>" ), RPT_SEVERITY_INFO );
@ -468,6 +469,7 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
if( !m_cancelled ) if( !m_cancelled )
{ {
m_sdbSizer1Cancel->SetDefault(); m_sdbSizer1Cancel->SetDefault();
// wxWidgets has a tendency to keep both buttons highlighted without the following: // wxWidgets has a tendency to keep both buttons highlighted without the following:
m_sdbSizer1OK->Enable( false ); m_sdbSizer1OK->Enable( false );
@ -683,7 +685,8 @@ void DIALOG_ERC::OnERCItemRClick( wxDataViewEvent& aEvent )
menu.Append( ID_SET_SEVERITY_TO_WARNING, menu.Append( ID_SET_SEVERITY_TO_WARNING,
wxString::Format( _( "Change severity to Warning for all '%s' violations" ), wxString::Format( _( "Change severity to Warning for all '%s' violations" ),
rcItem->GetErrorText() ), 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, menu.Append( ID_SET_SEVERITY_TO_IGNORE,

View File

@ -105,6 +105,7 @@ public:
const wxString GetPageNetFmtName() { return m_pageNetFmtName; } const wxString GetPageNetFmtName() { return m_pageNetFmtName; }
NETLIST_TYPE_ID m_IdNetType; NETLIST_TYPE_ID m_IdNetType;
// opt to reformat passive component values (e.g. 1M -> 1Meg): // opt to reformat passive component values (e.g. 1M -> 1Meg):
wxCheckBox* m_CurSheetAsRoot; wxCheckBox* m_CurSheetAsRoot;
wxCheckBox* m_SaveAllVoltages; wxCheckBox* m_SaveAllVoltages;
@ -139,8 +140,8 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private: private:
/* /**
* Browse plugin files, and set m_CommandStringCtrl field * Browse plugin files, and set m_CommandStringCtrl field.
*/ */
void OnBrowseGenerators( wxCommandEvent& event ) override; 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_isSheetFilename = true;
m_fieldId = SHEETFILENAME_V; m_fieldId = SHEETFILENAME_V;
m_note->SetLabel( wxString::Format( m_note->GetLabel(), 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 ); m_note->Show( true );
break; break;
@ -699,7 +700,7 @@ void DIALOG_FIELD_PROPERTIES::UpdateField( SCH_COMMIT* aCommit, SCH_FIELD* aFiel
if( positioningModified && parent ) if( positioningModified && parent )
parent->SetFieldsAutoplaced( AUTOPLACE_NONE ); parent->SetFieldsAutoplaced( AUTOPLACE_NONE );
//Update the hierarchy navigator labels if needed // Update the hierarchy navigator labels if needed.
if( needUpdateHierNav ) if( needUpdateHierNav )
editFrame->UpdateLabelsHierarchyNavigator(); editFrame->UpdateLabelsHierarchyNavigator();
} }

View File

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

View File

@ -41,7 +41,8 @@
#include <sch_commit.h> #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 ), DIALOG_LABEL_PROPERTIES_BASE( aParent ),
m_Parent( aParent ), m_Parent( aParent ),
m_currentLabel( aLabel ), 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_fontCtrl );
m_formattingGB->Detach( m_iconBar ); 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 else
{ {
@ -285,7 +287,8 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
// Ensure the symbol has the Power (i.e. equivalent to a global label // Ensure the symbol has the Power (i.e. equivalent to a global label
// before adding its value in list // before adding its value in list
if( power->IsSymbolLikePowerGlobalLabel() ) 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 ) void DIALOG_LABEL_PROPERTIES::OnEnterKey( wxCommandEvent& aEvent )
{ {
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) ); wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
@ -527,15 +527,24 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
if( m_shapeSizer->AreAnyItemsShown() ) if( m_shapeSizer->AreAnyItemsShown() )
{ {
if( m_bidirectional->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_BIDI ); if( m_bidirectional->GetValue() )
else if( m_input->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_INPUT ); m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_BIDI );
else if( m_output->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT ); else if( m_input->GetValue() )
else if( m_triState->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_TRISTATE ); m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_INPUT );
else if( m_passive->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_UNSPECIFIED ); else if( m_output->GetValue() )
else if( m_dot->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_DOT ); m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_OUTPUT );
else if( m_circle->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_ROUND ); else if( m_triState->GetValue() )
else if( m_diamond->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_DIAMOND ); m_currentLabel->SetShape( LABEL_FLAG_SHAPE::L_TRISTATE );
else if( m_rectangle->GetValue() ) m_currentLabel->SetShape( LABEL_FLAG_SHAPE::F_RECTANGLE ); 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() ) if( m_fontCtrl->HaveFontSelection() )
@ -547,7 +556,8 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T ) if( m_currentLabel->Type() == SCH_DIRECTIVE_LABEL_T )
static_cast<SCH_DIRECTIVE_LABEL*>( m_currentLabel )->SetPinLength( m_textSize.GetIntValue() ); static_cast<SCH_DIRECTIVE_LABEL*>( m_currentLabel )->SetPinLength( m_textSize.GetIntValue() );
else if( m_currentLabel->GetTextWidth() != 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() // Must come after SetTextSize()
m_currentLabel->SetBold( m_bold->IsChecked() ); m_currentLabel->SetBold( m_bold->IsChecked() );

View File

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

View File

@ -224,6 +224,7 @@ public:
val = LIB_SYMBOL::LetterSubReference( pin->GetUnit(), 'A' ); val = LIB_SYMBOL::LetterSubReference( pin->GetUnit(), 'A' );
else else
val = UNITS_ALL; val = UNITS_ALL;
break; break;
case COL_DEMORGAN: case COL_DEMORGAN:
@ -250,6 +251,7 @@ public:
{ {
if( fieldValue.length() ) if( fieldValue.length() )
fieldValue += wxT( ", " ); fieldValue += wxT( ", " );
fieldValue += val; fieldValue += val;
} }
else else
@ -329,7 +331,8 @@ public:
VECTOR2I pos = last->GetPosition(); VECTOR2I pos = last->GetPosition();
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); 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 if( last->GetOrientation() == PIN_ORIENTATION::PIN_LEFT
|| last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT ) || last->GetOrientation() == PIN_ORIENTATION::PIN_RIGHT )
@ -390,7 +393,8 @@ public:
case COL_ORIENTATION: case COL_ORIENTATION:
if( PinOrientationNames().Index( value ) != wxNOT_FOUND ) if( PinOrientationNames().Index( value ) != wxNOT_FOUND )
pin->SetOrientation( PinOrientationCode( PinOrientationNames().Index( value ) ) ); pin->SetOrientation(
PinOrientationCode( PinOrientationNames().Index( value ) ) );
break; break;
case COL_NUMBER_SIZE: case COL_NUMBER_SIZE:
@ -435,6 +439,7 @@ public:
} }
} }
} }
break; break;
case COL_DEMORGAN: case COL_DEMORGAN:
@ -1011,7 +1016,8 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnDeleteRow( wxCommandEvent& event )
if( curRow < 0 ) if( curRow < 0 )
return; 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 ); int nextSelRow = std::max( curRow-1, 0 );
m_grid->GoToCell( nextSelRow, m_grid->GetGridCursorCol() ); m_grid->GoToCell( nextSelRow, m_grid->GetGridCursorCol() );
m_grid->SetGridCursor( 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 // The Number and Name columns must be at least wide enough to hold their contents, but
// no less wide than their original widths. // no less wide than their original widths.
m_grid->AutoSizeColumn( COL_NUMBER ); m_grid->AutoSizeColumn( COL_NUMBER );
if( m_grid->GetColSize( COL_NUMBER ) < m_originalColWidths[ 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 // If the grid is still wider than the columns, then stretch the Number and Name columns
// to fit. // to fit.
for( int i = 0; i < COL_COUNT; ++i ) for( int i = 0; i < COL_COUNT; ++i )
width -= m_grid->GetColSize( 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 ); m_grid->ShowHideColumns( cfg->m_EditSymbolVisibleColumns );
wxGridCellAttr* attr = new wxGridCellAttr; 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_grid->SetAttr( DATASHEET_FIELD, FDC_VALUE, attr );
m_SymbolNameCtrl->SetValidator( FIELD_VALIDATOR( VALUE_FIELD ) ); 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 ); 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, m_FootprintFilterListBox->Bind( EDA_EVT_LISTBOX_CHANGED,
[&]( wxCommandEvent& aEvent ) [&]( wxCommandEvent& aEvent )
{ {
@ -802,7 +803,6 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnAddFootprintFilter( wxCommandEvent& event )
filterLine.Replace( wxT( " " ), wxT( "_" ) ); filterLine.Replace( wxT( " " ), wxT( "_" ) );
// duplicate filters do no harm, so don't be a nanny. // duplicate filters do no harm, so don't be a nanny.
m_FootprintFilterListBox->Append( filterLine ); m_FootprintFilterListBox->Append( filterLine );
m_FootprintFilterListBox->SetSelection( (int) m_FootprintFilterListBox->GetCount() - 1 ); 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 ), DIALOG_PIN_PROPERTIES_BASE( parent ),
m_frame( parent ), m_frame( parent ),
m_pin( aPin ), m_pin( aPin ),
@ -173,8 +174,10 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN
m_sdbSizerButtonsCancel m_sdbSizerButtonsCancel
}; };
// Default alternates turndown to whether or not alternates exist, or if we've had it open before // Default alternates turndown to whether or not alternates exist, or if we've had it open
m_alternatesTurndown->Collapse( m_pin->GetAlternates().size() == 0 && !s_alternatesTurndownOpen); // 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 // wxwidgets doesn't call the OnCollapseChange even at init, so we update this value if
// the alternates pane defaults to open // the alternates pane defaults to open
@ -268,7 +271,8 @@ bool DIALOG_PIN_PROPERTIES::TransferDataToWindow()
m_numberSize.SetValue( m_pin->GetNumberTextSize() ); m_numberSize.SetValue( m_pin->GetNumberTextSize() );
m_pinLength.SetValue( m_pin->GetLength() ); m_pinLength.SetValue( m_pin->GetLength() );
m_checkApplyToAllParts->Enable( m_pin->GetParentSymbol()->IsMulti() ); 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_checkApplyToAllBodyStyles->SetValue( m_pin->GetBodyStyle() == 0 );
m_checkShow->SetValue( m_pin->IsVisible() ); m_checkShow->SetValue( m_pin->IsVisible() );
@ -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 ) void DIALOG_PIN_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
{ {
wxPaintDC dc( m_panelShowPin ); wxPaintDC dc( m_panelShowPin );
@ -437,6 +438,7 @@ void DIALOG_PIN_PROPERTIES::OnPropertiesChange( wxCommandEvent& event )
m_panelShowPin->Refresh(); m_panelShowPin->Refresh();
} }
wxString DIALOG_PIN_PROPERTIES::getSyncPinsMessage() wxString DIALOG_PIN_PROPERTIES::getSyncPinsMessage()
{ {
if( m_checkApplyToAllParts->GetValue() ) if( m_checkApplyToAllParts->GetValue() )
@ -538,6 +540,8 @@ void DIALOG_PIN_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
m_delayedFocusColumn = -1; m_delayedFocusColumn = -1;
} }
} }
void DIALOG_PIN_PROPERTIES::OnCollapsiblePaneChange( wxCollapsiblePaneEvent& event ) void DIALOG_PIN_PROPERTIES::OnCollapsiblePaneChange( wxCollapsiblePaneEvent& event )
{ {
if( !event.GetCollapsed() ) if( !event.GetCollapsed() )

View File

@ -59,6 +59,9 @@ public:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
/**
* Draw (on m_panelShowPin) the pin according to current settings in dialog.
*/
void OnPaintShowPanel( wxPaintEvent& event ) override; void OnPaintShowPanel( wxPaintEvent& event ) override;
void OnPropertiesChange( wxCommandEvent& event ) override; void OnPropertiesChange( wxCommandEvent& event ) override;
void OnAddAlternate( 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 // Set the default line width (pen width which should be used for
// items that do not have a pen size defined (like frame ref) // items that do not have a pen size defined (like frame ref)
// the default line width is stored in mils in config // 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 // Initialize HPGL specific widgets
@ -445,6 +446,7 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
m_job->m_blackAndWhite = !getModeColor(); m_job->m_blackAndWhite = !getModeColor();
m_job->m_useBackgroundColor = m_plotBackgroundColor->GetValue(); m_job->m_useBackgroundColor = m_plotBackgroundColor->GetValue();
m_job->m_HPGLPenSize = m_penWidth.GetDoubleValue(); 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_pageSizeSelect = static_cast<JOB_PAGE_SIZE>( m_pageSizeSelect );
m_job->m_PDFPropertyPopups = m_plotPDFPropertyPopups->GetValue(); m_job->m_PDFPropertyPopups = m_plotPDFPropertyPopups->GetValue();

View File

@ -35,7 +35,8 @@
wxString DIALOG_SCH_IMPORT_SETTINGS::m_filePath; // remember for session 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 ), DIALOG_SCH_IMPORT_SETTINGS_BASE( aParent ),
m_frame( aFrame ) 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, m_borderColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch,
this ); this );
m_customColorSwatch->Unbind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch, m_customColorSwatch->Unbind( COLOR_SWATCH_CHANGED,
&DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch,
this ); this );
} }

View File

@ -441,6 +441,7 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
wxString msg; wxString msg;
wxFileName sheetFileName( EnsureFileExtension( aNewFilename, wxFileName sheetFileName( EnsureFileExtension( aNewFilename,
FILEEXT::KiCadSchematicFileExtension ) ); FILEEXT::KiCadSchematicFileExtension ) );
// Sheet file names are relative to the path of the current sheet. This allows for // 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. // nesting of schematic files in subfolders. Screen file names are always absolute.
SCHEMATIC& schematic = m_frame->Schematic(); 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_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; return false;
if( useScreen || loadFromFile ) // Load from existing file. if( useScreen || loadFromFile ) // Load from existing file.
@ -508,7 +510,8 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
return false; 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() ) else if( m_sourceSheetFilename && !m_sourceSheetFilename->IsEmpty() )
{ {
loadFromFile = true; loadFromFile = true;
@ -532,7 +535,8 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
{ {
isExistingSheet = true; isExistingSheet = true;
if( !m_frame->AllowCaseSensitiveFileNameClashes( m_sheet->GetFileName(), newAbsoluteFilename ) ) if( !m_frame->AllowCaseSensitiveFileNameClashes( m_sheet->GetFileName(),
newAbsoluteFilename ) )
return false; return false;
// We are always using here a case insensitive comparison to avoid issues // 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(); SetupStandardButtons();
} }
bool DIALOG_SIM_COMMAND::TransferDataToWindow() bool DIALOG_SIM_COMMAND::TransferDataToWindow()
{ {
/// @todo one day it could interpret the sim command and fill out appropriate fields. /// @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 ) if( m_inputSignalsFilter->IsSearchButtonVisible() && pos.x < buttonWidth )
SetCursor( wxCURSOR_ARROW ); 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 ); SetCursor( wxCURSOR_ARROW );
else else
SetCursor( wxCURSOR_IBEAM ); SetCursor( wxCURSOR_IBEAM );

View File

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

View File

@ -259,7 +259,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) ) if( m_modelListBoxEntryToLibraryIdx.contains( sel ) )
idx = m_modelListBoxEntryToLibraryIdx.at( 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 ) if( ibismodel )
{ {
@ -269,7 +270,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataToWindow()
for( const std::pair<std::string, std::string>& strs : ibismodel->GetIbisPins() ) 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() ); auto ibisLibrary = static_cast<const SIM_LIBRARY_IBIS*>( library() );
@ -386,7 +388,8 @@ bool DIALOG_SIM_MODEL<T>::TransferDataFromWindow()
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) ) if( m_modelListBoxEntryToLibraryIdx.contains( sel ) )
idx = m_modelListBoxEntryToLibraryIdx.at( 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 ) if( ibismodel )
{ {
@ -570,7 +573,8 @@ void DIALOG_SIM_MODEL<T>::updateBuiltinModelWidgets( SIM_MODEL* aModel )
m_deviceSubtypeChoice->Append( SIM_MODEL::TypeInfo( type ).description ); m_deviceSubtypeChoice->Append( SIM_MODEL::TypeInfo( type ).description );
if( type == aModel->GetType() ) 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(); wxString sel = m_modelListBox->GetStringSelection();
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) ) 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 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 ) ); 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 ); 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' ); wxArrayString lines = wxSplit( fallback->GetSpiceCode(), '\n' );
wxString code; wxString code;
@ -1431,9 +1439,11 @@ void DIALOG_SIM_MODEL<T>::onPinModelCombobox( wxCommandEvent& aEvent )
template <typename T> template <typename T>
void DIALOG_SIM_MODEL<T>::onPinModelComboboxTextEnter( wxCommandEvent& aEvent ) 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> template <typename T>
void DIALOG_SIM_MODEL<T>::onDifferentialCheckbox( wxCommandEvent& aEvent ) 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() ) 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 ); m_curModelType = m_curModelTypeOfDeviceType.at( deviceType );
break; break;
@ -1485,13 +1496,15 @@ void DIALOG_SIM_MODEL<T>::onWaveformChoice( wxCommandEvent& aEvent )
if( m_modelListBoxEntryToLibraryIdx.contains( sel ) ) if( m_modelListBoxEntryToLibraryIdx.contains( sel ) )
idx = m_modelListBoxEntryToLibraryIdx.at( 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 ) ); m_libraryModelsMgr.SetModel( idx, std::make_unique<SIM_MODEL_IBIS>( type, baseModel ) );
try 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 ) catch( IO_ERROR& err )
{ {
@ -1708,7 +1721,8 @@ void DIALOG_SIM_MODEL<T>::adjustParamGridColumns( int aWidth, bool aForce )
if( ii == PARAM_COLUMN::DESCRIPTION ) if( ii == PARAM_COLUMN::DESCRIPTION )
colWidths.push_back( grid->GetState()->GetColumnWidth( ii ) + margin + indent ); colWidths.push_back( grid->GetState()->GetColumnWidth( ii ) + margin + indent );
else if( ii == PARAM_COLUMN::VALUE ) 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 else
colWidths.push_back( 60 + margin ); 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<SCH_SYMBOL>;
template class DIALOG_SIM_MODEL<LIB_SYMBOL>; template class DIALOG_SIM_MODEL<LIB_SYMBOL>;

View File

@ -135,7 +135,7 @@ private:
std::map<wxString, int> m_modelListBoxEntryToLibraryIdx; 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; std::map<SIM_MODEL::DEVICE_T, SIM_MODEL::TYPE> m_curModelTypeOfDeviceType;
SIM_MODEL::TYPE m_curModelType; SIM_MODEL::TYPE m_curModelType;

View File

@ -113,7 +113,8 @@ protected:
// pick a footprint using the footprint picker. // pick a footprint using the footprint picker.
wxString fpid = m_grid->GetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD ); 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 ) ) if( frame->ShowModal( &fpid, m_dlg ) )
m_grid->SetCellValue( m_grid->GetGridCursorRow(), FOOTPRINT_FIELD, fpid ); 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, m_grid->Connect( wxEVT_GRID_COL_MOVE,
wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColMove ), nullptr, this ); wxGridEventHandler( DIALOG_SYMBOL_FIELDS_TABLE::OnColMove ), nullptr, this );
m_cbBomPresets->Bind( wxEVT_CHOICE, &DIALOG_SYMBOL_FIELDS_TABLE::onBomPresetChanged, 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, m_fieldsCtrl->Bind( wxEVT_DATAVIEW_ITEM_VALUE_CHANGED,
&DIALOG_SYMBOL_FIELDS_TABLE::OnColLabelChange, this ); &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 // sync m_grid's column visibilities to Show checkboxes in m_fieldsCtrl
for( int i = 0; i < m_fieldsCtrl->GetItemCount(); ++i ) 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 ) if( col == -1 )
continue; continue;
@ -617,7 +620,7 @@ bool DIALOG_SYMBOL_FIELDS_TABLE::TransferDataFromWindow()
if( m_job ) 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; return true;
} }
@ -797,8 +800,9 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRemoveField( wxCommandEvent& event )
m_fieldsCtrl->DeleteItem( row ); m_fieldsCtrl->DeleteItem( row );
m_dataModel->RemoveColumn( col ); m_dataModel->RemoveColumn( col );
// Make selection and update the state of "Remove field..." button via OnFieldsCtrlSelectionChanged() // Make selection and update the state of "Remove field..." button via
// Safe to decrement row index because we always have mandatory fields // OnFieldsCtrlSelectionChanged().
// Safe to decrement row index because we always have mandatory fields.
m_fieldsCtrl->SelectRow( --row ); m_fieldsCtrl->SelectRow( --row );
if( row < MANDATORY_FIELDS ) if( row < MANDATORY_FIELDS )
@ -902,6 +906,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnFieldsCtrlSelectionChanged( wxDataViewEvent&
} }
} }
void DIALOG_SYMBOL_FIELDS_TABLE::OnColumnItemToggled( wxDataViewEvent& event ) void DIALOG_SYMBOL_FIELDS_TABLE::OnColumnItemToggled( wxDataViewEvent& event )
{ {
wxDataViewItem item = event.GetItem(); wxDataViewItem item = event.GetItem();
@ -1085,6 +1090,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnColLabelChange( wxDataViewEvent& aEvent )
m_grid->ForceRefresh(); m_grid->ForceRefresh();
} }
void DIALOG_SYMBOL_FIELDS_TABLE::OnTableValueChanged( wxGridEvent& aEvent ) void DIALOG_SYMBOL_FIELDS_TABLE::OnTableValueChanged( wxGridEvent& aEvent )
{ {
m_grid->ForceRefresh(); m_grid->ForceRefresh();
@ -1109,11 +1115,13 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnRegroupSymbols( wxCommandEvent& aEvent )
m_grid->ForceRefresh(); m_grid->ForceRefresh();
} }
void DIALOG_SYMBOL_FIELDS_TABLE::OnScopeChanged( wxCommandEvent& aEvent ) void DIALOG_SYMBOL_FIELDS_TABLE::OnScopeChanged( wxCommandEvent& aEvent )
{ {
UpdateScope(); UpdateScope();
} }
void DIALOG_SYMBOL_FIELDS_TABLE::UpdateScope() void DIALOG_SYMBOL_FIELDS_TABLE::UpdateScope()
{ {
m_dataModel->SetPath( m_parent->GetCurrentSheet() ); m_dataModel->SetPath( m_parent->GetCurrentSheet() );
@ -1128,6 +1136,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::UpdateScope()
m_dataModel->RebuildRows(); m_dataModel->RebuildRows();
} }
void DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick( wxGridEvent& event ) void DIALOG_SYMBOL_FIELDS_TABLE::OnTableCellClick( wxGridEvent& event )
{ {
if( m_dataModel->ColIsReference( event.GetCol() ) ) 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 ) void DIALOG_SYMBOL_FIELDS_TABLE::OnTableRangeSelected( wxGridRangeSelectEvent& aEvent )
{ {
// Cross-probing should only work in Edit page // Cross-probing should only work in Edit page
@ -1401,7 +1411,8 @@ void DIALOG_SYMBOL_FIELDS_TABLE::OnExport( wxCommandEvent& aEvent )
return; 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() ); msg.Printf( _( "Wrote BOM output to '%s'" ), outputFile.GetFullPath() );
DisplayInfoMessage( this, msg ); DisplayInfoMessage( this, msg );
} }
@ -1675,10 +1686,12 @@ void DIALOG_SYMBOL_FIELDS_TABLE::syncBomPresetSelection()
// We should compare preset.name and current.name. // We should compare preset.name and current.name.
// unfortunately current.name is empty because // unfortunately current.name is empty because
// m_dataModel->GetBomSettings() does not store the .name member // 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, // sortField can be translated in m_bomPresets list,
// so current.sortField needs to be translated // 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 ) ) if( preset.sortField != wxGetTranslation( current.sortField ) )
return false; return false;
@ -1947,7 +1960,7 @@ void DIALOG_SYMBOL_FIELDS_TABLE::doApplyBomPreset( const BOM_PRESET& aPreset )
if( cfg->m_FieldEditorPanel.field_widths.count( fieldNameStr ) ) if( cfg->m_FieldEditorPanel.field_widths.count( fieldNameStr ) )
m_grid->SetColSize( col, cfg->m_FieldEditorPanel.field_widths.at( fieldNameStr ) ); m_grid->SetColSize( col, cfg->m_FieldEditorPanel.field_widths.at( fieldNameStr ) );
// Set shown colums // Set shown columns
bool show = m_dataModel->GetShowColumn( col ); bool show = m_dataModel->GetShowColumn( col );
m_fieldsCtrl->SetToggleValue( show, i, SHOW_FIELD_COLUMN ); 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(); m_schSettings.m_BomSettings = m_dataModel->GetBomSettings();
} }
// Save our BOM Format presets // Save our BOM Format presets
std::vector<BOM_FMT_PRESET> fmts; 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_pinGrid->SetDefaultRowSize( m_pinGrid->GetDefaultRowSize() + 4 );
m_fieldsGrid->SetTable( m_fields ); 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 ) [&]( wxCommandEvent& aEvent )
{ {
OnAddField( 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. // Find the same library in the symbol library table using the full path and file name.
wxString libFileName = lib.GetFullFileName(); 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 ) if( row )
{ {
@ -416,7 +417,8 @@ bool DIALOG_SYMBOL_REMAP::backupProject( REPORTER& aReporter )
destFileName.GetFullPath() ), destFileName.GetFullPath() ),
RPT_SEVERITY_INFO ); 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" ), errorMsg += wxString::Format( _( "Failed to create backup folder '%s'.\n" ),
destFileName.GetPath() ); destFileName.GetPath() );

View File

@ -41,7 +41,8 @@ DIALOG_TABLE_PROPERTIES::DIALOG_TABLE_PROPERTIES( SCH_EDIT_FRAME* aFrame, SCH_TA
m_frame( aFrame ), m_frame( aFrame ),
m_table( aTable ), m_table( aTable ),
m_borderWidth( aFrame, m_borderWidthLabel, m_borderWidthCtrl, m_borderWidthUnits ), 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 ); m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -131,7 +131,8 @@ bool DIALOG_TABLECELL_PROPERTIES::TransferDataToWindow()
} }
else 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 ); m_fontCtrl->SetSelection( -1 );
if( cell->GetTextWidth() != m_textSize.GetValue() ) 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 ); m_fillColorSwatch->SetSwatchBackground( schematicBackground );
if( m_frame->GetColorSettings()->GetOverrideSchItemColors() ) 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 else
{ {
@ -350,7 +351,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_privateCheckbox->SetValue( m_currentItem->IsPrivate() ); m_privateCheckbox->SetValue( m_currentItem->IsPrivate() );
m_commonToAllUnits->SetValue( symbol->IsMulti() && m_currentItem->GetUnit() == 0 ); m_commonToAllUnits->SetValue( symbol->IsMulti() && m_currentItem->GetUnit() == 0 );
m_commonToAllUnits->Enable( symbol->IsMulti() ); 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() ); 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 // On macOS CTRL+Enter produces '\r' instead of '\n' regardless of EOL setting
text.Replace( "\r", "\n" ); text.Replace( "\r", "\n" );
#elif defined( __WINDOWS__ ) #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. // drawing routines so strip the \r char.
text.Replace( "\r", "" ); text.Replace( "\r", "" );
#endif #endif
@ -523,7 +525,8 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
} }
if( m_currentText->GetTextWidth() != m_textSize.GetValue() ) 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() ) if( m_fontCtrl->HaveFontSelection() )
{ {

View File

@ -50,7 +50,7 @@ protected:
checkAll( false ); checkAll( false );
} }
///< Select or deselect all fields in the listbox widget /// Select or deselect all fields in the listbox widget.
void checkAll( bool aCheck ); void checkAll( bool aCheck );
private: private:
@ -59,7 +59,7 @@ private:
SYMBOL_EDIT_FRAME* m_editFrame; SYMBOL_EDIT_FRAME* m_editFrame;
LIB_SYMBOL* m_symbol; 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; std::set<wxString> m_updateFields;
}; };

View File

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

View File

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

View File

@ -112,7 +112,8 @@ bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow()
if( schFrame ) if( schFrame )
{ {
SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings(); 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; return true;

View File

@ -518,7 +518,8 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::zoomFitPreview()
view->SetScale( 1.0 ); view->SetScale( 1.0 );
VECTOR2D screenSize = view->ToWorld( ToVECTOR2D( m_preview->GetClientSize() ), false ); 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 ), double scale = view->GetScale() / std::max( fabs( psize.x / screenSize.x ),
fabs( psize.y / screenSize.y ) ); fabs( psize.y / screenSize.y ) );

View File

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

View File

@ -73,7 +73,8 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
m_backgroundColorSwatch->SetSwatchBackground( schematicBackground ); m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
m_backgroundColorSwatch->SetDefaultColor( settings->GetDefaultColor( LAYER_SHEET_BACKGROUND ) ); 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_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
m_footprintPreview->SetValue( aCfg->m_Appearance.footprint_preview ); m_footprintPreview->SetValue( aCfg->m_Appearance.footprint_preview );

View File

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

View File

@ -58,13 +58,13 @@ protected:
void doReloadMembersGrid(); void doReloadMembersGrid();
/* /**
* When rows are created programmatically by pasting values from the clipboard, * When rows are created programmatically by pasting values from the clipboard,
* the cell change event may not be triggered. This can prevent members from * the cell change event may not be triggered.
* being automatically added to the corresponding alias.
* *
* To ensure that members are correctly associated with the alias, * This can prevent members from being automatically added to the corresponding alias. To
* we manually update the members for the needed alias. * ensure that members are correctly associated with the alias, manually update the members
* for the needed alias.
*/ */
void updateAliasMembers( int aAliasIndex ); 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_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ),
m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ), m_lineWidth( aFrame, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
m_pinSymbolSize( aFrame, m_pinSymbolSizeLabel, m_pinSymbolSizeCtrl, m_pinSymbolSizeUnits ), 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(); wxSize minSize = m_dashLengthCtrl->GetMinSize();
int minWidth = m_dashLengthCtrl->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth(); 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 ) ) 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_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_dashLengthCtrl, EDA_UNITS::UNSCALED, settings.m_DashedLineDashRatio );
SET_VALUE( m_gapLengthCtrl, EDA_UNITS::UNSCALED, settings.m_DashedLineGapRatio ); SET_VALUE( m_gapLengthCtrl, EDA_UNITS::UNSCALED, settings.m_DashedLineGapRatio );
SET_VALUE( m_labelSizeRatioCtrl, EDA_UNITS::PERCENT, settings.m_LabelSizeRatio * 100.0 ); 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 ) #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_TextOffsetRatio = GET_VALUE( EDA_UNITS::PERCENT,
settings.m_FontMetrics.m_OverbarHeight = GET_VALUE( EDA_UNITS::PERCENT, m_overbarHeightCtrl->GetValue() ) / 100.0; 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_DashedLineDashRatio = GET_VALUE( EDA_UNITS::UNSCALED, m_dashLengthCtrl->GetValue() );
settings.m_DashedLineGapRatio = GET_VALUE( EDA_UNITS::UNSCALED, m_gapLengthCtrl->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 #undef GET_VALUE

View File

@ -64,6 +64,7 @@ PANEL_SETUP_PINMAP::PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* paren
reBuildMatrixPanel(); reBuildMatrixPanel();
} }
PANEL_SETUP_PINMAP::~PANEL_SETUP_PINMAP() PANEL_SETUP_PINMAP::~PANEL_SETUP_PINMAP()
{ {
#ifndef __WXMAC__ #ifndef __WXMAC__
@ -96,7 +97,8 @@ void PANEL_SETUP_PINMAP::OnMouseEnter( wxMouseEvent& aEvent )
wxBitmapButton* btn = static_cast<wxBitmapButton*>( aEvent.GetEventObject() ); wxBitmapButton* btn = static_cast<wxBitmapButton*>( aEvent.GetEventObject() );
m_btnBackground = btn->GetBackgroundColour(); m_btnBackground = btn->GetBackgroundColour();
btn->SetBackgroundColour( wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) ); btn->SetBackgroundColour(
wxSystemSettings::GetColour( wxSystemColour::wxSYS_COLOUR_HIGHLIGHT ) );
} }
@ -191,8 +193,10 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel()
#else #else
if( m_initialized ) if( m_initialized )
{ {
m_buttonList[ii][jj]->Unbind(wxEVT_ENTER_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this ); m_buttonList[ii][jj]->Unbind( wxEVT_ENTER_WINDOW,
m_buttonList[ii][jj]->Unbind(wxEVT_LEAVE_WINDOW, &PANEL_SETUP_PINMAP::OnMouseLeave, this ); &PANEL_SETUP_PINMAP::OnMouseLeave, this );
m_buttonList[ii][jj]->Unbind( wxEVT_LEAVE_WINDOW,
&PANEL_SETUP_PINMAP::OnMouseLeave, this );
} }
wxBitmapButton* btn = wxBitmapButton* btn =

View File

@ -137,6 +137,7 @@ PANEL_SIMULATOR_PREFERENCES::horizontalScrollSelectionToAction( int aSelection )
return SIM_MOUSE_WHEEL_ACTION::NONE; return SIM_MOUSE_WHEEL_ACTION::NONE;
} }
int PANEL_SIMULATOR_PREFERENCES::actionToHorizontalScrollSelection( SIM_MOUSE_WHEEL_ACTION a ) int PANEL_SIMULATOR_PREFERENCES::actionToHorizontalScrollSelection( SIM_MOUSE_WHEEL_ACTION a )
{ {
switch( a ) switch( a )

View File

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

View File

@ -63,10 +63,12 @@
*/ */
struct SUPPORTED_FILE_TYPE struct SUPPORTED_FILE_TYPE
{ {
wxString m_Description; ///< Description shown in the file picker dialog 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_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 /// 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; 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 ); 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 ) if( m_projectTable )
{ {
m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_projectTable ), true ); m_project_grid->SetTable( new SYMBOL_LIB_TABLE_GRID( *m_projectTable ), true );
setupGrid( m_project_grid ); 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 else
{ {
@ -397,12 +401,14 @@ PANEL_SYM_LIB_TABLE::~PANEL_SYM_LIB_TABLE()
// Delete the GRID_TRICKS. // Delete the GRID_TRICKS.
// Any additional event handlers should be popped before the window is deleted. // Any additional event handlers should be popped before the window is deleted.
m_global_grid->PopEventHandler( true ); 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 ) if( m_project_grid )
{ {
m_project_grid->PopEventHandler( true ); 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 ); 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 ) bool PANEL_SYM_LIB_TABLE::allowAutomaticPluginTypeSelection( wxString& aLibraryPath )
{ {
// When the plugin type depends only of the file extension, return true. // 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 ); wxFileName fn( aLibraryPath );
wxString ext = fn.GetExt().Lower(); wxString ext = fn.GetExt().Lower();
@ -458,7 +464,8 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
wxYES_NO | wxCENTER | wxICON_QUESTION | wxYES_DEFAULT ); wxYES_NO | wxCENTER | wxICON_QUESTION | wxYES_DEFAULT );
badCellDlg.SetExtendedMessage( _( "Empty cells will result in all rows that are " badCellDlg.SetExtendedMessage( _( "Empty cells will result in all rows that are "
"invalid to be removed from the table." ) ); "invalid to be removed from the table." ) );
badCellDlg.SetYesNoLabels( wxMessageDialog::ButtonLabel( _( "Remove Invalid Cells" ) ), badCellDlg.SetYesNoLabels(
wxMessageDialog::ButtonLabel( _( "Remove Invalid Cells" ) ),
wxMessageDialog::ButtonLabel( _( "Cancel Table Update" ) ) ); wxMessageDialog::ButtonLabel( _( "Cancel Table Update" ) ) );
wait.reset(); wait.reset();
@ -501,7 +508,9 @@ bool PANEL_SYM_LIB_TABLE::verifyTables()
model->SetValue( r, COL_NICKNAME, nick ); model->SetValue( r, COL_NICKNAME, nick );
if( allowAutomaticPluginTypeSelection( uri ) ) if( allowAutomaticPluginTypeSelection( uri ) )
{
model->SetValue( r, COL_URI, uri ); model->SetValue( r, COL_URI, uri );
}
else else
{ {
wxString ltype = model->GetValue( r, COL_TYPE ); wxString ltype = model->GetValue( r, COL_TYPE );
@ -987,9 +996,11 @@ void PANEL_SYM_LIB_TABLE::onConvertLegacyLibraries( wxCommandEvent& event )
} }
wxString options = m_cur_grid->GetCellValue( row, COL_OPTIONS ); 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(), relPath = NormalizePath( newLib.GetFullPath(), &Pgm().GetLocalEnvVariables(),
m_project ); m_project );

View File

@ -96,7 +96,9 @@ private:
WX_GRID* m_cur_grid; ///< changed based on tab choice WX_GRID* m_cur_grid; ///< changed based on tab choice
static size_t m_pageNdx; ///< Remember the last notebook page selected 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 ) for( int row = 0; row < m_grid->GetNumberRows(); ++row )
{ {
m_grid->SetCellValue( row, 0, m_fields[row].m_Name ); m_grid->SetCellValue( row, 0, m_fields[row].m_Name );
// columns 1 and 2 show a boolean value (in a check box): // 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, 1, m_fields[row].m_Visible ? wxS( "1" ) : wxS( "0" ) );
m_grid->SetCellValue( row, 2, m_fields[row].m_URL ? wxS( "1" ) : wxS( "0" ) ); m_grid->SetCellValue( row, 2, m_fields[row].m_URL ? wxS( "1" ) : wxS( "0" ) );