diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8c81675e00..d1601660fb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,17 @@ KiCad ChangeLog 2010 Please add newer entries at the top, list the date and your name with email address. +2010-nov-19 UPDATE Wayne Stambaugh +================================================================================ +++EESchema + * Move library new component and schematic edit sheet dialogs to dialogs + folder. + * Set library new component and schematic edit sheet dialogs default button. + * Create wxFormBuilder version of edit sheet label dialog and remove hand + coded version. + * More coding policy fixes. + + 2010-nov-19 UPDATE Wayne Stambaugh ================================================================================ ++EESchema diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index e66e574b34..7eea7bb678 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -59,12 +59,14 @@ set(EESCHEMA_SRCS dialogs/dialog_lib_edit_draw_item_base.cpp dialogs/dialog_lib_edit_pin.cpp dialogs/dialog_lib_edit_pin_base.cpp - dialog_lib_new_component.cpp - dialog_lib_new_component_base.cpp + dialogs/dialog_lib_new_component.cpp + dialogs/dialog_lib_new_component_base.cpp dialogs/dialog_print_using_printer_base.cpp dialogs/dialog_print_using_printer.cpp - dialog_sch_sheet_props.cpp - dialog_sch_sheet_props_base.cpp + dialogs/dialog_sch_edit_sheet_pin.cpp + dialogs/dialog_sch_edit_sheet_pin_base.cpp + dialogs/dialog_sch_sheet_props.cpp + dialogs/dialog_sch_sheet_props_base.cpp dialogs/dialog_schematic_find.cpp dialogs/dialog_schematic_find_base.cpp dialogs/dialog_SVG_print.cpp diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index a315c374ef..1966a8efc1 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -418,7 +418,7 @@ void LIB_EDIT_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) } -void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) +void LIB_VIEW_FRAME::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels ) { wxRealPoint delta; SCH_SCREEN* screen = GetScreen(); diff --git a/eeschema/dialog_lib_new_component.cpp b/eeschema/dialogs/dialog_lib_new_component.cpp similarity index 86% rename from eeschema/dialog_lib_new_component.cpp rename to eeschema/dialogs/dialog_lib_new_component.cpp index 1f03fb4fc4..0cf15cc040 100644 --- a/eeschema/dialog_lib_new_component.cpp +++ b/eeschema/dialogs/dialog_lib_new_component.cpp @@ -5,4 +5,5 @@ DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( wxWindow* parent ) : { /* Required to make escape key work correctly in wxGTK. */ m_sdbSizerOK->SetFocus(); + m_sdbSizerOK->SetDefault(); } diff --git a/eeschema/dialog_lib_new_component.fbp b/eeschema/dialogs/dialog_lib_new_component.fbp similarity index 100% rename from eeschema/dialog_lib_new_component.fbp rename to eeschema/dialogs/dialog_lib_new_component.fbp diff --git a/eeschema/dialog_lib_new_component.h b/eeschema/dialogs/dialog_lib_new_component.h similarity index 100% rename from eeschema/dialog_lib_new_component.h rename to eeschema/dialogs/dialog_lib_new_component.h diff --git a/eeschema/dialog_lib_new_component_base.cpp b/eeschema/dialogs/dialog_lib_new_component_base.cpp similarity index 100% rename from eeschema/dialog_lib_new_component_base.cpp rename to eeschema/dialogs/dialog_lib_new_component_base.cpp diff --git a/eeschema/dialog_lib_new_component_base.h b/eeschema/dialogs/dialog_lib_new_component_base.h similarity index 100% rename from eeschema/dialog_lib_new_component_base.h rename to eeschema/dialogs/dialog_lib_new_component_base.h diff --git a/eeschema/dialogs/dialog_sch_edit_sheet_pin.cpp b/eeschema/dialogs/dialog_sch_edit_sheet_pin.cpp new file mode 100644 index 0000000000..ffca6424ef --- /dev/null +++ b/eeschema/dialogs/dialog_sch_edit_sheet_pin.cpp @@ -0,0 +1,26 @@ +#include "dialog_sch_edit_sheet_pin.h" + + +static wxString sheetPinTypes[] = +{ + _( "Input" ), + _( "Output" ), + _( "Bidirectional" ), + _( "Tri-state" ), + _( "Passive" ) +}; + + +#define SHEET_PIN_TYPE_CNT ( sizeof( sheetPinTypes ) / sizeof( wxString ) ) + + +DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ) : + DIALOG_SCH_EDIT_SHEET_PIN_BASE( parent ) +{ + for( size_t i = 0; i < SHEET_PIN_TYPE_CNT; i++ ) + m_choiceConnectionType->Append( sheetPinTypes[ i ] ); + + m_choiceConnectionType->SetSelection( 0 ); + m_textName->SetFocus(); + m_sdbSizer2OK->SetDefault(); +} diff --git a/eeschema/dialogs/dialog_sch_edit_sheet_pin.fbp b/eeschema/dialogs/dialog_sch_edit_sheet_pin.fbp new file mode 100644 index 0000000000..8d7ecb7fc9 --- /dev/null +++ b/eeschema/dialogs/dialog_sch_edit_sheet_pin.fbp @@ -0,0 +1,747 @@ + + + + + + C++ + 1 + source_name + 0 + UTF-8 + connect + dialog_sch_edit_sheet_pin_base + 1000 + none + 1 + dialog_sch_edit_sheet_pin + + . + + 1 + 1 + 0 + 0 + + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_SCH_EDIT_SHEET_PIN_BASE + + + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Sheet Pin Properties + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + m_mainSizer + wxVERTICAL + none + + 6 + wxALL|wxEXPAND + 1 + + + m_nameSizer + wxHORIZONTAL + none + + 6 + wxEXPAND + 1 + + 3 + wxBOTH + + + 0 + + fgSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 4 + 0 + + 6 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Name: + + + m_staticText1 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + + 0 + + m_textName + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Text height: + + + m_staticText2 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + + 0 + + m_textHeight + protected + + + + + + + wxFILTER_NUMERIC + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + units + + + m_staticHeightUnits + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Text width: + + + m_staticText5 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + + 0 + + m_textWidth + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + units + + + m_staticWidthUnits + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + + 1 + 1 + + + 0 + wxID_ANY + Connection type: + + + m_staticText3 + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + + + + + 1 + 1 + + + 0 + wxID_ANY + + + m_choiceConnectionType + protected + + 0 + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxEXPAND + 1 + + 0 + protected + 0 + + + + + + + + 3 + wxALL|wxEXPAND + 0 + + 0 + protected + 0 + + + + 6 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer2 + protected + + + + + + + + + + + + + + diff --git a/eeschema/dialogs/dialog_sch_edit_sheet_pin.h b/eeschema/dialogs/dialog_sch_edit_sheet_pin.h new file mode 100644 index 0000000000..5d74d5698b --- /dev/null +++ b/eeschema/dialogs/dialog_sch_edit_sheet_pin.h @@ -0,0 +1,35 @@ +#ifndef __dialog_sch_edit_sheet_pin__ +#define __dialog_sch_edit_sheet_pin__ + + +/** + * @file + * Subclass of DIALOG_SCH_EDIT_SHEET_PIN_BASE, which is generated by wxFormBuilder. + */ + + +#include "dialog_sch_edit_sheet_pin_base.h" + + +class DIALOG_SCH_EDIT_SHEET_PIN : public DIALOG_SCH_EDIT_SHEET_PIN_BASE +{ +public: + DIALOG_SCH_EDIT_SHEET_PIN( wxWindow* parent ); + + void SetLabelName( const wxString& aName ) { m_textName->SetValue( aName ); } + wxString GetLabelName() const { return m_textName->GetValue(); } + + void SetTextHeight( const wxString& aHeight ) { m_textHeight->SetValue( aHeight ); } + wxString GetTextHeight() const { return m_textHeight->GetValue(); } + + void SetTextWidth( const wxString& aWidth ) { m_textWidth->SetValue( aWidth ); } + wxString GetTextWidth() const { return m_textWidth->GetValue(); } + + void SetConnectionType( int aType ) { m_choiceConnectionType->SetSelection( aType ); } + int GetConnectionType() const { return m_choiceConnectionType->GetCurrentSelection(); } + + void SetTextHeightUnits( const wxString& aUnit ) { m_staticHeightUnits->SetLabel( aUnit ); } + void SetTextWidthUnits( const wxString& aUnit ) { m_staticWidthUnits->SetLabel( aUnit ); } +}; + +#endif // __dialog_sch_edit_sheet_pin__ diff --git a/eeschema/dialogs/dialog_sch_edit_sheet_pin_base.cpp b/eeschema/dialogs/dialog_sch_edit_sheet_pin_base.cpp new file mode 100644 index 0000000000..b2eed498a9 --- /dev/null +++ b/eeschema/dialogs/dialog_sch_edit_sheet_pin_base.cpp @@ -0,0 +1,95 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Sep 8 2010) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_sch_edit_sheet_pin_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* m_mainSizer; + m_mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* m_nameSizer; + m_nameSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxFlexGridSizer* fgSizer1; + fgSizer1 = new wxFlexGridSizer( 4, 3, 0, 0 ); + fgSizer1->SetFlexibleDirection( wxBOTH ); + fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 6 ); + + m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer1->Add( m_textName, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 6 ); + + + fgSizer1->Add( 0, 0, 1, wxEXPAND, 6 ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Text height:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_textHeight = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer1->Add( m_textHeight, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 ); + + m_staticHeightUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticHeightUnits->Wrap( -1 ); + fgSizer1->Add( m_staticHeightUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_staticText5 = new wxStaticText( this, wxID_ANY, _("Text width:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText5->Wrap( -1 ); + fgSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_textWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer1->Add( m_textWidth, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 6 ); + + m_staticWidthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticWidthUnits->Wrap( -1 ); + fgSizer1->Add( m_staticWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + m_staticText3 = new wxStaticText( this, wxID_ANY, _("Connection type:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText3->Wrap( -1 ); + fgSizer1->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + wxArrayString m_choiceConnectionTypeChoices; + m_choiceConnectionType = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceConnectionTypeChoices, 0 ); + m_choiceConnectionType->SetSelection( 0 ); + fgSizer1->Add( m_choiceConnectionType, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + + + fgSizer1->Add( 0, 0, 1, wxEXPAND, 6 ); + + m_nameSizer->Add( fgSizer1, 1, wxEXPAND, 6 ); + + m_mainSizer->Add( m_nameSizer, 1, wxALL|wxEXPAND, 6 ); + + + m_mainSizer->Add( 0, 0, 0, wxALL|wxEXPAND, 3 ); + + m_sdbSizer2 = new wxStdDialogButtonSizer(); + m_sdbSizer2OK = new wxButton( this, wxID_OK ); + m_sdbSizer2->AddButton( m_sdbSizer2OK ); + m_sdbSizer2Cancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizer2->AddButton( m_sdbSizer2Cancel ); + m_sdbSizer2->Realize(); + m_mainSizer->Add( m_sdbSizer2, 0, wxALL|wxEXPAND, 6 ); + + this->SetSizer( m_mainSizer ); + this->Layout(); + m_mainSizer->Fit( this ); + + this->Centre( wxBOTH ); +} + +DIALOG_SCH_EDIT_SHEET_PIN_BASE::~DIALOG_SCH_EDIT_SHEET_PIN_BASE() +{ +} diff --git a/eeschema/dialogs/dialog_sch_edit_sheet_pin_base.h b/eeschema/dialogs/dialog_sch_edit_sheet_pin_base.h new file mode 100644 index 0000000000..42cb65e77b --- /dev/null +++ b/eeschema/dialogs/dialog_sch_edit_sheet_pin_base.h @@ -0,0 +1,60 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Sep 8 2010) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_sch_edit_sheet_pin_base__ +#define __dialog_sch_edit_sheet_pin_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_SCH_EDIT_SHEET_PIN_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public wxDialog +{ + private: + + protected: + wxStaticText* m_staticText1; + wxTextCtrl* m_textName; + + wxStaticText* m_staticText2; + wxTextCtrl* m_textHeight; + wxStaticText* m_staticHeightUnits; + wxStaticText* m_staticText5; + wxTextCtrl* m_textWidth; + wxStaticText* m_staticWidthUnits; + wxStaticText* m_staticText3; + wxChoice* m_choiceConnectionType; + + + wxStdDialogButtonSizer* m_sdbSizer2; + wxButton* m_sdbSizer2OK; + wxButton* m_sdbSizer2Cancel; + + public: + + DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_SCH_EDIT_SHEET_PIN_BASE(); + +}; + +#endif //__dialog_sch_edit_sheet_pin_base__ diff --git a/eeschema/dialog_sch_sheet_props.cpp b/eeschema/dialogs/dialog_sch_sheet_props.cpp similarity index 81% rename from eeschema/dialog_sch_sheet_props.cpp rename to eeschema/dialogs/dialog_sch_sheet_props.cpp index 655d409e9a..8aa611724c 100644 --- a/eeschema/dialog_sch_sheet_props.cpp +++ b/eeschema/dialogs/dialog_sch_sheet_props.cpp @@ -4,4 +4,5 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) : DIALOG_SCH_SHEET_PROPS_BASE( parent ) { m_textFileName->SetFocus(); + m_sdbSizer1OK->SetDefault(); } diff --git a/eeschema/dialog_sch_sheet_props.fbp b/eeschema/dialogs/dialog_sch_sheet_props.fbp similarity index 100% rename from eeschema/dialog_sch_sheet_props.fbp rename to eeschema/dialogs/dialog_sch_sheet_props.fbp diff --git a/eeschema/dialog_sch_sheet_props.h b/eeschema/dialogs/dialog_sch_sheet_props.h similarity index 100% rename from eeschema/dialog_sch_sheet_props.h rename to eeschema/dialogs/dialog_sch_sheet_props.h diff --git a/eeschema/dialog_sch_sheet_props_base.cpp b/eeschema/dialogs/dialog_sch_sheet_props_base.cpp similarity index 100% rename from eeschema/dialog_sch_sheet_props_base.cpp rename to eeschema/dialogs/dialog_sch_sheet_props_base.cpp diff --git a/eeschema/dialog_sch_sheet_props_base.h b/eeschema/dialogs/dialog_sch_sheet_props_base.h similarity index 100% rename from eeschema/dialog_sch_sheet_props_base.h rename to eeschema/dialogs/dialog_sch_sheet_props_base.h diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index d6bb8ce6f6..ffdad536f3 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -41,7 +41,7 @@ wxString WinEDA_SchematicFrame::SelectFromLibBrowser( void ) m_ViewlibFrame = NULL; } - m_ViewlibFrame = new WinEDA_ViewlibFrame( this, NULL, &semaphore ); + m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore ); m_ViewlibFrame->AdjustScrollBars(); // Show the library viewer frame until it is closed diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 2c4732830b..f12efe4500 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -19,7 +19,7 @@ #include "class_library.h" #include "template_fieldnames.h" -#include "dialog_lib_new_component.h" +#include "dialogs/dialog_lib_new_component.h" /* Update the main window title bar with the current library name. */ diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 3426a94594..3e9226eaad 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -725,7 +725,7 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event ) } else { - m_ViewlibFrame = new WinEDA_ViewlibFrame( this ); + m_ViewlibFrame = new LIB_VIEW_FRAME( this ); m_ViewlibFrame->AdjustScrollBars(); } } diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 7f1afe0169..03b226081c 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -23,7 +23,7 @@ #include "protos.h" #include "sch_sheet.h" -#include "dialog_sch_sheet_props.h" +#include "dialogs/dialog_sch_sheet_props.h" #include @@ -110,7 +110,7 @@ structures and cannot be undone.\nOk to continue renaming?" ); aSheet->ChangeFileName( this, fileName.GetFullPath() ); } } - + else SaveCopyInUndoList( aSheet, UR_CHANGED ); @@ -294,7 +294,7 @@ void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC ) DrawPanel->ForceCloseManageCurseur = ExitSheet; DrawPanel->ManageCurseur( DrawPanel, aDC, true ); DrawPanel->CursorOn( aDC ); - + if( (aSheet->m_Flags & IS_NEW) == 0 ) // not already in edit, save a copy for undo/redo { delete g_ItemToUndoCopy; diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index ccbc9bfe47..66a192882b 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -16,6 +16,8 @@ #include "sch_sheet.h" #include "dialog_helpers.h" +#include "dialogs/dialog_sch_edit_sheet_pin.h" + static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); @@ -26,110 +28,6 @@ static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT ); static wxPoint s_InitialPosition; // remember the initial value of the pin label when moving it static int s_InitialEdge; -/****************************************/ -/* class WinEDA_PinSheetPropertiesFrame */ -/****************************************/ - - -class WinEDA_PinSheetPropertiesFrame : public wxDialog -{ -private: - - WinEDA_SchematicFrame* m_Parent; - SCH_SHEET_PIN* m_CurrentPinSheet; - wxRadioBox* m_PinSheetType; - wxRadioBox* m_PinSheetShape; - WinEDA_GraphicTextCtrl* m_TextWin; - -public: WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent, - SCH_SHEET_PIN* curr_pinsheet, - const wxPoint& framepos = wxPoint( -1, -1 ) ); - ~WinEDA_PinSheetPropertiesFrame() { }; - -private: - void OnOkClick( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE( WinEDA_PinSheetPropertiesFrame, wxDialog ) -EVT_BUTTON( wxID_OK, WinEDA_PinSheetPropertiesFrame::OnOkClick ) -EVT_BUTTON( wxID_CANCEL, WinEDA_PinSheetPropertiesFrame::OnCancelClick ) -END_EVENT_TABLE() - - -WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame( - WinEDA_SchematicFrame* parent, - SCH_SHEET_PIN* curr_pinsheet, - const wxPoint& framepos ) : - wxDialog( parent, -1, _( "PinSheet Properties:" ), framepos, - wxSize( 340, 220 ), DIALOG_STYLE ) -{ - wxPoint pos; - wxString number; - wxButton* Button; - - m_Parent = parent; - - wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - SetSizer( MainBoxSizer ); - wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL ); - MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 ); - MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); - - m_CurrentPinSheet = curr_pinsheet; - - /* Create buttons: */ - Button = new wxButton( this, wxID_OK, _( "OK" ) ); - RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); - - Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ) ); - RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); - - m_TextWin = new WinEDA_GraphicTextCtrl( this, _( "Text:" ), - m_CurrentPinSheet->m_Text, - m_CurrentPinSheet->m_Size.x, - g_UserUnit, LeftBoxSizer, 200 ); - - // Display shape selection : - #define NBSHAPES 5 - wxString shape_list[NBSHAPES] = - { - _( "Input" ), _( "Output" ), _( "Bidi" ), _( "TriState" ), - _( "Passive" ) - }; - m_PinSheetShape = new wxRadioBox( this, -1, _( "PinSheet Shape:" ), - wxDefaultPosition, wxSize( -1, -1 ), - NBSHAPES, shape_list, 1 ); - m_PinSheetShape->SetSelection( m_CurrentPinSheet->m_Shape ); - LeftBoxSizer->Add( m_PinSheetShape, 0, wxGROW | wxALL, 5 ); - - m_TextWin->SetFocus(); - - GetSizer()->Fit( this ); - GetSizer()->SetSizeHints( this ); - Centre(); -} - - -void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED( - event) ) -{ - EndModal( wxID_CANCEL ); -} - - -void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event ) -{ - m_CurrentPinSheet->m_Text = m_TextWin->GetText(); - m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y = m_TextWin->GetTextSize(); - - m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection(); - EndModal( wxID_OK ); -} - /* Called when aborting a move pinsheet label * delete a new pin sheet label, or restire its old position @@ -195,8 +93,7 @@ void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) } -void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, - wxDC* DC ) +void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC ) { NetSheetTextSize = SheetLabel->m_Size; s_CurrentTypeLabel = SheetLabel->m_Shape; @@ -226,24 +123,44 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) } -int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC ) +int WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* aLabel, wxDC* aDC ) { - if( SheetLabel == NULL ) + if( aLabel == NULL ) return wxID_CANCEL; - if( DC ) - RedrawOneStruct( DrawPanel, DC, SheetLabel, g_XorMode ); + if( aDC ) + RedrawOneStruct( DrawPanel, aDC, aLabel, g_XorMode ); - WinEDA_PinSheetPropertiesFrame* frame = - new WinEDA_PinSheetPropertiesFrame( this, SheetLabel ); + DIALOG_SCH_EDIT_SHEET_PIN dlg( this ); - int diag = frame->ShowModal(); - frame->Destroy(); + dlg.SetLabelName( aLabel->m_Text ); + dlg.SetTextHeight( ReturnStringFromValue( g_UserUnit, aLabel->m_Size.y, m_InternalUnits ) ); + dlg.SetTextHeightUnits( GetUnitsLabel( g_UserUnit ) ); + dlg.SetTextWidth( ReturnStringFromValue( g_UserUnit, aLabel->m_Size.x, m_InternalUnits ) ); + dlg.SetTextWidthUnits( GetUnitsLabel( g_UserUnit ) ); + dlg.SetConnectionType( aLabel->m_Shape ); - if( DC ) - RedrawOneStruct( DrawPanel, DC, SheetLabel, GR_DEFAULT_DRAWMODE ); + /* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier versions for + * the flex grid sizer in wxGTK that prevents the last column from being sized + * correctly. It doesn't cause any problems on win32 so it doesn't need to wrapped + * in ugly #ifdef __WXGTK__ #endif. + */ + dlg.Layout(); + dlg.Fit(); + dlg.SetMinSize( dlg.GetSize() ); - return diag; + if( dlg.ShowModal() == wxID_CANCEL ) + return wxID_CANCEL; + + aLabel->m_Text = dlg.GetLabelName(); + aLabel->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), m_InternalUnits ); + aLabel->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_InternalUnits ); + aLabel->m_Shape = dlg.GetConnectionType(); + + if( aDC ) + RedrawOneStruct( DrawPanel, aDC, aLabel, GR_DEFAULT_DRAWMODE ); + + return wxID_OK; } @@ -266,6 +183,7 @@ SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet, wxDC* D delete NewSheetLabel; return NULL; } + GetScreen()->SetCurItem( NewSheetLabel ); s_CurrentTypeLabel = NewSheetLabel->m_Shape; diff --git a/eeschema/tool_viewlib.cpp b/eeschema/tool_viewlib.cpp index d9b7fb9328..af6f11bade 100644 --- a/eeschema/tool_viewlib.cpp +++ b/eeschema/tool_viewlib.cpp @@ -17,7 +17,7 @@ #include "dialog_helpers.h" -void WinEDA_ViewlibFrame::ReCreateHToolbar() +void LIB_VIEW_FRAME::ReCreateHToolbar() { int ii; wxString msg; @@ -159,6 +159,6 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar() } -void WinEDA_ViewlibFrame::ReCreateVToolbar() +void LIB_VIEW_FRAME::ReCreateVToolbar() { } diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index e9889f6801..96e94d18f3 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -22,43 +22,44 @@ /** * Save previous component library viewer state. */ -wxString WinEDA_ViewlibFrame::m_libraryName; -wxString WinEDA_ViewlibFrame::m_entryName; -wxString WinEDA_ViewlibFrame::m_exportToEeschemaCmpName; // When the viewer is used to select a component - // in schematic, the selected component is here -int WinEDA_ViewlibFrame::m_unit = 1; -int WinEDA_ViewlibFrame::m_convert = 1; -wxSize WinEDA_ViewlibFrame::m_clientSize = wxSize( -1, -1 ); +wxString LIB_VIEW_FRAME::m_libraryName; +wxString LIB_VIEW_FRAME::m_entryName; +int LIB_VIEW_FRAME::m_unit = 1; +int LIB_VIEW_FRAME::m_convert = 1; +wxSize LIB_VIEW_FRAME::m_clientSize = wxSize( -1, -1 ); + +// When the viewer is used to select a component in schematic, the selected component is here. +wxString LIB_VIEW_FRAME::m_exportToEeschemaCmpName; /*****************************/ /* class WinEDA_ViewlibFrame */ /*****************************/ -BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, WinEDA_DrawFrame ) +BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, WinEDA_DrawFrame ) /* Window events */ - EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow ) - EVT_SIZE( WinEDA_ViewlibFrame::OnSize ) - EVT_ACTIVATE( WinEDA_ViewlibFrame::OnActivate ) + EVT_CLOSE( LIB_VIEW_FRAME::OnCloseWindow ) + EVT_SIZE( LIB_VIEW_FRAME::OnSize ) + EVT_ACTIVATE( LIB_VIEW_FRAME::OnActivate ) /* Sash drag events */ - EVT_SASH_DRAGGED( ID_LIBVIEW_LIBWINDOW, WinEDA_ViewlibFrame::OnSashDrag ) - EVT_SASH_DRAGGED( ID_LIBVIEW_CMPWINDOW, WinEDA_ViewlibFrame::OnSashDrag ) + EVT_SASH_DRAGGED( ID_LIBVIEW_LIBWINDOW, LIB_VIEW_FRAME::OnSashDrag ) + EVT_SASH_DRAGGED( ID_LIBVIEW_CMPWINDOW, LIB_VIEW_FRAME::OnSashDrag ) /* Toolbar events */ EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, - WinEDA_ViewlibFrame::Process_Special_Functions ) + LIB_VIEW_FRAME::Process_Special_Functions ) - EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ViewlibFrame::OnZoom ) + EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, LIB_VIEW_FRAME::OnZoom ) EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, - WinEDA_ViewlibFrame::ExportToSchematicLibraryPart ) + LIB_VIEW_FRAME::ExportToSchematicLibraryPart ) EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER, - WinEDA_ViewlibFrame::Process_Special_Functions ) + LIB_VIEW_FRAME::Process_Special_Functions ) /* listbox events */ - EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList ) - EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList ) + EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, LIB_VIEW_FRAME::ClickOnLibList ) + EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::ClickOnCmpList ) - EVT_MENU( ID_SET_RELATIVE_OFFSET, WinEDA_ViewlibFrame::OnSetRelativeOffset ) + EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset ) END_EVENT_TABLE() @@ -82,9 +83,7 @@ static wxAcceleratorEntry accels[] = #define EXTRA_BORDER_SIZE 2 -WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, - CMP_LIBRARY* Library, - wxSemaphore* semaphore ) : +LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaphore* semaphore ) : WinEDA_DrawFrame( father, VIEWER_FRAME, _( "Library browser" ), wxDefaultPosition, wxDefaultSize ) { @@ -204,17 +203,17 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, m_auimgr.AddPane( m_HToolBar, wxAuiPaneInfo( horiz ).Name( wxT ("m_HToolBar" ) ).Top().Row( 0 ) ); - wxSize minsize(60,-1); + wxSize minsize( 60, -1 ); + // Manage the left window (list of libraries) if( m_LibListWindow ) - m_auimgr.AddPane( m_LibListWindow, - wxAuiPaneInfo( vert ).Name( wxT( "m_LibList" ) ). - Left().Row( 0 ).MinSize(minsize) ); + m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( vert ).Name( wxT( "m_LibList" ) ). + Left().Row( 0 ).MinSize( minsize ) ); // Manage the list of components) m_auimgr.AddPane( m_CmpListWindow, wxAuiPaneInfo( vert ).Name( wxT( "m_CmpList" ) ). - Left().Row( 1 ).MinSize(minsize) ); + Left().Row( 1 ).MinSize( minsize ) ); // Manage the draw panel m_auimgr.AddPane( DrawPanel, @@ -239,19 +238,20 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, } -WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() +LIB_VIEW_FRAME::~LIB_VIEW_FRAME() { - WinEDA_SchematicFrame* frame = - (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); + WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow(); frame->m_ViewlibFrame = NULL; } -void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event ) +void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) { SaveSettings(); + if( m_Semaphore ) m_Semaphore->Post(); + Destroy(); } @@ -259,7 +259,7 @@ void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event ) /* * Resize sub windows when dragging a sash window border */ -void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event ) +void LIB_VIEW_FRAME::OnSashDrag( wxSashEvent& event ) { if( event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE ) return; @@ -272,26 +272,26 @@ void WinEDA_ViewlibFrame::OnSashDrag( wxSashEvent& event ) case ID_LIBVIEW_LIBWINDOW: if( m_LibListWindow ) { - wxAuiPaneInfo& pane = m_auimgr.GetPane(m_LibListWindow); + wxAuiPaneInfo& pane = m_auimgr.GetPane( m_LibListWindow ); m_LibListSize.x = event.GetDragRect().width; - pane.MinSize(m_LibListSize); + pane.MinSize( m_LibListSize ); m_auimgr.Update(); } break; case ID_LIBVIEW_CMPWINDOW: { - wxAuiPaneInfo& pane = m_auimgr.GetPane(m_CmpListWindow); - m_CmpListSize.x = event.GetDragRect().width; - pane.MinSize(m_CmpListSize); - m_auimgr.Update(); + wxAuiPaneInfo& pane = m_auimgr.GetPane( m_CmpListWindow ); + m_CmpListSize.x = event.GetDragRect().width; + pane.MinSize( m_CmpListSize ); + m_auimgr.Update(); } break; } } -void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv ) +void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv ) { if( m_auimgr.GetManagedWindow() ) m_auimgr.Update(); @@ -300,14 +300,14 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv ) } -void WinEDA_ViewlibFrame::OnSetRelativeOffset( wxCommandEvent& event ) +void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event ) { GetScreen()->m_O_Curseur = GetScreen()->m_Curseur; UpdateStatusBar(); } -int WinEDA_ViewlibFrame::BestZoom() +int LIB_VIEW_FRAME::BestZoom() { int bestzoom, ii, jj; wxSize size; @@ -372,7 +372,7 @@ int WinEDA_ViewlibFrame::BestZoom() * Creates or recreates the list of current loaded libraries. * This list is sorted, with the library cache always at end of the list */ -void WinEDA_ViewlibFrame::ReCreateListLib() +void LIB_VIEW_FRAME::ReCreateListLib() { if( m_LibList == NULL ) return; @@ -404,7 +404,7 @@ void WinEDA_ViewlibFrame::ReCreateListLib() } -void WinEDA_ViewlibFrame::ReCreateListCmp() +void LIB_VIEW_FRAME::ReCreateListCmp() { if( m_CmpList == NULL ) return; @@ -441,7 +441,7 @@ void WinEDA_ViewlibFrame::ReCreateListCmp() } -void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event ) +void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event ) { int ii = m_LibList->GetSelection(); @@ -449,8 +449,10 @@ void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event ) return; wxString name = m_LibList->GetString( ii ); + if( m_libraryName == name ) return; + m_libraryName = name; ReCreateListCmp(); DrawPanel->Refresh(); @@ -459,7 +461,7 @@ void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event ) } -void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event ) +void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event ) { int ii = m_CmpList->GetSelection(); @@ -485,7 +487,7 @@ void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event ) /* * Export the current component to schematic and close the library browser */ -void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event ) +void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event ) { int ii = m_CmpList->GetSelection(); @@ -493,19 +495,22 @@ void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event ) m_exportToEeschemaCmpName = m_CmpList->GetString( ii ); else m_exportToEeschemaCmpName.Empty(); + Close( TRUE ); } -#define LIBLIST_WIDTH_KEY wxT("Liblist_width") -#define CMPLIST_WIDTH_KEY wxT("Cmplist_width") +#define LIBLIST_WIDTH_KEY wxT( "Liblist_width" ) +#define CMPLIST_WIDTH_KEY wxT( "Cmplist_width" ) + + /** * Load library viewer frame specific configuration settings. * * Don't forget to call this base method from any derived classes or the * settings will not get loaded. */ -void WinEDA_ViewlibFrame::LoadSettings( ) +void LIB_VIEW_FRAME::LoadSettings( ) { wxConfig* cfg ; @@ -535,7 +540,7 @@ void WinEDA_ViewlibFrame::LoadSettings( ) * Don't forget to call this base method from any derived classes or the * settings will not get saved. */ -void WinEDA_ViewlibFrame::SaveSettings() +void LIB_VIEW_FRAME::SaveSettings() { wxConfig* cfg; @@ -546,13 +551,14 @@ void WinEDA_ViewlibFrame::SaveSettings() if ( m_LibListSize.x ) cfg->Write( LIBLIST_WIDTH_KEY, m_LibListSize.x ); + cfg->Write( CMPLIST_WIDTH_KEY, m_CmpListSize.x ); } /** Called on activate the frame. * Reload the libraries lists that can be changed by the schematic editor or the library editor */ -void WinEDA_ViewlibFrame::OnActivate( wxActivateEvent& event ) +void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event ) { WinEDA_DrawFrame::OnActivate( event ); @@ -562,5 +568,6 @@ void WinEDA_ViewlibFrame::OnActivate( wxActivateEvent& event ) if( m_LibList ) ReCreateListLib(); + DisplayLibInfos(); } diff --git a/eeschema/viewlib_frame.h b/eeschema/viewlib_frame.h index 365470dd0a..282013bb0c 100644 --- a/eeschema/viewlib_frame.h +++ b/eeschema/viewlib_frame.h @@ -18,7 +18,7 @@ class CMP_LIBRARY; /** * Component library viewer main window. */ -class WinEDA_ViewlibFrame : public WinEDA_DrawFrame +class LIB_VIEW_FRAME : public WinEDA_DrawFrame { private: WinEDAChoiceBox* SelpartBox; @@ -47,11 +47,9 @@ protected: static wxSize m_clientSize; public: - WinEDA_ViewlibFrame( wxWindow* father, - CMP_LIBRARY* Library = NULL, - wxSemaphore* semaphore = NULL ); + LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library = NULL, wxSemaphore* semaphore = NULL ); - ~WinEDA_ViewlibFrame(); + ~LIB_VIEW_FRAME(); void OnSize( wxSizeEvent& event ); void OnSashDrag( wxSashEvent& event ); diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index 5fbd07a566..361c0c5b77 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -25,7 +25,7 @@ #define PREVIOUS_PART -1 -void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event ) +void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) { wxString msg; LIB_ALIAS* LibEntry; @@ -80,27 +80,26 @@ void WinEDA_ViewlibFrame::Process_Special_Functions( wxCommandEvent& event ) break; default: - msg << wxT( "WinEDA_ViewlibFrame::Process_Special_Functions error: id = " ) << id; + msg << wxT( "LIB_VIEW_FRAME::Process_Special_Functions error: id = " ) << id; DisplayError( this, msg ); break; } } -void WinEDA_ViewlibFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) +void LIB_VIEW_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { } -bool WinEDA_ViewlibFrame::OnRightClick( const wxPoint& MousePos, - wxMenu* PopMenu ) +bool LIB_VIEW_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) { return true; } /* Displays the name of the current opened library in the caption */ -void WinEDA_ViewlibFrame::DisplayLibInfos() +void LIB_VIEW_FRAME::DisplayLibInfos() { wxString msg; CMP_LIBRARY* Lib; @@ -123,16 +122,18 @@ void WinEDA_ViewlibFrame::DisplayLibInfos() /*****************************************/ /* Function to Select Current library */ /*****************************************/ -void WinEDA_ViewlibFrame::SelectCurrentLibrary() +void LIB_VIEW_FRAME::SelectCurrentLibrary() { CMP_LIBRARY* Lib; Lib = SelectLibraryFromList( this ); + if( Lib ) { m_entryName.Empty(); m_libraryName = Lib->GetName(); DisplayLibInfos(); + if( m_LibList ) { ReCreateListCmp(); @@ -140,6 +141,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary() DisplayLibInfos(); ReCreateHToolbar(); int id = m_LibList->FindString( m_libraryName.GetData() ); + if( id >= 0 ) m_LibList->SetSelection( id ); } @@ -150,7 +152,7 @@ void WinEDA_ViewlibFrame::SelectCurrentLibrary() /* * Routine to select and view library Part (NEW, NEXT or PREVIOUS) */ -void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option ) +void LIB_VIEW_FRAME::SelectAndViewLibraryPart( int option ) { CMP_LIBRARY* Lib; @@ -160,6 +162,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option ) return; Lib = CMP_LIBRARY::FindLibrary( m_libraryName ); + if( Lib == NULL ) return; @@ -185,7 +188,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option ) /*************************************************/ /* Routine to view one selected library content. */ /*************************************************/ -void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) +void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) { int NumOfParts = 0; LIB_ALIAS* LibEntry; @@ -248,7 +251,7 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) * Display the current selected component. * If the component is an alias, the ROOT component is displayed */ -void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) +void LIB_VIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) { LIB_COMPONENT* component; LIB_ALIAS* entry; diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index dc74daa4c2..4185aa305c 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -12,7 +12,7 @@ class LIB_EDIT_FRAME; -class WinEDA_ViewlibFrame; +class LIB_VIEW_FRAME; class SCH_SCREEN; class DRAWSEGMENT; class DrawPickedStruct; @@ -64,7 +64,7 @@ public: bool m_ShowAllPins; wxPoint m_OldPos; LIB_EDIT_FRAME* m_LibeditFrame; - WinEDA_ViewlibFrame* m_ViewlibFrame; + LIB_VIEW_FRAME* m_ViewlibFrame; wxString m_UserLibraryPath; wxArrayString m_ComponentLibFiles;