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"
|
2011-01-07 19:24:24 +00:00
|
|
|
#include "block_commande.h"
|
2011-02-05 02:21:11 +00:00
|
|
|
#include "class_sch_screen.h"
|
2011-03-25 19:16:05 +00:00
|
|
|
#include "sch_collectors.h"
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2010-11-19 16:28:46 +00:00
|
|
|
class LIB_EDIT_FRAME;
|
2010-11-20 21:59:00 +00:00
|
|
|
class LIB_VIEW_FRAME;
|
2009-02-04 15:25:03 +00:00
|
|
|
class DRAWSEGMENT;
|
2008-04-14 19:22:48 +00:00
|
|
|
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;
|
2010-12-08 20:12:46 +00:00
|
|
|
class EDA_ITEM;
|
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
|
|
|
|
2011-05-20 19:21:09 +00:00
|
|
|
/** Schematic annotation order options. */
|
|
|
|
enum ANNOTATE_ORDER_T {
|
|
|
|
SORT_BY_X_POSITION, ///< Annotate by X position from left to right.
|
|
|
|
SORT_BY_Y_POSITION, ///< Annotate by Y position from top to bottom.
|
|
|
|
UNSORTED, ///< Annotate by position of component in the schematic sheet
|
|
|
|
///< object list.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/** Schematic annotation type options. */
|
|
|
|
enum ANNOTATE_OPTION_T {
|
|
|
|
INCREMENTAL_BY_REF, ///< Annotate incrementally using the first free reference number.
|
|
|
|
SHEET_NUMBER_X_100, ///< Annotate using the first free reference number starting at
|
|
|
|
///< the sheet number * 100.
|
|
|
|
SHEET_NUMBER_X_1000, ///< Annotate using the first free reference number starting at
|
|
|
|
///< the sheet number * 1000.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
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
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
class SCH_EDIT_FRAME : public EDA_DRAW_FRAME
|
2008-04-14 19:22:48 +00:00
|
|
|
{
|
|
|
|
public:
|
2011-04-19 19:19:41 +00:00
|
|
|
wxComboBox* m_SelPartBox;
|
2010-02-02 15:01:09 +00:00
|
|
|
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;
|
2011-03-31 15:22:34 +00:00
|
|
|
int m_AddSubPrefix;
|
2010-02-02 15:01:09 +00:00
|
|
|
bool m_ShowAllPins;
|
|
|
|
wxPoint m_OldPos;
|
2010-11-19 16:28:46 +00:00
|
|
|
LIB_EDIT_FRAME* m_LibeditFrame;
|
2010-11-20 21:59:00 +00:00
|
|
|
LIB_VIEW_FRAME* m_ViewlibFrame;
|
2010-02-02 15:01:09 +00:00
|
|
|
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;
|
2010-07-14 13:24:36 +00:00
|
|
|
int m_TextFieldSize;
|
2010-02-02 15:01:09 +00:00
|
|
|
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.
|
2010-11-29 15:05:01 +00:00
|
|
|
bool m_printSheetReference;
|
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;
|
2011-01-07 19:24:24 +00:00
|
|
|
BLOCK_SELECTOR m_blockItems; ///< List of selected items.
|
2011-01-12 21:47:54 +00:00
|
|
|
SCH_ITEM* m_itemToRepeat; ///< Last item to insert by the repeat command.
|
|
|
|
int m_repeatLabelDelta; ///< Repeat label number increment step.
|
2011-03-25 19:16:05 +00:00
|
|
|
SCH_COLLECTOR m_collectedItems; ///< List of collected items.
|
2011-04-05 14:46:51 +00:00
|
|
|
SCH_ITEM* m_undoItem; ///< Copy of the current item being edited.
|
2011-06-15 18:44:24 +00:00
|
|
|
wxString m_simulatorCommand; ///< Command line used to call the circuit
|
|
|
|
///< simulator (gnucap, spice, ...)
|
|
|
|
wxString m_netListerCommand; ///< Command line to call a custom net list
|
|
|
|
///< generator.
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
static int m_lastSheetPinType; ///< Last sheet pin type.
|
|
|
|
static wxSize m_lastSheetPinTextSize; ///< Last sheet pin text size.
|
|
|
|
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
|
|
|
|
static int m_lastSheetPinEdge; ///< Last sheet edge a sheet pin was placed.
|
|
|
|
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_EDIT_FRAME( wxWindow* father,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
~SCH_EDIT_FRAME();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
2010-12-02 21:41:56 +00:00
|
|
|
void OnColorConfig( wxCommandEvent& aEvent );
|
2010-07-14 13:24:36 +00:00
|
|
|
void Process_Config( wxCommandEvent& event );
|
2011-02-21 13:54:29 +00:00
|
|
|
void OnSelectTool( wxCommandEvent& aEvent );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-02-22 16:43:03 +00:00
|
|
|
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
/**
|
|
|
|
* Function GetProjectFileParameters
|
|
|
|
* returns the project file parameter list for EESchema.
|
|
|
|
*
|
|
|
|
*<p?
|
|
|
|
* Populate the project file parameter array specific to EESchema if it hasn't
|
|
|
|
* already been populated and return a reference to the array to the caller.
|
|
|
|
* Creating the parameter list at run time has the advantage of being able to
|
|
|
|
* define local variables. The old method of statically building the array at
|
|
|
|
* compile time required global variable definitions.
|
|
|
|
* </p>
|
|
|
|
*/
|
2009-05-21 17:42:42 +00:00
|
|
|
PARAM_CFG_ARRAY& GetProjectFileParameters( void );
|
2011-08-18 19:25:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SaveProjectFile
|
|
|
|
* saves changes to the project settings to the project (.pro) file.
|
|
|
|
*/
|
|
|
|
void SaveProjectFile();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadProjectFile
|
|
|
|
* soads the Kicad project file (*.pro) settings specific to EESchema.
|
|
|
|
*
|
|
|
|
* @param aFileName The project file name to load.
|
|
|
|
* @param aForceReread Force the project file to be reread if true.
|
|
|
|
* @return True if the project file was loaded correctly.
|
|
|
|
*/
|
|
|
|
bool LoadProjectFile( const wxString& aFileName, bool aForceReread );
|
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.
|
2011-03-29 15:21:35 +00:00
|
|
|
* These field names are not modifiable, but template field names are.
|
2010-06-17 16:30:10 +00:00
|
|
|
* @param aFieldNdx The field number index
|
|
|
|
*/
|
2011-08-18 19:25:12 +00:00
|
|
|
static wxString GetDefaultFieldName( int aFieldNdx );
|
2010-06-17 16:30:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function AddTemplateFieldName
|
2011-03-29 15:21:35 +00:00
|
|
|
* inserts or appends a wanted symbol field name into the field names
|
2010-06-17 16:30:10 +00:00
|
|
|
* 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
|
2011-03-29 15:21:35 +00:00
|
|
|
* any of the default field names.
|
2010-06-17 16:30:10 +00:00
|
|
|
* @return int - the index within the config container at which aFieldName was
|
2011-03-29 15:21:35 +00:00
|
|
|
* added, or -1 if the name is illegal because it matches a default field name.
|
2010-06-17 16:30:10 +00:00
|
|
|
*/
|
|
|
|
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
|
2011-03-29 15:21:35 +00:00
|
|
|
* returns a template field names list for read only access.
|
2010-06-17 16:30:10 +00:00
|
|
|
*/
|
|
|
|
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
|
2011-03-29 15:21:35 +00:00
|
|
|
* removes all template field names.
|
2010-06-17 16:30:10 +00:00
|
|
|
*/
|
|
|
|
void DeleteAllTemplateFieldNames()
|
|
|
|
{
|
|
|
|
m_TemplateFieldNames.DeleteAllTemplateFieldNames();
|
|
|
|
}
|
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
/**
|
|
|
|
* Function GetConfigurationSettings
|
|
|
|
* returns the EESchema applications settings.
|
|
|
|
* <p>
|
|
|
|
* This replaces the old statically define list that had the project file settings and
|
|
|
|
* the application settings mixed together. This was confusing and caused some settings
|
|
|
|
* to get saved and loaded incorrectly. Currently, only the settings that are needed at
|
|
|
|
* start up by the main window are defined here. There are other locally used settings
|
|
|
|
* scattered throughout the EESchema source code. If you need to define a configuration
|
|
|
|
* setting that need to be loaded at run time, this is the place to define it.
|
|
|
|
* </p>
|
|
|
|
*/
|
2009-05-21 17:42:42 +00:00
|
|
|
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
|
2011-08-18 19:25:12 +00:00
|
|
|
|
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();
|
2011-02-02 19:01:21 +00:00
|
|
|
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
|
|
|
EDA_ITEM* aItem = NULL );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function OnModify
|
2010-02-18 20:07:29 +00:00
|
|
|
* 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
|
|
|
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
|
|
|
|
2011-02-02 19:01:21 +00:00
|
|
|
void OnLeftClick( wxDC* aDC, const wxPoint& aPosition );
|
|
|
|
void OnLeftDClick( wxDC* aDC, const wxPoint& aPosition );
|
|
|
|
bool OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu );
|
2009-04-10 14:53:24 +00:00
|
|
|
void OnSelectOptionToolbar( wxCommandEvent& event );
|
2011-07-05 12:46:14 +00:00
|
|
|
double BestZoom();
|
2009-04-10 14:53:24 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
/**
|
|
|
|
* Function LocateAndShowItem
|
|
|
|
* checks the schematic at \a aPosition in logical (drawing) units for a item
|
2011-05-20 19:21:09 +00:00
|
|
|
* matching the types in \a aFilterList.
|
2011-03-25 19:16:05 +00:00
|
|
|
* <p>
|
|
|
|
* The search is first performed at the nearest grid position to \a aPosition. If no
|
|
|
|
* item if found on grid, then \a aPosition is tested for any items. If the item found
|
|
|
|
* can be cross probed, a message is send to PCBNew and the selected item is highlighted
|
|
|
|
* in PCB editor.
|
|
|
|
* </p>
|
|
|
|
* @param aPosition The wxPoint on the schematic to search.
|
|
|
|
* @param aFilterList A list of #KICAD_T types to to filter.
|
|
|
|
* @param aHotKeyCommandId A hot key command ID for performing additional tests when
|
|
|
|
* multiple items are found at \a aPosition.
|
|
|
|
* @return A SCH_ITEM pointer of the item found or NULL if no item found
|
|
|
|
*/
|
|
|
|
SCH_ITEM* LocateAndShowItem( const wxPoint& aPosition,
|
|
|
|
const KICAD_T aFilterList[] = SCH_COLLECTOR::AllItems,
|
|
|
|
int aHotKeyCommandId = 0 );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
2011-03-25 19:16:05 +00:00
|
|
|
* Function LocateItem
|
2011-05-20 19:21:09 +00:00
|
|
|
* checks for items at \a aPosition matching the types in \a aFilterList.
|
2011-03-10 19:36:30 +00:00
|
|
|
* <p>
|
2011-03-25 19:16:05 +00:00
|
|
|
* If multiple items are located at \a aPosition, a context menu is displayed to clarify
|
|
|
|
* which item the user intended to select. If the user aborts the context menu, NULL is
|
|
|
|
* returned and the abort request flag will be set to true. Make sure to clear this flag
|
|
|
|
* before attempting to display any other context menus.
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @param aPosition The wxPoint location where to search.
|
|
|
|
* @param aFilterList A list of #KICAD_T types to to filter.
|
|
|
|
* @param aHotKeyCommandId A hot key command ID for performing additional tests when
|
|
|
|
* multiple items are found at \a aPosition.
|
|
|
|
* @return The SCH_ITEM pointer of the item found or NULL if no item found.
|
|
|
|
*/
|
|
|
|
SCH_ITEM* LocateItem( const wxPoint& aPosition,
|
|
|
|
const KICAD_T aFilterList[] = SCH_COLLECTOR::AllItems,
|
|
|
|
int aHotKeyCommandId = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DeleteItemAtCrossHair
|
|
|
|
* delete the item found under the cross hair. If multiple items are found at the
|
|
|
|
* cross hair position, a context menu is displayed to clarify which item to delete.
|
|
|
|
* See LocateItem() for more information on locating multiple items.
|
|
|
|
*
|
2011-03-10 19:36:30 +00:00
|
|
|
* @param aDC The device context to update if and item is deleted.
|
|
|
|
* @return True if an item was deleted.
|
|
|
|
*/
|
2011-03-29 15:21:35 +00:00
|
|
|
bool DeleteItemAtCrossHair( wxDC* aDC );
|
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-12-08 20:12:46 +00:00
|
|
|
void SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* netlist generation */
|
2010-07-14 13:24:36 +00:00
|
|
|
void BuildNetListBase();
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function CreateNetlist
|
2010-07-14 13:24:36 +00:00
|
|
|
* 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
|
2011-04-12 14:19:59 +00:00
|
|
|
* @param aUsePrefix Prefix reference designator with an 'X' for spice output.
|
2010-07-14 13:24:36 +00:00
|
|
|
* @return true if success.
|
|
|
|
*/
|
|
|
|
bool CreateNetlist( int aFormat,
|
|
|
|
const wxString& aFullFileName,
|
2011-03-31 15:22:34 +00:00
|
|
|
bool aUse_netnames,
|
|
|
|
bool aUsePrefix );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function WriteNetListFile
|
2010-07-14 13:24:36 +00:00
|
|
|
* 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,
|
2011-03-31 15:22:34 +00:00
|
|
|
bool aUse_netnames,
|
|
|
|
bool aUsePrefix );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DeleteAnnotation
|
2011-05-20 19:21:09 +00:00
|
|
|
* clears the current component annotation.
|
|
|
|
* @param aCurrentSheetOnly Clear the entire schematic annotation if true. Otherwise
|
|
|
|
* only clear the annotation for the current sheet.
|
2009-04-10 14:53:24 +00:00
|
|
|
*/
|
2011-05-20 19:21:09 +00:00
|
|
|
void DeleteAnnotation( bool aCurrentSheetOnly );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-01-01 17:28:21 +00:00
|
|
|
/**
|
2011-05-20 19:21:09 +00:00
|
|
|
* Function AnnotateComponents
|
2011-01-01 17:28:21 +00:00
|
|
|
*
|
2011-05-20 19:21:09 +00:00
|
|
|
* annotates the components in the schematic that are not currently annotated.
|
|
|
|
*
|
|
|
|
* @param aAnnotateSchematic Annotate the entire schematic if true. Otherwise annotate
|
|
|
|
* the current sheet only.
|
|
|
|
* @param aSortOption Define the annotation order. See #ANNOTATE_ORDER_T.
|
|
|
|
* @param aAlgoOption Define the annotation style. See #ANNOTATE_OPTION_T.
|
|
|
|
* @param aResetAnnotation Clear any previous annotation if true. Otherwise, keep the
|
|
|
|
* existing component annotation.
|
|
|
|
* @param aRepairTimestamps Test for and repair any duplicate time stamps if true.
|
|
|
|
* Otherwise, keep the existing time stamps. This option
|
|
|
|
* could change previous annotation because time stamps are
|
|
|
|
* used to handle annotation in complex hierarchies.
|
|
|
|
*
|
|
|
|
* When the sheet number is used in annotation, each sheet annotation starts from sheet
|
|
|
|
* number * 100. In other words the first sheet uses 100 to 199, the second sheet uses
|
|
|
|
* 200 to 299, and so on.
|
|
|
|
*/
|
|
|
|
void AnnotateComponents( bool aAnnotateSchematic, ANNOTATE_ORDER_T aSortOption,
|
|
|
|
ANNOTATE_OPTION_T aAlgoOption, bool aResetAnnotation,
|
|
|
|
bool aRepairTimestamps );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function CheckAnnotate
|
|
|
|
* checks for annotation errors.
|
|
|
|
*
|
|
|
|
* <p>
|
|
|
|
* The following list of items are checked:
|
|
|
|
* <ul>
|
|
|
|
* <li> Components that are not annotated.
|
|
|
|
* <li> Duplicate component references.
|
|
|
|
* <li> Multiple part per package components where the part\n
|
|
|
|
* number is greater number of parts in the package.
|
|
|
|
* <li> Multiple part per package components where the reference\n
|
|
|
|
* designator is different between parts.
|
|
|
|
* </ul>
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @return Number of annotation errors found.
|
|
|
|
* @param aMessageList A wxArrayString to store error messages.
|
|
|
|
* @param aOneSheetOnly Check the current sheet only if true. Otherwise check
|
|
|
|
* the entire schematic.
|
|
|
|
*/
|
|
|
|
int CheckAnnotate( wxArrayString* aMessageList, bool aOneSheetOnly );
|
2011-02-05 02:21:11 +00:00
|
|
|
|
2009-01-08 20:29:07 +00:00
|
|
|
// Functions used for hierarchy handling
|
2011-02-05 02:21:11 +00:00
|
|
|
/**
|
|
|
|
* Function DisplayCurrentSheet
|
|
|
|
* draws the current sheet on the display.
|
|
|
|
*/
|
|
|
|
void DisplayCurrentSheet();
|
2009-04-10 14:53:24 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetUniqueFilenameForCurrentSheet
|
2009-01-08 20:29:07 +00:00
|
|
|
* @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
|
2010-12-14 21:39:31 +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>
|
2009-01-08 20:29:07 +00:00
|
|
|
*/
|
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-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; }
|
2010-11-29 15:05:01 +00:00
|
|
|
bool GetPrintSheetReference() { return m_printSheetReference; }
|
|
|
|
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
|
2010-11-17 21:47:27 +00:00
|
|
|
void SVG_Print( wxCommandEvent& event );
|
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
|
2011-08-18 19:25:12 +00:00
|
|
|
void Save_File( wxCommandEvent& event );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnSaveProject
|
|
|
|
* is the command event handler to save the entire project and create a component library
|
|
|
|
* archive.
|
|
|
|
*
|
|
|
|
* The component library archive name is <root_name>-cache.lib
|
|
|
|
*/
|
|
|
|
void OnSaveProject( wxCommandEvent& aEvent );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadOneEEProject
|
|
|
|
* load an entire project into the schematic editor.
|
|
|
|
*
|
|
|
|
* This function loads schematic root file and it's subhierarchies, the project
|
|
|
|
* configuration, and the component libraries which are not already loaded.
|
|
|
|
*
|
|
|
|
* @param aFileName The full path an file name to load.
|
|
|
|
* @param aIsNew True indicates that this is a new project and the default project
|
|
|
|
* template is loaded.
|
|
|
|
* @return True if the project loaded properly.
|
|
|
|
*/
|
|
|
|
bool LoadOneEEProject( const wxString& aFileName, bool aIsNew );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function LoadOneEEFile
|
|
|
|
* loads the schematic (.sch) file \a aFullFileName into \a aScreen.
|
|
|
|
*
|
|
|
|
* @param aScreen Pointer to the associated SCH_SCREEN object in which to load
|
|
|
|
* \a aFullFileName.
|
|
|
|
* @param aFullFileName A reference to a wxString object containing the absolute path
|
|
|
|
* and file name to load.
|
|
|
|
* @return True if \a aFullFileName has been loaded (at least partially.)
|
|
|
|
*/
|
|
|
|
bool LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName );
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
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
|
2010-12-14 15:56:30 +00:00
|
|
|
*
|
|
|
|
* Read a "stuff" file created by cvpcb.
|
|
|
|
* That file has lines like:
|
|
|
|
* comp = "C1" module = "CP6"
|
|
|
|
* comp = "C2" module = "C1"
|
|
|
|
* comp = "C3" module = "C1"
|
|
|
|
* "comp =" gives the component reference
|
|
|
|
* "module =" gives the footprint name
|
|
|
|
*
|
2008-05-16 09:21:01 +00:00
|
|
|
* @param aFilename The file to read from.
|
2010-12-14 15:56:30 +00:00
|
|
|
* @param aSetFieldsAttributeToVisible = true to set the footprint field flag to visible
|
2008-05-07 23:41:05 +00:00
|
|
|
* @return bool - true if success, else true.
|
|
|
|
*/
|
2010-12-14 21:39:31 +00:00
|
|
|
bool ProcessStuffFile( FILE* aFilename, bool aSetFieldsAttributeToVisible );
|
2008-05-07 23:41:05 +00:00
|
|
|
|
2011-08-18 19:25:12 +00:00
|
|
|
/**
|
|
|
|
* Function SaveEEFile
|
|
|
|
* saves \a aScreen to a schematic file.
|
|
|
|
*
|
|
|
|
* @param aScreen A pointer to the SCH_SCREEN object to save. A NULL pointer saves
|
|
|
|
* the current screen.
|
|
|
|
* @param aSaveType Controls how the file is to be saved.
|
|
|
|
* @return True if the file has been saved.
|
|
|
|
*/
|
|
|
|
bool SaveEEFile( SCH_SCREEN* aScreen, int aSaveType );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// General search:
|
|
|
|
|
|
|
|
private:
|
2011-04-19 12:08:12 +00:00
|
|
|
void OnMoveItem( wxCommandEvent& aEvent );
|
2010-07-14 13:24:36 +00:00
|
|
|
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 );
|
2011-02-05 19:22:58 +00:00
|
|
|
void OnCancelCurrentCommand( wxCommandEvent& aEvent );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-03-25 19:16:05 +00:00
|
|
|
void OnSelectItem( wxCommandEvent& aEvent );
|
|
|
|
|
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 OnUpdateHiddenPins( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateBusOrientation( wxUpdateUIEvent& event );
|
2011-02-21 13:54:29 +00:00
|
|
|
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetLanguage
|
2010-03-20 19:57:59 +00:00
|
|
|
* 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
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
/**
|
|
|
|
* Function AddNoConnect
|
|
|
|
* add a no connect item to the current schematic sheet at \a aPosition.
|
|
|
|
* @param aDC The device context to draw the no connect to.
|
|
|
|
* @param aPosition The position in logical (drawing) units to add the no connect.
|
|
|
|
* @return The no connect item added.
|
|
|
|
*/
|
|
|
|
SCH_NO_CONNECT* AddNoConnect( wxDC* aDC, const wxPoint& aPosition );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Junction
|
2011-02-05 02:21:11 +00:00
|
|
|
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = FALSE );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-04-05 14:46:51 +00:00
|
|
|
// Text, label, glabel
|
2011-03-03 01:58:12 +00:00
|
|
|
SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
|
2010-07-14 13:24:36 +00:00
|
|
|
void EditSchematicText( SCH_TEXT* TextStruct );
|
2011-03-03 01:58:12 +00:00
|
|
|
void ChangeTextOrient( SCH_TEXT* aTextItem, wxDC* aDC );
|
2011-04-05 14:46:51 +00:00
|
|
|
void MoveText( SCH_TEXT* aTextItem, wxDC* aDC );
|
2011-03-03 01:58:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function OnCovertTextType
|
|
|
|
* is a command event handler to change a text type to an other one. The new text,
|
|
|
|
* label, hierarchical label, or global label is created from the old text and the
|
|
|
|
* old text is deleted.
|
|
|
|
*/
|
|
|
|
void OnConvertTextType( wxCommandEvent& aEvent );
|
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:
|
2011-06-07 15:29:01 +00:00
|
|
|
/**
|
|
|
|
* Function EditSheet
|
|
|
|
* is used to edit an existing sheet or add a new sheet to the schematic.
|
|
|
|
* <p>
|
|
|
|
* When \a aSheet is a new sheet:
|
|
|
|
* <ul>
|
|
|
|
* <li>and the file name already exists in the schematic hierarchy, the screen associated
|
|
|
|
* with the sheet found in the hierarchy is associated with \a aSheet.</li>
|
|
|
|
* <li>and the file name already exists on the system, then \a aSheet is loaded with the
|
|
|
|
* existing file.</li>
|
|
|
|
* <li>and the file name does not exist in the schematic hierarchy or on the file system,
|
|
|
|
* then a new screen is created and associated with \a aSheet.</li>
|
|
|
|
* </ul> </p> <p>
|
|
|
|
* When \a aSheet is an existing sheet:
|
|
|
|
* <ul>
|
|
|
|
* <li>and the file name already exists in the schematic hierarchy, the current associated
|
|
|
|
* screen is replace by the one found in the hierarchy.</li>
|
|
|
|
* <li>and the file name already exists on the system, the current associated screen file
|
|
|
|
* name is changed and the file is loaded.</li>
|
|
|
|
* <li>and the file name does not exist in the schematic hierarchy or on the file system,
|
|
|
|
* the current associated screen file name is changed and saved to disk.</li>
|
|
|
|
* </ul> </p>
|
|
|
|
*/
|
|
|
|
bool EditSheet( SCH_SHEET* aSheet, wxDC* aDC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-03-30 19:26:05 +00:00
|
|
|
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
|
|
|
|
|
|
|
|
int GetLastSheetPinEdge() const { return m_lastSheetPinEdge; }
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
2010-07-14 13:24:36 +00:00
|
|
|
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
|
2011-03-30 19:26:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function CreateSheetPin
|
|
|
|
* creates a new SCH_SHEET_PIN object and add it to \a aSheet at the current cursor position.
|
|
|
|
* @param aSheet The sheet to add the new sheet pin to.
|
|
|
|
* @param aDC The device context to draw on.
|
|
|
|
* @return The new sheet pin object created or NULL if the task was aborted by the user.
|
|
|
|
*/
|
|
|
|
SCH_SHEET_PIN* CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function EditSheetPin
|
|
|
|
* displays the dialog for editing the parameters of \a aSheetPin.
|
|
|
|
* @param aSheetPin The sheet pin item to edit.
|
|
|
|
* @param aDC The device context to draw on.
|
|
|
|
* @return The user response from the edit dialog.
|
|
|
|
*/
|
|
|
|
int EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function MoveSheetPin
|
|
|
|
* moves \a aSheetPin within it's parent sheet object.
|
|
|
|
* @param aSheetPin The sheet pin item to move.
|
|
|
|
* @param aDC The device context to draw on.
|
|
|
|
*/
|
|
|
|
void MoveSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ImportSheetPin
|
|
|
|
* automatically creates a sheet pin from the hierarchical labels in the schematic
|
|
|
|
* referenced by \a aSheet.
|
|
|
|
* @param aSheet The sheet to import the new sheet pin to.
|
|
|
|
* @param aDC The device context to draw on.
|
|
|
|
* @return The new sheet pin object importd or NULL if the task was aborted by the user.
|
|
|
|
*/
|
|
|
|
SCH_SHEET_PIN* ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2011-03-10 19:36:30 +00:00
|
|
|
/**
|
|
|
|
* Function DeleteItem
|
|
|
|
* removes \a aItem from the current screen and saves it in the undo list.
|
|
|
|
* @param aItem The item to remove from the current screen.
|
|
|
|
*/
|
|
|
|
void DeleteItem( SCH_ITEM* aItem );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
int GetLabelIncrement() const { return m_repeatLabelDelta; }
|
|
|
|
|
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:
|
2011-03-03 19:55:44 +00:00
|
|
|
void OnChangeComponentOrientation( wxCommandEvent& aEvent );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2011-03-02 00:46:08 +00:00
|
|
|
void OnSelectUnit( wxCommandEvent& aEvent );
|
2010-07-14 13:24:36 +00:00
|
|
|
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
|
|
|
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
|
2011-03-29 15:21:35 +00:00
|
|
|
|
|
|
|
void MoveField( SCH_FIELD* aField, wxDC* aDC );
|
|
|
|
void EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC );
|
|
|
|
void RotateField( SCH_FIELD* aField, wxDC* aDC );
|
2010-07-14 13:24:36 +00:00
|
|
|
|
|
|
|
void PasteListOfItems( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* Undo - redo */
|
|
|
|
public:
|
2009-07-26 17:16:42 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SaveCopyInUndoList.
|
2010-12-14 21:39:31 +00:00
|
|
|
* Create a copy of the current schematic item, and put it in the undo list.
|
|
|
|
*
|
|
|
|
* flag_type_command =
|
|
|
|
* UR_CHANGED
|
|
|
|
* UR_NEW
|
|
|
|
* UR_DELETED
|
|
|
|
* UR_WIRE_IMAGE
|
|
|
|
* UR_MOVED
|
|
|
|
*
|
|
|
|
* If it is a delete command, items are put on list with the .Flags member
|
|
|
|
* set to UR_DELETED. When it will be really deleted, the GetDrawItems() and the
|
|
|
|
* sub-hierarchy will be deleted. If it is only a copy, the GetDrawItems() and the
|
|
|
|
* sub-hierarchy must NOT be deleted.
|
|
|
|
*
|
2010-12-28 11:24:42 +00:00
|
|
|
* @note
|
2010-12-14 21:39:31 +00:00
|
|
|
* Edit wires and buses is a bit complex.
|
2010-12-28 11:24:42 +00:00
|
|
|
* because when a new wire is added, a lot of modifications in wire list is made
|
|
|
|
* (wire concatenation): modified items, deleted items and new items
|
2010-12-14 21:39:31 +00:00
|
|
|
* so flag_type_command is UR_WIRE_IMAGE: the struct ItemToCopy is a list of
|
|
|
|
* wires saved in Undo List (for Undo or Redo commands, saved wires will be
|
|
|
|
* exchanged with current wire list
|
2009-07-26 17:16:42 +00:00
|
|
|
* @param aItemToCopy = the schematic item modified by the command to undo
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
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,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
2010-12-14 21:39:31 +00:00
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
2009-07-26 17:16:42 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SaveCopyInUndoList (overloaded).
|
2009-07-26 17:16:42 +00:00
|
|
|
* 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
|
2011-04-05 14:46:51 +00:00
|
|
|
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
|
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,
|
2011-04-05 14:46:51 +00:00
|
|
|
UNDO_REDO_T aTypeCommand,
|
2010-12-14 21:39:31 +00:00
|
|
|
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
2010-11-12 16:59:16 +00:00
|
|
|
* Function PutDataInPreviousState
|
2010-12-14 21:39:31 +00:00
|
|
|
* is used in undo or redo command to put data pointed by List in the previous state, i.e.
|
|
|
|
* the state stored in \a aList
|
|
|
|
* @param aList a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
|
|
|
|
* @param aRedoCommand a bool: true for redo, false for undo
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2010-12-14 21:39:31 +00:00
|
|
|
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSchematicFromRedoList
|
2009-08-01 19:26:05 +00:00
|
|
|
* 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
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetSchematicFromUndoList
|
2010-12-14 21:39:31 +00:00
|
|
|
* performs an undo the last edition:
|
2009-08-01 19:26:05 +00:00
|
|
|
* - Save the current schematic in Redo list
|
|
|
|
* - Get an old version of the schematic from Undo list
|
|
|
|
*/
|
2010-07-14 13:24:36 +00:00
|
|
|
void GetSchematicFromUndoList( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-01-07 19:24:24 +00:00
|
|
|
/**
|
|
|
|
* Function copyBlockItems
|
|
|
|
* copies the list of block item.
|
|
|
|
* @sa m_blockItems
|
2011-06-07 15:29:01 +00:00
|
|
|
* @param aItemsList List to copy the block select items into.
|
2011-01-07 19:24:24 +00:00
|
|
|
*/
|
|
|
|
void copyBlockItems( PICKED_ITEMS_LIST& aItemsList );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-05-20 19:21:09 +00:00
|
|
|
/**
|
|
|
|
* Function addJunctionMenuEntries
|
|
|
|
* adds the context menu items to \a aMenu for \a aJunction.
|
2011-06-07 15:29:01 +00:00
|
|
|
* @param aMenu The menu to add the items to.
|
|
|
|
* @param aJunction The SCH_JUNCTION object selected.
|
2011-05-20 19:21:09 +00:00
|
|
|
*/
|
|
|
|
void addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunction );
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
public:
|
2010-12-08 20:12:46 +00:00
|
|
|
void Key( wxDC* DC, int hotkey, EDA_ITEM* 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
|
|
|
void InitBlockPasteInfos();
|
|
|
|
void HandleBlockEndByPopUp( int Command, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2010-11-13 11:02:24 +00:00
|
|
|
/**
|
|
|
|
* Function ReturnBlockCommand
|
|
|
|
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
|
|
|
|
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
|
|
|
|
* block command is started by dragging the mouse.
|
|
|
|
* @param aKey = the key modifiers (Alt, Shift ...)
|
|
|
|
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
|
|
|
|
*/
|
2010-12-14 15:56:30 +00:00
|
|
|
virtual int ReturnBlockCommand( int aKey );
|
2010-11-13 11:02:24 +00:00
|
|
|
|
|
|
|
/**
|
2010-12-14 21:39:31 +00:00
|
|
|
* Function HandleBlockPlace
|
2010-11-13 11:02:24 +00:00
|
|
|
* Called after HandleBlockEnd, when a block command needs to be
|
|
|
|
* executed after the block is moved to its new place
|
|
|
|
* (bloc move, drag, copy .. )
|
|
|
|
* Parameters must be initialized in GetScreen()->m_BlockLocate
|
|
|
|
*/
|
|
|
|
virtual void HandleBlockPlace( wxDC* DC );
|
|
|
|
|
|
|
|
/**
|
2010-12-14 21:39:31 +00:00
|
|
|
* Function HandleBlockEnd
|
2010-11-13 11:02:24 +00:00
|
|
|
* Handle the "end" of a block command,
|
|
|
|
* i.e. is called at the end of the definition of the area of a block.
|
|
|
|
* depending on the current block command, this command is executed
|
|
|
|
* or parameters are initialized to prepare a call to HandleBlockPlace
|
|
|
|
* in GetScreen()->m_BlockLocate
|
|
|
|
* @return false if no item selected, or command finished,
|
|
|
|
* true if some items found and HandleBlockPlace must be called later
|
|
|
|
*/
|
|
|
|
virtual bool HandleBlockEnd( wxDC* DC );
|
|
|
|
|
2010-07-14 13:24:36 +00:00
|
|
|
void RepeatDrawItem( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2011-01-12 21:47:54 +00:00
|
|
|
void SetRepeatItem( SCH_ITEM* aItem ) { m_itemToRepeat = aItem; }
|
|
|
|
|
2011-04-05 14:46:51 +00:00
|
|
|
/**
|
|
|
|
* Function SetUndoItem
|
|
|
|
* clones \a aItem which can be used to restore the state of the item being edited
|
|
|
|
* when the user cancels the editing in progress.
|
|
|
|
*
|
|
|
|
* @param aItem The item to make a clone of for undoing the last change. Set to
|
|
|
|
* NULL to free the current undo item.
|
|
|
|
*/
|
|
|
|
void SetUndoItem( const SCH_ITEM* aItem );
|
|
|
|
|
|
|
|
SCH_ITEM* GetUndoItem() const { return m_undoItem; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SaveUndoItemInUndoList
|
2011-04-12 14:19:59 +00:00
|
|
|
* swaps the cloned item in member variable m_undoItem with \a aItem and saves it to
|
|
|
|
* the undo list then swap the data back. This swaps the internal structure of the
|
|
|
|
* item with the cloned item. It does not swap the actual item pointers themselves.
|
2011-04-05 14:46:51 +00:00
|
|
|
*
|
|
|
|
* @param aItem The item to swap with the current undo item.
|
|
|
|
*/
|
|
|
|
void SaveUndoItemInUndoList( SCH_ITEM* aItem );
|
|
|
|
|
2009-07-05 12:09:41 +00:00
|
|
|
// ERC:
|
2010-07-14 13:24:36 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
/**
|
|
|
|
* Load component libraries defined in project file.
|
|
|
|
*/
|
2011-06-15 18:44:24 +00:00
|
|
|
void LoadLibraries( void );
|
2009-07-05 12:09:41 +00:00
|
|
|
|
2011-03-29 15:21:35 +00:00
|
|
|
/**
|
|
|
|
* Function PrintPage
|
|
|
|
* plots or prints the current sheet to the clipboard.
|
2011-03-28 19:26:31 +00:00
|
|
|
* @param aDC = wxDC given by the calling print function
|
|
|
|
* @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, int aPrintMask,
|
|
|
|
bool aPrintMirrorMode, void* aData = NULL );
|
|
|
|
|
2011-06-15 18:44:24 +00:00
|
|
|
void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; }
|
|
|
|
|
|
|
|
wxString GetSimulatorCommand() const { return m_simulatorCommand; }
|
|
|
|
|
|
|
|
void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
|
|
|
|
|
|
|
|
wxString GetNetListerCommand() const { return m_netListerCommand; }
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // WX_EESCHEMA_STRUCT_H
|