Schematic editor dialog source code housekeeping.

This commit is contained in:
Wayne Stambaugh 2021-03-21 13:31:23 -04:00
parent f0ed5fab39
commit 6997fec14f
27 changed files with 434 additions and 458 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2017 jean-pierre Charras jp.charras at wanadoo.fr * Copyright (C) 1992-2017 jean-pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -37,8 +37,7 @@
/** /**
* DIALOG_ANNOTATE: a dialog to set/clear reference designators, * A dialog to set/clear reference designators of a schematic with different options.
* of a schematic hierarchy, with different options
*/ */
class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE
{ {
@ -47,9 +46,7 @@ public:
~DIALOG_ANNOTATE(); ~DIALOG_ANNOTATE();
private: private:
SCH_EDIT_FRAME* m_Parent; /// Initialize member variables.
/// Initialises member variables
void InitValues(); void InitValues();
void OnOptionChanged( wxCommandEvent& event ) override; void OnOptionChanged( wxCommandEvent& event ) override;
void OnClearAnnotationClick( wxCommandEvent& event ) override; void OnClearAnnotationClick( wxCommandEvent& event ) override;
@ -63,14 +60,12 @@ private:
bool GetLockUnits(); bool GetLockUnits();
/** /**
* Function GetSortOrder
* @return 0 if annotation by X position, * @return 0 if annotation by X position,
* 1 if annotation by Y position, * 1 if annotation by Y position,
*/ */
int GetSortOrder(); int GetSortOrder();
/** /**
* Function GetAnnotateAlgo
* @return 0 if annotation using first free Id value * @return 0 if annotation using first free Id value
* 1 for first free Id value inside sheet num * 100 to sheet num * 100 + 99 * 1 for first free Id value inside sheet num * 100 to sheet num * 100 + 99
* 2 for first free Id value inside sheet num * 1000 to sheet num * 1000 + 999 * 2 for first free Id value inside sheet num * 1000 to sheet num * 1000 + 999
@ -78,6 +73,8 @@ private:
int GetAnnotateAlgo(); int GetAnnotateAlgo();
int GetStartNumber(); int GetStartNumber();
SCH_EDIT_FRAME* m_Parent;
}; };

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2018 CERN * Copyright (C) 2018 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com> * @author Jon Evans <jon@craftyjon.com>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -48,13 +49,16 @@ public:
void OnRemoveSignal( wxCommandEvent& aEvent ); void OnRemoveSignal( wxCommandEvent& aEvent );
protected: protected:
void OnInitDialog( wxInitDialogEvent& aEvent ); void OnInitDialog( wxInitDialogEvent& aEvent );
void OnSelectBus( wxListEvent& event ); void OnSelectBus( wxListEvent& event );
void OnSelectSignal( wxListEvent& event ); void OnSelectSignal( wxListEvent& event );
private:
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
wxString getAliasDisplayText( std::shared_ptr< BUS_ALIAS > aAlias );
protected:
SCH_EDIT_FRAME* m_parent; SCH_EDIT_FRAME* m_parent;
wxListView* m_bus_list_view; wxListView* m_bus_list_view;
@ -71,16 +75,8 @@ protected:
wxButton* m_btn_remove_signal; wxButton* m_btn_remove_signal;
private: private:
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
wxString getAliasDisplayText( std::shared_ptr< BUS_ALIAS > aAlias );
std::vector< std::shared_ptr< BUS_ALIAS > > m_aliases; std::vector< std::shared_ptr< BUS_ALIAS > > m_aliases;
std::unordered_set<SCH_SCREEN*> m_screens; std::unordered_set<SCH_SCREEN*> m_screens;
std::shared_ptr< BUS_ALIAS > m_active_alias; std::shared_ptr< BUS_ALIAS > m_active_alias;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Henner Zeller <h.zeller@acm.org> * Copyright (C) 2014 Henner Zeller <h.zeller@acm.org>
* Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -94,13 +94,13 @@ public:
* @param aTitle Dialog title. * @param aTitle Dialog title.
* @param aAdapter SYMBOL_TREE_MODEL_ADAPTER::PTR. See CMP_TREE_MODEL_ADAPTER * @param aAdapter SYMBOL_TREE_MODEL_ADAPTER::PTR. See CMP_TREE_MODEL_ADAPTER
* for documentation. * for documentation.
* @param aDeMorganConvert preferred deMorgan conversion * @param aDeMorganConvert preferred deMorgan conversion.
* (TODO: should happen in dialog) * (TODO: should happen in dialog)
* @param aAllowFieldEdits if false, all functions that allow the user to edit fields * @param aAllowFieldEdits if false, all functions that allow the user to edit fields
* (currently just footprint selection) will not be available. * (currently just footprint selection) will not be available.
* @param aShowFootprints if false, all footprint preview and selection features are * @param aShowFootprints if false, all footprint preview and selection features are
* disabled. This forces aAllowFieldEdits false too. * disabled. This forces aAllowFieldEdits false too.
* @param aAllowBrowser show a Select with Browser button * @param aAllowBrowser show a Select with Browser button.
*/ */
DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxString& aTitle, DIALOG_CHOOSE_SYMBOL( SCH_BASE_FRAME* aParent, const wxString& aTitle,
wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter, wxObjectDataPtr<LIB_TREE_MODEL_ADAPTER>& aAdapter,
@ -126,8 +126,9 @@ public:
* To be called after this dialog returns from ShowModal() * To be called after this dialog returns from ShowModal()
* *
* In the case of multi-unit symbols, this preferences asks to iterate through * In the case of multi-unit symbols, this preferences asks to iterate through
* all units of the symbol, one per click * all units of the symbol, one per click.
* @return The value of the dialog preference checkbox *
* @return The value of the dialog preference checkbox.
*/ */
bool GetUseAllUnits() const { return m_useUnits->GetValue(); } bool GetUseAllUnits() const { return m_useUnits->GetValue(); }
@ -135,33 +136,31 @@ public:
* To be called after this dialog returns from ShowModal() * To be called after this dialog returns from ShowModal()
* *
* Keeps a new copy of the symbol on the mouse cursor, allowing the user to rapidly * Keeps a new copy of the symbol on the mouse cursor, allowing the user to rapidly
* place multiple copies of the same symbol on their schematic * place multiple copies of the same symbol on their schematic.
* *
* @return The value of the keep symbol preference checkbox * @return The value of the keep symbol preference checkbox.
*/ */
bool GetKeepSymbol() const { return m_keepSymbol->GetValue(); } bool GetKeepSymbol() const { return m_keepSymbol->GetValue(); }
/** /**
* Get a list of fields edited by the user. * Get a list of fields edited by the user.
* @return vector of pairs; each.first = field ID, each.second = new value *
* @return vector of pairs; each.first = field ID, each.second = new value.
*/ */
std::vector<std::pair<int, wxString>> GetFields() const std::vector<std::pair<int, wxString>> GetFields() const
{ {
return m_field_edits; return m_field_edits;
} }
/** Function IsExternalBrowserSelected /**
* * @return true if the user pressed the thumbnail view of the component to
* @return true, iff the user pressed the thumbnail view of the component to * launch the component browser.
* launch the component browser.
*/ */
bool IsExternalBrowserSelected() const bool IsExternalBrowserSelected() const
{ {
return m_external_browser_requested; return m_external_browser_requested;
} }
static std::mutex g_Mutex;
protected: protected:
static constexpr int DblClickDelay = 100; // milliseconds static constexpr int DblClickDelay = 100; // milliseconds
@ -196,10 +195,14 @@ protected:
/** /**
* Populate the footprint selector for a given alias. * Populate the footprint selector for a given alias.
* *
* @param aLibId the #LIB_ID of the selection or invalid to clear * @param aLibId the #LIB_ID of the selection or invalid to clear.
*/ */
void PopulateFootprintSelector( LIB_ID const& aLibId ); void PopulateFootprintSelector( LIB_ID const& aLibId );
public:
static std::mutex g_Mutex;
protected:
wxTimer* m_dbl_click_timer; wxTimer* m_dbl_click_timer;
SYMBOL_PREVIEW_WIDGET* m_symbol_preview; SYMBOL_PREVIEW_WIDGET* m_symbol_preview;
wxButton* m_browser_button; wxButton* m_browser_button;

View File

@ -62,66 +62,54 @@ public:
private: private:
// HELPER ROUTINES UNCHANGED FROM wxWidgets IMPLEMENTATION // HELPER ROUTINES UNCHANGED FROM wxWidgets IMPLEMENTATION
wxArrayString GetTextLines( wxGrid& grid, wxArrayString GetTextLines( wxGrid& grid, wxDC& dc, const wxGridCellAttr& attr,
wxDC& dc, const wxRect& rect, int row, int col );
const wxGridCellAttr& attr,
const wxRect& rect,
int row, int col);
// Helper methods of GetTextLines() // Helper methods of GetTextLines()
// Break a single logical line of text into several physical lines, all of // Break a single logical line of text into several physical lines, all of
// which are added to the lines array. The lines are broken at maxWidth and // which are added to the lines array. The lines are broken at maxWidth and
// the dc is used for measuring text extent only. // the dc is used for measuring text extent only.
void BreakLine(wxDC& dc, void BreakLine( wxDC& dc, const wxString& logicalLine, wxCoord maxWidth, wxArrayString& lines );
const wxString& logicalLine,
wxCoord maxWidth,
wxArrayString& lines);
// Break a word, which is supposed to be wider than maxWidth, into several // Break a word, which is supposed to be wider than maxWidth, into several
// lines, which are added to lines array and the last, incomplete, of which // lines, which are added to lines array and the last, incomplete, of which
// is returned in line output parameter. // is returned in line output parameter.
// //
// Returns the width of the last line. // Returns the width of the last line.
wxCoord BreakWord(wxDC& dc, wxCoord BreakWord( wxDC& dc, const wxString& word, wxCoord maxWidth, wxArrayString& lines,
const wxString& word, wxString& line );
wxCoord maxWidth,
wxArrayString& lines,
wxString& line);
}; };
// PRIVATE METHOD UNCHANGED FROM wxWidgets IMPLEMENTATION // PRIVATE METHOD UNCHANGED FROM wxWidgets IMPLEMENTATION
wxArrayString wxArrayString GRIDCELL_AUTOWRAP_STRINGRENDERER::GetTextLines( wxGrid& grid, wxDC& dc,
GRIDCELL_AUTOWRAP_STRINGRENDERER::GetTextLines(wxGrid& grid, const wxGridCellAttr& attr,
wxDC& dc, const wxRect& rect, int row, int col )
const wxGridCellAttr& attr,
const wxRect& rect,
int row, int col)
{ {
dc.SetFont( attr.GetFont() ); dc.SetFont( attr.GetFont() );
const wxCoord maxWidth = rect.GetWidth(); const wxCoord maxWidth = rect.GetWidth();
// Transform logical lines into physical ones, wrapping the longer ones. // Transform logical lines into physical ones, wrapping the longer ones.
const wxArrayString const wxArrayString logicalLines = wxSplit( grid.GetCellValue( row, col ), '\n', '\0' );
logicalLines = wxSplit(grid.GetCellValue(row, col), '\n', '\0');
// Trying to do anything if the column is hidden anyhow doesn't make sense // Trying to do anything if the column is hidden anyhow doesn't make sense
// and we run into problems in BreakLine() in this case. // and we run into problems in BreakLine() in this case.
if ( maxWidth <= 0 ) if( maxWidth <= 0 )
return logicalLines; return logicalLines;
wxArrayString physicalLines; wxArrayString physicalLines;
for ( const wxString& line : logicalLines )
for( const wxString& line : logicalLines )
{ {
if ( dc.GetTextExtent(line).x > maxWidth ) if( dc.GetTextExtent( line ).x > maxWidth )
{ {
// Line does not fit, break it up. // Line does not fit, break it up.
BreakLine(dc, line, maxWidth, physicalLines); BreakLine( dc, line, maxWidth, physicalLines );
} }
else // The entire line fits as is else // The entire line fits as is
{ {
physicalLines.push_back(line); physicalLines.push_back( line );
} }
} }
@ -130,22 +118,21 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::GetTextLines(wxGrid& grid,
// PRIVATE METHOD UNCHANGED FROM wxWidgets IMPLEMENTATION // PRIVATE METHOD UNCHANGED FROM wxWidgets IMPLEMENTATION
void void GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakLine( wxDC& dc, const wxString& logicalLine,
GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakLine(wxDC& dc, wxCoord maxWidth, wxArrayString& lines )
const wxString& logicalLine,
wxCoord maxWidth,
wxArrayString& lines)
{ {
wxCoord lineWidth = 0; wxCoord lineWidth = 0;
wxString line; wxString line;
// For each word // For each word
wxStringTokenizer wordTokenizer(logicalLine, wxS(" \t"), wxTOKEN_RET_DELIMS); wxStringTokenizer wordTokenizer( logicalLine, wxS( " \t" ), wxTOKEN_RET_DELIMS );
while ( wordTokenizer.HasMoreTokens() )
while( wordTokenizer.HasMoreTokens() )
{ {
const wxString word = wordTokenizer.GetNextToken(); const wxString word = wordTokenizer.GetNextToken();
const wxCoord wordWidth = dc.GetTextExtent(word).x; const wxCoord wordWidth = dc.GetTextExtent( word ).x;
if ( lineWidth + wordWidth < maxWidth )
if( lineWidth + wordWidth < maxWidth )
{ {
// Word fits, just add it to this line. // Word fits, just add it to this line.
line += word; line += word;
@ -155,55 +142,53 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakLine(wxDC& dc,
{ {
// Word does not fit, check whether the word is itself wider that // Word does not fit, check whether the word is itself wider that
// available width // available width
if ( wordWidth < maxWidth ) if( wordWidth < maxWidth )
{ {
// Word can fit in a new line, put it at the beginning // Word can fit in a new line, put it at the beginning
// of the new line. // of the new line.
lines.push_back(line); lines.push_back( line );
line = word; line = word;
lineWidth = wordWidth; lineWidth = wordWidth;
} }
else // Word cannot fit in available width at all. else // Word cannot fit in available width at all.
{ {
if ( !line.empty() ) if( !line.empty() )
{ {
lines.push_back(line); lines.push_back( line );
line.clear(); line.clear();
lineWidth = 0; lineWidth = 0;
} }
// Break it up in several lines. // Break it up in several lines.
lineWidth = BreakWord(dc, word, maxWidth, lines, line); lineWidth = BreakWord( dc, word, maxWidth, lines, line );
} }
} }
} }
if ( !line.empty() ) if( !line.empty() )
lines.push_back(line); lines.push_back( line );
} }
// PRIVATE METHOD UNCHANGED FROM wxWidgets IMPLEMENTATION // PRIVATE METHOD UNCHANGED FROM wxWidgets IMPLEMENTATION
wxCoord wxCoord GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord( wxDC& dc, const wxString& word,
GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc, wxCoord maxWidth, wxArrayString& lines,
const wxString& word, wxString& line )
wxCoord maxWidth,
wxArrayString& lines,
wxString& line)
{ {
wxArrayInt widths; wxArrayInt widths;
dc.GetPartialTextExtents(word, widths); dc.GetPartialTextExtents( word, widths );
// TODO: Use binary search to find the first element > maxWidth. // TODO: Use binary search to find the first element > maxWidth.
const unsigned count = widths.size(); const unsigned count = widths.size();
unsigned n; unsigned n;
for ( n = 0; n < count; n++ )
for( n = 0; n < count; n++ )
{ {
if ( widths[n] > maxWidth ) if( widths[n] > maxWidth )
break; break;
} }
if ( n == 0 ) if( n == 0 )
{ {
// This is a degenerate case: the first character of the word is // This is a degenerate case: the first character of the word is
// already wider than the available space, so we just can't show it // already wider than the available space, so we just can't show it
@ -211,7 +196,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
n = 1; n = 1;
} }
lines.push_back( word.substr(0, n) ); lines.push_back( word.substr( 0, n ) );
// Check if the remainder of the string fits in one line. // Check if the remainder of the string fits in one line.
// //
@ -219,10 +204,10 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
// extent of the remainder may be different when it's rendered in a // extent of the remainder may be different when it's rendered in a
// separate line instead of as part of the same one, so we have to // separate line instead of as part of the same one, so we have to
// recompute it. // recompute it.
const wxString rest = word.substr(n); const wxString rest = word.substr( n );
const wxCoord restWidth = dc.GetTextExtent(rest).x; const wxCoord restWidth = dc.GetTextExtent( rest ).x;
if ( restWidth <= maxWidth ) if( restWidth <= maxWidth )
{ {
line = rest; line = rest;
return restWidth; return restWidth;
@ -232,7 +217,7 @@ GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakWord(wxDC& dc,
// //
// TODO: Perhaps avoid recursion? The code is simpler like this but using a // TODO: Perhaps avoid recursion? The code is simpler like this but using a
// loop in this function would probably be more efficient. // loop in this function would probably be more efficient.
return BreakWord(dc, rest, maxWidth, lines, line); return BreakWord( dc, rest, maxWidth, lines, line );
} }
@ -255,17 +240,12 @@ int GRIDCELL_AUTOWRAP_STRINGRENDERER::GetHeight( wxDC& aDC, wxGrid* aGrid, int a
} }
// a helper class to handle components to edit /**
* A helper to handle symbols to edit.
*/
class CMP_CANDIDATE class CMP_CANDIDATE
{ {
public: public:
SCH_COMPONENT* m_Component; // the schematic component
int m_Row; // the row index in m_grid
SCH_SCREEN* m_Screen; // the screen where m_Component lives
wxString m_Reference; // the schematic reference, only to display it in list
wxString m_InitialLibId; // the Lib Id of the component before any change
bool m_IsOrphan; // true if a component has no corresponding symbol found in libs
CMP_CANDIDATE( SCH_COMPONENT* aComponent ) CMP_CANDIDATE( SCH_COMPONENT* aComponent )
{ {
m_Component = aComponent; m_Component = aComponent;
@ -275,17 +255,24 @@ public:
m_Screen = nullptr; m_Screen = nullptr;
} }
// Returns a string like mylib:symbol_name from the LIB_ID of the component // Return a string like mylib:symbol_name from the #LIB_ID of the component.
wxString GetStringLibId() wxString GetStringLibId()
{ {
return m_Component->GetLibId().GetUniStringLibId(); return m_Component->GetLibId().GetUniStringLibId();
} }
// Returns a string containing the reference of the component // Return a string containing the reference of the component.
wxString GetSchematicReference() wxString GetSchematicReference()
{ {
return m_Reference; return m_Reference;
} }
SCH_COMPONENT* m_Component; // the schematic component
int m_Row; // the row index in m_grid
SCH_SCREEN* m_Screen; // the screen where m_Component lives
wxString m_Reference; // the schematic reference, only to display it in list
wxString m_InitialLibId; // the Lib Id of the component before any change
bool m_IsOrphan; // true if a component has no corresponding symbol found in libs
}; };
@ -293,8 +280,8 @@ public:
* Dialog to globally edit the #LIB_ID of groups if components having the same initial LIB_ID. * Dialog to globally edit the #LIB_ID of groups if components having the same initial LIB_ID.
* *
* This is useful when you want to: * This is useful when you want to:
* * to move a symbol from a symbol library to another symbol library * * move a symbol from a symbol library to another symbol library.
* to change the nickname of a library * * change the nickname of a library.
* * globally replace the symbol used by a group of components by another symbol. * * globally replace the symbol used by a group of components by another symbol.
*/ */
class DIALOG_EDIT_COMPONENTS_LIBID : public DIALOG_EDIT_COMPONENTS_LIBID_BASE class DIALOG_EDIT_COMPONENTS_LIBID : public DIALOG_EDIT_COMPONENTS_LIBID_BASE
@ -308,33 +295,29 @@ public:
bool IsSchematicModified() { return m_isModified; } bool IsSchematicModified() { return m_isModified; }
private: private:
bool m_isModified; // set to true if the schematic is modified
std::vector<int> m_OrphansRowIndexes; // list of rows containing orphan lib_id
std::vector<CMP_CANDIDATE> m_components;
GRIDCELL_AUTOWRAP_STRINGRENDERER* m_autoWrapRenderer;
void initDlg(); void initDlg();
/** /**
* Add a new row (new entry) in m_grid. * Add a new row (new entry) in m_grid.
* @param aMarkRow = true to use bold/italic font in column COL_CURR_LIBID *
* @param aReferences is the value of cell( aRowId, COL_REFS) * @param aMarkRow set to true to use bold/italic font in column COL_CURR_LIBID.
* @param aStrLibId is the value of cell( aRowId, COL_CURR_LIBID) * @param aReferences is the value of cell( aRowId, COL_REFS).
* @param aStrLibId is the value of cell( aRowId, COL_CURR_LIBID).
*/ */
void AddRowToGrid( bool aMarkRow, const wxString& aReferences, const wxString& aStrLibId ); void AddRowToGrid( bool aMarkRow, const wxString& aReferences, const wxString& aStrLibId );
/// returns true if all new lib id are valid /// returns true if all new lib id are valid
bool validateLibIds(); bool validateLibIds();
/** run the lib browser and set the selected LIB_ID for row aRow /**
* @param aRow is the row to edit * Run the lib browser and set the selected #LIB_ID for \a aRow.
* @return false if the command was aborted *
* @param aRow is the row to edit.
* @return false if the command was aborted.
*/ */
bool setLibIdByBrowser( int aRow ); bool setLibIdByBrowser( int aRow );
// Events handlers // Event handlers
// called on a right click or a left double click: // called on a right click or a left double click:
void onCellBrowseLib( wxGridEvent& event ) override; void onCellBrowseLib( wxGridEvent& event ) override;
@ -358,6 +341,13 @@ private:
void AdjustGridColumns( int aWidth ); void AdjustGridColumns( int aWidth );
void OnSizeGrid( wxSizeEvent& event ) override; void OnSizeGrid( wxSizeEvent& event ) override;
bool m_isModified; // set to true if the schematic is modified
std::vector<int> m_OrphansRowIndexes; // list of rows containing orphan lib_id
std::vector<CMP_CANDIDATE> m_components;
GRIDCELL_AUTOWRAP_STRINGRENDERER* m_autoWrapRenderer;
}; };
@ -406,10 +396,11 @@ void DIALOG_EDIT_COMPONENTS_LIBID::initDlg()
// the list is larger and looks like it contains all components // the list is larger and looks like it contains all components
const SCH_SHEET_LIST& sheets = GetParent()->Schematic().GetSheets(); const SCH_SHEET_LIST& sheets = GetParent()->Schematic().GetSheets();
SCH_REFERENCE_LIST references; SCH_REFERENCE_LIST references;
// build the full list of components including component having no symbol in loaded libs // build the full list of components including component having no symbol in loaded libs
// (orphan components) // (orphan components)
sheets.GetSymbols( references, /* include power symbols */true, sheets.GetSymbols( references, /* include power symbols */ true,
/* include orphan components */true ); /* include orphan components */ true );
for( unsigned ii = 0; ii < references.GetCount(); ii++ ) for( unsigned ii = 0; ii < references.GetCount(); ii++ )
{ {
@ -587,8 +578,9 @@ void DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton( wxCommandEvent& event )
LIB_ID curr_libid; LIB_ID curr_libid;
curr_libid.Parse( orphanLibid, true ); curr_libid.Parse( orphanLibid, true );
wxString symbName = curr_libid.GetLibItemName(); wxString symbName = curr_libid.GetLibItemName();
// number of full LIB_ID candidates (because we search for a symbol name // number of full LIB_ID candidates (because we search for a symbol name
// inside all avaiable libraries, perhaps the same symbol name can be found // inside all available libraries, perhaps the same symbol name can be found
// in more than one library, giving ambiguity // in more than one library, giving ambiguity
int libIdCandidateCount = 0; int libIdCandidateCount = 0;
candidateSymbNames.Clear(); candidateSymbNames.Clear();
@ -781,6 +773,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::AdjustGridColumns( int aWidth )
aWidth -= colWidth; aWidth -= colWidth;
colWidth = 0; colWidth = 0;
for( int row = 0; row < m_grid->GetNumberRows(); ++row ) for( int row = 0; row < m_grid->GetNumberRows(); ++row )
{ {
wxString cellValue = m_grid->GetCellValue( row, COL_CURR_LIBID ); wxString cellValue = m_grid->GetCellValue( row, COL_CURR_LIBID );
@ -792,6 +785,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::AdjustGridColumns( int aWidth )
aWidth -= colWidth; aWidth -= colWidth;
colWidth = 0; colWidth = 0;
for( int row = 0; row < m_grid->GetNumberRows(); ++row ) for( int row = 0; row < m_grid->GetNumberRows(); ++row )
{ {
wxString cellValue = m_grid->GetCellValue( row, COL_NEW_LIBID ); wxString cellValue = m_grid->GetCellValue( row, COL_NEW_LIBID );

View File

@ -7,7 +7,7 @@
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com * Copyright (C) 2016 Wayne Stambaugh, stambaughw@gmail.com
* Copyright (C) 2004-2020 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2021 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -39,13 +39,10 @@ class SCINTILLA_TRICKS;
/** /**
* DIALOG_EDIT_ONE_FIELD * A base class to edit schematic and component library fields.
* is a base class to edit schematic and component library fields. *
* <p> * This class is setup in expectation of its children possibly using Kiway player so
* This class is setup in expectation of its children * #DIALOG_SHIM::ShowQuasiModal is required when calling any subclasses.
* possibly using Kiway player so ShowQuasiModal is required when calling
* any subclasses.
*</p>
*/ */
class DIALOG_EDIT_ONE_FIELD : public DIALOG_LIB_EDIT_TEXT_BASE class DIALOG_EDIT_ONE_FIELD : public DIALOG_LIB_EDIT_TEXT_BASE
{ {
@ -68,8 +65,7 @@ protected:
void updateText( EDA_TEXT* aText ); void updateText( EDA_TEXT* aText );
/** /**
* Function OnTextValueSelectButtonClick * Handle the select button next to the text value field. The current assumption
* Handles the select button next to the text value field. The current assumption
* is that this event will only be enabled for footprint type fields. In the future * is that this event will only be enabled for footprint type fields. In the future
* this function may need to be moved to the subclasses to access m_field and check for * this function may need to be moved to the subclasses to access m_field and check for
* the field type if more select actions are desired. * the field type if more select actions are desired.
@ -81,7 +77,6 @@ protected:
/** /**
* Used to select the variant part of some text fields (for instance, the question mark * Used to select the variant part of some text fields (for instance, the question mark
* or number in a reference). * or number in a reference).
* @param event
*/ */
virtual void OnSetFocusText( wxFocusEvent& event ) override; virtual void OnSetFocusText( wxFocusEvent& event ) override;
@ -108,11 +103,9 @@ protected:
/** /**
* DIALOG_LIB_EDIT_ONE_FIELD * Handle editing a single component field in the library editor.
* is a the class to handle editing a single component field in the library editor. *
* <p>
* @note Use ShowQuasiModal when calling this class! * @note Use ShowQuasiModal when calling this class!
* </p>
*/ */
class DIALOG_LIB_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD class DIALOG_LIB_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD
{ {
@ -136,11 +129,9 @@ public:
/** /**
* DIALOG_SCH_EDIT_ONE_FIELD * Handle editing a single component field in the schematic editor.
* is a the class to handle editing a single component field in the schematic editor. *
* <p>
* @note Use ShowQuasiModal when calling this class! * @note Use ShowQuasiModal when calling this class!
* </p>
*/ */
class DIALOG_SCH_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD class DIALOG_SCH_EDIT_ONE_FIELD : public DIALOG_EDIT_ONE_FIELD
{ {

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -33,21 +33,9 @@
#include <widgets/progress_reporter.h> #include <widgets/progress_reporter.h>
#include <erc_settings.h> #include <erc_settings.h>
// DIALOG_ERC class declaration
class DIALOG_ERC : public DIALOG_ERC_BASE, PROGRESS_REPORTER class DIALOG_ERC : public DIALOG_ERC_BASE, PROGRESS_REPORTER
{ {
private:
SCH_EDIT_FRAME* m_parent;
RC_ITEMS_PROVIDER* m_markerProvider;
RC_TREE_MODEL* m_markerTreeModel;
bool m_running;
bool m_ercRun;
int m_severities;
public: public:
DIALOG_ERC( SCH_EDIT_FRAME* parent ); DIALOG_ERC( SCH_EDIT_FRAME* parent );
~DIALOG_ERC(); ~DIALOG_ERC();
@ -85,6 +73,17 @@ private:
void syncCheckboxes(); void syncCheckboxes();
void updateDisplayedCounts(); void updateDisplayedCounts();
private:
SCH_EDIT_FRAME* m_parent;
RC_ITEMS_PROVIDER* m_markerProvider;
RC_TREE_MODEL* m_markerTreeModel;
bool m_running;
bool m_ercRun;
int m_severities;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Oliver Walters * Copyright (C) 2017 Oliver Walters
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -44,13 +44,6 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private: private:
SCH_EDIT_FRAME* m_parent;
int m_showColWidth;
int m_groupByColWidth;
SCH_REFERENCE_LIST m_symbolsList;
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
void AddField( const wxString& displayName, const wxString& aCanonicalName, bool defaultShow, void AddField( const wxString& displayName, const wxString& aCanonicalName, bool defaultShow,
bool defaultSortBy ); bool defaultSortBy );
void LoadFieldNames(); void LoadFieldNames();
@ -69,6 +62,13 @@ private:
void OnSaveAndContinue( wxCommandEvent& aEvent ) override; void OnSaveAndContinue( wxCommandEvent& aEvent ) override;
void OnCancel( wxCommandEvent& event ) override; void OnCancel( wxCommandEvent& event ) override;
void OnClose( wxCloseEvent& event ) override; void OnClose( wxCloseEvent& event ) override;
SCH_EDIT_FRAME* m_parent;
int m_showColWidth;
int m_groupByColWidth;
SCH_REFERENCE_LIST m_symbolsList;
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
}; };
#endif /* DIALOG_FIELDS_EDITOR_GLOBAL_H */ #endif /* DIALOG_FIELDS_EDITOR_GLOBAL_H */

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2020 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -39,12 +39,12 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
private: private:
void resetDefaults( wxCommandEvent& event ) override;
SCH_EDIT_FRAME* m_frame; SCH_EDIT_FRAME* m_frame;
std::deque<SCH_JUNCTION*> m_junctions; std::deque<SCH_JUNCTION*> m_junctions;
UNIT_BINDER m_diameter; UNIT_BINDER m_diameter;
void resetDefaults( wxCommandEvent& event ) override;
}; };
#endif // __dialog_junction_props__ #endif // __dialog_junction_props__

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2001 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2001 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,14 +35,6 @@ class LIB_TEXT;
class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE
{ {
private:
SYMBOL_EDIT_FRAME* m_parent;
LIB_TEXT* m_graphicText;
UNIT_BINDER m_posX;
UNIT_BINDER m_posY;
UNIT_BINDER m_textSize;
public: public:
DIALOG_LIB_EDIT_TEXT( SYMBOL_EDIT_FRAME* aParent, LIB_TEXT* aText ); DIALOG_LIB_EDIT_TEXT( SYMBOL_EDIT_FRAME* aParent, LIB_TEXT* aText );
~DIALOG_LIB_EDIT_TEXT() override {}; ~DIALOG_LIB_EDIT_TEXT() override {};
@ -52,6 +44,13 @@ public:
private: private:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
SYMBOL_EDIT_FRAME* m_parent;
LIB_TEXT* m_graphicText;
UNIT_BINDER m_posX;
UNIT_BINDER m_posY;
UNIT_BINDER m_textSize;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2015-2019 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -25,11 +25,6 @@
#ifndef __dialog_lib_new_component__ #ifndef __dialog_lib_new_component__
#define __dialog_lib_new_component__ #define __dialog_lib_new_component__
/**
* @file
* Subclass of DIALOG_LIB_NEW_COMPONENT, which is generated by wxFormBuilder.
*/
#include <widgets/unit_binder.h> #include <widgets/unit_binder.h>
#include <dialog_lib_new_component_base.h> #include <dialog_lib_new_component_base.h>
@ -37,13 +32,11 @@
class EDA_DRAW_FRAME; class EDA_DRAW_FRAME;
class wxArrayString; class wxArrayString;
/** Implementing DIALOG_LIB_NEW_COMPONENT */
class DIALOG_LIB_NEW_COMPONENT : public DIALOG_LIB_NEW_COMPONENT_BASE class DIALOG_LIB_NEW_COMPONENT : public DIALOG_LIB_NEW_COMPONENT_BASE
{ {
public: public:
/** Constructor */
DIALOG_LIB_NEW_COMPONENT( EDA_DRAW_FRAME* parent, DIALOG_LIB_NEW_COMPONENT( EDA_DRAW_FRAME* parent,
const wxArrayString* aRootSymbolNames = nullptr ); const wxArrayString* aRootSymbolNames = nullptr );
void SetName( const wxString& name ) override { m_textName->SetValue( name ); } void SetName( const wxString& name ) override { m_textName->SetValue( name ); }
wxString GetName( void ) const override { return m_textName->GetValue(); } wxString GetName( void ) const override { return m_textName->GetValue(); }

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -37,36 +37,7 @@ class WX_GRID;
class DIALOG_LIB_SYMBOL_PROPERTIES: public DIALOG_LIB_SYMBOL_PROPERTIES_BASE class DIALOG_LIB_SYMBOL_PROPERTIES: public DIALOG_LIB_SYMBOL_PROPERTIES_BASE
{ {
static int m_lastOpenedPage; // To remember the last notebook selection
enum LAST_LAYOUT {
NONE,
ALIAS,
PARENT
};
static LAST_LAYOUT m_lastLayout;
public: public:
SYMBOL_EDIT_FRAME* m_Parent;
LIB_PART* m_libEntry;
FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;
UNIT_BINDER m_pinNameOffset;
wxControl* m_delayedFocusCtrl;
WX_GRID* m_delayedFocusGrid;
int m_delayedFocusRow;
int m_delayedFocusColumn;
int m_delayedFocusPage;
wxString m_delayedErrorMessage;
wxString m_shownColumns;
int m_width;
public:
/// Constructors
DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PART* aLibEntry ); DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PART* aLibEntry );
~DIALOG_LIB_SYMBOL_PROPERTIES(); ~DIALOG_LIB_SYMBOL_PROPERTIES();
@ -97,6 +68,35 @@ private:
void adjustGridColumns( int aWidth ); void adjustGridColumns( int aWidth );
void syncControlStates( bool aIsAlias ); void syncControlStates( bool aIsAlias );
public:
SYMBOL_EDIT_FRAME* m_Parent;
LIB_PART* m_libEntry;
FIELDS_GRID_TABLE<LIB_FIELD>* m_fields;
UNIT_BINDER m_pinNameOffset;
wxControl* m_delayedFocusCtrl;
WX_GRID* m_delayedFocusGrid;
int m_delayedFocusRow;
int m_delayedFocusColumn;
int m_delayedFocusPage;
wxString m_delayedErrorMessage;
wxString m_shownColumns;
int m_width;
private:
static int m_lastOpenedPage; // To remember the last notebook selection
enum LAST_LAYOUT {
NONE,
ALIAS,
PARENT
};
static LAST_LAYOUT m_lastLayout;
}; };
#endif // DIALOG_LIB_SYMBOL_PROPERTIES_H #endif // DIALOG_LIB_SYMBOL_PROPERTIES_H

View File

@ -2,6 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2018 CERN * Copyright (C) 2018 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jon Evans <jon@craftyjon.com> * @author Jon Evans <jon@craftyjon.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -51,10 +52,6 @@ public:
private: private:
SCH_EDIT_FRAME* m_frame;
unsigned m_selected_index;
void loadGraphData(); void loadGraphData();
void updateUi(); void updateUi();
@ -65,6 +62,11 @@ private:
void onAcceptClicked( wxCommandEvent& aEvent ); void onAcceptClicked( wxCommandEvent& aEvent );
SCH_EDIT_FRAME* m_frame;
unsigned m_selected_index;
std::vector<BUS_MIGRATION_STATUS> m_items; std::vector<BUS_MIGRATION_STATUS> m_items;
}; };

View File

@ -68,7 +68,26 @@ enum panel_netlist_index {
/* wxPanels for creating the NoteBook pages for each netlist format: */ /* wxPanels for creating the NoteBook pages for each netlist format: */
class NETLIST_PAGE_DIALOG : public wxPanel class NETLIST_PAGE_DIALOG : public wxPanel
{ {
public: public:
/**
* Create a setup page for one netlist format.
*
* Used in Netlist format dialog box creation.
*
* @param parent is the wxNotebook parent.
* @param title is the title of the notebook page.
* @param id_NetType is the netlist ID type.
*/
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
NETLIST_TYPE_ID id_NetType );
~NETLIST_PAGE_DIALOG() { };
/**
* @return the name of the netlist format for this page.
*/
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_AdjustPassiveValues; wxCheckBox* m_AdjustPassiveValues;
@ -81,43 +100,19 @@ public:
private: private:
wxString m_pageNetFmtName; wxString m_pageNetFmtName;
public:
/** Constructor to create a setup page for one netlist format.
* Used in Netlist format Dialog box creation
* @param parent = wxNotebook * parent
* @param title = title (name) of the notebook page
* @param id_NetType = netlist type id
*/
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
NETLIST_TYPE_ID id_NetType );
~NETLIST_PAGE_DIALOG() { };
/**
* function GetPageNetFmtName
* @return the name of the netlist format for this page
* This is also the page label.
*/
const wxString GetPageNetFmtName() { return m_pageNetFmtName; }
}; };
/* Dialog frame for creating netlists */ /* Dialog frame for creating netlists */
class NETLIST_DIALOG : public NETLIST_DIALOG_BASE class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
{ {
friend class NETLIST_PAGE_DIALOG;
public: public:
SCH_EDIT_FRAME* m_Parent;
wxString m_DefaultNetFmtName;
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
public:
// Constructor and destructor
NETLIST_DIALOG( SCH_EDIT_FRAME* parent ); NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
~NETLIST_DIALOG() { }; ~NETLIST_DIALOG() { };
private: private:
friend class NETLIST_PAGE_DIALOG;
void InstallCustomPages(); void InstallCustomPages();
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle, NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
const wxString & aCommandString, const wxString & aCommandString,
@ -130,54 +125,52 @@ private:
void OnNetlistTypeSelection( wxNotebookEvent& event ) override; void OnNetlistTypeSelection( wxNotebookEvent& event ) override;
/** /**
* Function OnAddGenerator * Add a new panel for a new netlist plugin.
* Add a new panel for a new netlist plugin
*/ */
void OnAddGenerator( wxCommandEvent& event ) override; void OnAddGenerator( wxCommandEvent& event ) override;
/** /**
* Function OnDelGenerator * Remove a panel relative to a netlist plugin.
* Remove a panel relative to a netlist plugin
*/ */
void OnDelGenerator( wxCommandEvent& event ) override; void OnDelGenerator( wxCommandEvent& event ) override;
/** /**
* Run the external spice simulator command * Run the external spice simulator command.
*/ */
void OnRunExternSpiceCommand( wxCommandEvent& event ); void OnRunExternSpiceCommand( wxCommandEvent& event );
/** /**
* Enable (if the command line is not empty or disable the button to run spice command * Enable (if the command line is not empty or disable the button to run spice command.
*/ */
void OnRunSpiceButtUI( wxUpdateUIEvent& event ); void OnRunSpiceButtUI( wxUpdateUIEvent& event );
/** /**
* Function WriteCurrentNetlistSetup * Write the current netlist options setup in the configuration.
* Write the current netlist options setup in the configuration
*/ */
void WriteCurrentNetlistSetup(); void WriteCurrentNetlistSetup();
/** /**
* Function FilenamePrms * Return the filename extension and the wildcard string for this page or a void name
* returns the filename extension and the wildcard string for this curr * if there is no default name.
* or a void name if there is no default name *
* @param aType = the netlist type ( NET_TYPE_PCBNEW ... ) * @param aType is the netlist type ( NET_TYPE_PCBNEW ... ).
* @param aExt = a reference to a wxString to return the default file ext. * @param aExt [in] is a holder for the netlist file extension.
* @param aWildCard = reference to a wxString to return the default wildcard. * @param aWildCard [in] is a holder for netlist file dialog wildcard.
* @return true for known netlist type, false for custom formats * @return true for known netlist type, false for custom formats.
*/ */
bool FilenamePrms( NETLIST_TYPE_ID aType, bool FilenamePrms( NETLIST_TYPE_ID aType, wxString* aExt, wxString* aWildCard );
wxString * aExt, wxString * aWildCard );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
public:
SCH_EDIT_FRAME* m_Parent;
wxString m_DefaultNetFmtName;
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
}; };
class NETLIST_DIALOG_ADD_GENERATOR : public NETLIST_DIALOG_ADD_GENERATOR_BASE class NETLIST_DIALOG_ADD_GENERATOR : public NETLIST_DIALOG_ADD_GENERATOR_BASE
{ {
private:
NETLIST_DIALOG* m_Parent;
public: public:
NETLIST_DIALOG_ADD_GENERATOR( NETLIST_DIALOG* parent ); NETLIST_DIALOG_ADD_GENERATOR( NETLIST_DIALOG* parent );
@ -186,7 +179,6 @@ public:
private: private:
/** /**
* Function OnOKClick
* Validate info relative to a new netlist plugin * Validate info relative to a new netlist plugin
*/ */
void OnOKClick( wxCommandEvent& event ) override; void OnOKClick( wxCommandEvent& event ) override;
@ -195,6 +187,8 @@ 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;
NETLIST_DIALOG* m_Parent;
}; };
@ -725,7 +719,7 @@ int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
int ret = dlg.ShowModal(); int ret = dlg.ShowModal();
// Update the default netlist and store it in prj config if it was explicitely changed. // Update the default netlist and store it in prj config if it was explicitly changed.
settings.m_NetFormatName = dlg.m_DefaultNetFmtName; // can have temporary changed settings.m_NetFormatName = dlg.m_DefaultNetFmtName; // can have temporary changed
if( curr_default_netformat != dlg.m_DefaultNetFmtName ) if( curr_default_netformat != dlg.m_DefaultNetFmtName )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2014-2021 KiCad Developers, see AUTHOR.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -51,9 +51,26 @@ enum COL_ORDER
class ALT_PIN_DATA_MODEL; class ALT_PIN_DATA_MODEL;
/** Implementing DIALOG_LIB_EDIT_PIN_BASE */
class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE
{ {
public:
DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN* aPin );
~DIALOG_PIN_PROPERTIES() override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void OnPaintShowPanel( wxPaintEvent& event ) override;
void OnPropertiesChange( wxCommandEvent& event ) override;
void OnAddAlternate( wxCommandEvent& event ) override;
void OnDeleteAlternate( wxCommandEvent& event ) override;
void OnSize( wxSizeEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
protected:
void adjustGridColumns( int aWidth );
private:
SYMBOL_EDIT_FRAME* m_frame; SYMBOL_EDIT_FRAME* m_frame;
LIB_PIN* m_pin; LIB_PIN* m_pin;
LIB_PIN* m_dummyPin; // a working copy used to show changes LIB_PIN* m_dummyPin; // a working copy used to show changes
@ -74,24 +91,6 @@ class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE
int m_originalColWidths[ COL_COUNT ]; int m_originalColWidths[ COL_COUNT ];
int m_width; int m_width;
bool m_initialized; bool m_initialized;
public:
/** Constructor */
DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN* aPin );
~DIALOG_PIN_PROPERTIES() override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void OnPaintShowPanel( wxPaintEvent& event ) override;
void OnPropertiesChange( wxCommandEvent& event ) override;
void OnAddAlternate( wxCommandEvent& event ) override;
void OnDeleteAlternate( wxCommandEvent& event ) override;
void OnSize( wxSizeEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
protected:
void adjustGridColumns( int aWidth );
}; };
#endif // __dialog_lib_edit_pin__ #endif // __dialog_lib_edit_pin__

View File

@ -1,13 +1,10 @@
/** @file dialog_plot_schematic.h
*/
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2010 Lorenzo Marcantonio * Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -27,6 +24,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file dialog_plot_schematic.h
*/
#ifndef __DIALOG_PLOT_SCHEMATIC__
#define __DIALOG_PLOT_SCHEMATIC__
#include <plotter.h> #include <plotter.h>
#include <sch_screen.h> #include <sch_screen.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
@ -34,7 +38,8 @@
#include <reporter.h> #include <reporter.h>
#include <widgets/unit_binder.h> #include <widgets/unit_binder.h>
enum PageFormatReq { enum PageFormatReq
{
PAGE_SIZE_AUTO, PAGE_SIZE_AUTO,
PAGE_SIZE_A4, PAGE_SIZE_A4,
PAGE_SIZE_A PAGE_SIZE_A
@ -52,23 +57,14 @@ class PDF_PLOTTER;
class DIALOG_PLOT_SCHEMATIC : public DIALOG_PLOT_SCHEMATIC_BASE class DIALOG_PLOT_SCHEMATIC : public DIALOG_PLOT_SCHEMATIC_BASE
{ {
private:
SCH_EDIT_FRAME* m_parent;
bool m_configChanged; // true if a project config param has changed
PLOT_FORMAT m_plotFormat;
static int m_pageSizeSelect; // Static to keep last option for some format
static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
double m_HPGLPenSize; // for HPGL format only: pen size
UNIT_BINDER m_defaultLineWidth;
UNIT_BINDER m_penWidth;
public: public:
// / Constructors // / Constructors
DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ); DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent );
bool PrjConfigChanged() { return m_configChanged; } // return true if the prj config was modified /**
// and therefore should be saved * Return true if the project configutation was modified.
*/
bool PrjConfigChanged() { return m_configChanged; }
private: private:
void OnPageSizeSelected( wxCommandEvent& event ) override; void OnPageSizeSelected( wxCommandEvent& event ) override;
@ -76,7 +72,7 @@ private:
void OnPlotAll( wxCommandEvent& event ) override; void OnPlotAll( wxCommandEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override; void OnUpdateUI( wxUpdateUIEvent& event ) override;
void initDlg(); void initDlg();
// common // common
void getPlotOptions( RENDER_SETTINGS* aSettings ); void getPlotOptions( RENDER_SETTINGS* aSettings );
@ -139,40 +135,64 @@ private:
switch( aOriginAndUnits ) switch( aOriginAndUnits )
{ {
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT: case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_BOT_LEFT:
default: m_plotOriginOpt->SetSelection( 0 ); break; default:
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER: m_plotOriginOpt->SetSelection( 1 ); break; m_plotOriginOpt->SetSelection( 0 );
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE: m_plotOriginOpt->SetSelection( 2 ); break; break;
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT: m_plotOriginOpt->SetSelection( 3 ); break;
case HPGL_PLOT_ORIGIN_AND_UNITS::PLOTTER_CENTER:
m_plotOriginOpt->SetSelection( 1 );
break;
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_PAGE:
m_plotOriginOpt->SetSelection( 2 );
break;
case HPGL_PLOT_ORIGIN_AND_UNITS::USER_FIT_CONTENT:
m_plotOriginOpt->SetSelection( 3 );
break;
} }
} }
void createHPGLFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings ); void createHPGLFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
void SetHPGLPenWidth(); void SetHPGLPenWidth();
bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen, bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef,
HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits ); HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits );
// PS // PS
void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings ); void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef ); wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
// SVG // SVG
void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings ); void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen, bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite, RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite,
bool aPlotFrameRef ); bool aPlotFrameRef );
/** /**
* Create a file name with an absolute path name * Create a file name with an absolute path name.
* @param aPlotFileName the name for the file to plot without a path *
* @param aExtension the extension for the file to plot * @param aPlotFileName the name for the file to plot without a path.
* @param aReporter a point to a REPORTER object use to show messages (can be NULL) * @param aExtension the extension for the file to plot.
* @return the created file name * @param aReporter a point to a REPORTER object use to show messages (can be NULL).
* @throw IO_ERROR on file I/O errors * @return the created file name.
* @throw IO_ERROR on file I/O errors.
*/ */
wxFileName createPlotFileName( const wxString& aPlotFileName, const wxString& aExtension, wxFileName createPlotFileName( const wxString& aPlotFileName, const wxString& aExtension,
REPORTER* aReporter = NULL ); REPORTER* aReporter = NULL );
SCH_EDIT_FRAME* m_parent;
bool m_configChanged; // true if a project config param has changed
PLOT_FORMAT m_plotFormat;
static int m_pageSizeSelect; // Static to keep last option for some format
static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
double m_HPGLPenSize; // for HPGL format only: pen size
UNIT_BINDER m_defaultLineWidth;
UNIT_BINDER m_penWidth;
}; };
#endif // __DIALOG_PLOT_SCHEMATIC__

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015-2020 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015-2021 KiCad Developers, see CHANGELOG.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -64,9 +64,6 @@ private:
*/ */
class SCH_PRINTOUT : public wxPrintout class SCH_PRINTOUT : public wxPrintout
{ {
private:
SCH_EDIT_FRAME* m_parent;
public: public:
SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle ) : SCH_PRINTOUT( SCH_EDIT_FRAME* aParent, const wxString& aTitle ) :
wxPrintout( aTitle ) wxPrintout( aTitle )
@ -80,6 +77,9 @@ public:
bool OnBeginDocument( int startPage, int endPage ) override; bool OnBeginDocument( int startPage, int endPage ) override;
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override; void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
void PrintPage( SCH_SCREEN* aScreen ); void PrintPage( SCH_SCREEN* aScreen );
private:
SCH_EDIT_FRAME* m_parent;
}; };
@ -254,8 +254,6 @@ void DIALOG_PRINT_USING_PRINTER::SavePrintOptions()
} }
/* Open a dialog box for printer setup (printer options, page size ...)
*/
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
{ {
wxPageSetupDialog pageSetupDialog( this, &m_parent->GetPageSetupData() ); wxPageSetupDialog pageSetupDialog( this, &m_parent->GetPageSetupData() );
@ -265,8 +263,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
} }
/* Open and display a previewer frame for printing
*/
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
{ {
SavePrintOptions(); SavePrintOptions();
@ -486,7 +482,7 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
if( cfg->m_Printing.use_theme && theme ) if( cfg->m_Printing.use_theme && theme )
renderSettings.LoadColors( theme ); renderSettings.LoadColors( theme );
// The drawing-sheet-item print code is shared between PCBNew and EESchema, so it's easier // The drawing-sheet-item print code is shared between PCBNew and Eeschema, so it's easier
// if they just use the PCB layer. // if they just use the PCB layer.
renderSettings.SetLayerColor( LAYER_DRAWINGSHEET, renderSettings.SetLayerColor( LAYER_DRAWINGSHEET,
renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) ); renderSettings.GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) );

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -33,10 +33,6 @@ class SCH_EDIT_FRAME;
class DIALOG_SCH_IMPORT_SETTINGS : public DIALOG_SCH_IMPORT_SETTINGS_BASE class DIALOG_SCH_IMPORT_SETTINGS : public DIALOG_SCH_IMPORT_SETTINGS_BASE
{ {
protected:
SCH_EDIT_FRAME* m_frame;
static wxString m_filePath;
public: public:
DIALOG_SCH_IMPORT_SETTINGS( wxWindow* aParent, SCH_EDIT_FRAME* aFrame ); DIALOG_SCH_IMPORT_SETTINGS( wxWindow* aParent, SCH_EDIT_FRAME* aFrame );
@ -47,6 +43,10 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
wxString GetFilePath() { return m_filePath; } wxString GetFilePath() { return m_filePath; }
protected:
SCH_EDIT_FRAME* m_frame;
static wxString m_filePath;
}; };
#endif //KICAD_DIALOG_SCH_IMPORT_SETTINGS_H #endif //KICAD_DIALOG_SCH_IMPORT_SETTINGS_H

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2010 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2010-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2010-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -46,6 +46,17 @@ class SCH_EDITOR_CONTROL;
class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE
{ {
public:
DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, wxFindReplaceData* aData,
const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize, int aStyle = 0 );
void SetFindEntries( const wxArrayString& aEntries );
wxArrayString GetFindEntries() const;
void SetReplaceEntries( const wxArrayString& aEntries );
wxArrayString GetReplaceEntries() const { return m_comboReplace->GetStrings(); }
protected: protected:
// Handlers for DIALOG_SCH_FIND_BASE events. // Handlers for DIALOG_SCH_FIND_BASE events.
void OnClose( wxCloseEvent& aEvent ) override; void OnClose( wxCloseEvent& aEvent ) override;
@ -70,17 +81,6 @@ protected:
bool m_findDirty; bool m_findDirty;
DECLARE_NO_COPY_CLASS( DIALOG_SCH_FIND ) DECLARE_NO_COPY_CLASS( DIALOG_SCH_FIND )
public:
DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, wxFindReplaceData* aData,
const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize, int aStyle = 0 );
void SetFindEntries( const wxArrayString& aEntries );
wxArrayString GetFindEntries() const;
void SetReplaceEntries( const wxArrayString& aEntries );
wxArrayString GetReplaceEntries() const { return m_comboReplace->GetStrings(); }
}; };

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2010 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -36,13 +36,6 @@ class HTML_MESSAGE_BOX;
class DIALOG_SHEET_PIN_PROPERTIES : public DIALOG_SHEET_PIN_PROPERTIES_BASE class DIALOG_SHEET_PIN_PROPERTIES : public DIALOG_SHEET_PIN_PROPERTIES_BASE
{ {
SCH_EDIT_FRAME* m_frame;
SCH_SHEET_PIN* m_sheetPin;
UNIT_BINDER m_textSize;
HTML_MESSAGE_BOX* m_helpWindow;
public: public:
DIALOG_SHEET_PIN_PROPERTIES( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin ); DIALOG_SHEET_PIN_PROPERTIES( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin );
~DIALOG_SHEET_PIN_PROPERTIES(); ~DIALOG_SHEET_PIN_PROPERTIES();
@ -54,6 +47,13 @@ private:
void onOKButton( wxCommandEvent& event ) override; void onOKButton( wxCommandEvent& event ) override;
void OnSyntaxHelp( wxHyperlinkEvent& event ) override; void OnSyntaxHelp( wxHyperlinkEvent& event ) override;
void onComboBox( wxCommandEvent& event ) override; void onComboBox( wxCommandEvent& event ) override;
SCH_EDIT_FRAME* m_frame;
SCH_SHEET_PIN* m_sheetPin;
UNIT_BINDER m_textSize;
HTML_MESSAGE_BOX* m_helpWindow;
}; };
#endif // DIALOG_SHEET_PIN_PROPERTIES_H #endif // DIALOG_SHEET_PIN_PROPERTIES_H

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2019 Alexander Shuklin <Jasuramme@gmail.com> * Copyright (C) 2019 Alexander Shuklin <Jasuramme@gmail.com>
* Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -28,31 +28,11 @@
#include <backannotate.h> #include <backannotate.h>
#include <dialog_update_from_pcb_base.h> #include <dialog_update_from_pcb_base.h>
// Forward declarations
class SCH_EDIT_FRAME; class SCH_EDIT_FRAME;
class SCH_EDITOR_CONTROL; class SCH_EDITOR_CONTROL;
class DIALOG_UPDATE_FROM_PCB : public DIALOG_UPDATE_FROM_PCB_BASE class DIALOG_UPDATE_FROM_PCB : public DIALOG_UPDATE_FROM_PCB_BASE
{ {
/**
* Struct containing the dialog last saved state
*/
struct DIALOG_UPDATE_FROM_PCB_SAVED_STATE
{
// Flags to remember last checkboxes state
bool MatchByReference;
bool UpdateReferences;
bool UpdateFootprints;
bool UpdateValues;
bool UpdateNetNames;
};
static DIALOG_UPDATE_FROM_PCB_SAVED_STATE s_savedDialogState;
private:
SCH_EDIT_FRAME* m_frame;
SCH_EDITOR_CONTROL* m_editorControl;
public: public:
DIALOG_UPDATE_FROM_PCB( SCH_EDIT_FRAME* aParent ); DIALOG_UPDATE_FROM_PCB( SCH_EDIT_FRAME* aParent );
~DIALOG_UPDATE_FROM_PCB(); ~DIALOG_UPDATE_FROM_PCB();
@ -63,6 +43,24 @@ private:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
void OnOptionChanged( wxCommandEvent& event ) override; void OnOptionChanged( wxCommandEvent& event ) override;
void OnUpdateClick( wxCommandEvent& event ) override; void OnUpdateClick( wxCommandEvent& event ) override;
/**
* Container for the dialog last saved state.
*/
struct DIALOG_UPDATE_FROM_PCB_SAVED_STATE
{
// Flags to remember last checkboxes state.
bool MatchByReference;
bool UpdateReferences;
bool UpdateFootprints;
bool UpdateValues;
bool UpdateNetNames;
};
static DIALOG_UPDATE_FROM_PCB_SAVED_STATE s_savedDialogState;
SCH_EDIT_FRAME* m_frame;
SCH_EDITOR_CONTROL* m_editorControl;
}; };
#endif #endif

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -29,16 +29,15 @@ class GAL_OPTIONS_PANEL;
class PANEL_EESCHEMA_DISPLAY_OPTIONS : public PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE class PANEL_EESCHEMA_DISPLAY_OPTIONS : public PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE
{ {
SCH_EDIT_FRAME* m_frame;
GAL_OPTIONS_PANEL* m_galOptsPanel;
public: public:
PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ); PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow );
private: private:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
SCH_EDIT_FRAME* m_frame;
GAL_OPTIONS_PANEL* m_galOptsPanel;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017-2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -28,17 +28,16 @@ class SCH_EDIT_FRAME;
class PANEL_EESCHEMA_EDITING_OPTIONS : public PANEL_EESCHEMA_EDITING_OPTIONS_BASE class PANEL_EESCHEMA_EDITING_OPTIONS : public PANEL_EESCHEMA_EDITING_OPTIONS_BASE
{ {
SCH_EDIT_FRAME* m_frame;
UNIT_BINDER m_hPitch;
UNIT_BINDER m_vPitch;
public: public:
PANEL_EESCHEMA_EDITING_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ); PANEL_EESCHEMA_EDITING_OPTIONS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow );
private: private:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
SCH_EDIT_FRAME* m_frame;
UNIT_BINDER m_hPitch;
UNIT_BINDER m_vPitch;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -28,41 +28,33 @@ class SCH_EDIT_FRAME;
class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES : public PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES : public PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
{ {
protected:
SCH_EDIT_FRAME* m_frame;
TEMPLATE_FIELDNAMES m_fields;
bool m_global; // Editing global (vs. project) fieldname templates
int m_checkboxColWidth;
/**
* Function OnAddButtonClick
* Process the wxWidgets @a event produced when the user presses the Add buton for the
* template fieldnames control
*
* @param event The wxWidgets produced event information
*
* Adds a new template fieldname (with default values) to the template fieldnames data
*/
void OnAddButtonClick( wxCommandEvent& event ) override;
/**
* Function OnDeleteButtonClick
* Process the wxWidgets @a event produced when the user presses the Delete button for the
* template fieldnames control
*
* @param event The wxWidgets produced event information
*
* Deletes the selected template fieldname from the template fieldnames data
*/
void OnDeleteButtonClick( wxCommandEvent& event ) override;
public: public:
PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow, bool aGlobal ); PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow, bool aGlobal );
~PANEL_EESCHEMA_TEMPLATE_FIELDNAMES() override; ~PANEL_EESCHEMA_TEMPLATE_FIELDNAMES() override;
void ImportSettingsFrom( TEMPLATES* templateMgr ); void ImportSettingsFrom( TEMPLATES* templateMgr );
protected:
/**
* Adds a new template fieldname (with default values) to the template fieldnames data.
*
* Process the wxWidgets @a event produced when the user presses the Add buton for the
* template fieldnames control.
*
* @param event The wxWidgets produced event information
*/
void OnAddButtonClick( wxCommandEvent& event ) override;
/**
* Deletes the selected template fieldname from the template fieldnames data.
*
* Process the wxWidgets @a event produced when the user presses the Delete button for the
* template fieldnames control.
*
* @param event The wxWidgets produced event information
*/
void OnDeleteButtonClick( wxCommandEvent& event ) override;
private: private:
void AdjustGridColumns( int aWidth ); void AdjustGridColumns( int aWidth );
@ -73,6 +65,13 @@ private:
bool TransferDataToGrid(); bool TransferDataToGrid();
bool TransferDataFromGrid(); bool TransferDataFromGrid();
protected:
SCH_EDIT_FRAME* m_frame;
TEMPLATE_FIELDNAMES m_fields;
bool m_global; // Editing global (vs. project) fieldname templates
int m_checkboxColWidth;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -30,13 +30,6 @@ class GAL_OPTIONS_PANEL;
class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE class PANEL_SETUP_FORMATTING : public PANEL_SETUP_FORMATTING_BASE
{ {
SCH_EDIT_FRAME* m_frame;
UNIT_BINDER m_textSize;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_pinSymbolSize;
public: public:
PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame ); PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame );
@ -47,6 +40,14 @@ public:
protected: protected:
void onCheckBoxIref( wxCommandEvent& event ) override; void onCheckBoxIref( wxCommandEvent& event ) override;
private:
SCH_EDIT_FRAME* m_frame;
UNIT_BINDER m_textSize;
UNIT_BINDER m_lineWidth;
UNIT_BINDER m_pinSymbolSize;
}; };

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -37,14 +37,6 @@ class SCHEMATIC;
class PANEL_SETUP_PINMAP : public PANEL_SETUP_PINMAP_BASE class PANEL_SETUP_PINMAP : public PANEL_SETUP_PINMAP_BASE
{ {
DECLARE_EVENT_TABLE()
private:
SCH_EDIT_FRAME* m_parent;
SCHEMATIC* m_schematic;
wxBitmapButton* m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
bool m_initialized;
public: public:
PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* aParent ); PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* aParent );
@ -56,9 +48,14 @@ private:
void changeErrorLevel( wxCommandEvent& event ); void changeErrorLevel( wxCommandEvent& event );
void reBuildMatrixPanel(); void reBuildMatrixPanel();
void setDRCMatrixButtonState( wxBitmapButton *aButton, PIN_ERROR aState ); void setDRCMatrixButtonState( wxBitmapButton *aButton, PIN_ERROR aState );
DECLARE_EVENT_TABLE()
SCH_EDIT_FRAME* m_parent;
SCHEMATIC* m_schematic;
wxBitmapButton* m_buttonList[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];
bool m_initialized;
}; };
#endif #endif // _PANEL_SETUP_PINMAP_H_
// _PANEL_SETUP_PINMAP_H_

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -31,8 +31,6 @@ class SYMBOL_EDIT_FRAME;
class PANEL_SYM_COLOR_SETTINGS : public PANEL_SYM_COLOR_SETTINGS_BASE class PANEL_SYM_COLOR_SETTINGS : public PANEL_SYM_COLOR_SETTINGS_BASE
{ {
SYMBOL_EDIT_FRAME* m_frame;
public: public:
PANEL_SYM_COLOR_SETTINGS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow ); PANEL_SYM_COLOR_SETTINGS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow );
@ -43,6 +41,8 @@ private:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
SYMBOL_EDIT_FRAME* m_frame;
}; };
#endif #endif

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -28,6 +28,13 @@ class SYMBOL_EDIT_FRAME;
class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE
{ {
public:
PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
SYMBOL_EDIT_FRAME* m_frame; SYMBOL_EDIT_FRAME* m_frame;
UNIT_BINDER m_lineWidth; UNIT_BINDER m_lineWidth;
@ -39,13 +46,6 @@ class PANEL_SYM_EDITING_OPTIONS : public PANEL_SYM_EDITING_OPTIONS_BASE
UNIT_BINDER m_hPitch; UNIT_BINDER m_hPitch;
UNIT_BINDER m_vPitch; UNIT_BINDER m_vPitch;
public:
PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame, wxWindow* aWindow );
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
}; };