eeschema: library order when loading libs fixed (i hope)

This commit is contained in:
charras 2009-04-10 14:53:24 +00:00
parent 9f7ca3444b
commit 82d8faeb40
2 changed files with 270 additions and 259 deletions

View File

@ -164,8 +164,7 @@ void LoadLibraries (WinEDA_DrawFrame* frame)
else else
msg += _( " error!" ); msg += _( " error!" );
frame->PrintMsg( msg ); frame->PrintMsg( msg ); }
}
// reorder the linked list to match the order filename list: // reorder the linked list to match the order filename list:
int NumOfLibs; int NumOfLibs;
@ -186,7 +185,8 @@ void LoadLibraries (WinEDA_DrawFrame* frame)
{ {
if( jj >= NumOfLibs ) if( jj >= NumOfLibs )
break; break;
lib = FindLibrary( g_LibName_List[ii] ); fn = g_LibName_List[ii];
lib = FindLibrary( fn.GetName() );
if( lib ) if( lib )
{ {
lib->m_Flags = 1; lib->m_Flags = 1;
@ -212,7 +212,9 @@ void LoadLibraries (WinEDA_DrawFrame* frame)
MyFree( libs ); MyFree( libs );
for( lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext ) for( lib = g_LibraryList; lib != NULL; lib = lib->m_Pnext )
{
lib->m_Flags = 0; lib->m_Flags = 0;
}
} }

View File

@ -56,16 +56,16 @@ class WinEDA_SchematicFrame : public WinEDA_DrawFrame
public: public:
WinEDAChoiceBox* m_SelPartBox; WinEDAChoiceBox* m_SelPartBox;
DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on. DrawSheetPath* m_CurrentSheet; ///< which sheet we are presently working on.
int m_Multiflag; int m_Multiflag;
wxPoint m_OldPos; wxPoint m_OldPos;
WinEDA_LibeditFrame* m_LibeditFrame; WinEDA_LibeditFrame* m_LibeditFrame;
WinEDA_ViewlibFrame* m_ViewlibFrame; WinEDA_ViewlibFrame* m_ViewlibFrame;
private: private:
SCH_CMP_FIELD* m_CurrentField; SCH_CMP_FIELD* m_CurrentField;
int m_TextFieldSize; int m_TextFieldSize;
bool m_ShowGrid; bool m_ShowGrid;
public: public:
@ -76,58 +76,59 @@ public:
~WinEDA_SchematicFrame(); ~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ); void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void Save_Config( wxWindow* displayframe ); void Save_Config( wxWindow* displayframe );
void LoadSettings(); void LoadSettings();
void SaveSettings(); void SaveSettings();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void CreateScreens(); void CreateScreens();
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void ReCreateOptToolbar(); void ReCreateOptToolbar();
void ReCreateMenuBar(); void ReCreateMenuBar();
void SetToolbars(); void SetToolbars();
void OnHotKey( wxDC* DC, void OnHotKey( wxDC* DC,
int hotkey, int hotkey,
EDA_BaseStruct* DrawStruct ); EDA_BaseStruct* DrawStruct );
SCH_CMP_FIELD* GetCurrentField() { return m_CurrentField; } SCH_CMP_FIELD* GetCurrentField() { return m_CurrentField; }
void SetCurrentField( SCH_CMP_FIELD* aCurrentField ) void SetCurrentField( SCH_CMP_FIELD* aCurrentField )
{ {
m_CurrentField = aCurrentField; m_CurrentField = aCurrentField;
} }
DrawSheetPath* GetSheet();
SCH_SCREEN* GetScreen() const; DrawSheetPath* GetSheet();
BASE_SCREEN* GetBaseScreen() const; SCH_SCREEN* GetScreen() const;
virtual wxString GetScreenDesc(); BASE_SCREEN* GetBaseScreen() const;
void InstallConfigFrame( const wxPoint& pos ); virtual wxString GetScreenDesc();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void InstallConfigFrame( const wxPoint& pos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
SCH_ITEM* SchematicGeneralLocateAndDisplay( void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
SCH_ITEM* SchematicGeneralLocateAndDisplay(
const wxPoint& refpoint, const wxPoint& refpoint,
bool bool
IncludePin ); IncludePin );
/** /**
* Function FillFootprintFieldForAllInstancesofComponent * Function FillFootprintFieldForAllInstancesofComponent
@ -141,34 +142,35 @@ public:
* have more than one instance (multiple parts per package 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). * the search is not stopped when a reference is found (all instances must be found).
*/ */
bool FillFootprintFieldForAllInstancesofComponent( const wxString& aReference, bool FillFootprintFieldForAllInstancesofComponent( const wxString& aReference,
const wxString& aFootPrint, const wxString& aFootPrint,
bool aSetVisible ); bool aSetVisible );
SCH_ITEM* FindComponentAndItem( const wxString& component_reference, SCH_ITEM* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy, bool Find_in_hierarchy,
int SearchType, int SearchType,
const wxString& text_to_find, const wxString& text_to_find,
bool mouseWarp ); bool mouseWarp );
/* Cross probing with pcbnew */ /* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct * objectToSync, void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
SCH_COMPONENT* LibItem ); SCH_COMPONENT* LibItem );
/* netlist generation */ /* netlist generation */
void* BuildNetListBase(); void* BuildNetListBase();
/** /**
* Function DeleteAnnotation * Function DeleteAnnotation
* Remove current component annotations * Remove current component annotations
* @param aCurrentSheetOnly : if false: remove all annotations, else remove annotation relative to the current sheet only * @param aCurrentSheetOnly : if false: remove all annotations, else remove annotation relative to the current sheet only
* @param aRedraw : true to refresh display * @param aRedraw : true to refresh display
*/ */
void DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw ); void DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw );
// Functions used for hierarchy handling // Functions used for hierarchy handling
void InstallPreviousSheet(); void InstallPreviousSheet();
void InstallNextScreen( DrawSheetStruct* Sheet ); void InstallNextScreen( DrawSheetStruct* Sheet );
/** Function GetUniqueFilenameForCurrentSheet /** Function GetUniqueFilenameForCurrentSheet
* @return a filename that can be used in plot and print functions * @return a filename that can be used in plot and print functions
* for the current screen anad sheet path. * for the current screen anad sheet path.
@ -179,26 +181,26 @@ public:
* and has no extension. * and has no extension.
* However if filename is too long name is <sheet filename>-<sheet number> * However if filename is too long name is <sheet filename>-<sheet number>
*/ */
wxString GetUniqueFilenameForCurrentSheet( ); wxString GetUniqueFilenameForCurrentSheet();
/** /**
* Function SetSheetNumberAndCount * Function SetSheetNumberAndCount
* Set the m_ScreenNumber and m_NumberOfScreen members for screens * 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 * must be called after a delete or add sheet command, and when entering a sheet
*/ */
void SetSheetNumberAndCount(); void SetSheetNumberAndCount();
// Plot functions: // Plot functions:
void ToPlot_PS( wxCommandEvent& event ); void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event ); void ToPlot_HPGL( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event );
// read and save files // read and save files
void Save_File( wxCommandEvent& event ); void Save_File( wxCommandEvent& event );
void SaveProject(); void SaveProject();
int LoadOneEEProject( const wxString& FileName, bool IsNew ); int LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName ); bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
bool ReadInputStuffFile(); bool ReadInputStuffFile();
/** /**
@ -208,10 +210,11 @@ public:
* @param aSetFielsAttributeToVisible = true to set the footprint field flag to visible * @param aSetFielsAttributeToVisible = true to set the footprint field flag to visible
* @return bool - true if success, else true. * @return bool - true if success, else true.
*/ */
bool ProcessStuffFile( FILE* aFilename, bool aSetFielsAttributeToVisible ); bool ProcessStuffFile( FILE* aFilename,
bool aSetFielsAttributeToVisible );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave ); bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp ); SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp );
// General search: // General search:
@ -225,147 +228,153 @@ public:
* 2 => or for the next item * 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item. * @param mouseWarp If true, then move the mouse cursor to the item.
*/ */
SCH_ITEM* FindSchematicItem( const wxString& pattern, SCH_ITEM* FindSchematicItem( const wxString& pattern,
int SearchType, int SearchType,
bool mouseWarp = true ); bool mouseWarp = true );
SCH_ITEM* FindMarker( int SearchType ); SCH_ITEM* FindMarker( int SearchType );
private: private:
void Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC ); void Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC );
void OnExit( wxCommandEvent& event ); void OnExit( wxCommandEvent& event );
void OnAnnotate( wxCommandEvent& event ); void OnAnnotate( wxCommandEvent& event );
void OnErc( wxCommandEvent& event ); void OnErc( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event ); void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event ); void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event ); void OnFindItems( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event ); void OnLoadFile( wxCommandEvent& event );
void OnLoadStuffFile( wxCommandEvent& event ); void OnLoadStuffFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event ); void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event ); void OnLoadProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event ); void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event ); void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryViewer( wxCommandEvent& event ); void OnOpenLibraryViewer( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event ); void OnOpenLibraryEditor( wxCommandEvent& event );
// Bus Entry // Bus Entry
DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type ); DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC, void SetBusEntryShape( wxDC* DC,
DrawBusEntryStruct* BusEntry, DrawBusEntryStruct* BusEntry,
int entry_type ); int entry_type );
int GetBusEntryShape( DrawBusEntryStruct* BusEntry ); int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC ); void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC );
// NoConnect // NoConnect
DrawNoConnectStruct* CreateNewNoConnectStruct( wxDC* DC ); DrawNoConnectStruct* CreateNewNoConnectStruct( wxDC* DC );
// Junction // Junction
DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC, DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
const wxPoint& pos, const wxPoint& pos,
bool PutInUndoList = FALSE ); bool PutInUndoList = FALSE );
// Text ,label, glabel // Text ,label, glabel
SCH_TEXT* CreateNewText( wxDC* DC, int type ); SCH_TEXT* CreateNewText( wxDC* DC, int type );
void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC ); void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC );
void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC ); void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC );
void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC ); void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC );
void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype ); void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype );
// Wire, Bus // Wire, Bus
void BeginSegment( wxDC* DC, int type ); void BeginSegment( wxDC* DC, int type );
void EndSegment( wxDC* DC ); void EndSegment( wxDC* DC );
void DeleteCurrentSegment( wxDC* DC ); void DeleteCurrentSegment( wxDC* DC );
void DeleteConnection( wxDC* DC, bool DeleteFullConnection ); void DeleteConnection( wxDC* DC, bool DeleteFullConnection );
// graphic lines // graphic lines
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC ); void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC ); DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
// Hierarchical Sheet & PinSheet // Hierarchical Sheet & PinSheet
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos ); void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
DrawSheetStruct* CreateSheet( wxDC* DC ); DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ); void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
public: public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC ); bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
/** Function UpdateSheetNumberAndDate /** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic * Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens * and update the date in all screens
*/ */
void UpdateSheetNumberAndDate(); void UpdateSheetNumberAndDate();
private: private:
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC ); void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
Hierarchical_PIN_Sheet_Struct* Create_PinSheet( 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 Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
void StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel, wxDC* DC ); wxDC* DC );
void Place_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel, wxDC* DC ); void StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
Hierarchical_PIN_Sheet_Struct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC ); wxDC* DC );
void Place_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
wxDC* DC );
Hierarchical_PIN_Sheet_Struct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
public: public:
void DeleteSheetLabel( bool aRedraw, Hierarchical_PIN_Sheet_Struct* aSheetLabelToDel ); void DeleteSheetLabel(
bool aRedraw,
Hierarchical_PIN_Sheet_Struct*
aSheetLabelToDel );
private: private:
// Component // Component
SCH_COMPONENT* Load_Component( wxDC* DC, SCH_COMPONENT* Load_Component( wxDC* DC,
const wxString& libname, const wxString& libname,
wxArrayString& List, wxArrayString& List,
bool UseLibBrowser ); bool UseLibBrowser );
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC ); void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
public: public:
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent, void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate ); wxDC* DC, int type_rotate );
private: private:
void SelPartUnit( SCH_COMPONENT* DrawComponent, void SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC ); int unit, wxDC* DC );
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ); void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC ); void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void EditComponentReference( SCH_COMPONENT* DrawLibItem, void EditComponentReference( SCH_COMPONENT* DrawLibItem,
wxDC* DC ); wxDC* DC );
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC ); void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem, void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
wxDC* DC ); wxDC* DC );
void StartMoveCmpField( SCH_CMP_FIELD* Field, wxDC* DC ); void StartMoveCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC ); void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC );
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC ); void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
/* Operations sur bloc */ /* Operations sur bloc */
void PasteStruct( wxDC* DC ); void PasteStruct( wxDC* DC );
/* Undo - redo */ /* Undo - redo */
public: public:
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy, void SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
int flag_type_command = 0 ); int flag_type_command = 0 );
private: private:
void PutDataInPreviousState( DrawPickedStruct* List ); void PutDataInPreviousState( DrawPickedStruct* List );
bool GetSchematicFromRedoList(); bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList(); bool GetSchematicFromUndoList();
public: public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* Gestion generale des operations sur block */ /* Gestion generale des operations sur block */
int ReturnBlockCommand( int key ); int ReturnBlockCommand( int key );
void InitBlockPasteInfos(); void InitBlockPasteInfos();
void HandleBlockPlace( wxDC* DC ); void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC ); int HandleBlockEnd( wxDC* DC );
void HandleBlockEndByPopUp( int Command, wxDC* DC ); void HandleBlockEndByPopUp( int Command, wxDC* DC );
// Repetition automatique de placements // Repetition automatique de placements
void RepeatDrawItem( wxDC* DC ); void RepeatDrawItem( wxDC* DC );
// Test des points de connexion en l'air (dangling ends) // Test des points de connexion en l'air (dangling ends)
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC ); void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
LibDrawPin* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos ); LibDrawPin* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@ -389,107 +398,107 @@ public:
~WinEDA_LibeditFrame(); ~WinEDA_LibeditFrame();
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void OnImportPart( wxCommandEvent& event ); void OnImportPart( wxCommandEvent& event );
void OnExportPart( wxCommandEvent& event ); void OnExportPart( wxCommandEvent& event );
void OnUpdateEditingPart( wxUpdateUIEvent& event ); void OnUpdateEditingPart( wxUpdateUIEvent& event );
void OnUpdateNotEditingPart( wxUpdateUIEvent& event ); void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
void DisplayLibInfos(); void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void SetToolbars(); void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void OnHotKey( wxDC* DC, int hotkey, void OnHotKey( wxDC* DC, int hotkey,
EDA_BaseStruct* DrawStruct ); EDA_BaseStruct* DrawStruct );
void GeneralControle( wxDC* DC, void GeneralControle( wxDC* DC,
wxPoint MousePositionInPixels ); wxPoint MousePositionInPixels );
void LoadSettings(); void LoadSettings();
void SaveSettings(); void SaveSettings();
private: private:
// General: // General:
void CreateNewLibraryPart(); void CreateNewLibraryPart();
void DeleteOnePart(); void DeleteOnePart();
void SaveOnePartInMemory(); void SaveOnePartInMemory();
void SelectActiveLibrary(); void SelectActiveLibrary();
bool LoadOneLibraryPart(); bool LoadOneLibraryPart();
void SaveActiveLibrary(); void SaveActiveLibrary();
int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry, int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry,
LibraryStruct* Library, LibraryStruct* Library,
int noMsg = 0 ); int noMsg = 0 );
void DisplayCmpDoc( const wxString& Name ); void DisplayCmpDoc( const wxString& Name );
void InstallLibeditFrame( ); void InstallLibeditFrame();
// General editing // General editing
public: public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
void InstallFieldsEditorDialog( void ); void InstallFieldsEditorDialog( void );
private: private:
bool GetComponentFromUndoList(); bool GetComponentFromUndoList();
bool GetComponentFromRedoList(); bool GetComponentFromRedoList();
// Edition des Pins: // Edition des Pins:
void CreatePin( wxDC* DC ); void CreatePin( wxDC* DC );
void DeletePin( wxDC* DC, void DeletePin( wxDC* DC,
EDA_LibComponentStruct* LibEntry, EDA_LibComponentStruct* LibEntry,
LibDrawPin* Pin ); LibDrawPin* Pin );
void StartMovePin( wxDC* DC ); void StartMovePin( wxDC* DC );
// Test des pins ( duplicates...) // Test des pins ( duplicates...)
bool TestPins( EDA_LibComponentStruct* LibEntry ); bool TestPins( EDA_LibComponentStruct* LibEntry );
// Edition de l'ancre // Edition de l'ancre
void PlaceAncre(); void PlaceAncre();
// Edition des graphismes: // Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC ); LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC );
void GraphicItemBeginDraw( wxDC* DC ); void GraphicItemBeginDraw( wxDC* DC );
void StartMoveDrawSymbol( wxDC* DC ); void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC ); void EndDrawGraphicItem( wxDC* DC );
void LoadOneSymbol( ); void LoadOneSymbol();
void SaveOneSymbol(); void SaveOneSymbol();
void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem ); void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem ); void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void RotateSymbolText( wxDC* DC ); void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC ); void DeleteDrawPoly( wxDC* DC );
LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry ); LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry );
LibEDA_BaseStruct* LocateItemUsingCursor(); LibEDA_BaseStruct* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field ); void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field ); void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field ); void EditField( wxDC* DC, LibDrawField* Field );
void StartMoveField( wxDC* DC, LibDrawField* field ); void StartMoveField( wxDC* DC, LibDrawField* field );
public: public:
/* Block commands: */ /* Block commands: */
int ReturnBlockCommand( int key ); int ReturnBlockCommand( int key );
void HandleBlockPlace( wxDC* DC ); void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC ); int HandleBlockEnd( wxDC* DC );
void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry ); void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry );
void PlacePin( wxDC* DC ); void PlacePin( wxDC* DC );
void InitEditOnePin(); void InitEditOnePin();
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id ); void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id );
// Repetition automatique de placement de pins // Repetition automatique de placement de pins
void RepeatPinItem( wxDC* DC, LibDrawPin* Pin ); void RepeatPinItem( wxDC* DC, LibDrawPin* Pin );
protected: protected:
wxString m_ConfigPath; wxString m_ConfigPath;
wxString m_LastLibImportPath; wxString m_LastLibImportPath;
wxString m_LastLibExportPath; wxString m_LastLibExportPath;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@ -501,57 +510,57 @@ class LibraryStruct;
class WinEDA_ViewlibFrame : public WinEDA_DrawFrame class WinEDA_ViewlibFrame : public WinEDA_DrawFrame
{ {
private: private:
WinEDAChoiceBox* SelpartBox; WinEDAChoiceBox* SelpartBox;
// List of libraries (for selection // List of libraries (for selection
wxSashLayoutWindow* m_LibListWindow; // The redimensionnable window to display the lib list wxSashLayoutWindow* m_LibListWindow; // The redimensionnable window to display the lib list
wxListBox* m_LibList; // The list of libs wxListBox* m_LibList; // The list of libs
wxSize m_LibListSize; // size of the window wxSize m_LibListSize; // size of the window
// List of components in the selected library // List of components in the selected library
wxSashLayoutWindow* m_CmpListWindow; // The redimensionnable window to display the component list wxSashLayoutWindow* m_CmpListWindow; // The redimensionnable window to display the component list
wxListBox* m_CmpList; // The list of components wxListBox* m_CmpList; // The list of components
wxSize m_CmpListSize; // size of the window wxSize m_CmpListSize; // size of the window
// Flags // Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_ConfigPath; // subpath for configuartion wxString m_ConfigPath; // subpath for configuartion
public: public:
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_ViewlibFrame( wxWindow* father,
LibraryStruct* Library = NULL, LibraryStruct* Library = NULL,
wxSemaphore* semaphore = NULL ); wxSemaphore* semaphore = NULL );
~WinEDA_ViewlibFrame(); ~WinEDA_ViewlibFrame();
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void OnSashDrag( wxSashEvent& event ); void OnSashDrag( wxSashEvent& event );
void ReCreateListLib(); void ReCreateListLib();
void ReCreateListCmp(); void ReCreateListCmp();
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos(); void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar(); void ReCreateHToolbar();
void ReCreateVToolbar(); void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom(); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void ClickOnLibList( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ); void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
void LoadSettings(); void LoadSettings();
void SaveSettings(); void SaveSettings();
private: private:
void SelectCurrentLibrary(); void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option ); void SelectAndViewLibraryPart( int option );
void ExportToSchematicLibraryPart( wxCommandEvent& event ); void ExportToSchematicLibraryPart( wxCommandEvent& event );
void ViewOneLibraryContent( LibraryStruct* Lib, int Flag ); void ViewOneLibraryContent( LibraryStruct* Lib, int Flag );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };