2009-09-22 12:27:57 +00:00
|
|
|
#ifndef __LIBVIEWFRM_H__
|
|
|
|
#define __LIBVIEWFRM_H__
|
|
|
|
|
|
|
|
|
2010-11-10 15:30:12 +00:00
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
|
|
|
|
#include "wxstruct.h"
|
|
|
|
|
|
|
|
|
|
|
|
class wxSashLayoutWindow;
|
|
|
|
class wxListBox;
|
|
|
|
class wxSemaphore;
|
2009-09-22 12:27:57 +00:00
|
|
|
class WinEDAChoiceBox;
|
|
|
|
class SCH_SCREEN;
|
|
|
|
class CMP_LIBRARY;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component library viewer main window.
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
class LIB_VIEW_FRAME : public EDA_DRAW_FRAME
|
2009-09-22 12:27:57 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
WinEDAChoiceBox* SelpartBox;
|
|
|
|
|
|
|
|
// List of libraries (for selection )
|
|
|
|
wxSashLayoutWindow* m_LibListWindow;
|
|
|
|
wxListBox* m_LibList; // The list of libs
|
|
|
|
wxSize m_LibListSize; // size of the window
|
|
|
|
|
|
|
|
// List of components in the selected library
|
|
|
|
wxSashLayoutWindow* m_CmpListWindow;
|
|
|
|
wxListBox* m_CmpList; // The list of components
|
|
|
|
wxSize m_CmpListSize; // size of the window
|
|
|
|
|
|
|
|
// Flags
|
|
|
|
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
|
2009-11-04 20:46:53 +00:00
|
|
|
wxString m_ConfigPath; // subpath for configuration
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2009-12-21 12:05:36 +00:00
|
|
|
protected:
|
|
|
|
static wxString m_libraryName;
|
|
|
|
static wxString m_entryName;
|
2010-11-20 10:59:59 +00:00
|
|
|
static wxString m_exportToEeschemaCmpName; // When the viewer is used to select a component
|
|
|
|
// in schematic, the selected component is here
|
2009-12-21 12:05:36 +00:00
|
|
|
static int m_unit;
|
|
|
|
static int m_convert;
|
|
|
|
static wxSize m_clientSize;
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
public:
|
2010-11-20 21:59:00 +00:00
|
|
|
LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library = NULL, wxSemaphore* semaphore = NULL );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
2010-11-20 21:59:00 +00:00
|
|
|
~LIB_VIEW_FRAME();
|
2009-09-22 12:27:57 +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 );
|
2009-11-04 20:46:53 +00:00
|
|
|
int BestZoom();
|
2009-09-22 12:27:57 +00:00
|
|
|
void ClickOnLibList( wxCommandEvent& event );
|
|
|
|
void ClickOnCmpList( wxCommandEvent& event );
|
2009-10-16 17:18:23 +00:00
|
|
|
void OnSetRelativeOffset( wxCommandEvent& event );
|
2009-09-22 12:27:57 +00:00
|
|
|
|
|
|
|
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
|
|
|
|
|
|
|
|
void GeneralControle( wxDC* DC, wxPoint MousePositionInPixels );
|
|
|
|
|
|
|
|
void LoadSettings();
|
|
|
|
void SaveSettings();
|
|
|
|
|
2009-10-01 14:17:47 +00:00
|
|
|
wxString& GetEntryName( void ) const { return m_entryName; }
|
2010-11-20 10:59:59 +00:00
|
|
|
wxString& GetSelectedComponent( void ) const { return m_exportToEeschemaCmpName; }
|
2009-10-01 14:17:47 +00:00
|
|
|
|
2009-10-16 17:18:23 +00:00
|
|
|
int GetUnit( void ) { return m_unit; }
|
|
|
|
int GetConvert( void ) { return m_convert; }
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
private:
|
2009-12-22 20:08:56 +00:00
|
|
|
/** OnActivate event funtion( virtual )
|
|
|
|
*/
|
|
|
|
virtual void OnActivate( wxActivateEvent& event );
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
void SelectCurrentLibrary();
|
|
|
|
void SelectAndViewLibraryPart( int option );
|
|
|
|
void ExportToSchematicLibraryPart( wxCommandEvent& event );
|
|
|
|
void ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag );
|
|
|
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __LIBVIEWFRM_H__ */
|