2008-04-14 19:22:48 +00:00
|
|
|
/***********************************************************/
|
|
|
|
/* wxEeschemaStruct.h: */
|
|
|
|
/***********************************************************/
|
|
|
|
|
|
|
|
#ifndef WX_EESCHEMA_STRUCT_H
|
|
|
|
#define WX_EESCHEMA_STRUCT_H
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "wxstruct.h"
|
2009-04-29 17:09:00 +00:00
|
|
|
#include "param_config.h"
|
2009-07-26 17:16:42 +00:00
|
|
|
#include "class_undoredo_container.h"
|
2010-06-17 16:30:10 +00:00
|
|
|
#include "template_fieldnames.h"
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
|
|
|
|
class WinEDA_LibeditFrame;
|
|
|
|
class WinEDA_ViewlibFrame;
|
|
|
|
class SCH_SCREEN;
|
|
|
|
class DRAWSEGMENT;
|
2008-04-14 19:22:48 +00:00
|
|
|
class DrawPickedStruct;
|
|
|
|
class SCH_ITEM;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_NO_CONNECT;
|
2009-09-18 14:56:05 +00:00
|
|
|
class CMP_LIBRARY;
|
|
|
|
class LIB_COMPONENT;
|
2009-09-25 18:49:04 +00:00
|
|
|
class LIB_DRAW_ITEM;
|
2008-09-17 17:26:25 +00:00
|
|
|
class EDA_BaseStruct;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_BUS_ENTRY;
|
2008-09-17 17:26:25 +00:00
|
|
|
class SCH_GLOBALLABEL;
|
|
|
|
class SCH_TEXT;
|
2009-11-04 20:46:53 +00:00
|
|
|
class SCH_SHEET;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_SHEET_PATH;
|
2009-11-04 20:46:53 +00:00
|
|
|
class SCH_SHEET_PIN;
|
2008-09-17 17:26:25 +00:00
|
|
|
class SCH_COMPONENT;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_FIELD;
|
2009-10-08 13:19:28 +00:00
|
|
|
class LIB_PIN;
|
2009-12-02 21:44:03 +00:00
|
|
|
class SCH_JUNCTION;
|
2010-03-16 18:22:59 +00:00
|
|
|
class DIALOG_SCH_FIND;
|
|
|
|
class wxFindDialogEvent;
|
|
|
|
class wxFindReplaceData;
|
|
|
|
|
2009-07-26 17:16:42 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
/* enum used in RotationMiroir() */
|
2010-07-14 13:24:36 +00:00
|
|
|
enum fl_rot_cmp {
|
|
|
|
CMP_NORMAL, // Normal orientation, no rotation or mirror
|
|
|
|
CMP_ROTATE_CLOCKWISE, // Rotate -90
|
|
|
|
CMP_ROTATE_COUNTERCLOCKWISE, // Rotate +90
|
|
|
|
CMP_ORIENT_0, // No rotation and no mirror id CMP_NORMAL
|
|
|
|
CMP_ORIENT_90, // Rotate 90, no mirror
|
|
|
|
CMP_ORIENT_180, // Rotate 180, no mirror
|
|
|
|
CMP_ORIENT_270, // Rotate -90, no mirror
|
|
|
|
CMP_MIRROR_X = 0x100, // Mirror around X axis
|
|
|
|
CMP_MIRROR_Y = 0x200 // Mirror around Y axis
|
2008-04-14 19:22:48 +00:00
|
|
|
};
|
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
/**
|
2009-11-04 20:46:53 +00:00
|
|
|
* Schematic editor (EESchema) main window.
|
2009-09-22 12:27:57 +00:00
|
|
|
*/
|
2008-04-14 19:22:48 +00:00
|
|
|
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
|
|
|
|
{
|
|
|
|
public:
|
2010-02-02 15:01:09 +00:00
|
|
|
WinEDAChoiceBox* m_SelPartBox;
|
|
|
|
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
|
2010-07-14 13:24:36 +00:00
|
|
|
int m_Multiflag;
|
|
|
|
int m_NetlistFormat;
|
2010-02-02 15:01:09 +00:00
|
|
|
bool m_ShowAllPins;
|
|
|
|
wxPoint m_OldPos;
|
|
|
|
WinEDA_LibeditFrame* m_LibeditFrame;
|
|
|
|
WinEDA_ViewlibFrame* m_ViewlibFrame;
|
|
|
|
wxString m_UserLibraryPath;
|
|
|
|
wxArrayString m_ComponentLibFiles;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
protected:
|
|
|
|
TEMPLATES m_TemplateFieldNames;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
2010-02-02 15:01:09 +00:00
|
|
|
wxString m_DefaultSchematicFileName;
|
|
|
|
SCH_FIELD* m_CurrentField;
|
2010-07-14 13:24:36 +00:00
|
|
|
int m_TextFieldSize;
|
2010-02-02 15:01:09 +00:00
|
|
|
bool m_ShowGrid;
|
|
|
|
PARAM_CFG_ARRAY m_projectFileParams;
|
|
|
|
PARAM_CFG_ARRAY m_configSettings;
|
|
|
|
wxPageSetupDialogData m_pageSetupData;
|
2010-03-16 18:22:59 +00:00
|
|
|
wxFindReplaceData* m_findReplaceData;
|
2010-02-02 15:01:09 +00:00
|
|
|
wxPoint m_previewPosition;
|
|
|
|
wxSize m_previewSize;
|
|
|
|
wxPoint m_printDialogPosition;
|
|
|
|
wxSize m_printDialogSize;
|
|
|
|
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
|
|
|
|
bool m_showSheetReference;
|
2010-03-16 18:22:59 +00:00
|
|
|
DIALOG_SCH_FIND* m_dlgFindReplace;
|
|
|
|
wxPoint m_findDialogPosition;
|
|
|
|
wxSize m_findDialogSize;
|
|
|
|
wxArrayString m_findStringHistoryList;
|
|
|
|
wxArrayString m_replaceStringHistoryList;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_SchematicFrame( wxWindow* father,
|
2008-04-14 19:22:48 +00:00
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
|
|
|
|
|
|
|
~WinEDA_SchematicFrame();
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
|
|
|
void Process_Config( wxCommandEvent& event );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
|
2010-07-14 13:24:36 +00:00
|
|
|
void SaveProjectFile( wxWindow* displayframe, bool askoverwrite = true );
|
|
|
|
bool LoadProjectFile( const wxString& CfgFileName, bool ForceRereadConfig );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetDefaultFieldName
|
|
|
|
* returns a default symbol field name for field \a aFieldNdx for all components.
|
|
|
|
* These fieldnames are not modifiable, but template fieldnames are.
|
|
|
|
* @param aFieldNdx The field number index
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
static wxString GetDefaultFieldName( int aFieldNdx );
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AddTemplateFieldName
|
|
|
|
* inserts or appends a wanted symbol field name into the fieldnames
|
|
|
|
* template. Should be used for any symbol property editor. If the name
|
|
|
|
* already exists, it overwrites the same name.
|
|
|
|
*
|
|
|
|
* @param aFieldName is a full description of the wanted field, and it must not match
|
|
|
|
* any of the default fieldnames.
|
|
|
|
* @return int - the index within the config container at which aFieldName was
|
|
|
|
* added, or -1 if the name is illegal because it matches a default fieldname.
|
|
|
|
*/
|
|
|
|
int AddTemplateFieldName( const TEMPLATE_FIELDNAME& aFieldName )
|
|
|
|
{
|
|
|
|
return m_TemplateFieldNames.AddTemplateFieldName( aFieldName );
|
|
|
|
}
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetTemplateFieldName
|
|
|
|
* returns a template fieldnames list for read only access.
|
|
|
|
*/
|
|
|
|
const TEMPLATE_FIELDNAMES& GetTemplateFieldNames()
|
|
|
|
{
|
|
|
|
return m_TemplateFieldNames.GetTemplateFieldNames();
|
|
|
|
}
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-06-17 16:30:10 +00:00
|
|
|
/**
|
|
|
|
* Function DeleteAllTemplateFieldNames
|
|
|
|
* removes all template fieldnames.
|
|
|
|
*/
|
|
|
|
void DeleteAllTemplateFieldNames()
|
|
|
|
{
|
|
|
|
m_TemplateFieldNames.DeleteAllTemplateFieldNames();
|
|
|
|
}
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
|
2010-07-14 13:24:36 +00:00
|
|
|
void LoadSettings();
|
|
|
|
void SaveSettings();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void CreateScreens();
|
|
|
|
void ReCreateHToolbar();
|
|
|
|
void ReCreateVToolbar();
|
|
|
|
void ReCreateOptToolbar();
|
|
|
|
void ReCreateMenuBar();
|
|
|
|
void OnHotKey( wxDC* DC,
|
|
|
|
int hotkey,
|
|
|
|
EDA_BaseStruct* DrawStruct );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
SCH_FIELD* GetCurrentField() { return m_CurrentField; }
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
void SetCurrentField( SCH_FIELD* aCurrentField )
|
2008-11-24 06:53:43 +00:00
|
|
|
{
|
|
|
|
m_CurrentField = aCurrentField;
|
|
|
|
}
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-02-18 20:07:29 +00:00
|
|
|
/** Function OnModify()
|
|
|
|
* Must be called after a schematic change
|
|
|
|
* in order to set the "modify" flag of the current screen
|
|
|
|
* and update the date in frame reference
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void OnModify();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* GetSheet();
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
SCH_SCREEN* GetScreen() const;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
BASE_SCREEN* GetBaseScreen() const;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
virtual wxString GetScreenDesc();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-03-20 19:57:59 +00:00
|
|
|
void InstallConfigFrame( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
|
|
|
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
|
|
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
|
|
|
void OnSelectOptionToolbar( wxCommandEvent& event );
|
2009-11-04 20:46:53 +00:00
|
|
|
int BestZoom();
|
2009-04-10 14:53:24 +00:00
|
|
|
|
|
|
|
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
|
2009-09-22 12:27:57 +00:00
|
|
|
SCH_ITEM* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
|
2010-07-14 13:24:36 +00:00
|
|
|
bool IncludePin );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
|
|
|
* Function FillFootprintFieldForAllInstancesofComponent
|
2009-09-22 12:27:57 +00:00
|
|
|
* searches for component "aReference", and places a Footprint in
|
|
|
|
* Footprint field
|
2009-11-04 20:46:53 +00:00
|
|
|
* @param aReference = reference of the component to initialize
|
|
|
|
* @param aFootPrint = new value for the filed Footprint component
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aSetVisible = true to have the field visible, false to set the
|
|
|
|
* invisible flag
|
2008-05-16 09:21:01 +00:00
|
|
|
* @return true if the given component is found
|
|
|
|
* Note:
|
2009-09-22 12:27:57 +00:00
|
|
|
* the component is searched in the whole schematic, and because some
|
|
|
|
* components have more than one instance (multiple parts per package
|
|
|
|
* components) the search is not stopped when a reference is found
|
|
|
|
* (all instances must be found).
|
2008-05-16 09:21:01 +00:00
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
bool FillFootprintFieldForAllInstancesofComponent( const wxString& aReference,
|
|
|
|
const wxString& aFootPrint,
|
|
|
|
bool aSetVisible );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
SCH_ITEM* FindComponentAndItem( const wxString& component_reference,
|
|
|
|
bool Find_in_hierarchy,
|
|
|
|
int SearchType,
|
|
|
|
const wxString& text_to_find,
|
|
|
|
bool mouseWarp );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* Cross probing with pcbnew */
|
2010-07-14 13:24:36 +00:00
|
|
|
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
|
|
|
|
SCH_COMPONENT* LibItem );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* netlist generation */
|
2010-07-14 13:24:36 +00:00
|
|
|
void BuildNetListBase();
|
|
|
|
|
|
|
|
/** Function CreateNetlist
|
|
|
|
* Create a netlist file:
|
|
|
|
* build netlist info
|
|
|
|
* test issues
|
|
|
|
* create file
|
|
|
|
* @param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
|
|
|
* @param aFullFileName = full netlist file name
|
|
|
|
* @param aUse_netnames = bool. if true, use net names from labels in schematic
|
|
|
|
* if false, use net numbers (net codes)
|
|
|
|
* bool aUse_netnames is used only for Spice netlist
|
|
|
|
* @return true if success.
|
|
|
|
*/
|
|
|
|
bool CreateNetlist( int aFormat,
|
|
|
|
const wxString& aFullFileName,
|
|
|
|
bool aUse_netnames );
|
|
|
|
|
|
|
|
/** function WriteNetListFile
|
|
|
|
* Create the netlist file. Netlist info must be existing
|
|
|
|
* @param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
|
|
|
* @param aFullFileName = full netlist file name
|
|
|
|
* @param aUse_netnames = bool. if true, use net names from labels in schematic
|
|
|
|
* if false, use net numbers (net codes)
|
|
|
|
* bool aUse_netnames is used only for Spice netlist
|
|
|
|
* @return true if success.
|
|
|
|
*/
|
|
|
|
bool WriteNetListFile( int aFormat,
|
|
|
|
const wxString& aFullFileName,
|
|
|
|
bool aUse_netnames );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DeleteAnnotation
|
2008-04-21 06:34:56 +00:00
|
|
|
* Remove current component annotations
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aCurrentSheetOnly : if false: remove all annotations, else
|
|
|
|
* remove annotation relative to the current
|
|
|
|
* sheet only
|
2008-04-21 06:34:56 +00:00
|
|
|
* @param aRedraw : true to refresh display
|
2009-04-10 14:53:24 +00:00
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-01-08 20:29:07 +00:00
|
|
|
// Functions used for hierarchy handling
|
2010-07-14 13:24:36 +00:00
|
|
|
void InstallPreviousSheet();
|
|
|
|
void InstallNextScreen( SCH_SHEET* Sheet );
|
2009-04-10 14:53:24 +00:00
|
|
|
|
2009-01-08 20:29:07 +00:00
|
|
|
/** Function GetUniqueFilenameForCurrentSheet
|
|
|
|
* @return a filename that can be used in plot and print functions
|
2009-11-04 20:46:53 +00:00
|
|
|
* for the current screen and sheet path.
|
|
|
|
* This filename is unique and must be used instead of the screen filename
|
|
|
|
* (or screen filename) when one must creates file for each sheet in the
|
|
|
|
* hierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is
|
2009-09-22 12:27:57 +00:00
|
|
|
* used more than once
|
2009-01-08 20:29:07 +00:00
|
|
|
* Name is <root sheet filename>-<sheet path>
|
|
|
|
* and has no extension.
|
|
|
|
* However if filename is too long name is <sheet filename>-<sheet number>
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
wxString GetUniqueFilenameForCurrentSheet();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
|
|
|
* Function SetSheetNumberAndCount
|
2008-04-30 17:04:22 +00:00
|
|
|
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
|
2009-09-22 12:27:57 +00:00
|
|
|
* must be called after a delete or add sheet command, and when entering
|
|
|
|
* a sheet
|
2008-04-30 17:04:22 +00:00
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void SetSheetNumberAndCount();
|
2008-04-30 17:04:22 +00:00
|
|
|
|
2010-03-18 20:35:29 +00:00
|
|
|
/** Virtual function PrintPage
|
|
|
|
* used to print a page
|
|
|
|
* Print the page pointed by ActiveScreen, set by the calling print function
|
|
|
|
* @param aDC = wxDC given by the calling print function
|
|
|
|
* @param aPrint_Sheet_Ref = true to print page references
|
|
|
|
* @param aPrintMask = not used here
|
|
|
|
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
|
|
|
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
|
|
|
|
*/
|
|
|
|
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
|
2010-07-14 13:24:36 +00:00
|
|
|
int aPrintMask, bool aPrintMirrorMode,
|
|
|
|
void* aData = NULL );
|
|
|
|
|
2010-02-02 15:01:09 +00:00
|
|
|
/**
|
|
|
|
* Show the print dialog
|
2010-01-01 13:30:39 +00:00
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void OnPrint( wxCommandEvent& event );
|
2010-02-02 15:01:09 +00:00
|
|
|
|
|
|
|
wxPageSetupDialogData& GetPageSetupData() { return m_pageSetupData; }
|
|
|
|
|
|
|
|
void SetPreviewPosition( const wxPoint& aPoint ) { m_previewPosition = aPoint; }
|
|
|
|
void SetPreviewSize( const wxSize& aSize ) { m_previewSize = aSize; }
|
2010-07-14 13:24:36 +00:00
|
|
|
const wxPoint& GetPreviewPosition() { return m_previewPosition; }
|
|
|
|
const wxSize& GetPreviewSize() { return m_previewSize; }
|
2010-02-02 15:01:09 +00:00
|
|
|
|
|
|
|
void SetPrintDialogPosition( const wxPoint& aPoint )
|
|
|
|
{
|
|
|
|
m_printDialogPosition = aPoint;
|
|
|
|
}
|
2010-07-14 13:24:36 +00:00
|
|
|
|
|
|
|
|
2010-02-02 15:01:09 +00:00
|
|
|
void SetPrintDialogSize( const wxSize& aSize ) { m_printDialogSize = aSize; }
|
2010-07-14 13:24:36 +00:00
|
|
|
const wxPoint& GetPrintDialogPosition() { return m_printDialogPosition; }
|
|
|
|
const wxSize& GetPrintDialogSize() { return m_printDialogSize; }
|
2010-02-02 15:01:09 +00:00
|
|
|
|
|
|
|
bool GetPrintMonochrome() { return m_printMonochrome; }
|
|
|
|
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
|
|
|
|
bool GetShowSheetReference() { return m_showSheetReference; }
|
|
|
|
void SetShowSheetReference( bool aShow ) { m_showSheetReference = aShow; }
|
2010-01-01 13:30:39 +00:00
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
// Plot functions:
|
2010-07-14 13:24:36 +00:00
|
|
|
void ToPlot_PS( wxCommandEvent& event );
|
|
|
|
void ToPlot_HPGL( wxCommandEvent& event );
|
|
|
|
void ToPlot_DXF( wxCommandEvent& event );
|
|
|
|
void ToPostProcess( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
// read and save files
|
2010-07-14 13:24:36 +00:00
|
|
|
void Save_File( wxCommandEvent& event );
|
|
|
|
void SaveProject();
|
|
|
|
bool LoadOneEEProject( const wxString& FileName, bool IsNew );
|
|
|
|
bool LoadOneEEFile( SCH_SCREEN* screen,
|
|
|
|
const wxString& FullFileName );
|
|
|
|
bool ReadInputStuffFile();
|
2008-05-07 23:41:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ProcessStuffFile
|
|
|
|
* gets footprint info from each line in the Stuff File by Ref Desg
|
2008-05-16 09:21:01 +00:00
|
|
|
* @param aFilename The file to read from.
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aSetFielsAttributeToVisible = true to set the footprint field
|
2010-07-14 13:24:36 +00:00
|
|
|
* flag to visible
|
2008-05-07 23:41:05 +00:00
|
|
|
* @return bool - true if success, else true.
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
bool ProcessStuffFile( FILE* aFilename,
|
|
|
|
bool aSetFielsAttributeToVisible );
|
2008-05-07 23:41:05 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// General search:
|
|
|
|
|
|
|
|
private:
|
2010-07-14 13:24:36 +00:00
|
|
|
void Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC );
|
|
|
|
void OnExit( wxCommandEvent& event );
|
|
|
|
void OnAnnotate( wxCommandEvent& event );
|
|
|
|
void OnErc( wxCommandEvent& event );
|
|
|
|
void OnCreateNetlist( wxCommandEvent& event );
|
|
|
|
void OnCreateBillOfMaterials( wxCommandEvent& event );
|
|
|
|
void OnFindItems( wxCommandEvent& event );
|
|
|
|
void OnFindDialogClose( wxFindDialogEvent& event );
|
|
|
|
void OnFindDrcMarker( wxFindDialogEvent& event );
|
|
|
|
void OnFindCompnentInLib( wxFindDialogEvent& event );
|
|
|
|
void OnFindSchematicItem( wxFindDialogEvent& event );
|
|
|
|
void OnLoadFile( wxCommandEvent& event );
|
|
|
|
void OnLoadStuffFile( wxCommandEvent& event );
|
|
|
|
void OnNewProject( wxCommandEvent& event );
|
|
|
|
void OnLoadProject( wxCommandEvent& event );
|
|
|
|
void OnOpenPcbnew( wxCommandEvent& event );
|
|
|
|
void OnOpenCvpcb( wxCommandEvent& event );
|
|
|
|
void OnOpenLibraryViewer( wxCommandEvent& event );
|
|
|
|
void OnOpenLibraryEditor( wxCommandEvent& event );
|
|
|
|
void OnSetOptions( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-01-09 08:50:30 +00:00
|
|
|
/* edition events functions */
|
2010-07-14 13:24:36 +00:00
|
|
|
void OnCopySchematicItemRequest( wxCommandEvent& event );
|
2010-01-09 08:50:30 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
/* User interface update event handlers. */
|
2010-07-14 13:24:36 +00:00
|
|
|
void OnUpdateBlockSelected( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdatePaste( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateSchematicUndo( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateSchematicRedo( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateGrid( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateUnits( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateSelectCursor( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateHiddenPins( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-03-20 19:57:59 +00:00
|
|
|
/** function SetLanguage
|
|
|
|
* called on a language menu selection
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void SetLanguage( wxCommandEvent& event );
|
2010-03-20 19:57:59 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
// Bus Entry
|
2010-07-14 13:24:36 +00:00
|
|
|
SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type );
|
|
|
|
void SetBusEntryShape( wxDC* DC,
|
|
|
|
SCH_BUS_ENTRY* BusEntry,
|
|
|
|
int entry_type );
|
|
|
|
int GetBusEntryShape( SCH_BUS_ENTRY* BusEntry );
|
|
|
|
void StartMoveBusEntry( SCH_BUS_ENTRY* DrawLibItem,
|
|
|
|
wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// NoConnect
|
2010-07-14 13:24:36 +00:00
|
|
|
SCH_NO_CONNECT* CreateNewNoConnectStruct( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Junction
|
2010-07-14 13:24:36 +00:00
|
|
|
SCH_JUNCTION* CreateNewJunctionStruct( wxDC* DC,
|
|
|
|
const wxPoint& pos,
|
|
|
|
bool PutInUndoList = FALSE );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Text ,label, glabel
|
2010-07-14 13:24:36 +00:00
|
|
|
SCH_TEXT* CreateNewText( wxDC* DC, int type );
|
|
|
|
void EditSchematicText( SCH_TEXT* TextStruct );
|
|
|
|
void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC );
|
|
|
|
void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC );
|
|
|
|
void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Wire, Bus
|
2010-07-14 13:24:36 +00:00
|
|
|
void BeginSegment( wxDC* DC, int type );
|
|
|
|
void EndSegment( wxDC* DC );
|
|
|
|
void DeleteCurrentSegment( wxDC* DC );
|
|
|
|
void DeleteConnection( bool DeleteFullConnection );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// graphic lines
|
2010-07-14 13:24:36 +00:00
|
|
|
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
|
|
|
|
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
|
|
|
|
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
|
|
|
|
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Hierarchical Sheet & PinSheet
|
2010-07-14 13:24:36 +00:00
|
|
|
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
|
|
|
|
SCH_SHEET* CreateSheet( wxDC* DC );
|
|
|
|
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
/**
|
|
|
|
* Use the component viewer to select component to import into schematic.
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
wxString SelectFromLibBrowser( void );
|
2009-10-16 17:18:23 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2010-07-14 13:24:36 +00:00
|
|
|
bool EditSheet( SCH_SHEET* Sheet, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/** Function UpdateSheetNumberAndDate
|
|
|
|
* Set a sheet number, the sheet count for sheets in the whole schematic
|
|
|
|
* and update the date in all screens
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void UpdateSheetNumberAndDate();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2010-07-14 13:24:36 +00:00
|
|
|
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
|
|
|
|
SCH_SHEET_PIN* Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
|
|
|
|
int Edit_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC );
|
|
|
|
void StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel,
|
|
|
|
wxDC* DC );
|
|
|
|
void Place_PinSheet( SCH_SHEET_PIN* SheetLabel,
|
|
|
|
wxDC* DC );
|
|
|
|
SCH_SHEET_PIN* Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2010-07-14 13:24:36 +00:00
|
|
|
void DeleteSheetLabel( bool aRedraw,
|
|
|
|
SCH_SHEET_PIN* aSheetLabelToDel );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// Component
|
2010-07-14 13:24:36 +00:00
|
|
|
SCH_COMPONENT* Load_Component( wxDC* DC,
|
|
|
|
const wxString& libname,
|
|
|
|
wxArrayString& List,
|
|
|
|
bool UseLibBrowser );
|
|
|
|
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2010-07-14 13:24:36 +00:00
|
|
|
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
|
|
|
wxDC* DC, int type_rotate );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2010-07-14 13:24:36 +00:00
|
|
|
void SelPartUnit( SCH_COMPONENT* DrawComponent,
|
|
|
|
int unit, wxDC* DC );
|
|
|
|
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
|
|
|
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
|
|
|
void EditComponentReference( SCH_COMPONENT* DrawLibItem,
|
|
|
|
wxDC* DC );
|
|
|
|
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
|
|
|
|
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
|
|
|
|
wxDC* DC );
|
|
|
|
void StartMoveCmpField( SCH_FIELD* Field, wxDC* DC );
|
|
|
|
void EditCmpFieldText( SCH_FIELD* Field, wxDC* DC );
|
|
|
|
void RotateCmpField( SCH_FIELD* Field, wxDC* DC );
|
|
|
|
|
|
|
|
void PasteListOfItems( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* Undo - redo */
|
|
|
|
public:
|
2009-07-26 17:16:42 +00:00
|
|
|
|
|
|
|
/** Function SaveCopyInUndoList.
|
|
|
|
* Creates a new entry in undo list of commands.
|
|
|
|
* add a picker to handle aItemToCopy
|
|
|
|
* @param aItemToCopy = the schematic item modified by the command to undo
|
|
|
|
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation,
|
|
|
|
* for commands like move
|
2009-07-26 17:16:42 +00:00
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
void SaveCopyInUndoList( SCH_ITEM* aItemToCopy,
|
2010-07-14 13:24:36 +00:00
|
|
|
UndoRedoOpType aTypeCommand,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
2009-07-26 17:16:42 +00:00
|
|
|
|
|
|
|
/** Function SaveCopyInUndoList (overloaded).
|
|
|
|
* Creates a new entry in undo list of commands.
|
|
|
|
* add a list of pickers to handle a list of items
|
|
|
|
* @param aItemsList = the list of items modified by the command to undo
|
|
|
|
* @param aTypeCommand = command type (see enum UndoRedoOpType)
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aTransformPoint = the reference point of the transformation,
|
|
|
|
* for commands like move
|
2009-07-26 17:16:42 +00:00
|
|
|
*/
|
2009-09-22 12:27:57 +00:00
|
|
|
void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
|
2010-07-14 13:24:36 +00:00
|
|
|
UndoRedoOpType aTypeCommand,
|
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/** Function PutDataInPreviousState()
|
|
|
|
* Used in undo or redo command.
|
2009-09-22 12:27:57 +00:00
|
|
|
* Put data pointed by List in the previous state, i.e. the state
|
2009-11-04 20:46:53 +00:00
|
|
|
* memorized by List
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
|
|
|
|
* undo/redo
|
2009-08-01 19:26:05 +00:00
|
|
|
* @param aRedoCommand = a bool: true for redo, false for undo
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/** Function GetSchematicFromRedoList
|
|
|
|
* Redo the last edition:
|
|
|
|
* - Save the current schematic in Undo list
|
|
|
|
* - Get an old version of the schematic from Redo list
|
|
|
|
* @return none
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void GetSchematicFromRedoList( wxCommandEvent& event );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/** Function GetSchematicFromUndoList
|
|
|
|
* Undo the last edition:
|
|
|
|
* - Save the current schematic in Redo list
|
|
|
|
* - Get an old version of the schematic from Undo list
|
|
|
|
* @return none
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void GetSchematicFromUndoList( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
public:
|
2010-07-14 13:24:36 +00:00
|
|
|
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* Block operations. */
|
2010-07-14 13:24:36 +00:00
|
|
|
int ReturnBlockCommand( int key );
|
|
|
|
void InitBlockPasteInfos();
|
|
|
|
void HandleBlockPlace( wxDC* DC );
|
|
|
|
int HandleBlockEnd( wxDC* DC );
|
|
|
|
void HandleBlockEndByPopUp( int Command, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void RepeatDrawItem( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
|
|
|
|
LIB_PIN* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-07-05 12:09:41 +00:00
|
|
|
// ERC:
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2009-07-05 12:09:41 +00:00
|
|
|
/**
|
|
|
|
* Function CheckAnnotate
|
|
|
|
* Check errors relatives to annotation:
|
|
|
|
* components not annotated
|
|
|
|
* components having the same reference (duplicates)
|
|
|
|
* for multiple parts per package components :
|
|
|
|
* part number > number of parts
|
|
|
|
* different values between parts
|
|
|
|
* @return errors count
|
2009-09-22 12:27:57 +00:00
|
|
|
* @param aMessageList = a wxArrayString to store messages. If NULL,
|
|
|
|
* they are displayed in a wxMessageBox
|
2009-07-05 12:09:41 +00:00
|
|
|
* @param aOneSheetOnly : true = search is made only in the current sheet
|
|
|
|
* false = search in whole hierarchy (usual search).
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
int CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly );
|
2009-07-05 12:09:41 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
/**
|
|
|
|
* Load component libraries defined in project file.
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void LoadLibraries( void );
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2009-07-05 12:09:41 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // WX_EESCHEMA_STRUCT_H
|