More header clean up.
This commit is contained in:
parent
e6346e3103
commit
6b5d512b9f
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2018 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -60,35 +60,6 @@ typedef std::vector< CVPCB_UNDO_REDO_ENTRIES > CVPCB_UNDO_REDO_LIST;
|
|||
*/
|
||||
class CVPCB_MAINFRAME : public KIWAY_PLAYER
|
||||
{
|
||||
friend struct CV::IFACE;
|
||||
|
||||
NETLIST m_netlist;
|
||||
int m_filteringOptions;
|
||||
ACTION_TOOLBAR* m_mainToolBar;
|
||||
FOOTPRINTS_LISTBOX* m_footprintListBox;
|
||||
LIBRARY_LISTBOX* m_librariesListBox;
|
||||
COMPONENTS_LISTBOX* m_symbolsListBox;
|
||||
wxTextCtrl* m_tcFilterString;
|
||||
wxStaticText* m_statusLine1;
|
||||
wxStaticText* m_statusLine2;
|
||||
wxStaticText* m_statusLine3;
|
||||
wxButton* m_saveAndContinue;
|
||||
|
||||
public:
|
||||
FOOTPRINT_LIST* m_FootprintsList;
|
||||
|
||||
protected:
|
||||
bool m_modified;
|
||||
bool m_skipComponentSelect; // skip component selection event during
|
||||
// automatic selection/deletion of
|
||||
// associations
|
||||
|
||||
bool m_initialized;
|
||||
|
||||
CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
void setupUIConditions() override;
|
||||
|
||||
public:
|
||||
~CVPCB_MAINFRAME();
|
||||
|
||||
|
@ -107,7 +78,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* The type of the controls present in the application
|
||||
* The type of the controls present in the application.
|
||||
*/
|
||||
enum CONTROL_TYPE
|
||||
{
|
||||
|
@ -118,7 +89,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* Directions to rotate the focus through the listboxes is
|
||||
* Directions to rotate the focus through the listboxes is.
|
||||
*/
|
||||
enum FOCUS_DIR
|
||||
{
|
||||
|
@ -127,7 +98,7 @@ public:
|
|||
};
|
||||
|
||||
/**
|
||||
* Directions to move when selecting items
|
||||
* Directions to move when selecting items.
|
||||
*/
|
||||
enum ITEM_DIR
|
||||
{
|
||||
|
@ -155,7 +126,7 @@ public:
|
|||
/**
|
||||
* Find out which control currently has focus.
|
||||
*
|
||||
* @return the contorl that currently has focus
|
||||
* @return the control that currently has focus
|
||||
*/
|
||||
CVPCB_MAINFRAME::CONTROL_TYPE GetFocusedControl() const;
|
||||
|
||||
|
@ -169,13 +140,12 @@ public:
|
|||
/**
|
||||
* Set the focus to a specific control.
|
||||
*
|
||||
* @param aControl the contorl to set focus to
|
||||
* @param aControl the control to set focus to
|
||||
*/
|
||||
void SetFocusedControl( CVPCB_MAINFRAME::CONTROL_TYPE aControl );
|
||||
|
||||
/**
|
||||
* Function OnSelectComponent
|
||||
* Called when clicking on a component in component list window
|
||||
* Called when clicking on a component in component list window:
|
||||
* * Updates the filtered footprint list, if the filtered list option is selected
|
||||
* * Updates the current selected footprint in footprint list
|
||||
* * Updates the footprint shown in footprint display window (if opened)
|
||||
|
@ -204,29 +174,26 @@ public:
|
|||
void AutomaticFootprintMatching();
|
||||
|
||||
/**
|
||||
* Function SetFootprintFilter
|
||||
* Set a filter criteria to either on/off or toggle the criteria.
|
||||
*
|
||||
* @param aFilter The filter to modify
|
||||
* @param aAction What action (on, off or toggle) to take
|
||||
*/
|
||||
void SetFootprintFilter(
|
||||
FOOTPRINTS_LISTBOX::FP_FILTER_T aFilter, CVPCB_MAINFRAME::CVPCB_FILTER_ACTION aAction );
|
||||
void SetFootprintFilter( FOOTPRINTS_LISTBOX::FP_FILTER_T aFilter,
|
||||
CVPCB_MAINFRAME::CVPCB_FILTER_ACTION aAction );
|
||||
|
||||
/**
|
||||
* Function OnEnterFilteringText
|
||||
* Is called each time the text of m_tcFilterString is changed.
|
||||
* Called each time the text of m_tcFilterString is changed.
|
||||
*/
|
||||
void OnEnterFilteringText( wxCommandEvent& event );
|
||||
|
||||
|
||||
/**
|
||||
* Undo the most recent associations that were performed.
|
||||
*/
|
||||
void UndoAssociation();
|
||||
|
||||
/**
|
||||
* Redo the most recently undone association
|
||||
* Redo the most recently undone association.
|
||||
*/
|
||||
void RedoAssociation();
|
||||
|
||||
|
@ -262,26 +229,25 @@ public:
|
|||
void BuildLibrariesListBox();
|
||||
|
||||
/**
|
||||
* Function SaveFootprintAssociation
|
||||
* saves the edits that the user has done by sending them back to eeschema
|
||||
* via the kiway.
|
||||
* Save the edits that the user has done by sending them back to Eeschema via the kiway.
|
||||
*
|
||||
* Optionally saves the schematic to disk as well.
|
||||
*/
|
||||
bool SaveFootprintAssociation( bool doSaveSchematic );
|
||||
|
||||
/**
|
||||
* Function ReadNetListAndFpFiles
|
||||
* loads the netlist file built on the fly by Eeschema and loads
|
||||
* footprint libraries from fp lib tables.
|
||||
* @param aNetlist is the netlist from eeschema in kicad s-expr format.
|
||||
* Load the netlist file built on the fly by Eeschema and loads footprint libraries from
|
||||
* fp lib tables.
|
||||
*
|
||||
* @param aNetlist is the netlist from Eeschema in KiCad s-expr format.
|
||||
* (see CVPCB_MAINFRAME::KiwayMailIn() to know how to get this netlist)
|
||||
*/
|
||||
bool ReadNetListAndFpFiles( const std::string& aNetlist );
|
||||
|
||||
/**
|
||||
* Function ReadSchematicNetlist
|
||||
* read the netlist (.net) file built on the fly by Eeschema.
|
||||
* @param aNetlist is the netlist buffer filled by eeschema, in kicad s-expr format.
|
||||
* Read the netlist (.net) file built on the fly by Eeschema.
|
||||
*
|
||||
* @param aNetlist is the netlist buffer filled by Eeschema, in KiCad s-expr format.
|
||||
* It is the same netlist as the .net file created by Eeschema.
|
||||
* (This method is called by ReadNetListAndFpFiles)
|
||||
*/
|
||||
|
@ -292,8 +258,7 @@ public:
|
|||
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
|
||||
|
||||
/**
|
||||
* Function DisplayStatus
|
||||
* updates the information displayed on the status bar at bottom of the main frame.
|
||||
* Update the information displayed on the status bar at bottom of the main frame.
|
||||
*
|
||||
* When the library or component list controls have the focus, the footprint assignment
|
||||
* status of the components is displayed in the first status bar pane and the list of
|
||||
|
@ -306,24 +271,25 @@ public:
|
|||
void DisplayStatus();
|
||||
|
||||
/**
|
||||
* Function LoadFootprintFiles
|
||||
* reads the list of footprint (*.mod files) and generate the list of footprints.
|
||||
* for each footprint are stored
|
||||
* the footprint name
|
||||
* documentation string
|
||||
* associated keywords
|
||||
* fills m_footprints
|
||||
* Read the list of footprint (*.mod files) and generate the list of footprints.
|
||||
*
|
||||
* For each footprint the following items are stored:
|
||||
* - the footprint name
|
||||
* - documentation string
|
||||
* - associated keywords
|
||||
*
|
||||
* @return true if libraries are found, false otherwise.
|
||||
*/
|
||||
bool LoadFootprintFiles();
|
||||
|
||||
/**
|
||||
* Function SendMessageToEESCHEMA
|
||||
* Send a remote command to Eeschema via a socket,
|
||||
* Commands are
|
||||
*
|
||||
* Commands are:
|
||||
* $PART: "reference" put cursor on component anchor
|
||||
* @param aClearHighligntOnly = true if the message to send is only "clear highlight"
|
||||
* (used when exiting Cvpcb)
|
||||
*
|
||||
* @param aClearHighligntOnly use true if the message to send is only "clear highlight"
|
||||
* (used when exiting CvPcb)
|
||||
*/
|
||||
void SendMessageToEESCHEMA( bool aClearHighligntOnly = false );
|
||||
|
||||
|
@ -371,6 +337,11 @@ public:
|
|||
|
||||
void SetStatusText( const wxString& aText, int aNumber = 0 ) override;
|
||||
|
||||
protected:
|
||||
CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
void setupUIConditions() override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Setup the tool system for the CVPCB main frame.
|
||||
|
@ -383,16 +354,44 @@ private:
|
|||
void setupEventHandlers();
|
||||
|
||||
/**
|
||||
* read the .equ files and populate the list of equvalents
|
||||
* Read the .equ files and populate the list of equivalents.
|
||||
*
|
||||
* @param aList the list to populate
|
||||
* @param aErrorMessages is a pointer to a wxString to store error messages
|
||||
* (can be NULL)
|
||||
* @return the error count ( 0 = no error)
|
||||
*/
|
||||
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList, wxString * aErrorMessages = NULL );
|
||||
int buildEquivalenceList( FOOTPRINT_EQUIVALENCE_LIST& aList,
|
||||
wxString* aErrorMessages = nullptr );
|
||||
|
||||
void refreshAfterSymbolSearch( COMPONENT* aSymbol );
|
||||
|
||||
public:
|
||||
FOOTPRINT_LIST* m_FootprintsList;
|
||||
|
||||
protected:
|
||||
bool m_modified;
|
||||
bool m_skipComponentSelect; // skip component selection event during
|
||||
// automatic selection/deletion of
|
||||
// associations
|
||||
|
||||
bool m_initialized;
|
||||
|
||||
private:
|
||||
friend struct CV::IFACE;
|
||||
|
||||
NETLIST m_netlist;
|
||||
int m_filteringOptions;
|
||||
ACTION_TOOLBAR* m_mainToolBar;
|
||||
FOOTPRINTS_LISTBOX* m_footprintListBox;
|
||||
LIBRARY_LISTBOX* m_librariesListBox;
|
||||
COMPONENTS_LISTBOX* m_symbolsListBox;
|
||||
wxTextCtrl* m_tcFilterString;
|
||||
wxStaticText* m_statusLine1;
|
||||
wxStaticText* m_statusLine2;
|
||||
wxStaticText* m_statusLine3;
|
||||
wxButton* m_saveAndContinue;
|
||||
|
||||
// Tool dispatcher
|
||||
TOOL_DISPATCHER* m_toolDispatcher;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010-2015 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2015 Kicad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 1992-2021 Kicad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -33,11 +33,9 @@
|
|||
|
||||
class DIALOG_CONFIG_EQUFILES : public DIALOG_CONFIG_EQUFILES_BASE
|
||||
{
|
||||
private:
|
||||
CVPCB_MAINFRAME* m_Parent;
|
||||
wxString m_UserLibDirBufferImg;
|
||||
|
||||
bool m_ListChanged;
|
||||
public:
|
||||
DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* parent );
|
||||
~DIALOG_CONFIG_EQUFILES() {};
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
@ -61,9 +59,10 @@ private:
|
|||
return m_rbPathOptionChoice->GetSelection() == 1;
|
||||
}
|
||||
|
||||
public:
|
||||
DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* parent );
|
||||
~DIALOG_CONFIG_EQUFILES() {};
|
||||
CVPCB_MAINFRAME* m_Parent;
|
||||
wxString m_UserLibDirBufferImg;
|
||||
|
||||
bool m_ListChanged;
|
||||
};
|
||||
|
||||
#endif // _DIALOG_CONFIG_EQUFILES_H_
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2010-2014 Jean-Pierre Charras <jp.charras at wanadoo.fr>
|
||||
* Copyright (C) 1992-2014 Kicad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 1992-2021 Kicad Developers, see CHANGELOG.TXT for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -31,38 +31,28 @@
|
|||
|
||||
class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR : public DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR_BASE
|
||||
{
|
||||
private:
|
||||
enum COL_ID
|
||||
{
|
||||
COL_REF, COL_FPSCH, COL_SELSCH, COL_SELCMP, COL_FPCMP,
|
||||
COL_COUNT
|
||||
};
|
||||
|
||||
int m_lineCount;
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR( wxWindow* parent );
|
||||
|
||||
/**
|
||||
* Add a line to the selection list.
|
||||
* @param aRef = component reference text
|
||||
* @param aFpSchName = fpid text from the netlist
|
||||
* @param aFpCmpName = fpid text from the .cmp file
|
||||
*
|
||||
* @param aRef is the component reference text.
|
||||
* @param aFpSchName is the fpid text from the netlist.
|
||||
* @param aFpCmpName is the fpid text from the .cmp file.
|
||||
*/
|
||||
void Add( const wxString& aRef, const wxString& aFpSchName,
|
||||
const wxString& aFpCmpName );
|
||||
void Add( const wxString& aRef, const wxString& aFpSchName, const wxString& aFpCmpName );
|
||||
|
||||
/**
|
||||
* @param aReference is the compoent schematic reference.
|
||||
* @return the selection option:
|
||||
* 0 for fpid text from the netlist
|
||||
* 1 for fpid text from the cmp file
|
||||
* -1 on error
|
||||
* @param aReference = the compoent schematic reference
|
||||
*/
|
||||
int GetSelection( const wxString& aReference );
|
||||
|
||||
private:
|
||||
private:
|
||||
void OnSize( wxSizeEvent& event ) override;
|
||||
|
||||
// Virtual: called when clicking on the column title:
|
||||
|
@ -76,4 +66,11 @@ class DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR : public DIALOG_FP_CONFLICT_ASSIGNM
|
|||
|
||||
void recalculateColumns();
|
||||
|
||||
enum COL_ID
|
||||
{
|
||||
COL_REF, COL_FPSCH, COL_SELSCH, COL_SELCMP, COL_FPCMP,
|
||||
COL_COUNT
|
||||
};
|
||||
|
||||
int m_lineCount;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2018 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -35,9 +35,6 @@ class FOOTPRINT_LIST;
|
|||
#define LISTBOX_STYLE ( wxBORDER_NONE | wxLC_NO_HEADER | wxLC_REPORT | wxLC_VIRTUAL | \
|
||||
wxVSCROLL | wxHSCROLL )
|
||||
|
||||
/*********************************************************************/
|
||||
/* ListBox (base class) to display lists of components or footprints */
|
||||
/*********************************************************************/
|
||||
class ITEMS_LISTBOX_BASE : public wxListView
|
||||
{
|
||||
public:
|
||||
|
@ -60,8 +57,7 @@ public:
|
|||
|
||||
virtual CVPCB_MAINFRAME* GetParent() const;
|
||||
|
||||
/* Function UpdateWidth
|
||||
*
|
||||
/**
|
||||
* Update the width of the column based on its contents.
|
||||
*
|
||||
* @param aLine is the line to calculate the width from. If positive, the
|
||||
|
@ -77,16 +73,9 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/******************************************/
|
||||
/* ListBox showing the list of footprints */
|
||||
/******************************************/
|
||||
class FOOTPRINTS_LISTBOX : public ITEMS_LISTBOX_BASE
|
||||
{
|
||||
private:
|
||||
wxArrayString m_footprintList;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Filter setting constants. The filter type is a bitwise OR of these flags,
|
||||
* and only footprints matching all selected filter types are shown.
|
||||
|
@ -109,15 +98,14 @@ public:
|
|||
void AppendLine( const wxString& text );
|
||||
|
||||
/**
|
||||
* Function SetFootprints
|
||||
* populates the wxListCtrl with the footprints from \a aList that meet the filter
|
||||
* Populate the wxListCtrl with the footprints from \a aList that meet the filter
|
||||
* criteria defined by \a aFilterType.
|
||||
*
|
||||
* @param aList is a #FOOTPRINT_LIST item containing the footprints.
|
||||
* @param aLibName is wxString containing the name of the selected library. Can be
|
||||
* wxEmptyString.
|
||||
* @param aComponent is the #COMPONENT used by the filtering criteria. Can be NULL.
|
||||
* @param aFootPrintFilterPattern = a filter used to filter list by names
|
||||
* @param aFootPrintFilterPattern is the filter used to filter list by names.
|
||||
* @param aFilterType defines the criteria to filter \a aList.
|
||||
*/
|
||||
void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName, COMPONENT* aComponent,
|
||||
|
@ -126,9 +114,8 @@ public:
|
|||
wxString GetSelectedFootprint();
|
||||
|
||||
/**
|
||||
* Function OnGetItemText
|
||||
* this overloaded function MUST be provided for the wxLC_VIRTUAL mode
|
||||
* because real data is not handled by ITEMS_LISTBOX_BASE
|
||||
* This overloaded function MUST be provided for the wxLC_VIRTUAL mode
|
||||
* because real data is not handled by ITEMS_LISTBOX_BASE.
|
||||
*/
|
||||
wxString OnGetItemText( long item, long column ) const override;
|
||||
|
||||
|
@ -137,17 +124,15 @@ public:
|
|||
void OnLeftDClick( wxListEvent& event );
|
||||
void OnChar( wxKeyEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
private:
|
||||
wxArrayString m_footprintList;
|
||||
};
|
||||
|
||||
|
||||
/******************************************/
|
||||
/* ListBox showing the list of library */
|
||||
/******************************************/
|
||||
class LIBRARY_LISTBOX : public ITEMS_LISTBOX_BASE
|
||||
{
|
||||
wxArrayString m_libraryList;
|
||||
|
||||
public:
|
||||
LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
||||
~LIBRARY_LISTBOX();
|
||||
|
@ -167,33 +152,28 @@ public:
|
|||
void OnSelectLibrary( wxListEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnChar
|
||||
* called on a key pressed
|
||||
* Call default handler for some special keys,
|
||||
* and for "ascii" keys, select the first footprint
|
||||
* that the name starts by the letter.
|
||||
* This is the defaut behaviour of a listbox, but because we use
|
||||
* virtual lists, the listbox does not know anything to what is displayed,
|
||||
* we must handle this behaviour here.
|
||||
* Furthermore the footprint name is not at the beginning of
|
||||
* displayed lines (the first word is the line number)
|
||||
* Called on a key press.
|
||||
*
|
||||
* Call default handler for some special keys, and for "ascii" keys, select the first
|
||||
* footprint that the name starts by the letter.
|
||||
*
|
||||
* This is the default behavior of a listbox, but because we use virtual lists, the
|
||||
* listbox does not know anything to what is displayed, we must handle this behavior
|
||||
* here. Furthermore the footprint name is not at the beginning of displayed lines
|
||||
* (the first word is the line number).
|
||||
*/
|
||||
void OnChar( wxKeyEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
private:
|
||||
wxArrayString m_libraryList;
|
||||
};
|
||||
|
||||
|
||||
/****************************************************/
|
||||
/* ListBox showing the list of schematic components */
|
||||
/****************************************************/
|
||||
class COMPONENTS_LISTBOX : public ITEMS_LISTBOX_BASE
|
||||
{
|
||||
public:
|
||||
wxArrayString m_ComponentList;
|
||||
|
||||
public:
|
||||
|
||||
COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
||||
|
||||
~COMPONENTS_LISTBOX();
|
||||
|
@ -202,9 +182,8 @@ public:
|
|||
int GetCount();
|
||||
|
||||
/**
|
||||
* Function OnGetItemText
|
||||
* this overloaded function MUST be provided for the wxLC_VIRTUAL mode
|
||||
* because real data is not handled by ITEMS_LISTBOX_BASE
|
||||
* This overloaded function MUST be provided for the wxLC_VIRTUAL mode
|
||||
* because real data is not handled by #ITEMS_LISTBOX_BASE.
|
||||
*/
|
||||
wxString OnGetItemText( long item, long column ) const override;
|
||||
|
||||
|
@ -218,22 +197,24 @@ public:
|
|||
// Events functions:
|
||||
|
||||
/**
|
||||
* Function OnChar
|
||||
* called on a key pressed
|
||||
* Call default handler for some special keys,
|
||||
* and for "ascii" keys, select the first component
|
||||
* that the name starts by the letter.
|
||||
* This is the default behavior of a listbox, but because we use
|
||||
* virtual lists, the listbox does not know anything to what is displayed,
|
||||
* we must handle this behavior here.
|
||||
* Furthermore the reference of components is not at the beginning of
|
||||
* displayed lines (the first word is the line number)
|
||||
* Called on a key press.
|
||||
*
|
||||
* Call default handler for some special keys, and for "ascii" keys, select the first
|
||||
* component that the name starts by the letter.
|
||||
*
|
||||
* This is the default behavior of a listbox, but because we use virtual lists, the
|
||||
* listbox does not know anything to what is displayed, we must handle this behavior
|
||||
* here. Furthermore the reference of components is not at the beginning of displayed
|
||||
* lines (the first word is the line number).
|
||||
*/
|
||||
void OnChar( wxKeyEvent& event );
|
||||
|
||||
void OnSelectComponent( wxListEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
wxArrayString m_ComponentList;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -85,11 +85,11 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME ),
|
||||
m_propertiesPagelayout( nullptr ),
|
||||
m_propertiesFrameWidth( 200 ),
|
||||
m_originSelectBox( nullptr ),
|
||||
m_originSelectChoice( 0 ),
|
||||
m_pageSelectBox( nullptr ),
|
||||
m_propertiesPagelayout( nullptr )
|
||||
m_pageSelectBox( nullptr )
|
||||
{
|
||||
m_maximizeByDefault = true;
|
||||
m_userUnits = EDA_UNITS::MILLIMETRES;
|
||||
|
@ -202,7 +202,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
#if 0 //start with empty layout
|
||||
DS_DATA_MODEL::GetTheInstance().AllowVoidList( true );
|
||||
DS_DATA_MODEL::GetTheInstance().ClearList();
|
||||
#else // start with the default Kicad layout
|
||||
#else // start with the default KiCad layout
|
||||
DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet();
|
||||
#endif
|
||||
OnNewDrawingSheet();
|
||||
|
@ -283,17 +283,25 @@ void PL_EDITOR_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( ACTIONS::paste, ENABLE( SELECTION_CONDITIONS::Idle ) );
|
||||
mgr->SetConditions( ACTIONS::doDelete, ENABLE( SELECTION_CONDITIONS::NotEmpty ) );
|
||||
|
||||
mgr->SetConditions( ACTIONS::zoomTool, CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::selectionTool, CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::deleteTool, CHECK( cond.CurrentTool( ACTIONS::deleteTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::zoomTool,
|
||||
CHECK( cond.CurrentTool( ACTIONS::zoomTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::selectionTool,
|
||||
CHECK( cond.CurrentTool( ACTIONS::selectionTool ) ) );
|
||||
mgr->SetConditions( ACTIONS::deleteTool,
|
||||
CHECK( cond.CurrentTool( ACTIONS::deleteTool ) ) );
|
||||
|
||||
mgr->SetConditions( PL_ACTIONS::drawLine, CHECK( cond.CurrentTool( PL_ACTIONS::drawLine ) ) );
|
||||
mgr->SetConditions( PL_ACTIONS::drawRectangle, CHECK( cond.CurrentTool( PL_ACTIONS::drawRectangle ) ) );
|
||||
mgr->SetConditions( PL_ACTIONS::placeText, CHECK( cond.CurrentTool( PL_ACTIONS::placeText ) ) );
|
||||
mgr->SetConditions( PL_ACTIONS::placeImage, CHECK( cond.CurrentTool( PL_ACTIONS::placeImage ) ) );
|
||||
mgr->SetConditions( PL_ACTIONS::drawLine,
|
||||
CHECK( cond.CurrentTool( PL_ACTIONS::drawLine ) ) );
|
||||
mgr->SetConditions( PL_ACTIONS::drawRectangle,
|
||||
CHECK( cond.CurrentTool( PL_ACTIONS::drawRectangle ) ) );
|
||||
mgr->SetConditions( PL_ACTIONS::placeText,
|
||||
CHECK( cond.CurrentTool( PL_ACTIONS::placeText ) ) );
|
||||
mgr->SetConditions( PL_ACTIONS::placeImage,
|
||||
CHECK( cond.CurrentTool( PL_ACTIONS::placeImage ) ) );
|
||||
|
||||
// Not a tool, just a way to activate the action
|
||||
mgr->SetConditions( PL_ACTIONS::appendImportedDrawingSheet, CHECK( SELECTION_CONDITIONS::ShowNever ) );
|
||||
mgr->SetConditions( PL_ACTIONS::appendImportedDrawingSheet,
|
||||
CHECK( SELECTION_CONDITIONS::ShowNever ) );
|
||||
|
||||
auto titleBlockNormalMode =
|
||||
[] ( const SELECTION& )
|
||||
|
@ -392,8 +400,6 @@ void PL_EDITOR_FRAME::doCloseWindow()
|
|||
}
|
||||
|
||||
|
||||
/* Handles the selection of tools, menu, and popup menu commands.
|
||||
*/
|
||||
void PL_EDITOR_FRAME::OnSelectPage( wxCommandEvent& event )
|
||||
{
|
||||
KIGFX::VIEW* view = GetCanvas()->GetView();
|
||||
|
@ -403,9 +409,6 @@ void PL_EDITOR_FRAME::OnSelectPage( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/* called when the user select one of the 4 page corner as corner
|
||||
* reference (or the left top paper corner)
|
||||
*/
|
||||
void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
|
||||
{
|
||||
m_originSelectChoice = m_originSelectBox->GetSelection();
|
||||
|
@ -423,7 +426,7 @@ void PL_EDITOR_FRAME::ToPrinter( bool doPreview )
|
|||
|
||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
||||
|
||||
if( s_PrintData == NULL ) // First print
|
||||
if( s_PrintData == nullptr ) // First print
|
||||
{
|
||||
s_PrintData = new wxPrintData();
|
||||
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
|
||||
|
@ -435,7 +438,7 @@ void PL_EDITOR_FRAME::ToPrinter( bool doPreview )
|
|||
return;
|
||||
}
|
||||
|
||||
if( s_pageSetupData == NULL )
|
||||
if( s_pageSetupData == nullptr )
|
||||
s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
|
||||
|
||||
s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
|
||||
|
@ -474,7 +477,8 @@ void PL_EDITOR_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
|||
|
||||
book->AddPage( new wxPanel( book ), _( "Drawing Sheet Editor" ) );
|
||||
book->AddSubPage( new PANEL_GAL_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
|
||||
book->AddSubPage( new PANEL_PL_EDITOR_COLOR_SETTINGS( this, aParent->GetTreebook() ), _( "Colors" ) );
|
||||
book->AddSubPage( new PANEL_PL_EDITOR_COLOR_SETTINGS( this, aParent->GetTreebook() ),
|
||||
_( "Colors" ) );
|
||||
|
||||
aHotkeysPanel->AddHotKeys( GetToolManager() );
|
||||
}
|
||||
|
@ -653,9 +657,6 @@ wxPoint PL_EDITOR_FRAME::ReturnCoordOriginCorner() const
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Display the grid status.
|
||||
*/
|
||||
void PL_EDITOR_FRAME::DisplayGridMsg()
|
||||
{
|
||||
wxString line;
|
||||
|
@ -810,7 +811,7 @@ void PL_EDITOR_FRAME::HardRedraw()
|
|||
|
||||
DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
|
||||
{
|
||||
DS_DATA_ITEM * item = NULL;
|
||||
DS_DATA_ITEM * item = nullptr;
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
|
@ -837,7 +838,7 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
|
|||
wxFD_OPEN );
|
||||
|
||||
if( fileDlg.ShowModal() != wxID_OK )
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
wxString fullFilename = fileDlg.GetPath();
|
||||
|
||||
|
@ -856,15 +857,15 @@ DS_DATA_ITEM* PL_EDITOR_FRAME::AddDrawingSheetItem( int aType )
|
|||
break;
|
||||
}
|
||||
|
||||
// Set the scale factor for pl_editor (it is set for eeschema by default)
|
||||
// Set the scale factor for pl_editor (it is set for Eeschema by default)
|
||||
image->SetPixelSizeIu( IU_PER_MILS * 1000.0 / image->GetPPI() );
|
||||
item = new DS_DATA_ITEM_BITMAP( image );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( item == NULL )
|
||||
return NULL;
|
||||
if( item == nullptr )
|
||||
return nullptr;
|
||||
|
||||
DS_DATA_MODEL::GetTheInstance().Append( item );
|
||||
item->SyncDrawItems( nullptr, GetCanvas()->GetView() );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -40,29 +40,10 @@ class wxChoice;
|
|||
|
||||
|
||||
/**
|
||||
* PL_EDITOR_FRAME
|
||||
* is the main window used in the drawing sheet editor.
|
||||
* The main window used in the drawing sheet editor.
|
||||
*/
|
||||
|
||||
class PL_EDITOR_FRAME : public EDA_DRAW_FRAME
|
||||
{
|
||||
PL_EDITOR_LAYOUT m_pageLayout;
|
||||
|
||||
int m_propertiesFrameWidth; // the last width (in pixels) of m_propertiesPagelayout
|
||||
|
||||
wxChoice* m_originSelectBox; // Corner origin choice for coordinates
|
||||
int m_originSelectChoice; // the last choice for m_originSelectBox
|
||||
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
||||
// usefull when there are some items which are
|
||||
// only on page 1, not on page 1
|
||||
wxPoint m_grid_origin;
|
||||
|
||||
protected:
|
||||
/// The last filename chosen to be proposed to the user
|
||||
PROPERTIES_FRAME* m_propertiesPagelayout;
|
||||
|
||||
void setupUIConditions() override;
|
||||
|
||||
public:
|
||||
PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~PL_EDITOR_FRAME();
|
||||
|
@ -77,23 +58,23 @@ public:
|
|||
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
|
||||
|
||||
/**
|
||||
* Function LoadDrawingSheetFile
|
||||
* Loads a .kicad_wks drawing sheet file
|
||||
* @param aFullFileName = the filename.
|
||||
* Load a .kicad_wks drawing sheet file.
|
||||
*
|
||||
* @param aFullFileName is the filename.
|
||||
*/
|
||||
bool LoadDrawingSheetFile( const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Function SaveDrawingSheetFile
|
||||
* Save the current layout in a .kicad_wks drawing sheet file
|
||||
* @param aFullFileName = the filename.
|
||||
* Save the current layout in a .kicad_wks drawing sheet file.
|
||||
*
|
||||
* @param aFullFileName is the filename.
|
||||
*/
|
||||
bool SaveDrawingSheetFile( const wxString& aFullFileName );
|
||||
|
||||
/**
|
||||
* Function InsertDrawingSheetFile
|
||||
* Loads a .kicad_wks drawing sheet file, and add items to the current layout list
|
||||
* @param aFullFileName = the filename.
|
||||
* Load a .kicad_wks drawing sheet file, and add items to the current layout list.
|
||||
*
|
||||
* @param aFullFileName is the filename.
|
||||
*/
|
||||
bool InsertDrawingSheetFile( const wxString& aFullFileName );
|
||||
|
||||
|
@ -104,16 +85,15 @@ public:
|
|||
*/
|
||||
bool IsContentModified() const override;
|
||||
|
||||
/*
|
||||
* Function OnExit
|
||||
* Event handler for the wxID_EXIT and wxID_CLOSE events
|
||||
/**
|
||||
* Event handler for the wxID_EXIT and wxID_CLOSE events.
|
||||
*/
|
||||
void OnExit( wxCommandEvent& aEvent );
|
||||
|
||||
bool canCloseWindow( wxCloseEvent& aCloseEvent ) override;
|
||||
void doCloseWindow() override;
|
||||
|
||||
// The Tool Framework initalization
|
||||
// The Tool Framework initialization
|
||||
void setupTools();
|
||||
|
||||
// Virtual basic functions:
|
||||
|
@ -131,8 +111,8 @@ public:
|
|||
void SetGridOrigin( const wxPoint& aPoint ) override { m_grid_origin = aPoint; }
|
||||
|
||||
/**
|
||||
* calculate the position (in page, in iu) of the corner used as coordinate origin
|
||||
* of items
|
||||
* Calculate the position (in page, in iu) of the corner used as coordinate origin
|
||||
* of items.
|
||||
*/
|
||||
wxPoint ReturnCoordOriginCorner() const;
|
||||
|
||||
|
@ -151,12 +131,13 @@ public:
|
|||
void OnNewDrawingSheet();
|
||||
|
||||
/**
|
||||
* creates or updates the right vertical toolbar.
|
||||
* Create or update the right vertical toolbar.
|
||||
*/
|
||||
void ReCreateVToolbar() override;
|
||||
|
||||
/**
|
||||
* Create or update the left vertical toolbar (option toolbar
|
||||
* Create or update the left vertical toolbar.
|
||||
*
|
||||
* @note This is currently not used.
|
||||
*/
|
||||
void ReCreateOptToolbar() override;
|
||||
|
@ -170,14 +151,16 @@ public:
|
|||
|
||||
/**
|
||||
* Drawing sheet editor can show the title block using a page number 1 or another number.
|
||||
*
|
||||
* This is because some items can be shown (or not) only on page 1 (a feature which
|
||||
* looks like word processing option "page 1 differs from other pages").
|
||||
* @return true if the page 1 is selected, and false if not
|
||||
*
|
||||
* @return true if the page 1 is selected, and false if not.
|
||||
*/
|
||||
bool GetPageNumberOption() const;
|
||||
|
||||
/**
|
||||
* Displays the short filename (if exists) loaded file on the caption of the main window
|
||||
* Display the short filename (if exists) loaded file on the caption of the main window.
|
||||
*/
|
||||
void UpdateTitleAndInfo();
|
||||
|
||||
|
@ -190,8 +173,8 @@ public:
|
|||
void OnSelectPage( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* called when the user select one of the 4 page corner as corner reference (or the
|
||||
* left top paper corner)
|
||||
* Called when the user select one of the 4 page corner as corner reference (or the
|
||||
* left top paper corner).
|
||||
*/
|
||||
void OnSelectCoordOriginCorner( wxCommandEvent& event );
|
||||
|
||||
|
@ -205,16 +188,16 @@ public:
|
|||
void OnSelectTitleBlockDisplayMode( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function ToPrinter
|
||||
* Open a dialog frame to print layers
|
||||
* Open a dialog frame to print layers.
|
||||
*/
|
||||
void ToPrinter( bool doPreview );
|
||||
|
||||
void Files_io( wxCommandEvent& event );
|
||||
|
||||
/** Virtual function PrintPage
|
||||
* used to print a page
|
||||
* @param aDC = wxDC given by the calling print function
|
||||
/**
|
||||
* Print a page.
|
||||
*
|
||||
* @param aDC is the device context used by the print function.
|
||||
*/
|
||||
virtual void PrintPage( const RENDER_SETTINGS* aSettings ) override;
|
||||
|
||||
|
@ -223,33 +206,33 @@ public:
|
|||
|
||||
/**
|
||||
* @return the filename of the current layout descr file
|
||||
* If this is the default (no loaded file) returns a emtpy name
|
||||
* If this is the default (no loaded file) returns a empty name
|
||||
* or a new design.
|
||||
*/
|
||||
wxString GetCurrentFileName() const override;
|
||||
|
||||
/**
|
||||
* Stores the current layout descr file filename
|
||||
* Store the current layout description file filename.
|
||||
*/
|
||||
void SetCurrentFileName( const wxString& aName );
|
||||
|
||||
/**
|
||||
* Refresh the library tree and redraw the window
|
||||
* Refresh the library tree and redraw the window.
|
||||
*/
|
||||
void HardRedraw() override;
|
||||
|
||||
/**
|
||||
* Function AddDrawingSheetItem
|
||||
* Add a new item to the drawing sheet item list.
|
||||
* @param aType = the type of item:
|
||||
*
|
||||
* @param aType is the type of item:
|
||||
* DS_TEXT, DS_SEGMENT, DS_RECT, DS_POLYPOLYGON
|
||||
* @param aIdx = the position in list to insert the new item.
|
||||
* @return a reference to the new item
|
||||
* @param aIdx is the position in list to insert the new item.
|
||||
* @return a reference to the new item.
|
||||
*/
|
||||
DS_DATA_ITEM* AddDrawingSheetItem( int aType );
|
||||
|
||||
/**
|
||||
* Must be called after a change in order to set the "modify" flag
|
||||
* Must be called after a change in order to set the "modify" flag.
|
||||
*/
|
||||
void OnModify()
|
||||
{
|
||||
|
@ -261,33 +244,49 @@ public:
|
|||
*/
|
||||
void SaveCopyInUndoList();
|
||||
|
||||
/** Redo the last edit:
|
||||
* - Place the current edited layout in undo list
|
||||
* - Get the previous version of the current edited layput
|
||||
/**
|
||||
* Redo the last edit:
|
||||
* - Place the current edited layout in undo list.
|
||||
* - Get the previous version of the current edited layout.
|
||||
*/
|
||||
void GetLayoutFromRedoList();
|
||||
|
||||
/** Undo the last edit:
|
||||
* - Place the current layout in Redo list
|
||||
* - Get the previous version of the current edited layout
|
||||
/**
|
||||
* Undo the last edit:
|
||||
* - Place the current layout in Redo list.
|
||||
* - Get the previous version of the current edited layout.
|
||||
*/
|
||||
void GetLayoutFromUndoList();
|
||||
|
||||
/**
|
||||
* Apply the last command in Undo List without stacking a Redo. Used to clean the
|
||||
* Undo stack after cancelling a command.
|
||||
* Undo stack after canceling a command.
|
||||
*/
|
||||
void RollbackFromUndo();
|
||||
|
||||
/**
|
||||
* Function ClearUndoORRedoList
|
||||
*/
|
||||
void ClearUndoORRedoList( UNDO_REDO_LIST whichList, int aItemCount = -1 ) override;
|
||||
|
||||
protected:
|
||||
bool saveCurrentPageLayout();
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
void setupUIConditions() override;
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
/// The last filename chosen to be proposed to the user
|
||||
PROPERTIES_FRAME* m_propertiesPagelayout;
|
||||
|
||||
private:
|
||||
PL_EDITOR_LAYOUT m_pageLayout;
|
||||
|
||||
int m_propertiesFrameWidth; // the last width (in pixels) of m_propertiesPagelayout
|
||||
|
||||
wxChoice* m_originSelectBox; // Corner origin choice for coordinates
|
||||
int m_originSelectChoice; // the last choice for m_originSelectBox
|
||||
wxChoice* m_pageSelectBox; // The page number sel'ector (page 1 or other pages
|
||||
// useful when there are some items which are
|
||||
// only on page 1, not on page 1
|
||||
wxPoint m_grid_origin;
|
||||
};
|
||||
|
||||
#endif /* _PL_EDITOR_FRAME_H */
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -33,18 +34,8 @@
|
|||
#include <drawing_sheet/ds_draw_item.h>
|
||||
|
||||
|
||||
/**
|
||||
* PL_EDITOR_LAYOUT
|
||||
*/
|
||||
class PL_EDITOR_LAYOUT
|
||||
{
|
||||
private:
|
||||
EDA_RECT m_boundingBox;
|
||||
PAGE_INFO m_paper;
|
||||
TITLE_BLOCK m_titles;
|
||||
|
||||
DS_DRAW_ITEM_LIST m_drawItemList;
|
||||
|
||||
public:
|
||||
PL_EDITOR_LAYOUT();
|
||||
~PL_EDITOR_LAYOUT();
|
||||
|
@ -69,15 +60,14 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function ComputeBoundingBox
|
||||
* calculates the bounding box containing all Gerber items.
|
||||
* @return EDA_RECT - the full item list bounding box
|
||||
* Calculate the bounding box containing all Gerber items.
|
||||
*
|
||||
* @return the full item list bounding box.
|
||||
*/
|
||||
EDA_RECT ComputeBoundingBox();
|
||||
|
||||
/**
|
||||
* Function GetBoundingBox
|
||||
* may be called soon after ComputeBoundingBox() to return the same EDA_RECT,
|
||||
* Called soon after ComputeBoundingBox() to return the same EDA_RECT,
|
||||
* as long as the CLASS_PL_EDITOR_LAYOUT has not changed.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox() const { return m_boundingBox; }
|
||||
|
@ -89,6 +79,13 @@ public:
|
|||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
EDA_RECT m_boundingBox;
|
||||
PAGE_INFO m_paper;
|
||||
TITLE_BLOCK m_titles;
|
||||
|
||||
DS_DRAW_ITEM_LIST m_drawItemList;
|
||||
};
|
||||
|
||||
#endif // #ifndef CLASS_PL_EDITOR_LAYOUT_H
|
||||
|
|
|
@ -35,6 +35,10 @@ public:
|
|||
|
||||
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
|
||||
|
||||
protected:
|
||||
virtual std::string getLegacyFrameName() const override { return "PlEditorFrame"; }
|
||||
|
||||
public:
|
||||
int m_CornerOrigin;
|
||||
int m_PropertiesFrameWidth;
|
||||
wxString m_LastPaperSize;
|
||||
|
@ -42,10 +46,6 @@ public:
|
|||
int m_LastCustomHeight;
|
||||
bool m_LastWasPortrait;
|
||||
bool m_BlackBackground;
|
||||
|
||||
|
||||
protected:
|
||||
virtual std::string getLegacyFrameName() const override { return "PlEditorFrame"; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Attenuator Synthesis
|
||||
*
|
||||
* From Qucs
|
||||
* Modified for Kicad
|
||||
* Modified for KiCad
|
||||
*/
|
||||
|
||||
#ifndef ATTENUATORFUNC_H
|
||||
|
@ -24,18 +24,40 @@ enum ATTENUATORS_TYPE {
|
|||
|
||||
class ATTENUATOR
|
||||
{
|
||||
protected:
|
||||
ATTENUATORS_TYPE m_Topology;
|
||||
public:
|
||||
wxString m_Name; // Identifier for config
|
||||
virtual ~ATTENUATOR();
|
||||
|
||||
/**
|
||||
* Calculates the values of components in attenuator.
|
||||
*
|
||||
* @return true if OK, false if some values cannot be calculated.
|
||||
*/
|
||||
virtual bool Calculate();
|
||||
|
||||
/**
|
||||
* Read values stored in config for this attenuator.
|
||||
*/
|
||||
void ReadConfig();
|
||||
|
||||
/**
|
||||
* Read values stored in config for this attenuator.
|
||||
*/
|
||||
void WriteConfig();
|
||||
|
||||
protected:
|
||||
// The constructor is protected, because this class is not intended to be instanciated.
|
||||
ATTENUATOR( ATTENUATORS_TYPE Topology );
|
||||
|
||||
public:
|
||||
wxString m_Name; // Identifier for configuration.
|
||||
int m_ResultCount; // Number of value to calculate, and therefore display
|
||||
bool m_Error; // Set to true if values acnnot be calculated
|
||||
bool m_Error; // Set to true if values cannot be calculated
|
||||
double m_Zin; // Impedance of source
|
||||
bool m_Zin_Enable; // Set to true when impedance of source has meaning
|
||||
double m_Zout; // Impedance of load
|
||||
double m_Attenuation; // Attenuation in dB
|
||||
bool m_Attenuation_Enable; // Set to true when Attenuatiopn has meaning
|
||||
double m_MinimumATT; // Minimun attenuation in dB from parameters
|
||||
bool m_Attenuation_Enable; // Set to true when Attenuation has meaning
|
||||
double m_MinimumATT; // Minimum attenuation in dB from parameters
|
||||
double m_R1; // value of R1
|
||||
double m_R2; // value of R2
|
||||
double m_R3; // value of R3 (if any)
|
||||
|
@ -43,33 +65,8 @@ public:
|
|||
wxString* m_FormulaName; // The HTML/markdown text name of the formula
|
||||
|
||||
protected:
|
||||
ATTENUATORS_TYPE m_Topology;
|
||||
double Lmin, L, A; // internal variable for temporary use
|
||||
|
||||
|
||||
protected:
|
||||
// The constructor is protected, because this class is not intended to be instancied
|
||||
ATTENUATOR( ATTENUATORS_TYPE Topology );
|
||||
public:
|
||||
virtual ~ATTENUATOR();
|
||||
|
||||
/**
|
||||
* Function Calculate
|
||||
* calculates the values of components in attenuator
|
||||
* @return true if ok, false if some values cannot be calculated
|
||||
*/
|
||||
virtual bool Calculate();
|
||||
|
||||
/**
|
||||
* Function ReadConfig
|
||||
* Read values stored in config for this attenuator
|
||||
*/
|
||||
void ReadConfig();
|
||||
|
||||
/**
|
||||
* Function WriteConfig
|
||||
* Read values stored in config for this attenuator
|
||||
*/
|
||||
void WriteConfig();
|
||||
};
|
||||
|
||||
class ATTENUATOR_PI : public ATTENUATOR
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2011 jean-pierre.charras
|
||||
* Copyright (C) 1992-2020 Kicad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 1992-2021 Kicad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -39,13 +39,6 @@
|
|||
// Helper class to store parameters for a regulator
|
||||
class REGULATOR_DATA
|
||||
{
|
||||
public:
|
||||
wxString m_Name; // Regulator name
|
||||
int m_Type; // type: with separate sense pin (normal) (=0)
|
||||
// or adjustable 3 pins reg (=1)
|
||||
double m_Vref; // Vreference in volt
|
||||
double m_Iadj; // 3 pin type only: I adjust in micro amp
|
||||
|
||||
public:
|
||||
REGULATOR_DATA( const wxString& aName, double aVref, int aType, double aIadj = 0)
|
||||
{
|
||||
|
@ -54,14 +47,18 @@ public:
|
|||
m_Name = aName;
|
||||
m_Iadj = aIadj;
|
||||
}
|
||||
|
||||
public:
|
||||
wxString m_Name; // Regulator name
|
||||
int m_Type; // type: with separate sense pin (normal) (=0)
|
||||
// or adjustable 3 pins reg (=1)
|
||||
double m_Vref; // Vreference in volt
|
||||
double m_Iadj; // 3 pin type only: I adjust in micro amp
|
||||
};
|
||||
|
||||
// Helper class to store the list of known regulators
|
||||
class REGULATOR_LIST
|
||||
{
|
||||
public:
|
||||
std::vector <REGULATOR_DATA*> m_List;
|
||||
|
||||
public:
|
||||
REGULATOR_LIST() {};
|
||||
~REGULATOR_LIST()
|
||||
|
@ -142,6 +139,8 @@ public:
|
|||
|
||||
return list;
|
||||
}
|
||||
|
||||
std::vector <REGULATOR_DATA*> m_List;
|
||||
};
|
||||
|
||||
#endif // CLASS_REGULATOR_DATA_H
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2011 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -30,22 +30,23 @@ class PCB_CALCULATOR_DATAFILE_PARSER;
|
|||
*/
|
||||
class PCB_CALCULATOR_DATAFILE
|
||||
{
|
||||
friend class PCB_CALCULATOR_DATAFILE_PARSER;
|
||||
protected:
|
||||
REGULATOR_LIST * m_list;
|
||||
|
||||
public:
|
||||
PCB_CALCULATOR_DATAFILE( REGULATOR_LIST * aList );
|
||||
|
||||
int WriteHeader( OUTPUTFORMATTER* aFormatter ) const ;
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel ) const ;
|
||||
void Parse( PCB_CALCULATOR_DATAFILE_PARSER* aParser );
|
||||
|
||||
private:
|
||||
friend class PCB_CALCULATOR_DATAFILE_PARSER;
|
||||
|
||||
protected:
|
||||
REGULATOR_LIST* m_list;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* PCB_CALCULATOR_DATAFILE_PARSER
|
||||
* is the parser class for PCB_CALCULATOR_DATAFILE.
|
||||
* Parser for PCB_CALCULATOR_DATAFILE.
|
||||
*/
|
||||
class PCB_CALCULATOR_DATAFILE_PARSER : public PCB_CALCULATOR_DATAFILE_LEXER
|
||||
{
|
||||
|
|
|
@ -34,18 +34,62 @@ class KIWAY;
|
|||
class PCB_CALCULATOR_SETTINGS;
|
||||
|
||||
|
||||
/*
|
||||
* Class PCB_CALCULATOR_FRAME_BASE
|
||||
* This is the main frame for this application
|
||||
/**
|
||||
* PCB calculator the main frame.
|
||||
*/
|
||||
class PCB_CALCULATOR_FRAME : public PCB_CALCULATOR_FRAME_BASE
|
||||
{
|
||||
public:
|
||||
REGULATOR_LIST m_RegulatorList; // the list of known regulator
|
||||
|
||||
PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~PCB_CALCULATOR_FRAME();
|
||||
|
||||
/**
|
||||
* Read/write params values and results.
|
||||
*
|
||||
* @param aPrmId is the parameter id to write.
|
||||
* @param aValue is the value to write.
|
||||
*/
|
||||
void SetPrmValue( enum PRMS_ID aPrmId, double aValue );
|
||||
|
||||
/**
|
||||
* Put the text into the given result line.
|
||||
*
|
||||
* @param aLineNumber is the line (0 to 5) where to display the text.
|
||||
* @param aText is the text to display.
|
||||
*/
|
||||
void SetResult( int aLineNumber, const wxString& aText );
|
||||
|
||||
/**
|
||||
* Set the background color of a parameter.
|
||||
*
|
||||
* @param aPrmId is the parameter id to set.
|
||||
* @param aCol is the new color.
|
||||
*/
|
||||
void SetPrmBgColor( enum PRMS_ID aPrmId, const KIGFX::COLOR4D* aCol );
|
||||
|
||||
/**
|
||||
* Return a param value.
|
||||
*
|
||||
* @param aPrmId is the parameter id to write.
|
||||
* @return the value always in normalized unit (meter, Hz, Ohm, radian).
|
||||
*/
|
||||
double GetPrmValue( enum PRMS_ID aPrmId ) const;
|
||||
|
||||
/**
|
||||
* @return true if the parameter aPrmId is selected.
|
||||
*/
|
||||
bool IsPrmSelected( enum PRMS_ID aPrmId ) const;
|
||||
|
||||
// Board classes panel:
|
||||
void OnBoardClassesUnitsSelection( wxCommandEvent& event ) override;
|
||||
void BoardClassesUpdateData( double aUnitScale );
|
||||
|
||||
// Calculator doesn't host a tool framework
|
||||
wxWindow* GetToolCanvas() const override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
// Event handlers
|
||||
void OnClosePcbCalc( wxCloseEvent& event ) override;
|
||||
|
@ -67,8 +111,9 @@ private:
|
|||
|
||||
/**
|
||||
* Initialize the full filename of the selected pcb_calculator data file
|
||||
* force the standard extension of the file (.pcbcalc)
|
||||
* @param aFilename = the full filename, with or without extension
|
||||
* force the standard extension of the file (.pcbcalc).
|
||||
*
|
||||
* @param aFilename is the full filename, with or without extension.
|
||||
*/
|
||||
void SetDataFilename( const wxString& aFilename );
|
||||
|
||||
|
@ -86,117 +131,93 @@ private:
|
|||
void OnCalculateESeries( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Radio Buttons to select the E-serie for the resistor calculator
|
||||
* @param event contains the radio button state
|
||||
* Radio Buttons to select the E-serie for the resistor calculator.
|
||||
*
|
||||
* @param event contains the radio button state.
|
||||
*/
|
||||
void OnESeriesSelection( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function writeTrackWidthConfig
|
||||
* Write Track width parameters in config
|
||||
* Write track width parameters in configuration.
|
||||
*/
|
||||
void writeTrackWidthConfig();
|
||||
|
||||
/**
|
||||
* Function OnTWParametersChanged
|
||||
* Called when the user changes the general parameters (i.e., anything that
|
||||
* is not one of the controlling values). This update the calculations.
|
||||
* Update the calculations the user changes the general parameters.
|
||||
*/
|
||||
void OnTWParametersChanged( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTWCalculateFromCurrent
|
||||
* Called when the user changes the desired maximum current. This sets the
|
||||
* current as the controlling value and performs the calculations.
|
||||
* Update the calculations when the user changes the desired maximum current.
|
||||
*/
|
||||
void OnTWCalculateFromCurrent( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTWCalculateFromExtWidth
|
||||
* Called when the user changes the desired external trace width. This sets
|
||||
* the external width as the controlling value and performs the calculations.
|
||||
* Update the calculations when the user changes the desired external trace width.
|
||||
*/
|
||||
void OnTWCalculateFromExtWidth( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTWCalculateFromIntWidth
|
||||
* Called when the user changes the desired internal trace width. This sets
|
||||
* the internal width as the controlling value and performs the calculations.
|
||||
* Update the calculations when the user changes the desired internal trace width.
|
||||
*/
|
||||
void OnTWCalculateFromIntWidth( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTWResetButtonClick
|
||||
* Called when the user clicks the reset button. This sets
|
||||
* the parameters to their default values.
|
||||
* Update the calculations when the user clicks the reset button.
|
||||
*/
|
||||
void OnTWResetButtonClick( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function TWCalculateWidth
|
||||
* Calculate track width required based on given current and temperature rise.
|
||||
*/
|
||||
double TWCalculateWidth( double aCurrent, double aThickness, double aDeltaT_C,
|
||||
bool aUseInternalLayer );
|
||||
|
||||
/**
|
||||
* Function TWCalculateCurrent
|
||||
* Calculate maximum current based on given width and temperature rise.
|
||||
*/
|
||||
double TWCalculateCurrent( double aWidth, double aThickness, double aDeltaT_C,
|
||||
bool aUseInternalLayer );
|
||||
|
||||
/**
|
||||
* Function TWDisplayValues
|
||||
* Displays the results of a calculation (including resulting values such
|
||||
* Display the results of a calculation (including resulting values such
|
||||
* as the resistance and power loss).
|
||||
*/
|
||||
void TWDisplayValues( double aCurrent, double aExtWidth, double aIntWidth,
|
||||
double aExtThickness, double aIntThickness );
|
||||
|
||||
/**
|
||||
* Function TWUpdateModeDisplay
|
||||
* Updates the fields to show whether the maximum current, external trace
|
||||
* Update the fields to show whether the maximum current, external trace
|
||||
* width, or internal trace width is currently the controlling parameter.
|
||||
*/
|
||||
void TWUpdateModeDisplay();
|
||||
|
||||
/**
|
||||
* Function writeViaSizeConfig
|
||||
* Write Via Size parameters in config
|
||||
* Write via size parameters in configuration.
|
||||
*/
|
||||
void writeViaSizeConfig();
|
||||
|
||||
/**
|
||||
* Function OnViaCalculate
|
||||
* Called when the user changes any value in the via calcultor.
|
||||
* Called when the user changes any value in the via calculator.
|
||||
*/
|
||||
void OnViaCalculate( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnViaEpsilonR_Button
|
||||
*/
|
||||
void OnViaEpsilonR_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnViaRho_Button
|
||||
*/
|
||||
void OnViaRho_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Update the Error message in Via calculation panel
|
||||
* Update the Error message in via calculation panel.
|
||||
*/
|
||||
void onUpdateViaCalcErrorText( wxUpdateUIEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnViaResetButtonClick
|
||||
* Called when the user clicks the reset button; sets the parameters to their default values.
|
||||
*/
|
||||
void OnViaResetButtonClick( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function VSDisplayValues
|
||||
* Displays the results of the calculation.
|
||||
* Display the results of the calculation.
|
||||
*/
|
||||
void VSDisplayValues( double aViaResistance, double aVoltageDrop, double aPowerLoss,
|
||||
double aEstimatedAmpacity, double aThermalResistance,
|
||||
|
@ -209,64 +230,58 @@ private:
|
|||
void ElectricalSpacingUpdateData( double aUnitScale );
|
||||
|
||||
/**
|
||||
* Function OnTranslineSelection
|
||||
* Called on new transmission line selection
|
||||
* Called on new transmission line selection.
|
||||
*/
|
||||
void OnTranslineSelection( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTransLineResetButtonClick
|
||||
* Called when the user clicks the reset button; sets the parameters to their default values.
|
||||
*/
|
||||
void OnTransLineResetButtonClick( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineAnalyse
|
||||
* Run a new analyse for the current transline with current parameters and displays the
|
||||
* electrical parameters
|
||||
* Run a new analyze for the current transline with current parameters and displays the
|
||||
* electrical parameters.
|
||||
*/
|
||||
void OnTranslineAnalyse( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineSynthetize
|
||||
* Run a new synthezis for the current transline with current parameters and displays the
|
||||
* geometrical parameters
|
||||
* Run a new synthesis for the current transline with current parameters and displays the
|
||||
* geometrical parameters.
|
||||
*/
|
||||
void OnTranslineSynthetize( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineEpsilonR_Button
|
||||
* Shows a list of current relative dielectric constant(Er) and set the selected value in
|
||||
* main dialog frame
|
||||
* main dialog frame.
|
||||
*/
|
||||
void OnTranslineEpsilonR_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineTanD_Button
|
||||
* Shows a list of current dielectric loss factor (tangent delta) and set the selected value
|
||||
* in main dialog frame
|
||||
* Show a list of current dielectric loss factor (tangent delta) and set the selected value
|
||||
* in main dialog frame.
|
||||
*/
|
||||
void OnTranslineTanD_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function OnTranslineRho_Button
|
||||
* Shows a list of current Specific resistance list (rho) and set the selected value in main
|
||||
* dialog frame
|
||||
* Show a list of current Specific resistance list (rho) and set the selected value in main
|
||||
* dialog frame.
|
||||
*/
|
||||
void OnTranslineRho_Button( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function TranslineTypeSelection
|
||||
* Must be called after selection of a new transline. Update all values, labels and tool
|
||||
* tips of parameters needed by the new transline; irrelevant parameters are blanked.
|
||||
* @param aType = the TRANSLINE_TYPE_ID of the new selected transline
|
||||
* Must be called after selection of a new transline.
|
||||
*
|
||||
* Update all values, labels and tool tips of parameters needed by the new transline;
|
||||
* irrelevant parameters are blanked.
|
||||
*
|
||||
* @param aType is the #TRANSLINE_TYPE_ID of the new selected transmission line.
|
||||
*/
|
||||
void TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType );
|
||||
|
||||
/**
|
||||
* Function TransfDlgDataToTranslineParams
|
||||
* Read values entered in dialog frame, and transfert these values in current transline
|
||||
* parameters, converted in normalized units
|
||||
* Read values entered in dialog frame, and transfer these values in current transline
|
||||
* parameters, converted in normalized units.
|
||||
*/
|
||||
void TransfDlgDataToTranslineParams();
|
||||
|
||||
|
@ -293,14 +308,13 @@ private:
|
|||
void OnRemoveRegulator( wxCommandEvent& event ) override;
|
||||
|
||||
/**
|
||||
* Function RegulatorPageUpdate:
|
||||
* Update the regulator page dialog display:
|
||||
* enable the current regulator drawings and the formula used for calculations
|
||||
* Update the regulator page dialog display.
|
||||
*
|
||||
* Enable the current regulator drawings and the formula used for calculations.
|
||||
*/
|
||||
void RegulatorPageUpdate();
|
||||
|
||||
/**
|
||||
* Function SelectLastSelectedRegulator
|
||||
* If m_lastSelectedRegulatorName is empty, just calls RegulatorPageUpdate()
|
||||
*/
|
||||
void SelectLastSelectedRegulator();
|
||||
|
@ -308,63 +322,17 @@ private:
|
|||
void RegulatorsSolve();
|
||||
|
||||
/**
|
||||
* Write regulators parameters in config
|
||||
* @param aCfg is the config settings
|
||||
* Write regulators parameters in configuration.
|
||||
*
|
||||
* @param aCfg is the configuration settings.
|
||||
*/
|
||||
void Regulators_WriteConfig( PCB_CALCULATOR_SETTINGS* aCfg );
|
||||
|
||||
public:
|
||||
// Read/write params values and results
|
||||
|
||||
/**
|
||||
* Function SetPrmValue
|
||||
* Read/write params values and results
|
||||
* @param aPrmId = param id to write
|
||||
* @param aValue = valmue to write
|
||||
*/
|
||||
void SetPrmValue( enum PRMS_ID aPrmId, double aValue );
|
||||
|
||||
/**
|
||||
* Function SetResult
|
||||
* Puts the text into the given result line.
|
||||
* @param aLineNumber = the line (0 to 5) wher to display the text
|
||||
* @param aText = the text to display
|
||||
*/
|
||||
void SetResult( int aLineNumber, const wxString& aText );
|
||||
|
||||
/** Function SetPrgmBgColor
|
||||
* Set the background color of a parameter
|
||||
* @param aPrmId = param id to set
|
||||
* @param aCol = new color
|
||||
*/
|
||||
void SetPrmBgColor( enum PRMS_ID aPrmId, const KIGFX::COLOR4D* aCol );
|
||||
/**
|
||||
* Function GetPrmValue
|
||||
* Returns a param value.
|
||||
* @param aPrmId = param id to write
|
||||
* @return the value always in normalized unit (meter, Hz, Ohm, radian)
|
||||
*/
|
||||
double GetPrmValue( enum PRMS_ID aPrmId ) const;
|
||||
|
||||
/**
|
||||
* Function IsPrmSelected
|
||||
* @return true if the param aPrmId is selected
|
||||
* Has meaning only for params that have a radio button
|
||||
*/
|
||||
bool IsPrmSelected( enum PRMS_ID aPrmId ) const;
|
||||
|
||||
// Board classes panel:
|
||||
void OnBoardClassesUnitsSelection( wxCommandEvent& event ) override;
|
||||
void BoardClassesUpdateData( double aUnitScale );
|
||||
|
||||
// Calculator doesn't host a tool framework
|
||||
wxWindow* GetToolCanvas() const override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
REGULATOR_LIST m_RegulatorList; // the list of known regulator
|
||||
|
||||
private:
|
||||
bool m_RegulatorListChanged; // Set when m_RegulatorList is modified and the corresponging file
|
||||
bool m_RegulatorListChanged; // Set when m_RegulatorList is modified and the corresponding file
|
||||
// must be rewritten
|
||||
|
||||
enum // Which dimension is controlling the track width / current
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* 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 under the terms of the GNU General Public License
|
||||
|
@ -123,6 +123,10 @@ public:
|
|||
|
||||
virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
|
||||
|
||||
protected:
|
||||
virtual std::string getLegacyFrameName() const override { return "pcb_calculator"; }
|
||||
|
||||
public:
|
||||
ATTENUATORS m_Attenuators;
|
||||
|
||||
int m_BoardClassUnits;
|
||||
|
@ -140,10 +144,6 @@ public:
|
|||
TRANSMISSION_LINE m_TransLine;
|
||||
|
||||
VIA_SIZE m_ViaSize;
|
||||
|
||||
protected:
|
||||
|
||||
virtual std::string getLegacyFrameName() const override { return "pcb_calculator"; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2011-2014 Jean-Pierre Charras
|
||||
* Copyright (C) 2004-2014 KiCad Developers, see AUTHORS.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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -56,6 +56,22 @@ enum PRM_TYPE {
|
|||
class TRANSLINE_PRM
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @param aKeywordCfg is the keyword used in config to identify the parameter
|
||||
* only ASCII7 keyword is valid.
|
||||
* @param aDlgLabel is a I18n string used to identify the parameter in dialog.
|
||||
* usually aDlgLabel is same as aKeywordCfg, but translatable.
|
||||
*/
|
||||
TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
||||
const char* aKeywordCfg = "",
|
||||
const wxString& aDlgLabel = wxEmptyString,
|
||||
const wxString& aToolTip = wxEmptyString,
|
||||
double aValue = 0.0,
|
||||
bool aConvUnit = false );
|
||||
|
||||
double ToUserUnit();
|
||||
double FromUserUnit();
|
||||
|
||||
PRM_TYPE m_Type; // Type of parameter: substr, physical, elect
|
||||
PRMS_ID m_Id; // Id of parameter ( link to transline functions )
|
||||
std::string m_KeyWord; // keyword for this parameter in json config file in ASCII7 only
|
||||
|
@ -67,42 +83,13 @@ public:
|
|||
void* m_ValueCtrl; // The text ctrl containing the value in dialog
|
||||
void* m_UnitCtrl; // The UNIT_SELECTOR containing the unit in dialog
|
||||
int m_UnitSelection; // last selection for units
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* TRANSLINE_PRM ctor.
|
||||
* @param aKeywordCfg is the keyword used in config to identify the parameter
|
||||
* only ASCII7 keyword is valid
|
||||
* @param aDlgLabel is a I18n string used to identify the parameter in dialog.
|
||||
* usually aDlgLabel is same as aKeywordCfg, but translatable
|
||||
*/
|
||||
TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
|
||||
const char* aKeywordCfg = "",
|
||||
const wxString& aDlgLabel = wxEmptyString,
|
||||
const wxString& aToolTip = wxEmptyString,
|
||||
double aValue = 0.0,
|
||||
bool aConvUnit = false );
|
||||
|
||||
double ToUserUnit();
|
||||
double FromUserUnit();
|
||||
};
|
||||
|
||||
|
||||
// A class to handle the list of availlable transm. lines
|
||||
// A class to handle the list of available transm. lines
|
||||
// with messages, tooptips ...
|
||||
class TRANSLINE_IDENT
|
||||
{
|
||||
public:
|
||||
enum TRANSLINE_TYPE_ID m_Type; // The type of transline handled
|
||||
wxBitmap * m_Icon; // An icon to display in dialogs
|
||||
TRANSLINE* m_TLine; // The TRANSLINE itself
|
||||
wxArrayString m_Messages; // messages for results
|
||||
bool m_HasPrmSelection; // true if selection of parameters must be enabled in dialog menu
|
||||
|
||||
private:
|
||||
std::vector <TRANSLINE_PRM*> m_prms_List;
|
||||
|
||||
public:
|
||||
TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType );
|
||||
~TRANSLINE_IDENT();
|
||||
|
@ -113,7 +100,6 @@ public:
|
|||
m_prms_List.push_back( aParam );
|
||||
}
|
||||
|
||||
|
||||
TRANSLINE_PRM* GetPrm( unsigned aIdx ) const
|
||||
{
|
||||
if( aIdx < m_prms_List.size() )
|
||||
|
@ -122,15 +108,25 @@ public:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
unsigned GetPrmsCount() const
|
||||
{
|
||||
return m_prms_List.size();
|
||||
}
|
||||
|
||||
|
||||
void ReadConfig();
|
||||
void WriteConfig();
|
||||
|
||||
public:
|
||||
enum TRANSLINE_TYPE_ID m_Type; // The type of transline handled
|
||||
wxBitmap * m_Icon; // An icon to display in dialogs
|
||||
TRANSLINE* m_TLine; // The TRANSLINE itself
|
||||
wxArrayString m_Messages; // messages for results
|
||||
|
||||
// true if selection of parameters must be enabled in dialog menu.
|
||||
bool m_HasPrmSelection;
|
||||
|
||||
private:
|
||||
std::vector <TRANSLINE_PRM*> m_prms_List;
|
||||
};
|
||||
|
||||
#endif // TRANSLINE_IDENT_H
|
||||
|
|
Loading…
Reference in New Issue