Commit 29446320 authored by jean-pierre charras's avatar jean-pierre charras

Code cleanup and minor fix in viewlib.

parent a094f7d5
...@@ -105,10 +105,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() ...@@ -105,10 +105,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
SelpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER, m_selpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxEmptyString, wxDefaultPosition, wxEmptyString, wxDefaultPosition,
wxSize( 150, -1 ), 0, NULL, wxCB_READONLY ); wxSize( 150, -1 ), 0, NULL, wxCB_READONLY );
m_mainToolBar->AddControl( SelpartBox ); m_mainToolBar->AddControl( m_selpartBox );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
...@@ -116,7 +116,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() ...@@ -116,7 +116,7 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
_( "View component documents" ) ); _( "View component documents" ) );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false ); m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
if( m_Semaphore ) if( m_semaphore )
{ {
// The library browser is called from a "load component" command // The library browser is called from a "load component" command
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
...@@ -167,17 +167,17 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() ...@@ -167,17 +167,17 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
if( component ) if( component )
parts_count = std::max( component->GetPartCount(), 1 ); parts_count = std::max( component->GetPartCount(), 1 );
SelpartBox->Clear(); m_selpartBox->Clear();
for( ii = 0; ii < parts_count; ii++ ) for( ii = 0; ii < parts_count; ii++ )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Unit %c" ), 'A' + ii ); msg.Printf( _( "Unit %c" ), 'A' + ii );
SelpartBox->Append( msg ); m_selpartBox->Append( msg );
} }
SelpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 ); m_selpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 );
SelpartBox->Enable( parts_count > 1 ); m_selpartBox->Enable( parts_count > 1 );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC,
entry && ( entry->GetDocFileName() != wxEmptyString ) ); entry && ( entry->GetDocFileName() != wxEmptyString ) );
......
...@@ -60,10 +60,6 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME ) ...@@ -60,10 +60,6 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_SIZE( LIB_VIEW_FRAME::OnSize ) EVT_SIZE( LIB_VIEW_FRAME::OnSize )
EVT_ACTIVATE( LIB_VIEW_FRAME::OnActivate ) EVT_ACTIVATE( LIB_VIEW_FRAME::OnActivate )
/* Sash drag events */
EVT_SASH_DRAGGED( ID_LIBVIEW_LIBWINDOW, LIB_VIEW_FRAME::OnSashDrag )
EVT_SASH_DRAGGED( ID_LIBVIEW_CMPWINDOW, LIB_VIEW_FRAME::OnSashDrag )
/* Toolbar events */ /* Toolbar events */
EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, EVT_TOOL_RANGE( ID_LIBVIEW_NEXT, ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT,
LIB_VIEW_FRAME::Process_Special_Functions ) LIB_VIEW_FRAME::Process_Special_Functions )
...@@ -96,8 +92,6 @@ static wxAcceleratorEntry accels[] = ...@@ -96,8 +92,6 @@ static wxAcceleratorEntry accels[] =
}; };
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) ) #define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
#define EXTRA_BORDER_SIZE 2
#define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" ) #define LIB_VIEW_FRAME_NAME wxT( "ViewlibFrame" )
LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary, LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
...@@ -117,13 +111,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary, ...@@ -117,13 +111,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
SetIcon( icon ); SetIcon( icon );
m_HotkeysZoomAndGridList = s_Viewlib_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Viewlib_Hokeys_Descr;
m_CmpList = NULL; m_cmpList = NULL;
m_LibList = NULL; m_libList = NULL;
m_LibListWindow = NULL; m_semaphore = aSemaphore;
m_CmpListWindow = NULL;
m_Semaphore = aSemaphore; if( m_semaphore )
if( m_Semaphore )
SetModalMode( true ); SetModalMode( true );
m_exportToEeschemaCmpName.Empty(); m_exportToEeschemaCmpName.Empty();
SetScreen( new SCH_SCREEN() ); SetScreen( new SCH_SCREEN() );
...@@ -142,23 +136,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary, ...@@ -142,23 +136,13 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
wxSize size = GetClientSize(); wxSize size = GetClientSize();
size.y -= m_MsgFrameHeight + 2; size.y -= m_MsgFrameHeight + 2;
m_LibListSize.y = -1;
wxPoint win_pos( 0, 0 ); wxPoint win_pos( 0, 0 );
if( aLibrary == NULL ) if( aLibrary == NULL )
{ {
// Creates the libraries window display // Creates the libraries window display
m_LibListWindow = m_libList = new wxListBox( this, ID_LIBVIEW_LIB_LIST,
new wxSashLayoutWindow( this, ID_LIBVIEW_LIBWINDOW, win_pos, wxPoint( 0, 0 ), wxSize(m_libListWidth, -1),
wxDefaultSize, wxCLIP_CHILDREN | wxSW_3D,
wxT( "LibWindow" ) );
m_LibListWindow->SetOrientation( wxLAYOUT_VERTICAL );
m_LibListWindow->SetAlignment( wxLAYOUT_LEFT );
m_LibListWindow->SetSashVisible( wxSASH_RIGHT, true );
m_LibListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE );
m_LibList = new wxListBox( m_LibListWindow, ID_LIBVIEW_LIB_LIST,
wxPoint( 0, 0 ), wxDefaultSize,
0, NULL, wxLB_HSCROLL ); 0, NULL, wxLB_HSCROLL );
} }
else else
...@@ -167,25 +151,16 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary, ...@@ -167,25 +151,16 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
m_entryName.Clear(); m_entryName.Clear();
m_unit = 1; m_unit = 1;
m_convert = 1; m_convert = 1;
m_LibListSize.x = 0; m_libListWidth = 0;
} }
// Creates the component window display // Creates the component window display
m_CmpListSize.y = size.y; win_pos.x = m_libListWidth;
win_pos.x = m_LibListSize.x; m_cmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST,
m_CmpListWindow = new wxSashLayoutWindow( this, ID_LIBVIEW_CMPWINDOW, wxPoint( 0, 0 ), wxSize(m_cmpListWidth, -1),
win_pos, wxDefaultSize,
wxCLIP_CHILDREN | wxSW_3D,
wxT( "CmpWindow" ) );
m_CmpListWindow->SetOrientation( wxLAYOUT_VERTICAL );
m_CmpListWindow->SetSashVisible( wxSASH_RIGHT, true );
m_CmpListWindow->SetExtraBorderSize( EXTRA_BORDER_SIZE );
m_CmpList = new wxListBox( m_CmpListWindow, ID_LIBVIEW_CMP_LIST,
wxPoint( 0, 0 ), wxDefaultSize,
0, NULL, wxLB_HSCROLL ); 0, NULL, wxLB_HSCROLL );
if( m_LibList ) if( m_libList )
ReCreateListLib(); ReCreateListLib();
DisplayLibInfos(); DisplayLibInfos();
...@@ -213,16 +188,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary, ...@@ -213,16 +188,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
m_auimgr.AddPane( m_mainToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) );
wxSize minsize( 60, -1 );
// Manage the left window (list of libraries) // Manage the left window (list of libraries)
if( m_LibListWindow ) if( m_libList )
m_auimgr.AddPane( m_LibListWindow, wxAuiPaneInfo( info ).Name( wxT( "m_LibList" ) ). m_auimgr.AddPane( m_libList, wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) ).
Left().Row( 0 )); Left().Row( 0 ) );
// Manage the list of components) // Manage the list of components)
m_auimgr.AddPane( m_CmpListWindow, m_auimgr.AddPane( m_cmpList,
wxAuiPaneInfo( info ).Name( wxT( "m_CmpList" ) ). wxAuiPaneInfo( info ).Name( wxT( "m_cmpList" ) ).
Left().Row( 1 ) ); Left().Row( 1 ) );
// Manage the draw panel // Manage the draw panel
...@@ -236,13 +209,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary, ...@@ -236,13 +209,14 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( SCH_BASE_FRAME* aParent, CMP_LIBRARY* aLibrary,
/* Now the minimum windows are fixed, set library list /* Now the minimum windows are fixed, set library list
* and component list of the previous values from last viewlib use * and component list of the previous values from last viewlib use
*/ */
if( m_LibListWindow ) if( m_libList )
{ {
wxAuiPaneInfo& pane = m_auimgr.GetPane(m_LibListWindow); m_auimgr.GetPane( m_libList ).MinSize( wxSize( 80, -1) );
pane.MinSize( wxSize(m_LibListSize.x, -1)); m_auimgr.GetPane( m_libList ).BestSize( wxSize(m_libListWidth, -1) );
} }
wxAuiPaneInfo& pane = m_auimgr.GetPane(m_CmpListWindow);
pane.MinSize(wxSize(m_CmpListSize.x, -1)); m_auimgr.GetPane( m_cmpList ).MinSize( wxSize( 80, -1) );
m_auimgr.GetPane( m_cmpList ).BestSize(wxSize(m_cmpListWidth, -1) );
m_auimgr.Update(); m_auimgr.Update();
...@@ -278,9 +252,9 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -278,9 +252,9 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
{ {
SaveSettings(); SaveSettings();
if( m_Semaphore ) if( m_semaphore )
{ {
m_Semaphore->Post(); m_semaphore->Post();
// This window will be destroyed by the calling function, // This window will be destroyed by the calling function,
// if needed // if needed
SetModalMode( false ); SetModalMode( false );
...@@ -292,38 +266,6 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event ) ...@@ -292,38 +266,6 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
} }
void LIB_VIEW_FRAME::OnSashDrag( wxSashEvent& event )
{
if( event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE )
return;
m_LibListSize.y = GetClientSize().y - m_MsgFrameHeight;
m_CmpListSize.y = m_LibListSize.y;
switch( event.GetId() )
{
case ID_LIBVIEW_LIBWINDOW:
if( m_LibListWindow )
{
wxAuiPaneInfo& pane = m_auimgr.GetPane( m_LibListWindow );
m_LibListSize.x = event.GetDragRect().width;
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();
}
break;
}
}
void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv ) void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
{ {
if( m_auimgr.GetManagedWindow() ) if( m_auimgr.GetManagedWindow() )
...@@ -388,18 +330,18 @@ double LIB_VIEW_FRAME::BestZoom() ...@@ -388,18 +330,18 @@ double LIB_VIEW_FRAME::BestZoom()
void LIB_VIEW_FRAME::ReCreateListLib() void LIB_VIEW_FRAME::ReCreateListLib()
{ {
if( m_LibList == NULL ) if( m_libList == NULL )
return; return;
m_LibList->Clear(); m_libList->Clear();
m_LibList->Append( CMP_LIBRARY::GetLibraryNames() ); m_libList->Append( CMP_LIBRARY::GetLibraryNames() );
// Search for a previous selection: // Search for a previous selection:
int index = m_LibList->FindString( m_libraryName ); int index = m_libList->FindString( m_libraryName );
if( index != wxNOT_FOUND ) if( index != wxNOT_FOUND )
{ {
m_LibList->SetSelection( index, true ); m_libList->SetSelection( index, true );
} }
else else
{ {
...@@ -420,10 +362,10 @@ void LIB_VIEW_FRAME::ReCreateListLib() ...@@ -420,10 +362,10 @@ void LIB_VIEW_FRAME::ReCreateListLib()
void LIB_VIEW_FRAME::ReCreateListCmp() void LIB_VIEW_FRAME::ReCreateListCmp()
{ {
if( m_CmpList == NULL ) if( m_cmpList == NULL )
return; return;
m_CmpList->Clear(); m_cmpList->Clear();
CMP_LIBRARY* Library = CMP_LIBRARY::FindLibrary( m_libraryName ); CMP_LIBRARY* Library = CMP_LIBRARY::FindLibrary( m_libraryName );
...@@ -438,9 +380,9 @@ void LIB_VIEW_FRAME::ReCreateListCmp() ...@@ -438,9 +380,9 @@ void LIB_VIEW_FRAME::ReCreateListCmp()
wxArrayString nameList; wxArrayString nameList;
Library->GetEntryNames( nameList ); Library->GetEntryNames( nameList );
m_CmpList->Append( nameList ); m_cmpList->Append( nameList );
int index = m_CmpList->FindString( m_entryName ); int index = m_cmpList->FindString( m_entryName );
if( index == wxNOT_FOUND ) if( index == wxNOT_FOUND )
{ {
...@@ -450,19 +392,19 @@ void LIB_VIEW_FRAME::ReCreateListCmp() ...@@ -450,19 +392,19 @@ void LIB_VIEW_FRAME::ReCreateListCmp()
} }
else else
{ {
m_CmpList->SetSelection( index, true ); m_cmpList->SetSelection( index, true );
} }
} }
void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event ) void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event )
{ {
int ii = m_LibList->GetSelection(); int ii = m_libList->GetSelection();
if( ii < 0 ) if( ii < 0 )
return; return;
wxString name = m_LibList->GetString( ii ); wxString name = m_libList->GetString( ii );
if( m_libraryName == name ) if( m_libraryName == name )
return; return;
...@@ -477,12 +419,12 @@ void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event ) ...@@ -477,12 +419,12 @@ void LIB_VIEW_FRAME::ClickOnLibList( wxCommandEvent& event )
void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event ) void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
{ {
int ii = m_CmpList->GetSelection(); int ii = m_cmpList->GetSelection();
if( ii < 0 ) if( ii < 0 )
return; return;
wxString name = m_CmpList->GetString( ii ); wxString name = m_cmpList->GetString( ii );
if( m_entryName.CmpNoCase( name ) != 0 ) if( m_entryName.CmpNoCase( name ) != 0 )
{ {
...@@ -498,7 +440,7 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event ) ...@@ -498,7 +440,7 @@ void LIB_VIEW_FRAME::ClickOnCmpList( wxCommandEvent& event )
void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event ) void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
{ {
if( m_Semaphore ) if( m_semaphore )
{ {
ExportToSchematicLibraryPart( event ); ExportToSchematicLibraryPart( event );
...@@ -512,10 +454,10 @@ void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event ) ...@@ -512,10 +454,10 @@ void LIB_VIEW_FRAME::DClickOnCmpList( wxCommandEvent& event )
void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event ) void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
{ {
int ii = m_CmpList->GetSelection(); int ii = m_cmpList->GetSelection();
if( ii >= 0 ) if( ii >= 0 )
m_exportToEeschemaCmpName = m_CmpList->GetString( ii ); m_exportToEeschemaCmpName = m_cmpList->GetString( ii );
else else
m_exportToEeschemaCmpName.Empty(); m_exportToEeschemaCmpName.Empty();
...@@ -523,8 +465,8 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event ) ...@@ -523,8 +465,8 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
} }
#define LIBLIST_WIDTH_KEY wxT( "Liblist_width" ) #define LIBLIST_WIDTH_KEY wxT( "ViewLiblistWidth" )
#define CMPLIST_WIDTH_KEY wxT( "Cmplist_width" ) #define CMPLIST_WIDTH_KEY wxT( "ViewCmplistWidth" )
void LIB_VIEW_FRAME::LoadSettings( ) void LIB_VIEW_FRAME::LoadSettings( )
...@@ -536,18 +478,15 @@ void LIB_VIEW_FRAME::LoadSettings( ) ...@@ -536,18 +478,15 @@ void LIB_VIEW_FRAME::LoadSettings( )
wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().GetSettings(); cfg = wxGetApp().GetSettings();
m_LibListSize.x = 150; // default width of libs list cfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 100 );
m_CmpListSize.x = 150; // default width of component list cfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 100 );
cfg->Read( LIBLIST_WIDTH_KEY, &m_LibListSize.x );
cfg->Read( CMPLIST_WIDTH_KEY, &m_CmpListSize.x );
// Set parameters to a reasonable value. // Set parameters to a reasonable value.
if ( m_LibListSize.x > m_FrameSize.x/2 ) if ( m_libListWidth > m_FrameSize.x/2 )
m_LibListSize.x = m_FrameSize.x/2; m_libListWidth = m_FrameSize.x/2;
if ( m_CmpListSize.x > m_FrameSize.x/2 ) if ( m_cmpListWidth > m_FrameSize.x/2 )
m_CmpListSize.x = m_FrameSize.x/2; m_cmpListWidth = m_FrameSize.x/2;
} }
...@@ -560,10 +499,14 @@ void LIB_VIEW_FRAME::SaveSettings() ...@@ -560,10 +499,14 @@ void LIB_VIEW_FRAME::SaveSettings()
wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath ); wxConfigPathChanger cpc( wxGetApp().GetSettings(), m_configPath );
cfg = wxGetApp().GetSettings(); cfg = wxGetApp().GetSettings();
if ( m_LibListSize.x ) if( m_libListWidth && m_libList)
cfg->Write( LIBLIST_WIDTH_KEY, m_LibListSize.x ); {
m_libListWidth = m_libList->GetSize().x;
cfg->Write( LIBLIST_WIDTH_KEY, m_libListWidth );
}
cfg->Write( CMPLIST_WIDTH_KEY, m_CmpListSize.x ); m_cmpListWidth = m_cmpList->GetSize().x;
cfg->Write( CMPLIST_WIDTH_KEY, m_cmpListWidth );
} }
...@@ -575,7 +518,7 @@ void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event ) ...@@ -575,7 +518,7 @@ void LIB_VIEW_FRAME::OnActivate( wxActivateEvent& event )
if( m_FrameIsActive ) if( m_FrameIsActive )
m_exportToEeschemaCmpName.Empty(); m_exportToEeschemaCmpName.Empty();
if( m_LibList ) if( m_libList )
ReCreateListLib(); ReCreateListLib();
DisplayLibInfos(); DisplayLibInfos();
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2014 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -48,20 +48,18 @@ class CMP_LIBRARY; ...@@ -48,20 +48,18 @@ class CMP_LIBRARY;
class LIB_VIEW_FRAME : public SCH_BASE_FRAME class LIB_VIEW_FRAME : public SCH_BASE_FRAME
{ {
private: private:
wxComboBox* SelpartBox; wxComboBox* m_selpartBox;
// List of libraries (for selection ) // List of libraries (for selection )
wxSashLayoutWindow* m_LibListWindow; wxListBox* m_libList; // The list of libs
wxListBox* m_LibList; // The list of libs int m_libListWidth; // Last width 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; wxListBox* m_cmpList; // The list of components
wxListBox* m_CmpList; // The list of components int m_cmpListWidth; // Last width 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 configuration wxString m_configPath; // subpath for configuration
protected: protected:
...@@ -95,12 +93,6 @@ public: ...@@ -95,12 +93,6 @@ public:
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
/**
* Function OnSashDrag
* resizes the child windows when dragging a sash window border.
*/
void OnSashDrag( wxSashEvent& event );
/** /**
* Function ReCreateListLib * Function ReCreateListLib
* *
......
...@@ -70,7 +70,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -70,7 +70,7 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_LIBVIEW_SELECT_PART_NUMBER: case ID_LIBVIEW_SELECT_PART_NUMBER:
ii = SelpartBox->GetCurrentSelection(); ii = m_selpartBox->GetCurrentSelection();
if( ii < 0 ) if( ii < 0 )
return; return;
m_unit = ii + 1; m_unit = ii + 1;
...@@ -132,16 +132,16 @@ void LIB_VIEW_FRAME::SelectCurrentLibrary() ...@@ -132,16 +132,16 @@ void LIB_VIEW_FRAME::SelectCurrentLibrary()
m_libraryName = Lib->GetName(); m_libraryName = Lib->GetName();
DisplayLibInfos(); DisplayLibInfos();
if( m_LibList ) if( m_libList )
{ {
ReCreateListCmp(); ReCreateListCmp();
m_canvas->Refresh(); m_canvas->Refresh();
DisplayLibInfos(); DisplayLibInfos();
ReCreateHToolbar(); ReCreateHToolbar();
int id = m_LibList->FindString( m_libraryName.GetData() ); int id = m_libList->FindString( m_libraryName.GetData() );
if( id >= 0 ) if( id >= 0 )
m_LibList->SetSelection( id ); m_libList->SetSelection( id );
} }
} }
} }
...@@ -234,11 +234,11 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag ) ...@@ -234,11 +234,11 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( CMP_LIBRARY* Lib, int Flag )
Zoom_Automatique( false ); Zoom_Automatique( false );
m_canvas->Refresh( ); m_canvas->Refresh( );
if( m_CmpList ) if( m_cmpList )
{ {
int id = m_CmpList->FindString( m_entryName.GetData() ); int id = m_cmpList->FindString( m_entryName.GetData() );
if( id >= 0 ) if( id >= 0 )
m_CmpList->SetSelection( id ); m_cmpList->SetSelection( id );
} }
ReCreateHToolbar(); ReCreateHToolbar();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment