2008-04-14 19:22:48 +00:00
|
|
|
/***********************************************************/
|
|
|
|
/* wxEeschemaStruct.h: */
|
|
|
|
/* descriptions des principales classes derivees utilisees */
|
|
|
|
/***********************************************************/
|
|
|
|
|
|
|
|
#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"
|
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;
|
|
|
|
class DrawNoConnectStruct;
|
2008-09-17 17:26:25 +00:00
|
|
|
class LibraryStruct;
|
|
|
|
class EDA_LibComponentStruct;
|
|
|
|
class LibEDA_BaseStruct;
|
|
|
|
class EDA_BaseStruct;
|
|
|
|
class DrawBusEntryStruct;
|
|
|
|
class SCH_GLOBALLABEL;
|
|
|
|
class SCH_TEXT;
|
|
|
|
class EDA_DrawLineStruct;
|
|
|
|
class DrawSheetStruct;
|
|
|
|
class DrawSheetPath;
|
|
|
|
class Hierarchical_PIN_Sheet_Struct;
|
|
|
|
class SCH_COMPONENT;
|
|
|
|
class LibDrawField;
|
|
|
|
class SCH_CMP_FIELD;
|
|
|
|
class LibDrawPin;
|
|
|
|
class DrawJunctionStruct;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/*******************************/
|
|
|
|
/* class WinEDA_SchematicFrame */
|
|
|
|
/*******************************/
|
|
|
|
|
|
|
|
/* enum used in RotationMiroir() */
|
|
|
|
enum fl_rot_cmp {
|
|
|
|
CMP_NORMAL, // orientation normale (O, pas de miroir)
|
|
|
|
CMP_ROTATE_CLOCKWISE, // nouvelle rotation de -90
|
|
|
|
CMP_ROTATE_COUNTERCLOCKWISE, // nouvelle rotation de +90
|
|
|
|
CMP_ORIENT_0, // orientation 0, pas de miroir, id CMP_NORMAL
|
|
|
|
CMP_ORIENT_90, // orientation 90, pas de miroir
|
|
|
|
CMP_ORIENT_180, // orientation 180, pas de miroir
|
|
|
|
CMP_ORIENT_270, // orientation -90, pas de miroir
|
|
|
|
CMP_MIROIR_X = 0x100, // miroir selon axe X
|
|
|
|
CMP_MIROIR_Y = 0x200 // miroir selon axe Y
|
|
|
|
};
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
|
|
|
|
{
|
|
|
|
public:
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDAChoiceBox* m_SelPartBox;
|
|
|
|
DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on.
|
2009-04-29 17:09:00 +00:00
|
|
|
int m_Multiflag;
|
|
|
|
int m_NetlistFormat;
|
|
|
|
bool m_ShowAllPins;
|
2008-12-08 15:27:13 +00:00
|
|
|
wxPoint m_OldPos;
|
|
|
|
WinEDA_LibeditFrame* m_LibeditFrame;
|
|
|
|
WinEDA_ViewlibFrame* m_ViewlibFrame;
|
2009-04-29 17:09:00 +00:00
|
|
|
wxString m_UserLibraryPath;
|
|
|
|
wxArrayString m_ComponentLibFiles;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
2009-04-29 17:09:00 +00:00
|
|
|
wxString m_DefaultSchematicFileName;
|
|
|
|
SCH_CMP_FIELD* m_CurrentField;
|
|
|
|
int m_TextFieldSize;
|
|
|
|
bool m_ShowGrid;
|
|
|
|
PARAM_CFG_ARRAY m_projectFileParams;
|
|
|
|
PARAM_CFG_ARRAY m_configSettings;
|
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();
|
|
|
|
|
2009-04-10 14:53:24 +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
|
|
|
|
2009-04-10 14:53:24 +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 );
|
2009-04-29 17:09:00 +00:00
|
|
|
void SaveProjectFile( wxWindow* displayframe );
|
|
|
|
bool LoadProjectFile( const wxString& CfgFileName, bool ForceRereadConfig );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
|
2009-04-10 14:53:24 +00:00
|
|
|
void LoadSettings();
|
|
|
|
void SaveSettings();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 14:53:24 +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
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
SCH_CMP_FIELD* GetCurrentField() { return m_CurrentField; }
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
void SetCurrentField( SCH_CMP_FIELD* aCurrentField )
|
|
|
|
{
|
|
|
|
m_CurrentField = aCurrentField;
|
|
|
|
}
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
DrawSheetPath* 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
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void InstallConfigFrame( const wxPoint& pos );
|
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 );
|
|
|
|
int BestZoom(); // Retourne le meilleur zoom
|
|
|
|
|
|
|
|
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
|
|
|
|
SCH_ITEM* SchematicGeneralLocateAndDisplay(
|
2008-04-14 19:22:48 +00:00
|
|
|
const wxPoint& refpoint,
|
|
|
|
bool
|
2009-04-10 14:53:24 +00:00
|
|
|
IncludePin );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
/**
|
|
|
|
* Function FillFootprintFieldForAllInstancesofComponent
|
|
|
|
* searches for component "aReference", and places a Footprint in Footprint field
|
2008-05-16 09:21:01 +00:00
|
|
|
* @param aReference = reference of the component to initialise
|
|
|
|
* @param aFootPrint = new value for the filed Fottprint component
|
|
|
|
* @param aSetVisible = true to have the field visible, false to set the invisible flag
|
|
|
|
* @return true if the given component is found
|
|
|
|
* Note:
|
|
|
|
* 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).
|
|
|
|
*/
|
2009-04-10 14:53:24 +00:00
|
|
|
bool FillFootprintFieldForAllInstancesofComponent( const wxString& aReference,
|
|
|
|
const wxString& aFootPrint,
|
|
|
|
bool aSetVisible );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2009-04-10 14:53:24 +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 */
|
2009-04-10 14:53:24 +00:00
|
|
|
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
|
|
|
|
SCH_COMPONENT* LibItem );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* netlist generation */
|
2009-04-10 14:53:24 +00:00
|
|
|
void* BuildNetListBase();
|
2008-11-24 06:53:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function DeleteAnnotation
|
2008-04-21 06:34:56 +00:00
|
|
|
* Remove current component annotations
|
|
|
|
* @param aCurrentSheetOnly : if false: remove all annotations, else remove annotation relative to the current sheet only
|
|
|
|
* @param aRedraw : true to refresh display
|
2009-04-10 14:53:24 +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
|
2009-04-10 14:53:24 +00:00
|
|
|
void InstallPreviousSheet();
|
|
|
|
void InstallNextScreen( DrawSheetStruct* Sheet );
|
|
|
|
|
2009-01-08 20:29:07 +00:00
|
|
|
/** Function GetUniqueFilenameForCurrentSheet
|
|
|
|
* @return a filename that can be used in plot and print functions
|
|
|
|
* for the current screen anad sheet path.
|
|
|
|
* This filename is unique and must be used insteed of the sreen filename
|
|
|
|
* (or scheen filename) when one must creates file for each sheet in the heierarchy.
|
|
|
|
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than once
|
|
|
|
* Name is <root sheet filename>-<sheet path>
|
|
|
|
* and has no extension.
|
|
|
|
* However if filename is too long name is <sheet filename>-<sheet number>
|
|
|
|
*/
|
2009-04-10 14:53:24 +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
|
|
|
|
* must be called after a delete or add sheet command, and when entering a sheet
|
|
|
|
*/
|
2009-04-10 14:53:24 +00:00
|
|
|
void SetSheetNumberAndCount();
|
2008-04-30 17:04:22 +00:00
|
|
|
|
|
|
|
// Plot functions:
|
2009-04-10 14:53:24 +00:00
|
|
|
void ToPlot_PS( wxCommandEvent& event );
|
|
|
|
void ToPlot_HPGL( 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
|
2009-04-10 14:53:24 +00:00
|
|
|
void Save_File( wxCommandEvent& event );
|
|
|
|
void SaveProject();
|
|
|
|
int 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.
|
|
|
|
* @param aSetFielsAttributeToVisible = true to set the footprint field flag to visible
|
2008-05-07 23:41:05 +00:00
|
|
|
* @return bool - true if success, else true.
|
|
|
|
*/
|
2009-04-10 14:53:24 +00:00
|
|
|
bool ProcessStuffFile( FILE* aFilename,
|
|
|
|
bool aSetFielsAttributeToVisible );
|
2008-05-07 23:41:05 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
|
|
|
|
SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// General search:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function FindSchematicItem
|
|
|
|
* finds a string in the schematic.
|
|
|
|
* @param pattern The text to search for, either in value, reference or
|
|
|
|
* elsewhere.
|
|
|
|
* @param SearchType: 0 => Search is made in current sheet
|
|
|
|
* 1 => the whole hierarchy
|
|
|
|
* 2 => or for the next item
|
|
|
|
* @param mouseWarp If true, then move the mouse cursor to the item.
|
|
|
|
*/
|
2009-04-10 14:53:24 +00:00
|
|
|
SCH_ITEM* FindSchematicItem( const wxString& pattern,
|
|
|
|
int SearchType,
|
|
|
|
bool mouseWarp = true );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
SCH_ITEM* FindMarker( int SearchType );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-10 14:53:24 +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 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 );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
/* User interface update event handlers. */
|
|
|
|
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
|
|
|
|
|
|
|
// Bus Entry
|
2009-04-10 14:53:24 +00:00
|
|
|
DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
|
|
|
|
void SetBusEntryShape( wxDC* DC,
|
|
|
|
DrawBusEntryStruct* BusEntry,
|
|
|
|
int entry_type );
|
|
|
|
int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
|
|
|
|
void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// NoConnect
|
2009-04-10 14:53:24 +00:00
|
|
|
DrawNoConnectStruct* CreateNewNoConnectStruct( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Junction
|
2009-04-10 14:53:24 +00:00
|
|
|
DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
|
|
|
|
const wxPoint& pos,
|
|
|
|
bool PutInUndoList = FALSE );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Text ,label, glabel
|
2009-04-10 14:53:24 +00:00
|
|
|
SCH_TEXT* CreateNewText( wxDC* DC, int type );
|
|
|
|
void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC );
|
|
|
|
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
|
2009-04-10 14:53:24 +00:00
|
|
|
void BeginSegment( wxDC* DC, int type );
|
|
|
|
void EndSegment( wxDC* DC );
|
|
|
|
void DeleteCurrentSegment( wxDC* DC );
|
|
|
|
void DeleteConnection( wxDC* DC, bool DeleteFullConnection );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// graphic lines
|
2009-04-10 14:53:24 +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
|
2009-04-10 14:53:24 +00:00
|
|
|
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
|
|
|
|
DrawSheetStruct* CreateSheet( wxDC* DC );
|
|
|
|
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2009-04-10 14:53:24 +00:00
|
|
|
bool EditSheet( DrawSheetStruct* 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
|
|
|
|
*/
|
2009-04-10 14:53:24 +00:00
|
|
|
void UpdateSheetNumberAndDate();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-10 14:53:24 +00:00
|
|
|
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
|
|
|
|
Hierarchical_PIN_Sheet_Struct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
|
|
|
|
void Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
|
|
|
wxDC* DC );
|
|
|
|
void StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
|
|
|
wxDC* DC );
|
|
|
|
void Place_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
|
|
|
wxDC* DC );
|
|
|
|
Hierarchical_PIN_Sheet_Struct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2009-04-10 14:53:24 +00:00
|
|
|
void DeleteSheetLabel(
|
|
|
|
bool aRedraw,
|
|
|
|
Hierarchical_PIN_Sheet_Struct*
|
|
|
|
aSheetLabelToDel );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// Component
|
2009-04-10 14:53:24 +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:
|
2009-04-10 14:53:24 +00:00
|
|
|
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
|
|
|
wxDC* DC, int type_rotate );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-10 14:53:24 +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_CMP_FIELD* Field, wxDC* DC );
|
|
|
|
void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC );
|
|
|
|
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* Operations sur bloc */
|
2009-04-10 14:53:24 +00:00
|
|
|
void PasteStruct( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* Undo - redo */
|
|
|
|
public:
|
2009-04-10 14:53:24 +00:00
|
|
|
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
|
|
|
|
int flag_type_command = 0 );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-10 14:53:24 +00:00
|
|
|
void PutDataInPreviousState( DrawPickedStruct* List );
|
|
|
|
bool GetSchematicFromRedoList();
|
|
|
|
bool GetSchematicFromUndoList();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
public:
|
2009-04-10 14:53:24 +00:00
|
|
|
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
/* Gestion generale des operations sur block */
|
2009-04-10 14:53:24 +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
|
|
|
|
|
|
|
// Repetition automatique de placements
|
2009-04-10 14:53:24 +00:00
|
|
|
void RepeatDrawItem( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Test des points de connexion en l'air (dangling ends)
|
2009-04-10 14:53:24 +00:00
|
|
|
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
|
|
|
|
LibDrawPin* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************/
|
|
|
|
/* class WinEDA_LibeditFrame */
|
|
|
|
/*****************************/
|
|
|
|
|
|
|
|
class WinEDA_LibeditFrame : public WinEDA_DrawFrame
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WinEDAChoiceBox* m_SelpartBox;
|
|
|
|
WinEDAChoiceBox* m_SelAliasBox;
|
|
|
|
|
|
|
|
public:
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_LibeditFrame( 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_LibeditFrame();
|
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
|
|
|
void OnImportPart( wxCommandEvent& event );
|
|
|
|
void OnExportPart( wxCommandEvent& event );
|
|
|
|
void OnUpdateEditingPart( wxUpdateUIEvent& event );
|
|
|
|
void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
|
|
|
|
|
|
|
|
void DisplayLibInfos();
|
|
|
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
|
|
|
void ReCreateHToolbar();
|
|
|
|
void ReCreateVToolbar();
|
|
|
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
|
|
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
|
|
|
int BestZoom(); // Retourne le meilleur zoom
|
|
|
|
void SetToolbars();
|
|
|
|
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
|
2009-04-10 14:53:24 +00:00
|
|
|
void OnHotKey( wxDC* DC, int hotkey,
|
|
|
|
EDA_BaseStruct* DrawStruct );
|
|
|
|
|
|
|
|
void GeneralControle( wxDC* DC,
|
|
|
|
wxPoint MousePositionInPixels );
|
2009-04-29 17:09:00 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void LoadSettings();
|
|
|
|
void SaveSettings();
|
2008-04-21 06:34:56 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
// General:
|
2009-04-10 14:53:24 +00:00
|
|
|
void CreateNewLibraryPart();
|
|
|
|
void DeleteOnePart();
|
|
|
|
void SaveOnePartInMemory();
|
|
|
|
void SelectActiveLibrary();
|
|
|
|
bool LoadOneLibraryPart();
|
|
|
|
void SaveActiveLibrary();
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry,
|
|
|
|
LibraryStruct* Library,
|
|
|
|
int noMsg = 0 );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void DisplayCmpDoc( const wxString& Name );
|
|
|
|
void InstallLibeditFrame();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// General editing
|
|
|
|
public:
|
2009-04-10 14:53:24 +00:00
|
|
|
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
|
|
|
|
void InstallFieldsEditorDialog( void );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
private:
|
2009-04-10 14:53:24 +00:00
|
|
|
bool GetComponentFromUndoList();
|
|
|
|
bool GetComponentFromRedoList();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Edition des Pins:
|
2009-04-10 14:53:24 +00:00
|
|
|
void CreatePin( wxDC* DC );
|
|
|
|
void DeletePin( wxDC* DC,
|
|
|
|
EDA_LibComponentStruct* LibEntry,
|
|
|
|
LibDrawPin* Pin );
|
|
|
|
void StartMovePin( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Test des pins ( duplicates...)
|
2009-04-10 14:53:24 +00:00
|
|
|
bool TestPins( EDA_LibComponentStruct* LibEntry );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Edition de l'ancre
|
2009-04-10 14:53:24 +00:00
|
|
|
void PlaceAncre();
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Edition des graphismes:
|
2009-06-18 13:30:52 +00:00
|
|
|
LibEDA_BaseStruct* CreateGraphicItem( EDA_LibComponentStruct * LibEntry, wxDC* DC );
|
2009-04-10 14:53:24 +00:00
|
|
|
void GraphicItemBeginDraw( wxDC* DC );
|
|
|
|
void StartMoveDrawSymbol( wxDC* DC );
|
|
|
|
void EndDrawGraphicItem( wxDC* DC );
|
|
|
|
void LoadOneSymbol();
|
|
|
|
void SaveOneSymbol();
|
|
|
|
void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem );
|
|
|
|
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
|
|
|
|
void RotateSymbolText( wxDC* DC );
|
|
|
|
void DeleteDrawPoly( wxDC* DC );
|
|
|
|
LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry );
|
|
|
|
LibEDA_BaseStruct* LocateItemUsingCursor();
|
|
|
|
void RotateField( wxDC* DC, LibDrawField* Field );
|
|
|
|
void PlaceField( wxDC* DC, LibDrawField* Field );
|
|
|
|
void EditField( wxDC* DC, LibDrawField* Field );
|
|
|
|
void StartMoveField( wxDC* DC, LibDrawField* field );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
/* Block commands: */
|
2009-04-10 14:53:24 +00:00
|
|
|
int ReturnBlockCommand( int key );
|
|
|
|
void HandleBlockPlace( wxDC* DC );
|
|
|
|
int HandleBlockEnd( wxDC* DC );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry );
|
|
|
|
void PlacePin( wxDC* DC );
|
|
|
|
void InitEditOnePin();
|
|
|
|
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
// Repetition automatique de placement de pins
|
2009-04-10 14:53:24 +00:00
|
|
|
void RepeatPinItem( wxDC* DC, LibDrawPin* Pin );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
protected:
|
2009-04-10 14:53:24 +00:00
|
|
|
wxString m_ConfigPath;
|
|
|
|
wxString m_LastLibImportPath;
|
|
|
|
wxString m_LastLibExportPath;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-04-10 13:39:03 +00:00
|
|
|
/************************************************************************************************/
|
|
|
|
/************************************************************************************************/
|
2008-04-14 19:22:48 +00:00
|
|
|
class LibraryStruct;
|
|
|
|
class WinEDA_ViewlibFrame : public WinEDA_DrawFrame
|
|
|
|
{
|
2009-04-10 13:39:03 +00:00
|
|
|
private:
|
2009-04-10 14:53:24 +00:00
|
|
|
WinEDAChoiceBox* SelpartBox;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 13:39:03 +00:00
|
|
|
// List of libraries (for selection
|
2009-04-10 14:53:24 +00:00
|
|
|
wxSashLayoutWindow* m_LibListWindow; // The redimensionnable window to display the lib list
|
|
|
|
wxListBox* m_LibList; // The list of libs
|
|
|
|
wxSize m_LibListSize; // size of the window
|
2009-04-10 13:39:03 +00:00
|
|
|
|
|
|
|
// List of components in the selected library
|
2009-04-10 14:53:24 +00:00
|
|
|
wxSashLayoutWindow* m_CmpListWindow; // The redimensionnable window to display the component list
|
|
|
|
wxListBox* m_CmpList; // The list of components
|
|
|
|
wxSize m_CmpListSize; // size of the window
|
2009-04-10 13:39:03 +00:00
|
|
|
|
|
|
|
// Flags
|
2009-04-10 14:53:24 +00:00
|
|
|
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
|
|
|
|
wxString m_ConfigPath; // subpath for configuartion
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
public:
|
2009-04-10 14:53:24 +00:00
|
|
|
WinEDA_ViewlibFrame( wxWindow* father,
|
2008-04-14 19:22:48 +00:00
|
|
|
LibraryStruct* Library = NULL,
|
2009-04-10 14:53:24 +00:00
|
|
|
wxSemaphore* semaphore = NULL );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
~WinEDA_ViewlibFrame();
|
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void OnSize( wxSizeEvent& event );
|
|
|
|
void OnSashDrag( wxSashEvent& event );
|
|
|
|
void ReCreateListLib();
|
|
|
|
void ReCreateListCmp();
|
|
|
|
void Process_Special_Functions( wxCommandEvent& event );
|
|
|
|
void DisplayLibInfos();
|
|
|
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
|
|
|
void OnCloseWindow( wxCloseEvent& Event );
|
|
|
|
void ReCreateHToolbar();
|
|
|
|
void ReCreateVToolbar();
|
|
|
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
|
|
|
int BestZoom(); // Retourne le meilleur zoom
|
|
|
|
void ClickOnLibList( wxCommandEvent& event );
|
|
|
|
void ClickOnCmpList( wxCommandEvent& event );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
|
2008-04-21 06:34:56 +00:00
|
|
|
|
2009-04-10 14:53:24 +00:00
|
|
|
void LoadSettings();
|
|
|
|
void SaveSettings();
|
2009-04-10 13:39:03 +00:00
|
|
|
|
2008-04-14 19:22:48 +00:00
|
|
|
private:
|
2009-04-10 14:53:24 +00:00
|
|
|
void SelectCurrentLibrary();
|
|
|
|
void SelectAndViewLibraryPart( int option );
|
|
|
|
void ExportToSchematicLibraryPart( wxCommandEvent& event );
|
|
|
|
void ViewOneLibraryContent( LibraryStruct* Lib, int Flag );
|
|
|
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
2008-04-14 19:22:48 +00:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // WX_EESCHEMA_STRUCT_H
|